Skip to content

Add sourcebridge version command #8

@jstuart0

Description

@jstuart0

Summary

The sourcebridge CLI has no version subcommand or --version flag. Newcomers and operators need a simple way to confirm which binary they're running, especially when debugging which prerelease is deployed.

What needs to happen

  1. Add a version subcommand in cli/ that prints:
    • Semver version (from a Version package var or the build's embedded tag)
    • Git commit SHA
    • Build date
    • Go runtime version (runtime.Version())
  2. Wire --version / -v on the root command so sourcebridge --version prints the same info.
  3. Populate the version string from -ldflags at build time (see scripts/build-and-deploy.sh for the existing build invocation).

Where to look

  • cli/root.go — root cobra.Command that owns the subcommands.
  • cli/ — all subcommands live here. Drop a new version.go alongside serve.go / ask.go.
  • scripts/build-and-deploy.sh — add -ldflags "-X 'github.com/sourcebridge/sourcebridge/cli.Version=$TAG' -X '...Commit=$SHA'".
  • Makefile — the build target should gain the same ldflags for local builds.

Acceptance

  • sourcebridge version prints a multi-line block with version, commit, build date, go runtime.
  • sourcebridge --version prints the short form (just the version number).
  • Unset ldflags (bare go build ./...) prints dev instead of failing.

Difficulty

Beginner-friendly for Go developers. Self-contained in the CLI layer. No protocol or data-model changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomers — well-scoped, isolated, clear acceptance criteria

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions