Skip to content

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

Merged
juliusmarminge merged 1 commit intomainfrom
cursor/cli-cwd-argument-bbab
Apr 4, 2026
Merged

feat(cli): allow optional positional cwd argument#1727
juliusmarminge merged 1 commit intomainfrom
cursor/cli-cwd-argument-bbab

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Apr 3, 2026

What Changed

  • Added an optional positional cwd argument to the t3 CLI command.
  • Updated server config resolution to use the provided positional cwd when present, otherwise fallback to process.cwd().
  • Normalized the cwd via home expansion + absolute resolution, and ensured the target cwd directory is created recursively if it does not exist.
  • Updated CLI config tests to include the new argument shape and verify custom cwd directory creation behavior.

Why

The CLI previously always hardcoded cwd to process.cwd(), which prevented commands like npx t3 ~/Developer/my-project from targeting a specific project directory. This change enables explicit cwd selection while preserving existing default behavior and ensuring missing directories are upserted automatically.

Testing

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run --cwd apps/server test src/cli-config.test.ts src/cli.test.ts

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes
Open in Web Open in Cursor 

Note

Add optional positional cwd argument to the server CLI

  • The CLI now accepts an optional positional argument cwd to set the working directory for provider sessions, defined in cli.ts.
  • resolveServerConfig expands home directory tokens, resolves the path to absolute, and creates the directory recursively if it does not exist; previously config.cwd was always process.cwd().
  • Behavioral Change: when cwd is provided, the resolved config's cwd reflects the supplied path rather than the process working directory.

Macroscope summarized 0acaf5d.

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

coderabbitai bot commented Apr 3, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8f64d723-5b0f-4d36-ad32-690ffe333efd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/cli-cwd-argument-bbab

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

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 3, 2026
@juliusmarminge juliusmarminge marked this pull request as ready for review April 4, 2026 00:38
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 4, 2026

Approvability

Verdict: Approved

Small CLI enhancement adding an optional cwd argument with home path expansion and automatic directory creation. The change is self-contained with appropriate test coverage, and the author is the primary maintainer of this codebase.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge merged commit 27c2b14 into main Apr 4, 2026
17 checks passed
@juliusmarminge juliusmarminge deleted the cursor/cli-cwd-argument-bbab branch April 4, 2026 02:49
aaditagrawal pushed a commit to aaditagrawal/t3code that referenced this pull request Apr 5, 2026
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
aaditagrawal added a commit to aaditagrawal/t3code that referenced this pull request Apr 5, 2026
…argument

Merge upstream: feat(cli) allow optional positional cwd argument (pingdotgg#1727)
gigq pushed a commit to gigq/t3code that referenced this pull request Apr 6, 2026
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Chrono-byte pushed a commit to Chrono-byte/t3code that referenced this pull request Apr 7, 2026
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). 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