gaunt-sloth-assistant
Version:
[](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml) [ • 3.86 kB
TypeScript
import { GthConfig } from '#src/config.js';
export declare function toFileSafeString(string: string): string;
/**
* Returns a formatted date string in the format YYYY-MM-DD_HH-MM-SS using local time
* @returns A formatted date string
*/
export declare function fileSafeLocalDate(): string;
/**
* Generates a standardized filename with the format: gth_YYYY-MM-DD_HH-MM-SS_COMMAND.md
* @param command - The command that created the file (ASK, REVIEW, PR, etc.)
* @returns A standardized filename string
*/
export declare function generateStandardFileName(command: string): string;
export declare function readFileFromProjectDir(fileName: string): string;
export declare function readFileFromInstallDir(filePath: string): string;
export declare function writeFileIfNotExistsWithMessages(filePath: string, content: string): void;
export declare function appendToFile(filePath: string, content: string): void;
export declare function readFileSyncWithMessages(filePath: string, errorMessageIn?: string, noFileMessage?: string): string;
export declare function spawnCommand(command: string, args: string[], progressMessage: string, successMessage: string): Promise<string>;
export declare function getSlothVersion(): string;
export declare class ProgressIndicator {
private interval;
constructor(initialMessage: string, manual?: boolean);
private indicateInner;
indicate(): void;
stop(): void;
}
/**
* Truncate a string to a maximum length with ellipsis
*/
export declare function truncateString(str: string, maxLength: number): string;
/**
* Format tool call arguments in a human-readable way
*/
export declare function formatToolCallArgs(args: Record<string, unknown>): string;
/**
* Format a single tool call with name and arguments
*/
export declare function formatToolCall(toolName: string, args: Record<string, unknown>, prefix?: string): string;
/**
* Format multiple tool calls for display (matches Invocation.ts behavior)
*/
export declare function formatToolCalls(toolCalls: Array<{
name: string;
args?: Record<string, unknown>;
}>, maxLength?: number): string;
interface LLMOutput {
messages: Array<{
content: string;
}>;
}
/**
* Extracts the content of the last message from an LLM response
* @param output - The output from the LLM containing messages
* @returns The content of the last message
*/
export declare function extractLastMessageContent(output: LLMOutput): string;
/**
* Dynamically imports a module from a file path from the outside of the installation dir
* @returns A promise that resolves to the imported module
*/
export declare function importExternalFile(filePath: string): Promise<{
configure: () => Promise<Partial<GthConfig>>;
}>;
/**
* Alias for importExternalFile for backward compatibility with tests
* @param filePath - The path to the file to import
* @returns A promise that resolves to the imported module
*/
export declare const importFromFilePath: typeof importExternalFile;
/**
* Reads multiple files from the current directory and returns their contents
* @param fileNames - Array of file names to read
* @returns Combined content of all files with proper formatting, each file is wrapped in random block like <file-abvesde>
*/
export declare function readMultipleFilesFromProjectDir(fileNames: string | string[]): string;
export declare function execAsync(command: string): Promise<string>;
/**
* Utility function to execute hook(s) - either a single hook or an array of hooks
* Fully type-safe and works with any number of arguments
* @param hooks - Single hook function or array of hook functions (or undefined)
* @param args - Arguments to pass to each hook function
*/
export declare function executeHooks<T extends (...args: any[]) => Promise<void>>(hooks: T | T[] | undefined, ...args: Parameters<T>): Promise<void>;
export {};