Skip to content

refactor(mpp-idea): replace hardcoded colors with AutoDevColors design system - #3

Merged
phodal merged 2 commits into
masterfrom
feat/mpp-idea-use-mpp-ui
Nov 29, 2025
Merged

phodal merged 2 commits into
masterfrom
feat/mpp-idea-use-mpp-ui

Conversation

@phodal

@phodal phodal commented Nov 29, 2025 •

Copy link
Copy Markdown
Member

Summary

Replace hardcoded color values in IdeaAgentApp.kt with semantic colors from the AutoDevColors design system in mpp-ui.

Changes

Location Before After
ToolCallBubble (success) Color(0xFF4CAF50) AutoDevColors.Green.c400
ToolCallBubble (error) Color(0xFFF44336) AutoDevColors.Red.c400
ErrorBubble (background) Color(0x33F44336) AutoDevColors.Red.c400.copy(alpha = 0.2f)
ErrorBubble (text) Color(0xFFF44336) AutoDevColors.Red.c400
TaskCompleteBubble (success bg) Color(0x334CAF50) AutoDevColors.Green.c400.copy(alpha = 0.2f)
TaskCompleteBubble (error bg) Color(0x33F44336) AutoDevColors.Red.c400.copy(alpha = 0.2f)

Why

Per the coding guidelines:

