/** * `cortex_github_ingest_repo` — natural-language hook so an MCP client * (Claude Code, Claude Desktop, Pyre) can ask "ingest owner/name" * without the user opening the dashboard. * * Wraps adapter-github (it does NOT bypass it): the tool's job is to * 1. Normalize the input (owner/name slug, https URL, or git@ URL). * 2. Detect the already-connected case via the workspace's * `adapters.github.config.repos` list. * 3. Verify access against GitHub's REST API using the device-flow * token in the agent context (`tryReadGithubToken()`) or * GITHUB_TOKEN env, so a 404 / 401 surfaces as a useful action * ("not_accessible" / "auth_expired") rather than a sync failure * hours later. * 4. On success, add the slug to cortex.yaml and enqueue a * `github-sync` job that runs `ingest_repo` against the * `https://github.com/owner/name.git` URL — same path the * dashboard route uses, same persistent job registry so the * caller can poll progress at `/_dashboard/jobs/`. * * Why an MCP tool when the dashboard already does this: the MCP * surface runs inside an agent context with no session cookie — pyre's * "ingest owner/name" intent maps to this single tool call instead of * a multi-step browser flow. */ import { z } from "zod"; import type { McpTool } from "../tool.js"; declare const inputSchema: z.ZodObject<{ /** * Either `owner/name`, `https://github.com/owner/name(.git)?`, or * `git@github.com:owner/name.git`. Tree URLs (with `/blob/`) * are rejected — we want the canonical repo slug. */ repo: z.ZodString; }, "strip", z.ZodTypeAny, { repo: string; }, { repo: string; }>; type Action = "already_ingested" | "ingesting" | "not_accessible" | "auth_expired" | "github_not_configured" | "invalid_repo"; interface Output { action: Action; /** Canonical `owner/name` for the resolved input. Empty when invalid_repo. */ repo: string; message: string; /** Present when action='ingesting' — poll via kb_job_status / dashboard. */ jobId?: string; /** Reserved for the already_ingested branch. Populated once Slice C wires per-repo memory stats. */ memoryCount?: number; lastSyncedAt?: string | null; } export declare const cortexGithubIngestRepo: McpTool; export {}; //# sourceMappingURL=cortex-github-ingest-repo.d.ts.map