artifact-graph 0.9.4 → 0.11.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
@@ -48,6 +48,95 @@ declare function parseTargetSelector(value: string): ArtifactTarget;
48
48
  */
49
49
  declare function resolveCliTarget(flags: Record<string, string | boolean>, schema: ArtifactSchema): ArtifactTarget;
50
50
 
51
+ type ImpactMode = 'worktree' | 'staged' | 'base' | 'paths';
52
+ interface ImpactOptions {
53
+ mode?: ImpactMode;
54
+ base?: string;
55
+ paths?: string[];
56
+ schema?: ArtifactSchema;
57
+ }
58
+ interface ImpactNodeRef {
59
+ uid: string;
60
+ type: string;
61
+ code: string;
62
+ title: string;
63
+ path: string;
64
+ }
65
+ interface ImpactEdgeRef {
66
+ from: string;
67
+ to: string;
68
+ kind: string;
69
+ sourcePath: string;
70
+ sourceLine?: number;
71
+ attrs?: Record<string, unknown>;
72
+ }
73
+ interface ImpactReport {
74
+ schemaVersion: '1.0';
75
+ root: string;
76
+ mode: ImpactMode;
77
+ base?: string;
78
+ changedPaths: string[];
79
+ directNodes: ImpactNodeRef[];
80
+ relatedNodes: ImpactNodeRef[];
81
+ affectedEdges: ImpactEdgeRef[];
82
+ scopedUnresolvedPaths: string[];
83
+ graphControlPaths: string[];
84
+ unmappedPaths: string[];
85
+ writes: 'none';
86
+ }
87
+ declare function computeImpact(root: string, options?: ImpactOptions): Promise<ImpactReport>;
88
+ declare function renderImpactMarkdown(report: ImpactReport): string;
89
+
90
+ interface DeclaredVerificationReference {
91
+ from: string;
92
+ to: string;
93
+ kind: string;
94
+ sourcePath: string;
95
+ sourceLine: number;
96
+ }
97
+ interface CoverageBoundaryReport {
98
+ schemaVersion: '1.0';
99
+ root: string;
100
+ graphHealth: {
101
+ validateIssues: number;
102
+ errorCount: number;
103
+ lockIssues: number;
104
+ relationLocks: {
105
+ declared: number;
106
+ locked: number;
107
+ fresh: number;
108
+ };
109
+ assessment: 'healthy-with-declarations' | 'healthy-no-declarations' | 'issues';
110
+ };
111
+ scanCoverage: {
112
+ configuredTypes: string[];
113
+ scannedFiles: number;
114
+ mappedFiles: number;
115
+ changedPathScope: 'worktree' | 'unavailable';
116
+ scopedUnresolved: string[];
117
+ unmapped: string[];
118
+ };
119
+ behaviorVerification: {
120
+ status: 'not-evaluated';
121
+ declaredReferences: DeclaredVerificationReference[];
122
+ note: string;
123
+ };
124
+ releaseCoverage: {
125
+ source: 'caller' | 'none';
126
+ inputList?: string[];
127
+ mappedPaths: string[];
128
+ unmappedPaths: string[];
129
+ status: 'not-requested' | 'unknown';
130
+ evidence: [];
131
+ note: string;
132
+ };
133
+ }
134
+ declare function computeCoverageBoundary(root: string, opts?: {
135
+ schema?: ArtifactSchema;
136
+ releaseInput?: string[];
137
+ }): Promise<CoverageBoundaryReport>;
138
+ declare function renderCoverageBoundaryMarkdown(report: CoverageBoundaryReport): string;
139
+
51
140
  /**
52
141
  * packet-assembler.ts
53
142
  *
@@ -167,6 +256,8 @@ interface ImplementationPacket {
167
256
  validationCommands: string[];
168
257
  /** Explicit universal baseline policy: true=enabled, false=disabled. Absent=legacy (pre-0.5) packet. */
169
258
  baselinePolicy?: boolean;
259
+ /** Present only when context resolution used an explicit time view. */
260
+ viewSelection?: ViewSelection;
170
261
  }
