MCPcopy Create free account
hub / github.com/MemTensor/MemOS / buildSkillBundleForHub

Function buildSkillBundleForHub

packages/memos-core/src/client/skill-sync.ts:10–34  ·  view source on GitHub ↗
(store: SqliteStore, skillId: string)

Source from the content-addressed store, hash-verified

8import { resolveHubClient, hubRequestJson } from "./hub";
9
10export function buildSkillBundleForHub(store: SqliteStore, skillId: string): SkillBundle {
11 const skill = store.getSkill(skillId);
12 if (!skill) {
13 throw new Error(`Skill not found: ${skillId}`);
14 }
15
16 const latestVersion = store.getLatestSkillVersion(skillId);
17 const skillMd = readSkillMarkdown(skill.dirPath, latestVersion?.content ?? "");
18
19 return {
20 metadata: {
21 id: skill.id,
22 name: skill.name,
23 description: skill.description,
24 version: skill.version,
25 qualityScore: skill.qualityScore,
26 },
27 bundle: {
28 skill_md: skillMd,
29 scripts: readCompanionFiles(path.join(skill.dirPath, "scripts")),
30 references: readCompanionFiles(path.join(skill.dirPath, "references")),
31 evals: readEvals(path.join(skill.dirPath, "evals", "evals.json")),
32 } satisfies SkillGenerateOutput,
33 };
34}
35
36function readSkillMarkdown(dirPath: string, fallback: string): string {
37 const skillMdPath = path.join(dirPath, "SKILL.md");

Callers 4

handleSkillVisibilityMethod · 0.90
handleSkillScopeMethod · 0.90
publishSkillBundleToHubFunction · 0.70

Calls 6

readSkillMarkdownFunction · 0.70
readCompanionFilesFunction · 0.70
readEvalsFunction · 0.70
getSkillMethod · 0.65
getLatestSkillVersionMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected