Skip to content

fix(cli): t3 up and t3 status hints keep --base-dir - #31878

Open
spoukyii wants to merge 2 commits into
pingdotgg:mainfrom
spoukyii:users/spoukyii/up-status-hints-keep-base-dir
Open

spoukyii wants to merge 2 commits into
pingdotgg:mainfrom
spoukyii:users/spoukyii/up-status-hints-keep-base-dir

Conversation

@spoukyii

@spoukyii spoukyii commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Problem

t3 up --base-dir <dir> and t3 status --base-dir <dir> still print four hints that drop --base-dir: "Run t3 to use T3 Code here.", "Run t3 connect." for a revoked link, "Turn it off: t3 up --no-lan." for the old LAN default, and t3 status's "Change access: t3 up." Each bare command runs against the default ~/.t3 home, not the one you asked about.

To see it on a Linux machine with no T3 Code service installed:

t3 status --base-dir /tmp/t3-other      # ends with: Change access: `t3 up`.
t3 up --base-dir /tmp/t3-other --no-lan  # ends with: Remote access is off. Run `t3` to use T3 Code here.

Change

In apps/server/src/cli/up.ts, a new resolveHints resolves every command these hints name once, through resolveHostCliCommand with the caller's --base-dir. formatSetup (shared by t3 up and t3 status) and formatNextSteps take that result instead of hard-coding bare t3 commands. The pairing hint (#29684) and the retry hint (#30480) now read from the same object. The retry hint is now resolved up front with the rest rather than only on the branch that prints it, since t3 status needs the same up command. The serve and service restart hints still resolve on the branch that prints them.

With the fix the hints read t3 --base-dir <dir>, t3 connect --base-dir <dir>, t3 up --base-dir <dir> --no-lan and t3 up --base-dir <dir>. The root command and t3 connect both take --base-dir. Like the other resolved hints, they also print the runner form (npx t3@… up) or this install's launcher when that is how the CLI ran. Run as plain t3 with no --base-dir, the text is unchanged. t3 status --json prints no hints and skips the lookup.

resolveHostCliCommand builds t3 <subcommand>, so the empty subcommand for the root command used to leave a trailing space (t3 / t3 --base-dir …). In apps/server/src/cli/invocation.ts it now trims that before joining the arguments.

Scope and approval

This is the follow-up #30480 ("t3 up's retry and restart hints keep --base-dir") named and left out. Its body says: "Three bare hints that t3 up --base-dir can still print are left for a follow-up, because two of them come from formatSetup, which t3 status shares: "Run t3 connect.", "t3 up --no-lan" and "Run t3 to use T3 Code here."" #29684 fixed the pairing hint the same way. t3 status's "Change access: t3 up." is the same defect in the same output, so it is included.

It is a small, focused fix for an obvious bug: printed hints only, with no contract, setting or other behaviour change. No open PR changes these hints. #23878 edits nearby lines in up.ts for a different problem (a service that belongs to another home). #25417 edits invocation.ts but not this function's argument join.

Verification

Two cases in apps/server/src/cli/up.test.ts. The existing table row a route turns off with no service to run already runs t3 up --base-dir <baseDir> --no-lan and now also checks its last hint. A new t3 status names commands that keep --base-dir case runs t3 status --base-dir <baseDir> against an installed service with an empty service.env (the old LAN default) and checks the "Turn it off" note and the "Change access" line. The revoked-link hint has no case of its own: it needs a T3 Connect build config and a revoked-link secret, which this table does not set up. It reads hints.connect from the same resolveHints call.

On main with only the test commit, vp test run src/cli/up.test.ts (from apps/server):

× restarts the service only when it must: a route turns off with no service to run
× t3 status names commands that keep --base-dir
Expected: "Run `t3 --base-dir C:/Users/…/t3-up-test-SwIhYn` to use T3 Code here."
Received: "Remote access is off. Run `t3` to use T3 Code here."
  actual: '…Older installs keep LAN access on. Turn it off: `t3 up --no-lan`.\n\nChange access: `t3 up`.'
Tests  2 failed | 21 passed (23)

With the fix: Tests 23 passed (23).

These runs were on Windows with two uncommitted test edits that make it behave like CI: the platform set to linux and the temp baseDir written with forward slashes. Without them, the #29684 and #30480 rows already fail on main, because resolveHostCliCommand quotes each word for PowerShell, and the two cases here fail the same way. On Windows the fixed output is Change access: `t3 up "--base-dir" "C:\…\t3-status-test-6MAeri"`., so the flag does reach the hint there too. CI runs the server tests on Ubuntu.

vp run check:changed: format, lint, knip, graphql and typecheck pass. Its test step fails only on the Windows quoting rows above and on two invocation.test.ts cases (npm-global launcher detection) that also fail on main on Windows.

A real t3 status --base-dir run from the source CLI, on Windows with no T3 Code service installed, before and after (it only reads state):

main:   Change access: `t3 up`.
branch: Change access: `& "C:\Users\…\.t3\bin\t3.cmd" up "--base-dir" "C:\Users\…\Temp\tmp.E4TFLSJIzq"`.

On Windows the command prints in this machine's PowerShell launcher form, as the pairing hint already does.

Not checked: a real t3 up run, which would replace this machine's service, and the revoked-link hint in a T3 Connect build.

Bug: t3 up and t3 status hints drop --base-dir

This was written with Claude Opus 5.5 in Claude Code, driven from T3 Code.

pingdotgg#29684 and pingdotgg#30480 made three of the hints `t3 up --base-dir <dir>` prints
carry the flag. The rest still named bare commands that run against the
default ~/.t3 home: "Run `t3` to use T3 Code here." after turning remote
access off with no service, and, in the setup summary `t3 status` shares,
"Run `t3 connect`." for a revoked link, "Turn it off: `t3 up --no-lan`."
for the old LAN default, and `t3 status`'s own "Change access: `t3 up`."

Every hint now comes from one resolveHints call that runs each command
through resolveHostCliCommand with the caller's --base-dir, so the setup
summary and next steps name the same home and launcher as the pairing
hint. resolveHostCliCommand trims the empty subcommand that names the
root `t3` command.

Bug: t3 up and t3 status hints drop --base-dir
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 6, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 768168a

Macroscope's review found this PR approvable — Setup and status hints now preserve the selected base directory and launcher, reducing the chance of follow-up commands targeting another installation. Service behavior, access defaults, and JSON status output remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Setup and non-JSON status output now use command hints resolved with the caller’s base directory and launcher. The JSON status output remains unchanged. Command construction trims trailing whitespace from its prefix.

Changes: CLI command hints

Layer / File(s) Summary
Resolve and format command hints
apps/server/src/cli/invocation.ts, apps/server/src/cli/up.ts
Command prefixes are trimmed before arguments are added. Setup and next-step formatters accept resolved hints for run, pair, up, no-LAN, and connect commands.
Use hints in setup and status output
apps/server/src/cli/up.ts, apps/server/src/cli/up.test.ts
Setup and non-JSON status output use the resolved hints in their instructions. Tests check base-directory-aware commands, including commands to turn off LAN access and change access.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: t3dotgg

Merge Risk: Minimal · up to 76816

The command hints now reflect the chosen base directory. No actionable issue remains after normal checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly identifies the CLI hint fix and its effect on --base-dir.
Description check Passed The description covers the problem, change, scope, and verification. It also identifies test failures and checks not performed.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2756da4 and 768168a.

Files selected for processing: 3

  • apps/server/src/cli/invocation.ts
  • apps/server/src/cli/up.test.ts
  • apps/server/src/cli/up.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant