Update: Remove character limits from @perstack/base file tools#57
Merged
Update: Remove character limits from @perstack/base file tools#57
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| .max(2_000) | ||
| .describe("Exact text to find and replace. Max 2000 characters."), | ||
| newText: z.string().describe("Text to replace with."), | ||
| oldText: z.string().describe("Exact text to find and replace."), |
There was a problem hiding this comment.
Bug: Empty oldText causes unintended prepend behavior
Removing .min(1) validation from oldText allows empty strings to be passed. In JavaScript, "any string".includes("") always returns true, and "any string".replace("", newText) prepends newText to the beginning of the content rather than performing a find-and-replace. This means passing an empty oldText will silently prepend content to the file instead of throwing an error, which is almost certainly not the intended behavior for a text replacement operation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove character limits from file operation tools in
@perstack/base:writeTextFile: removed 10,000 character limitappendTextFile: removed 2,000 character limiteditTextFile: removed 2,000 character limit for both newText and oldTextMotivation
When using these tools through CMO Expert, the character limits caused frequent failures when writing or editing larger files. Removing these limits allows for more flexible file operations.
Changes
write-text-file.tsto remove.max(10_000)validationappend-text-file.tsto remove.min(1).max(2_000)validationedit-text-file.tsto remove.min(1).max(2_000)validation for both parametersexamplesandperstackbinary to knip ignoreNote
Removes character limits from
writeTextFile,appendTextFile, andeditTextFile, and updatesknip.jsonignores.@perstack/base):write-text-file.ts,append-text-file.ts, andedit-text-file.ts.knip.json: addperstacktoignoreBinariesandexamples/**/*toignore.@perstack/basepatch notes in.changeset/remove-file-tool-char-limits.md.Written by Cursor Bugbot for commit 112d452. This will update automatically on new commits. Configure here.