cmd command group (also accessible as command or commands) allows you to execute and manage custom commands defined in your Forge configuration.
Usage
Subcommands
list
List all available custom commands.Shows only custom commands (excludes built-in commands).
Output in machine-readable format.
Conversation ID to execute the command within.Alias:
--cidexecute
Execute a custom command.Name of the custom command to execute, followed by any arguments.
Conversation ID to execute the command within.Alias:
--cidOutput in machine-readable format.
Examples
List All Commands
List Custom Commands Only
Execute a Command
Execute with Arguments
Execute with Multiple Arguments
Alternative Commands
You can use various aliases:list command:
Defining Custom Commands
Custom commands are defined in your Forge configuration file.User-Level Commands
Define global commands in~/.config/forge/commands.yaml:
Project-Level Commands
Define project-specific commands in./.forge/commands.yaml:
Command Scripts
Custom command scripts:- Run in your shell environment
- Have access to command arguments via
$1,$2, etc. - Can use any shell commands or scripts
- Support multi-line scripts
- Can return exit codes
Example Command with Arguments
Machine-Readable Output
Related Commands
forge list command- Alternative way to list commandsforge suggest <PROMPT>- Get AI-generated command suggestions
Notes
- Project-level commands take precedence over user-level commands
- Commands run in your current shell environment
- Use
--customto filter out built-in commands - Commands can accept multiple arguments
- Exit codes from scripts are preserved
- Scripts have access to all environment variables