@mushi-mushi/cli 0.38.0 → 0.40.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.
Files changed (51) hide show
  1. package/dist/{chunk-AIZRI665.js → chunk-AWASJDQI.js} +62 -33
  2. package/dist/{chunk-KOBEOGNF.js → chunk-CG5KPP4S.js} +62 -33
  3. package/dist/chunk-CNJIN4ST.js +10 -0
  4. package/dist/{chunk-QZMSGTVZ.js → chunk-ETFORW35.js} +1 -1
  5. package/dist/chunk-FA5LABKE.js +2279 -0
  6. package/dist/chunk-JWG2QI3W.js +8 -0
  7. package/dist/{chunk-JXAH3XKH.js → chunk-PGLH5XP2.js} +3 -3
  8. package/dist/chunk-TNTSV54C.js +160 -0
  9. package/dist/{chunk-V3DR4WLG.js → chunk-UV4DMSQH.js} +1 -1
  10. package/dist/{chunk-BUCMB4NS.js → chunk-WXICRZIU.js} +4 -4
  11. package/dist/{connect-M2IGP63E.js → connect-BSMHOKUQ.js} +4 -4
  12. package/dist/{connect-OTHJSNHC.js → connect-NKWXYGN7.js} +4 -4
  13. package/dist/{daemon-VYXTQ5TG.js → daemon-6SCU35YF.js} +3 -3
  14. package/dist/{detect-WZT5X6LP.js → detect-SOXPECZ3.js} +5 -1
  15. package/dist/detect.d.ts +17 -1
  16. package/dist/detect.js +5 -1
  17. package/dist/index.js +130 -62
  18. package/dist/init.js +11 -2264
  19. package/dist/{snippet-inject-NDAPEL2T.js → snippet-inject-AVGVHTUJ.js} +3 -2
  20. package/dist/{snippet-inject-LPRWTQDE.js → snippet-inject-ETGBPDYB.js} +3 -2
  21. package/dist/{version-ULUVAZ3V.js → version-SLVFYTAI.js} +1 -1
  22. package/dist/version.d.ts +1 -1
  23. package/dist/version.js +1 -1
  24. package/dist/wizard-args.d.ts +35 -1
  25. package/dist/wizard-args.js +14 -95
  26. package/dist/wizard-bin.d.ts +32 -0
  27. package/dist/wizard-bin.js +106 -0
  28. package/package.json +8 -1
  29. package/templates/node/.env.example +4 -0
  30. package/templates/node/README.md +12 -0
  31. package/templates/node/gitignore +6 -0
  32. package/templates/node/package.json +15 -0
  33. package/templates/node/src/server.mjs +38 -0
  34. package/templates/svelte/.env.example +4 -0
  35. package/templates/svelte/README.md +10 -0
  36. package/templates/svelte/gitignore +6 -0
  37. package/templates/svelte/index.html +12 -0
  38. package/templates/svelte/package.json +20 -0
  39. package/templates/svelte/src/App.svelte +20 -0
  40. package/templates/svelte/src/main.ts +12 -0
  41. package/templates/svelte/vite.config.ts +6 -0
  42. package/templates/vue/.env.example +4 -0
  43. package/templates/vue/README.md +10 -0
  44. package/templates/vue/gitignore +6 -0
  45. package/templates/vue/index.html +12 -0
  46. package/templates/vue/package.json +20 -0
  47. package/templates/vue/src/App.vue +22 -0
  48. package/templates/vue/src/main.ts +12 -0
  49. package/templates/vue/vite.config.ts +6 -0
  50. package/dist/chunk-DJNAPA4D.js +0 -10
  51. package/dist/chunk-M5LN4ZWQ.js +0 -8
@@ -0,0 +1,8 @@
1
+ // src/version.ts
2
+ var MUSHI_CLI_VERSION = true ? "0.40.0" : "0.0.0-dev";
3
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.2";
4
+
5
+ export {
6
+ MUSHI_CLI_VERSION,
7
+ MUSHI_MCP_PIN_SPEC
8
+ };
@@ -8,10 +8,10 @@ import {
8
8
  requireConfig,
9
9
  requireUuid,
10
10
  tryLoadWorkerKey
11
- } from "./chunk-QZMSGTVZ.js";
11
+ } from "./chunk-ETFORW35.js";
12
12
  import {
13
13
  MUSHI_CLI_VERSION
14
- } from "./chunk-DJNAPA4D.js";
14
+ } from "./chunk-CNJIN4ST.js";
15
15
 
16
16
  // src/worker/daemon.ts
17
17
  import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
@@ -1613,7 +1613,7 @@ function registerWorkCommands(program) {
1613
1613
  if (opts.repoDir || opts.report || opts.followups || opts.recheck) {
1614
1614
  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");
1615
1615
  }
1616
- const { runDaemon: runDaemon2 } = await import("./daemon-VYXTQ5TG.js");
1616
+ const { runDaemon: runDaemon2 } = await import("./daemon-6SCU35YF.js");
1617
1617
  await runDaemon2({ configPath: opts.workerConfig, ...opts.agent !== void 0 ? { agent } : {}, ...opts.anyRepo ? { anyRepo: true } : {} });
1618
1618
  return;
1619
1619
  }
@@ -0,0 +1,160 @@
1
+ import {
2
+ FRAMEWORK_IDS,
3
+ isFrameworkId
4
+ } from "./chunk-AWASJDQI.js";
5
+
6
+ // src/template.ts
7
+ import { cpSync, existsSync, renameSync } from "fs";
8
+ import { join, resolve } from "path";
9
+ import { fileURLToPath } from "url";
10
+ var TEMPLATE_IDS = ["vue", "svelte", "node"];
11
+ function isTemplateId(value) {
12
+ return typeof value === "string" && TEMPLATE_IDS.includes(value);
13
+ }
14
+ function templateDir(id) {
15
+ return fileURLToPath(new URL(`../templates/${id}`, import.meta.url));
16
+ }
17
+ function scaffoldTemplate(id, targetArg, cwd = process.cwd()) {
18
+ const relTarget = targetArg ?? `mushi-${id}-app`;
19
+ const targetDir = resolve(cwd, relTarget);
20
+ if (existsSync(targetDir)) {
21
+ throw new Error(`target directory already exists: ${targetDir}`);
22
+ }
23
+ cpSync(templateDir(id), targetDir, { recursive: true });
24
+ renameSync(join(targetDir, "gitignore"), join(targetDir, ".gitignore"));
25
+ return `Scaffolded the ${id} starter into ${targetDir}
26
+
27
+ Next steps:
28
+ cd "${relTarget}"
29
+ npm install
30
+ npx mushi-mushi # browser sign-in, writes your env vars
31
+ ${id === "node" ? "npm start" : "npm run dev"}
32
+ `;
33
+ }
34
+
35
+ // src/wizard-args.ts
36
+ var MIN_NODE_MAJOR = 20;
37
+ var WIZARD_PROBE_ENV = "MUSHI_WIZARD_PROBE";
38
+ var UNKNOWN_COMMAND_EXIT = 64;
39
+ function isUnknownTopLevelCommand(word, commands) {
40
+ if (word === void 0 || word.startsWith("-") || word === "help") return false;
41
+ return !commands.some((c) => c.name() === word || c.aliases().includes(word));
42
+ }
43
+ function newAppHint(word) {
44
+ return `To start a new app instead: npx mushi-mushi --template <${TEMPLATE_IDS.join("|")}> ${word}`;
45
+ }
46
+ var FLAGS_HELP = `Start a new app instead:
47
+ --template <id> [dir] scaffold a starter app (${TEMPLATE_IDS.join(", ")}) into [dir]
48
+ (default ./mushi-<id>-app) instead of running the wizard
49
+
50
+ Flags (forwarded to the wizard):
51
+ --project-id <uuid> skip the project ID prompt (UUID from the Projects page)
52
+ --api-key <key> skip the API key prompt with an ingest-only key (CI only \u2014 leaks into \`ps\`)
53
+ --framework <id> force a framework (${FRAMEWORK_IDS.join(", ")})
54
+ --skip-install print the install command instead of running it
55
+ --skip-test-report don't offer to send a test report at the end
56
+ --audit health-check an existing install (doctor checks) instead of re-running the wizard
57
+ --cwd <path> run in a different directory
58
+ --endpoint <url> override the Mushi API endpoint (self-hosted)
59
+ -y, --yes take the defaults: detected framework, saved credentials, browser sign-in
60
+ (required in non-interactive shells such as an AI agent's terminal, where
61
+ the sign-in URL is printed and the project is picked by the app's name)
62
+ -v, --version print the version and exit
63
+ -h, --help show this help
64
+
65
+ Requires Node.js ${MIN_NODE_MAJOR} or newer.
66
+
67
+ Docs: https://kensaur.us/mushi-mushi/docs/
68
+ Console: https://kensaur.us/mushi-mushi/`;
69
+ function parseArgs(argv) {
70
+ const args = argv[0] === "init" ? argv.slice(1) : argv;
71
+ const out = { showHelp: false, showVersion: false };
72
+ for (let i = 0; i < args.length; i++) {
73
+ const a = args[i];
74
+ if (a === "-h" || a === "--help") {
75
+ out.showHelp = true;
76
+ continue;
77
+ }
78
+ if (a === "-v" || a === "--version") {
79
+ out.showVersion = true;
80
+ continue;
81
+ }
82
+ if (a === "-y" || a === "--yes") {
83
+ out.yes = true;
84
+ continue;
85
+ }
86
+ if (a === "--skip-install") {
87
+ out.skipInstall = true;
88
+ continue;
89
+ }
90
+ if (a === "--skip-test-report") {
91
+ out.skipTestReport = true;
92
+ continue;
93
+ }
94
+ if (a === "--audit") {
95
+ out.audit = true;
96
+ continue;
97
+ }
98
+ if (a === "--project-id") {
99
+ out.projectId = args[++i];
100
+ continue;
101
+ }
102
+ if (a === "--api-key") {
103
+ out.apiKey = args[++i];
104
+ continue;
105
+ }
106
+ if (a === "--cwd") {
107
+ out.cwd = args[++i];
108
+ continue;
109
+ }
110
+ if (a === "--endpoint") {
111
+ out.endpoint = args[++i];
112
+ continue;
113
+ }
114
+ if (a === "--framework") {
115
+ const fw = args[++i];
116
+ if (!isFrameworkId(fw)) {
117
+ throw new Error(`Unknown framework: ${fw}. Valid: ${FRAMEWORK_IDS.join(", ")}`);
118
+ }
119
+ out.framework = fw;
120
+ continue;
121
+ }
122
+ if (a === "--template") {
123
+ const id = args[++i];
124
+ if (!isTemplateId(id)) {
125
+ throw new Error(`Unknown template: ${id ?? "(missing)"}. Valid: ${TEMPLATE_IDS.join(", ")}`);
126
+ }
127
+ out.template = id;
128
+ const next = args[i + 1];
129
+ if (next !== void 0 && !next.startsWith("-")) out.templateDir = args[++i];
130
+ continue;
131
+ }
132
+ if (a.startsWith("-")) {
133
+ throw new Error(`Unknown flag: ${a}. Try --help.`);
134
+ }
135
+ }
136
+ return out;
137
+ }
138
+ function assertNodeVersion(binName) {
139
+ const major = Number(process.versions.node.split(".")[0]);
140
+ if (!Number.isFinite(major) || major < MIN_NODE_MAJOR) {
141
+ process.stderr.write(
142
+ `${binName} requires Node.js ${MIN_NODE_MAJOR} or newer. You are on ${process.versions.node}.
143
+ Upgrade Node (https://nodejs.org/) and try again.
144
+ `
145
+ );
146
+ process.exit(1);
147
+ }
148
+ }
149
+
150
+ export {
151
+ scaffoldTemplate,
152
+ MIN_NODE_MAJOR,
153
+ WIZARD_PROBE_ENV,
154
+ UNKNOWN_COMMAND_EXIT,
155
+ isUnknownTopLevelCommand,
156
+ newAppHint,
157
+ FLAGS_HELP,
158
+ parseArgs,
159
+ assertNodeVersion
160
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION
3
- } from "./chunk-M5LN4ZWQ.js";
3
+ } from "./chunk-JWG2QI3W.js";
4
4
  import {
5
5
  assertEndpoint,
6
6
  normalizeEndpoint
@@ -3,16 +3,16 @@ import {
3
3
  detectFramework,
4
4
  envVarsToWrite,
5
5
  readPackageJson
6
- } from "./chunk-KOBEOGNF.js";
6
+ } from "./chunk-CG5KPP4S.js";
7
7
  import {
8
8
  CONFIG_PATH,
9
9
  requireUuid,
10
10
  saveConfig,
11
11
  savedSdkKeyFor
12
- } from "./chunk-QZMSGTVZ.js";
12
+ } from "./chunk-ETFORW35.js";
13
13
  import {
14
14
  MUSHI_MCP_PIN_SPEC
15
- } from "./chunk-DJNAPA4D.js";
15
+ } from "./chunk-CNJIN4ST.js";
16
16
  import {
17
17
  assertEndpoint,
18
18
  normalizeEndpoint
@@ -348,7 +348,7 @@ async function runConnect(opts, baseConfig = {}) {
348
348
  const deps = { ...pkg?.dependencies ?? {}, ...pkg?.devDependencies ?? {} };
349
349
  if (deps["@capacitor/core"] && deps["react"]) {
350
350
  messages.push(
351
- "\u2139 Capacitor + React detected \u2014 install @mushi-mushi/web (or @mushi-mushi/react) and call initMushi() in main.tsx. Optional @mushi-mushi/capacitor for native shell parity."
351
+ "\u2139 Capacitor + React detected \u2014 install mushi-mushi (import from mushi-mushi/react) and call initMushi() in main.tsx. Optional @mushi-mushi/capacitor for native shell parity."
352
352
  );
353
353
  }
354
354
  }
@@ -6,15 +6,15 @@ import {
6
6
  saveConfig,
7
7
  savedSdkKeyFor,
8
8
  waitForIngestReady
9
- } from "./chunk-V3DR4WLG.js";
9
+ } from "./chunk-UV4DMSQH.js";
10
10
  import {
11
11
  MUSHI_MCP_PIN_SPEC
12
- } from "./chunk-M5LN4ZWQ.js";
12
+ } from "./chunk-JWG2QI3W.js";
13
13
  import {
14
14
  detectFramework,
15
15
  envVarsToWrite,
16
16
  readPackageJson
17
- } from "./chunk-AIZRI665.js";
17
+ } from "./chunk-AWASJDQI.js";
18
18
  import {
19
19
  assertEndpoint
20
20
  } from "./chunk-2DMHQVRU.js";
@@ -174,7 +174,7 @@ async function runConnect(opts, baseConfig = {}) {
174
174
  const deps = { ...pkg?.dependencies ?? {}, ...pkg?.devDependencies ?? {} };
175
175
  if (deps["@capacitor/core"] && deps["react"]) {
176
176
  messages.push(
177
- "\u2139 Capacitor + React detected \u2014 install @mushi-mushi/web (or @mushi-mushi/react) and call initMushi() in main.tsx. Optional @mushi-mushi/capacitor for native shell parity."
177
+ "\u2139 Capacitor + React detected \u2014 install mushi-mushi (import from mushi-mushi/react) and call initMushi() in main.tsx. Optional @mushi-mushi/capacitor for native shell parity."
178
178
  );
179
179
  }
180
180
  }
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  resolveSdkEnvKey,
4
4
  runConnect
5
- } from "./chunk-BUCMB4NS.js";
6
- import "./chunk-KOBEOGNF.js";
7
- import "./chunk-QZMSGTVZ.js";
8
- import "./chunk-DJNAPA4D.js";
5
+ } from "./chunk-WXICRZIU.js";
6
+ import "./chunk-CG5KPP4S.js";
7
+ import "./chunk-ETFORW35.js";
8
+ import "./chunk-CNJIN4ST.js";
9
9
  import "./chunk-LGGE3LH7.js";
