convez.ai
Agente
nirjalalala

my-mini-coding-agent

nirjalalala/my-mini-coding-agent

Ver no GitHub
InicialPluginScore · de 0 a 100

A lightweight CLI AI code editor inspired by Cursor and Claude Code, built with Google’s Gemini API. It accepts coding tasks and uses predefined actions like scanning directories, reading/editing files, and running Python scripts to iteratively solve problems. It demonstrates how an LLM can function as a simple yet effective custom coding agent.

Instalação

$npx convez-ai nirjalalala/my-mini-coding-agent

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
1
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
2

README

A tradução para o português deste README ainda está na fila.

Mini AI Coding Agent

A lightweight CLI coding agent powered by Google's free Gemini API. Give it a natural language task and it autonomously reads, searches, writes, and runs code to complete it — iterating until the job is done.

Features

  • Iterative agentic loop: calls tools, feeds results back, keeps going until finished (up to 20 iterations)
  • Operates on any directory you point it at (not just the bundled example)
  • 5 built-in tools: list files, read files, search with regex, write files, run Python
  • Path traversal protection: agent is sandboxed to the working directory

Tech Stack

  • Python 3.12+
  • Google Gemini API (gemini-2.5-flash) — free tier available at aistudio.google.com

Installation

git clone https://github.com/nirjalalala/my-mini-coding-agent.git
cd my-mini-coding-agent

python -m venv .venv
source .venv/bin/activate        # Linux/Mac
.venv\Scripts\activate           # Windows

pip install -e .
pip install -e ".[dev]"          # for tests and linting

Set your API key in a .env file:

GEMINI_API_KEY=your_key_here

Usage

# Default working directory (calculator/ example project)
.venv/bin/python main.py "Fix the bug in the calculator"

# Point at any project
.venv/bin/python main.py "Add a docstring to every function" --working-dir ./my-project

# Verbose mode shows per-iteration token usage
.venv/bin/python main.py "Run the tests and explain any failures" --verbose

Sample Commands

Explore and explain the codebase

python main.py "List all files and give me a summary of what this project does" --working-dir .

Run tests and explain results

python main.py "Run the tests and explain any failures" --working-dir . --verbose

Read and explain a specific file

python main.py "Read and explain how call_function.py works"

Fix a bug

python main.py "Find and fix any bugs in the calculator" --verbose

Write new code

python main.py "Add a method to the Calculator class that computes the average of a list of numbers, then run the tests"

Search across the codebase

python main.py "Find all places where path traversal is checked and explain the security approach" --working-dir .

Multi-step task

python main.py "Add a square root method to Calculator, write a test for it, then run all tests to confirm they pass"

Development

# Run tests
.venv/bin/python -m pytest

# Run tests with coverage
.venv/bin/python -m pytest --cov=functions --cov=call_function

# Lint
.venv/bin/python -m ruff check .

# Format
.venv/bin/python -m ruff format .

Project Structure

main.py              # CLI entry point + agentic loop
call_function.py     # Dispatches LLM tool calls to handlers
functions/
  result.py          # ToolResult TypedDict (shared return type)
  get_files_info.py  # List directory contents
  get_file_content.py# Read file contents (max 10K chars)
  search_files.py    # Regex search across files (grep-style)
  write_file.py      # Write / create files
  run_python_file.py # Execute Python scripts
calculator/          # Example project the agent operates on
tests/               # pytest test suite for all tool functions

Disclaimer

This is a learning project. The agent can write and overwrite files — always use it on code that is version-controlled.

Ver o original no GitHub

Bom para

Relacionados