Repository navigation
Bump spf13/pflag to v1.1.0 - #7083
Conversation
pflag v1.1.0 prints the explicit-value syntax for bool flags in help output (pflag #453), so every bool flag in thv --help now reads --flag[=true|false] and the option column widens. The generated CLI docs are regenerated with task docs to match; this is the only generated output that changes. Flag parsing is unchanged for our uses. thv run and thv build still ignore unknown flags through cobra's FParseErrWhitelist, and thv list still rejects them, identical to a v1.0.10 build. This was previously bundled into the grouped Renovate update, where it failed the docs check; it is a user-visible help change, so it lands on its own. Co-authored-by: Mecatl <[email protected]>
rdimitrov
left a comment
There was a problem hiding this comment.
Approving: the bump is isolated, the regenerated CLI docs are formatting-only, and no pflag 1.1.0 behaviour change reaches toolhive's flag parsing.
Design: Splitting pflag out of the grouped dependency update and regenerating docs/cli via task docs is the right shape; pflag owns parsing and help formatting, so regeneration rather than hand edits is correct. The only behaviour-sensitive path is unknown-flag pass-through in thv run, thv build and thv-proxyrunner (FParseErrWhitelist{UnknownFlags: true}); cobra v1.10.2 converts that to pflag's ParseErrorsAllowlist, and 1.1.0 still maps UnknownFlags: true to IgnoreUnknownFlag, so args after -- pass through as before. On upgrade, users only see --flag[=true|false] in bool help text and friendlier error wording for bad typed values; toolhive uses no map flags, MarkDeprecated, SetNormalizeFunc or custom bool values, and no test asserts the old error text.
Follow-up (not blocking): pflag 1.1.0 marks ParseErrorsAllowlist.UnknownFlags deprecated in favour of UnknownFlagsHandling: pflag.IgnoreUnknownFlag. The three call sites above (cmd/thv/app/run.go:133, cmd/thv/app/build.go:55, cmd/thv-proxyrunner/app/run.go:51) can move over later; staticcheck does not flag it today.
🤖 Reviewed with Claude Code
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7083 +/- ##
==========================================
- Coverage 80.90% 80.84% -0.06%
==========================================
Files 864 864
Lines 88639 88639
==========================================
- Hits 71709 71662 -47
- Misses 16925 16972 +47
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
--flag[=true|false]and the option column widens. The generated CLI docs underdocs/cli/are regenerated withtask docsso the docs check stays green.thv run,thv buildandthv-proxyrunnerstill pass unknown flags through to the MCP server.Type of change
Test plan
task test)task test-e2e)task lint-fix)Manual testing: built
thvwithtask buildand compared it with a build that uses pflag v1.0.10. Forthv runandthv build, unknown flags (--bogus-flag some-value,--bogus=1, flags after the server name, and flags after--) produce the same output on both builds.thv list --bogus-flagstill fails with "unknown flag".thv run --helpshows the new[=true|false]form. Unit tests and lint are left to CI.Does this introduce a user-facing change?
Yes, help output only:
thv run --helplists bool flags as--debugand--isolate-network.--debug[=true|false]and--isolate-network[=true|false], in every command's help.Flag behavior is unchanged. Bad values for typed flags, such as a non-integer given to an int flag, now use pflag v1.1.0's error wording (spf13/pflag#469). Nothing in the repo matches on that text.
Special notes for reviewers
docs/cli/are generated. After removing[=true|false]and collapsing spaces, each old and new file pair is identical, so the diff is formatting only.go.modandgo.sumchange only forpflag. Thegodirective is unchanged.