Still in development, will be deployed soon
An intelligent AI-powered software engineering agent that can analyze, understand, and execute various programming tasks autonomously.
- AI-Powered: Uses Vercel's AI SDK and multi-model support for intelligent task understanding and execution
- Multi-Tool Support: Equipped with various development tools for comprehensive code manipulation
- Secure Operations: Implements robust security measures including path validation and glob pattern sanitization
- TypeScript: Built with modern TypeScript for type safety and better developer experience
- Bash Tool (
tools/bash.ts): Execute shell commands with timeout protection - Read Tool (
tools/read.ts): Read file contents safely - Write Tool (
tools/write.ts): Create and modify files - Edit Tool (
tools/edit.ts): Perform targeted file edits - Glob Tool (
tools/glob.ts): Search files using glob patterns with security validation - Grep Tool (
tools/grep.ts): Search within file contents
- Path Validation (
utils/safePath.ts): Prevents directory traversal attacks - Glob Pattern Sanitization (
utils/valGlobPattern.ts): Validates and sanitizes file patterns - Input Validation: Comprehensive validation using Zod schemas
- Node.js (v16 or higher)
- npm or yarn
- OpenAI API key
- Clone the repository:
git clone <repository-url>
cd codegenie/agent- Install dependencies:
npm install- Set up environment variables:
Create a
.envfile in theagentdirectory:
OPENAI_API_KEY=your_openai_api_key_here
Run the agent:
npm startThe agent will prompt you for a task description. Example tasks:
- "Create a new React component for user authentication"
- "Find all TypeScript files with TODO comments"
- "Refactor the utils directory to use ES6 modules"
- "Add unit tests for the validation functions"
OPENAI_API_KEY: Your OpenAI API key (required) OR - Choose your own model from ai sdk
- Maximum bash command timeout: 120 seconds
- Maximum glob pattern length: 200 characters
- Maximum glob results: 100 files
- Maximum agent steps: 10 per task
The agent implements multiple security layers:
- Path Validation: Prevents access to system directories and parent directory traversal
- Pattern Sanitization: Validates glob patterns to prevent injection attacks
- Input Validation: Uses Zod schemas to validate all inputs
- Ignored Directories: Automatically excludes
node_modulesanddistdirectories
ai: AI SDK for model integration@ai-sdk/openai: OpenAI providerzod: Schema validationfast-glob: Efficient file pattern matchingdotenv: Environment variable management
tsx: TypeScript execution@types/node: Node.js type definitionstypescript: TypeScript compiler
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
ISC License
Examples
User: "Find all TypeScript files in the src directory"
Agent: Uses glob tool to search for `**/*.ts` patternsUser: "Analyze the authentication logic in the codebase"
Agent: Uses grep and read tools to examine auth-related codeUser: "Convert all require() statements to ES6 imports"
Agent: Uses glob to find JS files, read to examine content, and edit to make changes- API Key Error: Ensure your OpenAI API key is correctly set in
.env - Permission Denied: Check file permissions for target directories
- Pattern Validation Failed: Ensure glob patterns are valid and don't contain dangerous sequences
The agent logs all tool executions and responses to help with debugging.
Built by Shilendra Singh - - - > "Hello guys"