A simplified AI coding assistant.
Project description
✨ tinycoder ✨
Your command-line AI coding assistant 🤖 integrated with Git! Pure Python, zero dependencies.
TinyCoder is a Python-based tool designed to help you interact with Large Language Models (LLMs) for coding tasks directly within your terminal. It analyzes your codebase, builds context for the LLM, applies suggested code changes safely, and integrates seamlessly with your Git workflow. Minimal dependencies, maximum productivity!
🚀 Key Features
- 💻 Command-Line Interface: Smooth terminal interaction with multiline input and potential path autocompletion.
- 🧠 Intelligent Context Building:
- File Management: Easily add/remove files (
/add,/drop,/files). - Automatic File Identification: Suggests relevant files to add to the context based on your request (
/askfor files feature). - Repo Map: Generates a high-level codebase map (
RepoMap) for broader LLM understanding. Controlled via/repomap [on|off]. - Smart Prompts: Constructs detailed prompts using file content and repo structure (
PromptBuilder).
- File Management: Easily add/remove files (
- 🤖 Multiple LLM Support: Works with Google Gemini, DeepSeek, Anthropic, Together AI, and Ollama. Configure via
--providerand--modelflags, or environment variables (GEMINI_API_KEY,DEEPSEEK_API_KEY,ANTHROPIC_API_KEY,TOGETHER_API_KEY). - ✏️ Safe Code Editing:
- Parses LLM responses using a structured XML format (
EditParser). - Applies changes with user confirmation and diff previews (
CodeApplier). - Handles file creation and modification reliably.
- Linting & Reflection: Automatically lints applied code and prompts user to let the LLM fix errors.
- Parses LLM responses using a structured XML format (
- 🔄 Modes of Operation: Switch between
codemode (for edits) andaskmode (for questions) using/codeand/ask. - 🌿 Git Integration:
- Initializes Git repo if needed (
GitManager). - Commits changes applied by the last successful LLM edit (
/commit). - Rolls back the last TinyCoder commit (
/undo).
- Initializes Git repo if needed (
- ✅ Linters & Validation: Includes built-in linters for Python, HTML, and CSS to catch issues after applying edits, with an option to auto-fix.
- 📜 Rules Engine:
- Define project-specific coding standards (e.g.,
style_guide.md) in.tinycoder/rules/(custom) or use built-in rules. - Manage active rules per-project using
/rules list|enable|disable. - Configuration stored in the user's standard application config directory.
- Define project-specific coding standards (e.g.,
- 🧪 Test Runner: Execute project tests (like
pytest) using the/testscommand (test_runner.py). - 💾 Chat History: Persists conversations to
.tinycoder_historyin the user's standard application data directory (ChatHistoryManager) and allows resuming with--continue-chat. - ⚙️ Command Handling: Rich set of commands for session control (
CommandHandler). - 🐚 Shell Execution: Run shell commands directly using
!<command>. Output can optionally be added to the chat context.
🛠️ Installation
Requirements: Python 3.8+
Option 1: Install directly from GitHub
python3 -m pip install git+https://github.com/koenvaneijk/tinycoder.git
Option 2: Clone and install locally
# 1. Clone the repository
git clone https://github.com/koenvaneijk/tinycoder.git
cd tinycoder
# 2. Install (choose one)
# Editable mode (for development)
python3 -m pip install -e .
# Standard install
# python3 -m pip install .
🔑 API Keys:
- Set the required environment variables for your chosen cloud LLM provider:
- Gemini:
GEMINI_API_KEY - DeepSeek:
DEEPSEEK_API_KEY - Anthropic:
ANTHROPIC_API_KEY - Together AI:
TOGETHER_API_KEY
- Gemini:
- Ollama runs locally and does not require an API key.
- You can also set
OLLAMA_HOSTif your Ollama instance is not at the defaulthttp://localhost:11434.
▶️ Usage
Start TinyCoder in your project's root directory:
You can specify the LLM provider and model:
# Use the default model for a specific provider
tinycoder --provider gemini # Uses default Gemini model
tinycoder --provider anthropic # Uses default Anthropic model
tinycoder --provider together # Uses default Together AI model
tinycoder --provider ollama # Uses default Ollama model (e.g., qwen3:14b)
# Specify both provider and model name (no prefix needed on model)
tinycoder --provider gemini --model gemini-1.5-flash
tinycoder --provider deepseek --model deepseek-coder
tinycoder --provider ollama --model llama3
tinycoder --provider anthropic --model claude-3-sonnet-20240229
# If --provider is omitted, --model assumes Ollama or uses legacy prefixes
tinycoder --model llama3 # Assumes Ollama provider
tinycoder --model gemini-1.5-pro # Uses legacy prefix detection
tinycoder --model deepseek-coder # Uses legacy prefix detection
# tinycoder --model my-custom-ollama-model # Assumes Ollama provider
# Use the legacy flag (still supported)
tinycoder --legacy-model gemini-1.5-flash
# Load the last used model from user preferences (default behavior if no flags)
tinycoder
# Override Ollama host if not default
export OLLAMA_HOST="http://my-ollama-server:11434"
tinycoder --provider ollama --model mistral
# Start with initial files and an instruction
tinycoder --provider gemini src/main.py src/utils.py "Refactor the main loop in main.py"
# Continue the last chat session
tinycoder --continue-chat
# Run non-interactively (applies changes and exits)
tinycoder --code "Implement the function foo in service.py using utils.bar"
Quick Command Reference:
/add <file> ["file 2"]...: Add file(s) to the chat context./drop <file> ["file 2"]...: Remove file(s) from the chat context./files: List files currently in the chat./ask [question]: Switch to ASK mode or ask a question directly./code [instruction]: Switch to CODE mode or give an instruction directly./commit: Commit the changes applied by the last successful LLM edit./undo: Revert the last TinyCoder commit./tests: Run project tests (e.g.,pytestin./tests)./rules list: List available rules and their status for the project./rules enable <rule_name>: Enable a specific rule./rules disable <rule_name>: Disable a specific rule./repomap [on|off]: Enable or disable including the repository map in prompts./clear: Clear the chat history./reset: Clear history and remove all files from context./help: Show help message./quitor/exitorCtrl+C/Ctrl+D: Exit.!<command>: Execute a shell command. You'll be prompted to add the output to the chat.
🤝 Contributing
Contributions are welcome! Please read the CONTRIBUTING.md file (if it exists) for guidelines. (Placeholder - create this file if needed)
📜 License
This project is licensed under the AGPLv3+ License. If you need a different license, please contact me at vaneijk.koen@gmail.com.
🙏 Credits
TinyCoder draws inspiration and ideas from the excellent Aider.Chat project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinycoder-0.3.9.tar.gz.
File metadata
- Download URL: tinycoder-0.3.9.tar.gz
- Upload date:
- Size: 146.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16b995dae1665d4eea348f91da3805136c086d8290e038272dbc0c500a7ae8b4
|
|
| MD5 |
4be28070f8475a884bd8e5101a80aa31
|
|
| BLAKE2b-256 |
e32acc9054a32987115a6bdd7dec5f69b4f10d8496e34c3f42696d589538691b
|
File details
Details for the file tinycoder-0.3.9-py3-none-any.whl.
File metadata
- Download URL: tinycoder-0.3.9-py3-none-any.whl
- Upload date:
- Size: 166.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f95950301ad16300acef882f53ad357e49656851864e13929e794feee53b08a
|
|
| MD5 |
c19b3417a42a85f380828adc6c9739c0
|
|
| BLAKE2b-256 |
ef28f3af3e1ff6b2003acacf1a787c2c7335f8f6221a631d44e5e1650ba44d1e
|