Skip to content
ƒtsforgev0.52.0
19

Safer line edits

2 min read

The edit tool needs an exact text match. The edit_lines tool (hashline) edits by line numbers from the model’s last read, with a hash proving the file has not changed since.

If the hash still matches, the edit applies. If the file drifted, tsforge tries recovery instead of silently writing to the wrong lines.

Always on.

When the model reads a file with hashline enabled, it sees:

¶src/app.ts#3F2A
1:import { foo } from "./foo";
2:export function main() {}

¶path#HASH is the anchor. HASH is four hex characters from the file contents at read time.

OperationSyntax
Replace linesreplace N..M: then lines prefixed with +
Delete linesdelete N or delete N..M
Insert linesinsert before N: or insert after N:

Line numbers are 1-based. Multiple ops apply bottom-up so line numbers stay stable.

ResultMeaning
Hash matchesedit applies
Hash mismatchtsforge tries a 3-way merge from a snapshot
Merge failsmodel must re-read and retry

File ops · Big picture