@slowcook-ai/cli 0.16.0-alpha.26 → 0.16.0-alpha.27
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/dist/commands/port/index.d.ts +18 -9
- package/dist/commands/port/index.d.ts.map +1 -1
- package/dist/commands/port/index.js +75 -41
- package/dist/commands/port/index.js.map +1 -1
- package/dist/commands/port/transform.d.ts +17 -0
- package/dist/commands/port/transform.d.ts.map +1 -1
- package/dist/commands/port/transform.js +20 -13
- package/dist/commands/port/transform.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `slowcook port` —
|
|
2
|
+
* `slowcook port` — deterministic mock → src copy step.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Runs as a CI step before brew on the brew PR's branch. No LLM.
|
|
5
|
+
* Same input → same output.
|
|
6
6
|
*
|
|
7
7
|
* Walks `mock/src/components/` + `mock/src/app/`, copies each file to
|
|
8
8
|
* the mirrored src/ path, applying small import + hook rewrites so the
|
|
9
9
|
* production component reads via `@/lib/data#useDataDomain` instead of
|
|
10
|
-
* the mock-runtime hook. Brew
|
|
10
|
+
* the mock-runtime hook. Brew writes the actual data layer.
|
|
11
11
|
*
|
|
12
|
-
* Excluded from the copy:
|
|
13
|
-
* registry
|
|
12
|
+
* Excluded from the copy:
|
|
13
|
+
* - mock/scenarios/, mock/src/lib/scenario-registry* (mock-only infra)
|
|
14
|
+
* - any mock file with a `@slowcook-port-skip` marker in its first
|
|
15
|
+
* 20 lines (file-level opt-out for shims like mock-emotions.ts)
|
|
16
|
+
*
|
|
17
|
+
* Conflict resolution at the destination (no abort, no hardcoded
|
|
18
|
+
* exclusions for layout.tsx / page.tsx / globals.css):
|
|
19
|
+
* - destination missing → CREATE
|
|
20
|
+
* - destination matches our output → NO-OP
|
|
21
|
+
* - destination has @slowcook-port-from → UPDATE
|
|
22
|
+
* - destination is hand-written (no marker)→ SKIP with notice
|
|
23
|
+
* (consumer's prod file is the source of truth; --force to override)
|
|
14
24
|
*
|
|
15
25
|
* What "deterministic" buys us: the diff is auditable in the PR, brew
|
|
16
|
-
* has a clear scope
|
|
17
|
-
*
|
|
18
|
-
* re-run port to detect drift.
|
|
26
|
+
* has a clear scope, and a future tooling pass could re-run port to
|
|
27
|
+
* detect drift.
|
|
19
28
|
*/
|
|
20
29
|
export declare function port(argv: string[], _cliVersion: string): Promise<void>;
|
|
21
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/port/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/port/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA6FH,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyD7E"}
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `slowcook port` —
|
|
2
|
+
* `slowcook port` — deterministic mock → src copy step.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Runs as a CI step before brew on the brew PR's branch. No LLM.
|
|
5
|
+
* Same input → same output.
|
|
6
6
|
*
|
|
7
7
|
* Walks `mock/src/components/` + `mock/src/app/`, copies each file to
|
|
8
8
|
* the mirrored src/ path, applying small import + hook rewrites so the
|
|
9
9
|
* production component reads via `@/lib/data#useDataDomain` instead of
|
|
10
|
-
* the mock-runtime hook. Brew
|
|
10
|
+
* the mock-runtime hook. Brew writes the actual data layer.
|
|
11
11
|
*
|
|
12
|
-
* Excluded from the copy:
|
|
13
|
-
* registry
|
|
12
|
+
* Excluded from the copy:
|
|
13
|
+
* - mock/scenarios/, mock/src/lib/scenario-registry* (mock-only infra)
|
|
14
|
+
* - any mock file with a `@slowcook-port-skip` marker in its first
|
|
15
|
+
* 20 lines (file-level opt-out for shims like mock-emotions.ts)
|
|
16
|
+
*
|
|
17
|
+
* Conflict resolution at the destination (no abort, no hardcoded
|
|
18
|
+
* exclusions for layout.tsx / page.tsx / globals.css):
|
|
19
|
+
* - destination missing → CREATE
|
|
20
|
+
* - destination matches our output → NO-OP
|
|
21
|
+
* - destination has @slowcook-port-from → UPDATE
|
|
22
|
+
* - destination is hand-written (no marker)→ SKIP with notice
|
|
23
|
+
* (consumer's prod file is the source of truth; --force to override)
|
|
14
24
|
*
|
|
15
25
|
* What "deterministic" buys us: the diff is auditable in the PR, brew
|
|
16
|
-
* has a clear scope
|
|
17
|
-
*
|
|
18
|
-
* re-run port to detect drift.
|
|
26
|
+
* has a clear scope, and a future tooling pass could re-run port to
|
|
27
|
+
* detect drift.
|
|
19
28
|
*/
|
|
20
29
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync, readdirSync } from "node:fs";
|
|
21
30
|
import { dirname, join, relative } from "node:path";
|
|
22
|
-
import { transformForPort, mockPathToSrcPath } from "./transform.js";
|
|
31
|
+
import { transformForPort, mockPathToSrcPath, isMockOnlyFile } from "./transform.js";
|
|
23
32
|
function parseArgs(argv) {
|
|
24
33
|
const args = {
|
|
25
34
|
story: "",
|
|
@@ -58,7 +67,7 @@ function parseArgs(argv) {
|
|
|
58
67
|
}
|
|
59
68
|
function printHelp() {
|
|
60
69
|
console.log(`
|
|
61
|
-
slowcook port — deterministic mock → src copy
|
|
70
|
+
slowcook port — deterministic mock → src copy
|
|
62
71
|
|
|
63
72
|
Walks mock/src/components/ + mock/src/app/, copies each file to the
|
|
64
73
|
mirrored src/ path, and applies small import + hook rewrites so the
|
|
@@ -72,14 +81,15 @@ Options:
|
|
|
72
81
|
--story <id> Story id (e.g. 017). Used in the port-provenance header.
|
|
73
82
|
--cwd <path> Repo root (default: cwd).
|
|
74
83
|
--dry-run Print planned actions; don't write.
|
|
75
|
-
--force Overwrite
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
--force Overwrite hand-written src/ files (no @slowcook-port-from
|
|
85
|
+
marker). Default: skip them and log a notice — the
|
|
86
|
+
consumer's hand-written file wins.
|
|
78
87
|
|
|
79
88
|
What's NOT ported:
|
|
80
|
-
mock/scenarios/
|
|
81
|
-
mock/src/lib/scenario-registry
|
|
82
|
-
|
|
89
|
+
mock/scenarios/ (scenario fixtures — mock-only)
|
|
90
|
+
mock/src/lib/scenario-registry* (consumer-managed)
|
|
91
|
+
any file containing @slowcook-port-skip (file-level opt-out marker;
|
|
92
|
+
use for mock-only shims)
|
|
83
93
|
|
|
84
94
|
What's transformed:
|
|
85
95
|
import { useScenarioFixture } from "@slowcook-ai/mock-runtime";
|
|
@@ -89,9 +99,13 @@ What's transformed:
|
|
|
89
99
|
// @slowcook-mock-only lines stripped
|
|
90
100
|
port-provenance header prepended (// @slowcook-port-from mock/ (story-N))
|
|
91
101
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
Conflict resolution (no abort):
|
|
103
|
+
destination missing → CREATE
|
|
104
|
+
destination identical to our output → NO-OP
|
|
105
|
+
destination has @slowcook-port-from → UPDATE
|
|
106
|
+
destination is hand-written (no marker) → SKIP (--force overrides)
|
|
107
|
+
|
|
108
|
+
Exit code: always 0 unless an unexpected I/O error occurs.
|
|
95
109
|
`);
|
|
96
110
|
}
|
|
97
111
|
export async function port(argv, _cliVersion) {
|
|
@@ -109,9 +123,7 @@ export async function port(argv, _cliVersion) {
|
|
|
109
123
|
if (!destRel)
|
|
110
124
|
continue;
|
|
111
125
|
const inputBody = readFileSync(absPath, "utf8");
|
|
112
|
-
|
|
113
|
-
void output; // populated below in writePhase
|
|
114
|
-
actions.push(buildPlanned(args.repoRoot, relMockPath, destRel, inputBody, rewrites, args.force, args.story));
|
|
126
|
+
actions.push(buildPlanned(args.repoRoot, relMockPath, destRel, inputBody, args.force, args.story));
|
|
115
127
|
}
|
|
116
128
|
if (actions.length === 0) {
|
|
117
129
|
console.log("Nothing to port (no eligible mock/src/ files).");
|
|
@@ -124,22 +136,23 @@ export async function port(argv, _cliVersion) {
|
|
|
124
136
|
console.log("\n--dry-run: no files written.");
|
|
125
137
|
return;
|
|
126
138
|
}
|
|
127
|
-
// 0.16.0-α.8 — refuse if any action is blocked. Better to surface
|
|
128
|
-
// the conflict than overwrite a hand-edited production file.
|
|
129
|
-
const blocked = actions.filter((a) => a.kind === "blocked");
|
|
130
|
-
if (blocked.length > 0) {
|
|
131
|
-
console.error(`\nRefusing to port: ${blocked.length} file(s) at the destination ` +
|
|
132
|
-
`path don't carry the @slowcook-port-from marker. Pass --force to overwrite, ` +
|
|
133
|
-
`or hand-merge first.`);
|
|
134
|
-
process.exit(2);
|
|
135
|
-
}
|
|
136
139
|
let written = 0;
|
|
137
140
|
let unchanged = 0;
|
|
141
|
+
let skippedHandwritten = 0;
|
|
142
|
+
let skippedMockOnly = 0;
|
|
138
143
|
for (const a of actions) {
|
|
139
144
|
if (a.kind === "no-op") {
|
|
140
145
|
unchanged += 1;
|
|
141
146
|
continue;
|
|
142
147
|
}
|
|
148
|
+
if (a.kind === "skip-handwritten") {
|
|
149
|
+
skippedHandwritten += 1;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (a.kind === "skip-mock-only") {
|
|
153
|
+
skippedMockOnly += 1;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
143
156
|
const inputBody = readFileSync(join(args.repoRoot, a.src), "utf8");
|
|
144
157
|
const { output } = transformForPort(inputBody, { storyId: args.story });
|
|
145
158
|
const destAbs = join(args.repoRoot, a.dest);
|
|
@@ -147,11 +160,30 @@ export async function port(argv, _cliVersion) {
|
|
|
147
160
|
writeFileSync(destAbs, output, "utf8");
|
|
148
161
|
written += 1;
|
|
149
162
|
}
|
|
150
|
-
|
|
163
|
+
const skipNotes = [];
|
|
164
|
+
if (skippedHandwritten > 0) {
|
|
165
|
+
skipNotes.push(`${skippedHandwritten} skipped (hand-written prod file — pass --force to override)`);
|
|
166
|
+
}
|
|
167
|
+
if (skippedMockOnly > 0) {
|
|
168
|
+
skipNotes.push(`${skippedMockOnly} skipped (@slowcook-port-skip)`);
|
|
169
|
+
}
|
|
170
|
+
const tail = skipNotes.length > 0 ? "; " + skipNotes.join("; ") : "";
|
|
171
|
+
console.log(`\nDone. ${written} file(s) written; ${unchanged} unchanged${tail}.`);
|
|
151
172
|
}
|
|
152
|
-
function buildPlanned(repoRoot, src, dest, inputBody,
|
|
173
|
+
function buildPlanned(repoRoot, src, dest, inputBody, force, story) {
|
|
174
|
+
// File-level opt-out: mock-only shims (e.g. mock/src/lib/mock-emotions.ts)
|
|
175
|
+
// tagged with @slowcook-port-skip never write to src/.
|
|
176
|
+
if (isMockOnlyFile(inputBody)) {
|
|
177
|
+
return {
|
|
178
|
+
src,
|
|
179
|
+
dest,
|
|
180
|
+
kind: "skip-mock-only",
|
|
181
|
+
rewrites: [],
|
|
182
|
+
reason: "file marked @slowcook-port-skip (mock-only shim)",
|
|
183
|
+
};
|
|
184
|
+
}
|
|
153
185
|
const destAbs = join(repoRoot, dest);
|
|
154
|
-
const { output } = transformForPort(inputBody, { storyId: story });
|
|
186
|
+
const { output, rewrites } = transformForPort(inputBody, { storyId: story });
|
|
155
187
|
const destExists = existsSync(destAbs);
|
|
156
188
|
if (!destExists) {
|
|
157
189
|
return { src, dest, kind: "create", rewrites };
|
|
@@ -160,24 +192,26 @@ function buildPlanned(repoRoot, src, dest, inputBody, rewrites, force, story) {
|
|
|
160
192
|
if (existing === output) {
|
|
161
193
|
return { src, dest, kind: "no-op", rewrites: [] };
|
|
162
194
|
}
|
|
163
|
-
//
|
|
164
|
-
// (carries the marker) OR --force is set.
|
|
195
|
+
// Update only if the existing file is a previously-ported file
|
|
196
|
+
// (carries the marker) OR --force is set. Otherwise skip — the
|
|
197
|
+
// consumer's hand-written file is the source of truth.
|
|
165
198
|
if (existing.includes("@slowcook-port-from") || force) {
|
|
166
199
|
return { src, dest, kind: "update", rewrites };
|
|
167
200
|
}
|
|
168
201
|
return {
|
|
169
202
|
src,
|
|
170
203
|
dest,
|
|
171
|
-
kind: "
|
|
204
|
+
kind: "skip-handwritten",
|
|
172
205
|
rewrites: [],
|
|
173
|
-
reason: "destination
|
|
206
|
+
reason: "destination is hand-written (no @slowcook-port-from marker); skipping. Use --force to overwrite.",
|
|
174
207
|
};
|
|
175
208
|
}
|
|
176
209
|
function printAction(a) {
|
|
177
210
|
const tag = a.kind === "create" ? "CREATE" :
|
|
178
211
|
a.kind === "update" ? "UPDATE" :
|
|
179
|
-
a.kind === "
|
|
180
|
-
"
|
|
212
|
+
a.kind === "skip-handwritten" ? "SKIP " :
|
|
213
|
+
a.kind === "skip-mock-only" ? "SKIP " :
|
|
214
|
+
"NO-OP ";
|
|
181
215
|
console.log(` ${tag} ${a.src} → ${a.dest}`);
|
|
182
216
|
if (a.reason)
|
|
183
217
|
console.log(` ${a.reason}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/port/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/port/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAWrF,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAa;QACrB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,OAAO,CAA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,cAAc,CAAC,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,SAAS,CAAC,GAAW,EAAE,MAAgB,EAAE;IAChD,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;YACrB,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACvB,CAAC;aAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -46,6 +46,23 @@ export declare function transformForPort(input: string, opts?: {
|
|
|
46
46
|
* mock/src/app/(main)/u/[handle]/page.tsx → src/app/(main)/u/[handle]/page.tsx
|
|
47
47
|
* mock/src/lib/scenario-registry.ts → null (mock-only; never ports)
|
|
48
48
|
* mock/scenarios/story-017.ts → null (mock-only; never ports)
|
|
49
|
+
*
|
|
50
|
+
* Note: collisions with the consumer's hand-written src/ files (e.g.
|
|
51
|
+
* mock/src/app/layout.tsx vs the consumer's real src/app/layout.tsx)
|
|
52
|
+
* are NOT filtered here. The walker handles them at write-time by
|
|
53
|
+
* checking for the @slowcook-port-from marker on the destination —
|
|
54
|
+
* unmarked destinations are skipped, never overwritten. That keeps
|
|
55
|
+
* this mapping a pure path translation (no hardcoded shell list).
|
|
49
56
|
*/
|
|
50
57
|
export declare function mockPathToSrcPath(mockPath: string): string | null;
|
|
58
|
+
/**
|
|
59
|
+
* File-level skip marker. A mock file that contains
|
|
60
|
+
* `@slowcook-port-skip` in its first 20 lines is treated as
|
|
61
|
+
* mock-only — port walks past it without writing anything in src/.
|
|
62
|
+
*
|
|
63
|
+
* Use this for mock-only shims (e.g. a `mock/src/lib/mock-foo.ts`
|
|
64
|
+
* that exists only so the mock app builds; the corresponding prod
|
|
65
|
+
* code lives elsewhere).
|
|
66
|
+
*/
|
|
67
|
+
export declare function isMockOnlyFile(input: string): boolean;
|
|
51
68
|
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/commands/port/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAOD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CAqDhG;AAED
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/commands/port/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAOD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CAqDhG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAajE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGrD"}
|
|
@@ -82,6 +82,13 @@ export function transformForPort(input, opts) {
|
|
|
82
82
|
* mock/src/app/(main)/u/[handle]/page.tsx → src/app/(main)/u/[handle]/page.tsx
|
|
83
83
|
* mock/src/lib/scenario-registry.ts → null (mock-only; never ports)
|
|
84
84
|
* mock/scenarios/story-017.ts → null (mock-only; never ports)
|
|
85
|
+
*
|
|
86
|
+
* Note: collisions with the consumer's hand-written src/ files (e.g.
|
|
87
|
+
* mock/src/app/layout.tsx vs the consumer's real src/app/layout.tsx)
|
|
88
|
+
* are NOT filtered here. The walker handles them at write-time by
|
|
89
|
+
* checking for the @slowcook-port-from marker on the destination —
|
|
90
|
+
* unmarked destinations are skipped, never overwritten. That keeps
|
|
91
|
+
* this mapping a pure path translation (no hardcoded shell list).
|
|
85
92
|
*/
|
|
86
93
|
export function mockPathToSrcPath(mockPath) {
|
|
87
94
|
if (!mockPath.startsWith("mock/"))
|
|
@@ -93,23 +100,23 @@ export function mockPathToSrcPath(mockPath) {
|
|
|
93
100
|
return null;
|
|
94
101
|
if (mockPath.startsWith("mock/src/lib/scenario-registry/"))
|
|
95
102
|
return null;
|
|
96
|
-
// 0.16.0-α.26 — mock-app-shell files: scaffolded by `slowcook init
|
|
97
|
-
// mock` (NOT story-specific UI). Never port — they would clobber the
|
|
98
|
-
// consumer's production app shell:
|
|
99
|
-
// layout.tsx — mounts ScenarioRegistryProvider + overlay; consumer's
|
|
100
|
-
// src/app/layout.tsx is THEIR production app shell
|
|
101
|
-
// page.tsx — the picker UI (homepage); consumer has their own
|
|
102
|
-
// globals.css — mock's tailwind directives + tokens
|
|
103
|
-
if (mockPath === "mock/src/app/layout.tsx")
|
|
104
|
-
return null;
|
|
105
|
-
if (mockPath === "mock/src/app/page.tsx")
|
|
106
|
-
return null;
|
|
107
|
-
if (mockPath === "mock/src/app/globals.css")
|
|
108
|
-
return null;
|
|
109
103
|
// mock/src/* → src/* ; mock/<other>/* → don't port (only src/ maps cleanly).
|
|
110
104
|
if (mockPath.startsWith("mock/src/")) {
|
|
111
105
|
return "src/" + mockPath.slice("mock/src/".length);
|
|
112
106
|
}
|
|
113
107
|
return null;
|
|
114
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* File-level skip marker. A mock file that contains
|
|
111
|
+
* `@slowcook-port-skip` in its first 20 lines is treated as
|
|
112
|
+
* mock-only — port walks past it without writing anything in src/.
|
|
113
|
+
*
|
|
114
|
+
* Use this for mock-only shims (e.g. a `mock/src/lib/mock-foo.ts`
|
|
115
|
+
* that exists only so the mock app builds; the corresponding prod
|
|
116
|
+
* code lives elsewhere).
|
|
117
|
+
*/
|
|
118
|
+
export function isMockOnlyFile(input) {
|
|
119
|
+
const head = input.split("\n", 20).join("\n");
|
|
120
|
+
return /@slowcook-port-skip\b/.test(head);
|
|
121
|
+
}
|
|
115
122
|
//# sourceMappingURL=transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/commands/port/transform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AASH,MAAM,0BAA0B,GAC9B,2GAA2G,CAAC;AAE9G,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAElD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,IAA2B;IACzE,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,yDAAyD;IACzD,IAAI,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,0BAA0B,CAAC,SAAS,GAAG,CAAC,CAAC;QACzC,MAAM,GAAG,MAAM,CAAC,OAAO,CACrB,0BAA0B,EAC1B,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE;YACnB,IAAI,Y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G,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slowcook-ai/cli",
|
|
3
|
-
"version": "0.16.0-alpha.
|
|
3
|
+
"version": "0.16.0-alpha.27",
|
|
4
4
|
"description": "CLI for the slowcook brewing harness",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "aminazar",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@slowcook-ai/core": "^0.13.0",
|
|
42
42
|
"@slowcook-ai/stack-ts": "^0.9.6",
|
|
43
43
|
"@slowcook-ai/forge-github": "^0.11.5",
|
|
44
|
-
"@slowcook-ai/
|
|
44
|
+
"@slowcook-ai/llm-anthropic": "^0.12.3",
|
|
45
45
|
"@slowcook-ai/review-overlay": "^0.5.3",
|
|
46
|
-
"@slowcook-ai/
|
|
46
|
+
"@slowcook-ai/recorder": "^0.9.1"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|