forgecraft-mcp 1.2.0 → 1.3.2

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 (136) hide show
  1. package/README.md +525 -525
  2. package/dist/cli/help.js +44 -44
  3. package/dist/registry/renderer-skeletons.js +92 -92
  4. package/dist/shared/gs-score-logger.js +6 -6
  5. package/dist/tools/add-module.js +123 -123
  6. package/dist/tools/advice-registry.js +18 -18
  7. package/dist/tools/check-cascade-report.js +64 -64
  8. package/dist/tools/configure-mcp.d.ts +3 -0
  9. package/dist/tools/configure-mcp.d.ts.map +1 -1
  10. package/dist/tools/configure-mcp.js +10 -0
  11. package/dist/tools/configure-mcp.js.map +1 -1
  12. package/dist/tools/forgecraft-dispatch.d.ts.map +1 -1
  13. package/dist/tools/forgecraft-dispatch.js +3 -0
  14. package/dist/tools/forgecraft-dispatch.js.map +1 -1
  15. package/dist/tools/forgecraft-schema-params.d.ts +9 -0
  16. package/dist/tools/forgecraft-schema-params.d.ts.map +1 -1
  17. package/dist/tools/forgecraft-schema-params.js +21 -0
  18. package/dist/tools/forgecraft-schema-params.js.map +1 -1
  19. package/dist/tools/forgecraft-schema.d.ts +9 -0
  20. package/dist/tools/forgecraft-schema.d.ts.map +1 -1
  21. package/dist/tools/refresh-output.js +14 -14
  22. package/dist/tools/scaffold-spec-stubs.js +115 -115
  23. package/dist/tools/scaffold-templates.js +62 -62
  24. package/dist/tools/setup-artifact-writers.d.ts +30 -0
  25. package/dist/tools/setup-artifact-writers.d.ts.map +1 -1
  26. package/dist/tools/setup-artifact-writers.js +120 -8
  27. package/dist/tools/setup-artifact-writers.js.map +1 -1
  28. package/dist/tools/setup-phase1.d.ts +3 -0
  29. package/dist/tools/setup-phase1.d.ts.map +1 -1
  30. package/dist/tools/setup-phase1.js +79 -35
  31. package/dist/tools/setup-phase1.js.map +1 -1
  32. package/dist/tools/setup-phase2.d.ts +2 -0
  33. package/dist/tools/setup-phase2.d.ts.map +1 -1
  34. package/dist/tools/setup-phase2.js +10 -1
  35. package/dist/tools/setup-phase2.js.map +1 -1
  36. package/dist/tools/setup-project.d.ts +18 -0
  37. package/dist/tools/setup-project.d.ts.map +1 -1
  38. package/dist/tools/setup-project.js +77 -1
  39. package/dist/tools/setup-project.js.map +1 -1
  40. package/dist/tools/spec-parser-tags.d.ts +9 -0
  41. package/dist/tools/spec-parser-tags.d.ts.map +1 -1
  42. package/dist/tools/spec-parser-tags.js +92 -0
  43. package/dist/tools/spec-parser-tags.js.map +1 -1
  44. package/package.json +89 -86
  45. package/templates/analytics/instructions.yaml +37 -37
  46. package/templates/analytics/mcp-servers.yaml +11 -11
  47. package/templates/analytics/structure.yaml +25 -25
  48. package/templates/api/instructions.yaml +231 -231
  49. package/templates/api/mcp-servers.yaml +22 -13
  50. package/templates/api/nfr.yaml +23 -23
  51. package/templates/api/review.yaml +103 -103
  52. package/templates/api/structure.yaml +34 -34
  53. package/templates/api/verification.yaml +132 -132
  54. package/templates/cli/instructions.yaml +31 -31
  55. package/templates/cli/mcp-servers.yaml +11 -11
  56. package/templates/cli/review.yaml +53 -53
  57. package/templates/cli/structure.yaml +16 -16
  58. package/templates/data-lineage/instructions.yaml +28 -28
  59. package/templates/data-lineage/mcp-servers.yaml +22 -22
  60. package/templates/data-pipeline/instructions.yaml +84 -84
  61. package/templates/data-pipeline/mcp-servers.yaml +13 -13
  62. package/templates/data-pipeline/nfr.yaml +39 -39
  63. package/templates/data-pipeline/structure.yaml +23 -23
  64. package/templates/fintech/hooks.yaml +55 -55
  65. package/templates/fintech/instructions.yaml +112 -112
  66. package/templates/fintech/mcp-servers.yaml +13 -13
  67. package/templates/fintech/nfr.yaml +46 -46
  68. package/templates/fintech/playbook.yaml +210 -210
  69. package/templates/fintech/verification.yaml +239 -239
  70. package/templates/game/instructions.yaml +289 -289
  71. package/templates/game/mcp-servers.yaml +38 -38
  72. package/templates/game/nfr.yaml +64 -64
  73. package/templates/game/playbook.yaml +214 -214
  74. package/templates/game/review.yaml +97 -97
  75. package/templates/game/structure.yaml +67 -67
  76. package/templates/game/verification.yaml +174 -174
  77. package/templates/healthcare/instructions.yaml +42 -42
  78. package/templates/healthcare/mcp-servers.yaml +13 -13
  79. package/templates/healthcare/nfr.yaml +47 -47
  80. package/templates/hipaa/instructions.yaml +41 -41
  81. package/templates/hipaa/mcp-servers.yaml +13 -13
  82. package/templates/infra/instructions.yaml +104 -104
  83. package/templates/infra/mcp-servers.yaml +20 -20
  84. package/templates/infra/nfr.yaml +46 -46
  85. package/templates/infra/review.yaml +65 -65
  86. package/templates/infra/structure.yaml +25 -25
  87. package/templates/library/instructions.yaml +36 -36
  88. package/templates/library/mcp-servers.yaml +20 -20
  89. package/templates/library/review.yaml +56 -56
  90. package/templates/library/structure.yaml +19 -19
  91. package/templates/medallion-architecture/instructions.yaml +41 -41
  92. package/templates/medallion-architecture/mcp-servers.yaml +22 -22
  93. package/templates/ml/instructions.yaml +85 -85
  94. package/templates/ml/mcp-servers.yaml +11 -11
  95. package/templates/ml/nfr.yaml +39 -39
  96. package/templates/ml/structure.yaml +25 -25
  97. package/templates/ml/verification.yaml +156 -156
  98. package/templates/mobile/instructions.yaml +44 -44
  99. package/templates/mobile/mcp-servers.yaml +11 -11
  100. package/templates/mobile/nfr.yaml +49 -49
  101. package/templates/mobile/structure.yaml +27 -27
  102. package/templates/mobile/verification.yaml +121 -121
  103. package/templates/observability-xray/instructions.yaml +40 -40
  104. package/templates/observability-xray/mcp-servers.yaml +15 -15
  105. package/templates/realtime/instructions.yaml +42 -42
  106. package/templates/realtime/mcp-servers.yaml +13 -13
  107. package/templates/soc2/instructions.yaml +41 -41
  108. package/templates/soc2/mcp-servers.yaml +24 -24
  109. package/templates/social/instructions.yaml +43 -43
  110. package/templates/social/mcp-servers.yaml +24 -24
  111. package/templates/state-machine/instructions.yaml +42 -42
  112. package/templates/state-machine/mcp-servers.yaml +11 -11
  113. package/templates/tools-registry.yaml +164 -164
  114. package/templates/universal/hooks.yaml +531 -531
  115. package/templates/universal/instructions.yaml +1692 -1692
  116. package/templates/universal/mcp-servers.yaml +50 -50
  117. package/templates/universal/nfr.yaml +197 -197
  118. package/templates/universal/reference.yaml +326 -326
  119. package/templates/universal/review.yaml +204 -204
  120. package/templates/universal/skills.yaml +262 -262
  121. package/templates/universal/structure.yaml +67 -67
  122. package/templates/universal/verification.yaml +416 -416
  123. package/templates/web-react/hooks.yaml +44 -44
  124. package/templates/web-react/instructions.yaml +207 -207
  125. package/templates/web-react/mcp-servers.yaml +20 -20
  126. package/templates/web-react/nfr.yaml +27 -27
  127. package/templates/web-react/review.yaml +94 -94
  128. package/templates/web-react/structure.yaml +46 -46
  129. package/templates/web-react/verification.yaml +126 -126
  130. package/templates/web-static/instructions.yaml +115 -115
  131. package/templates/web-static/mcp-servers.yaml +20 -20
  132. package/templates/web3/instructions.yaml +44 -44
  133. package/templates/web3/mcp-servers.yaml +11 -11
  134. package/templates/web3/verification.yaml +159 -159
  135. package/templates/zero-trust/instructions.yaml +41 -41
  136. package/templates/zero-trust/mcp-servers.yaml +15 -15
