Skip to content

chore: Adopt git root commit SHA as stable project identifier #58

Description

@nigel-dev

Source

Audit report — Section 9: Phase 1 (deferred item) + Section 4: Ecosystem Patterns (opencode-worktree)

Description

MC identifies projects by their filesystem path, which breaks when the repository is moved or cloned to a different location. The ecosystem plugin opencode-worktree uses the git root commit SHA as a stable, location-independent project identifier.

Current State

  • Project ID is derived from the filesystem path
  • State stored under ~/.local/share/opencode-mission-control/{path-based-id}/
  • Moving a repo = losing all MC state (jobs, plans, config)

Proposed Solution

  1. Compute project ID from git root commit SHA: git rev-list --max-parents=0 HEAD
  2. Use SHA-based ID for state directory naming
  3. Migration strategy required: Existing state directories need to be migrated from path-based to SHA-based naming
  4. Fallback: If not a git repo, fall back to path-based ID

Why This Was Deferred

Changing the project ID computation breaks all existing state directories. A migration strategy is needed:

  • Option A: Automatic migration on first run (detect old path-based dir, rename to SHA-based)
  • Option B: Symlink from old path to new SHA-based dir
  • Option C: Dual-lookup (check both, prefer SHA-based)

Ecosystem Precedent

opencode-worktree uses this pattern successfully for stable project identification across clone locations.

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

    P3: lowNice to have — polish, cleanup, or long-termenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions