bdy 1.26.6-dev → 1.26.8-dev

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.26.6-dev",
4
+ "version": "1.26.8-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",
@@ -53,7 +53,7 @@
53
53
  "tweetnacl"
54
54
  ],
55
55
  "dependencies": {
56
- "@buddy-works/ci-info": "1.1.7",
56
+ "@buddy-works/ci-info": "1.1.8",
57
57
  "@buddy-works/docs-schema": "0.1.4",
58
58
  "@fastify/accept-negotiator": "2.0.1",
59
59
  "@fastify/cors": "11.2.0",
@@ -69,7 +69,7 @@
69
69
  "commander": "15.0.0",
70
70
  "content-disposition": "2.0.1",
71
71
  "cookie": "1.1.1",
72
- "cross-spawn": "7.0.6",
72
+ "cross-spawn": "7.1.2",
73
73
  "dotenv": "17.4.2",
74
74
  "eventsource": "4.1.0",
75
75
  "fastify": "5.12.7",
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = cliIndex;
7
7
  const output_1 = __importDefault(require("./output"));
8
8
  const agent_1 = __importDefault(require("./command/agent"));
9
+ const fuse_1 = __importDefault(require("./command/fuse"));
9
10
  const version_1 = __importDefault(require("./command/version"));
10
11
  const pre_1 = __importDefault(require("./command/pre"));
11
12
  const utils_1 = require("./utils");
@@ -49,9 +50,7 @@ function cliIndex() {
49
50
  : options);
50
51
  });
51
52
  program.hook('preAction', pre_1.default);
52
- program.configureHelp({
53
- formatHelp: utils_1.formatHelp,
54
- });
53
+ program.configureHelp(utils_1.helpConfiguration);
55
54
  // root options must come before the subcommand, so -v here can't
56
55
  // shadow subcommand flags like `sandbox create -v <variable>`
57
56
  program.enablePositionalOptions();
