MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / fetchManifest

Function fetchManifest

apps/web/src/scripts/managed-indexing/test.ts:164–200  ·  view source on GitHub ↗
(
  organizationId: string | null,
  projectId: string,
  gitBranch: string,
  baseUrl: string,
  authToken: string
)

Source from the content-addressed store, hash-verified

162}
163
164async function fetchManifest(
165 organizationId: string | null,
166 projectId: string,
167 gitBranch: string,
168 baseUrl: string,
169 authToken: string
170): Promise<ManifestResponse> {
171 const url = new URL(`${baseUrl}/api/code-indexing/manifest`);
172 if (organizationId) url.searchParams.set('organizationId', organizationId);
173 url.searchParams.set('projectId', projectId);
174 url.searchParams.set('gitBranch', gitBranch);
175
176 const response = await fetch(url.toString(), {
177 method: 'GET',
178 headers: {
179 Authorization: `Bearer ${authToken}`,
180 },
181 });
182
183 if (!response.ok) {
184 // If manifest doesn't exist yet (404), return empty manifest
185 if (response.status === 404 || response.status === 400) {
186 return {
187 organizationId,
188 projectId,
189 gitBranch,
190 files: {},
191 totalFiles: 0,
192 lastUpdated: new Date().toISOString(),
193 };
194 }
195 const errorData = await response.json().catch(() => ({ error: 'Unknown error' }));
196 throw new Error(errorData.error || errorData.message || `HTTP ${response.status}`);
197 }
198
199 return response.json() as Promise<ManifestResponse>;
200}
201
202async function performSearch(
203 query: string,

Callers 1

indexFilesFunction · 0.85

Calls 4

setMethod · 0.65
toStringMethod · 0.65
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected