qfai 1.7.9 → 1.7.13

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 (151) hide show
  1. package/README.md +34 -70
  2. package/assets/init/.qfai/README.md +11 -16
  3. package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +51 -0
  4. package/assets/init/.qfai/assistant/agents/architecture-reviewer.md +57 -0
  5. package/assets/init/.qfai/assistant/agents/backend-engineer.md +40 -31
  6. package/assets/init/.qfai/assistant/agents/completion-reviewer.md +48 -0
  7. package/assets/init/.qfai/assistant/agents/delivery-planner.md +52 -0
  8. package/assets/init/.qfai/assistant/agents/devops-ci-engineer.md +31 -28
  9. package/assets/init/.qfai/assistant/agents/discovery-analyst.md +50 -0
  10. package/assets/init/.qfai/assistant/agents/doc-steward.md +30 -20
  11. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +40 -31
  12. package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +58 -0
  13. package/assets/init/.qfai/assistant/agents/orchestrator.md +19 -2
  14. package/assets/init/.qfai/assistant/agents/product-experience-architect.md +59 -0
  15. package/assets/init/.qfai/assistant/agents/product-surface-reviewer.md +60 -0
  16. package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +53 -48
  17. package/assets/init/.qfai/assistant/agents/qa-strategist.md +49 -0
  18. package/assets/init/.qfai/assistant/agents/requirements-analyst.md +32 -29
  19. package/assets/init/.qfai/assistant/agents/requirements-reviewer.md +48 -0
  20. package/assets/init/.qfai/assistant/agents/solution-architect.md +59 -0
  21. package/assets/init/.qfai/assistant/agents/test-design-analyst.md +64 -0
  22. package/assets/init/.qfai/assistant/instructions/agent-selection.md +64 -50
  23. package/assets/init/.qfai/assistant/instructions/communication.md +17 -0
  24. package/assets/init/.qfai/assistant/instructions/constitution.md +36 -1
  25. package/assets/init/.qfai/assistant/instructions/drift-protocol.md +1 -1
  26. package/assets/init/.qfai/assistant/instructions/requirements-decomposition.md +20 -13
  27. package/assets/init/.qfai/assistant/instructions/workflow.md +2 -1
  28. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +32 -31
  29. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +80 -0
  30. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +21 -15
  31. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +95 -61
  32. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +17 -85
  33. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +9 -1
  34. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +1 -1
  35. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +17 -60
  36. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/04_Sources.md +69 -2
  37. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/06_REQ.md +1 -1
  38. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +1 -1
  39. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +1 -1
  40. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +1 -1
  41. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +1 -1
  42. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +1 -1
  43. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/13_Deferred.md +1 -1
  44. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +25 -16
  45. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +1 -1
  46. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/prototyping.yaml +9 -0
  47. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +8 -4
  48. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +11 -7
  49. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/summary.json +6 -44
  50. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/00_index.md +29 -14
  51. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/10_implementation_strategy.md +20 -0
  52. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/11_design_taste_interview.md +45 -0
  53. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/20_design_eval_invariant.md +68 -0
  54. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/21_design_eval_trend_derived.md +68 -0
  55. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/22_design_eval_product_specific.md +68 -0
  56. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/23_design_eval_aggregate.md +41 -0
  57. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/24_design_eval_dynamic_overrides.md +28 -0
  58. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/30_option_comparison.md +56 -0
  59. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/31_selected_anchor_screen.md +42 -0
  60. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +44 -0
  61. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +36 -0
  62. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +65 -67
  63. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +171 -279
  64. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +91 -57
  65. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +21 -80
  66. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/import-lite.md +1 -1
  67. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +50 -0
  68. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/06_Test-Cases.md +23 -3
  69. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +25 -17
  70. package/assets/init/.qfai/assistant/steering/agent-catalog.yml +194 -0
  71. package/assets/init/.qfai/assistant/steering/agent-routing.yml +176 -0
  72. package/assets/init/.qfai/assistant/steering/cli-ux-guidelines.md +49 -0
  73. package/assets/init/.qfai/assistant/steering/manifest.md +44 -19
  74. package/assets/init/.qfai/assistant/steering/product.md +53 -11
  75. package/assets/init/.qfai/assistant/steering/research-first-protocol.md +58 -0
  76. package/assets/init/.qfai/assistant/steering/review-gate.rules.yml +17 -66
  77. package/assets/init/.qfai/assistant/steering/review-profiles.yml +30 -0
  78. package/assets/init/.qfai/assistant/steering/structure.md +30 -16
  79. package/assets/init/.qfai/assistant/steering/tech.md +37 -21
  80. package/assets/init/.qfai/assistant/steering/ui-definition-protocol.md +54 -0
  81. package/assets/init/.qfai/contracts/README.md +10 -4
  82. package/assets/init/.qfai/contracts/design/README.md +32 -0
  83. package/assets/init/.qfai/contracts/ui/README.md +5 -3
  84. package/assets/init/.qfai/discussion/README.md +52 -5
  85. package/assets/init/.qfai/evidence/README.md +143 -116
  86. package/assets/init/.qfai/report/README.md +1 -1
  87. package/assets/init/.qfai/review/README.md +24 -9
  88. package/assets/init/.qfai/specs/README.md +5 -2
  89. package/assets/init/root/qfai.config.yaml +13 -0
  90. package/assets/uix-rev/comparison-review.md +24 -7
  91. package/assets/uix-rev/contracts-review.md +17 -10
  92. package/assets/uix-rev/scoring-review.md +42 -6
  93. package/assets/uix-rev/strategy-review.md +13 -9
  94. package/dist/cli/index.cjs +15618 -11547
  95. package/dist/cli/index.cjs.map +1 -1
  96. package/dist/cli/index.mjs +15487 -11415
  97. package/dist/cli/index.mjs.map +1 -1
  98. package/dist/index.cjs +10486 -6080
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.d.cts +766 -198
  101. package/dist/index.d.ts +766 -198
  102. package/dist/index.mjs +10823 -6420
  103. package/dist/index.mjs.map +1 -1
  104. package/package.json +11 -3
  105. package/assets/init/.qfai/assistant/agents/architect-reviewer.md +0 -65
  106. package/assets/init/.qfai/assistant/agents/architect.md +0 -49
  107. package/assets/init/.qfai/assistant/agents/atdd-api-implementer.md +0 -49
  108. package/assets/init/.qfai/assistant/agents/atdd-e2e-implementer.md +0 -48
  109. package/assets/init/.qfai/assistant/agents/atdd-integration-implementer.md +0 -48
  110. package/assets/init/.qfai/assistant/agents/backend-reviewer.md +0 -66
  111. package/assets/init/.qfai/assistant/agents/code-reviewer.md +0 -67
  112. package/assets/init/.qfai/assistant/agents/contract-designer.md +0 -49
  113. package/assets/init/.qfai/assistant/agents/coverage-planner.md +0 -49
  114. package/assets/init/.qfai/assistant/agents/design-owner.md +0 -48
  115. package/assets/init/.qfai/assistant/agents/design-review-lead.md +0 -68
  116. package/assets/init/.qfai/assistant/agents/facilitator.md +0 -48
  117. package/assets/init/.qfai/assistant/agents/frontend-reviewer.md +0 -66
  118. package/assets/init/.qfai/assistant/agents/interviewer.md +0 -45
  119. package/assets/init/.qfai/assistant/agents/option-explorer.md +0 -51
  120. package/assets/init/.qfai/assistant/agents/option-reviewer.md +0 -66
  121. package/assets/init/.qfai/assistant/agents/oq-harvester.md +0 -50
  122. package/assets/init/.qfai/assistant/agents/oq-reviewer.md +0 -70
  123. package/assets/init/.qfai/assistant/agents/planner.md +0 -48
  124. package/assets/init/.qfai/assistant/agents/project-lead.md +0 -47
  125. package/assets/init/.qfai/assistant/agents/prototyping-coverage-auditor.md +0 -46
  126. package/assets/init/.qfai/assistant/agents/qa-engineer.md +0 -47
  127. package/assets/init/.qfai/assistant/agents/qa-lead.md +0 -44
  128. package/assets/init/.qfai/assistant/agents/qa-reviewer.md +0 -66
  129. package/assets/init/.qfai/assistant/agents/researcher.md +0 -47
  130. package/assets/init/.qfai/assistant/agents/reviewer.md +0 -62
  131. package/assets/init/.qfai/assistant/agents/runtime-gatekeeper.md +0 -46
  132. package/assets/init/.qfai/assistant/agents/test-case-owner.md +0 -53
  133. package/assets/init/.qfai/assistant/agents/test-engineer.md +0 -50
  134. package/assets/init/.qfai/assistant/agents/test-volume-estimator.md +0 -48
  135. package/assets/init/.qfai/assistant/agents/ui-ux-reviewer.md +0 -71
  136. package/assets/init/.qfai/assistant/agents/unit-test-scope-enforcer.md +0 -46
  137. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/10_strategy.md +0 -28
  138. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/20_eval_axis_usability.md +0 -31
  139. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/21_eval_axis_consistency.md +0 -31
  140. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/22_eval_axis_accessibility.md +0 -31
  141. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/23_eval_axis_delight.md +0 -56
  142. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/30_comparison.md +0 -45
  143. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/31_anchor.md +0 -27
  144. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_contracts.md +0 -51
  145. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_bundle.md +0 -31
  146. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/60_critique_loop.md +0 -23
  147. package/assets/init/.qfai/assistant/skills/qfai-prototyping-full-harness/SKILL.md +0 -185
  148. package/assets/init/.qfai/assistant/steering/review-roster.yml +0 -128
  149. package/assets/init/.qfai/evidence/.gitignore +0 -3
  150. package/assets/init/.qfai/report/.gitignore +0 -3
  151. package/assets/init/.qfai/review/.gitignore +0 -5
