Skip to content

Remove version command and simplify version output#107

Merged
gtsiolis merged 9 commits intomainfrom
george/des-165
Mar 17, 2026
Merged

Remove version command and simplify version output#107
gtsiolis merged 9 commits intomainfrom
george/des-165

Conversation

@gtsiolis
Copy link
Member

@gtsiolis gtsiolis commented Mar 12, 2026

This PR simplifies version reporting in lstk and aligns it with common CLI conventions.

  1. Removes the version subcommand
  2. Keeps -v and --version as the supported version entry points
  3. Simplifies version output to a single plain line, lstk 0.4.1 for production and lstk dev for development

The previous setup exposed three different version entry points and printed extra build metadata by default. That added surface area without much user value. This change narrows the interface to the standard flag-based pattern most CLIs use, which is simpler for both humans and automation:

  1. Easier to discover and remember
  2. Less output parsing ambiguity
  3. Cleaner default UX
  4. Better fit for agent-readiness, where deterministic plain output matters more than decorative metadata (PRO-236)
BEFORE AFTER
Screenshot 2026-03-12 at 16 04 50 Screenshot 2026-03-12 at 16 04 38

This will also remove the version.Commit and version.BuildDate. I know uv includes commit and build metadata in a compact format, but for lstk the current output structure adds noise and makes the binary feel more like a development build than a polished release.

For reference:

lstk --version uv --version
Screenshot 2026-03-12 at 16 04 58 Screenshot 2026-03-12 at 16 14 02

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Removes the version subcommand, consolidates version output to the --version/-v flag with a new template, drops exported Commit/BuildDate accessors, and updates tests/docs to use --version and to assert help/version formatting.

Changes

Cohort / File(s) Summary
Version core
cmd/version.go, internal/version/version.go
Deleted the Cobra version subcommand and the exported Commit()/BuildDate() accessors; added/simplified versionTemplate() / versionLine() and made Version() single-line.
CLI wiring
cmd/root.go
Stopped registering the version subcommand, set the --version flag shorthand -v, and switched root version template to versionTemplate().
Version tests
cmd/version_test.go
Tightened assertions for versionLine() and added a test asserting --version and -v produce identical output matching versionTemplate().
Help / CLI tests
cmd/help_test.go, cmd/non_interactive_test.go
Added assertion preventing leading \n version in help; updated tests to pass --version (flag) instead of positional version.
Integration tests
test/integration/update_test.go, test/integration/logging_test.go, test/integration/...
Replaced positional version invocations with --version in multiple integration tests.
Login integration
test/integration/login_test.go
TestDeviceFlowSuccess now reads licenseToken from environment with a fallback synthetic token instead of requiring the env var.
Docs
README.md
Removed example/mention of the lstk version subcommand from usage documentation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • silv-io
  • carole-lavillonniere
  • anisaoshafi
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: removing the version subcommand and simplifying version output to a single plain line.
Description check ✅ Passed The description clearly explains the motivation, implementation details, and rationale for the version reporting changes, including before/after comparisons.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch george/des-165
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gtsiolis gtsiolis self-assigned this Mar 12, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
cmd/version.go (1)

13-15: Remove the now-dead build metadata plumbing.

