opencode-swarm 6.33.8 → 6.33.9

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 (3) hide show
  1. package/dist/cli/index.js +306 -305
  2. package/dist/index.js +491 -504
  3. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -14276,7 +14276,8 @@ var init_utils2 = __esm(() => {
14276
14276
  });
14277
14277
 
14278
14278
  // src/evidence/manager.ts
14279
- import { mkdirSync, readdirSync, renameSync, rmSync, statSync as statSync2 } from "fs";
14279
+ import { mkdirSync, readdirSync, rmSync, statSync as statSync2 } from "fs";
14280
+ import * as fs2 from "fs/promises";
14280
14281
  import * as path3 from "path";
14281
14282
  function isValidEvidenceType(type) {
14282
14283
  return VALID_EVIDENCE_TYPES.includes(type);
@@ -14352,7 +14353,7 @@ async function saveEvidence(directory, taskId, evidence) {
14352
14353
  const tempPath = path3.join(evidenceDir, `evidence.json.tmp.${Date.now()}.${process.pid}`);
14353
14354
  try {
14354
14355
  await Bun.write(tempPath, bundleJson);
14355
- renameSync(tempPath, evidencePath);
14356
+ await fs2.rename(tempPath, evidencePath);
14356
14357
  } catch (error49) {
14357
14358
  try {
14358
14359
  rmSync(tempPath, { force: true });
@@ -14408,7 +14409,7 @@ async function loadEvidence(directory, taskId) {
14408
14409
  const tempPath = path3.join(evidenceDir, `evidence.json.tmp.${Date.now()}.${process.pid}`);
14409
14410
  try {
14410
14411
  await Bun.write(tempPath, bundleJson);
14411
- renameSync(tempPath, evidencePath);
14412
+ await fs2.rename(tempPath, evidencePath);
14412
14413
  } catch (writeError) {
14413
14414
  try {
14414
14415
  rmSync(tempPath, { force: true });
@@ -14622,54 +14623,54 @@ var require_polyfills = __commonJS((exports, module) => {
14622
14623
  }
14623
14624
  var chdir;
14624
14625
  module.exports = patch;
14625
- function patch(fs3) {
14626
+ function patch(fs4) {
14626
14627
  if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
14627
- patchLchmod(fs3);
14628
- }
14629
- if (!fs3.lutimes) {
14630
- patchLutimes(fs3);
14631
- }
14632
- fs3.chown = chownFix(fs3.chown);
14633
- fs3.fchown = chownFix(fs3.fchown);
14634
- fs3.lchown = chownFix(fs3.lchown);
14635
- fs3.chmod = chmodFix(fs3.chmod);
14636
- fs3.fchmod = chmodFix(fs3.fchmod);
14637
- fs3.lchmod = chmodFix(fs3.lchmod);
14638
- fs3.chownSync = chownFixSync(fs3.chownSync);
14639
- fs3.fchownSync = chownFixSync(fs3.fchownSync);
14640
- fs3.lchownSync = chownFixSync(fs3.lchownSync);
14641
- fs3.chmodSync = chmodFixSync(fs3.chmodSync);
14642
- fs3.fchmodSync = chmodFixSync(fs3.fchmodSync);
14643
- fs3.lchmodSync = chmodFixSync(fs3.lchmodSync);
14644
- fs3.stat = statFix(fs3.stat);
14645
- fs3.fstat = statFix(fs3.fstat);
14646
- fs3.lstat = statFix(fs3.lstat);
14647
- fs3.statSync = statFixSync(fs3.statSync);
14648
- fs3.fstatSync = statFixSync(fs3.fstatSync);
14649
- fs3.lstatSync = statFixSync(fs3.lstatSync);
14650
- if (fs3.chmod && !fs3.lchmod) {
14651
- fs3.lchmod = function(path6, mode, cb) {
14628
+ patchLchmod(fs4);
14629
+ }
14630
+ if (!fs4.lutimes) {
14631
+ patchLutimes(fs4);
14632
+ }
14633
+ fs4.chown = chownFix(fs4.chown);
14634
+ fs4.fchown = chownFix(fs4.fchown);
14635
+ fs4.lchown = chownFix(fs4.lchown);
14636
+ fs4.chmod = chmodFix(fs4.chmod);
14637
+ fs4.fchmod = chmodFix(fs4.fchmod);
14638
+ fs4.lchmod = chmodFix(fs4.lchmod);
14639
+ fs4.chownSync = chownFixSync(fs4.chownSync);
14640
+ fs4.fchownSync = chownFixSync(fs4.fchownSync);
14641
+ fs4.lchownSync = chownFixSync(fs4.lchownSync);
14642
+ fs4.chmodSync = chmodFixSync(fs4.chmodSync);
14643
+ fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
14644
+ fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
14645
+ fs4.stat = statFix(fs4.stat);
14646
+ fs4.fstat = statFix(fs4.fstat);
14647
+ fs4.lstat = statFix(fs4.lstat);
14648
+ fs4.statSync = statFixSync(fs4.statSync);
14649
+ fs4.fstatSync = statFixSync(fs4.fstatSync);
14650
+ fs4.lstatSync = statFixSync(fs4.lstatSync);
14651
+ if (fs4.chmod && !fs4.lchmod) {
14652
+ fs4.lchmod = function(path6, mode, cb) {
14652
14653
  if (cb)
14653
14654
  process.nextTick(cb);
14654
14655
  };
14655
- fs3.lchmodSync = function() {};
14656
+ fs4.lchmodSync = function() {};
14656
14657
  }
14657
- if (fs3.chown && !fs3.lchown) {
14658
- fs3.lchown = function(path6, uid, gid, cb) {
14658
+ if (fs4.chown && !fs4.lchown) {
14659
+ fs4.lchown = function(path6, uid, gid, cb) {
14659
14660
  if (cb)
14660
14661
  process.nextTick(cb);
14661
14662
  };
14662
- fs3.lchownSync = function() {};
14663
+ fs4.lchownSync = function() {};
14663
14664
  }
14664
14665
  if (platform === "win32") {
14665
- fs3.rename = typeof fs3.rename !== "function" ? fs3.rename : function(fs$rename) {
14666
- function rename(from, to, cb) {
14666
+ fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
14667
+ function rename2(from, to, cb) {
14667
14668
  var start = Date.now();
14668
14669
  var backoff = 0;
14669
14670
  fs$rename(from, to, function CB(er) {
14670
14671
  if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 60000) {
14671
14672
  setTimeout(function() {
14672
- fs3.stat(to, function(stater, st) {
14673
+ fs4.stat(to, function(stater, st) {
14673
14674
  if (stater && stater.code === "ENOENT")
14674
14675
  fs$rename(from, to, CB);
14675
14676
  else
@@ -14685,11 +14686,11 @@ var require_polyfills = __commonJS((exports, module) => {
14685
14686
  });
14686
14687
  }
14687
14688
  if (Object.setPrototypeOf)
14688
- Object.setPrototypeOf(rename, fs$rename);
14689
- return rename;
14690
- }(fs3.rename);
14689
+ Object.setPrototypeOf(rename2, fs$rename);
14690
+ return rename2;
14691
+ }(fs4.rename);
14691
14692
  }
14692
- fs3.read = typeof fs3.read !== "function" ? fs3.read : function(fs$read) {
14693
+ fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
14693
14694
  function read(fd, buffer, offset, length, position, callback_) {
14694
14695
  var callback;
14695
14696
  if (callback_ && typeof callback_ === "function") {
@@ -14697,23 +14698,23 @@ var require_polyfills = __commonJS((exports, module) => {
14697
14698
  callback = function(er, _, __) {
14698
14699
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
14699
14700
  eagCounter++;
14700
- return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
14701
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
14701
14702
  }
14702
14703
  callback_.apply(this, arguments);
14703
14704
  };
14704
14705
  }
14705
- return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
14706
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
14706
14707
  }
14707
14708
  if (Object.setPrototypeOf)
14708
14709
  Object.setPrototypeOf(read, fs$read);
14709
14710
  return read;
14710
- }(fs3.read);
14711
- fs3.readSync = typeof fs3.readSync !== "function" ? fs3.readSync : function(fs$readSync) {
14711
+ }(fs4.read);
14712
+ fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : function(fs$readSync) {
14712
14713
  return function(fd, buffer, offset, length, position) {
14713
14714
  var eagCounter = 0;
14714
14715
  while (true) {
14715
14716
  try {
14716
- return fs$readSync.call(fs3, fd, buffer, offset, length, position);
14717
+ return fs$readSync.call(fs4, fd, buffer, offset, length, position);
14717
14718
  } catch (er) {
14718
14719
  if (er.code === "EAGAIN" && eagCounter < 10) {
14719
14720
  eagCounter++;
@@ -14723,90 +14724,90 @@ var require_polyfills = __commonJS((exports, module) => {
14723
14724
  }
14724
14725
  }
14725
14726
  };
14726
- }(fs3.readSync);
14727
- function patchLchmod(fs4) {
14728
- fs4.lchmod = function(path6, mode, callback) {
14729
- fs4.open(path6, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
14727
+ }(fs4.readSync);
14728
+ function patchLchmod(fs5) {
14729
+ fs5.lchmod = function(path6, mode, callback) {
14730
+ fs5.open(path6, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
14730
14731
  if (err) {
14731
14732
  if (callback)
14732
14733
  callback(err);
14733
14734
  return;
14734
14735
  }
14735
- fs4.fchmod(fd, mode, function(err2) {
14736
- fs4.close(fd, function(err22) {
14736
+ fs5.fchmod(fd, mode, function(err2) {
14737
+ fs5.close(fd, function(err22) {
14737
14738
  if (callback)
14738
14739
  callback(err2 || err22);
14739
14740
  });
14740
14741
  });
14741
14742
  });
14742
14743
  };
14743
- fs4.lchmodSync = function(path6, mode) {
14744
- var fd = fs4.openSync(path6, constants.O_WRONLY | constants.O_SYMLINK, mode);
14744
+ fs5.lchmodSync = function(path6, mode) {
14745
+ var fd = fs5.openSync(path6, constants.O_WRONLY | constants.O_SYMLINK, mode);
14745
14746
  var threw = true;
14746
14747
  var ret;
14747
14748
  try {
14748
- ret = fs4.fchmodSync(fd, mode);
14749
+ ret = fs5.fchmodSync(fd, mode);
14749
14750
  threw = false;
14750
14751
  } finally {
14751
14752
  if (threw) {
14752
14753
  try {
14753
- fs4.closeSync(fd);
14754
+ fs5.closeSync(fd);
14754
14755
  } catch (er) {}
14755
14756
  } else {
14756
- fs4.closeSync(fd);
14757
+ fs5.closeSync(fd);
14757
14758
  }
14758
14759
  }
14759
14760
  return ret;
14760
14761
  };
14761
14762
  }
14762
- function patchLutimes(fs4) {
14763
- if (constants.hasOwnProperty("O_SYMLINK") && fs4.futimes) {
14764
- fs4.lutimes = function(path6, at, mt, cb) {
14765
- fs4.open(path6, constants.O_SYMLINK, function(er, fd) {
14763
+ function patchLutimes(fs5) {
14764
+ if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
14765
+ fs5.lutimes = function(path6, at, mt, cb) {
14766
+ fs5.open(path6, constants.O_SYMLINK, function(er, fd) {
14766
14767
  if (er) {
14767
14768
  if (cb)
14768
14769
  cb(er);
14769
14770
  return;
14770
14771
  }
14771
- fs4.futimes(fd, at, mt, function(er2) {
14772
- fs4.close(fd, function(er22) {
14772
+ fs5.futimes(fd, at, mt, function(er2) {
14773
+ fs5.close(fd, function(er22) {
14773
14774
  if (cb)
14774
14775
  cb(er2 || er22);
14775
14776
  });
14776
14777
  });
14777
14778
  });
14778
14779
  };
14779
- fs4.lutimesSync = function(path6, at, mt) {
14780
- var fd = fs4.openSync(path6, constants.O_SYMLINK);
14780
+ fs5.lutimesSync = function(path6, at, mt) {
14781
+ var fd = fs5.openSync(path6, constants.O_SYMLINK);
14781
14782
  var ret;
14782
14783
  var threw = true;
14783
14784
  try {
14784
- ret = fs4.futimesSync(fd, at, mt);
14785
+ ret = fs5.futimesSync(fd, at, mt);
14785
14786
  threw = false;
14786
14787
  } finally {
14787
14788
  if (threw) {
14788
14789
  try {
14789
- fs4.closeSync(fd);
14790
+ fs5.closeSync(fd);
14790
14791
  } catch (er) {}
14791
14792
  } else {
14792
- fs4.closeSync(fd);
14793
+ fs5.closeSync(fd);
14793
14794
  }
14794
14795
  }
14795
14796
  return ret;
14796
14797
  };
14797
- } else if (fs4.futimes) {
14798
- fs4.lutimes = function(_a2, _b, _c, cb) {
14798
+ } else if (fs5.futimes) {
14799
+ fs5.lutimes = function(_a2, _b, _c, cb) {
14799
14800
  if (cb)
14800
14801
  process.nextTick(cb);
14801
14802
  };
14802
- fs4.lutimesSync = function() {};
14803
+ fs5.lutimesSync = function() {};
14803
14804
  }
14804
14805
  }
14805
14806
  function chmodFix(orig) {
14806
14807
  if (!orig)
14807
14808
  return orig;
14808
14809
  return function(target, mode, cb) {
14809
- return orig.call(fs3, target, mode, function(er) {
14810
+ return orig.call(fs4, target, mode, function(er) {
14810
14811
  if (chownErOk(er))
14811
14812
  er = null;
14812
14813
  if (cb)
@@ -14819,7 +14820,7 @@ var require_polyfills = __commonJS((exports, module) => {
14819
14820
  return orig;
14820
14821
  return function(target, mode) {
14821
14822
  try {
14822
- return orig.call(fs3, target, mode);
14823
+ return orig.call(fs4, target, mode);
14823
14824
  } catch (er) {
14824
14825
  if (!chownErOk(er))
14825
14826
  throw er;
@@ -14830,7 +14831,7 @@ var require_polyfills = __commonJS((exports, module) => {
14830
14831
  if (!orig)
14831
14832
  return orig;
14832
14833
  return function(target, uid, gid, cb) {
14833
- return orig.call(fs3, target, uid, gid, function(er) {
14834
+ return orig.call(fs4, target, uid, gid, function(er) {
14834
14835
  if (chownErOk(er))
14835
14836
  er = null;
14836
14837
  if (cb)
@@ -14843,7 +14844,7 @@ var require_polyfills = __commonJS((exports, module) => {
14843
14844
  return orig;
14844
14845
  return function(target, uid, gid) {
14845
14846
  try {
14846
- return orig.call(fs3, target, uid, gid);
14847
+ return orig.call(fs4, target, uid, gid);
14847
14848
  } catch (er) {
14848
14849
  if (!chownErOk(er))
14849
14850
  throw er;
@@ -14868,14 +14869,14 @@ var require_polyfills = __commonJS((exports, module) => {
14868
14869
  if (cb)
14869
14870
  cb.apply(this, arguments);
14870
14871
  }
14871
- return options ? orig.call(fs3, target, options, callback) : orig.call(fs3, target, callback);
14872
+ return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
14872
14873
  };
14873
14874
  }
14874
14875
  function statFixSync(orig) {
14875
14876
  if (!orig)
14876
14877
  return orig;
14877
14878
  return function(target, options) {
14878
- var stats = options ? orig.call(fs3, target, options) : orig.call(fs3, target);
14879
+ var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
14879
14880
  if (stats) {
14880
14881
  if (stats.uid < 0)
14881
14882
  stats.uid += 4294967296;
@@ -14904,7 +14905,7 @@ var require_polyfills = __commonJS((exports, module) => {
14904
14905
  var require_legacy_streams = __commonJS((exports, module) => {
14905
14906
  var Stream = __require("stream").Stream;
14906
14907
  module.exports = legacy;
14907
- function legacy(fs3) {
14908
+ function legacy(fs4) {
14908
14909
  return {
14909
14910
  ReadStream,
14910
14911
  WriteStream
@@ -14949,7 +14950,7 @@ var require_legacy_streams = __commonJS((exports, module) => {
14949
14950
  });
14950
14951
  return;
14951
14952
  }
14952
- fs3.open(this.path, this.flags, this.mode, function(err, fd) {
14953
+ fs4.open(this.path, this.flags, this.mode, function(err, fd) {
14953
14954
  if (err) {
14954
14955
  self.emit("error", err);
14955
14956
  self.readable = false;
@@ -14989,7 +14990,7 @@ var require_legacy_streams = __commonJS((exports, module) => {
14989
14990
  this.busy = false;
14990
14991
  this._queue = [];
14991
14992
  if (this.fd === null) {
14992
- this._open = fs3.open;
14993
+ this._open = fs4.open;
14993
14994
  this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
14994
14995
  this.flush();
14995
14996
  }
@@ -15019,7 +15020,7 @@ var require_clone = __commonJS((exports, module) => {
15019
15020
 
15020
15021
  // node_modules/graceful-fs/graceful-fs.js
15021
15022
  var require_graceful_fs = __commonJS((exports, module) => {
15022
- var fs3 = __require("fs");
15023
+ var fs4 = __require("fs");
15023
15024
  var polyfills = require_polyfills();
15024
15025
  var legacy = require_legacy_streams();
15025
15026
  var clone3 = require_clone();
@@ -15051,12 +15052,12 @@ var require_graceful_fs = __commonJS((exports, module) => {
15051
15052
  GFS4: `);
15052
15053
  console.error(m);
15053
15054
  };
15054
- if (!fs3[gracefulQueue]) {
15055
+ if (!fs4[gracefulQueue]) {
15055
15056
  queue = global[gracefulQueue] || [];
15056
- publishQueue(fs3, queue);
15057
- fs3.close = function(fs$close) {
15057
+ publishQueue(fs4, queue);
15058
+ fs4.close = function(fs$close) {
15058
15059
  function close(fd, cb) {
15059
- return fs$close.call(fs3, fd, function(err) {
15060
+ return fs$close.call(fs4, fd, function(err) {
15060
15061
  if (!err) {
15061
15062
  resetQueue();
15062
15063
  }
@@ -15068,40 +15069,40 @@ GFS4: `);
15068
15069
  value: fs$close
15069
15070
  });
15070
15071
  return close;
15071
- }(fs3.close);
15072
- fs3.closeSync = function(fs$closeSync) {
15072
+ }(fs4.close);
15073
+ fs4.closeSync = function(fs$closeSync) {
15073
15074
  function closeSync(fd) {
15074
- fs$closeSync.apply(fs3, arguments);
15075
+ fs$closeSync.apply(fs4, arguments);
15075
15076
  resetQueue();
15076
15077
  }
15077
15078
  Object.defineProperty(closeSync, previousSymbol, {
15078
15079
  value: fs$closeSync
15079
15080
  });
15080
15081
  return closeSync;
15081
- }(fs3.closeSync);
15082
+ }(fs4.closeSync);
15082
15083
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
15083
15084
  process.on("exit", function() {
15084
- debug(fs3[gracefulQueue]);
15085
- __require("assert").equal(fs3[gracefulQueue].length, 0);
15085
+ debug(fs4[gracefulQueue]);
15086
+ __require("assert").equal(fs4[gracefulQueue].length, 0);
15086
15087
  });
15087
15088
  }
15088
15089
  }
15089
15090
  var queue;
15090
15091
  if (!global[gracefulQueue]) {
15091
- publishQueue(global, fs3[gracefulQueue]);
15092
- }
15093
- module.exports = patch(clone3(fs3));
15094
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs3.__patched) {
15095
- module.exports = patch(fs3);
15096
- fs3.__patched = true;
15097
- }
15098
- function patch(fs4) {
15099
- polyfills(fs4);
15100
- fs4.gracefulify = patch;
15101
- fs4.createReadStream = createReadStream;
15102
- fs4.createWriteStream = createWriteStream;
15103
- var fs$readFile = fs4.readFile;
15104
- fs4.readFile = readFile;
15092
+ publishQueue(global, fs4[gracefulQueue]);
15093
+ }
15094
+ module.exports = patch(clone3(fs4));
15095
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
15096
+ module.exports = patch(fs4);
15097
+ fs4.__patched = true;
15098
+ }
15099
+ function patch(fs5) {
15100
+ polyfills(fs5);
15101
+ fs5.gracefulify = patch;
15102
+ fs5.createReadStream = createReadStream;
15103
+ fs5.createWriteStream = createWriteStream;
15104
+ var fs$readFile = fs5.readFile;
15105
+ fs5.readFile = readFile;
15105
15106
  function readFile(path6, options, cb) {
15106
15107
  if (typeof options === "function")
15107
15108
  cb = options, options = null;
@@ -15117,8 +15118,8 @@ GFS4: `);
15117
15118
  });
15118
15119
  }
15119
15120
  }
15120
- var fs$writeFile = fs4.writeFile;
15121
- fs4.writeFile = writeFile;
15121
+ var fs$writeFile = fs5.writeFile;
15122
+ fs5.writeFile = writeFile;
15122
15123
  function writeFile(path6, data, options, cb) {
15123
15124
  if (typeof options === "function")
15124
15125
  cb = options, options = null;
@@ -15134,9 +15135,9 @@ GFS4: `);
15134
15135
  });
15135
15136
  }
15136
15137
  }
15137
- var fs$appendFile = fs4.appendFile;
15138
+ var fs$appendFile = fs5.appendFile;
15138
15139
  if (fs$appendFile)
15139
- fs4.appendFile = appendFile;
15140
+ fs5.appendFile = appendFile;
15140
15141
  function appendFile(path6, data, options, cb) {
15141
15142
  if (typeof options === "function")
15142
15143
  cb = options, options = null;
@@ -15152,9 +15153,9 @@ GFS4: `);
15152
15153
  });
15153
15154
  }
15154
15155
  }
15155
- var fs$copyFile = fs4.copyFile;
15156
+ var fs$copyFile = fs5.copyFile;
15156
15157
  if (fs$copyFile)
15157
- fs4.copyFile = copyFile;
15158
+ fs5.copyFile = copyFile;
15158
15159
  function copyFile(src, dest, flags, cb) {
15159
15160
  if (typeof flags === "function") {
15160
15161
  cb = flags;
@@ -15172,8 +15173,8 @@ GFS4: `);
15172
15173
  });
15173
15174
  }
15174
15175
  }
15175
- var fs$readdir = fs4.readdir;
15176
- fs4.readdir = readdir;
15176
+ var fs$readdir = fs5.readdir;
15177
+ fs5.readdir = readdir;
15177
15178
  var noReaddirOptionVersions = /^v[0-5]\./;
15178
15179
  function readdir(path6, options, cb) {
15179
15180
  if (typeof options === "function")
@@ -15204,21 +15205,21 @@ GFS4: `);
15204
15205
  }
15205
15206
  }
15206
15207
  if (process.version.substr(0, 4) === "v0.8") {
15207
- var legStreams = legacy(fs4);
15208
+ var legStreams = legacy(fs5);
15208
15209
  ReadStream = legStreams.ReadStream;
15209
15210
  WriteStream = legStreams.WriteStream;
15210
15211
  }
15211
- var fs$ReadStream = fs4.ReadStream;
15212
+ var fs$ReadStream = fs5.ReadStream;
15212
15213
  if (fs$ReadStream) {
15213
15214
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
15214
15215
  ReadStream.prototype.open = ReadStream$open;
15215
15216
  }
15216
- var fs$WriteStream = fs4.WriteStream;
15217
+ var fs$WriteStream = fs5.WriteStream;
15217
15218
  if (fs$WriteStream) {
15218
15219
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
15219
15220
  WriteStream.prototype.open = WriteStream$open;
15220
15221
  }
15221
- Object.defineProperty(fs4, "ReadStream", {
15222
+ Object.defineProperty(fs5, "ReadStream", {
15222
15223
  get: function() {
15223
15224
  return ReadStream;
15224
15225
  },
@@ -15228,7 +15229,7 @@ GFS4: `);
15228
15229
  enumerable: true,
15229
15230
  configurable: true
15230
15231
  });
15231
- Object.defineProperty(fs4, "WriteStream", {
15232
+ Object.defineProperty(fs5, "WriteStream", {
15232
15233
  get: function() {
15233
15234
  return WriteStream;
15234
15235
  },
@@ -15239,7 +15240,7 @@ GFS4: `);
15239
15240
  configurable: true
15240
15241
  });
15241
15242
  var FileReadStream = ReadStream;
15242
- Object.defineProperty(fs4, "FileReadStream", {
15243
+ Object.defineProperty(fs5, "FileReadStream", {
15243
15244
  get: function() {
15244
15245
  return FileReadStream;
15245
15246
  },
@@ -15250,7 +15251,7 @@ GFS4: `);
15250
15251
  configurable: true
15251
15252
  });
15252
15253
  var FileWriteStream = WriteStream;
15253
- Object.defineProperty(fs4, "FileWriteStream", {
15254
+ Object.defineProperty(fs5, "FileWriteStream", {
15254
15255
  get: function() {
15255
15256
  return FileWriteStream;
15256
15257
  },
@@ -15299,13 +15300,13 @@ GFS4: `);
15299
15300
  });
15300
15301
  }
15301
15302
  function createReadStream(path6, options) {
15302
- return new fs4.ReadStream(path6, options);
15303
+ return new fs5.ReadStream(path6, options);
15303
15304
  }
15304
15305
  function createWriteStream(path6, options) {
15305
- return new fs4.WriteStream(path6, options);
15306
+ return new fs5.WriteStream(path6, options);
15306
15307
  }
15307
- var fs$open = fs4.open;
15308
- fs4.open = open;
15308
+ var fs$open = fs5.open;
15309
+ fs5.open = open;
15309
15310
  function open(path6, flags, mode, cb) {
15310
15311
  if (typeof mode === "function")
15311
15312
  cb = mode, mode = null;
@@ -15321,20 +15322,20 @@ GFS4: `);
15321
15322
  });
15322
15323
  }
15323
15324
  }
15324
- return fs4;
15325
+ return fs5;
15325
15326
  }
15326
15327
  function enqueue(elem) {
15327
15328
  debug("ENQUEUE", elem[0].name, elem[1]);
15328
- fs3[gracefulQueue].push(elem);
15329
+ fs4[gracefulQueue].push(elem);
15329
15330
  retry();
15330
15331
  }
15331
15332
  var retryTimer;
15332
15333
  function resetQueue() {
15333
15334
  var now = Date.now();
15334
- for (var i = 0;i < fs3[gracefulQueue].length; ++i) {
15335
- if (fs3[gracefulQueue][i].length > 2) {
15336
- fs3[gracefulQueue][i][3] = now;
15337
- fs3[gracefulQueue][i][4] = now;
15335
+ for (var i = 0;i < fs4[gracefulQueue].length; ++i) {
15336
+ if (fs4[gracefulQueue][i].length > 2) {
15337
+ fs4[gracefulQueue][i][3] = now;
15338
+ fs4[gracefulQueue][i][4] = now;
15338
15339
  }
15339
15340
  }
15340
15341
  retry();
@@ -15342,9 +15343,9 @@ GFS4: `);
15342
15343
  function retry() {
15343
15344
  clearTimeout(retryTimer);
15344
15345
  retryTimer = undefined;
15345
- if (fs3[gracefulQueue].length === 0)
15346
+ if (fs4[gracefulQueue].length === 0)
15346
15347
  return;
15347
- var elem = fs3[gracefulQueue].shift();
15348
+ var elem = fs4[gracefulQueue].shift();
15348
15349
  var fn = elem[0];
15349
15350
  var args = elem[1];
15350
15351
  var err = elem[2];
@@ -15366,7 +15367,7 @@ GFS4: `);
15366
15367
  debug("RETRY", fn.name, args);
15367
15368
  fn.apply(null, args.concat([startTime]));
15368
15369
  } else {
15369
- fs3[gracefulQueue].push(elem);
15370
+ fs4[gracefulQueue].push(elem);
15370
15371
  }
15371
15372
  }
15372
15373
  if (retryTimer === undefined) {
@@ -15761,10 +15762,10 @@ var require_signal_exit = __commonJS((exports, module) => {
15761
15762
  // node_modules/proper-lockfile/lib/mtime-precision.js
15762
15763
  var require_mtime_precision = __commonJS((exports, module) => {
15763
15764
  var cacheSymbol = Symbol();
15764
- function probe(file3, fs3, callback) {
15765
- const cachedPrecision = fs3[cacheSymbol];
15765
+ function probe(file3, fs4, callback) {
15766
+ const cachedPrecision = fs4[cacheSymbol];
15766
15767
  if (cachedPrecision) {
15767
- return fs3.stat(file3, (err, stat) => {
15768
+ return fs4.stat(file3, (err, stat) => {
15768
15769
  if (err) {
15769
15770
  return callback(err);
15770
15771
  }
@@ -15772,16 +15773,16 @@ var require_mtime_precision = __commonJS((exports, module) => {
15772
15773
  });
15773
15774
  }
15774
15775
  const mtime = new Date(Math.ceil(Date.now() / 1000) * 1000 + 5);
15775
- fs3.utimes(file3, mtime, mtime, (err) => {
15776
+ fs4.utimes(file3, mtime, mtime, (err) => {
15776
15777
  if (err) {
15777
15778
  return callback(err);
15778
15779
  }
15779
- fs3.stat(file3, (err2, stat) => {
15780
+ fs4.stat(file3, (err2, stat) => {
15780
15781
  if (err2) {
15781
15782
  return callback(err2);
15782
15783
  }
15783
15784
  const precision = stat.mtime.getTime() % 1000 === 0 ? "s" : "ms";
15784
- Object.defineProperty(fs3, cacheSymbol, { value: precision });
15785
+ Object.defineProperty(fs4, cacheSymbol, { value: precision });
15785
15786
  callback(null, stat.mtime, precision);
15786
15787
  });
15787
15788
  });
@@ -15800,7 +15801,7 @@ var require_mtime_precision = __commonJS((exports, module) => {
15800
15801
  // node_modules/proper-lockfile/lib/lockfile.js
15801
15802
  var require_lockfile = __commonJS((exports, module) => {
15802
15803
  var path6 = __require("path");
15803
- var fs3 = require_graceful_fs();
15804
+ var fs4 = require_graceful_fs();
15804
15805
  var retry = require_retry();
15805
15806
  var onExit = require_signal_exit();
15806
15807
  var mtimePrecision = require_mtime_precision();
@@ -15923,7 +15924,7 @@ var require_lockfile = __commonJS((exports, module) => {
15923
15924
  update: null,
15924
15925
  realpath: true,
15925
15926
  retries: 0,
15926
- fs: fs3,
15927
+ fs: fs4,
15927
15928
  onCompromised: (err) => {
15928
15929
  throw err;
15929
15930
  },
@@ -15967,7 +15968,7 @@ var require_lockfile = __commonJS((exports, module) => {
15967
15968
  }
15968
15969
  function unlock(file3, options, callback) {
15969
15970
  options = {
15970
- fs: fs3,
15971
+ fs: fs4,
15971
15972
  realpath: true,
15972
15973
  ...options
15973
15974
  };
@@ -15989,7 +15990,7 @@ var require_lockfile = __commonJS((exports, module) => {
15989
15990
  options = {
15990
15991
  stale: 1e4,
15991
15992
  realpath: true,
15992
- fs: fs3,
15993
+ fs: fs4,
15993
15994
  ...options
15994
15995
  };
15995
15996
  options.stale = Math.max(options.stale || 0, 2000);
@@ -16024,16 +16025,16 @@ var require_lockfile = __commonJS((exports, module) => {
16024
16025
 
16025
16026
  // node_modules/proper-lockfile/lib/adapter.js
16026
16027
  var require_adapter = __commonJS((exports, module) => {
16027
- var fs3 = require_graceful_fs();
16028
- function createSyncFs(fs4) {
16028
+ var fs4 = require_graceful_fs();
16029
+ function createSyncFs(fs5) {
16029
16030
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
16030
- const newFs = { ...fs4 };
16031
+ const newFs = { ...fs5 };
16031
16032
  methods.forEach((method) => {
16032
16033
  newFs[method] = (...args) => {
16033
16034
  const callback = args.pop();
16034
16035
  let ret;
16035
16036
  try {
16036
- ret = fs4[`${method}Sync`](...args);
16037
+ ret = fs5[`${method}Sync`](...args);
16037
16038
  } catch (err) {
16038
16039
  return callback(err);
16039
16040
  }
@@ -16071,7 +16072,7 @@ var require_adapter = __commonJS((exports, module) => {
16071
16072
  }
16072
16073
  function toSyncOptions(options) {
16073
16074
  options = { ...options };
16074
- options.fs = createSyncFs(options.fs || fs3);
16075
+ options.fs = createSyncFs(options.fs || fs4);
16075
16076
  if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
16076
16077
  throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
16077
16078
  }
@@ -16118,7 +16119,7 @@ var require_proper_lockfile = __commonJS((exports, module) => {
16118
16119
  });
16119
16120
 
16120
16121
  // src/plan/manager.ts
16121
- import { renameSync as renameSync3, unlinkSync } from "fs";
16122
+ import { renameSync as renameSync2, unlinkSync } from "fs";
16122
16123
  import * as path11 from "path";
16123
16124
  async function loadPlanJsonOnly(directory) {
16124
16125
  const planJsonContent = await readSwarmFileAsync(directory, "plan.json");
@@ -16210,7 +16211,7 @@ ${markdown}`;
16210
16211
  const mdTempPath = path11.join(swarmDir, `plan.md.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
16211
16212
  try {
16212
16213
  await Bun.write(mdTempPath, markdownWithHash);
16213
- renameSync3(mdTempPath, mdPath);
16214
+ renameSync2(mdTempPath, mdPath);
16214
16215
  } finally {
16215
16216
  try {
16216
16217
  unlinkSync(mdTempPath);
@@ -16299,7 +16300,7 @@ async function savePlan(directory, plan, options) {
16299
16300
  const tempPath = path11.join(swarmDir, `plan.json.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
16300
16301
  try {
16301
16302
  await Bun.write(tempPath, JSON.stringify(validated, null, 2));
16302
- renameSync3(tempPath, planPath);
16303
+ renameSync2(tempPath, planPath);
16303
16304
  } finally {
16304
16305
  try {
16305
16306
  unlinkSync(tempPath);
@@ -16313,7 +16314,7 @@ ${markdown}`;
16313
16314
  const mdTempPath = path11.join(swarmDir, `plan.md.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
16314
16315
  try {
16315
16316
  await Bun.write(mdTempPath, markdownWithHash);
16316
- renameSync3(mdTempPath, mdPath);
16317
+ renameSync2(mdTempPath, mdPath);
16317
16318
  } finally {
16318
16319
  try {
16319
16320
  unlinkSync(mdTempPath);
@@ -16617,7 +16618,7 @@ __export(exports_config_doctor, {
16617
16618
  applySafeAutoFixes: () => applySafeAutoFixes
16618
16619
  });
16619
16620
  import * as crypto2 from "crypto";
16620
- import * as fs3 from "fs";
16621
+ import * as fs4 from "fs";
16621
16622
  import * as os4 from "os";
16622
16623
  import * as path13 from "path";
16623
16624
  function getUserConfigDir3() {
@@ -16662,15 +16663,15 @@ function createConfigBackup(directory) {
16662
16663
  const { userConfigPath, projectConfigPath } = getConfigPaths(directory);
16663
16664
  let configPath = projectConfigPath;
16664
16665
  let content = null;
16665
- if (fs3.existsSync(projectConfigPath)) {
16666
+ if (fs4.existsSync(projectConfigPath)) {
16666
16667
  try {
16667
- content = fs3.readFileSync(projectConfigPath, "utf-8");
16668
+ content = fs4.readFileSync(projectConfigPath, "utf-8");
16668
16669
  } catch {}
16669
16670
  }
16670
- if (content === null && fs3.existsSync(userConfigPath)) {
16671
+ if (content === null && fs4.existsSync(userConfigPath)) {
16671
16672
  configPath = userConfigPath;
16672
16673
  try {
16673
- content = fs3.readFileSync(userConfigPath, "utf-8");
16674
+ content = fs4.readFileSync(userConfigPath, "utf-8");
16674
16675
  } catch {}
16675
16676
  }
16676
16677
  if (content === null) {
@@ -16685,8 +16686,8 @@ function createConfigBackup(directory) {
16685
16686
  }
16686
16687
  function writeBackupArtifact(directory, backup) {
16687
16688
  const swarmDir = path13.join(directory, ".swarm");
16688
- if (!fs3.existsSync(swarmDir)) {
16689
- fs3.mkdirSync(swarmDir, { recursive: true });
16689
+ if (!fs4.existsSync(swarmDir)) {
16690
+ fs4.mkdirSync(swarmDir, { recursive: true });
16690
16691
  }
16691
16692
  const backupFilename = `config-backup-${backup.createdAt}.json`;
16692
16693
  const backupPath = path13.join(swarmDir, backupFilename);
@@ -16697,15 +16698,15 @@ function writeBackupArtifact(directory, backup) {
16697
16698
  content: backup.content,
16698
16699
  preview: backup.content.substring(0, 500) + (backup.content.length > 500 ? "..." : "")
16699
16700
  };
16700
- fs3.writeFileSync(backupPath, JSON.stringify(artifact, null, 2), "utf-8");
16701
+ fs4.writeFileSync(backupPath, JSON.stringify(artifact, null, 2), "utf-8");
16701
16702
  return backupPath;
16702
16703
  }
16703
16704
  function restoreFromBackup(backupPath, directory) {
16704
- if (!fs3.existsSync(backupPath)) {
16705
+ if (!fs4.existsSync(backupPath)) {
16705
16706
  return null;
16706
16707
  }
16707
16708
  try {
16708
- const artifact = JSON.parse(fs3.readFileSync(backupPath, "utf-8"));
16709
+ const artifact = JSON.parse(fs4.readFileSync(backupPath, "utf-8"));
16709
16710
  if (!artifact.content || !artifact.configPath || !artifact.contentHash) {
16710
16711
  return null;
16711
16712
  }
@@ -16720,10 +16721,10 @@ function restoreFromBackup(backupPath, directory) {
16720
16721
  }
16721
16722
  const targetPath = artifact.configPath;
16722
16723
  const targetDir = path13.dirname(targetPath);
16723
- if (!fs3.existsSync(targetDir)) {
16724
- fs3.mkdirSync(targetDir, { recursive: true });
16724
+ if (!fs4.existsSync(targetDir)) {
16725
+ fs4.mkdirSync(targetDir, { recursive: true });
16725
16726
  }
16726
- fs3.writeFileSync(targetPath, artifact.content, "utf-8");
16727
+ fs4.writeFileSync(targetPath, artifact.content, "utf-8");
16727
16728
  return targetPath;
16728
16729
  } catch {
16729
16730
  return null;
@@ -16733,12 +16734,12 @@ function readConfigFromFile(directory) {
16733
16734
  const { userConfigPath, projectConfigPath } = getConfigPaths(directory);
16734
16735
  let configPath = projectConfigPath;
16735
16736
  let configContent = null;
16736
- if (fs3.existsSync(projectConfigPath)) {
16737
+ if (fs4.existsSync(projectConfigPath)) {
16737
16738
  configPath = projectConfigPath;
16738
- configContent = fs3.readFileSync(projectConfigPath, "utf-8");
16739
- } else if (fs3.existsSync(userConfigPath)) {
16739
+ configContent = fs4.readFileSync(projectConfigPath, "utf-8");
16740
+ } else if (fs4.existsSync(userConfigPath)) {
16740
16741
  configPath = userConfigPath;
16741
- configContent = fs3.readFileSync(userConfigPath, "utf-8");
16742
+ configContent = fs4.readFileSync(userConfigPath, "utf-8");
16742
16743
  }
16743
16744
  if (configContent === null) {
16744
16745
  return null;
@@ -17034,9 +17035,9 @@ function runConfigDoctor(config3, directory) {
17034
17035
  const hasAutoFixableIssues = findings.some((f) => f.autoFixable && f.proposedFix?.risk === "low");
17035
17036
  const { userConfigPath, projectConfigPath } = getConfigPaths(directory);
17036
17037
  let configSource = "defaults";
17037
- if (fs3.existsSync(projectConfigPath)) {
17038
+ if (fs4.existsSync(projectConfigPath)) {
17038
17039
  configSource = projectConfigPath;
17039
- } else if (fs3.existsSync(userConfigPath)) {
17040
+ } else if (fs4.existsSync(userConfigPath)) {
17040
17041
  configSource = userConfigPath;
17041
17042
  }
17042
17043
  return {
@@ -17065,12 +17066,12 @@ function applySafeAutoFixes(directory, result) {
17065
17066
  const { userConfigPath, projectConfigPath } = getConfigPaths(directory);
17066
17067
  let configPath = projectConfigPath;
17067
17068
  let configContent;
17068
- if (fs3.existsSync(projectConfigPath)) {
17069
+ if (fs4.existsSync(projectConfigPath)) {
17069
17070
  configPath = projectConfigPath;
17070
- configContent = fs3.readFileSync(projectConfigPath, "utf-8");
17071
- } else if (fs3.existsSync(userConfigPath)) {
17071
+ configContent = fs4.readFileSync(projectConfigPath, "utf-8");
17072
+ } else if (fs4.existsSync(userConfigPath)) {
17072
17073
  configPath = userConfigPath;
17073
- configContent = fs3.readFileSync(userConfigPath, "utf-8");
17074
+ configContent = fs4.readFileSync(userConfigPath, "utf-8");
17074
17075
  } else {
17075
17076
  return { appliedFixes, updatedConfigPath: null };
17076
17077
  }
@@ -17140,18 +17141,18 @@ function applySafeAutoFixes(directory, result) {
17140
17141
  }
17141
17142
  if (appliedFixes.length > 0) {
17142
17143
  const configDir = path13.dirname(configPath);
17143
- if (!fs3.existsSync(configDir)) {
17144
- fs3.mkdirSync(configDir, { recursive: true });
17144
+ if (!fs4.existsSync(configDir)) {
17145
+ fs4.mkdirSync(configDir, { recursive: true });
17145
17146
  }
17146
- fs3.writeFileSync(configPath, JSON.stringify(config3, null, 2), "utf-8");
17147
+ fs4.writeFileSync(configPath, JSON.stringify(config3, null, 2), "utf-8");
17147
17148
  updatedConfigPath = configPath;
17148
17149
  }
17149
17150
  return { appliedFixes, updatedConfigPath };
17150
17151
  }
17151
17152
  function writeDoctorArtifact(directory, result) {
17152
17153
  const swarmDir = path13.join(directory, ".swarm");
17153
- if (!fs3.existsSync(swarmDir)) {
17154
- fs3.mkdirSync(swarmDir, { recursive: true });
17154
+ if (!fs4.existsSync(swarmDir)) {
17155
+ fs4.mkdirSync(swarmDir, { recursive: true });
17155
17156
  }
17156
17157
  const artifactFilename = "config-doctor.json";
17157
17158
  const artifactPath = path13.join(swarmDir, artifactFilename);
@@ -17175,7 +17176,7 @@ function writeDoctorArtifact(directory, result) {
17175
17176
  } : null
17176
17177
  }))
17177
17178
  };
17178
- fs3.writeFileSync(artifactPath, JSON.stringify(guiOutput, null, 2), "utf-8");
17179
+ fs4.writeFileSync(artifactPath, JSON.stringify(guiOutput, null, 2), "utf-8");
17179
17180
  return artifactPath;
17180
17181
  }
17181
17182
  function shouldRunOnStartup(automationConfig) {
@@ -17514,7 +17515,7 @@ var init_evidence_summary_service = __esm(() => {
17514
17515
  });
17515
17516
 
17516
17517
  // src/cli/index.ts
17517
- import * as fs12 from "fs";
17518
+ import * as fs13 from "fs";
17518
17519
  import * as os5 from "os";
17519
17520
  import * as path23 from "path";
17520
17521
 
@@ -18759,7 +18760,7 @@ async function handleBenchmarkCommand(directory, args) {
18759
18760
 
18760
18761
  // src/tools/checkpoint.ts
18761
18762
  import { spawnSync } from "child_process";
18762
- import * as fs2 from "fs";
18763
+ import * as fs3 from "fs";
18763
18764
  import * as path4 from "path";
18764
18765
 
18765
18766
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
@@ -31150,8 +31151,8 @@ function getCheckpointLogPath(directory) {
31150
31151
  function readCheckpointLog(directory) {
31151
31152
  const logPath = getCheckpointLogPath(directory);
31152
31153
  try {
31153
- if (fs2.existsSync(logPath)) {
31154
- const content = fs2.readFileSync(logPath, "utf-8");
31154
+ if (fs3.existsSync(logPath)) {
31155
+ const content = fs3.readFileSync(logPath, "utf-8");
31155
31156
  const parsed = JSON.parse(content);
31156
31157
  if (!parsed.checkpoints || !Array.isArray(parsed.checkpoints)) {
31157
31158
  return { version: 1, checkpoints: [] };
@@ -31164,12 +31165,12 @@ function readCheckpointLog(directory) {
31164
31165
  function writeCheckpointLog(log2, directory) {
31165
31166
  const logPath = getCheckpointLogPath(directory);
31166
31167
  const dir = path4.dirname(logPath);
31167
- if (!fs2.existsSync(dir)) {
31168
- fs2.mkdirSync(dir, { recursive: true });
31168
+ if (!fs3.existsSync(dir)) {
31169
+ fs3.mkdirSync(dir, { recursive: true });
31169
31170
  }
31170
31171
  const tempPath = `${logPath}.tmp`;
31171
- fs2.writeFileSync(tempPath, JSON.stringify(log2, null, 2), "utf-8");
31172
- fs2.renameSync(tempPath, logPath);
31172
+ fs3.writeFileSync(tempPath, JSON.stringify(log2, null, 2), "utf-8");
31173
+ fs3.renameSync(tempPath, logPath);
31173
31174
  }
31174
31175
  function gitExec(args) {
31175
31176
  const result = spawnSync("git", args, {
@@ -33649,7 +33650,7 @@ async function handleExportCommand(directory, _args) {
33649
33650
  // src/commands/handoff.ts
33650
33651
  init_utils2();
33651
33652
  import crypto3 from "crypto";
33652
- import { renameSync as renameSync5 } from "fs";
33653
+ import { renameSync as renameSync4 } from "fs";
33653
33654
 
33654
33655
  // src/services/handoff-service.ts
33655
33656
  init_utils2();
@@ -33950,7 +33951,7 @@ function formatHandoffMarkdown(data) {
33950
33951
 
33951
33952
  // src/session/snapshot-writer.ts
33952
33953
  init_utils2();
33953
- import { mkdirSync as mkdirSync4, renameSync as renameSync4 } from "fs";
33954
+ import { mkdirSync as mkdirSync4, renameSync as renameSync3 } from "fs";
33954
33955
  import * as path14 from "path";
33955
33956
  var pendingWrite = null;
33956
33957
  var lastWritePromise = Promise.resolve();
@@ -34041,7 +34042,7 @@ async function writeSnapshot(directory, state) {
34041
34042
  mkdirSync4(dir, { recursive: true });
34042
34043
  const tempPath = `${resolvedPath}.tmp.${Date.now()}.${Math.random().toString(36).slice(2)}`;
34043
34044
  await Bun.write(tempPath, content);
34044
- renameSync4(tempPath, resolvedPath);
34045
+ renameSync3(tempPath, resolvedPath);
34045
34046
  } catch (error93) {
34046
34047
  if (process.env.DEBUG_SWARM) {
34047
34048
  console.warn("[snapshot-writer] write failed:", error93 instanceof Error ? error93.message : String(error93));
@@ -34065,7 +34066,7 @@ async function handleHandoffCommand(directory, _args) {
34065
34066
  const resolvedPath = validateSwarmPath(directory, "handoff.md");
34066
34067
  const tempPath = `${resolvedPath}.tmp.${crypto3.randomUUID()}`;
34067
34068
  await Bun.write(tempPath, markdown);
34068
- renameSync5(tempPath, resolvedPath);
34069
+ renameSync4(tempPath, resolvedPath);
34069
34070
  await writeSnapshot(directory, swarmState);
34070
34071
  await flushPendingSnapshot(directory);
34071
34072
  return `## Handoff Brief Written
@@ -34664,15 +34665,15 @@ async function handlePlanCommand(directory, args) {
34664
34665
  // src/services/preflight-service.ts
34665
34666
  init_manager();
34666
34667
  init_manager2();
34667
- import * as fs8 from "fs";
34668
+ import * as fs9 from "fs";
34668
34669
  import * as path20 from "path";
34669
34670
 
34670
34671
  // src/tools/lint.ts
34671
- import * as fs5 from "fs";
34672
+ import * as fs6 from "fs";
34672
34673
  import * as path17 from "path";
34673
34674
 
34674
34675
  // src/build/discovery.ts
34675
- import * as fs4 from "fs";
34676
+ import * as fs5 from "fs";
34676
34677
  import * as path16 from "path";
34677
34678
 
34678
34679
  // src/lang/detector.ts
@@ -35713,7 +35714,7 @@ function findBuildFiles(workingDir, patterns) {
35713
35714
  if (pattern.includes("*")) {
35714
35715
  const dir = workingDir;
35715
35716
  try {
35716
- const files = fs4.readdirSync(dir);
35717
+ const files = fs5.readdirSync(dir);
35717
35718
  const regex = simpleGlobToRegex(pattern);
35718
35719
  const matches = files.filter((f) => regex.test(f));
35719
35720
  if (matches.length > 0) {
@@ -35722,7 +35723,7 @@ function findBuildFiles(workingDir, patterns) {
35722
35723
  } catch {}
35723
35724
  } else {
35724
35725
  const filePath = path16.join(workingDir, pattern);
35725
- if (fs4.existsSync(filePath)) {
35726
+ if (fs5.existsSync(filePath)) {
35726
35727
  return filePath;
35727
35728
  }
35728
35729
  }
@@ -35731,11 +35732,11 @@ function findBuildFiles(workingDir, patterns) {
35731
35732
  }
35732
35733
  function getRepoDefinedScripts(workingDir, scripts) {
35733
35734
  const packageJsonPath = path16.join(workingDir, "package.json");
35734
- if (!fs4.existsSync(packageJsonPath)) {
35735
+ if (!fs5.existsSync(packageJsonPath)) {
35735
35736
  return [];
35736
35737
  }
35737
35738
  try {
35738
- const content = fs4.readFileSync(packageJsonPath, "utf-8");
35739
+ const content = fs5.readFileSync(packageJsonPath, "utf-8");
35739
35740
  const pkg = JSON.parse(content);
35740
35741
  if (!pkg.scripts || typeof pkg.scripts !== "object") {
35741
35742
  return [];
@@ -35772,7 +35773,7 @@ function findAllBuildFiles(workingDir) {
35772
35773
  findFilesRecursive(workingDir, regex, allBuildFiles);
35773
35774
  } else {
35774
35775
  const filePath = path16.join(workingDir, pattern);
35775
- if (fs4.existsSync(filePath)) {
35776
+ if (fs5.existsSync(filePath)) {
35776
35777
  allBuildFiles.add(filePath);
35777
35778
  }
35778
35779
  }
@@ -35782,7 +35783,7 @@ function findAllBuildFiles(workingDir) {
35782
35783
  }
35783
35784
  function findFilesRecursive(dir, regex, results) {
35784
35785
  try {
35785
- const entries = fs4.readdirSync(dir, { withFileTypes: true });
35786
+ const entries = fs5.readdirSync(dir, { withFileTypes: true });
35786
35787
  for (const entry of entries) {
35787
35788
  const fullPath = path16.join(dir, entry.name);
35788
35789
  if (entry.isDirectory() && !["node_modules", ".git", "dist", "build", "target"].includes(entry.name)) {
@@ -35808,7 +35809,7 @@ async function discoverBuildCommandsFromProfiles(workingDir) {
35808
35809
  for (const cmd of sortedCommands) {
35809
35810
  if (cmd.detectFile) {
35810
35811
  const detectFilePath = path16.join(workingDir, cmd.detectFile);
35811
- if (!fs4.existsSync(detectFilePath)) {
35812
+ if (!fs5.existsSync(detectFilePath)) {
35812
35813
  continue;
35813
35814
  }
35814
35815
  }
@@ -35941,7 +35942,7 @@ function getLinterCommand(linter, mode, projectDir) {
35941
35942
  }
35942
35943
  function getAdditionalLinterCommand(linter, mode, cwd) {
35943
35944
  const gradlewName = process.platform === "win32" ? "gradlew.bat" : "gradlew";
35944
- const gradlew = fs5.existsSync(path17.join(cwd, gradlewName)) ? path17.join(cwd, gradlewName) : null;
35945
+ const gradlew = fs6.existsSync(path17.join(cwd, gradlewName)) ? path17.join(cwd, gradlewName) : null;
35945
35946
  switch (linter) {
35946
35947
  case "ruff":
35947
35948
  return mode === "fix" ? ["ruff", "check", "--fix", "."] : ["ruff", "check", "."];
@@ -35975,12 +35976,12 @@ function getAdditionalLinterCommand(linter, mode, cwd) {
35975
35976
  }
35976
35977
  }
35977
35978
  function detectRuff(cwd) {
35978
- if (fs5.existsSync(path17.join(cwd, "ruff.toml")))
35979
+ if (fs6.existsSync(path17.join(cwd, "ruff.toml")))
35979
35980
  return isCommandAvailable("ruff");
35980
35981
  try {
35981
35982
  const pyproject = path17.join(cwd, "pyproject.toml");
35982
- if (fs5.existsSync(pyproject)) {
35983
- const content = fs5.readFileSync(pyproject, "utf-8");
35983
+ if (fs6.existsSync(pyproject)) {
35984
+ const content = fs6.readFileSync(pyproject, "utf-8");
35984
35985
  if (content.includes("[tool.ruff]"))
35985
35986
  return isCommandAvailable("ruff");
35986
35987
  }
@@ -35988,21 +35989,21 @@ function detectRuff(cwd) {
35988
35989
  return false;
35989
35990
  }
35990
35991
  function detectClippy(cwd) {
35991
- return fs5.existsSync(path17.join(cwd, "Cargo.toml")) && isCommandAvailable("cargo");
35992
+ return fs6.existsSync(path17.join(cwd, "Cargo.toml")) && isCommandAvailable("cargo");
35992
35993
  }
35993
35994
  function detectGolangciLint(cwd) {
35994
- return fs5.existsSync(path17.join(cwd, "go.mod")) && isCommandAvailable("golangci-lint");
35995
+ return fs6.existsSync(path17.join(cwd, "go.mod")) && isCommandAvailable("golangci-lint");
35995
35996
  }
35996
35997
  function detectCheckstyle(cwd) {
35997
- const hasMaven = fs5.existsSync(path17.join(cwd, "pom.xml"));
35998
- const hasGradle = fs5.existsSync(path17.join(cwd, "build.gradle")) || fs5.existsSync(path17.join(cwd, "build.gradle.kts"));
35999
- const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (fs5.existsSync(path17.join(cwd, "gradlew")) || isCommandAvailable("gradle"));
35998
+ const hasMaven = fs6.existsSync(path17.join(cwd, "pom.xml"));
35999
+ const hasGradle = fs6.existsSync(path17.join(cwd, "build.gradle")) || fs6.existsSync(path17.join(cwd, "build.gradle.kts"));
36000
+ const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (fs6.existsSync(path17.join(cwd, "gradlew")) || isCommandAvailable("gradle"));
36000
36001
  return (hasMaven || hasGradle) && hasBinary;
36001
36002
  }
36002
36003
  function detectKtlint(cwd) {
36003
- const hasKotlin = fs5.existsSync(path17.join(cwd, "build.gradle.kts")) || fs5.existsSync(path17.join(cwd, "build.gradle")) || (() => {
36004
+ const hasKotlin = fs6.existsSync(path17.join(cwd, "build.gradle.kts")) || fs6.existsSync(path17.join(cwd, "build.gradle")) || (() => {
36004
36005
  try {
36005
- return fs5.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
36006
+ return fs6.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
36006
36007
  } catch {
36007
36008
  return false;
36008
36009
  }
@@ -36011,7 +36012,7 @@ function detectKtlint(cwd) {
36011
36012
  }
36012
36013
  function detectDotnetFormat(cwd) {
36013
36014
  try {
36014
- const files = fs5.readdirSync(cwd);
36015
+ const files = fs6.readdirSync(cwd);
36015
36016
  const hasCsproj = files.some((f) => f.endsWith(".csproj") || f.endsWith(".sln"));
36016
36017
  return hasCsproj && isCommandAvailable("dotnet");
36017
36018
  } catch {
@@ -36019,14 +36020,14 @@ function detectDotnetFormat(cwd) {
36019
36020
  }
36020
36021
  }
36021
36022
  function detectCppcheck(cwd) {
36022
- if (fs5.existsSync(path17.join(cwd, "CMakeLists.txt"))) {
36023
+ if (fs6.existsSync(path17.join(cwd, "CMakeLists.txt"))) {
36023
36024
  return isCommandAvailable("cppcheck");
36024
36025
  }
36025
36026
  try {
36026
36027
  const dirsToCheck = [cwd, path17.join(cwd, "src")];
36027
36028
  const hasCpp = dirsToCheck.some((dir) => {
36028
36029
  try {
36029
- return fs5.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
36030
+ return fs6.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
36030
36031
  } catch {
36031
36032
  return false;
36032
36033
  }
@@ -36037,13 +36038,13 @@ function detectCppcheck(cwd) {
36037
36038
  }
36038
36039
  }
36039
36040
  function detectSwiftlint(cwd) {
36040
- return fs5.existsSync(path17.join(cwd, "Package.swift")) && isCommandAvailable("swiftlint");
36041
+ return fs6.existsSync(path17.join(cwd, "Package.swift")) && isCommandAvailable("swiftlint");
36041
36042
  }
36042
36043
  function detectDartAnalyze(cwd) {
36043
- return fs5.existsSync(path17.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
36044
+ return fs6.existsSync(path17.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
36044
36045
  }
36045
36046
  function detectRubocop(cwd) {
36046
- return (fs5.existsSync(path17.join(cwd, "Gemfile")) || fs5.existsSync(path17.join(cwd, "gems.rb")) || fs5.existsSync(path17.join(cwd, ".rubocop.yml"))) && (isCommandAvailable("rubocop") || isCommandAvailable("bundle"));
36047
+ return (fs6.existsSync(path17.join(cwd, "Gemfile")) || fs6.existsSync(path17.join(cwd, "gems.rb")) || fs6.existsSync(path17.join(cwd, ".rubocop.yml"))) && (isCommandAvailable("rubocop") || isCommandAvailable("bundle"));
36047
36048
  }
36048
36049
  function detectAdditionalLinter(cwd) {
36049
36050
  if (detectRuff(cwd))
@@ -36088,7 +36089,7 @@ async function _detectAvailableLinter(_projectDir, biomeBin, eslintBin) {
36088
36089
  const result = await Promise.race([biomeExit, timeout]);
36089
36090
  if (result === "timeout") {
36090
36091
  biomeProc.kill();
36091
- } else if (biomeProc.exitCode === 0 && fs5.existsSync(biomeBin)) {
36092
+ } else if (biomeProc.exitCode === 0 && fs6.existsSync(biomeBin)) {
36092
36093
  return "biome";
36093
36094
  }
36094
36095
  } catch {}
@@ -36102,7 +36103,7 @@ async function _detectAvailableLinter(_projectDir, biomeBin, eslintBin) {
36102
36103
  const result = await Promise.race([eslintExit, timeout]);
36103
36104
  if (result === "timeout") {
36104
36105
  eslintProc.kill();
36105
- } else if (eslintProc.exitCode === 0 && fs5.existsSync(eslintBin)) {
36106
+ } else if (eslintProc.exitCode === 0 && fs6.existsSync(eslintBin)) {
36106
36107
  return "eslint";
36107
36108
  }
36108
36109
  } catch {}
@@ -36272,7 +36273,7 @@ For Rust: rustup component add clippy`
36272
36273
  });
36273
36274
 
36274
36275
  // src/tools/secretscan.ts
36275
- import * as fs6 from "fs";
36276
+ import * as fs7 from "fs";
36276
36277
  import * as path18 from "path";
36277
36278
  var MAX_FILE_PATH_LENGTH = 500;
36278
36279
  var MAX_FILE_SIZE_BYTES = 512 * 1024;
@@ -36515,9 +36516,9 @@ function isGlobOrPathPattern(pattern) {
36515
36516
  function loadSecretScanIgnore(scanDir) {
36516
36517
  const ignorePath = path18.join(scanDir, ".secretscanignore");
36517
36518
  try {
36518
- if (!fs6.existsSync(ignorePath))
36519
+ if (!fs7.existsSync(ignorePath))
36519
36520
  return [];
36520
- const content = fs6.readFileSync(ignorePath, "utf8");
36521
+ const content = fs7.readFileSync(ignorePath, "utf8");
36521
36522
  const patterns = [];
36522
36523
  for (const rawLine of content.split(/\r?\n/)) {
36523
36524
  const line = rawLine.trim();
@@ -36635,11 +36636,11 @@ function createRedactedContext(line, findings) {
36635
36636
  result += line.slice(lastEnd);
36636
36637
  return result;
36637
36638
  }
36638
- var O_NOFOLLOW = process.platform !== "win32" ? fs6.constants.O_NOFOLLOW : undefined;
36639
+ var O_NOFOLLOW = process.platform !== "win32" ? fs7.constants.O_NOFOLLOW : undefined;
36639
36640
  function scanFileForSecrets(filePath) {
36640
36641
  const findings = [];
36641
36642
  try {
36642
- const lstat = fs6.lstatSync(filePath);
36643
+ const lstat = fs7.lstatSync(filePath);
36643
36644
  if (lstat.isSymbolicLink()) {
36644
36645
  return findings;
36645
36646
  }
@@ -36648,14 +36649,14 @@ function scanFileForSecrets(filePath) {
36648
36649
  }
36649
36650
  let buffer;
36650
36651
  if (O_NOFOLLOW !== undefined) {
36651
- const fd = fs6.openSync(filePath, "r", O_NOFOLLOW);
36652
+ const fd = fs7.openSync(filePath, "r", O_NOFOLLOW);
36652
36653
  try {
36653
- buffer = fs6.readFileSync(fd);
36654
+ buffer = fs7.readFileSync(fd);
36654
36655
  } finally {
36655
- fs6.closeSync(fd);
36656
+ fs7.closeSync(fd);
36656
36657
  }
36657
36658
  } else {
36658
- buffer = fs6.readFileSync(filePath);
36659
+ buffer = fs7.readFileSync(filePath);
36659
36660
  }
36660
36661
  if (isBinaryFile(filePath, buffer)) {
36661
36662
  return findings;
@@ -36710,7 +36711,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
36710
36711
  const files = [];
36711
36712
  let entries;
36712
36713
  try {
36713
- entries = fs6.readdirSync(dir);
36714
+ entries = fs7.readdirSync(dir);
36714
36715
  } catch {
36715
36716
  stats.fileErrors++;
36716
36717
  return files;
@@ -36733,7 +36734,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
36733
36734
  }
36734
36735
  let lstat;
36735
36736
  try {
36736
- lstat = fs6.lstatSync(fullPath);
36737
+ lstat = fs7.lstatSync(fullPath);
36737
36738
  } catch {
36738
36739
  stats.fileErrors++;
36739
36740
  continue;
@@ -36745,7 +36746,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
36745
36746
  if (lstat.isDirectory()) {
36746
36747
  let realPath;
36747
36748
  try {
36748
- realPath = fs6.realpathSync(fullPath);
36749
+ realPath = fs7.realpathSync(fullPath);
36749
36750
  } catch {
36750
36751
  stats.fileErrors++;
36751
36752
  continue;
@@ -36828,7 +36829,7 @@ var secretscan = createSwarmTool({
36828
36829
  }
36829
36830
  try {
36830
36831
  const scanDir = path18.resolve(directory);
36831
- if (!fs6.existsSync(scanDir)) {
36832
+ if (!fs7.existsSync(scanDir)) {
36832
36833
  const errorResult = {
36833
36834
  error: "directory not found",
36834
36835
  scan_dir: directory,
@@ -36839,7 +36840,7 @@ var secretscan = createSwarmTool({
36839
36840
  };
36840
36841
  return JSON.stringify(errorResult, null, 2);
36841
36842
  }
36842
- const dirStat = fs6.statSync(scanDir);
36843
+ const dirStat = fs7.statSync(scanDir);
36843
36844
  if (!dirStat.isDirectory()) {
36844
36845
  const errorResult = {
36845
36846
  error: "target must be a directory, not a file",
@@ -36890,7 +36891,7 @@ var secretscan = createSwarmTool({
36890
36891
  break;
36891
36892
  const fileFindings = scanFileForSecrets(filePath);
36892
36893
  try {
36893
- const stat2 = fs6.statSync(filePath);
36894
+ const stat2 = fs7.statSync(filePath);
36894
36895
  if (stat2.size > MAX_FILE_SIZE_BYTES) {
36895
36896
  skippedFiles++;
36896
36897
  continue;
@@ -36977,7 +36978,7 @@ async function runSecretscan(directory) {
36977
36978
  }
36978
36979
 
36979
36980
  // src/tools/test-runner.ts
36980
- import * as fs7 from "fs";
36981
+ import * as fs8 from "fs";
36981
36982
  import * as path19 from "path";
36982
36983
  var MAX_OUTPUT_BYTES3 = 512000;
36983
36984
  var MAX_COMMAND_LENGTH2 = 500;
@@ -37077,19 +37078,19 @@ function hasDevDependency(devDeps, ...patterns) {
37077
37078
  return hasPackageJsonDependency(devDeps, ...patterns);
37078
37079
  }
37079
37080
  function detectGoTest(cwd) {
37080
- return fs7.existsSync(path19.join(cwd, "go.mod")) && isCommandAvailable("go");
37081
+ return fs8.existsSync(path19.join(cwd, "go.mod")) && isCommandAvailable("go");
37081
37082
  }
37082
37083
  function detectJavaMaven(cwd) {
37083
- return fs7.existsSync(path19.join(cwd, "pom.xml")) && isCommandAvailable("mvn");
37084
+ return fs8.existsSync(path19.join(cwd, "pom.xml")) && isCommandAvailable("mvn");
37084
37085
  }
37085
37086
  function detectGradle(cwd) {
37086
- const hasBuildFile = fs7.existsSync(path19.join(cwd, "build.gradle")) || fs7.existsSync(path19.join(cwd, "build.gradle.kts"));
37087
- const hasGradlew = fs7.existsSync(path19.join(cwd, "gradlew")) || fs7.existsSync(path19.join(cwd, "gradlew.bat"));
37087
+ const hasBuildFile = fs8.existsSync(path19.join(cwd, "build.gradle")) || fs8.existsSync(path19.join(cwd, "build.gradle.kts"));
37088
+ const hasGradlew = fs8.existsSync(path19.join(cwd, "gradlew")) || fs8.existsSync(path19.join(cwd, "gradlew.bat"));
37088
37089
  return hasBuildFile && (hasGradlew || isCommandAvailable("gradle"));
37089
37090
  }
37090
37091
  function detectDotnetTest(cwd) {
37091
37092
  try {
37092
- const files = fs7.readdirSync(cwd);
37093
+ const files = fs8.readdirSync(cwd);
37093
37094
  const hasCsproj = files.some((f) => f.endsWith(".csproj"));
37094
37095
  return hasCsproj && isCommandAvailable("dotnet");
37095
37096
  } catch {
@@ -37097,32 +37098,32 @@ function detectDotnetTest(cwd) {
37097
37098
  }
37098
37099
  }
37099
37100
  function detectCTest(cwd) {
37100
- const hasSource = fs7.existsSync(path19.join(cwd, "CMakeLists.txt"));
37101
- const hasBuildCache = fs7.existsSync(path19.join(cwd, "CMakeCache.txt")) || fs7.existsSync(path19.join(cwd, "build", "CMakeCache.txt"));
37101
+ const hasSource = fs8.existsSync(path19.join(cwd, "CMakeLists.txt"));
37102
+ const hasBuildCache = fs8.existsSync(path19.join(cwd, "CMakeCache.txt")) || fs8.existsSync(path19.join(cwd, "build", "CMakeCache.txt"));
37102
37103
  return (hasSource || hasBuildCache) && isCommandAvailable("ctest");
37103
37104
  }
37104
37105
  function detectSwiftTest(cwd) {
37105
- return fs7.existsSync(path19.join(cwd, "Package.swift")) && isCommandAvailable("swift");
37106
+ return fs8.existsSync(path19.join(cwd, "Package.swift")) && isCommandAvailable("swift");
37106
37107
  }
37107
37108
  function detectDartTest(cwd) {
37108
- return fs7.existsSync(path19.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
37109
+ return fs8.existsSync(path19.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
37109
37110
  }
37110
37111
  function detectRSpec(cwd) {
37111
- const hasRSpecFile = fs7.existsSync(path19.join(cwd, ".rspec"));
37112
- const hasGemfile = fs7.existsSync(path19.join(cwd, "Gemfile"));
37113
- const hasSpecDir = fs7.existsSync(path19.join(cwd, "spec"));
37112
+ const hasRSpecFile = fs8.existsSync(path19.join(cwd, ".rspec"));
37113
+ const hasGemfile = fs8.existsSync(path19.join(cwd, "Gemfile"));
37114
+ const hasSpecDir = fs8.existsSync(path19.join(cwd, "spec"));
37114
37115
  const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
37115
37116
  return hasRSpec && (isCommandAvailable("bundle") || isCommandAvailable("rspec"));
37116
37117
  }
37117
37118
  function detectMinitest(cwd) {
37118
- return fs7.existsSync(path19.join(cwd, "test")) && (fs7.existsSync(path19.join(cwd, "Gemfile")) || fs7.existsSync(path19.join(cwd, "Rakefile"))) && isCommandAvailable("ruby");
37119
+ return fs8.existsSync(path19.join(cwd, "test")) && (fs8.existsSync(path19.join(cwd, "Gemfile")) || fs8.existsSync(path19.join(cwd, "Rakefile"))) && isCommandAvailable("ruby");
37119
37120
  }
37120
37121
  async function detectTestFramework(cwd) {
37121
37122
  const baseDir = cwd;
37122
37123
  try {
37123
37124
  const packageJsonPath = path19.join(baseDir, "package.json");
37124
- if (fs7.existsSync(packageJsonPath)) {
37125
- const content = fs7.readFileSync(packageJsonPath, "utf-8");
37125
+ if (fs8.existsSync(packageJsonPath)) {
37126
+ const content = fs8.readFileSync(packageJsonPath, "utf-8");
37126
37127
  const pkg = JSON.parse(content);
37127
37128
  const _deps = pkg.dependencies || {};
37128
37129
  const devDeps = pkg.devDependencies || {};
@@ -37141,7 +37142,7 @@ async function detectTestFramework(cwd) {
37141
37142
  return "jest";
37142
37143
  if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
37143
37144
  return "mocha";
37144
- if (fs7.existsSync(path19.join(baseDir, "bun.lockb")) || fs7.existsSync(path19.join(baseDir, "bun.lock"))) {
37145
+ if (fs8.existsSync(path19.join(baseDir, "bun.lockb")) || fs8.existsSync(path19.join(baseDir, "bun.lock"))) {
37145
37146
  if (scripts.test?.includes("bun"))
37146
37147
  return "bun";
37147
37148
  }
@@ -37151,28 +37152,28 @@ async function detectTestFramework(cwd) {
37151
37152
  const pyprojectTomlPath = path19.join(baseDir, "pyproject.toml");
37152
37153
  const setupCfgPath = path19.join(baseDir, "setup.cfg");
37153
37154
  const requirementsTxtPath = path19.join(baseDir, "requirements.txt");
37154
- if (fs7.existsSync(pyprojectTomlPath)) {
37155
- const content = fs7.readFileSync(pyprojectTomlPath, "utf-8");
37155
+ if (fs8.existsSync(pyprojectTomlPath)) {
37156
+ const content = fs8.readFileSync(pyprojectTomlPath, "utf-8");
37156
37157
  if (content.includes("[tool.pytest"))
37157
37158
  return "pytest";
37158
37159
  if (content.includes("pytest"))
37159
37160
  return "pytest";
37160
37161
  }
37161
- if (fs7.existsSync(setupCfgPath)) {
37162
- const content = fs7.readFileSync(setupCfgPath, "utf-8");
37162
+ if (fs8.existsSync(setupCfgPath)) {
37163
+ const content = fs8.readFileSync(setupCfgPath, "utf-8");
37163
37164
  if (content.includes("[pytest]"))
37164
37165
  return "pytest";
37165
37166
  }
37166
- if (fs7.existsSync(requirementsTxtPath)) {
37167
- const content = fs7.readFileSync(requirementsTxtPath, "utf-8");
37167
+ if (fs8.existsSync(requirementsTxtPath)) {
37168
+ const content = fs8.readFileSync(requirementsTxtPath, "utf-8");
37168
37169
  if (content.includes("pytest"))
37169
37170
  return "pytest";
37170
37171
  }
37171
37172
  } catch {}
37172
37173
  try {
37173
37174
  const cargoTomlPath = path19.join(baseDir, "Cargo.toml");
37174
- if (fs7.existsSync(cargoTomlPath)) {
37175
- const content = fs7.readFileSync(cargoTomlPath, "utf-8");
37175
+ if (fs8.existsSync(cargoTomlPath)) {
37176
+ const content = fs8.readFileSync(cargoTomlPath, "utf-8");
37176
37177
  if (content.includes("[dev-dependencies]")) {
37177
37178
  if (content.includes("tokio") || content.includes("mockall") || content.includes("pretty_assertions")) {
37178
37179
  return "cargo";
@@ -37184,7 +37185,7 @@ async function detectTestFramework(cwd) {
37184
37185
  const pesterConfigPath = path19.join(baseDir, "pester.config.ps1");
37185
37186
  const pesterConfigJsonPath = path19.join(baseDir, "pester.config.ps1.json");
37186
37187
  const pesterPs1Path = path19.join(baseDir, "tests.ps1");
37187
- if (fs7.existsSync(pesterConfigPath) || fs7.existsSync(pesterConfigJsonPath) || fs7.existsSync(pesterPs1Path)) {
37188
+ if (fs8.existsSync(pesterConfigPath) || fs8.existsSync(pesterConfigJsonPath) || fs8.existsSync(pesterPs1Path)) {
37188
37189
  return "pester";
37189
37190
  }
37190
37191
  } catch {}
@@ -37254,7 +37255,7 @@ function getTestFilesFromConvention(sourceFiles) {
37254
37255
  path19.join(dirname9, "test", `${nameWithoutExt}${ext}`)
37255
37256
  ];
37256
37257
  for (const testFile of possibleTestFiles) {
37257
- if (fs7.existsSync(testFile) && !testFiles.includes(testFile)) {
37258
+ if (fs8.existsSync(testFile) && !testFiles.includes(testFile)) {
37258
37259
  testFiles.push(testFile);
37259
37260
  }
37260
37261
  }
@@ -37270,7 +37271,7 @@ async function getTestFilesFromGraph(sourceFiles) {
37270
37271
  }
37271
37272
  for (const testFile of candidateTestFiles) {
37272
37273
  try {
37273
- const content = fs7.readFileSync(testFile, "utf-8");
37274
+ const content = fs8.readFileSync(testFile, "utf-8");
37274
37275
  const testDir = path19.dirname(testFile);
37275
37276
  const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
37276
37277
  let match;
@@ -37291,7 +37292,7 @@ async function getTestFilesFromGraph(sourceFiles) {
37291
37292
  ".cjs"
37292
37293
  ]) {
37293
37294
  const withExt = resolvedImport + extToTry;
37294
- if (sourceFiles.includes(withExt) || fs7.existsSync(withExt)) {
37295
+ if (sourceFiles.includes(withExt) || fs8.existsSync(withExt)) {
37295
37296
  resolvedImport = withExt;
37296
37297
  break;
37297
37298
  }
@@ -37332,7 +37333,7 @@ async function getTestFilesFromGraph(sourceFiles) {
37332
37333
  ".cjs"
37333
37334
  ]) {
37334
37335
  const withExt = resolvedImport + extToTry;
37335
- if (sourceFiles.includes(withExt) || fs7.existsSync(withExt)) {
37336
+ if (sourceFiles.includes(withExt) || fs8.existsSync(withExt)) {
37336
37337
  resolvedImport = withExt;
37337
37338
  break;
37338
37339
  }
@@ -37428,8 +37429,8 @@ function buildTestCommand(framework, scope, files, coverage, baseDir) {
37428
37429
  return ["mvn", "test"];
37429
37430
  case "gradle": {
37430
37431
  const isWindows = process.platform === "win32";
37431
- const hasGradlewBat = fs7.existsSync(path19.join(baseDir, "gradlew.bat"));
37432
- const hasGradlew = fs7.existsSync(path19.join(baseDir, "gradlew"));
37432
+ const hasGradlewBat = fs8.existsSync(path19.join(baseDir, "gradlew.bat"));
37433
+ const hasGradlew = fs8.existsSync(path19.join(baseDir, "gradlew"));
37433
37434
  if (hasGradlewBat && isWindows)
37434
37435
  return ["gradlew.bat", "test"];
37435
37436
  if (hasGradlew)
@@ -37446,7 +37447,7 @@ function buildTestCommand(framework, scope, files, coverage, baseDir) {
37446
37447
  "cmake-build-release",
37447
37448
  "out"
37448
37449
  ];
37449
- const actualBuildDir = buildDirCandidates.find((d) => fs7.existsSync(path19.join(baseDir, d, "CMakeCache.txt"))) ?? "build";
37450
+ const actualBuildDir = buildDirCandidates.find((d) => fs8.existsSync(path19.join(baseDir, d, "CMakeCache.txt"))) ?? "build";
37450
37451
  return ["ctest", "--test-dir", actualBuildDir];
37451
37452
  }
37452
37453
  case "swift-test":
@@ -38057,8 +38058,8 @@ function validateTimeout(timeoutMs, defaultValue) {
38057
38058
  function getPackageVersion(dir) {
38058
38059
  try {
38059
38060
  const packagePath = path20.join(dir, "package.json");
38060
- if (fs8.existsSync(packagePath)) {
38061
- const content = fs8.readFileSync(packagePath, "utf-8");
38061
+ if (fs9.existsSync(packagePath)) {
38062
+ const content = fs9.readFileSync(packagePath, "utf-8");
38062
38063
  const pkg = JSON.parse(content);
38063
38064
  return pkg.version ?? null;
38064
38065
  }
@@ -38068,8 +38069,8 @@ function getPackageVersion(dir) {
38068
38069
  function getChangelogVersion(dir) {
38069
38070
  try {
38070
38071
  const changelogPath = path20.join(dir, "CHANGELOG.md");
38071
- if (fs8.existsSync(changelogPath)) {
38072
- const content = fs8.readFileSync(changelogPath, "utf-8");
38072
+ if (fs9.existsSync(changelogPath)) {
38073
+ const content = fs9.readFileSync(changelogPath, "utf-8");
38073
38074
  const match = content.match(/^##\s*\[?(\d+\.\d+\.\d+)\]?/m);
38074
38075
  if (match) {
38075
38076
  return match[1];
@@ -38082,9 +38083,9 @@ function getVersionFileVersion(dir) {
38082
38083
  const possibleFiles = ["VERSION.txt", "version.txt", "VERSION", "version"];
38083
38084
  for (const file3 of possibleFiles) {
38084
38085
  const filePath = path20.join(dir, file3);
38085
- if (fs8.existsSync(filePath)) {
38086
+ if (fs9.existsSync(filePath)) {
38086
38087
  try {
38087
- const content = fs8.readFileSync(filePath, "utf-8").trim();
38088
+ const content = fs9.readFileSync(filePath, "utf-8").trim();
38088
38089
  const match = content.match(/(\d+\.\d+\.\d+)/);
38089
38090
  if (match) {
38090
38091
  return match[1];
@@ -38627,7 +38628,7 @@ async function handlePromoteCommand(directory, args) {
38627
38628
  }
38628
38629
 
38629
38630
  // src/commands/reset.ts
38630
- import * as fs9 from "fs";
38631
+ import * as fs10 from "fs";
38631
38632
 
38632
38633
  // src/background/manager.ts
38633
38634
  init_utils();
@@ -39326,8 +39327,8 @@ async function handleResetCommand(directory, args) {
39326
39327
  for (const filename of filesToReset) {
39327
39328
  try {
39328
39329
  const resolvedPath = validateSwarmPath(directory, filename);
39329
- if (fs9.existsSync(resolvedPath)) {
39330
- fs9.unlinkSync(resolvedPath);
39330
+ if (fs10.existsSync(resolvedPath)) {
39331
+ fs10.unlinkSync(resolvedPath);
39331
39332
  results.push(`- \u2705 Deleted ${filename}`);
39332
39333
  } else {
39333
39334
  results.push(`- \u23ED\uFE0F ${filename} not found (skipped)`);
@@ -39344,8 +39345,8 @@ async function handleResetCommand(directory, args) {
39344
39345
  }
39345
39346
  try {
39346
39347
  const summariesPath = validateSwarmPath(directory, "summaries");
39347
- if (fs9.existsSync(summariesPath)) {
39348
- fs9.rmSync(summariesPath, { recursive: true, force: true });
39348
+ if (fs10.existsSync(summariesPath)) {
39349
+ fs10.rmSync(summariesPath, { recursive: true, force: true });
39349
39350
  results.push("- \u2705 Deleted summaries/ directory");
39350
39351
  } else {
39351
39352
  results.push("- \u23ED\uFE0F summaries/ not found (skipped)");
@@ -39365,13 +39366,13 @@ async function handleResetCommand(directory, args) {
39365
39366
 
39366
39367
  // src/commands/reset-session.ts
39367
39368
  init_utils2();
39368
- import * as fs10 from "fs";
39369
+ import * as fs11 from "fs";
39369
39370
  async function handleResetSessionCommand(directory, _args) {
39370
39371
  const results = [];
39371
39372
  try {
39372
39373
  const statePath = validateSwarmPath(directory, "session/state.json");
39373
- if (fs10.existsSync(statePath)) {
39374
- fs10.unlinkSync(statePath);
39374
+ if (fs11.existsSync(statePath)) {
39375
+ fs11.unlinkSync(statePath);
39375
39376
  results.push("\u2705 Deleted .swarm/session/state.json");
39376
39377
  } else {
39377
39378
  results.push("\u23ED\uFE0F state.json not found (already clean)");
@@ -39474,18 +39475,18 @@ ${error93 instanceof Error ? error93.message : String(error93)}`;
39474
39475
 
39475
39476
  // src/commands/rollback.ts
39476
39477
  init_utils2();
39477
- import * as fs11 from "fs";
39478
+ import * as fs12 from "fs";
39478
39479
  import * as path22 from "path";
39479
39480
  async function handleRollbackCommand(directory, args) {
39480
39481
  const phaseArg = args[0];
39481
39482
  if (!phaseArg) {
39482
39483
  const manifestPath2 = validateSwarmPath(directory, "checkpoints/manifest.json");
39483
- if (!fs11.existsSync(manifestPath2)) {
39484
+ if (!fs12.existsSync(manifestPath2)) {
39484
39485
  return "No checkpoints found. Use `/swarm checkpoint` to create checkpoints.";
39485
39486
  }
39486
39487
  let manifest2;
39487
39488
  try {
39488
- manifest2 = JSON.parse(fs11.readFileSync(manifestPath2, "utf-8"));
39489
+ manifest2 = JSON.parse(fs12.readFileSync(manifestPath2, "utf-8"));
39489
39490
  } catch {
39490
39491
  return "Error: Checkpoint manifest is corrupted. Delete .swarm/checkpoints/manifest.json and re-checkpoint.";
39491
39492
  }
@@ -39507,12 +39508,12 @@ async function handleRollbackCommand(directory, args) {
39507
39508
  return "Error: Phase number must be a positive integer.";
39508
39509
  }
39509
39510
  const manifestPath = validateSwarmPath(directory, "checkpoints/manifest.json");
39510
- if (!fs11.existsSync(manifestPath)) {
39511
+ if (!fs12.existsSync(manifestPath)) {
39511
39512
  return `Error: No checkpoints found. Cannot rollback to phase ${targetPhase}.`;
39512
39513
  }
39513
39514
  let manifest;
39514
39515
  try {
39515
- manifest = JSON.parse(fs11.readFileSync(manifestPath, "utf-8"));
39516
+ manifest = JSON.parse(fs12.readFileSync(manifestPath, "utf-8"));
39516
39517
  } catch {
39517
39518
  return `Error: Checkpoint manifest is corrupted. Delete .swarm/checkpoints/manifest.json and re-checkpoint.`;
39518
39519
  }
@@ -39522,10 +39523,10 @@ async function handleRollbackCommand(directory, args) {
39522
39523
  return `Error: Checkpoint for phase ${targetPhase} not found. Available phases: ${available}`;
39523
39524
  }
39524
39525
  const checkpointDir = validateSwarmPath(directory, `checkpoints/phase-${targetPhase}`);
39525
- if (!fs11.existsSync(checkpointDir)) {
39526
+ if (!fs12.existsSync(checkpointDir)) {
39526
39527
  return `Error: Checkpoint directory for phase ${targetPhase} does not exist.`;
39527
39528
  }
39528
- const checkpointFiles = fs11.readdirSync(checkpointDir);
39529
+ const checkpointFiles = fs12.readdirSync(checkpointDir);
39529
39530
  if (checkpointFiles.length === 0) {
39530
39531
  return `Error: Checkpoint for phase ${targetPhase} is empty. Cannot rollback.`;
39531
39532
  }
@@ -39536,7 +39537,7 @@ async function handleRollbackCommand(directory, args) {
39536
39537
  const src = path22.join(checkpointDir, file3);
39537
39538
  const dest = path22.join(swarmDir, file3);
39538
39539
  try {
39539
- fs11.cpSync(src, dest, { recursive: true, force: true });
39540
+ fs12.cpSync(src, dest, { recursive: true, force: true });
39540
39541
  successes.push(file3);
39541
39542
  } catch (error93) {
39542
39543
  failures.push({ file: file3, error: error93.message });
@@ -39553,7 +39554,7 @@ async function handleRollbackCommand(directory, args) {
39553
39554
  timestamp: new Date().toISOString()
39554
39555
  };
39555
39556
  try {
39556
- fs11.appendFileSync(eventsPath, `${JSON.stringify(rollbackEvent)}
39557
+ fs12.appendFileSync(eventsPath, `${JSON.stringify(rollbackEvent)}
39557
39558
  `);
39558
39559
  } catch (error93) {
39559
39560
  console.error("Failed to write rollback event:", error93);
@@ -39596,11 +39597,11 @@ async function handleSimulateCommand(directory, args) {
39596
39597
  ];
39597
39598
  const report = reportLines.filter(Boolean).join(`
39598
39599
  `);
39599
- const fs12 = await import("fs/promises");
39600
+ const fs13 = await import("fs/promises");
39600
39601
  const path23 = await import("path");
39601
39602
  const reportPath = path23.join(directory, ".swarm", "simulate-report.md");
39602
- await fs12.mkdir(path23.dirname(reportPath), { recursive: true });
39603
- await fs12.writeFile(reportPath, report, "utf-8");
39603
+ await fs13.mkdir(path23.dirname(reportPath), { recursive: true });
39604
+ await fs13.writeFile(reportPath, report, "utf-8");
39604
39605
  return `${darkMatterPairs.length} hidden coupling pairs detected`;
39605
39606
  }
39606
39607
 
@@ -40396,13 +40397,13 @@ var OPENCODE_CONFIG_PATH = path23.join(CONFIG_DIR, "opencode.json");
40396
40397
  var PLUGIN_CONFIG_PATH = path23.join(CONFIG_DIR, "opencode-swarm.json");
40397
40398
  var PROMPTS_DIR = path23.join(CONFIG_DIR, "opencode-swarm");
40398
40399
  function ensureDir(dir) {
40399
- if (!fs12.existsSync(dir)) {
40400
- fs12.mkdirSync(dir, { recursive: true });
40400
+ if (!fs13.existsSync(dir)) {
40401
+ fs13.mkdirSync(dir, { recursive: true });
40401
40402
  }
40402
40403
  }
40403
40404
  function loadJson(filepath) {
40404
40405
  try {
40405
- const content = fs12.readFileSync(filepath, "utf-8");
40406
+ const content = fs13.readFileSync(filepath, "utf-8");
40406
40407
  const stripped = content.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (match, comment) => comment ? "" : match).replace(/,(\s*[}\]])/g, "$1");
40407
40408
  return JSON.parse(stripped);
40408
40409
  } catch {
@@ -40410,7 +40411,7 @@ function loadJson(filepath) {
40410
40411
  }
40411
40412
  }
40412
40413
  function saveJson(filepath, data) {
40413
- fs12.writeFileSync(filepath, `${JSON.stringify(data, null, 2)}
40414
+ fs13.writeFileSync(filepath, `${JSON.stringify(data, null, 2)}
40414
40415
  `, "utf-8");
40415
40416
  }
40416
40417
  async function install() {
@@ -40443,7 +40444,7 @@ async function install() {
40443
40444
  saveJson(OPENCODE_CONFIG_PATH, opencodeConfig);
40444
40445
  console.log("\u2713 Added opencode-swarm to OpenCode plugins");
40445
40446
  console.log("\u2713 Disabled default OpenCode agents (explore, general)");
40446
- if (!fs12.existsSync(PLUGIN_CONFIG_PATH)) {
40447
+ if (!fs13.existsSync(PLUGIN_CONFIG_PATH)) {
40447
40448
  const defaultConfig = {
40448
40449
  agents: {
40449
40450
  coder: { model: "opencode/minimax-m2.5-free" },
@@ -40486,7 +40487,7 @@ async function uninstall() {
40486
40487
  `);
40487
40488
  const opencodeConfig = loadJson(OPENCODE_CONFIG_PATH);
40488
40489
  if (!opencodeConfig) {
40489
- if (fs12.existsSync(OPENCODE_CONFIG_PATH)) {
40490
+ if (fs13.existsSync(OPENCODE_CONFIG_PATH)) {
40490
40491
  console.log(`\u2717 Could not parse opencode config at: ${OPENCODE_CONFIG_PATH}`);
40491
40492
  return 1;
40492
40493
  } else {
@@ -40518,13 +40519,13 @@ async function uninstall() {
40518
40519
  console.log("\u2713 Re-enabled default OpenCode agents (explore, general)");
40519
40520
  if (process.argv.includes("--clean")) {
40520
40521
  let cleaned = false;
40521
- if (fs12.existsSync(PLUGIN_CONFIG_PATH)) {
40522
- fs12.unlinkSync(PLUGIN_CONFIG_PATH);
40522
+ if (fs13.existsSync(PLUGIN_CONFIG_PATH)) {
40523
+ fs13.unlinkSync(PLUGIN_CONFIG_PATH);
40523
40524
  console.log(`\u2713 Removed plugin config: ${PLUGIN_CONFIG_PATH}`);
40524
40525
  cleaned = true;
40525
40526
  }
40526
- if (fs12.existsSync(PROMPTS_DIR)) {
40527
- fs12.rmSync(PROMPTS_DIR, { recursive: true });
40527
+ if (fs13.existsSync(PROMPTS_DIR)) {
40528
+ fs13.rmSync(PROMPTS_DIR, { recursive: true });
40528
40529
  console.log(`\u2713 Removed custom prompts: ${PROMPTS_DIR}`);
40529
40530
  cleaned = true;
40530
40531
  }