nightralph 0.0.21 → 0.0.23

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/meta.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "inputs": {
3
3
  "src/setup.ts": {
4
- "bytes": 4981,
4
+ "bytes": 5004,
5
5
  "imports": [
6
6
  {
7
7
  "path": "node:fs",
@@ -27,7 +27,7 @@
27
27
  "format": "esm"
28
28
  },
29
29
  "src/worktree.ts": {
30
- "bytes": 4846,
30
+ "bytes": 5108,
31
31
  "imports": [
32
32
  {
33
33
  "path": "node:child_process",
@@ -116,7 +116,7 @@
116
116
  "format": "esm"
117
117
  },
118
118
  "src/testcmd.ts": {
119
- "bytes": 2195,
119
+ "bytes": 2463,
120
120
  "imports": [
121
121
  {
122
122
  "path": "node:child_process",
@@ -142,7 +142,7 @@
142
142
  "format": "esm"
143
143
  },
144
144
  "src/orchestrator.ts": {
145
- "bytes": 56085,
145
+ "bytes": 57999,
146
146
  "imports": [
147
147
  {
148
148
  "path": "node:child_process",
@@ -305,7 +305,7 @@
305
305
  "imports": [],
306
306
  "exports": [],
307
307
  "inputs": {},
308
- "bytes": 161652
308
+ "bytes": 165335
309
309
  },
310
310
  "dist/index.js": {
311
311
  "imports": [
@@ -465,13 +465,13 @@
465
465
  "bytesInOutput": 6896
466
466
  },
467
467
  "src/setup.ts": {
468
- "bytesInOutput": 4318
468
+ "bytesInOutput": 4339
469
469
  },
470
470
  "src/orchestrator.ts": {
471
- "bytesInOutput": 39685
471
+ "bytesInOutput": 40993
472
472
  },
473
473
  "src/worktree.ts": {
474
- "bytesInOutput": 3537
474
+ "bytesInOutput": 3788
475
475
  },
476
476
  "src/progress.ts": {
477
477
  "bytesInOutput": 4419
@@ -483,13 +483,13 @@
483
483
  "bytesInOutput": 7877
484
484
  },
485
485
  "src/testcmd.ts": {
486
- "bytesInOutput": 1620
486
+ "bytesInOutput": 1911
487
487
  },
488
488
  "src/resolve.ts": {
489
489
  "bytesInOutput": 1937
490
490
  }
491
491
  },
492
- "bytes": 75730
492
+ "bytes": 77601
493
493
  }
494
494
  }
495
495
  }
@@ -219,6 +219,7 @@ function renderMergePrompt(specBody, ticket) {
219
219
  "3. Commit the resolved files.",
220
220
  "",
221
221
  "Do NOT re-implement the ticket from scratch.",
222
+ "Do NOT read or modify files outside your current directory (the worktree).",
222
223
  "Do NOT run git push."
223
224
  ].join("\n");
224
225
  }
@@ -600,6 +601,7 @@ function spawnAgent(opts) {
600
601
  __name(finish, "finish");
601
602
  proc.on("exit", (code) => {
602
603
  graceTimer = setTimeout(() => {
604
+ killProcessGroup(proc.pid);
603
605
  proc.stdout.destroy();
604
606
  proc.stderr.destroy();
605
607
  finish(code ?? 1);
@@ -710,7 +712,7 @@ Test command: ${opts.testCmd ?? "(none)"}`
710
712
  `Retries: ${opts.retries ?? DEFAULT_RETRIES}`
711
713
  );
712
714
  console.log(
713
- `Retry delay: ${opts.retryDelay ?? DEFAULT_RETRY_DELAY}s`
715
+ `Retry delay: ${opts.retryDelay ?? 0}s`
714
716
  );
715
717
  console.log(
716
718
  `
@@ -723,7 +725,8 @@ async function runTestGate(opts) {
723
725
  const result = await runTestCmd({
724
726
  cmd: opts.testCmd,
725
727
  cwd: opts.worktreePath,
726
- timeout: opts.timeout
728
+ timeout: opts.timeout,
729
+ registry: opts.registry
727
730
  });
728
731
  const testLogPath = attemptLogPath(
729
732
  opts.logsDir,
@@ -799,7 +802,8 @@ async function respawnAndRetryMerge(opts) {
799
802
  worktreePath: opts.worktreePath,
800
803
  timeout: opts.timeout,
801
804
  logsDir: opts.logsDir,
802
- log
805
+ log,
806
+ registry: runningAgents
803
807
  });
804
808
  if (!passed) {
805
809
  log(
@@ -915,7 +919,12 @@ async function runTicketAttempt(opts) {
915
919
  opts.baseBranch,
916
920
  worktree.branchName
917
921
  )) {
918
- return { kind: "no-commits" };
922
+ await removeWorktreeQuietly(worktree.worktreePath, d);
923
+ return {
924
+ kind: "no-commits",
925
+ worktreePath: worktree.worktreePath,
926
+ branchName: worktree.branchName
927
+ };
919
928
  }
920
929
  if (opts.testCmd) {
921
930
  const passed = await runTestGate({
@@ -925,7 +934,8 @@ async function runTicketAttempt(opts) {
925
934
  timeout: opts.timeout,
926
935
  logsDir: opts.logsDir,
927
936
  attempt: opts.attempt,
928
- log: /* @__PURE__ */ __name((msg) => d.log(msg), "log")
937
+ log: /* @__PURE__ */ __name((msg) => d.log(msg), "log"),
938
+ registry: runningAgents
929
939
  });
930
940
  if (!passed) {
931
941
  await removeWorktreeQuietly(
@@ -954,7 +964,11 @@ async function runTicketAttempts(opts) {
954
964
  const maxAttempts = opts.retries + 1;
955
965
  const isPi = basename(opts.agentCmd) === "pi";
956
966
  let thinking = opts.thinking;
957
- let outcome = { kind: "no-commits" };
967
+ let outcome = {
968
+ kind: "no-commits",
969
+ worktreePath: "",
970
+ branchName: ""
971
+ };
958
972
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
959
973
  if (attempt === 1) {
960
974
  d.log(` Starting ${ticket.filename}`);
@@ -1215,6 +1229,18 @@ async function runWavesIsolated(opts) {
1215
1229
  d.log(
1216
1230
  ` ${ticket.filename}: failed to create worktree: ${formatErrorMessage(outcome.error)}`
1217
1231
  );
1232
+ checkTicket(progress, ticket.num, {
1233
+ branch: "",
1234
+ exitCode: -1,
1235
+ done: false
1236
+ });
1237
+ await saveProgress(
1238
+ repoRoot,
1239
+ progressPath,
1240
+ progress,
1241
+ `nightralph: ${ticket.filename} worktree error`,
1242
+ d
1243
+ );
1218
1244
  continue;
1219
1245
  }
1220
1246
  if (outcome.kind === "error") {
@@ -1223,6 +1249,18 @@ async function runWavesIsolated(opts) {
1223
1249
  d.log(
1224
1250
  ` ${ticket.filename}: attempt error: ` + formatErrorMessage(outcome.error)
1225
1251
  );
1252
+ checkTicket(progress, ticket.num, {
1253
+ branch: outcome.branchName ?? "",
1254
+ exitCode: -1,
1255
+ done: false
1256
+ });
1257
+ await saveProgress(
1258
+ repoRoot,
1259
+ progressPath,
1260
+ progress,
1261
+ `nightralph: ${ticket.filename} error`,
1262
+ d
1263
+ );
1226
1264
  continue;
1227
1265
  }
1228
1266
  if (outcome.kind === "no-commits") {
@@ -1231,6 +1269,18 @@ async function runWavesIsolated(opts) {
1231
1269
  d.log(
1232
1270
  ` ${ticket.filename}: agent exited 0 but made no changes; leaving ticket ready-for-agent`
1233
1271
  );
1272
+ checkTicket(progress, ticket.num, {
1273
+ branch: outcome.branchName,
1274
+ exitCode: 0,
1275
+ done: false
1276
+ });
1277
+ await saveProgress(
1278
+ repoRoot,
1279
+ progressPath,
1280
+ progress,
1281
+ `nightralph: ${ticket.filename} no commits`,
1282
+ d
1283
+ );
1234
1284
  continue;
1235
1285
  }
1236
1286
  if (outcome.kind === "failed") {