MCPcopy Create free account
hub / github.com/Tencent/teamai-cli / resolveProjectResourceNamespaces

Function resolveProjectResourceNamespaces

src/projects.ts:165–189  ·  view source on GitHub ↗
(input: {
  manifest: ProjectsManifest;
  activeProjects: string[];
})

Source from the content-addressed store, hash-verified

163 * duplicate error, not a runtime precedence decision).
164 */
165export function resolveProjectResourceNamespaces(input: {
166 manifest: ProjectsManifest;
167 activeProjects: string[];
168}): Record<ProjectResourceType, string[]> {
169 const resolved = input.activeProjects.map((id) => getProjectOrThrow(input.manifest, id));
170
171 const namespaces: Record<ProjectResourceType, string[]> = {
172 knowledge: [],
173 skills: [],
174 learnings: [],
175 };
176
177 for (const type of PROJECT_RESOURCE_TYPES) {
178 const seen = new Set<string>();
179 for (const project of resolved) {
180 for (const namespace of project.resources[type]) {
181 if (seen.has(namespace)) continue;
182 seen.add(namespace);
183 namespaces[type].push(namespace);
184 }
185 }
186 }
187
188 return namespaces;
189}
190
191/**
192 * Resolve the active **learnings** namespaces for a directory, from the manifest

Callers 3

buildRolePullContextFunction · 0.85
projects.test.tsFile · 0.85

Calls 1

getProjectOrThrowFunction · 0.85

Tested by

no test coverage detected