Aider IntelliJ Integration Guide
This skill provides comprehensive guidance for working with the Coding Aider plugin for IntelliJ IDEA - a plugin that integrates the Aider AI pair programming tool directly into the IDE.
Common Development Commands
Build and Test
```bash
Build the plugin
./gradlew build
Run tests
./gradlew test
Build and run IntelliJ IDEA with the plugin
./gradlew runIde
Build plugin distribution
./gradlew buildPlugin
Verify plugin compatibility
./gradlew verifyPlugin
Run individual test
./gradlew test --tests "ClassName.methodName"
```
Development Workflow
Launch test IntelliJ instance with `./gradlew runIde`Built plugin artifacts are in `build/distributions/`Logging level configurable via system property in `runIde` task (default: INFO)Architecture Overview
Core Module Structure
The plugin follows a **layered architecture** with clear separation of concerns:
**1. Actions Layer** (`actions/`)
User-initiated commands and IDE integrations`aider/`: Core Aider integration (AiderAction, DocumentCodeAction)`git/`: Git operations (CommitAction, GitCodeReviewAction)`ide/`: IDE utilities (PersistentFilesAction, SettingsAction)**2. Services Layer** (`services/`)
Business logic and state managementCore: AiderHistoryService, PersistentFileService, TokenCountServicePlan Management: AiderPlanService, ContinuePlanServiceMCP Integration: McpServerService with persistent file toolsExecution: CommandSummaryService, RunningCommandService**3. Executors Layer** (`executors/`)
CommandExecutor interface with execution strategies: - NativeAiderExecutionStrategy (direct command execution)
- DockerAiderExecutionStrategy (containerized)
- SidecarAiderExecutionStrategy (persistent process)
CommandObserver for progress tracking**4. Input/Output Layer**
AiderInputDialog: Context management and command inputOutputView: Markdown rendering and result displayKey Design Patterns
**Command Pattern**: CommandData encapsulates execution context (file lists, working directory, preferences)**Strategy Pattern**: Multiple execution strategies implement AiderExecutionStrategy interface**Observer Pattern**: Command progress tracked via CommandObserver lifecycle callbacks**Service Locator**: IntelliJ service architecture with application and project-level servicesAider Integration Modes
Execution Strategies
1. **Native**: Direct aider command (requires aider in PATH)
2. **Docker**: Containerized via `paulgauthier/aider` image
3. **Sidecar**: Persistent aider process for performance
Input Modes
**IDE-based**: Execution within IntelliJ with integrated output**Shell-based**: Terminal execution with file context pre-setupContext Management
Persistent files managed via PersistentFileServiceAutomatic inclusion of selected and persistent filesConfigurable working directory for operationsStructured Mode (Plan-Based Development)
Plans are stored in `.coding-aider-plans/` with three files per plan:
`{plan_name}.md`: Overview and goals`{plan_name}_checklist.md`: Implementation tasks`{plan_name}_context.yaml`: Associated filesPlan Services
**AiderPlanService**: Plan CRUD and file management**AiderPlanPromptService**: Generation and refinement prompts**ActivePlanService**: Current plan state tracking**ContinuePlanService**: Continuation and progress trackingPlan Workflow
1. Enable structured mode in AiderInputDialog
2. Plans auto-created with context files
3. Checklist items marked complete during implementation
4. Tool window provides plan management
MCP Server Integration
Built-in HTTP MCP server (localhost:8080) with tools:
`get_persistent_files`: Retrieve current persistent file list`add_persistent_files`: Add files to persistent context`remove_persistent_files`: Remove files from context`clear_persistent_files`: Clear all persistent filesArchitecture: McpServerService manages lifecycle, tools implement McpTool interface, McpToolRegistry handles discovery.
Settings and Configuration
Settings Hierarchy
**Application Level**: AiderSettings (global path, docker config, LLM providers)**Project Level**: AiderProjectSettings (persistent files, working directory, plan preferences)LLM Providers
Built-in: OpenAI, Anthropic, Ollama, OpenRouter, Gemini, Vertex AI
Custom providers via CustomLlmProviderService
Testing Strategy
**Unit Tests**: Located in `src/test/kotlin` using JUnit 5 and AssertJ**Integration Tests**: Extend `BaseIntegrationTest` for service testing**Mock-based**: Mockito for external dependencies**Test Resources**: `src/test/resources/`Important Implementation Notes
Action System
Actions extend AnAction with ActionUpdateThread.BGT for performanceKeyboard shortcuts defined in plugin.xmlContext-aware visibility via update() methodAction groups provide hierarchical menu organizationFile Processing
FileData class encapsulates file metadata (path, read-only status)File normalization handles cross-platform pathsDirectory traversal via FileTraversal classGit integration via GitUtils for change detectionError Handling
FixCompileErrorAction for compile error resolutionFixTodoAction for TODO detection and fixingError parsing and context extraction for AI assistanceThreading Model
Background tasks for long-running operations (web crawl, plan generation)EDT-safe UI updates via ApplicationManager.getApplication().invokeLater()Reactive programming with reactor-core for async operationsDocker Integration
DockerContainerManager: Container lifecycle (start, stop, remove)Volume mounting for project file accessImage management and updatesAutomatic image pulling and container setupDevelopment Best Practices
Code Organization
Package structure mirrors functional domainsCompanion objects for static utilities and factoriesExtension functions for IntelliJ platform integrationNullable types with Kotlin idiomsPlugin Integration
IntelliJ platform services registered in plugin.xmlTool windows for persistent UI componentsNotification groups for user feedbackIntention actions for contextual code assistanceKey Configuration Areas
**Execution**: Strategy selection (native/docker/sidecar)**Docker**: Container management and volume mounting**Plans**: Structured mode preferences and templates**UI**: Dialog behavior, keyboard shortcuts, output formatting