You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 Support multiline continue messages in /compact (#255)
## Overview
Refactor `/compact` command to support multiline continue messages.
Everything after the first line becomes the continue message, making it
much more ergonomic than the old `-c "message"` syntax.
**Old syntax (still works for backwards compat):**
```
/compact -c "Continue implementing auth"
```
**New syntax:**
```
/compact
Continue implementing the auth system.
Make sure to add tests for edge cases.
```
## Changes
### Parser Infrastructure
- Added `rawInput` field to `SlashCommandHandlerArgs` to pass raw input
with newlines preserved
- Updated parser to extract raw input after command name, preserving
newlines
- Only trim leading spaces on first line, not newlines
### Compact Command Handler
- Parse multiline continue messages from lines after the first line
- Prioritize `-c` flag if present (backwards compatibility)
- Otherwise use multiline content as continue message
### Tests
- Added 9 new test cases for multiline parsing:
- Basic multiline continue message
- Multiline with `-t` flag
- Multiple lines preservation
- Empty lines handling
- Whitespace preservation
- `-c` flag takes precedence (backwards compat)
- Trailing newline handling
- All 23 tests passing
### Documentation
- Updated `docs/context-management.md` with multiline syntax examples
- Updated `docs/prompting-tips.md` to show multiline usage
- Removed `-c` flag from documented syntax (but it still works)
## Benefits
1. **Ergonomics**: Much easier to type natural language without
quotes/escaping
2. **Readability**: Multiline messages are easier to read and edit
3. **Consistency**: Follows natural "command on first line, args below"
pattern
4. **Backwards compatible**: `-c` flag still works (just undocumented)
## Testing
- ✅ All unit tests passing (511 pass)
- ✅ TypeScript compilation passes
- ✅ Linting passes
- ✅ 9 new test cases for multiline parsing
## Files Changed
- `src/utils/slashCommands/types.ts` - Add rawInput to handler args
- `src/utils/slashCommands/parser.ts` - Pass rawInput to handlers
- `src/utils/slashCommands/registry.ts` - Update compact handler
- `src/utils/slashCommands/compact.test.ts` - Add multiline tests
- `docs/context-management.md` - Update syntax and examples
- `docs/prompting-tips.md` - Update examples
**Net change:** +132 lines / -21 lines = +111 lines
_Generated with `cmux`_
"Compact conversation history using AI summarization. Use -t <tokens> to set max output tokens, -c <message> to continue with custom prompt after compaction",
0 commit comments