@monoes/monomindcli 2.10.14 → 2.10.16
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/src/commands/doctor-env-checks.d.ts +1 -0
- package/dist/src/commands/doctor-env-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-env-checks.js +1 -0
- package/dist/src/commands/doctor-env-checks.js.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +106 -11
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +15 -3
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/monograph.d.ts.map +1 -1
- package/dist/src/commands/monograph.js +8 -7
- package/dist/src/commands/monograph.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +11 -0
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +2 -2
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/utils/native-error.d.ts +14 -0
- package/dist/src/utils/native-error.d.ts.map +1 -0
- package/dist/src/utils/native-error.js +66 -0
- package/dist/src/utils/native-error.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats an Error together with its `.cause`, if present, so wrapper errors
|
|
3
|
+
* (e.g. MonographError('Failed to open database at ...', err)) don't silently
|
|
4
|
+
* drop the actionable detail attached as `cause`.
|
|
5
|
+
*/
|
|
6
|
+
export function formatErrorWithCause(err) {
|
|
7
|
+
if (!(err instanceof Error))
|
|
8
|
+
return String(err);
|
|
9
|
+
const cause = err.cause;
|
|
10
|
+
if (cause === undefined)
|
|
11
|
+
return err.message;
|
|
12
|
+
const causeText = cause instanceof Error ? cause.message : String(cause);
|
|
13
|
+
return `${err.message}: ${causeText}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Recognizes known native-addon load failure signatures (e.g. better-sqlite3
|
|
17
|
+
* built against the wrong Node ABI) and returns a specific, actionable
|
|
18
|
+
* message. Returns null when the text doesn't match a known pattern, so
|
|
19
|
+
* callers can fall back to surfacing the raw text instead of a guess.
|
|
20
|
+
*/
|
|
21
|
+
export function classifyNativeModuleError(text) {
|
|
22
|
+
// build.log is append-only across every attempt ever made in this project
|
|
23
|
+
// (both spawners open it with 'a' and never truncate), so a long-lived
|
|
24
|
+
// project's log can hold several failures back to back. Match bounded
|
|
25
|
+
// pairs (so "built for X" and "requires Y" stay from the same attempt,
|
|
26
|
+
// not stitched together across two different ones) and take the LAST
|
|
27
|
+
// pair — the most recent attempt — not the first.
|
|
28
|
+
const pairs = [...text.matchAll(/NODE_MODULE_VERSION (\d+)[\s\S]{0,200}?NODE_MODULE_VERSION (\d+)/g)];
|
|
29
|
+
if (pairs.length > 0) {
|
|
30
|
+
const [, builtFor, required] = pairs[pairs.length - 1];
|
|
31
|
+
return (`Native module built for Node ABI ${builtFor}, but this Node needs ABI ${required} ` +
|
|
32
|
+
`(NODE_MODULE_VERSION mismatch). Try: delete the module's build/ or prebuilds/ ` +
|
|
33
|
+
`directory and reinstall, or reinstall under the exact Node version you run ` +
|
|
34
|
+
`monomind with. If reinstalling never changes the binary at all, a stale global ` +
|
|
35
|
+
`npm cache or a dependency-deduped copy elsewhere on disk may be the real cause — ` +
|
|
36
|
+
`run \`node -e "console.log(require.resolve('better-sqlite3'))"\` from the project ` +
|
|
37
|
+
`to see which file is actually being loaded.`);
|
|
38
|
+
}
|
|
39
|
+
if (/was compiled against a different Node\.js version/.test(text)) {
|
|
40
|
+
return ('Native module was compiled against a different Node.js version than the one ' +
|
|
41
|
+
'currently running. Try re-compiling or re-installing it (npm rebuild or npm install).');
|
|
42
|
+
}
|
|
43
|
+
// The `bindings` package's own message when a native addon's .node binary
|
|
44
|
+
// was never produced at all (as opposed to built for the wrong ABI) —
|
|
45
|
+
// typically because the install script that compiles/downloads it was
|
|
46
|
+
// blocked (npm's script-approval prompts, --ignore-scripts, an
|
|
47
|
+
// allowScripts policy) or failed silently. Different root cause from the
|
|
48
|
+
// ABI-mismatch case above, so it gets its own message and remediation.
|
|
49
|
+
const bindingsIdx = text.search(/Could not locate the bindings file\.\s*Tried:/i);
|
|
50
|
+
if (bindingsIdx !== -1) {
|
|
51
|
+
// Extract the module name from the FIRST candidate path listed after the
|
|
52
|
+
// trigger phrase (not the first node_modules/ reference anywhere in the
|
|
53
|
+
// text — a wrapping stack trace, e.g. through @monoes/monograph, would
|
|
54
|
+
// otherwise be mistaken for the module that's actually missing). Handles
|
|
55
|
+
// both scoped (@scope/name) and unscoped package directory names.
|
|
56
|
+
const moduleMatch = text.slice(bindingsIdx).match(/node_modules[\\/](@[^\\/]+[\\/][^\\/]+|[^\\/]+)[\\/]/);
|
|
57
|
+
const moduleName = moduleMatch?.[1];
|
|
58
|
+
return (`${moduleName ? `\`${moduleName}\`` : 'A native module'}'s binary was never built for ` +
|
|
59
|
+
'this platform (not an ABI mismatch — it simply doesn\'t exist). This usually means its ' +
|
|
60
|
+
'install script was blocked or failed silently. Try: ' +
|
|
61
|
+
`\`npm rebuild ${moduleName ?? '<module>'}\`, or check \`npm install-scripts ls\` for ` +
|
|
62
|
+
'scripts still pending approval.');
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=native-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-error.js","sourceRoot":"","sources":["../../../src/utils/native-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,KAAK,GAAI,GAA2B,CAAC,KAAK,CAAC;I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