nightralph 0.0.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.
Files changed (101) hide show
  1. package/.claude/settings.local.json +5 -0
  2. package/AGENTS.md +60 -0
  3. package/CLAUDE.md +1 -0
  4. package/PROMPT.md +95 -0
  5. package/README.md +138 -0
  6. package/WIP.md +5 -0
  7. package/dist/docs-templates/domain.md +36 -0
  8. package/dist/docs-templates/issue-tracker-github.md +228 -0
  9. package/dist/docs-templates/issue-tracker.md +30 -0
  10. package/dist/docs-templates/triage-labels.md +15 -0
  11. package/dist/index.js +154 -0
  12. package/dist/index.js.map +7 -0
  13. package/dist/meta.json +207 -0
  14. package/dist/orchestrator.js +273 -0
  15. package/dist/orchestrator.js.map +7 -0
  16. package/dist/resolve.js +71 -0
  17. package/dist/resolve.js.map +7 -0
  18. package/dist/setup.js +151 -0
  19. package/dist/setup.js.map +7 -0
  20. package/dist/skills/domain-modeling/ADR-FORMAT.md +47 -0
  21. package/dist/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  22. package/dist/skills/domain-modeling/SKILL.md +74 -0
  23. package/dist/skills/domain-modeling/agents/openai.yaml +3 -0
  24. package/dist/skills/grill/SKILL.md +7 -0
  25. package/dist/skills/grill/agents/openai.yaml +5 -0
  26. package/dist/skills/grilling/SKILL.md +28 -0
  27. package/dist/skills/grilling/agents/openai.yaml +3 -0
  28. package/dist/skills/tdd/SKILL.md +38 -0
  29. package/dist/skills/tdd/agents/openai.yaml +3 -0
  30. package/dist/skills/tdd/mocking.md +59 -0
  31. package/dist/skills/tdd/tests.md +77 -0
  32. package/dist/skills/to-spec/SKILL.md +75 -0
  33. package/dist/skills/to-spec/agents/openai.yaml +5 -0
  34. package/dist/skills/to-tickets/SKILL.md +105 -0
  35. package/dist/skills/to-tickets/agents/openai.yaml +5 -0
  36. package/dist/skills/upstream.json +5 -0
  37. package/dist/src/index.d.ts +4 -0
  38. package/dist/src/index.d.ts.map +1 -0
  39. package/dist/src/orchestrator.d.ts +31 -0
  40. package/dist/src/orchestrator.d.ts.map +1 -0
  41. package/dist/src/resolve.d.ts +10 -0
  42. package/dist/src/resolve.d.ts.map +1 -0
  43. package/dist/src/setup.d.ts +13 -0
  44. package/dist/src/setup.d.ts.map +1 -0
  45. package/dist/test/integration.test.js +848 -0
  46. package/dist/test/integration.test.js.map +7 -0
  47. package/dist/test/orchestrator.test.js +749 -0
  48. package/dist/test/orchestrator.test.js.map +7 -0
  49. package/dist/test/setup.test.js +574 -0
  50. package/dist/test/setup.test.js.map +7 -0
  51. package/docs/README.md +12 -0
  52. package/docs/agents/domain.md +36 -0
  53. package/docs/agents/issue-tracker.md +30 -0
  54. package/docs/agents/triage-labels.md +15 -0
  55. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase-2-future-work.md +144 -0
  56. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase_01.md +292 -0
  57. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase_02.md +212 -0
  58. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/test-requirements.md +203 -0
  59. package/docs/skills.md +58 -0
  60. package/docs/test-plans/2026-08-27-issue-tracker-choice.md +95 -0
  61. package/eslint.config.js +142 -0
  62. package/lib.es5.d.ts +19 -0
  63. package/package.json +36 -0
  64. package/progress.log +190 -0
  65. package/ralph_claude.sh +263 -0
  66. package/scripts/clone-skills.sh +52 -0
  67. package/specs/prd.json +172 -0
  68. package/src/docs-templates/domain.md +36 -0
  69. package/src/docs-templates/issue-tracker-github.md +228 -0
  70. package/src/docs-templates/issue-tracker.md +30 -0
  71. package/src/docs-templates/triage-labels.md +15 -0
  72. package/src/index.ts +184 -0
  73. package/src/orchestrator.ts +324 -0
  74. package/src/resolve.ts +73 -0
  75. package/src/setup.ts +157 -0
  76. package/src/skills/domain-modeling/ADR-FORMAT.md +47 -0
  77. package/src/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  78. package/src/skills/domain-modeling/SKILL.md +74 -0
  79. package/src/skills/domain-modeling/agents/openai.yaml +3 -0
  80. package/src/skills/grill/SKILL.md +7 -0
  81. package/src/skills/grill/agents/openai.yaml +5 -0
  82. package/src/skills/grilling/SKILL.md +28 -0
  83. package/src/skills/grilling/agents/openai.yaml +3 -0
  84. package/src/skills/tdd/SKILL.md +38 -0
  85. package/src/skills/tdd/agents/openai.yaml +3 -0
  86. package/src/skills/tdd/mocking.md +59 -0
  87. package/src/skills/tdd/tests.md +77 -0
  88. package/src/skills/to-spec/SKILL.md +75 -0
  89. package/src/skills/to-spec/agents/openai.yaml +5 -0
  90. package/src/skills/to-tickets/SKILL.md +105 -0
  91. package/src/skills/to-tickets/agents/openai.yaml +5 -0
  92. package/src/skills/upstream.json +5 -0
  93. package/tasks/prd-integration-test-coverage.md +243 -0
  94. package/test/integration.test.ts +636 -0
  95. package/test/mock-agent-echo-args.js +4 -0
  96. package/test/mock-agent-fail.js +3 -0
  97. package/test/mock-agent-pass.js +3 -0
  98. package/test/orchestrator.test.ts +609 -0
  99. package/test/setup.test.ts +417 -0
  100. package/tsconfig.build.json +7 -0
  101. package/tsconfig.json +31 -0
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: to-tickets
3
+ description: Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker (edges as text in one file per ticket locally, or native blocking links on a real tracker).
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # To Tickets
8
+
9
+ Break a plan, spec, or conversation into a set of **tickets**: tracer-bullet vertical slices, each declaring the tickets that **block** it.
10
+
11
+ The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
12
+
13
+ ## Process
14
+
15
+ ### 1. Gather context
16
+
17
+ Work from whatever is already in the conversation context. If the user passes a reference (a spec path, an issue number or URL) as an argument, fetch it and read its full body and comments.
18
+
19
+ ### 2. Explore the codebase (optional)
20
+
21
+ If you have not already explored the codebase, do so to understand the current state of the code. Ticket titles and descriptions should use the project's domain glossary vocabulary, and respect ADRs in the area you're touching.
22
+
23
+ Look for opportunities to prefactor the code to make the implementation easier. "Make the change easy, then make the easy change."
24
+
25
+ ### 3. Draft vertical slices
26
+
27
+ Break the work into **tracer bullet** tickets.
28
+
29
+ <vertical-slice-rules>
30
+
31
+ - Each slice cuts a narrow but COMPLETE path through every layer (schema, API, UI, tests): vertical, NOT a horizontal slice of one layer
32
+ - A completed slice is demoable or verifiable on its own
33
+ - Each slice is sized to fit in a single fresh context window
34
+ - Any prefactoring should be done first
35
+
36
+ </vertical-slice-rules>
37
+
38
+ Give each ticket its **blocking edges**: the other tickets that must complete before it can start. A ticket with no blockers can start immediately.
39
+
40
+ **Wide refactors are the exception to vertical slicing.** A **wide refactor** is one mechanical change (rename a column, retype a shared symbol) whose **blast radius** fans across the whole codebase, so a single edit breaks thousands of call sites at once and no vertical slice can land green. Don't force it into a tracer bullet; sequence it as **expand–contract**. First expand: add the new form beside the old so nothing breaks. Then migrate the call sites over in batches sized by blast radius (per package, per directory), each batch its own ticket blocked by the expand, keeping CI green batch to batch because the old form still exists. Finally contract: delete the old form once no caller remains, in a ticket blocked by every migrate batch. When even the batches can't stay green alone, keep the sequence but let them share an integration branch that all block a final integrate-and-verify ticket; green is promised only there.
41
+
42
+ ### 4. Quiz the user
43
+
44
+ Present the proposed breakdown as a numbered list. For each ticket, show:
45
+
46
+ - **Title**: short descriptive name
47
+ - **Blocked by**: which other tickets (if any) must complete first
48
+ - **What it delivers**: the end-to-end behaviour this ticket makes work
49
+
50
+ Ask the user:
51
+
52
+ - Does the granularity feel right? (too coarse / too fine)
53
+ - Are the blocking edges correct: does each ticket only depend on tickets that genuinely gate it?
54
+ - Should any tickets be merged or split further?
55
+
56
+ Iterate until the user approves the breakdown.
57
+
58
+ ### 5. Publish the tickets to the configured tracker
59
+
60
+ Publish the approved tickets. **How** depends on the tracker `/setup-matt-pocock-skills` configured; the tickets are the same either way, only the shape of the blocking edges changes:
61
+
62
+ - **Local files** → write one file per ticket under `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01` in dependency order (blockers first). Each file's "Blocked by" lists the numbers/titles it depends on. Use the per-ticket file template below: one ticket per file, never a single combined file.
63
+ - **A real issue tracker (GitHub, Linear, …)** → publish one issue per ticket in dependency order (blockers first) so each ticket's blocking edges can reference real identifiers. Use the platform's native blocking / sub-issue relationship where it has one; otherwise set each ticket's "Blocked by" to the blocking issues. Apply the `ready-for-agent` triage label unless instructed otherwise; the tickets are agent-grabbable by construction.
64
+
65
+ Work the **frontier**: any ticket whose blockers are all done. For a purely linear chain that means top to bottom.
66
+
67
+ Do NOT close or modify any parent issue.
68
+
69
+ <local-ticket-template>
70
+
71
+ # <NN>: <Ticket title>
72
+
73
+ **What to build:** the end-to-end behaviour this ticket makes work, from the user's perspective, not a layer-by-layer implementation list.
74
+
75
+ **Blocked by:** the numbers/titles of the tickets that gate this one, or "None (can start immediately)".
76
+
77
+ **Status:** ready-for-agent
78
+
79
+ - [ ] Acceptance criterion 1
80
+ - [ ] Acceptance criterion 2
81
+
82
+ </local-ticket-template>
83
+
84
+ <issue-template>
85
+
86
+ ## Parent
87
+
88
+ A reference to the parent issue on the tracker (if the source was an existing issue, otherwise omit this section).
89
+
90
+ ## What to build
91
+
92
+ The end-to-end behaviour this ticket makes work, from the user's perspective, not layer-by-layer implementation.
93
+
94
+ ## Acceptance criteria
95
+
96
+ - [ ] Criterion 1
97
+ - [ ] Criterion 2
98
+
99
+ ## Blocked by
100
+
101
+ - A reference to each blocking ticket, or "None (can start immediately)".
102
+
103
+ </issue-template>
104
+
105
+ In either form, avoid specific file paths or code snippets: they go stale fast. Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it and note briefly that it came from a prototype. Trim to the decision-rich parts, not a working demo, just the important bits.
@@ -0,0 +1,5 @@
1
+ interface:
2
+ display_name: "To Tickets"
3
+ short_description: "Split a plan into tracer-bullet tickets"
4
+ policy:
5
+ allow_implicit_invocation: false
@@ -0,0 +1,5 @@
1
+ {
2
+ "repo": "mattpocock/skills",
3
+ "commit": "6654f6b",
4
+ "pulledAt": "2026-08-26"
5
+ }
@@ -0,0 +1,243 @@
1
+ # PRD: Integration Test Coverage
2
+
3
+ ## Introduction
4
+
5
+ The nightralph test suite has solid unit coverage for parsing,
6
+ wave scheduling, and setup scaffolding, but nothing validates that
7
+ the CLI commands actually work end-to-end. The CLI layer
8
+ (`src/index.ts`) is completely untested, the `setup` and execute
9
+ commands are never tested in composition, and `spawnAgent` is only
10
+ exercised through trivial mock scripts. This PRD defines the
11
+ integration tests needed to close those gaps and give confidence
12
+ that `npx nightralph setup` followed by
13
+ `npx nightralph claude -m <model>` works on real issue docs.
14
+
15
+ ## Goals
16
+
17
+ - Validate the full CLI path via subprocess (`node dist/index.js`)
18
+ - Prove that `setup` output feeds correctly into the execute command
19
+ - Test `findFeatureDirs` and `resolveIssuesDir` with realistic
20
+ directory layouts
21
+ - Test `dryRun` output (wave order, deadlock warnings, prompt preview)
22
+ - Test the unknown-blocker warning/stripping logic in `runExecute`
23
+ - All new tests use mock agent scripts -- no real `claude` invocation
24
+
25
+ ## User Stories
26
+
27
+ ### US-001: Subprocess CLI smoke test for execute
28
+
29
+ **Description:** As a developer, I want a test that spawns
30
+ `node dist/index.js <provider>` as a child process so that I know
31
+ the yargs wiring, argument parsing, and file resolution work
32
+ end-to-end.
33
+
34
+ **Acceptance Criteria:**
35
+
36
+ - [ ] Test spawns the built CLI with `--dir`, `--spec`, and
37
+ `--timeout-secs` pointing at a temp directory with ticket files
38
+ - [ ] Uses the existing `mock-agent-pass.js` as the provider argument
39
+ - [ ] Asserts exit code 0
40
+ - [ ] Asserts ticket files on disk are updated to `**Status:** done`
41
+ - [ ] Asserts log files are created in the expected location
42
+ - [ ] Typecheck/lint passes
43
+
44
+ ### US-002: Subprocess CLI test for `--dry-run`
45
+
46
+ **Description:** As a developer, I want a test that runs the CLI
47
+ with `--dry-run` so that I know the dry-run path works through yargs
48
+ and produces the expected output.
49
+
50
+ **Acceptance Criteria:**
51
+
52
+ - [ ] Test spawns the built CLI with `--dry-run`, `--dir`, and
53
+ `--spec`
54
+ - [ ] Captures stdout
55
+ - [ ] Asserts output contains "Wave 1:" with the expected ticket
56
+ filenames
57
+ - [ ] Asserts output contains "AGENT INSTRUCTIONS" (prompt preview)
58
+ - [ ] Asserts ticket files on disk are NOT modified
59
+ - [ ] Typecheck/lint passes
60
+
61
+ ### US-003: Subprocess CLI test for `--model` flag
62
+
63
+ **Description:** As a developer, I want to verify that `--model`
64
+ (or `-m`) is passed through to the spawned agent process so that
65
+ running `npx nightralph claude -m claude-sonnet-4-6` actually
66
+ forwards the model argument.
67
+
68
+ **Acceptance Criteria:**
69
+
70
+ - [ ] Create a new mock agent script (`mock-agent-echo-args.js`)
71
+ that writes `process.argv` to stdout, then exits 0
72
+ - [ ] Test spawns the CLI with `-m test-model` using this mock agent
73
+ - [ ] Asserts the log file contains `--model` and `test-model` in
74
+ the captured argv
75
+ - [ ] Typecheck/lint passes
76
+
77
+ ### US-004: `findFeatureDirs` returns correct structure
78
+
79
+ **Description:** As a developer, I want direct tests for
80
+ `findFeatureDirs` so that feature directory discovery is validated
81
+ independently.
82
+
83
+ **Acceptance Criteria:**
84
+
85
+ - [ ] Export `findFeatureDirs` from `src/index.ts` (or extract to a
86
+ shared module) so it can be imported in tests
87
+ - [ ] Test: returns empty array when `.scratch/` does not exist
88
+ - [ ] Test: returns empty array when `.scratch/` has directories
89
+ without `issues/` subdirs
90
+ - [ ] Test: returns entries with correct `name`, `dir`, and `spec`
91
+ paths for valid feature dirs
92
+ - [ ] Test: ignores non-directory entries in `.scratch/`
93
+ - [ ] Typecheck/lint passes
94
+
95
+ ### US-005: `resolveIssuesDir` with explicit flags
96
+
97
+ **Description:** As a developer, I want to verify that when both
98
+ `--dir` and `--spec` are provided, `resolveIssuesDir` returns them
99
+ directly without scanning `.scratch/`.
100
+
101
+ **Acceptance Criteria:**
102
+
103
+ - [ ] Export `resolveIssuesDir` (or extract to a shared module)
104
+ - [ ] Test: returns `{ dir, spec }` exactly as given when both
105
+ flags are provided
106
+ - [ ] No filesystem scanning occurs (the temp dir has no `.scratch/`)
107
+ - [ ] Typecheck/lint passes
108
+
109
+ ### US-006: Setup-then-execute composition test
110
+
111
+ **Description:** As a developer, I want a test that runs `setup`,
112
+ then creates issue files in the expected `.scratch/` layout, then
113
+ runs `execute` -- proving the two commands compose correctly.
114
+
115
+ **Acceptance Criteria:**
116
+
117
+ - [ ] Test calls `setup()` with `tracker:'local'` in a temp project dir
118
+ - [ ] Creates `.scratch/<feature>/issues/` with 2 ticket files and
119
+ a `spec.md`
120
+ - [ ] Spawns the CLI as a subprocess pointing at that project dir
121
+ (using the mock agent)
122
+ - [ ] Asserts tickets are marked done
123
+ - [ ] Asserts logs are written to `.scratch/<feature>/logs/`
124
+ - [ ] Asserts `docs/agents/issue-tracker.md` exists (from setup)
125
+ - [ ] Asserts `.agents/skills/` directories exist (from setup)
126
+ - [ ] Typecheck/lint passes
127
+
128
+ ### US-007: Unknown blocker warning and stripping
129
+
130
+ **Description:** As a developer, I want to verify that `runExecute`
131
+ warns about blockers referencing nonexistent ticket numbers and
132
+ strips them so execution proceeds.
133
+
134
+ **Acceptance Criteria:**
135
+
136
+ - [ ] Test creates a ticket with `**Blocked by:** 99` where ticket
137
+ 99 does not exist
138
+ - [ ] Spawns the CLI as a subprocess
139
+ - [ ] Asserts stderr/stdout contains a warning mentioning
140
+ blocker `99`
141
+ - [ ] Asserts the ticket still completes (blocker was stripped)
142
+ - [ ] Typecheck/lint passes
143
+
144
+ ### US-008: Dry-run deadlock detection
145
+
146
+ **Description:** As a developer, I want the dry-run to report
147
+ deadlocked tickets (circular dependencies) so users can fix their
148
+ ticket graph before running real agents.
149
+
150
+ **Acceptance Criteria:**
151
+
152
+ - [ ] Test creates two tickets that block each other (1 blocks 2,
153
+ 2 blocks 1)
154
+ - [ ] Spawns the CLI with `--dry-run`
155
+ - [ ] Asserts output contains "Deadlocked tickets" with both
156
+ filenames
157
+ - [ ] Typecheck/lint passes
158
+
159
+ ### US-009: CLI exits with error when no tickets found
160
+
161
+ **Description:** As a developer, I want to verify the CLI handles
162
+ the empty-directory edge case gracefully.
163
+
164
+ **Acceptance Criteria:**
165
+
166
+ - [ ] Test points `--dir` at an empty directory
167
+ - [ ] Asserts stdout contains "No ticket files found"
168
+ - [ ] Asserts exit code 0 (graceful, not a crash)
169
+ - [ ] Typecheck/lint passes
170
+
171
+ ### US-010: CLI exits with error for missing dir/spec
172
+
173
+ **Description:** As a developer, I want the CLI to fail clearly
174
+ when `--dir` or `--spec` point to nonexistent paths.
175
+
176
+ **Acceptance Criteria:**
177
+
178
+ - [ ] Test passes `--dir /nonexistent/path` with a valid `--spec`
179
+ - [ ] Asserts exit code is non-zero
180
+ - [ ] Asserts stderr contains "not found"
181
+ - [ ] Test passes valid `--dir` with `--spec /nonexistent/spec.md`
182
+ - [ ] Asserts exit code is non-zero
183
+ - [ ] Asserts stderr contains "not found"
184
+ - [ ] Typecheck/lint passes
185
+
186
+ ## Functional Requirements
187
+
188
+ - FR-1: All new integration tests must use subprocess spawning
189
+ (`node dist/index.js`) to exercise the full CLI path including
190
+ yargs parsing
191
+ - FR-2: All tests must use mock agent scripts, never the real
192
+ `claude` CLI
193
+ - FR-3: A new mock agent script `mock-agent-echo-args.js` must be
194
+ created to validate argument forwarding
195
+ - FR-4: `findFeatureDirs` and `resolveIssuesDir` must be exported
196
+ (or extracted to a testable module) for direct unit tests
197
+ - FR-5: Tests must create and clean up temp directories -- no
198
+ shared mutable state between tests
199
+ - FR-6: The composition test (US-006) must call `setup()` as a
200
+ library function, then spawn the CLI for execute, proving the
201
+ two stages connect
202
+ - FR-7: All tests must pass `npm test` (build + run)
203
+
204
+ ## Non-Goals
205
+
206
+ - No tests that invoke the real `claude` CLI or require
207
+ authentication
208
+ - No tests for the interactive `@inquirer/prompts` select flows
209
+ (these require TTY)
210
+ - No tests for `checkGhAuth()` (depends on external `gh` CLI state)
211
+ - No performance or load testing
212
+ - No changes to the existing unit test files
213
+
214
+ ## Technical Considerations
215
+
216
+ - The CLI must be built (`npm run build`) before subprocess tests
217
+ run -- the test script already does this
218
+ - Subprocess tests should set a short `--timeout-secs` (e.g. 10)
219
+ to avoid hanging
220
+ - `findFeatureDirs` currently uses `process.cwd()` -- it will need
221
+ a `cwd` parameter to be testable, or the tests can set `CWD` via
222
+ subprocess env
223
+ - The test file should be `test/integration.test.ts` to keep it
224
+ separate from the existing unit tests
225
+ - Mock agent scripts live in `test/` alongside existing
226
+ `mock-agent-pass.js` and `mock-agent-fail.js`
227
+
228
+ ## Success Metrics
229
+
230
+ - Running `npm test` exercises the full CLI path through subprocess
231
+ - The `--model` flag is provably forwarded to the agent process
232
+ - The setup -> execute composition is tested in a single test
233
+ - Dry-run output is validated (wave order, deadlocks, prompt preview)
234
+ - Edge cases (empty dir, missing paths, unknown blockers) are covered
235
+
236
+ ## Open Questions
237
+
238
+ - Should `findFeatureDirs` accept a `cwd` parameter, or should
239
+ tests set `process.cwd()` via subprocess working directory? The
240
+ subprocess approach avoids changing the function signature but
241
+ is less direct for unit testing.
242
+ - Should the integration tests live in `test/integration.test.ts`
243
+ or `test/cli.test.ts`?