Fixes the issue where CLI crashes with rich.errors.MarkupError when printing error messages containing special characters like [ or ].
The CLI was using console.print() with formatted strings containing user-provided data that may include special characters. Rich tries to parse these as markup, causing crashes.
Added markup=False parameter to all console.print() calls that format user-provided data, preventing Rich from parsing the content as markup.
Modified trae_agent/cli.py:
- Added
markup=Falseto 11 console.print() calls that format user-provided data - Maintains all existing functionality and color formatting
Created test_markup_fix.py to reproduce and verify the fix:
- Demonstrates the original issue would fail with MarkupError
- Verifies the fixed version handles error messages with square brackets correctly
- Minimal code changes (only added
markup=Falseparameter) - Maintains backward compatibility
- Preserves color formatting while preventing markup parsing
- No breaking changes to existing functionality
- Run
python test_markup_fix.pyto see the original issue and the fix in action - The script will show that the fixed version handles error messages with square brackets correctly