@morphixai/mxenv-cli 0.12.0 → 0.12.1

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
@@ -8,6 +8,8 @@ L3 management face for [mxenv](https://github.com/Morphicai/morphix-env) — mac
8
8
  npm i -g @morphixai/mxenv-cli
9
9
  ```
10
10
 
11
+ > ⚠️ **Do not install `@morphixai/mxenv-cli` and `@morphixai/mxenv` globally side by side** — both register the `mxenv`/`mx-env`/`morphix-env` bin names and the later install silently takes over the symlinks. Keep `mxenv` as a project devDependency and install this package globally (or vice versa, never both).
12
+
11
13
  ## Commands
12
14
 
13
15
  - `mxenv-cli shell-init` — generate/remove PATH shims and the marked rc block (global + project shim manifests)
package/dist/cli.js CHANGED
@@ -85,27 +85,29 @@ function writeShims(commands, homeDir = (0, import_os.homedir)()) {
85
85
  return { written, removed, skipped };
86
86
  }
87
87
  function removeAllShims(homeDir = (0, import_os.homedir)()) {
88
- const dir = (0, import_mxenv_core.shimsDir)(homeDir);
89
- if (!(0, import_fs.existsSync)(dir)) return [];
90
88
  const removed = [];
91
- for (const file of (0, import_fs.readdirSync)(dir)) {
92
- const path = (0, import_path.join)(dir, file);
93
- const content = readIfExists(path);
94
- if (content !== null && isGeneratedShim(content)) {
95
- (0, import_fs.rmSync)(path);
96
- removed.push(file);
89
+ for (const dir of [(0, import_mxenv_core.shimsDir)(homeDir), (0, import_mxenv_core.legacyShimsDir)(homeDir)]) {
90
+ if (!(0, import_fs.existsSync)(dir)) continue;
91
+ for (const file of (0, import_fs.readdirSync)(dir)) {
92
+ const path = (0, import_path.join)(dir, file);
93
+ const content = readIfExists(path);
94
+ if (content !== null && isGeneratedShim(content)) {
95
+ (0, import_fs.rmSync)(path);
96
+ removed.push(file);
97
+ }
97
98
  }
98
99
  }
99
100
  return removed;
100
101
  }
101
102
  function detectHandmadeReservedShims(homeDir = (0, import_os.homedir)()) {
102
- const dir = (0, import_mxenv_core.shimsDir)(homeDir);
103
- if (!(0, import_fs.existsSync)(dir)) return [];
104
103
  const found = [];
105
- for (const file of (0, import_fs.readdirSync)(dir)) {
106
- if (!import_mxenv_core.RESERVED_SHIM_NAMES.includes(file.toLowerCase())) continue;
107
- const content = readIfExists((0, import_path.join)(dir, file));
108
- if (content === null || !isGeneratedShim(content)) found.push(file);
104
+ for (const dir of [(0, import_mxenv_core.shimsDir)(homeDir), (0, import_mxenv_core.legacyShimsDir)(homeDir)]) {
105
+ if (!(0, import_fs.existsSync)(dir)) continue;
106
+ for (const file of (0, import_fs.readdirSync)(dir)) {
107
+ if (!import_mxenv_core.RESERVED_SHIM_NAMES.includes(file.toLowerCase())) continue;
108
+ const content = readIfExists((0, import_path.join)(dir, file));
109
+ if (content === null || !isGeneratedShim(content)) found.push(file);
110
+ }
109
111
  }
110
112
  return found;
111
113
  }
@@ -171,7 +173,7 @@ function findShadowedCommands(commands, originalPath, homeDir = (0, import_os.ho
171
173
  // package.json
172
174
  var package_default = {
173
175
  name: "@morphixai/mxenv-cli",
174
- version: "0.12.0",
176
+ version: "0.12.1",
175
177
  description: "L3 management face for mxenv \u2014 machine-level extras like shell-init.",
176
178
  license: "MIT",
177
179
  author: "MorphixAI <dev@morphixai.com>",
@@ -256,6 +258,7 @@ function parseArgs(argv) {
256
258
  write: false,
257
259
  remove: false,
258
260
  warnPlaintext: false,
261
+ help: false,
259
262
  unknownFlags: []
260
263
  };
261
264
  let i = 2;
@@ -311,6 +314,8 @@ function parseArgs(argv) {
311
314
  args.serve = true;
312
315
  } else if (arg === "--warn-plaintext") {
313
316
  args.warnPlaintext = true;
317
+ } else if (arg === "--help" || arg === "-h") {
318
+ args.help = true;
314
319
  } else if (args.command === "run") {
315
320
  args.subArgs = argv.slice(i);
316
321
  break;
@@ -328,6 +333,10 @@ function configLayers() {
328
333
  }
329
334
  var bootInfo = { viaShim: false };
330
335
  function cmdShellInit(args) {
336
+ if (args.help) {
337
+ showHelp();
338
+ return 0;
339
+ }
331
340
  if (process.platform === "win32") {
332
341
  console.error("[mxenv] shell-init is supported on macOS/Linux only; on Windows keep using explicit `mxenv run -- <command>`.");
333
342
  return 1;
@@ -425,10 +434,30 @@ function cmdReserved(command) {
425
434
  console.error(`[mxenv] "${command}" is reserved for a future release and is not implemented yet.`);
426
435
  return 1;
427
436
  }
437
+ var PROJECT_COMMANDS = /* @__PURE__ */ new Set([
438
+ "run",
439
+ "fetch",
440
+ "export",
441
+ "render",
442
+ "inject",
443
+ "generate",
444
+ "gen",
445
+ "inspect",
446
+ "migrate",
447
+ "audit",
448
+ "edit",
449
+ "doc",
450
+ "skill"
451
+ ]);
428
452
  async function main() {
429
453
  (0, import_mxenv_core3.warnDeprecatedBinInvocation)(process.argv[1]);
430
454
  Object.assign(bootInfo, (0, import_mxenv_core3.sanitizeBootEnv)());
431
455
  const args = parseArgs(process.argv);
456
+ if (args.noGlobal) (0, import_mxenv_core3.suppressLegacyHomeHint)();
457
+ if (args.help && args.command !== "shell-init") {
458
+ showHelp();
459
+ return 0;
460
+ }
432
461
  switch (args.command) {
433
462
  case "shell-init":
434
463
  return cmdShellInit(args);
@@ -446,7 +475,14 @@ async function main() {
446
475
  console.log(VERSION);
447
476
  return 0;
448
477
  default:
449
- if (args.command) console.error(`[mxenv] Unknown command: ${args.command}`);
478
+ if (args.command) {
479
+ console.error(`[mxenv] Unknown command: ${args.command}`);
480
+ if (args.command === "migrate") {
481
+ console.error("[mxenv] `migrate --home` (machine-level global-directory migration) runs as `npx @morphixai/mxenv migrate --home` from anywhere; plaintext migration is a project command \u2014 run it inside a project.");
482
+ } else if (PROJECT_COMMANDS.has(args.command)) {
483
+ console.error(`[mxenv] "${args.command}" is a project command from @morphixai/mxenv \u2014 run it inside a project (\`npx mxenv ${args.command} \u2026\` or an npm script). This CLI is the machine-level face only.`);
484
+ }
485
+ }
450
486
  showHelp();
