claude-recall 0.29.0 → 0.29.1
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.
|
@@ -165,11 +165,33 @@ class KiroCommands {
|
|
|
165
165
|
preToolUse: 'kiro-rule-injector',
|
|
166
166
|
postToolUse: 'kiro-tool-outcome',
|
|
167
167
|
};
|
|
168
|
+
// Superseded claude-recall hooks to strip from an event before wiring the
|
|
169
|
+
// current one — prevents stacking when the handler for an event changes
|
|
170
|
+
// across versions. Pre-0.29 wired userPromptSubmit to `correction-detector`
|
|
171
|
+
// directly; 0.29 replaced it with `kiro-capture`. Leaving the old entry
|
|
172
|
+
// makes BOTH fire, double-capturing (often as near-duplicate memories).
|
|
173
|
+
// Only our own commands (containing 'claude-recall' / 'hook run') are
|
|
174
|
+
// touched — a user's unrelated hook on the same event is preserved.
|
|
175
|
+
const supersededMarkers = {
|
|
176
|
+
userPromptSubmit: ['correction-detector'],
|
|
177
|
+
};
|
|
178
|
+
const isOurCommand = (cmd) => cmd.includes('claude-recall') || cmd.includes('hook run');
|
|
168
179
|
for (const [event, entries] of Object.entries(KiroCommands.buildHookEntries(hookCmd))) {
|
|
169
180
|
if (!Array.isArray(config.hooks[event])) {
|
|
170
181
|
config.hooks[event] = [];
|
|
171
182
|
}
|
|
172
183
|
const marker = handlerMarkers[event];
|
|
184
|
+
// Strip superseded entries first (but never the current marker).
|
|
185
|
+
for (const stale of supersededMarkers[event] ?? []) {
|
|
186
|
+
if (stale === marker)
|
|
187
|
+
continue;
|
|
188
|
+
const before = config.hooks[event].length;
|
|
189
|
+
config.hooks[event] = config.hooks[event].filter((h) => !(typeof h?.command === 'string' && h.command.includes(stale) && isOurCommand(h.command)));
|
|
190
|
+
const removed = before - config.hooks[event].length;
|
|
191
|
+
if (removed > 0) {
|
|
192
|
+
changes.push(`hooks.${event}: removed ${removed} superseded ${stale} entr${removed === 1 ? 'y' : 'ies'}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
173
195
|
const alreadyWired = config.hooks[event].some((h) => typeof h?.command === 'string' && h.command.includes(marker));
|
|
174
196
|
if (alreadyWired) {
|
|
175
197
|
changes.push(`hooks.${event}: ${marker} already wired — skipped`);
|
package/package.json
CHANGED