Repository navigation
Description
Summary
Running graphify install --platform opencode without --project (i.e. the documented global-install mode) writes the plugin to ~/.opencode/plugins/graphify.js and creates a new ~/.opencode/opencode.json next to it. Neither file is loaded by opencode — opencode's global config lives at ~/.config/opencode/opencode.json, and plugins referenced as .opencode/plugins/<name>.js in that config are resolved relative to that config's directory (~/.config/opencode/.opencode/plugins/). The installer writes to the wrong tree.
The installer log claims success (tool.execute.before hook written, plugin registered), but the plugin silently never loads. The ~/.opencode/ directory opencode creates is the npm-style binary install dir (~/.opencode/bin/opencode, ~/.opencode/node_modules/), not a config dir.
This is the global-mode sibling of #1040 (which was the --project variant of the same class of bug).
Environment
- OS: Linux (Ubuntu / NixOS)
- Shell: bash
- graphify version:
0.8.39(installed viauv tool install graphifyy) - opencode: config at
~/.config/opencode/opencode.json(the documented global config location per https://opencode.ai/config.json) - Run from:
~(home directory)
Reproduction
cd ~
rm -rf .opencode/plugins/graphify.js .opencode/opencode.json \
.config/opencode/.opencode/plugins/graphify.js
graphify install --platform opencodeActual output
references -> /home/ikv/.config/opencode/skills/graphify/references
skill installed -> /home/ikv/.config/opencode/skills/graphify/SKILL.md
.opencode/plugins/graphify.js -> tool.execute.before hook written
.opencode/opencode.json -> plugin registered
Actual filesystem state after install
/home/ikv/.opencode/ ← npm-style binary install dir
├── bin/opencode
├── node_modules/
├── package.json
├── opencode.json ← installer CREATED this (orphan)
│ (contents: {"$schema":"…","plugin":[".opencode/plugins/graphify.js"]})
└── plugins/
└── graphify.js ← installer wrote plugin HERE (orphan)
/home/ikv/.config/opencode/ ← the REAL global config dir
├── opencode.json ← user's actual config (untouched)
│ (already has "plugin": [".opencode/plugins/graphify.js"] from a prior install)
├── skills/graphify/SKILL.md ← correctly placed (skill DOES load)
└── .opencode/plugins/ ← EMPTY — no graphify.js here
Observed symptom
The skill loads correctly, but the plugin never fires its tool.execute.before hook, because opencode resolves .opencode/plugins/graphify.js against ~/.config/opencode/ (where the loaded config lives), not against ~/.opencode/.
Running graphify query "<question>" confirms the skill is registered, but bash search commands (grep, rg, find) produce no reminder — the hook is dead.
Workaround
After install, manually move the plugin to where opencode actually loads it from:
mkdir -p ~/.config/opencode/.opencode/plugins
cp ~/.opencode/plugins/graphify.js ~/.config/opencode/.opencode/plugins/graphify.js
# Optional: delete the orphans
rm -rf ~/.opencode/plugins ~/.opencode/opencode.jsonExpected behaviour
The installer should resolve the global opencode config dir via (in order of preference):
$XDG_CONFIG_HOME/opencodeifXDG_CONFIG_HOMEis set~/.config/opencode/(the documented default — see https://opencode.ai/config.json and thecustomize-opencodeskill shipped with opencode itself, which explicitly states: "Global config —~/.config/opencode/opencode.json(NOT~/.opencode/)")
…and write the plugin to <config_dir>/.opencode/plugins/graphify.js, registering it in <config_dir>/opencode.json only if not already present.
~/.opencode/ is opencode's binary/cache dir, not a config dir, and should not be touched by the installer.
Related
--projectflag creates non-discoverable skill path for OpenCode platform #1040 —--projectvariant of the same bug class (skill written to non-discoverable path)- Installation reports success, but graphify.js, opencode.json entry, and /graphify command are missing #378 — earlier "installation reports success but plugin/json/command missing" report
- The opencode docs at https://opencode.ai/config.json and the built-in
customize-opencodeskill both clearly distinguish~/.config/opencode/(config) from~/.opencode/(runtime/binary).
Suggested fix
In the installer code path for --platform opencode global mode, replace the destination resolution (pseudocode):
# Before (buggy)
config_dir = home / ".opencode"
# After (correct)
xdg = os.environ.get("XDG_CONFIG_HOME")
config_dir = Path(xdg) / "opencode" if xdg else home / ".config" / "opencode"…and write graphify.js to config_dir / ".opencode" / "plugins" / "graphify.js". The skill write path (config_dir / "skills" / "graphify" / ...) already does this correctly — only the plugin + opencode.json writes are wrong.
Activity
fix(opencode): write global-install plugin to ~/.config/opencode/ ins…