171
262
  /**
172
263
  * Assemble an implementation packet from a context manifest.
@@ -629,6 +720,32 @@ declare function renderVersionLockAuditMarkdown(result: VersionLockAuditResult,
629
720
  declare function renderVersionLockRefreshMarkdown(result: VersionLockRefreshResult): string;
630
721
  declare function renderTraceVersionMarkdown(result: TraceVersionResult): string;
631
722
 
723
+ type NativeBindingFailedStage = 'load' | 'open' | 'write' | 'read' | 'close';
724
+ type NativeBindingCause = 'MISSING' | 'ABI_MISMATCH' | 'BUILD_DISABLED' | 'LOAD_ERROR';
725
+ interface NativeBindingDiagnostic {
726
+ selectedCli: string;
727
+ runtime: string;
728
+ abi: string;
729
+ installSource: string;
730
+ /** binding probe 实际加载 better-sqlite3 的安装锚点;与 selectedCli 绑定同一安装来源。 */
731
+ probedFrom: string;
732
+ failedStage: NativeBindingFailedStage;
733
+ cause: NativeBindingCause;
734
+ suggestion: string;
735
+ }
736
+ /**
737
+ * F-09-P03:probe 成功时的诊断上下文。成功与失败都必须保留并渲染实际探测来源
738
+ * (probedFrom)与安装来源(installSource),否则成功报告会隐藏选中安装,
739
+ * 双安装/PATH/legacy 场景无法核对分类依据来自哪同一个安装。
740
+ */
741
+ interface NativeBindingSuccessDiagnostic {
742
+ selectedCli: string;
743
+ runtime: string;
744
+ installSource: string;
745
+ probedFrom: string;
746
+ }
747
+ type BindingLoader = () => unknown;
748
+
632
749
  type ArtifactGraphCliSource = 'node_modules' | 'path' | 'legacy' | 'plugin-bundled';
