Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

628 B
Raw Blame
import { realpath } from 'node:fs/promises';
import { resolve } from 'node:path';
import { execGit } from './execGit.js';

/** Fresh canonical identity shared by linked worktrees and filesystem aliases.
 * Unknown evidence is never proof that two repositories are independent.
 */
export async function readGitCommonDirectory(repoPath) {
  if (typeof repoPath !== 'string' || !repoPath.trim()) return null;
  return execGit(['rev-parse', '--git-common-dir'], repoPath)
    .then(result => {
      const common = result.stdout.trim();
      return common ? realpath(resolve(repoPath, common)) : null;
    }).catch(() => null);
}