diff options
| author | Adam Malczewski <[email protected]> | 2026-03-28 05:15:49 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-03-28 05:15:49 +0900 |
| commit | ff4fd494811d326986cfe0305f35b89e37dd493c (patch) | |
| tree | 947209f20098279b1b334db653300f1e3bb43aa6 /src/tools.ts | |
| parent | be2dee39e5bf907dfdd3462817203a08cf3c345f (diff) | |
| download | ai-pulse-obsidian-plugin-ff4fd494811d326986cfe0305f35b89e37dd493c.tar.gz ai-pulse-obsidian-plugin-ff4fd494811d326986cfe0305f35b89e37dd493c.zip | |
no=op validation, and red tool error messages
Diffstat (limited to 'src/tools.ts')
| -rw-r--r-- | src/tools.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools.ts b/src/tools.ts index a4eb16e..57e21c1 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -338,6 +338,11 @@ async function executeEditFile(app: App, args: Record<string, unknown>): Promise const oldText = typeof args.old_text === "string" ? args.old_text : ""; const newText = typeof args.new_text === "string" ? args.new_text : ""; + // Reject no-op edits where old_text and new_text are identical + if (oldText === newText) { + return `Error: old_text and new_text are identical — no change would occur. Provide different text for new_text, or skip this edit.`; + } + const file = app.vault.getAbstractFileByPath(filePath); if (file === null || !(file instanceof TFile)) { return `Error: File not found at path "${filePath}".`; |
