feat: add version command to scharf & add agents.edn spec#48
Merged
Conversation
Contributor
Confidence Score: 5/5Safe to merge; all changes are additive and the refactored command tree is covered by new tests. The version embedding, newRootCmd refactor, and upgrade error-handling improvements are all straightforward and well-tested. The only notable finding is a small dead-code block in the upgrade command that poses no runtime risk. main.go — the unreachable splitActionRef error branch after validateUpgradeInput. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[scharf CLI] --> B{command}
B --> V1["--version flag\n(Cobra built-in)"]
B --> V2["version subcommand"]
B --> U["upgrade subcommand\n(now RunE)"]
B --> OTHER["other commands\naudit/autofix/find/list/lookup/upgrade-all-sha"]
V1 --> E1["rootCmd.Version\n= cliVersion()"]
V2 --> E2["fmt.Fprintln(cmd.OutOrStdout(), cliVersion())"]
E1 --> JSON["go:embed version.json"]
E2 --> JSON
JSON -->|"goreleaser build"| GR["goreleaser before hook\nwrites version/commit/date"]
JSON -->|"go build / dev"| DEV["dev defaults\nversion: dev, commit: unknown"]
U --> VAL["validateUpgradeInput()"]
VAL -->|"error"| ERR["Usage to stderr\nSilenceUsage=true\nreturn error"]
VAL -->|"ok"| RESOLVE["resolver.ResolveNext()"]
RESOLVE -->|"error"| RETERR["return error"]
RESOLVE -->|"ok"| OUT["print upgradedPin"]
Reviews (2): Last reviewed commit: "fix: silence the output" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: N3N9 <narenarya@live.com>
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.
Description
This PR adds a new version command by embedding version.json file at run time.
This PR also introduces a new agents.edn file to be used by agents while developing on project