Basic Command Groups
Create a group usingdefineGroup:
packages/core/src/types.ts:102-107
Nested Groups
Groups can contain other groups:Inline Subcommands
Define subcommands directly in a command:packages/core/src/types.ts:82-84
Group Structure
Groups are commands without handlers:packages/core/src/types.ts:102-107
Practical Example: Git CLI
Let’s build a git tool with multiple commands: Source:examples/git-tool/
Multiple Top-Level Groups
Organize your CLI into feature areas:Group Aliases
Add shortcuts for groups:packages/core/src/types.ts:83
Command Path Resolution
Bunli finds the deepest matching command:packages/core/src/cli.ts:262-272
Help Output for Groups
Groups automatically show available subcommands:packages/core/src/cli.ts:399-407
Accessing Parent Context
Plugin context is available to all commands in a group:examples/dev-server/commands/start.ts:38-66
File Organization
Recommended structure for grouped commands:Dynamic Command Registration
Load commands dynamically:Testing Command Groups
Next Steps
Defining Commands
Learn the fundamentals of command creation
Working with Options
Master command options and validation
Type Generation
Automatic TypeScript types for nested commands
Building Binaries
Compile grouped commands to executables