@mitre/hdf-diff 3.7.2-rc.2 → 3.8.0-next.42532249979.1

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/README.md CHANGED
@@ -17,7 +17,7 @@ Additional capabilities:
17
17
  - Multiple comparison modes: temporal, baseline, fleet, multi-source
18
18
  - Format normalization: InSpec exec-json (legacy HDF v1) to current HDF
19
19
  - Output formats: JSON, Markdown, CSV, terminal (ANSI-colored)
20
- - CI exit codes: GNU diff-compatible (0/1/2) and detailed (10-14)
20
+ - CI exit codes: GNU diff-compatible (0 identical, 1 differences) and detailed (10-14)
21
21
 
22
22
  ## Relationship to other packages
23
23
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/sbom.d.ts
2
1
  /**
3
2
  * SBOM comparison for the HDF diff engine.
4
3
  *
@@ -40,8 +39,6 @@ interface SbomDiffResult {
40
39
  * @throws Error if either input is not valid JSON or not a recognized SBOM format
41
40
  */
42
41
  export declare function diffSboms(oldJson: string, newJson: string): SbomDiffResult;
43
- //#endregion
44
- //#region src/types.d.ts
45
42
  /**
46
43
  * Why a requirement's effective status changed between two evaluations.
47
44
  *
@@ -249,8 +246,10 @@ interface HDFComparison {
249
246
  drift?: RequirementDiff[];
250
247
  /** Annotations keyed by requirement ID */
251
248
  annotations?: Record<string, Annotation>;
252
- /** Extension data for custom integrations */
253
- extensions?: Record<string, unknown>;
249
+ /** Extension data for custom integrations. Closed: unmodeled data goes in `passthrough`. */
250
+ extensions?: {
251
+ passthrough?: Record<string, unknown>;
252
+ };
254
253
  }
255
254
  /**
256
255
  * Configuration for how requirements are matched between evaluations.
@@ -269,8 +268,6 @@ type DiffSummary = ComparisonSummary;
269
268
  type HdfComparison = HDFComparison;
270
269
  /** @deprecated Use HDFComparison instead */
271
270
  type HdfDiff = HDFComparison;
272
- //#endregion
273
- //#region src/diff.d.ts
274
271
  /**
275
272
  * Options for configuring the diff behavior.
276
273
  */
@@ -318,8 +315,6 @@ export declare function diffBaselines(oldBaseline: Record<string, unknown>, newB
318
315
  * SBOMs are also compared.
319
316
  */
320
317
  export declare function diffSystems(oldSystem: Record<string, unknown>, newSystem: Record<string, unknown>, options?: DiffOptions): HDFComparison;
321
- //#endregion
322
- //#region src/status.d.ts
323
318
  /**
324
319
  * Determine the effective status of a requirement from its results and
325
320
  * overrides, delegating to the canonical shared implementation in
@@ -347,8 +342,6 @@ export declare function classifyChangeReasons(oldReq: Record<string, unknown>, n
347
342
  * - Otherwise → 'updated'
348
343
  */
349
344
  export declare function classifyDiffStatus(oldEffectiveStatus: string, newEffectiveStatus: string): RequirementState;
350
- //#endregion
351
- //#region src/effective-checksum.d.ts
352
345
  interface EffectiveChecksum {
353
346
  algorithm: 'sha256';
354
347
  value: string;
@@ -384,8 +377,6 @@ export declare function computeDisposition(requirement: Record<string, unknown>,
384
377
  * timestamp.
385
378
  */
386
379
  export declare function computeEffectiveChecksum(requirement: Record<string, unknown>, referenceTimestamp?: string): Promise<EffectiveChecksum>;
387
- //#endregion
388
- //#region src/change-event.d.ts
389
380
  /**
390
381
  * The reconciler's per-key last-value state (ADR-0005 §1): the minimal
391
382
  * posture a producer compares against to decide whether a requirement moved.
@@ -435,8 +426,6 @@ interface EventInputs {
435
426
  * (ChangeEventFromPrevious) is pinned by shared test vectors.
436
427
  */
437
428
  export declare function changeEventFromPrevious(prev: KeyState | null, newReq: Record<string, unknown> | null, prevReq: Record<string, unknown> | null, inputs: EventInputs): Promise<Record<string, unknown> | null>;
438
- //#endregion
439
- //#region src/apply-events.d.ts
440
429
  /**
441
430
  * Caller-supplied identity for a reassembly run. Everything else in the
442
431
  * derivation block is computed from the seed text and the event batch — no
@@ -481,8 +470,6 @@ type Doc$1 = Record<string, unknown>;
481
470
  * ApplyChangeEvents.
482
471
  */
483
472
  export declare function applyChangeEvents(seedJson: string, events: Doc$1[], inputs: ApplyInputs): Promise<ApplyResult>;
484
- //#endregion
485
- //#region src/fold-events.d.ts
486
473
  type Doc = Record<string, unknown>;
487
474
  interface FoldResult {
488
475
  comparison: Record<string, unknown>;
@@ -501,14 +488,10 @@ interface FoldResult {
501
488
  * has none) — never wall clock. Go parity: FoldChangeEventsIntoComparison.
502
489
  */
503
490
  export declare function foldChangeEventsIntoComparison(seedJson: string, events: Doc[]): Promise<FoldResult>;
504
- //#endregion
505
- //#region src/summary.d.ts
506
491
  /**
507
492
  * Compute summary counts from an array of RequirementDiff entries.
508
493
  */
509
494
  export declare function computeSummary(requirements: RequirementDiff[]): ComparisonSummary;
510
- //#endregion
511
- //#region src/normalize.d.ts
512
495
  /**
513
496
  * Normalize InSpec exec-json v1 format to HDF v2 structure for diffing.
514
497
  *
@@ -528,8 +511,6 @@ export declare function isV1Format(doc: Record<string, unknown>): boolean;
528
511
  * If v1, converts profiles→baselines, controls→requirements, and snake_case→camelCase.
529
512
  */
530
513
  export declare function normalizeToV2(doc: Record<string, unknown>): Record<string, unknown>;
531
- //#endregion
532
- //#region src/matching/types.d.ts
533
514
  /**
534
515
  * Result of matching requirements between two evaluations.
535
516
  */
@@ -565,8 +546,6 @@ interface MatchStrategy {
565
546
  /** Match old requirements against new requirements */
566
547
  match(oldReqs: Record<string, unknown>[], newReqs: Record<string, unknown>[]): MatchResult;
567
548
  }
568
- //#endregion
569
- //#region src/matching/exact-id.d.ts
570
549
  /**
571
550
  * Create an exact ID matching strategy.
572
551
  *
@@ -574,8 +553,6 @@ interface MatchStrategy {
574
553
  * Confidence is always 1.0 for matches.
575
554
  */
576
555
  export declare function createExactIdStrategy(): MatchStrategy;
577
- //#endregion
578
- //#region src/matching/mapped-id.d.ts
579
556
  /**
580
557
  * Create a mapped ID matching strategy.
581
558
  *
@@ -587,8 +564,6 @@ export declare function createExactIdStrategy(): MatchStrategy;
587
564
  * because the match depends on the accuracy of the mapping table).
588
565
  */
589
566
  export declare function createMappedIdStrategy(mapping: Record<string, string>): MatchStrategy;
590
- //#endregion
591
- //#region src/matching/cci-match.d.ts
592
567
  /**
593
568
  * Create a CCI-based matching strategy.
594
569
  *
@@ -605,8 +580,6 @@ export declare function createMappedIdStrategy(mapping: Record<string, string>):
605
580
  * Confidence is 0.8 for CCI matches and 0.6 for CWE-fallback matches.
606
581
  */
607
582
  export declare function createCciMatchStrategy(): MatchStrategy;
608
- //#endregion
609
- //#region src/matching/fuzzy-match.d.ts
610
583
  /**
611
584
  * Tokenize a title string into a set of meaningful tokens.
612
585
  *
@@ -631,8 +604,6 @@ export declare function jaccardSimilarity(a: Set<string>, b: Set<string>): numbe
631
604
  * @param minConfidence Minimum Jaccard similarity to accept a match (default: 0.6)
632
605
  */
633
606
  export declare function createFuzzyTitleStrategy(minConfidence?: number): MatchStrategy;
634
- //#endregion
635
- //#region src/matching/srg-deterministic.d.ts
636
607
  /**
637
608
  * Create a deterministic SRG matching strategy (Tier 1 of the delta pipeline).
638
609
  *
@@ -647,8 +618,6 @@ export declare function createFuzzyTitleStrategy(minConfidence?: number): MatchS
647
618
  * Requirements without a gtitle pass through as unmatched.
648
619
  */
649
620
  export declare function createSrgDeterministicStrategy(): MatchStrategy;
650
- //#endregion
651
- //#region src/matching/srg-cci-tiebreak.d.ts
652
621
  /**
653
622
  * Create an SRG CCI Tiebreak matching strategy (Tier 2 of the delta pipeline).
654
623
  *
@@ -660,8 +629,6 @@ export declare function createSrgDeterministicStrategy(): MatchStrategy;
660
629
  * 1:1 matches are left for srgDeterministic (Tier 1).
661
630
  */
662
631
  export declare function createSrgCciTiebreakStrategy(): MatchStrategy;
663
- //#endregion
664
- //#region src/matching/vendor-fuzzy-title.d.ts
665
632
  /**
666
633
  * Compute the Levenshtein edit distance between two strings.
667
634
  */
@@ -683,8 +650,6 @@ export declare function normalizedLevenshtein(a: string, b: string): number;
683
650
  * @param acceptThreshold Max normalized Levenshtein distance to accept (default: 0.45)
684
651
  */
685
652
  export declare function createVendorFuzzyTitleStrategy(acceptThreshold?: number): MatchStrategy;
686
- //#endregion
687
- //#region src/matching/index.d.ts
688
653
  /**
689
654
  * Options for configuring requirement matching.
690
655
  */
@@ -714,8 +679,6 @@ interface MatchOptions {
714
679
  * @returns Combined match result from all strategies
715
680
  */
716
681
  export declare function matchRequirements(oldReqs: Record<string, unknown>[], newReqs: Record<string, unknown>[], options?: MatchOptions): MatchResult;
717
- //#endregion
718
- //#region src/validate.d.ts
719
682
  /**
720
683
  * Result of validating a document against the hdf-comparison schema.
721
684
  */
@@ -735,11 +698,14 @@ interface ValidationResult {
735
698
  * @returns Validation result with `valid` boolean and optional `errors` array
736
699
  */
737
700
  export declare function validateComparison(doc: unknown): ValidationResult;
738
- //#endregion
739
- //#region src/exit-codes.d.ts
740
701
  /** GNU diff compatible exit codes (--exit-code mode) */
741
702
  export declare const EXIT_IDENTICAL = 0;
742
703
  export declare const EXIT_DIFFERENCES = 1;
704
+ /**
705
+ * GNU diff's trouble code. The hdf CLI does not return it: a diff that fails to
706
+ * run exits 1 like any failed operation, and 2 there means a usage error. Kept
707
+ * for a caller that wants GNU's convention instead.
708
+ */
743
709
  export declare const EXIT_ERROR = 2;
744
710
  /** Detailed exit codes (--detailed-exitcode mode) */
745
711
  export declare const EXIT_DETAILED_IDENTICAL = 0;
@@ -756,8 +722,8 @@ export declare const EXIT_DETAILED_DRIFT_ONLY = 14;
756
722
  * 0 = identical (no differences found)
757
723
  * 1 = differences found (any kind)
758
724
  *
759
- * Note: error (exit code 2) is not computed from the summary — callers
760
- * should return EXIT_ERROR directly when I/O or parse errors occur.
725
+ * Never EXIT_ERROR: a summary cannot describe a run that failed to produce one.
726
+ * A caller that follows the hdf CLI returns 1 for such a failure, not EXIT_ERROR.
761
727
  */
762
728
  export declare function computeExitCode(summary: ComparisonSummary): number;
763
729
  /**
@@ -771,14 +737,12 @@ export declare function computeExitCode(summary: ComparisonSummary): number;
771
737
  * 13 = differences found, only new/absent controls (baseline changed)
772
738
  * 14 = differences found, only metadata drift (no status changes)
773
739
  *
774
- * Note: error (exit code 1) is not computed from the summary — callers
775
- * should return EXIT_DETAILED_ERROR directly when I/O or parse errors occur.
740
+ * Never EXIT_DETAILED_ERROR: callers return that themselves when a diff fails
741
+ * to run, which matches the hdf CLI's 1 for a failed operation.
776
742
  *
777
743
  * Priority order: mixed(12) > regressions(11) > fixes(10) > baseline(13) > drift(14)
778
744
  */
779
745
  export declare function computeDetailedExitCode(summary: ComparisonSummary): number;
780
- //#endregion
781
- //#region src/renderers/types.d.ts
782
746
  type DetailLevel = 'summary' | 'control' | 'full';
783
747
  interface RenderOptions {
784
748
  /** What detail to show. Default: 'control' */
@@ -790,8 +754,6 @@ interface RenderOptions {
790
754
  /** Use color codes (for terminal). Default: true */
791
755
  color?: boolean;
792
756
  }
793
- //#endregion
794
- //#region src/renderers/json.d.ts
795
757
  /**
796
758
  * Render an HDFComparison as a JSON string.
797
759
  *
@@ -802,8 +764,6 @@ interface RenderOptions {
802
764
  * Default detail level: `'control'`.
803
765
  */
804
766
  export declare function renderJson(comparison: HDFComparison, options?: RenderOptions): string;
805
- //#endregion
806
- //#region src/renderers/markdown.d.ts
807
767
  /**
808
768
  * Render an HDFComparison as a Markdown string.
809
769
  *
@@ -814,8 +774,6 @@ export declare function renderJson(comparison: HDFComparison, options?: RenderOp
814
774
  * Default detail level: `'control'`.
815
775
  */
816
776
  export declare function renderMarkdown(comparison: HDFComparison, options?: RenderOptions): string;
817
- //#endregion
818
- //#region src/renderers/terminal.d.ts
819
777
  /**
820
778
  * Render an HDFComparison for terminal display with optional ANSI colors.
821
779
  *
@@ -827,8 +785,6 @@ export declare function renderMarkdown(comparison: HDFComparison, options?: Rend
827
785
  * Default detail level: `'control'`. Default color: `true`.
828
786
  */
829
787
  export declare function renderTerminal(comparison: HDFComparison, options?: RenderOptions): string;
830
- //#endregion
831
- //#region src/renderers/csv.d.ts
832
788
  /**
833
789
  * Render an HDFComparison as a CSV string.
834
790
  *
@@ -841,8 +797,6 @@ export declare function renderTerminal(comparison: HDFComparison, options?: Rend
841
797
  * Default detail level: `'control'`.
842
798
  */
843
799
  export declare function renderCsv(comparison: HDFComparison, options?: RenderOptions): string;
844
- //#endregion
845
- //#region src/renderers/index.d.ts
846
800
  /**
847
801
  * Convenience function to render a comparison in any supported format.
848
802
  *
@@ -852,6 +806,5 @@ export declare function renderCsv(comparison: HDFComparison, options?: RenderOpt
852
806
  * @returns The rendered string
853
807
  */
854
808
  export declare function render(comparison: HDFComparison, format: 'json' | 'markdown' | 'terminal' | 'csv', options?: RenderOptions): string;
855
- //#endregion
856
809
  export type { Annotation, ApplyInputs, ApplyResult, ApplyWarning, BaselineDiff, ChangeReason, ComparisonSummary, ComponentDiff, DetailLevel, DiffOptions, DiffStatus, DiffSummary, EffectiveChecksum, EventInputs, FieldChange, FoldResult, HDFComparison, HdfComparison, HdfDiff, KeyState, MatchOptions, MatchPair, MatchResult, MatchStrategy, MatchingConfig, PackageDiff, RenderOptions, RequirementDiff, RequirementState, SbomDiffResult, Source, ValidationResult };
857
810
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/sbom.ts","../src/types.ts","../src/diff.ts","../src/status.ts","../src/effective-checksum.ts","../src/change-event.ts","../src/apply-events.ts","../src/fold-events.ts","../src/summary.ts","../src/normalize.ts","../src/matching/types.ts","../src/matching/exact-id.ts","../src/matching/mapped-id.ts","../src/matching/cci-match.ts","../src/matching/fuzzy-match.ts","../src/matching/srg-deterministic.ts","../src/matching/srg-cci-tiebreak.ts","../src/matching/vendor-fuzzy-title.ts","../src/matching/index.ts","../src/validate.ts","../src/exit-codes.ts","../src/renderers/types.ts","../src/renderers/json.ts","../src/renderers/markdown.ts","../src/renderers/terminal.ts","../src/renderers/csv.ts","../src/renderers/index.ts"],"mappings":";;;;;;;;;;;;;;UAciB;EACf;EACA;EACA;EACA;EACA;EACA;;;;;UAMe;EACf,cAAc;EACd;EACA;EACA;EACA;;;;;;;;;;;wBAsBc,UAAU,iBAAiB,kBAAkB;;;;;;;;;;;;;;;;;;;;KCpCjD;;;;;;;;;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;;;UCpHzD;;EAEf;;EAEA;;EAEA,eAAe;;EAEf;;;;;;;;;;;;;;;;;wBAoDc,kBACd,SAAS,2BACT,SAAS,2BACT,UAAU,eACT;;;;;;UChFc;;EAEf;;EAEA;;;;;;;;;;;wBAYc,mBAAmB,eAAe;;;;qBCnBrC;qBACA;qBACA;;qBAGA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;;;;;;;;;;;wBAYG,gBAAgB,SAAS;;;;;;;;;;;;;;;;;wBAuBzB,wBAAwB,SAAS;;;KCjDrC;UAEK;;EAEf,SAAS;;EAET;;EAEA;;EAEA;;;;;;;;;;;;;wBCec,WACd,YAAY,eACZ,UAAU;;;;;;;;;;;;wBCmGI,eACd,YAAY,eACZ,UAAU;;;;;;;;;;;;;wBCmDI,eACd,YAAY,eACZ,UAAU;;;;;;;;;;;;;;wBC1II,UACd,YAAY,eACZ,UAAU;;;;;;;;;;;wBCxBI,OACd,YAAY,eACZ,kDACA,UAAU"}
1
+ {"version":3,"file":"index.d.ts","names":["_$__sbom_js0.PackageDiff","Doc"],"sources":["../src/sbom.ts","../src/types.ts","../src/diff.ts","../src/status.ts","../src/effective-checksum.ts","../src/change-event.ts","../src/apply-events.ts","../src/fold-events.ts","../src/summary.ts","../src/normalize.ts","../src/matching/types.ts","../src/matching/exact-id.ts","../src/matching/mapped-id.ts","../src/matching/cci-match.ts","../src/matching/fuzzy-match.ts","../src/matching/srg-deterministic.ts","../src/matching/srg-cci-tiebreak.ts","../src/matching/vendor-fuzzy-title.ts","../src/matching/index.ts","../src/validate.ts","../src/exit-codes.ts","../src/renderers/types.ts","../src/renderers/json.ts","../src/renderers/markdown.ts","../src/renderers/terminal.ts","../src/renderers/csv.ts","../src/renderers/index.ts"],"mappings":";;;;;;;;;;;;;UAciB;EACf;EACA;EACA;EACA;EACA;EACA;;;;;UAMe;EACf,cAAc;EACd;EACA;EACA;EACA;;;;;;;;;;;wBAsBc,UAAU,iBAAiB,kBAAkB;;;;;;;;;;;;;;;;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D;;EAEf;;EAEA;;EAEA,eAAe;;EAEf;;;;;;;;;;;;;;;;;wBAoDc,kBACd,SAAS,2BACT,SAAS,2BACT,UAAU,eACT;;;;UChFc;;EAEf;;EAEA;;;;;;;;;;;wBAYc,mBAAmB,eAAe;;qBCZrC;qBACA;;;;;;qBAMA;;qBAGA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;;;;;;;;;;;wBAYG,gBAAgB,SAAS;;;;;;;;;;;;;;;;;wBAuBzB,wBAAwB,SAAS;KC7DrC;UAEK;;EAEf,SAAS;;EAET;;EAEA;;EAEA;;;;;;;;;;;wBCec,WACd,YAAY,eACZ,UAAU;;;;;;;;;;wBCmGI,eACd,YAAY,eACZ,UAAU;;;;;;;;;;;wBCmDI,eACd,YAAY,eACZ,UAAU;;;;;;;;;;;;wBC1II,UACd,YAAY,eACZ,UAAU;;;;;;;;;wBCxBI,OACd,YAAY,eACZ,kDACA,UAAU"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { computeEffectiveStatus as computeEffectiveStatus$1, formatTimestamp, governingOverrideIndex, parseCvssVector, parseTimestamp, sha256 } from "@mitre/hdf-utilities";
2
2
  import { validateComparison as validateComparison$1 } from "@mitre/hdf-validators";
3
- //#region src/status.ts
3
+ // src/status.ts
4
4
  /** Statuses that count as "passing" for fixed/regressed classification */
5
5
  const PASSING_STATUSES = /* @__PURE__ */ new Set(["passed"]);
6
6
  /** Statuses that count as "failing" for fixed/regressed classification */
@@ -90,8 +90,7 @@ function classifyDiffStatus(oldEffectiveStatus, newEffectiveStatus) {
90
90
  if (oldIsPassing && newIsFailing) return "regressed";
91
91
  return "updated";
92
92
  }
93
- //#endregion
94
- //#region src/summary.ts
93
+ // src/summary.ts
95
94
  /**
96
95
  * Compute summary counts from an array of RequirementDiff entries.
97
96
  */
@@ -135,8 +134,7 @@ function computeSummary(requirements) {
135
134
  }
136
135
  return summary;
137
136
  }
138
- //#endregion
139
- //#region src/normalize.ts
137
+ // src/normalize.ts
140
138
  /**
141
139
  * Normalize InSpec exec-json v1 format to HDF v2 structure for diffing.
142
140
  *
@@ -239,8 +237,7 @@ function normalizeResult(result) {
239
237
  if (result.message !== void 0) normalized["message"] = result.message;
240
238
  return normalized;
241
239
  }
242
- //#endregion
243
- //#region src/matching/exact-id.ts
240
+ // src/matching/exact-id.ts
244
241
  /**
245
242
  * Create an exact ID matching strategy.
246
243
  *
@@ -306,8 +303,7 @@ function createExactIdStrategy() {
306
303
  }
307
304
  };
308
305
  }
309
- //#endregion
310
- //#region src/matching/mapped-id.ts
306
+ // src/matching/mapped-id.ts
311
307
  /**
312
308
  * Create a mapped ID matching strategy.
313
309
  *
@@ -386,8 +382,7 @@ function createMappedIdStrategy(mapping) {
386
382
  }
387
383
  };
388
384
  }
389
- //#endregion
390
- //#region src/matching/cci-match.ts
385
+ // src/matching/cci-match.ts
391
386
  /**
392
387
  * Extract CCI identifiers from a requirement's tags.
393
388
  * Looks for `tags.cci` as an array of strings.
@@ -508,8 +503,7 @@ function createCciMatchStrategy() {
508
503
  }
509
504
  };
510
505
  }
511
- //#endregion
512
- //#region src/matching/fuzzy-match.ts
506
+ // src/matching/fuzzy-match.ts
513
507
  /** Common English stop words to exclude from tokenization */
514
508
  const STOP_WORDS = /* @__PURE__ */ new Set([
515
509
  "a",
@@ -693,8 +687,7 @@ function createFuzzyTitleStrategy(minConfidence) {
693
687
  }
694
688
  };
695
689
  }
696
- //#endregion
697
- //#region src/matching/srg-deterministic.ts
690
+ // src/matching/srg-deterministic.ts
698
691
  /**
699
692
  * Extract the SRG-OS ID from a requirement's tags.gtitle field.
700
693
  * Returns null if missing or not a string.
@@ -786,8 +779,7 @@ function createSrgDeterministicStrategy() {
786
779
  }
787
780
  };
788
781
  }
789
- //#endregion
790
- //#region src/matching/srg-cci-tiebreak.ts
782
+ // src/matching/srg-cci-tiebreak.ts
791
783
  /** Composite score weights matching SAF CLI's Tier 2. */
792
784
  const CCI_WEIGHT = .7;
793
785
  const TITLE_WEIGHT = .3;
@@ -956,8 +948,7 @@ function createSrgCciTiebreakStrategy() {
956
948
  }
957
949
  };
958
950
  }
959
- //#endregion
960
- //#region src/matching/vendor-fuzzy-title.ts
951
+ // src/matching/vendor-fuzzy-title.ts
961
952
  /** Default threshold for accepting a Levenshtein match. */
962
953
  const DEFAULT_ACCEPT_THRESHOLD = .45;
963
954
  const MAX_LEVENSHTEIN_LENGTH = 4096;
@@ -1126,8 +1117,7 @@ function createVendorFuzzyTitleStrategy(acceptThreshold) {
1126
1117
  }
1127
1118
  };
1128
1119
  }
1129
- //#endregion
1130
- //#region src/matching/index.ts
1120
+ // src/matching/index.ts
1131
1121
  /**
1132
1122
  * Create a strategy instance by name, using the provided options for
1133
1123
  * strategies that require configuration.
@@ -1178,8 +1168,7 @@ function matchRequirements(oldReqs, newReqs, options) {
1178
1168
  unmatchedNew: currentUnmatchedNew
1179
1169
  };
1180
1170
  }
1181
- //#endregion
1182
- //#region src/validate.ts
1171
+ // src/validate.ts
1183
1172
  /**
1184
1173
  * Validate a document against the hdf-comparison schema.
1185
1174
  *
@@ -1197,8 +1186,7 @@ function validateComparison(doc) {
1197
1186
  errors: result.errors.map((e) => e.field === "(root)" ? e.message : `${e.field}: ${e.message}`)
1198
1187
  };
1199
1188
  }
1200
- //#endregion
1201
- //#region src/diff.ts
1189
+ // src/diff.ts
1202
1190
  const DEFAULT_TRACKED_FIELDS = [
1203
1191
  "impact",
1204
1192
  "severity",
@@ -2124,7 +2112,7 @@ function diffSystems(oldSystem, newSystem, options) {
2124
2112
  if (systemFieldChanges.length > 0) extensions["systemFieldChanges"] = systemFieldChanges;
2125
2113
  const dataFlowChanges = diffDataFlows(oldSystem, newSystem);
2126
2114
  if (dataFlowChanges.length > 0) extensions["dataFlowChanges"] = dataFlowChanges;
2127
- if (Object.keys(extensions).length > 0) comparison.extensions = extensions;
2115
+ if (Object.keys(extensions).length > 0) comparison.extensions = { passthrough: extensions };
2128
2116
  if (options?.validateOutput) {
2129
2117
  const result = validateComparison(comparison);
2130
2118
  /* c8 ignore start */
@@ -2264,8 +2252,7 @@ function computeComponentFieldChanges(oldObj, newObj, trackedFields) {
2264
2252
  }
2265
2253
  return changes;
2266
2254
  }
2267
- //#endregion
2268
- //#region src/effective-checksum.ts
2255
+ // src/effective-checksum.ts
2269
2256
  /** Maps overrides onto the shared neutral selection shape (applied/expiry
2270
2257
  * window only; eligibility is passed separately). */
2271
2258
  function overrideWindows(overrides) {
@@ -2337,8 +2324,7 @@ async function computeEffectiveChecksum(requirement, referenceTimestamp) {
2337
2324
  value: await sha256(canonical)
2338
2325
  };
2339
2326
  }
2340
- //#endregion
2341
- //#region src/change-event.ts
2327
+ // src/change-event.ts
2342
2328
  /** Batch ChangeReason → event-vocabulary mapping; unmapped reasons are batch-only. */
2343
2329
  const EVENT_REASON_FOR = {
2344
2330
  resultChanged: "resultChanged",
@@ -2423,8 +2409,7 @@ async function changeEventFromPrevious(prev, newReq, prevReq, inputs) {
2423
2409
  after: newReq
2424
2410
  };
2425
2411
  }
2426
- //#endregion
2427
- //#region src/event-stream-common.ts
2412
+ // src/event-stream-common.ts
2428
2413
  /** Extract the priorChecksum hex from an event ('' when null/absent). */
2429
2414
  function eventPriorValue(ev) {
2430
2415
  return ev["priorChecksum"]?.value ?? "";
@@ -2497,8 +2482,7 @@ async function verifyEventChain(chain, seedReq, inSeed, keyWarn) {
2497
2482
  expected = await requirementChecksum(ev["after"], ev["timestamp"]);
2498
2483
  }
2499
2484
  }
2500
- //#endregion
2501
- //#region src/apply-events.ts
2485
+ // src/apply-events.ts
2502
2486
  function findRequirement(doc, id) {
2503
2487
  const baselines = doc["baselines"] ?? [];
2504
2488
  for (const baseline of baselines) {
@@ -2628,8 +2612,7 @@ async function applyChangeEvents(seedJson, events, inputs) {
2628
2612
  warnings
2629
2613
  };
2630
2614
  }
2631
- //#endregion
2632
- //#region src/fold-events.ts
2615
+ // src/fold-events.ts
2633
2616
  function findSeedRequirement(doc, id) {
2634
2617
  const baselines = doc["baselines"] ?? [];
2635
2618
  for (const baseline of baselines) {
@@ -2762,11 +2745,15 @@ async function foldChangeEventsIntoComparison(seedJson, events) {
2762
2745
  warnings
2763
2746
  };
2764
2747
  }
2765
- //#endregion
2766
- //#region src/exit-codes.ts
2748
+ // src/exit-codes.ts
2767
2749
  /** GNU diff compatible exit codes (--exit-code mode) */
2768
2750
  const EXIT_IDENTICAL = 0;
2769
2751
  const EXIT_DIFFERENCES = 1;
2752
+ /**
2753
+ * GNU diff's trouble code. The hdf CLI does not return it: a diff that fails to
2754
+ * run exits 1 like any failed operation, and 2 there means a usage error. Kept
2755
+ * for a caller that wants GNU's convention instead.
2756
+ */
2770
2757
  const EXIT_ERROR = 2;
2771
2758
  /** Detailed exit codes (--detailed-exitcode mode) */
2772
2759
  const EXIT_DETAILED_IDENTICAL = 0;
@@ -2783,8 +2770,8 @@ const EXIT_DETAILED_DRIFT_ONLY = 14;
2783
2770
  * 0 = identical (no differences found)
2784
2771
  * 1 = differences found (any kind)
2785
2772
  *
2786
- * Note: error (exit code 2) is not computed from the summary — callers
2787
- * should return EXIT_ERROR directly when I/O or parse errors occur.
2773
+ * Never EXIT_ERROR: a summary cannot describe a run that failed to produce one.
2774
+ * A caller that follows the hdf CLI returns 1 for such a failure, not EXIT_ERROR.
2788
2775
  */
2789
2776
  function computeExitCode(summary) {
2790
2777
  if (hasDifferences(summary)) return 1;
@@ -2801,8 +2788,8 @@ function computeExitCode(summary) {
2801
2788
  * 13 = differences found, only new/absent controls (baseline changed)
2802
2789
  * 14 = differences found, only metadata drift (no status changes)
2803
2790
  *
2804
- * Note: error (exit code 1) is not computed from the summary — callers
2805
- * should return EXIT_DETAILED_ERROR directly when I/O or parse errors occur.
2791
+ * Never EXIT_DETAILED_ERROR: callers return that themselves when a diff fails
2792
+ * to run, which matches the hdf CLI's 1 for a failed operation.
2806
2793
  *
2807
2794
  * Priority order: mixed(12) > regressions(11) > fixes(10) > baseline(13) > drift(14)
2808
2795
  */
@@ -2820,8 +2807,7 @@ function computeDetailedExitCode(summary) {
2820
2807
  function hasDifferences(summary) {
2821
2808
  return summary.total !== summary.unchanged;
2822
2809
  }
2823
- //#endregion
2824
- //#region src/renderers/filter.ts
2810
+ // src/renderers/filter.ts
2825
2811
  /**
2826
2812
  * Filter requirement diffs based on render options.
2827
2813
  *
@@ -2846,8 +2832,7 @@ function filterRequirements(diffs, options) {
2846
2832
  }
2847
2833
  return filtered;
2848
2834
  }
2849
- //#endregion
2850
- //#region src/renderers/json.ts
2835
+ // src/renderers/json.ts
2851
2836
  /**
2852
2837
  * Strip `before` and `after` from a RequirementDiff, keeping only
2853
2838
  * the summary fields (id, state, title, statuses, changeReasons, fieldChanges).
@@ -2886,8 +2871,7 @@ function renderJson(comparison, options) {
2886
2871
  requirementDiffs: strippedDiffs
2887
2872
  }, null, 2);
2888
2873
  }
2889
- //#endregion
2890
- //#region src/renderers/markdown.ts
2874
+ // src/renderers/markdown.ts
2891
2875
  /**
2892
2876
  * Render the summary table in markdown format.
2893
2877
  */
@@ -3000,8 +2984,7 @@ function renderMarkdown(comparison, options) {
3000
2984
  }
3001
2985
  return parts.join("\n");
3002
2986
  }
3003
- //#endregion
3004
- //#region src/renderers/terminal.ts
2987
+ // src/renderers/terminal.ts
3005
2988
  const RESET = "\x1B[0m";
3006
2989
  const GREEN = "\x1B[32m";
3007
2990
  const RED = "\x1B[31m";
@@ -3135,8 +3118,7 @@ function renderTerminal(comparison, options) {
3135
3118
  lines.push(buildSummaryLine(comparison, useColor));
3136
3119
  return lines.join("\n");
3137
3120
  }
3138
- //#endregion
3139
- //#region src/renderers/csv.ts
3121
+ // src/renderers/csv.ts
3140
3122
  /**
3141
3123
  * Escape a value for CSV output.
3142
3124
  *
@@ -3201,8 +3183,7 @@ function renderCsv(comparison, options) {
3201
3183
  }
3202
3184
  return lines.join("\n");
3203
3185
  }
3204
- //#endregion
3205
- //#region src/renderers/index.ts
3186
+ // src/renderers/index.ts
3206
3187
  /**
3207
3188
  * Convenience function to render a comparison in any supported format.
3208
3189
  *
@@ -3219,8 +3200,7 @@ function render(comparison, format, options) {
3219
3200
  case "csv": return renderCsv(comparison, options);
3220
3201
  }
3221
3202
  }
3222
- //#endregion
3223
- //#region src/sbom.ts
3203
+ // src/sbom.ts
3224
3204
  /**
3225
3205
  * Compare two SBOM documents (CycloneDX or SPDX JSON strings) and return
3226
3206
  * package-level diffs.
@@ -3377,7 +3357,6 @@ function buildPackageMap(packages) {
3377
3357
  }
3378
3358
  return map;
3379
3359
  }
3380
- //#endregion
3381
3360
  export { EXIT_DETAILED_BASELINE_CHANGED, EXIT_DETAILED_DRIFT_ONLY, EXIT_DETAILED_ERROR, EXIT_DETAILED_FIXES_ONLY, EXIT_DETAILED_IDENTICAL, EXIT_DETAILED_MIXED, EXIT_DETAILED_REGRESSIONS_ONLY, EXIT_DIFFERENCES, EXIT_ERROR, EXIT_IDENTICAL, applyChangeEvents, changeEventFromPrevious, classifyChangeReasons, classifyDiffStatus, computeDetailedExitCode, computeDisposition, computeEffectiveChecksum, computeEffectiveImpact, computeEffectiveStatus, computeExitCode, computeSummary, createCciMatchStrategy, createExactIdStrategy, createFuzzyTitleStrategy, createMappedIdStrategy, createSrgCciTiebreakStrategy, createSrgDeterministicStrategy, createVendorFuzzyTitleStrategy, diffBaselines, diffHdf, diffSboms, diffSystems, foldChangeEventsIntoComparison, isV1Format, jaccardSimilarity, levenshteinDistance, matchRequirements, normalizeToV2, normalizedLevenshtein, render, renderCsv, renderJson, renderMarkdown, renderTerminal, tokenize, validateComparison };
3382
3361
 
3383
3362
  //# sourceMappingURL=index.js.map