chore: simplify codex prompt handling

This commit is contained in:
Mario Zechner 2026-01-17 21:53:01 +01:00
parent 94bd7f69fd
commit 4068bc556a
8 changed files with 33 additions and 87 deletions

View file

@ -1,12 +1,9 @@
import { accessSync, constants } from "node:fs";
import * as os from "node:os";
import { isAbsolute, resolve as resolvePath } from "node:path";
import { getPackageDir } from "../../config.js";
const UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
const NARROW_NO_BREAK_SPACE = "\u202F";
export const PI_INTERNAL_SCHEME = "pi-internal://";
function normalizeUnicodeSpaces(str: string): string {
return str.replace(UNICODE_SPACES, " ");
}
@ -48,12 +45,6 @@ export function resolveToCwd(filePath: string, cwd: string): string {
}
export function resolveReadPath(filePath: string, cwd: string): string {
// Handle pi-internal:// scheme for Pi package documentation
if (filePath.startsWith(PI_INTERNAL_SCHEME)) {
const relativePath = filePath.slice(PI_INTERNAL_SCHEME.length);
return resolvePath(getPackageDir(), relativePath);
}
const resolved = resolveToCwd(filePath, cwd);
if (fileExists(resolved)) {