gateproof 0.2.0 → 0.2.2
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/README.md +53 -1
- package/dist/cli/gateproof.d.ts +3 -0
- package/dist/cli/gateproof.d.ts.map +1 -0
- package/dist/cli/gateproof.js +472 -0
- package/dist/cli/gateproof.js.map +1 -0
- package/dist/prd/types.d.ts +1 -0
- package/dist/prd/types.d.ts.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -28,6 +28,48 @@ gateproof **executes gates**. It does not define intent, plans, or workflows. A
|
|
|
28
28
|
|
|
29
29
|
gateproof never decides *what* to build. It returns results; your CI/CD decides whether you are allowed to proceed.
|
|
30
30
|
|
|
31
|
+
## Agent skill: prdts-maker
|
|
32
|
+
|
|
33
|
+
This repo is agent-first. Use the `prdts-maker` skill to turn a prompt into a working `prd.ts`.
|
|
34
|
+
|
|
35
|
+
**How to use it:**
|
|
36
|
+
- Provide a prompt (big blob of text is fine).
|
|
37
|
+
- Ask the agent to run the `prdts-maker` skill and output a complete `prd.ts`.
|
|
38
|
+
- Save and run: `bun run prd.ts`.
|
|
39
|
+
|
|
40
|
+
**Example prompt:**
|
|
41
|
+
```text
|
|
42
|
+
@prdts-maker Create prd.ts for:
|
|
43
|
+
- User can sign up
|
|
44
|
+
- Email verification works (depends on signup)
|
|
45
|
+
- User can log in (depends on verification)
|
|
46
|
+
Include gate files under ./gates/.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## CLI: npx gateproof prdts
|
|
50
|
+
|
|
51
|
+
Generate a `prd.ts` from a prompt without opening the repo.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
echo "Build a signup flow with email verification and login" | npx gateproof prdts --stdout
|
|
55
|
+
npx gateproof prdts --in stories.txt --out prd.ts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This calls Opencode directly. Set `OPENCODE_ZEN_API_KEY` (or pass `--api-key`).
|
|
59
|
+
|
|
60
|
+
Paste mode (interactive stdin):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx gateproof prdts
|
|
64
|
+
# paste a prompt, then Ctrl-D
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
To target a different Opencode base URL or model:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx gateproof prdts --endpoint https://opencode.ai/zen/v1 --model big-pickle --in stories.txt --out prd.ts
|
|
71
|
+
```
|
|
72
|
+
|
|
31
73
|
## Agent Iterations: The Loop
|
|
32
74
|
|
|
33
75
|
The core innovation: agents work from PRD only, gates verify, iterate until correct.
|
|
@@ -65,6 +107,14 @@ done
|
|
|
65
107
|
|
|
66
108
|
This solves the context management problem: agents don't need full codebase context upfront. They get minimal context (PRD), concrete feedback (gate failures), and iterate until correct.
|
|
67
109
|
|
|
110
|
+
## Anatomy of a prd.ts (1 list)
|
|
111
|
+
|
|
112
|
+
1. **Instructions**: each story title encodes behavior + evidence + scope (the agent's marching orders).
|
|
113
|
+
2. **Stories**: `stories[]` holds `{ id, title, gateFile, dependsOn?, progress? }` in execution order.
|
|
114
|
+
3. **Gates**: `gateFile` points at a gate script that observes logs, acts, and asserts evidence.
|
|
115
|
+
4. **Loop state**: `runPrd(...)` returns success or the `failedStory` plus gate evidence (actions/stages/errors).
|
|
116
|
+
5. **Loop instructions**: on failure, feed the agent `prd.ts` + gate output, fix code, re-run PRD until pass.
|
|
117
|
+
|
|
68
118
|
## Stories as gates
|
|
69
119
|
|
|
70
120
|
A PRD (Product Requirements Document) defines stories. Stories are gates. Each story references a gate file. The gate file verifies the story against reality.
|
|
@@ -83,12 +133,14 @@ export const prd = definePrd({
|
|
|
83
133
|
id: "user-signup",
|
|
84
134
|
title: "User can sign up",
|
|
85
135
|
gateFile: "./gates/user-signup.gate.ts",
|
|
136
|
+
progress: ["signup_page_live", "user_created"],
|
|
86
137
|
},
|
|
87
138
|
{
|
|
88
139
|
id: "email-verification",
|
|
89
140
|
title: "User receives verification email",
|
|
90
141
|
gateFile: "./gates/email-verification.gate.ts",
|
|
91
142
|
dependsOn: ["user-signup"],
|
|
143
|
+
progress: ["email_sent", "verification_link_valid"],
|
|
92
144
|
},
|
|
93
145
|
] as const, // keep story IDs as literal types
|
|
94
146
|
});
|
|
@@ -132,7 +184,7 @@ export async function run() {
|
|
|
132
184
|
}
|
|
133
185
|
```
|
|
134
186
|
|
|
135
|
-
**gateproof does not own your PRD’s intent or state.** If you choose to use `gateproof/prd`, your PRD must match a small capsule shape (`stories[]` with `id/title/gateFile/dependsOn?`). Otherwise, orchestrate gates however you want — gateproof only cares about executing gate files.
|
|
187
|
+
**gateproof does not own your PRD’s intent or state.** If you choose to use `gateproof/prd`, your PRD must match a small capsule shape (`stories[]` with `id/title/gateFile/dependsOn?/progress?`). The optional `progress` list is for your own tracking (or agent guidance); gateproof does not interpret or mutate it. Otherwise, orchestrate gates however you want — gateproof only cares about executing gate files.
|
|
136
188
|
|
|
137
189
|
Stories execute in dependency order. The runner stops on first failure. Progress is not declared. It is proven.
|
|
138
190
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateproof.d.ts","sourceRoot":"","sources":["../../src/cli/gateproof.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
4
|
+
import { stdin, stdout } from "node:process";
|
|
5
|
+
function printHelp() {
|
|
6
|
+
const text = [
|
|
7
|
+
"gateproof",
|
|
8
|
+
"",
|
|
9
|
+
"Subcommands:",
|
|
10
|
+
" prdts Generate a prd.ts from story descriptions",
|
|
11
|
+
"",
|
|
12
|
+
"Usage:",
|
|
13
|
+
" npx gateproof prdts --in stories.txt --out prd.ts",
|
|
14
|
+
" echo \"User can sign up\" | npx gateproof prdts --stdout",
|
|
15
|
+
"",
|
|
16
|
+
"Options (prdts):",
|
|
17
|
+
" -i, --in <path> Input file with one story per line",
|
|
18
|
+
" -o, --out <path> Output file path (default: ./prd.ts)",
|
|
19
|
+
" --stdout Print the generated prd.ts to stdout",
|
|
20
|
+
" --endpoint <url> API base URL (default: https://opencode.ai/zen/v1)",
|
|
21
|
+
" --model <id> Model id (default: big-pickle)",
|
|
22
|
+
" --api-key <key> API key (or set OPENCODE_ZEN_API_KEY)",
|
|
23
|
+
" --overwrite Overwrite output file if it exists",
|
|
24
|
+
" -h, --help Show help",
|
|
25
|
+
].join("\n");
|
|
26
|
+
stdout.write(`${text}\n`);
|
|
27
|
+
}
|
|
28
|
+
function parseArgs(argv) {
|
|
29
|
+
const args = {
|
|
30
|
+
endpoint: "https://opencode.ai/zen/v1",
|
|
31
|
+
model: "big-pickle",
|
|
32
|
+
stdout: false,
|
|
33
|
+
overwrite: false,
|
|
34
|
+
};
|
|
35
|
+
if (argv.length > 0 && !argv[0].startsWith("-")) {
|
|
36
|
+
args.subcommand = argv.shift();
|
|
37
|
+
}
|
|
38
|
+
for (let i = 0; i < argv.length; i++) {
|
|
39
|
+
const arg = argv[i];
|
|
40
|
+
switch (arg) {
|
|
41
|
+
case "--in":
|
|
42
|
+
case "-i":
|
|
43
|
+
args.inputPath = argv[++i];
|
|
44
|
+
break;
|
|
45
|
+
case "--out":
|
|
46
|
+
case "-o":
|
|
47
|
+
args.outputPath = argv[++i];
|
|
48
|
+
break;
|
|
49
|
+
case "--endpoint":
|
|
50
|
+
args.endpoint = argv[++i];
|
|
51
|
+
break;
|
|
52
|
+
case "--model":
|
|
53
|
+
args.model = argv[++i];
|
|
54
|
+
break;
|
|
55
|
+
case "--api-key":
|
|
56
|
+
args.apiKey = argv[++i];
|
|
57
|
+
break;
|
|
58
|
+
case "--stdout":
|
|
59
|
+
args.stdout = true;
|
|
60
|
+
break;
|
|
61
|
+
case "--overwrite":
|
|
62
|
+
args.overwrite = true;
|
|
63
|
+
break;
|
|
64
|
+
case "--help":
|
|
65
|
+
case "-h":
|
|
66
|
+
printHelp();
|
|
67
|
+
process.exit(0);
|
|
68
|
+
default:
|
|
69
|
+
if (arg && arg.startsWith("-")) {
|
|
70
|
+
throw new Error(`Unknown flag: ${arg}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return args;
|
|
75
|
+
}
|
|
76
|
+
async function readStdin() {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
let data = "";
|
|
79
|
+
stdin.setEncoding("utf8");
|
|
80
|
+
stdin.on("data", (chunk) => {
|
|
81
|
+
data += chunk;
|
|
82
|
+
});
|
|
83
|
+
stdin.on("end", () => resolve(data));
|
|
84
|
+
stdin.on("error", reject);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async function getDescriptions(inputPath) {
|
|
88
|
+
if (inputPath) {
|
|
89
|
+
return readFile(inputPath, "utf8");
|
|
90
|
+
}
|
|
91
|
+
if (stdin.isTTY) {
|
|
92
|
+
process.stderr.write("Paste story descriptions, then press Ctrl-D.\n");
|
|
93
|
+
}
|
|
94
|
+
return readStdin();
|
|
95
|
+
}
|
|
96
|
+
function stripCodeFences(text) {
|
|
97
|
+
return text.replace(/```(?:json|ts|typescript)?/g, "").replace(/```/g, "").trim();
|
|
98
|
+
}
|
|
99
|
+
function extractJson(text) {
|
|
100
|
+
const cleaned = stripCodeFences(text);
|
|
101
|
+
try {
|
|
102
|
+
return JSON.parse(cleaned);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// Try to extract the first JSON object or array.
|
|
106
|
+
const objectStart = cleaned.indexOf("{");
|
|
107
|
+
const objectEnd = cleaned.lastIndexOf("}");
|
|
108
|
+
if (objectStart !== -1 && objectEnd !== -1 && objectEnd > objectStart) {
|
|
109
|
+
try {
|
|
110
|
+
return JSON.parse(cleaned.slice(objectStart, objectEnd + 1));
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// continue
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const arrayStart = cleaned.indexOf("[");
|
|
117
|
+
const arrayEnd = cleaned.lastIndexOf("]");
|
|
118
|
+
if (arrayStart !== -1 && arrayEnd !== -1 && arrayEnd > arrayStart) {
|
|
119
|
+
return JSON.parse(cleaned.slice(arrayStart, arrayEnd + 1));
|
|
120
|
+
}
|
|
121
|
+
throw new Error("Model response did not contain valid JSON.");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function normalizePrd(input) {
|
|
125
|
+
if (Array.isArray(input)) {
|
|
126
|
+
return { stories: input };
|
|
127
|
+
}
|
|
128
|
+
if (input && typeof input === "object" && "prd" in input) {
|
|
129
|
+
const prdValue = input.prd;
|
|
130
|
+
if (prdValue && typeof prdValue === "object") {
|
|
131
|
+
return prdValue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!input || typeof input !== "object")
|
|
135
|
+
return input;
|
|
136
|
+
const root = input;
|
|
137
|
+
if (!Array.isArray(root.stories))
|
|
138
|
+
return input;
|
|
139
|
+
const normalizedStories = root.stories.map((story) => {
|
|
140
|
+
if (!story || typeof story !== "object")
|
|
141
|
+
return story;
|
|
142
|
+
const s = story;
|
|
143
|
+
const gateImplementation = s.gateImplementation ?? s.gateImplementationCode ?? s.gateImplementation_code;
|
|
144
|
+
const dependsOn = s.dependsOn ?? s.depends_on;
|
|
145
|
+
return {
|
|
146
|
+
...s,
|
|
147
|
+
gateImplementation,
|
|
148
|
+
dependsOn,
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
return { ...root, stories: normalizedStories };
|
|
152
|
+
}
|
|
153
|
+
function coercePrd(input) {
|
|
154
|
+
const normalized = normalizePrd(input);
|
|
155
|
+
if (!normalized || typeof normalized !== "object") {
|
|
156
|
+
throw new Error("PRD output must be an object.");
|
|
157
|
+
}
|
|
158
|
+
const storiesValue = normalized.stories;
|
|
159
|
+
if (!Array.isArray(storiesValue)) {
|
|
160
|
+
throw new Error("PRD output must include stories[].");
|
|
161
|
+
}
|
|
162
|
+
const stories = storiesValue.map((story, index) => {
|
|
163
|
+
if (!story || typeof story !== "object") {
|
|
164
|
+
throw new Error(`stories[${index}] must be an object.`);
|
|
165
|
+
}
|
|
166
|
+
const s = story;
|
|
167
|
+
const id = s.id;
|
|
168
|
+
const title = s.title;
|
|
169
|
+
const gateImplementation = s.gateImplementation;
|
|
170
|
+
const dependsOn = s.dependsOn;
|
|
171
|
+
if (typeof id !== "string" || id.length === 0) {
|
|
172
|
+
throw new Error(`stories[${index}].id must be a non-empty string.`);
|
|
173
|
+
}
|
|
174
|
+
if (typeof title !== "string" || title.length === 0) {
|
|
175
|
+
throw new Error(`stories[${index}].title must be a non-empty string.`);
|
|
176
|
+
}
|
|
177
|
+
let code;
|
|
178
|
+
if (typeof gateImplementation === "string") {
|
|
179
|
+
code = gateImplementation;
|
|
180
|
+
}
|
|
181
|
+
else if (gateImplementation && typeof gateImplementation === "object") {
|
|
182
|
+
const codeValue = gateImplementation.code;
|
|
183
|
+
if (typeof codeValue === "string")
|
|
184
|
+
code = codeValue;
|
|
185
|
+
}
|
|
186
|
+
if (!code) {
|
|
187
|
+
throw new Error(`stories[${index}].gateImplementation.code must be a string.`);
|
|
188
|
+
}
|
|
189
|
+
let dependsOnArray;
|
|
190
|
+
if (dependsOn !== undefined) {
|
|
191
|
+
if (!Array.isArray(dependsOn)) {
|
|
192
|
+
throw new Error(`stories[${index}].dependsOn must be an array of strings.`);
|
|
193
|
+
}
|
|
194
|
+
for (const dep of dependsOn) {
|
|
195
|
+
if (typeof dep !== "string" || dep.length === 0) {
|
|
196
|
+
throw new Error(`stories[${index}].dependsOn must be an array of strings.`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
dependsOnArray = dependsOn;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
id,
|
|
203
|
+
title,
|
|
204
|
+
gateImplementation: { code },
|
|
205
|
+
...(dependsOnArray ? { dependsOn: dependsOnArray } : {}),
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
return { stories };
|
|
209
|
+
}
|
|
210
|
+
function buildPrompt(promptText) {
|
|
211
|
+
return `Transform the following product prompt into a structured PRD object with inline gate implementations.
|
|
212
|
+
|
|
213
|
+
Prompt:
|
|
214
|
+
${promptText}
|
|
215
|
+
|
|
216
|
+
Requirements:
|
|
217
|
+
1. Generate kebab-case IDs for each story (e.g., "user-signup", "email-verification")
|
|
218
|
+
2. Create clear, descriptive titles
|
|
219
|
+
3. For each story, generate a complete gate implementation in the gateImplementation.code field
|
|
220
|
+
4. Gate implementations should:
|
|
221
|
+
- Use createHttpObserveResource or createEmptyObserveResource for observation
|
|
222
|
+
- Include appropriate Act actions (Act.wait, Act.browser, etc.)
|
|
223
|
+
- Include Assert.custom or Assert.noErrors assertions
|
|
224
|
+
- Be self-contained and runnable
|
|
225
|
+
- Match the story's intent (e.g., if story is about API health, gate should check API endpoint)
|
|
226
|
+
5. Infer dependencies from the prompt (e.g., if a story mentions "depends on signup", add "user-signup" to dependsOn)
|
|
227
|
+
6. If dependencies are mentioned in natural language, map them to the appropriate story IDs
|
|
228
|
+
|
|
229
|
+
For gate implementations, use this EXACT pattern (return the gate spec directly):
|
|
230
|
+
\`\`\`
|
|
231
|
+
import { Gate, Act, Assert, createHttpObserveResource, createEmptyObserveResource } from "gateproof";
|
|
232
|
+
|
|
233
|
+
export function run() {
|
|
234
|
+
return {
|
|
235
|
+
name: "story-id",
|
|
236
|
+
observe: createHttpObserveResource({ url: API_URL + "/endpoint", pollInterval: 500 }),
|
|
237
|
+
act: [Act.wait(500)],
|
|
238
|
+
assert: [
|
|
239
|
+
Assert.custom("check_name", async (logs) => {
|
|
240
|
+
const httpLog = logs.find(l => l.stage === "http");
|
|
241
|
+
return httpLog?.status === "success";
|
|
242
|
+
})
|
|
243
|
+
],
|
|
244
|
+
stop: { idleMs: 1000, maxMs: 10000 }
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
\`\`\`
|
|
248
|
+
|
|
249
|
+
IMPORTANT: The gateImplementation.code field must contain COMPLETE, runnable TypeScript code that:
|
|
250
|
+
- Imports necessary functions from "gateproof"
|
|
251
|
+
- Exports a function called "run" that returns a gate spec object
|
|
252
|
+
- Uses the configuration variables (API_URL, TEST_URL) defined at the top
|
|
253
|
+
- Includes proper assertions that match the story's intent
|
|
254
|
+
|
|
255
|
+
Return ONLY JSON in this shape (no markdown):
|
|
256
|
+
{
|
|
257
|
+
"stories": [
|
|
258
|
+
{
|
|
259
|
+
"id": "story-id",
|
|
260
|
+
"title": "Story title",
|
|
261
|
+
"gateImplementation": { "code": "TypeScript code string" },
|
|
262
|
+
"dependsOn": ["optional-story-id"]
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}`;
|
|
266
|
+
}
|
|
267
|
+
async function requestPrd(endpoint, model, apiKey, descriptions) {
|
|
268
|
+
const response = await fetch(`${endpoint.replace(/\/$/, "")}/chat/completions`, {
|
|
269
|
+
method: "POST",
|
|
270
|
+
headers: {
|
|
271
|
+
"Content-Type": "application/json",
|
|
272
|
+
Authorization: `Bearer ${apiKey}`,
|
|
273
|
+
},
|
|
274
|
+
body: JSON.stringify({
|
|
275
|
+
model,
|
|
276
|
+
temperature: 0.2,
|
|
277
|
+
max_tokens: 3200,
|
|
278
|
+
messages: [
|
|
279
|
+
{
|
|
280
|
+
role: "user",
|
|
281
|
+
content: buildPrompt(descriptions),
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
}),
|
|
285
|
+
});
|
|
286
|
+
if (!response.ok) {
|
|
287
|
+
const text = await response.text();
|
|
288
|
+
throw new Error(`Opencode request failed (${response.status}): ${text}`);
|
|
289
|
+
}
|
|
290
|
+
const data = (await response.json());
|
|
291
|
+
const content = data.choices?.[0]?.message?.content;
|
|
292
|
+
if (!content) {
|
|
293
|
+
throw new Error("Opencode response did not include content.");
|
|
294
|
+
}
|
|
295
|
+
const json = extractJson(content);
|
|
296
|
+
return coercePrd(json);
|
|
297
|
+
}
|
|
298
|
+
function formatPrdFile(prd) {
|
|
299
|
+
const gateMap = prd.stories.map((story) => {
|
|
300
|
+
const functionName = story.id.replace(/-/g, "_");
|
|
301
|
+
let gateCode = story.gateImplementation.code;
|
|
302
|
+
gateCode = gateCode.replace(/export\s+function\s+run\s*\(\)/g, `function ${functionName}Gate()`);
|
|
303
|
+
gateCode = gateCode.replace(/export\s+/g, "");
|
|
304
|
+
if (!gateCode.includes("return {")) {
|
|
305
|
+
gateCode = gateCode.replace(/function\s+\w+Gate\(\)\s*\{/, `function ${functionName}Gate() {\n return`);
|
|
306
|
+
}
|
|
307
|
+
return { story, functionName, gateCode };
|
|
308
|
+
});
|
|
309
|
+
const gateFunctions = gateMap
|
|
310
|
+
.map(({ story, gateCode }) => {
|
|
311
|
+
return `// Gate: ${story.title}
|
|
312
|
+
${gateCode}
|
|
313
|
+
`;
|
|
314
|
+
})
|
|
315
|
+
.join("\n");
|
|
316
|
+
const gateMapObject = gateMap
|
|
317
|
+
.map(({ story, functionName }) => {
|
|
318
|
+
return ` "${story.id}": ${functionName}Gate,`;
|
|
319
|
+
})
|
|
320
|
+
.join("\n");
|
|
321
|
+
return `#!/usr/bin/env bun
|
|
322
|
+
/**
|
|
323
|
+
* gateproof PRD - Single File
|
|
324
|
+
*
|
|
325
|
+
* Complete PRD with inline gate implementations.
|
|
326
|
+
* Add your API keys/config at the top and run: bun run prd.ts
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
// ============================================================================
|
|
330
|
+
// CONFIGURATION
|
|
331
|
+
// ============================================================================
|
|
332
|
+
const API_URL = process.env.API_URL || "https://your-api.com";
|
|
333
|
+
const TEST_URL = process.env.TEST_URL || "http://localhost:3000";
|
|
334
|
+
|
|
335
|
+
// ============================================================================
|
|
336
|
+
// GATE IMPLEMENTATIONS
|
|
337
|
+
// ============================================================================
|
|
338
|
+
|
|
339
|
+
import { Gate, Act, Assert, createHttpObserveResource, createEmptyObserveResource } from "gateproof";
|
|
340
|
+
|
|
341
|
+
${gateFunctions}
|
|
342
|
+
|
|
343
|
+
// ============================================================================
|
|
344
|
+
// PRD DEFINITION & EXECUTION
|
|
345
|
+
// ============================================================================
|
|
346
|
+
|
|
347
|
+
const stories = [
|
|
348
|
+
${prd.stories
|
|
349
|
+
.map((story) => {
|
|
350
|
+
return ` {
|
|
351
|
+
id: "${story.id}",
|
|
352
|
+
title: "${story.title}",${story.dependsOn ? `\n dependsOn: [${story.dependsOn.map((id) => `"${id}"`).join(", ")}],` : ""}
|
|
353
|
+
}`;
|
|
354
|
+
})
|
|
355
|
+
.join(",\n")}
|
|
356
|
+
];
|
|
357
|
+
|
|
358
|
+
const gates: Record<string, () => ReturnType<typeof Gate.run> extends Promise<infer T> ? T : never> = {
|
|
359
|
+
${gateMapObject}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
async function runPrd() {
|
|
363
|
+
const byId = new Map(stories.map((s) => [s.id, s]));
|
|
364
|
+
const executed = new Set<string>();
|
|
365
|
+
const visiting = new Set<string>();
|
|
366
|
+
|
|
367
|
+
function visit(id: string): string[] {
|
|
368
|
+
if (visiting.has(id)) {
|
|
369
|
+
throw new Error(\`Dependency cycle detected: \${id}\`);
|
|
370
|
+
}
|
|
371
|
+
if (executed.has(id)) {
|
|
372
|
+
return [];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
visiting.add(id);
|
|
376
|
+
const story = byId.get(id);
|
|
377
|
+
if (!story) {
|
|
378
|
+
throw new Error(\`Unknown story: \${id}\`);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const order: string[] = [];
|
|
382
|
+
for (const depId of story.dependsOn || []) {
|
|
383
|
+
order.push(...visit(depId));
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
visiting.delete(id);
|
|
387
|
+
executed.add(id);
|
|
388
|
+
order.push(id);
|
|
389
|
+
return order;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const executionOrder = stories.flatMap((s) => visit(s.id));
|
|
393
|
+
const uniqueOrder = Array.from(new Set(executionOrder));
|
|
394
|
+
|
|
395
|
+
for (const storyId of uniqueOrder) {
|
|
396
|
+
const story = byId.get(storyId);
|
|
397
|
+
if (!story) continue;
|
|
398
|
+
|
|
399
|
+
console.log(\`\\n--- \${story.id}: \${story.title}\`);
|
|
400
|
+
const gateFn = gates[storyId];
|
|
401
|
+
if (!gateFn) {
|
|
402
|
+
throw new Error(\`No gate implementation for story: \${storyId}\`);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const gateSpec = gateFn();
|
|
406
|
+
const result = await Gate.run(gateSpec);
|
|
407
|
+
|
|
408
|
+
if (result.status !== "success") {
|
|
409
|
+
console.error(\`\\n❌ PRD failed at: \${story.id} - \${story.title}\`);
|
|
410
|
+
if (result.error) {
|
|
411
|
+
console.error(\`Error: \${result.error.message}\`);
|
|
412
|
+
}
|
|
413
|
+
process.exit(1);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
console.log("\\n✅ All PRD stories passed!");
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (import.meta.main) {
|
|
421
|
+
runPrd().catch((error) => {
|
|
422
|
+
console.error("Fatal error:", error);
|
|
423
|
+
process.exit(1);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
`;
|
|
427
|
+
}
|
|
428
|
+
async function runPrdts(args) {
|
|
429
|
+
const descriptions = (await getDescriptions(args.inputPath)).trim();
|
|
430
|
+
if (!descriptions) {
|
|
431
|
+
throw new Error("No story descriptions found.");
|
|
432
|
+
}
|
|
433
|
+
const apiKey = args.apiKey ?? process.env.OPENCODE_ZEN_API_KEY;
|
|
434
|
+
if (!apiKey) {
|
|
435
|
+
throw new Error("Missing OPENCODE_ZEN_API_KEY. Pass --api-key or set OPENCODE_ZEN_API_KEY.");
|
|
436
|
+
}
|
|
437
|
+
const prd = await requestPrd(args.endpoint, args.model, apiKey, descriptions);
|
|
438
|
+
const prdFile = formatPrdFile(prd);
|
|
439
|
+
if (args.stdout) {
|
|
440
|
+
stdout.write(prdFile);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const outputPath = args.outputPath ?? "prd.ts";
|
|
444
|
+
if (existsSync(outputPath) && !args.overwrite) {
|
|
445
|
+
throw new Error(`Refusing to overwrite ${outputPath}. Use --overwrite to replace it.`);
|
|
446
|
+
}
|
|
447
|
+
await writeFile(outputPath, prdFile, "utf8");
|
|
448
|
+
stdout.write(`✅ Wrote ${outputPath}\n`);
|
|
449
|
+
}
|
|
450
|
+
async function main() {
|
|
451
|
+
try {
|
|
452
|
+
const args = parseArgs(process.argv.slice(2));
|
|
453
|
+
if (!args.subcommand || args.subcommand === "help") {
|
|
454
|
+
printHelp();
|
|
455
|
+
process.exit(0);
|
|
456
|
+
}
|
|
457
|
+
switch (args.subcommand) {
|
|
458
|
+
case "prdts":
|
|
459
|
+
await runPrdts(args);
|
|
460
|
+
break;
|
|
461
|
+
default:
|
|
462
|
+
throw new Error(`Unknown subcommand: ${args.subcommand}`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
catch (error) {
|
|
466
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
467
|
+
stdout.write(`❌ ${message}\n`);
|
|
468
|
+
process.exit(1);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
void main();
|
|
472
|
+
//# sourceMappingURL=gateproof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateproof.js","sourceRoot":"","sources":["../../src/cli/gateproof.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAwB7C,SAAS,SAAS;IAChB,MAAM,IAAI,GAAG;QACX,WAAW;QACX,EAAE;QACF,cAAc;QACd,qDAAqD;QACrD,EAAE;QACF,QAAQ;QACR,q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zC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gateproof",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "E2E testing harness. Observe logs, run actions, assert results.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
"import": "./dist/prd/index.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"gateproof": "./dist/cli/gateproof.js"
|
|
24
|
+
},
|
|
22
25
|
"files": [
|
|
23
26
|
"dist",
|
|
24
27
|
"README.md",
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
"gate:dev": "bun run gate:framework && bun run gate:demo && bun run gate:local",
|
|
43
46
|
"gate:all": "bun run gate:dev && bun run gate:production",
|
|
44
47
|
"demo:gate": "bun run gate:production",
|
|
45
|
-
"prepush": "bun run typecheck && bun run prd:validate && bun test",
|
|
48
|
+
"prepush": "bun run typecheck && bun run prd:validate && bun test && bun run gate:dev",
|
|
46
49
|
"prepublishOnly": "bun run build && bun test"
|
|
47
50
|
},
|
|
48
51
|
"keywords": [
|