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

Method statMany

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

Source from the content-addressed store, hash-verified

283 }
284
285 async statMany(
286 sessionId: string,
287 req: FsStatManyRequest,
288 ): Promise<FsStatManyResponse> {
289 const session = await this.sessions.get(sessionId);
290 const cwd = session.metadata.cwd;
291
292 const resolved = await Promise.all(
293 req.paths.map(async (p) => ({
294 raw: p,
295 safe: await resolveSafePath(cwd, p),
296 })),
297 );
298
299 const stats = await Promise.all(
300 resolved.map(async ({ raw, safe }) => {
301 try {
302 const st = await fs.stat(safe.absolute);
303 const name =
304 safe.relative === '.'
305 ? path.basename(cwd)
306 : path.basename(safe.absolute);
307 return {
308 raw,
309 entry: buildFsEntryFromStat(
310 safe.relative,
311 name,
312 safe.absolute,
313 st,
314 false,
315 ),
316 };
317 } catch {
318
319 return { raw, entry: null };
320 }
321 }),
322 );
323
324 const entries: Record<string, FsEntry | null> = {};
325 for (const { raw, entry } of stats) {
326 entries[raw] = entry;
327 }
328 return { entries };
329 }
330
331 async mkdir(sessionId: string, req: FsMkdirRequest): Promise<FsEntry> {
332 const session = await this.sessions.get(sessionId);

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected