qfai 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +24 -16
  2. package/assets/defaults/workflows/apply-settled.yml +2 -0
  3. package/assets/defaults/workflows/decide-design.yml +1 -6
  4. package/assets/defaults/workflows/decompose-epic.yml +1 -1
  5. package/assets/init/.claude/settings.json +1 -1
  6. package/assets/init/.qfai/assistant/agent/architecture-reviewer.md +1 -0
  7. package/assets/init/.qfai/assistant/agent/fullstack-engineer.md +6 -9
  8. package/assets/init/.qfai/assistant/agent/implementation-reviewer.md +9 -1
  9. package/assets/init/.qfai/assistant/agent/product-surface-reviewer.md +70 -4
  10. package/assets/init/.qfai/assistant/agent/requirements-reviewer.md +1 -0
  11. package/assets/init/.qfai/assistant/rule/constitution.md +3 -2
  12. package/assets/init/.qfai/assistant/rule/drift-protocol.md +5 -5
  13. package/assets/init/.qfai/assistant/rule/references/deliberation-record-template.md +23 -0
  14. package/assets/init/.qfai/assistant/rule/references/deliberation-record.md +36 -0
  15. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +3 -3
  16. package/assets/init/.qfai/assistant/rule/references/launcher-preflight.md +27 -0
  17. package/assets/init/.qfai/assistant/rule/references/reviewer-findings.md +9 -0
  18. package/assets/init/.qfai/assistant/rule/references/reviewer-remit.md +23 -15
  19. package/assets/init/.qfai/assistant/rule/references/visual-reference-survey.md +146 -0
  20. package/assets/init/.qfai/assistant/rule/references/worker-edit-boundary.md +2 -0
  21. package/assets/init/.qfai/assistant/rule/research-first-protocol.md +49 -11
  22. package/assets/init/.qfai/assistant/rule/review-convergence.md +15 -16
  23. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +3 -0
  24. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +13 -25
  25. package/assets/init/.qfai/assistant/rule/test-layers.md +8 -0
  26. package/assets/init/.qfai/assistant/rule/thinking.md +10 -5
  27. package/assets/init/.qfai/assistant/rule/ui-definition-protocol.md +4 -4
  28. package/assets/init/.qfai/assistant/rule/ui-procurement.md +50 -10
  29. package/assets/init/.qfai/assistant/rule/workflow.md +4 -3
  30. package/assets/init/.qfai/assistant/skill/qfai-configure/SKILL.md +3 -1
  31. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +22 -56
  32. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/design-dna-intake.md +11 -14
  33. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-coverage-checklist.md +1 -1
  34. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +6 -4
  35. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/discussion-delegation.md +46 -0
  36. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/glossary-check.md +23 -0
  37. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-check.md +25 -0
  38. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +12 -1
  39. package/assets/init/.qfai/assistant/skill/qfai-implement/references/parallelization-policy.md +2 -3
  40. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +47 -8
  41. package/assets/init/.qfai/assistant/skill/qfai-maintain/SKILL.md +2 -0
  42. package/assets/init/.qfai/assistant/skill/qfai-migration-v1-to-v2/SKILL.md +1 -1
  43. package/assets/init/.qfai/assistant/skill/qfai-prototyping/SKILL.md +6 -2
  44. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/generator-prompt.md +6 -9
  45. package/assets/init/.qfai/assistant/skill/qfai-prototyping/references/reviewer-prompt.md +24 -15
  46. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +2 -2
  47. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +2 -1
  48. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +7 -3
  49. package/assets/init/.qfai/assistant/skill/qfai-run/references/stage-points.md +4 -1
  50. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/business-ui-patterns.md +180 -0
  51. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/contract-artifact-rules.md +14 -3
  52. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-anti-patterns.md +14 -3
  53. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +39 -24
  54. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-brand-catalog.md +2 -2
  55. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/marketing-ui-patterns.md +194 -0
  56. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/requirements-decomposition.md +27 -3
  57. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-execution-playbook.md +29 -22
  58. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +3 -3
  59. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +4 -4
  60. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  61. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +4 -2
  62. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/spec-traceability-rules.md +6 -6
  63. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +87 -4
  64. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-design-contract-normalization.md +6 -7
  65. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/api-contract.sample.yaml +3 -0
  66. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/db-contract.sample.sql +3 -0
  67. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/contracts/ui-contract.sample.yaml +40 -1
  68. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/report/preflight_summary.md +10 -16
  69. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/01_policy/constraint.md +10 -0
  70. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/01_policy/initiative.md +5 -0
  71. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/03_contract/tech.md +1 -0
  72. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +8 -2
  73. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +4 -0
  74. package/assets/init/.qfai/assistant/skill/qfai-verify/SKILL.md +4 -2
  75. package/assets/init/.qfai/assistant/skill/qfai-verify/references/context-load.md +2 -1
  76. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +4 -1
  77. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +11 -8
  78. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +1 -1
  79. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +25 -60
  80. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +18 -6
  81. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +45 -95
  82. package/assets/init/.qfai/assistant/step/discussion-research/STEP.md +11 -13
  83. package/assets/init/.qfai/assistant/step/implement-diagnose/STEP.md +2 -2
  84. package/assets/init/.qfai/assistant/step/implement-scaffold/STEP.md +52 -8
  85. package/assets/init/.qfai/assistant/step/implement-settled-edit/STEP.md +78 -0
  86. package/assets/init/.qfai/assistant/step/implement-sweep/STEP.md +3 -3
  87. package/assets/init/.qfai/assistant/step/implement-tdd/STEP.md +20 -2
  88. package/assets/init/.qfai/assistant/step/prototyping-grill/STEP.md +4 -0
  89. package/assets/init/.qfai/assistant/step/prototyping-handoff/STEP.md +3 -2
  90. package/assets/init/.qfai/assistant/step/prototyping-loop/STEP.md +6 -1
  91. package/assets/init/.qfai/assistant/step/sdd-contract/STEP.md +58 -11
  92. package/assets/init/.qfai/assistant/step/sdd-flow/STEP.md +41 -27
  93. package/assets/init/.qfai/assistant/step/sdd-story/STEP.md +2 -1
  94. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +43 -26
  95. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +8 -3
  96. package/assets/init/.qfai/assistant/step/triage-close/STEP.md +12 -6
  97. package/assets/init/.qfai/assistant/step/triage-decompose/STEP.md +2 -1
  98. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +36 -6
  99. package/assets/init/.qfai/assistant/step/triage-security-intake/STEP.md +2 -0
  100. package/assets/init/.qfai/assistant/step/verify-commit/STEP.md +3 -1
  101. package/assets/init/.qfai/assistant/step/verify-context/STEP.md +3 -3
  102. package/assets/init/.qfai/assistant/step/verify-release-notes/STEP.md +11 -3
  103. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +22 -0
  104. package/assets/init/root/.agents/rules/delegation-steering.md +4 -2
  105. package/assets/init/root/.agents/rules/distributed-surface.md +1 -1
  106. package/assets/init/root/.agents/rules/grilling.md +28 -76
  107. package/assets/init/root/.agents/rules/interface-clarity.md +98 -6
  108. package/assets/init/root/.gitattributes +7 -5
  109. package/assets/init/root/.github/workflows/qfai-docs.yml +1 -1
  110. package/assets/init/root/qfai.config.yaml +1 -1
  111. package/assets/mdschema/story/01_policy/constraint.mdschema.yml +46 -2
  112. package/assets/mdschema/story/01_policy/initiative.mdschema.yml +18 -0
  113. package/assets/mdschema/story/03_contract/tech.mdschema.yml +5 -2
  114. package/assets/uix-rev/strategy-review.md +1 -1
  115. package/dist/cli/index.cjs +3787 -7097
  116. package/dist/cli/index.cjs.map +1 -1
  117. package/dist/cli/index.mjs +3647 -6970
  118. package/dist/cli/index.mjs.map +1 -1
  119. package/dist/graph/cli.cjs +966 -222
  120. package/dist/graph/cli.cjs.map +1 -1
  121. package/dist/graph/cli.mjs +942 -198
  122. package/dist/graph/cli.mjs.map +1 -1
  123. package/dist/graph/hook.cjs +999 -88
  124. package/dist/graph/hook.cjs.map +1 -1
  125. package/dist/graph/hook.mjs +996 -85
  126. package/dist/graph/hook.mjs.map +1 -1
  127. package/dist/hook/turn-end.cjs +15 -45
  128. package/dist/hook/turn-end.cjs.map +1 -1
  129. package/dist/hook/turn-end.mjs +15 -45
  130. package/dist/hook/turn-end.mjs.map +1 -1
  131. package/dist/index.cjs +15398 -18327
  132. package/dist/index.cjs.map +1 -1
  133. package/dist/index.d.cts +32 -41
  134. package/dist/index.d.ts +32 -41
  135. package/dist/index.mjs +19276 -22214
  136. package/dist/index.mjs.map +1 -1
  137. package/package.json +2 -2
  138. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-artifact-rules.md +0 -53
  139. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +0 -133
  140. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/example-mapping-guide.md +0 -18
  141. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/oq-and-deferred-rules.md +0 -84
  142. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui-bearing-playbook.md +0 -95
  143. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/platform_baselines.md +0 -118
  144. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/review_audit_playbook.md +0 -115
  145. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux/trend_scan_playbook.md +0 -81
  146. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/ui_ux_best_practices.md +0 -184
  147. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/01_Context.md +0 -143
  148. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/03_Story-Workshop.md +0 -104
  149. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/04_Sources.md +0 -276
  150. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/05_Scope.md +0 -36
  151. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/06_REQ.md +0 -26
  152. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/07_NFR.md +0 -24
  153. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/08_Glossary.md +0 -23
  154. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/09_Constraints.md +0 -60
  155. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/11_OQ-Register.md +0 -38
  156. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/prototyping.yaml +0 -8
  157. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/00_index.md +0 -35
  158. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/40_screen_contracts.md +0 -62
  159. package/assets/init/.qfai/assistant/skill/qfai-discussion/templates/uiux/50_review_input_bundle.md +0 -38
  160. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +0 -70
  161. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +0 -199
  162. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +0 -82
  163. package/assets/uix-rev/contracts-review.md +0 -27
