mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-23 17:19:21 +00:00
14 lines
466 B
TypeScript
14 lines
466 B
TypeScript
import path from "node:path";
|
|
import { resolveRepoRoot, resolveSourceRoots } from "./ts-guard-utils.ts";
|
|
|
|
export function createPairingGuardContext(importMetaUrl: string) {
|
|
const repoRoot = resolveRepoRoot(importMetaUrl);
|
|
const sourceRoots = resolveSourceRoots(repoRoot, ["src", "extensions"]);
|
|
return {
|
|
repoRoot,
|
|
sourceRoots,
|
|
resolveFromRepo: (relativePath: string) =>
|
|
path.join(repoRoot, ...relativePath.split("/").filter(Boolean)),
|
|
};
|
|
}
|