import { DefaultResourceLoader, getAgentDir } from "@earendil-works/pi-coding-agent"; import type { SkillInfo, SkillsResponse } from "@/lib/api-types"; import { annotateSkillsWithInstallInfo } from "@/lib/skill-lock"; import { getProjectTrustStatus, projectTrustReloadOptions } from "@/lib/project-trust"; export async function loadSkillsWithInstallInfo(cwd: string): Promise { const agentDir = getAgentDir(); const loader = new DefaultResourceLoader({ cwd, agentDir }); await loader.reload(projectTrustReloadOptions(cwd, agentDir)); const { skills, diagnostics } = loader.getSkills(); return { skills: annotateSkillsWithInstallInfo(skills as SkillInfo[], { cwd, agentDir }), diagnostics, projectResourcesLoaded: getProjectTrustStatus(cwd, agentDir).trusted, }; }