@mycadet/cli 0.12.10 → 0.13.0-dev.202610171617.9ea363e
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/README.md +13 -0
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/__tests__/ingress.test.ts +10 -10
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/channels.ts +0 -1
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/ingress.ts +3 -3
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/__tests__/ingress.test.ts +10 -10
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/channels.ts +0 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/ingress.ts +3 -3
- package/node_modules/@mycadet/service-contracts/src/__tests__/ingress.test.ts +10 -10
- package/node_modules/@mycadet/service-contracts/src/channels.ts +0 -1
- package/node_modules/@mycadet/service-contracts/src/ingress.ts +3 -3
- package/package.json +8 -3
- package/src/__tests__/assistant-client-cloud-auth.test.ts +2 -2
- package/src/__tests__/backup-ops-matching.test.ts +15 -13
- package/src/__tests__/backup-ops.test.ts +105 -0
- package/src/__tests__/backup.test.ts +114 -673
- package/src/__tests__/cloud-login-poll.test.ts +69 -0
- package/src/__tests__/cloud-releases.test.ts +82 -0
- package/src/__tests__/commands-mock.ts +101 -0
- package/src/__tests__/debug.test.ts +17 -91
- package/src/__tests__/devices.test.ts +64 -2
- package/src/__tests__/ensure-binary.test.ts +52 -0
- package/src/__tests__/gateway-token.test.ts +267 -0
- package/src/__tests__/hatch-next-steps.test.ts +38 -0
- package/src/__tests__/host-teleport-docker.test.ts +371 -0
- package/src/__tests__/host-teleport.test.ts +405 -0
- package/src/__tests__/multi-local.test.ts +3 -3
- package/src/__tests__/nginx-ingress.test.ts +587 -36
- package/src/__tests__/orphan-detection.test.ts +1 -1
- package/src/__tests__/paired-lifecycle.test.ts +2 -2
- package/src/__tests__/ps-cloud-status.test.ts +8 -7
- package/src/__tests__/root-backup-docker.test.ts +294 -0
- package/src/__tests__/root-backup.test.ts +527 -0
- package/src/__tests__/root-restore-command.test.ts +147 -0
- package/src/__tests__/root-signing-key.test.ts +50 -0
- package/src/__tests__/setup.test.ts +17 -7
- package/src/__tests__/shell-mode.test.ts +83 -0
- package/src/__tests__/sleep.test.ts +11 -0
- package/src/__tests__/teleport.test.ts +68 -2996
- package/src/__tests__/tunnel-startup-summary.test.ts +110 -0
- package/src/__tests__/tunnel-stop.test.ts +226 -0
- package/src/__tests__/tunnel.test.ts +22 -4
- package/src/__tests__/upgrade-local.test.ts +21 -11
- package/src/__tests__/upgrade-replay-env.test.ts +2 -2
- package/src/__tests__/upgrade-root-recovery.test.ts +185 -0
- package/src/__tests__/wake.test.ts +4 -1
- package/src/__tests__/windows-lifecycle.test.ts +25 -0
- package/src/commands/backup.ts +44 -399
- package/src/commands/client.ts +3 -3
- package/src/commands/completions.ts +0 -2
- package/src/commands/debug.ts +75 -131
- package/src/commands/devices.ts +117 -47
- package/src/commands/gateway/token.ts +77 -23
- package/src/commands/hatch.ts +10 -52
- package/src/commands/pair.ts +9 -3
- package/src/commands/ps.ts +4 -2
- package/src/commands/restore.ts +77 -444
- package/src/commands/retire.ts +2 -3
- package/src/commands/sleep.ts +15 -2
- package/src/commands/teleport.ts +47 -1559
- package/src/commands/tunnel.ts +91 -11
- package/src/commands/upgrade.ts +84 -157
- package/src/commands/wake.ts +1 -1
- package/src/index.ts +0 -4
- package/src/lib/__tests__/http-client-version.test.ts +29 -0
- package/src/lib/__tests__/runtime-url.test.ts +3 -75
- package/src/lib/__tests__/web-dist.test.ts +27 -1
- package/src/lib/assistant-client.ts +1 -1
- package/src/lib/assistant-config.ts +43 -23
- package/src/lib/backup-ops.ts +37 -251
- package/src/lib/cloud-client.ts +10 -13
- package/src/lib/cloud-login-poll.ts +75 -0
- package/src/lib/cloud-login.ts +5 -2
- package/src/lib/cloud-releases.ts +54 -10
- package/src/lib/cloud-values.ts +1 -1
- package/src/lib/confirm-action.ts +2 -2
- package/src/lib/docker.ts +65 -34
- package/src/lib/ensure-binary.ts +65 -6
- package/src/lib/github-repository.ts +2 -0
- package/src/lib/guardian-token.ts +1 -23
- package/src/lib/hatch-local.ts +18 -52
- package/src/lib/hatch-next-steps.ts +15 -2
- package/src/lib/host-teleport.ts +506 -0
- package/src/lib/http-client.ts +25 -0
- package/src/lib/ingress-config.ts +31 -0
- package/src/lib/live-voice/tunnel.test.ts +1 -1
- package/src/lib/live-voice/tunnel.ts +3 -3
- package/src/lib/local.ts +10 -8
- package/src/lib/nginx-ingress.ts +572 -95
- package/src/lib/process.ts +13 -0
- package/src/lib/root-backup.ts +917 -0
- package/src/lib/root-signing-key.ts +31 -0
- package/src/lib/runtime-url.ts +0 -29
- package/src/lib/teleport-backup.ts +3 -16
- package/src/lib/tunnel.ts +87 -34
- package/src/lib/tunnels/cadet.ts +12 -1
- package/src/lib/tunnels/cloudflare.ts +36 -1
- package/src/lib/tunnels/ngrok.ts +16 -2
- package/src/lib/tunnels/process-lifecycle.ts +26 -0
- package/src/lib/tunnels/tailscale.ts +79 -1
- package/src/lib/upgrade-lifecycle.ts +63 -141
- package/src/lib/web-dist.ts +79 -1
- package/src/lib/xdg-log.ts +11 -0
- package/src/__tests__/bundle-staging.test.ts +0 -268
- package/src/__tests__/unpair.test.ts +0 -160
- package/src/commands/rollback.ts +0 -479
- package/src/commands/unpair.ts +0 -122
- package/src/lib/__tests__/job-polling.test.ts +0 -278
- package/src/lib/__tests__/local-runtime-client.test.ts +0 -666
- package/src/lib/bundle-staging.ts +0 -220
- package/src/lib/job-polling.ts +0 -195
- package/src/lib/local-runtime-client.ts +0 -374
package/src/commands/sleep.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
DAEMON_STOP_TIMEOUT_MS,
|
|
23
23
|
isProcessAlive,
|
|
24
24
|
stopProcessByPidFile,
|
|
25
|
+
stopProcessGracefully,
|
|
25
26
|
} from "../lib/process";
|
|
26
27
|
import { resolveFreshBearerToken } from "./client.js";
|
|
27
28
|
|
|
@@ -67,7 +68,7 @@ export const sleep = Object.assign(
|
|
|
67
68
|
if (args.includes("--help") || args.includes("-h")) {
|
|
68
69
|
console.log("Usage: cadet sleep [<name> | --all] [--force] [--wait [<duration>]]");
|
|
69
70
|
console.log("");
|
|
70
|
-
console.log("
|
|
71
|
+
console.log("Gracefully stop all services; abort if they do not exit without forced termination.");
|
|
71
72
|
console.log("");
|
|
72
73
|
console.log("Arguments:");
|
|
73
74
|
console.log(
|
|
@@ -96,6 +97,10 @@ export const sleep = Object.assign(
|
|
|
96
97
|
process.exit(0);
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
const knownFlags = new Set(["--all", "--force", "--wait"]);
|
|
101
|
+
const unknownFlag = args.find((arg) => arg.startsWith("-") && !knownFlags.has(arg) && !arg.startsWith("--wait="));
|
|
102
|
+
if (unknownFlag) { console.error(`Unknown sleep option: ${unknownFlag}`); process.exit(1); }
|
|
103
|
+
|
|
99
104
|
const force = args.includes("--force");
|
|
100
105
|
let wait = false;
|
|
101
106
|
let waitMs: number | null = null;
|
|
@@ -232,7 +237,7 @@ async function sleepAll(opts: SleepOptions): Promise<void> {
|
|
|
232
237
|
* resources, unmanageable runtimes) so the caller decides between exiting
|
|
233
238
|
* (single-assistant path) and continuing to the next entry (`--all`).
|
|
234
239
|
*/
|
|
235
|
-
async function sleepAssistant(
|
|
240
|
+
export async function sleepAssistant(
|
|
236
241
|
entry: AssistantEntry,
|
|
237
242
|
opts: SleepOptions,
|
|
238
243
|
): Promise<void> {
|
|
@@ -277,6 +282,9 @@ async function sleepAssistant(
|
|
|
277
282
|
);
|
|
278
283
|
}
|
|
279
284
|
const resources = entry.resources;
|
|
285
|
+
if (process.platform === "win32") {
|
|
286
|
+
throw new Error("Graceful-only shutdown is not supported for Windows local services.");
|
|
287
|
+
}
|
|
280
288
|
const assistantPidFile = getDaemonPidPath(resources);
|
|
281
289
|
const cadetDir = getAssistantRootDir(entry);
|
|
282
290
|
const gatewayPidFile = join(cadetDir, "gateway.pid");
|
|
@@ -317,6 +325,7 @@ async function sleepAssistant(
|
|
|
317
325
|
"assistant",
|
|
318
326
|
undefined,
|
|
319
327
|
DAEMON_STOP_TIMEOUT_MS,
|
|
328
|
+
stopProcessGracefully,
|
|
320
329
|
);
|
|
321
330
|
if (!assistantStopped) {
|
|
322
331
|
console.log("Assistant is not running.");
|
|
@@ -331,6 +340,7 @@ async function sleepAssistant(
|
|
|
331
340
|
"gateway",
|
|
332
341
|
undefined,
|
|
333
342
|
7000,
|
|
343
|
+
stopProcessGracefully,
|
|
334
344
|
);
|
|
335
345
|
if (!gatewayStopped) {
|
|
336
346
|
console.log("Gateway is not running.");
|
|
@@ -344,6 +354,9 @@ async function sleepAssistant(
|
|
|
344
354
|
const cesStopped = await stopProcessByPidFile(
|
|
345
355
|
cesPidFile,
|
|
346
356
|
"credential-executor",
|
|
357
|
+
undefined,
|
|
358
|
+
DAEMON_STOP_TIMEOUT_MS,
|
|
359
|
+
stopProcessGracefully,
|
|
347
360
|
);
|
|
348
361
|
if (cesStopped) {
|
|
349
362
|
console.log("credential-executor stopped.");
|