@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.
Files changed (84) hide show
  1. package/commands/_shared-preamble.md +76 -0
  2. package/commands/massu-audit-deps.md +211 -0
  3. package/commands/massu-changelog.md +174 -0
  4. package/commands/massu-cleanup.md +315 -0
  5. package/commands/massu-commit.md +481 -0
  6. package/commands/massu-create-plan.md +752 -0
  7. package/commands/massu-dead-code.md +131 -0
  8. package/commands/massu-debug.md +484 -0
  9. package/commands/massu-deploy.md +91 -0
  10. package/commands/massu-deps.md +374 -0
  11. package/commands/massu-doc-gen.md +279 -0
  12. package/commands/massu-docs.md +364 -0
  13. package/commands/massu-estimate.md +313 -0
  14. package/commands/massu-golden-path.md +973 -0
  15. package/commands/massu-guide.md +167 -0
  16. package/commands/massu-hotfix.md +480 -0
  17. package/commands/massu-loop-playwright.md +837 -0
  18. package/commands/massu-loop.md +775 -0
  19. package/commands/massu-new-feature.md +511 -0
  20. package/commands/massu-parity.md +214 -0
  21. package/commands/massu-plan.md +456 -0
  22. package/commands/massu-push-light.md +207 -0
  23. package/commands/massu-push.md +434 -0
  24. package/commands/massu-refactor.md +410 -0
  25. package/commands/massu-release.md +363 -0
  26. package/commands/massu-review.md +238 -0
  27. package/commands/massu-simplify.md +281 -0
  28. package/commands/massu-status.md +278 -0
  29. package/commands/massu-tdd.md +201 -0
  30. package/commands/massu-test.md +516 -0
  31. package/commands/massu-verify-playwright.md +281 -0
  32. package/commands/massu-verify.md +667 -0
  33. package/dist/cli.js +12521 -0
  34. package/dist/hooks/cost-tracker.js +80 -5
  35. package/dist/hooks/post-edit-context.js +72 -6
  36. package/dist/hooks/post-tool-use.js +234 -57
  37. package/dist/hooks/pre-compact.js +144 -5
  38. package/dist/hooks/pre-delete-check.js +141 -11
  39. package/dist/hooks/quality-event.js +80 -5
  40. package/dist/hooks/security-gate.js +29 -0
  41. package/dist/hooks/session-end.js +83 -8
  42. package/dist/hooks/session-start.js +153 -7
  43. package/dist/hooks/user-prompt.js +166 -5
  44. package/package.json +6 -5
  45. package/src/backfill-sessions.ts +5 -4
  46. package/src/cli.ts +6 -1
  47. package/src/commands/doctor.ts +193 -6
  48. package/src/commands/init.ts +235 -6
  49. package/src/commands/install-commands.ts +137 -0
  50. package/src/config.ts +68 -2
  51. package/src/db.ts +115 -2
  52. package/src/docs-tools.ts +8 -6
  53. package/src/hooks/post-edit-context.ts +1 -1
  54. package/src/hooks/post-tool-use.ts +130 -0
  55. package/src/hooks/pre-compact.ts +23 -1
  56. package/src/hooks/pre-delete-check.ts +92 -4
  57. package/src/hooks/security-gate.ts +32 -0
  58. package/src/hooks/session-start.ts +97 -4
  59. package/src/hooks/user-prompt.ts +46 -1
  60. package/src/import-resolver.ts +2 -1
  61. package/src/knowledge-db.ts +169 -0
  62. package/src/knowledge-indexer.ts +704 -0
  63. package/src/knowledge-tools.ts +1413 -0
  64. package/src/license.ts +482 -0
  65. package/src/memory-db.ts +14 -1
  66. package/src/observation-extractor.ts +11 -4
  67. package/src/page-deps.ts +3 -2
  68. package/src/python/coupling-detector.ts +124 -0
  69. package/src/python/domain-enforcer.ts +83 -0
  70. package/src/python/impact-analyzer.ts +95 -0
  71. package/src/python/import-parser.ts +244 -0
  72. package/src/python/import-resolver.ts +135 -0
  73. package/src/python/migration-indexer.ts +115 -0
  74. package/src/python/migration-parser.ts +332 -0
  75. package/src/python/model-indexer.ts +70 -0
  76. package/src/python/model-parser.ts +279 -0
  77. package/src/python/route-indexer.ts +58 -0
  78. package/src/python/route-parser.ts +317 -0
  79. package/src/python-tools.ts +629 -0
  80. package/src/sentinel-db.ts +2 -1
  81. package/src/server.ts +29 -6
  82. package/src/session-archiver.ts +4 -5
  83. package/src/tools.ts +283 -31
  84. package/README.md +0 -40
@@ -0,0 +1,374 @@
1
+ ---
2
+ name: massu-deps
3
+ description: Dependency audit covering security vulnerabilities, updates, and compatibility analysis
4
+ allowed-tools: Bash(*), Read(*), Grep(*), Glob(*)
5
+ ---
6
+ name: massu-deps
7
+
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9 enforced.
9
+
10
+ # Massu Deps: Dependency Audit Protocol
11
+
12
+ ## Objective
13
+
14
+ Audit project dependencies for **security vulnerabilities**, outdated packages, and compatibility issues. Maintain a healthy, secure dependency tree.
15
+
16
+ ---
17
+
18
+ ## NON-NEGOTIABLE RULES
19
+
20
+ - **Security first** - Critical/high vulnerabilities block deployment
21
+ - **Compatibility check** - Verify updates don't break build
22
+ - **Incremental updates** - Don't update everything at once
23
+ - **Test after updates** - Build and type check required
24
+ - **Document changes** - Track what was updated and why
25
+
26
+ ---
27
+
28
+ ## ZERO-GAP AUDIT LOOP
29
+
30
+ **Dependency updates do NOT complete until a SINGLE COMPLETE AUDIT finds ZERO issues.**
31
+
32
+ ### The Rule
33
+
34
+ ```
35
+ DEPENDENCY AUDIT LOOP:
36
+ 1. Run ALL security and compatibility checks
37
+ 2. Count vulnerabilities and issues found
38
+ 3. IF issues > 0:
39
+ - Fix/update to address issues
40
+ - Re-run ENTIRE audit from Step 1
41
+ 4. IF issues == 0:
42
+ - DEPENDENCIES VERIFIED
43
+ ```
44
+
45
+ ### Completion Requirement
46
+
47
+ | Scenario | Action |
48
+ |----------|--------|
49
+ | Audit finds 3 vulnerabilities | Fix all 3, re-run ENTIRE audit |
50
+ | Update breaks build | Fix compatibility, re-run ENTIRE audit |
51
+ | Re-audit finds 0 issues | **NOW** dependencies verified |
52
+
53
+ **Partial re-checks are NOT valid. The ENTIRE dependency audit must pass in a SINGLE run.**
54
+
55
+ ---
56
+
57
+ ## AUDIT SECTION 1: SECURITY VULNERABILITIES
58
+
59
+ ### 1.1 npm Audit (Root)
60
+ ```bash
61
+ # Run full audit from root
62
+ npm audit
63
+
64
+ # Check for critical/high only
65
+ npm audit --audit-level=high
66
+
67
+ # Check packages/core specifically
68
+ cd packages/core && npm audit
69
+ ```
70
+
71
+ ### 1.2 npm Audit (Website, if applicable)
72
+ ```bash
73
+ # Website dependencies
74
+ cd website && npm audit 2>/dev/null || echo "No website package"
75
+ ```
76
+
77
+ ### 1.3 Vulnerability Matrix
78
+ ```markdown
79
+ ### Security Vulnerabilities
80
+
81
+ | Package | Location | Severity | Vulnerability | Fix Available | Action |
82
+ |---------|----------|----------|---------------|---------------|--------|
83
+ | [pkg] | core | CRITICAL | [CVE-XXXX] | YES/NO | UPDATE/REPLACE |
84
+ | [pkg] | website | HIGH | [CVE-XXXX] | YES/NO | UPDATE/REPLACE |
85
+ ```
86
+
87
+ ### 1.4 Auto-fix (If Safe)
88
+ ```bash
89
+ # Attempt automatic fix
90
+ npm audit fix
91
+
92
+ # Force fix (may have breaking changes - REVIEW FIRST)
93
+ npm audit fix --force --dry-run # Preview
94
+ ```
95
+
96
+ ---
97
+
98
+ ## AUDIT SECTION 2: OUTDATED PACKAGES
99
+
100
+ ### 2.1 Check Outdated
101
+ ```bash
102
+ # Root outdated
103
+ npm outdated
104
+
105
+ # Core package outdated
106
+ cd packages/core && npm outdated
107
+
108
+ # Website outdated (if applicable)
109
+ cd website && npm outdated 2>/dev/null
110
+ ```
111
+
112
+ ### 2.2 Outdated Matrix
113
+ ```markdown
114
+ ### Outdated Packages
115
+
116
+ | Package | Current | Wanted | Latest | Location | Action |
117
+ |---------|---------|--------|--------|----------|--------|
118
+ | [pkg] | 1.0.0 | 1.0.5 | 2.0.0 | core | PATCH |
119
+ | [pkg] | 2.1.0 | 2.1.0 | 3.0.0 | website | REVIEW |
120
+ ```
121
+
122
+ ### 2.3 Update Priority
123
+ | Priority | Definition | Criteria |
124
+ |----------|------------|----------|
125
+ | **P0** | Security fix | Has vulnerability fix |
126
+ | **P1** | Bug fix | Patch version, bug fixes |
127
+ | **P2** | Minor update | New features, backward compatible |
128
+ | **P3** | Major update | Breaking changes, needs migration |
129
+
130
+ ---
131
+
132
+ ## AUDIT SECTION 3: DEPENDENCY ANALYSIS
133
+
134
+ ### 3.1 Dependency Tree
135
+ ```bash
136
+ # Full tree
137
+ npm ls --depth=2
138
+
139
+ # Find specific package
140
+ npm ls [package-name]
141
+
142
+ # Why is package installed?
143
+ npm why [package-name]
144
+ ```
145
+
146
+ ### 3.2 Duplicate Detection
147
+ ```bash
148
+ # Find duplicates
149
+ npm dedupe --dry-run
150
+ ```
151
+
152
+ ### 3.3 Unused Dependencies
153
+ ```bash
154
+ # Find potentially unused (packages/core)
155
+ npx depcheck packages/core
156
+
157
+ # Verify no phantom MCP SDK references (should be 0 — raw JSON-RPC 2.0)
158
+ grep -rn "@modelcontextprotocol/sdk" packages/core/src/ --include="*.ts" | wc -l
159
+
160
+ # Check better-sqlite3 usage
161
+ grep -rn "better-sqlite3\|Database" packages/core/src/ --include="*.ts" | wc -l
162
+ ```
163
+
164
+ ### 3.4 Dependency Matrix
165
+ ```markdown
166
+ ### Dependency Analysis
167
+
168
+ | Package | Direct | Versions | Used | Action |
169
+ |---------|--------|----------|------|--------|
170
+ | [pkg] | YES | 1 | YES | KEEP |
171
+ | [pkg] | NO | 2 | - | DEDUPE |
172
+ | [pkg] | YES | 1 | NO | REMOVE |
173
+ ```
174
+
175
+ ---
176
+
177
+ ## AUDIT SECTION 4: COMPATIBILITY CHECK
178
+
179
+ ### 4.1 Peer Dependencies
180
+ ```bash
181
+ # Check peer dependency warnings
182
+ npm ls 2>&1 | grep -i "peer dep\|WARN"
183
+ ```
184
+
185
+ ### 4.2 Engine Compatibility
186
+ ```bash
187
+ # Check Node.js version requirement
188
+ grep -A 5 '"engines"' packages/core/package.json
189
+
190
+ # Current Node.js version
191
+ node --version
192
+ ```
193
+
194
+ ### 4.3 TypeScript Compatibility
195
+ ```bash
196
+ # Verify TypeScript version
197
+ npx tsc --version
198
+
199
+ # Check for type definition updates
200
+ npm outdated | grep @types
201
+ ```
202
+
203
+ ---
204
+
205
+ ## AUDIT SECTION 5: UPDATE PROCESS
206
+
207
+ ### 5.1 Safe Update Order
208
+ 1. **Dev dependencies first** (lower risk)
209
+ 2. **Patch updates** (bug fixes only)
210
+ 3. **Minor updates** (backward compatible)
211
+ 4. **Major updates** (one at a time, test thoroughly)
212
+
213
+ ### 5.2 Post-Update Verification
214
+ ```bash
215
+ # After EACH update:
216
+
217
+ # 1. Type check
218
+ cd packages/core && npx tsc --noEmit
219
+
220
+ # 2. Build (includes hook compilation)
221
+ npm run build
222
+
223
+ # 3. Test
224
+ npm test
225
+
226
+ # 4. Pattern scanner
227
+ bash scripts/massu-pattern-scanner.sh
228
+
229
+ # 5. Security scanner
230
+ bash scripts/massu-security-scanner.sh
231
+ ```
232
+
233
+ ### 5.3 Update Checklist
234
+ ```markdown
235
+ ### Package Update: [PACKAGE_NAME]
236
+
237
+ - [ ] Reviewed changelog for breaking changes
238
+ - [ ] Updated package: `npm install [pkg]@[version]`
239
+ - [ ] Type check passes
240
+ - [ ] Build passes
241
+ - [ ] Tests pass
242
+ - [ ] Pattern scanner passes
243
+ ```
244
+
245
+ ---
246
+
247
+ ## AUDIT SECTION 6: LOCK FILE INTEGRITY
248
+
249
+ ### 6.1 Lock File Check
250
+ ```bash
251
+ # Verify lock file integrity
252
+ npm ci
253
+
254
+ # If issues, regenerate
255
+ rm -rf node_modules package-lock.json
256
+ npm install
257
+ ```
258
+
259
+ ---
260
+
261
+ ## DEPENDENCY REPORT FORMAT
262
+
263
+ ```markdown
264
+ ## MASSU DEPS AUDIT REPORT
265
+
266
+ ### Summary
267
+ - **Date**: [timestamp]
268
+ - **Total packages**: [N]
269
+ - **Direct dependencies**: [N]
270
+ - **Dev dependencies**: [N]
271
+
272
+ ### Security Status
273
+ | Severity | Count | Action Required |
274
+ |----------|-------|-----------------|
275
+ | Critical | 0 | IMMEDIATE |
276
+ | High | 0 | ASAP |
277
+ | Moderate | 0 | PLANNED |
278
+ | Low | 0 | DEFER |
279
+
280
+ **Security Status: PASS / BLOCKED**
281
+
282
+ ### Outdated Packages
283
+ | Priority | Count | Packages |
284
+ |----------|-------|----------|
285
+ | P0 Security | 0 | [list] |
286
+ | P1 Patches | N | [list] |
287
+ | P2 Minor | N | [list] |
288
+ | P3 Major | N | [list] |
289
+
290
+ ### Updates Applied
291
+ | Package | From | To | Breaking | Status |
292
+ |---------|------|----|---------| -------|
293
+ | [pkg] | X.X.X | Y.Y.Y | NO | PASS |
294
+
295
+ ### Verification
296
+ | Check | Result |
297
+ |-------|--------|
298
+ | npm audit | PASS |
299
+ | Type check | PASS |
300
+ | Build | PASS |
301
+ | Tests | PASS |
302
+ | Pattern scanner | PASS |
303
+
304
+ ### Recommendations
305
+ 1. [Recommendation 1]
306
+ 2. [Recommendation 2]
307
+
308
+ **DEPENDENCY HEALTH: GOOD / NEEDS ATTENTION / CRITICAL**
309
+ ```
310
+
311
+ ---
312
+
313
+ ## SESSION STATE UPDATE
314
+
315
+ After audit, update `session-state/CURRENT.md`:
316
+
317
+ ```markdown
318
+ ## DEPS AUDIT SESSION
319
+
320
+ ### Audit
321
+ - **Date**: [timestamp]
322
+ - **Type**: Security / Full
323
+
324
+ ### Findings
325
+ - Critical vulnerabilities: [N]
326
+ - Outdated packages: [N]
327
+ - Unused packages: [N]
328
+
329
+ ### Updates Applied
330
+ - [package]: X.X.X -> Y.Y.Y
331
+
332
+ ### Status
333
+ - All checks passing: YES/NO
334
+ ```
335
+
336
+ ---
337
+
338
+ ## QUICK COMMANDS
339
+
340
+ ```bash
341
+ # Quick security check
342
+ npm audit --audit-level=high
343
+
344
+ # Quick outdated check
345
+ npm outdated
346
+
347
+ # Update all patches (safe)
348
+ npm update
349
+
350
+ # Fix vulnerabilities (safe)
351
+ npm audit fix
352
+
353
+ # Full clean install
354
+ rm -rf node_modules package-lock.json && npm install
355
+
356
+ # Check for duplicates
357
+ npm dedupe --dry-run
358
+ ```
359
+
360
+ ---
361
+
362
+ ## START NOW
363
+
364
+ 1. Run npm audit for security
365
+ 2. Run npm outdated for updates
366
+ 3. Analyze dependency tree
367
+ 4. Check for duplicates and unused
368
+ 5. Plan update order (security first)
369
+ 6. Apply updates incrementally
370
+ 7. Verify after each update
371
+ 8. Produce dependency report
372
+ 9. Update session state
373
+
374
+ **Remember: Security first, one update at a time, verify after each.**
@@ -0,0 +1,279 @@
1
+ ---
2
+ name: massu-doc-gen
3
+ description: Generate JSDoc comments, README sections, and API docs for undocumented code
4
+ allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*)
5
+ ---
6
+ name: massu-doc-gen
7
+
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
9
+
10
+ # CS Doc Gen: Documentation Generation
11
+
12
+ ## Objective
13
+
14
+ Scan the codebase for undocumented functions, modules, and exported types, then generate accurate JSDoc comments, README sections, and API reference docs. Only documentation is added — no logic is modified.
15
+
16
+ **Usage**: `/massu-doc-gen` (full scan) or `/massu-doc-gen [area]` (focused: jsdoc, readme, api, config)
17
+
18
+ ---
19
+
20
+ ## NON-NEGOTIABLE RULES
21
+
22
+ - **Documentation ONLY** — never change logic, only add or update comments and docs
23
+ - **Accuracy over completeness** — only document what the code actually does; never invent behavior
24
+ - **FIX ALL ISSUES ENCOUNTERED (CR-9)** — incorrect existing docs found during scan MUST be corrected
25
+ - **Run type check after every file** — JSDoc tags must not introduce TS errors
26
+ - **Read before writing** — always read the full function before writing its doc
27
+
28
+ ---
29
+
30
+ ## STEP 1: INVENTORY
31
+
32
+ Enumerate all documentation gaps across the codebase.
33
+
34
+ ### 1a. Undocumented Functions (packages/core)
35
+
36
+ ```bash
37
+ # Functions and methods without a preceding JSDoc block
38
+ grep -n "^export function\|^export async function\|^ [a-zA-Z].*): " \
39
+ packages/core/src/*.ts | grep -v "__tests__" | while IFS=: read file line content; do
40
+ # Check if line above is */ (end of JSDoc)
41
+ prev=$((line - 1))
42
+ preceding=$(sed -n "${prev}p" "$file" 2>/dev/null)
43
+ if [[ "$preceding" != *"*/"* && "$preceding" != *"// "* ]]; then
44
+ echo "UNDOCUMENTED: $file:$line $content"
45
+ fi
46
+ done
47
+ ```
48
+
49
+ ### 1b. Exported Types Without Description
50
+
51
+ ```bash
52
+ # Exported interfaces and types without a preceding JSDoc
53
+ grep -n "^export interface\|^export type\|^export enum" \
54
+ packages/core/src/*.ts | grep -v "__tests__"
55
+ ```
56
+
57
+ ### 1c. Module-Level Doc Coverage
58
+
59
+ ```bash
60
+ # Source modules without a top-of-file comment block
61
+ for f in packages/core/src/*.ts; do
62
+ first_line=$(head -1 "$f")
63
+ if [[ "$first_line" != "/**"* && "$first_line" != "//"* ]]; then
64
+ echo "NO MODULE DOC: $f"
65
+ fi
66
+ done
67
+ ```
68
+
69
+ ### 1d. Config Schema Coverage
70
+
71
+ ```bash
72
+ # Config fields without description in massu.config.yaml
73
+ cat massu.config.yaml 2>/dev/null | head -80
74
+ ```
75
+
76
+ ### 1e. Package Modules Without JSDoc
77
+
78
+ ```bash
79
+ # Package modules without JSDoc exports
80
+ for f in packages/core/src/*.ts; do
81
+ if ! grep -q "@description\|/\*\*" "$f"; then
82
+ echo "NO JSDOC: $f"
83
+ fi
84
+ done
85
+ ```
86
+
87
+ ---
88
+
89
+ ## STEP 2: ANALYSIS
90
+
91
+ For each undocumented item, read the source and classify the documentation needed:
92
+
93
+ ```markdown
94
+ ### Documentation Inventory
95
+
96
+ | File | Item | Type | Priority | Action |
97
+ |------|------|------|----------|--------|
98
+ | [file] | [name] | function/type/module/endpoint | HIGH/MED/LOW | ADD_JSDOC/ADD_COMMENT/UPDATE_DOC |
99
+ ```
100
+
101
+ **Priority Rules:**
102
+ - HIGH: exported functions/types used by tools.ts or server.ts
103
+ - MED: internal utilities with complex behavior
104
+ - LOW: simple pass-through wrappers
105
+
106
+ ---
107
+
108
+ ## STEP 3: GENERATION
109
+
110
+ Apply documentation in order of priority. Read the entire function/type before writing docs.
111
+
112
+ ### JSDoc Pattern for Functions
113
+
114
+ ```typescript
115
+ /**
116
+ * Brief one-line description of what this function does.
117
+ *
118
+ * @param paramName - Description of the parameter
119
+ * @param anotherParam - Description with type context
120
+ * @returns Description of the return value
121
+ * @throws Description of error conditions, if any
122
+ *
123
+ * @example
124
+ * const result = doSomething('input', { option: true });
125
+ */
126
+ export function doSomething(paramName: string, anotherParam: Options): Result {
127
+ ```
128
+
129
+ ### JSDoc Pattern for Types / Interfaces
130
+
131
+ ```typescript
132
+ /**
133
+ * Brief description of what this type represents.
134
+ * Include usage context if non-obvious.
135
+ */
136
+ export interface MyType {
137
+ /** Description of this field */
138
+ fieldName: string;
139
+ /** Description, including valid values if enum-like */
140
+ status: 'active' | 'inactive';
141
+ }
142
+ ```
143
+
144
+ ### Module-Level Comment Pattern
145
+
146
+ ```typescript
147
+ /**
148
+ * [module-name] — One-sentence description of module purpose.
149
+ *
150
+ * Responsibilities:
151
+ * - [Responsibility 1]
152
+ * - [Responsibility 2]
153
+ *
154
+ * @module [module-name]
155
+ */
156
+ ```
157
+
158
+ ### After Each File
159
+
160
+ ```bash
161
+ # Verify no TypeScript errors introduced
162
+ cd packages/core && npx tsc --noEmit 2>&1
163
+ # MUST show same or fewer errors than baseline
164
+ ```
165
+
166
+ ---
167
+
168
+ ## STEP 4: README / API REFERENCE
169
+
170
+ If `$ARGUMENTS` includes `readme` or `api`, generate structured docs:
171
+
172
+ ### README Section Template
173
+
174
+ ```markdown
175
+ ## [Module Name]
176
+
177
+ [One-paragraph description of purpose and responsibilities.]
178
+
179
+ ### Exported Functions
180
+
181
+ | Function | Parameters | Returns | Description |
182
+ |----------|------------|---------|-------------|
183
+ | `functionName(param)` | `param: Type` | `ReturnType` | Brief description |
184
+
185
+ ### Configuration
186
+
187
+ | Key | Type | Default | Description |
188
+ |-----|------|---------|-------------|
189
+ | `configKey` | `string` | `"default"` | What this controls |
190
+
191
+ ### Example
192
+
193
+ \`\`\`typescript
194
+ import { functionName } from './module-name.ts';
195
+ const result = functionName('input');
196
+ \`\`\`
197
+ ```
198
+
199
+ ### Config Schema Annotation
200
+
201
+ For `massu.config.yaml`, add inline comments for undocumented fields:
202
+
203
+ ```yaml
204
+ # Brief description of this section
205
+ sectionName:
206
+ # Description of this field. Valid values: foo | bar | baz. Default: foo.
207
+ fieldName: value
208
+ ```
209
+
210
+ ---
211
+
212
+ ## STEP 5: VERIFICATION
213
+
214
+ ### Gate 1: Type Check (VR-TYPE)
215
+ ```bash
216
+ cd packages/core && npx tsc --noEmit
217
+ # MUST show 0 errors (or <= baseline before docs were added)
218
+ ```
219
+
220
+ ### Gate 2: Pattern Scanner (VR-PATTERN)
221
+ ```bash
222
+ bash scripts/massu-pattern-scanner.sh
223
+ # MUST exit 0
224
+ ```
225
+
226
+ ### Gate 3: All Tests (VR-TEST)
227
+ ```bash
228
+ npm test
229
+ # Documentation changes MUST NOT affect test results
230
+ ```
231
+
232
+ ---
233
+
234
+ ## COMPLETION REPORT
235
+
236
+ ```markdown
237
+ ## CS DOC GEN COMPLETE
238
+
239
+ ### Coverage Summary
240
+
241
+ | Category | Before | After | Added |
242
+ |----------|--------|-------|-------|
243
+ | Documented functions | [N] | [N] | [+N] |
244
+ | Documented types/interfaces | [N] | [N] | [+N] |
245
+ | Modules with module-level doc | [N] | [N] | [+N] |
246
+ | API endpoints with description | [N] | [N] | [+N] |
247
+ | Config fields with annotation | [N] | [N] | [+N] |
248
+
249
+ ### Files Modified
250
+
251
+ | File | Items Documented |
252
+ |------|-----------------|
253
+ | [file] | [list of items] |
254
+
255
+ ### Verification Gates
256
+ | Gate | Status |
257
+ |------|--------|
258
+ | Type Safety | PASS (no new errors introduced) |
259
+ | Pattern Scanner | PASS |
260
+ | Tests | PASS ([N] passed, unchanged) |
261
+
262
+ ### Corrections Made (CR-9)
263
+ | File | Issue | Fix Applied |
264
+ |------|-------|------------|
265
+ | [file] | [incorrect doc] | [correction] |
266
+
267
+ ### Next Steps
268
+ - Review changes: `git diff`
269
+ - Commit: `/massu-commit`
270
+ ```
271
+
272
+ ---
273
+
274
+ ## AUTO-LEARNING
275
+
276
+ After generating documentation, record the pattern:
277
+ 1. Note what documentation was needed and why
278
+ 2. Update session state with files generated
279
+ 3. If a documentation gap pattern is discovered, note it for future reference