Skip to content

Implement Worktree-scoped Commit and outcome recovery #11

Description

@codeacme17

Tracks #1.

Summary

Implement Worktree-scoped Commit Drafts and safe staged-only Commit with hooks/signing preservation and state-based outcome reconciliation.

Scope

  • Maintain one multiline Commit Draft per Repository/Worktree ID in backend session memory.
  • Preserve drafts across navigation, refresh, Branch switch, and failure; clear only after verified success or explicit Clear message.
  • Enable Commit only with staged content and display exact Worktree path, Branch/Detached HEAD, and staged-file count.
  • Support Initial Commit.
  • Require prominent confirmation for Detached HEAD Commit.
  • Block ordinary Commit on Conflict, In-progress Git Operation, missing identity, unresolved Index lock, or empty Index.
  • Revalidate Worktree identity, HEAD OID, and Index tree OID immediately before execution.
  • Pass the message through stdin/file-descriptor input; preserve existing hooks and configured signing.
  • Reconcile fresh HEAD/Index/status after success, failure, timeout, or cancellation; prevent duplicate retry while outcome is unknown.
  • Keep unstaged content and selected Worktree intact after success.

Acceptance criteria

  • Commit includes exactly the selected Worktree's staged content and no unstaged content.
  • Local Branch, Initial, and confirmed Detached HEAD Commit paths behave as specified.
  • Missing identity, hook rejection, signing failure, external Index lock, stale HEAD/Index, timeout, and ambiguous exit preserve the draft and classify recovery correctly.
  • Confirmed success reports short SHA/summary and clears only that Worktree's draft.
  • Two different Worktrees may Commit concurrently without crossing Index/HEAD boundaries.
  • Raw diagnostics are sanitized and no hook/signing behavior is bypassed.

Out of scope

  • Amend, allow-empty, sign-off controls, AI-generated messages, signing setup, or committing unstaged content.

Dependencies

PRD coverage

  • FR5; AC-09, AC-10, AC-19, and AC-21.

Verification

  • Real Git tests for Local/Initial/Detached commits, hook/signing stubs, lock and stale races, process interruption, and multi-Worktree concurrency.

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