Skip to content

fix(agent): detect bold suggested slash commands#94

Merged
simongdavies merged 1 commit intomainfrom
fix/mcp-auth-command-suggestions
Apr 29, 2026
Merged

fix(agent): detect bold suggested slash commands#94
simongdavies merged 1 commit intomainfrom
fix/mcp-auth-command-suggestions

Conversation

@simongdavies
Copy link
Copy Markdown
Member

This pull request enhances the extraction and testing of actionable slash commands from assistant responses, particularly improving support for commands formatted with markdown emphasis. The changes refactor command cleaning logic, add support for bolded commands, and expand test coverage to ensure correct extraction in these scenarios.

Improvements to command extraction:

  • Added a cleanCommandCandidate helper function in command-suggestions.ts to consistently trim and remove markdown formatting from command candidates before processing.
  • Updated extractSuggestedCommands to support detection and extraction of commands wrapped in markdown bold (e.g., **/mcp enable ...**), and refactored code to use the new cleaning helper for all command patterns.

Testing enhancements:

  • Added new test cases in command-suggestions.test.ts to verify extraction of bolded commands, inline bold commands, and commands with wildcard arguments inside bold formatting.

Copilot AI review requested due to automatic review settings April 29, 2026 09:23
@simongdavies simongdavies added the enhancement New feature or request label Apr 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Hyperagent’s suggested slash-command extraction so the agent can detect actionable commands even when the assistant formats them with Markdown emphasis (notably bold), and adds tests to lock in the new behavior.

Changes:

  • Added a cleanCommandCandidate() helper to normalize command candidates by trimming and stripping leading/trailing Markdown markers.
  • Extended extractSuggestedCommands() to extract commands wrapped in Markdown bold (**...**) and refactored command insertion through a shared addCommand() path.
  • Expanded Vitest coverage with bold-command scenarios, including inline bold and wildcard-containing arguments.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/agent/command-suggestions.ts Adds candidate-normalization helper and bold-pattern extraction to improve robustness of suggested command parsing.
tests/command-suggestions.test.ts Adds regression tests covering bold-formatted commands and wildcard arguments inside bold.

@simongdavies simongdavies merged commit 391eec9 into main Apr 29, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants