@fabrika/builder 0.9.0-dev.13 → 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.cemdw2n8.js +0 -214
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
/* Gate: skeletons (phase
|
|
2
|
+
/* Gate: skeletons (phase 5). One row per tests/browser/*.test.ts. Confirm the
|
|
3
3
|
acceptance contract (scenarios + frozen invariants) before issue induction.
|
|
4
4
|
The dashboard also shows the live skeleton grid from /api/session/:id/skeletons. */
|
|
5
5
|
}
|
|
6
|
-
<Section title="Phase
|
|
6
|
+
<Section title="Phase 5 — Opice skeletons (acceptance contract)">
|
|
7
7
|
<Note>
|
|
8
8
|
Each skeleton is the definition of "done" for its flow. The `intent` of every step and every invariant is FROZEN here — the build may write the
|
|
9
9
|
check body but must not weaken the claim.
|
|
@@ -22,11 +22,6 @@
|
|
|
22
22
|
"Invariants capture the durable 'why', not UI details",
|
|
23
23
|
]}
|
|
24
24
|
/>
|
|
25
|
-
<Choice
|
|
26
|
-
id="skeletons-ok"
|
|
27
|
-
label="Acceptance contract complete?"
|
|
28
|
-
required
|
|
29
|
-
options={['Yes, induce issues', 'A scenario is missing', 'An invariant is too weak']}
|
|
30
|
-
/>
|
|
31
25
|
<UserInput id="skeletons-note" label="Missing scenarios or invariants?" placeholder="write here…" multiline />
|
|
26
|
+
<Choice id="verdict" label="Verdict" required options={['Approve', 'Request changes']} />
|
|
32
27
|
</Section>
|
package/skill/gates/tech.jsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
/* Gate: tech (phase 4). From .fabrika/architecture/tech.md — the stack pointer
|
|
3
|
-
+ reasoning. Confirm the stack + data layer before
|
|
3
|
+
+ reasoning. Confirm the stack + data layer before the skeletons. */
|
|
4
4
|
}
|
|
5
5
|
<Section title="Phase 4 — Tech & scaffold decision">
|
|
6
6
|
<Item id="stack" label="Stack preset" badge="stack" badgeVariant="info">
|
|
7
|
-
|
|
7
|
+
zerops-app (the default), or cf-app for an installation on Cloudflare. Every other preset is unsupported.
|
|
8
8
|
</Item>
|
|
9
9
|
<Item id="data" label="Data layer" badge="data" badgeVariant="neutral">
|
|
10
10
|
Where state lives and how it is seeded for tests.
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
<Item id="reasoning" label="Reasoning" badge="why" badgeVariant="neutral">
|
|
13
13
|
Why this stack fits the deployment target + the team.
|
|
14
14
|
</Item>
|
|
15
|
-
<Choice id="tech-ok" label="Stack approved?" required options={['Yes, proceed', 'Different stack', 'Revisit data layer']} />
|
|
16
15
|
<UserInput id="tech-note" label="Constraints to capture?" placeholder="write here…" multiline />
|
|
16
|
+
<Choice id="verdict" label="Verdict" required options={['Approve', 'Request changes']} />
|
|
17
17
|
</Section>
|
package/stacks/README.md
CHANGED
|
@@ -16,6 +16,7 @@ gotchas — pure-reference, no resolver code (see `../decisions/README.md`).
|
|
|
16
16
|
id: <kebab> # == filename; the value stored in .fabrika config `profile`
|
|
17
17
|
title: <human title>
|
|
18
18
|
goal: <one line: from empty to a running, opice-green slice>
|
|
19
|
+
support: supported | unsupported # unsupported: kept for reference, off the paved road; init and the packet warn
|
|
19
20
|
decisions: [id, …] # the composition. requires-closure must hold (see below).
|
|
20
21
|
build: <pointer to the per-issue verify recipe, if stack-shaped>
|
|
21
22
|
---
|
|
@@ -36,9 +37,14 @@ is a **starting point**, not a lock-in — add/drop decisions freely.
|
|
|
36
37
|
|
|
37
38
|
## Presets
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
Supported: the paved road (contract, proxy, `@fabrika/ui`, `@fabrika/db`, `fabrika-check`).
|
|
40
41
|
|
|
41
|
-
- **`
|
|
42
|
+
- **`zerops-app`** (the default) — local Bun + PostgreSQL + React/Buzola, Fabrika IAM and proxy access, deployed through an installed Fabrika Control plane.
|
|
43
|
+
- **`cf-app`** — the same contract application on Cloudflare: one Durable Object per environment over its SQLite, the proxy Worker, a local lopata run. Deployed by the installation's Control, outside the builder.
|
|
44
|
+
|
|
45
|
+
Unsupported, kept for reference: they leave the paved road, and the platform can neither check nor deploy what they build.
|
|
46
|
+
|
|
47
|
+
- **`cf-lightweight`** — buzola SPA + lopata + D1, **no SSR**. The simplest end-to-end Cloudflare stack (bun/lopata path).
|
|
42
48
|
- **`cf-internal-app`** — the full internal-app stack: Buzola SPA +
|
|
43
49
|
Worker API, D1/R2/Queue/Cron/Workers AI, native Fabrika IAM login and Fabrika Control deploy.
|
|
44
50
|
- **`cf-fat`** — RRv7 **SSR** + vite + `@cloudflare/vite-plugin` (workerd) + the full CF primitive set (D1/KV/R2/Queue/AE/Cron); counts behind `count-store` so it stays locally testable.
|
package/stacks/cf-app.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: cf-app
|
|
3
|
+
title: "Contract application on Cloudflare — one Durable Object per environment + Fabrika IAM"
|
|
4
|
+
goal: "Build and verify a React/Buzola contract application previewed with `fabrika app dev` behind the proxy decision, ready for the installed Fabrika Control on Cloudflare to deploy."
|
|
5
|
+
support: supported
|
|
6
|
+
decisions:
|
|
7
|
+
- cloudflare
|
|
8
|
+
- cf-fabrika-contract
|
|
9
|
+
- cf-contract-app
|
|
10
|
+
- bun
|
|
11
|
+
- react
|
|
12
|
+
- buzola
|
|
13
|
+
- opice
|
|
14
|
+
build: "see §Local verification below"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Stack: cf-app
|
|
18
|
+
|
|
19
|
+
The paved road on Cloudflare: the same contract, proxy, `@fabrika/ui`,
|
|
20
|
+
`@fabrika/db` and `fabrika-check` as `zerops-app`, with the application in one
|
|
21
|
+
Durable Object per environment instead of a Bun service with PostgreSQL. Use it
|
|
22
|
+
when the installation the application will run on is on Cloudflare.
|
|
23
|
+
|
|
24
|
+
**Maturity:** Fabrika, Buzola and opice are evolving 0.x components. The worked
|
|
25
|
+
reference is `examples/app` in the fabrika-platform repository; read it, and the
|
|
26
|
+
installed contracts, before scaffolding.
|
|
27
|
+
|
|
28
|
+
## Composition
|
|
29
|
+
|
|
30
|
+
- `cf-fabrika-contract` supplies the contract and the proxy Worker that enforces it.
|
|
31
|
+
- `cf-contract-app` composes the Durable Object, the generated entrypoint, the
|
|
32
|
+
SPA, the local `fabrika app dev` preview and the seeds.
|
|
33
|
+
- `cloudflare`, `bun`, `react`, `buzola` and `opice` are reused. Of
|
|
34
|
+
`cloudflare`'s recommendations (D1, KV, R2, Queue, oblaka, wrangler), none
|
|
35
|
+
applies: the deployer owns every resource the application has.
|
|
36
|
+
|
|
37
|
+
The selection is requires-closed and occupies each exclusive slot once. It
|
|
38
|
+
selects no `fabrika-iam` or `fabrika-control`: the contract replaces the
|
|
39
|
+
application's own IAM tables, and the installation's Control plane is not part
|
|
40
|
+
of the application.
|
|
41
|
+
|
|
42
|
+
## Local verification
|
|
43
|
+
|
|
44
|
+
1. Install with Bun and typecheck. After a contract or table change, run
|
|
45
|
+
`fabrika db codegen`, `fabrika db test-scaffold` and `fabrika app build`.
|
|
46
|
+
2. Run the application's tests (`testKit` on `@fabrika/db/testing-sqlite`,
|
|
47
|
+
denials included) and `fabrika-check .`.
|
|
48
|
+
3. Build the SPA and start `fabrika app dev` with the `dev/seed.ts` the scenarios
|
|
49
|
+
need. Run the targeted opice scenario against its address, picking the
|
|
50
|
+
scenario's persona at `/__fabrika/dev`.
|
|
51
|
+
4. Publish that address with `fabrika builder preview --url=…` and report the checks.
|
|
52
|
+
|
|
53
|
+
`fabrika app dev` previews the application; it never replaces its tests.
|
|
54
|
+
|
|
55
|
+
## Deployment
|
|
56
|
+
|
|
57
|
+
The builder's `connect` and `deploy` work with a Zerops installation only. An
|
|
58
|
+
application on this preset is deployed by the installed Fabrika Control on
|
|
59
|
+
Cloudflare, from a pushed commit. Ask the human to commit and push; never deploy
|
|
60
|
+
from the local machine.
|
package/stacks/cf-fat.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
id: cf-fat
|
|
3
3
|
title: "React Router v7 SSR + vite + @cloudflare/vite-plugin + full CF bindings — fat"
|
|
4
4
|
goal: "From empty to a Worker serving an SSR React app (workerd dev) with D1/KV/R2/Queue/AE/Cron wired (AE behind CountStore), auth in KV, and a green opice smoke test — no CF account needed for build/test."
|
|
5
|
+
support: unsupported
|
|
5
6
|
decisions:
|
|
6
7
|
- cloudflare
|
|
7
8
|
- cloudflare-vite-plugin
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
id: cf-internal-app
|
|
3
3
|
title: "Full internal Cloudflare app — Buzola SPA + Fabrika IAM + Fabrika Control"
|
|
4
4
|
goal: "From empty to a full internal app: Buzola SPA + Worker API, D1/R2/Queue/Cron/Workers AI, local Vite+lopata, native Fabrika IAM login, Fabrika-managed production deploy, and green opice tests."
|
|
5
|
+
support: unsupported
|
|
5
6
|
decisions:
|
|
6
7
|
- cloudflare
|
|
7
8
|
- lopata
|
|
@@ -34,8 +35,7 @@ SPA backed by a Cloudflare Worker. It runs as a Vite SPA plus a lopata Worker
|
|
|
34
35
|
locally, ships as one Worker with static assets in production, logs people in
|
|
35
36
|
through native Fabrika IAM, and delegates the whole production lifecycle to Fabrika Control.
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
Fabrika Control/Fabrika IAM ecosystem. This preset deliberately includes the operational
|
|
38
|
+
For a new application on Cloudflare, use the supported `cf-app` preset instead. This preset deliberately includes the operational
|
|
39
39
|
primitives available to the stack: R2, Queue, Cron and Workers AI. Drop any of those at the
|
|
40
40
|
tech gate when the product has no corresponding workload.
|
|
41
41
|
|
package/stacks/cf-lightweight.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: cf-lightweight
|
|
3
|
-
title: "buzola SPA + lopata + D1 on Cloudflare — lightweight, no SSR (
|
|
3
|
+
title: "buzola SPA + lopata + D1 on Cloudflare — lightweight, no SSR (unsupported)"
|
|
4
4
|
goal: "From empty to a buzola SPA on a local lopata CF dev server with a D1 binding and a green opice test — no SSR, local-first."
|
|
5
|
+
support: unsupported
|
|
5
6
|
decisions:
|
|
6
7
|
- cloudflare
|
|
7
8
|
- lopata
|
|
@@ -19,7 +20,7 @@ build: "see §build recipe below"
|
|
|
19
20
|
|
|
20
21
|
# Stack: cf-lightweight
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
**Unsupported** (no contract, proxy or checker; use `cf-app` on Cloudflare). A client-rendered **buzola SPA** (no SSR) on **lopata**
|
|
23
24
|
(local-first CF runtime, Bun) with a single **D1** database, styled with Tailwind,
|
|
24
25
|
tested by opice. Lighter than `cf-fat` — no SSR machinery, no workerd, the bun/lopata
|
|
25
26
|
path. Replaces the old `cf-local` (which was RRv7 SSR); the SPA-no-SSR shape is the
|
package/stacks/contember-app.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
id: contember-app
|
|
3
3
|
title: "Contember (Postgres GraphQL CMS) + buzola/React admin SPA + bindx + Tailwind"
|
|
4
4
|
goal: "From empty to a Contember backend (Postgres) with a typed schema + ACL, and a buzola/React admin SPA bound to it via bindx, green opice tests against the running SPA."
|
|
5
|
+
support: unsupported
|
|
5
6
|
decisions:
|
|
6
7
|
- contember
|
|
7
8
|
- postgres
|
package/stacks/content-site.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
id: content-site
|
|
3
3
|
title: "pletivo (Bun-native SSG) + Preact islands + Tailwind — static content site"
|
|
4
4
|
goal: "From empty to a statically-generated content site (file-based pages + content collections) with Preact islands and Tailwind, served locally, green opice smoke test."
|
|
5
|
+
support: unsupported
|
|
5
6
|
decisions:
|
|
6
7
|
- pletivo
|
|
7
8
|
- preact
|
package/stacks/zerops-app.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
id: zerops-app
|
|
3
3
|
title: "Platform-managed Zerops app — Bun + PostgreSQL + Fabrika IAM"
|
|
4
4
|
goal: "Build and verify a local React/Buzola contract application behind real IAM and the proxy's endpoint table, then deploy its available Git revision through installed Fabrika Control."
|
|
5
|
+
support: supported
|
|
5
6
|
decisions:
|
|
6
7
|
- zerops-platform
|
|
7
8
|
- bun
|
package/types/cli/src/bin.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
export declare const BUILDER_USAGE = "fabrika builder \u2014 guided application builder\n\nUsage:\n fabrika builder init [dir] [--profile <stack>] [--agent all|claude|codex]\n [--session=<id>] [--no-open] [--no-daemon] [--json]\n Scaffold .fabrika/, install agent support, open dashboard\n fabrika builder next [--json] Print the task packet for the current derived phase\n fabrika builder init [dir] --url=<origin> [--no-open] Initialize zerops-app and begin human consent\n [--no-daemon] Offline init only; incompatible with --url\n fabrika builder connect --url=<origin> [--no-open] [--json]\n fabrika builder status [--json] Read connection and deployment status\n fabrika builder disconnect [--json] Remove local custody; revoke separately in console\n fabrika builder deploy [--wait] [--timeout=<seconds>] [--json]\n fabrika builder preview --url=<url> | --clear [--json]\n Platform commands also accept --dir=<project>\n Results are sanitized JSON; wait defaults to 600 seconds\n --no-open returns the local dashboard URL, never approval proof\n All commands accept --help and never prompt for input\n fabrika builder advance [--force] Validate outputs and gate, then print the next phase\n fabrika builder gate open <name> --view <f.jsx> Push a canvas gate and open the dashboard\n fabrika builder gate wait [--gate <n>] [--timeout] Wait for submitted gate feedback\n fabrika builder ensure-daemon Start the daemon if it is not running\n fabrika builder induce [--force] Derive issues from opice skeleton metadata\n fabrika builder build [--issue <ID>] [--assisted] Run the assisted per-issue build driver\n\nEnvironment:\n FABRIKA_PORT Daemon port (default 19410)\n FABRIKA_SESSION_ID Session id (fallback: stable hash of repo abs path)\n FABRIKA_DATA_DIR Persistent daemon/session data (default ~/.fabrika)\n FABRIKA_TIMEOUT gate wait timeout in ms (default 3600000)";
|
|
2
|
+
export declare const BUILDER_USAGE = "fabrika builder \u2014 guided application builder\n\nUsage:\n fabrika builder init [dir] [--profile <stack>] [--agent all|claude|codex]\n [--session=<id>] [--no-open] [--no-daemon] [--json]\n Scaffold .fabrika/, install agent support, open dashboard\n fabrika builder next [--json] Print the task packet for the current derived phase\n fabrika builder init [dir] --url=<origin> [--no-open] Initialize zerops-app and begin human consent\n [--no-daemon] Offline init only; incompatible with --url\n fabrika builder connect --url=<origin> [--no-open] [--json]\n fabrika builder status [--json] Read connection and deployment status\n fabrika builder disconnect [--json] Remove local custody; revoke separately in console\n fabrika builder deploy [--wait] [--timeout=<seconds>] [--json]\n fabrika builder preview --url=<url> | --clear [--json]\n Platform commands also accept --dir=<project>\n Results are sanitized JSON; wait defaults to 600 seconds\n --no-open returns the local dashboard URL, never approval proof\n All commands accept --help and never prompt for input\n fabrika builder advance [--force] Validate outputs and gate, then print the next phase\n fabrika builder gate open <name> --view <f.jsx> Push a canvas gate and open the dashboard\n fabrika builder gate wait [--gate <n>] [--timeout] Wait for submitted gate feedback\n fabrika builder ensure-daemon Start the daemon if it is not running\n fabrika builder flows review Write the flows gate view: the route map from the flow files\n fabrika builder design review Write the design checkpoint view: overrides, contrast, routes\n fabrika builder induce [--force] Derive issues from opice skeleton metadata\n fabrika builder build [--issue <ID>] [--assisted] Run the assisted per-issue build driver\n fabrika builder build done <ID> [--verify <cmd>] Run the issue's check; record it as done only when green\n A design checkpoint takes [--waive-contrast] instead\n fabrika builder build block <ID> --reason <text> Record an issue as blocked\n fabrika builder build status | review Print the board | write the build gate view from it\n\nEnvironment:\n FABRIKA_PORT Daemon port (default 19410)\n FABRIKA_SESSION_ID Session id (fallback: stable hash of repo abs path)\n FABRIKA_DATA_DIR Persistent daemon/session data (default ~/.fabrika)\n FABRIKA_TIMEOUT gate wait timeout in ms (default 3600000)";
|
|
3
3
|
export declare function runBuilderCli(argv: readonly string[]): Promise<number>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BuildBoard, BuildEvidence } from './build-status';
|
|
2
|
+
import type { Issue } from './issues';
|
|
3
|
+
export declare const BUILD_REVIEW_PATH = ".fabrika/build/review.jsx";
|
|
4
|
+
/**
|
|
5
|
+
* The build gate's view, generated from the recorded checks so the reviewer sees what ran, not what an agent reported.
|
|
6
|
+
* Every value from the repository reaches the view as a string literal whose characters outside a small safe set are
|
|
7
|
+
* `\uXXXX` escapes: the canvas compiler runs regex passes over the raw source, string contents included.
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderBuildReview(issues: Issue[], board: BuildBoard, now: Date): string;
|
|
10
|
+
export declare function describeEvidence(evidence: BuildEvidence): string;
|
|
11
|
+
type Literal = string | readonly Literal[];
|
|
12
|
+
export declare function literal(value: Literal): string;
|
|
13
|
+
export {};
|
|
@@ -1,14 +1,29 @@
|
|
|
1
|
+
import type { GateVerdict } from '../../shared/gate';
|
|
1
2
|
import type { Issue } from './issues';
|
|
2
3
|
export type IssueStatus = 'done' | 'blocked';
|
|
4
|
+
/** The check the builder itself ran before it recorded an issue as done. */
|
|
5
|
+
export interface BuildEvidence {
|
|
6
|
+
command: string;
|
|
7
|
+
exitCode: number;
|
|
8
|
+
durationMs: number;
|
|
9
|
+
at: string;
|
|
10
|
+
/** HEAD of the repository when the check ran; null outside git. */
|
|
11
|
+
commit: string | null;
|
|
12
|
+
/** Uncommitted changes outside `.fabrika/` were present, so the commit alone does not reproduce the run. */
|
|
13
|
+
dirty: boolean;
|
|
14
|
+
/** Set when the check was a review gate (the design checkpoint) rather than a command. */
|
|
15
|
+
verdict?: GateVerdict;
|
|
16
|
+
}
|
|
3
17
|
export interface BuildRecord {
|
|
4
18
|
status: IssueStatus;
|
|
5
19
|
reason?: string;
|
|
6
20
|
at: string;
|
|
21
|
+
evidence?: BuildEvidence;
|
|
7
22
|
}
|
|
8
23
|
export type BuildBoard = Record<string, BuildRecord>;
|
|
9
24
|
export declare function readBoard(fabrikaDir: string): BuildBoard;
|
|
10
25
|
export declare function writeBoard(fabrikaDir: string, board: BuildBoard): void;
|
|
11
|
-
export declare function record(fabrikaDir: string, id: string, status: IssueStatus, reason: string | undefined, at: string): BuildBoard;
|
|
26
|
+
export declare function record(fabrikaDir: string, id: string, status: IssueStatus, reason: string | undefined, at: string, evidence?: BuildEvidence): BuildBoard;
|
|
12
27
|
export interface BuildPlan {
|
|
13
28
|
done: Issue[];
|
|
14
29
|
blocked: Issue[];
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
export declare function resolveCatalogRoot(): string | null;
|
|
2
|
+
/** The project profile a new project gets; `zerops-app` is the paved road the builder connects and deploys. */
|
|
3
|
+
export declare const DEFAULT_PROFILE = "zerops-app";
|
|
4
|
+
/** `unsupported`: a preset kept for reference that leaves the paved road (no contract, proxy, kit or checker). */
|
|
5
|
+
export type StackSupport = 'supported' | 'unsupported';
|
|
2
6
|
export interface StackPointer {
|
|
3
7
|
profile: string;
|
|
4
8
|
root: string;
|
|
5
9
|
stackFile: string;
|
|
6
10
|
stackFileExists: boolean;
|
|
7
11
|
decisionsDir: string;
|
|
12
|
+
/** Null when the preset file does not exist. */
|
|
13
|
+
support: StackSupport | null;
|
|
8
14
|
}
|
|
9
15
|
export declare function resolveStackPointer(profile: string): StackPointer | null;
|
|
16
|
+
/** The ids of the presets the builder supports, for pointing away from an unsupported one. */
|
|
17
|
+
export declare function supportedProfiles(): string[];
|
|
18
|
+
export declare function unsupportedProfileNote(profile: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cmdDesign(argv: string[]): Promise<number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cmdFlows(argv: string[]): Promise<number>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type ThemeMode = 'light' | 'dark';
|
|
2
|
+
type Tokens = Record<string, string>;
|
|
3
|
+
interface Declared {
|
|
4
|
+
value: string;
|
|
5
|
+
important: boolean;
|
|
6
|
+
}
|
|
7
|
+
type Block = Record<string, Declared>;
|
|
8
|
+
export interface ThemeBlocks {
|
|
9
|
+
/** Top-level `:root` declarations of custom properties. */
|
|
10
|
+
light: Block;
|
|
11
|
+
/** Top-level `:root[data-theme='dark']` declarations of custom properties. */
|
|
12
|
+
dark: Block;
|
|
13
|
+
/** `--fui-*` names also declared in a rule this reader does not cascade: another selector, or inside an at-rule. */
|
|
14
|
+
elsewhere: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ContrastResult {
|
|
17
|
+
fg: string;
|
|
18
|
+
bg: string;
|
|
19
|
+
mode: ThemeMode;
|
|
20
|
+
min: number;
|
|
21
|
+
/** Null when either colour could not be computed (`note` says why). */
|
|
22
|
+
ratio: number | null;
|
|
23
|
+
/** The same pair with the kit's own values; null when it cannot be computed. */
|
|
24
|
+
kitRatio: number | null;
|
|
25
|
+
/**
|
|
26
|
+
* `inherited`: below the minimum with the kit's own values too, and the override does not lower it — the kit's
|
|
27
|
+
* defect, not the application's. Only `fail` is the override's.
|
|
28
|
+
*/
|
|
29
|
+
status: 'pass' | 'fail' | 'inherited' | 'unchecked';
|
|
30
|
+
note?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Reads the custom properties of the top-level `:root` and `:root[data-theme='dark']` rules, the two blocks the kit
|
|
34
|
+
* declares its tokens in. A `--fui-*` token declared anywhere else is listed in `elsewhere`, so no pair that reads it
|
|
35
|
+
* passes on values the browser may not use.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readThemeBlocks(css: string): ThemeBlocks;
|
|
38
|
+
/**
|
|
39
|
+
* The token values each mode computes to with the application's stylesheet imported after the kit's. The dark rule is
|
|
40
|
+
* more specific than `:root`, so an application's `:root` override reaches dark mode only where the kit's dark rule
|
|
41
|
+
* declares nothing, or with `!important`, which outranks every normal declaration.
|
|
42
|
+
*/
|
|
43
|
+
export declare function cascade(kit: ThemeBlocks, app: ThemeBlocks): Record<ThemeMode, Tokens>;
|
|
44
|
+
export declare function checkContrast(kit: ThemeBlocks, app: ThemeBlocks): ContrastResult[];
|
|
45
|
+
/** The opaque colour a token computes to in a mode, as `#rrggbb`; null when it cannot be computed or is translucent. */
|
|
46
|
+
export declare function tokenHex(kit: ThemeBlocks, app: ThemeBlocks, mode: ThemeMode, name: string): string | null;
|
|
47
|
+
/** Encoded sRGB channels and alpha, each in [0, 1]. */
|
|
48
|
+
interface Rgba {
|
|
49
|
+
r: number;
|
|
50
|
+
g: number;
|
|
51
|
+
b: number;
|
|
52
|
+
a: number;
|
|
53
|
+
}
|
|
54
|
+
/** OKLCH here; every other CSS colour through `Bun.color`, which does not read OKLCH. Null when neither reads it. */
|
|
55
|
+
export declare function parseColor(value: string): Rgba | null;
|
|
56
|
+
export declare function contrastRatio(x: Rgba, y: Rgba): number;
|
|
57
|
+
/** Truncated, never rounded up: WCAG does not round, so 4.499 must not read as 4.50. */
|
|
58
|
+
export declare function formatRatio(ratio: number): string;
|
|
59
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PhaseState } from '
|
|
1
|
+
import type { PhaseState } from '../../shared/derive';
|
|
2
|
+
import type { GateVerdict } from '../../shared/gate';
|
|
2
3
|
export declare function fetchPhase(fabrikaDir: string, sessionId?: string): Promise<PhaseState | null>;
|
|
3
4
|
export interface PlanResult {
|
|
4
5
|
ok: boolean;
|
|
@@ -25,7 +26,17 @@ export declare function pushPlan(sessionId: string, body: PlanSource & {
|
|
|
25
26
|
reachable: boolean;
|
|
26
27
|
}>;
|
|
27
28
|
export declare function peekFeedback(sessionId: string): Promise<string | null>;
|
|
28
|
-
export
|
|
29
|
+
export interface ConsumedFeedback {
|
|
30
|
+
feedback: string;
|
|
31
|
+
verdict: GateVerdict;
|
|
32
|
+
}
|
|
33
|
+
export declare function consumeFeedback(sessionId: string): Promise<ConsumedFeedback | null>;
|
|
34
|
+
export interface ConsumedGate {
|
|
35
|
+
revision: number;
|
|
36
|
+
verdict: GateVerdict;
|
|
37
|
+
}
|
|
38
|
+
/** Consumes a named gate's latest submission; null when the daemon is down or nothing was submitted. */
|
|
39
|
+
export declare function consumeGate(sessionId: string, gateName: string): Promise<ConsumedGate | null>;
|
|
29
40
|
export interface BuildEvent {
|
|
30
41
|
issue?: string;
|
|
31
42
|
status: string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type ContrastResult, type ThemeMode } from './contrast';
|
|
2
|
+
export declare const DESIGN_GATE = "design-checkpoint";
|
|
3
|
+
export declare const DESIGN_PATH = ".fabrika/architecture/design.md";
|
|
4
|
+
export declare const DESIGN_REVIEW_PATH = ".fabrika/build/design-review.jsx";
|
|
5
|
+
export type DesignContrast = {
|
|
6
|
+
kind: 'checked';
|
|
7
|
+
stylesheet: string;
|
|
8
|
+
overrides: string[][];
|
|
9
|
+
results: ContrastResult[];
|
|
10
|
+
swatches: Swatches;
|
|
11
|
+
}
|
|
12
|
+
/** The stylesheet's directory does not resolve `@fabrika/ui`: a stack without the kit has other tokens. */
|
|
13
|
+
| {
|
|
14
|
+
kind: 'no-kit';
|
|
15
|
+
stylesheet: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'invalid';
|
|
18
|
+
problem: string;
|
|
19
|
+
};
|
|
20
|
+
/** The colour each swatch token computes to, per mode; null when it cannot be computed. */
|
|
21
|
+
type Swatches = Record<ThemeMode, [string, string | null][]>;
|
|
22
|
+
export interface ThemeVariant {
|
|
23
|
+
/** The file name without its extension: what the reviewer picks. */
|
|
24
|
+
name: string;
|
|
25
|
+
contrast: DesignContrast;
|
|
26
|
+
}
|
|
27
|
+
export interface Design {
|
|
28
|
+
/** The stylesheet the application imports (`stylesheet:`): what `build done` judges. */
|
|
29
|
+
applied: DesignContrast;
|
|
30
|
+
/** The alternatives the reviewer compares (`variants:`); empty when design.md lists none. */
|
|
31
|
+
variants: ThemeVariant[];
|
|
32
|
+
/** What is wrong with the variant list; shown in the view and warned, never refused. */
|
|
33
|
+
problems: string[];
|
|
34
|
+
}
|
|
35
|
+
/** The theme override that `design.md`'s front matter names (`stylesheet:`), checked against the kit it imports. */
|
|
36
|
+
export declare function readDesignContrast(repoRoot: string): DesignContrast;
|
|
37
|
+
export declare function readDesign(repoRoot: string): Design;
|
|
38
|
+
/**
|
|
39
|
+
* The variant whose `--fui-*` overrides the applied stylesheet declares exactly, or null. Only the kit's tokens count:
|
|
40
|
+
* the applied stylesheet also holds the application's own properties. Values compare without case or extra spaces.
|
|
41
|
+
*/
|
|
42
|
+
export declare function appliedVariant(design: Design): string | null;
|
|
43
|
+
export declare function failingPairs(contrast: DesignContrast): ContrastResult[];
|
|
44
|
+
export declare function describePair(r: ContrastResult): string;
|
|
45
|
+
/** One line for the build evidence and the console. */
|
|
46
|
+
export declare function summarizeContrast(contrast: DesignContrast): string;
|
|
47
|
+
export declare const VARIANT_CHOICE_ID = "variant";
|
|
48
|
+
/**
|
|
49
|
+
* The design checkpoint's view: generated, like the build review, so the reviewer sees computed ratios, not claimed ones.
|
|
50
|
+
* With variants, each is shown side by side with a required choice; the preview shows only the applied stylesheet.
|
|
51
|
+
* `withDesign`: `design.md` exists, so the view shows the recorded decisions beside the computed values.
|
|
52
|
+
*/
|
|
53
|
+
export declare function renderDesignReview(design: Design, urls: string[], withDesign: boolean, now: Date): string;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const FLOWS_DIR = ".fabrika/architecture/flows";
|
|
2
|
+
export declare const FLOWS_REVIEW_PATH = ".fabrika/architecture/flows-review.jsx";
|
|
3
|
+
export interface Flow {
|
|
4
|
+
slug: string;
|
|
5
|
+
/** Repository-relative. */
|
|
6
|
+
path: string;
|
|
7
|
+
actor: string;
|
|
8
|
+
goal: string;
|
|
9
|
+
/** The screen the flow starts on; null when the front matter names none or an invalid one. */
|
|
10
|
+
route: string | null;
|
|
11
|
+
/** The screens the flow moves to, valid routes only. */
|
|
12
|
+
leadsTo: string[];
|
|
13
|
+
/** What the reviewer must fix before the map can be trusted. */
|
|
14
|
+
problems: string[];
|
|
15
|
+
/** Only a regular file under a slug name is shown and mapped; a link could pull in any file on the machine. */
|
|
16
|
+
shown: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function readFlows(repoRoot: string): Flow[];
|
|
19
|
+
export declare function parseFlow(slug: string, raw: string): Flow;
|
|
20
|
+
/** Every screen on the map: each shown flow's start and every screen it leads to. */
|
|
21
|
+
export declare function mappedRoutes(flows: readonly Flow[]): Set<string>;
|
|
22
|
+
/** The skeleton URLs on no screen of the map: a `:name` segment matches any one segment, and a trailing slash is ignored. */
|
|
23
|
+
export declare function unmappedUrls(flows: readonly Flow[], urls: readonly string[]): string[];
|
|
24
|
+
/** The route check `next` and `advance` report from the skeletons phase on: the issues are induced from these urls. */
|
|
25
|
+
export declare function skeletonRouteWarnings(repoRoot: string): string[];
|
|
26
|
+
export declare function routeMapMermaid(flows: readonly Flow[]): string;
|
|
27
|
+
/** The flows gate's view, generated from the flow files so the map is the one they declare. */
|
|
28
|
+
export declare function renderFlowsReview(flows: readonly Flow[], now: Date): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The flat `key: value` front matter the builder's own Markdown files carry; lists are `[a, b]` on one line. */
|
|
2
|
+
export interface FrontMatter {
|
|
3
|
+
body: Record<string, string>;
|
|
4
|
+
rest: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function extractFrontMatter(raw: string): FrontMatter;
|
|
7
|
+
export declare function scalar(v: string | undefined): string | undefined;
|
|
8
|
+
export declare function list(v: string | undefined): string[];
|
package/types/cli/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export { derivePhase, type GateProbe, isNonEmptyFile, matchGlob, offlineGateProbe, type PhaseState, producesSatisfied, resolveReads, } from '../../shared/derive';
|
|
1
2
|
export { type Phase, PHASE_COUNT, PHASE_IDS, phaseById, type PhaseId, phaseIndex, PHASES } from '../../shared/phases';
|
|
2
3
|
export { resolveCatalogRoot, resolveStackPointer, type StackPointer } from './catalog';
|
|
3
4
|
export { BASE_URL, DAEMON_PORT, DATA_DIR, FABRIKA_DIRNAME, getSessionId, hashRepoPath, NEUTRAL_DATA_DIR, resolveDataDir, TEMP_DIR, WS_URL, } from './config';
|
|
4
|
-
export { derivePhase, type GateProbe, isNonEmptyFile, matchGlob, offlineGateProbe, type PhaseState, producesSatisfied, resolveReads } from './derive';
|
|
5
5
|
export { type AgentHost, injectAgentSupport, type InjectOptions, type InjectResult, injectSkills, parseAgentHosts, resolveSkillSource, } from './inject-skills';
|
|
6
6
|
export { configPath, EXTERNAL_DIRS, type FabrikaConfig, fabrikaDir, findRepoRoot, type InitResult, isInitialized, LAYER_DIRS, readConfig, scaffold, } from './layout';
|
|
7
7
|
export { type PacketJson, packetJson, type RenderOpts, renderPacket } from './packet';
|
|
@@ -6,6 +6,9 @@ export interface InducedIssue {
|
|
|
6
6
|
satisfies: string[];
|
|
7
7
|
dependsOn: string[];
|
|
8
8
|
touches: string[];
|
|
9
|
+
verify: string[];
|
|
10
|
+
/** The review gate whose consumed verdict `build done` records instead of running a check. */
|
|
11
|
+
gate?: string;
|
|
9
12
|
body: string;
|
|
10
13
|
kind: 'foundation' | 'feature';
|
|
11
14
|
}
|
|
@@ -5,6 +5,10 @@ export interface Issue {
|
|
|
5
5
|
satisfies: string[];
|
|
6
6
|
dependsOn: string[];
|
|
7
7
|
touches: string[];
|
|
8
|
+
/** Repository-relative acceptance files `build done` runs; empty for an issue whose check the driver names. */
|
|
9
|
+
verify: string[];
|
|
10
|
+
/** A review gate whose verdict `build done` records instead of running a check. */
|
|
11
|
+
gate?: string;
|
|
8
12
|
body: string;
|
|
9
13
|
}
|
|
10
14
|
export declare function readIssues(fabrikaDir: string): Issue[];
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { BuilderProjectConnection } from '../../shared';
|
|
2
|
+
import type { PhaseState } from '../../shared/derive';
|
|
2
3
|
import { type PhaseId } from '../../shared/phases';
|
|
3
4
|
import { type StackPointer } from './catalog';
|
|
4
|
-
import type { PhaseState } from './derive';
|
|
5
5
|
export interface RenderOpts {
|
|
6
6
|
profile?: string;
|
|
7
7
|
connection?: BuilderProjectConnection;
|
|
8
|
+
/** Skeleton urls off the flows' route map (`skeletonRouteWarnings`). */
|
|
9
|
+
routeWarnings?: string[];
|
|
8
10
|
}
|
|
9
11
|
export declare function renderPacket(state: PhaseState, opts?: RenderOpts): string;
|
|
10
12
|
export interface PacketJson {
|
|
@@ -16,9 +18,15 @@ export interface PacketJson {
|
|
|
16
18
|
produces: string[];
|
|
17
19
|
gate: boolean;
|
|
18
20
|
gateView: string | null;
|
|
21
|
+
gateViewCommand: string | null;
|
|
22
|
+
/** An ungated phase whose output this later phase's gate reviews. */
|
|
23
|
+
reviewedAt: PhaseId | null;
|
|
19
24
|
skills: string[];
|
|
20
25
|
completed: PhaseId[];
|
|
21
26
|
satisfied: boolean;
|
|
27
|
+
verdicts: PhaseState['verdicts'];
|
|
28
|
+
unverified: PhaseId[];
|
|
29
|
+
stale: string[];
|
|
22
30
|
stack: StackPointer | null;
|
|
23
31
|
platform: ReturnType<typeof connectionContext> | null;
|
|
24
32
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BuildEvidence } from './build-status';
|
|
2
|
+
/** What an issue's check runs: its acceptance files under `bun test`, or the command the driver names. */
|
|
3
|
+
export type Verification = {
|
|
4
|
+
kind: 'files';
|
|
5
|
+
files: string[];
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'command';
|
|
8
|
+
command: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function verificationCommand(verification: Verification): string[];
|
|
11
|
+
export declare function describeVerification(verification: Verification): string;
|
|
12
|
+
/** Runs the check in the repository with the driver's terminal attached, and returns what happened. */
|
|
13
|
+
export declare function runVerification(repoRoot: string, verification: Verification, now?: () => Date): Promise<BuildEvidence>;
|
|
14
|
+
/** `commit` is null before the first commit and outside git; `dirty` is true whenever git cannot tell. */
|
|
15
|
+
export declare function gitState(repoRoot: string): {
|
|
16
|
+
commit: string | null;
|
|
17
|
+
dirty: boolean;
|
|
18
|
+
};
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
index: number;
|
|
5
|
-
completed: PhaseId[];
|
|
6
|
-
reads: string[];
|
|
7
|
-
produces: string[];
|
|
8
|
-
gate: boolean;
|
|
1
|
+
import { type GateReview, type PhaseState as SharedPhaseState } from '../../shared/derive';
|
|
2
|
+
import type { PhaseId } from '../../shared/phases';
|
|
3
|
+
export interface PhaseState extends SharedPhaseState {
|
|
9
4
|
gateName?: string;
|
|
10
|
-
satisfied: boolean;
|
|
11
5
|
}
|
|
12
6
|
export interface GateOracle {
|
|
13
|
-
|
|
14
|
-
revision: number;
|
|
15
|
-
feedback: string;
|
|
16
|
-
} | null;
|
|
17
|
-
hasGateRevision?(sessionId: string, gateName: string): boolean;
|
|
7
|
+
gateReview(sessionId: string, gateName: PhaseId): GateReview;
|
|
18
8
|
}
|
|
19
|
-
export declare function producesSatisfied(phase: Phase, repoRoot: string): boolean;
|
|
20
|
-
export declare function gateSatisfied(phase: Phase, sessionId: string, oracle?: GateOracle): boolean;
|
|
21
9
|
export declare function derivePhaseState(fabrikaDir: string, sessionId?: string, oracle?: GateOracle): PhaseState;
|