Skip to content

feat: add multi-edit tool - #10

Merged
bobrykov merged 2 commits into
masterfrom
feat/multi-edit-tool
Jul 18, 2026
Merged

feat: add multi-edit tool#10
bobrykov merged 2 commits into
masterfrom
feat/multi-edit-tool

Conversation

@bobrykov

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5dc529f0-d363-42b6-a1ed-bb1eef17ff23

📥 Commits

Reviewing files that changed from the base of the PR and between e54ff2f and 1c24ae8.

📒 Files selected for processing (6)
  • crates/dch-tools/src/bash.rs
  • crates/dch-tools/src/context.rs
  • crates/dch-tools/src/diff.rs
  • crates/dch-tools/src/edit.rs
  • crates/dch-tools/src/multi_edit.rs
  • crates/dch-tools/src/state.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • crates/dch-tools/src/context.rs
  • crates/dch-tools/src/state.rs
  • crates/dch-tools/src/edit.rs
  • crates/dch-tools/src/multi_edit.rs

📝 Walkthrough

Walkthrough

Introduces MultiEditTool for validated, linted, atomic batch edits across files. It adds crate and registry integration, extensive tests, crate-visible edit helpers, and expanded Rustdoc for existing tool, runtime, state, and protocol types.

Changes

Multi-file editing

Layer / File(s) Summary
Tool contract and integration
crates/dch-tools/src/multi_edit.rs, crates/dch-tools/src/lib.rs, crates/dch-tools/src/registry.rs, crates/dch-tools/src/edit.rs
Defines and exports MultiEditTool, registers it as a builtin, and exposes edit helpers within the crate.
Batch validation and conflict checks
crates/dch-tools/src/multi_edit.rs
Validates inputs, resolves and reads targets, rejects unsafe path conditions, and detects overlapping edits.
Merge, lint, preview, and apply
crates/dch-tools/src/multi_edit.rs
Sequentially merges edits, optionally lints results, builds summaries, and atomically writes distinct files unless running in dry-run mode.
Behavioral validation
crates/dch-tools/src/multi_edit.rs
Tests parsing, safety checks, merge behavior, lint gating, abort handling, dry runs, and output formatting.
Public API documentation
crates/dch-tools/src/{bash,context,diff,linter,question,runtime,state}.rs
Expands documentation for existing job, context, diff, linter, question, runtime, and session-state APIs.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant MultiEditTool
  participant FileSystem
  participant Linter
  Caller->>MultiEditTool: submit edit batch
  MultiEditTool->>FileSystem: read and validate target files
  MultiEditTool->>MultiEditTool: merge edits and build preview
  MultiEditTool->>Linter: validate final content
  Linter-->>MultiEditTool: return lint result
  MultiEditTool->>FileSystem: atomically write files
  MultiEditTool-->>Caller: return preview or applied summary
Loading

Possibly related PRs

  • dch-labs/dch#3: Introduces the context, question, runtime, and session-state types whose documentation is expanded here.
  • dch-labs/dch#7: Introduces the Bash job types whose documentation is expanded here.
  • dch-labs/dch#9: Relates to the diff formatting and edit helper areas updated here.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding the new multi-edit tool.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 50.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/multi-edit-tool

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dch-labs dch-labs deleted a comment from coderabbitai Bot Jul 18, 2026
@bobrykov

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@dch-labs dch-labs deleted a comment from coderabbitai Bot Jul 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 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/multi_edit.rs`:
- Around line 147-152: Update the overlap validation around overlap_check in the
multi-edit flow to run for both dry-run and apply modes by removing the
parsed.dry_run guard. Preserve the existing conflict result handling through
reason.into_output() so previews and actual applies use identical overlap
checks.
- Around line 424-435: Update symlink_check to validate every component of each
operation’s full_path, not just the final component, rejecting any symlink
encountered while traversing parent directories. Perform the check without
following links and preserve the no-symlink traversal guarantee through the
subsequent write path.
- Around line 682-709: Update build_preview to render each file’s complete
original content against its merged final content rather than comparing
originals with individual op.new_text fragments. Reuse the existing merged
finals representation if available, or track sequential edits per file so
operations on the same file are reflected cumulatively while preserving the
current preview formatting.
- Around line 174-183: Update the Phase 4 write flow around the operations loop
and atomic_write calls so writes across multiple files satisfy the tool’s
all-or-nothing contract: stage all final contents first, then commit
transactionally with rollback or recovery if any commit fails. Ensure a
later-file failure does not leave earlier files modified; otherwise narrow the
advertised guarantee instead of retaining the current claim.
- Around line 301-306: Update the path construction in the multi-edit flow
around full_path and dup_path_check to derive the identity from a normalized or
canonicalized physical path, so aliases such as a.rs and ./a.rs compare as
duplicates. Retain the original file_path for display and error messages, while
using the normalized identity consistently for merging and write operations.
🪄 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: fd1c0f49-6c52-4bed-a73f-be9b3c250edc

📥 Commits

Reviewing files that changed from the base of the PR and between 0073bc5 and e54ff2f.

📒 Files selected for processing (11)
  • crates/dch-tools/src/bash.rs
  • crates/dch-tools/src/context.rs
  • crates/dch-tools/src/diff.rs
  • crates/dch-tools/src/edit.rs
  • crates/dch-tools/src/lib.rs
  • crates/dch-tools/src/linter.rs
  • crates/dch-tools/src/multi_edit.rs
  • crates/dch-tools/src/question.rs
  • crates/dch-tools/src/registry.rs
  • crates/dch-tools/src/runtime.rs
  • crates/dch-tools/src/state.rs

Comment thread crates/dch-tools/src/multi_edit.rs Outdated
Comment thread crates/dch-tools/src/multi_edit.rs
Comment thread crates/dch-tools/src/multi_edit.rs
Comment thread crates/dch-tools/src/multi_edit.rs
Comment thread crates/dch-tools/src/multi_edit.rs
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
Not Found - https://docs.github.com/rest/issues/comments#update-an-issue-comment

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bobrykov
bobrykov merged commit 604ef1f into master Jul 18, 2026
8 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 26, 2026
This was referenced Aug 7, 2026
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