From 7b12d907cc785e9d855ee9e2e07a59de04f2c52c Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 1 May 2026 07:43:02 -0400 Subject: [PATCH] feat(skills): scan re-scans existing GitHub/sks_sh sources for new skills When the project workspace scan runs, also iterate the source locators of all accepted GitHub and sks_sh skills, re-fetch each source, and upsert any skills that have appeared since the last import. Per-source failures are collected as warnings instead of aborting the whole scan. --- server/src/services/company-skills.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/server/src/services/company-skills.ts b/server/src/services/company-skills.ts index f29944ac..790dd02d 100644 --- a/server/src/services/company-skills.ts +++ b/server/src/services/company-skills.ts @@ -2127,6 +2127,28 @@ export function companySkillService(db: Db) { } } + const sourceLocators = new Set(); + for (const skill of acceptedSkills) { + if (skill.sourceType !== "github" && skill.sourceType !== "skills_sh") continue; + const locator = skill.sourceLocator ?? ""; + if (locator) sourceLocators.add(locator); + } + for (const sourceLocator of sourceLocators) { + try { + const result = await readUrlSkillImports(companyId, sourceLocator, null); + for (const nextSkill of result.skills) { + if (acceptedSkills.some((s) => s.slug === nextSkill.slug)) continue; + const persisted = (await upsertImportedSkills(companyId, [nextSkill]))[0]; + if (persisted) { + imported.push(persisted); + upsertAcceptedSkill(persisted); + } + } + } catch { + warnings.push(`Could not re-scan source ${sourceLocator} — skipping.`); + } + } + return { scannedProjects: scannedProjectIds.size, scannedWorkspaces: scanTargets.length,