Skip to content

Merge upstream: feat(cli) allow optional positional cwd argument (#1727)#46

Merged
aaditagrawal merged 1 commit intomainfrom
merge/upstream-1727-cli-cwd-argument
Apr 5, 2026
Merged

Merge upstream: feat(cli) allow optional positional cwd argument (#1727)#46
aaditagrawal merged 1 commit intomainfrom
merge/upstream-1727-cli-cwd-argument

Conversation

@aaditagrawal
Copy link
Copy Markdown
Owner

@aaditagrawal aaditagrawal commented Apr 5, 2026

What

Cherry-picks upstream commit 27c2b145 (PR #1727) onto the fork.

Upstream changes

Adds an optional positional cwd argument to the CLI, allowing t3code /path/to/project to set the working directory. The server config resolution creates the directory if needed and resolves it to an absolute path.

Conflict resolution

None -- clean cherry-pick with no conflicts (2 files changed, +22/-3).

Verification

  • bun typecheck passes (all 7 packages)
  • cli-config.test.ts passes (6 tests)

Summary by CodeRabbit

  • New Features

    • Added optional cwd CLI argument to specify a custom server working directory. When provided, the server uses the designated directory (creating it if necessary). Defaults to the current process working directory when omitted.
  • Tests

    • Updated test cases to verify cwd resolution behavior for both default and custom values.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c6b6d821-abac-4a73-8c8a-4a3f7ecd27c3

📥 Commits

Reviewing files that changed from the base of the PR and between 24b27a0 and 9b45450.

📒 Files selected for processing (2)
  • apps/server/src/cli-config.test.ts
  • apps/server/src/cli.ts

📝 Walkthrough

Walkthrough

The pull request adds CLI support for an optional custom working directory argument. The server configuration now accepts a cwd parameter that is resolved to an absolute path with home directory expansion and creates the directory if needed, replacing reliance on the process working directory.

Changes

Cohort / File(s) Summary
CLI Configuration
apps/server/src/cli.ts
Added optional cwd CLI argument with home directory expansion and absolute path resolution. Updated CliServerFlags interface to include cwd: Option.Option<string>. Modified resolveServerConfig to process the custom cwd value with directory creation.
Test Updates
apps/server/src/cli-config.test.ts
Extended test inputs to include cwd option field across scenarios. Updated assertions to verify that resolved cwd equals process.cwd() for default cases and path.resolve(customCwd) for custom cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • aaditagrawal/t3code#28: Tests that a provider startSession receives the cwd value from ServerConfig in its payload.

Suggested labels

vouch:trusted, size:M

Poem

🐰 A warren needs its burrow deep,
Now CLI helps directories keep—
Home paths expand, resolve true and clear,
The cwd argument makes working dirs appear!
Hop along, rabbit code does bound!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: cherry-picking an upstream commit that adds an optional positional cwd argument to the CLI.
Description check ✅ Passed The description covers the template's required sections with clear explanations of what changed and why, though UI changes section is not applicable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch merge/upstream-1727-cli-cwd-argument

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 effective changed lines (test files excluded in mixed PRs). labels Apr 5, 2026
@aaditagrawal aaditagrawal merged commit a2e6f34 into main Apr 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants