feat(cli): add configurable plansDirectory for Plan Mode#4062
Open
shenyankm wants to merge 2 commits into
Open
feat(cli): add configurable plansDirectory for Plan Mode#4062shenyankm wants to merge 2 commits into
shenyankm wants to merge 2 commits into
Conversation
Add a plansDirectory setting that allows users to define a custom directory for approved Plan Mode files. Relative paths are resolved against the project root and validated to prevent path traversal. - Storage: add isPathWithinDirectory() with realpathSync-based symlink resolution to prevent traversal bypass attacks (direct, intermediate, and cross-drive) - Config: cache plansDir at construction time, use atomic write (write-temp then rename) to prevent corrupted plan files on crash - CLI: respect bareMode by clearing plansDirectory in minimal mode - Docs: document plansDirectory with requiresRestart and gitignore hint - Tests: 26 new tests covering path validation, symlink attacks (direct and intermediate), Windows cross-drive paths, mixed separators, and configuration integration Closes QwenLM#3548
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
plansDirectorysetting for Plan Mode so approved plan files can be stored in a project-specific directory instead of always using the global default.plansDirectoryis unset.Validation
Commands run:
Prompts / inputs used: N/A. This change was validated through focused configuration and storage tests rather than manual TUI interaction.
Expected result:
plansDirectoryvalues resolve from the project root.~/.qwen/planswhen unset.Observed result:
npm run buildcompleted successfully.npm run typecheckcompleted successfully.Quickest reviewer verification path:
"plansDirectory": "./.qwen/plans"to project.qwen/settings.json..qwen/plans."../plans"and confirm startup fails with a configuration error.Evidence:
Scope / Risk
plansDirectoryis unset.Testing Matrix
Testing matrix notes:
Linked Issues / Bugs
Closes #3548