@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
@@ -28,6 +28,7 @@ ${cleaned}`;
28
28
  var SOURCE_DIRS = ["src", "app", "pages", "lib", "components"];
29
29
  var SOURCE_EXTS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".vue", ".svelte"]);
30
30
  var MAX_FILES_SCANNED = 2e3;
31
+ var SDK_IMPORT = /@mushi-mushi\/|['"]mushi-mushi(?:\/[\w-]+)*['"]|MushiProvider/;
31
32
  async function findSdkImport(cwd) {
32
33
  let scanned = 0;
33
34
  async function walk(dir, depth) {
@@ -48,7 +49,7 @@ async function findSdkImport(cwd) {
48
49
  scanned += 1;
49
50
  try {
50
51
  const content = await readFile(join(dir, entry.name), "utf8");
51
- if (content.includes("@mushi-mushi/") || content.includes("MushiProvider")) {
52
+ if (SDK_IMPORT.test(content)) {
52
53
  return { file: join(dir, entry.name) };
53
54
  }
54
55
  } catch {
@@ -64,7 +65,7 @@ async function findSdkImport(cwd) {
64
65
  for (const name of ["main.ts", "main.js", "index.js", "index.ts", "index.html"]) {
65
66
  try {
66
67
  const content = await readFile(join(cwd, name), "utf8");
67
- if (content.includes("@mushi-mushi/") || content.includes("MushiProvider") || content.includes("mushi-mushi")) {
68
+ if (SDK_IMPORT.test(content) || content.includes("mushi-mushi")) {
68
69
  return { file: join(cwd, name) };
69
70
  }
70
71
  } catch {
@@ -30,6 +30,7 @@ ${cleaned}`;
30
30
  var SOURCE_DIRS = ["src", "app", "pages", "lib", "components"];
31
31
  var SOURCE_EXTS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".vue", ".svelte"]);
32
32
  var MAX_FILES_SCANNED = 2e3;
