repograph
Version:
Generate rich, semantic, and interactive codemaps with a functional, composable API for Node.js.
62 lines (54 loc) • 2.31 kB
TypeScript
import * as repograph_core from 'repograph-core';
import { FileContent, RankedCodeGraph, FileDiscoverer, Analyzer, Ranker, Renderer, RepoGraphMap } from 'repograph-core';
export * from 'repograph-core';
type RepoGraphOptions = {
root?: string;
output?: string;
include?: readonly string[];
ignore?: readonly string[];
noGitignore?: boolean;
rankingStrategy?: 'pagerank' | 'git-changes';
maxWorkers?: number;
logLevel?: 'silent' | 'error' | 'warn' | 'info' | 'debug';
rendererOptions?: repograph_core.RendererOptions;
files?: readonly FileContent[];
};
declare const analyzeProject: (options?: RepoGraphOptions) => Promise<RankedCodeGraph>;
declare const generateMap: (options?: RepoGraphOptions) => Promise<void>;
type MapGenerator = (config: RepoGraphOptions & {
root: string;
}) => Promise<RepoGraphMap>;
/**
* A Higher-Order Function that takes pipeline functions as arguments and
* returns a fully configured `generate` function for creating a codemap.
* This is the core of RepoGraph's composability.
*
* @param pipeline An object containing implementations for each pipeline stage.
* @returns An asynchronous function to generate and write the codemap.
*/
declare const createMapGenerator: (pipeline: {
readonly discover: FileDiscoverer;
readonly analyze: Analyzer;
readonly rank: Ranker;
readonly render: Renderer;
}) => MapGenerator;
/**
* Creates the default file discoverer. It uses globby to find all files,
* respecting .gitignore patterns and custom include/exclude rules.
* @returns A FileDiscoverer function.
*/
declare const createDefaultDiscoverer: () => FileDiscoverer;
declare const createTreeSitterAnalyzer: (options?: {
maxWorkers?: number;
}) => Analyzer;
declare const initializeParser: () => Promise<void>;
/**
* Creates a ranker based on Git commit history. Files changed more frequently are considered
* more important. Requires Git to be installed and the project to be a Git repository.
* @returns A Ranker function.
*/
declare const createGitRanker: (options?: {
maxCommits?: number;
}) => Ranker;
export { type RepoGraphOptions, analyzeProject, createDefaultDiscoverer, createGitRanker, createMapGenerator, createTreeSitterAnalyzer, generateMap, initializeParser };