@hasna/mementos 0.4.15 → 0.4.16

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/index.js CHANGED
@@ -5674,21 +5674,24 @@ program2.command("mcp").description("Install mementos MCP server into Claude Cod
5674
5674
  for (const target of targets) {
5675
5675
  try {
5676
5676
  if (target === "claude") {
5677
- const configPath = pathJoin(home, ".claude", ".mcp.json");
5678
- let config = {};
5679
- if (fileExists(configPath)) {
5680
- config = JSON.parse(readFileSync3(configPath, "utf-8"));
5681
- }
5682
- const servers = config["mcpServers"] || {};
5677
+ const { execSync } = __require("child_process");
5683
5678
  if (opts.uninstall) {
5684
- delete servers["mementos"];
5679
+ try {
5680
+ execSync(`claude mcp remove mementos`, { stdio: "pipe" });
5681
+ console.log(chalk.green("Removed mementos from Claude Code MCP"));
5682
+ } catch {
5683
+ console.log(chalk.yellow("mementos was not installed in Claude Code (or claude CLI not found)"));
5684
+ }
5685
5685
  } else {
5686
- servers["mementos"] = { command: mementosCmd, args: [] };
5686
+ try {
5687
+ execSync(`claude mcp add --transport stdio --scope user mementos -- ${mementosCmd}`, { stdio: "pipe" });
5688
+ console.log(chalk.green(`Installed mementos into Claude Code (user scope)`));
5689
+ console.log(chalk.gray(" Restart Claude Code for the change to take effect."));
5690
+ } catch (e) {
5691
+ console.log(chalk.yellow("claude CLI not found. Run this manually:"));
5692
+ console.log(chalk.white(` claude mcp add --transport stdio --scope user mementos -- ${mementosCmd}`));
5693
+ }
5687
5694
  }
5688
- config["mcpServers"] = servers;
5689
- writeFileSync3(configPath, JSON.stringify(config, null, 2) + `
5690
- `, "utf-8");
5691
- console.log(chalk.green(`${opts.uninstall ? "Removed from" : "Installed into"} Claude Code: ${configPath}`));
5692
5695
  }
5693
5696
  if (target === "codex") {
5694
5697
  const configPath = pathJoin(home, ".codex", "config.toml");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAukCH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkH9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAulCH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkH9C"}
@@ -2451,6 +2451,11 @@ addRoute("DELETE", "/api/memories/:id", (_req, _url, params) => {
2451
2451
  addRoute("GET", "/api/agents", (_req, url) => {
2452
2452
  const q = getSearchParams(url);
2453
2453
  const agents = q["project_id"] ? listAgentsByProject(q["project_id"]) : listAgents();
2454
+ if (q["fields"]) {
2455
+ const fields = q["fields"].split(",").map((f) => f.trim());
2456
+ const filtered = agents.map((a) => Object.fromEntries(fields.map((f) => [f, a[f]]).filter(([, v]) => v !== undefined)));
2457
+ return json({ agents: filtered, count: filtered.length });
2458
+ }
2454
2459
  return json({ agents, count: agents.length });
2455
2460
  });
2456
2461
  addRoute("POST", "/api/agents", async (req) => {
@@ -2493,8 +2498,14 @@ addRoute("PATCH", "/api/agents/:id", async (req, _url, params) => {
2493
2498
  return errorResponse(e instanceof Error ? e.message : "Update failed", 400);
2494
2499
  }
2495
2500
  });
2496
- addRoute("GET", "/api/projects", () => {
2501
+ addRoute("GET", "/api/projects", (_req, url) => {
2502
+ const q = getSearchParams(url);
2497
2503
  const projects = listProjects();
2504
+ if (q["fields"]) {
2505
+ const fields = q["fields"].split(",").map((f) => f.trim());
2506
+ const filtered = projects.map((p) => Object.fromEntries(fields.map((f) => [f, p[f]]).filter(([, v]) => v !== undefined)));
2507
+ return json({ projects: filtered, count: filtered.length });
2508
+ }
2498
2509
  return json({ projects, count: projects.length });
2499
2510
  });
2500
2511
  addRoute("POST", "/api/projects", async (req) => {
@@ -2626,6 +2637,11 @@ addRoute("GET", "/api/entities", (_req, url) => {
2626
2637
  if (q["offset"])
2627
2638
  filter.offset = parseInt(q["offset"], 10);
2628
2639
  const entities = listEntities(filter);
2640
+ if (q["fields"]) {
2641
+ const fields = q["fields"].split(",").map((f) => f.trim());
2642
+ const filtered = entities.map((e) => Object.fromEntries(fields.map((f) => [f, e[f]]).filter(([, v]) => v !== undefined)));
2643
+ return json({ entities: filtered, count: filtered.length });
2644
+ }
2629
2645
  return json({ entities, count: entities.length });
2630
2646
  });
2631
2647
  addRoute("POST", "/api/entities/merge", async (req) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "description": "Universal memory system for AI agents - CLI + MCP server + library API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",