@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,281 @@
1
+ ---
2
+ name: massu-verify-playwright
3
+ description: Open Playwright browser and check pages for console errors, generate report and fix plan
4
+ allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), mcp__plugin_playwright_playwright__*
5
+ ---
6
+ name: massu-verify-playwright
7
+
8
+ # Massu Verify Playwright: Page Console Error Scanner
9
+
10
+ ## Objective
11
+
12
+ Open a Playwright browser, navigate to pages, collect console errors, and produce a structured report with a categorized fix plan. This command **REPORTS ONLY** -- it never auto-fixes anything.
13
+
14
+ ---
15
+
16
+ ## NON-NEGOTIABLE RULES
17
+
18
+ - **Report only** - NEVER auto-fix errors. All fixes go into the plan document for user review.
19
+ - **Every page checked** - Do not skip pages even if they appear similar.
20
+ - **Exact error capture** - Record full console error messages, not summaries.
21
+ - **Categorize errors** - Every error must be assigned a category and priority.
22
+ - **Authentication required** - If not logged in, STOP immediately and instruct the user.
23
+ - **Complete even if slow** - Do not abort early due to page count. Check every page in the list.
24
+
25
+ ---
26
+
27
+ ## ZERO-GAP AUDIT LOOP
28
+
29
+ **Console error verification does NOT complete until ALL pages are checked and a complete report is generated.**
30
+
31
+ ```
32
+ Loop:
33
+ 1. Launch Playwright and verify authentication (if applicable)
34
+ 2. Check ALL pages in the mode (Quick or Full)
35
+ 3. Capture ALL console errors - every page, no skipping
36
+ 4. Categorize each error (Critical/High/Medium/Low)
37
+ 5. Generate complete report with:
38
+ - Every error listed with full message
39
+ - Priority ranking
40
+ - File/line references where available
41
+ - Fix recommendations for each error
42
+ 6. Only when ALL pages are checked: report complete
43
+ ```
44
+
45
+ **GAPS_DISCOVERED semantics**: Every console error found = 1 gap. A complete pass finding no new errors proves correctness.
46
+
47
+ **The purpose of this command is REPORTING, not fixing. Present the full report to the user.**
48
+
49
+ ---
50
+
51
+ ## TWO MODES
52
+
53
+ | Mode | Flag | Pages | When to Use |
54
+ |------|------|-------|-------------|
55
+ | **Quick** | (default) | Error-prone pages | Daily health check |
56
+ | **Full** | `--full` | ALL pages | Pre-release audit, periodic deep scan |
57
+
58
+ Check the user's input for `--full` flag. If absent, use Quick mode.
59
+
60
+ ---
61
+
62
+ ## PHASE 0: LAUNCH PLAYWRIGHT AND VERIFY AUTH
63
+
64
+ ### 0.1 Navigate to Target URL
65
+
66
+ The user provides the base URL. For the Massu website:
67
+ ```
68
+ Navigate to: http://localhost:3000 (dev) or the production URL
69
+ ```
70
+
71
+ Use `mcp__plugin_playwright_playwright__browser_navigate` to open the URL.
72
+
73
+ ### 0.2 Check Application Status
74
+
75
+ After navigation, use `mcp__plugin_playwright_playwright__browser_snapshot` to capture the page state.
76
+
77
+ **Check for these indicators:**
78
+
79
+ | Indicator | Meaning | Action |
80
+ |-----------|---------|--------|
81
+ | Page content visible | App loaded | PROCEED |
82
+ | URL redirected to `/login` | Not logged in | STOP and instruct user |
83
+ | Error page or blank | App not running | STOP and report |
84
+
85
+ ### 0.3 If NOT Ready
86
+
87
+ **STOP IMMEDIATELY.** Output instructions for the user to prepare the application.
88
+
89
+ ### 0.4 If Ready
90
+
91
+ Report to the user:
92
+ ```
93
+ Application confirmed. Starting page scan...
94
+ Mode: [Quick / Full]
95
+ Pages to check: [N]
96
+ ```
97
+
98
+ ---
99
+
100
+ ## PHASE 1: COLLECT CONSOLE ERRORS FROM EACH PAGE
101
+
102
+ ### 1.1 Page Lists
103
+
104
+ The user provides page lists, OR use the website sitemap. For the Massu website, common pages include:
105
+
106
+ #### Quick Mode (default)
107
+ ```
108
+ /
109
+ /pricing
110
+ /features
111
+ /docs
112
+ /blog
113
+ ```
114
+
115
+ #### Full Mode
116
+ All pages discovered from sitemap or route analysis.
117
+
118
+ ### 1.2 Per-Page Procedure
119
+
120
+ For EACH page in the list, execute these steps in order:
121
+
122
+ **Step 1: Navigate**
123
+ Use `mcp__plugin_playwright_playwright__browser_navigate` to go to the page URL.
124
+
125
+ **Step 2: Wait for Loading to Complete**
126
+ Use `mcp__plugin_playwright_playwright__browser_wait_for` or a brief pause (up to 10 seconds).
127
+
128
+ **Step 3: Collect Console Messages**
129
+ Use `mcp__plugin_playwright_playwright__browser_console_messages` to retrieve ALL console messages.
130
+ Filter for messages at the **error** level only.
131
+
132
+ **Step 4: Record Results**
133
+
134
+ | Field | Value |
135
+ |-------|-------|
136
+ | Page URL | The full path |
137
+ | Status | `clean` / `errors` / `timeout` / `404` |
138
+ | Error Count | Number of console errors |
139
+ | Error Messages | Full text of each error message |
140
+ | Load Time | Approximate (fast / slow / timeout) |
141
+
142
+ **Step 5: Move to Next Page**
143
+ Proceed to the next page in the list. Do NOT stop on errors.
144
+
145
+ ### 1.3 Progress Reporting
146
+
147
+ After every 10 pages (or after all pages if fewer than 10 remain):
148
+ ```
149
+ Progress: [X]/[TOTAL] pages checked | [Y] clean | [Z] with errors
150
+ ```
151
+
152
+ ---
153
+
154
+ ## PHASE 2: GENERATE THE REPORT
155
+
156
+ ### 2.1 Summary Table
157
+
158
+ ```markdown
159
+ ## Page Health Report
160
+
161
+ **Date**: [YYYY-MM-DD HH:MM]
162
+ **Mode**: Quick / Full
163
+ **Base URL**: [URL]
164
+
165
+ ### Summary
166
+
167
+ | Metric | Count |
168
+ |--------|-------|
169
+ | Total Pages Checked | [N] |
170
+ | Clean Pages (0 errors) | [N] |
171
+ | Pages with Errors | [N] |
172
+ | Pages with Timeout | [N] |
173
+ | Pages with 404 | [N] |
174
+ | Total Console Errors | [N] |
175
+ ```
176
+
177
+ ### 2.2 Error Categories
178
+
179
+ | Category | Pattern to Match | Priority |
180
+ |----------|-----------------|----------|
181
+ | **API 500** | `500`, `Internal Server Error`, `failed to fetch` | P0 |
182
+ | **React Crash** | `Uncaught Error`, `Cannot read properties of`, `TypeError` | P0 |
183
+ | **Missing Module** | `is not defined`, `Cannot find module` | P1 |
184
+ | **404 Resource** | `404`, `Not Found`, failed resource loads | P2 |
185
+ | **Deprecation** | `deprecated`, `will be removed` | P3 |
186
+ | **Other** | Anything not matching above | P2 |
187
+
188
+ ### 2.3 Per-Page Error Details
189
+
190
+ For EACH page that had errors, produce a detail block with error count, category, priority, and full message.
191
+
192
+ ### 2.4 Clean Pages List
193
+
194
+ List all pages with zero errors.
195
+
196
+ ---
197
+
198
+ ## PHASE 3: GENERATE THE FIX PLAN
199
+
200
+ ### 3.1 Fix Plan Structure
201
+
202
+ For each unique error (deduplicated across pages), propose a fix with:
203
+ - Pages affected
204
+ - Full error message
205
+ - Category and priority
206
+ - Likely root cause
207
+ - Proposed fix
208
+ - Files to investigate
209
+ - Estimated effort
210
+
211
+ ### 3.2 Deduplication Rules
212
+
213
+ - Same error on multiple pages = ONE fix entry listing all affected pages
214
+ - Multiple errors with same root cause = ONE grouped fix entry
215
+ - Always list total occurrence count
216
+
217
+ ---
218
+
219
+ ## PHASE 4: SAVE AND PRESENT
220
+
221
+ ### 4.1 Save the Plan Document
222
+
223
+ Save the complete report + fix plan to:
224
+ ```
225
+ docs/plans/[YYYY-MM-DD]-playwright-verification-fixes.md
226
+ ```
227
+
228
+ ### 4.2 Present to User
229
+
230
+ 1. The summary table (pages checked, error counts)
231
+ 2. The category breakdown
232
+ 3. The fix plan summary (priority counts)
233
+ 4. The file path where the full report was saved
234
+ 5. Ask for review/comments/approval before proceeding with any fixes
235
+
236
+ ```markdown
237
+ ## Next Steps
238
+
239
+ 1. Review the fix plan at: [file path]
240
+ 2. Comment on any fixes you want to modify, skip, or reprioritize
241
+ 3. When ready, run `/massu-loop` or `/massu-hotfix` to execute the approved fixes
242
+ 4. Re-run `/massu-verify-playwright` after fixes to verify resolution
243
+
244
+ **This command does NOT auto-fix anything. All fixes require your approval.**
245
+ ```
246
+
247
+ ---
248
+
249
+ ## ERROR HANDLING
250
+
251
+ | Scenario | Action |
252
+ |----------|--------|
253
+ | Page returns 404 | Record as `404`, continue to next page |
254
+ | Page hangs (>10s) | Record as `timeout`, continue to next page |
255
+ | Page redirects to /login | Session expired. STOP and report to user. |
256
+ | Network error | Retry once. If still fails, record and continue. |
257
+
258
+ ### Playwright Not Available
259
+
260
+ If Playwright MCP tools are not available:
261
+ ```
262
+ ERROR: Playwright MCP tools are not available in this session.
263
+
264
+ Please ensure the Playwright MCP server is running and try again.
265
+ ```
266
+
267
+ ---
268
+
269
+ ## START NOW
270
+
271
+ 1. Check user input for `--full` flag to determine mode
272
+ 2. Launch Playwright and navigate to target URL
273
+ 3. Verify application is ready (STOP if not)
274
+ 4. Iterate through ALL pages in the selected list
275
+ 5. Collect console errors from each page
276
+ 6. Generate the categorized report
277
+ 7. Generate the prioritized fix plan
278
+ 8. Save to docs directory
279
+ 9. Present summary and ask for user review
280
+
281
+ **Remember: Report everything. Fix nothing. Let the user decide.**