nightralph 0.0.37 → 0.0.38

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": 4884,
4
+ "bytes": 5445,
5
5
  "imports": [
6
6
  {
7
7
  "path": "node:fs",
@@ -142,7 +142,7 @@
142
142
  "format": "esm"
143
143
  },
144
144
  "src/orchestrator.ts": {
145
- "bytes": 65558,
145
+ "bytes": 68622,
146
146
  "imports": [
147
147
  {
148
148
  "path": "node:child_process",
@@ -169,6 +169,11 @@
169
169
  "kind": "import-statement",
170
170
  "external": true
171
171
  },
172
+ {
173
+ "path": "node:util",
174
+ "kind": "import-statement",
175
+ "external": true
176
+ },
172
177
  {
173
178
  "path": "src/worktree.ts",
174
179
  "kind": "import-statement",
@@ -305,7 +310,7 @@
305
310
  "imports": [],
306
311
  "exports": [],
307
312
  "inputs": {},
308
- "bytes": 175862
313
+ "bytes": 180825
309
314
  },
310
315
  "dist/index.js": {
311
316
  "imports": [
@@ -374,6 +379,11 @@
374
379
  "kind": "import-statement",
375
380
  "external": true
376
381
  },
382
+ {
383
+ "path": "node:util",
384
+ "kind": "import-statement",
385
+ "external": true
386
+ },
377
387
  {
378
388
  "path": "node:child_process",
379
389
  "kind": "import-statement",
@@ -465,10 +475,10 @@
465
475
  "bytesInOutput": 6800
466
476
  },
467
477
  "src/setup.ts": {
468
- "bytesInOutput": 4265
478
+ "bytesInOutput": 4816
469
479
  },
470
480
  "src/orchestrator.ts": {
471
- "bytesInOutput": 45107
481
+ "bytesInOutput": 47516
472
482
  },
473
483
  "src/worktree.ts": {
474
484
  "bytesInOutput": 3788
@@ -489,7 +499,7 @@
489
499
  "bytesInOutput": 1937
490
500
  }
491
501
  },
492
- "bytes": 81599
502
+ "bytes": 84559
493
503
  }
494
504
  }
495
505
  }
@@ -1,6 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { spawn } from "node:child_process";
3
+ import { spawn, execFile } from "node:child_process";
4
4
  import {
5
5
  createWriteStream,
6
6
  mkdirSync,
@@ -12,6 +12,8 @@ import {
12
12
  import { tmpdir } from "node:os";
13
13
  import { join, dirname, basename } from "node:path";
14
14
  import { createInterface } from "node:readline";
15
+ import { promisify } from "node:util";
16
+ const execFileAsync = promisify(execFile);
15
17
  import {
16
18
  getRepoRoot,
17
19
  getRepoName,
@@ -53,6 +55,48 @@ async function removeWorktreeQuietly(worktreePath, d) {
53
55
  }
54
56
  }
55
57
  __name(removeWorktreeQuietly, "removeWorktreeQuietly");
58
+ async function commitTicketFiles(repoRoot, tickets, d) {
59
+ const paths = tickets.map((t) => t.filepath);
60
+ if (paths.length === 0) return;
61
+ try {
62
+ await execFileAsync(
63
+ "git",
64
+ ["add", "--force", ...paths],
65
+ { cwd: repoRoot }
66
+ );
67
+ try {
68
+ await execFileAsync(
69
+ "git",
70
+ [
71
+ "diff",
72
+ "--cached",
73
+ "--quiet",
74
+ "--",
75
+ ...paths
76
+ ],
77
+ { cwd: repoRoot }
78
+ );
79
+ return;
80
+ } catch {
81
+ }
82
+ await execFileAsync(
83
+ "git",
84
+ [
85
+ "commit",
86
+ "-m",
87
+ "nightralph: update ticket checklists",
88
+ "--",
89
+ ...paths
90
+ ],
91
+ { cwd: repoRoot }
92
+ );
93
+ } catch (err) {
94
+ d.log(
95
+ " Failed to commit ticket updates: " + formatErrorMessage(err)
96
+ );
97
+ }
98
+ }
99
+ __name(commitTicketFiles, "commitTicketFiles");
56
100
  const TICKET_RE = /^(\d+)-(.+)\.md$/;
57
101
  function parseTicketFilename(filename) {
58
102
  const m = filename.match(TICKET_RE);
@@ -264,14 +308,18 @@ function renderPrompt(specBody, ticket, opts) {
264
308
  "You are an autonomous coding agent. Implement the ticket using /tdd.",
265
309
  "",
266
310
  "Follow these rules:",
267
- "- Read the files directly relevant to the ticket before writing code.",
311
+ "- Read the files directly relevant to the ticket before writing code. Also read any AGENTS.md in or above the directories you will touch, plus CONTEXT.md and the relevant docs/adr/ entries if they exist. If they do not exist, proceed silently.",
312
+ "- Work ONLY on this ticket. Do not fix unrelated problems you notice.",
268
313
  "- Do NOT research external APIs or services via web search. Use the spec and ticket body as your sole reference for API shapes.",
269
314
  "- 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.`,
315
+ `- While iterating, run only the tests relevant to what you changed. Run \`${opts.testCmd}\` in full once, as the final gate before your last commit. Do not commit with failing tests. The orchestrator runs the same command after you exit and rejects the ticket if it fails.`,
316
+ "- If the project has a lint script, run it and fix what it reports.",
317
+ "- INTEGRITY: never delete, skip, weaken, or write tautological tests to force a green result. Only report a checklist item done when its real tests genuinely pass. If an item cannot be completed honestly, leave it unchecked and say what blocked you.",
271
318
  "- Do NOT read or modify files outside your current directory (the worktree).",
272
319
  "- Do NOT run git push.",
273
- "- Commit your work when finished.",
320
+ "- Commit after each checklist item, and make sure everything is committed when finished.",
274
321
  "- After completing each checklist item in the ticket, print a line: [x] <item text> (matching the checklist text exactly).",
322
+ "- Before your final commit, record reusable learnings in the nearest AGENTS.md (in or above the directories you modified; prefer that over the repo root). Good additions: module conventions, gotchas, files that must change together, how to test that area, environment requirements. Do NOT add ticket-specific details or temporary debugging notes. Only write when you have knowledge that would help future work in that directory.",
275
323
  ""
276
324
  ].join("\n");
277
325
  }
@@ -292,8 +340,9 @@ function renderMergePrompt(specBody, ticket) {
292
340
  "",
293
341
  "Your task:",
294
342
  "1. Find and resolve all conflict markers (<<<<<<< / ======= / >>>>>>>).",
295
- "2. Make sure the code compiles and tests pass.",
296
- "3. Commit the resolved files.",
343
+ "2. When AGENTS.md or other docs conflict, keep both sides' additions rather than picking one.",
344
+ "3. Make sure the code compiles and tests pass.",
345
+ "4. Commit the resolved files.",
297
346
  "",
298
347
  "Do NOT re-implement the ticket from scratch.",
299
348
  "Do NOT read or modify files outside your current directory (the worktree).",
@@ -1476,6 +1525,13 @@ async function runWavesIsolated(opts) {
1476
1525
  });
1477
1526
  }
1478
1527
  if (successfulBranches.length > 0) {
1528
+ await commitTicketFiles(
1529
+ repoRoot,
1530
+ successfulBranches.map(
1531
+ (sb) => ticketsByNum.get(sb.ticketNum)
1532
+ ),
1533
+ d
1534
+ );
1479
1535
  const mergeResult = await mergeWave({
1480
1536
  repoRoot,
1481
1537
  baseBranch,