@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
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reviewer auth-helper server (0.6.0) — multi-person LCR review.
|
|
3
|
+
*
|
|
4
|
+
* GitHub's device-flow token endpoints (github.com/login/device/code +
|
|
5
|
+
* /login/oauth/access_token) are NOT CORS-accessible from a browser, so the
|
|
6
|
+
* overlay can't run the device dance itself. This tiny server (started by
|
|
7
|
+
* run-mock in `review_mode: lcr`) does the two server-side hops on the
|
|
8
|
+
* overlay's behalf and nothing else.
|
|
9
|
+
*
|
|
10
|
+
* Crucially it is SAFE TO EXPOSE off-host (unlike gh-proxy, which injects the
|
|
11
|
+
* host's own token): it only forwards the PUBLIC client-id + a per-session
|
|
12
|
+
* device code to GitHub's public device endpoints. The reviewer's resulting
|
|
13
|
+
* access token is returned to whoever completed the GitHub consent — the host
|
|
14
|
+
* never sees a privileged secret. So for the remote-box case it binds 0.0.0.0;
|
|
15
|
+
* for local use, 127.0.0.1.
|
|
16
|
+
*
|
|
17
|
+
* Endpoints (all JSON, permissive CORS):
|
|
18
|
+
* POST /__slowcook/auth/device → { userCode, verificationUri, deviceCode, intervalSeconds, expiresInSeconds }
|
|
19
|
+
* POST /__slowcook/auth/poll { deviceCode } → PollResult
|
|
20
|
+
* GET /__slowcook/auth/health → { ok: true, clientIdSuffix }
|
|
21
|
+
*/
|
|
22
|
+
import { createServer } from "node:http";
|
|
23
|
+
const DEVICE_PATH = "/__slowcook/auth/device";
|
|
24
|
+
const POLL_PATH = "/__slowcook/auth/poll";
|
|
25
|
+
const HEALTH_PATH = "/__slowcook/auth/health";
|
|
26
|
+
function cors(res, origin) {
|
|
27
|
+
res.setHeader("Access-Control-Allow-Origin", origin ?? "*");
|
|
28
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
|
29
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
|
|
30
|
+
}
|
|
31
|
+
function sendJson(res, status, body) {
|
|
32
|
+
res.writeHead(status, { "Content-Type": "application/json" });
|
|
33
|
+
res.end(JSON.stringify(body));
|
|
34
|
+
}
|
|
35
|
+
async function readJson(req) {
|
|
36
|
+
const chunks = [];
|
|
37
|
+
for await (const c of req)
|
|
38
|
+
chunks.push(c);
|
|
39
|
+
const raw = Buffer.concat(chunks).toString("utf8").trim();
|
|
40
|
+
if (!raw)
|
|
41
|
+
return {};
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(raw);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Build the request handler (exported so it can be unit-tested without a socket). */
|
|
50
|
+
export function makeAuthHandler(auth, clientIdSuffix) {
|
|
51
|
+
return (req, res) => {
|
|
52
|
+
const origin = req.headers["origin"];
|
|
53
|
+
cors(res, origin);
|
|
54
|
+
if (req.method === "OPTIONS") {
|
|
55
|
+
res.writeHead(204);
|
|
56
|
+
res.end();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const path = (req.url ?? "").split("?")[0];
|
|
60
|
+
void (async () => {
|
|
61
|
+
try {
|
|
62
|
+
if (req.method === "GET" && path === HEALTH_PATH) {
|
|
63
|
+
sendJson(res, 200, { ok: true, clientIdSuffix });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (req.method === "POST" && path === DEVICE_PATH) {
|
|
67
|
+
const grant = await auth.requestDeviceCode();
|
|
68
|
+
sendJson(res, 200, grant);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (req.method === "POST" && path === POLL_PATH) {
|
|
72
|
+
const body = await readJson(req);
|
|
73
|
+
const deviceCode = typeof body["deviceCode"] === "string" ? body["deviceCode"] : "";
|
|
74
|
+
if (!deviceCode) {
|
|
75
|
+
sendJson(res, 400, { error: "deviceCode required" });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const result = await auth.pollAccessToken(deviceCode);
|
|
79
|
+
sendJson(res, 200, result);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
sendJson(res, 404, { error: "not found" });
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
sendJson(res, 502, { error: e instanceof Error ? e.message : String(e) });
|
|
86
|
+
}
|
|
87
|
+
})();
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Start the auth helper. `host` defaults to 127.0.0.1; pass "0.0.0.0" for the
|
|
92
|
+
* remote-box case so a co-worker's browser can reach it.
|
|
93
|
+
*/
|
|
94
|
+
export async function startReviewerAuthServer(auth, opts) {
|
|
95
|
+
const suffix = opts.clientId.slice(-4);
|
|
96
|
+
const server = createServer(makeAuthHandler(auth, suffix));
|
|
97
|
+
const host = opts.host ?? "127.0.0.1";
|
|
98
|
+
const preferredPort = opts.preferredPort ?? 4200;
|
|
99
|
+
return await new Promise((resolve, reject) => {
|
|
100
|
+
const tryListen = (port, attemptsLeft) => {
|
|
101
|
+
const onError = (err) => {
|
|
102
|
+
server.removeListener("error", onError);
|
|
103
|
+
if (err.code === "EADDRINUSE" && attemptsLeft > 0)
|
|
104
|
+
tryListen(port + 1, attemptsLeft - 1);
|
|
105
|
+
else
|
|
106
|
+
reject(err);
|
|
107
|
+
};
|
|
108
|
+
server.once("error", onError);
|
|
109
|
+
server.listen(port, host, () => {
|
|
110
|
+
server.removeListener("error", onError);
|
|
111
|
+
resolve({
|
|
112
|
+
url: `http://localhost:${port}`,
|
|
113
|
+
port,
|
|
114
|
+
close: () => { try {
|
|
115
|
+
server.close();
|
|
116
|
+
}
|
|
117
|
+
catch { /* ignore */ } },
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
tryListen(preferredPort, 20);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=reviewer-auth-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer-auth-server.js","sourceRoot":"","sources":["../../../src/commands/run-mock/reviewer-auth-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,YAAY,EAA0D,MAAM,WAAW,CAAC;AASjG,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAC9C,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAC1C,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAE9C,SAAS,IAAI,CAAC,GAAmB,EAAE,MAA0B;IAC3D,GAAG,CAAC,SAAS,CAAC,6BAA6B,EAAE,MAAM,IAAI,GAAG,CAAC,CAAC;IAC5D,GAAG,CAAC,SAAS,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC;IACpE,GAAG,CAAC,SAAS,CAAC,8BAA8B,EAAE,sBAAsB,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,QAAQ,CAAC,GAAmB,EAAE,MAAc,EAAE,IAAa;IAClE,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC9D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E,CAAC;oBAAC,CAAC;oBAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;iBAChE,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QACF,SAAS,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -16,15 +16,15 @@ import { z } from "zod";
|
|
|
16
16
|
export declare const DEV_ENV_CONFIG_PATH = ".brewing/dev-env.yaml";
|
|
17
17
|
export declare const SERVE_CONFIG_PATH = ".brewing/serve.yaml";
|
|
18
18
|
declare const AppModeSchema: z.ZodEnum<{
|
|
19
|
-
dev: "dev";
|
|
20
19
|
start: "start";
|
|
20
|
+
dev: "dev";
|
|
21
21
|
"nest-watch": "nest-watch";
|
|
22
|
+
static: "static";
|
|
23
|
+
none: "none";
|
|
22
24
|
"nest-prod": "nest-prod";
|
|
23
25
|
"next-dev": "next-dev";
|
|
24
26
|
"next-start": "next-start";
|
|
25
27
|
"vite-dev": "vite-dev";
|
|
26
|
-
static: "static";
|
|
27
|
-
none: "none";
|
|
28
28
|
}>;
|
|
29
29
|
export declare const ProfileConfigSchema: z.ZodObject<{
|
|
30
30
|
mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -32,19 +32,20 @@ export declare const ProfileConfigSchema: z.ZodObject<{
|
|
|
32
32
|
"built-image": "built-image";
|
|
33
33
|
}>>>;
|
|
34
34
|
source_branch: z.ZodDefault<z.ZodString>;
|
|
35
|
+
compose_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
36
|
compose_overlay: z.ZodOptional<z.ZodString>;
|
|
36
37
|
bringup_cmd: z.ZodOptional<z.ZodString>;
|
|
37
38
|
apps: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
38
39
|
mode: z.ZodEnum<{
|
|
39
|
-
dev: "dev";
|
|
40
40
|
start: "start";
|
|
41
|
+
dev: "dev";
|
|
41
42
|
"nest-watch": "nest-watch";
|
|
43
|
+
static: "static";
|
|
44
|
+
none: "none";
|
|
42
45
|
"nest-prod": "nest-prod";
|
|
43
46
|
"next-dev": "next-dev";
|
|
44
47
|
"next-start": "next-start";
|
|
45
48
|
"vite-dev": "vite-dev";
|
|
46
|
-
static: "static";
|
|
47
|
-
none: "none";
|
|
48
49
|
}>;
|
|
49
50
|
port: z.ZodNumber;
|
|
50
51
|
autoheal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -84,19 +85,20 @@ export declare const ServeConfigSchema: z.ZodObject<{
|
|
|
84
85
|
"built-image": "built-image";
|
|
85
86
|
}>>>;
|
|
86
87
|
source_branch: z.ZodDefault<z.ZodString>;
|
|
88
|
+
compose_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
89
|
compose_overlay: z.ZodOptional<z.ZodString>;
|
|
88
90
|
bringup_cmd: z.ZodOptional<z.ZodString>;
|
|
89
91
|
apps: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
90
92
|
mode: z.ZodEnum<{
|
|
91
|
-
dev: "dev";
|
|
92
93
|
start: "start";
|
|
94
|
+
dev: "dev";
|
|
93
95
|
"nest-watch": "nest-watch";
|
|
96
|
+
static: "static";
|
|
97
|
+
none: "none";
|
|
94
98
|
"nest-prod": "nest-prod";
|
|
95
99
|
"next-dev": "next-dev";
|
|
96
100
|
"next-start": "next-start";
|
|
97
101
|
"vite-dev": "vite-dev";
|
|
98
|
-
static: "static";
|
|
99
|
-
none: "none";
|
|
100
102
|
}>;
|
|
101
103
|
port: z.ZodNumber;
|
|
102
104
|
autoheal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -136,5 +138,22 @@ export declare function loadServeConfig(repoRoot: string): ServeConfig;
|
|
|
136
138
|
export declare function normaliseConfig(raw: unknown, source: string): ServeConfig;
|
|
137
139
|
/** Convenience: lookup a profile by name (case-sensitive). */
|
|
138
140
|
export declare function getProfile(config: ServeConfig, name: string): ProfileConfig | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Return the ordered list of compose files for `docker compose -f ... -f ...`.
|
|
143
|
+
* Prefers `compose_files` (the multi-file shape sc#173 #2 surfaced); falls
|
|
144
|
+
* back to `compose_overlay` (legacy single-file). Empty when neither is set.
|
|
145
|
+
*/
|
|
146
|
+
export declare function composeFiles(profile: ProfileConfig): string[];
|
|
147
|
+
/**
|
|
148
|
+
* Whether `docker compose up` should pass `--build`.
|
|
149
|
+
*
|
|
150
|
+
* - `bind-mount-source`: NEVER. The whole point of the mode is to skip
|
|
151
|
+
* docker build (rsync source into a bind-mounted container). Passing
|
|
152
|
+
* `--build` triggers a rebuild that takes minutes per up. sc#173 #2.
|
|
153
|
+
* - `built-image`: usually no — the consumer's bring-up rebuilds out of
|
|
154
|
+
* band. But the explicit `--build` from `up` is conventional for
|
|
155
|
+
* built-image so the local docker daemon picks up image edits.
|
|
156
|
+
*/
|
|
157
|
+
export declare function shouldBuildOnUp(profile: ProfileConfig): boolean;
|
|
139
158
|
export {};
|
|
140
159
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,QAAA,MAAM,aAAa;;;;;;;;;;EAUjB,CAAC;AAuDH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,QAAA,MAAM,aAAa;;;;;;;;;;EAUjB,CAAC;AAuDH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsC9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAgB7D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CA2BzE;AASD,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEvF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CAI7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAE/D"}
|
|
@@ -82,7 +82,24 @@ export const ProfileConfigSchema = z.object({
|
|
|
82
82
|
mode: ProfileModeSchema.optional().default("bind-mount-source"),
|
|
83
83
|
/** Git branch the profile tracks. Default: `dev`. */
|
|
84
84
|
source_branch: z.string().default("dev"),
|
|
85
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* One or more compose files passed as `-f <path>` in declared order.
|
|
87
|
+
* The canonical pattern for `bind-mount-source` profiles:
|
|
88
|
+
*
|
|
89
|
+
* compose_files:
|
|
90
|
+
* - docker-compose.production.yml # base: postgres, networks, depends_on chain
|
|
91
|
+
* - docker-compose.dev.yml # overlay: bind-mount overrides
|
|
92
|
+
*
|
|
93
|
+
* Real consumers (delgoosh, etc.) define their long-lived services
|
|
94
|
+
* (postgres / temporal / non-swapped apps) in a base compose and the
|
|
95
|
+
* dev/staging overlays ONLY redefine the services that swap. Emitting
|
|
96
|
+
* just `-f overlay.yml` skips the base, breaking `depends_on`.
|
|
97
|
+
*
|
|
98
|
+
* Takes precedence over `compose_overlay` if both are set. Reported
|
|
99
|
+
* as a dogfood gap on serve 0.19.6 (sc#173 finding #2).
|
|
100
|
+
*/
|
|
101
|
+
compose_files: z.array(z.string()).optional(),
|
|
102
|
+
/** Single compose-overlay path (legacy). Use `compose_files` for base+overlay layering. */
|
|
86
103
|
compose_overlay: z.string().optional(),
|
|
87
104
|
/**
|
|
88
105
|
* Built-image profiles call into the consumer's bring-up script
|
|
@@ -171,4 +188,29 @@ function formatZodError(source, err) {
|
|
|
171
188
|
export function getProfile(config, name) {
|
|
172
189
|
return config.profiles[name];
|
|
173
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Return the ordered list of compose files for `docker compose -f ... -f ...`.
|
|
193
|
+
* Prefers `compose_files` (the multi-file shape sc#173 #2 surfaced); falls
|
|
194
|
+
* back to `compose_overlay` (legacy single-file). Empty when neither is set.
|
|
195
|
+
*/
|
|
196
|
+
export function composeFiles(profile) {
|
|
197
|
+
if (profile.compose_files && profile.compose_files.length > 0)
|
|
198
|
+
return profile.compose_files;
|
|
199
|
+
if (profile.compose_overlay)
|
|
200
|
+
return [profile.compose_overlay];
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Whether `docker compose up` should pass `--build`.
|
|
205
|
+
*
|
|
206
|
+
* - `bind-mount-source`: NEVER. The whole point of the mode is to skip
|
|
207
|
+
* docker build (rsync source into a bind-mounted container). Passing
|
|
208
|
+
* `--build` triggers a rebuild that takes minutes per up. sc#173 #2.
|
|
209
|
+
* - `built-image`: usually no — the consumer's bring-up rebuilds out of
|
|
210
|
+
* band. But the explicit `--build` from `up` is conventional for
|
|
211
|
+
* built-image so the local docker daemon picks up image edits.
|
|
212
|
+
*/
|
|
213
|
+
export function shouldBuildOnUp(profile) {
|
|
214
|
+
return profile.mode === "built-image";
|
|
215
|
+
}
|
|
174
216
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/commands/serve/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3B,KAAK,EAAU,kEAAkE;IACjF,OAAO,EAAQ,8DAA8D;IAC7E,YAAY,EAAG,wDAAwD;IACvE,WAAW,EAAI,2CAA2C;IAC1D,UAAU,EAAK,kDAAkD;IACjE,YAAY,EAAG,6BAA6B;IAC5C,UAAU,EAAK,0BAA0B;IACzC,QAAQ,EAAO,4CAA4C;IAC3D,MAAM,EAAS,wDAAwD;CACxE,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC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AAC,aAAa,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC,aAAa,CAAC;IAC5F,IAAI,OAAO,CAAC,eAAe;QAAE,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9D,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,OAAO,OAAO,CAAC,IAAI,KAAK,aAAa,CAAC;AACxC,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Verbs (Phase 1):
|
|
5
5
|
* - up — bring up the dev profile (compose overlay or fallback)
|
|
6
|
-
* - sync —
|
|
6
|
+
* - sync — push source-branch + restart bind-mount targets
|
|
7
7
|
* - down — stop the profile's services (volumes preserved)
|
|
8
8
|
* - logs — pass-through to docker-compose logs
|
|
9
9
|
* - reset — no-op for dev profile (only meaningful for staging)
|
|
@@ -13,39 +13,34 @@
|
|
|
13
13
|
* - `slowcook dev-env up` ≡ `slowcook serve dev up`
|
|
14
14
|
* - `slowcook dev-env reset` ≡ `slowcook serve dev reset` (no-op + notice)
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* 0.19.7 (sc#173 fixes):
|
|
17
|
+
* - Planner populates `commands[]` (structured ShellCommand records).
|
|
18
|
+
* The cli wrapper invokes runCommands() to actually execute (or
|
|
19
|
+
* dry-run); previously `up`/`down`/`logs` were planners only.
|
|
20
|
+
* - Compose-file layering: respects `profile.compose_files` (multi-`-f`)
|
|
21
|
+
* OR `compose_overlay` (single). Real consumers need base+overlay.
|
|
22
|
+
* - `--build` flag is suppressed for `bind-mount-source` mode (the
|
|
23
|
+
* mode's whole point is skipping the build loop).
|
|
21
24
|
*/
|
|
22
25
|
import type { ProfileConfig, ServeConfig } from "./config.js";
|
|
26
|
+
import type { ShellCommand } from "./runner.js";
|
|
23
27
|
export interface DevVerbArgs {
|
|
24
28
|
verb: string;
|
|
25
|
-
/** Branch to push (sync verb). Resolved from HEAD if undefined. */
|
|
26
29
|
branch?: string;
|
|
27
|
-
/** Story id, included in the push log line for audit. */
|
|
28
30
|
story?: string;
|
|
29
|
-
/** Filter logs to one app (logs verb). */
|
|
30
31
|
service?: string;
|
|
31
|
-
/** Follow logs (logs verb). */
|
|
32
32
|
follow?: boolean;
|
|
33
|
-
/** Drop volumes too (down verb). */
|
|
34
33
|
prune?: boolean;
|
|
35
34
|
repoRoot: string;
|
|
36
|
-
/** Test seam:
|
|
35
|
+
/** Test seam: report the plan but skip actual git rev-parse. */
|
|
37
36
|
dryRun?: boolean;
|
|
38
37
|
}
|
|
39
38
|
export interface DevVerbResult {
|
|
40
39
|
exitCode: number;
|
|
41
|
-
/**
|
|
40
|
+
/** Human narrative emitted by the planner. */
|
|
42
41
|
output: string[];
|
|
42
|
+
/** Shell commands the cli wrapper should execute (in order). */
|
|
43
|
+
commands?: ShellCommand[];
|
|
43
44
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Pure dispatcher for the dev profile. Returns a DevVerbResult so the
|
|
46
|
-
* caller (cli) can render output + set the exit code. Splitting the
|
|
47
|
-
* pure planner from the IO wrapper lets the tests assert on the plan
|
|
48
|
-
* without spawning docker.
|
|
49
|
-
*/
|
|
50
45
|
export declare function planServeDev(args: DevVerbArgs, _config: ServeConfig, profile: ProfileConfig): DevVerbResult;
|
|
51
46
|
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/dev.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,aAAa,GACrB,aAAa,CAkBf"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Verbs (Phase 1):
|
|
5
5
|
* - up — bring up the dev profile (compose overlay or fallback)
|
|
6
|
-
* - sync —
|
|
6
|
+
* - sync — push source-branch + restart bind-mount targets
|
|
7
7
|
* - down — stop the profile's services (volumes preserved)
|
|
8
8
|
* - logs — pass-through to docker-compose logs
|
|
9
9
|
* - reset — no-op for dev profile (only meaningful for staging)
|
|
@@ -13,19 +13,17 @@
|
|
|
13
13
|
* - `slowcook dev-env up` ≡ `slowcook serve dev up`
|
|
14
14
|
* - `slowcook dev-env reset` ≡ `slowcook serve dev reset` (no-op + notice)
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* 0.19.7 (sc#173 fixes):
|
|
17
|
+
* - Planner populates `commands[]` (structured ShellCommand records).
|
|
18
|
+
* The cli wrapper invokes runCommands() to actually execute (or
|
|
19
|
+
* dry-run); previously `up`/`down`/`logs` were planners only.
|
|
20
|
+
* - Compose-file layering: respects `profile.compose_files` (multi-`-f`)
|
|
21
|
+
* OR `compose_overlay` (single). Real consumers need base+overlay.
|
|
22
|
+
* - `--build` flag is suppressed for `bind-mount-source` mode (the
|
|
23
|
+
* mode's whole point is skipping the build loop).
|
|
21
24
|
*/
|
|
22
25
|
import { execSync } from "node:child_process";
|
|
23
|
-
|
|
24
|
-
* Pure dispatcher for the dev profile. Returns a DevVerbResult so the
|
|
25
|
-
* caller (cli) can render output + set the exit code. Splitting the
|
|
26
|
-
* pure planner from the IO wrapper lets the tests assert on the plan
|
|
27
|
-
* without spawning docker.
|
|
28
|
-
*/
|
|
26
|
+
import { composeFiles, shouldBuildOnUp } from "./config.js";
|
|
29
27
|
export function planServeDev(args, _config, profile) {
|
|
30
28
|
switch (args.verb) {
|
|
31
29
|
case "up":
|
|
@@ -46,19 +44,22 @@ export function planServeDev(args, _config, profile) {
|
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
function planUp(_args, profile) {
|
|
49
|
-
const
|
|
47
|
+
const files = composeFiles(profile);
|
|
50
48
|
const apps = Object.keys(profile.apps);
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
else {
|
|
56
|
-
lines.push(" (no compose_overlay set; consumer must wire its own up command)");
|
|
49
|
+
const output = [`[serve dev up] bringing up: ${apps.join(", ") || "(no apps configured)"}`];
|
|
50
|
+
if (files.length === 0) {
|
|
51
|
+
output.push(" (no compose_files / compose_overlay set; declare one in serve.yaml)");
|
|
52
|
+
return { exitCode: 64, output };
|
|
57
53
|
}
|
|
54
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
55
|
+
const buildFlag = shouldBuildOnUp(profile) ? " --build" : "";
|
|
56
|
+
const commands = [
|
|
57
|
+
{ cmd: `docker compose ${fileFlags} up -d${buildFlag}`, remote: true, label: "bring up" },
|
|
58
|
+
];
|
|
58
59
|
if (profile.seed_script) {
|
|
59
|
-
|
|
60
|
+
commands.push({ cmd: `pnpm exec ts-node ${profile.seed_script}`, remote: true, label: "seed" });
|
|
60
61
|
}
|
|
61
|
-
return { exitCode: 0, output
|
|
62
|
+
return { exitCode: 0, output, commands };
|
|
62
63
|
}
|
|
63
64
|
function planSync(args, profile) {
|
|
64
65
|
const sourceBranch = profile.source_branch;
|
|
@@ -68,7 +69,7 @@ function planSync(args, profile) {
|
|
|
68
69
|
localBranch = execSync("git rev-parse --abbrev-ref HEAD", { cwd: args.repoRoot, encoding: "utf8" }).trim();
|
|
69
70
|
}
|
|
70
71
|
catch {
|
|
71
|
-
//
|
|
72
|
+
// handled below
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
else if (!localBranch && args.dryRun) {
|
|
@@ -80,47 +81,42 @@ function planSync(args, profile) {
|
|
|
80
81
|
output: ["[serve dev sync] couldn't resolve a local branch (detached HEAD?). Pass --branch <name>."],
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
|
-
const
|
|
84
|
+
const output = [
|
|
84
85
|
`[serve dev sync] ${localBranch} → origin/${sourceBranch}${args.story ? ` (story-${args.story})` : ""}`,
|
|
85
86
|
];
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
execSync(`git push --force origin ${localBranch}:${sourceBranch}`, { cwd: args.repoRoot, stdio: "inherit" });
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
return {
|
|
95
|
-
exitCode: 1,
|
|
96
|
-
output: [...lines, `[serve dev sync] git push failed. Check push permissions on origin/${sourceBranch}.`],
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
lines.push(`[serve dev sync] done. The dev-deploy workflow on origin/${sourceBranch} will fire next.`);
|
|
100
|
-
return { exitCode: 0, output: lines };
|
|
87
|
+
const commands = [
|
|
88
|
+
{ cmd: `git push --force origin ${localBranch}:${sourceBranch}`, remote: false, label: "git push" },
|
|
89
|
+
];
|
|
90
|
+
return { exitCode: 0, output, commands };
|
|
101
91
|
}
|
|
102
92
|
function planDown(args, profile) {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return { exitCode: 64, output: ["[serve dev down] no compose_overlay set; nothing to stop."] };
|
|
93
|
+
const files = composeFiles(profile);
|
|
94
|
+
if (files.length === 0) {
|
|
95
|
+
return { exitCode: 64, output: ["[serve dev down] no compose_files / compose_overlay set; nothing to stop."] };
|
|
107
96
|
}
|
|
97
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
108
98
|
const cmd = args.prune
|
|
109
|
-
? `docker compose
|
|
110
|
-
: `docker compose
|
|
111
|
-
|
|
112
|
-
|
|
99
|
+
? `docker compose ${fileFlags} down -v`
|
|
100
|
+
: `docker compose ${fileFlags} down`;
|
|
101
|
+
return {
|
|
102
|
+
exitCode: 0,
|
|
103
|
+
output: ["[serve dev down]"],
|
|
104
|
+
commands: [{ cmd, remote: true, label: "compose down" }],
|
|
105
|
+
};
|
|
113
106
|
}
|
|
114
107
|
function planLogs(args, profile) {
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
117
|
-
return { exitCode: 64, output: ["[serve dev logs] no compose_overlay set; nothing to tail."] };
|
|
108
|
+
const files = composeFiles(profile);
|
|
109
|
+
if (files.length === 0) {
|
|
110
|
+
return { exitCode: 64, output: ["[serve dev logs] no compose_files / compose_overlay set; nothing to tail."] };
|
|
118
111
|
}
|
|
112
|
+
const fileFlags = files.map((f) => `-f ${f}`).join(" ");
|
|
119
113
|
const follow = args.follow ? "-f" : "";
|
|
120
114
|
const service = args.service ?? "";
|
|
115
|
+
const cmd = `docker compose ${fileFlags} logs ${follow} ${service}`.replace(/\s+/g, " ").trim();
|
|
121
116
|
return {
|
|
122
117
|
exitCode: 0,
|
|
123
|
-
output: [
|
|
118
|
+
output: ["[serve dev logs]"],
|
|
119
|
+
commands: [{ cmd, remote: true, label: "compose logs" }],
|
|
124
120
|
};
|
|
125
121
|
}
|
|
126
122
|
//# sourceMappingURL=dev.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/commands/serve/dev.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/commands/serve/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuB5D,MAAM,UAAU,YAAY,CAC1B,IAAiB,EACjB,OAAoB,EACpB,OAAsB;IAEtB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,IAAI;YACP,OAAO,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjC,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjC,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjC,KAAK,OAAO;YACV,OAAO;gBACL,QAAQ,EAAE,CAAC;gBACX,MAAM,EAAE,CAAC,qGAAqG,CAAC;aAChH,CAAC;QACJ;YACE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,iBAAiB,IAAI,CAAC,IAAI,sCAAsC,CAAC,EAAE,CAAC;IACxG,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,KAAkB,EAAE,OAAsB;IACxD,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,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,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,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,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,CAwBxD;AAED,wBAAgB,SAAS,IAAI,IAAI,CAkChC;AAED,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsEzD"}
|
|
@@ -15,6 +15,7 @@ import { planServeDev } from "./dev.js";
|
|
|
15
15
|
import { planServeMock } from "./mock.js";
|
|
16
16
|
import { detectMockRunnable } from "./detect.js";
|
|
17
17
|
import { planServeStaging } from "./staging.js";
|
|
18
|
+
import { runCommands } from "./runner.js";
|
|
18
19
|
export function parseServeArgs(argv) {
|
|
19
20
|
const args = { repoRoot: process.cwd() };
|
|
20
21
|
// First two positionals (if present + not flags) are profile + verb.
|
|
@@ -133,15 +134,11 @@ export async function serve(argv) {
|
|
|
133
134
|
console.error(`slowcook serve: profile "${args.profile}" not found in config. Available: ${available}.`);
|
|
134
135
|
process.exit(64);
|
|
135
136
|
}
|
|
137
|
+
let planResult;
|
|
136
138
|
switch (args.profile) {
|
|
137
|
-
case "dev":
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
console.log(line);
|
|
141
|
-
if (result.exitCode !== 0)
|
|
142
|
-
process.exit(result.exitCode);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
139
|
+
case "dev":
|
|
140
|
+
planResult = runDevVerb(args, config, profile);
|
|
141
|
+
break;
|
|
145
142
|
case "mock": {
|
|
146
143
|
// Trade-off #4: auto-skip if mock/ isn't vite-runnable.
|
|
147
144
|
const detect = detectMockRunnable(args.repoRoot);
|
|
@@ -149,25 +146,36 @@ export async function serve(argv) {
|
|
|
149
146
|
console.log(`[serve mock] skipped — ${detect.reason}`);
|
|
150
147
|
return;
|
|
151
148
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
console.log(line);
|
|
155
|
-
if (result.exitCode !== 0)
|
|
156
|
-
process.exit(result.exitCode);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
case "staging": {
|
|
160
|
-
const result = runStagingVerb(args, config, profile);
|
|
161
|
-
for (const line of result.output)
|
|
162
|
-
console.log(line);
|
|
163
|
-
if (result.exitCode !== 0)
|
|
164
|
-
process.exit(result.exitCode);
|
|
165
|
-
return;
|
|
149
|
+
planResult = runMockVerb(args, config, profile);
|
|
150
|
+
break;
|
|
166
151
|
}
|
|
152
|
+
case "staging":
|
|
153
|
+
planResult = runStagingVerb(args, config, profile);
|
|
154
|
+
break;
|
|
167
155
|
default:
|
|
168
156
|
console.error(`slowcook serve: profile "${args.profile}" has no runtime in this release.`);
|
|
169
157
|
process.exit(64);
|
|
170
158
|
}
|
|
159
|
+
for (const line of planResult.output)
|
|
160
|
+
console.log(line);
|
|
161
|
+
if (planResult.exitCode !== 0)
|
|
162
|
+
process.exit(planResult.exitCode);
|
|
163
|
+
// sc#173 #1: actually execute the plan. Wraps `remote: true` commands
|
|
164
|
+
// in `ssh user@host 'cd <checkout_dir> && <cmd>'` when ssh_target is
|
|
165
|
+
// set; runs locally otherwise. --dry-run prints the wrapped form
|
|
166
|
+
// without executing.
|
|
167
|
+
if (planResult.commands && planResult.commands.length > 0) {
|
|
168
|
+
const runResult = runCommands({
|
|
169
|
+
commands: planResult.commands,
|
|
170
|
+
profile,
|
|
171
|
+
repoRoot: args.repoRoot,
|
|
172
|
+
dryRun: args.dryRun,
|
|
173
|
+
});
|
|
174
|
+
for (const line of runResult.output)
|
|
175
|
+
console.log(line);
|
|
176
|
+
if (runResult.exitCode !== 0)
|
|
177
|
+
process.exit(runResult.exitCode);
|
|
178
|
+
}
|
|
171
179
|
}
|
|
172
180
|
function runDevVerb(args, config, profile) {
|
|
173
181
|
if (!profile)
|