Skip to content

Hide TUI from release builds via dev build tag#274

Merged
jeremy merged 6 commits intomainfrom
tuiless
Mar 11, 2026
Merged

Hide TUI from release builds via dev build tag#274
jeremy merged 6 commits intomainfrom
tuiless

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 11, 2026

Summary

  • Gate the full TUI workspace behind //go:build dev so release binaries get a stub that prints a dev-only notice and exits non-zero
  • Add devBuild compile-time constant (dev_tag.go / dev_tag_stub.go) as the single source of truth for TUI availability
  • Gate bonfire on the same devBuild check (before the existing experimental config check)
  • Add DevOnly field to the command catalog, rendered as [dev] badge in basecamp commands
  • Thread -tags dev through every Makefile target and CI workflow that invokes go build/test/vet; GoReleaser intentionally omits the tag so release binaries compile the stub

Design

make build (the documented dev path) always passes -tags dev → full TUI. GoReleaser (the release path) passes no tag → stub TUI. Plain go build ./cmd/basecamp is intentionally release-shaped; make build is the documented way.

The stub NewTUICmd() matches the real command's surface (Use, Args, --trace flag) so help text, completions, and surface snapshots are consistent across build types.

Test plan

  • make build && ./bin/basecamp tui --help shows full TUI help
  • go build -o /tmp/rel ./cmd/basecamp && /tmp/rel tui prints dev-only error, exits 1
  • /tmp/rel tui --trace same error (not "unknown flag")
  • /tmp/rel bonfire split foo prints dev-only error
  • ./bin/basecamp commands shows [dev] badge on tui and bonfire (styled output)
  • bin/ci passes

jeremy added 3 commits March 11, 2026 15:04
Add //go:build dev to tui.go, tui_url.go, and their tests so the full
workspace TUI is only compiled into dev-tagged builds. A stub
tui_stub.go (//go:build !dev) provides an identical command surface
(Use, Args, --trace flag) that returns a dev-only usage error.

The devBuild constant (dev_tag.go / dev_tag_stub.go) gives the rest of
the commands package a compile-time boolean for gating features without
importing version or adding runtime checks.
CommandInfo gains a DevOnly bool so the commands listing can badge
dev-gated commands with [dev] instead of [experimental]. DevOnly
subsumes experimental for display purposes — a command that is both
shows only [dev].

Catalog entries: tui is now DevOnly (was Experimental); bonfire is
DevOnly + Experimental (dev gate checked before experimental config).

requireBonfireExperimental checks devBuild first, returning a clear
"only available in development builds" error in release binaries
before ever consulting the experimental config flag.
With TUI files gated behind //go:build dev, all dev-time go
invocations must include the tag. Add BUILD_TAGS := -tags dev to the
Makefile and thread it through every target that calls go build, test,
vet, or fuzz. golangci-lint uses --build-tags dev (its own flag form).
govulncheck and gosec get the tag too.

CI workflows (test.yml, release.yml, security.yml) receive the same
treatment on their direct go invocations. GoReleaser intentionally
does not get the tag — release binaries compile the stub TUI.
@jeremy jeremy requested a review from a team as a code owner March 11, 2026 22:05
Copilot AI review requested due to automatic review settings March 11, 2026 22:05
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

Sensitive Change Detection (shadow mode)

This PR modifies control-plane files:

  • .github/workflows/release.yml
  • .github/workflows/security.yml
  • .github/workflows/test.yml

Shadow mode — this check is informational only. When activated, changes to these paths will require approval from a maintainer.

@github-actions github-actions bot added commands CLI command implementations tests Tests (unit and e2e) ci CI/CD workflows enhancement New feature or request breaking Breaking change labels Mar 11, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

⚠️ Potential breaking changes detected:

  • The 'tui' command is now restricted to development builds only and is not available in release builds. This is a breaking change since it removes the 'tui' command from production builds.
  • The 'bonfire' command is now restricted to development builds only and is not available in release builds. This is a breaking change since it removes the 'bonfire' command from production builds.

Review carefully before merging. Consider a major version bump.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 13 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/commands/tui_stub.go">

<violation number="1" location="internal/commands/tui_stub.go:15">
P2: Stub `Short` text doesn't match the real command's `Short`. The real TUI command uses `"Launch the Basecamp workspace [experimental]"` while this stub uses `[dev]`. If surface snapshots are generated from dev builds, the mismatch won't break them, but `--help` output and completions will differ between build types, contradicting the stated consistency goal.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the full-screen TUI workspace (and related tooling) available only in development builds by gating the real implementation behind the dev build tag and providing release-build stubs, while also surfacing “dev-only” status in the command catalog and ensuring CI/dev tooling builds with -tags dev.

Changes:

  • Add //go:build dev to TUI command + URL parsing code/tests, and introduce a !dev stub tui command for release builds.
  • Introduce a compile-time devBuild constant (dev_tag.go / dev_tag_stub.go) and use it to gate bonfire behavior.
  • Add DevOnly to the command catalog and render a [dev] badge; thread -tags dev through Makefile and CI workflows for dev builds.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
internal/commands/tui_url_test.go Gate TUI URL parsing tests behind dev build tag.
internal/commands/tui_url.go Gate TUI URL parsing implementation behind dev build tag.
internal/commands/tui_test.go Gate TUI command tests behind dev build tag.
internal/commands/tui_stub.go Add release-build (!dev) stub tui command that errors out.
internal/commands/tui.go Gate real TUI command behind dev build tag.
internal/commands/dev_tag.go Define devBuild = true for dev builds.
internal/commands/dev_tag_stub.go Define devBuild = false for non-dev builds.
internal/commands/commands.go Add DevOnly to catalog + render [dev] badge in basecamp commands.
internal/commands/bonfire.go Gate bonfire via devBuild before experimental-config gating.
Makefile Pass -tags dev through build/test/vet/lint/fuzz/vuln tooling.
.github/workflows/test.yml Run tests/build with -tags dev and pass build tags to golangci-lint.
.github/workflows/security.yml Build/analyze with -tags dev for gosec/CodeQL steps.
.github/workflows/release.yml Run race/govulncheck with dev tags in the release quality gate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The real command still said [experimental] while the stub said [dev].
Now both say [dev], matching the reclassification from experimental
to dev-only.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50dfd2d0c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Add tui_stub_test.go (//go:build !dev) to validate the stub command
  surface: accepts --trace, accepts URL arg, returns dev-only error.
- Add "Validate release build" CI step that compiles without the dev
  tag and runs stub tests, catching stub regressions on every PR.
- Switch tui stub and bonfire dev gate from ErrUsage to ErrUsageHint,
  guiding users toward `make build` or `go build -tags dev`.
- Replace tui.go Annotations {"experimental": "true"} with
  {"dev_only": "true"} to match the reclassification.
Copilot AI review requested due to automatic review settings March 11, 2026 22:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The function, message text, and sentinel filename all still said
"experimental" after the reclassification to dev-only. Rename to
printDevNotice, update the notice to "development preview", and
change the sentinel from experimental-tui-{v} to dev-tui-{v}.
@jeremy jeremy merged commit cfe0204 into main Mar 11, 2026
26 checks passed
@jeremy jeremy deleted the tuiless branch March 11, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change ci CI/CD workflows commands CLI command implementations enhancement New feature or request tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants