diff --git a/plugin/hooks/hooks.json b/plugin/hooks/hooks.json index d22a5a52..1b5023ea 100644 --- a/plugin/hooks/hooks.json +++ b/plugin/hooks/hooks.json @@ -11,7 +11,7 @@ }, { "type": "command", - "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/stderr-test-hook.js", + "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/user-message-hook.js", "timeout": 10 } ] diff --git a/plugin/scripts/user-message-hook.js b/plugin/scripts/user-message-hook.js index 6a41de6b..db8d6598 100755 --- a/plugin/scripts/user-message-hook.js +++ b/plugin/scripts/user-message-hook.js @@ -1,7 +1,7 @@ #!/usr/bin/env node -import{execSync as e}from"child_process";try{let o=e("node ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/context-hook.js --colors",{encoding:"utf8"});console.error(` +import{execSync as e}from"child_process";import{join as r}from"path";import{homedir as n}from"os";try{let o=r(n(),".claude","plugins","marketplaces","thedotmack","plugin","scripts","context-hook.js"),t=e(`node "${o}" --colors`,{encoding:"utf8"});console.error(` \u{1F4DD} Claude-Mem Context Loaded \u2139\uFE0F Note: This appears as stderr but is informational only -`+o)}catch(o){console.error(`\u274C Failed to load context display: ${o}`)}process.exit(3); +`+t)}catch(o){console.error(`\u274C Failed to load context display: ${o}`)}process.exit(3); diff --git a/src/hooks/user-message-hook.ts b/src/hooks/user-message-hook.ts index 9e4fcca6..5798fde0 100644 --- a/src/hooks/user-message-hook.ts +++ b/src/hooks/user-message-hook.ts @@ -7,9 +7,13 @@ * since it's currently the only way to display messages in Claude Code UI. */ import { execSync } from "child_process"; +import { join } from "path"; +import { homedir } from "os"; try { - const output = execSync("node ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/context-hook.js --colors", { + // Cross-platform path to context-hook.js in the installed plugin + const contextHookPath = join(homedir(), '.claude', 'plugins', 'marketplaces', 'thedotmack', 'plugin', 'scripts', 'context-hook.js'); + const output = execSync(`node "${contextHookPath}" --colors`, { encoding: 'utf8' });