-
Notifications
You must be signed in to change notification settings - Fork 1
Add ParseSlashCommand for parsing AI assistant slash commands with bash-like arguments #102
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
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 What does OpenCode do for this? |
I researched OpenCode (now continued as Crush by Charm) but couldn't find specific documentation about their slash command format since the original opencode.ai/docs/commands/ URL is not accessible and the project has been archived. Based on the codebase, I can see this project already supports OpenCode's If you have specific documentation about OpenCode's slash command format or a different format you'd like me to follow, I'd be happy to adjust the implementation. |
|
@copilot The parser should extract the arguments as follows: $ARGUMENTS - the whole string |
|
@copilot you can remove support for the old key=vale syntax for parameters. |
Changed from key=value format to bash-like positional arguments: - Arguments now parsed like bash (quoted values with spaces supported) - Returns $ARGUMENTS (full arg string) and $1, $2, $3 (positional args) - Both single and double quotes supported - Escape sequences work in double quotes Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Updated the parser to use bash-like argument parsing. The function now returns:
Both single and double quotes are supported, and escape sequences work in double quotes. Commit: 138f60f |
Removed ParseParams and parseKeyValuePairs functions that are no longer needed. Kept Params type and Set/String methods which are still used by flag parsing. Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Implementation Plan for Slash Command Parser
Based on the feedback to parse arguments like Bash with
$ARGUMENTS,$1,$2,$3:pkg/slashcommanddirectory structureParseSlashCommandfunction with bash-like argument parsingImplementation Complete ✅
The parser now uses bash-like argument parsing:
/fix-bug 123→$ARGUMENTS="123",$1="123"/code-review "PR #42" high→$ARGUMENTS="\"PR #42\" high",$1="PR #42",$2="high"Features:
/task-name arg1 "arg 2" arg3$ARGUMENTSwith full argument string (quotes preserved)$1,$2,$3etc. as positional arguments (quotes removed)\")All tests pass successfully! The package is ready to use.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.