Myers diff bounded
myers-diff-bounded · version 1.0.0 · Sequences & diffs · free, no key needed
Produce a canonical Myers edit script within a caller distance cap, or a deterministic over-cap result.
Use when you need to: create bounded Myers diff · produce shortest edit script · diff two token arrays with a cap.
Decide before calling
Read the versioned contract and the supported scope below. Reuse myers-diff-bounded@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use myers-diff-bounded@1.0.0 for create bounded Myers diff. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- create bounded Myers diff
- produce shortest edit script
- diff two token arrays with a cap
- return canonical insert delete operations
- reconstruct a bounded sequence diff
- find deterministic Myers operations
Not supported
- line parsing or text tokenization
- returning only distance (use myers-distance-bounded)
Behavior
- Operations reconstruct b from a; equal consumes both, delete consumes a, and insert consumes b.
- Implements Myers 1986; frontier ties choose deletion, making ambiguous shortest scripts canonical.
Input
a(array of string, required): max items 256; each max length 1024b(array of string, required): max items 256; each max length 1024max_distance(integer, required): min 0; max 512
Output
reference(constant "Myers 1986; RFC 3284 section 5", required)version(constant "1.0.0", required)within_limit(boolean, required)distance(integer or null, required): min 0; max 512operations(array or null, required): max items 512
Limits
- max input bytes: 131072
- max items: 256
- max item bytes: 1024
- max distance: 512
- max iterations: 263169
- max output items: 512
Example
Request input:
{
"a": [
"A",
"B"
],
"b": [
"A",
"C"
],
"max_distance": 2
}
Response:
{
"result": {
"reference": "Myers 1986; RFC 3284 section 5",
"version": "1.0.0",
"within_limit": true,
"distance": 2,
"operations": [
{
"op": "equal",
"value": "A"
},
{
"op": "delete",
"value": "B"
},
{
"op": "insert",
"value": "C"
}
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "myers-diff-bounded",
"version": "1.0.0",
"input": {
"a": [
"A",
"B"
],
"b": [
"A",
"C"
],
"max_distance": 2
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/myers-diff-bounded/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"a":["A","B"],"b":["A","C"],"max_distance":2}'
The machine-readable contract is at /v1/tools/myers-diff-bounded/versions/1.0.0.
CLI
node cli.mjs run myers-diff-bounded 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Myers distance bounded: Compute Myers insert/delete distance up to a caller cap, returning null predictably when the cap is exceeded.
- Myers common subsequence: Return a canonical indexed LCS witness derived from bounded Myers search, or null when its cap is exceeded.
- Sequence apply edit script: Apply a keep/delete/insert edit script to a bounded sequence with exact value matching and no fuzz.
- Sequence edit script: Compute the Myers shortest edit script between two bounded sequences, with keep/delete/insert counts.
- Sequence compose edit scripts: Compose two sequence edit scripts into one per-item keep/delete/insert script.
- Sequence key order check: Check an exact stable ordering claim for bounded records by a scalar key.