@lvlup-sw/exarchos 2.0.1
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/.claude-plugin/marketplace.json +22 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.mcp.json +17 -0
- package/AGENTS.md +59 -0
- package/CLAUDE.md.template +62 -0
- package/LICENSE +202 -0
- package/README.md +258 -0
- package/commands/autocompact.md +37 -0
- package/commands/checkpoint.md +85 -0
- package/commands/cleanup.md +99 -0
- package/commands/debug.md +145 -0
- package/commands/delegate.md +56 -0
- package/commands/ideate.md +82 -0
- package/commands/plan.md +150 -0
- package/commands/refactor.md +139 -0
- package/commands/reload.md +37 -0
- package/commands/resume.md +130 -0
- package/commands/review.md +51 -0
- package/commands/sync-schemas.md +74 -0
- package/commands/synthesize.md +122 -0
- package/commands/tdd.md +58 -0
- package/dist/exarchos-cli.js +8828 -0
- package/dist/exarchos-mcp.js +50 -0
- package/hooks/hooks.json +53 -0
- package/package.json +59 -0
- package/rules/coding-standards.md +46 -0
- package/rules/mcp-tool-guidance.md +26 -0
- package/rules/pr-descriptions.md +12 -0
- package/rules/rm-safety.md +9 -0
- package/rules/skill-path-resolution.md +10 -0
- package/rules/tdd.md +41 -0
- package/rules/telemetry-awareness.md +9 -0
- package/scripts/assess-refactor-scope.sh +239 -0
- package/scripts/check-benchmark-regression.sh +229 -0
- package/scripts/check-coderabbit.sh +288 -0
- package/scripts/check-coverage-thresholds.sh +194 -0
- package/scripts/check-polish-scope.sh +245 -0
- package/scripts/check-property-tests.sh +167 -0
- package/scripts/check-tdd-compliance.sh +265 -0
- package/scripts/coderabbit-review-gate.sh +518 -0
- package/scripts/debug-review-gate.sh +201 -0
- package/scripts/extract-fix-tasks.sh +179 -0
- package/scripts/extract-task.sh +67 -0
- package/scripts/generate-traceability.sh +209 -0
- package/scripts/investigation-timer.sh +171 -0
- package/scripts/needs-schema-sync.sh +174 -0
- package/scripts/new-project.sh +103 -0
- package/scripts/post-delegation-check.sh +317 -0
- package/scripts/pre-synthesis-check.sh +440 -0
- package/scripts/reconcile-state.sh +346 -0
- package/scripts/reconstruct-stack.sh +432 -0
- package/scripts/review-diff.sh +63 -0
- package/scripts/review-verdict.sh +169 -0
- package/scripts/security-scan.sh +248 -0
- package/scripts/select-debug-track.sh +186 -0
- package/scripts/setup-worktree.sh +323 -0
- package/scripts/spec-coverage-check.sh +230 -0
- package/scripts/static-analysis-gate.sh +236 -0
- package/scripts/sync-labels.sh +122 -0
- package/scripts/validate-companion.sh +161 -0
- package/scripts/validate-dotnet-standards.sh +267 -0
- package/scripts/validate-installation.sh +101 -0
- package/scripts/validate-plugin.sh +223 -0
- package/scripts/validate-refactor.sh +234 -0
- package/scripts/validate-rm.sh +93 -0
- package/scripts/verify-delegation-saga.sh +240 -0
- package/scripts/verify-doc-links.sh +211 -0
- package/scripts/verify-ideate-artifacts.sh +296 -0
- package/scripts/verify-plan-coverage.sh +228 -0
- package/scripts/verify-review-triage.sh +219 -0
- package/scripts/verify-worktree-baseline.sh +159 -0
- package/scripts/verify-worktree.sh +84 -0
- package/settings.json +47 -0
- package/skills/brainstorming/SKILL.md +127 -0
- package/skills/brainstorming/references/design-template.md +65 -0
- package/skills/cleanup/SKILL.md +147 -0
- package/skills/cleanup/references/merge-verification.md +40 -0
- package/skills/debug/SKILL.md +204 -0
- package/skills/debug/references/hotfix-track.md +134 -0
- package/skills/debug/references/investigation-checklist.md +217 -0
- package/skills/debug/references/rca-template.md +150 -0
- package/skills/debug/references/state-schema.md +294 -0
- package/skills/debug/references/thorough-track.md +194 -0
- package/skills/debug/references/triage-questions.md +155 -0
- package/skills/debug/references/troubleshooting.md +47 -0
- package/skills/delegation/SKILL.md +150 -0
- package/skills/delegation/references/adaptive-orchestration.md +31 -0
- package/skills/delegation/references/agent-teams-saga.md +248 -0
- package/skills/delegation/references/fix-mode.md +74 -0
- package/skills/delegation/references/fixer-prompt.md +162 -0
- package/skills/delegation/references/implementer-prompt.md +322 -0
- package/skills/delegation/references/parallel-strategy.md +124 -0
- package/skills/delegation/references/pbt-patterns.md +172 -0
- package/skills/delegation/references/pr-fixes-mode.md +154 -0
- package/skills/delegation/references/state-management.md +51 -0
- package/skills/delegation/references/testing-patterns.md +129 -0
- package/skills/delegation/references/troubleshooting.md +33 -0
- package/skills/delegation/references/workflow-steps.md +127 -0
- package/skills/delegation/references/worktree-enforcement.md +64 -0
- package/skills/dotnet-standards/SKILL.md +269 -0
- package/skills/dotnet-standards/references/csharp-standards.md +120 -0
- package/skills/dotnet-standards/templates/.editorconfig +366 -0
- package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
- package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
- package/skills/dotnet-standards/templates/global.json +6 -0
- package/skills/dotnet-standards/templates/nuget.config +9 -0
- package/skills/dotnet-standards/templates/stylecop.json +37 -0
- package/skills/git-worktrees/SKILL.md +255 -0
- package/skills/implementation-planning/SKILL.md +233 -0
- package/skills/implementation-planning/references/plan-document-template.md +42 -0
- package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
- package/skills/implementation-planning/references/task-template.md +43 -0
- package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
- package/skills/quality-review/SKILL.md +278 -0
- package/skills/quality-review/references/code-quality-checklist.md +159 -0
- package/skills/quality-review/references/review-report-template.md +65 -0
- package/skills/quality-review/references/security-checklist.md +79 -0
- package/skills/quality-review/references/typescript-standards.md +24 -0
- package/skills/refactor/COMMAND.md +67 -0
- package/skills/refactor/SKILL.md +198 -0
- package/skills/refactor/phases/auto-chain.md +262 -0
- package/skills/refactor/phases/brief.md +176 -0
- package/skills/refactor/phases/explore.md +132 -0
- package/skills/refactor/phases/overhaul-delegate.md +136 -0
- package/skills/refactor/phases/overhaul-plan.md +312 -0
- package/skills/refactor/phases/overhaul-review.md +304 -0
- package/skills/refactor/phases/polish-implement.md +349 -0
- package/skills/refactor/phases/polish-validate.md +218 -0
- package/skills/refactor/phases/update-docs.md +234 -0
- package/skills/refactor/references/brief-template.md +81 -0
- package/skills/refactor/references/doc-update-checklist.md +110 -0
- package/skills/refactor/references/explore-checklist.md +73 -0
- package/skills/refactor/references/overhaul-track.md +215 -0
- package/skills/refactor/references/polish-track.md +170 -0
- package/skills/shared/prompts/context-reading.md +58 -0
- package/skills/shared/prompts/report-format.md +54 -0
- package/skills/shared/prompts/tdd-requirements.md +39 -0
- package/skills/shepherd/SKILL.md +264 -0
- package/skills/shepherd/references/assess-checklist.md +124 -0
- package/skills/shepherd/references/fix-strategies.md +191 -0
- package/skills/spec-review/SKILL.md +229 -0
- package/skills/spec-review/references/review-checklist.md +60 -0
- package/skills/sync-schemas/SKILL.md +114 -0
- package/skills/sync-schemas/references/configuration.md +73 -0
- package/skills/synthesis/SKILL.md +129 -0
- package/skills/synthesis/references/pr-descriptions.md +87 -0
- package/skills/synthesis/references/synthesis-steps.md +109 -0
- package/skills/synthesis/references/troubleshooting.md +115 -0
- package/skills/validate-all-skills.sh +57 -0
- package/skills/validate-frontmatter.sh +237 -0
- package/skills/workflow-state/SKILL.md +210 -0
- package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
- package/skills/workflow-state/references/phase-transitions.md +141 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shepherd
|
|
3
|
+
description: "Shepherd PRs through CI checks and code reviews to merge readiness. Use after /synthesize to monitor CI, address CodeRabbit/Graphite feedback, fix failures, restack, and request approval. Triggers: 'shepherd', 'tend PRs', 'check CI', or /shepherd. Do NOT use before PRs are published — run /synthesize first."
|
|
4
|
+
metadata:
|
|
5
|
+
author: exarchos
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
mcp-server: exarchos
|
|
8
|
+
category: workflow
|
|
9
|
+
phase-affinity: synthesize
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Shepherd Skill
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Iterative loop that shepherds published PRs through CI checks and automated code reviews to merge readiness. Runs after `/synthesize` (or `/review` if PRs already exist). Monitors CI, addresses CodeRabbit and Graphite agent feedback, fixes failures, restacks as needed, and requests approval when everything is green.
|
|
17
|
+
|
|
18
|
+
**Position in workflow:**
|
|
19
|
+
```
|
|
20
|
+
/synthesize → /shepherd (assess → fix → restack → loop) → /cleanup
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Triggers
|
|
24
|
+
|
|
25
|
+
Activate this skill when:
|
|
26
|
+
- User runs `/shepherd` command
|
|
27
|
+
- User says "shepherd", "tend PRs", "check CI", "address review feedback"
|
|
28
|
+
- PRs are published and need monitoring through the CI/review gauntlet
|
|
29
|
+
- After `/synthesize` completes and PRs are enqueued
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
- Active workflow with PRs published (PR URLs in `synthesis.prUrl` or `artifacts.pr`)
|
|
34
|
+
- Graphite stack submitted (`gt submit` already ran)
|
|
35
|
+
- User has `gh` CLI authenticated
|
|
36
|
+
|
|
37
|
+
## Process
|
|
38
|
+
|
|
39
|
+
The shepherd loop repeats until all PRs are green or the user aborts.
|
|
40
|
+
|
|
41
|
+
### 1. Assess
|
|
42
|
+
|
|
43
|
+
Gather the current state of all PRs in the stack. See `references/assess-checklist.md` for detailed steps.
|
|
44
|
+
|
|
45
|
+
**Read PR URLs from workflow state:**
|
|
46
|
+
```
|
|
47
|
+
mcp__exarchos__exarchos_workflow({ action: "get", featureId: "<id>", fields: ["synthesis", "artifacts"] })
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**For each PR, check three dimensions:**
|
|
51
|
+
|
|
52
|
+
| Dimension | Tool | Pass condition |
|
|
53
|
+
|-----------|------|----------------|
|
|
54
|
+
| CI checks | `gh pr checks <number>` | All checks pass |
|
|
55
|
+
| CodeRabbit | `scripts/check-coderabbit.sh --owner <owner> --repo <repo> --json <numbers>` | All APPROVED or NONE |
|
|
56
|
+
| Other reviews | `gh pr view <number> --json reviews,reviewRequests` | No CHANGES_REQUESTED |
|
|
57
|
+
|
|
58
|
+
**Check stack health:**
|
|
59
|
+
```
|
|
60
|
+
mcp__graphite__run_gt_cmd({ args: ["log"] })
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Verify base branch targeting is correct and stack is not in a broken state.
|
|
64
|
+
|
|
65
|
+
**Report status to user:**
|
|
66
|
+
```markdown
|
|
67
|
+
## PR Status — Iteration <N>
|
|
68
|
+
|
|
69
|
+
| PR | CI | CodeRabbit | Reviews | Base |
|
|
70
|
+
|----|-----|-----------|---------|------|
|
|
71
|
+
| #123 | pass | APPROVED | pending | main |
|
|
72
|
+
| #124 | fail | CHANGES_REQUESTED | — | #123 |
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2. Evaluate
|
|
76
|
+
|
|
77
|
+
If ALL dimensions pass for ALL PRs → skip to step 5 (Request Approval).
|
|
78
|
+
|
|
79
|
+
Otherwise, categorize issues:
|
|
80
|
+
|
|
81
|
+
| Issue type | Action |
|
|
82
|
+
|------------|--------|
|
|
83
|
+
| CI failure | Investigate logs, fix directly or dispatch |
|
|
84
|
+
| CodeRabbit feedback | Read comments, address feedback |
|
|
85
|
+
| Graphite/human review feedback | Read comments, address feedback |
|
|
86
|
+
| Base branch wrong | Restack via `gt restack` |
|
|
87
|
+
| Stack broken | Reconstruct via `scripts/reconstruct-stack.sh` |
|
|
88
|
+
|
|
89
|
+
### 3. Fix
|
|
90
|
+
|
|
91
|
+
Address issues based on type. See `references/fix-strategies.md` for detailed strategies.
|
|
92
|
+
|
|
93
|
+
**For review feedback (CodeRabbit, Graphite agent, human):**
|
|
94
|
+
1. Read PR comments: `gh api repos/<owner>/<repo>/pulls/<number>/comments`
|
|
95
|
+
2. Read review comments: `gh pr view <number> --json reviews`
|
|
96
|
+
3. Categorize feedback: actionable fix vs. style nit vs. question to answer
|
|
97
|
+
4. For actionable fixes: apply changes directly (if small) or dispatch via delegation
|
|
98
|
+
5. For questions: respond on the PR via `gh pr comment` or `gh api`
|
|
99
|
+
|
|
100
|
+
**For CI failures:**
|
|
101
|
+
1. Read check details: `gh pr checks <number> --json name,status,conclusion,detailsUrl`
|
|
102
|
+
2. Identify failure cause from logs
|
|
103
|
+
3. Fix directly (if small) or dispatch via delegation
|
|
104
|
+
4. Push fixes to the appropriate stack branch
|
|
105
|
+
|
|
106
|
+
**For stack issues:**
|
|
107
|
+
1. Restack: `mcp__graphite__run_gt_cmd({ args: ["restack"] })`
|
|
108
|
+
2. Verify: `mcp__graphite__run_gt_cmd({ args: ["log"] })`
|
|
109
|
+
|
|
110
|
+
### 4. Resubmit
|
|
111
|
+
|
|
112
|
+
After fixes are applied:
|
|
113
|
+
```
|
|
114
|
+
mcp__graphite__run_gt_cmd({ args: ["submit", "--no-interactive", "--publish", "--merge-when-ready"] })
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Return to step 1 (Assess) for the next iteration.
|
|
118
|
+
|
|
119
|
+
### 5. Request Approval
|
|
120
|
+
|
|
121
|
+
When all checks and reviews are green:
|
|
122
|
+
|
|
123
|
+
1. Identify required approvers (repo settings or user-specified)
|
|
124
|
+
2. Request review:
|
|
125
|
+
```bash
|
|
126
|
+
gh pr edit <number> --add-reviewer <approver>
|
|
127
|
+
```
|
|
128
|
+
3. Report to user:
|
|
129
|
+
```markdown
|
|
130
|
+
## Ready for Approval
|
|
131
|
+
|
|
132
|
+
All CI checks pass. All automated reviews approved.
|
|
133
|
+
Approval requested from: <approvers>
|
|
134
|
+
|
|
135
|
+
PRs:
|
|
136
|
+
- #123: <url>
|
|
137
|
+
- #124: <url>
|
|
138
|
+
|
|
139
|
+
Run `/cleanup` after merge completes.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Iteration Limits
|
|
143
|
+
|
|
144
|
+
**Default: 5 iterations.** If the loop exceeds this limit without all PRs going green, pause and report to the user with a summary of persistent issues.
|
|
145
|
+
|
|
146
|
+
The user can override: `/shepherd --max-iterations 10`
|
|
147
|
+
|
|
148
|
+
## State Management
|
|
149
|
+
|
|
150
|
+
Track shepherd progress in the workflow state under the `shepherd` field.
|
|
151
|
+
|
|
152
|
+
### Initialize Shepherd
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
mcp__exarchos__exarchos_workflow({
|
|
156
|
+
action: "set",
|
|
157
|
+
featureId: "<id>",
|
|
158
|
+
updates: {
|
|
159
|
+
"shepherd": {
|
|
160
|
+
"startedAt": "<ISO8601>",
|
|
161
|
+
"currentIteration": 0,
|
|
162
|
+
"maxIterations": 5,
|
|
163
|
+
"iterations": [],
|
|
164
|
+
"approvalRequested": false
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Record Iteration
|
|
171
|
+
|
|
172
|
+
After each assess cycle:
|
|
173
|
+
```
|
|
174
|
+
mcp__exarchos__exarchos_workflow({
|
|
175
|
+
action: "set",
|
|
176
|
+
featureId: "<id>",
|
|
177
|
+
updates: {
|
|
178
|
+
"shepherd": {
|
|
179
|
+
"currentIteration": <N>,
|
|
180
|
+
"iterations": [
|
|
181
|
+
{
|
|
182
|
+
"iteration": <N>,
|
|
183
|
+
"assessedAt": "<ISO8601>",
|
|
184
|
+
"ciStatus": "pass | fail | pending",
|
|
185
|
+
"reviewStatus": {
|
|
186
|
+
"coderabbit": "APPROVED | CHANGES_REQUESTED | PENDING | NONE",
|
|
187
|
+
"otherReviews": "approved | changes_requested | pending | none"
|
|
188
|
+
},
|
|
189
|
+
"stackHealth": "healthy | needs-restack | broken",
|
|
190
|
+
"actions": ["fixed lint error in src/foo.ts", "addressed CodeRabbit feedback on PR #123"],
|
|
191
|
+
"result": "all-green | fixes-applied | blocked"
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Record Approval Request
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
mcp__exarchos__exarchos_workflow({
|
|
203
|
+
action: "set",
|
|
204
|
+
featureId: "<id>",
|
|
205
|
+
updates: {
|
|
206
|
+
"shepherd": {
|
|
207
|
+
"approvalRequested": true,
|
|
208
|
+
"approvalRequestedAt": "<ISO8601>",
|
|
209
|
+
"approvers": ["<username>"]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Completion Criteria
|
|
216
|
+
|
|
217
|
+
- [ ] All CI checks pass on all PRs
|
|
218
|
+
- [ ] CodeRabbit: APPROVED or NONE on all PRs
|
|
219
|
+
- [ ] No CHANGES_REQUESTED from any reviewer
|
|
220
|
+
- [ ] Stack is healthy (correct base branches, no conflicts)
|
|
221
|
+
- [ ] Approval requested from required reviewers
|
|
222
|
+
- [ ] State updated with shepherd history
|
|
223
|
+
|
|
224
|
+
## Anti-Patterns
|
|
225
|
+
|
|
226
|
+
| Don't | Do Instead |
|
|
227
|
+
|-------|------------|
|
|
228
|
+
| Force-merge with failing CI | Fix the failures first |
|
|
229
|
+
| Dismiss CodeRabbit reviews without reading | Address or acknowledge each comment |
|
|
230
|
+
| Skip restack when base branch changes | Always verify stack health |
|
|
231
|
+
| Loop indefinitely | Respect iteration limits, escalate to user |
|
|
232
|
+
| Fix issues without recording in state | Track every iteration for resumability |
|
|
233
|
+
| Push directly to main | All fixes go through the stack branches |
|
|
234
|
+
|
|
235
|
+
## Exarchos Integration
|
|
236
|
+
|
|
237
|
+
When Exarchos MCP tools are available:
|
|
238
|
+
|
|
239
|
+
1. **On shepherd start:** `mcp__exarchos__exarchos_event` with `action: "append"` — event type `shepherd.started` with PR URLs and iteration count
|
|
240
|
+
2. **On each iteration:** `mcp__exarchos__exarchos_event` with `action: "append"` — event type `shepherd.iteration` with assessment results and actions taken
|
|
241
|
+
3. **On approval request:** `mcp__exarchos__exarchos_event` with `action: "append"` — event type `shepherd.approval_requested` with approver list
|
|
242
|
+
4. **On completion:** `mcp__exarchos__exarchos_event` with `action: "append"` — event type `shepherd.completed` with total iterations and final status
|
|
243
|
+
|
|
244
|
+
## Troubleshooting
|
|
245
|
+
|
|
246
|
+
| Issue | Cause | Resolution |
|
|
247
|
+
|-------|-------|------------|
|
|
248
|
+
| CI check stuck in pending | GitHub Actions queue delay | Wait 5 min, re-check. If still pending, re-trigger via `gh run rerun <id>` |
|
|
249
|
+
| CodeRabbit not reviewing | PR too large or rate-limited | Check `scripts/check-coderabbit.sh` output. Wait 10 min or split PR |
|
|
250
|
+
| Stack base branch wrong | Rebase drift after fixes | `mcp__graphite__run_gt_cmd` with `["restack"]`, then resubmit |
|
|
251
|
+
| Iteration limit exceeded | Persistent flaky test or review loop | Report blockers to user with iteration history |
|
|
252
|
+
| Resubmit creates draft PRs | Missing `--publish` flag | Always use `--publish --merge-when-ready` together |
|
|
253
|
+
|
|
254
|
+
## Performance Notes
|
|
255
|
+
|
|
256
|
+
- Check all PR dimensions in parallel (CI, CodeRabbit, reviews) rather than sequentially
|
|
257
|
+
- Use `--json` flag on `gh pr checks` and `gh pr view` to reduce parsing overhead
|
|
258
|
+
- Limit iteration state recording to changed fields (don't re-record entire history each iteration)
|
|
259
|
+
|
|
260
|
+
## Transition
|
|
261
|
+
|
|
262
|
+
After approval is granted and PRs merge:
|
|
263
|
+
- Run `/cleanup` to resolve the workflow to completed state
|
|
264
|
+
- Shepherd state persists in workflow for audit trail
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Assessment Checklist
|
|
2
|
+
|
|
3
|
+
Detailed steps for gathering PR status during each shepherd iteration.
|
|
4
|
+
|
|
5
|
+
## 1. Identify PRs
|
|
6
|
+
|
|
7
|
+
Read PR URLs from workflow state:
|
|
8
|
+
```
|
|
9
|
+
mcp__exarchos__exarchos_workflow({ action: "get", featureId: "<id>", fields: ["synthesis", "artifacts"] })
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Extract PR numbers from URLs (e.g., `https://github.com/owner/repo/pull/123` → `123`).
|
|
13
|
+
|
|
14
|
+
If no PRs in state, check Graphite:
|
|
15
|
+
```
|
|
16
|
+
mcp__graphite__run_gt_cmd({ args: ["log"] })
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 2. CI Check Status
|
|
20
|
+
|
|
21
|
+
For each PR:
|
|
22
|
+
```bash
|
|
23
|
+
gh pr checks <number> --json name,status,conclusion,detailsUrl
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Classification:
|
|
27
|
+
| conclusion | Status |
|
|
28
|
+
|------------|--------|
|
|
29
|
+
| `SUCCESS` | pass |
|
|
30
|
+
| `NEUTRAL`, `SKIPPED` | pass (ignorable) |
|
|
31
|
+
| `FAILURE`, `TIMED_OUT` | fail |
|
|
32
|
+
| `ACTION_REQUIRED` | needs attention |
|
|
33
|
+
| `null` (still running) | pending |
|
|
34
|
+
|
|
35
|
+
**Aggregate rule:** ALL checks must be `SUCCESS`, `NEUTRAL`, or `SKIPPED` for CI to pass. Any `FAILURE` or `TIMED_OUT` → CI fails.
|
|
36
|
+
|
|
37
|
+
**Wait for pending:** If checks are still running, inform the user and suggest waiting. Do NOT treat pending as failure unless it has been pending for an unreasonable time (>30 minutes).
|
|
38
|
+
|
|
39
|
+
## 3. CodeRabbit Review Status
|
|
40
|
+
|
|
41
|
+
Use the existing script:
|
|
42
|
+
```bash
|
|
43
|
+
scripts/check-coderabbit.sh --owner <owner> --repo <repo> --json <pr-numbers...>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Output (JSON mode):
|
|
47
|
+
```json
|
|
48
|
+
[
|
|
49
|
+
{"pr": "123", "state": "APPROVED", "verdict": "pass"},
|
|
50
|
+
{"pr": "124", "state": "CHANGES_REQUESTED", "verdict": "fail"}
|
|
51
|
+
]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**If CHANGES_REQUESTED:** Read the specific comments to understand what needs fixing.
|
|
55
|
+
|
|
56
|
+
## 4. Other Review Status
|
|
57
|
+
|
|
58
|
+
Check for reviews from Graphite agent, human reviewers, or other bots:
|
|
59
|
+
```bash
|
|
60
|
+
gh pr view <number> --json reviews,reviewRequests
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Review classification:
|
|
64
|
+
| state | Meaning |
|
|
65
|
+
|-------|---------|
|
|
66
|
+
| `APPROVED` | Reviewer approved |
|
|
67
|
+
| `CHANGES_REQUESTED` | Reviewer wants changes |
|
|
68
|
+
| `COMMENTED` | Non-blocking comment |
|
|
69
|
+
| `PENDING` | Review requested but not submitted |
|
|
70
|
+
| `DISMISSED` | Review was dismissed |
|
|
71
|
+
|
|
72
|
+
**Aggregate rule:** No `CHANGES_REQUESTED` reviews from any reviewer. `COMMENTED` and `PENDING` are non-blocking.
|
|
73
|
+
|
|
74
|
+
## 5. Stack Health
|
|
75
|
+
|
|
76
|
+
Check the Graphite stack state:
|
|
77
|
+
```
|
|
78
|
+
mcp__graphite__run_gt_cmd({ args: ["log"] })
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Verify:
|
|
82
|
+
- All expected branches are present in the stack
|
|
83
|
+
- Base branch targeting is correct (bottom of stack targets `main`)
|
|
84
|
+
- Each PR's base matches its parent in the stack
|
|
85
|
+
- No "needs restack" indicators
|
|
86
|
+
|
|
87
|
+
If base branch has advanced:
|
|
88
|
+
```
|
|
89
|
+
mcp__graphite__run_gt_cmd({ args: ["restack"] })
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 6. Merge Readiness
|
|
93
|
+
|
|
94
|
+
Check if `--merge-when-ready` is active:
|
|
95
|
+
```bash
|
|
96
|
+
gh pr view <number> --json autoMergeRequest
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If `autoMergeRequest` is null, merge-when-ready is not set. Re-enable:
|
|
100
|
+
```
|
|
101
|
+
mcp__graphite__run_gt_cmd({ args: ["submit", "--no-interactive", "--publish", "--merge-when-ready"] })
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 7. Aggregate and Report
|
|
105
|
+
|
|
106
|
+
Build the status table:
|
|
107
|
+
|
|
108
|
+
```markdown
|
|
109
|
+
## PR Status — Iteration <N>
|
|
110
|
+
|
|
111
|
+
| PR | CI | CodeRabbit | Reviews | Stack | Merge Queue |
|
|
112
|
+
|----|-----|-----------|---------|-------|-------------|
|
|
113
|
+
| #123 | pass | APPROVED | 1 approved | healthy | enqueued |
|
|
114
|
+
| #124 | fail (lint) | CHANGES_REQUESTED | pending | healthy | blocked |
|
|
115
|
+
|
|
116
|
+
### Issues Found
|
|
117
|
+
1. **PR #124 CI:** Lint failure in `src/foo.ts:42` — unused import
|
|
118
|
+
2. **PR #124 CodeRabbit:** Suggests extracting helper function in `bar.ts`
|
|
119
|
+
|
|
120
|
+
### Recommended Actions
|
|
121
|
+
1. Fix lint error in `src/foo.ts`
|
|
122
|
+
2. Address CodeRabbit feedback on `bar.ts`
|
|
123
|
+
3. Resubmit stack after fixes
|
|
124
|
+
```
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Fix Strategies
|
|
2
|
+
|
|
3
|
+
How to address common issues found during shepherd assessment.
|
|
4
|
+
|
|
5
|
+
## Decision: Fix Directly vs. Delegate
|
|
6
|
+
|
|
7
|
+
| Condition | Approach |
|
|
8
|
+
|-----------|----------|
|
|
9
|
+
| Single file, < 20 lines changed | Fix directly in the stack branch |
|
|
10
|
+
| Multiple files, contained concern | Fix directly if < 5 files |
|
|
11
|
+
| Cross-cutting or architectural | Delegate via `/delegate --pr-fixes [PR_URL]` |
|
|
12
|
+
| Test changes needed | Fix directly (keep TDD cycle tight) |
|
|
13
|
+
|
|
14
|
+
**Default to fixing directly** — delegation adds overhead. Only delegate when the fix scope warrants it.
|
|
15
|
+
|
|
16
|
+
## CI Failures
|
|
17
|
+
|
|
18
|
+
### Lint / Format
|
|
19
|
+
|
|
20
|
+
1. Read the failure details:
|
|
21
|
+
```bash
|
|
22
|
+
gh pr checks <number> --json name,conclusion,detailsUrl
|
|
23
|
+
```
|
|
24
|
+
2. Checkout the failing branch:
|
|
25
|
+
```
|
|
26
|
+
mcp__graphite__run_gt_cmd({ args: ["checkout", "<branch-name>"] })
|
|
27
|
+
```
|
|
28
|
+
3. Run the linter locally to reproduce:
|
|
29
|
+
```bash
|
|
30
|
+
npm run lint # or project-specific command
|
|
31
|
+
```
|
|
32
|
+
4. Fix the issues
|
|
33
|
+
5. Commit and resubmit:
|
|
34
|
+
```
|
|
35
|
+
mcp__graphite__run_gt_cmd({ args: ["modify", "-m", "fix: lint errors"] })
|
|
36
|
+
mcp__graphite__run_gt_cmd({ args: ["submit", "--no-interactive", "--publish", "--merge-when-ready"] })
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Test Failures
|
|
40
|
+
|
|
41
|
+
1. Identify which tests failed from CI output
|
|
42
|
+
2. Checkout the branch and reproduce locally:
|
|
43
|
+
```bash
|
|
44
|
+
npm run test:run
|
|
45
|
+
```
|
|
46
|
+
3. Fix the failing tests (maintain TDD — don't delete tests, fix the code or update test expectations if the behavior changed intentionally)
|
|
47
|
+
4. Verify all tests pass locally before pushing
|
|
48
|
+
5. Commit and resubmit
|
|
49
|
+
|
|
50
|
+
### Build / TypeCheck Failures
|
|
51
|
+
|
|
52
|
+
1. Reproduce locally:
|
|
53
|
+
```bash
|
|
54
|
+
npm run build && npm run typecheck
|
|
55
|
+
```
|
|
56
|
+
2. Fix type errors or build issues
|
|
57
|
+
3. Commit and resubmit
|
|
58
|
+
|
|
59
|
+
### Flaky Tests
|
|
60
|
+
|
|
61
|
+
If a test passes locally but fails in CI:
|
|
62
|
+
1. Check if it's a known flaky test
|
|
63
|
+
2. Re-run CI: `gh pr checks <number> --watch` (or push an empty commit to retrigger)
|
|
64
|
+
3. If consistently flaky, fix the test or mark it with a skip annotation and create a follow-up issue
|
|
65
|
+
|
|
66
|
+
## Review Feedback
|
|
67
|
+
|
|
68
|
+
### CodeRabbit Comments
|
|
69
|
+
|
|
70
|
+
1. Read all CodeRabbit comments:
|
|
71
|
+
```bash
|
|
72
|
+
gh api repos/<owner>/<repo>/pulls/<number>/comments --jq '.[] | select(.user.login | test("coderabbit")) | {path: .path, line: .line, body: .body}'
|
|
73
|
+
```
|
|
74
|
+
2. Also check the review body (summary comments):
|
|
75
|
+
```bash
|
|
76
|
+
gh api repos/<owner>/<repo>/pulls/<number>/reviews --jq '.[] | select(.user.login | test("coderabbit")) | {state: .state, body: .body}'
|
|
77
|
+
```
|
|
78
|
+
3. Categorize each comment:
|
|
79
|
+
|
|
80
|
+
| Category | Action |
|
|
81
|
+
|----------|--------|
|
|
82
|
+
| Bug/correctness issue | Must fix |
|
|
83
|
+
| Security concern | Must fix |
|
|
84
|
+
| Style/naming suggestion | Fix if reasonable, otherwise acknowledge |
|
|
85
|
+
| Performance suggestion | Fix if low-effort, otherwise note for later |
|
|
86
|
+
| False positive | Dismiss with explanation |
|
|
87
|
+
|
|
88
|
+
4. Apply fixes to the appropriate branch
|
|
89
|
+
5. Respond to CodeRabbit if needed (it re-reviews automatically on push)
|
|
90
|
+
|
|
91
|
+
### Graphite Agent Comments
|
|
92
|
+
|
|
93
|
+
Same approach as CodeRabbit. Graphite agent reviews tend to focus on:
|
|
94
|
+
- PR description quality
|
|
95
|
+
- Commit message format
|
|
96
|
+
- Breaking change detection
|
|
97
|
+
- Dependency impact
|
|
98
|
+
|
|
99
|
+
### Human Reviewer Comments
|
|
100
|
+
|
|
101
|
+
1. Read comments carefully
|
|
102
|
+
2. For each comment, determine if it's:
|
|
103
|
+
- A required change (fix it)
|
|
104
|
+
- A question (answer it on the PR)
|
|
105
|
+
- A suggestion (discuss or implement)
|
|
106
|
+
- An approval with minor nits (fix nits, note the approval)
|
|
107
|
+
3. Respond to the reviewer on the PR:
|
|
108
|
+
```bash
|
|
109
|
+
gh pr comment <number> --body "Addressed feedback: <summary of changes>"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Stack Issues
|
|
113
|
+
|
|
114
|
+
### Needs Restack
|
|
115
|
+
|
|
116
|
+
When the base branch (usually `main`) has advanced:
|
|
117
|
+
```
|
|
118
|
+
mcp__graphite__run_gt_cmd({ args: ["restack"] })
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If restack has conflicts:
|
|
122
|
+
1. Resolve conflicts in each affected file
|
|
123
|
+
2. `git add <resolved-files>` then continue:
|
|
124
|
+
```
|
|
125
|
+
mcp__graphite__run_gt_cmd({ args: ["continue"] })
|
|
126
|
+
```
|
|
127
|
+
3. After resolution, resubmit
|
|
128
|
+
|
|
129
|
+
### Wrong Base Branch
|
|
130
|
+
|
|
131
|
+
If a PR targets the wrong base:
|
|
132
|
+
```
|
|
133
|
+
mcp__graphite__run_gt_cmd({ args: ["restack"] })
|
|
134
|
+
mcp__graphite__run_gt_cmd({ args: ["submit", "--no-interactive", "--publish", "--merge-when-ready"] })
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Stack Reconstruction
|
|
138
|
+
|
|
139
|
+
If the stack is in a broken state:
|
|
140
|
+
```bash
|
|
141
|
+
scripts/reconstruct-stack.sh
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Then resubmit.
|
|
145
|
+
|
|
146
|
+
## Commit Strategy for Fixes
|
|
147
|
+
|
|
148
|
+
When making fixes to stack branches:
|
|
149
|
+
|
|
150
|
+
1. **Checkout the target branch:**
|
|
151
|
+
```
|
|
152
|
+
mcp__graphite__run_gt_cmd({ args: ["checkout", "<branch-name>"] })
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
2. **Apply fixes and amend:**
|
|
156
|
+
```
|
|
157
|
+
mcp__graphite__run_gt_cmd({ args: ["modify", "-m", "fix: <description>"] })
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
3. **Restack dependent branches:**
|
|
161
|
+
```
|
|
162
|
+
mcp__graphite__run_gt_cmd({ args: ["restack"] })
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
4. **Resubmit the full stack:**
|
|
166
|
+
```
|
|
167
|
+
mcp__graphite__run_gt_cmd({ args: ["submit", "--no-interactive", "--publish", "--merge-when-ready"] })
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**IMPORTANT:** Always resubmit with `--publish --merge-when-ready` to maintain merge queue enrollment.
|
|
171
|
+
|
|
172
|
+
## Responding on PRs
|
|
173
|
+
|
|
174
|
+
When addressing feedback, communicate clearly:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Reply to a specific review comment
|
|
178
|
+
gh api repos/<owner>/<repo>/pulls/<number>/comments/<comment-id>/replies \
|
|
179
|
+
-f body="Fixed in <commit-sha>. <brief explanation>"
|
|
180
|
+
|
|
181
|
+
# General PR comment summarizing all fixes
|
|
182
|
+
gh pr comment <number> --body "$(cat <<'EOF'
|
|
183
|
+
Addressed review feedback:
|
|
184
|
+
- Fixed lint error in `src/foo.ts` (unused import)
|
|
185
|
+
- Extracted helper function per CodeRabbit suggestion
|
|
186
|
+
- Added missing error handling in `bar.ts`
|
|
187
|
+
|
|
188
|
+
All CI checks should pass on the next run.
|
|
189
|
+
EOF
|
|
190
|
+
)"
|
|
191
|
+
```
|