/** * Shared Analysis Orchestrator * * Extracts the core analysis pipeline from the CLI analyze command into a * reusable function that can be called from both the CLI and a server-side * worker process. * * IMPORTANT: This module must NEVER call process.exit(). The caller (CLI * wrapper or server worker) is responsible for process lifecycle. */ export interface AnalyzeCallbacks { onProgress: (phase: string, percent: number, message: string) => void; onLog?: (message: string) => void; } export interface AnalyzeOptions { /** * Force a full re-index of the pipeline. Callers may OR this with * other flags that imply re-analysis (e.g. `--skills`), so the value * here is the PIPELINE-force signal, NOT the registry-collision * bypass. See `allowDuplicateName` below. */ force?: boolean; /** Repair only search indexes without re-running full parsing/indexing. */ repairFts?: boolean; /** Emit per-index FTS create logs. */ verbose?: boolean; embeddings?: boolean; /** * Override the auto-skip node-count cap for embedding generation. * `undefined` (default) keeps the built-in 50,000-node safety limit; * `0` disables the cap entirely; any positive integer sets a custom cap. * Mapped from the CLI's `--embeddings [limit]` argument. */ embeddingsNodeLimit?: number; /** * Explicitly drop any embeddings present in the existing index instead of * preserving them. Only meaningful when `embeddings` is false/undefined: * the default behavior in that case is to load the previously generated * embeddings and re-insert them after the rebuild so a routine * re-analyze does not silently wipe a long embedding pass (#issue: analyze * silently wipes existing embeddings when run without --embeddings). */ dropEmbeddings?: boolean; skipGit?: boolean; /** Skip AGENTS.md and CLAUDE.md gitnexus block updates. */ skipAgentsMd?: boolean; /** Omit volatile symbol/relationship counts from AGENTS.md and CLAUDE.md. */ noStats?: boolean; /** Skip installing standard GitNexus skill files to .claude/skills/gitnexus/. */ skipSkills?: boolean; /** * Default branch threaded into generated AGENTS.md / CLAUDE.md so the * regression-compare example uses the configured branch instead of a * hardcoded "main" (#243). Resolved by the CLI; `undefined` here keeps the * "main" fallback for non-CLI callers (e.g. the server analyze worker). */ defaultBranch?: string; /** * User-provided alias for the registry `name` (#829). When set, * forwarded to `registerRepo` so the indexed repo is stored under * this alias instead of the path-derived basename. */ registryName?: string; /** * Bypass the `RegistryNameCollisionError` guard and allow two paths * to register under the same `name` (#829). Controlled by the * dedicated `--allow-duplicate-name` CLI flag, intentionally * independent from `--force` — users who hit the collision guard * should be able to accept the duplicate without paying the cost * of a pipeline re-index. */ allowDuplicateName?: boolean; /** * Worker pool size override, threaded from the CLI `--workers` flag. * Forwarded to `PipelineOptions.workerPoolSize` so the parse phase * sizes the pool without `analyzeCommand` mutating `process.env`. * Must be a positive integer — `0` hard-errors (sequential parsing was * removed); `undefined` defers to the env / auto-formula fallback. */ workerPoolSize?: number; } export interface AnalyzeResult { repoName: string; repoPath: string; stats: { files?: number; nodes?: number; edges?: number; communities?: number; processes?: number; embeddings?: number; }; alreadyUpToDate?: boolean; /** The raw pipeline result — only populated when needed by callers (e.g. skill generation). */ pipelineResult?: any; /** True when analyze only repaired FTS indexes and skipped pipeline re-analysis. */ ftsRepairedOnly?: boolean; /** * True when the FTS extension was unavailable so search-index creation was * skipped (offline-first degradation). The graph is fully queryable; only * full-text/BM25 search is disabled. Lets callers (CLI summary, server) and * the persisted meta surface the degraded state instead of reporting healthy. */ ftsSkipped?: boolean; } export { deriveEmbeddingMode, DEFAULT_EMBEDDING_NODE_LIMIT } from './embedding-mode.js'; export type { EmbeddingMode } from './embedding-mode.js'; export declare const PHASE_LABELS: Record; /** * Run the full GitNexus analysis pipeline. * * This is the shared core extracted from the CLI `analyze` command. It * handles: pipeline execution, LadybugDB loading, FTS indexing, embedding * generation, metadata persistence, and AI context file generation. * * The function communicates progress and log messages exclusively through * the {@link AnalyzeCallbacks} interface — it never writes to stdout/stderr * directly and never calls `process.exit()`. */ export declare function runFullAnalysis(repoPath: string, options: AnalyzeOptions, callbacks: AnalyzeCallbacks): Promise;