/** * Helpers that read + mutate the `adapters.github.config.repos` list in * a workspace's cortex.yaml. Used by both the dashboard REST API * (routes/dashboard-github-repos.ts) and the `cortex_github_ingest_repo` * MCP tool so the two surfaces stay in lock-step. * * We do NOT touch the live `GithubAdapter` instance — adapter config is * the source of truth, and a server reload (`tryReload`) wires the new * value through the live registry. That matches the rest of cortex's * "config files are authoritative, in-memory state is rebuilt from * them" model (see dashboard-adapters.ts). * * The github adapter entry is auto-created the first time a repo is * added so the dashboard / MCP tool can connect a repo without forcing * the user to also run a separate "enable github adapter" step. The * entry shape mirrors `buildAdapterEntry()` in config-mutation.ts so * the wizard renderer still works on the resulting YAML. */ export interface ParsedRepoIdentifier { owner: string; name: string; } /** * Best-effort coercion of the strings users actually paste into chat: * - `owner/name` * - `https://github.com/owner/name` (with or without `.git`) * - `git@github.com:owner/name.git` * Returns null on anything malformed. We deliberately do NOT accept * tree URLs or refs — the slug is what the adapter keys off, so we * normalize to a plain owner/name pair. */ export declare function parseRepoIdentifier(input: string): ParsedRepoIdentifier | null; /** * Read the current `adapters.github.config.repos` list. Returns an * empty array if cortex.yaml is missing, the github adapter isn't * configured, or the repos list isn't an array yet. Resolves against * cortex.local.yaml first when present so we read the same overlay * the rest of the dashboard mutates. */ export declare function readGithubRepoList(configPath: string): Promise; /** * Append `/` to `adapters.github.config.repos` in * cortex.yaml. Idempotent — already-present entries return * `{added: false}`. Creates the github adapter entry if missing so * the dashboard can connect a repo as a single user step. Writes * through the .local overlay so the change survives template * rewrites. Caller is responsible for triggering a reload after. */ export declare function appendGithubRepo(configPath: string, fullName: string): Promise<{ added: boolean; }>; /** * Per-repo ingestion mode override. Mirrors Slice C's adapter-side * `repoModes: Record` config — * a row missing from the map falls back to the adapter-level `mode`, * which falls back to `dossier` if unset. The dashboard's row-level * Mode dropdown writes here. */ export type GithubRepoMode = "dossier" | "full" | "both"; export interface GithubModeSnapshot { /** Adapter-default mode. `null` when the adapter entry is missing. */ adapterMode: GithubRepoMode | null; /** Per-repo overrides; entries WITHOUT an override are omitted. */ repoModes: Record; } export declare function isGithubRepoMode(value: unknown): value is GithubRepoMode; /** * Snapshot the adapter-level mode + the per-repo override map. Both * fields ride under `adapters.github.config`; reads from the .local * overlay first so the dashboard sees what the writer most recently * wrote. */ export declare function readGithubModeSnapshot(configPath: string): Promise; /** * Set or clear a per-repo mode override. `mode: null` removes the * override, so the repo falls back to the adapter-level default. * Idempotent — returns `{changed: false}` when the desired value * already matches what's on disk. * * Caller is responsible for triggering a config reload after a * successful change. */ export declare function setGithubRepoMode(configPath: string, fullName: string, mode: GithubRepoMode | null): Promise<{ changed: boolean; }>; /** * Resolve the effective mode for one repo given a snapshot. The default * when nothing's configured anywhere is `dossier`, matching Slice A's * recommended posture — knowledge-first ingest, full source only when * the user explicitly opts in. */ export declare function resolveGithubRepoMode(snapshot: GithubModeSnapshot, fullName: string): GithubRepoMode; /** * Drop `/` from the github.repos list. Returns whether a * row was removed so the caller can render an accurate "Removed N * repos" line and skip the reload when nothing changed. */ export declare function removeGithubRepo(configPath: string, fullName: string): Promise<{ removed: boolean; }>; //# sourceMappingURL=github-repo-config.d.ts.map