AI Coding Agent
An intelligent coding assistant powered by the @agenite framework that helps with coding tasks, code analysis, and file operations. This agent acts as your pair programming partner, capable of understanding and modifying code, answering questions, and providing assistance with development tasks.
Features
- 🔍 Code Analysis: Finds functions, imports, and analyzes code structure
- 📝 Code Generation: Creates and modifies code with proper formatting
- 🛠️ File Operations: Handles file system tasks (read, write, list)
- 💡 Interactive Assistance: Provides explanations and suggestions
- 🎨 Beautiful Output: Rich console output with icons and colors
- 🔄 Development Flow: Seamless integration with your coding workflow
Architecture
The agent uses a modular architecture with specialized tools:
Command Runner Tool
- Executes shell commands safely
- Handles command timeouts
- Caches recent command results
- Provides detailed command output
File System Tool
- Reads and writes files
- Lists directory contents
- Handles file operations safely
- Supports various file types
Installation
git clone [repository-url]
cd coding-agent
npm install
Usage
Start the agent and interact with it:
npm start
Example commands:
"Can you analyze the code in src/agent.ts?"
"What functions are defined in src/tools/file-system.ts?"
"Add error handling to the readFile function"
"Explain how the command runner tool works"
Project Structure
coding-agent/
├── src/
│ ├── agent.ts # Main agent implementation
│ ├── index.ts # Entry point
│ └── tools/ # Tool implementations
│ ├── command-runner.ts # Command execution
│ └── file-system.ts # File operations
├── tests/ # Test files
└── package.json
Configuration
The agent uses environment variables for configuration:
export LLM_PROVIDER=ollama
export LLM_MODEL_ID=llama3.2
export COMMAND_TIMEOUT=30000
export CACHE_DURATION=60000
Features in Detail
Code Analysis
- Function and class detection
- Import statement analysis
- Code structure understanding
- Dependency tracking
File Operations
- Safe file reading/writing
- Directory exploration
- File type detection
- Path resolution
Command Execution
- Safe command running
- Output capturing
- Error handling
- Result caching
Development
Run in development mode with auto-reload:
npm run dev
Watch mode for TypeScript:
npm run watch
Error Handling
The agent handles various scenarios:
- Invalid commands
- File system errors
- Syntax errors
- Timeout issues
- Permission problems
Best Practices
When using the agent:
- Be specific with your requests
- Provide full file paths when needed
- Review suggested changes before applying
- Use version control for safety
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
Dependencies
Core dependencies:
@agenite/agent: Core agent framework
@agenite/tool: Tool creation utilities
shared-llm-provider: LLM provider implementation
Dev dependencies:
typescript: Type support
tsx: TypeScript execution
@types/node: Node.js type definitions
License
MIT License
Acknowledgments
- Built with @agenite framework
- Inspired by pair programming practices
- Uses modern AI techniques for code understanding