feat: scan workspace .agents/skills/ directories for skill imports

Add scanWorkspaceSkills method to skill service that iterates all
workspace local paths for a company and imports SKILL.md files from
.agents/skills/ subdirectories. Uses path.join for cross-platform
compatibility (Windows/macOS/Linux). The scan runs automatically
when skills are listed via IPC, with graceful error handling per
workspace so one bad path does not block the entire listing.

Also adds listWorkspaceLocalPaths to database for retrieving workspace
paths by company.
This commit is contained in:
ZacharyZhang-NY committed 2026-03-27 22:38:02 -04:00
1 parent 831acc3b06
commit 3b756fd30d
3 files changed
+52 -1

No files matched your search

+7 -1
View File
@@ -50,13 +50,19 @@ export function registerSkillHandlers({
return result;
});
// ---- List all skills for a company ----
// ---- List all skills for a company (also scans workspace .agents/skills/) ----
registerHandle(IPC_CHANNELS.listSkills, async (_event, payload) => {
const parsed = listSkillsSchema.parse(payload);
const companyError = ensureCompanyExists(parsed.companyId);
if (companyError) return companyError;
const serviceError = requireSkillService();
if (serviceError) return serviceError;
// Scan workspace .agents/skills/ directories for new skills before listing
try {
await skillService!.scanWorkspaceSkills(parsed.companyId);
} catch {
// Non-fatal: scan failure should not block listing existing skills
}
return ok(skillService!.listForCompany(parsed.companyId));
});