mrmainspring 0.1.2 → 0.1.3
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/cli.js +17 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
3
4
|
import { loadConfig } from "./config.js";
|
|
4
5
|
import { ensureGrimoireMasterKey, loadLocalEnvFile, resolveEnvPath } from "./env-file.js";
|
|
5
6
|
import { getDefaultMainspringPaths } from "./paths.js";
|
|
6
|
-
const VERSION = "0.1.
|
|
7
|
+
const VERSION = "0.1.2";
|
|
7
8
|
const HELP = `Mr Mainspring MCP server
|
|
8
9
|
|
|
9
10
|
Usage:
|
|
@@ -14,12 +15,14 @@ Usage:
|
|
|
14
15
|
mainspring config Print MCP client config JSON
|
|
15
16
|
mainspring setup [client] Initialize local files and print MCP config
|
|
16
17
|
mainspring doctor Check the local setup
|
|
18
|
+
mainspring update Show how to update to the latest version
|
|
17
19
|
|
|
18
20
|
MCP client config:
|
|
19
21
|
{
|
|
20
22
|
"mcpServers": {
|
|
21
23
|
"mainspring": {
|
|
22
|
-
"command": "
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "mrmainspring"]
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
}
|
|
@@ -61,6 +64,13 @@ export function runCliCommand(args) {
|
|
|
61
64
|
process.stdout.write(formatDoctorReport());
|
|
62
65
|
return true;
|
|
63
66
|
}
|
|
67
|
+
if (command === "update") {
|
|
68
|
+
process.stdout.write("To update Mr Mainspring:\n\n" +
|
|
69
|
+
" npm install -g mrmainspring@latest\n\n" +
|
|
70
|
+
"or if using npx (no install needed):\n\n" +
|
|
71
|
+
" npx mrmainspring@latest\n\n");
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
64
74
|
process.stderr.write(`Unknown command: ${command}\n\n${HELP}`);
|
|
65
75
|
process.exitCode = 1;
|
|
66
76
|
return true;
|
|
@@ -93,7 +103,8 @@ export function formatMcpConfig() {
|
|
|
93
103
|
return JSON.stringify({
|
|
94
104
|
mcpServers: {
|
|
95
105
|
mainspring: {
|
|
96
|
-
command: "
|
|
106
|
+
command: "npx",
|
|
107
|
+
args: ["-y", "mrmainspring"]
|
|
97
108
|
}
|
|
98
109
|
}
|
|
99
110
|
}, null, 2);
|
|
@@ -118,6 +129,9 @@ function formatDoctorReport(env = process.env) {
|
|
|
118
129
|
lines.push(formatCheck(existsSync(envFile), `Config file: ${envFile}`, "Config file missing; run mainspring init"));
|
|
119
130
|
lines.push(formatCheck(existsSync(paths.dataDir), `Data dir: ${paths.dataDir}`, "Data dir missing; run mainspring init"));
|
|
120
131
|
lines.push(formatCheck(existsSync(paths.logsDir), `Logs dir: ${paths.logsDir}`, "Logs dir missing; run mainspring init"));
|
|
132
|
+
const casperBin = envCopy.CASPER_CLIENT_BIN ?? "casper-client";
|
|
133
|
+
const casperProbe = spawnSync(casperBin, ["--version"], { stdio: "pipe" });
|
|
134
|
+
lines.push(formatCheck(!casperProbe.error, `casper-client: ${casperBin}`, `casper-client not found at "${casperBin}" — optional, needed for on-chain anchoring (cargo install casper-client)`));
|
|
121
135
|
try {
|
|
122
136
|
const config = loadConfig(envCopy);
|
|
123
137
|
lines.push(`[ok] Storage backend: ${config.storage.backend}`);
|
package/package.json
CHANGED