Skip to content

fix(web): copy theme.json to dist on build - #56051

Closed
eloyred wants to merge 1 commit into
anomalyco:devfrom
eloyred:fix-theme-json-schema
Closed

eloyred wants to merge 1 commit into
anomalyco:devfrom
eloyred:fix-theme-json-schema

Conversation

@eloyred

@eloyred eloyred commented Oct 16, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #56050

Type of change

  • Bug fix

What does this PR do?

The astro:build:done hook in packages/web/astro.config.mjs copies dist/config.json (generated) and dist/tui.json (from packages/console/app/public). It does not copy dist/theme.json from packages/web/public, so https://opencode.ai/theme.json returns 404 even though the file exists.

This PR adds one line to the hook that copies packages/web/public/theme.json to dist/theme.json, the same pattern already used for tui.json. After the next deploy, the URL will serve a valid JSON Schema and any user-written theme that references $schema: "https://opencode.ai/theme.json" will get IDE auto-completion and validation as intended.

How did you verify your code works?

  • curl -sI https://opencode.ai/theme.json before: HTTP/2 404. Same for /config.json and /tui.json are 200.
  • Inspected packages/web/astro.config.mjs and confirmed the hook matches the existing pattern.
  • bun run check from repo root: 35 tasks pass, 0 fail.
  • node --check packages/web/astro.config.mjs: valid JS syntax.
  • The fix is verified at deploy time by re-running curl -I https://opencode.ai/theme.json.

Screenshots / recordings

Not applicable — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The astro:build:done hook in astro.config.mjs generates dist/config.json
and copies dist/tui.json from packages/console/app/public. The same hook
also needs to copy packages/web/public/theme.json so that
https://opencode.ai/theme.json serves the JSON Schema referenced by
themes.mdx and the theme examples.

Without this line the URL referenced by every theme example as
"$schema": "https://opencode.ai/theme.json" returns 404.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I couldn't verify this fixes the reported URL, and from the infra it looks like it can't. opencode.ai is served by the console app (infra/console.ts, packages/console/app). This hook is in the docs build (packages/web), which is deployed to docs.opencode.ai (infra/app.ts). On the live site the copied schemas are already served from both hosts: opencode.ai/tui.json, opencode.ai/config.json, docs.opencode.ai/tui.json and docs.opencode.ai/config.json all return 200. With this change, docs.opencode.ai/theme.json should start returning 200, but opencode.ai/theme.json probably won't.

The console app already ships its own packages/console/app/public/theme.json, and other console-only public files are served on opencode.ai, so the 404 there probably comes from routing or deployment, not from this hook. Also, opencode.ai/theme.json returns a plain-text Not found, unlike the HTML 404 for other missing paths. That points to something specific handling that path. The two theme.json copies have also drifted apart: the web one has selectedListItemText and the console one doesn't. Whatever ends up serving opencode.ai/theme.json should use one source.

Could you confirm (or ask a maintainer) which worker serves opencode.ai/theme.json, and either fix it there or explain how this line reaches it?

No public API change: no SDK, server, plugin, config-key or CLI change; it only affects which static files the docs build outputs.

execFileSync("bun", ["../schema/script/config-schema.ts", "./dist/config.json"], { stdio: "inherit" })
// The V1 TUI schema is frozen in the console app since packages/opencode lives on the v1 branch.
copyFileSync("../console/app/public/tui.json", "./dist/tui.json")
copyFileSync("./public/theme.json", "./dist/theme.json")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This output goes to the docs worker (docs.opencode.ai, per infra/app.ts). The URL in #56050, opencode.ai/theme.json, is served by the console app (infra/console.ts), which already has packages/console/app/public/theme.json and still returns 404 there. This line may make docs.opencode.ai/theme.json work, but I don't see how it fixes opencode.ai/theme.json. Also, this copy and the console copy have drifted apart (only this one has selectedListItemText).

@eloyred

eloyred commented Oct 16, 2026

Copy link
Copy Markdown
Author

Closing this — the @opencode-agent review is right.

I had narrowed the problem to "missing copy step in docs build", but the actual deployment of opencode.ai is a separate worker (the console app at packages/console/app), not the docs build at packages/web. So this PR fixes docs.opencode.ai/theme.json (which I confirmed still returns 404 today), but not the URL the issue actually points at.

Verifying against live URLs before and after this fix (note: I cannot test "after" until merge + deploy):

URL Before this PR
https://opencode.ai/config.json 200
https://opencode.ai/tui.json 200
https://opencode.ai/theme.json 404
https://docs.opencode.ai/config.json 200
https://docs.opencode.ai/tui.json 200
https://docs.opencode.ai/theme.json 404

So both opencode.ai and docs.opencode.ai are missing theme.json. The console app already ships its own packages/console/app/public/theme.json (drifted from the web copy — it lacks selectedListItemText), so the 404 on opencode.ai looks like a routing/config problem at the SolidStart + Nitro + Cloudflare layer, not a missing file. I do not have a confident fix for that side without a deploy environment to verify.

The one-line fix in this PR is still correct for the docs side, but the reported bug is broader. I'll move the work into issue #56050 — diagnosing the console-side 404 and consolidating the two theme.json copies into a single source so both URLs serve the same content.

Thanks to the bot for catching what I missed.

@eloyred eloyred closed this Oct 16, 2026
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.

theme.json returns 404 despite existing in packages/web/public

1 participant