start-vibing 4.3.4 → 4.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.
Files changed (44) hide show
  1. package/package.json +2 -2
  2. package/template/.claude/agents/sd-audit.md +32 -0
  3. package/template/.claude/skills/e2e-audit/DESIGN.md +294 -0
  4. package/template/.claude/skills/e2e-audit/SKILL.md +660 -0
  5. package/template/.claude/skills/e2e-audit/e2e/fixtures/auth.setup.ts +70 -0
  6. package/template/.claude/skills/e2e-audit/e2e/fixtures/auth.ts +21 -0
  7. package/template/.claude/skills/e2e-audit/e2e/fixtures/base.ts +90 -0
  8. package/template/.claude/skills/e2e-audit/e2e/fixtures/storage/.gitkeep +0 -0
  9. package/template/.claude/skills/e2e-audit/e2e/fixtures/storage/admin.json +50 -0
  10. package/template/.claude/skills/e2e-audit/e2e/fixtures/storage/manager.json +50 -0
  11. package/template/.claude/skills/e2e-audit/e2e/fixtures/storage/member.json +50 -0
  12. package/template/.claude/skills/e2e-audit/e2e/fixtures/storage/owner.json +50 -0
  13. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-admin.page.ts +141 -0
  14. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-billing.page.ts +47 -0
  15. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-chat.page.ts +35 -0
  16. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-home.page.ts +134 -0
  17. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-integrations.page.ts +334 -0
  18. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-knowledge.page.ts +30 -0
  19. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-ontology.page.ts +71 -0
  20. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-profile.page.ts +38 -0
  21. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-teams.page.ts +123 -0
  22. package/template/.claude/skills/e2e-audit/e2e/pages/dashboard-transcripts.page.ts +109 -0
  23. package/template/.claude/skills/e2e-audit/e2e/specs/auth/login.spec.ts +59 -0
  24. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-admin.spec.ts +233 -0
  25. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-billing.spec.ts +44 -0
  26. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-chat.spec.ts +50 -0
  27. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-home.spec.ts +243 -0
  28. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-integrations.spec.ts +472 -0
  29. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-knowledge.spec.ts +57 -0
  30. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-ontology.spec.ts +72 -0
  31. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-profile.spec.ts +48 -0
  32. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-teams.spec.ts +247 -0
  33. package/template/.claude/skills/e2e-audit/e2e/specs/dashboard-transcripts.spec.ts +122 -0
  34. package/template/.claude/skills/e2e-audit/e2e/specs/security/headers.spec.ts +39 -0
  35. package/template/.claude/skills/e2e-audit/e2e/specs/security/rbac.spec.ts +92 -0
  36. package/template/.claude/skills/e2e-audit/e2e/specs/security/xss.spec.ts +74 -0
  37. package/template/.claude/skills/e2e-audit/e2e/utils/console-collector.ts +89 -0
  38. package/template/.claude/skills/e2e-audit/e2e/utils/security-helpers.ts +114 -0
  39. package/template/.claude/skills/e2e-audit/e2e/utils/test-data.ts +64 -0
  40. package/template/.claude/skills/e2e-audit/runbook.md +115 -0
  41. package/template/.claude/skills/super-design/SKILL.md +42 -4
  42. package/template/.claude/skills/super-design/scripts/discover-surfaces.sh +197 -0
  43. package/template/.claude/skills/super-design/scripts/extract-project-rules.sh +240 -0
  44. package/template/.claude/skills/super-design/scripts/verify-audit.sh +34 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "start-vibing",
3
- "version": "4.3.4",
4
- "description": "Setup Claude Code with 9 plugins, 6 community skills, and 8 MCP servers. Parallel install, auto-accept, superpowers + ralph-loop. super-design 0.6.4: Baymard verbatim rules backfilled search (12), filter (10), breadcrumbs (6), PDP (18) now enumerated in audit-methodology.md with rule IDs + source URLs (joining the existing cc/14 + addr/8 sets), plus docs/research/baymard-public-rules.md catalogs 88 rules with SHOT+QUOTE+SEL+VAL evidence for detectors. DSC-choice typeui selection + harvest-typeui.sh carry over from 0.6.3.",
3
+ "version": "4.4.0",
4
+ "description": "Setup Claude Code with 9 plugins, 6 community skills, and 8 MCP servers. Parallel install, auto-accept, superpowers + ralph-loop. super-design 0.7.0 (BREAKING): source-first surface & project-rule discovery. New scripts/discover-surfaces.sh statically maps modals, forms, triggers, internal nav, Next.js layout/error/loading/not-found/parallel/intercepting routes BEFORE Playwright runs. New scripts/extract-project-rules.sh parses FORBIDDEN tables from CLAUDE.md / AGENTS.md / .cursorrules into an authoritative rule source. sd-audit gains Step 1.5 (surface + rule extraction), viewport-coverage quota (emits audit-coverage-skewed meta finding if mobile < 30%), mandatory design-intelligence-craft-summary finding per page × viewport (one holistic verdict per combo, not just discrete C1-C17), Step 3i project-rule enforcement (project FORBIDDEN rules fire as primary findings keyed to the project's own wording), and modal-coverage-gap / form-coverage-gap findings for source-declared components never exercised at runtime. verify-audit.sh enforces design-intelligence/<slug>_<vp>.json existence per MATRIX combination and mobile quota gate. Baymard 88-rule catalog + DSC-choice typeui selection carry over from 0.6.4.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "start-vibing": "./dist/cli.js"
@@ -67,6 +67,20 @@ Read in order:
67
67
 
68
68
  Run `.claude/skills/super-design/scripts/discover-routes.sh`. If incremental mode, filter to scope (read `.super-design/sessions/<id>/scope.json`).
69
69
 
70
+ ## Step 1.5 — Source-first surface & project-rule discovery (MANDATORY, 0.7.0+)
71
+
72
+ Playwright deduction misses internal state (modals never triggered in the tested flow, forms gated behind other forms, parallel/intercepting routes). Source-first discovery reads the repo FIRST and emits two authoritative artifacts that Step 2.5 and Step 3i consume as ground truth.
73
+
74
+ ```bash
75
+ bash .claude/skills/super-design/scripts/discover-surfaces.sh > "$SESSION_DIR/surfaces.json"
76
+ bash .claude/skills/super-design/scripts/extract-project-rules.sh > "$SESSION_DIR/project-rules.json"
77
+ ```
78
+
79
+ - `surfaces.json` — authoritative inventory of modals, forms, triggers, internal nav, Next.js layout/error/loading/not-found/parallel/intercepting routes. Step 2.5 Phase B cross-checks runtime discovery against this list and emits `modal-coverage-gap` / `form-coverage-gap` findings for anything the source declares but Playwright never exercised.
80
+ - `project-rules.json` — parsed FORBIDDEN tables from `CLAUDE.md`/`AGENTS.md`/`.cursorrules`. Applicable rules (audit-scope, not code-level) are consumed by Step 3i.
81
+
82
+ Both files MUST exist before Step 2 starts. `verify-audit.sh` warns when either is missing.
83
+
70
84
  ## Step 2 — Launch audit loop
71
85
 
72
86
  For each viewport ∈ [mobile 375×812, tablet 768×1024, desktop 1440×900], for each page in scope:
@@ -385,6 +399,24 @@ Cross-reference the competitor component vocabulary from
385
399
  tabs on mobile and the product uses hamburger-only, density score drops AND
386
400
  the M1 finding cites the category norm.
387
401
 
402
+ ## Step 3i — Project-rule enforcement (MANDATORY, 0.7.0+)
403
+
404
+ Iterate the `audit_applicable: true` rules from `project-rules.json` (Step 1.5). These rules are authoritative — the project owner has already codified them as the right answer for this codebase. Each violation fires as a PRIMARY finding with `rule: project-forbidden-<slug>` keyed to the project's own wording.
405
+
406
+ ```jsonc
407
+ {
408
+ "id": "F-NNNN",
409
+ "rule": "project-forbidden-use-cards-on-mobile",
410
+ "source_rule": { "raw": "Use Cards on mobile", "reason": "Waste space in flex-col", "source_file": "CLAUDE.md" },
411
+ "template_id": "M2",
412
+ "viewport": "mobile",
413
+ "severity": 3,
414
+ ...
415
+ }
416
+ ```
417
+
418
+ Do NOT downgrade or tag — project-forbidden rules ARE the rule source, not a bump on another finding. `verify-audit.sh` skips snapshot_quote verification for this rule family (evidence is aggregate, not a single DOM quote).
419
+
388
420
  ## Step 4 — Write findings
389
421
 
390
422
  Append to `docs/super-design/findings/F-NNNN.md` (one file per finding) AND `.super-design/sessions/<id>/findings.json`.
