@mesh-tech/mesh-cli 0.12.0 → 0.12.2

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/dist/bin/mesh.js CHANGED
@@ -3398,7 +3398,7 @@ var init_hub_roles = __esm({
3398
3398
 
3399
3399
  // libs/api-registry/src/index.ts
3400
3400
  import { z as z2 } from "zod";
3401
- var apiSurfaceSchema, apiRegistryEntrySchema;
3401
+ var apiSurfaceSchema, apiRegistryEntrySchema, integrationStatusSchema;
3402
3402
  var init_src2 = __esm({
3403
3403
  "libs/api-registry/src/index.ts"() {
3404
3404
  "use strict";
@@ -3417,7 +3417,28 @@ var init_src2 = __esm({
3417
3417
  surfaces: apiSurfaceSchema,
3418
3418
  credentials: z2.object({ keyedBy: z2.string().nullish() }).optional(),
3419
3419
  docs: z2.object({ url: z2.string().min(1), contentHash: z2.string().min(1) }),
3420
- enabledOps: z2.array(z2.string())
3420
+ enabledOps: z2.array(z2.string()),
3421
+ // The consumer schema strips unknown keys, so a producer-side field that is
3422
+ // not mirrored here never reaches a consumer — mirror every addition.
3423
+ status: z2.object({ url: z2.string().min(1) }).optional(),
3424
+ appVersion: z2.string().min(1).optional()
3425
+ });
3426
+ integrationStatusSchema = z2.object({
3427
+ contract: z2.literal("v1"),
3428
+ name: z2.string().min(1),
3429
+ provider: z2.string().optional(),
3430
+ type: z2.string().optional(),
3431
+ title: z2.string().optional(),
3432
+ definitionVersion: z2.string().optional(),
3433
+ packageVersion: z2.string().min(1).optional(),
3434
+ tenant: z2.string().min(1),
3435
+ instanceKey: z2.string().optional(),
3436
+ surfaces: z2.array(z2.enum(["http", "nexus"])),
3437
+ coreMode: z2.enum(["mock", "live"]),
3438
+ coreModeSource: z2.string().optional(),
3439
+ enabledOps: z2.array(z2.string()),
3440
+ credentialsWired: z2.boolean(),
3441
+ startedAt: z2.string().min(1)
3421
3442
  });
3422
3443
  }
3423
3444
  });
@@ -15459,15 +15480,67 @@ function shimScript() {
15459
15480
  # it. That resolves to bin/mesh.mjs, which runs the CLI from TypeScript source \u2014
15460
15481
  # so this always runs the LOCAL source of whatever worktree/app you are in, with
15461
15482
  # no build step. Nothing here is version-pinned; do not edit by hand.
15483
+ #
15484
+ # Outside a workspace it hands off to a globally installed mesh CLI (MESH-2869).
15485
+ # Without that hand-off the shim shadows \`npm i -g @mesh-tech/mesh-cli\` on the
15486
+ # PATH and \`mesh login\` is unreachable from the home directory \u2014 which is the
15487
+ # very first thing a new developer runs.
15488
+ # True when $1 is another copy of this shim. Reads the marker line with the
15489
+ # shell alone \u2014 no head/grep \u2014 so a stripped PATH cannot break the check.
15490
+ _mesh_is_shim() {
15491
+ _n=0
15492
+ while [ "$_n" -lt 6 ] && IFS= read -r _line; do
15493
+ case $_line in *"canonical launcher shim"*) return 0 ;; esac
15494
+ _n=$((_n + 1))
15495
+ done < "$1"
15496
+ return 1
15497
+ }
15498
+
15499
+ # Walk up to the nearest workspace CLI. Parameter expansion, not \`dirname\`:
15500
+ # an unavailable dirname used to leave $dir empty and spin this loop forever.
15462
15501
  dir=$(pwd)
15463
- while [ "$dir" != "/" ]; do
15502
+ while [ -n "$dir" ]; do
15464
15503
  if [ -x "$dir/node_modules/.bin/mesh" ]; then
15465
15504
  exec "$dir/node_modules/.bin/mesh" "$@"
15466
15505
  fi
15467
- dir=$(dirname "$dir")
15506
+ [ "$dir" = "/" ] && break
15507
+ parent=\${dir%/*}
15508
+ [ -n "$parent" ] || parent=/
15509
+ dir=$parent
15468
15510
  done
15469
- echo "mesh: not inside a Mesh workspace (no node_modules/.bin/mesh found)." >&2
15470
- echo " cd into your app/repo (after 'pnpm install'), or run 'pnpm exec mesh'." >&2
15511
+
15512
+ # Not in a workspace: exec the next \`mesh\` on PATH that is not another copy of
15513
+ # this shim (matched on the marker line above, so we can never exec ourselves).
15514
+ self_dir=\${0%/*}
15515
+ [ "$self_dir" = "$0" ] && self_dir=.
15516
+ self_dir=$(CDPATH= cd -- "$self_dir" 2>/dev/null && pwd -P)
15517
+ saved_ifs=$IFS
15518
+ IFS=:
15519
+ set -f
15520
+ for entry in $PATH; do
15521
+ IFS=$saved_ifs
15522
+ set +f
15523
+ [ -n "$entry" ] || entry=.
15524
+ candidate=$entry/mesh
15525
+ # -f as well as -x: [ -x ] is true for a DIRECTORY named mesh, which would be
15526
+ # taken for the CLI and exec'd into a bare 126 without ever reaching the real
15527
+ # one further down PATH. A shell's own PATH search skips directories.
15528
+ if [ -f "$candidate" ] && [ -x "$candidate" ]; then
15529
+ entry_dir=$(CDPATH= cd -- "$entry" 2>/dev/null && pwd -P)
15530
+ if [ -n "$entry_dir" ] && [ "$entry_dir" != "$self_dir" ] && ! _mesh_is_shim "$candidate"; then
15531
+ exec "$candidate" "$@"
15532
+ fi
15533
+ fi
15534
+ IFS=:
15535
+ set -f
15536
+ done
15537
+ IFS=$saved_ifs
15538
+ set +f
15539
+
15540
+ echo "mesh: not inside a Mesh workspace (no node_modules/.bin/mesh found)," >&2
15541
+ echo " and no global mesh CLI found on PATH." >&2
15542
+ echo " Install it: npm i -g @mesh-tech/mesh-cli" >&2
15543
+ echo " Or cd into your app/repo (after 'pnpm install') and use 'pnpm exec mesh'." >&2
15471
15544
  exit 1
15472
15545
  `;
15473
15546
  }