10
10
  export {
11
11
  resolveSdkEnvKey,
@@ -10,9 +10,9 @@ import {
10
10
  readWorkerKey,
11
11
  runDaemon,
12
12
  workerHostId
13
- } from "./chunk-JXAH3XKH.js";
14
- import "./chunk-QZMSGTVZ.js";
15
- import "./chunk-DJNAPA4D.js";
13
+ } from "./chunk-PGLH5XP2.js";
14
+ import "./chunk-ETFORW35.js";
15
+ import "./chunk-CNJIN4ST.js";
16
16
  import "./chunk-LGGE3LH7.js";
17
17
  export {
18
18
  assertWorkerKey,
@@ -7,8 +7,10 @@ import {
7
7
  envVarsToWrite,
8
8
  installCommand,
9
9
  isFrameworkId,
10
+ isLauncherOnly,
11
+ isMushiSdkPackage,
10
12
  readPackageJson
11
- } from "./chunk-KOBEOGNF.js";
13
+ } from "./chunk-CG5KPP4S.js";
12
14
  export {
13
15
  FRAMEWORKS,
14
16
  FRAMEWORK_IDS,
@@ -17,5 +19,7 @@ export {
17
19
  envVarsToWrite,
18
20
  installCommand,
19
21
  isFrameworkId,
22
+ isLauncherOnly,
23
+ isMushiSdkPackage,
20
24
  readPackageJson
21
25
  };
package/dist/detect.d.ts CHANGED
@@ -7,7 +7,10 @@ type FrameworkId = 'next' | 'react' | 'cra' | 'remix' | 'astro' | 'solid' | 'vue
7
7
  interface Framework {
8
8
  id: FrameworkId;
9
9
  label: string;
10
+ /** What the wizard installs: `mushi-mushi`, or the scoped native package (React Native, Capacitor). */
10
11
  packageName: string;
12
+ /** Where the snippet imports from, e.g. `mushi-mushi/react`. */
13
+ importPath: string;
11
14
  needsWebPackage: boolean;
12
15
  snippet: () => string;
13
16
  }
@@ -21,10 +24,23 @@ type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
21
24
  declare const FRAMEWORK_IDS: ReadonlyArray<FrameworkId>;
22
25
  declare function isFrameworkId(value: unknown): value is FrameworkId;
23
26
  declare const FRAMEWORKS: Record<FrameworkId, Framework>;
27
+ /**
28
+ * True for a dependency name that is a Mushi Mushi package: the `mushi-mushi`
29
+ * umbrella or any scoped `@mushi-mushi/*` package (older installs keep working).
30
+ */
31
+ declare function isMushiSdkPackage(name: string): boolean;
32
+ /**
33
+ * True for `mushi-mushi` pinned below 1.0. Before ADR 0060 that package was
34
+ * only the `npx mushi-mushi` setup command; the SDK ships in it from 1.x. A
35
+ * project that keeps `mushi-mushi@^0.8` to run the wizard has no SDK from it,
36
+ * and moving it to 1.x would add the whole SDK, so neither `mushi upgrade` nor
37
+ * `mushi doctor` treats it as one. Mirrors the server's isUmbrellaLauncherOnly.
38
+ */
39
+ declare function isLauncherOnly(name: string, spec: string | undefined): boolean;
24
40
  declare function readPackageJson(cwd: string): PackageJson | null;
25
41
  declare function detectFramework(cwd: string, pkg: PackageJson | null): Framework;
26
42
  declare function detectPackageManager(cwd: string): PackageManager;
27
43
  declare function installCommand(pm: PackageManager, packages: string[]): string;
28
44
  declare function envVarsToWrite(apiKey: string, projectId: string, framework: Framework, endpoint?: string): string;
29
45
 
30
- export { FRAMEWORKS, FRAMEWORK_IDS, type Framework, type FrameworkId, type PackageJson, type PackageManager, detectFramework, detectPackageManager, envVarsToWrite, installCommand, isFrameworkId, readPackageJson };
46
+ export { FRAMEWORKS, FRAMEWORK_IDS, type Framework, type FrameworkId, type PackageJson, type PackageManager, detectFramework, detectPackageManager, envVarsToWrite, installCommand, isFrameworkId, isLauncherOnly, isMushiSdkPackage, readPackageJson };
package/dist/detect.js CHANGED
@@ -6,8 +6,10 @@ import {
6
6
  envVarsToWrite,
7
7
  installCommand,
8
8
  isFrameworkId,
9
+ isLauncherOnly,
10
+ isMushiSdkPackage,
9
11
  readPackageJson
10
- } from "./chunk-AIZRI665.js";
12
+ } from "./chunk-AWASJDQI.js";
11
13
  export {
12
14
  FRAMEWORKS,
13
15
  FRAMEWORK_IDS,
@@ -16,5 +18,7 @@ export {
16
18
  envVarsToWrite,
17
19
  installCommand,
18
20
  isFrameworkId,
21
+ isLauncherOnly,
22
+ isMushiSdkPackage,
19
23
  readPackageJson
20
24
  };