Skip to content

feat: add commands to list the command tree for easier discovery#1585

Open
developerkunal wants to merge 1 commit into
mainfrom
feat/commands-tree
Open

feat: add commands to list the command tree for easier discovery#1585
developerkunal wants to merge 1 commit into
mainfrom
feat/commands-tree

Conversation

@developerkunal

Copy link
Copy Markdown
Contributor

🔧 Changes

Adds a new top-level auth0 commands command that prints the entire CLI command tree along with a short description of what each command does. The goal is to make the whole command surface discoverable in a single place, so you (or an AI agent driving the CLI) can find the right command without inspecting each --help page individually.

It supports three output shapes:

  • Default — a nested tree with descriptions, easy to scan visually.
  • --flat — every runnable command on its own line as path — description, which is the easiest form to scan or match an intent against.
  • --json — a machine-readable representation. Combined with --detailed it also includes the usage line, positional arguments, local flags (name, shorthand, usage, type, default), aliases, and whether the command requires authentication, which is enough to construct a valid invocation programmatically.

Additional behavior:

  • Accepts an optional command path (for example auth0 commands apps or auth0 commands apps create) to scope the output to a single branch instead of the whole tree.
  • A --depth flag limits how many levels are shown.
  • The command does not require authentication, since it only introspects the local command tree.

The tree-walking logic runs only when auth0 commands is invoked, so there is no impact on the startup or runtime of any other command, and no new dependencies are introduced.

📚 References

N/A

🔬 Testing

  • Added unit tests in internal/cli/commands_test.go covering tree building, depth limiting, detailed output, flat output (including the scoped case), and positional argument extraction that correctly ignores flag values.
  • The full internal/cli test suite passes.
  • Regenerated the docs so docs/auth0_commands.md and the docs/index.md listing stay in sync with the new command.

Manual checks:

auth0 commands
auth0 commands --flat
auth0 commands apps
auth0 commands apps show --json --detailed

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

Add a top-level `auth0 commands` that prints the full command tree with
short descriptions, so the whole CLI surface can be discovered without
inspecting each --help page individually.

Supports three output shapes:
- default nested tree with descriptions
- --flat for one runnable command per line, ideal for scanning or intent matching
- --json (with optional --detailed) exposing usage, arguments, flags, aliases
  and whether authentication is required

Accepts an optional command path (e.g. `auth0 commands apps`) to scope the
output to a single branch, and a --depth flag to limit nesting.
@developerkunal developerkunal requested a review from a team as a code owner July 10, 2026 20:22
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.

1 participant