33
+ var SDK_IMPORT = /@mushi-mushi\/|['"]mushi-mushi(?:\/[\w-]+)*['"]|MushiProvider/;
33
34
  async function findSdkImport(cwd) {
34
35
  let scanned = 0;
35
36
  async function walk(dir, depth) {
@@ -50,7 +51,7 @@ async function findSdkImport(cwd) {
50
51
  scanned += 1;
51
52
  try {
52
53
  const content = await readFile(join(dir, entry.name), "utf8");
53
- if (content.includes("@mushi-mushi/") || content.includes("MushiProvider")) {
54
+ if (SDK_IMPORT.test(content)) {
54
55
  return { file: join(dir, entry.name) };
55
56
  }
56
57
  } catch {
@@ -66,7 +67,7 @@ async function findSdkImport(cwd) {
66
67
  for (const name of ["main.ts", "main.js", "index.js", "index.ts", "index.html"]) {
67
68
  try {
68
69
  const content = await readFile(join(cwd, name), "utf8");
69
- if (content.includes("@mushi-mushi/") || content.includes("MushiProvider") || content.includes("mushi-mushi")) {
70
+ if (SDK_IMPORT.test(content) || content.includes("mushi-mushi")) {
70
71
  return { file: join(cwd, name) };
71
72
  }
72
73
  } catch {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MUSHI_CLI_VERSION,
4
4
  MUSHI_MCP_PIN_SPEC
5
- } from "./chunk-DJNAPA4D.js";
5
+ } from "./chunk-CNJIN4ST.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.0";
17
+ declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.2";
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-M5LN4ZWQ.js";
4
+ } from "./chunk-JWG2QI3W.js";
5
5
  export {
6
6
  MUSHI_CLI_VERSION,
7
7
  MUSHI_MCP_PIN_SPEC
@@ -1,5 +1,18 @@
1
1
  import { FrameworkId } from './detect.js';
2
2
 
3
+ /**
4
+ * FILE: packages/cli/src/template.ts
5
+ * PURPOSE: `npx mushi-mushi --template <vue|svelte|node> [dir]` — copy a
6
+ * minimal starter app from packages/cli/templates/<id>. Moved here
7
+ * from create-mushi-mushi (ADR 0060 Phase 1b), which now forwards to
8
+ * the same code. Dependency-free (plain cpSync): the starter's own
9
+ * README covers `npm install` and `npx mushi-mushi` for credentials,
10
+ * so no wizard run happens here.
11
+ */
12
+ /** Starter templates shipped inside the published package (templates/<id>/). */
13
+ declare const TEMPLATE_IDS: readonly ["vue", "svelte", "node"];
14
+ type TemplateId = (typeof TEMPLATE_IDS)[number];
15
+
3
16
  /**
4
17
  * FILE: packages/cli/src/wizard-args.ts
5
18
  * PURPOSE: Shared argument parsing, Node-version guard, and help text for the
@@ -11,6 +24,23 @@ import { FrameworkId } from './detect.js';
11
24
 
12
25
  /** Minimum Node major both shims require. Kept in sync with each package's `engines.node`. */
13
26
  declare const MIN_NODE_MAJOR = 20;
27
+ /**
28
+ * `npm create mushi-mushi my-app` passes a bare word that is not a `mushi`
29
+ * command. The bins forward every bare word to the `mushi` bin with this env
30
+ * var set; the CLI checks the word against its live command tree and, if it
31
+ * is unknown, exits {@link UNKNOWN_COMMAND_EXIT} without printing anything, so
32
+ * the bin runs the wizard instead. No hand-kept command list to drift.
33
+ */
34
+ declare const WIZARD_PROBE_ENV = "MUSHI_WIZARD_PROBE";
35
+ /** EX_USAGE. The CLI's own exit codes are 0–3, so this cannot be mistaken for one. */
36
+ declare const UNKNOWN_COMMAND_EXIT = 64;
37
+ /** The command(s) a top-level `mushi` invocation would not recognise. */
38
+ declare function isUnknownTopLevelCommand(word: string | undefined, commands: ReadonlyArray<{
39
+ name(): string;
40
+ aliases(): string[];
41
+ }>): boolean;
42
+ /** The one line printed before the wizard when the bare word was not a command. */
43
+ declare function newAppHint(word: string): string;
14
44
  interface ParsedArgs {
15
45
  showHelp: boolean;
16
46
  showVersion: boolean;
@@ -23,6 +53,10 @@ interface ParsedArgs {
23
53
  cwd?: string;
24
54
  endpoint?: string;
25
55
  audit?: boolean;
56
+ /** `--template <id>`: scaffold a starter app instead of running the wizard. */
57
+ template?: TemplateId;
58
+ /** Optional directory right after the template id. */
59
+ templateDir?: string;
26
60
  }
27
61
  /**
28
62
  * The flags block shared by both shims' help text. Ends with the Node
@@ -42,4 +76,4 @@ declare function parseArgs(argv: readonly string[]): ParsedArgs;
42
76
  */
43
77
  declare function assertNodeVersion(binName: string): void;
44
78
 
45
- export { FLAGS_HELP, MIN_NODE_MAJOR, type ParsedArgs, assertNodeVersion, parseArgs };
79
+ export { FLAGS_HELP, MIN_NODE_MAJOR, type ParsedArgs, UNKNOWN_COMMAND_EXIT, WIZARD_PROBE_ENV, assertNodeVersion, isUnknownTopLevelCommand, newAppHint, parseArgs };
@@ -1,102 +1,21 @@
1
1
  import {
2
- FRAMEWORK_IDS,
3
- isFrameworkId
4
- } from "./chunk-AIZRI665.js";
5
-
6
- // src/wizard-args.ts
7
- var MIN_NODE_MAJOR = 20;
8
- var FLAGS_HELP = `Flags (forwarded to the wizard):
9
- --project-id <uuid> skip the project ID prompt (UUID from the Projects page)
10
- --api-key <key> skip the API key prompt with an ingest-only key (CI only \u2014 leaks into \`ps\`)
11
- --framework <id> force a framework (${FRAMEWORK_IDS.join(", ")})
12
- --skip-install print the install command instead of running it
13
- --skip-test-report don't offer to send a test report at the end
14
- --audit health-check an existing install (doctor checks) instead of re-running the wizard
15
- --cwd <path> run in a different directory
16
- --endpoint <url> override the Mushi API endpoint (self-hosted)
17
- -y, --yes take the defaults: detected framework, saved credentials, browser sign-in
18
- (required in non-interactive shells such as an AI agent's terminal, where
19
- the sign-in URL is printed and the project is picked by the app's name)
20
- -v, --version print the version and exit
21
- -h, --help show this help
22
-
23
- Requires Node.js ${MIN_NODE_MAJOR} or newer.
24
-
25
- Docs: https://kensaur.us/mushi-mushi/docs/
26
- Console: https://kensaur.us/mushi-mushi/`;
27
- function parseArgs(argv) {
28
- const args = argv[0] === "init" ? argv.slice(1) : argv;
29
- const out = { showHelp: false, showVersion: false };
30
- for (let i = 0; i < args.length; i++) {
31
- const a = args[i];
32
- if (a === "-h" || a === "--help") {
33
- out.showHelp = true;
34
- continue;
35
- }
36
- if (a === "-v" || a === "--version") {
37
- out.showVersion = true;
38
- continue;
39
- }
40
- if (a === "-y" || a === "--yes") {
41
- out.yes = true;
42
- continue;
43
- }
44
- if (a === "--skip-install") {
45
- out.skipInstall = true;
46
- continue;
47
- }
48
- if (a === "--skip-test-report") {
49
- out.skipTestReport = true;
50
- continue;
51
- }
52
- if (a === "--audit") {
53
- out.audit = true;
54
- continue;
55
- }
56
- if (a === "--project-id") {
57
- out.projectId = args[++i];
58
- continue;
59
- }
60
- if (a === "--api-key") {
61
- out.apiKey = args[++i];
62
- continue;
63
- }
64
- if (a === "--cwd") {
65
- out.cwd = args[++i];
66
- continue;
67
- }
68
- if (a === "--endpoint") {
69
- out.endpoint = args[++i];
70
- continue;
71
- }
72
- if (a === "--framework") {
73
- const fw = args[++i];
74
- if (!isFrameworkId(fw)) {
75
- throw new Error(`Unknown framework: ${fw}. Valid: ${FRAMEWORK_IDS.join(", ")}`);
76
- }
77
- out.framework = fw;
78
- continue;
79
- }
80
- if (a.startsWith("-")) {
81
- throw new Error(`Unknown flag: ${a}. Try --help.`);
82
- }
83
- }
84
- return out;
85
- }
86
- function assertNodeVersion(binName) {
87
- const major = Number(process.versions.node.split(".")[0]);
88
- if (!Number.isFinite(major) || major < MIN_NODE_MAJOR) {
89
- process.stderr.write(
90
- `${binName} requires Node.js ${MIN_NODE_MAJOR} or newer. You are on ${process.versions.node}.
91
- Upgrade Node (https://nodejs.org/) and try again.
92
- `
93
- );
94
- process.exit(1);
95
- }
96
- }
2
+ FLAGS_HELP,
3
+ MIN_NODE_MAJOR,
4
+ UNKNOWN_COMMAND_EXIT,
5
+ WIZARD_PROBE_ENV,
6
+ assertNodeVersion,
7
+ isUnknownTopLevelCommand,
8
+ newAppHint,
9
+ parseArgs
10
+ } from "./chunk-TNTSV54C.js";
11
+ import "./chunk-AWASJDQI.js";
97
12
  export {
98
13
  FLAGS_HELP,
99
14
  MIN_NODE_MAJOR,
15
+ UNKNOWN_COMMAND_EXIT,
16
+ WIZARD_PROBE_ENV,
100
17
  assertNodeVersion,
18
+ isUnknownTopLevelCommand,
19
+ newAppHint,
101
20
  parseArgs
102
21
  };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * FILE: packages/cli/src/wizard-bin.ts
3
+ * PURPOSE: Everything the two unscoped bins do, in one place. `npx mushi-mushi`
4
+ * (packages/launcher) and `npm create mushi-mushi`
5
+ * (packages/create-mushi-mushi) both call runWizardBin and keep only
6
+ * their bin name, version and usage lines (ADR 0060 Phase 1b):
7
+ *
8
+ * - no args / flags → the setup wizard (runInit)
9
+ * - `init [flags]` → same
10
+ * - `--template <id>` → scaffold a starter app (template.ts)
11
+ * - `<cmd> [...]` → forwarded verbatim to the `mushi` bin
12
+ * (setup, login, status, ...)
13
+ * - `<word> [...]` → a bare word that is not a command
14
+ * (`npm create mushi-mushi my-app`) runs the wizard after one
15
+ * hint line about `--template`
16
+ */
17
+ interface WizardBinOptions {
18
+ /** The command the user typed, for messages (`mushi-mushi`, `create-mushi-mushi`). */
19
+ bin: string;
20
+ /** Printed by `--version`: the invoking package's own version. */
21
+ version: string;
22
+ /**
23
+ * The bin's header and usage lines. FLAGS_HELP (with the --template line,
24
+ * the Node requirement and the Docs/Console footer) is appended, so the
25
+ * usage block must not repeat that footer.
26
+ */
27
+ usage: string;
28
+ }
29
+ /** Run a bin's argv (`process.argv.slice(2)`), printing failures and exiting 1. */
30
+ declare function runWizardBin(argv: readonly string[], opts: WizardBinOptions): Promise<void>;
31
+
32
+ export { type WizardBinOptions, runWizardBin };
@@ -0,0 +1,106 @@
1
+ import {
2
+ runInit
3
+ } from "./chunk-FA5LABKE.js";
4
+ import {
5
+ FLAGS_HELP,
6
+ UNKNOWN_COMMAND_EXIT,
7
+ WIZARD_PROBE_ENV,
8
+ assertNodeVersion,
9
+ newAppHint,
10
+ parseArgs,
11
+ scaffoldTemplate
12
+ } from "./chunk-TNTSV54C.js";
13
+ import "./chunk-UV4DMSQH.js";
14
+ import "./chunk-JWG2QI3W.js";
15
+ import "./chunk-AWASJDQI.js";
16
+ import "./chunk-2DMHQVRU.js";
17
+
18
+ // src/wizard-bin.ts
19
+ import { spawnSync } from "child_process";
20
+ import { fileURLToPath } from "url";
21
+ var ISSUES_URL = "https://github.com/kensaurus/mushi-mushi/issues";
22
+ function forwardToCli(bin, argv) {
23
+ const cliBin = fileURLToPath(new URL("./index.js", import.meta.url));
24
+ const result = spawnSync(process.execPath, [cliBin, ...argv], {
25
+ stdio: "inherit",
26
+ env: { ...process.env, [WIZARD_PROBE_ENV]: "1" }
27
+ });
28
+ if (result.status === UNKNOWN_COMMAND_EXIT) return false;
29
+ if (result.error) {
30
+ process.stderr.write(`${bin}: could not start @mushi-mushi/cli (${result.error.message})
31
+ `);
32
+ } else if (result.signal) {
33
+ process.stderr.write(`${bin}: @mushi-mushi/cli was stopped by ${result.signal}
34
+ `);
35
+ }
36
+ process.exit(result.status ?? 1);
37
+ }
38
+ async function main(argv, opts) {
39
+ assertNodeVersion(opts.bin);
40
+ let bareWord;
41
+ const first = argv[0];
42
+ if (first !== void 0 && first !== "init" && !first.startsWith("-")) {
43
+ if (!forwardToCli(opts.bin, argv)) bareWord = first;
44
+ }
45
+ let parsed;
46
+ try {
47
+ parsed = parseArgs(argv);
48
+ } catch (err) {
49
+ process.stderr.write(`${opts.bin}: ${err instanceof Error ? err.message : String(err)}
50
+ `);
51
+ process.exit(1);
52
+ }
53
+ if (bareWord !== void 0 && !parsed.template && !parsed.showHelp && !parsed.showVersion) {
54
+ process.stderr.write(newAppHint(bareWord) + "\n");
55
+ }
56
+ if (parsed.showHelp) {
57
+ process.stdout.write(`${opts.usage}
58
+
59
+ ${FLAGS_HELP}
60
+ `);
61
+ return;
62
+ }
63
+ if (parsed.showVersion) {
64
+ process.stdout.write(opts.version + "\n");
65
+ return;
66
+ }
67
+ if (parsed.template) {
68
+ try {
69
+ process.stdout.write(scaffoldTemplate(parsed.template, parsed.templateDir));
70
+ } catch (err) {
71
+ process.stderr.write(`${opts.bin}: ${err instanceof Error ? err.message : String(err)}
72
+ `);
73
+ process.exit(1);
74
+ }
75
+ return;
76
+ }
77
+ await runInit({
78
+ projectId: parsed.projectId,
79
+ apiKey: parsed.apiKey,
80
+ framework: parsed.framework,
81
+ skipInstall: parsed.skipInstall,
82
+ yes: parsed.yes,
83
+ cwd: parsed.cwd,
84
+ endpoint: parsed.endpoint,
85
+ sendTestReport: parsed.skipTestReport ? false : void 0,
86
+ audit: parsed.audit
87
+ });
88
+ }
89
+ function runWizardBin(argv, opts) {
90
+ return main(argv, opts).catch((err) => {
91
+ const message = err instanceof Error ? err.message : String(err);
92
+ process.stderr.write(`
93
+ ${opts.bin}: ${message}
94
+ `);
95
+ if (process.env.DEBUG?.includes("mushi") && err instanceof Error && err.stack) {
96
+ process.stderr.write(err.stack + "\n");
97
+ }
98
+ process.stderr.write(`
99
+ If this is a bug, please report it at ${ISSUES_URL}
100
+ `);
101
+ process.exit(1);
102
+ });
103
+ }
104
+ export {
105
+ runWizardBin
106
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mushi-mushi/cli",
3
- "version": "0.38.0",
3
+ "version": "0.40.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": {
@@ -37,6 +37,7 @@
37
37
  },
38
38
  "files": [
39
39
  "dist",
40
+ "templates",
40
41
  "README.md",
41
42
  "LICENSE"
42
43
  ],
@@ -95,6 +96,12 @@
95
96
  "default": "./dist/wizard-args.js"
96
97
  }
97
98
  },
99
+ "./wizard-bin": {
100
+ "import": {
101
+ "types": "./dist/wizard-bin.d.ts",
102
+ "default": "./dist/wizard-bin.js"
103
+ }
104
+ },
98
105
  "./version": {
99
106
  "import": {
100
107
  "types": "./dist/version.d.ts",
@@ -0,0 +1,4 @@
1
+ # Get both from `npx mushi-mushi` (browser sign-in) or the Projects page
2
+ # of the Mushi console: https://kensaur.us/mushi-mushi/admin
3
+ MUSHI_PROJECT_ID=
4
+ MUSHI_API_KEY=
@@ -0,0 +1,12 @@
1
+ # Mushi Mushi — Node server starter
2
+
3
+ ```bash
4
+ npm install
5
+ cp .env.example .env # then fill in the two vars, or run: npx mushi-mushi
6
+ npm start # node --env-file=.env — loads .env automatically
7
+ # then: curl localhost:3000/boom
8
+ ```
9
+
10
+ `/boom` throws asynchronously; the unhandled hook forwards the crash to Mushi.
11
+ Express / Fastify / Hono error-handler middlewares are documented at
12
+ https://kensaur.us/mushi-mushi/docs/sdks/node
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ dist
3
+ # Env files hold your Mushi API key; .env.example stays committed.
4
+ .env
5
+ .env.*
6
+ !.env.example
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "mushi-node-app",
3
+ "private": true,
4
+ "version": "0.0.1",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=20.19"
8
+ },
9
+ "scripts": {
10
+ "start": "node --env-file=.env src/server.mjs"
11
+ },
12
+ "dependencies": {
13
+ "mushi-mushi": "^1.35.0"
14
+ }
15
+ }
@@ -0,0 +1,38 @@
1
+ import { createServer } from 'node:http'
2
+ import { MushiNodeClient, attachUnhandledHook } from 'mushi-mushi/node'
3
+
4
+ if (!process.env.MUSHI_PROJECT_ID || !process.env.MUSHI_API_KEY) {
5
+ console.error(
6
+ 'Missing MUSHI_PROJECT_ID / MUSHI_API_KEY.\n' +
7
+ 'Fill in .env (see .env.example) and start with:\n' +
8
+ ' npm start # runs: node --env-file=.env src/server.mjs\n' +
9
+ 'Or run `npx mushi-mushi` to sign in and write the env file for you.',
10
+ )
11
+ process.exit(1)
12
+ }
13
+
14
+ const mushi = new MushiNodeClient({
15
+ projectId: process.env.MUSHI_PROJECT_ID,
16
+ apiKey: process.env.MUSHI_API_KEY,
17
+ environment: process.env.NODE_ENV ?? 'development',
18
+ })
19
+
20
+ // Forward every uncaught exception / unhandled rejection to Mushi before exit.
21
+ attachUnhandledHook({ client: mushi })
22
+
23
+ const server = createServer((req, res) => {
24
+ if (req.url === '/boom') {
25
+ // Demo: an async crash — Mushi captures it via the unhandled hook.
26
+ setImmediate(() => {
27
+ throw new Error('Demo error — check your Mushi dashboard for the report')
28
+ })
29
+ res.writeHead(500).end('crashing…\n')
30
+ return
31
+ }
32
+ res.writeHead(200, { 'Content-Type': 'text/plain' })
33
+ res.end('Mushi Mushi Node demo. GET /boom to send a demo error.\n')
34
+ })
35
+
36
+ server.listen(3000, () => {
37
+ console.log('Listening on http://localhost:3000 — GET /boom to test capture')
38
+ })
@@ -0,0 +1,4 @@
1
+ # Get both from `npx mushi-mushi` (browser sign-in) or the Projects page
2
+ # of the Mushi console: https://kensaur.us/mushi-mushi/admin
3
+ VITE_MUSHI_PROJECT_ID=
4
+ VITE_MUSHI_API_KEY=
@@ -0,0 +1,10 @@
1
+ # Mushi Mushi — Svelte starter
2
+
3
+ ```bash
4
+ npm install
5
+ cp .env.example .env.local # then fill in the two vars, or run: npx mushi-mushi
6
+ npm run dev
7
+ ```
8
+
9
+ `npx mushi-mushi` signs you in via the browser and writes `.env.local` for you.
10
+ Docs: https://kensaur.us/mushi-mushi/docs/quickstart/svelte
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ dist
3
+ # Env files hold your Mushi API key; .env.example stays committed.
4
+ .env
5
+ .env.*
6
+ !.env.example
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Mushi Mushi Svelte Demo</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "mushi-svelte-app",
3
+ "private": true,
4
+ "version": "0.0.1",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "mushi-mushi": "^1.35.0",
13
+ "svelte": "^5.0.0"
14
+ },
15
+ "devDependencies": {
16
+ "@sveltejs/vite-plugin-svelte": "^6.0.0",
17
+ "typescript": "^5.9.0",
18
+ "vite": "^7.0.0"
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ function throwDemoError(): void {
3
+ throw new Error('Demo error — check your Mushi dashboard for the report')
4
+ }
5
+ </script>
6
+
7
+ <main style="font-family: system-ui; padding: 2rem; max-width: 40rem; margin: 0 auto">
8
+ <h1>Mushi Mushi + Svelte</h1>
9
+ <p>
10
+ The Mushi widget is mounted. Shake your phone (mobile) or use the floating
11
+ button to file a bug report — or trigger a demo error:
12
+ </p>
13
+ <button on:click={throwDemoError}>Throw a demo error</button>
14
+ <p>
15
+ Reports land in your
16
+ <a href="https://kensaur.us/mushi-mushi/admin" target="_blank" rel="noreferrer">
17
+ Mushi console</a
18
+ >, diagnosed in plain English.
19
+ </p>
20
+ </main>
@@ -0,0 +1,12 @@
1
+ import { mount } from 'svelte'
2
+ import { initMushi } from 'mushi-mushi/svelte'
3
+ import App from './App.svelte'
4
+
5
+ initMushi({
6
+ projectId: import.meta.env.VITE_MUSHI_PROJECT_ID,
7
+ apiKey: import.meta.env.VITE_MUSHI_API_KEY,
8
+ })
9
+
10
+ const app = mount(App, { target: document.getElementById('app')! })
11
+
12
+ export default app
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'vite'
2
+ import { svelte } from '@sveltejs/vite-plugin-svelte'
3
+
4
+ export default defineConfig({
5
+ plugins: [svelte()],
6
+ })
@@ -0,0 +1,4 @@
1
+ # Get both from `npx mushi-mushi` (browser sign-in) or the Projects page
2
+ # of the Mushi console: https://kensaur.us/mushi-mushi/admin
3
+ VITE_MUSHI_PROJECT_ID=
4
+ VITE_MUSHI_API_KEY=
@@ -0,0 +1,10 @@
1
+ # Mushi Mushi — Vue 3 starter
2
+
3
+ ```bash
4
+ npm install
5
+ cp .env.example .env.local # then fill in the two vars, or run: npx mushi-mushi
6
+ npm run dev
7
+ ```
8
+
9
+ `npx mushi-mushi` signs you in via the browser and writes `.env.local` for you.
10
+ Docs: https://kensaur.us/mushi-mushi/docs/quickstart/vue
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ dist
3
+ # Env files hold your Mushi API key; .env.example stays committed.
4
+ .env
5
+ .env.*
6
+ !.env.example
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Mushi Mushi Vue Demo</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>