feat: Add @codebot help command for instant discoverability
All checks were successful
Enterprise AI Code Review / ai-review (pull_request) Successful in 16s

Implements help command that shows all available bot commands with examples and categories.

Users can now type '@codebot help' to see complete command list without reading docs.
This commit is contained in:
2025-12-28 18:57:52 +00:00
parent c072d29781
commit 73d3dc6e37
5 changed files with 148 additions and 1 deletions

View File

@@ -380,7 +380,9 @@ class IssueAgent(BaseAgent):
title = issue.get("title", "")
body = issue.get("body", "")
if command == "summarize":
if command == "help":
return self._command_help()
elif command == "summarize":
return self._command_summarize(title, body)
elif command == "explain":
return self._command_explain(title, body)
@@ -445,6 +447,68 @@ Be practical and concise."""
except Exception as e:
return f"{self.AI_DISCLAIMER}\n\nSorry, I was unable to generate suggestions. Error: {e}"
def _command_help(self) -> str:
"""Generate help message with all available commands."""
mention_prefix = self.config.get("interaction", {}).get(
"mention_prefix", "@codebot"
)
help_text = f"""{self.AI_DISCLAIMER}
## Available {mention_prefix} Commands
### Issue Triage & Analysis
- `{mention_prefix} triage` - Full issue triage with auto-labeling and priority assignment
- `{mention_prefix} summarize` - Generate 2-3 sentence summary of the issue
- `{mention_prefix} explain` - Detailed explanation of what the issue is about
- `{mention_prefix} suggest` - Solution suggestions or next steps
- `{mention_prefix} security` - Security-focused analysis of the issue
### Interactive Chat
- `{mention_prefix} [question]` - Ask questions about the codebase (uses search & file reading tools)
- Example: `{mention_prefix} how does authentication work?`
- Example: `{mention_prefix} find all API endpoints`
### Setup & Utility
- `{mention_prefix} help` - Show this help message
- `{mention_prefix} setup-labels` - Auto-create/map repository labels for auto-labeling
### Pull Request Analysis
PR reviews run automatically when you open or update a pull request. The bot provides:
- Inline code review comments
- Security vulnerability scanning
- Approval or change-request recommendations
---
### Quick Examples
**Triage an issue:**
```
{mention_prefix} triage
```
**Get help understanding:**
```
{mention_prefix} explain
```
**Ask about the codebase:**
```
{mention_prefix} how does the authentication system work?
```
**Setup repository labels:**
```
{mention_prefix} setup-labels
```
---
*For full documentation, see the [README](https://github.com/YourOrg/OpenRabbit/blob/main/README.md)*
"""
return help_text
def _command_triage(self, context: AgentContext, issue: dict) -> str:
"""Perform full triage analysis on the issue."""
title = issue.get("title", "")

View File

@@ -59,6 +59,7 @@ interaction:
respond_to_mentions: true
mention_prefix: "@codebot" # Change this to customize your bot's name!
commands:
- help
- explain
- suggest
- security