@@ -27,34 +27,16 @@ optional:
27
27
  - OpenQuestions
28
28
  - Delta
29
29
 
30
+ agent_routing:
31
+ catalog_ssot: .qfai/assistant/steering/agent-catalog.yml
32
+ routing_ssot: .qfai/assistant/steering/agent-routing.yml
33
+ review_profiles_ssot: .qfai/assistant/steering/review-profiles.yml
34
+
30
35
  reviewers:
31
- minimum: 12
32
- roster_ssot: .qfai/assistant/steering/review-roster.yml
36
+ minimum: 1
33
37
  required:
34
- - id: qa-lead
35
- role: Quality Lead
36
- - id: qa-gatekeeper
37
- role: QA Gatekeeper
38
- - id: reviewer
39
- role: Independent Reviewer
40
- - id: code-reviewer
41
- role: Code Reviewer
42
- - id: architect-reviewer
43
- role: Architect Reviewer
44
- - id: qa-reviewer
45
- role: QA Reviewer
46
- - id: frontend-reviewer
47
- role: Frontend Reviewer
48
- - id: backend-reviewer
49
- role: Backend Reviewer
50
- - id: design-review-lead
51
- role: Design Review Lead
52
- - id: runtime-gatekeeper
53
- role: Runtime Gatekeeper
54
- - id: devils-advocate
55
- role: Devil's Advocate
56
- - id: pattern-doubler
57
- role: Pattern Doubler
38
+ - id: completion-reviewer
39
+ role: Completion Reviewer
58
40
 
