@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.
Files changed (96) hide show
  1. package/BUILD-CONTRACT.md +9 -3
  2. package/README.md +39 -9
  3. package/cli/src/bin.ts +14 -1
  4. package/cli/src/build-review.ts +66 -0
  5. package/cli/src/build-status.ts +41 -3
  6. package/cli/src/catalog.ts +34 -2
  7. package/cli/src/commands/advance.ts +48 -6
  8. package/cli/src/commands/build.ts +152 -15
  9. package/cli/src/commands/design.ts +34 -0
  10. package/cli/src/commands/flows.ts +32 -0
  11. package/cli/src/commands/induce.ts +2 -2
  12. package/cli/src/commands/init.ts +7 -1
  13. package/cli/src/commands/next.ts +9 -2
  14. package/cli/src/context.ts +2 -1
  15. package/cli/src/contrast.ts +301 -0
  16. package/cli/src/daemon-client.ts +29 -3
  17. package/cli/src/design-review.ts +261 -0
  18. package/cli/src/flows.ts +162 -0
  19. package/cli/src/frontmatter.ts +32 -0
  20. package/cli/src/index.ts +10 -1
  21. package/cli/src/induce.ts +61 -3
  22. package/cli/src/issues.ts +15 -29
  23. package/cli/src/layout.ts +5 -2
  24. package/cli/src/packet.ts +36 -3
  25. package/cli/src/phase-state.ts +19 -1
  26. package/cli/src/verify.ts +50 -0
  27. package/daemon/src/handlers.ts +32 -6
  28. package/daemon/src/phases.ts +7 -109
  29. package/daemon/src/platform-source.ts +8 -0
  30. package/decisions/README.md +2 -2
  31. package/decisions/patterns/cf-contract-app.md +57 -0
  32. package/decisions/technologies/bun.md +2 -1
  33. package/decisions/technologies/cf-fabrika-contract.md +45 -0
  34. package/decisions/technologies/cloudflare.md +3 -1
  35. package/decisions/technologies/oblaka.md +1 -1
  36. package/decisions/technologies/opice.md +1 -1
  37. package/decisions/technologies/react.md +1 -1
  38. package/decisions/technologies/tailwind.md +5 -5
  39. package/decisions/technologies/zerops-fabrika-auth.md +1 -1
  40. package/decisions/technologies/zerops-platform.md +1 -1
  41. package/package.json +11 -8
  42. package/shared/approvals.ts +65 -0
  43. package/shared/derive.ts +189 -0
  44. package/shared/gate.ts +20 -0
  45. package/shared/index.ts +6 -1
  46. package/shared/phases.ts +22 -20
  47. package/skill/SKILL.md +25 -16
  48. package/skill/agents/build-orchestrator.md +28 -8
  49. package/skill/agents/flows-author.md +27 -13
  50. package/skill/agents/implementer.md +3 -1
  51. package/skill/agents/opice-skeleton-author.md +8 -7
  52. package/skill/gates/brief.jsx +26 -5
  53. package/skill/gates/review-grid.jsx +3 -8
  54. package/skill/gates/tech.jsx +3 -3
  55. package/stacks/README.md +8 -2
  56. package/stacks/cf-app.md +60 -0
  57. package/stacks/cf-fat.md +1 -0
  58. package/stacks/cf-internal-app.md +2 -2
  59. package/stacks/cf-lightweight.md +3 -2
  60. package/stacks/contember-app.md +1 -0
  61. package/stacks/content-site.md +1 -0
  62. package/stacks/zerops-app.md +1 -0
  63. package/types/cli/src/bin.d.ts +1 -1
  64. package/types/cli/src/build-review.d.ts +13 -0
  65. package/types/cli/src/build-status.d.ts +16 -1
  66. package/types/cli/src/catalog.d.ts +9 -0
  67. package/types/cli/src/commands/design.d.ts +1 -0
  68. package/types/cli/src/commands/flows.d.ts +1 -0
  69. package/types/cli/src/contrast.d.ts +59 -0
  70. package/types/cli/src/daemon-client.d.ts +13 -2
  71. package/types/cli/src/design-review.d.ts +54 -0
  72. package/types/cli/src/flows.d.ts +28 -0
  73. package/types/cli/src/frontmatter.d.ts +8 -0
  74. package/types/cli/src/index.d.ts +1 -1
  75. package/types/cli/src/induce.d.ts +3 -0
  76. package/types/cli/src/issues.d.ts +4 -0
  77. package/types/cli/src/packet.d.ts +9 -1
  78. package/types/cli/src/phase-state.d.ts +1 -1
  79. package/types/cli/src/verify.d.ts +18 -0
  80. package/types/daemon/src/phases.d.ts +4 -16
  81. package/types/daemon/src/platform-remote.d.ts +6 -2
  82. package/types/shared/approvals.d.ts +32 -0
  83. package/types/shared/derive.d.ts +41 -0
  84. package/types/shared/gate.d.ts +11 -0
  85. package/types/shared/index.d.ts +105 -65
  86. package/types/shared/phases.d.ts +7 -1
  87. package/ui/dist/assets/client.css +1 -1
  88. package/ui/dist/assets/client.vn7hykcn.js +120 -0
  89. package/ui/dist/index.html +1 -1
  90. package/cli/src/derive.ts +0 -105
  91. package/skill/gates/build.jsx +0 -20
  92. package/skill/gates/design.jsx +0 -22
  93. package/skill/gates/flows.jsx +0 -14
  94. package/skill/gates/vision.jsx +0 -27
  95. package/types/cli/src/derive.d.ts +0 -17
  96. package/ui/dist/assets/client.8aw2edb7.js +0 -214
@@ -31,6 +31,6 @@
31
31
  }
32
32
  }
33
33
  </script>
34
- <script type="module" src="/assets/client.8aw2edb7.js"></script>
34
+ <script type="module" src="/assets/client.vn7hykcn.js"></script>
35
35
  </body>
36
36
  </html>
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
- }
@@ -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>
@@ -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>
@@ -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>
@@ -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;