compound-workflow 1.4.6 → 1.5.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/plugin.json +13 -4
- package/.cursor-plugin/plugin.json +20 -1
- package/README.md +20 -14
- package/package.json +6 -3
- package/scripts/check-pack-readme.mjs +16 -1
- package/scripts/check-version-parity.mjs +30 -0
- package/scripts/generate-platform-artifacts.mjs +165 -0
- package/scripts/install-cli.mjs +200 -438
- package/scripts/postinstall.mjs +4 -1
- package/src/.agents/commands/install.md +18 -30
- package/src/AGENTS.md +1 -1
- package/src/generated/opencode.managed.json +110 -0
- package/scripts/sync-into-repo.sh +0 -103
- package/src/.agents/commands/setup.md +0 -9
- package/src/.agents/commands/sync.md +0 -9
- package/src/.agents/commands/workflow/review-v2.md +0 -148
package/scripts/postinstall.mjs
CHANGED
|
@@ -38,7 +38,10 @@ function shouldSkip(targetRoot) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function run() {
|
|
41
|
-
|
|
41
|
+
let targetRoot = process.env.INIT_CWD ? path.resolve(process.env.INIT_CWD) : process.cwd();
|
|
42
|
+
if (!process.env.INIT_CWD) {
|
|
43
|
+
console.log("[compound-workflow] INIT_CWD not set; using process.cwd() as project root.");
|
|
44
|
+
}
|
|
42
45
|
const skipReason = shouldSkip(targetRoot);
|
|
43
46
|
if (skipReason) {
|
|
44
47
|
console.log(`[compound-workflow] postinstall skipped (${skipReason})`);
|
|
@@ -1,57 +1,45 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: install
|
|
3
3
|
invocation: install
|
|
4
|
-
description: Install compound-workflow in this project (
|
|
5
|
-
argument-hint: "[
|
|
4
|
+
description: Install compound-workflow in this project (native mode): writes opencode.json, merges AGENTS.md, and creates docs/todo dirs.
|
|
5
|
+
argument-hint: "[--dry-run] [--root <path>] [--no-config]"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# /install
|
|
9
9
|
|
|
10
|
-
Install or update compound-workflow in this project with **one action**.
|
|
10
|
+
Install or update compound-workflow in this project with **one action**.
|
|
11
11
|
|
|
12
12
|
## When to use
|
|
13
13
|
|
|
14
|
-
- First
|
|
15
|
-
- After updating
|
|
14
|
+
- First-time setup in a repository.
|
|
15
|
+
- After updating `compound-workflow` to refresh generated OpenCode command/agent mappings and AGENTS template content.
|
|
16
16
|
|
|
17
17
|
## Prerequisites
|
|
18
18
|
|
|
19
|
-
- The project must have `compound-workflow` installed: `npm install compound-workflow
|
|
19
|
+
- The project must have `compound-workflow` installed: `npm install compound-workflow`.
|
|
20
20
|
|
|
21
21
|
## Instructions for the agent
|
|
22
22
|
|
|
23
|
-
Run in the
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx compound-workflow@latest install
|
|
27
|
-
npx compound-workflow@latest install all
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Or with a specific root and flags:
|
|
23
|
+
Run in the workspace root (or user-provided root):
|
|
31
24
|
|
|
32
25
|
```bash
|
|
26
|
+
npx compound-workflow install
|
|
33
27
|
npx compound-workflow install --root /path/to/project
|
|
34
28
|
npx compound-workflow install --dry-run
|
|
35
29
|
npx compound-workflow install --no-config
|
|
36
|
-
npx compound-workflow install --cursor
|
|
37
30
|
```
|
|
38
31
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- **--no-config**: Skip Repo Config Block reminder; only write opencode.json, AGENTS.md merge, and dirs.
|
|
43
|
-
- **--cursor**: Force Cursor integration (create `.cursor` if missing, then wire skills/agents/commands/references).
|
|
44
|
-
|
|
45
|
-
Do not copy files from a compound-workflow clone; the Install CLI uses the package from `node_modules/compound-workflow`.
|
|
32
|
+
- `--dry-run`: Print planned changes only; no writes.
|
|
33
|
+
- `--root <path>`: Target project directory (default: current directory).
|
|
34
|
+
- `--no-config`: Skip Repo Config Block reminder; still writes opencode.json, AGENTS.md, and dirs.
|
|
46
35
|
|
|
47
|
-
After running, suggest
|
|
36
|
+
After running, suggest `opencode debug config` in the project to verify OpenCode resolution.
|
|
48
37
|
|
|
49
|
-
## What Install does
|
|
38
|
+
## What Install does
|
|
50
39
|
|
|
51
|
-
1. Ensures `compound-workflow` is in the project
|
|
52
|
-
2. Writes/merges
|
|
53
|
-
3. Creates/merges
|
|
54
|
-
4. Creates
|
|
55
|
-
5. Reminds the user to edit AGENTS.md for the Repo Config Block (default_branch, test_command, lint_command, dev_server_url, etc.) unless `--no-config` was used.
|
|
40
|
+
1. Ensures `compound-workflow` is installed in the project.
|
|
41
|
+
2. Writes/merges `opencode.json` so OpenCode resolves commands/agents/skills directly from `node_modules/compound-workflow/src/.agents`.
|
|
42
|
+
3. Creates/merges `AGENTS.md` using the package template while preserving an existing Repo Config Block.
|
|
43
|
+
4. Creates missing directories: `docs/brainstorms`, `docs/plans`, `docs/solutions`, `docs/metrics/daily|weekly|monthly`, `todos`.
|
|
56
44
|
|
|
57
|
-
No
|
|
45
|
+
No setup/sync compatibility paths are supported in this cutover.
|
package/src/AGENTS.md
CHANGED
|
@@ -168,7 +168,7 @@ worktree_bootstrap_notes:
|
|
|
168
168
|
|
|
169
169
|
## Implemented Components (Current Scope)
|
|
170
170
|
|
|
171
|
-
- Commands: `workflow:brainstorm`, `workflow:plan`, `workflow:triage`, `workflow:work`, `workflow:review`, `workflow:compound` (under `.agents/commands/workflow/`), plus `test-browser`, `metrics`, `assess`, `
|
|
171
|
+
- Commands: `workflow:brainstorm`, `workflow:plan`, `workflow:triage`, `workflow:work`, `workflow:review`, `workflow:compound` (under `.agents/commands/workflow/`), plus `test-browser`, `metrics`, `assess`, `install` (root commands)
|
|
172
172
|
- Skills: `brainstorming`, `document-review`, `technical-review`, `compound-docs` (alias: `compound_doc`), `capture-skill`, `file-todos`, `agent-browser`, `git-worktree`, `process-metrics`, `react-ddd-mvc-frontend`, `xstate-actor-orchestration`, `standards`, `pii-protection-prisma`, `financial-workflow-integrity`, `audit-traceability`, `data-foundations`
|
|
173
173
|
- Agents:
|
|
174
174
|
- `repo-research-analyst`
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"skillsPath": "node_modules/compound-workflow/src/.agents/skills",
|
|
4
|
+
"commandRoot": "node_modules/compound-workflow/src/.agents/commands",
|
|
5
|
+
"agentRoot": "node_modules/compound-workflow/src/.agents/agents",
|
|
6
|
+
"commands": [
|
|
7
|
+
{
|
|
8
|
+
"id": "assess",
|
|
9
|
+
"description": "Review recent metrics entries to identify failures/trends and propose concrete improvements to commands/skills/agents",
|
|
10
|
+
"rel": "assess.md"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "install",
|
|
14
|
+
"description": "Install compound-workflow in this project (native mode): writes opencode.json, merges AGENTS.md, and creates docs/todo dirs.",
|
|
15
|
+
"rel": "install.md"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "metrics",
|
|
19
|
+
"description": "Log a metrics entry for the current workflow run so process performance can be reviewed daily/weekly/monthly",
|
|
20
|
+
"rel": "metrics.md"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "test-browser",
|
|
24
|
+
"description": "Run browser tests on pages affected by current PR or branch",
|
|
25
|
+
"rel": "test-browser.md"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "workflow:brainstorm",
|
|
29
|
+
"description": "Explore requirements and approaches through collaborative dialogue before planning implementation",
|
|
30
|
+
"rel": "workflow/brainstorm.md"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "workflow:compound",
|
|
34
|
+
"description": "Document a durable learning (solved problem or implementation insight) into docs/solutions/ to compound institutional knowledge",
|
|
35
|
+
"rel": "workflow/compound.md"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "workflow:plan",
|
|
39
|
+
"description": "Transform feature descriptions into well-structured project plans using an explicit fidelity and confidence model",
|
|
40
|
+
"rel": "workflow/plan.md"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "workflow:review",
|
|
44
|
+
"description": "Review a PR/branch/diff with structured findings. Does not implement fixes unless explicitly requested.",
|
|
45
|
+
"rel": "workflow/review.md"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "workflow:triage",
|
|
49
|
+
"description": "Manual triage command to prioritize todo files into an executable ready queue (priority, dependencies, recommended action)",
|
|
50
|
+
"rel": "workflow/triage.md"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "workflow:work",
|
|
54
|
+
"description": "Execute a plan file systematically (implementation + verification) without auto-shipping",
|
|
55
|
+
"rel": "workflow/work.md"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"agents": [
|
|
59
|
+
{
|
|
60
|
+
"id": "agent-native-reviewer",
|
|
61
|
+
"description": "Reviews code to ensure agent-native parity — any action a user can take, an agent can also take. Use after adding UI features, agent tools, or system prompts.",
|
|
62
|
+
"rel": "review/agent-native-reviewer.md"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "best-practices-researcher",
|
|
66
|
+
"description": "Researches and synthesizes external best practices, documentation, and examples for any technology or framework. Use when you need industry standards, community conventions, or implementation guidance.",
|
|
67
|
+
"rel": "research/best-practices-researcher.md"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "bug-reproduction-validator",
|
|
71
|
+
"description": "Systematically reproduces and validates bug reports to confirm whether reported behavior is an actual bug. Use when you receive a bug report or issue that needs verification.",
|
|
72
|
+
"rel": "workflow/bug-reproduction-validator.md"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "framework-docs-researcher",
|
|
76
|
+
"description": "Gathers authoritative documentation for frameworks, libraries, and dependencies. Use when you need official docs, version constraints, breaking changes, or implementation patterns.",
|
|
77
|
+
"rel": "research/framework-docs-researcher.md"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "git-history-analyzer",
|
|
81
|
+
"description": "Performs archaeological analysis of git history to trace code evolution, identify contributors, and understand why code patterns exist. Use when you need historical context for code changes.",
|
|
82
|
+
"rel": "research/git-history-analyzer.md"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "learnings-researcher",
|
|
86
|
+
"description": "Searches docs/solutions/ for relevant past solutions by frontmatter metadata. Use before implementing features or fixing problems to surface institutional knowledge and prevent repeated mistakes.",
|
|
87
|
+
"rel": "research/learnings-researcher.md"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "lint",
|
|
91
|
+
"description": "Run repo-configured linting and code quality checks. Use when you need to lint/format or verify code quality.",
|
|
92
|
+
"rel": "workflow/lint.md"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "planning-technical-reviewer",
|
|
96
|
+
"description": "Independent technical reviewer for brainstorm/plan outputs before execution.",
|
|
97
|
+
"rel": "review/planning-technical-reviewer.md"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"id": "repo-research-analyst",
|
|
101
|
+
"description": "Conducts thorough research on repository structure, documentation, conventions, and implementation patterns. Use when onboarding to a new codebase or understanding project conventions.",
|
|
102
|
+
"rel": "research/repo-research-analyst.md"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"id": "spec-flow-analyzer",
|
|
106
|
+
"description": "Analyzes specifications and feature descriptions for user flow completeness and gap identification. Use when a spec, plan, or feature description needs flow analysis, edge case discovery, or requirements validation.",
|
|
107
|
+
"rel": "workflow/spec-flow-analyzer.md"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# LEGACY: Prefer "npm install compound-workflow" + "npx compound-workflow install" in the project.
|
|
3
|
-
# Copy src/.agents and src/AGENTS.md from this compound-workflow repo into a host repo.
|
|
4
|
-
# Does not update opencode.json; run Install (npx compound-workflow install) in the project for that.
|
|
5
|
-
set -e
|
|
6
|
-
CLONE_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
7
|
-
DRY_RUN=0
|
|
8
|
-
FORCE=0
|
|
9
|
-
TARGET=""
|
|
10
|
-
|
|
11
|
-
usage() {
|
|
12
|
-
cat <<'EOF'
|
|
13
|
-
Usage:
|
|
14
|
-
./scripts/sync-into-repo.sh [--dry-run] [--force] [target_dir]
|
|
15
|
-
|
|
16
|
-
Copies:
|
|
17
|
-
- src/.agents -> <target_dir>/.agents
|
|
18
|
-
- src/AGENTS.md -> <target_dir>/AGENTS.md (only if missing)
|
|
19
|
-
|
|
20
|
-
Notes:
|
|
21
|
-
- Replaces <target_dir>/.agents (prevents .agents/.agents nesting)
|
|
22
|
-
- Prints absolute paths before writing
|
|
23
|
-
- Refuses non-git targets unless --force
|
|
24
|
-
EOF
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
while [[ $# -gt 0 ]]; do
|
|
28
|
-
case "$1" in
|
|
29
|
-
--dry-run)
|
|
30
|
-
DRY_RUN=1
|
|
31
|
-
shift
|
|
32
|
-
;;
|
|
33
|
-
--force)
|
|
34
|
-
FORCE=1
|
|
35
|
-
shift
|
|
36
|
-
;;
|
|
37
|
-
-h|--help)
|
|
38
|
-
usage
|
|
39
|
-
exit 0
|
|
40
|
-
;;
|
|
41
|
-
*)
|
|
42
|
-
if [[ -z "$TARGET" ]]; then
|
|
43
|
-
TARGET="$1"
|
|
44
|
-
shift
|
|
45
|
-
else
|
|
46
|
-
echo "Error: unexpected argument: $1" >&2
|
|
47
|
-
usage >&2
|
|
48
|
-
exit 1
|
|
49
|
-
fi
|
|
50
|
-
;;
|
|
51
|
-
esac
|
|
52
|
-
done
|
|
53
|
-
|
|
54
|
-
TARGET="${TARGET:-$(dirname "$CLONE_ROOT")}"
|
|
55
|
-
if [[ ! -d "$CLONE_ROOT/src/.agents" || ! -f "$CLONE_ROOT/src/AGENTS.md" ]]; then
|
|
56
|
-
echo "Error: $CLONE_ROOT is not a compound-workflow clone (missing src/.agents or src/AGENTS.md)" >&2
|
|
57
|
-
exit 1
|
|
58
|
-
fi
|
|
59
|
-
if [[ ! -d "$TARGET" ]]; then
|
|
60
|
-
echo "Error: target is not a directory: $TARGET" >&2
|
|
61
|
-
exit 1
|
|
62
|
-
fi
|
|
63
|
-
TARGET_ABS="$(cd "$TARGET" && pwd)"
|
|
64
|
-
# Host marker validation (escape hatch: --force)
|
|
65
|
-
if [[ "$FORCE" -ne 1 && ! -d "$TARGET_ABS/.git" ]]; then
|
|
66
|
-
echo "Error: target does not look like a git repo (missing .git): $TARGET_ABS" >&2
|
|
67
|
-
echo "Hint: pass --force if you really want to sync into a non-git directory." >&2
|
|
68
|
-
exit 1
|
|
69
|
-
fi
|
|
70
|
-
# Refuse obvious template targets (escape hatch: --force)
|
|
71
|
-
if [[ "$FORCE" -ne 1 && -d "$TARGET_ABS/src/.agents" && -f "$TARGET_ABS/src/AGENTS.md" ]]; then
|
|
72
|
-
echo "Error: target looks like a compound-workflow template repo (has src/.agents + src/AGENTS.md): $TARGET_ABS" >&2
|
|
73
|
-
echo "Refusing to sync into a template repo. Pass --force to override." >&2
|
|
74
|
-
exit 1
|
|
75
|
-
fi
|
|
76
|
-
# Avoid copying into our own src
|
|
77
|
-
if [[ "$TARGET_ABS" == "$(cd "$CLONE_ROOT/src" 2>/dev/null && pwd)" ]] || [[ "$TARGET_ABS" == "$CLONE_ROOT/src" ]]; then
|
|
78
|
-
echo "Error: target must not be the clone's src directory" >&2
|
|
79
|
-
exit 1
|
|
80
|
-
fi
|
|
81
|
-
echo "Resolved target: $TARGET_ABS"
|
|
82
|
-
echo "Planned writes:"
|
|
83
|
-
echo " - $TARGET_ABS/.agents (replace)"
|
|
84
|
-
if [[ ! -f "$TARGET_ABS/AGENTS.md" ]]; then
|
|
85
|
-
echo " - $TARGET_ABS/AGENTS.md (create)"
|
|
86
|
-
else
|
|
87
|
-
echo " - $TARGET_ABS/AGENTS.md (skip; already exists)"
|
|
88
|
-
fi
|
|
89
|
-
|
|
90
|
-
if [[ "$DRY_RUN" -eq 1 ]]; then
|
|
91
|
-
echo "Dry-run: no changes made."
|
|
92
|
-
exit 0
|
|
93
|
-
fi
|
|
94
|
-
|
|
95
|
-
echo "Copying into $TARGET_ABS ..."
|
|
96
|
-
rm -rf "$TARGET_ABS/.agents"
|
|
97
|
-
cp -R "$CLONE_ROOT/src/.agents" "$TARGET_ABS/.agents"
|
|
98
|
-
if [[ ! -f "$TARGET_ABS/AGENTS.md" ]]; then
|
|
99
|
-
cp "$CLONE_ROOT/src/AGENTS.md" "$TARGET_ABS/AGENTS.md"
|
|
100
|
-
else
|
|
101
|
-
echo "AGENTS.md already exists; skipped copy. Run Install (npx compound-workflow install) in the project to merge template with host AGENTS.md."
|
|
102
|
-
fi
|
|
103
|
-
echo "Done. Run Install in the project (npx compound-workflow install) to configure opencode.json and AGENTS.md, or run /install in Cursor."
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: setup
|
|
3
|
-
description: "(Deprecated) Repo Config Block is now part of /install. Use /install once; then edit AGENTS.md to set default_branch, test_command, lint_command, dev_server_url."
|
|
4
|
-
argument-hint: "Use /install instead; then edit AGENTS.md for Repo Config Block."
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# /setup (deprecated)
|
|
8
|
-
|
|
9
|
-
**Use `/install` instead.** The Install command (one action) writes opencode.json, merges AGENTS.md, creates dirs, and preserves your Repo Config Block. After running Install, edit `AGENTS.md` to set `default_branch`, `test_command`, `lint_command`, `dev_server_url`, and other repo defaults in the Repo Config Block YAML section.
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sync
|
|
3
|
-
description: "(Deprecated) Use /install instead. Install compound-workflow in the project with one action (npx compound-workflow install)."
|
|
4
|
-
argument-hint: "Use /install instead."
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# /sync (deprecated)
|
|
8
|
-
|
|
9
|
-
**Use `/install` instead.** Run `npx compound-workflow install` in the project—one action that configures opencode.json, AGENTS.md, dirs, and Repo Config Block. No copy from a clone; the package is loaded from `node_modules/compound-workflow`.
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: review-v2
|
|
3
|
-
invocation: workflow:review-v2
|
|
4
|
-
description: Experimental PR/branch review with interactive snippet walkthrough (output-only; no publishing)
|
|
5
|
-
argument-hint: "[PR number, GitHub URL, branch name, or 'current']"
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# /workflow:review-v2
|
|
9
|
-
|
|
10
|
-
Experimental code review flow focused on **interactive, snippet-by-snippet walkthrough** and **collected, consolidated comments**.
|
|
11
|
-
|
|
12
|
-
Guardrails (unless explicitly requested):
|
|
13
|
-
|
|
14
|
-
- Do not modify code or documents
|
|
15
|
-
- Do not create commits
|
|
16
|
-
- Do not push branches
|
|
17
|
-
- Do not create pull requests
|
|
18
|
-
- Do not publish GitHub PR reviews (output-only)
|
|
19
|
-
|
|
20
|
-
## Inputs
|
|
21
|
-
|
|
22
|
-
- Target: `$ARGUMENTS`
|
|
23
|
-
- PR number / GitHub URL (if `gh` is available)
|
|
24
|
-
- branch name
|
|
25
|
-
- `current` (current branch)
|
|
26
|
-
|
|
27
|
-
If empty, default to `current`.
|
|
28
|
-
|
|
29
|
-
## Execution Workflow
|
|
30
|
-
|
|
31
|
-
### Phase 0: Resolve Repo Defaults (ALWAYS FIRST)
|
|
32
|
-
|
|
33
|
-
1. Read `AGENTS.md` and locate the "Repo Config Block" YAML.
|
|
34
|
-
2. Resolve:
|
|
35
|
-
- `default_branch` (fallback: `main`, then `master`)
|
|
36
|
-
- `lint_command` (optional; only run if configured)
|
|
37
|
-
|
|
38
|
-
State what you resolved or assumed.
|
|
39
|
-
|
|
40
|
-
### Phase 1: Determine Target + Checkout Strategy
|
|
41
|
-
|
|
42
|
-
Parse `$ARGUMENTS` to resolve:
|
|
43
|
-
|
|
44
|
-
- `target_type`: `pr | branch | current`
|
|
45
|
-
- `base_branch`
|
|
46
|
-
- `head_branch`
|
|
47
|
-
- (if PR) `pr_number`, `pr_title`, `pr_url`
|
|
48
|
-
|
|
49
|
-
Resolution rules:
|
|
50
|
-
|
|
51
|
-
- If `$ARGUMENTS` contains `/pull/`: treat as PR URL.
|
|
52
|
-
- Extract the PR number and run:
|
|
53
|
-
- `gh pr view <number> --json headRefName,baseRefName,number,title,url`
|
|
54
|
-
- If `$ARGUMENTS` is only digits: treat as PR number.
|
|
55
|
-
- Run:
|
|
56
|
-
- `gh pr view <number> --json headRefName,baseRefName,number,title,url`
|
|
57
|
-
- Else if `$ARGUMENTS == "current"` (or empty): review current branch.
|
|
58
|
-
- Else: treat `$ARGUMENTS` as a branch name; `base_branch = default_branch`.
|
|
59
|
-
|
|
60
|
-
Checkout strategy:
|
|
61
|
-
|
|
62
|
-
- Prefer reviewing the **currently checked-out** branch.
|
|
63
|
-
- If the user explicitly targeted a PR/branch that differs from current checkout:
|
|
64
|
-
- Prefer an isolated worktree for review via `skill: git-worktree` (recommended).
|
|
65
|
-
- If you cannot/should not switch branches, fall back to `gh pr diff <number>` (PR only) plus local diffing where possible.
|
|
66
|
-
|
|
67
|
-
### Phase 2: Gather the Diff + Surface Area
|
|
68
|
-
|
|
69
|
-
1. Determine changed files using (in order):
|
|
70
|
-
- `@{upstream}...HEAD` when upstream exists
|
|
71
|
-
- `origin/${base_branch}...HEAD`
|
|
72
|
-
- `HEAD~1..HEAD`
|
|
73
|
-
2. Run:
|
|
74
|
-
- `git diff origin/${base_branch}...HEAD --stat`
|
|
75
|
-
- `git diff origin/${base_branch}...HEAD`
|
|
76
|
-
3. If PR and `gh` is available, also run:
|
|
77
|
-
- `gh pr diff <number>`
|
|
78
|
-
|
|
79
|
-
Summarize surface area (changed files, hot paths, risk notes).
|
|
80
|
-
|
|
81
|
-
### Phase 3: Load Local Conventions
|
|
82
|
-
|
|
83
|
-
1. Read repo root `AGENTS.md` (already done in Phase 0) for workflow defaults and constraints.
|
|
84
|
-
2. Look for `CLAUDE.md` files:
|
|
85
|
-
- at repo root
|
|
86
|
-
- in directories containing modified files
|
|
87
|
-
3. Read any found `CLAUDE.md` files and summarize the applicable conventions you will enforce in this review.
|
|
88
|
-
|
|
89
|
-
### Phase 4: Interactive Snippet-by-Snippet Walkthrough (V2 Core)
|
|
90
|
-
|
|
91
|
-
Instead of dumping the full review at once, walk the user through the diff **snippet by snippet**.
|
|
92
|
-
|
|
93
|
-
Rules:
|
|
94
|
-
|
|
95
|
-
1. Organize snippets by concern (not file order), usually:
|
|
96
|
-
- foundational types/interfaces/config
|
|
97
|
-
- shared helpers/modules
|
|
98
|
-
- core logic changes
|
|
99
|
-
- integration edges (I/O, DB, network, auth)
|
|
100
|
-
- tests + docs
|
|
101
|
-
2. Number each snippet (e.g. `Snippet 3/12`) so the user knows progress.
|
|
102
|
-
3. For each snippet, present:
|
|
103
|
-
- a minimal diff/code block (only the essential lines)
|
|
104
|
-
- plain-language explanation (what/why)
|
|
105
|
-
- what’s good
|
|
106
|
-
- what’s concerning (specific issue → consequence)
|
|
107
|
-
4. After each snippet, STOP and ask for input:
|
|
108
|
-
- user comment/note → store it as a collected review comment and confirm you noted it
|
|
109
|
-
- user question → answer, then continue
|
|
110
|
-
- user says `next` / `move on` → proceed
|
|
111
|
-
|
|
112
|
-
Collected comment format (maintain internally as you go):
|
|
113
|
-
|
|
114
|
-
- `path:line` (approx is fine until final consolidation)
|
|
115
|
-
- severity: `Critical | Important | Suggestion | Nitpick`
|
|
116
|
-
- comment: rewrite user notes into clear, actionable language
|
|
117
|
-
|
|
118
|
-
### Phase 5: Common Review Patterns to Watch For
|
|
119
|
-
|
|
120
|
-
Pay special attention to:
|
|
121
|
-
|
|
122
|
-
- Consistency (constants vs hardcodes, patterns across similar files, loose return types like `any[]`)
|
|
123
|
-
- Architecture (duplication, half-wired integrations, silently removed behavior)
|
|
124
|
-
- Naming & types (misleading names, unexplained config values)
|
|
125
|
-
- LLM/agent code (tool success vs orchestrator blocks, missing prompt updates, duplicated context, confusing injected messages)
|
|
126
|
-
- Maintenance (hardcoded registries that should be co-located)
|
|
127
|
-
|
|
128
|
-
### Phase 6: Consolidate (Output-Only)
|
|
129
|
-
|
|
130
|
-
After all snippets, present the **full collected comment list**, organized by severity:
|
|
131
|
-
|
|
132
|
-
1. Critical / Important (must address before merge)
|
|
133
|
-
2. Suggestions (non-blocking improvements)
|
|
134
|
-
3. Nitpicks (minor consistency/style)
|
|
135
|
-
|
|
136
|
-
For each comment include:
|
|
137
|
-
|
|
138
|
-
- file + line reference (best-effort)
|
|
139
|
-
- description
|
|
140
|
-
- suggested fix (when applicable)
|
|
141
|
-
|
|
142
|
-
Then output:
|
|
143
|
-
|
|
144
|
-
- Summary (1–3 sentences)
|
|
145
|
-
- Verdict: `Ship it | Needs changes | Needs discussion`
|
|
146
|
-
|
|
147
|
-
Do **not** publish to GitHub in V2. If the user wants publishing later, that is a separate command/experiment.
|
|
148
|
-
|