@echomem/mcp 1.4.46 → 1.4.47
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/setup.js +77 -46
- package/package.json +1 -1
package/dist/setup.js
CHANGED
|
@@ -622,6 +622,7 @@ export function writeClaudeCodeConfig(entry, options = {}) {
|
|
|
622
622
|
// Older CLI versions wrote local/project entries, which take precedence over user scope and can
|
|
623
623
|
// keep launching a deleted npm cache or stale runtime. Migrate those only after user scope is safe.
|
|
624
624
|
const configPath = options.configPath ?? home(".claude.json");
|
|
625
|
+
let failureReason;
|
|
625
626
|
const emptyResult = () => ({
|
|
626
627
|
state: "unavailable",
|
|
627
628
|
removedLocalProjects: [],
|
|
@@ -629,6 +630,7 @@ export function writeClaudeCodeConfig(entry, options = {}) {
|
|
|
629
630
|
failedLocalProjects: [],
|
|
630
631
|
restoredPreviousUserEntry: false,
|
|
631
632
|
preservedDesktopManaged: false,
|
|
633
|
+
failureReason,
|
|
632
634
|
});
|
|
633
635
|
const runClaude = (args, cwd) => {
|
|
634
636
|
try {
|
|
@@ -638,9 +640,11 @@ export function writeClaudeCodeConfig(entry, options = {}) {
|
|
|
638
640
|
stdio: ["ignore", "pipe", "pipe"],
|
|
639
641
|
timeout: 10000,
|
|
640
642
|
}, options.claudeCommands);
|
|
643
|
+
failureReason = undefined;
|
|
641
644
|
return true;
|
|
642
645
|
}
|
|
643
|
-
catch {
|
|
646
|
+
catch (error) {
|
|
647
|
+
failureReason = commandFailureMessage(error);
|
|
644
648
|
return false;
|
|
645
649
|
}
|
|
646
650
|
};
|
|
@@ -659,8 +663,10 @@ export function writeClaudeCodeConfig(entry, options = {}) {
|
|
|
659
663
|
if (previousUserEntry && !removeUser())
|
|
660
664
|
return emptyResult();
|
|
661
665
|
if (!addUser(desiredUserEntry)) {
|
|
666
|
+
const addFailureReason = failureReason;
|
|
662
667
|
if (previousUserEntry)
|
|
663
668
|
restoredPreviousUserEntry = addUser(previousUserEntry);
|
|
669
|
+
failureReason = addFailureReason;
|
|
664
670
|
return { ...emptyResult(), restoredPreviousUserEntry };
|
|
665
671
|
}
|
|
666
672
|
}
|
|
@@ -2933,6 +2939,7 @@ async function cmdSetup(flags) {
|
|
|
2933
2939
|
// --dev is already an explicit request to replace the managed runtime with a checkout.
|
|
2934
2940
|
const forceHeadless = flags["force-headless"] === true || typeof flags.dev === "string";
|
|
2935
2941
|
const configurationFailures = [];
|
|
2942
|
+
const configuredTargets = [];
|
|
2936
2943
|
if (targets.length === 0) {
|
|
2937
2944
|
console.log("No client auto-detected. Add this MCP server entry manually:\n");
|
|
2938
2945
|
console.log(JSON.stringify({ echomem: entry }, null, 2));
|
|
@@ -2940,66 +2947,90 @@ async function cmdSetup(flags) {
|
|
|
2940
2947
|
}
|
|
2941
2948
|
else {
|
|
2942
2949
|
for (const c of targets) {
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
else {
|
|
2949
|
-
console.log(`✅ Wrote EchoMem MCP entry to ${c.label}: ${c.configPath}`);
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
|
-
else if (c.kind === "command") {
|
|
2953
|
-
const result = writeCodexConfig(c.configPath, entry, { forceHeadless });
|
|
2954
|
-
if (result === "wrote")
|
|
2955
|
-
console.log(`✅ Wrote EchoMem MCP entry to ${c.label}: ${c.configPath} — start a new Codex session to load it.`);
|
|
2956
|
-
else if (result === "desktop-managed")
|
|
2957
|
-
console.log(`✅ Kept the valid Echo Desktop-managed EchoMem entry for ${c.label}: ${c.configPath}`);
|
|
2958
|
-
else
|
|
2959
|
-
console.log(`✅ ${c.label} already has the EchoMem MCP entry: ${c.configPath}`);
|
|
2960
|
-
}
|
|
2961
|
-
else {
|
|
2962
|
-
const result = c.id === "claude-code"
|
|
2963
|
-
? writeClaudeCodeConfig(entry, { forceHeadless })
|
|
2964
|
-
: "unavailable";
|
|
2965
|
-
if (result !== "unavailable" && result.state === "wrote") {
|
|
2966
|
-
if (result.preservedDesktopManaged) {
|
|
2967
|
-
console.log(`✅ Kept the valid Echo Desktop-managed EchoMem user entry for ${c.label}.`);
|
|
2950
|
+
try {
|
|
2951
|
+
if (c.kind === "json") {
|
|
2952
|
+
const result = writeJsonClientConfig(c.configPath, entry, { forceHeadless });
|
|
2953
|
+
if (result === "desktop-managed") {
|
|
2954
|
+
console.log(`✅ Kept the valid Echo Desktop-managed EchoMem entry for ${c.label}: ${c.configPath}`);
|
|
2968
2955
|
}
|
|
2969
2956
|
else {
|
|
2970
|
-
console.log(`✅ Wrote EchoMem MCP entry to ${c.label}
|
|
2971
|
-
}
|
|
2972
|
-
if (result.removedLocalProjects.length > 0) {
|
|
2973
|
-
console.log(`✅ Removed ${result.removedLocalProjects.length} stale Claude Code project-local EchoMem ${result.removedLocalProjects.length === 1 ? "entry" : "entries"}.`);
|
|
2974
|
-
}
|
|
2975
|
-
if (result.skippedLocalProjects.length > 0) {
|
|
2976
|
-
console.log(`ℹ️ Ignored ${result.skippedLocalProjects.length} EchoMem local ${result.skippedLocalProjects.length === 1 ? "entry" : "entries"} for deleted project directories; they cannot shadow the user entry.`);
|
|
2957
|
+
console.log(`✅ Wrote EchoMem MCP entry to ${c.label}: ${c.configPath}`);
|
|
2977
2958
|
}
|
|
2959
|
+
configuredTargets.push(c);
|
|
2960
|
+
}
|
|
2961
|
+
else if (c.kind === "command") {
|
|
2962
|
+
const result = writeCodexConfig(c.configPath, entry, { forceHeadless });
|
|
2963
|
+
if (result === "wrote")
|
|
2964
|
+
console.log(`✅ Wrote EchoMem MCP entry to ${c.label}: ${c.configPath} — start a new Codex session to load it.`);
|
|
2965
|
+
else if (result === "desktop-managed")
|
|
2966
|
+
console.log(`✅ Kept the valid Echo Desktop-managed EchoMem entry for ${c.label}: ${c.configPath}`);
|
|
2967
|
+
else
|
|
2968
|
+
console.log(`✅ ${c.label} already has the EchoMem MCP entry: ${c.configPath}`);
|
|
2969
|
+
configuredTargets.push(c);
|
|
2978
2970
|
}
|
|
2979
2971
|
else {
|
|
2980
|
-
const
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2972
|
+
const result = c.id === "claude-code"
|
|
2973
|
+
? writeClaudeCodeConfig(entry, { forceHeadless })
|
|
2974
|
+
: "unavailable";
|
|
2975
|
+
if (result !== "unavailable" && result.state === "wrote") {
|
|
2976
|
+
if (result.preservedDesktopManaged) {
|
|
2977
|
+
console.log(`✅ Kept the valid Echo Desktop-managed EchoMem user entry for ${c.label}.`);
|
|
2978
|
+
}
|
|
2979
|
+
else {
|
|
2980
|
+
console.log(`✅ Wrote EchoMem MCP entry to ${c.label} via \`claude mcp add-json\` — start a new Claude Code session to load it.`);
|
|
2981
|
+
}
|
|
2982
|
+
if (result.removedLocalProjects.length > 0) {
|
|
2983
|
+
console.log(`✅ Removed ${result.removedLocalProjects.length} stale Claude Code project-local EchoMem ${result.removedLocalProjects.length === 1 ? "entry" : "entries"}.`);
|
|
2984
|
+
}
|
|
2985
|
+
if (result.skippedLocalProjects.length > 0) {
|
|
2986
|
+
console.log(`ℹ️ Ignored ${result.skippedLocalProjects.length} EchoMem local ${result.skippedLocalProjects.length === 1 ? "entry" : "entries"} for deleted project directories; they cannot shadow the user entry.`);
|
|
2987
|
+
}
|
|
2988
|
+
configuredTargets.push(c);
|
|
2989
|
+
}
|
|
2990
|
+
else {
|
|
2991
|
+
const failedProjects = result === "unavailable" ? [] : result.failedLocalProjects;
|
|
2992
|
+
const reason = result === "unavailable" ? undefined : result.failureReason;
|
|
2993
|
+
if (result !== "unavailable" && result.state === "needs-repair")
|
|
2994
|
+
configuredTargets.push(c);
|
|
2995
|
+
configurationFailures.push({
|
|
2996
|
+
client: c,
|
|
2997
|
+
reason: failedProjects.length > 0
|
|
2998
|
+
? `${c.label} still has project-local EchoMem overrides in: ${failedProjects.join(", ")}`
|
|
2999
|
+
: `${c.label} user-scoped EchoMem entry could not be verified${reason ? `: ${reason}` : ""}`,
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
2984
3002
|
}
|
|
2985
3003
|
}
|
|
3004
|
+
catch (error) {
|
|
3005
|
+
configurationFailures.push({
|
|
3006
|
+
client: c,
|
|
3007
|
+
reason: `${c.label} configuration was left unchanged: ${error instanceof Error ? error.message : String(error)}`,
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
2986
3010
|
}
|
|
2987
3011
|
}
|
|
2988
3012
|
if (configurationFailures.length > 0) {
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3013
|
+
const explicitSingleClient = Boolean(requested && requested !== "all" && flags.all !== true);
|
|
3014
|
+
const failureMessage = [
|
|
3015
|
+
explicitSingleClient
|
|
3016
|
+
? "EchoMem could not configure the requested MCP client."
|
|
3017
|
+
: "EchoMem skipped MCP clients that were unavailable or could not be configured.",
|
|
3018
|
+
...configurationFailures.map((failure) => `- ${failure.reason}`),
|
|
3019
|
+
...configurationFailures.map((failure) => `Retry ${failure.client.label} later with: ${MCP_UPDATE_COMMAND} --client ${failure.client.id}`),
|
|
3020
|
+
].join("\n");
|
|
3021
|
+
if (explicitSingleClient)
|
|
3022
|
+
throw new Error(failureMessage);
|
|
3023
|
+
console.log(`⚠️ ${failureMessage}`);
|
|
3024
|
+
console.log("Continuing with the available clients; account connection and local-history import are not blocked.");
|
|
2994
3025
|
}
|
|
2995
3026
|
if (!flags["no-agents-md"]) {
|
|
2996
|
-
writeMemoryGuidanceForTargets(
|
|
3027
|
+
writeMemoryGuidanceForTargets(configuredTargets);
|
|
2997
3028
|
}
|
|
2998
3029
|
if (!flags["no-codex-skills"]) {
|
|
2999
|
-
writeCodexSkillsForTargets(
|
|
3030
|
+
writeCodexSkillsForTargets(configuredTargets);
|
|
3000
3031
|
}
|
|
3001
3032
|
if (flags["no-save-hooks"] !== true) {
|
|
3002
|
-
writeLifecycleHooksForTargets(
|
|
3033
|
+
writeLifecycleHooksForTargets(configuredTargets);
|
|
3003
3034
|
}
|
|
3004
3035
|
console.log("");
|
|
3005
3036
|
if (flags["skip-login"] || flags["no-login"]) {
|
|
@@ -3040,7 +3071,7 @@ async function cmdInit(flags) {
|
|
|
3040
3071
|
}
|
|
3041
3072
|
console.log("");
|
|
3042
3073
|
console.log("🎉 EchoMem is ready.");
|
|
3043
|
-
console.log(" • MCP memory is configured for every coding agent
|
|
3074
|
+
console.log(" • MCP memory is configured for every available coding agent EchoMem could connect to on this machine.");
|
|
3044
3075
|
console.log(" • Echo Desktop shows connection status and manages this device credential.");
|
|
3045
3076
|
console.log(' • Try it now: ask your agent — "search my EchoMem for what I\'ve been working on and recap it."');
|
|
3046
3077
|
}
|
package/package.json
CHANGED