refactor(src): split oversized modules

This commit is contained in:
Peter Steinberger
2026-01-14 01:08:15 +00:00
parent b2179de839
commit bcbfb357be
675 changed files with 91476 additions and 73453 deletions

View File

@@ -0,0 +1,29 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
export function resolveBundledSkillsDir(): string | undefined {
const override = process.env.CLAWDBOT_BUNDLED_SKILLS_DIR?.trim();
if (override) return override;
// bun --compile: ship a sibling `skills/` next to the executable.
try {
const execDir = path.dirname(process.execPath);
const sibling = path.join(execDir, "skills");
if (fs.existsSync(sibling)) return sibling;
} catch {
// ignore
}
// npm/dev: resolve `<packageRoot>/skills` relative to this module.
try {
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
const root = path.resolve(moduleDir, "..", "..", "..");
const candidate = path.join(root, "skills");
if (fs.existsSync(candidate)) return candidate;
} catch {
// ignore
}
return undefined;
}