@cat-factory/cli 0.10.5 → 0.11.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 +8 -0
- package/dist/args.d.ts +16 -1
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +44 -14
- package/dist/args.js.map +1 -1
- package/dist/host-shell.d.ts +26 -0
- package/dist/host-shell.d.ts.map +1 -1
- package/dist/host-shell.js +19 -0
- package/dist/host-shell.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/k3s-handler.d.ts +35 -20
- package/dist/k3s-handler.d.ts.map +1 -1
- package/dist/k3s-handler.js +54 -26
- package/dist/k3s-handler.js.map +1 -1
- package/dist/k3s-ingress.d.ts +259 -0
- package/dist/k3s-ingress.d.ts.map +1 -0
- package/dist/k3s-ingress.js +372 -0
- package/dist/k3s-ingress.js.map +1 -0
- package/dist/k3s-probe.d.ts +38 -3
- package/dist/k3s-probe.d.ts.map +1 -1
- package/dist/k3s-probe.js +93 -5
- package/dist/k3s-probe.js.map +1 -1
- package/dist/k3s-provision.d.ts +92 -18
- package/dist/k3s-provision.d.ts.map +1 -1
- package/dist/k3s-provision.js +280 -28
- package/dist/k3s-provision.js.map +1 -1
- package/dist/k3s.d.ts +3 -0
- package/dist/k3s.d.ts.map +1 -1
- package/dist/k3s.js +149 -24
- package/dist/k3s.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -45,6 +45,14 @@ 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
|
+
It probes the host, creates or reuses a cluster, applies a least-privilege ServiceAccount, mints a
|
|
49
|
+
token, and hands the values to the SPA's connect form. It also CHECKS, rather than assumes, whether
|
|
50
|
+
the cluster can serve an ingress-derived environment URL: that needs an ingress controller inside
|
|
51
|
+
the cluster and a host port published into it (`--ingress-port`, default 80). When either is
|
|
52
|
+
missing the summary says so and names the fix instead of printing a host template that resolves to
|
|
53
|
+
nothing. A published host port is fixed when the cluster is created, so `--recreate` destroys the
|
|
54
|
+
named k3d/kind cluster and builds it again from the current flags. It names what is on the cluster
|
|
55
|
+
before deleting it, and `-y` on its own never selects it.
|
|
48
56
|
- **`cat-factory supervise`**: run a dev command under a self-healing watchdog (see
|
|
49
57
|
[Supervising local dev](#supervising-local-dev)).
|
|
50
58
|
|
package/dist/args.d.ts
CHANGED
|
@@ -32,6 +32,21 @@ export interface CliOptions {
|
|
|
32
32
|
clusterName?: string;
|
|
33
33
|
/** `k3s` command: the Kubernetes distribution to provision/target. */
|
|
34
34
|
k3sRuntime?: K3sRuntime;
|
|
35
|
+
/**
|
|
36
|
+
* `k3s` command: host port published into the cluster's ingress controller, so an
|
|
37
|
+
* ingress-template environment URL resolves to something. Fixed at cluster-create time.
|
|
38
|
+
*/
|
|
39
|
+
ingressPort?: number;
|
|
40
|
+
/**
|
|
41
|
+
* `k3s` command: DESTROY the named local cluster and build it again from the current flags.
|
|
42
|
+
*
|
|
43
|
+
* A flag rather than a subcommand because everything a recreate needs (`--cluster-name`,
|
|
44
|
+
* `--runtime`, `--ingress-port`) is already `k3s`'s own option surface, and the flow around it
|
|
45
|
+
* (probe, RBAC, token, hand-off) is byte-for-byte the create path's: a subcommand would be the
|
|
46
|
+
* same command with one step in front of it. It is also what makes destructive intent EXPLICIT
|
|
47
|
+
* rather than inferred, since `--yes` alone can never select a recreate.
|
|
48
|
+
*/
|
|
49
|
+
recreate?: boolean;
|
|
35
50
|
/** `k3s` command: base URL of the running SPA, opened (deep-linked) to wire the handler. */
|
|
36
51
|
appUrl?: string;
|
|
37
52
|
/** `supervise` command: the command to run and keep alive — everything after `--`. */
|
|
@@ -75,5 +90,5 @@ export declare const OPTION_DEFAULTS: {
|
|
|
75
90
|
readonly appUrl: 'http://localhost:3000';
|
|
76
91
|
readonly healthPath: '/health';
|
|
77
92
|
};
|
|
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";
|
|
93
|
+
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 --ingress-port <n> Host port published into the cluster's ingress controller (default: 80).\n Fixed when the cluster is created: changing it needs --recreate.\n --recreate DESTROY the named k3d/kind cluster and build it again from these flags.\n Names what is on it first and asks before deleting. Never selected for\n you: -y alone cannot pick this path.\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\n Ingress-derived environment URLs need TWO things, and both are checked rather than assumed: an\n ingress controller in the cluster, and a host port published into it. A published host port\n cannot be added to a running k3d/kind cluster, which is what --recreate is for.\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";
|
|
79
94
|
//# sourceMappingURL=args.d.ts.map
|
package/dist/args.d.ts.map
CHANGED
|
@@ -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,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AE,aAAa;aAC1B,QAAQ,EAAE,0BAA0B;aACpC,QAAQ,EAAc,WAAW;aACjC,WAAW,EAAE,8CAA8C;aAI3D,IAAI,EAAE,IAAI;aAGV,gBAAgB,EAAc,gBAAgB;aAC9C,aAAa,EAAY,aAAa;aAEtC,cAAc,EAAE,aAAa;aAC7B,UAAU,EAAW,UAAU;aAG/B,MAAM,EAAE,uBAAuB;aAE/B,UAAU,EAAE,SAAS;CACb,CAAA;AAEV,eAAO,MAAM,SAAS,o9NAsGrB,CAAA"}
|
package/dist/args.js
CHANGED
|
@@ -104,11 +104,44 @@ function applyCommandToken(flag, opts, commandSet) {
|
|
|
104
104
|
return { handled: false, commandSet };
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* The flags that name a local Kubernetes CLUSTER: which one, how it is built, and how the SPA is
|
|
109
|
+
* reached to wire it. Split out of {@link applyOptionFlag} so the one table stays under the
|
|
110
|
+
* complexity ratchet, and because they are the group that grows together (`--ingress-port` and
|
|
111
|
+
* `--recreate` arrived as a pair with the ingress work). Returns `false` for anything not its own.
|
|
112
|
+
*/
|
|
113
|
+
function applyClusterFlag(flag, opts, take) {
|
|
114
|
+
switch (flag) {
|
|
115
|
+
case '--cluster-name':
|
|
116
|
+
opts.clusterName = take(flag);
|
|
117
|
+
break;
|
|
118
|
+
case '--runtime':
|
|
119
|
+
opts.k3sRuntime = parseK3sRuntime(take(flag));
|
|
120
|
+
break;
|
|
121
|
+
case '--ingress-port':
|
|
122
|
+
opts.ingressPort = parsePort(take(flag), flag);
|
|
123
|
+
break;
|
|
124
|
+
case '--recreate':
|
|
125
|
+
opts.recreate = true;
|
|
126
|
+
break;
|
|
127
|
+
case '--app-url':
|
|
128
|
+
opts.appUrl = parseAppUrl(take(flag));
|
|
129
|
+
break;
|
|
130
|
+
case '--k3s-cluster':
|
|
131
|
+
opts.k3sCluster = take(flag);
|
|
132
|
+
break;
|
|
133
|
+
default:
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
107
138
|
/**
|
|
108
139
|
* Apply a single option flag, consuming its value from the queue (via `take`) where one is
|
|
109
140
|
* required. Returns `false` for an unrecognised flag so the caller can raise the error.
|
|
110
141
|
*/
|
|
111
142
|
function applyOptionFlag(flag, opts, take) {
|
|
143
|
+
if (applyClusterFlag(flag, opts, take))
|
|
144
|
+
return true;
|
|
112
145
|
switch (flag) {
|
|
113
146
|
case '--dir':
|
|
114
147
|
case '-d':
|
|
@@ -150,15 +183,6 @@ function applyOptionFlag(flag, opts, take) {
|
|
|
150
183
|
case '--harness-entry':
|
|
151
184
|
opts.harnessEntry = take(flag);
|
|
152
185
|
break;
|
|
153
|
-
case '--cluster-name':
|
|
154
|
-
opts.clusterName = take(flag);
|
|
155
|
-
break;
|
|
156
|
-
case '--runtime':
|
|
157
|
-
opts.k3sRuntime = parseK3sRuntime(take(flag));
|
|
158
|
-
break;
|
|
159
|
-
case '--app-url':
|
|
160
|
-
opts.appUrl = parseAppUrl(take(flag));
|
|
161
|
-
break;
|
|
162
186
|
case '--health-path':
|
|
163
187
|
opts.healthPath = parseHealthPath(take(flag));
|
|
164
188
|
break;
|
|
@@ -168,9 +192,6 @@ function applyOptionFlag(flag, opts, take) {
|
|
|
168
192
|
case '--compose-service':
|
|
169
193
|
opts.composeService = take(flag);
|
|
170
194
|
break;
|
|
171
|
-
case '--k3s-cluster':
|
|
172
|
-
opts.k3sCluster = take(flag);
|
|
173
|
-
break;
|
|
174
195
|
case '--poll':
|
|
175
196
|
opts.pollSeconds = parseWholeSeconds(flag, take(flag), 1);
|
|
176
197
|
break;
|
|
@@ -270,10 +291,10 @@ function parseFailures(value) {
|
|
|
270
291
|
}
|
|
271
292
|
return n;
|
|
272
293
|
}
|
|
273
|
-
function parsePort(value) {
|
|
294
|
+
function parsePort(value, flag = '--port') {
|
|
274
295
|
const n = Number(value);
|
|
275
296
|
if (!Number.isInteger(n) || n < 1 || n > 65535) {
|
|
276
|
-
throw new ArgError(`Invalid
|
|
297
|
+
throw new ArgError(`Invalid ${flag} "${value}" (expected an integer 1-65535)`);
|
|
277
298
|
}
|
|
278
299
|
return n;
|
|
279
300
|
}
|
|
@@ -380,6 +401,11 @@ Options (env):
|
|
|
380
401
|
Options (k3s):
|
|
381
402
|
--cluster-name <n> Name for a provisioned local cluster (default: cat-factory)
|
|
382
403
|
--runtime <r> Kubernetes distribution: k3d | kind | k3s (default: k3d)
|
|
404
|
+
--ingress-port <n> Host port published into the cluster's ingress controller (default: 80).
|
|
405
|
+
Fixed when the cluster is created: changing it needs --recreate.
|
|
406
|
+
--recreate DESTROY the named k3d/kind cluster and build it again from these flags.
|
|
407
|
+
Names what is on it first and asks before deleting. Never selected for
|
|
408
|
+
you: -y alone cannot pick this path.
|
|
383
409
|
--app-url <url> SPA base URL to deep-link for wiring (default: http://localhost:3000)
|
|
384
410
|
--no-open Don't open the browser at the pre-filled connect form (still prints it)
|
|
385
411
|
-y, --yes Non-interactive: pick the recommended path + skip confirms
|
|
@@ -388,6 +414,10 @@ Options (k3s):
|
|
|
388
414
|
pre-filled (paste the token, then Test -> Save). A hands-free --register flag that POSTs the
|
|
389
415
|
handler to the local API directly is a planned follow-up.
|
|
390
416
|
|
|
417
|
+
Ingress-derived environment URLs need TWO things, and both are checked rather than assumed: an
|
|
418
|
+
ingress controller in the cluster, and a host port published into it. A published host port
|
|
419
|
+
cannot be added to a running k3d/kind cluster, which is what --recreate is for.
|
|
420
|
+
|
|
391
421
|
Options (supervise):
|
|
392
422
|
--port <n> Port the supervised server binds (default: 8787)
|
|
393
423
|
--health-path <p> Health endpoint probed on that port (default: /health)
|
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,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C,IAAI,EAAE,IAAI;IACV,gGAAgG;IAChG,0FAA0F;IAC1F,gBAAgB,EAAE,QAA4B;IAC9C,aAAa,EAAE,MAAuB;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsGxB,CAAA"}
|
package/dist/host-shell.d.ts
CHANGED
|
@@ -10,6 +10,20 @@ export interface ShellResult {
|
|
|
10
10
|
}
|
|
11
11
|
/** Conventional exit code for a missing binary — returned by {@link HostShell.run} on `ENOENT`. */
|
|
12
12
|
export declare const COMMAND_NOT_FOUND = 127;
|
|
13
|
+
/**
|
|
14
|
+
* A single command to run through the {@link HostShell}, optionally with stdin `input`.
|
|
15
|
+
*
|
|
16
|
+
* Lives here rather than beside one of its planners because several modules now plan commands
|
|
17
|
+
* (provisioning, the ingress probe) and a shared type in either of them would make the pair
|
|
18
|
+
* import each other.
|
|
19
|
+
*/
|
|
20
|
+
export interface Command {
|
|
21
|
+
cmd: string;
|
|
22
|
+
args: string[];
|
|
23
|
+
input?: string;
|
|
24
|
+
/** Per-command watchdog override (ms). Absent ⇒ the {@link HostShell} default applies. */
|
|
25
|
+
timeoutMs?: number;
|
|
26
|
+
}
|
|
13
27
|
/** Conventional exit code for a command killed by the watchdog timeout (mirrors `timeout(1)`). */
|
|
14
28
|
export declare const COMMAND_TIMED_OUT = 124;
|
|
15
29
|
/**
|
|
@@ -47,6 +61,18 @@ export interface HostShell {
|
|
|
47
61
|
cwd?: string;
|
|
48
62
|
}): Promise<ShellResult>;
|
|
49
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Run a planned {@link Command} through a shell, honouring every field it carries.
|
|
66
|
+
*
|
|
67
|
+
* Use this for a READ whose non-zero exit is data rather than a failure (a probe, a best-effort
|
|
68
|
+
* list). `shell.run(command.cmd, command.args)` at a call site looks equivalent and is not: it
|
|
69
|
+
* silently drops `input` and the per-command `timeoutMs`, and hard-codes the binary the planner
|
|
70
|
+
* was there to name, so changing `cmd` keeps invoking the old one and the read gets the 10s
|
|
71
|
+
* default watchdog instead of its own.
|
|
72
|
+
*/
|
|
73
|
+
export declare function runCommand(shell: HostShell, command: Command): Promise<ShellResult>;
|
|
74
|
+
/** A planned command rendered as the shell line a human would type, for printed guidance. */
|
|
75
|
+
export declare function renderCommandLine(command: Command): string;
|
|
50
76
|
/** The real, process-backed {@link HostShell}. */
|
|
51
77
|
export declare function createNodeShell(): HostShell;
|
|
52
78
|
//# sourceMappingURL=host-shell.d.ts.map
|
package/dist/host-shell.d.ts.map
CHANGED
|
@@ -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;;;;;;;;;;;;;;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,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ClD,wBAAgB,eAAe,IAAI,SAAS,CA2D3C"}
|
package/dist/host-shell.js
CHANGED
|
@@ -10,6 +10,25 @@ export const COMMAND_TIMED_OUT = 124;
|
|
|
10
10
|
* {@link COMMAND_TIMED_OUT} so the probe treats it as "ran but failed" (not reachable), never hangs.
|
|
11
11
|
*/
|
|
12
12
|
export const DEFAULT_COMMAND_TIMEOUT_MS = 10_000;
|
|
13
|
+
/**
|
|
14
|
+
* Run a planned {@link Command} through a shell, honouring every field it carries.
|
|
15
|
+
*
|
|
16
|
+
* Use this for a READ whose non-zero exit is data rather than a failure (a probe, a best-effort
|
|
17
|
+
* list). `shell.run(command.cmd, command.args)` at a call site looks equivalent and is not: it
|
|
18
|
+
* silently drops `input` and the per-command `timeoutMs`, and hard-codes the binary the planner
|
|
19
|
+
* was there to name, so changing `cmd` keeps invoking the old one and the read gets the 10s
|
|
20
|
+
* default watchdog instead of its own.
|
|
21
|
+
*/
|
|
22
|
+
export function runCommand(shell, command) {
|
|
23
|
+
return shell.run(command.cmd, command.args, {
|
|
24
|
+
input: command.input,
|
|
25
|
+
timeoutMs: command.timeoutMs,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/** A planned command rendered as the shell line a human would type, for printed guidance. */
|
|
29
|
+
export function renderCommandLine(command) {
|
|
30
|
+
return [command.cmd, ...command.args].join(' ');
|
|
31
|
+
}
|
|
13
32
|
/** The real, process-backed {@link HostShell}. */
|
|
14
33
|
export function createNodeShell() {
|
|
15
34
|
return {
|
package/dist/host-shell.js.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"host-shell.js","sourceRoot":"","sources":["../src/host-shell.ts"],"names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C,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;oBACzC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAA;gBAC5B,CAAC,CAAC,CAAA;gBACF,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;oBACzC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAA;gBAC5B,CAAC,CAAC,CAAA;gBACF,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;oBAC/C,oFAAoF;oBACpF,qFAAqF;oBACrF,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA;oBAC1D,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;gBACzD,CAAC,CAAC,CAAA;gBACF,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;oBACzB,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;gBAC7C,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ export { type CliOptions, HELP_TEXT, K3S_RUNTIMES, type K3sRuntime, OPTION_DEFAU
|
|
|
2
2
|
export { bootstrap, type BootstrapDeps, BootstrapError } from './bootstrap.js';
|
|
3
3
|
export { type EnvCommandDeps, EnvCommandError, generateEnv } from './envCommand.js';
|
|
4
4
|
export { type FileSystem } from './fs.js';
|
|
5
|
-
export { COMMAND_NOT_FOUND, COMMAND_TIMED_OUT, createNodeShell, DEFAULT_COMMAND_TIMEOUT_MS, type HostShell, type ShellResult, } from './host-shell.js';
|
|
5
|
+
export { type Command, COMMAND_NOT_FOUND, COMMAND_TIMED_OUT, createNodeShell, DEFAULT_COMMAND_TIMEOUT_MS, type HostShell, renderCommandLine, runCommand, type ShellResult, } from './host-shell.js';
|
|
6
6
|
export { K3S_INSTALL_COMMAND, type K3sDeps, type K3sResult, setupK3s } from './k3s.js';
|
|
7
|
-
export { buildK3sHandler, buildK3sSetupUrl,
|
|
8
|
-
export {
|
|
7
|
+
export { buildK3sHandler, buildK3sSetupUrl, DEFAULT_NAMESPACE_TEMPLATE, handlerLabel, type K3sHandlerInput, KUBERNETES_ENV_TOKEN_SECRET_KEY, } from './k3s-handler.js';
|
|
8
|
+
export { DEFAULT_INGRESS_PORT, INGRESS_HOST_TEMPLATE, type IngressReadiness, ingressHostTemplate, ingressUrlPort, } from './k3s-ingress.js';
|
|
9
|
+
export { classifyHost, hasServerVersion, type HostDetections, type HostState, isRecreateOffer, type Offer, type OfferId, parseK3dClusters, parseKindClusters, probeHost, RECREATE_OFFERS, recreateOfferFor, recreateTargetForContext, type ToolDetection, } from './k3s-probe.js';
|
|
9
10
|
export { buildFrontendEnv, buildLocalEnv, type EnvEntry, type FrontendEnvInput, type LocalEnvInput, renderEnvFile, } from './env.js';
|
|
10
11
|
export { buildGitignore, mergeGitignore, REQUIRED_GITIGNORE_RULES } from './gitignore.js';
|
|
11
12
|
export { type Io, createConsoleIo } from './io.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EACf,SAAS,EACT,YAAY,EACZ,KAAK,UAAU,EACf,eAAe,EACf,SAAS,EACT,QAAQ,GACT,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,EAAE,KAAK,cAAc,EAAE,e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A"}
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,11 @@ export { HELP_TEXT, K3S_RUNTIMES, OPTION_DEFAULTS, parseArgs, ArgError, } from '
|
|
|
4
4
|
export { bootstrap, BootstrapError } from './bootstrap.js';
|
|
5
5
|
export { EnvCommandError, generateEnv } from './envCommand.js';
|
|
6
6
|
export {} from './fs.js';
|
|
7
|
-
export { COMMAND_NOT_FOUND, COMMAND_TIMED_OUT, createNodeShell, DEFAULT_COMMAND_TIMEOUT_MS, } from './host-shell.js';
|
|
7
|
+
export { COMMAND_NOT_FOUND, COMMAND_TIMED_OUT, createNodeShell, DEFAULT_COMMAND_TIMEOUT_MS, renderCommandLine, runCommand, } from './host-shell.js';
|
|
8
8
|
export { K3S_INSTALL_COMMAND, setupK3s } from './k3s.js';
|
|
9
|
-
export { buildK3sHandler, buildK3sSetupUrl,
|
|
10
|
-
export {
|
|
9
|
+
export { buildK3sHandler, buildK3sSetupUrl, DEFAULT_NAMESPACE_TEMPLATE, handlerLabel, KUBERNETES_ENV_TOKEN_SECRET_KEY, } from './k3s-handler.js';
|
|
10
|
+
export { DEFAULT_INGRESS_PORT, INGRESS_HOST_TEMPLATE, ingressHostTemplate, ingressUrlPort, } from './k3s-ingress.js';
|
|
11
|
+
export { classifyHost, hasServerVersion, isRecreateOffer, parseK3dClusters, parseKindClusters, probeHost, RECREATE_OFFERS, recreateOfferFor, recreateTargetForContext, } from './k3s-probe.js';
|
|
11
12
|
export { buildFrontendEnv, buildLocalEnv, renderEnvFile, } from './env.js';
|
|
12
13
|
export { buildGitignore, mergeGitignore, REQUIRED_GITIGNORE_RULES } from './gitignore.js';
|
|
13
14
|
export { createConsoleIo } from './io.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8FAA8F;AAC9F,OAAO,EAEL,SAAS,EACT,YAAY,EAEZ,e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cAAc,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzF,OAAO,EAAW,eAAe,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAuB,SAAS,EAAoB,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAE,eAAe,EAA2C,MAAM,cAAc,CAAA;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EACL,kBAAkB,EAElB,eAAe,EAEf,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,GAEjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAGnB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,EACb,aAAa,GAEd,MAAM,UAAU,CAAA"}
|
package/dist/k3s-handler.d.ts
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { type ResolvedConnection } from './k3s-provision.js';
|
|
2
2
|
/**
|
|
3
3
|
* The secret-bundle key the Kubernetes env backend reads the ServiceAccount token from. Mirrors
|
|
4
|
-
* the contracts constant `KUBERNETES_ENV_TOKEN_SECRET_KEY
|
|
4
|
+
* the contracts constant `KUBERNETES_ENV_TOKEN_SECRET_KEY`, kept inline so the CLI stays free of a
|
|
5
5
|
* backend/contract RUNTIME dependency (the unit test validates the built handler against the real
|
|
6
6
|
* `registerEnvironmentHandlerSchema`, so any drift from the contract fails a test).
|
|
7
7
|
*/
|
|
8
8
|
export declare const KUBERNETES_ENV_TOKEN_SECRET_KEY = "apiToken";
|
|
9
9
|
/** Default per-PR namespace name template written into the handler (rendered with the PR number). */
|
|
10
10
|
export declare const DEFAULT_NAMESPACE_TEMPLATE = "cf-env-{{pullNumber}}";
|
|
11
|
-
/**
|
|
12
|
-
* Default ingress host template. `nip.io` is a wildcard DNS service that resolves
|
|
13
|
-
* `<anything>.127.0.0.1.nip.io` to loopback with no local DNS setup, so a per-branch env URL works
|
|
14
|
-
* against a local k3s/k3d/kind ingress out of the box.
|
|
15
|
-
*/
|
|
16
|
-
export declare const DEFAULT_INGRESS_HOST_TEMPLATE = "{{branch}}.127.0.0.1.nip.io";
|
|
17
11
|
/**
|
|
18
12
|
* The `RegisterEnvironmentHandlerInput` shape for the `local-k3s` engine, mirrored structurally
|
|
19
13
|
* here so the CLI stays free of a backend/contract runtime dependency. `k3s-handler.test.ts`
|
|
20
14
|
* validates a built value against the real `registerEnvironmentHandlerSchema`, so this can't drift
|
|
21
15
|
* from the contract without failing a test.
|
|
16
|
+
*
|
|
17
|
+
* `url.port` carries a non-default host port. It is deliberately NOT folded into `hostTemplate`:
|
|
18
|
+
* the rendered template is also the Ingress `host` a service's manifests declare, and Kubernetes
|
|
19
|
+
* rejects a `host` with a port in it.
|
|
22
20
|
*/
|
|
23
21
|
export interface K3sHandlerInput {
|
|
24
22
|
provisionType: 'kubernetes';
|
|
@@ -32,6 +30,8 @@ export interface K3sHandlerInput {
|
|
|
32
30
|
url: {
|
|
33
31
|
source: 'ingressTemplate';
|
|
34
32
|
hostTemplate: string;
|
|
33
|
+
port?: number;
|
|
34
|
+
scheme: 'http';
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
};
|
|
@@ -40,20 +40,35 @@ export interface K3sHandlerInput {
|
|
|
40
40
|
/** Human label for the auto-provisioned connection (names the created cluster when there is one). */
|
|
41
41
|
export declare function handlerLabel(connection: ResolvedConnection): string;
|
|
42
42
|
/**
|
|
43
|
-
* Build the `local-k3s` infra handler registration input from a provisioned connection
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* apiserver self-
|
|
47
|
-
* non-secret config. The result is exactly what the
|
|
48
|
-
* Test/Save posts, so the guided flow reuses the #557
|
|
43
|
+
* Build the `local-k3s` infra handler registration input from a provisioned connection, or `null`
|
|
44
|
+
* when there is nothing honest to register. The minted ServiceAccount token rides ONLY in the
|
|
45
|
+
* write-only `secrets` bundle (never in the config, never in the deep-link). Everything else (the
|
|
46
|
+
* loopback apiserver URL, the skip-TLS flag for a self-signed local apiserver, the per-PR namespace
|
|
47
|
+
* and the nip.io ingress host) is non-secret config. The result is exactly what the
|
|
48
|
+
* Settings → Infrastructure → Local k3s form's Test/Save posts, so the guided flow reuses the #557
|
|
49
|
+
* probe + registration unchanged.
|
|
50
|
+
*
|
|
51
|
+
* `null` is the whole point of the return type. The contract REQUIRES a `url` source, and
|
|
52
|
+
* `ingressTemplate` is the only one the CLI can fill on its own (the status-backed sources name a
|
|
53
|
+
* Service or Ingress that belongs to the operator's manifests), so a cluster whose ingress path the
|
|
54
|
+
* probe did not establish has no handler to build: filling the host template in anyway is how the
|
|
55
|
+
* unserved URL got saved. It used to fall back to the literal template, which was worse than stale
|
|
56
|
+
* on a `--ingress-port 8080` run, naming a port that run had not even asked for.
|
|
49
57
|
*/
|
|
50
|
-
export declare function buildK3sHandler(connection: ResolvedConnection): K3sHandlerInput;
|
|
58
|
+
export declare function buildK3sHandler(connection: ResolvedConnection): K3sHandlerInput | null;
|
|
51
59
|
/**
|
|
52
|
-
* Build the deep-link that opens the SPA's Local k3s connect form pre-filled with the
|
|
53
|
-
* NON-SECRET fields. The ServiceAccount token is deliberately omitted
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
60
|
+
* Build the deep-link that opens the SPA's Local k3s connect form pre-filled with the connection's
|
|
61
|
+
* NON-SECRET fields. The ServiceAccount token is deliberately omitted (a secret in a URL would leak
|
|
62
|
+
* into browser history / server logs), so the user pastes it (printed once to the terminal) before
|
|
63
|
+
* running Test → Save. Param names mirror the connect form's fields.
|
|
64
|
+
*
|
|
65
|
+
* The URL params are prefilled ONLY when the ingress probe established that the cluster can serve
|
|
66
|
+
* them, and that is read off the CONNECTION rather than passed in: the withholding used to ride an
|
|
67
|
+
* `{ ingressVerified }` option DEFAULTED to true, so every caller that forgot it (the integration
|
|
68
|
+
* spec among them) re-established the promise this exists to remove. The connect form treats the
|
|
69
|
+
* host template as required for an `ingressTemplate` source, so an operator whose cluster has no
|
|
70
|
+
* ingress path cannot save a URL nothing answers, and the printed summary tells them what to fix or
|
|
71
|
+
* which source to pick instead.
|
|
57
72
|
*/
|
|
58
|
-
export declare function buildK3sSetupUrl(spaBaseUrl: string,
|
|
73
|
+
export declare function buildK3sSetupUrl(spaBaseUrl: string, connection: ResolvedConnection): string;
|
|
59
74
|
//# sourceMappingURL=k3s-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k3s-handler.d.ts","sourceRoot":"","sources":["../src/k3s-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"k3s-handler.d.ts","sourceRoot":"","sources":["../src/k3s-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,aAAa,CAAA;AAEzD,qGAAqG;AACrG,eAAO,MAAM,0BAA0B,0BAA0B,CAAA;AAEjE;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,YAAY,CAAA;IAC3B,MAAM,EAAE;QACN,MAAM,EAAE,WAAW,CAAA;QACnB,UAAU,EAAE;YACV,KAAK,EAAE,MAAM,CAAA;YACb,YAAY,EAAE,MAAM,CAAA;YACpB,qBAAqB,EAAE,IAAI,CAAA;YAC3B,iBAAiB,EAAE,MAAM,CAAA;YACzB,GAAG,EAAE;gBAAE,MAAM,EAAE,iBAAiB,CAAC;gBAAC,YAAY,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAA;aAAE,CAAA;SACxF,CAAA;KACF,CAAA;IACD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEnE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CA0BtF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAgB3F"}
|
package/dist/k3s-handler.js
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
|
+
import { ingressHostTemplate, ingressUrlPort } from './k3s-ingress.js';
|
|
1
2
|
import {} from './k3s-provision.js';
|
|
2
3
|
/**
|
|
3
4
|
* The secret-bundle key the Kubernetes env backend reads the ServiceAccount token from. Mirrors
|
|
4
|
-
* the contracts constant `KUBERNETES_ENV_TOKEN_SECRET_KEY
|
|
5
|
+
* the contracts constant `KUBERNETES_ENV_TOKEN_SECRET_KEY`, kept inline so the CLI stays free of a
|
|
5
6
|
* backend/contract RUNTIME dependency (the unit test validates the built handler against the real
|
|
6
7
|
* `registerEnvironmentHandlerSchema`, so any drift from the contract fails a test).
|
|
7
8
|
*/
|
|
8
9
|
export const KUBERNETES_ENV_TOKEN_SECRET_KEY = 'apiToken';
|
|
9
10
|
/** Default per-PR namespace name template written into the handler (rendered with the PR number). */
|
|
10
11
|
export const DEFAULT_NAMESPACE_TEMPLATE = 'cf-env-{{pullNumber}}';
|
|
11
|
-
/**
|
|
12
|
-
* Default ingress host template. `nip.io` is a wildcard DNS service that resolves
|
|
13
|
-
* `<anything>.127.0.0.1.nip.io` to loopback with no local DNS setup, so a per-branch env URL works
|
|
14
|
-
* against a local k3s/k3d/kind ingress out of the box.
|
|
15
|
-
*/
|
|
16
|
-
export const DEFAULT_INGRESS_HOST_TEMPLATE = '{{branch}}.127.0.0.1.nip.io';
|
|
17
12
|
/** Human label for the auto-provisioned connection (names the created cluster when there is one). */
|
|
18
13
|
export function handlerLabel(connection) {
|
|
19
14
|
return connection.clusterName ? `Local k3s (${connection.clusterName})` : 'Local k3s';
|
|
20
15
|
}
|
|
21
16
|
/**
|
|
22
|
-
* Build the `local-k3s` infra handler registration input from a provisioned connection
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* apiserver self-
|
|
26
|
-
* non-secret config. The result is exactly what the
|
|
27
|
-
* Test/Save posts, so the guided flow reuses the #557
|
|
17
|
+
* Build the `local-k3s` infra handler registration input from a provisioned connection, or `null`
|
|
18
|
+
* when there is nothing honest to register. The minted ServiceAccount token rides ONLY in the
|
|
19
|
+
* write-only `secrets` bundle (never in the config, never in the deep-link). Everything else (the
|
|
20
|
+
* loopback apiserver URL, the skip-TLS flag for a self-signed local apiserver, the per-PR namespace
|
|
21
|
+
* and the nip.io ingress host) is non-secret config. The result is exactly what the
|
|
22
|
+
* Settings → Infrastructure → Local k3s form's Test/Save posts, so the guided flow reuses the #557
|
|
23
|
+
* probe + registration unchanged.
|
|
24
|
+
*
|
|
25
|
+
* `null` is the whole point of the return type. The contract REQUIRES a `url` source, and
|
|
26
|
+
* `ingressTemplate` is the only one the CLI can fill on its own (the status-backed sources name a
|
|
27
|
+
* Service or Ingress that belongs to the operator's manifests), so a cluster whose ingress path the
|
|
28
|
+
* probe did not establish has no handler to build: filling the host template in anyway is how the
|
|
29
|
+
* unserved URL got saved. It used to fall back to the literal template, which was worse than stale
|
|
30
|
+
* on a `--ingress-port 8080` run, naming a port that run had not even asked for.
|
|
28
31
|
*/
|
|
29
32
|
export function buildK3sHandler(connection) {
|
|
33
|
+
const hostTemplate = ingressHostTemplate(connection.ingress);
|
|
34
|
+
if (hostTemplate === null)
|
|
35
|
+
return null;
|
|
36
|
+
const port = ingressUrlPort(connection.ingress);
|
|
30
37
|
return {
|
|
31
38
|
provisionType: 'kubernetes',
|
|
32
39
|
config: {
|
|
@@ -36,29 +43,50 @@ export function buildK3sHandler(connection) {
|
|
|
36
43
|
apiServerUrl: connection.apiServerUrl,
|
|
37
44
|
insecureSkipTlsVerify: true,
|
|
38
45
|
namespaceTemplate: DEFAULT_NAMESPACE_TEMPLATE,
|
|
39
|
-
url: {
|
|
46
|
+
url: {
|
|
47
|
+
source: 'ingressTemplate',
|
|
48
|
+
hostTemplate,
|
|
49
|
+
...(port === null ? {} : { port }),
|
|
50
|
+
// A local ingress controller serves TLS with a self-signed certificate, so the derived
|
|
51
|
+
// environment URL is plain HTTP: the derivation's own default is `https`, which would
|
|
52
|
+
// hand the tester a URL that fails on the certificate rather than on the connection.
|
|
53
|
+
scheme: 'http',
|
|
54
|
+
},
|
|
40
55
|
},
|
|
41
56
|
},
|
|
42
57
|
secrets: { [KUBERNETES_ENV_TOKEN_SECRET_KEY]: connection.apiToken },
|
|
43
58
|
};
|
|
44
59
|
}
|
|
45
60
|
/**
|
|
46
|
-
* Build the deep-link that opens the SPA's Local k3s connect form pre-filled with the
|
|
47
|
-
* NON-SECRET fields. The ServiceAccount token is deliberately omitted
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
61
|
+
* Build the deep-link that opens the SPA's Local k3s connect form pre-filled with the connection's
|
|
62
|
+
* NON-SECRET fields. The ServiceAccount token is deliberately omitted (a secret in a URL would leak
|
|
63
|
+
* into browser history / server logs), so the user pastes it (printed once to the terminal) before
|
|
64
|
+
* running Test → Save. Param names mirror the connect form's fields.
|
|
65
|
+
*
|
|
66
|
+
* The URL params are prefilled ONLY when the ingress probe established that the cluster can serve
|
|
67
|
+
* them, and that is read off the CONNECTION rather than passed in: the withholding used to ride an
|
|
68
|
+
* `{ ingressVerified }` option DEFAULTED to true, so every caller that forgot it (the integration
|
|
69
|
+
* spec among them) re-established the promise this exists to remove. The connect form treats the
|
|
70
|
+
* host template as required for an `ingressTemplate` source, so an operator whose cluster has no
|
|
71
|
+
* ingress path cannot save a URL nothing answers, and the printed summary tells them what to fix or
|
|
72
|
+
* which source to pick instead.
|
|
51
73
|
*/
|
|
52
|
-
export function buildK3sSetupUrl(spaBaseUrl,
|
|
53
|
-
const k = handler.config.kubernetes;
|
|
74
|
+
export function buildK3sSetupUrl(spaBaseUrl, connection) {
|
|
54
75
|
const url = new URL(spaBaseUrl);
|
|
55
76
|
const params = url.searchParams;
|
|
56
77
|
params.set('infraSetup', 'local-k3s');
|
|
57
|
-
params.set('label',
|
|
58
|
-
params.set('apiServerUrl',
|
|
59
|
-
params.set('namespaceTemplate',
|
|
60
|
-
|
|
61
|
-
if (
|
|
78
|
+
params.set('label', handlerLabel(connection));
|
|
79
|
+
params.set('apiServerUrl', connection.apiServerUrl);
|
|
80
|
+
params.set('namespaceTemplate', DEFAULT_NAMESPACE_TEMPLATE);
|
|
81
|
+
const handler = buildK3sHandler(connection);
|
|
82
|
+
if (handler) {
|
|
83
|
+
const k = handler.config.kubernetes.url;
|
|
84
|
+
params.set('hostTemplate', k.hostTemplate);
|
|
85
|
+
params.set('scheme', k.scheme);
|
|
86
|
+
if (k.port !== undefined)
|
|
87
|
+
params.set('ingressPort', String(k.port));
|
|
88
|
+
}
|
|
89
|
+
if (connection.insecureSkipTlsVerify)
|
|
62
90
|
params.set('insecureSkipTlsVerify', '1');
|
|
63
91
|
return url.toString();
|
|
64
92
|
}
|