opencode icon indicating copy to clipboard operation
opencode copied to clipboard

perf(bun): cache plugin versions with TTL to avoid reinstalling on every startup

Open xammen opened this issue 2 weeks ago • 0 comments

Summary

  • Fixes slow startup (~21 seconds) caused by reinstalling plugins on every launch
  • When plugins use @latest, the cache now tracks timestamps and reuses cached versions for 24 hours
  • Reduces plugin loading time from ~21s to <1s

Problem

The cache check compared 'latest' against the resolved version (e.g., '2.12.2'), which never matched:

if (parsed.dependencies[pkg] === version) return mod  // 'latest' !== '2.12.2'

Solution

  • Added _timestamps field to track when packages were installed
  • For @latest requests, reuse cached version if installed within 24 hours
  • Still allows periodic updates while avoiding redundant reinstalls

xammen avatar Jan 04 '26 12:01 xammen