UNPKG

@git.zone/tsdoc

Version:

A comprehensive TypeScript documentation tool that leverages AI to generate and enhance project documentation, including dynamic README creation, API docs via TypeDoc, and smart commit message generation.

61 lines (60 loc) 2.11 kB
import type { ITrimConfig, ContextMode } from './types.js'; /** * Class responsible for trimming file contents to reduce token usage * while preserving important information for context */ export declare class ContextTrimmer { private config; /** * Create a new ContextTrimmer with the given configuration * @param config The trimming configuration */ constructor(config?: ITrimConfig); /** * Trim a file's contents based on the configuration * @param filePath The path to the file * @param content The file's contents * @param mode The context mode to use * @returns The trimmed file contents */ trimFile(filePath: string, content: string, mode?: ContextMode): string; /** * Trim a TypeScript file to reduce token usage * @param content The TypeScript file contents * @returns The trimmed file contents */ private trimTypeScriptFile; /** * Limit a function body to a maximum number of lines * @param start The function signature and opening brace * @param body The function body * @param end The closing brace * @returns The limited function body */ private limitFunctionBody; /** * Trim a Markdown file to reduce token usage * @param content The Markdown file contents * @returns The trimmed file contents */ private trimMarkdownFile; /** * Trim a JSON file to reduce token usage * @param content The JSON file contents * @returns The trimmed file contents */ private trimJsonFile; /** * Update the trimmer configuration * @param config The new configuration to apply */ updateConfig(config: ITrimConfig): void; /** * Trim a file based on its importance tier * @param filePath The path to the file * @param content The file's contents * @param level The trimming level to apply ('none', 'light', 'aggressive') * @returns The trimmed file contents */ trimFileWithLevel(filePath: string, content: string, level: 'none' | 'light' | 'aggressive'): string; }