@mycadet/cli 0.13.0-dev.202610200020.9f20440 → 0.13.0-dev.202610201855.522ff0d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/node_modules/@mycadet/assistant-api/constants/personality-sliders.test.ts +0 -8
  2. package/node_modules/@mycadet/assistant-api/constants/personality-sliders.ts +5 -41
  3. package/node_modules/@mycadet/assistant-api/events/message-complete.ts +0 -5
  4. package/node_modules/@mycadet/assistant-api/index.ts +0 -2
  5. package/node_modules/@mycadet/assistant-api/responses/conversation-message.ts +0 -10
  6. package/node_modules/@mycadet/environments/src/seeds.ts +6 -2
  7. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/seeds.ts +6 -2
  8. package/node_modules/@mycadet/local-mode/src/config.ts +0 -2
  9. package/node_modules/@mycadet/local-mode/src/index.ts +1 -1
  10. package/node_modules/@mycadet/local-mode/src/lockfile-contract.test.ts +1 -22
  11. package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +26 -7
  12. package/node_modules/@mycadet/local-mode/src/util.ts +1 -20
  13. package/node_modules/@mycadet/shared/github-repository.ts +5 -0
  14. package/node_modules/@mycadet/shared/package.json +10 -0
  15. package/node_modules/@mycadet/shared/scripts/run-isolated-tests.ts +700 -0
  16. package/package.json +3 -2
  17. package/src/__tests__/app-command.test.ts +164 -0
  18. package/src/__tests__/client-web-config.test.ts +0 -1
  19. package/src/__tests__/cloud-releases.test.ts +1 -1
  20. package/src/__tests__/local-version.test.ts +16 -0
  21. package/src/__tests__/nginx-ingress.test.ts +248 -630
  22. package/src/__tests__/ps-cloud-status.test.ts +85 -11
  23. package/src/__tests__/root-process-lockfile.test.ts +29 -2
  24. package/src/__tests__/tunnel-holder-heal.test.ts +119 -0
  25. package/src/__tests__/tunnel-stop.test.ts +6 -13
  26. package/src/__tests__/tunnel.test.ts +50 -193
  27. package/src/__tests__/wake.test.ts +6 -38
  28. package/src/__tests__/web-dist.test.ts +267 -89
  29. package/src/commands/app.ts +113 -0
  30. package/src/commands/backup.ts +5 -4
  31. package/src/commands/clean.ts +2 -1
  32. package/src/commands/client.ts +5 -68
  33. package/src/commands/completions.ts +12 -1
  34. package/src/commands/connect.ts +2 -1
  35. package/src/commands/debug.ts +2 -1
  36. package/src/commands/exec.ts +7 -6
  37. package/src/commands/gateway/token.ts +2 -1
  38. package/src/commands/gateway.ts +2 -1
  39. package/src/commands/hatch.ts +74 -80
  40. package/src/commands/login.ts +7 -6
  41. package/src/commands/logs.ts +2 -1
  42. package/src/commands/ps.ts +136 -6
  43. package/src/commands/restart.ts +2 -1
  44. package/src/commands/restore.ts +10 -9
  45. package/src/commands/retire.ts +4 -3
  46. package/src/commands/setup.ts +5 -4
  47. package/src/commands/sleep.ts +3 -2
  48. package/src/commands/teleport.ts +2 -1
  49. package/src/commands/terminal.ts +7 -6
  50. package/src/commands/tunnel.ts +196 -242
  51. package/src/commands/uninstall.ts +2 -1
  52. package/src/commands/upgrade.ts +2 -1
  53. package/src/commands/use.ts +2 -1
  54. package/src/commands/wake.ts +3 -2
  55. package/src/index.ts +5 -4
  56. package/src/lib/__tests__/web-dist.test.ts +1 -27
  57. package/src/lib/assistant-config.ts +101 -37
  58. package/src/lib/cli-name.ts +14 -0
  59. package/src/lib/cloud-client.ts +2 -1
  60. package/src/lib/cloud-login-poll.ts +2 -1
  61. package/src/lib/cloud-releases.ts +1 -1
  62. package/src/lib/docker.ts +32 -21
  63. package/src/lib/hatch-local.ts +1 -3
  64. package/src/lib/hatch-next-steps.ts +1 -9
  65. package/src/lib/ingress-config.ts +0 -31
  66. package/src/lib/local-version.ts +25 -4
  67. package/src/lib/local.ts +34 -9
  68. package/src/lib/nginx-ingress.ts +143 -244
  69. package/src/lib/provider-secrets.ts +0 -5
  70. package/src/lib/statefulset.ts +0 -1
  71. package/src/lib/tunnel.ts +244 -43
  72. package/src/lib/tunnels/ngrok.ts +57 -9
  73. package/src/lib/tunnels/tailscale.ts +2 -1
  74. package/src/lib/web-dist.ts +134 -56
  75. package/src/__tests__/flags.test.ts +0 -318
  76. package/src/__tests__/shell-mode.test.ts +0 -83
  77. package/src/commands/flags.ts +0 -255
  78. package/src/lib/flag-args.test.ts +0 -84
  79. package/src/lib/flag-args.ts +0 -74
  80. package/src/lib/github-repository.ts +0 -2
@@ -63,7 +63,6 @@ import {
63
63
  import { parseAssistantTargetArg } from "../lib/assistant-target-args.js";
64
64
  import { displayVersion } from "../lib/local-version.js";
65
65
  import cliPkg from "../../package.json";
66
- import { parseFeatureFlagArgs, readAmbientFlagEnvVars } from "../lib/flag-args";
67
66
  import {
68
67
  fetchOrganizationId,
69
68
  fetchCloudAssistants,
@@ -141,10 +140,6 @@ interface ParsedArgs {
141
140
  bearerToken?: string;
142
141
  /** Interface identifier sent as X-Cadet-Interface-Id on all requests. */
143
142
  interfaceId: SupportedInterface;
144
- /** CADET_FLAG_* env vars for the gateway (process.env propagation). */
145
- flagEnvVars: Record<string, string>;
146
- /** Parsed --flag overrides: kebab-case key -> typed value (for web injection). */
147
- parsedFlagOverrides: Record<string, boolean | string>;
148
143
  disableCloud: boolean;
149
144
  /** Auto-open the web interface in the default browser (--interface web only). */
150
145
  openBrowser: boolean;
@@ -176,30 +171,11 @@ function readWorkspaceRoot(entry: AssistantEntry | null): string | undefined {
176
171
 
177
172
  // Exported for unit testing the arg/auth resolution without launching the TUI.
178
173
  export function parseArgs(): ParsedArgs {
179
- const { envVars: cliFlagVars, remaining: argsWithoutFlags } =
180
- parseFeatureFlagArgs(process.argv.slice(3));
181
- const flagEnvVars = { ...readAmbientFlagEnvVars(), ...cliFlagVars };
182
174
  const disableCloudAmbient =
183
175
  process.env.CADET_DISABLE_CLOUD?.trim().toLowerCase();
184
176
  let disableCloud =
185
177
  disableCloudAmbient === "true" || disableCloudAmbient === "1";
186
- const args = argsWithoutFlags;
187
-
188
- // Build parsedFlagOverrides from the extracted env vars:
189
- // CADET_FLAG_UPPER_SNAKE -> kebab-case key with typed value.
190
- const parsedFlagOverrides: Record<string, boolean | string> = {};
191
- for (const [envName, rawValue] of Object.entries(flagEnvVars)) {
192
- const snake = envName.replace(/^CADET_FLAG_/, "");
193
- const kebab = snake.toLowerCase().replace(/_/g, "-");
194
- const lower = rawValue.toLowerCase();
195
- if (["true", "1", "yes", "on"].includes(lower)) {
196
- parsedFlagOverrides[kebab] = true;
197
- } else if (["false", "0", "no", "off"].includes(lower)) {
198
- parsedFlagOverrides[kebab] = false;
199
- } else {
200
- parsedFlagOverrides[kebab] = rawValue;
201
- }
202
- }
178
+ const args = process.argv.slice(3);
203
179
 
204
180
  const positionalName = parseAssistantTargetArg(args, [
205
181
  "--url",
@@ -368,8 +344,6 @@ export function parseArgs(): ParsedArgs {
368
344
  cloudToken,
369
345
  bearerToken,
370
346
  interfaceId,
371
- flagEnvVars,
372
- parsedFlagOverrides,
373
347
  disableCloud,
374
348
  openBrowser: openBrowserPref,
375
349
  webPort,
@@ -1301,13 +1275,11 @@ async function spawnBackgroundWebInterface(
1301
1275
  * report a false `foreign`. An absent id is deliberately benign to the probe.
1302
1276
  */
1303
1277
  export function buildWebInterfaceConfig(opts: {
1304
- webUrl: string;
1305
1278
  cloudUrl: string;
1306
1279
  version: string;
1307
1280
  }): Record<string, unknown> {
1308
- const { webUrl, cloudUrl } = opts;
1281
+ const { cloudUrl } = opts;
1309
1282
  return {
1310
- webUrl,
1311
1283
  cloudUrl,
1312
1284
  // Which CLI build is serving — the same string `cadet-local --version`
1313
1285
  // prints, so devtools and the settings page answer identically.
@@ -1316,26 +1288,15 @@ export function buildWebInterfaceConfig(opts: {
1316
1288
  }
1317
1289
 
1318
1290
  async function runWebInterface(
1319
- flagEnvVars: Record<string, string>,
1320
- parsedFlagOverrides: Record<string, boolean | string>,
1321
1291
  disableCloud: boolean,
1322
1292
  openInBrowser: boolean,
1323
1293
  webPort: number | undefined,
1324
1294
  ): Promise<void> {
1325
- // Propagate flag env vars so child processes (e.g. hatch from the web UI) inherit them.
1326
- Object.assign(process.env, flagEnvVars);
1327
-
1328
1295
  // Prefer Vite dev server in source checkouts for full local-mode support
1329
1296
  // (HMR, __local endpoints, gateway proxy).
1330
1297
  const webSourceDir = findWebSourceDir();
1331
1298
  if (webSourceDir) {
1332
- return runViteDevServer(
1333
- webSourceDir,
1334
- flagEnvVars,
1335
- disableCloud,
1336
- openInBrowser,
1337
- webPort,
1338
- );
1299
+ return runViteDevServer(webSourceDir, disableCloud, openInBrowser, webPort);
1339
1300
  }
1340
1301
 
1341
1302
  const distDir = findWebDistDir();
@@ -1351,23 +1312,17 @@ async function runWebInterface(
1351
1312
 
1352
1313
  const rawIndexHtml = await Bun.file(path.join(distDir, "index.html")).text();
1353
1314
  const cloudUrl = getCloudUrl();
1354
- const webUrl = getWebUrl();
1355
1315
  const safeJson = (v: unknown) =>
1356
1316
  JSON.stringify(v).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
1357
1317
  const configJson = safeJson(
1358
1318
  buildWebInterfaceConfig({
1359
- webUrl,
1360
1319
  cloudUrl,
1361
1320
  version: displayVersion(cliPkg.version),
1362
1321
  }),
1363
1322
  );
1364
- const hasOverrides = Object.keys(parsedFlagOverrides).length > 0;
1365
- const flagOverridesSnippet = hasOverrides
1366
- ? `;window.__CADET_FLAG_OVERRIDES__=${safeJson(parsedFlagOverrides)}`
1367
- : "";
1368
1323
  const indexHtml = rawIndexHtml.replace(
1369
1324
  "</head>",
1370
- `<script>window.__CADET_CONFIG__=${configJson}${flagOverridesSnippet}</script></head>`,
1325
+ `<script>window.__CADET_CONFIG__=${configJson}</script></head>`,
1371
1326
  );
1372
1327
 
1373
1328
  // The shell names this build's hashed chunks and carries the host's injected
@@ -1534,19 +1489,12 @@ async function runWebInterface(
1534
1489
 
1535
1490
  async function runViteDevServer(
1536
1491
  webSourceDir: string,
1537
- flagEnvVars: Record<string, string>,
1538
1492
  disableCloud: boolean,
1539
1493
  openInBrowser: boolean,
1540
1494
  webPort: number | undefined,
1541
1495
  ): Promise<void> {
1542
1496
  const cloudUrl = getCloudUrl();
1543
1497
 
1544
- // Build VITE_CADET_FLAG_* vars so Vite exposes them to the browser bundle.
1545
- const viteFlagVars: Record<string, string> = {};
1546
- for (const [envName, value] of Object.entries(flagEnvVars)) {
1547
- viteFlagVars[`VITE_${envName}`] = value;
1548
- }
1549
-
1550
1498
  // Auto-pick a free port (Vite uses strictPort) so a running `vel up` stack
1551
1499
  // on :3000 doesn't wedge dev. The loopback callback port follows
1552
1500
  // window.location.port, so a non-3000 port propagates automatically.
@@ -1562,10 +1510,7 @@ async function runViteDevServer(
1562
1510
  windowsHide: true,
1563
1511
  env: {
1564
1512
  ...process.env,
1565
- ...flagEnvVars,
1566
- ...viteFlagVars,
1567
1513
  ...(disableCloud ? { VITE_CADET_DISABLE_CLOUD: "true" } : {}),
1568
- VITE_CLOUD_MODE: "false",
1569
1514
  VITE_WEB_MODE: "full",
1570
1515
  API_PROXY_TARGET: cloudUrl,
1571
1516
  CADET_WEB_URL: getWebUrl(),
@@ -1650,8 +1595,6 @@ export const client = Object.assign(
1650
1595
  cloudToken,
1651
1596
  bearerToken,
1652
1597
  interfaceId,
1653
- flagEnvVars,
1654
- parsedFlagOverrides,
1655
1598
  disableCloud,
1656
1599
  openBrowser: openInBrowser,
1657
1600
  webPort,
@@ -1667,13 +1610,7 @@ export const client = Object.assign(
1667
1610
  await spawnBackgroundWebInterface(webPort);
1668
1611
  return;
1669
1612
  }
1670
- await runWebInterface(
1671
- flagEnvVars,
1672
- parsedFlagOverrides,
1673
- disableCloud,
1674
- openInBrowser,
1675
- webPort,
1676
- );
1613
+ await runWebInterface(disableCloud, openInBrowser, webPort);
1677
1614
  return;
1678
1615
  }
1679
1616
 
@@ -15,12 +15,17 @@ const ASSISTANT_NAME_COMMANDS = new Set([
15
15
  "sleep",
16
16
  "teleport",
17
17
  "terminal",
18
- "tunnel",
19
18
  "upgrade",
20
19
  "use",
21
20
  "wake",
22
21
  ]);
23
22
 
23
+ /** First-positional subcommands, for commands that take no assistant name. */
24
+ const SUBCOMMAND_COMPLETIONS: Record<string, string[]> = {
25
+ app: ["start", "stop"],
26
+ tunnel: ["start", "stop"],
27
+ };
28
+
24
29
  /** Assistant names known to this CLI's lockfile; [] when the lockfile is unreadable. */
25
30
  function assistantNames(): string[] {
26
31
  try {
@@ -64,6 +69,12 @@ export function completeCadet(
64
69
  return assistantNames();
65
70
  }
66
71
 
72
+ // First positional of a subcommand-style command: offer its subcommands.
73
+ if (preceding.length === 1 && !toComplete.startsWith("-")) {
74
+ const subcommands = SUBCOMMAND_COMPLETIONS[preceding[0]];
75
+ if (subcommands) return subcommands;
76
+ }
77
+
67
78
  return [];
68
79
  }
69
80
 
@@ -1,7 +1,8 @@
1
1
  import { connectImport } from "./connect/import.js";
2
+ import { cliCommand } from "../lib/cli-name.js";
2
3
 
3
4
  function printUsage(): void {
4
- console.log("Usage: cadet connect [beta] <subcommand>");
5
+ console.log(`Usage: ${cliCommand()} connect [beta] <subcommand>`);
5
6
  console.log("");
6
7
  console.log("Connect to an assistant paired from another machine.");
7
8
  console.log("");
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { cliCommand } from "../lib/cli-name.js";
2
3
  import { isCloudHome } from "../lib/cloud-values.js";
3
4
  import {
4
5
  formatAssistantReference,
@@ -68,7 +69,7 @@ export const debug = Object.assign(
68
69
 
69
70
  const cloudToken = readCloudToken();
70
71
  if (!cloudToken) {
71
- console.error("Not logged in. Run 'cadet login' first.");
72
+ console.error(`Not logged in. Run '${cliCommand()} login' first.`);
72
73
  process.exit(1);
73
74
  }
74
75
  const cloudAssistantId = entry.cloudAssistantId?.trim();
@@ -1,4 +1,5 @@
1
1
  import { existsSync } from "fs";
2
+ import { cliCommand } from "../lib/cli-name.js";
2
3
  import { join } from "path";
3
4
 
4
5
  import { isCloudHome } from "../lib/cloud-values.js";
@@ -68,7 +69,7 @@ export const exec = Object.assign(
68
69
  rawArgs.length === 0
69
70
  ) {
70
71
  console.log(
71
- "Usage: cadet exec [<name>] [--service <svc>] [-it] -- <command...>",
72
+ `Usage: ${cliCommand()} exec [<name>] [--service <svc>] [-it] -- <command...>`,
72
73
  );
73
74
  console.log("");
74
75
  console.log("Execute a command inside an assistant's container.");
@@ -99,10 +100,10 @@ export const exec = Object.assign(
99
100
  console.log(" credential-executor");
100
101
  console.log("");
101
102
  console.log("Examples:");
102
- console.log(" cadet exec -- ls -la /workspace");
103
- console.log(" cadet exec -- cat /workspace/NOW.md");
104
- console.log(" cadet exec -it -- /bin/bash");
105
- console.log(" cadet exec --service gateway -- cat /tmp/gateway.log");
103
+ console.log(` ${cliCommand()} exec -- ls -la /workspace`);
104
+ console.log(` ${cliCommand()} exec -- cat /workspace/NOW.md`);
105
+ console.log(` ${cliCommand()} exec -it -- /bin/bash`);
106
+ console.log(` ${cliCommand()} exec --service gateway -- cat /tmp/gateway.log`);
106
107
  process.exit(0);
107
108
  }
108
109
 
@@ -110,7 +111,7 @@ export const exec = Object.assign(
110
111
  console.error(
111
112
  red(
112
113
  "Error: missing '--' separator before command.\n" +
113
- "Usage: cadet exec [<name>] -- <command...>",
114
+ `Usage: ${cliCommand()} exec [<name>] -- <command...>`,
114
115
  ),
115
116
  );
116
117
  process.exit(1);
@@ -1,4 +1,5 @@
1
1
  import { formatGuardianRefreshCliFailure } from "@mycadet/local-mode";
2
+ import { cliCommand } from "../../lib/cli-name.js";
2
3
 
3
4
  import {
4
5
  type AssistantEntry,
@@ -15,7 +16,7 @@ import {
15
16
  import { generateLocalSigningKey } from "../../lib/local.js";
16
17
 
17
18
  function printUsage(): void {
18
- console.log("Usage: cadet gateway token <subcommand> [assistantId]");
19
+ console.log(`Usage: ${cliCommand()} gateway token <subcommand> [assistantId]`);
19
20
  console.log("");
20
21
  console.log("Manage gateway authentication tokens.");
21
22
  console.log("");
@@ -1,7 +1,8 @@
1
1
  import { gatewayToken } from "./gateway/token.js";
2
+ import { cliCommand } from "../lib/cli-name.js";
2
3
 
3
4
  function printUsage(): void {
4
- console.log("Usage: cadet gateway <subcommand>");
5
+ console.log(`Usage: ${cliCommand()} gateway <subcommand>`);
5
6
  console.log("");
6
7
  console.log("Gateway management commands.");
7
8
  console.log("");
@@ -1,5 +1,6 @@
1
1
  // Direct import — bun embeds this at compile time so it works in compiled binaries.
2
2
  import { isCloudHome } from "../lib/cloud-values.js";
3
+ import { cliCommand } from "../lib/cli-name.js";
3
4
  import cliPkg from "../../package.json";
4
5
 
5
6
  import {
@@ -10,7 +11,6 @@ import { green } from "../lib/color";
10
11
  import { HATCH_ART, HATCHED_EMOJI, VALID_REMOTE_HOSTS } from "../lib/constants";
11
12
  import type { RemoteHost } from "../lib/constants";
12
13
  import { hatchDocker } from "../lib/docker";
13
- import { readAmbientFlagEnvVars } from "../lib/flag-args";
14
14
  import { hatchLocal } from "../lib/hatch-local";
15
15
  import {
16
16
  getCloudUrl,
@@ -28,7 +28,6 @@ interface HatchArgs {
28
28
  watch: boolean;
29
29
  sourcePath: string | null;
30
30
  configValues: Record<string, string>;
31
- flagEnvVars: Record<string, string>;
32
31
  netnsContainer: string | null;
33
32
  gatewayPort: number | null;
34
33
  assistantCaCert: string | null;
@@ -36,7 +35,6 @@ interface HatchArgs {
36
35
 
37
36
  function parseArgs(): HatchArgs {
38
37
  const args = process.argv.slice(3);
39
- const flagEnvVars = readAmbientFlagEnvVars();
40
38
  let verbose = false;
41
39
  let name: string | null = null;
42
40
  let remote: RemoteHost = DEFAULT_REMOTE;
@@ -50,7 +48,7 @@ function parseArgs(): HatchArgs {
50
48
  for (let i = 0; i < args.length; i++) {
51
49
  const arg = args[i];
52
50
  if (arg === "--help" || arg === "-h") {
53
- console.log("Usage: cadet hatch [options]");
51
+ console.log(`Usage: ${cliCommand()} hatch [options]`);
54
52
  console.log("");
55
53
  console.log("Create a new assistant instance.");
56
54
  console.log("");
@@ -178,7 +176,6 @@ function parseArgs(): HatchArgs {
178
176
  watch,
179
177
  sourcePath,
180
178
  configValues,
181
- flagEnvVars,
182
179
  netnsContainer,
183
180
  gatewayPort,
184
181
  assistantCaCert,
@@ -193,92 +190,88 @@ function getCliVersion(): string {
193
190
 
194
191
  export const hatch = Object.assign(
195
192
  async function hatch(): Promise<void> {
196
- const cliVersion = getCliVersion();
197
- console.log(`@mycadet/cli v${cliVersion}`);
193
+ const cliVersion = getCliVersion();
194
+ console.log(`@mycadet/cli v${cliVersion}`);
198
195
 
199
- const {
200
- verbose,
201
- name,
202
- remote,
203
- watch,
204
- sourcePath,
205
- configValues,
206
- flagEnvVars,
207
- netnsContainer,
208
- gatewayPort,
209
- assistantCaCert,
210
- } = parseArgs();
196
+ const {
197
+ verbose,
198
+ name,
199
+ remote,
200
+ watch,
201
+ sourcePath,
202
+ configValues,
203
+ netnsContainer,
204
+ gatewayPort,
205
+ assistantCaCert,
206
+ } = parseArgs();
211
207
 
212
- if (watch && remote !== "local" && remote !== "docker") {
213
- console.error(
214
- "Error: --watch is only supported for local and docker hatch targets.",
215
- );
216
- process.exit(1);
217
- }
208
+ if (watch && remote !== "local" && remote !== "docker") {
209
+ console.error(
210
+ "Error: --watch is only supported for local and docker hatch targets.",
211
+ );
212
+ process.exit(1);
213
+ }
218
214
 
219
- if (sourcePath !== null && remote !== "docker") {
220
- console.error(
221
- "Error: --source is only supported for docker hatch targets.",
222
- );
223
- process.exit(1);
224
- }
215
+ if (sourcePath !== null && remote !== "docker") {
216
+ console.error(
217
+ "Error: --source is only supported for docker hatch targets.",
218
+ );
219
+ process.exit(1);
220
+ }
225
221
 
226
- if (
227
- (netnsContainer !== null ||
228
- gatewayPort !== null ||
229
- assistantCaCert !== null) &&
230
- remote !== "docker"
231
- ) {
232
- console.error(
233
- "Error: --netns-container, --gateway-port, and --assistant-ca-cert are only supported for docker hatch targets.",
234
- );
235
- process.exit(1);
236
- }
222
+ if (
223
+ (netnsContainer !== null ||
224
+ gatewayPort !== null ||
225
+ assistantCaCert !== null) &&
226
+ remote !== "docker"
227
+ ) {
228
+ console.error(
229
+ "Error: --netns-container, --gateway-port, and --assistant-ca-cert are only supported for docker hatch targets.",
230
+ );
231
+ process.exit(1);
232
+ }
237
233
 
238
- if (netnsContainer !== null && gatewayPort === null) {
239
- console.error(
240
- "Error: --gateway-port is required with --netns-container (the namespace owner publishes the port before hatch runs).",
241
- );
242
- process.exit(1);
243
- }
234
+ if (netnsContainer !== null && gatewayPort === null) {
235
+ console.error(
236
+ "Error: --gateway-port is required with --netns-container (the namespace owner publishes the port before hatch runs).",
237
+ );
238
+ process.exit(1);
239
+ }
244
240
 
245
- if (remote === "local") {
246
- await hatchLocal({
247
- name,
248
- watch,
249
- configValues,
250
- flagEnvVars,
251
- verbose,
252
- });
253
- return;
254
- }
241
+ if (remote === "local") {
242
+ await hatchLocal({
243
+ name,
244
+ watch,
245
+ configValues,
246
+ verbose,
247
+ });
248
+ return;
249
+ }
255
250
 
256
- if (remote === "docker") {
257
- await hatchDocker({
258
- name,
259
- watch,
260
- configValues,
261
- flagEnvVars,
262
- sourcePath,
263
- netnsContainer: netnsContainer ?? undefined,
264
- gatewayPort: gatewayPort ?? undefined,
265
- assistantCaCertPath: assistantCaCert ?? undefined,
266
- });
267
- return;
268
- }
251
+ if (remote === "docker") {
252
+ await hatchDocker({
253
+ name,
254
+ watch,
255
+ configValues,
256
+ sourcePath,
257
+ netnsContainer: netnsContainer ?? undefined,
258
+ gatewayPort: gatewayPort ?? undefined,
259
+ assistantCaCertPath: assistantCaCert ?? undefined,
260
+ });
261
+ return;
262
+ }
269
263
 
270
- if (isCloudHome(remote)) {
271
- await hatchCadetPlatform();
272
- return;
273
- }
264
+ if (isCloudHome(remote)) {
265
+ await hatchCadetPlatform();
266
+ return;
267
+ }
274
268
 
275
- console.error(`Error: Remote host '${remote}' is not yet supported.`);
276
- process.exit(1);
277
- },
269
+ console.error(`Error: Remote host '${remote}' is not yet supported.`);
270
+ process.exit(1);
271
+ },
278
272
  { description: "Create a new assistant instance" },
279
273
  );
280
274
 
281
-
282
275
  async function hatchCadetPlatform(): Promise<void> {
283
276
  const token = readCloudToken();
284
277
  if (!token) {
@@ -307,7 +300,8 @@ async function hatchCadetPlatform(): Promise<void> {
307
300
  setActiveAssistant(result.id);
308
301
 
309
302
  console.log(
310
- " " + green(`${HATCHED_EMOJI} Your assistant has hatched!`, process.stdout),
303
+ " " +
304
+ green(`${HATCHED_EMOJI} Your assistant has hatched!`, process.stdout),
311
305
  );
312
306
  console.log("");
313
307
  console.log(` ID: ${result.id}`);
@@ -1,4 +1,5 @@
1
1
  import { isCloudHome } from "../lib/cloud-values.js";
2
+ import { cliCommand } from "../lib/cli-name.js";
2
3
 
3
4
  import {
4
5
  getActiveAssistant,
@@ -27,7 +28,7 @@ export const login = Object.assign(
27
28
  const args = process.argv.slice(3);
28
29
 
29
30
  if (args.includes("--help") || args.includes("-h")) {
30
- console.log("Usage: cadet login [--token <session-token>] [--force]");
31
+ console.log(`Usage: ${cliCommand()} login [--token <session-token>] [--force]`);
31
32
  console.log("");
32
33
  console.log("Log in to Cadet Cloud.");
33
34
  console.log("");
@@ -44,9 +45,9 @@ export const login = Object.assign(
44
45
  );
45
46
  console.log("");
46
47
  console.log("Examples:");
47
- console.log(" cadet login");
48
- console.log(" cadet login --token <session-token>");
49
- console.log(" cadet login --force");
48
+ console.log(` ${cliCommand()} login`);
49
+ console.log(` ${cliCommand()} login --token <session-token>`);
50
+ console.log(` ${cliCommand()} login --force`);
50
51
  process.exit(0);
51
52
  }
52
53
 
@@ -145,7 +146,7 @@ export const logout = Object.assign(
145
146
  async function logout(): Promise<void> {
146
147
  const args = process.argv.slice(3);
147
148
  if (args.includes("--help") || args.includes("-h")) {
148
- console.log("Usage: cadet logout");
149
+ console.log(`Usage: ${cliCommand()} logout`);
149
150
  console.log("");
150
151
  console.log("Log out of Cadet Cloud, remove the stored session token,");
151
152
  console.log("and remove cloud assistants from the local lockfile.");
@@ -176,7 +177,7 @@ export const whoami = Object.assign(
176
177
  async function whoami(): Promise<void> {
177
178
  const args = process.argv.slice(3);
178
179
  if (args.includes("--help") || args.includes("-h")) {
179
- console.log("Usage: cadet whoami");
180
+ console.log(`Usage: ${cliCommand()} whoami`);
180
181
  console.log("");
181
182
  console.log("Show the currently logged-in Cadet Cloud user.");
182
183
  process.exit(0);
@@ -1,4 +1,5 @@
1
1
  import { spawn } from "child_process";
2
+ import { cliCommand } from "../lib/cli-name.js";
2
3
  import { createReadStream, existsSync, statSync } from "fs";
3
4
  import { createInterface } from "readline";
4
5
  import { watch } from "fs";
@@ -26,7 +27,7 @@ interface LogsArgs {
26
27
  }
27
28
 
28
29
  function printHelp(): void {
29
- console.log("Usage: cadet logs [<name>] [options]");
30
+ console.log(`Usage: ${cliCommand()} logs [<name>] [options]`);
30
31
  console.log("");
31
32
  console.log("View logs from an assistant instance.");
32
33
  console.log("");