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

Function listImportedIds

apps/vis/server/src/lib/import-store.ts:87–105  ·  view source on GitHub ↗
(home: string)

Source from the content-addressed store, hash-verified

85
86/** Enumerate imported bundle ids (newest-first by directory mtime). */
87export async function listImportedIds(home: string): Promise<string[]> {
88 const root = importedRootOf(home);
89 let entries: import('node:fs').Dirent[];
90 try {
91 entries = await readdir(root, { withFileTypes: true });
92 } catch {
93 return [];
94 }
95 const ids = entries
96 .filter((e) => e.isDirectory() && isImportId(e.name))
97 .map((e) => e.name);
98 const withMtime = await Promise.all(
99 ids.map(async (id) => {
100 const mtime = await stat(join(root, id)).then((s) => s.mtimeMs).catch(() => 0);
101 return { id, mtime };
102 }),
103 );
104 return withMtime.toSorted((a, b) => b.mtime - a.mtime).map((x) => x.id);
105}
106
107export async function readImportMeta(home: string, importId: string): Promise<ImportInfo | null> {
108 try {

Callers 2

listSessionsFunction · 0.90

Calls 4

importedRootOfFunction · 0.85
isImportIdFunction · 0.85
readdirFunction · 0.50
statFunction · 0.50

Tested by

no test coverage detected