forgium 0.1.0

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 (36) hide show
  1. package/README.md +300 -0
  2. package/dist/cli/index.d.ts +2 -0
  3. package/dist/cli/index.js +404 -0
  4. package/dist/core/domain/types.d.ts +190 -0
  5. package/dist/core/domain/types.js +1 -0
  6. package/dist/core/errors/forgium-errors.d.ts +53 -0
  7. package/dist/core/errors/forgium-errors.js +58 -0
  8. package/dist/core/execution/execution-adapter.d.ts +35 -0
  9. package/dist/core/execution/execution-adapter.js +25 -0
  10. package/dist/core/execution/pi-rpc-execution-adapter.d.ts +13 -0
  11. package/dist/core/execution/pi-rpc-execution-adapter.js +119 -0
  12. package/dist/core/execution/spec-flow-execution-adapter.d.ts +14 -0
  13. package/dist/core/execution/spec-flow-execution-adapter.js +233 -0
  14. package/dist/core/index.d.ts +11 -0
  15. package/dist/core/index.js +11 -0
  16. package/dist/core/repository/filesystem-forgium-repository.d.ts +68 -0
  17. package/dist/core/repository/filesystem-forgium-repository.js +656 -0
  18. package/dist/core/repository/paths.d.ts +10 -0
  19. package/dist/core/repository/paths.js +14 -0
  20. package/dist/core/repository/repo-discovery.d.ts +1 -0
  21. package/dist/core/repository/repo-discovery.js +17 -0
  22. package/dist/core/schemas/draft.schema.d.ts +44 -0
  23. package/dist/core/schemas/draft.schema.js +11 -0
  24. package/dist/core/schemas/inbox.schema.d.ts +23 -0
  25. package/dist/core/schemas/inbox.schema.js +9 -0
  26. package/dist/core/schemas/manifest.schema.d.ts +116 -0
  27. package/dist/core/schemas/manifest.schema.js +20 -0
  28. package/dist/core/schemas/receipt.schema.d.ts +355 -0
  29. package/dist/core/schemas/receipt.schema.js +54 -0
  30. package/dist/core/services/id.d.ts +4 -0
  31. package/dist/core/services/id.js +9 -0
  32. package/dist/core/services/spec-flow-commands.d.ts +6 -0
  33. package/dist/core/services/spec-flow-commands.js +7 -0
  34. package/dist/core/transitions/transition-rules.d.ts +3 -0
  35. package/dist/core/transitions/transition-rules.js +10 -0
  36. package/package.json +34 -0
@@ -0,0 +1 @@
1
+ export declare function findRepositoryRoot(start?: string): Promise<string>;
@@ -0,0 +1,17 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { ForgiumRepositoryNotFoundError } from "../errors/forgium-errors.js";
4
+ export async function findRepositoryRoot(start = process.cwd()) {
5
+ let current = path.resolve(start);
6
+ while (true) {
7
+ try {
8
+ if ((await fs.stat(path.join(current, ".git"))).isDirectory())
9
+ return current;
10
+ }
11
+ catch { }
12
+ const parent = path.dirname(current);
13
+ if (parent === current)
14
+ throw new ForgiumRepositoryNotFoundError();
15
+ current = parent;
16
+ }
17
+ }
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ export declare const DraftSchema: z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<1>;
4
+ id: z.ZodString;
5
+ created: z.ZodString;
6
+ source: z.ZodObject<{
7
+ type: z.ZodString;
8
+ ref: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ type: string;
11
+ ref: string;
12
+ }, {
13
+ type: string;
14
+ ref: string;
15
+ }>;
16
+ title: z.ZodString;
17
+ goal: z.ZodString;
18
+ acceptance: z.ZodArray<z.ZodString, "many">;
19
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ schemaVersion: 1;
22
+ id: string;
23
+ created: string;
24
+ source: {
25
+ type: string;
26
+ ref: string;
27
+ };
28
+ title: string;
29
+ goal: string;
30
+ acceptance: string[];
31
+ constraints?: string[] | undefined;
32
+ }, {
33
+ schemaVersion: 1;
34
+ id: string;
35
+ created: string;
36
+ source: {
37
+ type: string;
38
+ ref: string;
39
+ };
40
+ title: string;
41
+ goal: string;
42
+ acceptance: string[];
43
+ constraints?: string[] | undefined;
44
+ }>;
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ export const DraftSchema = z.object({
3
+ schemaVersion: z.literal(1),
4
+ id: z.string().min(1).regex(/^draft-[a-z0-9][a-z0-9-]*$/),
5
+ created: z.string().datetime({ offset: true }),
6
+ source: z.object({ type: z.string().min(1), ref: z.string().min(1) }),
7
+ title: z.string().min(1),
8
+ goal: z.string(),
9
+ acceptance: z.array(z.string()),
10
+ constraints: z.array(z.string()).optional()
11
+ });
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ export declare const InboxFrontmatterSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ source: z.ZodString;
5
+ created: z.ZodString;
6
+ status: z.ZodEnum<["captured", "drafted", "promoted", "merged", "deferred"]>;
7
+ draftRef: z.ZodOptional<z.ZodString>;
8
+ featureRef: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ status: "captured" | "drafted" | "promoted" | "merged" | "deferred";
11
+ id: string;
12
+ created: string;
13
+ source: string;
14
+ draftRef?: string | undefined;
15
+ featureRef?: string | undefined;
16
+ }, {
17
+ status: "captured" | "drafted" | "promoted" | "merged" | "deferred";
18
+ id: string;
19
+ created: string;
20
+ source: string;
21
+ draftRef?: string | undefined;
22
+ featureRef?: string | undefined;
23
+ }>;
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ export const InboxFrontmatterSchema = z.object({
3
+ id: z.string().min(1).regex(/^inbox-[A-Za-z0-9T:+-]+-[a-z0-9]+$/),
4
+ source: z.string().min(1).regex(/^[a-z0-9][a-z0-9-]*$/),
5
+ created: z.string().datetime({ offset: true }),
6
+ status: z.enum(["captured", "drafted", "promoted", "merged", "deferred"]),
7
+ draftRef: z.string().optional(),
8
+ featureRef: z.string().optional()
9
+ });
@@ -0,0 +1,116 @@
1
+ import { z } from "zod";
2
+ export declare const ManifestSchema: z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<1>;
4
+ id: z.ZodString;
5
+ title: z.ZodString;
6
+ created: z.ZodString;
7
+ source: z.ZodOptional<z.ZodObject<{
8
+ type: z.ZodString;
9
+ ref: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ type: string;
12
+ ref: string;
13
+ }, {
14
+ type: string;
15
+ ref: string;
16
+ }>>;
17
+ goal: z.ZodString;
18
+ acceptance: z.ZodArray<z.ZodString, "many">;
19
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
+ verification: z.ZodOptional<z.ZodObject<{
21
+ commands: z.ZodArray<z.ZodObject<{
22
+ name: z.ZodString;
23
+ run: z.ZodString;
24
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ name: string;
27
+ run: string;
28
+ timeoutMs?: number | undefined;
29
+ }, {
30
+ name: string;
31
+ run: string;
32
+ timeoutMs?: number | undefined;
33
+ }>, "many">;
34
+ requiredEvidence: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ criterion: z.ZodString;
36
+ kind: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ criterion: string;
39
+ kind: string;
40
+ }, {
41
+ criterion: string;
42
+ kind: string;
43
+ }>, "many">>;
44
+ review: z.ZodOptional<z.ZodLiteral<"required">>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ commands: {
47
+ name: string;
48
+ run: string;
49
+ timeoutMs?: number | undefined;
50
+ }[];
51
+ review?: "required" | undefined;
52
+ requiredEvidence?: {
53
+ criterion: string;
54
+ kind: string;
55
+ }[] | undefined;
56
+ }, {
57
+ commands: {
58
+ name: string;
59
+ run: string;
60
+ timeoutMs?: number | undefined;
61
+ }[];
62
+ review?: "required" | undefined;
63
+ requiredEvidence?: {
64
+ criterion: string;
65
+ kind: string;
66
+ }[] | undefined;
67
+ }>>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ schemaVersion: 1;
70
+ id: string;
71
+ created: string;
72
+ title: string;
73
+ goal: string;
74
+ acceptance: string[];
75
+ verification?: {
76
+ commands: {
77
+ name: string;
78
+ run: string;
79
+ timeoutMs?: number | undefined;
80
+ }[];
81
+ review?: "required" | undefined;
82
+ requiredEvidence?: {
83
+ criterion: string;
84
+ kind: string;
85
+ }[] | undefined;
86
+ } | undefined;
87
+ source?: {
88
+ type: string;
89
+ ref: string;
90
+ } | undefined;
91
+ constraints?: string[] | undefined;
92
+ }, {
93
+ schemaVersion: 1;
94
+ id: string;
95
+ created: string;
96
+ title: string;
97
+ goal: string;
98
+ acceptance: string[];
99
+ verification?: {
100
+ commands: {
101
+ name: string;
102
+ run: string;
103
+ timeoutMs?: number | undefined;
104
+ }[];
105
+ review?: "required" | undefined;
106
+ requiredEvidence?: {
107
+ criterion: string;
108
+ kind: string;
109
+ }[] | undefined;
110
+ } | undefined;
111
+ source?: {
112
+ type: string;
113
+ ref: string;
114
+ } | undefined;
115
+ constraints?: string[] | undefined;
116
+ }>;
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ export const ManifestSchema = z.object({
3
+ schemaVersion: z.literal(1),
4
+ id: z.string().min(1).regex(/^feature-[a-z0-9][a-z0-9-]*$/),
5
+ title: z.string().min(1),
6
+ created: z.string().datetime({ offset: true }),
7
+ source: z.object({ type: z.string().min(1), ref: z.string().min(1) }).optional(),
8
+ goal: z.string().min(1),
9
+ acceptance: z.array(z.string().min(1)).min(1),
10
+ constraints: z.array(z.string().min(1)).optional(),
11
+ verification: z.object({
12
+ commands: z.array(z.object({
13
+ name: z.string().min(1),
14
+ run: z.string().min(1),
15
+ timeoutMs: z.number().int().positive().optional()
16
+ })),
17
+ requiredEvidence: z.array(z.object({ criterion: z.string().min(1), kind: z.string().min(1) })).optional(),
18
+ review: z.literal("required").optional()
19
+ }).optional()
20
+ });
@@ -0,0 +1,355 @@
1
+ import { z } from "zod";
2
+ export declare const ReceiptSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<1>;
4
+ id: z.ZodString;
5
+ created: z.ZodString;
6
+ feature: z.ZodObject<{
7
+ id: z.ZodString;
8
+ manifestPath: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ id: string;
11
+ manifestPath: string;
12
+ }, {
13
+ id: string;
14
+ manifestPath: string;
15
+ }>;
16
+ runId: z.ZodString;
17
+ actor: z.ZodObject<{
18
+ type: z.ZodString;
19
+ name: z.ZodString;
20
+ version: z.ZodOptional<z.ZodString>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ type: string;
23
+ name: string;
24
+ version?: string | undefined;
25
+ }, {
26
+ type: string;
27
+ name: string;
28
+ version?: string | undefined;
29
+ }>;
30
+ outcome: z.ZodString;
31
+ summary: z.ZodString;
32
+ } & {
33
+ kind: z.ZodLiteral<"execution">;
34
+ engine: z.ZodOptional<z.ZodString>;
35
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ schemaVersion: 1;
38
+ id: string;
39
+ created: string;
40
+ kind: "execution";
41
+ feature: {
42
+ id: string;
43
+ manifestPath: string;
44
+ };
45
+ runId: string;
46
+ actor: {
47
+ type: string;
48
+ name: string;
49
+ version?: string | undefined;
50
+ };
51
+ outcome: string;
52
+ summary: string;
53
+ engine?: string | undefined;
54
+ artifacts?: string[] | undefined;
55
+ }, {
56
+ schemaVersion: 1;
57
+ id: string;
58
+ created: string;
59
+ kind: "execution";
60
+ feature: {
61
+ id: string;
62
+ manifestPath: string;
63
+ };
64
+ runId: string;
65
+ actor: {
66
+ type: string;
67
+ name: string;
68
+ version?: string | undefined;
69
+ };
70
+ outcome: string;
71
+ summary: string;
72
+ engine?: string | undefined;
73
+ artifacts?: string[] | undefined;
74
+ }>, z.ZodObject<{
75
+ schemaVersion: z.ZodLiteral<1>;
76
+ id: z.ZodString;
77
+ created: z.ZodString;
78
+ feature: z.ZodObject<{
79
+ id: z.ZodString;
80
+ manifestPath: z.ZodString;
81
+ }, "strip", z.ZodTypeAny, {
82
+ id: string;
83
+ manifestPath: string;
84
+ }, {
85
+ id: string;
86
+ manifestPath: string;
87
+ }>;
88
+ runId: z.ZodString;
89
+ actor: z.ZodObject<{
90
+ type: z.ZodString;
91
+ name: z.ZodString;
92
+ version: z.ZodOptional<z.ZodString>;
93
+ }, "strip", z.ZodTypeAny, {
94
+ type: string;
95
+ name: string;
96
+ version?: string | undefined;
97
+ }, {
98
+ type: string;
99
+ name: string;
100
+ version?: string | undefined;
101
+ }>;
102
+ summary: z.ZodString;
103
+ } & {
104
+ kind: z.ZodLiteral<"verification">;
105
+ outcome: z.ZodEnum<["passed", "failed", "manual_required", "not_configured", "cancelled"]>;
106
+ checks: z.ZodArray<z.ZodObject<{
107
+ name: z.ZodString;
108
+ command: z.ZodString;
109
+ cwd: z.ZodString;
110
+ exitCode: z.ZodNullable<z.ZodNumber>;
111
+ durationMs: z.ZodNumber;
112
+ status: z.ZodEnum<["passed", "failed", "cancelled"]>;
113
+ outputSummary: z.ZodString;
114
+ }, "strip", z.ZodTypeAny, {
115
+ status: "passed" | "failed" | "cancelled";
116
+ name: string;
117
+ command: string;
118
+ cwd: string;
119
+ exitCode: number | null;
120
+ durationMs: number;
121
+ outputSummary: string;
122
+ }, {
123
+ status: "passed" | "failed" | "cancelled";
124
+ name: string;
125
+ command: string;
126
+ cwd: string;
127
+ exitCode: number | null;
128
+ durationMs: number;
129
+ outputSummary: string;
130
+ }>, "many">;
131
+ evidence: z.ZodOptional<z.ZodArray<z.ZodObject<{
132
+ criterion: z.ZodString;
133
+ kind: z.ZodString;
134
+ status: z.ZodEnum<["passed", "failed", "pending"]>;
135
+ ref: z.ZodOptional<z.ZodString>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ status: "passed" | "failed" | "pending";
138
+ criterion: string;
139
+ kind: string;
140
+ ref?: string | undefined;
141
+ }, {
142
+ status: "passed" | "failed" | "pending";
143
+ criterion: string;
144
+ kind: string;
145
+ ref?: string | undefined;
146
+ }>, "many">>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ schemaVersion: 1;
149
+ id: string;
150
+ created: string;
151
+ kind: "verification";
152
+ feature: {
153
+ id: string;
154
+ manifestPath: string;
155
+ };
156
+ runId: string;
157
+ actor: {
158
+ type: string;
159
+ name: string;
160
+ version?: string | undefined;
161
+ };
162
+ outcome: "passed" | "failed" | "manual_required" | "not_configured" | "cancelled";
163
+ summary: string;
164
+ checks: {
165
+ status: "passed" | "failed" | "cancelled";
166
+ name: string;
167
+ command: string;
168
+ cwd: string;
169
+ exitCode: number | null;
170
+ durationMs: number;
171
+ outputSummary: string;
172
+ }[];
173
+ evidence?: {
174
+ status: "passed" | "failed" | "pending";
175
+ criterion: string;
176
+ kind: string;
177
+ ref?: string | undefined;
178
+ }[] | undefined;
179
+ }, {
180
+ schemaVersion: 1;
181
+ id: string;
182
+ created: string;
183
+ kind: "verification";
184
+ feature: {
185
+ id: string;
186
+ manifestPath: string;
187
+ };
188
+ runId: string;
189
+ actor: {
190
+ type: string;
191
+ name: string;
192
+ version?: string | undefined;
193
+ };
194
+ outcome: "passed" | "failed" | "manual_required" | "not_configured" | "cancelled";
195
+ summary: string;
196
+ checks: {
197
+ status: "passed" | "failed" | "cancelled";
198
+ name: string;
199
+ command: string;
200
+ cwd: string;
201
+ exitCode: number | null;
202
+ durationMs: number;
203
+ outputSummary: string;
204
+ }[];
205
+ evidence?: {
206
+ status: "passed" | "failed" | "pending";
207
+ criterion: string;
208
+ kind: string;
209
+ ref?: string | undefined;
210
+ }[] | undefined;
211
+ }>, z.ZodObject<{
212
+ schemaVersion: z.ZodLiteral<1>;
213
+ id: z.ZodString;
214
+ created: z.ZodString;
215
+ feature: z.ZodObject<{
216
+ id: z.ZodString;
217
+ manifestPath: z.ZodString;
218
+ }, "strip", z.ZodTypeAny, {
219
+ id: string;
220
+ manifestPath: string;
221
+ }, {
222
+ id: string;
223
+ manifestPath: string;
224
+ }>;
225
+ runId: z.ZodString;
226
+ actor: z.ZodObject<{
227
+ type: z.ZodString;
228
+ name: z.ZodString;
229
+ version: z.ZodOptional<z.ZodString>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ type: string;
232
+ name: string;
233
+ version?: string | undefined;
234
+ }, {
235
+ type: string;
236
+ name: string;
237
+ version?: string | undefined;
238
+ }>;
239
+ summary: z.ZodString;
240
+ } & {
241
+ kind: z.ZodLiteral<"review">;
242
+ outcome: z.ZodEnum<["approved", "changes_requested", "blocked"]>;
243
+ decision: z.ZodEnum<["approved", "changes_requested", "blocked"]>;
244
+ findings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
245
+ }, "strip", z.ZodTypeAny, {
246
+ schemaVersion: 1;
247
+ id: string;
248
+ created: string;
249
+ kind: "review";
250
+ feature: {
251
+ id: string;
252
+ manifestPath: string;
253
+ };
254
+ runId: string;
255
+ actor: {
256
+ type: string;
257
+ name: string;
258
+ version?: string | undefined;
259
+ };
260
+ outcome: "blocked" | "approved" | "changes_requested";
261
+ summary: string;
262
+ decision: "blocked" | "approved" | "changes_requested";
263
+ findings?: string[] | undefined;
264
+ }, {
265
+ schemaVersion: 1;
266
+ id: string;
267
+ created: string;
268
+ kind: "review";
269
+ feature: {
270
+ id: string;
271
+ manifestPath: string;
272
+ };
273
+ runId: string;
274
+ actor: {
275
+ type: string;
276
+ name: string;
277
+ version?: string | undefined;
278
+ };
279
+ outcome: "blocked" | "approved" | "changes_requested";
280
+ summary: string;
281
+ decision: "blocked" | "approved" | "changes_requested";
282
+ findings?: string[] | undefined;
283
+ }>, z.ZodObject<{
284
+ schemaVersion: z.ZodLiteral<1>;
285
+ id: z.ZodString;
286
+ created: z.ZodString;
287
+ feature: z.ZodObject<{
288
+ id: z.ZodString;
289
+ manifestPath: z.ZodString;
290
+ }, "strip", z.ZodTypeAny, {
291
+ id: string;
292
+ manifestPath: string;
293
+ }, {
294
+ id: string;
295
+ manifestPath: string;
296
+ }>;
297
+ runId: z.ZodString;
298
+ actor: z.ZodObject<{
299
+ type: z.ZodString;
300
+ name: z.ZodString;
301
+ version: z.ZodOptional<z.ZodString>;
302
+ }, "strip", z.ZodTypeAny, {
303
+ type: string;
304
+ name: string;
305
+ version?: string | undefined;
306
+ }, {
307
+ type: string;
308
+ name: string;
309
+ version?: string | undefined;
310
+ }>;
311
+ summary: z.ZodString;
312
+ } & {
313
+ kind: z.ZodLiteral<"handoff">;
314
+ outcome: z.ZodEnum<["failed", "blocked", "needs_human", "cancelled"]>;
315
+ reason: z.ZodString;
316
+ relatedReceipt: z.ZodOptional<z.ZodString>;
317
+ }, "strip", z.ZodTypeAny, {
318
+ schemaVersion: 1;
319
+ id: string;
320
+ created: string;
321
+ kind: "handoff";
322
+ feature: {
323
+ id: string;
324
+ manifestPath: string;
325
+ };
326
+ runId: string;
327
+ actor: {
328
+ type: string;
329
+ name: string;
330
+ version?: string | undefined;
331
+ };
332
+ outcome: "blocked" | "failed" | "cancelled" | "needs_human";
333
+ summary: string;
334
+ reason: string;
335
+ relatedReceipt?: string | undefined;
336
+ }, {
337
+ schemaVersion: 1;
338
+ id: string;
339
+ created: string;
340
+ kind: "handoff";
341
+ feature: {
342
+ id: string;
343
+ manifestPath: string;
344
+ };
345
+ runId: string;
346
+ actor: {
347
+ type: string;
348
+ name: string;
349
+ version?: string | undefined;
350
+ };
351
+ outcome: "blocked" | "failed" | "cancelled" | "needs_human";
352
+ summary: string;
353
+ reason: string;
354
+ relatedReceipt?: string | undefined;
355
+ }>]>;
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ const ReceiptBaseSchema = z.object({
3
+ schemaVersion: z.literal(1),
4
+ id: z.string().min(1).regex(/^receipt-[A-Za-z0-9T:+-]+-[a-z0-9]+-[a-z-]+$/),
5
+ kind: z.enum(["execution", "verification", "review", "handoff"]),
6
+ created: z.string().datetime({ offset: true }),
7
+ feature: z.object({ id: z.string().min(1), manifestPath: z.string().min(1) }),
8
+ runId: z.string().min(1),
9
+ actor: z.object({ type: z.string().min(1), name: z.string().min(1), version: z.string().optional() }),
10
+ outcome: z.string().min(1),
11
+ summary: z.string().min(1)
12
+ });
13
+ const VerificationReceiptSchema = ReceiptBaseSchema.extend({
14
+ kind: z.literal("verification"),
15
+ outcome: z.enum(["passed", "failed", "manual_required", "not_configured", "cancelled"]),
16
+ checks: z.array(z.object({
17
+ name: z.string().min(1),
18
+ command: z.string().min(1),
19
+ cwd: z.string().min(1),
20
+ exitCode: z.number().int().nullable(),
21
+ durationMs: z.number().nonnegative(),
22
+ status: z.enum(["passed", "failed", "cancelled"]),
23
+ outputSummary: z.string()
24
+ })),
25
+ evidence: z.array(z.object({
26
+ criterion: z.string().min(1),
27
+ kind: z.string().min(1),
28
+ status: z.enum(["passed", "failed", "pending"]),
29
+ ref: z.string().optional()
30
+ })).optional()
31
+ });
32
+ const ReviewReceiptSchema = ReceiptBaseSchema.extend({
33
+ kind: z.literal("review"),
34
+ outcome: z.enum(["approved", "changes_requested", "blocked"]),
35
+ decision: z.enum(["approved", "changes_requested", "blocked"]),
36
+ findings: z.array(z.string().min(1)).optional()
37
+ });
38
+ const HandoffReceiptSchema = ReceiptBaseSchema.extend({
39
+ kind: z.literal("handoff"),
40
+ outcome: z.enum(["failed", "blocked", "needs_human", "cancelled"]),
41
+ reason: z.string().min(1),
42
+ relatedReceipt: z.string().optional()
43
+ });
44
+ const ExecutionReceiptSchema = ReceiptBaseSchema.extend({
45
+ kind: z.literal("execution"),
46
+ engine: z.string().optional(),
47
+ artifacts: z.array(z.string().min(1)).optional()
48
+ });
49
+ export const ReceiptSchema = z.discriminatedUnion("kind", [
50
+ ExecutionReceiptSchema,
51
+ VerificationReceiptSchema,
52
+ ReviewReceiptSchema,
53
+ HandoffReceiptSchema
54
+ ]);
@@ -0,0 +1,4 @@
1
+ export declare function slugify(value: string): string;
2
+ export declare function shortId(bytes?: number): string;
3
+ export declare function timestampForFile(date?: Date): string;
4
+ export declare function isoNow(): string;
@@ -0,0 +1,9 @@
1
+ import crypto from "node:crypto";
2
+ export function slugify(value) {
3
+ return value.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80) || "feature";
4
+ }
5
+ export function shortId(bytes = 2) { return crypto.randomBytes(bytes).toString("hex"); }
6
+ export function timestampForFile(date = new Date()) {
7
+ return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
8
+ }
9
+ export function isoNow() { return new Date().toISOString(); }
@@ -0,0 +1,6 @@
1
+ export interface SpecFlowCommandHints {
2
+ init: string;
3
+ implement: string;
4
+ next: string;
5
+ }
6
+ export declare function specFlowCommandsForSpec(specPath: string): SpecFlowCommandHints;
@@ -0,0 +1,7 @@
1
+ export function specFlowCommandsForSpec(specPath) {
2
+ return {
3
+ init: `/spec-flow-init ${specPath}`,
4
+ implement: `/spec-flow-implement ${specPath}`,
5
+ next: `/spec-flow-next ${specPath}`
6
+ };
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { FeatureState } from "../domain/types.js";
2
+ export declare const allowedTransitions: Record<FeatureState, FeatureState[]>;
3
+ export declare function canTransition(from: FeatureState, to: FeatureState): boolean;