Metadata-Version: 2.4
Name: jugaad-agent
Version: 0.1.0
Summary: Local-first self-healing Ubuntu terminal agent powered by LangGraph and Ollama
Author: JugaadAgent
License-Expression: MIT
Project-URL: Homepage, https://github.com/jugaad-agent/jugaad-agent
Project-URL: Repository, https://github.com/jugaad-agent/jugaad-agent
Project-URL: Issues, https://github.com/jugaad-agent/jugaad-agent/issues
Keywords: langgraph,ollama,cli,agent,ubuntu,terminal
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: langgraph>=0.2.0
Requires-Dist: langchain-ollama>=0.1.0
Requires-Dist: langchain-core>=0.3.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=5.0.0; extra == "dev"
Dynamic: license-file

# JugaadAgent

Local-first, self-healing Ubuntu terminal agent. Natural language in, bash out — LangGraph state loops, Ollama, risk guardrails, and Ubuntu diagnostics on failure.

## Install

Requires **Python 3.10+**, **Linux**, and [Ollama](https://ollama.com/) running locally.

```bash
pip install jugaad-agent
```

Recommended for CLI tools (isolated, no venv juggling):

```bash
pipx install jugaad-agent
```

Pull a model once Ollama is running:

```bash
ollama serve          # if not already running
ollama pull qwen2.5-coder:latest
```

### From source (development)

```bash
git clone https://github.com/jugaad-agent/jugaad-agent.git
cd jugaad-agent
pip install -e ".[dev]"
```

## Usage

```bash
jaa                              # interactive
jaa "create a folder demo and list it"
jaa "free port 8080" --dry-run
jaa "install htop" --yes         # auto-approve risky commands
python -m jugaad_agent "echo hi"
```

`jugaad` is an alias for `jaa`.

| Flag | Description |
|------|-------------|
| `--model`, `-m` | Ollama model (`JUGAAD_MODEL`) |
| `--max-retries` | Self-heal ceiling (default 3) |
| `--dry-run` | Generate without executing |
| `--yes`, `-y` | Skip HITL for MEDIUM/HIGH risk |

### Environment

| Variable | Default | Meaning |
|----------|---------|---------|
| `JUGAAD_MODEL` | `qwen2.5-coder:latest` | Ollama model |
| `JUGAAD_BASE_URL` | `http://127.0.0.1:11434` | Ollama endpoint |
| `JUGAAD_MAX_RETRIES` | `3` | Max self-heal attempts |

Copy [`.agent_rules.md.example`](.agent_rules.md.example) to `.agent_rules.md` in your project directory for workspace-specific preferences.

## How it works

```
memory → generator → guardrail → executor
              ↑            fail + retries
```

| Module | Role |
|--------|------|
| `state.py` | Pydantic state + history reducer |
| `nodes.py` | LLM generation + shell execution |
| `guardrails.py` | Risk scan + human approval |
| `diagnostics.py` | Enrich stderr (`lsof`, missing binaries) |
| `memory.py` | Load `.agent_rules.md` |
| `graph.py` | LangGraph topology |

## Safety

LOW risk commands run automatically. MEDIUM/HIGH risk opens a `[Y]es / [N]o / [E]dit` prompt. This tool executes real shell commands on your machine — review every approval.

## Publish (maintainers)

```bash
pip install build twine
python -m build
twine check dist/*
twine upload dist/*
```

## License

MIT
