mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-06 06:58:21 +00:00
- [x] Explore repository structure and understand existing tools pattern - [x] Create tools_readdir.go file with read_dir tool implementation - [x] Add GetReadDirToolDefinition() function following the pattern of read_text_file - [x] Register the new tool in tools.go GenerateTabStateAndTools function - [x] Create comprehensive tests in tools_readdir_test.go - [x] Test the implementation manually with various scenarios - [x] Run Go tests to ensure no regressions - [x] Run security check with CodeQL - No vulnerabilities found - [x] Revert unintended changes to tsunami demo go.mod and go.sum files - [x] Fix sorting to happen before truncation and preserve real total count ## Summary Successfully implemented a new `read_dir` AI tool that reads and lists directory contents, following the same pattern as the existing `read_text_file` tool. **Key Features:** - Supports path expansion (including ~) - Sorts directories first, then files (sorting happens BEFORE truncation) - Truncates output to prevent overwhelming responses (default 1000 entries) - Preserves the real total count even when truncated - Requires user approval for security - Provides detailed file/directory information (name, type, size, permissions, modification time) - Returns both structured data and formatted listing **Files Changed:** - `pkg/aiusechat/tools_readdir.go` - Main implementation (189 lines) - `pkg/aiusechat/tools_readdir_test.go` - Comprehensive tests (211 lines) - `pkg/aiusechat/tools.go` - Tool registration (1 line) **Testing:** - ✅ All 6 unit tests passing (including new test for sort-before-truncate) - ✅ Manual testing with real directories successful - ✅ CodeQL security scan passed with no vulnerabilities - ✅ Go build and vet successful <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > Right now we have AI tools in go at pkg/aichat ... see tools.go, tools_readfile.go. i'd like to add a new tool to read directories in the style of readfile. </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> Co-authored-by: sawka <mike@commandline.dev> |
||
|---|---|---|
| .. | ||
| aiusechat | ||
| authkey | ||
| blockcontroller | ||
| blocklogger | ||
| docsite | ||
| eventbus | ||
| faviconcache | ||
| filestore | ||
| genconn | ||
| gogen | ||
| ijson | ||
| panichandler | ||
| remote | ||
| schema | ||
| service | ||
| shellexec | ||
| suggestion | ||
| telemetry | ||
| trimquotes | ||
| tsgen | ||
| userinput | ||
| util | ||
| utilds | ||
| vdom | ||
| waveai | ||
| waveapp | ||
| wavebase | ||
| waveobj | ||
| wcloud | ||
| wconfig | ||
| wcore | ||
| web | ||
| wps | ||
| wshrpc | ||
| wshutil | ||
| wsl | ||
| wslconn | ||
| wstore | ||