fix(pkg): ship src/logger.ts and src/util for the raw-source ./tui entry#8
Open
iceteaSA wants to merge 1 commit into
Open
fix(pkg): ship src/logger.ts and src/util for the raw-source ./tui entry#8iceteaSA wants to merge 1 commit into
iceteaSA wants to merge 1 commit into
Conversation
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
In
@cortexkit/opencode-openai-auth@0.1.4the OpenAI provider half works (slash commands, OAuth, quota, RPC server), but the quota sidebar never renders.Root cause is packaging, not logic. opencode loads the TUI plugin from raw source:
so every
src/file transitively imported bysrc/tui.tsxmust be present in the published tarball. Thefilesarray enumerates individualsrcfiles but omits two that are reachable fromtui.tsx:src/logger.ts—src/tui.tsx(import { createLogger } from './logger.js') andsrc/sidebar-state.ts.src/util/open-url.ts—src/tui/command-dialogs.tsx(import { openUrl } from '../util/open-url'); the wholesrc/util/dir was absent.At load the
./tuimodule throwsERR_MODULE_NOT_FOUND, so the TUI half dies silently — no sidebar slot, RPC poll never starts, stale RPC port files never cleaned. The server half is unaffected because it's consumed via the bundleddist/, where these modules are inlined (which is why the slash commands and quota state work while the sidebar doesn't).Fix
Add the two missing paths to
files:exportsis unchanged — the raw-source./tuiload is intentional and matches the sibling plugin.Recurrence guard
New test
src/tests/tui-packaging.test.tsmakes this class of bug impossible to reintroduce silently. With no hardcoded list, it:exports["./tui"].importfrompackage.json,.js→.ts/.tsxspecifier rewrites,import/export … from, side-effect and dynamic imports, type-only imports),src/file is covered by afilesentry (exact match or directory prefix).Red-first proven: on the pre-fix
filesarray it fails listing exactlysrc/logger.tsandsrc/util/open-url.ts; green after the fix.Verification
bun pm pack --dry-runnow listssrc/logger.tsandsrc/util/open-url.tsin the tarball.bun run buildclean ·bun run typesclean ·bun test394 pass / 0 fail ·bunx biome check src0 warnings.Affects 0.1.4 (current latest). The Anthropic sibling is unaffected — its
tui.tsxdoesn't import./loggeror../util/open-url.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by cubic
Fixes the TUI sidebar not rendering by shipping the missing source files for the raw-source
./tuiexport. Restores the quota sidebar and ensures the TUI loads without module errors.src/logger.tsandsrc/utiltopackage.json:filesso the./tuientry resolves all transitive imports.src/tests/tui-packaging.test.tsto walk imports fromexports["./tui"].importand assert every reachablesrc/file is covered byfiles.Written for commit 5620e39. Summary will update on new commits.