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

Function copyPluginToManagedRoot

packages/agent-core/src/plugin/manager.ts:334–352  ·  view source on GitHub ↗
(
  kimiHomeDir: string,
  id: string,
  sourceRoot: string,
)

Source from the content-addressed store, hash-verified

332}
333
334async function copyPluginToManagedRoot(
335 kimiHomeDir: string,
336 id: string,
337 sourceRoot: string,
338): Promise<string> {
339 const managedRoot = path.join(kimiHomeDir, 'plugins', 'managed', id);
340 const managedDir = path.dirname(managedRoot);
341 await mkdir(managedDir, { recursive: true });
342 const stagingRoot = await mkdtemp(path.join(managedDir, `${id}-`));
343 try {
344 await cp(sourceRoot, stagingRoot, { recursive: true });
345 await rm(managedRoot, { recursive: true, force: true });
346 await rename(stagingRoot, managedRoot);
347 } catch (error) {
348 await rm(stagingRoot, { recursive: true, force: true });
349 throw error;
350 }
351 return realpath(managedRoot);
352}
353
354async function recordFrom(input: {
355 id: string;

Callers 1

installMethod · 0.85

Calls 3

mkdtempFunction · 0.85
mkdirFunction · 0.50
realpathFunction · 0.50

Tested by

no test coverage detected