smashspace 0.1.3 → 0.1.4
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/smash.mjs +19 -8
- package/package.json +1 -1
package/dist/smash.mjs
CHANGED
|
@@ -4732,22 +4732,33 @@ program2.command("init").description(
|
|
|
4732
4732
|
}
|
|
4733
4733
|
if (opts.mcp !== false) {
|
|
4734
4734
|
let mcp = { mcpServers: {} };
|
|
4735
|
+
let parseFailed = false;
|
|
4735
4736
|
if (await exists(".mcp.json")) {
|
|
4736
4737
|
try {
|
|
4737
|
-
|
|
4738
|
+
const parsed = JSON.parse(await readFile2(abs(".mcp.json"), "utf8"));
|
|
4739
|
+
if (parsed && typeof parsed === "object")
|
|
4740
|
+
mcp = parsed;
|
|
4738
4741
|
} catch {
|
|
4742
|
+
parseFailed = true;
|
|
4739
4743
|
}
|
|
4740
|
-
if (!mcp.mcpServers)
|
|
4744
|
+
if (!mcp.mcpServers || typeof mcp.mcpServers !== "object") {
|
|
4741
4745
|
mcp.mcpServers = {};
|
|
4746
|
+
}
|
|
4742
4747
|
}
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4748
|
+
if (parseFailed && !opts.force) {
|
|
4749
|
+
actions.push(
|
|
4750
|
+
"\u26A0 .mcp.json exists but is not valid JSON \u2014 left untouched; add the 'smashspace' server by hand or re-run with --force"
|
|
4751
|
+
);
|
|
4746
4752
|
} else {
|
|
4747
|
-
servers
|
|
4748
|
-
|
|
4753
|
+
const servers = mcp.mcpServers;
|
|
4754
|
+
if (servers.smashspace && !opts.force) {
|
|
4755
|
+
actions.push("\u2022 .mcp.json already wires 'smashspace' \u2014 kept (use --force)");
|
|
4756
|
+
} else {
|
|
4757
|
+
servers.smashspace = mcpServerEntry(baseUrl, boardId);
|
|
4758
|
+
await put(".mcp.json", `${JSON.stringify(mcp, null, 2)}
|
|
4749
4759
|
`);
|
|
4750
|
-
|
|
4760
|
+
actions.push("\u2713 .mcp.json \u2014 smashspace MCP server");
|
|
4761
|
+
}
|
|
4751
4762
|
}
|
|
4752
4763
|
}
|
|
4753
4764
|
}
|