โก Slash Commands
Slash commands provide command-based interactions with DAIV directly from issues and merge/pull requests. They are useful for common tasks and information requests.
Slash commands vs. direct mentions
DAIV responds to two types of interactions:
| Interaction Type | Format | Use Case |
|---|---|---|
| Slash Commands | @daiv /command |
Execute specific commands (get help, clone issues) |
| Direct Mentions | @daiv <request> |
Address code review comments, ask questions, request code changes |
To address code review comments, use a direct mention without a slash command. See Review Addressor for details and examples.
Overview
Slash commands are triggered by mentioning DAIV with specific commands in issue or merge/pull request comments.
How slash commands work
Command Format: @<daiv-username> /<command> [arguments]
Supported Scopes:
- Issues: Available in issue comments and discussions
- Merge/Pull Requests: Available in merge/pull request comments and discussions
Command Parsing:
Slash commands use shell-like parsing with support for:
- Simple commands:
@daiv /help - Commands with arguments:
@daiv /clone-to-topic backend, api - Case-insensitive:
@DAIV /HELPworks the same as@daiv /help
Workflow
graph TD
A["๐ค User"] --> B["๐ฌ Comments with @daiv<br/>(e.g., '@daiv /help')"]
B --> C["๐ Comment Webhook"]
C --> D["๐ Slash Command Parser<br/>(extracts command and args)"]
D --> E["๐ Registry Lookup<br/>(finds matching command)"]
E --> F["โ
Command Found?"]
F -->|Yes| G["โก Execute Command"]
F -->|No| H["โ Unknown Command Error"]
G --> I["๐ Validate Scope<br/>(Issue vs Merge/Pull Request)"]
I --> J["๐ ๏ธ Execute Specific Logic"]
J --> K["๐ Help Command<br/>(show available commands)"]
J --> L["๐งน Clear Command<br/>(reset conversation)"]
J --> R["๐ค Clone to Topic<br/>(clone issue to repos)"]
K --> N["๐ฌ Posts Help Message"]
L --> O["๐๏ธ Deletes Thread<br/>(clears context)"]
R --> S["๐ Creates Issues in<br/>Matching Repositories"]
H --> Q["๐ฌ Posts Error Message<br/>(suggests valid commands)"]
style B fill:#e1f5fe
style E fill:#fff3e0
style G fill:#e8f5e8
style H fill:#ffebee
Basic usage
- Navigate to any issue or merge/pull request
- Add a comment mentioning DAIV with the desired command
- Submit the comment
- DAIV responds with the command result
Available slash commands
๐ Help command
Command: /help
Purpose: Displays all available slash commands for the current scope (issue or merge/pull request).
Scopes: Issues, Merge/Pull Requests
Example:
| Text Only | |
|---|---|
Response: DAIV replies with a formatted list of all available slash commands and their descriptions.
๐งน Clear command
Command: /clear
Purpose: Clear the conversation context and start a fresh conversation with DAIV.
Scopes: Issues, Merge/Pull Requests
Usage: When you want to reset the conversation history and start fresh, use this command. This deletes the thread associated with the current issue or merge request, effectively clearing DAIV's memory of the conversation.
Example:
| Text Only | |
|---|---|
Response: DAIV replies with a confirmation that the context has been cleared successfully.
Behavior:
- Deletes the conversation thread for the current issue or merge request
- Clears all conversation history and context
- Allows starting a new conversation from scratch
- Useful when previous context is no longer relevant or causing confusion
๐ค Clone to topic command
Command: /clone-to-topic <topics>
Purpose: Clone the current issue to all repositories matching the specified topics.
Scopes: Issues only
Arguments: Comma-separated list of topics to match repositories against.
Usage: Leave a comment specifying the topics, and DAIV will create a copy of the issue in every matching repository (excluding the current one).
Example:
| Text Only | |
|---|---|
Response: DAIV replies with a summary of the cloned issues, including links to each new issue created.
Behavior:
- Searches for repositories that have all the specified topics
- Excludes the current repository from the target list
- Copies the issue title, description, and labels to each target repository
- Reports how many issues were successfully created and lists them
Troubleshooting
Common issues
Command not recognized:
- Check that the command supports the current scope (issue vs merge/pull request)
- Ensure proper spelling and case (commands are case-insensitive)
- Verify command syntax (e.g.,
/helpnot/Help)
No response from DAIV:
- Confirm DAIV has access to the repository
- Check that webhooks are properly configured
- Verify the bot username is correct in the mention
Permission errors:
- Ensure DAIV has sufficient repository permissions
- Confirm the user triggering the command has appropriate access levels
Pipeline command issues:
- Ensure the pipeline is in "failed" status
- Check that failed jobs have
script_failureas the failure reason - Verify jobs are not marked as
allow_failure
Clone to topic command issues:
- Ensure you provide at least one topic
- Check that target repositories have the specified topics configured
- Verify DAIV has access to the target repositories
- Confirm the current repository is not the only one matching the topics
Debug information
Slash commands log detailed information for troubleshooting:
- Command parsing results
- Registry lookup attempts
- Execution success/failure
- Error details and stack traces
Examples
Getting help
| Text Only | |
|---|---|
Response:
Cloning an issue to multiple repositories
| Text Only | |
|---|---|
Response:
| Text Only | |
|---|---|
Extension and development
Adding new commands
- Create new command class in
slash_commands/actions/ - Implement required methods
execute_action_for_issue,execute_action_for_merge_request, andexecute_for_agent - Decorate with
@slash_commandspecifying command and scopes - Import in the actions module
- Test the command in development environment
Best practices
- Keep commands simple: Slash commands should execute immediately
- Provide clear descriptions: Help users understand what each command does
- Handle errors gracefully: Post user-friendly error messages
- Use appropriate scopes: Only enable commands where they make sense
- Follow naming conventions: Use clear, descriptive command names