Skip to content

Honor hidden: true for subcommands in generated help#93

Merged
AgentEnder merged 3 commits intomainfrom
copilot/fix-hidden-subcommands-rendering
Apr 22, 2026
Merged

Honor hidden: true for subcommands in generated help#93
AgentEnder merged 3 commits intomainfrom
copilot/fix-hidden-subcommands-rendering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Help output currently respects hidden for options but still lists hidden subcommands. This change aligns command help behavior with existing hidden semantics so internal/experimental commands are not surfaced in user-facing help.

  • Help rendering now filters hidden subcommands

    • Updated command listing logic in formatHelp() to only include subcommands where configuration.hidden !== true.
    • Preserved de-duplication behavior for aliased command entries while applying visibility filtering.
  • Commands section and command-help footer are visibility-aware

    • Commands: is rendered only when at least one visible subcommand exists.
    • Run \... [command] --help`` footer is omitted when no visible subcommands are available.
  • Focused regression coverage

    • Added tests for:
      • mixed visible + hidden subcommands (hidden command is omitted),
      • all-hidden subcommands (no Commands: block and no command-help footer).
await cli('test')
  .command('visible', { handler: () => {} })
  .command('secret', { hidden: true, handler: () => {} })
  .forge(['--help']);

// Help now lists only "visible"

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/prod-north-america/66c6330b3cc96d3e7872ab8d/a4d68412-7db5-4a40-91b5-65235829c83a-logs
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js run cli-forge:build (http block)
  • https://storage.googleapis.com/prod-north-america/66c6330b3cc96d3e7872ab8d/bfefc345-f65f-4063-9f53-8553efcfeab0
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js run cli-forge:test -- src/lib/internal-cli.spec.ts (http block)
  • https://storage.googleapis.com/prod-north-america/66c6330b3cc96d3e7872ab8d/bfefc345-f65f-4063-9f53-8553efcfeab0-logs
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js run cli-forge:test -- src/lib/internal-cli.spec.ts (http block)
  • https://storage.googleapis.com/prod-north-america/66c6330b3cc96d3e7872ab8d/c9467a59-20f8-4baf-9374-029d0ef54697
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js run cli-forge:test (http block)
  • https://storage.googleapis.com/prod-north-america/66c6330b3cc96d3e7872ab8d/f037dfa1-ba07-4e2d-882a-1529ed88e0fc
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js run-many -t lint:eslint,build,test -p cli-forge (http block)
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js run cli-forge:build (http block)
  • www.google-analytics.com
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js show project parser (dns block)
    • Triggering command: /usr/local/bin/node node ./node_modules/.bin/../nx/bin/nx.js show project cli-forge (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/cli-forge/cli-forge/node_modules/.pnpm/nx@22.6.3_@swc-node+register@1.11.1_@swc+core@1.15.8_@swc+helpers@0.5.18__@swc+types@0._08fcaebe47e144ae1496eaa205fa2254/node_modules/nx/src/project-graph/plugins/isolation/plugin-worker /tmp/plugin4396-2-324.592435.sock /home/REDACTED/work/cli-forge/cli-forge/node_modules/.pnpm/nx@22.6.3_@swc-node+register@1.11.1_@swc+core@1.15.8_@swc+helpers@0.5.18__@swc+types@0._08fcaebe47e144ae1496eaa205fa2254/node_modules/nx/src/plugins/project-json/build-nodes/project-json (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 22, 2026

View your CI Pipeline Execution ↗ for commit d373526

Command Status Duration Result
nx run-many -t build test e2e lint ✅ Succeeded 5m 36s View ↗
nx build docs-site ✅ Succeeded 59s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-22 17:58:03 UTC

Copilot AI changed the title [WIP] Fix hidden subcommands rendering in help text Honor hidden: true for subcommands in generated help Apr 22, 2026
Copilot AI requested a review from AgentEnder April 22, 2026 13:11
@AgentEnder
Copy link
Copy Markdown
Owner

@copilot validate that generated docs and autocomplete also obey this. We should probably add a .hidden() method to the CLI class for composition

@AgentEnder
Copy link
Copy Markdown
Owner

@copilot validate that generated docs and autocomplete also obey this. We should probably add a .hidden() method to the CLI class for composition

@copilot you there?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

Docs Preview: https://craigory.dev/cli-forge/pr/93/

Deployed commit: d373526 (d373526)

github-actions Bot added a commit that referenced this pull request Apr 22, 2026
Adds a fluent setter on the CLI interface that marks a command as hidden
from help output, generated docs, and shell completion. Writes through
to `configuration.hidden`, the same field the existing `hidden: true`
command option sets — so all three readers (format-help, documentation,
resolve-completions) honor it without further changes.

The method is most useful when composing a sub-CLI standalone and then
registering it via `.command(subCli)`. For the in-builder case, prefer
`hidden: true` in the command options object: child builders run lazily
and don't execute when the parent renders --help, so a `.hidden()` call
inside the child's builder cannot affect the parent's listing.
github-actions Bot added a commit that referenced this pull request Apr 22, 2026
@AgentEnder AgentEnder marked this pull request as ready for review April 22, 2026 18:10
@AgentEnder AgentEnder merged commit 181b332 into main Apr 22, 2026
4 checks passed
@AgentEnder AgentEnder deleted the copilot/fix-hidden-subcommands-rendering branch April 22, 2026 18:11
github-actions Bot added a commit that referenced this pull request Apr 22, 2026
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.

honor hidden: true for subcommands

2 participants