Initial commit: git-agent-sync CLI tool

This commit is contained in:
2026-02-03 07:53:16 +00:00
parent d1c4acfe53
commit 3cc12bd904

143
.src/types/index.ts Normal file
View File

@@ -0,0 +1,143 @@
import { SimpleGit } from 'simple-git';
export interface AgentWorkspace {
agentName: string;
branch: string;
path: string;
createdAt: string;
mainBranch: string;
environment: Record<string, string>;
}
export interface WorkspaceConfig {
agentName: string;
branch: string;
createdAt: string;
mainBranch: string;
environment: Record<string, string>;
customSetupScript?: string;
}
export interface FileChange {
file: string;
status: 'added' | 'modified' | 'deleted' | 'renamed';
oldPath?: string;
newPath?: string;
staged: boolean;
author: string;
timestamp: string;
diff: string;
}
export interface WorkspaceChange {
agentName: string;
branch: string;
path: string;
changes: FileChange[];
lastUpdated: string;
uncommittedCount: number;
}
export interface MergeResult {
success: boolean;
commitSha?: string;
message?: string;
conflicts?: ConflictInfo[];
error?: string;
}
export interface ConflictInfo {
file: string;
content: string;
}
export interface DiffResult {
agentName: string;
branch: string;
comparedBranch: string;
files: DiffFile[];
summary: DiffSummary;
}
export interface DiffFile {
file: string;
oldFile?: string;
changes: DiffLine[];
additions: number;
deletions: number;
}
export interface DiffLine {
type: 'context' | 'added' | 'deleted';
lineNumber: {
old: number | null;
new: number | null;
};
content: string;
}
export interface DiffSummary {
filesChanged: number;
additions: number;
deletions: number;
}
export interface GlobalConfig {
workspacePath: string;
defaultBranch: string;
autoInstall: boolean;
templates: Record<string, string>;
}
export interface CreateOptions {
path?: string;
template?: string;
installDeps: boolean;
environment?: Record<string, string>;
}
export interface ListOptions {
json: boolean;
verbose: boolean;
}
export interface StatusOptions {
short: boolean;
output?: string;
}
export interface MergeOptions {
force: boolean;
dryRun: boolean;
message?: string;
}
export interface DestroyOptions {
force: boolean;
preserveChanges: boolean;
outputPath?: string;
}
export interface DiffOptions {
output?: string;
short: boolean;
compare?: string;
}
export interface GitContext {
git: SimpleGit;
basePath: string;
workspacePath: string;
}
export interface WorkspaceInfo {
name: string;
path: string;
branch: string;
exists: boolean;
hasChanges: boolean;
changeCount: number;
lastCommit?: string;
}
export { SimpleGit };