@@ -0,0 +1,294 @@
1
+ # E2E Audit Infrastructure - Design Specification
2
+
3
+ ## Objective
4
+
5
+ Build a comprehensive E2E testing system for the Hakutaku Dashboard that:
6
+
7
+ 1. **Discovers every interactive element** on every page (links, buttons, inputs, modals, dropdowns, tabs, tooltips, toasts)
8
+ 2. **Auto-generates page specs** documenting all elements found per page
9
+ 3. **Produces fixed `.spec.ts` Playwright test files** that run standalone (`bun run test:e2e`) without AI
10
+ 4. **Validates UX/UI** — inputs, sanitization, notifications, tooltips, styles, toasts
11
+ 5. **Tests security** — XSS, RBAC across 4 roles, console leaks, security headers
12
+ 6. **Detects dead code** — unused/unreachable elements via static + dynamic analysis
13
+ 7. **Supports agent-driven updates** — agent re-audits and updates test files when app changes
14
+
15
+ ## Scope
16
+
17
+ - **Desktop only** (1280px+) — no mobile/tablet for now
18
+ - **All pages** — 25 pages across dashboard, auth, and public routes
19
+ - **All roles** — OWNER, ADMIN, MANAGER, MEMBER + unauthenticated
20
+ - **Public** — committed to git, no .gitignore
21
+
22
+ ---
23
+
24
+ ## 1. Playwright Infrastructure
25
+
26
+ ### Config
27
+
28
+ - `playwright.config.ts` at project root
29
+ - Desktop viewport: `1280x720`
30
+ - Base URL: `http://localhost:3000`
31
+ - `fullyParallel: true` for speed
32
+ - `trace: 'on-first-retry'` for CI debugging
33
+ - `screenshot: 'only-on-failure'`
34
+ - Test directory: `tests/e2e/`
35
+ - Output: `test-results/`
36
+
37
+ ### Auth Fixtures
38
+
39
+ Reusable `storageState` per role:
40
+
41
+ ```
42
+ tests/e2e/
43
+ ├── fixtures/
44
+ │ ├── auth.ts # Auth setup — generates storageState per role
45
+ │ ├── base.ts # Extended test fixture with page helpers
46
+ │ └── storage/ # Generated auth state files (gitignored)
47
+ │ ├── owner.json
48
+ │ ├── admin.json
49
+ │ ├── manager.json
50
+ │ └── member.json
51
+ ├── pages/ # Page Object Models
52
+ ├── specs/ # Test spec files
53
+ └── utils/ # Shared test utilities
54
+ ```
55
+
56
+ ### Test Tags
57
+
58
+ | Tag | Purpose |
59
+ |-----|---------|
60
+ | `@smoke` | Critical path — must pass on every PR |
61
+ | `@regression` | Full suite — runs on main merges |
62
+ | `@security` | Security-specific tests |
63
+ | `@a11y` | Accessibility checks |
64
+ | `@ux` | UX/UI validation (toasts, tooltips, styles) |
65
+
66
+ ---
67
+
68
+ ## 2. Page Spec Template
69
+
70
+ Each page gets a structured spec document in `docs/e2e-audit/page-specs/`:
71
+
72
+ ```markdown
73
+ # Page: [Name]
74
+ Route: /dashboard/[route]
75
+ Auth Required: yes/no
76
+ Minimum Role: MEMBER/MANAGER/ADMIN/OWNER
77
+
78
+ ## Interactive Elements
79
+
80
+ ### Navigation
81
+ - [ ] Link: "Home" → /dashboard/home
82
+ - [ ] Link: "Knowledge" → /dashboard/knowledge
83
+
84
+ ### Buttons
85
+ - [ ] Button: "Create New" → opens modal
86
+ - [ ] Button: "Delete" → confirmation dialog
87
+
88
+ ### Inputs
89
+ - [ ] Input: "Search" (text, placeholder: "Search...")
90
+ - [ ] Select: "Filter by" (options: All, Active, Archived)
91
+
92
+ ### Modals/Dialogs
93
+ - [ ] Modal: "Create Item" (trigger: "Create New" button)
94
+ - Input: "Name" (required)
95
+ - Input: "Description" (optional)
96
+ - Button: "Save" → POST + toast
97
+ - Button: "Cancel" → closes modal
98
+
99
+ ### Toasts/Notifications
100
+ - [ ] Success: "Item created successfully"
101
+ - [ ] Error: "Failed to create item"
102
+
103
+ ### Tooltips
104
+ - [ ] Tooltip: "Info icon" → "This is a tooltip"
105
+
106
+ ### States
107
+ - [ ] Empty state: "No items found"
108
+ - [ ] Loading state: skeleton/spinner
109
+ - [ ] Error state: error message display
110
+ ```
111
+
112
+ ---
113
+
114
+ ## 3. E2E Audit Skill Architecture
115
+
116
+ The skill (`/.claude/skills/e2e-audit/SKILL.md`) instructs agents to:
117
+
118
+ 1. **Crawl** — Navigate to each page, capture all interactive elements
119
+ 2. **Generate page spec** — Write structured spec to `docs/e2e-audit/page-specs/`
120
+ 3. **Generate test file** — Write `.spec.ts` to `tests/e2e/specs/`
121
+ 4. **Generate page object** — Write POM to `tests/e2e/pages/`
122
+ 5. **Validate** — Run tests via Playwright, fix failures
123
+ 6. **Report** — Write results to `docs/e2e-audit/reports/`
124
+
125
+ ### Agent Workflow
126
+
127
+ ```
128
+ DISCOVER → SPEC → IMPLEMENT → VALIDATE → REPORT
129
+ ```
130
+
131
+ - **DISCOVER**: Use Playwright MCP to navigate page, snapshot DOM, list all actionable elements
132
+ - **SPEC**: Write page spec markdown documenting every element found
133
+ - **IMPLEMENT**: Generate POM + test spec from the page spec
134
+ - **VALIDATE**: Run `bunx playwright test <file>` and fix any failures
135
+ - **REPORT**: Record pass/fail counts, coverage gaps, findings
136
+
137
+ ---
138
+
139
+ ## 4. Research-Oriented Testing Agent
140
+
141
+ Each page audit follows a 4-phase approach:
142
+
143
+ ### Phase 1: RESEARCH
144
+ - Check OWASP Top 10 for relevant vulnerabilities
145
+ - Research common issues with the page's tech (e.g., file upload XSS, chat injection)
146
+ - Look up library-specific CVEs and edge cases
147
+
148
+ ### Phase 2: DISCOVER
149
+ - Navigate to page via Playwright MCP
150
+ - Snapshot DOM to enumerate all elements
151
+ - Identify: links, buttons, inputs, selects, modals, dropdowns, tabs, tooltips
152
+ - Capture initial state, loading states, empty states, error states
153
+
154
+ ### Phase 3: GENERATE
155
+ - Write page spec markdown
156
+ - Write Page Object Model class
157
+ - Write test spec with assertions for:
158
+ - Navigation (all links resolve correctly)
159
+ - Interactions (buttons, modals, forms work)
160
+ - Validation (required fields, error messages)
161
+ - UX (toasts appear, tooltips show, styles correct)
162
+ - Security (XSS in inputs, RBAC enforcement)
163
+
164
+ ### Phase 4: DOCUMENT
165
+ - Record all findings
166
+ - Flag missing test-ids
167
+ - Flag accessibility issues
168
+ - Flag security concerns
169
+
170
+ ---
171
+
172
+ ## 5. Security Testing
173
+
174
+ ### Layer 1: Passive (Every Page)
175
+ - `page.on('console')` — capture and assert no sensitive data leaks
176
+ - Response header checks: `X-Frame-Options`, `X-Content-Type-Options`, `Strict-Transport-Security`
177
+ - No stack traces in error responses
178
+
179
+ ### Layer 2: RBAC Matrix
180
+ - Test each page with all 4 roles + unauthenticated
181
+ - Verify unauthorized access redirects to `/unauthorized` or `/auth`
182
+ - Verify UI elements show/hide based on permissions
183
+
184
+ ### Layer 3: Active (Targeted)
185
+ - XSS payloads in text inputs (`<script>`, `<img onerror>`, `javascript:`)
186
+ - Verify dialog listeners don't fire (no XSS execution)
187
+ - IDOR checks on ID-based routes (`/knowledge/[id]`, `/chat/[id]`)
188
+ - CSRF token presence on mutations
189
+
190
+ ---
191
+
192
+ ## 6. Dead Code Detection
193
+
194
+ ### Static Analysis
195
+ - `knip` for unused exports, files, dependencies
196
+ - Run: `bunx knip --reporter json > docs/e2e-audit/reports/dead-code-static.json`
197
+
198
+ ### Dynamic Analysis
199
+ - Playwright coverage API to track which code executes during tests
200
+ - Compare covered vs total to identify unreachable code paths
201
+ - Output: `docs/e2e-audit/reports/dead-code-dynamic.json`
202
+
203
+ ---
204
+
205
+ ## 7. Documentation Output
206
+
207
+ ```
208
+ docs/e2e-audit/
209
+ ├── DESIGN.md # This file
210
+ ├── page-specs/ # Per-page element inventories
211
+ │ ├── dashboard-home.md
212
+ │ ├── dashboard-knowledge.md
213
+ │ ├── dashboard-chat.md
214
+ │ └── ...
215
+ ├── reports/ # Audit results
216
+ │ ├── master-audit.md # Summary of all findings
217
+ │ ├── security-report.md # Security-specific findings
218
+ │ ├── coverage-gaps.md # Missing test coverage
219
+ │ └── dead-code.md # Unused code findings
220
+ └── runbook.md # How to run, update, and maintain tests
221
+ ```
222
+
223
+ ---
224
+
225
+ ## 8. All Pages to Audit
226
+
227
+ ### Dashboard (Authenticated)
228
+ | # | Page | Route | Min Role |
229
+ |---|------|-------|----------|
230
+ | 1 | Home | `/dashboard/home` | MEMBER |
231
+ | 2 | Knowledge List | `/dashboard/knowledge` | MEMBER |
232
+ | 3 | Knowledge Detail | `/dashboard/knowledge/[id]` | MEMBER |
233
+ | 4 | Chat | `/dashboard/chat` | MEMBER |
234
+ | 5 | Integrations List | `/dashboard/integrations` | MEMBER |
235
+ | 6 | Integration Detail | `/dashboard/integrations/[id]` | MEMBER |
236
+ | 7 | New Integration | `/dashboard/integrations/new` | MANAGER |
237
+ | 8 | Integration Success | `/dashboard/integrations/success` | MEMBER |
238
+ | 9 | Teams | `/dashboard/teams` | MEMBER |
239
+ | 10 | Profile | `/dashboard/profile` | MEMBER |
240
+ | 11 | Admin | `/dashboard/admin` | ADMIN |
241
+ | 12 | Billing | `/dashboard/billing` | OWNER |
242
+ | 13 | Ontology | `/dashboard/ontology` | MEMBER |
243
+ | 14 | Transcripts List | `/dashboard/transcripts` | MEMBER |
244
+ | 15 | Transcript Detail | `/dashboard/transcripts/[id]` | MEMBER |
245
+ | 16 | Transcript Document | `/dashboard/transcripts/documents/[id]` | MEMBER |
246
+
247
+ ### Auth
248
+ | # | Page | Route |
249
+ |---|------|-------|
250
+ | 17 | Login/Landing | `/` |
251
+ | 18 | Desktop Auth | `/auth/desktop` |
252
+ | 19 | Auth Error | `/auth/error` |
253
+ | 20 | Logout | `/auth/logout` |
254
+ | 21 | OAuth Popup Callback | `/auth/popup-callback` |
255
+ | 22 | Integration Callback Success | `/auth/integration/callback/success` |
256
+ | 23 | Integration Callback Error | `/auth/integration/callback/error` |
257
+
258
+ ### Other
259
+ | # | Page | Route |
260
+ |---|------|-------|
261
+ | 24 | Unauthorized | `/unauthorized` |
262
+ | 25 | Free Trial | `/freetrial` |
263
+
264
+ ---
265
+
266
+ ## 9. Running Tests
267
+
268
+ ```bash
269
+ # Run all E2E tests
270
+ bun run test:e2e
271
+
272
+ # Run specific tag
273
+ bunx playwright test --grep @smoke
274
+
275
+ # Run specific page
276
+ bunx playwright test tests/e2e/specs/dashboard-home.spec.ts
277
+
278
+ # Run with UI mode
279
+ bunx playwright test --ui
280
+
281
+ # Run with trace viewer
282
+ bunx playwright show-trace test-results/trace.zip
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 10. Maintenance
288
+
289
+ When the app changes:
290
+ 1. Agent re-runs discovery on affected pages
291
+ 2. Compares new elements with existing page spec
292
+ 3. Updates page spec, POM, and test file
293
+ 4. Runs tests to validate
294
+ 5. Updates reports with new findings