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.
Files changed (37) hide show
  1. package/.agent/CheatSheet.md +51 -16
  2. package/.agent/README.md +4 -4
  3. package/.agent/agents/README.md +8 -1
  4. package/.agent/agents/pr-reviewer.md +259 -0
  5. package/.agent/checklists/README.md +2 -1
  6. package/.agent/checklists/pre-commit.md +1 -1
  7. package/.agent/checklists/session-end.md +1 -1
  8. package/.agent/checklists/session-start.md +1 -1
  9. package/.agent/checklists/task-complete.md +1 -1
  10. package/.agent/commands/README.md +130 -119
  11. package/.agent/commands/help.md +36 -19
  12. package/.agent/commands/pr-describe.md +65 -0
  13. package/.agent/commands/pr-fix.md +45 -0
  14. package/.agent/commands/pr-merge.md +45 -0
  15. package/.agent/commands/pr-review.md +50 -0
  16. package/.agent/commands/pr-split.md +54 -0
  17. package/.agent/commands/pr-status.md +56 -0
  18. package/.agent/commands/pr.md +58 -30
  19. package/.agent/engine/loading-rules.json +5 -0
  20. package/.agent/hooks/README.md +9 -5
  21. package/.agent/manifest.json +39 -6
  22. package/.agent/rules/agent-upgrade-policy.md +56 -0
  23. package/.agent/session-context.md +1 -1
  24. package/.agent/skills/README.md +4 -2
  25. package/.agent/skills/pr-toolkit/SKILL.md +467 -0
  26. package/.agent/skills/production-readiness/SKILL.md +3 -3
  27. package/.agent/workflows/README.md +13 -6
  28. package/.agent/workflows/deploy.md +2 -1
  29. package/.agent/workflows/pr-fix.md +305 -0
  30. package/.agent/workflows/pr-merge.md +242 -0
  31. package/.agent/workflows/pr-review.md +312 -0
  32. package/.agent/workflows/pr-split.md +263 -0
  33. package/.agent/workflows/pr.md +116 -26
  34. package/.agent/workflows/preflight.md +2 -2
  35. package/.agent/workflows/upgrade.md +196 -0
  36. package/README.md +48 -35
  37. package/package.json +2 -2
@@ -0,0 +1,305 @@
1
+ ---
2
+ description: Fix pull request issues based on review comments. Fetch findings, prioritize by severity, implement fixes, verify, and push resolution.
3
+ version: 1.0.0
4
+ sdlc-phase: build
5
+ skills: [pr-toolkit, verification-loop]
6
+ commit-types: [fix]
7
+ ---
8
+
9
+ # /pr-fix — Pull Request Fix Workflow
10
+
11
+ > **Trigger**: `/pr-fix <url>` · `/pr-fix <owner/repo>#<number>` · `/pr-fix #<number>`
12
+ > **Lifecycle**: Build — remediation phase after review findings, before re-review
13
+
14
+ > [!CAUTION]
15
+ > This workflow modifies code and pushes to the PR branch. Ensure you have write access to the branch and that no other contributors are actively pushing to it. Coordinate with the PR author if you are not the author.
16
+
17
+ > [!TIP]
18
+ > This workflow leverages the **pr-toolkit** skill for fix prioritization and the **verification-loop** skill for post-fix validation. Read `.agent/skills/pr-toolkit/SKILL.md` for the fix prioritization framework.
19
+
20
+ ---
21
+
22
+ ## Scope Filter
23
+
24
+ | Commit Type | Behavior | Rationale |
25
+ | :--- | :--- | :--- |
26
+ | `fix()` | Full workflow (all steps) | Fix commits from review findings |
27
+
28
+ > This workflow always produces `fix` commits. The scope filter applies to the PR's original commit type for context only.
29
+
30
+ ---
31
+
32
+ ## Critical Rules
33
+
34
+ 1. **ALWAYS** fetch and read ALL review comments before implementing any fix — understand the full picture first
35
+ 2. **ALWAYS** prioritize fixes: CRITICAL → HIGH → MEDIUM → LOW (never skip severity levels)
36
+ 3. **ALWAYS** run `/review` pipeline after all fixes before pushing — never push broken code
37
+ 4. **NEVER** modify code unrelated to review findings — stay scoped to the review
38
+ 5. **NEVER** dismiss or resolve review comments without implementing the fix or providing justification
39
+ 6. **ATOMIC** commits — one fix per commit with descriptive message referencing the finding
40
+
41
+ ---
42
+
43
+ ## Argument Parsing
44
+
45
+ | Command | Action |
46
+ | :--- | :--- |
47
+ | `/pr-fix <url>` | Fix PR at the given GitHub URL |
48
+ | `/pr-fix <owner/repo>#<number>` | Fix PR by owner/repo and number |
49
+ | `/pr-fix #<number>` | Fix PR in current repo by number |
50
+ | `/pr-fix #<number> --critical-only` | Fix only CRITICAL findings |
51
+ | `/pr-fix #<number> --dry-run` | Show fix plan without implementing |
52
+
53
+ ---
54
+
55
+ ## Steps
56
+
57
+ Execute IN ORDER. Stop at first failure.
58
+
59
+ ### Step 1: Parse PR Reference and Validate
60
+
61
+ // turbo
62
+
63
+ Parse the PR reference (same as `/pr-review` Step 1):
64
+
65
+ ```bash
66
+ # Get repo if not specified
67
+ gh repo view --json nameWithOwner --jq .nameWithOwner
68
+
69
+ # Validate PR exists and is open
70
+ gh pr view <number> --repo <owner/repo> --json state,title,headRefName --jq '{state,title,headRefName}'
71
+ ```
72
+
73
+ - If PR is closed/merged → **STOP**: "Cannot fix a closed/merged PR"
74
+ - If PR is open → proceed
75
+
76
+ ### Step 2: Fetch Review Comments
77
+
78
+ // turbo
79
+
80
+ Retrieve all review comments and requested changes:
81
+
82
+ ```bash
83
+ # Fetch PR reviews with comments
84
+ gh api repos/<owner>/<repo>/pulls/<number>/reviews
85
+
86
+ # Fetch inline review comments
87
+ gh api repos/<owner>/<repo>/pulls/<number>/comments
88
+
89
+ # Fetch issue-level comments (may contain fix requests)
90
+ gh api repos/<owner>/<repo>/issues/<number>/comments
91
+
92
+ # Get PR diff for context
93
+ gh pr diff <number> --repo <owner/repo>
94
+ ```
95
+
96
+ Extract and categorize:
97
+ - Review verdicts (REQUEST_CHANGES, COMMENT, APPROVE)
98
+ - Inline comments with file:line references
99
+ - Issue-level comments with fix requests
100
+ - Already-resolved comments (skip these)
101
+
102
+ ### Step 3: Categorize and Prioritize Fixes
103
+
104
+ // turbo
105
+
106
+ Apply the pr-toolkit fix prioritization framework:
107
+
108
+ | Priority | Category | Examples |
109
+ | :--- | :--- | :--- |
110
+ | P0 | CRITICAL | Security vulnerabilities, data loss, crashes |
111
+ | P1 | HIGH | Broken functionality, failed tests, code quality blockers |
112
+ | P2 | MEDIUM | Style issues, naming, documentation gaps |
113
+ | P3 | LOW/NIT | Suggestions, preferences, nice-to-haves |
114
+
115
+ Generate a fix plan:
116
+
117
+ ```markdown
118
+ ## Fix Plan for PR #{number}
119
+
120
+ | # | Priority | File:Line | Finding | Planned Fix |
121
+ | :--- | :--- | :--- | :--- | :--- |
122
+ | 1 | P0 | src/auth.ts:42 | Hardcoded API key | Move to env var |
123
+ | 2 | P1 | src/api/user.ts:15 | Missing input validation | Add Zod schema |
124
+ | ... | ... | ... | ... | ... |
125
+
126
+ **Total**: {p0} P0, {p1} P1, {p2} P2, {p3} P3
127
+ ```
128
+
129
+ If `--dry-run` flag → display fix plan and **STOP**
130
+ If `--critical-only` flag → filter to P0 only
131
+
132
+ ### Step 4: Checkout PR Branch
133
+
134
+ ```bash
135
+ # Fetch the PR branch
136
+ git fetch origin pull/<number>/head:<branch-name>
137
+ # Or if you have push access:
138
+ git fetch origin <head-branch>
139
+ git checkout <head-branch>
140
+
141
+ # Ensure branch is up to date
142
+ git pull origin <head-branch>
143
+ ```
144
+
145
+ - If checkout fails → **STOP**: "Cannot checkout PR branch — check access permissions"
146
+ - If branch has conflicts with base → resolve conflicts first per `/pr` conflict resolution protocol
147
+
148
+ ### Step 5: Implement Fixes
149
+
150
+ Implement fixes in priority order (P0 → P1 → P2 → P3):
151
+
152
+ For each fix:
153
+
154
+ 1. **Read** the affected file and understand the context
155
+ 2. **Implement** the fix addressing the reviewer's specific concern
156
+ 3. **Verify** the fix resolves the issue (run affected tests if applicable)
157
+ 4. **Commit** with descriptive message:
158
+
159
+ ```bash
160
+ git add <fixed-files>
161
+ git commit -m "fix(review): <description of fix>
162
+
163
+ Addresses review comment: <summary of reviewer's finding>"
164
+ ```
165
+
166
+ **Fix Guidelines:**
167
+ - Address the reviewer's exact concern — do not over-fix or refactor adjacent code
168
+ - If a finding requires a larger change than expected, document the scope and confirm with user
169
+ - If a finding is incorrect or not applicable, prepare a justification comment instead of a code change
170
+
171
+ ### Step 6: Run Verification
172
+
173
+ // turbo
174
+
175
+ After all fixes are implemented, run the full verification pipeline:
176
+
177
+ ```bash
178
+ # Delegate to /review pipeline
179
+ # Gates: lint → type-check → tests → security → build
180
+ ```
181
+
182
+ - If any gate fails → fix the failure, re-run verification
183
+ - If all gates pass → proceed to push
184
+
185
+ ### Step 7: Push Fixes
186
+
187
+ ```bash
188
+ git push origin <head-branch>
189
+ ```
190
+
191
+ - If push rejected → pull latest, resolve conflicts, re-verify, retry push
192
+ - If push succeeds → proceed to comment
193
+
194
+ ### Step 8: Comment Resolution
195
+
196
+ Post a summary comment on the PR documenting all fixes made:
197
+
198
+ ```bash
199
+ gh pr comment <number> --repo <owner/repo> --body "## Review Fixes Applied
200
+
201
+ | # | Finding | Fix Applied | Commit |
202
+ | :--- | :--- | :--- | :--- |
203
+ | 1 | {finding summary} | {fix description} | {short sha} |
204
+ | ... | ... | ... | ... |
205
+
206
+ **Verification**: All gates passed (lint, types, tests, security, build)
207
+
208
+ Ready for re-review."
209
+ ```
210
+
211
+ Re-request review from the original reviewer:
212
+
213
+ ```bash
214
+ gh pr edit <number> --repo <owner/repo> --add-reviewer <reviewer>
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Output Template
220
+
221
+ ### Fixes Applied Successfully
222
+
223
+ ```markdown
224
+ ## PR Fix Complete: #{number}
225
+
226
+ | Field | Value |
227
+ | :--- | :--- |
228
+ | PR | #{number} — {title} |
229
+ | Branch | {head-branch} |
230
+ | Fixes Applied | {count} |
231
+ | Commits | {commit count} |
232
+ | Verification | All gates passed |
233
+
234
+ ### Fix Summary
235
+
236
+ | Priority | Count | Status |
237
+ | :--- | :--- | :--- |
238
+ | P0 (Critical) | {n} | {all fixed / partial} |
239
+ | P1 (High) | {n} | {all fixed / partial} |
240
+ | P2 (Medium) | {n} | {all fixed / skipped} |
241
+ | P3 (Low) | {n} | {all fixed / skipped} |
242
+
243
+ **Next**: Wait for re-review from @{reviewer}
244
+ ```
245
+
246
+ ### Fix Failed
247
+
248
+ ```markdown
249
+ ## PR Fix Failed at Step {N}
250
+
251
+ ### Error
252
+ {error description}
253
+
254
+ ### Resolution
255
+ 1. {fix steps}
256
+ 2. Re-run: `/pr-fix <reference>`
257
+
258
+ ### Partial Progress
259
+ {list of fixes already applied}
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Governance
265
+
266
+ **PROHIBITED:**
267
+ - Modifying code unrelated to review findings
268
+ - Pushing without running full verification pipeline
269
+ - Dismissing review comments without justification
270
+ - Force-pushing over the PR branch (use regular push only)
271
+ - Skipping CRITICAL or HIGH findings (unless `--critical-only` is used)
272
+ - Resolving review threads without implementing the fix
273
+
274
+ **REQUIRED:**
275
+ - Read ALL review comments before implementing any fix
276
+ - Priority-ordered fixing (P0 → P1 → P2 → P3)
277
+ - Atomic commits — one fix per commit with review reference
278
+ - Full `/review` pipeline pass before push
279
+ - Summary comment documenting all fixes
280
+ - Re-request review from original reviewer
281
+
282
+ ---
283
+
284
+ ## Completion Criteria
285
+
286
+ - [ ] PR reference parsed and validated (open PR)
287
+ - [ ] All review comments fetched and categorized
288
+ - [ ] Fix plan generated with priority ordering
289
+ - [ ] PR branch checked out and up to date
290
+ - [ ] All applicable fixes implemented (by priority level)
291
+ - [ ] Each fix committed with descriptive message
292
+ - [ ] Full verification pipeline passed
293
+ - [ ] Fixes pushed to PR branch
294
+ - [ ] Summary comment posted on PR
295
+ - [ ] Re-review requested from original reviewer
296
+
297
+ ---
298
+
299
+ ## Related Resources
300
+
301
+ - **Skill**: `.agent/skills/pr-toolkit/SKILL.md` — fix prioritization framework, commit conventions
302
+ - **Previous**: `/pr-review` (review findings that drive fixes)
303
+ - **Next**: Re-review cycle → `/pr-review` or manual reviewer re-check
304
+ - **Related**: `/review` (local verification pipeline) · `/pr` (PR creation)
305
+ - **Rule**: `.agent/rules/git-workflow.md` — commit conventions
@@ -0,0 +1,242 @@
1
+ ---
2
+ description: Safe PR merge with dependency validation, CI verification, post-merge checks, and branch cleanup.
3
+ version: 1.0.0
4
+ sdlc-phase: ship
5
+ skills: [pr-toolkit, verification-loop]
6
+ commit-types: [feat, fix, refactor, perf, chore, docs, test]
7
+ ---
8
+
9
+ # /pr-merge — Safe Pull Request Merge Workflow
10
+
11
+ > **Trigger**: `/pr-merge <url>` · `/pr-merge <owner/repo>#<number>` · `/pr-merge #<number>`
12
+ > **Lifecycle**: Ship — after review approval, final step before deployment
13
+
14
+ > [!CAUTION]
15
+ > Merging a PR modifies the target branch and is difficult to reverse without force-push. Ensure all checks pass, reviews are approved, and dependencies are merged before proceeding. This workflow enforces pre-merge and post-merge validation.
16
+
17
+ > [!TIP]
18
+ > This workflow leverages the **pr-toolkit** skill for dependency validation and merge strategy selection. Read `.agent/skills/pr-toolkit/SKILL.md` for dependency management details.
19
+
20
+ ---
21
+
22
+ ## Scope Filter
23
+
24
+ | Commit Type | Merge Mode | Gates |
25
+ | :--- | :--- | :--- |
26
+ | `feat`, `fix`, `refactor`, `perf` | Full (all steps) | All checks required |
27
+ | `chore`, `docs`, `test` | Lightweight | Skip Step 4 (post-merge verification) |
28
+
29
+ ---
30
+
31
+ ## Critical Rules
32
+
33
+ 1. **NEVER** merge a PR with failing CI checks — no exceptions
34
+ 2. **NEVER** merge a PR without at least 1 approval (unless solo project)
35
+ 3. **NEVER** merge a PR with unresolved blocking dependencies (`Depends-On:` PRs still open)
36
+ 4. **ALWAYS** verify the merge target matches the detected branch strategy
37
+ 5. **ALWAYS** run post-merge validation to catch integration issues immediately
38
+ 6. **PREFER** squash merge for feature branches, merge commit for release/dev→main
39
+
40
+ ---
41
+
42
+ ## Argument Parsing
43
+
44
+ | Command | Action |
45
+ | :--- | :--- |
46
+ | `/pr-merge #<number>` | Merge PR in current repo |
47
+ | `/pr-merge <url>` | Merge PR at GitHub URL |
48
+ | `/pr-merge #<number> --squash` | Force squash merge |
49
+ | `/pr-merge #<number> --merge-commit` | Force merge commit |
50
+ | `/pr-merge #<number> --rebase` | Force rebase merge |
51
+ | `/pr-merge #<number> --dry-run` | Validate merge readiness without merging |
52
+
53
+ ---
54
+
55
+ ## Steps
56
+
57
+ Execute IN ORDER. Stop at first failure.
58
+
59
+ ### Step 1: Parse PR Reference and Validate State
60
+
61
+ // turbo
62
+
63
+ ```bash
64
+ gh pr view <number> --repo <owner/repo> \
65
+ --json state,mergeable,mergeStateStatus,title,baseRefName,headRefName,reviewDecision,statusCheckRollup
66
+ ```
67
+
68
+ Validate:
69
+ - PR is OPEN (not closed or already merged)
70
+ - PR is mergeable (no conflicts)
71
+ - `mergeStateStatus` is not `BLOCKED`
72
+
73
+ If validation fails → **STOP** with specific error message.
74
+
75
+ ### Step 2: Verify Merge Prerequisites
76
+
77
+ // turbo
78
+
79
+ **2a. Review Approval**:
80
+ ```bash
81
+ gh pr view <number> --repo <owner/repo> --json reviewDecision --jq '.reviewDecision'
82
+ ```
83
+ - If `APPROVED` → proceed
84
+ - If `REVIEW_REQUIRED` or `CHANGES_REQUESTED` → **STOP**: "PR requires review approval"
85
+
86
+ **2b. CI Status**:
87
+ ```bash
88
+ gh pr checks <number> --repo <owner/repo>
89
+ ```
90
+ - All required checks must pass
91
+ - If any check failed → **STOP**: "CI check `{name}` failed — fix before merge"
92
+ - If checks pending → **WAIT** or **STOP**: "CI checks still running"
93
+
94
+ **2c. Dependency Validation** (per pr-toolkit dependency management):
95
+ ```bash
96
+ # Extract Depends-On from PR body
97
+ gh pr view <number> --repo <owner/repo> --json body --jq '.body' | grep -i 'Depends-On'
98
+ ```
99
+ - For each dependency, verify status is `MERGED`
100
+ - If any dependency is OPEN → **STOP**: "Blocking dependency #{dep} is not yet merged"
101
+ - If no dependencies → proceed
102
+
103
+ **2d. Branch Strategy Validation**:
104
+ - Verify the merge target matches detected branch strategy
105
+ - GitFlow: feature→dev (not main), dev→main (sprint merge), hotfix→main
106
+ - If target mismatch → **WARN** (non-blocking for merge, but flag it)
107
+
108
+ ### Step 3: Execute Merge
109
+
110
+ **3a. Select Merge Strategy**:
111
+
112
+ | Scenario | Default Strategy | Rationale |
113
+ | :--- | :--- | :--- |
114
+ | Feature → dev/develop | Squash merge | Clean history, single commit per feature |
115
+ | dev → main (release) | Merge commit | Preserve branch history for audit |
116
+ | hotfix → main | Squash merge | Fast, clean hotfix |
117
+ | User specified `--squash/--merge-commit/--rebase` | User's choice | Explicit override |
118
+
119
+ **3b. Execute**:
120
+ ```bash
121
+ gh pr merge <number> --repo <owner/repo> \
122
+ --{squash|merge|rebase} \
123
+ --delete-branch \
124
+ --subject "<merge commit title>"
125
+ ```
126
+
127
+ - If merge fails (race condition, conflict) → **STOP** with error
128
+ - `--delete-branch` auto-cleans the merged branch
129
+
130
+ ### Step 4: Post-Merge Validation
131
+
132
+ // turbo
133
+
134
+ **4a. Verify merge was recorded**:
135
+ ```bash
136
+ gh pr view <number> --repo <owner/repo> --json state,mergedAt --jq '{state,mergedAt}'
137
+ ```
138
+
139
+ **4b. Check target branch CI** (if available):
140
+ ```bash
141
+ # Check if CI triggered on the target branch after merge
142
+ gh run list --repo <owner/repo> --branch <target> --limit 1
143
+ ```
144
+
145
+ **4c. Update dependent PRs** (if any PRs depend on this one):
146
+ ```bash
147
+ # Search for PRs that have "Depends-On: #<number>" in their body
148
+ gh pr list --repo <owner/repo> --state open --json number,body \
149
+ --jq '[.[] | select(.body | test("Depends-On.*#'<number>'"))] | .[].number'
150
+ ```
151
+ - For each dependent PR, post a comment: "Dependency #{number} has been merged. This PR may now be ready to merge."
152
+
153
+ ### Step 5: Report Results
154
+
155
+ // turbo
156
+
157
+ Report merge status and any post-merge actions needed.
158
+
159
+ ---
160
+
161
+ ## Output Template
162
+
163
+ ### Merge Successful
164
+
165
+ ```markdown
166
+ ## PR Merged Successfully: #{number}
167
+
168
+ | Field | Value |
169
+ | :--- | :--- |
170
+ | PR | #{number} — {title} |
171
+ | Merged into | {base branch} |
172
+ | Strategy | {squash / merge commit / rebase} |
173
+ | Branch | {head branch} — deleted |
174
+ | Merged at | {timestamp} |
175
+
176
+ ### Post-Merge Status
177
+ | Check | Status |
178
+ | :--- | :--- |
179
+ | CI on target branch | {running / passed / N/A} |
180
+ | Dependent PRs notified | {count} PRs |
181
+ | Branch cleanup | Deleted |
182
+
183
+ **Next**: `/deploy` when ready · or continue with dependent PRs
184
+ ```
185
+
186
+ ### Merge Blocked
187
+
188
+ ```markdown
189
+ ## PR Merge Blocked: #{number}
190
+
191
+ | Blocker | Status |
192
+ | :--- | :--- |
193
+ | {blocker description} | {detail} |
194
+
195
+ ### Resolution
196
+ 1. {fix steps}
197
+ 2. Re-run: `/pr-merge #<number>`
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Governance
203
+
204
+ **PROHIBITED:**
205
+ - Merging PRs with failing CI checks
206
+ - Merging PRs without review approval
207
+ - Merging PRs with unresolved blocking dependencies
208
+ - Force-merging past branch protection rules
209
+ - Merging without verifying branch strategy compliance
210
+ - Using `// turbo` on the merge execution step (Step 3)
211
+
212
+ **REQUIRED:**
213
+ - All CI checks passing
214
+ - At least 1 review approval
215
+ - All `Depends-On` dependencies merged
216
+ - Branch strategy validation
217
+ - Post-merge CI verification (for non-chore PRs)
218
+ - Auto-delete merged branch
219
+ - Notify dependent PRs after merge
220
+
221
+ ---
222
+
223
+ ## Completion Criteria
224
+
225
+ - [ ] PR state validated (open, mergeable, not blocked)
226
+ - [ ] Review approval confirmed
227
+ - [ ] All CI checks passing
228
+ - [ ] Dependencies validated (all merged)
229
+ - [ ] Branch strategy compliance verified
230
+ - [ ] Merge executed with appropriate strategy
231
+ - [ ] Merged branch deleted
232
+ - [ ] Post-merge CI status checked
233
+ - [ ] Dependent PRs notified
234
+
235
+ ---
236
+
237
+ ## Related Resources
238
+
239
+ - **Skill**: `.agent/skills/pr-toolkit/SKILL.md` — dependency management, merge strategy selection
240
+ - **Previous**: `/pr-review` (review approved) · `/pr-fix` (findings addressed)
241
+ - **Next**: `/deploy` (deployment after merge)
242
+ - **Related**: `/pr` (PR creation) · `/pr-status` (check merge readiness)