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

@@ -263,6 +263,84 @@ class TestMetrics:
assert summary["requests"]["success"] == 1
class TestHelpCommand:
"""Test help command functionality."""
def test_help_command_returns_text(self):
"""Test that help command returns formatted help text."""
from agents.issue_agent import IssueAgent
agent = IssueAgent(
gitea_client=None,
llm_client=None,
config={
"interaction": {
"mention_prefix": "@codebot",
"commands": ["help", "triage", "explain"],
}
},
)
help_text = agent._command_help()
assert help_text is not None
assert len(help_text) > 100
assert "@codebot" in help_text
assert "help" in help_text.lower()
assert "triage" in help_text.lower()
def test_help_includes_all_sections(self):
"""Test that help text includes all major sections."""
from agents.issue_agent import IssueAgent
agent = IssueAgent(
gitea_client=None,
llm_client=None,
config={"interaction": {"mention_prefix": "@codebot"}},
)
help_text = agent._command_help()
# Check for main sections
assert "Issue Triage" in help_text
assert "Interactive Chat" in help_text
assert "Setup & Utility" in help_text
assert "Pull Request" in help_text
assert "Quick Examples" in help_text
def test_help_uses_custom_bot_name(self):
"""Test that help command uses custom bot name from config."""
from agents.issue_agent import IssueAgent
agent = IssueAgent(
gitea_client=None,
llm_client=None,
config={"interaction": {"mention_prefix": "@mybot"}},
)
help_text = agent._command_help()
assert "@mybot" in help_text
assert "@codebot" not in help_text
def test_help_includes_examples(self):
"""Test that help text includes usage examples."""
from agents.issue_agent import IssueAgent
agent = IssueAgent(
gitea_client=None,
llm_client=None,
config={"interaction": {"mention_prefix": "@codebot"}},
)
help_text = agent._command_help()
# Check for example commands
assert "triage" in help_text
assert "explain" in help_text
assert "setup-labels" in help_text
class TestLabelSetup:
"""Test label setup and schema detection."""