antigravity-ai-kit 3.7.0 → 3.9.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/.agent/CheatSheet.md +51 -16
- package/.agent/README.md +4 -4
- package/.agent/agents/README.md +8 -1
- package/.agent/agents/pr-reviewer.md +259 -0
- package/.agent/checklists/README.md +2 -1
- package/.agent/checklists/pre-commit.md +1 -1
- package/.agent/checklists/session-end.md +1 -1
- package/.agent/checklists/session-start.md +1 -1
- package/.agent/checklists/task-complete.md +1 -1
- package/.agent/commands/README.md +130 -119
- package/.agent/commands/help.md +36 -19
- package/.agent/commands/pr-describe.md +65 -0
- package/.agent/commands/pr-fix.md +45 -0
- package/.agent/commands/pr-merge.md +45 -0
- package/.agent/commands/pr-review.md +50 -0
- package/.agent/commands/pr-split.md +54 -0
- package/.agent/commands/pr-status.md +56 -0
- package/.agent/commands/pr.md +58 -30
- package/.agent/engine/loading-rules.json +5 -0
- package/.agent/hooks/README.md +9 -5
- package/.agent/manifest.json +39 -6
- package/.agent/rules/agent-upgrade-policy.md +56 -0
- package/.agent/session-context.md +1 -1
- package/.agent/skills/README.md +4 -2
- package/.agent/skills/pr-toolkit/SKILL.md +467 -0
- package/.agent/skills/production-readiness/SKILL.md +3 -3
- package/.agent/workflows/README.md +13 -6
- package/.agent/workflows/deploy.md +2 -1
- package/.agent/workflows/pr-fix.md +305 -0
- package/.agent/workflows/pr-merge.md +242 -0
- package/.agent/workflows/pr-review.md +312 -0
- package/.agent/workflows/pr-split.md +263 -0
- package/.agent/workflows/pr.md +116 -26
- package/.agent/workflows/preflight.md +2 -2
- package/.agent/workflows/upgrade.md +196 -0
- package/README.md +48 -35
- package/package.json +2 -2
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Review pull requests with Senior Staff Engineer expertise. Multi-perspective analysis covering PR hygiene, branch strategy, code quality, security, testing, and architecture.
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
sdlc-phase: verify
|
|
5
|
+
skills: [pr-toolkit, verification-loop]
|
|
6
|
+
commit-types: []
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /pr-review — Pull Request Review Workflow
|
|
10
|
+
|
|
11
|
+
> **Trigger**: `/pr-review <url>` · `/pr-review <owner/repo>#<number>` · `/pr-review #<number>`
|
|
12
|
+
> **Lifecycle**: Verify — peer review before merge, independent of local development
|
|
13
|
+
|
|
14
|
+
> [!CAUTION]
|
|
15
|
+
> This workflow posts reviews to GitHub that are visible to the entire team. Ensure findings are accurate, constructive, and properly prioritized before submitting. Every review reflects engineering standards.
|
|
16
|
+
|
|
17
|
+
> [!TIP]
|
|
18
|
+
> This workflow leverages the **pr-toolkit** skill for review patterns and the **pr-reviewer** agent for multi-perspective analysis. Read `.agent/skills/pr-toolkit/SKILL.md` for review framework details.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Critical Rules
|
|
23
|
+
|
|
24
|
+
1. **ALWAYS** fetch the full PR diff before reviewing — never review from title/description alone
|
|
25
|
+
2. **ALWAYS** detect the project's branch strategy before assessing target branch compliance
|
|
26
|
+
3. **ALWAYS** include a concrete fix suggestion for every finding — no criticism without remedy
|
|
27
|
+
4. **NEVER** post a review with only NITs — if everything is clean, APPROVE explicitly
|
|
28
|
+
5. **NEVER** approve a PR with known CRITICAL findings — no social-pressure approvals
|
|
29
|
+
6. **EVIDENCE-BASED** — cite file:line references, project conventions, or industry standards for every finding
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Argument Parsing
|
|
34
|
+
|
|
35
|
+
| Command | Action |
|
|
36
|
+
| :--- | :--- |
|
|
37
|
+
| `/pr-review <url>` | Review PR at the given GitHub URL |
|
|
38
|
+
| `/pr-review <owner/repo>#<number>` | Review PR by owner/repo and number |
|
|
39
|
+
| `/pr-review #<number>` | Review PR in current repo by number |
|
|
40
|
+
| `/pr-review #<number> --post` | Review and post to GitHub (default) |
|
|
41
|
+
| `/pr-review #<number> --local` | Review locally only — do not post to GitHub |
|
|
42
|
+
| `/pr-review #<number> --focus security` | Focus review on security perspective only |
|
|
43
|
+
| `/pr-review #<number> --focus quality` | Focus review on code quality perspective only |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Steps
|
|
48
|
+
|
|
49
|
+
Execute IN ORDER. Stop at first failure.
|
|
50
|
+
|
|
51
|
+
### Step 1: Parse PR Reference
|
|
52
|
+
|
|
53
|
+
// turbo
|
|
54
|
+
|
|
55
|
+
Parse the user-provided PR reference to extract:
|
|
56
|
+
|
|
57
|
+
- **Repository**: `owner/repo` (from URL or current repo via `gh repo view --json nameWithOwner`)
|
|
58
|
+
- **PR Number**: extracted from URL path or `#N` argument
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# If URL provided, extract owner/repo and number from URL path
|
|
62
|
+
# If #N provided, get current repo
|
|
63
|
+
gh repo view --json nameWithOwner --jq .nameWithOwner
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Validate the PR exists and is open:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
gh pr view <number> --repo <owner/repo> --json state,title --jq '.state'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- If PR not found → **STOP** with error: "PR not found"
|
|
73
|
+
- If PR is closed/merged → **WARN**: "PR is already {state} — review will be informational only"
|
|
74
|
+
|
|
75
|
+
### Step 2: Fetch PR Data
|
|
76
|
+
|
|
77
|
+
// turbo
|
|
78
|
+
|
|
79
|
+
Retrieve comprehensive PR metadata:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# PR metadata
|
|
83
|
+
gh pr view <number> --repo <owner/repo> \
|
|
84
|
+
--json title,body,state,baseRefName,headRefName,author,files,additions,deletions,changedFiles,commits,labels,url,reviews,reviewRequests
|
|
85
|
+
|
|
86
|
+
# PR diff
|
|
87
|
+
gh pr diff <number> --repo <owner/repo>
|
|
88
|
+
|
|
89
|
+
# Existing reviews (to avoid duplicating findings)
|
|
90
|
+
gh api repos/<owner>/<repo>/pulls/<number>/reviews
|
|
91
|
+
|
|
92
|
+
# CI status
|
|
93
|
+
gh pr checks <number> --repo <owner/repo>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Extract and document:
|
|
97
|
+
|
|
98
|
+
- Title, author, branch direction (head → base)
|
|
99
|
+
- File count, additions, deletions
|
|
100
|
+
- Existing reviews and their verdicts
|
|
101
|
+
- CI check results
|
|
102
|
+
|
|
103
|
+
### Step 3: Analyze PR Hygiene
|
|
104
|
+
|
|
105
|
+
// turbo
|
|
106
|
+
|
|
107
|
+
Apply PR Hygiene perspective from pr-toolkit:
|
|
108
|
+
|
|
109
|
+
**3a. Title Format Validation**
|
|
110
|
+
- Check conventional commits format: `type(scope): description`
|
|
111
|
+
- Verify type is valid: feat, fix, docs, style, refactor, test, chore, perf, ci
|
|
112
|
+
- Verify description is imperative mood, under 72 characters
|
|
113
|
+
|
|
114
|
+
**3b. Body Completeness**
|
|
115
|
+
- Check for required sections: Summary, Changes, Test Plan
|
|
116
|
+
- Check for Breaking Changes section (if applicable)
|
|
117
|
+
- Check for Related Issues references
|
|
118
|
+
|
|
119
|
+
**3c. PR Size Classification**
|
|
120
|
+
- Classify as XS/S/M/L/XL per pr-toolkit size matrix
|
|
121
|
+
- If XL (50+ files or 1500+ LOC) → finding: CRITICAL — recommend splitting
|
|
122
|
+
|
|
123
|
+
**3d. Scope Coherence**
|
|
124
|
+
- Analyze changed file paths for unrelated concerns
|
|
125
|
+
- Detect mixed feature + tooling, mixed feature + dependency upgrades
|
|
126
|
+
- If scope violation detected → finding: HIGH — recommend focused PRs
|
|
127
|
+
|
|
128
|
+
### Step 4: Analyze Branch Strategy
|
|
129
|
+
|
|
130
|
+
// turbo
|
|
131
|
+
|
|
132
|
+
**4a. Detect Branch Strategy**
|
|
133
|
+
- Check for `dev`/`develop` remote branch existence
|
|
134
|
+
- Classify as GitFlow or Trunk-Based
|
|
135
|
+
|
|
136
|
+
**4b. Validate Target Branch**
|
|
137
|
+
- Apply target validation rules from pr-toolkit
|
|
138
|
+
- GitFlow: `feature/*` → `dev` (not `main`)
|
|
139
|
+
- Trunk-Based: any → `main`
|
|
140
|
+
- If invalid target → finding: CRITICAL — wrong base branch
|
|
141
|
+
|
|
142
|
+
**4c. Branch Naming**
|
|
143
|
+
- Verify branch follows naming convention: `type/[ticket-]description`
|
|
144
|
+
- If non-standard naming → finding: LOW
|
|
145
|
+
|
|
146
|
+
### Step 5: Multi-Perspective Code Review
|
|
147
|
+
|
|
148
|
+
Read each changed file and apply perspectives 3-6 from the pr-toolkit review framework.
|
|
149
|
+
|
|
150
|
+
**5a. Code Quality Review**
|
|
151
|
+
|
|
152
|
+
For each changed file, check:
|
|
153
|
+
- Function size (> 50 lines → HIGH)
|
|
154
|
+
- File size (> 800 lines → HIGH)
|
|
155
|
+
- Nesting depth (> 4 levels → HIGH)
|
|
156
|
+
- Error handling (missing try/catch → MEDIUM)
|
|
157
|
+
- Debug artifacts (console.log, debugger → MEDIUM)
|
|
158
|
+
- Naming quality (single-letter vars, generic names → LOW)
|
|
159
|
+
- Immutability patterns (mutation → MEDIUM)
|
|
160
|
+
|
|
161
|
+
**5b. Security Review**
|
|
162
|
+
|
|
163
|
+
For each changed file, check:
|
|
164
|
+
- Hardcoded secrets (API keys, passwords, tokens → CRITICAL)
|
|
165
|
+
- Input validation (missing validation on user input → HIGH)
|
|
166
|
+
- Injection risks (string concatenation in queries → CRITICAL)
|
|
167
|
+
- XSS vectors (unescaped user content in HTML → CRITICAL)
|
|
168
|
+
- Auth/authz (missing guards on protected resources → HIGH)
|
|
169
|
+
- Sensitive data exposure (PII in logs → HIGH)
|
|
170
|
+
|
|
171
|
+
**5c. Testing Review**
|
|
172
|
+
|
|
173
|
+
Check the PR diff for:
|
|
174
|
+
- New functions/components without corresponding tests → HIGH
|
|
175
|
+
- Test file changes that reduce coverage → MEDIUM
|
|
176
|
+
- Flaky test patterns (timeouts, sleep, race conditions) → MEDIUM
|
|
177
|
+
- Missing edge case coverage → LOW
|
|
178
|
+
|
|
179
|
+
**5d. Architecture Review**
|
|
180
|
+
|
|
181
|
+
Assess structural changes:
|
|
182
|
+
- Pattern consistency with existing codebase → MEDIUM
|
|
183
|
+
- Separation of concerns violations → HIGH
|
|
184
|
+
- Circular dependency introduction → HIGH
|
|
185
|
+
- Over-engineering / premature abstraction → MEDIUM
|
|
186
|
+
- API design consistency → MEDIUM
|
|
187
|
+
|
|
188
|
+
### Step 6: Generate Review Report
|
|
189
|
+
|
|
190
|
+
// turbo
|
|
191
|
+
|
|
192
|
+
Compile all findings into the structured review format:
|
|
193
|
+
|
|
194
|
+
1. Group findings by severity (CRITICAL → HIGH → MEDIUM → LOW → NIT)
|
|
195
|
+
2. Calculate verdict per decision table
|
|
196
|
+
3. Generate assessment summary with per-perspective status
|
|
197
|
+
4. Format inline comments for GitHub posting
|
|
198
|
+
|
|
199
|
+
### Step 7: Post Review to GitHub
|
|
200
|
+
|
|
201
|
+
**Skip this step if `--local` flag was used.**
|
|
202
|
+
|
|
203
|
+
Post the review using the `gh` CLI:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Post review with verdict
|
|
207
|
+
gh pr review <number> --repo <owner/repo> \
|
|
208
|
+
--{approve|request-changes|comment} \
|
|
209
|
+
--body "<review body>"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
For inline findings, post as review comments:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
gh api repos/<owner>/<repo>/pulls/<number>/comments \
|
|
216
|
+
--method POST \
|
|
217
|
+
-f body="<finding detail>" \
|
|
218
|
+
-f commit_id="<latest commit sha>" \
|
|
219
|
+
-f path="<file path>" \
|
|
220
|
+
-F line=<line number> \
|
|
221
|
+
-f side="RIGHT"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
- If posting fails → display review locally as fallback
|
|
225
|
+
- Confirm review was posted successfully
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Output Template
|
|
230
|
+
|
|
231
|
+
### Review Complete
|
|
232
|
+
|
|
233
|
+
```markdown
|
|
234
|
+
## PR Review Complete: #{number}
|
|
235
|
+
|
|
236
|
+
| Field | Value |
|
|
237
|
+
| :--- | :--- |
|
|
238
|
+
| PR | #{number} — {title} |
|
|
239
|
+
| Branch | {head} → {base} |
|
|
240
|
+
| Size | {label} ({files} files, +{additions}/-{deletions}) |
|
|
241
|
+
| Verdict | {APPROVE / REQUEST_CHANGES / COMMENT} |
|
|
242
|
+
|
|
243
|
+
### Assessment Summary
|
|
244
|
+
|
|
245
|
+
| Perspective | Status |
|
|
246
|
+
| :--- | :--- |
|
|
247
|
+
| PR Hygiene | {status} |
|
|
248
|
+
| Branch Strategy | {status} |
|
|
249
|
+
| Code Quality | {status} |
|
|
250
|
+
| Security | {status} |
|
|
251
|
+
| Testing | {status} |
|
|
252
|
+
| Architecture | {status} |
|
|
253
|
+
|
|
254
|
+
**Findings**: {critical} Critical, {high} High, {medium} Medium, {low} Low
|
|
255
|
+
|
|
256
|
+
**Review posted**: {Yes — link / No — local only}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Review Failed
|
|
260
|
+
|
|
261
|
+
```markdown
|
|
262
|
+
## PR Review Failed at Step {N}
|
|
263
|
+
|
|
264
|
+
### Error
|
|
265
|
+
{error description}
|
|
266
|
+
|
|
267
|
+
### Resolution
|
|
268
|
+
1. {fix steps}
|
|
269
|
+
2. Re-run: `/pr-review <reference>`
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Governance
|
|
275
|
+
|
|
276
|
+
**PROHIBITED:**
|
|
277
|
+
- Approving PRs with known CRITICAL findings
|
|
278
|
+
- Posting reviews without reading the full diff
|
|
279
|
+
- Making findings without file:line evidence
|
|
280
|
+
- Reviewing without detecting the branch strategy first
|
|
281
|
+
- Social-pressure approvals ("LGTM" without analysis)
|
|
282
|
+
- Posting duplicate reviews (check existing reviews first)
|
|
283
|
+
|
|
284
|
+
**REQUIRED:**
|
|
285
|
+
- Full diff analysis before any verdict
|
|
286
|
+
- Concrete fix suggestion for every finding
|
|
287
|
+
- Severity-prioritized findings (CRITICAL first)
|
|
288
|
+
- Branch strategy detection before target validation
|
|
289
|
+
- Evidence-based findings with file:line references
|
|
290
|
+
- Constructive tone — teach, don't criticize
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Completion Criteria
|
|
295
|
+
|
|
296
|
+
- [ ] PR reference parsed and validated
|
|
297
|
+
- [ ] Full PR data fetched (metadata, diff, reviews, CI)
|
|
298
|
+
- [ ] PR hygiene assessed (title, body, size, scope)
|
|
299
|
+
- [ ] Branch strategy detected and target validated
|
|
300
|
+
- [ ] Code quality, security, testing, architecture reviewed
|
|
301
|
+
- [ ] Findings compiled with severity and fix suggestions
|
|
302
|
+
- [ ] Verdict rendered per decision table
|
|
303
|
+
- [ ] Review posted to GitHub (unless `--local`)
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Related Resources
|
|
308
|
+
|
|
309
|
+
- **Skill**: `.agent/skills/pr-toolkit/SKILL.md` — review patterns, severity levels, size classification
|
|
310
|
+
- **Agent**: `.agent/agents/pr-reviewer.md` — Senior Staff Engineer review specialist
|
|
311
|
+
- **Related**: `/pr` (create PRs) · `/pr-fix` (fix review findings) · `/review` (local quality gates)
|
|
312
|
+
- **Rule**: `.agent/rules/git-workflow.md` — branching and commit conventions
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Guide splitting large PRs into focused sub-PRs by concern category with dependency-ordered merge plan.
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
sdlc-phase: build
|
|
5
|
+
skills: [pr-toolkit, git-workflow]
|
|
6
|
+
commit-types: [chore]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /pr-split — Pull Request Split Workflow
|
|
10
|
+
|
|
11
|
+
> **Trigger**: `/pr-split` (current branch) · `/pr-split #<number>` (existing PR)
|
|
12
|
+
> **Lifecycle**: Build — remediation for oversized PRs, before `/pr-review`
|
|
13
|
+
|
|
14
|
+
> [!CAUTION]
|
|
15
|
+
> Splitting a PR creates new branches and potentially modifies git history. This workflow uses `git cherry-pick` and selective checkout — it does NOT rewrite existing commits. The original PR/branch is preserved until the user explicitly closes it.
|
|
16
|
+
|
|
17
|
+
> [!TIP]
|
|
18
|
+
> This workflow leverages the **pr-toolkit** skill for split strategy (section 11) and size classification (section 2). PRs classified as L or XL are candidates for splitting.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Critical Rules
|
|
23
|
+
|
|
24
|
+
1. **NEVER** delete or force-push the original branch — preserve it as reference
|
|
25
|
+
2. **ALWAYS** analyze the full diff before proposing a split plan
|
|
26
|
+
3. **ALWAYS** verify each sub-PR independently passes `/review` pipeline
|
|
27
|
+
4. **ALWAYS** include dependency ordering in the split plan
|
|
28
|
+
5. **PRESERVE** all commits — use cherry-pick or selective checkout, not rebase
|
|
29
|
+
6. **ATOMIC** sub-PRs — each must be independently mergeable and testable
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Argument Parsing
|
|
34
|
+
|
|
35
|
+
| Command | Action |
|
|
36
|
+
| :--- | :--- |
|
|
37
|
+
| `/pr-split` | Analyze current branch for splitting |
|
|
38
|
+
| `/pr-split #<number>` | Analyze existing PR for splitting |
|
|
39
|
+
| `/pr-split --dry-run` | Show split plan without creating branches |
|
|
40
|
+
| `/pr-split --auto` | Auto-split by file category (no manual grouping) |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Steps
|
|
45
|
+
|
|
46
|
+
Execute IN ORDER. Stop at first failure.
|
|
47
|
+
|
|
48
|
+
### Step 1: Analyze Current Diff
|
|
49
|
+
|
|
50
|
+
// turbo
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# If analyzing current branch
|
|
54
|
+
git diff --name-only origin/<target>..HEAD
|
|
55
|
+
git diff --stat origin/<target>..HEAD
|
|
56
|
+
|
|
57
|
+
# If analyzing an existing PR
|
|
58
|
+
gh pr diff <number> --repo <owner/repo> --name-only
|
|
59
|
+
gh pr view <number> --repo <owner/repo> --json additions,deletions,changedFiles
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Classify the PR size per pr-toolkit size matrix.
|
|
63
|
+
- If XS/S/M → **STOP**: "PR is already reviewable ({size} — {files} files, {loc} LOC). Splitting not recommended."
|
|
64
|
+
- If L/XL → proceed with split analysis
|
|
65
|
+
|
|
66
|
+
### Step 2: Categorize Changed Files
|
|
67
|
+
|
|
68
|
+
// turbo
|
|
69
|
+
|
|
70
|
+
Group all changed files by concern category (per pr-toolkit split categories):
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
## Split Analysis: {files} files, +{additions}/-{deletions}
|
|
74
|
+
|
|
75
|
+
### Feature Code ({count} files)
|
|
76
|
+
- src/components/Button.tsx
|
|
77
|
+
- src/hooks/useAuth.ts
|
|
78
|
+
|
|
79
|
+
### Tests ({count} files)
|
|
80
|
+
- tests/Button.test.tsx
|
|
81
|
+
- tests/useAuth.test.ts
|
|
82
|
+
|
|
83
|
+
### Configuration ({count} files)
|
|
84
|
+
- .agent/manifest.json
|
|
85
|
+
- .eslintrc.js
|
|
86
|
+
|
|
87
|
+
### Dependencies ({count} files)
|
|
88
|
+
- package.json
|
|
89
|
+
- package-lock.json
|
|
90
|
+
|
|
91
|
+
### Documentation ({count} files)
|
|
92
|
+
- README.md
|
|
93
|
+
- docs/api.md
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Step 3: Propose Split Plan
|
|
97
|
+
|
|
98
|
+
// turbo
|
|
99
|
+
|
|
100
|
+
Generate a split plan with merge ordering:
|
|
101
|
+
|
|
102
|
+
```markdown
|
|
103
|
+
## Proposed Split Plan
|
|
104
|
+
|
|
105
|
+
| # | Sub-PR | Branch Name | Files | Type | Depends On |
|
|
106
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
107
|
+
| 1 | Update dependencies | split/{original}-deps | 2 | chore(deps) | — |
|
|
108
|
+
| 2 | Update configuration | split/{original}-config | 3 | chore | — |
|
|
109
|
+
| 3 | Implement feature | split/{original}-feat | 8 | feat | #1, #2 |
|
|
110
|
+
| 4 | Add tests | split/{original}-tests | 4 | test | #3 |
|
|
111
|
+
| 5 | Update documentation | split/{original}-docs | 3 | docs | #3 |
|
|
112
|
+
|
|
113
|
+
**Merge Order**: 1 → 2 → 3 → 4 → 5
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
If `--dry-run` → display plan and **STOP**.
|
|
117
|
+
|
|
118
|
+
Present plan to user for approval before proceeding.
|
|
119
|
+
|
|
120
|
+
### Step 4: Create Sub-Branches
|
|
121
|
+
|
|
122
|
+
For each sub-PR in the approved plan:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Create sub-branch from target
|
|
126
|
+
git checkout <target>
|
|
127
|
+
git pull origin <target>
|
|
128
|
+
git checkout -b split/<original>-<category>
|
|
129
|
+
|
|
130
|
+
# Cherry-pick or selectively checkout files from original branch
|
|
131
|
+
git checkout <original-branch> -- <file1> <file2> <file3>
|
|
132
|
+
git commit -m "<type>(<scope>): <description>
|
|
133
|
+
|
|
134
|
+
Split from: <original-branch>
|
|
135
|
+
Part N of M in split series"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Step 5: Verify Each Sub-Branch
|
|
139
|
+
|
|
140
|
+
// turbo
|
|
141
|
+
|
|
142
|
+
For each sub-branch, run the verification pipeline:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git checkout split/<original>-<category>
|
|
146
|
+
|
|
147
|
+
# Run /review pipeline (scope-filtered)
|
|
148
|
+
# lint → type-check → tests → security → build
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- If any sub-branch fails verification → fix issues before proceeding
|
|
152
|
+
- Each sub-PR must be independently buildable and testable
|
|
153
|
+
|
|
154
|
+
### Step 6: Create Sub-PRs
|
|
155
|
+
|
|
156
|
+
For each verified sub-branch:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
git push origin split/<original>-<category>
|
|
160
|
+
|
|
161
|
+
gh pr create \
|
|
162
|
+
--base <target> \
|
|
163
|
+
--head split/<original>-<category> \
|
|
164
|
+
--title "<type>(<scope>): <description>" \
|
|
165
|
+
--body "## Summary
|
|
166
|
+
Split from #{original-pr} — Part {N} of {M}
|
|
167
|
+
|
|
168
|
+
## Changes
|
|
169
|
+
{categorized change list}
|
|
170
|
+
|
|
171
|
+
## Dependencies
|
|
172
|
+
{Depends-On: #prev if applicable}
|
|
173
|
+
|
|
174
|
+
## Context
|
|
175
|
+
This PR is part of a split series. See #{original-pr} for full context.
|
|
176
|
+
Merge order: {1 → 2 → 3 → ...}"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Step 7: Update Original PR
|
|
180
|
+
|
|
181
|
+
Post a comment on the original PR linking all sub-PRs:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
gh pr comment <original-number> --repo <owner/repo> --body "## PR Split Complete
|
|
185
|
+
|
|
186
|
+
This PR has been split into {M} focused sub-PRs:
|
|
187
|
+
|
|
188
|
+
| # | Sub-PR | Status |
|
|
189
|
+
| :--- | :--- | :--- |
|
|
190
|
+
| 1 | #{sub-pr-1} — {title} | Open |
|
|
191
|
+
| 2 | #{sub-pr-2} — {title} | Open |
|
|
192
|
+
| ... | ... | ... |
|
|
193
|
+
|
|
194
|
+
**Merge order**: #1 → #2 → #3 → ...
|
|
195
|
+
|
|
196
|
+
This PR can be closed after all sub-PRs are merged."
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Output Template
|
|
202
|
+
|
|
203
|
+
### Split Complete
|
|
204
|
+
|
|
205
|
+
```markdown
|
|
206
|
+
## PR Split Complete
|
|
207
|
+
|
|
208
|
+
| Field | Value |
|
|
209
|
+
| :--- | :--- |
|
|
210
|
+
| Original PR | #{number} — {title} |
|
|
211
|
+
| Sub-PRs Created | {count} |
|
|
212
|
+
| Total Files | {original files} → {avg per sub-PR} per sub-PR |
|
|
213
|
+
| Verification | All sub-PRs pass /review |
|
|
214
|
+
|
|
215
|
+
### Sub-PRs
|
|
216
|
+
|
|
217
|
+
| # | PR | Title | Size | Status |
|
|
218
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
219
|
+
| 1 | #{n} | {title} | {size} | Created |
|
|
220
|
+
|
|
221
|
+
**Next**: Review and merge sub-PRs in order: #1 → #2 → ...
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Governance
|
|
227
|
+
|
|
228
|
+
**PROHIBITED:**
|
|
229
|
+
- Deleting or force-pushing the original branch
|
|
230
|
+
- Creating sub-PRs that cannot independently build/test
|
|
231
|
+
- Splitting into sub-PRs that have circular dependencies
|
|
232
|
+
- Proceeding without user approval of the split plan
|
|
233
|
+
- Using `// turbo` on branch creation or PR creation steps
|
|
234
|
+
|
|
235
|
+
**REQUIRED:**
|
|
236
|
+
- Full diff analysis before proposing split
|
|
237
|
+
- User approval of split plan before creating branches
|
|
238
|
+
- Each sub-PR independently passes `/review`
|
|
239
|
+
- Dependency ordering declared in sub-PR bodies
|
|
240
|
+
- Original PR updated with links to all sub-PRs
|
|
241
|
+
- Merge order explicitly documented
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Completion Criteria
|
|
246
|
+
|
|
247
|
+
- [ ] Original PR analyzed and size classified (L/XL)
|
|
248
|
+
- [ ] Files categorized by concern
|
|
249
|
+
- [ ] Split plan generated with merge ordering
|
|
250
|
+
- [ ] Split plan approved by user
|
|
251
|
+
- [ ] Sub-branches created with selective commits
|
|
252
|
+
- [ ] Each sub-branch passes `/review` independently
|
|
253
|
+
- [ ] Sub-PRs created with structured bodies and dependency declarations
|
|
254
|
+
- [ ] Original PR updated with sub-PR links and merge order
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Related Resources
|
|
259
|
+
|
|
260
|
+
- **Skill**: `.agent/skills/pr-toolkit/SKILL.md` — split categories (section 11), size classification (section 2)
|
|
261
|
+
- **Previous**: `/pr` (PR creation triggered XL warning)
|
|
262
|
+
- **Next**: `/pr-review` (review each sub-PR) · `/pr-merge` (merge in dependency order)
|
|
263
|
+
- **Related**: `/pr-fix` (fix review findings on sub-PRs)
|