@re-shell/cli
Version:
Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja
160 lines (159 loc) • 4.8 kB
TypeScript
import { EventEmitter } from 'events';
export interface GitConfig {
userName?: string;
userEmail?: string;
defaultBranch?: string;
remoteUrl?: string;
gitignoreTemplate?: string;
commitMessage?: string;
signCommits?: boolean;
hooks?: GitHook[];
}
export interface GitHook {
name: string;
script: string;
description?: string;
}
export interface GitStatus {
initialized: boolean;
hasRemote: boolean;
currentBranch: string;
clean: boolean;
ahead: number;
behind: number;
untracked: string[];
modified: string[];
staged: string[];
conflicts: string[];
}
export interface BranchConfig {
name: string;
type: 'feature' | 'bugfix' | 'hotfix' | 'release' | 'custom';
baseBranch?: string;
checkout?: boolean;
push?: boolean;
}
export interface CommitOptions {
message: string;
description?: string;
stage?: 'all' | 'modified' | 'specific';
files?: string[];
amend?: boolean;
noVerify?: boolean;
signoff?: boolean;
}
export interface GitFlowConfig {
masterBranch: string;
developBranch: string;
featurePrefix: string;
bugfixPrefix: string;
releasePrefix: string;
hotfixPrefix: string;
tagPrefix: string;
}
export interface InitializationResult {
success: boolean;
repoPath: string;
initialCommit?: string;
branch: string;
remote?: string;
errors?: string[];
warnings?: string[];
}
export declare class GitIntegration extends EventEmitter {
private defaultGitFlow;
private defaultGitignore;
constructor();
initializeRepository(projectPath: string, config?: GitConfig): Promise<InitializationResult>;
isGitRepository(projectPath: string): Promise<boolean>;
getStatus(projectPath: string): Promise<GitStatus>;
createBranch(projectPath: string, config: BranchConfig): Promise<{
success: boolean;
branch: string;
error?: string;
}>;
createFeatureBranch(projectPath: string, featureName: string, gitFlow?: Partial<GitFlowConfig>): Promise<{
success: boolean;
branch: string;
error?: string;
}>;
commit(projectPath: string, options: CommitOptions): Promise<{
success: boolean;
commitHash?: string;
error?: string;
}>;
private createInitialCommit;
setupGitFlow(projectPath: string, config?: Partial<GitFlowConfig>): Promise<{
success: boolean;
errors?: string[];
}>;
addRemote(projectPath: string, name: string, url: string): Promise<void>;
push(projectPath: string, options?: {
remote?: string;
branch?: string;
force?: boolean;
tags?: boolean;
setUpstream?: boolean;
}): Promise<{
success: boolean;
error?: string;
}>;
pull(projectPath: string, options?: {
remote?: string;
branch?: string;
rebase?: boolean;
noCommit?: boolean;
}): Promise<{
success: boolean;
error?: string;
}>;
tag(projectPath: string, tagName: string, options?: {
message?: string;
annotated?: boolean;
force?: boolean;
sign?: boolean;
}): Promise<{
success: boolean;
error?: string;
}>;
stash(projectPath: string, options?: {
message?: string;
includeUntracked?: boolean;
keepIndex?: boolean;
}): Promise<{
success: boolean;
error?: string;
}>;
getLog(projectPath: string, options?: {
limit?: number;
oneline?: boolean;
graph?: boolean;
author?: string;
since?: string;
until?: string;
}): Promise<string[]>;
getDiff(projectPath: string, options?: {
staged?: boolean;
nameOnly?: boolean;
stat?: boolean;
commit?: string;
}): Promise<string>;
setupHooks(projectPath: string, hooks: GitHook[]): Promise<void>;
configureUser(projectPath: string, userName?: string, userEmail?: string): Promise<void>;
getConfig(projectPath: string, key: string, options?: {
global?: boolean;
}): Promise<string | null>;
setConfig(projectPath: string, key: string, value: string, options?: {
global?: boolean;
}): Promise<void>;
private getCurrentBranch;
private isValidBranchName;
private generateReadme;
private runGitCommand;
ensureGitInstalled(): Promise<boolean>;
getGitVersion(): Promise<string | null>;
generateGitignore(projectType: string): string;
}
export declare function getGitIntegration(): GitIntegration;
export declare function initializeGitRepository(projectPath: string, config?: GitConfig): Promise<InitializationResult>;
export declare function getGitStatus(projectPath: string): Promise<GitStatus>;