@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
58 lines • 1.85 kB
TypeScript
/**
* Git Utilities
*
* Shared git operations for the MCP server layer.
* Provides authenticated clone, pull, and push using simple-git.
*
* PRD #362: Git Operations for Recommend Tool
*
* Environment variables:
* - DOT_AI_GIT_TOKEN: PAT authentication token
* - GITHUB_APP_ENABLED: Enable GitHub App authentication
* - GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY, GITHUB_APP_INSTALLATION_ID: GitHub App config
*/
export interface GitAuthConfig {
pat?: string;
githubApp?: {
appId: string;
privateKey: string;
installationId?: string;
};
}
export declare function scrubCredentials(message: string): string;
export declare function getAuthenticatedUrl(repoUrl: string, token: string): string;
export declare function getAuthToken(authConfig: GitAuthConfig): Promise<string>;
export declare function getGitAuthConfigFromEnv(): GitAuthConfig;
/**
* Sanitize a relative path to prevent directory traversal.
* Rejects absolute paths and paths that escape the base directory.
*/
export declare function sanitizeRelativePath(relativePath: string): string;
export interface CloneOptions {
branch?: string;
depth?: number;
}
export declare function cloneRepo(repoUrl: string, targetDir: string, opts?: CloneOptions): Promise<{
localPath: string;
branch: string;
}>;
export declare function pullRepo(repoPath: string): Promise<{
branch: string;
}>;
export interface PushOptions {
branch?: string;
author?: {
name: string;
email: string;
};
}
export interface PushResult {
commitSha: string | undefined;
branch: string;
filesAdded: string[];
}
export declare function pushRepo(repoPath: string, files: Array<{
path: string;
content: string;
}>, commitMessage: string, opts?: PushOptions): Promise<PushResult>;
//# sourceMappingURL=git-utils.d.ts.map