@imunitic/synapse 0.0.1-test.0 → 0.0.1-test.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.
@@ -356,7 +356,13 @@ function configureOpencode() {
356
356
  const pluginDestDir = path.join(os.homedir(), ".config", "opencode", "plugin");
357
357
  const pluginDest = path.join(pluginDestDir, "synapse.js");
358
358
  fs.mkdirSync(pluginDestDir, { recursive: true });
359
- fs.copyFileSync(pluginSrc, pluginDest);
359
+ // synapse.js as shipped is a template -- it has no way to compute its own
360
+ // binary's install path at import time (no CLAUDE_PLUGIN_ROOT-equivalent
361
+ // for OpenCode plugins), so this bakes the real resolved path in as a
362
+ // literal, the same absolute path resolveHookBin() already gave the
363
+ // Claude/Codex hooks.json rendering above.
364
+ const pluginSource = fs.readFileSync(pluginSrc, "utf8").replace('"__SYNAPSE_HOOK_BIN__"', JSON.stringify(hookBin));
365
+ fs.writeFileSync(pluginDest, pluginSource);
360
366
  console.log(`installed ${pluginDest}`);
361
367
 
362
368
  const skillCount = copySkills(path.join(os.homedir(), ".config", "opencode", "skill"), opencodeToolNameTransform);
@@ -36,23 +36,18 @@
36
36
  //
37
37
  // `synapse-hook`'s own binary path isn't resolved here the usual way --
38
38
  // OpenCode plugins get no `${CLAUDE_PLUGIN_ROOT}`-equivalent "where am I
39
- // installed" value, unlike Claude Code/Codex. Resolves via `SYNAPSE_HOOK_BIN`
40
- // if set (an override, not a requirement), else the fixed shared install
41
- // location every harness's setup fetches into (`~/.cache/synapse/bin/
42
- // synapse-hook`, `XDG_CACHE_HOME`-aware) -- a real, predictable path now that
43
- // the binary is shared and unsuffixed across harnesses, not a bare name that
44
- // needed PATH resolution.
39
+ // installed" value, unlike Claude Code/Codex, and an npm install's binary
40
+ // lives inside a per-platform optionalDependency package
41
+ // (node_modules/@imunitic/synapse-{platform}-{arch}/bin/), a path with no
42
+ // fixed location this file could hardcode or compute at import time.
43
+ // `synapse-setup configure opencode` resolves it once, at configure time,
44
+ // and rewrites the literal string below to the real absolute path -- this
45
+ // file as shipped in the npm package is a template, not the copy that
46
+ // actually runs. `SYNAPSE_HOOK_BIN` overrides it if ever needed.
45
47
 
46
48
  import { spawnSync } from "child_process"
47
- import { homedir } from "os"
48
- import { join } from "path"
49
49
 
50
- function defaultHookBin() {
51
- const cacheHome = process.env.XDG_CACHE_HOME || join(homedir(), ".cache")
52
- return join(cacheHome, "synapse", "bin", "synapse-hook")
53
- }
54
-
55
- const HOOK_BIN = process.env.SYNAPSE_HOOK_BIN || defaultHookBin()
50
+ const HOOK_BIN = process.env.SYNAPSE_HOOK_BIN || "__SYNAPSE_HOOK_BIN__"
56
51
  const SESSION_START_MARKER = "[SYNAPSE-SESSION-START]"
57
52
 
58
53
  function runHook(subcommand, payload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imunitic/synapse",
3
- "version": "0.0.1-test.0",
3
+ "version": "0.0.1-test.1",
4
4
  "description": "Memory for Claude Code, Codex CLI, and OpenCode: a durable Obsidian vault plus a per-repo code graph.",
5
5
  "bin": {
6
6
  "synapse-setup": "bin/synapse-setup.cjs",