opencode-mission-control icon indicating copy to clipboard operation
opencode-mission-control copied to clipboard

chore: Adopt git root commit SHA as stable project identifier

Open nigel-dev opened this issue 9 months ago • 0 comments

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.

nigel-dev avatar Feb 13 '26 18:02 nigel-dev