claude-memory-layer 1.0.16 → 1.0.17

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
@@ -9227,41 +9227,51 @@ function saveClaudeSettings(settings) {
9227
9227
  fs9.writeFileSync(tempPath, JSON.stringify(settings, null, 2));
9228
9228
  fs9.renameSync(tempPath, CLAUDE_SETTINGS_PATH);
9229
9229
  }
9230
+ var REQUIRED_HOOK_FILES = [
9231
+ "user-prompt-submit.js",
9232
+ "post-tool-use.js",
9233
+ "session-start.js",
9234
+ "stop.js",
9235
+ "session-end.js"
9236
+ ];
9237
+ function hasHook(settings, hookName, commandFragment) {
9238
+ const hookEntries = settings.hooks?.[hookName];
9239
+ if (!hookEntries)
9240
+ return false;
9241
+ return hookEntries.some((entry) => entry.hooks?.some((hook) => hook.command?.includes(commandFragment)));
9242
+ }
9230
9243
  function getHooksConfig(pluginPath) {
9244
+ const makeHook = (fileName) => [
9245
+ {
9246
+ matcher: "",
9247
+ hooks: [
9248
+ {
9249
+ type: "command",
9250
+ command: `node ${path9.join(pluginPath, "hooks", fileName)}`
9251
+ }
9252
+ ]
9253
+ }
9254
+ ];
9231
9255
  return {
9232
- UserPromptSubmit: [
9233
- {
9234
- matcher: "",
9235
- hooks: [
9236
- {
9237
- type: "command",
9238
- command: `node ${path9.join(pluginPath, "hooks", "user-prompt-submit.js")}`
9239
- }
9240
- ]
9241
- }
9242
- ],
9243
- PostToolUse: [
9244
- {
9245
- matcher: "",
9246
- hooks: [
9247
- {
9248
- type: "command",
9249
- command: `node ${path9.join(pluginPath, "hooks", "post-tool-use.js")}`
9250
- }
9251
- ]
9252
- }
9253
- ]
9256
+ SessionStart: makeHook("session-start.js"),
9257
+ UserPromptSubmit: makeHook("user-prompt-submit.js"),
9258
+ PostToolUse: makeHook("post-tool-use.js"),
9259
+ Stop: makeHook("stop.js"),
9260
+ SessionEnd: makeHook("session-end.js")
9254
9261
  };
9255
9262
  }
9256
9263
  var program = new Command();
9257
- program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.16");
9264
+ program.name("claude-memory-layer").description("Claude Code Memory Plugin CLI").version("1.0.17");
9258
9265
  program.command("install").description("Install hooks into Claude Code settings").option("--path <path>", "Custom plugin path (defaults to auto-detect)").action(async (options) => {
9259
9266
  try {
9260
9267
  const pluginPath = options.path || getPluginPath();
9261
- const userPromptHook = path9.join(pluginPath, "hooks", "user-prompt-submit.js");
9262
- if (!fs9.existsSync(userPromptHook)) {
9268
+ const missingHooks = REQUIRED_HOOK_FILES.filter(
9269
+ (file) => !fs9.existsSync(path9.join(pluginPath, "hooks", file))
9270
+ );
9271
+ if (missingHooks.length > 0) {
9263
9272
  console.error(`
9264
9273
  \u274C Hook files not found at: ${pluginPath}`);
9274
+ console.error(` Missing: ${missingHooks.join(", ")}`);
9265
9275
  console.error(' Make sure you have built the plugin with "npm run build"');
9266
9276
  process.exit(1);
9267
9277
  }
@@ -9274,8 +9284,11 @@ program.command("install").description("Install hooks into Claude Code settings"
9274
9284
  saveClaudeSettings(settings);
9275
9285
  console.log("\n\u2705 Claude Memory Layer installed!\n");
9276
9286
  console.log("Hooks registered:");
9287
+ console.log(" - SessionStart: Register session -> project mapping");
9277
9288
  console.log(" - UserPromptSubmit: Memory retrieval on user input");
9278
- console.log(" - PostToolUse: Store tool observations\n");
9289
+ console.log(" - PostToolUse: Store tool observations");
9290
+ console.log(" - Stop: Store assistant responses");
9291
+ console.log(" - SessionEnd: Persist session summary\n");
9279
9292
  console.log("Plugin path:", pluginPath);
9280
9293
  console.log("\n\u26A0\uFE0F Restart Claude Code for changes to take effect.\n");
9281
9294
  console.log("Commands:");
@@ -9295,8 +9308,11 @@ program.command("uninstall").description("Remove hooks from Claude Code settings
9295
9308
  console.log("\n\u{1F4CB} No hooks installed.\n");
9296
9309
  return;
9297
9310
  }
9311
+ delete settings.hooks.SessionStart;
9298
9312
  delete settings.hooks.UserPromptSubmit;
9299
9313
  delete settings.hooks.PostToolUse;
9314
+ delete settings.hooks.Stop;
9315
+ delete settings.hooks.SessionEnd;
9300
9316
  if (Object.keys(settings.hooks).length === 0) {
9301
9317
  delete settings.hooks;
9302
9318
  }
@@ -9316,23 +9332,25 @@ program.command("status").description("Check plugin installation status").action
9316
9332
  const settings = loadClaudeSettings();
9317
9333
  const pluginPath = getPluginPath();
9318
9334
  console.log("\n\u{1F9E0} Claude Memory Layer Status\n");
9319
- const hasUserPromptHook = settings.hooks?.UserPromptSubmit?.some(
9320
- (h) => h.hooks?.some((hook) => hook.command?.includes("user-prompt-submit"))
9321
- );
9322
- const hasPostToolHook = settings.hooks?.PostToolUse?.some(
9323
- (h) => h.hooks?.some((hook) => hook.command?.includes("post-tool-use"))
9324
- );
9335
+ const hasSessionStartHook = hasHook(settings, "SessionStart", "session-start");
9336
+ const hasUserPromptHook = hasHook(settings, "UserPromptSubmit", "user-prompt-submit");
9337
+ const hasPostToolHook = hasHook(settings, "PostToolUse", "post-tool-use");
9338
+ const hasStopHook = hasHook(settings, "Stop", "stop");
9339
+ const hasSessionEndHook = hasHook(settings, "SessionEnd", "session-end");
9325
9340
  console.log("Hooks:");
9341
+ console.log(` SessionStart: ${hasSessionStartHook ? "\u2705 Installed" : "\u274C Not installed"}`);
9326
9342
  console.log(` UserPromptSubmit: ${hasUserPromptHook ? "\u2705 Installed" : "\u274C Not installed"}`);
9327
9343
  console.log(` PostToolUse: ${hasPostToolHook ? "\u2705 Installed" : "\u274C Not installed"}`);
9328
- const hooksExist = fs9.existsSync(path9.join(pluginPath, "hooks", "user-prompt-submit.js"));
9344
+ console.log(` Stop: ${hasStopHook ? "\u2705 Installed" : "\u274C Not installed"}`);
9345
+ console.log(` SessionEnd: ${hasSessionEndHook ? "\u2705 Installed" : "\u274C Not installed"}`);
9346
+ const hooksExist = REQUIRED_HOOK_FILES.every((file) => fs9.existsSync(path9.join(pluginPath, "hooks", file)));
9329
9347
  console.log(`
9330
9348
  Plugin files: ${hooksExist ? "\u2705 Found" : "\u274C Not found"}`);
9331
9349
  console.log(` Path: ${pluginPath}`);
9332
9350
  const dashboardRunning = await isServerRunning(37777);
9333
9351
  console.log(`
9334
9352
  Dashboard: ${dashboardRunning ? "\u2705 Running at http://localhost:37777" : "\u23F9\uFE0F Not running"}`);
9335
- if (!hasUserPromptHook || !hasPostToolHook) {
9353
+ if (!hasSessionStartHook || !hasUserPromptHook || !hasPostToolHook || !hasStopHook || !hasSessionEndHook) {
9336
9354
  console.log('\n\u{1F4A1} Run "claude-memory-layer install" to set up hooks.\n');
9337
9355
  } else {
9338
9356
  console.log("\n\u2705 Plugin is fully installed and configured.\n");