@slowcook-ai/cli 0.19.6 → 0.21.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 +22 -2
- package/dist/cli.js +30 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/brand/index.d.ts.map +1 -1
- package/dist/commands/brand/index.js +6 -0
- package/dist/commands/brand/index.js.map +1 -1
- package/dist/commands/brand/logo-cmd.d.ts +2 -0
- package/dist/commands/brand/logo-cmd.d.ts.map +1 -0
- package/dist/commands/brand/logo-cmd.js +90 -0
- package/dist/commands/brand/logo-cmd.js.map +1 -0
- package/dist/commands/brand/logo.d.ts +23 -0
- package/dist/commands/brand/logo.d.ts.map +1 -0
- package/dist/commands/brand/logo.js +60 -0
- package/dist/commands/brand/logo.js.map +1 -0
- package/dist/commands/brew/fidelity-loop.d.ts +71 -0
- package/dist/commands/brew/fidelity-loop.d.ts.map +1 -0
- package/dist/commands/brew/fidelity-loop.js +108 -0
- package/dist/commands/brew/fidelity-loop.js.map +1 -0
- package/dist/commands/brew/fidelity-phase.d.ts +49 -0
- package/dist/commands/brew/fidelity-phase.d.ts.map +1 -0
- package/dist/commands/brew/fidelity-phase.js +75 -0
- package/dist/commands/brew/fidelity-phase.js.map +1 -0
- package/dist/commands/eye/index.d.ts +2 -0
- package/dist/commands/eye/index.d.ts.map +1 -0
- package/dist/commands/eye/index.js +83 -0
- package/dist/commands/eye/index.js.map +1 -0
- package/dist/commands/eye/plan.d.ts +69 -0
- package/dist/commands/eye/plan.d.ts.map +1 -0
- package/dist/commands/eye/plan.js +87 -0
- package/dist/commands/eye/plan.js.map +1 -0
- package/dist/commands/eye/run.d.ts +42 -0
- package/dist/commands/eye/run.d.ts.map +1 -0
- package/dist/commands/eye/run.js +116 -0
- package/dist/commands/eye/run.js.map +1 -0
- package/dist/commands/eye/spec-modes.d.ts +5 -0
- package/dist/commands/eye/spec-modes.d.ts.map +1 -0
- package/dist/commands/eye/spec-modes.js +36 -0
- package/dist/commands/eye/spec-modes.js.map +1 -0
- package/dist/commands/gate/github.d.ts +27 -0
- package/dist/commands/gate/github.d.ts.map +1 -0
- package/dist/commands/gate/github.js +46 -0
- package/dist/commands/gate/github.js.map +1 -0
- package/dist/commands/gate/index.d.ts +2 -0
- package/dist/commands/gate/index.d.ts.map +1 -0
- package/dist/commands/gate/index.js +68 -0
- package/dist/commands/gate/index.js.map +1 -0
- package/dist/commands/gate/model.d.ts +55 -0
- package/dist/commands/gate/model.d.ts.map +1 -0
- package/dist/commands/gate/model.js +64 -0
- package/dist/commands/gate/model.js.map +1 -0
- package/dist/commands/gate/reviewers.d.ts +24 -0
- package/dist/commands/gate/reviewers.d.ts.map +1 -0
- package/dist/commands/gate/reviewers.js +69 -0
- package/dist/commands/gate/reviewers.js.map +1 -0
- package/dist/commands/greenfield/index.d.ts +2 -0
- package/dist/commands/greenfield/index.d.ts.map +1 -0
- package/dist/commands/greenfield/index.js +80 -0
- package/dist/commands/greenfield/index.js.map +1 -0
- package/dist/commands/greenfield/status.d.ts +38 -0
- package/dist/commands/greenfield/status.d.ts.map +1 -0
- package/dist/commands/greenfield/status.js +52 -0
- package/dist/commands/greenfield/status.js.map +1 -0
- package/dist/commands/menu/assemble.d.ts +31 -0
- package/dist/commands/menu/assemble.d.ts.map +1 -0
- package/dist/commands/menu/assemble.js +37 -0
- package/dist/commands/menu/assemble.js.map +1 -0
- package/dist/commands/menu/index.d.ts +5 -0
- package/dist/commands/menu/index.d.ts.map +1 -0
- package/dist/commands/menu/index.js +111 -0
- package/dist/commands/menu/index.js.map +1 -0
- package/dist/commands/menu/prd.d.ts +33 -0
- package/dist/commands/menu/prd.d.ts.map +1 -0
- package/dist/commands/menu/prd.js +68 -0
- package/dist/commands/menu/prd.js.map +1 -0
- package/dist/commands/plate/index.d.ts.map +1 -1
- package/dist/commands/plate/index.js +5 -1
- package/dist/commands/plate/index.js.map +1 -1
- package/dist/commands/plate/route-hint.d.ts +18 -0
- package/dist/commands/plate/route-hint.d.ts.map +1 -0
- package/dist/commands/plate/route-hint.js +21 -0
- package/dist/commands/plate/route-hint.js.map +1 -0
- package/dist/commands/recon/shape-preserve.d.ts +38 -0
- package/dist/commands/recon/shape-preserve.d.ts.map +1 -1
- package/dist/commands/recon/shape-preserve.js +112 -1
- package/dist/commands/recon/shape-preserve.js.map +1 -1
- package/dist/commands/refine/spec-yaml.d.ts +26 -0
- package/dist/commands/refine/spec-yaml.d.ts.map +1 -1
- package/dist/commands/refine/spec-yaml.js +29 -0
- package/dist/commands/refine/spec-yaml.js.map +1 -1
- package/dist/commands/run-mock/index.d.ts.map +1 -1
- package/dist/commands/run-mock/index.js +69 -16
- package/dist/commands/run-mock/index.js.map +1 -1
- package/dist/commands/run-mock/reviewer-auth-server.d.ts +40 -0
- package/dist/commands/run-mock/reviewer-auth-server.d.ts.map +1 -0
- package/dist/commands/run-mock/reviewer-auth-server.js +124 -0
- package/dist/commands/run-mock/reviewer-auth-server.js.map +1 -0
- package/dist/commands/serve/config.d.ts +28 -9
- package/dist/commands/serve/config.d.ts.map +1 -1
- package/dist/commands/serve/config.js +43 -1
- package/dist/commands/serve/config.js.map +1 -1
- package/dist/commands/serve/dev.d.ts +14 -19
- package/dist/commands/serve/dev.d.ts.map +1 -1
- package/dist/commands/serve/dev.js +46 -50
- package/dist/commands/serve/dev.js.map +1 -1
- package/dist/commands/serve/index.d.ts.map +1 -1
- package/dist/commands/serve/index.js +30 -22
- package/dist/commands/serve/index.js.map +1 -1
- package/dist/commands/serve/mock.d.ts +5 -20
- package/dist/commands/serve/mock.d.ts.map +1 -1
- package/dist/commands/serve/mock.js +44 -65
- package/dist/commands/serve/mock.js.map +1 -1
- package/dist/commands/serve/runner.d.ts +52 -0
- package/dist/commands/serve/runner.d.ts.map +1 -0
- package/dist/commands/serve/runner.js +53 -0
- package/dist/commands/serve/runner.js.map +1 -0
- package/dist/commands/serve/staging.d.ts +8 -19
- package/dist/commands/serve/staging.d.ts.map +1 -1
- package/dist/commands/serve/staging.js +53 -91
- package/dist/commands/serve/staging.js.map +1 -1
- package/dist/commands/trace/check.d.ts +67 -0
- package/dist/commands/trace/check.d.ts.map +1 -0
- package/dist/commands/trace/check.js +82 -0
- package/dist/commands/trace/check.js.map +1 -0
- package/dist/commands/trace/index.d.ts +2 -0
- package/dist/commands/trace/index.d.ts.map +1 -0
- package/dist/commands/trace/index.js +86 -0
- package/dist/commands/trace/index.js.map +1 -0
- package/dist/commands/upsert-agent-docs.d.ts.map +1 -1
- package/dist/commands/upsert-agent-docs.js +12 -0
- package/dist/commands/upsert-agent-docs.js.map +1 -1
- package/dist/commands.manifest.d.ts.map +1 -1
- package/dist/commands.manifest.js +32 -2
- package/dist/commands.manifest.js.map +1 -1
- package/dist/lib/mock-shape.d.ts +6 -0
- package/dist/lib/mock-shape.d.ts.map +1 -1
- package/dist/lib/mock-shape.js +26 -0
- package/dist/lib/mock-shape.js.map +1 -1
- package/package.json +8 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAwC,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAqB,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAwC,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAqB,MAAM,WA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AK,CAAC,aAAa,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAoB;QACnC,IAAI,EAAE,IAAI,CAAC,IAAK;QAChB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC;IACF,OAAO,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -2,23 +2,12 @@
|
|
|
2
2
|
* `slowcook serve mock <verb>` — Phase 2 implementation.
|
|
3
3
|
*
|
|
4
4
|
* The mock profile runs the consumer's `mock/` package as a vite-dev
|
|
5
|
-
* server on a shared box
|
|
6
|
-
* all hit the same artefact at the same URL. Mock-vite runs alongside
|
|
7
|
-
* `serve dev` on the same host with distinct ports + profile-prefixed
|
|
8
|
-
* container names (per design #5).
|
|
5
|
+
* server on a shared box. See `dev.ts` header for the broader pattern.
|
|
9
6
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - down — stop the mock services (volumes preserved)
|
|
15
|
-
* - logs — pass-through to docker-compose logs
|
|
16
|
-
* - reset — no-op (mock has no scenario seed)
|
|
17
|
-
*
|
|
18
|
-
* Auto-skip per Trade-off #4: if the consumer's `mock/package.json`
|
|
19
|
-
* has no `scripts.dev`, slowcook prints a notice + exits 0 instead of
|
|
20
|
-
* trying to bring up an unrunnable vite-dev. Detection runs from
|
|
21
|
-
* `index.ts`'s dispatcher before this module is called.
|
|
7
|
+
* 0.19.7 (sc#173): same refactor as dev.ts — emit ShellCommand[] so
|
|
8
|
+
* runCommands() can actually execute (including ssh-wrapping for the
|
|
9
|
+
* remote case); support `compose_files` multi-`-f`; suppress `--build`
|
|
10
|
+
* for `bind-mount-source`.
|
|
22
11
|
*/
|
|
23
12
|
import type { ProfileConfig, ServeConfig } from "./config.js";
|
|
24
13
|
import type { DevVerbResult } from "./dev.js";
|
|
@@ -31,9 +20,5 @@ export interface MockVerbArgs {
|
|
|
31
20
|
repoRoot: string;
|
|
32
21
|
dryRun?: boolean;
|
|
33
22
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Pure planner for the mock profile. Same shape as `planServeDev` so
|
|
36
|
-
* the cli wrapper can render output uniformly.
|
|
37
|
-
*/
|
|
38
23
|
export declare function planServeMock(args: MockVerbArgs, _config: ServeConfig, profile: ProfileConfig): DevVerbResult;
|
|
39
24
|
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/mock.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/mock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,aAAa,GACrB,aAAa,CAkBf"}
|
|
@@ -2,29 +2,15 @@
|
|
|
2
2
|
* `slowcook serve mock <verb>` — Phase 2 implementation.
|
|
3
3
|
*
|
|
4
4
|
* The mock profile runs the consumer's `mock/` package as a vite-dev
|
|
5
|
-
* server on a shared box
|
|
6
|
-
* all hit the same artefact at the same URL. Mock-vite runs alongside
|
|
7
|
-
* `serve dev` on the same host with distinct ports + profile-prefixed
|
|
8
|
-
* container names (per design #5).
|
|
5
|
+
* server on a shared box. See `dev.ts` header for the broader pattern.
|
|
9
6
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - down — stop the mock services (volumes preserved)
|
|
15
|
-
* - logs — pass-through to docker-compose logs
|
|
16
|
-
* - reset — no-op (mock has no scenario seed)
|
|
17
|
-
*
|
|
18
|
-
* Auto-skip per Trade-off #4: if the consumer's `mock/package.json`
|
|
19
|
-
* has no `scripts.dev`, slowcook prints a notice + exits 0 instead of
|
|
20
|
-
* trying to bring up an unrunnable vite-dev. Detection runs from
|
|
21
|
-
* `index.ts`'s dispatcher before this module is called.
|
|
7
|
+
* 0.19.7 (sc#173): same refactor as dev.ts — emit ShellCommand[] so
|
|
8
|
+
* runCommands() can actually execute (including ssh-wrapping for the
|
|
9
|
+
* remote case); support `compose_files` multi-`-f`; suppress `--build`
|
|
10
|
+
* for `bind-mount-source`.
|
|
22
11
|
*/
|
|
23
12
|
import { execSync } from "node:child_process";
|
|
24
|
-
|
|
25
|
-
* Pure planner for the mock profile. Same shape as `planServeDev` so
|
|
26
|
-
* the cli wrapper can render output uniformly.
|
|
27
|
-
*/
|
|
13
|
+
import { composeFiles, shouldBuildOnUp } from "./config.js";
|
|
28
14
|
export function planServeMock(args, _config, profile) {
|
|
29
15
|
switch (args.verb) {
|
|
30
16
|
case "up":
|
|
@@ -41,28 +27,35 @@ export function planServeMock(args, _config, profile) {
|
|
|
41
27
|
output: ["[serve mock reset] mock profile has no scenario seed; nothing to reset (only meaningful for staging)."],
|
|
42
28
|
};
|
|
43
29
|
default:
|
|
44
|
-
return {
|
|
45
|
-
exitCode: 64,
|
|
46
|
-
output: [`Unknown verb: ${args.verb}. See \`slowcook serve --help\`.`],
|
|
47
|
-
};
|
|
30
|
+
return { exitCode: 64, output: [`Unknown verb: ${args.verb}. See \`slowcook serve --help\`.`] };
|
|
48
31
|
}
|
|
49
32
|
}
|
|
50
33
|
function planUp(_args, profile) {
|
|
51
|
-
const
|
|
34
|
+
const files = composeFiles(profile);
|
|
52
35
|
const apps = Object.keys(profile.apps);
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
const output = [`[serve mock up] bringing up: ${apps.join(", ") || "(no apps configured)"}`];
|
|
37
|
+
if (files.length === 0) {
|
|
38
|
+
// Fallback: no compose, run `pnpm --filter ./mock dev` locally. Used on
|
|
39
|
+
// a dev's laptop without a docker box.
|
|
40
|
+
output.push(" (no compose_files / compose_overlay set; falling back to local pnpm filter)");
|
|
41
|
+
return {
|
|
42
|
+
exitCode: 0,
|
|
43
|
+
output,
|
|
44
|
+
commands: [{ cmd: "pnpm --filter ./mock dev", remote: false, label: "vite dev" }],
|
|
45
|
+
};
|
|
59
46
|
}
|
|
60
47
|
// PM + designer reference URL: surface the vite port if exactly one app.
|
|
61
48
|
if (apps.length === 1) {
|
|
62
49
|
const vitePort = profile.apps[apps[0]].port;
|
|
63
|
-
|
|
50
|
+
output.push(` vite dev URL (once up): http://<your-box>:${vitePort}`);
|
|
64
51
|
}
|
|
65
|
-
|
|
52
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
53
|
+
const buildFlag = shouldBuildOnUp(profile) ? " --build" : "";
|
|
54
|
+
return {
|
|
55
|
+
exitCode: 0,
|
|
56
|
+
output,
|
|
57
|
+
commands: [{ cmd: `docker compose ${fileFlags} up -d${buildFlag}`, remote: true, label: "bring up" }],
|
|
58
|
+
};
|
|
66
59
|
}
|
|
67
60
|
function planSync(args, profile) {
|
|
68
61
|
const sourceBranch = profile.source_branch;
|
|
@@ -87,46 +80,32 @@ function planSync(args, profile) {
|
|
|
87
80
|
output: ["[serve mock sync] couldn't resolve a local branch (detached HEAD?). Pass --branch <name>."],
|
|
88
81
|
};
|
|
89
82
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
try {
|
|
96
|
-
execSync(`git push --force origin ${localBranch}:${sourceBranch}`, {
|
|
97
|
-
cwd: args.repoRoot,
|
|
98
|
-
stdio: "inherit",
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return {
|
|
103
|
-
exitCode: 1,
|
|
104
|
-
output: [...lines, `[serve mock sync] git push failed. Check push permissions on origin/${sourceBranch}.`],
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
lines.push(`[serve mock sync] done. The mock-deploy workflow on origin/${sourceBranch} will fire next.`);
|
|
108
|
-
return { exitCode: 0, output: lines };
|
|
83
|
+
return {
|
|
84
|
+
exitCode: 0,
|
|
85
|
+
output: [`[serve mock sync] ${localBranch} → origin/${sourceBranch}`],
|
|
86
|
+
commands: [{ cmd: `git push --force origin ${localBranch}:${sourceBranch}`, remote: false, label: "git push" }],
|
|
87
|
+
};
|
|
109
88
|
}
|
|
110
89
|
function planDown(args, profile) {
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
113
|
-
return { exitCode: 64, output: ["[serve mock down] no compose_overlay set; nothing to stop."] };
|
|
90
|
+
const files = composeFiles(profile);
|
|
91
|
+
if (files.length === 0) {
|
|
92
|
+
return { exitCode: 64, output: ["[serve mock down] no compose_files / compose_overlay set; nothing to stop."] };
|
|
114
93
|
}
|
|
94
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
115
95
|
const cmd = args.prune
|
|
116
|
-
? `docker compose
|
|
117
|
-
: `docker compose
|
|
118
|
-
return { exitCode: 0, output: ["[serve mock down]",
|
|
96
|
+
? `docker compose ${fileFlags} down -v`
|
|
97
|
+
: `docker compose ${fileFlags} down`;
|
|
98
|
+
return { exitCode: 0, output: ["[serve mock down]"], commands: [{ cmd, remote: true, label: "compose down" }] };
|
|
119
99
|
}
|
|
120
100
|
function planLogs(args, profile) {
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
123
|
-
return { exitCode: 64, output: ["[serve mock logs] no compose_overlay set; nothing to tail."] };
|
|
101
|
+
const files = composeFiles(profile);
|
|
102
|
+
if (files.length === 0) {
|
|
103
|
+
return { exitCode: 64, output: ["[serve mock logs] no compose_files / compose_overlay set; nothing to tail."] };
|
|
124
104
|
}
|
|
105
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
125
106
|
const follow = args.follow ? "-f" : "";
|
|
126
107
|
const service = args.service ?? "";
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
output: [` cmd: docker compose -f ${overlay} logs ${follow} ${service}`.replace(/\s+/g, " ").trim()],
|
|
130
|
-
};
|
|
108
|
+
const cmd = `docker compose ${fileFlags} logs ${follow} ${service}`.replace(/\s+/g, " ").trim();
|
|
109
|
+
return { exitCode: 0, output: ["[serve mock logs]"], commands: [{ cmd, remote: true, label: "compose logs" }] };
|
|
131
110
|
}
|
|
132
111
|
//# sourceMappingURL=mock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../../../src/commands/serve/mock.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../../../src/commands/serve/mock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAc5D,MAAM,UAAU,aAAa,CAC3B,IAAkB,EAClB,OAAoB,EACpB,OAAsB;IAEtB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;Q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AM,EAAE,CAAC,4EAA4E,CAAC,EAAE,CAAC;IAClH,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IACnC,MAAM,GAAG,GAAG,kBAAkB,SAAS,SAAS,MAAM,IAAI,OAAO,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAChG,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,mBAAmB,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC;AAClH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell-command execution layer for `slowcook serve`.
|
|
3
|
+
*
|
|
4
|
+
* Closes sc#173 finding #1: prior to this, planners emitted command
|
|
5
|
+
* strings into `output[]` and exited without executing them, even when
|
|
6
|
+
* `profile.ssh_target` was set. Operators had to copy-paste the emitted
|
|
7
|
+
* command and run it themselves — the verb was documentation, not
|
|
8
|
+
* automation.
|
|
9
|
+
*
|
|
10
|
+
* Now planners populate `result.commands[]` with structured ShellCommand
|
|
11
|
+
* records; `runCommands()` wraps `remote: true` commands in
|
|
12
|
+
* `ssh user@host 'cd checkout_dir && <cmd>'` and executes (unless
|
|
13
|
+
* --dry-run, in which case the wrapped form is just printed).
|
|
14
|
+
*
|
|
15
|
+
* Local commands run via execSync in the repoRoot. Remote commands run
|
|
16
|
+
* via execSync of an ssh invocation. Either way: stdio inherited so the
|
|
17
|
+
* operator sees docker / git output in real time.
|
|
18
|
+
*/
|
|
19
|
+
import type { ProfileConfig } from "./config.js";
|
|
20
|
+
export interface ShellCommand {
|
|
21
|
+
/** The local-shell-shape command (e.g. `docker compose -f a.yml up -d`). */
|
|
22
|
+
cmd: string;
|
|
23
|
+
/**
|
|
24
|
+
* When true AND `profile.ssh_target` is set, wrap the command in
|
|
25
|
+
* `ssh <user>@<host> 'cd <checkout_dir> && <cmd>'`. When `ssh_target`
|
|
26
|
+
* is absent, runs locally regardless. Use for docker / box-side
|
|
27
|
+
* operations (up, down, logs). Local-only operations like `git push`
|
|
28
|
+
* should pass `remote: false`.
|
|
29
|
+
*/
|
|
30
|
+
remote?: boolean;
|
|
31
|
+
/** Optional label printed before the command (e.g. "bring up", "seed"). */
|
|
32
|
+
label?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface RunCommandsArgs {
|
|
35
|
+
commands: ShellCommand[];
|
|
36
|
+
profile: ProfileConfig;
|
|
37
|
+
repoRoot: string;
|
|
38
|
+
/** When true: print the resolved command but don't execute. */
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface RunCommandsResult {
|
|
42
|
+
exitCode: number;
|
|
43
|
+
/** Additional human-readable lines emitted by the runner (resolved cmds, errors). */
|
|
44
|
+
output: string[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve a single ShellCommand into the wire-form string we'd actually
|
|
48
|
+
* pass to /bin/sh. Pure; useful for tests + the dry-run print path.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveCommand(cmd: ShellCommand, profile: ProfileConfig): string;
|
|
51
|
+
export declare function runCommands(args: RunCommandsArgs): RunCommandsResult;
|
|
52
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAShF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,iBAAiB,CAepE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell-command execution layer for `slowcook serve`.
|
|
3
|
+
*
|
|
4
|
+
* Closes sc#173 finding #1: prior to this, planners emitted command
|
|
5
|
+
* strings into `output[]` and exited without executing them, even when
|
|
6
|
+
* `profile.ssh_target` was set. Operators had to copy-paste the emitted
|
|
7
|
+
* command and run it themselves — the verb was documentation, not
|
|
8
|
+
* automation.
|
|
9
|
+
*
|
|
10
|
+
* Now planners populate `result.commands[]` with structured ShellCommand
|
|
11
|
+
* records; `runCommands()` wraps `remote: true` commands in
|
|
12
|
+
* `ssh user@host 'cd checkout_dir && <cmd>'` and executes (unless
|
|
13
|
+
* --dry-run, in which case the wrapped form is just printed).
|
|
14
|
+
*
|
|
15
|
+
* Local commands run via execSync in the repoRoot. Remote commands run
|
|
16
|
+
* via execSync of an ssh invocation. Either way: stdio inherited so the
|
|
17
|
+
* operator sees docker / git output in real time.
|
|
18
|
+
*/
|
|
19
|
+
import { execSync } from "node:child_process";
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a single ShellCommand into the wire-form string we'd actually
|
|
22
|
+
* pass to /bin/sh. Pure; useful for tests + the dry-run print path.
|
|
23
|
+
*/
|
|
24
|
+
export function resolveCommand(cmd, profile) {
|
|
25
|
+
if (cmd.remote && profile.ssh_target) {
|
|
26
|
+
const { user, host, checkout_dir } = profile.ssh_target;
|
|
27
|
+
// Single-quote the remote command. Inner single quotes get escaped via
|
|
28
|
+
// the bash `'\''` trick so paths/cmds containing `'` survive.
|
|
29
|
+
const inner = cmd.cmd.replace(/'/g, `'\\''`);
|
|
30
|
+
return `ssh ${user}@${host} 'cd ${checkout_dir} && ${inner}'`;
|
|
31
|
+
}
|
|
32
|
+
return cmd.cmd;
|
|
33
|
+
}
|
|
34
|
+
export function runCommands(args) {
|
|
35
|
+
const out = [];
|
|
36
|
+
for (const c of args.commands) {
|
|
37
|
+
const wire = resolveCommand(c, args.profile);
|
|
38
|
+
if (c.label)
|
|
39
|
+
out.push(` ${c.label}:`);
|
|
40
|
+
out.push(` ${args.dryRun ? "would run" : "run"}: ${wire}`);
|
|
41
|
+
if (args.dryRun)
|
|
42
|
+
continue;
|
|
43
|
+
try {
|
|
44
|
+
execSync(wire, { cwd: args.repoRoot, stdio: "inherit" });
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
out.push(` ✗ command failed: ${wire}`);
|
|
48
|
+
return { exitCode: 1, output: out };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return { exitCode: 0, output: out };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../../src/commands/serve/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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AI,EAAE,CAAC,CAAC;YACxC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `slowcook serve staging <verb>` — Phase 3 implementation.
|
|
3
3
|
*
|
|
4
|
-
* The staging profile runs a built-image deployment for PM walkthroughs
|
|
5
|
-
* manual QA. Distinct from `dev` (bind-mount source) and `mock` (vite-dev):
|
|
4
|
+
* The staging profile runs a built-image deployment for PM walkthroughs.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* 0.19.7 (sc#173): same refactor as dev.ts / mock.ts — emit
|
|
7
|
+
* ShellCommand[] for the cli wrapper to execute via runCommands(),
|
|
8
|
+
* supporting ssh-wrap when `ssh_target` is set; honour `compose_files`
|
|
9
|
+
* multi-`-f`; pass `--build` (staging IS built-image).
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* box's CI/deploy chain picks it up + rebuilds the image
|
|
16
|
-
* - down — stop the profile's services (volumes preserved)
|
|
17
|
-
* - logs — pass-through to docker-compose logs
|
|
18
|
-
* - reset --scenario <name> — re-run the named scenario's seed scripts;
|
|
19
|
-
* protected by the optional `seed.guard_env` env-var sentinel
|
|
20
|
-
* to prevent accidental wipes from interactive sessions.
|
|
21
|
-
*
|
|
22
|
-
* Per design #5 "Additional decisions" — the staging seed is idempotent;
|
|
23
|
-
* each scenario's scripts MUST be re-runnable. Slowcook just invokes them
|
|
24
|
-
* via `ts-node` (Trade-off #2) inside the container.
|
|
11
|
+
* `reset --scenario <name>` re-runs the named scenario's seed scripts.
|
|
12
|
+
* Idempotency is the seed-script author's contract; slowcook bails on
|
|
13
|
+
* any non-zero exit. Optional `seed.guard_env` blocks accidental wipes.
|
|
25
14
|
*/
|
|
26
15
|
import type { ProfileConfig, ServeConfig } from "./config.js";
|
|
27
16
|
import type { DevVerbResult } from "./dev.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/staging.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/staging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,aAAa,GACrB,aAAa,CAef"}
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `slowcook serve staging <verb>` — Phase 3 implementation.
|
|
3
3
|
*
|
|
4
|
-
* The staging profile runs a built-image deployment for PM walkthroughs
|
|
5
|
-
* manual QA. Distinct from `dev` (bind-mount source) and `mock` (vite-dev):
|
|
4
|
+
* The staging profile runs a built-image deployment for PM walkthroughs.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* 0.19.7 (sc#173): same refactor as dev.ts / mock.ts — emit
|
|
7
|
+
* ShellCommand[] for the cli wrapper to execute via runCommands(),
|
|
8
|
+
* supporting ssh-wrap when `ssh_target` is set; honour `compose_files`
|
|
9
|
+
* multi-`-f`; pass `--build` (staging IS built-image).
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* box's CI/deploy chain picks it up + rebuilds the image
|
|
16
|
-
* - down — stop the profile's services (volumes preserved)
|
|
17
|
-
* - logs — pass-through to docker-compose logs
|
|
18
|
-
* - reset --scenario <name> — re-run the named scenario's seed scripts;
|
|
19
|
-
* protected by the optional `seed.guard_env` env-var sentinel
|
|
20
|
-
* to prevent accidental wipes from interactive sessions.
|
|
21
|
-
*
|
|
22
|
-
* Per design #5 "Additional decisions" — the staging seed is idempotent;
|
|
23
|
-
* each scenario's scripts MUST be re-runnable. Slowcook just invokes them
|
|
24
|
-
* via `ts-node` (Trade-off #2) inside the container.
|
|
11
|
+
* `reset --scenario <name>` re-runs the named scenario's seed scripts.
|
|
12
|
+
* Idempotency is the seed-script author's contract; slowcook bails on
|
|
13
|
+
* any non-zero exit. Optional `seed.guard_env` blocks accidental wipes.
|
|
25
14
|
*/
|
|
26
15
|
import { execSync } from "node:child_process";
|
|
16
|
+
import { composeFiles, shouldBuildOnUp } from "./config.js";
|
|
27
17
|
export function planServeStaging(args, _config, profile) {
|
|
28
18
|
switch (args.verb) {
|
|
29
19
|
case "up":
|
|
@@ -37,26 +27,32 @@ export function planServeStaging(args, _config, profile) {
|
|
|
37
27
|
case "reset":
|
|
38
28
|
return planReset(args, profile);
|
|
39
29
|
default:
|
|
40
|
-
return {
|
|
41
|
-
exitCode: 64,
|
|
42
|
-
output: [`Unknown verb: ${args.verb}. See \`slowcook serve --help\`.`],
|
|
43
|
-
};
|
|
30
|
+
return { exitCode: 64, output: [`Unknown verb: ${args.verb}. See \`slowcook serve --help\`.`] };
|
|
44
31
|
}
|
|
45
32
|
}
|
|
46
33
|
function planUp(_args, profile) {
|
|
47
|
-
const
|
|
34
|
+
const output = [`[serve staging up] mode: ${profile.mode}`];
|
|
35
|
+
// Trade-off #3: when consumer's bringup_cmd is set, slowcook just shells it out.
|
|
48
36
|
if (profile.bringup_cmd) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
return {
|
|
38
|
+
exitCode: 0,
|
|
39
|
+
output,
|
|
40
|
+
commands: [{ cmd: profile.bringup_cmd, remote: true, label: "bring up" }],
|
|
41
|
+
};
|
|
52
42
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return {
|
|
43
|
+
const files = composeFiles(profile);
|
|
44
|
+
if (files.length === 0) {
|
|
45
|
+
return {
|
|
46
|
+
exitCode: 64,
|
|
47
|
+
output: ["[serve staging up] neither bringup_cmd nor compose_files / compose_overlay set; nothing to bring up."],
|
|
48
|
+
};
|
|
56
49
|
}
|
|
50
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
51
|
+
const buildFlag = shouldBuildOnUp(profile) ? " --build" : "";
|
|
57
52
|
return {
|
|
58
|
-
exitCode:
|
|
59
|
-
output
|
|
53
|
+
exitCode: 0,
|
|
54
|
+
output,
|
|
55
|
+
commands: [{ cmd: `docker compose ${fileFlags} up -d${buildFlag}`, remote: true, label: "bring up" }],
|
|
60
56
|
};
|
|
61
57
|
}
|
|
62
58
|
function planSync(args, profile) {
|
|
@@ -82,55 +78,34 @@ function planSync(args, profile) {
|
|
|
82
78
|
output: ["[serve staging sync] couldn't resolve a local branch (detached HEAD?). Pass --branch <name>."],
|
|
83
79
|
};
|
|
84
80
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
execSync(`git push --force origin ${localBranch}:${sourceBranch}`, {
|
|
92
|
-
cwd: args.repoRoot,
|
|
93
|
-
stdio: "inherit",
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
return {
|
|
98
|
-
exitCode: 1,
|
|
99
|
-
output: [...lines, `[serve staging sync] git push failed. Check push permissions on origin/${sourceBranch}.`],
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
lines.push(`[serve staging sync] done.`);
|
|
103
|
-
return { exitCode: 0, output: lines };
|
|
81
|
+
return {
|
|
82
|
+
exitCode: 0,
|
|
83
|
+
output: [`[serve staging sync] ${localBranch} → origin/${sourceBranch} (staging-deploy CI rebuilds)`],
|
|
84
|
+
commands: [{ cmd: `git push --force origin ${localBranch}:${sourceBranch}`, remote: false, label: "git push" }],
|
|
85
|
+
};
|
|
104
86
|
}
|
|
105
87
|
function planDown(args, profile) {
|
|
106
|
-
|
|
107
|
-
|
|
88
|
+
const files = composeFiles(profile);
|
|
89
|
+
if (files.length === 0) {
|
|
90
|
+
return { exitCode: 64, output: ["[serve staging down] no compose_files / compose_overlay set; nothing to stop."] };
|
|
108
91
|
}
|
|
92
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
109
93
|
const cmd = args.prune
|
|
110
|
-
? `docker compose
|
|
111
|
-
: `docker compose
|
|
112
|
-
return { exitCode: 0, output: ["[serve staging down]",
|
|
94
|
+
? `docker compose ${fileFlags} down -v`
|
|
95
|
+
: `docker compose ${fileFlags} down`;
|
|
96
|
+
return { exitCode: 0, output: ["[serve staging down]"], commands: [{ cmd, remote: true, label: "compose down" }] };
|
|
113
97
|
}
|
|
114
98
|
function planLogs(args, profile) {
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
const files = composeFiles(profile);
|
|
100
|
+
if (files.length === 0) {
|
|
101
|
+
return { exitCode: 64, output: ["[serve staging logs] no compose_files / compose_overlay set; nothing to tail."] };
|
|
117
102
|
}
|
|
103
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
118
104
|
const follow = args.follow ? "-f" : "";
|
|
119
105
|
const service = args.service ?? "";
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
output: [` cmd: docker compose -f ${profile.compose_overlay} logs ${follow} ${service}`.replace(/\s+/g, " ").trim()],
|
|
123
|
-
};
|
|
106
|
+
const cmd = `docker compose ${fileFlags} logs ${follow} ${service}`.replace(/\s+/g, " ").trim();
|
|
107
|
+
return { exitCode: 0, output: ["[serve staging logs]"], commands: [{ cmd, remote: true, label: "compose logs" }] };
|
|
124
108
|
}
|
|
125
|
-
/**
|
|
126
|
-
* `serve staging reset --scenario <name>` — re-run the named scenario's
|
|
127
|
-
* seed scripts. Idempotency is the seed-script author's job; slowcook
|
|
128
|
-
* just invokes them via ts-node (Trade-off #2 — runtime model locked).
|
|
129
|
-
*
|
|
130
|
-
* Guard: if `seed.guard_env` is set in the profile, the named env var
|
|
131
|
-
* must be non-empty in the caller's environment. Prevents accidental
|
|
132
|
-
* wipes from an interactive `serve staging reset`.
|
|
133
|
-
*/
|
|
134
109
|
function planReset(args, profile) {
|
|
135
110
|
if (!args.scenario) {
|
|
136
111
|
const available = profile.seed?.scenarios ? Object.keys(profile.seed.scenarios) : [];
|
|
@@ -166,25 +141,12 @@ function planReset(args, profile) {
|
|
|
166
141
|
};
|
|
167
142
|
}
|
|
168
143
|
}
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
// Real reset: shell out to ts-node for each script. Idempotency is the
|
|
177
|
-
// seed-script author's contract; slowcook bails on any non-zero exit.
|
|
178
|
-
for (const script of scenario.scripts) {
|
|
179
|
-
try {
|
|
180
|
-
execSync(`pnpm exec ts-node ${script}`, { cwd: args.repoRoot, stdio: "inherit" });
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
lines.push(`[serve staging reset] script ${script} failed; aborting.`);
|
|
184
|
-
return { exitCode: 1, output: lines };
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
lines.push(`[serve staging reset] scenario=${args.scenario} complete.`);
|
|
188
|
-
return { exitCode: 0, output: lines };
|
|
144
|
+
const output = [`[serve staging reset] scenario=${args.scenario}`];
|
|
145
|
+
const commands = scenario.scripts.map((script) => ({
|
|
146
|
+
cmd: `pnpm exec ts-node ${script}`,
|
|
147
|
+
remote: true,
|
|
148
|
+
label: `seed ${script}`,
|
|
149
|
+
}));
|
|
150
|
+
return { exitCode: 0, output, commands };
|
|
189
151
|
}
|
|
190
152
|
//# sourceMappingURL=staging.js.map
|