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.
- package/README.md +719 -0
- package/VERSION +1 -0
- package/docs/ANVIL-REPO-IMPLEMENTATION-PLAN.md +441 -0
- package/docs/FIRST-SKILL-TUTORIAL.md +408 -0
- package/docs/INSTALLATION-RETRO-NOTES.md +458 -0
- package/docs/INSTALLATION.md +984 -0
- package/docs/anvil-hud.md +469 -0
- package/docs/anvil-init.md +255 -0
- package/docs/anvil-state.md +210 -0
- package/docs/boris-cherny-ralph-wiggum-insights.md +608 -0
- package/docs/command-reference.md +2022 -0
- package/docs/hooks-tts.md +368 -0
- package/docs/implementation-guide.md +810 -0
- package/docs/linear-github-integration.md +247 -0
- package/docs/local-issues.md +677 -0
- package/docs/patterns/README.md +419 -0
- package/docs/planning-responsibilities.md +139 -0
- package/docs/session-workflow.md +573 -0
- package/docs/simplification-plan-template.md +297 -0
- package/docs/simplification-principles.md +129 -0
- package/docs/specifications/CCS-RALPH-INTEGRATION-DESIGN.md +633 -0
- package/docs/specifications/CCS-RESEARCH-REPORT.md +169 -0
- package/docs/specifications/PLAN-ANV-verification-ralph-wiggum.md +403 -0
- package/docs/specifications/PLAN-parallel-tracks-anvil-memory-ccs.md +494 -0
- package/docs/specifications/SPEC-ANV-VRW/component-01-verify.md +208 -0
- package/docs/specifications/SPEC-ANV-VRW/component-02-stop-gate.md +226 -0
- package/docs/specifications/SPEC-ANV-VRW/component-03-posttooluse.md +209 -0
- package/docs/specifications/SPEC-ANV-VRW/component-04-ralph-wiggum.md +604 -0
- package/docs/specifications/SPEC-ANV-VRW/component-05-atomic-actions.md +311 -0
- package/docs/specifications/SPEC-ANV-VRW/component-06-verify-subagent.md +264 -0
- package/docs/specifications/SPEC-ANV-VRW/component-07-claude-md.md +363 -0
- package/docs/specifications/SPEC-ANV-VRW/index.md +182 -0
- package/docs/specifications/SPEC-ANV-anvil-memory.md +573 -0
- package/docs/specifications/SPEC-ANV-context-checkpoints.md +781 -0
- package/docs/specifications/SPEC-ANV-verification-ralph-wiggum.md +789 -0
- package/docs/sync.md +122 -0
- package/global/CLAUDE.md +140 -0
- package/global/agents/verify-app.md +164 -0
- package/global/commands/anvil-settings.md +527 -0
- package/global/commands/anvil-sync.md +121 -0
- package/global/commands/change.md +197 -0
- package/global/commands/clarify.md +252 -0
- package/global/commands/cleanup.md +292 -0
- package/global/commands/commit-push-pr.md +207 -0
- package/global/commands/decay-review.md +127 -0
- package/global/commands/discover.md +158 -0
- package/global/commands/doc-coverage.md +122 -0
- package/global/commands/evidence.md +307 -0
- package/global/commands/explore.md +121 -0
- package/global/commands/force-exit.md +135 -0
- package/global/commands/handoff.md +191 -0
- package/global/commands/healthcheck.md +302 -0
- package/global/commands/hud.md +84 -0
- package/global/commands/insights.md +319 -0
- package/global/commands/linear-setup.md +184 -0
- package/global/commands/lint-fix.md +198 -0
- package/global/commands/orient.md +510 -0
- package/global/commands/plan.md +228 -0
- package/global/commands/ralph.md +346 -0
- package/global/commands/ready.md +182 -0
- package/global/commands/release.md +305 -0
- package/global/commands/retro.md +96 -0
- package/global/commands/shard.md +166 -0
- package/global/commands/spec.md +227 -0
- package/global/commands/sprint.md +184 -0
- package/global/commands/tasks.md +228 -0
- package/global/commands/test-and-commit.md +151 -0
- package/global/commands/validate.md +132 -0
- package/global/commands/verify.md +251 -0
- package/global/commands/weekly-review.md +156 -0
- package/global/hooks/__pycache__/ralph_context_monitor.cpython-314.pyc +0 -0
- package/global/hooks/__pycache__/statusline_agent_sync.cpython-314.pyc +0 -0
- package/global/hooks/anvil_memory_observe.ts +322 -0
- package/global/hooks/anvil_memory_session.ts +166 -0
- package/global/hooks/anvil_memory_stop.ts +187 -0
- package/global/hooks/parse_transcript.py +116 -0
- package/global/hooks/post_merge_cleanup.sh +132 -0
- package/global/hooks/post_tool_format.sh +215 -0
- package/global/hooks/ralph_context_monitor.py +240 -0
- package/global/hooks/ralph_stop.sh +502 -0
- package/global/hooks/statusline.sh +1110 -0
- package/global/hooks/statusline_agent_sync.py +224 -0
- package/global/hooks/stop_gate.sh +250 -0
- package/global/lib/.claude/anvil-state.json +21 -0
- package/global/lib/__pycache__/agent_registry.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/claim_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coderabbit_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/config_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coordination_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/doc_coverage_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/gate_logger.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/github_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/hygiene_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_data_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/local_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/quality_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/transcript_parser.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verification_runner.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_iteration.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_subagent.cpython-314.pyc +0 -0
- package/global/lib/agent_registry.py +995 -0
- package/global/lib/anvil-state.sh +435 -0
- package/global/lib/claim_service.py +515 -0
- package/global/lib/coderabbit_service.py +314 -0
- package/global/lib/config_service.py +423 -0
- package/global/lib/coordination_service.py +331 -0
- package/global/lib/doc_coverage_service.py +1305 -0
- package/global/lib/gate_logger.py +316 -0
- package/global/lib/github_service.py +310 -0
- package/global/lib/handoff_generator.py +775 -0
- package/global/lib/hygiene_service.py +712 -0
- package/global/lib/issue_models.py +257 -0
- package/global/lib/issue_provider.py +339 -0
- package/global/lib/linear_data_service.py +210 -0
- package/global/lib/linear_provider.py +987 -0
- package/global/lib/linear_provider.py.backup +671 -0
- package/global/lib/local_provider.py +486 -0
- package/global/lib/orient_fast.py +457 -0
- package/global/lib/quality_service.py +470 -0
- package/global/lib/ralph_prompt_generator.py +563 -0
- package/global/lib/ralph_state.py +1202 -0
- package/global/lib/state_manager.py +417 -0
- package/global/lib/transcript_parser.py +597 -0
- package/global/lib/verification_runner.py +557 -0
- package/global/lib/verify_iteration.py +490 -0
- package/global/lib/verify_subagent.py +250 -0
- package/global/skills/README.md +155 -0
- package/global/skills/quality-gates/SKILL.md +252 -0
- package/global/skills/skill-template/SKILL.md +109 -0
- package/global/skills/testing-strategies/SKILL.md +337 -0
- package/global/templates/CHANGE-template.md +105 -0
- package/global/templates/HANDOFF-template.md +63 -0
- package/global/templates/PLAN-template.md +111 -0
- package/global/templates/SPEC-template.md +93 -0
- package/global/templates/ralph/PROMPT.md.template +89 -0
- package/global/templates/ralph/fix_plan.md.template +31 -0
- package/global/templates/ralph/progress.txt.template +23 -0
- package/global/tests/__pycache__/test_doc_coverage.cpython-314.pyc +0 -0
- package/global/tests/test_doc_coverage.py +520 -0
- package/global/tests/test_issue_models.py +299 -0
- package/global/tests/test_local_provider.py +323 -0
- package/global/tools/README.md +178 -0
- package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
- package/global/tools/anvil-hud.py +3622 -0
- package/global/tools/anvil-hud.py.bak +3318 -0
- package/global/tools/anvil-issue.py +432 -0
- package/global/tools/anvil-memory/CLAUDE.md +49 -0
- package/global/tools/anvil-memory/README.md +42 -0
- package/global/tools/anvil-memory/bun.lock +25 -0
- package/global/tools/anvil-memory/bunfig.toml +9 -0
- package/global/tools/anvil-memory/package.json +23 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +535 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/edge-cases.test.ts +645 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +363 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +8 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/integration.test.ts +417 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +571 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +440 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +252 -0
- package/global/tools/anvil-memory/src/__tests__/commands.test.ts +657 -0
- package/global/tools/anvil-memory/src/__tests__/db.test.ts +641 -0
- package/global/tools/anvil-memory/src/__tests__/hooks.test.ts +272 -0
- package/global/tools/anvil-memory/src/__tests__/performance.test.ts +427 -0
- package/global/tools/anvil-memory/src/__tests__/test-utils.ts +113 -0
- package/global/tools/anvil-memory/src/commands/checkpoint.ts +197 -0
- package/global/tools/anvil-memory/src/commands/get.ts +115 -0
- package/global/tools/anvil-memory/src/commands/init.ts +94 -0
- package/global/tools/anvil-memory/src/commands/observe.ts +163 -0
- package/global/tools/anvil-memory/src/commands/search.ts +112 -0
- package/global/tools/anvil-memory/src/db.ts +638 -0
- package/global/tools/anvil-memory/src/index.ts +205 -0
- package/global/tools/anvil-memory/src/types.ts +122 -0
- package/global/tools/anvil-memory/tsconfig.json +29 -0
- package/global/tools/ralph-loop.sh +359 -0
- package/package.json +45 -0
- package/scripts/anvil +822 -0
- package/scripts/extract_patterns.py +222 -0
- package/scripts/init-project.sh +541 -0
- package/scripts/install.sh +229 -0
- package/scripts/postinstall.js +41 -0
- package/scripts/rollback.sh +188 -0
- package/scripts/sync.sh +623 -0
- package/scripts/test-statusline.sh +248 -0
- package/scripts/update_claude_md.py +224 -0
- package/scripts/verify.sh +255 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# /cleanup - Repository Hygiene Cleanup
|
|
2
|
+
|
|
3
|
+
> Address accumulated stashes, orphan branches, and stale PRs to maintain repository health.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- After `/healthcheck` or `/orient` shows hygiene warnings
|
|
7
|
+
- Periodically to prevent cruft accumulation
|
|
8
|
+
- Before starting work on a clean slate
|
|
9
|
+
- After merging a large PR to clean up related artifacts
|
|
10
|
+
|
|
11
|
+
## Command Options
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
/cleanup [--dry-run] [--category=stashes|branches|prs|all] [--force] [--age=DAYS]
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--dry-run Show what would be cleaned without making changes
|
|
18
|
+
--category Clean specific category only (default: all)
|
|
19
|
+
--force Skip confirmation prompts (use with caution!)
|
|
20
|
+
--age=DAYS Override stash age threshold (default: 7 days)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Execution Steps
|
|
24
|
+
|
|
25
|
+
### Step 1: Run Hygiene Check
|
|
26
|
+
|
|
27
|
+
Gather current hygiene status:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python3 global/lib/hygiene_service.py --check --json
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Parse the JSON output to get:
|
|
34
|
+
- `old_stashes`: Stashes older than threshold
|
|
35
|
+
- `orphan_branches`: Branches with deleted remotes
|
|
36
|
+
- `stale_prs`: PRs for Done Linear issues
|
|
37
|
+
- `conflict_prs`: PRs with merge conflicts
|
|
38
|
+
|
|
39
|
+
### Step 2: Display Categorized Results
|
|
40
|
+
|
|
41
|
+
Present findings in categorized tables:
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
## Repository Cleanup
|
|
45
|
+
|
|
46
|
+
### Old Stashes (5 items)
|
|
47
|
+
|
|
48
|
+
| Index | Age | Branch | Message | Issue Refs |
|
|
49
|
+
|-------|-----|--------|---------|------------|
|
|
50
|
+
| stash@{0} | 14d | feature/ANV-50 | WIP: auth flow | ANV-50 |
|
|
51
|
+
| stash@{2} | 10d | feature/ANV-45 | save before rebase | ANV-45 |
|
|
52
|
+
...
|
|
53
|
+
|
|
54
|
+
### Orphan Branches (3 items)
|
|
55
|
+
|
|
56
|
+
| Branch | Last Commit | Tracking |
|
|
57
|
+
|--------|-------------|----------|
|
|
58
|
+
| feature/ANV-30-old | abc1234 | origin/feature/ANV-30-old: gone |
|
|
59
|
+
...
|
|
60
|
+
|
|
61
|
+
### Stale PRs (1 item)
|
|
62
|
+
|
|
63
|
+
| PR | Title | Issue Status |
|
|
64
|
+
|----|-------|--------------|
|
|
65
|
+
| #55 | ANV-211: Linear cleanup | ANV-211: Done |
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
### PRs with Conflicts (1 item)
|
|
69
|
+
|
|
70
|
+
| PR | Title | Conflicts |
|
|
71
|
+
|----|-------|-----------|
|
|
72
|
+
| #60 | ANV-220: Feature X | 3 files |
|
|
73
|
+
...
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If any category is empty, show "None found" for that category.
|
|
77
|
+
|
|
78
|
+
### Step 3: Interactive Cleanup (per category)
|
|
79
|
+
|
|
80
|
+
**For each category with items, use AskUserQuestion:**
|
|
81
|
+
|
|
82
|
+
#### Stash Cleanup
|
|
83
|
+
```typescript
|
|
84
|
+
AskUserQuestion({
|
|
85
|
+
questions: [{
|
|
86
|
+
header: "Stashes",
|
|
87
|
+
question: "5 stashes are older than 7 days. How would you like to handle them?",
|
|
88
|
+
multiSelect: false,
|
|
89
|
+
options: [
|
|
90
|
+
{ label: "Drop all old stashes (Recommended)", description: "Remove all 5 old stashes permanently" },
|
|
91
|
+
{ label: "Select individually", description: "Choose which stashes to drop" },
|
|
92
|
+
{ label: "Skip", description: "Leave stashes unchanged" }
|
|
93
|
+
]
|
|
94
|
+
}]
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If "Select individually" chosen, present each stash for confirmation.
|
|
99
|
+
|
|
100
|
+
**Before dropping any stash, show its content preview:**
|
|
101
|
+
```bash
|
|
102
|
+
git stash show -p stash@{N} | head -50
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Drop stash:**
|
|
106
|
+
```bash
|
|
107
|
+
git stash drop stash@{N}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Branch Cleanup
|
|
111
|
+
```typescript
|
|
112
|
+
AskUserQuestion({
|
|
113
|
+
questions: [{
|
|
114
|
+
header: "Branches",
|
|
115
|
+
question: "3 local branches have deleted remotes. Delete them?",
|
|
116
|
+
multiSelect: false,
|
|
117
|
+
options: [
|
|
118
|
+
{ label: "Delete all orphan branches (Recommended)", description: "Remove branches: feature/ANV-30, feature/ANV-31, feature/ANV-32" },
|
|
119
|
+
{ label: "Select individually", description: "Choose which branches to delete" },
|
|
120
|
+
{ label: "Skip", description: "Keep all branches" }
|
|
121
|
+
]
|
|
122
|
+
}]
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Delete branch:**
|
|
127
|
+
```bash
|
|
128
|
+
git branch -D [branch-name]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Stale PR Cleanup
|
|
132
|
+
```typescript
|
|
133
|
+
AskUserQuestion({
|
|
134
|
+
questions: [{
|
|
135
|
+
header: "Stale PRs",
|
|
136
|
+
question: "PR #55 is for issue ANV-211 which is already Done. Close it?",
|
|
137
|
+
multiSelect: false,
|
|
138
|
+
options: [
|
|
139
|
+
{ label: "Close PR #55 (Recommended)", description: "Issue ANV-211 is Done, PR likely obsolete" },
|
|
140
|
+
{ label: "View PR first", description: "Open PR in browser before deciding" },
|
|
141
|
+
{ label: "Skip", description: "Leave PR open" }
|
|
142
|
+
]
|
|
143
|
+
}]
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
If "View PR first" chosen:
|
|
148
|
+
```bash
|
|
149
|
+
gh pr view 55 --web
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Close PR:**
|
|
153
|
+
```bash
|
|
154
|
+
gh pr close 55 --comment "Closing: linked issue ANV-211 is already Done."
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### Conflict PR Suggestions
|
|
158
|
+
For PRs with conflicts, only provide suggestions (no automatic actions):
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
### PRs with Conflicts
|
|
162
|
+
|
|
163
|
+
PR #60 has merge conflicts with main. Suggested actions:
|
|
164
|
+
1. Rebase: `git checkout feature/ANV-220 && git rebase main`
|
|
165
|
+
2. Close if obsolete: `gh pr close 60`
|
|
166
|
+
|
|
167
|
+
These require manual intervention.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Step 4: Execute Cleanup Actions
|
|
171
|
+
|
|
172
|
+
For each confirmed action:
|
|
173
|
+
1. Show the command being executed
|
|
174
|
+
2. Execute the command
|
|
175
|
+
3. Capture result (success/failure)
|
|
176
|
+
4. Continue to next item
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Executing cleanup...
|
|
180
|
+
|
|
181
|
+
✅ Dropped stash@{0}: WIP: auth flow
|
|
182
|
+
✅ Dropped stash@{2}: save before rebase
|
|
183
|
+
✅ Deleted branch: feature/ANV-30-old
|
|
184
|
+
✅ Closed PR #55
|
|
185
|
+
|
|
186
|
+
⚠️ Failed to delete branch: feature/locked (branch is currently checked out)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Step 5: Summary Report
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
## Cleanup Summary
|
|
193
|
+
|
|
194
|
+
| Category | Cleaned | Skipped | Failed |
|
|
195
|
+
|----------|---------|---------|--------|
|
|
196
|
+
| Stashes | 5 | 2 | 0 |
|
|
197
|
+
| Branches | 3 | 0 | 1 |
|
|
198
|
+
| PRs | 1 | 0 | 0 |
|
|
199
|
+
|
|
200
|
+
**Total items cleaned**: 9
|
|
201
|
+
**Total items skipped**: 2
|
|
202
|
+
**Total failures**: 1
|
|
203
|
+
|
|
204
|
+
### Remaining Issues
|
|
205
|
+
|
|
206
|
+
- Branch `feature/locked` could not be deleted (currently checked out)
|
|
207
|
+
|
|
208
|
+
### New Hygiene Status
|
|
209
|
+
|
|
210
|
+
| Check | Before | After |
|
|
211
|
+
|-------|--------|-------|
|
|
212
|
+
| Stashes | 7 | 2 |
|
|
213
|
+
| Orphan branches | 3 | 1 |
|
|
214
|
+
| Stale PRs | 1 | 0 |
|
|
215
|
+
|
|
216
|
+
Run `/healthcheck` for full status.
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Dry Run Mode
|
|
220
|
+
|
|
221
|
+
When `--dry-run` is specified:
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
## Cleanup Preview (Dry Run)
|
|
225
|
+
|
|
226
|
+
The following actions WOULD be taken:
|
|
227
|
+
|
|
228
|
+
### Stashes
|
|
229
|
+
- Would drop stash@{0}: WIP: auth flow (14 days old)
|
|
230
|
+
- Would drop stash@{2}: save before rebase (10 days old)
|
|
231
|
+
|
|
232
|
+
### Branches
|
|
233
|
+
- Would delete: feature/ANV-30-old
|
|
234
|
+
- Would delete: feature/ANV-31-cleanup
|
|
235
|
+
|
|
236
|
+
### PRs
|
|
237
|
+
- Would close PR #55 (ANV-211 is Done)
|
|
238
|
+
|
|
239
|
+
**No changes made.** Run without --dry-run to execute.
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Force Mode
|
|
243
|
+
|
|
244
|
+
When `--force` is specified:
|
|
245
|
+
1. Skip all AskUserQuestion prompts
|
|
246
|
+
2. Show warning before proceeding
|
|
247
|
+
3. Execute all cleanup actions automatically
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
⚠️ WARNING: --force mode enabled
|
|
251
|
+
|
|
252
|
+
This will automatically:
|
|
253
|
+
- Drop 5 old stashes
|
|
254
|
+
- Delete 3 orphan branches
|
|
255
|
+
- Close 1 stale PR
|
|
256
|
+
|
|
257
|
+
Are you absolutely sure? This cannot be undone.
|
|
258
|
+
[Require explicit "yes" confirmation even in force mode]
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Category Filtering
|
|
262
|
+
|
|
263
|
+
When `--category=stashes` (or branches, prs):
|
|
264
|
+
- Only run hygiene check for that category
|
|
265
|
+
- Only show and offer cleanup for that category
|
|
266
|
+
- Other categories are skipped entirely
|
|
267
|
+
|
|
268
|
+
## Safety Measures
|
|
269
|
+
|
|
270
|
+
1. **Never auto-delete without confirmation** (except --force)
|
|
271
|
+
2. **Show stash content preview** before dropping
|
|
272
|
+
3. **Prevent deletion of current branch**
|
|
273
|
+
4. **Add comment when closing PRs** explaining why
|
|
274
|
+
5. **Track failures** and report at end
|
|
275
|
+
6. **No action on conflict PRs** (suggestions only)
|
|
276
|
+
|
|
277
|
+
## Key Behaviors
|
|
278
|
+
|
|
279
|
+
- Always require confirmation before destructive actions
|
|
280
|
+
- Show clear before/after comparison
|
|
281
|
+
- Report all failures with actionable messages
|
|
282
|
+
- Provide dry-run mode for safe preview
|
|
283
|
+
- Keep conflict PRs suggestions-only (manual intervention required)
|
|
284
|
+
- Comment on PRs when closing to maintain audit trail
|
|
285
|
+
|
|
286
|
+
## Integration Points
|
|
287
|
+
|
|
288
|
+
- Uses: `global/lib/hygiene_service.py` for hygiene detection
|
|
289
|
+
- Called from: `/healthcheck` recommendations, `/orient` warnings
|
|
290
|
+
- Uses: Git for stash/branch operations
|
|
291
|
+
- Uses: `gh` CLI for PR operations
|
|
292
|
+
- Uses: AskUserQuestion for confirmations
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# /commit-push-pr - Full Commit Workflow
|
|
2
|
+
|
|
3
|
+
> Commit, push, and create PR in one command.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- When feature is complete and ready for review
|
|
7
|
+
- For quick iteration on small changes
|
|
8
|
+
- When you want the full workflow in one step
|
|
9
|
+
|
|
10
|
+
## Why This Matters
|
|
11
|
+
The manual workflow is error-prone:
|
|
12
|
+
1. `git add .`
|
|
13
|
+
2. `git commit -m "..."`
|
|
14
|
+
3. `git push` (might fail)
|
|
15
|
+
4. `gh pr create` (might forget)
|
|
16
|
+
|
|
17
|
+
This command handles all steps atomically.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
| Argument | Required | Description |
|
|
22
|
+
|----------|----------|-------------|
|
|
23
|
+
| `message` | Yes | Commit message (becomes PR title) |
|
|
24
|
+
| `--draft` | No | Create as draft PR |
|
|
25
|
+
| `--base` | No | Base branch (default: main) |
|
|
26
|
+
|
|
27
|
+
## Prerequisites
|
|
28
|
+
|
|
29
|
+
Before using this command:
|
|
30
|
+
- [ ] `gh` CLI installed (`brew install gh`)
|
|
31
|
+
- [ ] `gh` authenticated (`gh auth login`)
|
|
32
|
+
- [ ] Remote repository configured
|
|
33
|
+
- [ ] Git credentials available
|
|
34
|
+
|
|
35
|
+
## Execution Steps
|
|
36
|
+
|
|
37
|
+
### Step 1: Verify Preconditions
|
|
38
|
+
```bash
|
|
39
|
+
# Check we're in a git repo
|
|
40
|
+
git rev-parse --git-dir > /dev/null 2>&1 || exit 1
|
|
41
|
+
|
|
42
|
+
# Check gh is available
|
|
43
|
+
command -v gh > /dev/null 2>&1 || { echo "Error: gh CLI not installed"; exit 1; }
|
|
44
|
+
|
|
45
|
+
# Check there are changes to commit
|
|
46
|
+
git diff --cached --quiet && git diff --quiet && echo "No changes to commit" && exit 0
|
|
47
|
+
|
|
48
|
+
# Check we're not on main/master
|
|
49
|
+
BRANCH=$(git branch --show-current)
|
|
50
|
+
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
|
|
51
|
+
echo "Error: Cannot create PR from main branch"
|
|
52
|
+
echo "Create a feature branch first: git checkout -b feature/your-feature"
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Step 2: Stage All Changes
|
|
58
|
+
```bash
|
|
59
|
+
git add .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Step 3: Create Commit
|
|
63
|
+
```bash
|
|
64
|
+
git commit -m "[message]
|
|
65
|
+
|
|
66
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
67
|
+
|
|
68
|
+
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 4: Push to Remote
|
|
72
|
+
```bash
|
|
73
|
+
# Try normal push first
|
|
74
|
+
git push origin "$BRANCH" 2>/dev/null
|
|
75
|
+
|
|
76
|
+
# If no upstream, set it
|
|
77
|
+
if [ $? -ne 0 ]; then
|
|
78
|
+
git push -u origin "$BRANCH"
|
|
79
|
+
fi
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**If push fails** (rejected, conflicts):
|
|
83
|
+
```
|
|
84
|
+
❌ Push failed: [error message]
|
|
85
|
+
|
|
86
|
+
Suggested fix:
|
|
87
|
+
git pull --rebase origin main
|
|
88
|
+
```
|
|
89
|
+
- Stop execution
|
|
90
|
+
|
|
91
|
+
### Step 5: Create Pull Request
|
|
92
|
+
```bash
|
|
93
|
+
gh pr create --title "[message]" --body "$(cat <<'EOF'
|
|
94
|
+
## Summary
|
|
95
|
+
[Auto-generated from commit message]
|
|
96
|
+
|
|
97
|
+
## Changes
|
|
98
|
+
[List of files changed]
|
|
99
|
+
|
|
100
|
+
## Test Plan
|
|
101
|
+
- [ ] Tests passing
|
|
102
|
+
- [ ] Manual verification
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
106
|
+
EOF
|
|
107
|
+
)"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Step 6: Report Success
|
|
111
|
+
```
|
|
112
|
+
✅ Committed: [message]
|
|
113
|
+
[hash] - [N] files changed
|
|
114
|
+
✅ Pushed to origin/[branch]
|
|
115
|
+
✅ PR created: [URL]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Usage Examples
|
|
119
|
+
|
|
120
|
+
### Basic Usage
|
|
121
|
+
```
|
|
122
|
+
/commit-push-pr "feat: add OAuth support"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Draft PR
|
|
126
|
+
```
|
|
127
|
+
/commit-push-pr "wip: initial authentication flow" --draft
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Custom Base Branch
|
|
131
|
+
```
|
|
132
|
+
/commit-push-pr "fix: hotfix for production" --base release/v2.0
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Success Output
|
|
136
|
+
```
|
|
137
|
+
✅ Committed: feat: add OAuth support
|
|
138
|
+
abc1234 - 5 files changed, 234 insertions(+), 12 deletions(-)
|
|
139
|
+
✅ Pushed to origin/feature/oauth
|
|
140
|
+
✅ PR created: https://github.com/org/repo/pull/42
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Failure Outputs
|
|
144
|
+
|
|
145
|
+
### No gh CLI
|
|
146
|
+
```
|
|
147
|
+
❌ Error: gh CLI not installed
|
|
148
|
+
|
|
149
|
+
Install with: brew install gh
|
|
150
|
+
Then authenticate: gh auth login
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### On Main Branch
|
|
154
|
+
```
|
|
155
|
+
❌ Error: Cannot create PR from main branch
|
|
156
|
+
|
|
157
|
+
Create a feature branch first:
|
|
158
|
+
git checkout -b feature/your-feature
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Push Rejected
|
|
162
|
+
```
|
|
163
|
+
❌ Push failed: rejected (non-fast-forward)
|
|
164
|
+
|
|
165
|
+
Suggested fix:
|
|
166
|
+
git pull --rebase origin main
|
|
167
|
+
git push origin feature/your-feature
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### No Remote
|
|
171
|
+
```
|
|
172
|
+
❌ Push failed: No configured remote
|
|
173
|
+
|
|
174
|
+
Add a remote first:
|
|
175
|
+
git remote add origin https://github.com/org/repo.git
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Error Handling
|
|
179
|
+
|
|
180
|
+
| Error | Response |
|
|
181
|
+
|-------|----------|
|
|
182
|
+
| Not a git repo | "Error: Not a git repository" |
|
|
183
|
+
| No changes | "No changes to commit" |
|
|
184
|
+
| No gh CLI | Install instructions |
|
|
185
|
+
| On main branch | Create branch instructions |
|
|
186
|
+
| Push rejected | Pull/rebase suggestion |
|
|
187
|
+
| No remote | Add remote instructions |
|
|
188
|
+
| PR creation fails | Show gh error, manual instructions |
|
|
189
|
+
|
|
190
|
+
## Anti-Patterns
|
|
191
|
+
- ❌ Pushing to protected branches directly
|
|
192
|
+
- ❌ Creating PRs without tests passing (use `/test-and-commit` first)
|
|
193
|
+
- ❌ Using force push
|
|
194
|
+
- ❌ Creating PRs from main branch
|
|
195
|
+
|
|
196
|
+
## Key Behaviors
|
|
197
|
+
- **Atomic**: All steps succeed or provide clear rollback path
|
|
198
|
+
- **Safe**: Never pushes to main/master directly
|
|
199
|
+
- **Informative**: Shows commit hash, files changed, PR URL
|
|
200
|
+
- **Conventional**: Uses conventional commit format
|
|
201
|
+
- **Traceable**: Adds Claude Code attribution
|
|
202
|
+
|
|
203
|
+
## Integration Points
|
|
204
|
+
- Combine with: `/test-and-commit` for tested PRs
|
|
205
|
+
- Alternative to: Manual git workflow
|
|
206
|
+
- Follows: Feature development
|
|
207
|
+
- Creates: GitHub Pull Request
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# /decay-review - Archive Old Work
|
|
2
|
+
|
|
3
|
+
> Review and archive old issues and specs to keep context lean.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
- Weekly maintenance (recommended: Friday)
|
|
7
|
+
- When active issue count exceeds 50
|
|
8
|
+
- When old specs clutter the current directory
|
|
9
|
+
- Quarterly cleanup
|
|
10
|
+
|
|
11
|
+
## Why Decay Management Matters
|
|
12
|
+
Without cleanup:
|
|
13
|
+
- Issue trackers accumulate cruft
|
|
14
|
+
- Old specs pollute context
|
|
15
|
+
- Signal-to-noise ratio degrades
|
|
16
|
+
- "What's actually active?" becomes unclear
|
|
17
|
+
|
|
18
|
+
Target: **<50 active issues** in Linear
|
|
19
|
+
|
|
20
|
+
## Execution Steps
|
|
21
|
+
|
|
22
|
+
### Step 1: Query Closed Issues
|
|
23
|
+
|
|
24
|
+
Use the Linear CLI to find old closed issues:
|
|
25
|
+
```bash
|
|
26
|
+
# Get completed issues (will need to filter by date manually)
|
|
27
|
+
python3 ~/.claude/skills/linear-skill/scripts/linear.py list-issues --status "Done" --limit 50
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Filter results for issues where `updatedAt` is >30 days ago.
|
|
31
|
+
|
|
32
|
+
### Step 2: Archive Candidates Review
|
|
33
|
+
For each old closed issue:
|
|
34
|
+
- Was it significant? (Keep summary)
|
|
35
|
+
- Any learnings? (Capture in retrospective)
|
|
36
|
+
- Related to active work? (Keep reference)
|
|
37
|
+
|
|
38
|
+
### Step 3: Archive in Linear
|
|
39
|
+
Move old issues to archive:
|
|
40
|
+
- Mark as archived in Linear
|
|
41
|
+
- Or move to "Archive" project
|
|
42
|
+
|
|
43
|
+
### Step 4: Archive Old Specs
|
|
44
|
+
Move completed specs:
|
|
45
|
+
```bash
|
|
46
|
+
# Move completed specs to archive
|
|
47
|
+
mv .claude/specs/current/SPEC-*-completed.md .claude/specs/archive/
|
|
48
|
+
|
|
49
|
+
# Or specs older than 90 days that are done
|
|
50
|
+
find .claude/specs/current -name "*.md" -mtime +90 -exec grep -l "status: implemented" {} \;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Step 5: Archive Old Handoffs
|
|
54
|
+
Keep only last 7 handoffs:
|
|
55
|
+
```bash
|
|
56
|
+
# List handoffs older than 7 days
|
|
57
|
+
find .claude/handoffs -name "*.md" -mtime +7 -type f
|
|
58
|
+
|
|
59
|
+
# Archive old ones
|
|
60
|
+
mkdir -p .claude/handoffs/archive
|
|
61
|
+
mv .claude/handoffs/2024-*.md .claude/handoffs/archive/
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Step 6: Generate Decay Report
|
|
65
|
+
|
|
66
|
+
Output:
|
|
67
|
+
```markdown
|
|
68
|
+
## Decay Review: [Date]
|
|
69
|
+
|
|
70
|
+
### Linear Issues
|
|
71
|
+
| Action | Count | Details |
|
|
72
|
+
|--------|-------|---------|
|
|
73
|
+
| Archived | 12 | Closed >30 days |
|
|
74
|
+
| Kept | 3 | Still relevant |
|
|
75
|
+
| Active | 34 | Current work |
|
|
76
|
+
|
|
77
|
+
**Active issue count**: 34 (target: <50) ✅
|
|
78
|
+
|
|
79
|
+
### Specifications
|
|
80
|
+
| Action | Count |
|
|
81
|
+
|--------|-------|
|
|
82
|
+
| Archived | 5 |
|
|
83
|
+
| Current | 8 |
|
|
84
|
+
|
|
85
|
+
### Handoffs
|
|
86
|
+
| Action | Count |
|
|
87
|
+
|--------|-------|
|
|
88
|
+
| Archived | 15 |
|
|
89
|
+
| Kept | 7 |
|
|
90
|
+
|
|
91
|
+
### Summary
|
|
92
|
+
- Archived 12 issues, 5 specs, 15 handoffs
|
|
93
|
+
- Context is now lean and current
|
|
94
|
+
- Next decay review: [Date + 7 days]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Archive vs Delete
|
|
98
|
+
|
|
99
|
+
**Archive** (preserve but hide):
|
|
100
|
+
- Completed features (might need reference)
|
|
101
|
+
- Historical decisions
|
|
102
|
+
- Significant milestones
|
|
103
|
+
|
|
104
|
+
**Delete** (truly remove):
|
|
105
|
+
- Duplicate issues
|
|
106
|
+
- Abandoned experiments (with note)
|
|
107
|
+
- Outdated drafts never implemented
|
|
108
|
+
|
|
109
|
+
## Decay Schedule
|
|
110
|
+
|
|
111
|
+
| Item | Review Frequency | Archive After |
|
|
112
|
+
|------|-----------------|---------------|
|
|
113
|
+
| Linear issues | Weekly | 30 days closed |
|
|
114
|
+
| Specs | Monthly | 90 days implemented |
|
|
115
|
+
| Handoffs | Weekly | 7 days |
|
|
116
|
+
| Change docs | Monthly | 60 days implemented |
|
|
117
|
+
|
|
118
|
+
## Key Behaviors
|
|
119
|
+
- Regular cadence prevents buildup
|
|
120
|
+
- Archive, don't delete (usually)
|
|
121
|
+
- Capture learnings before archiving
|
|
122
|
+
- Keep context lean for AI efficiency
|
|
123
|
+
|
|
124
|
+
## Integration Points
|
|
125
|
+
- Scheduled: Weekly (Friday recommended)
|
|
126
|
+
- Affects: Linear, .claude/specs/, .claude/handoffs/
|
|
127
|
+
- Follows: `/weekly-review` for full maintenance
|