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

Method mkdir

packages/agent-core/src/services/fs/fsService.ts:331–353  ·  view source on GitHub ↗
(sessionId: string, req: FsMkdirRequest)

Source from the content-addressed store, hash-verified

329 }
330
331 async mkdir(sessionId: string, req: FsMkdirRequest): Promise<FsEntry> {
332 const session = await this.sessions.get(sessionId);
333 const cwd = session.metadata.cwd;
334 const safe = await resolveSafePath(cwd, req.path);
335
336 try {
337 await fs.mkdir(safe.absolute, { recursive: req.recursive });
338 } catch (err) {
339 const code = (err as NodeJS.ErrnoException).code;
340 if (code === 'EEXIST') {
341 throw new FsAlreadyExistsError(req.path);
342 }
343 if (code === 'ENOENT' || code === 'ENOTDIR') {
344 // Non-recursive mkdir whose parent is missing / not a directory.
345 throw new FsPathNotFoundError(req.path);
346 }
347 throw err;
348 }
349
350 const st = await fs.stat(safe.absolute);
351 const name = path.basename(safe.absolute);
352 return buildFsEntryFromStat(safe.relative, name, safe.absolute, st, false);
353 }
354
355 async resolveDownload(
356 sessionId: string,

Callers

nothing calls this directly

Calls 5

resolveSafePathFunction · 0.90
buildFsEntryFromStatFunction · 0.85
getMethod · 0.65
mkdirMethod · 0.65
statMethod · 0.65

Tested by

no test coverage detected