qfai 1.8.2 → 1.8.4

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 (39) hide show
  1. package/README.md +9 -4
  2. package/assets/init/.qfai/assistant/agents/product-experience-architect.md +2 -1
  3. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +4 -4
  4. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +1 -1
  5. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +1 -0
  6. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +1 -1
  7. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +3 -1
  8. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +126 -62
  9. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +43 -12
  10. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-cycle.md +46 -14
  11. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/l1-review-guide.md +13 -12
  12. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/l2-review-guide.md +16 -10
  13. package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/reviewer-gate.md +25 -4
  14. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +3 -3
  15. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +1 -1
  16. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +1 -1
  17. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/absorption-policy.sample.yaml +7 -0
  18. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/evaluation-rubric.sample.yaml +22 -3
  19. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/evaluator-calibration.sample.yaml +6 -0
  20. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/exploration-brief.sample.yaml +9 -0
  21. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +6 -6
  22. package/assets/init/.qfai/contracts/design/README.md +6 -1
  23. package/assets/init/.qfai/contracts/ui/README.md +3 -3
  24. package/assets/init/.qfai/discussion/README.md +14 -9
  25. package/assets/init/.qfai/evidence/README.md +66 -46
  26. package/assets/init/root/.github/workflows/qfai-validate.yml +39 -0
  27. package/assets/init/root/qfai.config.yaml +1 -2
  28. package/dist/cli/index.cjs +8787 -5641
  29. package/dist/cli/index.cjs.map +1 -1
  30. package/dist/cli/index.mjs +5993 -2847
  31. package/dist/cli/index.mjs.map +1 -1
  32. package/dist/index.cjs +2677 -702
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +102 -23
  35. package/dist/index.d.ts +102 -23
  36. package/dist/index.mjs +2651 -675
  37. package/dist/index.mjs.map +1 -1
  38. package/package.json +4 -2
  39. package/assets/scripts/capture-screenshots.js +0 -128
package/dist/index.d.cts CHANGED
@@ -37,7 +37,7 @@ type ValidationCounts = {
37
37
  warning: number;
38
38
  error: number;
39
39
  };
