Skip to content

refactor: consume logger + cache from @four-bytes/opencode-plugin-lib v0.2.0 (#89) - #92

Merged
four-bytes-robby merged 6 commits into
mainfrom
feat/89-expand-plugin-lib
Jun 7, 2026
Merged

four-bytes-robby merged 6 commits into
mainfrom
feat/89-expand-plugin-lib

Conversation

@four-bytes-robby

@four-bytes-robby four-bytes-robby commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Brain now imports LRUCache, sessionCache, and createLogger from @four-bytes/opencode-plugin-lib v0.2.0 instead of maintaining local copies.

Changes

Lib — @four-bytes/opencode-plugin-lib v0.2.0

  • New: createLogger(pluginName) — throttled, rate-limited structured logger
  • New: LRUCache<K, V> — generic LRU cache with TTL
  • New: sessionCache — pre-configured cache singleton (embeddings, search, chunks, hashes)

Brain — src/logger.ts + src/cache.ts

  • Both files now thin re-exports from the lib (no local implementation)
  • All 18+ internal imports unchanged — backward compatible
  • 105 lines deleted from brain codebase

Verification

  • ✅ Build passes
  • ✅ All 247 tests pass
  • ✅ Logger prefix preserved ([brain])
  • ✅ setSilent() works identically

Closes #89


Summary by cubic

Align logging and cache with @four-bytes/opencode-plugin-lib v0.2.0. Keep console log/setSilent, route debug to stderr, and use the lib’s JSONL logger for structured debug.

  • Refactors

    • Re-export LRUCache and sessionCache; remove local implementations.
    • Throttle info/warn; setSilent controls console output.
  • Dependencies

    • Pin @four-bytes/opencode-plugin-lib to the v0.2.0 tag.
    • Bump package to @four-bytes/four-opencode-brain@1.5.1.

Written for commit 2353ba6. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread src/logger.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/cache.ts
@four-bytes-robby
four-bytes-robby merged commit a89b5d0 into main Jun 7, 2026
4 checks passed
@four-bytes-robby
four-bytes-robby deleted the feat/89-expand-plugin-lib branch June 7, 2026 14:03
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.

lib: expand @four-bytes/opencode-plugin-lib with more shared primitives

1 participant