@fern-api/generator-cli 0.9.40 → 0.9.42

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/cli.js CHANGED
@@ -41,9 +41,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
41
41
  mod
42
42
  ));
43
43
 
44
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
44
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/constants.js
45
45
  var require_constants = __commonJS({
46
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js"(exports2, module2) {
46
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/constants.js"(exports2, module2) {
47
47
  "use strict";
48
48
  var SEMVER_SPEC_VERSION = "2.0.0";
49
49
  var MAX_LENGTH = 256;
@@ -73,9 +73,9 @@ var require_constants = __commonJS({
73
73
  }
74
74
  });
75
75
 
76
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
76
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/debug.js
77
77
  var require_debug = __commonJS({
78
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js"(exports2, module2) {
78
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/debug.js"(exports2, module2) {
79
79
  "use strict";
80
80
  var debug2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
81
81
  };
@@ -83,9 +83,9 @@ var require_debug = __commonJS({
83
83
  }
84
84
  });
85
85
 
86
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js
86
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/re.js
87
87
  var require_re = __commonJS({
88
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js"(exports2, module2) {
88
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/re.js"(exports2, module2) {
89
89
  "use strict";
90
90
  var {
91
91
  MAX_SAFE_COMPONENT_LENGTH,
@@ -171,9 +171,9 @@ var require_re = __commonJS({
171
171
  }
172
172
  });
173
173
 
174
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js
174
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/parse-options.js
175
175
  var require_parse_options = __commonJS({
176
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js"(exports2, module2) {
176
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/parse-options.js"(exports2, module2) {
177
177
  "use strict";
178
178
  var looseOption = Object.freeze({ loose: true });
179
179
  var emptyOpts = Object.freeze({});
@@ -190,9 +190,9 @@ var require_parse_options = __commonJS({
190
190
  }
191
191
  });
192
192
 
193
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js
193
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/identifiers.js
194
194
  var require_identifiers = __commonJS({
195
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js"(exports2, module2) {
195
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/identifiers.js"(exports2, module2) {
196
196
  "use strict";
197
197
  var numeric2 = /^[0-9]+$/;
198
198
  var compareIdentifiers = (a, b3) => {
@@ -215,15 +215,27 @@ var require_identifiers = __commonJS({
215
215
  }
216
216
  });
217
217
 
218
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js
218
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/semver.js
219
219
  var require_semver = __commonJS({
220
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js"(exports2, module2) {
220
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/semver.js"(exports2, module2) {
221
221
  "use strict";
222
222
  var debug2 = require_debug();
223
223
  var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
224
224
  var { safeRe: re, t: t2 } = require_re();
225
225
  var parseOptions = require_parse_options();
226
226
  var { compareIdentifiers } = require_identifiers();
227
+ var isPrereleaseIdentifier = (prerelease, identifier) => {
228
+ const identifiers = identifier.split(".");
229
+ if (identifiers.length > prerelease.length) {
230
+ return false;
231
+ }
232
+ for (let i2 = 0; i2 < identifiers.length; i2++) {
233
+ if (compareIdentifiers(prerelease[i2], identifiers[i2]) !== 0) {
234
+ return false;
235
+ }
236
+ }
237
+ return true;
238
+ };
227
239
  var SemVer = class _SemVer {
228
240
  constructor(version2, options) {
229
241
  options = parseOptions(options);
@@ -470,8 +482,9 @@ var require_semver = __commonJS({
470
482
  if (identifierBase === false) {
471
483
  prerelease = [identifier];
472
484
  }
473
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
474
- if (isNaN(this.prerelease[1])) {
485
+ if (isPrereleaseIdentifier(this.prerelease, identifier)) {
486
+ const prereleaseBase = this.prerelease[identifier.split(".").length];
487
+ if (isNaN(prereleaseBase)) {
475
488
  this.prerelease = prerelease;
476
489
  }
477
490
  } else {
@@ -494,9 +507,9 @@ var require_semver = __commonJS({
494
507
  }
495
508
  });
496
509
 
497
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js
510
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/parse.js
498
511
  var require_parse = __commonJS({
499
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js"(exports2, module2) {
512
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/parse.js"(exports2, module2) {
500
513
  "use strict";
501
514
  var SemVer = require_semver();
502
515
  var parse3 = (version2, options, throwErrors = false) => {
@@ -516,9 +529,9 @@ var require_parse = __commonJS({
516
529
  }
517
530
  });
518
531
 
519
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js
532
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/valid.js
520
533
  var require_valid = __commonJS({
521
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js"(exports2, module2) {
534
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/valid.js"(exports2, module2) {
522
535
  "use strict";
523
536
  var parse3 = require_parse();
524
537
  var valid = (version2, options) => {
@@ -529,9 +542,9 @@ var require_valid = __commonJS({
529
542
  }
530
543
  });
531
544
 
532
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js
545
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/clean.js
533
546
  var require_clean = __commonJS({
534
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js"(exports2, module2) {
547
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/clean.js"(exports2, module2) {
535
548
  "use strict";
536
549
  var parse3 = require_parse();
537
550
  var clean = (version2, options) => {
@@ -542,9 +555,9 @@ var require_clean = __commonJS({
542
555
  }
543
556
  });
544
557
 
545
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js
558
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/inc.js
546
559
  var require_inc = __commonJS({
547
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js"(exports2, module2) {
560
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/inc.js"(exports2, module2) {
548
561
  "use strict";
549
562
  var SemVer = require_semver();
550
563
  var inc = (version2, release, options, identifier, identifierBase) => {
@@ -566,9 +579,9 @@ var require_inc = __commonJS({
566
579
  }
567
580
  });
568
581
 
569
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js
582
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/diff.js
570
583
  var require_diff = __commonJS({
571
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js"(exports2, module2) {
584
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/diff.js"(exports2, module2) {
572
585
  "use strict";
573
586
  var parse3 = require_parse();
574
587
  var diff = (version1, version2) => {
@@ -610,9 +623,9 @@ var require_diff = __commonJS({
610
623
  }
611
624
  });
612
625
 
613
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js
626
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/major.js
614
627
  var require_major = __commonJS({
615
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js"(exports2, module2) {
628
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/major.js"(exports2, module2) {
616
629
  "use strict";
617
630
  var SemVer = require_semver();
618
631
  var major = (a, loose) => new SemVer(a, loose).major;
@@ -620,9 +633,9 @@ var require_major = __commonJS({
620
633
  }
621
634
  });
622
635
 
623
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js
636
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/minor.js
624
637
  var require_minor = __commonJS({
625
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js"(exports2, module2) {
638
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/minor.js"(exports2, module2) {
626
639
  "use strict";
627
640
  var SemVer = require_semver();
628
641
  var minor = (a, loose) => new SemVer(a, loose).minor;
@@ -630,9 +643,9 @@ var require_minor = __commonJS({
630
643
  }
631
644
  });
632
645
 
633
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js
646
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/patch.js
634
647
  var require_patch = __commonJS({
635
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js"(exports2, module2) {
648
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/patch.js"(exports2, module2) {
636
649
  "use strict";
637
650
  var SemVer = require_semver();
638
651
  var patch = (a, loose) => new SemVer(a, loose).patch;
@@ -640,9 +653,9 @@ var require_patch = __commonJS({
640
653
  }
641
654
  });
642
655
 
643
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js
656
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/prerelease.js
644
657
  var require_prerelease = __commonJS({
645
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js"(exports2, module2) {
658
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/prerelease.js"(exports2, module2) {
646
659
  "use strict";
647
660
  var parse3 = require_parse();
648
661
  var prerelease = (version2, options) => {
@@ -653,9 +666,9 @@ var require_prerelease = __commonJS({
653
666
  }
654
667
  });
655
668
 
656
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js
669
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare.js
657
670
  var require_compare = __commonJS({
658
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js"(exports2, module2) {
671
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare.js"(exports2, module2) {
659
672
  "use strict";
660
673
  var SemVer = require_semver();
661
674
  var compare = (a, b3, loose) => new SemVer(a, loose).compare(new SemVer(b3, loose));
@@ -663,9 +676,9 @@ var require_compare = __commonJS({
663
676
  }
664
677
  });
665
678
 
666
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js
679
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/rcompare.js
667
680
  var require_rcompare = __commonJS({
668
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js"(exports2, module2) {
681
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/rcompare.js"(exports2, module2) {
669
682
  "use strict";
670
683
  var compare = require_compare();
671
684
  var rcompare = (a, b3, loose) => compare(b3, a, loose);
@@ -673,9 +686,9 @@ var require_rcompare = __commonJS({
673
686
  }
674
687
  });
675
688
 
676
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js
689
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare-loose.js
677
690
  var require_compare_loose = __commonJS({
678
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
691
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
679
692
  "use strict";
680
693
  var compare = require_compare();
681
694
  var compareLoose = (a, b3) => compare(a, b3, true);
@@ -683,9 +696,9 @@ var require_compare_loose = __commonJS({
683
696
  }
684
697
  });
685
698
 
686
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js
699
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare-build.js
687
700
  var require_compare_build = __commonJS({
688
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js"(exports2, module2) {
701
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare-build.js"(exports2, module2) {
689
702
  "use strict";
690
703
  var SemVer = require_semver();
691
704
  var compareBuild = (a, b3, loose) => {
@@ -697,9 +710,9 @@ var require_compare_build = __commonJS({
697
710
  }
698
711
  });
699
712
 
700
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js
713
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/sort.js
701
714
  var require_sort = __commonJS({
702
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js"(exports2, module2) {
715
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/sort.js"(exports2, module2) {
703
716
  "use strict";
704
717
  var compareBuild = require_compare_build();
705
718
  var sort = (list2, loose) => list2.sort((a, b3) => compareBuild(a, b3, loose));
@@ -707,9 +720,9 @@ var require_sort = __commonJS({
707
720
  }
708
721
  });
709
722
 
710
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js
723
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/rsort.js
711
724
  var require_rsort = __commonJS({
712
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js"(exports2, module2) {
725
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/rsort.js"(exports2, module2) {
713
726
  "use strict";
714
727
  var compareBuild = require_compare_build();
715
728
  var rsort = (list2, loose) => list2.sort((a, b3) => compareBuild(b3, a, loose));
@@ -717,9 +730,9 @@ var require_rsort = __commonJS({
717
730
  }
718
731
  });
719
732
 
720
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js
733
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gt.js
721
734
  var require_gt = __commonJS({
722
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js"(exports2, module2) {
735
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gt.js"(exports2, module2) {
723
736
  "use strict";
724
737
  var compare = require_compare();
725
738
  var gt = (a, b3, loose) => compare(a, b3, loose) > 0;
@@ -727,9 +740,9 @@ var require_gt = __commonJS({
727
740
  }
728
741
  });
729
742
 
730
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js
743
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lt.js
731
744
  var require_lt = __commonJS({
732
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js"(exports2, module2) {
745
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lt.js"(exports2, module2) {
733
746
  "use strict";
734
747
  var compare = require_compare();
735
748
  var lt = (a, b3, loose) => compare(a, b3, loose) < 0;
@@ -737,9 +750,9 @@ var require_lt = __commonJS({
737
750
  }
738
751
  });
739
752
 
740
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js
753
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/eq.js
741
754
  var require_eq = __commonJS({
742
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js"(exports2, module2) {
755
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/eq.js"(exports2, module2) {
743
756
  "use strict";
744
757
  var compare = require_compare();
745
758
  var eq = (a, b3, loose) => compare(a, b3, loose) === 0;
@@ -747,9 +760,9 @@ var require_eq = __commonJS({
747
760
  }
748
761
  });
749
762
 
750
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js
763
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/neq.js
751
764
  var require_neq = __commonJS({
752
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js"(exports2, module2) {
765
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/neq.js"(exports2, module2) {
753
766
  "use strict";
754
767
  var compare = require_compare();
755
768
  var neq = (a, b3, loose) => compare(a, b3, loose) !== 0;
@@ -757,9 +770,9 @@ var require_neq = __commonJS({
757
770
  }
758
771
  });
759
772
 
760
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js
773
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gte.js
761
774
  var require_gte = __commonJS({
762
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js"(exports2, module2) {
775
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gte.js"(exports2, module2) {
763
776
  "use strict";
764
777
  var compare = require_compare();
765
778
  var gte2 = (a, b3, loose) => compare(a, b3, loose) >= 0;
@@ -767,9 +780,9 @@ var require_gte = __commonJS({
767
780
  }
768
781
  });
769
782
 
770
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js
783
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lte.js
771
784
  var require_lte = __commonJS({
772
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js"(exports2, module2) {
785
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lte.js"(exports2, module2) {
773
786
  "use strict";
774
787
  var compare = require_compare();
775
788
  var lte2 = (a, b3, loose) => compare(a, b3, loose) <= 0;
@@ -777,9 +790,9 @@ var require_lte = __commonJS({
777
790
  }
778
791
  });
779
792
 
780
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js
793
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/cmp.js
781
794
  var require_cmp = __commonJS({
782
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js"(exports2, module2) {
795
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/cmp.js"(exports2, module2) {
783
796
  "use strict";
784
797
  var eq = require_eq();
785
798
  var neq = require_neq();
@@ -827,9 +840,9 @@ var require_cmp = __commonJS({
827
840
  }
828
841
  });
829
842
 
830
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js
843
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/coerce.js
831
844
  var require_coerce = __commonJS({
832
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js"(exports2, module2) {
845
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/coerce.js"(exports2, module2) {
833
846
  "use strict";
834
847
  var SemVer = require_semver();
835
848
  var parse3 = require_parse();
@@ -873,9 +886,50 @@ var require_coerce = __commonJS({
873
886
  }
874
887
  });
875
888
 
876
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js
889
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/truncate.js
890
+ var require_truncate = __commonJS({
891
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/truncate.js"(exports2, module2) {
892
+ "use strict";
893
+ var parse3 = require_parse();
894
+ var constants = require_constants();
895
+ var SemVer = require_semver();
896
+ var truncate = (version2, truncation, options) => {
897
+ if (!constants.RELEASE_TYPES.includes(truncation)) {
898
+ return null;
899
+ }
900
+ const clonedVersion = cloneInputVersion(version2, options);
901
+ return clonedVersion && doTruncation(clonedVersion, truncation);
902
+ };
903
+ var cloneInputVersion = (version2, options) => {
904
+ const versionStringToParse = version2 instanceof SemVer ? version2.version : version2;
905
+ return parse3(versionStringToParse, options);
906
+ };
907
+ var doTruncation = (version2, truncation) => {
908
+ if (isPrerelease(truncation)) {
909
+ return version2.version;
910
+ }
911
+ version2.prerelease = [];
912
+ switch (truncation) {
913
+ case "major":
914
+ version2.minor = 0;
915
+ version2.patch = 0;
916
+ break;
917
+ case "minor":
918
+ version2.patch = 0;
919
+ break;
920
+ }
921
+ return version2.format();
922
+ };
923
+ var isPrerelease = (type) => {
924
+ return type.startsWith("pre");
925
+ };
926
+ module2.exports = truncate;
927
+ }
928
+ });
929
+
930
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/lrucache.js
877
931
  var require_lrucache = __commonJS({
878
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js"(exports2, module2) {
932
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/lrucache.js"(exports2, module2) {
879
933
  "use strict";
880
934
  var LRUCache = class {
881
935
  constructor() {
@@ -911,9 +965,9 @@ var require_lrucache = __commonJS({
911
965
  }
912
966
  });
913
967
 
914
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js
968
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/range.js
915
969
  var require_range = __commonJS({
916
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js"(exports2, module2) {
970
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/range.js"(exports2, module2) {
917
971
  "use strict";
918
972
  var SPACE_CHARACTERS = /\s+/g;
919
973
  var Range = class _Range {
@@ -981,6 +1035,7 @@ var require_range = __commonJS({
981
1035
  return this.range;
982
1036
  }
983
1037
  parseRange(range2) {
1038
+ range2 = range2.replace(BUILDSTRIPRE, "");
984
1039
  const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
985
1040
  const memoKey = memoOpts + ":" + range2;
986
1041
  const cached = cache.get(memoKey);
@@ -1063,12 +1118,14 @@ var require_range = __commonJS({
1063
1118
  var SemVer = require_semver();
1064
1119
  var {
1065
1120
  safeRe: re,
1121
+ src,
1066
1122
  t: t2,
1067
1123
  comparatorTrimReplace,
1068
1124
  tildeTrimReplace,
1069
1125
  caretTrimReplace
1070
1126
  } = require_re();
1071
1127
  var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1128
+ var BUILDSTRIPRE = new RegExp(src[t2.BUILD], "g");
1072
1129
  var isNullSet = (c3) => c3.value === "<0.0.0-0";
1073
1130
  var isAny = (c3) => c3.value === "";
1074
1131
  var isSatisfiable = (comparators, options) => {
@@ -1097,6 +1154,7 @@ var require_range = __commonJS({
1097
1154
  return comp;
1098
1155
  };
1099
1156
  var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1157
+ var invalidXRangeOrder = (M2, m, p2) => isX(M2) && !isX(m) || isX(m) && p2 && !isX(p2);
1100
1158
  var replaceTildes = (comp, options) => {
1101
1159
  return comp.trim().split(/\s+/).map((c3) => replaceTilde(c3, options)).join(" ");
1102
1160
  };
@@ -1156,9 +1214,9 @@ var require_range = __commonJS({
1156
1214
  debug2("no pr");
1157
1215
  if (M2 === "0") {
1158
1216
  if (m === "0") {
1159
- ret = `>=${M2}.${m}.${p2}${z2} <${M2}.${m}.${+p2 + 1}-0`;
1217
+ ret = `>=${M2}.${m}.${p2} <${M2}.${m}.${+p2 + 1}-0`;
1160
1218
  } else {
1161
- ret = `>=${M2}.${m}.${p2}${z2} <${M2}.${+m + 1}.0-0`;
1219
+ ret = `>=${M2}.${m}.${p2} <${M2}.${+m + 1}.0-0`;
1162
1220
  }
1163
1221
  } else {
1164
1222
  ret = `>=${M2}.${m}.${p2} <${+M2 + 1}.0.0-0`;
@@ -1177,6 +1235,9 @@ var require_range = __commonJS({
1177
1235
  const r2 = options.loose ? re[t2.XRANGELOOSE] : re[t2.XRANGE];
1178
1236
  return comp.replace(r2, (ret, gtlt, M2, m, p2, pr) => {
1179
1237
  debug2("xRange", comp, ret, gtlt, M2, m, p2, pr);
1238
+ if (invalidXRangeOrder(M2, m, p2)) {
1239
+ return comp;
1240
+ }
1180
1241
  const xM = isX(M2);
1181
1242
  const xm = xM || isX(m);
1182
1243
  const xp = xm || isX(p2);
@@ -1288,9 +1349,9 @@ var require_range = __commonJS({
1288
1349
  }
1289
1350
  });
1290
1351
 
1291
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js
1352
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/comparator.js
1292
1353
  var require_comparator = __commonJS({
1293
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js"(exports2, module2) {
1354
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/comparator.js"(exports2, module2) {
1294
1355
  "use strict";
1295
1356
  var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
1296
1357
  var Comparator = class _Comparator {
@@ -1401,9 +1462,9 @@ var require_comparator = __commonJS({
1401
1462
  }
1402
1463
  });
1403
1464
 
1404
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js
1465
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/satisfies.js
1405
1466
  var require_satisfies = __commonJS({
1406
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js"(exports2, module2) {
1467
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/satisfies.js"(exports2, module2) {
1407
1468
  "use strict";
1408
1469
  var Range = require_range();
1409
1470
  var satisfies = (version2, range2, options) => {
@@ -1418,9 +1479,9 @@ var require_satisfies = __commonJS({
1418
1479
  }
1419
1480
  });
1420
1481
 
1421
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
1482
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/to-comparators.js
1422
1483
  var require_to_comparators = __commonJS({
1423
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
1484
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
1424
1485
  "use strict";
1425
1486
  var Range = require_range();
1426
1487
  var toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c3) => c3.value).join(" ").trim().split(" "));
@@ -1428,9 +1489,9 @@ var require_to_comparators = __commonJS({
1428
1489
  }
1429
1490
  });
1430
1491
 
1431
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
1492
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/max-satisfying.js
1432
1493
  var require_max_satisfying = __commonJS({
1433
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
1494
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
1434
1495
  "use strict";
1435
1496
  var SemVer = require_semver();
1436
1497
  var Range = require_range();
@@ -1457,9 +1518,9 @@ var require_max_satisfying = __commonJS({
1457
1518
  }
1458
1519
  });
1459
1520
 
1460
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
1521
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/min-satisfying.js
1461
1522
  var require_min_satisfying = __commonJS({
1462
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
1523
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
1463
1524
  "use strict";
1464
1525
  var SemVer = require_semver();
1465
1526
  var Range = require_range();
@@ -1486,9 +1547,9 @@ var require_min_satisfying = __commonJS({
1486
1547
  }
1487
1548
  });
1488
1549
 
1489
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js
1550
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/min-version.js
1490
1551
  var require_min_version = __commonJS({
1491
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js"(exports2, module2) {
1552
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/min-version.js"(exports2, module2) {
1492
1553
  "use strict";
1493
1554
  var SemVer = require_semver();
1494
1555
  var Range = require_range();
@@ -1545,9 +1606,9 @@ var require_min_version = __commonJS({
1545
1606
  }
1546
1607
  });
1547
1608
 
1548
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
1609
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/valid.js
1549
1610
  var require_valid2 = __commonJS({
1550
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js"(exports2, module2) {
1611
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/valid.js"(exports2, module2) {
1551
1612
  "use strict";
1552
1613
  var Range = require_range();
1553
1614
  var validRange = (range2, options) => {
@@ -1561,9 +1622,9 @@ var require_valid2 = __commonJS({
1561
1622
  }
1562
1623
  });
1563
1624
 
1564
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js
1625
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/outside.js
1565
1626
  var require_outside = __commonJS({
1566
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js"(exports2, module2) {
1627
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/outside.js"(exports2, module2) {
1567
1628
  "use strict";
1568
1629
  var SemVer = require_semver();
1569
1630
  var Comparator = require_comparator();
@@ -1630,9 +1691,9 @@ var require_outside = __commonJS({
1630
1691
  }
1631
1692
  });
1632
1693
 
1633
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js
1694
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/gtr.js
1634
1695
  var require_gtr = __commonJS({
1635
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js"(exports2, module2) {
1696
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/gtr.js"(exports2, module2) {
1636
1697
  "use strict";
1637
1698
  var outside = require_outside();
1638
1699
  var gtr = (version2, range2, options) => outside(version2, range2, ">", options);
@@ -1640,9 +1701,9 @@ var require_gtr = __commonJS({
1640
1701
  }
1641
1702
  });
1642
1703
 
1643
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js
1704
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/ltr.js
1644
1705
  var require_ltr = __commonJS({
1645
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js"(exports2, module2) {
1706
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/ltr.js"(exports2, module2) {
1646
1707
  "use strict";
1647
1708
  var outside = require_outside();
1648
1709
  var ltr = (version2, range2, options) => outside(version2, range2, "<", options);
@@ -1650,9 +1711,9 @@ var require_ltr = __commonJS({
1650
1711
  }
1651
1712
  });
1652
1713
 
1653
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js
1714
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/intersects.js
1654
1715
  var require_intersects = __commonJS({
1655
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js"(exports2, module2) {
1716
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/intersects.js"(exports2, module2) {
1656
1717
  "use strict";
1657
1718
  var Range = require_range();
1658
1719
  var intersects = (r1, r2, options) => {
@@ -1664,9 +1725,9 @@ var require_intersects = __commonJS({
1664
1725
  }
1665
1726
  });
1666
1727
 
1667
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js
1728
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/simplify.js
1668
1729
  var require_simplify = __commonJS({
1669
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js"(exports2, module2) {
1730
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/simplify.js"(exports2, module2) {
1670
1731
  "use strict";
1671
1732
  var satisfies = require_satisfies();
1672
1733
  var compare = require_compare();
@@ -1714,9 +1775,9 @@ var require_simplify = __commonJS({
1714
1775
  }
1715
1776
  });
1716
1777
 
1717
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js
1778
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/subset.js
1718
1779
  var require_subset = __commonJS({
1719
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js"(exports2, module2) {
1780
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/subset.js"(exports2, module2) {
1720
1781
  "use strict";
1721
1782
  var Range = require_range();
1722
1783
  var Comparator = require_comparator();
@@ -1824,7 +1885,7 @@ var require_subset = __commonJS({
1824
1885
  if (higher === c3 && higher !== gt) {
1825
1886
  return false;
1826
1887
  }
1827
- } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c3), options)) {
1888
+ } else if (gt.operator === ">=" && !c3.test(gt.semver)) {
1828
1889
  return false;
1829
1890
  }
1830
1891
  }
@@ -1839,7 +1900,7 @@ var require_subset = __commonJS({
1839
1900
  if (lower === c3 && lower !== lt) {
1840
1901
  return false;
1841
1902
  }
1842
- } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c3), options)) {
1903
+ } else if (lt.operator === "<=" && !c3.test(lt.semver)) {
1843
1904
  return false;
1844
1905
  }
1845
1906
  }
@@ -1876,9 +1937,9 @@ var require_subset = __commonJS({
1876
1937
  }
1877
1938
  });
1878
1939
 
1879
- // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js
1940
+ // ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/index.js
1880
1941
  var require_semver2 = __commonJS({
1881
- "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js"(exports2, module2) {
1942
+ "../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/index.js"(exports2, module2) {
1882
1943
  "use strict";
1883
1944
  var internalRe = require_re();
1884
1945
  var constants = require_constants();
@@ -1907,6 +1968,7 @@ var require_semver2 = __commonJS({
1907
1968
  var lte2 = require_lte();
1908
1969
  var cmp = require_cmp();
1909
1970
  var coerce = require_coerce();
1971
+ var truncate = require_truncate();
1910
1972
  var Comparator = require_comparator();
1911
1973
  var Range = require_range();
1912
1974
  var satisfies = require_satisfies();
@@ -1945,6 +2007,7 @@ var require_semver2 = __commonJS({
1945
2007
  lte: lte2,
1946
2008
  cmp,
1947
2009
  coerce,
2010
+ truncate,
1948
2011
  Comparator,
1949
2012
  Range,
1950
2013
  satisfies,
@@ -3754,10 +3817,10 @@ var init_esm3 = __esm({
3754
3817
  }
3755
3818
  return filtered.join("/");
3756
3819
  }).join("|");
3757
- const [open, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
3758
- re = "^" + open + re + close + "$";
3820
+ const [open2, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
3821
+ re = "^" + open2 + re + close + "$";
3759
3822
  if (this.partial) {
3760
- re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
3823
+ re = "^(?:\\/|" + open2 + re.slice(1, -1) + close + ")$";
3761
3824
  }
3762
3825
  if (this.negate)
3763
3826
  re = "^(?!" + re + ").+$";
@@ -3831,9 +3894,9 @@ var init_esm3 = __esm({
3831
3894
  }
3832
3895
  });
3833
3896
 
3834
- // ../../node_modules/.pnpm/tmp@0.2.6/node_modules/tmp/lib/tmp.js
3897
+ // ../../node_modules/.pnpm/tmp@0.2.7/node_modules/tmp/lib/tmp.js
3835
3898
  var require_tmp = __commonJS({
3836
- "../../node_modules/.pnpm/tmp@0.2.6/node_modules/tmp/lib/tmp.js"(exports2, module2) {
3899
+ "../../node_modules/.pnpm/tmp@0.2.7/node_modules/tmp/lib/tmp.js"(exports2, module2) {
3837
3900
  "use strict";
3838
3901
  var fs3 = require("fs");
3839
3902
  var os = require("os");
@@ -4084,11 +4147,14 @@ var require_tmp = __commonJS({
4084
4147
  ].join("");
4085
4148
  return path5.join(tmpDir, opts.dir, name);
4086
4149
  }
4087
- function _assertPath(path6) {
4088
- if (path6.includes("..")) {
4150
+ function _assertPath(option, value) {
4151
+ if (typeof value !== "string") {
4152
+ throw new Error(`${option} option must be a string, got "${typeof value}".`);
4153
+ }
4154
+ if (value.includes("..")) {
4089
4155
  throw new Error("Relative value not allowed");
4090
4156
  }
4091
- return path6;
4157
+ return value;
4092
4158
  }
4093
4159
  function _assertOptionsBase(options) {
4094
4160
  if (!_isUndefined(options.name)) {
@@ -4099,8 +4165,13 @@ var require_tmp = __commonJS({
4099
4165
  throw new Error(`name option must not contain a path, found "${name}".`);
4100
4166
  }
4101
4167
  }
4102
- if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) {
4103
- throw new Error(`Invalid template, found "${options.template}".`);
4168
+ if (!_isUndefined(options.template)) {
4169
+ if (typeof options.template !== "string") {
4170
+ throw new Error(`template option must be a string, got "${typeof options.template}".`);
4171
+ }
4172
+ if (!options.template.match(TEMPLATE_PATTERN)) {
4173
+ throw new Error(`Invalid template, found "${options.template}".`);
4174
+ }
4104
4175
  }
4105
4176
  if (!_isUndefined(options.tries) && isNaN(options.tries) || options.tries < 0) {
4106
4177
  throw new Error(`Invalid tries, found "${options.tries}".`);
@@ -4110,9 +4181,9 @@ var require_tmp = __commonJS({
4110
4181
  options.detachDescriptor = !!options.detachDescriptor;
4111
4182
  options.discardDescriptor = !!options.discardDescriptor;
4112
4183
  options.unsafeCleanup = !!options.unsafeCleanup;
4113
- options.prefix = _isUndefined(options.prefix) ? "" : _assertPath(options.prefix);
4114
- options.postfix = _isUndefined(options.postfix) ? "" : _assertPath(options.postfix);
4115
- options.template = _isUndefined(options.template) ? void 0 : _assertPath(options.template);
4184
+ options.prefix = _isUndefined(options.prefix) ? "" : _assertPath("prefix", options.prefix);
4185
+ options.postfix = _isUndefined(options.postfix) ? "" : _assertPath("postfix", options.postfix);
4186
+ options.template = _isUndefined(options.template) ? void 0 : _assertPath("template", options.template);
4116
4187
  }
4117
4188
  function _getRelativePath(option, name, tmpDir, cb) {
4118
4189
  if (_isUndefined(name)) return cb(null);
@@ -7095,7 +7166,7 @@ var require_require_directory = __commonJS({
7095
7166
  "../../node_modules/.pnpm/require-directory@2.1.1/node_modules/require-directory/index.js"(exports2, module2) {
7096
7167
  "use strict";
7097
7168
  var fs3 = require("fs");
7098
- var join17 = require("path").join;
7169
+ var join18 = require("path").join;
7099
7170
  var resolve8 = require("path").resolve;
7100
7171
  var dirname6 = require("path").dirname;
7101
7172
  var defaultOptions2 = {
@@ -7132,7 +7203,7 @@ var require_require_directory = __commonJS({
7132
7203
  }
7133
7204
  path5 = !path5 ? dirname6(m.filename) : resolve8(dirname6(m.filename), path5);
7134
7205
  fs3.readdirSync(path5).forEach(function(filename) {
7135
- var joined = join17(path5, filename), files, key, obj;
7206
+ var joined = join18(path5, filename), files, key, obj;
7136
7207
  if (fs3.statSync(joined).isDirectory() && options.recurse) {
7137
7208
  files = requireDirectory(m, joined, options);
7138
7209
  if (Object.keys(files).length) {
@@ -9534,12 +9605,12 @@ var require_src2 = __commonJS({
9534
9605
  function check(path5, isFile, isDirectory) {
9535
9606
  log(`checking %s`, path5);
9536
9607
  try {
9537
- const stat2 = fs_1.statSync(path5);
9538
- if (stat2.isFile() && isFile) {
9608
+ const stat = fs_1.statSync(path5);
9609
+ if (stat.isFile() && isFile) {
9539
9610
  log(`[OK] path represents a file`);
9540
9611
  return true;
9541
9612
  }
9542
- if (stat2.isDirectory() && isDirectory) {
9613
+ if (stat.isDirectory() && isDirectory) {
9543
9614
  log(`[OK] path represents a directory`);
9544
9615
  return true;
9545
9616
  }
@@ -22143,7 +22214,7 @@ var init_diff3 = __esm({
22143
22214
  }
22144
22215
  });
22145
22216
 
22146
- // ../../node_modules/.pnpm/@fern-api+replay@0.18.0/node_modules/@fern-api/replay/dist/index.js
22217
+ // ../../node_modules/.pnpm/@fern-api+replay@0.19.0/node_modules/@fern-api/replay/dist/index.js
22147
22218
  var dist_exports = {};
22148
22219
  __export(dist_exports, {
22149
22220
  CREDENTIAL_PATTERNS: () => CREDENTIAL_PATTERNS,
@@ -22553,12 +22624,14 @@ async function capturePatchSnapshot(git, files, treeish) {
22553
22624
  return snapshot;
22554
22625
  }
22555
22626
  function filterInfrastructureAndSensitiveFiles(rawFilesOutput, fernignorePatterns) {
22556
- const allFiles = rawFilesOutput.trim().split("\n").filter(Boolean).filter((f) => !INFRASTRUCTURE_FILES.has(f)).filter((f) => !f.startsWith(".fern/"));
22627
+ const rawFiles = rawFilesOutput.trim().split("\n").filter(Boolean);
22628
+ const infrastructureFiles = rawFiles.filter((f) => INFRASTRUCTURE_FILES.has(f) || f.startsWith(".fern/"));
22629
+ const allFiles = rawFiles.filter((f) => !INFRASTRUCTURE_FILES.has(f) && !f.startsWith(".fern/"));
22557
22630
  const sensitiveFiles = allFiles.filter((f) => isSensitiveFile(f));
22558
22631
  const nonSensitive = allFiles.filter((f) => !isSensitiveFile(f));
22559
22632
  const fernignoredFiles = nonSensitive.filter((f) => matchesFernignorePattern(f, fernignorePatterns));
22560
22633
  const files = nonSensitive.filter((f) => !matchesFernignorePattern(f, fernignorePatterns));
22561
- return { files, sensitiveFiles, fernignoredFiles };
22634
+ return { files, sensitiveFiles, fernignoredFiles, infrastructureFiles };
22562
22635
  }
22563
22636
  function threeWayMerge(base, ours, theirs) {
22564
22637
  const baseLines = base.split("\n");
@@ -23064,6 +23137,11 @@ function isDiffLineForFile(diffLine, filePath) {
23064
23137
  const match2 = diffLine.match(/^diff --git a\/.+ b\/(.+)$/);
23065
23138
  return match2 !== null && match2[1] === filePath;
23066
23139
  }
23140
+ function readFernignorePatterns(outputDir) {
23141
+ const fernignorePath = (0, import_path14.join)(outputDir, ".fernignore");
23142
+ if (!(0, import_fs8.existsSync)(fernignorePath)) return [];
23143
+ return (0, import_fs8.readFileSync)(fernignorePath, "utf-8").split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
23144
+ }
23067
23145
  function normalizeHunkBody(hunk) {
23068
23146
  let contextC = 0;
23069
23147
  let removeC = 0;
@@ -23279,10 +23357,10 @@ function overlayRegions(currentGenLines, locInCurrentGen, workingTreeLines, locI
23279
23357
  }
23280
23358
  async function unifiedDiff(beforeContent, afterContent, filePath) {
23281
23359
  if (beforeContent === afterContent) return "";
23282
- const tmp4 = await (0, import_promises8.mkdtemp)((0, import_path14.join)((0, import_os3.tmpdir)(), "fern-replay-pp-"));
23360
+ const tmp4 = await (0, import_promises8.mkdtemp)((0, import_path15.join)((0, import_os3.tmpdir)(), "fern-replay-pp-"));
23283
23361
  try {
23284
- const beforePath = (0, import_path14.join)(tmp4, "before");
23285
- const afterPath = (0, import_path14.join)(tmp4, "after");
23362
+ const beforePath = (0, import_path15.join)(tmp4, "before");
23363
+ const afterPath = (0, import_path15.join)(tmp4, "after");
23286
23364
  await (0, import_promises8.writeFile)(beforePath, beforeContent, "utf-8");
23287
23365
  await (0, import_promises8.writeFile)(afterPath, afterContent, "utf-8");
23288
23366
  const raw = await runGitDiffNoIndex(beforePath, afterPath);
@@ -23391,6 +23469,17 @@ function assertActive(prep) {
23391
23469
  );
23392
23470
  }
23393
23471
  }
23472
+ function dedupeDegradedReasons(reasons) {
23473
+ const seen = /* @__PURE__ */ new Set();
23474
+ const out = [];
23475
+ for (const reason of reasons) {
23476
+ const key = `${reason.code}\0${reason.message}`;
23477
+ if (seen.has(key)) continue;
23478
+ seen.add(key);
23479
+ out.push(reason);
23480
+ }
23481
+ return out;
23482
+ }
23394
23483
  function computeCommitBuckets(results, absorbedPatchIds, patchesPassedToCommit) {
23395
23484
  const resultByPatchId = /* @__PURE__ */ new Map();
23396
23485
  for (const r2 of results) resultByPatchId.set(r2.patch.id, r2);
@@ -23439,7 +23528,7 @@ function computeLegacyFernignoreCleanse(patch, fernignorePatterns, computeConten
23439
23528
  }
23440
23529
  }
23441
23530
  }
23442
- const { stripped: patchContentStripped, content: newPatchContent, strippedSectionPaths } = stripFernignoreDiffSections(patch.patch_content, matchesFernignore);
23531
+ const { stripped: patchContentStripped, content: newPatchContent, strippedSectionPaths } = stripDiffSectionsByPredicate(patch.patch_content, matchesFernignore);
23443
23532
  const unchanged = strippedFromFiles.length === 0 && !snapshotChanged && !patchContentStripped;
23444
23533
  if (unchanged) {
23445
23534
  return {
@@ -23474,7 +23563,38 @@ function computeLegacyFernignoreCleanse(patch, fernignorePatterns, computeConten
23474
23563
  strippedPaths
23475
23564
  };
23476
23565
  }
23477
- function stripFernignoreDiffSections(patchContent, matchesFernignore) {
23566
+ function isInfrastructureFile(filePath) {
23567
+ return filePath === ".fernignore" || filePath.startsWith(".fern/");
23568
+ }
23569
+ function computeInfrastructureFileCleanse(patch, computeContentHash2) {
23570
+ const { stripped, content: newPatchContent, strippedSectionPaths } = stripDiffSectionsByPredicate(patch.patch_content, isInfrastructureFile);
23571
+ if (!stripped) {
23572
+ return {
23573
+ unchanged: true,
23574
+ remove: false,
23575
+ patch_content: patch.patch_content,
23576
+ content_hash: patch.content_hash,
23577
+ strippedPaths: []
23578
+ };
23579
+ }
23580
+ if (newPatchContent.trim() === "" || patch.files.length === 0) {
23581
+ return {
23582
+ unchanged: false,
23583
+ remove: true,
23584
+ patch_content: "",
23585
+ content_hash: "",
23586
+ strippedPaths: strippedSectionPaths
23587
+ };
23588
+ }
23589
+ return {
23590
+ unchanged: false,
23591
+ remove: false,
23592
+ patch_content: newPatchContent,
23593
+ content_hash: computeContentHash2(newPatchContent),
23594
+ strippedPaths: strippedSectionPaths
23595
+ };
23596
+ }
23597
+ function stripDiffSectionsByPredicate(patchContent, shouldStrip) {
23478
23598
  const lines = patchContent.split("\n");
23479
23599
  const sectionStarts = [];
23480
23600
  for (let i2 = 0; i2 < lines.length; i2++) {
@@ -23496,7 +23616,7 @@ function stripFernignoreDiffSections(patchContent, matchesFernignore) {
23496
23616
  const section = sectionStarts[i2];
23497
23617
  const next = sectionStarts[i2 + 1];
23498
23618
  const endIdx = next ? next.idx : lines.length;
23499
- if (section.path !== null && matchesFernignore(section.path)) {
23619
+ if (section.path !== null && shouldStrip(section.path)) {
23500
23620
  stripped = true;
23501
23621
  strippedSectionPaths.push(section.path);
23502
23622
  continue;
@@ -23669,10 +23789,10 @@ function parseGitLog(log) {
23669
23789
  });
23670
23790
  }
23671
23791
  function ensureFernignoreEntries(outputDir) {
23672
- const fernignorePath = (0, import_path16.join)(outputDir, ".fernignore");
23792
+ const fernignorePath = (0, import_path17.join)(outputDir, ".fernignore");
23673
23793
  let content = "";
23674
- if ((0, import_fs9.existsSync)(fernignorePath)) {
23675
- content = (0, import_fs9.readFileSync)(fernignorePath, "utf-8");
23794
+ if ((0, import_fs10.existsSync)(fernignorePath)) {
23795
+ content = (0, import_fs10.readFileSync)(fernignorePath, "utf-8");
23676
23796
  }
23677
23797
  const lines = content.split("\n");
23678
23798
  const toAdd = [];
@@ -23688,14 +23808,14 @@ function ensureFernignoreEntries(outputDir) {
23688
23808
  content += "\n";
23689
23809
  }
23690
23810
  content += toAdd.join("\n") + "\n";
23691
- (0, import_fs9.writeFileSync)(fernignorePath, content, "utf-8");
23811
+ (0, import_fs10.writeFileSync)(fernignorePath, content, "utf-8");
23692
23812
  return true;
23693
23813
  }
23694
23814
  function ensureGitattributesEntries(outputDir) {
23695
- const gitattributesPath = (0, import_path16.join)(outputDir, ".gitattributes");
23815
+ const gitattributesPath = (0, import_path17.join)(outputDir, ".gitattributes");
23696
23816
  let content = "";
23697
- if ((0, import_fs9.existsSync)(gitattributesPath)) {
23698
- content = (0, import_fs9.readFileSync)(gitattributesPath, "utf-8");
23817
+ if ((0, import_fs10.existsSync)(gitattributesPath)) {
23818
+ content = (0, import_fs10.readFileSync)(gitattributesPath, "utf-8");
23699
23819
  }
23700
23820
  const lines = content.split("\n");
23701
23821
  const toAdd = [];
@@ -23711,7 +23831,7 @@ function ensureGitattributesEntries(outputDir) {
23711
23831
  content += "\n";
23712
23832
  }
23713
23833
  content += toAdd.join("\n") + "\n";
23714
- (0, import_fs9.writeFileSync)(gitattributesPath, content, "utf-8");
23834
+ (0, import_fs10.writeFileSync)(gitattributesPath, content, "utf-8");
23715
23835
  }
23716
23836
  function computeContentHash(patchContent) {
23717
23837
  const lines = patchContent.split("\n");
@@ -23769,7 +23889,28 @@ function buildWarnings(patches) {
23769
23889
  }
23770
23890
  return warnings;
23771
23891
  }
23772
- function forget(outputDir, options) {
23892
+ async function dismissPatches(outputDir, lockManager, patches) {
23893
+ const git = new GitClient(outputDir);
23894
+ const detector = new ReplayDetector(git, lockManager, outputDir, readFernignorePatterns(outputDir));
23895
+ for (const patch of patches) {
23896
+ const hashes = [patch.content_hash];
23897
+ if (patch.original_commit) {
23898
+ const materialized = await detector.materializeCommitPatch(patch.original_commit);
23899
+ if (materialized.status === "ok" && !hashes.includes(materialized.contentHash)) {
23900
+ hashes.push(materialized.contentHash);
23901
+ }
23902
+ }
23903
+ lockManager.addDismissal({
23904
+ patch_id: patch.id,
23905
+ original_commit: patch.original_commit,
23906
+ original_message: patch.original_message,
23907
+ content_hashes: hashes,
23908
+ dismissed_at: (/* @__PURE__ */ new Date()).toISOString(),
23909
+ via: "forget"
23910
+ });
23911
+ }
23912
+ }
23913
+ async function forget(outputDir, options) {
23773
23914
  const lockManager = new LockfileManager(outputDir);
23774
23915
  if (!lockManager.exists()) {
23775
23916
  return { ...EMPTY_RESULT };
@@ -23780,9 +23921,7 @@ function forget(outputDir, options) {
23780
23921
  const removed = lock.patches.map(toMatchedPatch);
23781
23922
  const warnings = buildWarnings(lock.patches);
23782
23923
  if (!options.dryRun) {
23783
- for (const patch of lock.patches) {
23784
- lockManager.addForgottenHash(patch.content_hash);
23785
- }
23924
+ await dismissPatches(outputDir, lockManager, lock.patches);
23786
23925
  lockManager.clearPatches();
23787
23926
  lockManager.save();
23788
23927
  }
@@ -23811,8 +23950,8 @@ function forget(outputDir, options) {
23811
23950
  }
23812
23951
  const warnings = buildWarnings(patchesToRemove);
23813
23952
  if (!options.dryRun) {
23953
+ await dismissPatches(outputDir, lockManager, patchesToRemove);
23814
23954
  for (const patch of patchesToRemove) {
23815
- lockManager.addForgottenHash(patch.content_hash);
23816
23955
  lockManager.removePatch(patch.id);
23817
23956
  }
23818
23957
  lockManager.save();
@@ -23864,7 +24003,7 @@ function reset(outputDir, options) {
23864
24003
  const lock = lockManager.read();
23865
24004
  const patchCount = lock.patches.length;
23866
24005
  if (!options?.dryRun) {
23867
- (0, import_fs10.unlinkSync)(lockManager.lockfilePath);
24006
+ (0, import_fs11.unlinkSync)(lockManager.lockfilePath);
23868
24007
  }
23869
24008
  return {
23870
24009
  success: true,
@@ -23912,15 +24051,16 @@ async function resolve7(outputDir, options) {
23912
24051
  const patchesToCommit = [...resolvingPatches, ...unresolvedPatches];
23913
24052
  if (patchesToCommit.length > 0) {
23914
24053
  const currentGen = lock.current_generation;
23915
- const detector = new ReplayDetector(git, lockManager, outputDir);
24054
+ const detector = new ReplayDetector(git, lockManager, outputDir, readFernignorePatterns(outputDir));
23916
24055
  const warnings = [];
24056
+ const patchesDismissed = [];
23917
24057
  let patchesResolved = 0;
23918
24058
  const pass1 = [];
23919
24059
  for (const patch of patchesToCommit) {
23920
24060
  const result = await computePerPatchDiffWithFallback(
23921
24061
  patch,
23922
24062
  (f) => git.showFile(currentGen, f),
23923
- (f) => (0, import_promises9.readFile)((0, import_path17.join)(outputDir, f), "utf-8").catch(() => null),
24063
+ (f) => (0, import_promises9.readFile)((0, import_path18.join)(outputDir, f), "utf-8").catch(() => null),
23924
24064
  (files) => git.exec(["diff", currentGen, "--", ...files]).catch(() => null)
23925
24065
  );
23926
24066
  if (result === null) {
@@ -23954,7 +24094,27 @@ async function resolve7(outputDir, options) {
23954
24094
  const r2 = pass1[i2];
23955
24095
  if (r2.kind === "skip") continue;
23956
24096
  if (r2.kind === "revert") {
24097
+ const hashes = [patch.content_hash];
24098
+ if (patch.original_commit) {
24099
+ const materialized = await detector.materializeCommitPatch(patch.original_commit);
24100
+ if (materialized.status === "ok" && !hashes.includes(materialized.contentHash)) {
24101
+ hashes.push(materialized.contentHash);
24102
+ } else if (materialized.status === "unreachable") {
24103
+ warnings.push(
24104
+ `Patch ${patch.id}: original commit ${patch.original_commit.slice(0, 7)} is unreachable; dismissed using the stored content hash only. If this commit reappears in history, the customization may be re-detected once.`
24105
+ );
24106
+ }
24107
+ }
24108
+ lockManager.addDismissal({
24109
+ patch_id: patch.id,
24110
+ original_commit: patch.original_commit,
24111
+ original_message: patch.original_message,
24112
+ content_hashes: hashes,
24113
+ dismissed_at: (/* @__PURE__ */ new Date()).toISOString(),
24114
+ via: "resolve"
24115
+ });
23957
24116
  lockManager.removePatch(patch.id);
24117
+ patchesDismissed.push({ id: patch.id, message: patch.original_message });
23958
24118
  continue;
23959
24119
  }
23960
24120
  if (lastIndexByHash.get(r2.hash) !== i2) {
@@ -23976,7 +24136,7 @@ async function resolve7(outputDir, options) {
23976
24136
  const theirsSnapshot = {};
23977
24137
  for (const file of filesForSnapshot) {
23978
24138
  if (isBinaryFile(file)) continue;
23979
- const content = await (0, import_promises9.readFile)((0, import_path17.join)(outputDir, file), "utf-8").catch(() => null);
24139
+ const content = await (0, import_promises9.readFile)((0, import_path18.join)(outputDir, file), "utf-8").catch(() => null);
23980
24140
  if (content != null) {
23981
24141
  theirsSnapshot[file] = content;
23982
24142
  }
@@ -24003,6 +24163,7 @@ async function resolve7(outputDir, options) {
24003
24163
  commitSha: commitSha2,
24004
24164
  phase: "committed",
24005
24165
  patchesResolved,
24166
+ patchesDismissed: patchesDismissed.length > 0 ? patchesDismissed : void 0,
24006
24167
  warnings: warnings.length > 0 ? warnings : void 0
24007
24168
  };
24008
24169
  }
@@ -24048,7 +24209,9 @@ function status(outputDir) {
24048
24209
  lastGeneration: void 0,
24049
24210
  patches: [],
24050
24211
  unresolvedCount: 0,
24051
- excludePatterns: []
24212
+ excludePatterns: [],
24213
+ dismissed: [],
24214
+ legacyDismissedCount: 0
24052
24215
  };
24053
24216
  }
24054
24217
  const lock = lockManager.read();
@@ -24077,18 +24240,29 @@ function status(outputDir) {
24077
24240
  }
24078
24241
  const config = lockManager.getCustomizationsConfig();
24079
24242
  const excludePatterns = config.exclude ?? [];
24243
+ const dismissals = lock.dismissals ?? [];
24244
+ const dismissed = dismissals.map((d) => ({
24245
+ message: d.original_message,
24246
+ sha: d.original_commit.slice(0, 7),
24247
+ via: d.via,
24248
+ dismissedAt: d.dismissed_at
24249
+ }));
24250
+ const coveredHashes = new Set(dismissals.flatMap((d) => d.content_hashes));
24251
+ const legacyDismissedCount = (lock.forgotten_hashes ?? []).filter((h2) => !coveredHashes.has(h2)).length;
24080
24252
  return {
24081
24253
  initialized: true,
24082
24254
  generationCount: lock.generations.length,
24083
24255
  lastGeneration,
24084
24256
  patches,
24085
24257
  unresolvedCount,
24086
- excludePatterns
24258
+ excludePatterns,
24259
+ dismissed,
24260
+ legacyDismissedCount
24087
24261
  };
24088
24262
  }
24089
- var import_promises3, import_os, import_path7, import_fs6, import_path8, import_yaml, import_crypto, import_path9, import_promises4, import_os2, import_path10, import_promises5, import_path11, import_promises6, import_path12, import_fs7, import_promises7, import_path13, import_promises8, import_os3, import_path14, import_child_process3, import_crypto2, import_fs8, import_path15, import_yaml2, import_crypto3, import_fs9, import_path16, import_fs10, import_promises9, import_path17, __defProp3, __getOwnPropNames3, __esm3, __export3, GitClient_exports, GitClient, init_GitClient, HybridReconstruction_exports, init_HybridReconstruction, PatchApplyTheirs_exports, init_PatchApplyTheirs, CREDENTIAL_PATTERNS, SENSITIVE_FILE_PATTERNS, FERN_BOT_NAME, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_SUPPORT_NAMES, LOCKFILE_HEADER, LockfileNotFoundError, LockfileManager, BINARY_EXTENSIONS, INFRASTRUCTURE_FILES, ReplayDetector, MergeAccumulator, CONFLICT_OPENER, CONFLICT_SEPARATOR, CONFLICT_CLOSER, ReplayApplicator, ReplayCommitter, FileOwnership, FirstGenerationFlow, SkipApplicationFlow, NoPatchesFlow, NormalRegenerationFlow, ReplayService, FernignoreMigrator, REPLAY_FERNIGNORE_ENTRIES, GITATTRIBUTES_ENTRIES, EMPTY_RESULT;
24263
+ var import_promises3, import_os, import_path7, import_fs6, import_path8, import_yaml, import_crypto, import_path9, import_promises4, import_os2, import_path10, import_promises5, import_path11, import_promises6, import_path12, import_fs7, import_promises7, import_path13, import_fs8, import_path14, import_promises8, import_os3, import_path15, import_child_process3, import_crypto2, import_fs9, import_path16, import_yaml2, import_crypto3, import_fs10, import_path17, import_fs11, import_promises9, import_path18, __defProp3, __getOwnPropNames3, __esm3, __export3, GitClient_exports, GitClient, init_GitClient, HybridReconstruction_exports, init_HybridReconstruction, PatchApplyTheirs_exports, init_PatchApplyTheirs, CREDENTIAL_PATTERNS, SENSITIVE_FILE_PATTERNS, FERN_BOT_NAME, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_SUPPORT_NAMES, LOCKFILE_HEADER, LockfileNotFoundError, LockfileManager, BINARY_EXTENSIONS, INFRASTRUCTURE_FILES, ReplayDetector, MergeAccumulator, CONFLICT_OPENER, CONFLICT_SEPARATOR, CONFLICT_CLOSER, ReplayApplicator, ReplayCommitter, FileOwnership, FirstGenerationFlow, SkipApplicationFlow, NoPatchesFlow, NormalRegenerationFlow, ReplayService, FernignoreMigrator, REPLAY_FERNIGNORE_ENTRIES, GITATTRIBUTES_ENTRIES, EMPTY_RESULT;
24090
24264
  var init_dist3 = __esm({
24091
- "../../node_modules/.pnpm/@fern-api+replay@0.18.0/node_modules/@fern-api/replay/dist/index.js"() {
24265
+ "../../node_modules/.pnpm/@fern-api+replay@0.19.0/node_modules/@fern-api/replay/dist/index.js"() {
24092
24266
  "use strict";
24093
24267
  init_esm4();
24094
24268
  import_promises3 = require("fs/promises");
@@ -24114,23 +24288,25 @@ var init_dist3 = __esm({
24114
24288
  import_promises7 = require("fs/promises");
24115
24289
  import_path13 = require("path");
24116
24290
  init_esm3();
24291
+ import_fs8 = require("fs");
24292
+ import_path14 = require("path");
24117
24293
  import_promises8 = require("fs/promises");
24118
24294
  import_os3 = require("os");
24119
- import_path14 = require("path");
24295
+ import_path15 = require("path");
24120
24296
  import_child_process3 = require("child_process");
24121
24297
  init_esm3();
24122
24298
  import_crypto2 = require("crypto");
24123
- import_fs8 = require("fs");
24124
- import_path15 = require("path");
24125
- init_esm3();
24126
- import_yaml2 = __toESM(require_dist3(), 1);
24127
- import_crypto3 = require("crypto");
24128
24299
  import_fs9 = require("fs");
24129
24300
  import_path16 = require("path");
24130
24301
  init_esm3();
24302
+ import_yaml2 = __toESM(require_dist3(), 1);
24303
+ import_crypto3 = require("crypto");
24131
24304
  import_fs10 = require("fs");
24132
- import_promises9 = require("fs/promises");
24133
24305
  import_path17 = require("path");
24306
+ init_esm3();
24307
+ import_fs11 = require("fs");
24308
+ import_promises9 = require("fs/promises");
24309
+ import_path18 = require("path");
24134
24310
  __defProp3 = Object.defineProperty;
24135
24311
  __getOwnPropNames3 = Object.getOwnPropertyNames;
24136
24312
  __esm3 = (fn, res) => function __init() {
@@ -24480,6 +24656,22 @@ var init_dist3 = __esm({
24480
24656
  this.lock.forgotten_hashes.push(hash);
24481
24657
  }
24482
24658
  }
24659
+ /**
24660
+ * Record a dismissed customization: visibility metadata in `dismissals`
24661
+ * plus a tombstone in `forgotten_hashes` for every content hash.
24662
+ * `forgotten_hashes` stays the only list the detector consults; the
24663
+ * metadata exists so `status` can show what was dismissed.
24664
+ */
24665
+ addDismissal(record2) {
24666
+ this.ensureLoaded();
24667
+ if (!this.lock.dismissals) {
24668
+ this.lock.dismissals = [];
24669
+ }
24670
+ this.lock.dismissals.push(record2);
24671
+ for (const hash of record2.content_hashes) {
24672
+ this.addForgottenHash(hash);
24673
+ }
24674
+ }
24483
24675
  getUnresolvedPatches() {
24484
24676
  this.ensureLoaded();
24485
24677
  return this.lock.patches.filter((p2) => p2.status === "unresolved");
@@ -24589,6 +24781,15 @@ var init_dist3 = __esm({
24589
24781
  sdkOutputDir;
24590
24782
  fernignorePatterns;
24591
24783
  warnings = [];
24784
+ /**
24785
+ * Structured degraded-state channel, mirroring `warnings`. Populated when
24786
+ * detection cannot guarantee customizations were carried forward (baseline
24787
+ * unreachable in this clone). Cleared per-run by `ReplayService.prepareReplay`
24788
+ * alongside `warnings`. Merged into `ReplayReport.degradedReasons` by each
24789
+ * flow handler. Degraded is observability only: detection results are
24790
+ * unchanged.
24791
+ */
24792
+ degradedReasons = [];
24592
24793
  constructor(git, lockManager, sdkOutputDir, fernignorePatterns = []) {
24593
24794
  this.git = git;
24594
24795
  this.lockManager = lockManager;
@@ -24659,6 +24860,10 @@ var init_dist3 = __esm({
24659
24860
  this.warnings.push(
24660
24861
  `No generation boundary found in git history and the lockfile's recorded generation (${lock.current_generation.slice(0, 7)}) matches no entry in its generation records. Customer customizations may differ from the last known generation and could be lost on the next regeneration. Run \`fern-replay bootstrap --force\` to re-initialize tracking.`
24661
24862
  );
24863
+ this.degradedReasons.push({
24864
+ code: "baseline-unresolvable",
24865
+ message: `The previous generation recorded in the lockfile (${lock.current_generation.slice(0, 7)}) could not be resolved to any reachable baseline during this run. Customizations may not have been carried forward \u2014 review the result before merging.`
24866
+ });
24662
24867
  }
24663
24868
  return { patches: [], revertedPatchIds: [] };
24664
24869
  }
@@ -24667,6 +24872,12 @@ var init_dist3 = __esm({
24667
24872
  this.warnings.push(
24668
24873
  `Generation commit ${lastGen.commit_sha.slice(0, 7)} not found in git history. Falling back to tree-diff detection (likely a shallow clone).`
24669
24874
  );
24875
+ if (lock.patches.length > 0) {
24876
+ this.degradedReasons.push({
24877
+ code: "generation-anchor-unreachable",
24878
+ message: `The previous generation (${lastGen.commit_sha.slice(0, 7)}) was not reachable during this run, and ${lock.patches.length} tracked customization(s) could not be verified against it. Customizations may not have been carried forward \u2014 review the result before merging.`
24879
+ });
24880
+ }
24670
24881
  return this.detectPatchesViaTreeDiff(
24671
24882
  lastGen,
24672
24883
  /* commitKnownMissing */
@@ -24706,54 +24917,27 @@ var init_dist3 = __esm({
24706
24917
  if (lock.patches.find((p2) => p2.original_commit === commit.sha)) {
24707
24918
  continue;
24708
24919
  }
24709
- const parents = await this.git.getCommitParents(commit.sha);
24710
- let filesOutput;
24711
- try {
24712
- filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
24713
- } catch {
24920
+ const materialized = await this.materializeCommitPatch(commit.sha);
24921
+ if (materialized.sensitiveFiles.length > 0) {
24714
24922
  this.warnings.push(
24715
- `Could not generate patch for commit ${commit.sha.slice(0, 7)} \u2014 it may be unreachable in a shallow clone. Skipping.`
24923
+ `Sensitive file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${materialized.sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
24716
24924
  );
24717
- continue;
24718
24925
  }
24719
- const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
24720
- filesOutput,
24721
- this.fernignorePatterns
24722
- );
24723
- if (sensitiveFiles.length > 0) {
24926
+ if (materialized.fernignoredFiles.length > 0) {
24724
24927
  this.warnings.push(
24725
- `Sensitive file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
24928
+ `.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${materialized.fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
24726
24929
  );
24727
24930
  }
24728
- if (fernignoredFiles.length > 0) {
24931
+ if (materialized.status === "unreachable") {
24729
24932
  this.warnings.push(
24730
- `.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
24933
+ `Could not generate patch for commit ${commit.sha.slice(0, 7)} \u2014 it may be unreachable in a shallow clone. Skipping.`
24731
24934
  );
24732
- }
24733
- if (files.length === 0) {
24734
24935
  continue;
24735
24936
  }
24736
- const wasFiltered = sensitiveFiles.length > 0 || fernignoredFiles.length > 0;
24737
- const parentSha = parents[0];
24738
- let patchContent;
24739
- if (wasFiltered && parentSha) {
24740
- try {
24741
- patchContent = await this.git.exec(["diff", parentSha, commit.sha, "--", ...files]);
24742
- } catch {
24743
- continue;
24744
- }
24745
- if (!patchContent.trim()) continue;
24746
- } else {
24747
- try {
24748
- patchContent = await this.git.formatPatch(commit.sha);
24749
- } catch {
24750
- this.warnings.push(
24751
- `Could not generate patch for commit ${commit.sha.slice(0, 7)} \u2014 it may be unreachable in a shallow clone. Skipping.`
24752
- );
24753
- continue;
24754
- }
24937
+ if (materialized.status === "empty") {
24938
+ continue;
24755
24939
  }
24756
- const contentHash = this.computeContentHash(patchContent);
24940
+ const { files, patchContent, contentHash } = materialized;
24757
24941
  if (lock.patches.find((p2) => p2.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
24758
24942
  continue;
24759
24943
  }
@@ -24830,6 +25014,63 @@ var init_dist3 = __esm({
24830
25014
  const filteredPatches = survivingPatches.filter((_2, i2) => !revertIndicesToRemove.has(i2));
24831
25015
  return { patches: filteredPatches, revertedPatchIds: [...revertedPatchIdSet] };
24832
25016
  }
25017
+ /**
25018
+ * Materialize a commit into patch content exactly as detection does.
25019
+ *
25020
+ * Pipeline: `diff-tree --name-only` → filter infrastructure / sensitive /
25021
+ * `.fernignore`d files → scoped `git diff` when files were stripped,
25022
+ * otherwise full `git format-patch` → content hash.
25023
+ *
25024
+ * This is THE definition of a commit's re-emission identity: the content
25025
+ * hash this method returns is what `detectPatchesInRange` will compute if
25026
+ * the commit re-enters the scan range (e.g. after a regen PR is merged
25027
+ * with a merge commit). Callers that tombstone a dismissed patch must use
25028
+ * this hash — the stored `content_hash` drifts every time the patch is
25029
+ * carried forward, so it does not identify the commit on re-detection.
25030
+ *
25031
+ * Never throws; failures are reported through the `status` discriminant.
25032
+ */
25033
+ async materializeCommitPatch(sha) {
25034
+ let parents;
25035
+ let filesOutput;
25036
+ try {
25037
+ parents = await this.git.getCommitParents(sha);
25038
+ filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", sha]);
25039
+ } catch {
25040
+ return { status: "unreachable", sensitiveFiles: [], fernignoredFiles: [] };
25041
+ }
25042
+ const { files, sensitiveFiles, fernignoredFiles, infrastructureFiles } = filterInfrastructureAndSensitiveFiles(filesOutput, this.fernignorePatterns);
25043
+ if (files.length === 0) {
25044
+ return { status: "empty", sensitiveFiles, fernignoredFiles };
25045
+ }
25046
+ const wasFiltered = sensitiveFiles.length > 0 || fernignoredFiles.length > 0 || infrastructureFiles.length > 0;
25047
+ const parentSha = parents[0];
25048
+ let patchContent;
25049
+ if (wasFiltered && parentSha) {
25050
+ try {
25051
+ patchContent = await this.git.exec(["diff", parentSha, sha, "--", ...files]);
25052
+ } catch {
25053
+ return { status: "empty", sensitiveFiles, fernignoredFiles };
25054
+ }
25055
+ if (!patchContent.trim()) {
25056
+ return { status: "empty", sensitiveFiles, fernignoredFiles };
25057
+ }
25058
+ } else {
25059
+ try {
25060
+ patchContent = await this.git.formatPatch(sha);
25061
+ } catch {
25062
+ return { status: "unreachable", sensitiveFiles, fernignoredFiles };
25063
+ }
25064
+ }
25065
+ return {
25066
+ status: "ok",
25067
+ files,
25068
+ sensitiveFiles,
25069
+ fernignoredFiles,
25070
+ patchContent,
25071
+ contentHash: this.computeContentHash(patchContent)
25072
+ };
25073
+ }
24833
25074
  /**
24834
25075
  * Compute content hash for deduplication.
24835
25076
  *
@@ -24934,6 +25175,13 @@ var init_dist3 = __esm({
24934
25175
  async detectPatchesViaTreeDiff(lastGen, commitKnownMissing) {
24935
25176
  const diffBase = await this.resolveDiffBase(lastGen, commitKnownMissing);
24936
25177
  if (!diffBase) {
25178
+ this.warnings.push(
25179
+ `Neither the previous generation's commit (${lastGen.commit_sha.slice(0, 7)}) nor its recorded tree was reachable during this run. Falling back to a bounded commit scan, which cannot see customizations older than the clone window. Widen the clone window (e.g. \`git fetch --unshallow\`) and re-run replay to verify customizations were carried forward.`
25180
+ );
25181
+ this.degradedReasons.push({
25182
+ code: "generation-tree-unreachable",
25183
+ message: `The previous generation (${lastGen.commit_sha.slice(0, 7)}) was not reachable during this run \u2014 neither its commit nor its recorded tree. Customizations may not have been carried forward \u2014 review the result before merging, or widen the clone window and re-run replay.`
25184
+ });
24937
25185
  return this.detectPatchesViaCommitScan();
24938
25186
  }
24939
25187
  const lockForGuard = this.lockManager.read();
@@ -25046,10 +25294,7 @@ var init_dist3 = __esm({
25046
25294
  continue;
25047
25295
  }
25048
25296
  const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
25049
- const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
25050
- filesOutput,
25051
- this.fernignorePatterns
25052
- );
25297
+ const { files, sensitiveFiles, fernignoredFiles, infrastructureFiles } = filterInfrastructureAndSensitiveFiles(filesOutput, this.fernignorePatterns);
25053
25298
  if (sensitiveFiles.length > 0) {
25054
25299
  this.warnings.push(
25055
25300
  `Sensitive file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
@@ -25060,7 +25305,8 @@ var init_dist3 = __esm({
25060
25305
  `.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
25061
25306
  );
25062
25307
  }
25063
- if ((sensitiveFiles.length > 0 || fernignoredFiles.length > 0) && files.length > 0) {
25308
+ const wasFiltered = sensitiveFiles.length > 0 || fernignoredFiles.length > 0 || infrastructureFiles.length > 0;
25309
+ if (wasFiltered && files.length > 0) {
25064
25310
  if (parents.length === 0) {
25065
25311
  continue;
25066
25312
  }
@@ -25878,6 +26124,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
25878
26124
  patchesToApply: [],
25879
26125
  newPatchIds: /* @__PURE__ */ new Set(),
25880
26126
  detectorWarnings: [],
26127
+ detectorDegraded: [],
25881
26128
  revertedCount: 0,
25882
26129
  genSha: genRecord.commit_sha,
25883
26130
  optionsSnapshot: options
@@ -25925,6 +26172,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
25925
26172
  patchesToApply: [],
25926
26173
  newPatchIds: /* @__PURE__ */ new Set(),
25927
26174
  detectorWarnings: [],
26175
+ detectorDegraded: [],
25928
26176
  revertedCount: 0,
25929
26177
  genSha: genRecord.commit_sha,
25930
26178
  optionsSnapshot: options
@@ -25960,8 +26208,10 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
25960
26208
  const previousGenerationSha = preLock.current_generation ?? null;
25961
26209
  let { patches: newPatches, revertedPatchIds } = await this.service.detector.detectNewPatches();
25962
26210
  const detectorWarnings = [...this.service.detector.warnings];
26211
+ const detectorDegraded = [...this.service.detector.degradedReasons];
25963
26212
  if (options?.dryRun) {
25964
26213
  const dryRunWarnings = [...detectorWarnings, ...this.service.warnings];
26214
+ const dryRunDegraded = dedupeDegradedReasons([...detectorDegraded, ...this.service.degradedReasons]);
25965
26215
  const preparedReport = {
25966
26216
  flow: "no-patches",
25967
26217
  patchesDetected: newPatches.length,
@@ -25971,7 +26221,9 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
25971
26221
  patchesReverted: revertedPatchIds.length,
25972
26222
  conflicts: [],
25973
26223
  wouldApply: newPatches,
25974
- warnings: dryRunWarnings.length > 0 ? dryRunWarnings : void 0
26224
+ warnings: dryRunWarnings.length > 0 ? dryRunWarnings : void 0,
26225
+ degraded: dryRunDegraded.length > 0 ? true : void 0,
26226
+ degradedReasons: dryRunDegraded.length > 0 ? dryRunDegraded : void 0
25975
26227
  };
25976
26228
  const headSha = await this.service.git.exec(["rev-parse", "HEAD"]).then((s) => s.trim()).catch(() => "");
25977
26229
  return {
@@ -26025,6 +26277,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26025
26277
  patchesToApply: newPatches,
26026
26278
  newPatchIds: new Set(newPatches.map((p2) => p2.id)),
26027
26279
  detectorWarnings,
26280
+ detectorDegraded,
26028
26281
  revertedCount: revertedPatchIds.length,
26029
26282
  genSha: genRecord.commit_sha,
26030
26283
  optionsSnapshot: options
@@ -26068,6 +26321,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26068
26321
  }
26069
26322
  }
26070
26323
  const warnings = [...detectorWarnings, ...this.service.warnings];
26324
+ const degradedReasons = [...prep._prepared.detectorDegraded, ...this.service.degradedReasons];
26071
26325
  return this.service.buildReport(
26072
26326
  "no-patches",
26073
26327
  newPatches,
@@ -26076,7 +26330,8 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26076
26330
  warnings,
26077
26331
  rebaseCounts,
26078
26332
  void 0,
26079
- prep._prepared.revertedCount
26333
+ prep._prepared.revertedCount,
26334
+ degradedReasons
26080
26335
  );
26081
26336
  }
26082
26337
  };
@@ -26091,6 +26346,10 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26091
26346
  const existingPatches2 = this.service.lockManager.getPatches();
26092
26347
  const { patches: newPatches2, revertedPatchIds: dryRunReverted } = await this.service.detector.detectNewPatches();
26093
26348
  const warnings = [...this.service.detector.warnings, ...this.service.warnings];
26349
+ const dryRunDegraded = dedupeDegradedReasons([
26350
+ ...this.service.detector.degradedReasons,
26351
+ ...this.service.degradedReasons
26352
+ ]);
26094
26353
  const allPatches2 = [...existingPatches2, ...newPatches2];
26095
26354
  const preparedReport = {
26096
26355
  flow: "normal-regeneration",
@@ -26101,7 +26360,9 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26101
26360
  patchesReverted: dryRunReverted.length,
26102
26361
  conflicts: [],
26103
26362
  wouldApply: allPatches2,
26104
- warnings: warnings.length > 0 ? warnings : void 0
26363
+ warnings: warnings.length > 0 ? warnings : void 0,
26364
+ degraded: dryRunDegraded.length > 0 ? true : void 0,
26365
+ degradedReasons: dryRunDegraded.length > 0 ? dryRunDegraded : void 0
26105
26366
  };
26106
26367
  const headSha = await this.service.git.exec(["rev-parse", "HEAD"]).then((s) => s.trim()).catch(() => "");
26107
26368
  return {
@@ -26140,6 +26401,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26140
26401
  existingPatches = this.service.lockManager.getPatches();
26141
26402
  let { patches: newPatches, revertedPatchIds } = await this.service.detector.detectNewPatches();
26142
26403
  const detectorWarnings = [...this.service.detector.warnings];
26404
+ const detectorDegraded = [...this.service.detector.degradedReasons];
26143
26405
  if (removedByPreRebase.length > 0) {
26144
26406
  const removedOriginalCommits = new Set(removedByPreRebase.map((p2) => p2.original_commit));
26145
26407
  const removedOriginalMessages = new Set(removedByPreRebase.map((p2) => p2.original_message));
@@ -26180,6 +26442,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26180
26442
  newPatchIds: new Set(newPatches.map((p2) => p2.id)),
26181
26443
  preRebaseCounts,
26182
26444
  detectorWarnings,
26445
+ detectorDegraded,
26183
26446
  revertedCount: revertedPatchIds.length,
26184
26447
  genSha: genRecord.commit_sha,
26185
26448
  optionsSnapshot: options
@@ -26228,6 +26491,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26228
26491
  await this.service.committer.commitReplay(appliedCount, allPatches, void 0, { buckets });
26229
26492
  }
26230
26493
  const warnings = [...detectorWarnings, ...this.service.warnings];
26494
+ const degradedReasons = [...prep._prepared.detectorDegraded, ...this.service.degradedReasons];
26231
26495
  return this.service.buildReport(
26232
26496
  "normal-regeneration",
26233
26497
  allPatches,
@@ -26236,7 +26500,8 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26236
26500
  warnings,
26237
26501
  rebaseCounts,
26238
26502
  prep._prepared.preRebaseCounts,
26239
- prep._prepared.revertedCount
26503
+ prep._prepared.revertedCount,
26504
+ degradedReasons
26240
26505
  );
26241
26506
  }
26242
26507
  };
@@ -26267,6 +26532,16 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26267
26532
  * @internal Used by Flow implementations in `src/flows/`.
26268
26533
  */
26269
26534
  warnings = [];
26535
+ /**
26536
+ * Service-level structured degraded reasons, mirroring `warnings`.
26537
+ * Populated at apply time (e.g. `recordUnreachableBaseWarnings` when a
26538
+ * patch's base-generation tree is unreachable). Merged with
26539
+ * `detector.degradedReasons` into `ReplayReport.degradedReasons` by each
26540
+ * flow handler. Cleared at the top of `prepareReplay()`.
26541
+ *
26542
+ * @internal Used by Flow implementations in `src/flows/`.
26543
+ */
26544
+ degradedReasons = [];
26270
26545
  /**
26271
26546
  * @internal Test-only accessor.
26272
26547
  * Returns the ReplayApplicator instance used for the last run. Tests use this
@@ -26310,7 +26585,10 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26310
26585
  async prepareReplay(options) {
26311
26586
  this.warnings = [];
26312
26587
  this.detector.warnings.length = 0;
26588
+ this.degradedReasons = [];
26589
+ this.detector.degradedReasons.length = 0;
26313
26590
  this.cleanseLegacyFernignoreEntries();
26591
+ this.cleanseInfrastructureFileEntries();
26314
26592
  return this.selectFlow(options).prepare(options);
26315
26593
  }
26316
26594
  /**
@@ -26364,6 +26642,50 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
26364
26642
  this.lockManager.save();
26365
26643
  }
26366
26644
  }
26645
+ /**
26646
+ * Migration step: strips infrastructure file diffs (`.fernignore`, `.fern/*`)
26647
+ * from existing patches' `patch_content`. These diffs were bundled by older
26648
+ * detection logic that did not scope `git diff` when only infrastructure files
26649
+ * were stripped. Patches that end up with no surviving diff sections are
26650
+ * removed entirely.
26651
+ *
26652
+ * Idempotent: a second run is a no-op because the first run already removed
26653
+ * all infrastructure sections. Per-patch try/catch ensures isolation.
26654
+ */
26655
+ cleanseInfrastructureFileEntries() {
26656
+ if (!this.lockManager.exists()) return;
26657
+ this.lockManager.read();
26658
+ let lockfileMutated = false;
26659
+ const patches = this.lockManager.getPatches();
26660
+ for (const patch of patches) {
26661
+ try {
26662
+ const result = computeInfrastructureFileCleanse(
26663
+ patch,
26664
+ (content) => this.detector.computeContentHash(content)
26665
+ );
26666
+ if (result.unchanged) continue;
26667
+ if (result.remove) {
26668
+ this.lockManager.removePatch(patch.id);
26669
+ this.warnings.push(
26670
+ `Stripped infrastructure file diffs from patch ${patch.id}: patch contained only infrastructure file changes (${result.strippedPaths.join(", ")}) \u2014 removed.`
26671
+ );
26672
+ } else {
26673
+ this.lockManager.updatePatch(patch.id, {
26674
+ patch_content: result.patch_content,
26675
+ content_hash: result.content_hash
26676
+ });
26677
+ this.warnings.push(
26678
+ `Stripped infrastructure file diffs from patch ${patch.id}: removed bundled diffs for ${result.strippedPaths.join(", ")}.`
26679
+ );
26680
+ }
26681
+ lockfileMutated = true;
26682
+ } catch {
26683
+ }
26684
+ }
26685
+ if (lockfileMutated) {
26686
+ this.lockManager.save();
26687
+ }
26688
+ }
26367
26689
  /**
26368
26690
  * Phase 2 of the two-phase replay flow. Applies patches, rebases them against
26369
26691
  * the generation, saves the lockfile, and commits `[fern-replay]` (or stages
@@ -27136,6 +27458,12 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
27136
27458
  );
27137
27459
  }
27138
27460
  }
27461
+ if (warned.size > 0) {
27462
+ this.degradedReasons.push({
27463
+ code: "patch-base-unreachable",
27464
+ message: `${warned.size} customization file(s) could not be checked against the generation they were made on because that generation's tree was not reachable during this run. Customizations may not have been carried forward \u2014 review the result before merging, or widen the clone window and re-run replay.`
27465
+ });
27466
+ }
27139
27467
  }
27140
27468
  /**
27141
27469
  * After applyPatches(), strip conflict markers from conflicting files
@@ -27179,12 +27507,11 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
27179
27507
  }
27180
27508
  /** @internal Used by Flow implementations in `src/flows/`. */
27181
27509
  readFernignorePatterns() {
27182
- const fernignorePath = (0, import_path13.join)(this.outputDir, ".fernignore");
27183
- if (!(0, import_fs7.existsSync)(fernignorePath)) return [];
27184
- return (0, import_fs7.readFileSync)(fernignorePath, "utf-8").split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
27510
+ return readFernignorePatterns(this.outputDir);
27185
27511
  }
27186
27512
  /** @internal Used by Flow implementations in `src/flows/`. */
27187
- buildReport(flow, patches, results, options, warnings, rebaseCounts, preRebaseCounts, patchesReverted) {
27513
+ buildReport(flow, patches, results, options, warnings, rebaseCounts, preRebaseCounts, patchesReverted, degradedReasons) {
27514
+ const degraded = dedupeDegradedReasons(degradedReasons ?? []);
27188
27515
  const conflictResults = results.filter((r2) => r2.status === "conflict");
27189
27516
  const conflictDetails = conflictResults.map((r2) => {
27190
27517
  const conflictFiles = r2.fileResults?.filter((f) => f.status === "conflict") ?? [];
@@ -27224,7 +27551,9 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
27224
27551
  conflictDetails: r2.fileResults?.filter((f) => f.status === "conflict") ?? []
27225
27552
  })) : void 0,
27226
27553
  wouldApply: options?.dryRun ? patches : void 0,
27227
- warnings: warnings && warnings.length > 0 ? warnings : void 0
27554
+ warnings: warnings && warnings.length > 0 ? warnings : void 0,
27555
+ degraded: degraded.length > 0 ? true : void 0,
27556
+ degradedReasons: degraded.length > 0 ? degraded : void 0
27228
27557
  };
27229
27558
  }
27230
27559
  };
@@ -27238,14 +27567,14 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
27238
27567
  this.outputDir = outputDir;
27239
27568
  }
27240
27569
  fernignoreExists() {
27241
- return (0, import_fs8.existsSync)((0, import_path15.join)(this.outputDir, ".fernignore"));
27570
+ return (0, import_fs9.existsSync)((0, import_path16.join)(this.outputDir, ".fernignore"));
27242
27571
  }
27243
27572
  readFernignorePatterns() {
27244
- const fernignorePath = (0, import_path15.join)(this.outputDir, ".fernignore");
27245
- if (!(0, import_fs8.existsSync)(fernignorePath)) {
27573
+ const fernignorePath = (0, import_path16.join)(this.outputDir, ".fernignore");
27574
+ if (!(0, import_fs9.existsSync)(fernignorePath)) {
27246
27575
  return [];
27247
27576
  }
27248
- const content = (0, import_fs8.readFileSync)(fernignorePath, "utf-8");
27577
+ const content = (0, import_fs9.readFileSync)(fernignorePath, "utf-8");
27249
27578
  return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
27250
27579
  }
27251
27580
  /** Analyze .fernignore patterns vs git history. Creates synthetic patches for files differing from pristine generation. */
@@ -27350,16 +27679,16 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
27350
27679
  return results;
27351
27680
  }
27352
27681
  readFileContent(filePath) {
27353
- const fullPath = (0, import_path15.join)(this.outputDir, filePath);
27354
- if (!(0, import_fs8.existsSync)(fullPath)) {
27682
+ const fullPath = (0, import_path16.join)(this.outputDir, filePath);
27683
+ if (!(0, import_fs9.existsSync)(fullPath)) {
27355
27684
  return null;
27356
27685
  }
27357
27686
  try {
27358
- const stat2 = (0, import_fs8.statSync)(fullPath);
27359
- if (stat2.isDirectory()) {
27687
+ const stat = (0, import_fs9.statSync)(fullPath);
27688
+ if (stat.isDirectory()) {
27360
27689
  return null;
27361
27690
  }
27362
- return (0, import_fs8.readFileSync)(fullPath, "utf-8");
27691
+ return (0, import_fs9.readFileSync)(fullPath, "utf-8");
27363
27692
  } catch {
27364
27693
  return null;
27365
27694
  }
@@ -27415,25 +27744,26 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
27415
27744
  };
27416
27745
  }
27417
27746
  movePatternsToReplayYml(patterns) {
27418
- const replayYmlPath = (0, import_path15.join)(this.outputDir, ".fern", "replay.yml");
27747
+ const replayYmlPath = (0, import_path16.join)(this.outputDir, ".fern", "replay.yml");
27419
27748
  let config = {};
27420
- if ((0, import_fs8.existsSync)(replayYmlPath)) {
27421
- const content = (0, import_fs8.readFileSync)(replayYmlPath, "utf-8");
27749
+ if ((0, import_fs9.existsSync)(replayYmlPath)) {
27750
+ const content = (0, import_fs9.readFileSync)(replayYmlPath, "utf-8");
27422
27751
  config = (0, import_yaml2.parse)(content) ?? {};
27423
27752
  }
27424
27753
  const existing = config.exclude ?? [];
27425
27754
  const merged = [.../* @__PURE__ */ new Set([...existing, ...patterns])];
27426
27755
  config.exclude = merged;
27427
- const dir = (0, import_path15.dirname)(replayYmlPath);
27428
- if (!(0, import_fs8.existsSync)(dir)) {
27429
- (0, import_fs8.mkdirSync)(dir, { recursive: true });
27756
+ const dir = (0, import_path16.dirname)(replayYmlPath);
27757
+ if (!(0, import_fs9.existsSync)(dir)) {
27758
+ (0, import_fs9.mkdirSync)(dir, { recursive: true });
27430
27759
  }
27431
- (0, import_fs8.writeFileSync)(replayYmlPath, (0, import_yaml2.stringify)(config, { lineWidth: 0 }), "utf-8");
27760
+ (0, import_fs9.writeFileSync)(replayYmlPath, (0, import_yaml2.stringify)(config, { lineWidth: 0 }), "utf-8");
27432
27761
  }
27433
27762
  };
27434
27763
  init_GitClient();
27435
27764
  REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock", ".fern/replay.yml", ".gitattributes"];
27436
27765
  GITATTRIBUTES_ENTRIES = [".fern/replay.lock linguist-generated=true"];
27766
+ init_GitClient();
27437
27767
  EMPTY_RESULT = {
27438
27768
  initialized: false,
27439
27769
  removed: [],
@@ -27471,15 +27801,15 @@ var require_windows = __commonJS({
27471
27801
  }
27472
27802
  return false;
27473
27803
  }
27474
- function checkStat(stat2, path5, options) {
27475
- if (!stat2.isSymbolicLink() && !stat2.isFile()) {
27804
+ function checkStat(stat, path5, options) {
27805
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
27476
27806
  return false;
27477
27807
  }
27478
27808
  return checkPathExt(path5, options);
27479
27809
  }
27480
27810
  function isexe(path5, options, cb) {
27481
- fs3.stat(path5, function(er, stat2) {
27482
- cb(er, er ? false : checkStat(stat2, path5, options));
27811
+ fs3.stat(path5, function(er, stat) {
27812
+ cb(er, er ? false : checkStat(stat, path5, options));
27483
27813
  });
27484
27814
  }
27485
27815
  function sync(path5, options) {
@@ -27496,20 +27826,20 @@ var require_mode = __commonJS({
27496
27826
  isexe.sync = sync;
27497
27827
  var fs3 = require("fs");
27498
27828
  function isexe(path5, options, cb) {
27499
- fs3.stat(path5, function(er, stat2) {
27500
- cb(er, er ? false : checkStat(stat2, options));
27829
+ fs3.stat(path5, function(er, stat) {
27830
+ cb(er, er ? false : checkStat(stat, options));
27501
27831
  });
27502
27832
  }
27503
27833
  function sync(path5, options) {
27504
27834
  return checkStat(fs3.statSync(path5), options);
27505
27835
  }
27506
- function checkStat(stat2, options) {
27507
- return stat2.isFile() && checkMode(stat2, options);
27836
+ function checkStat(stat, options) {
27837
+ return stat.isFile() && checkMode(stat, options);
27508
27838
  }
27509
- function checkMode(stat2, options) {
27510
- var mod = stat2.mode;
27511
- var uid = stat2.uid;
27512
- var gid = stat2.gid;
27839
+ function checkMode(stat, options) {
27840
+ var mod = stat.mode;
27841
+ var uid = stat.uid;
27842
+ var gid = stat.gid;
27513
27843
  var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
27514
27844
  var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
27515
27845
  var u = parseInt("100", 8);
@@ -30009,11 +30339,11 @@ function cwd() {
30009
30339
  var import_promises = require("fs/promises");
30010
30340
  async function doesPathExist(filepath, mode) {
30011
30341
  try {
30012
- const stat2 = await (0, import_promises.lstat)(filepath);
30013
- if (mode === "file" && !stat2.isFile()) {
30342
+ const stat = await (0, import_promises.lstat)(filepath);
30343
+ if (mode === "file" && !stat.isFile()) {
30014
30344
  return false;
30015
30345
  }
30016
- if (mode === "directory" && !stat2.isDirectory()) {
30346
+ if (mode === "directory" && !stat.isDirectory()) {
30017
30347
  return false;
30018
30348
  }
30019
30349
  return true;
@@ -30029,9 +30359,9 @@ function resolve(...paths) {
30029
30359
  }
30030
30360
 
30031
30361
  // src/cli.ts
30032
- var import_fs16 = __toESM(require("fs"));
30362
+ var import_fs17 = __toESM(require("fs"));
30033
30363
  var import_promises18 = require("fs/promises");
30034
- var import_path25 = __toESM(require("path"));
30364
+ var import_path26 = __toESM(require("path"));
30035
30365
 
30036
30366
  // ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/yerror.js
30037
30367
  var YError = class _YError extends Error {
@@ -39753,23 +40083,23 @@ async function githubPush(params) {
39753
40083
 
39754
40084
  // src/replay/replay-forget.ts
39755
40085
  init_dist3();
39756
- function replayForget(params) {
40086
+ async function replayForget(params) {
39757
40087
  return forget(params.outputDir, params.options);
39758
40088
  }
39759
40089
 
39760
40090
  // src/replay/replay-init.ts
39761
40091
  init_dist3();
39762
- var import_fs11 = require("fs");
39763
- var import_path19 = require("path");
40092
+ var import_fs12 = require("fs");
40093
+ var import_path20 = require("path");
39764
40094
  var import_tmp_promise2 = __toESM(require_tmp_promise());
39765
40095
 
39766
40096
  // src/replay/fernignore.ts
39767
40097
  var import_promises10 = require("fs/promises");
39768
- var import_path18 = require("path");
40098
+ var import_path19 = require("path");
39769
40099
  var REPLAY_FERNIGNORE_ENTRIES2 = [".fern/replay.lock", ".fern/replay.yml", ".gitattributes"];
39770
40100
  var GITATTRIBUTES_ENTRIES2 = [".fern/replay.lock linguist-generated=true"];
39771
40101
  async function ensureReplayFernignoreEntries(outputDir) {
39772
- const fernignorePath = (0, import_path18.join)(outputDir, ".fernignore");
40102
+ const fernignorePath = (0, import_path19.join)(outputDir, ".fernignore");
39773
40103
  let content = "";
39774
40104
  try {
39775
40105
  content = await (0, import_promises10.readFile)(fernignorePath, "utf-8");
@@ -39785,7 +40115,7 @@ async function ensureReplayFernignoreEntries(outputDir) {
39785
40115
  return false;
39786
40116
  }
39787
40117
  async function ensureGitattributesEntries2(outputDir) {
39788
- const gitattributesPath = (0, import_path18.join)(outputDir, ".gitattributes");
40118
+ const gitattributesPath = (0, import_path19.join)(outputDir, ".gitattributes");
39789
40119
  let content = "";
39790
40120
  try {
39791
40121
  content = await (0, import_promises10.readFile)(gitattributesPath, "utf-8");
@@ -39822,8 +40152,8 @@ async function replayInit(params) {
39822
40152
  if (dryRun) {
39823
40153
  return { bootstrap: bootstrapResult, fernignoreEntries: [], gitattributesEntries: [] };
39824
40154
  }
39825
- const lockfilePath = (0, import_path19.join)(repoPath, ".fern", "replay.lock");
39826
- const lockfileContent = (0, import_fs11.existsSync)(lockfilePath) ? (0, import_fs11.readFileSync)(lockfilePath, "utf-8") : void 0;
40155
+ const lockfilePath = (0, import_path20.join)(repoPath, ".fern", "replay.lock");
40156
+ const lockfileContent = (0, import_fs12.existsSync)(lockfilePath) ? (0, import_fs12.readFileSync)(lockfilePath, "utf-8") : void 0;
39827
40157
  return {
39828
40158
  bootstrap: bootstrapResult,
39829
40159
  lockfileContent,
@@ -39943,14 +40273,14 @@ init_dist3();
39943
40273
 
39944
40274
  // src/replay/replay-run.ts
39945
40275
  init_dist3();
39946
- var import_fs12 = require("fs");
39947
- var import_path20 = require("path");
40276
+ var import_fs13 = require("fs");
40277
+ var import_path21 = require("path");
39948
40278
  async function replayPrepare(params, state) {
39949
40279
  const { outputDir, cliVersion, generatorVersions, stageOnly = false, skipApplication, logger } = params;
39950
- const lockfilePath = (0, import_path20.join)(outputDir, ".fern", "replay.lock");
40280
+ const lockfilePath = (0, import_path21.join)(outputDir, ".fern", "replay.lock");
39951
40281
  let autoBootstrapped = false;
39952
40282
  let bootstrapAttempted = false;
39953
- if (!(0, import_fs12.existsSync)(lockfilePath)) {
40283
+ if (!(0, import_fs13.existsSync)(lockfilePath)) {
39954
40284
  if (process.env.FERN_DISABLE_AUTO_BOOTSTRAP === "true" || process.env.FERN_DISABLE_AUTO_BOOTSTRAP === "1") {
39955
40285
  return null;
39956
40286
  }
@@ -39971,8 +40301,8 @@ async function replayPrepare(params, state) {
39971
40301
  } catch (error) {
39972
40302
  logger?.warn("Replay auto-bootstrap failed, continuing without replay: " + String(error));
39973
40303
  try {
39974
- if ((0, import_fs12.existsSync)(lockfilePath)) {
39975
- (0, import_fs12.unlinkSync)(lockfilePath);
40304
+ if ((0, import_fs13.existsSync)(lockfilePath)) {
40305
+ (0, import_fs13.unlinkSync)(lockfilePath);
39976
40306
  }
39977
40307
  } catch {
39978
40308
  }
@@ -40127,9 +40457,9 @@ var FERN_BOT_LOGIN2 = "fern-api[bot]";
40127
40457
 
40128
40458
  // src/pipeline/steps/AutoVersionStep.ts
40129
40459
  var import_child_process4 = require("child_process");
40130
- var import_fs14 = require("fs");
40460
+ var import_fs15 = require("fs");
40131
40461
  var import_promises15 = require("fs/promises");
40132
- var import_path22 = require("path");
40462
+ var import_path23 = require("path");
40133
40463
 
40134
40464
  // ../commons/logging-execa/lib/loggingExeca.js
40135
40465
  var import_execa = __toESM(require_execa(), 1);
@@ -40186,136 +40516,10 @@ async function loggingExeca(logger, executable, args = [], { doNotPipeOutput = f
40186
40516
  return result;
40187
40517
  }
40188
40518
 
40189
- // ../cli/task-context/lib/CliError.js
40190
- var CliError = class _CliError extends Error {
40191
- code;
40192
- docsLink;
40193
- constructor({ message, code, docsLink }) {
40194
- super(message);
40195
- Object.setPrototypeOf(this, new.target.prototype);
40196
- if (Error.captureStackTrace) {
40197
- Error.captureStackTrace(this, this.constructor);
40198
- }
40199
- this.name = "CliError";
40200
- this.code = code;
40201
- this.docsLink = docsLink;
40202
- }
40203
- static authRequired(message) {
40204
- return new _CliError({
40205
- message: message ?? "Authentication required. Please run 'fern login' or set the FERN_TOKEN environment variable.",
40206
- code: _CliError.Code.AuthError
40207
- });
40208
- }
40209
- static unauthorized(message) {
40210
- return new _CliError({
40211
- message: message ?? "Unauthorized. Please run 'fern auth login' or set the FERN_TOKEN environment variable.",
40212
- code: _CliError.Code.AuthError
40213
- });
40214
- }
40215
- static notFound(message) {
40216
- return new _CliError({ message, code: _CliError.Code.ConfigError });
40217
- }
40218
- static badRequest(message) {
40219
- return new _CliError({ message, code: _CliError.Code.NetworkError });
40220
- }
40221
- static validationError(message) {
40222
- return new _CliError({ message, code: _CliError.Code.ValidationError });
40223
- }
40224
- static internalError(message) {
40225
- return new _CliError({ message, code: _CliError.Code.InternalError });
40226
- }
40227
- };
40228
- (function(CliError2) {
40229
- CliError2.Code = {
40230
- InternalError: "INTERNAL_ERROR",
40231
- ResolutionError: "RESOLUTION_ERROR",
40232
- IrConversionError: "IR_CONVERSION_ERROR",
40233
- ContainerError: "CONTAINER_ERROR",
40234
- VersionError: "VERSION_ERROR",
40235
- ParseError: "PARSE_ERROR",
40236
- EnvironmentError: "ENVIRONMENT_ERROR",
40237
- ReferenceError: "REFERENCE_ERROR",
40238
- ValidationError: "VALIDATION_ERROR",
40239
- NetworkError: "NETWORK_ERROR",
40240
- AuthError: "AUTH_ERROR",
40241
- ConfigError: "CONFIG_ERROR",
40242
- UserError: "USER_ERROR"
40243
- };
40244
- })(CliError || (CliError = {}));
40245
- var SENTRY_REPORTABLE = {
40246
- [CliError.Code.InternalError]: true,
40247
- [CliError.Code.ResolutionError]: true,
40248
- [CliError.Code.IrConversionError]: true,
40249
- [CliError.Code.ContainerError]: false,
40250
- [CliError.Code.VersionError]: false,
40251
- [CliError.Code.ParseError]: false,
40252
- [CliError.Code.EnvironmentError]: false,
40253
- [CliError.Code.ReferenceError]: false,
40254
- [CliError.Code.ValidationError]: false,
40255
- [CliError.Code.NetworkError]: false,
40256
- [CliError.Code.AuthError]: false,
40257
- [CliError.Code.ConfigError]: false,
40258
- [CliError.Code.UserError]: false
40259
- };
40260
-
40261
- // ../cli/logger/lib/LogLevel.js
40262
- var LogLevel2 = {
40263
- Trace: "trace",
40264
- Debug: "debug",
40265
- Info: "info",
40266
- Warn: "warn",
40267
- Error: "error"
40268
- };
40269
- var LOG_LEVELS = Object.values(LogLevel2);
40270
-
40271
- // ../cli/logger/lib/createLogger.js
40272
- var LoggerImpl = class {
40273
- log;
40274
- enabled;
40275
- constructor(log, enabled = true) {
40276
- this.log = log;
40277
- this.enabled = enabled;
40278
- }
40279
- disable() {
40280
- this.enabled = false;
40281
- }
40282
- enable() {
40283
- this.enabled = true;
40284
- }
40285
- debug(...args) {
40286
- if (this.enabled) {
40287
- this.log(LogLevel2.Debug, ...args);
40288
- }
40289
- }
40290
- info(...args) {
40291
- if (this.enabled) {
40292
- this.log(LogLevel2.Info, ...args);
40293
- }
40294
- }
40295
- warn(...args) {
40296
- if (this.enabled) {
40297
- this.log(LogLevel2.Warn, ...args);
40298
- }
40299
- }
40300
- error(...args) {
40301
- if (this.enabled) {
40302
- this.log(LogLevel2.Error, ...args);
40303
- }
40304
- }
40305
- trace(...args) {
40306
- if (this.enabled) {
40307
- this.log(LogLevel2.Trace, ...args);
40308
- }
40309
- }
40310
- };
40311
- function createLogger4(log) {
40312
- return new LoggerImpl(log);
40313
- }
40314
-
40315
40519
  // src/autoversion/AutoVersioningService.ts
40316
- var import_fs13 = require("fs");
40520
+ var import_fs14 = require("fs");
40317
40521
  var import_promises14 = require("fs/promises");
40318
- var import_path21 = require("path");
40522
+ var import_path22 = require("path");
40319
40523
  var import_semver = __toESM(require_semver2());
40320
40524
  var AutoVersioningException = class extends Error {
40321
40525
  /**
@@ -40353,6 +40557,43 @@ function countFilesInDiff(diffContent) {
40353
40557
  function formatSizeKB(charLength) {
40354
40558
  return (charLength / 1024).toFixed(1);
40355
40559
  }
40560
+ var EXCLUDED_DIRECTORIES = /* @__PURE__ */ new Set([
40561
+ // Version control
40562
+ ".git",
40563
+ // Dependency directories
40564
+ "vendor",
40565
+ "node_modules",
40566
+ "Pods",
40567
+ // Python environments and caches
40568
+ ".venv",
40569
+ "venv",
40570
+ "__pycache__",
40571
+ ".tox",
40572
+ ".mypy_cache",
40573
+ ".pytest_cache",
40574
+ ".ruff_cache",
40575
+ // Build output directories
40576
+ "build",
40577
+ "dist",
40578
+ "out",
40579
+ "target",
40580
+ "bin",
40581
+ "obj",
40582
+ // Build tool caches
40583
+ ".gradle",
40584
+ ".mvn",
40585
+ // Framework build caches
40586
+ ".next",
40587
+ ".nuxt",
40588
+ ".cache",
40589
+ // IDE directories
40590
+ ".idea",
40591
+ ".vscode",
40592
+ ".eclipse",
40593
+ // Language-specific tool caches
40594
+ ".dart_tool",
40595
+ ".swiftpm"
40596
+ ]);
40356
40597
  var EXCLUDED_FILE_PATTERNS = [
40357
40598
  // Documentation / generated reference
40358
40599
  /(?:^|\/)reference\.md$/i,
@@ -40962,34 +41203,37 @@ var AutoVersioningService = class _AutoVersioningService {
40962
41203
  */
40963
41204
  async replaceMagicVersion(workingDirectory, mappedMagicVersion, finalVersion) {
40964
41205
  this.logger.debug(`Replacing placeholder version ${mappedMagicVersion} with final version: ${finalVersion}`);
40965
- const sedCommand = `s/${this.escapeForSed(mappedMagicVersion)}/${this.escapeForSed(finalVersion)}/g`;
40966
- let isGNUSed = false;
40967
- try {
40968
- await loggingExeca(this.logger, "sed", ["--version"], {
40969
- doNotPipeOutput: true
40970
- });
40971
- isGNUSed = true;
40972
- } catch {
40973
- isGNUSed = false;
40974
- }
40975
- let command;
40976
- if (isGNUSed) {
40977
- command = `find "${workingDirectory}" -type f -not -path "*/.git/*" -exec sed -i '${sedCommand}' {} +`;
40978
- } else {
40979
- command = `find "${workingDirectory}" -type f -not -path "*/.git/*" -exec sed -i '' '${sedCommand}' {} +`;
40980
- }
41206
+ const files = await this.walkDirectory(workingDirectory, () => true);
41207
+ const replaceInFile = async (filePath) => {
41208
+ if (await this.isBinaryFile(filePath)) {
41209
+ return false;
41210
+ }
41211
+ const content = await (0, import_promises14.readFile)(filePath, "utf-8");
41212
+ if (!content.includes(mappedMagicVersion)) {
41213
+ return false;
41214
+ }
41215
+ const updated = content.split(mappedMagicVersion).join(finalVersion);
41216
+ await (0, import_promises14.writeFile)(filePath, updated, "utf-8");
41217
+ return true;
41218
+ };
41219
+ const results = await this.processInParallel(files, replaceInFile);
41220
+ const replacedCount = results.filter(Boolean).length;
41221
+ this.logger.debug(`Placeholder version replaced successfully in ${replacedCount} file(s)`);
41222
+ }
41223
+ async isBinaryFile(filePath) {
41224
+ const fileHandle = await (0, import_promises14.open)(filePath, "r");
40981
41225
  try {
40982
- await loggingExeca(this.logger, "bash", ["-c", command], {
40983
- cwd: workingDirectory,
40984
- doNotPipeOutput: true
40985
- });
40986
- } catch (error) {
40987
- throw new CliError({
40988
- message: `Failed to replace placeholder version in generated files: ${extractErrorMessage(error)}`,
40989
- code: CliError.Code.UserError
40990
- });
41226
+ const header = Buffer.alloc(8192);
41227
+ const { bytesRead } = await fileHandle.read(header, 0, 8192, 0);
41228
+ for (let i2 = 0; i2 < bytesRead; i2++) {
41229
+ if (header[i2] === 0) {
41230
+ return true;
41231
+ }
41232
+ }
41233
+ return false;
41234
+ } finally {
41235
+ await fileHandle.close();
40991
41236
  }
40992
- this.logger.debug("Placeholder version replaced successfully");
40993
41237
  }
40994
41238
  /**
40995
41239
  * Adds /vN suffix to Go module paths and import statements when the computed
@@ -41009,8 +41253,8 @@ var AutoVersioningService = class _AutoVersioningService {
41009
41253
  );
41010
41254
  return;
41011
41255
  }
41012
- const goModPath = (0, import_path21.join)(workingDirectory, "go.mod");
41013
- if (!(0, import_fs13.existsSync)(goModPath)) {
41256
+ const goModPath = (0, import_path22.join)(workingDirectory, "go.mod");
41257
+ if (!(0, import_fs14.existsSync)(goModPath)) {
41014
41258
  this.logger.debug(`No go.mod found in ${workingDirectory}, skipping Go module path update`);
41015
41259
  return;
41016
41260
  }
@@ -41079,10 +41323,13 @@ var AutoVersioningService = class _AutoVersioningService {
41079
41323
  const results = [];
41080
41324
  const entries2 = await (0, import_promises14.readdir)(dir);
41081
41325
  for (const entry of entries2) {
41082
- const fullPath = (0, import_path21.join)(dir, entry);
41083
- const entryStat = await (0, import_promises14.stat)(fullPath);
41326
+ const fullPath = (0, import_path22.join)(dir, entry);
41327
+ const entryStat = await (0, import_promises14.lstat)(fullPath);
41328
+ if (entryStat.isSymbolicLink()) {
41329
+ continue;
41330
+ }
41084
41331
  if (entryStat.isDirectory()) {
41085
- if (entry === ".git" || entry === "vendor") {
41332
+ if (EXCLUDED_DIRECTORIES.has(entry)) {
41086
41333
  continue;
41087
41334
  }
41088
41335
  const subResults = await this.walkDirectory(fullPath, filter2);
@@ -41093,14 +41340,22 @@ var AutoVersioningService = class _AutoVersioningService {
41093
41340
  }
41094
41341
  return results;
41095
41342
  }
41343
+ static CONCURRENCY_LIMIT = 32;
41344
+ async processInParallel(items, fn) {
41345
+ const results = [];
41346
+ for (let i2 = 0; i2 < items.length; i2 += _AutoVersioningService.CONCURRENCY_LIMIT) {
41347
+ const batch = items.slice(i2, i2 + _AutoVersioningService.CONCURRENCY_LIMIT);
41348
+ const batchResults = await Promise.all(batch.map(fn));
41349
+ results.push(...batchResults);
41350
+ }
41351
+ return results;
41352
+ }
41096
41353
  /**
41097
41354
  * Adds a version suffix to import paths in all .go files in the repository.
41098
41355
  */
41099
41356
  async addSuffixToGoFiles(repoRoot, modulePath, suffix) {
41100
- const goFiles = await this.walkDirectory(repoRoot, (filePath) => (0, import_path21.extname)(filePath) === ".go");
41101
- for (const filePath of goFiles) {
41102
- await this.addSuffixToGoFile(filePath, modulePath, suffix);
41103
- }
41357
+ const goFiles = await this.walkDirectory(repoRoot, (filePath) => (0, import_path22.extname)(filePath) === ".go");
41358
+ await this.processInParallel(goFiles, (filePath) => this.addSuffixToGoFile(filePath, modulePath, suffix));
41104
41359
  }
41105
41360
  /**
41106
41361
  * Adds a version suffix to import paths in a single .go file.
@@ -41140,12 +41395,6 @@ var AutoVersioningService = class _AutoVersioningService {
41140
41395
  this.logger.debug(`Updated Go imports in ${filePath}`);
41141
41396
  }
41142
41397
  }
41143
- /**
41144
- * Escapes special characters for use in sed command.
41145
- */
41146
- escapeForSed(str) {
41147
- return str.replace(/[/&]/g, "\\$&");
41148
- }
41149
41398
  /**
41150
41399
  * Extracts the file path from a diff file section.
41151
41400
  * Parses the "diff --git a/path b/path" header line.
@@ -41297,7 +41546,7 @@ var AutoVersionStep = class extends BaseStep {
41297
41546
  const { service, language, mappedMagicVersion, commit } = params;
41298
41547
  const initialVersion = this.config.baseVersion ?? (mappedMagicVersion.startsWith("v") ? "v0.0.1" : "0.0.1");
41299
41548
  if (!isValidSemver(initialVersion)) {
41300
- const errorMessage = `AutoVersionStep: baseVersion ${JSON.stringify(initialVersion)} is not a valid semver string (expected e.g. "1.2.3" or "v1.2.3"). Refusing to run to avoid shell injection into the placeholder-rewrite step.`;
41549
+ const errorMessage = `AutoVersionStep: baseVersion ${JSON.stringify(initialVersion)} is not a valid semver string (expected e.g. "1.2.3" or "v1.2.3"). Refusing to run.`;
41301
41550
  this.logger.error(errorMessage);
41302
41551
  return {
41303
41552
  executed: true,
@@ -41772,7 +42021,7 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
41772
42021
  }
41773
42022
  async prependChangelogEntry(params) {
41774
42023
  const { version: version2, entry } = params;
41775
- const changelogPath = (0, import_path22.join)(this.outputDir, "changelog.md");
42024
+ const changelogPath = (0, import_path23.join)(this.outputDir, "changelog.md");
41776
42025
  const now = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
41777
42026
  const header = `## [${version2}] - ${now}
41778
42027
  `;
@@ -41780,7 +42029,7 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
41780
42029
 
41781
42030
  `;
41782
42031
  let existing = "";
41783
- if ((0, import_fs14.existsSync)(changelogPath)) {
42032
+ if ((0, import_fs15.existsSync)(changelogPath)) {
41784
42033
  existing = await (0, import_promises15.readFile)(changelogPath, "utf-8");
41785
42034
  }
41786
42035
  let output;
@@ -42073,7 +42322,7 @@ function tryRevParse(cwd2, rev) {
42073
42322
 
42074
42323
  // src/pipeline/steps/GithubStep.ts
42075
42324
  var import_promises16 = require("fs/promises");
42076
- var import_path23 = require("path");
42325
+ var import_path24 = require("path");
42077
42326
 
42078
42327
  // src/pipeline/github/createReplayBranch.ts
42079
42328
  async function createReplayBranch(repository, branchName, commitMessage, replayConflictInfo, logger) {
@@ -42776,7 +43025,7 @@ var GithubStep = class extends BaseStep {
42776
43025
  }
42777
43026
  async ensureFernignore() {
42778
43027
  this.logger.debug("Checking for .fernignore file...");
42779
- const fernignorePath = (0, import_path23.join)(this.outputDir, ".fernignore");
43028
+ const fernignorePath = (0, import_path24.join)(this.outputDir, ".fernignore");
42780
43029
  try {
42781
43030
  await (0, import_promises16.access)(fernignorePath);
42782
43031
  this.logger.debug(".fernignore already exists");
@@ -43024,9 +43273,10 @@ ${stderr}`);
43024
43273
  throw e;
43025
43274
  }
43026
43275
  }
43027
- async function execInContainer({ logger, containerId, command, runner, writeLogsToFile = true, reject = true }) {
43276
+ async function execInContainer({ logger, containerId, command, runner, envVars = {}, writeLogsToFile = true, reject = true }) {
43028
43277
  const containerRunner = runner ?? "docker";
43029
- const { stdout, stderr, exitCode } = await loggingExeca(logger, containerRunner, ["exec", "--user", "root", containerId, ...command], {
43278
+ const envArgs = Object.entries(envVars).flatMap(([key, value]) => ["-e", `${key}=${value}`]);
43279
+ const { stdout, stderr, exitCode } = await loggingExeca(logger, containerRunner, ["exec", "--user", "root", ...envArgs, containerId, ...command], {
43030
43280
  reject: false,
43031
43281
  all: true,
43032
43282
  doNotPipeOutput: true
@@ -43065,9 +43315,63 @@ async function stopContainer({ logger, containerId, runner }) {
43065
43315
  });
43066
43316
  }
43067
43317
 
43318
+ // ../cli/logger/lib/LogLevel.js
43319
+ var LogLevel2 = {
43320
+ Trace: "trace",
43321
+ Debug: "debug",
43322
+ Info: "info",
43323
+ Warn: "warn",
43324
+ Error: "error"
43325
+ };
43326
+ var LOG_LEVELS = Object.values(LogLevel2);
43327
+
43328
+ // ../cli/logger/lib/createLogger.js
43329
+ var LoggerImpl = class {
43330
+ log;
43331
+ enabled;
43332
+ constructor(log, enabled = true) {
43333
+ this.log = log;
43334
+ this.enabled = enabled;
43335
+ }
43336
+ disable() {
43337
+ this.enabled = false;
43338
+ }
43339
+ enable() {
43340
+ this.enabled = true;
43341
+ }
43342
+ debug(...args) {
43343
+ if (this.enabled) {
43344
+ this.log(LogLevel2.Debug, ...args);
43345
+ }
43346
+ }
43347
+ info(...args) {
43348
+ if (this.enabled) {
43349
+ this.log(LogLevel2.Info, ...args);
43350
+ }
43351
+ }
43352
+ warn(...args) {
43353
+ if (this.enabled) {
43354
+ this.log(LogLevel2.Warn, ...args);
43355
+ }
43356
+ }
43357
+ error(...args) {
43358
+ if (this.enabled) {
43359
+ this.log(LogLevel2.Error, ...args);
43360
+ }
43361
+ }
43362
+ trace(...args) {
43363
+ if (this.enabled) {
43364
+ this.log(LogLevel2.Trace, ...args);
43365
+ }
43366
+ }
43367
+ };
43368
+ function createLogger4(log) {
43369
+ return new LoggerImpl(log);
43370
+ }
43371
+
43068
43372
  // src/pipeline/steps/VerificationStep.ts
43069
- var import_fs15 = require("fs");
43070
- var import_path24 = require("path");
43373
+ var import_fs16 = require("fs");
43374
+ var import_path25 = require("path");
43071
43375
  var CONTAINER_WORKSPACE_PATH = "/workspace";
43072
43376
  var VERIFY_SCRIPT_RELATIVE_PATH = ".fern/verify.sh";
43073
43377
  var VERIFY_SCRIPT_CONTAINER_PATH = `${CONTAINER_WORKSPACE_PATH}/${VERIFY_SCRIPT_RELATIVE_PATH}`;
@@ -43083,8 +43387,8 @@ var VerificationStep = class extends BaseStep {
43083
43387
  generatorVersions;
43084
43388
  name = "verify";
43085
43389
  async execute(_context) {
43086
- const verifyScriptHostPath = (0, import_path24.join)(this.outputDir, VERIFY_SCRIPT_RELATIVE_PATH);
43087
- if (!(0, import_fs15.existsSync)(verifyScriptHostPath)) {
43390
+ const verifyScriptHostPath = (0, import_path25.join)(this.outputDir, VERIFY_SCRIPT_RELATIVE_PATH);
43391
+ if (!(0, import_fs16.existsSync)(verifyScriptHostPath)) {
43088
43392
  return { executed: true, success: true, skipped: true };
43089
43393
  }
43090
43394
  const validatorImage = this.deriveValidatorImage();
@@ -43725,28 +44029,28 @@ Bootstrap complete! Lockfile saved to ${outputDir}/.fern/replay.lock
43725
44029
  description: "Search pattern (file path, glob, or commit message substring)"
43726
44030
  });
43727
44031
  },
43728
- (argv) => {
44032
+ async (argv) => {
43729
44033
  try {
43730
44034
  const outputDir = resolve(cwd(), ".");
43731
44035
  const args = argv.args ?? [];
43732
44036
  const dryRun = argv["dry-run"];
43733
44037
  let result;
43734
44038
  if (argv.all) {
43735
- result = replayForget({ outputDir, options: { all: true, dryRun } });
44039
+ result = await replayForget({ outputDir, options: { all: true, dryRun } });
43736
44040
  } else if (argv.pattern) {
43737
- result = replayForget({ outputDir, options: { pattern: argv.pattern, dryRun } });
44041
+ result = await replayForget({ outputDir, options: { pattern: argv.pattern, dryRun } });
43738
44042
  } else if (args.length > 0) {
43739
44043
  const allPatchIds = args.every((a) => a.startsWith("patch-"));
43740
44044
  if (allPatchIds) {
43741
- result = replayForget({ outputDir, options: { patchIds: args, dryRun } });
44045
+ result = await replayForget({ outputDir, options: { patchIds: args, dryRun } });
43742
44046
  } else {
43743
- result = replayForget({
44047
+ result = await replayForget({
43744
44048
  outputDir,
43745
44049
  options: { pattern: args[0], dryRun }
43746
44050
  });
43747
44051
  }
43748
44052
  } else {
43749
- result = replayForget({ outputDir, options: { dryRun } });
44053
+ result = await replayForget({ outputDir, options: { dryRun } });
43750
44054
  }
43751
44055
  process.stdout.write(JSON.stringify(result, null, 2) + "\n");
43752
44056
  process.exit(0);
@@ -43774,9 +44078,9 @@ async function createWriteStream(outputPath) {
43774
44078
  }
43775
44079
  async function createWriteStreamFromFile(filepath) {
43776
44080
  if (!await doesPathExist(filepath)) {
43777
- await (0, import_promises18.mkdir)(import_path25.default.dirname(filepath), { recursive: true });
44081
+ await (0, import_promises18.mkdir)(import_path26.default.dirname(filepath), { recursive: true });
43778
44082
  }
43779
- return import_fs16.default.createWriteStream(filepath);
44083
+ return import_fs17.default.createWriteStream(filepath);
43780
44084
  }
43781
44085
  /*! Bundled license information:
43782
44086