59
41
  quality_gates:
60
42
  validate:
@@ -70,46 +52,15 @@ quality_gates:
70
52
  warning_signal:
71
53
  - QFAI-COV-207
72
54
  defaults:
73
- - id: qa-lead
74
- role: Quality Lead
55
+ - id: completion-reviewer
56
+ role: Completion Reviewer
75
57
  - id: qa-gatekeeper
76
58
  role: QA Gatekeeper
77
- - id: code-reviewer
78
- role: Code Reviewer
79
- - id: architect-reviewer
80
- role: Architect Reviewer
81
- - id: qa-reviewer
82
- role: QA Reviewer
83
- - id: frontend-reviewer
84
- role: Frontend Reviewer
85
- - id: backend-reviewer
86
- role: Backend Reviewer
87
- - id: design-review-lead
88
- role: Design Review Lead
89
- - id: runtime-gatekeeper
90
- role: Runtime Gatekeeper
91
- - id: devils-advocate
92
- role: Devil's Advocate
93
- - id: pattern-doubler
94
- role: Pattern Doubler
59
+ - id: implementation-reviewer
60
+ role: Implementation Reviewer
95
61
 
96
- extended_reviewers:
97
- devils-advocate:
98
- execution_order: 11
99
- can_be_na: false
100
- fail_rules:
101
- - alternative_required: true
102
- - bare_negation_invalid: true
103
- escalation:
104
- consecutive_fail_limit: 3
105
- action: advisory_demotion
106
- scope: current_review_cycle
107
- effect: non_blocking_feedback_only
108
- pattern-doubler:
109
- execution_order: 12
110
- can_be_na: true
111
- na_rule: "Allowed only if target artifact has no ID-bearing spec items (US/AC/BR/EX/TC)."
112
- fail_rules:
113
- - rationale_required: true
114
- - count_target: "2x current ID-bearing items"
115
- - count_scope: "US, AC, BR, EX, TC prefixed sequential IDs only"
62
+ optional_review_modes:
63
+ review_profiles_ssot: .qfai/assistant/steering/review-profiles.yml
64
+ supported:
65
+ - devils-advocate
66
+ - pattern-doubler
@@ -0,0 +1,30 @@
1
+ schema_version: "1.0"
2
+
3
+ profiles:
4
+ default:
5
+ always_required: [completion-reviewer]
6
+ conditional_required: []
7
+ requirements-heavy:
8
+ always_required: [completion-reviewer, requirements-reviewer]
9
+ conditional_required: []
10
+ architecture-heavy:
11
+ always_required: [completion-reviewer, architecture-reviewer]
12
+ conditional_required: []
13
+ ui-bearing:
14
+ always_required: [completion-reviewer, product-surface-reviewer]
15
+ conditional_required: []
16
+ runtime-heavy:
17
+ always_required: [completion-reviewer, qa-gatekeeper]
18
+ conditional_required: [implementation-reviewer]
19
+
20
+ optional_modes:
21
+ devils-advocate:
22
+ kind: advisory
23
+ description: Challenge assumptions aggressively, but do not block completion by default.
24
+ alternative_required: true
25
+ bare_negation_invalid: true
26
+ pattern-doubler:
27
+ kind: advisory
28
+ description: Demand additional ID-bearing patterns with rationale when pattern coverage is thin.
29
+ rationale_required: true
30
+ default_target: "2x current ID-bearing items"
@@ -2,33 +2,47 @@
2
2
 
3
3
  ## Repo layout (high level)
4
4
 
5
- - Top-level directories:
6
- - Evidence:
5
+ - Top-level directories: packages/, .qfai/, docs/, scripts/, tmp/, .github/, .claude/, .codex/, .agents/
6
+ - Evidence: Repository root listing
7
7
 
8
8
  ## Key packages / entrypoints
9
9
 
10
- - Package(s) of interest:
11
- - CLI entry:
12
- - Core modules:
13
- - Evidence:
10
+ - Package(s) of interest: packages/qfai/ (monorepo single package)
11
+ - CLI entry: packages/qfai/src/cli/index.ts -> main.ts (run() with switch on command)
12
+ - Core modules: packages/qfai/src/core/ (40+ files: config, discovery, specLayout, discussionPack, traceability, contracts, waivers, validate, etc.)
13
+ - Evidence: packages/qfai/package.json, packages/qfai/src/
14
14
 
15
15
  ## Architecture constraints
16
16
 
17
17
  - Boundaries (what must not depend on what):
18
+ - Validators are pure async functions returning Issue[] (no side effects)
19
+ - CLI layer -> Core layer -> Validators -> Artifacts (one-way dependency)
20
+ - specs/ is definition-only (no operational status)
18
21
  - Conventions (naming, file layout):
19
- - Evidence:
22
+ - Layered spec: `_policies/` + `spec-XXXX/` (1 CAP = 1 spec dir)
23
+ - Contract IDs: CON-DB-XXXX, CON-API-XXXX, CON-UI-XXXX
24
+ - Validator files: packages/qfai/src/core/validators/ (45+ files)
25
+ - Evidence: 02_Inception-Deck.md (Architecture), 09_Constraints.md (TC-09)
20
26
 
21
27
  ## Quality gates (SSOT)
22
28
 
23
- - format:
24
- - lint:
25
- - typecheck:
26
- - test:
27
- - verify-pack / pack:
28
- - Evidence:
29
+ - format: prettier (.prettierrc.json)
30
+ - lint: eslint (eslint.config.js)
31
+ - typecheck: pnpm check-types (tsc --noEmit)
32
+ - test: pnpm test (vitest run)
33
+ - verify-pack / pack: scripts/verify-pack.mjs
34
+ - Evidence: packages/qfai/package.json (scripts), .prettierrc.json, eslint.config.js
29
35
 
30
36
  ## How to run locally
31
37
 
32
- Provide copy-paste commands and expected outputs.
33
-
34
- - Evidence:
38
+ ```bash
39
+ pnpm install
40
+ pnpm build # tsup build
41
+ pnpm test # vitest run
42
+ pnpm check-types # tsc --noEmit
43
+ pnpm lint # eslint src
44
+ npx qfai validate # run validation
45
+ npx qfai doctor # diagnose setup
46
+ ```
47
+
48
+ - Evidence: packages/qfai/package.json (scripts)
@@ -2,36 +2,52 @@
2
2
 
3
3
  ## Runtime / platform
4
4
 
5
- - Node:
6
- - Evidence:
7
- - OS assumptions:
8
- - Evidence:
9
- - CI environment:
10
- - Evidence:
5
+ - Node: >= 18.0.0 (package.json engines)
6
+ - Evidence: packages/qfai/package.json
7
+ - OS assumptions: cross-platform (Windows, macOS, Linux)
8
+ - Evidence: fast-glob abstraction, path normalization in core/paths.ts
9
+ - CI environment: GitHub Actions
10
+ - Evidence: .github/ directory
11
11
 
12
12
  ## Package manager
13
13
 
14
- - pnpm / npm / yarn:
15
- - Evidence:
14
+ - pnpm >= 9.12.3 (monorepo workspace)
15
+ - Evidence: pnpm-workspace.yaml, pnpm-lock.yaml
16
16
 
17
17
  ## Language / framework
18
18
 
19
- - TypeScript:
20
- - Build tool:
21
- - Test runner:
22
- - Lint / format:
23
- - Evidence:
19
+ - TypeScript: 5.6.3 (strict mode)
20
+ - Build tool: tsup 8.3.5 (ESM/CJS dual build)
21
+ - Test runner: vitest 2.1.8
22
+ - Lint / format: eslint + prettier + markdownlint-cli2
23
+ - Evidence: packages/qfai/package.json (devDependencies), tsconfig.base.json
24
+
25
+ ## Dependencies (runtime)
26
+
27
+ - @cucumber/gherkin ^37.0.1 (Gherkin parse)
28
+ - @cucumber/messages ^31.1.0 (Gherkin AST)
29
+ - fast-glob ^3.3.2 (file discovery, 10k limit)
30
+ - jsdom ^26.1.0 (DOM crawling for UI fidelity)
31
+ - yaml ^2.5.1 (YAML 1.2 parse)
32
+ - Evidence: packages/qfai/package.json (dependencies)
24
33
 
25
34
  ## Constraints
26
35
 
27
- -
28
- - Evidence:
36
+ - Validators are pure async functions (no side effects, return Issue[])
37
+ - File search limit: 10,000 files (fast-glob)
38
+ - CI/CD: 2 minutes timeout target
39
+ - validate.json: internal contract (not stable API, per OQ-0003)
40
+ - Optional browser tooling for render evidence must remain lazy and must not become a new runtime dependency in v1.7.1.
41
+ - v1.7.5 backend provider abstraction uses optional registration; no new universal runtime dependencies. Browser/visual-review backends are registered optionally; future capability-based loading is deferred.
42
+ - Evidence: 09_Constraints.md (TC-09, TC-10, OC-01, OC-02)
29
43
 
30
44
  ## Standard commands (copy-paste)
31
45
 
