MCPcopy Create free account
hub / github.com/NiladriHazra/WhatToBuild / getFullFileTree

Method getFullFileTree

lib/github.ts:261–285  ·  view source on GitHub ↗
(repoFullName: string)

Source from the content-addressed store, hash-verified

259
260 // eslint-disable-next-line @typescript-eslint/no-explicit-any
261 async getFullFileTree(repoFullName: string): Promise<any[]> {
262 const [owner, repo] = repoFullName.split('/');
263 try {
264 const repoDetails = await axios.get(`${this.baseURL}/repos/${owner}/${repo}`, { headers: this.getHeaders() });
265 const defaultBranch = repoDetails.data.default_branch;
266
267 const branchDetails = await axios.get(`${this.baseURL}/repos/${owner}/${repo}/branches/${defaultBranch}`, { headers: this.getHeaders() });
268 const treeSha = branchDetails.data.commit.commit.tree.sha;
269
270 const treeResponse = await axios.get(`${this.baseURL}/repos/${owner}/${repo}/git/trees/${treeSha}?recursive=1`, { headers: this.getHeaders() });
271
272 interface TreeNode {
273 path: string;
274 mode: string;
275 type: string;
276 sha: string;
277 size?: number;
278 url: string;
279 }
280 return treeResponse.data.tree.filter((node: TreeNode) => node.type === 'blob');
281 } catch (error) {
282 console.error(`Failed to fetch file tree for ${repoFullName}:`, error);
283 throw new Error('Could not fetch the repository file tree.');
284 }
285 }
286
287 async getRepositoryIssues(
288 repoFullName: string,

Callers 3

GETFunction · 0.95
GETFunction · 0.95
GETFunction · 0.95

Calls 1

getHeadersMethod · 0.95

Tested by

no test coverage detected