nightralph 0.0.53 → 0.0.54

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.
Files changed (42) hide show
  1. package/README.md +82 -9
  2. package/dist/index.js +1947 -230
  3. package/dist/index.js.map +4 -4
  4. package/dist/learnings.js +356 -0
  5. package/dist/learnings.js.map +7 -0
  6. package/dist/meta.json +232 -12
  7. package/dist/orchestrator.js +442 -109
  8. package/dist/orchestrator.js.map +3 -3
  9. package/dist/preflight.js +34 -0
  10. package/dist/preflight.js.map +7 -0
  11. package/dist/progress.js +5 -4
  12. package/dist/progress.js.map +2 -2
  13. package/dist/retry.js +83 -0
  14. package/dist/retry.js.map +7 -0
  15. package/dist/review.js +662 -0
  16. package/dist/review.js.map +7 -0
  17. package/dist/rules.js +54 -0
  18. package/dist/rules.js.map +7 -0
  19. package/dist/src/index.d.ts.map +1 -1
  20. package/dist/src/learnings.d.ts +68 -0
  21. package/dist/src/learnings.d.ts.map +1 -0
  22. package/dist/src/orchestrator.d.ts +14 -11
  23. package/dist/src/orchestrator.d.ts.map +1 -1
  24. package/dist/src/preflight.d.ts +6 -0
  25. package/dist/src/preflight.d.ts.map +1 -0
  26. package/dist/src/progress.d.ts +1 -1
  27. package/dist/src/progress.d.ts.map +1 -1
  28. package/dist/src/retry.d.ts +26 -0
  29. package/dist/src/retry.d.ts.map +1 -0
  30. package/dist/src/review.d.ts +127 -0
  31. package/dist/src/review.d.ts.map +1 -0
  32. package/dist/src/rules.d.ts +10 -0
  33. package/dist/src/rules.d.ts.map +1 -0
  34. package/dist/src/testcmd.d.ts +1 -0
  35. package/dist/src/testcmd.d.ts.map +1 -1
  36. package/dist/src/worktree.d.ts +30 -1
  37. package/dist/src/worktree.d.ts.map +1 -1
  38. package/dist/testcmd.js +13 -0
  39. package/dist/testcmd.js.map +2 -2
  40. package/dist/worktree.js +236 -32
  41. package/dist/worktree.js.map +2 -2
  42. package/package.json +4 -3
package/README.md CHANGED
@@ -22,6 +22,7 @@ so they can't drift as long as you install the skills with this package.
22
22
  <!-- toc -->
23
23
 
