xtrm-tools 0.5.3 → 0.5.5

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.
@@ -1202,7 +1202,7 @@ var require_command = __commonJS({
1202
1202
  "use strict";
1203
1203
  var EventEmitter2 = require("events").EventEmitter;
1204
1204
  var childProcess = require("child_process");
1205
- var path22 = require("path");
1205
+ var path21 = require("path");
1206
1206
  var fs22 = require("fs");
1207
1207
  var process19 = require("process");
1208
1208
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -2215,9 +2215,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2215
2215
  let launchWithNode = false;
2216
2216
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2217
2217
  function findFile(baseDir, baseName) {
2218
- const localBin = path22.resolve(baseDir, baseName);
2218
+ const localBin = path21.resolve(baseDir, baseName);
2219
2219
  if (fs22.existsSync(localBin)) return localBin;
2220
- if (sourceExt.includes(path22.extname(baseName))) return void 0;
2220
+ if (sourceExt.includes(path21.extname(baseName))) return void 0;
2221
2221
  const foundExt = sourceExt.find(
2222
2222
  (ext) => fs22.existsSync(`${localBin}${ext}`)
2223
2223
  );
@@ -2235,17 +2235,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
2235
2235
  } catch {
2236
2236
  resolvedScriptPath = this._scriptPath;
2237
2237
  }
2238
- executableDir = path22.resolve(
2239
- path22.dirname(resolvedScriptPath),
2238
+ executableDir = path21.resolve(
2239
+ path21.dirname(resolvedScriptPath),
2240
2240
  executableDir
2241
2241
  );
2242
2242
  }
2243
2243
  if (executableDir) {
2244
2244
  let localFile = findFile(executableDir, executableFile);
2245
2245
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2246
- const legacyName = path22.basename(
2246
+ const legacyName = path21.basename(
2247
2247
  this._scriptPath,
2248
- path22.extname(this._scriptPath)
2248
+ path21.extname(this._scriptPath)
2249
2249
  );
2250
2250
  if (legacyName !== this._name) {
2251
2251
  localFile = findFile(
@@ -2256,7 +2256,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2256
2256
  }
2257
2257
  executableFile = localFile || executableFile;
2258
2258
  }
2259
- launchWithNode = sourceExt.includes(path22.extname(executableFile));
2259
+ launchWithNode = sourceExt.includes(path21.extname(executableFile));
2260
2260
  let proc;
2261
2261
  if (process19.platform !== "win32") {
2262
2262
  if (launchWithNode) {
@@ -3171,7 +3171,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3171
3171
  * @return {Command}
3172
3172
  */
3173
3173
  nameFromFilename(filename) {
3174
- this._name = path22.basename(filename, path22.extname(filename));
3174
+ this._name = path21.basename(filename, path21.extname(filename));
3175
3175
  return this;
3176
3176
  }
3177
3177
  /**
@@ -3185,9 +3185,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3185
3185
  * @param {string} [path]
3186
3186
  * @return {(string|null|Command)}
3187
3187
  */
3188
- executableDir(path23) {
3189
- if (path23 === void 0) return this._executableDir;
3190
- this._executableDir = path23;
3188
+ executableDir(path22) {
3189
+ if (path22 === void 0) return this._executableDir;
3190
+ this._executableDir = path22;
3191
3191
  return this;
3192
3192
  }
3193
3193
  /**
@@ -3503,7 +3503,7 @@ var require_kleur = __commonJS({
3503
3503
  bgCyan: init2(46, 49),
3504
3504
  bgWhite: init2(47, 49)
3505
3505
  };
3506
- function run3(arr, str) {
3506
+ function run2(arr, str) {
3507
3507
  let i = 0, tmp, beg = "", end = "";
3508
3508
  for (; i < arr.length; i++) {
3509
3509
  tmp = arr[i];
@@ -3554,9 +3554,9 @@ var require_kleur = __commonJS({
3554
3554
  return function(txt) {
3555
3555
  if (this !== void 0 && this.has !== void 0) {
3556
3556
  this.has.includes(open) || (this.has.push(open), this.keys.push(blk));
3557
- return txt === void 0 ? this : $2.enabled ? run3(this.keys, txt + "") : txt + "";
3557
+ return txt === void 0 ? this : $2.enabled ? run2(this.keys, txt + "") : txt + "";
3558
3558
  }
3559
- return txt === void 0 ? chain2([open], [blk]) : $2.enabled ? run3([blk], txt + "") : txt + "";
3559
+ return txt === void 0 ? chain2([open], [blk]) : $2.enabled ? run2([blk], txt + "") : txt + "";
3560
3560
  };
3561
3561
  }
3562
3562
  module2.exports = $2;
@@ -11665,14 +11665,14 @@ var require_polyfills = __commonJS({
11665
11665
  fs22.fstatSync = statFixSync(fs22.fstatSync);
11666
11666
  fs22.lstatSync = statFixSync(fs22.lstatSync);
11667
11667
  if (fs22.chmod && !fs22.lchmod) {
11668
- fs22.lchmod = function(path22, mode, cb) {
11668
+ fs22.lchmod = function(path21, mode, cb) {
11669
11669
  if (cb) process.nextTick(cb);
11670
11670
  };
11671
11671
  fs22.lchmodSync = function() {
11672
11672
  };
11673
11673
  }
11674
11674
  if (fs22.chown && !fs22.lchown) {
11675
- fs22.lchown = function(path22, uid, gid, cb) {
11675
+ fs22.lchown = function(path21, uid, gid, cb) {
11676
11676
  if (cb) process.nextTick(cb);
11677
11677
  };
11678
11678
  fs22.lchownSync = function() {
@@ -11739,9 +11739,9 @@ var require_polyfills = __commonJS({
11739
11739
  };
11740
11740
  })(fs22.readSync);
11741
11741
  function patchLchmod(fs23) {
11742
- fs23.lchmod = function(path22, mode, callback) {
11742
+ fs23.lchmod = function(path21, mode, callback) {
11743
11743
  fs23.open(
11744
- path22,
11744
+ path21,
11745
11745
  constants.O_WRONLY | constants.O_SYMLINK,
11746
11746
  mode,
11747
11747
  function(err, fd) {
@@ -11757,8 +11757,8 @@ var require_polyfills = __commonJS({
11757
11757
  }
11758
11758
  );
11759
11759
  };
11760
- fs23.lchmodSync = function(path22, mode) {
11761
- var fd = fs23.openSync(path22, constants.O_WRONLY | constants.O_SYMLINK, mode);
11760
+ fs23.lchmodSync = function(path21, mode) {
11761
+ var fd = fs23.openSync(path21, constants.O_WRONLY | constants.O_SYMLINK, mode);
11762
11762
  var threw = true;
11763
11763
  var ret;
11764
11764
  try {
@@ -11779,8 +11779,8 @@ var require_polyfills = __commonJS({
11779
11779
  }
11780
11780
  function patchLutimes(fs23) {
11781
11781
  if (constants.hasOwnProperty("O_SYMLINK") && fs23.futimes) {
11782
- fs23.lutimes = function(path22, at, mt, cb) {
11783
- fs23.open(path22, constants.O_SYMLINK, function(er, fd) {
11782
+ fs23.lutimes = function(path21, at, mt, cb) {
11783
+ fs23.open(path21, constants.O_SYMLINK, function(er, fd) {
11784
11784
  if (er) {
11785
11785
  if (cb) cb(er);
11786
11786
  return;
@@ -11792,8 +11792,8 @@ var require_polyfills = __commonJS({
11792
11792
  });
11793
11793
  });
11794
11794
  };
11795
- fs23.lutimesSync = function(path22, at, mt) {
11796
- var fd = fs23.openSync(path22, constants.O_SYMLINK);
11795
+ fs23.lutimesSync = function(path21, at, mt) {
11796
+ var fd = fs23.openSync(path21, constants.O_SYMLINK);
11797
11797
  var ret;
11798
11798
  var threw = true;
11799
11799
  try {
@@ -11912,11 +11912,11 @@ var require_legacy_streams = __commonJS({
11912
11912
  ReadStream,
11913
11913
  WriteStream
11914
11914
  };
11915
- function ReadStream(path22, options) {
11916
- if (!(this instanceof ReadStream)) return new ReadStream(path22, options);
11915
+ function ReadStream(path21, options) {
11916
+ if (!(this instanceof ReadStream)) return new ReadStream(path21, options);
11917
11917
  Stream.call(this);
11918
11918
  var self = this;
11919
- this.path = path22;
11919
+ this.path = path21;
11920
11920
  this.fd = null;
11921
11921
  this.readable = true;
11922
11922
  this.paused = false;
@@ -11961,10 +11961,10 @@ var require_legacy_streams = __commonJS({
11961
11961
  self._read();
11962
11962
  });
11963
11963
  }
11964
- function WriteStream(path22, options) {
11965
- if (!(this instanceof WriteStream)) return new WriteStream(path22, options);
11964
+ function WriteStream(path21, options) {
11965
+ if (!(this instanceof WriteStream)) return new WriteStream(path21, options);
11966
11966
  Stream.call(this);
11967
- this.path = path22;
11967
+ this.path = path21;
11968
11968
  this.fd = null;
11969
11969
  this.writable = true;
11970
11970
  this.flags = "w";
@@ -12108,14 +12108,14 @@ var require_graceful_fs = __commonJS({
12108
12108
  fs23.createWriteStream = createWriteStream2;
12109
12109
  var fs$readFile = fs23.readFile;
12110
12110
  fs23.readFile = readFile;
12111
- function readFile(path22, options, cb) {
12111
+ function readFile(path21, options, cb) {
12112
12112
  if (typeof options === "function")
12113
12113
  cb = options, options = null;
12114
- return go$readFile(path22, options, cb);
12115
- function go$readFile(path23, options2, cb2, startTime) {
12116
- return fs$readFile(path23, options2, function(err) {
12114
+ return go$readFile(path21, options, cb);
12115
+ function go$readFile(path22, options2, cb2, startTime) {
12116
+ return fs$readFile(path22, options2, function(err) {
12117
12117
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
12118
- enqueue([go$readFile, [path23, options2, cb2], err, startTime || Date.now(), Date.now()]);
12118
+ enqueue([go$readFile, [path22, options2, cb2], err, startTime || Date.now(), Date.now()]);
12119
12119
  else {
12120
12120
  if (typeof cb2 === "function")
12121
12121
  cb2.apply(this, arguments);
@@ -12125,14 +12125,14 @@ var require_graceful_fs = __commonJS({
12125
12125
  }
12126
12126
  var fs$writeFile = fs23.writeFile;
12127
12127
  fs23.writeFile = writeFile;
12128
- function writeFile(path22, data, options, cb) {
12128
+ function writeFile(path21, data, options, cb) {
12129
12129
  if (typeof options === "function")
12130
12130
  cb = options, options = null;
12131
- return go$writeFile(path22, data, options, cb);
12132
- function go$writeFile(path23, data2, options2, cb2, startTime) {
12133
- return fs$writeFile(path23, data2, options2, function(err) {
12131
+ return go$writeFile(path21, data, options, cb);
12132
+ function go$writeFile(path22, data2, options2, cb2, startTime) {
12133
+ return fs$writeFile(path22, data2, options2, function(err) {
12134
12134
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
12135
- enqueue([go$writeFile, [path23, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
12135
+ enqueue([go$writeFile, [path22, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
12136
12136
  else {
12137
12137
  if (typeof cb2 === "function")
12138
12138
  cb2.apply(this, arguments);
@@ -12143,14 +12143,14 @@ var require_graceful_fs = __commonJS({
12143
12143
  var fs$appendFile = fs23.appendFile;
12144
12144
  if (fs$appendFile)
12145
12145
  fs23.appendFile = appendFile;
12146
- function appendFile(path22, data, options, cb) {
12146
+ function appendFile(path21, data, options, cb) {
12147
12147
  if (typeof options === "function")
12148
12148
  cb = options, options = null;
12149
- return go$appendFile(path22, data, options, cb);
12150
- function go$appendFile(path23, data2, options2, cb2, startTime) {
12151
- return fs$appendFile(path23, data2, options2, function(err) {
12149
+ return go$appendFile(path21, data, options, cb);
12150
+ function go$appendFile(path22, data2, options2, cb2, startTime) {
12151
+ return fs$appendFile(path22, data2, options2, function(err) {
12152
12152
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
12153
- enqueue([go$appendFile, [path23, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
12153
+ enqueue([go$appendFile, [path22, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
12154
12154
  else {
12155
12155
  if (typeof cb2 === "function")
12156
12156
  cb2.apply(this, arguments);
@@ -12181,31 +12181,31 @@ var require_graceful_fs = __commonJS({
12181
12181
  var fs$readdir = fs23.readdir;
12182
12182
  fs23.readdir = readdir;
12183
12183
  var noReaddirOptionVersions = /^v[0-5]\./;
12184
- function readdir(path22, options, cb) {
12184
+ function readdir(path21, options, cb) {
12185
12185
  if (typeof options === "function")
12186
12186
  cb = options, options = null;
12187
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path23, options2, cb2, startTime) {
12188
- return fs$readdir(path23, fs$readdirCallback(
12189
- path23,
12187
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path22, options2, cb2, startTime) {
12188
+ return fs$readdir(path22, fs$readdirCallback(
12189
+ path22,
12190
12190
  options2,
12191
12191
  cb2,
12192
12192
  startTime
12193
12193
  ));
12194
- } : function go$readdir2(path23, options2, cb2, startTime) {
12195
- return fs$readdir(path23, options2, fs$readdirCallback(
12196
- path23,
12194
+ } : function go$readdir2(path22, options2, cb2, startTime) {
12195
+ return fs$readdir(path22, options2, fs$readdirCallback(
12196
+ path22,
12197
12197
  options2,
12198
12198
  cb2,
12199
12199
  startTime
12200
12200
  ));
12201
12201
  };
12202
- return go$readdir(path22, options, cb);
12203
- function fs$readdirCallback(path23, options2, cb2, startTime) {
12202
+ return go$readdir(path21, options, cb);
12203
+ function fs$readdirCallback(path22, options2, cb2, startTime) {
12204
12204
  return function(err, files) {
12205
12205
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
12206
12206
  enqueue([
12207
12207
  go$readdir,
12208
- [path23, options2, cb2],
12208
+ [path22, options2, cb2],
12209
12209
  err,
12210
12210
  startTime || Date.now(),
12211
12211
  Date.now()
@@ -12276,7 +12276,7 @@ var require_graceful_fs = __commonJS({
12276
12276
  enumerable: true,
12277
12277
  configurable: true
12278
12278
  });
12279
- function ReadStream(path22, options) {
12279
+ function ReadStream(path21, options) {
12280
12280
  if (this instanceof ReadStream)
12281
12281
  return fs$ReadStream.apply(this, arguments), this;
12282
12282
  else
@@ -12296,7 +12296,7 @@ var require_graceful_fs = __commonJS({
12296
12296
  }
12297
12297
  });
12298
12298
  }
12299
- function WriteStream(path22, options) {
12299
+ function WriteStream(path21, options) {
12300
12300
  if (this instanceof WriteStream)
12301
12301
  return fs$WriteStream.apply(this, arguments), this;
12302
12302
  else
@@ -12314,22 +12314,22 @@ var require_graceful_fs = __commonJS({
12314
12314
  }
12315
12315
  });
12316
12316
  }
12317
- function createReadStream(path22, options) {
12318
- return new fs23.ReadStream(path22, options);
12317
+ function createReadStream(path21, options) {
12318
+ return new fs23.ReadStream(path21, options);
12319
12319
  }
12320
- function createWriteStream2(path22, options) {
12321
- return new fs23.WriteStream(path22, options);
12320
+ function createWriteStream2(path21, options) {
12321
+ return new fs23.WriteStream(path21, options);
12322
12322
  }
12323
12323
  var fs$open = fs23.open;
12324
12324
  fs23.open = open;
12325
- function open(path22, flags, mode, cb) {
12325
+ function open(path21, flags, mode, cb) {
12326
12326
  if (typeof mode === "function")
12327
12327
  cb = mode, mode = null;
12328
- return go$open(path22, flags, mode, cb);
12329
- function go$open(path23, flags2, mode2, cb2, startTime) {
12330
- return fs$open(path23, flags2, mode2, function(err, fd) {
12328
+ return go$open(path21, flags, mode, cb);
12329
+ function go$open(path22, flags2, mode2, cb2, startTime) {
12330
+ return fs$open(path22, flags2, mode2, function(err, fd) {
12331
12331
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
12332
- enqueue([go$open, [path23, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
12332
+ enqueue([go$open, [path22, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
12333
12333
  else {
12334
12334
  if (typeof cb2 === "function")
12335
12335
  cb2.apply(this, arguments);
@@ -12512,10 +12512,10 @@ var require_fs = __commonJS({
12512
12512
  var require_utils = __commonJS({
12513
12513
  "../node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
12514
12514
  "use strict";
12515
- var path22 = require("path");
12515
+ var path21 = require("path");
12516
12516
  module2.exports.checkPath = function checkPath(pth) {
12517
12517
  if (process.platform === "win32") {
12518
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path22.parse(pth).root, ""));
12518
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path21.parse(pth).root, ""));
12519
12519
  if (pathHasInvalidWinCharacters) {
12520
12520
  const error49 = new Error(`Path contains invalid characters: ${pth}`);
12521
12521
  error49.code = "EINVAL";
@@ -12579,8 +12579,8 @@ var require_path_exists = __commonJS({
12579
12579
  "use strict";
12580
12580
  var u = require_universalify().fromPromise;
12581
12581
  var fs22 = require_fs();
12582
- function pathExists(path22) {
12583
- return fs22.access(path22).then(() => true).catch(() => false);
12582
+ function pathExists(path21) {
12583
+ return fs22.access(path21).then(() => true).catch(() => false);
12584
12584
  }
12585
12585
  module2.exports = {
12586
12586
  pathExists: u(pathExists),
@@ -12595,8 +12595,8 @@ var require_utimes = __commonJS({
12595
12595
  "use strict";
12596
12596
  var fs22 = require_fs();
12597
12597
  var u = require_universalify().fromPromise;
12598
- async function utimesMillis(path22, atime, mtime) {
12599
- const fd = await fs22.open(path22, "r+");
12598
+ async function utimesMillis(path21, atime, mtime) {
12599
+ const fd = await fs22.open(path21, "r+");
12600
12600
  let closeErr = null;
12601
12601
  try {
12602
12602
  await fs22.futimes(fd, atime, mtime);
@@ -12611,8 +12611,8 @@ var require_utimes = __commonJS({
12611
12611
  throw closeErr;
12612
12612
  }
12613
12613
  }
12614
- function utimesMillisSync(path22, atime, mtime) {
12615
- const fd = fs22.openSync(path22, "r+");
12614
+ function utimesMillisSync(path21, atime, mtime) {
12615
+ const fd = fs22.openSync(path21, "r+");
12616
12616
  fs22.futimesSync(fd, atime, mtime);
12617
12617
  return fs22.closeSync(fd);
12618
12618
  }
@@ -12628,7 +12628,7 @@ var require_stat = __commonJS({
12628
12628
  "../node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
12629
12629
  "use strict";
12630
12630
  var fs22 = require_fs();
12631
- var path22 = require("path");
12631
+ var path21 = require("path");
12632
12632
  var u = require_universalify().fromPromise;
12633
12633
  function getStats(src, dest, opts) {
12634
12634
  const statFunc = opts.dereference ? (file2) => fs22.stat(file2, { bigint: true }) : (file2) => fs22.lstat(file2, { bigint: true });
@@ -12656,8 +12656,8 @@ var require_stat = __commonJS({
12656
12656
  const { srcStat, destStat } = await getStats(src, dest, opts);
12657
12657
  if (destStat) {
12658
12658
  if (areIdentical(srcStat, destStat)) {
12659
- const srcBaseName = path22.basename(src);
12660
- const destBaseName = path22.basename(dest);
12659
+ const srcBaseName = path21.basename(src);
12660
+ const destBaseName = path21.basename(dest);
12661
12661
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
12662
12662
  return { srcStat, destStat, isChangingCase: true };
12663
12663
  }
@@ -12679,8 +12679,8 @@ var require_stat = __commonJS({
12679
12679
  const { srcStat, destStat } = getStatsSync(src, dest, opts);
12680
12680
  if (destStat) {
12681
12681
  if (areIdentical(srcStat, destStat)) {
12682
- const srcBaseName = path22.basename(src);
12683
- const destBaseName = path22.basename(dest);
12682
+ const srcBaseName = path21.basename(src);
12683
+ const destBaseName = path21.basename(dest);
12684
12684
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
12685
12685
  return { srcStat, destStat, isChangingCase: true };
12686
12686
  }
@@ -12699,9 +12699,9 @@ var require_stat = __commonJS({
12699
12699
  return { srcStat, destStat };
12700
12700
  }
12701
12701
  async function checkParentPaths(src, srcStat, dest, funcName) {
12702
- const srcParent = path22.resolve(path22.dirname(src));
12703
- const destParent = path22.resolve(path22.dirname(dest));
12704
- if (destParent === srcParent || destParent === path22.parse(destParent).root) return;
12702
+ const srcParent = path21.resolve(path21.dirname(src));
12703
+ const destParent = path21.resolve(path21.dirname(dest));
12704
+ if (destParent === srcParent || destParent === path21.parse(destParent).root) return;
12705
12705
  let destStat;
12706
12706
  try {
12707
12707
  destStat = await fs22.stat(destParent, { bigint: true });
@@ -12715,9 +12715,9 @@ var require_stat = __commonJS({
12715
12715
  return checkParentPaths(src, srcStat, destParent, funcName);
12716
12716
  }
12717
12717
  function checkParentPathsSync(src, srcStat, dest, funcName) {
12718
- const srcParent = path22.resolve(path22.dirname(src));
12719
- const destParent = path22.resolve(path22.dirname(dest));
12720
- if (destParent === srcParent || destParent === path22.parse(destParent).root) return;
12718
+ const srcParent = path21.resolve(path21.dirname(src));
12719
+ const destParent = path21.resolve(path21.dirname(dest));
12720
+ if (destParent === srcParent || destParent === path21.parse(destParent).root) return;
12721
12721
  let destStat;
12722
12722
  try {
12723
12723
  destStat = fs22.statSync(destParent, { bigint: true });
@@ -12734,8 +12734,8 @@ var require_stat = __commonJS({
12734
12734
  return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
12735
12735
  }
12736
12736
  function isSrcSubdir(src, dest) {
12737
- const srcArr = path22.resolve(src).split(path22.sep).filter((i) => i);
12738
- const destArr = path22.resolve(dest).split(path22.sep).filter((i) => i);
12737
+ const srcArr = path21.resolve(src).split(path21.sep).filter((i) => i);
12738
+ const destArr = path21.resolve(dest).split(path21.sep).filter((i) => i);
12739
12739
  return srcArr.every((cur, i) => destArr[i] === cur);
12740
12740
  }
12741
12741
  function errMsg(src, dest, funcName) {
@@ -12788,7 +12788,7 @@ var require_copy = __commonJS({
12788
12788
  "../node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
12789
12789
  "use strict";
12790
12790
  var fs22 = require_fs();
12791
- var path22 = require("path");
12791
+ var path21 = require("path");
12792
12792
  var { mkdirs } = require_mkdirs();
12793
12793
  var { pathExists } = require_path_exists();
12794
12794
  var { utimesMillis } = require_utimes();
@@ -12811,7 +12811,7 @@ var require_copy = __commonJS({
12811
12811
  await stat.checkParentPaths(src, srcStat, dest, "copy");
12812
12812
  const include = await runFilter(src, dest, opts);
12813
12813
  if (!include) return;
12814
- const destParent = path22.dirname(dest);
12814
+ const destParent = path21.dirname(dest);
12815
12815
  const dirExists = await pathExists(destParent);
12816
12816
  if (!dirExists) {
12817
12817
  await mkdirs(destParent);
@@ -12864,8 +12864,8 @@ var require_copy = __commonJS({
12864
12864
  await fs22.mkdir(dest);
12865
12865
  }
12866
12866
  await asyncIteratorConcurrentProcess(await fs22.opendir(src), async (item) => {
12867
- const srcItem = path22.join(src, item.name);
12868
- const destItem = path22.join(dest, item.name);
12867
+ const srcItem = path21.join(src, item.name);
12868
+ const destItem = path21.join(dest, item.name);
12869
12869
  const include = await runFilter(srcItem, destItem, opts);
12870
12870
  if (include) {
12871
12871
  const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
@@ -12879,7 +12879,7 @@ var require_copy = __commonJS({
12879
12879
  async function onLink(destStat, src, dest, opts) {
12880
12880
  let resolvedSrc = await fs22.readlink(src);
12881
12881
  if (opts.dereference) {
12882
- resolvedSrc = path22.resolve(process.cwd(), resolvedSrc);
12882
+ resolvedSrc = path21.resolve(process.cwd(), resolvedSrc);
12883
12883
  }
12884
12884
  if (!destStat) {
12885
12885
  return fs22.symlink(resolvedSrc, dest);
@@ -12892,7 +12892,7 @@ var require_copy = __commonJS({
12892
12892
  throw e;
12893
12893
  }
12894
12894
  if (opts.dereference) {
12895
- resolvedDest = path22.resolve(process.cwd(), resolvedDest);
12895
+ resolvedDest = path21.resolve(process.cwd(), resolvedDest);
12896
12896
  }
12897
12897
  if (resolvedSrc !== resolvedDest) {
12898
12898
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
@@ -12914,7 +12914,7 @@ var require_copy_sync = __commonJS({
12914
12914
  "../node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
12915
12915
  "use strict";
12916
12916
  var fs22 = require_graceful_fs();
12917
- var path22 = require("path");
12917
+ var path21 = require("path");
12918
12918
  var mkdirsSync = require_mkdirs().mkdirsSync;
12919
12919
  var utimesMillisSync = require_utimes().utimesMillisSync;
12920
12920
  var stat = require_stat();
@@ -12935,7 +12935,7 @@ var require_copy_sync = __commonJS({
12935
12935
  const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
12936
12936
  stat.checkParentPathsSync(src, srcStat, dest, "copy");
12937
12937
  if (opts.filter && !opts.filter(src, dest)) return;
12938
- const destParent = path22.dirname(dest);
12938
+ const destParent = path21.dirname(dest);
12939
12939
  if (!fs22.existsSync(destParent)) mkdirsSync(destParent);
12940
12940
  return getStats(destStat, src, dest, opts);
12941
12941
  }
@@ -13004,8 +13004,8 @@ var require_copy_sync = __commonJS({
13004
13004
  }
13005
13005
  }
13006
13006
  function copyDirItem(item, src, dest, opts) {
13007
- const srcItem = path22.join(src, item);
13008
- const destItem = path22.join(dest, item);
13007
+ const srcItem = path21.join(src, item);
13008
+ const destItem = path21.join(dest, item);
13009
13009
  if (opts.filter && !opts.filter(srcItem, destItem)) return;
13010
13010
  const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
13011
13011
  return getStats(destStat, srcItem, destItem, opts);
@@ -13013,7 +13013,7 @@ var require_copy_sync = __commonJS({
13013
13013
  function onLink(destStat, src, dest, opts) {
13014
13014
  let resolvedSrc = fs22.readlinkSync(src);
13015
13015
  if (opts.dereference) {
13016
- resolvedSrc = path22.resolve(process.cwd(), resolvedSrc);
13016
+ resolvedSrc = path21.resolve(process.cwd(), resolvedSrc);
13017
13017
  }
13018
13018
  if (!destStat) {
13019
13019
  return fs22.symlinkSync(resolvedSrc, dest);
@@ -13026,7 +13026,7 @@ var require_copy_sync = __commonJS({
13026
13026
  throw err;
13027
13027
  }
13028
13028
  if (opts.dereference) {
13029
- resolvedDest = path22.resolve(process.cwd(), resolvedDest);
13029
+ resolvedDest = path21.resolve(process.cwd(), resolvedDest);
13030
13030
  }
13031
13031
  if (resolvedSrc !== resolvedDest) {
13032
13032
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
@@ -13065,11 +13065,11 @@ var require_remove = __commonJS({
13065
13065
  "use strict";
13066
13066
  var fs22 = require_graceful_fs();
13067
13067
  var u = require_universalify().fromCallback;
13068
- function remove(path22, callback) {
13069
- fs22.rm(path22, { recursive: true, force: true }, callback);
13068
+ function remove(path21, callback) {
13069
+ fs22.rm(path21, { recursive: true, force: true }, callback);
13070
13070
  }
13071
- function removeSync(path22) {
13072
- fs22.rmSync(path22, { recursive: true, force: true });
13071
+ function removeSync(path21) {
13072
+ fs22.rmSync(path21, { recursive: true, force: true });
13073
13073
  }
13074
13074
  module2.exports = {
13075
13075
  remove: u(remove),
@@ -13084,7 +13084,7 @@ var require_empty = __commonJS({
13084
13084
  "use strict";
13085
13085
  var u = require_universalify().fromPromise;
13086
13086
  var fs22 = require_fs();
13087
- var path22 = require("path");
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) {
@@ -13094,7 +13094,7 @@ var require_empty = __commonJS({
13094
13094
  } catch {
13095
13095
  return mkdir.mkdirs(dir);
13096
13096
  }
13097
- return Promise.all(items.map((item) => remove.remove(path22.join(dir, item))));
13097
+ return Promise.all(items.map((item) => remove.remove(path21.join(dir, item))));
13098
13098
  });
13099
13099
  function emptyDirSync(dir) {
13100
13100
  let items;
@@ -13104,7 +13104,7 @@ var require_empty = __commonJS({
13104
13104
  return mkdir.mkdirsSync(dir);
13105
13105
  }
13106
13106
  items.forEach((item) => {
13107
- item = path22.join(dir, item);
13107
+ item = path21.join(dir, item);
13108
13108
  remove.removeSync(item);
13109
13109
  });
13110
13110
  }
@@ -13122,7 +13122,7 @@ var require_file = __commonJS({
13122
13122
  "../node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
13123
13123
  "use strict";
13124
13124
  var u = require_universalify().fromPromise;
13125
- var path22 = require("path");
13125
+ var path21 = require("path");
13126
13126
  var fs22 = require_fs();
13127
13127
  var mkdir = require_mkdirs();
13128
13128
  async function createFile(file2) {
@@ -13132,7 +13132,7 @@ var require_file = __commonJS({
13132
13132
  } catch {
13133
13133
  }
13134
13134
  if (stats && stats.isFile()) return;
13135
- const dir = path22.dirname(file2);
13135
+ const dir = path21.dirname(file2);
13136
13136
  let dirStats = null;
13137
13137
  try {
13138
13138
  dirStats = await fs22.stat(dir);
@@ -13158,7 +13158,7 @@ var require_file = __commonJS({
13158
13158
  } catch {
13159
13159
  }
13160
13160
  if (stats && stats.isFile()) return;
13161
- const dir = path22.dirname(file2);
13161
+ const dir = path21.dirname(file2);
13162
13162
  try {
13163
13163
  if (!fs22.statSync(dir).isDirectory()) {
13164
13164
  fs22.readdirSync(dir);
@@ -13181,7 +13181,7 @@ var require_link = __commonJS({
13181
13181
  "../node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
13182
13182
  "use strict";
13183
13183
  var u = require_universalify().fromPromise;
13184
- var path22 = require("path");
13184
+ var path21 = require("path");
13185
13185
  var fs22 = require_fs();
13186
13186
  var mkdir = require_mkdirs();
13187
13187
  var { pathExists } = require_path_exists();
@@ -13200,7 +13200,7 @@ var require_link = __commonJS({
13200
13200
  throw err;
13201
13201
  }
13202
13202
  if (dstStat && areIdentical(srcStat, dstStat)) return;
13203
- const dir = path22.dirname(dstpath);
13203
+ const dir = path21.dirname(dstpath);
13204
13204
  const dirExists = await pathExists(dir);
13205
13205
  if (!dirExists) {
13206
13206
  await mkdir.mkdirs(dir);
@@ -13220,7 +13220,7 @@ var require_link = __commonJS({
13220
13220
  err.message = err.message.replace("lstat", "ensureLink");
13221
13221
  throw err;
13222
13222
  }
13223
- const dir = path22.dirname(dstpath);
13223
+ const dir = path21.dirname(dstpath);
13224
13224
  const dirExists = fs22.existsSync(dir);
13225
13225
  if (dirExists) return fs22.linkSync(srcpath, dstpath);
13226
13226
  mkdir.mkdirsSync(dir);
@@ -13237,12 +13237,12 @@ var require_link = __commonJS({
13237
13237
  var require_symlink_paths = __commonJS({
13238
13238
  "../node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
13239
13239
  "use strict";
13240
- var path22 = require("path");
13240
+ var path21 = require("path");
13241
13241
  var fs22 = require_fs();
13242
13242
  var { pathExists } = require_path_exists();
13243
13243
  var u = require_universalify().fromPromise;
13244
13244
  async function symlinkPaths(srcpath, dstpath) {
13245
- if (path22.isAbsolute(srcpath)) {
13245
+ if (path21.isAbsolute(srcpath)) {
13246
13246
  try {
13247
13247
  await fs22.lstat(srcpath);
13248
13248
  } catch (err) {
@@ -13254,8 +13254,8 @@ var require_symlink_paths = __commonJS({
13254
13254
  toDst: srcpath
13255
13255
  };
13256
13256
  }
13257
- const dstdir = path22.dirname(dstpath);
13258
- const relativeToDst = path22.join(dstdir, srcpath);
13257
+ const dstdir = path21.dirname(dstpath);
13258
+ const relativeToDst = path21.join(dstdir, srcpath);
13259
13259
  const exists = await pathExists(relativeToDst);
13260
13260
  if (exists) {
13261
13261
  return {
@@ -13271,11 +13271,11 @@ var require_symlink_paths = __commonJS({
13271
13271
  }
13272
13272
  return {
13273
13273
  toCwd: srcpath,
13274
- toDst: path22.relative(dstdir, srcpath)
13274
+ toDst: path21.relative(dstdir, srcpath)
13275
13275
  };
13276
13276
  }
13277
13277
  function symlinkPathsSync(srcpath, dstpath) {
13278
- if (path22.isAbsolute(srcpath)) {
13278
+ if (path21.isAbsolute(srcpath)) {
13279
13279
  const exists2 = fs22.existsSync(srcpath);
13280
13280
  if (!exists2) throw new Error("absolute srcpath does not exist");
13281
13281
  return {
@@ -13283,8 +13283,8 @@ var require_symlink_paths = __commonJS({
13283
13283
  toDst: srcpath
13284
13284
  };
13285
13285
  }
13286
- const dstdir = path22.dirname(dstpath);
13287
- const relativeToDst = path22.join(dstdir, srcpath);
13286
+ const dstdir = path21.dirname(dstpath);
13287
+ const relativeToDst = path21.join(dstdir, srcpath);
13288
13288
  const exists = fs22.existsSync(relativeToDst);
13289
13289
  if (exists) {
13290
13290
  return {
@@ -13296,7 +13296,7 @@ var require_symlink_paths = __commonJS({
13296
13296
  if (!srcExists) throw new Error("relative srcpath does not exist");
13297
13297
  return {
13298
13298
  toCwd: srcpath,
13299
- toDst: path22.relative(dstdir, srcpath)
13299
+ toDst: path21.relative(dstdir, srcpath)
13300
13300
  };
13301
13301
  }
13302
13302
  module2.exports = {
@@ -13344,7 +13344,7 @@ var require_symlink = __commonJS({
13344
13344
  "../node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
13345
13345
  "use strict";
13346
13346
  var u = require_universalify().fromPromise;
13347
- var path22 = require("path");
13347
+ var path21 = require("path");
13348
13348
  var fs22 = require_fs();
13349
13349
  var { mkdirs, mkdirsSync } = require_mkdirs();
13350
13350
  var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
@@ -13367,7 +13367,7 @@ var require_symlink = __commonJS({
13367
13367
  const relative = await symlinkPaths(srcpath, dstpath);
13368
13368
  srcpath = relative.toDst;
13369
13369
  const toType = await symlinkType(relative.toCwd, type);
13370
- const dir = path22.dirname(dstpath);
13370
+ const dir = path21.dirname(dstpath);
13371
13371
  if (!await pathExists(dir)) {
13372
13372
  await mkdirs(dir);
13373
13373
  }
@@ -13387,7 +13387,7 @@ var require_symlink = __commonJS({
13387
13387
  const relative = symlinkPathsSync(srcpath, dstpath);
13388
13388
  srcpath = relative.toDst;
13389
13389
  type = symlinkTypeSync(relative.toCwd, type);
13390
- const dir = path22.dirname(dstpath);
13390
+ const dir = path21.dirname(dstpath);
13391
13391
  const exists = fs22.existsSync(dir);
13392
13392
  if (exists) return fs22.symlinkSync(srcpath, dstpath, type);
13393
13393
  mkdirsSync(dir);
@@ -13478,7 +13478,7 @@ var require_jsonfile = __commonJS({
13478
13478
  return obj;
13479
13479
  }
13480
13480
  var readFile = universalify.fromPromise(_readFile);
13481
- function readFileSync3(file2, options = {}) {
13481
+ function readFileSync2(file2, options = {}) {
13482
13482
  if (typeof options === "string") {
13483
13483
  options = { encoding: options };
13484
13484
  }
@@ -13503,16 +13503,16 @@ var require_jsonfile = __commonJS({
13503
13503
  await universalify.fromCallback(fs22.writeFile)(file2, str, options);
13504
13504
  }
13505
13505
  var writeFile = universalify.fromPromise(_writeFile);
13506
- function writeFileSync3(file2, obj, options = {}) {
13506
+ function writeFileSync2(file2, obj, options = {}) {
13507
13507
  const fs22 = options.fs || _fs;
13508
13508
  const str = stringify2(obj, options);
13509
13509
  return fs22.writeFileSync(file2, str, options);
13510
13510
  }
13511
13511
  module2.exports = {
13512
13512
  readFile,
13513
- readFileSync: readFileSync3,
13513
+ readFileSync: readFileSync2,
13514
13514
  writeFile,
13515
- writeFileSync: writeFileSync3
13515
+ writeFileSync: writeFileSync2
13516
13516
  };
13517
13517
  }
13518
13518
  });
@@ -13538,18 +13538,18 @@ var require_output_file = __commonJS({
13538
13538
  "use strict";
13539
13539
  var u = require_universalify().fromPromise;
13540
13540
  var fs22 = require_fs();
13541
- var path22 = require("path");
13541
+ var path21 = require("path");
13542
13542
  var mkdir = require_mkdirs();
13543
13543
  var pathExists = require_path_exists().pathExists;
13544
13544
  async function outputFile(file2, data, encoding = "utf-8") {
13545
- const dir = path22.dirname(file2);
13545
+ const dir = path21.dirname(file2);
13546
13546
  if (!await pathExists(dir)) {
13547
13547
  await mkdir.mkdirs(dir);
13548
13548
  }
13549
13549
  return fs22.writeFile(file2, data, encoding);
13550
13550
  }
13551
13551
  function outputFileSync(file2, ...args) {
13552
- const dir = path22.dirname(file2);
13552
+ const dir = path21.dirname(file2);
13553
13553
  if (!fs22.existsSync(dir)) {
13554
13554
  mkdir.mkdirsSync(dir);
13555
13555
  }
@@ -13613,7 +13613,7 @@ var require_move = __commonJS({
13613
13613
  "../node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
13614
13614
  "use strict";
13615
13615
  var fs22 = require_fs();
13616
- var path22 = require("path");
13616
+ var path21 = require("path");
13617
13617
  var { copy } = require_copy2();
13618
13618
  var { remove } = require_remove();
13619
13619
  var { mkdirp } = require_mkdirs();
@@ -13623,8 +13623,8 @@ var require_move = __commonJS({
13623
13623
  const overwrite = opts.overwrite || opts.clobber || false;
13624
13624
  const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
13625
13625
  await stat.checkParentPaths(src, srcStat, dest, "move");
13626
- const destParent = path22.dirname(dest);
13627
- const parsedParentPath = path22.parse(destParent);
13626
+ const destParent = path21.dirname(dest);
13627
+ const parsedParentPath = path21.parse(destParent);
13628
13628
  if (parsedParentPath.root !== destParent) {
13629
13629
  await mkdirp(destParent);
13630
13630
  }
@@ -13665,7 +13665,7 @@ var require_move_sync = __commonJS({
13665
13665
  "../node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
13666
13666
  "use strict";
13667
13667
  var fs22 = require_graceful_fs();
13668
- var path22 = require("path");
13668
+ var path21 = require("path");
13669
13669
  var copySync = require_copy2().copySync;
13670
13670
  var removeSync = require_remove().removeSync;
13671
13671
  var mkdirpSync = require_mkdirs().mkdirpSync;
@@ -13675,12 +13675,12 @@ var require_move_sync = __commonJS({
13675
13675
  const overwrite = opts.overwrite || opts.clobber || false;
13676
13676
  const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
13677
13677
  stat.checkParentPathsSync(src, srcStat, dest, "move");
13678
- if (!isParentRoot(dest)) mkdirpSync(path22.dirname(dest));
13678
+ if (!isParentRoot(dest)) mkdirpSync(path21.dirname(dest));
13679
13679
  return doRename(src, dest, overwrite, isChangingCase);
13680
13680
  }
13681
13681
  function isParentRoot(dest) {
13682
- const parent = path22.dirname(dest);
13683
- const parsedPath = path22.parse(parent);
13682
+ const parent = path21.dirname(dest);
13683
+ const parsedPath = path21.parse(parent);
13684
13684
  return parsedPath.root === parent;
13685
13685
  }
13686
13686
  function doRename(src, dest, overwrite, isChangingCase) {
@@ -16939,8 +16939,8 @@ var require_utils3 = __commonJS({
16939
16939
  }
16940
16940
  return ind;
16941
16941
  }
16942
- function removeDotSegments(path22) {
16943
- let input = path22;
16942
+ function removeDotSegments(path21) {
16943
+ let input = path21;
16944
16944
  const output = [];
16945
16945
  let nextSlash = -1;
16946
16946
  let len = 0;
@@ -17139,8 +17139,8 @@ var require_schemes = __commonJS({
17139
17139
  wsComponent.secure = void 0;
17140
17140
  }
17141
17141
  if (wsComponent.resourceName) {
17142
- const [path22, query] = wsComponent.resourceName.split("?");
17143
- wsComponent.path = path22 && path22 !== "/" ? path22 : void 0;
17142
+ const [path21, query] = wsComponent.resourceName.split("?");
17143
+ wsComponent.path = path21 && path21 !== "/" ? path21 : void 0;
17144
17144
  wsComponent.query = query;
17145
17145
  wsComponent.resourceName = void 0;
17146
17146
  }
@@ -31074,7 +31074,7 @@ var require_main = __commonJS({
31074
31074
  "node_modules/dotenv/lib/main.js"(exports2, module2) {
31075
31075
  "use strict";
31076
31076
  var fs22 = require("fs");
31077
- var path22 = require("path");
31077
+ var path21 = require("path");
31078
31078
  var os7 = require("os");
31079
31079
  var crypto2 = require("crypto");
31080
31080
  var packageJson = require_package();
@@ -31190,7 +31190,7 @@ var require_main = __commonJS({
31190
31190
  possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
31191
31191
  }
31192
31192
  } else {
31193
- possibleVaultPath = path22.resolve(process.cwd(), ".env.vault");
31193
+ possibleVaultPath = path21.resolve(process.cwd(), ".env.vault");
31194
31194
  }
31195
31195
  if (fs22.existsSync(possibleVaultPath)) {
31196
31196
  return possibleVaultPath;
@@ -31198,7 +31198,7 @@ var require_main = __commonJS({
31198
31198
  return null;
31199
31199
  }
31200
31200
  function _resolveHome(envPath) {
31201
- return envPath[0] === "~" ? path22.join(os7.homedir(), envPath.slice(1)) : envPath;
31201
+ return envPath[0] === "~" ? path21.join(os7.homedir(), envPath.slice(1)) : envPath;
31202
31202
  }
31203
31203
  function _configVault(options) {
31204
31204
  const debug = Boolean(options && options.debug);
@@ -31215,7 +31215,7 @@ var require_main = __commonJS({
31215
31215
  return { parsed };
31216
31216
  }
31217
31217
  function configDotenv(options) {
31218
- const dotenvPath = path22.resolve(process.cwd(), ".env");
31218
+ const dotenvPath = path21.resolve(process.cwd(), ".env");
31219
31219
  let encoding = "utf8";
31220
31220
  const debug = Boolean(options && options.debug);
31221
31221
  const quiet = options && "quiet" in options ? options.quiet : true;
@@ -31239,13 +31239,13 @@ var require_main = __commonJS({
31239
31239
  }
31240
31240
  let lastError;
31241
31241
  const parsedAll = {};
31242
- for (const path23 of optionPaths) {
31242
+ for (const path22 of optionPaths) {
31243
31243
  try {
31244
- const parsed = DotenvModule.parse(fs22.readFileSync(path23, { encoding }));
31244
+ const parsed = DotenvModule.parse(fs22.readFileSync(path22, { encoding }));
31245
31245
  DotenvModule.populate(parsedAll, parsed, options);
31246
31246
  } catch (e) {
31247
31247
  if (debug) {
31248
- _debug(`Failed to load ${path23} ${e.message}`);
31248
+ _debug(`Failed to load ${path22} ${e.message}`);
31249
31249
  }
31250
31250
  lastError = e;
31251
31251
  }
@@ -31260,7 +31260,7 @@ var require_main = __commonJS({
31260
31260
  const shortPaths = [];
31261
31261
  for (const filePath of optionPaths) {
31262
31262
  try {
31263
- const relative = path22.relative(process.cwd(), filePath);
31263
+ const relative = path21.relative(process.cwd(), filePath);
31264
31264
  shortPaths.push(relative);
31265
31265
  } catch (e) {
31266
31266
  if (debug) {
@@ -33827,8 +33827,8 @@ var init_boxen = __esm({
33827
33827
  });
33828
33828
 
33829
33829
  // src/index.ts
33830
- var import_node_fs6 = require("fs");
33831
- var import_node_path7 = require("path");
33830
+ var import_node_fs4 = require("fs");
33831
+ var import_node_path6 = require("path");
33832
33832
 
33833
33833
  // ../node_modules/commander/esm.mjs
33834
33834
  var import_index = __toESM(require_commander(), 1);
@@ -35772,12 +35772,12 @@ var disallowedKeys = /* @__PURE__ */ new Set([
35772
35772
  "constructor"
35773
35773
  ]);
35774
35774
  var digits = new Set("0123456789");
35775
- function getPathSegments(path22) {
35775
+ function getPathSegments(path21) {
35776
35776
  const parts = [];
35777
35777
  let currentSegment = "";
35778
35778
  let currentPart = "start";
35779
35779
  let isIgnoring = false;
35780
- for (const character of path22) {
35780
+ for (const character of path21) {
35781
35781
  switch (character) {
35782
35782
  case "\\": {
35783
35783
  if (currentPart === "index") {
@@ -35899,11 +35899,11 @@ function assertNotStringIndex(object2, key) {
35899
35899
  throw new Error("Cannot use string index");
35900
35900
  }
35901
35901
  }
35902
- function getProperty(object2, path22, value) {
35903
- if (!isObject(object2) || typeof path22 !== "string") {
35902
+ function getProperty(object2, path21, value) {
35903
+ if (!isObject(object2) || typeof path21 !== "string") {
35904
35904
  return value === void 0 ? object2 : value;
35905
35905
  }
35906
- const pathArray = getPathSegments(path22);
35906
+ const pathArray = getPathSegments(path21);
35907
35907
  if (pathArray.length === 0) {
35908
35908
  return value;
35909
35909
  }
@@ -35923,12 +35923,12 @@ function getProperty(object2, path22, value) {
35923
35923
  }
35924
35924
  return object2 === void 0 ? value : object2;
35925
35925
  }
35926
- function setProperty(object2, path22, value) {
35927
- if (!isObject(object2) || typeof path22 !== "string") {
35926
+ function setProperty(object2, path21, value) {
35927
+ if (!isObject(object2) || typeof path21 !== "string") {
35928
35928
  return object2;
35929
35929
  }
35930
35930
  const root = object2;
35931
- const pathArray = getPathSegments(path22);
35931
+ const pathArray = getPathSegments(path21);
35932
35932
  for (let index = 0; index < pathArray.length; index++) {
35933
35933
  const key = pathArray[index];
35934
35934
  assertNotStringIndex(object2, key);
@@ -35941,11 +35941,11 @@ function setProperty(object2, path22, value) {
35941
35941
  }
35942
35942
  return root;
35943
35943
  }
35944
- function deleteProperty(object2, path22) {
35945
- if (!isObject(object2) || typeof path22 !== "string") {
35944
+ function deleteProperty(object2, path21) {
35945
+ if (!isObject(object2) || typeof path21 !== "string") {
35946
35946
  return false;
35947
35947
  }
35948
- const pathArray = getPathSegments(path22);
35948
+ const pathArray = getPathSegments(path21);
35949
35949
  for (let index = 0; index < pathArray.length; index++) {
35950
35950
  const key = pathArray[index];
35951
35951
  assertNotStringIndex(object2, key);
@@ -35959,11 +35959,11 @@ function deleteProperty(object2, path22) {
35959
35959
  }
35960
35960
  }
35961
35961
  }
35962
- function hasProperty(object2, path22) {
35963
- if (!isObject(object2) || typeof path22 !== "string") {
35962
+ function hasProperty(object2, path21) {
35963
+ if (!isObject(object2) || typeof path21 !== "string") {
35964
35964
  return false;
35965
35965
  }
35966
- const pathArray = getPathSegments(path22);
35966
+ const pathArray = getPathSegments(path21);
35967
35967
  if (pathArray.length === 0) {
35968
35968
  return false;
35969
35969
  }
@@ -36080,9 +36080,9 @@ var retryifyAsync = (fn, options) => {
36080
36080
  throw error49;
36081
36081
  if (Date.now() >= timestamp)
36082
36082
  throw error49;
36083
- const delay4 = Math.round(interval * Math.random());
36084
- if (delay4 > 0) {
36085
- const delayPromise = new Promise((resolve2) => setTimeout(resolve2, delay4));
36083
+ const delay3 = Math.round(interval * Math.random());
36084
+ if (delay3 > 0) {
36085
+ const delayPromise = new Promise((resolve2) => setTimeout(resolve2, delay3));
36086
36086
  return delayPromise.then(() => attempt.apply(void 0, args));
36087
36087
  } else {
36088
36088
  return attempt.apply(void 0, args);
@@ -37174,8 +37174,8 @@ function detectAdapter(systemRoot) {
37174
37174
  // src/core/diff.ts
37175
37175
  var IGNORED_ITEMS = /* @__PURE__ */ new Set(["__pycache__", ".DS_Store", "Thumbs.db", ".gitkeep", "node_modules"]);
37176
37176
  var PruneModeReadError = class extends Error {
37177
- constructor(path22) {
37178
- super(`Cannot read ${path22} in prune mode \u2014 aborting to prevent accidental deletion`);
37177
+ constructor(path21) {
37178
+ super(`Cannot read ${path21} in prune mode \u2014 aborting to prevent accidental deletion`);
37179
37179
  this.name = "PruneModeReadError";
37180
37180
  }
37181
37181
  };
@@ -41250,19 +41250,15 @@ var import_node_child_process2 = require("child_process");
41250
41250
  function randomSlug(len = 4) {
41251
41251
  return Math.random().toString(36).slice(2, 2 + len);
41252
41252
  }
41253
- function shortDate() {
41254
- const d = /* @__PURE__ */ new Date();
41255
- return `${d.getFullYear()}${String(d.getMonth() + 1).padStart(2, "0")}${String(d.getDate()).padStart(2, "0")}`;
41256
- }
41257
41253
  async function launchWorktreeSession(opts) {
41258
41254
  const { runtime, name } = opts;
41259
41255
  const cwd = process.cwd();
41260
41256
  const repoRoot = await findRepoRoot();
41261
41257
  const cwdBasename = import_node_path5.default.basename(cwd);
41262
- const date5 = shortDate();
41263
- const worktreeName = `${cwdBasename}-xt-${runtime}-${date5}`;
41258
+ const slug = name ?? randomSlug(4);
41259
+ const worktreeName = `${cwdBasename}-xt-${runtime}-${slug}`;
41264
41260
  const worktreePath = import_node_path5.default.join(import_node_path5.default.dirname(cwd), worktreeName);
41265
- const branchName = `xt/${name ?? randomSlug(4)}`;
41261
+ const branchName = `xt/${slug}`;
41266
41262
  console.log(kleur_default.bold(`
41267
41263
  Launching ${runtime} session`));
41268
41264
  console.log(kleur_default.dim(` worktree: ${worktreePath}`));
@@ -41284,8 +41280,6 @@ async function launchWorktreeSession(opts) {
41284
41280
  const worktreeBeadsDir = import_node_path5.default.join(worktreePath, ".beads");
41285
41281
  const mainPortFile = import_node_path5.default.join(mainBeadsDir, "dolt-server.port");
41286
41282
  if (await import_fs_extra12.default.pathExists(mainBeadsDir)) {
41287
- const worktreePortFile = import_node_path5.default.join(worktreeBeadsDir, "dolt-server.port");
41288
- (0, import_node_child_process2.spawnSync)("bd", ["dolt", "stop"], { cwd: worktreePath, stdio: "pipe" });
41289
41283
  let mainPort = null;
41290
41284
  if (await import_fs_extra12.default.pathExists(mainPortFile)) {
41291
41285
  mainPort = (await import_fs_extra12.default.readFile(mainPortFile, "utf8")).trim();
@@ -41303,7 +41297,7 @@ async function launchWorktreeSession(opts) {
41303
41297
  }
41304
41298
  if (mainPort) {
41305
41299
  await import_fs_extra12.default.ensureDir(worktreeBeadsDir);
41306
- await import_fs_extra12.default.writeFile(worktreePortFile, mainPort, "utf8");
41300
+ await import_fs_extra12.default.writeFile(import_node_path5.default.join(worktreeBeadsDir, "dolt-server.port"), mainPort, "utf8");
41307
41301
  console.log(kleur_default.dim(` beads: redirected to main server (port ${mainPort})`));
41308
41302
  } else {
41309
41303
  console.log(kleur_default.dim(" beads: main Dolt server not running, worktree will use isolated db"));
@@ -41744,7 +41738,6 @@ var MCP_CORE_CONFIG_PATH = import_path15.default.join(PKG_ROOT2, "config", "mcp_
41744
41738
  var INSTRUCTIONS_DIR = import_path15.default.join(PKG_ROOT2, "config", "instructions");
41745
41739
  var XTRM_BLOCK_START = "<!-- xtrm:start -->";
41746
41740
  var XTRM_BLOCK_END = "<!-- xtrm:end -->";
41747
- var syncedProjectMcpRoots = /* @__PURE__ */ new Set();
41748
41741
  function toServiceId(name) {
41749
41742
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "service";
41750
41743
  }
@@ -41838,80 +41831,6 @@ async function ensureServiceRegistry(projectRoot, services) {
41838
41831
  }
41839
41832
  return { generated: changed || !existedBefore, registryPath };
41840
41833
  }
41841
- function resolveEnvVars(value) {
41842
- if (typeof value !== "string") return value;
41843
- return value.replace(/\$\{([A-Z0-9_]+)\}/g, (_m, name) => process.env[name] || "");
41844
- }
41845
- function hasClaudeCli() {
41846
- const r = (0, import_child_process4.spawnSync)("claude", ["--version"], { stdio: "pipe" });
41847
- return r.status === 0;
41848
- }
41849
- function buildProjectMcpArgs(name, server) {
41850
- const transport = server.type || (server.url?.includes("/sse") ? "sse" : "http");
41851
- if (server.command) {
41852
- const args = ["mcp", "add", "-s", "project"];
41853
- if (server.env && typeof server.env === "object") {
41854
- for (const [k, v] of Object.entries(server.env)) {
41855
- args.push("-e", `${k}=${resolveEnvVars(String(v))}`);
41856
- }
41857
- }
41858
- args.push(name, "--", server.command, ...server.args || []);
41859
- return args;
41860
- }
41861
- if (server.url || server.serverUrl) {
41862
- const url2 = server.url || server.serverUrl;
41863
- const args = ["mcp", "add", "-s", "project", "--transport", transport, name, url2];
41864
- if (server.headers && typeof server.headers === "object") {
41865
- for (const [k, v] of Object.entries(server.headers)) {
41866
- args.push("--header", `${k}: ${resolveEnvVars(String(v))}`);
41867
- }
41868
- }
41869
- return args;
41870
- }
41871
- return null;
41872
- }
41873
- async function syncProjectMcpServers(projectRoot) {
41874
- if (syncedProjectMcpRoots.has(projectRoot)) return;
41875
- syncedProjectMcpRoots.add(projectRoot);
41876
- if (!await import_fs_extra16.default.pathExists(MCP_CORE_CONFIG_PATH)) return;
41877
- console.log(kleur_default.bold("\n\u2500\u2500 Installing MCP (project scope) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
41878
- if (!hasClaudeCli()) {
41879
- console.log(kleur_default.yellow(" \u26A0 Claude CLI not found; skipping project-scope MCP registration."));
41880
- return;
41881
- }
41882
- const mcpConfig = await import_fs_extra16.default.readJson(MCP_CORE_CONFIG_PATH);
41883
- const servers = Object.entries(mcpConfig?.mcpServers ?? {});
41884
- if (servers.length === 0) {
41885
- console.log(kleur_default.dim(" \u2139 No core MCP servers configured."));
41886
- return;
41887
- }
41888
- let added = 0;
41889
- let existing = 0;
41890
- let failed = 0;
41891
- for (const [name, server] of servers) {
41892
- const args = buildProjectMcpArgs(name, server);
41893
- if (!args) continue;
41894
- const r = (0, import_child_process4.spawnSync)("claude", args, {
41895
- cwd: projectRoot,
41896
- encoding: "utf8",
41897
- stdio: ["pipe", "pipe", "pipe"]
41898
- });
41899
- if (r.status === 0) {
41900
- added++;
41901
- console.log(`${kleur_default.green(" \u2713")} ${name}`);
41902
- continue;
41903
- }
41904
- const stderr = `${r.stderr || ""}`.toLowerCase();
41905
- if (stderr.includes("already exists") || stderr.includes("already configured")) {
41906
- existing++;
41907
- console.log(kleur_default.dim(` \u2713 ${name} (already configured)`));
41908
- continue;
41909
- }
41910
- failed++;
41911
- console.log(kleur_default.red(` \u2717 ${name} (${(r.stderr || r.stdout || "failed").toString().trim()})`));
41912
- }
41913
- console.log(kleur_default.dim(` \u21B3 MCP project-scope result: ${added} added, ${existing} existing, ${failed} failed`));
41914
- }
41915
41834
  function upsertManagedBlock(fileContent, blockBody, startMarker = XTRM_BLOCK_START, endMarker = XTRM_BLOCK_END) {
41916
41835
  const normalizedBody = blockBody.trim();
41917
41836
  const managedBlock = `${startMarker}
@@ -42011,7 +41930,6 @@ async function bootstrapProjectInit() {
42011
41930
  await runBdInitForProject(projectRoot);
42012
41931
  await injectProjectInstructionHeaders(projectRoot);
42013
41932
  await runGitNexusInitForProject(projectRoot);
42014
- await syncProjectMcpServers(projectRoot);
42015
41933
  if (detected.dockerServices.length > 0) {
42016
41934
  const { generated, registryPath } = await ensureServiceRegistry(projectRoot, detected.dockerServices);
42017
41935
  detected.generatedRegistry = generated;
@@ -42883,10 +42801,10 @@ function mergeDefs(...defs) {
42883
42801
  function cloneDef(schema) {
42884
42802
  return mergeDefs(schema._zod.def);
42885
42803
  }
42886
- function getElementAtPath(obj, path22) {
42887
- if (!path22)
42804
+ function getElementAtPath(obj, path21) {
42805
+ if (!path21)
42888
42806
  return obj;
42889
- return path22.reduce((acc, key) => acc?.[key], obj);
42807
+ return path21.reduce((acc, key) => acc?.[key], obj);
42890
42808
  }
42891
42809
  function promiseAllObject(promisesObj) {
42892
42810
  const keys = Object.keys(promisesObj);
@@ -43269,11 +43187,11 @@ function aborted(x, startIndex = 0) {
43269
43187
  }
43270
43188
  return false;
43271
43189
  }
43272
- function prefixIssues(path22, issues) {
43190
+ function prefixIssues(path21, issues) {
43273
43191
  return issues.map((iss) => {
43274
43192
  var _a2;
43275
43193
  (_a2 = iss).path ?? (_a2.path = []);
43276
- iss.path.unshift(path22);
43194
+ iss.path.unshift(path21);
43277
43195
  return iss;
43278
43196
  });
43279
43197
  }
@@ -43456,7 +43374,7 @@ function formatError(error49, mapper = (issue2) => issue2.message) {
43456
43374
  }
43457
43375
  function treeifyError(error49, mapper = (issue2) => issue2.message) {
43458
43376
  const result = { errors: [] };
43459
- const processError = (error50, path22 = []) => {
43377
+ const processError = (error50, path21 = []) => {
43460
43378
  var _a2, _b;
43461
43379
  for (const issue2 of error50.issues) {
43462
43380
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -43466,7 +43384,7 @@ function treeifyError(error49, mapper = (issue2) => issue2.message) {
43466
43384
  } else if (issue2.code === "invalid_element") {
43467
43385
  processError({ issues: issue2.issues }, issue2.path);
43468
43386
  } else {
43469
- const fullpath = [...path22, ...issue2.path];
43387
+ const fullpath = [...path21, ...issue2.path];
43470
43388
  if (fullpath.length === 0) {
43471
43389
  result.errors.push(mapper(issue2));
43472
43390
  continue;
@@ -43498,8 +43416,8 @@ function treeifyError(error49, mapper = (issue2) => issue2.message) {
43498
43416
  }
43499
43417
  function toDotPath(_path) {
43500
43418
  const segs = [];
43501
- const path22 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
43502
- for (const seg of path22) {
43419
+ const path21 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
43420
+ for (const seg of path21) {
43503
43421
  if (typeof seg === "number")
43504
43422
  segs.push(`[${seg}]`);
43505
43423
  else if (typeof seg === "symbol")
@@ -55476,13 +55394,13 @@ function resolveRef(ref, ctx) {
55476
55394
  if (!ref.startsWith("#")) {
55477
55395
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
55478
55396
  }
55479
- const path22 = ref.slice(1).split("/").filter(Boolean);
55480
- if (path22.length === 0) {
55397
+ const path21 = ref.slice(1).split("/").filter(Boolean);
55398
+ if (path21.length === 0) {
55481
55399
  return ctx.rootSchema;
55482
55400
  }
55483
55401
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
55484
- if (path22[0] === defsKey) {
55485
- const key = path22[1];
55402
+ if (path21[0] === defsKey) {
55403
+ const key = path21[1];
55486
55404
  if (!key || !ctx.defs[key]) {
55487
55405
  throw new Error(`Reference not found: ${ref}`);
55488
55406
  }
@@ -56512,327 +56430,15 @@ function createCleanCommand() {
56512
56430
  });
56513
56431
  }
56514
56432
 
56515
- // src/core/xtrm-finish.ts
56516
- var import_node_child_process7 = require("child_process");
56517
- var import_node_fs5 = require("fs");
56518
-
56519
- // src/core/session-state.ts
56520
- var import_node_child_process6 = require("child_process");
56521
- var import_node_fs4 = require("fs");
56522
- var import_node_path6 = __toESM(require("path"), 1);
56523
- var SESSION_STATE_FILE = ".xtrm-session-state.json";
56524
- var SESSION_PHASES = [
56525
- "claimed",
56526
- "phase1-done",
56527
- "waiting-merge",
56528
- "conflicting",
56529
- "pending-cleanup",
56530
- "merged",
56531
- "cleanup-done"
56532
- ];
56533
- var ALLOWED_TRANSITIONS = {
56534
- claimed: ["phase1-done", "waiting-merge", "conflicting", "pending-cleanup", "cleanup-done"],
56535
- "phase1-done": ["waiting-merge", "conflicting", "pending-cleanup", "cleanup-done"],
56536
- "waiting-merge": ["conflicting", "pending-cleanup", "merged", "cleanup-done"],
56537
- conflicting: ["waiting-merge", "pending-cleanup", "merged", "cleanup-done"],
56538
- "pending-cleanup": ["waiting-merge", "conflicting", "merged", "cleanup-done"],
56539
- merged: ["cleanup-done"],
56540
- "cleanup-done": []
56541
- };
56542
- var nowIso = () => (/* @__PURE__ */ new Date()).toISOString();
56543
- function isPhase(value) {
56544
- return typeof value === "string" && SESSION_PHASES.includes(value);
56545
- }
56546
- function normalizeState(value) {
56547
- if (!value || typeof value !== "object") {
56548
- throw new Error("Invalid session state payload");
56549
- }
56550
- const state = value;
56551
- if (!state.issueId || !state.branch || !state.worktreePath || !state.phase) {
56552
- throw new Error("Session state requires issueId, branch, worktreePath, and phase");
56553
- }
56554
- if (!isPhase(state.phase)) throw new Error(`Invalid session phase: ${String(state.phase)}`);
56555
- return {
56556
- issueId: String(state.issueId),
56557
- branch: String(state.branch),
56558
- worktreePath: String(state.worktreePath),
56559
- prNumber: state.prNumber ?? null,
56560
- prUrl: state.prUrl ?? null,
56561
- phase: state.phase,
56562
- conflictFiles: Array.isArray(state.conflictFiles) ? state.conflictFiles.map(String) : [],
56563
- startedAt: state.startedAt || nowIso(),
56564
- lastChecked: nowIso()
56565
- };
56566
- }
56567
- function findSessionStateFile(startCwd = process.cwd()) {
56568
- let current = import_node_path6.default.resolve(startCwd);
56569
- for (; ; ) {
56570
- const candidate = import_node_path6.default.join(current, SESSION_STATE_FILE);
56571
- if ((0, import_node_fs4.existsSync)(candidate)) return candidate;
56572
- const parent = import_node_path6.default.dirname(current);
56573
- if (parent === current) return null;
56574
- current = parent;
56575
- }
56576
- }
56577
- function readSessionState(startCwd = process.cwd()) {
56578
- const filePath = findSessionStateFile(startCwd);
56579
- if (!filePath) return null;
56580
- try {
56581
- const parsed = JSON.parse((0, import_node_fs4.readFileSync)(filePath, "utf8"));
56582
- return normalizeState(parsed);
56583
- } catch {
56584
- return null;
56585
- }
56586
- }
56587
- function updateSessionPhase(nextPhase, startCwd = process.cwd(), patch = {}) {
56588
- const filePath = findSessionStateFile(startCwd);
56589
- if (!filePath) throw new Error("Session state file not found");
56590
- const current = readSessionState(startCwd);
56591
- if (!current) throw new Error("Session state file invalid");
56592
- if (!isPhase(nextPhase)) {
56593
- throw new Error(`Invalid session phase: ${String(nextPhase)}`);
56594
- }
56595
- if (current.phase !== nextPhase && !ALLOWED_TRANSITIONS[current.phase].includes(nextPhase)) {
56596
- throw new Error(`Invalid phase transition: ${current.phase} -> ${nextPhase}`);
56597
- }
56598
- const nextState = normalizeState({
56599
- ...current,
56600
- ...patch,
56601
- phase: nextPhase
56602
- });
56603
- (0, import_node_fs4.writeFileSync)(filePath, JSON.stringify(nextState, null, 2) + "\n", "utf8");
56604
- return nextState;
56605
- }
56606
-
56607
- // src/core/xtrm-finish.ts
56608
- var DEFAULT_POLL_INTERVAL_MS = 5e3;
56609
- var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
56610
- function run2(cmd, args, cwd) {
56611
- const r = (0, import_node_child_process7.spawnSync)(cmd, args, {
56612
- cwd,
56613
- encoding: "utf8",
56614
- stdio: ["pipe", "pipe", "pipe"]
56615
- });
56616
- return {
56617
- code: r.status ?? 1,
56618
- stdout: (r.stdout ?? "").trim(),
56619
- stderr: (r.stderr ?? "").trim()
56620
- };
56621
- }
56622
- function getControlRepoRoot(cwd) {
56623
- const commonDir = run2("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], cwd);
56624
- if (commonDir.code === 0 && commonDir.stdout) {
56625
- return commonDir.stdout.replace(/\/.git$/, "");
56626
- }
56627
- return cwd;
56628
- }
56629
- function resolveExecutionCwd(controlCwd, state) {
56630
- if (state.worktreePath && (0, import_node_fs5.existsSync)(state.worktreePath)) {
56631
- return state.worktreePath;
56632
- }
56633
- return controlCwd;
56634
- }
56635
- function parsePrCreate(stdout) {
56636
- const urlMatch = stdout.match(/https?:\/\/\S+\/pull\/(\d+)/);
56637
- if (urlMatch) {
56638
- return { prNumber: Number(urlMatch[1]), prUrl: urlMatch[0] };
56639
- }
56640
- const numberMatch = stdout.match(/#(\d+)/);
56641
- if (numberMatch) {
56642
- return { prNumber: Number(numberMatch[1]), prUrl: null };
56643
- }
56644
- return { prNumber: null, prUrl: null };
56645
- }
56646
- function getConflictFiles(cwd) {
56647
- const out = run2("git", ["diff", "--name-only", "--diff-filter=U"], cwd);
56648
- if (out.code !== 0 || !out.stdout) return [];
56649
- return out.stdout.split("\n").map((s) => s.trim()).filter(Boolean);
56650
- }
56651
- async function delay2(ms) {
56652
- if (ms <= 0) return;
56653
- await new Promise((resolve2) => setTimeout(resolve2, ms));
56654
- }
56655
- function ensureCleanPhaseTransition(cwd, phase, patch = {}) {
56656
- try {
56657
- updateSessionPhase(phase, cwd, patch);
56658
- } catch {
56659
- }
56660
- }
56661
- function handleRebaseAndPush(cwd) {
56662
- const fetch = run2("git", ["fetch", "origin"], cwd);
56663
- if (fetch.code !== 0) return { ok: false, error: fetch.stderr || fetch.stdout };
56664
- const rebase = run2("git", ["rebase", "origin/main"], cwd);
56665
- if (rebase.code !== 0) {
56666
- const conflicts = getConflictFiles(cwd);
56667
- return { ok: false, conflicts, error: rebase.stderr || rebase.stdout };
56668
- }
56669
- const push = run2("git", ["push", "--force-with-lease"], cwd);
56670
- if (push.code !== 0) {
56671
- return { ok: false, error: push.stderr || push.stdout };
56672
- }
56673
- return { ok: true };
56674
- }
56675
- function cleanupPhase(controlCwd, state) {
56676
- if ((0, import_node_fs5.existsSync)(state.worktreePath)) {
56677
- const rm = run2("git", ["worktree", "remove", state.worktreePath, "--force"], controlCwd);
56678
- if (rm.code !== 0) {
56679
- return { ok: false, message: rm.stderr || rm.stdout || `Failed to remove worktree ${state.worktreePath}` };
56680
- }
56681
- }
56682
- run2("git", ["fetch", "--prune"], controlCwd);
56683
- ensureCleanPhaseTransition(controlCwd, "cleanup-done");
56684
- const prLabel = state.prNumber != null ? `#${state.prNumber}` : "(unknown PR)";
56685
- return { ok: true, message: `Done. PR ${prLabel} merged. Worktree removed.` };
56686
- }
56687
- async function pollUntilMerged(controlCwd, executionCwd, state, opts) {
56688
- if (state.prNumber == null) {
56689
- return { ok: false, message: "Session state missing prNumber. Re-run phase 1 before polling." };
56690
- }
56691
- const started = Date.now();
56692
- while (Date.now() - started < opts.timeoutMs) {
56693
- const view = run2("gh", ["pr", "view", String(state.prNumber), "--json", "state,mergeStateStatus,mergeable"], executionCwd);
56694
- if (view.code !== 0) {
56695
- return { ok: false, message: view.stderr || view.stdout || `Failed to inspect PR #${state.prNumber}` };
56696
- }
56697
- let payload = null;
56698
- try {
56699
- payload = JSON.parse(view.stdout);
56700
- } catch {
56701
- return { ok: false, message: `Unable to parse gh pr view output for #${state.prNumber}` };
56702
- }
56703
- ensureCleanPhaseTransition(controlCwd, "waiting-merge");
56704
- if (payload.state === "MERGED") {
56705
- ensureCleanPhaseTransition(controlCwd, "merged");
56706
- const latest = readSessionState(controlCwd) ?? state;
56707
- return cleanupPhase(controlCwd, latest);
56708
- }
56709
- if (payload.mergeStateStatus === "BEHIND") {
56710
- run2("git", ["fetch", "origin"], executionCwd);
56711
- run2("git", ["push"], executionCwd);
56712
- await delay2(opts.pollIntervalMs);
56713
- continue;
56714
- }
56715
- if (payload.mergeable === "CONFLICTING") {
56716
- const rebased = handleRebaseAndPush(executionCwd);
56717
- if (!rebased.ok) {
56718
- const conflictFiles = rebased.conflicts ?? getConflictFiles(executionCwd);
56719
- ensureCleanPhaseTransition(controlCwd, "conflicting", { conflictFiles });
56720
- return {
56721
- ok: false,
56722
- message: `Conflicts in: ${conflictFiles.join(", ") || "unknown files"}. Resolve, push, then re-run xtrm finish.`
56723
- };
56724
- }
56725
- ensureCleanPhaseTransition(controlCwd, "waiting-merge", { conflictFiles: [] });
56726
- await delay2(opts.pollIntervalMs);
56727
- continue;
56728
- }
56729
- await delay2(opts.pollIntervalMs);
56730
- }
56731
- ensureCleanPhaseTransition(controlCwd, "pending-cleanup");
56732
- return {
56733
- ok: false,
56734
- message: `PR #${state.prNumber} not yet merged. Run xtrm finish when ready.`
56735
- };
56736
- }
56737
- function isWorkingTreeDirty(cwd) {
56738
- const st = run2("git", ["status", "--porcelain"], cwd);
56739
- return st.code === 0 && st.stdout.length > 0;
56740
- }
56741
- function runPhase1(controlCwd, executionCwd, state) {
56742
- if (isWorkingTreeDirty(executionCwd)) {
56743
- const add = run2("git", ["add", "-A"], executionCwd);
56744
- if (add.code !== 0) return { ok: false, message: add.stderr || add.stdout };
56745
- const msg = `feat(${state.issueId}): ${state.branch}`;
56746
- const commit = run2("git", ["commit", "-m", msg], executionCwd);
56747
- if (commit.code !== 0) {
56748
- return { ok: false, message: commit.stderr || commit.stdout || "git commit failed" };
56749
- }
56750
- }
56751
- const push = run2("git", ["push", "-u", "origin", state.branch], executionCwd);
56752
- if (push.code !== 0) return { ok: false, message: push.stderr || push.stdout || "git push failed" };
56753
- const create = run2("gh", ["pr", "create", "--fill"], executionCwd);
56754
- if (create.code !== 0) return { ok: false, message: create.stderr || create.stdout || "gh pr create failed" };
56755
- const parsed = parsePrCreate(create.stdout);
56756
- const merge2 = run2("gh", ["pr", "merge", "--squash", "--auto"], executionCwd);
56757
- if (merge2.code !== 0) return { ok: false, message: merge2.stderr || merge2.stdout || "gh pr merge failed" };
56758
- ensureCleanPhaseTransition(controlCwd, "phase1-done", {
56759
- prNumber: parsed.prNumber,
56760
- prUrl: parsed.prUrl
56761
- });
56762
- ensureCleanPhaseTransition(controlCwd, "waiting-merge", {
56763
- prNumber: parsed.prNumber,
56764
- prUrl: parsed.prUrl
56765
- });
56766
- return { ok: true, message: "phase1 complete" };
56767
- }
56768
- async function runXtrmFinish(options = {}) {
56769
- const cwd = options.cwd ?? process.cwd();
56770
- const controlCwd = getControlRepoRoot(cwd);
56771
- const state = readSessionState(controlCwd);
56772
- if (!state) {
56773
- return { ok: false, message: "No .xtrm-session-state.json found. Claim an issue first (bd update <id> --claim)." };
56774
- }
56775
- const executionCwd = resolveExecutionCwd(controlCwd, state);
56776
- const opts = {
56777
- cwd: controlCwd,
56778
- pollIntervalMs: options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS,
56779
- timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS
56780
- };
56781
- if (state.phase === "cleanup-done") {
56782
- return { ok: true, message: "Session is already cleanup-done." };
56783
- }
56784
- if (state.phase === "conflicting") {
56785
- const resolved = handleRebaseAndPush(executionCwd);
56786
- if (!resolved.ok) {
56787
- const files = resolved.conflicts ?? getConflictFiles(executionCwd);
56788
- ensureCleanPhaseTransition(controlCwd, "conflicting", { conflictFiles: files });
56789
- return { ok: false, message: `Conflicts in: ${files.join(", ") || "unknown files"}. Resolve, push, then re-run xtrm finish.` };
56790
- }
56791
- ensureCleanPhaseTransition(controlCwd, "waiting-merge", { conflictFiles: [] });
56792
- const refreshed2 = readSessionState(controlCwd) ?? state;
56793
- return pollUntilMerged(controlCwd, executionCwd, refreshed2, opts);
56794
- }
56795
- if (state.phase === "waiting-merge" || state.phase === "pending-cleanup" || state.phase === "merged") {
56796
- const refreshed2 = readSessionState(controlCwd) ?? state;
56797
- if (refreshed2.phase === "merged") return cleanupPhase(controlCwd, refreshed2);
56798
- return pollUntilMerged(controlCwd, executionCwd, refreshed2, opts);
56799
- }
56800
- const phase1 = runPhase1(controlCwd, executionCwd, state);
56801
- if (!phase1.ok) return phase1;
56802
- const refreshed = readSessionState(controlCwd) ?? state;
56803
- return pollUntilMerged(controlCwd, executionCwd, refreshed, opts);
56804
- }
56805
-
56806
- // src/commands/finish.ts
56807
- function createFinishCommand() {
56808
- return new Command("finish").description("Complete session closure lifecycle (phase1 + merge polling + cleanup)").option("--poll-interval-ms <ms>", "Polling interval for PR state checks", (v) => Number(v), 5e3).option("--timeout-ms <ms>", "Maximum wait time before pending-cleanup", (v) => Number(v), 10 * 60 * 1e3).action(async (opts) => {
56809
- const result = await runXtrmFinish({
56810
- cwd: process.cwd(),
56811
- pollIntervalMs: opts.pollIntervalMs,
56812
- timeoutMs: opts.timeoutMs
56813
- });
56814
- if (result.ok) {
56815
- console.log(kleur_default.green(`
56816
- \u2713 ${result.message}
56817
- `));
56818
- return;
56819
- }
56820
- console.error(kleur_default.red(`
56821
- \u2717 ${result.message}
56822
- `));
56823
- process.exitCode = 1;
56824
- });
56825
- }
56826
-
56827
56433
  // src/commands/end.ts
56828
56434
  var import_prompts5 = __toESM(require_prompts3(), 1);
56829
- var import_node_child_process8 = require("child_process");
56435
+ var import_node_child_process6 = require("child_process");
56830
56436
  function git(args, cwd) {
56831
- const r = (0, import_node_child_process8.spawnSync)("git", args, { cwd, encoding: "utf8", stdio: "pipe" });
56437
+ const r = (0, import_node_child_process6.spawnSync)("git", args, { cwd, encoding: "utf8", stdio: "pipe" });
56832
56438
  return { ok: r.status === 0, out: (r.stdout ?? "").trim(), err: (r.stderr ?? "").trim() };
56833
56439
  }
56834
56440
  function bd(args, cwd) {
56835
- const r = (0, import_node_child_process8.spawnSync)("bd", args, { cwd, encoding: "utf8", stdio: "pipe" });
56441
+ const r = (0, import_node_child_process6.spawnSync)("bd", args, { cwd, encoding: "utf8", stdio: "pipe" });
56836
56442
  return { ok: r.status === 0, out: (r.stdout ?? "").trim() };
56837
56443
  }
56838
56444
  function extractIssueIds(commitLog) {
@@ -56960,7 +56566,7 @@ function createEndCommand() {
56960
56566
  console.log(kleur_default.dim(" Creating PR..."));
56961
56567
  const prArgs = ["pr", "create", "--title", prTitle, "--body", prBody];
56962
56568
  if (opts.draft) prArgs.push("--draft");
56963
- const prResult = (0, import_node_child_process8.spawnSync)("gh", prArgs, { cwd, encoding: "utf8", stdio: "pipe" });
56569
+ const prResult = (0, import_node_child_process6.spawnSync)("gh", prArgs, { cwd, encoding: "utf8", stdio: "pipe" });
56964
56570
  if (prResult.status !== 0) {
56965
56571
  console.error(kleur_default.red(`
56966
56572
  \u2717 PR creation failed:
@@ -56990,7 +56596,7 @@ function createEndCommand() {
56990
56596
  if (doRemove) {
56991
56597
  try {
56992
56598
  const repoRoot = git(["rev-parse", "--show-toplevel"], cwd).out;
56993
- const removeResult = (0, import_node_child_process8.spawnSync)(
56599
+ const removeResult = (0, import_node_child_process6.spawnSync)(
56994
56600
  "git",
56995
56601
  ["worktree", "remove", cwd, "--force"],
56996
56602
  { cwd: repoRoot, encoding: "utf8", stdio: "pipe" }
@@ -57014,9 +56620,9 @@ function createEndCommand() {
57014
56620
 
57015
56621
  // src/commands/worktree.ts
57016
56622
  var import_prompts6 = __toESM(require_prompts3(), 1);
57017
- var import_node_child_process9 = require("child_process");
56623
+ var import_node_child_process7 = require("child_process");
57018
56624
  function listXtWorktrees(repoRoot) {
57019
- const r = (0, import_node_child_process9.spawnSync)("git", ["worktree", "list", "--porcelain"], {
56625
+ const r = (0, import_node_child_process7.spawnSync)("git", ["worktree", "list", "--porcelain"], {
57020
56626
  cwd: repoRoot,
57021
56627
  encoding: "utf8",
57022
56628
  stdio: "pipe"
@@ -57045,7 +56651,7 @@ function listXtWorktrees(repoRoot) {
57045
56651
  }
57046
56652
  function isMergedIntoMain(branch, repoRoot) {
57047
56653
  const branchShort = branch.replace("refs/heads/", "");
57048
- const r = (0, import_node_child_process9.spawnSync)("git", ["branch", "--merged", "origin/main", "--list", branchShort], {
56654
+ const r = (0, import_node_child_process7.spawnSync)("git", ["branch", "--merged", "origin/main", "--list", branchShort], {
57049
56655
  cwd: repoRoot,
57050
56656
  encoding: "utf8",
57051
56657
  stdio: "pipe"
@@ -57053,7 +56659,7 @@ function isMergedIntoMain(branch, repoRoot) {
57053
56659
  return (r.stdout ?? "").includes(branchShort);
57054
56660
  }
57055
56661
  function getRepoRoot(cwd) {
57056
- const r = (0, import_node_child_process9.spawnSync)("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8", stdio: "pipe" });
56662
+ const r = (0, import_node_child_process7.spawnSync)("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8", stdio: "pipe" });
57057
56663
  return r.ok ? r.stdout.trim() : cwd;
57058
56664
  }
57059
56665
  function createWorktreeCommand() {
@@ -57107,7 +56713,7 @@ function createWorktreeCommand() {
57107
56713
  return;
57108
56714
  }
57109
56715
  for (const wt of merged) {
57110
- const r = (0, import_node_child_process9.spawnSync)("git", ["worktree", "remove", wt.path, "--force"], {
56716
+ const r = (0, import_node_child_process7.spawnSync)("git", ["worktree", "remove", wt.path, "--force"], {
57111
56717
  cwd: repoRoot,
57112
56718
  encoding: "utf8",
57113
56719
  stdio: "pipe"
@@ -57147,7 +56753,7 @@ function createWorktreeCommand() {
57147
56753
  console.log(kleur_default.dim(" Cancelled\n"));
57148
56754
  return;
57149
56755
  }
57150
- const r = (0, import_node_child_process9.spawnSync)("git", ["worktree", "remove", target.path, "--force"], {
56756
+ const r = (0, import_node_child_process7.spawnSync)("git", ["worktree", "remove", target.path, "--force"], {
57151
56757
  cwd: repoRoot,
57152
56758
  encoding: "utf8",
57153
56759
  stdio: "pipe"
@@ -57233,7 +56839,7 @@ function pressAnyKey() {
57233
56839
  setTimeout(finish, 4e3);
57234
56840
  });
57235
56841
  }
57236
- function delay3(ms) {
56842
+ function delay2(ms) {
57237
56843
  return new Promise((r) => setTimeout(r, ms));
57238
56844
  }
57239
56845
  async function typewriterTagline(text) {
@@ -57243,7 +56849,7 @@ async function typewriterTagline(text) {
57243
56849
  process.stdout.write(prefix);
57244
56850
  for (const ch of text) {
57245
56851
  process.stdout.write(ch);
57246
- await delay3(CHAR_DELAY);
56852
+ await delay2(CHAR_DELAY);
57247
56853
  }
57248
56854
  process.stdout.write(suffix + "\n");
57249
56855
  }
@@ -57338,7 +56944,7 @@ async function printBanner(version3) {
57338
56944
  // src/index.ts
57339
56945
  var version2 = "0.0.0";
57340
56946
  try {
57341
- version2 = JSON.parse((0, import_node_fs6.readFileSync)((0, import_node_path7.resolve)(__dirname, "../package.json"), "utf8")).version;
56947
+ version2 = JSON.parse((0, import_node_fs4.readFileSync)((0, import_node_path6.resolve)(__dirname, "../package.json"), "utf8")).version;
57342
56948
  } catch {
57343
56949
  }
57344
56950
  var program2 = new Command();
@@ -57361,7 +56967,6 @@ program2.command("init").description("Alias for xtrm project init").action(async
57361
56967
  program2.addCommand(createStatusCommand());
57362
56968
  program2.addCommand(createResetCommand());
57363
56969
  program2.addCommand(createCleanCommand());
57364
- program2.addCommand(createFinishCommand());
57365
56970
  program2.addCommand(createEndCommand());
57366
56971
  program2.addCommand(createWorktreeCommand());
57367
56972
  program2.addCommand(createHelpCommand());