@imunitic/synapse 0.6.0 → 0.7.0

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.
@@ -174,18 +174,28 @@ function renderHooksTemplate(templatePath, hookBin) {
174
174
  return template;
175
175
  }
176
176
 
177
+ // "Ours" by the resolved binary's own basename, not the absolute path it's
178
+ // resolved to today -- an install-location change (a different platform
179
+ // package version, a different global npm prefix) would otherwise leave a
180
+ // previously-written entry unrecognized as ours, appending a second,
181
+ // duplicate hook group instead of replacing the first.
182
+ function isOurHookCommand(command) {
183
+ if (typeof command !== "string") return false;
184
+ const binToken = command.split(" ", 1)[0];
185
+ return path.basename(binToken) === HOOK_NAME;
186
+ }
187
+
177
188
  // Merges a rendered hooks.json-shaped template into an existing hooks.json
178
189
  // (Codex) or into settings.json's own `hooks` key (Claude Code) -- same
179
190
  // merge either way: drop only the groups a previous run of this script
180
- // itself wrote (every hook in the group calling the resolved hookBin path),
181
- // append the freshly rendered ones, leave anything else untouched. Re-running
182
- // this is therefore idempotent instead of accumulating duplicate entries.
183
- function mergeHooksInto(existingHooks, rendered, hookBin) {
191
+ // itself wrote (every hook in the group is one of ours, per
192
+ // `isOurHookCommand`), append the freshly rendered ones, leave anything else
193
+ // untouched. Re-running this is therefore idempotent instead of
194
+ // accumulating duplicate entries.
195
+ function mergeHooksInto(existingHooks, rendered) {
184
196
  const hooks = existingHooks || {};
185
197
  for (const [event, groups] of Object.entries(rendered.hooks)) {
186
- const kept = (hooks[event] || []).filter(
187
- (group) => !group.hooks.every((h) => typeof h.command === "string" && h.command.startsWith(hookBin))
188
- );
198
+ const kept = (hooks[event] || []).filter((group) => !group.hooks.every((h) => isOurHookCommand(h.command)));
189
199
  hooks[event] = [...kept, ...groups];
190
200
  }
191
201
  return hooks;
@@ -227,7 +237,7 @@ function configureClaude() {
227
237
  }
228
238
 
229
239
  const rendered = renderHooksTemplate(path.join(PKG_ROOT, "harness", "claude", "hooks.json"), hookBin);
230
- settings.hooks = mergeHooksInto(settings.hooks, rendered, hookBin);
240
+ settings.hooks = mergeHooksInto(settings.hooks, rendered);
231
241
 
232
242
  // The npm-install counterpart to $CLAUDE_PLUGIN_ROOT -- conf.zig's own
233
243
  // resolveConfPath and session_start.zig's synapse-claude.md/Index.md.template
@@ -264,7 +274,7 @@ function configureCodex() {
264
274
  fail(`${hooksPath} has invalid JSON (${err.message}) -- fix or back it up manually before re-running`);
265
275
  }
266
276
  }
267
- existing.hooks = mergeHooksInto(existing.hooks, rendered, hookBin);
277
+ existing.hooks = mergeHooksInto(existing.hooks, rendered);
268
278
  fs.mkdirSync(path.dirname(hooksPath), { recursive: true });
269
279
  backupIfExists(hooksPath);
270
280
  fs.writeFileSync(hooksPath, JSON.stringify(existing, null, 2) + "\n");
@@ -174,9 +174,8 @@ Omit either section if Steps 3–5 found nothing for it. If both are empty, don'
174
174
  all — say so directly instead of creating an empty note.
175
175
 
176
176
  This command never edits `Index.md` itself beyond the `inbox/` bootstrap case above — creating or
177
- renaming a category is the vault owner's call, made by hand using
178
- [[sb — Make vault folder taxonomy user-customizable via Index.md.template]]'s already-shipped
179
- mechanism, not something this command does on its own.
177
+ renaming a category is the vault owner's call, made by hand by editing `Index.md`'s folder list
178
+ directly, not something this command does on its own.
180
179
 
181
180
  ## Step 7: Report
182
181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imunitic/synapse",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Memory for Claude Code, Codex CLI, and OpenCode: a durable markdown vault plus a per-repo code graph.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,9 +23,9 @@
23
23
  "*.conf.template"
24
24
  ],
25
25
  "optionalDependencies": {
26
- "@imunitic/synapse-darwin-arm64": "0.6.0",
27
- "@imunitic/synapse-linux-x64": "0.6.0",
28
- "@imunitic/synapse-linux-arm64": "0.6.0"
26
+ "@imunitic/synapse-darwin-arm64": "0.7.0",
27
+ "@imunitic/synapse-linux-x64": "0.7.0",
28
+ "@imunitic/synapse-linux-arm64": "0.7.0"
29
29
  },
30
30
  "license": "SEE LICENSE IN LICENSE"
31
31
  }