@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.
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.cemdw2n8.js +0 -214
@@ -28,6 +28,8 @@ export declare class PlatformRemote {
28
28
  sourceConnection: {
29
29
  list: (input: import("@fabrika/control-contract").GitHubSourceConnectionListInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionListResponse>;
30
30
  start: (input: import("@fabrika/control-contract").StartGitHubSourceConnectionRequest) => Promise<import("@fabrika/control-contract").StartGitHubSourceConnectionResponse>;
31
+ handoff: (input: import("@fabrika/control-contract").GitHubSourceConnectionHandoffInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionHandoffDto>;
32
+ cancel: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionCancelDto>;
31
33
  verifyInstallation: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionStatusDto>;
32
34
  repair: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionStatusDto>;
33
35
  reconcile: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionStatusDto>;
@@ -131,8 +133,8 @@ export declare class PlatformRemote {
131
133
  kind: "backup";
132
134
  appId: string;
133
135
  } | {
134
- env: string;
135
136
  at: string;
137
+ env: string;
136
138
  kind: "restore";
137
139
  appId: string;
138
140
  }) => Promise<import("@fabrika/control-contract").DataOperationDto>;
@@ -171,6 +173,8 @@ export declare class PlatformRemote {
171
173
  sourceConnection: {
172
174
  list: (input: import("@fabrika/control-contract").GitHubSourceConnectionListInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionListResponse>;
173
175
  start: (input: import("@fabrika/control-contract").StartGitHubSourceConnectionRequest) => Promise<import("@fabrika/control-contract").StartGitHubSourceConnectionResponse>;
176
+ handoff: (input: import("@fabrika/control-contract").GitHubSourceConnectionHandoffInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionHandoffDto>;
177
+ cancel: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionCancelDto>;
174
178
  verifyInstallation: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionStatusDto>;
175
179
  repair: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionStatusDto>;
176
180
  reconcile: (input: import("@fabrika/control-contract").GitHubSourceConnectionInput) => Promise<import("@fabrika/control-contract").GitHubSourceConnectionStatusDto>;
@@ -274,8 +278,8 @@ export declare class PlatformRemote {
274
278
  kind: "backup";
275
279
  appId: string;
276
280
  } | {
277
- env: string;
278
281
  at: string;
282
+ env: string;
279
283
  kind: "restore";
280
284
  appId: string;
281
285
  }) => Promise<import("@fabrika/control-contract").DataOperationDto>;
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { type PhaseId } from './phases';
3
+ export declare const APPROVALS_FILE = "approvals.json";
4
+ declare const approvalSchema: z.ZodObject<{
5
+ at: z.ZodString;
6
+ /** Repository-relative path → sha256 of its content, for every file the phase reads or produces (`phaseInputs`). */
7
+ inputs: z.ZodRecord<z.ZodString, z.ZodString>;
8
+ /** `advance --force`: the gate was waived, not reviewed. */
9
+ waived: z.ZodOptional<z.ZodBoolean>;
10
+ /** The gate revision whose review `advance` approved; absent when waived or recorded before revisions were kept. */
11
+ revision: z.ZodOptional<z.ZodNumber>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ at: string;
14
+ inputs: Record<string, string>;
15
+ waived?: boolean | undefined;
16
+ revision?: number | undefined;
17
+ }, {
18
+ at: string;
19
+ inputs: Record<string, string>;
20
+ waived?: boolean | undefined;
21
+ revision?: number | undefined;
22
+ }>;
23
+ export type PhaseApproval = z.infer<typeof approvalSchema>;
24
+ export type Approvals = Partial<Record<PhaseId, PhaseApproval>>;
25
+ /** A file that does not parse is refused, never read as empty: that would re-open every phase, and the next write would drop its records. */
26
+ export declare class InvalidApprovalsError extends Error {
27
+ constructor();
28
+ }
29
+ /** Null for a project initialized before approvals existed: its gates are judged by the daemon's reviews alone, and refused without it, until the CLI writes the file. */
30
+ export declare function readApprovals(repoRoot: string): Approvals | null;
31
+ export declare function writeApprovals(repoRoot: string, approvals: Approvals): void;
32
+ export {};
@@ -0,0 +1,41 @@
1
+ import { type Approvals } from './approvals';
2
+ import type { GateVerdict } from './gate';
3
+ import { type Phase, type PhaseId } from './phases';
4
+ export interface PhaseState {
5
+ current: PhaseId;
6
+ index: number;
7
+ completed: PhaseId[];
8
+ reads: string[];
9
+ produces: string[];
10
+ gate: boolean;
11
+ satisfied: boolean;
12
+ /** The verdict of each completed gated phase whose review is known. */
13
+ verdicts: Partial<Record<PhaseId, GateVerdict>>;
14
+ /** Gated phases `advance` approved whose review could not be checked (no daemon); they are assumed reviewed. */
15
+ unverified: PhaseId[];
16
+ /** The files that changed since the current phase was approved; empty unless it was approved and went stale. */
17
+ stale: string[];
18
+ }
19
+ /** A gate's review: `reviewed` once its latest revision's feedback was consumed by `advance`. */
20
+ export interface GateReview {
21
+ reviewed: boolean;
22
+ verdict: GateVerdict;
23
+ /** The gate's latest revision; null before it was ever opened. */
24
+ revision: number | null;
25
+ }
26
+ export type GateProbe = (phase: Phase) => GateReview | 'unknown';
27
+ /** Without the daemon no review can be checked; the derivation then says so instead of guessing. */
28
+ export declare const offlineGateProbe: GateProbe;
29
+ export declare function matchGlob(repoRoot: string, glob: string): string[];
30
+ export declare function isNonEmptyFile(p: string): boolean;
31
+ export declare function producesSatisfied(repoRoot: string, phase: Phase): boolean;
32
+ export declare function resolveReads(repoRoot: string, phase: Phase): string[];
33
+ /** The content of every file the phase reads or produces now, by repository-relative path. */
34
+ export declare function phaseInputs(repoRoot: string, phase: Phase): Record<string, string>;
35
+ /** The inputs added, removed or changed since the approval, sorted. */
36
+ export declare function changedInputs(approved: Readonly<Record<string, string>>, now: Readonly<Record<string, string>>): string[];
37
+ /**
38
+ * A gated phase is complete when its outputs exist, its latest gate revision was reviewed, and — once the project keeps
39
+ * approvals — `advance` approved it over the inputs it reads now. The earliest phase whose inputs changed is current again.
40
+ */
41
+ export declare function derivePhase(repoRoot: string, gateProbe?: GateProbe, approvals?: Approvals | null): PhaseState;
@@ -0,0 +1,11 @@
1
+ /** The id of the verdict question every gate view ends with, and its two answers. */
2
+ export declare const GATE_VERDICT_ID = "verdict";
3
+ export declare const GATE_APPROVE = "Approve";
4
+ export declare const GATE_CHANGES = "Request changes";
5
+ /** `none` is a submission whose verdict question was left unanswered (or a view without one). */
6
+ export type GateVerdict = 'approve' | 'changes' | 'none';
7
+ export interface GateAnswer {
8
+ id: string;
9
+ value: string | string[] | number;
10
+ }
11
+ export declare function gateVerdict(answers: readonly GateAnswer[]): GateVerdict;