Skip to content

Discover registered Worktrees with generation-safe identity #6

Description

@codeacme17

Tracks #1.

Summary

Resolve the Current Project to its Git Repository and discover every registered Worktree with stable server-side identity and truthful actionable/unavailable state.

Scope

  • Resolve a project anchor through Git commands to the canonical common Git directory.
  • Treat git worktree list --porcelain -z as the sole authoritative Worktree inventory.
  • Include Main and every valid linked Worktree regardless of path, Branch naming, creator, Codex registration, Detached HEAD, or custom root.
  • Parse branch/detached commit, Main role, locked reason, prunable state, and canonical path without inspecting assumed .git/worktrees layouts.
  • Produce opaque RepositoryId and generation-aware WorktreeId values from canonical Git identities.
  • Represent missing/prunable registrations as unavailable diagnostics with no mutation capabilities.
  • Rediscover a removed/restored/moved Worktree as fresh identity/state and never preserve cached Branch Occupancy across generations.
  • Return a safe non-repository result for an ordinary directory.

Acceptance criteria

  • A fixture containing Main, manual, Codex-style, Scheduled-style, Permanent-style, detached, custom-root, and unknown Worktrees shows every valid registration exactly once.
  • Inclusion does not use path scans, .codex directories, Branch prefixes, or inferred provenance.
  • Paths containing spaces, Unicode, leading dashes, and newlines parse correctly.
  • Locked and prunable/missing states are distinct and neither is mislabeled as an active-operation lock.
  • A removed and recreated Worktree at the same path invalidates its previous opaque IDs.
  • A non-Git Current Project enables no Git mutation.

Out of scope

  • Provenance labels, file status, Branch switching, Worktree lifecycle mutation, or automatic prune/repair.

Dependencies

PRD coverage

  • FR1; AC-01, AC-03, AC-04, and the identity portion of AC-22.

Verification

  • Repository Engine contract tests against real temporary Git repositories and NUL-path parser fixtures.

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