@massu/core 0.1.2 → 0.4.1
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/commands/_shared-preamble.md +76 -0
- package/commands/massu-audit-deps.md +211 -0
- package/commands/massu-changelog.md +174 -0
- package/commands/massu-cleanup.md +315 -0
- package/commands/massu-commit.md +481 -0
- package/commands/massu-create-plan.md +752 -0
- package/commands/massu-dead-code.md +131 -0
- package/commands/massu-debug.md +484 -0
- package/commands/massu-deploy.md +91 -0
- package/commands/massu-deps.md +374 -0
- package/commands/massu-doc-gen.md +279 -0
- package/commands/massu-docs.md +364 -0
- package/commands/massu-estimate.md +313 -0
- package/commands/massu-golden-path.md +973 -0
- package/commands/massu-guide.md +167 -0
- package/commands/massu-hotfix.md +480 -0
- package/commands/massu-loop-playwright.md +837 -0
- package/commands/massu-loop.md +775 -0
- package/commands/massu-new-feature.md +511 -0
- package/commands/massu-parity.md +214 -0
- package/commands/massu-plan.md +456 -0
- package/commands/massu-push-light.md +207 -0
- package/commands/massu-push.md +434 -0
- package/commands/massu-refactor.md +410 -0
- package/commands/massu-release.md +363 -0
- package/commands/massu-review.md +238 -0
- package/commands/massu-simplify.md +281 -0
- package/commands/massu-status.md +278 -0
- package/commands/massu-tdd.md +201 -0
- package/commands/massu-test.md +516 -0
- package/commands/massu-verify-playwright.md +281 -0
- package/commands/massu-verify.md +667 -0
- package/dist/cli.js +12521 -0
- package/dist/hooks/cost-tracker.js +80 -5
- package/dist/hooks/post-edit-context.js +72 -6
- package/dist/hooks/post-tool-use.js +234 -57
- package/dist/hooks/pre-compact.js +144 -5
- package/dist/hooks/pre-delete-check.js +141 -11
- package/dist/hooks/quality-event.js +80 -5
- package/dist/hooks/security-gate.js +29 -0
- package/dist/hooks/session-end.js +83 -8
- package/dist/hooks/session-start.js +153 -7
- package/dist/hooks/user-prompt.js +166 -5
- package/package.json +6 -5
- package/src/backfill-sessions.ts +5 -4
- package/src/cli.ts +6 -1
- package/src/commands/doctor.ts +193 -6
- package/src/commands/init.ts +235 -6
- package/src/commands/install-commands.ts +137 -0
- package/src/config.ts +68 -2
- package/src/db.ts +115 -2
- package/src/docs-tools.ts +8 -6
- package/src/hooks/post-edit-context.ts +1 -1
- package/src/hooks/post-tool-use.ts +130 -0
- package/src/hooks/pre-compact.ts +23 -1
- package/src/hooks/pre-delete-check.ts +92 -4
- package/src/hooks/security-gate.ts +32 -0
- package/src/hooks/session-start.ts +97 -4
- package/src/hooks/user-prompt.ts +46 -1
- package/src/import-resolver.ts +2 -1
- package/src/knowledge-db.ts +169 -0
- package/src/knowledge-indexer.ts +704 -0
- package/src/knowledge-tools.ts +1413 -0
- package/src/license.ts +482 -0
- package/src/memory-db.ts +14 -1
- package/src/observation-extractor.ts +11 -4
- package/src/page-deps.ts +3 -2
- package/src/python/coupling-detector.ts +124 -0
- package/src/python/domain-enforcer.ts +83 -0
- package/src/python/impact-analyzer.ts +95 -0
- package/src/python/import-parser.ts +244 -0
- package/src/python/import-resolver.ts +135 -0
- package/src/python/migration-indexer.ts +115 -0
- package/src/python/migration-parser.ts +332 -0
- package/src/python/model-indexer.ts +70 -0
- package/src/python/model-parser.ts +279 -0
- package/src/python/route-indexer.ts +58 -0
- package/src/python/route-parser.ts +317 -0
- package/src/python-tools.ts +629 -0
- package/src/sentinel-db.ts +2 -1
- package/src/server.ts +29 -6
- package/src/session-archiver.ts +4 -5
- package/src/tools.ts +283 -31
- package/README.md +0 -40
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-release
|
|
3
|
+
description: Release preparation — version bump, changelog, full verification, tagging
|
|
4
|
+
allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*)
|
|
5
|
+
---
|
|
6
|
+
name: massu-release
|
|
7
|
+
|
|
8
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
|
|
9
|
+
|
|
10
|
+
# CS Release: Release Preparation Gate
|
|
11
|
+
|
|
12
|
+
## Objective
|
|
13
|
+
|
|
14
|
+
Prepare a verified release with proper versioning, changelog generation, and tagging. Runs the full verification gate before creating any release artifacts. Does NOT push — waits for user confirmation.
|
|
15
|
+
|
|
16
|
+
**Usage**: `/massu-release` (auto-detect version) or `/massu-release [major|minor|patch]`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## NON-NEGOTIABLE RULES
|
|
21
|
+
|
|
22
|
+
- ALL verification gates MUST pass before version bump
|
|
23
|
+
- Do NOT push to remote (wait for user)
|
|
24
|
+
- Changelog MUST be generated from conventional commits
|
|
25
|
+
- Version MUST follow semver
|
|
26
|
+
- ALL package.json files MUST be updated consistently
|
|
27
|
+
- If ANY gate fails, ABORT with clear reason
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## STEP 1: VERSION DETERMINATION
|
|
32
|
+
|
|
33
|
+
### 1.1 Get Current State
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Current version
|
|
37
|
+
grep '"version"' packages/core/package.json
|
|
38
|
+
|
|
39
|
+
# Last tag
|
|
40
|
+
git describe --tags --abbrev=0 2>/dev/null || echo "no tags"
|
|
41
|
+
|
|
42
|
+
# Commits since last tag
|
|
43
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
44
|
+
if [ -n "$LAST_TAG" ]; then
|
|
45
|
+
git log ${LAST_TAG}..HEAD --oneline
|
|
46
|
+
echo "---"
|
|
47
|
+
echo "Commit count since $LAST_TAG:"
|
|
48
|
+
git log ${LAST_TAG}..HEAD --oneline | wc -l
|
|
49
|
+
else
|
|
50
|
+
git log --oneline | head -20
|
|
51
|
+
echo "---"
|
|
52
|
+
echo "No previous tags found"
|
|
53
|
+
fi
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 1.2 Classify Commits
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Count by type
|
|
60
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
61
|
+
RANGE="${LAST_TAG:+$LAST_TAG..}HEAD"
|
|
62
|
+
|
|
63
|
+
echo "=== Commit Classification ==="
|
|
64
|
+
echo "feat (minor):"
|
|
65
|
+
git log $RANGE --oneline | grep -c '^[a-f0-9]* feat' || echo "0"
|
|
66
|
+
echo "fix (patch):"
|
|
67
|
+
git log $RANGE --oneline | grep -c '^[a-f0-9]* fix' || echo "0"
|
|
68
|
+
echo "BREAKING CHANGE (major):"
|
|
69
|
+
git log $RANGE --format="%B" | grep -c 'BREAKING CHANGE' || echo "0"
|
|
70
|
+
echo "perf:"
|
|
71
|
+
git log $RANGE --oneline | grep -c '^[a-f0-9]* perf' || echo "0"
|
|
72
|
+
echo "refactor:"
|
|
73
|
+
git log $RANGE --oneline | grep -c '^[a-f0-9]* refactor' || echo "0"
|
|
74
|
+
echo "other:"
|
|
75
|
+
git log $RANGE --oneline | grep -vc '^[a-f0-9]* \(feat\|fix\|perf\|refactor\|docs\|test\|chore\|ci\|build\)' || echo "0"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 1.3 Determine Version Bump
|
|
79
|
+
|
|
80
|
+
| Commit Types Present | Auto-Detected Bump |
|
|
81
|
+
|---------------------|-------------------|
|
|
82
|
+
| BREAKING CHANGE | major (X.0.0) |
|
|
83
|
+
| feat | minor (0.X.0) |
|
|
84
|
+
| fix, perf, refactor only | patch (0.0.X) |
|
|
85
|
+
|
|
86
|
+
If `$ARGUMENTS` specifies `major`, `minor`, or `patch`, use that instead of auto-detection.
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
### Version Determination
|
|
90
|
+
- **Current version**: [X.Y.Z]
|
|
91
|
+
- **Last tag**: [tag or none]
|
|
92
|
+
- **Commits since tag**: [N]
|
|
93
|
+
- **Auto-detected bump**: [major/minor/patch]
|
|
94
|
+
- **Proposed version**: [X.Y.Z] -> [A.B.C]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## STEP 2: PRE-RELEASE VERIFICATION
|
|
100
|
+
|
|
101
|
+
Run the full verification gate sequence. If ANY check fails, ABORT the release.
|
|
102
|
+
|
|
103
|
+
### Tier 1: Quick Checks
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# 1.1 Pattern Scanner
|
|
107
|
+
bash scripts/massu-pattern-scanner.sh
|
|
108
|
+
# MUST exit 0
|
|
109
|
+
|
|
110
|
+
# 1.2 TypeScript
|
|
111
|
+
cd packages/core && npx tsc --noEmit
|
|
112
|
+
# MUST show 0 errors
|
|
113
|
+
|
|
114
|
+
# 1.3 Hook Build
|
|
115
|
+
cd packages/core && npm run build:hooks
|
|
116
|
+
# MUST exit 0
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Tier 2: Full Test Suite
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# 2.1 All tests
|
|
123
|
+
npm test
|
|
124
|
+
# MUST exit 0, all tests pass
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# 2.2 Tool registration verification
|
|
129
|
+
grep -c "ToolDefinitions()" packages/core/src/tools.ts
|
|
130
|
+
grep -c "isTool\b\|startsWith" packages/core/src/tools.ts
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Tier 3: Security & Compliance
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# 3.1 npm audit
|
|
137
|
+
npm audit --audit-level=high 2>&1 || true
|
|
138
|
+
|
|
139
|
+
# 3.2 Secrets scan
|
|
140
|
+
grep -rn 'sk-[a-zA-Z0-9]\{20,\}\|password.*=.*["\x27][^"\x27]\{8,\}' --include="*.ts" --include="*.tsx" \
|
|
141
|
+
packages/core/src/ 2>/dev/null \
|
|
142
|
+
| grep -v "process.env\|RegExp\|regex\|REDACT\|redact\|sanitize\|mask\|\.test\.ts:" \
|
|
143
|
+
| wc -l
|
|
144
|
+
# MUST be 0
|
|
145
|
+
|
|
146
|
+
# 3.3 Dependency audit
|
|
147
|
+
npm audit --audit-level=high 2>&1
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Tier 4: Website Build (if website exists)
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
if [ -d "website" ]; then
|
|
154
|
+
cd website && npm run build 2>&1
|
|
155
|
+
# MUST exit 0
|
|
156
|
+
fi
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+
### Pre-Release Verification
|
|
161
|
+
|
|
162
|
+
| Tier | Check | Result | Status |
|
|
163
|
+
|------|-------|--------|--------|
|
|
164
|
+
| 1 | Pattern Scanner | Exit [X] | PASS/FAIL |
|
|
165
|
+
| 1 | TypeScript | [X] errors | PASS/FAIL |
|
|
166
|
+
| 1 | Hook Build | Exit [X] | PASS/FAIL |
|
|
167
|
+
| 2 | Tests | [X]/[X] passed | PASS/FAIL |
|
|
168
|
+
| 2 | Tool Registration | All wired | PASS/FAIL |
|
|
169
|
+
| 3 | npm audit | [X] high/critical | PASS/FAIL |
|
|
170
|
+
| 3 | Secrets scan | [X] found | PASS/FAIL |
|
|
171
|
+
| 4 | Website build | Exit [X] | PASS/FAIL/N/A |
|
|
172
|
+
|
|
173
|
+
**PRE-RELEASE GATE: PASS / FAIL**
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**If ANY check fails**: ABORT with "Release blocked: [specific failure reason]". Do NOT proceed.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## STEP 3: CHANGELOG GENERATION
|
|
181
|
+
|
|
182
|
+
### 3.1 Parse Conventional Commits
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
186
|
+
RANGE="${LAST_TAG:+$LAST_TAG..}HEAD"
|
|
187
|
+
|
|
188
|
+
git log $RANGE --pretty=format:"%H|%s|%an|%ad" --date=short
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 3.2 Group by Type
|
|
192
|
+
|
|
193
|
+
| Commit Type | Changelog Section |
|
|
194
|
+
|-------------|------------------|
|
|
195
|
+
| feat | Added |
|
|
196
|
+
| fix | Fixed |
|
|
197
|
+
| perf | Performance |
|
|
198
|
+
| refactor | Changed |
|
|
199
|
+
| docs | Documentation |
|
|
200
|
+
| test | Tests |
|
|
201
|
+
| build/ci | Build & CI |
|
|
202
|
+
| chore | Maintenance |
|
|
203
|
+
| BREAKING CHANGE | Breaking Changes |
|
|
204
|
+
|
|
205
|
+
### 3.3 Generate Changelog Section
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
## [X.Y.Z] - YYYY-MM-DD
|
|
209
|
+
|
|
210
|
+
### Breaking Changes
|
|
211
|
+
- [breaking changes, if any]
|
|
212
|
+
|
|
213
|
+
### Added
|
|
214
|
+
- [feat commits, stripped of Co-authored-by lines]
|
|
215
|
+
|
|
216
|
+
### Changed
|
|
217
|
+
- [refactor commits]
|
|
218
|
+
|
|
219
|
+
### Fixed
|
|
220
|
+
- [fix commits]
|
|
221
|
+
|
|
222
|
+
### Performance
|
|
223
|
+
- [perf commits]
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Empty sections are omitted.**
|
|
227
|
+
|
|
228
|
+
### 3.4 Update CHANGELOG.md
|
|
229
|
+
|
|
230
|
+
1. Read existing `CHANGELOG.md`
|
|
231
|
+
2. Replace `## [Unreleased]` content with empty section
|
|
232
|
+
3. Insert new version section below `## [Unreleased]`
|
|
233
|
+
4. Preserve all previous released sections unchanged
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## STEP 4: VERSION BUMP
|
|
238
|
+
|
|
239
|
+
### 4.1 Update Package Versions
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Find all package.json files that need version updates
|
|
243
|
+
grep -rn '"version"' packages/*/package.json package.json 2>/dev/null
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Update version in:
|
|
247
|
+
- `packages/core/package.json`
|
|
248
|
+
- `packages/plugin/package.json` (if exists)
|
|
249
|
+
- Root `package.json` (if has version field)
|
|
250
|
+
|
|
251
|
+
### 4.2 Verify Consistency
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# All version fields should now show the new version
|
|
255
|
+
grep '"version"' packages/*/package.json package.json 2>/dev/null
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## STEP 5: RELEASE NOTES DRAFT
|
|
261
|
+
|
|
262
|
+
Generate user-facing release notes:
|
|
263
|
+
|
|
264
|
+
```markdown
|
|
265
|
+
# Release vX.Y.Z
|
|
266
|
+
|
|
267
|
+
## Highlights
|
|
268
|
+
- [Most impactful features/changes — 2-3 bullet points]
|
|
269
|
+
|
|
270
|
+
## Breaking Changes
|
|
271
|
+
- [Breaking changes with migration instructions, if any]
|
|
272
|
+
|
|
273
|
+
## Bug Fixes
|
|
274
|
+
- [Notable bug fixes]
|
|
275
|
+
|
|
276
|
+
## Dependencies
|
|
277
|
+
- [Notable dependency updates, if any]
|
|
278
|
+
|
|
279
|
+
## Full Changelog
|
|
280
|
+
See CHANGELOG.md for the complete list of changes.
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## STEP 6: COMMIT AND TAG
|
|
286
|
+
|
|
287
|
+
### 6.1 Stage Release Files
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
git add CHANGELOG.md
|
|
291
|
+
git add packages/*/package.json
|
|
292
|
+
git add package.json 2>/dev/null || true
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### 6.2 Create Release Commit
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
git commit -m "$(cat <<'EOF'
|
|
299
|
+
chore: release vX.Y.Z
|
|
300
|
+
|
|
301
|
+
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
302
|
+
EOF
|
|
303
|
+
)"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### 6.3 Create Annotated Tag
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
git tag -a vX.Y.Z -m "Release vX.Y.Z"
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### 6.4 Verify
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
# Verify tag was created
|
|
316
|
+
git tag -l 'vX.Y.Z'
|
|
317
|
+
git log -1 --oneline
|
|
318
|
+
git show vX.Y.Z --quiet
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Do NOT push.** Wait for user to review and confirm.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## COMPLETION REPORT
|
|
326
|
+
|
|
327
|
+
```markdown
|
|
328
|
+
## CS RELEASE COMPLETE
|
|
329
|
+
|
|
330
|
+
### Release Summary
|
|
331
|
+
- **Version**: [old] -> [new]
|
|
332
|
+
- **Bump type**: [major/minor/patch]
|
|
333
|
+
- **Commits included**: [N]
|
|
334
|
+
- **Tag**: vX.Y.Z
|
|
335
|
+
|
|
336
|
+
### Pre-Release Verification
|
|
337
|
+
| Tier | Status |
|
|
338
|
+
|------|--------|
|
|
339
|
+
| Tier 1 (patterns, types, hooks) | PASS |
|
|
340
|
+
| Tier 2 (tests, tool registration) | PASS |
|
|
341
|
+
| Tier 3 (security, compliance) | PASS |
|
|
342
|
+
| Tier 4 (website build) | PASS/N/A |
|
|
343
|
+
|
|
344
|
+
### Changelog
|
|
345
|
+
- **Sections updated**: [list]
|
|
346
|
+
- **Breaking changes**: [N]
|
|
347
|
+
- **Features**: [N]
|
|
348
|
+
- **Fixes**: [N]
|
|
349
|
+
|
|
350
|
+
### Files Modified
|
|
351
|
+
- `CHANGELOG.md`
|
|
352
|
+
- `packages/core/package.json`
|
|
353
|
+
- `packages/plugin/package.json` (if exists)
|
|
354
|
+
|
|
355
|
+
### Release Artifacts
|
|
356
|
+
- Commit: [hash]
|
|
357
|
+
- Tag: vX.Y.Z
|
|
358
|
+
|
|
359
|
+
### Next Steps
|
|
360
|
+
- Review the changelog and release notes
|
|
361
|
+
- Push to remote: `git push origin [branch] --follow-tags`
|
|
362
|
+
- Create GitHub release (optional): `gh release create vX.Y.Z --notes-file [notes]`
|
|
363
|
+
```
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-review
|
|
3
|
+
description: Automated code review across 7 dimensions (patterns, security, architecture, website, AI-specific, performance, accessibility)
|
|
4
|
+
allowed-tools: Bash(*), Read(*), Grep(*), Glob(*)
|
|
5
|
+
---
|
|
6
|
+
name: massu-review
|
|
7
|
+
|
|
8
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
|
|
9
|
+
|
|
10
|
+
# CS Review: Automated Code Review
|
|
11
|
+
|
|
12
|
+
## Objective
|
|
13
|
+
|
|
14
|
+
Perform a comprehensive code review across 7 dimensions: pattern compliance, security, architecture, website-specific checks, AI-specific, performance, and accessibility. Accepts a PR number, branch name, or reviews uncommitted changes by default. This is READ-ONLY - no files are modified.
|
|
15
|
+
|
|
16
|
+
**Usage**: `/massu-review` (uncommitted changes) or `/massu-review [PR#|branch]`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## NON-NEGOTIABLE RULES
|
|
21
|
+
|
|
22
|
+
- Do NOT modify any files
|
|
23
|
+
- Do NOT fix any issues found (report only)
|
|
24
|
+
- Review ALL changed files, not just a sample
|
|
25
|
+
- Security findings are ALWAYS reported, even if minor
|
|
26
|
+
- Output structured findings that can be acted on
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## STEP 1: DETERMINE REVIEW SCOPE
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# If argument is a PR number
|
|
34
|
+
gh pr diff $ARGUMENTS 2>/dev/null
|
|
35
|
+
|
|
36
|
+
# If argument is a branch name
|
|
37
|
+
git diff main...$ARGUMENTS 2>/dev/null
|
|
38
|
+
|
|
39
|
+
# If no argument, review uncommitted changes
|
|
40
|
+
git diff HEAD
|
|
41
|
+
git diff --cached
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
### Review Scope
|
|
46
|
+
- **Target**: [PR #N / branch / uncommitted changes]
|
|
47
|
+
- **Files changed**: [N]
|
|
48
|
+
- **Lines added**: [N]
|
|
49
|
+
- **Lines removed**: [N]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## DIMENSION 1: CLAUDE.md PATTERN COMPLIANCE
|
|
55
|
+
|
|
56
|
+
For each changed file in `packages/core/src/`:
|
|
57
|
+
|
|
58
|
+
| Check | What | How |
|
|
59
|
+
|-------|------|-----|
|
|
60
|
+
| ESM imports | No require() | grep for require( |
|
|
61
|
+
| Config access | getConfig() not yaml.parse | grep for yaml.parse |
|
|
62
|
+
| No process.exit | Library code only | grep for process.exit |
|
|
63
|
+
| Tool prefix | Uses p() helper | grep for hardcoded 'massu_' |
|
|
64
|
+
| memDb lifecycle | try/finally pattern | Check memDb usage |
|
|
65
|
+
| ESM exports | No module.exports | grep for module.exports |
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
### Pattern Compliance Findings
|
|
69
|
+
|
|
70
|
+
| File | Check | Status | Details |
|
|
71
|
+
|------|-------|--------|---------|
|
|
72
|
+
| [file] | [check] | PASS/FAIL | [details] |
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## DIMENSION 2: SECURITY REVIEW
|
|
78
|
+
|
|
79
|
+
For ALL changed files:
|
|
80
|
+
|
|
81
|
+
| Check | Pattern | Severity |
|
|
82
|
+
|-------|---------|----------|
|
|
83
|
+
| XSS | innerHTML, dangerouslySetInnerHTML, javascript: URLs | HIGH |
|
|
84
|
+
| Injection | Template literals in SQL, shell commands with user input | CRITICAL |
|
|
85
|
+
| SSRF | Unvalidated URL construction, fetch with user input | HIGH |
|
|
86
|
+
| Secrets | Hardcoded API keys, passwords, tokens | CRITICAL |
|
|
87
|
+
| Auth bypass | Missing auth checks, exposed endpoints | HIGH |
|
|
88
|
+
| Path traversal | User input in file paths without validation | HIGH |
|
|
89
|
+
| Open redirect | Unvalidated redirect URLs | MEDIUM |
|
|
90
|
+
| CSRF | Missing CSRF tokens on state-changing operations | MEDIUM |
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
### Security Findings
|
|
94
|
+
|
|
95
|
+
| File:Line | Severity | Type | Description | Recommendation |
|
|
96
|
+
|-----------|----------|------|-------------|----------------|
|
|
97
|
+
| [loc] | [sev] | [type] | [desc] | [fix] |
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## DIMENSION 3: ARCHITECTURE REVIEW
|
|
103
|
+
|
|
104
|
+
| Check | What | Impact |
|
|
105
|
+
|-------|------|--------|
|
|
106
|
+
| Tool registration | New tools wired into tools.ts | Tools invisible if missing |
|
|
107
|
+
| Hook compilation | New hooks compile with esbuild | Hooks fail silently |
|
|
108
|
+
| Config schema | New config matches interface | Runtime errors |
|
|
109
|
+
| DB access | Correct DB used (CodeGraph/Data/Memory) | Data corruption |
|
|
110
|
+
| Import cycles | No circular dependencies | Build failures |
|
|
111
|
+
| Type safety | No unsafe `as any` casts | Runtime errors |
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
### Architecture Findings
|
|
115
|
+
|
|
116
|
+
| File | Check | Status | Details |
|
|
117
|
+
|------|-------|--------|---------|
|
|
118
|
+
| [file] | [check] | PASS/WARN/FAIL | [details] |
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## DIMENSION 4: WEBSITE-SPECIFIC CHECKS (if website/ files changed)
|
|
124
|
+
|
|
125
|
+
| Check | What | Impact |
|
|
126
|
+
|-------|------|--------|
|
|
127
|
+
| Client/Server boundary | 'use client' / 'use server' directives | Build failures |
|
|
128
|
+
| Env var exposure | NEXT_PUBLIC_ prefix for client-safe vars only | Secret leakage |
|
|
129
|
+
| Supabase RLS | Data access goes through RLS policies | Data leakage |
|
|
130
|
+
| Input validation | User input validated server-side | Injection attacks |
|
|
131
|
+
| Auth middleware | Protected routes use middleware | Auth bypass |
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
### Website-Specific Findings
|
|
135
|
+
|
|
136
|
+
| File | Check | Status | Details |
|
|
137
|
+
|------|-------|--------|---------|
|
|
138
|
+
| [file] | [check] | PASS/WARN/FAIL | [details] |
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## DIMENSION 5: AI-SPECIFIC REVIEW (for changes involving AI/LLM patterns)
|
|
144
|
+
|
|
145
|
+
| Check | What | Impact |
|
|
146
|
+
|-------|------|--------|
|
|
147
|
+
| Prompt injection | User input flowing into system prompts without sanitization | Data exfiltration |
|
|
148
|
+
| Over-privileged tools | Tools with broader permissions than needed | Unauthorized actions |
|
|
149
|
+
| Context window management | Unnecessarily large context stuffing | Cost waste, degraded responses |
|
|
150
|
+
| Cost awareness | Changes that increase API token consumption without justification | Budget overrun |
|
|
151
|
+
| Model selection | Using expensive models (Opus) where cheaper ones (Haiku) suffice | Unnecessary cost |
|
|
152
|
+
| Hallucination guards | Verifying AI outputs before acting on them | Incorrect actions |
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
### AI-Specific Findings
|
|
156
|
+
|
|
157
|
+
| File | Check | Status | Details |
|
|
158
|
+
|------|-------|--------|---------|
|
|
159
|
+
| [file] | [check] | PASS/WARN/FAIL | [details] |
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## DIMENSION 6: PERFORMANCE REVIEW (for all changed files)
|
|
165
|
+
|
|
166
|
+
| Check | What | Impact |
|
|
167
|
+
|-------|------|--------|
|
|
168
|
+
| N+1 queries | Loop containing database query | Slow responses |
|
|
169
|
+
| Unbounded fetches | `.select('*')` without `.limit()` on list endpoints | Memory/performance |
|
|
170
|
+
| Missing pagination | List endpoints without page/per_page parameters | Unbounded data |
|
|
171
|
+
| Bundle impact | New imports of heavy libraries without dynamic import | Slow page load |
|
|
172
|
+
| Missing Suspense/loading | New pages without loading.tsx | Poor UX |
|
|
173
|
+
| Synchronous operations | Blocking calls in request handlers | Request timeouts |
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
### Performance Findings
|
|
177
|
+
|
|
178
|
+
| File | Check | Status | Details |
|
|
179
|
+
|------|-------|--------|---------|
|
|
180
|
+
| [file] | [check] | PASS/WARN/FAIL | [details] |
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## DIMENSION 7: ACCESSIBILITY REVIEW (for website component changes)
|
|
186
|
+
|
|
187
|
+
| Check | What | Impact |
|
|
188
|
+
|-------|------|--------|
|
|
189
|
+
| ARIA labels | Interactive elements without aria-label or aria-labelledby | Screen readers can't identify element |
|
|
190
|
+
| Keyboard navigation | Clickable elements without keyboard handler (onKeyDown) | Keyboard-only users blocked |
|
|
191
|
+
| Color contrast | Text on backgrounds with insufficient contrast (light gray on white) | Low-vision users can't read |
|
|
192
|
+
| Focus management | Modals/dialogs without focus trap | Focus escapes modal |
|
|
193
|
+
| Screen reader | Images without alt text, icons without sr-only labels | Content invisible to screen readers |
|
|
194
|
+
| Semantic HTML | Divs used instead of button/nav/main/section/article | Structure lost for assistive tech |
|
|
195
|
+
|
|
196
|
+
```markdown
|
|
197
|
+
### Accessibility Findings
|
|
198
|
+
|
|
199
|
+
| File | Check | Status | Details |
|
|
200
|
+
|------|-------|--------|---------|
|
|
201
|
+
| [file] | [check] | PASS/WARN/FAIL | [details] |
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## COMPLETION REPORT
|
|
207
|
+
|
|
208
|
+
```markdown
|
|
209
|
+
## CS REVIEW COMPLETE
|
|
210
|
+
|
|
211
|
+
### Review Summary
|
|
212
|
+
- **Scope**: [PR #N / branch / uncommitted]
|
|
213
|
+
- **Files reviewed**: [N]
|
|
214
|
+
|
|
215
|
+
### Findings by Dimension
|
|
216
|
+
|
|
217
|
+
| Dimension | Critical | High | Medium | Low | Total |
|
|
218
|
+
|-----------|----------|------|--------|-----|-------|
|
|
219
|
+
| Pattern Compliance | [N] | [N] | [N] | [N] | [N] |
|
|
220
|
+
| Security | [N] | [N] | [N] | [N] | [N] |
|
|
221
|
+
| Architecture | [N] | [N] | [N] | [N] | [N] |
|
|
222
|
+
| Website | [N] | [N] | [N] | [N] | [N] |
|
|
223
|
+
| AI-Specific | [N] | [N] | [N] | [N] | [N] |
|
|
224
|
+
| Performance | [N] | [N] | [N] | [N] | [N] |
|
|
225
|
+
| Accessibility | [N] | [N] | [N] | [N] | [N] |
|
|
226
|
+
| **Total** | **[N]** | **[N]** | **[N]** | **[N]** | **[N]** |
|
|
227
|
+
|
|
228
|
+
### Verdict: APPROVE / REQUEST CHANGES / BLOCK
|
|
229
|
+
|
|
230
|
+
- **APPROVE**: 0 critical, 0 high findings
|
|
231
|
+
- **REQUEST CHANGES**: 0 critical, 1+ high findings
|
|
232
|
+
- **BLOCK**: 1+ critical findings
|
|
233
|
+
|
|
234
|
+
### Top Priority Fixes
|
|
235
|
+
1. [Most critical finding]
|
|
236
|
+
2. [Second most critical]
|
|
237
|
+
3. [Third most critical]
|
|
238
|
+
```
|