# 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.  [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  ## 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  ## 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 »