feat(cli): add -C / --cd <dir> to set the working directory (Codex parity)#148
Merged
Conversation
…rity) Codex's `-C`/`--cd` runs the agent against a directory other than the shell's cwd; DeepCode had no equivalent — every path was hardwired to process.cwd(). Parse `-C`/`--cd` and chdir once in main() after the --help/--version short-circuit but before any subcommand/REPL/headless path reads cwd, so a single chdir covers them all. A non-existent directory fails fast with exit 2. Adds parser tests for -C/--cd and documents the flag in --help. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
5 tasks
oratis
added a commit
that referenced
this pull request
Jun 4, 2026
…code (#154) * docs(behavior-parity): audit slash-command + CLI-flag tables against code Reconcile docs/BEHAVIOR_PARITY.md with the actual source. Verified every row in the Slash-commands, CLI-flags, and Tools tables by grepping the code rather than trusting the doc. Slash commands (apps/cli/src/commands.ts BUILTIN_COMMANDS): - /init 🔄 → ✅ — runInitFlow is a real 3-phase REPL flow (scan → draft → approve-write AGENTS.md), wired in repl.ts; no longer a stub. - /bug ✗ → ✅ and /release-notes ✗ → ✅ — both registered since PR #150. - /upgrade ✓/🟡 → ✗/🔄 — there is no /upgrade slash command; it is the `deepcode upgrade` CLI subcommand (cli.ts) that prints an upgrade hint. - add missing rows: /diff (✅, PR #150) and /keybindings (🆕, DeepCode-only). - /effort wording: CLI prints the EFFORT_PARAMS-derived tier table (PR #147). - header count ~20 → ~28 shipped. - genuinely-missing commands kept 🔄 (/btw /recap /voice /teleport /desktop /background /batch /tasks /plan /login /logout /pr_comments /terminal-setup /privacy-settings /migrate-installer); skill-backed kept 🟡 (/review, /security-review, /schedule, /loop — skills confirmed under packages/core/skills). CLI flags (apps/cli/src/parse-args.ts + cli.ts): - split `--mode` / `--permission-mode`: the latter is parsed + validated but never consumed (cli.ts forwards only args.mode) → 🔄 not wired. - add `-C` / `--cd <dir>` (✅, wired via process.chdir in cli.ts, PR #148). Tools table (de-staled by PR #151) re-verified row-by-row — all markers hold: TaskTool + ctx.runSubAgent (agent.ts), all 7 TASK_TOOLS, NotebookEdit, AskUserQuestion, Enter/ExitPlanMode, Enter/ExitWorktree, ToolSearch, Cron*; ScheduleWakeup correctly⚠️ (not a tool — use CronCreate). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * docs(behavior-parity): fix /keybindings — it's a Claude Code built-in, not DeepCode-only Verified against Claude Code's built-in command set: /keybindings ships in Claude Code ("open or create your keybindings config file"). DeepCode's /keybindings only lists bindings (read-only; edit ~/.deepcode/keybindings.json by hand), so mark it ✓ / ✓ (read-only) / 🟡 — same shape as /config and /permissions — rather than 🆕 DeepCode-only. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: t <t@t> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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
OpenAI Codex's
-C/--cd <dir>runs the agent against a directory other than the shell's cwd. DeepCode had no equivalent — every path (REPL, headless,mcp/trust/plugins/skillssubcommands,doctor) was hardwired toprocess.cwd(). This parses-C/--cdandchdirs once inmain()after the--help/--versionshort-circuit but before anything reads cwd, so one chdir covers every path. A non-existent directory fails fast with exit code 2.Test plan
pnpm typecheckpnpm --filter deepcode-cli test— 103 passing, incl. 2 new parser tests for-C/--cdprettier --check+eslintcleanDocumentation
--helptext updated inline (new WORKING DIRECTORY section).docs/cli-flags.md+BEHAVIOR_PARITY.mdflag tables are stale across the board and synced in a separate docs PR.Release notes label
release-notes:featureRelated
Codex/Claude Code/DeepCode capability-alignment review. Codex parity:
-C/--cd.