@apogeelabs/the-agency 0.7.0 → 0.8.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/package.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Goal
|
|
4
4
|
|
|
5
|
-
Prepare and create a draft pull request for the current branch. Run pre-submission checks, generate a PR
|
|
5
|
+
Prepare and create a draft pull request for the current branch. Run pre-submission checks, generate a full PR review, collect optional author testing notes, and create the draft PR.
|
|
6
6
|
|
|
7
7
|
This command takes no arguments. It operates on the currently checked-out branch.
|
|
8
8
|
|
|
9
|
-
<!-- Sibling command: review-pr.md uses the same plugin discovery/loading flow
|
|
9
|
+
<!-- Sibling command: review-pr.md uses the same analysis approach and plugin discovery/loading flow. If the analysis format or plugin format changes, update both files. -->
|
|
10
10
|
|
|
11
11
|
## Constraints
|
|
12
12
|
|
|
13
|
-
- This command is conversational. There are multiple points where you pause and wait for developer input (Step 2, Step
|
|
13
|
+
- This command is conversational. There are multiple points where you pause and wait for developer input (Step 2, Step 10, Step 11, Step 12). Don't try to rush through without their responses.
|
|
14
14
|
- Check failures are informational, not blocking. The developer can still create the PR even if checks fail.
|
|
15
15
|
- Always create the PR as a draft. No option to toggle this.
|
|
16
16
|
- If the developer wants to bail at any point, respect that. Don't push them to continue.
|
|
@@ -90,11 +90,94 @@ git diff $TARGET...HEAD
|
|
|
90
90
|
git log --no-merges --oneline $TARGET..HEAD
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
## Step 4:
|
|
93
|
+
## Step 4: Categorize and Filter Files
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
Before analysis, categorize the changed files:
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
**Noise files (acknowledge but don't analyze deeply):**
|
|
98
|
+
|
|
99
|
+
- `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` -> "lock file updated"
|
|
100
|
+
- `*.min.js`, `*.min.css`, `dist/*`, `build/*` -> "generated/bundled files"
|
|
101
|
+
- Binary files (images, fonts, etc.) -> "binary file added/modified/deleted"
|
|
102
|
+
|
|
103
|
+
**Categorize by area:**
|
|
104
|
+
|
|
105
|
+
Group changed files by top-level directory. If the repo uses workspaces (check for a `workspaces` field in `package.json` or the presence of `pnpm-workspace.yaml`), use the workspace definitions to inform grouping. Otherwise, fall back to top-level directory names.
|
|
106
|
+
|
|
107
|
+
## Step 5: Analyze Changes
|
|
108
|
+
|
|
109
|
+
### For Small PRs (fewer than 30 changed files):
|
|
110
|
+
|
|
111
|
+
Analyze **per-commit**. For each commit, produce a narrative block with:
|
|
112
|
+
|
|
113
|
+
1. **The Mental Model Shift** -- plain English explanation of how the codebase's story changed. Focus on "why" and "so what," not restating the diff. Highlight:
|
|
114
|
+
- Architectural shifts or new patterns introduced
|
|
115
|
+
- Patterns retired or approaches abandoned
|
|
116
|
+
- Code that appears orphaned, half-finished, or disconnected
|
|
117
|
+
|
|
118
|
+
2. **What Changed Structurally** -- numbered list of concrete changes:
|
|
119
|
+
- Collapse repetitive/mechanical changes (e.g., "~15 files updated imports from X to Y")
|
|
120
|
+
- Call out meaningful changes individually with enough context to understand impact
|
|
121
|
+
|
|
122
|
+
### For Large PRs (30 or more changed files):
|
|
123
|
+
|
|
124
|
+
Analyze **by theme/area** rather than per-commit. Group changes by package or functional area:
|
|
125
|
+
|
|
126
|
+
1. First, identify the major themes/areas touched
|
|
127
|
+
2. For each theme, produce a narrative block (Mental Model Shift + Structural Changes)
|
|
128
|
+
3. After per-area analysis, produce a **holistic summary** that captures cross-cutting changes and overall architectural impact
|
|
129
|
+
|
|
130
|
+
### Analysis Guidance:
|
|
131
|
+
|
|
132
|
+
- **Explain the "why" and "so what"**, not just the "what"
|
|
133
|
+
- **Collapse noise**: If 50 files have the same mechanical change, that's one bullet point
|
|
134
|
+
- **Highlight signal**: New public APIs, changed interfaces, deleted capabilities, behavioral changes
|
|
135
|
+
- **Flag disconnects**: Code that doesn't seem to connect to anything, half-implemented features, TODOs left behind
|
|
136
|
+
- **Note removals**: Deleted code is as important as added code -- what capability is gone?
|
|
137
|
+
|
|
138
|
+
## Step 6: Identify Risks
|
|
139
|
+
|
|
140
|
+
Scan for and report:
|
|
141
|
+
|
|
142
|
+
**Security concerns:**
|
|
143
|
+
|
|
144
|
+
- Auth/authorization changes
|
|
145
|
+
- New API endpoints or route changes
|
|
146
|
+
- Injection vectors (SQL, command, XSS)
|
|
147
|
+
- Sensitive data in logs or error messages
|
|
148
|
+
- Secrets or credentials (even if they look like placeholders)
|
|
149
|
+
- Changes to validation or sanitization
|
|
150
|
+
|
|
151
|
+
**Behavioral risks:**
|
|
152
|
+
|
|
153
|
+
- Changes to public APIs or interfaces
|
|
154
|
+
- Modified default values or fallback behavior
|
|
155
|
+
- Error handling changes that might swallow errors
|
|
156
|
+
- Timing or ordering changes in async code
|
|
157
|
+
|
|
158
|
+
**Architectural concerns:**
|
|
159
|
+
|
|
160
|
+
- Layer boundary violations (e.g., handler calling repository directly)
|
|
161
|
+
- New circular dependencies
|
|
162
|
+
- Assumptions in one layer that depend on implementation details of another
|
|
163
|
+
- Patterns that diverge from established codebase conventions
|
|
164
|
+
|
|
165
|
+
**Dependency concerns:**
|
|
166
|
+
|
|
167
|
+
- New dependencies added
|
|
168
|
+
- Dependencies removed (what relied on them?)
|
|
169
|
+
- Major version bumps
|
|
170
|
+
- Dependencies with known security issues
|
|
171
|
+
|
|
172
|
+
**Before finalizing risk callouts related to test files (`.test.ts`, `.spec.ts`):**
|
|
173
|
+
|
|
174
|
+
Read `.ai/UnitTestGeneration.md` (if it exists) and cross-reference any test-related findings against the project's testing conventions. Do NOT flag patterns that conform to those guidelines -- they are intentional, not risks.
|
|
175
|
+
|
|
176
|
+
## Step 7: Tribal Knowledge Checks
|
|
177
|
+
|
|
178
|
+
Tribal knowledge checks are loaded dynamically from `.ai/review-checks/`. Each check file is a markdown file with YAML frontmatter.
|
|
179
|
+
|
|
180
|
+
<!-- This is the same discovery/loading flow as review-pr.md. -->
|
|
98
181
|
|
|
99
182
|
**Expected check file format:**
|
|
100
183
|
|
|
@@ -116,7 +199,7 @@ applies_when: Changed files include .ts files in src/
|
|
|
116
199
|
ls .ai/review-checks/*.md 2>/dev/null
|
|
117
200
|
```
|
|
118
201
|
|
|
119
|
-
2. **If the directory does not exist or contains no `.md` files**, skip the entire
|
|
202
|
+
2. **If the directory does not exist or contains no `.md` files**, skip the entire Tribal Knowledge Checks section silently -- no error, no placeholder text. Proceed to Step 8.
|
|
120
203
|
|
|
121
204
|
3. **If files are found**, read each one:
|
|
122
205
|
|
|
@@ -126,34 +209,60 @@ cat .ai/review-checks/*.md
|
|
|
126
209
|
|
|
127
210
|
4. For each file, parse the YAML frontmatter to extract `name` and `applies_when`. If a file is missing frontmatter or has invalid/unparseable YAML, skip it and note: "Skipped `{filename}`: missing or invalid frontmatter."
|
|
128
211
|
|
|
129
|
-
5. Evaluate each file's `applies_when` value against the list of changed files from the diff (gathered in Step 3). Use your judgment
|
|
212
|
+
5. Evaluate each file's `applies_when` value against the list of changed files from the diff (gathered in Step 3). Use your judgment -- `applies_when` is natural language, not a glob pattern. Match generously but sensibly.
|
|
130
213
|
|
|
131
|
-
6. For each check group where `applies_when` matches,
|
|
214
|
+
6. For each check group where `applies_when` matches, include its checks in the output under a heading using the `name` from frontmatter. Evaluate each check against the actual diff.
|
|
132
215
|
|
|
133
|
-
7. If files exist but **none** of their `applies_when` criteria match the diff, skip the
|
|
134
|
-
|
|
135
|
-
Store the check results — they'll be included in the PR body later.
|
|
216
|
+
7. If files exist but **none** of their `applies_when` criteria match the diff, skip the Tribal Knowledge Checks section entirely.
|
|
136
217
|
|
|
137
218
|
Display the check results to the developer as you go so they can see what passed and what needs attention.
|
|
138
219
|
|
|
139
|
-
## Step
|
|
220
|
+
## Step 8: Testing Recommendations
|
|
221
|
+
|
|
222
|
+
Based on the changes, provide concrete testing recommendations. This is NOT generic "write more tests" advice -- recommendations must be tied to the actual changes.
|
|
223
|
+
|
|
224
|
+
### What to recommend:
|
|
225
|
+
|
|
226
|
+
**Manual verification:**
|
|
227
|
+
|
|
228
|
+
- Specific user flows or scenarios the reviewer should manually test
|
|
229
|
+
- Edge cases introduced by the changes that aren't obvious from reading the code
|
|
230
|
+
- Integration points that might behave differently after these changes
|
|
231
|
+
|
|
232
|
+
**Automated test coverage:**
|
|
233
|
+
|
|
234
|
+
- New code paths that lack corresponding tests
|
|
235
|
+
- Behavioral changes that existing tests might not cover
|
|
236
|
+
- Specific test scenarios to add (with enough detail to write the test)
|
|
237
|
+
- **Do NOT recommend tests for React components (`.tsx` files).** We do not unit test React components.
|
|
238
|
+
|
|
239
|
+
**Regression risks:**
|
|
240
|
+
|
|
241
|
+
- Existing functionality that might be affected and should be regression tested
|
|
242
|
+
- Areas where the change assumptions might conflict with existing behavior
|
|
243
|
+
|
|
244
|
+
### Guidance:
|
|
245
|
+
|
|
246
|
+
- Be specific: "Test the login flow with an expired token" not "test authentication"
|
|
247
|
+
- Reference the actual changes: "The new `validateApiKey` middleware should be tested with missing, invalid, and expired keys"
|
|
248
|
+
- Prioritize: If there are many potential tests, highlight the most important ones first
|
|
249
|
+
- If the PR includes good test coverage already, acknowledge that and note any gaps
|
|
250
|
+
|
|
251
|
+
## Step 9: Generate Title
|
|
140
252
|
|
|
141
253
|
Analyze the diff and commit history gathered in Step 3. Generate:
|
|
142
254
|
|
|
143
255
|
- **Title**: Concise, reflects the nature of the changes (bug fix, feature, refactor, etc.). Keep it under 70 characters.
|
|
144
|
-
- **Description**: Summarize what changed and why. Focus on the "so what" — not a restatement of the diff. Draw from commit messages and the actual code changes.
|
|
145
|
-
|
|
146
|
-
For large diffs, prioritize analyzing `git diff --stat` and the commit log, then selectively read diffs for the most significant files rather than trying to process the entire diff.
|
|
147
256
|
|
|
148
|
-
## Step
|
|
257
|
+
## Step 10: Collect Author Testing Notes (Optional)
|
|
149
258
|
|
|
150
259
|
Ask the developer:
|
|
151
260
|
|
|
152
|
-
> **
|
|
261
|
+
> **Do you have any additional testing steps you'd like to include?** These will appear in the PR as "PR Author Testing Recommendations" alongside the generated testing analysis. Feel free to skip if the generated recommendations cover it.
|
|
153
262
|
|
|
154
|
-
|
|
263
|
+
If the developer provides testing steps, store them for inclusion in the PR body. If they skip or decline, proceed without them.
|
|
155
264
|
|
|
156
|
-
## Step
|
|
265
|
+
## Step 11: Present Full Preview
|
|
157
266
|
|
|
158
267
|
Show the developer the complete PR preview:
|
|
159
268
|
|
|
@@ -164,24 +273,59 @@ Show the developer the complete PR preview:
|
|
|
164
273
|
|
|
165
274
|
---
|
|
166
275
|
|
|
276
|
+
# {title}
|
|
277
|
+
|
|
278
|
+
**Branch**: {current branch} -> {$TARGET}
|
|
279
|
+
**Changes**: {additions} additions, {deletions} deletions across {changed file count} files
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
167
283
|
## Summary
|
|
168
284
|
|
|
169
|
-
|
|
285
|
+
[Per-commit or per-theme narrative blocks from Step 5]
|
|
170
286
|
|
|
171
|
-
|
|
287
|
+
---
|
|
172
288
|
|
|
173
|
-
|
|
289
|
+
## Risk Callouts
|
|
290
|
+
|
|
291
|
+
[Risks from Step 6, or "No significant risks identified"]
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Tribal Knowledge Checks
|
|
296
|
+
|
|
297
|
+
[Only if matching check files were found in Step 7. Omit section entirely otherwise.]
|
|
298
|
+
|
|
299
|
+
### [name from check file frontmatter]
|
|
300
|
+
|
|
301
|
+
- [x] [Check passed or N/A]
|
|
302
|
+
- [ ] **[Check failed]**: [Specific finding with file:line references]
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Testing Recommendations
|
|
307
|
+
|
|
308
|
+
### Manual Verification
|
|
309
|
+
|
|
310
|
+
- [Specific scenario to test manually]
|
|
311
|
+
|
|
312
|
+
### Automated Test Gaps
|
|
313
|
+
|
|
314
|
+
- [Specific test that should be written]
|
|
315
|
+
|
|
316
|
+
### Regression Risks
|
|
317
|
+
|
|
318
|
+
- [Existing functionality to regression test]
|
|
174
319
|
```
|
|
175
320
|
|
|
176
|
-
If
|
|
321
|
+
If the developer provided author testing notes in Step 10, also show:
|
|
177
322
|
|
|
178
323
|
```
|
|
179
|
-
|
|
180
|
-
<summary>Pre-submission Checks</summary>
|
|
324
|
+
---
|
|
181
325
|
|
|
182
|
-
|
|
326
|
+
## PR Author Testing Recommendations
|
|
183
327
|
|
|
184
|
-
|
|
328
|
+
{developer-provided testing steps}
|
|
185
329
|
```
|
|
186
330
|
|
|
187
331
|
Then ask:
|
|
@@ -190,7 +334,7 @@ Then ask:
|
|
|
190
334
|
|
|
191
335
|
Let the developer make edits. Iterate until they're satisfied.
|
|
192
336
|
|
|
193
|
-
## Step
|
|
337
|
+
## Step 12: Push Branch
|
|
194
338
|
|
|
195
339
|
Check whether the branch has an upstream and is up to date:
|
|
196
340
|
|
|
@@ -218,32 +362,60 @@ git push -u origin $(git branch --show-current)
|
|
|
218
362
|
|
|
219
363
|
**If the branch is already up to date with the remote**, skip this step silently.
|
|
220
364
|
|
|
221
|
-
## Step
|
|
365
|
+
## Step 13: Create Draft PR
|
|
222
366
|
|
|
223
|
-
Assemble the PR body:
|
|
367
|
+
Assemble the PR body using the full review content from Steps 5-8:
|
|
224
368
|
|
|
225
369
|
```
|
|
370
|
+
# {title}
|
|
371
|
+
|
|
372
|
+
**Branch**: {current branch} -> {$TARGET}
|
|
373
|
+
**Changes**: {additions} additions, {deletions} deletions across {changed file count} files
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
226
377
|
## Summary
|
|
227
378
|
|
|
228
|
-
{
|
|
379
|
+
{per-commit or per-theme narrative blocks}
|
|
229
380
|
|
|
230
|
-
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Risk Callouts
|
|
231
384
|
|
|
232
|
-
{
|
|
385
|
+
{risks, or "No significant risks identified"}
|
|
233
386
|
```
|
|
234
387
|
|
|
235
|
-
If check results exist from Step
|
|
388
|
+
If tribal knowledge check results exist from Step 7, append:
|
|
236
389
|
|
|
237
390
|
```
|
|
238
|
-
|
|
239
|
-
<summary>Pre-submission Checks</summary>
|
|
391
|
+
---
|
|
240
392
|
|
|
241
|
-
|
|
393
|
+
## Tribal Knowledge Checks
|
|
242
394
|
|
|
243
|
-
|
|
395
|
+
{check results with pass/fail and file:line references}
|
|
244
396
|
```
|
|
245
397
|
|
|
246
|
-
If no check results (no plugin files found or none matched), omit the
|
|
398
|
+
If no check results (no plugin files found or none matched), omit the Tribal Knowledge Checks section entirely.
|
|
399
|
+
|
|
400
|
+
Append the testing recommendations from Step 8:
|
|
401
|
+
|
|
402
|
+
```
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Testing Recommendations
|
|
406
|
+
|
|
407
|
+
{testing recommendations}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
If the developer provided author testing notes in Step 10, append:
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## PR Author Testing Recommendations
|
|
416
|
+
|
|
417
|
+
{developer-provided testing steps}
|
|
418
|
+
```
|
|
247
419
|
|
|
248
420
|
Create the draft PR:
|
|
249
421
|
|