@cleocode/contracts 2026.4.69 → 2026.4.70
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/dist/__tests__/acceptance-gate.test.d.ts +14 -0
- package/dist/__tests__/acceptance-gate.test.d.ts.map +1 -0
- package/dist/__tests__/acceptance-gate.test.js +642 -0
- package/dist/__tests__/acceptance-gate.test.js.map +1 -0
- package/dist/__tests__/attachment.test.d.ts +17 -0
- package/dist/__tests__/attachment.test.d.ts.map +1 -0
- package/dist/__tests__/attachment.test.js +505 -0
- package/dist/__tests__/attachment.test.js.map +1 -0
- package/dist/acceptance-gate-schema.d.ts +624 -0
- package/dist/acceptance-gate-schema.d.ts.map +1 -0
- package/dist/acceptance-gate-schema.js +244 -0
- package/dist/acceptance-gate-schema.js.map +1 -0
- package/dist/acceptance-gate.d.ts +253 -0
- package/dist/acceptance-gate.d.ts.map +1 -0
- package/dist/acceptance-gate.js +22 -0
- package/dist/acceptance-gate.js.map +1 -0
- package/dist/attachment-schema.d.ts +243 -0
- package/dist/attachment-schema.d.ts.map +1 -0
- package/dist/attachment-schema.js +200 -0
- package/dist/attachment-schema.js.map +1 -0
- package/dist/attachment.d.ts +224 -0
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +21 -0
- package/dist/attachment.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/task.d.ts +23 -4
- package/dist/task.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/acceptance-gate.test.ts +736 -0
- package/src/__tests__/attachment.test.ts +601 -0
- package/src/acceptance-gate-schema.ts +283 -0
- package/src/acceptance-gate.ts +264 -0
- package/src/attachment-schema.ts +223 -0
- package/src/attachment.ts +245 -0
- package/src/index.ts +49 -0
- package/src/task.ts +24 -4
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod validation schemas for {@link AcceptanceGate} and related types.
|
|
3
|
+
*
|
|
4
|
+
* Kept in a separate file from the plain TypeScript types so that consumers
|
|
5
|
+
* that do not need runtime validation (e.g. type-only imports) pay zero cost.
|
|
6
|
+
*
|
|
7
|
+
* All schemas are named `*Schema` and derive their inferred types from the
|
|
8
|
+
* canonical TypeScript interfaces in `./acceptance-gate.ts`.
|
|
9
|
+
*
|
|
10
|
+
* @epic T760
|
|
11
|
+
* @task T763
|
|
12
|
+
* @task T779
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
/**
|
|
16
|
+
* Zod schema for {@link GateBase} — fields every gate variant carries.
|
|
17
|
+
*
|
|
18
|
+
* Not exported as a standalone validator because it is always composed into a
|
|
19
|
+
* full gate schema via `z.discriminatedUnion`. Exported so downstream packages
|
|
20
|
+
* can extend it (e.g. for migration or testing).
|
|
21
|
+
*/
|
|
22
|
+
export declare const gateBaseSchema: z.ZodObject<{
|
|
23
|
+
req: z.ZodOptional<z.ZodString>;
|
|
24
|
+
description: z.ZodString;
|
|
25
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
/**
|
|
29
|
+
* Zod schema for {@link FileAssertion}.
|
|
30
|
+
*
|
|
31
|
+
* Each variant carries a `type` literal that drives the discriminated union.
|
|
32
|
+
*/
|
|
33
|
+
export declare const fileAssertionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"exists">;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"absent">;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
type: z.ZodLiteral<"nonEmpty">;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"maxBytes">;
|
|
41
|
+
value: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"minBytes">;
|
|
44
|
+
value: z.ZodNumber;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"contains">;
|
|
47
|
+
value: z.ZodString;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"matches">;
|
|
50
|
+
regex: z.ZodString;
|
|
51
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"sha256">;
|
|
54
|
+
value: z.ZodString;
|
|
55
|
+
}, z.core.$strip>], "type">;
|
|
56
|
+
/** Inferred TypeScript type from {@link fileAssertionSchema}. */
|
|
57
|
+
export type FileAssertionInput = z.input<typeof fileAssertionSchema>;
|
|
58
|
+
/**
|
|
59
|
+
* Zod schema for {@link TestGate}.
|
|
60
|
+
*
|
|
61
|
+
* Validates that `command` is present and `expect` is one of the two allowed
|
|
62
|
+
* literal values.
|
|
63
|
+
*/
|
|
64
|
+
export declare const testGateSchema: z.ZodObject<{
|
|
65
|
+
req: z.ZodOptional<z.ZodString>;
|
|
66
|
+
description: z.ZodString;
|
|
67
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
kind: z.ZodLiteral<"test">;
|
|
70
|
+
command: z.ZodString;
|
|
71
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
+
expect: z.ZodEnum<{
|
|
73
|
+
pass: "pass";
|
|
74
|
+
exit0: "exit0";
|
|
75
|
+
}>;
|
|
76
|
+
minCount: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
78
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
/** Zod schema for {@link FileGate}. */
|
|
81
|
+
export declare const fileGateSchema: z.ZodObject<{
|
|
82
|
+
req: z.ZodOptional<z.ZodString>;
|
|
83
|
+
description: z.ZodString;
|
|
84
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
kind: z.ZodLiteral<"file">;
|
|
87
|
+
path: z.ZodString;
|
|
88
|
+
assertions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"exists">;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
type: z.ZodLiteral<"absent">;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"nonEmpty">;
|
|
94
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"maxBytes">;
|
|
96
|
+
value: z.ZodNumber;
|
|
97
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"minBytes">;
|
|
99
|
+
value: z.ZodNumber;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"contains">;
|
|
102
|
+
value: z.ZodString;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"matches">;
|
|
105
|
+
regex: z.ZodString;
|
|
106
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
+
type: z.ZodLiteral<"sha256">;
|
|
109
|
+
value: z.ZodString;
|
|
110
|
+
}, z.core.$strip>], "type">>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
/** Zod schema for {@link CommandGate}. */
|
|
113
|
+
export declare const commandGateSchema: z.ZodObject<{
|
|
114
|
+
req: z.ZodOptional<z.ZodString>;
|
|
115
|
+
description: z.ZodString;
|
|
116
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
kind: z.ZodLiteral<"command">;
|
|
119
|
+
cmd: z.ZodString;
|
|
120
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
121
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
122
|
+
stdoutMatches: z.ZodOptional<z.ZodString>;
|
|
123
|
+
stderrMatches: z.ZodOptional<z.ZodString>;
|
|
124
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
125
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
/** Zod schema for {@link LintGate}. */
|
|
128
|
+
export declare const lintGateSchema: z.ZodObject<{
|
|
129
|
+
req: z.ZodOptional<z.ZodString>;
|
|
130
|
+
description: z.ZodString;
|
|
131
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
kind: z.ZodLiteral<"lint">;
|
|
134
|
+
tool: z.ZodEnum<{
|
|
135
|
+
biome: "biome";
|
|
136
|
+
eslint: "eslint";
|
|
137
|
+
tsc: "tsc";
|
|
138
|
+
prettier: "prettier";
|
|
139
|
+
rustc: "rustc";
|
|
140
|
+
clippy: "clippy";
|
|
141
|
+
}>;
|
|
142
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
143
|
+
expect: z.ZodEnum<{
|
|
144
|
+
clean: "clean";
|
|
145
|
+
noErrors: "noErrors";
|
|
146
|
+
}>;
|
|
147
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
/** Zod schema for {@link HttpGate}. */
|
|
150
|
+
export declare const httpGateSchema: z.ZodObject<{
|
|
151
|
+
req: z.ZodOptional<z.ZodString>;
|
|
152
|
+
description: z.ZodString;
|
|
153
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
kind: z.ZodLiteral<"http">;
|
|
156
|
+
url: z.ZodString;
|
|
157
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
158
|
+
GET: "GET";
|
|
159
|
+
HEAD: "HEAD";
|
|
160
|
+
POST: "POST";
|
|
161
|
+
PUT: "PUT";
|
|
162
|
+
DELETE: "DELETE";
|
|
163
|
+
}>>;
|
|
164
|
+
status: z.ZodNumber;
|
|
165
|
+
bodyMatches: z.ZodOptional<z.ZodString>;
|
|
166
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
167
|
+
startCommand: z.ZodOptional<z.ZodString>;
|
|
168
|
+
startupDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
/** Zod schema for {@link ManualGate}. */
|
|
171
|
+
export declare const manualGateSchema: z.ZodObject<{
|
|
172
|
+
req: z.ZodOptional<z.ZodString>;
|
|
173
|
+
description: z.ZodString;
|
|
174
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
kind: z.ZodLiteral<"manual">;
|
|
177
|
+
prompt: z.ZodString;
|
|
178
|
+
verdicts: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
179
|
+
pass: "pass";
|
|
180
|
+
fail: "fail";
|
|
181
|
+
warn: "warn";
|
|
182
|
+
}>>>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
/**
|
|
185
|
+
* Zod discriminated-union schema for {@link AcceptanceGate}.
|
|
186
|
+
*
|
|
187
|
+
* Uses `z.discriminatedUnion('kind', [...])` for O(1) variant lookup.
|
|
188
|
+
* Parse with `acceptanceGateSchema.parse(input)` or
|
|
189
|
+
* `acceptanceGateSchema.safeParse(input)`.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* const gate = acceptanceGateSchema.parse({
|
|
194
|
+
* kind: 'test',
|
|
195
|
+
* command: 'pnpm test',
|
|
196
|
+
* expect: 'pass',
|
|
197
|
+
* description: 'Test suite must pass',
|
|
198
|
+
* });
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
export declare const acceptanceGateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
202
|
+
req: z.ZodOptional<z.ZodString>;
|
|
203
|
+
description: z.ZodString;
|
|
204
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
205
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
kind: z.ZodLiteral<"test">;
|
|
207
|
+
command: z.ZodString;
|
|
208
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
209
|
+
expect: z.ZodEnum<{
|
|
210
|
+
pass: "pass";
|
|
211
|
+
exit0: "exit0";
|
|
212
|
+
}>;
|
|
213
|
+
minCount: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
215
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
216
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
217
|
+
req: z.ZodOptional<z.ZodString>;
|
|
218
|
+
description: z.ZodString;
|
|
219
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
kind: z.ZodLiteral<"file">;
|
|
222
|
+
path: z.ZodString;
|
|
223
|
+
assertions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
224
|
+
type: z.ZodLiteral<"exists">;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
type: z.ZodLiteral<"absent">;
|
|
227
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
228
|
+
type: z.ZodLiteral<"nonEmpty">;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
type: z.ZodLiteral<"maxBytes">;
|
|
231
|
+
value: z.ZodNumber;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"minBytes">;
|
|
234
|
+
value: z.ZodNumber;
|
|
235
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
236
|
+
type: z.ZodLiteral<"contains">;
|
|
237
|
+
value: z.ZodString;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
type: z.ZodLiteral<"matches">;
|
|
240
|
+
regex: z.ZodString;
|
|
241
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
242
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
243
|
+
type: z.ZodLiteral<"sha256">;
|
|
244
|
+
value: z.ZodString;
|
|
245
|
+
}, z.core.$strip>], "type">>;
|
|
246
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
247
|
+
req: z.ZodOptional<z.ZodString>;
|
|
248
|
+
description: z.ZodString;
|
|
249
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
251
|
+
kind: z.ZodLiteral<"command">;
|
|
252
|
+
cmd: z.ZodString;
|
|
253
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
254
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
stdoutMatches: z.ZodOptional<z.ZodString>;
|
|
256
|
+
stderrMatches: z.ZodOptional<z.ZodString>;
|
|
257
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
258
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
259
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
260
|
+
req: z.ZodOptional<z.ZodString>;
|
|
261
|
+
description: z.ZodString;
|
|
262
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
264
|
+
kind: z.ZodLiteral<"lint">;
|
|
265
|
+
tool: z.ZodEnum<{
|
|
266
|
+
biome: "biome";
|
|
267
|
+
eslint: "eslint";
|
|
268
|
+
tsc: "tsc";
|
|
269
|
+
prettier: "prettier";
|
|
270
|
+
rustc: "rustc";
|
|
271
|
+
clippy: "clippy";
|
|
272
|
+
}>;
|
|
273
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
274
|
+
expect: z.ZodEnum<{
|
|
275
|
+
clean: "clean";
|
|
276
|
+
noErrors: "noErrors";
|
|
277
|
+
}>;
|
|
278
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
280
|
+
req: z.ZodOptional<z.ZodString>;
|
|
281
|
+
description: z.ZodString;
|
|
282
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
283
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
284
|
+
kind: z.ZodLiteral<"http">;
|
|
285
|
+
url: z.ZodString;
|
|
286
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
287
|
+
GET: "GET";
|
|
288
|
+
HEAD: "HEAD";
|
|
289
|
+
POST: "POST";
|
|
290
|
+
PUT: "PUT";
|
|
291
|
+
DELETE: "DELETE";
|
|
292
|
+
}>>;
|
|
293
|
+
status: z.ZodNumber;
|
|
294
|
+
bodyMatches: z.ZodOptional<z.ZodString>;
|
|
295
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
296
|
+
startCommand: z.ZodOptional<z.ZodString>;
|
|
297
|
+
startupDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
298
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
299
|
+
req: z.ZodOptional<z.ZodString>;
|
|
300
|
+
description: z.ZodString;
|
|
301
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
302
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
303
|
+
kind: z.ZodLiteral<"manual">;
|
|
304
|
+
prompt: z.ZodString;
|
|
305
|
+
verdicts: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
306
|
+
pass: "pass";
|
|
307
|
+
fail: "fail";
|
|
308
|
+
warn: "warn";
|
|
309
|
+
}>>>;
|
|
310
|
+
}, z.core.$strip>], "kind">;
|
|
311
|
+
/** Inferred TypeScript type from {@link acceptanceGateSchema}. */
|
|
312
|
+
export type AcceptanceGateSchemaInput = z.input<typeof acceptanceGateSchema>;
|
|
313
|
+
/**
|
|
314
|
+
* Zod schema for {@link AcceptanceGateResult}.
|
|
315
|
+
*
|
|
316
|
+
* Validates the shape produced by the gate runner and stored in
|
|
317
|
+
* `lifecycle_gate_results`.
|
|
318
|
+
*/
|
|
319
|
+
export declare const acceptanceGateResultSchema: z.ZodObject<{
|
|
320
|
+
index: z.ZodNumber;
|
|
321
|
+
req: z.ZodOptional<z.ZodString>;
|
|
322
|
+
kind: z.ZodEnum<{
|
|
323
|
+
file: "file";
|
|
324
|
+
test: "test";
|
|
325
|
+
command: "command";
|
|
326
|
+
lint: "lint";
|
|
327
|
+
http: "http";
|
|
328
|
+
manual: "manual";
|
|
329
|
+
}>;
|
|
330
|
+
result: z.ZodEnum<{
|
|
331
|
+
error: "error";
|
|
332
|
+
pass: "pass";
|
|
333
|
+
fail: "fail";
|
|
334
|
+
warn: "warn";
|
|
335
|
+
skipped: "skipped";
|
|
336
|
+
}>;
|
|
337
|
+
durationMs: z.ZodNumber;
|
|
338
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
339
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
340
|
+
checkedAt: z.ZodString;
|
|
341
|
+
checkedBy: z.ZodString;
|
|
342
|
+
}, z.core.$strip>;
|
|
343
|
+
/** Inferred TypeScript type from {@link acceptanceGateResultSchema}. */
|
|
344
|
+
export type AcceptanceGateResultInput = z.input<typeof acceptanceGateResultSchema>;
|
|
345
|
+
/**
|
|
346
|
+
* Zod schema for a single acceptance criterion — either a non-empty string
|
|
347
|
+
* (legacy) or a structured {@link AcceptanceGate} (machine-verifiable).
|
|
348
|
+
*
|
|
349
|
+
* **Tightened (T800)**: Rejects empty strings, whitespace-only strings, and
|
|
350
|
+
* any non-gate objects. Clear error messages guide callers toward valid input.
|
|
351
|
+
*
|
|
352
|
+
* Strings are validated with `z.string().trim().min(1)` to eliminate empty
|
|
353
|
+
* and whitespace-only criteria. The gate branch uses the existing discriminated-union
|
|
354
|
+
* schema so all six gate kinds (`test`, `file`, `command`, `lint`, `http`, `manual`)
|
|
355
|
+
* are accepted.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* acceptanceItemSchema.parse('must render in <100ms'); // => 'must render in <100ms'
|
|
360
|
+
* acceptanceItemSchema.parse({ kind: 'test', command: 'pnpm test', expect: 'pass', description: '...' }); // => TestGate
|
|
361
|
+
* acceptanceItemSchema.parse(''); // ERROR: string must be non-empty
|
|
362
|
+
* acceptanceItemSchema.parse({ foo: 'bar' }); // ERROR: invalid gate object
|
|
363
|
+
* ```
|
|
364
|
+
*
|
|
365
|
+
* @epic T760
|
|
366
|
+
* @task T780
|
|
367
|
+
* @task T800
|
|
368
|
+
*/
|
|
369
|
+
export declare const acceptanceItemSchema: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
370
|
+
req: z.ZodOptional<z.ZodString>;
|
|
371
|
+
description: z.ZodString;
|
|
372
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
373
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
374
|
+
kind: z.ZodLiteral<"test">;
|
|
375
|
+
command: z.ZodString;
|
|
376
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
377
|
+
expect: z.ZodEnum<{
|
|
378
|
+
pass: "pass";
|
|
379
|
+
exit0: "exit0";
|
|
380
|
+
}>;
|
|
381
|
+
minCount: z.ZodOptional<z.ZodNumber>;
|
|
382
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
383
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
384
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
385
|
+
req: z.ZodOptional<z.ZodString>;
|
|
386
|
+
description: z.ZodString;
|
|
387
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
388
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
389
|
+
kind: z.ZodLiteral<"file">;
|
|
390
|
+
path: z.ZodString;
|
|
391
|
+
assertions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
392
|
+
type: z.ZodLiteral<"exists">;
|
|
393
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
394
|
+
type: z.ZodLiteral<"absent">;
|
|
395
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
396
|
+
type: z.ZodLiteral<"nonEmpty">;
|
|
397
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
398
|
+
type: z.ZodLiteral<"maxBytes">;
|
|
399
|
+
value: z.ZodNumber;
|
|
400
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
401
|
+
type: z.ZodLiteral<"minBytes">;
|
|
402
|
+
value: z.ZodNumber;
|
|
403
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
404
|
+
type: z.ZodLiteral<"contains">;
|
|
405
|
+
value: z.ZodString;
|
|
406
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
407
|
+
type: z.ZodLiteral<"matches">;
|
|
408
|
+
regex: z.ZodString;
|
|
409
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
410
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
411
|
+
type: z.ZodLiteral<"sha256">;
|
|
412
|
+
value: z.ZodString;
|
|
413
|
+
}, z.core.$strip>], "type">>;
|
|
414
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
415
|
+
req: z.ZodOptional<z.ZodString>;
|
|
416
|
+
description: z.ZodString;
|
|
417
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
418
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
419
|
+
kind: z.ZodLiteral<"command">;
|
|
420
|
+
cmd: z.ZodString;
|
|
421
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
422
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
423
|
+
stdoutMatches: z.ZodOptional<z.ZodString>;
|
|
424
|
+
stderrMatches: z.ZodOptional<z.ZodString>;
|
|
425
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
426
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
427
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
428
|
+
req: z.ZodOptional<z.ZodString>;
|
|
429
|
+
description: z.ZodString;
|
|
430
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
431
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
432
|
+
kind: z.ZodLiteral<"lint">;
|
|
433
|
+
tool: z.ZodEnum<{
|
|
434
|
+
biome: "biome";
|
|
435
|
+
eslint: "eslint";
|
|
436
|
+
tsc: "tsc";
|
|
437
|
+
prettier: "prettier";
|
|
438
|
+
rustc: "rustc";
|
|
439
|
+
clippy: "clippy";
|
|
440
|
+
}>;
|
|
441
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
442
|
+
expect: z.ZodEnum<{
|
|
443
|
+
clean: "clean";
|
|
444
|
+
noErrors: "noErrors";
|
|
445
|
+
}>;
|
|
446
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
447
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
448
|
+
req: z.ZodOptional<z.ZodString>;
|
|
449
|
+
description: z.ZodString;
|
|
450
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
451
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
452
|
+
kind: z.ZodLiteral<"http">;
|
|
453
|
+
url: z.ZodString;
|
|
454
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
455
|
+
GET: "GET";
|
|
456
|
+
HEAD: "HEAD";
|
|
457
|
+
POST: "POST";
|
|
458
|
+
PUT: "PUT";
|
|
459
|
+
DELETE: "DELETE";
|
|
460
|
+
}>>;
|
|
461
|
+
status: z.ZodNumber;
|
|
462
|
+
bodyMatches: z.ZodOptional<z.ZodString>;
|
|
463
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
464
|
+
startCommand: z.ZodOptional<z.ZodString>;
|
|
465
|
+
startupDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
466
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
467
|
+
req: z.ZodOptional<z.ZodString>;
|
|
468
|
+
description: z.ZodString;
|
|
469
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
470
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
471
|
+
kind: z.ZodLiteral<"manual">;
|
|
472
|
+
prompt: z.ZodString;
|
|
473
|
+
verdicts: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
474
|
+
pass: "pass";
|
|
475
|
+
fail: "fail";
|
|
476
|
+
warn: "warn";
|
|
477
|
+
}>>>;
|
|
478
|
+
}, z.core.$strip>], "kind">]>;
|
|
479
|
+
/** Inferred TypeScript type from {@link acceptanceItemSchema}. */
|
|
480
|
+
export type AcceptanceItemInput = z.input<typeof acceptanceItemSchema>;
|
|
481
|
+
/**
|
|
482
|
+
* Zod schema for a mixed acceptance array — `(string | AcceptanceGate)[]`.
|
|
483
|
+
*
|
|
484
|
+
* **Tightened (T800)**:
|
|
485
|
+
* - Requires at least 1 item (matching CLEO's anti-hallucination policy).
|
|
486
|
+
* - Rejects duplicate `req:` GSD-style REQ-IDs within the same array.
|
|
487
|
+
*
|
|
488
|
+
* Use this to validate the full `Task.acceptance` field after widening (T780).
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```ts
|
|
492
|
+
* // Valid: mixed types with unique req IDs
|
|
493
|
+
* acceptanceArraySchema.parse([
|
|
494
|
+
* 'must render in <100ms',
|
|
495
|
+
* { kind: 'test', command: 'pnpm test', expect: 'pass', description: 'Tests pass', req: 'TEST-01' }
|
|
496
|
+
* ]);
|
|
497
|
+
*
|
|
498
|
+
* // ERROR: empty array
|
|
499
|
+
* acceptanceArraySchema.parse([]);
|
|
500
|
+
*
|
|
501
|
+
* // ERROR: duplicate req:'TEST-01' across two gates
|
|
502
|
+
* acceptanceArraySchema.parse([
|
|
503
|
+
* { kind: 'test', command: 'pnpm test', expect: 'pass', description: 'Tests pass', req: 'TEST-01' },
|
|
504
|
+
* { kind: 'file', path: 'README.md', assertions: [{ type: 'exists' }], description: 'README exists', req: 'TEST-01' }
|
|
505
|
+
* ]);
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* @epic T760
|
|
509
|
+
* @task T780
|
|
510
|
+
* @task T800
|
|
511
|
+
*/
|
|
512
|
+
export declare const acceptanceArraySchema: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
513
|
+
req: z.ZodOptional<z.ZodString>;
|
|
514
|
+
description: z.ZodString;
|
|
515
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
516
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
517
|
+
kind: z.ZodLiteral<"test">;
|
|
518
|
+
command: z.ZodString;
|
|
519
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
520
|
+
expect: z.ZodEnum<{
|
|
521
|
+
pass: "pass";
|
|
522
|
+
exit0: "exit0";
|
|
523
|
+
}>;
|
|
524
|
+
minCount: z.ZodOptional<z.ZodNumber>;
|
|
525
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
526
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
527
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
528
|
+
req: z.ZodOptional<z.ZodString>;
|
|
529
|
+
description: z.ZodString;
|
|
530
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
531
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
532
|
+
kind: z.ZodLiteral<"file">;
|
|
533
|
+
path: z.ZodString;
|
|
534
|
+
assertions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
535
|
+
type: z.ZodLiteral<"exists">;
|
|
536
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
537
|
+
type: z.ZodLiteral<"absent">;
|
|
538
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
539
|
+
type: z.ZodLiteral<"nonEmpty">;
|
|
540
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
541
|
+
type: z.ZodLiteral<"maxBytes">;
|
|
542
|
+
value: z.ZodNumber;
|
|
543
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
544
|
+
type: z.ZodLiteral<"minBytes">;
|
|
545
|
+
value: z.ZodNumber;
|
|
546
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
547
|
+
type: z.ZodLiteral<"contains">;
|
|
548
|
+
value: z.ZodString;
|
|
549
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
550
|
+
type: z.ZodLiteral<"matches">;
|
|
551
|
+
regex: z.ZodString;
|
|
552
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
553
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
554
|
+
type: z.ZodLiteral<"sha256">;
|
|
555
|
+
value: z.ZodString;
|
|
556
|
+
}, z.core.$strip>], "type">>;
|
|
557
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
558
|
+
req: z.ZodOptional<z.ZodString>;
|
|
559
|
+
description: z.ZodString;
|
|
560
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
561
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
562
|
+
kind: z.ZodLiteral<"command">;
|
|
563
|
+
cmd: z.ZodString;
|
|
564
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
565
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
566
|
+
stdoutMatches: z.ZodOptional<z.ZodString>;
|
|
567
|
+
stderrMatches: z.ZodOptional<z.ZodString>;
|
|
568
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
569
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
570
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
571
|
+
req: z.ZodOptional<z.ZodString>;
|
|
572
|
+
description: z.ZodString;
|
|
573
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
574
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
575
|
+
kind: z.ZodLiteral<"lint">;
|
|
576
|
+
tool: z.ZodEnum<{
|
|
577
|
+
biome: "biome";
|
|
578
|
+
eslint: "eslint";
|
|
579
|
+
tsc: "tsc";
|
|
580
|
+
prettier: "prettier";
|
|
581
|
+
rustc: "rustc";
|
|
582
|
+
clippy: "clippy";
|
|
583
|
+
}>;
|
|
584
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
585
|
+
expect: z.ZodEnum<{
|
|
586
|
+
clean: "clean";
|
|
587
|
+
noErrors: "noErrors";
|
|
588
|
+
}>;
|
|
589
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
590
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
591
|
+
req: z.ZodOptional<z.ZodString>;
|
|
592
|
+
description: z.ZodString;
|
|
593
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
594
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
595
|
+
kind: z.ZodLiteral<"http">;
|
|
596
|
+
url: z.ZodString;
|
|
597
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
598
|
+
GET: "GET";
|
|
599
|
+
HEAD: "HEAD";
|
|
600
|
+
POST: "POST";
|
|
601
|
+
PUT: "PUT";
|
|
602
|
+
DELETE: "DELETE";
|
|
603
|
+
}>>;
|
|
604
|
+
status: z.ZodNumber;
|
|
605
|
+
bodyMatches: z.ZodOptional<z.ZodString>;
|
|
606
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
607
|
+
startCommand: z.ZodOptional<z.ZodString>;
|
|
608
|
+
startupDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
609
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
610
|
+
req: z.ZodOptional<z.ZodString>;
|
|
611
|
+
description: z.ZodString;
|
|
612
|
+
advisory: z.ZodOptional<z.ZodBoolean>;
|
|
613
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
614
|
+
kind: z.ZodLiteral<"manual">;
|
|
615
|
+
prompt: z.ZodString;
|
|
616
|
+
verdicts: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
617
|
+
pass: "pass";
|
|
618
|
+
fail: "fail";
|
|
619
|
+
warn: "warn";
|
|
620
|
+
}>>>;
|
|
621
|
+
}, z.core.$strip>], "kind">]>>;
|
|
622
|
+
/** Inferred TypeScript type from {@link acceptanceArraySchema}. */
|
|
623
|
+
export type AcceptanceArrayInput = z.input<typeof acceptanceArraySchema>;
|
|
624
|
+
//# sourceMappingURL=acceptance-gate-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acceptance-gate-schema.d.ts","sourceRoot":"","sources":["../src/acceptance-gate-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;iBASzB,CAAC;AAIH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;2BAe9B,CAAC;AAEH,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIrE;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;iBAQzB,CAAC;AAEH,uCAAuC;AACvC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIzB,CAAC;AAEH,0CAA0C;AAC1C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBAS5B,CAAC;AAEH,uCAAuC;AACvC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;iBAMzB,CAAC;AAEH,uCAAuC;AACvC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;iBASzB,CAAC;AAEH,yCAAyC;AACzC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAI3B,CAAC;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAO/B,CAAC;AAEH,kEAAkE;AAClE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAI7E;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;iBAWrC,CAAC;AAEH,wEAAwE;AACxE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAInF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAU/B,CAAC;AAEH,kEAAkE;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAwB/B,CAAC;AAEJ,mEAAmE;AACnE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|