Repository navigation
fix: honor --json and --api-url after subcommands, and report the real version - #10
Merged
Merged
Conversation
…l version The root program parses --json and --api-url wherever they appear, so the subcommand never saw them: --json was ignored in a terminal and --api-url was ignored by every command except login. A preAction hook now passes both to the command that runs. The npm build never defined __CLI_VERSION__, so `sevalla --version` printed 0.0.0-dev. tsup now defines it from package.json, and the release builds on prepack so the published bundle carries the bumped version.
kristofdombi
approved these changes
Oct 18, 2026
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
Fixes three bugs in 1.10.1:
--jsonhad no effect in a terminal.sevalla apps list --jsonprinted the spinner and a table when stdout was a TTY. Piped output was JSON either way.--api-urlwas ignored by every command exceptlogin. Requests went toSEVALLA_API_URL, or the default URL, whether the flag came before or after the subcommand.sevalla --versionprinted0.0.0-devfor npm installs.Cause and fix
--jsonand--api-urlare defined on the root program. Commander parses root options anywhere in argv, so the root consumed them and the subcommand's own options never received the values. ApreActionhook on the root now passes both to the command that runs. This covers every command, generated or hand-written, without changing each one.__CLI_VERSION__was only defined for the standalone binaries (bun build --define). The npm build never defined it and fell back to0.0.0-dev.tsup.config.tsnow defines it frompackage.json.prepack:npm publishtriggers it after the bump. The standalone pre-release build step is removed.Tests
tests/unit/program.test.ts):--jsonand--api-urlgiven before and after the subcommand reach the action;jsonstays off by default.tests/e2e/tests/common.test.ts):sevalla --versionmatches thepackage.jsonversion.apps list --jsonprints JSON when stdout is a terminal.--api-url, in either position, routes requests to the given URL even whenSEVALLA_API_URLpoints elsewhere.