xtrm-tools 0.5.9 → 0.5.11
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 +28 -30
- package/cli/dist/index.cjs +379 -441
- package/cli/dist/index.cjs.map +1 -1
- package/cli/package.json +1 -1
- package/config/instructions/agents-top.md +87 -23
- package/config/instructions/claude-top.md +101 -23
- package/config/pi/extensions/beads/index.ts +3 -1
- package/config/pi/extensions/session-flow/index.ts +26 -90
- package/config/pi/extensions/xtrm-loader/index.ts +39 -2
- package/hooks/README.md +0 -14
- package/hooks/beads-gate-messages.mjs +4 -18
- package/hooks/hooks.json +20 -16
- package/hooks/using-xtrm-reminder.mjs +35 -0
- package/package.json +1 -1
- package/skills/using-xtrm/SKILL.md +84 -205
- package/config/pi/extensions/bg-process/index.ts +0 -230
- package/config/pi/extensions/bg-process/package.json +0 -16
- package/config/pi/extensions/minimal-mode/index.ts +0 -201
- package/config/pi/extensions/minimal-mode/package.json +0 -16
- package/config/pi/extensions/todo/index.ts +0 -299
- package/config/pi/extensions/todo/package.json +0 -16
- package/hooks/agent_context.py +0 -105
- package/hooks/guard-rules.mjs +0 -118
- package/hooks/main-guard-post-push.mjs +0 -71
- package/hooks/main-guard.mjs +0 -119
package/cli/dist/index.cjs
CHANGED
|
@@ -1203,7 +1203,7 @@ var require_command = __commonJS({
|
|
|
1203
1203
|
var EventEmitter2 = require("events").EventEmitter;
|
|
1204
1204
|
var childProcess = require("child_process");
|
|
1205
1205
|
var path21 = require("path");
|
|
1206
|
-
var
|
|
1206
|
+
var fs21 = require("fs");
|
|
1207
1207
|
var process19 = require("process");
|
|
1208
1208
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1209
1209
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -2197,7 +2197,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2197
2197
|
* @param {string} subcommandName
|
|
2198
2198
|
*/
|
|
2199
2199
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
2200
|
-
if (
|
|
2200
|
+
if (fs21.existsSync(executableFile)) return;
|
|
2201
2201
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
2202
2202
|
const executableMissing = `'${executableFile}' does not exist
|
|
2203
2203
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -2216,10 +2216,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2216
2216
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2217
2217
|
function findFile(baseDir, baseName) {
|
|
2218
2218
|
const localBin = path21.resolve(baseDir, baseName);
|
|
2219
|
-
if (
|
|
2219
|
+
if (fs21.existsSync(localBin)) return localBin;
|
|
2220
2220
|
if (sourceExt.includes(path21.extname(baseName))) return void 0;
|
|
2221
2221
|
const foundExt = sourceExt.find(
|
|
2222
|
-
(ext) =>
|
|
2222
|
+
(ext) => fs21.existsSync(`${localBin}${ext}`)
|
|
2223
2223
|
);
|
|
2224
2224
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2225
2225
|
return void 0;
|
|
@@ -2231,7 +2231,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2231
2231
|
if (this._scriptPath) {
|
|
2232
2232
|
let resolvedScriptPath;
|
|
2233
2233
|
try {
|
|
2234
|
-
resolvedScriptPath =
|
|
2234
|
+
resolvedScriptPath = fs21.realpathSync(this._scriptPath);
|
|
2235
2235
|
} catch {
|
|
2236
2236
|
resolvedScriptPath = this._scriptPath;
|
|
2237
2237
|
}
|
|
@@ -11639,54 +11639,54 @@ var require_polyfills = __commonJS({
|
|
|
11639
11639
|
}
|
|
11640
11640
|
var chdir;
|
|
11641
11641
|
module2.exports = patch;
|
|
11642
|
-
function patch(
|
|
11642
|
+
function patch(fs21) {
|
|
11643
11643
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
11644
|
-
patchLchmod(
|
|
11645
|
-
}
|
|
11646
|
-
if (!
|
|
11647
|
-
patchLutimes(
|
|
11648
|
-
}
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
if (
|
|
11668
|
-
|
|
11644
|
+
patchLchmod(fs21);
|
|
11645
|
+
}
|
|
11646
|
+
if (!fs21.lutimes) {
|
|
11647
|
+
patchLutimes(fs21);
|
|
11648
|
+
}
|
|
11649
|
+
fs21.chown = chownFix(fs21.chown);
|
|
11650
|
+
fs21.fchown = chownFix(fs21.fchown);
|
|
11651
|
+
fs21.lchown = chownFix(fs21.lchown);
|
|
11652
|
+
fs21.chmod = chmodFix(fs21.chmod);
|
|
11653
|
+
fs21.fchmod = chmodFix(fs21.fchmod);
|
|
11654
|
+
fs21.lchmod = chmodFix(fs21.lchmod);
|
|
11655
|
+
fs21.chownSync = chownFixSync(fs21.chownSync);
|
|
11656
|
+
fs21.fchownSync = chownFixSync(fs21.fchownSync);
|
|
11657
|
+
fs21.lchownSync = chownFixSync(fs21.lchownSync);
|
|
11658
|
+
fs21.chmodSync = chmodFixSync(fs21.chmodSync);
|
|
11659
|
+
fs21.fchmodSync = chmodFixSync(fs21.fchmodSync);
|
|
11660
|
+
fs21.lchmodSync = chmodFixSync(fs21.lchmodSync);
|
|
11661
|
+
fs21.stat = statFix(fs21.stat);
|
|
11662
|
+
fs21.fstat = statFix(fs21.fstat);
|
|
11663
|
+
fs21.lstat = statFix(fs21.lstat);
|
|
11664
|
+
fs21.statSync = statFixSync(fs21.statSync);
|
|
11665
|
+
fs21.fstatSync = statFixSync(fs21.fstatSync);
|
|
11666
|
+
fs21.lstatSync = statFixSync(fs21.lstatSync);
|
|
11667
|
+
if (fs21.chmod && !fs21.lchmod) {
|
|
11668
|
+
fs21.lchmod = function(path21, mode, cb) {
|
|
11669
11669
|
if (cb) process.nextTick(cb);
|
|
11670
11670
|
};
|
|
11671
|
-
|
|
11671
|
+
fs21.lchmodSync = function() {
|
|
11672
11672
|
};
|
|
11673
11673
|
}
|
|
11674
|
-
if (
|
|
11675
|
-
|
|
11674
|
+
if (fs21.chown && !fs21.lchown) {
|
|
11675
|
+
fs21.lchown = function(path21, uid, gid, cb) {
|
|
11676
11676
|
if (cb) process.nextTick(cb);
|
|
11677
11677
|
};
|
|
11678
|
-
|
|
11678
|
+
fs21.lchownSync = function() {
|
|
11679
11679
|
};
|
|
11680
11680
|
}
|
|
11681
11681
|
if (platform2 === "win32") {
|
|
11682
|
-
|
|
11682
|
+
fs21.rename = typeof fs21.rename !== "function" ? fs21.rename : (function(fs$rename) {
|
|
11683
11683
|
function rename(from, to, cb) {
|
|
11684
11684
|
var start = Date.now();
|
|
11685
11685
|
var backoff = 0;
|
|
11686
11686
|
fs$rename(from, to, function CB(er) {
|
|
11687
11687
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
11688
11688
|
setTimeout(function() {
|
|
11689
|
-
|
|
11689
|
+
fs21.stat(to, function(stater, st) {
|
|
11690
11690
|
if (stater && stater.code === "ENOENT")
|
|
11691
11691
|
fs$rename(from, to, CB);
|
|
11692
11692
|
else
|
|
@@ -11702,9 +11702,9 @@ var require_polyfills = __commonJS({
|
|
|
11702
11702
|
}
|
|
11703
11703
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
11704
11704
|
return rename;
|
|
11705
|
-
})(
|
|
11705
|
+
})(fs21.rename);
|
|
11706
11706
|
}
|
|
11707
|
-
|
|
11707
|
+
fs21.read = typeof fs21.read !== "function" ? fs21.read : (function(fs$read) {
|
|
11708
11708
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
11709
11709
|
var callback;
|
|
11710
11710
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -11712,22 +11712,22 @@ var require_polyfills = __commonJS({
|
|
|
11712
11712
|
callback = function(er, _, __) {
|
|
11713
11713
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
11714
11714
|
eagCounter++;
|
|
11715
|
-
return fs$read.call(
|
|
11715
|
+
return fs$read.call(fs21, fd, buffer, offset, length, position, callback);
|
|
11716
11716
|
}
|
|
11717
11717
|
callback_.apply(this, arguments);
|
|
11718
11718
|
};
|
|
11719
11719
|
}
|
|
11720
|
-
return fs$read.call(
|
|
11720
|
+
return fs$read.call(fs21, fd, buffer, offset, length, position, callback);
|
|
11721
11721
|
}
|
|
11722
11722
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
11723
11723
|
return read;
|
|
11724
|
-
})(
|
|
11725
|
-
|
|
11724
|
+
})(fs21.read);
|
|
11725
|
+
fs21.readSync = typeof fs21.readSync !== "function" ? fs21.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
11726
11726
|
return function(fd, buffer, offset, length, position) {
|
|
11727
11727
|
var eagCounter = 0;
|
|
11728
11728
|
while (true) {
|
|
11729
11729
|
try {
|
|
11730
|
-
return fs$readSync.call(
|
|
11730
|
+
return fs$readSync.call(fs21, fd, buffer, offset, length, position);
|
|
11731
11731
|
} catch (er) {
|
|
11732
11732
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
11733
11733
|
eagCounter++;
|
|
@@ -11737,10 +11737,10 @@ var require_polyfills = __commonJS({
|
|
|
11737
11737
|
}
|
|
11738
11738
|
}
|
|
11739
11739
|
};
|
|
11740
|
-
})(
|
|
11741
|
-
function patchLchmod(
|
|
11742
|
-
|
|
11743
|
-
|
|
11740
|
+
})(fs21.readSync);
|
|
11741
|
+
function patchLchmod(fs22) {
|
|
11742
|
+
fs22.lchmod = function(path21, mode, callback) {
|
|
11743
|
+
fs22.open(
|
|
11744
11744
|
path21,
|
|
11745
11745
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
11746
11746
|
mode,
|
|
@@ -11749,80 +11749,80 @@ var require_polyfills = __commonJS({
|
|
|
11749
11749
|
if (callback) callback(err);
|
|
11750
11750
|
return;
|
|
11751
11751
|
}
|
|
11752
|
-
|
|
11753
|
-
|
|
11752
|
+
fs22.fchmod(fd, mode, function(err2) {
|
|
11753
|
+
fs22.close(fd, function(err22) {
|
|
11754
11754
|
if (callback) callback(err2 || err22);
|
|
11755
11755
|
});
|
|
11756
11756
|
});
|
|
11757
11757
|
}
|
|
11758
11758
|
);
|
|
11759
11759
|
};
|
|
11760
|
-
|
|
11761
|
-
var fd =
|
|
11760
|
+
fs22.lchmodSync = function(path21, mode) {
|
|
11761
|
+
var fd = fs22.openSync(path21, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
11762
11762
|
var threw = true;
|
|
11763
11763
|
var ret;
|
|
11764
11764
|
try {
|
|
11765
|
-
ret =
|
|
11765
|
+
ret = fs22.fchmodSync(fd, mode);
|
|
11766
11766
|
threw = false;
|
|
11767
11767
|
} finally {
|
|
11768
11768
|
if (threw) {
|
|
11769
11769
|
try {
|
|
11770
|
-
|
|
11770
|
+
fs22.closeSync(fd);
|
|
11771
11771
|
} catch (er) {
|
|
11772
11772
|
}
|
|
11773
11773
|
} else {
|
|
11774
|
-
|
|
11774
|
+
fs22.closeSync(fd);
|
|
11775
11775
|
}
|
|
11776
11776
|
}
|
|
11777
11777
|
return ret;
|
|
11778
11778
|
};
|
|
11779
11779
|
}
|
|
11780
|
-
function patchLutimes(
|
|
11781
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
11782
|
-
|
|
11783
|
-
|
|
11780
|
+
function patchLutimes(fs22) {
|
|
11781
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs22.futimes) {
|
|
11782
|
+
fs22.lutimes = function(path21, at, mt, cb) {
|
|
11783
|
+
fs22.open(path21, constants.O_SYMLINK, function(er, fd) {
|
|
11784
11784
|
if (er) {
|
|
11785
11785
|
if (cb) cb(er);
|
|
11786
11786
|
return;
|
|
11787
11787
|
}
|
|
11788
|
-
|
|
11789
|
-
|
|
11788
|
+
fs22.futimes(fd, at, mt, function(er2) {
|
|
11789
|
+
fs22.close(fd, function(er22) {
|
|
11790
11790
|
if (cb) cb(er2 || er22);
|
|
11791
11791
|
});
|
|
11792
11792
|
});
|
|
11793
11793
|
});
|
|
11794
11794
|
};
|
|
11795
|
-
|
|
11796
|
-
var fd =
|
|
11795
|
+
fs22.lutimesSync = function(path21, at, mt) {
|
|
11796
|
+
var fd = fs22.openSync(path21, constants.O_SYMLINK);
|
|
11797
11797
|
var ret;
|
|
11798
11798
|
var threw = true;
|
|
11799
11799
|
try {
|
|
11800
|
-
ret =
|
|
11800
|
+
ret = fs22.futimesSync(fd, at, mt);
|
|
11801
11801
|
threw = false;
|
|
11802
11802
|
} finally {
|
|
11803
11803
|
if (threw) {
|
|
11804
11804
|
try {
|
|
11805
|
-
|
|
11805
|
+
fs22.closeSync(fd);
|
|
11806
11806
|
} catch (er) {
|
|
11807
11807
|
}
|
|
11808
11808
|
} else {
|
|
11809
|
-
|
|
11809
|
+
fs22.closeSync(fd);
|
|
11810
11810
|
}
|
|
11811
11811
|
}
|
|
11812
11812
|
return ret;
|
|
11813
11813
|
};
|
|
11814
|
-
} else if (
|
|
11815
|
-
|
|
11814
|
+
} else if (fs22.futimes) {
|
|
11815
|
+
fs22.lutimes = function(_a2, _b, _c, cb) {
|
|
11816
11816
|
if (cb) process.nextTick(cb);
|
|
11817
11817
|
};
|
|
11818
|
-
|
|
11818
|
+
fs22.lutimesSync = function() {
|
|
11819
11819
|
};
|
|
11820
11820
|
}
|
|
11821
11821
|
}
|
|
11822
11822
|
function chmodFix(orig) {
|
|
11823
11823
|
if (!orig) return orig;
|
|
11824
11824
|
return function(target, mode, cb) {
|
|
11825
|
-
return orig.call(
|
|
11825
|
+
return orig.call(fs21, target, mode, function(er) {
|
|
11826
11826
|
if (chownErOk(er)) er = null;
|
|
11827
11827
|
if (cb) cb.apply(this, arguments);
|
|
11828
11828
|
});
|
|
@@ -11832,7 +11832,7 @@ var require_polyfills = __commonJS({
|
|
|
11832
11832
|
if (!orig) return orig;
|
|
11833
11833
|
return function(target, mode) {
|
|
11834
11834
|
try {
|
|
11835
|
-
return orig.call(
|
|
11835
|
+
return orig.call(fs21, target, mode);
|
|
11836
11836
|
} catch (er) {
|
|
11837
11837
|
if (!chownErOk(er)) throw er;
|
|
11838
11838
|
}
|
|
@@ -11841,7 +11841,7 @@ var require_polyfills = __commonJS({
|
|
|
11841
11841
|
function chownFix(orig) {
|
|
11842
11842
|
if (!orig) return orig;
|
|
11843
11843
|
return function(target, uid, gid, cb) {
|
|
11844
|
-
return orig.call(
|
|
11844
|
+
return orig.call(fs21, target, uid, gid, function(er) {
|
|
11845
11845
|
if (chownErOk(er)) er = null;
|
|
11846
11846
|
if (cb) cb.apply(this, arguments);
|
|
11847
11847
|
});
|
|
@@ -11851,7 +11851,7 @@ var require_polyfills = __commonJS({
|
|
|
11851
11851
|
if (!orig) return orig;
|
|
11852
11852
|
return function(target, uid, gid) {
|
|
11853
11853
|
try {
|
|
11854
|
-
return orig.call(
|
|
11854
|
+
return orig.call(fs21, target, uid, gid);
|
|
11855
11855
|
} catch (er) {
|
|
11856
11856
|
if (!chownErOk(er)) throw er;
|
|
11857
11857
|
}
|
|
@@ -11871,13 +11871,13 @@ var require_polyfills = __commonJS({
|
|
|
11871
11871
|
}
|
|
11872
11872
|
if (cb) cb.apply(this, arguments);
|
|
11873
11873
|
}
|
|
11874
|
-
return options ? orig.call(
|
|
11874
|
+
return options ? orig.call(fs21, target, options, callback) : orig.call(fs21, target, callback);
|
|
11875
11875
|
};
|
|
11876
11876
|
}
|
|
11877
11877
|
function statFixSync(orig) {
|
|
11878
11878
|
if (!orig) return orig;
|
|
11879
11879
|
return function(target, options) {
|
|
11880
|
-
var stats = options ? orig.call(
|
|
11880
|
+
var stats = options ? orig.call(fs21, target, options) : orig.call(fs21, target);
|
|
11881
11881
|
if (stats) {
|
|
11882
11882
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
11883
11883
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -11907,7 +11907,7 @@ var require_legacy_streams = __commonJS({
|
|
|
11907
11907
|
"use strict";
|
|
11908
11908
|
var Stream = require("stream").Stream;
|
|
11909
11909
|
module2.exports = legacy;
|
|
11910
|
-
function legacy(
|
|
11910
|
+
function legacy(fs21) {
|
|
11911
11911
|
return {
|
|
11912
11912
|
ReadStream,
|
|
11913
11913
|
WriteStream
|
|
@@ -11950,7 +11950,7 @@ var require_legacy_streams = __commonJS({
|
|
|
11950
11950
|
});
|
|
11951
11951
|
return;
|
|
11952
11952
|
}
|
|
11953
|
-
|
|
11953
|
+
fs21.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
11954
11954
|
if (err) {
|
|
11955
11955
|
self.emit("error", err);
|
|
11956
11956
|
self.readable = false;
|
|
@@ -11989,7 +11989,7 @@ var require_legacy_streams = __commonJS({
|
|
|
11989
11989
|
this.busy = false;
|
|
11990
11990
|
this._queue = [];
|
|
11991
11991
|
if (this.fd === null) {
|
|
11992
|
-
this._open =
|
|
11992
|
+
this._open = fs21.open;
|
|
11993
11993
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
11994
11994
|
this.flush();
|
|
11995
11995
|
}
|
|
@@ -12025,7 +12025,7 @@ var require_clone = __commonJS({
|
|
|
12025
12025
|
var require_graceful_fs = __commonJS({
|
|
12026
12026
|
"../node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
|
|
12027
12027
|
"use strict";
|
|
12028
|
-
var
|
|
12028
|
+
var fs21 = require("fs");
|
|
12029
12029
|
var polyfills = require_polyfills();
|
|
12030
12030
|
var legacy = require_legacy_streams();
|
|
12031
12031
|
var clone3 = require_clone();
|
|
@@ -12057,12 +12057,12 @@ var require_graceful_fs = __commonJS({
|
|
|
12057
12057
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
12058
12058
|
console.error(m);
|
|
12059
12059
|
};
|
|
12060
|
-
if (!
|
|
12060
|
+
if (!fs21[gracefulQueue]) {
|
|
12061
12061
|
queue = global[gracefulQueue] || [];
|
|
12062
|
-
publishQueue(
|
|
12063
|
-
|
|
12062
|
+
publishQueue(fs21, queue);
|
|
12063
|
+
fs21.close = (function(fs$close) {
|
|
12064
12064
|
function close(fd, cb) {
|
|
12065
|
-
return fs$close.call(
|
|
12065
|
+
return fs$close.call(fs21, fd, function(err) {
|
|
12066
12066
|
if (!err) {
|
|
12067
12067
|
resetQueue();
|
|
12068
12068
|
}
|
|
@@ -12074,40 +12074,40 @@ var require_graceful_fs = __commonJS({
|
|
|
12074
12074
|
value: fs$close
|
|
12075
12075
|
});
|
|
12076
12076
|
return close;
|
|
12077
|
-
})(
|
|
12078
|
-
|
|
12077
|
+
})(fs21.close);
|
|
12078
|
+
fs21.closeSync = (function(fs$closeSync) {
|
|
12079
12079
|
function closeSync(fd) {
|
|
12080
|
-
fs$closeSync.apply(
|
|
12080
|
+
fs$closeSync.apply(fs21, arguments);
|
|
12081
12081
|
resetQueue();
|
|
12082
12082
|
}
|
|
12083
12083
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
12084
12084
|
value: fs$closeSync
|
|
12085
12085
|
});
|
|
12086
12086
|
return closeSync;
|
|
12087
|
-
})(
|
|
12087
|
+
})(fs21.closeSync);
|
|
12088
12088
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
12089
12089
|
process.on("exit", function() {
|
|
12090
|
-
debug(
|
|
12091
|
-
require("assert").equal(
|
|
12090
|
+
debug(fs21[gracefulQueue]);
|
|
12091
|
+
require("assert").equal(fs21[gracefulQueue].length, 0);
|
|
12092
12092
|
});
|
|
12093
12093
|
}
|
|
12094
12094
|
}
|
|
12095
12095
|
var queue;
|
|
12096
12096
|
if (!global[gracefulQueue]) {
|
|
12097
|
-
publishQueue(global,
|
|
12098
|
-
}
|
|
12099
|
-
module2.exports = patch(clone3(
|
|
12100
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
12101
|
-
module2.exports = patch(
|
|
12102
|
-
|
|
12103
|
-
}
|
|
12104
|
-
function patch(
|
|
12105
|
-
polyfills(
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
var fs$readFile =
|
|
12110
|
-
|
|
12097
|
+
publishQueue(global, fs21[gracefulQueue]);
|
|
12098
|
+
}
|
|
12099
|
+
module2.exports = patch(clone3(fs21));
|
|
12100
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs21.__patched) {
|
|
12101
|
+
module2.exports = patch(fs21);
|
|
12102
|
+
fs21.__patched = true;
|
|
12103
|
+
}
|
|
12104
|
+
function patch(fs22) {
|
|
12105
|
+
polyfills(fs22);
|
|
12106
|
+
fs22.gracefulify = patch;
|
|
12107
|
+
fs22.createReadStream = createReadStream;
|
|
12108
|
+
fs22.createWriteStream = createWriteStream2;
|
|
12109
|
+
var fs$readFile = fs22.readFile;
|
|
12110
|
+
fs22.readFile = readFile;
|
|
12111
12111
|
function readFile(path21, options, cb) {
|
|
12112
12112
|
if (typeof options === "function")
|
|
12113
12113
|
cb = options, options = null;
|
|
@@ -12123,8 +12123,8 @@ var require_graceful_fs = __commonJS({
|
|
|
12123
12123
|
});
|
|
12124
12124
|
}
|
|
12125
12125
|
}
|
|
12126
|
-
var fs$writeFile =
|
|
12127
|
-
|
|
12126
|
+
var fs$writeFile = fs22.writeFile;
|
|
12127
|
+
fs22.writeFile = writeFile;
|
|
12128
12128
|
function writeFile(path21, data, options, cb) {
|
|
12129
12129
|
if (typeof options === "function")
|
|
12130
12130
|
cb = options, options = null;
|
|
@@ -12140,9 +12140,9 @@ var require_graceful_fs = __commonJS({
|
|
|
12140
12140
|
});
|
|
12141
12141
|
}
|
|
12142
12142
|
}
|
|
12143
|
-
var fs$appendFile =
|
|
12143
|
+
var fs$appendFile = fs22.appendFile;
|
|
12144
12144
|
if (fs$appendFile)
|
|
12145
|
-
|
|
12145
|
+
fs22.appendFile = appendFile;
|
|
12146
12146
|
function appendFile(path21, data, options, cb) {
|
|
12147
12147
|
if (typeof options === "function")
|
|
12148
12148
|
cb = options, options = null;
|
|
@@ -12158,9 +12158,9 @@ var require_graceful_fs = __commonJS({
|
|
|
12158
12158
|
});
|
|
12159
12159
|
}
|
|
12160
12160
|
}
|
|
12161
|
-
var fs$copyFile =
|
|
12161
|
+
var fs$copyFile = fs22.copyFile;
|
|
12162
12162
|
if (fs$copyFile)
|
|
12163
|
-
|
|
12163
|
+
fs22.copyFile = copyFile;
|
|
12164
12164
|
function copyFile(src, dest, flags, cb) {
|
|
12165
12165
|
if (typeof flags === "function") {
|
|
12166
12166
|
cb = flags;
|
|
@@ -12178,8 +12178,8 @@ var require_graceful_fs = __commonJS({
|
|
|
12178
12178
|
});
|
|
12179
12179
|
}
|
|
12180
12180
|
}
|
|
12181
|
-
var fs$readdir =
|
|
12182
|
-
|
|
12181
|
+
var fs$readdir = fs22.readdir;
|
|
12182
|
+
fs22.readdir = readdir;
|
|
12183
12183
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
12184
12184
|
function readdir(path21, options, cb) {
|
|
12185
12185
|
if (typeof options === "function")
|
|
@@ -12220,21 +12220,21 @@ var require_graceful_fs = __commonJS({
|
|
|
12220
12220
|
}
|
|
12221
12221
|
}
|
|
12222
12222
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
12223
|
-
var legStreams = legacy(
|
|
12223
|
+
var legStreams = legacy(fs22);
|
|
12224
12224
|
ReadStream = legStreams.ReadStream;
|
|
12225
12225
|
WriteStream = legStreams.WriteStream;
|
|
12226
12226
|
}
|
|
12227
|
-
var fs$ReadStream =
|
|
12227
|
+
var fs$ReadStream = fs22.ReadStream;
|
|
12228
12228
|
if (fs$ReadStream) {
|
|
12229
12229
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
12230
12230
|
ReadStream.prototype.open = ReadStream$open;
|
|
12231
12231
|
}
|
|
12232
|
-
var fs$WriteStream =
|
|
12232
|
+
var fs$WriteStream = fs22.WriteStream;
|
|
12233
12233
|
if (fs$WriteStream) {
|
|
12234
12234
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
12235
12235
|
WriteStream.prototype.open = WriteStream$open;
|
|
12236
12236
|
}
|
|
12237
|
-
Object.defineProperty(
|
|
12237
|
+
Object.defineProperty(fs22, "ReadStream", {
|
|
12238
12238
|
get: function() {
|
|
12239
12239
|
return ReadStream;
|
|
12240
12240
|
},
|
|
@@ -12244,7 +12244,7 @@ var require_graceful_fs = __commonJS({
|
|
|
12244
12244
|
enumerable: true,
|
|
12245
12245
|
configurable: true
|
|
12246
12246
|
});
|
|
12247
|
-
Object.defineProperty(
|
|
12247
|
+
Object.defineProperty(fs22, "WriteStream", {
|
|
12248
12248
|
get: function() {
|
|
12249
12249
|
return WriteStream;
|
|
12250
12250
|
},
|
|
@@ -12255,7 +12255,7 @@ var require_graceful_fs = __commonJS({
|
|
|
12255
12255
|
configurable: true
|
|
12256
12256
|
});
|
|
12257
12257
|
var FileReadStream = ReadStream;
|
|
12258
|
-
Object.defineProperty(
|
|
12258
|
+
Object.defineProperty(fs22, "FileReadStream", {
|
|
12259
12259
|
get: function() {
|
|
12260
12260
|
return FileReadStream;
|
|
12261
12261
|
},
|
|
@@ -12266,7 +12266,7 @@ var require_graceful_fs = __commonJS({
|
|
|
12266
12266
|
configurable: true
|
|
12267
12267
|
});
|
|
12268
12268
|
var FileWriteStream = WriteStream;
|
|
12269
|
-
Object.defineProperty(
|
|
12269
|
+
Object.defineProperty(fs22, "FileWriteStream", {
|
|
12270
12270
|
get: function() {
|
|
12271
12271
|
return FileWriteStream;
|
|
12272
12272
|
},
|
|
@@ -12315,13 +12315,13 @@ var require_graceful_fs = __commonJS({
|
|
|
12315
12315
|
});
|
|
12316
12316
|
}
|
|
12317
12317
|
function createReadStream(path21, options) {
|
|
12318
|
-
return new
|
|
12318
|
+
return new fs22.ReadStream(path21, options);
|
|
12319
12319
|
}
|
|
12320
12320
|
function createWriteStream2(path21, options) {
|
|
12321
|
-
return new
|
|
12321
|
+
return new fs22.WriteStream(path21, options);
|
|
12322
12322
|
}
|
|
12323
|
-
var fs$open =
|
|
12324
|
-
|
|
12323
|
+
var fs$open = fs22.open;
|
|
12324
|
+
fs22.open = open;
|
|
12325
12325
|
function open(path21, flags, mode, cb) {
|
|
12326
12326
|
if (typeof mode === "function")
|
|
12327
12327
|
cb = mode, mode = null;
|
|
@@ -12337,20 +12337,20 @@ var require_graceful_fs = __commonJS({
|
|
|
12337
12337
|
});
|
|
12338
12338
|
}
|
|
12339
12339
|
}
|
|
12340
|
-
return
|
|
12340
|
+
return fs22;
|
|
12341
12341
|
}
|
|
12342
12342
|
function enqueue(elem) {
|
|
12343
12343
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
12344
|
-
|
|
12344
|
+
fs21[gracefulQueue].push(elem);
|
|
12345
12345
|
retry();
|
|
12346
12346
|
}
|
|
12347
12347
|
var retryTimer;
|
|
12348
12348
|
function resetQueue() {
|
|
12349
12349
|
var now = Date.now();
|
|
12350
|
-
for (var i = 0; i <
|
|
12351
|
-
if (
|
|
12352
|
-
|
|
12353
|
-
|
|
12350
|
+
for (var i = 0; i < fs21[gracefulQueue].length; ++i) {
|
|
12351
|
+
if (fs21[gracefulQueue][i].length > 2) {
|
|
12352
|
+
fs21[gracefulQueue][i][3] = now;
|
|
12353
|
+
fs21[gracefulQueue][i][4] = now;
|
|
12354
12354
|
}
|
|
12355
12355
|
}
|
|
12356
12356
|
retry();
|
|
@@ -12358,9 +12358,9 @@ var require_graceful_fs = __commonJS({
|
|
|
12358
12358
|
function retry() {
|
|
12359
12359
|
clearTimeout(retryTimer);
|
|
12360
12360
|
retryTimer = void 0;
|
|
12361
|
-
if (
|
|
12361
|
+
if (fs21[gracefulQueue].length === 0)
|
|
12362
12362
|
return;
|
|
12363
|
-
var elem =
|
|
12363
|
+
var elem = fs21[gracefulQueue].shift();
|
|
12364
12364
|
var fn = elem[0];
|
|
12365
12365
|
var args = elem[1];
|
|
12366
12366
|
var err = elem[2];
|
|
@@ -12382,7 +12382,7 @@ var require_graceful_fs = __commonJS({
|
|
|
12382
12382
|
debug("RETRY", fn.name, args);
|
|
12383
12383
|
fn.apply(null, args.concat([startTime]));
|
|
12384
12384
|
} else {
|
|
12385
|
-
|
|
12385
|
+
fs21[gracefulQueue].push(elem);
|
|
12386
12386
|
}
|
|
12387
12387
|
}
|
|
12388
12388
|
if (retryTimer === void 0) {
|
|
@@ -12397,7 +12397,7 @@ var require_fs = __commonJS({
|
|
|
12397
12397
|
"../node_modules/fs-extra/lib/fs/index.js"(exports2) {
|
|
12398
12398
|
"use strict";
|
|
12399
12399
|
var u = require_universalify().fromCallback;
|
|
12400
|
-
var
|
|
12400
|
+
var fs21 = require_graceful_fs();
|
|
12401
12401
|
var api = [
|
|
12402
12402
|
"access",
|
|
12403
12403
|
"appendFile",
|
|
@@ -12438,26 +12438,26 @@ var require_fs = __commonJS({
|
|
|
12438
12438
|
"utimes",
|
|
12439
12439
|
"writeFile"
|
|
12440
12440
|
].filter((key) => {
|
|
12441
|
-
return typeof
|
|
12441
|
+
return typeof fs21[key] === "function";
|
|
12442
12442
|
});
|
|
12443
|
-
Object.assign(exports2,
|
|
12443
|
+
Object.assign(exports2, fs21);
|
|
12444
12444
|
api.forEach((method) => {
|
|
12445
|
-
exports2[method] = u(
|
|
12445
|
+
exports2[method] = u(fs21[method]);
|
|
12446
12446
|
});
|
|
12447
12447
|
exports2.exists = function(filename, callback) {
|
|
12448
12448
|
if (typeof callback === "function") {
|
|
12449
|
-
return
|
|
12449
|
+
return fs21.exists(filename, callback);
|
|
12450
12450
|
}
|
|
12451
12451
|
return new Promise((resolve2) => {
|
|
12452
|
-
return
|
|
12452
|
+
return fs21.exists(filename, resolve2);
|
|
12453
12453
|
});
|
|
12454
12454
|
};
|
|
12455
12455
|
exports2.read = function(fd, buffer, offset, length, position, callback) {
|
|
12456
12456
|
if (typeof callback === "function") {
|
|
12457
|
-
return
|
|
12457
|
+
return fs21.read(fd, buffer, offset, length, position, callback);
|
|
12458
12458
|
}
|
|
12459
12459
|
return new Promise((resolve2, reject) => {
|
|
12460
|
-
|
|
12460
|
+
fs21.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
|
|
12461
12461
|
if (err) return reject(err);
|
|
12462
12462
|
resolve2({ bytesRead, buffer: buffer2 });
|
|
12463
12463
|
});
|
|
@@ -12465,10 +12465,10 @@ var require_fs = __commonJS({
|
|
|
12465
12465
|
};
|
|
12466
12466
|
exports2.write = function(fd, buffer, ...args) {
|
|
12467
12467
|
if (typeof args[args.length - 1] === "function") {
|
|
12468
|
-
return
|
|
12468
|
+
return fs21.write(fd, buffer, ...args);
|
|
12469
12469
|
}
|
|
12470
12470
|
return new Promise((resolve2, reject) => {
|
|
12471
|
-
|
|
12471
|
+
fs21.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
|
|
12472
12472
|
if (err) return reject(err);
|
|
12473
12473
|
resolve2({ bytesWritten, buffer: buffer2 });
|
|
12474
12474
|
});
|
|
@@ -12476,10 +12476,10 @@ var require_fs = __commonJS({
|
|
|
12476
12476
|
};
|
|
12477
12477
|
exports2.readv = function(fd, buffers, ...args) {
|
|
12478
12478
|
if (typeof args[args.length - 1] === "function") {
|
|
12479
|
-
return
|
|
12479
|
+
return fs21.readv(fd, buffers, ...args);
|
|
12480
12480
|
}
|
|
12481
12481
|
return new Promise((resolve2, reject) => {
|
|
12482
|
-
|
|
12482
|
+
fs21.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
|
|
12483
12483
|
if (err) return reject(err);
|
|
12484
12484
|
resolve2({ bytesRead, buffers: buffers2 });
|
|
12485
12485
|
});
|
|
@@ -12487,17 +12487,17 @@ var require_fs = __commonJS({
|
|
|
12487
12487
|
};
|
|
12488
12488
|
exports2.writev = function(fd, buffers, ...args) {
|
|
12489
12489
|
if (typeof args[args.length - 1] === "function") {
|
|
12490
|
-
return
|
|
12490
|
+
return fs21.writev(fd, buffers, ...args);
|
|
12491
12491
|
}
|
|
12492
12492
|
return new Promise((resolve2, reject) => {
|
|
12493
|
-
|
|
12493
|
+
fs21.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
|
|
12494
12494
|
if (err) return reject(err);
|
|
12495
12495
|
resolve2({ bytesWritten, buffers: buffers2 });
|
|
12496
12496
|
});
|
|
12497
12497
|
});
|
|
12498
12498
|
};
|
|
12499
|
-
if (typeof
|
|
12500
|
-
exports2.realpath.native = u(
|
|
12499
|
+
if (typeof fs21.realpath.native === "function") {
|
|
12500
|
+
exports2.realpath.native = u(fs21.realpath.native);
|
|
12501
12501
|
} else {
|
|
12502
12502
|
process.emitWarning(
|
|
12503
12503
|
"fs.realpath.native is not a function. Is fs being monkey-patched?",
|
|
@@ -12530,7 +12530,7 @@ var require_utils = __commonJS({
|
|
|
12530
12530
|
var require_make_dir = __commonJS({
|
|
12531
12531
|
"../node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
|
|
12532
12532
|
"use strict";
|
|
12533
|
-
var
|
|
12533
|
+
var fs21 = require_fs();
|
|
12534
12534
|
var { checkPath } = require_utils();
|
|
12535
12535
|
var getMode = (options) => {
|
|
12536
12536
|
const defaults = { mode: 511 };
|
|
@@ -12539,14 +12539,14 @@ var require_make_dir = __commonJS({
|
|
|
12539
12539
|
};
|
|
12540
12540
|
module2.exports.makeDir = async (dir, options) => {
|
|
12541
12541
|
checkPath(dir);
|
|
12542
|
-
return
|
|
12542
|
+
return fs21.mkdir(dir, {
|
|
12543
12543
|
mode: getMode(options),
|
|
12544
12544
|
recursive: true
|
|
12545
12545
|
});
|
|
12546
12546
|
};
|
|
12547
12547
|
module2.exports.makeDirSync = (dir, options) => {
|
|
12548
12548
|
checkPath(dir);
|
|
12549
|
-
return
|
|
12549
|
+
return fs21.mkdirSync(dir, {
|
|
12550
12550
|
mode: getMode(options),
|
|
12551
12551
|
recursive: true
|
|
12552
12552
|
});
|
|
@@ -12578,13 +12578,13 @@ var require_path_exists = __commonJS({
|
|
|
12578
12578
|
"../node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
|
|
12579
12579
|
"use strict";
|
|
12580
12580
|
var u = require_universalify().fromPromise;
|
|
12581
|
-
var
|
|
12581
|
+
var fs21 = require_fs();
|
|
12582
12582
|
function pathExists(path21) {
|
|
12583
|
-
return
|
|
12583
|
+
return fs21.access(path21).then(() => true).catch(() => false);
|
|
12584
12584
|
}
|
|
12585
12585
|
module2.exports = {
|
|
12586
12586
|
pathExists: u(pathExists),
|
|
12587
|
-
pathExistsSync:
|
|
12587
|
+
pathExistsSync: fs21.existsSync
|
|
12588
12588
|
};
|
|
12589
12589
|
}
|
|
12590
12590
|
});
|
|
@@ -12593,16 +12593,16 @@ var require_path_exists = __commonJS({
|
|
|
12593
12593
|
var require_utimes = __commonJS({
|
|
12594
12594
|
"../node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
|
|
12595
12595
|
"use strict";
|
|
12596
|
-
var
|
|
12596
|
+
var fs21 = require_fs();
|
|
12597
12597
|
var u = require_universalify().fromPromise;
|
|
12598
12598
|
async function utimesMillis(path21, atime, mtime) {
|
|
12599
|
-
const fd = await
|
|
12599
|
+
const fd = await fs21.open(path21, "r+");
|
|
12600
12600
|
let closeErr = null;
|
|
12601
12601
|
try {
|
|
12602
|
-
await
|
|
12602
|
+
await fs21.futimes(fd, atime, mtime);
|
|
12603
12603
|
} finally {
|
|
12604
12604
|
try {
|
|
12605
|
-
await
|
|
12605
|
+
await fs21.close(fd);
|
|
12606
12606
|
} catch (e) {
|
|
12607
12607
|
closeErr = e;
|
|
12608
12608
|
}
|
|
@@ -12612,9 +12612,9 @@ var require_utimes = __commonJS({
|
|
|
12612
12612
|
}
|
|
12613
12613
|
}
|
|
12614
12614
|
function utimesMillisSync(path21, atime, mtime) {
|
|
12615
|
-
const fd =
|
|
12616
|
-
|
|
12617
|
-
return
|
|
12615
|
+
const fd = fs21.openSync(path21, "r+");
|
|
12616
|
+
fs21.futimesSync(fd, atime, mtime);
|
|
12617
|
+
return fs21.closeSync(fd);
|
|
12618
12618
|
}
|
|
12619
12619
|
module2.exports = {
|
|
12620
12620
|
utimesMillis: u(utimesMillis),
|
|
@@ -12627,11 +12627,11 @@ var require_utimes = __commonJS({
|
|
|
12627
12627
|
var require_stat = __commonJS({
|
|
12628
12628
|
"../node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
|
|
12629
12629
|
"use strict";
|
|
12630
|
-
var
|
|
12630
|
+
var fs21 = require_fs();
|
|
12631
12631
|
var path21 = require("path");
|
|
12632
12632
|
var u = require_universalify().fromPromise;
|
|
12633
12633
|
function getStats(src, dest, opts) {
|
|
12634
|
-
const statFunc = opts.dereference ? (file2) =>
|
|
12634
|
+
const statFunc = opts.dereference ? (file2) => fs21.stat(file2, { bigint: true }) : (file2) => fs21.lstat(file2, { bigint: true });
|
|
12635
12635
|
return Promise.all([
|
|
12636
12636
|
statFunc(src),
|
|
12637
12637
|
statFunc(dest).catch((err) => {
|
|
@@ -12642,7 +12642,7 @@ var require_stat = __commonJS({
|
|
|
12642
12642
|
}
|
|
12643
12643
|
function getStatsSync(src, dest, opts) {
|
|
12644
12644
|
let destStat;
|
|
12645
|
-
const statFunc = opts.dereference ? (file2) =>
|
|
12645
|
+
const statFunc = opts.dereference ? (file2) => fs21.statSync(file2, { bigint: true }) : (file2) => fs21.lstatSync(file2, { bigint: true });
|
|
12646
12646
|
const srcStat = statFunc(src);
|
|
12647
12647
|
try {
|
|
12648
12648
|
destStat = statFunc(dest);
|
|
@@ -12704,7 +12704,7 @@ var require_stat = __commonJS({
|
|
|
12704
12704
|
if (destParent === srcParent || destParent === path21.parse(destParent).root) return;
|
|
12705
12705
|
let destStat;
|
|
12706
12706
|
try {
|
|
12707
|
-
destStat = await
|
|
12707
|
+
destStat = await fs21.stat(destParent, { bigint: true });
|
|
12708
12708
|
} catch (err) {
|
|
12709
12709
|
if (err.code === "ENOENT") return;
|
|
12710
12710
|
throw err;
|
|
@@ -12720,7 +12720,7 @@ var require_stat = __commonJS({
|
|
|
12720
12720
|
if (destParent === srcParent || destParent === path21.parse(destParent).root) return;
|
|
12721
12721
|
let destStat;
|
|
12722
12722
|
try {
|
|
12723
|
-
destStat =
|
|
12723
|
+
destStat = fs21.statSync(destParent, { bigint: true });
|
|
12724
12724
|
} catch (err) {
|
|
12725
12725
|
if (err.code === "ENOENT") return;
|
|
12726
12726
|
throw err;
|
|
@@ -12787,7 +12787,7 @@ var require_async = __commonJS({
|
|
|
12787
12787
|
var require_copy = __commonJS({
|
|
12788
12788
|
"../node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
|
|
12789
12789
|
"use strict";
|
|
12790
|
-
var
|
|
12790
|
+
var fs21 = require_fs();
|
|
12791
12791
|
var path21 = require("path");
|
|
12792
12792
|
var { mkdirs } = require_mkdirs();
|
|
12793
12793
|
var { pathExists } = require_path_exists();
|
|
@@ -12823,7 +12823,7 @@ var require_copy = __commonJS({
|
|
|
12823
12823
|
return opts.filter(src, dest);
|
|
12824
12824
|
}
|
|
12825
12825
|
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
12826
|
-
const statFn = opts.dereference ?
|
|
12826
|
+
const statFn = opts.dereference ? fs21.stat : fs21.lstat;
|
|
12827
12827
|
const srcStat = await statFn(src);
|
|
12828
12828
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
12829
12829
|
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -12835,7 +12835,7 @@ var require_copy = __commonJS({
|
|
|
12835
12835
|
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
12836
12836
|
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
12837
12837
|
if (opts.overwrite) {
|
|
12838
|
-
await
|
|
12838
|
+
await fs21.unlink(dest);
|
|
12839
12839
|
return copyFile(srcStat, src, dest, opts);
|
|
12840
12840
|
}
|
|
12841
12841
|
if (opts.errorOnExist) {
|
|
@@ -12843,27 +12843,27 @@ var require_copy = __commonJS({
|
|
|
12843
12843
|
}
|
|
12844
12844
|
}
|
|
12845
12845
|
async function copyFile(srcStat, src, dest, opts) {
|
|
12846
|
-
await
|
|
12846
|
+
await fs21.copyFile(src, dest);
|
|
12847
12847
|
if (opts.preserveTimestamps) {
|
|
12848
12848
|
if (fileIsNotWritable(srcStat.mode)) {
|
|
12849
12849
|
await makeFileWritable(dest, srcStat.mode);
|
|
12850
12850
|
}
|
|
12851
|
-
const updatedSrcStat = await
|
|
12851
|
+
const updatedSrcStat = await fs21.stat(src);
|
|
12852
12852
|
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
12853
12853
|
}
|
|
12854
|
-
return
|
|
12854
|
+
return fs21.chmod(dest, srcStat.mode);
|
|
12855
12855
|
}
|
|
12856
12856
|
function fileIsNotWritable(srcMode) {
|
|
12857
12857
|
return (srcMode & 128) === 0;
|
|
12858
12858
|
}
|
|
12859
12859
|
function makeFileWritable(dest, srcMode) {
|
|
12860
|
-
return
|
|
12860
|
+
return fs21.chmod(dest, srcMode | 128);
|
|
12861
12861
|
}
|
|
12862
12862
|
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
12863
12863
|
if (!destStat) {
|
|
12864
|
-
await
|
|
12864
|
+
await fs21.mkdir(dest);
|
|
12865
12865
|
}
|
|
12866
|
-
await asyncIteratorConcurrentProcess(await
|
|
12866
|
+
await asyncIteratorConcurrentProcess(await fs21.opendir(src), async (item) => {
|
|
12867
12867
|
const srcItem = path21.join(src, item.name);
|
|
12868
12868
|
const destItem = path21.join(dest, item.name);
|
|
12869
12869
|
const include = await runFilter(srcItem, destItem, opts);
|
|
@@ -12873,22 +12873,22 @@ var require_copy = __commonJS({
|
|
|
12873
12873
|
}
|
|
12874
12874
|
});
|
|
12875
12875
|
if (!destStat) {
|
|
12876
|
-
await
|
|
12876
|
+
await fs21.chmod(dest, srcStat.mode);
|
|
12877
12877
|
}
|
|
12878
12878
|
}
|
|
12879
12879
|
async function onLink(destStat, src, dest, opts) {
|
|
12880
|
-
let resolvedSrc = await
|
|
12880
|
+
let resolvedSrc = await fs21.readlink(src);
|
|
12881
12881
|
if (opts.dereference) {
|
|
12882
12882
|
resolvedSrc = path21.resolve(process.cwd(), resolvedSrc);
|
|
12883
12883
|
}
|
|
12884
12884
|
if (!destStat) {
|
|
12885
|
-
return
|
|
12885
|
+
return fs21.symlink(resolvedSrc, dest);
|
|
12886
12886
|
}
|
|
12887
12887
|
let resolvedDest = null;
|
|
12888
12888
|
try {
|
|
12889
|
-
resolvedDest = await
|
|
12889
|
+
resolvedDest = await fs21.readlink(dest);
|
|
12890
12890
|
} catch (e) {
|
|
12891
|
-
if (e.code === "EINVAL" || e.code === "UNKNOWN") return
|
|
12891
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs21.symlink(resolvedSrc, dest);
|
|
12892
12892
|
throw e;
|
|
12893
12893
|
}
|
|
12894
12894
|
if (opts.dereference) {
|
|
@@ -12902,8 +12902,8 @@ var require_copy = __commonJS({
|
|
|
12902
12902
|
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
12903
12903
|
}
|
|
12904
12904
|
}
|
|
12905
|
-
await
|
|
12906
|
-
return
|
|
12905
|
+
await fs21.unlink(dest);
|
|
12906
|
+
return fs21.symlink(resolvedSrc, dest);
|
|
12907
12907
|
}
|
|
12908
12908
|
module2.exports = copy;
|
|
12909
12909
|
}
|
|
@@ -12913,7 +12913,7 @@ var require_copy = __commonJS({
|
|
|
12913
12913
|
var require_copy_sync = __commonJS({
|
|
12914
12914
|
"../node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
|
|
12915
12915
|
"use strict";
|
|
12916
|
-
var
|
|
12916
|
+
var fs21 = require_graceful_fs();
|
|
12917
12917
|
var path21 = require("path");
|
|
12918
12918
|
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
12919
12919
|
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
@@ -12936,11 +12936,11 @@ var require_copy_sync = __commonJS({
|
|
|
12936
12936
|
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
12937
12937
|
if (opts.filter && !opts.filter(src, dest)) return;
|
|
12938
12938
|
const destParent = path21.dirname(dest);
|
|
12939
|
-
if (!
|
|
12939
|
+
if (!fs21.existsSync(destParent)) mkdirsSync(destParent);
|
|
12940
12940
|
return getStats(destStat, src, dest, opts);
|
|
12941
12941
|
}
|
|
12942
12942
|
function getStats(destStat, src, dest, opts) {
|
|
12943
|
-
const statSync = opts.dereference ?
|
|
12943
|
+
const statSync = opts.dereference ? fs21.statSync : fs21.lstatSync;
|
|
12944
12944
|
const srcStat = statSync(src);
|
|
12945
12945
|
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
12946
12946
|
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
@@ -12955,14 +12955,14 @@ var require_copy_sync = __commonJS({
|
|
|
12955
12955
|
}
|
|
12956
12956
|
function mayCopyFile(srcStat, src, dest, opts) {
|
|
12957
12957
|
if (opts.overwrite) {
|
|
12958
|
-
|
|
12958
|
+
fs21.unlinkSync(dest);
|
|
12959
12959
|
return copyFile(srcStat, src, dest, opts);
|
|
12960
12960
|
} else if (opts.errorOnExist) {
|
|
12961
12961
|
throw new Error(`'${dest}' already exists`);
|
|
12962
12962
|
}
|
|
12963
12963
|
}
|
|
12964
12964
|
function copyFile(srcStat, src, dest, opts) {
|
|
12965
|
-
|
|
12965
|
+
fs21.copyFileSync(src, dest);
|
|
12966
12966
|
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
12967
12967
|
return setDestMode(dest, srcStat.mode);
|
|
12968
12968
|
}
|
|
@@ -12977,10 +12977,10 @@ var require_copy_sync = __commonJS({
|
|
|
12977
12977
|
return setDestMode(dest, srcMode | 128);
|
|
12978
12978
|
}
|
|
12979
12979
|
function setDestMode(dest, srcMode) {
|
|
12980
|
-
return
|
|
12980
|
+
return fs21.chmodSync(dest, srcMode);
|
|
12981
12981
|
}
|
|
12982
12982
|
function setDestTimestamps(src, dest) {
|
|
12983
|
-
const updatedSrcStat =
|
|
12983
|
+
const updatedSrcStat = fs21.statSync(src);
|
|
12984
12984
|
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
12985
12985
|
}
|
|
12986
12986
|
function onDir(srcStat, destStat, src, dest, opts) {
|
|
@@ -12988,12 +12988,12 @@ var require_copy_sync = __commonJS({
|
|
|
12988
12988
|
return copyDir(src, dest, opts);
|
|
12989
12989
|
}
|
|
12990
12990
|
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
12991
|
-
|
|
12991
|
+
fs21.mkdirSync(dest);
|
|
12992
12992
|
copyDir(src, dest, opts);
|
|
12993
12993
|
return setDestMode(dest, srcMode);
|
|
12994
12994
|
}
|
|
12995
12995
|
function copyDir(src, dest, opts) {
|
|
12996
|
-
const dir =
|
|
12996
|
+
const dir = fs21.opendirSync(src);
|
|
12997
12997
|
try {
|
|
12998
12998
|
let dirent;
|
|
12999
12999
|
while ((dirent = dir.readSync()) !== null) {
|
|
@@ -13011,18 +13011,18 @@ var require_copy_sync = __commonJS({
|
|
|
13011
13011
|
return getStats(destStat, srcItem, destItem, opts);
|
|
13012
13012
|
}
|
|
13013
13013
|
function onLink(destStat, src, dest, opts) {
|
|
13014
|
-
let resolvedSrc =
|
|
13014
|
+
let resolvedSrc = fs21.readlinkSync(src);
|
|
13015
13015
|
if (opts.dereference) {
|
|
13016
13016
|
resolvedSrc = path21.resolve(process.cwd(), resolvedSrc);
|
|
13017
13017
|
}
|
|
13018
13018
|
if (!destStat) {
|
|
13019
|
-
return
|
|
13019
|
+
return fs21.symlinkSync(resolvedSrc, dest);
|
|
13020
13020
|
} else {
|
|
13021
13021
|
let resolvedDest;
|
|
13022
13022
|
try {
|
|
13023
|
-
resolvedDest =
|
|
13023
|
+
resolvedDest = fs21.readlinkSync(dest);
|
|
13024
13024
|
} catch (err) {
|
|
13025
|
-
if (err.code === "EINVAL" || err.code === "UNKNOWN") return
|
|
13025
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs21.symlinkSync(resolvedSrc, dest);
|
|
13026
13026
|
throw err;
|
|
13027
13027
|
}
|
|
13028
13028
|
if (opts.dereference) {
|
|
@@ -13040,8 +13040,8 @@ var require_copy_sync = __commonJS({
|
|
|
13040
13040
|
}
|
|
13041
13041
|
}
|
|
13042
13042
|
function copyLink(resolvedSrc, dest) {
|
|
13043
|
-
|
|
13044
|
-
return
|
|
13043
|
+
fs21.unlinkSync(dest);
|
|
13044
|
+
return fs21.symlinkSync(resolvedSrc, dest);
|
|
13045
13045
|
}
|
|
13046
13046
|
module2.exports = copySync;
|
|
13047
13047
|
}
|
|
@@ -13063,13 +13063,13 @@ var require_copy2 = __commonJS({
|
|
|
13063
13063
|
var require_remove = __commonJS({
|
|
13064
13064
|
"../node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
|
|
13065
13065
|
"use strict";
|
|
13066
|
-
var
|
|
13066
|
+
var fs21 = require_graceful_fs();
|
|
13067
13067
|
var u = require_universalify().fromCallback;
|
|
13068
13068
|
function remove(path21, callback) {
|
|
13069
|
-
|
|
13069
|
+
fs21.rm(path21, { recursive: true, force: true }, callback);
|
|
13070
13070
|
}
|
|
13071
13071
|
function removeSync(path21) {
|
|
13072
|
-
|
|
13072
|
+
fs21.rmSync(path21, { recursive: true, force: true });
|
|
13073
13073
|
}
|
|
13074
13074
|
module2.exports = {
|
|
13075
13075
|
remove: u(remove),
|
|
@@ -13083,14 +13083,14 @@ var require_empty = __commonJS({
|
|
|
13083
13083
|
"../node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
|
|
13084
13084
|
"use strict";
|
|
13085
13085
|
var u = require_universalify().fromPromise;
|
|
13086
|
-
var
|
|
13086
|
+
var fs21 = require_fs();
|
|
13087
13087
|
var path21 = require("path");
|
|
13088
13088
|
var mkdir = require_mkdirs();
|
|
13089
13089
|
var remove = require_remove();
|
|
13090
13090
|
var emptyDir = u(async function emptyDir2(dir) {
|
|
13091
13091
|
let items;
|
|
13092
13092
|
try {
|
|
13093
|
-
items = await
|
|
13093
|
+
items = await fs21.readdir(dir);
|
|
13094
13094
|
} catch {
|
|
13095
13095
|
return mkdir.mkdirs(dir);
|
|
13096
13096
|
}
|
|
@@ -13099,7 +13099,7 @@ var require_empty = __commonJS({
|
|
|
13099
13099
|
function emptyDirSync(dir) {
|
|
13100
13100
|
let items;
|
|
13101
13101
|
try {
|
|
13102
|
-
items =
|
|
13102
|
+
items = fs21.readdirSync(dir);
|
|
13103
13103
|
} catch {
|
|
13104
13104
|
return mkdir.mkdirsSync(dir);
|
|
13105
13105
|
}
|
|
@@ -13123,51 +13123,51 @@ var require_file = __commonJS({
|
|
|
13123
13123
|
"use strict";
|
|
13124
13124
|
var u = require_universalify().fromPromise;
|
|
13125
13125
|
var path21 = require("path");
|
|
13126
|
-
var
|
|
13126
|
+
var fs21 = require_fs();
|
|
13127
13127
|
var mkdir = require_mkdirs();
|
|
13128
13128
|
async function createFile(file2) {
|
|
13129
13129
|
let stats;
|
|
13130
13130
|
try {
|
|
13131
|
-
stats = await
|
|
13131
|
+
stats = await fs21.stat(file2);
|
|
13132
13132
|
} catch {
|
|
13133
13133
|
}
|
|
13134
13134
|
if (stats && stats.isFile()) return;
|
|
13135
13135
|
const dir = path21.dirname(file2);
|
|
13136
13136
|
let dirStats = null;
|
|
13137
13137
|
try {
|
|
13138
|
-
dirStats = await
|
|
13138
|
+
dirStats = await fs21.stat(dir);
|
|
13139
13139
|
} catch (err) {
|
|
13140
13140
|
if (err.code === "ENOENT") {
|
|
13141
13141
|
await mkdir.mkdirs(dir);
|
|
13142
|
-
await
|
|
13142
|
+
await fs21.writeFile(file2, "");
|
|
13143
13143
|
return;
|
|
13144
13144
|
} else {
|
|
13145
13145
|
throw err;
|
|
13146
13146
|
}
|
|
13147
13147
|
}
|
|
13148
13148
|
if (dirStats.isDirectory()) {
|
|
13149
|
-
await
|
|
13149
|
+
await fs21.writeFile(file2, "");
|
|
13150
13150
|
} else {
|
|
13151
|
-
await
|
|
13151
|
+
await fs21.readdir(dir);
|
|
13152
13152
|
}
|
|
13153
13153
|
}
|
|
13154
13154
|
function createFileSync(file2) {
|
|
13155
13155
|
let stats;
|
|
13156
13156
|
try {
|
|
13157
|
-
stats =
|
|
13157
|
+
stats = fs21.statSync(file2);
|
|
13158
13158
|
} catch {
|
|
13159
13159
|
}
|
|
13160
13160
|
if (stats && stats.isFile()) return;
|
|
13161
13161
|
const dir = path21.dirname(file2);
|
|
13162
13162
|
try {
|
|
13163
|
-
if (!
|
|
13164
|
-
|
|
13163
|
+
if (!fs21.statSync(dir).isDirectory()) {
|
|
13164
|
+
fs21.readdirSync(dir);
|
|
13165
13165
|
}
|
|
13166
13166
|
} catch (err) {
|
|
13167
13167
|
if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
|
|
13168
13168
|
else throw err;
|
|
13169
13169
|
}
|
|
13170
|
-
|
|
13170
|
+
fs21.writeFileSync(file2, "");
|
|
13171
13171
|
}
|
|
13172
13172
|
module2.exports = {
|
|
13173
13173
|
createFile: u(createFile),
|
|
@@ -13182,19 +13182,19 @@ var require_link = __commonJS({
|
|
|
13182
13182
|
"use strict";
|
|
13183
13183
|
var u = require_universalify().fromPromise;
|
|
13184
13184
|
var path21 = require("path");
|
|
13185
|
-
var
|
|
13185
|
+
var fs21 = require_fs();
|
|
13186
13186
|
var mkdir = require_mkdirs();
|
|
13187
13187
|
var { pathExists } = require_path_exists();
|
|
13188
13188
|
var { areIdentical } = require_stat();
|
|
13189
13189
|
async function createLink(srcpath, dstpath) {
|
|
13190
13190
|
let dstStat;
|
|
13191
13191
|
try {
|
|
13192
|
-
dstStat = await
|
|
13192
|
+
dstStat = await fs21.lstat(dstpath);
|
|
13193
13193
|
} catch {
|
|
13194
13194
|
}
|
|
13195
13195
|
let srcStat;
|
|
13196
13196
|
try {
|
|
13197
|
-
srcStat = await
|
|
13197
|
+
srcStat = await fs21.lstat(srcpath);
|
|
13198
13198
|
} catch (err) {
|
|
13199
13199
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
13200
13200
|
throw err;
|
|
@@ -13205,26 +13205,26 @@ var require_link = __commonJS({
|
|
|
13205
13205
|
if (!dirExists) {
|
|
13206
13206
|
await mkdir.mkdirs(dir);
|
|
13207
13207
|
}
|
|
13208
|
-
await
|
|
13208
|
+
await fs21.link(srcpath, dstpath);
|
|
13209
13209
|
}
|
|
13210
13210
|
function createLinkSync(srcpath, dstpath) {
|
|
13211
13211
|
let dstStat;
|
|
13212
13212
|
try {
|
|
13213
|
-
dstStat =
|
|
13213
|
+
dstStat = fs21.lstatSync(dstpath);
|
|
13214
13214
|
} catch {
|
|
13215
13215
|
}
|
|
13216
13216
|
try {
|
|
13217
|
-
const srcStat =
|
|
13217
|
+
const srcStat = fs21.lstatSync(srcpath);
|
|
13218
13218
|
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
13219
13219
|
} catch (err) {
|
|
13220
13220
|
err.message = err.message.replace("lstat", "ensureLink");
|
|
13221
13221
|
throw err;
|
|
13222
13222
|
}
|
|
13223
13223
|
const dir = path21.dirname(dstpath);
|
|
13224
|
-
const dirExists =
|
|
13225
|
-
if (dirExists) return
|
|
13224
|
+
const dirExists = fs21.existsSync(dir);
|
|
13225
|
+
if (dirExists) return fs21.linkSync(srcpath, dstpath);
|
|
13226
13226
|
mkdir.mkdirsSync(dir);
|
|
13227
|
-
return
|
|
13227
|
+
return fs21.linkSync(srcpath, dstpath);
|
|
13228
13228
|
}
|
|
13229
13229
|
module2.exports = {
|
|
13230
13230
|
createLink: u(createLink),
|
|
@@ -13238,13 +13238,13 @@ var require_symlink_paths = __commonJS({
|
|
|
13238
13238
|
"../node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
|
|
13239
13239
|
"use strict";
|
|
13240
13240
|
var path21 = require("path");
|
|
13241
|
-
var
|
|
13241
|
+
var fs21 = require_fs();
|
|
13242
13242
|
var { pathExists } = require_path_exists();
|
|
13243
13243
|
var u = require_universalify().fromPromise;
|
|
13244
13244
|
async function symlinkPaths(srcpath, dstpath) {
|
|
13245
13245
|
if (path21.isAbsolute(srcpath)) {
|
|
13246
13246
|
try {
|
|
13247
|
-
await
|
|
13247
|
+
await fs21.lstat(srcpath);
|
|
13248
13248
|
} catch (err) {
|
|
13249
13249
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
13250
13250
|
throw err;
|
|
@@ -13264,7 +13264,7 @@ var require_symlink_paths = __commonJS({
|
|
|
13264
13264
|
};
|
|
13265
13265
|
}
|
|
13266
13266
|
try {
|
|
13267
|
-
await
|
|
13267
|
+
await fs21.lstat(srcpath);
|
|
13268
13268
|
} catch (err) {
|
|
13269
13269
|
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
13270
13270
|
throw err;
|
|
@@ -13276,7 +13276,7 @@ var require_symlink_paths = __commonJS({
|
|
|
13276
13276
|
}
|
|
13277
13277
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
13278
13278
|
if (path21.isAbsolute(srcpath)) {
|
|
13279
|
-
const exists2 =
|
|
13279
|
+
const exists2 = fs21.existsSync(srcpath);
|
|
13280
13280
|
if (!exists2) throw new Error("absolute srcpath does not exist");
|
|
13281
13281
|
return {
|
|
13282
13282
|
toCwd: srcpath,
|
|
@@ -13285,14 +13285,14 @@ var require_symlink_paths = __commonJS({
|
|
|
13285
13285
|
}
|
|
13286
13286
|
const dstdir = path21.dirname(dstpath);
|
|
13287
13287
|
const relativeToDst = path21.join(dstdir, srcpath);
|
|
13288
|
-
const exists =
|
|
13288
|
+
const exists = fs21.existsSync(relativeToDst);
|
|
13289
13289
|
if (exists) {
|
|
13290
13290
|
return {
|
|
13291
13291
|
toCwd: relativeToDst,
|
|
13292
13292
|
toDst: srcpath
|
|
13293
13293
|
};
|
|
13294
13294
|
}
|
|
13295
|
-
const srcExists =
|
|
13295
|
+
const srcExists = fs21.existsSync(srcpath);
|
|
13296
13296
|
if (!srcExists) throw new Error("relative srcpath does not exist");
|
|
13297
13297
|
return {
|
|
13298
13298
|
toCwd: srcpath,
|
|
@@ -13310,13 +13310,13 @@ var require_symlink_paths = __commonJS({
|
|
|
13310
13310
|
var require_symlink_type = __commonJS({
|
|
13311
13311
|
"../node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
|
|
13312
13312
|
"use strict";
|
|
13313
|
-
var
|
|
13313
|
+
var fs21 = require_fs();
|
|
13314
13314
|
var u = require_universalify().fromPromise;
|
|
13315
13315
|
async function symlinkType(srcpath, type) {
|
|
13316
13316
|
if (type) return type;
|
|
13317
13317
|
let stats;
|
|
13318
13318
|
try {
|
|
13319
|
-
stats = await
|
|
13319
|
+
stats = await fs21.lstat(srcpath);
|
|
13320
13320
|
} catch {
|
|
13321
13321
|
return "file";
|
|
13322
13322
|
}
|
|
@@ -13326,7 +13326,7 @@ var require_symlink_type = __commonJS({
|
|
|
13326
13326
|
if (type) return type;
|
|
13327
13327
|
let stats;
|
|
13328
13328
|
try {
|
|
13329
|
-
stats =
|
|
13329
|
+
stats = fs21.lstatSync(srcpath);
|
|
13330
13330
|
} catch {
|
|
13331
13331
|
return "file";
|
|
13332
13332
|
}
|
|
@@ -13345,7 +13345,7 @@ var require_symlink = __commonJS({
|
|
|
13345
13345
|
"use strict";
|
|
13346
13346
|
var u = require_universalify().fromPromise;
|
|
13347
13347
|
var path21 = require("path");
|
|
13348
|
-
var
|
|
13348
|
+
var fs21 = require_fs();
|
|
13349
13349
|
var { mkdirs, mkdirsSync } = require_mkdirs();
|
|
13350
13350
|
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
13351
13351
|
var { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
@@ -13354,13 +13354,13 @@ var require_symlink = __commonJS({
|
|
|
13354
13354
|
async function createSymlink(srcpath, dstpath, type) {
|
|
13355
13355
|
let stats;
|
|
13356
13356
|
try {
|
|
13357
|
-
stats = await
|
|
13357
|
+
stats = await fs21.lstat(dstpath);
|
|
13358
13358
|
} catch {
|
|
13359
13359
|
}
|
|
13360
13360
|
if (stats && stats.isSymbolicLink()) {
|
|
13361
13361
|
const [srcStat, dstStat] = await Promise.all([
|
|
13362
|
-
|
|
13363
|
-
|
|
13362
|
+
fs21.stat(srcpath),
|
|
13363
|
+
fs21.stat(dstpath)
|
|
13364
13364
|
]);
|
|
13365
13365
|
if (areIdentical(srcStat, dstStat)) return;
|
|
13366
13366
|
}
|
|
@@ -13371,27 +13371,27 @@ var require_symlink = __commonJS({
|
|
|
13371
13371
|
if (!await pathExists(dir)) {
|
|
13372
13372
|
await mkdirs(dir);
|
|
13373
13373
|
}
|
|
13374
|
-
return
|
|
13374
|
+
return fs21.symlink(srcpath, dstpath, toType);
|
|
13375
13375
|
}
|
|
13376
13376
|
function createSymlinkSync(srcpath, dstpath, type) {
|
|
13377
13377
|
let stats;
|
|
13378
13378
|
try {
|
|
13379
|
-
stats =
|
|
13379
|
+
stats = fs21.lstatSync(dstpath);
|
|
13380
13380
|
} catch {
|
|
13381
13381
|
}
|
|
13382
13382
|
if (stats && stats.isSymbolicLink()) {
|
|
13383
|
-
const srcStat =
|
|
13384
|
-
const dstStat =
|
|
13383
|
+
const srcStat = fs21.statSync(srcpath);
|
|
13384
|
+
const dstStat = fs21.statSync(dstpath);
|
|
13385
13385
|
if (areIdentical(srcStat, dstStat)) return;
|
|
13386
13386
|
}
|
|
13387
13387
|
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
13388
13388
|
srcpath = relative.toDst;
|
|
13389
13389
|
type = symlinkTypeSync(relative.toCwd, type);
|
|
13390
13390
|
const dir = path21.dirname(dstpath);
|
|
13391
|
-
const exists =
|
|
13392
|
-
if (exists) return
|
|
13391
|
+
const exists = fs21.existsSync(dir);
|
|
13392
|
+
if (exists) return fs21.symlinkSync(srcpath, dstpath, type);
|
|
13393
13393
|
mkdirsSync(dir);
|
|
13394
|
-
return
|
|
13394
|
+
return fs21.symlinkSync(srcpath, dstpath, type);
|
|
13395
13395
|
}
|
|
13396
13396
|
module2.exports = {
|
|
13397
13397
|
createSymlink: u(createSymlink),
|
|
@@ -13460,9 +13460,9 @@ var require_jsonfile = __commonJS({
|
|
|
13460
13460
|
if (typeof options === "string") {
|
|
13461
13461
|
options = { encoding: options };
|
|
13462
13462
|
}
|
|
13463
|
-
const
|
|
13463
|
+
const fs21 = options.fs || _fs;
|
|
13464
13464
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
13465
|
-
let data = await universalify.fromCallback(
|
|
13465
|
+
let data = await universalify.fromCallback(fs21.readFile)(file2, options);
|
|
13466
13466
|
data = stripBom(data);
|
|
13467
13467
|
let obj;
|
|
13468
13468
|
try {
|
|
@@ -13482,10 +13482,10 @@ var require_jsonfile = __commonJS({
|
|
|
13482
13482
|
if (typeof options === "string") {
|
|
13483
13483
|
options = { encoding: options };
|
|
13484
13484
|
}
|
|
13485
|
-
const
|
|
13485
|
+
const fs21 = options.fs || _fs;
|
|
13486
13486
|
const shouldThrow = "throws" in options ? options.throws : true;
|
|
13487
13487
|
try {
|
|
13488
|
-
let content =
|
|
13488
|
+
let content = fs21.readFileSync(file2, options);
|
|
13489
13489
|
content = stripBom(content);
|
|
13490
13490
|
return JSON.parse(content, options.reviver);
|
|
13491
13491
|
} catch (err) {
|
|
@@ -13498,15 +13498,15 @@ var require_jsonfile = __commonJS({
|
|
|
13498
13498
|
}
|
|
13499
13499
|
}
|
|
13500
13500
|
async function _writeFile(file2, obj, options = {}) {
|
|
13501
|
-
const
|
|
13501
|
+
const fs21 = options.fs || _fs;
|
|
13502
13502
|
const str = stringify2(obj, options);
|
|
13503
|
-
await universalify.fromCallback(
|
|
13503
|
+
await universalify.fromCallback(fs21.writeFile)(file2, str, options);
|
|
13504
13504
|
}
|
|
13505
13505
|
var writeFile = universalify.fromPromise(_writeFile);
|
|
13506
13506
|
function writeFileSync2(file2, obj, options = {}) {
|
|
13507
|
-
const
|
|
13507
|
+
const fs21 = options.fs || _fs;
|
|
13508
13508
|
const str = stringify2(obj, options);
|
|
13509
|
-
return
|
|
13509
|
+
return fs21.writeFileSync(file2, str, options);
|
|
13510
13510
|
}
|
|
13511
13511
|
module2.exports = {
|
|
13512
13512
|
readFile,
|
|
@@ -13537,7 +13537,7 @@ var require_output_file = __commonJS({
|
|
|
13537
13537
|
"../node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
|
|
13538
13538
|
"use strict";
|
|
13539
13539
|
var u = require_universalify().fromPromise;
|
|
13540
|
-
var
|
|
13540
|
+
var fs21 = require_fs();
|
|
13541
13541
|
var path21 = require("path");
|
|
13542
13542
|
var mkdir = require_mkdirs();
|
|
13543
13543
|
var pathExists = require_path_exists().pathExists;
|
|
@@ -13546,14 +13546,14 @@ var require_output_file = __commonJS({
|
|
|
13546
13546
|
if (!await pathExists(dir)) {
|
|
13547
13547
|
await mkdir.mkdirs(dir);
|
|
13548
13548
|
}
|
|
13549
|
-
return
|
|
13549
|
+
return fs21.writeFile(file2, data, encoding);
|
|
13550
13550
|
}
|
|
13551
13551
|
function outputFileSync(file2, ...args) {
|
|
13552
13552
|
const dir = path21.dirname(file2);
|
|
13553
|
-
if (!
|
|
13553
|
+
if (!fs21.existsSync(dir)) {
|
|
13554
13554
|
mkdir.mkdirsSync(dir);
|
|
13555
13555
|
}
|
|
13556
|
-
|
|
13556
|
+
fs21.writeFileSync(file2, ...args);
|
|
13557
13557
|
}
|
|
13558
13558
|
module2.exports = {
|
|
13559
13559
|
outputFile: u(outputFile),
|
|
@@ -13612,7 +13612,7 @@ var require_json = __commonJS({
|
|
|
13612
13612
|
var require_move = __commonJS({
|
|
13613
13613
|
"../node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
|
|
13614
13614
|
"use strict";
|
|
13615
|
-
var
|
|
13615
|
+
var fs21 = require_fs();
|
|
13616
13616
|
var path21 = require("path");
|
|
13617
13617
|
var { copy } = require_copy2();
|
|
13618
13618
|
var { remove } = require_remove();
|
|
@@ -13639,7 +13639,7 @@ var require_move = __commonJS({
|
|
|
13639
13639
|
}
|
|
13640
13640
|
}
|
|
13641
13641
|
try {
|
|
13642
|
-
await
|
|
13642
|
+
await fs21.rename(src, dest);
|
|
13643
13643
|
} catch (err) {
|
|
13644
13644
|
if (err.code !== "EXDEV") {
|
|
13645
13645
|
throw err;
|
|
@@ -13664,7 +13664,7 @@ var require_move = __commonJS({
|
|
|
13664
13664
|
var require_move_sync = __commonJS({
|
|
13665
13665
|
"../node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
|
|
13666
13666
|
"use strict";
|
|
13667
|
-
var
|
|
13667
|
+
var fs21 = require_graceful_fs();
|
|
13668
13668
|
var path21 = require("path");
|
|
13669
13669
|
var copySync = require_copy2().copySync;
|
|
13670
13670
|
var removeSync = require_remove().removeSync;
|
|
@@ -13689,12 +13689,12 @@ var require_move_sync = __commonJS({
|
|
|
13689
13689
|
removeSync(dest);
|
|
13690
13690
|
return rename(src, dest, overwrite);
|
|
13691
13691
|
}
|
|
13692
|
-
if (
|
|
13692
|
+
if (fs21.existsSync(dest)) throw new Error("dest already exists.");
|
|
13693
13693
|
return rename(src, dest, overwrite);
|
|
13694
13694
|
}
|
|
13695
13695
|
function rename(src, dest, overwrite) {
|
|
13696
13696
|
try {
|
|
13697
|
-
|
|
13697
|
+
fs21.renameSync(src, dest);
|
|
13698
13698
|
} catch (err) {
|
|
13699
13699
|
if (err.code !== "EXDEV") throw err;
|
|
13700
13700
|
return moveAcrossDevice(src, dest, overwrite);
|
|
@@ -20466,12 +20466,12 @@ var require_dist2 = __commonJS({
|
|
|
20466
20466
|
throw new Error(`Unknown format "${name}"`);
|
|
20467
20467
|
return f;
|
|
20468
20468
|
};
|
|
20469
|
-
function addFormats(ajv, list,
|
|
20469
|
+
function addFormats(ajv, list, fs21, exportName) {
|
|
20470
20470
|
var _a2;
|
|
20471
20471
|
var _b;
|
|
20472
20472
|
(_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = codegen_1._`require("ajv-formats/dist/formats").${exportName}`;
|
|
20473
20473
|
for (const f of list)
|
|
20474
|
-
ajv.addFormat(f,
|
|
20474
|
+
ajv.addFormat(f, fs21[f]);
|
|
20475
20475
|
}
|
|
20476
20476
|
module2.exports = exports2 = formatsPlugin;
|
|
20477
20477
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -31073,7 +31073,7 @@ var require_package = __commonJS({
|
|
|
31073
31073
|
var require_main = __commonJS({
|
|
31074
31074
|
"node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
31075
31075
|
"use strict";
|
|
31076
|
-
var
|
|
31076
|
+
var fs21 = require("fs");
|
|
31077
31077
|
var path21 = require("path");
|
|
31078
31078
|
var os8 = require("os");
|
|
31079
31079
|
var crypto2 = require("crypto");
|
|
@@ -31182,7 +31182,7 @@ var require_main = __commonJS({
|
|
|
31182
31182
|
if (options && options.path && options.path.length > 0) {
|
|
31183
31183
|
if (Array.isArray(options.path)) {
|
|
31184
31184
|
for (const filepath of options.path) {
|
|
31185
|
-
if (
|
|
31185
|
+
if (fs21.existsSync(filepath)) {
|
|
31186
31186
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
31187
31187
|
}
|
|
31188
31188
|
}
|
|
@@ -31192,7 +31192,7 @@ var require_main = __commonJS({
|
|
|
31192
31192
|
} else {
|
|
31193
31193
|
possibleVaultPath = path21.resolve(process.cwd(), ".env.vault");
|
|
31194
31194
|
}
|
|
31195
|
-
if (
|
|
31195
|
+
if (fs21.existsSync(possibleVaultPath)) {
|
|
31196
31196
|
return possibleVaultPath;
|
|
31197
31197
|
}
|
|
31198
31198
|
return null;
|
|
@@ -31241,7 +31241,7 @@ var require_main = __commonJS({
|
|
|
31241
31241
|
const parsedAll = {};
|
|
31242
31242
|
for (const path22 of optionPaths) {
|
|
31243
31243
|
try {
|
|
31244
|
-
const parsed = DotenvModule.parse(
|
|
31244
|
+
const parsed = DotenvModule.parse(fs21.readFileSync(path22, { encoding }));
|
|
31245
31245
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
31246
31246
|
} catch (e) {
|
|
31247
31247
|
if (debug) {
|
|
@@ -41327,16 +41327,27 @@ var import_node_child_process3 = require("child_process");
|
|
|
41327
41327
|
|
|
41328
41328
|
// src/utils/worktree-session.ts
|
|
41329
41329
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
41330
|
-
var import_fs_extra12 = __toESM(require_lib2(), 1);
|
|
41331
41330
|
var import_node_child_process2 = require("child_process");
|
|
41332
41331
|
function randomSlug(len = 4) {
|
|
41333
41332
|
return Math.random().toString(36).slice(2, 2 + len);
|
|
41334
41333
|
}
|
|
41334
|
+
function gitRepoRoot(cwd) {
|
|
41335
|
+
const r = (0, import_node_child_process2.spawnSync)("git", ["rev-parse", "--show-toplevel"], {
|
|
41336
|
+
cwd,
|
|
41337
|
+
stdio: "pipe",
|
|
41338
|
+
encoding: "utf8"
|
|
41339
|
+
});
|
|
41340
|
+
return r.status === 0 ? (r.stdout ?? "").trim() : null;
|
|
41341
|
+
}
|
|
41335
41342
|
async function launchWorktreeSession(opts) {
|
|
41336
41343
|
const { runtime, name } = opts;
|
|
41337
41344
|
const cwd = process.cwd();
|
|
41338
|
-
const repoRoot =
|
|
41339
|
-
|
|
41345
|
+
const repoRoot = gitRepoRoot(cwd);
|
|
41346
|
+
if (!repoRoot) {
|
|
41347
|
+
console.error(kleur_default.red("\n \u2717 Not inside a git repository\n"));
|
|
41348
|
+
process.exit(1);
|
|
41349
|
+
}
|
|
41350
|
+
const cwdBasename = import_node_path5.default.basename(repoRoot);
|
|
41340
41351
|
const slug = name ?? randomSlug(4);
|
|
41341
41352
|
const worktreeName = `${cwdBasename}-xt-${runtime}-${slug}`;
|
|
41342
41353
|
const worktreePath = import_node_path5.default.join(repoRoot, ".xtrm", "worktrees", worktreeName);
|
|
@@ -41346,43 +41357,25 @@ async function launchWorktreeSession(opts) {
|
|
|
41346
41357
|
console.log(kleur_default.dim(` worktree: ${worktreePath}`));
|
|
41347
41358
|
console.log(kleur_default.dim(` branch: ${branchName}
|
|
41348
41359
|
`));
|
|
41349
|
-
const
|
|
41360
|
+
const bdResult = (0, import_node_child_process2.spawnSync)("bd", ["worktree", "create", worktreePath, "--branch", branchName], {
|
|
41350
41361
|
cwd: repoRoot,
|
|
41351
|
-
stdio: "
|
|
41352
|
-
})
|
|
41353
|
-
|
|
41354
|
-
|
|
41355
|
-
|
|
41356
|
-
|
|
41362
|
+
stdio: "inherit"
|
|
41363
|
+
});
|
|
41364
|
+
if (bdResult.error || bdResult.status !== 0) {
|
|
41365
|
+
if (bdResult.status !== 0 && !bdResult.error) {
|
|
41366
|
+
console.log(kleur_default.dim(" beads: no database found, creating worktree without redirect"));
|
|
41367
|
+
}
|
|
41368
|
+
const branchExists = (0, import_node_child_process2.spawnSync)("git", ["rev-parse", "--verify", branchName], {
|
|
41369
|
+
cwd: repoRoot,
|
|
41370
|
+
stdio: "pipe"
|
|
41371
|
+
}).status === 0;
|
|
41372
|
+
const gitArgs = branchExists ? ["worktree", "add", worktreePath, branchName] : ["worktree", "add", "-b", branchName, worktreePath];
|
|
41373
|
+
const gitResult = (0, import_node_child_process2.spawnSync)("git", gitArgs, { cwd: repoRoot, stdio: "inherit" });
|
|
41374
|
+
if (gitResult.status !== 0) {
|
|
41375
|
+
console.error(kleur_default.red(`
|
|
41357
41376
|
\u2717 Failed to create worktree at ${worktreePath}
|
|
41358
41377
|
`));
|
|
41359
|
-
|
|
41360
|
-
}
|
|
41361
|
-
const mainBeadsDir = import_node_path5.default.join(repoRoot, ".beads");
|
|
41362
|
-
const worktreeBeadsDir = import_node_path5.default.join(worktreePath, ".beads");
|
|
41363
|
-
const mainPortFile = import_node_path5.default.join(mainBeadsDir, "dolt-server.port");
|
|
41364
|
-
if (await import_fs_extra12.default.pathExists(mainBeadsDir)) {
|
|
41365
|
-
let mainPort = null;
|
|
41366
|
-
if (await import_fs_extra12.default.pathExists(mainPortFile)) {
|
|
41367
|
-
mainPort = (await import_fs_extra12.default.readFile(mainPortFile, "utf8")).trim();
|
|
41368
|
-
} else {
|
|
41369
|
-
const statusResult = (0, import_node_child_process2.spawnSync)("bd", ["dolt", "status"], {
|
|
41370
|
-
cwd: repoRoot,
|
|
41371
|
-
stdio: "pipe",
|
|
41372
|
-
encoding: "utf8"
|
|
41373
|
-
});
|
|
41374
|
-
const portMatch = (statusResult.stdout ?? "").match(/Port:\s*(\d+)/);
|
|
41375
|
-
if (portMatch) {
|
|
41376
|
-
mainPort = portMatch[1];
|
|
41377
|
-
await import_fs_extra12.default.writeFile(mainPortFile, mainPort, "utf8");
|
|
41378
|
-
}
|
|
41379
|
-
}
|
|
41380
|
-
if (mainPort) {
|
|
41381
|
-
await import_fs_extra12.default.ensureDir(worktreeBeadsDir);
|
|
41382
|
-
await import_fs_extra12.default.writeFile(import_node_path5.default.join(worktreeBeadsDir, "dolt-server.port"), mainPort, "utf8");
|
|
41383
|
-
console.log(kleur_default.dim(` beads: redirected to main server (port ${mainPort})`));
|
|
41384
|
-
} else {
|
|
41385
|
-
console.log(kleur_default.dim(" beads: main Dolt server not running, worktree will use isolated db"));
|
|
41378
|
+
process.exit(1);
|
|
41386
41379
|
}
|
|
41387
41380
|
}
|
|
41388
41381
|
console.log(kleur_default.green(`
|
|
@@ -41486,11 +41479,11 @@ function createClaudeCommand() {
|
|
|
41486
41479
|
var import_path13 = __toESM(require("path"), 1);
|
|
41487
41480
|
var import_node_child_process5 = require("child_process");
|
|
41488
41481
|
var import_node_os6 = require("os");
|
|
41489
|
-
var
|
|
41482
|
+
var import_fs_extra13 = __toESM(require_lib2(), 1);
|
|
41490
41483
|
|
|
41491
41484
|
// src/commands/install-pi.ts
|
|
41492
41485
|
var import_prompts3 = __toESM(require_prompts3(), 1);
|
|
41493
|
-
var
|
|
41486
|
+
var import_fs_extra12 = __toESM(require_lib2(), 1);
|
|
41494
41487
|
var import_path12 = __toESM(require("path"), 1);
|
|
41495
41488
|
var import_node_child_process4 = require("child_process");
|
|
41496
41489
|
var import_node_os5 = require("os");
|
|
@@ -41519,14 +41512,14 @@ function isPiInstalled2() {
|
|
|
41519
41512
|
return (0, import_node_child_process4.spawnSync)("pi", ["--version"], { encoding: "utf8" }).status === 0;
|
|
41520
41513
|
}
|
|
41521
41514
|
async function listExtensionDirs2(baseDir) {
|
|
41522
|
-
if (!await
|
|
41523
|
-
const entries = await
|
|
41515
|
+
if (!await import_fs_extra12.default.pathExists(baseDir)) return [];
|
|
41516
|
+
const entries = await import_fs_extra12.default.readdir(baseDir, { withFileTypes: true });
|
|
41524
41517
|
const extDirs = [];
|
|
41525
41518
|
for (const entry of entries) {
|
|
41526
41519
|
if (!entry.isDirectory()) continue;
|
|
41527
41520
|
const extPath = import_path12.default.join(baseDir, entry.name);
|
|
41528
41521
|
const pkgPath = import_path12.default.join(extPath, "package.json");
|
|
41529
|
-
if (await
|
|
41522
|
+
if (await import_fs_extra12.default.pathExists(pkgPath)) {
|
|
41530
41523
|
extDirs.push(entry.name);
|
|
41531
41524
|
}
|
|
41532
41525
|
}
|
|
@@ -41534,17 +41527,17 @@ async function listExtensionDirs2(baseDir) {
|
|
|
41534
41527
|
}
|
|
41535
41528
|
async function fileSha256(filePath) {
|
|
41536
41529
|
const crypto2 = await import("crypto");
|
|
41537
|
-
const content = await
|
|
41530
|
+
const content = await import_fs_extra12.default.readFile(filePath);
|
|
41538
41531
|
return crypto2.createHash("sha256").update(content).digest("hex");
|
|
41539
41532
|
}
|
|
41540
41533
|
async function extensionHash(extDir) {
|
|
41541
41534
|
const pkgPath = import_path12.default.join(extDir, "package.json");
|
|
41542
41535
|
const indexPath = import_path12.default.join(extDir, "index.ts");
|
|
41543
41536
|
const hashes = [];
|
|
41544
|
-
if (await
|
|
41537
|
+
if (await import_fs_extra12.default.pathExists(pkgPath)) {
|
|
41545
41538
|
hashes.push(await fileSha256(pkgPath));
|
|
41546
41539
|
}
|
|
41547
|
-
if (await
|
|
41540
|
+
if (await import_fs_extra12.default.pathExists(indexPath)) {
|
|
41548
41541
|
hashes.push(await fileSha256(indexPath));
|
|
41549
41542
|
}
|
|
41550
41543
|
return hashes.join(":");
|
|
@@ -41559,12 +41552,12 @@ async function diffPiExtensions(sourceDir, targetDir) {
|
|
|
41559
41552
|
for (const extName of sourceExts) {
|
|
41560
41553
|
const srcExtPath = import_path12.default.join(sourceAbs, extName);
|
|
41561
41554
|
const dstExtPath = import_path12.default.join(targetAbs, extName);
|
|
41562
|
-
if (!await
|
|
41555
|
+
if (!await import_fs_extra12.default.pathExists(dstExtPath)) {
|
|
41563
41556
|
missing.push(extName);
|
|
41564
41557
|
continue;
|
|
41565
41558
|
}
|
|
41566
41559
|
const dstPkgPath = import_path12.default.join(dstExtPath, "package.json");
|
|
41567
|
-
if (!await
|
|
41560
|
+
if (!await import_fs_extra12.default.pathExists(dstPkgPath)) {
|
|
41568
41561
|
missing.push(extName);
|
|
41569
41562
|
continue;
|
|
41570
41563
|
}
|
|
@@ -41629,7 +41622,7 @@ function createInstallPiCommand() {
|
|
|
41629
41622
|
console.log(t.success(` pi ${v.stdout.trim()} already installed
|
|
41630
41623
|
`));
|
|
41631
41624
|
}
|
|
41632
|
-
const schema = await
|
|
41625
|
+
const schema = await import_fs_extra12.default.readJson(import_path12.default.join(piConfigDir, "install-schema.json"));
|
|
41633
41626
|
const existing = readExistingPiValues(PI_AGENT_DIR2);
|
|
41634
41627
|
const values = { ...existing };
|
|
41635
41628
|
console.log(t.bold(" API Keys\n"));
|
|
@@ -41645,23 +41638,23 @@ function createInstallPiCommand() {
|
|
|
41645
41638
|
const { value } = await (0, import_prompts3.default)({ type: field.secret ? "password" : "text", name: "value", message: ` ${field.label}`, hint: field.hint, validate: (v) => field.required && !v ? "Required" : true });
|
|
41646
41639
|
if (value) values[field.key] = value;
|
|
41647
41640
|
}
|
|
41648
|
-
await
|
|
41641
|
+
await import_fs_extra12.default.ensureDir(PI_AGENT_DIR2);
|
|
41649
41642
|
console.log(t.muted(`
|
|
41650
41643
|
Writing config to ${PI_AGENT_DIR2}`));
|
|
41651
41644
|
for (const name of ["models.json", "auth.json", "settings.json"]) {
|
|
41652
41645
|
const destPath = import_path12.default.join(PI_AGENT_DIR2, name);
|
|
41653
|
-
if (name === "auth.json" && await
|
|
41646
|
+
if (name === "auth.json" && await import_fs_extra12.default.pathExists(destPath) && !yes) {
|
|
41654
41647
|
const { overwrite } = await (0, import_prompts3.default)({ type: "confirm", name: "overwrite", message: ` ${name} already exists \u2014 overwrite? (OAuth tokens will be lost)`, initial: false });
|
|
41655
41648
|
if (!overwrite) {
|
|
41656
41649
|
console.log(t.muted(` skipped ${name}`));
|
|
41657
41650
|
continue;
|
|
41658
41651
|
}
|
|
41659
41652
|
}
|
|
41660
|
-
const raw = await
|
|
41661
|
-
await
|
|
41653
|
+
const raw = await import_fs_extra12.default.readFile(import_path12.default.join(piConfigDir, `${name}.template`), "utf8");
|
|
41654
|
+
await import_fs_extra12.default.writeFile(destPath, fillTemplate(raw, values), "utf8");
|
|
41662
41655
|
console.log(t.success(` ${sym.ok} ${name}`));
|
|
41663
41656
|
}
|
|
41664
|
-
await
|
|
41657
|
+
await import_fs_extra12.default.copy(import_path12.default.join(piConfigDir, "extensions"), import_path12.default.join(PI_AGENT_DIR2, "extensions"), { overwrite: true });
|
|
41665
41658
|
console.log(t.success(` ${sym.ok} extensions/`));
|
|
41666
41659
|
const extDirs = await listExtensionDirs2(import_path12.default.join(PI_AGENT_DIR2, "extensions"));
|
|
41667
41660
|
if (extDirs.length > 0) {
|
|
@@ -41750,10 +41743,10 @@ function createPiCommand() {
|
|
|
41750
41743
|
allOk = false;
|
|
41751
41744
|
}
|
|
41752
41745
|
const schemaPath = import_path13.default.join(piConfigDir, "install-schema.json");
|
|
41753
|
-
if (await
|
|
41746
|
+
if (await import_fs_extra13.default.pathExists(schemaPath)) {
|
|
41754
41747
|
try {
|
|
41755
41748
|
(0, import_node_child_process5.execSync)("pi --version", { stdio: "ignore" });
|
|
41756
|
-
const schema = await
|
|
41749
|
+
const schema = await import_fs_extra13.default.readJson(schemaPath);
|
|
41757
41750
|
const listResult = (0, import_node_child_process5.spawnSync)("pi", ["list"], { encoding: "utf8", stdio: "pipe" });
|
|
41758
41751
|
const installed = listResult.stdout ?? "";
|
|
41759
41752
|
const missing = schema.packages.filter((p) => !installed.includes(p.replace("npm:", "")));
|
|
@@ -41782,18 +41775,18 @@ function createPiCommand() {
|
|
|
41782
41775
|
|
|
41783
41776
|
// src/commands/init.ts
|
|
41784
41777
|
var import_path15 = __toESM(require("path"), 1);
|
|
41785
|
-
var
|
|
41778
|
+
var import_fs_extra15 = __toESM(require_lib2(), 1);
|
|
41786
41779
|
var import_child_process4 = require("child_process");
|
|
41787
41780
|
|
|
41788
41781
|
// src/commands/install-service-skills.ts
|
|
41789
41782
|
var import_path14 = __toESM(require("path"), 1);
|
|
41790
|
-
var
|
|
41783
|
+
var import_fs_extra14 = __toESM(require_lib2(), 1);
|
|
41791
41784
|
function resolvePkgRoot() {
|
|
41792
41785
|
const candidates = [
|
|
41793
41786
|
import_path14.default.resolve(__dirname, "../.."),
|
|
41794
41787
|
import_path14.default.resolve(__dirname, "../../..")
|
|
41795
41788
|
];
|
|
41796
|
-
const match = candidates.find((candidate) =>
|
|
41789
|
+
const match = candidates.find((candidate) => import_fs_extra14.default.existsSync(import_path14.default.join(candidate, "project-skills")));
|
|
41797
41790
|
if (!match) {
|
|
41798
41791
|
throw new Error("Unable to locate project-skills directory from CLI runtime.");
|
|
41799
41792
|
}
|
|
@@ -41808,7 +41801,7 @@ function resolvePkgRoot2() {
|
|
|
41808
41801
|
import_path15.default.resolve(__dirname, "../.."),
|
|
41809
41802
|
import_path15.default.resolve(__dirname, "../../..")
|
|
41810
41803
|
];
|
|
41811
|
-
const match = candidates.find((candidate) =>
|
|
41804
|
+
const match = candidates.find((candidate) => import_fs_extra15.default.existsSync(import_path15.default.join(candidate, "project-skills")));
|
|
41812
41805
|
if (!match) {
|
|
41813
41806
|
throw new Error("Unable to locate project-skills directory from CLI runtime.");
|
|
41814
41807
|
}
|
|
@@ -41820,9 +41813,6 @@ var MCP_CORE_CONFIG_PATH = import_path15.default.join(PKG_ROOT2, "config", "mcp_
|
|
|
41820
41813
|
var INSTRUCTIONS_DIR = import_path15.default.join(PKG_ROOT2, "config", "instructions");
|
|
41821
41814
|
var XTRM_BLOCK_START = "<!-- xtrm:start -->";
|
|
41822
41815
|
var XTRM_BLOCK_END = "<!-- xtrm:end -->";
|
|
41823
|
-
function toServiceId(name) {
|
|
41824
|
-
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "service";
|
|
41825
|
-
}
|
|
41826
41816
|
function parseComposeServices(content) {
|
|
41827
41817
|
const lines = content.split("\n");
|
|
41828
41818
|
const services = /* @__PURE__ */ new Set();
|
|
@@ -41846,8 +41836,8 @@ function parseComposeServices(content) {
|
|
|
41846
41836
|
return [...services];
|
|
41847
41837
|
}
|
|
41848
41838
|
async function detectProjectFeatures(projectRoot) {
|
|
41849
|
-
const hasTypeScript = await
|
|
41850
|
-
const hasPython = await
|
|
41839
|
+
const hasTypeScript = await import_fs_extra15.default.pathExists(import_path15.default.join(projectRoot, "tsconfig.json"));
|
|
41840
|
+
const hasPython = await import_fs_extra15.default.pathExists(import_path15.default.join(projectRoot, "pyproject.toml")) || await import_fs_extra15.default.pathExists(import_path15.default.join(projectRoot, "setup.py")) || await import_fs_extra15.default.pathExists(import_path15.default.join(projectRoot, "requirements.txt"));
|
|
41851
41841
|
const composeCandidates = [
|
|
41852
41842
|
"docker-compose.yml",
|
|
41853
41843
|
"docker-compose.yaml",
|
|
@@ -41857,16 +41847,16 @@ async function detectProjectFeatures(projectRoot) {
|
|
|
41857
41847
|
const dockerServices = /* @__PURE__ */ new Set();
|
|
41858
41848
|
for (const composeFile of composeCandidates) {
|
|
41859
41849
|
const composePath = import_path15.default.join(projectRoot, composeFile);
|
|
41860
|
-
if (!await
|
|
41850
|
+
if (!await import_fs_extra15.default.pathExists(composePath)) continue;
|
|
41861
41851
|
try {
|
|
41862
|
-
const content = await
|
|
41852
|
+
const content = await import_fs_extra15.default.readFile(composePath, "utf8");
|
|
41863
41853
|
for (const service of parseComposeServices(content)) {
|
|
41864
41854
|
dockerServices.add(service);
|
|
41865
41855
|
}
|
|
41866
41856
|
} catch {
|
|
41867
41857
|
}
|
|
41868
41858
|
}
|
|
41869
|
-
const hasDockerfile = await
|
|
41859
|
+
const hasDockerfile = await import_fs_extra15.default.pathExists(import_path15.default.join(projectRoot, "Dockerfile"));
|
|
41870
41860
|
if (hasDockerfile && dockerServices.size === 0) {
|
|
41871
41861
|
dockerServices.add(import_path15.default.basename(projectRoot));
|
|
41872
41862
|
}
|
|
@@ -41877,42 +41867,6 @@ async function detectProjectFeatures(projectRoot) {
|
|
|
41877
41867
|
generatedRegistry: false
|
|
41878
41868
|
};
|
|
41879
41869
|
}
|
|
41880
|
-
async function ensureServiceRegistry(projectRoot, services) {
|
|
41881
|
-
const registryPath = import_path15.default.join(projectRoot, "service-registry.json");
|
|
41882
|
-
if (services.length === 0) {
|
|
41883
|
-
return { generated: false, registryPath };
|
|
41884
|
-
}
|
|
41885
|
-
const existedBefore = await import_fs_extra16.default.pathExists(registryPath);
|
|
41886
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
41887
|
-
let registry2 = { version: "1.0.0", services: {} };
|
|
41888
|
-
if (existedBefore) {
|
|
41889
|
-
try {
|
|
41890
|
-
registry2 = await import_fs_extra16.default.readJson(registryPath);
|
|
41891
|
-
if (!registry2.services || typeof registry2.services !== "object") {
|
|
41892
|
-
registry2.services = {};
|
|
41893
|
-
}
|
|
41894
|
-
} catch {
|
|
41895
|
-
registry2 = { version: "1.0.0", services: {} };
|
|
41896
|
-
}
|
|
41897
|
-
}
|
|
41898
|
-
let changed = false;
|
|
41899
|
-
for (const serviceName of services) {
|
|
41900
|
-
const serviceId = toServiceId(serviceName);
|
|
41901
|
-
if (registry2.services[serviceId]) continue;
|
|
41902
|
-
registry2.services[serviceId] = {
|
|
41903
|
-
name: serviceName,
|
|
41904
|
-
description: `Detected from Docker configuration (${serviceName}).`,
|
|
41905
|
-
territory: [],
|
|
41906
|
-
skill_path: `.claude/skills/${serviceId}/SKILL.md`,
|
|
41907
|
-
last_sync: now
|
|
41908
|
-
};
|
|
41909
|
-
changed = true;
|
|
41910
|
-
}
|
|
41911
|
-
if (changed || !existedBefore) {
|
|
41912
|
-
await import_fs_extra16.default.writeJson(registryPath, registry2, { spaces: 2 });
|
|
41913
|
-
}
|
|
41914
|
-
return { generated: changed || !existedBefore, registryPath };
|
|
41915
|
-
}
|
|
41916
41870
|
function upsertManagedBlock(fileContent, blockBody, startMarker = XTRM_BLOCK_START, endMarker = XTRM_BLOCK_END) {
|
|
41917
41871
|
const normalizedBody = blockBody.trim();
|
|
41918
41872
|
const managedBlock = `${startMarker}
|
|
@@ -41939,19 +41893,19 @@ async function injectProjectInstructionHeaders(projectRoot) {
|
|
|
41939
41893
|
console.log(kleur_default.bold("Injecting xtrm agent instruction headers..."));
|
|
41940
41894
|
for (const target of targets) {
|
|
41941
41895
|
const templatePath = import_path15.default.join(INSTRUCTIONS_DIR, target.template);
|
|
41942
|
-
if (!await
|
|
41896
|
+
if (!await import_fs_extra15.default.pathExists(templatePath)) {
|
|
41943
41897
|
console.log(kleur_default.yellow(` \u26A0 Missing template: ${target.template}`));
|
|
41944
41898
|
continue;
|
|
41945
41899
|
}
|
|
41946
|
-
const template = await
|
|
41900
|
+
const template = await import_fs_extra15.default.readFile(templatePath, "utf8");
|
|
41947
41901
|
const outputPath = import_path15.default.join(projectRoot, target.output);
|
|
41948
|
-
const existing = await
|
|
41902
|
+
const existing = await import_fs_extra15.default.pathExists(outputPath) ? await import_fs_extra15.default.readFile(outputPath, "utf8") : "";
|
|
41949
41903
|
const next = upsertManagedBlock(existing, template);
|
|
41950
41904
|
if (next === existing) {
|
|
41951
41905
|
console.log(kleur_default.dim(` \u2713 ${target.output} already up to date`));
|
|
41952
41906
|
continue;
|
|
41953
41907
|
}
|
|
41954
|
-
await
|
|
41908
|
+
await import_fs_extra15.default.writeFile(outputPath, next.endsWith("\n") ? next : `${next}
|
|
41955
41909
|
`, "utf8");
|
|
41956
41910
|
console.log(`${kleur_default.green(" \u2713")} updated ${target.output}`);
|
|
41957
41911
|
}
|
|
@@ -41964,15 +41918,14 @@ function buildProjectInitGuide() {
|
|
|
41964
41918
|
kleur_default.dim(" xtrm init (alias: xtrm project init)"),
|
|
41965
41919
|
kleur_default.dim(" - Initializes beads workspace (bd init)"),
|
|
41966
41920
|
kleur_default.dim(" - Refreshes GitNexus index if missing/stale"),
|
|
41967
|
-
kleur_default.dim(" -
|
|
41968
|
-
kleur_default.dim(" - Detects
|
|
41969
|
-
kleur_default.dim(" - Scaffolds service-registry.json when Docker services are detected"),
|
|
41921
|
+
kleur_default.dim(" - Injects XTRM workflow headers into AGENTS.md + CLAUDE.md"),
|
|
41922
|
+
kleur_default.dim(" - Detects TypeScript/Python project signals"),
|
|
41970
41923
|
"",
|
|
41971
41924
|
`${kleur_default.cyan("2) What is already global (no per-project install needed):")}`,
|
|
41972
|
-
kleur_default.dim(" - quality gates hooks (
|
|
41973
|
-
kleur_default.dim(" -
|
|
41974
|
-
kleur_default.dim(" -
|
|
41975
|
-
kleur_default.dim(" -
|
|
41925
|
+
kleur_default.dim(" - quality gates hooks (ESLint/tsc/ruff/mypy on every edit)"),
|
|
41926
|
+
kleur_default.dim(" - beads workflow gates (edit/commit/stop/memory enforcement)"),
|
|
41927
|
+
kleur_default.dim(" - session-flow gates (claim sync, stop gate, xt end reminder)"),
|
|
41928
|
+
kleur_default.dim(" - service-skills routing and drift checks"),
|
|
41976
41929
|
"",
|
|
41977
41930
|
`${kleur_default.cyan("3) Configure repo quality tools (hooks enforce what exists):")}`,
|
|
41978
41931
|
kleur_default.dim(" - TS: eslint + prettier + tsc"),
|
|
@@ -42012,27 +41965,12 @@ async function bootstrapProjectInit() {
|
|
|
42012
41965
|
await runBdInitForProject(projectRoot);
|
|
42013
41966
|
await injectProjectInstructionHeaders(projectRoot);
|
|
42014
41967
|
await runGitNexusInitForProject(projectRoot);
|
|
42015
|
-
if (detected.dockerServices.length > 0) {
|
|
42016
|
-
const { generated, registryPath } = await ensureServiceRegistry(projectRoot, detected.dockerServices);
|
|
42017
|
-
detected.generatedRegistry = generated;
|
|
42018
|
-
detected.registryPath = registryPath;
|
|
42019
|
-
if (generated) {
|
|
42020
|
-
console.log(`${kleur_default.green(" \u2713")} service registry scaffolded at ${import_path15.default.relative(projectRoot, registryPath)}`);
|
|
42021
|
-
} else {
|
|
42022
|
-
console.log(kleur_default.dim(" \u2713 service-registry.json already includes detected services"));
|
|
42023
|
-
}
|
|
42024
|
-
}
|
|
42025
41968
|
const projectTypes = [];
|
|
42026
41969
|
if (detected.hasTypeScript) projectTypes.push("TypeScript");
|
|
42027
41970
|
if (detected.hasPython) projectTypes.push("Python");
|
|
42028
|
-
if (detected.dockerServices.length > 0) projectTypes.push("Docker");
|
|
42029
41971
|
console.log(kleur_default.bold("\nProject initialized."));
|
|
42030
41972
|
console.log(kleur_default.white(` Quality gates active globally.`));
|
|
42031
41973
|
console.log(kleur_default.white(` Project types: ${projectTypes.length > 0 ? projectTypes.join(", ") : "none detected"}.`));
|
|
42032
|
-
console.log(kleur_default.white(` Services detected: ${detected.dockerServices.length > 0 ? detected.dockerServices.join(", ") : "none"}.`));
|
|
42033
|
-
if (detected.registryPath) {
|
|
42034
|
-
console.log(kleur_default.dim(` Service registry: ${detected.registryPath}`));
|
|
42035
|
-
}
|
|
42036
41974
|
console.log("");
|
|
42037
41975
|
}
|
|
42038
41976
|
async function runBdInitForProject(projectRoot) {
|
|
@@ -55927,7 +55865,7 @@ function getManifestPath(projectDir) {
|
|
|
55927
55865
|
}
|
|
55928
55866
|
|
|
55929
55867
|
// src/commands/status.ts
|
|
55930
|
-
var
|
|
55868
|
+
var import_fs_extra16 = __toESM(require_lib2(), 1);
|
|
55931
55869
|
var import_path17 = __toESM(require("path"), 1);
|
|
55932
55870
|
function formatTargetLabel2(target) {
|
|
55933
55871
|
const normalized = target.replace(/\\/g, "/").toLowerCase();
|
|
@@ -55953,7 +55891,7 @@ function createStatusCommand() {
|
|
|
55953
55891
|
const candidates = getCandidatePaths();
|
|
55954
55892
|
const targets = [];
|
|
55955
55893
|
for (const c of candidates) {
|
|
55956
|
-
if (await
|
|
55894
|
+
if (await import_fs_extra16.default.pathExists(c.path)) targets.push(c.path);
|
|
55957
55895
|
}
|
|
55958
55896
|
if (targets.length === 0) {
|
|
55959
55897
|
console.log(kleur_default.yellow("\n No agent environments found (~/.claude, ~/.agents/skills)\n"));
|
|
@@ -55964,8 +55902,8 @@ function createStatusCommand() {
|
|
|
55964
55902
|
const manifestPath = getManifestPath(target);
|
|
55965
55903
|
let lastSync = null;
|
|
55966
55904
|
try {
|
|
55967
|
-
if (await
|
|
55968
|
-
const manifest = await
|
|
55905
|
+
if (await import_fs_extra16.default.pathExists(manifestPath)) {
|
|
55906
|
+
const manifest = await import_fs_extra16.default.readJson(manifestPath);
|
|
55969
55907
|
if (manifest.lastSync) lastSync = manifest.lastSync;
|
|
55970
55908
|
}
|
|
55971
55909
|
} catch {
|
|
@@ -56058,45 +55996,43 @@ function createResetCommand() {
|
|
|
56058
55996
|
|
|
56059
55997
|
// src/commands/help.ts
|
|
56060
55998
|
var import_path18 = __toESM(require("path"), 1);
|
|
56061
|
-
var
|
|
55999
|
+
var import_fs_extra17 = __toESM(require_lib2(), 1);
|
|
56062
56000
|
var HOOK_CATALOG = [
|
|
56063
|
-
{ file: "
|
|
56064
|
-
{ file: "main-guard-post-push.mjs", event: "PostToolUse", desc: "After feature-branch push, reminds PR/merge/sync steps" },
|
|
56001
|
+
{ file: "using-xtrm-reminder.mjs", event: "SessionStart", desc: "Injects using-xtrm session operating manual into system prompt" },
|
|
56065
56002
|
{ file: "serena-workflow-reminder.py", event: "SessionStart", desc: "Injects Serena semantic editing workflow reminder" },
|
|
56066
56003
|
{ file: "gitnexus/gitnexus-hook.cjs", event: "PostToolUse", desc: "Adds GitNexus context for search and Serena tooling" },
|
|
56067
|
-
{ file: "agent_context.py", event: "Support module", desc: "Shared hook I/O helper used by Python hook scripts" },
|
|
56068
|
-
{ file: "beads-edit-gate.mjs", event: "PreToolUse", desc: "Blocks file edits if no beads issue is claimed", beads: true },
|
|
56069
|
-
{ file: "beads-commit-gate.mjs", event: "PreToolUse", desc: "Blocks commits when no beads issue is in progress", beads: true },
|
|
56070
|
-
{ file: "beads-memory-gate.mjs", event: "Stop", desc: "Prompts memory save when claim was closed", beads: true },
|
|
56071
|
-
{ file: "beads-compact-save.mjs", event: "PreCompact", desc: "Saves in_progress issue + session-state bundle", beads: true },
|
|
56072
|
-
{ file: "beads-compact-restore.mjs", event: "SessionStart", desc: "Restores compacted issue + session-state bundle", beads: true },
|
|
56073
|
-
{ file: "beads-claim-sync.mjs", event: "PostToolUse", desc: "Auto-claim sync + worktree/session-state bootstrap", sessionFlow: true },
|
|
56074
|
-
{ file: "beads-stop-gate.mjs", event: "Stop", desc: "Blocks stop for waiting-merge/conflicting/pending-cleanup", sessionFlow: true },
|
|
56075
56004
|
{ file: "branch-state.mjs", event: "UserPromptSubmit", desc: "Injects current git branch into prompt context" },
|
|
56076
56005
|
{ file: "quality-check.cjs", event: "PostToolUse", desc: "Runs JS/TS quality checks on mutating edits" },
|
|
56077
|
-
{ file: "quality-check.py", event: "PostToolUse", desc: "Runs Python quality checks on mutating edits" }
|
|
56006
|
+
{ file: "quality-check.py", event: "PostToolUse", desc: "Runs Python quality checks on mutating edits" },
|
|
56007
|
+
{ file: "beads-edit-gate.mjs", event: "PreToolUse", desc: "Blocks file edits if no beads issue is claimed", beads: true },
|
|
56008
|
+
{ file: "beads-commit-gate.mjs", event: "PreToolUse", desc: "Blocks commits when no beads issue is in progress", beads: true },
|
|
56009
|
+
{ file: "beads-stop-gate.mjs", event: "Stop", desc: "Blocks stop when there is an unclosed in_progress claim", beads: true },
|
|
56010
|
+
{ file: "beads-memory-gate.mjs", event: "Stop", desc: "Prompts memory save when claim was closed this session", beads: true },
|
|
56011
|
+
{ file: "beads-compact-save.mjs", event: "PreCompact", desc: "Saves claim state across /compact", beads: true },
|
|
56012
|
+
{ file: "beads-compact-restore.mjs", event: "SessionStart", desc: "Restores claim state after /compact", beads: true },
|
|
56013
|
+
{ file: "beads-claim-sync.mjs", event: "PostToolUse", desc: "Notifies on bd update --claim; auto-commits on bd close", sessionFlow: true }
|
|
56078
56014
|
];
|
|
56079
56015
|
async function readSkillsFromDir(dir) {
|
|
56080
|
-
if (!await
|
|
56081
|
-
const entries = await
|
|
56016
|
+
if (!await import_fs_extra17.default.pathExists(dir)) return [];
|
|
56017
|
+
const entries = await import_fs_extra17.default.readdir(dir);
|
|
56082
56018
|
const skills = [];
|
|
56083
56019
|
for (const name of entries.sort()) {
|
|
56084
56020
|
const skillMd = import_path18.default.join(dir, name, "SKILL.md");
|
|
56085
|
-
if (!await
|
|
56086
|
-
const content = await
|
|
56021
|
+
if (!await import_fs_extra17.default.pathExists(skillMd)) continue;
|
|
56022
|
+
const content = await import_fs_extra17.default.readFile(skillMd, "utf8");
|
|
56087
56023
|
const m = content.match(/^description:\s*(.+)$/m);
|
|
56088
56024
|
skills.push({ name, desc: m ? m[1].replace(/^["']|["']$/g, "").trim() : "" });
|
|
56089
56025
|
}
|
|
56090
56026
|
return skills;
|
|
56091
56027
|
}
|
|
56092
56028
|
async function readProjectSkillsFromDir(dir) {
|
|
56093
|
-
if (!await
|
|
56094
|
-
const entries = await
|
|
56029
|
+
if (!await import_fs_extra17.default.pathExists(dir)) return [];
|
|
56030
|
+
const entries = await import_fs_extra17.default.readdir(dir);
|
|
56095
56031
|
const skills = [];
|
|
56096
56032
|
for (const name of entries.sort()) {
|
|
56097
56033
|
const readme = import_path18.default.join(dir, name, "README.md");
|
|
56098
|
-
if (!await
|
|
56099
|
-
const content = await
|
|
56034
|
+
if (!await import_fs_extra17.default.pathExists(readme)) continue;
|
|
56035
|
+
const content = await import_fs_extra17.default.readFile(readme, "utf8");
|
|
56100
56036
|
const descLine = content.split("\n").find((line) => {
|
|
56101
56037
|
const trimmed = line.trim();
|
|
56102
56038
|
return Boolean(trimmed) && !trimmed.startsWith("#") && !trimmed.startsWith("[") && !trimmed.startsWith("<");
|
|
@@ -56111,7 +56047,7 @@ function resolvePkgRootFallback() {
|
|
|
56111
56047
|
import_path18.default.resolve(__dirname, "../../..")
|
|
56112
56048
|
];
|
|
56113
56049
|
const match = candidates.find(
|
|
56114
|
-
(candidate) =>
|
|
56050
|
+
(candidate) => import_fs_extra17.default.existsSync(import_path18.default.join(candidate, "skills")) || import_fs_extra17.default.existsSync(import_path18.default.join(candidate, "project-skills"))
|
|
56115
56051
|
);
|
|
56116
56052
|
return match || null;
|
|
56117
56053
|
}
|
|
@@ -56174,7 +56110,7 @@ ${hr}`;
|
|
|
56174
56110
|
` ${kleur_default.dim("beads gate hooks (xtrm install all -- require beads+dolt):")}`,
|
|
56175
56111
|
hookRows(beads),
|
|
56176
56112
|
"",
|
|
56177
|
-
` ${kleur_default.dim("session-flow hooks
|
|
56113
|
+
` ${kleur_default.dim("session-flow hooks:")}`,
|
|
56178
56114
|
hookRows(sessionFlow)
|
|
56179
56115
|
].join("\n");
|
|
56180
56116
|
const skillRows = skills.map((s) => {
|
|
@@ -56200,10 +56136,14 @@ ${hr}`;
|
|
|
56200
56136
|
const otherSection = [
|
|
56201
56137
|
section("OTHER COMMANDS"),
|
|
56202
56138
|
"",
|
|
56203
|
-
` ${kleur_default.bold("xtrm status")}
|
|
56204
|
-
` ${kleur_default.bold("xtrm
|
|
56205
|
-
` ${kleur_default.bold("xtrm
|
|
56206
|
-
` ${kleur_default.bold("xtrm
|
|
56139
|
+
` ${kleur_default.bold("xtrm status")} ${kleur_default.dim("Show pending changes without applying them")}`,
|
|
56140
|
+
` ${kleur_default.bold("xtrm clean")} ${kleur_default.dim("Remove orphaned hooks and skills not in canonical repo")}`,
|
|
56141
|
+
` ${kleur_default.bold("xtrm init")} ${kleur_default.dim("Initialize project data (beads, gitnexus, service-registry)")}`,
|
|
56142
|
+
` ${kleur_default.bold("xtrm reset")} ${kleur_default.dim("Clear saved preferences and start fresh")}`,
|
|
56143
|
+
` ${kleur_default.bold("xtrm end")} ${kleur_default.dim("Close worktree session: rebase, push, PR, link issues, cleanup")}`,
|
|
56144
|
+
` ${kleur_default.bold("xtrm worktree list")} ${kleur_default.dim("List all active xt/* worktrees with status")}`,
|
|
56145
|
+
` ${kleur_default.bold("xtrm worktree clean")} ${kleur_default.dim("Remove worktrees whose branch has been merged into main")}`,
|
|
56146
|
+
` ${kleur_default.bold("xtrm help")} ${kleur_default.dim("Show this overview")}`
|
|
56207
56147
|
].join("\n");
|
|
56208
56148
|
const resourcesSection = [
|
|
56209
56149
|
section("RESOURCES"),
|
|
@@ -56219,14 +56159,12 @@ ${hr}`;
|
|
|
56219
56159
|
}
|
|
56220
56160
|
|
|
56221
56161
|
// src/commands/clean.ts
|
|
56222
|
-
var
|
|
56162
|
+
var import_fs_extra18 = __toESM(require_lib2(), 1);
|
|
56223
56163
|
var import_path19 = __toESM(require("path"), 1);
|
|
56224
56164
|
var import_os6 = require("os");
|
|
56225
56165
|
var CANONICAL_HOOKS = /* @__PURE__ */ new Set([
|
|
56226
|
-
"
|
|
56166
|
+
"using-xtrm-reminder.mjs",
|
|
56227
56167
|
"serena-workflow-reminder.py",
|
|
56228
|
-
"main-guard.mjs",
|
|
56229
|
-
"main-guard-post-push.mjs",
|
|
56230
56168
|
"beads-gate-core.mjs",
|
|
56231
56169
|
"beads-gate-utils.mjs",
|
|
56232
56170
|
"beads-gate-messages.mjs",
|
|
@@ -56285,15 +56223,15 @@ async function cleanHooks(dryRun) {
|
|
|
56285
56223
|
const hooksDir = import_path19.default.join((0, import_os6.homedir)(), ".claude", "hooks");
|
|
56286
56224
|
const removed = [];
|
|
56287
56225
|
const cache = [];
|
|
56288
|
-
if (!await
|
|
56226
|
+
if (!await import_fs_extra18.default.pathExists(hooksDir)) {
|
|
56289
56227
|
return { removed, cache };
|
|
56290
56228
|
}
|
|
56291
|
-
const entries = await
|
|
56229
|
+
const entries = await import_fs_extra18.default.readdir(hooksDir);
|
|
56292
56230
|
for (const entry of entries) {
|
|
56293
56231
|
if (IGNORED_ITEMS2.has(entry)) {
|
|
56294
56232
|
if (!dryRun) {
|
|
56295
56233
|
const fullPath2 = import_path19.default.join(hooksDir, entry);
|
|
56296
|
-
await
|
|
56234
|
+
await import_fs_extra18.default.remove(fullPath2);
|
|
56297
56235
|
}
|
|
56298
56236
|
cache.push(entry);
|
|
56299
56237
|
continue;
|
|
@@ -56302,10 +56240,10 @@ async function cleanHooks(dryRun) {
|
|
|
56302
56240
|
continue;
|
|
56303
56241
|
}
|
|
56304
56242
|
const fullPath = import_path19.default.join(hooksDir, entry);
|
|
56305
|
-
const stat = await
|
|
56243
|
+
const stat = await import_fs_extra18.default.stat(fullPath);
|
|
56306
56244
|
if (stat.isFile() || stat.isDirectory() && IGNORED_ITEMS2.has(entry)) {
|
|
56307
56245
|
if (!dryRun) {
|
|
56308
|
-
await
|
|
56246
|
+
await import_fs_extra18.default.remove(fullPath);
|
|
56309
56247
|
}
|
|
56310
56248
|
removed.push(entry);
|
|
56311
56249
|
}
|
|
@@ -56315,10 +56253,10 @@ async function cleanHooks(dryRun) {
|
|
|
56315
56253
|
async function cleanSkills(dryRun) {
|
|
56316
56254
|
const skillsDir = import_path19.default.join((0, import_os6.homedir)(), ".agents", "skills");
|
|
56317
56255
|
const removed = [];
|
|
56318
|
-
if (!await
|
|
56256
|
+
if (!await import_fs_extra18.default.pathExists(skillsDir)) {
|
|
56319
56257
|
return removed;
|
|
56320
56258
|
}
|
|
56321
|
-
const entries = await
|
|
56259
|
+
const entries = await import_fs_extra18.default.readdir(skillsDir);
|
|
56322
56260
|
for (const entry of entries) {
|
|
56323
56261
|
if (IGNORED_ITEMS2.has(entry)) {
|
|
56324
56262
|
continue;
|
|
@@ -56330,10 +56268,10 @@ async function cleanSkills(dryRun) {
|
|
|
56330
56268
|
continue;
|
|
56331
56269
|
}
|
|
56332
56270
|
const fullPath = import_path19.default.join(skillsDir, entry);
|
|
56333
|
-
const stat = await
|
|
56271
|
+
const stat = await import_fs_extra18.default.stat(fullPath);
|
|
56334
56272
|
if (stat.isDirectory()) {
|
|
56335
56273
|
if (!dryRun) {
|
|
56336
|
-
await
|
|
56274
|
+
await import_fs_extra18.default.remove(fullPath);
|
|
56337
56275
|
}
|
|
56338
56276
|
removed.push(entry);
|
|
56339
56277
|
}
|
|
@@ -56343,12 +56281,12 @@ async function cleanSkills(dryRun) {
|
|
|
56343
56281
|
async function cleanOrphanedHookEntries(dryRun, repoRoot) {
|
|
56344
56282
|
const settingsPath = import_path19.default.join((0, import_os6.homedir)(), ".claude", "settings.json");
|
|
56345
56283
|
const removed = [];
|
|
56346
|
-
if (!await
|
|
56284
|
+
if (!await import_fs_extra18.default.pathExists(settingsPath)) {
|
|
56347
56285
|
return removed;
|
|
56348
56286
|
}
|
|
56349
56287
|
let settings = {};
|
|
56350
56288
|
try {
|
|
56351
|
-
settings = await
|
|
56289
|
+
settings = await import_fs_extra18.default.readJson(settingsPath);
|
|
56352
56290
|
} catch {
|
|
56353
56291
|
return removed;
|
|
56354
56292
|
}
|
|
@@ -56366,8 +56304,8 @@ async function cleanOrphanedHookEntries(dryRun, repoRoot) {
|
|
|
56366
56304
|
if (repoRoot) {
|
|
56367
56305
|
const hooksJsonPath = import_path19.default.join(repoRoot, "config", "hooks.json");
|
|
56368
56306
|
try {
|
|
56369
|
-
if (await
|
|
56370
|
-
const hooksJson = await
|
|
56307
|
+
if (await import_fs_extra18.default.pathExists(hooksJsonPath)) {
|
|
56308
|
+
const hooksJson = await import_fs_extra18.default.readJson(hooksJsonPath);
|
|
56371
56309
|
for (const [event, entries] of Object.entries(hooksJson.hooks ?? {})) {
|
|
56372
56310
|
for (const entry of entries) {
|
|
56373
56311
|
const script = entry.script;
|
|
@@ -56429,7 +56367,7 @@ async function cleanOrphanedHookEntries(dryRun, repoRoot) {
|
|
|
56429
56367
|
}
|
|
56430
56368
|
}
|
|
56431
56369
|
if (modified && !dryRun) {
|
|
56432
|
-
await
|
|
56370
|
+
await import_fs_extra18.default.writeJson(settingsPath, settings, { spaces: 2 });
|
|
56433
56371
|
}
|
|
56434
56372
|
return removed;
|
|
56435
56373
|
}
|