🚧 Caution: Pre-Alpha — Early Stage Development
An IntelliJ IDEA plugin project that leverages OpenAI to interpret natural language prompts and automatically create or modify Java Spring Boot code within your development workspace. This repository contains the complete source code for the plugin—no marketplace distribution is provided.
- Natural Language to Code: Interpret developer prompts in plain English and translate them into actionable code changes.
- Class Creation & Modification: Automatically generate new classes or update existing ones based on structured JSON instructions.
- Context Awareness: Retrieve existing code context (classes, methods, imports) to ensure accurate modifications.
- JSON-Based Instruction Extraction: Use GPT-4o-mini to parse prompts into structured instructions (
action,newClasses,modifiedClasses, etc.). - Embedded Tool Window: A custom Tool Window in IntelliJ for prompt input and instant feedback within the IDE.
- IntelliJ IDEA Community or Ultimate (version 2021.3 or newer)
- Java 11 or higher
- Gradle (wrapper included)
- An OpenAI API key
- Clone this repository:
git clone https://github.com/ankitbanka17/prompt-based-coding.git cd prompt-based-coding - Configure your OpenAI API key (see Configuration below).
- Build the plugin JAR:
The resulting plugin artifact will be at
./gradlew clean build
build/distributions/prompt-based-coding.zip.
- In IntelliJ IDEA, go to Settings ➔ Plugins.
- Click the gear icon and choose Install Plugin from Disk...
- Select the generated ZIP (
build/distributions/prompt-based-coding.zip). - Restart the IDE to activate the plugin.
For iterative development, you can launch a sandbox instance of IntelliJ:
./gradlew runIdeThis opens a fresh IDE with your plugin loaded, isolating it from your main IDE settings.
- Open the Prompt-Based Coding tool window:
View➔Tool Windows➔ Prompt-Based Coding. - Enter a natural language instruction, for example:
Add a REST controller for user management with CRUD endpoints. - Press Submit. The plugin will:
- Send the prompt to
LLMAdapterfor instruction extraction. - Locate or create target code files via
PromptProcessor. - Apply modifications or generate new code using
CodeModifier. - Write changes to your project and display results in the tool window.
- Send the prompt to
All settings
- OpenAI API Key: Your API key (e.g.,
sk-...). Define in LLMAdapter
prompt-based-coding/
├── src/
│ ├── main/
│ │ ├── kotlin/com/github/ankitbanka17/promptbasedcoding/
│ │ │ ├── adapter/LLMAdapter.kt
│ │ │ ├── handlers/PromptProcessor.kt
│ │ │ ├── services/CodeModifier.kt
│ │ │ ├── tools/MyToolWindow.kt
│ │ │ └── util/PromptBuilder.kt
│ │ └── resources/prompts/
│ │ └── code_instructions.txt
│ └── test/
├── build.gradle.kts
├── settings.gradle.kts
├── gradle/
└── gradlew*
This project is licensed under the MIT License. See LICENSE for details.