@pyxmate/memory 0.23.0 → 0.24.0
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/pyx-mem.mjs +146 -46
- package/package.json +1 -1
package/dist/cli/pyx-mem.mjs
CHANGED
|
@@ -15479,7 +15479,7 @@ var ALL_TOOL_NAMES = ALL_TOOLS.map((t) => t.name);
|
|
|
15479
15479
|
// src/mcp/server.ts
|
|
15480
15480
|
async function runMcpServer(opts) {
|
|
15481
15481
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
15482
|
-
const version2 = opts.version ?? (true ? "0.
|
|
15482
|
+
const version2 = opts.version ?? (true ? "0.24.0" : "0.0.0-dev");
|
|
15483
15483
|
const server = new McpServer(
|
|
15484
15484
|
{ name: "pyx-memory", version: version2 },
|
|
15485
15485
|
{ instructions: PYX_MEMORY_INSTRUCTIONS, capabilities: { tools: {} } }
|
|
@@ -15830,13 +15830,113 @@ Restart Gemini CLI to make the tools available. No API key was written to settin
|
|
|
15830
15830
|
function geminiConfigPath(home, scope) {
|
|
15831
15831
|
return scope === "project" ? join(process.cwd(), ".gemini", "settings.json") : join(home, ".gemini", "settings.json");
|
|
15832
15832
|
}
|
|
15833
|
+
function mcpInstallPiCommand(opts = {}) {
|
|
15834
|
+
const scope = opts.scope ?? "user";
|
|
15835
|
+
if (!validateScope(scope)) return EXIT.USAGE;
|
|
15836
|
+
const home = opts._homeDir ?? homedir();
|
|
15837
|
+
const filePath = scope === "user" ? join(home, ".pi", "agent", "mcp.json") : join(process.cwd(), ".pi", "mcp.json");
|
|
15838
|
+
return writeJsonAndReport(filePath, "Pi", {
|
|
15839
|
+
prereq: "pi has no native MCP support \u2014 install the third-party adapter once:\n pi install npm:pi-mcp-adapter"
|
|
15840
|
+
});
|
|
15841
|
+
}
|
|
15842
|
+
function mcpInstallOpenClawCommand(opts = {}) {
|
|
15843
|
+
const scope = opts.scope ?? "user";
|
|
15844
|
+
if (!validateScope(scope)) return EXIT.USAGE;
|
|
15845
|
+
const spawnSync = opts._spawnSync ?? nodeSpawnSync;
|
|
15846
|
+
const probe = spawnSync("openclaw", ["--version"], { stdio: "pipe" });
|
|
15847
|
+
if (probe.error || probe.status !== 0) {
|
|
15848
|
+
printOpenClawManualInstructions();
|
|
15849
|
+
return EXIT.OK;
|
|
15850
|
+
}
|
|
15851
|
+
const entryJson = JSON.stringify(ENTRY);
|
|
15852
|
+
const cmd = ["mcp", "set", SERVER_NAME, entryJson];
|
|
15853
|
+
const res = spawnSync("openclaw", cmd, { stdio: "inherit" });
|
|
15854
|
+
if (res.status !== 0) {
|
|
15855
|
+
process.stderr.write(
|
|
15856
|
+
`\`openclaw ${cmd.join(" ")}\` exited with code ${res.status ?? "null"}.
|
|
15857
|
+
`
|
|
15858
|
+
);
|
|
15859
|
+
printOpenClawManualInstructions();
|
|
15860
|
+
return EXIT.USAGE;
|
|
15861
|
+
}
|
|
15862
|
+
process.stdout.write(
|
|
15863
|
+
`Installed pyx-memory MCP server in OpenClaw.
|
|
15864
|
+
Restart OpenClaw to make the tools available. No API key was written to openclaw.json \u2014 credentials live in the OS credential store.
|
|
15865
|
+
`
|
|
15866
|
+
);
|
|
15867
|
+
return EXIT.OK;
|
|
15868
|
+
}
|
|
15869
|
+
function printOpenClawManualInstructions() {
|
|
15870
|
+
const entryJson = JSON.stringify(ENTRY);
|
|
15871
|
+
process.stdout.write(
|
|
15872
|
+
[
|
|
15873
|
+
"The `openclaw` CLI is not on PATH, or the install command failed.",
|
|
15874
|
+
"",
|
|
15875
|
+
"Run this once OpenClaw is installed:",
|
|
15876
|
+
` openclaw mcp set ${SERVER_NAME} '${entryJson}'`,
|
|
15877
|
+
"",
|
|
15878
|
+
"Or add this entry manually under `mcp.servers` in your OpenClaw config",
|
|
15879
|
+
"(run `openclaw config file` to print the active config path):",
|
|
15880
|
+
"",
|
|
15881
|
+
JSON.stringify({ mcp: { servers: { [SERVER_NAME]: ENTRY } } }, null, 2),
|
|
15882
|
+
"",
|
|
15883
|
+
"Do NOT add your pyx-memory API key here. Run `pyx-mem login` to store it in the OS credential store.",
|
|
15884
|
+
""
|
|
15885
|
+
].join("\n")
|
|
15886
|
+
);
|
|
15887
|
+
}
|
|
15888
|
+
function mcpInstallHermesCommand(opts = {}) {
|
|
15889
|
+
const scope = opts.scope ?? "user";
|
|
15890
|
+
if (!validateScope(scope)) return EXIT.USAGE;
|
|
15891
|
+
const spawnSync = opts._spawnSync ?? nodeSpawnSync;
|
|
15892
|
+
const probe = spawnSync("hermes", ["--version"], { stdio: "pipe" });
|
|
15893
|
+
if (probe.error || probe.status !== 0) {
|
|
15894
|
+
printHermesManualInstructions();
|
|
15895
|
+
return EXIT.OK;
|
|
15896
|
+
}
|
|
15897
|
+
const cmd = ["mcp", "add", SERVER_NAME, "--command", "pyx-mem", "--args", "mcp"];
|
|
15898
|
+
const res = spawnSync("hermes", cmd, { stdio: "inherit" });
|
|
15899
|
+
if (res.status !== 0) {
|
|
15900
|
+
process.stderr.write(`\`hermes ${cmd.join(" ")}\` exited with code ${res.status ?? "null"}.
|
|
15901
|
+
`);
|
|
15902
|
+
printHermesManualInstructions();
|
|
15903
|
+
return EXIT.USAGE;
|
|
15904
|
+
}
|
|
15905
|
+
process.stdout.write(
|
|
15906
|
+
`Installed pyx-memory MCP server in Hermes.
|
|
15907
|
+
Restart Hermes to make the tools available. No API key was written to config.yaml \u2014 credentials live in the OS credential store.
|
|
15908
|
+
`
|
|
15909
|
+
);
|
|
15910
|
+
return EXIT.OK;
|
|
15911
|
+
}
|
|
15912
|
+
function printHermesManualInstructions() {
|
|
15913
|
+
process.stdout.write(
|
|
15914
|
+
[
|
|
15915
|
+
"The `hermes` CLI is not on PATH, or the install command failed.",
|
|
15916
|
+
"",
|
|
15917
|
+
"Run this once Hermes is installed:",
|
|
15918
|
+
` hermes mcp add ${SERVER_NAME} --command pyx-mem --args mcp`,
|
|
15919
|
+
"",
|
|
15920
|
+
"Or add this block under `mcp_servers:` in your Hermes config",
|
|
15921
|
+
"(typically ~/.hermes/config.yaml):",
|
|
15922
|
+
"",
|
|
15923
|
+
`${SERVER_NAME}:`,
|
|
15924
|
+
" command: pyx-mem",
|
|
15925
|
+
" args:",
|
|
15926
|
+
" - mcp",
|
|
15927
|
+
"",
|
|
15928
|
+
"Do NOT add your pyx-memory API key here. Run `pyx-mem login` to store it in the OS credential store.",
|
|
15929
|
+
""
|
|
15930
|
+
].join("\n")
|
|
15931
|
+
);
|
|
15932
|
+
}
|
|
15833
15933
|
function validateScope(scope) {
|
|
15834
15934
|
if (VALID_SCOPES.has(scope)) return true;
|
|
15835
15935
|
process.stderr.write(`Error: invalid --scope \`${scope}\`. Expected: local | user | project.
|
|
15836
15936
|
`);
|
|
15837
15937
|
return false;
|
|
15838
15938
|
}
|
|
15839
|
-
function writeJsonAndReport(filePath, agentLabel) {
|
|
15939
|
+
function writeJsonAndReport(filePath, agentLabel, opts = {}) {
|
|
15840
15940
|
const result = mergeWriteJsonMcpEntry({
|
|
15841
15941
|
filePath,
|
|
15842
15942
|
serverName: SERVER_NAME,
|
|
@@ -15850,6 +15950,10 @@ function writeJsonAndReport(filePath, agentLabel) {
|
|
|
15850
15950
|
`
|
|
15851
15951
|
);
|
|
15852
15952
|
}
|
|
15953
|
+
if ((result.status === "installed" || result.status === "already-installed") && opts.prereq) {
|
|
15954
|
+
process.stdout.write(`Prerequisite: ${opts.prereq}
|
|
15955
|
+
`);
|
|
15956
|
+
}
|
|
15853
15957
|
return result.exitCode;
|
|
15854
15958
|
}
|
|
15855
15959
|
|
|
@@ -15910,7 +16014,7 @@ Commands:
|
|
|
15910
16014
|
mcp Start stdio MCP server.
|
|
15911
16015
|
mcp install <target> [--scope user|local|project]
|
|
15912
16016
|
Install pyx-memory MCP config for your AI agent.
|
|
15913
|
-
Targets: claude-code, codex, cursor, cline, continue, windsurf, gemini-cli.
|
|
16017
|
+
Targets: claude-code, codex, cursor, cline, continue, windsurf, gemini-cli, pi, openclaw, hermes.
|
|
15914
16018
|
|
|
15915
16019
|
Notes:
|
|
15916
16020
|
- Credentials are stored only in the OS credential store (Keychain / libsecret / Credential Manager).
|
|
@@ -15963,15 +16067,43 @@ function parseArgs(argv) {
|
|
|
15963
16067
|
}
|
|
15964
16068
|
|
|
15965
16069
|
// src/cli/pyx-mem.ts
|
|
15966
|
-
var
|
|
15967
|
-
"claude-code",
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
"gemini-cli"
|
|
15974
|
-
|
|
16070
|
+
var INSTALL_TARGETS = {
|
|
16071
|
+
"claude-code": mcpInstallClaudeCodeCommand,
|
|
16072
|
+
codex: mcpInstallCodexCommand,
|
|
16073
|
+
cursor: mcpInstallCursorCommand,
|
|
16074
|
+
cline: mcpInstallClineCommand,
|
|
16075
|
+
continue: mcpInstallContinueCommand,
|
|
16076
|
+
windsurf: mcpInstallWindsurfCommand,
|
|
16077
|
+
"gemini-cli": mcpInstallGeminiCliCommand,
|
|
16078
|
+
pi: mcpInstallPiCommand,
|
|
16079
|
+
openclaw: mcpInstallOpenClawCommand,
|
|
16080
|
+
hermes: mcpInstallHermesCommand
|
|
16081
|
+
};
|
|
16082
|
+
var VALID_TARGETS = Object.keys(INSTALL_TARGETS);
|
|
16083
|
+
function runMcpInstall(target, scope) {
|
|
16084
|
+
if (target === void 0 || !Object.hasOwn(INSTALL_TARGETS, target)) {
|
|
16085
|
+
process.stderr.write(
|
|
16086
|
+
`Error: unknown install target \`${target ?? ""}\`. Expected: ${VALID_TARGETS.join(", ")}.
|
|
16087
|
+
`
|
|
16088
|
+
);
|
|
16089
|
+
return EXIT.USAGE;
|
|
16090
|
+
}
|
|
16091
|
+
const handler = INSTALL_TARGETS[target];
|
|
16092
|
+
return handler({ scope });
|
|
16093
|
+
}
|
|
16094
|
+
function runMcpCommand(parsed) {
|
|
16095
|
+
if (parsed.subcommand === void 0) return mcpCommand();
|
|
16096
|
+
if (parsed.subcommand === "install") {
|
|
16097
|
+
const target = parsed.positional[0];
|
|
16098
|
+
const scope = typeof parsed.flags.scope === "string" ? parsed.flags.scope : void 0;
|
|
16099
|
+
return runMcpInstall(target, scope);
|
|
16100
|
+
}
|
|
16101
|
+
process.stderr.write(
|
|
16102
|
+
`Error: unknown subcommand \`mcp ${parsed.subcommand}\`. Run \`pyx-mem --help\`.
|
|
16103
|
+
`
|
|
16104
|
+
);
|
|
16105
|
+
return EXIT.USAGE;
|
|
16106
|
+
}
|
|
15975
16107
|
async function main() {
|
|
15976
16108
|
const parsed = parseArgs(process.argv.slice(2));
|
|
15977
16109
|
if (parsed.flags.help === true || parsed.flags.h === true) {
|
|
@@ -15994,40 +16126,8 @@ async function main() {
|
|
|
15994
16126
|
return logoutCommand();
|
|
15995
16127
|
case "doctor":
|
|
15996
16128
|
return doctorCommand({ json: parsed.flags.json === true });
|
|
15997
|
-
case "mcp":
|
|
15998
|
-
|
|
15999
|
-
if (parsed.subcommand === "install") {
|
|
16000
|
-
const target = parsed.positional[0];
|
|
16001
|
-
const scope = typeof parsed.flags.scope === "string" ? parsed.flags.scope : void 0;
|
|
16002
|
-
switch (target) {
|
|
16003
|
-
case "claude-code":
|
|
16004
|
-
return mcpInstallClaudeCodeCommand({ scope });
|
|
16005
|
-
case "codex":
|
|
16006
|
-
return mcpInstallCodexCommand({ scope });
|
|
16007
|
-
case "cursor":
|
|
16008
|
-
return mcpInstallCursorCommand({ scope });
|
|
16009
|
-
case "cline":
|
|
16010
|
-
return mcpInstallClineCommand({ scope });
|
|
16011
|
-
case "continue":
|
|
16012
|
-
return mcpInstallContinueCommand({ scope });
|
|
16013
|
-
case "windsurf":
|
|
16014
|
-
return mcpInstallWindsurfCommand({ scope });
|
|
16015
|
-
case "gemini-cli":
|
|
16016
|
-
return mcpInstallGeminiCliCommand({ scope });
|
|
16017
|
-
default:
|
|
16018
|
-
process.stderr.write(
|
|
16019
|
-
`Error: unknown install target \`${target ?? ""}\`. Expected: ${VALID_TARGETS.join(", ")}.
|
|
16020
|
-
`
|
|
16021
|
-
);
|
|
16022
|
-
return EXIT.USAGE;
|
|
16023
|
-
}
|
|
16024
|
-
}
|
|
16025
|
-
process.stderr.write(
|
|
16026
|
-
`Error: unknown subcommand \`mcp ${parsed.subcommand}\`. Run \`pyx-mem --help\`.
|
|
16027
|
-
`
|
|
16028
|
-
);
|
|
16029
|
-
return EXIT.USAGE;
|
|
16030
|
-
}
|
|
16129
|
+
case "mcp":
|
|
16130
|
+
return runMcpCommand(parsed);
|
|
16031
16131
|
default:
|
|
16032
16132
|
process.stderr.write(
|
|
16033
16133
|
`Error: unknown command \`${parsed.command}\`. Run \`pyx-mem --help\`.
|