@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
61 lines • 1.97 kB
TypeScript
/**
* User Prompts Loader
*
* Loads user-defined prompts from a git repository.
* Supports any git provider (GitHub, GitLab, Gitea, Forgejo, Bitbucket, etc.)
*
* Environment variables:
* - DOT_AI_USER_PROMPTS_REPO: Git repository URL (required to enable)
* - DOT_AI_USER_PROMPTS_BRANCH: Branch to use (default: main)
* - DOT_AI_USER_PROMPTS_PATH: Subdirectory within repo (default: root)
* - DOT_AI_GIT_TOKEN: Authentication token (optional)
* - DOT_AI_USER_PROMPTS_CACHE_TTL: Cache TTL in seconds (default: 86400 = 24h)
*/
import { Logger } from './error-handling';
import { Prompt } from '../tools/prompts';
/**
* Configuration for user prompts repository
*/
export interface UserPromptsConfig {
repoUrl: string;
branch: string;
subPath: string;
gitToken?: string;
cacheTtlSeconds: number;
}
/**
* Cache state for tracking repository freshness
*/
interface CacheState {
lastPullTime: number;
localPath: string;
}
/**
* Read user prompts configuration from environment variables
* Returns null if DOT_AI_USER_PROMPTS_REPO is not set
*/
export declare function getUserPromptsConfig(): UserPromptsConfig | null;
/**
* Get the cache directory for user prompts
* Tries project-relative tmp first, falls back to system temp
*/
export declare function getCacheDirectory(): string;
/**
* Sanitize URL for logging (remove credentials)
*/
export declare function sanitizeUrlForLogging(url: string): string;
/**
* Load user prompts from the configured git repository
* Returns empty array if not configured or on error
*/
export declare function loadUserPrompts(logger: Logger, forceRefresh?: boolean): Promise<Prompt[]>;
/**
* Clear the cache state (useful for testing)
*/
export declare function clearUserPromptsCache(): void;
/**
* Get current cache state (for testing/debugging)
*/
export declare function getUserPromptsCacheState(): CacheState | null;
export {};
//# sourceMappingURL=user-prompts-loader.d.ts.map