@mushi-mushi/cli 0.41.0 → 0.43.0

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.
@@ -9,14 +9,14 @@ import {
9
9
  requireUuid,
10
10
  saveConfig,
11
11
  savedSdkKeyFor
12
- } from "./chunk-G3RJDBYO.js";
12
+ } from "./chunk-UZQZU5OP.js";
13
13
  import {
14
14
  MUSHI_MCP_PIN_SPEC
15
- } from "./chunk-SW53IBFM.js";
15
+ } from "./chunk-JQQACG3P.js";
16
16
  import {
17
17
  assertEndpoint,
18
18
  normalizeEndpoint
19
- } from "./chunk-LGGE3LH7.js";
19
+ } from "./chunk-X6SC4JKO.js";
20
20
 
21
21
  // src/connect.ts
22
22
  import { appendFile, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
@@ -8,10 +8,10 @@ import {
8
8
  requireConfig,
9
9
  requireUuid,
10
10
  tryLoadWorkerKey
11
- } from "./chunk-G3RJDBYO.js";
11
+ } from "./chunk-UZQZU5OP.js";
12
12
  import {
13
13
  MUSHI_CLI_VERSION
14
- } from "./chunk-SW53IBFM.js";
14
+ } from "./chunk-JQQACG3P.js";
15
15
 
16
16
  // src/worker/daemon.ts
17
17
  import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
@@ -2019,7 +2019,7 @@ function registerWorkCommands(program) {
2019
2019
  if (opts.repoDir || opts.report || opts.followups || opts.recheck || opts.collapseBacklog) {
2020
2020
  throw new MushiCliError("E_INVALID_INPUT", "--daemon takes its lanes and clones from the worker config, not from --repo-dir, --report or --followups.", "mushi worker install");
2021
2021
  }
2022
- const { runDaemon: runDaemon2 } = await import("./daemon-JPRYTZ2H.js");
2022
+ const { runDaemon: runDaemon2 } = await import("./daemon-ZQ6WYRLD.js");
2023
2023
  await runDaemon2({ configPath: opts.workerConfig, ...opts.agent !== void 0 ? { agent } : {}, ...opts.anyRepo ? { anyRepo: true } : {} });
2024
2024
  return;
2025
2025
  }
@@ -2301,7 +2301,7 @@ async function resolveConflict(t, o) {
2301
2301
  import { spawn as spawn2 } from "child_process";
2302
2302
  import { existsSync as existsSync4 } from "fs";
2303
2303
  import { dirname as dirname2, join as join6 } from "path";
2304
- var UX_PACKAGE = "@mushi-mushi/ux@^0.3.0";
2304
+ var UX_PACKAGE = "@mushi-mushi/ux@^0.5.0";
2305
2305
  function cmdQuote(arg) {
2306
2306
  return /^[\w./:=@-]+$/.test(arg) ? arg : `"${arg.replace(/"/g, '""')}"`;
2307
2307
  }
@@ -2363,7 +2363,9 @@ function freshEyesStdin(t) {
2363
2363
  sessions: t.sessions,
2364
2364
  successText: t.successText,
2365
2365
  dryRun: t.dryRun,
2366
- accounts: t.accounts
2366
+ accounts: t.accounts,
2367
+ // The persona the console picked (ADR 0073); mushi-ux checks it again.
2368
+ ...t.persona ? { persona: t.persona } : {}
2367
2369
  });
2368
2370
  }
2369
2371
  function freshEyesEnv(base, sync) {
@@ -2757,6 +2759,20 @@ function parseHeartbeatAnswer(raw) {
2757
2759
  bad
2758
2760
  };
2759
2761
  }
2762
+ var PERSONA_NEEDS = ["screen_reader", "low_vision", "keyboard_only", "reduced_motion", "color_blind", "motor", "plain_language"];
2763
+ function parsePersonaTarget(raw) {
2764
+ if (raw == null) return { ok: true, value: void 0 };
2765
+ const p = raw;
2766
+ const name = plainText(p.name, 60);
2767
+ const brief = plainText(p.brief, 600);
2768
+ if (!name || !brief) return { ok: false, message: "the test claim's persona is not plain text" };
2769
+ if (typeof p.locale !== "string" || p.locale.length > 35 || !/^[a-z]{2,3}(-[A-Za-z0-9]{2,8}){0,3}$/.test(p.locale)) return { ok: false, message: "the test claim's persona language is malformed" };
2770
+ if (p.device !== "desktop" && p.device !== "mobile" && p.device !== "tablet") return { ok: false, message: "the test claim's persona device is malformed" };
2771
+ const needs = Array.isArray(p.needs) ? p.needs : [];
2772
+ if (needs.some((n) => typeof n !== "string" || !PERSONA_NEEDS.includes(n))) return { ok: false, message: "the test claim's persona needs are malformed" };
2773
+ if (typeof p.steps !== "number" || !Number.isInteger(p.steps) || p.steps < 5 || p.steps > 80) return { ok: false, message: "the test claim's persona step cap is not 5 to 80" };
2774
+ return { ok: true, value: { name, brief, locale: p.locale, device: p.device, needs: [...new Set(needs)], steps: p.steps } };
2775
+ }
2760
2776
  var RUN_ID_RE = /^[0-9]{8}-[0-9]{6}-[a-z0-9]{4}$/;
2761
2777
  var CONTROL_RE = /[\u0000-\u001f\u007f]/;
2762
2778
  function plainText(raw, max) {
@@ -2788,7 +2804,9 @@ function parseFreshEyesTarget(raw) {
2788
2804
  accounts.push({ email: a.email, password: a.password, name: plainText(a.name, 80) ?? "Test visitor", ...userId ? { userId } : {} });
2789
2805
  }
2790
2806
  if (accounts.length > t.sessions || t.dryRun && accounts.length) return { ok: false, message: "the test claim carries more accounts than it may use" };
2791
- return { ok: true, value: { runId: t.runId, url: url.toString(), goal, sessions: t.sessions, successText, dryRun: t.dryRun, accounts } };
2807
+ const persona = parsePersonaTarget(t.persona);
2808
+ if (!persona.ok) return persona;
2809
+ return { ok: true, value: { runId: t.runId, url: url.toString(), goal, sessions: t.sessions, successText, dryRun: t.dryRun, accounts, ...persona.value ? { persona: persona.value } : {} } };
2792
2810
  }
2793
2811
  function parseClaim(raw) {
2794
2812
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { ok: false, message: "the claim is not an object" };
@@ -2994,7 +3012,7 @@ function createDaemon(cfg, deps) {
2994
3012
  return {
2995
3013
  // `takes`: the claim kinds beyond the lanes' modes this daemon runs (a closed list on the server).
2996
3014
  // `can`: what this daemon does when the console asks (a closed list on the server).
2997
- host: { ...deps.host, takes: deps.freshEyes ? ["fresh_eyes"] : [], can: deps.cursorLogin ? ["cursor_login"] : [] },
3015
+ host: { ...deps.host, takes: deps.freshEyes ? ["fresh_eyes", "fresh_eyes_persona"] : [], can: deps.cursorLogin ? ["cursor_login"] : [] },
2998
3016
  status: {
2999
3017
  state: hostState,
3000
3018
  // Which coding agent the lanes run, so the console names its account (not always Cursor).
@@ -32,10 +32,10 @@ import {
32
32
  saveConfig,
33
33
  savedSdkKeyFor,
34
34
  trySaveKeyToKeychain
35
- } from "./chunk-XB3IJVAR.js";
35
+ } from "./chunk-LHSWFJOB.js";
36
36
  import {
37
37
  MUSHI_CLI_VERSION
38
- } from "./chunk-3K53JXJ4.js";
38
+ } from "./chunk-WJ7ZTOF7.js";
39
39
  import {
40
40
  FRAMEWORKS,
41
41
  detectFramework,
@@ -53,7 +53,7 @@ import {
53
53
  firstEndpoint,
54
54
  normalizeEndpoint,
55
55
  resolveCloudEndpoint
56
- } from "./chunk-2DMHQVRU.js";
56
+ } from "./chunk-X64CFG54.js";
57
57
 
58
58
  // src/init.ts
59
59
  import * as p from "@clack/prompts";
@@ -2093,10 +2093,19 @@ function emitWizardFunnelEvent(credentials, endpoint, event, metadata = {}) {
2093
2093
  }).catch(() => {
2094
2094
  });
2095
2095
  }
2096
- function snippetTarget(framework) {
2096
+ function snippetTarget(framework, cwd) {
2097
2097
  const comment = framework.snippet().split("\n").map((l) => l.trim()).find((l) => l.startsWith("//"));
2098
2098
  const text2 = comment?.replace(/^\/\/\s*/, "").trim();
2099
- return text2 && text2.length > 0 ? text2 : "your app entry file";
2099
+ if (!text2) return "your app entry file";
2100
+ return cwd ? existingEntryVariant(cwd, text2) : text2;
2101
+ }
2102
+ function existingEntryVariant(cwd, target) {
2103
+ const m = /^(\S+?)\.(tsx|ts|jsx|js)(\s.*)?$/.exec(target);
2104
+ if (!m || existsSync2(join2(cwd, `${m[1]}.${m[2]}`))) return target;
2105
+ for (const ext of ["tsx", "jsx", "ts", "js"]) {
2106
+ if (ext !== m[2] && existsSync2(join2(cwd, `${m[1]}.${ext}`))) return `${m[1]}.${ext}${m[3] ?? ""}`;
2107
+ }
2108
+ return target;
2100
2109
  }
2101
2110
  async function planSnippetInjection(cwd, framework) {
2102
2111
  const candidates = ENTRY_CANDIDATES[framework.id] ?? [];
@@ -2119,7 +2128,7 @@ async function planSnippetInjection(cwd, framework) {
2119
2128
  unchanged: next === source
2120
2129
  };
2121
2130
  }
2122
- return { kind: "manual", target: snippetTarget(framework) };
2131
+ return { kind: "manual", target: snippetTarget(framework, cwd) };
2123
2132
  }
2124
2133
  async function applySnippetPlan(plan, opts) {
2125
2134
  if (plan.kind === "manual") return plan;
@@ -2185,7 +2194,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
2185
2194
  if (p.isCancel(answer) || !answer) return;
2186
2195
  const endpoint = resolveCloudEndpoint(options.endpoint);
2187
2196
  try {
2188
- const { runConnect } = await import("./connect-T62VV3TC.js");
2197
+ const { runConnect } = await import("./connect-HSL2EUEV.js");
2189
2198
  const saved = loadConfig();
2190
2199
  const result = await runConnect(
2191
2200
  {
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/version.ts
4
+ var MUSHI_CLI_VERSION = true ? "0.43.0" : "0.0.0-dev";
5
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.33.0";
6
+
7
+ export {
8
+ MUSHI_CLI_VERSION,
9
+ MUSHI_MCP_PIN_SPEC
10
+ };
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION
3
- } from "./chunk-3K53JXJ4.js";
3
+ } from "./chunk-WJ7ZTOF7.js";
4
4
  import {
5
5
  assertEndpoint,
6
- normalizeEndpoint
7
- } from "./chunk-2DMHQVRU.js";
6
+ normalizeEndpoint,
7
+ resolvePublicOrigin
8
+ } from "./chunk-X64CFG54.js";
8
9
 
9
10
  // src/keychain.ts
10
11
  import { createRequire } from "module";
@@ -317,7 +318,7 @@ function describeUnsafeSdkKey(probe, endpoint) {
317
318
  // src/console-url.ts
318
319
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
319
320
  import { dirname as dirname2, join as join2 } from "path";
320
- var HOSTED_CONSOLE_BASE = "https://kensaur.us/mushi-mushi/admin";
321
+ var HOSTED_CONSOLE_BASE = `${resolvePublicOrigin()}/mushi-mushi/admin`;
321
322
  var LOCAL_ADMIN_URL = "http://localhost:6464";
322
323
  var LOCAL_PROBE_MS = 800;
323
324
  function normalizeConsoleBase(url) {
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  MUSHI_CLI_VERSION
4
- } from "./chunk-SW53IBFM.js";
4
+ } from "./chunk-JQQACG3P.js";
5
5
  import {
6
6
  CLOUD_API_ENDPOINT,
7
- normalizeEndpoint
8
- } from "./chunk-LGGE3LH7.js";
7
+ normalizeEndpoint,
8
+ resolvePublicOrigin
9
+ } from "./chunk-X6SC4JKO.js";
9
10
 
10
11
  // src/errors.ts
