@hustle-together/api-dev-tools 3.12.3 → 4.5.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/.claude/adr-requests/.gitkeep +10 -0
- package/.claude/agents/adr-researcher.md +109 -0
- package/.claude/agents/visual-analyzer.md +183 -0
- package/.claude/api-dev-state.json +7 -463
- package/.claude/documentation-audit.json +114 -0
- package/.claude/registry.json +289 -0
- package/.claude/settings.json +45 -1
- package/.claude/workflow-logs/None.json +49 -0
- package/.claude/workflow-logs/session-20251230-143727.json +106 -0
- package/.skills/adr-deep-research/SKILL.md +351 -0
- package/.skills/api-create/SKILL.md +116 -17
- package/.skills/api-research/SKILL.md +130 -0
- package/.skills/docs-sync/SKILL.md +260 -0
- package/.skills/docs-update/SKILL.md +205 -0
- package/.skills/hustle-brand/SKILL.md +368 -0
- package/.skills/hustle-build/SKILL.md +786 -0
- package/.skills/hustle-build-review/SKILL.md +518 -0
- package/.skills/parallel-spawn/SKILL.md +212 -0
- package/.skills/ralph-continue/SKILL.md +151 -0
- package/.skills/ralph-loop/SKILL.md +341 -0
- package/.skills/ralph-status/SKILL.md +87 -0
- package/.skills/refactor/SKILL.md +59 -0
- package/.skills/shadcn/SKILL.md +522 -0
- package/.skills/test-all/SKILL.md +210 -0
- package/.skills/test-builds/SKILL.md +208 -0
- package/.skills/test-debug/SKILL.md +212 -0
- package/.skills/test-e2e/SKILL.md +168 -0
- package/.skills/test-review/SKILL.md +707 -0
- package/.skills/test-unit/SKILL.md +143 -0
- package/.skills/test-visual/SKILL.md +301 -0
- package/.skills/token-report/SKILL.md +132 -0
- package/CHANGELOG.md +575 -0
- package/README.md +426 -56
- package/bin/cli.js +1538 -88
- package/commands/hustle-api-create.md +22 -0
- package/commands/hustle-build.md +259 -0
- package/commands/hustle-combine.md +81 -2
- package/commands/hustle-ui-create-page.md +84 -2
- package/commands/hustle-ui-create.md +82 -2
- package/hooks/__pycache__/api-workflow-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/auto-answer.cpython-314.pyc +0 -0
- package/hooks/__pycache__/cache-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-api-routes.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-playwright-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-storybook-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-update.cpython-314.pyc +0 -0
- package/hooks/__pycache__/completion-promise-detector.cpython-314.pyc +0 -0
- package/hooks/__pycache__/context-capacity-warning.cpython-314.pyc +0 -0
- package/hooks/__pycache__/detect-interruption.cpython-314.pyc +0 -0
- package/hooks/__pycache__/docs-update-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-a11y-audit.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-brand-guide.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-component-type-confirm.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-deep-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-documentation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-dry-run.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-environment.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-external-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-freshness.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-components.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-data-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-questions-sourced.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-refactor.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema-from-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-scope.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-tdd-red.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-verify.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-adr-options.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-manifest-entry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/hook_utils.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-input-needed.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-phase-complete.cpython-314.pyc +0 -0
- package/hooks/__pycache__/ntfy-on-question.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-completion.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-handoff.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/parallel-orchestrator.cpython-314.pyc +0 -0
- package/hooks/__pycache__/periodic-reground.cpython-314.pyc +0 -0
- package/hooks/__pycache__/project-document-prompt.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-proxy.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-server.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-code-review.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-visual-qa.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-logger.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-scope-coverage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-token-usage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-tool-use.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-adr-decision.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-api-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-registry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-ui-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-after-green.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-implementation.cpython-314.pyc +0 -0
- package/hooks/api-workflow-check.py +34 -0
- package/hooks/auto-answer.py +305 -0
- package/hooks/check-update.py +132 -0
- package/hooks/completion-promise-detector.py +293 -0
- package/hooks/context-capacity-warning.py +171 -0
- package/hooks/docs-update-check.py +120 -0
- package/hooks/enforce-dry-run.py +134 -0
- package/hooks/enforce-external-research.py +25 -0
- package/hooks/enforce-interview.py +20 -0
- package/hooks/generate-adr-options.py +282 -0
- package/hooks/hook_utils.py +609 -0
- package/hooks/lib/__pycache__/__init__.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/greptile.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/ntfy.cpython-314.pyc +0 -0
- package/hooks/ntfy-on-question.py +240 -0
- package/hooks/orchestrator-completion.py +313 -0
- package/hooks/orchestrator-handoff.py +267 -0
- package/hooks/orchestrator-session-startup.py +146 -0
- package/hooks/parallel-orchestrator.py +451 -0
- package/hooks/periodic-reground.py +270 -67
- package/hooks/project-document-prompt.py +302 -0
- package/hooks/remote-question-proxy.py +284 -0
- package/hooks/remote-question-server.py +1224 -0
- package/hooks/run-code-review.py +176 -29
- package/hooks/run-visual-qa.py +338 -0
- package/hooks/session-logger.py +27 -1
- package/hooks/session-startup.py +113 -0
- package/hooks/update-adr-decision.py +236 -0
- package/hooks/update-api-showcase.py +13 -1
- package/hooks/update-testing-checklist.py +195 -0
- package/hooks/update-ui-showcase.py +13 -1
- package/package.json +7 -3
- package/scripts/extract-schema-docs.cjs +322 -0
- package/templates/.skills/hustle-interview/SKILL.md +174 -0
- package/templates/CLAUDE-SECTION.md +89 -64
- package/templates/adr-viewer/_components/ADRViewer.tsx +326 -0
- package/templates/api-dev-state.json +33 -1
- package/templates/api-showcase/_components/APIModal.tsx +100 -8
- package/templates/api-showcase/_components/APIShowcase.tsx +36 -4
- package/templates/api-showcase/_components/APITester.tsx +367 -58
- package/templates/brand-page/page.tsx +645 -0
- package/templates/component/Component.visual.spec.ts +30 -24
- package/templates/docs/page.tsx +230 -0
- package/templates/eslint-plugin-zod-schema/index.js +446 -0
- package/templates/eslint-plugin-zod-schema/package.json +26 -0
- package/templates/github-workflows/security.yml +274 -0
- package/templates/hustle-build-defaults.json +136 -0
- package/templates/hustle-dev-dashboard/page.tsx +365 -0
- package/templates/page/page.e2e.test.ts +30 -26
- package/templates/performance-budgets.json +63 -5
- package/templates/playwright-report/page.tsx +258 -0
- package/templates/registry.json +279 -3
- package/templates/review-dashboard/page.tsx +510 -0
- package/templates/settings.json +155 -7
- package/templates/test-results/page.tsx +237 -0
- package/templates/typedoc.json +19 -0
- package/templates/ui-showcase/_components/UIShowcase.tsx +48 -1
- package/templates/ui-showcase/_components/VisualTestingDashboard.tsx +579 -0
- package/templates/ui-showcase/page.tsx +1 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-unit
|
|
3
|
+
description: Run Vitest unit tests with coverage and actionable reporting
|
|
4
|
+
tools: Bash, Read, Glob, TodoWrite
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Unit Skill
|
|
9
|
+
|
|
10
|
+
Run Vitest unit tests with detailed coverage reporting and actionable feedback.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- After implementing a feature (TDD Green phase)
|
|
15
|
+
- Before committing changes
|
|
16
|
+
- When debugging test failures
|
|
17
|
+
- To check test coverage
|
|
18
|
+
|
|
19
|
+
## Execution Steps
|
|
20
|
+
|
|
21
|
+
### Step 1: Detect Test Configuration
|
|
22
|
+
|
|
23
|
+
Check for test configuration:
|
|
24
|
+
```bash
|
|
25
|
+
# Check for vitest.config.ts or vite.config.ts
|
|
26
|
+
ls -la vitest.config.* vite.config.* 2>/dev/null || echo "No config found"
|
|
27
|
+
|
|
28
|
+
# Check package.json for test script
|
|
29
|
+
cat package.json | grep -A5 '"scripts"' | grep test
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Step 2: Run Tests
|
|
33
|
+
|
|
34
|
+
Execute the appropriate test command:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# If pnpm is available
|
|
38
|
+
pnpm test
|
|
39
|
+
|
|
40
|
+
# Or with coverage
|
|
41
|
+
pnpm test:coverage
|
|
42
|
+
|
|
43
|
+
# Or run specific file
|
|
44
|
+
pnpm test -- path/to/file.test.ts
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 3: Parse Results
|
|
48
|
+
|
|
49
|
+
After tests complete, analyze the output:
|
|
50
|
+
|
|
51
|
+
1. **If all tests pass:**
|
|
52
|
+
```
|
|
53
|
+
✅ All tests passing
|
|
54
|
+
|
|
55
|
+
Summary:
|
|
56
|
+
- Tests: 42 passed
|
|
57
|
+
- Duration: 3.2s
|
|
58
|
+
- Coverage: 85%
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. **If tests fail:**
|
|
62
|
+
```
|
|
63
|
+
❌ Test failures detected
|
|
64
|
+
|
|
65
|
+
Failed Tests:
|
|
66
|
+
1. src/components/Button.test.tsx
|
|
67
|
+
- "should render with loading state"
|
|
68
|
+
- Expected: spinner to be visible
|
|
69
|
+
- Received: spinner not found
|
|
70
|
+
|
|
71
|
+
Suggested Fix:
|
|
72
|
+
- Check if isLoading prop is being passed
|
|
73
|
+
- Verify Spinner component is imported
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 4: Coverage Analysis
|
|
77
|
+
|
|
78
|
+
If coverage is enabled, report:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Coverage Report:
|
|
82
|
+
─────────────────────────────────────
|
|
83
|
+
File | Stmts | Branch | Funcs | Lines
|
|
84
|
+
─────────────────────────────────────
|
|
85
|
+
src/lib/api.ts | 92% | 85% | 100% | 92%
|
|
86
|
+
src/components/... | 78% | 70% | 90% | 78%
|
|
87
|
+
─────────────────────────────────────
|
|
88
|
+
|
|
89
|
+
⚠️ Files below 80% coverage:
|
|
90
|
+
- src/utils/helpers.ts (65%)
|
|
91
|
+
- src/hooks/useAuth.ts (72%)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Arguments
|
|
95
|
+
|
|
96
|
+
| Argument | Description | Default |
|
|
97
|
+
|----------|-------------|---------|
|
|
98
|
+
| `[pattern]` | Test file pattern to match | All tests |
|
|
99
|
+
| `--coverage` | Include coverage report | false |
|
|
100
|
+
| `--watch` | Run in watch mode | false |
|
|
101
|
+
| `--ui` | Open Vitest UI | false |
|
|
102
|
+
|
|
103
|
+
## Examples
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Run all tests
|
|
107
|
+
/test-unit
|
|
108
|
+
|
|
109
|
+
# Run tests for specific file
|
|
110
|
+
/test-unit Button
|
|
111
|
+
|
|
112
|
+
# Run with coverage
|
|
113
|
+
/test-unit --coverage
|
|
114
|
+
|
|
115
|
+
# Watch mode for development
|
|
116
|
+
/test-unit --watch
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Output Format
|
|
120
|
+
|
|
121
|
+
Always end with a clear status:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
═══════════════════════════════════════
|
|
125
|
+
Unit Test Results: ✅ PASS / ❌ FAIL
|
|
126
|
+
═══════════════════════════════════════
|
|
127
|
+
Tests: 42 passed, 0 failed
|
|
128
|
+
Duration: 3.2s
|
|
129
|
+
Coverage: 85% (target: 80%)
|
|
130
|
+
═══════════════════════════════════════
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Integration with TDD Workflow
|
|
134
|
+
|
|
135
|
+
This skill is automatically invoked during:
|
|
136
|
+
- Phase 9 (TDD Green) - After implementation
|
|
137
|
+
- Phase 12 (Refactor) - After cleanup
|
|
138
|
+
|
|
139
|
+
## See Also
|
|
140
|
+
|
|
141
|
+
- `/test-e2e` - End-to-end tests
|
|
142
|
+
- `/test-visual` - Visual regression tests
|
|
143
|
+
- `/test-all` - Run all test suites
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-visual
|
|
3
|
+
description: Run Storybook visual and interaction tests with component coverage
|
|
4
|
+
tools: Bash, Read, Glob, TodoWrite, Task
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Visual Skill
|
|
9
|
+
|
|
10
|
+
Run visual regression tests using Storybook and Playwright across 7 viewports.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- After creating or modifying UI components
|
|
15
|
+
- Before merging component changes
|
|
16
|
+
- To detect unintended visual changes
|
|
17
|
+
- To verify responsive design
|
|
18
|
+
|
|
19
|
+
## Execution Steps
|
|
20
|
+
|
|
21
|
+
### Step 1: Check Storybook Configuration
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Check for Storybook config
|
|
25
|
+
ls .storybook/main.* 2>/dev/null
|
|
26
|
+
|
|
27
|
+
# Check for test-runner
|
|
28
|
+
cat package.json | grep -E "storybook|chromatic"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Step 2: Build Storybook (if needed)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Build static Storybook for testing
|
|
35
|
+
pnpm storybook:build
|
|
36
|
+
|
|
37
|
+
# Or run dev server
|
|
38
|
+
pnpm storybook &
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 3: Run Visual Tests
|
|
42
|
+
|
|
43
|
+
Execute visual regression tests:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Run Storybook test runner
|
|
47
|
+
pnpm test-storybook
|
|
48
|
+
|
|
49
|
+
# Or with Playwright visual comparisons
|
|
50
|
+
npx playwright test --project=visual
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Step 4: Test Across 7 Viewports
|
|
54
|
+
|
|
55
|
+
For each component, capture screenshots at:
|
|
56
|
+
|
|
57
|
+
| Viewport | Dimensions | Safe Areas |
|
|
58
|
+
|----------|------------|------------|
|
|
59
|
+
| Mobile Portrait | 375×667 | None |
|
|
60
|
+
| Mobile Notch | 393×852 | Top: 47px, Bottom: 34px |
|
|
61
|
+
| Mobile Landscape | 667×375 | None |
|
|
62
|
+
| Tablet Portrait | 768×1024 | None |
|
|
63
|
+
| Tablet Landscape | 1024×768 | None |
|
|
64
|
+
| Small Desktop | 1280×720 | None |
|
|
65
|
+
| Desktop | 1920×1080 | None |
|
|
66
|
+
|
|
67
|
+
### Step 5: AI-Powered Analysis (Haiku)
|
|
68
|
+
|
|
69
|
+
For each viewport screenshot, spawn a Haiku subagent to analyze:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Task({
|
|
73
|
+
subagent_type: "visual-analyzer",
|
|
74
|
+
model: "haiku",
|
|
75
|
+
prompt: `Analyze screenshot for:
|
|
76
|
+
1. Layout issues (overlapping, clipping)
|
|
77
|
+
2. Typography (readability, contrast)
|
|
78
|
+
3. Touch targets (min 44x44px)
|
|
79
|
+
4. Safe area compliance
|
|
80
|
+
5. Brand consistency
|
|
81
|
+
|
|
82
|
+
Return: {issues: [{type, severity, element, detail}]}`
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Step 6: Report Results (Enhanced with Haiku Reasoning + Links)
|
|
87
|
+
|
|
88
|
+
The report includes **Haiku's detailed reasoning** for any issues found, plus **clickable links** to screenshots and Storybook states:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
92
|
+
VISUAL TEST RESULTS: Button
|
|
93
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
94
|
+
|
|
95
|
+
Viewport Tests:
|
|
96
|
+
┌──────────────────┬────────┬─────────────────────────────────────────────────┐
|
|
97
|
+
│ Viewport │ Status │ Details │
|
|
98
|
+
├──────────────────┼────────┼─────────────────────────────────────────────────┤
|
|
99
|
+
│ Mobile Portrait │ ✅ Pass │ No issues │
|
|
100
|
+
│ Mobile Notch │ ⚠️ Warn │ Touch target below minimum │
|
|
101
|
+
│ Mobile Landscape │ ✅ Pass │ No issues │
|
|
102
|
+
│ Tablet Portrait │ ✅ Pass │ No issues │
|
|
103
|
+
│ Tablet Landscape │ ✅ Pass │ No issues │
|
|
104
|
+
│ Small Desktop │ ✅ Pass │ No issues │
|
|
105
|
+
│ Desktop │ ✅ Pass │ No issues │
|
|
106
|
+
└──────────────────┴────────┴─────────────────────────────────────────────────┘
|
|
107
|
+
|
|
108
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
109
|
+
HAIKU AI ANALYSIS
|
|
110
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
111
|
+
|
|
112
|
+
📱 Mobile Notch (393×852) - ⚠️ 1 Warning
|
|
113
|
+
───────────────────────────────────────────────────────────────────────────────
|
|
114
|
+
📸 Screenshot: file://__snapshots__/Button-mobile-notch.png
|
|
115
|
+
📖 Storybook: http://localhost:6006/?path=/story/components-button--primary
|
|
116
|
+
|
|
117
|
+
Issue #1: Touch Target Too Small
|
|
118
|
+
Type: touch_target
|
|
119
|
+
Severity: warning
|
|
120
|
+
Element: Secondary action button (bottom right)
|
|
121
|
+
|
|
122
|
+
🤖 Haiku's Reasoning:
|
|
123
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
124
|
+
│ "I measured the secondary button at approximately 36px height. Apple's │
|
|
125
|
+
│ HIG recommends 44×44px minimum for touch targets to ensure reliable │
|
|
126
|
+
│ tapping, especially on notch devices where users may be adjusting grip. │
|
|
127
|
+
│ The primary button meets the standard at 48px, but the secondary button │
|
|
128
|
+
│ falls short. This could lead to tap frustration on real devices." │
|
|
129
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
130
|
+
|
|
131
|
+
💡 Suggestion: Increase button height to 44px minimum
|
|
132
|
+
🔧 Fix: Add `min-h-[44px]` to secondary button variants
|
|
133
|
+
|
|
134
|
+
───────────────────────────────────────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
🖥️ Desktop (1920×1080) - ✅ All Checks Pass
|
|
137
|
+
───────────────────────────────────────────────────────────────────────────────
|
|
138
|
+
📸 Screenshot: file://__snapshots__/Button-desktop.png
|
|
139
|
+
📖 Storybook: http://localhost:6006/?path=/story/components-button--primary
|
|
140
|
+
|
|
141
|
+
🤖 Haiku's Analysis:
|
|
142
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
143
|
+
│ "Layout is clean with proper alignment. Typography contrast measured │
|
|
144
|
+
│ at approximately 4.8:1 against the background, exceeding WCAG AA │
|
|
145
|
+
│ requirements (4.5:1). All interactive elements are appropriately sized │
|
|
146
|
+
│ for desktop interaction. Brand colors match the guide specification." │
|
|
147
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
148
|
+
|
|
149
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
150
|
+
SUMMARY
|
|
151
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
152
|
+
|
|
153
|
+
Category Results:
|
|
154
|
+
───────────────────────────────────────
|
|
155
|
+
✅ Layout: 7/7 viewports pass
|
|
156
|
+
✅ Typography: 7/7 viewports pass
|
|
157
|
+
⚠️ Touch Targets: 6/7 viewports pass (1 warning)
|
|
158
|
+
✅ Safe Areas: 7/7 viewports pass
|
|
159
|
+
✅ Brand: 7/7 viewports pass
|
|
160
|
+
───────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
Quick Links:
|
|
163
|
+
───────────────────────────────────────
|
|
164
|
+
📸 All Screenshots: file://__snapshots__/
|
|
165
|
+
📖 Storybook: http://localhost:6006/?path=/story/components-button
|
|
166
|
+
🧪 Playwright: file://playwright-report/index.html
|
|
167
|
+
📊 Coverage: file://coverage/index.html
|
|
168
|
+
|
|
169
|
+
───────────────────────────────────────
|
|
170
|
+
Result: ⚠️ PASS WITH WARNINGS (1 warning, 0 critical)
|
|
171
|
+
───────────────────────────────────────
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Handling Visual Diffs
|
|
175
|
+
|
|
176
|
+
When visual differences are detected:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
⚠️ Visual Differences Detected
|
|
180
|
+
|
|
181
|
+
Component: Card
|
|
182
|
+
Viewport: Desktop
|
|
183
|
+
|
|
184
|
+
Changes:
|
|
185
|
+
- Border radius changed from 4px to 8px
|
|
186
|
+
- Shadow depth increased
|
|
187
|
+
|
|
188
|
+
Expected: __snapshots__/Card-desktop-expected.png
|
|
189
|
+
Actual: __snapshots__/Card-desktop-actual.png
|
|
190
|
+
Diff: __snapshots__/Card-desktop-diff.png
|
|
191
|
+
|
|
192
|
+
Actions:
|
|
193
|
+
1. [u] Update baseline (accept change)
|
|
194
|
+
2. [r] Reject change (fix code)
|
|
195
|
+
3. [i] Ignore this viewport
|
|
196
|
+
|
|
197
|
+
Choice? >
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Arguments
|
|
201
|
+
|
|
202
|
+
| Argument | Description | Default |
|
|
203
|
+
|----------|-------------|---------|
|
|
204
|
+
| `[component]` | Component to test | All components |
|
|
205
|
+
| `--update` | Update baselines | false |
|
|
206
|
+
| `--viewport` | Specific viewport | All 7 |
|
|
207
|
+
| `--ai` | Include AI analysis | true |
|
|
208
|
+
|
|
209
|
+
## Examples
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Run all visual tests
|
|
213
|
+
/test-visual
|
|
214
|
+
|
|
215
|
+
# Test specific component
|
|
216
|
+
/test-visual Button
|
|
217
|
+
|
|
218
|
+
# Update baselines
|
|
219
|
+
/test-visual --update
|
|
220
|
+
|
|
221
|
+
# Single viewport
|
|
222
|
+
/test-visual --viewport=mobile-portrait
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Output Format
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
═══════════════════════════════════════
|
|
229
|
+
Visual Test Results: ✅ PASS / ❌ FAIL
|
|
230
|
+
═══════════════════════════════════════
|
|
231
|
+
Components: 12 tested
|
|
232
|
+
Viewports: 7 each (84 total screenshots)
|
|
233
|
+
AI Analysis: ✅ No issues found
|
|
234
|
+
Duration: 28s
|
|
235
|
+
═══════════════════════════════════════
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Autonomous Loop Completion (Ralph Wiggum Pattern)
|
|
239
|
+
|
|
240
|
+
When running in autonomous mode (`--auto` flag or `/ralph-loop`), this skill supports
|
|
241
|
+
self-terminating loops for iterative visual QA cycles.
|
|
242
|
+
|
|
243
|
+
### Promise Signal
|
|
244
|
+
|
|
245
|
+
After completing visual analysis and fixing all issues, output:
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
<promise>VISUAL_CLEAN</promise>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
This signal is detected by the `completion-promise-detector.py` hook, which:
|
|
252
|
+
1. Records the promise in `.claude/completion-promises.json`
|
|
253
|
+
2. Allows graceful workflow termination
|
|
254
|
+
3. Prevents infinite visual QA loops
|
|
255
|
+
|
|
256
|
+
### When to Output the Promise
|
|
257
|
+
|
|
258
|
+
Output `<promise>VISUAL_CLEAN</promise>` when:
|
|
259
|
+
- All 7 viewports have been tested
|
|
260
|
+
- All Haiku-detected issues have been fixed
|
|
261
|
+
- Re-analysis confirms no remaining issues
|
|
262
|
+
- Screenshots match expected baselines
|
|
263
|
+
|
|
264
|
+
### Iterative Visual QA Loop
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
268
|
+
│ VISUAL QA LOOP (Ralph Wiggum) │
|
|
269
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
270
|
+
│ │
|
|
271
|
+
│ 1. Capture screenshots (7 viewports) │
|
|
272
|
+
│ └─ Spawn Haiku for AI analysis │
|
|
273
|
+
│ │
|
|
274
|
+
│ 2. Issues found? │
|
|
275
|
+
│ └─ Fix layout, typography, touch targets, etc. │
|
|
276
|
+
│ │
|
|
277
|
+
│ 3. Re-capture and re-analyze │
|
|
278
|
+
│ └─ Still issues? → Loop back to step 2 │
|
|
279
|
+
│ │
|
|
280
|
+
│ 4. All viewports clean? │
|
|
281
|
+
│ └─ Output: <promise>VISUAL_CLEAN</promise> │
|
|
282
|
+
│ └─ Hook detects → Workflow terminates gracefully │
|
|
283
|
+
│ │
|
|
284
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Credit:** Ralph Wiggum pattern by [Geoffrey Huntley](https://ghuntley.com/ralph/)
|
|
288
|
+
|
|
289
|
+
## Integration
|
|
290
|
+
|
|
291
|
+
Invoked during:
|
|
292
|
+
- `/hustle-ui-create` Phase 11 (Visual Testing)
|
|
293
|
+
- `/hustle-ui-create-page` Phase 11 (Visual Testing)
|
|
294
|
+
|
|
295
|
+
## See Also
|
|
296
|
+
|
|
297
|
+
- `/test-unit` - Unit tests
|
|
298
|
+
- `/test-e2e` - E2E tests
|
|
299
|
+
- `/test-debug` - Debug failures
|
|
300
|
+
- `/ralph-loop` - Autonomous loop execution
|
|
301
|
+
- [docs/AUTONOMOUS_LOOPS.md](../../docs/AUTONOMOUS_LOOPS.md) - Pattern documentation
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: token-report
|
|
3
|
+
description: Generate token usage report by workflow phase
|
|
4
|
+
tools: Bash, Read
|
|
5
|
+
model: haiku
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Token Report Skill
|
|
9
|
+
|
|
10
|
+
Generate an **estimated** token usage report showing approximate costs by workflow phase.
|
|
11
|
+
|
|
12
|
+
> **Note:** Token counts are estimated based on ccusage session data correlated with
|
|
13
|
+
> phase timestamps. Actual usage may vary by ±10%. For precise billing, check your
|
|
14
|
+
> Anthropic dashboard.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- After completing an API workflow
|
|
19
|
+
- To understand cost distribution across phases
|
|
20
|
+
- For budget planning and optimization
|
|
21
|
+
- When investigating expensive operations
|
|
22
|
+
|
|
23
|
+
## Execution Steps
|
|
24
|
+
|
|
25
|
+
### Step 1: Check ccusage Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
which ccusage || npx ccusage --version
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If not installed:
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g ccusage
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Step 2: Read State File
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cat .claude/api-dev-state.json | jq '.token_usage'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 3: Get Current Session Usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx ccusage session --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Step 4: Generate Report
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
═══════════════════════════════════════════════════════
|
|
52
|
+
TOKEN USAGE REPORT (ESTIMATED)
|
|
53
|
+
═══════════════════════════════════════════════════════
|
|
54
|
+
|
|
55
|
+
Session Started: 2025-12-29 10:00:00
|
|
56
|
+
Total Duration: 45 minutes
|
|
57
|
+
|
|
58
|
+
Phase Breakdown:
|
|
59
|
+
─────────────────────────────────────────────────────
|
|
60
|
+
Phase Tokens Cost % Total
|
|
61
|
+
─────────────────────────────────────────────────────
|
|
62
|
+
1. Disambiguation 1,200 $0.01 2.7%
|
|
63
|
+
2. Scope 1,500 $0.02 3.3%
|
|
64
|
+
3. Initial Research 8,400 $0.08 18.7%
|
|
65
|
+
4. Interview 3,100 $0.03 6.9%
|
|
66
|
+
5. Deep Research 12,500 $0.13 27.8%
|
|
67
|
+
6. Schema 2,800 $0.03 6.2%
|
|
68
|
+
7. Environment 500 $0.01 1.1%
|
|
69
|
+
8. TDD Red 4,200 $0.04 9.3%
|
|
70
|
+
9. TDD Green 5,100 $0.05 11.3%
|
|
71
|
+
10. Verify 3,200 $0.03 7.1%
|
|
72
|
+
11. Code Review 1,500 $0.02 3.3%
|
|
73
|
+
12. Refactor 800 $0.01 1.8%
|
|
74
|
+
13. Documentation 200 $0.00 0.4%
|
|
75
|
+
14. Completion 100 $0.00 0.2%
|
|
76
|
+
─────────────────────────────────────────────────────
|
|
77
|
+
TOTAL 45,100 $0.45 100.0%
|
|
78
|
+
═══════════════════════════════════════════════════════
|
|
79
|
+
|
|
80
|
+
Cost Analysis:
|
|
81
|
+
─────────────────────────────────────────────────────
|
|
82
|
+
Most Expensive Phase: Deep Research (27.8%)
|
|
83
|
+
Optimization Tip: Use targeted searches to reduce research tokens
|
|
84
|
+
|
|
85
|
+
Research Phases: 40.5% of tokens
|
|
86
|
+
Implementation Phases: 20.6% of tokens
|
|
87
|
+
Verification Phases: 10.4% of tokens
|
|
88
|
+
─────────────────────────────────────────────────────
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Output Interpretation
|
|
92
|
+
|
|
93
|
+
| Metric | Good | Warning | Action |
|
|
94
|
+
|--------|------|---------|--------|
|
|
95
|
+
| Research % | < 40% | 40-60% | > 60% - Optimize queries |
|
|
96
|
+
| Interview % | < 10% | 10-20% | > 20% - Reduce questions |
|
|
97
|
+
| TDD % | 15-25% | 10-30% | < 10% - Insufficient testing |
|
|
98
|
+
|
|
99
|
+
## Arguments
|
|
100
|
+
|
|
101
|
+
| Argument | Description | Default |
|
|
102
|
+
|----------|-------------|---------|
|
|
103
|
+
| `--endpoint` | Specific endpoint to report | All |
|
|
104
|
+
| `--format` | Output format (text/json) | text |
|
|
105
|
+
| `--compare` | Compare with previous run | false |
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Full report
|
|
111
|
+
/token-report
|
|
112
|
+
|
|
113
|
+
# Specific endpoint
|
|
114
|
+
/token-report --endpoint=users-create
|
|
115
|
+
|
|
116
|
+
# JSON output for processing
|
|
117
|
+
/token-report --format=json
|
|
118
|
+
|
|
119
|
+
# Compare with last run
|
|
120
|
+
/token-report --compare
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Integration
|
|
124
|
+
|
|
125
|
+
This skill reads from:
|
|
126
|
+
- `.claude/api-dev-state.json` - Phase timestamps and token data
|
|
127
|
+
- ccusage logs - Session token counts
|
|
128
|
+
|
|
129
|
+
## See Also
|
|
130
|
+
|
|
131
|
+
- `/api-status` - Current workflow status
|
|
132
|
+
- `/api-verify` - Verification phase
|