@mx-space/cli 0.6.5 → 0.6.7

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 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
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { t as run } from "../mxs-lcMA5vod.mjs";
2
+ import { t as run } from "../mxs-DvtFbS0U.mjs";
3
3
  export { run };
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-lcMA5vod.mjs";
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-DvtFbS0U.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 process$1, { stdin, stdout } from "node:process";
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 (process$1.platform !== "linux") return false;
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 = process$1.env.__IS_WSL_TEST__ ? isWsl : isWsl();
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 = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
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 (process$1.platform !== "darwin") throw new Error("macOS only");
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 (process$1.platform !== "darwin") throw new Error("macOS only");
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 (process$1.platform === "darwin") {
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 (process$1.platform === "linux") {
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 (process$1.platform === "win32") return defaultBrowser$1();
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(process$1.env.SSH_CONNECTION || process$1.env.SSH_CLIENT || process$1.env.SSH_TTY);
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 } = process$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 = process$1.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
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 = [
@@ -9915,7 +10042,7 @@ var Config = class Config extends Tag$2("Config")() {
9915
10042
  };
9916
10043
  //#endregion
9917
10044
  //#region src/services/Auth.ts
9918
- const SUPPORTED_API_VERSIONS = [2];
10045
+ const SUPPORTED_API_VERSIONS = [3, 2];
9919
10046
  var Auth = class Auth extends Tag$2("Auth")() {
9920
10047
  /** Build the Auth Layer; depends on `Config` and `HttpClient`. */
9921
10048
  static Default = effect(Auth, gen(function* () {
@@ -9985,13 +10112,19 @@ function makeAuthService(http, config) {
9985
10112
  version: null
9986
10113
  }];
9987
10114
  let lastTransport = null;
10115
+ const attempted = [];
9988
10116
  for (const cand of candidates) {
9989
- const result = yield* sendJson(`${apiUrl}${cand.prefix}/ok`, "GET", void 0, { accept: "application/json" }).pipe(either);
10117
+ const probeUrl = `${apiUrl}${cand.prefix}/ok`;
10118
+ const result = yield* sendJson(probeUrl, "GET", void 0, { accept: "application/json" }).pipe(either);
9990
10119
  if (result._tag === "Left") {
9991
10120
  lastTransport = result.left;
9992
10121
  continue;
9993
10122
  }
9994
10123
  const res = result.right;
10124
+ attempted.push({
10125
+ url: probeUrl,
10126
+ status: res.status
10127
+ });
9995
10128
  if (res.status >= 200 && res.status < 300) {
9996
10129
  const apiVersion = cand.version ?? SUPPORTED_API_VERSIONS[0];
9997
10130
  return {
@@ -10005,7 +10138,7 @@ function makeAuthService(http, config) {
10005
10138
  if (lastTransport && lastTransport._tag !== "Generic") return yield* fail$2(lastTransport);
10006
10139
  return yield* fail$2(new AuthProbe({
10007
10140
  message: "cannot detect auth endpoint",
10008
- hint: "verify the URL points at a running mx-core server"
10141
+ hint: `tried: ${attempted.length > 0 ? attempted.map((a) => `${a.url} → ${a.status}`).join(", ") : "no responses"}. supply the site root (e.g. https://blog.example.com), not the API path. verify the server is reachable and runs a supported API version (${SUPPORTED_API_VERSIONS.join(", ")}).`
10009
10142
  }));
10010
10143
  });
10011
10144
  const requestDeviceCode = (authBase, clientId, scope = "openid profile email") => gen(function* () {
@@ -10889,7 +11022,7 @@ var ht$1 = class extends m {
10889
11022
  //#endregion
10890
11023
  //#region ../../node_modules/.pnpm/@clack+prompts@1.4.0/node_modules/@clack/prompts/dist/index.mjs
10891
11024
  function ee() {
10892
- return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
11025
+ 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
11026
  }
10894
11027
  const tt = ee(), w = (t, i) => tt ? t : i, Tt = w("◆", "*"), at = w("■", "x"), ut = w("▲", "x"), H = w("◇", "o");
10895
11028
  const $ = w("│", "|"), x = w("└", "—");
@@ -27368,8 +27501,12 @@ const login = make$13("login", { production: production$1 }, ({ production }) =>
27368
27501
  const editor = yield* Editor;
27369
27502
  const renderer = yield* Renderer;
27370
27503
  const opts = yield* renderer.options;
27371
- const resolved = yield* profile.resolve().pipe(catchTag("Generic", (e) => {
27372
- return e.cause?._tag === "ConfigMissingApiUrl" ? succeed$1(null) : fail$2(e);
27504
+ const flagProfile = yield* get$15(currentProfileFlag);
27505
+ const resolved = yield* profile.resolve(flagProfile ? { profile: flagProfile } : {}).pipe(catchTags({
27506
+ Generic: (e) => {
27507
+ return e.cause?._tag === "ConfigMissingApiUrl" ? succeed$1(null) : fail$2(e);
27508
+ },
27509
+ ProfileNotFound: () => succeed$1(null)
27373
27510
  }));
27374
27511
  let apiUrl;
27375
27512
  let targetProfile;
@@ -27383,7 +27520,7 @@ const login = make$13("login", { production: production$1 }, ({ production }) =>
27383
27520
  message: e.message,
27384
27521
  cause: e
27385
27522
  })))).baseUrl;
27386
- targetProfile = yield* config.readCurrent;
27523
+ targetProfile = flagProfile?.trim() || (yield* config.readCurrent);
27387
27524
  }
27388
27525
  yield* renderer.emitInfoBlock(({ color }) => `${arrow(`probing ${apiUrl}…`, color)}`);
27389
27526
  const probeResult = yield* auth.probe(apiUrl).pipe(mapError((e) => new Generic({
@@ -32144,7 +32281,7 @@ const parseFrontmatter = (raw, file) => {
32144
32281
  if (!orderRaw) return { error: `${file}: frontmatter missing required 'order'` };
32145
32282
  const order = Number.parseInt(orderRaw, 10);
32146
32283
  if (!Number.isFinite(order)) return { error: `${file}: frontmatter 'order' not an integer: ${orderRaw}` };
32147
- if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return { error: `${file}: frontmatter 'slug' not kebab-case: ${slug}` };
32284
+ if (!/^[\da-z][\da-z-]*$/.test(slug)) return { error: `${file}: frontmatter 'slug' not kebab-case: ${slug}` };
32148
32285
  return {
32149
32286
  slug,
32150
32287
  title,
@@ -32198,7 +32335,7 @@ const stripAnyFrontmatter = (raw) => {
32198
32335
  body
32199
32336
  };
32200
32337
  };
32201
- const humanizeBase = (name) => name.replace(/[-_]+/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
32338
+ const humanizeBase = (name) => name.replaceAll(/[_-]+/g, " ").replaceAll(/\b\w/g, (c) => c.toUpperCase());
32202
32339
  const firstNonEmptyLine = (body) => {
32203
32340
  for (const line of body.split("\n")) {
32204
32341
  const trimmed = line.trim();
@@ -32280,7 +32417,7 @@ const buildSnippets = (body, keyword) => {
32280
32417
  if (idx < 0) break;
32281
32418
  const start = Math.max(0, idx - 60);
32282
32419
  const end = Math.min(body.length, idx + keyword.length + 60);
32283
- let snippet = body.slice(start, end).replace(/\s+/g, " ").trim();
32420
+ let snippet = body.slice(start, end).replaceAll(/\s+/g, " ").trim();
32284
32421
  if (start > 0) snippet = `…${snippet}`;
32285
32422
  if (end < body.length) snippet = `${snippet}…`;
32286
32423
  out.push(snippet);
@@ -34964,132 +35101,6 @@ const FLAG_TAKES_VALUE = new Set([
34964
35101
  "--profile"
34965
35102
  ]);
34966
35103
  //#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
35104
  //#region src/services/Migration.ts
35094
35105
  const emit = (report, line) => {
35095
35106
  if (report === null) return;
@@ -35370,7 +35381,7 @@ const run = (argv) => {
35370
35381
  name: "mxs",
35371
35382
  version: CLI_VERSION
35372
35383
  });
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(() => {
35384
+ 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
35385
  const tag = isCliError(err) ? err._tag : "Generic";
35375
35386
  process.exit(exitCodeForTag(tag));
35376
35387
  }))), currentOutputOptions, {
@@ -35378,7 +35389,7 @@ const run = (argv) => {
35378
35389
  output: flags.output,
35379
35390
  quiet: flags.quiet,
35380
35391
  verbose: flags.verbose
35381
- }), currentDryRun, flags.dryRun).pipe(catchAllDefect((defect) => sync(() => {
35392
+ }), currentDryRun, flags.dryRun), currentProfileFlag, flags.profile?.trim() || void 0).pipe(catchAllDefect((defect) => sync(() => {
35382
35393
  process.stderr.write(`mxs: internal error\n${String(defect)}\n`);
35383
35394
  process.exit(1);
35384
35395
  })), 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.5",
3
+ "version": "0.6.7",
4
4
  "description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
5
5
  "keywords": [
6
6
  "mx-space",