32
- - Install:
33
- - Test:
34
- - Lint:
35
- - Typecheck:
36
- - Pack/verify:
37
- - Evidence:
46
+ - Install: `pnpm install`
47
+ - Test: `pnpm test`
48
+ - Lint: `pnpm lint`
49
+ - Typecheck: `pnpm check-types`
50
+ - Pack/verify: `node scripts/verify-pack.mjs`
51
+ - Build: `pnpm build`
52
+ - Validate: `npx qfai validate --fail-on error --format github`
53
+ - Evidence: packages/qfai/package.json
@@ -0,0 +1,54 @@
1
+ # UI Definition Consumption Protocol
2
+
3
+ spec-0013 (CAP-0013) で定義された、下流 skill(prototyping / ATDD / TDD)が UI 定義を読み取る際の手順。
4
+
5
+ ## Reading Order
6
+
7
+ 下流 skill は以下の順序で UI 定義を読み取る。
8
+ **Primary truth** は step 1 の discussion sidecar artifacts にある。step 2 以降は **存在する場合のみ読む supporting input / fallback** であり、init 直後に未作成でも正常である。
9
+
10
+ 1. **Discussion-side UI/UX Sidecar Artifacts** (`discussion-*/uiux/`) — **primary source of truth**
11
+ - `30_option_comparison.md` — オプション比較(比較 artifact)
12
+ - `31_selected_anchor_screen.md` — 選定結果 + selected direction の SSOT
13
+ - `10_implementation_strategy.md` — 実装戦略(strict canonical schema)
14
+ - `11_design_taste_interview.md` — デザインテイストインタビュー
15
+ - `20-24` — 3-layer 評価ファミリー(invariant / trend-derived / product-specific / aggregate / dynamic overrides)
16
+ - `40_screen_contracts.md` — スクリーンコントラクト(strong schema)
17
+ - `50_review_input_bundle.md` — レビュー入力バンドル
18
+
19
+ 2. **UI Contracts / Route-level Obligations** (`.qfai/contracts/ui/*.yaml`) — **supporting input; read only if present**
20
+ - 画面定義、インタラクション仕様
21
+ - Design Token ID への参照を含む
22
+ - init 直後にファイルが存在しなくても異常ではない
23
+
24
+ 3. **Design Token** (`.qfai/contracts/design/design-tokens*.yaml`) — **supporting input; read only if present**
25
+ - カラー、スペーシング、タイポグラフィ等の基盤値
26
+ - primitive → semantic → component の 3 層参照解決
27
+ - init 直後にファイルが存在しなくても異常ではない
28
+
29
+ 4. **Optional Fallback Visual Mock** (spec/discussion 内の Screen Mock セクション) — **fallback; read only if present**
30
+ - HTML+CSS mock は補助的な視覚的フォールバックとしてのみ使用
31
+ - sidecar artifacts と contracts が主要な UI 定義ソース
32
+ - mock が存在する場合のみ参照し、欠落していても問題なし
33
+
34
+ 5. **Mermaid Screen Flow** (spec/discussion 内の mermaid フェンス) — **supporting; read only if present**
35
+ - 画面遷移図(stateDiagram-v2)
36
+ - ナビゲーション構造図(flowchart)
37
+
38
+ ## Fallback Rules
39
+
40
+ | Missing Definition | Behavior |
41
+ | ---------------------- | ---------------------------------------------- |
42
+ | Design Token のみ欠落 | warning 発行、CSS fallback 値を使用して継続 |
43
+ | UI Contract のみ欠落 | warning 発行、sidecar artifacts から構造を推論 |
44
+ | Sidecar artifacts 欠落 | warning 発行、UI Contract からの推論で継続 |
45
+ | Fallback mock 欠落 | no-op — mock は必須ではない |
46
+ | 全定義が欠落 | 現実装では no-op(issues なし)で終了 |
47
+
48
+ ## Priority and Override Semantics
49
+
50
+ - sidecar artifacts(selected direction / strategy / contracts)が **primary truth**
51
+ - UI Contracts と Design Token は **存在する場合のみ読む supporting input**(primary truth ではない)
52
+ - Optional fallback mock はさらに後順位の **fallback**
53
+ - Design Token の値と HTML Mock の fallback 値が矛盾する場合は warning を発行
54
+ - UI Contract の screen ID と sidecar contracts の対応がない場合は warning を発行
@@ -5,15 +5,18 @@
5
5
  Contracts define the **stable surface** that specs and tests may reference.
6
6
  They are the boundary between "what we promise" and "how we implement".
7
7
 
8
- QFAI organizes contracts into three types:
8
+ QFAI organizes contracts into four directories:
9
9
 
10
10
  ```text
11
11
  contracts/
12
- ├── api/ # OpenAPI YAML (endpoints, request/response)
13
- ├── db/ # SQL schema contracts (tables, columns, constraints)
14
- └── ui/ # UI contract YAML (screens, elements, user actions)
12
+ ├── api/ # OpenAPI YAML (endpoints, request/response)
13
+ ├── db/ # SQL schema contracts (tables, columns, constraints)
14
+ ├── design/ # Design token YAML optional supporting input
15
+ └── ui/ # UI contract YAML (screens, elements, user actions)
15
16
  ```
16
17
 
18
+ > **Note:** `ui/` and `design/` are **supporting input** that supplements the discussion sidecar artifacts (`discussion-*/uiux/*`), which remain the primary truth. After `qfai init`, these directories may contain only placeholder READMEs — this is the normal initial state.
19
+
17
20
  ## Directory rules
18
21
 
19
22
  - Contract files are **minimal**: only what specs actually need.
@@ -29,6 +32,9 @@ contracts/
29
32
  ├── db/
30
33
  │ ├── README.md
31
34
  │ └── db-0001-<slug>.sql
35
+ ├── design/
36
+ │ ├── README.md
37
+ │ └── design-tokens.yaml (created when needed)
32
38
  └── ui/
33
39
  ├── README.md
34
40
  └── ui-0001-<slug>.yaml
