mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-24 01:41:42 +02:00
Remove physical-root source/reader authorization and sticky directory classifications from workspace preparation. Preserve current task/run authority, app-record privacy, credential authorization, containment, and lifecycle/publication integrity.
Validate replacement selections against persisted new inputs and refresh verified checkout ownership so bounded reuse survives earlier workspace relocation. Add real PostgreSQL/Git regressions, a reproducible history-scaling benchmark, and documentation.
Full CI passed all 48 jobs and Greptile scored 5/5 at 3d5da6c259. Five preparation-guard medians improved from 20,512.99 ms to 52.22 ms on the 8,500-workspace fixture; these are not end-to-end startup timings.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
14 lines
496 B
TypeScript
14 lines
496 B
TypeScript
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
export async function canonicalRepositoryRoot(cwd: string): Promise<string> {
|
|
const absolute = path.resolve(cwd);
|
|
try { return await fs.realpath(absolute); }
|
|
catch (error) {
|
|
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
const parent = path.dirname(absolute);
|
|
if (parent === absolute) throw error;
|
|
return path.join(await canonicalRepositoryRoot(parent), path.basename(absolute));
|
|
}
|
|
}
|