40
- type ValidationPhase = "full" | "atdd" | "tdd" | "refinement";
40
+ type ValidationProfile = "discussion" | "sdd" | "prototyping" | "atdd" | "tdd" | "verify" | "full";
41
41
  type ValidationTraceability = {
42
42
  sc: ScCoverage;
43
43
  testFiles: TestFileScan;
@@ -78,7 +78,7 @@ type ValidationWaivers = {
78
78
  };
79
79
  type ValidationResult = {
80
80
  toolVersion: string;
81
- phase?: ValidationPhase;
81
+ profile?: ValidationProfile;
82
82
  issues: Issue[];
83
83
  counts: ValidationCounts;
84
84
  traceability: ValidationTraceability;
@@ -121,6 +121,12 @@ type QfaiValidationConfig = {
121
121
  requireSizeTags: boolean;
122
122
  maxE2eScenarioRatio: number | null;
123
123
  maxE2eScenarioCount: number | null;
124
+ /**
125
+ * When true (default), `qfai validate` rejects `it.todo` / `test.todo` /
126
+ * `describe.todo` stubs in test files (spec-0012, QFAI-TEST-001).
127
+ * Set to false to opt out while migrating an existing project.
128
+ */
129
+ forbidTestTodoStubs: boolean;
124
130
  };
125
131
  traceability: {
126
132
  brMustHaveSc: boolean;
@@ -156,13 +162,24 @@ type QfaiUiuxConfig = {
156
162
  type QfaiPrototypingCalibrationConfig = {
157
163
  packPath?: string;
158
164
  };
165
+ type QfaiPrototypingExecutionConfig = {
166
+ targetUrl?: string | null;
167
+ /**
168
+ * Browser tool handed to the AI evaluator sub-agent (spec-0012).
169
+ * The only accepted value is `"playwright-cli"`.
170
+ */
171
+ browserTool: "playwright-cli";
172
+ };
159
173
  type QfaiPrototypingConfig = {
160
174
  calibration?: QfaiPrototypingCalibrationConfig;
161
- execution?: {
162
- targetUrl?: string | null;
163
- browserProvider?: string;
164
- renderProvider?: string;
165
- };
175
+ execution?: QfaiPrototypingExecutionConfig;
176
+ /**
177
+ * v1.8.4: explicit primary spec ID for `/qfai-prototyping`. If omitted,
178
+ * `resolvePrimaryPrototypingSpec` auto-detects via the prototyping marker
179
+ * (`surface_type: ui-bearing`) in `01_Spec.md`. Format: 4-digit string,
180
+ * e.g. `"0012"`.
181
+ */
182
+ primarySpecId?: string;
166
183
  };
167
184
  type QfaiConfig = {
168
185
  paths: QfaiPaths;
@@ -314,6 +331,22 @@ type CanonicalPrototypingSurface = (typeof CANONICAL_PROTOTYPING_SURFACES)[numbe
314
331
 
315
332
  declare const PROTOTYPING_MODES: readonly ["low-cost", "standard", "full-harness"];
316
333
  declare const DEFAULT_PROTOTYPING_MODE: "standard";
334
+ /**
335
+ * Maximum cycles permitted per prototyping mode.
336
+ *
337
+ * Per spec-0017 REQ-0001 (mode invariant), modes differ only in maxCycles.
338
+ * All other obligations (review cycle, evidence, reviewer gate, completion
339
+ * criteria) are identical across modes.
340
+ */
341
+ declare const PROTOTYPING_MAX_CYCLES: {
342
+ readonly "low-cost": 1;
343
+ readonly standard: 3;
344
+ readonly "full-harness": 20;
345
+ };
346
+ /**
347
+ * Alias retained for callers still using spec-0012 wording.
348
+ * Will be removed in a later phase once all callers reference PROTOTYPING_MAX_CYCLES.
349
+ */
317
350
  declare const PROTOTYPING_MAX_ITERATIONS: {
318
351
  readonly "low-cost": 1;
319
352
  readonly standard: 3;
@@ -323,18 +356,42 @@ declare const PROTOTYPING_SUPPORTED_SURFACES: readonly ["web", "mobile", "deskto
323
356
  type PrototypingMode = (typeof PROTOTYPING_MODES)[number];
324
357
  type ModeSelectionSource = "explicit-request" | "system-default";
325
358
  type PrototypingSurface = CanonicalPrototypingSurface;
359
+ type PrototypingBrowserTool = "playwright-cli";
326
360
  type ModeResolutionResult = {
327
361
  requested?: PrototypingMode;
328
362
  effective: PrototypingMode;
329
363
  source: ModeSelectionSource;
330
364
  rationale: string;
331
365
  };
366
+ /**
367
+ * Prototyping obligations (spec-0017 REQ-0001, REQ-0002, REQ-0004).
368
+ *
369
+ * Every obligation flag is true for every mode. The only mode-dependent
370
+ * value is {@link maxCycles}. Validators enforcing per-mode differentiation
371
+ * for any other field violate the mode invariant (QFAI-PROT-MODE-001).
372
+ */
332
373
  type PrototypingObligations = {
374
+ /** Browser tool handed to the AI evaluator sub-agent. */
375
+ browserTool: PrototypingBrowserTool;
376
+ requireExecutionPlan: boolean;
377
+ requirePlaywrightEvidence: boolean;
378
+ requireReviewBundle: boolean;
379
+ requireEvaluatorReview: boolean;
380
+ requireBestOfHistory: boolean;
381
+ requireBreakthrough: boolean;
382
+ requireIndependentReviewerGate: boolean;
383
+ requirePerfect100Completion: boolean;
333
384
  requireRuntimeGate: boolean;
334
385
  requireUiFidelity: boolean;
335
386
  requireRenderBundle: boolean;
336
387
  requireBrowserQaBundle: boolean;
337
388
  requireIterations: boolean;
389
+ /** Cycle budget; the only mode-dependent value (spec-0017 REQ-0001). */
390
+ maxCycles: number;
391
+ /**
392
+ * Alias for {@link maxCycles} kept for callers still using the spec-0012
393
+ * "iterations" vocabulary. Same numeric value.
394
+ */
338
395
  maxIterations: number;
339
396
  validCombination: boolean;
340
397
  invalidReason?: string;
@@ -348,6 +405,13 @@ declare function isValidPrototypingMode(value: unknown): value is PrototypingMod
348
405
  declare function isValidPrototypingSurface(value: unknown): value is PrototypingSurface;
349
406
  declare function isSupportedPrototypingSurface(surface: string): surface is PrototypingSurface;
350
407
  declare function resolvePrototypingMode(requested?: PrototypingMode): ModeResolutionResult;
408
+ /**
409
+ * Derive prototyping obligations for a (surface, mode) pair.
410
+ *
411
+ * Per spec-0017 REQ-0001 the return value is identical across modes except
412
+ * for {@link PrototypingObligations.maxCycles}. Callers MUST NOT branch
413
+ * on mode when deciding which obligation to enforce.
414
+ */
351
415
  declare function derivePrototypingObligations(input: {
352
416
  surface: PrototypingSurface;
353
417
  effectiveMode: PrototypingMode;
@@ -544,9 +608,25 @@ type ReportFullHarnessExecution = {
544
608
  browserQaPhasesSkipped: number;
545
609
  browserQaTotalFindings: number;
546
610
  };
611
+ type ReportRoundLifecycle = {
612
+ schemaVersion: "2.0";
613
+ rounds: number;
614
+ roundIds: string[];
615
+ candidatesObserved: number;
616
+ perfectRounds: number;
617
+ harvestArtifacts: number;
618
+ narrowDecisions: number;
619
+ absorptionPlans: number;
620
+ reimplementations: number;
621
+ polishCycles: number;
622
+ completedPolishCycles: number;
623
+ perfectPolishCycles: number;
624
+ polishKinds: Record<string, number>;
625
+ };
547
626
  type ReportPrototypingSummary = {
548
627
  surfaceClassification?: ReportSurfaceClassification;
549
628
  fullHarnessExecution?: ReportFullHarnessExecution;
629
+ roundLifecycle?: ReportRoundLifecycle;
550
630
  mode: {
551
631
  requested?: string;
552
632
  effective: string;
@@ -662,7 +742,7 @@ declare function formatReportMarkdown(data: ReportData, options?: ReportMarkdown
662
742
  declare function formatReportJson(data: ReportData): string;
663
743
 
664
744
  type ValidationOptions = {
665
- phase?: ValidationPhase;
745
+ profile?: ValidationProfile;
666
746
  platform?: string;
667
747
  };
668
748
  declare function validateProject(root: string, configResult?: ConfigLoadResult, options?: ValidationOptions): Promise<ValidationResult>;
@@ -682,7 +762,9 @@ declare function validateOrphanProhibition(root: string, config: QfaiConfig): Pr
682
762
 
683
763
  declare function validateSpecSplitByCapability(root: string, config: QfaiConfig): Promise<Issue[]>;
684
764
 
685
- declare function validateTraceability(root: string, config: QfaiConfig, phase: ValidationPhase): Promise<Issue[]>;
765
+ declare function validateTraceability(root: string, config: QfaiConfig, options: {
766
+ includeCodeReferences: boolean;
767
+ }): Promise<Issue[]>;
686
768
 
687
769
  type SurfaceType = CanonicalPrototypingSurface | "non-ui";
688
770
  declare const DISCUSSION_UI_BEARING_SURFACES: Set<SurfaceType>;
@@ -843,10 +925,13 @@ type FullHarnessHandoff = {
843
925
  };
844
926
 
845
927
  /**
846
- * Full-harness mode types.
928
+ * Legacy full-harness mode types (spec-0012).
847
929
  *
848
- * Full-harness now follows the reviewerScores/allItemsPass95 evidence schema
849
- * used by prototyping.json. Legacy weighted totals are intentionally excluded.
930
+ * NOTE: superseded by the cycle-centric `PrototypingCycleEvidence` /
931
+ * `PrototypingEvidenceRecord` schema in
932
+ * `packages/qfai/src/core/prototyping/types.ts` (spec-0017 REQ-0005).
933
+ * New code should consume the prototyping schema. Legacy callers remain
934
+ * supported for back-compat with spec-0012 callers.
850
935
  */
851
936
  type FullHarnessAxisScore = {
852
937
  axisId: string;
@@ -877,7 +962,7 @@ type FullHarnessIteration = {
877
962
  limitations: string[];
878
963
  evidenceRefs: FullHarnessEvidenceRefs;
879
964
  reviewerScores: FullHarnessReviewerScore[];
880
- allItemsPass95: boolean;
965
+ allReviewerAxesPerfect100: boolean;
881
966
  stopReason?: string;
882
967
  };
883
968
  type TerminationReason = "converged" | "max-iterations" | "plateau" | "manual-stop";
@@ -890,7 +975,7 @@ type FullHarnessScoreSnapshot = {
890
975
  axisCount: number;
891
976
  minScore: number | null;
892
977
  averageScore: number | null;
893
- allItemsPass95: boolean;
978
+ allReviewerAxesPerfect100: boolean;
894
979
  commitSha: string;
895
980
  };
896
981
  type FullHarnessHistory = {
@@ -918,7 +1003,7 @@ type MeasurementInput = {
918
1003
  discussionDirRelative?: string;
919
1004
  trendRefs: string[];
920
1005
  reviewerScores: FullHarnessReviewerScore[];
921
- allItemsPass95: boolean;
1006
+ allReviewerAxesPerfect100: boolean;
922
1007
  stopReason?: string;
923
1008
  };
924
1009
  type MeasurementResult = {
@@ -1065,7 +1150,7 @@ declare function writeEvidenceBundles(input: {
1065
1150
  *
1066
1151
  * Reads previous iterations from prototyping.json,
1067
1152
  * appends new iteration, and recomputes bestIteration/scoringTrace from
1068
- * reviewerScores/allItemsPass95 evidence.
1153
+ * reviewerScores/allReviewerAxesPerfect100 evidence.
1069
1154
  */
1070
1155
 
1071
1156
  declare function loadHistory(root: string): Promise<FullHarnessHistory | null>;
@@ -1097,10 +1182,4 @@ declare function validateReviewer(reviewer: string | undefined): string;
1097
1182
  */
1098
1183
  declare function resolveCommitSha(root: string): Promise<string>;
1099
1184
 
1100
- declare function createPlaywrightRenderAdapter(input: {
1101
- targetUrl?: string;
1102
- }): RenderCaptureAdapter;
1103
-
1104
- declare function createPlaywrightBrowserQaProvider(): BrowserQaProvider;
1105
-
1106
- export { type AtddCodeTraceabilityResult, type AtddForbiddenRef, type AtddSpecRefs, type AtddTestKind, type AtddTraceabilityMissing, type AtddTraceabilityScan, type AtddUnknownRef, type AtddUnknownRefKind, BROWSER_QA_PHASES, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_PROTOTYPING_MODE, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DecisionGuardrail, type DecisionGuardrailEntry, type FailOn, type FinalDecision, type FullHarnessAxisScore, type FullHarnessCalibrationRef, type FullHarnessEvidenceRefs, type FullHarnessHistory, type FullHarnessIteration, type FullHarnessReviewerScore, type FullHarnessScoreSnapshot, type GuardrailCheckResult, type GuardrailIssue, type GuardrailIssueSeverity, type GuardrailLoadError, type GuardrailLoadResult, type GuardrailType, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type MeasurementInput, type MeasurementResult, type ModeResolutionResult, type ModeSelectionSource, type OrphanContractsPolicy, type OutputFormat, PROTOTYPING_MAX_ITERATIONS, PROTOTYPING_MODES, PROTOTYPING_SUPPORTED_SURFACES, type PrototypingMode, type PrototypingObligations, type PrototypingSurface, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingCalibrationConfig, type QfaiPrototypingConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, REVIEWER_PLACEHOLDERS, type ReportChangeType, type ReportChangeTypeSummary, type ReportChangeTypeWarning, type ReportContractCoverage, type ReportData, type ReportDeltaCoverage, type ReportFullHarnessExecution, type ReportGuardrailItem, type ReportGuardrails, type ReportIds, type ReportPrototypingSummary, type ReportRuleFinding, type ReportSpecContractRefs, type ReportSpecCoverage, type ReportSummary, type ReportSurfaceClassification, type ReportTddCoverage, type ReportTddCoverageSpec, type ReportTestStrategy, type ReportTraceability, type ReportWaivers, type ReviewerLogVerdict, type ReviewerSignoffStatus, type RunSddPreflightOptions, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type TerminationReason, type TraceabilitySeverity, type UiFidelityStatus, VISUAL_BROWSER_SURFACES, type ValidationCounts, type ValidationOptions, type ValidationPhase, type ValidationResult, type ValidationTraceability, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, appendIteration, checkDecisionGuardrails, computeTerminationReason, createPlaywrightBrowserQaProvider, createPlaywrightRenderAdapter, createReportData, defaultConfig, derivePrototypingObligations, evaluateAtddCodeTraceability, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractDecisionGuardrailsFromMarkdown, extractIds, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, filterDecisionGuardrailsByKeyword, findConfigRoot, formatGuardrailsForLlm, formatReportJson, formatReportMarkdown, getConfigPath, isDiscussionUiBearingSurfaceType, isNonUiDiscussionSurface, isSupportedPrototypingSurface, isValidPrototypingMode, isValidPrototypingSurface, lintSql, loadConfig, loadDecisionGuardrails, loadHistory, normalizeDecisionGuardrails, requiresVisualBrowserEvidence, resolveCommitSha, resolvePath, resolvePrototypingMode, resolveToolVersion, runBrowserQaOrchestrated, runRenderCapture, runSddPreflight, sortDecisionGuardrails, summarizeBrowserQaResult, validateAtddCodeTraceability, validateContracts, validateDefinedIds, validateLayeredTraceability, validateOrphanProhibition, validateProject, validateReviewer, validateSpecSplitByCapability, validateTraceability, writeEvidenceBundles };
1185
+ export { type AtddCodeTraceabilityResult, type AtddForbiddenRef, type AtddSpecRefs, type AtddTestKind, type AtddTraceabilityMissing, type AtddTraceabilityScan, type AtddUnknownRef, type AtddUnknownRefKind, BROWSER_QA_PHASES, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_PROTOTYPING_MODE, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DecisionGuardrail, type DecisionGuardrailEntry, type FailOn, type FinalDecision, type FullHarnessAxisScore, type FullHarnessCalibrationRef, type FullHarnessEvidenceRefs, type FullHarnessHistory, type FullHarnessIteration, type FullHarnessReviewerScore, type FullHarnessScoreSnapshot, type GuardrailCheckResult, type GuardrailIssue, type GuardrailIssueSeverity, type GuardrailLoadError, type GuardrailLoadResult, type GuardrailType, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type MeasurementInput, type MeasurementResult, type ModeResolutionResult, type ModeSelectionSource, type OrphanContractsPolicy, type OutputFormat, PROTOTYPING_MAX_CYCLES, PROTOTYPING_MAX_ITERATIONS, PROTOTYPING_MODES, PROTOTYPING_SUPPORTED_SURFACES, type PrototypingBrowserTool, type PrototypingMode, type PrototypingObligations, type PrototypingSurface, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingCalibrationConfig, type QfaiPrototypingConfig, type QfaiPrototypingExecutionConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, REVIEWER_PLACEHOLDERS, type ReportChangeType, type ReportChangeTypeSummary, type ReportChangeTypeWarning, type ReportContractCoverage, type ReportData, type ReportDeltaCoverage, type ReportFullHarnessExecution, type ReportGuardrailItem, type ReportGuardrails, type ReportIds, type ReportPrototypingSummary, type ReportRoundLifecycle, type ReportRuleFinding, type ReportSpecContractRefs, type ReportSpecCoverage, type ReportSummary, type ReportSurfaceClassification, type ReportTddCoverage, type ReportTddCoverageSpec, type ReportTestStrategy, type ReportTraceability, type ReportWaivers, type ReviewerLogVerdict, type ReviewerSignoffStatus, type RunSddPreflightOptions, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type TerminationReason, type TraceabilitySeverity, type UiFidelityStatus, VISUAL_BROWSER_SURFACES, type ValidationCounts, type ValidationOptions, type ValidationProfile, type ValidationResult, type ValidationTraceability, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, appendIteration, checkDecisionGuardrails, computeTerminationReason, createReportData, defaultConfig, derivePrototypingObligations, evaluateAtddCodeTraceability, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractDecisionGuardrailsFromMarkdown, extractIds, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, filterDecisionGuardrailsByKeyword, findConfigRoot, formatGuardrailsForLlm, formatReportJson, formatReportMarkdown, getConfigPath, isDiscussionUiBearingSurfaceType, isNonUiDiscussionSurface, isSupportedPrototypingSurface, isValidPrototypingMode, isValidPrototypingSurface, lintSql, loadConfig, loadDecisionGuardrails, loadHistory, normalizeDecisionGuardrails, requiresVisualBrowserEvidence, resolveCommitSha, resolvePath, resolvePrototypingMode, resolveToolVersion, runBrowserQaOrchestrated, runRenderCapture, runSddPreflight, sortDecisionGuardrails, summarizeBrowserQaResult, validateAtddCodeTraceability, validateContracts, validateDefinedIds, validateLayeredTraceability, validateOrphanProhibition, validateProject, validateReviewer, validateSpecSplitByCapability, validateTraceability, writeEvidenceBundles };
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ type ValidationCounts = {
37
37
  warning: number;
38
38
  error: number;
39
39
  };
40
- type ValidationPhase = "full" | "atdd" | "tdd" | "refinement";
40
+ type ValidationProfile = "discussion" | "sdd" | "prototyping" | "atdd" | "tdd" | "verify" | "full";
41
41
  type ValidationTraceability = {
42
42
  sc: ScCoverage;
43
43
  testFiles: TestFileScan;
@@ -78,7 +78,7 @@ type ValidationWaivers = {
78
78
  };
79
79
  type ValidationResult = {
80
80
  toolVersion: string;
81
- phase?: ValidationPhase;
81
+ profile?: ValidationProfile;
82
82
  issues: Issue[];
83
83
  counts: ValidationCounts;
84
84
  traceability: ValidationTraceability;
@@ -121,6 +121,12 @@ type QfaiValidationConfig = {
121
121
  requireSizeTags: boolean;
122
122
  maxE2eScenarioRatio: number | null;
123
123
  maxE2eScenarioCount: number | null;
124
+ /**
125
+ * When true (default), `qfai validate` rejects `it.todo` / `test.todo` /
126
+ * `describe.todo` stubs in test files (spec-0012, QFAI-TEST-001).
127
+ * Set to false to opt out while migrating an existing project.
128
+ */
129
+ forbidTestTodoStubs: boolean;
124
130
  };
125
131
  traceability: {
126
132
  brMustHaveSc: boolean;
@@ -156,13 +162,24 @@ type QfaiUiuxConfig = {
156
162
  type QfaiPrototypingCalibrationConfig = {
157
163
  packPath?: string;
158
164
  };
165
+ type QfaiPrototypingExecutionConfig = {
166
+ targetUrl?: string | null;
167
+ /**
168
+ * Browser tool handed to the AI evaluator sub-agent (spec-0012).
169
+ * The only accepted value is `"playwright-cli"`.
170
+ */
171
+ browserTool: "playwright-cli";
172
+ };
159
173
  type QfaiPrototypingConfig = {
160
174
  calibration?: QfaiPrototypingCalibrationConfig;
161
- execution?: {
162
- targetUrl?: string | null;
163
- browserProvider?: string;
164
- renderProvider?: string;
165
- };
175
+ execution?: QfaiPrototypingExecutionConfig;
176
+ /**
177
+ * v1.8.4: explicit primary spec ID for `/qfai-prototyping`. If omitted,
178
+ * `resolvePrimaryPrototypingSpec` auto-detects via the prototyping marker
179
+ * (`surface_type: ui-bearing`) in `01_Spec.md`. Format: 4-digit string,
180
+ * e.g. `"0012"`.
181
+ */
182
+ primarySpecId?: string;
166
183
  };
167
184
  type QfaiConfig = {
168
185
  paths: QfaiPaths;
@@ -314,6 +331,22 @@ type CanonicalPrototypingSurface = (typeof CANONICAL_PROTOTYPING_SURFACES)[numbe
314
331
 
315
332
  declare const PROTOTYPING_MODES: readonly ["low-cost", "standard", "full-harness"];
316
333
  declare const DEFAULT_PROTOTYPING_MODE: "standard";
334
+ /**
335
+ * Maximum cycles permitted per prototyping mode.
336
+ *
337
+ * Per spec-0017 REQ-0001 (mode invariant), modes differ only in maxCycles.
338
+ * All other obligations (review cycle, evidence, reviewer gate, completion
339
+ * criteria) are identical across modes.
340
+ */
341
+ declare const PROTOTYPING_MAX_CYCLES: {
342
+ readonly "low-cost": 1;
343
+ readonly standard: 3;
344
+ readonly "full-harness": 20;
345
+ };
346
+ /**
347
+ * Alias retained for callers still using spec-0012 wording.
348
+ * Will be removed in a later phase once all callers reference PROTOTYPING_MAX_CYCLES.
349
+ */
317
350
  declare const PROTOTYPING_MAX_ITERATIONS: {
318
351
  readonly "low-cost": 1;
319
352
  readonly standard: 3;
@@ -323,18 +356,42 @@ declare const PROTOTYPING_SUPPORTED_SURFACES: readonly ["web", "mobile", "deskto
323
356
  type PrototypingMode = (typeof PROTOTYPING_MODES)[number];
324
357
  type ModeSelectionSource = "explicit-request" | "system-default";
325
358
  type PrototypingSurface = CanonicalPrototypingSurface;
359
+ type PrototypingBrowserTool = "playwright-cli";
326
360
  type ModeResolutionResult = {
327
361
  requested?: PrototypingMode;
328
362
  effective: PrototypingMode;
329
363
  source: ModeSelectionSource;
330
364
  rationale: string;
331
365
  };
366
+ /**
367
+ * Prototyping obligations (spec-0017 REQ-0001, REQ-0002, REQ-0004).
368
+ *
369
+ * Every obligation flag is true for every mode. The only mode-dependent
370
+ * value is {@link maxCycles}. Validators enforcing per-mode differentiation
371
+ * for any other field violate the mode invariant (QFAI-PROT-MODE-001).
372
+ */
332
373
  type PrototypingObligations = {
374
+ /** Browser tool handed to the AI evaluator sub-agent. */
375
+ browserTool: PrototypingBrowserTool;
376
+ requireExecutionPlan: boolean;
377
+ requirePlaywrightEvidence: boolean;
378
+ requireReviewBundle: boolean;
379
+ requireEvaluatorReview: boolean;
380
+ requireBestOfHistory: boolean;
381
+ requireBreakthrough: boolean;
382
+ requireIndependentReviewerGate: boolean;
383
+ requirePerfect100Completion: boolean;
333
384
  requireRuntimeGate: boolean;
334
385
  requireUiFidelity: boolean;
335
386
  requireRenderBundle: boolean;
336
387
  requireBrowserQaBundle: boolean;
337
388
  requireIterations: boolean;
389
+ /** Cycle budget; the only mode-dependent value (spec-0017 REQ-0001). */
390
+ maxCycles: number;
391
+ /**
392
+ * Alias for {@link maxCycles} kept for callers still using the spec-0012
393
+ * "iterations" vocabulary. Same numeric value.
394
+ */
338
395
  maxIterations: number;
339
396
  validCombination: boolean;
340
397
  invalidReason?: string;
@@ -348,6 +405,13 @@ declare function isValidPrototypingMode(value: unknown): value is PrototypingMod
348
405
  declare function isValidPrototypingSurface(value: unknown): value is PrototypingSurface;
349
406
  declare function isSupportedPrototypingSurface(surface: string): surface is PrototypingSurface;
350
407
  declare function resolvePrototypingMode(requested?: PrototypingMode): ModeResolutionResult;
408
+ /**
409
+ * Derive prototyping obligations for a (surface, mode) pair.
410
+ *
411
+ * Per spec-0017 REQ-0001 the return value is identical across modes except
412
+ * for {@link PrototypingObligations.maxCycles}. Callers MUST NOT branch
413
+ * on mode when deciding which obligation to enforce.
414
+ */
351
415
  declare function derivePrototypingObligations(input: {
352
416
  surface: PrototypingSurface;
353
417
  effectiveMode: PrototypingMode;
@@ -544,9 +608,25 @@ type ReportFullHarnessExecution = {
544
608
  browserQaPhasesSkipped: number;
545
609
  browserQaTotalFindings: number;
546
610
  };
611
+ type ReportRoundLifecycle = {
612
+ schemaVersion: "2.0";
613
+ rounds: number;
614
+ roundIds: string[];
615
+ candidatesObserved: number;
616
+ perfectRounds: number;
617
+ harvestArtifacts: number;
618
+ narrowDecisions: number;
619
+ absorptionPlans: number;
620
+ reimplementations: number;
621
+ polishCycles: number;
622
+ completedPolishCycles: number;
623
+ perfectPolishCycles: number;
624
+ polishKinds: Record<string, number>;
625
+ };
547
626
  type ReportPrototypingSummary = {
548
627
  surfaceClassification?: ReportSurfaceClassification;
549
628
  fullHarnessExecution?: ReportFullHarnessExecution;
629
+ roundLifecycle?: ReportRoundLifecycle;
550
630
  mode: {
551
631
  requested?: string;
552
632
  effective: string;
@@ -662,7 +742,7 @@ declare function formatReportMarkdown(data: ReportData, options?: ReportMarkdown
662
742
  declare function formatReportJson(data: ReportData): string;
663
743
 
664
744
  type ValidationOptions = {
665
- phase?: ValidationPhase;
745
+ profile?: ValidationProfile;
666
746
  platform?: string;
667
747
  };
668
748
  declare function validateProject(root: string, configResult?: ConfigLoadResult, options?: ValidationOptions): Promise<ValidationResult>;
@@ -682,7 +762,9 @@ declare function validateOrphanProhibition(root: string, config: QfaiConfig): Pr
682
762
 
683
763
  declare function validateSpecSplitByCapability(root: string, config: QfaiConfig): Promise<Issue[]>;
684
764
 
685
- declare function validateTraceability(root: string, config: QfaiConfig, phase: ValidationPhase): Promise<Issue[]>;
765
+ declare function validateTraceability(root: string, config: QfaiConfig, options: {
766
+ includeCodeReferences: boolean;
767
+ }): Promise<Issue[]>;
686
768
 
687
769
  type SurfaceType = CanonicalPrototypingSurface | "non-ui";
688
770
  declare const DISCUSSION_UI_BEARING_SURFACES: Set<SurfaceType>;
@@ -843,10 +925,13 @@ type FullHarnessHandoff = {
843
925
  };
844
926
 
845
927
  /**
846
- * Full-harness mode types.
928
+ * Legacy full-harness mode types (spec-0012).
847
929
  *
848
- * Full-harness now follows the reviewerScores/allItemsPass95 evidence schema
849
- * used by prototyping.json. Legacy weighted totals are intentionally excluded.
930
+ * NOTE: superseded by the cycle-centric `PrototypingCycleEvidence` /
931
+ * `PrototypingEvidenceRecord` schema in
932
+ * `packages/qfai/src/core/prototyping/types.ts` (spec-0017 REQ-0005).
933
+ * New code should consume the prototyping schema. Legacy callers remain
934
+ * supported for back-compat with spec-0012 callers.
850
935
  */
851
936
  type FullHarnessAxisScore = {
852
937
  axisId: string;
@@ -877,7 +962,7 @@ type FullHarnessIteration = {
877
962
  limitations: string[];
878
963
  evidenceRefs: FullHarnessEvidenceRefs;
879
964
  reviewerScores: FullHarnessReviewerScore[];
880
- allItemsPass95: boolean;
965
+ allReviewerAxesPerfect100: boolean;
881
966
  stopReason?: string;
882
967
  };
883
968
  type TerminationReason = "converged" | "max-iterations" | "plateau" | "manual-stop";
@@ -890,7 +975,7 @@ type FullHarnessScoreSnapshot = {
890
975
  axisCount: number;
891
976
  minScore: number | null;
892
977
  averageScore: number | null;
893
- allItemsPass95: boolean;
978
+ allReviewerAxesPerfect100: boolean;
894
979
  commitSha: string;
895
980
  };
896
981
  type FullHarnessHistory = {
@@ -918,7 +1003,7 @@ type MeasurementInput = {
918
1003
  discussionDirRelative?: string;
919
1004
  trendRefs: string[];
920
1005
  reviewerScores: FullHarnessReviewerScore[];
921
- allItemsPass95: boolean;
1006
+ allReviewerAxesPerfect100: boolean;
922
1007
  stopReason?: string;
923
1008
  };
924
1009
  type MeasurementResult = {
@@ -1065,7 +1150,7 @@ declare function writeEvidenceBundles(input: {
1065
1150
  *
1066
1151
  * Reads previous iterations from prototyping.json,
1067
1152
  * appends new iteration, and recomputes bestIteration/scoringTrace from
1068
- * reviewerScores/allItemsPass95 evidence.
1153
+ * reviewerScores/allReviewerAxesPerfect100 evidence.
1069
1154
  */
1070
1155
 
1071
1156
  declare function loadHistory(root: string): Promise<FullHarnessHistory | null>;
@@ -1097,10 +1182,4 @@ declare function validateReviewer(reviewer: string | undefined): string;
1097
1182
  */
1098
1183
  declare function resolveCommitSha(root: string): Promise<string>;
1099
1184
 
1100
- declare function createPlaywrightRenderAdapter(input: {
1101
- targetUrl?: string;
1102
- }): RenderCaptureAdapter;
1103
-
1104
- declare function createPlaywrightBrowserQaProvider(): BrowserQaProvider;
1105
-
1106
- export { type AtddCodeTraceabilityResult, type AtddForbiddenRef, type AtddSpecRefs, type AtddTestKind, type AtddTraceabilityMissing, type AtddTraceabilityScan, type AtddUnknownRef, type AtddUnknownRefKind, BROWSER_QA_PHASES, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_PROTOTYPING_MODE, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DecisionGuardrail, type DecisionGuardrailEntry, type FailOn, type FinalDecision, type FullHarnessAxisScore, type FullHarnessCalibrationRef, type FullHarnessEvidenceRefs, type FullHarnessHistory, type FullHarnessIteration, type FullHarnessReviewerScore, type FullHarnessScoreSnapshot, type GuardrailCheckResult, type GuardrailIssue, type GuardrailIssueSeverity, type GuardrailLoadError, type GuardrailLoadResult, type GuardrailType, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type MeasurementInput, type MeasurementResult, type ModeResolutionResult, type ModeSelectionSource, type OrphanContractsPolicy, type OutputFormat, PROTOTYPING_MAX_ITERATIONS, PROTOTYPING_MODES, PROTOTYPING_SUPPORTED_SURFACES, type PrototypingMode, type PrototypingObligations, type PrototypingSurface, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingCalibrationConfig, type QfaiPrototypingConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, REVIEWER_PLACEHOLDERS, type ReportChangeType, type ReportChangeTypeSummary, type ReportChangeTypeWarning, type ReportContractCoverage, type ReportData, type ReportDeltaCoverage, type ReportFullHarnessExecution, type ReportGuardrailItem, type ReportGuardrails, type ReportIds, type ReportPrototypingSummary, type ReportRuleFinding, type ReportSpecContractRefs, type ReportSpecCoverage, type ReportSummary, type ReportSurfaceClassification, type ReportTddCoverage, type ReportTddCoverageSpec, type ReportTestStrategy, type ReportTraceability, type ReportWaivers, type ReviewerLogVerdict, type ReviewerSignoffStatus, type RunSddPreflightOptions, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type TerminationReason, type TraceabilitySeverity, type UiFidelityStatus, VISUAL_BROWSER_SURFACES, type ValidationCounts, type ValidationOptions, type ValidationPhase, type ValidationResult, type ValidationTraceability, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, appendIteration, checkDecisionGuardrails, computeTerminationReason, createPlaywrightBrowserQaProvider, createPlaywrightRenderAdapter, createReportData, defaultConfig, derivePrototypingObligations, evaluateAtddCodeTraceability, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractDecisionGuardrailsFromMarkdown, extractIds, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, filterDecisionGuardrailsByKeyword, findConfigRoot, formatGuardrailsForLlm, formatReportJson, formatReportMarkdown, getConfigPath, isDiscussionUiBearingSurfaceType, isNonUiDiscussionSurface, isSupportedPrototypingSurface, isValidPrototypingMode, isValidPrototypingSurface, lintSql, loadConfig, loadDecisionGuardrails, loadHistory, normalizeDecisionGuardrails, requiresVisualBrowserEvidence, resolveCommitSha, resolvePath, resolvePrototypingMode, resolveToolVersion, runBrowserQaOrchestrated, runRenderCapture, runSddPreflight, sortDecisionGuardrails, summarizeBrowserQaResult, validateAtddCodeTraceability, validateContracts, validateDefinedIds, validateLayeredTraceability, validateOrphanProhibition, validateProject, validateReviewer, validateSpecSplitByCapability, validateTraceability, writeEvidenceBundles };
1185
+ export { type AtddCodeTraceabilityResult, type AtddForbiddenRef, type AtddSpecRefs, type AtddTestKind, type AtddTraceabilityMissing, type AtddTraceabilityScan, type AtddUnknownRef, type AtddUnknownRefKind, BROWSER_QA_PHASES, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DEFAULT_PROTOTYPING_MODE, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DecisionGuardrail, type DecisionGuardrailEntry, type FailOn, type FinalDecision, type FullHarnessAxisScore, type FullHarnessCalibrationRef, type FullHarnessEvidenceRefs, type FullHarnessHistory, type FullHarnessIteration, type FullHarnessReviewerScore, type FullHarnessScoreSnapshot, type GuardrailCheckResult, type GuardrailIssue, type GuardrailIssueSeverity, type GuardrailLoadError, type GuardrailLoadResult, type GuardrailType, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type MeasurementInput, type MeasurementResult, type ModeResolutionResult, type ModeSelectionSource, type OrphanContractsPolicy, type OutputFormat, PROTOTYPING_MAX_CYCLES, PROTOTYPING_MAX_ITERATIONS, PROTOTYPING_MODES, PROTOTYPING_SUPPORTED_SURFACES, type PrototypingBrowserTool, type PrototypingMode, type PrototypingObligations, type PrototypingSurface, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingCalibrationConfig, type QfaiPrototypingConfig, type QfaiPrototypingExecutionConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, REVIEWER_PLACEHOLDERS, type ReportChangeType, type ReportChangeTypeSummary, type ReportChangeTypeWarning, type ReportContractCoverage, type ReportData, type ReportDeltaCoverage, type ReportFullHarnessExecution, type ReportGuardrailItem, type ReportGuardrails, type ReportIds, type ReportPrototypingSummary, type ReportRoundLifecycle, type ReportRuleFinding, type ReportSpecContractRefs, type ReportSpecCoverage, type ReportSummary, type ReportSurfaceClassification, type ReportTddCoverage, type ReportTddCoverageSpec, type ReportTestStrategy, type ReportTraceability, type ReportWaivers, type ReviewerLogVerdict, type ReviewerSignoffStatus, type RunSddPreflightOptions, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type TerminationReason, type TraceabilitySeverity, type UiFidelityStatus, VISUAL_BROWSER_SURFACES, type ValidationCounts, type ValidationOptions, type ValidationProfile, type ValidationResult, type ValidationTraceability, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, appendIteration, checkDecisionGuardrails, computeTerminationReason, createReportData, defaultConfig, derivePrototypingObligations, evaluateAtddCodeTraceability, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractDecisionGuardrailsFromMarkdown, extractIds, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, filterDecisionGuardrailsByKeyword, findConfigRoot, formatGuardrailsForLlm, formatReportJson, formatReportMarkdown, getConfigPath, isDiscussionUiBearingSurfaceType, isNonUiDiscussionSurface, isSupportedPrototypingSurface, isValidPrototypingMode, isValidPrototypingSurface, lintSql, loadConfig, loadDecisionGuardrails, loadHistory, normalizeDecisionGuardrails, requiresVisualBrowserEvidence, resolveCommitSha, resolvePath, resolvePrototypingMode, resolveToolVersion, runBrowserQaOrchestrated, runRenderCapture, runSddPreflight, sortDecisionGuardrails, summarizeBrowserQaResult, validateAtddCodeTraceability, validateContracts, validateDefinedIds, validateLayeredTraceability, validateOrphanProhibition, validateProject, validateReviewer, validateSpecSplitByCapability, validateTraceability, writeEvidenceBundles };