Skip to content

Conversation

@xiaobluesky
Copy link

@xiaobluesky xiaobluesky commented Jan 31, 2026

Fixes #11147
fix(config): optimize dependency installation to use global cache

Problem:

  • OpenCode was creating node_modules in every .opencode directory
  • Each installation duplicated @opencode-ai/plugin (~6MB each)
  • Wasted disk space when working across multiple projects

Solution:

  • Install @opencode-ai/plugin to ~/.cache/opencode/node_modules/ (shared global cache)
  • Only create local node_modules when package.json has custom dependencies
  • Skip dependency installation entirely if package.json does not exist

Result:

  • Reduces disk usage by sharing @opencode-ai/plugin across all projects
  • Maintains ability for users to add custom dependencies locally
  • No longer creates redundant node_modules directories

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found two potentially related PRs:

  1. feat(bun): track provider packages for automatic cleanup (feat(bun): track provider packages for automatic cleanup #10275)

  2. fix(core): plugins are always reinstalled (fix(core): plugins are always reinstalled  #9675)

The primary PR (#11506) appears to be the current PR you're working with. The two related PRs above might have relevance to the dependency installation and caching improvements being made.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local project keep getting installed with @opencode-ai/plugin on opencode launch

1 participant