@elephant-wiki/cli 0.1.4 → 0.1.5
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/elephant.mjs +31 -20
- package/package.json +1 -1
package/dist/elephant.mjs
CHANGED
|
@@ -7760,10 +7760,10 @@ async function mergeJsonMcpConfig(filePath, desired) {
|
|
|
7760
7760
|
let fileExisted = false;
|
|
7761
7761
|
if (existsSync(filePath)) {
|
|
7762
7762
|
fileExisted = true;
|
|
7763
|
-
const raw = readFileSync(filePath, "utf8");
|
|
7763
|
+
const raw = readFileSync(filePath, "utf8").trim();
|
|
7764
7764
|
let parsed;
|
|
7765
7765
|
try {
|
|
7766
|
-
parsed = JSON.parse(raw);
|
|
7766
|
+
parsed = raw ? JSON.parse(raw) : {};
|
|
7767
7767
|
} catch (error) {
|
|
7768
7768
|
throw new CliError(`Cannot update ${filePath}: invalid JSON (${error.message}). Fix the file and retry.`);
|
|
7769
7769
|
}
|
|
@@ -7929,19 +7929,25 @@ Specify one or more hosts with --host <${ALL_HOSTS.join("|")}> or --all.
|
|
|
7929
7929
|
return 0;
|
|
7930
7930
|
}
|
|
7931
7931
|
const results = [];
|
|
7932
|
+
const failures = [];
|
|
7932
7933
|
for (const host of hosts) {
|
|
7933
|
-
|
|
7934
|
+
try {
|
|
7935
|
+
results.push(await configureHost(ctx.homeDir, host, mcpUrl));
|
|
7936
|
+
} catch (error) {
|
|
7937
|
+
failures.push(`${host}: ${error.message}`);
|
|
7938
|
+
}
|
|
7934
7939
|
}
|
|
7935
7940
|
if (options.json) {
|
|
7936
7941
|
ctx.stdout(JSON.stringify({ origin, mcp_url: mcpUrl, hosts: results }, null, 2) + "\n");
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
ctx.stdout(`Configured Elephant Wiki (${mcpUrl}) for ${results.length} Assistant host${results.length === 1 ? "" : "s"}:
|
|
7942
|
+
} else if (results.length) {
|
|
7943
|
+
ctx.stdout(`Configured Elephant Wiki (${mcpUrl}) for ${results.length} Assistant host${results.length === 1 ? "" : "s"}:
|
|
7940
7944
|
`);
|
|
7941
|
-
|
|
7942
|
-
|
|
7945
|
+
for (const r of results) {
|
|
7946
|
+
ctx.stdout(` ${r.host}: MCP ${r.mcp_action} (${r.mcp_config_path}); skill ${r.skill_action} (${r.skill_path})
|
|
7943
7947
|
`);
|
|
7948
|
+
}
|
|
7944
7949
|
}
|
|
7950
|
+
if (failures.length) throw new CliError(failures.join("\n"));
|
|
7945
7951
|
return 0;
|
|
7946
7952
|
}
|
|
7947
7953
|
|
|
@@ -10326,25 +10332,30 @@ function renderAgentGuidance(layout) {
|
|
|
10326
10332
|
return [
|
|
10327
10333
|
"# Elephant Wiki Sync root",
|
|
10328
10334
|
"",
|
|
10335
|
+
"This folder mirrors Elephant Wiki. Save through the Elephant Wiki MCP tools, not by writing files here.",
|
|
10329
10336
|
`Read \`${desk}/desk.md\` if it exists before working on the Project.`,
|
|
10330
10337
|
"",
|
|
10331
|
-
"##
|
|
10338
|
+
"## Saving",
|
|
10332
10339
|
"",
|
|
10333
|
-
|
|
10334
|
-
"
|
|
10335
|
-
|
|
10336
|
-
"
|
|
10337
|
-
|
|
10338
|
-
"
|
|
10340
|
+
"- **New saves:** call `save_note`. Do not create new files in this folder. The Decider on the server routes",
|
|
10341
|
+
" each save to the right Folder, and to the Knowledge base or Project notes, using the whole Bundle.",
|
|
10342
|
+
" The sync daemon then mirrors the saved file here.",
|
|
10343
|
+
"- **Project desk:** never edit `desk.md` during ordinary saves. To change it, show the user the exact proposed wording,",
|
|
10344
|
+
" wait for explicit user confirmation, then write it with `project_desk`.",
|
|
10345
|
+
"- If these tools are not loaded, look for the Elephant Wiki connector and load them. If it is not connected,",
|
|
10346
|
+
" tell the user instead of writing the file yourself.",
|
|
10339
10347
|
"",
|
|
10340
|
-
"##
|
|
10348
|
+
"## Local layout",
|
|
10341
10349
|
"",
|
|
10342
|
-
"
|
|
10343
|
-
"and wait for explicit user confirmation before editing.",
|
|
10350
|
+
"Use these paths for reading, and for in-place edits to existing Notes or Project notes when the user asks for one.",
|
|
10344
10351
|
"",
|
|
10345
|
-
|
|
10352
|
+
`- **Knowledge base:** ${knowledgeBase}. Holds research, specs, comparisons, and settled decisions.`,
|
|
10353
|
+
`- **Project notes:** \`${desk}/<note>.md\`. Hold the user's own thinking, including ideas, plans being weighed,`,
|
|
10354
|
+
" open questions, and to-dos.",
|
|
10355
|
+
`- **Project desk:** \`${desk}/desk.md\`. Holds standing context and rules for future Assistant sessions.`,
|
|
10346
10356
|
"",
|
|
10347
|
-
"`index.md`, `log.md`, and `AGENTS.md` are local virtual files managed by Elephant Wiki.
|
|
10357
|
+
"`index.md`, `log.md`, and `AGENTS.md` at the top of this folder are local virtual files managed by Elephant Wiki.",
|
|
10358
|
+
layout === "bundle" ? "So are `index.md` and `log.md` in each Project folder. Treat them all as read-only." : "Treat them as read-only.",
|
|
10348
10359
|
""
|
|
10349
10360
|
].join("\n");
|
|
10350
10361
|
}
|