451
487
  return args.command ? 1 : 0;
452
488
  }
package/dist/index.d.ts CHANGED
@@ -69,11 +69,12 @@ declare function writeShims(commands: string[], homeDir?: string): {
69
69
  removed: string[];
70
70
  skipped: string[];
71
71
  };
72
- /** Removes every tool-generated shim; handmade files are left alone. */
72
+ /** Removes every tool-generated shim (current **and** legacy shim dirs); handmade files are left alone. */
73
73
  declare function removeAllShims(homeDir?: string): string[];
74
74
  /**
75
75
  * Handmade files that shadow reserved mxenv names would wrap mxenv itself in
76
76
  * a shim (weird but terminating) — surface them so the user can delete them.
77
+ * Sweeps both the current and the legacy shim dir (0.12.x compat window).
77
78
  */
78
79
  declare function detectHandmadeReservedShims(homeDir?: string): string[];
79
80
  /** Infers the rc file from $SHELL; returns null for shells we do not write. */
package/dist/index.js CHANGED
@@ -180,27 +180,29 @@ function writeShims(commands, homeDir = (0, import_os.homedir)()) {
180
180
  return { written, removed, skipped };
181
181
  }
182
182
  function removeAllShims(homeDir = (0, import_os.homedir)()) {
183
- const dir = (0, import_mxenv_core.shimsDir)(homeDir);
184
- if (!(0, import_fs2.existsSync)(dir)) return [];
185
183
  const removed = [];
186
- for (const file of (0, import_fs2.readdirSync)(dir)) {
187
- const path = (0, import_path2.join)(dir, file);
188
- const content = readIfExists(path);
189
- if (content !== null && isGeneratedShim(content)) {
190
- (0, import_fs2.rmSync)(path);
191
- removed.push(file);
184
+ for (const dir of [(0, import_mxenv_core.shimsDir)(homeDir), (0, import_mxenv_core.legacyShimsDir)(homeDir)]) {
185
+ if (!(0, import_fs2.existsSync)(dir)) continue;
186
+ for (const file of (0, import_fs2.readdirSync)(dir)) {
187
+ const path = (0, import_path2.join)(dir, file);
188
+ const content = readIfExists(path);
189
+ if (content !== null && isGeneratedShim(content)) {
190
+ (0, import_fs2.rmSync)(path);
191
+ removed.push(file);
192
+ }
192
193
  }
193
194
  }
194
195
  return removed;
195
196
  }
196
197
  function detectHandmadeReservedShims(homeDir = (0, import_os.homedir)()) {
197
- const dir = (0, import_mxenv_core.shimsDir)(homeDir);
198
- if (!(0, import_fs2.existsSync)(dir)) return [];
199
198
  const found = [];
200
- for (const file of (0, import_fs2.readdirSync)(dir)) {
201
- if (!import_mxenv_core.RESERVED_SHIM_NAMES.includes(file.toLowerCase())) continue;
202
- const content = readIfExists((0, import_path2.join)(dir, file));
203
- if (content === null || !isGeneratedShim(content)) found.push(file);
199
+ for (const dir of [(0, import_mxenv_core.shimsDir)(homeDir), (0, import_mxenv_core.legacyShimsDir)(homeDir)]) {
200
+ if (!(0, import_fs2.existsSync)(dir)) continue;
201
+ for (const file of (0, import_fs2.readdirSync)(dir)) {
202
+ if (!import_mxenv_core.RESERVED_SHIM_NAMES.includes(file.toLowerCase())) continue;
203
+ const content = readIfExists((0, import_path2.join)(dir, file));
204
+ if (content === null || !isGeneratedShim(content)) found.push(file);
205
+ }
204
206
  }
205
207
  return found;
206
208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphixai/mxenv-cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "L3 management face for mxenv \u2014 machine-level extras like shell-init.",
5
5
  "license": "MIT",
6
6
  "author": "MorphixAI <dev@morphixai.com>",