@nahisaho/musubix-codegraph 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +13 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +318 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/pr/errors.d.ts +63 -0
- package/dist/pr/errors.d.ts.map +1 -0
- package/dist/pr/errors.js +116 -0
- package/dist/pr/errors.js.map +1 -0
- package/dist/pr/git-operations.d.ts +186 -0
- package/dist/pr/git-operations.d.ts.map +1 -0
- package/dist/pr/git-operations.js +441 -0
- package/dist/pr/git-operations.js.map +1 -0
- package/dist/pr/github-adapter.d.ts +163 -0
- package/dist/pr/github-adapter.d.ts.map +1 -0
- package/dist/pr/github-adapter.js +467 -0
- package/dist/pr/github-adapter.js.map +1 -0
- package/dist/pr/index.d.ts +20 -0
- package/dist/pr/index.d.ts.map +1 -0
- package/dist/pr/index.js +26 -0
- package/dist/pr/index.js.map +1 -0
- package/dist/pr/pr-creator.d.ts +173 -0
- package/dist/pr/pr-creator.d.ts.map +1 -0
- package/dist/pr/pr-creator.js +468 -0
- package/dist/pr/pr-creator.js.map +1 -0
- package/dist/pr/pr-template.d.ts +105 -0
- package/dist/pr/pr-template.d.ts.map +1 -0
- package/dist/pr/pr-template.js +273 -0
- package/dist/pr/pr-template.js.map +1 -0
- package/dist/pr/refactoring-applier.d.ts +143 -0
- package/dist/pr/refactoring-applier.d.ts.map +1 -0
- package/dist/pr/refactoring-applier.js +412 -0
- package/dist/pr/refactoring-applier.js.map +1 -0
- package/dist/pr/types.d.ts +362 -0
- package/dist/pr/types.d.ts.map +1 -0
- package/dist/pr/types.js +63 -0
- package/dist/pr/types.js.map +1 -0
- package/package.json +11 -2
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nahisaho/musubix-codegraph - Git Operations
|
|
3
|
+
*
|
|
4
|
+
* Git operations wrapper using simple-git
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @module @nahisaho/musubix-codegraph/pr
|
|
8
|
+
*
|
|
9
|
+
* @see REQ-CG-PR-003 - Git Branch Creation
|
|
10
|
+
* @see REQ-CG-PR-004 - Auto Commit
|
|
11
|
+
* @see DES-CG-PR-004 - Class Design
|
|
12
|
+
*/
|
|
13
|
+
import type { BranchInfo, CommitInfo, GitOperationOptions, CodeChange } from './types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Git operations wrapper
|
|
16
|
+
*
|
|
17
|
+
* Provides a safe interface for Git operations needed for PR creation.
|
|
18
|
+
* Uses child_process to interact with Git directly.
|
|
19
|
+
*
|
|
20
|
+
* @see DES-CG-PR-004
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const git = new GitOperations('/path/to/repo');
|
|
24
|
+
* await git.createBranch('refactor/extract-interface');
|
|
25
|
+
* await git.commit('refactor(auth): extract IAuthService interface');
|
|
26
|
+
* await git.push();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class GitOperations {
|
|
30
|
+
private readonly repoPath;
|
|
31
|
+
private readonly remote;
|
|
32
|
+
/**
|
|
33
|
+
* Create a new GitOperations instance
|
|
34
|
+
* @param options - Git operation options
|
|
35
|
+
*/
|
|
36
|
+
constructor(options: GitOperationOptions);
|
|
37
|
+
/**
|
|
38
|
+
* Check if path is a Git repository
|
|
39
|
+
*/
|
|
40
|
+
isGitRepository(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Get repository root path
|
|
43
|
+
*/
|
|
44
|
+
getRepoRoot(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Get current branch name
|
|
47
|
+
* @see REQ-CG-PR-003
|
|
48
|
+
*/
|
|
49
|
+
getCurrentBranch(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Get default branch name (main or master)
|
|
52
|
+
*/
|
|
53
|
+
getDefaultBranch(): string;
|
|
54
|
+
/**
|
|
55
|
+
* List all branches
|
|
56
|
+
*/
|
|
57
|
+
listBranches(): BranchInfo[];
|
|
58
|
+
/**
|
|
59
|
+
* Check if branch exists
|
|
60
|
+
*/
|
|
61
|
+
branchExists(branchName: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Create a new branch
|
|
64
|
+
* @see REQ-CG-PR-003
|
|
65
|
+
*/
|
|
66
|
+
createBranch(branchName: string, baseBranch?: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Checkout an existing branch
|
|
69
|
+
*/
|
|
70
|
+
checkout(branchName: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Delete a branch
|
|
73
|
+
*/
|
|
74
|
+
deleteBranch(branchName: string, force?: boolean): void;
|
|
75
|
+
/**
|
|
76
|
+
* Check for uncommitted changes
|
|
77
|
+
*/
|
|
78
|
+
hasUncommittedChanges(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Get list of modified files
|
|
81
|
+
*/
|
|
82
|
+
getModifiedFiles(): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Stage files for commit
|
|
85
|
+
*/
|
|
86
|
+
stageFiles(files: string[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* Stage all changes
|
|
89
|
+
*/
|
|
90
|
+
stageAll(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Unstage files
|
|
93
|
+
*/
|
|
94
|
+
unstageFiles(files: string[]): void;
|
|
95
|
+
/**
|
|
96
|
+
* Discard changes in working tree
|
|
97
|
+
*/
|
|
98
|
+
discardChanges(files: string[]): void;
|
|
99
|
+
/**
|
|
100
|
+
* Stash changes
|
|
101
|
+
*/
|
|
102
|
+
stash(message?: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Pop stash
|
|
105
|
+
*/
|
|
106
|
+
stashPop(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Create a commit
|
|
109
|
+
* @see REQ-CG-PR-004
|
|
110
|
+
*/
|
|
111
|
+
commit(message: string, options?: {
|
|
112
|
+
allowEmpty?: boolean;
|
|
113
|
+
}): CommitInfo;
|
|
114
|
+
/**
|
|
115
|
+
* Get last commit info
|
|
116
|
+
*/
|
|
117
|
+
getLastCommit(): CommitInfo;
|
|
118
|
+
/**
|
|
119
|
+
* Get commit history
|
|
120
|
+
*/
|
|
121
|
+
getCommitHistory(count?: number): CommitInfo[];
|
|
122
|
+
/**
|
|
123
|
+
* Push branch to remote
|
|
124
|
+
*/
|
|
125
|
+
push(options?: {
|
|
126
|
+
setUpstream?: boolean;
|
|
127
|
+
force?: boolean;
|
|
128
|
+
}): void;
|
|
129
|
+
/**
|
|
130
|
+
* Fetch from remote
|
|
131
|
+
*/
|
|
132
|
+
fetch(prune?: boolean): void;
|
|
133
|
+
/**
|
|
134
|
+
* Pull from remote
|
|
135
|
+
*/
|
|
136
|
+
pull(rebase?: boolean): void;
|
|
137
|
+
/**
|
|
138
|
+
* Get remote URL
|
|
139
|
+
*/
|
|
140
|
+
getRemoteUrl(): string;
|
|
141
|
+
/**
|
|
142
|
+
* Parse GitHub owner/repo from remote URL
|
|
143
|
+
*/
|
|
144
|
+
parseRemoteUrl(): {
|
|
145
|
+
owner: string;
|
|
146
|
+
repo: string;
|
|
147
|
+
} | null;
|
|
148
|
+
/**
|
|
149
|
+
* Get diff for staged changes
|
|
150
|
+
*/
|
|
151
|
+
getStagedDiff(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Get diff for unstaged changes
|
|
154
|
+
*/
|
|
155
|
+
getUnstagedDiff(): string;
|
|
156
|
+
/**
|
|
157
|
+
* Get diff between branches
|
|
158
|
+
*/
|
|
159
|
+
getDiffBetweenBranches(baseBranch: string, headBranch?: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Get diff stats
|
|
162
|
+
*/
|
|
163
|
+
getDiffStats(baseBranch?: string): {
|
|
164
|
+
additions: number;
|
|
165
|
+
deletions: number;
|
|
166
|
+
files: number;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Apply code changes to files
|
|
170
|
+
* @see REQ-CG-PR-002
|
|
171
|
+
*/
|
|
172
|
+
applyCodeChanges(changes: CodeChange[]): string[];
|
|
173
|
+
/**
|
|
174
|
+
* Revert changes to a file
|
|
175
|
+
*/
|
|
176
|
+
revertFile(filePath: string): void;
|
|
177
|
+
/**
|
|
178
|
+
* Execute a git command synchronously
|
|
179
|
+
*/
|
|
180
|
+
private git;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Create a GitOperations instance
|
|
184
|
+
*/
|
|
185
|
+
export declare function createGitOperations(repoPath: string, remote?: string): GitOperations;
|
|
186
|
+
//# sourceMappingURL=git-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-operations.d.ts","sourceRoot":"","sources":["../../src/pr/git-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;;OAGG;gBACS,OAAO,EAAE,mBAAmB;IAcxC;;OAEG;IACH,eAAe,IAAI,OAAO;IAS1B;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAgB1B;;OAEG;IACH,YAAY,IAAI,UAAU,EAAE;IAsB5B;;OAEG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAazC;;;OAGG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAU3D;;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AM;IAIvB;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM;IAKvE;;OAEG;IACH,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAoB1F;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE;IAqCjD;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQlC;;OAEG;IACH,OAAO,CAAC,GAAG;CAcZ;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,CAEpF"}
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nahisaho/musubix-codegraph - Git Operations
|
|
3
|
+
*
|
|
4
|
+
* Git operations wrapper using simple-git
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @module @nahisaho/musubix-codegraph/pr
|
|
8
|
+
*
|
|
9
|
+
* @see REQ-CG-PR-003 - Git Branch Creation
|
|
10
|
+
* @see REQ-CG-PR-004 - Auto Commit
|
|
11
|
+
* @see DES-CG-PR-004 - Class Design
|
|
12
|
+
*/
|
|
13
|
+
import { execSync } from 'node:child_process';
|
|
14
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
/**
|
|
17
|
+
* Git operations wrapper
|
|
18
|
+
*
|
|
19
|
+
* Provides a safe interface for Git operations needed for PR creation.
|
|
20
|
+
* Uses child_process to interact with Git directly.
|
|
21
|
+
*
|
|
22
|
+
* @see DES-CG-PR-004
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const git = new GitOperations('/path/to/repo');
|
|
26
|
+
* await git.createBranch('refactor/extract-interface');
|
|
27
|
+
* await git.commit('refactor(auth): extract IAuthService interface');
|
|
28
|
+
* await git.push();
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class GitOperations {
|
|
32
|
+
repoPath;
|
|
33
|
+
remote;
|
|
34
|
+
/**
|
|
35
|
+
* Create a new GitOperations instance
|
|
36
|
+
* @param options - Git operation options
|
|
37
|
+
*/
|
|
38
|
+
constructor(options) {
|
|
39
|
+
this.repoPath = options.repoPath;
|
|
40
|
+
this.remote = options.remote ?? 'origin';
|
|
41
|
+
// Validate repository
|
|
42
|
+
if (!this.isGitRepository()) {
|
|
43
|
+
throw new Error(`Not a git repository: ${this.repoPath}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Repository Information
|
|
48
|
+
// ============================================================================
|
|
49
|
+
/**
|
|
50
|
+
* Check if path is a Git repository
|
|
51
|
+
*/
|
|
52
|
+
isGitRepository() {
|
|
53
|
+
try {
|
|
54
|
+
this.git(['rev-parse', '--git-dir']);
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get repository root path
|
|
63
|
+
*/
|
|
64
|
+
getRepoRoot() {
|
|
65
|
+
return this.git(['rev-parse', '--show-toplevel']).trim();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get current branch name
|
|
69
|
+
* @see REQ-CG-PR-003
|
|
70
|
+
*/
|
|
71
|
+
getCurrentBranch() {
|
|
72
|
+
return this.git(['rev-parse', '--abbrev-ref', 'HEAD']).trim();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get default branch name (main or master)
|
|
76
|
+
*/
|
|
77
|
+
getDefaultBranch() {
|
|
78
|
+
try {
|
|
79
|
+
// Try to get from remote HEAD
|
|
80
|
+
const remoteHead = this.git(['symbolic-ref', `refs/remotes/${this.remote}/HEAD`]);
|
|
81
|
+
return remoteHead.replace(`refs/remotes/${this.remote}/`, '').trim();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Fallback: check if main exists, otherwise master
|
|
85
|
+
try {
|
|
86
|
+
this.git(['rev-parse', '--verify', 'main']);
|
|
87
|
+
return 'main';
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return 'master';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* List all branches
|
|
96
|
+
*/
|
|
97
|
+
listBranches() {
|
|
98
|
+
const output = this.git([
|
|
99
|
+
'for-each-ref',
|
|
100
|
+
'--format=%(refname:short)|%(HEAD)|%(upstream:short)|%(objectname:short)',
|
|
101
|
+
'refs/heads',
|
|
102
|
+
]);
|
|
103
|
+
return output
|
|
104
|
+
.trim()
|
|
105
|
+
.split('\n')
|
|
106
|
+
.filter((line) => line.length > 0)
|
|
107
|
+
.map((line) => {
|
|
108
|
+
const [name, head, tracking, commit] = line.split('|');
|
|
109
|
+
return {
|
|
110
|
+
name,
|
|
111
|
+
current: head === '*',
|
|
112
|
+
tracking: tracking || undefined,
|
|
113
|
+
commit,
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Check if branch exists
|
|
119
|
+
*/
|
|
120
|
+
branchExists(branchName) {
|
|
121
|
+
try {
|
|
122
|
+
this.git(['rev-parse', '--verify', branchName]);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// ============================================================================
|
|
130
|
+
// Branch Operations
|
|
131
|
+
// ============================================================================
|
|
132
|
+
/**
|
|
133
|
+
* Create a new branch
|
|
134
|
+
* @see REQ-CG-PR-003
|
|
135
|
+
*/
|
|
136
|
+
createBranch(branchName, baseBranch) {
|
|
137
|
+
const base = baseBranch ?? this.getCurrentBranch();
|
|
138
|
+
if (this.branchExists(branchName)) {
|
|
139
|
+
throw new Error(`Branch already exists: ${branchName}`);
|
|
140
|
+
}
|
|
141
|
+
this.git(['checkout', '-b', branchName, base]);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Checkout an existing branch
|
|
145
|
+
*/
|
|
146
|
+
checkout(branchName) {
|
|
147
|
+
if (!this.branchExists(branchName)) {
|
|
148
|
+
throw new Error(`Branch does not exist: ${branchName}`);
|
|
149
|
+
}
|
|
150
|
+
this.git(['checkout', branchName]);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Delete a branch
|
|
154
|
+
*/
|
|
155
|
+
deleteBranch(branchName, force = false) {
|
|
156
|
+
const flag = force ? '-D' : '-d';
|
|
157
|
+
this.git(['branch', flag, branchName]);
|
|
158
|
+
}
|
|
159
|
+
// ============================================================================
|
|
160
|
+
// Working Tree Operations
|
|
161
|
+
// ============================================================================
|
|
162
|
+
/**
|
|
163
|
+
* Check for uncommitted changes
|
|
164
|
+
*/
|
|
165
|
+
hasUncommittedChanges() {
|
|
166
|
+
const status = this.git(['status', '--porcelain']);
|
|
167
|
+
return status.trim().length > 0;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get list of modified files
|
|
171
|
+
*/
|
|
172
|
+
getModifiedFiles() {
|
|
173
|
+
const status = this.git(['status', '--porcelain']);
|
|
174
|
+
return status
|
|
175
|
+
.trim()
|
|
176
|
+
.split('\n')
|
|
177
|
+
.filter((line) => line.length > 0)
|
|
178
|
+
.map((line) => line.slice(3).trim());
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Stage files for commit
|
|
182
|
+
*/
|
|
183
|
+
stageFiles(files) {
|
|
184
|
+
if (files.length === 0)
|
|
185
|
+
return;
|
|
186
|
+
this.git(['add', ...files]);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Stage all changes
|
|
190
|
+
*/
|
|
191
|
+
stageAll() {
|
|
192
|
+
this.git(['add', '-A']);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Unstage files
|
|
196
|
+
*/
|
|
197
|
+
unstageFiles(files) {
|
|
198
|
+
if (files.length === 0)
|
|
199
|
+
return;
|
|
200
|
+
this.git(['reset', 'HEAD', ...files]);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Discard changes in working tree
|
|
204
|
+
*/
|
|
205
|
+
discardChanges(files) {
|
|
206
|
+
if (files.length === 0)
|
|
207
|
+
return;
|
|
208
|
+
this.git(['checkout', '--', ...files]);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Stash changes
|
|
212
|
+
*/
|
|
213
|
+
stash(message) {
|
|
214
|
+
const args = ['stash', 'push'];
|
|
215
|
+
if (message) {
|
|
216
|
+
args.push('-m', message);
|
|
217
|
+
}
|
|
218
|
+
this.git(args);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Pop stash
|
|
222
|
+
*/
|
|
223
|
+
stashPop() {
|
|
224
|
+
this.git(['stash', 'pop']);
|
|
225
|
+
}
|
|
226
|
+
// ============================================================================
|
|
227
|
+
// Commit Operations
|
|
228
|
+
// ============================================================================
|
|
229
|
+
/**
|
|
230
|
+
* Create a commit
|
|
231
|
+
* @see REQ-CG-PR-004
|
|
232
|
+
*/
|
|
233
|
+
commit(message, options) {
|
|
234
|
+
const args = ['commit', '-m', message];
|
|
235
|
+
if (options?.allowEmpty) {
|
|
236
|
+
args.push('--allow-empty');
|
|
237
|
+
}
|
|
238
|
+
this.git(args);
|
|
239
|
+
// Get commit info
|
|
240
|
+
return this.getLastCommit();
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Get last commit info
|
|
244
|
+
*/
|
|
245
|
+
getLastCommit() {
|
|
246
|
+
const format = '%H|%s|%an|%ae|%aI';
|
|
247
|
+
const output = this.git(['log', '-1', `--format=${format}`]).trim();
|
|
248
|
+
const [hash, message, author, email, dateStr] = output.split('|');
|
|
249
|
+
return {
|
|
250
|
+
hash,
|
|
251
|
+
message,
|
|
252
|
+
author,
|
|
253
|
+
email,
|
|
254
|
+
date: new Date(dateStr),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get commit history
|
|
259
|
+
*/
|
|
260
|
+
getCommitHistory(count = 10) {
|
|
261
|
+
const format = '%H|%s|%an|%ae|%aI';
|
|
262
|
+
const output = this.git(['log', `-${count}`, `--format=${format}`]).trim();
|
|
263
|
+
return output
|
|
264
|
+
.split('\n')
|
|
265
|
+
.filter((line) => line.length > 0)
|
|
266
|
+
.map((line) => {
|
|
267
|
+
const [hash, message, author, email, dateStr] = line.split('|');
|
|
268
|
+
return {
|
|
269
|
+
hash,
|
|
270
|
+
message,
|
|
271
|
+
author,
|
|
272
|
+
email,
|
|
273
|
+
date: new Date(dateStr),
|
|
274
|
+
};
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
// ============================================================================
|
|
278
|
+
// Remote Operations
|
|
279
|
+
// ============================================================================
|
|
280
|
+
/**
|
|
281
|
+
* Push branch to remote
|
|
282
|
+
*/
|
|
283
|
+
push(options) {
|
|
284
|
+
const args = ['push'];
|
|
285
|
+
if (options?.setUpstream) {
|
|
286
|
+
args.push('-u', this.remote, this.getCurrentBranch());
|
|
287
|
+
}
|
|
288
|
+
if (options?.force) {
|
|
289
|
+
args.push('--force');
|
|
290
|
+
}
|
|
291
|
+
this.git(args);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Fetch from remote
|
|
295
|
+
*/
|
|
296
|
+
fetch(prune = false) {
|
|
297
|
+
const args = ['fetch', this.remote];
|
|
298
|
+
if (prune) {
|
|
299
|
+
args.push('--prune');
|
|
300
|
+
}
|
|
301
|
+
this.git(args);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Pull from remote
|
|
305
|
+
*/
|
|
306
|
+
pull(rebase = false) {
|
|
307
|
+
const args = ['pull', this.remote, this.getCurrentBranch()];
|
|
308
|
+
if (rebase) {
|
|
309
|
+
args.push('--rebase');
|
|
310
|
+
}
|
|
311
|
+
this.git(args);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Get remote URL
|
|
315
|
+
*/
|
|
316
|
+
getRemoteUrl() {
|
|
317
|
+
return this.git(['remote', 'get-url', this.remote]).trim();
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Parse GitHub owner/repo from remote URL
|
|
321
|
+
*/
|
|
322
|
+
parseRemoteUrl() {
|
|
323
|
+
const url = this.getRemoteUrl();
|
|
324
|
+
// SSH format: git@github.com:owner/repo.git
|
|
325
|
+
const sshMatch = url.match(/git@github\.com:([^/]+)\/([^/.]+)(\.git)?$/);
|
|
326
|
+
if (sshMatch) {
|
|
327
|
+
return { owner: sshMatch[1], repo: sshMatch[2] };
|
|
328
|
+
}
|
|
329
|
+
// HTTPS format: https://github.com/owner/repo.git
|
|
330
|
+
const httpsMatch = url.match(/https:\/\/github\.com\/([^/]+)\/([^/.]+)(\.git)?$/);
|
|
331
|
+
if (httpsMatch) {
|
|
332
|
+
return { owner: httpsMatch[1], repo: httpsMatch[2] };
|
|
333
|
+
}
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
// ============================================================================
|
|
337
|
+
// Diff Operations
|
|
338
|
+
// ============================================================================
|
|
339
|
+
/**
|
|
340
|
+
* Get diff for staged changes
|
|
341
|
+
*/
|
|
342
|
+
getStagedDiff() {
|
|
343
|
+
return this.git(['diff', '--cached']);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Get diff for unstaged changes
|
|
347
|
+
*/
|
|
348
|
+
getUnstagedDiff() {
|
|
349
|
+
return this.git(['diff']);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Get diff between branches
|
|
353
|
+
*/
|
|
354
|
+
getDiffBetweenBranches(baseBranch, headBranch) {
|
|
355
|
+
const head = headBranch ?? this.getCurrentBranch();
|
|
356
|
+
return this.git(['diff', `${baseBranch}...${head}`]);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Get diff stats
|
|
360
|
+
*/
|
|
361
|
+
getDiffStats(baseBranch) {
|
|
362
|
+
const base = baseBranch ?? this.getDefaultBranch();
|
|
363
|
+
const output = this.git(['diff', '--stat', `${base}...HEAD`]);
|
|
364
|
+
const match = output.match(/(\d+) files? changed(?:, (\d+) insertions?\(\+\))?(?:, (\d+) deletions?\(-\))?/);
|
|
365
|
+
if (!match) {
|
|
366
|
+
return { additions: 0, deletions: 0, files: 0 };
|
|
367
|
+
}
|
|
368
|
+
return {
|
|
369
|
+
files: parseInt(match[1], 10) || 0,
|
|
370
|
+
additions: parseInt(match[2], 10) || 0,
|
|
371
|
+
deletions: parseInt(match[3], 10) || 0,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
// ============================================================================
|
|
375
|
+
// File Operations for Refactoring
|
|
376
|
+
// ============================================================================
|
|
377
|
+
/**
|
|
378
|
+
* Apply code changes to files
|
|
379
|
+
* @see REQ-CG-PR-002
|
|
380
|
+
*/
|
|
381
|
+
applyCodeChanges(changes) {
|
|
382
|
+
const modifiedFiles = [];
|
|
383
|
+
for (const change of changes) {
|
|
384
|
+
const filePath = join(this.repoPath, change.filePath);
|
|
385
|
+
// Ensure file exists
|
|
386
|
+
if (!existsSync(filePath)) {
|
|
387
|
+
throw new Error(`File not found: ${change.filePath}`);
|
|
388
|
+
}
|
|
389
|
+
// Read file content
|
|
390
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
391
|
+
const lines = content.split('\n');
|
|
392
|
+
// Validate line numbers
|
|
393
|
+
if (change.startLine < 1 || change.endLine > lines.length) {
|
|
394
|
+
throw new Error(`Invalid line range ${change.startLine}-${change.endLine} for file ${change.filePath} (has ${lines.length} lines)`);
|
|
395
|
+
}
|
|
396
|
+
// Apply change
|
|
397
|
+
const beforeLines = lines.slice(0, change.startLine - 1);
|
|
398
|
+
const afterLines = lines.slice(change.endLine);
|
|
399
|
+
const newLines = change.newCode.split('\n');
|
|
400
|
+
const newContent = [...beforeLines, ...newLines, ...afterLines].join('\n');
|
|
401
|
+
// Write back
|
|
402
|
+
writeFileSync(filePath, newContent, 'utf-8');
|
|
403
|
+
modifiedFiles.push(change.filePath);
|
|
404
|
+
}
|
|
405
|
+
return [...new Set(modifiedFiles)];
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Revert changes to a file
|
|
409
|
+
*/
|
|
410
|
+
revertFile(filePath) {
|
|
411
|
+
this.git(['checkout', 'HEAD', '--', filePath]);
|
|
412
|
+
}
|
|
413
|
+
// ============================================================================
|
|
414
|
+
// Private Helpers
|
|
415
|
+
// ============================================================================
|
|
416
|
+
/**
|
|
417
|
+
* Execute a git command synchronously
|
|
418
|
+
*/
|
|
419
|
+
git(args) {
|
|
420
|
+
try {
|
|
421
|
+
return execSync(`git ${args.join(' ')}`, {
|
|
422
|
+
cwd: this.repoPath,
|
|
423
|
+
encoding: 'utf-8',
|
|
424
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
if (error instanceof Error && 'stderr' in error) {
|
|
429
|
+
throw new Error(`Git command failed: git ${args.join(' ')}\n${error.stderr}`);
|
|
430
|
+
}
|
|
431
|
+
throw error;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Create a GitOperations instance
|
|
437
|
+
*/
|
|
438
|
+
export function createGitOperations(repoPath, remote) {
|
|
439
|
+
return new GitOperations({ repoPath, remote });
|
|
440
|
+
}
|
|
441
|
+
//# sourceMappingURL=git-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-operations.js","sourceRoot":"","sources":["../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