@richjava/req0 0.5.0 → 0.7.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.
package/README.md CHANGED
@@ -8,7 +8,9 @@
8
8
 
9
9
  Req0 allows you to keep structured requirement packs in your product git repo. The same pack drives definition, implementation, and proof — not a ticket, a chat, or a separate test script.
10
10
 
11
- A local **cockpit** runs that loop: a coding agent (Cursor or Copilot) interviews you, drafts frozen-grammar `requirement.md`, and later implements — only after you answer, a compiler checks the grammar, and **Jev** (TypeSafe System One) judges Ready. The browser then proves the app against the spec. If proof fails, **Fix from proof** sends that report back so the same agent can repair the implementation — not the spec.
11
+ A local **cockpit** runs that loop: a coding agent (Cursor, Copilot, Claude, or Codex) interviews you, drafts frozen-grammar `requirement.md`, and later implements — only after you answer, a compiler checks the grammar, and **Jev** (TypeSafe System One) judges Ready. The browser then proves the app against the spec. If proof fails, **Fix from proof** sends that report back so the same agent can repair the implementation — not the spec.
12
+
13
+ Implement is optional. On first run pick **I’ll write the code**, or set `"implement": false` in `req0.json` at the product repo root. Req0 then stays on the pack and QA; you implement your own way.
12
14
 
13
15
  Req0 is a CLI plus a thin HTML cockpit, free and open source. It is not a hosted SaaS.
14
16
 
@@ -16,12 +18,6 @@ Req0 is a CLI plus a thin HTML cockpit, free and open source. It is not a hosted
16
18
 
17
19
  Node.js **22.15** or newer.
18
20
 
19
- ```bash
20
- npm install -g @richjava/req0
21
- ```
22
-
23
- Or run without a global install:
24
-
25
21
  ```bash
26
22
  npx @richjava/req0 start
27
23
  ```
@@ -34,7 +30,7 @@ From the **product** repo (the app you are specifying), not from inside this pac
34
30
 
35
31
  ```bash
36
32
  cd /path/to/your-product
37
- req0 start
33
+ npx @richjava/req0 start
38
34
  ```
39
35
 
40
36
  The cockpit opens at `http://127.0.0.1:4370` (or the next free port). From the requirement list, create a pack with a kebab-case id such as `001`. That writes `docs/requirements/<id>/`. On **Define**, describe the requirement and **Start** — the recorded coding agent interviews you (you can skip questions) and drafts frozen-grammar `requirement.md`. Optional PNG/JPG/WebP go in that pack’s `context/` folder. `req0 create` on the CLI still writes the starter template only.
@@ -49,7 +45,7 @@ You can also edit `requirement.md` yourself. Save compiles. Spec Valid means the
49
45
  | `req0 create <id>` | Create a pack folder (kebab-case) |
50
46
  | `req0 compile` | Compile the pack; exit 2 on grammar errors |
51
47
  | `req0 check` | Ask Jev to judge the spec. Needs `TYPESAFE_API_KEY`. Exit 3 if the key is missing; exit 2 if Ready is blocked |
52
- | `req0 implement` | Launch the recorded coding agent after Ready. `--adapter=cursor\|copilot\|manual`. `--stack=nextjs-default\|amplify-gen2` on an empty repo |
48
+ | `req0 implement` | Launch the recorded coding agent after Ready. `--adapter=cursor\|copilot\|claude\|codex\|manual`. `--stack=nextjs-default\|amplify-gen2` on an empty repo |
53
49
  | `req0 prove` | Run compiled browser QA after Ready (and Build, unless Implement is off) |
54
50
 
55
51
  `req0 compile`, `check`, `implement`, and `prove` resolve a pack from the current directory (a pack folder, or the only pack under `docs/requirements/`). The cockpit does not auto-open a pack from the product root — you pick one from the list.
@@ -69,7 +65,7 @@ docs/requirements/invoice-approval/
69
65
  derived/ # generated; do not hand-edit
