Oxen icon indicating copy to clipboard operation
Oxen copied to clipboard

Implement oxen mv command

Open rpschoenburg opened this issue 2 months ago β€’ 1 comments

Summary by CodeRabbit

New Features

  • Introduced mv command to move and rename files within your repositories with full state management
  • Automatically handles repository state updates during file operations to maintain data integrity
  • Validates repository compatibility before performing move operations
  • Ensures complete consistency across the repository after file moves
  • Available for local repository operations only

rpschoenburg avatar Oct 22 '25 18:10 rpschoenburg

[!WARNING]

Rate limit exceeded

@rpschoenburg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 21 seconds before requesting another review.

βŒ› How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 1805e2a3761c177b062d8e3156aa61156ffffb0a and c92cb404eb751b231e56df1f276ed2b8c93758b4.

πŸ“’ Files selected for processing (3)
  • oxen-rust/src/cli/src/cmd.rs (1 hunks)
  • oxen-rust/src/cli/src/cmd/mv.rs (1 hunks)
  • oxen-rust/src/cli/src/main.rs (2 hunks)

Walkthrough

A new "mv" CLI command is introduced to the Oxen Rust CLI for moving files within repositories. The command resolves the repository, validates migration compatibility, performs filesystem rename operations, and updates repository state by registering the destination and removing the source.

Changes

Cohort / File(s) Change Summary
Command Module Exports
oxen-rust/src/cli/src/cmd.rs
Added module declaration pub mod mv; and re-export pub use mv::MvCmd; to expose the new MV command
MV Command Implementation
oxen-rust/src/cli/src/cmd/mv.rs
New file implementing MvCmd struct with RunCmd trait, defining CLI args via clap, and implementing move operation flow: argument parsing β†’ repository resolution β†’ migration check β†’ filesystem rename β†’ destination registration β†’ source removal
CLI Integration
oxen-rust/src/cli/src/main.rs
Integrated MvCmd into available commands via Box::new(cmd::MvCmd) and added "mv" to remote-mode disallowed commands list

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant Repo
    participant FS as Filesystem

    User->>CLI: oxen mv src dst
    CLI->>CLI: Parse arguments
    CLI->>Repo: Resolve repository
    Repo-->>CLI: Repository handle
    CLI->>Repo: Check migration status
    Repo-->>CLI: Migration valid
    FS->>FS: Rename src β†’ dst
    CLI->>Repo: Register destination
    Repo-->>CLI: Destination added
    CLI->>Repo: Remove source from state
    Repo-->>CLI: Source removed
    CLI-->>User: Success

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes introduce a new command feature across multiple files with consistent patterns following existing RunCmd trait conventions. Review requires verification of the move operation sequence (filesystem rename coupled with repository state updates), error handling paths, and integration correctness, but complexity remains bounded within a single feature scope.

Poem

🐰 A move command hops into view,
With files shifting from old to new,
The repository dances with grace,
As sources and destinations swap their place,
mv makes the magic true! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
βœ… Passed checks (2 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check βœ… Passed The pull request title "Implement oxen mv command" is directly and specifically related to the main change in the changeset. The primary objective is to add a new mv (move) command to the Oxen CLI, which is reflected in the implementation across three files: adding the module and re-export in cmd.rs, creating the complete MvCmd implementation in mv.rs, and integrating it into main.rs. The title is concise, clear, and specific enough that a teammate scanning the git history would immediately understand that a new CLI command is being introduced, without attempting to enumerate implementation details.

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 and usage tips.

coderabbitai[bot] avatar Oct 22 '25 18:10 coderabbitai[bot]