Skip to content

feat: add filesystem navigation commands (/cd, /ls, /pwd, /new)#1

Open
huanglx27 wants to merge 11 commits intobishenghua:mainfrom
huanglx27:feature/filesystem-navigation-commands
Open

feat: add filesystem navigation commands (/cd, /ls, /pwd, /new)#1
huanglx27 wants to merge 11 commits intobishenghua:mainfrom
huanglx27:feature/filesystem-navigation-commands

Conversation

@huanglx27
Copy link
Copy Markdown

Summary

This PR adds four Unix-style filesystem commands to the IM interface (Telegram/QQ) to allow dynamic directory navigation and session management:

  • /pwd: Show the current working directory.
  • /cd <path>: Change the current working directory (supports ~, absolute, and relative paths).
  • /ls [path]: List directory contents (with emoji indicators for dirs/files).
  • /new: Clear session history and start fresh in the current directory.

Technical Changes

  • Added a thread-safe cwd map to the Lazycoding struct to track per-conversation working directories.
  • Updated dispatch and sessionKey to use the dynamic currentDir() instead of static configuration.
  • Added a full implementation of /cd with path validation and /ls with formatted output.
  • Included unit tests in internal/lazycoding/lazycoding_test.go.

Test plan

  • Verified /pwd returns the initial work directory.
  • Verified /cd successfully changes the path and /pwd reflects it.
  • Verified /ls correctly lists and formats files/directories.
  • Verified /new resets the Claude session while maintaining the current cd location.
  • Ran go test ./internal/lazycoding/... - All tests passed.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant