sourcebot/packages/web/src/app/api/(server)/repos/route.ts
Wayne Sun ba4c8a58e7 feat: add temporal filtering to search and repository APIs
Add temporal filtering capabilities for searches by git branch/revision
and repository index dates (since/until). Integrates with the refactored
QueryIR-based search architecture.

- Add gitRevision, since, until parameters to SearchOptions
- Implement temporal repo filtering by indexedAt field
- Add branch filtering via QueryIR wrapper
- Add search_commits MCP tool for commit-based searches
- Update list_repos with activeAfter/activeBefore filtering
- Add 88 new tests (all passing)

Signed-off-by: Wayne Sun <gsun@redhat.com>
2025-12-07 15:50:48 -05:00

21 lines
721 B
TypeScript

import { getRepos } from "@/actions";
import { serviceErrorResponse } from "@/lib/serviceError";
import { isServiceError } from "@/lib/utils";
import { GetReposResponse } from "@/lib/types";
import { NextRequest } from "next/server";
export const GET = async (request: NextRequest) => {
const searchParams = request.nextUrl.searchParams;
const activeAfter = searchParams.get('activeAfter') || undefined;
const activeBefore = searchParams.get('activeBefore') || undefined;
const response: GetReposResponse = await getRepos({
activeAfter,
activeBefore,
});
if (isServiceError(response)) {
return serviceErrorResponse(response);
}
return Response.json(response);
}