@massu/core 0.1.2 → 0.4.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/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 +12522 -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 -0
- 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,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-push-light
|
|
3
|
+
description: Fast pre-push verification (~90s) - patterns, security, types, hooks, tests, build
|
|
4
|
+
allowed-tools: Bash(*)
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
name: massu-push-light
|
|
8
|
+
|
|
9
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9 enforced.
|
|
10
|
+
|
|
11
|
+
# Massu Push Light: Fast Pre-Push Verification
|
|
12
|
+
|
|
13
|
+
## Objective
|
|
14
|
+
|
|
15
|
+
Run fast verification checks (~90 seconds total) before pushing to catch the most common issues without the overhead of full builds or E2E tests.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## CHECKS TO RUN
|
|
20
|
+
|
|
21
|
+
Execute these checks in order. **STOP on first failure.**
|
|
22
|
+
|
|
23
|
+
### 1. Pattern Scanner (~5s)
|
|
24
|
+
```bash
|
|
25
|
+
bash scripts/massu-pattern-scanner.sh
|
|
26
|
+
```
|
|
27
|
+
**Catches:** Code pattern violations, ESM import issues, config anti-patterns, hardcoded prefixes
|
|
28
|
+
|
|
29
|
+
### 2. Generalization Scanner (~5s)
|
|
30
|
+
```bash
|
|
31
|
+
bash scripts/massu-generalization-scanner.sh
|
|
32
|
+
```
|
|
33
|
+
**Catches:** Hardcoded project names, /Users/ paths, Supabase IDs, API endpoints
|
|
34
|
+
|
|
35
|
+
### 3. Security Scanner (~5s)
|
|
36
|
+
```bash
|
|
37
|
+
bash scripts/massu-security-scanner.sh
|
|
38
|
+
```
|
|
39
|
+
**Catches:** Hardcoded secrets, unsafe patterns, @ts-ignore usage
|
|
40
|
+
|
|
41
|
+
### 4. TypeScript Check (~30s)
|
|
42
|
+
```bash
|
|
43
|
+
cd packages/core && npx tsc --noEmit
|
|
44
|
+
```
|
|
45
|
+
**Catches:** Type errors, missing imports, interface mismatches
|
|
46
|
+
|
|
47
|
+
### 5. Hook Compilation (~5s)
|
|
48
|
+
```bash
|
|
49
|
+
cd packages/core && npm run build:hooks
|
|
50
|
+
```
|
|
51
|
+
**Catches:** Hook compilation failures, invalid imports in hooks
|
|
52
|
+
|
|
53
|
+
### 6. Unit Tests (~30s)
|
|
54
|
+
```bash
|
|
55
|
+
npm test
|
|
56
|
+
```
|
|
57
|
+
**Catches:** Regressions, broken logic, handler errors
|
|
58
|
+
|
|
59
|
+
### 7. Build (~20s)
|
|
60
|
+
```bash
|
|
61
|
+
npm run build
|
|
62
|
+
```
|
|
63
|
+
**Catches:** Build failures, compilation errors
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## EXECUTION
|
|
68
|
+
|
|
69
|
+
Run all checks and report results:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
echo "=============================================="
|
|
73
|
+
echo "MASSU PUSH LIGHT - Fast Pre-Push Verification"
|
|
74
|
+
echo "=============================================="
|
|
75
|
+
echo ""
|
|
76
|
+
|
|
77
|
+
FAILED=0
|
|
78
|
+
|
|
79
|
+
echo "[1/7] Pattern Scanner..."
|
|
80
|
+
if bash scripts/massu-pattern-scanner.sh > /tmp/pattern-scanner.log 2>&1; then
|
|
81
|
+
echo " PASS"
|
|
82
|
+
else
|
|
83
|
+
echo " FAIL - see /tmp/pattern-scanner.log"
|
|
84
|
+
FAILED=1
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
echo "[2/7] Generalization Scanner..."
|
|
88
|
+
if bash scripts/massu-generalization-scanner.sh > /tmp/gen-scanner.log 2>&1; then
|
|
89
|
+
echo " PASS"
|
|
90
|
+
else
|
|
91
|
+
echo " FAIL - see /tmp/gen-scanner.log"
|
|
92
|
+
FAILED=1
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
echo "[3/7] Security Scanner..."
|
|
96
|
+
if bash scripts/massu-security-scanner.sh > /tmp/security-scanner.log 2>&1; then
|
|
97
|
+
echo " PASS"
|
|
98
|
+
else
|
|
99
|
+
echo " FAIL - see /tmp/security-scanner.log"
|
|
100
|
+
FAILED=1
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
echo "[4/7] TypeScript Check..."
|
|
104
|
+
if cd packages/core && npx tsc --noEmit 2>&1; then
|
|
105
|
+
echo " PASS"
|
|
106
|
+
else
|
|
107
|
+
echo " FAIL"
|
|
108
|
+
FAILED=1
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
echo "[5/7] Hook Compilation..."
|
|
112
|
+
if cd packages/core && npm run build:hooks > /dev/null 2>&1; then
|
|
113
|
+
echo " PASS"
|
|
114
|
+
else
|
|
115
|
+
echo " FAIL - Hook compilation error"
|
|
116
|
+
FAILED=1
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
echo "[6/7] Unit Tests..."
|
|
120
|
+
if npm test > /dev/null 2>&1; then
|
|
121
|
+
echo " PASS"
|
|
122
|
+
else
|
|
123
|
+
echo " FAIL - Tests failing"
|
|
124
|
+
FAILED=1
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
echo "[7/7] Build..."
|
|
128
|
+
if npm run build > /dev/null 2>&1; then
|
|
129
|
+
echo " PASS"
|
|
130
|
+
else
|
|
131
|
+
echo " FAIL - Build error"
|
|
132
|
+
FAILED=1
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
echo ""
|
|
136
|
+
echo "=============================================="
|
|
137
|
+
if [ $FAILED -eq 0 ]; then
|
|
138
|
+
echo "ALL CHECKS PASSED - Safe to push"
|
|
139
|
+
echo "=============================================="
|
|
140
|
+
else
|
|
141
|
+
echo "CHECKS FAILED - Fix issues before pushing"
|
|
142
|
+
echo "=============================================="
|
|
143
|
+
exit 1
|
|
144
|
+
fi
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## WHEN TO USE
|
|
150
|
+
|
|
151
|
+
- **Before every `git push`** - Catches ~90% of CI failures
|
|
152
|
+
- **After significant changes** - Quick sanity check
|
|
153
|
+
- **Before creating PR** - Ensure clean state
|
|
154
|
+
|
|
155
|
+
## WHEN TO USE FULL VERIFICATION INSTEAD
|
|
156
|
+
|
|
157
|
+
Use `/massu-push` (full) when:
|
|
158
|
+
- Making config schema changes
|
|
159
|
+
- Modifying tool registration patterns
|
|
160
|
+
- Changing core infrastructure
|
|
161
|
+
- Before major releases
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## WHAT THIS DOESN'T CHECK
|
|
166
|
+
|
|
167
|
+
| Skipped Check | Why | Risk Level |
|
|
168
|
+
|---------------|-----|------------|
|
|
169
|
+
| Full integration tests | Can take 5+ minutes | Medium |
|
|
170
|
+
| Coverage report | Takes extra time | Low |
|
|
171
|
+
| Migration validation | Takes extra time | Low (run for migration changes) |
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## OUTPUT FORMAT
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
==============================================
|
|
179
|
+
MASSU PUSH LIGHT - Fast Pre-Push Verification
|
|
180
|
+
==============================================
|
|
181
|
+
|
|
182
|
+
[1/7] Pattern Scanner... PASS
|
|
183
|
+
[2/7] Generalization Scanner... PASS
|
|
184
|
+
[3/7] Security Scanner... PASS
|
|
185
|
+
[4/7] TypeScript Check... PASS
|
|
186
|
+
[5/7] Hook Compilation... PASS
|
|
187
|
+
[6/7] Unit Tests... PASS
|
|
188
|
+
[7/7] Build... PASS
|
|
189
|
+
|
|
190
|
+
==============================================
|
|
191
|
+
ALL CHECKS PASSED - Safe to push
|
|
192
|
+
==============================================
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## FAILURE RECOVERY
|
|
198
|
+
|
|
199
|
+
| Check Failed | How to Fix |
|
|
200
|
+
|--------------|------------|
|
|
201
|
+
| Pattern Scanner | Run `bash scripts/massu-pattern-scanner.sh` to see details |
|
|
202
|
+
| Generalization Scanner | Run `bash scripts/massu-generalization-scanner.sh` for details |
|
|
203
|
+
| Security Scanner | Run `bash scripts/massu-security-scanner.sh` for details |
|
|
204
|
+
| TypeScript | Run `cd packages/core && npx tsc --noEmit` for full error output |
|
|
205
|
+
| Hook Compilation | Run `cd packages/core && npm run build:hooks` for error details |
|
|
206
|
+
| Unit Tests | Run `npm test` to see failing tests |
|
|
207
|
+
| Build | Run `npm run build` for full error output |
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-push
|
|
3
|
+
description: Full verification gate (all tests, regression detection, security) before remote push
|
|
4
|
+
allowed-tools: Bash(*), Read(*), Edit(*), Grep(*), Glob(*)
|
|
5
|
+
---
|
|
6
|
+
name: massu-push
|
|
7
|
+
|
|
8
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
|
|
9
|
+
|
|
10
|
+
# CS Push: Full Verification Gate Before Remote Push
|
|
11
|
+
|
|
12
|
+
## Workflow Position
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/massu-create-plan -> /massu-plan -> /massu-loop -> /massu-commit -> /massu-push
|
|
16
|
+
(CREATE) (AUDIT) (IMPLEMENT) (COMMIT) (PUSH)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**This command is step 5 of 5 in the standard workflow.**
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Objective
|
|
24
|
+
|
|
25
|
+
Execute COMPREHENSIVE verification including ALL tests and security checks before pushing to remote. This is the final gate - code MUST pass every check before leaving your machine.
|
|
26
|
+
|
|
27
|
+
**Philosophy**: Commit often (quality checks), push verified (full checks + security + regression).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## START NOW
|
|
32
|
+
|
|
33
|
+
**Step 0: Write AUTHORIZED_COMMAND to session state (CR-35)**
|
|
34
|
+
|
|
35
|
+
Update `session-state/CURRENT.md` to include `AUTHORIZED_COMMAND: massu-push`.
|
|
36
|
+
|
|
37
|
+
**Step 0.1: Workflow State Tracking**
|
|
38
|
+
|
|
39
|
+
Write a transition entry to `.massu/workflow-log.md`:
|
|
40
|
+
```
|
|
41
|
+
| [timestamp] | VERIFY | DEPLOY | /massu-push | [session-id] |
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## NON-NEGOTIABLE RULES
|
|
47
|
+
|
|
48
|
+
- **ALL tests must pass** - vitest, full suite
|
|
49
|
+
- **ALL security checks must pass** - npm audit, secrets scan
|
|
50
|
+
- **Zero violations** - Pattern scanner, type check
|
|
51
|
+
- **Do NOT push if ANY check fails**
|
|
52
|
+
- **Document ALL test failures before fixing**
|
|
53
|
+
- **Regression detection MANDATORY** - Compare against main branch
|
|
54
|
+
- **FIX ALL ISSUES ENCOUNTERED (CR-9)** - Pre-existing or not
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## CRITICAL: DUAL VERIFICATION REQUIREMENT
|
|
59
|
+
|
|
60
|
+
**Push completion requires BOTH verification gates to pass.**
|
|
61
|
+
|
|
62
|
+
| Verification | What It Checks | Required for Push |
|
|
63
|
+
|--------------|----------------|-------------------|
|
|
64
|
+
| **Code Quality** | Build, types, patterns, tests pass | YES |
|
|
65
|
+
| **Plan Coverage** | ALL plan items implemented (if from plan) | YES |
|
|
66
|
+
|
|
67
|
+
**Code Quality: PASS + Plan Coverage: FAIL = DO NOT PUSH**
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## CRITICAL: REGRESSION DETECTION
|
|
72
|
+
|
|
73
|
+
**Before pushing, verify no existing tests have regressed.**
|
|
74
|
+
|
|
75
|
+
### Regression Detection Protocol
|
|
76
|
+
|
|
77
|
+
#### Step 1: Establish Baseline
|
|
78
|
+
```bash
|
|
79
|
+
# If on main branch, compare against parent commit instead
|
|
80
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
81
|
+
if [ "$CURRENT_BRANCH" = "main" ]; then
|
|
82
|
+
# Compare against parent commit
|
|
83
|
+
git stash -q 2>/dev/null || true
|
|
84
|
+
git checkout HEAD~1 -q
|
|
85
|
+
npm test 2>&1 | tee /tmp/baseline-tests.txt
|
|
86
|
+
git checkout - -q
|
|
87
|
+
git stash pop -q 2>/dev/null || true
|
|
88
|
+
else
|
|
89
|
+
# Compare against main branch
|
|
90
|
+
git stash -q 2>/dev/null || true
|
|
91
|
+
git checkout main -q
|
|
92
|
+
npm test 2>&1 | tee /tmp/baseline-tests.txt
|
|
93
|
+
git checkout - -q
|
|
94
|
+
git stash pop -q 2>/dev/null || true
|
|
95
|
+
fi
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Step 2: Run Tests on Current Branch
|
|
99
|
+
```bash
|
|
100
|
+
npm test 2>&1 | tee /tmp/current-tests.txt
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Step 3: Compare Results
|
|
104
|
+
```bash
|
|
105
|
+
# Parse vitest output: "Tests N passed (N)" or "Tests N failed | N passed (N)"
|
|
106
|
+
BASELINE_PASS=$(grep -oP 'Tests\s+\K\d+(?=\s+passed)' /tmp/baseline-tests.txt || echo 0)
|
|
107
|
+
BASELINE_FAIL=$(grep -oP '\K\d+(?=\s+failed)' /tmp/baseline-tests.txt || echo 0)
|
|
108
|
+
|
|
109
|
+
CURRENT_PASS=$(grep -oP 'Tests\s+\K\d+(?=\s+passed)' /tmp/current-tests.txt || echo 0)
|
|
110
|
+
CURRENT_FAIL=$(grep -oP '\K\d+(?=\s+failed)' /tmp/current-tests.txt || echo 0)
|
|
111
|
+
|
|
112
|
+
echo "Baseline: $BASELINE_PASS passed, $BASELINE_FAIL failed"
|
|
113
|
+
echo "Current: $CURRENT_PASS passed, $CURRENT_FAIL failed"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Step 4: Gate Decision
|
|
117
|
+
| Scenario | Action |
|
|
118
|
+
|----------|--------|
|
|
119
|
+
| No regressions | PASS - Continue to push |
|
|
120
|
+
| Regressions found | FAIL - Fix before push |
|
|
121
|
+
| New test failures | Investigate - may be new test or bug |
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+
### Regression Detection Report
|
|
125
|
+
|
|
126
|
+
| Metric | Value |
|
|
127
|
+
|--------|-------|
|
|
128
|
+
| Baseline (main) passing tests | [N] |
|
|
129
|
+
| Current branch passing tests | [N] |
|
|
130
|
+
| Regressions (was passing, now failing) | [N] |
|
|
131
|
+
|
|
132
|
+
**REGRESSION GATE: PASS / FAIL**
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## VERIFICATION TIERS
|
|
138
|
+
|
|
139
|
+
### Tier 1: Quick Checks (should already pass from massu-commit)
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# 1.1 Pattern Scanner
|
|
143
|
+
bash scripts/massu-pattern-scanner.sh
|
|
144
|
+
# MUST exit 0
|
|
145
|
+
|
|
146
|
+
# 1.2 TypeScript
|
|
147
|
+
cd packages/core && npx tsc --noEmit
|
|
148
|
+
# MUST show 0 errors
|
|
149
|
+
|
|
150
|
+
# 1.3 Hook Build
|
|
151
|
+
cd packages/core && npm run build:hooks
|
|
152
|
+
# MUST exit 0
|
|
153
|
+
|
|
154
|
+
# 1.4 Generalization Compliance (VR-GENERIC)
|
|
155
|
+
bash scripts/massu-generalization-scanner.sh
|
|
156
|
+
# MUST exit 0
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Gate Check:**
|
|
160
|
+
```markdown
|
|
161
|
+
### Tier 1: Quick Checks
|
|
162
|
+
| Check | Command | Result | Status |
|
|
163
|
+
|-------|---------|--------|--------|
|
|
164
|
+
| Pattern Scanner | massu-pattern-scanner.sh | Exit [X] | PASS/FAIL |
|
|
165
|
+
| TypeScript | tsc --noEmit | [X] errors | PASS/FAIL |
|
|
166
|
+
| Hook Build | build:hooks | Exit [X] | PASS/FAIL |
|
|
167
|
+
| Generalization | massu-generalization-scanner.sh | Exit [X] | PASS/FAIL |
|
|
168
|
+
|
|
169
|
+
**Tier 1 Status: PASS/FAIL**
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### Tier 2: Full Test Suite (CRITICAL)
|
|
175
|
+
|
|
176
|
+
#### 2.0 Regression Detection (MANDATORY FIRST)
|
|
177
|
+
|
|
178
|
+
Run the regression detection protocol above before the full test suite.
|
|
179
|
+
|
|
180
|
+
#### 2.1 All Tests (vitest)
|
|
181
|
+
```bash
|
|
182
|
+
npm test
|
|
183
|
+
# MUST exit 0, all tests pass
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Capture output:
|
|
187
|
+
- Total tests
|
|
188
|
+
- Passed tests
|
|
189
|
+
- Failed tests
|
|
190
|
+
- Skipped tests
|
|
191
|
+
|
|
192
|
+
**If tests fail:**
|
|
193
|
+
1. Document ALL failures
|
|
194
|
+
2. Fix each failure
|
|
195
|
+
3. Re-run ALL tests (not just failed ones)
|
|
196
|
+
|
|
197
|
+
#### 2.2 Tool Registration Verification (if new tools in this push)
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# List new/modified tool files
|
|
201
|
+
git diff origin/main..HEAD --name-only | grep "tools\|tool"
|
|
202
|
+
|
|
203
|
+
# For EACH new tool, verify registration
|
|
204
|
+
grep "getToolDefinitions\|isToolName\|handleToolCall" packages/core/src/tools.ts
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Gate Check:**
|
|
208
|
+
```markdown
|
|
209
|
+
### Tier 2: Test Suite
|
|
210
|
+
| Check | Command | Passed | Failed | Status |
|
|
211
|
+
|-------|---------|--------|--------|--------|
|
|
212
|
+
| Regression Detection | Compare vs main | 0 regressions | 0 | PASS/FAIL |
|
|
213
|
+
| All Tests | npm test | [X]/[Y] | 0 | PASS/FAIL |
|
|
214
|
+
| Tool Registration | grep tools.ts | All registered | 0 | PASS/FAIL |
|
|
215
|
+
|
|
216
|
+
**Tier 2 Status: PASS/FAIL**
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### Tier 3: Security & Compliance
|
|
222
|
+
|
|
223
|
+
#### 3.1 npm Audit
|
|
224
|
+
```bash
|
|
225
|
+
npm audit --audit-level=high
|
|
226
|
+
# MUST have 0 high/critical vulnerabilities
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Vulnerability Handling:**
|
|
230
|
+
- **Critical/High**: MUST fix before push
|
|
231
|
+
- **Moderate**: Document and create ticket
|
|
232
|
+
- **Low**: Informational only
|
|
233
|
+
|
|
234
|
+
#### 3.2 Secrets Scan
|
|
235
|
+
```bash
|
|
236
|
+
# Check for staged secret files
|
|
237
|
+
git diff --cached --name-only | grep -E '\.(env|pem|key|secret)' && echo "FAIL" || echo "PASS"
|
|
238
|
+
|
|
239
|
+
# Check for hardcoded credentials in source
|
|
240
|
+
grep -rn 'sk-[a-zA-Z0-9]\{20,\}\|password.*=.*["\x27][^"\x27]\{8,\}' --include="*.ts" --include="*.tsx" \
|
|
241
|
+
packages/core/src/ 2>/dev/null \
|
|
242
|
+
| grep -v "process.env" \
|
|
243
|
+
| grep -v 'RegExp\|regex\|REDACT\|redact\|sanitize\|mask' \
|
|
244
|
+
| grep -v '\.test\.ts:' \
|
|
245
|
+
| wc -l
|
|
246
|
+
# MUST be 0
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### 3.3 License Compliance (if deps changed)
|
|
250
|
+
```bash
|
|
251
|
+
# Check if package.json or package-lock.json changed
|
|
252
|
+
git diff origin/main..HEAD --name-only | grep -E 'package(-lock)?\.json' && \
|
|
253
|
+
npm audit --audit-level=high 2>&1 || true
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### 3.3 Plan Coverage (if from plan)
|
|
257
|
+
```markdown
|
|
258
|
+
### Plan Coverage Verification
|
|
259
|
+
|
|
260
|
+
| Item # | Description | Status | Proof |
|
|
261
|
+
|--------|-------------|--------|-------|
|
|
262
|
+
| P1-001 | [desc] | DONE | [evidence] |
|
|
263
|
+
| ... | ... | ... | ... |
|
|
264
|
+
|
|
265
|
+
**Coverage: X/X items = 100%**
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Gate Check:**
|
|
269
|
+
```markdown
|
|
270
|
+
### Tier 3: Security & Compliance
|
|
271
|
+
| Check | Command | Result | Status |
|
|
272
|
+
|-------|---------|--------|--------|
|
|
273
|
+
| npm audit | npm audit --audit-level=high | [X] vulns | PASS/FAIL |
|
|
274
|
+
| Secrets Scan | grep check | [X] found | PASS/FAIL |
|
|
275
|
+
| Plan Coverage | item-by-item | [X]/[X] = [X]% | PASS/FAIL |
|
|
276
|
+
|
|
277
|
+
**Tier 3 Status: PASS/FAIL**
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## EXECUTION FLOW
|
|
283
|
+
|
|
284
|
+
### Phase 1: Pre-Flight Verification
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Verify we're on a branch and have commits to push
|
|
288
|
+
git status
|
|
289
|
+
git log origin/main..HEAD --oneline
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
If no commits to push, abort with message.
|
|
293
|
+
|
|
294
|
+
### Phase 2: Run All Tiers
|
|
295
|
+
|
|
296
|
+
Run Tier 1, Tier 2, and Tier 3 in order. Stop at first tier failure.
|
|
297
|
+
|
|
298
|
+
### Phase 3: Final Gate & Push
|
|
299
|
+
|
|
300
|
+
#### All Tiers Must Pass
|
|
301
|
+
|
|
302
|
+
```markdown
|
|
303
|
+
### PUSH GATE SUMMARY
|
|
304
|
+
| Tier | Description | Status |
|
|
305
|
+
|------|-------------|--------|
|
|
306
|
+
| Tier 1 | Quick Checks (patterns, types, hooks) | PASS/FAIL |
|
|
307
|
+
| Tier 2 | Full Test Suite + Regression | PASS/FAIL |
|
|
308
|
+
| Tier 3 | Security & Compliance | PASS/FAIL |
|
|
309
|
+
|
|
310
|
+
### DUAL VERIFICATION GATE
|
|
311
|
+
| Gate | Status | Evidence |
|
|
312
|
+
|------|--------|----------|
|
|
313
|
+
| Code Quality | PASS/FAIL | Tiers 1-3 |
|
|
314
|
+
| Plan Coverage | PASS/FAIL | X/X items (if plan) |
|
|
315
|
+
|
|
316
|
+
**OVERALL: PASS / FAIL**
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### If ALL Pass
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Push to remote
|
|
323
|
+
git push origin [current-branch]
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### If ANY Fail
|
|
327
|
+
|
|
328
|
+
1. **Document ALL failures**
|
|
329
|
+
2. **Fix each failure**
|
|
330
|
+
3. **Re-run ENTIRE verification** (not just failed tiers)
|
|
331
|
+
4. **Do NOT push until all tiers pass**
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## TIMING EXPECTATIONS
|
|
336
|
+
|
|
337
|
+
| Phase | Typical Duration |
|
|
338
|
+
|-------|------------------|
|
|
339
|
+
| Tier 1 (Quick) | ~30 seconds |
|
|
340
|
+
| Tier 2 (Tests + Regression) | ~1-2 minutes |
|
|
341
|
+
| Tier 3 (Security) | ~30 seconds |
|
|
342
|
+
| Total | ~2-3 minutes |
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## ABORT CONDITIONS
|
|
347
|
+
|
|
348
|
+
Immediately abort and report if:
|
|
349
|
+
- Secrets detected in codebase
|
|
350
|
+
- More than 10% of tests failing (indicates systemic issue)
|
|
351
|
+
- Any HIGH/CRITICAL npm vulnerability with no fix available
|
|
352
|
+
|
|
353
|
+
```markdown
|
|
354
|
+
## PUSH ABORTED
|
|
355
|
+
|
|
356
|
+
### Reason
|
|
357
|
+
[SECURITY | TEST_FAILURE | OTHER]
|
|
358
|
+
|
|
359
|
+
### Details
|
|
360
|
+
[Specific issue]
|
|
361
|
+
|
|
362
|
+
### Required Action
|
|
363
|
+
[Steps to resolve]
|
|
364
|
+
|
|
365
|
+
### Do NOT Attempt Push Until Resolved
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## MANDATORY: PLAN DOCUMENT UPDATE (If Push Completes Plan)
|
|
371
|
+
|
|
372
|
+
**If this push completes work from a plan document, the plan MUST be updated.**
|
|
373
|
+
|
|
374
|
+
Before push is considered complete:
|
|
375
|
+
- [ ] Plan document has IMPLEMENTATION STATUS at TOP
|
|
376
|
+
- [ ] All completed items marked with status
|
|
377
|
+
- [ ] Verification evidence recorded
|
|
378
|
+
- [ ] Push commit hash recorded in plan
|
|
379
|
+
|
|
380
|
+
```markdown
|
|
381
|
+
# IMPLEMENTATION STATUS
|
|
382
|
+
|
|
383
|
+
**Plan**: [Plan Name]
|
|
384
|
+
**Status**: COMPLETE - PUSHED
|
|
385
|
+
**Last Updated**: [YYYY-MM-DD HH:MM]
|
|
386
|
+
**Push Commit**: [commit hash]
|
|
387
|
+
|
|
388
|
+
## Final Verification
|
|
389
|
+
|
|
390
|
+
| Check | Result | Status |
|
|
391
|
+
|-------|--------|--------|
|
|
392
|
+
| Pattern Scanner | Exit 0 | PASS |
|
|
393
|
+
| Type Check | 0 errors | PASS |
|
|
394
|
+
| Tests | All pass | PASS |
|
|
395
|
+
| Push | Successful | PASS |
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## AUTO-LEARNING PROTOCOL
|
|
401
|
+
|
|
402
|
+
After pushing, if any issues were fixed during this verification:
|
|
403
|
+
|
|
404
|
+
1. **Record the pattern** - What went wrong and how it was fixed
|
|
405
|
+
2. **Check if pattern scanner should be updated**
|
|
406
|
+
3. **Update session state**
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## COMPLETION REPORT
|
|
411
|
+
|
|
412
|
+
```markdown
|
|
413
|
+
## CS PUSH COMPLETE
|
|
414
|
+
|
|
415
|
+
### Push Details
|
|
416
|
+
- **Branch**: [branch]
|
|
417
|
+
- **Commits**: [count]
|
|
418
|
+
- **Remote**: origin/[branch]
|
|
419
|
+
|
|
420
|
+
### Verification Summary
|
|
421
|
+
| Tier | Checks | Status |
|
|
422
|
+
|------|--------|--------|
|
|
423
|
+
| Tier 1 | Patterns, Types, Hooks | PASS |
|
|
424
|
+
| Tier 2 | Tests ([X] passed), Regression (0) | PASS |
|
|
425
|
+
| Tier 3 | npm audit (0 high/critical), Secrets (0) | PASS |
|
|
426
|
+
|
|
427
|
+
### Dual Verification
|
|
428
|
+
| Gate | Status |
|
|
429
|
+
|------|--------|
|
|
430
|
+
| Code Quality | PASS |
|
|
431
|
+
| Plan Coverage | PASS (X/X = 100%) |
|
|
432
|
+
|
|
433
|
+
**Push succeeded.**
|
|
434
|
+
```
|