fix(coding-agent): corrected variable initialization order in formatPromptContent

- Corrected variable initialization order in formatPromptContent to prevent stale trimmedStart value when ASCII symbol replacement occurs.
- Updated bash.md documentation to use ellipsis (...) instead of three dots (...) for consistency with ASCII symbol replacement behavior.
- Added test case verifying table row compaction and content deduplication during pre-render with ASCII symbol replacement.
This commit is contained in:
can1357
2026-03-01 11:21:17 +01:00
parent 1643cd4673
commit 5347d89e76
3 changed files with 16 additions and 5 deletions
@@ -43,4 +43,15 @@ describe("formatPromptContent renderPhase", () => {
expect(preRender).toBe("<root>\n{{#if ok}}\nvalue\n{{/if}}\n</root>");
expect(postRender).toBe("<root>\n{{#if ok}}\nvalue\n\n{{/if}}\n</root>");
});
test("pre-render compacts table rows and does not duplicate content when replacing ascii", () => {
const input =
'|`cat <<\'EOF\' > file`|`write(path="file", content="...")`|\n|`sed -i \'s/old/new/\' file`|`edit(path="file", edits=[...])`|';
const output = formatPromptContent(input, {
renderPhase: "pre-render",
replaceAsciiSymbols: true,
});
expect(output).toBe(
'|`cat <<\'EOF\' > file`|`write(path="file", content="…")`|\n|`sed -i \'s/old/new/\' file`|`edit(path="file", edits=[…])`|',
);
});
});