anvil-dev-framework 0.1.6

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 (190) hide show
  1. package/README.md +719 -0
  2. package/VERSION +1 -0
  3. package/docs/ANVIL-REPO-IMPLEMENTATION-PLAN.md +441 -0
  4. package/docs/FIRST-SKILL-TUTORIAL.md +408 -0
  5. package/docs/INSTALLATION-RETRO-NOTES.md +458 -0
  6. package/docs/INSTALLATION.md +984 -0
  7. package/docs/anvil-hud.md +469 -0
  8. package/docs/anvil-init.md +255 -0
  9. package/docs/anvil-state.md +210 -0
  10. package/docs/boris-cherny-ralph-wiggum-insights.md +608 -0
  11. package/docs/command-reference.md +2022 -0
  12. package/docs/hooks-tts.md +368 -0
  13. package/docs/implementation-guide.md +810 -0
  14. package/docs/linear-github-integration.md +247 -0
  15. package/docs/local-issues.md +677 -0
  16. package/docs/patterns/README.md +419 -0
  17. package/docs/planning-responsibilities.md +139 -0
  18. package/docs/session-workflow.md +573 -0
  19. package/docs/simplification-plan-template.md +297 -0
  20. package/docs/simplification-principles.md +129 -0
  21. package/docs/specifications/CCS-RALPH-INTEGRATION-DESIGN.md +633 -0
  22. package/docs/specifications/CCS-RESEARCH-REPORT.md +169 -0
  23. package/docs/specifications/PLAN-ANV-verification-ralph-wiggum.md +403 -0
  24. package/docs/specifications/PLAN-parallel-tracks-anvil-memory-ccs.md +494 -0
  25. package/docs/specifications/SPEC-ANV-VRW/component-01-verify.md +208 -0
  26. package/docs/specifications/SPEC-ANV-VRW/component-02-stop-gate.md +226 -0
  27. package/docs/specifications/SPEC-ANV-VRW/component-03-posttooluse.md +209 -0
  28. package/docs/specifications/SPEC-ANV-VRW/component-04-ralph-wiggum.md +604 -0
  29. package/docs/specifications/SPEC-ANV-VRW/component-05-atomic-actions.md +311 -0
  30. package/docs/specifications/SPEC-ANV-VRW/component-06-verify-subagent.md +264 -0
  31. package/docs/specifications/SPEC-ANV-VRW/component-07-claude-md.md +363 -0
  32. package/docs/specifications/SPEC-ANV-VRW/index.md +182 -0
  33. package/docs/specifications/SPEC-ANV-anvil-memory.md +573 -0
  34. package/docs/specifications/SPEC-ANV-context-checkpoints.md +781 -0
  35. package/docs/specifications/SPEC-ANV-verification-ralph-wiggum.md +789 -0
  36. package/docs/sync.md +122 -0
  37. package/global/CLAUDE.md +140 -0
  38. package/global/agents/verify-app.md +164 -0
  39. package/global/commands/anvil-settings.md +527 -0
  40. package/global/commands/anvil-sync.md +121 -0
  41. package/global/commands/change.md +197 -0
  42. package/global/commands/clarify.md +252 -0
  43. package/global/commands/cleanup.md +292 -0
  44. package/global/commands/commit-push-pr.md +207 -0
  45. package/global/commands/decay-review.md +127 -0
  46. package/global/commands/discover.md +158 -0
  47. package/global/commands/doc-coverage.md +122 -0
  48. package/global/commands/evidence.md +307 -0
  49. package/global/commands/explore.md +121 -0
  50. package/global/commands/force-exit.md +135 -0
  51. package/global/commands/handoff.md +191 -0
  52. package/global/commands/healthcheck.md +302 -0
  53. package/global/commands/hud.md +84 -0
  54. package/global/commands/insights.md +319 -0
  55. package/global/commands/linear-setup.md +184 -0
  56. package/global/commands/lint-fix.md +198 -0
  57. package/global/commands/orient.md +510 -0
  58. package/global/commands/plan.md +228 -0
  59. package/global/commands/ralph.md +346 -0
  60. package/global/commands/ready.md +182 -0
  61. package/global/commands/release.md +305 -0
  62. package/global/commands/retro.md +96 -0
  63. package/global/commands/shard.md +166 -0
  64. package/global/commands/spec.md +227 -0
  65. package/global/commands/sprint.md +184 -0
  66. package/global/commands/tasks.md +228 -0
  67. package/global/commands/test-and-commit.md +151 -0
  68. package/global/commands/validate.md +132 -0
  69. package/global/commands/verify.md +251 -0
  70. package/global/commands/weekly-review.md +156 -0
  71. package/global/hooks/__pycache__/ralph_context_monitor.cpython-314.pyc +0 -0
  72. package/global/hooks/__pycache__/statusline_agent_sync.cpython-314.pyc +0 -0
  73. package/global/hooks/anvil_memory_observe.ts +322 -0
  74. package/global/hooks/anvil_memory_session.ts +166 -0
  75. package/global/hooks/anvil_memory_stop.ts +187 -0
  76. package/global/hooks/parse_transcript.py +116 -0
  77. package/global/hooks/post_merge_cleanup.sh +132 -0
  78. package/global/hooks/post_tool_format.sh +215 -0
  79. package/global/hooks/ralph_context_monitor.py +240 -0
  80. package/global/hooks/ralph_stop.sh +502 -0
  81. package/global/hooks/statusline.sh +1110 -0
  82. package/global/hooks/statusline_agent_sync.py +224 -0
  83. package/global/hooks/stop_gate.sh +250 -0
  84. package/global/lib/.claude/anvil-state.json +21 -0
  85. package/global/lib/__pycache__/agent_registry.cpython-314.pyc +0 -0
  86. package/global/lib/__pycache__/claim_service.cpython-314.pyc +0 -0
  87. package/global/lib/__pycache__/coderabbit_service.cpython-314.pyc +0 -0
  88. package/global/lib/__pycache__/config_service.cpython-314.pyc +0 -0
  89. package/global/lib/__pycache__/coordination_service.cpython-314.pyc +0 -0
  90. package/global/lib/__pycache__/doc_coverage_service.cpython-314.pyc +0 -0
  91. package/global/lib/__pycache__/gate_logger.cpython-314.pyc +0 -0
  92. package/global/lib/__pycache__/github_service.cpython-314.pyc +0 -0
  93. package/global/lib/__pycache__/hygiene_service.cpython-314.pyc +0 -0
  94. package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
  95. package/global/lib/__pycache__/issue_provider.cpython-314.pyc +0 -0
  96. package/global/lib/__pycache__/linear_data_service.cpython-314.pyc +0 -0
  97. package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
  98. package/global/lib/__pycache__/local_provider.cpython-314.pyc +0 -0
  99. package/global/lib/__pycache__/quality_service.cpython-314.pyc +0 -0
  100. package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
  101. package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
  102. package/global/lib/__pycache__/transcript_parser.cpython-314.pyc +0 -0
  103. package/global/lib/__pycache__/verification_runner.cpython-314.pyc +0 -0
  104. package/global/lib/__pycache__/verify_iteration.cpython-314.pyc +0 -0
  105. package/global/lib/__pycache__/verify_subagent.cpython-314.pyc +0 -0
  106. package/global/lib/agent_registry.py +995 -0
  107. package/global/lib/anvil-state.sh +435 -0
  108. package/global/lib/claim_service.py +515 -0
  109. package/global/lib/coderabbit_service.py +314 -0
  110. package/global/lib/config_service.py +423 -0
  111. package/global/lib/coordination_service.py +331 -0
  112. package/global/lib/doc_coverage_service.py +1305 -0
  113. package/global/lib/gate_logger.py +316 -0
  114. package/global/lib/github_service.py +310 -0
  115. package/global/lib/handoff_generator.py +775 -0
  116. package/global/lib/hygiene_service.py +712 -0
  117. package/global/lib/issue_models.py +257 -0
  118. package/global/lib/issue_provider.py +339 -0
  119. package/global/lib/linear_data_service.py +210 -0
  120. package/global/lib/linear_provider.py +987 -0
  121. package/global/lib/linear_provider.py.backup +671 -0
  122. package/global/lib/local_provider.py +486 -0
  123. package/global/lib/orient_fast.py +457 -0
  124. package/global/lib/quality_service.py +470 -0
  125. package/global/lib/ralph_prompt_generator.py +563 -0
  126. package/global/lib/ralph_state.py +1202 -0
  127. package/global/lib/state_manager.py +417 -0
  128. package/global/lib/transcript_parser.py +597 -0
  129. package/global/lib/verification_runner.py +557 -0
  130. package/global/lib/verify_iteration.py +490 -0
  131. package/global/lib/verify_subagent.py +250 -0
  132. package/global/skills/README.md +155 -0
  133. package/global/skills/quality-gates/SKILL.md +252 -0
  134. package/global/skills/skill-template/SKILL.md +109 -0
  135. package/global/skills/testing-strategies/SKILL.md +337 -0
  136. package/global/templates/CHANGE-template.md +105 -0
  137. package/global/templates/HANDOFF-template.md +63 -0
  138. package/global/templates/PLAN-template.md +111 -0
  139. package/global/templates/SPEC-template.md +93 -0
  140. package/global/templates/ralph/PROMPT.md.template +89 -0
  141. package/global/templates/ralph/fix_plan.md.template +31 -0
  142. package/global/templates/ralph/progress.txt.template +23 -0
  143. package/global/tests/__pycache__/test_doc_coverage.cpython-314.pyc +0 -0
  144. package/global/tests/test_doc_coverage.py +520 -0
  145. package/global/tests/test_issue_models.py +299 -0
  146. package/global/tests/test_local_provider.py +323 -0
  147. package/global/tools/README.md +178 -0
  148. package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
  149. package/global/tools/anvil-hud.py +3622 -0
  150. package/global/tools/anvil-hud.py.bak +3318 -0
  151. package/global/tools/anvil-issue.py +432 -0
  152. package/global/tools/anvil-memory/CLAUDE.md +49 -0
  153. package/global/tools/anvil-memory/README.md +42 -0
  154. package/global/tools/anvil-memory/bun.lock +25 -0
  155. package/global/tools/anvil-memory/bunfig.toml +9 -0
  156. package/global/tools/anvil-memory/package.json +23 -0
  157. package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +535 -0
  158. package/global/tools/anvil-memory/src/__tests__/ccs/edge-cases.test.ts +645 -0
  159. package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +363 -0
  160. package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +8 -0
  161. package/global/tools/anvil-memory/src/__tests__/ccs/integration.test.ts +417 -0
  162. package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +571 -0
  163. package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +440 -0
  164. package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +252 -0
  165. package/global/tools/anvil-memory/src/__tests__/commands.test.ts +657 -0
  166. package/global/tools/anvil-memory/src/__tests__/db.test.ts +641 -0
  167. package/global/tools/anvil-memory/src/__tests__/hooks.test.ts +272 -0
  168. package/global/tools/anvil-memory/src/__tests__/performance.test.ts +427 -0
  169. package/global/tools/anvil-memory/src/__tests__/test-utils.ts +113 -0
  170. package/global/tools/anvil-memory/src/commands/checkpoint.ts +197 -0
  171. package/global/tools/anvil-memory/src/commands/get.ts +115 -0
  172. package/global/tools/anvil-memory/src/commands/init.ts +94 -0
  173. package/global/tools/anvil-memory/src/commands/observe.ts +163 -0
  174. package/global/tools/anvil-memory/src/commands/search.ts +112 -0
  175. package/global/tools/anvil-memory/src/db.ts +638 -0
  176. package/global/tools/anvil-memory/src/index.ts +205 -0
  177. package/global/tools/anvil-memory/src/types.ts +122 -0
  178. package/global/tools/anvil-memory/tsconfig.json +29 -0
  179. package/global/tools/ralph-loop.sh +359 -0
  180. package/package.json +45 -0
  181. package/scripts/anvil +822 -0
  182. package/scripts/extract_patterns.py +222 -0
  183. package/scripts/init-project.sh +541 -0
  184. package/scripts/install.sh +229 -0
  185. package/scripts/postinstall.js +41 -0
  186. package/scripts/rollback.sh +188 -0
  187. package/scripts/sync.sh +623 -0
  188. package/scripts/test-statusline.sh +248 -0
  189. package/scripts/update_claude_md.py +224 -0
  190. package/scripts/verify.sh +255 -0
