Skip to content

feat: Add Flag.withHidden to hide flags from help output#2

Open
avallete wants to merge 10 commits into
mainfrom
claude/add-hidden-flag-primitive-OhGsi
Open

feat: Add Flag.withHidden to hide flags from help output#2
avallete wants to merge 10 commits into
mainfrom
claude/add-hidden-flag-primitive-OhGsi

Conversation

@avallete
Copy link
Copy Markdown
Member

Summary

Adds Flag.withHidden (and Param.withHidden) to hide flags from --help output and shell completions while keeping them fully parseable on the command line. This is useful for experimental, internal, or deprecated flags that should be accepted but not advertised.

Key Changes

  • Added hidden: boolean property to Param.Single interface
  • Implemented Param.withHidden combinator to mark parameters as hidden
  • Implemented Flag.withHidden as a convenience wrapper around Param.withHidden
  • Updated help text generation to skip hidden flags in help.ts
  • Updated command descriptor generation to exclude hidden flags from suggestions in command.ts
  • Updated shell completion descriptor generation to exclude hidden flags in descriptor.ts
  • Updated unrecognized flag error suggestions to exclude hidden flag names from suggestions in parser.ts
  • Added comprehensive test coverage for hidden flag behavior:
    • Hidden flags are excluded from help output
    • Hidden flags still parse correctly on the command line
    • Hidden flag names do not appear in unrecognized flag suggestions

Implementation Details

  • Hidden flags are filtered out at multiple points: help rendering, completions, and error suggestions
  • The hidden property defaults to false for backward compatibility
  • Hidden flags remain fully functional for parsing—they are only hidden from user-facing output
  • The implementation prevents information leakage of hidden flag names through error messages and suggestions

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 Flag.withHidden to hide flags from help output feat: Add Flag.withHidden to hide flags from help output May 19, 2026
claude added 4 commits May 19, 2026 02:51
Adds `Flag.withHidden` (and underlying `Param.withHidden`) so flags can
parse normally on the command line while being omitted from `--help`
output, shared/global flag listings, and shell completion descriptors.

This is useful for experimental, internal, or deprecated flags such as
`--experimental-foo`, debug toggles, or escape hatches that should be
accepted but not yet advertised on the public CLI surface.
…, drop unused FlagDoc.hidden

- Filter hidden flags from suggestion candidates in createUnrecognizedFlagError so a typo cannot leak a hidden flag name.
- Remove the unused `hidden` field from `HelpDoc.FlagDoc` — buildHelpDoc filters hidden flags out before constructing FlagDocs, so the field was dead weight on the public API surface.
- Add a regression test for the suggestion filter.
@avallete avallete force-pushed the claude/add-hidden-flag-primitive-OhGsi branch from a8526c6 to 06a4fd9 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