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,319 @@
1
+ # /insights - Synthesize Recent Learnings
2
+
3
+ > Deep analysis of retrospectives to identify patterns, root causes, and actionable improvements.
4
+
5
+ ## When to Use
6
+ - Weekly (Monday morning suggested)
7
+ - Before starting new similar work
8
+ - When noticing repeated issues
9
+ - After multiple sessions on complex features
10
+
11
+ ## Philosophy
12
+
13
+ Shallow pattern detection creates false confidence. This command performs **deep analysis** to surface:
14
+ - Frequency-ranked patterns (not just "mentioned 2+ times")
15
+ - Root causes (not just symptoms)
16
+ - Prioritized recommendations with implementation steps
17
+ - Concrete actions ready for CLAUDE.md or Linear
18
+
19
+ ## Data Sources
20
+
21
+ | Source | Path | Contains |
22
+ |--------|------|----------|
23
+ | Retrospectives | `.claude/retros/` | Session learnings, process insights |
24
+ | Healthchecks | `.claude/healthchecks/` | Framework diagnostics, hook/tool metrics |
25
+ | Handoffs | `.claude/handoffs/` | Session context, implicit learnings |
26
+
27
+ ---
28
+
29
+ ## Execution Steps
30
+
31
+ ### Step 1: Gather Recent Data
32
+
33
+ Find retrospectives from the last 2 weeks:
34
+ ```bash
35
+ find .claude/retros -name "*.md" -mtime -14 -type f
36
+ ```
37
+
38
+ Find healthchecks from the last 2 weeks:
39
+ ```bash
40
+ find .claude/healthchecks -name "*.md" -mtime -14 -type f
41
+ ```
42
+
43
+ **If no retros exist**: Check handoffs for implicit learnings, or suggest running `/retro` first.
44
+
45
+ ### Step 2: Read Every Retro Fully
46
+
47
+ Do NOT skim. For each retrospective:
48
+ 1. Read the entire "What Happened" narrative
49
+ 2. Extract the "Key Learning"
50
+ 3. Extract the "For Next Time" action
51
+ 4. Note any issues, blockers, or friction mentioned
52
+
53
+ Create a working extraction table:
54
+
55
+ | Retro | Key Learning | For Next Time | Issues Mentioned |
56
+ |-------|--------------|---------------|------------------|
57
+ | ANV-78 | Verify branch before read | Run git status at session start | Wrong branch, file mismatch |
58
+ | ANV-67 | Diff after edits | Run git diff after modifications | Linter reverted changes |
59
+ | ... | ... | ... | ... |
60
+
61
+ ### Step 3: Identify Patterns with Frequency Analysis
62
+
63
+ Group similar issues and count occurrences:
64
+
65
+ | Pattern | Occurrences | Retros | Severity |
66
+ |---------|-------------|--------|----------|
67
+ | Branch context issues | 6 | ANV-78, ANV-76, ANV-47, ANV-44/45, ANV-30 | CRITICAL |
68
+ | Uncommitted work loss | 3 | ANV-67, ANV-30, ANV-44/45 | HIGH |
69
+ | Multi-location confusion | 3 | ANV-47, TTS-fix, ANV-68 | MEDIUM |
70
+
71
+ **Severity Rating**:
72
+ - **CRITICAL** (5+ occurrences OR data loss/major rework)
73
+ - **HIGH** (3-4 occurrences OR significant time waste)
74
+ - **MEDIUM** (2 occurrences OR moderate friction)
75
+ - **LOW** (1 occurrence, minor issue)
76
+
77
+ ### Step 4: Root Cause Analysis
78
+
79
+ For each pattern with 2+ occurrences, identify the **systemic root cause** (not just the symptom):
80
+
81
+ | Pattern (Symptom) | Root Cause | Why It Keeps Happening |
82
+ |-------------------|------------|------------------------|
83
+ | Reading wrong file version | Session compaction loses branch awareness | No automated verification at session resume |
84
+ | Uncommitted work lost | No checkpoint commit discipline | Compaction happens unexpectedly |
85
+ | Edited wrong file location | Dual-location pattern unclear | No pre-check of file locations |
86
+
87
+ **Key distinction**:
88
+ - Symptom: "I was on the wrong branch"
89
+ - Root cause: "Session compaction removes branch context and there's no automated verification"
90
+
91
+ ### Step 5: Categorize by Type
92
+
93
+ Group patterns into actionable categories:
94
+
95
+ **Process Gaps** (behavioral/workflow issues)
96
+ - Example: "No checkpoint commits before compaction"
97
+
98
+ **Tooling Limitations** (tool behavior that causes friction)
99
+ - Example: "Session compaction loses branch state"
100
+
101
+ **Knowledge Gaps** (things that need to be learned/documented)
102
+ - Example: "jq // operator treats false as falsey"
103
+
104
+ **Codebase Issues** (code structure causing problems)
105
+ - Example: "Dual-location hook pattern is confusing"
106
+
107
+ **Positive Patterns** (successes to reinforce)
108
+ - Example: "Service-first architecture made integration predictable"
109
+
110
+ ### Step 6: Create Implementation Recommendations
111
+
112
+ For each pattern, propose a **specific fix** with effort estimate:
113
+
114
+ | Priority | Pattern | Recommended Fix | Effort | Type |
115
+ |----------|---------|-----------------|--------|------|
116
+ | P1 | Branch context | Add `git branch --show-current` check to /orient, add anti-pattern | Low | Documentation |
117
+ | P2 | Uncommitted work | Add "30-minute commit reminder" anti-pattern | Low | Documentation |
118
+ | P2 | Post-edit verification | Add `git diff` verification step after edits | Low | Behavioral |
119
+ | P3 | Branch logging | Enhance pre_tool_use hook to log branch on Read | Medium | Code change |
120
+
121
+ **Effort Estimates**:
122
+ - **Low**: Documentation or behavioral change only
123
+ - **Medium**: Small code change or new script
124
+ - **High**: Significant implementation work
125
+
126
+ **Priority Formula**: Impact x Frequency / Effort
127
+ - P1: CRITICAL patterns or HIGH with low effort
128
+ - P2: HIGH patterns or MEDIUM with low effort
129
+ - P3: MEDIUM patterns or anything requiring significant effort
130
+
131
+ ### Step 7: Check Framework Health (if healthchecks exist)
132
+
133
+ From healthcheck files, extract:
134
+ - Hook success rates
135
+ - Tool invocation patterns
136
+ - Safety rule triggers
137
+ - Any errors or warnings
138
+
139
+ Note any framework issues that correlate with retro patterns.
140
+
141
+ ---
142
+
143
+ ## Output Format
144
+
145
+ Generate a comprehensive report with ALL of the following sections:
146
+
147
+ ```markdown
148
+ ## Insights Report: [Date Range]
149
+
150
+ ### Executive Summary
151
+
152
+ **Analyzed**: [X] retrospectives, [Y] healthchecks from [date range]
153
+ **Critical Patterns**: [count]
154
+ **High Patterns**: [count]
155
+ **Recommended Actions**: [count]
156
+
157
+ ### Pattern Analysis
158
+
159
+ #### Category 1: [Pattern Name] ([X] occurrences) - [SEVERITY]
160
+
161
+ | Retro | Issue Description |
162
+ |-------|-------------------|
163
+ | [ID] | [What happened] |
164
+ | [ID] | [What happened] |
165
+
166
+ **Root Cause**: [Systemic cause, not symptom]
167
+
168
+ **Impact**: [Time wasted, data lost, rework required]
169
+
170
+ ---
171
+
172
+ #### Category 2: [Pattern Name] ([X] occurrences) - [SEVERITY]
173
+ [Same structure]
174
+
175
+ ---
176
+
177
+ ### Positive Patterns (Reinforce These)
178
+
179
+ | Pattern | Evidence | Why It Works |
180
+ |---------|----------|--------------|
181
+ | [Pattern] | [Retros] | [Explanation] |
182
+
183
+ ---
184
+
185
+ ### Framework Health
186
+
187
+ **Status**: [Healthy / Warning / Issues]
188
+
189
+ | Metric | Value | Status |
190
+ |--------|-------|--------|
191
+ | Hook success rate | X% | [OK/Warning] |
192
+ | Safety blocks | X | [OK/Warning] |
193
+ | Tool errors | X | [OK/Warning] |
194
+
195
+ [Any correlations between framework issues and retro patterns]
196
+
197
+ ---
198
+
199
+ ### Recommended Actions
200
+
201
+ #### Priority 1 (Do Now)
202
+
203
+ **1. [Action Name]**
204
+ - **Pattern**: [Which pattern this fixes]
205
+ - **Fix**: [Specific implementation]
206
+ - **Effort**: [Low/Medium/High]
207
+ - **Implementation**:
208
+ ```
209
+ [Specific commands, file edits, or steps]
210
+ ```
211
+
212
+ #### Priority 2 (This Week)
213
+
214
+ **2. [Action Name]**
215
+ [Same structure]
216
+
217
+ #### Priority 3 (Backlog)
218
+
219
+ **3. [Action Name]**
220
+ [Same structure]
221
+
222
+ ---
223
+
224
+ ### CLAUDE.md Patch
225
+
226
+ **New Anti-Patterns to Add**:
227
+
228
+ | Anti-Pattern | Check |
229
+ |--------------|-------|
230
+ | [Pattern] | [Verification question] |
231
+
232
+ **New Learned Patterns to Add**:
233
+
234
+ | Pattern | Evidence | Added |
235
+ |---------|----------|-------|
236
+ | [Name] | [Retro IDs] | [Today] |
237
+
238
+ ---
239
+
240
+ ### Suggested Linear Issues
241
+
242
+ For patterns requiring code changes:
243
+
244
+ | Title | Description | Priority | Estimate |
245
+ |-------|-------------|----------|----------|
246
+ | [Issue title] | [Brief description] | P[X] | [X]h |
247
+
248
+ ---
249
+
250
+ ### No Action Needed
251
+
252
+ - [Observation that's interesting but one-off or not actionable]
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Post-Report Actions
258
+
259
+ After generating the report, offer:
260
+
261
+ 1. **"apply patch"** - Update CLAUDE.md with new patterns and anti-patterns
262
+ 2. **"create issues"** - Create Linear issues for code-change recommendations
263
+ 3. **"save report"** - Save to `.claude/insights/YYYY-MM-DD.md`
264
+
265
+ ---
266
+
267
+ ## Key Behaviors
268
+
269
+ - **Read every retro fully** - do not skim for keywords
270
+ - **Count frequencies** - patterns with 6 occurrences are more urgent than 2
271
+ - **Identify root causes** - "wrong branch" is a symptom, "compaction loses context" is the cause
272
+ - **Be specific** - include file paths, commands, implementation steps
273
+ - **Prioritize by impact** - not all patterns are equally important
274
+ - **Include positive patterns** - reinforce what is working
275
+
276
+ ## Anti-Patterns to Avoid
277
+
278
+ - One-liner pattern summaries without evidence
279
+ - Vague recommendations ("be more careful")
280
+ - Missing frequency counts
281
+ - Confusing symptoms with root causes
282
+ - Equal treatment of all patterns regardless of severity
283
+ - Skipping implementation details
284
+
285
+ ## What This Command Does NOT Do
286
+
287
+ - Replace writing individual retros (that is `/retro`)
288
+ - Automatically apply changes without confirmation
289
+ - Create issues without user approval
290
+ - Analyze code (that is `/explore`)
291
+
292
+ ## Integration Points
293
+
294
+ - **Reads**: `.claude/retros/`, `.claude/healthchecks/`, `.claude/handoffs/`
295
+ - **Modifies**: `CLAUDE.md` (when "apply patch" requested)
296
+ - **Creates**: Linear issues (when "create issues" requested)
297
+ - **Saves**: `.claude/insights/` (when "save report" requested)
298
+
299
+ ## Handling Edge Cases
300
+
301
+ | Scenario | Action |
302
+ |----------|--------|
303
+ | No retros in date range | Expand to 30 days, or suggest `/retro` |
304
+ | Only 1-2 retros | Still analyze, note limited data |
305
+ | No patterns found | Report "no recurring patterns" with individual learnings |
306
+ | All patterns are positive | Focus on reinforcement, no fixes needed |
307
+ | Conflicting learnings | Note the conflict, ask for clarification |
308
+
309
+ ---
310
+
311
+ ## Quick Mode (Optional)
312
+
313
+ If user runs `/insights --quick`:
314
+ - Skip root cause analysis
315
+ - Skip implementation details
316
+ - Output summary table only
317
+ - Suggest full analysis if patterns detected
318
+
319
+ Default behavior is **full deep analysis**.
@@ -0,0 +1,184 @@
1
+ ---
2
+ description: Configure Linear integration for this project
3
+ arguments: []
4
+ ---
5
+
6
+ # Linear Setup
7
+
8
+ Configure which Linear team this local project maps to.
9
+
10
+ ## Overview
11
+
12
+ This command establishes the connection between your local project directory and a Linear team. Once configured, all Anvil commands (`/orient`, `/sprint`, `/tasks`, etc.) will only show issues from the configured team.
13
+
14
+ ### Linear Team Structure
15
+
16
+ Linear supports hierarchical team structures:
17
+
18
+ ```
19
+ Workspace
20
+ ├── Parent Team (optional) ← Cross-cutting work, unified view
21
+ │ ├── Sub-Team A ← Project/product 1
22
+ │ └── Sub-Team B ← Project/product 2
23
+ └── Standalone Team ← Independent project
24
+ ```
25
+
26
+ **Recommendation**:
27
+ - One team (or sub-team) per product/project
28
+ - Use parent teams for unified backlog view across projects
29
+ - Each local project directory should map to one specific team
30
+
31
+ ## Pre-Flight Check
32
+
33
+ First, verify Linear MCP is available:
34
+
35
+ ```bash
36
+ # Check if Linear MCP is configured
37
+ claude mcp list | grep -i linear || echo "Linear MCP not found"
38
+ ```
39
+
40
+ ## Step 1: Check Current Configuration
41
+
42
+ ```bash
43
+ # Check if linear.yaml exists
44
+ if [ -f ".claude/linear.yaml" ]; then
45
+ echo "Current Linear configuration:"
46
+ cat .claude/linear.yaml
47
+ else
48
+ echo "No Linear configuration found for this project."
49
+ fi
50
+ ```
51
+
52
+ ## Step 2: List Available Teams
53
+
54
+ Query Linear for available teams. Present them in a selection format:
55
+
56
+ **Action**: Use Linear MCP to list teams
57
+
58
+ ```
59
+ List all Linear teams I have access to. Show:
60
+ - Team name
61
+ - Team key (e.g., "ENG", "PROD", "API")
62
+ - Whether it's a sub-team (and parent name)
63
+ - Number of active issues
64
+ ```
65
+
66
+ Present as numbered list for selection:
67
+ ```
68
+ Available Linear Teams:
69
+ 1. Engineering (ENG) - 23 active issues
70
+ 2. Product (PROD) - 5 active issues [sub-team of Platform]
71
+ 3. API Team (API) - 12 active issues [sub-team of Platform]
72
+
73
+ Enter number to select, or 'new' to create a new team:
74
+ ```
75
+
76
+ ## Step 3: Team Selection
77
+
78
+ Based on user selection:
79
+
80
+ ### If existing team selected:
81
+ 1. Get team details (key, ID)
82
+ 2. Ask if they want to filter to a specific project within that team
83
+ 3. If yes, list projects in that team and let them select
84
+
85
+ ### If 'new' selected:
86
+ 1. Ask for team name
87
+ 2. Ask for team key (2-4 uppercase letters)
88
+ 3. Ask if this should be a sub-team of an existing team
89
+ 4. Create the team in Linear
90
+ 5. Confirm creation
91
+
92
+ ## Step 4: Save Configuration
93
+
94
+ Write the configuration to `.claude/linear.yaml`:
95
+
96
+ ```yaml
97
+ # Linear Integration Configuration
98
+ # Generated by /linear-setup on [DATE]
99
+
100
+ team_key: "ENG"
101
+ team_name: "Engineering"
102
+ team_id: "uuid-here"
103
+ project_name: "" # Empty = all team issues
104
+ project_id: ""
105
+ issue_prefix: "ENG"
106
+ ```
107
+
108
+ ## Step 5: Verification
109
+
110
+ After saving, verify the configuration works:
111
+
112
+ ```
113
+ Verifying Linear configuration...
114
+
115
+ ✓ Team found: Engineering (ENG)
116
+ ✓ Issue prefix: ENG-
117
+ ✓ Active issues in team: 5
118
+
119
+ Configuration saved to .claude/linear.yaml
120
+
121
+ Next steps:
122
+ - Run /orient to see issues from this team
123
+ - Run /sprint to plan work
124
+ - Issues created will use prefix: ENG-XXX
125
+ ```
126
+
127
+ ## Troubleshooting
128
+
129
+ ### "No teams found"
130
+ - Check Linear MCP is properly configured
131
+ - Verify you have access to at least one Linear workspace
132
+
133
+ ### "Team key already exists"
134
+ - Each team key must be unique in your Linear workspace
135
+ - Choose a different key or use the existing team
136
+
137
+ ### "Permission denied"
138
+ - You may not have permission to create teams
139
+ - Contact your Linear workspace admin
140
+
141
+ ## Configuration Reference
142
+
143
+ | Field | Required | Description |
144
+ |-------|----------|-------------|
145
+ | `team_key` | Yes | 2-4 letter team identifier (e.g., "ENG") |
146
+ | `team_name` | Yes | Human-readable team name |
147
+ | `team_id` | Yes | Linear UUID for the team |
148
+ | `project_name` | No | Filter to specific Linear project |
149
+ | `project_id` | No | Linear UUID for the project |
150
+ | `issue_prefix` | Yes | Prefix for issue IDs (usually = team_key) |
151
+
152
+ ## Manual Configuration
153
+
154
+ If you prefer to configure manually:
155
+
156
+ 1. Go to Linear → Settings → Teams
157
+ 2. Find or create your team
158
+ 3. Copy the team key and ID
159
+ 4. Create `.claude/linear.yaml`:
160
+
161
+ ```yaml
162
+ team_key: "YOUR_KEY"
163
+ team_name: "Your Team Name"
164
+ team_id: "your-team-uuid"
165
+ project_name: ""
166
+ project_id: ""
167
+ issue_prefix: "YOUR_KEY"
168
+ ```
169
+
170
+ ## Multi-Project Setup
171
+
172
+ If you have multiple local projects mapping to different Linear teams:
173
+
174
+ ```
175
+ ~/projects/
176
+ ├── frontend-app/
177
+ │ └── .claude/linear.yaml → team_key: "FE"
178
+ ├── backend-api/
179
+ │ └── .claude/linear.yaml → team_key: "BE"
180
+ └── shared-lib/
181
+ └── .claude/linear.yaml → team_key: "CORE"
182
+ ```
183
+
184
+ Each project's `/orient`, `/sprint`, `/tasks` commands will only show issues from its configured team.
@@ -0,0 +1,198 @@
1
+ # /lint-fix - Auto-Fix Lint Issues
2
+
3
+ > Run linter with auto-fix enabled.
4
+
5
+ ## When to Use
6
+ - Before committing to clean up code style
7
+ - After large refactors
8
+ - When lint errors are blocking CI
9
+ - To quickly fix formatting issues
10
+
11
+ ## Why This Matters
12
+ Manual lint fixing is tedious and error-prone:
13
+ - Easy to miss issues
14
+ - Inconsistent formatting
15
+ - Time wasted on style debates
16
+
17
+ Auto-fix handles the mechanical work, leaving only semantic issues for human review.
18
+
19
+ ## Arguments
20
+
21
+ | Argument | Required | Description |
22
+ |----------|----------|-------------|
23
+ | `path` | No | Specific path to fix (default: all files) |
24
+
25
+ ## Execution Steps
26
+
27
+ ### Step 1: Detect Linter
28
+
29
+ Detect the project's linter configuration:
30
+ ```bash
31
+ # Check for linter config files
32
+ if [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ] || [ -f "eslint.config.js" ]; then
33
+ LINTER="eslint"
34
+ elif [ -f "biome.json" ]; then
35
+ LINTER="biome"
36
+ elif [ -f "ruff.toml" ] || [ -f "pyproject.toml" ]; then
37
+ LINTER="ruff"
38
+ elif [ -f ".prettierrc" ] || [ -f "prettier.config.js" ]; then
39
+ LINTER="prettier"
40
+ else
41
+ echo "No linter configuration detected"
42
+ exit 1
43
+ fi
44
+ ```
45
+
46
+ ### Step 2: Run Linter with Fix
47
+
48
+ Execute the appropriate fix command:
49
+
50
+ | Linter | Command |
51
+ |--------|---------|
52
+ | ESLint | `npx eslint --fix [path]` |
53
+ | Prettier | `npx prettier --write [path]` |
54
+ | Biome | `npx biome check --apply [path]` |
55
+ | Ruff | `ruff check --fix [path]` |
56
+ | Black | `black [path]` |
57
+ | gofmt | `gofmt -w [path]` |
58
+ | rustfmt | `cargo fmt` |
59
+
60
+ ### Step 3: Capture Results
61
+
62
+ Parse linter output to identify:
63
+ - Number of issues fixed
64
+ - Types of fixes applied
65
+ - Remaining unfixable issues
66
+
67
+ ### Step 4: Stage Fixed Files
68
+ ```bash
69
+ git add .
70
+ ```
71
+
72
+ ### Step 5: Report Results
73
+
74
+ **If all issues fixed**:
75
+ ```
76
+ ✅ Lint auto-fix complete
77
+
78
+ Fixed 12 issues:
79
+ - 5 formatting issues
80
+ - 4 import order issues
81
+ - 3 unused import removals
82
+
83
+ All issues resolved. Changes staged for commit.
84
+ ```
85
+
86
+ **If some issues remain**:
87
+ ```
88
+ ✅ Lint auto-fix complete
89
+
90
+ Fixed 8 issues:
91
+ - 3 formatting issues
92
+ - 5 import order issues
93
+
94
+ ⚠️ Remaining (manual fix required):
95
+ - src/utils/api.ts:45 - 'x' is defined but never used
96
+ - src/utils/api.ts:67 - Unexpected 'any' type
97
+
98
+ Changes staged for commit.
99
+ ```
100
+
101
+ ## Usage Examples
102
+
103
+ ### Fix All Files
104
+ ```
105
+ /lint-fix
106
+ ```
107
+
108
+ ### Fix Specific Directory
109
+ ```
110
+ /lint-fix src/components/
111
+ ```
112
+
113
+ ### Fix Single File
114
+ ```
115
+ /lint-fix src/utils/api.ts
116
+ ```
117
+
118
+ ## Success Output (All Fixed)
119
+ ```
120
+ ✅ Lint auto-fix complete
121
+
122
+ Fixed 12 issues:
123
+ - 5 formatting issues
124
+ - 4 import order issues
125
+ - 3 unused import removals
126
+
127
+ All issues resolved. Changes staged for commit.
128
+ ```
129
+
130
+ ## Partial Success Output
131
+ ```
132
+ ✅ Lint auto-fix complete
133
+
134
+ Fixed 8 issues:
135
+ - 3 formatting issues
136
+ - 5 import order issues
137
+
138
+ ⚠️ Remaining (manual fix required):
139
+ - src/utils/api.ts:45 - 'x' is defined but never used (no-unused-vars)
140
+ - src/components/Form.tsx:23 - Missing return type (explicit-function-return-type)
141
+
142
+ Changes staged for commit. Address remaining issues manually.
143
+ ```
144
+
145
+ ## Failure Output
146
+ ```
147
+ ❌ Lint auto-fix failed
148
+
149
+ No linter configuration detected.
150
+
151
+ Supported linters:
152
+ - ESLint (.eslintrc.js, eslint.config.js)
153
+ - Prettier (.prettierrc)
154
+ - Biome (biome.json)
155
+ - Ruff (ruff.toml, pyproject.toml)
156
+
157
+ Add a linter configuration to use this command.
158
+ ```
159
+
160
+ ## Supported Linters
161
+
162
+ | Language | Linter | Fix Flag |
163
+ |----------|--------|----------|
164
+ | JavaScript/TypeScript | ESLint | `--fix` |
165
+ | JavaScript/TypeScript | Prettier | `--write` |
166
+ | JavaScript/TypeScript | Biome | `--apply` |
167
+ | Python | Ruff | `--fix` |
168
+ | Python | Black | (default) |
169
+ | Go | gofmt | `-w` |
170
+ | Rust | rustfmt | (default) |
171
+ | Shell | shfmt | `-w` |
172
+
173
+ ## Error Handling
174
+
175
+ | Error | Response |
176
+ |-------|----------|
177
+ | No linter config | List supported linters |
178
+ | Linter not installed | Installation instructions |
179
+ | Parse error | Show file and line |
180
+ | No files to fix | "No matching files found" |
181
+
182
+ ## Anti-Patterns
183
+ - ❌ Running lint-fix without reviewing changes
184
+ - ❌ Ignoring remaining unfixable issues
185
+ - ❌ Committing without verifying auto-fixes are correct
186
+
187
+ ## Key Behaviors
188
+ - **Automatic**: Detects linter from project config
189
+ - **Safe**: Only fixes auto-fixable issues
190
+ - **Staged**: Changes are staged but not committed
191
+ - **Transparent**: Shows what was fixed and what remains
192
+ - **Composable**: Use with `/test-and-commit` for full workflow
193
+
194
+ ## Integration Points
195
+ - Use before: `/test-and-commit` to ensure clean code
196
+ - Combine with: `/commit-push-pr` for full workflow
197
+ - Alternative to: Manual `npm run lint -- --fix`
198
+ - Triggers: After code changes, before commits