/** * Checks if .gsloth directory exists in the project root * @returns Boolean indicating whether .gsloth directory exists */ export declare function gslothDirExists(): boolean; /** * Gets the path where gsloth should write files based on .gsloth directory existence * @param filename The filename to append to the path * @returns The resolved path where the file should be written */ export declare function getGslothFilePath(filename: string): string; /** * Gets the path where gsloth should write configuration files based on .gsloth directory existence. * The main difference from {@link @gaunt-sloth/core!utils/fileUtils.getGslothConfigReadPath | getGslothConfigReadPath} is that this getGslothConfigWritePath * method creates internal settings directory if it does not exist. * * If .gsloth dir exists returns `projectdir/.gsloth/.gsloth-settings` * If .gsloth dir does not exist returns `projectdir` * * When `identityProfileRaw` names a profile, the path is always * `projectdir/.gsloth/.gsloth-settings/`, creating `.gsloth` and the profile dir as * needed — a named profile only exists under `.gsloth-settings/`, so there is no project-root * fallback for it. A blank/whitespace-only profile name counts as "no profile". * * @param filename The configuration filename * @param identityProfileRaw Optional identity profile subdirectory name within `.gsloth-settings` * @returns The resolved path where the configuration file should be written */ export declare function getGslothConfigWritePath(filename: string, identityProfileRaw?: string): string; /** * Gets the path where gsloth should look for configuration files based on .gsloth directory existence * @param filename The configuration filename to look for * @param identityProfileRaw The identity profile dir within GSLOTH_SETTINGS_DIR to look for the configuration file in. * @returns The resolved path where the configuration file should be found */ export declare function getGslothConfigReadPath(filename: string, identityProfileRaw: string | undefined): string; /** * Resolve an explicit output path string to an absolute file path. * Concerned only with string values: * - If the string includes a path separator, resolve relative to project root and ensure parent directories exist. * - If it's a bare filename, place it under .gsloth/ when present, otherwise project root. */ export declare function resolveOutputPath(writeOutputToFile: string): string; 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; /** * 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 */ export declare function readMultipleFilesFromProjectDir(fileNames: string | string[]): string; /** * Read a file shipped with an installed package. Defaults to the core package dir; * downstream packages shipping their own default files (e.g. prompts) pass their own * package dir. */ export declare function readFileFromInstallDir(filePath: string, packageDir?: string): string; /** * No-clobber write: writes `content` only when `filePath` does not already exist. * @returns `true` when the file was written, `false` when it was skipped because it * already existed. Callers use the return value to avoid claiming success on a skip. */ export declare function writeFileIfNotExistsWithMessages(filePath: string, content: string): boolean; /** * Unconditional write: writes (or overwrites) `content` at `filePath`, creating parent * directories as needed. Use this only for the config-overwrite path (an explicit user / * `--force` decision); the no-clobber {@link writeFileIfNotExistsWithMessages} still guards * user-editable preamble files (guidelines / review). */ export declare function writeFileWithMessages(filePath: string, content: string): void; /** * Config-file write that honours an overwrite flag. * - `force === true` → always (over)writes. * - `force === false` → no-clobber (skips + warns when the file already exists). * @returns `true` when a write happened, `false` when it was skipped. */ export declare function writeConfigFileWithMessages(filePath: string, content: string, force?: boolean): boolean; export declare function appendToFile(filePath: string, content: string): void; export declare function readFileSyncWithMessages(filePath: string, errorMessageIn?: string, noFileMessage?: string): string; /** * Dynamically imports a module from a file path from the outside of the installation dir. * `.ts` modules are loaded through jiti (Node's native dynamic `import()` cannot load * TypeScript), so `.gsloth.config.ts` honours the same async `configure()` contract as * `.js`/`.mjs`. All other extensions use native dynamic import. * @returns A promise that resolves to the imported module */ export declare function importExternalFile(filePath: string): Promise>; /** * Returns the output file path for a given command execution based on configuration. * - If writeOutputToFile is false, returns null. * - If writeOutputToFile is a string, resolves it without generating a default filename. * - If writeOutputToFile is true, generates a standard filename from source and resolves it under .gsloth/ (when present) or project root. */ export declare function getCommandOutputFilePath(config: { writeOutputToFile: boolean | string; }, source: string): string | null;