fix(cli): exit 0 for bare group commands to match Go cobra parity#5827
Merged
Coly010 merged 1 commit intoJul 8, 2026
Conversation
Invoking a legacy-shell group command with subcommands but no subcommand and no --help (e.g. `supabase branches`, `supabase completion`) exited 1. Go's cobra CLI exits 0 for the identical invocation: a non-Runnable command with no RunE returns flag.ErrHelp internally, which ExecuteC() maps to "print help, return nil error". CliError.ShowHelp already declares the correct exit code via Effect's own Runtime.errorExitCode marker (0 for a clean ShowHelp with no errors, 1 otherwise), so run.ts now delegates to Runtime.getErrorExitCode(Cause.squash(cause)) instead of hand-rolling ShowHelp classification. Fixes CLI-1906
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Contributor
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@48b09a2675cc5a23847c91599bab96b5ac5191c9Preview package for commit |
jgoux
approved these changes
Jul 8, 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.
What changed
Invoking a legacy-shell group command that has subcommands but is itself not runnable — e.g.
supabase branches,supabase completion— with no subcommand and no--helpexited 1 in the TS legacy shell. Go's cobra CLI exits 0 for the identical invocation: a non-Runnable()command with noRunEinternally returnsflag.ErrHelp, which cobra'sExecuteC()maps to "print help, return nil error". Only explicit--helpgot exit 0 before this fix; the bare/missing-subcommand form did not, even though the printed help text was identical in both cases.CliError.ShowHelp(ineffect/unstable/cli) already declares the correct exit code via Effect's ownRuntime.errorExitCodemarker (0for a cleanShowHelpwith no errors,1otherwise) —apps/cli/src/shared/cli/run.tsnow delegates toRuntime.getErrorExitCode(Cause.squash(cause))instead of hand-rollingShowHelpclassification, which is simpler and tracks the library's own source of truth for any futureCliErroradditions.Also added an integration test driving the real
legacyBranchesCommandthroughCommand.runWith(confirming the actualShowHelpcause shape), and an e2e test asserting the real compiled-binary exit code, since this bug is specifically about the real OS process exit code.Known related (not fixed here)
A typo'd subcommand under a group (e.g.
supabase branches bogus) still exits 1 where Go cobra exits 0 for a non-root command — this is pre-existing ondevelop, not a regression from this change, and out of scope for this fix. Filed as a follow-up.Fixes CLI-1906