all-for-claudecode 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +15 -3
- package/agents/afc-impl-worker.md +2 -0
- package/agents/afc-pr-analyst.md +57 -0
- package/agents/afc-security.md +5 -0
- package/commands/auto.md +1 -1
- package/commands/doctor.md +63 -22
- package/commands/implement.md +14 -10
- package/commands/init.md +42 -21
- package/commands/pr-comment.md +181 -0
- package/commands/qa.md +191 -0
- package/commands/release-notes.md +219 -0
- package/commands/resume.md +1 -1
- package/commands/triage.md +222 -0
- package/docs/phase-gate-protocol.md +1 -1
- package/package.json +6 -4
- package/scripts/afc-bash-guard.sh +3 -3
- package/scripts/afc-blast-radius.sh +41 -119
- package/scripts/afc-config-change.sh +8 -0
- package/scripts/afc-consistency-check.sh +58 -19
- package/scripts/afc-dag-validate.sh +1 -1
- package/scripts/afc-doctor.sh +445 -0
- package/scripts/afc-failure-hint.sh +24 -2
- package/scripts/afc-qa-audit.sh +536 -0
- package/scripts/afc-state.sh +3 -3
- package/scripts/afc-subagent-context.sh +1 -1
- package/scripts/afc-sync-cache.sh +49 -0
- package/scripts/afc-triage.sh +142 -0
- package/scripts/afc-user-prompt-submit.sh +9 -4
- package/scripts/pre-compact-checkpoint.sh +2 -2
- package/scripts/session-start-context.sh +27 -1
- package/scripts/track-afc-changes.sh +3 -3
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Automated pipeline for Claude Code — spec → plan → implement → review → clean",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.6.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "afc",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Automated pipeline for Claude Code. Automates the full development cycle: spec → plan → implement → review → clean.",
|
|
16
|
-
"version": "2.
|
|
16
|
+
"version": "2.6.0",
|
|
17
17
|
"category": "automation",
|
|
18
18
|
"tags": ["pipeline", "automation", "spec", "plan", "implement", "review", "critic-loop"]
|
|
19
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "afc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Automated pipeline for Claude Code. Automates the full development cycle: spec → plan → implement → review → clean.",
|
|
5
5
|
"author": { "name": "jhlee0409", "email": "relee6203@gmail.com" },
|
|
6
6
|
"homepage": "https://github.com/jhlee0409/all-for-claudecode",
|
package/README.md
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
**Claude Code plugin that automates the full development cycle — spec → plan → implement → review → clean.**
|
|
8
8
|
|
|
9
|
+
[](https://github.com/jhlee0409/all-for-claudecode/actions/workflows/ci.yml)
|
|
9
10
|
[](https://www.npmjs.com/package/all-for-claudecode)
|
|
10
11
|
[](https://www.npmjs.com/package/all-for-claudecode)
|
|
11
12
|
[](./LICENSE)
|
|
12
|
-
[](https://github.com/jhlee0409/all-for-claudecode)
|
|
13
14
|
|
|
14
15
|
> One command (`/afc:auto`) runs the entire cycle. Zero runtime dependencies — pure markdown commands + bash hook scripts.
|
|
15
16
|
|
|
@@ -121,7 +122,11 @@ Performance: ✓ no N+1 queries
|
|
|
121
122
|
| `/afc:launch` | Generate release artifacts (changelog, tag, publish) |
|
|
122
123
|
| `/afc:validate` | Verify artifact consistency |
|
|
123
124
|
| `/afc:analyze` | General-purpose code and component analysis |
|
|
125
|
+
| `/afc:qa` | Project quality audit — test confidence, error resilience, code health |
|
|
124
126
|
| `/afc:consult` | Expert consultation (backend, infra, PM, design, marketing) |
|
|
127
|
+
| `/afc:triage` | Analyze open PRs and issues in parallel |
|
|
128
|
+
| `/afc:pr-comment` | Generate structured PR review comments |
|
|
129
|
+
| `/afc:release-notes` | Generate release notes from git history |
|
|
125
130
|
| `/afc:clarify` | Resolve spec ambiguities |
|
|
126
131
|
|
|
127
132
|
### Individual Command Examples
|
|
@@ -141,6 +146,12 @@ Performance: ✓ no N+1 queries
|
|
|
141
146
|
|
|
142
147
|
# Explore and structure a product idea
|
|
143
148
|
/afc:ideate "real-time collaboration feature"
|
|
149
|
+
|
|
150
|
+
# Triage open PRs and issues
|
|
151
|
+
/afc:triage # all open PRs + issues
|
|
152
|
+
/afc:triage --pr # PRs only
|
|
153
|
+
/afc:triage --deep # deep analysis with diff review
|
|
154
|
+
/afc:triage 42 99 # specific items by number
|
|
144
155
|
```
|
|
145
156
|
|
|
146
157
|
## Hook Events
|
|
@@ -160,7 +171,7 @@ Every hook fires automatically — no configuration needed after install.
|
|
|
160
171
|
| `Notification` | Desktop alerts (macOS/Linux) |
|
|
161
172
|
| `TaskCompleted` | CI gate (shell) + acceptance criteria verification (LLM) |
|
|
162
173
|
| `SubagentStop` | Tracks subagent completion in pipeline log |
|
|
163
|
-
| `UserPromptSubmit` | Injects Phase/Feature context
|
|
174
|
+
| `UserPromptSubmit` | Injects Phase/Feature context + drift checkpoint during active pipeline |
|
|
164
175
|
| `PermissionRequest` | Auto-allows CI commands during implement/review |
|
|
165
176
|
| `ConfigChange` | Audits/blocks settings changes during active pipeline |
|
|
166
177
|
| `TeammateIdle` | Prevents Agent Teams idle during implement/review |
|
|
@@ -175,7 +186,8 @@ Handler types: `command` (shell scripts, all events), `prompt` (LLM single-turn,
|
|
|
175
186
|
|---|---|
|
|
176
187
|
| `afc-architect` | Remembers ADR decisions and architecture patterns across sessions. Auto-invoked during Plan (ADR recording) and Review (architecture compliance). |
|
|
177
188
|
| `afc-security` | Remembers vulnerability patterns and false positives across sessions. Auto-invoked during Review (security scanning). Runs in isolated worktree. |
|
|
178
|
-
| `afc-impl-worker` | Parallel implementation worker. Receives pre-assigned tasks from orchestrator. Ephemeral (no memory). |
|
|
189
|
+
| `afc-impl-worker` | Parallel implementation worker. Receives pre-assigned tasks from orchestrator. Ephemeral (no memory). Max 50 turns, auto-approve edits. |
|
|
190
|
+
| `afc-pr-analyst` | PR deep analysis worker for triage. Runs in isolated worktree with diff access. Max 15 turns. |
|
|
179
191
|
|
|
180
192
|
## Expert Consultation
|
|
181
193
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: afc-pr-analyst
|
|
3
|
+
description: "PR deep analysis worker — performs build/test/lint verification in an isolated worktree for triage."
|
|
4
|
+
tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Bash
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
model: sonnet
|
|
10
|
+
maxTurns: 15
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
You are a PR deep-analysis worker for the all-for-claudecode triage pipeline.
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
You run inside an **isolated worktree** to perform deep analysis that requires checking out the PR branch: building, testing, linting, and architectural impact assessment.
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. **Checkout the PR branch** using `gh pr checkout {number}` (provided in your prompt)
|
|
22
|
+
2. **Detect project tooling**:
|
|
23
|
+
- Read `.claude/afc.config.md` for CI commands (if present)
|
|
24
|
+
- Read `CLAUDE.md` for build/test commands
|
|
25
|
+
- Read `package.json`, `Makefile`, `Cargo.toml`, etc. for standard commands
|
|
26
|
+
3. **Run verification** (skip steps if commands are not available):
|
|
27
|
+
a. **Build**: run the project build command
|
|
28
|
+
b. **Lint**: run the project lint command
|
|
29
|
+
c. **Test**: run the project test command
|
|
30
|
+
4. **Analyze results**:
|
|
31
|
+
- Parse build/test/lint output for errors and warnings
|
|
32
|
+
- Identify files with issues
|
|
33
|
+
- Assess architectural impact (does the PR cross layer boundaries?)
|
|
34
|
+
5. **Return structured report**
|
|
35
|
+
|
|
36
|
+
## Output Format
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
BUILD_STATUS: pass|fail|skip
|
|
40
|
+
BUILD_OUTPUT: {first 20 lines of errors if failed, otherwise "clean"}
|
|
41
|
+
TEST_STATUS: pass|fail|skip (N passed, M failed)
|
|
42
|
+
TEST_OUTPUT: {failed test names and first error lines if failed}
|
|
43
|
+
LINT_STATUS: pass|fail|skip
|
|
44
|
+
LINT_OUTPUT: {lint warnings/errors if any}
|
|
45
|
+
ARCHITECTURE_IMPACT: {assessment of cross-cutting changes}
|
|
46
|
+
DEEP_FINDINGS: {key findings from deep analysis, numbered list}
|
|
47
|
+
RECOMMENDATION: merge|request-changes|needs-discussion
|
|
48
|
+
RECOMMENDATION_REASON: {one sentence explanation}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- **Read-only intent**: you are analyzing, not fixing. Do not modify code.
|
|
54
|
+
- **Time budget**: keep total execution under 2 minutes. Skip long-running test suites (use `timeout 90s` wrapper).
|
|
55
|
+
- **Error resilience**: if a command fails to run (missing tool, permissions), report `skip` and continue.
|
|
56
|
+
- **No network calls**: do not install dependencies unless the build step explicitly requires it and it completes within the time budget.
|
|
57
|
+
- Follow the project's shell script conventions when running commands.
|
package/agents/afc-security.md
CHANGED
package/commands/auto.md
CHANGED
|
@@ -499,7 +499,7 @@ Artifact cleanup and codebase hygiene check after implementation and review:
|
|
|
499
499
|
```
|
|
500
500
|
- Create `.claude/afc/memory/quality-history/` directory if it does not exist
|
|
501
501
|
6. **Checkpoint reset**:
|
|
502
|
-
- Clear `.claude/afc/memory/checkpoint.md` **and** `~/.claude/projects/{ENCODED_PATH}/
|
|
502
|
+
- Clear `.claude/afc/memory/checkpoint.md` **and** `~/.claude/projects/{ENCODED_PATH}/memory/checkpoint.md` (pipeline complete = session goal achieved, dual-delete prevents stale checkpoint in either location; `ENCODED_PATH` = project path with `/` replaced by `-`)
|
|
503
503
|
7. **Timeline finalize**:
|
|
504
504
|
```bash
|
|
505
505
|
"${CLAUDE_PLUGIN_ROOT}/scripts/afc-pipeline-manage.sh" log pipeline-end "Pipeline complete: {feature}"
|
package/commands/doctor.md
CHANGED
|
@@ -59,7 +59,7 @@ Run ALL checks regardless of earlier failures. Do not short-circuit.
|
|
|
59
59
|
|-------|-----|------|------|
|
|
60
60
|
| Global CLAUDE.md exists | Read `~/.claude/CLAUDE.md` | File exists | ⚠ Warning: no global CLAUDE.md. all-for-claudecode skills won't auto-trigger from intent. Fix: run `/afc:init` |
|
|
61
61
|
| all-for-claudecode block present | Grep for `<!-- AFC:START -->` and `<!-- AFC:END -->` in `~/.claude/CLAUDE.md` | Both markers found | Fix: run `/afc:init` to inject all-for-claudecode block |
|
|
62
|
-
| all-for-claudecode block version | Extract version from `<!-- AFC:VERSION:X.Y.Z -->` in CLAUDE.md.
|
|
62
|
+
| all-for-claudecode block version | Extract version from `<!-- AFC:VERSION:X.Y.Z -->` in CLAUDE.md. Read `${CLAUDE_PLUGIN_ROOT}/package.json` (`.version`) to get the actual plugin version. Compare the two. | Block version = plugin version | ⚠ Warning: all-for-claudecode block is outdated (found {block_version}, current {plugin_version}). Fix: run `/afc:init` to update |
|
|
63
63
|
| No conflicting routing | Grep for conflicting agent patterns (`executor`, `deep-executor`, `debugger`, `code-reviewer`) outside all-for-claudecode block that could intercept afc intents | No conflicts or conflicts are inside other tool blocks | ⚠ Warning: found agent routing that may conflict with afc skills. Review `~/.claude/CLAUDE.md` |
|
|
64
64
|
|
|
65
65
|
### Category 4: Legacy Migration (v1.x → v2.0)
|
|
@@ -112,36 +112,56 @@ Run ALL checks regardless of earlier failures. Do not short-circuit.
|
|
|
112
112
|
|
|
113
113
|
| Check | How | Pass | Fail |
|
|
114
114
|
|-------|-----|------|------|
|
|
115
|
-
| Version triple match | Compare versions in `package.json
|
|
115
|
+
| Version triple match | Compare versions in `package.json` (`.version`), `.claude-plugin/plugin.json` (`.version`), `.claude-plugin/marketplace.json` (`.metadata.version` and `.plugins[0].version`) | All identical | ✗ Fix: update mismatched files to the same version |
|
|
116
116
|
| Cache in sync | Compare `commands/auto.md` content between source and `~/.claude/plugins/cache/all-for-claudecode/afc/{version}/commands/auto.md` | Content matches | ⚠ Warning: plugin cache is stale. Fix: copy source files to cache directory |
|
|
117
117
|
|
|
118
|
+
### Category 9: Command Definitions (development only)
|
|
119
|
+
|
|
120
|
+
> Only run if current directory is the all-for-claudecode source repo (same condition as Category 8).
|
|
121
|
+
|
|
122
|
+
| Check | How | Pass | Fail |
|
|
123
|
+
|-------|-----|------|------|
|
|
124
|
+
| Frontmatter exists | Each `commands/*.md` file has opening and closing `---` block | All files have frontmatter | ✗ Fix: add YAML frontmatter block to `commands/{file}.md` |
|
|
125
|
+
| Required fields | Each command frontmatter contains `name:` and `description:` | All files have both fields | ✗ Fix: add missing `name:` or `description:` to `commands/{file}.md` |
|
|
126
|
+
| Name-filename match | `name:` value follows `afc:{filename}` pattern (e.g. `auto.md` → `name: afc:auto`) | All names match filenames | ✗ Fix: rename `name:` field in `commands/{file}.md` to `afc:{filename}` |
|
|
127
|
+
| Fork-agent reference | Commands with `context: fork` and `agent:` field reference a file that exists in `agents/` (e.g. `agent: afc-architect` → `agents/afc-architect.md` exists) | All agent references resolve | ✗ Fix: create missing agent file `agents/{name}.md` or fix `agent:` field in `commands/{file}.md` |
|
|
128
|
+
|
|
129
|
+
### Category 10: Agent Definitions (development only)
|
|
130
|
+
|
|
131
|
+
> Only run if current directory is the all-for-claudecode source repo (same condition as Category 8).
|
|
132
|
+
|
|
133
|
+
| Check | How | Pass | Fail |
|
|
134
|
+
|-------|-----|------|------|
|
|
135
|
+
| Frontmatter exists | Each `agents/*.md` file has opening and closing `---` block | All files have frontmatter | ✗ Fix: add YAML frontmatter block to `agents/{file}.md` |
|
|
136
|
+
| Required fields | Each agent frontmatter contains `name:`, `description:`, and `model:` | All files have all 3 fields | ✗ Fix: add missing field to `agents/{file}.md` |
|
|
137
|
+
| Name-filename match | `name:` value equals the filename without extension (e.g. `afc-architect.md` → `name: afc-architect`) | All names match filenames | ✗ Fix: rename `name:` field in `agents/{file}.md` to match filename |
|
|
138
|
+
| Expert memory | All 8 expert consultation agents (`afc-backend-expert`, `afc-infra-expert`, `afc-pm-expert`, `afc-design-expert`, `afc-marketing-expert`, `afc-legal-expert`, `afc-appsec-expert`, `afc-tech-advisor`) have `memory: project` | All experts have memory field | ✗ Fix: add `memory: project` to `agents/{name}.md` frontmatter |
|
|
139
|
+
| Worker maxTurns | `afc-impl-worker` and `afc-pr-analyst` have `maxTurns:` field | Both workers have maxTurns | ✗ Fix: add `maxTurns:` to `agents/{name}.md` frontmatter |
|
|
140
|
+
|
|
141
|
+
### Category 11: Doc References (development only)
|
|
142
|
+
|
|
143
|
+
> Only run if current directory is the all-for-claudecode source repo (same condition as Category 8).
|
|
144
|
+
|
|
145
|
+
| Check | How | Pass | Fail |
|
|
146
|
+
|-------|-----|------|------|
|
|
147
|
+
| Referenced docs exist | Scan commands and agents for file references to `docs/` (e.g. `docs/critic-loop-rules.md`, `docs/phase-gate-protocol.md`). Each referenced file must exist. | All referenced docs found | ✗ Fix: create missing `docs/{file}.md` or fix the reference |
|
|
148
|
+
| Domain adapters exist | `docs/domain-adapters/` directory contains at least one `.md` file | ≥ 1 adapter file found | ✗ Fix: add domain adapter files to `docs/domain-adapters/` |
|
|
149
|
+
|
|
118
150
|
---
|
|
119
151
|
|
|
120
152
|
## Execution
|
|
121
153
|
|
|
122
|
-
1.
|
|
154
|
+
1. Run the automated health check script:
|
|
123
155
|
```
|
|
124
|
-
|
|
125
|
-
=======================
|
|
156
|
+
"${CLAUDE_PLUGIN_ROOT}/scripts/afc-doctor.sh" $ARGUMENTS
|
|
126
157
|
```
|
|
158
|
+
This covers Categories 1-8 automatically.
|
|
127
159
|
|
|
128
|
-
2.
|
|
129
|
-
- Print ` ✓ {check name}` on pass
|
|
130
|
-
- Print ` ⚠ {check name}: {brief reason}` on warning
|
|
131
|
-
- Print ` ✗ {check name}: {brief reason}` on fail
|
|
132
|
-
- On fail/warning, print ` Fix: {command}` indented below
|
|
160
|
+
2. Print the script's stdout output as-is (already formatted with pass/warn/fail markers).
|
|
133
161
|
|
|
134
|
-
3. If
|
|
135
|
-
- Print additional details for each check (command output, file paths, versions found)
|
|
162
|
+
3. If in the source repo (package.json `name` = `"all-for-claudecode"`), continue with Categories 9-11 manually using the check tables above.
|
|
136
163
|
|
|
137
|
-
4. Print summary
|
|
138
|
-
```
|
|
139
|
-
─────────────────────────
|
|
140
|
-
Results: {pass} passed, {warn} warnings, {fail} failures
|
|
141
|
-
```
|
|
142
|
-
- If all pass: `No issues found!`
|
|
143
|
-
- If warnings only: `{N} warnings found. Non-blocking but review recommended.`
|
|
144
|
-
- If any failures: `{N} issues need attention. Run the Fix commands above.`
|
|
164
|
+
4. Print combined summary (script summary + any additional findings from Categories 9-11).
|
|
145
165
|
|
|
146
166
|
## Example Output
|
|
147
167
|
|
|
@@ -178,8 +198,29 @@ Hook Health
|
|
|
178
198
|
✓ All scripts exist
|
|
179
199
|
✓ All scripts executable
|
|
180
200
|
|
|
201
|
+
Version Sync (dev)
|
|
202
|
+
✓ Version triple match
|
|
203
|
+
✓ Cache in sync
|
|
204
|
+
|
|
205
|
+
Command Definitions (dev)
|
|
206
|
+
✓ Frontmatter exists (25 files)
|
|
207
|
+
✓ Required fields present
|
|
208
|
+
✓ Name-filename match
|
|
209
|
+
✓ Fork-agent references valid
|
|
210
|
+
|
|
211
|
+
Agent Definitions (dev)
|
|
212
|
+
✓ Frontmatter exists (12 files)
|
|
213
|
+
✓ Required fields present
|
|
214
|
+
✓ Name-filename match
|
|
215
|
+
✓ Expert memory configured (8/8)
|
|
216
|
+
✓ Worker maxTurns configured (2/2)
|
|
217
|
+
|
|
218
|
+
Doc References (dev)
|
|
219
|
+
✓ Referenced docs exist
|
|
220
|
+
✓ Domain adapters exist (3 files)
|
|
221
|
+
|
|
181
222
|
─────────────────────────
|
|
182
|
-
Results:
|
|
223
|
+
Results: 28 passed, 2 warnings, 0 failures
|
|
183
224
|
2 warnings found. Non-blocking but review recommended.
|
|
184
225
|
```
|
|
185
226
|
|
|
@@ -189,4 +230,4 @@ Results: 14 passed, 2 warnings, 0 failures
|
|
|
189
230
|
- **Always run all checks**: do not stop on first failure. The full picture is the value.
|
|
190
231
|
- **Actionable fixes**: every non-pass result must include a Fix line. Never report a problem without a solution.
|
|
191
232
|
- **Fast execution**: skip CI/gate command checks if `--fast` is in arguments (these are the slowest checks).
|
|
192
|
-
- **Development checks**:
|
|
233
|
+
- **Development checks**: Categories 8–11 (Version Sync, Command Definitions, Agent Definitions, Doc References) only run when inside the all-for-claudecode source repo.
|
package/commands/implement.md
CHANGED
|
@@ -180,11 +180,13 @@ Task("T004: Create AuthService", subagent_type: "afc:afc-impl-worker", isolation
|
|
|
180
180
|
|
|
181
181
|
**Failure Recovery** (per-task, not per-batch):
|
|
182
182
|
1. Identify the failed task from the agent's error return
|
|
183
|
-
2.
|
|
184
|
-
3.
|
|
185
|
-
4.
|
|
186
|
-
5. If retryCount
|
|
187
|
-
|
|
183
|
+
2. Capture the `agentId` from the failed agent's result (returned in Task tool output)
|
|
184
|
+
3. Reset: `TaskUpdate(taskId, status: "pending")`
|
|
185
|
+
4. Track: `TaskUpdate(taskId, metadata: { retryCount: N, lastAgentId: agentId })`
|
|
186
|
+
5. If retryCount < 3 → re-launch with `resume: lastAgentId` in the next batch round. The resumed agent retains full context from the previous attempt (what it tried, what failed, partial progress), enabling more targeted retry instead of starting from scratch.
|
|
187
|
+
- **Worktree caveat**: if the failed worker made no file changes, its worktree is auto-cleaned and `resume` will fail. In this case, fall back to a fresh launch (omit `resume`) for the retry.
|
|
188
|
+
6. If retryCount >= 3 → mark as failed, report: `"T{ID} failed after 3 attempts: {last error}"`
|
|
189
|
+
7. Continue with remaining tasks — a single failure does not block the entire phase
|
|
188
190
|
|
|
189
191
|
#### Swarm Mode (6+ [P] tasks)
|
|
190
192
|
|
|
@@ -247,11 +249,13 @@ Task("Worker 2: T008, T010, T012", subagent_type: "afc:afc-impl-worker", isolati
|
|
|
247
249
|
When a worker agent returns an error:
|
|
248
250
|
1. Identify which tasks the worker was assigned (from the pre-assigned list)
|
|
249
251
|
2. Check which tasks the worker actually completed (from its result summary)
|
|
250
|
-
3.
|
|
251
|
-
4.
|
|
252
|
-
5.
|
|
253
|
-
6. If retryCount
|
|
254
|
-
|
|
252
|
+
3. Capture the `agentId` from the failed worker's result
|
|
253
|
+
4. Reset uncompleted tasks: `TaskUpdate(taskId, status: "pending")`
|
|
254
|
+
5. Track retry count: `TaskUpdate(taskId, metadata: { retryCount: N, lastAgentId: agentId })`
|
|
255
|
+
6. If retryCount < 3 → re-launch with `resume: lastAgentId` to preserve context from the previous attempt. The resumed agent retains its full conversation history (files read, changes attempted, errors encountered), enabling targeted retry.
|
|
256
|
+
- **Worktree caveat**: if the failed worker made no file changes, its worktree is auto-cleaned and `resume` will fail. In this case, fall back to a fresh launch (omit `resume`) for the retry.
|
|
257
|
+
7. If retryCount >= 3 → mark as failed, report: `"T{ID} failed after 3 attempts: {last error}"`
|
|
258
|
+
8. Continue with remaining tasks
|
|
255
259
|
|
|
256
260
|
> Single task failure does not block the phase. The orchestrator reassigns failed tasks to subsequent batches.
|
|
257
261
|
|
package/commands/init.md
CHANGED
|
@@ -41,10 +41,12 @@ Before anything else, detect and migrate v1.x (selfish-pipeline) artifacts:
|
|
|
41
41
|
- Rename: `mv .claude/selfish .claude/afc`
|
|
42
42
|
- Print: `Migrated: .claude/selfish/ → .claude/afc/`
|
|
43
43
|
|
|
44
|
-
**D. Git tag
|
|
45
|
-
- Check `git tag -l 'selfish
|
|
46
|
-
- If any found:
|
|
47
|
-
-
|
|
44
|
+
**D. Git tag cleanup**
|
|
45
|
+
- Check `git tag -l 'selfish/*'`
|
|
46
|
+
- If any found:
|
|
47
|
+
- Known patterns (`selfish/pre-*`, `selfish/phase-*`): rename to `afc/` equivalent (`git tag afc/... selfish/... && git tag -d selfish/...`)
|
|
48
|
+
- All remaining `selfish/*`: delete (`git tag -d`)
|
|
49
|
+
- Print: `Migrated: {renamed} renamed, {deleted} deleted`
|
|
48
50
|
|
|
49
51
|
### 2. Check for Existing Config
|
|
50
52
|
|
|
@@ -224,31 +226,43 @@ IMPORTANT: For requests matching the afc skill routing table below, always invok
|
|
|
224
226
|
|
|
225
227
|
## Skill Routing
|
|
226
228
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
|
230
|
-
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
| Design | `afc:plan` |
|
|
234
|
-
|
|
|
235
|
-
|
|
|
236
|
-
|
|
|
237
|
-
|
|
|
238
|
-
|
|
|
239
|
-
|
|
|
240
|
-
|
|
|
241
|
-
|
|
|
242
|
-
|
|
|
229
|
+
Classify the user's intent and route to the matching skill. Use semantic understanding — not keyword matching.
|
|
230
|
+
|
|
231
|
+
| User Intent | Skill | Route When |
|
|
232
|
+
|-------------|-------|------------|
|
|
233
|
+
| Full lifecycle | `afc:auto` | User wants end-to-end feature development, or the request is a non-trivial new feature without an existing plan |
|
|
234
|
+
| Specification | `afc:spec` | User wants to define or write requirements, acceptance criteria, or success conditions |
|
|
235
|
+
| Design/Plan | `afc:plan` | User wants to plan HOW to implement before coding — approach, architecture decisions, design |
|
|
236
|
+
| Implement | `afc:implement` | User wants specific code changes with a clear scope: add feature, refactor, modify. Requires existing plan or precise instructions |
|
|
237
|
+
| Review | `afc:review` | User wants code review, PR review, or quality check on existing/changed code |
|
|
238
|
+
| Debug/Fix | `afc:debug` | User reports a bug, error, or broken behavior and wants diagnosis and fix |
|
|
239
|
+
| Test | `afc:test` | User wants to write tests, improve coverage, or verify behavior |
|
|
240
|
+
| Validate | `afc:validate` | User wants to check consistency or validate existing pipeline artifacts |
|
|
241
|
+
| Analyze | `afc:analyze` | User wants to understand, explore, or audit existing code without modifying it |
|
|
242
|
+
| QA Audit | `afc:qa` | User wants project quality audit, test confidence check, or runtime quality gaps |
|
|
243
|
+
| Research | `afc:research` | User wants deep investigation of external tools, libraries, APIs, or technical concepts |
|
|
244
|
+
| Ideate | `afc:ideate` | User wants to brainstorm ideas, explore possibilities, or draft a product brief |
|
|
245
|
+
| Consult | `afc:consult` | User wants expert advice on a decision: library choice, architecture direction, legal/security/infra guidance |
|
|
246
|
+
| Launch | `afc:launch` | User wants to prepare a release — generate changelog, release notes, version bump, or tag |
|
|
247
|
+
| Tasks | `afc:tasks` | User explicitly wants to decompose work into a task breakdown |
|
|
248
|
+
| Ambiguous | `afc:clarify` | User's request is too vague or underspecified to route confidently |
|
|
249
|
+
|
|
250
|
+
### Routing Rules
|
|
251
|
+
|
|
252
|
+
1. **Auto vs Implement**: A new feature request without an existing plan routes to `afc:auto`. Only use `afc:implement` when the user has a clear, scoped task or an existing plan/spec.
|
|
253
|
+
2. **Compound intents**: Route to the primary intent. The pipeline handles sequencing internally.
|
|
254
|
+
3. **Design-first**: When scope is non-trivial (multiple files, architectural decisions needed), prefer `afc:auto` or `afc:plan` over direct `afc:implement`.
|
|
243
255
|
|
|
244
256
|
User-only (not auto-triggered — inform user on request):
|
|
245
|
-
- `afc:launch` — inform user when release artifact generation is requested
|
|
246
257
|
- `afc:doctor` — inform user when health check is requested
|
|
247
258
|
- `afc:architect` — inform user when architecture review is requested
|
|
248
259
|
- `afc:security` — inform user when security scan is requested
|
|
249
260
|
- `afc:checkpoint` — inform user when session save is requested
|
|
250
261
|
- `afc:resume` — inform user when session restore is requested
|
|
251
262
|
- `afc:principles` — inform user when project principles management is requested
|
|
263
|
+
- `afc:triage` — inform user when parallel PR/issue triage is requested
|
|
264
|
+
- `afc:pr-comment` — inform user when posting PR review comments to GitHub is requested
|
|
265
|
+
- `afc:release-notes` — inform user when generating release notes from git history is requested
|
|
252
266
|
|
|
253
267
|
## Pipeline
|
|
254
268
|
|
|
@@ -257,6 +271,13 @@ spec → plan → implement → review → clean
|
|
|
257
271
|
## Override Rules
|
|
258
272
|
|
|
259
273
|
NEVER use executor, deep-executor, debugger, planner, analyst, verifier, test-engineer, code-reviewer, quality-reviewer, style-reviewer, api-reviewer, security-reviewer, performance-reviewer for tasks that an afc skill covers above. ALWAYS invoke the afc skill instead.
|
|
274
|
+
|
|
275
|
+
## Source Verification
|
|
276
|
+
|
|
277
|
+
When analyzing or making claims about external systems, APIs, SDKs, or third-party tools:
|
|
278
|
+
- Verify against official documentation, NOT project-internal docs
|
|
279
|
+
- Do not hardcode reference data when delegating to sub-agents — instruct them to look up primary sources
|
|
280
|
+
- Cross-verify high-severity findings before reporting
|
|
260
281
|
</afc-pipeline>
|
|
261
282
|
<!-- AFC:END -->
|
|
262
283
|
```
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: afc:pr-comment
|
|
3
|
+
description: "Post PR review comments to GitHub"
|
|
4
|
+
argument-hint: "<PR number> [--severity critical,warning,info]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Glob
|
|
9
|
+
- Grep
|
|
10
|
+
- Task
|
|
11
|
+
model: sonnet
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# /afc:pr-comment — Post PR Review to GitHub
|
|
15
|
+
|
|
16
|
+
> Analyzes a PR and posts a structured review comment to GitHub.
|
|
17
|
+
> Reuses existing triage reports when available. Asks for user confirmation before posting.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
- `$ARGUMENTS` — PR number (required), with optional severity filter
|
|
22
|
+
- `42` — Analyze and post review for PR #42
|
|
23
|
+
- `42 --severity critical,warning` — Only include Critical and Warning findings
|
|
24
|
+
- `42 --severity critical` — Only include Critical findings
|
|
25
|
+
|
|
26
|
+
Parse the arguments:
|
|
27
|
+
1. Extract the PR number (first numeric argument)
|
|
28
|
+
2. Extract `--severity` filter if present (comma-separated list of: `critical`, `warning`, `info`)
|
|
29
|
+
3. If no PR number is found, ask the user: "Which PR number should I review?"
|
|
30
|
+
|
|
31
|
+
## Execution Steps
|
|
32
|
+
|
|
33
|
+
### 1. Collect PR Information
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
gh pr view {number} --json number,title,headRefName,author,body,additions,deletions,changedFiles,labels,reviewDecision,state
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
gh pr diff {number}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Verify the PR exists and is open. If closed/merged, inform the user and ask whether to proceed anyway.
|
|
44
|
+
|
|
45
|
+
### 2. Check for Existing Triage Report
|
|
46
|
+
|
|
47
|
+
Look for a recent triage report that covers this PR:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ls -t .claude/afc/memory/triage/*.md 2>/dev/null | head -5
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If a report exists from today, search it for `PR #{number}` analysis. If found, reuse that analysis as the basis for the review instead of re-analyzing from scratch.
|
|
54
|
+
|
|
55
|
+
### 3. Analyze PR (if no triage data available)
|
|
56
|
+
|
|
57
|
+
If no existing triage report covers this PR, perform a focused review of the diff.
|
|
58
|
+
|
|
59
|
+
Examine the diff from the following perspectives (abbreviated from review.md):
|
|
60
|
+
|
|
61
|
+
#### A. Code Quality
|
|
62
|
+
- Style compliance, naming conventions, unnecessary complexity
|
|
63
|
+
|
|
64
|
+
#### B. Architecture
|
|
65
|
+
- Layer violations, boundary crossings, structural concerns
|
|
66
|
+
|
|
67
|
+
#### C. Security
|
|
68
|
+
- XSS, injection, sensitive data exposure, auth issues
|
|
69
|
+
|
|
70
|
+
#### D. Performance
|
|
71
|
+
- Latency concerns, unnecessary computation, resource leaks
|
|
72
|
+
|
|
73
|
+
#### E. Maintainability
|
|
74
|
+
- Function/file size, naming clarity, readability
|
|
75
|
+
|
|
76
|
+
Classify each finding with a severity:
|
|
77
|
+
- **Critical (C)** — Must fix before merge. Bugs, security vulnerabilities, data loss risks.
|
|
78
|
+
- **Warning (W)** — Should fix. Code quality issues, potential problems, maintainability concerns.
|
|
79
|
+
- **Info (I)** — Nice to have. Suggestions, minor improvements, style preferences.
|
|
80
|
+
|
|
81
|
+
### 4. Apply Severity Filter
|
|
82
|
+
|
|
83
|
+
If `--severity` was specified, filter findings to only include the specified severity levels.
|
|
84
|
+
|
|
85
|
+
Default (no filter): include all severity levels.
|
|
86
|
+
|
|
87
|
+
### 5. Generate Review Comment
|
|
88
|
+
|
|
89
|
+
Compose the review comment in this format:
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
## AFC Code Review — PR #{number}
|
|
93
|
+
|
|
94
|
+
### Summary
|
|
95
|
+
|
|
96
|
+
| Severity | Count |
|
|
97
|
+
|----------|-------|
|
|
98
|
+
| Critical | {N} |
|
|
99
|
+
| Warning | {N} |
|
|
100
|
+
| Info | {N} |
|
|
101
|
+
|
|
102
|
+
### Findings
|
|
103
|
+
|
|
104
|
+
#### C-{N}: {title}
|
|
105
|
+
- **File**: `{path}:{line}`
|
|
106
|
+
- **Issue**: {description}
|
|
107
|
+
- **Suggested fix**: {suggestion}
|
|
108
|
+
|
|
109
|
+
#### W-{N}: {title}
|
|
110
|
+
{same format}
|
|
111
|
+
|
|
112
|
+
#### I-{N}: {title}
|
|
113
|
+
{same format}
|
|
114
|
+
|
|
115
|
+
### Positives
|
|
116
|
+
- {1-2 things done well}
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
*Reviewed by [all-for-claudecode](https://github.com/anthropics/claude-code)*
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
If there are zero findings after filtering, the comment should be:
|
|
123
|
+
|
|
124
|
+
```markdown
|
|
125
|
+
## AFC Code Review — PR #{number}
|
|
126
|
+
|
|
127
|
+
No issues found. Code looks good!
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
*Reviewed by [all-for-claudecode](https://github.com/anthropics/claude-code)*
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 6. Preview and Confirm
|
|
134
|
+
|
|
135
|
+
Display the full review comment to the user in the console.
|
|
136
|
+
|
|
137
|
+
Then determine the review event type:
|
|
138
|
+
- **Critical findings exist** → `REQUEST_CHANGES`
|
|
139
|
+
- **Only Warning/Info findings** → `COMMENT`
|
|
140
|
+
- **No findings** → `APPROVE`
|
|
141
|
+
|
|
142
|
+
Tell the user:
|
|
143
|
+
```
|
|
144
|
+
Review event: {APPROVE|COMMENT|REQUEST_CHANGES}
|
|
145
|
+
Findings: Critical {N} / Warning {N} / Info {N}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Ask the user to confirm using AskUserQuestion with these options:
|
|
149
|
+
1. **Post as-is** — Post the review comment to GitHub
|
|
150
|
+
2. **Edit first** — Let me modify the comment before posting (user provides edits, then re-confirm)
|
|
151
|
+
3. **Cancel** — Do not post anything
|
|
152
|
+
|
|
153
|
+
### 7. Post to GitHub
|
|
154
|
+
|
|
155
|
+
On approval, write the review comment to a temp file and post via `--body-file` (avoids shell escaping issues with markdown):
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
tmp_file=$(mktemp)
|
|
159
|
+
cat > "$tmp_file" << 'REVIEW_EOF'
|
|
160
|
+
{review comment content}
|
|
161
|
+
REVIEW_EOF
|
|
162
|
+
gh pr review {number} --body-file "$tmp_file" --event {COMMENT|REQUEST_CHANGES|APPROVE}
|
|
163
|
+
rm -f "$tmp_file"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 8. Final Output
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
PR review posted
|
|
170
|
+
├─ PR: #{number} ({title})
|
|
171
|
+
├─ Event: {APPROVE|COMMENT|REQUEST_CHANGES}
|
|
172
|
+
├─ Findings: Critical {N} / Warning {N} / Info {N}
|
|
173
|
+
└─ URL: {PR URL from gh pr view}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Notes
|
|
177
|
+
|
|
178
|
+
- **User confirmation required**: Never post to GitHub without explicit user approval.
|
|
179
|
+
- **Idempotent**: Running multiple times on the same PR creates additional review comments (GitHub does not deduplicate).
|
|
180
|
+
- **Respects existing reviews**: This command does not dismiss or override other reviewers' reviews.
|
|
181
|
+
- **Rate limits**: Uses a single `gh pr review` call. No rate limit concerns for normal usage.
|