24
24
  - [Install](#install)
25
+ * [Requirements](#requirements)
25
26
  * [Install Dependency Skills](#install-dependency-skills)
26
27
  - [Workflow](#workflow)
27
28
  * [Create Issues](#create-issues)
@@ -32,12 +33,15 @@ so they can't drift as long as you install the skills with this package.
32
33
  * [Select a ticket](#select-a-ticket)
33
34
  * [Worktrees](#worktrees)
34
35
  * [Progress](#progress)
36
+ * [Integration branch](#integration-branch)
37
+ * [Review](#review)
35
38
  * [Status display](#status-display)
36
39
  - [Keep Your Machine Awake](#keep-your-machine-awake)
37
40
  * [Mac OS](#mac-os)
38
41
  + [Claude Opus 4.6](#claude-opus-46)
39
42
  + [Claude Opus 5.5](#claude-opus-55)
40
- + [Claude Sonnet 5](#claude-sonnet-5)
43
+ + [Claude Sonnet 5.5](#claude-sonnet-55)
44
+ + [Claude Haiku 5.5](#claude-haiku-55)
41
45
  + [Claude Fable 5.1](#claude-fable-51)
42
46
  + [`pi` + OpenRouter model](#pi--openrouter-model)
43
47
  + [`codex` + Luna](#codex--luna)
@@ -52,6 +56,19 @@ so they can't drift as long as you install the skills with this package.
52
56
  npm i -S nightralph
53
57
  ```
54
58
 
59
+ ### Requirements
60
+
61
+ - Node 24 or newer (see `engines` in `package.json`) and git.
62
+ - The agent CLI you name on the command line (`claude`, `codex` or
63
+ `pi`) installed and on your `PATH`. After it finds tickets,
64
+ nightralph checks for this command before it touches git, and
65
+ exits with code 2 if the command is not found. A run with no
66
+ tickets stops before the check. With `--dry-run` it prints the
67
+ problem and keeps going.
68
+ - macOS or Linux. nightralph runs agents in their own process group
69
+ and uses `sh -c` for test and install commands, so it does not
70
+ run on Windows.
71
+
55
72
  ### Install Dependency Skills
56
73
 
57
74
  ```sh
@@ -100,8 +117,8 @@ a prose text description.
100
117
  The `nightralph` CLI does the `tdd` part of the workflow: the agent
101
118
  prompt tells the agent to write a failing test per acceptance
102
119
  criterion at the seams named in the spec's Testing Decisions, and
103
- the orchestrator runs the project's test command in the worktree
104
- before a ticket can be marked `done`.
120
+ the orchestrator runs the project's test command, when there is
121
+ one, in the worktree before a ticket can be marked `done`.
105
122
 
106
123
  >
107
124
  > [!NOTE]
@@ -157,15 +174,16 @@ Flags:
157
174
  | Flag | Required | Default | Description |
158
175
  |------|----------|---------|-------------|
159
176
  | `<provider>` | yes | -- | Agent harness to spawn (e.g. `claude`, `codex`, `pi`) |
160
- | `[turns]` | no | -- | Max agentic turns per ticket (positional shorthand for `--max-turns`) |
177
+ | `[turns]` | no | -- | Max agentic turns per agent run (positional shorthand for `--max-turns`) |
161
178
  | `-m`, `--model` | no | -- | Model flag passed to the agent |
162
179
  | `--spec <name>` | no | auto | Feature name (resolves `.scratch/<name>/`) |
163
180
  | `--dry-run` | no | -- | Show wave order and prompt without running |
181
+ | `--no-review` | no | review on | Skip the review and fix pass at the end of a run |
164
182
  | `-X` | no | -- | Stop on merge conflict instead of re-spawning |
165
183
  | `--timeout` | no | `3600` | Kill the agent after N seconds. A killed agent is not a failure: its work is kept (see Notes) |
166
- | `--test-cmd <cmd>` | no | auto | Run in each worktree after the agent exits; non-zero exit rejects the ticket. Auto-detects `npm test`. Pass `""` to disable. Shares the agent's `--timeout`. Dependencies are already installed by `--install-cmd` |
184
+ | `--test-cmd <cmd>` | no | auto | Run in each worktree after the agent exits; non-zero exit rejects the ticket. Defaults to `npm test` when `package.json` has a `test` script. When nothing is detected the run has no test gate and says so at startup. Pass `""` to run without a gate. Shares the agent's `--timeout`. Dependencies are already installed by `--install-cmd` |
167
185
  | `--install-cmd <cmd>` | no | auto | Run in each fresh worktree before the agent starts, and again after a merge-conflict rebase; non-zero exit fails the attempt (it is retried like any other failure). Auto-detects from the lockfile: `pnpm-lock.yaml` -> `pnpm install --prefer-offline --frozen-lockfile`, `package-lock.json` -> `npm ci --prefer-offline --no-audit --no-fund`, a `package.json` with no lockfile -> `npm install --prefer-offline --no-audit --no-fund --no-package-lock`, no `package.json` -> no install. Pass `""` to disable. Shares the agent's `--timeout`. Output goes to `<ticket>.install.log` |
168
- | `--max-turns <n>` | no | -- | Max agentic turns per ticket. Forwarded verbatim as `--max-turns <n>` to the provider CLI. Only `claude` accepts it; `codex` and `pi` reject it as an unknown option and the agent exits immediately. Applies to every agent spawn, including a re-spawn after a merge conflict. When omitted, `claude` applies no turn limit, so `--timeout` is the only cap. Reaching the limit is an error exit, so the ticket is recorded as failed |
186
+ | `--max-turns <n>` | no | -- | Max agentic turns per agent run. Forwarded as `--max-turns <n>` to `claude` only; for `codex` and `pi` the flag is skipped with a warning and the agent runs with no turn limit. The limit is per spawn, not a total for the ticket: every retry and every re-spawn after a merge conflict starts with a fresh budget of `n` turns, so with `--retries 3` one ticket can use up to 4 x `n`. When omitted (or `0`), no limit is passed, so `--timeout` is the only cap. Takes precedence over the `[turns]` positional when both are given. Reaching the limit is an error exit, so the attempt fails and is retried like any other failure |
169
187
  | `--effort <level>` | no | -- | Starting effort/reasoning level. Each provider has its own ladder: `claude` supports `low`, `medium`, `high`, `xhigh`, `max` (forwarded as `--effort`); `codex` supports `low`, `medium`, `high` (forwarded as `-c model_reasoning_effort=<level>`); `pi` supports `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` (forwarded as `--thinking`). Omitted = provider default. Each retry steps up from here (see `--retries`) |
170
188
  | `--retries <n>` | no | `3` | Extra attempts per ticket after a failed run. Each retry starts from a fresh worktree and raises the effort level one rung (see Notes). `0` disables retries |
171
189
  | `--retry-delay <n>` | no | `30` | Seconds to wait before the first retry; doubles each further retry (30s, 60s, 120s, ...). `0` disables the wait |
@@ -184,7 +202,8 @@ Flags:
184
202
  tickets start in the next wave.
185
203
  * An agent run only counts as a success when the agent exits 0,
186
204
  its worktree branch has new commits relative to the base branch,
187
- and the test command (see `--test-cmd`) exits 0 in that worktree.
205
+ and the test command (see `--test-cmd`), when there is one, exits
206
+ 0 in that worktree.
188
207
  Uncommitted changes left by the agent are auto-committed before
189
208
  the check. On success, the ticket's status is updated to `done`
190
209
  in-place. If the agent exits 0 but made no commits, or the test
@@ -209,6 +228,20 @@ Flags:
209
228
  logs are written to `<dir>/../logs/<ticket>.attempt<n>.log`
210
229
  (and `.attempt<n>.test.log` for the test command) so the first
211
230
  attempt's log is kept.
231
+ * Each attempt at a ticket appends an entry to
232
+ `.scratch/<feature>/learnings.md`, next to `progress.md`. The
233
+ entry records what the orchestrator saw (the outcome, the agent's
234
+ exit code, the checklist items it reported, and the last lines of
235
+ the test or install log when one of those failed) and, when an
236
+ agent ran, the agent's own notes. The file is committed along with
237
+ `progress.md` and persists across runs. Each agent's prompt
238
+ includes the most
239
+ recent entries for its own ticket and the last successful entry of
240
+ each ticket that directly blocks it, so a retry can see why the
241
+ previous attempt failed. Agents keep their notes in
242
+ `.nightralph/notes.md` inside the worktree. nightralph collects
243
+ that file when the agent exits, and a self-ignoring
244
+ `.nightralph/.gitignore` keeps it out of the agent's commits.
212
245
  * A ticket that exhausts all its retry attempts is excluded from
213
246
  later waves in the same run. It stays `ready-for-agent` on disk
214
247
  so a future run can pick it up, but it will not be re-started
@@ -287,6 +320,13 @@ completes, successful branches are merged back into the base branch.
287
320
  The first branch merges directly, and subsequent branches rebase
288
321
  onto the updated base before merging.
289
322
 
323
+ Worktrees are created next to the repository, not inside it: a
324
+ ticket's worktree is the sibling directory
325
+ `<repo>.<feature>-<num>-<slug>` on the branch
326
+ `<repo>--<feature>-<num>-<slug>`. A run that is interrupted leaves
327
+ them in place; the next run removes a stale worktree and branch of
328
+ the same name before creating a new one.
329
+
290
330
  A fresh worktree has only tracked files, so there is no
291
331
  `node_modules`. Before the agent starts, the orchestrator installs
292
332
  dependencies with the command that matches the project's lockfile
@@ -304,6 +344,33 @@ A file `progress.md` is written to the `.scratch/<feature>/` directory
304
344
  and committed after each ticket completes, so you can monitor the run from
305
345
  another terminal by reading the file.
306
346
 
347
+ ### Integration branch
348
+
349
+ Launched from your default branch (`main`), nightralph does not merge
350
+ into it. It creates `nightralph--<feature>` (or `nightralph--all` for
351
+ several features), merges every ticket there, and leaves you on that
352
+ branch. Running again from `main` resumes the same branch, so finished
353
+ tickets stay finished. Launched from any other branch, it merges into
354
+ that branch.
355
+
356
+ After you merge the integration branch into `main`, the next run
357
+ fast-forwards it to `main` and resumes. If the branch has commits `main`
358
+ lacks, nightralph reports how far behind it is; merge `main` into it or
359
+ delete it with `git branch -D`.
360
+
361
+ If `.scratch/` is gitignored, the bookkeeping files (tickets, progress,
362
+ learnings, review) are force-added and live on the integration branch, so
363
+ they disappear from disk when you check out `main`.
364
+
365
+ ### Review
366
+
367
+ After the last wave, an agent reviews everything merged since the last
368
+ review and writes its findings to `.scratch/<feature>/review.md` (`.scratch/review.md`
369
+ for a multi-feature run). A
370
+ second agent fixes them test-first; its work merges only if the test
371
+ command passes. Findings it could not fix stay unchecked in
372
+ `review.md`. Skip this with `--no-review`.
373
+
307
374
  ### Status display
308
375
 
309
376
  In a terminal, nightralph shows a header line, one row per ticket, and
@@ -368,10 +435,16 @@ caffeinate -i npx nightralph claude -m claude-opus-4-6 --effort low
368
435
  ```sh
369
436
  caffeinate -i npx nightralph claude -m claude-opus-5-5 --effort low
370
437
  ```
371
- #### Claude Sonnet 5
438
+ #### Claude Sonnet 5.5
439
+
440
+ ```sh
441
+ caffeinate -i npx nightralph claude -m claude-sonnet-5-5 --effort high
442
+ ```
443
+
444
+ #### Claude Haiku 5.5
372
445
 
373
446
  ```sh
374
- caffeinate -i npx nightralph claude -m claude-sonnet-5 --effort high
447
+ caffeinate -i npx nightralph claude -m claude-haiku-5-5 --effort high
375
448
  ```
376
449
 
377
450
  #### Claude Fable 5.1