@clef-sh/core 0.1.15-beta.98 → 0.1.16-beta.110

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.
Files changed (41) hide show
  1. package/dist/git/integration.d.ts.map +1 -1
  2. package/dist/index.d.mts +3 -2
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +425 -652
  6. package/dist/index.js.map +4 -4
  7. package/dist/index.mjs +420 -639
  8. package/dist/index.mjs.map +4 -4
  9. package/dist/kms/types.d.ts +1 -1
  10. package/dist/kms/types.d.ts.map +1 -1
  11. package/dist/lint/runner.d.ts.map +1 -1
  12. package/dist/manifest/parser.d.ts.map +1 -1
  13. package/dist/migration/backend.d.ts +1 -1
  14. package/dist/migration/backend.d.ts.map +1 -1
  15. package/dist/service-identity/manager.d.ts +13 -5
  16. package/dist/service-identity/manager.d.ts.map +1 -1
  17. package/dist/sops/client.d.ts +1 -12
  18. package/dist/sops/client.d.ts.map +1 -1
  19. package/dist/sync/index.d.ts +3 -0
  20. package/dist/sync/index.d.ts.map +1 -0
  21. package/dist/sync/manager.d.ts +58 -0
  22. package/dist/sync/manager.d.ts.map +1 -0
  23. package/dist/types/index.d.ts +6 -9
  24. package/dist/types/index.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/dist/cloud/bundled.d.ts +0 -6
  27. package/dist/cloud/bundled.d.ts.map +0 -1
  28. package/dist/cloud/constants.d.ts +0 -2
  29. package/dist/cloud/constants.d.ts.map +0 -1
  30. package/dist/cloud/credentials.d.ts +0 -13
  31. package/dist/cloud/credentials.d.ts.map +0 -1
  32. package/dist/cloud/device-flow.d.ts +0 -46
  33. package/dist/cloud/device-flow.d.ts.map +0 -1
  34. package/dist/cloud/index.d.ts +0 -10
  35. package/dist/cloud/index.d.ts.map +0 -1
  36. package/dist/cloud/keyservice.d.ts +0 -20
  37. package/dist/cloud/keyservice.d.ts.map +0 -1
  38. package/dist/cloud/pack-client.d.ts +0 -34
  39. package/dist/cloud/pack-client.d.ts.map +0 -1
  40. package/dist/cloud/resolver.d.ts +0 -24
  41. package/dist/cloud/resolver.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -304,10 +304,10 @@ var require_lib = __commonJS({
304
304
  module.exports.sync = writeFileSync6;
305
305
  module.exports._getTmpname = getTmpname;
306
306
  module.exports._cleanupOnExit = cleanupOnExit;
307
- var fs21 = __require("fs");
307
+ var fs17 = __require("fs");
308
308
  var crypto4 = __require("node:crypto");
309
309
  var { onExit } = require_cjs();
310
- var path28 = __require("path");
310
+ var path25 = __require("path");
311
311
  var { promisify } = __require("util");
312
312
  var activeFiles = {};
313
313
  var threadId = (function getId() {
@@ -325,7 +325,7 @@ var require_lib = __commonJS({
325
325
  function cleanupOnExit(tmpfile) {
326
326
  return () => {
327
327
  try {
328
- fs21.unlinkSync(typeof tmpfile === "function" ? tmpfile() : tmpfile);
328
+ fs17.unlinkSync(typeof tmpfile === "function" ? tmpfile() : tmpfile);
329
329
  } catch {
330
330
  }
331
331
  };
@@ -360,13 +360,13 @@ var require_lib = __commonJS({
360
360
  let fd;
361
361
  let tmpfile;
362
362
  const removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile));
363
- const absoluteName = path28.resolve(filename);
363
+ const absoluteName = path25.resolve(filename);
364
364
  try {
365
365
  await serializeActiveFile(absoluteName);
366
- const truename = await promisify(fs21.realpath)(filename).catch(() => filename);
366
+ const truename = await promisify(fs17.realpath)(filename).catch(() => filename);
367
367
  tmpfile = getTmpname(truename);
368
368
  if (!options.mode || !options.chown) {
369
- const stats = await promisify(fs21.stat)(truename).catch(() => {
369
+ const stats = await promisify(fs17.stat)(truename).catch(() => {
370
370
  });
371
371
  if (stats) {
372
372
  if (options.mode == null) {
@@ -377,45 +377,45 @@ var require_lib = __commonJS({
377
377
  }
378
378
  }
379
379
  }
380
- fd = await promisify(fs21.open)(tmpfile, "w", options.mode);
380
+ fd = await promisify(fs17.open)(tmpfile, "w", options.mode);
381
381
  if (options.tmpfileCreated) {
382
382
  await options.tmpfileCreated(tmpfile);
383
383
  }
384
384
  if (ArrayBuffer.isView(data)) {
385
- await promisify(fs21.write)(fd, data, 0, data.length, 0);
385
+ await promisify(fs17.write)(fd, data, 0, data.length, 0);
386
386
  } else if (data != null) {
387
- await promisify(fs21.write)(fd, String(data), 0, String(options.encoding || "utf8"));
387
+ await promisify(fs17.write)(fd, String(data), 0, String(options.encoding || "utf8"));
388
388
  }
389
389
  if (options.fsync !== false) {
390
- await promisify(fs21.fsync)(fd);
390
+ await promisify(fs17.fsync)(fd);
391
391
  }
392
- await promisify(fs21.close)(fd);
392
+ await promisify(fs17.close)(fd);
393
393
  fd = null;
394
394
  if (options.chown) {
395
- await promisify(fs21.chown)(tmpfile, options.chown.uid, options.chown.gid).catch((err) => {
395
+ await promisify(fs17.chown)(tmpfile, options.chown.uid, options.chown.gid).catch((err) => {
396
396
  if (!isChownErrOk(err)) {
397
397
  throw err;
398
398
  }
399
399
  });
400
400
  }
401
401
  if (options.mode) {
402
- await promisify(fs21.chmod)(tmpfile, options.mode).catch((err) => {
402
+ await promisify(fs17.chmod)(tmpfile, options.mode).catch((err) => {
403
403
  if (!isChownErrOk(err)) {
404
404
  throw err;
405
405
  }
406
406
  });
407
407
  }
408
- await promisify(fs21.rename)(tmpfile, truename);
408
+ await promisify(fs17.rename)(tmpfile, truename);
409
409
  } finally {
410
410
  if (fd) {
411
- await promisify(fs21.close)(fd).catch(
411
+ await promisify(fs17.close)(fd).catch(
412
412
  /* istanbul ignore next */
413
413
  () => {
414
414
  }
415
415
  );
416
416
  }
417
417
  removeOnExitHandler();
418
- await promisify(fs21.unlink)(tmpfile).catch(() => {
418
+ await promisify(fs17.unlink)(tmpfile).catch(() => {
419
419
  });
420
420
  activeFiles[absoluteName].shift();
421
421
  if (activeFiles[absoluteName].length > 0) {
@@ -448,13 +448,13 @@ var require_lib = __commonJS({
448
448
  options = {};
449
449
  }
450
450
  try {
451
- filename = fs21.realpathSync(filename);
451
+ filename = fs17.realpathSync(filename);
452
452
  } catch (ex) {
453
453
  }
454
454
  const tmpfile = getTmpname(filename);
455
455
  if (!options.mode || !options.chown) {
456
456
  try {
457
- const stats = fs21.statSync(filename);
457
+ const stats = fs17.statSync(filename);
458
458
  options = Object.assign({}, options);
459
459
  if (!options.mode) {
460
460
  options.mode = stats.mode;
@@ -470,23 +470,23 @@ var require_lib = __commonJS({
470
470
  const removeOnExitHandler = onExit(cleanup);
471
471
  let threw = true;
472
472
  try {
473
- fd = fs21.openSync(tmpfile, "w", options.mode || 438);
473
+ fd = fs17.openSync(tmpfile, "w", options.mode || 438);
474
474
  if (options.tmpfileCreated) {
475
475
  options.tmpfileCreated(tmpfile);
476
476
  }
477
477
  if (ArrayBuffer.isView(data)) {
478
- fs21.writeSync(fd, data, 0, data.length, 0);
478
+ fs17.writeSync(fd, data, 0, data.length, 0);
479
479
  } else if (data != null) {
480
- fs21.writeSync(fd, String(data), 0, String(options.encoding || "utf8"));
480
+ fs17.writeSync(fd, String(data), 0, String(options.encoding || "utf8"));
481
481
  }
482
482
  if (options.fsync !== false) {
483
- fs21.fsyncSync(fd);
483
+ fs17.fsyncSync(fd);
484
484
  }
485
- fs21.closeSync(fd);
485
+ fs17.closeSync(fd);
486
486
  fd = null;
487
487
  if (options.chown) {
488
488
  try {
489
- fs21.chownSync(tmpfile, options.chown.uid, options.chown.gid);
489
+ fs17.chownSync(tmpfile, options.chown.uid, options.chown.gid);
490
490
  } catch (err) {
491
491
  if (!isChownErrOk(err)) {
492
492
  throw err;
@@ -495,19 +495,19 @@ var require_lib = __commonJS({
495
495
  }
496
496
  if (options.mode) {
497
497
  try {
498
- fs21.chmodSync(tmpfile, options.mode);
498
+ fs17.chmodSync(tmpfile, options.mode);
499
499
  } catch (err) {
500
500
  if (!isChownErrOk(err)) {
501
501
  throw err;
502
502
  }
503
503
  }
504
504
  }
505
- fs21.renameSync(tmpfile, filename);
505
+ fs17.renameSync(tmpfile, filename);
506
506
  threw = false;
507
507
  } finally {
508
508
  if (fd) {
509
509
  try {
510
- fs21.closeSync(fd);
510
+ fs17.closeSync(fd);
511
511
  } catch (ex) {
512
512
  }
513
513
  }
@@ -546,54 +546,54 @@ var require_polyfills = __commonJS({
546
546
  }
547
547
  var chdir;
548
548
  module.exports = patch;
549
- function patch(fs21) {
549
+ function patch(fs17) {
550
550
  if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
551
- patchLchmod(fs21);
552
- }
553
- if (!fs21.lutimes) {
554
- patchLutimes(fs21);
555
- }
556
- fs21.chown = chownFix(fs21.chown);
557
- fs21.fchown = chownFix(fs21.fchown);
558
- fs21.lchown = chownFix(fs21.lchown);
559
- fs21.chmod = chmodFix(fs21.chmod);
560
- fs21.fchmod = chmodFix(fs21.fchmod);
561
- fs21.lchmod = chmodFix(fs21.lchmod);
562
- fs21.chownSync = chownFixSync(fs21.chownSync);
563
- fs21.fchownSync = chownFixSync(fs21.fchownSync);
564
- fs21.lchownSync = chownFixSync(fs21.lchownSync);
565
- fs21.chmodSync = chmodFixSync(fs21.chmodSync);
566
- fs21.fchmodSync = chmodFixSync(fs21.fchmodSync);
567
- fs21.lchmodSync = chmodFixSync(fs21.lchmodSync);
568
- fs21.stat = statFix(fs21.stat);
569
- fs21.fstat = statFix(fs21.fstat);
570
- fs21.lstat = statFix(fs21.lstat);
571
- fs21.statSync = statFixSync(fs21.statSync);
572
- fs21.fstatSync = statFixSync(fs21.fstatSync);
573
- fs21.lstatSync = statFixSync(fs21.lstatSync);
574
- if (fs21.chmod && !fs21.lchmod) {
575
- fs21.lchmod = function(path28, mode, cb) {
551
+ patchLchmod(fs17);
552
+ }
553
+ if (!fs17.lutimes) {
554
+ patchLutimes(fs17);
555
+ }
556
+ fs17.chown = chownFix(fs17.chown);
557
+ fs17.fchown = chownFix(fs17.fchown);
558
+ fs17.lchown = chownFix(fs17.lchown);
559
+ fs17.chmod = chmodFix(fs17.chmod);
560
+ fs17.fchmod = chmodFix(fs17.fchmod);
561
+ fs17.lchmod = chmodFix(fs17.lchmod);
562
+ fs17.chownSync = chownFixSync(fs17.chownSync);
563
+ fs17.fchownSync = chownFixSync(fs17.fchownSync);
564
+ fs17.lchownSync = chownFixSync(fs17.lchownSync);
565
+ fs17.chmodSync = chmodFixSync(fs17.chmodSync);
566
+ fs17.fchmodSync = chmodFixSync(fs17.fchmodSync);
567
+ fs17.lchmodSync = chmodFixSync(fs17.lchmodSync);
568
+ fs17.stat = statFix(fs17.stat);
569
+ fs17.fstat = statFix(fs17.fstat);
570
+ fs17.lstat = statFix(fs17.lstat);
571
+ fs17.statSync = statFixSync(fs17.statSync);
572
+ fs17.fstatSync = statFixSync(fs17.fstatSync);
573
+ fs17.lstatSync = statFixSync(fs17.lstatSync);
574
+ if (fs17.chmod && !fs17.lchmod) {
575
+ fs17.lchmod = function(path25, mode, cb) {
576
576
  if (cb) process.nextTick(cb);
577
577
  };
578
- fs21.lchmodSync = function() {
578
+ fs17.lchmodSync = function() {
579
579
  };
580
580
  }
581
- if (fs21.chown && !fs21.lchown) {
582
- fs21.lchown = function(path28, uid, gid, cb) {
581
+ if (fs17.chown && !fs17.lchown) {
582
+ fs17.lchown = function(path25, uid, gid, cb) {
583
583
  if (cb) process.nextTick(cb);
584
584
  };
585
- fs21.lchownSync = function() {
585
+ fs17.lchownSync = function() {
586
586
  };
587
587
  }
588
588
  if (platform === "win32") {
589
- fs21.rename = typeof fs21.rename !== "function" ? fs21.rename : (function(fs$rename) {
589
+ fs17.rename = typeof fs17.rename !== "function" ? fs17.rename : (function(fs$rename) {
590
590
  function rename(from, to, cb) {
591
591
  var start = Date.now();
592
592
  var backoff = 0;
593
593
  fs$rename(from, to, function CB(er) {
594
594
  if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
595
595
  setTimeout(function() {
596
- fs21.stat(to, function(stater, st) {
596
+ fs17.stat(to, function(stater, st) {
597
597
  if (stater && stater.code === "ENOENT")
598
598
  fs$rename(from, to, CB);
599
599
  else
@@ -609,9 +609,9 @@ var require_polyfills = __commonJS({
609
609
  }
610
610
  if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
611
611
  return rename;
612
- })(fs21.rename);
612
+ })(fs17.rename);
613
613
  }
614
- fs21.read = typeof fs21.read !== "function" ? fs21.read : (function(fs$read) {
614
+ fs17.read = typeof fs17.read !== "function" ? fs17.read : (function(fs$read) {
615
615
  function read(fd, buffer, offset, length, position, callback_) {
616
616
  var callback;
617
617
  if (callback_ && typeof callback_ === "function") {
@@ -619,22 +619,22 @@ var require_polyfills = __commonJS({
619
619
  callback = function(er, _, __) {
620
620
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
621
621
  eagCounter++;
622
- return fs$read.call(fs21, fd, buffer, offset, length, position, callback);
622
+ return fs$read.call(fs17, fd, buffer, offset, length, position, callback);
623
623
  }
624
624
  callback_.apply(this, arguments);
625
625
  };
626
626
  }
627
- return fs$read.call(fs21, fd, buffer, offset, length, position, callback);
627
+ return fs$read.call(fs17, fd, buffer, offset, length, position, callback);
628
628
  }
629
629
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
630
630
  return read;
631
- })(fs21.read);
632
- fs21.readSync = typeof fs21.readSync !== "function" ? fs21.readSync : /* @__PURE__ */ (function(fs$readSync) {
631
+ })(fs17.read);
632
+ fs17.readSync = typeof fs17.readSync !== "function" ? fs17.readSync : /* @__PURE__ */ (function(fs$readSync) {
633
633
  return function(fd, buffer, offset, length, position) {
634
634
  var eagCounter = 0;
635
635
  while (true) {
636
636
  try {
637
- return fs$readSync.call(fs21, fd, buffer, offset, length, position);
637
+ return fs$readSync.call(fs17, fd, buffer, offset, length, position);
638
638
  } catch (er) {
639
639
  if (er.code === "EAGAIN" && eagCounter < 10) {
640
640
  eagCounter++;
@@ -644,11 +644,11 @@ var require_polyfills = __commonJS({
644
644
  }
645
645
  }
646
646
  };
647
- })(fs21.readSync);
648
- function patchLchmod(fs22) {
649
- fs22.lchmod = function(path28, mode, callback) {
650
- fs22.open(
651
- path28,
647
+ })(fs17.readSync);
648
+ function patchLchmod(fs18) {
649
+ fs18.lchmod = function(path25, mode, callback) {
650
+ fs18.open(
651
+ path25,
652
652
  constants.O_WRONLY | constants.O_SYMLINK,
653
653
  mode,
654
654
  function(err, fd) {
@@ -656,80 +656,80 @@ var require_polyfills = __commonJS({
656
656
  if (callback) callback(err);
657
657
  return;
658
658
  }
659
- fs22.fchmod(fd, mode, function(err2) {
660
- fs22.close(fd, function(err22) {
659
+ fs18.fchmod(fd, mode, function(err2) {
660
+ fs18.close(fd, function(err22) {
661
661
  if (callback) callback(err2 || err22);
662
662
  });
663
663
  });
664
664
  }
665
665
  );
666
666
  };
667
- fs22.lchmodSync = function(path28, mode) {
668
- var fd = fs22.openSync(path28, constants.O_WRONLY | constants.O_SYMLINK, mode);
667
+ fs18.lchmodSync = function(path25, mode) {
668
+ var fd = fs18.openSync(path25, constants.O_WRONLY | constants.O_SYMLINK, mode);
669
669
  var threw = true;
670
670
  var ret;
671
671
  try {
672
- ret = fs22.fchmodSync(fd, mode);
672
+ ret = fs18.fchmodSync(fd, mode);
673
673
  threw = false;
674
674
  } finally {
675
675
  if (threw) {
676
676
  try {
677
- fs22.closeSync(fd);
677
+ fs18.closeSync(fd);
678
678
  } catch (er) {
679
679
  }
680
680
  } else {
681
- fs22.closeSync(fd);
681
+ fs18.closeSync(fd);
682
682
  }
683
683
  }
684
684
  return ret;
685
685
  };
686
686
  }
687
- function patchLutimes(fs22) {
688
- if (constants.hasOwnProperty("O_SYMLINK") && fs22.futimes) {
689
- fs22.lutimes = function(path28, at, mt, cb) {
690
- fs22.open(path28, constants.O_SYMLINK, function(er, fd) {
687
+ function patchLutimes(fs18) {
688
+ if (constants.hasOwnProperty("O_SYMLINK") && fs18.futimes) {
689
+ fs18.lutimes = function(path25, at, mt, cb) {
690
+ fs18.open(path25, constants.O_SYMLINK, function(er, fd) {
691
691
  if (er) {
692
692
  if (cb) cb(er);
693
693
  return;
694
694
  }
695
- fs22.futimes(fd, at, mt, function(er2) {
696
- fs22.close(fd, function(er22) {
695
+ fs18.futimes(fd, at, mt, function(er2) {
696
+ fs18.close(fd, function(er22) {
697
697
  if (cb) cb(er2 || er22);
698
698
  });
699
699
  });
700
700
  });
701
701
  };
702
- fs22.lutimesSync = function(path28, at, mt) {
703
- var fd = fs22.openSync(path28, constants.O_SYMLINK);
702
+ fs18.lutimesSync = function(path25, at, mt) {
703
+ var fd = fs18.openSync(path25, constants.O_SYMLINK);
704
704
  var ret;
705
705
  var threw = true;
706
706
  try {
707
- ret = fs22.futimesSync(fd, at, mt);
707
+ ret = fs18.futimesSync(fd, at, mt);
708
708
  threw = false;
709
709
  } finally {
710
710
  if (threw) {
711
711
  try {
712
- fs22.closeSync(fd);
712
+ fs18.closeSync(fd);
713
713
  } catch (er) {
714
714
  }
715
715
  } else {
716
- fs22.closeSync(fd);
716
+ fs18.closeSync(fd);
717
717
  }
718
718
  }
719
719
  return ret;
720
720
  };
721
- } else if (fs22.futimes) {
722
- fs22.lutimes = function(_a, _b, _c, cb) {
721
+ } else if (fs18.futimes) {
722
+ fs18.lutimes = function(_a, _b, _c, cb) {
723
723
  if (cb) process.nextTick(cb);
724
724
  };
725
- fs22.lutimesSync = function() {
725
+ fs18.lutimesSync = function() {
726
726
  };
727
727
  }
728
728
  }
729
729
  function chmodFix(orig) {
730
730
  if (!orig) return orig;
731
731
  return function(target, mode, cb) {
732
- return orig.call(fs21, target, mode, function(er) {
732
+ return orig.call(fs17, target, mode, function(er) {
733
733
  if (chownErOk(er)) er = null;
734
734
  if (cb) cb.apply(this, arguments);
735
735
  });
@@ -739,7 +739,7 @@ var require_polyfills = __commonJS({
739
739
  if (!orig) return orig;
740
740
  return function(target, mode) {
741
741
  try {
742
- return orig.call(fs21, target, mode);
742
+ return orig.call(fs17, target, mode);
743
743
  } catch (er) {
744
744
  if (!chownErOk(er)) throw er;
745
745
  }
@@ -748,7 +748,7 @@ var require_polyfills = __commonJS({
748
748
  function chownFix(orig) {
749
749
  if (!orig) return orig;
750
750
  return function(target, uid, gid, cb) {
751
- return orig.call(fs21, target, uid, gid, function(er) {
751
+ return orig.call(fs17, target, uid, gid, function(er) {
752
752
  if (chownErOk(er)) er = null;
753
753
  if (cb) cb.apply(this, arguments);
754
754
  });
@@ -758,7 +758,7 @@ var require_polyfills = __commonJS({
758
758
  if (!orig) return orig;
759
759
  return function(target, uid, gid) {
760
760
  try {
761
- return orig.call(fs21, target, uid, gid);
761
+ return orig.call(fs17, target, uid, gid);
762
762
  } catch (er) {
763
763
  if (!chownErOk(er)) throw er;
764
764
  }
@@ -778,13 +778,13 @@ var require_polyfills = __commonJS({
778
778
  }
779
779
  if (cb) cb.apply(this, arguments);
780
780
  }
781
- return options ? orig.call(fs21, target, options, callback) : orig.call(fs21, target, callback);
781
+ return options ? orig.call(fs17, target, options, callback) : orig.call(fs17, target, callback);
782
782
  };
783
783
  }
784
784
  function statFixSync(orig) {
785
785
  if (!orig) return orig;
786
786
  return function(target, options) {
787
- var stats = options ? orig.call(fs21, target, options) : orig.call(fs21, target);
787
+ var stats = options ? orig.call(fs17, target, options) : orig.call(fs17, target);
788
788
  if (stats) {
789
789
  if (stats.uid < 0) stats.uid += 4294967296;
790
790
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -813,16 +813,16 @@ var require_legacy_streams = __commonJS({
813
813
  "../../node_modules/graceful-fs/legacy-streams.js"(exports, module) {
814
814
  var Stream = __require("stream").Stream;
815
815
  module.exports = legacy;
816
- function legacy(fs21) {
816
+ function legacy(fs17) {
817
817
  return {
818
818
  ReadStream,
819
819
  WriteStream
820
820
  };
821
- function ReadStream(path28, options) {
822
- if (!(this instanceof ReadStream)) return new ReadStream(path28, options);
821
+ function ReadStream(path25, options) {
822
+ if (!(this instanceof ReadStream)) return new ReadStream(path25, options);
823
823
  Stream.call(this);
824
824
  var self = this;
825
- this.path = path28;
825
+ this.path = path25;
826
826
  this.fd = null;
827
827
  this.readable = true;
828
828
  this.paused = false;
@@ -856,7 +856,7 @@ var require_legacy_streams = __commonJS({
856
856
  });
857
857
  return;
858
858
  }
859
- fs21.open(this.path, this.flags, this.mode, function(err, fd) {
859
+ fs17.open(this.path, this.flags, this.mode, function(err, fd) {
860
860
  if (err) {
861
861
  self.emit("error", err);
862
862
  self.readable = false;
@@ -867,10 +867,10 @@ var require_legacy_streams = __commonJS({
867
867
  self._read();
868
868
  });
869
869
  }
870
- function WriteStream(path28, options) {
871
- if (!(this instanceof WriteStream)) return new WriteStream(path28, options);
870
+ function WriteStream(path25, options) {
871
+ if (!(this instanceof WriteStream)) return new WriteStream(path25, options);
872
872
  Stream.call(this);
873
- this.path = path28;
873
+ this.path = path25;
874
874
  this.fd = null;
875
875
  this.writable = true;
876
876
  this.flags = "w";
@@ -895,7 +895,7 @@ var require_legacy_streams = __commonJS({
895
895
  this.busy = false;
896
896
  this._queue = [];
897
897
  if (this.fd === null) {
898
- this._open = fs21.open;
898
+ this._open = fs17.open;
899
899
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
900
900
  this.flush();
901
901
  }
@@ -930,7 +930,7 @@ var require_clone = __commonJS({
930
930
  // ../../node_modules/graceful-fs/graceful-fs.js
931
931
  var require_graceful_fs = __commonJS({
932
932
  "../../node_modules/graceful-fs/graceful-fs.js"(exports, module) {
933
- var fs21 = __require("fs");
933
+ var fs17 = __require("fs");
934
934
  var polyfills = require_polyfills();
935
935
  var legacy = require_legacy_streams();
936
936
  var clone = require_clone();
@@ -962,12 +962,12 @@ var require_graceful_fs = __commonJS({
962
962
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
963
963
  console.error(m);
964
964
  };
965
- if (!fs21[gracefulQueue]) {
965
+ if (!fs17[gracefulQueue]) {
966
966
  queue = global[gracefulQueue] || [];
967
- publishQueue(fs21, queue);
968
- fs21.close = (function(fs$close) {
967
+ publishQueue(fs17, queue);
968
+ fs17.close = (function(fs$close) {
969
969
  function close(fd, cb) {
970
- return fs$close.call(fs21, fd, function(err) {
970
+ return fs$close.call(fs17, fd, function(err) {
971
971
  if (!err) {
972
972
  resetQueue();
973
973
  }
@@ -979,48 +979,48 @@ var require_graceful_fs = __commonJS({
979
979
  value: fs$close
980
980
  });
981
981
  return close;
982
- })(fs21.close);
983
- fs21.closeSync = (function(fs$closeSync) {
982
+ })(fs17.close);
983
+ fs17.closeSync = (function(fs$closeSync) {
984
984
  function closeSync2(fd) {
985
- fs$closeSync.apply(fs21, arguments);
985
+ fs$closeSync.apply(fs17, arguments);
986
986
  resetQueue();
987
987
  }
988
988
  Object.defineProperty(closeSync2, previousSymbol, {
989
989
  value: fs$closeSync
990
990
  });
991
991
  return closeSync2;
992
- })(fs21.closeSync);
992
+ })(fs17.closeSync);
993
993
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
994
994
  process.on("exit", function() {
995
- debug(fs21[gracefulQueue]);
996
- __require("assert").equal(fs21[gracefulQueue].length, 0);
995
+ debug(fs17[gracefulQueue]);
996
+ __require("assert").equal(fs17[gracefulQueue].length, 0);
997
997
  });
998
998
  }
999
999
  }
1000
1000
  var queue;
1001
1001
  if (!global[gracefulQueue]) {
1002
- publishQueue(global, fs21[gracefulQueue]);
1003
- }
1004
- module.exports = patch(clone(fs21));
1005
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs21.__patched) {
1006
- module.exports = patch(fs21);
1007
- fs21.__patched = true;
1008
- }
1009
- function patch(fs22) {
1010
- polyfills(fs22);
1011
- fs22.gracefulify = patch;
1012
- fs22.createReadStream = createReadStream;
1013
- fs22.createWriteStream = createWriteStream;
1014
- var fs$readFile = fs22.readFile;
1015
- fs22.readFile = readFile;
1016
- function readFile(path28, options, cb) {
1002
+ publishQueue(global, fs17[gracefulQueue]);
1003
+ }
1004
+ module.exports = patch(clone(fs17));
1005
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs17.__patched) {
1006
+ module.exports = patch(fs17);
1007
+ fs17.__patched = true;
1008
+ }
1009
+ function patch(fs18) {
1010
+ polyfills(fs18);
1011
+ fs18.gracefulify = patch;
1012
+ fs18.createReadStream = createReadStream;
1013
+ fs18.createWriteStream = createWriteStream;
1014
+ var fs$readFile = fs18.readFile;
1015
+ fs18.readFile = readFile;
1016
+ function readFile(path25, options, cb) {
1017
1017
  if (typeof options === "function")
1018
1018
  cb = options, options = null;
1019
- return go$readFile(path28, options, cb);
1020
- function go$readFile(path29, options2, cb2, startTime) {
1021
- return fs$readFile(path29, options2, function(err) {
1019
+ return go$readFile(path25, options, cb);
1020
+ function go$readFile(path26, options2, cb2, startTime) {
1021
+ return fs$readFile(path26, options2, function(err) {
1022
1022
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1023
- enqueue([go$readFile, [path29, options2, cb2], err, startTime || Date.now(), Date.now()]);
1023
+ enqueue([go$readFile, [path26, options2, cb2], err, startTime || Date.now(), Date.now()]);
1024
1024
  else {
1025
1025
  if (typeof cb2 === "function")
1026
1026
  cb2.apply(this, arguments);
@@ -1028,16 +1028,16 @@ var require_graceful_fs = __commonJS({
1028
1028
  });
1029
1029
  }
1030
1030
  }
1031
- var fs$writeFile = fs22.writeFile;
1032
- fs22.writeFile = writeFile;
1033
- function writeFile(path28, data, options, cb) {
1031
+ var fs$writeFile = fs18.writeFile;
1032
+ fs18.writeFile = writeFile;
1033
+ function writeFile(path25, data, options, cb) {
1034
1034
  if (typeof options === "function")
1035
1035
  cb = options, options = null;
1036
- return go$writeFile(path28, data, options, cb);
1037
- function go$writeFile(path29, data2, options2, cb2, startTime) {
1038
- return fs$writeFile(path29, data2, options2, function(err) {
1036
+ return go$writeFile(path25, data, options, cb);
1037
+ function go$writeFile(path26, data2, options2, cb2, startTime) {
1038
+ return fs$writeFile(path26, data2, options2, function(err) {
1039
1039
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1040
- enqueue([go$writeFile, [path29, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
1040
+ enqueue([go$writeFile, [path26, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
1041
1041
  else {
1042
1042
  if (typeof cb2 === "function")
1043
1043
  cb2.apply(this, arguments);
@@ -1045,17 +1045,17 @@ var require_graceful_fs = __commonJS({
1045
1045
  });
1046
1046
  }
1047
1047
  }
1048
- var fs$appendFile = fs22.appendFile;
1048
+ var fs$appendFile = fs18.appendFile;
1049
1049
  if (fs$appendFile)
1050
- fs22.appendFile = appendFile;
1051
- function appendFile(path28, data, options, cb) {
1050
+ fs18.appendFile = appendFile;
1051
+ function appendFile(path25, data, options, cb) {
1052
1052
  if (typeof options === "function")
1053
1053
  cb = options, options = null;
1054
- return go$appendFile(path28, data, options, cb);
1055
- function go$appendFile(path29, data2, options2, cb2, startTime) {
1056
- return fs$appendFile(path29, data2, options2, function(err) {
1054
+ return go$appendFile(path25, data, options, cb);
1055
+ function go$appendFile(path26, data2, options2, cb2, startTime) {
1056
+ return fs$appendFile(path26, data2, options2, function(err) {
1057
1057
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1058
- enqueue([go$appendFile, [path29, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
1058
+ enqueue([go$appendFile, [path26, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
1059
1059
  else {
1060
1060
  if (typeof cb2 === "function")
1061
1061
  cb2.apply(this, arguments);
@@ -1063,9 +1063,9 @@ var require_graceful_fs = __commonJS({
1063
1063
  });
1064
1064
  }
1065
1065
  }
1066
- var fs$copyFile = fs22.copyFile;
1066
+ var fs$copyFile = fs18.copyFile;
1067
1067
  if (fs$copyFile)
1068
- fs22.copyFile = copyFile;
1068
+ fs18.copyFile = copyFile;
1069
1069
  function copyFile(src, dest, flags, cb) {
1070
1070
  if (typeof flags === "function") {
1071
1071
  cb = flags;
@@ -1083,34 +1083,34 @@ var require_graceful_fs = __commonJS({
1083
1083
  });
1084
1084
  }
1085
1085
  }
1086
- var fs$readdir = fs22.readdir;
1087
- fs22.readdir = readdir;
1086
+ var fs$readdir = fs18.readdir;
1087
+ fs18.readdir = readdir;
1088
1088
  var noReaddirOptionVersions = /^v[0-5]\./;
1089
- function readdir(path28, options, cb) {
1089
+ function readdir(path25, options, cb) {
1090
1090
  if (typeof options === "function")
1091
1091
  cb = options, options = null;
1092
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path29, options2, cb2, startTime) {
1093
- return fs$readdir(path29, fs$readdirCallback(
1094
- path29,
1092
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path26, options2, cb2, startTime) {
1093
+ return fs$readdir(path26, fs$readdirCallback(
1094
+ path26,
1095
1095
  options2,
1096
1096
  cb2,
1097
1097
  startTime
1098
1098
  ));
1099
- } : function go$readdir2(path29, options2, cb2, startTime) {
1100
- return fs$readdir(path29, options2, fs$readdirCallback(
1101
- path29,
1099
+ } : function go$readdir2(path26, options2, cb2, startTime) {
1100
+ return fs$readdir(path26, options2, fs$readdirCallback(
1101
+ path26,
1102
1102
  options2,
1103
1103
  cb2,
1104
1104
  startTime
1105
1105
  ));
1106
1106
  };
1107
- return go$readdir(path28, options, cb);
1108
- function fs$readdirCallback(path29, options2, cb2, startTime) {
1107
+ return go$readdir(path25, options, cb);
1108
+ function fs$readdirCallback(path26, options2, cb2, startTime) {
1109
1109
  return function(err, files) {
1110
1110
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1111
1111
  enqueue([
1112
1112
  go$readdir,
1113
- [path29, options2, cb2],
1113
+ [path26, options2, cb2],
1114
1114
  err,
1115
1115
  startTime || Date.now(),
1116
1116
  Date.now()
@@ -1125,21 +1125,21 @@ var require_graceful_fs = __commonJS({
1125
1125
  }
1126
1126
  }
1127
1127
  if (process.version.substr(0, 4) === "v0.8") {
1128
- var legStreams = legacy(fs22);
1128
+ var legStreams = legacy(fs18);
1129
1129
  ReadStream = legStreams.ReadStream;
1130
1130
  WriteStream = legStreams.WriteStream;
1131
1131
  }
1132
- var fs$ReadStream = fs22.ReadStream;
1132
+ var fs$ReadStream = fs18.ReadStream;
1133
1133
  if (fs$ReadStream) {
1134
1134
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
1135
1135
  ReadStream.prototype.open = ReadStream$open;
1136
1136
  }
1137
- var fs$WriteStream = fs22.WriteStream;
1137
+ var fs$WriteStream = fs18.WriteStream;
1138
1138
  if (fs$WriteStream) {
1139
1139
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
1140
1140
  WriteStream.prototype.open = WriteStream$open;
1141
1141
  }
1142
- Object.defineProperty(fs22, "ReadStream", {
1142
+ Object.defineProperty(fs18, "ReadStream", {
1143
1143
  get: function() {
1144
1144
  return ReadStream;
1145
1145
  },
@@ -1149,7 +1149,7 @@ var require_graceful_fs = __commonJS({
1149
1149
  enumerable: true,
1150
1150
  configurable: true
1151
1151
  });
1152
- Object.defineProperty(fs22, "WriteStream", {
1152
+ Object.defineProperty(fs18, "WriteStream", {
1153
1153
  get: function() {
1154
1154
  return WriteStream;
1155
1155
  },
@@ -1160,7 +1160,7 @@ var require_graceful_fs = __commonJS({
1160
1160
  configurable: true
1161
1161
  });
1162
1162
  var FileReadStream = ReadStream;
1163
- Object.defineProperty(fs22, "FileReadStream", {
1163
+ Object.defineProperty(fs18, "FileReadStream", {
1164
1164
  get: function() {
1165
1165
  return FileReadStream;
1166
1166
  },
@@ -1171,7 +1171,7 @@ var require_graceful_fs = __commonJS({
1171
1171
  configurable: true
1172
1172
  });
1173
1173
  var FileWriteStream = WriteStream;
1174
- Object.defineProperty(fs22, "FileWriteStream", {
1174
+ Object.defineProperty(fs18, "FileWriteStream", {
1175
1175
  get: function() {
1176
1176
  return FileWriteStream;
1177
1177
  },
@@ -1181,7 +1181,7 @@ var require_graceful_fs = __commonJS({
1181
1181
  enumerable: true,
1182
1182
  configurable: true
1183
1183
  });
1184
- function ReadStream(path28, options) {
1184
+ function ReadStream(path25, options) {
1185
1185
  if (this instanceof ReadStream)
1186
1186
  return fs$ReadStream.apply(this, arguments), this;
1187
1187
  else
@@ -1201,7 +1201,7 @@ var require_graceful_fs = __commonJS({
1201
1201
  }
1202
1202
  });
1203
1203
  }
1204
- function WriteStream(path28, options) {
1204
+ function WriteStream(path25, options) {
1205
1205
  if (this instanceof WriteStream)
1206
1206
  return fs$WriteStream.apply(this, arguments), this;
1207
1207
  else
@@ -1219,22 +1219,22 @@ var require_graceful_fs = __commonJS({
1219
1219
  }
1220
1220
  });
1221
1221
  }
1222
- function createReadStream(path28, options) {
1223
- return new fs22.ReadStream(path28, options);
1222
+ function createReadStream(path25, options) {
1223
+ return new fs18.ReadStream(path25, options);
1224
1224
  }
1225
- function createWriteStream(path28, options) {
1226
- return new fs22.WriteStream(path28, options);
1225
+ function createWriteStream(path25, options) {
1226
+ return new fs18.WriteStream(path25, options);
1227
1227
  }
1228
- var fs$open = fs22.open;
1229
- fs22.open = open;
1230
- function open(path28, flags, mode, cb) {
1228
+ var fs$open = fs18.open;
1229
+ fs18.open = open;
1230
+ function open(path25, flags, mode, cb) {
1231
1231
  if (typeof mode === "function")
1232
1232
  cb = mode, mode = null;
1233
- return go$open(path28, flags, mode, cb);
1234
- function go$open(path29, flags2, mode2, cb2, startTime) {
1235
- return fs$open(path29, flags2, mode2, function(err, fd) {
1233
+ return go$open(path25, flags, mode, cb);
1234
+ function go$open(path26, flags2, mode2, cb2, startTime) {
1235
+ return fs$open(path26, flags2, mode2, function(err, fd) {
1236
1236
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1237
- enqueue([go$open, [path29, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
1237
+ enqueue([go$open, [path26, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
1238
1238
  else {
1239
1239
  if (typeof cb2 === "function")
1240
1240
  cb2.apply(this, arguments);
@@ -1242,20 +1242,20 @@ var require_graceful_fs = __commonJS({
1242
1242
  });
1243
1243
  }
1244
1244
  }
1245
- return fs22;
1245
+ return fs18;
1246
1246
  }
1247
1247
  function enqueue(elem) {
1248
1248
  debug("ENQUEUE", elem[0].name, elem[1]);
1249
- fs21[gracefulQueue].push(elem);
1249
+ fs17[gracefulQueue].push(elem);
1250
1250
  retry();
1251
1251
  }
1252
1252
  var retryTimer;
1253
1253
  function resetQueue() {
1254
1254
  var now = Date.now();
1255
- for (var i = 0; i < fs21[gracefulQueue].length; ++i) {
1256
- if (fs21[gracefulQueue][i].length > 2) {
1257
- fs21[gracefulQueue][i][3] = now;
1258
- fs21[gracefulQueue][i][4] = now;
1255
+ for (var i = 0; i < fs17[gracefulQueue].length; ++i) {
1256
+ if (fs17[gracefulQueue][i].length > 2) {
1257
+ fs17[gracefulQueue][i][3] = now;
1258
+ fs17[gracefulQueue][i][4] = now;
1259
1259
  }
1260
1260
  }
1261
1261
  retry();
@@ -1263,9 +1263,9 @@ var require_graceful_fs = __commonJS({
1263
1263
  function retry() {
1264
1264
  clearTimeout(retryTimer);
1265
1265
  retryTimer = void 0;
1266
- if (fs21[gracefulQueue].length === 0)
1266
+ if (fs17[gracefulQueue].length === 0)
1267
1267
  return;
1268
- var elem = fs21[gracefulQueue].shift();
1268
+ var elem = fs17[gracefulQueue].shift();
1269
1269
  var fn = elem[0];
1270
1270
  var args = elem[1];
1271
1271
  var err = elem[2];
@@ -1287,7 +1287,7 @@ var require_graceful_fs = __commonJS({
1287
1287
  debug("RETRY", fn.name, args);
1288
1288
  fn.apply(null, args.concat([startTime]));
1289
1289
  } else {
1290
- fs21[gracefulQueue].push(elem);
1290
+ fs17[gracefulQueue].push(elem);
1291
1291
  }
1292
1292
  }
1293
1293
  if (retryTimer === void 0) {
@@ -1722,10 +1722,10 @@ var require_mtime_precision = __commonJS({
1722
1722
  "../../node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
1723
1723
  "use strict";
1724
1724
  var cacheSymbol = /* @__PURE__ */ Symbol();
1725
- function probe(file, fs21, callback) {
1726
- const cachedPrecision = fs21[cacheSymbol];
1725
+ function probe(file, fs17, callback) {
1726
+ const cachedPrecision = fs17[cacheSymbol];
1727
1727
  if (cachedPrecision) {
1728
- return fs21.stat(file, (err, stat) => {
1728
+ return fs17.stat(file, (err, stat) => {
1729
1729
  if (err) {
1730
1730
  return callback(err);
1731
1731
  }
@@ -1733,16 +1733,16 @@ var require_mtime_precision = __commonJS({
1733
1733
  });
1734
1734
  }
1735
1735
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
1736
- fs21.utimes(file, mtime, mtime, (err) => {
1736
+ fs17.utimes(file, mtime, mtime, (err) => {
1737
1737
  if (err) {
1738
1738
  return callback(err);
1739
1739
  }
1740
- fs21.stat(file, (err2, stat) => {
1740
+ fs17.stat(file, (err2, stat) => {
1741
1741
  if (err2) {
1742
1742
  return callback(err2);
1743
1743
  }
1744
1744
  const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1745
- Object.defineProperty(fs21, cacheSymbol, { value: precision });
1745
+ Object.defineProperty(fs17, cacheSymbol, { value: precision });
1746
1746
  callback(null, stat.mtime, precision);
1747
1747
  });
1748
1748
  });
@@ -1763,8 +1763,8 @@ var require_mtime_precision = __commonJS({
1763
1763
  var require_lockfile = __commonJS({
1764
1764
  "../../node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
1765
1765
  "use strict";
1766
- var path28 = __require("path");
1767
- var fs21 = require_graceful_fs();
1766
+ var path25 = __require("path");
1767
+ var fs17 = require_graceful_fs();
1768
1768
  var retry = require_retry2();
1769
1769
  var onExit = require_signal_exit();
1770
1770
  var mtimePrecision = require_mtime_precision();
@@ -1774,7 +1774,7 @@ var require_lockfile = __commonJS({
1774
1774
  }
1775
1775
  function resolveCanonicalPath(file, options, callback) {
1776
1776
  if (!options.realpath) {
1777
- return callback(null, path28.resolve(file));
1777
+ return callback(null, path25.resolve(file));
1778
1778
  }
1779
1779
  options.fs.realpath(file, callback);
1780
1780
  }
@@ -1895,7 +1895,7 @@ var require_lockfile = __commonJS({
1895
1895
  update: null,
1896
1896
  realpath: true,
1897
1897
  retries: 0,
1898
- fs: fs21,
1898
+ fs: fs17,
1899
1899
  onCompromised: (err) => {
1900
1900
  throw err;
1901
1901
  },
@@ -1939,7 +1939,7 @@ var require_lockfile = __commonJS({
1939
1939
  }
1940
1940
  function unlock(file, options, callback) {
1941
1941
  options = {
1942
- fs: fs21,
1942
+ fs: fs17,
1943
1943
  realpath: true,
1944
1944
  ...options
1945
1945
  };
@@ -1961,7 +1961,7 @@ var require_lockfile = __commonJS({
1961
1961
  options = {
1962
1962
  stale: 1e4,
1963
1963
  realpath: true,
1964
- fs: fs21,
1964
+ fs: fs17,
1965
1965
  ...options
1966
1966
  };
1967
1967
  options.stale = Math.max(options.stale || 0, 2e3);
@@ -2000,16 +2000,16 @@ var require_lockfile = __commonJS({
2000
2000
  var require_adapter = __commonJS({
2001
2001
  "../../node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
2002
2002
  "use strict";
2003
- var fs21 = require_graceful_fs();
2004
- function createSyncFs(fs22) {
2003
+ var fs17 = require_graceful_fs();
2004
+ function createSyncFs(fs18) {
2005
2005
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
2006
- const newFs = { ...fs22 };
2006
+ const newFs = { ...fs18 };
2007
2007
  methods.forEach((method) => {
2008
2008
  newFs[method] = (...args) => {
2009
2009
  const callback = args.pop();
2010
2010
  let ret;
2011
2011
  try {
2012
- ret = fs22[`${method}Sync`](...args);
2012
+ ret = fs18[`${method}Sync`](...args);
2013
2013
  } catch (err) {
2014
2014
  return callback(err);
2015
2015
  }
@@ -2047,7 +2047,7 @@ var require_adapter = __commonJS({
2047
2047
  }
2048
2048
  function toSyncOptions(options) {
2049
2049
  options = { ...options };
2050
- options.fs = createSyncFs(options.fs || fs21);
2050
+ options.fs = createSyncFs(options.fs || fs17);
2051
2051
  if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
2052
2052
  throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
2053
2053
  }
@@ -2247,15 +2247,14 @@ function keyPreview(key) {
2247
2247
 
2248
2248
  // src/manifest/parser.ts
2249
2249
  var CLEF_MANIFEST_FILENAME = "clef.yaml";
2250
- var VALID_BACKENDS = ["age", "awskms", "gcpkms", "azurekv", "pgp", "cloud"];
2250
+ var VALID_BACKENDS = ["age", "awskms", "gcpkms", "azurekv", "pgp"];
2251
2251
  var VALID_TOP_LEVEL_KEYS = [
2252
2252
  "version",
2253
2253
  "environments",
2254
2254
  "namespaces",
2255
2255
  "sops",
2256
2256
  "file_pattern",
2257
- "service_identities",
2258
- "cloud"
2257
+ "service_identities"
2259
2258
  ];
2260
2259
  var ENV_NAME_PATTERN = /^[a-z][a-z0-9_-]*$/;
2261
2260
  var FILE_PATTERN_REQUIRED_TOKENS = ["{namespace}", "{environment}"];
@@ -2639,6 +2638,12 @@ var ManifestParser = class {
2639
2638
  "service_identities"
2640
2639
  );
2641
2640
  }
2641
+ if (siObj.pack_only !== void 0 && typeof siObj.pack_only !== "boolean") {
2642
+ throw new ManifestValidationError(
2643
+ `Service identity '${siName}' has a non-boolean 'pack_only' field.`,
2644
+ "service_identities"
2645
+ );
2646
+ }
2642
2647
  if (!Array.isArray(siObj.namespaces) || siObj.namespaces.length === 0) {
2643
2648
  throw new ManifestValidationError(
2644
2649
  `Service identity '${siName}' must have a non-empty 'namespaces' array.`,
@@ -2744,7 +2749,8 @@ var ManifestParser = class {
2744
2749
  name: siName,
2745
2750
  description: siObj.description ?? "",
2746
2751
  namespaces: siObj.namespaces,
2747
- environments: parsedEnvs
2752
+ environments: parsedEnvs,
2753
+ ...siObj.pack_only === true ? { pack_only: true } : {}
2748
2754
  };
2749
2755
  });
2750
2756
  const siNames = /* @__PURE__ */ new Set();
@@ -2758,47 +2764,13 @@ var ManifestParser = class {
2758
2764
  siNames.add(si.name);
2759
2765
  }
2760
2766
  }
2761
- let cloud;
2762
- if (obj.cloud !== void 0) {
2763
- if (typeof obj.cloud !== "object" || obj.cloud === null || Array.isArray(obj.cloud)) {
2764
- throw new ManifestValidationError("Field 'cloud' must be an object.", "cloud");
2765
- }
2766
- const cloudObj = obj.cloud;
2767
- if (typeof cloudObj.integrationId !== "string" || cloudObj.integrationId.length === 0) {
2768
- throw new ManifestValidationError(
2769
- "Field 'cloud.integrationId' is required and must be a non-empty string.",
2770
- "cloud"
2771
- );
2772
- }
2773
- if (typeof cloudObj.keyId !== "string" || cloudObj.keyId.length === 0) {
2774
- throw new ManifestValidationError(
2775
- "Field 'cloud.keyId' is required and must be a non-empty string.",
2776
- "cloud"
2777
- );
2778
- }
2779
- if (!/^clef:[a-zA-Z0-9_]+\/[a-zA-Z0-9_-]+$/.test(cloudObj.keyId)) {
2780
- throw new ManifestValidationError(
2781
- `Field 'cloud.keyId' has invalid format '${cloudObj.keyId}'. Must match: clef:<integrationId>/<keyAlias>`,
2782
- "cloud"
2783
- );
2784
- }
2785
- cloud = { integrationId: cloudObj.integrationId, keyId: cloudObj.keyId };
2786
- }
2787
- const usesCloudBackend = sopsConfig.default_backend === "cloud" || environments.some((e) => e.sops?.backend === "cloud");
2788
- if (usesCloudBackend && !cloud) {
2789
- throw new ManifestValidationError(
2790
- "One or more environments use the 'cloud' backend but the manifest is missing the top-level 'cloud' block with 'integrationId' and 'keyId'.",
2791
- "cloud"
2792
- );
2793
- }
2794
2767
  return {
2795
2768
  version: 1,
2796
2769
  environments,
2797
2770
  namespaces,
2798
2771
  sops: sopsConfig,
2799
2772
  file_pattern: obj.file_pattern,
2800
- ...serviceIdentities ? { service_identities: serviceIdentities } : {},
2801
- ...cloud ? { cloud } : {}
2773
+ ...serviceIdentities ? { service_identities: serviceIdentities } : {}
2802
2774
  };
2803
2775
  }
2804
2776
  /**
@@ -3740,6 +3712,11 @@ var PRE_COMMIT_HOOK = `#!/bin/sh
3740
3712
  # and scans staged files for plaintext secrets.
3741
3713
  # Installed by: clef hooks install
3742
3714
 
3715
+ # Skip during TransactionManager commits (policy scaffolding, migrations, etc.)
3716
+ if [ "$CLEF_IN_TRANSACTION" = "1" ]; then
3717
+ exit 0
3718
+ fi
3719
+
3743
3720
  STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
3744
3721
  EXIT_CODE=0
3745
3722
 
@@ -4096,12 +4073,10 @@ ${mergeRule}
4096
4073
  ` : `# Clef: SOPS-aware merge driver for encrypted files
4097
4074
  ${mergeRule}
4098
4075
  `;
4099
- const writeResult = await this.runner.run("tee", [attrPath], {
4100
- stdin: newContent,
4101
- cwd: repoRoot
4102
- });
4103
- if (writeResult.exitCode !== 0) {
4104
- throw new GitOperationError(`Failed to write .gitattributes: ${writeResult.stderr.trim()}`);
4076
+ try {
4077
+ fs9.writeFileSync(attrPath, newContent, "utf-8");
4078
+ } catch (err) {
4079
+ throw new GitOperationError(`Failed to write .gitattributes: ${err.message}`);
4105
4080
  }
4106
4081
  }
4107
4082
  /**
@@ -4113,22 +4088,18 @@ ${mergeRule}
4113
4088
  */
4114
4089
  async installPreCommitHook(repoRoot) {
4115
4090
  const hookPath = path8.join(repoRoot, ".git", "hooks", "pre-commit");
4116
- const result = await this.runner.run("tee", [hookPath], {
4117
- stdin: PRE_COMMIT_HOOK,
4118
- cwd: repoRoot
4119
- });
4120
- if (result.exitCode !== 0) {
4091
+ try {
4092
+ const hooksDir = path8.dirname(hookPath);
4093
+ if (!fs9.existsSync(hooksDir)) {
4094
+ fs9.mkdirSync(hooksDir, { recursive: true });
4095
+ }
4096
+ fs9.writeFileSync(hookPath, PRE_COMMIT_HOOK, { mode: 493 });
4097
+ } catch (err) {
4121
4098
  throw new GitOperationError(
4122
- `Failed to install pre-commit hook: ${result.stderr.trim()}`,
4099
+ `Failed to install pre-commit hook: ${err.message}`,
4123
4100
  "Ensure .git/hooks/ directory exists."
4124
4101
  );
4125
4102
  }
4126
- const chmodResult = await this.runner.run("chmod", ["+x", hookPath], { cwd: repoRoot });
4127
- if (chmodResult.exitCode !== 0) {
4128
- throw new GitOperationError(
4129
- `Failed to make pre-commit hook executable: ${chmodResult.stderr.trim()}`
4130
- );
4131
- }
4132
4103
  }
4133
4104
  };
4134
4105
 
@@ -4513,13 +4484,6 @@ function openWindowsInputPipe(content) {
4513
4484
  });
4514
4485
  });
4515
4486
  }
4516
- function cloudKeyToArn(keyId) {
4517
- const body = keyId.replace(/^clef:/, "");
4518
- const sep = body.indexOf("/");
4519
- const integration = sep >= 0 ? body.slice(0, sep) : body;
4520
- const env = sep >= 0 ? body.slice(sep + 1) : "default";
4521
- return `arn:aws:kms:us-east-1:000000000000:alias/clef/${integration}/${env}`;
4522
- }
4523
4487
  var SopsClient = class {
4524
4488
  /**
4525
4489
  * @param runner - Subprocess runner used to invoke the `sops` binary.
@@ -4529,18 +4493,14 @@ var SopsClient = class {
4529
4493
  * to the subprocess environment.
4530
4494
  * @param sopsPath - Optional explicit path to the sops binary. When omitted,
4531
4495
  * resolved automatically via {@link resolveSopsPath}.
4532
- * @param keyserviceAddr - Optional keyservice address (e.g. `tcp://127.0.0.1:12345`).
4533
- * When set, all SOPS invocations include `--enable-local-keyservice=false --keyservice <addr>`.
4534
4496
  */
4535
- constructor(runner, ageKeyFile, ageKey, sopsPath, keyserviceAddr) {
4497
+ constructor(runner, ageKeyFile, ageKey, sopsPath) {
4536
4498
  this.runner = runner;
4537
4499
  this.ageKeyFile = ageKeyFile;
4538
4500
  this.ageKey = ageKey;
4539
4501
  this.sopsCommand = sopsPath ?? resolveSopsPath().path;
4540
- this.keyserviceArgs = keyserviceAddr ? ["--enable-local-keyservice=false", "--keyservice", keyserviceAddr] : [];
4541
4502
  }
4542
4503
  sopsCommand;
4543
- keyserviceArgs;
4544
4504
  buildSopsEnv() {
4545
4505
  const env = {};
4546
4506
  if (this.ageKey) {
@@ -4565,7 +4525,7 @@ var SopsClient = class {
4565
4525
  const env = this.buildSopsEnv();
4566
4526
  const result = await this.runner.run(
4567
4527
  this.sopsCommand,
4568
- ["decrypt", ...this.keyserviceArgs, "--output-type", fmt, filePath],
4528
+ ["decrypt", "--output-type", fmt, filePath],
4569
4529
  {
4570
4530
  ...env ? { env } : {}
4571
4531
  }
@@ -4632,7 +4592,6 @@ var SopsClient = class {
4632
4592
  "--config",
4633
4593
  configPath,
4634
4594
  "encrypt",
4635
- ...this.keyserviceArgs,
4636
4595
  ...args,
4637
4596
  "--input-type",
4638
4597
  fmt,
@@ -4689,7 +4648,7 @@ var SopsClient = class {
4689
4648
  const env = this.buildSopsEnv();
4690
4649
  const result = await this.runner.run(
4691
4650
  this.sopsCommand,
4692
- ["rotate", ...this.keyserviceArgs, "-i", "--add-age", key, filePath],
4651
+ ["rotate", "-i", "--add-age", key, filePath],
4693
4652
  {
4694
4653
  ...env ? { env } : {}
4695
4654
  }
@@ -4713,7 +4672,7 @@ var SopsClient = class {
4713
4672
  const env = this.buildSopsEnv();
4714
4673
  const result = await this.runner.run(
4715
4674
  this.sopsCommand,
4716
- ["rotate", ...this.keyserviceArgs, "-i", "--rm-age", key, filePath],
4675
+ ["rotate", "-i", "--rm-age", key, filePath],
4717
4676
  {
4718
4677
  ...env ? { env } : {}
4719
4678
  }
@@ -4825,13 +4784,7 @@ var SopsClient = class {
4825
4784
  }
4826
4785
  detectBackend(sops) {
4827
4786
  if (sops.age && Array.isArray(sops.age) && sops.age.length > 0) return "age";
4828
- if (sops.kms && Array.isArray(sops.kms) && sops.kms.length > 0) {
4829
- const firstArn = sops.kms[0]?.arn;
4830
- if (typeof firstArn === "string" && (firstArn.startsWith("clef:") || firstArn.includes("alias/clef/"))) {
4831
- return "cloud";
4832
- }
4833
- return "awskms";
4834
- }
4787
+ if (sops.kms && Array.isArray(sops.kms) && sops.kms.length > 0) return "awskms";
4835
4788
  if (sops.gcp_kms && Array.isArray(sops.gcp_kms) && sops.gcp_kms.length > 0)
4836
4789
  return "gcpkms";
4837
4790
  if (sops.azure_kv && Array.isArray(sops.azure_kv) && sops.azure_kv.length > 0)
@@ -4845,7 +4798,6 @@ var SopsClient = class {
4845
4798
  const entries = sops.age;
4846
4799
  return entries?.map((e) => String(e.recipient ?? "")) ?? [];
4847
4800
  }
4848
- case "cloud":
4849
4801
  case "awskms": {
4850
4802
  const entries = sops.kms;
4851
4803
  return entries?.map((e) => String(e.arn ?? "")) ?? [];
@@ -4907,13 +4859,6 @@ var SopsClient = class {
4907
4859
  args.push("--pgp", config.pgp_fingerprint);
4908
4860
  }
4909
4861
  break;
4910
- case "cloud": {
4911
- const cloudKeyId = manifest.cloud?.keyId;
4912
- if (cloudKeyId) {
4913
- args.push("--kms", cloudKeyToArn(cloudKeyId));
4914
- }
4915
- break;
4916
- }
4917
4862
  }
4918
4863
  return args;
4919
4864
  }
@@ -5151,6 +5096,18 @@ var LintRunner = class {
5151
5096
  });
5152
5097
  }
5153
5098
  }
5099
+ if (si.pack_only) {
5100
+ const ageRecipients = Object.values(si.environments).filter((cfg) => !isKmsEnvelope(cfg) && cfg.recipient).map((cfg) => cfg.recipient);
5101
+ if (ageRecipients.length >= 2 && new Set(ageRecipients).size === 1) {
5102
+ issues.push({
5103
+ severity: "warning",
5104
+ category: "service-identity",
5105
+ file: "clef.yaml",
5106
+ message: `Runtime identity '${si.name}' uses a shared recipient across all environments. A compromised key in any environment decrypts artifacts for all environments. Consider per-environment keys for runtime workloads.`
5107
+ });
5108
+ }
5109
+ continue;
5110
+ }
5154
5111
  for (const cell of existingCells) {
5155
5112
  const envConfig = si.environments[cell.environment];
5156
5113
  if (!envConfig) continue;
@@ -6510,12 +6467,10 @@ var ServiceIdentityManager = class {
6510
6467
  * Create a new service identity with per-environment age key pairs or KMS envelope config.
6511
6468
  * For age-only: generates keys, updates the manifest, and registers public keys as SOPS recipients.
6512
6469
  * For KMS: stores KMS config in manifest, no age keys generated.
6513
- *
6514
- * @param kmsEnvConfigs - Optional per-environment KMS config. When provided, those envs use
6515
- * KMS envelope encryption instead of generating age keys.
6516
- * @returns The created identity definition and the per-environment private keys (empty for KMS envs).
6470
+ * For pack-only (runtime) identities: keys are generated but NOT registered on SOPS files.
6517
6471
  */
6518
- async create(name, namespaces, description, manifest, repoRoot, kmsEnvConfigs) {
6472
+ async create(name, namespaces, description, manifest, repoRoot, options) {
6473
+ const { kmsEnvConfigs, sharedRecipient, packOnly } = options ?? {};
6519
6474
  if (manifest.service_identities?.some((si) => si.name === name)) {
6520
6475
  throw new Error(`Service identity '${name}' already exists.`);
6521
6476
  }
@@ -6527,23 +6482,25 @@ var ServiceIdentityManager = class {
6527
6482
  }
6528
6483
  const environments = {};
6529
6484
  const privateKeys = {};
6485
+ const sharedKey = sharedRecipient ? await generateAgeIdentity() : void 0;
6530
6486
  for (const env of manifest.environments) {
6531
6487
  const kmsConfig = kmsEnvConfigs?.[env.name];
6532
6488
  if (kmsConfig) {
6533
6489
  environments[env.name] = { kms: kmsConfig };
6534
6490
  } else {
6535
- const identity = await generateAgeIdentity();
6536
- environments[env.name] = { recipient: identity.publicKey };
6537
- privateKeys[env.name] = identity.privateKey;
6491
+ const ageIdentity = sharedKey ?? await generateAgeIdentity();
6492
+ environments[env.name] = { recipient: ageIdentity.publicKey };
6493
+ privateKeys[env.name] = ageIdentity.privateKey;
6538
6494
  }
6539
6495
  }
6540
6496
  const definition = {
6541
6497
  name,
6542
6498
  description,
6543
6499
  namespaces,
6544
- environments
6500
+ environments,
6501
+ ...packOnly ? { pack_only: true } : {}
6545
6502
  };
6546
- const cells = this.matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists && namespaces.includes(c.namespace));
6503
+ const cells = packOnly ? [] : this.matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists && namespaces.includes(c.namespace));
6547
6504
  await this.tx.run(repoRoot, {
6548
6505
  description: `clef service create ${name}`,
6549
6506
  paths: this.txPaths(repoRoot, cells),
@@ -6557,12 +6514,13 @@ var ServiceIdentityManager = class {
6557
6514
  name,
6558
6515
  description,
6559
6516
  namespaces,
6560
- environments
6517
+ environments,
6518
+ ...packOnly ? { pack_only: true } : {}
6561
6519
  });
6562
6520
  writeManifestYaml(repoRoot, doc);
6563
6521
  }
6564
6522
  });
6565
- return { identity: definition, privateKeys };
6523
+ return { identity: definition, privateKeys, sharedRecipient: sharedKey !== void 0 };
6566
6524
  }
6567
6525
  /**
6568
6526
  * List all service identities from the manifest.
@@ -6585,7 +6543,7 @@ var ServiceIdentityManager = class {
6585
6543
  if (!identity) {
6586
6544
  throw new Error(`Service identity '${name}' not found.`);
6587
6545
  }
6588
- const scopedCells = this.matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists && identity.namespaces.includes(c.namespace));
6546
+ const scopedCells = identity.pack_only ? [] : this.matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists && identity.namespaces.includes(c.namespace));
6589
6547
  await this.tx.run(repoRoot, {
6590
6548
  description: `clef service delete ${name}`,
6591
6549
  paths: this.txPaths(repoRoot, scopedCells),
@@ -6641,7 +6599,7 @@ var ServiceIdentityManager = class {
6641
6599
  const envs = siDoc.environments;
6642
6600
  for (const [envName, kmsConfig] of Object.entries(kmsEnvConfigs)) {
6643
6601
  const oldConfig = identity.environments[envName];
6644
- if (oldConfig?.recipient && !isKmsEnvelope(oldConfig)) {
6602
+ if (!identity.pack_only && oldConfig?.recipient && !isKmsEnvelope(oldConfig)) {
6645
6603
  const scopedCells = cells.filter((c) => c.environment === envName);
6646
6604
  for (const cell of scopedCells) {
6647
6605
  try {
@@ -6660,8 +6618,10 @@ var ServiceIdentityManager = class {
6660
6618
  }
6661
6619
  /**
6662
6620
  * Register a service identity's public keys as SOPS recipients on scoped matrix files.
6621
+ * Pack-only (runtime) identities skip registration entirely.
6663
6622
  */
6664
6623
  async registerRecipients(identity, manifest, repoRoot) {
6624
+ if (identity.pack_only) return;
6665
6625
  const cells = this.matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists);
6666
6626
  for (const cell of cells) {
6667
6627
  if (!identity.namespaces.includes(cell.namespace)) continue;
@@ -6711,18 +6671,20 @@ var ServiceIdentityManager = class {
6711
6671
  description: `clef service update ${name}: add namespaces ${toAdd.join(",")}`,
6712
6672
  paths: this.txPaths(repoRoot, cells),
6713
6673
  mutate: async () => {
6714
- for (const cell of cells) {
6715
- const envConfig = identity.environments[cell.environment];
6716
- if (!envConfig) continue;
6717
- if (isKmsEnvelope(envConfig)) continue;
6718
- if (!envConfig.recipient) continue;
6719
- try {
6720
- await this.encryption.addRecipient(cell.filePath, envConfig.recipient);
6721
- affectedFiles.push(cell.filePath);
6722
- } catch (err) {
6723
- const message = err instanceof Error ? err.message : String(err);
6724
- if (!message.includes("already")) {
6725
- throw err;
6674
+ if (!identity.pack_only) {
6675
+ for (const cell of cells) {
6676
+ const envConfig = identity.environments[cell.environment];
6677
+ if (!envConfig) continue;
6678
+ if (isKmsEnvelope(envConfig)) continue;
6679
+ if (!envConfig.recipient) continue;
6680
+ try {
6681
+ await this.encryption.addRecipient(cell.filePath, envConfig.recipient);
6682
+ affectedFiles.push(cell.filePath);
6683
+ } catch (err) {
6684
+ const message = err instanceof Error ? err.message : String(err);
6685
+ if (!message.includes("already")) {
6686
+ throw err;
6687
+ }
6726
6688
  }
6727
6689
  }
6728
6690
  }
@@ -6770,15 +6732,17 @@ var ServiceIdentityManager = class {
6770
6732
  description: `clef service update ${name}: remove namespaces ${namespacesToRemove.join(",")}`,
6771
6733
  paths: this.txPaths(repoRoot, cells),
6772
6734
  mutate: async () => {
6773
- for (const cell of cells) {
6774
- const envConfig = identity.environments[cell.environment];
6775
- if (!envConfig) continue;
6776
- if (isKmsEnvelope(envConfig)) continue;
6777
- if (!envConfig.recipient) continue;
6778
- try {
6779
- await this.encryption.removeRecipient(cell.filePath, envConfig.recipient);
6780
- affectedFiles.push(cell.filePath);
6781
- } catch {
6735
+ if (!identity.pack_only) {
6736
+ for (const cell of cells) {
6737
+ const envConfig = identity.environments[cell.environment];
6738
+ if (!envConfig) continue;
6739
+ if (isKmsEnvelope(envConfig)) continue;
6740
+ if (!envConfig.recipient) continue;
6741
+ try {
6742
+ await this.encryption.removeRecipient(cell.filePath, envConfig.recipient);
6743
+ affectedFiles.push(cell.filePath);
6744
+ } catch {
6745
+ }
6782
6746
  }
6783
6747
  }
6784
6748
  const doc = readManifestYaml(repoRoot);
@@ -6841,7 +6805,7 @@ var ServiceIdentityManager = class {
6841
6805
  description: `clef service add-env ${name} ${envName}`,
6842
6806
  paths: this.txPaths(repoRoot, cells),
6843
6807
  mutate: async () => {
6844
- if (!isKmsEnvelope(envConfig) && envConfig.recipient) {
6808
+ if (!identity.pack_only && !isKmsEnvelope(envConfig) && envConfig.recipient) {
6845
6809
  for (const cell of cells) {
6846
6810
  try {
6847
6811
  await this.encryption.addRecipient(cell.filePath, envConfig.recipient);
@@ -6900,7 +6864,7 @@ var ServiceIdentityManager = class {
6900
6864
  if (targetEnvNames.size === 0) {
6901
6865
  return newPrivateKeys;
6902
6866
  }
6903
- const cells = this.matrixManager.resolveMatrix(manifest, repoRoot).filter(
6867
+ const cells = identity.pack_only ? [] : this.matrixManager.resolveMatrix(manifest, repoRoot).filter(
6904
6868
  (c) => c.exists && identity.namespaces.includes(c.namespace) && targetEnvNames.has(c.environment)
6905
6869
  );
6906
6870
  await this.tx.run(repoRoot, {
@@ -6917,13 +6881,15 @@ var ServiceIdentityManager = class {
6917
6881
  const oldRecipient = identity.environments[envName].recipient;
6918
6882
  const newPublicKey = newPublicKeys[envName];
6919
6883
  envs[envName] = { recipient: newPublicKey };
6920
- const scopedCells = cells.filter((c) => c.environment === envName);
6921
- for (const cell of scopedCells) {
6922
- try {
6923
- await this.encryption.removeRecipient(cell.filePath, oldRecipient);
6924
- } catch {
6884
+ if (!identity.pack_only) {
6885
+ const scopedCells = cells.filter((c) => c.environment === envName);
6886
+ for (const cell of scopedCells) {
6887
+ try {
6888
+ await this.encryption.removeRecipient(cell.filePath, oldRecipient);
6889
+ } catch {
6890
+ }
6891
+ await this.encryption.addRecipient(cell.filePath, newPublicKey);
6925
6892
  }
6926
- await this.encryption.addRecipient(cell.filePath, newPublicKey);
6927
6893
  }
6928
6894
  }
6929
6895
  writeManifestYaml(repoRoot, doc);
@@ -6963,6 +6929,17 @@ var ServiceIdentityManager = class {
6963
6929
  });
6964
6930
  }
6965
6931
  }
6932
+ if (si.pack_only) {
6933
+ const ageRecipients = Object.values(si.environments).filter((cfg) => !isKmsEnvelope(cfg) && cfg.recipient).map((cfg) => cfg.recipient);
6934
+ if (ageRecipients.length >= 2 && new Set(ageRecipients).size === 1) {
6935
+ issues.push({
6936
+ identity: si.name,
6937
+ type: "runtime_shared_recipient",
6938
+ message: `Runtime identity '${si.name}' uses a shared recipient across all environments. A compromised key in any environment decrypts artifacts for all environments. Consider per-environment keys for runtime workloads.`
6939
+ });
6940
+ }
6941
+ continue;
6942
+ }
6966
6943
  for (const cell of cells) {
6967
6944
  const envConfig = si.environments[cell.environment];
6968
6945
  if (!envConfig) continue;
@@ -7809,12 +7786,7 @@ var ArtifactPacker = class {
7809
7786
  };
7810
7787
 
7811
7788
  // src/kms/types.ts
7812
- var VALID_KMS_PROVIDERS = [
7813
- "aws",
7814
- "gcp",
7815
- "azure",
7816
- "cloud"
7817
- ];
7789
+ var VALID_KMS_PROVIDERS = ["aws", "gcp", "azure"];
7818
7790
 
7819
7791
  // src/migration/backend.ts
7820
7792
  import * as path22 from "path";
@@ -7824,8 +7796,7 @@ var BACKEND_KEY_FIELDS = {
7824
7796
  awskms: "aws_kms_arn",
7825
7797
  gcpkms: "gcp_kms_resource_id",
7826
7798
  azurekv: "azure_kv_url",
7827
- pgp: "pgp_fingerprint",
7828
- cloud: void 0
7799
+ pgp: "pgp_fingerprint"
7829
7800
  };
7830
7801
  var ALL_KEY_FIELDS = Object.values(BACKEND_KEY_FIELDS).filter(
7831
7802
  (v) => v !== void 0
@@ -8020,18 +7991,6 @@ var BackendMigrator = class {
8020
7991
  sops[keyField] = target.key;
8021
7992
  }
8022
7993
  }
8023
- if (doc.cloud && target.backend !== "cloud") {
8024
- const sops = doc.sops;
8025
- const environments = doc.environments;
8026
- const defaultIsCloud = sops.default_backend === "cloud";
8027
- const anyEnvIsCloud = environments.some((e) => {
8028
- const envSops = e.sops;
8029
- return envSops?.backend === "cloud";
8030
- });
8031
- if (!defaultIsCloud && !anyEnvIsCloud) {
8032
- delete doc.cloud;
8033
- }
8034
- }
8035
7994
  }
8036
7995
  checkAgeRecipientsWarning(manifest, target, environment, warnings) {
8037
7996
  if (target.backend === "age") return;
@@ -8240,281 +8199,111 @@ function withBackendOverride(manifest, envNames, backend, key) {
8240
8199
  };
8241
8200
  }
8242
8201
 
8243
- // src/cloud/keyservice.ts
8244
- import { spawn } from "child_process";
8245
- import * as readline from "readline";
8246
- var PORT_REGEX = /^PORT=(\d+)$/;
8247
- var STARTUP_TIMEOUT_MS = 5e3;
8248
- var SHUTDOWN_TIMEOUT_MS = 3e3;
8249
- async function spawnKeyservice(options) {
8250
- const args = ["--addr", "127.0.0.1:0"];
8251
- if (options.endpoint) {
8252
- args.push("--endpoint", options.endpoint);
8253
- }
8254
- const child = spawn(options.binaryPath, args, {
8255
- stdio: ["ignore", "pipe", "pipe"],
8256
- env: { ...process.env, CLEF_CLOUD_TOKEN: options.token }
8257
- });
8258
- const port = await readPort(child);
8259
- const addr = `tcp://127.0.0.1:${port}`;
8260
- return {
8261
- addr,
8262
- kill: () => killGracefully(child)
8263
- };
8264
- }
8265
- function readPort(child) {
8266
- return new Promise((resolve, reject) => {
8267
- let settled = false;
8268
- const rl = readline.createInterface({ input: child.stdout });
8269
- function settle() {
8270
- clearTimeout(timer);
8271
- rl.close();
8272
- }
8273
- const timer = setTimeout(() => {
8274
- if (!settled) {
8275
- settled = true;
8276
- settle();
8277
- child.kill("SIGKILL");
8278
- reject(new Error("Keyservice did not start within 5 seconds."));
8279
- }
8280
- }, STARTUP_TIMEOUT_MS);
8281
- rl.on("line", (line) => {
8282
- const match = PORT_REGEX.exec(line);
8283
- if (match && !settled) {
8284
- settled = true;
8285
- settle();
8286
- resolve(parseInt(match[1], 10));
8202
+ // src/sync/manager.ts
8203
+ import * as path24 from "path";
8204
+ var SyncManager = class {
8205
+ constructor(matrixManager, encryption, tx) {
8206
+ this.matrixManager = matrixManager;
8207
+ this.encryption = encryption;
8208
+ this.tx = tx;
8209
+ }
8210
+ /**
8211
+ * Compute what sync would do without mutating anything.
8212
+ */
8213
+ async plan(manifest, repoRoot, opts) {
8214
+ if (opts.namespace) {
8215
+ const exists = manifest.namespaces.some((n) => n.name === opts.namespace);
8216
+ if (!exists) {
8217
+ throw new Error(`Namespace '${opts.namespace}' not found in manifest.`);
8287
8218
  }
8288
- });
8289
- child.on("error", (err) => {
8290
- if (!settled) {
8291
- settled = true;
8292
- settle();
8293
- reject(new Error(`Failed to start keyservice: ${err.message}`));
8219
+ }
8220
+ const allCells = this.matrixManager.resolveMatrix(manifest, repoRoot);
8221
+ const existingCells = allCells.filter((c) => c.exists);
8222
+ const targetCells = opts.namespace ? existingCells.filter((c) => c.namespace === opts.namespace) : existingCells;
8223
+ const keysByNsEnv = {};
8224
+ for (const cell of targetCells) {
8225
+ const keys = readSopsKeyNames(cell.filePath);
8226
+ if (!keys) continue;
8227
+ if (!keysByNsEnv[cell.namespace]) keysByNsEnv[cell.namespace] = {};
8228
+ keysByNsEnv[cell.namespace][cell.environment] = new Set(keys);
8229
+ }
8230
+ const cells = [];
8231
+ let totalKeys = 0;
8232
+ let hasProtectedEnvs = false;
8233
+ for (const [nsName, envKeys] of Object.entries(keysByNsEnv)) {
8234
+ const allKeys = /* @__PURE__ */ new Set();
8235
+ for (const keys of Object.values(envKeys)) {
8236
+ for (const k of keys) allKeys.add(k);
8294
8237
  }
8295
- });
8296
- child.on("exit", (code) => {
8297
- if (!settled) {
8298
- settled = true;
8299
- settle();
8300
- reject(new Error(`Keyservice exited unexpectedly with code ${code}.`));
8238
+ for (const cell of targetCells) {
8239
+ if (cell.namespace !== nsName) continue;
8240
+ const cellKeys = envKeys[cell.environment];
8241
+ if (!cellKeys) continue;
8242
+ const missing = [...allKeys].filter((k) => !cellKeys.has(k));
8243
+ if (missing.length === 0) continue;
8244
+ const isProtected = this.matrixManager.isProtectedEnvironment(manifest, cell.environment);
8245
+ if (isProtected) hasProtectedEnvs = true;
8246
+ cells.push({
8247
+ namespace: cell.namespace,
8248
+ environment: cell.environment,
8249
+ filePath: cell.filePath,
8250
+ missingKeys: missing.sort(),
8251
+ isProtected
8252
+ });
8253
+ totalKeys += missing.length;
8301
8254
  }
8302
- });
8303
- });
8304
- }
8305
- function killGracefully(child) {
8306
- return new Promise((resolve) => {
8307
- if (child.exitCode !== null) {
8308
- resolve();
8309
- return;
8310
- }
8311
- const timer = setTimeout(() => {
8312
- child.kill("SIGKILL");
8313
- }, SHUTDOWN_TIMEOUT_MS);
8314
- child.on("exit", () => {
8315
- clearTimeout(timer);
8316
- resolve();
8317
- });
8318
- child.kill("SIGTERM");
8319
- });
8320
- }
8321
-
8322
- // src/cloud/resolver.ts
8323
- import * as fs18 from "fs";
8324
- import * as path25 from "path";
8325
-
8326
- // src/cloud/bundled.ts
8327
- import * as fs17 from "fs";
8328
- import * as path24 from "path";
8329
- function tryBundledKeyservice() {
8330
- const platform = process.platform;
8331
- const arch = process.arch;
8332
- const archName = arch === "x64" ? "x64" : arch === "arm64" ? "arm64" : null;
8333
- if (!archName) return null;
8334
- const platformName = platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : platform === "win32" ? "win32" : null;
8335
- if (!platformName) return null;
8336
- const packageName = `@clef-sh/keyservice-${platformName}-${archName}`;
8337
- const binName = platform === "win32" ? "clef-keyservice.exe" : "clef-keyservice";
8338
- try {
8339
- const packageMain = __require.resolve(`${packageName}/package.json`);
8340
- const packageDir = path24.dirname(packageMain);
8341
- const binPath = path24.join(packageDir, "bin", binName);
8342
- return fs17.existsSync(binPath) ? binPath : null;
8343
- } catch {
8344
- return null;
8345
- }
8346
- }
8347
-
8348
- // src/cloud/resolver.ts
8349
- function validateKeyservicePath(candidate) {
8350
- if (!path25.isAbsolute(candidate)) {
8351
- throw new Error(`CLEF_KEYSERVICE_PATH must be an absolute path, got '${candidate}'.`);
8352
- }
8353
- const segments = candidate.split(/[/\\]/);
8354
- if (segments.includes("..")) {
8355
- throw new Error(
8356
- `CLEF_KEYSERVICE_PATH contains '..' path segments ('${candidate}'). Use an absolute path without directory traversal.`
8357
- );
8358
- }
8359
- }
8360
- var cached2;
8361
- function resolveKeyservicePath() {
8362
- if (cached2) return cached2;
8363
- const envPath = process.env.CLEF_KEYSERVICE_PATH?.trim();
8364
- if (envPath) {
8365
- validateKeyservicePath(envPath);
8366
- if (!fs18.existsSync(envPath)) {
8367
- throw new Error(`CLEF_KEYSERVICE_PATH points to '${envPath}' but the file does not exist.`);
8368
8255
  }
8369
- cached2 = { path: envPath, source: "env" };
8370
- return cached2;
8371
- }
8372
- const bundledPath = tryBundledKeyservice();
8373
- if (bundledPath) {
8374
- cached2 = { path: bundledPath, source: "bundled" };
8375
- return cached2;
8376
- }
8377
- cached2 = { path: "clef-keyservice", source: "system" };
8378
- return cached2;
8379
- }
8380
- function resetKeyserviceResolution() {
8381
- cached2 = void 0;
8382
- }
8383
-
8384
- // src/cloud/credentials.ts
8385
- import * as fs19 from "fs";
8386
- import * as path26 from "path";
8387
- import * as os from "os";
8388
- import * as YAML11 from "yaml";
8389
-
8390
- // src/cloud/constants.ts
8391
- var CLOUD_DEFAULT_ENDPOINT = "https://api.clef.sh";
8392
-
8393
- // src/cloud/credentials.ts
8394
- var CREDENTIALS_FILENAME = "credentials.yaml";
8395
- function readCloudCredentials() {
8396
- const credPath = path26.join(os.homedir(), ".clef", CREDENTIALS_FILENAME);
8397
- let raw;
8398
- try {
8399
- raw = YAML11.parse(fs19.readFileSync(credPath, "utf-8"));
8400
- } catch {
8401
- return null;
8256
+ return { cells, totalKeys, hasProtectedEnvs };
8402
8257
  }
8403
- if (!raw || typeof raw !== "object") return null;
8404
- const obj = raw;
8405
- const token = typeof obj.token === "string" && obj.token.length > 0 ? obj.token : "";
8406
- const endpoint = typeof obj.endpoint === "string" ? obj.endpoint : CLOUD_DEFAULT_ENDPOINT;
8407
- if (!token && endpoint === CLOUD_DEFAULT_ENDPOINT) return null;
8408
- return { token, endpoint };
8409
- }
8410
- function writeCloudCredentials(credentials) {
8411
- const clefDir = path26.join(os.homedir(), ".clef");
8412
- fs19.mkdirSync(clefDir, { recursive: true, mode: 448 });
8413
- const credPath = path26.join(clefDir, CREDENTIALS_FILENAME);
8414
- const content = { token: credentials.token };
8415
- if (credentials.endpoint) {
8416
- content.endpoint = credentials.endpoint;
8417
- }
8418
- fs19.writeFileSync(credPath, YAML11.stringify(content), { mode: 384 });
8419
- }
8420
-
8421
- // src/cloud/device-flow.ts
8422
- async function initiateDeviceFlow(endpoint, options) {
8423
- const base = endpoint ?? CLOUD_DEFAULT_ENDPOINT;
8424
- const payload = {
8425
- clientType: "cli",
8426
- clientVersion: options.clientVersion,
8427
- repoName: options.repoName,
8428
- flow: options.flow
8429
- };
8430
- if (options.environment) {
8431
- payload.environment = options.environment;
8432
- }
8433
- const res = await fetch(`${base}/api/v1/device/init`, {
8434
- method: "POST",
8435
- headers: { "Content-Type": "application/json" },
8436
- body: JSON.stringify(payload)
8437
- });
8438
- if (!res.ok) {
8439
- const body = await res.text().catch(() => "");
8440
- throw new Error(`Device flow init failed (${res.status}): ${body}`);
8441
- }
8442
- const json = await res.json();
8443
- const session = json.data ?? json;
8444
- if (session.pollUrl && !session.pollUrl.startsWith("http")) {
8445
- session.pollUrl = `${base}${session.pollUrl}`;
8446
- }
8447
- return session;
8448
- }
8449
- async function pollDeviceFlow(pollUrl) {
8450
- const res = await fetch(pollUrl);
8451
- if (!res.ok) {
8452
- const body = await res.text().catch(() => "");
8453
- throw new Error(`Device flow poll failed (${res.status}): ${body}`);
8454
- }
8455
- const json = await res.json();
8456
- return json.data ?? json;
8457
- }
8458
-
8459
- // src/cloud/pack-client.ts
8460
- import * as fs20 from "fs";
8461
- import * as path27 from "path";
8462
- var CloudPackClient = class {
8463
- endpoint;
8464
- constructor(endpoint) {
8465
- this.endpoint = endpoint ?? CLOUD_DEFAULT_ENDPOINT;
8466
- }
8467
- async pack(token, config) {
8468
- const matrixManager = new MatrixManager();
8469
- const cells = matrixManager.resolveMatrix(config.manifest, config.repoRoot).filter((c) => c.environment === config.environment && c.exists);
8470
- const formData = new FormData();
8471
- const configJson = JSON.stringify({
8472
- identity: config.identity,
8473
- environment: config.environment,
8474
- ...config.ttl ? { ttl: config.ttl } : {}
8475
- });
8476
- formData.append("config", new Blob([configJson], { type: "application/json" }));
8477
- const manifestPath = path27.join(config.repoRoot, "clef.yaml");
8478
- const manifestContent = fs20.readFileSync(manifestPath, "utf-8");
8479
- formData.append("manifest", new Blob([manifestContent], { type: "text/yaml" }));
8480
- for (const cell of cells) {
8481
- const relPath = path27.relative(config.repoRoot, cell.filePath);
8482
- const content = fs20.readFileSync(cell.filePath, "utf-8");
8483
- formData.append(`files`, new Blob([content], { type: "text/yaml" }), relPath);
8484
- }
8485
- const res = await fetch(`${this.endpoint}/api/v1/cloud/pack`, {
8486
- method: "POST",
8487
- headers: { Authorization: `Bearer ${token}` },
8488
- body: formData
8489
- });
8490
- if (!res.ok) {
8491
- const body = await res.text().catch(() => "");
8492
- throw new Error(`Cloud pack failed (${res.status}): ${body}`);
8258
+ /**
8259
+ * Execute the sync: scaffold missing keys with random pending values.
8260
+ *
8261
+ * Returns immediately (no-op) when the plan has nothing to do.
8262
+ * When `dryRun` is set, returns a result with zero modifications —
8263
+ * the caller can inspect the plan via {@link plan} separately.
8264
+ */
8265
+ async sync(manifest, repoRoot, opts = {}) {
8266
+ const syncPlan = await this.plan(manifest, repoRoot, opts);
8267
+ if (opts.dryRun || syncPlan.totalKeys === 0) {
8268
+ return { modifiedCells: [], scaffoldedKeys: {}, totalKeysScaffolded: 0 };
8493
8269
  }
8494
- return await res.json();
8495
- }
8496
- };
8497
- var CloudArtifactClient = class {
8498
- endpoint;
8499
- constructor(endpoint) {
8500
- this.endpoint = endpoint ?? CLOUD_DEFAULT_ENDPOINT;
8501
- }
8502
- async upload(token, config) {
8503
- const res = await fetch(
8504
- `${this.endpoint}/api/v1/cloud/artifacts/${config.identity}/${config.environment}`,
8505
- {
8506
- method: "PUT",
8507
- headers: {
8508
- Authorization: `Bearer ${token}`,
8509
- "Content-Type": "application/json"
8510
- },
8511
- body: config.artifactJson
8270
+ const txPaths = [];
8271
+ for (const cell of syncPlan.cells) {
8272
+ const rel = path24.relative(repoRoot, cell.filePath);
8273
+ txPaths.push(rel);
8274
+ txPaths.push(rel.replace(/\.enc\.(yaml|json)$/, ".clef-meta.yaml"));
8275
+ }
8276
+ const modifiedCells = [];
8277
+ const scaffoldedKeys = {};
8278
+ const nsLabel = opts.namespace ?? "all";
8279
+ const envCount = new Set(syncPlan.cells.map((c) => c.environment)).size;
8280
+ await this.tx.run(repoRoot, {
8281
+ description: `clef sync ${nsLabel}: ${syncPlan.totalKeys} key(s) across ${envCount} environment(s)`,
8282
+ paths: txPaths,
8283
+ mutate: async () => {
8284
+ for (const cell of syncPlan.cells) {
8285
+ const decrypted = await this.encryption.decrypt(cell.filePath);
8286
+ for (const key of cell.missingKeys) {
8287
+ decrypted.values[key] = generateRandomValue();
8288
+ }
8289
+ await this.encryption.encrypt(
8290
+ cell.filePath,
8291
+ decrypted.values,
8292
+ manifest,
8293
+ cell.environment
8294
+ );
8295
+ await markPendingWithRetry(cell.filePath, cell.missingKeys, "clef sync");
8296
+ const cellLabel = `${cell.namespace}/${cell.environment}`;
8297
+ modifiedCells.push(cellLabel);
8298
+ scaffoldedKeys[cellLabel] = cell.missingKeys;
8299
+ }
8512
8300
  }
8513
- );
8514
- if (!res.ok) {
8515
- const body = await res.text().catch(() => "");
8516
- throw new Error(`Artifact upload failed (${res.status}): ${body}`);
8517
- }
8301
+ });
8302
+ return {
8303
+ modifiedCells,
8304
+ scaffoldedKeys,
8305
+ totalKeysScaffolded: syncPlan.totalKeys
8306
+ };
8518
8307
  }
8519
8308
  };
8520
8309
  export {
@@ -8526,9 +8315,7 @@ export {
8526
8315
  CLEF_SUPPORTED_EXTENSIONS,
8527
8316
  ClefError,
8528
8317
  CloudApiError,
8529
- CloudArtifactClient,
8530
8318
  CloudClient,
8531
- CloudPackClient,
8532
8319
  ConsumptionClient,
8533
8320
  DiffEngine,
8534
8321
  DriftDetector,
@@ -8560,6 +8347,7 @@ export {
8560
8347
  SopsMissingError,
8561
8348
  SopsVersionError,
8562
8349
  StructureManager,
8350
+ SyncManager,
8563
8351
  TransactionLockError,
8564
8352
  TransactionManager,
8565
8353
  TransactionPreflightError,
@@ -8580,7 +8368,6 @@ export {
8580
8368
  generateRandomValue,
8581
8369
  generateSigningKeyPair,
8582
8370
  getPendingKeys,
8583
- initiateDeviceFlow,
8584
8371
  isHighEntropy,
8585
8372
  isKmsEnvelope,
8586
8373
  isPending,
@@ -8598,17 +8385,13 @@ export {
8598
8385
  parseIgnoreContent,
8599
8386
  parseJson,
8600
8387
  parseYaml,
8601
- pollDeviceFlow,
8602
- readCloudCredentials,
8603
8388
  readManifestYaml,
8604
8389
  redactValue,
8605
8390
  removeRequest as removeAccessRequest,
8606
8391
  requestsFilePath,
8607
- resetKeyserviceResolution,
8608
8392
  resetSopsResolution,
8609
8393
  resolveBackendConfig,
8610
8394
  resolveIdentitySecrets,
8611
- resolveKeyservicePath,
8612
8395
  resolveRecipientsForEnvironment,
8613
8396
  resolveSopsPath,
8614
8397
  saveMetadata,
@@ -8618,12 +8401,10 @@ export {
8618
8401
  shouldIgnoreMatch,
8619
8402
  signEd25519,
8620
8403
  signKms,
8621
- spawnKeyservice,
8622
8404
  upsertRequest,
8623
8405
  validateAgePublicKey,
8624
8406
  validateResetScope,
8625
8407
  verifySignature,
8626
- writeCloudCredentials,
8627
8408
  writeManifestYaml,
8628
8409
  writeManifestYamlRaw
8629
8410
  };