nightralph 0.0.35 → 0.0.37
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 +16 -5
- package/dist/index.js +58 -59
- package/dist/index.js.map +2 -2
- package/dist/meta.json +6 -6
- package/dist/orchestrator.js +53 -55
- package/dist/orchestrator.js.map +2 -2
- package/dist/src/orchestrator.d.ts +6 -6
- package/dist/src/orchestrator.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/meta.json
CHANGED
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"format": "esm"
|
|
143
143
|
},
|
|
144
144
|
"src/orchestrator.ts": {
|
|
145
|
-
"bytes":
|
|
145
|
+
"bytes": 65558,
|
|
146
146
|
"imports": [
|
|
147
147
|
{
|
|
148
148
|
"path": "node:child_process",
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
"format": "esm"
|
|
235
235
|
},
|
|
236
236
|
"src/index.ts": {
|
|
237
|
-
"bytes":
|
|
237
|
+
"bytes": 10105,
|
|
238
238
|
"imports": [
|
|
239
239
|
{
|
|
240
240
|
"path": "node:fs",
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
"imports": [],
|
|
306
306
|
"exports": [],
|
|
307
307
|
"inputs": {},
|
|
308
|
-
"bytes":
|
|
308
|
+
"bytes": 175862
|
|
309
309
|
},
|
|
310
310
|
"dist/index.js": {
|
|
311
311
|
"imports": [
|
|
@@ -462,13 +462,13 @@
|
|
|
462
462
|
"entryPoint": "src/index.ts",
|
|
463
463
|
"inputs": {
|
|
464
464
|
"src/index.ts": {
|
|
465
|
-
"bytesInOutput":
|
|
465
|
+
"bytesInOutput": 6800
|
|
466
466
|
},
|
|
467
467
|
"src/setup.ts": {
|
|
468
468
|
"bytesInOutput": 4265
|
|
469
469
|
},
|
|
470
470
|
"src/orchestrator.ts": {
|
|
471
|
-
"bytesInOutput":
|
|
471
|
+
"bytesInOutput": 45107
|
|
472
472
|
},
|
|
473
473
|
"src/worktree.ts": {
|
|
474
474
|
"bytesInOutput": 3788
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
"bytesInOutput": 1937
|
|
490
490
|
}
|
|
491
491
|
},
|
|
492
|
-
"bytes":
|
|
492
|
+
"bytes": 81599
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
}
|
package/dist/orchestrator.js
CHANGED
|
@@ -251,11 +251,7 @@ function stripSpecSection(specBody, heading) {
|
|
|
251
251
|
return out.join("\n");
|
|
252
252
|
}
|
|
253
253
|
__name(stripSpecSection, "stripSpecSection");
|
|
254
|
-
function renderPrompt(specBody, ticket, opts
|
|
255
|
-
const testRules = opts.testCmd ? [
|
|
256
|
-
"- Work test-first. For each checklist item, write a failing test at the seams named in the spec's Testing Decisions section, then write only enough code to make it pass.",
|
|
257
|
-
`- Run \`${opts.testCmd}\` before committing. Do not commit with failing tests. The orchestrator runs the same command after you exit and rejects the ticket if it fails.`
|
|
258
|
-
] : [];
|
|
254
|
+
function renderPrompt(specBody, ticket, opts) {
|
|
259
255
|
return [
|
|
260
256
|
"---- SPEC CONTEXT ----",
|
|
261
257
|
specBody,
|
|
@@ -265,12 +261,13 @@ function renderPrompt(specBody, ticket, opts = {}) {
|
|
|
265
261
|
ticket.body,
|
|
266
262
|
"",
|
|
267
263
|
"---- AGENT INSTRUCTIONS ----",
|
|
268
|
-
"You are an autonomous coding agent. Implement the ticket.",
|
|
264
|
+
"You are an autonomous coding agent. Implement the ticket using /tdd.",
|
|
269
265
|
"",
|
|
270
266
|
"Follow these rules:",
|
|
271
267
|
"- Read the files directly relevant to the ticket before writing code.",
|
|
272
268
|
"- Do NOT research external APIs or services via web search. Use the spec and ticket body as your sole reference for API shapes.",
|
|
273
|
-
|
|
269
|
+
"- Use /tdd for every checklist item. For each item, write a failing test at the seams named in the spec's Testing Decisions section, then write only enough code to make it pass, then refactor.",
|
|
270
|
+
`- Run \`${opts.testCmd}\` before committing. Do not commit with failing tests. The orchestrator runs the same command after you exit and rejects the ticket if it fails.`,
|
|
274
271
|
"- Do NOT read or modify files outside your current directory (the worktree).",
|
|
275
272
|
"- Do NOT run git push.",
|
|
276
273
|
"- Commit your work when finished.",
|
|
@@ -775,7 +772,7 @@ function spawnAgent(opts) {
|
|
|
775
772
|
});
|
|
776
773
|
}
|
|
777
774
|
__name(spawnAgent, "spawnAgent");
|
|
778
|
-
function dryRun(tickets, specBody) {
|
|
775
|
+
function dryRun(tickets, specBody, testCmd) {
|
|
779
776
|
listTickets(tickets);
|
|
780
777
|
console.log("\nSimulated wave order:");
|
|
781
778
|
for (const { wave, ready } of simulateWaves(tickets)) {
|
|
@@ -797,7 +794,11 @@ Prompt for first ready ticket (${firstReady[0].filename}):
|
|
|
797
794
|
`
|
|
798
795
|
);
|
|
799
796
|
console.log(
|
|
800
|
-
renderPrompt(
|
|
797
|
+
renderPrompt(
|
|
798
|
+
specBody,
|
|
799
|
+
firstReady[0],
|
|
800
|
+
{ testCmd }
|
|
801
|
+
)
|
|
801
802
|
);
|
|
802
803
|
}
|
|
803
804
|
}
|
|
@@ -843,7 +844,7 @@ Prompt for first ready ticket (${firstReady[0].filename}):
|
|
|
843
844
|
const strategyDesc = opts.conflictStrategy === "respawn" ? "respawn (re-run agent on conflict)" : "stop (stop merging on conflict)";
|
|
844
845
|
console.log(
|
|
845
846
|
`
|
|
846
|
-
Test command: ${opts.testCmd
|
|
847
|
+
Test command: ${opts.testCmd}`
|
|
847
848
|
);
|
|
848
849
|
console.log(
|
|
849
850
|
`Effort: ${opts.effort ?? "(provider default)"}`
|
|
@@ -935,22 +936,20 @@ async function respawnAndRetryMerge(opts) {
|
|
|
935
936
|
}
|
|
936
937
|
return false;
|
|
937
938
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
return false;
|
|
953
|
-
}
|
|
939
|
+
const passed = await runTestGate({
|
|
940
|
+
testCmd: opts.testCmd,
|
|
941
|
+
ticket: opts.ticket,
|
|
942
|
+
worktreePath: opts.worktreePath,
|
|
943
|
+
timeout: opts.timeout,
|
|
944
|
+
logsDir: opts.logsDir,
|
|
945
|
+
log,
|
|
946
|
+
registry: runningAgents
|
|
947
|
+
});
|
|
948
|
+
if (!passed) {
|
|
949
|
+
log(
|
|
950
|
+
` ${opts.ticket.filename}: tests failed after conflict respawn; not merging`
|
|
951
|
+
);
|
|
952
|
+
return false;
|
|
954
953
|
}
|
|
955
954
|
const mergeResult = await mergeBranch(
|
|
956
955
|
opts.repoRoot,
|
|
@@ -1066,30 +1065,28 @@ async function runTicketAttempt(opts) {
|
|
|
1066
1065
|
branchName: worktree.branchName
|
|
1067
1066
|
};
|
|
1068
1067
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1068
|
+
const passed = await runTestGate({
|
|
1069
|
+
testCmd: opts.testCmd,
|
|
1070
|
+
ticket,
|
|
1071
|
+
worktreePath: worktree.worktreePath,
|
|
1072
|
+
timeout: opts.timeout,
|
|
1073
|
+
logsDir: opts.logsDir,
|
|
1074
|
+
attempt: opts.attempt,
|
|
1075
|
+
log: /* @__PURE__ */ __name((msg) => d.log(msg), "log"),
|
|
1076
|
+
registry: runningAgents
|
|
1077
|
+
});
|
|
1078
|
+
if (!passed) {
|
|
1079
|
+
await removeWorktreeQuietly(
|
|
1080
|
+
worktree.worktreePath,
|
|
1081
|
+
d
|
|
1082
|
+
);
|
|
1083
|
+
return {
|
|
1084
|
+
kind: "failed",
|
|
1085
|
+
reason: "tests",
|
|
1086
|
+
branchName: worktree.branchName,
|
|
1087
|
+
exitCode: 1,
|
|
1088
|
+
completedItems: agentResult.completedItems
|
|
1089
|
+
};
|
|
1093
1090
|
}
|
|
1094
1091
|
return {
|
|
1095
1092
|
kind: "ready",
|
|
@@ -1163,7 +1160,7 @@ function runProgress(tickets) {
|
|
|
1163
1160
|
};
|
|
1164
1161
|
}
|
|
1165
1162
|
__name(runProgress, "runProgress");
|
|
1166
|
-
async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, display, maxTurns, effort, retries, retryDelay) {
|
|
1163
|
+
async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, testCmd, display, maxTurns, effort, retries, retryDelay) {
|
|
1167
1164
|
mkdirSync(logsDir, { recursive: true });
|
|
1168
1165
|
const d = display ?? createDisplay();
|
|
1169
1166
|
const maxAttempts = (retries ?? DEFAULT_RETRIES) + 1;
|
|
@@ -1200,7 +1197,11 @@ async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, di
|
|
|
1200
1197
|
);
|
|
1201
1198
|
const results = await Promise.allSettled(
|
|
1202
1199
|
ready.map(async (t) => {
|
|
1203
|
-
const prompt = renderPrompt(
|
|
1200
|
+
const prompt = renderPrompt(
|
|
1201
|
+
specBody,
|
|
1202
|
+
t,
|
|
1203
|
+
{ testCmd }
|
|
1204
|
+
);
|
|
1204
1205
|
const label = t.filename.replace(
|
|
1205
1206
|
/\.md$/,
|
|
1206
1207
|
""
|
|
@@ -1327,9 +1328,6 @@ async function runWavesIsolated(opts) {
|
|
|
1327
1328
|
`nightralph: start ${opts.featureName}`,
|
|
1328
1329
|
d
|
|
1329
1330
|
);
|
|
1330
|
-
if (!opts.testCmd) {
|
|
1331
|
-
d.log(" Test gate disabled: no test command");
|
|
1332
|
-
}
|
|
1333
1331
|
let totalCompleted = 0;
|
|
1334
1332
|
let waveNum = 0;
|
|
1335
1333
|
const failedNums = /* @__PURE__ */ new Set();
|