Close
0%
0%

aiCoder

LLM coding using AST(abstract syntax trees) for intelligently merging LLM generated sippets in to existing code files

Similar projects worth following
aiCoder uses Abstract Syntax Trees (ASTs) to integrate AI-generated code snippets into existing JavaScript files with precision. User prompts guide the AI in generating suggestions, which are parsed into an AST representation. This allows aiCoder to analyze the structure of a single file and identify accurate insertion points, ensuring new methods, classes, or functions are added without disrupting existing code. The tool also maintains consistency in naming and organization.

ASTs enable aiCoder to automate complex code merging by representing the hierarchical structure of the source code. This approach minimizes errors common in manual merging and ensures deterministic integration of features or refactoring. By abstracting code manipulation complexities, aiCoder allows developers to focus on design while preserving code integrity.

# aiCoder
**Harness AI to Craft Your JavaScript Libraries with Ease!**

Tired of manually copying and pasting code snippets from ChatGPT into your editor? **aiCoder** is your solution, streamlining the coding process with an AI-powered assistant.

With **aiCoder** as your coding co-pilot, you can simplify development, refine your code, and bring ideas to life through natural language interactions. It intelligently merges AI-suggested changes into your existing code—without disrupting what you’ve already built.

The magic lies in aiCoder’s advanced merging logic, which keeps your original code intact while integrating new snippets precisely and reliably.


![NEW UI](https://aicoderproject.com/aiCoder.gif)

[Slide Deck discussing the AST approach to merging snippets](https://docs.google.com/presentation/d/1xdX09ELgW7lMU1E9KWIrpibUYVT1wdaiSvUhFhAT7EI/edit?usp=sharing)

[Code manipulator source file](./src/mergeTools/languages/javascript/javascript.js)


## Purpose and Benefits
**aiCoder** is designed to enhance your coding experience by leveraging the power of AI. It helps you:
- Save time by automating repetitive coding tasks.
- Improve code quality with intelligent suggestions.
- Focus on higher-level design and problem-solving.
- Seamlessly integrate new features and improvements into your existing codebase.


# Standard Workflow
1. Run `aiCoder` or just the `a` command in your project’s directory.
2. Visit [http://localhost:3000](http://localhost:3000) to access the web UI.
3. Use **New Plan Chat** to discuss and define your project requirements, then save the plan. The saved plan guides future implementations.
4. Open the **Files** tab to select the target file you want to modify.
5. Start a **New Chat** with the selected file.
6. Request code changes using natural language prompts.
7. Review the suggested snippets and click **🤖✎⚡** to automatically merge them into the file.

# Installation
Installation instructions provided for linux. 
### From NPM
```
npm i -g aicodertool
```

### From Source
1. Clone this repository and navigate to the cloned directory.
2. Run:   ```   cd aiCoder   npm install && npm install -g .   ```   After installation, you’re all set! Just run the `aiCoder` or the much short `a` command in any project directory.

Installing Ollama allows you to use local LLMs. On linux you can run `aiCoder -setup` to automatically install ollama and pull the default model or manually install it with the following commands: ```
# Install Ollama curl -fsSL https://ollama.com/install.sh | sh

# Pull the preferred model
ollama pull granite3.1-dense
```

You can find and install additional models to test with https://ollama.com/search


## Usage
Launch `aiCoder` from within your project folder:
```
cd myProjectFolder
aicoder
```
Then open [http://localhost:3000](http://localhost:3000/) in your browser to begin.

To run on a different port use `aicoder -p 3001`

## Chat Interface
![NEW UI](https://aicoderproject.com/CHAT.png)

## aiCoder provides two different specialized chat modes:

## New Chat
Use **New Chat** to interactively modify a selected file. Before starting a conversation, be sure to choose a file from the **Files** tab. The LLM uses a system prompt specifying the snippet format. Correctly formatted snippets can be merged automatically, updating existing functions or class methods without disturbing the rest of the code.

## New Plan Chat
Use **New Plan Chat** to refine the project plan document. This plan, combined with the default system prompts, guides the LLM during regular chats.  Begin by describing your project goals. You can ask the LLM to produce a detailed outline of all the necessary classes and methods, then save this plan.


# Tools
![NEW TOOLS](https://aicoderproject.com/TOOLS.png)

## Methods List
Displays all detected methods.  - **Green** methods: Implemented methods with code.
- **Red** methods: Stubs that need implementation.

To only dhow the red stubs in the list use the "Show Only...
Read more »

View project log

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates