spaider
Version:
Deterministic-first AI code assistant that crawls your codebase to implement changes using open source LLMs
33 lines • 2.57 kB
TypeScript
import { ChatCompletionMessageParam } from "openai/resources/chat";
import { Change, FileContext } from "./types";
export declare function message(role: "system" | "user", content: string): ChatCompletionMessageParam;
export declare function system(content: string): ChatCompletionMessageParam;
export declare function user(content: string): ChatCompletionMessageParam;
export declare function readFile(filePath: string): Promise<string>;
export declare function detectLanguage(filePath: string): FileContext["language"];
export declare function getRelativePath(from: string, to: string): string;
export declare function filterPathsWithinProject(filePaths: string[], excludePaths: string[], projectRoot: string): string[];
export declare function sanitizePath(filePath: string): string;
export declare function getDisplayPath(filePath: string, projectRoot?: string): string;
export declare function ensureDirectoryExists(dirPath: string): Promise<void>;
export declare function loadFileContexts(filePaths: string[]): Promise<FileContext[]>;
export declare function formatFilePreview(file: FileContext): string;
export declare function formatFileSemantic(file: FileContext): string;
export declare function formatFilePreviews(files: FileContext[]): string;
export declare function formatFileSemantics(files: FileContext[]): string;
export declare function formatChanges(changes: Change[]): string;
export declare function formatWriteChanges(filePath: string, fileChanges: Change[]): string;
export declare function resolveFilePath(filePath: string, projectRoot: string): string;
export declare function ensureDirectoryForFile(filePath: string): Promise<void>;
export declare function normalizeFilePath(filePath: string): string;
export declare function isWithinProjectRoot(filePath: string, projectRoot: string): boolean;
export declare function getFileExtension(filePath: string): string;
export declare function getFileName(filePath: string): string;
export declare function getFileNameWithoutExtension(filePath: string): string;
export declare function joinPaths(...paths: string[]): string;
export declare function makeRelativeToProject(filePath: string, projectRoot: string): string;
export declare function fileExists(filePath: string): Promise<boolean>;
export declare function isDirectory(dirPath: string): Promise<boolean>;
export declare function safeWriteFile(filePath: string, content: string, projectRoot?: string): Promise<void>;
export declare function safeDeleteFile(filePath: string, projectRoot?: string): Promise<void>;
//# sourceMappingURL=utils.d.ts.map