11
12
  var EXIT_CODE_MAP = {
@@ -473,7 +474,7 @@ function tightenWindowsAcl(path, type) {
473
474
  // src/console-url.ts
474
475
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
475
476
  import { dirname as dirname2, join as join2 } from "path";
476
- var HOSTED_CONSOLE_BASE = "https://kensaur.us/mushi-mushi/admin";
477
+ var HOSTED_CONSOLE_BASE = `${resolvePublicOrigin()}/mushi-mushi/admin`;
477
478
  var LOCAL_ADMIN_URL = "http://localhost:6464";
478
479
  var LOCAL_PROBE_MS = 800;
479
480
  function normalizeConsoleBase(url) {
@@ -0,0 +1,8 @@
1
+ // src/version.ts
2
+ var MUSHI_CLI_VERSION = true ? "0.43.0" : "0.0.0-dev";
3
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.33.0";
4
+
5
+ export {
6
+ MUSHI_CLI_VERSION,
7
+ MUSHI_MCP_PIN_SPEC
8
+ };
@@ -2,7 +2,19 @@
2
2
  var TEST_REPORT_TIMEOUT_MS = 1e4;
3
3
  var TEST_REPORT_FETCH_TIMEOUT_MS = TEST_REPORT_TIMEOUT_MS;
4
4
  var CLOUD_API_ENDPOINT = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api";
5
- var CLOUD_MCP_OAUTH_URL = "https://kensaur.us/mushi-mushi/hosted-mcp/";
5
+ var DEFAULT_PUBLIC_ORIGIN = "https://kensaur.us";
6
+ function resolvePublicOrigin(raw = process.env.MUSHI_PUBLIC_ORIGIN) {
7
+ const v = raw?.trim();
8
+ if (v) {
9
+ try {
10
+ const u = new URL(v);
11
+ if (u.protocol === "https:" || u.protocol === "http:") return u.origin;
12
+ } catch {
13
+ }
14
+ }
15
+ return DEFAULT_PUBLIC_ORIGIN;
16
+ }
17
+ var CLOUD_MCP_OAUTH_URL = `${resolvePublicOrigin()}/mushi-mushi/hosted-mcp/`;
6
18
  function firstEndpoint(...candidates) {
7
19
  for (const c of candidates) {
8
20
  const v = c?.trim();
@@ -44,6 +56,7 @@ function normalizeEndpoint(url) {
44
56
  export {
45
57
  TEST_REPORT_FETCH_TIMEOUT_MS,
46
58
  CLOUD_API_ENDPOINT,
59
+ resolvePublicOrigin,
47
60
  CLOUD_MCP_OAUTH_URL,
48
61
  firstEndpoint,
49
62
  resolveCloudEndpoint,
@@ -4,7 +4,19 @@
4
4
  var TEST_REPORT_TIMEOUT_MS = 1e4;
5
5
  var TEST_REPORT_FETCH_TIMEOUT_MS = TEST_REPORT_TIMEOUT_MS;
6
6
  var CLOUD_API_ENDPOINT = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api";
7
- var CLOUD_MCP_OAUTH_URL = "https://kensaur.us/mushi-mushi/hosted-mcp/";
7
+ var DEFAULT_PUBLIC_ORIGIN = "https://kensaur.us";
8
+ function resolvePublicOrigin(raw = process.env.MUSHI_PUBLIC_ORIGIN) {
9
+ const v = raw?.trim();
10
+ if (v) {
11
+ try {
12
+ const u = new URL(v);
13
+ if (u.protocol === "https:" || u.protocol === "http:") return u.origin;
14
+ } catch {
15
+ }
16
+ }
17
+ return DEFAULT_PUBLIC_ORIGIN;
18
+ }
19
+ var CLOUD_MCP_OAUTH_URL = `${resolvePublicOrigin()}/mushi-mushi/hosted-mcp/`;
8
20
  function firstEndpoint(...candidates) {
9
21
  for (const c of candidates) {
10
22
  const v = c?.trim();
@@ -46,6 +58,7 @@ function normalizeEndpoint(url) {
46
58
  export {
47
59
  TEST_REPORT_FETCH_TIMEOUT_MS,
48
60
  CLOUD_API_ENDPOINT,
61
+ resolvePublicOrigin,
49
62
  CLOUD_MCP_OAUTH_URL,
50
63
  firstEndpoint,
51
64
  resolveCloudEndpoint,
@@ -6,10 +6,10 @@ import {
6
6
  saveConfig,
7
7
  savedSdkKeyFor,
8
8
  waitForIngestReady
9
- } from "./chunk-XB3IJVAR.js";
9
+ } from "./chunk-LHSWFJOB.js";
10
10
  import {
11
11
  MUSHI_MCP_PIN_SPEC
12
- } from "./chunk-3K53JXJ4.js";
12
+ } from "./chunk-WJ7ZTOF7.js";
13
13
  import {
14
14
  detectFramework,
15
15
  envVarsToWrite,
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-AWASJDQI.js";
18
18
  import {
19
19
  assertEndpoint
20
- } from "./chunk-2DMHQVRU.js";
20
+ } from "./chunk-X64CFG54.js";
21
21
 
22
22
  // src/connect.ts
23
23
  import { appendFile, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  resolveSdkEnvKey,
4
4
  runConnect
5
- } from "./chunk-JW3JHZXS.js";
5
+ } from "./chunk-25P6NAME.js";
6
6
  import "./chunk-CG5KPP4S.js";
7
- import "./chunk-G3RJDBYO.js";
8
- import "./chunk-SW53IBFM.js";
9
- import "./chunk-LGGE3LH7.js";
7
+ import "./chunk-UZQZU5OP.js";
8
+ import "./chunk-JQQACG3P.js";
9
+ import "./chunk-X6SC4JKO.js";
10
10
  export {
11
11
  resolveSdkEnvKey,
12
12
  runConnect
@@ -12,10 +12,10 @@ import {
12
12
  runDaemon,
13
13
  stopHint,
14
14
  workerHostId
15
- } from "./chunk-ZNAK5DLR.js";
16
- import "./chunk-G3RJDBYO.js";
17
- import "./chunk-SW53IBFM.js";
18
- import "./chunk-LGGE3LH7.js";
15
+ } from "./chunk-AEXZYEUS.js";
16
+ import "./chunk-UZQZU5OP.js";
17
+ import "./chunk-JQQACG3P.js";
18
+ import "./chunk-X6SC4JKO.js";
19
19
  export {
20
20
  assertWorkerKey,
21
21
  createDaemon,
@@ -5,8 +5,9 @@ import {
5
5
  assertEndpoint,
6
6
  firstEndpoint,
7
7
  normalizeEndpoint,
8
- resolveCloudEndpoint
9
- } from "./chunk-2DMHQVRU.js";
8
+ resolveCloudEndpoint,
9
+ resolvePublicOrigin
10
+ } from "./chunk-X64CFG54.js";
10
11
  export {
11
12
  CLOUD_API_ENDPOINT,
12
13
  CLOUD_MCP_OAUTH_URL,
@@ -14,5 +15,6 @@ export {
14
15
  assertEndpoint,
15
16
  firstEndpoint,
16
17
  normalizeEndpoint,
17
- resolveCloudEndpoint
18
+ resolveCloudEndpoint,
19
+ resolvePublicOrigin
18
20
  };
@@ -6,8 +6,9 @@ import {
6
6
  assertEndpoint,
7
7
  firstEndpoint,
8
8
  normalizeEndpoint,
9
- resolveCloudEndpoint
10
- } from "./chunk-LGGE3LH7.js";
9
+ resolveCloudEndpoint,
10
+ resolvePublicOrigin
11
+ } from "./chunk-X6SC4JKO.js";
11
12
  export {
12
13
  CLOUD_API_ENDPOINT,
13
14
  CLOUD_MCP_OAUTH_URL,
@@ -15,5 +16,6 @@ export {
15
16
  assertEndpoint,
16
17
  firstEndpoint,
17
18
  normalizeEndpoint,
18
- resolveCloudEndpoint
19
+ resolveCloudEndpoint,
20
+ resolvePublicOrigin
19
21
  };
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  sanitizeEndpoint,
29
29
  sanitizeProjectId,
30
30
  writeMcpServerEntry
31
- } from "./chunk-JW3JHZXS.js";
31
+ } from "./chunk-25P6NAME.js";
32
32
  import {
33
33
  FRAMEWORKS,
34
34
  FRAMEWORK_IDS,
@@ -59,7 +59,7 @@ import {
59
59
  registerUxCommands,
60
60
  registerWorkCommands,
61
61
  validateWorkerConfig
62
- } from "./chunk-ZNAK5DLR.js";
62
+ } from "./chunk-AEXZYEUS.js";
63
63
  import {
64
64
  CONFIG_PATH,
65
65
  MushiCliError,
@@ -99,11 +99,11 @@ import {
99
99
  tryLoadKeyFromKeychain,
100
100
  trySaveKeyToKeychain,
101
101
  trySaveWorkerKey
102
- } from "./chunk-G3RJDBYO.js";
102
+ } from "./chunk-UZQZU5OP.js";
103
103
  import {
104
104
  MUSHI_CLI_VERSION,
105
105
  MUSHI_MCP_PIN_SPEC
106
- } from "./chunk-SW53IBFM.js";
106
+ } from "./chunk-JQQACG3P.js";
107
107
  import {
108
108
  CLOUD_API_ENDPOINT,
109
109
  CLOUD_MCP_OAUTH_URL,
@@ -112,7 +112,7 @@ import {
112
112
  firstEndpoint,
113
113
  normalizeEndpoint,
114
114
  resolveCloudEndpoint
115
- } from "./chunk-LGGE3LH7.js";
115
+ } from "./chunk-X6SC4JKO.js";
116
116
 
117
117
  // src/index.ts
118
118
  import { Command } from "commander";
@@ -537,7 +537,7 @@ function chooseProjectNonInteractive(projects, preferredName, appFolder = true)
537
537
  return { kind: "new", name: preferredName };
538
538
  }
539
539
  async function runLogin(opts = {}) {
540
- const { CLOUD_API_ENDPOINT: CLOUD_API_ENDPOINT2, resolveCloudEndpoint: resolveCloudEndpoint2 } = await import("./endpoint-MJATXOXM.js");
540
+ const { CLOUD_API_ENDPOINT: CLOUD_API_ENDPOINT2, resolveCloudEndpoint: resolveCloudEndpoint2 } = await import("./endpoint-XZHMF6EZ.js");
541
541
  const saved = loadConfig().endpoint;
542
542
  const endpoint = opts.endpoint ? resolveCloudEndpoint2(opts.endpoint) : saved ? resolveCloudEndpoint2(saved) : CLOUD_API_ENDPOINT2;
543
543
  const consoleBase = await resolveConsoleUrl();
@@ -1639,7 +1639,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
1639
1639
  }
1640
1640
  async function checkVersionDrift(cwd, doFetch) {
1641
1641
  const checks = [];
1642
- const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-4FOYAOOB.js");
1642
+ const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-JUEQJNGV.js");
1643
1643
  if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
1644
1644
  const parse2 = (v) => {
1645
1645
  const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
@@ -2564,10 +2564,19 @@ function emitWizardFunnelEvent(credentials, endpoint, event, metadata = {}) {
2564
2564
  }).catch(() => {
2565
2565
  });
2566
2566
  }
2567
- function snippetTarget(framework) {
2567
+ function snippetTarget(framework, cwd) {
2568
2568
  const comment = framework.snippet().split("\n").map((l) => l.trim()).find((l) => l.startsWith("//"));
2569
2569
  const text2 = comment?.replace(/^\/\/\s*/, "").trim();
2570
- return text2 && text2.length > 0 ? text2 : "your app entry file";
2570
+ if (!text2) return "your app entry file";
2571
+ return cwd ? existingEntryVariant(cwd, text2) : text2;
2572
+ }
2573
+ function existingEntryVariant(cwd, target) {
2574
+ const m = /^(\S+?)\.(tsx|ts|jsx|js)(\s.*)?$/.exec(target);
2575
+ if (!m || existsSync2(join2(cwd, `${m[1]}.${m[2]}`))) return target;
2576
+ for (const ext of ["tsx", "jsx", "ts", "js"]) {
2577
+ if (ext !== m[2] && existsSync2(join2(cwd, `${m[1]}.${ext}`))) return `${m[1]}.${ext}${m[3] ?? ""}`;
2578
+ }
2579
+ return target;
2571
2580
  }
2572
2581
  async function planSnippetInjection(cwd, framework) {
2573
2582
  const candidates = ENTRY_CANDIDATES[framework.id] ?? [];
@@ -2590,7 +2599,7 @@ async function planSnippetInjection(cwd, framework) {
2590
2599
  unchanged: next === source
2591
2600
  };
2592
2601
  }
2593
- return { kind: "manual", target: snippetTarget(framework) };
2602
+ return { kind: "manual", target: snippetTarget(framework, cwd) };
2594
2603
  }
2595
2604
  async function applySnippetPlan(plan, opts) {
2596
2605
  if (plan.kind === "manual") return plan;
@@ -2656,7 +2665,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
2656
2665
  if (p.isCancel(answer) || !answer) return;
2657
2666
  const endpoint = resolveCloudEndpoint(options.endpoint);
2658
2667
  try {
2659
- const { runConnect: runConnect2 } = await import("./connect-T4XXJHAQ.js");
2668
+ const { runConnect: runConnect2 } = await import("./connect-OPWVFSNG.js");
2660
2669
  const saved = loadConfig();
2661
2670
  const result = await runConnect2(
2662
2671
  {
@@ -5613,7 +5622,7 @@ Examples:
5613
5622
  mushi upgrade --check # CI freshness (no install)
5614
5623
  mushi upgrade --self # upgrade the CLI binary itself
5615
5624
  mushi upgrade --self --dry-run
5616
- mushi upgrade --cwd ../glot.it`).action(async (opts) => {
5625
+ mushi upgrade --cwd ../my-app`).action(async (opts) => {
5617
5626
  if (opts.self) {
5618
5627
  const selfResult = await runSelfUpgrade({ dryRun: opts.dryRun || opts.check });
5619
5628
  if (opts.json) {
@@ -11380,17 +11389,17 @@ function numberOrNull(v) {
11380
11389
  function pickLimits(settings) {
11381
11390
  return Object.fromEntries(SPEND_LIMIT_FIELDS.map((f) => [f, numberOrNull(settings[f])]));
11382
11391
  }
11383
- function renderBudgets(view) {
11384
- const lines = [`Spend limits for project ${view.projectId}`];
11392
+ function renderBudgets(view2) {
11393
+ const lines = [`Spend limits for project ${view2.projectId}`];
11385
11394
  for (const f of SPEND_LIMIT_FIELDS) {
11386
11395
  const meta = LABELS[f];
11387
- const v = view.limits[f];
11396
+ const v = view2.limits[f];
11388
11397
  const shown = v === null ? meta.none : meta.unit === "usd" ? `$${v}` : String(v);
11389
11398
  lines.push(` ${meta.label.padEnd(36)} ${shown}`);
11390
11399
  }
11391
- lines.push(` ${"Plan spend cap (per month)".padEnd(36)} ${view.monthlySpendCapUsd == null ? "no cap" : `$${view.monthlySpendCapUsd}`}`);
11392
- lines.push(` ${"Auto-fix".padEnd(36)} ${view.autofixEnabled ? "on" : "off"}`);
11393
- if (view.autofixEnabled && view.limits.autofix_max_spend_usd === null && view.limits.autofix_max_dispatches_per_day === null) {
11400
+ lines.push(` ${"Plan spend cap (per month)".padEnd(36)} ${view2.monthlySpendCapUsd == null ? "no cap" : `$${view2.monthlySpendCapUsd}`}`);
11401
+ lines.push(` ${"Auto-fix".padEnd(36)} ${view2.autofixEnabled ? "on" : "off"}`);
11402
+ if (view2.autofixEnabled && view2.limits.autofix_max_spend_usd === null && view2.limits.autofix_max_dispatches_per_day === null) {
11394
11403
  lines.push(" Auto-fix is on with no cap. Set one in the console: Settings \u2192 General \u2192 Spend limits.");
11395
11404
  }
11396
11405
  lines.push("Change the plan cap: mushi billing cap <usd>. Change the other limits: console Settings \u2192 General \u2192 Spend limits.");
@@ -11410,17 +11419,17 @@ function registerBudgetsCommands(program2) {
11410
11419
  if (!settings.ok) die(settings);
11411
11420
  if (!billing.ok) die(billing);
11412
11421
  if (!autofix.ok) die(autofix);
11413
- const view = {
11422
+ const view2 = {
11414
11423
  projectId: projectId2,
11415
11424
  limits: pickLimits(settings.data),
11416
11425
  monthlySpendCapUsd: billing.data.monthlySpendCapUsd ?? null,
11417
11426
  autofixEnabled: autofix.data.autofix_enabled
11418
11427
  };
11419
11428
  if (outputIsJson(opts.json)) {
11420
- console.log(JSON.stringify(view, null, 2));
11429
+ console.log(JSON.stringify(view2, null, 2));
11421
11430
  return;
11422
11431
  }
11423
- for (const line of renderBudgets(view)) console.log(line);
11432
+ for (const line of renderBudgets(view2)) console.log(line);
11424
11433
  });
11425
11434
  budgets.command("autofix <state>").description("Turn auto-fix on or off (on | off). Fixes you start yourself always run.").option("--project-id <id>", "Project ID (defaults to the configured project)").action(async (state, opts) => {
11426
11435
  if (state !== "on" && state !== "off") {
@@ -11917,6 +11926,91 @@ function registerDesignCommands(program2) {
11917
11926
  });
11918
11927
  }
11919
11928
 
11929
+ // src/commands/widget.ts
11930
+ var POSITIONS = ["top-left", "top-right", "bottom-left", "bottom-right"];
11931
+ var THEMES = ["auto", "light", "dark", "inherit"];
11932
+ var LAUNCHERS = ["auto", "banner", "edge-tab", "attach", "manual", "hidden"];
11933
+ function view(data) {
11934
+ const w = data.widget ?? {};
11935
+ const str2 = (v) => typeof v === "string" && v ? v : null;
11936
+ return {
11937
+ position: str2(w.position) ?? "bottom-right",
11938
+ theme: str2(w.theme) ?? "auto",
11939
+ triggerText: str2(w.triggerText),
11940
+ accent: str2(w.accent) ?? "auto",
11941
+ accentText: str2(w.accentText),
11942
+ launcher: str2(w.launcher) ?? "auto"
11943
+ };
11944
+ }
11945
+ function oneOf(raw, allowed, flag) {
11946
+ const v = raw.trim().toLowerCase();
11947
+ if (!allowed.includes(v)) {
11948
+ throw new MushiCliError("E_INVALID_INPUT", `${flag} must be one of ${allowed.join(", ")}`);
11949
+ }
11950
+ return v;
11951
+ }
11952
+ function parseAccent(raw) {
11953
+ const v = raw.trim();
11954
+ if (v === "" || v.toLowerCase() === "auto") return null;
11955
+ if (/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.test(v)) return v.startsWith("#") ? v : `#${v}`;
11956
+ throw new MushiCliError("E_INVALID_INPUT", "--accent must be a hex colour like #3b5bdb, or auto to match your site");
11957
+ }
11958
+ function renderWidget(data) {
11959
+ const w = view(data);
11960
+ const lines = [
11961
+ `Launcher: ${w.launcher}`,
11962
+ `Position: ${w.position}`,
11963
+ `Theme: ${w.theme}`,
11964
+ `Trigger text: ${w.triggerText ?? "(default bug icon)"}`,
11965
+ `Accent: ${w.accent === "auto" ? "auto (matches your site)" : `${w.accent}, text ${w.accentText === "#000000" ? "black" : "white"}`}`
11966
+ ];
11967
+ if (data.enabled === false) lines.push("Runtime config is off: installed SDKs ignore these settings (turn it on in the console).");
11968
+ if (data.canEdit === false) lines.push("Read-only: only project owners and admins change these.");
11969
+ lines.push("If your app's code sets one of these in Mushi.init, your code's value wins.");
11970
+ return lines;
11971
+ }
11972
+ function registerWidgetCommands(program2) {
11973
+ const widget = program2.command("widget").description("How the in-app bug widget looks: colour, corner, theme, label (applies without a redeploy)");
11974
+ widget.command("show").description("Show the widget settings served to installed SDKs").option("--project-id <id>", "Project ID (defaults to the configured project)").option("--json", "Machine-readable JSON output").action(async (opts) => {
11975
+ const config = requireConfig();
11976
+ const pid = resolveProjectId(opts.projectId, config.projectId);
11977
+ const result = await apiCall(`/v1/admin/projects/${pid}/sdk-config`, config);
11978
+ if (!result.ok) die(result);
11979
+ if (outputIsJson(opts.json)) {
11980
+ console.log(JSON.stringify({ enabled: result.data.enabled !== false, canEdit: result.data.canEdit ?? null, widget: view(result.data) }, null, 2));
11981
+ return;
11982
+ }
11983
+ for (const line of renderWidget(result.data)) console.log(line);
11984
+ });
11985
+ widget.command("set").description("Change the widget look (project owners and admins)").option("--accent <colour>", "Brand colour as hex (#3b5bdb), or auto to match your site").option("--position <corner>", POSITIONS.join(" | ")).option("--theme <theme>", THEMES.join(" | ")).option("--trigger-text <text>", 'Launcher label, up to 24 characters ("" restores the bug icon)').option("--launcher <mode>", LAUNCHERS.join(" | ")).option("--project-id <id>", "Project ID (defaults to the configured project)").option("--json", "Machine-readable JSON output").action(async (opts) => {
11986
+ const body = {};
11987
+ if (opts.accent !== void 0) body.accent = parseAccent(opts.accent);
11988
+ if (opts.position !== void 0) body.position = oneOf(opts.position, POSITIONS, "--position");
11989
+ if (opts.theme !== void 0) body.theme = oneOf(opts.theme, THEMES, "--theme");
11990
+ if (opts.launcher !== void 0) body.launcher = oneOf(opts.launcher, LAUNCHERS, "--launcher");
11991
+ if (opts.triggerText !== void 0) {
11992
+ if (opts.triggerText.length > 24) throw new MushiCliError("E_INVALID_INPUT", "--trigger-text must be 24 characters or fewer");
11993
+ body.triggerText = opts.triggerText.trim() ? opts.triggerText : null;
11994
+ }
11995
+ if (Object.keys(body).length === 0) {
11996
+ throw new MushiCliError("E_INVALID_INPUT", "Nothing to change: pass --accent, --position, --theme, --trigger-text or --launcher.");
11997
+ }
11998
+ const config = requireConfig();
11999
+ const pid = resolveProjectId(opts.projectId, config.projectId);
12000
+ const result = await apiCall(`/v1/admin/projects/${pid}/sdk-config`, config, {
12001
+ method: "PUT",
12002
+ body: JSON.stringify({ widget: body })
12003
+ });
12004
+ if (!result.ok) die(result);
12005
+ if (outputIsJson(opts.json)) {
12006
+ console.log(JSON.stringify({ enabled: result.data.enabled !== false, widget: view(result.data) }, null, 2));
12007
+ return;
12008
+ }
12009
+ console.log("Saved. Installed SDKs pick this up at their next start.");
12010
+ for (const line of renderWidget(result.data)) console.log(line);
12011
+ });
12012
+ }
12013
+
11920
12014
  // src/commands/ux-runs.ts
11921
12015
  var STATUS_LABEL = {
11922
12016
  accepted: "improved",
@@ -14621,6 +14715,7 @@ registerRepoCommands(program);
14621
14715
  registerAccountsCommands(program);
14622
14716
  registerSpendCommands(program);
14623
14717
  registerDesignCommands(program);
14718
+ registerWidgetCommands(program);
14624
14719
  registerUxCommands(program);
14625
14720
  registerUxRunsCommands(program);
14626
14721
  registerRunnerCommands(program);
package/dist/init.d.ts CHANGED
@@ -280,7 +280,7 @@ type SnippetPlan = {
280
280
  * "app/providers.tsx (or pages/_app.tsx …)"), from its first `//` comment.
281
281
  * @internal Exported for tests only.
282
282
  */
283
- declare function snippetTarget(framework: Framework): string;
283
+ declare function snippetTarget(framework: Framework, cwd?: string): string;
284
284
  /**
285
285
  * Plan the snippet edit with the same idempotent marker injection for every
286
286
  * mode. Only frameworks in ENTRY_CANDIDATES (a plain top-of-file import) are
package/dist/init.js CHANGED
@@ -13,12 +13,12 @@ import {
13
13
  sampleBugSnippet,
14
14
  sanitizeSecret,
15
15
  snippetTarget
16
- } from "./chunk-ZTCOD6BX.js";
16
+ } from "./chunk-AKUYV2CR.js";
17
17
  import "./chunk-LFP3NPZT.js";
18
- import "./chunk-XB3IJVAR.js";
19
- import "./chunk-3K53JXJ4.js";
18
+ import "./chunk-LHSWFJOB.js";
19
+ import "./chunk-WJ7ZTOF7.js";
20
20
  import "./chunk-AWASJDQI.js";
21
- import "./chunk-2DMHQVRU.js";
21
+ import "./chunk-X64CFG54.js";
22
22
  export {
23
23
  CLI_FRESHNESS_SOURCE,
24
24
  applySnippetPlan,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MUSHI_CLI_VERSION,
4
4
  MUSHI_MCP_PIN_SPEC
5
- } from "./chunk-SW53IBFM.js";
5
+ } from "./chunk-JQQACG3P.js";
6
6
  export {
7
7
  MUSHI_CLI_VERSION,
8
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.31.8";
17
+ declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.33.0";
18
18
 
19
19
  export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION,
3
3
  MUSHI_MCP_PIN_SPEC
4
- } from "./chunk-3K53JXJ4.js";
4
+ } from "./chunk-WJ7ZTOF7.js";
5
5
  export {
6
6
  MUSHI_CLI_VERSION,
7
7
  MUSHI_MCP_PIN_SPEC
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runInit
3
- } from "./chunk-ZTCOD6BX.js";
3
+ } from "./chunk-AKUYV2CR.js";
4
4
  import {
5
5
  FLAGS_HELP,
6
6
  UNKNOWN_COMMAND_EXIT,
@@ -11,10 +11,10 @@ import {
11
11
  scaffoldTemplate
12
12
  } from "./chunk-4JF7C3MY.js";
13
13
  import "./chunk-LFP3NPZT.js";
14
- import "./chunk-XB3IJVAR.js";
15
- import "./chunk-3K53JXJ4.js";
14
+ import "./chunk-LHSWFJOB.js";
15
+ import "./chunk-WJ7ZTOF7.js";
16
16
  import "./chunk-AWASJDQI.js";
17
- import "./chunk-2DMHQVRU.js";
17
+ import "./chunk-X64CFG54.js";
18
18
 
19
19
  // src/wizard-bin.ts
20
20
  import { spawnSync } from "child_process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mushi-mushi/cli",
3
- "version": "0.41.0",
3
+ "version": "0.43.0",
4
4
  "license": "MIT",
5
5
  "description": "Mushi Mushi CLI: SDK setup, MCP wiring, triage. One place to improve AI-built apps: fix bugs, smooth user journeys and clean up the code.",
6
6
  "bin": {
@@ -1,8 +0,0 @@
1
- // src/version.ts
2
- var MUSHI_CLI_VERSION = true ? "0.41.0" : "0.0.0-dev";
3
- var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.8";
4
-
5
- export {
6
- MUSHI_CLI_VERSION,
7
- MUSHI_MCP_PIN_SPEC
8
- };
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/version.ts
4
- var MUSHI_CLI_VERSION = true ? "0.41.0" : "0.0.0-dev";
5
- var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.8";
6
-
7
- export {
8
- MUSHI_CLI_VERSION,
9
- MUSHI_MCP_PIN_SPEC
10
- };