A lightweight, powerful AI-powered code editing assistant that helps you modify your codebase through natural language commands.
- Natural Language Code Editing: Modify your code by describing what you want in plain English
- File Management: Read and list files with simple commands
- Smart Edits: Precisely replace code segments without manual search
- File Creation: Generate new files on demand
- Powered by GPT-4.1: Leverages OpenRouter to connect to advanced AI models
# Clone the repository
git clone https://github.com/yourusername/code-editing-agent.git
cd code-editing-agent
# Install dependencies
bun install
# Set up your environment variables
cp .env.local.example .env.local
# Edit .env.local to add your OPENROUTER_API_KEYCreate a .env.local file with your OpenRouter API key:
OPENROUTER_API_KEY=your_openrouter_api_key_here
You can get an API key from OpenRouter.
Run the agent with a natural language command:
bun run index.ts "Create a new React component called Button that accepts variant and size props"The agent will:
- Parse your request
- Use the appropriate tools to edit or create files
- Return a summary of the changes
The agent provides three primary tools:
- read_file: Read the contents of a file
- list_files: List all files in a directory
- edit_file: Make changes to existing files or create new ones
The agent uses the Vercel AI SDK and OpenRouter to connect to powerful AI models. When you provide a command, it:
- Interprets your request
- Plans the necessary file operations
- Executes them using the appropriate tools
- Returns the results
MIT
- Bun - Fast JavaScript runtime
- OpenRouter - AI model provider
- Vercel AI SDK - Tools for building AI interfaces
This project was created using bun init in bun v1.2.2.