Skip to content

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

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

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