mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 10:27:33 +00:00
Combine the completed comment cleanup from 319 stacked PRs into one change against `main`, so the full CI suite validates the combined result once. This replaces the previous audit stack; no additional audit work is included. The change shortens redundant comments across 2,753 source and shell-snapshot files (25,235 net lines removed). Conflicts preserve current-main executable code. Runtime behavior, test assertions, directives, licenses, generated notices, SAFETY rationales, and compatibility markers are preserved. The audit tracker remains local, outside the repository. Validation: - Equivalent source/emitted AST and executable tokens across all 2,750 source files, with separate checks for embedded shell, SQL, JavaScript, CSS, and generated fixtures. - Identical executable lines in the three shell snapshots; protected comments unchanged. - Changed-code quality gate passed with no new findings. - 358 tests passed, 2 skipped across 23 focused test files. - `git diff --check` passed.
29 lines
983 B
TypeScript
29 lines
983 B
TypeScript
type ResolveWorktreeCreateBaseArgs = {
|
|
requestedBaseBranch?: string
|
|
repoWorktreeBaseRef?: string | null
|
|
resolveDefaultBaseRef: () => Promise<string | null>
|
|
isBaseUsable: (baseBranch: string) => Promise<boolean>
|
|
}
|
|
|
|
export async function resolveWorktreeCreateBase(
|
|
args: ResolveWorktreeCreateBaseArgs
|
|
): Promise<string | null> {
|
|
if (args.requestedBaseBranch) {
|
|
return args.requestedBaseBranch
|
|
}
|
|
|
|
const defaultBaseRef = await args.resolveDefaultBaseRef()
|
|
const repoWorktreeBaseRef = args.repoWorktreeBaseRef
|
|
if (!repoWorktreeBaseRef) {
|
|
return defaultBaseRef
|
|
}
|
|
if (!defaultBaseRef) {
|
|
return (await args.isBaseUsable(repoWorktreeBaseRef)) ? repoWorktreeBaseRef : null
|
|
}
|
|
if (repoWorktreeBaseRef === defaultBaseRef) {
|
|
return repoWorktreeBaseRef
|
|
}
|
|
// Stale persisted refs fall back to the detected default; usable custom refs stay authoritative.
|
|
return (await args.isBaseUsable(repoWorktreeBaseRef)) ? repoWorktreeBaseRef : defaultBaseRef
|
|
}
|