Release v0.9.2

This commit is contained in:
Mario Zechner 2025-11-24 19:32:55 +01:00
parent 68ca83441b
commit 52325adb97
11 changed files with 80 additions and 58 deletions

View file

@ -1,5 +1,11 @@
# Changelog
## [0.9.2] - 2025-11-24
### Fixed
- **Edit Tool Dollar Sign Bug**: Fixed critical bug in the `edit` tool where `String.replace()` was interpreting `$` as a special replacement pattern (e.g., `$$`, `$&`, `$'`). When trying to insert `$` into code (like adding a dollar sign to a template literal), the replacement would silently fail and produce unchanged content, but the tool would incorrectly report success. Now uses `indexOf` + `substring` for raw string replacement without special character interpretation. Also added verification that content actually changed, rejecting with a clear error if the replacement produces identical content. ([#53](https://github.com/badlogic/pi-mono/issues/53))
## [0.9.0] - 2025-11-21
### Added

View file

@ -1,6 +1,6 @@
{
"name": "@mariozechner/pi-coding-agent",
"version": "0.9.1",
"version": "0.9.2",
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
"type": "module",
"bin": {
@ -22,9 +22,9 @@
"prepublishOnly": "npm run clean && npm run build"
},
"dependencies": {
"@mariozechner/pi-agent-core": "^0.9.1",
"@mariozechner/pi-ai": "^0.9.1",
"@mariozechner/pi-tui": "^0.9.1",
"@mariozechner/pi-agent-core": "^0.9.2",
"@mariozechner/pi-ai": "^0.9.2",
"@mariozechner/pi-tui": "^0.9.2",
"chalk": "^5.5.0",
"diff": "^8.0.2",
"glob": "^11.0.3"

View file

@ -213,8 +213,24 @@ export const editTool: AgentTool<typeof editSchema> = {
return;
}
// Perform replacement
const newContent = content.replace(oldText, newText);
// Perform replacement using indexOf + substring (raw string replace, no special character interpretation)
// String.replace() interprets $ in the replacement string, so we do manual replacement
const index = content.indexOf(oldText);
const newContent = content.substring(0, index) + newText + content.substring(index + oldText.length);
// Verify the replacement actually changed something
if (content === newContent) {
if (signal) {
signal.removeEventListener("abort", onAbort);
}
reject(
new Error(
`No changes made to ${path}. The replacement produced identical content. This might indicate an issue with special characters or the text not existing as expected.`,
),
);
return;
}
await writeFile(absolutePath, newContent, "utf-8");
// Check if aborted after writing