Skip to content

Commit ec4c91c

Browse files
saphidclaude
authored andcommitted
fix(cli): t3 up's pairing hint keeps --base-dir
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 55e2538 commit ec4c91c

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎apps/server/src/cli/up.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NetService.layer))("t3 up", (it) =>
180180
},
181181
{
182182
label: "the local network opens",
183+
prints: "Run `t3 pair --base-dir <baseDir>`.",
183184
installed: true,
184185
env: "T3CODE_LAN=false\n",
185186
args: ["--lan"],
@@ -335,7 +336,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NetService.layer))("t3 up", (it) =>
335336
),
336337
);
337338
if (input.prints !== undefined) {
338-
expect(lines.join("\n")).toContain(input.prints);
339+
expect(lines.join("\n")).toContain(input.prints.replace("<baseDir>", baseDir));
339340
}
340341
expect(exit._tag).toBe(input.restartFails === true ? "Failure" : "Success");
341342
expect({ installs, restarts }).toEqual({

‎apps/server/src/cli/up.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ const formatSetup = (setup: Setup) => {
171171
].join("\n");
172172
};
173173

174-
const formatNextSteps = (routes: Routes, serviceInstalled: boolean) =>
174+
const formatNextSteps = (routes: Routes, serviceInstalled: boolean, pairCommand: string) =>
175175
[
176176
...(routes.connect
177177
? ["On your other device, sign in to T3 Connect with the same account."]
178178
: []),
179-
...(routes.lan ? ["Run `t3 pair`. Use the code on your other device."] : []),
179+
...(routes.lan ? [`Run \`${pairCommand}\`. Use the code on your other device.`] : []),
180180
...(routes.connect || routes.lan
181181
? []
182182
: [
@@ -197,6 +197,11 @@ const setUp = Effect.fn("cli.up")(function* (flags: {
197197
}) {
198198
const { baseDir } = yield* ServerConfig.ServerConfig;
199199
const service = yield* BootService.BootService;
200+
const baseDirArgs = Option.match(flags.baseDir, {
201+
onNone: () => [],
202+
onSome: (dir) => ["--base-dir", dir],
203+
});
204+
const { command: pairCommand } = yield* resolveHostCliCommand("pair", baseDirArgs);
200205
const before = yield* readSetup();
201206
if (before.connect === null && Option.getOrElse(flags.connect, () => false)) {
202207
return yield* new CliError.UserError({
@@ -252,7 +257,7 @@ const setUp = Effect.fn("cli.up")(function* (flags: {
252257
yield* disconnectCloud({ clearAuthorization: false });
253258
}
254259
if (current.lan) yield* CliService.writeServiceEnv(baseDir, { T3CODE_LAN: "false" });
255-
return yield* Console.log(formatNextSteps(routes, false));
260+
return yield* Console.log(formatNextSteps(routes, false, pairCommand));
256261
}
257262
const { installedVersion } = before.service;
258263
const newer =
@@ -327,7 +332,7 @@ const setUp = Effect.fn("cli.up")(function* (flags: {
327332

328333
const printServeCommand = Effect.fn(function* (reason: string) {
329334
const { command } = yield* resolveHostCliCommand("serve", [
330-
...Option.match(flags.baseDir, { onNone: () => [], onSome: (dir) => ["--base-dir", dir] }),
335+
...baseDirArgs,
331336
// Explicit either way, so a T3CODE_LAN in the shell cannot override the choice.
332337
routes.lan ? "--lan" : "--no-lan",
333338
]);
@@ -408,6 +413,7 @@ const setUp = Effect.fn("cli.up")(function* (flags: {
408413
`\nThis machine\n${formatSetup(after)}\n\n${formatNextSteps(
409414
{ connect: after.connect === true, lan: after.lan },
410415
after.service.installed,
416+
pairCommand,
411417
)}`,
412418
);
413419
});

0 commit comments

Comments
 (0)