feat: edit tool added - #9
Conversation
|
Warning Review limit reached
Next review available in: 6 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis change adds a registered ChangesEdit tool workflow
Sequence Diagram(s)sequenceDiagram
participant ToolCaller
participant EditTool
participant FileSystem
participant Linter
ToolCaller->>EditTool: JSON edit request
EditTool->>FileSystem: read existing content
EditTool->>EditTool: locate and replace unique occurrence
EditTool->>Linter: lint updated content
Linter-->>EditTool: validation result
EditTool->>FileSystem: atomic write
EditTool-->>ToolCaller: diff preview or error
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/dch-tools/src/diff.rs`:
- Around line 117-127: The diff summary currently misses changes to the file’s
trailing newline because the line-count inputs lose terminal empty segments.
Update the diff construction and summary logic around the removed/added counts
to preserve EOF segments or explicitly report newline-at-EOF changes, ensuring
transitions such as "a\n" to "a" produce a visible preview and summary. Add a
regression test covering this case.
In `@crates/dch-tools/src/edit.rs`:
- Around line 93-97: Update Edit’s system_prompt method to remove the
unavailable MultiEdit instruction, while preserving the guidance that old_text
must be unique and callers should run the linter after applying changes.
- Around line 132-146: Serialize the read-modify-write flow around read_existing
and atomic_write per target path, using the existing path-based synchronization
mechanism if available. Immediately before atomic_write, re-read the target and
compare it with old_content; if it differs, return a retryable conflict output
instead of writing, while preserving the existing edit and linter behavior.
In `@crates/dch-tools/src/fs.rs`:
- Around line 19-36: Update atomic_write to explicitly handle symbolic-link
targets before creating the temporary file: resolve the link and write to the
resolved target, or reject symlink targets with a clear ToolError, ensuring
symlinks are never replaced by regular files. Add a Unix-only regression test
for atomic_write that verifies the chosen behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4a7a4da5-d795-48d9-8452-1e03f365d85e
📒 Files selected for processing (6)
crates/dch-tools/src/diff.rscrates/dch-tools/src/edit.rscrates/dch-tools/src/fs.rscrates/dch-tools/src/lib.rscrates/dch-tools/src/registry.rscrates/dch-tools/src/write.rs
No description provided.