@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.
- package/node_modules/@mycadet/assistant-api/constants/personality-sliders.test.ts +0 -8
- package/node_modules/@mycadet/assistant-api/constants/personality-sliders.ts +5 -41
- package/node_modules/@mycadet/assistant-api/events/message-complete.ts +0 -5
- package/node_modules/@mycadet/assistant-api/index.ts +0 -2
- package/node_modules/@mycadet/assistant-api/responses/conversation-message.ts +0 -10
- package/node_modules/@mycadet/environments/src/seeds.ts +6 -2
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/seeds.ts +6 -2
- package/node_modules/@mycadet/local-mode/src/config.ts +0 -2
- package/node_modules/@mycadet/local-mode/src/index.ts +1 -1
- package/node_modules/@mycadet/local-mode/src/lockfile-contract.test.ts +1 -22
- package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +26 -7
- package/node_modules/@mycadet/local-mode/src/util.ts +1 -20
- package/node_modules/@mycadet/shared/github-repository.ts +5 -0
- package/node_modules/@mycadet/shared/package.json +10 -0
- package/node_modules/@mycadet/shared/scripts/run-isolated-tests.ts +700 -0
- package/package.json +3 -2
- package/src/__tests__/app-command.test.ts +164 -0
- package/src/__tests__/client-web-config.test.ts +0 -1
- package/src/__tests__/cloud-releases.test.ts +1 -1
- package/src/__tests__/local-version.test.ts +16 -0
- package/src/__tests__/nginx-ingress.test.ts +248 -630
- package/src/__tests__/ps-cloud-status.test.ts +85 -11
- package/src/__tests__/root-process-lockfile.test.ts +29 -2
- package/src/__tests__/tunnel-holder-heal.test.ts +119 -0
- package/src/__tests__/tunnel-stop.test.ts +6 -13
- package/src/__tests__/tunnel.test.ts +50 -193
- package/src/__tests__/wake.test.ts +6 -38
- package/src/__tests__/web-dist.test.ts +267 -89
- package/src/commands/app.ts +113 -0
- package/src/commands/backup.ts +5 -4
- package/src/commands/clean.ts +2 -1
- package/src/commands/client.ts +5 -68
- package/src/commands/completions.ts +12 -1
- package/src/commands/connect.ts +2 -1
- package/src/commands/debug.ts +2 -1
- package/src/commands/exec.ts +7 -6
- package/src/commands/gateway/token.ts +2 -1
- package/src/commands/gateway.ts +2 -1
- package/src/commands/hatch.ts +74 -80
- package/src/commands/login.ts +7 -6
- package/src/commands/logs.ts +2 -1
- package/src/commands/ps.ts +136 -6
- package/src/commands/restart.ts +2 -1
- package/src/commands/restore.ts +10 -9
- package/src/commands/retire.ts +4 -3
- package/src/commands/setup.ts +5 -4
- package/src/commands/sleep.ts +3 -2
- package/src/commands/teleport.ts +2 -1
- package/src/commands/terminal.ts +7 -6
- package/src/commands/tunnel.ts +196 -242
- package/src/commands/uninstall.ts +2 -1
- package/src/commands/upgrade.ts +2 -1
- package/src/commands/use.ts +2 -1
- package/src/commands/wake.ts +3 -2
- package/src/index.ts +5 -4
- package/src/lib/__tests__/web-dist.test.ts +1 -27
- package/src/lib/assistant-config.ts +101 -37
- package/src/lib/cli-name.ts +14 -0
- package/src/lib/cloud-client.ts +2 -1
- package/src/lib/cloud-login-poll.ts +2 -1
- package/src/lib/cloud-releases.ts +1 -1
- package/src/lib/docker.ts +32 -21
- package/src/lib/hatch-local.ts +1 -3
- package/src/lib/hatch-next-steps.ts +1 -9
- package/src/lib/ingress-config.ts +0 -31
- package/src/lib/local-version.ts +25 -4
- package/src/lib/local.ts +34 -9
- package/src/lib/nginx-ingress.ts +143 -244
- package/src/lib/provider-secrets.ts +0 -5
- package/src/lib/statefulset.ts +0 -1
- package/src/lib/tunnel.ts +244 -43
- package/src/lib/tunnels/ngrok.ts +57 -9
- package/src/lib/tunnels/tailscale.ts +2 -1
- package/src/lib/web-dist.ts +134 -56
- package/src/__tests__/flags.test.ts +0 -318
- package/src/__tests__/shell-mode.test.ts +0 -83
- package/src/commands/flags.ts +0 -255
- package/src/lib/flag-args.test.ts +0 -84
- package/src/lib/flag-args.ts +0 -74
- package/src/lib/github-repository.ts +0 -2
package/src/commands/ps.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { getNginxIngressPort } from "../lib/nginx-ingress.js";
|
|
2
|
+
import { getIngressPaths, readIngressState } from "../lib/nginx-ingress.js";
|
|
3
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
2
4
|
import { isCloudHome } from "../lib/cloud-values.js";
|
|
3
5
|
import { join } from "path";
|
|
4
6
|
|
|
7
|
+
import {
|
|
8
|
+
TUNNEL_PROVIDERS,
|
|
9
|
+
type TunnelProviderName,
|
|
10
|
+
} from "@mycadet/service-contracts/ingress";
|
|
11
|
+
import { DEFAULT_TUNNEL_PROVIDER, toLocalTunnelTarget } from "../lib/tunnel.js";
|
|
12
|
+
import { getDefaultWorkspaceDir } from "../lib/ingress-config.js";
|
|
13
|
+
import { loadNgrokDomain } from "../lib/tunnels/ngrok.js";
|
|
14
|
+
import { getLogDir } from "../lib/xdg-log.js";
|
|
15
|
+
|
|
5
16
|
import {
|
|
6
17
|
extractHostFromUrl,
|
|
7
18
|
findAssistantByName,
|
|
@@ -633,7 +644,11 @@ interface RootManagedRow {
|
|
|
633
644
|
* Rows for the CLI-managed processes recorded at the lockfile root: the
|
|
634
645
|
* `tunnel` agent and the `app` nginx edge. Pids are liveness-checked so a
|
|
635
646
|
* stale entry reads as not running rather than as a lie. Each row carries the
|
|
636
|
-
* assistant it fronts so the listing can nest it under that assistant
|
|
647
|
+
* assistant it fronts so the listing can nest it under that assistant, and
|
|
648
|
+
* the INFO column leads with the URL the process serves — the tunnel's
|
|
649
|
+
* public URL, the edge's loopback listen URL — the same way assistant rows
|
|
650
|
+
* lead with their runtime URL. The app entry may carry only its built-sha
|
|
651
|
+
* stamp between runs; such an entry reports no row.
|
|
637
652
|
*/
|
|
638
653
|
async function getRootManagedRows(): Promise<RootManagedRow[]> {
|
|
639
654
|
const { tunnel, app } = readRootProcesses();
|
|
@@ -641,31 +656,139 @@ async function getRootManagedRows(): Promise<RootManagedRow[]> {
|
|
|
641
656
|
|
|
642
657
|
if (tunnel) {
|
|
643
658
|
const alive = isLocalProcessAlive(tunnel.pid);
|
|
659
|
+
const info = [tunnel.publicUrl, `PID ${tunnel.pid}`]
|
|
660
|
+
.filter(Boolean)
|
|
661
|
+
.join(" | ");
|
|
644
662
|
rows.push({
|
|
645
663
|
assistantId: tunnel.assistantId,
|
|
646
664
|
row: {
|
|
647
665
|
name: tunnel.provider ?? "unknown provider",
|
|
648
666
|
type: TUNNEL_TYPE,
|
|
649
667
|
status: withStatusEmoji(alive ? "running" : "not running"),
|
|
650
|
-
info: alive ?
|
|
668
|
+
info: alive ? info : `${info} (exited)`,
|
|
651
669
|
},
|
|
652
670
|
});
|
|
653
671
|
}
|
|
654
|
-
if (app) {
|
|
672
|
+
if (app?.pid !== undefined) {
|
|
655
673
|
const alive = isLocalProcessAlive(app.pid);
|
|
674
|
+
const listenUrl = `http://127.0.0.1:${app.port ?? getNginxIngressPort()}`;
|
|
675
|
+
const info = [listenUrl, `PID ${app.pid}`].join(" | ");
|
|
656
676
|
rows.push({
|
|
657
677
|
assistantId: app.assistantId,
|
|
658
678
|
row: {
|
|
659
679
|
name: "nginx",
|
|
660
680
|
type: APP_TYPE,
|
|
661
681
|
status: withStatusEmoji(alive ? "running" : "not running"),
|
|
662
|
-
info:
|
|
682
|
+
info: alive ? info : `${info} (exited)`,
|
|
663
683
|
},
|
|
664
684
|
});
|
|
665
685
|
}
|
|
666
686
|
return rows;
|
|
667
687
|
}
|
|
668
688
|
|
|
689
|
+
// ── Root-managed process detail views ───────────────────────────
|
|
690
|
+
|
|
691
|
+
function detailLine(label: string, value: string | null | undefined): void {
|
|
692
|
+
console.log(` ${label.padEnd(17)}${value ?? "—"}`);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/** The workspace the edge fronting `assistantId` lives in, or the default. */
|
|
696
|
+
function edgeWorkspaceFor(assistantId: string | undefined): string {
|
|
697
|
+
if (assistantId) {
|
|
698
|
+
const result = lookupAssistantByIdentifier(assistantId);
|
|
699
|
+
if (result.status === "found") {
|
|
700
|
+
const target = toLocalTunnelTarget(result.entry);
|
|
701
|
+
if (target) return target.workspaceDir;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return getDefaultWorkspaceDir();
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Full info for one CLI-managed process: `cadet ps nginx` (the app edge) and
|
|
709
|
+
* `cadet ps ngrok` (the tunnel agent — any provider name, or "tunnel"). These
|
|
710
|
+
* names resolve before assistant lookup: a built-in process name wins.
|
|
711
|
+
* Returns false when the identifier names neither, so the caller falls
|
|
712
|
+
* through to the assistant lookup.
|
|
713
|
+
*/
|
|
714
|
+
async function printRootProcessDetail(identifier: string): Promise<boolean> {
|
|
715
|
+
const name = identifier.toLowerCase();
|
|
716
|
+
const { tunnel, app } = readRootProcesses();
|
|
717
|
+
|
|
718
|
+
if (name === "nginx" || name === "app") {
|
|
719
|
+
console.log("App edge (nginx):");
|
|
720
|
+
if (!app?.pid) {
|
|
721
|
+
console.log(
|
|
722
|
+
` not recorded — start one with \`${cliCommand()} app start\``,
|
|
723
|
+
);
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
const alive = isLocalProcessAlive(app.pid);
|
|
727
|
+
const workspaceDir = edgeWorkspaceFor(app.assistantId);
|
|
728
|
+
const state = readIngressState(workspaceDir);
|
|
729
|
+
detailLine("Status:", alive ? "running" : "not running");
|
|
730
|
+
detailLine("PID:", String(app.pid));
|
|
731
|
+
detailLine(
|
|
732
|
+
"Listen:",
|
|
733
|
+
`http://127.0.0.1:${app.port ?? state?.listenPort ?? getNginxIngressPort()}`,
|
|
734
|
+
);
|
|
735
|
+
detailLine(
|
|
736
|
+
"Gateway:",
|
|
737
|
+
state?.gatewayPort !== undefined
|
|
738
|
+
? `127.0.0.1:${state.gatewayPort}`
|
|
739
|
+
: null,
|
|
740
|
+
);
|
|
741
|
+
detailLine("Assistant:", assistantLabelFor(app.assistantId));
|
|
742
|
+
detailLine("Started:", app.startedAt);
|
|
743
|
+
detailLine("Log:", getIngressPaths(workspaceDir).logPath);
|
|
744
|
+
return true;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
const provider: string | null = tunnel?.provider ?? null;
|
|
748
|
+
if (
|
|
749
|
+
name === "tunnel" ||
|
|
750
|
+
TUNNEL_PROVIDERS.includes(name as TunnelProviderName)
|
|
751
|
+
) {
|
|
752
|
+
console.log(
|
|
753
|
+
name === "tunnel" ? "Tunnel agent:" : `Tunnel agent (${name}):`,
|
|
754
|
+
);
|
|
755
|
+
if (!tunnel) {
|
|
756
|
+
console.log(
|
|
757
|
+
` not recorded — start one with \`${cliCommand()} tunnel start\``,
|
|
758
|
+
);
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
if (name !== "tunnel" && (provider ?? DEFAULT_TUNNEL_PROVIDER) !== name) {
|
|
762
|
+
console.log(
|
|
763
|
+
` no ${name} tunnel is recorded — the recorded tunnel's provider is ${provider ?? "unknown"}.`,
|
|
764
|
+
);
|
|
765
|
+
return true;
|
|
766
|
+
}
|
|
767
|
+
const alive = isLocalProcessAlive(tunnel.pid);
|
|
768
|
+
detailLine("Status:", alive ? "running" : "not running");
|
|
769
|
+
detailLine("PID:", String(tunnel.pid));
|
|
770
|
+
detailLine("Provider:", provider ?? DEFAULT_TUNNEL_PROVIDER);
|
|
771
|
+
detailLine("URL:", tunnel.publicUrl);
|
|
772
|
+
detailLine("Assistant:", assistantLabelFor(tunnel.assistantId));
|
|
773
|
+
if ((provider ?? DEFAULT_TUNNEL_PROVIDER) === "ngrok") {
|
|
774
|
+
detailLine("Reserved domain:", loadNgrokDomain());
|
|
775
|
+
}
|
|
776
|
+
detailLine("Started:", tunnel.startedAt);
|
|
777
|
+
detailLine("Log:", join(getLogDir(), "tunnel.log"));
|
|
778
|
+
return true;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
return false;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
function assistantLabelFor(assistantId: string | undefined): string | null {
|
|
785
|
+
if (!assistantId) return null;
|
|
786
|
+
const result = lookupAssistantByIdentifier(assistantId);
|
|
787
|
+
return result.status === "found"
|
|
788
|
+
? formatAssistantReference(result.entry)
|
|
789
|
+
: assistantId;
|
|
790
|
+
}
|
|
791
|
+
|
|
669
792
|
/**
|
|
670
793
|
* Fold the CLI-managed process rows into ONE table with the assistant rows.
|
|
671
794
|
* Tunnel agents and the nginx edge are root resources of the machine, not
|
|
@@ -829,7 +952,7 @@ export const ps = Object.assign(
|
|
|
829
952
|
async function ps(): Promise<void> {
|
|
830
953
|
const args = process.argv.slice(3);
|
|
831
954
|
if (args.includes("--help") || args.includes("-h")) {
|
|
832
|
-
console.log(
|
|
955
|
+
console.log(`Usage: ${cliCommand()} ps [<name-or-id>] [--verbose]`);
|
|
833
956
|
console.log("");
|
|
834
957
|
console.log(
|
|
835
958
|
"List all assistants, or show processes for a specific assistant.",
|
|
@@ -837,7 +960,9 @@ export const ps = Object.assign(
|
|
|
837
960
|
console.log("");
|
|
838
961
|
console.log("Arguments:");
|
|
839
962
|
console.log(
|
|
840
|
-
" <name-or-id> Show processes for the assistant display name or ID",
|
|
963
|
+
" <name-or-id> Show processes for the assistant display name or ID.",
|
|
964
|
+
" Built-in names show the CLI-managed processes instead:",
|
|
965
|
+
" `nginx` (the app edge), `ngrok`/`tunnel` (the agent)",
|
|
841
966
|
);
|
|
842
967
|
console.log("");
|
|
843
968
|
console.log("Options:");
|
|
@@ -855,6 +980,11 @@ export const ps = Object.assign(
|
|
|
855
980
|
return;
|
|
856
981
|
}
|
|
857
982
|
|
|
983
|
+
// Built-in process names (`nginx`, `ngrok`, any provider, `tunnel`)
|
|
984
|
+
// detail the CLI-managed processes before assistant lookup — they can
|
|
985
|
+
// never collide with an assistant name worth shadowing.
|
|
986
|
+
if (await printRootProcessDetail(assistantIdentifier)) return;
|
|
987
|
+
|
|
858
988
|
const result = lookupAssistantByIdentifier(assistantIdentifier);
|
|
859
989
|
if (result.status !== "found") {
|
|
860
990
|
console.error(formatAssistantLookupError(assistantIdentifier, result));
|
package/src/commands/restart.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { sleep } from "./sleep.js";
|
|
2
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
2
3
|
import { wake } from "./wake.js";
|
|
3
4
|
|
|
4
5
|
export const restart = Object.assign(
|
|
@@ -6,7 +7,7 @@ export const restart = Object.assign(
|
|
|
6
7
|
const args = process.argv.slice(3);
|
|
7
8
|
if (args.includes("--help") || args.includes("-h")) {
|
|
8
9
|
console.log(
|
|
9
|
-
|
|
10
|
+
`Usage: ${cliCommand()} restart [<name> | --all] [--force] [--wait [<duration>]] [--repair-guardian]`,
|
|
10
11
|
);
|
|
11
12
|
console.log("");
|
|
12
13
|
console.log("Sleep, then wake the assistant.");
|
package/src/commands/restore.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isCloudHome } from "../lib/cloud-values.js";
|
|
2
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
2
3
|
import {
|
|
3
4
|
existsSync,
|
|
4
5
|
mkdirSync,
|
|
@@ -34,7 +35,7 @@ import {
|
|
|
34
35
|
import { restoreRootBackup, validateRootArchive } from "../lib/root-backup.js";
|
|
35
36
|
|
|
36
37
|
function printUsage(): void {
|
|
37
|
-
console.log(
|
|
38
|
+
console.log(`Usage: ${cliCommand()} restore <name> [--from <path>] [--dry-run]`);
|
|
38
39
|
console.log("");
|
|
39
40
|
console.log(
|
|
40
41
|
"Restore all persistent roots from a tar archive into an assistant.",
|
|
@@ -54,10 +55,10 @@ function printUsage(): void {
|
|
|
54
55
|
);
|
|
55
56
|
console.log("");
|
|
56
57
|
console.log("Examples:");
|
|
57
|
-
console.log(
|
|
58
|
-
console.log(
|
|
59
|
-
console.log(
|
|
60
|
-
console.log(
|
|
58
|
+
console.log(` ${cliCommand()} restore my-retired-assistant`);
|
|
59
|
+
console.log(` ${cliCommand()} restore my-assistant --from backup.tar.gz`);
|
|
60
|
+
console.log(` ${cliCommand()} restore my-cloud-assistant --from backup.tar.gz`);
|
|
61
|
+
console.log(` ${cliCommand()} restore my-assistant --from backup.tar.gz --dry-run`);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
function parseArgs(argv: string[]): {
|
|
@@ -152,7 +153,7 @@ async function restorePlatform(
|
|
|
152
153
|
// Step 1 — Authenticate
|
|
153
154
|
const token = readCloudToken();
|
|
154
155
|
if (!token) {
|
|
155
|
-
console.error(
|
|
156
|
+
console.error(`Not logged in. Run '${cliCommand()} login' first.`);
|
|
156
157
|
process.exit(1);
|
|
157
158
|
}
|
|
158
159
|
|
|
@@ -192,7 +193,7 @@ async function restorePlatform(
|
|
|
192
193
|
preflightResult.statusCode === 401 ||
|
|
193
194
|
preflightResult.statusCode === 403
|
|
194
195
|
) {
|
|
195
|
-
console.error(
|
|
196
|
+
console.error(`Authentication failed. Run '${cliCommand()} login' to refresh.`);
|
|
196
197
|
process.exit(1);
|
|
197
198
|
}
|
|
198
199
|
|
|
@@ -300,7 +301,7 @@ async function restorePlatform(
|
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
if (importResult.statusCode === 401 || importResult.statusCode === 403) {
|
|
303
|
-
console.error(
|
|
304
|
+
console.error(`Authentication failed. Run '${cliCommand()} login' to refresh.`);
|
|
304
305
|
process.exit(1);
|
|
305
306
|
}
|
|
306
307
|
|
|
@@ -552,7 +553,7 @@ export const restore = Object.assign(
|
|
|
552
553
|
const entry = findAssistantByName(name);
|
|
553
554
|
if (!entry) {
|
|
554
555
|
console.error(`Error: No assistant found with name '${name}'.`);
|
|
555
|
-
console.error(
|
|
556
|
+
console.error(`Run '${cliCommand()} ps' to see available assistants.`);
|
|
556
557
|
process.exit(1);
|
|
557
558
|
}
|
|
558
559
|
|
package/src/commands/retire.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isCloudHome } from "../lib/cloud-values.js";
|
|
2
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
2
3
|
import { existsSync, unlinkSync } from "fs";
|
|
3
4
|
import { join } from "path";
|
|
4
5
|
|
|
@@ -282,7 +283,7 @@ async function retireInner(): Promise<void> {
|
|
|
282
283
|
const args = process.argv.slice(3);
|
|
283
284
|
if (args.includes("--help") || args.includes("-h")) {
|
|
284
285
|
console.log(
|
|
285
|
-
|
|
286
|
+
`Usage: ${cliCommand()} retire [<name-or-id>] [--source <source>] [--yes]`,
|
|
286
287
|
);
|
|
287
288
|
console.log("");
|
|
288
289
|
console.log("Delete an assistant instance and archive its data.");
|
|
@@ -312,7 +313,7 @@ async function retireInner(): Promise<void> {
|
|
|
312
313
|
"Error: No assistant specified and no active assistant. Pass a name or ID, or pick one with `cadet use <name>`.",
|
|
313
314
|
);
|
|
314
315
|
console.error(
|
|
315
|
-
|
|
316
|
+
`Usage: ${cliCommand()} retire <name-or-id> [--source <source>] [--yes]`,
|
|
316
317
|
);
|
|
317
318
|
process.exit(1);
|
|
318
319
|
}
|
|
@@ -320,7 +321,7 @@ async function retireInner(): Promise<void> {
|
|
|
320
321
|
const lookup = lookupAssistantByIdentifier(name);
|
|
321
322
|
if (lookup.status !== "found") {
|
|
322
323
|
console.error(formatAssistantLookupError(name, lookup));
|
|
323
|
-
console.error(
|
|
324
|
+
console.error(`Run '${cliCommand()} hatch' first, or check the instance name.`);
|
|
324
325
|
process.exit(1);
|
|
325
326
|
}
|
|
326
327
|
|
package/src/commands/setup.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveAssistant } from "../lib/assistant-config.js";
|
|
2
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
2
3
|
import {
|
|
3
4
|
leaseGuardianToken,
|
|
4
5
|
loadGuardianToken,
|
|
@@ -144,7 +145,7 @@ export const setup = Object.assign(
|
|
|
144
145
|
const args = process.argv.slice(3);
|
|
145
146
|
|
|
146
147
|
if (args.includes("--help") || args.includes("-h")) {
|
|
147
|
-
console.log(
|
|
148
|
+
console.log(`Usage: ${cliCommand()} setup [--provider <provider>]`);
|
|
148
149
|
console.log("");
|
|
149
150
|
console.log("Configure a provider API key on the active assistant.");
|
|
150
151
|
console.log("");
|
|
@@ -159,9 +160,9 @@ export const setup = Object.assign(
|
|
|
159
160
|
console.log(" - Otherwise prompts securely without echoing the key.");
|
|
160
161
|
console.log("");
|
|
161
162
|
console.log("Examples:");
|
|
162
|
-
console.log(
|
|
163
|
-
console.log(
|
|
164
|
-
console.log(
|
|
163
|
+
console.log(` ${cliCommand()} setup`);
|
|
164
|
+
console.log(` ANTHROPIC_API_KEY=... ${cliCommand()} setup`);
|
|
165
|
+
console.log(` ${cliCommand()} setup --provider openai`);
|
|
165
166
|
process.exit(0);
|
|
166
167
|
}
|
|
167
168
|
|
package/src/commands/sleep.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "fs";
|
|
2
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
2
3
|
import { join } from "path";
|
|
3
4
|
|
|
4
5
|
import {
|
|
@@ -66,7 +67,7 @@ export const sleep = Object.assign(
|
|
|
66
67
|
async function sleep(): Promise<void> {
|
|
67
68
|
const args = process.argv.slice(3);
|
|
68
69
|
if (args.includes("--help") || args.includes("-h")) {
|
|
69
|
-
console.log(
|
|
70
|
+
console.log(`Usage: ${cliCommand()} sleep [<name> | --all] [--force] [--wait [<duration>]]`);
|
|
70
71
|
console.log("");
|
|
71
72
|
console.log("Gracefully stop all services; abort if they do not exit without forced termination.");
|
|
72
73
|
console.log("");
|
|
@@ -196,7 +197,7 @@ class SleepExit extends Error {
|
|
|
196
197
|
async function sleepAll(opts: SleepOptions): Promise<void> {
|
|
197
198
|
const entries = loadAllAssistants();
|
|
198
199
|
if (entries.length === 0) {
|
|
199
|
-
console.error(
|
|
200
|
+
console.error(`Error: no assistants found. Run '${cliCommand()} hatch' first.`);
|
|
200
201
|
process.exit(1);
|
|
201
202
|
}
|
|
202
203
|
|
package/src/commands/teleport.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { teleportHostInstallation } from "../lib/host-teleport.js";
|
|
2
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
2
3
|
import { findAssistantByName } from "../lib/assistant-config.js";
|
|
3
4
|
|
|
4
5
|
function printHelp(): void {
|
|
5
6
|
console.log(
|
|
6
|
-
|
|
7
|
+
`Usage: ${cliCommand()} teleport --from <assistant> <--local | --docker> [name] [--keep-source] [--dry-run]`,
|
|
7
8
|
);
|
|
8
9
|
console.log(
|
|
9
10
|
"Move the whole installation between local and Docker storage using root tar archives.",
|
package/src/commands/terminal.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { isCloudHome } from "../lib/cloud-values.js";
|
|
16
|
+
import { cliCommand } from "../lib/cli-name.js";
|
|
16
17
|
import { spawn } from "child_process";
|
|
17
18
|
|
|
18
19
|
import { extractHostFromUrl, resolveAssistant } from "../lib/assistant-config";
|
|
@@ -48,7 +49,7 @@ const SSH_OPTS = [
|
|
|
48
49
|
// ---------------------------------------------------------------------------
|
|
49
50
|
|
|
50
51
|
function printHelp(): void {
|
|
51
|
-
console.log(
|
|
52
|
+
console.log(`Usage: ${cliCommand()} terminal [subcommand] [options]`);
|
|
52
53
|
console.log("");
|
|
53
54
|
console.log("Open an interactive terminal session into an assistant.");
|
|
54
55
|
console.log("");
|
|
@@ -78,10 +79,10 @@ function printHelp(): void {
|
|
|
78
79
|
);
|
|
79
80
|
console.log("");
|
|
80
81
|
console.log("Examples:");
|
|
81
|
-
console.log(
|
|
82
|
-
console.log(
|
|
83
|
-
console.log(
|
|
84
|
-
console.log(
|
|
82
|
+
console.log(` ${cliCommand()} terminal`);
|
|
83
|
+
console.log(` ${cliCommand()} terminal attach my-session`);
|
|
84
|
+
console.log(` ${cliCommand()} terminal list`);
|
|
85
|
+
console.log(` ${cliCommand()} terminal --assistant my-assistant`);
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
function waitForExit(child: ChildProcess): Promise<void> {
|
|
@@ -247,7 +248,7 @@ export const terminal = Object.assign(
|
|
|
247
248
|
|
|
248
249
|
if (subcommand === "attach") {
|
|
249
250
|
if (!tmuxSessionName) {
|
|
250
|
-
console.error(
|
|
251
|
+
console.error(`Usage: ${cliCommand()} terminal attach <session-name>`);
|
|
251
252
|
console.error(
|
|
252
253
|
"\nUse 'cadet terminal list' to see available tmux sessions.",
|
|
253
254
|
);
|