package/dist/index.d.cts CHANGED
@@ -169,7 +169,8 @@ type OutputFormat = "text" | "github";
169
169
  type QfaiPaths = {
170
170
  contractsDir: string;
171
171
  specsDir: string;
172
- discussionDir: string;
172
+ /** Where the per-run deliberation records live, read with `\` taken as `/`. */
173
+ deliberationDir: string;
173
174
  outDir: string;
174
175
  skillsDir: string;
175
176
  srcDir: string;
@@ -231,7 +232,6 @@ type QfaiOutputConfig = {
231
232
  type QfaiUiuxAuditConfig = {
232
233
  enabled?: boolean;
233
234
  slopDetection?: boolean;
234
- maxPrimaryCtas?: number;
235
235
  maxRawTokenLiteralWarnings?: number;
236
236
  maxDuplicateFindingsPerRule?: number;
237
237
  };
@@ -250,14 +250,6 @@ type QfaiUiuxConfig = {
250
250
  designTokensDir?: string;
251
251
  htmlMockTimeout?: number;
252
252
  qualityProfile?: "strict" | "high" | "default";
253
- requireResearchSummary?: boolean;
254
- competitive_refs_min?: number;
255
- /**
256
- * Minimum complete component-catalogue references a UI-bearing pack must
257
- * register. Absent means the count is not gated; entries that are
258
- * registered are still held to the same three fields.
259
- */
260
- catalogue_refs_min?: number;
261
253
  /**
262
254
  * Repository-relative POSIX globs of the paths that render a user-visible
263
255
  * surface. An empty list states that the project renders none; an absent
@@ -335,7 +327,7 @@ type ConfigLoadResult = {
335
327
  * so it cannot answer "was the value I depend on honoured, or silently
336
328
  * replaced by its default?". Normalization is per-key and independent,
337
329
  * so an unrelated rejection (a bad `baseBranch`, say) says nothing
338
- * about `paths.discussionDir`. A caller whose correctness hinges on one
330
+ * about `paths.specsDir`. A caller whose correctness hinges on one
339
331
  * key reads it here and checks that key alone, rather than treating any
340
332
  * issue anywhere in the file as a reason to distrust the whole config.
341
333
  */
@@ -394,6 +386,14 @@ declare function resolvePath(root: string, config: QfaiConfig, key: ConfigPathKe
394
386
  * because the loaded config would otherwise fall back to the first UI contract.
395
387
  */
396
388
  declare function readRejectedPrimaryUiContract(loaded: ConfigLoadResult): string | undefined;
389
+ declare const DELIBERATION_DIR_OUTSIDE_ROOT_MESSAGE = "paths.deliberationDir must name a directory inside the project root, not the root itself or a directory outside it, and no part of it may end in a dot or a space.";
390
+ /**
391
+ * Whether `dir`, read against `root`, names a directory strictly inside `root`.
392
+ *
393
+ * A part that ends in a dot or a space, such as `...` or `docs.`, is refused: Windows drops
394
+ * those characters, so `...` would land in the root while this check reads it as a child.
395
+ */
396
+ declare function isDirectoryInsideRoot(root: string, dir: string): boolean;
397
397
 
398
398
  type AtddTestKind = "e2e" | "api" | "integration";
399
399
  /** Test directory each `AtddTestKind` owns, for user-facing messages. */
@@ -576,38 +576,32 @@ declare function extractCaseSpecNumber(caseId: string): string | null;
576
576
  declare function extractScSpecNumber(scId: string): string | null;
577
577
 
578
578
  /**
579
- * The input source preflight selected: the discussion pack, or an imported
580
- * specification the caller names with `importPath`. An explicit user
581
- * requirement is not a file, so a project with neither reports `blocked` and
582
- * SDD decides whether the user gave one.
579
+ * The input source preflight selected: the deliberation record the caller
580
+ * names with `recordPath`, or an imported specification it names with
581
+ * `importPath`. An explicit user requirement is not a file, so a project with
582
+ * neither reports `blocked` and SDD decides whether the user gave one.
583
583
  */
584
- type SddPreflightSource = "discussion-pack" | "import-lite";
584
+ type SddPreflightSource = "deliberation-record" | "import-lite";
585
585
  type SddPreflightStatus = "ready" | "blocked";
586
586
  type RunSddPreflightOptions = {
587
587
  assumptions?: string[];
588
588
  /**
589
- * Pack to judge. Defaults to the newest pack under the discussion root;
590
- * callers that honor `.qfai/state.json#discussion.currentId` pass the
591
- * pointed-at pack so an explicitly pinned (older) pack is the one gated.
589
+ * The deliberation record SDD consumes: the run's own, the one the work
590
+ * order names, or the one the user names. Read against the project root,
591
+ * then against `paths.deliberationDir`. Preflight never picks one itself.
592
592
  */
593
- packDir?: string;
594
- /** An imported specification to use when no discussion pack is usable. */
593
+ recordPath?: string;
594
+ /** An imported specification to use when no record is named. */
595
595
  importPath?: string;
596
596
  startedAt?: Date;
597
597
  };
598
598
  type SddPreflightResult = {
599
599
  status: SddPreflightStatus;
600
- source: SddPreflightSource;
600
+ /** `null` when preflight selected no input. */
601
+ source: SddPreflightSource | null;
601
602
  selectedInputPath: string | null;
602
- importedReqCount: number | null;
603
603
  openQuestions: string[];
604
604
  blockers: string[];
605
- /**
606
- * What the selected pack lacks or contradicts. Listed, never a stop: the pack
607
- * is non-normative reference material, so SDD states each gap in its final
608
- * report and carries on.
609
- */
610
- packGaps: string[];
611
605
  nextCommands: string[];
612
606
  /** Run id of this preflight, in `run-<17-digit local timestamp>` form. */
613
607
  runId: string;
@@ -616,6 +610,14 @@ type SddPreflightResult = {
616
610
  /** Overwritten-every-run copy at `<outDir>/preflight_summary.md`, for humans. */
617
611
  latestPreflightSummaryPath: string;
618
612
  };
613
+ /**
614
+ * Select the source of `/qfai-sdd` in the order its contract sets: the named
615
+ * deliberation record, else an imported specification, else nothing — an
616
+ * explicit user requirement is SDD's to judge. A named record that cannot be
617
+ * read stops the run rather than falling through to the import. Preflight
618
+ * reads no record content: a record that leaves a question open or
619
+ * contradicts itself is still a usable source.
620
+ */
619
621
  declare function runSddPreflight(root: string, config: QfaiConfig, options?: RunSddPreflightOptions): Promise<SddPreflightResult>;
620
622
 
621
623
  type ReportData = {
@@ -890,17 +892,6 @@ declare function validateContracts(root: string, config: QfaiConfig): Promise<Is
890
892
  declare function validateUiContractParse(root: string, config: QfaiConfig): Promise<Issue[]>;
891
893
  declare function lintSql(text: string, file: string): Issue[];
892
894
 
893
- declare const CANONICAL_PROTOTYPING_SURFACES: readonly ["web", "mobile", "desktop", "cli", "mixed"];
894
- type CanonicalPrototypingSurface = (typeof CANONICAL_PROTOTYPING_SURFACES)[number];
895
-
896
- type SurfaceType = CanonicalPrototypingSurface | "non-ui";
897
- declare const DISCUSSION_UI_BEARING_SURFACES: Set<SurfaceType>;
898
- declare const DISCUSSION_NON_UI_SURFACES: Set<SurfaceType>;
899
- declare const VISUAL_BROWSER_SURFACES: Set<SurfaceType>;
900
- declare function isDiscussionUiBearingSurfaceType(surface: SurfaceType): boolean;
901
- declare function isNonUiDiscussionSurface(surface: SurfaceType): boolean;
902
- declare function requiresVisualBrowserEvidence(surface: SurfaceType): boolean;
903
-
904
895
  declare const ARCHETYPES: readonly ["minimal", "bold", "corporate", "playful", "organic", "tech", "elegant", "casual"];
905
896
  type Archetype = (typeof ARCHETYPES)[number];
906
897
  declare const COLOR_KEYS: readonly ["primary", "secondary", "accent", "surface", "surface_muted", "text", "text_muted", "danger", "warning", "success", "border", "overlay"];
@@ -1097,4 +1088,4 @@ declare function prepareDocumentAnalysis(root: string, run?: GraphProcess, appro
1097
1088
  /** Run one ordered spec-to-story migration step from the current project root. */
1098
1089
  declare function runMigrationStep(step: number, argv: string[]): Promise<number>;
1099
1090
 
1100
- export { ACCEPTED_DRIFT_MESSAGE, AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type AcceptedDrift, type ApproveExternalProcessing, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_DIAGRAM_BUDGET, DESIGN_MD_SAMPLE_MARKER, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, type DiagramBudget, type DocumentPreparation, type ExternalProcessingRequest, FONT_KEYS, type FailOn, type FenceMaskOptions, type FontKey, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type InstalledOlderThanDeclared, type InvalidIdOccurrence, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type OutputFormat, type ParseError, type ParseResult, type QfaiConfig, type QfaiForbiddenIdentifier, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingConfig, type QfaiPrototypingExecutionConfig, type QfaiReportConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, STOP_GATE_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, VISUAL_BROWSER_SURFACES, type ValidationCounts, type ValidationFamilyTiming, type ValidationFamilyTimings, type ValidationIssue, type ValidationOptions, type ValidationProfile, type ValidationResult, type ValidationTimings, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, WORKFLOW_MODE_MESSAGE, type WorkflowMode, atddAcceptanceLayerFilter, atddAcceptanceTestGlobs, atddTestKindDirs, classifyAgainstDeclaration, classifyToolLocation, compareInstalledToDeclared, countIssues, createReportData, createTestLayerRoots, defaultConfig, deriveAtddFilePattern, deriveTestFileExtensions, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractIds, extractInvalidIdOccurrences, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, findConfigRoot, findDeclaringDir, findLinkingNodeModules, findPackageJsonUpward, formatReportJson, formatReportMarkdown, getConfigPath, isDiscussionUiBearingSurfaceType, isNonUiDiscussionSurface, isOlderVersion, isUnreplacedDesignMdSample, labelCheckTimings, lintSql, loadConfig, locateToolAgainstProject, lowestVersionOfRange, maskFencedCodeBlocks, orderUiuxParts, packageRootProbe, parseDesignMd, prepareDocumentAnalysis, prepareGraphIntegration, reachedThroughLinkedNodeModules, readAcceptedDrift, readDeclaredQfaiRange, readRejectedPrimaryUiContract, readSkippedWorkflows, readStopGate, readTestFileExtensions, readWorkflowMode, renderGraphPreparation, requiresVisualBrowserEvidence, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };
1091
+ export { ACCEPTED_DRIFT_MESSAGE, AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type AcceptedDrift, type ApproveExternalProcessing, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_DIAGRAM_BUDGET, DELIBERATION_DIR_OUTSIDE_ROOT_MESSAGE, DESIGN_MD_SAMPLE_MARKER, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, type DiagramBudget, type DocumentPreparation, type ExternalProcessingRequest, FONT_KEYS, type FailOn, type FenceMaskOptions, type FontKey, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type InstalledOlderThanDeclared, type InvalidIdOccurrence, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type OutputFormat, type ParseError, type ParseResult, type QfaiConfig, type QfaiForbiddenIdentifier, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingConfig, type QfaiPrototypingExecutionConfig, type QfaiReportConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, STOP_GATE_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, type ValidationCounts, type ValidationFamilyTiming, type ValidationFamilyTimings, type ValidationIssue, type ValidationOptions, type ValidationProfile, type ValidationResult, type ValidationTimings, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, WORKFLOW_MODE_MESSAGE, type WorkflowMode, atddAcceptanceLayerFilter, atddAcceptanceTestGlobs, atddTestKindDirs, classifyAgainstDeclaration, classifyToolLocation, compareInstalledToDeclared, countIssues, createReportData, createTestLayerRoots, defaultConfig, deriveAtddFilePattern, deriveTestFileExtensions, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractIds, extractInvalidIdOccurrences, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, findConfigRoot, findDeclaringDir, findLinkingNodeModules, findPackageJsonUpward, formatReportJson, formatReportMarkdown, getConfigPath, isDirectoryInsideRoot, isOlderVersion, isUnreplacedDesignMdSample, labelCheckTimings, lintSql, loadConfig, locateToolAgainstProject, lowestVersionOfRange, maskFencedCodeBlocks, orderUiuxParts, packageRootProbe, parseDesignMd, prepareDocumentAnalysis, prepareGraphIntegration, reachedThroughLinkedNodeModules, readAcceptedDrift, readDeclaredQfaiRange, readRejectedPrimaryUiContract, readSkippedWorkflows, readStopGate, readTestFileExtensions, readWorkflowMode, renderGraphPreparation, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };
package/dist/index.d.ts CHANGED
@@ -169,7 +169,8 @@ type OutputFormat = "text" | "github";
169
169
  type QfaiPaths = {
170
170
  contractsDir: string;
171
171
  specsDir: string;
172
- discussionDir: string;
172
+ /** Where the per-run deliberation records live, read with `\` taken as `/`. */
173
+ deliberationDir: string;
173
174
  outDir: string;
174
175
  skillsDir: string;
175
176
  srcDir: string;
@@ -231,7 +232,6 @@ type QfaiOutputConfig = {
231
232
  type QfaiUiuxAuditConfig = {
232
233
  enabled?: boolean;
233
234
  slopDetection?: boolean;
234
- maxPrimaryCtas?: number;
235
235
  maxRawTokenLiteralWarnings?: number;
236
236
  maxDuplicateFindingsPerRule?: number;
237
237
  };
@@ -250,14 +250,6 @@ type QfaiUiuxConfig = {
250
250
  designTokensDir?: string;
251
251
  htmlMockTimeout?: number;
252
252
  qualityProfile?: "strict" | "high" | "default";
253
- requireResearchSummary?: boolean;
254
- competitive_refs_min?: number;
255
- /**
256
- * Minimum complete component-catalogue references a UI-bearing pack must
257
- * register. Absent means the count is not gated; entries that are
258
- * registered are still held to the same three fields.
259
- */
260
- catalogue_refs_min?: number;
261
253
  /**
262
254
  * Repository-relative POSIX globs of the paths that render a user-visible
263
255
  * surface. An empty list states that the project renders none; an absent
@@ -335,7 +327,7 @@ type ConfigLoadResult = {
335
327
  * so it cannot answer "was the value I depend on honoured, or silently
336
328
  * replaced by its default?". Normalization is per-key and independent,
337
329
  * so an unrelated rejection (a bad `baseBranch`, say) says nothing
338
- * about `paths.discussionDir`. A caller whose correctness hinges on one
330
+ * about `paths.specsDir`. A caller whose correctness hinges on one
339
331
  * key reads it here and checks that key alone, rather than treating any
340
332
  * issue anywhere in the file as a reason to distrust the whole config.
341
333
  */
@@ -394,6 +386,14 @@ declare function resolvePath(root: string, config: QfaiConfig, key: ConfigPathKe
394
386
  * because the loaded config would otherwise fall back to the first UI contract.
395
387
  */
396
388
  declare function readRejectedPrimaryUiContract(loaded: ConfigLoadResult): string | undefined;
389
+ declare const DELIBERATION_DIR_OUTSIDE_ROOT_MESSAGE = "paths.deliberationDir must name a directory inside the project root, not the root itself or a directory outside it, and no part of it may end in a dot or a space.";
390
+ /**
391
+ * Whether `dir`, read against `root`, names a directory strictly inside `root`.
392
+ *
393
+ * A part that ends in a dot or a space, such as `...` or `docs.`, is refused: Windows drops
394
+ * those characters, so `...` would land in the root while this check reads it as a child.
395
+ */
396
+ declare function isDirectoryInsideRoot(root: string, dir: string): boolean;
397
397
 
398
398
  type AtddTestKind = "e2e" | "api" | "integration";
399
399
  /** Test directory each `AtddTestKind` owns, for user-facing messages. */
@@ -576,38 +576,32 @@ declare function extractCaseSpecNumber(caseId: string): string | null;
576
576
  declare function extractScSpecNumber(scId: string): string | null;
577
577
 
578
578
  /**
579
- * The input source preflight selected: the discussion pack, or an imported
580
- * specification the caller names with `importPath`. An explicit user
581
- * requirement is not a file, so a project with neither reports `blocked` and
582
- * SDD decides whether the user gave one.
579
+ * The input source preflight selected: the deliberation record the caller
580
+ * names with `recordPath`, or an imported specification it names with
581
+ * `importPath`. An explicit user requirement is not a file, so a project with
582
+ * neither reports `blocked` and SDD decides whether the user gave one.
583
583
  */
584
- type SddPreflightSource = "discussion-pack" | "import-lite";
584
+ type SddPreflightSource = "deliberation-record" | "import-lite";
585
585
  type SddPreflightStatus = "ready" | "blocked";
586
586
  type RunSddPreflightOptions = {
587
587
  assumptions?: string[];
588
588
  /**
589
- * Pack to judge. Defaults to the newest pack under the discussion root;
590
- * callers that honor `.qfai/state.json#discussion.currentId` pass the
591
- * pointed-at pack so an explicitly pinned (older) pack is the one gated.
589
+ * The deliberation record SDD consumes: the run's own, the one the work
590
+ * order names, or the one the user names. Read against the project root,
591
+ * then against `paths.deliberationDir`. Preflight never picks one itself.
592
592
  */
593
- packDir?: string;
594
- /** An imported specification to use when no discussion pack is usable. */
593
+ recordPath?: string;
594
+ /** An imported specification to use when no record is named. */
595
595
  importPath?: string;
596
596
  startedAt?: Date;
597
597
  };
598
598
  type SddPreflightResult = {
599
599
  status: SddPreflightStatus;
600
- source: SddPreflightSource;
600
+ /** `null` when preflight selected no input. */
601
+ source: SddPreflightSource | null;
601
602
  selectedInputPath: string | null;
602
- importedReqCount: number | null;
603
603
  openQuestions: string[];
604
604
  blockers: string[];
605
- /**
606
- * What the selected pack lacks or contradicts. Listed, never a stop: the pack
607
- * is non-normative reference material, so SDD states each gap in its final
608
- * report and carries on.
609
- */
610
- packGaps: string[];
611
605
  nextCommands: string[];
612
606
  /** Run id of this preflight, in `run-<17-digit local timestamp>` form. */
613
607
  runId: string;
@@ -616,6 +610,14 @@ type SddPreflightResult = {
616
610
  /** Overwritten-every-run copy at `<outDir>/preflight_summary.md`, for humans. */
617
611
  latestPreflightSummaryPath: string;
618
612
  };
613
+ /**
614
+ * Select the source of `/qfai-sdd` in the order its contract sets: the named
615
+ * deliberation record, else an imported specification, else nothing — an
616
+ * explicit user requirement is SDD's to judge. A named record that cannot be
617
+ * read stops the run rather than falling through to the import. Preflight
618
+ * reads no record content: a record that leaves a question open or
619
+ * contradicts itself is still a usable source.
620
+ */
619
621
  declare function runSddPreflight(root: string, config: QfaiConfig, options?: RunSddPreflightOptions): Promise<SddPreflightResult>;
620
622
 
621
623
  type ReportData = {
@@ -890,17 +892,6 @@ declare function validateContracts(root: string, config: QfaiConfig): Promise<Is
890
892
  declare function validateUiContractParse(root: string, config: QfaiConfig): Promise<Issue[]>;
891
893
  declare function lintSql(text: string, file: string): Issue[];
892
894
 
893
- declare const CANONICAL_PROTOTYPING_SURFACES: readonly ["web", "mobile", "desktop", "cli", "mixed"];
894
- type CanonicalPrototypingSurface = (typeof CANONICAL_PROTOTYPING_SURFACES)[number];
895
-
896
- type SurfaceType = CanonicalPrototypingSurface | "non-ui";
897
- declare const DISCUSSION_UI_BEARING_SURFACES: Set<SurfaceType>;
898
- declare const DISCUSSION_NON_UI_SURFACES: Set<SurfaceType>;
899
- declare const VISUAL_BROWSER_SURFACES: Set<SurfaceType>;
900
- declare function isDiscussionUiBearingSurfaceType(surface: SurfaceType): boolean;
901
- declare function isNonUiDiscussionSurface(surface: SurfaceType): boolean;
902
- declare function requiresVisualBrowserEvidence(surface: SurfaceType): boolean;
903
-
904
895
  declare const ARCHETYPES: readonly ["minimal", "bold", "corporate", "playful", "organic", "tech", "elegant", "casual"];
905
896
  type Archetype = (typeof ARCHETYPES)[number];
906
897
  declare const COLOR_KEYS: readonly ["primary", "secondary", "accent", "surface", "surface_muted", "text", "text_muted", "danger", "warning", "success", "border", "overlay"];
@@ -1097,4 +1088,4 @@ declare function prepareDocumentAnalysis(root: string, run?: GraphProcess, appro
1097
1088
  /** Run one ordered spec-to-story migration step from the current project root. */
1098
1089
  declare function runMigrationStep(step: number, argv: string[]): Promise<number>;
1099
1090
 
1100
- export { ACCEPTED_DRIFT_MESSAGE, AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type AcceptedDrift, type ApproveExternalProcessing, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_DIAGRAM_BUDGET, DESIGN_MD_SAMPLE_MARKER, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, type DiagramBudget, type DocumentPreparation, type ExternalProcessingRequest, FONT_KEYS, type FailOn, type FenceMaskOptions, type FontKey, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type InstalledOlderThanDeclared, type InvalidIdOccurrence, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type OutputFormat, type ParseError, type ParseResult, type QfaiConfig, type QfaiForbiddenIdentifier, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingConfig, type QfaiPrototypingExecutionConfig, type QfaiReportConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, STOP_GATE_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, VISUAL_BROWSER_SURFACES, type ValidationCounts, type ValidationFamilyTiming, type ValidationFamilyTimings, type ValidationIssue, type ValidationOptions, type ValidationProfile, type ValidationResult, type ValidationTimings, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, WORKFLOW_MODE_MESSAGE, type WorkflowMode, atddAcceptanceLayerFilter, atddAcceptanceTestGlobs, atddTestKindDirs, classifyAgainstDeclaration, classifyToolLocation, compareInstalledToDeclared, countIssues, createReportData, createTestLayerRoots, defaultConfig, deriveAtddFilePattern, deriveTestFileExtensions, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractIds, extractInvalidIdOccurrences, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, findConfigRoot, findDeclaringDir, findLinkingNodeModules, findPackageJsonUpward, formatReportJson, formatReportMarkdown, getConfigPath, isDiscussionUiBearingSurfaceType, isNonUiDiscussionSurface, isOlderVersion, isUnreplacedDesignMdSample, labelCheckTimings, lintSql, loadConfig, locateToolAgainstProject, lowestVersionOfRange, maskFencedCodeBlocks, orderUiuxParts, packageRootProbe, parseDesignMd, prepareDocumentAnalysis, prepareGraphIntegration, reachedThroughLinkedNodeModules, readAcceptedDrift, readDeclaredQfaiRange, readRejectedPrimaryUiContract, readSkippedWorkflows, readStopGate, readTestFileExtensions, readWorkflowMode, renderGraphPreparation, requiresVisualBrowserEvidence, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };
1091
+ export { ACCEPTED_DRIFT_MESSAGE, AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type AcceptedDrift, type ApproveExternalProcessing, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_DIAGRAM_BUDGET, DELIBERATION_DIR_OUTSIDE_ROOT_MESSAGE, DESIGN_MD_SAMPLE_MARKER, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, type DiagramBudget, type DocumentPreparation, type ExternalProcessingRequest, FONT_KEYS, type FailOn, type FenceMaskOptions, type FontKey, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type InstalledOlderThanDeclared, type InvalidIdOccurrence, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type OutputFormat, type ParseError, type ParseResult, type QfaiConfig, type QfaiForbiddenIdentifier, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingConfig, type QfaiPrototypingExecutionConfig, type QfaiReportConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, STOP_GATE_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, type ValidationCounts, type ValidationFamilyTiming, type ValidationFamilyTimings, type ValidationIssue, type ValidationOptions, type ValidationProfile, type ValidationResult, type ValidationTimings, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, WORKFLOW_MODE_MESSAGE, type WorkflowMode, atddAcceptanceLayerFilter, atddAcceptanceTestGlobs, atddTestKindDirs, classifyAgainstDeclaration, classifyToolLocation, compareInstalledToDeclared, countIssues, createReportData, createTestLayerRoots, defaultConfig, deriveAtddFilePattern, deriveTestFileExtensions, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractIds, extractInvalidIdOccurrences, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, findConfigRoot, findDeclaringDir, findLinkingNodeModules, findPackageJsonUpward, formatReportJson, formatReportMarkdown, getConfigPath, isDirectoryInsideRoot, isOlderVersion, isUnreplacedDesignMdSample, labelCheckTimings, lintSql, loadConfig, locateToolAgainstProject, lowestVersionOfRange, maskFencedCodeBlocks, orderUiuxParts, packageRootProbe, parseDesignMd, prepareDocumentAnalysis, prepareGraphIntegration, reachedThroughLinkedNodeModules, readAcceptedDrift, readDeclaredQfaiRange, readRejectedPrimaryUiContract, readSkippedWorkflows, readStopGate, readTestFileExtensions, readWorkflowMode, renderGraphPreparation, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };