Metadata-Version: 2.4
Name: brepl
Version: 0.1.0
Summary: A headless universal REPL driver for LLMs. Supports PTY, TUI apps, and Tab completion.
Author-email: Maxime Rivest <mrive052@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/MaximeRivest/brepl
Project-URL: Repository, https://github.com/MaximeRivest/brepl
Project-URL: Documentation, https://github.com/MaximeRivest/brepl#readme
Project-URL: Issues, https://github.com/MaximeRivest/brepl/issues
Keywords: repl,pty,terminal,llm,mcp,autocomplete,tab-completion,tui,headless,automation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Shells
Classifier: Topic :: Terminals :: Terminal Emulators/X Terminals
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyte>=0.8.1
Requires-Dist: psutil>=5.9.0
Requires-Dist: mcp>=1.0.0
Dynamic: license-file

# REPL Bridge

**REPL Bridge** is a Python library that turns any CLI tool (Bash, Python, Julia, SSH, Vim) into a programmatic object controllable by code or LLMs.

It uses `node-pty` style process forking combined with a headless VT100 emulator (`pyte`) to maintain perfect state of the visual terminal, allowing for robust interaction with TUI applications and complex shells.

## Features

- **Universal:** Works with any binary (Python, Node, Bash, top, vim).
- **Stateful:** Maintains a 2D grid of the screen (supports colors, cursor position).
- **Smart Waiting:** Detects when commands finish via Silence Detection, Regex, or Kernel Introspection.
- **Tab Completion:** Includes a cursor-differential engine to solve inline vs grid completion ambiguity.
- **TUI Support:** Handles `htop`, `fzf`, and `tmux` rendering correctly.

## Installation

```bash
pip install .
```

## Quick Start

```python
from brepl import REPLSession

# Start a session
session = REPLSession("bash")

# Run a command (atomic execution)
result = session.execute("ls -la")
print(result.output)

# Interactive / TUI mode
session.send_text("top", enter=True)
session.wait(timeout=1.0)
print(session.screen.render()) # Prints the top table
session.send_key("q")
```

## License

MIT License - see LICENSE file for details.
