@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
package/ui/dist/index.html
CHANGED
package/cli/src/derive.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, statSync } from 'fs'
|
|
2
|
-
import { basename, dirname, join, resolve } from 'path'
|
|
3
|
-
import { isPhaseHint, type Phase, type PhaseId, phaseIndex, PHASES } from '../../shared/phases'
|
|
4
|
-
|
|
5
|
-
export interface PhaseState {
|
|
6
|
-
current: PhaseId
|
|
7
|
-
index: number
|
|
8
|
-
completed: PhaseId[]
|
|
9
|
-
reads: string[]
|
|
10
|
-
produces: string[]
|
|
11
|
-
gate: boolean
|
|
12
|
-
satisfied: boolean
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type GateProbe = (phase: Phase) => boolean
|
|
16
|
-
|
|
17
|
-
export const offlineGateProbe: GateProbe = () => true
|
|
18
|
-
|
|
19
|
-
export function matchGlob(repoRoot: string, glob: string): string[] {
|
|
20
|
-
if (!glob.includes('*')) {
|
|
21
|
-
const abs = resolve(repoRoot, glob)
|
|
22
|
-
return existsSync(abs) ? [abs] : []
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const dirPart = dirname(glob)
|
|
26
|
-
const filePart = basename(glob)
|
|
27
|
-
const absDir = resolve(repoRoot, dirPart)
|
|
28
|
-
if (!existsSync(absDir) || !statSync(absDir).isDirectory()) return []
|
|
29
|
-
|
|
30
|
-
const re = globSegmentToRegExp(filePart)
|
|
31
|
-
const out: string[] = []
|
|
32
|
-
for (const entry of readdirSync(absDir)) {
|
|
33
|
-
if (re.test(entry)) out.push(join(absDir, entry))
|
|
34
|
-
}
|
|
35
|
-
return out
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function globSegmentToRegExp(seg: string): RegExp {
|
|
39
|
-
const escaped = seg.replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '[^/]*')
|
|
40
|
-
return new RegExp(`^${escaped}$`)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function isNonEmptyFile(p: string): boolean {
|
|
44
|
-
try {
|
|
45
|
-
const st = statSync(p)
|
|
46
|
-
return st.isFile() && st.size > 0
|
|
47
|
-
} catch {
|
|
48
|
-
return false
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function producesSatisfied(repoRoot: string, phase: Phase): boolean {
|
|
53
|
-
for (const glob of phase.produces) {
|
|
54
|
-
if (isPhaseHint(glob)) return false
|
|
55
|
-
const matches = matchGlob(repoRoot, glob).filter(isNonEmptyFile)
|
|
56
|
-
if (matches.length === 0) return false
|
|
57
|
-
}
|
|
58
|
-
return true
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function resolveReads(repoRoot: string, phase: Phase): string[] {
|
|
62
|
-
const out: string[] = []
|
|
63
|
-
for (const glob of phase.reads) {
|
|
64
|
-
if (isPhaseHint(glob)) {
|
|
65
|
-
out.push(glob) // keep the human hint, e.g. "<init brief>"
|
|
66
|
-
continue
|
|
67
|
-
}
|
|
68
|
-
const matches = matchGlob(repoRoot, glob)
|
|
69
|
-
if (matches.length > 0) {
|
|
70
|
-
out.push(glob)
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return out
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function derivePhase(repoRoot: string, gateProbe: GateProbe = offlineGateProbe): PhaseState {
|
|
77
|
-
const completed: PhaseId[] = []
|
|
78
|
-
|
|
79
|
-
for (const phase of PHASES) {
|
|
80
|
-
const produced = producesSatisfied(repoRoot, phase)
|
|
81
|
-
const gateOk = !produced ? false : phase.gate ? gateProbe(phase) : true
|
|
82
|
-
|
|
83
|
-
if (produced && gateOk) {
|
|
84
|
-
completed.push(phase.id)
|
|
85
|
-
continue
|
|
86
|
-
}
|
|
87
|
-
return toState(repoRoot, phase, completed, produced)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const build = PHASES.at(-1)
|
|
91
|
-
if (build === undefined) throw new Error('The builder has no phases')
|
|
92
|
-
return toState(repoRoot, build, completed.filter((id) => id !== build.id), true)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function toState(repoRoot: string, phase: Phase, completed: PhaseId[], satisfied: boolean): PhaseState {
|
|
96
|
-
return {
|
|
97
|
-
current: phase.id,
|
|
98
|
-
index: phaseIndex(phase.id),
|
|
99
|
-
completed,
|
|
100
|
-
reads: resolveReads(repoRoot, phase),
|
|
101
|
-
produces: phase.produces,
|
|
102
|
-
gate: phase.gate,
|
|
103
|
-
satisfied,
|
|
104
|
-
}
|
|
105
|
-
}
|
package/skill/gates/build.jsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
/* Gate: build (phase 8). A per-issue / final-review canvas. The dashboard build
|
|
3
|
-
pane streams live BuildEvents from /api/build/stream alongside this. Use it to
|
|
4
|
-
sign off green issues and triage blocked ones at final review. */
|
|
5
|
-
}
|
|
6
|
-
<Section title="Phase 8 — Build review">
|
|
7
|
-
<Table
|
|
8
|
-
headers={['Issue', 'Satisfies', 'Status']}
|
|
9
|
-
rows={[
|
|
10
|
-
['ISSUE-001', 'scaffold + routes', '✓ green'],
|
|
11
|
-
['ISSUE-101', 'browse scenario', '✓ green'],
|
|
12
|
-
['ISSUE-102', 'checkout scenario', '⚠ blocked'],
|
|
13
|
-
]}
|
|
14
|
-
/>
|
|
15
|
-
<Item id="blocked" label="Blocked issues need a decision" badge="triage" badgeVariant="warning">
|
|
16
|
-
For each blocked issue: relax the approach, split it, or accept the gap.
|
|
17
|
-
</Item>
|
|
18
|
-
<Choice id="build-ok" label="Accept this build?" required options={['Yes, ship', 'Re-try a blocked issue', 'Re-open an earlier phase']} />
|
|
19
|
-
<UserInput id="build-note" label="Notes for the blocked issues?" placeholder="write here…" multiline />
|
|
20
|
-
</Section>
|
package/skill/gates/design.jsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
/* Gate: design (phase 5). Pair this review canvas with the live mockup the
|
|
3
|
-
dashboard renders from .fabrika/architecture/design.md tokens. Push BOTH the
|
|
4
|
-
mockup spec and the token table; the right pane shows the themed screen. */
|
|
5
|
-
}
|
|
6
|
-
<Section title="Phase 5 — Design tokens + mockup">
|
|
7
|
-
<Item id="header" label="Screen: the primary flow surface" badge="h1" badgeVariant="info">
|
|
8
|
-
The key screen from a user flow (heading + the main action).
|
|
9
|
-
</Item>
|
|
10
|
-
<Table
|
|
11
|
-
headers={['Token', 'Role', 'Value']}
|
|
12
|
-
rows={[
|
|
13
|
-
['color.brand', 'primary action, brand', '#6F4E37'],
|
|
14
|
-
['color.surface', 'page + card background', '#FBF7F0'],
|
|
15
|
-
['color.accent', 'prices, badges', '#C8853A'],
|
|
16
|
-
['radius.card', 'cards, inputs, buttons', '12px'],
|
|
17
|
-
]}
|
|
18
|
-
/>
|
|
19
|
-
<Choice id="palette" label="Primary palette?" required options={['As shown (recommended)', 'Darker', 'Lighter / minimal']} />
|
|
20
|
-
<Choice id="layout-ok" label="Screen layout reads well?" required options={['Yes, approve', 'Adjust hierarchy', 'Bigger primary action']} />
|
|
21
|
-
<UserInput id="design-note" label="Token or layout tweaks?" placeholder="e.g. more contrast on the price" multiline />
|
|
22
|
-
</Section>
|
package/skill/gates/flows.jsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
/* Gate: flows (phase 3). One Item per .fabrika/architecture/flows/*.flow.md.
|
|
3
|
-
Each flow's first segment is its route (a contract the skeletons + build honour). */
|
|
4
|
-
}
|
|
5
|
-
<Section title="Phase 3 — User flows">
|
|
6
|
-
<Item id="flow-browse" label="Browse — /" badge="flow" badgeVariant="info">
|
|
7
|
-
Land → filter → open an item → act.
|
|
8
|
-
</Item>
|
|
9
|
-
<Item id="flow-checkout" label="Checkout — /cart" badge="flow" badgeVariant="info">
|
|
10
|
-
Review items → provide details → confirm → see the result.
|
|
11
|
-
</Item>
|
|
12
|
-
<Choice id="flows-complete" label="Flows complete?" required options={['Yes, proceed', 'A flow is missing', 'Merge two flows']} />
|
|
13
|
-
<UserInput id="flows-note" label="Missing steps or edge cases?" placeholder="write here…" multiline />
|
|
14
|
-
</Section>
|
package/skill/gates/vision.jsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
/* Gate: vision (phase 2). From .fabrika/intent/glossary.md +
|
|
3
|
-
.fabrika/principles/principles.md. Confirm the ubiquitous language and the
|
|
4
|
-
Must/Must-not/Preference principles before flows. */
|
|
5
|
-
}
|
|
6
|
-
<Section title="Phase 2 — Vision, scope & principles">
|
|
7
|
-
<Item id="vision" label="Vision" badge="vision" badgeVariant="info">
|
|
8
|
-
The one-line product vision.
|
|
9
|
-
</Item>
|
|
10
|
-
<Table
|
|
11
|
-
headers={['Term', 'Means exactly']}
|
|
12
|
-
rows={[
|
|
13
|
-
['Term A', 'single agreed meaning'],
|
|
14
|
-
['Term B', 'single agreed meaning'],
|
|
15
|
-
]}
|
|
16
|
-
/>
|
|
17
|
-
<Note>Principles use RFC-2119 keywords: MUST / MUST NOT / SHOULD / MAY.</Note>
|
|
18
|
-
<Checklist
|
|
19
|
-
items={[
|
|
20
|
-
'MUST: a hard requirement',
|
|
21
|
-
'MUST NOT: a hard prohibition',
|
|
22
|
-
'PREFERENCE: a tie-breaker',
|
|
23
|
-
]}
|
|
24
|
-
/>
|
|
25
|
-
<Choice id="principles-ok" label="Principles + glossary agreed?" required options={['Yes, proceed', 'Edit a term', 'Add a principle']} />
|
|
26
|
-
<UserInput id="vision-note" label="Edits to scope or wording?" placeholder="write here…" multiline />
|
|
27
|
-
</Section>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Phase, type PhaseId } from '../../shared/phases';
|
|
2
|
-
export interface PhaseState {
|
|
3
|
-
current: PhaseId;
|
|
4
|
-
index: number;
|
|
5
|
-
completed: PhaseId[];
|
|
6
|
-
reads: string[];
|
|
7
|
-
produces: string[];
|
|
8
|
-
gate: boolean;
|
|
9
|
-
satisfied: boolean;
|
|
10
|
-
}
|
|
11
|
-
export type GateProbe = (phase: Phase) => boolean;
|
|
12
|
-
export declare const offlineGateProbe: GateProbe;
|
|
13
|
-
export declare function matchGlob(repoRoot: string, glob: string): string[];
|
|
14
|
-
export declare function isNonEmptyFile(p: string): boolean;
|
|
15
|
-
export declare function producesSatisfied(repoRoot: string, phase: Phase): boolean;
|
|
16
|
-
export declare function resolveReads(repoRoot: string, phase: Phase): string[];
|
|
17
|
-
export declare function derivePhase(repoRoot: string, gateProbe?: GateProbe): PhaseState;
|