opencode-swarm 6.33.8 → 6.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -5
- package/dist/agents/critic.d.ts +5 -2
- package/dist/cli/index.js +328 -306
- package/dist/config/agent-categories.d.ts +12 -0
- package/dist/config/constants.d.ts +3 -3
- package/dist/config/schema.d.ts +2 -2
- package/dist/gate-evidence.d.ts +6 -0
- package/dist/index.d.ts +0 -10
- package/dist/index.js +1769 -1112
- package/dist/telemetry.d.ts +53 -0
- package/dist/telemetry.test.d.ts +1 -0
- package/dist/tools/completion-verify.d.ts +23 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/tool-names.d.ts +1 -1
- 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,
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
14626
|
+
function patch(fs4) {
|
|
14626
14627
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
14627
|
-
patchLchmod(
|
|
14628
|
-
}
|
|
14629
|
-
if (!
|
|
14630
|
-
patchLutimes(
|
|
14631
|
-
}
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
if (
|
|
14651
|
-
|
|
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
|
-
|
|
14656
|
+
fs4.lchmodSync = function() {};
|
|
14656
14657
|
}
|
|
14657
|
-
if (
|
|
14658
|
-
|
|
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
|
-
|
|
14663
|
+
fs4.lchownSync = function() {};
|
|
14663
14664
|
}
|
|
14664
14665
|
if (platform === "win32") {
|
|
14665
|
-
|
|
14666
|
-
function
|
|
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
|
-
|
|
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(
|
|
14689
|
-
return
|
|
14690
|
-
}(
|
|
14689
|
+
Object.setPrototypeOf(rename2, fs$rename);
|
|
14690
|
+
return rename2;
|
|
14691
|
+
}(fs4.rename);
|
|
14691
14692
|
}
|
|
14692
|
-
|
|
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(
|
|
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(
|
|
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
|
-
}(
|
|
14711
|
-
|
|
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(
|
|
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
|
-
}(
|
|
14727
|
-
function patchLchmod(
|
|
14728
|
-
|
|
14729
|
-
|
|
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
|
-
|
|
14736
|
-
|
|
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
|
-
|
|
14744
|
-
var fd =
|
|
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 =
|
|
14749
|
+
ret = fs5.fchmodSync(fd, mode);
|
|
14749
14750
|
threw = false;
|
|
14750
14751
|
} finally {
|
|
14751
14752
|
if (threw) {
|
|
14752
14753
|
try {
|
|
14753
|
-
|
|
14754
|
+
fs5.closeSync(fd);
|
|
14754
14755
|
} catch (er) {}
|
|
14755
14756
|
} else {
|
|
14756
|
-
|
|
14757
|
+
fs5.closeSync(fd);
|
|
14757
14758
|
}
|
|
14758
14759
|
}
|
|
14759
14760
|
return ret;
|
|
14760
14761
|
};
|
|
14761
14762
|
}
|
|
14762
|
-
function patchLutimes(
|
|
14763
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
14764
|
-
|
|
14765
|
-
|
|
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
|
-
|
|
14772
|
-
|
|
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
|
-
|
|
14780
|
-
var fd =
|
|
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 =
|
|
14785
|
+
ret = fs5.futimesSync(fd, at, mt);
|
|
14785
14786
|
threw = false;
|
|
14786
14787
|
} finally {
|
|
14787
14788
|
if (threw) {
|
|
14788
14789
|
try {
|
|
14789
|
-
|
|
14790
|
+
fs5.closeSync(fd);
|
|
14790
14791
|
} catch (er) {}
|
|
14791
14792
|
} else {
|
|
14792
|
-
|
|
14793
|
+
fs5.closeSync(fd);
|
|
14793
14794
|
}
|
|
14794
14795
|
}
|
|
14795
14796
|
return ret;
|
|
14796
14797
|
};
|
|
14797
|
-
} else if (
|
|
14798
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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 (!
|
|
15055
|
+
if (!fs4[gracefulQueue]) {
|
|
15055
15056
|
queue = global[gracefulQueue] || [];
|
|
15056
|
-
publishQueue(
|
|
15057
|
-
|
|
15057
|
+
publishQueue(fs4, queue);
|
|
15058
|
+
fs4.close = function(fs$close) {
|
|
15058
15059
|
function close(fd, cb) {
|
|
15059
|
-
return fs$close.call(
|
|
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
|
-
}(
|
|
15072
|
-
|
|
15072
|
+
}(fs4.close);
|
|
15073
|
+
fs4.closeSync = function(fs$closeSync) {
|
|
15073
15074
|
function closeSync(fd) {
|
|
15074
|
-
fs$closeSync.apply(
|
|
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
|
-
}(
|
|
15082
|
+
}(fs4.closeSync);
|
|
15082
15083
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
15083
15084
|
process.on("exit", function() {
|
|
15084
|
-
debug(
|
|
15085
|
-
__require("assert").equal(
|
|
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,
|
|
15092
|
-
}
|
|
15093
|
-
module.exports = patch(clone3(
|
|
15094
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
15095
|
-
module.exports = patch(
|
|
15096
|
-
|
|
15097
|
-
}
|
|
15098
|
-
function patch(
|
|
15099
|
-
polyfills(
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
var fs$readFile =
|
|
15104
|
-
|
|
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 =
|
|
15121
|
-
|
|
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 =
|
|
15138
|
+
var fs$appendFile = fs5.appendFile;
|
|
15138
15139
|
if (fs$appendFile)
|
|
15139
|
-
|
|
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 =
|
|
15156
|
+
var fs$copyFile = fs5.copyFile;
|
|
15156
15157
|
if (fs$copyFile)
|
|
15157
|
-
|
|
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 =
|
|
15176
|
-
|
|
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(
|
|
15208
|
+
var legStreams = legacy(fs5);
|
|
15208
15209
|
ReadStream = legStreams.ReadStream;
|
|
15209
15210
|
WriteStream = legStreams.WriteStream;
|
|
15210
15211
|
}
|
|
15211
|
-
var fs$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 =
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
15303
|
+
return new fs5.ReadStream(path6, options);
|
|
15303
15304
|
}
|
|
15304
15305
|
function createWriteStream(path6, options) {
|
|
15305
|
-
return new
|
|
15306
|
+
return new fs5.WriteStream(path6, options);
|
|
15306
15307
|
}
|
|
15307
|
-
var fs$open =
|
|
15308
|
-
|
|
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
|
|
15325
|
+
return fs5;
|
|
15325
15326
|
}
|
|
15326
15327
|
function enqueue(elem) {
|
|
15327
15328
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
15328
|
-
|
|
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 <
|
|
15335
|
-
if (
|
|
15336
|
-
|
|
15337
|
-
|
|
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 (
|
|
15346
|
+
if (fs4[gracefulQueue].length === 0)
|
|
15346
15347
|
return;
|
|
15347
|
-
var elem =
|
|
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
|
-
|
|
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,
|
|
15765
|
-
const cachedPrecision =
|
|
15765
|
+
function probe(file3, fs4, callback) {
|
|
15766
|
+
const cachedPrecision = fs4[cacheSymbol];
|
|
15766
15767
|
if (cachedPrecision) {
|
|
15767
|
-
return
|
|
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
|
-
|
|
15776
|
+
fs4.utimes(file3, mtime, mtime, (err) => {
|
|
15776
15777
|
if (err) {
|
|
15777
15778
|
return callback(err);
|
|
15778
15779
|
}
|
|
15779
|
-
|
|
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(
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
16028
|
-
function createSyncFs(
|
|
16028
|
+
var fs4 = require_graceful_fs();
|
|
16029
|
+
function createSyncFs(fs5) {
|
|
16029
16030
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
16030
|
-
const newFs = { ...
|
|
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 =
|
|
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 ||
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 (
|
|
16666
|
+
if (fs4.existsSync(projectConfigPath)) {
|
|
16666
16667
|
try {
|
|
16667
|
-
content =
|
|
16668
|
+
content = fs4.readFileSync(projectConfigPath, "utf-8");
|
|
16668
16669
|
} catch {}
|
|
16669
16670
|
}
|
|
16670
|
-
if (content === null &&
|
|
16671
|
+
if (content === null && fs4.existsSync(userConfigPath)) {
|
|
16671
16672
|
configPath = userConfigPath;
|
|
16672
16673
|
try {
|
|
16673
|
-
content =
|
|
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 (!
|
|
16689
|
-
|
|
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
|
-
|
|
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 (!
|
|
16705
|
+
if (!fs4.existsSync(backupPath)) {
|
|
16705
16706
|
return null;
|
|
16706
16707
|
}
|
|
16707
16708
|
try {
|
|
16708
|
-
const artifact = JSON.parse(
|
|
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 (!
|
|
16724
|
-
|
|
16724
|
+
if (!fs4.existsSync(targetDir)) {
|
|
16725
|
+
fs4.mkdirSync(targetDir, { recursive: true });
|
|
16725
16726
|
}
|
|
16726
|
-
|
|
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 (
|
|
16737
|
+
if (fs4.existsSync(projectConfigPath)) {
|
|
16737
16738
|
configPath = projectConfigPath;
|
|
16738
|
-
configContent =
|
|
16739
|
-
} else if (
|
|
16739
|
+
configContent = fs4.readFileSync(projectConfigPath, "utf-8");
|
|
16740
|
+
} else if (fs4.existsSync(userConfigPath)) {
|
|
16740
16741
|
configPath = userConfigPath;
|
|
16741
|
-
configContent =
|
|
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 (
|
|
17038
|
+
if (fs4.existsSync(projectConfigPath)) {
|
|
17038
17039
|
configSource = projectConfigPath;
|
|
17039
|
-
} else if (
|
|
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 (
|
|
17069
|
+
if (fs4.existsSync(projectConfigPath)) {
|
|
17069
17070
|
configPath = projectConfigPath;
|
|
17070
|
-
configContent =
|
|
17071
|
-
} else if (
|
|
17071
|
+
configContent = fs4.readFileSync(projectConfigPath, "utf-8");
|
|
17072
|
+
} else if (fs4.existsSync(userConfigPath)) {
|
|
17072
17073
|
configPath = userConfigPath;
|
|
17073
|
-
configContent =
|
|
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 (!
|
|
17144
|
-
|
|
17144
|
+
if (!fs4.existsSync(configDir)) {
|
|
17145
|
+
fs4.mkdirSync(configDir, { recursive: true });
|
|
17145
17146
|
}
|
|
17146
|
-
|
|
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 (!
|
|
17154
|
-
|
|
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
|
-
|
|
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
|
|
17518
|
+
import * as fs13 from "fs";
|
|
17518
17519
|
import * as os5 from "os";
|
|
17519
17520
|
import * as path23 from "path";
|
|
17520
17521
|
|
|
@@ -17601,6 +17602,7 @@ var TOOL_NAMES = [
|
|
|
17601
17602
|
"todo_extract",
|
|
17602
17603
|
"evidence_check",
|
|
17603
17604
|
"check_gate_status",
|
|
17605
|
+
"completion_verify",
|
|
17604
17606
|
"sbom_generate",
|
|
17605
17607
|
"checkpoint",
|
|
17606
17608
|
"pkg_audit",
|
|
@@ -17619,13 +17621,18 @@ var TOOL_NAMES = [
|
|
|
17619
17621
|
var TOOL_NAME_SET = new Set(TOOL_NAMES);
|
|
17620
17622
|
|
|
17621
17623
|
// src/config/constants.ts
|
|
17622
|
-
var QA_AGENTS = [
|
|
17624
|
+
var QA_AGENTS = [
|
|
17625
|
+
"reviewer",
|
|
17626
|
+
"critic",
|
|
17627
|
+
"critic_drift_verifier"
|
|
17628
|
+
];
|
|
17623
17629
|
var PIPELINE_AGENTS = ["explorer", "coder", "test_engineer"];
|
|
17624
17630
|
var ORCHESTRATOR_NAME = "architect";
|
|
17625
17631
|
var ALL_SUBAGENT_NAMES = [
|
|
17626
17632
|
"sme",
|
|
17627
17633
|
"docs",
|
|
17628
17634
|
"designer",
|
|
17635
|
+
"critic_sounding_board",
|
|
17629
17636
|
...QA_AGENTS,
|
|
17630
17637
|
...PIPELINE_AGENTS
|
|
17631
17638
|
];
|
|
@@ -17717,6 +17724,21 @@ var AGENT_TOOL_MAP = {
|
|
|
17717
17724
|
"retrieve_summary",
|
|
17718
17725
|
"symbols"
|
|
17719
17726
|
],
|
|
17727
|
+
critic_sounding_board: [
|
|
17728
|
+
"complexity_hotspots",
|
|
17729
|
+
"detect_domains",
|
|
17730
|
+
"imports",
|
|
17731
|
+
"retrieve_summary",
|
|
17732
|
+
"symbols"
|
|
17733
|
+
],
|
|
17734
|
+
critic_drift_verifier: [
|
|
17735
|
+
"completion_verify",
|
|
17736
|
+
"complexity_hotspots",
|
|
17737
|
+
"detect_domains",
|
|
17738
|
+
"imports",
|
|
17739
|
+
"retrieve_summary",
|
|
17740
|
+
"symbols"
|
|
17741
|
+
],
|
|
17720
17742
|
docs: [
|
|
17721
17743
|
"detect_domains",
|
|
17722
17744
|
"extract_code_blocks",
|
|
@@ -18759,7 +18781,7 @@ async function handleBenchmarkCommand(directory, args) {
|
|
|
18759
18781
|
|
|
18760
18782
|
// src/tools/checkpoint.ts
|
|
18761
18783
|
import { spawnSync } from "child_process";
|
|
18762
|
-
import * as
|
|
18784
|
+
import * as fs3 from "fs";
|
|
18763
18785
|
import * as path4 from "path";
|
|
18764
18786
|
|
|
18765
18787
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
|
|
@@ -31150,8 +31172,8 @@ function getCheckpointLogPath(directory) {
|
|
|
31150
31172
|
function readCheckpointLog(directory) {
|
|
31151
31173
|
const logPath = getCheckpointLogPath(directory);
|
|
31152
31174
|
try {
|
|
31153
|
-
if (
|
|
31154
|
-
const content =
|
|
31175
|
+
if (fs3.existsSync(logPath)) {
|
|
31176
|
+
const content = fs3.readFileSync(logPath, "utf-8");
|
|
31155
31177
|
const parsed = JSON.parse(content);
|
|
31156
31178
|
if (!parsed.checkpoints || !Array.isArray(parsed.checkpoints)) {
|
|
31157
31179
|
return { version: 1, checkpoints: [] };
|
|
@@ -31164,12 +31186,12 @@ function readCheckpointLog(directory) {
|
|
|
31164
31186
|
function writeCheckpointLog(log2, directory) {
|
|
31165
31187
|
const logPath = getCheckpointLogPath(directory);
|
|
31166
31188
|
const dir = path4.dirname(logPath);
|
|
31167
|
-
if (!
|
|
31168
|
-
|
|
31189
|
+
if (!fs3.existsSync(dir)) {
|
|
31190
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
31169
31191
|
}
|
|
31170
31192
|
const tempPath = `${logPath}.tmp`;
|
|
31171
|
-
|
|
31172
|
-
|
|
31193
|
+
fs3.writeFileSync(tempPath, JSON.stringify(log2, null, 2), "utf-8");
|
|
31194
|
+
fs3.renameSync(tempPath, logPath);
|
|
31173
31195
|
}
|
|
31174
31196
|
function gitExec(args) {
|
|
31175
31197
|
const result = spawnSync("git", args, {
|
|
@@ -33649,7 +33671,7 @@ async function handleExportCommand(directory, _args) {
|
|
|
33649
33671
|
// src/commands/handoff.ts
|
|
33650
33672
|
init_utils2();
|
|
33651
33673
|
import crypto3 from "crypto";
|
|
33652
|
-
import { renameSync as
|
|
33674
|
+
import { renameSync as renameSync4 } from "fs";
|
|
33653
33675
|
|
|
33654
33676
|
// src/services/handoff-service.ts
|
|
33655
33677
|
init_utils2();
|
|
@@ -33950,7 +33972,7 @@ function formatHandoffMarkdown(data) {
|
|
|
33950
33972
|
|
|
33951
33973
|
// src/session/snapshot-writer.ts
|
|
33952
33974
|
init_utils2();
|
|
33953
|
-
import { mkdirSync as mkdirSync4, renameSync as
|
|
33975
|
+
import { mkdirSync as mkdirSync4, renameSync as renameSync3 } from "fs";
|
|
33954
33976
|
import * as path14 from "path";
|
|
33955
33977
|
var pendingWrite = null;
|
|
33956
33978
|
var lastWritePromise = Promise.resolve();
|
|
@@ -34041,7 +34063,7 @@ async function writeSnapshot(directory, state) {
|
|
|
34041
34063
|
mkdirSync4(dir, { recursive: true });
|
|
34042
34064
|
const tempPath = `${resolvedPath}.tmp.${Date.now()}.${Math.random().toString(36).slice(2)}`;
|
|
34043
34065
|
await Bun.write(tempPath, content);
|
|
34044
|
-
|
|
34066
|
+
renameSync3(tempPath, resolvedPath);
|
|
34045
34067
|
} catch (error93) {
|
|
34046
34068
|
if (process.env.DEBUG_SWARM) {
|
|
34047
34069
|
console.warn("[snapshot-writer] write failed:", error93 instanceof Error ? error93.message : String(error93));
|
|
@@ -34065,7 +34087,7 @@ async function handleHandoffCommand(directory, _args) {
|
|
|
34065
34087
|
const resolvedPath = validateSwarmPath(directory, "handoff.md");
|
|
34066
34088
|
const tempPath = `${resolvedPath}.tmp.${crypto3.randomUUID()}`;
|
|
34067
34089
|
await Bun.write(tempPath, markdown);
|
|
34068
|
-
|
|
34090
|
+
renameSync4(tempPath, resolvedPath);
|
|
34069
34091
|
await writeSnapshot(directory, swarmState);
|
|
34070
34092
|
await flushPendingSnapshot(directory);
|
|
34071
34093
|
return `## Handoff Brief Written
|
|
@@ -34664,15 +34686,15 @@ async function handlePlanCommand(directory, args) {
|
|
|
34664
34686
|
// src/services/preflight-service.ts
|
|
34665
34687
|
init_manager();
|
|
34666
34688
|
init_manager2();
|
|
34667
|
-
import * as
|
|
34689
|
+
import * as fs9 from "fs";
|
|
34668
34690
|
import * as path20 from "path";
|
|
34669
34691
|
|
|
34670
34692
|
// src/tools/lint.ts
|
|
34671
|
-
import * as
|
|
34693
|
+
import * as fs6 from "fs";
|
|
34672
34694
|
import * as path17 from "path";
|
|
34673
34695
|
|
|
34674
34696
|
// src/build/discovery.ts
|
|
34675
|
-
import * as
|
|
34697
|
+
import * as fs5 from "fs";
|
|
34676
34698
|
import * as path16 from "path";
|
|
34677
34699
|
|
|
34678
34700
|
// src/lang/detector.ts
|
|
@@ -35713,7 +35735,7 @@ function findBuildFiles(workingDir, patterns) {
|
|
|
35713
35735
|
if (pattern.includes("*")) {
|
|
35714
35736
|
const dir = workingDir;
|
|
35715
35737
|
try {
|
|
35716
|
-
const files =
|
|
35738
|
+
const files = fs5.readdirSync(dir);
|
|
35717
35739
|
const regex = simpleGlobToRegex(pattern);
|
|
35718
35740
|
const matches = files.filter((f) => regex.test(f));
|
|
35719
35741
|
if (matches.length > 0) {
|
|
@@ -35722,7 +35744,7 @@ function findBuildFiles(workingDir, patterns) {
|
|
|
35722
35744
|
} catch {}
|
|
35723
35745
|
} else {
|
|
35724
35746
|
const filePath = path16.join(workingDir, pattern);
|
|
35725
|
-
if (
|
|
35747
|
+
if (fs5.existsSync(filePath)) {
|
|
35726
35748
|
return filePath;
|
|
35727
35749
|
}
|
|
35728
35750
|
}
|
|
@@ -35731,11 +35753,11 @@ function findBuildFiles(workingDir, patterns) {
|
|
|
35731
35753
|
}
|
|
35732
35754
|
function getRepoDefinedScripts(workingDir, scripts) {
|
|
35733
35755
|
const packageJsonPath = path16.join(workingDir, "package.json");
|
|
35734
|
-
if (!
|
|
35756
|
+
if (!fs5.existsSync(packageJsonPath)) {
|
|
35735
35757
|
return [];
|
|
35736
35758
|
}
|
|
35737
35759
|
try {
|
|
35738
|
-
const content =
|
|
35760
|
+
const content = fs5.readFileSync(packageJsonPath, "utf-8");
|
|
35739
35761
|
const pkg = JSON.parse(content);
|
|
35740
35762
|
if (!pkg.scripts || typeof pkg.scripts !== "object") {
|
|
35741
35763
|
return [];
|
|
@@ -35772,7 +35794,7 @@ function findAllBuildFiles(workingDir) {
|
|
|
35772
35794
|
findFilesRecursive(workingDir, regex, allBuildFiles);
|
|
35773
35795
|
} else {
|
|
35774
35796
|
const filePath = path16.join(workingDir, pattern);
|
|
35775
|
-
if (
|
|
35797
|
+
if (fs5.existsSync(filePath)) {
|
|
35776
35798
|
allBuildFiles.add(filePath);
|
|
35777
35799
|
}
|
|
35778
35800
|
}
|
|
@@ -35782,7 +35804,7 @@ function findAllBuildFiles(workingDir) {
|
|
|
35782
35804
|
}
|
|
35783
35805
|
function findFilesRecursive(dir, regex, results) {
|
|
35784
35806
|
try {
|
|
35785
|
-
const entries =
|
|
35807
|
+
const entries = fs5.readdirSync(dir, { withFileTypes: true });
|
|
35786
35808
|
for (const entry of entries) {
|
|
35787
35809
|
const fullPath = path16.join(dir, entry.name);
|
|
35788
35810
|
if (entry.isDirectory() && !["node_modules", ".git", "dist", "build", "target"].includes(entry.name)) {
|
|
@@ -35808,7 +35830,7 @@ async function discoverBuildCommandsFromProfiles(workingDir) {
|
|
|
35808
35830
|
for (const cmd of sortedCommands) {
|
|
35809
35831
|
if (cmd.detectFile) {
|
|
35810
35832
|
const detectFilePath = path16.join(workingDir, cmd.detectFile);
|
|
35811
|
-
if (!
|
|
35833
|
+
if (!fs5.existsSync(detectFilePath)) {
|
|
35812
35834
|
continue;
|
|
35813
35835
|
}
|
|
35814
35836
|
}
|
|
@@ -35941,7 +35963,7 @@ function getLinterCommand(linter, mode, projectDir) {
|
|
|
35941
35963
|
}
|
|
35942
35964
|
function getAdditionalLinterCommand(linter, mode, cwd) {
|
|
35943
35965
|
const gradlewName = process.platform === "win32" ? "gradlew.bat" : "gradlew";
|
|
35944
|
-
const gradlew =
|
|
35966
|
+
const gradlew = fs6.existsSync(path17.join(cwd, gradlewName)) ? path17.join(cwd, gradlewName) : null;
|
|
35945
35967
|
switch (linter) {
|
|
35946
35968
|
case "ruff":
|
|
35947
35969
|
return mode === "fix" ? ["ruff", "check", "--fix", "."] : ["ruff", "check", "."];
|
|
@@ -35975,12 +35997,12 @@ function getAdditionalLinterCommand(linter, mode, cwd) {
|
|
|
35975
35997
|
}
|
|
35976
35998
|
}
|
|
35977
35999
|
function detectRuff(cwd) {
|
|
35978
|
-
if (
|
|
36000
|
+
if (fs6.existsSync(path17.join(cwd, "ruff.toml")))
|
|
35979
36001
|
return isCommandAvailable("ruff");
|
|
35980
36002
|
try {
|
|
35981
36003
|
const pyproject = path17.join(cwd, "pyproject.toml");
|
|
35982
|
-
if (
|
|
35983
|
-
const content =
|
|
36004
|
+
if (fs6.existsSync(pyproject)) {
|
|
36005
|
+
const content = fs6.readFileSync(pyproject, "utf-8");
|
|
35984
36006
|
if (content.includes("[tool.ruff]"))
|
|
35985
36007
|
return isCommandAvailable("ruff");
|
|
35986
36008
|
}
|
|
@@ -35988,21 +36010,21 @@ function detectRuff(cwd) {
|
|
|
35988
36010
|
return false;
|
|
35989
36011
|
}
|
|
35990
36012
|
function detectClippy(cwd) {
|
|
35991
|
-
return
|
|
36013
|
+
return fs6.existsSync(path17.join(cwd, "Cargo.toml")) && isCommandAvailable("cargo");
|
|
35992
36014
|
}
|
|
35993
36015
|
function detectGolangciLint(cwd) {
|
|
35994
|
-
return
|
|
36016
|
+
return fs6.existsSync(path17.join(cwd, "go.mod")) && isCommandAvailable("golangci-lint");
|
|
35995
36017
|
}
|
|
35996
36018
|
function detectCheckstyle(cwd) {
|
|
35997
|
-
const hasMaven =
|
|
35998
|
-
const hasGradle =
|
|
35999
|
-
const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (
|
|
36019
|
+
const hasMaven = fs6.existsSync(path17.join(cwd, "pom.xml"));
|
|
36020
|
+
const hasGradle = fs6.existsSync(path17.join(cwd, "build.gradle")) || fs6.existsSync(path17.join(cwd, "build.gradle.kts"));
|
|
36021
|
+
const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (fs6.existsSync(path17.join(cwd, "gradlew")) || isCommandAvailable("gradle"));
|
|
36000
36022
|
return (hasMaven || hasGradle) && hasBinary;
|
|
36001
36023
|
}
|
|
36002
36024
|
function detectKtlint(cwd) {
|
|
36003
|
-
const hasKotlin =
|
|
36025
|
+
const hasKotlin = fs6.existsSync(path17.join(cwd, "build.gradle.kts")) || fs6.existsSync(path17.join(cwd, "build.gradle")) || (() => {
|
|
36004
36026
|
try {
|
|
36005
|
-
return
|
|
36027
|
+
return fs6.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
|
|
36006
36028
|
} catch {
|
|
36007
36029
|
return false;
|
|
36008
36030
|
}
|
|
@@ -36011,7 +36033,7 @@ function detectKtlint(cwd) {
|
|
|
36011
36033
|
}
|
|
36012
36034
|
function detectDotnetFormat(cwd) {
|
|
36013
36035
|
try {
|
|
36014
|
-
const files =
|
|
36036
|
+
const files = fs6.readdirSync(cwd);
|
|
36015
36037
|
const hasCsproj = files.some((f) => f.endsWith(".csproj") || f.endsWith(".sln"));
|
|
36016
36038
|
return hasCsproj && isCommandAvailable("dotnet");
|
|
36017
36039
|
} catch {
|
|
@@ -36019,14 +36041,14 @@ function detectDotnetFormat(cwd) {
|
|
|
36019
36041
|
}
|
|
36020
36042
|
}
|
|
36021
36043
|
function detectCppcheck(cwd) {
|
|
36022
|
-
if (
|
|
36044
|
+
if (fs6.existsSync(path17.join(cwd, "CMakeLists.txt"))) {
|
|
36023
36045
|
return isCommandAvailable("cppcheck");
|
|
36024
36046
|
}
|
|
36025
36047
|
try {
|
|
36026
36048
|
const dirsToCheck = [cwd, path17.join(cwd, "src")];
|
|
36027
36049
|
const hasCpp = dirsToCheck.some((dir) => {
|
|
36028
36050
|
try {
|
|
36029
|
-
return
|
|
36051
|
+
return fs6.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
|
|
36030
36052
|
} catch {
|
|
36031
36053
|
return false;
|
|
36032
36054
|
}
|
|
@@ -36037,13 +36059,13 @@ function detectCppcheck(cwd) {
|
|
|
36037
36059
|
}
|
|
36038
36060
|
}
|
|
36039
36061
|
function detectSwiftlint(cwd) {
|
|
36040
|
-
return
|
|
36062
|
+
return fs6.existsSync(path17.join(cwd, "Package.swift")) && isCommandAvailable("swiftlint");
|
|
36041
36063
|
}
|
|
36042
36064
|
function detectDartAnalyze(cwd) {
|
|
36043
|
-
return
|
|
36065
|
+
return fs6.existsSync(path17.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
|
|
36044
36066
|
}
|
|
36045
36067
|
function detectRubocop(cwd) {
|
|
36046
|
-
return (
|
|
36068
|
+
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
36069
|
}
|
|
36048
36070
|
function detectAdditionalLinter(cwd) {
|
|
36049
36071
|
if (detectRuff(cwd))
|
|
@@ -36088,7 +36110,7 @@ async function _detectAvailableLinter(_projectDir, biomeBin, eslintBin) {
|
|
|
36088
36110
|
const result = await Promise.race([biomeExit, timeout]);
|
|
36089
36111
|
if (result === "timeout") {
|
|
36090
36112
|
biomeProc.kill();
|
|
36091
|
-
} else if (biomeProc.exitCode === 0 &&
|
|
36113
|
+
} else if (biomeProc.exitCode === 0 && fs6.existsSync(biomeBin)) {
|
|
36092
36114
|
return "biome";
|
|
36093
36115
|
}
|
|
36094
36116
|
} catch {}
|
|
@@ -36102,7 +36124,7 @@ async function _detectAvailableLinter(_projectDir, biomeBin, eslintBin) {
|
|
|
36102
36124
|
const result = await Promise.race([eslintExit, timeout]);
|
|
36103
36125
|
if (result === "timeout") {
|
|
36104
36126
|
eslintProc.kill();
|
|
36105
|
-
} else if (eslintProc.exitCode === 0 &&
|
|
36127
|
+
} else if (eslintProc.exitCode === 0 && fs6.existsSync(eslintBin)) {
|
|
36106
36128
|
return "eslint";
|
|
36107
36129
|
}
|
|
36108
36130
|
} catch {}
|
|
@@ -36272,7 +36294,7 @@ For Rust: rustup component add clippy`
|
|
|
36272
36294
|
});
|
|
36273
36295
|
|
|
36274
36296
|
// src/tools/secretscan.ts
|
|
36275
|
-
import * as
|
|
36297
|
+
import * as fs7 from "fs";
|
|
36276
36298
|
import * as path18 from "path";
|
|
36277
36299
|
var MAX_FILE_PATH_LENGTH = 500;
|
|
36278
36300
|
var MAX_FILE_SIZE_BYTES = 512 * 1024;
|
|
@@ -36515,9 +36537,9 @@ function isGlobOrPathPattern(pattern) {
|
|
|
36515
36537
|
function loadSecretScanIgnore(scanDir) {
|
|
36516
36538
|
const ignorePath = path18.join(scanDir, ".secretscanignore");
|
|
36517
36539
|
try {
|
|
36518
|
-
if (!
|
|
36540
|
+
if (!fs7.existsSync(ignorePath))
|
|
36519
36541
|
return [];
|
|
36520
|
-
const content =
|
|
36542
|
+
const content = fs7.readFileSync(ignorePath, "utf8");
|
|
36521
36543
|
const patterns = [];
|
|
36522
36544
|
for (const rawLine of content.split(/\r?\n/)) {
|
|
36523
36545
|
const line = rawLine.trim();
|
|
@@ -36635,11 +36657,11 @@ function createRedactedContext(line, findings) {
|
|
|
36635
36657
|
result += line.slice(lastEnd);
|
|
36636
36658
|
return result;
|
|
36637
36659
|
}
|
|
36638
|
-
var O_NOFOLLOW = process.platform !== "win32" ?
|
|
36660
|
+
var O_NOFOLLOW = process.platform !== "win32" ? fs7.constants.O_NOFOLLOW : undefined;
|
|
36639
36661
|
function scanFileForSecrets(filePath) {
|
|
36640
36662
|
const findings = [];
|
|
36641
36663
|
try {
|
|
36642
|
-
const lstat =
|
|
36664
|
+
const lstat = fs7.lstatSync(filePath);
|
|
36643
36665
|
if (lstat.isSymbolicLink()) {
|
|
36644
36666
|
return findings;
|
|
36645
36667
|
}
|
|
@@ -36648,14 +36670,14 @@ function scanFileForSecrets(filePath) {
|
|
|
36648
36670
|
}
|
|
36649
36671
|
let buffer;
|
|
36650
36672
|
if (O_NOFOLLOW !== undefined) {
|
|
36651
|
-
const fd =
|
|
36673
|
+
const fd = fs7.openSync(filePath, "r", O_NOFOLLOW);
|
|
36652
36674
|
try {
|
|
36653
|
-
buffer =
|
|
36675
|
+
buffer = fs7.readFileSync(fd);
|
|
36654
36676
|
} finally {
|
|
36655
|
-
|
|
36677
|
+
fs7.closeSync(fd);
|
|
36656
36678
|
}
|
|
36657
36679
|
} else {
|
|
36658
|
-
buffer =
|
|
36680
|
+
buffer = fs7.readFileSync(filePath);
|
|
36659
36681
|
}
|
|
36660
36682
|
if (isBinaryFile(filePath, buffer)) {
|
|
36661
36683
|
return findings;
|
|
@@ -36710,7 +36732,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
36710
36732
|
const files = [];
|
|
36711
36733
|
let entries;
|
|
36712
36734
|
try {
|
|
36713
|
-
entries =
|
|
36735
|
+
entries = fs7.readdirSync(dir);
|
|
36714
36736
|
} catch {
|
|
36715
36737
|
stats.fileErrors++;
|
|
36716
36738
|
return files;
|
|
@@ -36733,7 +36755,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
36733
36755
|
}
|
|
36734
36756
|
let lstat;
|
|
36735
36757
|
try {
|
|
36736
|
-
lstat =
|
|
36758
|
+
lstat = fs7.lstatSync(fullPath);
|
|
36737
36759
|
} catch {
|
|
36738
36760
|
stats.fileErrors++;
|
|
36739
36761
|
continue;
|
|
@@ -36745,7 +36767,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
36745
36767
|
if (lstat.isDirectory()) {
|
|
36746
36768
|
let realPath;
|
|
36747
36769
|
try {
|
|
36748
|
-
realPath =
|
|
36770
|
+
realPath = fs7.realpathSync(fullPath);
|
|
36749
36771
|
} catch {
|
|
36750
36772
|
stats.fileErrors++;
|
|
36751
36773
|
continue;
|
|
@@ -36828,7 +36850,7 @@ var secretscan = createSwarmTool({
|
|
|
36828
36850
|
}
|
|
36829
36851
|
try {
|
|
36830
36852
|
const scanDir = path18.resolve(directory);
|
|
36831
|
-
if (!
|
|
36853
|
+
if (!fs7.existsSync(scanDir)) {
|
|
36832
36854
|
const errorResult = {
|
|
36833
36855
|
error: "directory not found",
|
|
36834
36856
|
scan_dir: directory,
|
|
@@ -36839,7 +36861,7 @@ var secretscan = createSwarmTool({
|
|
|
36839
36861
|
};
|
|
36840
36862
|
return JSON.stringify(errorResult, null, 2);
|
|
36841
36863
|
}
|
|
36842
|
-
const dirStat =
|
|
36864
|
+
const dirStat = fs7.statSync(scanDir);
|
|
36843
36865
|
if (!dirStat.isDirectory()) {
|
|
36844
36866
|
const errorResult = {
|
|
36845
36867
|
error: "target must be a directory, not a file",
|
|
@@ -36890,7 +36912,7 @@ var secretscan = createSwarmTool({
|
|
|
36890
36912
|
break;
|
|
36891
36913
|
const fileFindings = scanFileForSecrets(filePath);
|
|
36892
36914
|
try {
|
|
36893
|
-
const stat2 =
|
|
36915
|
+
const stat2 = fs7.statSync(filePath);
|
|
36894
36916
|
if (stat2.size > MAX_FILE_SIZE_BYTES) {
|
|
36895
36917
|
skippedFiles++;
|
|
36896
36918
|
continue;
|
|
@@ -36977,7 +36999,7 @@ async function runSecretscan(directory) {
|
|
|
36977
36999
|
}
|
|
36978
37000
|
|
|
36979
37001
|
// src/tools/test-runner.ts
|
|
36980
|
-
import * as
|
|
37002
|
+
import * as fs8 from "fs";
|
|
36981
37003
|
import * as path19 from "path";
|
|
36982
37004
|
var MAX_OUTPUT_BYTES3 = 512000;
|
|
36983
37005
|
var MAX_COMMAND_LENGTH2 = 500;
|
|
@@ -37077,19 +37099,19 @@ function hasDevDependency(devDeps, ...patterns) {
|
|
|
37077
37099
|
return hasPackageJsonDependency(devDeps, ...patterns);
|
|
37078
37100
|
}
|
|
37079
37101
|
function detectGoTest(cwd) {
|
|
37080
|
-
return
|
|
37102
|
+
return fs8.existsSync(path19.join(cwd, "go.mod")) && isCommandAvailable("go");
|
|
37081
37103
|
}
|
|
37082
37104
|
function detectJavaMaven(cwd) {
|
|
37083
|
-
return
|
|
37105
|
+
return fs8.existsSync(path19.join(cwd, "pom.xml")) && isCommandAvailable("mvn");
|
|
37084
37106
|
}
|
|
37085
37107
|
function detectGradle(cwd) {
|
|
37086
|
-
const hasBuildFile =
|
|
37087
|
-
const hasGradlew =
|
|
37108
|
+
const hasBuildFile = fs8.existsSync(path19.join(cwd, "build.gradle")) || fs8.existsSync(path19.join(cwd, "build.gradle.kts"));
|
|
37109
|
+
const hasGradlew = fs8.existsSync(path19.join(cwd, "gradlew")) || fs8.existsSync(path19.join(cwd, "gradlew.bat"));
|
|
37088
37110
|
return hasBuildFile && (hasGradlew || isCommandAvailable("gradle"));
|
|
37089
37111
|
}
|
|
37090
37112
|
function detectDotnetTest(cwd) {
|
|
37091
37113
|
try {
|
|
37092
|
-
const files =
|
|
37114
|
+
const files = fs8.readdirSync(cwd);
|
|
37093
37115
|
const hasCsproj = files.some((f) => f.endsWith(".csproj"));
|
|
37094
37116
|
return hasCsproj && isCommandAvailable("dotnet");
|
|
37095
37117
|
} catch {
|
|
@@ -37097,32 +37119,32 @@ function detectDotnetTest(cwd) {
|
|
|
37097
37119
|
}
|
|
37098
37120
|
}
|
|
37099
37121
|
function detectCTest(cwd) {
|
|
37100
|
-
const hasSource =
|
|
37101
|
-
const hasBuildCache =
|
|
37122
|
+
const hasSource = fs8.existsSync(path19.join(cwd, "CMakeLists.txt"));
|
|
37123
|
+
const hasBuildCache = fs8.existsSync(path19.join(cwd, "CMakeCache.txt")) || fs8.existsSync(path19.join(cwd, "build", "CMakeCache.txt"));
|
|
37102
37124
|
return (hasSource || hasBuildCache) && isCommandAvailable("ctest");
|
|
37103
37125
|
}
|
|
37104
37126
|
function detectSwiftTest(cwd) {
|
|
37105
|
-
return
|
|
37127
|
+
return fs8.existsSync(path19.join(cwd, "Package.swift")) && isCommandAvailable("swift");
|
|
37106
37128
|
}
|
|
37107
37129
|
function detectDartTest(cwd) {
|
|
37108
|
-
return
|
|
37130
|
+
return fs8.existsSync(path19.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
|
|
37109
37131
|
}
|
|
37110
37132
|
function detectRSpec(cwd) {
|
|
37111
|
-
const hasRSpecFile =
|
|
37112
|
-
const hasGemfile =
|
|
37113
|
-
const hasSpecDir =
|
|
37133
|
+
const hasRSpecFile = fs8.existsSync(path19.join(cwd, ".rspec"));
|
|
37134
|
+
const hasGemfile = fs8.existsSync(path19.join(cwd, "Gemfile"));
|
|
37135
|
+
const hasSpecDir = fs8.existsSync(path19.join(cwd, "spec"));
|
|
37114
37136
|
const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
|
|
37115
37137
|
return hasRSpec && (isCommandAvailable("bundle") || isCommandAvailable("rspec"));
|
|
37116
37138
|
}
|
|
37117
37139
|
function detectMinitest(cwd) {
|
|
37118
|
-
return
|
|
37140
|
+
return fs8.existsSync(path19.join(cwd, "test")) && (fs8.existsSync(path19.join(cwd, "Gemfile")) || fs8.existsSync(path19.join(cwd, "Rakefile"))) && isCommandAvailable("ruby");
|
|
37119
37141
|
}
|
|
37120
37142
|
async function detectTestFramework(cwd) {
|
|
37121
37143
|
const baseDir = cwd;
|
|
37122
37144
|
try {
|
|
37123
37145
|
const packageJsonPath = path19.join(baseDir, "package.json");
|
|
37124
|
-
if (
|
|
37125
|
-
const content =
|
|
37146
|
+
if (fs8.existsSync(packageJsonPath)) {
|
|
37147
|
+
const content = fs8.readFileSync(packageJsonPath, "utf-8");
|
|
37126
37148
|
const pkg = JSON.parse(content);
|
|
37127
37149
|
const _deps = pkg.dependencies || {};
|
|
37128
37150
|
const devDeps = pkg.devDependencies || {};
|
|
@@ -37141,7 +37163,7 @@ async function detectTestFramework(cwd) {
|
|
|
37141
37163
|
return "jest";
|
|
37142
37164
|
if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
|
|
37143
37165
|
return "mocha";
|
|
37144
|
-
if (
|
|
37166
|
+
if (fs8.existsSync(path19.join(baseDir, "bun.lockb")) || fs8.existsSync(path19.join(baseDir, "bun.lock"))) {
|
|
37145
37167
|
if (scripts.test?.includes("bun"))
|
|
37146
37168
|
return "bun";
|
|
37147
37169
|
}
|
|
@@ -37151,28 +37173,28 @@ async function detectTestFramework(cwd) {
|
|
|
37151
37173
|
const pyprojectTomlPath = path19.join(baseDir, "pyproject.toml");
|
|
37152
37174
|
const setupCfgPath = path19.join(baseDir, "setup.cfg");
|
|
37153
37175
|
const requirementsTxtPath = path19.join(baseDir, "requirements.txt");
|
|
37154
|
-
if (
|
|
37155
|
-
const content =
|
|
37176
|
+
if (fs8.existsSync(pyprojectTomlPath)) {
|
|
37177
|
+
const content = fs8.readFileSync(pyprojectTomlPath, "utf-8");
|
|
37156
37178
|
if (content.includes("[tool.pytest"))
|
|
37157
37179
|
return "pytest";
|
|
37158
37180
|
if (content.includes("pytest"))
|
|
37159
37181
|
return "pytest";
|
|
37160
37182
|
}
|
|
37161
|
-
if (
|
|
37162
|
-
const content =
|
|
37183
|
+
if (fs8.existsSync(setupCfgPath)) {
|
|
37184
|
+
const content = fs8.readFileSync(setupCfgPath, "utf-8");
|
|
37163
37185
|
if (content.includes("[pytest]"))
|
|
37164
37186
|
return "pytest";
|
|
37165
37187
|
}
|
|
37166
|
-
if (
|
|
37167
|
-
const content =
|
|
37188
|
+
if (fs8.existsSync(requirementsTxtPath)) {
|
|
37189
|
+
const content = fs8.readFileSync(requirementsTxtPath, "utf-8");
|
|
37168
37190
|
if (content.includes("pytest"))
|
|
37169
37191
|
return "pytest";
|
|
37170
37192
|
}
|
|
37171
37193
|
} catch {}
|
|
37172
37194
|
try {
|
|
37173
37195
|
const cargoTomlPath = path19.join(baseDir, "Cargo.toml");
|
|
37174
|
-
if (
|
|
37175
|
-
const content =
|
|
37196
|
+
if (fs8.existsSync(cargoTomlPath)) {
|
|
37197
|
+
const content = fs8.readFileSync(cargoTomlPath, "utf-8");
|
|
37176
37198
|
if (content.includes("[dev-dependencies]")) {
|
|
37177
37199
|
if (content.includes("tokio") || content.includes("mockall") || content.includes("pretty_assertions")) {
|
|
37178
37200
|
return "cargo";
|
|
@@ -37184,7 +37206,7 @@ async function detectTestFramework(cwd) {
|
|
|
37184
37206
|
const pesterConfigPath = path19.join(baseDir, "pester.config.ps1");
|
|
37185
37207
|
const pesterConfigJsonPath = path19.join(baseDir, "pester.config.ps1.json");
|
|
37186
37208
|
const pesterPs1Path = path19.join(baseDir, "tests.ps1");
|
|
37187
|
-
if (
|
|
37209
|
+
if (fs8.existsSync(pesterConfigPath) || fs8.existsSync(pesterConfigJsonPath) || fs8.existsSync(pesterPs1Path)) {
|
|
37188
37210
|
return "pester";
|
|
37189
37211
|
}
|
|
37190
37212
|
} catch {}
|
|
@@ -37254,7 +37276,7 @@ function getTestFilesFromConvention(sourceFiles) {
|
|
|
37254
37276
|
path19.join(dirname9, "test", `${nameWithoutExt}${ext}`)
|
|
37255
37277
|
];
|
|
37256
37278
|
for (const testFile of possibleTestFiles) {
|
|
37257
|
-
if (
|
|
37279
|
+
if (fs8.existsSync(testFile) && !testFiles.includes(testFile)) {
|
|
37258
37280
|
testFiles.push(testFile);
|
|
37259
37281
|
}
|
|
37260
37282
|
}
|
|
@@ -37270,7 +37292,7 @@ async function getTestFilesFromGraph(sourceFiles) {
|
|
|
37270
37292
|
}
|
|
37271
37293
|
for (const testFile of candidateTestFiles) {
|
|
37272
37294
|
try {
|
|
37273
|
-
const content =
|
|
37295
|
+
const content = fs8.readFileSync(testFile, "utf-8");
|
|
37274
37296
|
const testDir = path19.dirname(testFile);
|
|
37275
37297
|
const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
|
|
37276
37298
|
let match;
|
|
@@ -37291,7 +37313,7 @@ async function getTestFilesFromGraph(sourceFiles) {
|
|
|
37291
37313
|
".cjs"
|
|
37292
37314
|
]) {
|
|
37293
37315
|
const withExt = resolvedImport + extToTry;
|
|
37294
|
-
if (sourceFiles.includes(withExt) ||
|
|
37316
|
+
if (sourceFiles.includes(withExt) || fs8.existsSync(withExt)) {
|
|
37295
37317
|
resolvedImport = withExt;
|
|
37296
37318
|
break;
|
|
37297
37319
|
}
|
|
@@ -37332,7 +37354,7 @@ async function getTestFilesFromGraph(sourceFiles) {
|
|
|
37332
37354
|
".cjs"
|
|
37333
37355
|
]) {
|
|
37334
37356
|
const withExt = resolvedImport + extToTry;
|
|
37335
|
-
if (sourceFiles.includes(withExt) ||
|
|
37357
|
+
if (sourceFiles.includes(withExt) || fs8.existsSync(withExt)) {
|
|
37336
37358
|
resolvedImport = withExt;
|
|
37337
37359
|
break;
|
|
37338
37360
|
}
|
|
@@ -37428,8 +37450,8 @@ function buildTestCommand(framework, scope, files, coverage, baseDir) {
|
|
|
37428
37450
|
return ["mvn", "test"];
|
|
37429
37451
|
case "gradle": {
|
|
37430
37452
|
const isWindows = process.platform === "win32";
|
|
37431
|
-
const hasGradlewBat =
|
|
37432
|
-
const hasGradlew =
|
|
37453
|
+
const hasGradlewBat = fs8.existsSync(path19.join(baseDir, "gradlew.bat"));
|
|
37454
|
+
const hasGradlew = fs8.existsSync(path19.join(baseDir, "gradlew"));
|
|
37433
37455
|
if (hasGradlewBat && isWindows)
|
|
37434
37456
|
return ["gradlew.bat", "test"];
|
|
37435
37457
|
if (hasGradlew)
|
|
@@ -37446,7 +37468,7 @@ function buildTestCommand(framework, scope, files, coverage, baseDir) {
|
|
|
37446
37468
|
"cmake-build-release",
|
|
37447
37469
|
"out"
|
|
37448
37470
|
];
|
|
37449
|
-
const actualBuildDir = buildDirCandidates.find((d) =>
|
|
37471
|
+
const actualBuildDir = buildDirCandidates.find((d) => fs8.existsSync(path19.join(baseDir, d, "CMakeCache.txt"))) ?? "build";
|
|
37450
37472
|
return ["ctest", "--test-dir", actualBuildDir];
|
|
37451
37473
|
}
|
|
37452
37474
|
case "swift-test":
|
|
@@ -38057,8 +38079,8 @@ function validateTimeout(timeoutMs, defaultValue) {
|
|
|
38057
38079
|
function getPackageVersion(dir) {
|
|
38058
38080
|
try {
|
|
38059
38081
|
const packagePath = path20.join(dir, "package.json");
|
|
38060
|
-
if (
|
|
38061
|
-
const content =
|
|
38082
|
+
if (fs9.existsSync(packagePath)) {
|
|
38083
|
+
const content = fs9.readFileSync(packagePath, "utf-8");
|
|
38062
38084
|
const pkg = JSON.parse(content);
|
|
38063
38085
|
return pkg.version ?? null;
|
|
38064
38086
|
}
|
|
@@ -38068,8 +38090,8 @@ function getPackageVersion(dir) {
|
|
|
38068
38090
|
function getChangelogVersion(dir) {
|
|
38069
38091
|
try {
|
|
38070
38092
|
const changelogPath = path20.join(dir, "CHANGELOG.md");
|
|
38071
|
-
if (
|
|
38072
|
-
const content =
|
|
38093
|
+
if (fs9.existsSync(changelogPath)) {
|
|
38094
|
+
const content = fs9.readFileSync(changelogPath, "utf-8");
|
|
38073
38095
|
const match = content.match(/^##\s*\[?(\d+\.\d+\.\d+)\]?/m);
|
|
38074
38096
|
if (match) {
|
|
38075
38097
|
return match[1];
|
|
@@ -38082,9 +38104,9 @@ function getVersionFileVersion(dir) {
|
|
|
38082
38104
|
const possibleFiles = ["VERSION.txt", "version.txt", "VERSION", "version"];
|
|
38083
38105
|
for (const file3 of possibleFiles) {
|
|
38084
38106
|
const filePath = path20.join(dir, file3);
|
|
38085
|
-
if (
|
|
38107
|
+
if (fs9.existsSync(filePath)) {
|
|
38086
38108
|
try {
|
|
38087
|
-
const content =
|
|
38109
|
+
const content = fs9.readFileSync(filePath, "utf-8").trim();
|
|
38088
38110
|
const match = content.match(/(\d+\.\d+\.\d+)/);
|
|
38089
38111
|
if (match) {
|
|
38090
38112
|
return match[1];
|
|
@@ -38627,7 +38649,7 @@ async function handlePromoteCommand(directory, args) {
|
|
|
38627
38649
|
}
|
|
38628
38650
|
|
|
38629
38651
|
// src/commands/reset.ts
|
|
38630
|
-
import * as
|
|
38652
|
+
import * as fs10 from "fs";
|
|
38631
38653
|
|
|
38632
38654
|
// src/background/manager.ts
|
|
38633
38655
|
init_utils();
|
|
@@ -39326,8 +39348,8 @@ async function handleResetCommand(directory, args) {
|
|
|
39326
39348
|
for (const filename of filesToReset) {
|
|
39327
39349
|
try {
|
|
39328
39350
|
const resolvedPath = validateSwarmPath(directory, filename);
|
|
39329
|
-
if (
|
|
39330
|
-
|
|
39351
|
+
if (fs10.existsSync(resolvedPath)) {
|
|
39352
|
+
fs10.unlinkSync(resolvedPath);
|
|
39331
39353
|
results.push(`- \u2705 Deleted ${filename}`);
|
|
39332
39354
|
} else {
|
|
39333
39355
|
results.push(`- \u23ED\uFE0F ${filename} not found (skipped)`);
|
|
@@ -39344,8 +39366,8 @@ async function handleResetCommand(directory, args) {
|
|
|
39344
39366
|
}
|
|
39345
39367
|
try {
|
|
39346
39368
|
const summariesPath = validateSwarmPath(directory, "summaries");
|
|
39347
|
-
if (
|
|
39348
|
-
|
|
39369
|
+
if (fs10.existsSync(summariesPath)) {
|
|
39370
|
+
fs10.rmSync(summariesPath, { recursive: true, force: true });
|
|
39349
39371
|
results.push("- \u2705 Deleted summaries/ directory");
|
|
39350
39372
|
} else {
|
|
39351
39373
|
results.push("- \u23ED\uFE0F summaries/ not found (skipped)");
|
|
@@ -39365,13 +39387,13 @@ async function handleResetCommand(directory, args) {
|
|
|
39365
39387
|
|
|
39366
39388
|
// src/commands/reset-session.ts
|
|
39367
39389
|
init_utils2();
|
|
39368
|
-
import * as
|
|
39390
|
+
import * as fs11 from "fs";
|
|
39369
39391
|
async function handleResetSessionCommand(directory, _args) {
|
|
39370
39392
|
const results = [];
|
|
39371
39393
|
try {
|
|
39372
39394
|
const statePath = validateSwarmPath(directory, "session/state.json");
|
|
39373
|
-
if (
|
|
39374
|
-
|
|
39395
|
+
if (fs11.existsSync(statePath)) {
|
|
39396
|
+
fs11.unlinkSync(statePath);
|
|
39375
39397
|
results.push("\u2705 Deleted .swarm/session/state.json");
|
|
39376
39398
|
} else {
|
|
39377
39399
|
results.push("\u23ED\uFE0F state.json not found (already clean)");
|
|
@@ -39474,18 +39496,18 @@ ${error93 instanceof Error ? error93.message : String(error93)}`;
|
|
|
39474
39496
|
|
|
39475
39497
|
// src/commands/rollback.ts
|
|
39476
39498
|
init_utils2();
|
|
39477
|
-
import * as
|
|
39499
|
+
import * as fs12 from "fs";
|
|
39478
39500
|
import * as path22 from "path";
|
|
39479
39501
|
async function handleRollbackCommand(directory, args) {
|
|
39480
39502
|
const phaseArg = args[0];
|
|
39481
39503
|
if (!phaseArg) {
|
|
39482
39504
|
const manifestPath2 = validateSwarmPath(directory, "checkpoints/manifest.json");
|
|
39483
|
-
if (!
|
|
39505
|
+
if (!fs12.existsSync(manifestPath2)) {
|
|
39484
39506
|
return "No checkpoints found. Use `/swarm checkpoint` to create checkpoints.";
|
|
39485
39507
|
}
|
|
39486
39508
|
let manifest2;
|
|
39487
39509
|
try {
|
|
39488
|
-
manifest2 = JSON.parse(
|
|
39510
|
+
manifest2 = JSON.parse(fs12.readFileSync(manifestPath2, "utf-8"));
|
|
39489
39511
|
} catch {
|
|
39490
39512
|
return "Error: Checkpoint manifest is corrupted. Delete .swarm/checkpoints/manifest.json and re-checkpoint.";
|
|
39491
39513
|
}
|
|
@@ -39507,12 +39529,12 @@ async function handleRollbackCommand(directory, args) {
|
|
|
39507
39529
|
return "Error: Phase number must be a positive integer.";
|
|
39508
39530
|
}
|
|
39509
39531
|
const manifestPath = validateSwarmPath(directory, "checkpoints/manifest.json");
|
|
39510
|
-
if (!
|
|
39532
|
+
if (!fs12.existsSync(manifestPath)) {
|
|
39511
39533
|
return `Error: No checkpoints found. Cannot rollback to phase ${targetPhase}.`;
|
|
39512
39534
|
}
|
|
39513
39535
|
let manifest;
|
|
39514
39536
|
try {
|
|
39515
|
-
manifest = JSON.parse(
|
|
39537
|
+
manifest = JSON.parse(fs12.readFileSync(manifestPath, "utf-8"));
|
|
39516
39538
|
} catch {
|
|
39517
39539
|
return `Error: Checkpoint manifest is corrupted. Delete .swarm/checkpoints/manifest.json and re-checkpoint.`;
|
|
39518
39540
|
}
|
|
@@ -39522,10 +39544,10 @@ async function handleRollbackCommand(directory, args) {
|
|
|
39522
39544
|
return `Error: Checkpoint for phase ${targetPhase} not found. Available phases: ${available}`;
|
|
39523
39545
|
}
|
|
39524
39546
|
const checkpointDir = validateSwarmPath(directory, `checkpoints/phase-${targetPhase}`);
|
|
39525
|
-
if (!
|
|
39547
|
+
if (!fs12.existsSync(checkpointDir)) {
|
|
39526
39548
|
return `Error: Checkpoint directory for phase ${targetPhase} does not exist.`;
|
|
39527
39549
|
}
|
|
39528
|
-
const checkpointFiles =
|
|
39550
|
+
const checkpointFiles = fs12.readdirSync(checkpointDir);
|
|
39529
39551
|
if (checkpointFiles.length === 0) {
|
|
39530
39552
|
return `Error: Checkpoint for phase ${targetPhase} is empty. Cannot rollback.`;
|
|
39531
39553
|
}
|
|
@@ -39536,7 +39558,7 @@ async function handleRollbackCommand(directory, args) {
|
|
|
39536
39558
|
const src = path22.join(checkpointDir, file3);
|
|
39537
39559
|
const dest = path22.join(swarmDir, file3);
|
|
39538
39560
|
try {
|
|
39539
|
-
|
|
39561
|
+
fs12.cpSync(src, dest, { recursive: true, force: true });
|
|
39540
39562
|
successes.push(file3);
|
|
39541
39563
|
} catch (error93) {
|
|
39542
39564
|
failures.push({ file: file3, error: error93.message });
|
|
@@ -39553,7 +39575,7 @@ async function handleRollbackCommand(directory, args) {
|
|
|
39553
39575
|
timestamp: new Date().toISOString()
|
|
39554
39576
|
};
|
|
39555
39577
|
try {
|
|
39556
|
-
|
|
39578
|
+
fs12.appendFileSync(eventsPath, `${JSON.stringify(rollbackEvent)}
|
|
39557
39579
|
`);
|
|
39558
39580
|
} catch (error93) {
|
|
39559
39581
|
console.error("Failed to write rollback event:", error93);
|
|
@@ -39596,11 +39618,11 @@ async function handleSimulateCommand(directory, args) {
|
|
|
39596
39618
|
];
|
|
39597
39619
|
const report = reportLines.filter(Boolean).join(`
|
|
39598
39620
|
`);
|
|
39599
|
-
const
|
|
39621
|
+
const fs13 = await import("fs/promises");
|
|
39600
39622
|
const path23 = await import("path");
|
|
39601
39623
|
const reportPath = path23.join(directory, ".swarm", "simulate-report.md");
|
|
39602
|
-
await
|
|
39603
|
-
await
|
|
39624
|
+
await fs13.mkdir(path23.dirname(reportPath), { recursive: true });
|
|
39625
|
+
await fs13.writeFile(reportPath, report, "utf-8");
|
|
39604
39626
|
return `${darkMatterPairs.length} hidden coupling pairs detected`;
|
|
39605
39627
|
}
|
|
39606
39628
|
|
|
@@ -40396,13 +40418,13 @@ var OPENCODE_CONFIG_PATH = path23.join(CONFIG_DIR, "opencode.json");
|
|
|
40396
40418
|
var PLUGIN_CONFIG_PATH = path23.join(CONFIG_DIR, "opencode-swarm.json");
|
|
40397
40419
|
var PROMPTS_DIR = path23.join(CONFIG_DIR, "opencode-swarm");
|
|
40398
40420
|
function ensureDir(dir) {
|
|
40399
|
-
if (!
|
|
40400
|
-
|
|
40421
|
+
if (!fs13.existsSync(dir)) {
|
|
40422
|
+
fs13.mkdirSync(dir, { recursive: true });
|
|
40401
40423
|
}
|
|
40402
40424
|
}
|
|
40403
40425
|
function loadJson(filepath) {
|
|
40404
40426
|
try {
|
|
40405
|
-
const content =
|
|
40427
|
+
const content = fs13.readFileSync(filepath, "utf-8");
|
|
40406
40428
|
const stripped = content.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (match, comment) => comment ? "" : match).replace(/,(\s*[}\]])/g, "$1");
|
|
40407
40429
|
return JSON.parse(stripped);
|
|
40408
40430
|
} catch {
|
|
@@ -40410,7 +40432,7 @@ function loadJson(filepath) {
|
|
|
40410
40432
|
}
|
|
40411
40433
|
}
|
|
40412
40434
|
function saveJson(filepath, data) {
|
|
40413
|
-
|
|
40435
|
+
fs13.writeFileSync(filepath, `${JSON.stringify(data, null, 2)}
|
|
40414
40436
|
`, "utf-8");
|
|
40415
40437
|
}
|
|
40416
40438
|
async function install() {
|
|
@@ -40443,7 +40465,7 @@ async function install() {
|
|
|
40443
40465
|
saveJson(OPENCODE_CONFIG_PATH, opencodeConfig);
|
|
40444
40466
|
console.log("\u2713 Added opencode-swarm to OpenCode plugins");
|
|
40445
40467
|
console.log("\u2713 Disabled default OpenCode agents (explore, general)");
|
|
40446
|
-
if (!
|
|
40468
|
+
if (!fs13.existsSync(PLUGIN_CONFIG_PATH)) {
|
|
40447
40469
|
const defaultConfig = {
|
|
40448
40470
|
agents: {
|
|
40449
40471
|
coder: { model: "opencode/minimax-m2.5-free" },
|
|
@@ -40486,7 +40508,7 @@ async function uninstall() {
|
|
|
40486
40508
|
`);
|
|
40487
40509
|
const opencodeConfig = loadJson(OPENCODE_CONFIG_PATH);
|
|
40488
40510
|
if (!opencodeConfig) {
|
|
40489
|
-
if (
|
|
40511
|
+
if (fs13.existsSync(OPENCODE_CONFIG_PATH)) {
|
|
40490
40512
|
console.log(`\u2717 Could not parse opencode config at: ${OPENCODE_CONFIG_PATH}`);
|
|
40491
40513
|
return 1;
|
|
40492
40514
|
} else {
|
|
@@ -40518,13 +40540,13 @@ async function uninstall() {
|
|
|
40518
40540
|
console.log("\u2713 Re-enabled default OpenCode agents (explore, general)");
|
|
40519
40541
|
if (process.argv.includes("--clean")) {
|
|
40520
40542
|
let cleaned = false;
|
|
40521
|
-
if (
|
|
40522
|
-
|
|
40543
|
+
if (fs13.existsSync(PLUGIN_CONFIG_PATH)) {
|
|
40544
|
+
fs13.unlinkSync(PLUGIN_CONFIG_PATH);
|
|
40523
40545
|
console.log(`\u2713 Removed plugin config: ${PLUGIN_CONFIG_PATH}`);
|
|
40524
40546
|
cleaned = true;
|
|
40525
40547
|
}
|
|
40526
|
-
if (
|
|
40527
|
-
|
|
40548
|
+
if (fs13.existsSync(PROMPTS_DIR)) {
|
|
40549
|
+
fs13.rmSync(PROMPTS_DIR, { recursive: true });
|
|
40528
40550
|
console.log(`\u2713 Removed custom prompts: ${PROMPTS_DIR}`);
|
|
40529
40551
|
cleaned = true;
|
|
40530
40552
|
}
|