MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / ensureSkillsCurrent

Function ensureSkillsCurrent

packages/cli/src/commands/init.ts:589–623  ·  view source on GitHub ↗

* Ensure the AI coding skills are present and current. Checks the installed * skills against the latest published on GitHub and only (re)installs when * something is outdated or missing — so re-running `init` on an up-to-date * machine is a no-op. Best-effort: if the version check can't reach Git

(destDir: string)

Source from the content-addressed store, hash-verified

587 * to match.
588 */
589async function ensureSkillsCurrent(destDir: string): Promise<void> {
590 const { installAllSkills } = await import("./skills.js");
591 const { checkSkills } = await import("../utils/skillsManifest.js");
592
593 console.log();
594 console.log(c.bold("Checking AI coding skills against GitHub..."));
595 let needsInstall = true;
596 try {
597 const result = await checkSkills({ cwd: destDir });
598 needsInstall = result.updateAvailable;
599 } catch {
600 // Couldn't reach GitHub (offline, rate-limited) — install anyway.
601 }
602
603 if (needsInstall) {
604 // installAllSkills installs the full set once globally and mirrors it into
605 // every installed agent's global dir — project-independent, so a freshly
606 // scaffolded project doesn't need any agent folders yet.
607 //
608 // Best-effort: installAllSkills (non-strict here) already swallows its own
609 // failures, but now that --skip-skills no longer escapes this path every
610 // init runs it — including offline ones, where checkSkills throws and we
611 // fall through to "install anyway". Wrap defensively so a skills-install
612 // failure can never break `init` itself; it only warns and proceeds.
613 try {
614 await installAllSkills({ cwd: destDir });
615 } catch (err) {
616 console.log(
617 c.dim(`AI coding skills install skipped: ${err instanceof Error ? err.message : err}`),
618 );
619 }
620 } else {
621 console.log(c.success("AI coding skills are already up to date."));
622 }
623}
624
625// ---------------------------------------------------------------------------
626// Exported command

Callers 1

runFunction · 0.85

Calls 2

checkSkillsFunction · 0.85
installAllSkillsFunction · 0.85

Tested by

no test coverage detected