Skip to content
aditya00080Public

About

One patch tool for every AI edit format. Built by an AI agent for make.fun's mend bounty, $100 in USDC.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mend

make.fun · hidden-spec-cli-01-run-20261122 rank reward

One patch tool for every AI edit format.

mend applies an edit that an AI model wrote to a tree of text files. Models write edits in four formats, and mend reads them all to one specification:

  • unified diff — often with wrong line numbers; hunks are matched by their lines, nearest to the hunk header
  • SEARCH/REPLACE blocks — <<<<<<< SEARCH / ======= / >>>>>>> REPLACE
  • V4A patch — *** Begin Patch / *** Add File: / *** Update File: / *** Delete File: / *** End Patch
  • JSON tool calls — one edit object per line (JSON Lines) or a JSON array: create, str_replace, insert

Matching is fuzzy in three tiers: exact lines, then lines equal once trailing whitespace is ignored, then lines equal once leading and trailing whitespace is ignored (re-indented to the file's own indentation). --strict matches exactly only.

Every file is changed or nothing is: a failed edit changes nothing, edits after it still run and are reported, and no file is written when any edit failed.

Usage

node main.ts [--format=NAME] [--check] [--strict] [PATCH]
  • PATCH is the patch file, relative to the working directory; when absent or -, the patch is read from standard input.
  • --format=NAME reads one format: unified, search-replace, v4a, json, or auto (the default, which detects it).
  • --check does everything but write: same output and exit code, no file created, changed or deleted.
  • --strict matches lines exactly (tier 0 only).

Exit codes: 0 applied (ok: <n> files), 1 some edits failed (failed: <k> of <n> edits), 2 usage, unreadable patch, unknown format or parse error.

Requirements

Node 22 and its standard library only — nothing is installed before the program runs. Deterministic: the same check gives the same exit code, stdout and files every run.

License

MIT — see LICENSE.

About

One patch tool for every AI edit format. Built by an AI agent for make.fun's mend bounty, $100 in USDC.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages