UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

206 lines 5.48 kB
/** * @file git-workflow-orchestrator.ts * @description Git workflow orchestration and automation system * * Implements F-004/UC-008: Git Workflow Orchestration * - Automated git operations (commits, branches, merges, PRs) * - Conventional Commits support * - Branch strategy enforcement (GitFlow, GitHub Flow, trunk-based) * - Conflict detection and resolution guidance * - PR template management and automation * * @implements NFR-GIT-001: Git operations <5s for typical workflows * @implements NFR-GIT-002: Conflict detection accuracy >90% * @implements NFR-GIT-003: Commit message generation accuracy >85% */ export type BranchStrategy = 'gitflow' | 'github-flow' | 'trunk-based'; export type CommitType = 'feat' | 'fix' | 'docs' | 'style' | 'refactor' | 'perf' | 'test' | 'build' | 'ci' | 'chore'; export type MergeStrategy = 'merge' | 'squash' | 'rebase'; export interface GitConfig { repoPath: string; branchStrategy?: BranchStrategy; defaultBranch?: string; remote?: string; conventionalCommits?: boolean; autoGenerateMessages?: boolean; } export interface CommitOptions { message?: string; type?: CommitType; scope?: string; breaking?: boolean; files?: string[]; autoStage?: boolean; generateMessage?: boolean; } export interface BranchOptions { name: string; baseBranch?: string; strategy?: BranchStrategy; type?: 'feature' | 'bugfix' | 'hotfix' | 'release'; } export interface MergeOptions { sourceBranch: string; targetBranch?: string; strategy?: MergeStrategy; deleteSource?: boolean; checkConflicts?: boolean; } export interface PROptions { title?: string; body?: string; baseBranch?: string; assignees?: string[]; reviewers?: string[]; labels?: string[]; autoGenerate?: boolean; } export interface ConflictInfo { file: string; type: 'merge' | 'rebase' | 'cherry-pick'; severity: 'trivial' | 'moderate' | 'complex'; lineRanges: Array<{ start: number; end: number; }>; suggestions?: string[]; } export interface GitStatus { branch: string; remoteBranch?: string; ahead: number; behind: number; staged: string[]; unstaged: string[]; untracked: string[]; conflicts: string[]; } export interface GitWorkflowResult { success: boolean; operation: string; output?: string; error?: string; conflicts?: ConflictInfo[]; duration: number; } export declare class GitWorkflowOrchestrator { private config; constructor(config: GitConfig); /** * Get comprehensive git repository status */ getStatus(): Promise<GitStatus>; /** * Get current branch name */ private getCurrentBranch; /** * Get remote tracking branch */ private getRemoteBranch; /** * Get count of commits ahead of remote */ private getAheadCount; /** * Get count of commits behind remote */ private getBehindCount; /** * Get staged files */ private getStagedFiles; /** * Get unstaged files */ private getUnstagedFiles; /** * Get untracked files */ private getUntrackedFiles; /** * Get conflicted files */ private getConflicts; /** * Create a new branch following branch strategy */ createBranch(options: BranchOptions): Promise<GitWorkflowResult>; /** * Switch to an existing branch */ switchBranch(branchName: string): Promise<GitWorkflowResult>; /** * Delete a branch (local and optionally remote) */ deleteBranch(branchName: string, deleteRemote?: boolean): Promise<GitWorkflowResult>; /** * List all branches */ listBranches(includeRemote?: boolean): Promise<string[]>; /** * Create a commit with conventional commits support */ commit(options: CommitOptions): Promise<GitWorkflowResult>; /** * Stage files for commit */ stageFiles(files: string[]): Promise<void>; /** * Generate conventional commit message */ private generateCommitMessage; /** * Detect commit type from changed files */ private detectCommitType; /** * Generate commit description from files */ private generateCommitDescription; /** * Merge branches with conflict detection */ merge(options: MergeOptions): Promise<GitWorkflowResult>; /** * Detect potential merge conflicts */ detectMergeConflicts(sourceBranch: string, _targetBranch?: string): Promise<ConflictInfo[]>; /** * Analyze a specific conflict */ private analyzeConflict; /** * Generate conflict resolution suggestions */ private generateConflictSuggestions; /** * Create a pull request (requires GitHub CLI or API) */ createPR(options: PROptions): Promise<GitWorkflowResult>; /** * Get commits since base branch */ private getCommitsSinceBase; /** * Generate PR title from commits */ private generatePRTitle; /** * Generate PR body from commits */ private generatePRBody; /** * Format branch name according to strategy */ private formatBranchName; /** * Get default base branch for strategy */ private getDefaultBaseBranch; /** * Execute git command */ private execGit; } //# sourceMappingURL=git-workflow-orchestrator.d.ts.map