@@ -48,6 +48,7 @@ import {
4848} from "../startupAccess.ts" ;
4949import { authScopesFlag } from "./authScopes.ts" ;
5050import { baseDirFlag , DurationFromString } from "./config.ts" ;
51+ import { resolveHostCliCommand } from "./invocation.ts" ;
5152
5253const WELL_KNOWN_ENVIRONMENT_PATH = "/.well-known/t3/environment" ;
5354const PAIR_PROBE_TIMEOUT = Duration . millis ( 2_500 ) ;
@@ -65,6 +66,8 @@ export class NoRunningServerError extends Schema.TaggedError<NoRunningServerErro
6566 {
6667 checkedStatePaths : Schema . Array ( Schema . String ) ,
6768 inLinkedWorktree : Schema . Boolean ,
69+ serveCommand : Schema . String ,
70+ connectCommand : Schema . String ,
6871 } ,
6972) {
7073 override get message ( ) : string {
@@ -74,7 +77,7 @@ export class NoRunningServerError extends Schema.TaggedError<NoRunningServerErro
7477 ...( this . inLinkedWorktree
7578 ? [ "In a linked worktree, pass --base-dir to pair with a server outside it." ]
7679 : [ ] ) ,
77- " Start one with `npx t3 serve `, or connect this machine with T3 Connect: `npx t3 connect`." ,
80+ ` Start one with \` ${ this . serveCommand } \ `, or connect this machine with T3 Connect: \` ${ this . connectCommand } \`.` ,
7881 ] . join ( "\n" ) ;
7982 }
8083}
@@ -245,7 +248,8 @@ const discoverPairTarget = Effect.fn("pair.discoverPairTarget")(function* (
245248) {
246249 const bases : Array < string > = [ ] ;
247250 let inLinkedWorktree = false ;
248- if ( explicitBaseDir !== undefined && explicitBaseDir . trim ( ) . length > 0 ) {
251+ const hasExplicitBaseDir = explicitBaseDir !== undefined && explicitBaseDir . trim ( ) . length > 0 ;
252+ if ( hasExplicitBaseDir ) {
249253 bases . push ( yield * resolveBaseDir ( explicitBaseDir ) ) ;
250254 } else {
251255 // Same precedence as dev-runner: inside a linked worktree only its own
@@ -292,7 +296,13 @@ const discoverPairTarget = Effect.fn("pair.discoverPairTarget")(function* (
292296 } satisfies DiscoveredPairTarget ;
293297 }
294298 }
295- return yield * new NoRunningServerError ( { checkedStatePaths, inLinkedWorktree } ) ;
299+ const baseDirArgs = hasExplicitBaseDir ? [ "--base-dir" , explicitBaseDir ] : [ ] ;
300+ return yield * new NoRunningServerError ( {
301+ checkedStatePaths,
302+ inLinkedWorktree,
303+ serveCommand : ( yield * resolveHostCliCommand ( "serve" , baseDirArgs ) ) . command ,
304+ connectCommand : ( yield * resolveHostCliCommand ( "connect" , baseDirArgs ) ) . command ,
305+ } ) ;
296306} ) ;
297307
298308/** Use the discovered state directory, independent of ambient config variables. */
0 commit comments