@slayzone/cli 0.36.0-beta.13 → 0.36.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/slay.js +636 -384
  2. package/package.json +1 -1
package/dist/slay.js CHANGED
@@ -1143,7 +1143,7 @@ var require_command = __commonJS({
1143
1143
  "../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/command.js"(exports2) {
1144
1144
  var EventEmitter = require("node:events").EventEmitter;
1145
1145
  var childProcess = require("node:child_process");
1146
- var path9 = require("node:path");
1146
+ var path10 = require("node:path");
1147
1147
  var fs7 = require("node:fs");
1148
1148
  var process2 = require("node:process");
1149
1149
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -2143,9 +2143,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2143
2143
  let launchWithNode = false;
2144
2144
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2145
2145
  function findFile(baseDir, baseName) {
2146
- const localBin = path9.resolve(baseDir, baseName);
2146
+ const localBin = path10.resolve(baseDir, baseName);
2147
2147
  if (fs7.existsSync(localBin)) return localBin;
2148
- if (sourceExt.includes(path9.extname(baseName))) return void 0;
2148
+ if (sourceExt.includes(path10.extname(baseName))) return void 0;
2149
2149
  const foundExt = sourceExt.find(
2150
2150
  (ext) => fs7.existsSync(`${localBin}${ext}`)
2151
2151
  );
@@ -2163,17 +2163,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
2163
2163
  } catch {
2164
2164
  resolvedScriptPath = this._scriptPath;
2165
2165
  }
2166
- executableDir = path9.resolve(
2167
- path9.dirname(resolvedScriptPath),
2166
+ executableDir = path10.resolve(
2167
+ path10.dirname(resolvedScriptPath),
2168
2168
  executableDir
2169
2169
  );
2170
2170
  }
2171
2171
  if (executableDir) {
2172
2172
  let localFile = findFile(executableDir, executableFile);
2173
2173
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2174
- const legacyName = path9.basename(
2174
+ const legacyName = path10.basename(
2175
2175
  this._scriptPath,
2176
- path9.extname(this._scriptPath)
2176
+ path10.extname(this._scriptPath)
2177
2177
  );
2178
2178
  if (legacyName !== this._name) {
2179
2179
  localFile = findFile(
@@ -2184,7 +2184,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2184
2184
  }
2185
2185
  executableFile = localFile || executableFile;
2186
2186
  }
2187
- launchWithNode = sourceExt.includes(path9.extname(executableFile));
2187
+ launchWithNode = sourceExt.includes(path10.extname(executableFile));
2188
2188
  let proc;
2189
2189
  if (process2.platform !== "win32") {
2190
2190
  if (launchWithNode) {
@@ -3031,7 +3031,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3031
3031
  * @return {Command}
3032
3032
  */
3033
3033
  nameFromFilename(filename) {
3034
- this._name = path9.basename(filename, path9.extname(filename));
3034
+ this._name = path10.basename(filename, path10.extname(filename));
3035
3035
  return this;
3036
3036
  }
3037
3037
  /**
@@ -3045,9 +3045,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3045
3045
  * @param {string} [path]
3046
3046
  * @return {(string|null|Command)}
3047
3047
  */
3048
- executableDir(path10) {
3049
- if (path10 === void 0) return this._executableDir;
3050
- this._executableDir = path10;
3048
+ executableDir(path11) {
3049
+ if (path11 === void 0) return this._executableDir;
3050
+ this._executableDir = path11;
3051
3051
  return this;
3052
3052
  }
3053
3053
  /**
@@ -3546,8 +3546,8 @@ var require_minimatch = __commonJS({
3546
3546
  return new Minimatch(pattern, options).match(p2);
3547
3547
  };
3548
3548
  module2.exports = minimatch;
3549
- var path9 = require_path();
3550
- minimatch.sep = path9.sep;
3549
+ var path10 = require_path();
3550
+ minimatch.sep = path10.sep;
3551
3551
  var GLOBSTAR = Symbol("globstar **");
3552
3552
  minimatch.GLOBSTAR = GLOBSTAR;
3553
3553
  var expand = require_brace_expansion();
@@ -4056,8 +4056,8 @@ var require_minimatch = __commonJS({
4056
4056
  if (this.empty) return f === "";
4057
4057
  if (f === "/" && partial) return true;
4058
4058
  const options = this.options;
4059
- if (path9.sep !== "/") {
4060
- f = f.split(path9.sep).join("/");
4059
+ if (path10.sep !== "/") {
4060
+ f = f.split(path10.sep).join("/");
4061
4061
  }
4062
4062
  f = f.split(slashSplit);
4063
4063
  this.debug(this.pattern, "split", f);
@@ -4155,8 +4155,8 @@ var require_readdir_glob = __commonJS({
4155
4155
  });
4156
4156
  });
4157
4157
  }
4158
- async function* exploreWalkAsync(dir, path9, followSymlinks, useStat, shouldSkip, strict) {
4159
- let files = await readdir(path9 + dir, strict);
4158
+ async function* exploreWalkAsync(dir, path10, followSymlinks, useStat, shouldSkip, strict) {
4159
+ let files = await readdir(path10 + dir, strict);
4160
4160
  for (const file of files) {
4161
4161
  let name = file.name;
4162
4162
  if (name === void 0) {
@@ -4165,7 +4165,7 @@ var require_readdir_glob = __commonJS({
4165
4165
  }
4166
4166
  const filename = dir + "/" + name;
4167
4167
  const relative = filename.slice(1);
4168
- const absolute = path9 + "/" + relative;
4168
+ const absolute = path10 + "/" + relative;
4169
4169
  let stats = null;
4170
4170
  if (useStat || followSymlinks) {
4171
4171
  stats = await stat(absolute, followSymlinks);
@@ -4179,15 +4179,15 @@ var require_readdir_glob = __commonJS({
4179
4179
  if (stats.isDirectory()) {
4180
4180
  if (!shouldSkip(relative)) {
4181
4181
  yield { relative, absolute, stats };
4182
- yield* exploreWalkAsync(filename, path9, followSymlinks, useStat, shouldSkip, false);
4182
+ yield* exploreWalkAsync(filename, path10, followSymlinks, useStat, shouldSkip, false);
4183
4183
  }
4184
4184
  } else {
4185
4185
  yield { relative, absolute, stats };
4186
4186
  }
4187
4187
  }
4188
4188
  }
4189
- async function* explore(path9, followSymlinks, useStat, shouldSkip) {
4190
- yield* exploreWalkAsync("", path9, followSymlinks, useStat, shouldSkip, true);
4189
+ async function* explore(path10, followSymlinks, useStat, shouldSkip) {
4190
+ yield* exploreWalkAsync("", path10, followSymlinks, useStat, shouldSkip, true);
4191
4191
  }
4192
4192
  function readOptions(options) {
4193
4193
  return {
@@ -6225,14 +6225,14 @@ var require_polyfills = __commonJS({
6225
6225
  fs7.fstatSync = statFixSync(fs7.fstatSync);
6226
6226
  fs7.lstatSync = statFixSync(fs7.lstatSync);
6227
6227
  if (fs7.chmod && !fs7.lchmod) {
6228
- fs7.lchmod = function(path9, mode, cb) {
6228
+ fs7.lchmod = function(path10, mode, cb) {
6229
6229
  if (cb) process.nextTick(cb);
6230
6230
  };
6231
6231
  fs7.lchmodSync = function() {
6232
6232
  };
6233
6233
  }
6234
6234
  if (fs7.chown && !fs7.lchown) {
6235
- fs7.lchown = function(path9, uid, gid, cb) {
6235
+ fs7.lchown = function(path10, uid, gid, cb) {
6236
6236
  if (cb) process.nextTick(cb);
6237
6237
  };
6238
6238
  fs7.lchownSync = function() {
@@ -6299,9 +6299,9 @@ var require_polyfills = __commonJS({
6299
6299
  };
6300
6300
  })(fs7.readSync);
6301
6301
  function patchLchmod(fs8) {
6302
- fs8.lchmod = function(path9, mode, callback) {
6302
+ fs8.lchmod = function(path10, mode, callback) {
6303
6303
  fs8.open(
6304
- path9,
6304
+ path10,
6305
6305
  constants.O_WRONLY | constants.O_SYMLINK,
6306
6306
  mode,
6307
6307
  function(err, fd) {
@@ -6317,8 +6317,8 @@ var require_polyfills = __commonJS({
6317
6317
  }
6318
6318
  );
6319
6319
  };
6320
- fs8.lchmodSync = function(path9, mode) {
6321
- var fd = fs8.openSync(path9, constants.O_WRONLY | constants.O_SYMLINK, mode);
6320
+ fs8.lchmodSync = function(path10, mode) {
6321
+ var fd = fs8.openSync(path10, constants.O_WRONLY | constants.O_SYMLINK, mode);
6322
6322
  var threw = true;
6323
6323
  var ret;
6324
6324
  try {
@@ -6339,8 +6339,8 @@ var require_polyfills = __commonJS({
6339
6339
  }
6340
6340
  function patchLutimes(fs8) {
6341
6341
  if (constants.hasOwnProperty("O_SYMLINK") && fs8.futimes) {
6342
- fs8.lutimes = function(path9, at, mt, cb) {
6343
- fs8.open(path9, constants.O_SYMLINK, function(er, fd) {
6342
+ fs8.lutimes = function(path10, at, mt, cb) {
6343
+ fs8.open(path10, constants.O_SYMLINK, function(er, fd) {
6344
6344
  if (er) {
6345
6345
  if (cb) cb(er);
6346
6346
  return;
@@ -6352,8 +6352,8 @@ var require_polyfills = __commonJS({
6352
6352
  });
6353
6353
  });
6354
6354
  };
6355
- fs8.lutimesSync = function(path9, at, mt) {
6356
- var fd = fs8.openSync(path9, constants.O_SYMLINK);
6355
+ fs8.lutimesSync = function(path10, at, mt) {
6356
+ var fd = fs8.openSync(path10, constants.O_SYMLINK);
6357
6357
  var ret;
6358
6358
  var threw = true;
6359
6359
  try {
@@ -6471,11 +6471,11 @@ var require_legacy_streams = __commonJS({
6471
6471
  ReadStream,
6472
6472
  WriteStream
6473
6473
  };
6474
- function ReadStream(path9, options) {
6475
- if (!(this instanceof ReadStream)) return new ReadStream(path9, options);
6474
+ function ReadStream(path10, options) {
6475
+ if (!(this instanceof ReadStream)) return new ReadStream(path10, options);
6476
6476
  Stream.call(this);
6477
6477
  var self2 = this;
6478
- this.path = path9;
6478
+ this.path = path10;
6479
6479
  this.fd = null;
6480
6480
  this.readable = true;
6481
6481
  this.paused = false;
@@ -6520,10 +6520,10 @@ var require_legacy_streams = __commonJS({
6520
6520
  self2._read();
6521
6521
  });
6522
6522
  }
6523
- function WriteStream(path9, options) {
6524
- if (!(this instanceof WriteStream)) return new WriteStream(path9, options);
6523
+ function WriteStream(path10, options) {
6524
+ if (!(this instanceof WriteStream)) return new WriteStream(path10, options);
6525
6525
  Stream.call(this);
6526
- this.path = path9;
6526
+ this.path = path10;
6527
6527
  this.fd = null;
6528
6528
  this.writable = true;
6529
6529
  this.flags = "w";
@@ -6666,14 +6666,14 @@ var require_graceful_fs = __commonJS({
6666
6666
  fs8.createWriteStream = createWriteStream;
6667
6667
  var fs$readFile = fs8.readFile;
6668
6668
  fs8.readFile = readFile;
6669
- function readFile(path9, options, cb) {
6669
+ function readFile(path10, options, cb) {
6670
6670
  if (typeof options === "function")
6671
6671
  cb = options, options = null;
6672
- return go$readFile(path9, options, cb);
6673
- function go$readFile(path10, options2, cb2, startTime) {
6674
- return fs$readFile(path10, options2, function(err) {
6672
+ return go$readFile(path10, options, cb);
6673
+ function go$readFile(path11, options2, cb2, startTime) {
6674
+ return fs$readFile(path11, options2, function(err) {
6675
6675
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6676
- enqueue([go$readFile, [path10, options2, cb2], err, startTime || Date.now(), Date.now()]);
6676
+ enqueue([go$readFile, [path11, options2, cb2], err, startTime || Date.now(), Date.now()]);
6677
6677
  else {
6678
6678
  if (typeof cb2 === "function")
6679
6679
  cb2.apply(this, arguments);
@@ -6683,14 +6683,14 @@ var require_graceful_fs = __commonJS({
6683
6683
  }
6684
6684
  var fs$writeFile = fs8.writeFile;
6685
6685
  fs8.writeFile = writeFile;
6686
- function writeFile(path9, data, options, cb) {
6686
+ function writeFile(path10, data, options, cb) {
6687
6687
  if (typeof options === "function")
6688
6688
  cb = options, options = null;
6689
- return go$writeFile(path9, data, options, cb);
6690
- function go$writeFile(path10, data2, options2, cb2, startTime) {
6691
- return fs$writeFile(path10, data2, options2, function(err) {
6689
+ return go$writeFile(path10, data, options, cb);
6690
+ function go$writeFile(path11, data2, options2, cb2, startTime) {
6691
+ return fs$writeFile(path11, data2, options2, function(err) {
6692
6692
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6693
- enqueue([go$writeFile, [path10, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
6693
+ enqueue([go$writeFile, [path11, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
6694
6694
  else {
6695
6695
  if (typeof cb2 === "function")
6696
6696
  cb2.apply(this, arguments);
@@ -6701,14 +6701,14 @@ var require_graceful_fs = __commonJS({
6701
6701
  var fs$appendFile = fs8.appendFile;
6702
6702
  if (fs$appendFile)
6703
6703
  fs8.appendFile = appendFile;
6704
- function appendFile(path9, data, options, cb) {
6704
+ function appendFile(path10, data, options, cb) {
6705
6705
  if (typeof options === "function")
6706
6706
  cb = options, options = null;
6707
- return go$appendFile(path9, data, options, cb);
6708
- function go$appendFile(path10, data2, options2, cb2, startTime) {
6709
- return fs$appendFile(path10, data2, options2, function(err) {
6707
+ return go$appendFile(path10, data, options, cb);
6708
+ function go$appendFile(path11, data2, options2, cb2, startTime) {
6709
+ return fs$appendFile(path11, data2, options2, function(err) {
6710
6710
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6711
- enqueue([go$appendFile, [path10, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
6711
+ enqueue([go$appendFile, [path11, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
6712
6712
  else {
6713
6713
  if (typeof cb2 === "function")
6714
6714
  cb2.apply(this, arguments);
@@ -6739,31 +6739,31 @@ var require_graceful_fs = __commonJS({
6739
6739
  var fs$readdir = fs8.readdir;
6740
6740
  fs8.readdir = readdir;
6741
6741
  var noReaddirOptionVersions = /^v[0-5]\./;
6742
- function readdir(path9, options, cb) {
6742
+ function readdir(path10, options, cb) {
6743
6743
  if (typeof options === "function")
6744
6744
  cb = options, options = null;
6745
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path10, options2, cb2, startTime) {
6746
- return fs$readdir(path10, fs$readdirCallback(
6747
- path10,
6745
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path11, options2, cb2, startTime) {
6746
+ return fs$readdir(path11, fs$readdirCallback(
6747
+ path11,
6748
6748
  options2,
6749
6749
  cb2,
6750
6750
  startTime
6751
6751
  ));
6752
- } : function go$readdir2(path10, options2, cb2, startTime) {
6753
- return fs$readdir(path10, options2, fs$readdirCallback(
6754
- path10,
6752
+ } : function go$readdir2(path11, options2, cb2, startTime) {
6753
+ return fs$readdir(path11, options2, fs$readdirCallback(
6754
+ path11,
6755
6755
  options2,
6756
6756
  cb2,
6757
6757
  startTime
6758
6758
  ));
6759
6759
  };
6760
- return go$readdir(path9, options, cb);
6761
- function fs$readdirCallback(path10, options2, cb2, startTime) {
6760
+ return go$readdir(path10, options, cb);
6761
+ function fs$readdirCallback(path11, options2, cb2, startTime) {
6762
6762
  return function(err, files) {
6763
6763
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6764
6764
  enqueue([
6765
6765
  go$readdir,
6766
- [path10, options2, cb2],
6766
+ [path11, options2, cb2],
6767
6767
  err,
6768
6768
  startTime || Date.now(),
6769
6769
  Date.now()
@@ -6834,7 +6834,7 @@ var require_graceful_fs = __commonJS({
6834
6834
  enumerable: true,
6835
6835
  configurable: true
6836
6836
  });
6837
- function ReadStream(path9, options) {
6837
+ function ReadStream(path10, options) {
6838
6838
  if (this instanceof ReadStream)
6839
6839
  return fs$ReadStream.apply(this, arguments), this;
6840
6840
  else
@@ -6854,7 +6854,7 @@ var require_graceful_fs = __commonJS({
6854
6854
  }
6855
6855
  });
6856
6856
  }
6857
- function WriteStream(path9, options) {
6857
+ function WriteStream(path10, options) {
6858
6858
  if (this instanceof WriteStream)
6859
6859
  return fs$WriteStream.apply(this, arguments), this;
6860
6860
  else
@@ -6872,22 +6872,22 @@ var require_graceful_fs = __commonJS({
6872
6872
  }
6873
6873
  });
6874
6874
  }
6875
- function createReadStream(path9, options) {
6876
- return new fs8.ReadStream(path9, options);
6875
+ function createReadStream(path10, options) {
6876
+ return new fs8.ReadStream(path10, options);
6877
6877
  }
6878
- function createWriteStream(path9, options) {
6879
- return new fs8.WriteStream(path9, options);
6878
+ function createWriteStream(path10, options) {
6879
+ return new fs8.WriteStream(path10, options);
6880
6880
  }
6881
6881
  var fs$open = fs8.open;
6882
6882
  fs8.open = open;
6883
- function open(path9, flags, mode, cb) {
6883
+ function open(path10, flags, mode, cb) {
6884
6884
  if (typeof mode === "function")
6885
6885
  cb = mode, mode = null;
6886
- return go$open(path9, flags, mode, cb);
6887
- function go$open(path10, flags2, mode2, cb2, startTime) {
6888
- return fs$open(path10, flags2, mode2, function(err, fd) {
6886
+ return go$open(path10, flags, mode, cb);
6887
+ function go$open(path11, flags2, mode2, cb2, startTime) {
6888
+ return fs$open(path11, flags2, mode2, function(err, fd) {
6889
6889
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6890
- enqueue([go$open, [path10, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
6890
+ enqueue([go$open, [path11, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
6891
6891
  else {
6892
6892
  if (typeof cb2 === "function")
6893
6893
  cb2.apply(this, arguments);
@@ -8992,22 +8992,22 @@ var require_lazystream = __commonJS({
8992
8992
  // ../../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js
8993
8993
  var require_normalize_path = __commonJS({
8994
8994
  "../../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js"(exports2, module2) {
8995
- module2.exports = function(path9, stripTrailing) {
8996
- if (typeof path9 !== "string") {
8995
+ module2.exports = function(path10, stripTrailing) {
8996
+ if (typeof path10 !== "string") {
8997
8997
  throw new TypeError("expected path to be a string");
8998
8998
  }
8999
- if (path9 === "\\" || path9 === "/") return "/";
9000
- var len = path9.length;
9001
- if (len <= 1) return path9;
8999
+ if (path10 === "\\" || path10 === "/") return "/";
9000
+ var len = path10.length;
9001
+ if (len <= 1) return path10;
9002
9002
  var prefix = "";
9003
- if (len > 4 && path9[3] === "\\") {
9004
- var ch = path9[2];
9005
- if ((ch === "?" || ch === ".") && path9.slice(0, 2) === "\\\\") {
9006
- path9 = path9.slice(2);
9003
+ if (len > 4 && path10[3] === "\\") {
9004
+ var ch = path10[2];
9005
+ if ((ch === "?" || ch === ".") && path10.slice(0, 2) === "\\\\") {
9006
+ path10 = path10.slice(2);
9007
9007
  prefix = "//";
9008
9008
  }
9009
9009
  }
9010
- var segs = path9.split(/[/\\]+/);
9010
+ var segs = path10.split(/[/\\]+/);
9011
9011
  if (stripTrailing !== false && segs[segs.length - 1] === "") {
9012
9012
  segs.pop();
9013
9013
  }
@@ -17708,11 +17708,11 @@ var require_commonjs = __commonJS({
17708
17708
  return (f) => f.length === len && f !== "." && f !== "..";
17709
17709
  };
17710
17710
  var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
17711
- var path9 = {
17711
+ var path10 = {
17712
17712
  win32: { sep: "\\" },
17713
17713
  posix: { sep: "/" }
17714
17714
  };
17715
- exports2.sep = defaultPlatform === "win32" ? path9.win32.sep : path9.posix.sep;
17715
+ exports2.sep = defaultPlatform === "win32" ? path10.win32.sep : path10.posix.sep;
17716
17716
  exports2.minimatch.sep = exports2.sep;
17717
17717
  exports2.GLOBSTAR = Symbol("globstar **");
17718
17718
  exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
@@ -20960,12 +20960,12 @@ var require_commonjs4 = __commonJS({
20960
20960
  /**
20961
20961
  * Get the Path object referenced by the string path, resolved from this Path
20962
20962
  */
20963
- resolve(path9) {
20964
- if (!path9) {
20963
+ resolve(path10) {
20964
+ if (!path10) {
20965
20965
  return this;
20966
20966
  }
20967
- const rootPath = this.getRootString(path9);
20968
- const dir = path9.substring(rootPath.length);
20967
+ const rootPath = this.getRootString(path10);
20968
+ const dir = path10.substring(rootPath.length);
20969
20969
  const dirParts = dir.split(this.splitSep);
20970
20970
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
20971
20971
  return result;
@@ -21718,8 +21718,8 @@ var require_commonjs4 = __commonJS({
21718
21718
  /**
21719
21719
  * @internal
21720
21720
  */
21721
- getRootString(path9) {
21722
- return node_path_1.win32.parse(path9).root;
21721
+ getRootString(path10) {
21722
+ return node_path_1.win32.parse(path10).root;
21723
21723
  }
21724
21724
  /**
21725
21725
  * @internal
@@ -21766,8 +21766,8 @@ var require_commonjs4 = __commonJS({
21766
21766
  /**
21767
21767
  * @internal
21768
21768
  */
21769
- getRootString(path9) {
21770
- return path9.startsWith("/") ? "/" : "";
21769
+ getRootString(path10) {
21770
+ return path10.startsWith("/") ? "/" : "";
21771
21771
  }
21772
21772
  /**
21773
21773
  * @internal
@@ -21857,11 +21857,11 @@ var require_commonjs4 = __commonJS({
21857
21857
  /**
21858
21858
  * Get the depth of a provided path, string, or the cwd
21859
21859
  */
21860
- depth(path9 = this.cwd) {
21861
- if (typeof path9 === "string") {
21862
- path9 = this.cwd.resolve(path9);
21860
+ depth(path10 = this.cwd) {
21861
+ if (typeof path10 === "string") {
21862
+ path10 = this.cwd.resolve(path10);
21863
21863
  }
21864
- return path9.depth();
21864
+ return path10.depth();
21865
21865
  }
21866
21866
  /**
21867
21867
  * Return the cache of child entries. Exposed so subclasses can create
@@ -22348,9 +22348,9 @@ var require_commonjs4 = __commonJS({
22348
22348
  process2();
22349
22349
  return results;
22350
22350
  }
22351
- chdir(path9 = this.cwd) {
22351
+ chdir(path10 = this.cwd) {
22352
22352
  const oldCwd = this.cwd;
22353
- this.cwd = typeof path9 === "string" ? this.cwd.resolve(path9) : path9;
22353
+ this.cwd = typeof path10 === "string" ? this.cwd.resolve(path10) : path10;
22354
22354
  this.cwd[setAsCwd](oldCwd);
22355
22355
  }
22356
22356
  };
@@ -22738,8 +22738,8 @@ var require_processor = __commonJS({
22738
22738
  }
22739
22739
  // match, absolute, ifdir
22740
22740
  entries() {
22741
- return [...this.store.entries()].map(([path9, n]) => [
22742
- path9,
22741
+ return [...this.store.entries()].map(([path10, n]) => [
22742
+ path10,
22743
22743
  !!(n & 2),
22744
22744
  !!(n & 1)
22745
22745
  ]);
@@ -22957,9 +22957,9 @@ var require_walker = __commonJS({
22957
22957
  signal;
22958
22958
  maxDepth;
22959
22959
  includeChildMatches;
22960
- constructor(patterns, path9, opts) {
22960
+ constructor(patterns, path10, opts) {
22961
22961
  this.patterns = patterns;
22962
- this.path = path9;
22962
+ this.path = path10;
22963
22963
  this.opts = opts;
22964
22964
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
22965
22965
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -22978,11 +22978,11 @@ var require_walker = __commonJS({
22978
22978
  });
22979
22979
  }
22980
22980
  }
22981
- #ignored(path9) {
22982
- return this.seen.has(path9) || !!this.#ignore?.ignored?.(path9);
22981
+ #ignored(path10) {
22982
+ return this.seen.has(path10) || !!this.#ignore?.ignored?.(path10);
22983
22983
  }
22984
- #childrenIgnored(path9) {
22985
- return !!this.#ignore?.childrenIgnored?.(path9);
22984
+ #childrenIgnored(path10) {
22985
+ return !!this.#ignore?.childrenIgnored?.(path10);
22986
22986
  }
22987
22987
  // backpressure mechanism
22988
22988
  pause() {
@@ -23198,8 +23198,8 @@ var require_walker = __commonJS({
23198
23198
  exports2.GlobUtil = GlobUtil;
23199
23199
  var GlobWalker = class extends GlobUtil {
23200
23200
  matches = /* @__PURE__ */ new Set();
23201
- constructor(patterns, path9, opts) {
23202
- super(patterns, path9, opts);
23201
+ constructor(patterns, path10, opts) {
23202
+ super(patterns, path10, opts);
23203
23203
  }
23204
23204
  matchEmit(e) {
23205
23205
  this.matches.add(e);
@@ -23237,8 +23237,8 @@ var require_walker = __commonJS({
23237
23237
  exports2.GlobWalker = GlobWalker;
23238
23238
  var GlobStream = class extends GlobUtil {
23239
23239
  results;
23240
- constructor(patterns, path9, opts) {
23241
- super(patterns, path9, opts);
23240
+ constructor(patterns, path10, opts) {
23241
+ super(patterns, path10, opts);
23242
23242
  this.results = new minipass_1.Minipass({
23243
23243
  signal: this.signal,
23244
23244
  objectMode: true
@@ -23594,7 +23594,7 @@ var require_commonjs5 = __commonJS({
23594
23594
  var require_file = __commonJS({
23595
23595
  "../../../node_modules/.pnpm/archiver-utils@5.0.2/node_modules/archiver-utils/file.js"(exports2, module2) {
23596
23596
  var fs7 = require_graceful_fs();
23597
- var path9 = require("path");
23597
+ var path10 = require("path");
23598
23598
  var flatten = require_flatten();
23599
23599
  var difference = require_difference();
23600
23600
  var union = require_union();
@@ -23619,7 +23619,7 @@ var require_file = __commonJS({
23619
23619
  return result;
23620
23620
  };
23621
23621
  file.exists = function() {
23622
- var filepath = path9.join.apply(path9, arguments);
23622
+ var filepath = path10.join.apply(path10, arguments);
23623
23623
  return fs7.existsSync(filepath);
23624
23624
  };
23625
23625
  file.expand = function(...args) {
@@ -23633,7 +23633,7 @@ var require_file = __commonJS({
23633
23633
  });
23634
23634
  if (options.filter) {
23635
23635
  matches = matches.filter(function(filepath) {
23636
- filepath = path9.join(options.cwd || "", filepath);
23636
+ filepath = path10.join(options.cwd || "", filepath);
23637
23637
  try {
23638
23638
  if (typeof options.filter === "function") {
23639
23639
  return options.filter(filepath);
@@ -23650,7 +23650,7 @@ var require_file = __commonJS({
23650
23650
  file.expandMapping = function(patterns, destBase, options) {
23651
23651
  options = Object.assign({
23652
23652
  rename: function(destBase2, destPath) {
23653
- return path9.join(destBase2 || "", destPath);
23653
+ return path10.join(destBase2 || "", destPath);
23654
23654
  }
23655
23655
  }, options);
23656
23656
  var files = [];
@@ -23658,14 +23658,14 @@ var require_file = __commonJS({
23658
23658
  file.expand(options, patterns).forEach(function(src) {
23659
23659
  var destPath = src;
23660
23660
  if (options.flatten) {
23661
- destPath = path9.basename(destPath);
23661
+ destPath = path10.basename(destPath);
23662
23662
  }
23663
23663
  if (options.ext) {
23664
23664
  destPath = destPath.replace(/(\.[^\/]*)?$/, options.ext);
23665
23665
  }
23666
23666
  var dest = options.rename(destBase, destPath, options);
23667
23667
  if (options.cwd) {
23668
- src = path9.join(options.cwd, src);
23668
+ src = path10.join(options.cwd, src);
23669
23669
  }
23670
23670
  dest = dest.replace(pathSeparatorRe, "/");
23671
23671
  src = src.replace(pathSeparatorRe, "/");
@@ -23747,7 +23747,7 @@ var require_file = __commonJS({
23747
23747
  var require_archiver_utils = __commonJS({
23748
23748
  "../../../node_modules/.pnpm/archiver-utils@5.0.2/node_modules/archiver-utils/index.js"(exports2, module2) {
23749
23749
  var fs7 = require_graceful_fs();
23750
- var path9 = require("path");
23750
+ var path10 = require("path");
23751
23751
  var isStream = require_is_stream();
23752
23752
  var lazystream = require_lazystream();
23753
23753
  var normalizePath = require_normalize_path();
@@ -23835,11 +23835,11 @@ var require_archiver_utils = __commonJS({
23835
23835
  if (!file) {
23836
23836
  return callback(null, results);
23837
23837
  }
23838
- filepath = path9.join(dirpath, file);
23838
+ filepath = path10.join(dirpath, file);
23839
23839
  fs7.stat(filepath, function(err2, stats) {
23840
23840
  results.push({
23841
23841
  path: filepath,
23842
- relative: path9.relative(base, filepath).replace(/\\/g, "/"),
23842
+ relative: path10.relative(base, filepath).replace(/\\/g, "/"),
23843
23843
  stats
23844
23844
  });
23845
23845
  if (stats && stats.isDirectory()) {
@@ -23901,7 +23901,7 @@ var require_core = __commonJS({
23901
23901
  var fs7 = require("fs");
23902
23902
  var glob = require_readdir_glob();
23903
23903
  var async = require_async();
23904
- var path9 = require("path");
23904
+ var path10 = require("path");
23905
23905
  var util = require_archiver_utils();
23906
23906
  var inherits = require("util").inherits;
23907
23907
  var ArchiverError = require_error2();
@@ -24177,9 +24177,9 @@ var require_core = __commonJS({
24177
24177
  task.source = Buffer.concat([]);
24178
24178
  } else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) {
24179
24179
  var linkPath = fs7.readlinkSync(task.filepath);
24180
- var dirName = path9.dirname(task.filepath);
24180
+ var dirName = path10.dirname(task.filepath);
24181
24181
  task.data.type = "symlink";
24182
- task.data.linkname = path9.relative(dirName, path9.resolve(dirName, linkPath));
24182
+ task.data.linkname = path10.relative(dirName, path10.resolve(dirName, linkPath));
24183
24183
  task.data.sourceType = "buffer";
24184
24184
  task.source = Buffer.concat([]);
24185
24185
  } else {
@@ -28459,10 +28459,10 @@ function getSlayzoneMode() {
28459
28459
 
28460
28460
  // ../../shared/platform/src/hub-addr.ts
28461
28461
  var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1"]);
28462
- function hubUrlFromAddr(addr, kind, path9 = "", mode = getSlayzoneMode()) {
28462
+ function hubUrlFromAddr(addr, kind, path10 = "", mode = getSlayzoneMode()) {
28463
28463
  const secure = mode === "remote";
28464
28464
  const scheme = kind === "ws" ? secure ? "wss" : "ws" : secure ? "https" : "http";
28465
- return `${scheme}://${addr}${path9}`;
28465
+ return `${scheme}://${addr}${path10}`;
28466
28466
  }
28467
28467
  function isBareAuthority(addr) {
28468
28468
  if (addr === "" || /[/\s]/.test(addr) || addr.includes("://")) return false;
@@ -28704,7 +28704,9 @@ function resolveHubTarget() {
28704
28704
  const addr = envAddress.trim();
28705
28705
  const baseUrl = isBareAuthority(addr) ? normalizeHubUrl(hubUrlFromAddr(addr, "http")) : null;
28706
28706
  if (!baseUrl) {
28707
- console.error(`Invalid SLAYZONE_HUB_ADDRESS (expected host[:port], no scheme/path): ${envAddress}`);
28707
+ console.error(
28708
+ `Invalid SLAYZONE_HUB_ADDRESS (expected host[:port], no scheme/path): ${envAddress}`
28709
+ );
28708
28710
  process.exit(1);
28709
28711
  }
28710
28712
  return { baseUrl, token: envToken || null };
@@ -28713,9 +28715,7 @@ function resolveHubTarget() {
28713
28715
  if (file) {
28714
28716
  const baseUrl = normalizeHubUrl(file.url);
28715
28717
  if (!baseUrl) {
28716
- console.error(
28717
- `Warning: ignoring invalid hub URL in ${getHubConfigPath()} \u2014 using local app.`
28718
- );
28718
+ console.error(`Warning: ignoring invalid hub URL in ${getHubConfigPath()} \u2014 using local app.`);
28719
28719
  return null;
28720
28720
  }
28721
28721
  const fileToken = typeof file.token === "string" && file.token !== "" ? file.token : null;
@@ -28746,13 +28746,23 @@ function removeHubConfig() {
28746
28746
  }
28747
28747
 
28748
28748
  // src/local-hub.ts
28749
+ var import_node_path = __toESM(require("node:path"), 1);
28749
28750
  function fixedPortForChannel() {
28750
28751
  return process.env.SLAYZONE_DEV === "1" ? SIDECAR_FIXED_PORT.dev : SIDECAR_FIXED_PORT.prod;
28751
28752
  }
28753
+ function expectedRoot() {
28754
+ const root = process.env.SLAYZONE_ROOT?.trim();
28755
+ return root ? import_node_path.default.resolve(root) : null;
28756
+ }
28752
28757
  async function probeFixedPort() {
28753
28758
  const port = fixedPortForChannel();
28754
28759
  const hub = await findHub(String(port));
28755
- return hub ? hub.port : null;
28760
+ if (!hub) return { kind: "absent" };
28761
+ const expected = expectedRoot();
28762
+ if (expected && import_node_path.default.resolve(hub.root) !== expected) {
28763
+ return { kind: "foreign", port: hub.port, root: hub.root, expected };
28764
+ }
28765
+ return { kind: "found", port: hub.port };
28756
28766
  }
28757
28767
  async function isCoLocatedHub() {
28758
28768
  const configured = resolveHubTarget();
@@ -28769,12 +28779,22 @@ async function isCoLocatedHub() {
28769
28779
  async function resolveTarget() {
28770
28780
  const hub = resolveHubTarget();
28771
28781
  if (hub) return { baseUrl: hub.baseUrl, token: hub.token, hub: true };
28772
- const port = await probeFixedPort();
28773
- if (!port) {
28782
+ const probe2 = await probeFixedPort();
28783
+ if (probe2.kind === "foreign") {
28784
+ console.error(
28785
+ `Refusing to act on the SlayZone app at 127.0.0.1:${probe2.port}: it serves
28786
+ ${probe2.root}
28787
+ but this shell belongs to
28788
+ ${probe2.expected}
28789
+ Set SLAYZONE_HUB_ADDRESS to the intended app, or run from a shell that belongs to it.`
28790
+ );
28791
+ process.exit(1);
28792
+ }
28793
+ if (probe2.kind === "absent") {
28774
28794
  console.error("SlayZone server port not found. Is the app running?");
28775
28795
  process.exit(1);
28776
28796
  }
28777
- return { baseUrl: `http://127.0.0.1:${port}`, token: null, hub: false };
28797
+ return { baseUrl: `http://127.0.0.1:${probe2.port}`, token: null, hub: false };
28778
28798
  }
28779
28799
  function withAuth(init, token) {
28780
28800
  if (!token) return init;
@@ -28790,11 +28810,11 @@ function connectError(target) {
28790
28810
  }
28791
28811
  process.exit(1);
28792
28812
  }
28793
- async function request(path9, init) {
28813
+ async function request(path10, init) {
28794
28814
  const target = await resolveTarget();
28795
28815
  let res;
28796
28816
  try {
28797
- res = await fetch(`${target.baseUrl}${path9}`, withAuth(init, target.token));
28817
+ res = await fetch(`${target.baseUrl}${path10}`, withAuth(init, target.token));
28798
28818
  } catch {
28799
28819
  connectError(target);
28800
28820
  }
@@ -28803,44 +28823,44 @@ async function request(path9, init) {
28803
28823
  }
28804
28824
  return res.json();
28805
28825
  }
28806
- function apiGet(path9) {
28807
- return request(path9);
28826
+ function apiGet(path10) {
28827
+ return request(path10);
28808
28828
  }
28809
- function apiPost(path9, body) {
28810
- return request(path9, {
28829
+ function apiPost(path10, body) {
28830
+ return request(path10, {
28811
28831
  method: "POST",
28812
28832
  headers: { "Content-Type": "application/json" },
28813
28833
  body: JSON.stringify(body)
28814
28834
  });
28815
28835
  }
28816
- function apiPatch(path9, body) {
28817
- return request(path9, {
28836
+ function apiPatch(path10, body) {
28837
+ return request(path10, {
28818
28838
  method: "PATCH",
28819
28839
  headers: { "Content-Type": "application/json" },
28820
28840
  body: JSON.stringify(body)
28821
28841
  });
28822
28842
  }
28823
- function apiDelete(path9, body) {
28824
- if (body === void 0) return request(path9, { method: "DELETE" });
28825
- return request(path9, {
28843
+ function apiDelete(path10, body) {
28844
+ if (body === void 0) return request(path10, { method: "DELETE" });
28845
+ return request(path10, {
28826
28846
  method: "DELETE",
28827
28847
  headers: { "Content-Type": "application/json" },
28828
28848
  body: JSON.stringify(body)
28829
28849
  });
28830
28850
  }
28831
- async function apiFetch(path9, init) {
28851
+ async function apiFetch(path10, init) {
28832
28852
  const target = await resolveTarget();
28833
28853
  try {
28834
- return await fetch(`${target.baseUrl}${path9}`, withAuth(init, target.token));
28854
+ return await fetch(`${target.baseUrl}${path10}`, withAuth(init, target.token));
28835
28855
  } catch {
28836
28856
  connectError(target);
28837
28857
  }
28838
28858
  }
28839
- async function apiGetStream(path9, passThroughCodes = []) {
28859
+ async function apiGetStream(path10, passThroughCodes = []) {
28840
28860
  const target = await resolveTarget();
28841
28861
  let res;
28842
28862
  try {
28843
- res = await fetch(`${target.baseUrl}${path9}`, withAuth(void 0, target.token));
28863
+ res = await fetch(`${target.baseUrl}${path10}`, withAuth(void 0, target.token));
28844
28864
  } catch {
28845
28865
  connectError(target);
28846
28866
  }
@@ -28859,11 +28879,11 @@ async function apiGetStream(path9, passThroughCodes = []) {
28859
28879
  }
28860
28880
  return { body: res.body };
28861
28881
  }
28862
- async function requestStream(method, path9, body) {
28882
+ async function requestStream(method, path10, body) {
28863
28883
  const target = await resolveTarget();
28864
28884
  let res;
28865
28885
  try {
28866
- res = await fetch(`${target.baseUrl}${path9}`, {
28886
+ res = await fetch(`${target.baseUrl}${path10}`, {
28867
28887
  ...withAuth(
28868
28888
  {
28869
28889
  method,
@@ -28883,11 +28903,11 @@ async function requestStream(method, path9, body) {
28883
28903
  }
28884
28904
  return res.json();
28885
28905
  }
28886
- function apiPostStream(path9, body) {
28887
- return requestStream("POST", path9, body);
28906
+ function apiPostStream(path10, body) {
28907
+ return requestStream("POST", path10, body);
28888
28908
  }
28889
- function apiPutStream(path9, body) {
28890
- return requestStream("PUT", path9, body);
28909
+ function apiPutStream(path10, body) {
28910
+ return requestStream("PUT", path10, body);
28891
28911
  }
28892
28912
  async function failFromResponse(res) {
28893
28913
  return failFromText(await res.text().catch(() => ""), res.status);
@@ -29080,17 +29100,17 @@ function browserCommand() {
29080
29100
  withCommonOpts(cmd.command("screenshot"), "hidden").description("Capture screenshot to file").option("-o, --output <path>", "Output file path").action(async (opts) => {
29081
29101
  const taskId = await resolveId();
29082
29102
  const tabId = await resolveTabId(taskId, opts.tab);
29083
- const { path: path9 } = await apiPost("/api/browser/screenshot", {
29103
+ const { path: path10 } = await apiPost("/api/browser/screenshot", {
29084
29104
  taskId,
29085
29105
  panel: panel(opts, "hidden"),
29086
29106
  tabId
29087
29107
  });
29088
29108
  if (opts.output) {
29089
29109
  const { copyFileSync } = await import("fs");
29090
- copyFileSync(path9, opts.output);
29110
+ copyFileSync(path10, opts.output);
29091
29111
  console.log(opts.output);
29092
29112
  } else {
29093
- console.log(path9);
29113
+ console.log(path10);
29094
29114
  }
29095
29115
  });
29096
29116
  return cmd;
@@ -29104,9 +29124,7 @@ async function listAction(opts) {
29104
29124
  else if (opts.status) params.set("status", opts.status);
29105
29125
  if (opts.limit) params.set("limit", opts.limit);
29106
29126
  const qs = params.toString();
29107
- const { data } = await apiGet(
29108
- `/api/tasks${qs ? `?${qs}` : ""}`
29109
- );
29127
+ const { data } = await apiGet(`/api/tasks${qs ? `?${qs}` : ""}`);
29110
29128
  if (opts.json) {
29111
29129
  console.log(JSON.stringify(data, null, 2));
29112
29130
  return;
@@ -29129,9 +29147,9 @@ function resolveProjectArg(opt) {
29129
29147
  }
29130
29148
 
29131
29149
  // src/db.ts
29132
- function postJson(port, path9, timeoutMs = 3e3) {
29150
+ function postJson(port, path10, timeoutMs = 3e3) {
29133
29151
  return new Promise((resolve) => {
29134
- const req = import_node_http2.default.request({ hostname: "127.0.0.1", port, path: path9, method: "POST" }, (res) => {
29152
+ const req = import_node_http2.default.request({ hostname: "127.0.0.1", port, path: path10, method: "POST" }, (res) => {
29135
29153
  res.resume();
29136
29154
  res.on("end", () => {
29137
29155
  const code = res.statusCode ?? 0;
@@ -29176,9 +29194,15 @@ async function notifyApp() {
29176
29194
  }
29177
29195
  return;
29178
29196
  }
29179
- const port = await probeFixedPort();
29180
- if (port) {
29181
- const ok = await postJson(port, "/api/notify");
29197
+ const probe2 = await probeFixedPort();
29198
+ if (probe2.kind === "foreign") {
29199
+ console.error(
29200
+ `Warning: skipped app notify \u2014 127.0.0.1:${probe2.port} serves ${probe2.root}, not ${probe2.expected}.`
29201
+ );
29202
+ return;
29203
+ }
29204
+ if (probe2.kind === "found") {
29205
+ const ok = await postJson(probe2.port, "/api/notify");
29182
29206
  if (!ok) {
29183
29207
  console.error(
29184
29208
  "Warning: app notify failed (POST /api/notify) \u2014 app may be stale or unreachable"
@@ -29207,7 +29231,11 @@ async function createAction(title, opts) {
29207
29231
  process.exit(1);
29208
29232
  }
29209
29233
  }
29210
- const { data: task, existing, project } = await apiPost("/api/tasks", {
29234
+ const {
29235
+ data: task,
29236
+ existing,
29237
+ project
29238
+ } = await apiPost("/api/tasks", {
29211
29239
  project: projectRef,
29212
29240
  title,
29213
29241
  description: opts.description,
@@ -29219,9 +29247,7 @@ async function createAction(title, opts) {
29219
29247
  externalProvider: opts.externalProvider
29220
29248
  });
29221
29249
  if (existing) {
29222
- console.log(
29223
- `Exists: ${task.id.slice(0, 8)} ${task.title} [${task.status}] ${project.name}`
29224
- );
29250
+ console.log(`Exists: ${task.id.slice(0, 8)} ${task.title} [${task.status}] ${project.name}`);
29225
29251
  return;
29226
29252
  }
29227
29253
  console.log(`Created: ${task.id.slice(0, 8)} ${title} [${task.status}] ${project.name}`);
@@ -29526,22 +29552,22 @@ async function searchAction(query, opts) {
29526
29552
  // src/commands/tasks/tag.ts
29527
29553
  async function tagAction(taskId, opts) {
29528
29554
  taskId = await resolveId(taskId);
29529
- const path9 = `/api/tasks/${encodeURIComponent(taskId)}/tags`;
29555
+ const path10 = `/api/tasks/${encodeURIComponent(taskId)}/tags`;
29530
29556
  let tagNames;
29531
29557
  if (opts.set) {
29532
29558
  ;
29533
- ({ data: tagNames } = await apiPost(path9, { set: opts.set }));
29559
+ ({ data: tagNames } = await apiPost(path10, { set: opts.set }));
29534
29560
  } else if (opts.add) {
29535
29561
  ;
29536
- ({ data: tagNames } = await apiPost(path9, { add: opts.add }));
29562
+ ({ data: tagNames } = await apiPost(path10, { add: opts.add }));
29537
29563
  } else if (opts.remove) {
29538
29564
  ;
29539
- ({ data: tagNames } = await apiDelete(path9, {
29565
+ ({ data: tagNames } = await apiDelete(path10, {
29540
29566
  remove: opts.remove
29541
29567
  }));
29542
29568
  } else if (opts.clear) {
29543
29569
  ;
29544
- ({ data: tagNames } = await apiDelete(path9, { clear: true }));
29570
+ ({ data: tagNames } = await apiDelete(path10, { clear: true }));
29545
29571
  } else {
29546
29572
  const { data } = await apiGet(
29547
29573
  `/api/tasks/${encodeURIComponent(taskId)}`
@@ -29560,25 +29586,25 @@ async function tagAction(taskId, opts) {
29560
29586
  // src/commands/tasks/blockers.ts
29561
29587
  async function blockersAction(taskId, opts) {
29562
29588
  taskId = await resolveId(taskId);
29563
- const path9 = `/api/tasks/${encodeURIComponent(taskId)}/blockers`;
29589
+ const path10 = `/api/tasks/${encodeURIComponent(taskId)}/blockers`;
29564
29590
  let blockers;
29565
29591
  if (opts.set) {
29566
29592
  ;
29567
- ({ data: blockers } = await apiPost(path9, { set: opts.set }));
29593
+ ({ data: blockers } = await apiPost(path10, { set: opts.set }));
29568
29594
  } else if (opts.add) {
29569
29595
  ;
29570
- ({ data: blockers } = await apiPost(path9, { add: opts.add }));
29596
+ ({ data: blockers } = await apiPost(path10, { add: opts.add }));
29571
29597
  } else if (opts.remove) {
29572
29598
  ;
29573
- ({ data: blockers } = await apiDelete(path9, {
29599
+ ({ data: blockers } = await apiDelete(path10, {
29574
29600
  remove: opts.remove
29575
29601
  }));
29576
29602
  } else if (opts.clear) {
29577
29603
  ;
29578
- ({ data: blockers } = await apiDelete(path9, { clear: true }));
29604
+ ({ data: blockers } = await apiDelete(path10, { clear: true }));
29579
29605
  } else {
29580
29606
  ;
29581
- ({ data: blockers } = await apiGet(path9));
29607
+ ({ data: blockers } = await apiGet(path10));
29582
29608
  }
29583
29609
  if (opts.json) {
29584
29610
  console.log(JSON.stringify(blockers, null, 2));
@@ -29607,7 +29633,7 @@ async function blockingAction(taskId, opts) {
29607
29633
  // src/commands/tasks/blocked.ts
29608
29634
  async function blockedAction(taskId, opts) {
29609
29635
  taskId = await resolveId(taskId);
29610
- const path9 = `/api/tasks/${encodeURIComponent(taskId)}/blocked`;
29636
+ const path10 = `/api/tasks/${encodeURIComponent(taskId)}/blocked`;
29611
29637
  const isWrite = opts.on || opts.off || opts.toggle || opts.comment !== void 0;
29612
29638
  let state;
29613
29639
  if (isWrite) {
@@ -29617,10 +29643,10 @@ async function blockedAction(taskId, opts) {
29617
29643
  else if (opts.toggle) body.toggle = true;
29618
29644
  else if (opts.comment === false) body.comment = null;
29619
29645
  else if (opts.comment !== void 0) body.comment = opts.comment;
29620
- ({ data: state } = await apiPost(path9, body));
29646
+ ({ data: state } = await apiPost(path10, body));
29621
29647
  } else {
29622
29648
  ;
29623
- ({ data: state } = await apiGet(path9));
29649
+ ({ data: state } = await apiGet(path10));
29624
29650
  }
29625
29651
  if (opts.json) {
29626
29652
  console.log(
@@ -29909,12 +29935,6 @@ function printArtifactTree(artifacts, folders) {
29909
29935
  console.log("No artifacts.");
29910
29936
  return;
29911
29937
  }
29912
- const byId = new Map(folders.map((f) => [f.id, f]));
29913
- function folderPath(id) {
29914
- const f = byId.get(id);
29915
- if (!f) return "?";
29916
- return f.parent_id ? `${folderPath(f.parent_id)}/${f.name}` : f.name;
29917
- }
29918
29938
  const childFolders = /* @__PURE__ */ new Map();
29919
29939
  for (const f of folders) {
29920
29940
  const arr = childFolders.get(f.parent_id) ?? [];
@@ -30146,9 +30166,7 @@ function artifactsSubcommand() {
30146
30166
  `/api/artifacts/${encodeURIComponent(artifactId)}/content?${versionWriteQuery(opts.mutateVersion)}`,
30147
30167
  stdinStream()
30148
30168
  );
30149
- console.log(
30150
- `Written: ${data.id.slice(0, 8)} ${data.title} v${data.version.version_num}`
30151
- );
30169
+ console.log(`Written: ${data.id.slice(0, 8)} ${data.title} v${data.version.version_num}`);
30152
30170
  });
30153
30171
  cmd.command("append <artifactId>").description("Append to artifact content from stdin").option(
30154
30172
  "--mutate-version [ref]",
@@ -30158,9 +30176,7 @@ function artifactsSubcommand() {
30158
30176
  `/api/artifacts/${encodeURIComponent(artifactId)}/content?${versionWriteQuery(opts.mutateVersion)}`,
30159
30177
  stdinStream()
30160
30178
  );
30161
- console.log(
30162
- `Appended: ${data.id.slice(0, 8)} ${data.title} v${data.version.version_num}`
30163
- );
30179
+ console.log(`Appended: ${data.id.slice(0, 8)} ${data.title} v${data.version.version_num}`);
30164
30180
  });
30165
30181
  cmd.command("delete <artifactId>").description("Delete an artifact").action(async (artifactId) => {
30166
30182
  const { data: artifact } = await apiDelete(`/api/artifacts/${encodeURIComponent(artifactId)}`);
@@ -30273,7 +30289,9 @@ pdf/png/html require the SlayZone app to be running.
30273
30289
  output.on("error", reject);
30274
30290
  });
30275
30291
  if (opts.json) {
30276
- console.log(JSON.stringify({ path: outputPath2, type: "zip", taskId: artifacts[0].task_id }));
30292
+ console.log(
30293
+ JSON.stringify({ path: outputPath2, type: "zip", taskId: artifacts[0].task_id })
30294
+ );
30277
30295
  } else {
30278
30296
  console.log(outputPath2);
30279
30297
  }
@@ -30296,7 +30314,10 @@ pdf/png/html require the SlayZone app to be running.
30296
30314
  );
30297
30315
  const outputPath2 = opts.output ? import_path6.default.resolve(opts.output) : import_path6.default.resolve(artifact.title);
30298
30316
  import_fs5.default.mkdirSync(import_path6.default.dirname(outputPath2), { recursive: true });
30299
- await (0, import_promises.pipeline)(import_node_stream.Readable.fromWeb(body), import_fs5.default.createWriteStream(outputPath2));
30317
+ await (0, import_promises.pipeline)(
30318
+ import_node_stream.Readable.fromWeb(body),
30319
+ import_fs5.default.createWriteStream(outputPath2)
30320
+ );
30300
30321
  if (opts.json) {
30301
30322
  console.log(JSON.stringify({ path: outputPath2, type: "raw", artifactId: artifact.id }));
30302
30323
  } else {
@@ -30510,7 +30531,7 @@ function tasksCommand() {
30510
30531
 
30511
30532
  // src/commands/projects.ts
30512
30533
  var import_node_fs = __toESM(require("node:fs"), 1);
30513
- var import_node_path = __toESM(require("node:path"), 1);
30534
+ var import_node_path2 = __toESM(require("node:path"), 1);
30514
30535
 
30515
30536
  // ../../shared/workflow/src/types.ts
30516
30537
  var WORKFLOW_CATEGORIES = [
@@ -30602,13 +30623,13 @@ function prepareProjectCreate(input) {
30602
30623
  const columnsConfig = input.columnsConfig ? validateColumns(input.columnsConfig) : null;
30603
30624
  const name = normalizeProjectName(input.name);
30604
30625
  const color = normalizeProjectColor(input.color);
30605
- const path9 = typeof input.path === "string" ? input.path.trim() || null : input.path ?? null;
30626
+ const path10 = typeof input.path === "string" ? input.path.trim() || null : input.path ?? null;
30606
30627
  const now = (/* @__PURE__ */ new Date()).toISOString();
30607
30628
  return {
30608
30629
  id: crypto.randomUUID(),
30609
30630
  name,
30610
30631
  color,
30611
- path: path9,
30632
+ path: path10,
30612
30633
  columnsConfig,
30613
30634
  columnsConfigJson: columnsConfig ? JSON.stringify(columnsConfig) : null,
30614
30635
  createdAt: now,
@@ -30632,7 +30653,7 @@ function normalizeProjectPath(input) {
30632
30653
  if (!input) return null;
30633
30654
  const trimmed = input.trim();
30634
30655
  if (!trimmed) return null;
30635
- return import_node_path.default.resolve(trimmed);
30656
+ return import_node_path2.default.resolve(trimmed);
30636
30657
  }
30637
30658
  function ensureProjectPath(projectPath) {
30638
30659
  if (!projectPath) return false;
@@ -31066,7 +31087,7 @@ function completionsCommand() {
31066
31087
 
31067
31088
  // src/commands/init.ts
31068
31089
  var import_node_fs2 = __toESM(require("node:fs"), 1);
31069
- var import_node_path2 = __toESM(require("node:path"), 1);
31090
+ var import_node_path3 = __toESM(require("node:path"), 1);
31070
31091
 
31071
31092
  // ../../domains/ai-config/src/shared/provider-registry.ts
31072
31093
  var PROVIDER_PATHS = {
@@ -34470,7 +34491,7 @@ function writeInstructionsToDisk(projectPath, providers) {
34470
34491
  }
34471
34492
  const written = [];
34472
34493
  for (const filename of filenames) {
34473
- const filePath = import_node_path2.default.join(projectPath, filename);
34494
+ const filePath = import_node_path3.default.join(projectPath, filename);
34474
34495
  const existing = import_node_fs2.default.existsSync(filePath) ? import_node_fs2.default.readFileSync(filePath, "utf-8") : "";
34475
34496
  const prefix = existing && !existing.endsWith("\n") ? "\n" : "";
34476
34497
  import_node_fs2.default.appendFileSync(filePath, prefix + INSTRUCTIONS, "utf-8");
@@ -34483,8 +34504,8 @@ function writeSkillsToDisk(projectPath, providers, skills) {
34483
34504
  const mapping = PROVIDER_PATHS[provider];
34484
34505
  if (!mapping?.skillsDir) continue;
34485
34506
  for (const skill of skills) {
34486
- const filePath = import_node_path2.default.join(projectPath, mapping.skillsDir, skill.slug, "SKILL.md");
34487
- import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(filePath), { recursive: true });
34507
+ const filePath = import_node_path3.default.join(projectPath, mapping.skillsDir, skill.slug, "SKILL.md");
34508
+ import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(filePath), { recursive: true });
34488
34509
  import_node_fs2.default.writeFileSync(filePath, skill.content, "utf-8");
34489
34510
  }
34490
34511
  }
@@ -35112,7 +35133,9 @@ function automationsCommand() {
35112
35133
  }
35113
35134
  } else {
35114
35135
  if (!TRIGGER_TYPES.includes(opts.trigger)) {
35115
- console.error(`Invalid trigger type: ${opts.trigger}. Must be: ${TRIGGER_TYPES.join(", ")}`);
35136
+ console.error(
35137
+ `Invalid trigger type: ${opts.trigger}. Must be: ${TRIGGER_TYPES.join(", ")}`
35138
+ );
35116
35139
  process.exit(1);
35117
35140
  }
35118
35141
  const params = {};
@@ -35229,7 +35252,9 @@ function automationsCommand() {
35229
35252
  console.log(
35230
35253
  `${"ID".padEnd(idW)} ${"STATUS".padEnd(statusW)} ${"DURATION".padEnd(10)} STARTED`
35231
35254
  );
35232
- console.log(`${"-".repeat(idW)} ${"-".repeat(statusW)} ${"-".repeat(10)} ${"-".repeat(19)}`);
35255
+ console.log(
35256
+ `${"-".repeat(idW)} ${"-".repeat(statusW)} ${"-".repeat(10)} ${"-".repeat(19)}`
35257
+ );
35233
35258
  for (const r of runs) {
35234
35259
  const id = r.id.slice(0, 8).padEnd(idW);
35235
35260
  const status = r.status.padEnd(statusW);
@@ -35325,24 +35350,24 @@ function panelsCommand() {
35325
35350
  // src/commands/hub.ts
35326
35351
  var import_node_child_process3 = require("node:child_process");
35327
35352
  var import_node_fs7 = require("node:fs");
35328
- var import_node_path6 = require("node:path");
35353
+ var import_node_path7 = require("node:path");
35329
35354
 
35330
35355
  // ../../shared/platform/src/slayzone-config.ts
35331
35356
  var import_node_fs4 = require("node:fs");
35332
- var import_node_path3 = require("node:path");
35357
+ var import_node_path4 = require("node:path");
35333
35358
 
35334
35359
  // ../../shared/platform/src/runner-identity.ts
35335
35360
  var DEFAULT_LOCAL_RUNNER_NAME = "local-runner";
35336
35361
 
35337
35362
  // ../../shared/platform/src/slayzone-config.ts
35338
35363
  function getHubConfigFilePath() {
35339
- return (0, import_node_path3.join)(getSlayzoneHomeDir(), "hub.config.json");
35364
+ return (0, import_node_path4.join)(getSlayzoneHomeDir(), "hub.config.json");
35340
35365
  }
35341
35366
  function getRunnerConfigFilePath() {
35342
- return (0, import_node_path3.join)(getSlayzoneHomeDir(), "runner.config.json");
35367
+ return (0, import_node_path4.join)(getSlayzoneHomeDir(), "runner.config.json");
35343
35368
  }
35344
35369
  function legacyConfigFilePathFor(newFilePath) {
35345
- return (0, import_node_path3.join)((0, import_node_path3.dirname)(newFilePath), "config.json");
35370
+ return (0, import_node_path4.join)((0, import_node_path4.dirname)(newFilePath), "config.json");
35346
35371
  }
35347
35372
  function coerceHubConfig(raw) {
35348
35373
  const cfg = {};
@@ -35350,7 +35375,8 @@ function coerceHubConfig(raw) {
35350
35375
  if (typeof raw.publicAddress === "string" && raw.publicAddress.length > 0)
35351
35376
  cfg.publicAddress = raw.publicAddress;
35352
35377
  if (raw.mode === "local" || raw.mode === "remote") cfg.mode = raw.mode;
35353
- if (typeof raw.hubName === "string" && raw.hubName.trim().length > 0) cfg.hubName = raw.hubName.trim();
35378
+ if (typeof raw.hubName === "string" && raw.hubName.trim().length > 0)
35379
+ cfg.hubName = raw.hubName.trim();
35354
35380
  if (typeof raw.port === "number" && Number.isInteger(raw.port)) cfg.port = raw.port;
35355
35381
  if (typeof raw.publicUrl === "string" && raw.publicUrl.length > 0) cfg.publicUrl = raw.publicUrl;
35356
35382
  return cfg;
@@ -35358,7 +35384,8 @@ function coerceHubConfig(raw) {
35358
35384
  function coerceRunnerConfig(raw) {
35359
35385
  const cfg = {};
35360
35386
  if (typeof raw.joinToken === "string" && raw.joinToken.length > 0) cfg.joinToken = raw.joinToken;
35361
- if (typeof raw.runnerName === "string" && raw.runnerName.length > 0) cfg.runnerName = raw.runnerName;
35387
+ if (typeof raw.runnerName === "string" && raw.runnerName.length > 0)
35388
+ cfg.runnerName = raw.runnerName;
35362
35389
  if (typeof raw.hubUrl === "string" && raw.hubUrl.length > 0) cfg.hubUrl = raw.hubUrl;
35363
35390
  if (Array.isArray(raw.allowedRoots)) {
35364
35391
  const roots = raw.allowedRoots.filter((r) => typeof r === "string" && r.length > 0);
@@ -35368,14 +35395,14 @@ function coerceRunnerConfig(raw) {
35368
35395
  cfg.pinnedCertSha256 = raw.pinnedCertSha256;
35369
35396
  return cfg;
35370
35397
  }
35371
- function readJsonObject(path9) {
35398
+ function readJsonObject(path10) {
35372
35399
  let raw;
35373
35400
  try {
35374
- raw = (0, import_node_fs4.readFileSync)(path9, "utf8");
35401
+ raw = (0, import_node_fs4.readFileSync)(path10, "utf8");
35375
35402
  } catch (err) {
35376
35403
  if (err.code === "ENOENT") return null;
35377
35404
  process.stderr.write(
35378
- `[slayzone-config] cannot read ${path9}: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
35405
+ `[slayzone-config] cannot read ${path10}: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
35379
35406
  `
35380
35407
  );
35381
35408
  return null;
@@ -35385,59 +35412,59 @@ function readJsonObject(path9) {
35385
35412
  parsed = JSON.parse(raw);
35386
35413
  } catch (err) {
35387
35414
  process.stderr.write(
35388
- `[slayzone-config] ${path9} is not valid JSON: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
35415
+ `[slayzone-config] ${path10} is not valid JSON: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
35389
35416
  `
35390
35417
  );
35391
35418
  return null;
35392
35419
  }
35393
35420
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
35394
- process.stderr.write(`[slayzone-config] ${path9} is not a JSON object \u2014 using empty config
35421
+ process.stderr.write(`[slayzone-config] ${path10} is not a JSON object \u2014 using empty config
35395
35422
  `);
35396
35423
  return null;
35397
35424
  }
35398
35425
  return parsed;
35399
35426
  }
35400
- function writeJsonAtomic(path9, data) {
35401
- const dir = (0, import_node_path3.dirname)(path9);
35427
+ function writeJsonAtomic(path10, data) {
35428
+ const dir = (0, import_node_path4.dirname)(path10);
35402
35429
  (0, import_node_fs4.mkdirSync)(dir, { recursive: true, mode: 448 });
35403
- const tmpPath = `${path9}.tmp-${process.pid}-${Date.now()}`;
35430
+ const tmpPath = `${path10}.tmp-${process.pid}-${Date.now()}`;
35404
35431
  (0, import_node_fs4.writeFileSync)(tmpPath, `${JSON.stringify(data, null, 2)}
35405
35432
  `, { mode: 384 });
35406
35433
  try {
35407
- (0, import_node_fs4.renameSync)(tmpPath, path9);
35434
+ (0, import_node_fs4.renameSync)(tmpPath, path10);
35408
35435
  } catch (err) {
35409
35436
  (0, import_node_fs4.rmSync)(tmpPath, { force: true });
35410
35437
  throw err;
35411
35438
  }
35412
35439
  }
35413
- function saveHubConfigFile(cfg, path9 = getHubConfigFilePath()) {
35414
- writeJsonAtomic(path9, cfg);
35440
+ function saveHubConfigFile(cfg, path10 = getHubConfigFilePath()) {
35441
+ writeJsonAtomic(path10, cfg);
35415
35442
  }
35416
- function updateHubConfigFile(patch, path9 = getHubConfigFilePath()) {
35417
- const current = readJsonObject(path9);
35443
+ function updateHubConfigFile(patch, path10 = getHubConfigFilePath()) {
35444
+ const current = readJsonObject(path10);
35418
35445
  const merged = current ? coerceHubConfig(current) : {};
35419
35446
  for (const [k, v2] of Object.entries(patch)) {
35420
35447
  if (v2 !== void 0) merged[k] = v2;
35421
35448
  }
35422
- saveHubConfigFile(merged, path9);
35449
+ saveHubConfigFile(merged, path10);
35423
35450
  return merged;
35424
35451
  }
35425
- function loadRunnerConfigFile(path9 = getRunnerConfigFilePath()) {
35426
- const raw = readJsonObject(path9);
35452
+ function loadRunnerConfigFile(path10 = getRunnerConfigFilePath()) {
35453
+ const raw = readJsonObject(path10);
35427
35454
  if (raw) return coerceRunnerConfig(raw);
35428
- const legacy = readJsonObject(legacyConfigFilePathFor(path9));
35455
+ const legacy = readJsonObject(legacyConfigFilePathFor(path10));
35429
35456
  return legacy ? coerceRunnerConfig(legacy) : {};
35430
35457
  }
35431
- function saveRunnerConfigFile(cfg, path9 = getRunnerConfigFilePath()) {
35432
- writeJsonAtomic(path9, cfg);
35458
+ function saveRunnerConfigFile(cfg, path10 = getRunnerConfigFilePath()) {
35459
+ writeJsonAtomic(path10, cfg);
35433
35460
  }
35434
- function updateRunnerConfigFile(patch, path9 = getRunnerConfigFilePath()) {
35435
- const current = readJsonObject(path9);
35461
+ function updateRunnerConfigFile(patch, path10 = getRunnerConfigFilePath()) {
35462
+ const current = readJsonObject(path10);
35436
35463
  const merged = current ? coerceRunnerConfig(current) : {};
35437
35464
  for (const [k, v2] of Object.entries(patch)) {
35438
35465
  if (v2 !== void 0) merged[k] = v2;
35439
35466
  }
35440
- saveRunnerConfigFile(merged, path9);
35467
+ saveRunnerConfigFile(merged, path10);
35441
35468
  return merged;
35442
35469
  }
35443
35470
 
@@ -35445,7 +35472,7 @@ function updateRunnerConfigFile(patch, path9 = getRunnerConfigFilePath()) {
35445
35472
  var import_node_child_process = require("node:child_process");
35446
35473
  var import_node_fs5 = require("node:fs");
35447
35474
  var import_node_os = require("node:os");
35448
- var import_node_path4 = require("node:path");
35475
+ var import_node_path5 = require("node:path");
35449
35476
  var KINDS = {
35450
35477
  hub: {
35451
35478
  labelPrefix: "com.slayzone.hub.",
@@ -35481,29 +35508,76 @@ function assertValidServiceName(kind, name) {
35481
35508
  }
35482
35509
  function defaultUnitDir(backend) {
35483
35510
  const home = process.env.HOME ?? (0, import_node_os.homedir)();
35484
- if (backend === "launchd") return (0, import_node_path4.join)(home, "Library", "LaunchAgents");
35485
- if (backend === "systemd") return (0, import_node_path4.join)(home, ".config", "systemd", "user");
35511
+ if (backend === "launchd") return (0, import_node_path5.join)(home, "Library", "LaunchAgents");
35512
+ if (backend === "systemd") return (0, import_node_path5.join)(home, ".config", "systemd", "user");
35486
35513
  throw new Error("[slayzone] no unit directory: this platform has no user service backend");
35487
35514
  }
35488
- function detectBackend() {
35489
- if (process.platform === "darwin") return "launchd";
35490
- if (process.platform === "win32") return "none";
35515
+ function derivedRuntimeDir() {
35516
+ if (process.env.XDG_RUNTIME_DIR) return null;
35517
+ const uid = process.getuid?.();
35518
+ if (uid === void 0) return null;
35519
+ const dir = `/run/user/${uid}`;
35520
+ return (0, import_node_fs5.existsSync)(dir) ? dir : null;
35521
+ }
35522
+ function userServiceEnv() {
35523
+ const dir = derivedRuntimeDir();
35524
+ return dir ? { ...process.env, XDG_RUNTIME_DIR: dir } : process.env;
35525
+ }
35526
+ function detectBackendWithReason() {
35527
+ if (process.platform === "darwin") return { backend: "launchd", reason: "launchd" };
35528
+ if (process.platform === "win32") return { backend: "none", reason: "windows" };
35529
+ if (probeUserBus(process.env)) return { backend: "systemd", reason: "systemd-bus-ok" };
35530
+ const healed = derivedRuntimeDir();
35531
+ if (healed && probeUserBus({ ...process.env, XDG_RUNTIME_DIR: healed })) {
35532
+ return { backend: "systemd", reason: "systemd-bus-healed" };
35533
+ }
35534
+ return {
35535
+ backend: "none",
35536
+ reason: hasSystemctl() ? "systemd-no-bus" : "systemd-missing"
35537
+ };
35538
+ }
35539
+ function hasSystemctl() {
35540
+ try {
35541
+ (0, import_node_child_process.execFileSync)("systemctl", ["--version"], { stdio: "ignore" });
35542
+ return true;
35543
+ } catch {
35544
+ return false;
35545
+ }
35546
+ }
35547
+ function probeUserBus(env) {
35491
35548
  try {
35492
35549
  const out = (0, import_node_child_process.execFileSync)("systemctl", ["--user", "is-system-running"], {
35493
35550
  encoding: "utf8",
35494
- stdio: ["ignore", "pipe", "pipe"]
35551
+ stdio: ["ignore", "pipe", "pipe"],
35552
+ env
35495
35553
  });
35496
- return out.trim().length > 0 ? "systemd" : "none";
35554
+ return out.trim().length > 0;
35497
35555
  } catch (e) {
35498
35556
  const err = e;
35499
35557
  const state = (typeof err.stdout === "string" ? err.stdout : err.stdout?.toString() ?? "").trim();
35500
- if (state && !/^(offline|unknown)$/i.test(state)) return "systemd";
35501
- return "none";
35558
+ return Boolean(state) && !/^(offline|unknown)$/i.test(state);
35502
35559
  }
35503
35560
  }
35561
+ function detectBackend() {
35562
+ return detectBackendWithReason().backend;
35563
+ }
35564
+ function explainNoBackend(reason) {
35565
+ if (reason === "windows") {
35566
+ return "Windows has no user service manager, so services cannot be registered here.";
35567
+ }
35568
+ if (reason === "systemd-missing") {
35569
+ return "systemd is not present on this machine, so services cannot be registered here.";
35570
+ }
35571
+ if (reason === "systemd-no-bus") {
35572
+ return `systemd is running, but this account has no user manager, so \`systemctl --user\` cannot work. Enable a persistent one:
35573
+ sudo loginctl enable-linger ${process.env.USER ?? "<user>"}
35574
+ then log out and back in.`;
35575
+ }
35576
+ return "No user service manager is available here.";
35577
+ }
35504
35578
  function unitPath(kind, name, backend, unitDir = defaultUnitDir(backend)) {
35505
35579
  assertValidServiceName(kind, name);
35506
- return backend === "launchd" ? (0, import_node_path4.join)(unitDir, `${KINDS[kind].labelPrefix}${name}.plist`) : (0, import_node_path4.join)(unitDir, `${KINDS[kind].systemdPrefix}${name}.service`);
35580
+ return backend === "launchd" ? (0, import_node_path5.join)(unitDir, `${KINDS[kind].labelPrefix}${name}.plist`) : (0, import_node_path5.join)(unitDir, `${KINDS[kind].systemdPrefix}${name}.service`);
35507
35581
  }
35508
35582
  function nameFromUnitFile(kind, file, backend) {
35509
35583
  if (backend === "launchd") {
@@ -35558,9 +35632,9 @@ ${envEntries}
35558
35632
  <false/>
35559
35633
  </dict>
35560
35634
  <key>StandardOutPath</key>
35561
- <string>${xmlEscape((0, import_node_path4.join)(spec.logDir, kind.outLog))}</string>
35635
+ <string>${xmlEscape((0, import_node_path5.join)(spec.logDir, kind.outLog))}</string>
35562
35636
  <key>StandardErrorPath</key>
35563
- <string>${xmlEscape((0, import_node_path4.join)(spec.logDir, kind.errLog))}</string>
35637
+ <string>${xmlEscape((0, import_node_path5.join)(spec.logDir, kind.errLog))}</string>
35564
35638
  <key>ProcessType</key>
35565
35639
  <string>Background</string>
35566
35640
  </dict>
@@ -35593,16 +35667,16 @@ WantedBy=default.target
35593
35667
  `;
35594
35668
  }
35595
35669
  function writeUnit(spec, backend, unitDir = defaultUnitDir(backend)) {
35596
- const path9 = unitPath(spec.kind, spec.name, backend, unitDir);
35670
+ const path10 = unitPath(spec.kind, spec.name, backend, unitDir);
35597
35671
  (0, import_node_fs5.mkdirSync)(unitDir, { recursive: true });
35598
35672
  const content = backend === "launchd" ? renderLaunchdPlist(spec) : renderSystemdUnit(spec);
35599
- (0, import_node_fs5.writeFileSync)(path9, content, { mode: 420 });
35600
- return path9;
35673
+ (0, import_node_fs5.writeFileSync)(path10, content, { mode: 420 });
35674
+ return path10;
35601
35675
  }
35602
35676
  function removeUnit(kind, name, backend, unitDir = defaultUnitDir(backend)) {
35603
- const path9 = unitPath(kind, name, backend, unitDir);
35604
- if (!(0, import_node_fs5.existsSync)(path9)) return false;
35605
- (0, import_node_fs5.rmSync)(path9, { force: true });
35677
+ const path10 = unitPath(kind, name, backend, unitDir);
35678
+ if (!(0, import_node_fs5.existsSync)(path10)) return false;
35679
+ (0, import_node_fs5.rmSync)(path10, { force: true });
35606
35680
  return true;
35607
35681
  }
35608
35682
  function listRegisteredUnits(kind, backend, unitDir = defaultUnitDir(backend)) {
@@ -35615,7 +35689,7 @@ function listRegisteredUnits(kind, backend, unitDir = defaultUnitDir(backend)) {
35615
35689
  const out = [];
35616
35690
  for (const file of files) {
35617
35691
  const name = nameFromUnitFile(kind, file, backend);
35618
- if (name) out.push({ name, unitPath: (0, import_node_path4.join)(unitDir, file) });
35692
+ if (name) out.push({ name, unitPath: (0, import_node_path5.join)(unitDir, file) });
35619
35693
  }
35620
35694
  return out.sort((a, b) => a.name.localeCompare(b.name));
35621
35695
  }
@@ -35647,15 +35721,15 @@ function launchdLabel(kind, name) {
35647
35721
  var import_node_child_process2 = require("node:child_process");
35648
35722
  var import_node_fs6 = require("node:fs");
35649
35723
  var import_node_module = require("node:module");
35650
- var import_node_path5 = require("node:path");
35651
- var CLI_VERSION = true ? "0.36.0-beta.13" : "";
35724
+ var import_node_path6 = require("node:path");
35725
+ var CLI_VERSION = true ? "0.36.0-beta.16" : "";
35652
35726
  function fail(message) {
35653
35727
  console.error(message);
35654
35728
  process.exit(1);
35655
35729
  }
35656
- function shortenPath(path9) {
35730
+ function shortenPath(path10) {
35657
35731
  const home = process.env.HOME ?? "";
35658
- return home && path9.startsWith(home) ? `~${path9.slice(home.length)}` : path9;
35732
+ return home && path10.startsWith(home) ? `~${path10.slice(home.length)}` : path10;
35659
35733
  }
35660
35734
  function resolveBackend() {
35661
35735
  return process.env.SLZ_FORCE_NO_SERVICE === "1" ? "none" : detectBackend();
@@ -35681,18 +35755,18 @@ function readServicePkg(kind, pkgJsonPath) {
35681
35755
  }
35682
35756
  const binRel = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.[PACKAGES[kind].bin];
35683
35757
  if (!binRel) return null;
35684
- const binPath = (0, import_node_path5.join)((0, import_node_path5.dirname)(pkgJsonPath), binRel);
35758
+ const binPath = (0, import_node_path6.join)((0, import_node_path6.dirname)(pkgJsonPath), binRel);
35685
35759
  if (!(0, import_node_fs6.existsSync)(binPath)) return null;
35686
35760
  return { binPath, version: pkg.version ?? "unknown" };
35687
35761
  }
35688
35762
  function interpreterFor(binPath, version) {
35689
- let dir = (0, import_node_path5.dirname)(binPath);
35763
+ let dir = (0, import_node_path6.dirname)(binPath);
35690
35764
  for (let i = 0; i < 6; i++) {
35691
- const pathTxt = (0, import_node_path5.join)(dir, "node_modules", "electron", "path.txt");
35765
+ const pathTxt = (0, import_node_path6.join)(dir, "node_modules", "electron", "path.txt");
35692
35766
  if ((0, import_node_fs6.existsSync)(pathTxt)) {
35693
35767
  try {
35694
35768
  const rel = (0, import_node_fs6.readFileSync)(pathTxt, "utf8").trim();
35695
- const electron = (0, import_node_path5.join)(dir, "node_modules", "electron", "dist", rel);
35769
+ const electron = (0, import_node_path6.join)(dir, "node_modules", "electron", "dist", rel);
35696
35770
  if ((0, import_node_fs6.existsSync)(electron)) {
35697
35771
  return {
35698
35772
  command: electron,
@@ -35705,7 +35779,7 @@ function interpreterFor(binPath, version) {
35705
35779
  } catch {
35706
35780
  }
35707
35781
  }
35708
- const parent = (0, import_node_path5.dirname)(dir);
35782
+ const parent = (0, import_node_path6.dirname)(dir);
35709
35783
  if (parent === dir) break;
35710
35784
  dir = parent;
35711
35785
  }
@@ -35720,7 +35794,7 @@ function resolveServiceBin(kind) {
35720
35794
  // this package's CJS bundle.
35721
35795
  () => {
35722
35796
  try {
35723
- return (0, import_node_module.createRequire)(process.argv[1] ?? (0, import_node_path5.join)(process.cwd(), "x")).resolve(
35797
+ return (0, import_node_module.createRequire)(process.argv[1] ?? (0, import_node_path6.join)(process.cwd(), "x")).resolve(
35724
35798
  `${pkg}/package.json`
35725
35799
  );
35726
35800
  } catch {
@@ -35731,18 +35805,18 @@ function resolveServiceBin(kind) {
35731
35805
  () => {
35732
35806
  const self2 = process.argv[1];
35733
35807
  if (!self2) return null;
35734
- const sibling = (0, import_node_path5.join)((0, import_node_path5.dirname)(self2), "..", "..", devDir, "package.json");
35808
+ const sibling = (0, import_node_path6.join)((0, import_node_path6.dirname)(self2), "..", "..", devDir, "package.json");
35735
35809
  return (0, import_node_fs6.existsSync)(sibling) ? sibling : null;
35736
35810
  }
35737
35811
  ];
35738
35812
  for (const find of candidates) {
35739
- const path9 = find();
35740
- if (!path9) continue;
35741
- const found2 = readServicePkg(kind, path9);
35813
+ const path10 = find();
35814
+ if (!path10) continue;
35815
+ const found2 = readServicePkg(kind, path10);
35742
35816
  if (found2) return interpreterFor(found2.binPath, found2.version);
35743
35817
  }
35744
35818
  const prefix = getServiceRuntimeDir(kind);
35745
- const installed = (0, import_node_path5.join)(prefix, "node_modules", pkg, "package.json");
35819
+ const installed = (0, import_node_path6.join)(prefix, "node_modules", pkg, "package.json");
35746
35820
  const wanted = CLI_VERSION ? `${pkg}@${CLI_VERSION}` : `${pkg}@beta`;
35747
35821
  if (!(0, import_node_fs6.existsSync)(installed) || CLI_VERSION && readServicePkg(kind, installed)?.version !== CLI_VERSION) {
35748
35822
  console.log(`Installing ${wanted}\u2026`);
@@ -35775,12 +35849,12 @@ function ensureLogDir(kind, root) {
35775
35849
  return dir;
35776
35850
  }
35777
35851
  function logDirFor(_kind, root) {
35778
- return (0, import_node_path5.join)(root, "logs");
35852
+ return (0, import_node_path6.join)(root, "logs");
35779
35853
  }
35780
35854
  function serviceLogPaths(kind, root) {
35781
35855
  const dir = logDirFor(kind, root);
35782
35856
  const names = serviceLogNames(kind);
35783
- return { out: (0, import_node_path5.join)(dir, names.out), err: (0, import_node_path5.join)(dir, names.err) };
35857
+ return { out: (0, import_node_path6.join)(dir, names.out), err: (0, import_node_path6.join)(dir, names.err) };
35784
35858
  }
35785
35859
  function failWithLog(kind, name, logPath, what) {
35786
35860
  let detail = "";
@@ -35810,7 +35884,7 @@ function readServiceLogTail(kind, root, lines) {
35810
35884
  const chunks = [];
35811
35885
  for (const f of files) {
35812
35886
  try {
35813
- chunks.push((0, import_node_fs6.readFileSync)((0, import_node_path5.join)(dir, f), "utf8"));
35887
+ chunks.push((0, import_node_fs6.readFileSync)((0, import_node_path6.join)(dir, f), "utf8"));
35814
35888
  } catch {
35815
35889
  }
35816
35890
  }
@@ -35821,13 +35895,13 @@ function followServiceLog(args) {
35821
35895
  if (systemdUnit) {
35822
35896
  const jargs = ["--user", "-u", systemdUnitName(kind, name), "-n", String(lines)];
35823
35897
  if (follow) jargs.push("-f");
35824
- const child2 = (0, import_node_child_process2.spawn)("journalctl", jargs, { stdio: "inherit" });
35898
+ const child2 = (0, import_node_child_process2.spawn)("journalctl", jargs, { stdio: "inherit", env: userServiceEnv() });
35825
35899
  child2.on("exit", (code) => process.exit(code ?? 0));
35826
35900
  return;
35827
35901
  }
35828
35902
  const dir = logDirFor(kind, root);
35829
35903
  if (!(0, import_node_fs6.existsSync)(dir)) fail(`No log directory at ${shortenPath(dir)}.`);
35830
- const candidates = (0, import_node_fs6.readdirSync)(dir).filter((f) => f.endsWith(".log")).map((f) => ({ f, path: (0, import_node_path5.join)(dir, f), mtime: (0, import_node_fs6.statSync)((0, import_node_path5.join)(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
35904
+ const candidates = (0, import_node_fs6.readdirSync)(dir).filter((f) => f.endsWith(".log")).map((f) => ({ f, path: (0, import_node_path6.join)(dir, f), mtime: (0, import_node_fs6.statSync)((0, import_node_path6.join)(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
35831
35905
  if (candidates.length === 0) fail(`No log files in ${shortenPath(dir)}.`);
35832
35906
  const target = candidates[0].path;
35833
35907
  const targs = follow ? ["-f", "-n", String(lines), target] : ["-n", String(lines), target];
@@ -35843,7 +35917,7 @@ var SupervisorError = class extends Error {
35843
35917
  };
35844
35918
  function run(file, args) {
35845
35919
  try {
35846
- (0, import_node_child_process2.execFileSync)(file, args, { stdio: ["ignore", "inherit", "pipe"] });
35920
+ (0, import_node_child_process2.execFileSync)(file, args, { stdio: ["ignore", "inherit", "pipe"], env: userServiceEnv() });
35847
35921
  } catch (e) {
35848
35922
  const stderr = e.stderr;
35849
35923
  throw new SupervisorError(
@@ -35870,7 +35944,10 @@ function supervisorStart(kind, backend, name, unitFilePath) {
35870
35944
  run("systemctl", ["--user", "daemon-reload"]);
35871
35945
  run("systemctl", ["--user", "enable", "--now", unit]);
35872
35946
  try {
35873
- (0, import_node_child_process2.execFileSync)("loginctl", ["enable-linger", process.env.USER ?? ""], { stdio: "ignore" });
35947
+ (0, import_node_child_process2.execFileSync)("loginctl", ["enable-linger", process.env.USER ?? ""], {
35948
+ stdio: "ignore",
35949
+ env: userServiceEnv()
35950
+ });
35874
35951
  } catch {
35875
35952
  console.log(
35876
35953
  `Note: could not enable systemd lingering \u2014 the ${kind} will stop when you log out.`
@@ -35890,7 +35967,8 @@ function supervisorStop(kind, backend, name) {
35890
35967
  }
35891
35968
  try {
35892
35969
  (0, import_node_child_process2.execFileSync)("systemctl", ["--user", "disable", "--now", systemdUnitName(kind, name)], {
35893
- stdio: "ignore"
35970
+ stdio: "ignore",
35971
+ env: userServiceEnv()
35894
35972
  });
35895
35973
  } catch {
35896
35974
  }
@@ -35926,8 +36004,18 @@ function supervisorStatus(kind, backend, name) {
35926
36004
  try {
35927
36005
  out = (0, import_node_child_process2.execFileSync)(
35928
36006
  "systemctl",
35929
- ["--user", "show", systemdUnitName(kind, name), "-p", "ActiveState", "-p", "MainPID", "-p", "ExecMainStatus"],
35930
- { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }
36007
+ [
36008
+ "--user",
36009
+ "show",
36010
+ systemdUnitName(kind, name),
36011
+ "-p",
36012
+ "ActiveState",
36013
+ "-p",
36014
+ "MainPID",
36015
+ "-p",
36016
+ "ExecMainStatus"
36017
+ ],
36018
+ { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], env: userServiceEnv() }
35931
36019
  );
35932
36020
  } catch {
35933
36021
  return none;
@@ -35962,8 +36050,8 @@ Name one with \`slay --hub <name|port> ${what}\`.`
35962
36050
  return { baseUrl: `http://127.0.0.1:${running[0].port}`, token: null };
35963
36051
  }
35964
36052
  async function hubRequest(opts) {
35965
- const { target, path: path9, method, body, unwrap } = opts;
35966
- const url = `${target.baseUrl}${path9}`;
36053
+ const { target, path: path10, method, body, unwrap } = opts;
36054
+ const url = `${target.baseUrl}${path10}`;
35967
36055
  let res;
35968
36056
  try {
35969
36057
  res = await fetch(url, {
@@ -36294,10 +36382,12 @@ function hubCommand() {
36294
36382
  console.log(
36295
36383
  `${"-".repeat(nameW)} ${"-".repeat(5)} ${"-".repeat(7)} ${"-".repeat(rootW)} ${"-".repeat(7)} ${"-".repeat(8)}`
36296
36384
  );
36385
+ const ownRoot = process.env.SLAYZONE_ROOT?.trim() ? (0, import_node_path7.resolve)(process.env.SLAYZONE_ROOT.trim()) : null;
36297
36386
  for (const h of hubs) {
36298
36387
  const root = h.supervised ? "(desktop app)" : shortenPath(h.root);
36388
+ const mine = ownRoot && (0, import_node_path7.resolve)(h.root) === ownRoot ? " \u2190 this shell" : "";
36299
36389
  console.log(
36300
- `${h.name.padEnd(nameW)} ${String(h.port).padEnd(5)} ${String(h.pid).padEnd(7)} ${root.padEnd(rootW)} ${String(h.runnersConnected).padEnd(7)} ${formatUptime(h.uptimeMs)}`
36390
+ `${h.name.padEnd(nameW)} ${String(h.port).padEnd(5)} ${String(h.pid).padEnd(7)} ${root.padEnd(rootW)} ${String(h.runnersConnected).padEnd(7)} ${formatUptime(h.uptimeMs)}${mine}`
36301
36391
  );
36302
36392
  }
36303
36393
  });
@@ -36306,7 +36396,7 @@ function hubCommand() {
36306
36396
  "Externally-reachable address of this hub \u2014 makes it a REMOTE hub (auth + TLS + wss join tokens)"
36307
36397
  ).option("--bind <host[:port]>", "Address to bind (default: loopback, or 0.0.0.0 when remote)").action(
36308
36398
  async (name, opts) => {
36309
- const root = (0, import_node_path6.resolve)(opts.root ?? process.cwd());
36399
+ const root = (0, import_node_path7.resolve)(opts.root ?? process.cwd());
36310
36400
  const port = opts.port === void 0 ? void 0 : Number(opts.port);
36311
36401
  if (port !== void 0 && (!Number.isInteger(port) || port < 1 || port > 65535)) {
36312
36402
  fail(`Invalid --port ${opts.port} \u2014 expected an integer 1-65535.`);
@@ -36357,7 +36447,7 @@ Start it with \`slay hub start ${name}\`, or remove it with \`slay hub rm ${name
36357
36447
  publicAddress,
36358
36448
  ...address !== void 0 ? { address } : {}
36359
36449
  },
36360
- (0, import_node_path6.join)(root, "hub.config.json")
36450
+ (0, import_node_path7.join)(root, "hub.config.json")
36361
36451
  );
36362
36452
  console.log("Mode: remote (client auth + TLS enforced)");
36363
36453
  console.log(`Bind: ${address ?? "(hub block default)"}`);
@@ -36586,8 +36676,8 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
36586
36676
 
36587
36677
  // src/commands/runner.ts
36588
36678
  var import_node_child_process4 = require("node:child_process");
36589
- var import_node_fs8 = require("node:fs");
36590
- var import_node_path7 = require("node:path");
36679
+ var import_node_fs9 = require("node:fs");
36680
+ var import_node_path9 = require("node:path");
36591
36681
 
36592
36682
  // ../../shared/platform/src/join-token.ts
36593
36683
  var JOIN_TOKEN_PREFIX = "szjt1";
@@ -36609,13 +36699,115 @@ function decodeJoinToken(token) {
36609
36699
  }
36610
36700
  }
36611
36701
 
36702
+ // src/commands/runner-identity.ts
36703
+ var import_node_fs8 = require("node:fs");
36704
+ var import_node_path8 = require("node:path");
36705
+ function configPathFor(root) {
36706
+ return (0, import_node_path8.join)(root, "runner.config.json");
36707
+ }
36708
+ function ambientRoot() {
36709
+ return process.env.SLAYZONE_ROOT ?? process.cwd();
36710
+ }
36711
+ function isEnrolled(root) {
36712
+ try {
36713
+ const parsed = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path8.join)(root, "runner.state.json"), "utf8"));
36714
+ return typeof parsed === "object" && parsed !== null && Object.keys(parsed).length > 0;
36715
+ } catch {
36716
+ return false;
36717
+ }
36718
+ }
36719
+ async function hubRunners() {
36720
+ let baseUrl;
36721
+ let token = null;
36722
+ try {
36723
+ const configured = resolveHubTarget();
36724
+ if (configured) {
36725
+ baseUrl = configured.baseUrl;
36726
+ token = configured.token;
36727
+ } else {
36728
+ const running = await discoverHubs();
36729
+ if (running.length !== 1) return null;
36730
+ baseUrl = `http://127.0.0.1:${running[0].port}`;
36731
+ }
36732
+ } catch {
36733
+ return null;
36734
+ }
36735
+ try {
36736
+ const res = await fetch(`${baseUrl}/api/runners`, {
36737
+ headers: token ? { Authorization: `Bearer ${token}` } : {},
36738
+ signal: AbortSignal.timeout(3e3)
36739
+ });
36740
+ if (!res.ok) return null;
36741
+ const rows = await res.json();
36742
+ return Array.isArray(rows) ? rows : null;
36743
+ } catch {
36744
+ return null;
36745
+ }
36746
+ }
36747
+ function localFacts(name, root, backend, supervised) {
36748
+ const cfg = root ? loadRunnerConfigFile(configPathFor(root)) : {};
36749
+ return {
36750
+ name,
36751
+ root,
36752
+ installed: cfg.runnerName !== void 0,
36753
+ supervised,
36754
+ enrolled: root ? isEnrolled(root) : false,
36755
+ running: supervised ? supervisorStatus("runner", backend, name).running : false,
36756
+ hubUrl: cfg.hubUrl ?? null
36757
+ };
36758
+ }
36759
+ function rootClaims(root, name) {
36760
+ return loadRunnerConfigFile(configPathFor(root)).runnerName === name;
36761
+ }
36762
+ async function resolveRunner(name, backend, opts = {}) {
36763
+ const cwd = opts.cwd ?? ambientRoot();
36764
+ const supervised = backend !== "none" && (0, import_node_fs8.existsSync)(unitPath("runner", name, backend));
36765
+ const root = supervised ? readUnitRoot("runner", name, backend) : rootClaims(cwd, name) ? cwd : null;
36766
+ const local = localFacts(name, root, backend, supervised);
36767
+ if (opts.hub === false) return { ...local, connected: null };
36768
+ const rows = await hubRunners();
36769
+ const row = rows?.find((r) => r.name === name) ?? null;
36770
+ return {
36771
+ ...local,
36772
+ // A hub that knows this runner proves enrollment even when the local state file
36773
+ // is gone (root deleted, machine rebuilt) — so OR the two rather than trusting
36774
+ // disk alone.
36775
+ enrolled: local.enrolled || row !== null,
36776
+ connected: rows === null ? null : row?.connected ?? false
36777
+ };
36778
+ }
36779
+ async function listRunners(backend, opts = {}) {
36780
+ const cwd = opts.cwd ?? ambientRoot();
36781
+ const names = /* @__PURE__ */ new Set();
36782
+ if (backend !== "none") {
36783
+ for (const u of listRegisteredUnits("runner", backend)) names.add(u.name);
36784
+ }
36785
+ const cwdName = loadRunnerConfigFile(configPathFor(cwd)).runnerName;
36786
+ if (cwdName !== void 0) names.add(cwdName);
36787
+ const rows = await hubRunners();
36788
+ for (const r of rows ?? []) names.add(r.name);
36789
+ const runners = [];
36790
+ for (const name of [...names].sort((a, b) => a.localeCompare(b))) {
36791
+ const supervised = backend !== "none" && (0, import_node_fs8.existsSync)(unitPath("runner", name, backend));
36792
+ const root = supervised ? readUnitRoot("runner", name, backend) : rootClaims(cwd, name) ? cwd : null;
36793
+ const local = localFacts(name, root, backend, supervised);
36794
+ const row = rows?.find((r) => r.name === name) ?? null;
36795
+ runners.push({
36796
+ ...local,
36797
+ enrolled: local.enrolled || row !== null,
36798
+ connected: rows === null ? null : row?.connected ?? false
36799
+ });
36800
+ }
36801
+ return { runners, hubReachable: rows !== null };
36802
+ }
36803
+ function isUnknown(facts) {
36804
+ return !facts.installed && !facts.supervised && !facts.enrolled;
36805
+ }
36806
+
36612
36807
  // src/commands/runner.ts
36613
36808
  var RUNNER_PACKAGE = servicePackage("runner");
36614
36809
  var ENROLL_TIMEOUT_MS = 3e4;
36615
36810
  var CONNECTED_RE = /"mode":"(enroll|hello)"/;
36616
- function configPathFor(root) {
36617
- return (0, import_node_path7.join)(root, "runner.config.json");
36618
- }
36619
36811
  function warnIfLoopbackHub(hubUrl) {
36620
36812
  if (!isLoopbackRunnerUrl(hubUrl)) return;
36621
36813
  console.log("");
@@ -36626,14 +36818,35 @@ never connect. For a hub other machines can reach, recreate it with
36626
36818
  \`slay hub create <name> --public-address <host:port>\`.`
36627
36819
  );
36628
36820
  }
36629
- function isEnrolled(root) {
36630
- try {
36631
- const parsed = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path7.join)(root, "runner.state.json"), "utf8"));
36632
- return typeof parsed === "object" && parsed !== null && Object.keys(parsed).length > 0;
36633
- } catch {
36634
- return false;
36821
+ var createRollback = [];
36822
+ function registerCreateRollback(undo) {
36823
+ createRollback.push(undo);
36824
+ }
36825
+ function runCreateRollback() {
36826
+ while (createRollback.length > 0) {
36827
+ try {
36828
+ createRollback.pop()?.();
36829
+ } catch {
36830
+ }
36635
36831
  }
36636
36832
  }
36833
+ async function requireKnown(name, backend) {
36834
+ const facts = await resolveRunner(name, backend);
36835
+ if (!isUnknown(facts)) return facts;
36836
+ const { runners } = await listRunners(backend);
36837
+ const known = runners.map((r) => r.name);
36838
+ fail(
36839
+ `No runner named "${name}" on this machine.
36840
+ ` + (known.length > 0 ? `Known runners: ${known.join(", ")}` : "No runners here. Create one with `slay runner create <name> --token <token>`.")
36841
+ );
36842
+ }
36843
+ function requireRoot(facts, verb) {
36844
+ if (facts.root) return facts.root;
36845
+ fail(
36846
+ `"${facts.name}" is enrolled on the hub but has no installation on this machine, so there is nothing to ${verb}.
36847
+ Install it here with \`slay runner create ${facts.name} --token <token>\`, or run the command on the machine that hosts it.`
36848
+ );
36849
+ }
36637
36850
  function requireRegistered(name, backend) {
36638
36851
  if (backend === "none") {
36639
36852
  fail(
@@ -36641,7 +36854,7 @@ function requireRegistered(name, backend) {
36641
36854
  npx ${RUNNER_PACKAGE}`
36642
36855
  );
36643
36856
  }
36644
- if (!(0, import_node_fs8.existsSync)(unitPath("runner", name, backend))) {
36857
+ if (!(0, import_node_fs9.existsSync)(unitPath("runner", name, backend))) {
36645
36858
  const known = listRegisteredUnits("runner", backend).map((u) => u.name);
36646
36859
  fail(
36647
36860
  `No runner named "${name}" on this machine.
@@ -36670,7 +36883,7 @@ async function launchRunner(args) {
36670
36883
  const logDir = ensureLogDir("runner", root);
36671
36884
  const logs = serviceLogPaths("runner", root);
36672
36885
  if (backend === "none") {
36673
- const out = (0, import_node_fs8.openSync)(logs.out, "a");
36886
+ const out = (0, import_node_fs9.openSync)(logs.out, "a");
36674
36887
  const child = (0, import_node_child_process4.spawn)(bin.command, bin.args, {
36675
36888
  cwd: root,
36676
36889
  detached: true,
@@ -36688,6 +36901,7 @@ async function launchRunner(args) {
36688
36901
  });
36689
36902
  child.unref();
36690
36903
  if (!await waitForConnected(root, ENROLL_TIMEOUT_MS)) {
36904
+ if (creating) runCreateRollback();
36691
36905
  failWithLog(
36692
36906
  "runner",
36693
36907
  name,
@@ -36720,7 +36934,10 @@ async function launchRunner(args) {
36720
36934
  try {
36721
36935
  supervisorStart("runner", backend, name, writtenUnitPath);
36722
36936
  } catch (e) {
36723
- if (creating) removeUnit("runner", name, backend);
36937
+ if (creating) {
36938
+ removeUnit("runner", name, backend);
36939
+ runCreateRollback();
36940
+ }
36724
36941
  if (!(e instanceof SupervisorError)) throw e;
36725
36942
  const noBus = /Failed to connect to bus|No medium found/i.test(e.output);
36726
36943
  fail(
@@ -36740,6 +36957,7 @@ then log out and back in, and retry. If this account is not meant to have one (a
36740
36957
  if (creating) {
36741
36958
  supervisorStop("runner", backend, name);
36742
36959
  removeUnit("runner", name, backend);
36960
+ runCreateRollback();
36743
36961
  } else {
36744
36962
  supervisorStop("runner", backend, name);
36745
36963
  }
@@ -36807,69 +37025,51 @@ Run \`slay runner mint\` there, or put the hub in remote mode (\`slay hub create
36807
37025
  console.log(` slay runner create ${label ?? "<name>"} --token ${minted.token}`);
36808
37026
  warnIfLoopbackHub(minted.hubUrl);
36809
37027
  });
36810
- cmd.command("ls").description("List the runners installed on this machine").option("--json", "Output as JSON").action((opts) => {
36811
- const backend = detectBackend();
36812
- if (backend === "none") {
36813
- if (opts.json) {
36814
- console.log("[]");
36815
- return;
36816
- }
36817
- console.log(
36818
- "No runners installed \u2014 this platform has no user service manager, so runners cannot be registered here."
36819
- );
36820
- console.log(`Run one in the foreground instead:
36821
- npx ${RUNNER_PACKAGE}`);
36822
- return;
36823
- }
36824
- const units = listRegisteredUnits("runner", backend);
36825
- const rows = units.map((u) => {
36826
- const root = readUnitRoot("runner", u.name, backend);
36827
- const status = supervisorStatus("runner", backend, u.name);
36828
- const hubUrl = root ? loadRunnerConfigFile(configPathFor(root)).hubUrl ?? null : null;
36829
- return {
36830
- name: u.name,
36831
- unitPath: u.unitPath,
36832
- root,
36833
- running: status.running,
36834
- pid: status.pid,
36835
- lastExit: status.lastExit,
36836
- hubUrl,
36837
- enrolled: root ? isEnrolled(root) : false
36838
- };
36839
- });
37028
+ cmd.command("ls").description("List the runners this machine knows about").option("--json", "Output as JSON").action(async (opts) => {
37029
+ const backend = resolveBackend();
37030
+ const { runners, hubReachable } = await listRunners(backend);
36840
37031
  if (opts.json) {
36841
- console.log(JSON.stringify(rows, null, 2));
37032
+ console.log(JSON.stringify(runners, null, 2));
36842
37033
  return;
36843
37034
  }
36844
- if (rows.length === 0) {
36845
- console.log(
36846
- "No runners installed. Create one with `slay runner create <name> --token <token>`."
36847
- );
37035
+ if (runners.length === 0) {
37036
+ console.log("No runners here. Create one with `slay runner create <name> --token <token>`.");
37037
+ if (backend === "none") console.log(`
37038
+ ${explainNoBackend(detectBackendWithReason().reason)}`);
36848
37039
  return;
36849
37040
  }
36850
- const nameW = Math.max(4, ...rows.map((r) => r.name.length));
36851
- const rootW = Math.max(4, ...rows.map((r) => r.root ? shortenPath(r.root).length : 1));
36852
- const hubW = Math.max(3, ...rows.map((r) => (r.hubUrl ?? "-").length));
37041
+ const state = (r) => {
37042
+ if (r.running) return "running";
37043
+ if (r.supervised) return "stopped";
37044
+ return "unmanaged";
37045
+ };
37046
+ const enrolled = (r) => !hubReachable && !r.enrolled ? "?" : r.enrolled ? "yes" : "no";
37047
+ const nameW = Math.max(4, ...runners.map((r) => r.name.length));
37048
+ const rootW = Math.max(4, ...runners.map((r) => r.root ? shortenPath(r.root).length : 1));
37049
+ const hubW = Math.max(3, ...runners.map((r) => (r.hubUrl ?? "-").length));
36853
37050
  console.log(
36854
- `${"NAME".padEnd(nameW)} ${"STATE".padEnd(7)} ${"PID".padEnd(7)} ${"ROOT".padEnd(rootW)} ${"HUB".padEnd(hubW)} ENROLLED`
37051
+ `${"NAME".padEnd(nameW)} ${"STATE".padEnd(9)} ${"ROOT".padEnd(rootW)} ${"HUB".padEnd(hubW)} ENROLLED`
36855
37052
  );
36856
37053
  console.log(
36857
- `${"-".repeat(nameW)} ${"-".repeat(7)} ${"-".repeat(7)} ${"-".repeat(rootW)} ${"-".repeat(hubW)} ${"-".repeat(8)}`
37054
+ `${"-".repeat(nameW)} ${"-".repeat(9)} ${"-".repeat(rootW)} ${"-".repeat(hubW)} ${"-".repeat(8)}`
36858
37055
  );
36859
- for (const r of rows) {
37056
+ for (const r of runners) {
36860
37057
  console.log(
36861
- `${r.name.padEnd(nameW)} ${(r.running ? "running" : "stopped").padEnd(7)} ${String(r.pid ?? "-").padEnd(7)} ${(r.root ? shortenPath(r.root) : "?").padEnd(rootW)} ${(r.hubUrl ?? "-").padEnd(hubW)} ${r.enrolled ? "yes" : "no"}`
37058
+ `${r.name.padEnd(nameW)} ${state(r).padEnd(9)} ${(r.root ? shortenPath(r.root) : "?").padEnd(rootW)} ${(r.hubUrl ?? "-").padEnd(hubW)} ${enrolled(r)}`
36862
37059
  );
36863
37060
  }
36864
- for (const r of rows.filter((x2) => !x2.enrolled)) {
37061
+ if (!hubReachable) {
36865
37062
  console.log(
36866
37063
  `
36867
- Runner "${r.name}" has never reached a hub` + (r.lastExit !== null && r.lastExit !== 0 ? ` (last exit ${r.lastExit})` : "") + `. Check \`slay runner logs ${r.name}\`.`
37064
+ No hub could be reached, so ENROLLED is unknown ("?") for runners this machine has no local record of.`
36868
37065
  );
36869
37066
  }
36870
- for (const r of rows.filter((x2) => !x2.running)) {
36871
- console.log(`
36872
- Runner "${r.name}" is stopped. Start it: slay runner start ${r.name}`);
37067
+ const unmanaged = runners.filter((r) => state(r) === "unmanaged");
37068
+ if (unmanaged.length > 0 && backend !== "none") {
37069
+ console.log(
37070
+ `
37071
+ ${unmanaged.map((r) => `"${r.name}"`).join(", ")} ${unmanaged.length === 1 ? "is" : "are"} installed but not registered with ${backend}. \`slay runner start <name>\` will register and start ${unmanaged.length === 1 ? "it" : "them"}.`
37072
+ );
36873
37073
  }
36874
37074
  });
36875
37075
  cmd.command("create <name>").description("Install a runner here and keep it running (crash-restart + start at login)").requiredOption("--token <token>", "Join token minted on the hub (szjt1.\u2026)").option("--root <dir>", "Runner root \u2014 its config, credentials and logs (default: cwd)").option(
@@ -36877,7 +37077,7 @@ Runner "${r.name}" is stopped. Start it: slay runner start ${r.name}`);
36877
37077
  "Filesystem root the runner may operate under (repeatable; default: the runner root)",
36878
37078
  (value, previous = []) => [...previous, value]
36879
37079
  ).action(async (name, opts) => {
36880
- const root = (0, import_node_path7.resolve)(opts.root ?? process.cwd());
37080
+ const root = (0, import_node_path9.resolve)(opts.root ?? process.cwd());
36881
37081
  const backend = resolveBackend();
36882
37082
  const decoded = decodeJoinToken(opts.token);
36883
37083
  if (!decoded) {
@@ -36893,7 +37093,7 @@ Mint one on the hub:
36893
37093
  `"${DEFAULT_LOCAL_RUNNER_NAME}" is reserved for the runner inside the SlayZone desktop app \u2014 a second runner using it would collide with that one on the hub. Choose another name.`
36894
37094
  );
36895
37095
  }
36896
- if (backend !== "none" && (0, import_node_fs8.existsSync)(unitPath("runner", name, backend))) {
37096
+ if (backend !== "none" && (0, import_node_fs9.existsSync)(unitPath("runner", name, backend))) {
36897
37097
  const existingRoot = readUnitRoot("runner", name, backend);
36898
37098
  fail(
36899
37099
  `A runner named "${name}" already exists${existingRoot ? ` (root ${shortenPath(existingRoot)})` : ""}.
@@ -36901,13 +37101,28 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
36901
37101
  );
36902
37102
  }
36903
37103
  const occupant = loadRunnerConfigFile(configPathFor(root)).runnerName;
36904
- if (occupant !== void 0) {
37104
+ if (occupant !== void 0 && occupant !== name) {
37105
+ fail(
37106
+ `A runner is already installed in ${shortenPath(root)} \u2014 "${occupant}".
37107
+ Give this runner its own directory with \`--root <dir>\`, or remove "${occupant}" first with \`slay runner rm ${occupant}\`.`
37108
+ );
37109
+ }
37110
+ const adopting = occupant === name && backend !== "none";
37111
+ if (occupant === name && !adopting) {
36905
37112
  fail(
36906
37113
  `A runner is already installed in ${shortenPath(root)} \u2014 "${occupant}".
36907
- ` + (occupant === name ? `Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm ${name}\`.` : `Give this runner its own directory with \`--root <dir>\`, or remove "${occupant}" first with \`slay runner rm ${occupant}\`.`)
37114
+ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm ${name}\`.`
36908
37115
  );
36909
37116
  }
36910
- const allowedRoots = opts.allow && opts.allow.length > 0 ? opts.allow.map((d) => (0, import_node_path7.resolve)(d)) : [root];
37117
+ if (adopting) {
37118
+ console.log(
37119
+ `Adopting the runner already in ${shortenPath(root)} \u2014 it is installed but not registered with ${backend}. Its config will be refreshed with this token.`
37120
+ );
37121
+ console.log(
37122
+ ` If you started it in the foreground, stop that process first \u2014 otherwise two runners would share this root.`
37123
+ );
37124
+ }
37125
+ const allowedRoots = opts.allow && opts.allow.length > 0 ? opts.allow.map((d) => (0, import_node_path9.resolve)(d)) : [root];
36911
37126
  updateRunnerConfigFile(
36912
37127
  {
36913
37128
  joinToken: opts.token,
@@ -36917,27 +37132,42 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
36917
37132
  },
36918
37133
  configPathFor(root)
36919
37134
  );
37135
+ if (!adopting) {
37136
+ registerCreateRollback(() => {
37137
+ (0, import_node_fs9.rmSync)(configPathFor(root), { force: true });
37138
+ });
37139
+ }
36920
37140
  console.log(`Hub: ${decoded.hubUrl}`);
36921
37141
  console.log(`Allow: ${allowedRoots.map((d) => shortenPath(d)).join(", ")}`);
36922
37142
  warnIfLoopbackHub(decoded.hubUrl);
36923
37143
  await launchRunner({ name, root, backend, creating: true });
36924
37144
  });
36925
- cmd.command("start <name>").description("Start an existing runner that is stopped").action(async (name) => {
37145
+ cmd.command("start <name>").description("Start a runner, registering it first if it is not yet supervised").action(async (name) => {
36926
37146
  const backend = resolveBackend();
36927
- const { root } = requireRegistered(name, backend);
36928
- if (backend !== "none" && supervisorStatus("runner", backend, name).running) {
37147
+ const facts = await requireKnown(name, backend);
37148
+ if (facts.running) {
36929
37149
  const status = supervisorStatus("runner", backend, name);
36930
37150
  console.log(
36931
37151
  `Runner "${name}" is already running${status.pid ? ` (pid ${status.pid})` : ""}.`
36932
37152
  );
36933
37153
  return;
36934
37154
  }
37155
+ const root = requireRoot(facts, "start");
37156
+ if (!facts.supervised && backend !== "none") {
37157
+ console.log(`"${name}" is installed but not registered with ${backend} \u2014 registering it.`);
37158
+ }
36935
37159
  await launchRunner({ name, root, backend, creating: false });
36936
37160
  });
36937
37161
  cmd.command("stop <name>").description("Stop a runner, keeping it registered so `start` can bring it back").action(async (name) => {
36938
37162
  const backend = resolveBackend();
36939
- requireRegistered(name, backend);
37163
+ const facts = await requireKnown(name, backend);
36940
37164
  if (backend === "none") return;
37165
+ if (!facts.supervised) {
37166
+ console.log(
37167
+ `"${name}" is not registered with ${backend}, so there is nothing for it to stop.`
37168
+ );
37169
+ return;
37170
+ }
36941
37171
  supervisorStop("runner", backend, name);
36942
37172
  if (!await waitForStopped(name, backend, 15e3)) {
36943
37173
  fail(
@@ -36946,18 +37176,33 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
36946
37176
  }
36947
37177
  console.log(`Stopped "${name}". Start it again with \`slay runner start ${name}\`.`);
36948
37178
  });
36949
- cmd.command("rm <name>").description("Stop a runner and remove its registration").action((name) => {
37179
+ cmd.command("rm <name>").description("Stop a runner and remove its registration").option(
37180
+ "--purge",
37181
+ "Also delete the runner root (config, credentials, logs) \u2014 this is the operator\u2019s data"
37182
+ ).action(async (name, opts) => {
36950
37183
  const backend = resolveBackend();
36951
- const { root } = requireRegistered(name, backend);
36952
- if (backend === "none") return;
36953
- supervisorStopQuiet("runner", backend, name);
36954
- removeUnit("runner", name, backend);
36955
- console.log(
36956
- `Removed "${name}". Its config and credentials are still in ${shortenPath(root)}.`
36957
- );
36958
- console.log(
36959
- `It is still enrolled on its hub \u2014 revoke it there if this machine is going away.`
36960
- );
37184
+ const facts = await requireKnown(name, backend);
37185
+ if (facts.supervised && backend !== "none") {
37186
+ supervisorStopQuiet("runner", backend, name);
37187
+ removeUnit("runner", name, backend);
37188
+ console.log(`Unregistered "${name}" from ${backend}.`);
37189
+ } else if (backend !== "none") {
37190
+ console.log(`"${name}" had no ${backend} registration.`);
37191
+ }
37192
+ if (facts.root && facts.installed) {
37193
+ if (opts.purge) {
37194
+ (0, import_node_fs9.rmSync)(facts.root, { recursive: true, force: true });
37195
+ console.log(`Deleted ${shortenPath(facts.root)}.`);
37196
+ } else {
37197
+ console.log(`Config and credentials remain in ${shortenPath(facts.root)}.`);
37198
+ console.log(` Delete them too with \`slay runner rm ${name} --purge\`.`);
37199
+ }
37200
+ }
37201
+ if (facts.enrolled) {
37202
+ console.log(
37203
+ `It is still enrolled on its hub \u2014 revoke it there if this machine is going away.`
37204
+ );
37205
+ }
36961
37206
  });
36962
37207
  cmd.command("restart <name>").description("Restart a runner").option("--upgrade", `Re-resolve ${RUNNER_PACKAGE} first (picks up a newer version)`).action(async (name, opts) => {
36963
37208
  const backend = resolveBackend();
@@ -36995,9 +37240,10 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
36995
37240
  `Runner "${name}" restarted${status.pid ? ` (pid ${status.pid})` : ""} and reconnected.`
36996
37241
  );
36997
37242
  });
36998
- cmd.command("logs <name>").description("Show a runner's log output").option("-n, --lines <n>", "Last N lines", "50").option("-f, --follow", "Follow the log").action((name, opts) => {
36999
- const backend = detectBackend();
37000
- const { root } = requireRegistered(name, backend);
37243
+ cmd.command("logs <name>").description("Show a runner's log output").option("-n, --lines <n>", "Last N lines", "50").option("-f, --follow", "Follow the log").action(async (name, opts) => {
37244
+ const backend = resolveBackend();
37245
+ const facts = await requireKnown(name, backend);
37246
+ const root = requireRoot(facts, "read logs for");
37001
37247
  const lines = Number(opts.lines);
37002
37248
  if (!Number.isInteger(lines) || lines < 1) fail(`Invalid --lines ${opts.lines}.`);
37003
37249
  followServiceLog({
@@ -37006,7 +37252,7 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
37006
37252
  root,
37007
37253
  lines,
37008
37254
  follow: opts.follow === true,
37009
- systemdUnit: backend === "systemd" && (0, import_node_fs8.existsSync)(unitPath("runner", name, backend))
37255
+ systemdUnit: backend === "systemd" && (0, import_node_fs9.existsSync)(unitPath("runner", name, backend))
37010
37256
  });
37011
37257
  });
37012
37258
  return cmd;
@@ -37014,9 +37260,9 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
37014
37260
 
37015
37261
  // src/commands/update.ts
37016
37262
  var import_node_child_process5 = require("node:child_process");
37017
- var import_node_fs9 = require("node:fs");
37263
+ var import_node_fs10 = require("node:fs");
37018
37264
  var import_node_os2 = require("node:os");
37019
- var import_node_path8 = require("node:path");
37265
+ var import_node_path10 = require("node:path");
37020
37266
  var PACKAGE_NAMES = ["@slayzone/cli", "@slayzone/runner", "@slayzone/hub"];
37021
37267
  var KIND_FOR_PACKAGE = {
37022
37268
  "@slayzone/hub": "hub",
@@ -37030,9 +37276,9 @@ function runCapture(bin, args) {
37030
37276
  }
37031
37277
  }
37032
37278
  function bunGlobalRoot() {
37033
- const base = process.env.BUN_INSTALL || (0, import_node_path8.join)((0, import_node_os2.homedir)(), ".bun");
37034
- const dir = (0, import_node_path8.join)(base, "install", "global", "node_modules");
37035
- return (0, import_node_fs9.existsSync)(dir) ? dir : null;
37279
+ const base = process.env.BUN_INSTALL || (0, import_node_path10.join)((0, import_node_os2.homedir)(), ".bun");
37280
+ const dir = (0, import_node_path10.join)(base, "install", "global", "node_modules");
37281
+ return (0, import_node_fs10.existsSync)(dir) ? dir : null;
37036
37282
  }
37037
37283
  var MANAGERS = [
37038
37284
  {
@@ -37072,10 +37318,10 @@ var MANAGERS = [
37072
37318
  }
37073
37319
  ];
37074
37320
  function readInstalledVersion(globalRoot, pkg) {
37075
- const pkgJsonPath = (0, import_node_path8.join)(globalRoot, ...pkg.split("/"), "package.json");
37076
- if (!(0, import_node_fs9.existsSync)(pkgJsonPath)) return null;
37321
+ const pkgJsonPath = (0, import_node_path10.join)(globalRoot, ...pkg.split("/"), "package.json");
37322
+ if (!(0, import_node_fs10.existsSync)(pkgJsonPath)) return null;
37077
37323
  try {
37078
- const parsed = JSON.parse((0, import_node_fs9.readFileSync)(pkgJsonPath, "utf8"));
37324
+ const parsed = JSON.parse((0, import_node_fs10.readFileSync)(pkgJsonPath, "utf8"));
37079
37325
  return typeof parsed.version === "string" ? parsed.version : null;
37080
37326
  } catch {
37081
37327
  return null;
@@ -37108,14 +37354,18 @@ function printRestartHints(updatedPackages) {
37108
37354
  for (const hint of hints) console.log(hint);
37109
37355
  }
37110
37356
  function updateCommand() {
37111
- const cmd = new Command("update").description("Update globally installed @slayzone packages (cli, hub, runner) \u2014 npm, pnpm, or bun").option("--check", "Report available updates without installing anything").action((opts) => {
37357
+ const cmd = new Command("update").description(
37358
+ "Update globally installed @slayzone packages (cli, hub, runner) \u2014 npm, pnpm, or bun"
37359
+ ).option("--check", "Report available updates without installing anything").action((opts) => {
37112
37360
  const roots = /* @__PURE__ */ new Map();
37113
37361
  for (const mgr of MANAGERS) {
37114
37362
  const root = mgr.globalRoot();
37115
37363
  if (root) roots.set(mgr.id, root);
37116
37364
  }
37117
37365
  if (roots.size === 0) {
37118
- fail("Could not resolve a global install root for npm, pnpm, or bun. Is at least one on PATH?");
37366
+ fail(
37367
+ "Could not resolve a global install root for npm, pnpm, or bun. Is at least one on PATH?"
37368
+ );
37119
37369
  }
37120
37370
  const found = [];
37121
37371
  for (const [manager, root] of roots) {
@@ -37175,7 +37425,9 @@ function updateCommand() {
37175
37425
  } catch {
37176
37426
  fail(
37177
37427
  `${mgr.bin} install failed. Install the packages yourself and retry:
37178
- ` + names.map((n) => ` ${mgr.bin} ${mgr.id === "npm" ? "install" : "add"} -g ${n}@${target}`).join("\n")
37428
+ ` + names.map(
37429
+ (n) => ` ${mgr.bin} ${mgr.id === "npm" ? "install" : "add"} -g ${n}@${target}`
37430
+ ).join("\n")
37179
37431
  );
37180
37432
  }
37181
37433
  }
@@ -37185,7 +37437,7 @@ function updateCommand() {
37185
37437
  }
37186
37438
 
37187
37439
  // src/index.ts
37188
- var program2 = new Command().name("slay").description("SlayZone CLI").version("0.36.0-beta.13").option("--dev", "Use development database (slayzone.dev.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
37440
+ var program2 = new Command().name("slay").description("SlayZone CLI").version("0.36.0-beta.16").option("--dev", "Use development database (slayzone.dev.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
37189
37441
  const root = thisCommand.parent ?? thisCommand;
37190
37442
  const opts = root.opts();
37191
37443
  if (opts.dev) process.env.SLAYZONE_DEV = "1";