forked from phodal/auto-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
Description
Overview
Refactor IdeaSketchRenderer in mpp-idea module to reuse business logic from core module's LangSketch components while keeping the Compose UI implementation.
Background
- mpp-idea: Uses Compose for Desktop (Jewel) - currently only static rendering
- core: Uses Swing (JComponent) - full functionality (Apply/Reject/Repair/View Diff, etc.)
Approach: Solution B
Reimplement UI in Compose while reusing core's business logic to avoid SwingPanel z-index issues.
LangSketch Components to Migrate
Core Module
| Component | Language | Priority |
|---|---|---|
CodeHighlightSketch |
All code | P0 |
DiffLangSketch |
diff, patch | P0 |
SingleFileDiffSketch |
- | P0 |
PlanLangSketch |
plan | P1 |
HtmlHighlightSketch |
html | P1 |
WebpageLangSketch |
html (full page) | P2 |
MarkdownPreviewHighlightSketch |
markdown | P2 |
OpenAPISketch |
yaml, yml | P3 |
Extension Modules
| Component | Module | Language | Priority |
|---|---|---|---|
TerminalLangSketch |
ext-terminal | bash, shell | P1 |
MermaidSketch |
ext-mermaid | mermaid | P2 |
PlantUmlSketch |
ext-plantuml | plantuml, puml | P3 |
GraphvizSketch |
ext-diagram | dot, graphviz | P3 |
GoLangPlaygroundSketch |
goland | go | P3 |
Reusable Business Logic
| Logic | Location | Method |
|---|---|---|
| Diff parsing | mpp-core | DiffParser.parse() |
| Patch apply | core | PatchProcessor.applyPatch() |
| Patch repair | core | DiffRepair.applyDiffRepairSuggestion() |
| Diff dialog | core | showSingleDiff() |
| Plan parsing | core | MarkdownPlanParser.parse() |
| Shell safety | core | ShellSafetyCheck.checkDangerousCommand() |
Implementation Phases
Phase 1: IdeaDiffActions (P0) ✅ COMPLETED
- Create
IdeaDiffActions.ktwith accept/reject/viewDiff/repair methods - Update
IdeaDiffRenderer.ktwith action buttons - Reuse
PatchProcessor,DiffRepair,showSingleDiff()
Files created/modified:
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/actions/IdeaDiffActions.ktmpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaDiffRenderer.ktmpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaSketchRenderer.kt
Phase 2: IdeaCodeActions (P1)
- Create
IdeaCodeActions.ktwith copy/insert/newFile methods - Update
IdeaCodeBlockRenderer.ktwith toolbar
Phase 3: IdeaPlanRenderer (P1)
- Create
IdeaPlanRenderer.kt - Reuse
MarkdownPlanParser.parse() - Support Pin/Compress features
Phase 4: IdeaTerminalRenderer (P2)
- Create
IdeaTerminalRenderer.kt - Reuse
ShellSafetyCheck - Depends on
ext-terminalmodule
Phase 5: Diagram Enhancements (P3)
- Enhance existing
IdeaMermaidRenderer - Add PlantUML/Graphviz support (optional)
Architecture
mpp-idea (Compose UI)
├── IdeaSketchRenderer
│ ├── IdeaDiffRenderer → IdeaDiffActions ✅
│ ├── IdeaCodeBlockRenderer → IdeaCodeActions
│ ├── IdeaPlanRenderer → IdeaPlanActions
│ └── IdeaTerminalRenderer → IdeaTerminalActions
↓
core (Business Logic)
├── PatchProcessor
├── DiffRepair
├── MarkdownPlanParser
└── ShellSafetyCheck
↓
mpp-core (Cross-platform)
├── DiffParser
└── DiffUtils
Notes
- Use
DialogWrapperfor complex Swing components to avoid z-index issues - Use Jewel's
IconButtonfor action buttons - Maintain feature parity with core module Sketches
Related Files
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaSketchRenderer.ktcore/src/main/kotlin/cc/unitmesh/devti/sketch/ui/LangSketch.ktcore/src/main/kotlin/cc/unitmesh/devti/sketch/ui/patch/DiffLangSketch.ktcore/src/main/kotlin/cc/unitmesh/devti/sketch/ui/plan/PlanLangSketch.ktdocs/refactor-idea-sketch-renderer.md
Reactions are currently unavailable