MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / getRepos

Function getRepos

packages/web/src/actions.ts:191–227  ·  view source on GitHub ↗
({
    where,
    take,
}: {
    where?: Prisma.RepoWhereInput,
    take?: number
} = {})

Source from the content-addressed store, hash-verified

189 }));
190
191export const getRepos = async ({
192 where,
193 take,
194}: {
195 where?: Prisma.RepoWhereInput,
196 take?: number
197} = {}) => sew(() =>
198 withOptionalAuth(async ({ org, prisma }) => {
199 const repos = await prisma.repo.findMany({
200 where: {
201 orgId: org.id,
202 ...where,
203 },
204 take,
205 });
206
207 const baseUrl = env.AUTH_URL;
208
209 return repos.map((repo) => ({
210 codeHostType: repo.external_codeHostType,
211 repoId: repo.id,
212 repoName: repo.name,
213 repoDisplayName: repo.displayName ?? undefined,
214 webUrl: `${baseUrl}${getBrowsePath({
215 repoName: repo.name,
216 path: '',
217 pathType: 'tree',
218 })}`,
219 externalWebUrl: repo.webUrl ?? undefined,
220 imageUrl: repo.imageUrl ?? undefined,
221 indexedAt: repo.indexedAt ?? undefined,
222 pushedAt: repo.pushedAt ?? undefined,
223 defaultBranch: repo.defaultBranch ?? undefined,
224 isFork: repo.isFork,
225 isArchived: repo.isArchived,
226 } satisfies RepositoryQuery))
227 }));
228
229/**
230 * Returns a set of aggregated stats about the repos in the org

Callers 3

SearchLandingPageFunction · 0.90
ChatLandingPageFunction · 0.90
PageFunction · 0.90

Calls 3

sewFunction · 0.90
withOptionalAuthFunction · 0.90
getBrowsePathFunction · 0.90

Tested by

no test coverage detected