getRepoMainWorktreeId (worktree/id.ts)

orca · src/shared/worktree/id.ts · typescript · MIT
payments

Utility functions for composing, parsing, and comparing worktree identifiers across repos.

// Source: https://github.com/stablyai/orca | License: MIT | Copyright 2026 Lovecast Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { normalizeRuntimePathForComparison } from '../cross-platform-path'
import { WORKTREE_ID_SEPARATOR } from '../pty-session-id-format'
import type { Repo } from '../repo-types'

export { WORKTREE_ID_SEPARATOR } from '../pty-session-id-format'

export type ParsedWorktreeId = {
  repoId: string
  worktreePath: string
}

export const FOLDER_WORKSPACE_INSTANCE_SEPARATOR = '::workspace:'
const FOLDER_WORKSPACE_INSTANCE_SUFFIX = new RegExp(
  `${FOLDER_WORKSPACE_INSTANCE_SEPARATOR.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[0-9a-f-]{36}$`
)

/**
 * Worktree id of the repo's own checkout. A bare repo id is never a valid worktree id —
 * runtime

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key