@mx-space/cli 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin/mxs.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{mxs-lcMA5vod.mjs → mxs-DUkVdHhE.mjs} +152 -147
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ local expiry from the refreshed session.
|
|
|
101
101
|
|
|
102
102
|
### Auth and profiles
|
|
103
103
|
|
|
104
|
-
`mxs auth login [--profile <name>] [--production]` writes credentials to the named profile. If `--profile` is omitted and a current profile is active, it refreshes that profile. If no current profile exists (fresh install), it creates and selects the `default` profile. Passing `--production` sets the production flag on the target profile after login succeeds.
|
|
104
|
+
`mxs auth login [--profile <name>] [--production]` writes credentials to the named profile. If `--profile` is omitted and a current profile is active, it refreshes that profile. If no current profile exists (fresh install), it creates and selects the `default` profile. If the `current` pointer references a profile whose directory has been removed, `auth login` recovers by creating the requested profile (or recreating the pointed-at one) rather than failing with `profile.not_found`. Passing `--production` sets the production flag on the target profile after login succeeds.
|
|
105
105
|
|
|
106
106
|
`mxs auth logout [--profile <name>]` clears credentials for the target profile; the profile directory and the `current` pointer are preserved.
|
|
107
107
|
|
package/dist/bin/mxs.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-
|
|
1
|
+
import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-DUkVdHhE.mjs";
|
|
2
2
|
export { codeForTag, defaultGlobalFlags, defaultMessageFor, exitCodeForError, exitCodeForTag, parseGlobalFlags, run, tagToCode, toErrorEnvelope };
|
|
@@ -24,7 +24,7 @@ import * as ChildProcess from "node:child_process";
|
|
|
24
24
|
import childProcess, { execFile, spawn } from "node:child_process";
|
|
25
25
|
import * as readline from "node:readline";
|
|
26
26
|
import E from "node:readline";
|
|
27
|
-
import
|
|
27
|
+
import V, { stdin, stdout } from "node:process";
|
|
28
28
|
import "node:tty";
|
|
29
29
|
//#region ../../node_modules/.pnpm/@effect+platform@0.96.1_effect@3.21.2/node_modules/@effect/platform/dist/esm/Error.js
|
|
30
30
|
/**
|
|
@@ -9042,7 +9042,7 @@ function isInsideContainer() {
|
|
|
9042
9042
|
//#endregion
|
|
9043
9043
|
//#region ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
|
|
9044
9044
|
const isWsl = () => {
|
|
9045
|
-
if (
|
|
9045
|
+
if (V.platform !== "linux") return false;
|
|
9046
9046
|
if (os.release().toLowerCase().includes("microsoft")) {
|
|
9047
9047
|
if (isInsideContainer()) return false;
|
|
9048
9048
|
return true;
|
|
@@ -9053,11 +9053,11 @@ const isWsl = () => {
|
|
|
9053
9053
|
if (fs.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs.existsSync("/run/WSL")) return !isInsideContainer();
|
|
9054
9054
|
return false;
|
|
9055
9055
|
};
|
|
9056
|
-
var is_wsl_default =
|
|
9056
|
+
var is_wsl_default = V.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
9057
9057
|
//#endregion
|
|
9058
9058
|
//#region ../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
|
|
9059
9059
|
const execFile$2 = promisify(childProcess.execFile);
|
|
9060
|
-
const powerShellPath$1 = () => `${
|
|
9060
|
+
const powerShellPath$1 = () => `${V.env.SYSTEMROOT || V.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
9061
9061
|
const executePowerShell = async (command, options = {}) => {
|
|
9062
9062
|
const { powerShellPath: psPath, ...execFileOptions } = options;
|
|
9063
9063
|
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
@@ -9164,7 +9164,7 @@ function defineLazyProperty(object, propertyName, valueGetter) {
|
|
|
9164
9164
|
//#region ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
9165
9165
|
const execFileAsync$3 = promisify(execFile);
|
|
9166
9166
|
async function defaultBrowserId() {
|
|
9167
|
-
if (
|
|
9167
|
+
if (V.platform !== "darwin") throw new Error("macOS only");
|
|
9168
9168
|
const { stdout } = await execFileAsync$3("defaults", [
|
|
9169
9169
|
"read",
|
|
9170
9170
|
"com.apple.LaunchServices/com.apple.launchservices.secure",
|
|
@@ -9178,7 +9178,7 @@ async function defaultBrowserId() {
|
|
|
9178
9178
|
//#region ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
9179
9179
|
const execFileAsync$2 = promisify(execFile);
|
|
9180
9180
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
9181
|
-
if (
|
|
9181
|
+
if (V.platform !== "darwin") throw new Error("macOS only");
|
|
9182
9182
|
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
9183
9183
|
const execOptions = {};
|
|
9184
9184
|
if (signal) execOptions.signal = signal;
|
|
@@ -9289,14 +9289,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
|
|
|
9289
9289
|
const execFileAsync = promisify(execFile);
|
|
9290
9290
|
const titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
9291
9291
|
async function defaultBrowser() {
|
|
9292
|
-
if (
|
|
9292
|
+
if (V.platform === "darwin") {
|
|
9293
9293
|
const id = await defaultBrowserId();
|
|
9294
9294
|
return {
|
|
9295
9295
|
name: await bundleName(id),
|
|
9296
9296
|
id
|
|
9297
9297
|
};
|
|
9298
9298
|
}
|
|
9299
|
-
if (
|
|
9299
|
+
if (V.platform === "linux") {
|
|
9300
9300
|
const { stdout } = await execFileAsync("xdg-mime", [
|
|
9301
9301
|
"query",
|
|
9302
9302
|
"default",
|
|
@@ -9308,18 +9308,18 @@ async function defaultBrowser() {
|
|
|
9308
9308
|
id
|
|
9309
9309
|
};
|
|
9310
9310
|
}
|
|
9311
|
-
if (
|
|
9311
|
+
if (V.platform === "win32") return defaultBrowser$1();
|
|
9312
9312
|
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
9313
9313
|
}
|
|
9314
9314
|
//#endregion
|
|
9315
9315
|
//#region ../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
|
|
9316
|
-
const isInSsh = Boolean(
|
|
9316
|
+
const isInSsh = Boolean(V.env.SSH_CONNECTION || V.env.SSH_CLIENT || V.env.SSH_TTY);
|
|
9317
9317
|
//#endregion
|
|
9318
9318
|
//#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
9319
9319
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
9320
9320
|
const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
9321
9321
|
const localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
9322
|
-
const { platform: platform$1, arch: arch$1 } =
|
|
9322
|
+
const { platform: platform$1, arch: arch$1 } = V;
|
|
9323
9323
|
const tryEachApp = async (apps, opener) => {
|
|
9324
9324
|
if (apps.length === 0) return;
|
|
9325
9325
|
const errors = [];
|
|
@@ -9432,7 +9432,7 @@ const baseOpen = async (options) => {
|
|
|
9432
9432
|
await fs$1.access(localXdgOpenPath, constants.X_OK);
|
|
9433
9433
|
exeLocalXdgOpen = true;
|
|
9434
9434
|
} catch {}
|
|
9435
|
-
command =
|
|
9435
|
+
command = V.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
|
|
9436
9436
|
}
|
|
9437
9437
|
if (appArguments.length > 0) cliArguments.push(...appArguments);
|
|
9438
9438
|
if (!options.wait) {
|
|
@@ -9668,6 +9668,133 @@ const toErrorEnvelope = (err) => {
|
|
|
9668
9668
|
return envelope;
|
|
9669
9669
|
};
|
|
9670
9670
|
//#endregion
|
|
9671
|
+
//#region src/domain/runtime-flags.ts
|
|
9672
|
+
const defaultGlobalFlags = {
|
|
9673
|
+
json: false,
|
|
9674
|
+
output: "readable",
|
|
9675
|
+
quiet: false,
|
|
9676
|
+
verbose: false,
|
|
9677
|
+
dryRun: false
|
|
9678
|
+
};
|
|
9679
|
+
const VALID_OUTPUT_MODES = new Set([
|
|
9680
|
+
"pretty-json",
|
|
9681
|
+
"json",
|
|
9682
|
+
"readable",
|
|
9683
|
+
"llm",
|
|
9684
|
+
"xml"
|
|
9685
|
+
]);
|
|
9686
|
+
const isOutputMode = (s) => VALID_OUTPUT_MODES.has(s);
|
|
9687
|
+
/** Long-name flags that take a value (consume the next argv slot if no `=`). */
|
|
9688
|
+
const VALUE_FLAGS = new Set([
|
|
9689
|
+
"--output",
|
|
9690
|
+
"--api-url",
|
|
9691
|
+
"--token",
|
|
9692
|
+
"--api-key",
|
|
9693
|
+
"--lang",
|
|
9694
|
+
"--profile"
|
|
9695
|
+
]);
|
|
9696
|
+
/** Long-name boolean flags (no value). */
|
|
9697
|
+
const BOOL_FLAGS = new Set([
|
|
9698
|
+
"--json",
|
|
9699
|
+
"--quiet",
|
|
9700
|
+
"--verbose",
|
|
9701
|
+
"--dry-run"
|
|
9702
|
+
]);
|
|
9703
|
+
/** Aliases handled separately because they share the leading dash. */
|
|
9704
|
+
const SHORT_BOOL_FLAGS = { "-q": "quiet" };
|
|
9705
|
+
/**
|
|
9706
|
+
* Walk `argv` once, extracting recognized global flags and returning both the
|
|
9707
|
+
* resolved `GlobalFlags` and the residual `argv` (with those flags removed).
|
|
9708
|
+
*
|
|
9709
|
+
* Unknown flags pass through untouched — `@effect/cli` will surface them at
|
|
9710
|
+
* the proper command layer.
|
|
9711
|
+
*
|
|
9712
|
+
* Notes:
|
|
9713
|
+
* - Both `--key value` and `--key=value` are supported for value flags.
|
|
9714
|
+
* - argv[0] (node) and argv[1] (script) pass through unchanged.
|
|
9715
|
+
* - We stop processing global flags at the first `--` (POSIX convention).
|
|
9716
|
+
*/
|
|
9717
|
+
const parseGlobalFlags = (argv) => {
|
|
9718
|
+
const rest = [];
|
|
9719
|
+
let json = false;
|
|
9720
|
+
let output = "readable";
|
|
9721
|
+
let apiUrl;
|
|
9722
|
+
let token;
|
|
9723
|
+
let apiKey;
|
|
9724
|
+
let lang;
|
|
9725
|
+
let quiet = false;
|
|
9726
|
+
let verbose = false;
|
|
9727
|
+
let dryRun = false;
|
|
9728
|
+
let profile;
|
|
9729
|
+
if (argv.length > 0) rest.push(argv[0]);
|
|
9730
|
+
if (argv.length > 1) rest.push(argv[1]);
|
|
9731
|
+
let passThrough = false;
|
|
9732
|
+
for (let i = 2; i < argv.length; i++) {
|
|
9733
|
+
const arg = argv[i];
|
|
9734
|
+
if (passThrough) {
|
|
9735
|
+
rest.push(arg);
|
|
9736
|
+
continue;
|
|
9737
|
+
}
|
|
9738
|
+
if (arg === "--") {
|
|
9739
|
+
passThrough = true;
|
|
9740
|
+
rest.push(arg);
|
|
9741
|
+
continue;
|
|
9742
|
+
}
|
|
9743
|
+
if (arg.startsWith("--")) {
|
|
9744
|
+
const eqIdx = arg.indexOf("=");
|
|
9745
|
+
const name = eqIdx === -1 ? arg : arg.slice(0, eqIdx);
|
|
9746
|
+
const inlineValue = eqIdx === -1 ? void 0 : arg.slice(eqIdx + 1);
|
|
9747
|
+
if (BOOL_FLAGS.has(name)) {
|
|
9748
|
+
if (name === "--json") json = true;
|
|
9749
|
+
else if (name === "--quiet") quiet = true;
|
|
9750
|
+
else if (name === "--verbose") verbose = true;
|
|
9751
|
+
else if (name === "--dry-run") dryRun = true;
|
|
9752
|
+
continue;
|
|
9753
|
+
}
|
|
9754
|
+
if (VALUE_FLAGS.has(name)) {
|
|
9755
|
+
const value = inlineValue !== void 0 ? inlineValue : i + 1 < argv.length ? argv[++i] : void 0;
|
|
9756
|
+
if (value === void 0) continue;
|
|
9757
|
+
if (name === "--output") {
|
|
9758
|
+
if (isOutputMode(value)) output = value;
|
|
9759
|
+
} else if (name === "--api-url") apiUrl = value;
|
|
9760
|
+
else if (name === "--token") token = value;
|
|
9761
|
+
else if (name === "--api-key") apiKey = value;
|
|
9762
|
+
else if (name === "--lang") lang = value;
|
|
9763
|
+
else if (name === "--profile") profile = value;
|
|
9764
|
+
continue;
|
|
9765
|
+
}
|
|
9766
|
+
rest.push(arg);
|
|
9767
|
+
continue;
|
|
9768
|
+
}
|
|
9769
|
+
if (arg.startsWith("-") && arg.length > 1 && !arg.startsWith("--")) {
|
|
9770
|
+
if (SHORT_BOOL_FLAGS[arg] === "quiet") {
|
|
9771
|
+
quiet = true;
|
|
9772
|
+
continue;
|
|
9773
|
+
}
|
|
9774
|
+
rest.push(arg);
|
|
9775
|
+
continue;
|
|
9776
|
+
}
|
|
9777
|
+
rest.push(arg);
|
|
9778
|
+
}
|
|
9779
|
+
return {
|
|
9780
|
+
flags: {
|
|
9781
|
+
json,
|
|
9782
|
+
output: json ? "json" : output,
|
|
9783
|
+
apiUrl,
|
|
9784
|
+
token,
|
|
9785
|
+
apiKey,
|
|
9786
|
+
lang,
|
|
9787
|
+
quiet,
|
|
9788
|
+
verbose,
|
|
9789
|
+
dryRun,
|
|
9790
|
+
profile
|
|
9791
|
+
},
|
|
9792
|
+
rest
|
|
9793
|
+
};
|
|
9794
|
+
};
|
|
9795
|
+
const currentDryRun = unsafeMake(false);
|
|
9796
|
+
const currentProfileFlag = unsafeMake(void 0);
|
|
9797
|
+
//#endregion
|
|
9671
9798
|
//#region src/services/Config.ts
|
|
9672
9799
|
const DEFAULT_CLIENT_ID = "mxs-cli";
|
|
9673
9800
|
const LEGACY_CONFIG_FIELDS = [
|
|
@@ -10889,7 +11016,7 @@ var ht$1 = class extends m {
|
|
|
10889
11016
|
//#endregion
|
|
10890
11017
|
//#region ../../node_modules/.pnpm/@clack+prompts@1.4.0/node_modules/@clack/prompts/dist/index.mjs
|
|
10891
11018
|
function ee() {
|
|
10892
|
-
return
|
|
11019
|
+
return V.platform !== "win32" ? V.env.TERM !== "linux" : !!V.env.CI || !!V.env.WT_SESSION || !!V.env.TERMINUS_SUBLIME || V.env.ConEmuTask === "{cmd::Cmder}" || V.env.TERM_PROGRAM === "Terminus-Sublime" || V.env.TERM_PROGRAM === "vscode" || V.env.TERM === "xterm-256color" || V.env.TERM === "alacritty" || V.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
10893
11020
|
}
|
|
10894
11021
|
const tt = ee(), w = (t, i) => tt ? t : i, Tt = w("◆", "*"), at = w("■", "x"), ut = w("▲", "x"), H = w("◇", "o");
|
|
10895
11022
|
const $ = w("│", "|"), x = w("└", "—");
|
|
@@ -27368,8 +27495,12 @@ const login = make$13("login", { production: production$1 }, ({ production }) =>
|
|
|
27368
27495
|
const editor = yield* Editor;
|
|
27369
27496
|
const renderer = yield* Renderer;
|
|
27370
27497
|
const opts = yield* renderer.options;
|
|
27371
|
-
const
|
|
27372
|
-
|
|
27498
|
+
const flagProfile = yield* get$15(currentProfileFlag);
|
|
27499
|
+
const resolved = yield* profile.resolve(flagProfile ? { profile: flagProfile } : {}).pipe(catchTags({
|
|
27500
|
+
Generic: (e) => {
|
|
27501
|
+
return e.cause?._tag === "ConfigMissingApiUrl" ? succeed$1(null) : fail$2(e);
|
|
27502
|
+
},
|
|
27503
|
+
ProfileNotFound: () => succeed$1(null)
|
|
27373
27504
|
}));
|
|
27374
27505
|
let apiUrl;
|
|
27375
27506
|
let targetProfile;
|
|
@@ -27383,7 +27514,7 @@ const login = make$13("login", { production: production$1 }, ({ production }) =>
|
|
|
27383
27514
|
message: e.message,
|
|
27384
27515
|
cause: e
|
|
27385
27516
|
})))).baseUrl;
|
|
27386
|
-
targetProfile = yield* config.readCurrent;
|
|
27517
|
+
targetProfile = flagProfile?.trim() || (yield* config.readCurrent);
|
|
27387
27518
|
}
|
|
27388
27519
|
yield* renderer.emitInfoBlock(({ color }) => `${arrow(`probing ${apiUrl}…`, color)}`);
|
|
27389
27520
|
const probeResult = yield* auth.probe(apiUrl).pipe(mapError((e) => new Generic({
|
|
@@ -32144,7 +32275,7 @@ const parseFrontmatter = (raw, file) => {
|
|
|
32144
32275
|
if (!orderRaw) return { error: `${file}: frontmatter missing required 'order'` };
|
|
32145
32276
|
const order = Number.parseInt(orderRaw, 10);
|
|
32146
32277
|
if (!Number.isFinite(order)) return { error: `${file}: frontmatter 'order' not an integer: ${orderRaw}` };
|
|
32147
|
-
if (!/^[
|
|
32278
|
+
if (!/^[\da-z][\da-z-]*$/.test(slug)) return { error: `${file}: frontmatter 'slug' not kebab-case: ${slug}` };
|
|
32148
32279
|
return {
|
|
32149
32280
|
slug,
|
|
32150
32281
|
title,
|
|
@@ -32198,7 +32329,7 @@ const stripAnyFrontmatter = (raw) => {
|
|
|
32198
32329
|
body
|
|
32199
32330
|
};
|
|
32200
32331
|
};
|
|
32201
|
-
const humanizeBase = (name) => name.
|
|
32332
|
+
const humanizeBase = (name) => name.replaceAll(/[_-]+/g, " ").replaceAll(/\b\w/g, (c) => c.toUpperCase());
|
|
32202
32333
|
const firstNonEmptyLine = (body) => {
|
|
32203
32334
|
for (const line of body.split("\n")) {
|
|
32204
32335
|
const trimmed = line.trim();
|
|
@@ -32280,7 +32411,7 @@ const buildSnippets = (body, keyword) => {
|
|
|
32280
32411
|
if (idx < 0) break;
|
|
32281
32412
|
const start = Math.max(0, idx - 60);
|
|
32282
32413
|
const end = Math.min(body.length, idx + keyword.length + 60);
|
|
32283
|
-
let snippet = body.slice(start, end).
|
|
32414
|
+
let snippet = body.slice(start, end).replaceAll(/\s+/g, " ").trim();
|
|
32284
32415
|
if (start > 0) snippet = `…${snippet}`;
|
|
32285
32416
|
if (end < body.length) snippet = `${snippet}…`;
|
|
32286
32417
|
out.push(snippet);
|
|
@@ -34964,132 +35095,6 @@ const FLAG_TAKES_VALUE = new Set([
|
|
|
34964
35095
|
"--profile"
|
|
34965
35096
|
]);
|
|
34966
35097
|
//#endregion
|
|
34967
|
-
//#region src/domain/runtime-flags.ts
|
|
34968
|
-
const defaultGlobalFlags = {
|
|
34969
|
-
json: false,
|
|
34970
|
-
output: "readable",
|
|
34971
|
-
quiet: false,
|
|
34972
|
-
verbose: false,
|
|
34973
|
-
dryRun: false
|
|
34974
|
-
};
|
|
34975
|
-
const VALID_OUTPUT_MODES = new Set([
|
|
34976
|
-
"pretty-json",
|
|
34977
|
-
"json",
|
|
34978
|
-
"readable",
|
|
34979
|
-
"llm",
|
|
34980
|
-
"xml"
|
|
34981
|
-
]);
|
|
34982
|
-
const isOutputMode = (s) => VALID_OUTPUT_MODES.has(s);
|
|
34983
|
-
/** Long-name flags that take a value (consume the next argv slot if no `=`). */
|
|
34984
|
-
const VALUE_FLAGS = new Set([
|
|
34985
|
-
"--output",
|
|
34986
|
-
"--api-url",
|
|
34987
|
-
"--token",
|
|
34988
|
-
"--api-key",
|
|
34989
|
-
"--lang",
|
|
34990
|
-
"--profile"
|
|
34991
|
-
]);
|
|
34992
|
-
/** Long-name boolean flags (no value). */
|
|
34993
|
-
const BOOL_FLAGS = new Set([
|
|
34994
|
-
"--json",
|
|
34995
|
-
"--quiet",
|
|
34996
|
-
"--verbose",
|
|
34997
|
-
"--dry-run"
|
|
34998
|
-
]);
|
|
34999
|
-
/** Aliases handled separately because they share the leading dash. */
|
|
35000
|
-
const SHORT_BOOL_FLAGS = { "-q": "quiet" };
|
|
35001
|
-
/**
|
|
35002
|
-
* Walk `argv` once, extracting recognized global flags and returning both the
|
|
35003
|
-
* resolved `GlobalFlags` and the residual `argv` (with those flags removed).
|
|
35004
|
-
*
|
|
35005
|
-
* Unknown flags pass through untouched — `@effect/cli` will surface them at
|
|
35006
|
-
* the proper command layer.
|
|
35007
|
-
*
|
|
35008
|
-
* Notes:
|
|
35009
|
-
* - Both `--key value` and `--key=value` are supported for value flags.
|
|
35010
|
-
* - argv[0] (node) and argv[1] (script) pass through unchanged.
|
|
35011
|
-
* - We stop processing global flags at the first `--` (POSIX convention).
|
|
35012
|
-
*/
|
|
35013
|
-
const parseGlobalFlags = (argv) => {
|
|
35014
|
-
const rest = [];
|
|
35015
|
-
let json = false;
|
|
35016
|
-
let output = "readable";
|
|
35017
|
-
let apiUrl;
|
|
35018
|
-
let token;
|
|
35019
|
-
let apiKey;
|
|
35020
|
-
let lang;
|
|
35021
|
-
let quiet = false;
|
|
35022
|
-
let verbose = false;
|
|
35023
|
-
let dryRun = false;
|
|
35024
|
-
let profile;
|
|
35025
|
-
if (argv.length > 0) rest.push(argv[0]);
|
|
35026
|
-
if (argv.length > 1) rest.push(argv[1]);
|
|
35027
|
-
let passThrough = false;
|
|
35028
|
-
for (let i = 2; i < argv.length; i++) {
|
|
35029
|
-
const arg = argv[i];
|
|
35030
|
-
if (passThrough) {
|
|
35031
|
-
rest.push(arg);
|
|
35032
|
-
continue;
|
|
35033
|
-
}
|
|
35034
|
-
if (arg === "--") {
|
|
35035
|
-
passThrough = true;
|
|
35036
|
-
rest.push(arg);
|
|
35037
|
-
continue;
|
|
35038
|
-
}
|
|
35039
|
-
if (arg.startsWith("--")) {
|
|
35040
|
-
const eqIdx = arg.indexOf("=");
|
|
35041
|
-
const name = eqIdx === -1 ? arg : arg.slice(0, eqIdx);
|
|
35042
|
-
const inlineValue = eqIdx === -1 ? void 0 : arg.slice(eqIdx + 1);
|
|
35043
|
-
if (BOOL_FLAGS.has(name)) {
|
|
35044
|
-
if (name === "--json") json = true;
|
|
35045
|
-
else if (name === "--quiet") quiet = true;
|
|
35046
|
-
else if (name === "--verbose") verbose = true;
|
|
35047
|
-
else if (name === "--dry-run") dryRun = true;
|
|
35048
|
-
continue;
|
|
35049
|
-
}
|
|
35050
|
-
if (VALUE_FLAGS.has(name)) {
|
|
35051
|
-
const value = inlineValue !== void 0 ? inlineValue : i + 1 < argv.length ? argv[++i] : void 0;
|
|
35052
|
-
if (value === void 0) continue;
|
|
35053
|
-
if (name === "--output") {
|
|
35054
|
-
if (isOutputMode(value)) output = value;
|
|
35055
|
-
} else if (name === "--api-url") apiUrl = value;
|
|
35056
|
-
else if (name === "--token") token = value;
|
|
35057
|
-
else if (name === "--api-key") apiKey = value;
|
|
35058
|
-
else if (name === "--lang") lang = value;
|
|
35059
|
-
else if (name === "--profile") profile = value;
|
|
35060
|
-
continue;
|
|
35061
|
-
}
|
|
35062
|
-
rest.push(arg);
|
|
35063
|
-
continue;
|
|
35064
|
-
}
|
|
35065
|
-
if (arg.startsWith("-") && arg.length > 1 && !arg.startsWith("--")) {
|
|
35066
|
-
if (SHORT_BOOL_FLAGS[arg] === "quiet") {
|
|
35067
|
-
quiet = true;
|
|
35068
|
-
continue;
|
|
35069
|
-
}
|
|
35070
|
-
rest.push(arg);
|
|
35071
|
-
continue;
|
|
35072
|
-
}
|
|
35073
|
-
rest.push(arg);
|
|
35074
|
-
}
|
|
35075
|
-
return {
|
|
35076
|
-
flags: {
|
|
35077
|
-
json,
|
|
35078
|
-
output: json ? "json" : output,
|
|
35079
|
-
apiUrl,
|
|
35080
|
-
token,
|
|
35081
|
-
apiKey,
|
|
35082
|
-
lang,
|
|
35083
|
-
quiet,
|
|
35084
|
-
verbose,
|
|
35085
|
-
dryRun,
|
|
35086
|
-
profile
|
|
35087
|
-
},
|
|
35088
|
-
rest
|
|
35089
|
-
};
|
|
35090
|
-
};
|
|
35091
|
-
const currentDryRun = unsafeMake(false);
|
|
35092
|
-
//#endregion
|
|
35093
35098
|
//#region src/services/Migration.ts
|
|
35094
35099
|
const emit = (report, line) => {
|
|
35095
35100
|
if (report === null) return;
|
|
@@ -35370,7 +35375,7 @@ const run = (argv) => {
|
|
|
35370
35375
|
name: "mxs",
|
|
35371
35376
|
version: CLI_VERSION
|
|
35372
35377
|
});
|
|
35373
|
-
return runMain(locally(locally(preflight(flags).pipe(zipRight(cli(parsed.rest)), tapError((err) => isCliError(err) ? flatMap$1(Renderer, (r) => r.emitError(err)) : sync(() => void 0)), catchAll((err) => sync(() => {
|
|
35378
|
+
return runMain(locally(locally(locally(preflight(flags).pipe(zipRight(cli(parsed.rest)), tapError((err) => isCliError(err) ? flatMap$1(Renderer, (r) => r.emitError(err)) : sync(() => void 0)), catchAll((err) => sync(() => {
|
|
35374
35379
|
const tag = isCliError(err) ? err._tag : "Generic";
|
|
35375
35380
|
process.exit(exitCodeForTag(tag));
|
|
35376
35381
|
}))), currentOutputOptions, {
|
|
@@ -35378,7 +35383,7 @@ const run = (argv) => {
|
|
|
35378
35383
|
output: flags.output,
|
|
35379
35384
|
quiet: flags.quiet,
|
|
35380
35385
|
verbose: flags.verbose
|
|
35381
|
-
}), currentDryRun, flags.dryRun).pipe(catchAllDefect((defect) => sync(() => {
|
|
35386
|
+
}), currentDryRun, flags.dryRun), currentProfileFlag, flags.profile?.trim() || void 0).pipe(catchAllDefect((defect) => sync(() => {
|
|
35382
35387
|
process.stderr.write(`mxs: internal error\n${String(defect)}\n`);
|
|
35383
35388
|
process.exit(1);
|
|
35384
35389
|
})), provide$1(fullAppLayer), provide$1(layer)));
|