633
750
  interface ArtifactGraphCliCandidate {
634
751
  source: ArtifactGraphCliSource;
@@ -644,6 +761,7 @@ interface ArtifactGraphCliResolution {
644
761
  interface ResolveArtifactGraphCliOptions {
645
762
  projectCliPath?: string;
646
763
  fallbackPath?: string;
764
+ bindingLoader?: BindingLoader;
647
765
  }
648
766
  interface ArtifactChainDoctorReport {
649
767
  schemaVersion: '1.0';
@@ -662,6 +780,11 @@ interface ArtifactChainDoctorReport {
662
780
  path: string;
663
781
  exists: boolean;
664
782
  };
783
+ nativeBinding: ({
784
+ ok: true;
785
+ } & NativeBindingSuccessDiagnostic) | ({
786
+ ok: false;
787
+ } & NativeBindingDiagnostic);
665
788
  supportedCommands: string[];
666
789
  warnings: string[];
667
790
  }
@@ -1203,6 +1326,7 @@ interface ArtifactEdge {
1203
1326
  source: string;
1204
1327
  sourcePath: string;
1205
1328
  sourceLine: number;
1329
+ attrs?: Record<string, unknown>;
1206
1330
  }
1207
1331
  interface ValidationIssue {
1208
1332
  code: string;
@@ -1237,6 +1361,16 @@ interface ArtifactEdgeRule {
1237
1361
  to: string;
1238
1362
  kind: string;
1239
1363
  }
1364
+ type TimeBucket = 'current' | 'planned' | 'history';
1365
+ type TimeView = TimeBucket | 'all';
1366
+ interface RelationSemanticsSpec {
1367
+ label: string;
1368
+ targetTypes: string[];
1369
+ fields: string[];
1370
+ partial?: {
1371
+ sectionField: string;
1372
+ };
1373
+ }
1240
1374
  /** E2E test runner configuration */
1241
1375
  interface E2eRunnerConfig {
1242
1376
  /** Runner name (e.g., 'playwright', 'vitest', 'jest') */
@@ -1269,6 +1403,10 @@ interface ArtifactSchema {
1269
1403
  start: number;
1270
1404
  end: number;
1271
1405
  }>>;
1406
+ /** Optional, domain-configured relation kinds and their frontmatter fields. */
1407
+ relationSemantics?: Record<string, RelationSemanticsSpec>;
1408
+ /** Optional mapping from domain status words to time-view buckets. */
1409
+ statusViews?: Record<string, TimeBucket>;
1272
1410
  /** Context resolution overrides */
1273
1411
  context?: {
1274
1412
  /** When false, skip universal baseline injection. Default: true. */
@@ -1321,11 +1459,36 @@ interface ArtifactGraph {
1321
1459
  root?: string;
1322
1460
  /** Scan-time diagnostics. Optional for backward compatibility with consumers that build graph literals without this field. */
1323
1461
  diagnostics?: ValidationIssue[];
1462
+ /** Present only for an explicit time-view query. */
1463
+ viewSelection?: ViewSelection;
1324
1464
  }
1325
1465
  interface QueryOptions {
1326
1466
  from?: string;
1327
1467
  to?: string;
1328
1468
  depth?: number;
1469
+ view?: TimeView;
1470
+ schema?: ArtifactSchema;
1471
+ }
1472
+ interface NodeTimeView {
1473
+ bucket: TimeBucket | 'uncategorized';
1474
+ basis: string;
1475
+ }
1476
+ interface ViewExcludedNode {
1477
+ uid: string;
1478
+ bucket: TimeBucket | 'uncategorized';
1479
+ basis: string;
1480
+ }
1481
+ interface PartialSupersedeAnnotation {
1482
+ targetUid: string;
1483
+ supersededBy: string;
1484
+ sections: string[];
1485
+ sourcePath: string;
1486
+ sourceLine: number;
1487
+ }
1488
+ interface ViewSelection {
1489
+ view: TimeBucket;
1490
+ excluded: ViewExcludedNode[];
1491
+ partialSupersedes: PartialSupersedeAnnotation[];
1329
1492
  }
1330
1493
  type ContextTier = 'baseline' | 'target' | 'direct' | 'matrix' | 'transitive';
1331
1494
  interface ContextItem {
@@ -1358,6 +1521,8 @@ interface ContextManifest {
1358
1521
  omitted?: ContextItem[];
1359
1522
  /** Explicit universal baseline policy: true=enabled, false=disabled. Used by validatePacket to prevent inferring opt-out from total=0. */
1360
1523
  baselinePolicy?: boolean;
1524
+ /** Present only when the caller explicitly selects a time view. */
1525
+ viewSelection?: ViewSelection;
1361
1526
  }
1362
1527
  type ContextMode = 'full' | 'implementation';
1363
1528
  interface ContextOptions {
@@ -1378,6 +1543,8 @@ interface ContextOptions {
1378
1543
  universalBaseline?: boolean;
1379
1544
  /** Project root for baseline file existence checks. Required when universalBaseline is true. */
1380
1545
  root?: string;
1546
+ view?: TimeView;
1547
+ schema?: ArtifactSchema;
1381
1548
  }
1382
1549
  declare const DEFAULT_SCHEMA: ArtifactSchema;
1383
1550
  declare function loadConfig(root: string): Promise<ArtifactSchema>;
@@ -1391,8 +1558,21 @@ declare function scanArtifacts(root: string, schema?: ArtifactSchema): Promise<A
1391
1558
  */
1392
1559
  declare function resolveMatrixEdges(graph: ArtifactGraph): ArtifactGraph;
1393
1560
  declare function validateGraph(graph: ArtifactGraph, schema?: ArtifactSchema): ValidationIssue[];
1561
+ interface ExternalEntryInfo {
1562
+ external: boolean;
1563
+ targetProject?: string;
1564
+ targetRef?: string;
1565
+ targetVersion?: string;
1566
+ }
1567
+ declare function getExternalEntryInfo(node: ArtifactNode): ExternalEntryInfo;
1394
1568
  declare function validateScenarioPrdLinks(graph: ArtifactGraph, schema?: ArtifactSchema): ValidationIssue[];
1395
1569
  declare function validateScenarioPrdLinkIndex(root: string, graph: ArtifactGraph): Promise<ValidationIssue[]>;
1570
+ declare function resolveNodeTimeView(node: ArtifactNode, graph: ArtifactGraph, schema?: ArtifactSchema): NodeTimeView;
1571
+ declare function filterGraphByView(graph: ArtifactGraph, view: TimeView | undefined, schema?: ArtifactSchema): {
1572
+ graph: ArtifactGraph;
1573
+ excluded: ViewExcludedNode[];
1574
+ partialSupersedes: PartialSupersedeAnnotation[];
1575
+ };
1396
1576
  declare function queryGraph(graph: ArtifactGraph, options: QueryOptions): ArtifactGraph;
1397
1577
  declare function renderMermaid(graph: ArtifactGraph): string;
1398
1578
  declare function nextId(graph: ArtifactGraph, schema: ArtifactSchema, type: string, rangeName: string): string;
@@ -1498,4 +1678,4 @@ declare function discoverTargets(graph: ArtifactGraph, options?: DiscoverOptions
1498
1678
  declare function resolveArtifactContext(graph: ArtifactGraph, opts: ContextOptions): ContextManifest;
1499
1679
  declare function formatContextMarkdown(manifest: ContextManifest): string;
1500
1680
 
1501
- 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, CONTRACT_ERROR_CODES, type CanonicalIR, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, ContractCatalog, type ContractCatalogEntry, type ContractDefinition, ContractError, type ContractErrorCode, type ContractIdentity, ContractRegistry, type ContractRegistryEntry, type ContractSchema, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DiscoverOptions, E2E_NORMALIZER_CONFIG, 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, type LegacyFieldMapping, type LoadContractOptions, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type NormalizationResult, type NormalizerConfig, 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 PolicyCompatibilityResult, type PreparedManagedHookBlock, type Producer, type ProjectPolicy, 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, type SchemaValidationResult, 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 VersionLockAuditMarkdownOptions, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockIssueSeverity, 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, computeRevisionDigest, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, formatContextMarkdown, generateE2eRegistry, getArtifactTypeMetadata, getTargetArtifactTypes, installManagedHookBlock, isOfficialNamespace, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, isVersionLockIssueBlocking, loadConfig, loadContract, loadContractCatalog, loadContractsFromDirectory, matchesConfiguredArtifactPath, nextId, normalizeE2eLegacyArtifact, normalizeToCanonical, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderDoctorMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, scanArtifacts, traceVersion, updateVersionLock, validateContractAgainstSchema, validateExecutableTraceability, validateGraph, validateNamespaceAuthority, validatePacket, validatePacketMarkdown, validatePacketPrompt, validatePolicyCompatibility, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, verifyDigest, versionLockIssueSeverity, writeGraphCache };
1681
+ 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, CONTRACT_ERROR_CODES, type CanonicalIR, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, ContractCatalog, type ContractCatalogEntry, type ContractDefinition, ContractError, type ContractErrorCode, type ContractIdentity, ContractRegistry, type ContractRegistryEntry, type ContractSchema, type CoverageBoundaryReport, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DeclaredVerificationReference, type DiscoverOptions, E2E_NORMALIZER_CONFIG, type E2eCoverageStats, type E2eCoverageThresholds, type E2eRegistry, type E2eRegistryBatch, type E2eRunnerConfig, type E2eWaiver, type Evidence, type EvidenceObject, type ExecutorType, type ExternalEntryInfo, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImpactEdgeRef, type ImpactMode, type ImpactNodeRef, type ImpactOptions, type ImpactReport, type ImplementationBlueprintDraft, type ImplementationPacket, type LegacyFieldMapping, type LoadContractOptions, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type NodeTimeView, type NormalizationResult, type NormalizerConfig, 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 PartialSupersedeAnnotation, type PolicyCompatibilityResult, type PreparedManagedHookBlock, type Producer, type ProjectPolicy, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, type RelationSemanticsSpec, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, type SchemaValidationResult, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TimeBucket, type TimeView, 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 VersionLockAuditMarkdownOptions, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockIssueSeverity, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, type ViewExcludedNode, type ViewSelection, applyPreparedManagedHookBlocks, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildGraph, buildVersionIndex, collectChangedPaths, computeCoverageBoundary, computeE2eCoverageStats, computeImpact, computeRevisionDigest, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, filterGraphByView, formatContextMarkdown, generateE2eRegistry, getArtifactTypeMetadata, getExternalEntryInfo, getTargetArtifactTypes, installManagedHookBlock, isOfficialNamespace, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, isVersionLockIssueBlocking, loadConfig, loadContract, loadContractCatalog, loadContractsFromDirectory, matchesConfiguredArtifactPath, nextId, normalizeE2eLegacyArtifact, normalizeToCanonical, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderCoverageBoundaryMarkdown, renderDoctorMarkdown, renderImpactMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, resolveNodeTimeView, scanArtifacts, traceVersion, updateVersionLock, validateContractAgainstSchema, validateExecutableTraceability, validateGraph, validateNamespaceAuthority, validatePacket, validatePacketMarkdown, validatePacketPrompt, validatePolicyCompatibility, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, verifyDigest, versionLockIssueSeverity, writeGraphCache };
package/dist/index.d.ts CHANGED
@@ -48,6 +48,95 @@ declare function parseTargetSelector(value: string): ArtifactTarget;
48
48
  */
49
49
  declare function resolveCliTarget(flags: Record<string, string | boolean>, schema: ArtifactSchema): ArtifactTarget;
50
50
 
51
+ type ImpactMode = 'worktree' | 'staged' | 'base' | 'paths';
52
+ interface ImpactOptions {
53
+ mode?: ImpactMode;
54
+ base?: string;
55
+ paths?: string[];
56
+ schema?: ArtifactSchema;
57
+ }
58
+ interface ImpactNodeRef {
59
+ uid: string;
60
+ type: string;
61
+ code: string;
62
+ title: string;
63
+ path: string;
64
+ }
65
+ interface ImpactEdgeRef {
66
+ from: string;
67
+ to: string;
68
+ kind: string;
69
+ sourcePath: string;
70
+ sourceLine?: number;
71
+ attrs?: Record<string, unknown>;
72
+ }
73
+ interface ImpactReport {
74
+ schemaVersion: '1.0';
75
+ root: string;
76
+ mode: ImpactMode;
77
+ base?: string;
78
+ changedPaths: string[];
79
+ directNodes: ImpactNodeRef[];
80
+ relatedNodes: ImpactNodeRef[];
81
+ affectedEdges: ImpactEdgeRef[];
82
+ scopedUnresolvedPaths: string[];
83
+ graphControlPaths: string[];
84
+ unmappedPaths: string[];
85
+ writes: 'none';
86
+ }
87
+ declare function computeImpact(root: string, options?: ImpactOptions): Promise<ImpactReport>;
88
+ declare function renderImpactMarkdown(report: ImpactReport): string;
89
+
90
+ interface DeclaredVerificationReference {
91
+ from: string;
92
+ to: string;
93
+ kind: string;
94
+ sourcePath: string;
95
+ sourceLine: number;
96
+ }
97
+ interface CoverageBoundaryReport {
98
+ schemaVersion: '1.0';
99
+ root: string;
100
+ graphHealth: {
101
+ validateIssues: number;
102
+ errorCount: number;
103
+ lockIssues: number;
104
+ relationLocks: {
105
+ declared: number;
106
+ locked: number;
107
+ fresh: number;
108
+ };
109
+ assessment: 'healthy-with-declarations' | 'healthy-no-declarations' | 'issues';
110
+ };
111
+ scanCoverage: {
112
+ configuredTypes: string[];
113
+ scannedFiles: number;
114
+ mappedFiles: number;
115
+ changedPathScope: 'worktree' | 'unavailable';
116
+ scopedUnresolved: string[];
117
+ unmapped: string[];
118
+ };
119
+ behaviorVerification: {
120
+ status: 'not-evaluated';
121
+ declaredReferences: DeclaredVerificationReference[];
122
+ note: string;
123
+ };
124
+ releaseCoverage: {
125
+ source: 'caller' | 'none';
126
+ inputList?: string[];
127
+ mappedPaths: string[];
128
+ unmappedPaths: string[];
129
+ status: 'not-requested' | 'unknown';
130
+ evidence: [];
131
+ note: string;
132
+ };
133
+ }
134
+ declare function computeCoverageBoundary(root: string, opts?: {
135
+ schema?: ArtifactSchema;
136
+ releaseInput?: string[];
137
+ }): Promise<CoverageBoundaryReport>;
138
+ declare function renderCoverageBoundaryMarkdown(report: CoverageBoundaryReport): string;
139
+
51
140
  /**
52
141
  * packet-assembler.ts
53
142
  *
@@ -167,6 +256,8 @@ interface ImplementationPacket {
167
256
  validationCommands: string[];
168
257
  /** Explicit universal baseline policy: true=enabled, false=disabled. Absent=legacy (pre-0.5) packet. */
169
258
  baselinePolicy?: boolean;
259
+ /** Present only when context resolution used an explicit time view. */
260
+ viewSelection?: ViewSelection;
170
261
  }
171
262
  /**
172
263
  * Assemble an implementation packet from a context manifest.
@@ -629,6 +720,32 @@ declare function renderVersionLockAuditMarkdown(result: VersionLockAuditResult,
629
720
  declare function renderVersionLockRefreshMarkdown(result: VersionLockRefreshResult): string;
630
721
  declare function renderTraceVersionMarkdown(result: TraceVersionResult): string;
631
722
 
723
+ type NativeBindingFailedStage = 'load' | 'open' | 'write' | 'read' | 'close';
724
+ type NativeBindingCause = 'MISSING' | 'ABI_MISMATCH' | 'BUILD_DISABLED' | 'LOAD_ERROR';
725
+ interface NativeBindingDiagnostic {
726
+ selectedCli: string;
727
+ runtime: string;
728
+ abi: string;
729
+ installSource: string;
730
+ /** binding probe 实际加载 better-sqlite3 的安装锚点;与 selectedCli 绑定同一安装来源。 */
731
+ probedFrom: string;
732
+ failedStage: NativeBindingFailedStage;
733
+ cause: NativeBindingCause;
734
+ suggestion: string;
735
+ }
736
+ /**
737
+ * F-09-P03:probe 成功时的诊断上下文。成功与失败都必须保留并渲染实际探测来源
738
+ * (probedFrom)与安装来源(installSource),否则成功报告会隐藏选中安装,
739
+ * 双安装/PATH/legacy 场景无法核对分类依据来自哪同一个安装。
740
+ */
741
+ interface NativeBindingSuccessDiagnostic {
742
+ selectedCli: string;
743
+ runtime: string;
744
+ installSource: string;
745
+ probedFrom: string;
746
+ }
747
+ type BindingLoader = () => unknown;
748
+
632
749
  type ArtifactGraphCliSource = 'node_modules' | 'path' | 'legacy' | 'plugin-bundled';
633
750
  interface ArtifactGraphCliCandidate {
634
751
  source: ArtifactGraphCliSource;
@@ -644,6 +761,7 @@ interface ArtifactGraphCliResolution {
644
761
  interface ResolveArtifactGraphCliOptions {
645
762
  projectCliPath?: string;
646
763
  fallbackPath?: string;
764
+ bindingLoader?: BindingLoader;
647
765
  }
648
766
  interface ArtifactChainDoctorReport {
649
767
  schemaVersion: '1.0';
@@ -662,6 +780,11 @@ interface ArtifactChainDoctorReport {
662
780
  path: string;
663
781
  exists: boolean;
664
782
  };
783
+ nativeBinding: ({
784
+ ok: true;
785
+ } & NativeBindingSuccessDiagnostic) | ({
786
+ ok: false;
787
+ } & NativeBindingDiagnostic);
665
788
  supportedCommands: string[];
666
789
  warnings: string[];
667
790
  }
@@ -1203,6 +1326,7 @@ interface ArtifactEdge {
1203
1326
  source: string;
1204
1327
  sourcePath: string;
1205
1328
  sourceLine: number;
1329
+ attrs?: Record<string, unknown>;
1206
1330
  }
1207
1331
  interface ValidationIssue {
1208
1332
  code: string;
@@ -1237,6 +1361,16 @@ interface ArtifactEdgeRule {
1237
1361
  to: string;
1238
1362
  kind: string;
1239
1363
  }
1364
+ type TimeBucket = 'current' | 'planned' | 'history';
1365
+ type TimeView = TimeBucket | 'all';
1366
+ interface RelationSemanticsSpec {
1367
+ label: string;
1368
+ targetTypes: string[];
1369
+ fields: string[];
1370
+ partial?: {
1371
+ sectionField: string;
1372
+ };
1373
+ }
1240
1374
  /** E2E test runner configuration */
1241
1375
  interface E2eRunnerConfig {
1242
1376
  /** Runner name (e.g., 'playwright', 'vitest', 'jest') */
@@ -1269,6 +1403,10 @@ interface ArtifactSchema {
1269
1403
  start: number;
1270
1404
  end: number;
1271
1405
  }>>;
1406
+ /** Optional, domain-configured relation kinds and their frontmatter fields. */
1407
+ relationSemantics?: Record<string, RelationSemanticsSpec>;
1408
+ /** Optional mapping from domain status words to time-view buckets. */
1409
+ statusViews?: Record<string, TimeBucket>;
1272
1410
  /** Context resolution overrides */
1273
1411
  context?: {
1274
1412
  /** When false, skip universal baseline injection. Default: true. */
@@ -1321,11 +1459,36 @@ interface ArtifactGraph {
1321
1459
  root?: string;
1322
1460
  /** Scan-time diagnostics. Optional for backward compatibility with consumers that build graph literals without this field. */
1323
1461
  diagnostics?: ValidationIssue[];
1462
+ /** Present only for an explicit time-view query. */
1463
+ viewSelection?: ViewSelection;
1324
1464
  }
1325
1465
  interface QueryOptions {
1326
1466
  from?: string;
1327
1467
  to?: string;
1328
1468
  depth?: number;
1469
+ view?: TimeView;
1470
+ schema?: ArtifactSchema;
1471
+ }
1472
+ interface NodeTimeView {
1473
+ bucket: TimeBucket | 'uncategorized';
1474
+ basis: string;
1475
+ }
1476
+ interface ViewExcludedNode {
1477
+ uid: string;
1478
+ bucket: TimeBucket | 'uncategorized';
1479
+ basis: string;
1480
+ }
1481
+ interface PartialSupersedeAnnotation {
1482
+ targetUid: string;
1483
+ supersededBy: string;
1484
+ sections: string[];
1485
+ sourcePath: string;
1486
+ sourceLine: number;
1487
+ }
1488
+ interface ViewSelection {
1489
+ view: TimeBucket;
1490
+ excluded: ViewExcludedNode[];
1491
+ partialSupersedes: PartialSupersedeAnnotation[];
1329
1492
  }
1330
1493
  type ContextTier = 'baseline' | 'target' | 'direct' | 'matrix' | 'transitive';
1331
1494
  interface ContextItem {
@@ -1358,6 +1521,8 @@ interface ContextManifest {
1358
1521
  omitted?: ContextItem[];
1359
1522
  /** Explicit universal baseline policy: true=enabled, false=disabled. Used by validatePacket to prevent inferring opt-out from total=0. */
1360
1523
  baselinePolicy?: boolean;
1524
+ /** Present only when the caller explicitly selects a time view. */
1525
+ viewSelection?: ViewSelection;
1361
1526
  }
1362
1527
  type ContextMode = 'full' | 'implementation';
1363
1528
  interface ContextOptions {
@@ -1378,6 +1543,8 @@ interface ContextOptions {
1378
1543
  universalBaseline?: boolean;
1379
1544
  /** Project root for baseline file existence checks. Required when universalBaseline is true. */
1380
1545
  root?: string;
1546
+ view?: TimeView;
1547
+ schema?: ArtifactSchema;
1381
1548
  }
1382
1549
  declare const DEFAULT_SCHEMA: ArtifactSchema;
1383
1550
  declare function loadConfig(root: string): Promise<ArtifactSchema>;
@@ -1391,8 +1558,21 @@ declare function scanArtifacts(root: string, schema?: ArtifactSchema): Promise<A
1391
1558
  */
1392
1559
  declare function resolveMatrixEdges(graph: ArtifactGraph): ArtifactGraph;
1393
1560
  declare function validateGraph(graph: ArtifactGraph, schema?: ArtifactSchema): ValidationIssue[];
1561
+ interface ExternalEntryInfo {
1562
+ external: boolean;
1563
+ targetProject?: string;
1564
+ targetRef?: string;
1565
+ targetVersion?: string;
1566
+ }
1567
+ declare function getExternalEntryInfo(node: ArtifactNode): ExternalEntryInfo;
1394
1568
  declare function validateScenarioPrdLinks(graph: ArtifactGraph, schema?: ArtifactSchema): ValidationIssue[];
1395
1569
  declare function validateScenarioPrdLinkIndex(root: string, graph: ArtifactGraph): Promise<ValidationIssue[]>;
1570
+ declare function resolveNodeTimeView(node: ArtifactNode, graph: ArtifactGraph, schema?: ArtifactSchema): NodeTimeView;
1571
+ declare function filterGraphByView(graph: ArtifactGraph, view: TimeView | undefined, schema?: ArtifactSchema): {
1572
+ graph: ArtifactGraph;
1573
+ excluded: ViewExcludedNode[];
1574
+ partialSupersedes: PartialSupersedeAnnotation[];
1575
+ };
1396
1576
  declare function queryGraph(graph: ArtifactGraph, options: QueryOptions): ArtifactGraph;
1397
1577
  declare function renderMermaid(graph: ArtifactGraph): string;
1398
1578
  declare function nextId(graph: ArtifactGraph, schema: ArtifactSchema, type: string, rangeName: string): string;
@@ -1498,4 +1678,4 @@ declare function discoverTargets(graph: ArtifactGraph, options?: DiscoverOptions
1498
1678
  declare function resolveArtifactContext(graph: ArtifactGraph, opts: ContextOptions): ContextManifest;
1499
1679
  declare function formatContextMarkdown(manifest: ContextManifest): string;
1500
1680
 
1501
- 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, CONTRACT_ERROR_CODES, type CanonicalIR, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, ContractCatalog, type ContractCatalogEntry, type ContractDefinition, ContractError, type ContractErrorCode, type ContractIdentity, ContractRegistry, type ContractRegistryEntry, type ContractSchema, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DiscoverOptions, E2E_NORMALIZER_CONFIG, 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, type LegacyFieldMapping, type LoadContractOptions, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type NormalizationResult, type NormalizerConfig, 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 PolicyCompatibilityResult, type PreparedManagedHookBlock, type Producer, type ProjectPolicy, 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, type SchemaValidationResult, 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 VersionLockAuditMarkdownOptions, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockIssueSeverity, 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, computeRevisionDigest, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, formatContextMarkdown, generateE2eRegistry, getArtifactTypeMetadata, getTargetArtifactTypes, installManagedHookBlock, isOfficialNamespace, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, isVersionLockIssueBlocking, loadConfig, loadContract, loadContractCatalog, loadContractsFromDirectory, matchesConfiguredArtifactPath, nextId, normalizeE2eLegacyArtifact, normalizeToCanonical, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderDoctorMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, scanArtifacts, traceVersion, updateVersionLock, validateContractAgainstSchema, validateExecutableTraceability, validateGraph, validateNamespaceAuthority, validatePacket, validatePacketMarkdown, validatePacketPrompt, validatePolicyCompatibility, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, verifyDigest, versionLockIssueSeverity, writeGraphCache };
1681
+ 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, CONTRACT_ERROR_CODES, type CanonicalIR, type CollectChangedPathsOptions, type ContextItem, type ContextManifest, type ContextMode, type ContextOptions, type ContextTier, ContractCatalog, type ContractCatalogEntry, type ContractDefinition, ContractError, type ContractErrorCode, type ContractIdentity, ContractRegistry, type ContractRegistryEntry, type ContractSchema, type CoverageBoundaryReport, DEFAULT_MAX_CHARS, DEFAULT_SCHEMA, type DeclaredVerificationReference, type DiscoverOptions, E2E_NORMALIZER_CONFIG, type E2eCoverageStats, type E2eCoverageThresholds, type E2eRegistry, type E2eRegistryBatch, type E2eRunnerConfig, type E2eWaiver, type Evidence, type EvidenceObject, type ExecutorType, type ExternalEntryInfo, type Finding, type FindingLocation, type FindingSeverity, type FindingStatus, type GitChangeMode, type GitChangeResult, type GitHookName, type HookInstallResult, type ImpactEdgeRef, type ImpactMode, type ImpactNodeRef, type ImpactOptions, type ImpactReport, type ImplementationBlueprintDraft, type ImplementationPacket, type LegacyFieldMapping, type LoadContractOptions, MIN_PROMPT_CHARS, type ManagedHookBlockOptions, type MissingDetail, type NodeTimeView, type NormalizationResult, type NormalizerConfig, 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 PartialSupersedeAnnotation, type PolicyCompatibilityResult, type PreparedManagedHookBlock, type Producer, type ProjectPolicy, type PromptValidationIssue, type PromptValidationResult, type QueryOptions, type RelationSemanticsSpec, type RepairData, type RepairValidation, type ResolveArtifactGraphCliOptions, type ReviewData, type ReviewDecision, type ReviewMetrics, type ReviewOrderStep, type ReviewResult, type ReviewStatus, type RiskChecklistItem, type SchemaValidationResult, TARGET_ARTIFACT_TYPES, type TargetArtifactType, type TimeBucket, type TimeView, 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 VersionLockAuditMarkdownOptions, type VersionLockAuditResult, type VersionLockBootstrapOptions, type VersionLockEntry, type VersionLockFile, type VersionLockIssue, type VersionLockIssueSeverity, type VersionLockRef, type VersionLockRefreshOptions, type VersionLockRefreshResult, type VersionLockSourceRef, type VersionLockStatus, type VersionLockUpdateOptions, type VersionSourceKind, type VersionedEdge, type VersionedNode, type ViewExcludedNode, type ViewSelection, applyPreparedManagedHookBlocks, assemblePacket, auditPackets, auditVersionLock, bootstrapVersionLock, buildGraph, buildVersionIndex, collectChangedPaths, computeCoverageBoundary, computeE2eCoverageStats, computeImpact, computeRevisionDigest, discoverAndAuditPackets, discoverTargets, doctorArtifactChain, filterGraphByView, formatContextMarkdown, generateE2eRegistry, getArtifactTypeMetadata, getExternalEntryInfo, getTargetArtifactTypes, installManagedHookBlock, isOfficialNamespace, isPacketTargetType, isPacketTargetTypeDynamic, isTargetArtifactType, isVersionLockIssueBlocking, loadConfig, loadContract, loadContractCatalog, loadContractsFromDirectory, matchesConfiguredArtifactPath, nextId, normalizeE2eLegacyArtifact, normalizeToCanonical, parseTargetSelector, parseTargetsFile, prepareManagedHookBlock, queryGraph, refreshVersionLock, renderCoverageBoundaryMarkdown, renderDoctorMarkdown, renderImpactMarkdown, renderMermaid, renderPacketMarkdown, renderPacketPrompt, renderTraceVersionMarkdown, renderVersionLockAuditMarkdown, renderVersionLockRefreshMarkdown, resolveArtifactContext, resolveArtifactGraphCli, resolveArtifactTypeName, resolveCliTarget, resolveGitHookPath, resolveMatrixEdges, resolveNodeTimeView, scanArtifacts, traceVersion, updateVersionLock, validateContractAgainstSchema, validateExecutableTraceability, validateGraph, validateNamespaceAuthority, validatePacket, validatePacketMarkdown, validatePacketPrompt, validatePolicyCompatibility, validateReviewResult, validateScenarioPrdLinkIndex, validateScenarioPrdLinks, verifyDigest, versionLockIssueSeverity, writeGraphCache };