Date: 2026-05-05
This project ships as a Go binary with an embedded Svelte/Vite web UI.
The built web UI under web/ui/dist is intentionally tracked. The Go web
server embeds it from web/server.go:
//go:embed all:ui/dist
var embeddedUI embed.FStask build compiles the Go binary and embeds whatever web/ui/dist currently
contains. It does not run task web-build locally.
This keeps ordinary Go builds from requiring npm, but it means UI source
changes must be paired with refreshed dist assets before release.
The GitHub release workflow is stricter: it runs npm ci and task web-build
before every release task build, so published binaries embed web assets built
from the tagged UI source rather than relying only on the committed dist
directory.
Pull request CI also runs task web-build and then checks web/ui/dist for a
clean diff. If UI source changes were not committed with refreshed dist assets,
the PR fails before merge.
task build injects release metadata from DBRAIN_RELEASE_VERSION, a GitHub
Actions tag ref, or an exact checked-out git tag. Untagged local builds report
release_version: unknown and rely on the build short commit for identity.
Run task web-install after a fresh checkout if web/ui/node_modules is
missing, or after web/ui/package-lock.json changes.
Run task web-build whenever a change can affect the bundled UI:
web/ui/src/**web/ui/package.jsonweb/ui/package-lock.jsonweb/ui/vite.config.jsweb/ui/svelte.config.js- any future UI asset or build-config file
Commit the resulting web/ui/dist/** changes with the source UI change.
Go-only, CLI-only, docs-only, and backend-only changes do not need
task web-build unless they change an API contract or static data expected by
the UI.
Before tagging or packaging a release that includes UI changes:
-
Run
task web-installif dependencies are missing or changed. -
Run
task web-build. -
Inspect
git status --short web/ui/dist web/ui/src web/ui/package*.json. -
Commit refreshed
web/ui/dist/**assets with the UI source changes. -
Run the normal gates:
task fmt task lint task test-ci task build
-
Optionally spot-check the embedded UI:
bin/dbrain serve web
Do not use the Vite dev server as release evidence. It serves source assets
directly and does not prove that web/ui/dist is current.
If UI behavior looks different between development and bin/dbrain serve web,
rebuild web/ui/dist and check the diff:
task web-build
git diff -- web/ui/distIf task build succeeds but the served UI looks old, the binary likely embedded
stale tracked dist assets. Rebuild the UI, then rebuild the Go binary.
For tag releases, GitHub Actions rebuilds web/ui/dist before compiling the Go
binary. The committed dist files still matter for local builds, review, and
source checkouts, but the release archives are protected from stale UI assets.
Pull request CI catches stale committed dist assets earlier by rebuilding and
requiring git diff --exit-code -- web/ui/dist to stay clean.
The tag release workflow updates darron/homebrew-tap after the GitHub release
assets are published when the repository secret HOMEBREW_TAP_TOKEN is present.
The token must be able to write contents to darron/homebrew-tap.
The workflow downloads the built release archives, computes the four Homebrew
checksums for darwin_amd64, darwin_arm64, linux_amd64, and linux_arm64,
updates Formula/dbrain.rb, and pushes a commit named
Update dbrain to <tag>. If the secret is absent, the release still succeeds
and the tap update is skipped.