qfai 1.8.2 → 1.8.3

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 +121 -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 +20 -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 +2 -0
  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 +2539 -927
  29. package/dist/cli/index.cjs.map +1 -1
  30. package/dist/cli/index.mjs +2624 -1012
  31. package/dist/cli/index.mjs.map +1 -1
  32. package/dist/index.cjs +1120 -421
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +95 -23
  35. package/dist/index.d.ts +95 -23
  36. package/dist/index.mjs +1114 -414
  37. package/dist/index.mjs.map +1 -1
  38. package/package.json +3 -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,17 @@ 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;
166
176
  };
167
177
  type QfaiConfig = {
168
178
  paths: QfaiPaths;
@@ -314,6 +324,22 @@ type CanonicalPrototypingSurface = (typeof CANONICAL_PROTOTYPING_SURFACES)[numbe
314
324
 
315
325
  declare const PROTOTYPING_MODES: readonly ["low-cost", "standard", "full-harness"];
316
326
  declare const DEFAULT_PROTOTYPING_MODE: "standard";
327
+ /**
328
+ * Maximum cycles permitted per prototyping mode.
329
+ *
330
+ * Per spec-0017 REQ-0001 (mode invariant), modes differ only in maxCycles.
331
+ * All other obligations (review cycle, evidence, reviewer gate, completion
332
+ * criteria) are identical across modes.
333
+ */
334
+ declare const PROTOTYPING_MAX_CYCLES: {
335
+ readonly "low-cost": 1;
336
+ readonly standard: 3;
337
+ readonly "full-harness": 20;
338
+ };
339
+ /**
340
+ * Alias retained for callers still using spec-0012 wording.
341
+ * Will be removed in a later phase once all callers reference PROTOTYPING_MAX_CYCLES.
342
+ */
317
343
  declare const PROTOTYPING_MAX_ITERATIONS: {
318
344
  readonly "low-cost": 1;
319
345
  readonly standard: 3;
@@ -323,18 +349,42 @@ declare const PROTOTYPING_SUPPORTED_SURFACES: readonly ["web", "mobile", "deskto
323
349
  type PrototypingMode = (typeof PROTOTYPING_MODES)[number];
324
350
  type ModeSelectionSource = "explicit-request" | "system-default";
325
351
  type PrototypingSurface = CanonicalPrototypingSurface;
352
+ type PrototypingBrowserTool = "playwright-cli";
326
353
  type ModeResolutionResult = {
327
354
  requested?: PrototypingMode;
328
355
  effective: PrototypingMode;
329
356
  source: ModeSelectionSource;
330
357
  rationale: string;
331
358
  };
359
+ /**
360
+ * Prototyping obligations (spec-0017 REQ-0001, REQ-0002, REQ-0004).
361
+ *
362
+ * Every obligation flag is true for every mode. The only mode-dependent
363
+ * value is {@link maxCycles}. Validators enforcing per-mode differentiation
364
+ * for any other field violate the mode invariant (QFAI-PROT-MODE-001).
365
+ */
332
366
  type PrototypingObligations = {
367
+ /** Browser tool handed to the AI evaluator sub-agent. */
368
+ browserTool: PrototypingBrowserTool;
369
+ requireExecutionPlan: boolean;
370
+ requirePlaywrightEvidence: boolean;
371
+ requireReviewBundle: boolean;
372
+ requireEvaluatorReview: boolean;
373
+ requireBestOfHistory: boolean;
374
+ requireBreakthrough: boolean;
375
+ requireIndependentReviewerGate: boolean;
376
+ requirePerfect100Completion: boolean;
333
377
  requireRuntimeGate: boolean;
334
378
  requireUiFidelity: boolean;
335
379
  requireRenderBundle: boolean;
336
380
  requireBrowserQaBundle: boolean;
337
381
  requireIterations: boolean;
382
+ /** Cycle budget; the only mode-dependent value (spec-0017 REQ-0001). */
383
+ maxCycles: number;
384
+ /**
385
+ * Alias for {@link maxCycles} kept for callers still using the spec-0012
386
+ * "iterations" vocabulary. Same numeric value.
387
+ */
338
388
  maxIterations: number;
339
389
  validCombination: boolean;
340
390
  invalidReason?: string;
@@ -348,6 +398,13 @@ declare function isValidPrototypingMode(value: unknown): value is PrototypingMod
348
398
  declare function isValidPrototypingSurface(value: unknown): value is PrototypingSurface;
349
399
  declare function isSupportedPrototypingSurface(surface: string): surface is PrototypingSurface;
350
400
  declare function resolvePrototypingMode(requested?: PrototypingMode): ModeResolutionResult;
401
+ /**
402
+ * Derive prototyping obligations for a (surface, mode) pair.
403
+ *
404
+ * Per spec-0017 REQ-0001 the return value is identical across modes except
405
+ * for {@link PrototypingObligations.maxCycles}. Callers MUST NOT branch
406
+ * on mode when deciding which obligation to enforce.
407
+ */
351
408
  declare function derivePrototypingObligations(input: {
352
409
  surface: PrototypingSurface;
353
410
  effectiveMode: PrototypingMode;
@@ -544,9 +601,25 @@ type ReportFullHarnessExecution = {
544
601
  browserQaPhasesSkipped: number;
545
602
  browserQaTotalFindings: number;
546
603
  };
604
+ type ReportRoundLifecycle = {
605
+ schemaVersion: "2.0";
606
+ rounds: number;
607
+ roundIds: string[];
608
+ candidatesObserved: number;
609
+ perfectRounds: number;
610
+ harvestArtifacts: number;
611
+ narrowDecisions: number;
612
+ absorptionPlans: number;
613
+ reimplementations: number;
614
+ polishCycles: number;
615
+ completedPolishCycles: number;
616
+ perfectPolishCycles: number;
617
+ polishKinds: Record<string, number>;
618
+ };
547
619
  type ReportPrototypingSummary = {
548
620
  surfaceClassification?: ReportSurfaceClassification;
549
621
  fullHarnessExecution?: ReportFullHarnessExecution;
622
+ roundLifecycle?: ReportRoundLifecycle;
550
623
  mode: {
551
624
  requested?: string;
552
625
  effective: string;
@@ -662,7 +735,7 @@ declare function formatReportMarkdown(data: ReportData, options?: ReportMarkdown
662
735
  declare function formatReportJson(data: ReportData): string;
663
736
 
664
737
  type ValidationOptions = {
665
- phase?: ValidationPhase;
738
+ profile?: ValidationProfile;
666
739
  platform?: string;
667
740
  };
668
741
  declare function validateProject(root: string, configResult?: ConfigLoadResult, options?: ValidationOptions): Promise<ValidationResult>;
@@ -682,7 +755,9 @@ declare function validateOrphanProhibition(root: string, config: QfaiConfig): Pr
682
755
 
683
756
  declare function validateSpecSplitByCapability(root: string, config: QfaiConfig): Promise<Issue[]>;
684
757
 
685
- declare function validateTraceability(root: string, config: QfaiConfig, phase: ValidationPhase): Promise<Issue[]>;
758
+ declare function validateTraceability(root: string, config: QfaiConfig, options: {
759
+ includeCodeReferences: boolean;
760
+ }): Promise<Issue[]>;
686
761
 
687
762
  type SurfaceType = CanonicalPrototypingSurface | "non-ui";
688
763
  declare const DISCUSSION_UI_BEARING_SURFACES: Set<SurfaceType>;
@@ -843,10 +918,13 @@ type FullHarnessHandoff = {
843
918
  };
844
919
 
845
920
  /**
846
- * Full-harness mode types.
921
+ * Legacy full-harness mode types (spec-0012).
847
922
  *
848
- * Full-harness now follows the reviewerScores/allItemsPass95 evidence schema
849
- * used by prototyping.json. Legacy weighted totals are intentionally excluded.
923
+ * NOTE: superseded by the cycle-centric `PrototypingCycleEvidence` /
924
+ * `PrototypingEvidenceRecord` schema in
925
+ * `packages/qfai/src/core/prototyping/types.ts` (spec-0017 REQ-0005).
926
+ * New code should consume the prototyping schema. Legacy callers remain
927
+ * supported for back-compat with spec-0012 callers.
850
928
  */
851
929
  type FullHarnessAxisScore = {
852
930
  axisId: string;
@@ -877,7 +955,7 @@ type FullHarnessIteration = {
877
955
  limitations: string[];
878
956
  evidenceRefs: FullHarnessEvidenceRefs;
879
957
  reviewerScores: FullHarnessReviewerScore[];
880
- allItemsPass95: boolean;
958
+ allReviewerAxesPerfect100: boolean;
881
959
  stopReason?: string;
882
960
  };
883
961
  type TerminationReason = "converged" | "max-iterations" | "plateau" | "manual-stop";
@@ -890,7 +968,7 @@ type FullHarnessScoreSnapshot = {
890
968
  axisCount: number;
891
969
  minScore: number | null;
892
970
  averageScore: number | null;
893
- allItemsPass95: boolean;
971
+ allReviewerAxesPerfect100: boolean;
894
972
  commitSha: string;
895
973
  };
896
974
  type FullHarnessHistory = {
@@ -918,7 +996,7 @@ type MeasurementInput = {
918
996
  discussionDirRelative?: string;
919
997
  trendRefs: string[];
920
998
  reviewerScores: FullHarnessReviewerScore[];
921
- allItemsPass95: boolean;
999
+ allReviewerAxesPerfect100: boolean;
922
1000
  stopReason?: string;
923
1001
  };
924
1002
  type MeasurementResult = {
@@ -1065,7 +1143,7 @@ declare function writeEvidenceBundles(input: {
1065
1143
  *
1066
1144
  * Reads previous iterations from prototyping.json,
1067
1145
  * appends new iteration, and recomputes bestIteration/scoringTrace from
1068
- * reviewerScores/allItemsPass95 evidence.
1146
+ * reviewerScores/allReviewerAxesPerfect100 evidence.
1069
1147
  */
1070
1148
 
1071
1149
  declare function loadHistory(root: string): Promise<FullHarnessHistory | null>;
@@ -1097,10 +1175,4 @@ declare function validateReviewer(reviewer: string | undefined): string;
1097
1175
  */
1098
1176
  declare function resolveCommitSha(root: string): Promise<string>;
1099
1177
 
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 };
1178
+ 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,17 @@ 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;
166
176
  };
167
177
  type QfaiConfig = {
168
178
  paths: QfaiPaths;
@@ -314,6 +324,22 @@ type CanonicalPrototypingSurface = (typeof CANONICAL_PROTOTYPING_SURFACES)[numbe
314
324
 
315
325
  declare const PROTOTYPING_MODES: readonly ["low-cost", "standard", "full-harness"];
316
326
  declare const DEFAULT_PROTOTYPING_MODE: "standard";
327
+ /**
328
+ * Maximum cycles permitted per prototyping mode.
329
+ *
330
+ * Per spec-0017 REQ-0001 (mode invariant), modes differ only in maxCycles.
331
+ * All other obligations (review cycle, evidence, reviewer gate, completion
332
+ * criteria) are identical across modes.
333
+ */
334
+ declare const PROTOTYPING_MAX_CYCLES: {
335
+ readonly "low-cost": 1;
336
+ readonly standard: 3;
337
+ readonly "full-harness": 20;
338
+ };
339
+ /**
340
+ * Alias retained for callers still using spec-0012 wording.
341
+ * Will be removed in a later phase once all callers reference PROTOTYPING_MAX_CYCLES.
342
+ */
317
343
  declare const PROTOTYPING_MAX_ITERATIONS: {
318
344
  readonly "low-cost": 1;
319
345
  readonly standard: 3;
@@ -323,18 +349,42 @@ declare const PROTOTYPING_SUPPORTED_SURFACES: readonly ["web", "mobile", "deskto
323
349
  type PrototypingMode = (typeof PROTOTYPING_MODES)[number];
324
350
  type ModeSelectionSource = "explicit-request" | "system-default";
325
351
  type PrototypingSurface = CanonicalPrototypingSurface;
352
+ type PrototypingBrowserTool = "playwright-cli";
326
353
  type ModeResolutionResult = {
327
354
  requested?: PrototypingMode;
328
355
  effective: PrototypingMode;
329
356
  source: ModeSelectionSource;
330
357
  rationale: string;
331
358
  };
359
+ /**
360
+ * Prototyping obligations (spec-0017 REQ-0001, REQ-0002, REQ-0004).
361
+ *
362
+ * Every obligation flag is true for every mode. The only mode-dependent
363
+ * value is {@link maxCycles}. Validators enforcing per-mode differentiation
364
+ * for any other field violate the mode invariant (QFAI-PROT-MODE-001).
365
+ */
332
366
  type PrototypingObligations = {
367
+ /** Browser tool handed to the AI evaluator sub-agent. */
368
+ browserTool: PrototypingBrowserTool;
369
+ requireExecutionPlan: boolean;
370
+ requirePlaywrightEvidence: boolean;
371
+ requireReviewBundle: boolean;
372
+ requireEvaluatorReview: boolean;
373
+ requireBestOfHistory: boolean;
374
+ requireBreakthrough: boolean;
375
+ requireIndependentReviewerGate: boolean;
376
+ requirePerfect100Completion: boolean;
333
377
  requireRuntimeGate: boolean;
334
378
  requireUiFidelity: boolean;
335
379
  requireRenderBundle: boolean;
336
380
  requireBrowserQaBundle: boolean;
337
381
  requireIterations: boolean;
382
+ /** Cycle budget; the only mode-dependent value (spec-0017 REQ-0001). */
383
+ maxCycles: number;
384
+ /**
385
+ * Alias for {@link maxCycles} kept for callers still using the spec-0012
386
+ * "iterations" vocabulary. Same numeric value.
387
+ */
338
388
  maxIterations: number;
339
389
  validCombination: boolean;
340
390
  invalidReason?: string;
@@ -348,6 +398,13 @@ declare function isValidPrototypingMode(value: unknown): value is PrototypingMod
348
398
  declare function isValidPrototypingSurface(value: unknown): value is PrototypingSurface;
349
399
  declare function isSupportedPrototypingSurface(surface: string): surface is PrototypingSurface;
350
400
  declare function resolvePrototypingMode(requested?: PrototypingMode): ModeResolutionResult;
401
+ /**
402
+ * Derive prototyping obligations for a (surface, mode) pair.
403
+ *
404
+ * Per spec-0017 REQ-0001 the return value is identical across modes except
405
+ * for {@link PrototypingObligations.maxCycles}. Callers MUST NOT branch
406
+ * on mode when deciding which obligation to enforce.
407
+ */
351
408
  declare function derivePrototypingObligations(input: {
352
409
  surface: PrototypingSurface;
353
410
  effectiveMode: PrototypingMode;
@@ -544,9 +601,25 @@ type ReportFullHarnessExecution = {
544
601
  browserQaPhasesSkipped: number;
545
602
  browserQaTotalFindings: number;
546
603
  };
604
+ type ReportRoundLifecycle = {
605
+ schemaVersion: "2.0";
606
+ rounds: number;
607
+ roundIds: string[];
608
+ candidatesObserved: number;
609
+ perfectRounds: number;
610
+ harvestArtifacts: number;
611
+ narrowDecisions: number;
612
+ absorptionPlans: number;
613
+ reimplementations: number;
614
+ polishCycles: number;
615
+ completedPolishCycles: number;
616
+ perfectPolishCycles: number;
617
+ polishKinds: Record<string, number>;
618
+ };
547
619
  type ReportPrototypingSummary = {
548
620
  surfaceClassification?: ReportSurfaceClassification;
549
621
  fullHarnessExecution?: ReportFullHarnessExecution;
622
+ roundLifecycle?: ReportRoundLifecycle;
550
623
  mode: {
551
624
  requested?: string;
552
625
  effective: string;
@@ -662,7 +735,7 @@ declare function formatReportMarkdown(data: ReportData, options?: ReportMarkdown
662
735
  declare function formatReportJson(data: ReportData): string;
663
736
 
664
737
  type ValidationOptions = {
665
- phase?: ValidationPhase;
738
+ profile?: ValidationProfile;
666
739
  platform?: string;
667
740
  };
668
741
  declare function validateProject(root: string, configResult?: ConfigLoadResult, options?: ValidationOptions): Promise<ValidationResult>;
@@ -682,7 +755,9 @@ declare function validateOrphanProhibition(root: string, config: QfaiConfig): Pr
682
755
 
683
756
  declare function validateSpecSplitByCapability(root: string, config: QfaiConfig): Promise<Issue[]>;
684
757
 
685
- declare function validateTraceability(root: string, config: QfaiConfig, phase: ValidationPhase): Promise<Issue[]>;
758
+ declare function validateTraceability(root: string, config: QfaiConfig, options: {
759
+ includeCodeReferences: boolean;
760
+ }): Promise<Issue[]>;
686
761
 
687
762
  type SurfaceType = CanonicalPrototypingSurface | "non-ui";
688
763
  declare const DISCUSSION_UI_BEARING_SURFACES: Set<SurfaceType>;
@@ -843,10 +918,13 @@ type FullHarnessHandoff = {
843
918
  };
844
919
 
845
920
  /**
846
- * Full-harness mode types.
921
+ * Legacy full-harness mode types (spec-0012).
847
922
  *
848
- * Full-harness now follows the reviewerScores/allItemsPass95 evidence schema
849
- * used by prototyping.json. Legacy weighted totals are intentionally excluded.
923
+ * NOTE: superseded by the cycle-centric `PrototypingCycleEvidence` /
924
+ * `PrototypingEvidenceRecord` schema in
925
+ * `packages/qfai/src/core/prototyping/types.ts` (spec-0017 REQ-0005).
926
+ * New code should consume the prototyping schema. Legacy callers remain
927
+ * supported for back-compat with spec-0012 callers.
850
928
  */
851
929
  type FullHarnessAxisScore = {
852
930
  axisId: string;
@@ -877,7 +955,7 @@ type FullHarnessIteration = {
877
955
  limitations: string[];
878
956
  evidenceRefs: FullHarnessEvidenceRefs;
879
957
  reviewerScores: FullHarnessReviewerScore[];
880
- allItemsPass95: boolean;
958
+ allReviewerAxesPerfect100: boolean;
881
959
  stopReason?: string;
882
960
  };
883
961
  type TerminationReason = "converged" | "max-iterations" | "plateau" | "manual-stop";
@@ -890,7 +968,7 @@ type FullHarnessScoreSnapshot = {
890
968
  axisCount: number;
891
969
  minScore: number | null;
892
970
  averageScore: number | null;
893
- allItemsPass95: boolean;
971
+ allReviewerAxesPerfect100: boolean;
894
972
  commitSha: string;
895
973
  };
896
974
  type FullHarnessHistory = {
@@ -918,7 +996,7 @@ type MeasurementInput = {
918
996
  discussionDirRelative?: string;
919
997
  trendRefs: string[];
920
998
  reviewerScores: FullHarnessReviewerScore[];
921
- allItemsPass95: boolean;
999
+ allReviewerAxesPerfect100: boolean;
922
1000
  stopReason?: string;
923
1001
  };
924
1002
  type MeasurementResult = {
@@ -1065,7 +1143,7 @@ declare function writeEvidenceBundles(input: {
1065
1143
  *
1066
1144
  * Reads previous iterations from prototyping.json,
1067
1145
  * appends new iteration, and recomputes bestIteration/scoringTrace from
1068
- * reviewerScores/allItemsPass95 evidence.
1146
+ * reviewerScores/allReviewerAxesPerfect100 evidence.
1069
1147
  */
1070
1148
 
1071
1149
  declare function loadHistory(root: string): Promise<FullHarnessHistory | null>;
@@ -1097,10 +1175,4 @@ declare function validateReviewer(reviewer: string | undefined): string;
1097
1175
  */
1098
1176
  declare function resolveCommitSha(root: string): Promise<string>;
1099
1177
 
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 };
1178
+ 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 };