/** * Atlas API Routes * * HTTP API endpoints for ingesting and querying code units and atlas runs. * Part of Code Atlas Epic (CA-006, CA-007) - Layer 2: API * * Endpoints: * POST /api/atlas/ingest - Batch ingest CodeAtlasRun with CodeUnits * GET /api/atlas/units - Query code units with filtering * GET /api/atlas/units/:id - Get a specific code unit * GET /api/atlas/runs - Query atlas runs * GET /api/atlas/runs/:runId - Get a specific atlas run */ import { Router } from "express"; import type Database from "better-sqlite3-multiple-ciphers"; import { z } from "zod"; /** * API error response structure */ export interface AtlasApiErrorResponse { error: string; message: string; code: number; field?: string; details?: unknown; } /** * Request schema for batch ingestion */ export declare const AtlasIngestRequestSchema: z.ZodObject<{ run: z.ZodObject<{ runId: z.ZodString; repoId: z.ZodString; filesRequested: z.ZodArray; filesScanned: z.ZodArray; unitsEmitted: z.ZodNumber; limits: z.ZodObject<{ maxFiles: z.ZodOptional; maxBytes: z.ZodOptional; }, z.core.$strip>; truncated: z.ZodBoolean; strategy: z.ZodOptional>; createdAt: z.ZodString; schemaVersion: z.ZodLiteral<"code-atlas-run-v0">; }, z.core.$strip>; units: z.ZodArray; symbolPath: z.ZodString; name: z.ZodString; span: z.ZodObject<{ startLine: z.ZodNumber; endLine: z.ZodNumber; }, z.core.$strip>; tags: z.ZodOptional>; docComment: z.ZodOptional; discoveredAt: z.ZodString; schemaVersion: z.ZodLiteral<"code-unit-v0">; }, z.core.$strip>>; }, z.core.$strip>; export type AtlasIngestRequest = z.infer; /** * Response type for successful ingestion */ export interface AtlasIngestResponse { runId: string; unitsIngested: number; unitsSkipped: number; durationMs: number; } /** * Paginated response structure for units */ export interface UnitsListResponse { items: unknown[]; total: number; limit: number; offset: number; } /** * Paginated response structure for runs */ export interface RunsListResponse { items: unknown[]; total: number; limit: number; offset: number; } /** * Create atlas router * Note: Authentication is handled by middleware at the app level */ export declare function createAtlasRouter(db: Database.Database): Router;