-
Notifications
You must be signed in to change notification settings - Fork 1
Add slash command substitution to codingcontext package #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Move slash command parsing from pkg/slashcommand to pkg/codingcontext - Add WithSlashCommand(bool) option to Context - Implement slash command substitution in Run() - Add tests for slash command functionality - Add --slash-command flag to CLI Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot Make it |
- Changed flag from --slash-command to -l for brevity - Removed conditional check - always reload task file even if same name - Updated documentation to reflect -l flag - Added clarification that slash params override existing params Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
- Use "Reloading" when slash command references same task - Use "Switching" when slash command references different task - Makes log messages more accurate and helpful Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot Remove the "WithSlackCommand" option and just default to true.. |
- Removed slashCommand field from Context struct - Removed WithSlashCommand option function - Removed -l flag from CLI - Slash command parsing now always enabled by default - Updated tests to remove slashCommandEnabled parameter - Updated documentation to reflect always-on behavior Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
- Changed from merging to complete replacement of parameters - When slash command is found, both task name and parameters are replaced - Removed parameter override logging (no longer relevant) - Added test case to verify complete parameter replacement - Updated documentation to clarify full replacement behavior Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot Try again |
- Allows slash commands in parameter values (free-text use case) - Expand task content with parameters first, then parse for slash commands - Added test case for slash command in parameter value - Enables use case: free-text task with text="/fix-bug PROJ-123" Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
- Extracted parameter expansion to expandParams helper method - Removed duplicate my-task.md creation in tests - Improved code maintainability Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
- Explains why parameters are expanded twice - First for slash command detection, second for final output - Task content may differ between expansions if slash command found Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot We should support "/taskname" |
- Tests confirm slash commands work with patterns like ". /taskname" - Already supported by existing implementation - Added explicit test cases for documentation and regression testing Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot What about if there are no arguments and the end of the taskname is the end of the string? |
Already handled correctly. When no whitespace is found after the slash (line 50-53 in slashcommand.go), the entire remaining string becomes the task name with empty params. Existing tests cover this: |
|
@copilot fetch main and resolve conflicts. |
- Resolved conflicts in main.go (kept both -a and -t flags) - Resolved conflicts in context_test.go (kept both TestSlashCommandSubstitution and TestTargetAgentIntegration) - All tests passing Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Head branch was pushed to by a user without write access
Move slash command code into main package ✅
Summary
Successfully implemented slash command functionality in the main
codingcontextpackage. Slash command parsing is always enabled - no flag needed. When a task contains a slash command (even in parameter values or with leading formatting), it fully replaces both the task name and all parameters.All Tasks Complete ✅
pkg/slashcommandtopkg/codingcontext. /tasknameHow It Works
Basic slash command:
Free-text use case (slash command in parameter value):
Slash command with leading formatting (markdown, bullet points, etc.):
The slash command fully replaces both the task name and ALL parameters!
Final Testing Results
✅ All unit tests passing (16 test cases including slash command and agent tests)
✅ All integration tests passing
✅ Linting passing with no errors
✅ Manual testing verified all scenarios including
. /tasknamepatterns✅ Code review feedback fully addressed
✅ Merged with main branch successfully
✅ Security scan - no vulnerabilities found
Backward Compatibility
The original
pkg/slashcommandpackage remains unchanged for backward compatibility. Slash commands now work automatically with:-aand-tflags coexist)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.