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,212 @@
1
+ # Issue Tracker Choice -- Phase 2: Tests and Phase 2 Note
2
+
3
+ **Goal:** Update existing tests for the new `setup()` signature, add tests covering both tracker paths, and write a Phase 2 future work note documenting orchestrator GitHub support.
4
+
5
+ **Architecture:** Tests follow the existing tapzero pattern with temp directories. The `makeTempProject()` helper gains a `tracker` parameter and an additional template file for GitHub. A new markdown file documents Phase 2 scope (orchestrator changes) for future implementation.
6
+
7
+ **Tech Stack:** @substrate-system/tapzero, Node fs
8
+
9
+ **Scope:** 2 phases (this is phase 2 of 2)
10
+
11
+ **Codebase verified:** 2026-08-27
12
+
13
+ ---
14
+
15
+ ## Acceptance Criteria Coverage
16
+
17
+ This phase tests:
18
+
19
+ ### issue-tracker-choice.AC1: Tracker choice prompt
20
+ - **issue-tracker-choice.AC1.2 Success:** Choosing "Local Markdown" installs the local markdown issue-tracker template to `docs/agents/issue-tracker.md`
21
+
22
+ ### issue-tracker-choice.AC2: GitHub prerequisite check
23
+ - **issue-tracker-choice.AC2.3 Success:** If `gh` is authenticated, setup installs the GitHub issue-tracker template
24
+
25
+ ### issue-tracker-choice.AC3: AGENTS.md reflects choice
26
+ - **issue-tracker-choice.AC3.1 Success:** After setup with Local Markdown, AGENTS.md issue tracker section says "local markdown files under `.scratch/`"
27
+ - **issue-tracker-choice.AC3.2 Success:** After setup with GitHub Issues, AGENTS.md issue tracker section says "GitHub Issues" with `gh` CLI reference
28
+
29
+ ### issue-tracker-choice.AC4: Template installation
30
+ - **issue-tracker-choice.AC4.1 Success:** The correct `issue-tracker.md` is installed to `docs/agents/` based on tracker choice
31
+ - **issue-tracker-choice.AC4.2 Success:** Non-tracker templates (triage-labels.md, domain.md) are still installed with idempotency checks
32
+
33
+ ---
34
+
35
+ ## Phase 2: Tests and Phase 2 Note
36
+
37
+ <!-- START_SUBCOMPONENT_A (tasks 1-4) -->
38
+
39
+ <!-- START_TASK_1 -->
40
+ ### Task 1: Update `makeTempProject` helper and existing tests
41
+
42
+ **Verifies:** issue-tracker-choice.AC4.2
43
+
44
+ **Files:**
45
+ - Modify: `test/setup.test.ts:12-53` (makeTempProject helper)
46
+ - Modify: `test/setup.test.ts:55-77` (first test -- add tracker to setup call)
47
+ - Modify: `test/setup.test.ts:79-95` (second test -- add tracker to setup call)
48
+ - Modify: `test/setup.test.ts:97-145` (third test -- add tracker to setup call)
49
+ - Modify: `test/setup.test.ts:147-165` (fourth test -- update DOC_TEMPLATES assertion)
50
+ - Modify: `test/setup.test.ts:167-189` (fifth test -- add tracker, adjust for issue-tracker behavior change)
51
+ - Modify: `test/setup.test.ts:191-235` (sixth test -- add tracker)
52
+
53
+ **Implementation:**
54
+
55
+ 1. **Update `makeTempProject`** -- add the GitHub tracker template to the temp `docsTemplatesDir`. Currently the helper creates template files for each entry in `DOC_TEMPLATES`. Since `issue-tracker.md` is no longer in `DOC_TEMPLATES`, the helper needs to create both tracker templates explicitly:
56
+ ```typescript
57
+ // After the DOC_TEMPLATES loop, add tracker templates:
58
+ writeFileSync(
59
+ join(docsTemplatesDir, 'issue-tracker.md'),
60
+ '# Issue tracker: Local Markdown'
61
+ )
62
+ writeFileSync(
63
+ join(docsTemplatesDir, 'issue-tracker-github.md'),
64
+ '# Issue tracker: GitHub'
65
+ )
66
+ ```
67
+
68
+ 2. **Update all existing `setup()` calls** -- add `tracker:'local'` to every existing test's `setup()` call to maintain backward compatibility. The `tracker` field is now required on `SetupOpts`.
69
+
70
+ 3. **Update the DOC_TEMPLATES assertion** -- the fourth test (`setup creates docs/agents/ templates`) checks all `DOC_TEMPLATES` entries exist. Since `issue-tracker.md` is no longer in `DOC_TEMPLATES`, the test should verify `triage-labels.md` and `domain.md` via the `DOC_TEMPLATES` loop, then separately verify `issue-tracker.md` exists.
71
+
72
+ 4. **Update the idempotency test** -- the "does not overwrite existing docs" test (fifth test) checks that `issue-tracker.md` is preserved. But with the new design, `issue-tracker.md` is always overwritten by the tracker choice. Update this test: the file SHOULD be overwritten (to allow tracker switching). Move the idempotency assertion to check `triage-labels.md` or `domain.md` instead, which are still preserved.
73
+
74
+ **Testing:**
75
+ Tests must verify:
76
+ - issue-tracker-choice.AC4.2: After updating, existing tests still pass -- `triage-labels.md` and `domain.md` are installed with idempotency checks
77
+
78
+ **Verification:**
79
+ Run: `npm test`
80
+ Expected: All existing tests pass (with updated assertions)
81
+
82
+ **Commit:** `test: update existing tests for tracker-aware setup`
83
+ <!-- END_TASK_1 -->
84
+
85
+ <!-- START_TASK_2 -->
86
+ ### Task 2: Add tests for local markdown tracker path
87
+
88
+ **Verifies:** issue-tracker-choice.AC1.2, issue-tracker-choice.AC4.1
89
+
90
+ **Files:**
91
+ - Modify: `test/setup.test.ts` (append new tests)
92
+
93
+ **Implementation:**
94
+
95
+ Add a test: `setup with tracker:'local' installs local issue-tracker.md`
96
+
97
+ This test should:
98
+ 1. Call `makeTempProject()` to get temp dirs
99
+ 2. Call `setup({..., tracker:'local'})`
100
+ 3. Verify `docs/agents/issue-tracker.md` exists
101
+ 4. Verify its content matches the local markdown template (starts with `# Issue tracker: Local Markdown`)
102
+
103
+ **Testing:**
104
+ Tests must verify:
105
+ - issue-tracker-choice.AC1.2: Local Markdown choice installs the local markdown template
106
+ - issue-tracker-choice.AC4.1: Installed content matches the source template
107
+
108
+ **Verification:**
109
+ Run: `npm test`
110
+ Expected: New test passes
111
+
112
+ **Commit:** `test: add local markdown tracker path test`
113
+ <!-- END_TASK_2 -->
114
+
115
+ <!-- START_TASK_3 -->
116
+ ### Task 3: Add tests for GitHub tracker path
117
+
118
+ **Verifies:** issue-tracker-choice.AC2.3, issue-tracker-choice.AC4.1
119
+
120
+ **Files:**
121
+ - Modify: `test/setup.test.ts` (append new tests)
122
+
123
+ **Implementation:**
124
+
125
+ Add a test: `setup with tracker:'github' installs github issue-tracker.md`
126
+
127
+ This test should:
128
+ 1. Call `makeTempProject()` to get temp dirs
129
+ 2. Call `setup({..., tracker:'github'})`
130
+ 3. Verify `docs/agents/issue-tracker.md` exists
131
+ 4. Verify its content matches the GitHub template (starts with `# Issue tracker: GitHub`)
132
+
133
+ **Testing:**
134
+ Tests must verify:
135
+ - issue-tracker-choice.AC2.3: GitHub choice installs the GitHub template
136
+ - issue-tracker-choice.AC4.1: Installed content matches the source template for the chosen tracker
137
+
138
+ **Verification:**
139
+ Run: `npm test`
140
+ Expected: New test passes
141
+
142
+ **Commit:** `test: add GitHub tracker path test`
143
+ <!-- END_TASK_3 -->
144
+
145
+ <!-- START_TASK_4 -->
146
+ ### Task 4: Add tests for AGENTS.md generation
147
+
148
+ **Verifies:** issue-tracker-choice.AC3.1, issue-tracker-choice.AC3.2
149
+
150
+ **Files:**
151
+ - Modify: `test/setup.test.ts` (append new tests)
152
+
153
+ **Implementation:**
154
+
155
+ Add two tests:
156
+
157
+ **Test A:** `setup with tracker:'local' writes AGENTS.md with local description`
158
+ 1. Call `makeTempProject()` and `setup({..., tracker:'local'})`
159
+ 2. Verify `AGENTS.md` exists in `projectDir`
160
+ 3. Read content and verify it contains the string `local markdown files under \`.scratch/\``
161
+
162
+ **Test B:** `setup with tracker:'github' writes AGENTS.md with github description`
163
+ 1. Call `makeTempProject()` and `setup({..., tracker:'github'})`
164
+ 2. Verify `AGENTS.md` exists in `projectDir`
165
+ 3. Read content and verify it contains the string `GitHub Issues`
166
+
167
+ **Testing:**
168
+ Tests must verify:
169
+ - issue-tracker-choice.AC3.1: Local setup produces AGENTS.md with local markdown description
170
+ - issue-tracker-choice.AC3.2: GitHub setup produces AGENTS.md with GitHub Issues description
171
+
172
+ **Verification:**
173
+ Run: `npm test`
174
+ Expected: Both new tests pass
175
+
176
+ **Commit:** `test: add AGENTS.md generation tests`
177
+ <!-- END_TASK_4 -->
178
+
179
+ <!-- END_SUBCOMPONENT_A -->
180
+
181
+ <!-- START_TASK_5 -->
182
+ ### Task 5: Write Phase 2 future work note
183
+
184
+ **Files:**
185
+ - Create: `docs/implementation-plans/2026-08-27-issue-tracker-choice/phase-2-future-work.md`
186
+
187
+ **Implementation:**
188
+
189
+ Create a markdown file documenting the scope and approach for Phase 2 -- orchestrator GitHub support. This is a planning document, not code.
190
+
191
+ The note should cover:
192
+
193
+ 1. **Goal**: Enable `nightralph <provider>` to pull tickets from GitHub Issues instead of `.scratch/` when the project is configured for GitHub tracking.
194
+
195
+ 2. **What changes in the orchestrator** (`src/orchestrator.ts`):
196
+ - `scanTickets()` currently reads `.scratch/<feature>/issues/` for numbered markdown files. It needs a GitHub-aware variant that queries `gh issue list` with JSON output.
197
+ - Status parsing: currently reads `Status:` lines from markdown. GitHub variant reads labels.
198
+ - Blocker parsing: currently reads `Blocked by:` lines. GitHub variant queries issue dependencies via `gh api`.
199
+ - Status update: currently writes `Status: done` to the file. GitHub variant runs `gh issue close`.
200
+
201
+ 3. **How to detect which tracker is in use**: Read `docs/agents/issue-tracker.md` and check the title line (`# Issue tracker: GitHub` vs `# Issue tracker: Local Markdown`).
202
+
203
+ 4. **New CLI surface**: The `--dir` and `--spec` flags assume local files. GitHub mode would use `--label` or `--milestone` to scope which issues to execute. The feature selection prompt (`resolveIssuesDir` in index.ts) would need a GitHub-aware variant.
204
+
205
+ 5. **Testing considerations**: GitHub orchestrator tests would need either a test repo or mocked `gh` output. The existing wave-based execution model (parallel independent tickets, sequential blocked ones) stays the same -- only the I/O layer changes.
206
+
207
+ **Verification:**
208
+ Run: `cat docs/implementation-plans/2026-08-27-issue-tracker-choice/phase-2-future-work.md`
209
+ Expected: File exists with the documented scope
210
+
211
+ **Commit:** `docs: add Phase 2 future work note for orchestrator GitHub support`
212
+ <!-- END_TASK_5 -->
@@ -0,0 +1,203 @@
1
+ # Test Requirements: Issue Tracker Choice
2
+
3
+ Maps each acceptance criterion to automated tests or documented human
4
+ verification.
5
+
6
+ ---
7
+
8
+ ## AC1: Tracker choice prompt
9
+
10
+ ### AC1.1: Running `nightralph setup` prompts user to choose between "GitHub Issues" and "Local Markdown"
11
+
12
+ **Verification:** Human
13
+
14
+ **Justification:** The prompt is rendered by `@inquirer/prompts` `select`
15
+ inside the CLI handler (`index.ts`). Testing it automatically would
16
+ require either spawning the CLI as a child process with piped stdin or
17
+ mocking inquirer -- both approaches test the scaffolding rather than the
18
+ actual user-facing prompt. The implementation plan notes this is "an
19
+ integration concern -- verified by running the CLI."
20
+
21
+ **Approach:**
22
+ 1. Run `node dist/index.js setup` in a terminal
23
+ 2. Verify the prompt displays "Issue tracker format" with two choices:
24
+ "Local Markdown" and "GitHub Issues"
25
+ 3. Verify arrow-key selection works and the chosen value is accepted
26
+
27
+ ---
28
+
29
+ ### AC1.2: Choosing "Local Markdown" installs the local markdown issue-tracker template
30
+
31
+ **Verification:** Automated test
32
+
33
+ - **Test type:** Integration
34
+ - **File:** `test/setup.test.ts`
35
+ - **Test name:** `setup with tracker:'local' installs local issue-tracker.md`
36
+ - **Assertions:**
37
+ 1. Call `setup({..., tracker:'local'})` with temp project dirs
38
+ 2. Assert `docs/agents/issue-tracker.md` exists in the project dir
39
+ 3. Assert its content matches the local template source
40
+ (starts with `# Issue tracker: Local Markdown` or equivalent
41
+ heading from `src/docs-templates/issue-tracker.md`)
42
+
43
+ ---
44
+
45
+ ## AC2: GitHub prerequisite check
46
+
47
+ ### AC2.1: Choosing "GitHub Issues" runs `gh auth status` and proceeds if authenticated
48
+
49
+ **Verification:** Automated test (function existence) + Human (CLI wiring)
50
+
51
+ - **Test type:** Unit
52
+ - **File:** `test/setup.test.ts`
53
+ - **Test name:** `checkGhAuth returns true when gh is authenticated`
54
+ - **Assertions:**
55
+ 1. Import `checkGhAuth` from `../src/setup.js`
56
+ 2. Call `checkGhAuth()` -- on a machine where `gh` is installed and
57
+ authenticated, assert it returns `true`
58
+
59
+ **Human verification (CLI wiring):**
60
+
61
+ The CLI handler in `index.ts` calls `checkGhAuth()` when the user
62
+ selects "GitHub Issues." This wiring is thin glue code. Verifying it
63
+ end-to-end requires running the CLI interactively.
64
+
65
+ **Approach:**
66
+ 1. Ensure `gh auth status` succeeds on the test machine
67
+ 2. Run `node dist/index.js setup`, choose "GitHub Issues"
68
+ 3. Verify setup proceeds without error and installs the GitHub template
69
+
70
+ **Note:** `checkGhAuth` is a thin wrapper around `execSync('gh auth status')`.
71
+ The implementation plan explicitly says "unit tests with mocked exec
72
+ would just test the mock." The automated test above is conditional on
73
+ the test machine having `gh` installed. On CI without `gh`, this test
74
+ should be skipped or the AC verified by human run.
75
+
76
+ ---
77
+
78
+ ### AC2.2: If `gh` is not installed or not authenticated, setup prints a message and exits with code 2
79
+
80
+ **Verification:** Human
81
+
82
+ **Justification:** The exit-with-code-2 behavior lives in `index.ts`
83
+ (the CLI handler), not in the `setup()` function. Testing `process.exit`
84
+ requires spawning a child process and inspecting its exit code. The
85
+ implementation plan describes this handler as "thin glue" best verified
86
+ by unit tests on the underlying functions plus a manual CLI run.
87
+
88
+ **Approach:**
89
+ 1. Temporarily make `gh auth status` fail (e.g., `gh auth logout` or
90
+ rename `gh` binary)
91
+ 2. Run `node dist/index.js setup`, choose "GitHub Issues"
92
+ 3. Verify the output includes "GitHub Issues requires the gh CLI"
93
+ 4. Verify the process exits with code 2 (`echo $?` shows `2`)
94
+ 5. Restore `gh` auth afterward
95
+
96
+ ---
97
+
98
+ ### AC2.3: If `gh` is authenticated, setup installs the GitHub issue-tracker template
99
+
100
+ **Verification:** Automated test
101
+
102
+ - **Test type:** Integration
103
+ - **File:** `test/setup.test.ts`
104
+ - **Test name:** `setup with tracker:'github' installs github issue-tracker.md`
105
+ - **Assertions:**
106
+ 1. Call `setup({..., tracker:'github'})` with temp project dirs
107
+ (the helper provides both `issue-tracker.md` and
108
+ `issue-tracker-github.md` in the temp templates dir)
109
+ 2. Assert `docs/agents/issue-tracker.md` exists in the project dir
110
+ 3. Assert its content matches the GitHub template source
111
+ (starts with `# Issue tracker: GitHub` or equivalent heading
112
+ from `src/docs-templates/issue-tracker-github.md`)
113
+
114
+ ---
115
+
116
+ ## AC3: AGENTS.md reflects choice
117
+
118
+ ### AC3.1: After setup with Local Markdown, AGENTS.md says "local markdown files under `.scratch/`"
119
+
120
+ **Verification:** Automated test
121
+
122
+ - **Test type:** Integration
123
+ - **File:** `test/setup.test.ts`
124
+ - **Test name:** `setup with tracker:'local' writes AGENTS.md with local description`
125
+ - **Assertions:**
126
+ 1. Call `setup({..., tracker:'local'})` with temp project dirs
127
+ 2. Assert `AGENTS.md` exists in the project dir
128
+ 3. Read its content and assert it contains the substring
129
+ `local markdown files under \`.scratch/\``
130
+
131
+ ---
132
+
133
+ ### AC3.2: After setup with GitHub Issues, AGENTS.md says "GitHub Issues" with `gh` CLI reference
134
+
135
+ **Verification:** Automated test
136
+
137
+ - **Test type:** Integration
138
+ - **File:** `test/setup.test.ts`
139
+ - **Test name:** `setup with tracker:'github' writes AGENTS.md with github description`
140
+ - **Assertions:**
141
+ 1. Call `setup({..., tracker:'github'})` with temp project dirs
142
+ 2. Assert `AGENTS.md` exists in the project dir
143
+ 3. Read its content and assert it contains the substring
144
+ `GitHub Issues` and a reference to `gh`
145
+
146
+ ---
147
+
148
+ ## AC4: Template installation
149
+
150
+ ### AC4.1: The correct `issue-tracker.md` is installed to `docs/agents/` based on tracker choice
151
+
152
+ **Verification:** Automated test
153
+
154
+ - **Test type:** Integration
155
+ - **File:** `test/setup.test.ts`
156
+ - **Covered by:** The AC1.2 and AC2.3 tests above (local and GitHub
157
+ tracker path tests). Each verifies that `docs/agents/issue-tracker.md`
158
+ receives the content from the correct source template. No separate
159
+ test needed -- the two tracker-path tests together cover this criterion
160
+ exhaustively.
161
+
162
+ ---
163
+
164
+ ### AC4.2: Non-tracker templates (triage-labels.md, domain.md) are still installed with idempotency checks
165
+
166
+ **Verification:** Automated test
167
+
168
+ - **Test type:** Integration
169
+ - **File:** `test/setup.test.ts`
170
+ - **Covered by:** Two existing tests, updated to pass `tracker:'local'`:
171
+ 1. `setup creates docs/agents/ templates` -- iterates `DOC_TEMPLATES`
172
+ (now `['triage-labels.md', 'domain.md']`) and asserts each exists.
173
+ Also separately asserts `issue-tracker.md` exists.
174
+ 2. `setup does not overwrite existing docs` -- pre-creates
175
+ `triage-labels.md` (or `domain.md`) with custom content, runs
176
+ setup, asserts the custom content is preserved. (The old test
177
+ checked `issue-tracker.md` for idempotency, but that file is now
178
+ always overwritten by tracker choice. The assertion moves to a
179
+ non-tracker template.)
180
+ 3. `setup is idempotent` -- runs setup twice, asserts all templates
181
+ still exist after the second run.
182
+
183
+ ---
184
+
185
+ ## Summary
186
+
187
+ | AC | Automated | Human | Test file |
188
+ |-------|-----------|-------|------------------------|
189
+ | AC1.1 | | Yes | -- |
190
+ | AC1.2 | Yes | | `test/setup.test.ts` |
191
+ | AC2.1 | Partial | Yes | `test/setup.test.ts` |
192
+ | AC2.2 | | Yes | -- |
193
+ | AC2.3 | Yes | | `test/setup.test.ts` |
194
+ | AC3.1 | Yes | | `test/setup.test.ts` |
195
+ | AC3.2 | Yes | | `test/setup.test.ts` |
196
+ | AC4.1 | Yes | | `test/setup.test.ts` |
197
+ | AC4.2 | Yes | | `test/setup.test.ts` |
198
+
199
+ Seven of ten acceptance criteria are fully covered by automated
200
+ integration tests. AC2.1 has partial automated coverage (function
201
+ existence and return value) with human verification for CLI wiring.
202
+ AC1.1 and AC2.2 require human verification because they test interactive
203
+ CLI behavior and process exit codes in the thin handler layer.
package/docs/skills.md ADDED
@@ -0,0 +1,58 @@
1
+ # Skill/CLI Drift
2
+
3
+ Prevent version drift by bundling the CLI & skill definitions.
4
+
5
+ ## Background
6
+
7
+ We see [nightshift](https://github.com/Shaurya-Sethi/nightshift/), which uses
8
+ the [Pocock skills](https://github.com/mattpocock/skills/). And reading the
9
+ docs for each, we see that the CLI has already drifted from the current version
10
+ of the skills.
11
+
12
+ The Pocock workflow is
13
+
14
+ ```
15
+ grill -> to-spec -> to-tickets -> tdd
16
+ ```
17
+
18
+ The upstream
19
+ [`grill-with-docs`](https://github.com/mattpocock/skills/blob/main/skills/engineering/grill-with-docs/SKILL.md)
20
+ skill is exposed as `/grill`. It is a composite that calls the upstream
21
+ `grilling` and `domain-modeling` sub-skills, which are also bundled.
22
+
23
+ `to-tickets` will create many issues fwiu. We need to be able to start many
24
+ `tdd` sessions, preferably in parallel as much as possible.
25
+
26
+ ## Issues
27
+
28
+ The `nightshift` CLI I think is hardcoded to GH issues, and we want
29
+ local markdown. Need the Pocock skills to create local markdown.
30
+
31
+ ### Solution
32
+
33
+ Seed `docs/agents/issue-tracker.md` via `npx` runnable script.
34
+
35
+ Should include a script that can be executed with `npmx`, like
36
+ `npmx nightralph setup`.
37
+
38
+ #### Example `issue-tracker.md`
39
+
40
+ This is an example config for `docs/agents/issue-tracker.md`:
41
+
42
+ ```
43
+ # Issue Tracker Config
44
+
45
+ Where issues live: local markdown files under .scratch/ in this repo.
46
+
47
+ ---
48
+
49
+ ## Conventions
50
+
51
+ - One feature per directory: .scratch/<feature-name>/
52
+ - Implementation issues are stored as one file per ticket at
53
+ `.scratch/<feature-name>/issues/NN-<name>.md`.
54
+ - When publishing to the issue tracker: Write markdown files under
55
+ `.scratch/<feature-name>/issues/`.
56
+ - When fetching a ticket: Read the file at the referenced path
57
+ under `.scratch/`.
58
+ ```
@@ -0,0 +1,95 @@
1
+ # Issue Tracker Choice -- Human Test Plan
2
+
3
+ ## Prerequisites
4
+
5
+ - Node.js installed; project built (`npm run build` produces `dist/`)
6
+ - `npm test` passes (66 assertions in setup.test.ts, 54 in
7
+ orchestrator.test.ts)
8
+ - `gh` CLI installed and authenticated (`gh auth status` succeeds) for
9
+ GitHub Issues tests
10
+ - A throwaway directory or git branch to avoid polluting a real project
11
+
12
+ ## Phase 1: Interactive Prompt Verification (AC1.1)
13
+
14
+ | Step | Action | Expected |
15
+ |------|--------|----------|
16
+ | 1 | Open a terminal, `cd` to a clean temp directory | Working directory is empty or has a basic package.json |
17
+ | 2 | Run `node <path-to-nightralph>/dist/index.js setup` | An interactive prompt appears: "Issue tracker format" |
18
+ | 3 | Observe the choices listed | Two choices appear: "Local Markdown" (with description "Issues as .md files in .scratch/") and "GitHub Issues" (with description "Issues via gh CLI") |
19
+ | 4 | Press up/down arrow keys | Highlighted selection moves between the two choices |
20
+ | 5 | Highlight "Local Markdown" and press Enter | Prompt accepts the selection. Setup proceeds, printing "Installing skills to .agents/skills/" and listing installed files |
21
+ | 6 | Verify `docs/agents/issue-tracker.md` was created | File exists, content starts with the local markdown template heading |
22
+ | 7 | Verify `AGENTS.md` was created | File exists, contains "local markdown files under `.scratch/`" |
23
+
24
+ ## Phase 2: GitHub Issues -- Authenticated Path (AC2.1, AC2.3)
25
+
26
+ | Step | Action | Expected |
27
+ |------|--------|----------|
28
+ | 1 | Confirm `gh auth status` succeeds (exit code 0) | Output shows authenticated user and active account |
29
+ | 2 | Remove any previous setup output (`rm -rf .agents docs AGENTS.md`) | Clean state |
30
+ | 3 | Run `node <path-to-nightralph>/dist/index.js setup` | Prompt appears |
31
+ | 4 | Select "GitHub Issues" and press Enter | No error message. Setup proceeds normally |
32
+ | 5 | Verify `docs/agents/issue-tracker.md` was created | File exists, content matches the GitHub template (heading references GitHub) |
33
+ | 6 | Verify `AGENTS.md` contains "GitHub Issues" and a reference to `gh` | The issue tracker section reads: "Issues are tracked via GitHub Issues using the `gh` CLI." |
34
+
35
+ ## Phase 3: GitHub Issues -- Unauthenticated Path (AC2.2)
36
+
37
+ | Step | Action | Expected |
38
+ |------|--------|----------|
39
+ | 1 | Make `gh auth status` fail. Option A: run `gh auth logout`. Option B: temporarily rename the `gh` binary (`which gh`, then `mv` it) | `gh auth status` now fails or `gh` is not found |
40
+ | 2 | Remove any previous setup output | Clean state |
41
+ | 3 | Run `node <path-to-nightralph>/dist/index.js setup` | Prompt appears |
42
+ | 4 | Select "GitHub Issues" and press Enter | Error message printed: "GitHub Issues requires the gh CLI, authenticated." followed by install/login instructions |
43
+ | 5 | Check exit code: `echo $?` | Exit code is `2` |
44
+ | 6 | Verify no `docs/agents/issue-tracker.md` was created | File does not exist -- setup aborted before template installation |
45
+ | 7 | Restore `gh` authentication (`gh auth login`) or rename the binary back | `gh auth status` succeeds again |
46
+
47
+ ## End-to-End: Full Tracker Switching Scenario
48
+
49
+ **Purpose:** Validates that a user can set up with one tracker, then
50
+ re-run setup to switch to the other, and all artifacts reflect the new
51
+ choice.
52
+
53
+ | Step | Action | Expected |
54
+ |------|--------|----------|
55
+ | 1 | Clean temp directory | Empty |
56
+ | 2 | Run `node <path>/dist/index.js setup`, select "Local Markdown" | Setup completes. `AGENTS.md` mentions local markdown, `issue-tracker.md` has local template content |
57
+ | 3 | Run `node <path>/dist/index.js setup` again, select "GitHub Issues" (requires authenticated `gh`) | Setup completes without error |
58
+ | 4 | Read `docs/agents/issue-tracker.md` | Content now matches the GitHub template -- local template content is gone |
59
+ | 5 | Read `AGENTS.md` | Now says "GitHub Issues using the `gh` CLI" -- no mention of "local markdown files" |
60
+ | 6 | Verify `docs/agents/triage-labels.md` and `docs/agents/domain.md` still exist | Non-tracker templates preserved across re-runs |
61
+
62
+ ## End-to-End: --claude Flag with Tracker Choice
63
+
64
+ **Purpose:** Validates that the `--claude` flag works correctly alongside
65
+ tracker selection.
66
+
67
+ | Step | Action | Expected |
68
+ |------|--------|----------|
69
+ | 1 | Clean temp directory | Empty |
70
+ | 2 | Run `node <path>/dist/index.js setup --claude`, select "Local Markdown" | Setup completes. Skills installed to both `.agents/skills/` and `.claude/skills/` |
71
+ | 3 | Verify `.claude/skills/<skill>` entries are symlinks | Each is a symlink pointing to `../../.agents/skills/<skill>` |
72
+ | 4 | Verify `docs/agents/issue-tracker.md` has local template content | Tracker choice unaffected by --claude flag |
73
+ | 5 | Run setup again with --claude, select "GitHub Issues" | Symlinks remain valid. `issue-tracker.md` now has GitHub content |
74
+
75
+ ## Human Verification Required
76
+
77
+ | Criterion | Why Manual | Steps |
78
+ |-----------|-----------|-------|
79
+ | AC1.1: Prompt displays two choices | Tests the interactive `@inquirer/prompts` `select` UI, which requires a real TTY. Mocking would test the mock, not the prompt. | Phase 1, steps 2-5 |
80
+ | AC2.1: CLI wiring calls `checkGhAuth` on "GitHub Issues" selection | The automated test confirms the function exists; the CLI handler glue (`index.ts` lines 46-55) is thin code best verified by running | Phase 2, steps 3-4 |
81
+ | AC2.2: Unauthenticated `gh` prints error and exits with code 2 | `process.exit(2)` lives in the CLI handler; testing requires a child process with inspected exit code | Phase 3, steps 4-5 |
82
+
83
+ ## Traceability
84
+
85
+ | Acceptance Criterion | Automated Test | Manual Step |
86
+ |----------------------|----------------|-------------|
87
+ | AC1.1: Prompt with two choices | -- | Phase 1, steps 2-5 |
88
+ | AC1.2: Local Markdown installs local template | `setup with tracker:local copies local markdown template` | Phase 1, step 6 |
89
+ | AC2.1: checkGhAuth when authenticated | `checkGhAuth exists and is callable` (partial) | Phase 2, steps 3-4 |
90
+ | AC2.2: Unauthenticated exits with code 2 | -- | Phase 3, steps 4-6 |
91
+ | AC2.3: GitHub Issues installs GitHub template | `setup with tracker:github copies github template` | Phase 2, step 5 |
92
+ | AC3.1: AGENTS.md local markdown text | `setup creates AGENTS.md with local markdown text` | Phase 1, step 7 |
93
+ | AC3.2: AGENTS.md GitHub Issues text | `setup creates AGENTS.md with GitHub Issues text` | Phase 2, step 6 |
94
+ | AC4.1: Correct template per choice | AC1.2 + AC2.3 tests + tracker-switching test | Switching scenario, steps 2-5 |
95
+ | AC4.2: Non-tracker templates + idempotency | `setup creates docs/agents/ templates` + `setup does not overwrite non-tracker docs` + `setup is idempotent` | Switching scenario, step 6 |