Skip to content

feat(cli): Add markdown theming support for Reasoning box content - #4583

Merged
pandemicsyn merged 6 commits into
mainfrom
session/agent_0804969b-ef89-4c16-a3c6-c17b312f5142
Dec 22, 2025
Merged

feat(cli): Add markdown theming support for Reasoning box content#4583
pandemicsyn merged 6 commits into
mainfrom
session/agent_0804969b-ef89-4c16-a3c6-c17b312f5142

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR adds full theming support for markdown content inside the Reasoning box in the CLI.

Changes

1. Extended Theme Interface

  • Added section to the Theme interface with 8 color properties:
      • Main text color
      • Heading color
      • Bold text color
      • Italic/emphasized text color
      • Inline code color
      • Blockquote color
      • Link color
      • List item color

2. Updated All Theme Definitions

  • Added markdown color configurations to all 14 built-in themes
  • Each theme's markdown colors are carefully chosen to match its overall color scheme

3. Modified MarkdownText Component

  • Added optional theme prop to accept Theme object
  • When theme is provided, passes markdown colors to TerminalRenderer options
  • Maintains backward compatibility - works without theme prop

4. Updated SayReasoningMessage

  • Now passes the theme to MarkdownText component
  • Enables themed markdown rendering in the Reasoning box

Result

Users can now customize the text color and styling of markdown content inside Reasoning boxes through the theme system. This provides a consistent theming experience across all CLI UI elements.

Files Changed

  • cli/src/types/theme.ts - Extended Theme interface
  • cli/src/constants/themes/*.ts - Updated all 14 theme definitions
  • cli/src/ui/components/MarkdownText.tsx - Added theme support
  • cli/src/ui/messages/extension/say/SayReasoningMessage.tsx - Pass theme to MarkdownText

- Extended Theme interface with markdown color properties (text, heading, strong, em, code, blockquote, link, list)
- Updated all 14 built-in themes with markdown color configurations
- Modified MarkdownText component to accept and apply theme colors via TerminalRenderer
- Updated SayReasoningMessage to pass theme to MarkdownText component
- Enables full theming of markdown content inside Reasoning boxes
@changeset-bot

changeset-bot Bot commented Dec 19, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 25a9499

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pandemicsyn pandemicsyn self-assigned this Dec 19, 2025

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No Issues Found

17 files reviewed | Confidence: 95% | Recommendation: Merge

Review Details

Files Reviewed:

  • cli/src/types/theme.ts - Theme interface extension
  • cli/src/ui/components/MarkdownText.tsx - Component theme support
  • cli/src/ui/messages/extension/say/SayReasoningMessage.tsx - Theme prop usage
  • 14 theme definition files (alpha.ts, ansi.ts, ansi-light.ts, atom-one-dark.ts, ayu-dark.ts, ayu-light.ts, dark.ts, dracula.ts, github-dark.ts, github-light.ts, googlecode.ts, light.ts, shades-of-purple.ts, xcode.ts)

Checked:

  • ✅ Security: No user input processing, static theme colors only
  • ✅ Bugs: Type-safe implementation, proper null handling
  • ✅ Performance: Theme merging happens once per render
  • ✅ Error handling: Graceful fallback in MarkdownText component
  • ✅ Backward compatibility: Optional theme prop maintains existing behavior

Implementation Quality:

  • Clean extension of the Theme interface with required string properties
  • Consistent markdown configuration across all 14 themes
  • Proper precedence: theme colors override default options when provided
  • Well-documented component with JSDoc comments

- Cast theme markdown colors to TerminalRendererOptions to fix TypeScript error
- marked-terminal expects ChalkInstance or functions, but our theme uses strings
- Type assertion allows the strings to be passed through correctly
- Import chalk and create proper chalk color instances
- Add colorToChalk helper to handle both hex colors and named colors
- Replace type assertion with proper chalk.hex() and chalk[color] calls
- This ensures marked-terminal receives the correct ChalkInstance types

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No New Issues in Latest Changes

Changes since last review (commits 246ca74 and f187fb2) look good.

Summary of new commits:

  1. Type assertion fix - Added proper type handling for TerminalRendererOptions
  2. Chalk instances fix - Replaced type assertion with proper chalk.hex() and chalk[color] calls via colorToChalk helper

Reviewed:

  • colorToChalk helper correctly handles both hex colors (#ffffff) and named colors (white)
  • ✅ Graceful fallback to chalk.white for invalid color names
  • ✅ Theme colors are statically defined in theme files (not user input), so the (chalk as any) pattern is acceptable here
  • ✅ Implementation properly integrates with marked-terminal's expected ChalkInstance types
Review Details

Files reviewed: cli/src/ui/components/MarkdownText.tsx

Checked: Type safety, runtime behavior, error handling

@pandemicsyn

Copy link
Copy Markdown
Contributor
SCR-20251219-jyat

- Replace 'as any' with proper type assertion using ChalkColor type
- Fixes ESLint no-explicit-any error

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No New Issues in Latest Changes

Changes since last review (commits 55cce3e and 25a9499) look good.

Summary of new commits:

  1. Type safety improvement - Replaced as any with proper ChalkColorMethod type and isChalkColorMethod type guard
  2. Test coverage - Added comprehensive tests for theme support (hex colors, named colors, invalid color fallback)

Reviewed:

  • colorToChalk helper is now fully type-safe with explicit ChalkColorMethod union type
  • isChalkColorMethod type guard properly validates named colors at runtime
  • ✅ Graceful fallback to chalk.white for invalid color names
  • ✅ Test coverage verifies hex colors, named colors, and invalid color handling
  • ✅ All 14 theme files have consistent markdown color configurations
Review Details

Files reviewed:

  • cli/src/ui/components/MarkdownText.tsx - Type-safe color handling
  • cli/src/ui/components/__tests__/MarkdownText.test.tsx - Theme support tests

Checked: Type safety, runtime behavior, error handling, test coverage

@marius-kilocode marius-kilocode left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pandemicsyn
pandemicsyn merged commit 845f8c1 into main Dec 22, 2025
12 checks passed
@pandemicsyn
pandemicsyn deleted the session/agent_0804969b-ef89-4c16-a3c6-c17b312f5142 branch December 22, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants