Skip to content

Slash command parsing improvements - Single quote support#139

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/review-slash-command-parsing
Closed

Slash command parsing improvements - Single quote support#139
Copilot wants to merge 2 commits into
mainfrom
copilot/review-slash-command-parsing

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 6, 2025

Implements improved slash command parsing to handle common user errors, starting with single quote tolerance for named parameters.

Implementation Status

✅ Completed:

  • Single quote support - Accept both key="value" and key='value' for named parameters
    • Double quotes support escape sequences (existing behavior preserved)
    • Single quotes are literal with no escape processing (shell-like behavior)
    • Mixed quote types supported in single command

📋 Planned (Future PRs):

  • Unquoted simple values - Support key=value for alphanumeric + [-_.]
  • Comma delimiters - Treat , as whitespace outside quotes
  • Enhanced error messages - Suggest fixes when detecting common patterns
  • Spaces around equals - Support key = "value" format

Changes Made

Core Functionality

  • Modified parseNamedParamWithQuotes() to accept both single and double quotes
  • Preserved existing escape sequence handling for double quotes
  • Single quotes treated as literal values (no escape processing)

Test Coverage

  • Added 5 new comprehensive test cases for single quote scenarios
  • All 32 tests pass (27 original + 5 new)
  • 100% backwards compatible with existing behavior

Documentation

  • Updated CLI reference to document both quote types
  • Added examples showing single quote usage
  • Clarified differences between quote types

Example Impact

# Before
/task key='value'           # ❌ $1="key=value" (positional only)
/run msg='Hello World'      # ❌ $1="msg=Hello World" (positional only)

# After
/task key='value'           # ✅ $1="key='value'", $key="value"
/run msg='Hello World'      # ✅ $1="msg='Hello World'", $msg="Hello World"
/deploy env="prod" region='us-east'  # ✅ Mixed quotes work

# Existing syntax unchanged
/deploy env="production"    # ✅ Works identically before and after

Analysis Documents

Initial analysis documents created in /tmp/ (informational only):

  • executive-summary.md - Rankings, recommendations, risk assessment
  • implementation-plan.md - Technical implementation details
  • user-error-examples.txt - Concrete before/after examples

Testing

  • ✅ All 32 tests pass
  • ✅ Linter passes
  • ✅ Build succeeds
  • ✅ Fully backwards compatible
Original prompt

Review the slash command parsing. I think it is likely that users will make minor errors, such as using two spaces or commas between parameters, or forgetting to quote the parameters. Think of mistakes they might make. Don't make any changes yet, just a proposal.


💡 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.

Copilot AI changed the title [WIP] Review slash command parsing for user errors Slash command parsing review and improvement proposal Dec 6, 2025
Copilot AI requested a review from alexec December 6, 2025 17:25
@alexec
Copy link
Copy Markdown
Contributor

alexec commented Dec 6, 2025

@copilot Lets do this step-by-step. Please implement the quotes tolerance first.

- Modified parseNamedParamWithQuotes() to accept both single and double quotes
- Double quotes support escape sequences (existing behavior)
- Single quotes are literal (no escape processing)
- Added 5 new test cases covering various single quote scenarios
- Updated documentation to reflect new capability
- All 32 tests pass, backwards compatible

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 6, 2025

@copilot Lets do this step-by-step. Please implement the quotes tolerance first.

Implemented single quote support for named parameters in commit c006300.

Changes:

  • Both key="value" and key='value' now work as named parameters
  • Double quotes support escape sequences (existing behavior)
  • Single quotes are literal with no escape processing
  • Added 5 comprehensive test cases
  • Updated documentation

Examples now working:

/task msg='Hello World'              # $msg = "Hello World"
/deploy env="prod" region='us-east'  # Mixed quotes supported
/run path='C:\Users\test'            # Backslashes preserved

All tests pass and fully backwards compatible. Ready for the next step when you are.

Copilot AI changed the title Slash command parsing review and improvement proposal Slash command parsing improvements - Single quote support Dec 6, 2025
@alexec
Copy link
Copy Markdown
Contributor

alexec commented Dec 6, 2025

@copilot Don't mention the error tolerance in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants