Metadata-Version: 2.4
Name: moesniper
Version: 0.7.2
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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 :: Rust
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Editors
Summary: Escape-proof precision file editing — Python bindings for moesniper
Keywords: editor,llm,agent,hex,precision
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/moeshawky/moesniper/blob/main/CHANGELOG.md
Project-URL: Homepage, https://github.com/moeshawky/moesniper
Project-URL: Issues, https://github.com/moeshawky/moesniper/issues

# sniper-py

> Python bindings for moesniper — escape-proof precision file editor for LLM agents.

[![PyPI](https://img.shields.io/pypi/v/sniper-py)](https://pypi.org/project/sniper-py/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)]()
[![Python: 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)]()

## Installation

```bash
pip install sniper-py
```

## Overview

`sniper-py` provides native Python bindings to the [`moesniper`](https://github.com/moeshawky/moesniper) Rust CLI — an escape-proof precision file editor designed for LLM agents. All file edits are:

- **Hex-encoded** to prevent shell corruption
- **Atomic** (temp file + rename — never inconsistent)
- **Tracked** via automatic backups and multi-step undo
- **Paced** with metabolic resource guards to prevent runaway edits

## Usage

```python
from sniper import splice

# Replace lines 5-5 with hex-encoded content
result = splice("file.rs", start=5, end=5, hex_content="68656c6c6f")
print(result.status)  # "ok"
print(result.line_shift)  # 0
```

## Features

| Feature | Description |
|---------|-------------|
| **Hex-encoded payloads** | All content is hex strings, zero shell injection risk |
| **Atomic writes** | Files are never in an inconsistent state during edit |
| **Multi-step undo** | Each edit creates a backup; undo restores previous state |
| **Dry-run preview** | Preview diffs before applying changes |
| **Indentation safety** | Validates and auto-corrects indentation on edits |
| **Resource pacing** | Built-in metabolic guards prevent runaway edits |

## License

MIT ([source](https://github.com/moeshawky/moesniper))

