MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / pushProvidedRoot

Function pushProvidedRoot

packages/agent-core/src/skill/scanner.ts:342–360  ·  view source on GitHub ↗
(
  out: SkillRoot[],
  root: SkillRoot,
  isDir: (p: string) => Promise<boolean>,
  realpath: (p: string) => Promise<string>,
)

Source from the content-addressed store, hash-verified

340}
341
342async function pushProvidedRoot(
343 out: SkillRoot[],
344 root: SkillRoot,
345 isDir: (p: string) => Promise<boolean>,
346 realpath: (p: string) => Promise<string>,
347): Promise<boolean> {
348 if (!(await isDir(root.path))) return false;
349 const resolved = await realpath(root.path);
350 const existingIndex = out.findIndex((existing) => existing.path === resolved);
351 if (existingIndex < 0) {
352 out.push({ ...root, path: resolved });
353 return true;
354 }
355 const existing = out[existingIndex];
356 if (existing !== undefined && existing.plugin === undefined && root.plugin !== undefined) {
357 out[existingIndex] = { ...existing, plugin: root.plugin };
358 }
359 return true;
360}
361
362async function parseAndRegister(input: {
363 readonly parse: NonNullable<DiscoverSkillsOptions['parse']>;

Callers 1

resolveSkillRootsFunction · 0.85

Calls 3

isDirFunction · 0.85
realpathFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected