Skip to content

OpenCode global install writes plugin and slash command to CWD instead of ~/.config/opencode/ #3398

Closed

Description

@ayushcodes10

Summary

Surfaced via automated review on #2727 (_install_opencode_command, adding the native /graphify slash command). A non-project (global, no --project) OpenCode install writes the plugin and the slash command to the current working directory's .opencode/ instead of the documented ~/.config/opencode/.

Where

Both _install_opencode_plugin and _install_opencode_command in graphify/install.py document the intended global location in their own docstrings:

OpenCode auto-loads every plugin file under .opencode/plugins/ (project) or ~/.config/opencode/plugins/ (global) at startup

Only a markdown file under .opencode/commands/ (or ~/.config/opencode/commands/ globally) becomes a /-menu entry

But every call site passes Path(".") for the non-project case instead of a ~/.config/opencode base:

_install_opencode_plugin(project_dir if project else Path("."))
_install_opencode_command(project_dir if project else Path("."))

_OPENCODE_PLUGIN_PATH/_OPENCODE_COMMAND_PATH also hardcode a leading .opencode/ segment, which is right for a project-relative install (<project_dir>/.opencode/plugins/graphify.js) but wrong for the global case (should be ~/.config/opencode/plugins/graphify.js, no extra .opencode/ nesting) — so this needs more than just swapping the base path.

This predates #2709/#2727; the slash command PR just inherited the same pattern from its sibling function for consistency, since fixing it there would have meant reworking both functions across their several call sites in install(), _agents_install, _agents_uninstall, and uninstall_all.

Fix

Likely needs _install_opencode_plugin/_install_opencode_command (and their uninstall counterparts) to take an explicit project: bool (or a pre-resolved base path) rather than always joining onto whatever project_dir they're handed, so the global case can correctly target ~/.config/opencode/ without the extra .opencode/ segment, matching how ~/.config/opencode/skills/graphify/SKILL.md is already resolved elsewhere in this file for the OpenCode skill itself.

Activity

  1. nikhilsaxena04 commented on Sep 9, 2026

    @nikhilsaxena04
    Contributor

    Hey! I've opened a PR to fix this issue.

    I updated _install_opencode_plugin and its uninstall counterpart to explicitly handle the project boolean, cleanly separating the global installation path (~/.config/opencode/) from the project-scoped path (<project_dir>/.opencode/).

    I also added a suite of tests to verify the routing for both global and project installations, as well as the uninstaller, to ensure this doesn't regress. Let me know if any changes are needed!

  2. nothariharan commented on Oct 26, 2026

    @nothariharan
    Contributor

    Opened #4771. A global install now writes the plugin to ~/.config/opencode/plugins/graphify.js (no .opencode/ nesting), graphify uninstall removes it, and the OpenCode 2 auto-refresh checks that dir too. The slash-command half no longer applies on v8, because _install_opencode_command is gone, so this is plugin-only now. It takes the same approach as #3459 (@nikhilsaxena04), rebuilt on current v8 because that PR now conflicts. This closes when #4771 merges.

  3. safishamsi commented on Oct 30, 2026

    @safishamsi
    Member

    Fixed in v0.9.99 via #4771 (pip install graphifyy==0.9.99). The global OpenCode install writes the plugin to ~/.config/opencode. Thanks for the report, @ayushcodes10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions