nightralph 0.0.2 → 0.0.3

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 (93) hide show
  1. package/README.md +106 -33
  2. package/dist/index.js +80 -22
  3. package/dist/index.js.map +2 -2
  4. package/dist/merge.js +194 -0
  5. package/dist/merge.js.map +7 -0
  6. package/dist/meta.json +183 -17
  7. package/dist/orchestrator.js +459 -44
  8. package/dist/orchestrator.js.map +2 -2
  9. package/dist/progress.js +164 -0
  10. package/dist/progress.js.map +7 -0
  11. package/dist/resolve.js +16 -8
  12. package/dist/resolve.js.map +2 -2
  13. package/dist/setup.js +33 -5
  14. package/dist/setup.js.map +2 -2
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/merge.d.ts +25 -0
  17. package/dist/src/merge.d.ts.map +1 -0
  18. package/dist/src/orchestrator.d.ts +27 -3
  19. package/dist/src/orchestrator.d.ts.map +1 -1
  20. package/dist/src/progress.d.ts +27 -0
  21. package/dist/src/progress.d.ts.map +1 -0
  22. package/dist/src/resolve.d.ts +2 -1
  23. package/dist/src/resolve.d.ts.map +1 -1
  24. package/dist/src/setup.d.ts +1 -0
  25. package/dist/src/setup.d.ts.map +1 -1
  26. package/dist/src/worktree.d.ts +18 -0
  27. package/dist/src/worktree.d.ts.map +1 -0
  28. package/dist/worktree.js +139 -0
  29. package/dist/worktree.js.map +7 -0
  30. package/package.json +8 -4
  31. package/.claude/settings.local.json +0 -5
  32. package/.github/dependabot.yml +0 -28
  33. package/.github/workflows/nodejs.yml +0 -30
  34. package/AGENTS.md +0 -60
  35. package/CLAUDE.md +0 -1
  36. package/PROMPT.md +0 -95
  37. package/WIP.md +0 -5
  38. package/dist/test/integration.test.js +0 -848
  39. package/dist/test/integration.test.js.map +0 -7
  40. package/dist/test/orchestrator.test.js +0 -749
  41. package/dist/test/orchestrator.test.js.map +0 -7
  42. package/dist/test/setup.test.js +0 -574
  43. package/dist/test/setup.test.js.map +0 -7
  44. package/docs/README.md +0 -12
  45. package/docs/agents/domain.md +0 -36
  46. package/docs/agents/issue-tracker.md +0 -30
  47. package/docs/agents/triage-labels.md +0 -15
  48. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase-2-future-work.md +0 -144
  49. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase_01.md +0 -292
  50. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase_02.md +0 -212
  51. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/test-requirements.md +0 -203
  52. package/docs/skills.md +0 -58
  53. package/docs/test-plans/2026-08-27-issue-tracker-choice.md +0 -95
  54. package/eslint.config.js +0 -142
  55. package/lib.es5.d.ts +0 -19
  56. package/progress.log +0 -190
  57. package/ralph_claude.sh +0 -263
  58. package/scripts/clone-skills.sh +0 -52
  59. package/specs/prd.json +0 -172
  60. package/src/docs-templates/domain.md +0 -36
  61. package/src/docs-templates/issue-tracker-github.md +0 -228
  62. package/src/docs-templates/issue-tracker.md +0 -30
  63. package/src/docs-templates/triage-labels.md +0 -15
  64. package/src/index.ts +0 -184
  65. package/src/orchestrator.ts +0 -324
  66. package/src/resolve.ts +0 -73
  67. package/src/setup.ts +0 -157
  68. package/src/skills/domain-modeling/ADR-FORMAT.md +0 -47
  69. package/src/skills/domain-modeling/CONTEXT-FORMAT.md +0 -60
  70. package/src/skills/domain-modeling/SKILL.md +0 -74
  71. package/src/skills/domain-modeling/agents/openai.yaml +0 -3
  72. package/src/skills/grill/SKILL.md +0 -7
  73. package/src/skills/grill/agents/openai.yaml +0 -5
  74. package/src/skills/grilling/SKILL.md +0 -28
  75. package/src/skills/grilling/agents/openai.yaml +0 -3
  76. package/src/skills/tdd/SKILL.md +0 -38
  77. package/src/skills/tdd/agents/openai.yaml +0 -3
  78. package/src/skills/tdd/mocking.md +0 -59
  79. package/src/skills/tdd/tests.md +0 -77
  80. package/src/skills/to-spec/SKILL.md +0 -75
  81. package/src/skills/to-spec/agents/openai.yaml +0 -5
  82. package/src/skills/to-tickets/SKILL.md +0 -105
  83. package/src/skills/to-tickets/agents/openai.yaml +0 -5
  84. package/src/skills/upstream.json +0 -5
  85. package/tasks/prd-integration-test-coverage.md +0 -243
  86. package/test/integration.test.ts +0 -636
  87. package/test/mock-agent-echo-args.js +0 -4
  88. package/test/mock-agent-fail.js +0 -3
  89. package/test/mock-agent-pass.js +0 -3
  90. package/test/orchestrator.test.ts +0 -609
  91. package/test/setup.test.ts +0 -417
  92. package/tsconfig.build.json +0 -7
  93. package/tsconfig.json +0 -31
@@ -1,243 +0,0 @@
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`?