@@ -59,6 +58,8 @@ function cliIndex() {
59
58
  program.addCommand(tunnel_1.default);
60
59
  if (!(0, utils_1.isDocker)())
61
60
  program.addCommand(agent_1.default);
61
+ if (!(0, utils_1.isDocker)())
62
+ program.addCommand(fuse_1.default);
62
63
  program.addCommand(version_1.default);
63
64
  program.addCommand(crawl_1.default);
64
65
  program.addCommand(tests_1.default);
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_path_1 = __importDefault(require("node:path"));
7
+ const output_1 = __importDefault(require("../../output"));
8
+ const cliError_1 = __importDefault(require("../../cliError"));
9
+ const utils_1 = require("../../utils");
10
+ const texts_1 = require("../../texts");
11
+ const release_1 = require("./release");
12
+ // bdy-fuse install's flags passed on as given (commander option -> its flag); the ones not given
13
+ // keep bdy-fuse's defaults. --dir is passed always (absolute), --env is bdy's own environment.
14
+ // Its flags for development and tests (--pin, --update-at, --download-url, --sentry-dsn) are not
15
+ // here: bdy installs the newest release of its environment, updated by the daemon every day.
16
+ const PASSED = [
17
+ ['maxDirty', 'max-dirty'],
18
+ ['uploadRate', 'upload-rate'],
19
+ ['cacheMax', 'cache-max'],
20
+ ['minFree', 'min-free'],
21
+ ];
22
+ const commandFuseInstall = (0, utils_1.newCommand)('install', texts_1.DESC_COMMAND_FUSE_INSTALL, {
23
+ requiredScopes: [],
24
+ examples: texts_1.EXAMPLE_FUSE_INSTALL,
25
+ helpText: texts_1.HELP_FUSE_INSTALL,
26
+ });
27
+ commandFuseInstall.option('--dir <dir>', texts_1.OPTION_FUSE_DIR);
28
+ commandFuseInstall.option('--max-dirty <size>', texts_1.OPTION_FUSE_MAX_DIRTY);
29
+ commandFuseInstall.option('--upload-rate <size>', texts_1.OPTION_FUSE_UPLOAD_RATE);
30
+ commandFuseInstall.option('--cache-max <size>', texts_1.OPTION_FUSE_CACHE_MAX);
31
+ commandFuseInstall.option('--min-free <size>', texts_1.OPTION_FUSE_MIN_FREE);
32
+ commandFuseInstall.option('--format <text|json>', texts_1.OPTION_FORMAT);
33
+ commandFuseInstall.action(async (options) => {
34
+ const json = options.format === 'json';
35
+ const env = (0, utils_1.getVersionEnv)();
36
+ const dir = node_path_1.default.resolve(options.dir || release_1.FUSE_DEFAULT_DIR);
37
+ const bin = node_path_1.default.join(dir, 'bin', 'bdy-fuse');
38
+ const say = output_1.default.progress(json);
39
+ try {
40
+ (0, release_1.checkFuseHost)();
41
+ // Only on a host without the service. An install over it would take its directory and
42
+ // options from these flags alone: one without --dir would move the service to the default
43
+ // directory, away from its attaches and changes, and the options not given would fall back
44
+ // to the defaults. bdy fuse update upgrades it; its options are changed in its unit.
45
+ const installed = (0, release_1.readFuseUnit)();
46
+ if (installed?.broken) {
47
+ throw new cliError_1.default('usage_error', (0, texts_1.ERR_FUSE_BROKEN)(installed.bin ?? release_1.FUSE_UNIT));
48
+ }
49
+ if (installed) {
50
+ throw new cliError_1.default('usage_error', (0, texts_1.ERR_FUSE_INSTALLED)(installed.dir));
51
+ }
52
+ // a binary left in the directory (an install cut short) is replaced
53
+ const version = await (0, release_1.fetchFuseLatest)(env);
54
+ say((0, texts_1.TXT_FUSE_DOWNLOADING)(env, version));
55
+ const data = await (0, release_1.downloadFuse)(env, version);
56
+ (0, release_1.placeFuseBinary)(bin, data, env);
57
+ say((0, texts_1.TXT_FUSE_DOWNLOADED)(bin));
58
+ const args = ['install', `--env=${env}`, `--dir=${dir}`];
59
+ for (const [option, flag] of PASSED) {
60
+ if (options[option] !== undefined)
61
+ args.push(`--${flag}=${options[option]}`);
62
+ }
63
+ const output = await (0, release_1.runFuse)(bin, args, json);
64
+ if (json) {
65
+ output_1.default.json({ ...(0, release_1.fuseBinaryVersion)(bin), binary: bin, output: output.trim().split('\n') });
66
+ }
67
+ output_1.default.exitNormal();
68
+ }
69
+ catch (err) {
70
+ output_1.default.exitError(err);
71
+ }
72
+ });
73
+ exports.default = commandFuseInstall;
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fuseBusy = exports.runFuse = exports.findFuseBinary = exports.downloadTempFuse = exports.readFuseUnit = exports.splitFuseExec = exports.FUSE_PATH_LINK = exports.FUSE_UNIT = exports.placeFuseBinary = exports.fuseBinaryVersion = exports.downloadFuse = exports.fetchFuseLatest = exports.fuseSumOf = exports.verifyFuseSums = exports.fuseSignedMessage = exports.fuseUrl = exports.checkFuseHost = exports.checkFuseRoot = exports.isKernelSupported = exports.kernelVersion = exports.fusePackageName = exports.FUSE_DEFAULT_DIR = exports.FUSE_MIN_KERNEL = exports.FUSE_PUBLIC_KEYS = exports.FUSE_DOWNLOAD_URL = void 0;
7
+ const node_crypto_1 = require("node:crypto");
8
+ const node_child_process_1 = require("node:child_process");
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_os_1 = __importDefault(require("node:os"));
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const cliError_1 = __importDefault(require("../../cliError"));
13
+ const texts_1 = require("../../texts");
14
+ // The releases of bdy-fuse (the bdy-fuse repo, internal/release): per environment and version on
15
+ // ES, bdy-fuse-linux-<amd64|arm64>, SHA256SUMS and its ed25519 signature SHA256SUMS.sig; the
16
+ // version "latest" holds only VERSION, the newest one.
17
+ exports.FUSE_DOWNLOAD_URL = 'https://es.buddy.works/bdy/fuse/${env}/${version}/${packageName}';
18
+ // The keys a release may be signed with: a copy of release.PublicKeys of bdy-fuse. bdy runs the
19
+ // downloaded binary as root, so it checks the signature the way bdy-fuse does, with keys of its
20
+ // own - never with anything from ES. A new key has to come here before releases are signed with it.
21
+ exports.FUSE_PUBLIC_KEYS = [
22
+ // 2026-11-27
23
+ 'J4SIM/cEV8mkF/xd+ljTrUwENXEGX071PN+alNeIc5U=',
24
+ ];
25
+ // what install of bdy-fuse requires too (its doctor tells the rest)
26
+ exports.FUSE_MIN_KERNEL = [6, 12];
27
+ exports.FUSE_DEFAULT_DIR = '/var/lib/bdy-fuse';
28
+ const DOWNLOAD_TIMEOUT = 5 * 60 * 1000;
29
+ // the binary is tens of MB; anything far larger is not it (downloadMax of bdy-fuse)
30
+ const DOWNLOAD_MAX = 256 * 1024 * 1024;
31
+ const fusePackageName = (arch = process.arch) => {
32
+ if (arch === 'x64')
33
+ return 'bdy-fuse-linux-amd64';
34
+ if (arch === 'arm64')
35
+ return 'bdy-fuse-linux-arm64';
36
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_ARCH)(arch));
37
+ };
38
+ exports.fusePackageName = fusePackageName;
39
+ // [major, minor] of a kernel release (6.12.0-1-amd64), or null
40
+ const kernelVersion = (release) => {
41
+ const m = /^(\d+)\.(\d+)/.exec(release);
42
+ return m ? [Number(m[1]), Number(m[2])] : null;
43
+ };
44
+ exports.kernelVersion = kernelVersion;
45
+ const isKernelSupported = (release) => {
46
+ const v = (0, exports.kernelVersion)(release);
47
+ if (!v)
48
+ return false;
49
+ const [major, minor] = exports.FUSE_MIN_KERNEL;
50
+ return v[0] > major || (v[0] === major && v[1] >= minor);
51
+ };
52
+ exports.isKernelSupported = isKernelSupported;
53
+ // Every command of bdy fuse: Linux, as root (the service, its directory).
54
+ const checkFuseRoot = (command) => {
55
+ if (process.platform !== 'linux') {
56
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_NOT_LINUX)(process.platform));
57
+ }
58
+ if (!process.getuid || process.getuid() !== 0) {
59
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_ROOT)(command));
60
+ }
61
+ };
62
+ exports.checkFuseRoot = checkFuseRoot;
63
+ // Refuses a host bdy-fuse cannot run on, before anything is downloaded.
64
+ const checkFuseHost = () => {
65
+ (0, exports.checkFuseRoot)('install');
66
+ (0, exports.fusePackageName)();
67
+ try {
68
+ (0, node_child_process_1.execFileSync)('systemctl', ['--version'], { stdio: 'ignore' });
69
+ }
70
+ catch {
71
+ throw new cliError_1.default('command_failed', texts_1.ERR_FUSE_SYSTEMD);
72
+ }
73
+ if (!(0, exports.isKernelSupported)(node_os_1.default.release())) {
74
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_KERNEL)(node_os_1.default.release()));
75
+ }
76
+ // opened, not only looked at, like bdy-fuse doctor: the node can be there while the device is
77
+ // not usable (a container without --device /dev/fuse, a kernel without FUSE)
78
+ let fuse = false;
79
+ try {
80
+ if (node_fs_1.default.statSync('/dev/fuse').isCharacterDevice()) {
81
+ node_fs_1.default.closeSync(node_fs_1.default.openSync('/dev/fuse', 'r+'));
82
+ fuse = true;
83
+ }
84
+ }
85
+ catch {
86
+ // reported below
87
+ }
88
+ if (!fuse)
89
+ throw new cliError_1.default('command_failed', texts_1.ERR_FUSE_DEVICE);
90
+ };
91
+ exports.checkFuseHost = checkFuseHost;
92
+ const fuseUrl = (env, version, name) => exports.FUSE_DOWNLOAD_URL
93
+ .replaceAll('${env}', encodeURIComponent(env))
94
+ .replaceAll('${version}', encodeURIComponent(version))
95
+ .replaceAll('${packageName}', encodeURIComponent(name));
96
+ exports.fuseUrl = fuseUrl;
97
+ // What the pipeline signs: a line naming the environment and the version, then SHA256SUMS
98
+ // (release.Message of bdy-fuse), so a signature of one version is not taken for another.
99
+ const fuseSignedMessage = (env, version, sums) => Buffer.concat([Buffer.from(`bdy-fuse ${env} ${version}\n`), sums]);
100
+ exports.fuseSignedMessage = fuseSignedMessage;
101
+ const verifyFuseSums = (env, version, sums, sig, keys = exports.FUSE_PUBLIC_KEYS) => {
102
+ const s = Buffer.from(sig.toString().trim(), 'base64');
103
+ if (s.length !== 64)
104
+ return false;
105
+ const msg = (0, exports.fuseSignedMessage)(env, version, sums);
106
+ return keys.some((k) => {
107
+ const raw = Buffer.from(k, 'base64');
108
+ if (raw.length !== 32)
109
+ return false;
110
+ const key = (0, node_crypto_1.createPublicKey)({
111
+ key: { kty: 'OKP', crv: 'Ed25519', x: raw.toString('base64url') },
112
+ format: 'jwk',
113
+ });
114
+ return (0, node_crypto_1.verify)(null, msg, key, s);
115
+ });
116
+ };
117
+ exports.verifyFuseSums = verifyFuseSums;
118
+ // name's checksum in sha256sum's output
119
+ const fuseSumOf = (sums, name) => {
120
+ for (const line of sums.toString().split('\n')) {
121
+ const f = line.trim().split(/\s+/);
122
+ if (f.length === 2 && f[1].replace(/^\*/, '') === name) {
123
+ return f[0].toLowerCase();
124
+ }
125
+ }
126
+ return null;
127
+ };
128
+ exports.fuseSumOf = fuseSumOf;
129
+ // The file at url, read whole within the timeout (the body too: a connection that breaks or
130
+ // stalls halfway fails here with the URL), and at most DOWNLOAD_MAX bytes of it.
131
+ const fetchFile = async (url) => {
132
+ const fail = (reason) => new cliError_1.default('connection_error', (0, texts_1.ERR_FUSE_DOWNLOAD)(url, reason));
133
+ try {
134
+ const response = await require('undici').fetch(url, {
135
+ signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT),
136
+ });
137
+ if (response.status !== 200)
138
+ throw fail(`${response.status}`);
139
+ const chunks = [];
140
+ let size = 0;
141
+ for await (const chunk of response.body ?? []) {
142
+ size += chunk.length;
143
+ if (size > DOWNLOAD_MAX)
144
+ throw fail(`larger than ${DOWNLOAD_MAX} bytes`);
145
+ chunks.push(Buffer.from(chunk));
146
+ }
147
+ return Buffer.concat(chunks);
148
+ }
149
+ catch (err) {
150
+ if (err instanceof cliError_1.default)
151
+ throw err;
152
+ throw fail(String(err));
153
+ }
154
+ };
155
+ const fetchFuseLatest = async (env) => {
156
+ const url = (0, exports.fuseUrl)(env, 'latest', 'VERSION');
157
+ const version = (await fetchFile(url)).toString().trim();
158
+ if (!/^\d+\.\d+\.\d+$/.test(version)) {
159
+ throw new cliError_1.default('connection_error', (0, texts_1.ERR_FUSE_DOWNLOAD)(url, `not a version: ${version}`));
160
+ }
161
+ return version;
162
+ };
163
+ exports.fetchFuseLatest = fetchFuseLatest;
164
+ // The binary of the version for this host: SHA256SUMS checked against its signature first, then
165
+ // the binary against its sum.
166
+ const downloadFuse = async (env, version) => {
167
+ const name = (0, exports.fusePackageName)();
168
+ const sums = await fetchFile((0, exports.fuseUrl)(env, version, 'SHA256SUMS'));
169
+ const sig = await fetchFile((0, exports.fuseUrl)(env, version, 'SHA256SUMS.sig'));
170
+ if (!(0, exports.verifyFuseSums)(env, version, sums, sig)) {
171
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_SIGNATURE)(env, version));
172
+ }
173
+ const want = (0, exports.fuseSumOf)(sums, name);
174
+ if (!want)
175
+ throw new cliError_1.default('not_found', (0, texts_1.ERR_FUSE_NO_PACKAGE)(env, version, name));
176
+ const data = await fetchFile((0, exports.fuseUrl)(env, version, name));
177
+ if ((0, node_crypto_1.createHash)('sha256').update(data).digest('hex') !== want) {
178
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_CHECKSUM)(name));
179
+ }
180
+ return data;
181
+ };
182
+ exports.downloadFuse = downloadFuse;
183
+ // What bdy-fuse version says of itself: { version, env }. The socket that is not there keeps it
184
+ // from asking a running daemon.
185
+ const fuseBinaryVersion = (bin) => {
186
+ let out;
187
+ try {
188
+ out = (0, node_child_process_1.execFileSync)(bin, ['version', '--socket=/nonexistent'], {
189
+ timeout: 30000,
190
+ stdio: ['ignore', 'pipe', 'pipe'],
191
+ }).toString();
192
+ }
193
+ catch (err) {
194
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_BINARY)(String(err)));
195
+ }
196
+ // bdy-fuse 1.1.0 prod (go1.25.4 linux/amd64)
197
+ const f = out.split('\n')[0].trim().split(/\s+/);
198
+ if (f.length < 3 || f[0] !== 'bdy-fuse') {
199
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_BINARY)(out.trim()));
200
+ }
201
+ return { version: f[1], env: f[2] };
202
+ };
203
+ exports.fuseBinaryVersion = fuseBinaryVersion;
204
+ // Puts the binary at bin: written aside, synced, run there (it has to run on this host and be of
205
+ // env), then moved in. Aside in the same directory, not in /tmp, which may be mounted noexec.
206
+ const placeFuseBinary = (bin, data, env) => {
207
+ node_fs_1.default.mkdirSync(node_path_1.default.dirname(bin), { recursive: true, mode: 0o755 });
208
+ const tmp = `${bin}.download`;
209
+ try {
210
+ const fd = node_fs_1.default.openSync(tmp, 'w', 0o755);
211
+ try {
212
+ // the whole buffer (writeSync may write a part of it)
213
+ node_fs_1.default.writeFileSync(fd, data);
214
+ node_fs_1.default.fsyncSync(fd);
215
+ }
216
+ finally {
217
+ node_fs_1.default.closeSync(fd);
218
+ }
219
+ node_fs_1.default.chmodSync(tmp, 0o755);
220
+ const got = (0, exports.fuseBinaryVersion)(tmp);
221
+ if (got.env !== env) {
222
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_BINARY_ENV)(`${got.version} ${got.env}`, env));
223
+ }
224
+ node_fs_1.default.renameSync(tmp, bin);
225
+ }
226
+ finally {
227
+ node_fs_1.default.rmSync(tmp, { force: true });
228
+ }
229
+ };
230
+ exports.placeFuseBinary = placeFuseBinary;
231
+ // The unit bdy-fuse install writes; its ExecStart starts with the service's binary.
232
+ exports.FUSE_UNIT = '/etc/systemd/system/bdy-fuse.service';
233
+ // the symlink bdy-fuse install puts on the PATH
234
+ exports.FUSE_PATH_LINK = '/usr/local/bin/bdy-fuse';
235
+ // Splits an ExecStart line as bdy-fuse install writes it (execLine): a word with a space or a
236
+ // quote in double quotes with \\ and \" escaped, % and $ doubled (systemd's specifiers and
237
+ // variables) - splitExec of bdy-fuse.
238
+ const splitFuseExec = (line) => {
239
+ const words = [];
240
+ let cur = '';
241
+ let quoted = false;
242
+ let escaped = false;
243
+ let inWord = false;
244
+ for (const c of line) {
245
+ if (escaped) {
246
+ cur += c;
247
+ escaped = false;
248
+ }
249
+ else if (c === '\\' && quoted) {
250
+ escaped = true;
251
+ }
252
+ else if (c === '"') {
253
+ quoted = !quoted;
254
+ inWord = true;
255
+ }
256
+ else if ((c === ' ' || c === '\t') && !quoted) {
257
+ if (inWord)
258
+ words.push(cur);
259
+ cur = '';
260
+ inWord = false;
261
+ }
262
+ else {
263
+ cur += c;
264
+ inWord = true;
265
+ }
266
+ }
267
+ if (inWord)
268
+ words.push(cur);
269
+ return words.map((w) => w.replaceAll('%%', '%').replaceAll('$$', '$'));
270
+ };
271
+ exports.splitFuseExec = splitFuseExec;
272
+ // The installed service, as its unit says: its binary and its directory (--dir). null: no unit,
273
+ // so no service installed.
274
+ const readFuseUnit = (unit = exports.FUSE_UNIT) => {
275
+ let text;
276
+ try {
277
+ text = node_fs_1.default.readFileSync(unit, 'utf8');
278
+ }
279
+ catch {
280
+ return null;
281
+ }
282
+ const line = /^ExecStart=(.*)$/m.exec(text);
283
+ const words = line ? (0, exports.splitFuseExec)(line[1].trim()) : [];
284
+ const dir = words.find((w) => w.startsWith('--dir='))?.slice('--dir='.length);
285
+ const bin = words[0] ?? null;
286
+ // a unit whose binary is gone (its directory deleted, its disk not mounted): a broken install
287
+ return { bin, dir: dir || exports.FUSE_DEFAULT_DIR, broken: !bin || !node_fs_1.default.existsSync(bin) };
288
+ };
289
+ exports.readFuseUnit = readFuseUnit;
290
+ // A binary of bdy's environment for a broken install's uninstall: bdy-fuse uninstall goes by the
291
+ // unit, not by where its binary is. In a directory of its own under /var/tmp (not /tmp, which may
292
+ // be mounted noexec), deleted when this process ends, however it ends: the commands leave through
293
+ // process.exit (a declined question, Ctrl+C in one, an error), and a signal ends it as well.
294
+ // /var/tmp is not cleared at boot, so a directory left would stay.
295
+ const downloadTempFuse = async (env) => {
296
+ const version = await (0, exports.fetchFuseLatest)(env);
297
+ const data = await (0, exports.downloadFuse)(env, version);
298
+ const dir = node_fs_1.default.mkdtempSync(node_path_1.default.join('/var/tmp', 'bdy-fuse-'));
299
+ const remove = () => node_fs_1.default.rmSync(dir, { recursive: true, force: true });
300
+ process.once('exit', remove);
301
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
302
+ process.once(signal, () => process.exit(128 + node_os_1.default.constants.signals[signal]));
303
+ }
304
+ const bin = node_path_1.default.join(dir, 'bdy-fuse');
305
+ (0, exports.placeFuseBinary)(bin, data, env);
306
+ return bin;
307
+ };
308
+ exports.downloadTempFuse = downloadTempFuse;
309
+ // The binary of the installed service, as its unit names it, else the one of the default
310
+ // directory, else the one on the PATH. null: no bdy-fuse on this host.
311
+ const findFuseBinary = (unit = exports.FUSE_UNIT) => {
312
+ const candidates = [
313
+ (0, exports.readFuseUnit)(unit)?.bin ?? undefined,
314
+ node_path_1.default.join(exports.FUSE_DEFAULT_DIR, 'bin', 'bdy-fuse'),
315
+ exports.FUSE_PATH_LINK,
316
+ ];
317
+ return candidates.find((p) => !!p && node_fs_1.default.existsSync(p)) ?? null;
318
+ };
319
+ exports.findFuseBinary = findFuseBinary;
320
+ // Runs a command of bdy-fuse. Text: its output as it goes; json: its stdout collected for the
321
+ // result (its stderr - the errors - still goes to stderr). Fails with its exit code.
322
+ const runFuse = (bin, args, json) => new Promise((resolve, reject) => {
323
+ const child = (0, node_child_process_1.spawn)(bin, args, {
324
+ stdio: ['ignore', json ? 'pipe' : 'inherit', 'inherit'],
325
+ });
326
+ let out = '';
327
+ child.stdout?.on('data', (chunk) => {
328
+ out += chunk;
329
+ });
330
+ child.once('error', reject);
331
+ child.once('close', (code) => {
332
+ if (code === 0)
333
+ resolve(out);
334
+ else
335
+ reject(new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_COMMAND)(args[0], code)));
336
+ });
337
+ });
338
+ exports.runFuse = runFuse;
339
+ // What keeps the daemon in use, as bdy-fuse ls says: the attaches and the changes not on the server
340
+ // yet. null: no daemon answers (stopped, restarting).
341
+ const fuseBusy = (bin) => {
342
+ try {
343
+ const out = (0, node_child_process_1.execFileSync)(bin, ['ls', '--format', 'json', '--timeout', '10s'], {
344
+ timeout: 20000,
345
+ stdio: ['ignore', 'pipe', 'ignore'],
346
+ }).toString();
347
+ const drives = JSON.parse(out) ?? [];
348
+ return drives.reduce((sum, d) => ({
349
+ attaches: sum.attaches + (d.attaches?.length ?? 0),
350
+ pending: sum.pending + (d.journal?.pending ?? 0),
351
+ }), { attaches: 0, pending: 0 });
352
+ }
353
+ catch {
354
+ return null;
355
+ }
356
+ };
357
+ exports.fuseBusy = fuseBusy;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const output_1 = __importDefault(require("../../output"));
7
+ const cliError_1 = __importDefault(require("../../cliError"));
8
+ const utils_1 = require("../../utils");
9
+ const texts_1 = require("../../texts");
10
+ const release_1 = require("./release");
11
+ const commandFuseUninstall = (0, utils_1.newCommand)('uninstall', texts_1.DESC_COMMAND_FUSE_UNINSTALL, {
12
+ requiredScopes: [],
13
+ examples: texts_1.EXAMPLE_FUSE_UNINSTALL,
14
+ helpText: texts_1.HELP_FUSE_UNINSTALL,
15
+ });
16
+ commandFuseUninstall.option('-f, --force', texts_1.OPTION_FUSE_FORCE);
17
+ commandFuseUninstall.option('--purge', texts_1.OPTION_FUSE_PURGE);
18
+ commandFuseUninstall.option('--format <text|json>', texts_1.OPTION_FORMAT);
19
+ commandFuseUninstall.action(async (options) => {
20
+ const json = options.format === 'json';
21
+ const purge = !!options.purge;
22
+ let force = !!options.force;
23
+ try {
24
+ (0, release_1.checkFuseRoot)('uninstall');
25
+ let bin = (0, release_1.findFuseBinary)();
26
+ const broken = !!(0, release_1.readFuseUnit)()?.broken;
27
+ if (!bin && !broken)
28
+ throw new cliError_1.default('not_found', texts_1.ERR_FUSE_NOT_INSTALLED);
29
+ // -f is bdy-fuse's --force, and asks nothing. Without it a terminal is asked first, and once
30
+ // more when containers are attached or changes are not on the server yet. Without a terminal
31
+ // nothing is asked: bdy-fuse uninstall itself refuses while the daemon is in use.
32
+ const ask = !force && output_1.default.isStdInTTY();
33
+ if (ask) {
34
+ const sure = await output_1.default.confirm(purge ? texts_1.TXT_FUSE_CONFIRM_PURGE : texts_1.TXT_FUSE_CONFIRM_UNINSTALL, json);
35
+ if (!sure)
36
+ output_1.default.exitResult(json, { uninstalled: false });
37
+ }
38
+ // A unit whose binary is gone (a broken install) is removed by a binary downloaded for it -
39
+ // once confirmed, and deleted when the process ends: bdy-fuse uninstall goes by the unit (its
40
+ // directory, its mounts), not by its own place.
41
+ if (broken)
42
+ bin = await (0, release_1.downloadTempFuse)((0, utils_1.getVersionEnv)());
43
+ if (!bin)
44
+ throw new cliError_1.default('not_found', texts_1.ERR_FUSE_NOT_INSTALLED);
45
+ if (ask) {
46
+ // null: no daemon answers - bdy-fuse then counts them from its files and refuses
47
+ const busy = (0, release_1.fuseBusy)(bin);
48
+ if (busy && (busy.attaches || busy.pending)) {
49
+ const anyway = await output_1.default.confirm((0, texts_1.TXT_FUSE_CONFIRM_BUSY)(busy.attaches, busy.pending, purge), json);
50
+ if (!anyway)
51
+ output_1.default.exitResult(json, { uninstalled: false });
52
+ force = true;
53
+ }
54
+ }
55
+ const args = ['uninstall'];
56
+ if (force)
57
+ args.push('--force');
58
+ if (purge)
59
+ args.push('--purge');
60
+ // the binary removes itself: a running process keeps its file until it ends
61
+ const output = await (0, release_1.runFuse)(bin, args, json);
62
+ if (json) {
63
+ output_1.default.json({
64
+ uninstalled: true,
65
+ binary: bin,
66
+ purged: purge,
67
+ output: output.trim().split('\n'),
68
+ });
69
+ }
70
+ output_1.default.exitNormal();
71
+ }
72
+ catch (err) {
73
+ output_1.default.exitError(err);
74
+ }
75
+ });
76
+ exports.default = commandFuseUninstall;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const output_1 = __importDefault(require("../../output"));
7
+ const cliError_1 = __importDefault(require("../../cliError"));
8
+ const utils_1 = require("../../utils");
9
+ const texts_1 = require("../../texts");
10
+ const release_1 = require("./release");
11
+ const commandFuseUpdate = (0, utils_1.newCommand)('update', texts_1.DESC_COMMAND_FUSE_UPDATE, {
12
+ requiredScopes: [],
13
+ examples: texts_1.EXAMPLE_FUSE_UPDATE,
14
+ helpText: texts_1.HELP_FUSE_UPDATE,
15
+ });
16
+ commandFuseUpdate.option('--dry-run', texts_1.OPTION_FUSE_DRY_RUN);
17
+ commandFuseUpdate.option('--format <text|json>', texts_1.OPTION_FORMAT);
18
+ commandFuseUpdate.action(async (options) => {
19
+ const json = options.format === 'json';
20
+ try {
21
+ (0, release_1.checkFuseRoot)('update');
22
+ // the service's own binary: bdy-fuse update replaces it in place and restarts the service
23
+ // with its unit as it is - its directory, its options, its environment
24
+ const installed = (0, release_1.readFuseUnit)();
25
+ if (!installed)
26
+ throw new cliError_1.default('not_found', texts_1.ERR_FUSE_NOT_INSTALLED);
27
+ if (installed.broken || !installed.bin) {
28
+ throw new cliError_1.default('command_failed', (0, texts_1.ERR_FUSE_BROKEN)(installed.bin ?? release_1.FUSE_UNIT));
29
+ }
30
+ const bin = installed.bin;
31
+ const args = ['update'];
32
+ if (options.dryRun)
33
+ args.push('--dry-run');
34
+ const output = await (0, release_1.runFuse)(bin, args, json);
35
+ if (json) {
36
+ output_1.default.json({
37
+ ...(0, release_1.fuseBinaryVersion)(bin),
38
+ binary: bin,
39
+ dryRun: !!options.dryRun,
40
+ output: output.trim().split('\n'),
41
+ });
42
+ }
43
+ output_1.default.exitNormal();
44
+ }
45
+ catch (err) {
46
+ output_1.default.exitError(err);
47
+ }
48
+ });
49
+ exports.default = commandFuseUpdate;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../utils");
7
+ const texts_1 = require("../texts");
8
+ const install_1 = __importDefault(require("./fuse/install"));
9
+ const uninstall_1 = __importDefault(require("./fuse/uninstall"));
10
+ const update_1 = __importDefault(require("./fuse/update"));
11
+ const commandFuse = (0, utils_1.newCommand)('fuse', texts_1.DESC_COMMAND_FUSE, {
12
+ examples: [
13
+ ...texts_1.EXAMPLE_FUSE_INSTALL,
14
+ ...texts_1.EXAMPLE_FUSE_UPDATE,
15
+ ...texts_1.EXAMPLE_FUSE_UNINSTALL,
16
+ ],
17
+ });
18
+ commandFuse.addCommand(install_1.default);
19
+ commandFuse.addCommand(update_1.default);
20
+ commandFuse.addCommand(uninstall_1.default);
21
+ exports.default = commandFuse;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildInjection = exports.parseVarFile = void 0;
6
+ exports.buildInjection = exports.effectiveVariables = exports.parseVarFile = void 0;
7
7
  const node_os_1 = require("node:os");
8
8
  const node_path_1 = require("node:path");
9
9
  const utils_1 = require("../../utils");
@@ -33,6 +33,22 @@ const parseVarFile = (spec) => {
33
33
  return { key, path: (0, node_path_1.resolve)(path) };
34
34
  };
35
35
  exports.parseVarFile = parseVarFile;
36
+ /**
37
+ * The variables of an environment that apply: GET /variables?environment_id=
38
+ * lists the environment's own variables first, then its bases nearest first,
39
+ * so the first variable of a key wins - a disabled one too, which leaves the
40
+ * key out rather than letting a base fill it.
41
+ */
42
+ const effectiveVariables = (variables) => {
43
+ const seen = new Set();
44
+ return variables.filter((v) => {
45
+ if (seen.has(v.key))
46
+ return false;
47
+ seen.add(v.key);
48
+ return true;
49
+ });
50
+ };
51
+ exports.effectiveVariables = effectiveVariables;
36
52
  /**
37
53
  * What goes into the command, from GET /variables?environment_id=: the
38
54
  * environment's own variables first, then its bases nearest first, so the
@@ -40,7 +56,7 @@ exports.parseVarFile = parseVarFile;
40
56
  *
41
57
  * VAR variables go into the process environment - all of them, or only the
42
58
  * ones named by --var. File variables go only where --var-file puts them,
43
- * with their password/passphrase as KEY_PASSWORD/KEY_PASSPHRASE.
59
+ * with their password/passphrase as <KEY>_PASSWORD/<KEY>_PASSPHRASE.
44
60
  *
45
61
  * An encrypted value the API did not decrypt fails the whole run: injecting
46
62
  * the masked form would hand the command a wrong secret without a word. The
@@ -50,11 +66,7 @@ exports.parseVarFile = parseVarFile;
50
66
  * with the flag on, the token's scope.
51
67
  */
52
68
  const buildInjection = (variables, environment, vars, varFiles) => {
53
- const byKey = new Map();
54
- for (const variable of variables) {
55
- if (!byKey.has(variable.key))
56
- byKey.set(variable.key, variable);
57
- }
69
+ const byKey = new Map((0, exports.effectiveVariables)(variables).map((v) => [v.key, v]));
58
70
  const find = (key) => {
59
71
  const variable = byKey.get(key);
60
72
  if (!variable) {
@@ -8,6 +8,7 @@ const texts_1 = require("../../texts");
8
8
  const output_1 = __importDefault(require("../../output"));
9
9
  const input_1 = __importDefault(require("../../input"));
10
10
  const scope_1 = require("./scope");
11
+ const injection_1 = require("./injection");
11
12
  const commandVariableList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_VARIABLE_LIST, {
12
13
  requiredScopes: [utils_1.REST_API_SCOPE.VARIABLE_READ],
13
14
  examples: texts_1.EXAMPLE_VARIABLE_LIST,
@@ -27,19 +28,24 @@ commandVariableList.action(async (options) => {
27
28
  const client = input_1.default.restApiTokenClient();
28
29
  const params = await (0, scope_1.resolveVariableScope)(client, workspace, project, scope, options);
29
30
  const result = await client.getVariables(workspace, params);
30
- const variables = result.variables || [];
31
31
  if (options.format === 'json') {
32
- output_1.default.json(variables);
32
+ output_1.default.json(result.variables || []);
33
33
  }
34
34
  else {
35
+ // An environment's list also carries the variables of its base
36
+ // environments; text shows only the ones that apply, as inject does,
37
+ // and where an inherited one comes from (base_environment).
38
+ const variables = (0, injection_1.effectiveVariables)(result.variables || []);
35
39
  if (variables.length === 0) {
36
40
  output_1.default.exitNormal(texts_1.TXT_VARIABLE_NOT_FOUND);
37
41
  }
38
- const data = [
39
- ['KEY', 'VALUE', 'TYPE', 'ENCRYPTED', 'SETTABLE', 'SCOPE'],
40
- ];
42
+ const inherited = variables.some((v) => v.base_environment);
43
+ const header = ['KEY', 'VALUE', 'TYPE', 'ENCRYPTED', 'SETTABLE', 'SCOPE'];
44
+ if (inherited)
45
+ header.push('INHERITED FROM');
46
+ const data = [header];
41
47
  for (const variable of variables) {
42
- data.push([
48
+ const row = [
43
49
  variable.key,
44
50
  (0, scope_1.variableValueOf)(variable, 40),
45
51
  variable.type || '-',
@@ -47,7 +53,12 @@ commandVariableList.action(async (options) => {
47
53
  variable.settable ? 'true' : 'false',
48
54
  // the list is exact-scope and its items carry no owner object
49
55
  scope,
50
- ]);
56
+ ];
57
+ if (inherited) {
58
+ const base = variable.base_environment;
59
+ row.push(base ? base.identifier || base.name || base.id : '-');
60
+ }
61
+ data.push(row);
51
62
  }
52
63
  output_1.default.table(data);
53
64
  }
@@ -32,7 +32,8 @@ exports.EXAMPLE_YAML_DISTRO = exports.EXAMPLE_YAML_ENVIRONMENT = exports.EXAMPLE
32
32
  exports.TXT_YAML_EXAMPLES = exports.TXT_YAML_OUTPUT_FILES = exports.TXT_YAML_EXPORTED_VARIABLES = exports.TXT_YAML_EVENT_VARIABLES_OF = exports.TXT_YAML_EVENT_VARIABLES = exports.TXT_YAML_TYPES = exports.TXT_YAML_TARGET_HINT = exports.TXT_YAML_TARGETS_ALL = exports.TXT_YAML_TARGET_USE_LIST = exports.ERR_YAML_TARGET_SEARCH_NO_RESULTS = exports.ERR_YAML_TARGET_NOT_FOUND = exports.OPTION_YAML_TARGET_TYPE = exports.DESC_COMMAND_YAML_TARGETS_INFO = exports.DESC_COMMAND_YAML_TARGETS_LIST = exports.DESC_COMMAND_YAML_TARGETS = exports.TXT_YAML_CUSTOM_ACTION_PROPERTIES = exports.DESC_COMMAND_YAML_CUSTOM_ACTION = exports.TXT_YAML_AGENT_PROPERTIES = exports.DESC_COMMAND_YAML_AGENT = exports.TXT_YAML_DISTRO_PROPERTIES = exports.DESC_COMMAND_YAML_DISTRO = exports.TXT_YAML_ENVIRONMENT_TARGET_FIELDS = exports.TXT_YAML_ENVIRONMENT_PROPERTIES = exports.DESC_COMMAND_YAML_ENVIRONMENT = exports.TXT_YAML_DOMAIN_PROPERTIES = exports.DESC_COMMAND_YAML_DOMAIN = exports.TXT_YAML_SANDBOX_PROPERTIES = exports.DESC_COMMAND_YAML_SANDBOX = exports.TXT_YAML_PIPELINE_SETTINGS = exports.TXT_YAML_PIPELINE_PROPERTIES = exports.TXT_YAML_PIPELINE_ACTION_FIELDS = exports.TXT_YAML_PIPELINE_EVENT_HINT = exports.TXT_YAML_PIPELINE_EVENTS_WITH_VARIABLES = exports.TXT_YAML_PIPELINE_EVENT_NONE = exports.ERR_YAML_PIPELINE_EVENT_UNKNOWN = exports.OPTION_YAML_PIPELINE_EVENT = exports.DESC_COMMAND_YAML_PIPELINE = exports.DESC_COMMAND_YAML = exports.TXT_ACTION_SUGGESTED_FROM_REPO = exports.TXT_ACTION_USE_LIST = exports.TXT_ACTION_DID_YOU_MEAN = exports.ERR_ACTION_SEARCH_NO_RESULTS = exports.ERR_ACTION_NOT_FOUND = exports.OPTION_ACTION_TYPE = exports.OPTION_ACTION_SEARCH = exports.EXAMPLE_YAML_VALIDATE = exports.EXAMPLE_YAML_ACTIONS_INFO = exports.EXAMPLE_YAML_ACTIONS_LIST = exports.EXAMPLE_YAML_CUSTOM_ACTION = exports.EXAMPLE_YAML_AGENT = void 0;
33
33
  exports.EXAMPLE_AGENT_DEBUG = exports.EXAMPLE_AGENT_TUNNELING_DISABLE = exports.EXAMPLE_AGENT_TUNNELING_ENABLE = exports.EXAMPLE_AGENT_PROXY_DISABLE = exports.EXAMPLE_AGENT_PROXY_ENABLE = exports.EXAMPLE_AGENT_TARGET_DISABLE = exports.EXAMPLE_AGENT_TARGET_ENABLE = exports.EXAMPLE_AGENT_DISABLE = exports.EXAMPLE_AGENT_ENABLE = exports.EXAMPLE_AGENT_STATUS = exports.EXAMPLE_DOMAIN_IMPORT = exports.EXAMPLE_DOMAIN_UPDATE = exports.EXAMPLE_DOMAIN_YAML = exports.EXAMPLE_DOMAIN_DELETE = exports.EXAMPLE_DOMAIN_CREATE = exports.EXAMPLE_DOMAIN_LIST = exports.EXAMPLE_DOMAIN_BUY = exports.EXAMPLE_DOMAIN_SEARCH = exports.EXAMPLE_API_LIST = exports.EXAMPLE_API_INFO = exports.ERR_API_SCHEMA_NOT_FOUND = exports.EXAMPLE_SANDBOX_LOGS = exports.ERR_YAML_SCHEMA_READ_FAILED = exports.ERR_YAML_SCHEMA_FETCH_FAILED = exports.TXT_YAML_PIPELINE_ENTRY = exports.ERR_YAML_PARSE = exports.ERR_YAML_VALIDATE_FAILED_COUNT = exports.TXT_YAML_VALIDATE_ALL_PASS = exports.ERR_YAML_VALIDATE_FAILED = exports.ERR_YAML_VALIDATE_FILE_NOT_FOUND = exports.TXT_YAML_DOCUMENT_TYPE_HINT = exports.ERR_YAML_DOCUMENT_EMPTY = exports.ERR_YAML_DOCUMENT_KEYS_AT_TOP = exports.ERR_YAML_DOCUMENT_ONE_ENTRY = exports.ERR_YAML_DOCUMENT_LIST = exports.TXT_YAML_DOCUMENT_PASSED = exports.ERR_YAML_DOCUMENT_FAILED_COUNT = exports.TXT_YAML_VALIDATED_AS = exports.OPTION_YAML_VALIDATE_TYPE = exports.OPTION_YAML_VALIDATE_FILE = exports.DESC_COMMAND_YAML_VALIDATE = exports.DESC_COMMAND_YAML_ACTIONS_INFO = exports.DESC_COMMAND_YAML_ACTIONS_LIST = exports.DESC_COMMAND_YAML_ACTIONS = exports.TXT_YAML_ACTIONS_ALL = exports.TXT_YAML_ACTIONS_SUGGESTED = exports.TXT_YAML_ACTIONS_SUGGESTED_FROM_REPO = exports.TXT_YAML_COMMON_FIELDS = exports.TXT_YAML_TYPE_SPECIFIC_FIELDS = exports.TXT_YAML_EXAMPLE_TITLE = void 0;
34
34
  exports.ERR_CONTEXT_LINK_INVALID = exports.ERR_CONTEXT_LINK_MISSING = exports.ERR_CONTEXT_GIT_URL = exports.ERR_CONTEXT_GIT_REMOTE = exports.ERR_CONTEXT_GIT_REPO = exports.ERR_CONTEXT_GIT_MISSING = exports.ERR_CONTEXT_API = exports.ERR_CONTEXT_PROJECT = exports.ERR_CONTEXT_SOURCE = exports.ERR_CONTEXT_NAME = exports.ERR_CONTEXT_EXISTS = exports.ERR_CONTEXT_RESERVED = exports.ERR_CONTEXT_UNKNOWN = exports.TXT_CONTEXT_LINK_HINT = exports.TXT_CONTEXT_GIT_HINT = exports.TXT_CONTEXT_HINT = exports.OPTION_CONTEXT_API = exports.OPTION_CONTEXT_TOKEN = exports.OPTION_CONTEXT_REMOTE = exports.OPTION_CONTEXT_GIT = exports.OPTION_CONTEXT_LINK = exports.OPTION_CONTEXT_NAME = exports.DESC_CONTEXT_REMOVE = exports.DESC_CONTEXT_USE = exports.DESC_CONTEXT_SHOW = exports.DESC_CONTEXT_LIST = exports.DESC_CONTEXT_ADD = exports.DESC_CONTEXT = exports.OPTION_CONTEXT = exports.HELP_AGENT_STATUS_JSON = exports.HELP_SANDBOX_APP_ADD_JSON = exports.EXAMPLE_CONFIG_GET_TUNNELS = exports.EXAMPLE_CONFIG_GET_TUNNEL = exports.HELP_TARGET_EXEC_LOGS_JSONL = exports.HELP_SANDBOX_EXEC_COMMAND_JSONL = exports.HELP_SANDBOX_EXEC_JSONL = exports.HELP_INTEGRATION_EXEC = exports.HELP_TARGET_EXEC_COMMAND = exports.HELP_TARGET_EXEC_STATUS = exports.HELP_SANDBOX_EXEC_STATUS = exports.HELP_API_INFO_JSON = exports.HELP_DOMAIN_SEARCH_JSON = exports.HELP_DOMAIN_IMPORT = exports.HELP_YAML_VALIDATE_JSON = exports.EXAMPLE_AGENT_TAGS_SET = exports.EXAMPLE_AGENT_TAGS_GET = exports.EXAMPLE_AGENT_PROXY_STATUS = exports.EXAMPLE_AGENT_TARGET_STATUS = exports.EXAMPLE_AGENT_VERSION = exports.EXAMPLE_AGENT_UPDATE = void 0;
35
- exports.HELP_CONTEXT_REMOVE = exports.HELP_CONTEXT_USE = exports.HELP_CONTEXT_SHOW = exports.HELP_CONTEXT_LIST = exports.HELP_CONTEXT_ADD = exports.EXAMPLE_CONTEXT_REMOVE = exports.EXAMPLE_CONTEXT_USE = exports.EXAMPLE_CONTEXT_SHOW = exports.EXAMPLE_CONTEXT_LIST = exports.EXAMPLE_CONTEXT_ADD = exports.TXT_CONTEXT_TOKEN_MISSING = exports.TXT_CONTEXT_TOKEN_AVAILABLE = exports.TXT_CONTEXT_TOKEN_LABEL = exports.TXT_CONTEXT_REMOTE_LABEL = exports.TXT_CONTEXT_API_LABEL = exports.TXT_CONTEXT_PROJECT_LABEL = exports.TXT_CONTEXT_WORKSPACE_LABEL = exports.TXT_CONTEXT_SOURCE_LABEL = exports.TXT_CONTEXT_LABEL = exports.TXT_CONTEXT_REMOVE_CONFIRM = exports.ERR_CONTEXT_GIT_FAILED = exports.ERR_CONTEXT_GIT_TIMEOUT = exports.TXT_CONTEXT_PROJECT_HINT = exports.TXT_CONTEXT_WORKSPACE_HINT = exports.HELP_CONTEXT = exports.TXT_CONTEXT_REMOVED = exports.TXT_CONTEXT_ACTIVE = exports.TXT_CONTEXT_SAVED = void 0;
35
+ exports.ERR_FUSE_COMMAND = exports.ERR_FUSE_BINARY_ENV = exports.ERR_FUSE_BINARY = exports.ERR_FUSE_CHECKSUM = exports.ERR_FUSE_NO_PACKAGE = exports.ERR_FUSE_SIGNATURE = exports.ERR_FUSE_DOWNLOAD = exports.ERR_FUSE_DEVICE = exports.ERR_FUSE_KERNEL = exports.ERR_FUSE_SYSTEMD = exports.ERR_FUSE_ROOT = exports.ERR_FUSE_ARCH = exports.ERR_FUSE_NOT_LINUX = exports.OPTION_FUSE_MIN_FREE = exports.OPTION_FUSE_CACHE_MAX = exports.OPTION_FUSE_UPLOAD_RATE = exports.OPTION_FUSE_MAX_DIRTY = exports.OPTION_FUSE_DIR = exports.EXAMPLE_FUSE_INSTALL = exports.HELP_FUSE_INSTALL = exports.DESC_COMMAND_FUSE_INSTALL = exports.DESC_COMMAND_FUSE = exports.HELP_CONTEXT_REMOVE = exports.HELP_CONTEXT_USE = exports.HELP_CONTEXT_SHOW = exports.HELP_CONTEXT_LIST = exports.HELP_CONTEXT_ADD = exports.EXAMPLE_CONTEXT_REMOVE = exports.EXAMPLE_CONTEXT_USE = exports.EXAMPLE_CONTEXT_SHOW = exports.EXAMPLE_CONTEXT_LIST = exports.EXAMPLE_CONTEXT_ADD = exports.TXT_CONTEXT_TOKEN_MISSING = exports.TXT_CONTEXT_TOKEN_AVAILABLE = exports.TXT_CONTEXT_TOKEN_LABEL = exports.TXT_CONTEXT_REMOTE_LABEL = exports.TXT_CONTEXT_API_LABEL = exports.TXT_CONTEXT_PROJECT_LABEL = exports.TXT_CONTEXT_WORKSPACE_LABEL = exports.TXT_CONTEXT_SOURCE_LABEL = exports.TXT_CONTEXT_LABEL = exports.TXT_CONTEXT_REMOVE_CONFIRM = exports.ERR_CONTEXT_GIT_FAILED = exports.ERR_CONTEXT_GIT_TIMEOUT = exports.TXT_CONTEXT_PROJECT_HINT = exports.TXT_CONTEXT_WORKSPACE_HINT = exports.HELP_CONTEXT = exports.TXT_CONTEXT_REMOVED = exports.TXT_CONTEXT_ACTIVE = exports.TXT_CONTEXT_SAVED = void 0;
36
+ exports.OPTION_FUSE_DRY_RUN = exports.EXAMPLE_FUSE_UPDATE = exports.HELP_FUSE_UPDATE = exports.DESC_COMMAND_FUSE_UPDATE = exports.TXT_FUSE_CONFIRM_PURGE = exports.TXT_FUSE_CONFIRM_BUSY = exports.TXT_FUSE_CONFIRM_UNINSTALL = exports.ERR_FUSE_NOT_INSTALLED = exports.OPTION_FUSE_PURGE = exports.OPTION_FUSE_FORCE = exports.EXAMPLE_FUSE_UNINSTALL = exports.HELP_FUSE_UNINSTALL = exports.DESC_COMMAND_FUSE_UNINSTALL = exports.ERR_FUSE_BROKEN = exports.ERR_FUSE_INSTALLED = exports.TXT_FUSE_DOWNLOADED = exports.TXT_FUSE_DOWNLOADING = void 0;
36
37
  const utils_1 = require("./utils");
37
38
  exports.ERR_CONFIRM_REQUIRED = 'Confirmation is required in non-interactive mode';
38
39
  exports.ERR_FOLLOW_WITH_JSON = '--follow cannot be used with --format json';
@@ -1263,7 +1264,7 @@ exports.OPTION_VARIABLE_ENABLE = 'Enable the variable';
1263
1264
  exports.OPTION_VARIABLE_DISABLE = 'Disable the variable. A disabled variable is not injected anywhere';
1264
1265
  exports.OPTION_VARIABLE_INJECT_ENVIRONMENT = 'Environment identifier (required). Its variables and those of its base environments are injected, its own winning. Looked up in the project first (--project, BUDDY_PROJECT or the linked project), then in the workspace; --scope picks exactly one of them';
1265
1266
  exports.OPTION_VARIABLE_INJECT_VAR = 'Inject only this VAR variable into the environment of the command; repeatable. By default every VAR variable of the environment is injected';
1266
- exports.OPTION_VARIABLE_INJECT_VAR_FILE = 'Write a file variable (FILE, SSH_KEY, SSH_PUBLIC_KEY, GPG_KEY, P12, IOS_KEYCHAIN, IOS_PROVISION_PROFILES) to a new file at PATH for the time of the command, then delete it; repeatable. Its password and passphrase go into KEY_PASSWORD and KEY_PASSPHRASE';
1267
+ exports.OPTION_VARIABLE_INJECT_VAR_FILE = 'Write a file variable (FILE, SSH_KEY, SSH_PUBLIC_KEY, GPG_KEY, P12, IOS_KEYCHAIN, IOS_PROVISION_PROFILES) to a new file at PATH for the time of the command, then delete it; repeatable. Its password and passphrase go into <KEY>_PASSWORD and <KEY>_PASSPHRASE, e.g. DEPLOY_KEY_PASSPHRASE';
1267
1268
  exports.OPTION_VARIABLE_INJECT_NO_MASKING = 'Do not mask encrypted values in the output of the command. The command then gets the terminal directly, which interactive programs need';
1268
1269
  exports.OPTION_VARIABLE_INJECT_WAIT = 'With masking: how many seconds to wait, after the command exited, for its output to close - a process it left in the background keeps it open. Past that bdy stops passing the output on and exits with 1 (such a process gets SIGPIPE on its next write). 0 waits without a limit. Time a slow reader of the output holds it up is not counted';
1269
1270
  exports.OPTION_VARIABLE_INJECT_COMMAND = 'Command to run with its arguments, after --';
@@ -4541,3 +4542,123 @@ A declined confirmation leaves both the context and selection unchanged. In JSON
4541
4542
  removed is the deleted name, or null when declined; active is the current selection.
4542
4543
  Without interactive stdin, missing --force is a usage error (exit 1); nothing is removed.
4543
4544
  `;
4545
+ exports.DESC_COMMAND_FUSE = 'Manage bdy-fuse, the daemon that mounts versions of file packages for the containers of a host';
4546
+ exports.DESC_COMMAND_FUSE_INSTALL = 'Install or upgrade the bdy-fuse daemon as a systemd service (Linux 6.12+, root)';
4547
+ exports.HELP_FUSE_INSTALL = `
4548
+ Downloads the newest bdy-fuse of this bdy's environment (dev, stage, beta, master, prod),
4549
+ checks its signature and checksum, puts it in <dir>/bin/bdy-fuse and runs its install with
4550
+ the options given. The daemon then updates itself every day. Refused when bdy-fuse is
4551
+ installed already: bdy fuse update upgrades it, keeping its directory and options. Its options
4552
+ are changed in its unit, /etc/systemd/system/bdy-fuse.service (then systemctl daemon-reload &&
4553
+ systemctl restart bdy-fuse: the mounts stay). To install it anew, bdy fuse uninstall first: its
4554
+ directory stays, and the new install goes on with it.
4555
+ Refused, before anything is downloaded, on another system than Linux, without root, without
4556
+ systemd, on a kernel older than 6.12 and without /dev/fuse. The options are bdy-fuse
4557
+ install's; bdy-fuse help install describes them in full.
4558
+ `;
4559
+ exports.EXAMPLE_FUSE_INSTALL = [
4560
+ {
4561
+ description: 'install the daemon with its defaults',
4562
+ command: 'sudo bdy fuse install',
4563
+ },
4564
+ {
4565
+ description: 'cap the caches and keep 5 GB free on their disk',
4566
+ command: 'sudo bdy fuse install --cache-max 50G --min-free 5G',
4567
+ },
4568
+ {
4569
+ description: 'keep the caches on another disk',
4570
+ command: 'sudo bdy fuse install --dir /data/bdy-fuse',
4571
+ },
4572
+ ];
4573
+ exports.OPTION_FUSE_DIR = "The daemon's directory: caches, queues of changes, attaches, logs and its binary (bin/bdy-fuse). Default: /var/lib/bdy-fuse";
4574
+ exports.OPTION_FUSE_MAX_DIRTY = 'Per version, how many bytes written locally may wait for the server (K, M, G; 0: no limit). Default: 256M';
4575
+ exports.OPTION_FUSE_UPLOAD_RATE = 'Per version, at most this many bytes per second sent to the server (K, M, G; 0: no limit). Default: 0';
4576
+ exports.OPTION_FUSE_CACHE_MAX = "All the caches together; over it the least recently used ones not in use are deleted (K, M, G; 0: no limit). Default: 0";
4577
+ exports.OPTION_FUSE_MIN_FREE = "Free space kept on the caches' disk (K, M, G; 0: none). Default: 1G";
4578
+ const ERR_FUSE_NOT_LINUX = (platform) => `bdy-fuse runs on Linux only, not on ${platform}`;
4579
+ exports.ERR_FUSE_NOT_LINUX = ERR_FUSE_NOT_LINUX;
4580
+ const ERR_FUSE_ARCH = (arch) => `bdy-fuse is built for x64 and arm64, not for ${arch}`;
4581
+ exports.ERR_FUSE_ARCH = ERR_FUSE_ARCH;
4582
+ const ERR_FUSE_ROOT = (command) => `bdy fuse ${command} must be run as root (sudo bdy fuse ${command})`;
4583
+ exports.ERR_FUSE_ROOT = ERR_FUSE_ROOT;
4584
+ exports.ERR_FUSE_SYSTEMD = 'bdy-fuse runs as a systemd service: no systemctl on this host';
4585
+ const ERR_FUSE_KERNEL = (release) => `bdy-fuse needs Linux 6.12 or newer (idmapped FUSE mounts), this kernel is ${release}`;
4586
+ exports.ERR_FUSE_KERNEL = ERR_FUSE_KERNEL;
4587
+ exports.ERR_FUSE_DEVICE = 'No usable /dev/fuse on this host: load the module (modprobe fuse), or in a container pass the device (--device /dev/fuse)';
4588
+ const ERR_FUSE_DOWNLOAD = (url, reason) => `Failed downloading ${url}: ${reason}`;
4589
+ exports.ERR_FUSE_DOWNLOAD = ERR_FUSE_DOWNLOAD;
4590
+ const ERR_FUSE_SIGNATURE = (env, version) => `bdy-fuse ${version} (${env}) is not signed with a key bdy trusts: not installed`;
4591
+ exports.ERR_FUSE_SIGNATURE = ERR_FUSE_SIGNATURE;
4592
+ const ERR_FUSE_NO_PACKAGE = (env, version, name) => `bdy-fuse ${version} (${env}) has no ${name}`;
4593
+ exports.ERR_FUSE_NO_PACKAGE = ERR_FUSE_NO_PACKAGE;
4594
+ const ERR_FUSE_CHECKSUM = (name) => `The checksum of ${name} does not match (a partial download?): not installed`;
4595
+ exports.ERR_FUSE_CHECKSUM = ERR_FUSE_CHECKSUM;
4596
+ const ERR_FUSE_BINARY = (reason) => `The downloaded bdy-fuse does not run here: ${reason}`;
4597
+ exports.ERR_FUSE_BINARY = ERR_FUSE_BINARY;
4598
+ const ERR_FUSE_BINARY_ENV = (got, env) => `The downloaded bdy-fuse is ${got}, not of ${env}: not installed`;
4599
+ exports.ERR_FUSE_BINARY_ENV = ERR_FUSE_BINARY_ENV;
4600
+ const ERR_FUSE_COMMAND = (command, code) => `bdy-fuse ${command} failed (exit code ${code})`;
4601
+ exports.ERR_FUSE_COMMAND = ERR_FUSE_COMMAND;
4602
+ const TXT_FUSE_DOWNLOADING = (env, version) => `Downloading bdy-fuse ${version} (${env})`;
4603
+ exports.TXT_FUSE_DOWNLOADING = TXT_FUSE_DOWNLOADING;
4604
+ const TXT_FUSE_DOWNLOADED = (bin) => `bdy-fuse saved to ${bin}`;
4605
+ exports.TXT_FUSE_DOWNLOADED = TXT_FUSE_DOWNLOADED;
4606
+ const ERR_FUSE_INSTALLED = (dir) => `bdy-fuse is installed already (${dir}): bdy fuse update upgrades it; its options are in /etc/systemd/system/bdy-fuse.service (then systemctl daemon-reload && systemctl restart bdy-fuse); bdy fuse uninstall first to install it anew`;
4607
+ exports.ERR_FUSE_INSTALLED = ERR_FUSE_INSTALLED;
4608
+ const ERR_FUSE_BROKEN = (bin) => `bdy-fuse is installed, but its binary ${bin} is gone: bdy fuse uninstall removes what is left, then bdy fuse install`;
4609
+ exports.ERR_FUSE_BROKEN = ERR_FUSE_BROKEN;
4610
+ exports.DESC_COMMAND_FUSE_UNINSTALL = 'Uninstall the bdy-fuse daemon: its service and binary, the mounts left (root)';
4611
+ exports.HELP_FUSE_UNINSTALL = `
4612
+ Runs bdy-fuse uninstall of the installed binary: the service and its binary are removed and
4613
+ the mounts left unmounted. Refused while containers are attached or changes are not on the
4614
+ server yet, unless --force. In a terminal it asks first, and asks again when the daemon is in
4615
+ use; --force asks nothing. The daemon's directory (caches, changes not pushed, logs; the --dir
4616
+ of the installed service) stays for the next install, which goes on with them, unless --purge.
4617
+ `;
4618
+ exports.EXAMPLE_FUSE_UNINSTALL = [
4619
+ {
4620
+ description: 'uninstall the daemon, keep its caches',
4621
+ command: 'sudo bdy fuse uninstall',
4622
+ },
4623
+ {
4624
+ description: 'uninstall even while in use and delete everything, without asking',
4625
+ command: 'sudo bdy fuse uninstall --purge -f',
4626
+ },
4627
+ ];
4628
+ exports.OPTION_FUSE_FORCE = 'Uninstall even with attaches or changes not on the server yet (their containers lose the files; with --purge the changes are lost); asks nothing';
4629
+ exports.OPTION_FUSE_PURGE = "Delete the daemon's directory too: caches, changes not pushed, logs";
4630
+ exports.ERR_FUSE_NOT_INSTALLED = 'bdy-fuse is not installed on this host';
4631
+ exports.TXT_FUSE_CONFIRM_UNINSTALL = 'Uninstall the bdy-fuse service?';
4632
+ const TXT_FUSE_CONFIRM_BUSY = (attaches, pending, purge) => {
4633
+ const what = [
4634
+ attaches ? `${attaches} attached container(s) lose their files` : '',
4635
+ pending ? `${pending} change(s) not on the server yet` : '',
4636
+ ]
4637
+ .filter(Boolean)
4638
+ .join(', ');
4639
+ if (purge && pending)
4640
+ return `${what}: delete the changes not on the server too? They are lost.`;
4641
+ if (pending)
4642
+ return `${what}: uninstall anyway? The changes stay on the disk for the next install.`;
4643
+ return `${what}: uninstall anyway?`;
4644
+ };
4645
+ exports.TXT_FUSE_CONFIRM_BUSY = TXT_FUSE_CONFIRM_BUSY;
4646
+ exports.TXT_FUSE_CONFIRM_PURGE = 'Uninstall bdy-fuse and delete its directory (caches, changes not pushed, logs)?';
4647
+ exports.DESC_COMMAND_FUSE_UPDATE = 'Update the installed bdy-fuse daemon to the newest version of its environment now (root)';
4648
+ exports.HELP_FUSE_UPDATE = `
4649
+ Runs bdy-fuse update of the installed service, as its daily update does: the newest binary of
4650
+ its environment is downloaded, its signature, checksum and a run here checked, and the service
4651
+ restarts with it, keeping its directory and options. A new binary that does not come up goes
4652
+ back to the one before. A daemon on the newest version, or pinned, does nothing.
4653
+ `;
4654
+ exports.EXAMPLE_FUSE_UPDATE = [
4655
+ {
4656
+ description: 'update the daemon now',
4657
+ command: 'sudo bdy fuse update',
4658
+ },
4659
+ {
4660
+ description: 'what an update would do, changing nothing',
4661
+ command: 'sudo bdy fuse update --dry-run',
4662
+ },
4663
+ ];
4664
+ exports.OPTION_FUSE_DRY_RUN = 'Download and check the newest version, but neither put it in place nor restart the daemon';
@@ -37,8 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.VARIABLE_TYPE = exports.VARIABLE_SCOPE = exports.TARGET_SCOPE = exports.PROJECT_SOURCE_INTEGRATION_TYPES = exports.PROJECT_SOURCE_ALIASES = exports.PROJECT_SOURCE = exports.PROJECT_STATUS = exports.PROJECT_ACCESS = exports.DOMAIN_TYPE = exports.ARTIFACT_VERSION_STATUS = exports.ARTIFACT_TYPE = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_APP_STATUS = exports.SANDBOX_SETUP_STATUS = exports.SANDBOX_EXEC_STATUS = exports.SANDBOX_EXEC_RUNTIME = exports.SANDBOX_STATUS = exports.REST_API_ENDPOINT = exports.REST_API_REGION = exports.DEFAULT_SANDBOX_CP_USER = exports.ARTIFACT_DEFAULT_VERSION = exports.SUGGESTED_BROWSER_VERSION = exports.AGENT_TUNNEL_REPLACE_TIMEOUT_MS = exports.AGENT_UPDATE_STATUS_TTL_MS = exports.AGENT_UPDATE_PROBATION_MS = exports.AGENT_UPDATE_MAX_ATTEMPTS = exports.AGENT_FETCH_RETRY_MAX = exports.AGENT_FETCH_RETRY_MIN = exports.SSH_HANDSHAKE_TIMEOUT = exports.TUNNEL_SSH_FORWARD_IDLE_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.getSshIdent = exports.TUNNEL_SSH_IDENT_SHARED_H1 = exports.TUNNEL_SSH_IDENT_SHARED_H2 = exports.TUNNEL_CLIENT_IP_HEADER = exports.TUNNEL_H2_WINDOW_SIZE = exports.TUNNEL_HTTP2_SHED_LOG_INTERVAL = exports.TUNNEL_HTTP2_MAX_SESSIONS = exports.TUNNEL_HTTP1_CHANNEL_KEEPALIVE = exports.TUNNEL_HTTP2_SESSION_IDLE_TIMEOUT = exports.TUNNEL_HTTP_RETRY_AFTER = exports.TUNNEL_HTTP_MAX_INFLIGHT = exports.TUNNEL_HTTP_CB_MIN_REQUESTS = exports.TUNNEL_HTTP_CB_WINDOW = exports.TUNNEL_MAX_REQUEST_SIZE_TO_SYNC = exports.TUNNEL_HTTP_LOG_MAX_REQUESTS = exports.TUNNEL_HTTP_LOG_MAX_BODY = exports.TUNNEL_HTTP_RATE_WINDOW = exports.TUNNEL_HTTP_RATE_LIMIT = exports.REST_API_SCOPE = void 0;
40
- exports.getServiceUser = exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.truncate = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = exports.getCurrentVersionWithoutEnv = exports.isVersionNewer = exports.getVersionWithoutEnv = exports.parseVersion = exports.getVersion = exports.isInstalledByChoco = exports.isInstalledByApt = exports.isInstalledByBrew = exports.isInstalledByNpm = exports.isNpmGlobalWritable = exports.isPathWritable = exports.tryGetEmail = exports.execLocally = exports.getHomeDirectory = exports.HOME_DIR_NAME = exports.chownToHomeOwner = exports.isDomainAvailable = exports.sandboxScopeOptions = exports.newCommand = exports.formatBytes = exports.formatHelp = exports.getPlatform = exports.getHostname = exports.isStringRegExp = exports.getWorkingDir = exports.getRootDir = exports.TARGET_ONLY_PORT_REGEX = exports.TARGET_HTTP_REGEX = exports.TARGET_TCP_TLS_REGEX = exports.ApiErrorTunnelsDisabled = exports.ApiErrorWorkspaceFlagged = exports.ApiErrorTunnelLimitReached = exports.ApiErrorAgentLimitReached = exports.ApiErrorDomainRestricted = exports.ApiErrorTargetInvalid = exports.ApiErrorWrongToken = exports.ApiErrorFailedToConnect = exports.ApiErrorAgentNotFound = exports.ARTIFACT_AUTH_TYPE = exports.TARGET_EXEC_STATUS = void 0;
41
- exports.findArtifactReadme = exports.isPathInside = exports.getComposerReadmePath = exports.parseComposerJson = exports.ARTIFACT_README_NAMES = exports.ARTIFACT_README_SIZE_LIMIT = exports.filterIgnoredEntries = exports.parseIgnorePatterns = exports.ARTIFACT_IGNORE_DEFAULT = exports.createZip = exports.getGitName = exports.getGitEmail = exports.MCP_TOOL_CATEGORIES = exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.getCurrentUser = void 0;
40
+ exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.truncate = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = exports.getCurrentVersionWithoutEnv = exports.isVersionNewer = exports.getVersionWithoutEnv = exports.parseVersion = exports.getVersion = exports.isInstalledByChoco = exports.isInstalledByApt = exports.isInstalledByBrew = exports.isInstalledByNpm = exports.isNpmGlobalWritable = exports.isPathWritable = exports.tryGetEmail = exports.execLocally = exports.getHomeDirectory = exports.HOME_DIR_NAME = exports.chownToHomeOwner = exports.isDomainAvailable = exports.sandboxScopeOptions = exports.newCommand = exports.helpConfiguration = exports.formatBytes = exports.formatHelp = exports.getPlatform = exports.getHostname = exports.isStringRegExp = exports.getWorkingDir = exports.getRootDir = exports.TARGET_ONLY_PORT_REGEX = exports.TARGET_HTTP_REGEX = exports.TARGET_TCP_TLS_REGEX = exports.ApiErrorTunnelsDisabled = exports.ApiErrorWorkspaceFlagged = exports.ApiErrorTunnelLimitReached = exports.ApiErrorAgentLimitReached = exports.ApiErrorDomainRestricted = exports.ApiErrorTargetInvalid = exports.ApiErrorWrongToken = exports.ApiErrorFailedToConnect = exports.ApiErrorAgentNotFound = exports.ARTIFACT_AUTH_TYPE = exports.TARGET_EXEC_STATUS = void 0;
41
+ exports.findArtifactReadme = exports.isPathInside = exports.getComposerReadmePath = exports.parseComposerJson = exports.ARTIFACT_README_NAMES = exports.ARTIFACT_README_SIZE_LIMIT = exports.filterIgnoredEntries = exports.parseIgnorePatterns = exports.ARTIFACT_IGNORE_DEFAULT = exports.createZip = exports.getGitName = exports.getGitEmail = exports.MCP_TOOL_CATEGORIES = exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.getCurrentUser = exports.getServiceUser = void 0;
42
42
  exports.executionExitCode = executionExitCode;
43
43
  exports.apiErrorCodeToClass = apiErrorCodeToClass;
44
44
  exports.isFile = isFile;
@@ -72,6 +72,7 @@ const node_sea_1 = require("node:sea");
72
72
  const node_zlib_1 = __importDefault(require("node:zlib"));
73
73
  const node_stream_1 = require("node:stream");
74
74
  const promises_1 = require("node:stream/promises");
75
+ const commander_1 = require("commander");
75
76
  const cliCommand_1 = __importDefault(require("./cliCommand"));
76
77
  const node_os_1 = __importStar(require("node:os"));
77
78
  const node_net_1 = __importDefault(require("node:net"));
@@ -579,13 +580,33 @@ const formatBytes = (bytes) => {
579
580
  return `${bytes}GB`;
580
581
  };
581
582
  exports.formatBytes = formatBytes;
583
+ // Commander names a command in help by its first alias only (`inject|exec`),
584
+ // so every other alias (`run`) worked but was nowhere to be seen.
585
+ const withAllAliases = (cmd, text) => {
586
+ const aliases = cmd.aliases();
587
+ if (aliases.length < 2)
588
+ return text;
589
+ return text.replace(`${cmd.name()}|${aliases[0]}`, [cmd.name(), ...aliases].join('|'));
590
+ };
591
+ exports.helpConfiguration = {
592
+ formatHelp: exports.formatHelp,
593
+ subcommandTerm(cmd) {
594
+ return withAllAliases(cmd, commander_1.Help.prototype.subcommandTerm.call(this, cmd));
595
+ },
596
+ commandUsage(cmd) {
597
+ // the command's own name comes last, after its ancestors'
598
+ const usage = commander_1.Help.prototype.commandUsage.call(this, cmd);
599
+ const at = usage.lastIndexOf(`${cmd.name()}|`);
600
+ if (at < 0)
601
+ return usage;
602
+ return usage.slice(0, at) + withAllAliases(cmd, usage.slice(at));
603
+ },
604
+ };
582
605
  const newCommand = (name, desc, metadata) => {
583
606
  const cmd = new cliCommand_1.default(name, metadata);
584
607
  if (desc)
585
608
  cmd.description(desc);
586
- cmd.configureHelp({
587
- formatHelp: exports.formatHelp,
588
- });
609
+ cmd.configureHelp(exports.helpConfiguration);
589
610
  return cmd;
590
611
  };
591
612
  exports.newCommand = newCommand;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.26.6-dev",
4
+ "version": "1.26.8-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",
@@ -53,7 +53,7 @@
53
53
  "tweetnacl"
54
54
  ],
55
55
  "dependencies": {
56
- "@buddy-works/ci-info": "1.1.7",
56
+ "@buddy-works/ci-info": "1.1.8",
57
57
  "@buddy-works/docs-schema": "0.1.4",
58
58
  "@fastify/accept-negotiator": "2.0.1",
59
59
  "@fastify/cors": "11.2.0",
@@ -69,7 +69,7 @@
69
69
  "commander": "15.0.0",
70
70
  "content-disposition": "2.0.1",
71
71
  "cookie": "1.1.1",
72
- "cross-spawn": "7.0.6",
72
+ "cross-spawn": "7.1.2",
73
73
  "dotenv": "17.4.2",
74
74
  "eventsource": "4.1.0",
75
75
  "fastify": "5.12.7",