@@ -0,0 +1,32 @@
1
+ # contracts/design (Design Token YAML) — Optional Supporting Input
2
+
3
+ ## Purpose
4
+
5
+ Provide a designated location for design token files (`design-tokens*.yaml`) that serve as **optional supporting input** for UI review, validation, and implementation.
6
+
7
+ **Primary truth** for UI/UX definitions resides in the discussion sidecar artifacts (`discussion-*/uiux/*`). Design token files in this directory supplement — but never override — those primary artifacts.
8
+
9
+ ## Status After Init
10
+
11
+ After `qfai init`, this directory contains only this README. This is the normal initial state. Design token files are created later when the project needs explicit token definitions.
12
+
13
+ The absence of design token files is **not** a defect and does not affect the canonical discussion or contracts flow.
14
+
15
+ ## When Design Tokens Are Used
16
+
17
+ Design token files are consumed **only when they exist**:
18
+
19
+ - `qfai validate` runs token-level checks (schema, circular references, platform coverage) if token files are present
20
+ - `ui-definition-protocol.md` read-order includes this path as a conditional step
21
+ - Prototyping and review skills reference tokens as supplementary color/spacing/typography values
22
+
23
+ ## Expected File Names
24
+
25
+ - `design-tokens.yaml` — primary token definitions (primitive → semantic → component)
26
+ - `design-tokens.mobile.yaml` — mobile-specific overrides (optional)
27
+
28
+ ## What This Directory Is NOT
29
+
30
+ - **Not** the primary truth for screen layout or component hierarchy
31
+ - **Not** a required baseline for discussion or spec authoring
32
+ - **Not** a substitute for sidecar artifacts or UI contracts
@@ -2,9 +2,11 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Define UI surface contracts as SSOT for prototyping and E2E selection.
5
+ Define UI surface contracts for prototyping and E2E selection.
6
6
  The contract must describe both screen structure and minimum mockable behavior.
7
7
 
8
+ > **Note:** UI contracts are **supporting input** that supplements the discussion sidecar artifacts (`discussion-*/uiux/*`), which remain the primary truth for UI/UX definitions. Screen contract YAML files are read **only when present**; after `qfai init`, this directory may contain only this README — that is the normal initial state.
9
+
8
10
  ## File rules
9
11
 
10
12
  - File name: `ui-XXXX-<slug>.yaml`
@@ -130,7 +132,7 @@ screens:
130
132
 
131
133
  ### Q1. "The page is just a static string." Which rule fails?
132
134
 
133
- - Typical fail: `QFAI-PROT-232` (`prototypingEvidence.uiFidelityContractCoverage`).
135
+ - Typical fail: `QFAI-PROT-238` (`prototypingEvidence.uiFidelityContractCoverage`).
134
136
  - Reason: Contract expects `elements/actions`, but runtime evidence does not satisfy expected placement/wiring.
135
137
  - Fix:
136
138
  - Add concrete UI elements for contract labels, or
@@ -142,7 +144,7 @@ screens:
142
144
  1. Contract label (`contracts/ui/*.yaml`)
143
145
  2. UI rendered text (or marker mapping)
144
146
  3. Prototyping evidence (`.qfai/evidence/prototyping.json`)
145
- - If only one side is updated, `QFAI-PROT-232` can remain unresolved in review.
147
+ - If only one side is updated, `QFAI-PROT-238` can remain unresolved in review.
146
148
 
147
149
  ### Q3. "Can I treat this as a static screen?"
148
150
 
@@ -2,10 +2,12 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- `discussion/` stores the unified discussion pack that merges interview outputs (discuss) and requirement intake (require) into a single fixed 15-file structure.
5
+ `discussion/` stores the unified discussion pack that merges interview outputs (discuss) and requirement intake (require). Discussion packs use 15 required markdown files plus required prototyping.yaml.
6
6
 
7
7
  This directory does not directly update `specs/`; it prepares decisions, requirements, open questions, and rationale as inputs for `/qfai-sdd`.
8
8
 
9
+ Generated discussion packs (`discussion-YYYYMMDDhhmmssSSS/`) are not version-controlled by default. Only `README.md` is tracked in Git. Ignore rules are managed in the project root `.gitignore` by `qfai init`. Historic discussion packs that were previously committed should be referenced via Git history only.
10
+
9
11
  ## Required structure
10
12
 
11
13
  ```text
@@ -26,7 +28,8 @@ discussion/
26
28
  ├── 12_OQ-Resolution-Log.md
27
29
  ├── 13_Deferred.md
28
30
  ├── 14_Review-Request.md
29
- └── 99_delta.md
31
+ ├── 99_delta.md
32
+ └── prototyping.yaml
30
33
  ```
31
34
 
32
35
  ## File responsibilities
@@ -55,7 +58,7 @@ discussion/
55
58
  | ------------------- | ---------------------------------------------------- |
56
59
  | OQ-ID | `OQ-0001` format |
57
60
  | Title | Short descriptive title |
58
- | Gate | `discuss`, `require`, or `sdd` |
61
+ | Gate | `discussion`, `sdd`, `atdd`, `tdd`, or `ops` |
59
62
  | Disposition | `open`, `resolved`, `deferred`, or `rejected` |
60
63
  | Owner | `user`, `agent`, or `team` |
61
64
  | Rationale | Required for `deferred` and `rejected` |
@@ -76,7 +79,7 @@ discussion/
76
79
  | --------------- | -------------------------------------------------- |
77
80
  | OQ-ID | `OQ-0001` format |
78
81
  | Title | Short descriptive title |
79
- | Gate | `discuss`, `require`, or `sdd` |
82
+ | Gate | `discussion`, `sdd`, `atdd`, `tdd`, or `ops` |
80
83
  | Deferred-Reason | Why deferral is justified |
81
84
  | Deferred-Until | Milestone, date, or trigger |
82
85
  | Owner | `user`, `agent`, or `team` |
@@ -88,6 +91,7 @@ discussion/
88
91
 
89
92
  - Every deferred item must have all columns populated.
90
93
  - `Deferred-Until` must define when and by what signal re-evaluation happens.
94
+ - If there are no deferred items, keep the table header and add a single `0 items` row instead of replacing the section with plain text.
91
95
 
92
96
  ## Rules
93
97
 
@@ -97,7 +101,50 @@ discussion/
97
101
  - `03_Story-Workshop.md` must include at least one Mermaid diagram in ` ```mermaid ` fences.
98
102
  - If diagrams are written elsewhere, use ` ```mermaid ` fences only (do not use ` ```text ` or language-less fences).
99
103
  - Use timestamp directory naming for new outputs: `discussion-YYYYMMDDhhmmssSSS`.
100
- - `14_Review-Request.md` must reference roster SSOT: `.qfai/assistant/steering/review-roster.yml`.
104
+ - `14_Review-Request.md` must reference routing SSOT: `.qfai/assistant/steering/agent-routing.yml` and `.qfai/assistant/steering/review-profiles.yml`.
105
+
106
+ ## prototyping.yaml (Required Recommendation Artifact)
107
+
108
+ Each discussion pack **must** include a `prototyping.yaml` file that recommends the prototyping mode for the project. This is a required side artifact of the 15-file discussion pack plus required prototyping.yaml completion contract.
109
+
110
+ ### Canonical namespaced schema (recommended)
111
+
112
+ ```yaml
113
+ prototyping:
114
+ recommended_mode: standard
115
+ rationale: UI validation is recommended but full-harness is not justified by default.
116
+ allowed_modes:
117
+ - low-cost
118
+ - standard
119
+ - full-harness
120
+ surface: web-ui
121
+ ```
122
+
123
+ ### Legacy top-level schema (deprecated — read-only backward compatibility)
124
+
125
+ The following top-level form is accepted by the parser for backward compatibility but produces a deprecation warning (`QFAI-PROT-231`). New artifacts MUST NOT emit this form; use the namespaced canonical schema above.
126
+
127
+ ```yaml
128
+ recommended_mode: standard
129
+ rationale: ...
130
+ allowed_modes:
131
+ - low-cost
132
+ - standard
133
+ surface: web-ui
134
+ ```
135
+
136
+ If both forms are present in the same file, the namespaced form takes precedence and a conflict warning (`QFAI-PROT-232`) is emitted.
137
+
138
+ ### Field reference
139
+
140
+ All 4 fields are **required**. An artifact missing any field will fail validation.
141
+
142
+ | Field | Required | Description |
143
+ | ------------------ | -------- | ------------------------------------------------------------ |
144
+ | `recommended_mode` | yes | `low-cost`, `standard`, or `full-harness` |
145
+ | `rationale` | yes | Non-empty string explaining the recommendation |
146
+ | `allowed_modes` | yes | Unique array of valid modes; must include `recommended_mode` |
147
+ | `surface` | yes | `web-ui`, `mobile-ui`, `desktop-ui`, `mixed`, or `non-ui` |
101
148
 
102
149
  ## Suggested naming
103
150