@alex900530/claude-persistent-memory 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/bin/setup.js +11 -14
  2. package/package.json +1 -1
package/bin/setup.js CHANGED
@@ -142,22 +142,19 @@ function setupHooks() {
142
142
  const command = `${envPrefix} ${NODE_BIN} ${path.join(PKG_DIR, 'hooks', file)}`;
143
143
 
144
144
  if (!existing.hooks[event]) existing.hooks[event] = [];
145
- const hooks = existing.hooks[event];
146
145
 
147
- // New hook format with matcher: { matcher: {}, hooks: [{ type, command }] }
148
- const hookCmd = { type: 'command', command };
149
- const entry = { matcher: {}, hooks: [hookCmd] };
150
-
151
- // Find existing hook group by script filename
152
- const idx = hooks.findIndex(h =>
153
- h.hooks && h.hooks.some(hh => hh.command && hh.command.includes(file))
154
- );
146
+ // Remove any existing entries (old or new format) matching this hook file
147
+ existing.hooks[event] = existing.hooks[event].filter(h => {
148
+ // Old format: { type, command }
149
+ if (h.command && h.command.includes(file)) return false;
150
+ // New format: { matcher, hooks: [{ type, command }] }
151
+ if (h.hooks && h.hooks.some(hh => hh.command && hh.command.includes(file))) return false;
152
+ return true;
153
+ });
155
154
 
156
- if (idx >= 0) {
157
- hooks[idx] = entry;
158
- } else {
159
- hooks.push(entry);
160
- }
155
+ // Add new format entry (matcher: "" means match all)
156
+ const hookCmd = { type: 'command', command };
157
+ existing.hooks[event].push({ matcher: '', hooks: [hookCmd] });
161
158
  }
162
159
 
163
160
  writeJSON(SETTINGS_FILE, existing);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alex900530/claude-persistent-memory",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Persistent memory system for Claude Code — hybrid BM25 + vector search, LLM-driven structuring, automatic clustering",
5
5
  "main": "lib/memory-db.js",
6
6
  "bin": {