Metadata-Version: 2.4
Name: opencodr
Version: 0.1.8
Summary: open source terminal-based coding agent
Author-email: notpolomarco@icloud.com
Requires-Python: >=3.13
Requires-Dist: aiofiles==24.1.0
Requires-Dist: aiohappyeyeballs==2.4.6
Requires-Dist: aiohttp==3.11.13
Requires-Dist: aiosignal==1.3.2
Requires-Dist: annotated-types==0.7.0
Requires-Dist: anyio==4.8.0
Requires-Dist: attrs==25.1.0
Requires-Dist: certifi==2025.1.31
Requires-Dist: charset-normalizer==3.4.1
Requires-Dist: click==8.1.8
Requires-Dist: debugpy==1.8.12
Requires-Dist: distro==1.9.0
Requires-Dist: docstring-parser==0.16
Requires-Dist: filelock==3.17.0
Requires-Dist: frozenlist==1.5.0
Requires-Dist: fsspec==2025.2.0
Requires-Dist: h11==0.14.0
Requires-Dist: httpcore==1.0.7
Requires-Dist: httpx-sse==0.4.0
Requires-Dist: httpx==0.28.1
Requires-Dist: huggingface-hub==0.29.2
Requires-Dist: idna==3.10
Requires-Dist: importlib-metadata==8.6.1
Requires-Dist: jinja2==3.1.5
Requires-Dist: jiter==0.8.2
Requires-Dist: jsonschema-specifications==2024.10.1
Requires-Dist: jsonschema==4.23.0
Requires-Dist: litellm==1.63.0
Requires-Dist: markdown-it-py==3.0.0
Requires-Dist: markupsafe==3.0.2
Requires-Dist: mcp>=1.4.1
Requires-Dist: mdurl==0.1.2
Requires-Dist: multidict==6.1.0
Requires-Dist: openai==1.65.2
Requires-Dist: packaging==24.2
Requires-Dist: platformdirs>=4.3.6
Requires-Dist: prompt-toolkit==3.0.50
Requires-Dist: propcache==0.3.0
Requires-Dist: pydantic-core==2.27.2
Requires-Dist: pydantic-settings==2.8.1
Requires-Dist: pydantic==2.10.6
Requires-Dist: pygments==2.19.1
Requires-Dist: python-dotenv==1.0.1
Requires-Dist: pyyaml==6.0.2
Requires-Dist: questionary==2.1.0
Requires-Dist: referencing==0.36.2
Requires-Dist: regex==2024.11.6
Requires-Dist: requests==2.32.3
Requires-Dist: rich==13.9.4
Requires-Dist: rpds-py==0.23.1
Requires-Dist: shellingham==1.5.4
Requires-Dist: sniffio==1.3.1
Requires-Dist: sse-starlette==2.2.1
Requires-Dist: starlette==0.46.0
Requires-Dist: tenacity==9.0.0
Requires-Dist: tiktoken==0.9.0
Requires-Dist: tokenizers==0.21.0
Requires-Dist: tqdm==4.67.1
Requires-Dist: typer==0.15.2
Requires-Dist: typing-extensions==4.12.2
Requires-Dist: urllib3==2.3.0
Requires-Dist: uvicorn==0.34.0
Requires-Dist: wcwidth==0.2.13
Requires-Dist: yarl==1.18.3
Requires-Dist: zipp==3.21.0
Description-Content-Type: text/markdown

<div align="center"  id="readme-top">
  <a>
    <img src="https://raw.githubusercontent.com/notpolomarco/opencodr/main/images/logo.svg" alt="Logo" width="120" height="80">
  </a>
  <p align="center">
    Open source coding agent in your terminal
    <br />
    &middot;
    <a href="https://github.com/notpolomarco/opencodr/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
    &middot;
    <a href="https://github.com/notpolomarco/opencodr/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
  </p>
</div>

<details>
  <summary>Table of Contents</summary>
  <ol>
    <li>
      <a href="#about-the-project">About The Project</a>
      <ul>
        <li><a href="#built-with">Built With</a></li>
      </ul>
    </li>
    <li>
      <a href="#getting-started">Getting Started</a>
      <ul>
        <li><a href="#prerequisites">Prerequisites</a></li>
        <li><a href="#installation">Installation</a></li>
        <li><a href="#initialization">Initialization</a></li>
        <li><a href="#configuration">Configuration</a></li>
      </ul>
    </li>
    <li>
    <a href="#usage">Usage</a>
    <ul>
        <li><a href="#generate">Generate</a></li>
        <li><a href="#workspace">Workspace</a></li>
      </ul>
    </li>
    <li><a href="#contributing">Contributing</a></li>
  </ol>
</details>

<!-- ABOUT THE PROJECT -->

## About The Project

<p align="">
<img src="https://github.com/notpolomarco/opencodr/raw/main/images/mascot.jpeg" alt="Product Name Screen Shot" width="250" height="250">
</p>

<div align="">

`opencodr` is a simple recursive function combined with the [Function Calling API](https://docs.litellm.ai/docs/completion/function_call) + [Model Context Protocol](https://modelcontextprotocol.io/introduction) to create agentic behavior.

- ❌ No Auth Screens
- ❌ No Provider Lock-in

API Key(s) + A Terminal Is All You Need™️

</div>

## Built With

[![LiteLLM](https://img.shields.io/badge/%F0%9F%9A%85_litellm-lightblue?style=for-the-badge&link=https%3A%2F%2Fdocs.litellm.ai%2F)](https://docs.litellm.ai/)

[![Pydantic v2](https://img.shields.io/endpoint?style=for-the-badge&url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)

[![Typer][typer-logo]](https://typer.tiangolo.com/)

[![Rich][rich-logo]](https://rich.readthedocs.io/en/stable/introduction.html)

[![Docker](https://img.shields.io/badge/Docker-blue?logo=docker&logoColor=fff&style=for-the-badge)](https://docs.docker.com/)

<!-- GETTING STARTED -->

## Getting Started

### Prerequisites

- [Python>=3.13](https://www.python.org/downloads/)
- [Docker](https://docs.docker.com/get-started/) (Optional but _highly_ recommended)

### Installation

```
> MacBookPro:example user$ pip install opencodr
```

```
> MacBookPro:example user$ opencodr init opencodr --help

✋ opencodr project not initialized. Run `opencodr init`
```

### Initialization

Run the following command from the **root** of your project:

```
> MacBookPro:example user$ opencodr init

📄 .rc file generated at /workspace/example/.opencodr/.rc
✔️ .opencodr added to .gitignore
```

```
> MacBookPro:example user$ opencodr --help

 Usage: opencodr [OPTIONS] COMMAND [ARGS]...

╭─ Options ────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the     │
│                               current shell.                 │
│ --show-completion             Show completion for the        │
│                               current shell, to copy it or   │
│                               customize the installation.    │
│ --help                        Show this message and exit.    │
╰──────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────╮
│ gen                                                          │
│ workspace                                                    │
╰──────────────────────────────────────────────────────────────╯
```

### Configuration

`/workspace/example/.opencodr/.rc`

```bash
# List of allowed directories, Separated with colons (:) e.g "/path/to/a/dir:/path/to/b/dir"
export OC_PATH="$(pwd)"

# <provider>/<model_name>
export OC_MODEL="openrouter/openai/gpt-4o"

# export OC_BASE_URL=""
# export OC_MAX_TOKENS=""
# export OC_MAX_DEPTH=""

# Provider API Keys
export OPENROUTER_API_KEY=""
# export OPENAI_API_KEY=""
# export ANTHROPIC_API_KEY=""
```

> **_NOTE:_** See [https://docs.litellm.ai/docs/providers](https://docs.litellm.ai/docs/providers) for the list of supported models

`/workspace/example/.opencodr/mcp.json` _(Optional)_

```json
{
  "sqlite": {
    "command": "uvx",
    "args": ["mcp-server-sqlite", "--db-path", "./test.db"]
  },
  "puppeteer": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-puppeteer"]
  }
}
```

Prompt Overrides _(Optional)_

`/workspace/example/.opencodr/SYSTEM.txt`

`/workspace/example/.opencodr/REPROMPT.txt`

<p align="right">(<a href="#readme-top">back to top</a>)</p>

## Usage

### generate

```
> MacBookPro:example user$ opencodr gen --help

 Usage: opencodr gen [OPTIONS]

╭─ Options ────────────────────────────────────────────────────╮
│ --f           TEXT  Load prompt from file [default: None]    │
│ --help              Show this message and exit.              │
╰──────────────────────────────────────────────────────────────╯
```

### workspace

> **_NOTE:_** Requires Docker

```
> MacBookPro:example user$ opencodr workspace --help

 Usage: opencodr workspace [OPTIONS] COMMAND [ARGS]...

╭─ Options ────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                  │
╰──────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────╮
│ create   Creates a docker image to sandbox the agent         │
│ start    Shortcut to start the container                     │
│ stop     Shortcut to stop the container                      │
╰──────────────────────────────────────────────────────────────╯
```

# Contributing

### Prerequisites

- [uv](https://docs.astral.sh/uv/getting-started/installation/)

### Repo Setup

```bash
git clone https://github.com/notpolomarco/opencodr.git
cd opencodr
```

### Create Virtual Environment

```bash
uv venv
source .venv/bin/activate
```

### Install

```bash
uv pip install -e ".[dev]"
pre-commit install
pre-commit install --hook-type pre-push
```

> _*NOTE*_: to test any new features in workspace mode, build the base image from `/opencodr/dockerfile.dev`
```bash
uv build
docker build -t opencodr/base -f dockerfile.dev .
```


[rich-logo]: https://img.shields.io/badge/rich-white?style=for-the-badge
[typer-logo]: https://img.shields.io/badge/typer-black?style=for-the-badge&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8%2BCjxzdmcKICAgaWQ9InN2ZzgiCiAgIHZlcnNpb249IjEuMSIKICAgdmlld0JveD0iMCAwIDE1OC43NSAxMTAuNTA5MzIiCiAgIGhlaWdodD0iMTEwLjUwOTMybW0iCiAgIHdpZHRoPSIxNTguNzVtbSIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI%2BCiAgPGRlZnMKICAgICBpZD0iZGVmczIiIC8%2BCiAgPG1ldGFkYXRhCiAgICAgaWQ9Im1ldGFkYXRhNSI%2BCiAgICA8cmRmOlJERj4KICAgICAgPGNjOldvcmsKICAgICAgICAgcmRmOmFib3V0PSIiPgogICAgICAgIDxkYzpmb3JtYXQ%2BaW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PgogICAgICAgIDxkYzp0eXBlCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz4KICAgICAgPC9jYzpXb3JrPgogICAgPC9yZGY6UkRGPgogIDwvbWV0YWRhdGE%2BCiAgPHJlY3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