MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / indexRepo

Method indexRepo

packages/backend/src/api.ts:78–101  ·  view source on GitHub ↗
(req: Request, res: Response)

Source from the content-addressed store, hash-verified

76 }
77
78 private async indexRepo(req: Request, res: Response) {
79 const schema = z.object({
80 repoId: z.number(),
81 }).strict();
82
83 const parsed = schema.safeParse(req.body);
84 if (!parsed.success) {
85 res.status(400).json({ error: parsed.error.message });
86 return;
87 }
88
89 const { repoId } = parsed.data;
90 const repo = await this.prisma.repo.findUnique({
91 where: { id: repoId },
92 });
93
94 if (!repo) {
95 res.status(404).json({ error: 'Repo not found' });
96 return;
97 }
98
99 const [jobId] = await this.repoIndexManager.createJobs([repo], RepoIndexingJobType.INDEX);
100 res.status(200).json({ jobId });
101 }
102
103 private async triggerAccountPermissionSync(req: Request, res: Response) {
104 if (env.PERMISSION_SYNC_ENABLED !== 'true' || !await hasEntitlement('permission-syncing')) {

Callers

nothing calls this directly

Calls 1

createJobsMethod · 0.45

Tested by

no test coverage detected