Repository navigation
Description
What version of Effect is running?
4.0.0-beta.29
What steps can reproduce the bug?
Minimal Reproduction
import { Effect } from "effect"
import { Command, Flag } from "effect/unstable/cli"
const unsafe = Flag.boolean("unsafe").pipe(
Flag.withDescription("Allow unsafe operations"),
Flag.withDefault(false)
)
const command = Command.make("demo", { unsafe }, () => Effect.void)
command.pipe(
Command.run({ version: "0.0.0" })
)What is the expected behavior?
Summary
I'm using effect/unstable/cli to build a CLI, and I've run into a few related ergonomics issues around:
- positive boolean flags
- generated completion scripts
- built-in global flags like
--completionsand--log-level - lack of public extension points for fixing the above cleanly
The current behavior is workable, but in practice it pushes downstream CLIs toward brittle workarounds like post-processing completion scripts, deep-importing internal modules, or rewriting help text manually.
Problems
1. Boolean flags always imply negated forms, but there is no public control over that
With Flag.boolean("unsafe"), the CLI model and generated completions assume both:
--unsafe--no-unsafe
That is sometimes fine, but not always desirable.
There are two downstream cases where this becomes a problem:
- Some CLIs want to expose only the positive form in completions/help.
- Some flags are naturally positive booleans, but the generated negated form is noisy or confusing in shell completions.
- Negative public flag names become especially awkward. For example, a flag like
--no-validate-functionsnaturally leads to generated forms like--no-no-validate-functions.
In other words, downstream users currently cannot say:
- this is a boolean
- keep the positive flag
- but do not generate/show negated completion entries
- or use a custom negation name
2. Built-in global flags render opaque choice help instead of explicit values
For the built-in globals, help currently renders:
--completions choice--log-level choice
That is not very user-friendly. It would be much better if help showed explicit allowed values, e.g.:
--completions <bash|zsh|fish|sh>--log-level <all|trace|debug|info|warn|warning|error|fatal|none>
As far as I can tell, there is no public API to customize the help rows for these built-in flags.
3. There is no clean public way to customize completion generation
If a downstream CLI wants to:
- keep positive boolean flags
- avoid advertising unwanted negated forms in completions
- or customize built-in global flag UX
the available choices seem to be:
- accept the upstream output as-is
- recursively spawn the CLI and post-process the generated script
- deep-import internal completion modules
- patch help output at the formatter layer
All of these feel heavier or more brittle than they should be.
What do you see instead?
No response
Additional information
No response
Activity
MohanedMashaly commentedon Jun 11, 2026
Hi,
I know this issue was opened a long time ago, but still curious to know if this is still a concern or not,
For option 1, I would simply recommend using withDescription simply to avoid confusion for user + Prefering positive boolean flags to avoid confusion.
test(cli): cover negation collisions and PowerShell negation replay (#…