@mnemom/mnemom 0.16.0 → 0.16.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.
@@ -28,7 +28,7 @@ import { putAlignmentCard, putProtectionCard, listOrgAgents, MnemomApiError } fr
28
28
  import { resolveAuth, loginWithBrowser, loginWithDeviceFlow } from "../lib/auth.js";
29
29
  import { openBrowser } from "../lib/oauth.js";
30
30
  import { askSelect, askInput, askYesNo, isInteractive } from "../lib/prompt.js";
31
- import { getApiUrl } from "../lib/config.js";
31
+ import { getApiUrl, setApiUrlOverride } from "../lib/config.js";
32
32
  import { fmt } from "../lib/format.js";
33
33
  const POLL_INTERVAL_MS = 3000;
34
34
  /**
@@ -58,6 +58,12 @@ export async function tryMeCommand(token, options = {}) {
58
58
  throw new Error(`'${token}' doesn't look like a try-me token (expected e.g. tryme_…). ` +
59
59
  "Copy the token from your Dojo /try-me invite.");
60
60
  }
61
+ // Point EVERY API surface for this run at the ring the operator chose via
62
+ // `--api` — including OAuth discovery + the one-click claim login, which
63
+ // otherwise fall back to getApiUrl()'s prod default and leak the sign-in to
64
+ // prod even though resolve/birth ran on the ring.
65
+ if (options.api)
66
+ setApiUrlOverride(options.api);
61
67
  // ── State: resolve ────────────────────────────────────────────────────────
62
68
  say(fmt.header("Mnemom Dojo — try-me"));
63
69
  say();
package/dist/index.js CHANGED
@@ -74,24 +74,15 @@ program
74
74
  // ── skills (MNE-1324) — discover the zero-install skill surface ──────────────
75
75
  const skills = program
76
76
  .command("skills")
77
- .description("List and describe the Mnemom CLI skills (npx @mnemom/mnemom@latest <skill>)")
78
- // Bare `mnemom skills` lists; but an unknown subcommand or stray arg must ERROR
79
- // (exit 1) like every other command group NOT silently print the list (the
80
- // `{ isDefault }` footgun caught in the MNE-1324 review, F1). A parent .action()
81
- // handles the bare case; allowExcessArguments(false) rejects `skills bogus`.
82
- .option("--json", "Emit the registry as JSON")
83
- .allowExcessArguments(false)
84
- .action(async (opts) => {
85
- try {
86
- await skillsListCommand(opts);
87
- }
88
- catch (error) {
89
- console.error("Error:", error instanceof Error ? error.message : error);
90
- process.exit(1);
91
- }
92
- });
77
+ .description("List and describe the Mnemom CLI skills (npx @mnemom/mnemom@latest <skill>)");
78
+ // `list` is the default subcommand so bare `mnemom skills` lists. `--json` lives
79
+ // ONLY on the subcommands (NOT the parent): a parent-level `--json` shadows the
80
+ // subcommand option under commander@12 (the MNE-238 class), which silently broke
81
+ // `skills list --json` / `skills describe --json` in 0.16.0. `allowExcessArguments
82
+ // (false)` keeps the F1 fix — `skills bogus` / `skills list foo` error (exit 1)
83
+ // instead of silently listing.
93
84
  skills
94
- .command("list")
85
+ .command("list", { isDefault: true })
95
86
  .description("List available + planned skills")
96
87
  .option("--json", "Emit the registry as JSON")
97
88
  .allowExcessArguments(false)
@@ -13,6 +13,8 @@ export type Environment = "production" | "staging" | "local";
13
13
  * Defaults to production.
14
14
  */
15
15
  export declare function getEnvironment(): Environment;
16
+ /** Override the active API base for this process (clears on undefined/empty). */
17
+ export declare function setApiUrlOverride(url: string | undefined): void;
16
18
  export declare function getApiUrl(): string;
17
19
  export declare function getGatewayUrl(): string;
18
20
  export declare function getWebsiteUrl(): string;
@@ -34,12 +34,28 @@ export function getEnvironment() {
34
34
  return env;
35
35
  return "production";
36
36
  }
37
+ // Process-level base overrides. MNEMOM_ENV only selects prod/staging/local;
38
+ // to target an arbitrary ring (preview/us-1, test) a command can set an
39
+ // explicit override (e.g. `try-me --api <ring>`) or the operator can export
40
+ // MNEMOM_API_URL / MNEMOM_GATEWAY_URL / MNEMOM_WEBSITE_URL. Crucially these
41
+ // flow through EVERY surface — including OAuth discovery + the one-click claim
42
+ // login — so a non-prod ring's sign-in no longer falls back to the prod AS.
43
+ let apiUrlOverride;
44
+ /** Override the active API base for this process (clears on undefined/empty). */
45
+ export function setApiUrlOverride(url) {
46
+ const trimmed = url?.trim().replace(/\/+$/, "");
47
+ apiUrlOverride = trimmed || undefined;
48
+ }
49
+ function envBase(name) {
50
+ const v = process.env[name]?.trim();
51
+ return v ? v.replace(/\/+$/, "") : undefined;
52
+ }
37
53
  export function getApiUrl() {
38
- return API_URLS[getEnvironment()];
54
+ return apiUrlOverride ?? envBase("MNEMOM_API_URL") ?? API_URLS[getEnvironment()];
39
55
  }
40
56
  export function getGatewayUrl() {
41
- return GATEWAY_URLS[getEnvironment()];
57
+ return envBase("MNEMOM_GATEWAY_URL") ?? GATEWAY_URLS[getEnvironment()];
42
58
  }
43
59
  export function getWebsiteUrl() {
44
- return WEBSITE_URLS[getEnvironment()];
60
+ return envBase("MNEMOM_WEBSITE_URL") ?? WEBSITE_URLS[getEnvironment()];
45
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mnemom/mnemom",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "Transparent AI agent tracing",
5
5
  "type": "module",
6
6
  "bin": {