@fabrika/builder 0.9.0-dev.12 → 0.9.0-dev.14
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/BUILD-CONTRACT.md +9 -3
- package/README.md +39 -9
- package/cli/src/bin.ts +14 -1
- package/cli/src/build-review.ts +66 -0
- package/cli/src/build-status.ts +41 -3
- package/cli/src/catalog.ts +34 -2
- package/cli/src/commands/advance.ts +48 -6
- package/cli/src/commands/build.ts +152 -15
- package/cli/src/commands/design.ts +34 -0
- package/cli/src/commands/flows.ts +32 -0
- package/cli/src/commands/induce.ts +2 -2
- package/cli/src/commands/init.ts +7 -1
- package/cli/src/commands/next.ts +9 -2
- package/cli/src/context.ts +2 -1
- package/cli/src/contrast.ts +301 -0
- package/cli/src/daemon-client.ts +29 -3
- package/cli/src/design-review.ts +261 -0
- package/cli/src/flows.ts +162 -0
- package/cli/src/frontmatter.ts +32 -0
- package/cli/src/index.ts +10 -1
- package/cli/src/induce.ts +61 -3
- package/cli/src/issues.ts +15 -29
- package/cli/src/layout.ts +5 -2
- package/cli/src/packet.ts +36 -3
- package/cli/src/phase-state.ts +19 -1
- package/cli/src/verify.ts +50 -0
- package/daemon/src/handlers.ts +32 -6
- package/daemon/src/phases.ts +7 -109
- package/daemon/src/platform-source.ts +8 -0
- package/decisions/README.md +2 -2
- package/decisions/patterns/cf-contract-app.md +57 -0
- package/decisions/technologies/bun.md +2 -1
- package/decisions/technologies/cf-fabrika-contract.md +45 -0
- package/decisions/technologies/cloudflare.md +3 -1
- package/decisions/technologies/oblaka.md +1 -1
- package/decisions/technologies/opice.md +1 -1
- package/decisions/technologies/react.md +1 -1
- package/decisions/technologies/tailwind.md +5 -5
- package/decisions/technologies/zerops-fabrika-auth.md +1 -1
- package/decisions/technologies/zerops-platform.md +1 -1
- package/package.json +11 -8
- package/shared/approvals.ts +65 -0
- package/shared/derive.ts +189 -0
- package/shared/gate.ts +20 -0
- package/shared/index.ts +6 -1
- package/shared/phases.ts +22 -20
- package/skill/SKILL.md +25 -16
- package/skill/agents/build-orchestrator.md +28 -8
- package/skill/agents/flows-author.md +27 -13
- package/skill/agents/implementer.md +3 -1
- package/skill/agents/opice-skeleton-author.md +8 -7
- package/skill/gates/brief.jsx +26 -5
- package/skill/gates/review-grid.jsx +3 -8
- package/skill/gates/tech.jsx +3 -3
- package/stacks/README.md +8 -2
- package/stacks/cf-app.md +60 -0
- package/stacks/cf-fat.md +1 -0
- package/stacks/cf-internal-app.md +2 -2
- package/stacks/cf-lightweight.md +3 -2
- package/stacks/contember-app.md +1 -0
- package/stacks/content-site.md +1 -0
- package/stacks/zerops-app.md +1 -0
- package/types/cli/src/bin.d.ts +1 -1
- package/types/cli/src/build-review.d.ts +13 -0
- package/types/cli/src/build-status.d.ts +16 -1
- package/types/cli/src/catalog.d.ts +9 -0
- package/types/cli/src/commands/design.d.ts +1 -0
- package/types/cli/src/commands/flows.d.ts +1 -0
- package/types/cli/src/contrast.d.ts +59 -0
- package/types/cli/src/daemon-client.d.ts +13 -2
- package/types/cli/src/design-review.d.ts +54 -0
- package/types/cli/src/flows.d.ts +28 -0
- package/types/cli/src/frontmatter.d.ts +8 -0
- package/types/cli/src/index.d.ts +1 -1
- package/types/cli/src/induce.d.ts +3 -0
- package/types/cli/src/issues.d.ts +4 -0
- package/types/cli/src/packet.d.ts +9 -1
- package/types/cli/src/phase-state.d.ts +1 -1
- package/types/cli/src/verify.d.ts +18 -0
- package/types/daemon/src/phases.d.ts +4 -16
- package/types/daemon/src/platform-remote.d.ts +6 -2
- package/types/shared/approvals.d.ts +32 -0
- package/types/shared/derive.d.ts +41 -0
- package/types/shared/gate.d.ts +11 -0
- package/types/shared/index.d.ts +105 -65
- package/types/shared/phases.d.ts +7 -1
- package/ui/dist/assets/client.css +1 -1
- package/ui/dist/assets/client.vn7hykcn.js +120 -0
- package/ui/dist/index.html +1 -1
- package/cli/src/derive.ts +0 -105
- package/skill/gates/build.jsx +0 -20
- package/skill/gates/design.jsx +0 -22
- package/skill/gates/flows.jsx +0 -14
- package/skill/gates/vision.jsx +0 -27
- package/types/cli/src/derive.d.ts +0 -17
- package/ui/dist/assets/client.8aw2edb7.js +0 -214
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'fs'
|
|
2
|
+
import { dirname, join } from 'path'
|
|
2
3
|
import { parseArgs } from 'util'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { GATE_CHANGES } from '../../../shared/gate'
|
|
5
|
+
import { BUILD_REVIEW_PATH, describeEvidence, renderBuildReview } from '../build-review'
|
|
6
|
+
import { type BuildEvidence, type BuildPlan, planBuild, readBoard, record } from '../build-status'
|
|
7
|
+
import { resolveStackPointer, unsupportedProfileNote } from '../catalog'
|
|
5
8
|
import { resolveContext } from '../context'
|
|
6
|
-
import { postBuildEvent } from '../daemon-client'
|
|
9
|
+
import { consumeGate, postBuildEvent } from '../daemon-client'
|
|
10
|
+
import { ensureDaemon } from '../daemon-lifecycle'
|
|
11
|
+
import { describePair, DESIGN_GATE, DESIGN_PATH, failingPairs, readDesignContrast, summarizeContrast } from '../design-review'
|
|
7
12
|
import { type Issue, readIssues } from '../issues'
|
|
13
|
+
import { describeVerification, gitState, runVerification, type Verification } from '../verify'
|
|
8
14
|
|
|
9
15
|
export async function cmdBuild(argv: string[]): Promise<number> {
|
|
10
16
|
const { values, positionals } = parseArgs({
|
|
11
17
|
args: argv,
|
|
12
18
|
options: {
|
|
13
19
|
reason: { type: 'string' },
|
|
20
|
+
verify: { type: 'string' },
|
|
14
21
|
issue: { type: 'string' },
|
|
15
22
|
dir: { type: 'string' },
|
|
16
23
|
session: { type: 'string' },
|
|
17
24
|
assisted: { type: 'boolean', default: false },
|
|
25
|
+
'waive-contrast': { type: 'boolean', default: false },
|
|
18
26
|
},
|
|
19
27
|
allowPositionals: true,
|
|
20
28
|
})
|
|
@@ -31,7 +39,7 @@ export async function cmdBuild(argv: string[]): Promise<number> {
|
|
|
31
39
|
const issues = readIssues(ctx.fabrikaDir)
|
|
32
40
|
if (issues.length === 0) {
|
|
33
41
|
console.error(
|
|
34
|
-
`[fabrika] no issues in ${ctx.fabrikaDir}/issues/. Run \`fabrika builder induce\` (phase
|
|
42
|
+
`[fabrika] no issues in ${ctx.fabrikaDir}/issues/. Run \`fabrika builder induce\` (phase 6) first.`,
|
|
35
43
|
)
|
|
36
44
|
return 1
|
|
37
45
|
}
|
|
@@ -43,16 +51,61 @@ export async function cmdBuild(argv: string[]): Promise<number> {
|
|
|
43
51
|
return 0
|
|
44
52
|
|
|
45
53
|
case 'done': {
|
|
46
|
-
|
|
54
|
+
const issue = idArg ? byId(idArg) : null
|
|
55
|
+
if (!issue) {
|
|
47
56
|
console.error(`[fabrika] build done <ISSUE-ID> — unknown or missing issue id.`)
|
|
48
57
|
return 1
|
|
49
58
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
if (values['waive-contrast'] && issue.gate !== DESIGN_GATE) {
|
|
60
|
+
console.error(`[fabrika] --waive-contrast applies only to the "${DESIGN_GATE}" gate's issue; ${issue.id} has no contrast check.`)
|
|
61
|
+
return 1
|
|
62
|
+
}
|
|
63
|
+
if (issue.gate) {
|
|
64
|
+
if (values.verify || issue.verify.length > 0) {
|
|
65
|
+
console.error(`[fabrika] ${issue.id} is proved by its "${issue.gate}" review gate; it takes no --verify or verify files.`)
|
|
66
|
+
return 1
|
|
67
|
+
}
|
|
68
|
+
const check = issue.gate === DESIGN_GATE ? checkDesignContrast(issue, ctx.repoRoot, values['waive-contrast']) : ''
|
|
69
|
+
if (check === null) return 1
|
|
70
|
+
return await recordGateReview(issue, issue.gate, check, ctx.sessionId, ctx.repoRoot, ctx.fabrikaDir, issues)
|
|
71
|
+
}
|
|
72
|
+
if (values.verify && issue.verify.length > 0) {
|
|
73
|
+
console.error(`[fabrika] ${issue.id} is proved by ${issue.verify.join(', ')}; --verify is only for issues that name no acceptance file.`)
|
|
74
|
+
return 1
|
|
75
|
+
}
|
|
76
|
+
const verification: Verification | null = values.verify
|
|
77
|
+
? { kind: 'command', command: values.verify }
|
|
78
|
+
: issue.verify.length > 0
|
|
79
|
+
? { kind: 'files', files: issue.verify }
|
|
80
|
+
: null
|
|
81
|
+
if (!verification) {
|
|
82
|
+
console.error(
|
|
83
|
+
`[fabrika] ${issue.id} names no acceptance file. Pass the check that proves it: `
|
|
84
|
+
+ `fabrika builder build done ${issue.id} --verify "<command>"`,
|
|
85
|
+
)
|
|
86
|
+
return 1
|
|
87
|
+
}
|
|
88
|
+
console.log(`[fabrika] ${issue.id}: running ${describeVerification(verification)}`)
|
|
89
|
+
const evidence = await runVerification(ctx.repoRoot, verification)
|
|
90
|
+
if (evidence.exitCode !== 0) {
|
|
91
|
+
await postBuildEvent({ issue: issue.id, status: 'failed', message: `check failed: ${describeEvidence(evidence)}` })
|
|
92
|
+
console.error(`[fabrika] ✗ ${issue.id} not marked done: \`${evidence.command}\` exited ${evidence.exitCode}.`)
|
|
93
|
+
return 1
|
|
94
|
+
}
|
|
95
|
+
record(ctx.fabrikaDir, issue.id, 'done', undefined, evidence.at, evidence)
|
|
96
|
+
await postBuildEvent({ issue: issue.id, status: 'passed', message: `check passed: ${describeEvidence(evidence)}` })
|
|
97
|
+
console.log(`[fabrika] ✓ ${issue.id} marked done (${describeEvidence(evidence)}).`)
|
|
53
98
|
return await reportProgress(issues, ctx.fabrikaDir)
|
|
54
99
|
}
|
|
55
100
|
|
|
101
|
+
case 'review': {
|
|
102
|
+
const path = join(ctx.repoRoot, BUILD_REVIEW_PATH)
|
|
103
|
+
mkdirSync(dirname(path), { recursive: true })
|
|
104
|
+
writeFileSync(path, renderBuildReview(issues, readBoard(ctx.fabrikaDir), new Date()))
|
|
105
|
+
console.log(path)
|
|
106
|
+
return 0
|
|
107
|
+
}
|
|
108
|
+
|
|
56
109
|
case 'block': {
|
|
57
110
|
if (!idArg || !byId(idArg)) {
|
|
58
111
|
console.error(`[fabrika] build block <ISSUE-ID> --reason "…" — unknown or missing issue id.`)
|
|
@@ -99,6 +152,76 @@ async function emitBrief(
|
|
|
99
152
|
return 0
|
|
100
153
|
}
|
|
101
154
|
|
|
155
|
+
/**
|
|
156
|
+
* The design checkpoint's deterministic half: the theme override's contrast. Unlike the advisory verdict, a pair below
|
|
157
|
+
* AA refuses `done` until the stylesheet is fixed or the reviewer waives it. Returns the evidence suffix, or null.
|
|
158
|
+
*/
|
|
159
|
+
function checkDesignContrast(issue: Issue, repoRoot: string, waive: boolean | undefined): string | null {
|
|
160
|
+
const contrast = readDesignContrast(repoRoot)
|
|
161
|
+
const failing = failingPairs(contrast)
|
|
162
|
+
const refused = contrast.kind === 'invalid' || failing.length > 0
|
|
163
|
+
if (refused && !waive) {
|
|
164
|
+
console.error(`[fabrika] ${issue.id} not marked done: ${summarizeContrast(contrast)}.`)
|
|
165
|
+
for (const pair of failing) console.error(`[fabrika] ${describePair(pair)}`)
|
|
166
|
+
console.error(
|
|
167
|
+
contrast.kind === 'invalid'
|
|
168
|
+
? `[fabrika] Name the theme stylesheet in ${DESIGN_PATH} (front matter \`stylesheet: <path>\`), then run \`fabrika builder build done ${issue.id}\` again.`
|
|
169
|
+
: `[fabrika] Raise these pairs in the stylesheet and re-open the gate, or pass --waive-contrast when the reviewer accepts them.`,
|
|
170
|
+
)
|
|
171
|
+
return null
|
|
172
|
+
}
|
|
173
|
+
if (contrast.kind === 'checked') {
|
|
174
|
+
for (const r of contrast.results) {
|
|
175
|
+
if (r.status === 'unchecked') console.error(`[fabrika] warning: contrast not checked for ${r.mode} ${r.fg} on ${r.bg}: ${r.note ?? ''}`)
|
|
176
|
+
}
|
|
177
|
+
} else if (contrast.kind === 'no-kit') {
|
|
178
|
+
console.error(`[fabrika] warning: ${summarizeContrast(contrast)}; on the paved road, run \`bun install\` where the SPA lives.`)
|
|
179
|
+
}
|
|
180
|
+
const waived = failing.map((r) => `${r.mode} ${r.fg} on ${r.bg}`)
|
|
181
|
+
return ` · ${summarizeContrast(contrast)}${refused ? ` (waived${waived.length ? `: ${waived.join(', ')}` : ''})` : ''}`
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** An issue whose check is a review gate: record the gate's consumed verdict. Gates are advisory, so "changes" warns. */
|
|
185
|
+
async function recordGateReview(
|
|
186
|
+
issue: Issue,
|
|
187
|
+
gate: string,
|
|
188
|
+
/** Appended to the evidence: what a deterministic check beside the gate found. */
|
|
189
|
+
checked: string,
|
|
190
|
+
sessionId: string,
|
|
191
|
+
repoRoot: string,
|
|
192
|
+
fabrikaDir: string,
|
|
193
|
+
issues: Issue[],
|
|
194
|
+
): Promise<number> {
|
|
195
|
+
await ensureDaemon({ quiet: true })
|
|
196
|
+
const review = await consumeGate(sessionId, gate)
|
|
197
|
+
if (!review) {
|
|
198
|
+
console.error(
|
|
199
|
+
`[fabrika] ${issue.id} not marked done: the "${gate}" gate has no submitted review (or the daemon is down). `
|
|
200
|
+
+ `Open it, have it reviewed, then run \`fabrika builder build done ${issue.id}\` again.`,
|
|
201
|
+
)
|
|
202
|
+
return 1
|
|
203
|
+
}
|
|
204
|
+
const evidence: BuildEvidence = {
|
|
205
|
+
command: `${gate} gate review, revision ${review.revision}${checked}`,
|
|
206
|
+
exitCode: 0,
|
|
207
|
+
durationMs: 0,
|
|
208
|
+
at: new Date().toISOString(),
|
|
209
|
+
...gitState(repoRoot),
|
|
210
|
+
verdict: review.verdict,
|
|
211
|
+
}
|
|
212
|
+
if (review.verdict !== 'approve') {
|
|
213
|
+
console.error(
|
|
214
|
+
`[fabrika] warning: the "${gate}" gate was ${
|
|
215
|
+
review.verdict === 'changes' ? `answered "${GATE_CHANGES}"` : 'submitted without a verdict'
|
|
216
|
+
}; recording ${issue.id} anyway (gates are advisory).`,
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
record(fabrikaDir, issue.id, 'done', undefined, evidence.at, evidence)
|
|
220
|
+
await postBuildEvent({ issue: issue.id, status: 'passed', message: `reviewed: ${describeEvidence(evidence)}` })
|
|
221
|
+
console.log(`[fabrika] ✓ ${issue.id} marked done (${describeEvidence(evidence)}).`)
|
|
222
|
+
return await reportProgress(issues, fabrikaDir)
|
|
223
|
+
}
|
|
224
|
+
|
|
102
225
|
async function reportProgress(issues: Issue[], fabrikaDir: string): Promise<number> {
|
|
103
226
|
const plan = planBuild(issues, readBoard(fabrikaDir))
|
|
104
227
|
if (plan.complete) return await reportComplete(plan, issues.length)
|
|
@@ -150,6 +273,7 @@ function stackBriefLines(profile: string): string[] {
|
|
|
150
273
|
return [
|
|
151
274
|
`Stack: ${profile} -> ${p.stackFile}`,
|
|
152
275
|
` resolve its \`decisions:\` ids under ${p.decisionsDir}/ and read the live \`sources\` they pin`,
|
|
276
|
+
...(p.support === 'unsupported' ? [` warning: ${unsupportedProfileNote(profile)}`] : []),
|
|
153
277
|
]
|
|
154
278
|
}
|
|
155
279
|
|
|
@@ -167,7 +291,8 @@ function renderOrchestrationBrief(plan: BuildPlan, repoRoot: string, profile: st
|
|
|
167
291
|
const note = marker.get(i.id) === '…'
|
|
168
292
|
? ` (waiting on ${i.dependsOn.filter((d) => !doneIds.has(d)).join(', ')})`
|
|
169
293
|
: ''
|
|
170
|
-
|
|
294
|
+
const gate = i.gate ? ` [${i.gate} gate: main session, needs the human]` : ''
|
|
295
|
+
return ` ${marker.get(i.id) ?? '?'} ${i.id} ${i.goal}${deps}${note}${gate}`
|
|
171
296
|
})
|
|
172
297
|
|
|
173
298
|
return [
|
|
@@ -188,8 +313,9 @@ function renderOrchestrationBrief(plan: BuildPlan, repoRoot: string, profile: st
|
|
|
188
313
|
...stackBriefLines(profile),
|
|
189
314
|
`Scaffold: NO templates — read the stack preset + its decisions + the live sources`,
|
|
190
315
|
` they point to, and scaffold from current APIs (your memory is likely stale).`,
|
|
191
|
-
`Record: fabrika builder build done <ID> | fabrika builder build block <ID> --reason "…"`,
|
|
192
|
-
` (both write status.json + stream a BuildEvent
|
|
316
|
+
`Record: fabrika builder build done <ID> [--verify "<command>"] | fabrika builder build block <ID> --reason "…"`,
|
|
317
|
+
` (done RUNS the issue's check and refuses on red; both write status.json + stream a BuildEvent)`,
|
|
318
|
+
`Review: fabrika builder build review && fabrika builder gate open build --view ${BUILD_REVIEW_PATH}`,
|
|
193
319
|
`Detail: fabrika builder build --issue <ID> (re-emit one issue's full packet)`,
|
|
194
320
|
].join('\n') + '\n'
|
|
195
321
|
}
|
|
@@ -204,12 +330,23 @@ function renderBuildPacket(issue: Issue, repoRoot: string, profile: string): str
|
|
|
204
330
|
const sp = resolveStackPointer(profile)
|
|
205
331
|
if (sp?.stackFileExists) {
|
|
206
332
|
lines.push(`Stack: ${profile} -> ${sp.stackFile} (decisions under ${sp.decisionsDir}/)`)
|
|
333
|
+
if (sp.support === 'unsupported') lines.push(` warning: ${unsupportedProfileNote(profile)}`)
|
|
207
334
|
}
|
|
208
|
-
lines.push(
|
|
209
|
-
|
|
335
|
+
lines.push(
|
|
336
|
+
issue.gate
|
|
337
|
+
? `Pipeline: follow the steps in ${issue.path} in the MAIN session; the "${issue.gate}" gate needs the human`
|
|
338
|
+
: `Pipeline: implement -> opice-author (selectors vs running app) -> bun test (steps + invariants)`,
|
|
339
|
+
)
|
|
340
|
+
lines.push(
|
|
341
|
+
issue.gate
|
|
342
|
+
? `Check: the "${issue.gate}" review gate (build done records its verdict)`
|
|
343
|
+
: issue.verify.length > 0
|
|
344
|
+
? `Check: bun test ${issue.verify.join(' ')} (build done runs it)`
|
|
345
|
+
: `Check: none recorded — pass the command that proves this issue: build done ${issue.id} --verify "<command>"`,
|
|
346
|
+
)
|
|
210
347
|
lines.push(`Repo: ${repoRoot}`)
|
|
211
348
|
lines.push(``)
|
|
212
|
-
lines.push(`After green: fabrika builder build done ${issue.id} (records it
|
|
349
|
+
lines.push(`After green: fabrika builder build done ${issue.id} (runs the check, records it, emits the next packet)`)
|
|
213
350
|
lines.push(`If stuck: fabrika builder build block ${issue.id} --reason "…" (escalate, continue)`)
|
|
214
351
|
return lines.join('\n') + '\n'
|
|
215
352
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from 'fs'
|
|
2
|
+
import { dirname, join } from 'path'
|
|
3
|
+
import { parseArgs } from 'util'
|
|
4
|
+
import { resolveContext } from '../context'
|
|
5
|
+
import { describePair, DESIGN_PATH, DESIGN_REVIEW_PATH, failingPairs, readDesign, renderDesignReview, summarizeContrast } from '../design-review'
|
|
6
|
+
import { readSkeletons } from '../skeletons'
|
|
7
|
+
|
|
8
|
+
export async function cmdDesign(argv: string[]): Promise<number> {
|
|
9
|
+
const { values, positionals } = parseArgs({
|
|
10
|
+
args: argv,
|
|
11
|
+
options: { dir: { type: 'string' }, session: { type: 'string' } },
|
|
12
|
+
allowPositionals: true,
|
|
13
|
+
})
|
|
14
|
+
if (positionals[0] !== 'review') {
|
|
15
|
+
console.error('[fabrika] usage: fabrika builder design review')
|
|
16
|
+
return 1
|
|
17
|
+
}
|
|
18
|
+
const ctx = resolveContext({ dir: values.dir, session: values.session })
|
|
19
|
+
if (!ctx.initialized) {
|
|
20
|
+
console.error(`[fabrika] no .fabrika/ found at or above ${ctx.repoRoot}. Run \`fabrika builder init\` first.`)
|
|
21
|
+
return 1
|
|
22
|
+
}
|
|
23
|
+
const design = readDesign(ctx.repoRoot)
|
|
24
|
+
console.error(`[fabrika] ${summarizeContrast(design.applied)}`)
|
|
25
|
+
for (const pair of failingPairs(design.applied)) console.error(`[fabrika] below AA: ${describePair(pair)}`)
|
|
26
|
+
for (const variant of design.variants) console.error(`[fabrika] variant ${variant.name}: ${summarizeContrast(variant.contrast)}`)
|
|
27
|
+
for (const problem of design.problems) console.error(`[fabrika] warning: variants: ${problem}`)
|
|
28
|
+
const urls = [...new Set(readSkeletons(join(ctx.repoRoot, 'tests', 'browser')).flatMap((s) => (s.url ? [s.url] : [])))]
|
|
29
|
+
const path = join(ctx.repoRoot, DESIGN_REVIEW_PATH)
|
|
30
|
+
mkdirSync(dirname(path), { recursive: true })
|
|
31
|
+
writeFileSync(path, renderDesignReview(design, urls, existsSync(join(ctx.repoRoot, DESIGN_PATH)), new Date()))
|
|
32
|
+
console.log(path)
|
|
33
|
+
return 0
|
|
34
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'fs'
|
|
2
|
+
import { dirname, join } from 'path'
|
|
3
|
+
import { parseArgs } from 'util'
|
|
4
|
+
import { resolveContext } from '../context'
|
|
5
|
+
import { FLOWS_REVIEW_PATH, readFlows, renderFlowsReview } from '../flows'
|
|
6
|
+
|
|
7
|
+
export async function cmdFlows(argv: string[]): Promise<number> {
|
|
8
|
+
const { values, positionals } = parseArgs({
|
|
9
|
+
args: argv,
|
|
10
|
+
options: { dir: { type: 'string' }, session: { type: 'string' } },
|
|
11
|
+
allowPositionals: true,
|
|
12
|
+
})
|
|
13
|
+
if (positionals[0] !== 'review') {
|
|
14
|
+
console.error('[fabrika] usage: fabrika builder flows review')
|
|
15
|
+
return 1
|
|
16
|
+
}
|
|
17
|
+
const ctx = resolveContext({ dir: values.dir, session: values.session })
|
|
18
|
+
if (!ctx.initialized) {
|
|
19
|
+
console.error(`[fabrika] no .fabrika/ found at or above ${ctx.repoRoot}. Run \`fabrika builder init\` first.`)
|
|
20
|
+
return 1
|
|
21
|
+
}
|
|
22
|
+
const flows = readFlows(ctx.repoRoot)
|
|
23
|
+
// The map is advisory, like every gate: problems are shown in the view and here, and never stop it.
|
|
24
|
+
for (const flow of flows) {
|
|
25
|
+
for (const problem of flow.problems) console.error(`[fabrika] warning: ${flow.path}: ${problem}`)
|
|
26
|
+
}
|
|
27
|
+
const path = join(ctx.repoRoot, FLOWS_REVIEW_PATH)
|
|
28
|
+
mkdirSync(dirname(path), { recursive: true })
|
|
29
|
+
writeFileSync(path, renderFlowsReview(flows, new Date()))
|
|
30
|
+
console.log(path)
|
|
31
|
+
return 0
|
|
32
|
+
}
|
|
@@ -28,7 +28,7 @@ export async function cmdInduce(argv: string[]): Promise<number> {
|
|
|
28
28
|
if (skeletons.length === 0) {
|
|
29
29
|
console.error(
|
|
30
30
|
`[fabrika] no opice skeletons in ${testsBrowserDir}. `
|
|
31
|
-
+ `Author them in phase
|
|
31
|
+
+ `Author them in phase 5 (skeletons) first.`,
|
|
32
32
|
)
|
|
33
33
|
return 1
|
|
34
34
|
}
|
|
@@ -56,6 +56,6 @@ export async function cmdInduce(argv: string[]): Promise<number> {
|
|
|
56
56
|
+ `${foundation} foundation + ${feature} feature.`,
|
|
57
57
|
)
|
|
58
58
|
console.log(`[fabrika] wrote ${written}, skipped ${skipped} existing (use --force to overwrite).`)
|
|
59
|
-
console.log(`[fabrika] → .fabrika/issues/ · next: fabrika builder
|
|
59
|
+
console.log(`[fabrika] → .fabrika/issues/ · next: fabrika builder next (build)`)
|
|
60
60
|
return 0
|
|
61
61
|
}
|
package/cli/src/commands/init.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { rmSync } from 'node:fs'
|
|
|
2
2
|
import { join } from 'node:path'
|
|
3
3
|
import { parseArgs } from 'node:util'
|
|
4
4
|
import { type BuilderPlatformStatus, parseBuilderOrigin } from '../../../shared'
|
|
5
|
+
import { DEFAULT_PROFILE, resolveStackPointer, unsupportedProfileNote } from '../catalog'
|
|
5
6
|
import { BASE_URL, SESSIONS_DIR } from '../config'
|
|
6
7
|
import { ensureDaemon, openBrowser } from '../daemon-lifecycle'
|
|
7
8
|
import { BuilderCliError } from '../errors'
|
|
@@ -47,7 +48,7 @@ export async function cmdInit(argv: string[]): Promise<number> {
|
|
|
47
48
|
const origin = values.url === undefined ? undefined : parseBuilderOrigin(values.url, 'control origin')
|
|
48
49
|
if (origin && values['no-daemon']) throw new BuilderCliError('--url cannot be combined with --no-daemon.')
|
|
49
50
|
const existing = readConfig(dir)
|
|
50
|
-
const profile = values.profile ?? existing?.profile ??
|
|
51
|
+
const profile = values.profile ?? existing?.profile ?? DEFAULT_PROFILE
|
|
51
52
|
if (existing && (profile !== existing.profile || (values.session && values.session !== existing.sessionId))) {
|
|
52
53
|
throw new BuilderCliError('Existing project profile and session cannot be replaced by init.')
|
|
53
54
|
}
|
|
@@ -58,6 +59,11 @@ export async function cmdInit(argv: string[]): Promise<number> {
|
|
|
58
59
|
throw new BuilderCliError('Disconnect explicitly before changing installations.')
|
|
59
60
|
}
|
|
60
61
|
const result = scaffold(dir, { profile, sessionId: values.session })
|
|
62
|
+
const stack = resolveStackPointer(profile)
|
|
63
|
+
if (stack?.support === 'unsupported') console.error(`[fabrika] warning: ${unsupportedProfileNote(profile)}`)
|
|
64
|
+
if (stack && !stack.stackFileExists) {
|
|
65
|
+
console.error(`[fabrika] warning: no "${profile}" preset in ${stack.root}/stacks/; the tech phase will ask for one.`)
|
|
66
|
+
}
|
|
61
67
|
const support = injectAgentSupport(result.repoRoot, { hosts })
|
|
62
68
|
|
|
63
69
|
if (result.alreadyInitialized) {
|
package/cli/src/commands/next.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util'
|
|
2
|
+
import { phaseIndex } from '../../../shared/phases'
|
|
2
3
|
import { resolveContext } from '../context'
|
|
4
|
+
import { skeletonRouteWarnings } from '../flows'
|
|
3
5
|
import { packetJson, renderPacket } from '../packet'
|
|
4
6
|
import { resolvePhaseState } from '../phase-state'
|
|
5
7
|
|
|
@@ -22,10 +24,15 @@ export async function cmdNext(argv: string[]): Promise<number> {
|
|
|
22
24
|
|
|
23
25
|
const { state, source } = await resolvePhaseState(ctx.repoRoot, ctx.fabrikaDir, ctx.sessionId)
|
|
24
26
|
|
|
27
|
+
const opts = {
|
|
28
|
+
profile: ctx.profile,
|
|
29
|
+
connection: ctx.connection,
|
|
30
|
+
routeWarnings: phaseIndex(state.current) >= phaseIndex('skeletons') ? skeletonRouteWarnings(ctx.repoRoot) : [],
|
|
31
|
+
}
|
|
25
32
|
if (values.json) {
|
|
26
|
-
console.log(JSON.stringify({ ...packetJson(state,
|
|
33
|
+
console.log(JSON.stringify({ ...packetJson(state, opts), routeWarnings: opts.routeWarnings, source }))
|
|
27
34
|
} else {
|
|
28
|
-
process.stdout.write(renderPacket(state,
|
|
35
|
+
process.stdout.write(renderPacket(state, opts))
|
|
29
36
|
}
|
|
30
37
|
return 0
|
|
31
38
|
}
|
package/cli/src/context.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'node:path'
|
|
2
2
|
import type { BuilderProjectConnection } from '../../shared'
|
|
3
|
+
import { DEFAULT_PROFILE } from './catalog'
|
|
3
4
|
import { getSessionId } from './config'
|
|
4
5
|
import { fabrikaDir, findRepoRoot, readConfig } from './layout'
|
|
5
6
|
|
|
@@ -24,7 +25,7 @@ export function resolveContext(opts: { dir?: string; session?: string } = {}): C
|
|
|
24
25
|
repoRoot,
|
|
25
26
|
fabrikaDir: fabrikaDir(repoRoot),
|
|
26
27
|
sessionId,
|
|
27
|
-
profile: config?.profile ??
|
|
28
|
+
profile: config?.profile ?? DEFAULT_PROFILE,
|
|
28
29
|
initialized: config !== null,
|
|
29
30
|
...(config?.connection ? { connection: config.connection } : {}),
|
|
30
31
|
}
|