70
66
  ```
71
67
 
72
- First run in an empty product repo asks how code should be written (**I’ll write the code**, **Cursor**, or **Copilot**) and, if an agent will implement, which stack. That writes `req0.json`. Set `"implement": false` when Req0 should not own Implement.
68
+ First run asks how code should be written (**I’ll write the code**, **Cursor**, **Copilot**, **Claude**, or **Codex**) and, if an agent will implement, which stack. That writes `req0.json` at the product repo root. Edit that file later: `"implement": false` turns Implement off (same as **I’ll write the code**); `"adapter": "cursor"` (or `copilot`, `claude`, `codex`) records which CLI to launch.
73
69
 
74
70
  Copy names-only env vars into `.env` as needed. Do not put secrets in `.env.example`.
75
71
 
@@ -88,7 +84,7 @@ npx playwright install chromium
88
84
 
89
85
  ### Implement
90
86
 
91
- Install the agent CLI you recorded: [Cursor](https://cursor.com) agent, or GitHub Copilot CLI. `--adapter=manual` skips launch.
87
+ Install the agent CLI you recorded: [Cursor](https://cursor.com) agent, [GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli), [Claude Code](https://code.claude.com/docs/en/cli), or [Codex CLI](https://developers.openai.com/codex/cli/reference). `--adapter=manual` skips launch. Codex runs `codex exec --json --sandbox workspace-write` (not `--full-auto` or `--yolo`). `npm` / `ampx` that need network beyond the workspace may fail until you widen that sandbox.
92
88
 
93
89
  ## Grammar (short)
94
90
 
package/cockpit/app.js CHANGED
@@ -70,6 +70,8 @@ const els = {
70
70
  codingManual: document.getElementById("coding-manual"),
71
71
  codingCursor: document.getElementById("coding-cursor"),
72
72
  codingCopilot: document.getElementById("coding-copilot"),
73
+ codingClaude: document.getElementById("coding-claude"),
74
+ codingCodex: document.getElementById("coding-codex"),
73
75
  cockpitApp: document.getElementById("cockpit-app"),
74
76
  workspace: document.getElementById("view-define"),
75
77
  workspaceLabel: document.getElementById("workspace-label"),
@@ -196,12 +198,16 @@ let pendingCoding = null;
196
198
  function recordedAdapter() {
197
199
  const repo = state?.productRepo;
198
200
  if (!repo?.implement) return "manual";
199
- if (repo.adapter === "copilot" || repo.adapter === "manual") return repo.adapter;
201
+ if (repo.adapter === "copilot" || repo.adapter === "claude" || repo.adapter === "codex" || repo.adapter === "manual") {
202
+ return repo.adapter;
203
+ }
200
204
  return "cursor";
201
205
  }
202
206
 
203
207
  function adapterLabel(id) {
204
208
  if (id === "copilot") return "Copilot";
209
+ if (id === "claude") return "Claude";
210
+ if (id === "codex") return "Codex";
205
211
  if (id === "manual") return "Manual";
206
212
  return "Cursor";
207
213
  }
@@ -220,7 +226,7 @@ function renderSetupGate(snapshot) {
220
226
  const showStack = needStack && (!needCoding || Boolean(pendingCoding));
221
227
  els.codingSection?.classList.toggle("hidden", !needCoding);
222
228
  els.stackSection?.classList.toggle("hidden", !showStack);
223
- for (const btn of [els.codingManual, els.codingCursor, els.codingCopilot]) {
229
+ for (const btn of [els.codingManual, els.codingCursor, els.codingCopilot, els.codingClaude, els.codingCodex]) {
224
230
  if (!btn) continue;
225
231
  btn.classList.toggle("is-selected", btn.dataset.coding === pendingCoding);
226
232
  btn.disabled = false;
@@ -2262,6 +2268,8 @@ async function recordStack(id) {
2262
2268
  els.codingManual?.addEventListener("click", () => void onCodingChoice("manual"));
2263
2269
  els.codingCursor?.addEventListener("click", () => void onCodingChoice("cursor"));
2264
2270
  els.codingCopilot?.addEventListener("click", () => void onCodingChoice("copilot"));
2271
+ els.codingClaude?.addEventListener("click", () => void onCodingChoice("claude"));
2272
+ els.codingCodex?.addEventListener("click", () => void onCodingChoice("codex"));
2265
2273
  els.stackNextjs?.addEventListener("click", () => void recordStack("nextjs-default"));
2266
2274
  els.stackAmplify?.addEventListener("click", () => void recordStack("amplify-gen2"));
2267
2275
 
@@ -62,6 +62,14 @@
62
62
  <strong>Copilot</strong>
63
63
  <span>After Ready, Req0 starts GitHub Copilot CLI with the implement brief.</span>
64
64
  </button>
65
+ <button type="button" class="stack-choice" data-coding="claude" id="coding-claude">
66
+ <strong>Claude</strong>
67
+ <span>After Ready, Req0 starts Claude Code CLI with the implement brief.</span>
68
+ </button>
69
+ <button type="button" class="stack-choice" data-coding="codex" id="coding-codex">
70
+ <strong>Codex</strong>
71
+ <span>After Ready, Req0 starts Codex CLI with the implement brief.</span>
72
+ </button>
65
73
  </div>
66
74
  </div>
67
75
  <div class="stack-gate-section hidden" id="stack-section">
@@ -304,10 +304,11 @@ body {
304
304
  #all-requirements {
305
305
  display: inline-flex;
306
306
  align-items: center;
307
+ justify-content: flex-start;
307
308
  gap: 6px;
308
309
  flex-shrink: 0;
309
310
  white-space: nowrap;
310
- align-self: center;
311
+ align-self: flex-start;
311
312
  }
312
313
 
313
314
  #all-requirements svg {
@@ -1797,6 +1798,10 @@ body {
1797
1798
  align-items: stretch;
1798
1799
  }
1799
1800
 
1801
+ #all-requirements {
1802
+ align-self: flex-start;
1803
+ }
1804
+
1800
1805
  .pack-row {
1801
1806
  flex-direction: column;
1802
1807
  align-items: stretch;
package/dist/adapter.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AdapterId } from "./types.js";
2
- export declare const ADAPTER_IDS: readonly ["cursor", "copilot", "manual"];
2
+ export declare const ADAPTER_IDS: readonly ["cursor", "copilot", "claude", "codex", "manual"];
3
3
  export declare function parseAdapterId(raw: unknown): AdapterId | null;
4
4
  export declare function adapterDisplayName(adapter: AdapterId): string;
5
5
  export declare function adapterLaunchesAgent(adapter: AdapterId): boolean;
package/dist/adapter.js CHANGED
@@ -1,16 +1,20 @@
1
- export const ADAPTER_IDS = ["cursor", "copilot", "manual"];
1
+ export const ADAPTER_IDS = ["cursor", "copilot", "claude", "codex", "manual"];
2
2
  export function parseAdapterId(raw) {
3
- if (raw === "cursor" || raw === "copilot" || raw === "manual")
4
- return raw;
5
- return null;
3
+ if (typeof raw !== "string")
4
+ return null;
5
+ return ADAPTER_IDS.includes(raw) ? raw : null;
6
6
  }
7
7
  export function adapterDisplayName(adapter) {
8
8
  if (adapter === "copilot")
9
9
  return "Copilot";
10
+ if (adapter === "claude")
11
+ return "Claude";
12
+ if (adapter === "codex")
13
+ return "Codex";
10
14
  if (adapter === "manual")
11
15
  return "Manual";
12
16
  return "Cursor";
13
17
  }
14
18
  export function adapterLaunchesAgent(adapter) {
15
- return adapter === "cursor" || adapter === "copilot";
19
+ return adapter !== "manual";
16
20
  }
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import path from "node:path";
5
5
  import { spawn } from "node:child_process";
6
6
  import { loadEnvFile } from "node:process";
7
7
  import { fileURLToPath } from "node:url";
8
- import { parseAdapterId } from "./adapter.js";
8
+ import { ADAPTER_IDS, parseAdapterId } from "./adapter.js";
9
9
  import { isRequirementId } from "./compile.js";
10
10
  import { adapterInstructions, ImplementDisabledError, ImplementLockedError } from "./implement.js";
11
11
  import { FixFromProofLockedError } from "./fix-from-proof.js";
@@ -241,12 +241,10 @@ function adapterFromArgs(args) {
241
241
  if (flagged !== undefined) {
242
242
  const id = parseAdapterId(flagged);
243
243
  if (!id)
244
- throw new Error(`Unknown adapter "${flagged}". Use cursor, copilot, or manual.`);
244
+ throw new Error(`Unknown adapter "${flagged}". Use ${ADAPTER_IDS.join(", ")}.`);
245
245
  return id;
246
246
  }
247
- if (args[0] === "manual" || args[0] === "cursor" || args[0] === "copilot")
248
- return args[0];
249
- return null;
247
+ return parseAdapterId(args[0]);
250
248
  }
251
249
  function isFree(port) {
252
250
  return new Promise((resolve) => {
@@ -25,7 +25,12 @@ export type LaunchAdapterDeps = {
25
25
  spawn?: typeof spawn;
26
26
  resolveBin?: () => string | null;
27
27
  resolveCopilotBin?: () => string | null;
28
+ resolveClaudeBin?: () => string | null;
29
+ resolveCodexBin?: () => string | null;
28
30
  agentStatus?: (bin: string) => string;
31
+ claudeAuthStatus?: (bin: string) => {
32
+ ok: boolean;
33
+ };
29
34
  settleMs?: number;
30
35
  platform?: NodeJS.Platform;
31
36
  prompt?: string;
@@ -56,7 +61,12 @@ export declare function fixFromProofPrompt(briefPath: string, reportPath: string
56
61
  export declare function improvePrompt(briefPath: string): string;
57
62
  export declare function resolveCursorBin(): string | null;
58
63
  export declare function resolveCopilotBin(): string | null;
64
+ export declare function resolveClaudeBin(): string | null;
65
+ export declare function resolveCodexBin(): string | null;
59
66
  export declare function cursorAgentStatus(bin: string): string;
67
+ export declare function claudeAuthStatus(bin: string): {
68
+ ok: boolean;
69
+ };
60
70
  export declare function assertImplementAllowed(result: CompileResult): void;
61
71
  export declare function implementLogPath(briefPath: string, logFile?: string): string;
62
72
  export declare function launchAdapter(adapter: AdapterId, repoRoot: string | null, briefPath: string, deps?: LaunchAdapterDeps): Promise<LaunchAdapterResult>;
package/dist/implement.js CHANGED
@@ -34,6 +34,12 @@ export function adapterInstructions(adapter, briefPath) {
34
34
  if (adapter === "copilot") {
35
35
  return `Copilot adapter: GitHub Copilot CLI starts in the product repo with ${briefPath} in the prompt. Do not invent spec IDs.`;
36
36
  }
37
+ if (adapter === "claude") {
38
+ return `Claude adapter: Claude Code CLI starts in the product repo with ${briefPath} in the prompt. Do not invent spec IDs.`;
39
+ }
40
+ if (adapter === "codex") {
41
+ return `Codex adapter: Codex CLI starts in the product repo with ${briefPath} in the prompt. Do not invent spec IDs.`;
42
+ }
37
43
  return `Manual adapter: open ${briefPath} in any coding agent and implement from that brief. This path does not start an agent.`;
38
44
  }
39
45
  export function implementPrompt(briefPath, stackId) {
@@ -97,10 +103,19 @@ export function resolveCursorBin() {
97
103
  return null;
98
104
  }
99
105
  export function resolveCopilotBin() {
100
- const override = process.env.COPILOT_BIN?.trim();
106
+ return resolvePathBin("COPILOT_BIN", "copilot");
107
+ }
108
+ export function resolveClaudeBin() {
109
+ return resolvePathBin("CLAUDE_BIN", "claude");
110
+ }
111
+ export function resolveCodexBin() {
112
+ return resolvePathBin("CODEX_BIN", "codex");
113
+ }
114
+ function resolvePathBin(envName, exeBase) {
115
+ const override = process.env[envName]?.trim();
101
116
  if (override && existsSync(override))
102
117
  return override;
103
- const exe = process.platform === "win32" ? "copilot.cmd" : "copilot";
118
+ const exe = process.platform === "win32" ? `${exeBase}.cmd` : exeBase;
104
119
  for (const dir of (process.env.PATH ?? "").split(path.delimiter)) {
105
120
  if (!dir)
106
121
  continue;
@@ -114,6 +129,10 @@ export function cursorAgentStatus(bin) {
114
129
  const result = spawnSync(bin, ["agent", "status"], { encoding: "utf8", timeout: 4_000 });
115
130
  return `${result.stdout ?? ""}${result.stderr ?? ""}`;
116
131
  }
132
+ export function claudeAuthStatus(bin) {
133
+ const result = spawnSync(bin, ["auth", "status"], { encoding: "utf8", timeout: 4_000 });
134
+ return { ok: result.status === 0 };
135
+ }
117
136
  export function assertImplementAllowed(result) {
118
137
  if (result.health.ready.state !== "ready") {
119
138
  throw new ImplementLockedError();
@@ -139,6 +158,12 @@ export function launchAdapter(adapter, repoRoot, briefPath, deps = {}) {
139
158
  if (adapter === "copilot") {
140
159
  return spawnCopilotAgent(repoRoot, briefPath, deps);
141
160
  }
161
+ if (adapter === "claude") {
162
+ return spawnClaudeAgent(repoRoot, briefPath, deps);
163
+ }
164
+ if (adapter === "codex") {
165
+ return spawnCodexAgent(repoRoot, briefPath, deps);
166
+ }
142
167
  const bin = (deps.resolveBin ?? resolveCursorBin)();
143
168
  if (!bin) {
144
169
  return Promise.resolve({
@@ -196,16 +221,67 @@ async function spawnCopilotAgent(repoRoot, briefPath, deps) {
196
221
  if (!bin) {
197
222
  return {
198
223
  ok: false,
199
- message: "GitHub Copilot CLI was not found. Install it, set COPILOT_BIN, or retry with --adapter=cursor or --adapter=manual.",
224
+ message: "GitHub Copilot CLI was not found. Install it, set COPILOT_BIN, or retry with --adapter=manual.",
225
+ };
226
+ }
227
+ return spawnCliAgent(repoRoot, briefPath, deps, {
228
+ bin,
229
+ args: copilotArgs(briefPath, deps),
230
+ cliName: "Copilot",
231
+ successMessage: "Started GitHub Copilot CLI with the implement brief. Activity shows tools and messages as they happen. Build stays running until the agent exits.",
232
+ });
233
+ }
234
+ async function spawnClaudeAgent(repoRoot, briefPath, deps) {
235
+ const bin = (deps.resolveClaudeBin ?? resolveClaudeBin)();
236
+ if (!bin) {
237
+ return {
238
+ ok: false,
239
+ message: "Claude Code CLI was not found. Install it, set CLAUDE_BIN, or retry with --adapter=manual.",
240
+ };
241
+ }
242
+ if (!process.env.ANTHROPIC_API_KEY) {
243
+ const status = (deps.claudeAuthStatus ?? claudeAuthStatus)(bin);
244
+ if (!status.ok) {
245
+ return {
246
+ ok: false,
247
+ message: `Claude Code is not logged in, so nothing was generated. In a terminal run: "${bin}" auth login then retry Implement.`,
248
+ };
249
+ }
250
+ }
251
+ return spawnCliAgent(repoRoot, briefPath, deps, {
252
+ bin,
253
+ args: claudeArgs(briefPath, deps),
254
+ cliName: "Claude",
255
+ successMessage: "Started Claude Code CLI with the implement brief. Activity shows tools and messages as they happen. Build stays running until the agent exits.",
256
+ });
257
+ }
258
+ async function spawnCodexAgent(repoRoot, briefPath, deps) {
259
+ const bin = (deps.resolveCodexBin ?? resolveCodexBin)();
260
+ if (!bin) {
261
+ return {
262
+ ok: false,
263
+ message: "Codex CLI was not found. Install it, set CODEX_BIN, or retry with --adapter=manual.",
200
264
  };
201
265
  }
266
+ return spawnCliAgent(repoRoot, briefPath, deps, {
267
+ bin,
268
+ args: codexArgs(briefPath, deps),
269
+ cliName: "Codex",
270
+ successMessage: "Started Codex CLI with the implement brief. Activity shows tools and messages as they happen. Build stays running until the agent exits.",
271
+ });
272
+ }
273
+ async function spawnCliAgent(repoRoot, briefPath, deps, options) {
202
274
  const run = deps.spawn ?? spawn;
203
275
  const logPath = implementLogPath(briefPath, deps.logFile);
204
- const agentLaunch = await launchLogged(run, bin, copilotArgs(briefPath, deps), repoRoot, logPath, { ...deps, heartbeatLabel: deps.heartbeatLabel ?? "Copilot agent still running.", cliName: "Copilot" });
276
+ const agentLaunch = await launchLogged(run, options.bin, options.args, repoRoot, logPath, {
277
+ ...deps,
278
+ heartbeatLabel: deps.heartbeatLabel ?? `${options.cliName} agent still running.`,
279
+ cliName: options.cliName,
280
+ });
205
281
  if (!agentLaunch.ok) {
206
282
  return { ok: false, message: agentLaunch.message, logPath, stop: agentLaunch.stop };
207
283
  }
208
- const settled = await waitForAgent(agentLaunch.child, deps.settleMs ?? 1500, logPath, bin, "Copilot");
284
+ const settled = await waitForAgent(agentLaunch.child, deps.settleMs ?? 1500, logPath, options.bin, options.cliName);
209
285
  if (!settled.ok) {
210
286
  return {
211
287
  ...settled,
@@ -217,8 +293,7 @@ async function spawnCopilotAgent(repoRoot, briefPath, deps) {
217
293
  }
218
294
  return {
219
295
  ok: true,
220
- message: deps.successMessage ??
221
- "Started GitHub Copilot CLI with the implement brief. Activity shows tools and messages as they happen. Build stays running until the agent exits.",
296
+ message: deps.successMessage ?? options.successMessage,
222
297
  child: agentLaunch.child,
223
298
  logPath,
224
299
  finished: agentLaunch.finished,
@@ -247,6 +322,23 @@ function copilotArgs(briefPath, deps) {
247
322
  const prompt = deps.prompt ?? implementPrompt(briefPath);
248
323
  return ["-p", prompt, "--no-ask-user", "--allow-all", "--output-format", "json"];
249
324
  }
325
+ function claudeArgs(briefPath, deps) {
326
+ const prompt = deps.prompt ?? implementPrompt(briefPath);
327
+ return [
328
+ "-p",
329
+ prompt,
330
+ "--output-format",
331
+ "stream-json",
332
+ "--verbose",
333
+ "--dangerously-skip-permissions",
334
+ "--disallowedTools",
335
+ "AskUserQuestion",
336
+ ];
337
+ }
338
+ function codexArgs(briefPath, deps) {
339
+ const prompt = deps.prompt ?? implementPrompt(briefPath);
340
+ return ["exec", "--json", "--sandbox", "workspace-write", prompt];
341
+ }
250
342
  function launchDetached(run, bin, args, cwd) {
251
343
  return new Promise((resolve) => {
252
344
  let child;
@@ -485,6 +577,9 @@ export function summarizeAgentLine(line) {
485
577
  catch {
486
578
  return text.slice(0, 280);
487
579
  }
580
+ const codex = summarizeCodexLine(event);
581
+ if (codex !== undefined)
582
+ return codex;
488
583
  const copilot = summarizeCopilotLine(event);
489
584
  if (copilot !== undefined)
490
585
  return copilot;
@@ -512,9 +607,58 @@ export function summarizeAgentLine(line) {
512
607
  }
513
608
  return null;
514
609
  }
610
+ function summarizeCodexLine(event) {
611
+ const type = typeof event.type === "string" ? event.type : "";
612
+ const isCodex = type.startsWith("item.") ||
613
+ type.startsWith("turn.") ||
614
+ type.startsWith("thread.") ||
615
+ type === "event_msg";
616
+ if (!isCodex)
617
+ return undefined;
618
+ if (type === "turn.started" || type === "thread.started" || type === "turn.completed")
619
+ return null;
620
+ const item = event.item && typeof event.item === "object" ? event.item : undefined;
621
+ if (item) {
622
+ const kind = typeof item.type === "string" ? item.type : "";
623
+ if (kind === "command_execution" || kind === "command") {
624
+ if (type.endsWith(".completed"))
625
+ return null;
626
+ const command = String(item.command ?? item.cmd ?? item.aggregated_output ?? "").trim();
627
+ return command ? clip(`Running ${command}`, 280) : clip("Running a command", 280);
628
+ }
629
+ if (kind === "file_change" || kind === "file_change_item") {
630
+ if (type.endsWith(".completed"))
631
+ return null;
632
+ const changes = Array.isArray(item.changes) ? item.changes : [];
633
+ const first = changes[0] && typeof changes[0] === "object" ? changes[0] : undefined;
634
+ const file = String(first?.path ?? item.path ?? "").trim();
635
+ return file ? clip(`Writing ${file}`, 280) : clip("Writing files", 280);
636
+ }
637
+ if (kind === "agent_message" || kind === "message") {
638
+ const body = String(item.text ?? item.content ?? "").trim();
639
+ return body ? clip(`Agent: ${body}`, 280) : null;
640
+ }
641
+ if (kind.includes("mcp") || kind.includes("tool")) {
642
+ const name = String(item.name ?? item.tool ?? kind);
643
+ return clip(`Using ${name}`, 280);
644
+ }
645
+ }
646
+ if (type === "error" || type.endsWith(".failed")) {
647
+ const message = event.message ?? event.error ?? item?.error;
648
+ return clip(`Codex error: ${String(message ?? "unknown")}`, 280);
649
+ }
650
+ return null;
651
+ }
515
652
  function summarizeCopilotLine(event) {
516
653
  const type = typeof event.type === "string" ? event.type : "";
517
- const isCopilot = type.includes(".") || type === "tool_use" || type === "tool_result" || type === "message";
654
+ const isCopilot = type === "tool.execution_start" ||
655
+ type === "tool.execution_complete" ||
656
+ type === "tool_use" ||
657
+ type === "tool_result" ||
658
+ type === "user.message" ||
659
+ type === "assistant.message" ||
660
+ type === "session.error" ||
661
+ type === "message";
518
662
  if (!isCopilot)
519
663
  return undefined;
520
664
  const data = event.data && typeof event.data === "object" ? event.data : event;
@@ -527,7 +671,7 @@ function summarizeCopilotLine(event) {
527
671
  const args = (data.arguments ?? data.input ?? event.input);
528
672
  return summarizeCopilotTool(name, args);
529
673
  }
530
- if (type === "assistant.message" || type === "assistant" || type === "message") {
674
+ if (type === "assistant.message" || type === "message") {
531
675
  const requests = data.toolRequests;
532
676
  if (Array.isArray(requests) && requests[0] && typeof requests[0] === "object") {
533
677
  const req = requests[0];
@@ -647,7 +791,11 @@ async function waitForAgent(child, settleMs, logPath, bin, agentName = "Cursor")
647
791
  const tail = tailLog(logPath);
648
792
  const loginHint = agentName === "Copilot"
649
793
  ? `If you are not logged in, run: "${bin}" /login`
650
- : `If you are not logged in, run: "${bin}" agent login`;
794
+ : agentName === "Claude"
795
+ ? `If you are not logged in, run: "${bin}" auth login`
796
+ : agentName === "Codex"
797
+ ? `If you are not logged in, run: "${bin}" login`
798
+ : `If you are not logged in, run: "${bin}" agent login`;
651
799
  return {
652
800
  ok: false,
653
801
  message: tail
package/dist/ready.js CHANGED
@@ -260,7 +260,7 @@ function goingCopy(health, ready) {
260
260
  return proofGoing(health);
261
261
  }
262
262
  if (health.build.state === "running") {
263
- const agent = adapterDisplayName(health.build.adapter === "copilot" ? "copilot" : "cursor");
263
+ const agent = adapterDisplayName(health.build.adapter ?? "cursor");
264
264
  return `${agent} agent is running. Activity shows tools and messages as they happen. Stop ends the run. Build Succeeded is not proof the app boots.`;
265
265
  }
266
266
  if (health.build.state === "stale")
package/dist/server.js CHANGED
@@ -251,14 +251,14 @@ async function handle(state, req, res) {
251
251
  return;
252
252
  }
253
253
  const body = await readJson(req);
254
- const coding = body["coding"];
255
- if (coding !== "manual" && coding !== "cursor" && coding !== "copilot") {
256
- sendJson(res, { error: "Choose I'll write the code, Cursor, or Copilot." }, 400);
254
+ const coding = parseAdapterId(body["coding"]);
255
+ if (!coding) {
256
+ sendJson(res, { error: "Choose I'll write the code, Cursor, Copilot, Claude, or Codex." }, 400);
257
257
  return;
258
258
  }
259
259
  const stackId = typeof body["stack"] === "string" && body["stack"].trim() ? String(body["stack"]) : undefined;
260
260
  if (coding !== "manual" && !stackId && needsStackChoice({ ...repo, implement: true })) {
261
- sendJson(res, { error: "Choose a stack for Cursor or Copilot on an empty repo." }, 400);
261
+ sendJson(res, { error: "Choose a stack for a coding agent on an empty repo." }, 400);
262
262
  return;
263
263
  }
264
264
  try {
package/dist/stack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AdapterId, ProductRepo, Req0Config, StackChoice } from "./types.js";
2
- export type CodingChoice = "manual" | "cursor" | "copilot";
2
+ export type CodingChoice = AdapterId;
3
3
  export declare const REQ0_CONFIG_FILE = "req0.json";
4
4
  export declare const ENV_EXAMPLE_FILE = ".env.example";
5
5
  export declare const AMPLIFY_ENV_EXAMPLE = "# Copy to .env. Names only. Do not put real values in this file.\n# ampx does not read this file. Export the vars, or run: npx ampx configure profile\nAWS_REGION=\n# Named profile (then: npx ampx sandbox --once --profile <name>):\nAWS_PROFILE=\n# Or access keys instead of AWS_PROFILE:\n# AWS_ACCESS_KEY_ID=\n# AWS_SECRET_ACCESS_KEY=\n# AWS_SESSION_TOKEN= # temporary/SSO creds only \u2014 not IAM user keys\n";
package/dist/stages.js CHANGED
@@ -225,7 +225,7 @@ export function computeStages(health, ready) {
225
225
  const implementOwned = health.build.owned !== false;
226
226
  const neverSucceeded = health.build.state === "not_yet" || health.build.state === "failed";
227
227
  const needsStack = health.build.needsStack === true;
228
- const agent = adapterDisplayName(health.build.adapter === "copilot" ? "copilot" : "cursor");
228
+ const agent = adapterDisplayName(health.build.adapter ?? "cursor");
229
229
  const buildAction = implementOwned
230
230
  ? {
231
231
  id: "implement",
package/dist/types.d.ts CHANGED
@@ -159,7 +159,7 @@ export type JevRun = {
159
159
  checkedAt: string;
160
160
  answers: JevAnswer[];
161
161
  };
162
- export type AdapterId = "cursor" | "copilot" | "manual";
162
+ export type AdapterId = "cursor" | "copilot" | "claude" | "codex" | "manual";
163
163
  export type StackChoice = {
164
164
  id: string;
165
165
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@richjava/req0",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Requirement operating system: spec packs, a local cockpit, Jev, coding-agent implement, and browser proof.",
5
5
  "license": "MIT",
6
6
  "type": "module",