MCPcopy Create free account
hub / github.com/Wirasm/kild / addProject

Function addProject

engine/src/kild/projects.ts:38–53  ·  view source on GitHub ↗
(name: string, dir: string)

Source from the content-addressed store, hash-verified

36 return []; // unreadable registry → no projects, not a crashed request
37 }
38 // Accept the canonical `{projects: [...]}`, and tolerate a bare array, which is what a
39 // hand-edited file usually becomes.
40 const list = Array.isArray(parsed)
41 ? parsed
42 : Array.isArray((parsed as { projects?: unknown })?.projects)
43 ? (parsed as { projects: unknown[] }).projects
44 : [];
45 return list.filter(
46 (entry): entry is Project =>
47 typeof entry === 'object' &&
48 entry !== null &&
49 typeof (entry as Project).name === 'string' &&
50 typeof (entry as Project).path === 'string',
51 );
52}
53
54export async function findProject(name: string): Promise<Project | null> {
55 return (await loadProjects()).find((p) => p.name === name) ?? null;
56}

Callers 2

projectFunction · 0.90
server.tsFile · 0.90

Calls 4

kildHomeFunction · 0.90
loadProjectsFunction · 0.85
projectsFileFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected