artifact-graph 0.4.1 → 0.6.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.
package/dist/index.d.cts CHANGED
@@ -165,6 +165,8 @@ interface ImplementationPacket {
165
165
  missingDetails?: MissingDetail[];
166
166
  implementationBlueprintDraft: ImplementationBlueprintDraft;
167
167
  validationCommands: string[];
168
+ /** Explicit universal baseline policy: true=enabled, false=disabled. Absent=legacy (pre-0.5) packet. */
169
+ baselinePolicy?: boolean;
168
170
  }
169
171
  /**
170
172
  * Assemble an implementation packet from a context manifest.
@@ -190,6 +192,10 @@ declare function renderPacketMarkdown(packet: ImplementationPacket): string;
190
192
  *
191
193
  * v1.12: accepts optional schema to derive valid target types dynamically.
192
194
  * Without schema, falls back to the static VALID_PACKET_TARGET_TYPES list.
195
+ *
196
+ * v0.5: PKT-004 no longer infers opt-out from missingDetails or total=0.
197
+ * baselinePolicy=true|absent → must match ALWAYS_PRESENT_ITEMS exactly.
198
+ * baselinePolicy=false → must be total=0, items=[].
193
199
  */
194
200
 
195
201
  /** Valid target types for packets (legacy static fallback) */
@@ -302,6 +308,8 @@ interface AuditOptions {
302
308
  format?: 'json' | 'markdown';
303
309
  mode?: ContextMode;
304
310
  maxPerCategory?: number;
311
+ /** When true (default), check universal baseline files. When false, skip. */
312
+ universalBaseline?: boolean;
305
313
  /** Absolute path to the targets file (--targets-file mode only) */
306
314
  sourceTargetsPath?: string;
307
315
  /** If true, do not write individual packet files — only summary */
@@ -349,10 +357,14 @@ interface DiscoverAuditOptions {
349
357
  summaryDetail?: 'full' | 'compact';
350
358
  /** Artifact schema for dynamic target type validation */
351
359
  schema?: ArtifactSchema;
360
+ /** When true (default), check universal baseline files. When false, skip. */
361
+ universalBaseline?: boolean;
352
362
  }
353
363
  /**
354
364
  * Scan artifacts, discover targets, then audit packets for each.
355
365
  * Single scan is reused for both discovery and audit.
366
+ *
367
+ * When options.universalBaseline is undefined, falls back to config.context?.universal_baseline.
356
368
  */
357
369
  declare function discoverAndAuditPackets(root: string, options: DiscoverAuditOptions): Promise<PacketAuditSummary>;
358
370
 
@@ -547,7 +559,7 @@ interface VersionLockRefreshResult {
547
559
  warnings: string[];
548
560
  }
549
561
  declare function buildVersionIndex(root: string, graph?: ArtifactGraph): Promise<VersionIndex>;
550
- declare function auditVersionLock(root: string, lockPath?: string, graph?: ArtifactGraph): Promise<VersionLockAuditResult>;
562
+ declare function auditVersionLock(root: string, lockPath?: string, graph?: ArtifactGraph, config?: ArtifactSchema): Promise<VersionLockAuditResult>;
551
563
  declare function updateVersionLock(root: string, options: VersionLockUpdateOptions): Promise<VersionLockFile>;
552
564
  declare function bootstrapVersionLock(root: string, options?: VersionLockBootstrapOptions): Promise<VersionLockFile>;
553
565
  declare function refreshVersionLock(root: string, options?: VersionLockRefreshOptions): Promise<VersionLockRefreshResult>;
@@ -654,7 +666,6 @@ declare function installManagedHookBlock(options: ManagedHookBlockOptions): Prom
654
666
 
655
667
  /**
656
668
  * Review Result Protocol validator.
657
- * @feature ACA16 @scenario S-46
658
669
  *
659
670
  * Validates a JSON object against the review-result.schema.json constraints.
660
671
  * Does NOT use ajv or any JSON-schema library — pure deterministic checks
@@ -715,6 +726,15 @@ interface Producer {
715
726
  name: string;
716
727
  skill?: string;
717
728
  }
729
+ interface AcceptanceSourceResult {
730
+ run_id: string;
731
+ stage_id?: string;
732
+ producer: Producer;
733
+ }
734
+ interface AcceptanceData {
735
+ reviewer: Producer;
736
+ source_result: AcceptanceSourceResult;
737
+ }
718
738
  interface BatchDefinition {
719
739
  id: string;
720
740
  files: string[];
@@ -767,6 +787,7 @@ interface ReviewResult {
767
787
  blocking_reason?: string | null;
768
788
  degradation?: string | null;
769
789
  producer?: Producer;
790
+ acceptance?: AcceptanceData;
770
791
  evidence?: Evidence[];
771
792
  review?: ReviewData;
772
793
  repair?: RepairData;
@@ -824,6 +845,26 @@ interface ArtifactEdgeRule {
824
845
  to: string;
825
846
  kind: string;
826
847
  }
848
+ /** E2E test runner configuration */
849
+ interface E2eRunnerConfig {
850
+ /** Runner name (e.g., 'playwright', 'vitest', 'jest') */
851
+ name: string;
852
+ /** Test kind accepted by this runner: 'unit', 'integration', or 'e2e' */
853
+ kind?: 'unit' | 'integration' | 'e2e';
854
+ /** Root directory for test discovery (relative to project root) */
855
+ root: string;
856
+ /** Include glob patterns for test files */
857
+ include: string[];
858
+ /** Exclude glob patterns for test files */
859
+ exclude?: string[];
860
+ /** Test ignore patterns (files that should not be considered as tests) */
861
+ testIgnore?: string[];
862
+ }
863
+ /** Waiver entry with mandatory reason */
864
+ interface E2eWaiver {
865
+ id: string;
866
+ reason: string;
867
+ }
827
868
  interface ArtifactSchema {
828
869
  types: Record<string, ArtifactTypeSchema>;
829
870
  idPatterns: Record<string, string>;
@@ -836,6 +877,28 @@ interface ArtifactSchema {
836
877
  start: number;
837
878
  end: number;
838
879
  }>>;
880
+ /** Context resolution overrides */
881
+ context?: {
882
+ /** When false, skip universal baseline injection. Default: true. */
883
+ universal_baseline?: boolean;
884
+ };
885
+ /** E2E coverage proof configuration */
886
+ e2e?: {
887
+ /** Minimum executable_ref coverage rate (0-1) for warning */
888
+ executable_ref_warning?: number;
889
+ /** Minimum executable_ref coverage rate (0-1) for error */
890
+ executable_ref_error?: number;
891
+ /** Whether to report uncovered scenarios. Default true. */
892
+ report_uncovered_scenarios?: boolean;
893
+ /** Whether to report uncovered features. Default true. */
894
+ report_uncovered_features?: boolean;
895
+ /** Scenario waivers (id + reason) from coverage requirements */
896
+ scenario_waivers?: E2eWaiver[];
897
+ /** Feature waivers (id + reason) from coverage requirements */
898
+ feature_waivers?: E2eWaiver[];
899
+ /** E2E test runner configurations */
900
+ runners?: E2eRunnerConfig[];
901
+ };
839
902
  }
840
903
  declare const TARGET_ARTIFACT_TYPES: readonly ["feature", "scenario", "decision", "design", "e2e_test"];
841
904
  type TargetArtifactType = typeof TARGET_ARTIFACT_TYPES[number];
@@ -862,6 +925,8 @@ interface ArtifactGraph {
862
925
  nodes: ArtifactNode[];
863
926
  edges: ArtifactEdge[];
864
927
  generatedAt: string;
928
+ /** Normalized absolute project root passed to scanArtifacts. Optional for backward compatibility. */
929
+ root?: string;
865
930
  /** Scan-time diagnostics. Optional for backward compatibility with consumers that build graph literals without this field. */
866
931
  diagnostics?: ValidationIssue[];
867
932
  }
@@ -881,7 +946,7 @@ interface ContextItem {
881
946
  interface MissingDetail {
882
947
  ref: string;
883
948
  from: string;
884
- kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets';
949
+ kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets' | 'missing-baseline';
885
950
  message: string;
886
951
  suggestedAction: string;
887
952
  }
@@ -899,6 +964,8 @@ interface ContextManifest {
899
964
  missing: string[];
900
965
  missingDetails?: MissingDetail[];
901
966
  omitted?: ContextItem[];
967
+ /** Explicit universal baseline policy: true=enabled, false=disabled. Used by validatePacket to prevent inferring opt-out from total=0. */
968
+ baselinePolicy?: boolean;
902
969
  }
903
970
  type ContextMode = 'full' | 'implementation';
904
971
  interface ContextOptions {
@@ -911,10 +978,18 @@ interface ContextOptions {
911
978
  target?: ArtifactTarget;
912
979
  mode?: ContextMode;
913
980
  maxPerCategory?: number;
981
+ /**
982
+ * When true (default), inject all ALWAYS_PRESENT_ITEMS as required baseline
983
+ * and report missing ones in manifest.missing. When false, skip baseline
984
+ * injection entirely for lightweight projects.
985
+ */
986
+ universalBaseline?: boolean;
987
+ /** Project root for baseline file existence checks. Required when universalBaseline is true. */
988
+ root?: string;
914
989
  }
915
990
  declare const DEFAULT_SCHEMA: ArtifactSchema;
916
991
  declare function loadConfig(root: string): Promise<ArtifactSchema>;
917
- declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[]): ArtifactGraph;
992
+ declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[], root?: string): ArtifactGraph;
918
993
  declare function scanArtifacts(root: string, schema?: ArtifactSchema): Promise<ArtifactGraph>;
919
994
  /**
920
995
  * Resolve traceability-matrix-v2 edges:
@@ -930,7 +1005,88 @@ declare function queryGraph(graph: ArtifactGraph, options: QueryOptions): Artifa
930
1005
  declare function renderMermaid(graph: ArtifactGraph): string;
931
1006
  declare function nextId(graph: ArtifactGraph, schema: ArtifactSchema, type: string, rangeName: string): string;
932
1007
  declare function writeGraphCache(root: string, graph: ArtifactGraph): Promise<void>;
933
- declare function validateExecutableTraceability(root: string): Promise<ValidationIssue[]>;
1008
+ declare function validateExecutableTraceability(root: string, config?: ArtifactSchema): Promise<ValidationIssue[]>;
1009
+ /** O2: E2E coverage statistics and blackhole diagnostics */
1010
+ interface E2eCoverageStats {
1011
+ totalTestCases: number;
1012
+ withExecutableRef: number;
1013
+ executableRefRate: string;
1014
+ /** TCs by status */
1015
+ statusBreakdown: Record<string, number>;
1016
+ /** TCs by chain_type */
1017
+ chainTypeBreakdown: Record<string, number>;
1018
+ /** Scenarios with zero E2E coverage */
1019
+ uncoveredScenarios: string[];
1020
+ /** Features with zero E2E coverage */
1021
+ uncoveredFeatures: string[];
1022
+ /** Configurable thresholds */
1023
+ thresholdWarnings: string[];
1024
+ thresholdErrors: string[];
1025
+ /** Derived ac_coverage_rate per feature */
1026
+ acCoverageRateByFeature: Record<string, {
1027
+ numerator: number;
1028
+ denominator: number;
1029
+ rate: number;
1030
+ }>;
1031
+ /** Multi-dimensional scenario coverage */
1032
+ scenarioCoverage: Record<string, {
1033
+ linked: boolean;
1034
+ acCovered: boolean;
1035
+ waived: boolean;
1036
+ verified: boolean;
1037
+ }>;
1038
+ /** Multi-dimensional feature coverage */
1039
+ featureCoverage: Record<string, {
1040
+ linked: boolean;
1041
+ acCovered: boolean;
1042
+ waived: boolean;
1043
+ verified: boolean;
1044
+ }>;
1045
+ }
1046
+ interface E2eCoverageThresholds {
1047
+ /** Minimum executable_ref coverage rate (0-1). Below this triggers warning. */
1048
+ executableRefWarning?: number;
1049
+ /** Minimum executable_ref coverage rate (0-1). Below this triggers error. */
1050
+ executableRefError?: number;
1051
+ /** Whether to report uncovered scenarios as warnings. Default true. */
1052
+ reportUncoveredScenarios?: boolean;
1053
+ /** Whether to report uncovered features as warnings. Default true. */
1054
+ reportUncoveredFeatures?: boolean;
1055
+ /** Explicit waivers: scenario IDs that are waived from coverage requirements */
1056
+ scenarioWaivers?: E2eWaiver[];
1057
+ /** Explicit waivers: feature IDs that are waived from coverage requirements */
1058
+ featureWaivers?: E2eWaiver[];
1059
+ }
1060
+ declare function computeE2eCoverageStats(graph: ArtifactGraph, root: string, thresholds?: E2eCoverageThresholds): Promise<E2eCoverageStats>;
1061
+ /** O4: Deterministic, idempotent E2E registry generation from Markdown sources */
1062
+ interface E2eRegistryBatch {
1063
+ batch_id: string;
1064
+ file: string;
1065
+ scope: string;
1066
+ ac_coverage: Record<string, string[]>;
1067
+ related_scenarios: string[];
1068
+ test_case_count: number;
1069
+ status_summary?: Record<string, number>;
1070
+ /** Batch-level status: 'blocked' when frontmatter fixes_block indicates blocking */
1071
+ status?: string;
1072
+ /** Blocking reasons from frontmatter fixes_block */
1073
+ blocking_reasons?: Record<string, string>;
1074
+ }
1075
+ interface E2eRegistry {
1076
+ registry_version: string;
1077
+ generated_at: string;
1078
+ total_batches: number;
1079
+ total_test_cases: number;
1080
+ batches: E2eRegistryBatch[];
1081
+ }
1082
+ /**
1083
+ * Generate E2E registry from Markdown test files.
1084
+ * Deterministic: same input always produces same output (except generated_at).
1085
+ * Use `--deterministic` to set generated_at to epoch for idempotent diff checks.
1086
+ */
1087
+ declare function generateE2eRegistry(root: string, opts?: {
1088
+ deterministic?: boolean;
1089
+ }): Promise<E2eRegistry>;
934
1090
  interface DiscoverOptions {
935
1091
  limit?: number;
936
1092
  schema?: ArtifactSchema;
@@ -949,4 +1105,4 @@ declare function discoverTargets(graph: ArtifactGraph, options?: DiscoverOptions
949
1105
  declare function resolveArtifactContext(graph: ArtifactGraph, opts: ContextOptions): ContextManifest;
950
1106
  declare function formatContextMarkdown(manifest: ContextManifest): string;
951
1107
 
952
- export { ALWAYS_PRESENT_ITEMS as ALWAYS_PRESENT, type ArtifactChainDoctorReport, type ArtifactEdge, type ArtifactEdgeRule, type ArtifactExtraFieldSchema, type ArtifactGraph, type ArtifactGraphCliCandidate, type ArtifactGraphCliResolution, type ArtifactGraphCliSource, type ArtifactNode, type ArtifactSchema, type ArtifactTarget, type ArtifactTypeMetadata, type ArtifactTypeRole, type ArtifactTypeSchema, BASELINE_CONSTRAINTS, BASELINE_CONSTRAINTS_COUNT, BASELINE_ITEMS_COUNT, type BatchDefinition, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DiscoverOptions, type Evidence, type EvidenceObject, type ExecutorType, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImplementationBlueprintDraft, type ImplementationPacket, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type PacketAuditEntry, type PacketAuditSummary, type PacketCategory, type PacketItem, type PacketOmittedItem, type PacketOptions, type PacketPromptError, type PacketPromptOptions, type PacketTarget, type PacketTargetType, type PacketValidationIssue, type PacketValidationResult, type PreparedManagedHookBlock, type Producer, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TraceVersionResult, VALID_PACKET_TARGET_TYPES, VERSION_INDEX_SCHEMA_VERSION, VERSION_LOCK_PATH, VERSION_LOCK_SCHEMA_VERSION, type ValidationError, type ValidationIssue, type VersionEdgeKind, type VersionIndex, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, applyPreparedManagedHookBlocks, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildGraph, buildVersionIndex, collectChangedPaths, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, formatContextMarkdown, getArtifactTypeMetadata, getTargetArtifactTypes, installManagedHookBlock, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, loadConfig, nextId, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderDoctorMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, scanArtifacts, traceVersion, updateVersionLock, validateExecutableTraceability, validateGraph, validatePacket, validatePacketMarkdown, validatePacketPrompt, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, writeGraphCache };
1108
+ export { ALWAYS_PRESENT_ITEMS as ALWAYS_PRESENT, type ArtifactChainDoctorReport, type ArtifactEdge, type ArtifactEdgeRule, type ArtifactExtraFieldSchema, type ArtifactGraph, type ArtifactGraphCliCandidate, type ArtifactGraphCliResolution, type ArtifactGraphCliSource, type ArtifactNode, type ArtifactSchema, type ArtifactTarget, type ArtifactTypeMetadata, type ArtifactTypeRole, type ArtifactTypeSchema, BASELINE_CONSTRAINTS, BASELINE_CONSTRAINTS_COUNT, BASELINE_ITEMS_COUNT, type BatchDefinition, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DiscoverOptions, type E2eCoverageStats, type E2eCoverageThresholds, type E2eRegistry, type E2eRegistryBatch, type E2eRunnerConfig, type E2eWaiver, type Evidence, type EvidenceObject, type ExecutorType, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImplementationBlueprintDraft, type ImplementationPacket, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type PacketAuditEntry, type PacketAuditSummary, type PacketCategory, type PacketItem, type PacketOmittedItem, type PacketOptions, type PacketPromptError, type PacketPromptOptions, type PacketTarget, type PacketTargetType, type PacketValidationIssue, type PacketValidationResult, type PreparedManagedHookBlock, type Producer, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TraceVersionResult, VALID_PACKET_TARGET_TYPES, VERSION_INDEX_SCHEMA_VERSION, VERSION_LOCK_PATH, VERSION_LOCK_SCHEMA_VERSION, type ValidationError, type ValidationIssue, type VersionEdgeKind, type VersionIndex, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, applyPreparedManagedHookBlocks, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildGraph, buildVersionIndex, collectChangedPaths, computeE2eCoverageStats, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, formatContextMarkdown, generateE2eRegistry, getArtifactTypeMetadata, getTargetArtifactTypes, installManagedHookBlock, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, loadConfig, nextId, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderDoctorMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, scanArtifacts, traceVersion, updateVersionLock, validateExecutableTraceability, validateGraph, validatePacket, validatePacketMarkdown, validatePacketPrompt, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, writeGraphCache };
package/dist/index.d.ts CHANGED
@@ -165,6 +165,8 @@ interface ImplementationPacket {
165
165
  missingDetails?: MissingDetail[];
166
166
  implementationBlueprintDraft: ImplementationBlueprintDraft;
167
167
  validationCommands: string[];
168
+ /** Explicit universal baseline policy: true=enabled, false=disabled. Absent=legacy (pre-0.5) packet. */
169
+ baselinePolicy?: boolean;
168
170
  }
169
171
  /**
170
172
  * Assemble an implementation packet from a context manifest.
@@ -190,6 +192,10 @@ declare function renderPacketMarkdown(packet: ImplementationPacket): string;
190
192
  *
191
193
  * v1.12: accepts optional schema to derive valid target types dynamically.
192
194
  * Without schema, falls back to the static VALID_PACKET_TARGET_TYPES list.
195
+ *
196
+ * v0.5: PKT-004 no longer infers opt-out from missingDetails or total=0.
197
+ * baselinePolicy=true|absent → must match ALWAYS_PRESENT_ITEMS exactly.
198
+ * baselinePolicy=false → must be total=0, items=[].
193
199
  */
194
200
 
195
201
  /** Valid target types for packets (legacy static fallback) */
@@ -302,6 +308,8 @@ interface AuditOptions {
302
308
  format?: 'json' | 'markdown';
303
309
  mode?: ContextMode;
304
310
  maxPerCategory?: number;
311
+ /** When true (default), check universal baseline files. When false, skip. */
312
+ universalBaseline?: boolean;
305
313
  /** Absolute path to the targets file (--targets-file mode only) */
306
314
  sourceTargetsPath?: string;
307
315
  /** If true, do not write individual packet files — only summary */
@@ -349,10 +357,14 @@ interface DiscoverAuditOptions {
349
357
  summaryDetail?: 'full' | 'compact';
350
358
  /** Artifact schema for dynamic target type validation */
351
359
  schema?: ArtifactSchema;
360
+ /** When true (default), check universal baseline files. When false, skip. */
361
+ universalBaseline?: boolean;
352
362
  }
353
363
  /**
354
364
  * Scan artifacts, discover targets, then audit packets for each.
355
365
  * Single scan is reused for both discovery and audit.
366
+ *
367
+ * When options.universalBaseline is undefined, falls back to config.context?.universal_baseline.
356
368
  */
357
369
  declare function discoverAndAuditPackets(root: string, options: DiscoverAuditOptions): Promise<PacketAuditSummary>;
358
370
 
@@ -547,7 +559,7 @@ interface VersionLockRefreshResult {
547
559
  warnings: string[];
548
560
  }
549
561
  declare function buildVersionIndex(root: string, graph?: ArtifactGraph): Promise<VersionIndex>;
550
- declare function auditVersionLock(root: string, lockPath?: string, graph?: ArtifactGraph): Promise<VersionLockAuditResult>;
562
+ declare function auditVersionLock(root: string, lockPath?: string, graph?: ArtifactGraph, config?: ArtifactSchema): Promise<VersionLockAuditResult>;
551
563
  declare function updateVersionLock(root: string, options: VersionLockUpdateOptions): Promise<VersionLockFile>;
552
564
  declare function bootstrapVersionLock(root: string, options?: VersionLockBootstrapOptions): Promise<VersionLockFile>;
553
565
  declare function refreshVersionLock(root: string, options?: VersionLockRefreshOptions): Promise<VersionLockRefreshResult>;
@@ -654,7 +666,6 @@ declare function installManagedHookBlock(options: ManagedHookBlockOptions): Prom
654
666
 
655
667
  /**
656
668
  * Review Result Protocol validator.
657
- * @feature ACA16 @scenario S-46
658
669
  *
659
670
  * Validates a JSON object against the review-result.schema.json constraints.
660
671
  * Does NOT use ajv or any JSON-schema library — pure deterministic checks
@@ -715,6 +726,15 @@ interface Producer {
715
726
  name: string;
716
727
  skill?: string;
717
728
  }
729
+ interface AcceptanceSourceResult {
730
+ run_id: string;
731
+ stage_id?: string;
732
+ producer: Producer;
733
+ }
734
+ interface AcceptanceData {
735
+ reviewer: Producer;
736
+ source_result: AcceptanceSourceResult;
737
+ }
718
738
  interface BatchDefinition {
719
739
  id: string;
720
740
  files: string[];
@@ -767,6 +787,7 @@ interface ReviewResult {
767
787
  blocking_reason?: string | null;
768
788
  degradation?: string | null;
769
789
  producer?: Producer;
790
+ acceptance?: AcceptanceData;
770
791
  evidence?: Evidence[];
771
792
  review?: ReviewData;
772
793
  repair?: RepairData;
@@ -824,6 +845,26 @@ interface ArtifactEdgeRule {
824
845
  to: string;
825
846
  kind: string;
826
847
  }
848
+ /** E2E test runner configuration */
849
+ interface E2eRunnerConfig {
850
+ /** Runner name (e.g., 'playwright', 'vitest', 'jest') */
851
+ name: string;
852
+ /** Test kind accepted by this runner: 'unit', 'integration', or 'e2e' */
853
+ kind?: 'unit' | 'integration' | 'e2e';
854
+ /** Root directory for test discovery (relative to project root) */
855
+ root: string;
856
+ /** Include glob patterns for test files */
857
+ include: string[];
858
+ /** Exclude glob patterns for test files */
859
+ exclude?: string[];
860
+ /** Test ignore patterns (files that should not be considered as tests) */
861
+ testIgnore?: string[];
862
+ }
863
+ /** Waiver entry with mandatory reason */
864
+ interface E2eWaiver {
865
+ id: string;
866
+ reason: string;
867
+ }
827
868
  interface ArtifactSchema {
828
869
  types: Record<string, ArtifactTypeSchema>;
829
870
  idPatterns: Record<string, string>;
@@ -836,6 +877,28 @@ interface ArtifactSchema {
836
877
  start: number;
837
878
  end: number;
838
879
  }>>;
880
+ /** Context resolution overrides */
881
+ context?: {
882
+ /** When false, skip universal baseline injection. Default: true. */
883
+ universal_baseline?: boolean;
884
+ };
885
+ /** E2E coverage proof configuration */
886
+ e2e?: {
887
+ /** Minimum executable_ref coverage rate (0-1) for warning */
888
+ executable_ref_warning?: number;
889
+ /** Minimum executable_ref coverage rate (0-1) for error */
890
+ executable_ref_error?: number;
891
+ /** Whether to report uncovered scenarios. Default true. */
892
+ report_uncovered_scenarios?: boolean;
893
+ /** Whether to report uncovered features. Default true. */
894
+ report_uncovered_features?: boolean;
895
+ /** Scenario waivers (id + reason) from coverage requirements */
896
+ scenario_waivers?: E2eWaiver[];
897
+ /** Feature waivers (id + reason) from coverage requirements */
898
+ feature_waivers?: E2eWaiver[];
899
+ /** E2E test runner configurations */
900
+ runners?: E2eRunnerConfig[];
901
+ };
839
902
  }
840
903
  declare const TARGET_ARTIFACT_TYPES: readonly ["feature", "scenario", "decision", "design", "e2e_test"];
841
904
  type TargetArtifactType = typeof TARGET_ARTIFACT_TYPES[number];
@@ -862,6 +925,8 @@ interface ArtifactGraph {
862
925
  nodes: ArtifactNode[];
863
926
  edges: ArtifactEdge[];
864
927
  generatedAt: string;
928
+ /** Normalized absolute project root passed to scanArtifacts. Optional for backward compatibility. */
929
+ root?: string;
865
930
  /** Scan-time diagnostics. Optional for backward compatibility with consumers that build graph literals without this field. */
866
931
  diagnostics?: ValidationIssue[];
867
932
  }
@@ -881,7 +946,7 @@ interface ContextItem {
881
946
  interface MissingDetail {
882
947
  ref: string;
883
948
  from: string;
884
- kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets';
949
+ kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets' | 'missing-baseline';
885
950
  message: string;
886
951
  suggestedAction: string;
887
952
  }
@@ -899,6 +964,8 @@ interface ContextManifest {
899
964
  missing: string[];
900
965
  missingDetails?: MissingDetail[];
901
966
  omitted?: ContextItem[];
967
+ /** Explicit universal baseline policy: true=enabled, false=disabled. Used by validatePacket to prevent inferring opt-out from total=0. */
968
+ baselinePolicy?: boolean;
902
969
  }
903
970
  type ContextMode = 'full' | 'implementation';
904
971
  interface ContextOptions {
@@ -911,10 +978,18 @@ interface ContextOptions {
911
978
  target?: ArtifactTarget;
912
979
  mode?: ContextMode;
913
980
  maxPerCategory?: number;
981
+ /**
982
+ * When true (default), inject all ALWAYS_PRESENT_ITEMS as required baseline
983
+ * and report missing ones in manifest.missing. When false, skip baseline
984
+ * injection entirely for lightweight projects.
985
+ */
986
+ universalBaseline?: boolean;
987
+ /** Project root for baseline file existence checks. Required when universalBaseline is true. */
988
+ root?: string;
914
989
  }
915
990
  declare const DEFAULT_SCHEMA: ArtifactSchema;
916
991
  declare function loadConfig(root: string): Promise<ArtifactSchema>;
917
- declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[]): ArtifactGraph;
992
+ declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[], root?: string): ArtifactGraph;
918
993
  declare function scanArtifacts(root: string, schema?: ArtifactSchema): Promise<ArtifactGraph>;
919
994
  /**
920
995
  * Resolve traceability-matrix-v2 edges:
@@ -930,7 +1005,88 @@ declare function queryGraph(graph: ArtifactGraph, options: QueryOptions): Artifa
930
1005
  declare function renderMermaid(graph: ArtifactGraph): string;
931
1006
  declare function nextId(graph: ArtifactGraph, schema: ArtifactSchema, type: string, rangeName: string): string;
932
1007
  declare function writeGraphCache(root: string, graph: ArtifactGraph): Promise<void>;
933
- declare function validateExecutableTraceability(root: string): Promise<ValidationIssue[]>;
1008
+ declare function validateExecutableTraceability(root: string, config?: ArtifactSchema): Promise<ValidationIssue[]>;
1009
+ /** O2: E2E coverage statistics and blackhole diagnostics */
1010
+ interface E2eCoverageStats {
1011
+ totalTestCases: number;
1012
+ withExecutableRef: number;
1013
+ executableRefRate: string;
1014
+ /** TCs by status */
1015
+ statusBreakdown: Record<string, number>;
1016
+ /** TCs by chain_type */
1017
+ chainTypeBreakdown: Record<string, number>;
1018
+ /** Scenarios with zero E2E coverage */
1019
+ uncoveredScenarios: string[];
1020
+ /** Features with zero E2E coverage */
1021
+ uncoveredFeatures: string[];
1022
+ /** Configurable thresholds */
1023
+ thresholdWarnings: string[];
1024
+ thresholdErrors: string[];
1025
+ /** Derived ac_coverage_rate per feature */
1026
+ acCoverageRateByFeature: Record<string, {
1027
+ numerator: number;
1028
+ denominator: number;
1029
+ rate: number;
1030
+ }>;
1031
+ /** Multi-dimensional scenario coverage */
1032
+ scenarioCoverage: Record<string, {
1033
+ linked: boolean;
1034
+ acCovered: boolean;
1035
+ waived: boolean;
1036
+ verified: boolean;
1037
+ }>;
1038
+ /** Multi-dimensional feature coverage */
1039
+ featureCoverage: Record<string, {
1040
+ linked: boolean;
1041
+ acCovered: boolean;
1042
+ waived: boolean;
1043
+ verified: boolean;
1044
+ }>;
1045
+ }
1046
+ interface E2eCoverageThresholds {
1047
+ /** Minimum executable_ref coverage rate (0-1). Below this triggers warning. */
1048
+ executableRefWarning?: number;
1049
+ /** Minimum executable_ref coverage rate (0-1). Below this triggers error. */
1050
+ executableRefError?: number;
1051
+ /** Whether to report uncovered scenarios as warnings. Default true. */
1052
+ reportUncoveredScenarios?: boolean;
1053
+ /** Whether to report uncovered features as warnings. Default true. */
1054
+ reportUncoveredFeatures?: boolean;
1055
+ /** Explicit waivers: scenario IDs that are waived from coverage requirements */
1056
+ scenarioWaivers?: E2eWaiver[];
1057
+ /** Explicit waivers: feature IDs that are waived from coverage requirements */
1058
+ featureWaivers?: E2eWaiver[];
1059
+ }
1060
+ declare function computeE2eCoverageStats(graph: ArtifactGraph, root: string, thresholds?: E2eCoverageThresholds): Promise<E2eCoverageStats>;
1061
+ /** O4: Deterministic, idempotent E2E registry generation from Markdown sources */
1062
+ interface E2eRegistryBatch {
1063
+ batch_id: string;
1064
+ file: string;
1065
+ scope: string;
1066
+ ac_coverage: Record<string, string[]>;
1067
+ related_scenarios: string[];
1068
+ test_case_count: number;
1069
+ status_summary?: Record<string, number>;
1070
+ /** Batch-level status: 'blocked' when frontmatter fixes_block indicates blocking */
1071
+ status?: string;
1072
+ /** Blocking reasons from frontmatter fixes_block */
1073
+ blocking_reasons?: Record<string, string>;
1074
+ }
1075
+ interface E2eRegistry {
1076
+ registry_version: string;
1077
+ generated_at: string;
1078
+ total_batches: number;
1079
+ total_test_cases: number;
1080
+ batches: E2eRegistryBatch[];
1081
+ }
1082
+ /**
1083
+ * Generate E2E registry from Markdown test files.
1084
+ * Deterministic: same input always produces same output (except generated_at).
1085
+ * Use `--deterministic` to set generated_at to epoch for idempotent diff checks.
1086
+ */
1087
+ declare function generateE2eRegistry(root: string, opts?: {
1088
+ deterministic?: boolean;
1089
+ }): Promise<E2eRegistry>;
934
1090
  interface DiscoverOptions {
935
1091
  limit?: number;
936
1092
  schema?: ArtifactSchema;
@@ -949,4 +1105,4 @@ declare function discoverTargets(graph: ArtifactGraph, options?: DiscoverOptions
949
1105
  declare function resolveArtifactContext(graph: ArtifactGraph, opts: ContextOptions): ContextManifest;
950
1106
  declare function formatContextMarkdown(manifest: ContextManifest): string;
951
1107
 
952
- export { ALWAYS_PRESENT_ITEMS as ALWAYS_PRESENT, type ArtifactChainDoctorReport, type ArtifactEdge, type ArtifactEdgeRule, type ArtifactExtraFieldSchema, type ArtifactGraph, type ArtifactGraphCliCandidate, type ArtifactGraphCliResolution, type ArtifactGraphCliSource, type ArtifactNode, type ArtifactSchema, type ArtifactTarget, type ArtifactTypeMetadata, type ArtifactTypeRole, type ArtifactTypeSchema, BASELINE_CONSTRAINTS, BASELINE_CONSTRAINTS_COUNT, BASELINE_ITEMS_COUNT, type BatchDefinition, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DiscoverOptions, type Evidence, type EvidenceObject, type ExecutorType, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImplementationBlueprintDraft, type ImplementationPacket, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type PacketAuditEntry, type PacketAuditSummary, type PacketCategory, type PacketItem, type PacketOmittedItem, type PacketOptions, type PacketPromptError, type PacketPromptOptions, type PacketTarget, type PacketTargetType, type PacketValidationIssue, type PacketValidationResult, type PreparedManagedHookBlock, type Producer, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TraceVersionResult, VALID_PACKET_TARGET_TYPES, VERSION_INDEX_SCHEMA_VERSION, VERSION_LOCK_PATH, VERSION_LOCK_SCHEMA_VERSION, type ValidationError, type ValidationIssue, type VersionEdgeKind, type VersionIndex, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, applyPreparedManagedHookBlocks, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildGraph, buildVersionIndex, collectChangedPaths, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, formatContextMarkdown, getArtifactTypeMetadata, getTargetArtifactTypes, installManagedHookBlock, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, loadConfig, nextId, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderDoctorMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, scanArtifacts, traceVersion, updateVersionLock, validateExecutableTraceability, validateGraph, validatePacket, validatePacketMarkdown, validatePacketPrompt, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, writeGraphCache };
1108
+ export { ALWAYS_PRESENT_ITEMS as ALWAYS_PRESENT, type ArtifactChainDoctorReport, type ArtifactEdge, type ArtifactEdgeRule, type ArtifactExtraFieldSchema, type ArtifactGraph, type ArtifactGraphCliCandidate, type ArtifactGraphCliResolution, type ArtifactGraphCliSource, type ArtifactNode, type ArtifactSchema, type ArtifactTarget, type ArtifactTypeMetadata, type ArtifactTypeRole, type ArtifactTypeSchema, BASELINE_CONSTRAINTS, BASELINE_CONSTRAINTS_COUNT, BASELINE_ITEMS_COUNT, type BatchDefinition, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DiscoverOptions, type E2eCoverageStats, type E2eCoverageThresholds, type E2eRegistry, type E2eRegistryBatch, type E2eRunnerConfig, type E2eWaiver, type Evidence, type EvidenceObject, type ExecutorType, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImplementationBlueprintDraft, type ImplementationPacket, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type PacketAuditEntry, type PacketAuditSummary, type PacketCategory, type PacketItem, type PacketOmittedItem, type PacketOptions, type PacketPromptError, type PacketPromptOptions, type PacketTarget, type PacketTargetType, type PacketValidationIssue, type PacketValidationResult, type PreparedManagedHookBlock, type Producer, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TraceVersionResult, VALID_PACKET_TARGET_TYPES, VERSION_INDEX_SCHEMA_VERSION, VERSION_LOCK_PATH, VERSION_LOCK_SCHEMA_VERSION, type ValidationError, type ValidationIssue, type VersionEdgeKind, type VersionIndex, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, applyPreparedManagedHookBlocks, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildGraph, buildVersionIndex, collectChangedPaths, computeE2eCoverageStats, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, formatContextMarkdown, generateE2eRegistry, getArtifactTypeMetadata, getTargetArtifactTypes, installManagedHookBlock, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, loadConfig, nextId, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderDoctorMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, scanArtifacts, traceVersion, updateVersionLock, validateExecutableTraceability, validateGraph, validatePacket, validatePacketMarkdown, validatePacketPrompt, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, writeGraphCache };