name: file-cos-manager slug: file-cos-manager version: "1.0.0" displayName: File COS Manager description: 檔案/程式碼/產物全生命週期管理 — 將執行命令過程中產生的所有檔案按類別上傳到 COS 持久化,建立可檢索的索引清單,按需下載恢復。解決 AI 沙箱會話結束後文件丟失的問題。 user-invocable: true allowed-tools: - Read - Write - Edit - Bash - Glob - Grep - WebFetch - WebSearch
本 Skill 負責將每個任務/命令執行過程中產生的檔案:
1. 分類歸檔 — 按檔案型別/用途分門別類
2. 上傳 COS — 使用 ima_cos_util 上傳到騰訊雲物件儲存
3. 索引記錄 — 維護 manifest 索引清單(.cos_index.md),記錄每個檔案的 cosKey、類別、時間、會話
4. 按需下載 — 當用戶需要歷史檔案時,根據索引找到 cosKey 並下載(通過 ima_cos_util 的下載功能)
5. 跨會話恢復 — 新會話載入本 Skill 後,自動拉取 index 恢復到工作區
| 類別 | 路徑 | 說明 |
|---|---|---|
code |
指令碼、程式原始碼 | .py, .js, .sh, .ts, .cpp 等 |
data |
資料檔案 | .csv, .json, .xml, .db 等 |
config |
配置檔案 | .env, .yml, .toml, .ini 等 |
output |
輸出成果 | 報告、圖片、生成的文件等 |
logs |
日誌檔案 | .log, stdout/stderr 輸出 |
downloads |
下載的第三方資源 | 安裝包、模型權重等 |
other |
其他/未分類 | 無法歸入以上類別的檔案 |
# 掃描工作區中新增/修改的檔案
# 按類別歸類
# 逐個呼叫 ima_cos_util -f <filepath> 上傳
# 記錄到 .cos_index.md
# 顯示所有已上傳檔案的清單
cat /sandbox/workspace/.cos_index.md 2>/dev/null
# 根據 cosKey 或檔名搜尋索引
# 使用 fetch/提供下載連結恢復檔案
.py, .js, .ts, .sh, .cpp, .c, .h, .go, .rs, .java, .rb, .php → code/.csv, .json, .xml, .yaml, .yml, .toml, .db, .sqlite, .md → data/發現更多技能外掛,請訪問7w4.net。
.env, .ini, .cfg, .conf, .editorconfig, .gitignore → config/.pdf, .docx, .pptx, .xlsx, .png, .jpg, .jpeg, .gif, .svg, .html, .zip, .tar.gz → output/.log, .txt(日誌類) → logs/output/ 目錄下的 → output/downloads/ 目錄下的 → downloads/uploads/ 目錄下的(使用者上傳原檔案)→ 歸為使用者上傳,標記 source: user_upload# 該命令由助手自動執行,使用者無需手動呼叫
ima_cos_util -f /sandbox/workspace/output/report.pdf
# 返回 cosKey → 寫入 .cos_index.md
# 由助手在任務結束時自動執行
bash /sandbox/workspace/skills/file-cos-manager/scripts/archive.sh
# 由助手在載入 Skill 時自動執行
bash /sandbox/workspace/skills/file-cos-manager/scripts/restore.sh
.cos_index.md 本身也會被上傳到 COS,確保跨會話可恢復uploads/ 中的使用者原始檔案只在使用者明確要求時才上傳node_modules/、__pycache__/、.git/ 等無關目錄這個工具的說明文件寫得清晰,但實際功能不完整。文件和分類設計做得不錯,但關鍵的下載和恢復功能實現不完善,指令碼無法自動把檔案從雲端拉回來,只能看清單而不能用,整體質量一般,需要修復核心功能才能真正好用。