@mushi-mushi/cli 0.30.4 → 0.30.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.
@@ -1,24 +1,23 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION
3
- } from "./chunk-ODY6NZY2.js";
3
+ } from "./chunk-QR6NCHXT.js";
4
4
  import {
5
5
  assertEndpoint,
6
6
  normalizeEndpoint
7
7
  } from "./chunk-2DMHQVRU.js";
8
- import {
9
- __require
10
- } from "./chunk-3RG5ZIWI.js";
11
8
 
12
9
  // src/keychain.ts
10
+ import { createRequire } from "module";
13
11
  var KEYCHAIN_SERVICE = "mushi-cli";
14
12
  function accountName(profile = "default") {
15
13
  return `api-key:${profile}`;
16
14
  }
17
15
  var _EntryClass = void 0;
18
16
  function getEntryClass() {
17
+ if (process.env["MUSHI_NO_KEYCHAIN"]) return null;
19
18
  if (_EntryClass === void 0) {
20
19
  try {
21
- const mod = __require("@napi-rs/keyring");
20
+ const mod = createRequire(import.meta.url)("@napi-rs/keyring");
22
21
  _EntryClass = mod.Entry ?? null;
23
22
  } catch {
24
23
  _EntryClass = null;
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/version.ts
4
+ var MUSHI_CLI_VERSION = true ? "0.30.6" : "0.0.0-dev";
5
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.26.1";
6
+
7
+ export {
8
+ MUSHI_CLI_VERSION,
9
+ MUSHI_MCP_PIN_SPEC
10
+ };
@@ -0,0 +1,8 @@
1
+ // src/version.ts
2
+ var MUSHI_CLI_VERSION = true ? "0.30.6" : "0.0.0-dev";
3
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.26.1";
4
+
5
+ export {
6
+ MUSHI_CLI_VERSION,
7
+ MUSHI_MCP_PIN_SPEC
8
+ };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MUSHI_CLI_VERSION,
4
4
  MUSHI_MCP_PIN_SPEC
5
- } from "./chunk-F7TLL2FB.js";
5
+ } from "./chunk-D7ZVFRYW.js";
6
6
  import {
7
7
  CLOUD_API_ENDPOINT,
8
8
  assertEndpoint,
@@ -13,9 +13,6 @@ import {
13
13
  envVarsToWrite,
14
14
  readPackageJson
15
15
  } from "./chunk-KOBEOGNF.js";
16
- import {
17
- __require
18
- } from "./chunk-PDX44BCA.js";
19
16
 
20
17
  // src/connect.ts
21
18
  import { appendFile, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
@@ -29,15 +26,17 @@ import { homedir } from "os";
29
26
  import { dirname, join } from "path";
30
27
 
31
28
  // src/keychain.ts
29
+ import { createRequire } from "module";
32
30
  var KEYCHAIN_SERVICE = "mushi-cli";
33
31
  function accountName(profile = "default") {
34
32
  return `api-key:${profile}`;
35
33
  }
36
34
  var _EntryClass = void 0;
37
35
  function getEntryClass() {
36
+ if (process.env["MUSHI_NO_KEYCHAIN"]) return null;
38
37
  if (_EntryClass === void 0) {
39
38
  try {
40
- const mod = __require("@napi-rs/keyring");
39
+ const mod = createRequire(import.meta.url)("@napi-rs/keyring");
41
40
  _EntryClass = mod.Entry ?? null;
42
41
  } catch {
43
42
  _EntryClass = null;
@@ -68,6 +67,21 @@ function tryLoadKeyFromKeychain(profile = "default") {
68
67
  return null;
69
68
  }
70
69
  }
70
+ function tryDeleteKeyFromKeychain(profile = "default") {
71
+ const EntryClass = getEntryClass();
72
+ if (!EntryClass) return;
73
+ try {
74
+ const entry = new EntryClass(KEYCHAIN_SERVICE, accountName(profile));
75
+ entry.deletePassword();
76
+ } catch {
77
+ }
78
+ }
79
+ function syncKeychainAfterKeyChange(apiKey, profile = "default") {
80
+ if (tryLoadKeyFromKeychain(profile) === null) return "none";
81
+ if (trySaveKeyToKeychain(apiKey, profile) && tryLoadKeyFromKeychain(profile) === apiKey) return "updated";
82
+ tryDeleteKeyFromKeychain(profile);
83
+ return "removed";
84
+ }
71
85
 
72
86
  // src/config.ts
73
87
  var DEFAULT_PROFILE = "default";
@@ -1101,6 +1115,7 @@ export {
1101
1115
  printAndExit,
1102
1116
  installSignalHandlers,
1103
1117
  trySaveKeyToKeychain,
1118
+ syncKeychainAfterKeyChange,
1104
1119
  savedSdkKeyFor,
1105
1120
  resolveProfileName,
1106
1121
  CONFIG_PATH,
@@ -2,11 +2,10 @@
2
2
  import {
3
3
  resolveSdkEnvKey,
4
4
  runConnect
5
- } from "./chunk-26JWYLCK.js";
6
- import "./chunk-F7TLL2FB.js";
5
+ } from "./chunk-YAF2NATT.js";
6
+ import "./chunk-D7ZVFRYW.js";
7
7
  import "./chunk-LGGE3LH7.js";
8
8
  import "./chunk-KOBEOGNF.js";
9
- import "./chunk-PDX44BCA.js";
10
9
  export {
11
10
  resolveSdkEnvKey,
12
11
  runConnect
@@ -6,10 +6,10 @@ import {
6
6
  saveConfig,
7
7
  savedSdkKeyFor,
8
8
  waitForIngestReady
9
- } from "./chunk-SV6HHYWE.js";
9
+ } from "./chunk-BNO37ZO5.js";
10
10
  import {
11
11
  MUSHI_MCP_PIN_SPEC
12
- } from "./chunk-ODY6NZY2.js";
12
+ } from "./chunk-QR6NCHXT.js";
13
13
  import {
14
14
  detectFramework,
15
15
  envVarsToWrite,
@@ -18,7 +18,6 @@ import {
18
18
  import {
19
19
  assertEndpoint
20
20
  } from "./chunk-2DMHQVRU.js";
21
- import "./chunk-3RG5ZIWI.js";
22
21
 
23
22
  // src/connect.ts
24
23
  import { appendFile, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
@@ -9,7 +9,6 @@ import {
9
9
  isFrameworkId,
10
10
  readPackageJson
11
11
  } from "./chunk-KOBEOGNF.js";
12
- import "./chunk-PDX44BCA.js";
13
12
  export {
14
13
  FRAMEWORKS,
15
14
  FRAMEWORK_IDS,
package/dist/detect.js CHANGED
@@ -8,7 +8,6 @@ import {
8
8
  isFrameworkId,
9
9
  readPackageJson
10
10
  } from "./chunk-AIZRI665.js";
11
- import "./chunk-3RG5ZIWI.js";
12
11
  export {
13
12
  FRAMEWORKS,
14
13
  FRAMEWORK_IDS,
@@ -7,7 +7,6 @@ import {
7
7
  normalizeEndpoint,
8
8
  resolveCloudEndpoint
9
9
  } from "./chunk-2DMHQVRU.js";
10
- import "./chunk-3RG5ZIWI.js";
11
10
  export {
12
11
  CLOUD_API_ENDPOINT,
13
12
  CLOUD_MCP_OAUTH_URL,
@@ -8,7 +8,6 @@ import {
8
8
  normalizeEndpoint,
9
9
  resolveCloudEndpoint
10
10
  } from "./chunk-LGGE3LH7.js";
11
- import "./chunk-PDX44BCA.js";
12
11
  export {
13
12
  CLOUD_API_ENDPOINT,
14
13
  CLOUD_MCP_OAUTH_URL,
package/dist/index.js CHANGED
@@ -51,13 +51,14 @@ import {
51
51
  savedSdkKeyFor,
52
52
  setActiveProfile,
53
53
  setGlobalOutputFormat,
54
+ syncKeychainAfterKeyChange,
54
55
  trySaveKeyToKeychain,
55
56
  writeMcpServerEntry
56
- } from "./chunk-26JWYLCK.js";
57
+ } from "./chunk-YAF2NATT.js";
57
58
  import {
58
59
  MUSHI_CLI_VERSION,
59
60
  MUSHI_MCP_PIN_SPEC
60
- } from "./chunk-F7TLL2FB.js";
61
+ } from "./chunk-D7ZVFRYW.js";
61
62
  import {
62
63
  CLOUD_API_ENDPOINT,
63
64
  CLOUD_MCP_OAUTH_URL,
@@ -75,7 +76,6 @@ import {
75
76
  installCommand,
76
77
  readPackageJson
77
78
  } from "./chunk-KOBEOGNF.js";
78
- import "./chunk-PDX44BCA.js";
79
79
 
80
80
  // src/index.ts
81
81
  import { Command } from "commander";
@@ -467,7 +467,7 @@ function chooseProjectNonInteractive(projects, preferredName) {
467
467
  return match ? { kind: "existing", id: match.id, name: match.name } : { kind: "new", name: preferredName };
468
468
  }
469
469
  async function runLogin(opts = {}) {
470
- const { CLOUD_API_ENDPOINT: CLOUD_API_ENDPOINT2, resolveCloudEndpoint: resolveCloudEndpoint2 } = await import("./endpoint-KI5FMW2S.js");
470
+ const { CLOUD_API_ENDPOINT: CLOUD_API_ENDPOINT2, resolveCloudEndpoint: resolveCloudEndpoint2 } = await import("./endpoint-MJATXOXM.js");
471
471
  const endpoint = opts.endpoint ? resolveCloudEndpoint2(opts.endpoint) : CLOUD_API_ENDPOINT2;
472
472
  const consoleBase = await resolveConsoleUrl();
473
473
  let apiKey = opts.apiKey;
@@ -558,7 +558,7 @@ error: Could not start login session: ${err instanceof Error ? err.message : Str
558
558
  choice = await resolveProjectChoice(projectsList, ask);
559
559
  rl.close();
560
560
  } else {
561
- const { readPackageJson: readPackageJson2 } = await import("./detect-4PYRZXVK.js");
561
+ const { readPackageJson: readPackageJson2 } = await import("./detect-WZT5X6LP.js");
562
562
  const cwd = process.cwd();
563
563
  const nonInteractive = chooseProjectNonInteractive(
564
564
  projectsList,
@@ -1546,7 +1546,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
1546
1546
  }
1547
1547
  async function checkVersionDrift(cwd, doFetch) {
1548
1548
  const checks = [];
1549
- const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-35BA3FDB.js");
1549
+ const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-NJJQDMYO.js");
1550
1550
  if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
1551
1551
  const parse2 = (v) => {
1552
1552
  const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
@@ -1663,7 +1663,7 @@ async function runDoctor(config, options = {}) {
1663
1663
  }
1664
1664
  if (sdkCheck) checks.push(sdkCheck);
1665
1665
  if (sdkCheck?.ok && !sdkCheck.warn) {
1666
- const { findSdkImport } = await import("./snippet-inject-CCXILWYZ.js");
1666
+ const { findSdkImport } = await import("./snippet-inject-LPRWTQDE.js");
1667
1667
  const imported = await findSdkImport(options.cwd ?? process.cwd());
1668
1668
  checks.push(
1669
1669
  imported ? { name: "SDK init snippet wired", ok: true, detail: `Found SDK usage in ${imported.file}` } : {
@@ -2414,7 +2414,7 @@ function emitWizardFunnelEvent(credentials, endpoint, event, metadata = {}) {
2414
2414
  }
2415
2415
  async function maybeInjectSnippet(cwd, framework, options) {
2416
2416
  if (options.yes || !process.stdin.isTTY) return;
2417
- const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-CCXILWYZ.js");
2417
+ const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-LPRWTQDE.js");
2418
2418
  const candidates = ENTRY_CANDIDATES[framework.id];
2419
2419
  if (!candidates) return;
2420
2420
  const { readFile: readFile3, writeFile: writeFile3 } = await import("fs/promises");
@@ -2470,7 +2470,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
2470
2470
  if (p.isCancel(answer) || !answer) return;
2471
2471
  const endpoint = resolveCloudEndpoint(options.endpoint);
2472
2472
  try {
2473
- const { runConnect: runConnect2 } = await import("./connect-XPSH7MK3.js");
2473
+ const { runConnect: runConnect2 } = await import("./connect-D7FYRBAP.js");
2474
2474
  const saved = loadConfig();
2475
2475
  const result = await runConnect2(
2476
2476
  {
@@ -2884,6 +2884,7 @@ Examples:
2884
2884
  const safeValue = key === "endpoint" ? assertEndpoint(value) : value;
2885
2885
  config[key] = safeValue;
2886
2886
  saveConfig(config);
2887
+ if (key === "apiKey") syncKeychainAfterKeyChange(safeValue, resolveProfileName());
2887
2888
  console.log(`\u2713 Set ${key}`);
2888
2889
  } else {
2889
2890
  const safe = {
@@ -5403,6 +5404,7 @@ function registerKeysCommands(program2) {
5403
5404
  const oldPrefix = oldKey?.slice(0, 12) ?? "(none)";
5404
5405
  config.apiKey = newKey;
5405
5406
  saveConfig(config);
5407
+ syncKeychainAfterKeyChange(newKey, resolveProfileName());
5406
5408
  let serverRevoked = false;
5407
5409
  if (oldKey && config.projectId) {
5408
5410
  const revokeResult = await revokeProjectKey(
package/dist/init.js CHANGED
@@ -25,10 +25,10 @@ import {
25
25
  saveConfig,
26
26
  savedSdkKeyFor,
27
27
  trySaveKeyToKeychain
28
- } from "./chunk-SV6HHYWE.js";
28
+ } from "./chunk-BNO37ZO5.js";
29
29
  import {
30
30
  MUSHI_CLI_VERSION
31
- } from "./chunk-ODY6NZY2.js";
31
+ } from "./chunk-QR6NCHXT.js";
32
32
  import {
33
33
  FRAMEWORKS,
34
34
  detectFramework,
@@ -45,7 +45,6 @@ import {
45
45
  normalizeEndpoint,
46
46
  resolveCloudEndpoint
47
47
  } from "./chunk-2DMHQVRU.js";
48
- import "./chunk-3RG5ZIWI.js";
49
48
 
50
49
  // src/init.ts
51
50
  import * as p from "@clack/prompts";
@@ -1252,7 +1251,7 @@ async function runDoctor(config, options = {}) {
1252
1251
  }
1253
1252
  if (sdkCheck) checks.push(sdkCheck);
1254
1253
  if (sdkCheck?.ok && !sdkCheck.warn) {
1255
- const { findSdkImport } = await import("./snippet-inject-7ABYE57O.js");
1254
+ const { findSdkImport } = await import("./snippet-inject-NDAPEL2T.js");
1256
1255
  const imported = await findSdkImport(options.cwd ?? process.cwd());
1257
1256
  checks.push(
1258
1257
  imported ? { name: "SDK init snippet wired", ok: true, detail: `Found SDK usage in ${imported.file}` } : {
@@ -2003,7 +2002,7 @@ function emitWizardFunnelEvent(credentials, endpoint, event, metadata = {}) {
2003
2002
  }
2004
2003
  async function maybeInjectSnippet(cwd, framework, options) {
2005
2004
  if (options.yes || !process.stdin.isTTY) return;
2006
- const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-7ABYE57O.js");
2005
+ const { ENTRY_CANDIDATES, injectSnippet, MUSHI_MARKER_START } = await import("./snippet-inject-NDAPEL2T.js");
2007
2006
  const candidates = ENTRY_CANDIDATES[framework.id];
2008
2007
  if (!candidates) return;
2009
2008
  const { readFile, writeFile } = await import("fs/promises");
@@ -2059,7 +2058,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
2059
2058
  if (p.isCancel(answer) || !answer) return;
2060
2059
  const endpoint = resolveCloudEndpoint(options.endpoint);
2061
2060
  try {
2062
- const { runConnect } = await import("./connect-YDQ65VJY.js");
2061
+ const { runConnect } = await import("./connect-YKI7VZMP.js");
2063
2062
  const saved = loadConfig();
2064
2063
  const result = await runConnect(
2065
2064
  {
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-PDX44BCA.js";
3
2
 
4
3
  // src/snippet-inject.ts
5
4
  import { readFile, readdir } from "fs/promises";
@@ -1,5 +1,3 @@
1
- import "./chunk-3RG5ZIWI.js";
2
-
3
1
  // src/snippet-inject.ts
4
2
  import { readFile, readdir } from "fs/promises";
5
3
  import { join } from "path";
@@ -2,8 +2,7 @@
2
2
  import {
3
3
  MUSHI_CLI_VERSION,
4
4
  MUSHI_MCP_PIN_SPEC
5
- } from "./chunk-F7TLL2FB.js";
6
- import "./chunk-PDX44BCA.js";
5
+ } from "./chunk-D7ZVFRYW.js";
7
6
  export {
8
7
  MUSHI_CLI_VERSION,
9
8
  MUSHI_MCP_PIN_SPEC
package/dist/version.d.ts CHANGED
@@ -14,6 +14,6 @@ declare const MUSHI_CLI_VERSION: string;
14
14
  * setup refreshes the pin. Synced to packages/mcp/package.json by
15
15
  * `scripts/sync-mcp-pin.mjs` — never hand-edit the version.
16
16
  */
17
- declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.25.0";
17
+ declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.26.1";
18
18
 
19
19
  export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
package/dist/version.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION,
3
3
  MUSHI_MCP_PIN_SPEC
4
- } from "./chunk-ODY6NZY2.js";
5
- import "./chunk-3RG5ZIWI.js";
4
+ } from "./chunk-QR6NCHXT.js";
6
5
  export {
7
6
  MUSHI_CLI_VERSION,
8
7
  MUSHI_MCP_PIN_SPEC
@@ -2,7 +2,6 @@ import {
2
2
  FRAMEWORK_IDS,
3
3
  isFrameworkId
4
4
  } from "./chunk-AIZRI665.js";
5
- import "./chunk-3RG5ZIWI.js";
6
5
 
7
6
  // src/wizard-args.ts
8
7
  var MIN_NODE_MAJOR = 20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mushi-mushi/cli",
3
- "version": "0.30.4",
3
+ "version": "0.30.6",
4
4
  "license": "MIT",
5
5
  "description": "Mushi CLI: SDK setup, MCP wiring, bug triage. The bug mediator for AI-built apps: plain-English diagnosis + a ready fix, in your editor.",
6
6
  "bin": {
@@ -1,10 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- export {
9
- __require
10
- };
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/version.ts
4
- var MUSHI_CLI_VERSION = true ? "0.30.4" : "0.0.0-dev";
5
- var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.25.0";
6
-
7
- export {
8
- MUSHI_CLI_VERSION,
9
- MUSHI_MCP_PIN_SPEC
10
- };
@@ -1,8 +0,0 @@
1
- // src/version.ts
2
- var MUSHI_CLI_VERSION = true ? "0.30.4" : "0.0.0-dev";
3
- var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.25.0";
4
-
5
- export {
6
- MUSHI_CLI_VERSION,
7
- MUSHI_MCP_PIN_SPEC
8
- };
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
- export {
10
- __require
11
- };