Skip to content

Update: Remove character limits from @perstack/base file tools#57

Merged
FL4TLiN3 merged 2 commits intomainfrom
remove-file-tool-char-limits
Dec 7, 2025
Merged

Update: Remove character limits from @perstack/base file tools#57
FL4TLiN3 merged 2 commits intomainfrom
remove-file-tool-char-limits

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Dec 7, 2025

Summary

Remove character limits from file operation tools in @perstack/base:

  • writeTextFile: removed 10,000 character limit
  • appendTextFile: removed 2,000 character limit
  • editTextFile: removed 2,000 character limit for both newText and oldText

Motivation

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

  • Updated write-text-file.ts to remove .max(10_000) validation
  • Updated append-text-file.ts to remove .min(1).max(2_000) validation
  • Updated edit-text-file.ts to remove .min(1).max(2_000) validation for both parameters
  • Added examples and perstack binary to knip ignore

Note

Removes character limits from writeTextFile, appendTextFile, and editTextFile, and updates knip.json ignores.

  • Base tools (@perstack/base):
    • Input schemas: Remove length validations in write-text-file.ts, append-text-file.ts, and edit-text-file.ts.
    • Tool descriptions: Drop rules referencing token/character limits.
  • Tooling:
    • Update knip.json: add perstack to ignoreBinaries and examples/**/* to ignore.
  • Changeset:
    • Add @perstack/base patch 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.

@vercel
Copy link

vercel bot commented Dec 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
perstack Ignored Ignored Dec 7, 2025 1:01pm

@codecov
Copy link

codecov bot commented Dec 7, 2025

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."),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

@FL4TLiN3 FL4TLiN3 merged commit f5fc0ec into main Dec 7, 2025
9 checks passed
@FL4TLiN3 FL4TLiN3 deleted the remove-file-tool-char-limits branch December 7, 2025 13:03
@github-actions github-actions bot mentioned this pull request Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant