import { Parser, Language, Tree } from 'web-tree-sitter'; type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'silent'; type LogHandler = (level: Exclude, ...args: any[]) => void; interface TsConfig { compilerOptions?: { baseUrl?: string; paths?: Record; }; } interface AnalyzeProjectOptions { files: InputFile[]; tsconfig?: TsConfig; root?: string; onProgress?: (progress: { percentage: number; message: string; }) => void; logLevel?: LogLevel; signal?: AbortSignal; include?: string[]; exclude?: string[]; } type FormattingPreset = 'minimal' | 'compact' | 'default' | 'detailed' | 'verbose'; /** * Options to control the SCN output format. */ interface FormattingOptions { preset?: FormattingPreset; showOutgoing?: boolean; showIncoming?: boolean; showIcons?: boolean; showExportedIndicator?: boolean; showPrivateIndicator?: boolean; showModifiers?: boolean; showTags?: boolean; showSymbolIds?: boolean; groupMembers?: boolean; displayFilters?: Partial>; showFilePrefix?: boolean; showFileIds?: boolean; showOnlyExports?: boolean; } /** * Represents the token cost of toggling each formatting option. * The value is the delta when an option is toggled from its state in the `baseOptions`. * e.g. `new_token_count - base_token_count`. */ interface FormattingOptionsTokenImpact { options: Partial<{ [K in keyof Omit]: number; }>; displayFilters: Partial>; } /** * Represents a file to be processed. */ interface InputFile { path: string; content: string; } /** * Configuration for the SCN generation process. */ interface ScnTsConfig { files: InputFile[]; tsconfig?: TsConfig; formattingOptions?: FormattingOptions; root?: string; _test_id?: string; } /** * Options for initializing the Tree-sitter parser. */ interface ParserInitOptions { wasmBaseUrl: string; } /** * Represents a supported programming language and its configuration. */ type SymbolKind = 'class' | 'interface' | 'function' | 'method' | 'constructor' | 'variable' | 'property' | 'enum' | 'enum_member' | 'type_alias' | 'module' | 'decorator' | 'parameter' | 'type_parameter' | 'import_specifier' | 're_export' | 'react_component' | 'react_hook' | 'react_hoc' | 'jsx_attribute' | 'jsx_element' | 'styled_component' | 'css_class' | 'css_id' | 'css_tag' | 'css_at_rule' | 'css_property' | 'css_variable' | 'file' | 'reference' | 'comment' | 'error' | 'unresolved' | 'go_package' | 'go_struct' | 'go_goroutine' | 'rust_struct' | 'rust_trait' | 'rust_impl' | 'rust_macro' | 'java_package' | 'python_class' | 'unknown'; interface Position { line: number; column: number; } interface Range { start: Position; end: Position; } interface CodeSymbol { id: string; fileId: number; name: string; kind: SymbolKind; range: Range; isExported: boolean; isAbstract?: boolean; isStatic?: boolean; isReadonly?: boolean; isAsync?: boolean; isPure?: boolean; throws?: boolean; labels?: string[]; isGenerated?: boolean; languageDirectives?: string[]; superClass?: string; implementedInterfaces?: string[]; scopeRange: Range; accessibility?: 'public' | 'private' | 'protected'; signature?: string; typeAnnotation?: string; typeAliasValue?: string; dependencies: Relationship[]; } type RelationshipKind = 'import' | 'dynamic_import' | 'reference' | 'tagged' | 'export' | 'call' | 'extends' | 'implements' | 'references' | 'aliased' | 'goroutine' | 'macro'; interface Relationship { targetName: string; kind: RelationshipKind; range: Range; resolvedFileId?: number; resolvedSymbolId?: string; } interface SourceFile { id: number; relativePath: string; absolutePath: string; language: LanguageConfig; sourceCode: string; ast?: Tree; symbols: CodeSymbol[]; parseError: boolean; isGenerated?: boolean; languageDirectives?: string[]; fileRelationships?: Relationship[]; } /** * Represents a supported programming language and its configuration. */ interface LanguageConfig { id: string; name: string; extensions: string[]; wasmPath: string; parser?: Parser; loadedLanguage?: Language; queries?: Record; } declare class Logger { private handler; private level; private logLevels; setLogHandler(handler: LogHandler | null): void; setLevel(level: LogLevel): void; private shouldLog; private log; error(...args: any[]): void; warn(...args: any[]): void; info(...args: any[]): void; debug(...args: any[]): void; } declare const logger: Logger; declare function getFormattingOptionsForPreset(preset: FormattingPreset): FormattingOptions; /** * Calculates the token impact of toggling each formatting option. * This can be slow as it re-generates the SCN for each option. * @param analyzedFiles The result from `analyzeProject`. * @param baseOptions The formatting options to calculate deltas from. * @returns An object detailing the token change for toggling each option. */ declare const calculateTokenImpact: (analyzedFiles: SourceFile[], baseOptions: FormattingOptions) => FormattingOptionsTokenImpact; /** * Parses and analyzes a project's files to build a dependency graph. */ declare const analyzeProject: ({ files, tsconfig, root, onProgress, logLevel, signal, include, exclude, }: AnalyzeProjectOptions) => Promise<{ sourceFiles: SourceFile[]; analysisTime: number; }>; /** * Public API to initialize the parser. Must be called before any other APIs. */ declare const initializeParser: (options: ParserInitOptions) => Promise; /** * Initializes the tokenizer. Call this for consistency, although `countTokens` will auto-initialize on first use. * It's a synchronous and lightweight operation. */ declare const initializeTokenizer: () => boolean; type FileContent = InputFile; /** * Counts tokens in a string using the cl100k_base model. */ declare const countTokens: (text: string) => number; /** * Generate SCN from analyzed source files */ declare const generateScn: (analyzedFiles: SourceFile[], options?: FormattingOptions) => string; /** * Legacy API: Generate SCN from config (for backward compatibility) */ declare const generateScnFromConfig: (config: ScnTsConfig) => Promise; declare const ICONS: Record; declare const SCN_SYMBOLS: { FILE_PREFIX: string; EXPORTED_PREFIX: string; PRIVATE_PREFIX: string; OUTGOING_ARROW: string; INCOMING_ARROW: string; ASYNC: string; THROWS: string; PURE: string; TAG_GENERATED: string; TAG_DYNAMIC: string; TAG_GOROUTINE: string; TAG_MACRO: string; TAG_SYMBOL: string; TAG_PROXY: string; TAG_ABSTRACT: string; TAG_STATIC: string; TAG_STYLED: string; }; export { type AnalyzeProjectOptions, type CodeSymbol, type FileContent, type FormattingOptions, type FormattingOptionsTokenImpact, type FormattingPreset, ICONS, type InputFile, type LogHandler, type LogLevel, type ParserInitOptions, SCN_SYMBOLS, type ScnTsConfig, type SourceFile, type SymbolKind, type TsConfig, analyzeProject, calculateTokenImpact, countTokens, generateScn, generateScnFromConfig, getFormattingOptionsForPreset, initializeParser, initializeTokenizer, logger };