opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(deps): add missing @opencode-ai/plugin to dependencies

Open HelloGGX opened this issue 1 month ago • 2 comments

Description

This PR fixes a Cannot find module error encountered when running tools that rely on @opencode-ai/plugin.

The Problem

As described in issue #2802, running scripts like .opencode/tool/github-triage.ts fails with the following error because the plugin package was missing from the dependencies list:

error: Cannot find module '@opencode-ai/plugin' from ...

The Fix

I have added "@opencode-ai/plugin": "workspace:*" to the dependencies section in package.json. This ensures the module is correctly linked and available for the tools to use.

Related Issue

Fixes #2802

HelloGGX avatar Dec 19 '25 15:12 HelloGGX

Btw this won't fix that persons issue, they had an in general request for:

allow running custom tools without external dependencies

That would mean no requirement of this dep at all (not possible rn)

ALso if u run opencode in opencode repo itll auto install this dep, so idk if we need to include in root package.json?

rekram1-node avatar Dec 20 '25 03:12 rekram1-node

I encountered a Cannot find module '@opencode-ai/plugin' error when attempting to run the internal tools (specifically github-triage.ts) within the OpenCode repository.

Cause: The script .opencode/tool/github-triage.ts imports { tool } from @opencode-ai/plugin, but this package is missing from the root package.json dependencies. In a pnpm workspace, this prevents the module from being correctly symlinked and resolved during local execution.

Proposed Solution: Add @opencode-ai/plugin to the dependencies section of the root package.json using the workspace:* protocol:

"dependencies": {
  ...
  "@opencode-ai/plugin": "workspace:*",
  "@opencode-ai/script": "workspace:*",
  "@opencode-ai/sdk": "workspace:*",
  ...
}

Verification: After adding the dependency and running pnpm install, the module resolution works as expected and the triage tool runs successfully.

Best regards, Sherlock Holmes

Btw this won't fix that persons issue, they had an in general request for:

allow running custom tools without external dependencies

That would mean no requirement of this dep at all (not possible rn)

ALso if u run opencode in opencode repo itll auto install this dep, so idk if we need to include in root package.json?

HelloGGX avatar Dec 21 '25 10:12 HelloGGX

Btw this won't fix that persons issue, they had an in general request for:

allow running custom tools without external dependencies

That would mean no requirement of this dep at all (not possible rn)

ALso if u run opencode in opencode repo itll auto install this dep, so idk if we need to include in root package.json?

I'm on NixOS, so naturally the automatic install fails because of the readonly filesystem and opencode will not work anymore when a plugin is installed. For every message I just get:

Cannot find module '@opencode-ai/plugin from 'path/to/my/plugin'

So I would be really greatful if this was included so I can use plugins on NixOS

Edit: I'm not sure anymore if this would solve my problem or if the reason why it cannot find the plugin is that my plugin file can just not find the already installed plugin

JoshuaDietz avatar Dec 21 '25 16:12 JoshuaDietz

this would only fix ur issue if u are running in the opencode repo, we need to figure out better solution for elsewhere

rekram1-node avatar Dec 21 '25 17:12 rekram1-node