Skip to content

feat(cli): polish --add-dir / --include-directories feature - #3856

Closed
B-A-M-N wants to merge 3 commits into
QwenLM:mainfrom
B-A-M-N:feat/add-dir-polish
Closed

feat(cli): polish --add-dir / --include-directories feature#3856
B-A-M-N wants to merge 3 commits into
QwenLM:mainfrom
B-A-M-N:feat/add-dir-polish

Conversation

@B-A-M-N

@B-A-M-N B-A-M-N commented May 5, 2026

Copy link
Copy Markdown
Contributor

Commit: a0daf50c065f48f793c357dc3a600ca60d4672c9 (a0daf50c0)

Summary

  • Added /directory remove subcommand with tab-completion, initial-directory guards, and workspace settings persistence
  • Added startup warning when --add-dir paths don't exist or aren't readable
  • Updated --add-dir CLI help text to document path resolution and skip behavior
  • Added WorkspaceContext.getSkippedDirectories() to track invalid paths

Why

The --add-dir / --include-directories feature had four rough edges:

  1. No way to remove a directory via slash command (only add + show existed)
  2. Invalid --add-dir paths were silently skipped with only a debug log
  3. Help text didn't mention path resolution or skip behavior
  4. WorkspaceContext had no way to report which paths were skipped

What Changed

  • packages/cli/src/ui/commands/directoryCommand.tsx: New remove subcommand with completion (filters out initial dirs), error handling for missing/initial dirs, and context.includeDirectories persistence
  • packages/cli/src/ui/commands/directoryCommand.test.tsx: 5 new tests covering remove validation, initial-dir guard, not-found, successful removal, and settings-write failure
  • packages/cli/src/config/config.ts: Improved --add-dir help text description
  • packages/cli/src/i18n/locales/en.js: 6 new i18n strings for the remove subcommand
  • packages/core/src/config/config.ts: Startup warning via process.stderr listing skipped --include-directories paths
  • packages/core/src/utils/workspaceContext.ts: skippedDirectories tracker in addDirectory(), exposed via getSkippedDirectories()
  • packages/core/src/utils/workspaceContext.test.ts: 4 new tests for getSkippedDirectories()

Validation

  • npx vitest run packages/core/src/utils/workspaceContext.test.ts — 48 tests passed
  • npx vitest run packages/cli/src/ui/commands/directoryCommand.test.tsx — 18 tests passed
  • npx vitest run packages/core/src/config/config.test.ts — 106 tests passed
  • npx vitest run packages/cli/src/config/config.test.ts — 188 tests passed (2 skipped, pre-existing)

Scope

  • Does not change any public API signatures
  • Does not alter the WorkspaceContext constructor behavior (only adds tracking)
  • Does not affect any other slash commands or CLI flags
  • .gitignore updated with PRForge artifact patterns (.prforge/, .prforge-run, .prforge-*)

Risk / Compatibility Notes

Low risk — isolated change with full regression coverage. The startup warning only writes to stderr when invalid paths are detected, so normal usage is unaffected.

B-A-M-N and others added 2 commits May 5, 2026 16:46
The model-driven relevance selector (selectRelevantAutoMemoryDocumentsByModel)
currently uses the main session model for its LLM call. Since this is a
background side-query that runs in parallel with the user's main request,
route it to config.getFastModel() instead — consistent with sessionRecap,
sessionTitle, toolUseSummary, and forkedAgent which all prefer the fast
model for background work.

When no fast model is configured, getFastModel() returns undefined and
runSideQuery falls back to config.getModel(), so behavior is unchanged
for users without a fast model set.

Co-Authored-By: Claude <noreply@anthropic.com>
Add /directory remove subcommand with tab-completion, initial directory
guards, and workspace settings persistence. Warn on startup when
--add-dir paths don't exist or aren't readable. Update CLI help text
to document path resolution and skip behavior. Track skipped paths in
WorkspaceContext via getSkippedDirectories().

Changes:
- directoryCommand.tsx: new 'remove' subcommand (action, completion, error handling)
- directoryCommand.tsx: remove persists to context.includeDirectories in settings
- directoryCommand.test.tsx: 5 new tests for remove subcommand
- config.ts (cli): improved --add-dir help text description
- en.js: 6 new i18n strings for remove subcommand
- config.ts (core): startup warning via process.stderr for invalid --add-dir paths
- workspaceContext.ts: track skipped directories, expose getSkippedDirectories()
- workspaceContext.test.ts: 4 new tests for getSkippedDirectories()
@B-A-M-N
B-A-M-N force-pushed the feat/add-dir-polish branch from a0daf50 to ecbbba1 Compare May 5, 2026 21:47
@B-A-M-N

B-A-M-N commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #3867 and #3868 (split PRs).

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