Metadata-Version: 2.4
Name: chesterton
Version: 0.1.1
Summary: Remember why code exists, and speak up before it's removed.
License-Expression: MIT
Project-URL: Homepage, https://github.com/Blueangelman36/chesterton
Project-URL: Repository, https://github.com/Blueangelman36/chesterton
Project-URL: Issues, https://github.com/Blueangelman36/chesterton/issues
Keywords: git,hooks,pre-commit,code-review,documentation,refactoring
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# chesterton

*Don't take down a fence until you know why it was put up.*

`fence` remembers **why** code exists, and speaks up when a commit is about to delete it.

Some of the most painful bugs start the same way: someone removes a strange-looking retry loop,
a `sleep(50)`, or an `if` that "can't happen", and it turns out it could. The person who wrote it
knew why. That reason lived in a closed pull request, a chat thread, or their head, and none of
those are open when the next person edits the file.

Notes are pinned to statements in the syntax tree rather than to line numbers, so they follow the
code through reformatting, identifier renames, and moves between files.

```bash
pip install chesterton
cd your-project
fence init
fence add src/client.py:42 -m "Vendor API returns 200 on auth failure; the error is in the body."
```

Later, when someone deletes that check:

```text
$ git commit -m "Simplify fetch"
[REMOVED] 1559744b  src/client.py:42  in Client.fetch
    why: Vendor API returns 200 on auth failure; the error is in the body.
    was: if resp.json().get("error") == "unauthorized":

fence: 1 note(s) checked: 1 REMOVED
  reason no longer applies?    fence retire <id> -m "what changed"
  code lives somewhere new?    fence reanchor <id> <file>:<line>
  commit anyway?               git commit --no-verify
```

Renaming or moving that code instead blocks nothing — the note follows it.

## For coding agents

```bash
fence why src/client.py --json    # before changing code you did not write
fence check --json                # what a blocked commit is objecting to
fence init --agents               # write the instructions where agents will find them
```

## Status

A prototype of the core loop: anchoring plus the hook. **Python source only** — the design is not
Python-specific, and a tree-sitter implementation for other languages is in progress. Measured
against requests, flask, pytest, django and a slice of the standard library (3,613 files): no
false alarms, and every deliberate deletion caught.

No dependencies. Python 3.11+. <!-- asof:python-version --> MIT licensed.

Full documentation, the note format specification, and the conformance suite live in the
repository.
