file-browser

👤 nagilem 📦 v1.0.0 ⭐ 4.1 ⬇️ 2.2K 下載
💻 開發程式設計 免費

📖 技能介紹


name: file-browser description: Read-only file browsing and reading in the OpenClaw workspace (/home/alfred/.openclaw/workspace). Use for listing directories or reading text files (up to 10k chars). Triggers on queries like "list files in [dir]", "read file [path]", "browse workspace [path]". Restrict to relative paths; reject absolutes or ../ escapes. NOT for writing, deleting, executing, or non-workspace access.


File Browser Skill

Quick Start

Resolve all paths relative to WORKSPACE=/home/alfred/.openclaw/workspace. Sanitize inputs to prevent escapes or absolutes.

  • To list directory: exec("scripts/list_files.sh", [rel_path]) → JSON {success: bool, data: array of names, error: string}
  • To read file: exec("scripts/read_file.sh", [rel_path]) → JSON {success: bool, data: string (text content), error: string}
  • Handle errors: For binary/large/non-text files, return error JSON.

Step-by-Step Workflow

  1. Parse user query for action (list/read) and relative path.
  2. Call appropriate script with sanitized rel_path.
  3. Parse JSON output; respond to user with results or error message.
  4. If path invalid or outside workspace, reject immediately.

Safety Guidelines

7w4.net小蔥技能。

  • Enforce read-only: No writes, deletes, or exec beyond scripts.
  • Log accesses if verbose mode enabled.
  • For large files (>10k chars), truncate or summarize.

Edge Cases

  • Empty path: Default to "." (workspace root).
  • Binary file: Return error "Non-text file".
  • See references/examples.md for more (if added).

Bundled Resources

  • scripts/list_files.sh: Bash wrapper for ls.
  • scripts/read_file.sh: Bash wrapper for cat with limits.

🤖 AI 評測

這個工具質量中規中矩,基本功能完善,安全防護也做得不錯,錯誤提示清晰明瞭。優點是操作簡單、使用門檻低,路徑穿越等安全隱患也做了防範。主要問題是偶爾會出現輸出格式異常,另外缺少使用示例,對新使用者不太友好。總體來說是一個實用可用的工具,但在細節處理和文件完善上還有提升空間。

📊 多維度評分

適應性4.4
規範性3.9
有效性4.1
可靠性4.1
可信度4.4

📁 包含檔案 (5 個)

📄 SKILL.md 1.6 KB
📄 _meta.json 131 B
📄 scripts/list_files.sh 448 B
📄 scripts/read_file.sh 509 B
📄 skill-card.md 1.5 KB