@mushi-mushi/cli 0.39.0 → 0.40.1
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.
- package/dist/{chunk-UVAADP4O.js → chunk-3B7PXCRR.js} +12 -4
- package/dist/chunk-CP57NSIY.js +8 -0
- package/dist/{chunk-BG2TVTBN.js → chunk-KIWSPGQB.js} +1 -1
- package/dist/chunk-KQHEYAEK.js +10 -0
- package/dist/{chunk-OZPDPF6G.js → chunk-OVBRQDHI.js} +2 -2
- package/dist/{chunk-PPES6C4Y.js → chunk-QKO42UPX.js} +1 -1
- package/dist/chunk-RH5VBBIV.js +2279 -0
- package/dist/chunk-TNTSV54C.js +160 -0
- package/dist/{connect-RZV3PXP3.js → connect-LCTKRHV7.js} +3 -3
- package/dist/{connect-BCCGBCYR.js → connect-Q6LFT6QA.js} +2 -2
- package/dist/{daemon-ASMMT73O.js → daemon-JX6IG454.js} +5 -3
- package/dist/index.js +82 -39
- package/dist/init.js +11 -2269
- package/dist/{version-MGHYYC2T.js → version-T27RO74F.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wizard-args.d.ts +35 -1
- package/dist/wizard-args.js +14 -95
- package/dist/wizard-bin.d.ts +32 -0
- package/dist/wizard-bin.js +106 -0
- package/package.json +8 -1
- package/templates/node/.env.example +4 -0
- package/templates/node/README.md +12 -0
- package/templates/node/gitignore +6 -0
- package/templates/node/package.json +15 -0
- package/templates/node/src/server.mjs +38 -0
- package/templates/svelte/.env.example +4 -0
- package/templates/svelte/README.md +10 -0
- package/templates/svelte/gitignore +6 -0
- package/templates/svelte/index.html +12 -0
- package/templates/svelte/package.json +20 -0
- package/templates/svelte/src/App.svelte +20 -0
- package/templates/svelte/src/main.ts +12 -0
- package/templates/svelte/vite.config.ts +6 -0
- package/templates/vue/.env.example +4 -0
- package/templates/vue/README.md +10 -0
- package/templates/vue/gitignore +6 -0
- package/templates/vue/index.html +12 -0
- package/templates/vue/package.json +20 -0
- package/templates/vue/src/App.vue +22 -0
- package/templates/vue/src/main.ts +12 -0
- package/templates/vue/vite.config.ts +6 -0
- package/dist/chunk-HQM2WZVF.js +0 -8
- package/dist/chunk-JQPLY3ZT.js +0 -10
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.
|
|
17
|
+
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.31.3";
|
|
18
18
|
|
|
19
19
|
export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
|
package/dist/version.js
CHANGED
package/dist/wizard-args.d.ts
CHANGED
|
@@ -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 };
|
package/dist/wizard-args.js
CHANGED
|
@@ -1,102 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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-RH5VBBIV.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-KIWSPGQB.js";
|
|
14
|
+
import "./chunk-CP57NSIY.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.
|
|
3
|
+
"version": "0.40.1",
|
|
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,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,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,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,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,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,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>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mushi-vue-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
|
+
"vue": "^3.5.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
17
|
+
"typescript": "^5.9.0",
|
|
18
|
+
"vite": "^7.0.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
function throwDemoError(): void {
|
|
3
|
+
throw new Error('Demo error — check your Mushi dashboard for the report')
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<main style="font-family: system-ui; padding: 2rem; max-width: 40rem; margin: 0 auto">
|
|
9
|
+
<h1>Mushi Mushi + Vue 3</h1>
|
|
10
|
+
<p>
|
|
11
|
+
The Mushi widget is mounted. Shake your phone (mobile) or use the floating
|
|
12
|
+
button to file a bug report — or trigger a demo error:
|
|
13
|
+
</p>
|
|
14
|
+
<button @click="throwDemoError">Throw a demo error</button>
|
|
15
|
+
<p>
|
|
16
|
+
Reports land in your
|
|
17
|
+
<a href="https://kensaur.us/mushi-mushi/admin" target="_blank" rel="noreferrer">
|
|
18
|
+
Mushi console</a
|
|
19
|
+
>, diagnosed in plain English.
|
|
20
|
+
</p>
|
|
21
|
+
</main>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import { MushiPlugin } from 'mushi-mushi/vue'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
|
|
5
|
+
const app = createApp(App)
|
|
6
|
+
|
|
7
|
+
app.use(MushiPlugin, {
|
|
8
|
+
projectId: import.meta.env.VITE_MUSHI_PROJECT_ID,
|
|
9
|
+
apiKey: import.meta.env.VITE_MUSHI_API_KEY,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
app.mount('#app')
|