Skip to main content

Minimal diff format and robust edit applier for LLM-driven code editing

Project description

lcea

lcea is the short name for the project formerly called llm-code-edit-applier. The shorter name is used for the package and CLI command so it is easier to type and remember.

This project provides:

  • a minimal diff-like edit format for LLM output
  • a prompt template that constrains model output to that format
  • a robust applier that parses, validates, and applies edits to a workspace

Minimal edit format

Each edit targets one file and uses a single fenced block:

path/to/file.py
```edit
<<<<<<< SEARCH
old text
=======
new text
>>>>>>> REPLACE

Rules:

- The line before the fenced block is the relative file path.
- Fence info string must be `edit`.
- `SEARCH` is matched literally.
- `REPLACE` is the replacement text.
- Empty `SEARCH` means create at file start when the file already exists, or create a new file.
- Empty `REPLACE` means delete the matched text.
- A `SEARCH` block must match exactly once in the target file unless `SEARCH` is empty.

## Prompt template

See `src/llm_edit_applier/prompts.md`.

## Run tests

```bash
python -m pytest

CLI

After installation:

lcea spec
lcea prompt
lcea apply edits.txt --root .
cat edits.txt | lcea apply --root .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lcea-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lcea-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file lcea-0.1.0.tar.gz.

File metadata

  • Download URL: lcea-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lcea-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2af388e33c0a90d05c17dd54366e1eb2bf0fd2378f90fb1803bcdb825e597fad
MD5 33117971fc8450e6d3efbfea95033aaf
BLAKE2b-256 5ac889bd087aa0a0b5ffeef28523df7ebe49d14f2577261d38bfe8a6ceb3fdd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for lcea-0.1.0.tar.gz:

Publisher: publish.yml on TingjiaInFuture/lcea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lcea-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lcea-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lcea-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a913a374611d18c346380adba334f3c713cd805bcdc4364b2a37d4ff85e5d89
MD5 5ed33142dcc75350f459bdf9b6e9160c
BLAKE2b-256 aa5715489632b37ffd9b62180c09f22a2280ac5dee4cfa9c07bdb00639de61c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for lcea-0.1.0-py3-none-any.whl:

Publisher: publish.yml on TingjiaInFuture/lcea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page