fix: dynamic frameworkLogger import + server static file fixes#15
Closed
fix: dynamic frameworkLogger import + server static file fixes#15
Conversation
…r static file fixes Plugin: Replace static frameworkLogger import with dynamic loader matching the existing candidate-path pattern used for config-paths and system-prompt-generator. The static import '../core/framework-logger.js' resolves to .opencode/core/ when the compiled plugin is loaded from .opencode/plugins/, causing a blank screen in OpenCode TUI. Server: Fix PUBLIC_DIR to resolve to project root public/, add 404 guard on sendFile for index.html, move error handler middleware before app.listen() so Express registers it, replace console.error with frameworkLogger.
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenCode TUI renders a blank black screen on launch due to a broken import in the codex injection plugin.
Root cause: PR #12 replaced
console.warnwithframeworkLogger.log()but used a static import path../core/framework-logger.jsthat only resolves correctly fromdist/plugin/. When the compiled plugin is loaded from.opencode/plugins/(where OpenCode discovers it), the relative path resolves to.opencode/core/— which doesn't exist. Bun throwsERR_MODULE_NOT_FOUNDand OpenCode silently fails to initialize.Changes
Plugin (
src/plugin/strray-codex-injection.ts)frameworkLoggerimport with dynamic loader + noop fallback../../dist/core/→../core/candidate-path pattern already used byloadConfigPaths()andimportSystemPromptGenerator()dist/plugin/and.opencode/plugins/without modificationServer (
src/cli/server.ts)PUBLIC_DIRto resolve toproject-root/public/(wasdist/public/which doesn't exist at runtime)sendFileforindex.htmlapp.listen()so Express actually registers itconsole.errorwithframeworkLoggerBuild (
package.json)public/*todist/public/Verification
npm test— 2399 tests passingopencode debug config --print-logs --log-level DEBUG— no ERROR lines, plugin loads successfullybun -e "import('./.opencode/plugins/strray-codex-injection.js')"— loads OK