INNER CODE UNIT · TypeScript

resolveHunkPath

totec448-spec/chat-on-steroids · src/main/codex/apply-patch/index.ts:392

function resolveHunkPath(hunk: Hunk, cwd: string, resolvePath: PatchPathResolver): string {
  const spelled = hunk.kind === 'update_file' ? hunk.path : hunkPath(hunk);
  return resolvePath(spelled, cwd);
}

async function ensureNotDirectory(path: string): Promise<void> {
  const metadata = await getMetadata(path);
  if (metadata.isDirectory) throw invalidInput('path is a directory');
}

async function removeFailureWasSideEffectFree(
  path: string,
  expectedContent: string | null
): Promise<boolean> {
  if (expectedContent === null) return false;
  try {
    return (await readFileText(path)) === expectedContent;
  } catch {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…