@cat-factory/cli 0.8.5 → 0.9.0

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 CHANGED
@@ -45,6 +45,71 @@ It does the fiddly setup for you:
45
45
  is **not** needed to boot — add providers/keys through the UI after sign-in (the `.env` leaves
46
46
  them as commented hints) — so the generated file runs local mode with no manual edits.
47
47
  - **`cat-factory k3s`** — guided local Kubernetes setup for ephemeral environments (see `--help`).
48
+ - **`cat-factory supervise`** — run a dev command under a self-healing watchdog (see
49
+ [Supervising local dev](#supervising-local-dev)).
50
+
51
+ ## Supervising local dev
52
+
53
+ `node --watch` **parks on crash**: it restarts the entry only on a _file change_, never on a
54
+ process exit. So when a laptop sleeps and the resume takes the Postgres connection with it, the
55
+ server dies, the watcher settles at "Waiting for file changes before restarting", and nothing is
56
+ left bound to the port. The wrapper PID is still alive and the ready banner scrolled past long ago,
57
+ so the stack **looks** healthy while the SPA reports only a generic "can't reach backend" — and it
58
+ stays that way until somebody notices.
59
+
60
+ `cat-factory supervise` wraps that command and repairs it:
61
+
62
+ ```sh
63
+ cat-factory supervise --compose-service postgres -- pnpm dev:raw
64
+ ```
65
+
66
+ `--compose-dir` (default: `--dir`, itself defaulting to the current directory) is where the
67
+ `docker-compose.yml` lives — compose resolves its project file relative to the working directory, so
68
+ supervising from anywhere else needs it set.
69
+
70
+ - **Probes the real signal** every 10s — the port is listening _and_ `/health` answers 200. The two
71
+ failure modes differ: a parked watcher leaves nothing bound, while a server that booted but lost
72
+ its DB pool still holds the socket and only fails the HTTP check.
73
+ - **Notices a resume.** Timers don't fire while the host is suspended, so a tick arriving three
74
+ intervals late means time jumped. That triggers an immediate repair rather than waiting out the
75
+ normal failure threshold — a resume is exactly when the stack is most likely already dead.
76
+ - **Restores dependencies before restarting.** `--compose-service postgres` brings the database
77
+ back (the example compose files set no restart policy, so anything that stops the container
78
+ engine leaves it down) and waits for it to report healthy, because relaunching against a
79
+ still-initialising database just crashes again in `migrate`.
80
+ - **Revives a stopped local cluster.** `--k3s-cluster <name>` starts a k3d/kind cluster that is
81
+ merely stopped and waits for its apiserver, so a slept laptop doesn't leave the Local k3s
82
+ environment handler pointing at a dead control plane.
83
+ - **Notices a child that simply died.** A dead process handle is authoritative, so it repairs on the
84
+ next probe instead of counting failures against a process that no longer exists.
85
+ - **Reaps the port.** Killing the child tree usually suffices, but a package-manager wrapper killed
86
+ without its subtree leaves the real `node` orphaned and holding the socket — the relaunch then
87
+ dies with `EADDRINUSE`, turning one outage into a restart loop. Reaping by port means SIGKILLing a
88
+ process it was never handed, so every kill **names** the pid and the command behind it, and it only
89
+ ever runs once the supervisor's own child is confirmed dead.
90
+
91
+ Two failures it deliberately does **not** retry, because retrying either would reproduce the exact
92
+ pathology this command exists to end — a restart loop that reads as progress:
93
+
94
+ - **A cluster wedged by a stale cgroup** (`runc create failed: … cgroup.procs: device or resource
95
+ busy`, a state a suspend can leave behind). Clearing that needs the container **engine** restarted,
96
+ which would kill every other container — including the database the supervisor depends on. Reported
97
+ once, with the fix.
98
+ - **A supervised command that never serves.** Restarts that fail to reach a serving state are capped
99
+ (5 by default); hitting the cap reports why and exits **non-zero**. A command that is broken — a
100
+ syntax error, a missing binary, a port something else owns — cannot be repaired by killing it again.
101
+ Any successful probe resets the count, so a long-lived stack that has been repaired often is never
102
+ capped.
103
+
104
+ `--runtime k3s` is **refused** alongside `--k3s-cluster`: a k3s host service has no containers for
105
+ this command to start, and quietly treating it as k3d would report "not ready, will retry" forever
106
+ without naming the real reason.
107
+
108
+ Prefer the unsupervised script when you are **debugging a crash** — the supervisor's job is to
109
+ restart the process, which destroys the parked state you would be trying to read.
110
+
111
+ Run `cat-factory supervise --help` for the full flag list (`--port`, `--health-path`, `--poll`,
112
+ `--boot-grace`, `--failures`, `--runtime`).
48
113
 
49
114
  ## Usage
50
115
 
package/dist/args.d.ts CHANGED
@@ -7,9 +7,10 @@ export type K3sRuntime = (typeof K3S_RUNTIMES)[number];
7
7
  export interface CliOptions {
8
8
  /**
9
9
  * The subcommand. `init` (the default when omitted) scaffolds a full project; `env` writes just
10
- * a ready-to-run local-mode `.env`; `k3s` is the guided local-cluster setup.
10
+ * a ready-to-run local-mode `.env`; `k3s` is the guided local-cluster setup; `supervise` wraps a
11
+ * dev command in the self-healing watchdog.
11
12
  */
12
- command: 'init' | 'env' | 'k3s' | 'help' | 'version';
13
+ command: 'init' | 'env' | 'k3s' | 'supervise' | 'help' | 'version';
13
14
  dir?: string;
14
15
  projectName?: string;
15
16
  appTitle?: string;
@@ -33,6 +34,22 @@ export interface CliOptions {
33
34
  k3sRuntime?: K3sRuntime;
34
35
  /** `k3s` command: base URL of the running SPA, opened (deep-linked) to wire the handler. */
35
36
  appUrl?: string;
37
+ /** `supervise` command: the command to run and keep alive — everything after `--`. */
38
+ superviseCommand?: string[];
39
+ /** `supervise` command: health endpoint path probed on `port` (default `/health`). */
40
+ healthPath?: string;
41
+ /** `supervise` command: directory holding the `docker-compose.yml` (default: cwd). */
42
+ composeDir?: string;
43
+ /** `supervise` command: compose service to keep up before each (re)start, e.g. `postgres`. */
44
+ composeService?: string;
45
+ /** `supervise` command: local cluster to keep running (started if merely stopped). */
46
+ k3sCluster?: string;
47
+ /** `supervise` command: seconds between health probes. */
48
+ pollSeconds?: number;
49
+ /** `supervise` command: seconds after a (re)start during which failures don't count. */
50
+ bootGraceSeconds?: number;
51
+ /** `supervise` command: consecutive failed probes required before a repair. */
52
+ failures?: number;
36
53
  /** Skip opening the browser at the token-creation URL (still prints it). */
37
54
  noOpen: boolean;
38
55
  /** Non-interactive: never prompt; use defaults/flags. Fails if a required value is missing. */
@@ -56,6 +73,7 @@ export declare const OPTION_DEFAULTS: {
56
73
  readonly k3sClusterName: 'cat-factory';
57
74
  readonly k3sRuntime: K3sRuntime;
58
75
  readonly appUrl: 'http://localhost:3000';
76
+ readonly healthPath: '/health';
59
77
  };
60
- export declare const HELP_TEXT = "cat-factory \u2014 bootstrap a local cat-factory deployment\n\nUsage:\n cat-factory [init] [options]\n cat-factory env [options]\n cat-factory k3s [options]\n\nCommands:\n init Scaffold a local-mode backend (local/) + frontend SPA (frontend/): generate the\n crypto secrets, mint a GitHub/GitLab PAT (opens your browser), write gitignored .env.\n env Generate ONLY a ready-to-run local-mode .env in the current dir (or --dir): all three\n crypto secrets, a minted GitHub/GitLab PAT, and the execution mode \u2014 so local mode\n boots with no manual edits. Use it in an existing deployment dir (e.g. deploy/local).\n k3s Guided local Kubernetes setup: probe the host for a usable cluster, then create (or\n reuse) one + a least-privilege ServiceAccount and print the values to wire the\n Local k3s environment handler. A k3s install needs sudo, so it is only ever printed.\n\nOptions (init):\n -d, --dir <path> Target directory (default: ./<name>)\n --name <name> Project name slug (default: cat-factory)\n --title <title> Frontend app title (default: Agent Architecture Board)\n --provider <p> Source control: github | gitlab (default: github)\n --token <token> PAT value (skips the browser/paste flow)\n --db-url <url> Postgres DATABASE_URL\n --api-base <url> Backend API base for the SPA (default: http://localhost:<port>)\n --port <n> Backend HTTP port (default: 8787; also sets the SPA's api-base)\n --harness-image <ref> Pin the executor-harness image (default: unset \u2014 the backend runs the version it was built against)\n --container-runtime <r> Agent container runtime: docker | podman | orbstack | colima | apple\n --execution-mode <m> How agents run: pool (Docker container pool) | native (host CLI)\n --native-harnesses <l> Native mode: harnesses to run natively (claude-code,codex)\n --harness-entry <p> Native mode: path to the executor-harness server entry\n --no-open Don't open the browser (just print the token URL)\n -y, --yes Non-interactive: use defaults/flags, never prompt\n -f, --force Overwrite existing files\n -h, --help Show this help\n -v, --version Show the CLI version\n\nOptions (env):\n -d, --dir <path> Directory to write .env into (default: current directory)\n --provider <p> Source control: github | gitlab (default: github)\n --token <token> PAT value (skips the browser/paste flow)\n --db-url <url> Postgres DATABASE_URL\n --port <n> Backend HTTP port (default: 8787)\n --harness-image <ref> Pin the executor-harness image (default: unset \u2014 the backend runs the version it was built against)\n --container-runtime <r> Agent container runtime: docker | podman | orbstack | colima | apple\n --execution-mode <m> How agents run: pool (Docker container pool) | native (host CLI)\n --native-harnesses <l> Native mode: harnesses to run natively (claude-code,codex)\n --harness-entry <p> Native mode: path to the executor-harness server entry\n --no-open Don't open the browser (just print the token URL)\n -y, --yes Non-interactive: use defaults/flags, never prompt\n -f, --force Overwrite an existing .env\n\nOptions (k3s):\n --cluster-name <n> Name for a provisioned local cluster (default: cat-factory)\n --runtime <r> Kubernetes distribution: k3d | kind | k3s (default: k3d)\n --app-url <url> SPA base URL to deep-link for wiring (default: http://localhost:3000)\n --no-open Don't open the browser at the pre-filled connect form (still prints it)\n -y, --yes Non-interactive: pick the recommended path + skip confirms\n\n After provisioning, the values are printed and the SPA's Local k3s connect form is opened\n pre-filled (paste the token, then Test -> Save). A hands-free --register flag that POSTs the\n handler to the local API directly is a planned follow-up.\n";
78
+ export declare const HELP_TEXT = "cat-factory \u2014 bootstrap a local cat-factory deployment\n\nUsage:\n cat-factory [init] [options]\n cat-factory env [options]\n cat-factory k3s [options]\n cat-factory supervise [options] -- <command...>\n\nCommands:\n init Scaffold a local-mode backend (local/) + frontend SPA (frontend/): generate the\n crypto secrets, mint a GitHub/GitLab PAT (opens your browser), write gitignored .env.\n env Generate ONLY a ready-to-run local-mode .env in the current dir (or --dir): all three\n crypto secrets, a minted GitHub/GitLab PAT, and the execution mode \u2014 so local mode\n boots with no manual edits. Use it in an existing deployment dir (e.g. deploy/local).\n k3s Guided local Kubernetes setup: probe the host for a usable cluster, then create (or\n reuse) one + a least-privilege ServiceAccount and print the values to wire the\n Local k3s environment handler. A k3s install needs sudo, so it is only ever printed.\n supervise Run a dev command under a self-healing watchdog. 'node --watch' PARKS on crash\n (it restarts only on a file change), so a laptop sleep leaves the server dead with\n the port unbound and the SPA showing only \"can't reach backend\" \u2014 indefinitely. This\n probes the real signal (port listening AND /health 200), notices a resume, brings the\n database/cluster back, and restarts the command.\n\nOptions (init):\n -d, --dir <path> Target directory (default: ./<name>)\n --name <name> Project name slug (default: cat-factory)\n --title <title> Frontend app title (default: Agent Architecture Board)\n --provider <p> Source control: github | gitlab (default: github)\n --token <token> PAT value (skips the browser/paste flow)\n --db-url <url> Postgres DATABASE_URL\n --api-base <url> Backend API base for the SPA (default: http://localhost:<port>)\n --port <n> Backend HTTP port (default: 8787; also sets the SPA's api-base)\n --harness-image <ref> Pin the executor-harness image (default: unset \u2014 the backend runs the version it was built against)\n --container-runtime <r> Agent container runtime: docker | podman | orbstack | colima | apple\n --execution-mode <m> How agents run: pool (Docker container pool) | native (host CLI)\n --native-harnesses <l> Native mode: harnesses to run natively (claude-code,codex)\n --harness-entry <p> Native mode: path to the executor-harness server entry\n --no-open Don't open the browser (just print the token URL)\n -y, --yes Non-interactive: use defaults/flags, never prompt\n -f, --force Overwrite existing files\n -h, --help Show this help\n -v, --version Show the CLI version\n\nOptions (env):\n -d, --dir <path> Directory to write .env into (default: current directory)\n --provider <p> Source control: github | gitlab (default: github)\n --token <token> PAT value (skips the browser/paste flow)\n --db-url <url> Postgres DATABASE_URL\n --port <n> Backend HTTP port (default: 8787)\n --harness-image <ref> Pin the executor-harness image (default: unset \u2014 the backend runs the version it was built against)\n --container-runtime <r> Agent container runtime: docker | podman | orbstack | colima | apple\n --execution-mode <m> How agents run: pool (Docker container pool) | native (host CLI)\n --native-harnesses <l> Native mode: harnesses to run natively (claude-code,codex)\n --harness-entry <p> Native mode: path to the executor-harness server entry\n --no-open Don't open the browser (just print the token URL)\n -y, --yes Non-interactive: use defaults/flags, never prompt\n -f, --force Overwrite an existing .env\n\nOptions (k3s):\n --cluster-name <n> Name for a provisioned local cluster (default: cat-factory)\n --runtime <r> Kubernetes distribution: k3d | kind | k3s (default: k3d)\n --app-url <url> SPA base URL to deep-link for wiring (default: http://localhost:3000)\n --no-open Don't open the browser at the pre-filled connect form (still prints it)\n -y, --yes Non-interactive: pick the recommended path + skip confirms\n\n After provisioning, the values are printed and the SPA's Local k3s connect form is opened\n pre-filled (paste the token, then Test -> Save). A hands-free --register flag that POSTs the\n handler to the local API directly is a planned follow-up.\n\nOptions (supervise):\n --port <n> Port the supervised server binds (default: 8787)\n --health-path <p> Health endpoint probed on that port (default: /health)\n -d, --dir <path> Working directory for the command (default: current directory)\n --compose-service <s> docker compose service to keep up (e.g. postgres)\n --compose-dir <path> Directory holding docker-compose.yml (default: --dir)\n --k3s-cluster <name> Local k3d/kind cluster to keep running (started if stopped)\n --runtime <r> Cluster distribution for --k3s-cluster: k3d | kind (default: k3d).\n 'k3s' is refused: a host service has no cluster to start from here.\n --poll <seconds> Health probe interval, whole seconds (default: 10)\n --boot-grace <seconds> Ignore failures for this long after a (re)start (default: 60)\n --failures <n> Consecutive failed probes before repairing (default: 3)\n\n Everything after `--` is the supervised command, passed through untouched:\n cat-factory supervise --compose-service postgres -- pnpm dev\n\n A cluster that is merely STOPPED is started automatically. A cluster whose restart is blocked\n by a stale cgroup (\"device or resource busy\" \u2014 a state a suspend can leave behind) cannot be\n fixed from here: clearing it needs the container ENGINE restarted, which would kill every other\n container. That case is reported once, with the fix, instead of retried forever.\n\n The same rule applies to the supervised command itself: restarts that never reach a serving\n state are capped, and hitting the cap reports why and exits NON-ZERO rather than looping. A\n command that is simply broken cannot be repaired by killing it again.\n";
61
79
  //# sourceMappingURL=args.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAE1D,0EAA0E;AAC1E,eAAO,MAAM,YAAY,YAAI,KAAK,EAAE,MAAM,EAAE,KAAK,CAAU,CAAA;AAC3D,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtD,8FAA8F;AAC9F,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,OAAO,EAAE,MAAM,G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@ export function parseArgs(argv) {
16
16
  const queue = [...argv];
17
17
  while (queue.length > 0) {
18
18
  const raw = queue.shift();
19
+ // `--` ends option parsing: the rest is a command to hand to `supervise` verbatim, so its own
20
+ // flags (`--watch`, `-y`, …) are never mistaken for ours.
21
+ if (raw === '--') {
22
+ opts.superviseCommand = [...queue];
23
+ queue.length = 0;
24
+ break;
25
+ }
19
26
  const eq = raw.indexOf('=');
20
27
  const flag = raw.startsWith('--') && eq !== -1 ? raw.slice(0, eq) : raw;
21
28
  const inline = raw.startsWith('--') && eq !== -1 ? raw.slice(eq + 1) : undefined;
@@ -29,8 +36,35 @@ export function parseArgs(argv) {
29
36
  throw new ArgError(`Unknown argument: ${raw}`);
30
37
  }
31
38
  }
39
+ assertSuperviseOnlyFlagsAreScoped(opts);
32
40
  return opts;
33
41
  }
42
+ /**
43
+ * The `supervise`-only flags are parsed by the one shared option table, so nothing structurally
44
+ * stops `cat-factory init --failures 2` or a stray `--` from being accepted and then silently
45
+ * ignored. Reject them here instead: an option that is read by no code path is a typo the user
46
+ * wants to hear about, not a no-op. Listed as data so a new supervise flag joins the check by name
47
+ * rather than being forgotten.
48
+ */
49
+ const SUPERVISE_ONLY_FLAGS = [
50
+ ['superviseCommand', '--'],
51
+ ['healthPath', '--health-path'],
52
+ ['composeDir', '--compose-dir'],
53
+ ['composeService', '--compose-service'],
54
+ ['k3sCluster', '--k3s-cluster'],
55
+ ['pollSeconds', '--poll'],
56
+ ['bootGraceSeconds', '--boot-grace'],
57
+ ['failures', '--failures'],
58
+ ];
59
+ function assertSuperviseOnlyFlagsAreScoped(opts) {
60
+ if (opts.command === 'supervise' || opts.command === 'help' || opts.command === 'version')
61
+ return;
62
+ for (const [key, flag] of SUPERVISE_ONLY_FLAGS) {
63
+ if (opts[key] !== undefined) {
64
+ throw new ArgError(`${flag} is only valid for \`cat-factory supervise\` (got: ${opts.command})`);
65
+ }
66
+ }
67
+ }
34
68
  /** Resolve a flag's value: the inline `--flag=value` form, else the next queued token. */
35
69
  function takeOptionValue(flag, inline, rest) {
36
70
  if (inline !== undefined)
@@ -50,6 +84,7 @@ function applyCommandToken(flag, opts, commandSet) {
50
84
  case 'init':
51
85
  case 'env':
52
86
  case 'k3s':
87
+ case 'supervise':
53
88
  if (!commandSet) {
54
89
  opts.command = flag;
55
90
  commandSet = true;
@@ -124,6 +159,28 @@ function applyOptionFlag(flag, opts, take) {
124
159
  case '--app-url':
125
160
  opts.appUrl = parseAppUrl(take(flag));
126
161
  break;
162
+ case '--health-path':
163
+ opts.healthPath = parseHealthPath(take(flag));
164
+ break;
165
+ case '--compose-dir':
166
+ opts.composeDir = take(flag);
167
+ break;
168
+ case '--compose-service':
169
+ opts.composeService = take(flag);
170
+ break;
171
+ case '--k3s-cluster':
172
+ opts.k3sCluster = take(flag);
173
+ break;
174
+ case '--poll':
175
+ opts.pollSeconds = parseWholeSeconds(flag, take(flag), 1);
176
+ break;
177
+ case '--boot-grace':
178
+ // 0 is meaningful: a fast-booting toy command wants no grace window at all.
179
+ opts.bootGraceSeconds = parseWholeSeconds(flag, take(flag), 0);
180
+ break;
181
+ case '--failures':
182
+ opts.failures = parseFailures(take(flag));
183
+ break;
127
184
  case '--no-open':
128
185
  opts.noOpen = true;
129
186
  break;
@@ -186,6 +243,33 @@ function parseK3sRuntime(value) {
186
243
  return v;
187
244
  throw new ArgError(`Invalid --runtime "${value}" (expected: ${K3S_RUNTIMES.join(' | ')})`);
188
245
  }
246
+ /** The probed health path must be rooted, so `--health-path health` can't silently probe nothing. */
247
+ function parseHealthPath(value) {
248
+ if (!value.startsWith('/')) {
249
+ throw new ArgError(`Invalid --health-path "${value}" (expected a rooted path, e.g. /health)`);
250
+ }
251
+ return value;
252
+ }
253
+ /**
254
+ * Whole seconds only, and at least `min`. Fractions are refused rather than honoured: `--poll 0.001`
255
+ * would otherwise build a 1ms poll loop that spins a core and — because the derived clock-jump
256
+ * threshold is `poll * 3` — reads its own probe latency as a host suspend, so every failed probe
257
+ * repairs at once and `--failures` stops meaning anything.
258
+ */
259
+ function parseWholeSeconds(flag, value, min) {
260
+ const n = Number(value);
261
+ if (!Number.isInteger(n) || n < min) {
262
+ throw new ArgError(`Invalid ${flag} "${value}" (expected a whole number of seconds >= ${min})`);
263
+ }
264
+ return n;
265
+ }
266
+ function parseFailures(value) {
267
+ const n = Number(value);
268
+ if (!Number.isInteger(n) || n < 1) {
269
+ throw new ArgError(`Invalid --failures "${value}" (expected an integer >= 1)`);
270
+ }
271
+ return n;
272
+ }
189
273
  function parsePort(value) {
190
274
  const n = Number(value);
191
275
  if (!Number.isInteger(n) || n < 1 || n > 65535) {
@@ -232,6 +316,8 @@ export const OPTION_DEFAULTS = {
232
316
  // The local-mode SPA URL (matches the frontend served by `cat-factory init`) — the deep-link the
233
317
  // guided k3s hand-off opens to pre-fill the Local k3s connect form.
234
318
  appUrl: 'http://localhost:3000',
319
+ // `supervise` probes the same `/health` every runtime mounts.
320
+ healthPath: '/health',
235
321
  };
236
322
  export const HELP_TEXT = `cat-factory — bootstrap a local cat-factory deployment
237
323
 
@@ -239,6 +325,7 @@ Usage:
239
325
  cat-factory [init] [options]
240
326
  cat-factory env [options]
241
327
  cat-factory k3s [options]
328
+ cat-factory supervise [options] -- <command...>
242
329
 
243
330
  Commands:
244
331
  init Scaffold a local-mode backend (local/) + frontend SPA (frontend/): generate the
@@ -249,6 +336,11 @@ Commands:
249
336
  k3s Guided local Kubernetes setup: probe the host for a usable cluster, then create (or
250
337
  reuse) one + a least-privilege ServiceAccount and print the values to wire the
251
338
  Local k3s environment handler. A k3s install needs sudo, so it is only ever printed.
339
+ supervise Run a dev command under a self-healing watchdog. 'node --watch' PARKS on crash
340
+ (it restarts only on a file change), so a laptop sleep leaves the server dead with
341
+ the port unbound and the SPA showing only "can't reach backend" — indefinitely. This
342
+ probes the real signal (port listening AND /health 200), notices a resume, brings the
343
+ database/cluster back, and restarts the command.
252
344
 
253
345
  Options (init):
254
346
  -d, --dir <path> Target directory (default: ./<name>)
@@ -295,5 +387,30 @@ Options (k3s):
295
387
  After provisioning, the values are printed and the SPA's Local k3s connect form is opened
296
388
  pre-filled (paste the token, then Test -> Save). A hands-free --register flag that POSTs the
297
389
  handler to the local API directly is a planned follow-up.
390
+
391
+ Options (supervise):
392
+ --port <n> Port the supervised server binds (default: 8787)
393
+ --health-path <p> Health endpoint probed on that port (default: /health)
394
+ -d, --dir <path> Working directory for the command (default: current directory)
395
+ --compose-service <s> docker compose service to keep up (e.g. postgres)
396
+ --compose-dir <path> Directory holding docker-compose.yml (default: --dir)
397
+ --k3s-cluster <name> Local k3d/kind cluster to keep running (started if stopped)
398
+ --runtime <r> Cluster distribution for --k3s-cluster: k3d | kind (default: k3d).
399
+ 'k3s' is refused: a host service has no cluster to start from here.
400
+ --poll <seconds> Health probe interval, whole seconds (default: 10)
401
+ --boot-grace <seconds> Ignore failures for this long after a (re)start (default: 60)
402
+ --failures <n> Consecutive failed probes before repairing (default: 3)
403
+
404
+ Everything after \`--\` is the supervised command, passed through untouched:
405
+ cat-factory supervise --compose-service postgres -- pnpm dev
406
+
407
+ A cluster that is merely STOPPED is started automatically. A cluster whose restart is blocked
408
+ by a stale cgroup ("device or resource busy" — a state a suspend can leave behind) cannot be
409
+ fixed from here: clearing it needs the container ENGINE restarted, which would kill every other
410
+ container. That case is reported once, with the fix, instead of retried forever.
411
+
412
+ The same rule applies to the supervised command itself: restarts that never reach a serving
413
+ state are capped, and hitting the cap reports why and exits NON-ZERO rather than looping. A
414
+ command that is simply broken cannot be repaired by killing it again.
298
415
  `;
299
416
  //# sourceMappingURL=args.js.map
package/dist/args.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,eAAe,EAEf,gBAAgB,GAEjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,aAAa,EAAoB,MAAM,UAAU,CAAA;AAE1D,0EAA0E;AAC1E,MAAM,CAAC,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;IACtC,0BAA0B;IAC1B,cAAc,EAAE,aAAa;IAC7B,UAAU,EAAE,KAAmB;IAC/B,iGAAiG;IACjG,oEAAoE;IACpE,MAAM,EAAE,uBAAuB;IAC/B,8DAA8D;IAC9D,UAAU,EAAE,SAAS;CACb,CAAA;AAEV,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6FxB,CAAA"}
package/dist/bin.js CHANGED
@@ -5,6 +5,7 @@ import { ArgError, HELP_TEXT, parseArgs } from './args.js';
5
5
  import { bootstrap } from './bootstrap.js';
6
6
  import { generateEnv } from './envCommand.js';
7
7
  import { setupK3s } from './k3s.js';
8
+ import { supervise } from './superviseCommand.js';
8
9
  function readVersion() {
9
10
  try {
10
11
  const pkgUrl = new URL('../package.json', import.meta.url);
@@ -43,6 +44,10 @@ async function main() {
43
44
  await setupK3s(options);
44
45
  return;
45
46
  }
47
+ if (options.command === 'supervise') {
48
+ await supervise(options);
49
+ return;
50
+ }
46
51
  await bootstrap(options);
47
52
  }
48
53
  main().catch((err) => {
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG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C,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC5F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
package/dist/execution.js CHANGED
@@ -20,7 +20,7 @@ export const NATIVE_HARNESS_INFO = {
20
20
  * with the backend catalog when the flagship models change.
21
21
  */
22
22
  export const NATIVE_MODELS = [
23
- { id: 'claude-opus', label: 'Claude Opus 4.8', harness: 'claude-code' },
23
+ { id: 'claude-opus', label: 'Claude Opus 5', harness: 'claude-code' },
24
24
  { id: 'claude-sonnet', label: 'Claude Sonnet 4.6', harness: 'claude-code' },
25
25
  { id: 'gpt-5.5', label: 'GPT-5.5', harness: 'codex' },
26
26
  { id: 'gpt-5.4', label: 'GPT-5.4', harness: 'codex' },
@@ -1 +1 @@
1
- {"version":3,"file":"execution.js","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,gBAAgB,GAEjB,MAAM,gBAAgB,CAAA;AAgBvB,MAAM,CAAC,MAAM,mBAAmB,GAA6C;IAC3E,aAAa,EAAE;QACb,OAAO,EAAE,aAAa;QACtB,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,2DAA2D;KACnE;IACD,KAAK,EAAE;QACL,OAAO,EAAE,OAAO;QAChB,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,kDAAkD;KAC1D;CACF,CAAA;AAWD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAE;IACvE,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,aAAa,EAAE;IAC3E,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EA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,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC7D,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,wBAAwB,GAAoC;IACvE,IAAI,EAAE;QACJ,6CAA6C;QAC7C,6DAA6D,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;QAC7F,0EAA0E;QAC1E,mFAAmF;QACnF,sEAAsE;KACvE;IACD,MAAM,EAAE;QACN,oBAAoB;QACpB,wFAAwF;QACxF,+EAA+E;QAC/E,wDAAwD;QACxD,4DAA4D;QAC5D,iFAAiF;QACjF,uFAAuF;QACvF,6EAA6E;KAC9E;CACF,CAAA;AAED,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAoB,CAAC,GAAG,gBAAgB,CAAC,CAAA"}
@@ -35,10 +35,16 @@ export interface HostShell {
35
35
  * `opts.input`, when set, is written to the child's stdin and the stream is closed — used to
36
36
  * feed a manifest to `kubectl apply -f -` WITHOUT writing it (or the token Secret it creates)
37
37
  * to a temp file on disk.
38
+ *
39
+ * `opts.cwd` runs the command from a specific directory. Required by anything that shells out to
40
+ * a directory-sensitive tool: `docker compose` resolves its `docker-compose.yml` relative to the
41
+ * working directory, so a supervisor launched from elsewhere would silently operate on no
42
+ * compose project at all.
38
43
  */
39
44
  run(cmd: string, args: string[], opts?: {
40
45
  timeoutMs?: number;
41
46
  input?: string;
47
+ cwd?: string;
42
48
  }): Promise<ShellResult>;
43
49
  }
44
50
  /** The real, process-backed {@link HostShell}. */
@@ -1 +1 @@
1
- {"version":3,"file":"host-shell.d.ts","sourceRoot":"","sources":["../src/host-shell.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;;OASG;IACH,GAAG,CACD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5C,OAAO,CAAC,WAAW,CAAC,CAAA;CACxB;AAED,kDAAkD;AAClD,wBAAgB,eAAe,IAAI,SAAS,CA2D3C"}
1
+ {"version":3,"file":"host-shell.d.ts","sourceRoot":"","sources":["../src/host-shell.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;;;;;;;OAcG;IACH,GAAG,CACD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1D,OAAO,CAAC,WAAW,CAAC,CAAA;CACxB;AAED,kDAAkD;AAClD,wBAAgB,eAAe,IAAI,SAAS,CA2D3C"}
@@ -32,7 +32,7 @@ export function createNodeShell() {
32
32
  const stdin = opts?.input !== undefined ? 'pipe' : 'ignore';
33
33
  let child;
34
34
  try {
35
- child = spawn(cmd, args, { stdio: [stdin, 'pipe', 'pipe'] });
35
+ child = spawn(cmd, args, { cwd: opts?.cwd, stdio: [stdin, 'pipe', 'pipe'] });
36
36
  }
37
37
  catch {
38
38
  finish({ code: COMMAND_NOT_FOUND, stdout: '', stderr: `${cmd}: not found` });
@@ -1 +1 @@
1
- {"version":3,"file":"host-shell.js","sourceRoot":"","sources":["../src/host-shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAa1C,mGAAmG;AACnG,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAA;AA0BhD,kDAAkD;AAClD,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI;YACjB,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,0BAA0B,CAAA;YAC/D,OAAO,IAAI,OAAO,CAAc,CAAC,OAAO,EAAE,EAAE;gBAC1C,IAAI,MAAM,GAAG,EAAE,CAAA;gBACf,IAAI,MAAM,GAAG,EAAE,CAAA;gBACf,IAAI,OAAO,GAAG,KAAK,CAAA;gBACnB,IAAI,KAAgD,CAAA;gBACpD,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAQ,EAAE;oBAC3C,IAAI,OAAO;wBAAE,OAAM;oBACnB,OAAO,GAAG,IAAI,CAAA;oBACd,IAAI,KAAK;wBAAE,YAAY,CAAC,KAAK,CAAC,CAAA;oBAC9B,OAAO,CAAC,MAAM,CAAC,CAAA;gBACjB,CAAC,CAAA;gBAED,4EAA4E;gBAC5E,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAA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dependency.
3
+ *
4
+ * WHY. A slept laptop takes the k3s control plane with it, and nothing brings it back. The failure
5
+ * is quiet in the worst way: the container engine's `unless-stopped` policy DOES retry the server
6
+ * node, so `docker ps` shows motion — but the load balancer in front of it boots, fails to resolve
7
+ * its now-missing upstream, exits 0, and is restarted forever. A zero exit code reads as healthy at
8
+ * a glance, so the cluster can sit dead for days while `kubectl` just times out and every
9
+ * environment provisioned through the Local k3s handler fails.
10
+ *
11
+ * WHAT THIS CAN AND CANNOT FIX. A cluster whose containers are merely STOPPED is repairable here:
12
+ * start it, wait for the apiserver. A cluster whose restart is blocked by a wedged cgroup
13
+ * (`runc create failed: ... cgroup.procs: device or resource busy`, the state a suspend can leave
14
+ * behind) is NOT: clearing it requires restarting the container engine itself, which would kill
15
+ * every other container — including the database this same supervisor depends on. So that case is
16
+ * detected and NAMED rather than retried. Looping on it would reproduce exactly the uselessness of
17
+ * the load-balancer restart loop this dependency exists to prevent.
18
+ */
19
+ import type { HostShell } from './host-shell.js';
20
+ import { OperatorActionRequiredError, type ServiceDependency } from './supervise-runtime.js';
21
+ /** The local distributions a supervised cluster can run on. `k3s` proper is a host service, not ours to start. */
22
+ export type SupervisedK3sRuntime = 'k3d' | 'kind';
23
+ /**
24
+ * The cgroup-wedge signature. runc reports it when a dead container's cgroup was never torn down,
25
+ * so the new task cannot be created in it — the state a suspend/resume cycle can leave behind, and
26
+ * the one thing a start command can never talk its way out of.
27
+ */
28
+ export declare function looksLikeCgroupWedge(output: string): boolean;
29
+ /** The guidance printed when the wedge is hit — the only sequence that actually clears it. */
30
+ export declare const CGROUP_WEDGE_GUIDANCE: string;
31
+ /**
32
+ * Build the cluster dependency. `reachable` is judged from the apiserver's OWN version — the only
33
+ * signal that survives every intermediate lie (containers up but apiserver not listening, LB up but
34
+ * upstream missing, kubeconfig present but stale).
35
+ */
36
+ export declare function createK3sClusterDependency(shell: HostShell, opts: {
37
+ cluster: string;
38
+ runtime: SupervisedK3sRuntime;
39
+ /** Overridable so tests don't wait out the real budget. */
40
+ readyTimeoutMs?: number;
41
+ readyPollMs?: number;
42
+ }): ServiceDependency;
43
+ /**
44
+ * Thrown when the cluster cannot be restarted without operator action. Distinct from a plain
45
+ * `false` (not ready, retry next cycle) precisely so the loop can stop repeating a hopeless step
46
+ * and surface the fix instead.
47
+ */
48
+ export declare class K3sWedgedError extends OperatorActionRequiredError {
49
+ }
50
+ //# sourceMappingURL=supervise-k3s.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supervise-k3s.d.ts","sourceRoot":"","sources":["../src/supervise-k3s.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD,OAAO,EAAE,2BAA2B,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE5F,kHAAkH;AAClH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,CAAA;AAMjD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,QAIkD,CAAA;AAEpF;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,oBAAoB,CAAA;IAC7B,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GACA,iBAAiB,CA+EnB;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,2BAA2B;CAAG"}