Skip to content

AgentGino/coding-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Agent

A experimental Go-based coding assistant that generates complete, structured code projects using AI. It creates actual files, handles multiple languages, and follows best practices through customizable agent rules.

What It Is

The Coding Agent is an AI-powered tool that:

  • Generates complete code projects from natural language descriptions
  • Creates actual files with proper directory structure
  • Supports multiple programming languages (Go, Python, JavaScript, etc.)
  • Follows coding best practices through customizable rules
  • Handles complex multi-file projects with proper organization
  • Provides beautiful visual feedback with loading animations and progress indicators

Quick Start

# 1. Install dependencies
go mod tidy

# 2. Set up your API key
cp .env.example .env
# Edit .env with your OpenRouter API key

# 3. Run the agent
go run main.go -prompt "Create a REST API server in Go with user management"

Usage Examples

Basic Usage

go run main.go -prompt "Create a simple HTTP server in Go"

Advanced Projects

# Multi-file web application
go run main.go -prompt "Create a complete Go web app with handlers, models, and database integration"

# Microservices architecture
go run main.go -prompt "Create a microservice with authentication, user management, and API gateway"

# Terraform infrastructure
go run main.go -prompt "Create Terraform code for S3 bucket with Lambda function"

Features Checklist

✅ Core Features

  • AI-Powered Code Generation - Uses OpenRouter API with multiple models
  • Multi-File Project Generation - Creates complete project structures
  • Multiple Language Support - Go, Python, JavaScript, Terraform, and more
  • Structured JSON Responses - Parses AI responses into organized file structures
  • Visual Loading Animations - Beautiful spinner with progress indicators
  • Tree-Style File Display - Shows project structure before generation

✅ Configuration & Customization

  • Environment Configuration - .env file for API keys and settings
  • Agent Rules System - Customizable .agentrules file for coding guidelines
  • Flexible Output Directory - Configurable output locations
  • Model Selection - Choose different AI models (GPT-4, Claude, etc.)

✅ Error Handling & Reliability

  • Robust Error Handling - Graceful fallbacks for API failures
  • JSON Parsing Recovery - Handles malformed AI responses
  • Directory Auto-Creation - Creates nested directories automatically
  • Configuration Validation - Validates required settings on startup

✅ Developer Experience

  • Progress Indicators - Real-time file creation progress
  • File Size Reporting - Shows generated file sizes
  • Comprehensive Logging - Detailed operation feedback
  • Cross-Platform Support - Works on macOS, Linux, and Windows

Configuration

Required Setup

  1. API Key: Get your OpenRouter API key from openrouter.ai
  2. Environment File: Copy .env.example to .env and add your API key

Optional Customization

  • Agent Rules: Create .agentrules file for custom coding guidelines
  • Output Directory: Set OUTPUT_DIR in .env to change where files are generated
  • AI Model: Choose different models by setting MODEL in .env

Agent Rules System

Customize code generation behavior with .agentrules:

# Agent Rules - Dos and Don'ts for Code Generation

## DO:
- Always include proper error handling
- Use meaningful variable and function names
- Follow language-specific conventions

## DON'T:
- Don't hardcode sensitive information
- Don't use deprecated functions

## TERRAFORM SPECIFIC RULES:
- Always create backend.tf, providers.tf, variables.tf
- Never hardcode values - use variables
- Create individual resource files (iam.tf, s3.tf, etc.)

Project Structure

Generated projects follow best practices:

generated/
├── main.go                    # Entry point
├── handlers/
│   └── user.go               # HTTP handlers
├── models/
│   └── user.go               # Data models
├── services/
│   └── user_service.go       # Business logic
├── go.mod                    # Go module file
└── README.md                 # Generated documentation

Troubleshooting

Common Issues

  • "API key required": Check your .env file has OPENROUTER_API_KEY
  • "JSON parsing failed": AI response format issue - agent falls back gracefully
  • Permission errors: Ensure output directory is writable

Getting Help

  • Check the generated README.md in output directories for usage instructions
  • Review agent rules in .agentrules for customization options
  • Ensure stable internet connection for API calls

Building

# Build standalone binary
go build -o coding-agent main.go

# Run the binary
./coding-agent -prompt "your prompt here"

Made with ❤️ using Go and AI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages