mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 10:37:35 +00:00
* [comment audit] Shorten daemon, hook, and emulator comments [skip ci] * [comment audit] Shorten VM, conversation, SQLite, and theme-import comments [skip ci] * [comment audit] Tighten Git execution and source-control comment contracts [skip ci] * [comment audit] Clarify repository probes and maintenance comments [skip ci] * [comment audit] Shorten status, diff-cache, and checkout comments [skip ci] * [comment audit] Clarify worktree lifecycle and WSL routing comments [skip ci] * [comment audit] Shorten forge identity and review-refresh comments [skip ci] * [comment audit] Tighten hosted-review client comment contracts [skip ci] * [comment audit] Clarify GitLab compatibility and review comments [skip ci] * [comment audit] Tighten hook ownership and watchdog rationale [skip ci] * [comment audit] Condense host and integration compatibility comments [skip ci] * [comment audit] Clarify IPC authority and remote-routing rationale [skip ci] * [comment audit] Finalize file-import and containment comment cleanup * [comment audit] Fix stale Jira type imports blocking full CI --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { GITHUB_OWNER_SLUG_RE } from '../../shared/github/owner-slug'
|
|
import type { GitHubOwnerRepo } from '../../shared/github/pull-request-types'
|
|
|
|
export type GitHubApiRepositoryResolution =
|
|
| GitHubOwnerRepo
|
|
| null
|
|
| undefined
|
|
| (() => Promise<GitHubOwnerRepo | null>)
|
|
|
|
// Untrusted renderer/RPC slugs become authenticated REST paths.
|
|
const OWNER_SLUG_RE = GITHUB_OWNER_SLUG_RE
|
|
const REPOSITORY_SLUG_RE = /^[A-Za-z0-9._-]+$/
|
|
|
|
export function isValidGitHubApiRepository(repository: unknown): repository is GitHubOwnerRepo {
|
|
if (
|
|
!repository ||
|
|
typeof repository !== 'object' ||
|
|
!('owner' in repository) ||
|
|
!('repo' in repository)
|
|
) {
|
|
return false
|
|
}
|
|
return (
|
|
typeof repository.owner === 'string' &&
|
|
typeof repository.repo === 'string' &&
|
|
(!('host' in repository) ||
|
|
repository.host === undefined ||
|
|
typeof repository.host === 'string') &&
|
|
OWNER_SLUG_RE.test(repository.owner) &&
|
|
REPOSITORY_SLUG_RE.test(repository.repo) &&
|
|
repository.repo !== '.' &&
|
|
repository.repo !== '..'
|
|
)
|
|
}
|