Skip to content

Conversation

@heynemann
Copy link

@heynemann heynemann commented Nov 1, 2025

Idea from #523


This commit implements comprehensive slash command support similar to Claude Code, allowing users to create custom commands that can be invoked with \command-name syntax.

image image image

Key Features:

  • Slash command syntax using backslash prefix (\command-name) to avoid conflicts
  • Custom commands loaded from multiple locations with precedence:
    • Project: .crush/commands/
    • User home: ~/.crush/commands/
    • XDG config: $XDG_CONFIG_HOME/crush/commands/
  • YAML frontmatter support for command metadata:
    • description: Command description shown in help and completions
    • argument-hint: Hints for expected arguments (e.g., [arg1] [arg2])
    • allowed-tools: List of Crush tools allowed for this command
  • Argument parsing and substitution:
    • Supports $ARGUMENTS for all arguments
    • Supports positional arguments $1, $2, etc.
    • Automatic argument detection from argument-hint or content placeholders
    • Appends arguments to prompt when not all are referenced in content
  • File reference support using @filename syntax
  • Namespacing using directory structure (e.g., frontend:review-pr)
  • Built-in \help command listing all available commands
  • Fuzzy command completion with backslash trigger
  • Command reload via Ctrl+P "Reload Commands"
  • Comprehensive error handling and validation
  • Full test coverage with unit and integration tests

Implementation Details:

  • Command registry with loading, lookup, and reload functionality
  • Command executor integrating with agent coordinator
  • Tool filtering based on allowed-tools frontmatter
  • Markdown-formatted help output with purple command styling
  • Editor integration for command detection and execution
  • Session auto-creation when executing commands without active session

All commands are sorted lexicographically and grouped by namespace in help output. Commands can be reloaded without restarting the application.

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

This commit implements comprehensive slash command support similar to Claude Code,
allowing users to create custom commands that can be invoked with \command-name syntax.

Key Features:
- Slash command syntax using backslash prefix (\command-name) to avoid conflicts
- Custom commands loaded from multiple locations with precedence:
  * Project: .crush/commands/
  * User home: ~/.crush/commands/
  * XDG config: $XDG_CONFIG_HOME/crush/commands/
- YAML frontmatter support for command metadata:
  * description: Command description shown in help and completions
  * argument-hint: Hints for expected arguments (e.g., [arg1] [arg2])
  * allowed-tools: List of Crush tools allowed for this command
- Argument parsing and substitution:
  * Supports $ARGUMENTS for all arguments
  * Supports positional arguments $1, $2, etc.
  * Automatic argument detection from argument-hint or content placeholders
  * Appends arguments to prompt when not all are referenced in content
- File reference support using @filename syntax
- Namespacing using directory structure (e.g., frontend:review-pr)
- Built-in \help command listing all available commands
- Fuzzy command completion with backslash trigger
- Command reload via Ctrl+P "Reload Commands"
- Comprehensive error handling and validation
- Full test coverage with unit and integration tests

Implementation Details:
- Command registry with loading, lookup, and reload functionality
- Command executor integrating with agent coordinator
- Tool filtering based on allowed-tools frontmatter
- Markdown-formatted help output with purple command styling
- Editor integration for command detection and execution
- Session auto-creation when executing commands without active session

All commands are sorted lexicographically and grouped by namespace in help output.
Commands can be reloaded without restarting the application.
@charmcli
Copy link
Contributor

charmcli commented Nov 1, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@heynemann
Copy link
Author

I have read the Contributor License Agreement (CLA) and hereby sign the CLA.

@meowgorithm
Copy link
Member

Hi and thanks for the contribution! While we appreciate the effort here, we're going to close this on in favor of #1377 as it's simpler and more in-line with our current thinking.

Please note that with PRs for features we request that you chat with the core team (typically in a GitHub discussion or on Slack or Discord) prior to submitting the PR in order to make sure the feature aligns with the project direction.

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.

3 participants