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
163 lines • 4.71 kB
TypeScript
/**
* Git History Analyzer
*
* Analyzes Git repository history to extract project metadata including
* velocity metrics, team composition, and project maturity for automated intake.
*
* @module src/intake/git-history-analyzer
* @implements @.aiwg/requirements/use-cases/UC-003-generate-intake-from-codebase.md
* @architecture @.aiwg/architecture/software-architecture-doc.md - Section 5.2 Intake Coordinator
* @tests @test/unit/intake/git-history-analyzer.test.ts
* @command @.claude/commands/intake-from-codebase.md
* @agent @agentic/code/frameworks/sdlc-complete/agents/intake-coordinator.md
*/
export interface CommitInfo {
hash: string;
author: string;
email: string;
timestamp: number;
message: string;
date: Date;
}
export interface AuthorStats {
name: string;
email: string;
commitCount: number;
firstCommit: Date;
lastCommit: Date;
activeDays: number;
}
export interface VelocityMetrics {
commitsPerDay: number;
commitsPerWeek: number;
commitsPerMonth: number;
activeDaysRatio: number;
teamVelocity: number;
averageCommitsPerAuthor: number;
peakDay: string;
peakWeekCommits: number;
}
export type MaturityLevel = 'nascent' | 'mvp' | 'production' | 'mature';
export interface MaturityClassification {
level: MaturityLevel;
ageMonths: number;
totalCommits: number;
confidence: number;
indicators: string[];
}
export interface TeamInfo {
totalAuthors: number;
activeAuthors: number;
topContributors: AuthorStats[];
authorDistribution: Map<string, number>;
issoloProject: boolean;
teamSize: 'solo' | 'small' | 'medium' | 'large';
}
export interface BranchInfo {
name: string;
isDefault: boolean;
commitCount: number;
lastActivity: Date;
}
export interface RepositoryMetadata {
path: string;
name: string;
firstCommitDate: Date;
lastCommitDate: Date;
totalCommits: number;
branches: BranchInfo[];
defaultBranch: string;
hasRemote: boolean;
remoteUrl?: string;
}
export interface GitAnalysisResult {
repository: RepositoryMetadata;
velocity: VelocityMetrics;
maturity: MaturityClassification;
team: TeamInfo;
commits: CommitInfo[];
analysisTimeMs: number;
analyzedAt: string;
}
export interface AnalyzerOptions {
maxCommits?: number;
sinceMonths?: number;
includeAllBranches?: boolean;
excludeAuthors?: string[];
excludePatterns?: RegExp[];
}
/**
* Git History Analyzer
*
* Extracts project metadata from Git commit history for automated intake generation.
*/
export declare class GitHistoryAnalyzer {
private repoPath;
private options;
constructor(repoPath: string, options?: AnalyzerOptions);
/**
* Run comprehensive Git history analysis
*/
analyze(): Promise<GitAnalysisResult>;
/**
* Validate that the path is a Git repository
*/
validateRepository(): Promise<void>;
/**
* Execute a Git command in the repository
*/
executeGitCommand(args: string): Promise<string>;
/**
* Get commit history from Git log
*/
getCommitHistory(): Promise<CommitInfo[]>;
/**
* Parse Git log output into CommitInfo objects
*/
parseCommitLog(logOutput: string): CommitInfo[];
/**
* Get repository metadata
*/
getRepositoryMetadata(): Promise<RepositoryMetadata>;
/**
* Get branch information
*/
getBranches(): Promise<BranchInfo[]>;
/**
* Calculate velocity metrics from commit history
*/
calculateVelocity(commits: CommitInfo[]): VelocityMetrics;
/**
* Classify project maturity based on age and activity
*/
classifyMaturity(commits: CommitInfo[], repository: RepositoryMetadata): MaturityClassification;
/**
* Extract team information from commits
*/
extractTeamInfo(commits: CommitInfo[]): TeamInfo;
/**
* Get author statistics using git shortlog
*/
getAuthorStats(): Promise<AuthorStats[]>;
/**
* Helper to get week key for a date
*/
private getWeekKey;
/**
* Extract repository name from path or remote URL
*/
private extractRepoName;
}
/**
* Quick analysis function for simple use cases
*/
export declare function analyzeGitHistory(repoPath: string, options?: AnalyzerOptions): Promise<GitAnalysisResult>;
/**
* Get project maturity classification
*/
export declare function getProjectMaturity(repoPath: string): Promise<MaturityClassification>;
/**
* Get team composition from Git history
*/
export declare function getTeamComposition(repoPath: string): Promise<TeamInfo>;
//# sourceMappingURL=git-history-analyzer.d.ts.map