feat(pi-natives/chunk): added parse-error line metadata support to chunk edits

- Added parse_error_lines to ChunkTree and threaded parse-error line metadata through tree creation.
- Changed count_parse_errors to return (count, line numbers) and collect recursive parse-error positions.
- Added hashline edit input resolution so computeHashlineDiff accepts loc/content edits and throws on invalid payloads.
- Fixed apply_edits error rendering to fall back to full-tree context when edited chunks have downstream parse errors.
This commit is contained in:
can1357
2026-04-11 20:30:24 +02:00
parent 5f304cccb5
commit 4750b523be
9 changed files with 264 additions and 116 deletions
@@ -240,6 +240,20 @@ describe("computeHashlineDiff", () => {
}
});
test("accepts hashline tool edits without resolved op/lines", async () => {
const sourcePath = path.join(tempDir, "source.txt");
await Bun.write(sourcePath, "first\n");
const result = await computeHashlineDiff(
{ path: sourcePath, edits: [{ loc: "append", content: "second" }] },
tempDir,
);
expect("diff" in result).toBe(true);
if ("diff" in result) {
expect(result.diff).toContain("second");
}
});
test("allows move-only operation when content is unchanged", async () => {
const sourcePath = path.join(tempDir, "source.txt");
await Bun.write(sourcePath, "unchanged content\n");