@slayzone/cli 0.36.0-beta.15 → 0.36.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/slay.js +668 -391
- 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
|
|
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 =
|
|
2146
|
+
const localBin = path10.resolve(baseDir, baseName);
|
|
2147
2147
|
if (fs7.existsSync(localBin)) return localBin;
|
|
2148
|
-
if (sourceExt.includes(
|
|
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 =
|
|
2167
|
-
|
|
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 =
|
|
2174
|
+
const legacyName = path10.basename(
|
|
2175
2175
|
this._scriptPath,
|
|
2176
|
-
|
|
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(
|
|
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 =
|
|
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(
|
|
3049
|
-
if (
|
|
3050
|
-
this._executableDir =
|
|
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
|
|
3550
|
-
minimatch.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 (
|
|
4060
|
-
f = f.split(
|
|
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,
|
|
4159
|
-
let files = await readdir(
|
|
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 =
|
|
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,
|
|
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(
|
|
4190
|
-
yield* exploreWalkAsync("",
|
|
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(
|
|
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(
|
|
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(
|
|
6302
|
+
fs8.lchmod = function(path10, mode, callback) {
|
|
6303
6303
|
fs8.open(
|
|
6304
|
-
|
|
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(
|
|
6321
|
-
var fd = fs8.openSync(
|
|
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(
|
|
6343
|
-
fs8.open(
|
|
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(
|
|
6356
|
-
var fd = fs8.openSync(
|
|
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(
|
|
6475
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
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 =
|
|
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(
|
|
6524
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
6523
|
+
function WriteStream(path10, options) {
|
|
6524
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path10, options);
|
|
6525
6525
|
Stream.call(this);
|
|
6526
|
-
this.path =
|
|
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(
|
|
6669
|
+
function readFile(path10, options, cb) {
|
|
6670
6670
|
if (typeof options === "function")
|
|
6671
6671
|
cb = options, options = null;
|
|
6672
|
-
return go$readFile(
|
|
6673
|
-
function go$readFile(
|
|
6674
|
-
return fs$readFile(
|
|
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, [
|
|
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(
|
|
6686
|
+
function writeFile(path10, data, options, cb) {
|
|
6687
6687
|
if (typeof options === "function")
|
|
6688
6688
|
cb = options, options = null;
|
|
6689
|
-
return go$writeFile(
|
|
6690
|
-
function go$writeFile(
|
|
6691
|
-
return fs$writeFile(
|
|
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, [
|
|
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(
|
|
6704
|
+
function appendFile(path10, data, options, cb) {
|
|
6705
6705
|
if (typeof options === "function")
|
|
6706
6706
|
cb = options, options = null;
|
|
6707
|
-
return go$appendFile(
|
|
6708
|
-
function go$appendFile(
|
|
6709
|
-
return fs$appendFile(
|
|
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, [
|
|
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(
|
|
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(
|
|
6746
|
-
return fs$readdir(
|
|
6747
|
-
|
|
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(
|
|
6753
|
-
return fs$readdir(
|
|
6754
|
-
|
|
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(
|
|
6761
|
-
function fs$readdirCallback(
|
|
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
|
-
[
|
|
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(
|
|
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(
|
|
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(
|
|
6876
|
-
return new fs8.ReadStream(
|
|
6875
|
+
function createReadStream(path10, options) {
|
|
6876
|
+
return new fs8.ReadStream(path10, options);
|
|
6877
6877
|
}
|
|
6878
|
-
function createWriteStream(
|
|
6879
|
-
return new fs8.WriteStream(
|
|
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(
|
|
6883
|
+
function open(path10, flags, mode, cb) {
|
|
6884
6884
|
if (typeof mode === "function")
|
|
6885
6885
|
cb = mode, mode = null;
|
|
6886
|
-
return go$open(
|
|
6887
|
-
function go$open(
|
|
6888
|
-
return fs$open(
|
|
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, [
|
|
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(
|
|
8996
|
-
if (typeof
|
|
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 (
|
|
9000
|
-
var len =
|
|
9001
|
-
if (len <= 1) return
|
|
8999
|
+
if (path10 === "\\" || path10 === "/") return "/";
|
|
9000
|
+
var len = path10.length;
|
|
9001
|
+
if (len <= 1) return path10;
|
|
9002
9002
|
var prefix = "";
|
|
9003
|
-
if (len > 4 &&
|
|
9004
|
-
var ch =
|
|
9005
|
-
if ((ch === "?" || ch === ".") &&
|
|
9006
|
-
|
|
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 =
|
|
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
|
|
17711
|
+
var path10 = {
|
|
17712
17712
|
win32: { sep: "\\" },
|
|
17713
17713
|
posix: { sep: "/" }
|
|
17714
17714
|
};
|
|
17715
|
-
exports2.sep = defaultPlatform === "win32" ?
|
|
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(
|
|
20964
|
-
if (!
|
|
20963
|
+
resolve(path10) {
|
|
20964
|
+
if (!path10) {
|
|
20965
20965
|
return this;
|
|
20966
20966
|
}
|
|
20967
|
-
const rootPath = this.getRootString(
|
|
20968
|
-
const dir =
|
|
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(
|
|
21722
|
-
return node_path_1.win32.parse(
|
|
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(
|
|
21770
|
-
return
|
|
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(
|
|
21861
|
-
if (typeof
|
|
21862
|
-
|
|
21860
|
+
depth(path10 = this.cwd) {
|
|
21861
|
+
if (typeof path10 === "string") {
|
|
21862
|
+
path10 = this.cwd.resolve(path10);
|
|
21863
21863
|
}
|
|
21864
|
-
return
|
|
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(
|
|
22351
|
+
chdir(path10 = this.cwd) {
|
|
22352
22352
|
const oldCwd = this.cwd;
|
|
22353
|
-
this.cwd = typeof
|
|
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(([
|
|
22742
|
-
|
|
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,
|
|
22960
|
+
constructor(patterns, path10, opts) {
|
|
22961
22961
|
this.patterns = patterns;
|
|
22962
|
-
this.path =
|
|
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(
|
|
22982
|
-
return this.seen.has(
|
|
22981
|
+
#ignored(path10) {
|
|
22982
|
+
return this.seen.has(path10) || !!this.#ignore?.ignored?.(path10);
|
|
22983
22983
|
}
|
|
22984
|
-
#childrenIgnored(
|
|
22985
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
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,
|
|
23202
|
-
super(patterns,
|
|
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,
|
|
23241
|
-
super(patterns,
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
23838
|
+
filepath = path10.join(dirpath, file);
|
|
23839
23839
|
fs7.stat(filepath, function(err2, stats) {
|
|
23840
23840
|
results.push({
|
|
23841
23841
|
path: filepath,
|
|
23842
|
-
relative:
|
|
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
|
|
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 =
|
|
24180
|
+
var dirName = path10.dirname(task.filepath);
|
|
24181
24181
|
task.data.type = "symlink";
|
|
24182
|
-
task.data.linkname =
|
|
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,
|
|
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}${
|
|
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(
|
|
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
|
-
|
|
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
|
|
28773
|
-
if (
|
|
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(
|
|
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}${
|
|
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(
|
|
28807
|
-
return request(
|
|
28826
|
+
function apiGet(path10) {
|
|
28827
|
+
return request(path10);
|
|
28808
28828
|
}
|
|
28809
|
-
function apiPost(
|
|
28810
|
-
return request(
|
|
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(
|
|
28817
|
-
return request(
|
|
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(
|
|
28824
|
-
if (body === void 0) return request(
|
|
28825
|
-
return request(
|
|
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(
|
|
28851
|
+
async function apiFetch(path10, init) {
|
|
28832
28852
|
const target = await resolveTarget();
|
|
28833
28853
|
try {
|
|
28834
|
-
return await fetch(`${target.baseUrl}${
|
|
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(
|
|
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}${
|
|
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,
|
|
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}${
|
|
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(
|
|
28887
|
-
return requestStream("POST",
|
|
28906
|
+
function apiPostStream(path10, body) {
|
|
28907
|
+
return requestStream("POST", path10, body);
|
|
28888
28908
|
}
|
|
28889
|
-
function apiPutStream(
|
|
28890
|
-
return requestStream("PUT",
|
|
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:
|
|
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(
|
|
29110
|
+
copyFileSync(path10, opts.output);
|
|
29091
29111
|
console.log(opts.output);
|
|
29092
29112
|
} else {
|
|
29093
|
-
console.log(
|
|
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,
|
|
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:
|
|
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
|
|
29180
|
-
if (
|
|
29181
|
-
|
|
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 {
|
|
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
|
|
29555
|
+
const path10 = `/api/tasks/${encodeURIComponent(taskId)}/tags`;
|
|
29530
29556
|
let tagNames;
|
|
29531
29557
|
if (opts.set) {
|
|
29532
29558
|
;
|
|
29533
|
-
({ data: tagNames } = await apiPost(
|
|
29559
|
+
({ data: tagNames } = await apiPost(path10, { set: opts.set }));
|
|
29534
29560
|
} else if (opts.add) {
|
|
29535
29561
|
;
|
|
29536
|
-
({ data: tagNames } = await apiPost(
|
|
29562
|
+
({ data: tagNames } = await apiPost(path10, { add: opts.add }));
|
|
29537
29563
|
} else if (opts.remove) {
|
|
29538
29564
|
;
|
|
29539
|
-
({ data: tagNames } = await apiDelete(
|
|
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(
|
|
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
|
|
29589
|
+
const path10 = `/api/tasks/${encodeURIComponent(taskId)}/blockers`;
|
|
29564
29590
|
let blockers;
|
|
29565
29591
|
if (opts.set) {
|
|
29566
29592
|
;
|
|
29567
|
-
({ data: blockers } = await apiPost(
|
|
29593
|
+
({ data: blockers } = await apiPost(path10, { set: opts.set }));
|
|
29568
29594
|
} else if (opts.add) {
|
|
29569
29595
|
;
|
|
29570
|
-
({ data: blockers } = await apiPost(
|
|
29596
|
+
({ data: blockers } = await apiPost(path10, { add: opts.add }));
|
|
29571
29597
|
} else if (opts.remove) {
|
|
29572
29598
|
;
|
|
29573
|
-
({ data: blockers } = await apiDelete(
|
|
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(
|
|
29604
|
+
({ data: blockers } = await apiDelete(path10, { clear: true }));
|
|
29579
29605
|
} else {
|
|
29580
29606
|
;
|
|
29581
|
-
({ data: blockers } = await apiGet(
|
|
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
|
|
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(
|
|
29646
|
+
({ data: state } = await apiPost(path10, body));
|
|
29621
29647
|
} else {
|
|
29622
29648
|
;
|
|
29623
|
-
({ data: state } = await apiGet(
|
|
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(
|
|
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)(
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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 =
|
|
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 =
|
|
34487
|
-
import_node_fs2.default.mkdirSync(
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
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,
|
|
35364
|
+
return (0, import_node_path4.join)(getSlayzoneHomeDir(), "hub.config.json");
|
|
35340
35365
|
}
|
|
35341
35366
|
function getRunnerConfigFilePath() {
|
|
35342
|
-
return (0,
|
|
35367
|
+
return (0, import_node_path4.join)(getSlayzoneHomeDir(), "runner.config.json");
|
|
35343
35368
|
}
|
|
35344
35369
|
function legacyConfigFilePathFor(newFilePath) {
|
|
35345
|
-
return (0,
|
|
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)
|
|
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)
|
|
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(
|
|
35398
|
+
function readJsonObject(path10) {
|
|
35372
35399
|
let raw;
|
|
35373
35400
|
try {
|
|
35374
|
-
raw = (0, import_node_fs4.readFileSync)(
|
|
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 ${
|
|
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] ${
|
|
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] ${
|
|
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(
|
|
35401
|
-
const dir = (0,
|
|
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 = `${
|
|
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,
|
|
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,
|
|
35414
|
-
writeJsonAtomic(
|
|
35440
|
+
function saveHubConfigFile(cfg, path10 = getHubConfigFilePath()) {
|
|
35441
|
+
writeJsonAtomic(path10, cfg);
|
|
35415
35442
|
}
|
|
35416
|
-
function updateHubConfigFile(patch,
|
|
35417
|
-
const current = readJsonObject(
|
|
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,
|
|
35449
|
+
saveHubConfigFile(merged, path10);
|
|
35423
35450
|
return merged;
|
|
35424
35451
|
}
|
|
35425
|
-
function loadRunnerConfigFile(
|
|
35426
|
-
const raw = readJsonObject(
|
|
35452
|
+
function loadRunnerConfigFile(path10 = getRunnerConfigFilePath()) {
|
|
35453
|
+
const raw = readJsonObject(path10);
|
|
35427
35454
|
if (raw) return coerceRunnerConfig(raw);
|
|
35428
|
-
const legacy = readJsonObject(legacyConfigFilePathFor(
|
|
35455
|
+
const legacy = readJsonObject(legacyConfigFilePathFor(path10));
|
|
35429
35456
|
return legacy ? coerceRunnerConfig(legacy) : {};
|
|
35430
35457
|
}
|
|
35431
|
-
function saveRunnerConfigFile(cfg,
|
|
35432
|
-
writeJsonAtomic(
|
|
35458
|
+
function saveRunnerConfigFile(cfg, path10 = getRunnerConfigFilePath()) {
|
|
35459
|
+
writeJsonAtomic(path10, cfg);
|
|
35433
35460
|
}
|
|
35434
|
-
function updateRunnerConfigFile(patch,
|
|
35435
|
-
const current = readJsonObject(
|
|
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,
|
|
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
|
|
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,
|
|
35485
|
-
if (backend === "systemd") return (0,
|
|
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
|
|
35489
|
-
if (process.
|
|
35490
|
-
|
|
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
|
|
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
|
-
|
|
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,
|
|
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,
|
|
35635
|
+
<string>${xmlEscape((0, import_node_path5.join)(spec.logDir, kind.outLog))}</string>
|
|
35562
35636
|
<key>StandardErrorPath</key>
|
|
35563
|
-
<string>${xmlEscape((0,
|
|
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
|
|
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)(
|
|
35600
|
-
return
|
|
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
|
|
35604
|
-
if (!(0, import_node_fs5.existsSync)(
|
|
35605
|
-
(0, import_node_fs5.rmSync)(
|
|
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,
|
|
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
|
|
35651
|
-
var CLI_VERSION = true ? "0.36.0-beta.
|
|
35724
|
+
var import_node_path6 = require("node:path");
|
|
35725
|
+
var CLI_VERSION = true ? "0.36.0-beta.17" : "";
|
|
35652
35726
|
function fail(message) {
|
|
35653
35727
|
console.error(message);
|
|
35654
35728
|
process.exit(1);
|
|
35655
35729
|
}
|
|
35656
|
-
function shortenPath(
|
|
35730
|
+
function shortenPath(path10) {
|
|
35657
35731
|
const home = process.env.HOME ?? "";
|
|
35658
|
-
return home &&
|
|
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,
|
|
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,
|
|
35763
|
+
let dir = (0, import_node_path6.dirname)(binPath);
|
|
35690
35764
|
for (let i = 0; i < 6; i++) {
|
|
35691
|
-
const pathTxt = (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
35740
|
-
if (!
|
|
35741
|
-
const found2 = readServicePkg(kind,
|
|
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,
|
|
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,
|
|
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,
|
|
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 = "";
|
|
@@ -35799,7 +35873,18 @@ No output was captured in ${shortenPath(logPath)}.
|
|
|
35799
35873
|
`)
|
|
35800
35874
|
);
|
|
35801
35875
|
}
|
|
35802
|
-
function readServiceLogTail(kind, root, lines) {
|
|
35876
|
+
function readServiceLogTail(kind, root, lines, systemdUnit) {
|
|
35877
|
+
if (systemdUnit) {
|
|
35878
|
+
try {
|
|
35879
|
+
return (0, import_node_child_process2.execFileSync)(
|
|
35880
|
+
"journalctl",
|
|
35881
|
+
["--user", "-u", systemdUnit, "-n", String(lines), "--no-pager", "-o", "cat"],
|
|
35882
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], env: userServiceEnv() }
|
|
35883
|
+
).trim();
|
|
35884
|
+
} catch {
|
|
35885
|
+
return "";
|
|
35886
|
+
}
|
|
35887
|
+
}
|
|
35803
35888
|
const dir = logDirFor(kind, root);
|
|
35804
35889
|
let files;
|
|
35805
35890
|
try {
|
|
@@ -35810,7 +35895,7 @@ function readServiceLogTail(kind, root, lines) {
|
|
|
35810
35895
|
const chunks = [];
|
|
35811
35896
|
for (const f of files) {
|
|
35812
35897
|
try {
|
|
35813
|
-
chunks.push((0, import_node_fs6.readFileSync)((0,
|
|
35898
|
+
chunks.push((0, import_node_fs6.readFileSync)((0, import_node_path6.join)(dir, f), "utf8"));
|
|
35814
35899
|
} catch {
|
|
35815
35900
|
}
|
|
35816
35901
|
}
|
|
@@ -35821,13 +35906,13 @@ function followServiceLog(args) {
|
|
|
35821
35906
|
if (systemdUnit) {
|
|
35822
35907
|
const jargs = ["--user", "-u", systemdUnitName(kind, name), "-n", String(lines)];
|
|
35823
35908
|
if (follow) jargs.push("-f");
|
|
35824
|
-
const child2 = (0, import_node_child_process2.spawn)("journalctl", jargs, { stdio: "inherit" });
|
|
35909
|
+
const child2 = (0, import_node_child_process2.spawn)("journalctl", jargs, { stdio: "inherit", env: userServiceEnv() });
|
|
35825
35910
|
child2.on("exit", (code) => process.exit(code ?? 0));
|
|
35826
35911
|
return;
|
|
35827
35912
|
}
|
|
35828
35913
|
const dir = logDirFor(kind, root);
|
|
35829
35914
|
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,
|
|
35915
|
+
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
35916
|
if (candidates.length === 0) fail(`No log files in ${shortenPath(dir)}.`);
|
|
35832
35917
|
const target = candidates[0].path;
|
|
35833
35918
|
const targs = follow ? ["-f", "-n", String(lines), target] : ["-n", String(lines), target];
|
|
@@ -35843,7 +35928,7 @@ var SupervisorError = class extends Error {
|
|
|
35843
35928
|
};
|
|
35844
35929
|
function run(file, args) {
|
|
35845
35930
|
try {
|
|
35846
|
-
(0, import_node_child_process2.execFileSync)(file, args, { stdio: ["ignore", "inherit", "pipe"] });
|
|
35931
|
+
(0, import_node_child_process2.execFileSync)(file, args, { stdio: ["ignore", "inherit", "pipe"], env: userServiceEnv() });
|
|
35847
35932
|
} catch (e) {
|
|
35848
35933
|
const stderr = e.stderr;
|
|
35849
35934
|
throw new SupervisorError(
|
|
@@ -35870,7 +35955,10 @@ function supervisorStart(kind, backend, name, unitFilePath) {
|
|
|
35870
35955
|
run("systemctl", ["--user", "daemon-reload"]);
|
|
35871
35956
|
run("systemctl", ["--user", "enable", "--now", unit]);
|
|
35872
35957
|
try {
|
|
35873
|
-
(0, import_node_child_process2.execFileSync)("loginctl", ["enable-linger", process.env.USER ?? ""], {
|
|
35958
|
+
(0, import_node_child_process2.execFileSync)("loginctl", ["enable-linger", process.env.USER ?? ""], {
|
|
35959
|
+
stdio: "ignore",
|
|
35960
|
+
env: userServiceEnv()
|
|
35961
|
+
});
|
|
35874
35962
|
} catch {
|
|
35875
35963
|
console.log(
|
|
35876
35964
|
`Note: could not enable systemd lingering \u2014 the ${kind} will stop when you log out.`
|
|
@@ -35890,7 +35978,8 @@ function supervisorStop(kind, backend, name) {
|
|
|
35890
35978
|
}
|
|
35891
35979
|
try {
|
|
35892
35980
|
(0, import_node_child_process2.execFileSync)("systemctl", ["--user", "disable", "--now", systemdUnitName(kind, name)], {
|
|
35893
|
-
stdio: "ignore"
|
|
35981
|
+
stdio: "ignore",
|
|
35982
|
+
env: userServiceEnv()
|
|
35894
35983
|
});
|
|
35895
35984
|
} catch {
|
|
35896
35985
|
}
|
|
@@ -35926,8 +36015,18 @@ function supervisorStatus(kind, backend, name) {
|
|
|
35926
36015
|
try {
|
|
35927
36016
|
out = (0, import_node_child_process2.execFileSync)(
|
|
35928
36017
|
"systemctl",
|
|
35929
|
-
[
|
|
35930
|
-
|
|
36018
|
+
[
|
|
36019
|
+
"--user",
|
|
36020
|
+
"show",
|
|
36021
|
+
systemdUnitName(kind, name),
|
|
36022
|
+
"-p",
|
|
36023
|
+
"ActiveState",
|
|
36024
|
+
"-p",
|
|
36025
|
+
"MainPID",
|
|
36026
|
+
"-p",
|
|
36027
|
+
"ExecMainStatus"
|
|
36028
|
+
],
|
|
36029
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], env: userServiceEnv() }
|
|
35931
36030
|
);
|
|
35932
36031
|
} catch {
|
|
35933
36032
|
return none;
|
|
@@ -35962,8 +36061,8 @@ Name one with \`slay --hub <name|port> ${what}\`.`
|
|
|
35962
36061
|
return { baseUrl: `http://127.0.0.1:${running[0].port}`, token: null };
|
|
35963
36062
|
}
|
|
35964
36063
|
async function hubRequest(opts) {
|
|
35965
|
-
const { target, path:
|
|
35966
|
-
const url = `${target.baseUrl}${
|
|
36064
|
+
const { target, path: path10, method, body, unwrap } = opts;
|
|
36065
|
+
const url = `${target.baseUrl}${path10}`;
|
|
35967
36066
|
let res;
|
|
35968
36067
|
try {
|
|
35969
36068
|
res = await fetch(url, {
|
|
@@ -36294,10 +36393,12 @@ function hubCommand() {
|
|
|
36294
36393
|
console.log(
|
|
36295
36394
|
`${"-".repeat(nameW)} ${"-".repeat(5)} ${"-".repeat(7)} ${"-".repeat(rootW)} ${"-".repeat(7)} ${"-".repeat(8)}`
|
|
36296
36395
|
);
|
|
36396
|
+
const ownRoot = process.env.SLAYZONE_ROOT?.trim() ? (0, import_node_path7.resolve)(process.env.SLAYZONE_ROOT.trim()) : null;
|
|
36297
36397
|
for (const h of hubs) {
|
|
36298
36398
|
const root = h.supervised ? "(desktop app)" : shortenPath(h.root);
|
|
36399
|
+
const mine = ownRoot && (0, import_node_path7.resolve)(h.root) === ownRoot ? " \u2190 this shell" : "";
|
|
36299
36400
|
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)}`
|
|
36401
|
+
`${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
36402
|
);
|
|
36302
36403
|
}
|
|
36303
36404
|
});
|
|
@@ -36306,7 +36407,7 @@ function hubCommand() {
|
|
|
36306
36407
|
"Externally-reachable address of this hub \u2014 makes it a REMOTE hub (auth + TLS + wss join tokens)"
|
|
36307
36408
|
).option("--bind <host[:port]>", "Address to bind (default: loopback, or 0.0.0.0 when remote)").action(
|
|
36308
36409
|
async (name, opts) => {
|
|
36309
|
-
const root = (0,
|
|
36410
|
+
const root = (0, import_node_path7.resolve)(opts.root ?? process.cwd());
|
|
36310
36411
|
const port = opts.port === void 0 ? void 0 : Number(opts.port);
|
|
36311
36412
|
if (port !== void 0 && (!Number.isInteger(port) || port < 1 || port > 65535)) {
|
|
36312
36413
|
fail(`Invalid --port ${opts.port} \u2014 expected an integer 1-65535.`);
|
|
@@ -36357,7 +36458,7 @@ Start it with \`slay hub start ${name}\`, or remove it with \`slay hub rm ${name
|
|
|
36357
36458
|
publicAddress,
|
|
36358
36459
|
...address !== void 0 ? { address } : {}
|
|
36359
36460
|
},
|
|
36360
|
-
(0,
|
|
36461
|
+
(0, import_node_path7.join)(root, "hub.config.json")
|
|
36361
36462
|
);
|
|
36362
36463
|
console.log("Mode: remote (client auth + TLS enforced)");
|
|
36363
36464
|
console.log(`Bind: ${address ?? "(hub block default)"}`);
|
|
@@ -36412,6 +36513,12 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
|
|
|
36412
36513
|
`The unit for "${name}" does not record a root \u2014 it may be hand-edited. Remove it with \`slay hub rm ${name}\` and create it again.`
|
|
36413
36514
|
);
|
|
36414
36515
|
}
|
|
36516
|
+
const occupant = (await discoverAllHubs()).find((h) => h.root === root);
|
|
36517
|
+
if (occupant) {
|
|
36518
|
+
fail(
|
|
36519
|
+
`A hub is already running in ${shortenPath(root)} \u2014 "${occupant.name}" on port ${occupant.port} (pid ${occupant.pid}). Starting "${name}" would put two hubs on the same store.`
|
|
36520
|
+
);
|
|
36521
|
+
}
|
|
36415
36522
|
await launchHub({ name, root, backend, creating: false });
|
|
36416
36523
|
});
|
|
36417
36524
|
cmd.command("stop <name|port>").description("Stop a hub, keeping it registered so `start` can bring it back").action(async (nameOrPort) => {
|
|
@@ -36474,7 +36581,14 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
|
|
|
36474
36581
|
console.log(`Unit updated to ${HUB_PACKAGE}@${bin.version}.`);
|
|
36475
36582
|
}
|
|
36476
36583
|
supervisorStop("hub", backend, name);
|
|
36477
|
-
await waitForHubGone(hub.port, 15e3)
|
|
36584
|
+
if (!await waitForHubGone(hub.port, 15e3)) {
|
|
36585
|
+
fail(
|
|
36586
|
+
`Hub "${name}" is still answering on port ${hub.port} after 15s, so restarting would leave TWO hubs sharing ${shortenPath(root)} \u2014 refusing.
|
|
36587
|
+
It is not owned by ${backend} (started by hand, docker, or before it was registered). Stop that process first:
|
|
36588
|
+
kill ${hub.pid}
|
|
36589
|
+
then \`slay hub start ${name}\`.`
|
|
36590
|
+
);
|
|
36591
|
+
}
|
|
36478
36592
|
supervisorStart("hub", backend, name, unitPath("hub", name, backend));
|
|
36479
36593
|
const back = await waitForHub(() => findHub(name), 2e4);
|
|
36480
36594
|
if (!back) fail(`Hub "${name}" did not come back within 20s. Check ${shortenPath(logDir)}.`);
|
|
@@ -36586,8 +36700,8 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
|
|
|
36586
36700
|
|
|
36587
36701
|
// src/commands/runner.ts
|
|
36588
36702
|
var import_node_child_process4 = require("node:child_process");
|
|
36589
|
-
var
|
|
36590
|
-
var
|
|
36703
|
+
var import_node_fs9 = require("node:fs");
|
|
36704
|
+
var import_node_path9 = require("node:path");
|
|
36591
36705
|
|
|
36592
36706
|
// ../../shared/platform/src/join-token.ts
|
|
36593
36707
|
var JOIN_TOKEN_PREFIX = "szjt1";
|
|
@@ -36609,13 +36723,115 @@ function decodeJoinToken(token) {
|
|
|
36609
36723
|
}
|
|
36610
36724
|
}
|
|
36611
36725
|
|
|
36726
|
+
// src/commands/runner-identity.ts
|
|
36727
|
+
var import_node_fs8 = require("node:fs");
|
|
36728
|
+
var import_node_path8 = require("node:path");
|
|
36729
|
+
function configPathFor(root) {
|
|
36730
|
+
return (0, import_node_path8.join)(root, "runner.config.json");
|
|
36731
|
+
}
|
|
36732
|
+
function ambientRoot() {
|
|
36733
|
+
return process.env.SLAYZONE_ROOT ?? process.cwd();
|
|
36734
|
+
}
|
|
36735
|
+
function isEnrolled(root) {
|
|
36736
|
+
try {
|
|
36737
|
+
const parsed = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path8.join)(root, "runner.state.json"), "utf8"));
|
|
36738
|
+
return typeof parsed === "object" && parsed !== null && Object.keys(parsed).length > 0;
|
|
36739
|
+
} catch {
|
|
36740
|
+
return false;
|
|
36741
|
+
}
|
|
36742
|
+
}
|
|
36743
|
+
async function hubRunners() {
|
|
36744
|
+
let baseUrl;
|
|
36745
|
+
let token = null;
|
|
36746
|
+
try {
|
|
36747
|
+
const configured = resolveHubTarget();
|
|
36748
|
+
if (configured) {
|
|
36749
|
+
baseUrl = configured.baseUrl;
|
|
36750
|
+
token = configured.token;
|
|
36751
|
+
} else {
|
|
36752
|
+
const running = await discoverHubs();
|
|
36753
|
+
if (running.length !== 1) return null;
|
|
36754
|
+
baseUrl = `http://127.0.0.1:${running[0].port}`;
|
|
36755
|
+
}
|
|
36756
|
+
} catch {
|
|
36757
|
+
return null;
|
|
36758
|
+
}
|
|
36759
|
+
try {
|
|
36760
|
+
const res = await fetch(`${baseUrl}/api/runners`, {
|
|
36761
|
+
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
|
36762
|
+
signal: AbortSignal.timeout(3e3)
|
|
36763
|
+
});
|
|
36764
|
+
if (!res.ok) return null;
|
|
36765
|
+
const rows = await res.json();
|
|
36766
|
+
return Array.isArray(rows) ? rows : null;
|
|
36767
|
+
} catch {
|
|
36768
|
+
return null;
|
|
36769
|
+
}
|
|
36770
|
+
}
|
|
36771
|
+
function localFacts(name, root, backend, supervised) {
|
|
36772
|
+
const cfg = root ? loadRunnerConfigFile(configPathFor(root)) : {};
|
|
36773
|
+
return {
|
|
36774
|
+
name,
|
|
36775
|
+
root,
|
|
36776
|
+
installed: cfg.runnerName !== void 0,
|
|
36777
|
+
supervised,
|
|
36778
|
+
enrolled: root ? isEnrolled(root) : false,
|
|
36779
|
+
running: supervised ? supervisorStatus("runner", backend, name).running : false,
|
|
36780
|
+
hubUrl: cfg.hubUrl ?? null
|
|
36781
|
+
};
|
|
36782
|
+
}
|
|
36783
|
+
function rootClaims(root, name) {
|
|
36784
|
+
return loadRunnerConfigFile(configPathFor(root)).runnerName === name;
|
|
36785
|
+
}
|
|
36786
|
+
async function resolveRunner(name, backend, opts = {}) {
|
|
36787
|
+
const cwd = opts.cwd ?? ambientRoot();
|
|
36788
|
+
const supervised = backend !== "none" && (0, import_node_fs8.existsSync)(unitPath("runner", name, backend));
|
|
36789
|
+
const root = supervised ? readUnitRoot("runner", name, backend) : rootClaims(cwd, name) ? cwd : null;
|
|
36790
|
+
const local = localFacts(name, root, backend, supervised);
|
|
36791
|
+
if (opts.hub === false) return { ...local, connected: null };
|
|
36792
|
+
const rows = await hubRunners();
|
|
36793
|
+
const row = rows?.find((r) => r.name === name) ?? null;
|
|
36794
|
+
return {
|
|
36795
|
+
...local,
|
|
36796
|
+
// A hub that knows this runner proves enrollment even when the local state file
|
|
36797
|
+
// is gone (root deleted, machine rebuilt) — so OR the two rather than trusting
|
|
36798
|
+
// disk alone.
|
|
36799
|
+
enrolled: local.enrolled || row !== null,
|
|
36800
|
+
connected: rows === null ? null : row?.connected ?? false
|
|
36801
|
+
};
|
|
36802
|
+
}
|
|
36803
|
+
async function listRunners(backend, opts = {}) {
|
|
36804
|
+
const cwd = opts.cwd ?? ambientRoot();
|
|
36805
|
+
const names = /* @__PURE__ */ new Set();
|
|
36806
|
+
if (backend !== "none") {
|
|
36807
|
+
for (const u of listRegisteredUnits("runner", backend)) names.add(u.name);
|
|
36808
|
+
}
|
|
36809
|
+
const cwdName = loadRunnerConfigFile(configPathFor(cwd)).runnerName;
|
|
36810
|
+
if (cwdName !== void 0) names.add(cwdName);
|
|
36811
|
+
const rows = await hubRunners();
|
|
36812
|
+
for (const r of rows ?? []) names.add(r.name);
|
|
36813
|
+
const runners = [];
|
|
36814
|
+
for (const name of [...names].sort((a, b) => a.localeCompare(b))) {
|
|
36815
|
+
const supervised = backend !== "none" && (0, import_node_fs8.existsSync)(unitPath("runner", name, backend));
|
|
36816
|
+
const root = supervised ? readUnitRoot("runner", name, backend) : rootClaims(cwd, name) ? cwd : null;
|
|
36817
|
+
const local = localFacts(name, root, backend, supervised);
|
|
36818
|
+
const row = rows?.find((r) => r.name === name) ?? null;
|
|
36819
|
+
runners.push({
|
|
36820
|
+
...local,
|
|
36821
|
+
enrolled: local.enrolled || row !== null,
|
|
36822
|
+
connected: rows === null ? null : row?.connected ?? false
|
|
36823
|
+
});
|
|
36824
|
+
}
|
|
36825
|
+
return { runners, hubReachable: rows !== null };
|
|
36826
|
+
}
|
|
36827
|
+
function isUnknown(facts) {
|
|
36828
|
+
return !facts.installed && !facts.supervised && !facts.enrolled;
|
|
36829
|
+
}
|
|
36830
|
+
|
|
36612
36831
|
// src/commands/runner.ts
|
|
36613
36832
|
var RUNNER_PACKAGE = servicePackage("runner");
|
|
36614
36833
|
var ENROLL_TIMEOUT_MS = 3e4;
|
|
36615
36834
|
var CONNECTED_RE = /"mode":"(enroll|hello)"/;
|
|
36616
|
-
function configPathFor(root) {
|
|
36617
|
-
return (0, import_node_path7.join)(root, "runner.config.json");
|
|
36618
|
-
}
|
|
36619
36835
|
function warnIfLoopbackHub(hubUrl) {
|
|
36620
36836
|
if (!isLoopbackRunnerUrl(hubUrl)) return;
|
|
36621
36837
|
console.log("");
|
|
@@ -36626,14 +36842,35 @@ never connect. For a hub other machines can reach, recreate it with
|
|
|
36626
36842
|
\`slay hub create <name> --public-address <host:port>\`.`
|
|
36627
36843
|
);
|
|
36628
36844
|
}
|
|
36629
|
-
|
|
36630
|
-
|
|
36631
|
-
|
|
36632
|
-
|
|
36633
|
-
|
|
36634
|
-
|
|
36845
|
+
var createRollback = [];
|
|
36846
|
+
function registerCreateRollback(undo) {
|
|
36847
|
+
createRollback.push(undo);
|
|
36848
|
+
}
|
|
36849
|
+
function runCreateRollback() {
|
|
36850
|
+
while (createRollback.length > 0) {
|
|
36851
|
+
try {
|
|
36852
|
+
createRollback.pop()?.();
|
|
36853
|
+
} catch {
|
|
36854
|
+
}
|
|
36635
36855
|
}
|
|
36636
36856
|
}
|
|
36857
|
+
async function requireKnown(name, backend) {
|
|
36858
|
+
const facts = await resolveRunner(name, backend);
|
|
36859
|
+
if (!isUnknown(facts)) return facts;
|
|
36860
|
+
const { runners } = await listRunners(backend);
|
|
36861
|
+
const known = runners.map((r) => r.name);
|
|
36862
|
+
fail(
|
|
36863
|
+
`No runner named "${name}" on this machine.
|
|
36864
|
+
` + (known.length > 0 ? `Known runners: ${known.join(", ")}` : "No runners here. Create one with `slay runner create <name> --token <token>`.")
|
|
36865
|
+
);
|
|
36866
|
+
}
|
|
36867
|
+
function requireRoot(facts, verb) {
|
|
36868
|
+
if (facts.root) return facts.root;
|
|
36869
|
+
fail(
|
|
36870
|
+
`"${facts.name}" is enrolled on the hub but has no installation on this machine, so there is nothing to ${verb}.
|
|
36871
|
+
Install it here with \`slay runner create ${facts.name} --token <token>\`, or run the command on the machine that hosts it.`
|
|
36872
|
+
);
|
|
36873
|
+
}
|
|
36637
36874
|
function requireRegistered(name, backend) {
|
|
36638
36875
|
if (backend === "none") {
|
|
36639
36876
|
fail(
|
|
@@ -36641,7 +36878,7 @@ function requireRegistered(name, backend) {
|
|
|
36641
36878
|
npx ${RUNNER_PACKAGE}`
|
|
36642
36879
|
);
|
|
36643
36880
|
}
|
|
36644
|
-
if (!(0,
|
|
36881
|
+
if (!(0, import_node_fs9.existsSync)(unitPath("runner", name, backend))) {
|
|
36645
36882
|
const known = listRegisteredUnits("runner", backend).map((u) => u.name);
|
|
36646
36883
|
fail(
|
|
36647
36884
|
`No runner named "${name}" on this machine.
|
|
@@ -36656,10 +36893,11 @@ function requireRegistered(name, backend) {
|
|
|
36656
36893
|
}
|
|
36657
36894
|
return { root };
|
|
36658
36895
|
}
|
|
36659
|
-
async function waitForConnected(root, timeoutMs) {
|
|
36896
|
+
async function waitForConnected(root, timeoutMs, backend, name) {
|
|
36897
|
+
const unit = backend === "systemd" ? systemdUnitName("runner", name) : void 0;
|
|
36660
36898
|
const deadline = Date.now() + timeoutMs;
|
|
36661
36899
|
for (; ; ) {
|
|
36662
|
-
if (CONNECTED_RE.test(readServiceLogTail("runner", root, 200))) return true;
|
|
36900
|
+
if (CONNECTED_RE.test(readServiceLogTail("runner", root, 200, unit))) return true;
|
|
36663
36901
|
if (Date.now() >= deadline) return false;
|
|
36664
36902
|
await new Promise((r) => setTimeout(r, 300));
|
|
36665
36903
|
}
|
|
@@ -36670,7 +36908,7 @@ async function launchRunner(args) {
|
|
|
36670
36908
|
const logDir = ensureLogDir("runner", root);
|
|
36671
36909
|
const logs = serviceLogPaths("runner", root);
|
|
36672
36910
|
if (backend === "none") {
|
|
36673
|
-
const out = (0,
|
|
36911
|
+
const out = (0, import_node_fs9.openSync)(logs.out, "a");
|
|
36674
36912
|
const child = (0, import_node_child_process4.spawn)(bin.command, bin.args, {
|
|
36675
36913
|
cwd: root,
|
|
36676
36914
|
detached: true,
|
|
@@ -36687,7 +36925,8 @@ async function launchRunner(args) {
|
|
|
36687
36925
|
}
|
|
36688
36926
|
});
|
|
36689
36927
|
child.unref();
|
|
36690
|
-
if (!await waitForConnected(root, ENROLL_TIMEOUT_MS)) {
|
|
36928
|
+
if (!await waitForConnected(root, ENROLL_TIMEOUT_MS, backend, name)) {
|
|
36929
|
+
if (creating) runCreateRollback();
|
|
36691
36930
|
failWithLog(
|
|
36692
36931
|
"runner",
|
|
36693
36932
|
name,
|
|
@@ -36720,7 +36959,10 @@ async function launchRunner(args) {
|
|
|
36720
36959
|
try {
|
|
36721
36960
|
supervisorStart("runner", backend, name, writtenUnitPath);
|
|
36722
36961
|
} catch (e) {
|
|
36723
|
-
if (creating)
|
|
36962
|
+
if (creating) {
|
|
36963
|
+
removeUnit("runner", name, backend);
|
|
36964
|
+
runCreateRollback();
|
|
36965
|
+
}
|
|
36724
36966
|
if (!(e instanceof SupervisorError)) throw e;
|
|
36725
36967
|
const noBus = /Failed to connect to bus|No medium found/i.test(e.output);
|
|
36726
36968
|
fail(
|
|
@@ -36736,10 +36978,11 @@ then log out and back in, and retry. If this account is not meant to have one (a
|
|
|
36736
36978
|
` : "")
|
|
36737
36979
|
);
|
|
36738
36980
|
}
|
|
36739
|
-
if (!await waitForConnected(root, ENROLL_TIMEOUT_MS)) {
|
|
36981
|
+
if (!await waitForConnected(root, ENROLL_TIMEOUT_MS, backend, name)) {
|
|
36740
36982
|
if (creating) {
|
|
36741
36983
|
supervisorStop("runner", backend, name);
|
|
36742
36984
|
removeUnit("runner", name, backend);
|
|
36985
|
+
runCreateRollback();
|
|
36743
36986
|
} else {
|
|
36744
36987
|
supervisorStop("runner", backend, name);
|
|
36745
36988
|
}
|
|
@@ -36807,69 +37050,51 @@ Run \`slay runner mint\` there, or put the hub in remote mode (\`slay hub create
|
|
|
36807
37050
|
console.log(` slay runner create ${label ?? "<name>"} --token ${minted.token}`);
|
|
36808
37051
|
warnIfLoopbackHub(minted.hubUrl);
|
|
36809
37052
|
});
|
|
36810
|
-
cmd.command("ls").description("List the runners
|
|
36811
|
-
const backend =
|
|
36812
|
-
|
|
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
|
-
});
|
|
37053
|
+
cmd.command("ls").description("List the runners this machine knows about").option("--json", "Output as JSON").action(async (opts) => {
|
|
37054
|
+
const backend = resolveBackend();
|
|
37055
|
+
const { runners, hubReachable } = await listRunners(backend);
|
|
36840
37056
|
if (opts.json) {
|
|
36841
|
-
console.log(JSON.stringify(
|
|
37057
|
+
console.log(JSON.stringify(runners, null, 2));
|
|
36842
37058
|
return;
|
|
36843
37059
|
}
|
|
36844
|
-
if (
|
|
36845
|
-
console.log(
|
|
36846
|
-
|
|
36847
|
-
|
|
37060
|
+
if (runners.length === 0) {
|
|
37061
|
+
console.log("No runners here. Create one with `slay runner create <name> --token <token>`.");
|
|
37062
|
+
if (backend === "none") console.log(`
|
|
37063
|
+
${explainNoBackend(detectBackendWithReason().reason)}`);
|
|
36848
37064
|
return;
|
|
36849
37065
|
}
|
|
36850
|
-
const
|
|
36851
|
-
|
|
36852
|
-
|
|
37066
|
+
const state = (r) => {
|
|
37067
|
+
if (r.running) return "running";
|
|
37068
|
+
if (r.supervised) return "stopped";
|
|
37069
|
+
return "unmanaged";
|
|
37070
|
+
};
|
|
37071
|
+
const enrolled = (r) => !hubReachable && !r.enrolled ? "?" : r.enrolled ? "yes" : "no";
|
|
37072
|
+
const nameW = Math.max(4, ...runners.map((r) => r.name.length));
|
|
37073
|
+
const rootW = Math.max(4, ...runners.map((r) => r.root ? shortenPath(r.root).length : 1));
|
|
37074
|
+
const hubW = Math.max(3, ...runners.map((r) => (r.hubUrl ?? "-").length));
|
|
36853
37075
|
console.log(
|
|
36854
|
-
`${"NAME".padEnd(nameW)} ${"STATE".padEnd(
|
|
37076
|
+
`${"NAME".padEnd(nameW)} ${"STATE".padEnd(9)} ${"ROOT".padEnd(rootW)} ${"HUB".padEnd(hubW)} ENROLLED`
|
|
36855
37077
|
);
|
|
36856
37078
|
console.log(
|
|
36857
|
-
`${"-".repeat(nameW)} ${"-".repeat(
|
|
37079
|
+
`${"-".repeat(nameW)} ${"-".repeat(9)} ${"-".repeat(rootW)} ${"-".repeat(hubW)} ${"-".repeat(8)}`
|
|
36858
37080
|
);
|
|
36859
|
-
for (const r of
|
|
37081
|
+
for (const r of runners) {
|
|
36860
37082
|
console.log(
|
|
36861
|
-
`${r.name.padEnd(nameW)} ${(r
|
|
37083
|
+
`${r.name.padEnd(nameW)} ${state(r).padEnd(9)} ${(r.root ? shortenPath(r.root) : "?").padEnd(rootW)} ${(r.hubUrl ?? "-").padEnd(hubW)} ${enrolled(r)}`
|
|
36862
37084
|
);
|
|
36863
37085
|
}
|
|
36864
|
-
|
|
37086
|
+
if (!hubReachable && runners.some((r) => enrolled(r) === "?")) {
|
|
36865
37087
|
console.log(
|
|
36866
37088
|
`
|
|
36867
|
-
|
|
37089
|
+
No hub could be reached, so ENROLLED is "?" for runners with no local credentials \u2014 they may or may not be enrolled.`
|
|
36868
37090
|
);
|
|
36869
37091
|
}
|
|
36870
|
-
|
|
36871
|
-
|
|
36872
|
-
|
|
37092
|
+
const unmanaged = runners.filter((r) => state(r) === "unmanaged");
|
|
37093
|
+
if (unmanaged.length > 0 && backend !== "none") {
|
|
37094
|
+
console.log(
|
|
37095
|
+
`
|
|
37096
|
+
${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"}.`
|
|
37097
|
+
);
|
|
36873
37098
|
}
|
|
36874
37099
|
});
|
|
36875
37100
|
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 +37102,7 @@ Runner "${r.name}" is stopped. Start it: slay runner start ${r.name}`);
|
|
|
36877
37102
|
"Filesystem root the runner may operate under (repeatable; default: the runner root)",
|
|
36878
37103
|
(value, previous = []) => [...previous, value]
|
|
36879
37104
|
).action(async (name, opts) => {
|
|
36880
|
-
const root = (0,
|
|
37105
|
+
const root = (0, import_node_path9.resolve)(opts.root ?? process.cwd());
|
|
36881
37106
|
const backend = resolveBackend();
|
|
36882
37107
|
const decoded = decodeJoinToken(opts.token);
|
|
36883
37108
|
if (!decoded) {
|
|
@@ -36893,7 +37118,7 @@ Mint one on the hub:
|
|
|
36893
37118
|
`"${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
37119
|
);
|
|
36895
37120
|
}
|
|
36896
|
-
if (backend !== "none" && (0,
|
|
37121
|
+
if (backend !== "none" && (0, import_node_fs9.existsSync)(unitPath("runner", name, backend))) {
|
|
36897
37122
|
const existingRoot = readUnitRoot("runner", name, backend);
|
|
36898
37123
|
fail(
|
|
36899
37124
|
`A runner named "${name}" already exists${existingRoot ? ` (root ${shortenPath(existingRoot)})` : ""}.
|
|
@@ -36901,13 +37126,28 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
|
|
|
36901
37126
|
);
|
|
36902
37127
|
}
|
|
36903
37128
|
const occupant = loadRunnerConfigFile(configPathFor(root)).runnerName;
|
|
36904
|
-
if (occupant !== void 0) {
|
|
37129
|
+
if (occupant !== void 0 && occupant !== name) {
|
|
36905
37130
|
fail(
|
|
36906
37131
|
`A runner is already installed in ${shortenPath(root)} \u2014 "${occupant}".
|
|
36907
|
-
|
|
37132
|
+
Give this runner its own directory with \`--root <dir>\`, or remove "${occupant}" first with \`slay runner rm ${occupant}\`.`
|
|
36908
37133
|
);
|
|
36909
37134
|
}
|
|
36910
|
-
const
|
|
37135
|
+
const adopting = occupant === name && backend !== "none";
|
|
37136
|
+
if (occupant === name && !adopting) {
|
|
37137
|
+
fail(
|
|
37138
|
+
`A runner is already installed in ${shortenPath(root)} \u2014 "${occupant}".
|
|
37139
|
+
Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm ${name}\`.`
|
|
37140
|
+
);
|
|
37141
|
+
}
|
|
37142
|
+
if (adopting) {
|
|
37143
|
+
console.log(
|
|
37144
|
+
`Adopting the runner already in ${shortenPath(root)} \u2014 it is installed but not registered with ${backend}. Its config will be refreshed with this token.`
|
|
37145
|
+
);
|
|
37146
|
+
console.log(
|
|
37147
|
+
` If you started it in the foreground, stop that process first \u2014 otherwise two runners would share this root.`
|
|
37148
|
+
);
|
|
37149
|
+
}
|
|
37150
|
+
const allowedRoots = opts.allow && opts.allow.length > 0 ? opts.allow.map((d) => (0, import_node_path9.resolve)(d)) : [root];
|
|
36911
37151
|
updateRunnerConfigFile(
|
|
36912
37152
|
{
|
|
36913
37153
|
joinToken: opts.token,
|
|
@@ -36917,27 +37157,42 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
|
|
|
36917
37157
|
},
|
|
36918
37158
|
configPathFor(root)
|
|
36919
37159
|
);
|
|
37160
|
+
if (!adopting) {
|
|
37161
|
+
registerCreateRollback(() => {
|
|
37162
|
+
(0, import_node_fs9.rmSync)(configPathFor(root), { force: true });
|
|
37163
|
+
});
|
|
37164
|
+
}
|
|
36920
37165
|
console.log(`Hub: ${decoded.hubUrl}`);
|
|
36921
37166
|
console.log(`Allow: ${allowedRoots.map((d) => shortenPath(d)).join(", ")}`);
|
|
36922
37167
|
warnIfLoopbackHub(decoded.hubUrl);
|
|
36923
37168
|
await launchRunner({ name, root, backend, creating: true });
|
|
36924
37169
|
});
|
|
36925
|
-
cmd.command("start <name>").description("Start
|
|
37170
|
+
cmd.command("start <name>").description("Start a runner, registering it first if it is not yet supervised").action(async (name) => {
|
|
36926
37171
|
const backend = resolveBackend();
|
|
36927
|
-
const
|
|
36928
|
-
if (
|
|
37172
|
+
const facts = await requireKnown(name, backend);
|
|
37173
|
+
if (facts.running) {
|
|
36929
37174
|
const status = supervisorStatus("runner", backend, name);
|
|
36930
37175
|
console.log(
|
|
36931
37176
|
`Runner "${name}" is already running${status.pid ? ` (pid ${status.pid})` : ""}.`
|
|
36932
37177
|
);
|
|
36933
37178
|
return;
|
|
36934
37179
|
}
|
|
37180
|
+
const root = requireRoot(facts, "start");
|
|
37181
|
+
if (!facts.supervised && backend !== "none") {
|
|
37182
|
+
console.log(`"${name}" is installed but not registered with ${backend} \u2014 registering it.`);
|
|
37183
|
+
}
|
|
36935
37184
|
await launchRunner({ name, root, backend, creating: false });
|
|
36936
37185
|
});
|
|
36937
37186
|
cmd.command("stop <name>").description("Stop a runner, keeping it registered so `start` can bring it back").action(async (name) => {
|
|
36938
37187
|
const backend = resolveBackend();
|
|
36939
|
-
|
|
37188
|
+
const facts = await requireKnown(name, backend);
|
|
36940
37189
|
if (backend === "none") return;
|
|
37190
|
+
if (!facts.supervised) {
|
|
37191
|
+
console.log(
|
|
37192
|
+
`"${name}" is not registered with ${backend}, so there is nothing for it to stop.`
|
|
37193
|
+
);
|
|
37194
|
+
return;
|
|
37195
|
+
}
|
|
36941
37196
|
supervisorStop("runner", backend, name);
|
|
36942
37197
|
if (!await waitForStopped(name, backend, 15e3)) {
|
|
36943
37198
|
fail(
|
|
@@ -36946,18 +37201,33 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
|
|
|
36946
37201
|
}
|
|
36947
37202
|
console.log(`Stopped "${name}". Start it again with \`slay runner start ${name}\`.`);
|
|
36948
37203
|
});
|
|
36949
|
-
cmd.command("rm <name>").description("Stop a runner and remove its registration").
|
|
37204
|
+
cmd.command("rm <name>").description("Stop a runner and remove its registration").option(
|
|
37205
|
+
"--purge",
|
|
37206
|
+
"Also delete the runner root (config, credentials, logs) \u2014 this is the operator\u2019s data"
|
|
37207
|
+
).action(async (name, opts) => {
|
|
36950
37208
|
const backend = resolveBackend();
|
|
36951
|
-
const
|
|
36952
|
-
if (backend
|
|
36953
|
-
|
|
36954
|
-
|
|
36955
|
-
|
|
36956
|
-
|
|
36957
|
-
|
|
36958
|
-
|
|
36959
|
-
|
|
36960
|
-
|
|
37209
|
+
const facts = await requireKnown(name, backend);
|
|
37210
|
+
if (facts.supervised && backend !== "none") {
|
|
37211
|
+
supervisorStopQuiet("runner", backend, name);
|
|
37212
|
+
removeUnit("runner", name, backend);
|
|
37213
|
+
console.log(`Unregistered "${name}" from ${backend}.`);
|
|
37214
|
+
} else if (backend !== "none") {
|
|
37215
|
+
console.log(`"${name}" had no ${backend} registration.`);
|
|
37216
|
+
}
|
|
37217
|
+
if (facts.root && facts.installed) {
|
|
37218
|
+
if (opts.purge) {
|
|
37219
|
+
(0, import_node_fs9.rmSync)(facts.root, { recursive: true, force: true });
|
|
37220
|
+
console.log(`Deleted ${shortenPath(facts.root)}.`);
|
|
37221
|
+
} else {
|
|
37222
|
+
console.log(`Config and credentials remain in ${shortenPath(facts.root)}.`);
|
|
37223
|
+
console.log(` Delete them too with \`slay runner rm ${name} --purge\`.`);
|
|
37224
|
+
}
|
|
37225
|
+
}
|
|
37226
|
+
if (facts.enrolled) {
|
|
37227
|
+
console.log(
|
|
37228
|
+
`It is still enrolled on its hub \u2014 revoke it there if this machine is going away.`
|
|
37229
|
+
);
|
|
37230
|
+
}
|
|
36961
37231
|
});
|
|
36962
37232
|
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
37233
|
const backend = resolveBackend();
|
|
@@ -36985,7 +37255,7 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
|
|
|
36985
37255
|
supervisorStop("runner", backend, name);
|
|
36986
37256
|
await waitForStopped(name, backend, 15e3);
|
|
36987
37257
|
supervisorStart("runner", backend, name, unitPath("runner", name, backend));
|
|
36988
|
-
if (!await waitForConnected(root, ENROLL_TIMEOUT_MS)) {
|
|
37258
|
+
if (!await waitForConnected(root, ENROLL_TIMEOUT_MS, backend, name)) {
|
|
36989
37259
|
fail(
|
|
36990
37260
|
`Runner "${name}" did not reconnect within ${ENROLL_TIMEOUT_MS / 1e3}s. Check \`slay runner logs ${name}\`.`
|
|
36991
37261
|
);
|
|
@@ -36995,9 +37265,10 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
|
|
|
36995
37265
|
`Runner "${name}" restarted${status.pid ? ` (pid ${status.pid})` : ""} and reconnected.`
|
|
36996
37266
|
);
|
|
36997
37267
|
});
|
|
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 =
|
|
37000
|
-
const
|
|
37268
|
+
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) => {
|
|
37269
|
+
const backend = resolveBackend();
|
|
37270
|
+
const facts = await requireKnown(name, backend);
|
|
37271
|
+
const root = requireRoot(facts, "read logs for");
|
|
37001
37272
|
const lines = Number(opts.lines);
|
|
37002
37273
|
if (!Number.isInteger(lines) || lines < 1) fail(`Invalid --lines ${opts.lines}.`);
|
|
37003
37274
|
followServiceLog({
|
|
@@ -37006,7 +37277,7 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
|
|
|
37006
37277
|
root,
|
|
37007
37278
|
lines,
|
|
37008
37279
|
follow: opts.follow === true,
|
|
37009
|
-
systemdUnit: backend === "systemd" && (0,
|
|
37280
|
+
systemdUnit: backend === "systemd" && (0, import_node_fs9.existsSync)(unitPath("runner", name, backend))
|
|
37010
37281
|
});
|
|
37011
37282
|
});
|
|
37012
37283
|
return cmd;
|
|
@@ -37014,9 +37285,9 @@ Start it with \`slay runner start ${name}\`, or remove it with \`slay runner rm
|
|
|
37014
37285
|
|
|
37015
37286
|
// src/commands/update.ts
|
|
37016
37287
|
var import_node_child_process5 = require("node:child_process");
|
|
37017
|
-
var
|
|
37288
|
+
var import_node_fs10 = require("node:fs");
|
|
37018
37289
|
var import_node_os2 = require("node:os");
|
|
37019
|
-
var
|
|
37290
|
+
var import_node_path10 = require("node:path");
|
|
37020
37291
|
var PACKAGE_NAMES = ["@slayzone/cli", "@slayzone/runner", "@slayzone/hub"];
|
|
37021
37292
|
var KIND_FOR_PACKAGE = {
|
|
37022
37293
|
"@slayzone/hub": "hub",
|
|
@@ -37030,9 +37301,9 @@ function runCapture(bin, args) {
|
|
|
37030
37301
|
}
|
|
37031
37302
|
}
|
|
37032
37303
|
function bunGlobalRoot() {
|
|
37033
|
-
const base = process.env.BUN_INSTALL || (0,
|
|
37034
|
-
const dir = (0,
|
|
37035
|
-
return (0,
|
|
37304
|
+
const base = process.env.BUN_INSTALL || (0, import_node_path10.join)((0, import_node_os2.homedir)(), ".bun");
|
|
37305
|
+
const dir = (0, import_node_path10.join)(base, "install", "global", "node_modules");
|
|
37306
|
+
return (0, import_node_fs10.existsSync)(dir) ? dir : null;
|
|
37036
37307
|
}
|
|
37037
37308
|
var MANAGERS = [
|
|
37038
37309
|
{
|
|
@@ -37072,10 +37343,10 @@ var MANAGERS = [
|
|
|
37072
37343
|
}
|
|
37073
37344
|
];
|
|
37074
37345
|
function readInstalledVersion(globalRoot, pkg) {
|
|
37075
|
-
const pkgJsonPath = (0,
|
|
37076
|
-
if (!(0,
|
|
37346
|
+
const pkgJsonPath = (0, import_node_path10.join)(globalRoot, ...pkg.split("/"), "package.json");
|
|
37347
|
+
if (!(0, import_node_fs10.existsSync)(pkgJsonPath)) return null;
|
|
37077
37348
|
try {
|
|
37078
|
-
const parsed = JSON.parse((0,
|
|
37349
|
+
const parsed = JSON.parse((0, import_node_fs10.readFileSync)(pkgJsonPath, "utf8"));
|
|
37079
37350
|
return typeof parsed.version === "string" ? parsed.version : null;
|
|
37080
37351
|
} catch {
|
|
37081
37352
|
return null;
|
|
@@ -37108,14 +37379,18 @@ function printRestartHints(updatedPackages) {
|
|
|
37108
37379
|
for (const hint of hints) console.log(hint);
|
|
37109
37380
|
}
|
|
37110
37381
|
function updateCommand() {
|
|
37111
|
-
const cmd = new Command("update").description(
|
|
37382
|
+
const cmd = new Command("update").description(
|
|
37383
|
+
"Update globally installed @slayzone packages (cli, hub, runner) \u2014 npm, pnpm, or bun"
|
|
37384
|
+
).option("--check", "Report available updates without installing anything").action((opts) => {
|
|
37112
37385
|
const roots = /* @__PURE__ */ new Map();
|
|
37113
37386
|
for (const mgr of MANAGERS) {
|
|
37114
37387
|
const root = mgr.globalRoot();
|
|
37115
37388
|
if (root) roots.set(mgr.id, root);
|
|
37116
37389
|
}
|
|
37117
37390
|
if (roots.size === 0) {
|
|
37118
|
-
fail(
|
|
37391
|
+
fail(
|
|
37392
|
+
"Could not resolve a global install root for npm, pnpm, or bun. Is at least one on PATH?"
|
|
37393
|
+
);
|
|
37119
37394
|
}
|
|
37120
37395
|
const found = [];
|
|
37121
37396
|
for (const [manager, root] of roots) {
|
|
@@ -37175,7 +37450,9 @@ function updateCommand() {
|
|
|
37175
37450
|
} catch {
|
|
37176
37451
|
fail(
|
|
37177
37452
|
`${mgr.bin} install failed. Install the packages yourself and retry:
|
|
37178
|
-
` + names.map(
|
|
37453
|
+
` + names.map(
|
|
37454
|
+
(n) => ` ${mgr.bin} ${mgr.id === "npm" ? "install" : "add"} -g ${n}@${target}`
|
|
37455
|
+
).join("\n")
|
|
37179
37456
|
);
|
|
37180
37457
|
}
|
|
37181
37458
|
}
|
|
@@ -37185,7 +37462,7 @@ function updateCommand() {
|
|
|
37185
37462
|
}
|
|
37186
37463
|
|
|
37187
37464
|
// src/index.ts
|
|
37188
|
-
var program2 = new Command().name("slay").description("SlayZone CLI").version("0.36.0-beta.
|
|
37465
|
+
var program2 = new Command().name("slay").description("SlayZone CLI").version("0.36.0-beta.17").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
37466
|
const root = thisCommand.parent ?? thisCommand;
|
|
37190
37467
|
const opts = root.opts();
|
|
37191
37468
|
if (opts.dev) process.env.SLAYZONE_DEV = "1";
|