Skip to content

feat: Add Command.withHidden to hide subcommands from help and completions#3

Open
avallete wants to merge 7 commits into
mainfrom
claude/add-hidden-command-primitive
Open

feat: Add Command.withHidden to hide subcommands from help and completions#3
avallete wants to merge 7 commits into
mainfrom
claude/add-hidden-command-primitive

Conversation

@avallete
Copy link
Copy Markdown
Member

Summary

Adds a new Command.withHidden combinator that allows subcommands to be hidden from help output, shell completions, and "did you mean?" suggestions while remaining fully invocable by exact name. This is useful for experimental or internal subcommands that should be accepted but not advertised on the public CLI surface.

Key Changes

  • New withHidden combinator: Added Command.withHidden to mark subcommands as hidden
  • Command interface update: Added hidden: boolean property to the Command interface and implementation
  • Help output filtering: Modified help text generation to exclude hidden subcommands and omit the <subcommand> usage hint when all subcommands are hidden
  • Parser improvements: Updated unknown subcommand suggestions to exclude hidden commands, preventing typo suggestions from revealing hidden command names
  • Shell completions: Modified completion descriptor generation to skip hidden subcommands
  • Comprehensive tests: Added four test cases covering:
    • Hidden subcommands don't appear in help output
    • Hidden subcommands still parse and execute when invoked by exact name
    • Hidden subcommand names don't leak through "did you mean?" suggestions
    • Subcommand groups with only hidden commands disappear entirely from help

Implementation Details

  • Hidden subcommands are filtered at the help rendering stage, not at the parsing stage, ensuring they remain fully functional when invoked directly
  • The implementation maintains backward compatibility by defaulting hidden to false
  • When all subcommands in a group are hidden, the entire group heading is omitted from help output
  • Hidden commands are excluded from shell completion suggestions to maintain consistency with help output

https://claude.ai/code/session_01Eurf2SqBb8vNgcCiqLaokP

gcanti and others added 6 commits May 18, 2026 17:53
…directly with `asserts(schema, input)` and remove `Schema.Codec.ToAsserts` (Effect-TS#2221)
Co-authored-by: Tim Smart <hello@timsmart.co>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@avallete avallete changed the title Add Command.withHidden to hide subcommands from help and completions feat: Add Command.withHidden to hide subcommands from help and completions May 19, 2026
…ompletions

Adds `Command.withHidden` so subcommands can be invoked by exact name while
being omitted from the parent's `SUBCOMMANDS` help section, shell completion
scripts, and "did you mean?" suggestions on unknown-subcommand typos.

Mirrors the `Flag.withHidden` primitive for the subcommand surface. Useful
for experimental or internal subcommands that should parse normally but not
yet appear on the public CLI surface.

When every subcommand in a group is hidden the group heading is dropped and
the `<subcommand>` token is stripped from the usage line so the parent reads
as a leaf command.
@avallete avallete force-pushed the claude/add-hidden-command-primitive branch from a5aafb1 to ba511ea Compare May 19, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants