fix(coding-agent): show compact read line ranges

This commit is contained in:
Armin Ronacher
2026-05-04 09:39:12 +02:00
parent 324aa1d647
commit e355696d8a
2 changed files with 48 additions and 19 deletions

View File

@@ -384,4 +384,25 @@ describe("ToolExecutionComponent parity", () => {
expect(expanded).toContain(scenario.hidden);
});
}
for (const scenario of [
{ title: "SKILL.md", path: join(process.cwd(), "attio", "SKILL.md"), compact: "[skill] attio:120-329" },
{ title: "Pi documentation", path: getReadmePath(), compact: "read docs README.md:120-329" },
] as const) {
test(`shows the read line range in compact ${scenario.title} reads before the expand hint`, () => {
const component = new ToolExecutionComponent(
"read",
`tool-compact-range-${scenario.title}`,
{ path: scenario.path, offset: 120, limit: 210 },
{},
createReadToolDefinition(process.cwd()),
createFakeTui(),
process.cwd(),
);
const collapsed = stripAnsi(component.render(120).join("\n"));
expect(collapsed).toContain(scenario.compact);
expect(collapsed.indexOf(":120-329")).toBeLessThan(collapsed.indexOf("to expand"));
});
}
});