Commit 8600660
authored
🤖 Fix /compact multiline parsing bug (#268)
## Problem
Multiline content after the `/compact` command was being incorrectly
parsed as flags, causing rejection or unexpected behavior.
**Example of bug:**
```
/compact
-t should be treated as message content
```
This would error with: `-t requires a positive number, got should`
instead of treating the entire line as the continue message.
## Root Cause
The parser was tokenizing the entire input (including content after
newlines) and passing all tokens to minimist for flag parsing. This
meant any text after a newline that looked like a flag (e.g., `-t`,
`-c`, `--anything`) would be interpreted as a flag instead of message
content.
## Solution
Changed the `/compact` handler to:
1. Split `rawInput` at the first newline
2. Tokenize **only** the first line for flag parsing
3. Use remaining lines (after first newline) as multiline continue
message
This ensures content after newlines is never interpreted as flags.
## Testing
**New test cases added:**
- Multiline content starting with flag-like text (`-t`, `-c`)
- Combination of flags on first line + flag-like text in multiline
content
**All existing tests pass** (25/25 slash command tests, 537 total tests)
_Generated with `cmux`_1 parent f95eed3 commit 8600660
2 files changed
+30
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
217 | 236 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
184 | 190 | | |
185 | | - | |
| 191 | + | |
186 | 192 | | |
187 | 193 | | |
188 | 194 | | |
| |||
193 | 199 | | |
194 | 200 | | |
195 | 201 | | |
196 | | - | |
197 | | - | |
| 202 | + | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
| |||
0 commit comments