@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.
76 lines (75 loc) • 2.37 kB
TypeScript
import * as plugins from '../plugins.js';
import type { ContextMode, IContextResult, TaskType } from './types.js';
/**
* Enhanced ProjectContext that supports context optimization strategies
*/
export declare class EnhancedContext {
private projectDir;
private trimmer;
private configManager;
private contextMode;
private tokenBudget;
private contextResult;
/**
* Create a new EnhancedContext
* @param projectDirArg The project directory
*/
constructor(projectDirArg: string);
/**
* Initialize the context builder
*/
initialize(): Promise<void>;
/**
* Set the context mode
* @param mode The context mode to use
*/
setContextMode(mode: ContextMode): void;
/**
* Set the token budget
* @param maxTokens The maximum tokens to use
*/
setTokenBudget(maxTokens: number): void;
/**
* Gather files from the project
* @param includePaths Optional paths to include
* @param excludePaths Optional paths to exclude
*/
gatherFiles(includePaths?: string[], excludePaths?: string[]): Promise<Record<string, plugins.smartfile.SmartFile | plugins.smartfile.SmartFile[]>>;
/**
* Convert files to context string
* @param files The files to convert
* @param mode The context mode to use
*/
convertFilesToContext(files: plugins.smartfile.SmartFile[], mode?: ContextMode): Promise<string>;
/**
* Build context for the project
* @param taskType Optional task type for task-specific context
*/
buildContext(taskType?: TaskType): Promise<IContextResult>;
/**
* Update the context with git diff information for commit tasks
* @param gitDiff The git diff to include
*/
updateWithGitDiff(gitDiff: string): IContextResult;
/**
* Count tokens in a string
* @param text The text to count tokens for
* @param model The model to use for token counting
*/
countTokens(text: string, model?: string): number;
/**
* Get the context result
*/
getContextResult(): IContextResult;
/**
* Get the token count for the current context
*/
getTokenCount(): number;
/**
* Get both the context string and its token count
*/
getContextWithTokenCount(): {
context: string;
tokenCount: number;
};
}