@@ -1,94 +1,94 @@
1
- tag: WEB-REACT
2
- section: review
3
- blocks:
4
- - id: react-architecture-review
5
- tier: recommended
6
- dimension: architecture
7
- title: "React Architecture Review"
8
- description: |
9
- Evaluate component hierarchy, state management, and rendering patterns.
10
- checklist:
11
- - id: component-hierarchy
12
- description: "Atomic Design followed: atoms → molecules → organisms → templates → pages."
13
- severity: important
14
- - id: component-purity
15
- description: "Components are pure UI. No API calls or business logic inside components."
16
- severity: critical
17
- - id: state-management
18
- description: "State management follows hierarchy: local → context → global store. No prop drilling > 2 levels."
19
- severity: important
20
- - id: route-structure
21
- description: "Routes organized by feature. Lazy loading for non-critical routes."
22
- severity: nice-to-have
23
-
24
- - id: react-code-quality-review
25
- tier: recommended
26
- dimension: code-quality
27
- title: "React Code Quality Review"
28
- description: |
29
- Evaluate component patterns, hooks usage, and i18n compliance.
30
- checklist:
31
- - id: i18n-compliance
32
- description: "Every user-facing string goes through the i18n system. No hardcoded text in JSX."
33
- severity: critical
34
- - id: accessibility
35
- description: "WCAG 2.1 AA compliance: semantic HTML, ARIA labels, keyboard navigation, focus management."
36
- severity: critical
37
- - id: hooks-patterns
38
- description: "Custom hooks extract reusable logic. No complex useEffect chains. Dependencies arrays are correct."
39
- severity: important
40
- - id: key-props
41
- description: "List renderings use stable, unique keys. No array index as key for dynamic lists."
42
- severity: important
43
- - id: error-boundaries
44
- description: "Feature areas wrapped in Error Boundaries. Crash in one widget doesn’t take down the page."
45
- severity: critical
46
- - id: suspense-loading
47
- description: "Every async operation has loading, success, and error states. No blank screens. Skeleton loaders for layout stability."
48
- severity: important
49
-
50
- - id: react-performance-review
51
- tier: recommended
52
- dimension: performance
53
- title: "React Performance Review"
54
- description: |
55
- Evaluate rendering efficiency, bundle size, and lazy loading.
56
- checklist:
57
- - id: unnecessary-rerenders
58
- description: "No unnecessary re-renders. React.memo, useMemo, useCallback used where measurably impactful."
59
- severity: important
60
- - id: bundle-size
61
- description: "Bundle size monitored. No full-library imports (use tree-shakeable named imports)."
62
- severity: important
63
- - id: image-optimization
64
- description: "Images optimized: lazy loading, responsive srcset, modern formats (WebP/AVIF)."
65
- severity: nice-to-have
66
- - id: core-web-vitals
67
- description: "Core Web Vitals tracked: LCP < 2.5s, FID < 100ms, CLS < 0.1."
68
- severity: important
69
- - id: bundle-budget
70
- description: "JavaScript bundle within budget. Initial load under 200 KB compressed. Lighthouse CI enforced in pipeline."
71
- severity: important
72
- - id: preview-deployments
73
- description: "PR preview deployments enabled. URL posted in PR comments for stakeholder review."
74
- severity: nice-to-have
75
- - id: cache-headers
76
- description: "Hashed assets use immutable cache headers. HTML uses short-lived cache with stale-while-revalidate."
77
- severity: important
78
-
79
- - id: react-test-review
80
- tier: recommended
81
- dimension: tests
82
- title: "React Test Review"
83
- description: |
84
- Evaluate React-specific testing patterns.
85
- checklist:
86
- - id: error-boundary-coverage
87
- description: "Error boundaries tested: verify fallback UI renders on component errors. Error reporting verified."
88
- severity: important
89
- - id: loading-error-states
90
- description: "All async operations tested in three states: loading, success, error. No untested blank screens."
91
- severity: critical
92
- - id: user-interaction-tests
93
- description: "Key user flows tested via integration tests (Testing Library). Tests interact as a user would, not via implementation details."
94
- severity: critical
1
+ tag: WEB-REACT
2
+ section: review
3
+ blocks:
4
+ - id: react-architecture-review
5
+ tier: recommended
6
+ dimension: architecture
7
+ title: "React Architecture Review"
8
+ description: |
9
+ Evaluate component hierarchy, state management, and rendering patterns.
10
+ checklist:
11
+ - id: component-hierarchy
12
+ description: "Atomic Design followed: atoms → molecules → organisms → templates → pages."
13
+ severity: important
14
+ - id: component-purity
15
+ description: "Components are pure UI. No API calls or business logic inside components."
16
+ severity: critical
17
+ - id: state-management
18
+ description: "State management follows hierarchy: local → context → global store. No prop drilling > 2 levels."
19
+ severity: important
20
+ - id: route-structure
21
+ description: "Routes organized by feature. Lazy loading for non-critical routes."
22
+ severity: nice-to-have
23
+
24
+ - id: react-code-quality-review
25
+ tier: recommended
26
+ dimension: code-quality
27
+ title: "React Code Quality Review"
28
+ description: |
29
+ Evaluate component patterns, hooks usage, and i18n compliance.
30
+ checklist:
31
+ - id: i18n-compliance
32
+ description: "Every user-facing string goes through the i18n system. No hardcoded text in JSX."
33
+ severity: critical
34
+ - id: accessibility
35
+ description: "WCAG 2.1 AA compliance: semantic HTML, ARIA labels, keyboard navigation, focus management."
36
+ severity: critical
37
+ - id: hooks-patterns
38
+ description: "Custom hooks extract reusable logic. No complex useEffect chains. Dependencies arrays are correct."
39
+ severity: important
40
+ - id: key-props
41
+ description: "List renderings use stable, unique keys. No array index as key for dynamic lists."
42
+ severity: important
43
+ - id: error-boundaries
44
+ description: "Feature areas wrapped in Error Boundaries. Crash in one widget doesn’t take down the page."
45
+ severity: critical
46
+ - id: suspense-loading
47
+ description: "Every async operation has loading, success, and error states. No blank screens. Skeleton loaders for layout stability."
48
+ severity: important
49
+
50
+ - id: react-performance-review
51
+ tier: recommended
52
+ dimension: performance
53
+ title: "React Performance Review"
54
+ description: |
55
+ Evaluate rendering efficiency, bundle size, and lazy loading.
56
+ checklist:
57
+ - id: unnecessary-rerenders
58
+ description: "No unnecessary re-renders. React.memo, useMemo, useCallback used where measurably impactful."
59
+ severity: important
60
+ - id: bundle-size
61
+ description: "Bundle size monitored. No full-library imports (use tree-shakeable named imports)."
62
+ severity: important
63
+ - id: image-optimization
64
+ description: "Images optimized: lazy loading, responsive srcset, modern formats (WebP/AVIF)."
65
+ severity: nice-to-have
66
+ - id: core-web-vitals
67
+ description: "Core Web Vitals tracked: LCP < 2.5s, FID < 100ms, CLS < 0.1."
68
+ severity: important
69
+ - id: bundle-budget
70
+ description: "JavaScript bundle within budget. Initial load under 200 KB compressed. Lighthouse CI enforced in pipeline."
71
+ severity: important
72
+ - id: preview-deployments
73
+ description: "PR preview deployments enabled. URL posted in PR comments for stakeholder review."
74
+ severity: nice-to-have
75
+ - id: cache-headers
76
+ description: "Hashed assets use immutable cache headers. HTML uses short-lived cache with stale-while-revalidate."
77
+ severity: important
78
+
79
+ - id: react-test-review
80
+ tier: recommended
81
+ dimension: tests
82
+ title: "React Test Review"
83
+ description: |
84
+ Evaluate React-specific testing patterns.
85
+ checklist:
86
+ - id: error-boundary-coverage
87
+ description: "Error boundaries tested: verify fallback UI renders on component errors. Error reporting verified."
88
+ severity: important
89
+ - id: loading-error-states
90
+ description: "All async operations tested in three states: loading, success, error. No untested blank screens."
91
+ severity: critical
92
+ - id: user-interaction-tests
93
+ description: "Key user flows tested via integration tests (Testing Library). Tests interact as a user would, not via implementation details."
94
+ severity: critical
@@ -1,46 +1,46 @@
1
- tag: WEB-REACT
2
- section: structure
3
- language: typescript
4
- entries:
5
- - path: src/app
6
- type: directory
7
- description: "App shell, providers, router config"
8
- - path: src/app/App.tsx
9
- type: file
10
- description: "Root component with providers"
11
- - path: src/app/router.tsx
12
- type: file
13
- description: "ALL routes defined here as config"
14
- - path: src/app/providers
15
- type: directory
16
- description: "Context providers (auth, theme, i18n)"
17
- - path: src/app/layouts
18
- type: directory
19
- description: "Layout components (sidebar, header, etc.)"
20
- - path: src/features
21
- type: directory
22
- description: "Feature modules (self-contained)"
23
- - path: src/shared/api
24
- type: directory
25
- description: "Centralized API client"
26
- - path: src/shared/components
27
- type: directory
28
- description: "Reusable UI components (atoms, molecules)"
29
- - path: src/shared/hooks
30
- type: directory
31
- description: "Shared hooks (useDebounce, useMediaQuery, etc.)"
32
- - path: src/shared/config
33
- type: directory
34
- description: "Nav config, env access, constants"
35
- - path: src/locales
36
- type: directory
37
- description: "i18n translation files"
38
- - path: src/locales/en
39
- type: directory
40
- description: "English translations"
41
- - path: src/styles
42
- type: directory
43
- description: "Global styles, theme, tokens"
44
- - path: tests/e2e
45
- type: directory
46
- description: "Playwright tests"
1
+ tag: WEB-REACT
2
+ section: structure
3
+ language: typescript
4
+ entries:
5
+ - path: src/app
6
+ type: directory
7
+ description: "App shell, providers, router config"
8
+ - path: src/app/App.tsx
9
+ type: file
10
+ description: "Root component with providers"
11
+ - path: src/app/router.tsx
12
+ type: file
13
+ description: "ALL routes defined here as config"
14
+ - path: src/app/providers
15
+ type: directory
16
+ description: "Context providers (auth, theme, i18n)"
17
+ - path: src/app/layouts
18
+ type: directory
19
+ description: "Layout components (sidebar, header, etc.)"
20
+ - path: src/features
21
+ type: directory
22
+ description: "Feature modules (self-contained)"
23
+ - path: src/shared/api
24
+ type: directory
25
+ description: "Centralized API client"
26
+ - path: src/shared/components
27
+ type: directory
28
+ description: "Reusable UI components (atoms, molecules)"
29
+ - path: src/shared/hooks
30
+ type: directory
31
+ description: "Shared hooks (useDebounce, useMediaQuery, etc.)"
32
+ - path: src/shared/config
33
+ type: directory
34
+ description: "Nav config, env access, constants"
35
+ - path: src/locales
36
+ type: directory
37
+ description: "i18n translation files"
38
+ - path: src/locales/en
39
+ type: directory
40
+ description: "English translations"
41
+ - path: src/styles
42
+ type: directory
43
+ description: "Global styles, theme, tokens"
44
+ - path: tests/e2e
45
+ type: directory
46
+ description: "Playwright tests"
@@ -1,126 +1,126 @@
1
- tag: WEB-REACT
2
- section: verification
3
- title: "Behavioral Navigation Verification"
4
- description: >
5
- UI behavior cannot be verified by type checks or unit tests alone. Correct
6
- behavior means: the right elements are visible at the right URLs, interactions
7
- produce the right state transitions, and the UI matches the design spec visually.
8
- This strategy uses Playwright for navigational path execution and Claude Vision
9
- for visual contract assertion — closing the behavioral uncertainty dimension.
10
- uncertainty_levels:
11
- - behavioral
12
- completeness_ceiling: 0.85
13
-
14
- phases:
15
-
16
- - id: contract-definition
17
- title: "Define Navigation Contracts and Visual Expectations"
18
- rationale: >
19
- A behavioral contract is a precise description of: which URL renders which component,
20
- which user actions trigger which state transitions, and what the page looks like at
21
- each checkpoint. Without explicit contracts, visual regressions and interaction bugs
22
- are invisible to the automated verify loop.
23
- steps:
24
- - id: define-use-case-paths
25
- instruction: >
26
- For every user-facing feature, write a use-case navigational path as a numbered list:
27
- 1. Starting URL and initial state
28
- 2. Each user action (click, fill, submit, navigate) in order
29
- 3. Expected URL and visible DOM elements after each action
30
- 4. Terminal state (e.g., "success toast visible, redirect to /dashboard")
31
- Store in docs/use-cases/{feature}.md. Minimum one path per route group.
32
- contract: >
33
- docs/use-cases/ directory exists with one file per feature.
34
- Each file has a numbered step list with URL, action, and assertion per step.
35
- tools: ["filesystem"]
36
- expected_output: "docs/use-cases/auth.md, docs/use-cases/articles.md, etc."
37
- pass_criterion: "File count in docs/use-cases/ ≥ number of route groups"
38
-
39
- - id: define-visual-snapshots
40
- instruction: >
41
- For every major page state (empty state, loaded state, error state), define a
42
- visual expectation in plain English that Claude Vision can assert against a screenshot:
43
- e.g., "The navbar shows the user avatar. The feed contains at least one article card.
44
- The sidebar is absent on mobile viewport."
45
- Store expectations in docs/visual-contracts/{page}.md.
46
- contract: >
47
- docs/visual-contracts/ exists. Each file lists named states with prose
48
- visual expectations that are unambiguous.
49
- tools: ["filesystem"]
50
- expected_output: "docs/visual-contracts/feed.md with 'loaded_state', 'empty_state', 'error_state' sections"
51
- pass_criterion: "File count in docs/visual-contracts/ ≥ number of pages"
52
-
53
- - id: execution
54
- title: "Run Playwright Paths + Claude Vision Assertions"
55
- rationale: >
56
- Playwright drives the browser headlessly and captures screenshots at each checkpoint.
57
- Claude Vision asserts the screenshot against the visual contract — this is the only
58
- technique that catches layout breakage, missing elements, and wrong copy in one pass.
59
- steps:
60
- - id: run-playwright-navigation
61
- instruction: >
62
- For each use-case path in docs/use-cases/, write a Playwright test that:
63
- 1. Navigates to the starting URL
64
- 2. Executes each action in the numbered list
65
- 3. Takes a screenshot after every state transition
66
- 4. Asserts on DOM elements cited in the contract (getByRole, getByText, toBeVisible)
67
- Run with `npx playwright test` in headless mode.
68
- contract: >
69
- Playwright test file exists per use-case. All DOM assertions in the contract
70
- are expressed as Playwright locators. Test run exits 0.
71
- tools: ["npx playwright test", "npx playwright codegen"]
72
- expected_output: "Playwright HTML report + screenshots in test-results/playwright/"
73
- pass_criterion: "playwright test exits 0; 0 failing tests"
74
-
75
- - id: assert-screenshots-with-vision
76
- instruction: >
77
- For each screenshot taken by Playwright, call Claude Vision with:
78
- - The screenshot file path
79
- - The visual contract from docs/visual-contracts/{page}.md for that state
80
- - The prompt: "Assert this screenshot against the following visual contract.
81
- List every contract item that FAILS. If all items pass, respond: PASS."
82
- Record the response. Any response other than PASS is a failure.
83
- contract: >
84
- Every screenshot has a corresponding vision assertion result.
85
- All results are PASS for the final verify loop iteration.
86
- tools: ["claude --vision", "anthropic vision API", "openai vision API"]
87
- expected_output: "vision-assertions.json: [{screenshot, contract_state, result: PASS|FAIL, failures: [...]}]"
88
- pass_criterion: "All vision assertion results = PASS"
89
- requires_human_review: true
90
-
91
- - id: run-accessibility-check
92
- instruction: >
93
- Run axe-core or @axe-core/playwright on every page visited.
94
- Zero critical or serious violations are allowed.
95
- Document all moderate violations for backlog.
96
- contract: "0 critical or serious axe violations on any page"
97
- tools: ["@axe-core/playwright", "axe-core"]
98
- expected_output: "axe-report.json per page with violations array"
99
- pass_criterion: "critical + serious violation count = 0 across all pages"
100
-
101
- - id: evidence
102
- title: "Persist Screenshots, Vision Results, and Traces"
103
- rationale: >
104
- Screenshots and vision assertion results are the ground truth for behavioral
105
- verification. They must be persisted so regressions are detectable across
106
- Playwright test runs, CI runs, and GS loop passes.
107
- steps:
108
- - id: persist-playwright-report
109
- instruction: >
110
- Save Playwright HTML report to test-results/playwright/index.html.
111
- Save all screenshots to test-results/playwright/screenshots/{test-name}/{step}.png.
112
- On failure, save the Playwright trace zip for each failing test.
113
- contract: "test-results/playwright/ exists with report and screenshots"
114
- tools: ["playwright --reporter=html"]
115
- expected_output: "HTML report + PNG per checkpoint + trace.zip on failure"
116
- pass_criterion: "test-results/playwright/index.html exists"
117
-
118
- - id: persist-vision-assertions
119
- instruction: >
120
- Save vision-assertions.json to test-results/vision-assertions.json.
121
- Summary: total assertions, pass count, fail count, list of failed contracts.
122
- If any assertion fails, the FAIL details become the fix prompt input for next pass.
123
- contract: "vision-assertions.json exists with integer pass and fail counts"
124
- tools: ["jq", "node"]
125
- expected_output: '{"total": 12, "passed": 11, "failed": 1, "failures": [...]}'
126
- pass_criterion: "File parses; failed count = 0 for strategy to be complete"
1
+ tag: WEB-REACT
2
+ section: verification
3
+ title: "Behavioral Navigation Verification"
4
+ description: >
5
+ UI behavior cannot be verified by type checks or unit tests alone. Correct
6
+ behavior means: the right elements are visible at the right URLs, interactions
7
+ produce the right state transitions, and the UI matches the design spec visually.
8
+ This strategy uses Playwright for navigational path execution and Claude Vision
9
+ for visual contract assertion — closing the behavioral uncertainty dimension.
10
+ uncertainty_levels:
11
+ - behavioral
12
+ completeness_ceiling: 0.85
13
+
14
+ phases:
15
+
16
+ - id: contract-definition
17
+ title: "Define Navigation Contracts and Visual Expectations"
18
+ rationale: >
19
+ A behavioral contract is a precise description of: which URL renders which component,
20
+ which user actions trigger which state transitions, and what the page looks like at
21
+ each checkpoint. Without explicit contracts, visual regressions and interaction bugs
22
+ are invisible to the automated verify loop.
23
+ steps:
24
+ - id: define-use-case-paths
25
+ instruction: >
26
+ For every user-facing feature, write a use-case navigational path as a numbered list:
27
+ 1. Starting URL and initial state
28
+ 2. Each user action (click, fill, submit, navigate) in order
29
+ 3. Expected URL and visible DOM elements after each action
30
+ 4. Terminal state (e.g., "success toast visible, redirect to /dashboard")
31
+ Store in docs/use-cases/{feature}.md. Minimum one path per route group.
32
+ contract: >
33
+ docs/use-cases/ directory exists with one file per feature.
34
+ Each file has a numbered step list with URL, action, and assertion per step.
35
+ tools: ["filesystem"]
36
+ expected_output: "docs/use-cases/auth.md, docs/use-cases/articles.md, etc."
37
+ pass_criterion: "File count in docs/use-cases/ ≥ number of route groups"
38
+
39
+ - id: define-visual-snapshots
40
+ instruction: >
41
+ For every major page state (empty state, loaded state, error state), define a
42
+ visual expectation in plain English that Claude Vision can assert against a screenshot:
43
+ e.g., "The navbar shows the user avatar. The feed contains at least one article card.
44
+ The sidebar is absent on mobile viewport."
45
+ Store expectations in docs/visual-contracts/{page}.md.
46
+ contract: >
47
+ docs/visual-contracts/ exists. Each file lists named states with prose
48
+ visual expectations that are unambiguous.
49
+ tools: ["filesystem"]
50
+ expected_output: "docs/visual-contracts/feed.md with 'loaded_state', 'empty_state', 'error_state' sections"
51
+ pass_criterion: "File count in docs/visual-contracts/ ≥ number of pages"
52
+
53
+ - id: execution
54
+ title: "Run Playwright Paths + Claude Vision Assertions"
55
+ rationale: >
56
+ Playwright drives the browser headlessly and captures screenshots at each checkpoint.
57
+ Claude Vision asserts the screenshot against the visual contract — this is the only
58
+ technique that catches layout breakage, missing elements, and wrong copy in one pass.
59
+ steps:
60
+ - id: run-playwright-navigation
61
+ instruction: >
62
+ For each use-case path in docs/use-cases/, write a Playwright test that:
63
+ 1. Navigates to the starting URL
64
+ 2. Executes each action in the numbered list
65
+ 3. Takes a screenshot after every state transition
66
+ 4. Asserts on DOM elements cited in the contract (getByRole, getByText, toBeVisible)
67
+ Run with `npx playwright test` in headless mode.
68
+ contract: >
69
+ Playwright test file exists per use-case. All DOM assertions in the contract
70
+ are expressed as Playwright locators. Test run exits 0.
71
+ tools: ["npx playwright test", "npx playwright codegen"]
72
+ expected_output: "Playwright HTML report + screenshots in test-results/playwright/"
73
+ pass_criterion: "playwright test exits 0; 0 failing tests"
74
+
75
+ - id: assert-screenshots-with-vision
76
+ instruction: >
77
+ For each screenshot taken by Playwright, call Claude Vision with:
78
+ - The screenshot file path
79
+ - The visual contract from docs/visual-contracts/{page}.md for that state
80
+ - The prompt: "Assert this screenshot against the following visual contract.
81
+ List every contract item that FAILS. If all items pass, respond: PASS."
82
+ Record the response. Any response other than PASS is a failure.
83
+ contract: >
84
+ Every screenshot has a corresponding vision assertion result.
85
+ All results are PASS for the final verify loop iteration.
86
+ tools: ["claude --vision", "anthropic vision API", "openai vision API"]
87
+ expected_output: "vision-assertions.json: [{screenshot, contract_state, result: PASS|FAIL, failures: [...]}]"
88
+ pass_criterion: "All vision assertion results = PASS"
89
+ requires_human_review: true
90
+
91
+ - id: run-accessibility-check
92
+ instruction: >
93
+ Run axe-core or @axe-core/playwright on every page visited.
94
+ Zero critical or serious violations are allowed.
95
+ Document all moderate violations for backlog.
96
+ contract: "0 critical or serious axe violations on any page"
97
+ tools: ["@axe-core/playwright", "axe-core"]
98
+ expected_output: "axe-report.json per page with violations array"
99
+ pass_criterion: "critical + serious violation count = 0 across all pages"
100
+
101
+ - id: evidence
102
+ title: "Persist Screenshots, Vision Results, and Traces"
103
+ rationale: >
104
+ Screenshots and vision assertion results are the ground truth for behavioral
105
+ verification. They must be persisted so regressions are detectable across
106
+ Playwright test runs, CI runs, and GS loop passes.
107
+ steps:
108
+ - id: persist-playwright-report
109
+ instruction: >
110
+ Save Playwright HTML report to test-results/playwright/index.html.
111
+ Save all screenshots to test-results/playwright/screenshots/{test-name}/{step}.png.
112
+ On failure, save the Playwright trace zip for each failing test.
113
+ contract: "test-results/playwright/ exists with report and screenshots"
114
+ tools: ["playwright --reporter=html"]
115
+ expected_output: "HTML report + PNG per checkpoint + trace.zip on failure"
116
+ pass_criterion: "test-results/playwright/index.html exists"
117
+
118
+ - id: persist-vision-assertions
119
+ instruction: >
120
+ Save vision-assertions.json to test-results/vision-assertions.json.
121
+ Summary: total assertions, pass count, fail count, list of failed contracts.
122
+ If any assertion fails, the FAIL details become the fix prompt input for next pass.
123
+ contract: "vision-assertions.json exists with integer pass and fail counts"
124
+ tools: ["jq", "node"]
125
+ expected_output: '{"total": 12, "passed": 11, "failed": 1, "failures": [...]}'
126
+ pass_criterion: "File parses; failed count = 0 for strategy to be complete"