Repository navigation
feat(cli): add -v/--version flag - #295
Merged
Merged
Conversation
Automated updaters need to know which version is installed. The binary had no version information, and any invocation ran config.Load(), so it failed without FUSION_PASSWORD or OIDC configured. - Parse flags before loading config; `fusion -v` / `--version` prints the bare version to stdout and exits 0, so scripts can compare it with a release tag directly. - build_backend injects `git describe --tags --always --dirty` via -X main.version, falling back to `dev`. Release and Docker builds already go through it with full history, so CI needs no change. - Log the version on server start to help with bug reports. Unknown flags now exit 2 with usage instead of being silently ignored. Closes #232 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
-v/--versionfor automated updaters (#232). Flags are parsed before config loading, so it works with noFUSION_*env set.scripts.sh build_backendinjectsgit describe --tags --always --dirtyvia-ldflags "-X main.version=..."(falls back todev). Release and Docker builds already use this script withfetch-depth: 0, so CI is unchanged.v1.3.2mainpush imagev1.3.2-1-ga153670go run/ plaingo builddevThe
--configrequest from #232 is intentionally not implemented: env files already cover it everywhere (docker --env-file, Composeenv_file:, k8senvFrom, systemdEnvironmentFile=,set -a; . ./fusion.env), and a second config source would add precedence rules and dual maintenance for every option.Evidence
Before:
env -i ./fusion --version→ERROR fatal error="FUSION_PASSWORD or FUSION_OIDC_ISSUER is required ..."(exit 1)After: simulated release (scratch clone, commit tagged
v9.9.9,build-frontend+build-backend, tree stays clean):TestParseArgscovers-v,--version, no args, unknown flag,-h;./scripts.sh test-backendpasses.Merge Danger
Door: two-way
Blast Radius: small
Unknown flags (e.g.
fusion -foo) used to be silently ignored and now exit 2. Non-flag positional args are still ignored.Closes #232
🤖 Generated with Claude Code