Commit 511ce5a
Add named parameter support to slash commands (#128)
* Initial plan
* Add named parameter support to slash commands
Extended slash command parsing to support named parameters in key="value" format
alongside existing positional parameters. Named parameters can be mixed with
positional arguments and do not count toward positional numbering.
Examples:
- /fix-bug issue="PROJ-123" -> ${issue} = "PROJ-123"
- /task arg1 key="value" arg2 -> ${1}="arg1", ${2}="arg2", ${key}="value"
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Fix review comments: clarify parseNamedParam documentation
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Fix: Named parameters now count toward positional numbering
Updated slash command parsing so that named parameters (key="value") are also
included as positional arguments in their original form. This addresses the
feedback that `/task arg1 issue="PROJ-123" arg2` should result in:
- ${1} = arg1
- ${2} = issue="PROJ-123"
- ${3} = arg2
- ${issue} = PROJ-123
Also added protections:
- Reserved key ARGUMENTS cannot be used as a named parameter key
- Numeric keys (1, 2, etc.) cannot be used as named parameter keys
- Duplicate named parameter keys: last value wins (documented behavior)
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Make double quotes mandatory for named parameters
Per @alexec's feedback, named parameters now require mandatory double quotes.
- Unquoted values like `key=value` are treated as positional arguments
- Single-quoted values like `key='value'` are also treated as positional arguments
- Only `key="value"` format is recognized as a named parameter
Updated parseNamedParamWithQuotes to validate double quote requirement.
Added tests for unquoted and single-quoted edge cases.
Updated documentation to clarify mandatory double quotes.
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Simplify numeric key check using strconv.Atoi
Replaced manual character-by-character numeric check with strconv.Atoi
for cleaner, more idiomatic Go code.
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Simplify parseBashArgsWithNamed to return map[string]string
Changed return type from ([]string, map[string]string, error) to
(map[string]string, error). The map now contains both positional keys
("1", "2", "3", etc.) and named parameter keys, eliminating the need
for a separate allArgs slice.
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
* Remove protection for reserved keys (ARGUMENTS, numeric keys)
Per @alexec's feedback, removed the validation that prevented named
parameters from using ARGUMENTS or numeric keys. Users would have to
misuse the system greatly for this to cause problems.
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: Alex Collins <alexec@users.noreply.github.com>1 parent 2911b09 commit 511ce5a
File tree
3 files changed
+346
-15
lines changed- docs/reference
- pkg/codingcontext
3 files changed
+346
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
399 | 423 | | |
400 | 424 | | |
401 | 425 | | |
| |||
429 | 453 | | |
430 | 454 | | |
431 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
432 | 493 | | |
433 | 494 | | |
434 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | | - | |
| 38 | + | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
| |||
79 | 87 | | |
80 | 88 | | |
81 | 89 | | |
82 | | - | |
83 | | - | |
| 90 | + | |
| 91 | + | |
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
91 | 99 | | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
96 | | - | |
97 | | - | |
98 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
99 | 112 | | |
| 113 | + | |
100 | 114 | | |
101 | 115 | | |
102 | 116 | | |
| |||
107 | 121 | | |
108 | 122 | | |
109 | 123 | | |
| 124 | + | |
110 | 125 | | |
111 | 126 | | |
112 | 127 | | |
113 | 128 | | |
114 | 129 | | |
115 | 130 | | |
116 | 131 | | |
| 132 | + | |
117 | 133 | | |
118 | 134 | | |
119 | 135 | | |
| |||
122 | 138 | | |
123 | 139 | | |
124 | 140 | | |
| 141 | + | |
125 | 142 | | |
126 | 143 | | |
127 | 144 | | |
128 | 145 | | |
129 | 146 | | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
133 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
134 | 166 | | |
| 167 | + | |
135 | 168 | | |
136 | 169 | | |
137 | 170 | | |
138 | 171 | | |
139 | 172 | | |
| 173 | + | |
140 | 174 | | |
141 | 175 | | |
142 | 176 | | |
143 | 177 | | |
144 | 178 | | |
145 | 179 | | |
146 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
147 | 193 | | |
148 | 194 | | |
149 | 195 | | |
150 | 196 | | |
151 | 197 | | |
152 | 198 | | |
153 | 199 | | |
154 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
155 | 246 | | |
0 commit comments