@@ -0,0 +1,228 @@
1
+ # /tasks - Create Linear Sub-Issues from Plan
2
+
3
+ > Generate Linear sub-issues from an approved implementation plan, nested under a parent feature issue.
4
+
5
+ ## When to Use
6
+ - After implementation plan is approved
7
+ - To break work into trackable sub-issues under a parent feature
8
+ - Before starting implementation
9
+
10
+ ## Pre-Flight: Check Linear Configuration
11
+
12
+ **CRITICAL**: Before creating issues, verify project configuration.
13
+
14
+ ```bash
15
+ if [ -f ".claude/linear.yaml" ]; then
16
+ TEAM_KEY=$(grep "team_key:" .claude/linear.yaml | cut -d'"' -f2)
17
+ TEAM_ID=$(grep "team_id:" .claude/linear.yaml | cut -d'"' -f2)
18
+ echo "Creating issues in team: $TEAM_KEY"
19
+ else
20
+ echo "⚠️ LINEAR NOT CONFIGURED"
21
+ echo "Run /linear-setup first"
22
+ exit 1
23
+ fi
24
+ ```
25
+
26
+ **If no linear.yaml**: Stop and prompt user to run `/linear-setup`. Do NOT create issues.
27
+
28
+ ## Prerequisites
29
+ - Implementation plan created and approved (`/plan`)
30
+ - **Parent feature issue exists in Linear** (e.g., ANV-5)
31
+ - Linear team configured in `.claude/linear.yaml`
32
+ - Clear understanding of task scope
33
+
34
+ ## Execution Steps
35
+
36
+ ### Step 1: Identify Parent Issue
37
+ Check if the plan references a parent Linear issue:
38
+ - Look for `linear_issue:` in spec frontmatter
39
+ - Or ask user which issue should be the parent
40
+
41
+ **Example Spec Reference:**
42
+ ```yaml
43
+ ---
44
+ spec_id: SPEC-001
45
+ linear_issue: ANV-5 # Parent issue for sub-tasks
46
+ ---
47
+ ```
48
+
49
+ ### Step 2: Review Implementation Plan
50
+ Read the approved plan:
51
+ - Identify all phases
52
+ - Note task dependencies
53
+ - Understand acceptance criteria per phase
54
+
55
+ ### Step 3: Create Sub-Issues Under Parent
56
+
57
+ For each phase, create a Linear **sub-issue** using the CLI with `--parent`:
58
+
59
+ **Linear CLI Reference (IMPORTANT):**
60
+
61
+ | Command | Option | Note |
62
+ |---------|--------|------|
63
+ | `create-issue` | `--team` | Team UUID (required) |
64
+ | | `--title` | Issue title (required) |
65
+ | | `--description` | Issue description |
66
+ | | `--parent` | Parent issue UUID (for sub-issues) |
67
+ | `update-issue` | `--id` | Issue ID like "ANV-12" (required) |
68
+ | | `--state` | State UUID (not state name!) |
69
+ | | `--parent` | Parent issue UUID |
70
+
71
+ > **Common Mistakes:**
72
+ > - Use `list-issues` not `list_issues` (hyphens, not underscores)
73
+ > - Use `--team` not `--team-id`
74
+ > - Use `--status` to filter by state name, `--state` for state UUID
75
+
76
+ **Create sub-issue:**
77
+ ```bash
78
+ python3 scripts/linear.py create-issue \
79
+ --team "TEAM_UUID" \
80
+ --title "[PARENT-ID] Phase 1: Core Implementation" \
81
+ --description "..." \
82
+ --parent "PARENT_ISSUE_UUID"
83
+ ```
84
+
85
+ **Update existing issue to become sub-issue:**
86
+ ```bash
87
+ python3 scripts/linear.py update-issue \
88
+ --id "ANV-12" \
89
+ --parent "parent-issue-uuid"
90
+ ```
91
+
92
+ **Issue Title Convention:**
93
+ ```
94
+ [PARENT-ID] Phase N: [Brief description]
95
+ ```
96
+ Example: `[ANV-5] Phase 1: Core Script & Directory Structure`
97
+
98
+ **Issue Description Template:**
99
+ ```markdown
100
+ ## Goal
101
+ [What this phase accomplishes]
102
+
103
+ ## Tasks
104
+ - [ ] [Task 1]
105
+ - [ ] [Task 2]
106
+
107
+ ## Acceptance Criteria
108
+ - [ ] [Criterion 1]
109
+ - [ ] [Criterion 2]
110
+
111
+ ## References
112
+ - Parent: [PARENT-ID]
113
+ - Spec: .claude/specs/current/SPEC-[id].md
114
+ - Plan: .claude/specs/current/PLAN-[id].md
115
+ ```
116
+
117
+ ### Step 4: Set Dependencies
118
+ Use Linear's "blocked by" relationships:
119
+ - Phase 2 blocked by Phase 1
120
+ - Phase 3 blocked by Phase 2
121
+ - Testing blocked by implementation phases
122
+
123
+ ### Step 5: Report Created Sub-Issues
124
+
125
+ Output:
126
+ ```
127
+ ## Linear Sub-Issues Created — [team_key]
128
+
129
+ ### Parent Issue: [TEAM]-XX ([Title])
130
+
131
+ ### From Plan: PLAN-[id]
132
+
133
+ | Sub-Issue | Title | Priority | Estimate | Blocked By |
134
+ |-----------|-------|----------|----------|------------|
135
+ | [TEAM]-101 | [PARENT] Phase 1: [Name] | P1 | 2h | - |
136
+ | [TEAM]-102 | [PARENT] Phase 2: [Name] | P2 | 3h | [TEAM]-101 |
137
+ | [TEAM]-103 | [PARENT] Testing & Polish | P2 | 2h | [TEAM]-102 |
138
+
139
+ **Total estimated**: X hours
140
+ **Ready to start**: [TEAM]-101 (unblocked)
141
+
142
+ ### Issue Links
143
+ - Parent: [TEAM]-XX: [Linear URL]
144
+ - [TEAM]-101: [Linear URL] (sub-issue)
145
+ - [TEAM]-102: [Linear URL] (sub-issue)
146
+ - [TEAM]-103: [Linear URL] (sub-issue)
147
+
148
+ **Next Step**: Run `/validate` then begin work on [TEAM]-101.
149
+ ```
150
+
151
+ ## Error: Linear Not Configured
152
+
153
+ If linear.yaml is missing, output:
154
+
155
+ ```
156
+ ## Create Tasks — ⚠️ Linear Not Configured
157
+
158
+ This project is not mapped to a Linear team.
159
+
160
+ **To configure:**
161
+ 1. Run `/linear-setup` to select or create a team
162
+ 2. Then run `/tasks` again
163
+
164
+ Cannot create issues without team configuration.
165
+ ```
166
+
167
+ ## Task Sizing Guidelines
168
+
169
+ | Size | Hours | Description |
170
+ |------|-------|-------------|
171
+ | XS | <1h | Trivial change, single file |
172
+ | S | 1-2h | Small feature, few files |
173
+ | M | 2-4h | Standard feature, multiple files |
174
+ | L | 4-8h | Complex feature, consider splitting |
175
+ | XL | >8h | **Must split** into smaller tasks |
176
+
177
+ If a task is XL, return to `/plan` and break it down further.
178
+
179
+ ## Key Behaviors
180
+ - **ALWAYS check linear.yaml first** — create issues in correct team only
181
+ - **ALWAYS create as sub-issues** — nest under parent feature issue for clean board organization
182
+ - Each task should be 1-4 hours of work
183
+ - Always set blocking dependencies
184
+ - Include acceptance criteria in description
185
+ - Link back to parent issue, spec, and plan
186
+ - Set appropriate priority based on sequence
187
+ - Use `--parent` flag when creating issues via CLI
188
+
189
+ ## Anti-Patterns
190
+ - ❌ Creating top-level issues instead of sub-issues (clutters board)
191
+ - ❌ Creating issues without checking linear.yaml
192
+ - ❌ Tasks larger than 8 hours
193
+ - ❌ Missing dependencies (creates confusion)
194
+ - ❌ Vague acceptance criteria
195
+ - ❌ No reference to parent/spec/plan
196
+
197
+ ## State Sync (ANV-176)
198
+
199
+ After creating the Linear issues, update the session state:
200
+
201
+ ```bash
202
+ python3 global/lib/state_manager.py tasks
203
+ ```
204
+
205
+ This updates `.claude/anvil-state.json` with:
206
+ - `phase: "tasks"`
207
+ - Sets `lastCommand: "/tasks"`
208
+
209
+ And syncs to the agent registry for statusline visibility.
210
+
211
+ ## GitHub Auto-Update Note
212
+
213
+ Issues created via `/tasks` will **automatically move to Done** when their associated PR is merged, thanks to Linear's GitHub integration. You don't need to manually update issue status after PR merge.
214
+
215
+ **How it works:**
216
+ - Include the issue key in your PR title: `feat(api): add endpoint (ANV-123)`
217
+ - When the PR is merged, Linear detects the issue key and moves the issue to Done
218
+
219
+ See [Linear-GitHub Integration Guide](../../docs/linear-github-integration.md) for details.
220
+
221
+ ## Integration Points
222
+ - Requires: `.claude/linear.yaml` (team configuration)
223
+ - Requires: Parent issue ID from spec's `linear_issue:` field
224
+ - Follows: `/plan` implementation planning
225
+ - Uses: Linear CLI (`create-issue --parent` or `update-issue --parent`)
226
+ - Precedes: Implementation work
227
+ - References: `.claude/specs/current/PLAN-*.md`
228
+ - Note: Issues auto-update to Done on PR merge (via GitHub integration)
@@ -0,0 +1,151 @@
1
+ # /test-and-commit - Test Then Commit
2
+
3
+ > Run tests, and if passing, commit changes.
4
+
5
+ ## When to Use
6
+ - When you've made changes and want to commit safely
7
+ - Before pushing to ensure tests pass
8
+ - For quick inner-loop development
9
+
10
+ ## Why This Matters
11
+ Committing without testing leads to:
12
+ - Broken builds on CI
13
+ - Wasted PR review cycles
14
+ - Teammates pulling broken code
15
+
16
+ **Rule**: Never commit untested code.
17
+
18
+ ## Arguments
19
+
20
+ | Argument | Required | Description |
21
+ |----------|----------|-------------|
22
+ | `message` | Yes | Commit message (conventional format) |
23
+
24
+ ## Execution Steps
25
+
26
+ ### Step 1: Verify Preconditions
27
+ ```bash
28
+ # Check we're in a git repo
29
+ git rev-parse --git-dir > /dev/null 2>&1 || exit 1
30
+
31
+ # Check there are changes to commit
32
+ git diff --cached --quiet && git diff --quiet && echo "No changes to commit" && exit 0
33
+ ```
34
+
35
+ **If not a git repo**: Stop with error
36
+ **If no changes**: Report "No changes to commit" and exit
37
+
38
+ ### Step 2: Run Test Suite
39
+
40
+ Detect and run the appropriate test command:
41
+ ```bash
42
+ # Detect test runner
43
+ if [ -f "package.json" ]; then
44
+ npm test
45
+ elif [ -f "pytest.ini" ] || [ -f "pyproject.toml" ]; then
46
+ pytest
47
+ elif [ -f "Cargo.toml" ]; then
48
+ cargo test
49
+ elif [ -f "go.mod" ]; then
50
+ go test ./...
51
+ else
52
+ echo "No test runner detected"
53
+ exit 1
54
+ fi
55
+ ```
56
+
57
+ **Capture**: Exit code and output
58
+
59
+ ### Step 3: Evaluate Results
60
+
61
+ **If tests pass** (exit 0):
62
+ - Proceed to Step 4
63
+
64
+ **If tests fail** (exit non-zero):
65
+ ```
66
+ ❌ Tests failed
67
+
68
+ Failing tests:
69
+ - [file:line] - [error description]
70
+ - [file:line] - [error description]
71
+
72
+ No commit created. Fix tests first.
73
+ ```
74
+ - Stop execution, do NOT commit
75
+
76
+ ### Step 4: Create Commit
77
+
78
+ ```bash
79
+ # Stage all changes
80
+ git add .
81
+
82
+ # Create commit with provided message
83
+ git commit -m "[message]"
84
+ ```
85
+
86
+ ### Step 5: Report Success
87
+
88
+ ```
89
+ ✅ Tests passed ([N] tests)
90
+ ✅ Committed: [message]
91
+ [hash] - [N] files changed, [+] insertions(+), [-] deletions(-)
92
+ ```
93
+
94
+ ## Usage Examples
95
+
96
+ ### Basic Usage
97
+ ```
98
+ /test-and-commit "feat: add user authentication"
99
+ ```
100
+
101
+ ### With Conventional Commit Types
102
+ ```
103
+ /test-and-commit "fix: resolve null pointer in login flow"
104
+ /test-and-commit "chore: update dependencies"
105
+ /test-and-commit "refactor: extract validation logic"
106
+ ```
107
+
108
+ ## Success Output
109
+ ```
110
+ ✅ Tests passed (47 tests)
111
+ ✅ Committed: feat: add user authentication
112
+ abc1234 - 3 files changed, 145 insertions(+), 23 deletions(-)
113
+ ```
114
+
115
+ ## Failure Output
116
+ ```
117
+ ❌ Tests failed (2 failures)
118
+
119
+ Failing tests:
120
+ - src/auth/login.test.ts:45 - Expected 200, got 401
121
+ - src/auth/login.test.ts:67 - Timeout after 5000ms
122
+
123
+ No commit created. Fix tests first.
124
+ ```
125
+
126
+ ## Error Handling
127
+
128
+ | Error | Response |
129
+ |-------|----------|
130
+ | Not a git repo | "Error: Not a git repository" |
131
+ | No changes | "No changes to commit" |
132
+ | Tests fail | List failures, no commit |
133
+ | No test runner | "Error: No test runner detected" |
134
+
135
+ ## Anti-Patterns
136
+ - ❌ Committing without running tests
137
+ - ❌ Ignoring test failures ("I'll fix it later")
138
+ - ❌ Using generic commit messages ("fix stuff")
139
+ - ❌ Skipping tests with `--skip-tests` flag (there isn't one)
140
+
141
+ ## Key Behaviors
142
+ - **Atomic**: Either both test AND commit succeed, or neither happens
143
+ - **Informative**: Always show test count and commit details
144
+ - **Conventional**: Enforce conventional commit format
145
+ - **Safe**: Never leave partial state
146
+
147
+ ## Integration Points
148
+ - Used with: `/commit-push-pr` for full workflow
149
+ - Alternative to: Manual `npm test && git commit`
150
+ - Follows: Development work
151
+ - Precedes: Push to remote
@@ -0,0 +1,132 @@
1
+ # /validate - Environment Validation Checkpoint
2
+
3
+ > Verify environment is ready before making any code changes.
4
+
5
+ ## When to Use
6
+ - **Always** before starting implementation
7
+ - After pulling changes from remote
8
+ - After switching branches
9
+ - When something feels "off"
10
+
11
+ ## Why This is Non-Negotiable
12
+ Agents are non-deterministic. Without validation:
13
+ - You might build on a dirty working directory
14
+ - Dependencies might be out of sync
15
+ - Tests might already be failing
16
+ - You might be on the wrong branch
17
+
18
+ **If ANY check fails, STOP. Do not proceed.**
19
+
20
+ ## Execution Steps
21
+
22
+ ### Step 1: Check Git Status
23
+ ```bash
24
+ git status
25
+ ```
26
+
27
+ **Expected**: Working directory clean, or only expected changes
28
+ **If dirty**: Either commit, stash, or understand why before proceeding
29
+
30
+ ### Step 2: Check Branch
31
+ ```bash
32
+ git branch --show-current
33
+ ```
34
+
35
+ **Expected**: On feature branch, not `main`
36
+ **If on main**: Create feature branch before making changes
37
+
38
+ ### Step 3: Sync Dependencies
39
+ ```bash
40
+ npm ci
41
+ ```
42
+
43
+ **Expected**: Clean install from lockfile
44
+ **If fails**: Resolve dependency issues before proceeding
45
+
46
+ ### Step 4: Run Type Check
47
+ ```bash
48
+ npm run typecheck
49
+ ```
50
+
51
+ **Expected**: 0 errors
52
+ **If fails**: Fix type errors before adding more code
53
+
54
+ ### Step 5: Run Tests
55
+ ```bash
56
+ npm test
57
+ ```
58
+
59
+ **Expected**: All tests pass
60
+ **If fails**: Understand why—are these pre-existing failures or did something break?
61
+
62
+ ### Step 6: Run Lint
63
+ ```bash
64
+ npm run lint
65
+ ```
66
+
67
+ **Expected**: 0 errors (warnings acceptable)
68
+ **If fails**: Fix lint errors before proceeding
69
+
70
+ ### Step 7: Report Validation Results
71
+
72
+ Output format:
73
+ ```
74
+ ## Environment Validation
75
+
76
+ | Check | Status | Details |
77
+ |-------|--------|---------|
78
+ | Git Status | ✅ | Clean |
79
+ | Branch | ✅ | feature/ENG-123-new-feature |
80
+ | Dependencies | ✅ | Installed from lockfile |
81
+ | TypeScript | ✅ | 0 errors |
82
+ | Tests | ✅ | 47 passed |
83
+ | Lint | ✅ | 0 errors |
84
+
85
+ **Result**: ✅ Environment validated. Ready to proceed.
86
+ ```
87
+
88
+ Or if failures:
89
+ ```
90
+ ## Environment Validation
91
+
92
+ | Check | Status | Details |
93
+ |-------|--------|---------|
94
+ | Git Status | ✅ | Clean |
95
+ | Branch | ❌ | On main (should be feature branch) |
96
+ | Dependencies | ✅ | Installed |
97
+ | TypeScript | ❌ | 3 errors |
98
+ | Tests | ⚠️ | 45 passed, 2 failed |
99
+ | Lint | ✅ | 0 errors |
100
+
101
+ **Result**: ❌ Validation failed. Must resolve before proceeding.
102
+
103
+ ### Issues to Resolve
104
+ 1. **Branch**: Create feature branch from main
105
+ 2. **TypeScript**: Fix errors in src/components/X.tsx (lines 23, 45, 67)
106
+ 3. **Tests**: Investigate failures in useAuth.test.ts
107
+
108
+ Do not proceed with implementation until all checks pass.
109
+ ```
110
+
111
+ ## Validation Matrix
112
+
113
+ | Check | Pass Criteria | Failure Action |
114
+ |-------|--------------|----------------|
115
+ | Git Status | Clean or understood | Commit, stash, or investigate |
116
+ | Branch | On feature branch | Create branch |
117
+ | Dependencies | npm ci succeeds | Resolve conflicts |
118
+ | TypeScript | 0 errors | Fix errors |
119
+ | Tests | All pass | Fix or understand failures |
120
+ | Lint | 0 errors | Fix errors |
121
+
122
+ ## Key Behaviors
123
+ - **Never skip validation**
124
+ - If checks fail, fix before proceeding
125
+ - Document any known/accepted failures
126
+ - Re-run validation after fixes
127
+
128
+ ## Integration Points
129
+ - Used before: Any implementation work
130
+ - Follows: `/orient` session start
131
+ - Precedes: Code changes
132
+ - Referenced by: `/evidence` for baseline comparison