Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

550 B
Raw Blame
import { apiGet } from "./client";
import type { SearchResultResponse } from "./types";

export async function search(
  query: string,
  opts?: {
    search_type?: "semantic" | "fulltext";
    limit?: number;
    repo_id?: string;
  },
): Promise<SearchResultResponse[]> {
  const params: Record<string, string | number> = {
    query,
    search_type: opts?.search_type ?? "semantic",
    limit: opts?.limit ?? 10,
  };
  if (opts?.repo_id) {
    params.repo_id = opts.repo_id;
  }
  return apiGet<SearchResultResponse[]>("/api/search", params);
}