DO NOT hardcode colors (e.g., Color(0xFF...) or #hex). Always use design tokens for consistency across platforms.

Using AutoDevColors ensures:

  • Cross-platform color consistency
  • Proper dark/light theme support
  • Maintainable design system

Related

Addresses review comments from PR #2 regarding hardcoded colors.


Pull Request opened by Augment Code with guidance from the PR author

Summary by CodeRabbit

  • Revert

    • Removed the Compose-based Chat tool window from the IDE
  • Improvements

    • Updated Agent UI components to use unified design system color tokens for improved visual consistency

✏️ Tip: You can customize this high-level summary in your review settings.

Delete AutoDev Compose tool window and related classes to streamline tool window offerings and reduce redundancy.
…n system

- Replace Color(0xFF4CAF50) with AutoDevColors.Green.c400 for success status
- Replace Color(0xFFF44336) with AutoDevColors.Red.c400 for error status
- Use .copy(alpha = 0.2f) for background colors instead of hardcoded alpha
- Remove unused Color import

This ensures cross-platform color consistency by using the design system
tokens from mpp-ui instead of hardcoded hex values.
@coderabbitai

coderabbitai Bot commented Nov 29, 2025 •

Copy link
Copy Markdown

Walkthrough

This PR removes the Compose-based AutoDev chat UI infrastructure, including the AutoDevChatApp composable, AutoDevChatViewModel, and AutoDevToolWindowFactory class, along with their plugin registration. Separately, IdeaAgentApp is refactored to use AutoDevColors design tokens instead of hard-coded colors.

Changes

Cohort / File(s) Summary
Removed Chat UI Infrastructure
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatApp.kt, AutoDevChatViewModel.kt, AutoDevToolWindowFactory.kt
Deleted three Kotlin files: AutoDevChatApp (Compose UI with header, message bubbles, input), AutoDevChatViewModel (with ChatMessage data class, MessageInputState sealed class, state flows, and behavior methods), and AutoDevToolWindowFactory (ToolWindowFactory implementation). All Compose-based chat UI code removed.
Design System Integration
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt
Replaced hard-coded color hex values with AutoDevColors design tokens in ToolCallBubble, ErrorBubble, and TaskCompleteBubble composables. Color definitions now reference AutoDevColors.Green.c400 and AutoDevColors.Red.c400.
Plugin Registration
mpp-idea/src/main/resources/META-INF/plugin.xml
Removed toolWindow extension declaration for AutoDevToolWindowFactory with id "AutoDev Compose". AutoDev Agent tool window remains.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Deletions are straightforward: Three entire files removed with clear, complete removal of interdependent classes and composables.
  • Color refactoring is cosmetic: IdeaAgentApp changes involve direct color token replacements with no logic modifications.
  • Plugin registration removal is minimal: Single toolWindow entry removal from XML.

Possibly related PRs

Poem

🐰 The Compose chat bids adieu,
No more bubbles, colors flew,
ViewModel and Factory too,
AutoDevColors shine anew! ✨
Fresh design tokens guide the view.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims the PR replaces hardcoded colors with AutoDevColors, but the raw summary shows significant file deletions (AutoDevChatApp.kt, AutoDevChatViewModel.kt, AutoDevToolWindowFactory.kt, and plugin.xml changes) unrelated to this color refactoring. Update the title to reflect the primary changes: either focus on the color refactoring if the deletions are incidental, or update to 'refactor(mpp-idea): remove Chat UI and replace hardcoded colors with AutoDevColors' if both are intentional.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Docstrings were successfully generated.
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mpp-idea-use-mpp-ui

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 192f308 and 16101e6.

📒 Files selected for processing (5)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatApp.kt (0 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatViewModel.kt (0 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevToolWindowFactory.kt (0 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt (4 hunks)
  • mpp-idea/src/main/resources/META-INF/plugin.xml (0 hunks)
💤 Files with no reviewable changes (4)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevToolWindowFactory.kt
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatViewModel.kt
  • mpp-idea/src/main/resources/META-INF/plugin.xml
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/AutoDevChatApp.kt
🧰 Additional context used
📓 Path-based instructions (3)
**/*.kt

📄 CodeRabbit inference engine (AGENTS.md)

**/*.kt: Use expect/actual for platform-specific code in Kotlin Multiplatform (e.g., file I/O on JVM/JS/Wasm)
Check export first; if some functions are not working well with CLI (TypeScript), verify the export configuration
In Kotlin/JS @JsExport: avoid Flow, use Promise instead
In Kotlin/JS @JsExport: use concrete classes as return types and parameter types, avoid interface types as JS cannot handle type conversion correctly
For WASM platform, do not use emoji and UTF-8 in code

Files:

  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt
**/*.{kt,kts}

📄 CodeRabbit inference engine (AGENTS.md)

For Compose (Desktop/Android), use AutoDevColors from cc.unitmesh.devins.ui.compose.theme or MaterialTheme.colorScheme

Files:

  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt
**/*.{ts,tsx,kt,kts}

📄 CodeRabbit inference engine (AGENTS.md)

DO NOT hardcode colors (e.g., Color(0xFF...) or #hex). Always use design tokens for consistency across platforms

Files:

  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: phodal/auto-dev-sketch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T14:07:19.001Z
Learning: Applies to **/*.{ts,tsx,kt,kts} : DO NOT hardcode colors (e.g., `Color(0xFF...)` or `#hex`). Always use design tokens for consistency across platforms
Learnt from: CR
Repo: phodal/auto-dev-sketch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T14:07:19.001Z
Learning: Applies to **/*.{kt,kts} : For Compose (Desktop/Android), use `AutoDevColors` from `cc.unitmesh.devins.ui.compose.theme` or `MaterialTheme.colorScheme`
📚 Learning: 2025-11-29T14:07:19.001Z
Learnt from: CR
Repo: phodal/auto-dev-sketch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T14:07:19.001Z
Learning: Applies to **/*.{kt,kts} : For Compose (Desktop/Android), use `AutoDevColors` from `cc.unitmesh.devins.ui.compose.theme` or `MaterialTheme.colorScheme`

Applied to files:

  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt
📚 Learning: 2025-11-29T14:07:19.001Z
Learnt from: CR
Repo: phodal/auto-dev-sketch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T14:07:19.001Z
Learning: Applies to **/*.{ts,tsx,kt,kts} : DO NOT hardcode colors (e.g., `Color(0xFF...)` or `#hex`). Always use design tokens for consistency across platforms

Applied to files:

  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt
📚 Learning: 2025-11-29T14:07:19.001Z
Learnt from: CR
Repo: phodal/auto-dev-sketch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T14:07:19.001Z
Learning: See `docs/design-system-compose.md` for Kotlin Compose color design system documentation

Applied to files:

  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build (223)
  • GitHub Check: Build (241)
🔇 Additional comments (4)
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt (4)

18-18: LGTM! Correct import for the design system.

The import of AutoDevColors from cc.unitmesh.devins.ui.compose.theme is appropriate and necessary for the refactoring.

Based on coding guidelines and learnings.


229-234: Excellent refactoring to use design system tokens.

The replacement of hardcoded colors (Color(0xFF4CAF50) and Color(0xFFF44336)) with AutoDevColors.Green.c400 and AutoDevColors.Red.c400 successfully addresses the coding guideline to avoid hardcoded colors.

Based on coding guidelines and learnings: "DO NOT hardcode colors. Always use design tokens for consistency across platforms."


278-278: LGTM! Proper alpha handling with design tokens.

Both the background and text colors now use AutoDevColors.Red.c400 instead of hardcoded values. The alpha transparency is correctly applied using .copy(alpha = 0.2f), which matches the original hex alpha value.

Based on coding guidelines and learnings.

Also applies to: 284-284


300-305: LGTM! Consistent use of design tokens across success and error states.

The conditional background colors now use AutoDevColors.Green.c400 and AutoDevColors.Red.c400 with proper alpha transparency, replacing the original hardcoded hex values. This maintains visual consistency with other components in the file.

Based on coding guidelines and learnings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@coderabbitai

coderabbitai Bot commented Nov 29, 2025 •

Copy link
Copy Markdown

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #4

@phodal
phodal merged commit c7445af into master Nov 29, 2025
coderabbitai Bot added a commit that referenced this pull request Nov 29, 2025
Docstrings generation was requested by @phodal.

* #3 (comment)

The following files were modified:

* `mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt`
@phodal
phodal deleted the feat/mpp-idea-use-mpp-ui branch December 2, 2025 10:30
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.

1 participant