Skip to content

Implement safe file-level Stage and Unstage #10

Description

@codeacme17

Tracks #1.

Summary

Implement file-level and selected-Worktree group Stage/Unstage with stale-content rejection and partial-success reporting.

Scope

  • Add file actions plus Stage all for Changes/Untracked and Unstage all for Staged Changes.
  • Reject staging Conflict entries in the MVP.
  • Resolve opaque File IDs server-side and pass literal NUL-delimited paths through stdin; never interpolate paths through a shell.
  • Re-read file identity, status, and expected diff baseline immediately before execution.
  • Implement Initial-Commit-safe Unstage that changes only the selected Worktree Index and never the Working Tree.
  • Run through the selected Worktree's local mutation lane.
  • Reconcile the Index/status after every attempt and report bulk Partial Success per path.
  • Follow a successful file into its new group/baseline when it still exists.

Acceptance criteria

  • Only the explicitly selected Worktree Index changes, including when another Worktree contains the same relative path.
  • Unstage leaves Working Tree bytes unchanged.
  • External file/Index mutation between review and submission returns a stale rejection and current state.
  • Conflict paths cannot be staged.
  • Bulk success/failure is reported per path without rollback claims.
  • Spaces, Unicode, leading dashes, newlines, renames, deletions, and untracked paths are handled safely.
  • Independent Stage/Unstage commands in different Worktrees may run concurrently.

Out of scope

  • Hunk/line staging, conflict resolution, discard, stash, reset, or clean.

Dependencies

PRD coverage

  • FR4; AC-07, AC-08, and the Index portion of AC-19/21.

Verification

  • Real multi-Worktree integration tests, stale-baseline races, partial group failure fixtures, and Working Tree byte-preservation assertions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Core reachable product behavior required for the MVPenhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions