qfai 2.1.2 → 2.2.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 (102) hide show
  1. package/assets/defaults/agent-routing/qfai-implement.yml +9 -0
  2. package/assets/defaults/agent-routing/qfai-triage.yml +9 -0
  3. package/assets/defaults/workflows/answer-in-session.yml +8 -0
  4. package/assets/defaults/workflows/quarantine-flaky.yml +3 -0
  5. package/assets/defaults/workflows/repair-consistency.yml +1 -0
  6. package/assets/defaults/workflows/run-operation.yml +11 -0
  7. package/assets/defaults/workflows/write-procedure.yml +18 -0
  8. package/assets/graph/codegraph-native.mjs +174 -0
  9. package/assets/graph/graphify-native.py +72 -0
  10. package/assets/init/.claude/settings.json +2 -20
  11. package/assets/init/.codex/hooks.json +0 -12
  12. package/assets/init/.qfai/assistant/rule/constitution.md +31 -15
  13. package/assets/init/.qfai/assistant/rule/drift-protocol.md +62 -1
  14. package/assets/init/.qfai/assistant/rule/references/codex-delegation.md +27 -0
  15. package/assets/init/.qfai/assistant/rule/references/griller-recommendations.md +21 -9
  16. package/assets/init/.qfai/assistant/rule/review-convergence.md +25 -12
  17. package/assets/init/.qfai/assistant/rule/shared-skill-delegation-baseline.md +1 -0
  18. package/assets/init/.qfai/assistant/rule/shared-skill-operating-baseline.md +8 -3
  19. package/assets/init/.qfai/assistant/rule/workflow.md +2 -1
  20. package/assets/init/.qfai/assistant/skill/qfai-discussion/SKILL.md +6 -0
  21. package/assets/init/.qfai/assistant/skill/qfai-discussion/references/discussion-completion-matrix.md +18 -9
  22. package/assets/init/.qfai/assistant/skill/qfai-grilling/SKILL.md +30 -20
  23. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/delegated-session.md +4 -3
  24. package/assets/init/.qfai/assistant/skill/qfai-grilling/references/session-record.md +8 -2
  25. package/assets/init/.qfai/assistant/skill/qfai-implement/SKILL.md +7 -0
  26. package/assets/init/.qfai/assistant/skill/qfai-implement/references/ui-affecting.md +2 -2
  27. package/assets/init/.qfai/assistant/skill/qfai-run/SKILL.md +41 -39
  28. package/assets/init/.qfai/assistant/skill/qfai-run/references/codex-cloud-install.md +80 -0
  29. package/assets/init/.qfai/assistant/skill/qfai-run/references/extraction.md +36 -25
  30. package/assets/init/.qfai/assistant/skill/qfai-run/references/operator-screens.md +9 -1
  31. package/assets/init/.qfai/assistant/skill/qfai-run/references/plan.md +2 -0
  32. package/assets/init/.qfai/assistant/skill/qfai-run/references/reached-step-observations.md +132 -0
  33. package/assets/init/.qfai/assistant/skill/qfai-run/scripts/codex-cloud-install.mjs +117 -0
  34. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/design-md-authoring.md +20 -7
  35. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-phase-checklists.md +1 -1
  36. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-pre-draft-grilling.md +4 -1
  37. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-quality-gate.md +1 -1
  38. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/sdd-triage.md +29 -2
  39. package/assets/init/.qfai/assistant/skill/qfai-sdd/references/ui-contract-guide.md +36 -4
  40. package/assets/init/.qfai/assistant/skill/qfai-sdd/templates/spec/decisions.md +9 -0
  41. package/assets/init/.qfai/assistant/skill/qfai-triage/SKILL.md +10 -7
  42. package/assets/init/.qfai/assistant/skill/qfai-verify/references/verify-output-contract.md +7 -7
  43. package/assets/init/.qfai/assistant/step/common-design-md/STEP.md +33 -16
  44. package/assets/init/.qfai/assistant/step/common-gate-run/STEP.md +26 -0
  45. package/assets/init/.qfai/assistant/step/common-grilling-record/STEP.md +10 -2
  46. package/assets/init/.qfai/assistant/step/common-policy-check/STEP.md +1 -0
  47. package/assets/init/.qfai/assistant/step/common-review-cycle/STEP.md +23 -7
  48. package/assets/init/.qfai/assistant/step/discussion-interview/STEP.md +15 -8
  49. package/assets/init/.qfai/assistant/step/discussion-oq/STEP.md +5 -1
  50. package/assets/init/.qfai/assistant/step/discussion-pack/STEP.md +5 -1
  51. package/assets/init/.qfai/assistant/step/discussion-uiux/STEP.md +5 -1
  52. package/assets/init/.qfai/assistant/step/implement-dep-bump/STEP.md +8 -2
  53. package/assets/init/.qfai/assistant/step/implement-procedure/STEP.md +69 -0
  54. package/assets/init/.qfai/assistant/step/implement-quarantine/STEP.md +21 -4
  55. package/assets/init/.qfai/assistant/step/implement-regression-fix/STEP.md +3 -3
  56. package/assets/init/.qfai/assistant/step/implement-stress-harness/STEP.md +33 -2
  57. package/assets/init/.qfai/assistant/step/prototyping-preflight/STEP.md +8 -0
  58. package/assets/init/.qfai/assistant/step/sdd-triage/STEP.md +4 -2
  59. package/assets/init/.qfai/assistant/step/triage-answer/STEP.md +2 -2
  60. package/assets/init/.qfai/assistant/step/triage-operate/STEP.md +50 -0
  61. package/assets/init/.qfai/assistant/step/verify-qfai-gate/STEP.md +8 -1
  62. package/assets/init/.qfai/assistant/step/verify-repeat-run/STEP.md +40 -0
  63. package/assets/init/.qfai/assistant/step/verify-repo-gate/STEP.md +12 -0
  64. package/assets/init/root/.agents/rules/document-schema.md +17 -0
  65. package/assets/init/root/.agents/rules/documentation-clarity.md +1 -1
  66. package/assets/init/root/.agents/rules/graph-exploration.md +150 -0
  67. package/assets/init/root/.agents/rules/grilling.md +100 -43
  68. package/assets/init/root/.agents/rules/reminders.json +14 -18
  69. package/assets/init/root/.agents/rules/session-feedback.md +6 -11
  70. package/assets/init/root/.agents/rules/untrusted-content.md +2 -2
  71. package/assets/init/root/.agents/rules/user-questions.md +3 -3
  72. package/assets/init/root/.github/workflows/qfai-docs.yml +2 -2
  73. package/assets/init/root/.github/workflows/qfai-tests.yml +88 -35
  74. package/assets/init/root/.github/workflows/qfai-validate.yml +2 -2
  75. package/assets/init/root/AGENTS.md +1 -0
  76. package/assets/schemas/workflow/extraction.schema.json +6 -2
  77. package/assets/scripts/check-mdschema.mjs +77 -8
  78. package/dist/cli/index.cjs +2616 -1130
  79. package/dist/cli/index.cjs.map +1 -1
  80. package/dist/cli/index.mjs +2617 -1121
  81. package/dist/cli/index.mjs.map +1 -1
  82. package/dist/graph/cli.cjs +1568 -0
  83. package/dist/graph/cli.cjs.map +1 -0
  84. package/dist/graph/cli.d.cts +9 -0
  85. package/dist/graph/cli.d.ts +9 -0
  86. package/dist/graph/cli.mjs +1541 -0
  87. package/dist/graph/cli.mjs.map +1 -0
  88. package/dist/graph/hook.cjs +817 -0
  89. package/dist/graph/hook.cjs.map +1 -0
  90. package/dist/graph/hook.d.cts +9 -0
  91. package/dist/graph/hook.d.ts +9 -0
  92. package/dist/graph/hook.mjs +792 -0
  93. package/dist/graph/hook.mjs.map +1 -0
  94. package/dist/index.cjs +2734 -818
  95. package/dist/index.cjs.map +1 -1
  96. package/dist/index.d.cts +129 -1
  97. package/dist/index.d.ts +129 -1
  98. package/dist/index.mjs +2707 -789
  99. package/dist/index.mjs.map +1 -1
  100. package/dist/process-C21nTvkT.d.cts +12 -0
  101. package/dist/process-C21nTvkT.d.ts +12 -0
  102. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ import { G as GraphProcess } from './process-C21nTvkT.cjs';
2
+
1
3
  type IssueSeverity = "info" | "warning" | "error";
2
4
  type IssueCategory = "canonical" | "change";
3
5
  type IssueLocation = {
@@ -93,6 +95,16 @@ type ValidationTimings = {
93
95
  uiuxBudgetMs: number;
94
96
  htmlMockMs: number;
95
97
  htmlMockBudgetMs: number;
98
+ /**
99
+ * What each validator of the UI/UX group took, slowest first. The validators run side by side
100
+ * on one event loop, so each time includes waiting for the others: the parts overlap, do not
101
+ * add up to `uiuxMs`, and can credit a fast validator with another's time. They say where to
102
+ * look, not how the time divides.
103
+ */
104
+ uiuxParts: readonly {
105
+ name: string;
106
+ ms: number;
107
+ }[];
96
108
  };
97
109
  type ValidationResult = {
98
110
  toolVersion: string;
@@ -605,6 +617,17 @@ type ValidationOptions = {
605
617
  flowIds?: readonly string[];
606
618
  };
607
619
  declare function validateProject(root: string, configResult?: ConfigLoadResult, options?: ValidationOptions): Promise<ValidationResult>;
620
+ /**
621
+ * The parts of the UI/UX group, slowest first. The html-mock part leaves out the one-off load of
622
+ * its parser, as the group's own time does.
623
+ */
624
+ declare function orderUiuxParts(parts: readonly {
625
+ name: string;
626
+ ms: number;
627
+ }[], htmlMockLoadMs: number): {
628
+ name: string;
629
+ ms: number;
630
+ }[];
608
631
  /**
609
632
  * Count findings by severity, skipping suppressed ones. `counts` is the SSOT
610
633
  * every gate reads, so anything that rebuilds a `ValidationResult` from an
@@ -716,6 +739,44 @@ declare function classifyAgainstDeclaration(declaringDir: string, packageDir: st
716
739
  * statement but still a statement.
717
740
  */
718
741
  declare function findDeclaringDir(root: string): Promise<string | null>;
742
+ /**
743
+ * The range the nearest `package.json` declaring qfai gives it, or `null` when
744
+ * no manifest at or above `root` declares it with a text range.
745
+ *
746
+ * Read from the manifest {@link findDeclaringDir} stops at, so the range and the
747
+ * directory it is compared against are one declaration.
748
+ */
749
+ declare function readDeclaredQfaiRange(root: string): Promise<string | null>;
750
+ /**
751
+ * The lowest version a dependency range admits, as `x.y.z`, or `null` when the
752
+ * range does not state one this reads.
753
+ *
754
+ * Only the forms a project writes for a pinned dependency are read: an exact
755
+ * version, and a caret, tilde or `>=` range, each optionally followed by more
756
+ * comparators (`>=2.1.1 <3`). A tag (`latest`), a wildcard (`2.x`), an
757
+ * alternative (`||`), a protocol (`workspace:`, `file:`, `github:`) and a
758
+ * partial version (`^2.1`) answer `null`, so nothing is compared against them.
759
+ */
760
+ declare function lowestVersionOfRange(range: string): string | null;
761
+ /** Whether `version` is strictly older than `other`; `false` where either is unreadable. */
762
+ declare function isOlderVersion(version: string, other: string): boolean;
763
+ /** An installed qfai that is older than the version the project declares. */
764
+ type InstalledOlderThanDeclared = {
765
+ readonly installed: string;
766
+ readonly declaredRange: string;
767
+ readonly declaredLowest: string;
768
+ };
769
+ /**
770
+ * Whether the running qfai is older than the lowest version this project's
771
+ * dependency declaration admits.
772
+ *
773
+ * The declaration is the only record of "the qfai this tree was written for"
774
+ * that a project keeps: the files `qfai init` writes carry no version. An
775
+ * installed copy below that floor is the state a lockfile that moved after the
776
+ * last install leaves, and every rule whose input is a generated file can then
777
+ * disagree with the tree for a reason that is not in the tree.
778
+ */
779
+ declare function compareInstalledToDeclared(installed: string, declaredRange: string | null): InstalledOlderThanDeclared | null;
719
780
  /**
720
781
  * Whether `packageDir` is an installed copy resolved from outside `root`.
721
782
  *
@@ -911,7 +972,74 @@ declare const DESIGN_MD_SAMPLE_MARKER = "QFAI-SAMPLE-DESIGN-MD";
911
972
  */
912
973
  declare function isUnreplacedDesignMdSample(text: unknown): boolean;
913
974
 
975
+ interface GraphPreparation {
976
+ runtime: "installed" | "not-ready";
977
+ tools?: {
978
+ codegraph: "installed" | "not-ready";
979
+ graphify: "installed" | "not-ready";
980
+ };
981
+ code: "code-ready" | "code-not-ready";
982
+ documents: "documents-not-ready";
983
+ failedStep?: string;
984
+ recovery?: string;
985
+ previousInstallation?: "retained" | "none";
986
+ }
987
+
988
+ type GraphHookHost = "claude" | "codex" | "copilot" | "vscode";
989
+
990
+ interface GraphHostFacts {
991
+ host: GraphHookHost;
992
+ version?: string;
993
+ configuration: "configured" | "not-configured" | "failed";
994
+ denialEvent?: string;
995
+ failureProtocol?: "supported" | "unsupported" | "unverified";
996
+ trust: "required" | "granted" | "not-required" | "unknown";
997
+ }
998
+ interface GraphHostProtection {
999
+ host: GraphHookHost;
1000
+ version?: string;
1001
+ state: "configured" | "trust-required" | "runtime-verified" | "unsupported" | "failed";
1002
+ events: readonly string[];
1003
+ recovery: string;
1004
+ configuration?: GraphHostFacts["configuration"];
1005
+ trust?: GraphHostFacts["trust"];
1006
+ }
1007
+
1008
+ interface GraphSettingsComposition {
1009
+ files: string[];
1010
+ conflicts: string[];
1011
+ }
1012
+
1013
+ type GraphIntegrationPreparation = GraphPreparation & GraphSettingsComposition & {
1014
+ hosts: GraphHostProtection[];
1015
+ };
1016
+ declare function prepareGraphIntegration(root: string, run?: GraphProcess): Promise<GraphIntegrationPreparation>;
1017
+
1018
+ declare function renderGraphPreparation(preparation: GraphPreparation, hosts?: readonly GraphHostProtection[]): string;
1019
+
1020
+ interface GraphReuseEnvironment {
1021
+ platform: string;
1022
+ architecture: string;
1023
+ machine: string;
1024
+ }
1025
+
1026
+ interface DocumentPreparation {
1027
+ status: "prepared" | "not-ready" | "failed";
1028
+ source?: "current" | "restored" | "generated";
1029
+ reuse?: "published" | "unavailable";
1030
+ recovery?: string;
1031
+ }
1032
+ interface ExternalProcessingRequest {
1033
+ readonly destination: string;
1034
+ readonly scope: readonly string[];
1035
+ readonly backend: string;
1036
+ readonly model: string;
1037
+ readonly worktree: string;
1038
+ }
1039
+ type ApproveExternalProcessing = (request: ExternalProcessingRequest) => Promise<boolean>;
1040
+ declare function prepareDocumentAnalysis(root: string, run?: GraphProcess, approveExternal?: ApproveExternalProcessing, environment?: GraphReuseEnvironment): Promise<DocumentPreparation>;
1041
+
914
1042
  /** Run one ordered spec-to-story migration step from the current project root. */
915
1043
  declare function runMigrationStep(step: number, argv: string[]): Promise<number>;
916
1044
 
917
- export { AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DESIGN_MD_SAMPLE_MARKER, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, FONT_KEYS, type FailOn, type FenceMaskOptions, type FontKey, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, 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 QfaiReviewProfile, type QfaiRoutingEntry, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, VISUAL_BROWSER_SURFACES, type ValidationCounts, 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, 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, isUnreplacedDesignMdSample, lintSql, loadConfig, locateToolAgainstProject, maskFencedCodeBlocks, packageRootProbe, parseDesignMd, reachedThroughLinkedNodeModules, readRejectedPrimaryUiContract, readSkippedWorkflows, readTestFileExtensions, readWorkflowMode, requiresVisualBrowserEvidence, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, routingEntryName, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };
1045
+ export { AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type ApproveExternalProcessing, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DESIGN_MD_SAMPLE_MARKER, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, 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 QfaiReviewProfile, type QfaiRoutingEntry, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, VISUAL_BROWSER_SURFACES, type ValidationCounts, 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, lintSql, loadConfig, locateToolAgainstProject, lowestVersionOfRange, maskFencedCodeBlocks, orderUiuxParts, packageRootProbe, parseDesignMd, prepareDocumentAnalysis, prepareGraphIntegration, reachedThroughLinkedNodeModules, readDeclaredQfaiRange, readRejectedPrimaryUiContract, readSkippedWorkflows, readTestFileExtensions, readWorkflowMode, renderGraphPreparation, requiresVisualBrowserEvidence, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, routingEntryName, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { G as GraphProcess } from './process-C21nTvkT.js';
2
+
1
3
  type IssueSeverity = "info" | "warning" | "error";
2
4
  type IssueCategory = "canonical" | "change";
3
5
  type IssueLocation = {
@@ -93,6 +95,16 @@ type ValidationTimings = {
93
95
  uiuxBudgetMs: number;
94
96
  htmlMockMs: number;
95
97
  htmlMockBudgetMs: number;
98
+ /**
99
+ * What each validator of the UI/UX group took, slowest first. The validators run side by side
100
+ * on one event loop, so each time includes waiting for the others: the parts overlap, do not
101
+ * add up to `uiuxMs`, and can credit a fast validator with another's time. They say where to
102
+ * look, not how the time divides.
103
+ */
104
+ uiuxParts: readonly {
105
+ name: string;
106
+ ms: number;
107
+ }[];
96
108
  };
97
109
  type ValidationResult = {
98
110
  toolVersion: string;
@@ -605,6 +617,17 @@ type ValidationOptions = {
605
617
  flowIds?: readonly string[];
606
618
  };
607
619
  declare function validateProject(root: string, configResult?: ConfigLoadResult, options?: ValidationOptions): Promise<ValidationResult>;
620
+ /**
621
+ * The parts of the UI/UX group, slowest first. The html-mock part leaves out the one-off load of
622
+ * its parser, as the group's own time does.
623
+ */
624
+ declare function orderUiuxParts(parts: readonly {
625
+ name: string;
626
+ ms: number;
627
+ }[], htmlMockLoadMs: number): {
628
+ name: string;
629
+ ms: number;
630
+ }[];
608
631
  /**
609
632
  * Count findings by severity, skipping suppressed ones. `counts` is the SSOT
610
633
  * every gate reads, so anything that rebuilds a `ValidationResult` from an
@@ -716,6 +739,44 @@ declare function classifyAgainstDeclaration(declaringDir: string, packageDir: st
716
739
  * statement but still a statement.
717
740
  */
718
741
  declare function findDeclaringDir(root: string): Promise<string | null>;
742
+ /**
743
+ * The range the nearest `package.json` declaring qfai gives it, or `null` when
744
+ * no manifest at or above `root` declares it with a text range.
745
+ *
746
+ * Read from the manifest {@link findDeclaringDir} stops at, so the range and the
747
+ * directory it is compared against are one declaration.
748
+ */
749
+ declare function readDeclaredQfaiRange(root: string): Promise<string | null>;
750
+ /**
751
+ * The lowest version a dependency range admits, as `x.y.z`, or `null` when the
752
+ * range does not state one this reads.
753
+ *
754
+ * Only the forms a project writes for a pinned dependency are read: an exact
755
+ * version, and a caret, tilde or `>=` range, each optionally followed by more
756
+ * comparators (`>=2.1.1 <3`). A tag (`latest`), a wildcard (`2.x`), an
757
+ * alternative (`||`), a protocol (`workspace:`, `file:`, `github:`) and a
758
+ * partial version (`^2.1`) answer `null`, so nothing is compared against them.
759
+ */
760
+ declare function lowestVersionOfRange(range: string): string | null;
761
+ /** Whether `version` is strictly older than `other`; `false` where either is unreadable. */
762
+ declare function isOlderVersion(version: string, other: string): boolean;
763
+ /** An installed qfai that is older than the version the project declares. */
764
+ type InstalledOlderThanDeclared = {
765
+ readonly installed: string;
766
+ readonly declaredRange: string;
767
+ readonly declaredLowest: string;
768
+ };
769
+ /**
770
+ * Whether the running qfai is older than the lowest version this project's
771
+ * dependency declaration admits.
772
+ *
773
+ * The declaration is the only record of "the qfai this tree was written for"
774
+ * that a project keeps: the files `qfai init` writes carry no version. An
775
+ * installed copy below that floor is the state a lockfile that moved after the
776
+ * last install leaves, and every rule whose input is a generated file can then
777
+ * disagree with the tree for a reason that is not in the tree.
778
+ */
779
+ declare function compareInstalledToDeclared(installed: string, declaredRange: string | null): InstalledOlderThanDeclared | null;
719
780
  /**
720
781
  * Whether `packageDir` is an installed copy resolved from outside `root`.
721
782
  *
@@ -911,7 +972,74 @@ declare const DESIGN_MD_SAMPLE_MARKER = "QFAI-SAMPLE-DESIGN-MD";
911
972
  */
912
973
  declare function isUnreplacedDesignMdSample(text: unknown): boolean;
913
974
 
975
+ interface GraphPreparation {
976
+ runtime: "installed" | "not-ready";
977
+ tools?: {
978
+ codegraph: "installed" | "not-ready";
979
+ graphify: "installed" | "not-ready";
980
+ };
981
+ code: "code-ready" | "code-not-ready";
982
+ documents: "documents-not-ready";
983
+ failedStep?: string;
984
+ recovery?: string;
985
+ previousInstallation?: "retained" | "none";
986
+ }
987
+
988
+ type GraphHookHost = "claude" | "codex" | "copilot" | "vscode";
989
+
990
+ interface GraphHostFacts {
991
+ host: GraphHookHost;
992
+ version?: string;
993
+ configuration: "configured" | "not-configured" | "failed";
994
+ denialEvent?: string;
995
+ failureProtocol?: "supported" | "unsupported" | "unverified";
996
+ trust: "required" | "granted" | "not-required" | "unknown";
997
+ }
998
+ interface GraphHostProtection {
999
+ host: GraphHookHost;
1000
+ version?: string;
1001
+ state: "configured" | "trust-required" | "runtime-verified" | "unsupported" | "failed";
1002
+ events: readonly string[];
1003
+ recovery: string;
1004
+ configuration?: GraphHostFacts["configuration"];
1005
+ trust?: GraphHostFacts["trust"];
1006
+ }
1007
+
1008
+ interface GraphSettingsComposition {
1009
+ files: string[];
1010
+ conflicts: string[];
1011
+ }
1012
+
1013
+ type GraphIntegrationPreparation = GraphPreparation & GraphSettingsComposition & {
1014
+ hosts: GraphHostProtection[];
1015
+ };
1016
+ declare function prepareGraphIntegration(root: string, run?: GraphProcess): Promise<GraphIntegrationPreparation>;
1017
+
1018
+ declare function renderGraphPreparation(preparation: GraphPreparation, hosts?: readonly GraphHostProtection[]): string;
1019
+
1020
+ interface GraphReuseEnvironment {
1021
+ platform: string;
1022
+ architecture: string;
1023
+ machine: string;
1024
+ }
1025
+
1026
+ interface DocumentPreparation {
1027
+ status: "prepared" | "not-ready" | "failed";
1028
+ source?: "current" | "restored" | "generated";
1029
+ reuse?: "published" | "unavailable";
1030
+ recovery?: string;
1031
+ }
1032
+ interface ExternalProcessingRequest {
1033
+ readonly destination: string;
1034
+ readonly scope: readonly string[];
1035
+ readonly backend: string;
1036
+ readonly model: string;
1037
+ readonly worktree: string;
1038
+ }
1039
+ type ApproveExternalProcessing = (request: ExternalProcessingRequest) => Promise<boolean>;
1040
+ declare function prepareDocumentAnalysis(root: string, run?: GraphProcess, approveExternal?: ApproveExternalProcessing, environment?: GraphReuseEnvironment): Promise<DocumentPreparation>;
1041
+
914
1042
  /** Run one ordered spec-to-story migration step from the current project root. */
915
1043
  declare function runMigrationStep(step: number, argv: string[]): Promise<number>;
916
1044
 
917
- export { AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DESIGN_MD_SAMPLE_MARKER, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, FONT_KEYS, type FailOn, type FenceMaskOptions, type FontKey, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, 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 QfaiReviewProfile, type QfaiRoutingEntry, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, VISUAL_BROWSER_SURFACES, type ValidationCounts, 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, 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, isUnreplacedDesignMdSample, lintSql, loadConfig, locateToolAgainstProject, maskFencedCodeBlocks, packageRootProbe, parseDesignMd, reachedThroughLinkedNodeModules, readRejectedPrimaryUiContract, readSkippedWorkflows, readTestFileExtensions, readWorkflowMode, requiresVisualBrowserEvidence, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, routingEntryName, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };
1045
+ export { AC_GHERKIN_SECTION, ARCHETYPES, ATDD_TEST_KIND_DIRS, type ApproveExternalProcessing, type Archetype, type AtddTestKind, COLOR_KEYS, type ColorKey, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, DESIGN_MD_SAMPLE_MARKER, DISCUSSION_NON_UI_SURFACES, DISCUSSION_UI_BEARING_SURFACES, type DesignMd, type DesignMdColors, type DesignMdFonts, type DesignMdRadius, type DesignMdShadow, 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 QfaiReviewProfile, type QfaiRoutingEntry, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiValidationConfig, RADIUS_KEYS, type RadiusKey, type ReportData, type RunSddPreflightOptions, SHADOW_KEYS, SKIPPED_WORKFLOWS_MESSAGE, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type ShadowKey, type TestFileExtensions, type TestLayerRoots, VISUAL_BROWSER_SURFACES, type ValidationCounts, 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, lintSql, loadConfig, locateToolAgainstProject, lowestVersionOfRange, maskFencedCodeBlocks, orderUiuxParts, packageRootProbe, parseDesignMd, prepareDocumentAnalysis, prepareGraphIntegration, reachedThroughLinkedNodeModules, readDeclaredQfaiRange, readRejectedPrimaryUiContract, readSkippedWorkflows, readTestFileExtensions, readWorkflowMode, renderGraphPreparation, requiresVisualBrowserEvidence, resolvePath, resolveTestKind, resolveToolPackageDir, resolveToolVersion, resolvesThroughOwnNodeModules, routingEntryName, runMigrationStep, runSddPreflight, validateContracts, validateDesignMd, validateProject, validateUiContractParse };