artifact-graph 0.4.0 → 0.5.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
 
@@ -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;
@@ -836,6 +857,11 @@ interface ArtifactSchema {
836
857
  start: number;
837
858
  end: number;
838
859
  }>>;
860
+ /** Context resolution overrides */
861
+ context?: {
862
+ /** When false, skip universal baseline injection. Default: true. */
863
+ universal_baseline?: boolean;
864
+ };
839
865
  }
840
866
  declare const TARGET_ARTIFACT_TYPES: readonly ["feature", "scenario", "decision", "design", "e2e_test"];
841
867
  type TargetArtifactType = typeof TARGET_ARTIFACT_TYPES[number];
@@ -862,6 +888,8 @@ interface ArtifactGraph {
862
888
  nodes: ArtifactNode[];
863
889
  edges: ArtifactEdge[];
864
890
  generatedAt: string;
891
+ /** Normalized absolute project root passed to scanArtifacts. Optional for backward compatibility. */
892
+ root?: string;
865
893
  /** Scan-time diagnostics. Optional for backward compatibility with consumers that build graph literals without this field. */
866
894
  diagnostics?: ValidationIssue[];
867
895
  }
@@ -881,7 +909,7 @@ interface ContextItem {
881
909
  interface MissingDetail {
882
910
  ref: string;
883
911
  from: string;
884
- kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets';
912
+ kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets' | 'missing-baseline';
885
913
  message: string;
886
914
  suggestedAction: string;
887
915
  }
@@ -899,6 +927,8 @@ interface ContextManifest {
899
927
  missing: string[];
900
928
  missingDetails?: MissingDetail[];
901
929
  omitted?: ContextItem[];
930
+ /** Explicit universal baseline policy: true=enabled, false=disabled. Used by validatePacket to prevent inferring opt-out from total=0. */
931
+ baselinePolicy?: boolean;
902
932
  }
903
933
  type ContextMode = 'full' | 'implementation';
904
934
  interface ContextOptions {
@@ -911,10 +941,18 @@ interface ContextOptions {
911
941
  target?: ArtifactTarget;
912
942
  mode?: ContextMode;
913
943
  maxPerCategory?: number;
944
+ /**
945
+ * When true (default), inject all ALWAYS_PRESENT_ITEMS as required baseline
946
+ * and report missing ones in manifest.missing. When false, skip baseline
947
+ * injection entirely for lightweight projects.
948
+ */
949
+ universalBaseline?: boolean;
950
+ /** Project root for baseline file existence checks. Required when universalBaseline is true. */
951
+ root?: string;
914
952
  }
915
953
  declare const DEFAULT_SCHEMA: ArtifactSchema;
916
954
  declare function loadConfig(root: string): Promise<ArtifactSchema>;
917
- declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[]): ArtifactGraph;
955
+ declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[], root?: string): ArtifactGraph;
918
956
  declare function scanArtifacts(root: string, schema?: ArtifactSchema): Promise<ArtifactGraph>;
919
957
  /**
920
958
  * Resolve traceability-matrix-v2 edges:
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
 
@@ -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;
@@ -836,6 +857,11 @@ interface ArtifactSchema {
836
857
  start: number;
837
858
  end: number;
838
859
  }>>;
860
+ /** Context resolution overrides */
861
+ context?: {
862
+ /** When false, skip universal baseline injection. Default: true. */
863
+ universal_baseline?: boolean;
864
+ };
839
865
  }
840
866
  declare const TARGET_ARTIFACT_TYPES: readonly ["feature", "scenario", "decision", "design", "e2e_test"];
841
867
  type TargetArtifactType = typeof TARGET_ARTIFACT_TYPES[number];
@@ -862,6 +888,8 @@ interface ArtifactGraph {
862
888
  nodes: ArtifactNode[];
863
889
  edges: ArtifactEdge[];
864
890
  generatedAt: string;
891
+ /** Normalized absolute project root passed to scanArtifacts. Optional for backward compatibility. */
892
+ root?: string;
865
893
  /** Scan-time diagnostics. Optional for backward compatibility with consumers that build graph literals without this field. */
866
894
  diagnostics?: ValidationIssue[];
867
895
  }
@@ -881,7 +909,7 @@ interface ContextItem {
881
909
  interface MissingDetail {
882
910
  ref: string;
883
911
  from: string;
884
- kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets';
912
+ kind: 'unresolved-outgoing' | 'unresolved-incoming' | 'target-not-found' | 'multiple-targets' | 'missing-baseline';
885
913
  message: string;
886
914
  suggestedAction: string;
887
915
  }
@@ -899,6 +927,8 @@ interface ContextManifest {
899
927
  missing: string[];
900
928
  missingDetails?: MissingDetail[];
901
929
  omitted?: ContextItem[];
930
+ /** Explicit universal baseline policy: true=enabled, false=disabled. Used by validatePacket to prevent inferring opt-out from total=0. */
931
+ baselinePolicy?: boolean;
902
932
  }
903
933
  type ContextMode = 'full' | 'implementation';
904
934
  interface ContextOptions {
@@ -911,10 +941,18 @@ interface ContextOptions {
911
941
  target?: ArtifactTarget;
912
942
  mode?: ContextMode;
913
943
  maxPerCategory?: number;
944
+ /**
945
+ * When true (default), inject all ALWAYS_PRESENT_ITEMS as required baseline
946
+ * and report missing ones in manifest.missing. When false, skip baseline
947
+ * injection entirely for lightweight projects.
948
+ */
949
+ universalBaseline?: boolean;
950
+ /** Project root for baseline file existence checks. Required when universalBaseline is true. */
951
+ root?: string;
914
952
  }
915
953
  declare const DEFAULT_SCHEMA: ArtifactSchema;
916
954
  declare function loadConfig(root: string): Promise<ArtifactSchema>;
917
- declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[]): ArtifactGraph;
955
+ declare function buildGraph(nodes: Omit<ArtifactNode, 'uid'>[], edges: ArtifactEdge[], diagnostics?: ValidationIssue[], root?: string): ArtifactGraph;
918
956
  declare function scanArtifacts(root: string, schema?: ArtifactSchema): Promise<ArtifactGraph>;
919
957
  /**
920
958
  * Resolve traceability-matrix-v2 edges: