Skip to content

fix(branding): repair branded CodeQ build broken by upstream drift#11

Open
Kenny-Heitritter wants to merge 1 commit into
devfrom
fix/branding-upstream-drift
Open

fix(branding): repair branded CodeQ build broken by upstream drift#11
Kenny-Heitritter wants to merge 1 commit into
devfrom
fix/branding-upstream-drift

Conversation

@Kenny-Heitritter
Copy link
Copy Markdown
Member

Fixes two pre-existing bugs in branding/apply.ts that broke branded (CodeQ) builds after the recent upstream sync (feat/upstream-sync-opus-4-6). Both were found while verifying a branded bun run build --single on macOS arm64 — the branded build failed to compile, and once worked around, the binary crashed at startup.

Bug 1 — external package renamed → build fails

The opencode -> codeq product-name replacement also rewrote the external scoped package @gitlab/opencode-gitlab-auth@gitlab/codeq-gitlab-auth (in plugin/index.ts import + packages/opencode/package.json). bun install then 404s on the nonexistent package and the build aborts:

error: GET https://registry.npmjs.org/@gitlab%2fcodeq-gitlab-auth - 404

Fix: add a negative lookbehind for scoped packages (@<scope>/) and exclude -gitlab-auth from the product-name regex, so external @scope/opencode-* packages are preserved (matches the existing @opencode-ai exclusion intent).

Bug 2 — LOGO is not defined → branded binary crashes at startup

The CLI logo transform injects a logo() that iterates a const LOGO array, but upstream removed that array (the logo now comes from ./logo as glyphs.left/right). The const LOGO = [...] replacement no-ops while the injected logo() still references LOGO, so the branded binary crashes immediately:

ERROR service=default e=LOGO is not defined exception

Fix: guard both the CLI (ui.ts) and TUI (logo.tsx) logo transforms — if the expected LOGO / LOGO_LEFT/LOGO_RIGHT structures are absent, skip the rewrite and keep the upstream logo (cosmetic loss of the purple-Q branding, but a working binary). Resilient to future upstream logo changes.

Verification (macOS arm64)

On this branch (off dev, no other changes):

  • bun branding/apply.ts qbraid → both structures preserved (no @gitlab/codeq..., no broken LOGO).
  • bun run build --single → branded codeq binary builds cleanly.
  • ./dist/codeq-darwin-arm64/bin/codeq --versionboots without crashing (previously crashed).
  • codeq models qbraid (clean config) → lists models, logo renders.

Notes

🤖 Generated with opencode

Two pre-existing bugs surfaced after the upstream sync, both of which
broke branded (CodeQ) builds:

1. External scoped package @gitlab/opencode-gitlab-auth was renamed to
   @gitlab/codeq-gitlab-auth by the opencode->productName replacement,
   causing 'bun install' to 404 and the build to fail. Exclude scoped
   packages (negative lookbehind for @<scope>/) and -gitlab-auth.

2. The CLI logo transform injected a logo() that references a 'const LOGO'
   array which upstream removed (logo now comes from ./logo glyphs), so the
   branded binary crashed at startup with 'LOGO is not defined'. Guard the
   CLI + TUI logo transforms to no-op when the expected structures are
   absent, preserving the upstream logo instead of crashing.
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.

1 participant