Commit 2d7cee3
dalbee
Preserve double-digit command placeholders
Command templates replace numbered placeholders with literal string replacement. Replacing in ascending order lets short placeholders such as $1 consume the prefix of $10 before the intended replacement runs, so templates with double-digit placeholders produce corrupted output.
Constraint: Keep existing last-placeholder-captures-rest behavior unchanged
Rejected: Regex replacement rewrite | larger change than needed for the prefix-collision bug
Confidence: high
Scope-risk: narrow
Directive: Preserve descending replacement unless the placeholder parser is replaced with token-aware substitution
Tested: Docker rust:latest cargo test -p cortex-commands test_substitute_two_digit_placeholders_before_prefixes -- --nocapture
Tested: Docker rust:latest cargo test -p cortex-commands substitute -- --nocapture
Tested: Docker rust:latest cargo check -p cortex-commands
Tested: Docker rust:latest cargo fmt --check --package cortex-commands
Tested: git diff --check1 parent 7954d02 commit 2d7cee3
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
| 212 | + | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
377 | 388 | | |
378 | 389 | | |
379 | 390 | | |
| |||
0 commit comments