@mx-space/cli 0.6.4 → 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-BGjeCBcT.mjs → mxs-DUkVdHhE.mjs} +156 -149
- package/package.json +2 -2
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("└", "—");
|
|
@@ -12483,7 +12610,7 @@ function customAlphabet(alphabet, size = 21) {
|
|
|
12483
12610
|
return customRandom(alphabet, size, random);
|
|
12484
12611
|
}
|
|
12485
12612
|
//#endregion
|
|
12486
|
-
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.
|
|
12613
|
+
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.3/node_modules/@haklex/rich-litexml/dist/src-Chu1pfGY.js
|
|
12487
12614
|
var impl = null;
|
|
12488
12615
|
function registerParseHTML(fn) {
|
|
12489
12616
|
impl = fn;
|
|
@@ -13510,6 +13637,7 @@ function deserializeFromXml(xml, registry) {
|
|
|
13510
13637
|
}
|
|
13511
13638
|
/** Structural containers whose whitespace-only text nodes are layout artifacts, not content */
|
|
13512
13639
|
var BLOCK_TAGS = new Set([
|
|
13640
|
+
"body",
|
|
13513
13641
|
"doc",
|
|
13514
13642
|
"fragment",
|
|
13515
13643
|
"root",
|
|
@@ -24750,7 +24878,7 @@ function Document() {
|
|
|
24750
24878
|
}
|
|
24751
24879
|
setPrototypeOf(Document, Document$1).prototype = Document$1.prototype;
|
|
24752
24880
|
//#endregion
|
|
24753
|
-
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.
|
|
24881
|
+
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.3/node_modules/@haklex/rich-litexml/dist/node.mjs
|
|
24754
24882
|
registerParseHTML((html) => parseHTML(html).document);
|
|
24755
24883
|
//#endregion
|
|
24756
24884
|
//#region src/services/Renderer/content.ts
|
|
@@ -27367,8 +27495,12 @@ const login = make$13("login", { production: production$1 }, ({ production }) =>
|
|
|
27367
27495
|
const editor = yield* Editor;
|
|
27368
27496
|
const renderer = yield* Renderer;
|
|
27369
27497
|
const opts = yield* renderer.options;
|
|
27370
|
-
const
|
|
27371
|
-
|
|
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)
|
|
27372
27504
|
}));
|
|
27373
27505
|
let apiUrl;
|
|
27374
27506
|
let targetProfile;
|
|
@@ -27382,7 +27514,7 @@ const login = make$13("login", { production: production$1 }, ({ production }) =>
|
|
|
27382
27514
|
message: e.message,
|
|
27383
27515
|
cause: e
|
|
27384
27516
|
})))).baseUrl;
|
|
27385
|
-
targetProfile = yield* config.readCurrent;
|
|
27517
|
+
targetProfile = flagProfile?.trim() || (yield* config.readCurrent);
|
|
27386
27518
|
}
|
|
27387
27519
|
yield* renderer.emitInfoBlock(({ color }) => `${arrow(`probing ${apiUrl}…`, color)}`);
|
|
27388
27520
|
const probeResult = yield* auth.probe(apiUrl).pipe(mapError((e) => new Generic({
|
|
@@ -31883,6 +32015,7 @@ const previewCmd = make$13("preview", {
|
|
|
31883
32015
|
} catch (err) {
|
|
31884
32016
|
return yield* fail$2(err instanceof ValidationXml ? err : new ValidationXml({ message: err instanceof Error ? err.message : String(err) }));
|
|
31885
32017
|
}
|
|
32018
|
+
if (!body.includes("<doc")) body = `<doc>${body}</doc>`;
|
|
31886
32019
|
const resolvedVariant = getOrElse(variant, () => detectedVariant);
|
|
31887
32020
|
const resolvedTheme = getOrUndefined(theme);
|
|
31888
32021
|
const savePath = getOrUndefined(save);
|
|
@@ -32142,7 +32275,7 @@ const parseFrontmatter = (raw, file) => {
|
|
|
32142
32275
|
if (!orderRaw) return { error: `${file}: frontmatter missing required 'order'` };
|
|
32143
32276
|
const order = Number.parseInt(orderRaw, 10);
|
|
32144
32277
|
if (!Number.isFinite(order)) return { error: `${file}: frontmatter 'order' not an integer: ${orderRaw}` };
|
|
32145
|
-
if (!/^[
|
|
32278
|
+
if (!/^[\da-z][\da-z-]*$/.test(slug)) return { error: `${file}: frontmatter 'slug' not kebab-case: ${slug}` };
|
|
32146
32279
|
return {
|
|
32147
32280
|
slug,
|
|
32148
32281
|
title,
|
|
@@ -32196,7 +32329,7 @@ const stripAnyFrontmatter = (raw) => {
|
|
|
32196
32329
|
body
|
|
32197
32330
|
};
|
|
32198
32331
|
};
|
|
32199
|
-
const humanizeBase = (name) => name.
|
|
32332
|
+
const humanizeBase = (name) => name.replaceAll(/[_-]+/g, " ").replaceAll(/\b\w/g, (c) => c.toUpperCase());
|
|
32200
32333
|
const firstNonEmptyLine = (body) => {
|
|
32201
32334
|
for (const line of body.split("\n")) {
|
|
32202
32335
|
const trimmed = line.trim();
|
|
@@ -32278,7 +32411,7 @@ const buildSnippets = (body, keyword) => {
|
|
|
32278
32411
|
if (idx < 0) break;
|
|
32279
32412
|
const start = Math.max(0, idx - 60);
|
|
32280
32413
|
const end = Math.min(body.length, idx + keyword.length + 60);
|
|
32281
|
-
let snippet = body.slice(start, end).
|
|
32414
|
+
let snippet = body.slice(start, end).replaceAll(/\s+/g, " ").trim();
|
|
32282
32415
|
if (start > 0) snippet = `…${snippet}`;
|
|
32283
32416
|
if (end < body.length) snippet = `${snippet}…`;
|
|
32284
32417
|
out.push(snippet);
|
|
@@ -34962,132 +35095,6 @@ const FLAG_TAKES_VALUE = new Set([
|
|
|
34962
35095
|
"--profile"
|
|
34963
35096
|
]);
|
|
34964
35097
|
//#endregion
|
|
34965
|
-
//#region src/domain/runtime-flags.ts
|
|
34966
|
-
const defaultGlobalFlags = {
|
|
34967
|
-
json: false,
|
|
34968
|
-
output: "readable",
|
|
34969
|
-
quiet: false,
|
|
34970
|
-
verbose: false,
|
|
34971
|
-
dryRun: false
|
|
34972
|
-
};
|
|
34973
|
-
const VALID_OUTPUT_MODES = new Set([
|
|
34974
|
-
"pretty-json",
|
|
34975
|
-
"json",
|
|
34976
|
-
"readable",
|
|
34977
|
-
"llm",
|
|
34978
|
-
"xml"
|
|
34979
|
-
]);
|
|
34980
|
-
const isOutputMode = (s) => VALID_OUTPUT_MODES.has(s);
|
|
34981
|
-
/** Long-name flags that take a value (consume the next argv slot if no `=`). */
|
|
34982
|
-
const VALUE_FLAGS = new Set([
|
|
34983
|
-
"--output",
|
|
34984
|
-
"--api-url",
|
|
34985
|
-
"--token",
|
|
34986
|
-
"--api-key",
|
|
34987
|
-
"--lang",
|
|
34988
|
-
"--profile"
|
|
34989
|
-
]);
|
|
34990
|
-
/** Long-name boolean flags (no value). */
|
|
34991
|
-
const BOOL_FLAGS = new Set([
|
|
34992
|
-
"--json",
|
|
34993
|
-
"--quiet",
|
|
34994
|
-
"--verbose",
|
|
34995
|
-
"--dry-run"
|
|
34996
|
-
]);
|
|
34997
|
-
/** Aliases handled separately because they share the leading dash. */
|
|
34998
|
-
const SHORT_BOOL_FLAGS = { "-q": "quiet" };
|
|
34999
|
-
/**
|
|
35000
|
-
* Walk `argv` once, extracting recognized global flags and returning both the
|
|
35001
|
-
* resolved `GlobalFlags` and the residual `argv` (with those flags removed).
|
|
35002
|
-
*
|
|
35003
|
-
* Unknown flags pass through untouched — `@effect/cli` will surface them at
|
|
35004
|
-
* the proper command layer.
|
|
35005
|
-
*
|
|
35006
|
-
* Notes:
|
|
35007
|
-
* - Both `--key value` and `--key=value` are supported for value flags.
|
|
35008
|
-
* - argv[0] (node) and argv[1] (script) pass through unchanged.
|
|
35009
|
-
* - We stop processing global flags at the first `--` (POSIX convention).
|
|
35010
|
-
*/
|
|
35011
|
-
const parseGlobalFlags = (argv) => {
|
|
35012
|
-
const rest = [];
|
|
35013
|
-
let json = false;
|
|
35014
|
-
let output = "readable";
|
|
35015
|
-
let apiUrl;
|
|
35016
|
-
let token;
|
|
35017
|
-
let apiKey;
|
|
35018
|
-
let lang;
|
|
35019
|
-
let quiet = false;
|
|
35020
|
-
let verbose = false;
|
|
35021
|
-
let dryRun = false;
|
|
35022
|
-
let profile;
|
|
35023
|
-
if (argv.length > 0) rest.push(argv[0]);
|
|
35024
|
-
if (argv.length > 1) rest.push(argv[1]);
|
|
35025
|
-
let passThrough = false;
|
|
35026
|
-
for (let i = 2; i < argv.length; i++) {
|
|
35027
|
-
const arg = argv[i];
|
|
35028
|
-
if (passThrough) {
|
|
35029
|
-
rest.push(arg);
|
|
35030
|
-
continue;
|
|
35031
|
-
}
|
|
35032
|
-
if (arg === "--") {
|
|
35033
|
-
passThrough = true;
|
|
35034
|
-
rest.push(arg);
|
|
35035
|
-
continue;
|
|
35036
|
-
}
|
|
35037
|
-
if (arg.startsWith("--")) {
|
|
35038
|
-
const eqIdx = arg.indexOf("=");
|
|
35039
|
-
const name = eqIdx === -1 ? arg : arg.slice(0, eqIdx);
|
|
35040
|
-
const inlineValue = eqIdx === -1 ? void 0 : arg.slice(eqIdx + 1);
|
|
35041
|
-
if (BOOL_FLAGS.has(name)) {
|
|
35042
|
-
if (name === "--json") json = true;
|
|
35043
|
-
else if (name === "--quiet") quiet = true;
|
|
35044
|
-
else if (name === "--verbose") verbose = true;
|
|
35045
|
-
else if (name === "--dry-run") dryRun = true;
|
|
35046
|
-
continue;
|
|
35047
|
-
}
|
|
35048
|
-
if (VALUE_FLAGS.has(name)) {
|
|
35049
|
-
const value = inlineValue !== void 0 ? inlineValue : i + 1 < argv.length ? argv[++i] : void 0;
|
|
35050
|
-
if (value === void 0) continue;
|
|
35051
|
-
if (name === "--output") {
|
|
35052
|
-
if (isOutputMode(value)) output = value;
|
|
35053
|
-
} else if (name === "--api-url") apiUrl = value;
|
|
35054
|
-
else if (name === "--token") token = value;
|
|
35055
|
-
else if (name === "--api-key") apiKey = value;
|
|
35056
|
-
else if (name === "--lang") lang = value;
|
|
35057
|
-
else if (name === "--profile") profile = value;
|
|
35058
|
-
continue;
|
|
35059
|
-
}
|
|
35060
|
-
rest.push(arg);
|
|
35061
|
-
continue;
|
|
35062
|
-
}
|
|
35063
|
-
if (arg.startsWith("-") && arg.length > 1 && !arg.startsWith("--")) {
|
|
35064
|
-
if (SHORT_BOOL_FLAGS[arg] === "quiet") {
|
|
35065
|
-
quiet = true;
|
|
35066
|
-
continue;
|
|
35067
|
-
}
|
|
35068
|
-
rest.push(arg);
|
|
35069
|
-
continue;
|
|
35070
|
-
}
|
|
35071
|
-
rest.push(arg);
|
|
35072
|
-
}
|
|
35073
|
-
return {
|
|
35074
|
-
flags: {
|
|
35075
|
-
json,
|
|
35076
|
-
output: json ? "json" : output,
|
|
35077
|
-
apiUrl,
|
|
35078
|
-
token,
|
|
35079
|
-
apiKey,
|
|
35080
|
-
lang,
|
|
35081
|
-
quiet,
|
|
35082
|
-
verbose,
|
|
35083
|
-
dryRun,
|
|
35084
|
-
profile
|
|
35085
|
-
},
|
|
35086
|
-
rest
|
|
35087
|
-
};
|
|
35088
|
-
};
|
|
35089
|
-
const currentDryRun = unsafeMake(false);
|
|
35090
|
-
//#endregion
|
|
35091
35098
|
//#region src/services/Migration.ts
|
|
35092
35099
|
const emit = (report, line) => {
|
|
35093
35100
|
if (report === null) return;
|
|
@@ -35368,7 +35375,7 @@ const run = (argv) => {
|
|
|
35368
35375
|
name: "mxs",
|
|
35369
35376
|
version: CLI_VERSION
|
|
35370
35377
|
});
|
|
35371
|
-
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(() => {
|
|
35372
35379
|
const tag = isCliError(err) ? err._tag : "Generic";
|
|
35373
35380
|
process.exit(exitCodeForTag(tag));
|
|
35374
35381
|
}))), currentOutputOptions, {
|
|
@@ -35376,7 +35383,7 @@ const run = (argv) => {
|
|
|
35376
35383
|
output: flags.output,
|
|
35377
35384
|
quiet: flags.quiet,
|
|
35378
35385
|
verbose: flags.verbose
|
|
35379
|
-
}), currentDryRun, flags.dryRun).pipe(catchAllDefect((defect) => sync(() => {
|
|
35386
|
+
}), currentDryRun, flags.dryRun), currentProfileFlag, flags.profile?.trim() || void 0).pipe(catchAllDefect((defect) => sync(() => {
|
|
35380
35387
|
process.stderr.write(`mxs: internal error\n${String(defect)}\n`);
|
|
35381
35388
|
process.exit(1);
|
|
35382
35389
|
})), provide$1(fullAppLayer), provide$1(layer)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mx-space/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mx-space",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@effect/platform": "0.96.1",
|
|
54
54
|
"@effect/platform-node": "0.106.0",
|
|
55
55
|
"@haklex/rich-headless": "0.13.0",
|
|
56
|
-
"@haklex/rich-litexml": "0.15.
|
|
56
|
+
"@haklex/rich-litexml": "0.15.3",
|
|
57
57
|
"@haklex/rich-litexml-cli": "0.15.3",
|
|
58
58
|
"@lexical/headless": "^0.44.0",
|
|
59
59
|
"better-auth": "^1.6.9",
|