versionLine() now only consumes version.Version(), so internal/version.Commit(), internal/version.BuildDate(), and the matching ldflags in .goreleaser.yaml are dead. Cleaning those up in the same change would keep the version model truly single-source and avoid shipping unused metadata in release builds.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/version.go` around lines 13 - 15, versionLine() now only uses
version.Version(), so remove the unused build metadata plumbing: delete
internal/version.Commit() and internal/version.BuildDate() implementations and
any callers, remove the corresponding ldflags from .goreleaser.yaml, and
consolidate the source of truth to version.Version() (leave version.Version()
intact); update any docs/comments referencing Commit/BuildDate to avoid dead
code and ensure releases no longer include those unused fields.
cmd/root.go (1)

48-56: Call out the lstk version removal in release notes or migration docs.

Dropping the subcommand is a CLI breaking change for automation that still invokes lstk version. If the hard removal is intentional, I'd make sure the release notes explicitly point users to lstk --version / lstk -v.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/root.go` around lines 48 - 56, The CLI removed the legacy "lstk version"
subcommand (see root.AddCommand where subcommands like newStartCmd/newStopCmd
are registered), which is a breaking change for users and automation; update the
release notes and migration documentation to explicitly call out removal of
"lstk version", mention the supported alternatives "lstk --version" and "lstk
-v", and provide a short migration note or example command for CI scripts to
replace the old subcommand with the new flag-based usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/non_interactive_test.go`:
- Around line 47-52: The tests TestNonInteractiveFlagBindsToCfg (and the similar
test at 58-62) currently ignore the error from root.Execute() and then assert on
cfg.NonInteractive; change them to check the returned error first (e.g.,
require.NoError(t, err) or if err != nil { t.Fatalf(...)}), then assert
cfg.NonInteractive so a failing Execute() (such as broken --version handling)
will fail the test instead of producing a false positive; locate root :=
NewRootCmd(...) and the subsequent root.Execute() call and update the test to
capture and assert on the error before inspecting cfg.NonInteractive.

---

Nitpick comments:
In `@cmd/root.go`:
- Around line 48-56: The CLI removed the legacy "lstk version" subcommand (see
root.AddCommand where subcommands like newStartCmd/newStopCmd are registered),
which is a breaking change for users and automation; update the release notes
and migration documentation to explicitly call out removal of "lstk version",
mention the supported alternatives "lstk --version" and "lstk -v", and provide a
short migration note or example command for CI scripts to replace the old
subcommand with the new flag-based usage.

In `@cmd/version.go`:
- Around line 13-15: versionLine() now only uses version.Version(), so remove
the unused build metadata plumbing: delete internal/version.Commit() and
internal/version.BuildDate() implementations and any callers, remove the
corresponding ldflags from .goreleaser.yaml, and consolidate the source of truth
to version.Version() (leave version.Version() intact); update any docs/comments
referencing Commit/BuildDate to avoid dead code and ensure releases no longer
include those unused fields.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 79c82fcd-4c6a-48e0-ac5c-2b1f4a3b9aa5

📥 Commits

Reviewing files that changed from the base of the PR and between ce474bd and 7b4c80b.

📒 Files selected for processing (6)
  • cmd/help_test.go
  • cmd/non_interactive_test.go
  • cmd/root.go
  • cmd/version.go
  • cmd/version_test.go
  • test/integration/update_test.go

@silv-io
Copy link
Member

silv-io commented Mar 12, 2026

The build metadata is needed for goreleaser so it has to stay there

@gtsiolis
Copy link
Member Author

Thanks for taking a look and the insight, @silv-io! Ok then, could we keep the linker-populated build metadata in the binary for Goreleaser and only removed it from the public version output. So --version and -v stay clean, while release builds still embed commit and build date internally.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/root.go`:
- Around line 44-46: The version flag only has the long form; add the -v
shorthand after calling root.InitDefaultVersionFlag() by setting the shorthand
on the existing flag (e.g., use root.Flags().Lookup("version").Shorthand = "v"
and ensure its Usage remains "Show version") so both -v and --version behave
identically; this touches the block using root.InitDefaultVersionFlag(),
root.Flags().Lookup("version").Usage and
root.SetVersionTemplate(versionTemplate()).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 74dc0690-06ee-44bc-9d91-626f9728e33c

📥 Commits

Reviewing files that changed from the base of the PR and between 7b4c80b and f50c7a0.

📒 Files selected for processing (8)
  • README.md
  • cmd/help_test.go
  • cmd/non_interactive_test.go
  • cmd/root.go
  • cmd/version.go
  • cmd/version_test.go
  • internal/version/version.go
  • test/integration/update_test.go
💤 Files with no reviewable changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/integration/update_test.go
  • cmd/help_test.go
  • cmd/version.go
  • cmd/non_interactive_test.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/integration/login_test.go`:
- Line 11: The test currently skips when os.Getenv("LOCALSTACK_AUTH_TOKEN") is
empty; since this integration test uses a mocked API server, remove or relax
that env-gate in the login_test.go test (the block checking
LOCALSTACK_AUTH_TOKEN and calling t.Skip) so the test can run with a
synthetic/dummy token instead—either default the token to a known test value
when empty or remove the t.Skip call and ensure the mocked client uses the
synthetic token; update any references to LOCALSTACK_AUTH_TOKEN in the test
setup to accept the fallback token.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 160e3b3c-12c5-4378-a597-e8c6cf07deff

📥 Commits

Reviewing files that changed from the base of the PR and between be6ed22 and 1f7b050.

📒 Files selected for processing (10)
  • README.md
  • cmd/help_test.go
  • cmd/non_interactive_test.go
  • cmd/root.go
  • cmd/version.go
  • cmd/version_test.go
  • internal/version/version.go
  • test/integration/logging_test.go
  • test/integration/login_test.go
  • test/integration/update_test.go
💤 Files with no reviewable changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • cmd/help_test.go
  • cmd/version_test.go
  • cmd/non_interactive_test.go
  • test/integration/update_test.go
  • internal/version/version.go

@carole-lavillonniere
Copy link
Collaborator

Pushed a "clean-up" commit 3146cf9. @silv-io can you have a look?

  1. internal/version/version.go — Removed dead commit/buildDate vars. Only version remains.
  2. .goreleaser.yaml — Removed dead commit and buildDate ldflags to match.
  3. cmd/version.go — Removed versionTemplate() wrapper, inlined at call sites.
  4. cmd/version_test.go — Removed redundant empty string check.
  5. test/integration/login_test.go — Replaced env lookup with hardcoded "test-license-token", removed unused os
    import.

Copy link
Member

@silv-io silv-io left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks for fixing it up.

IMO a version command will be useful for also showing info about the images we currently have downloaded already. But we can add that back in the future.
Maybe this can also just go into the doctor command I was thinking about.

@gtsiolis
Copy link
Member Author

Thanks, @silv-io @carole-lavillonniere! 🏀

@gtsiolis gtsiolis merged commit 8bac894 into main Mar 17, 2026
8 checks passed
@gtsiolis gtsiolis deleted the george/des-165 branch March 17, 2026 21:44
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.

3 participants