@vibe-validate/git 0.18.0-rc.1 → 0.18.0
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/branch-cleanup.d.ts +289 -0
- package/dist/branch-cleanup.d.ts.map +1 -0
- package/dist/branch-cleanup.js +592 -0
- package/dist/branch-cleanup.js.map +1 -0
- package/dist/branch-sync.d.ts.map +1 -1
- package/dist/branch-sync.js +15 -31
- package/dist/branch-sync.js.map +1 -1
- package/dist/gh-commands.d.ts +45 -3
- package/dist/gh-commands.d.ts.map +1 -1
- package/dist/gh-commands.js +32 -5
- package/dist/gh-commands.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branch Cleanup - Core Analysis Functions
|
|
3
|
+
*
|
|
4
|
+
* Git-aware branch cleanup that safely identifies and removes merged branches.
|
|
5
|
+
* This module provides the core analysis functionality for determining which
|
|
6
|
+
* branches are safe to delete automatically and which need manual review.
|
|
7
|
+
*
|
|
8
|
+
* Safety principles:
|
|
9
|
+
* 1. NEVER delete branches with unpushed work
|
|
10
|
+
* 2. Auto-delete only if 100% safe (merged + no unpushed commits)
|
|
11
|
+
* 3. All deletions are recoverable via reflog
|
|
12
|
+
* 4. Never touch protected branches (main/master/develop)
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import { type GitHubPullRequest } from './gh-commands.js';
|
|
17
|
+
/**
|
|
18
|
+
* Remote tracking status for a branch
|
|
19
|
+
*/
|
|
20
|
+
export type RemoteStatus = 'exists' | 'deleted' | 'never_pushed';
|
|
21
|
+
/**
|
|
22
|
+
* Git metadata about a branch
|
|
23
|
+
*/
|
|
24
|
+
export interface BranchGitFacts {
|
|
25
|
+
/** Branch name */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Is branch merged to default branch */
|
|
28
|
+
mergedToMain: boolean;
|
|
29
|
+
/** Remote tracking status */
|
|
30
|
+
remoteStatus: RemoteStatus;
|
|
31
|
+
/** Number of unpushed commits */
|
|
32
|
+
unpushedCommitCount: number;
|
|
33
|
+
/** Last commit date (ISO 8601) */
|
|
34
|
+
lastCommitDate: string;
|
|
35
|
+
/** Last commit author */
|
|
36
|
+
lastCommitAuthor: string;
|
|
37
|
+
/** Days since last activity */
|
|
38
|
+
daysSinceActivity: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* GitHub metadata about a branch (from PR data)
|
|
42
|
+
*/
|
|
43
|
+
export interface BranchGitHubFacts {
|
|
44
|
+
/** Associated PR number */
|
|
45
|
+
prNumber?: number;
|
|
46
|
+
/** PR state (open, closed, merged) */
|
|
47
|
+
prState?: 'open' | 'closed' | 'merged';
|
|
48
|
+
/** Merge method used */
|
|
49
|
+
mergeMethod?: 'merge' | 'squash' | 'rebase';
|
|
50
|
+
/** When PR was merged */
|
|
51
|
+
mergedAt?: string;
|
|
52
|
+
/** Who merged the PR */
|
|
53
|
+
mergedBy?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Assessment and action commands for a branch
|
|
57
|
+
*/
|
|
58
|
+
export interface BranchAssessment {
|
|
59
|
+
/** Human-readable assessment */
|
|
60
|
+
summary: string;
|
|
61
|
+
/** Exact command to delete branch */
|
|
62
|
+
deleteCommand: string;
|
|
63
|
+
/** Command to recover branch after deletion */
|
|
64
|
+
recoveryCommand: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Complete analysis of a branch
|
|
68
|
+
*/
|
|
69
|
+
export interface BranchAnalysis {
|
|
70
|
+
/** Git facts about the branch */
|
|
71
|
+
gitFacts: BranchGitFacts;
|
|
72
|
+
/** GitHub facts (if available) */
|
|
73
|
+
githubFacts?: BranchGitHubFacts;
|
|
74
|
+
/** Assessment and commands */
|
|
75
|
+
assessment: BranchAssessment;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Context about the cleanup operation
|
|
79
|
+
*/
|
|
80
|
+
export interface CleanupContext {
|
|
81
|
+
/** Repository name (owner/repo) */
|
|
82
|
+
repository: string;
|
|
83
|
+
/** Remote name (usually 'origin') */
|
|
84
|
+
remote: string;
|
|
85
|
+
/** Default branch name (main/master/develop) */
|
|
86
|
+
defaultBranch: string;
|
|
87
|
+
/** Branch we were on before switching */
|
|
88
|
+
previousBranch?: string;
|
|
89
|
+
/** Current branch after potential switch */
|
|
90
|
+
currentBranch: string;
|
|
91
|
+
/** Did we switch branches during cleanup? */
|
|
92
|
+
switchedBranch: boolean;
|
|
93
|
+
/** Why we switched (if applicable) */
|
|
94
|
+
switchReason?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Detect the repository's default branch
|
|
98
|
+
*
|
|
99
|
+
* Tries multiple methods in order of reliability:
|
|
100
|
+
* 1. Remote HEAD symbolic ref (most reliable)
|
|
101
|
+
* 2. Git config init.defaultBranch
|
|
102
|
+
* 3. Fallback to 'main'
|
|
103
|
+
*
|
|
104
|
+
* @param options - Options for detection
|
|
105
|
+
* @returns Default branch name
|
|
106
|
+
* @throws Error if throwOnError is true and detection fails
|
|
107
|
+
*/
|
|
108
|
+
export declare function detectDefaultBranch(options?: {
|
|
109
|
+
throwOnError?: boolean;
|
|
110
|
+
}): string;
|
|
111
|
+
/**
|
|
112
|
+
* Check if a branch is protected (should never be deleted)
|
|
113
|
+
*
|
|
114
|
+
* @param name - Branch name
|
|
115
|
+
* @param defaultBranch - Default branch name
|
|
116
|
+
* @returns true if branch is protected
|
|
117
|
+
*/
|
|
118
|
+
export declare function isProtectedBranch(name: string, defaultBranch: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Parse remote tracking status from git branch -vv output
|
|
121
|
+
*
|
|
122
|
+
* @param branchVerbose - Output from git branch -vv
|
|
123
|
+
* @returns Remote status and ref
|
|
124
|
+
*/
|
|
125
|
+
export declare function parseRemoteTracking(branchVerbose: string): {
|
|
126
|
+
remoteStatus: RemoteStatus;
|
|
127
|
+
remoteRef: string | null;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Get unpushed commit count for a branch
|
|
131
|
+
*
|
|
132
|
+
* @param branch - Branch name
|
|
133
|
+
* @param remoteRef - Remote ref (e.g., 'origin/feature/test')
|
|
134
|
+
* @returns Number of unpushed commits
|
|
135
|
+
*/
|
|
136
|
+
export declare function getUnpushedCommitCount(branch: string, remoteRef: string | null): number;
|
|
137
|
+
/**
|
|
138
|
+
* Gather git facts about a branch
|
|
139
|
+
*
|
|
140
|
+
* @param branch - Branch name
|
|
141
|
+
* @param _defaultBranch - Default branch name (reserved for future use)
|
|
142
|
+
* @param mergedBranches - Set of branch names that are merged to main
|
|
143
|
+
* @returns Git facts about the branch
|
|
144
|
+
*/
|
|
145
|
+
export declare function gatherBranchGitFacts(branch: string, _defaultBranch: string, mergedBranches: Set<string>): Promise<BranchGitFacts>;
|
|
146
|
+
/**
|
|
147
|
+
* Determine if a branch is 100% safe to auto-delete
|
|
148
|
+
*
|
|
149
|
+
* A branch is auto-delete safe if:
|
|
150
|
+
* - Merged to main (detected by git)
|
|
151
|
+
* - Zero unpushed commits
|
|
152
|
+
* - Even if deleted, it's recoverable via reflog
|
|
153
|
+
*
|
|
154
|
+
* @param facts - Git facts about the branch
|
|
155
|
+
* @returns true if safe to auto-delete
|
|
156
|
+
*/
|
|
157
|
+
export declare function isAutoDeleteSafe(facts: BranchGitFacts): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Determine if a branch needs manual review before deletion
|
|
160
|
+
*
|
|
161
|
+
* A branch needs review if:
|
|
162
|
+
* - Not merged (could be squash/rebase merged)
|
|
163
|
+
* - Zero unpushed commits (safe from data loss)
|
|
164
|
+
* - Remote deleted OR >30 days old
|
|
165
|
+
* - NOT if has open PR (obviously keep)
|
|
166
|
+
* - NOT if has unpushed work (obviously keep)
|
|
167
|
+
*
|
|
168
|
+
* @param facts - Git facts about the branch
|
|
169
|
+
* @param githubFacts - GitHub facts (used to check PR state)
|
|
170
|
+
* @returns true if needs manual review
|
|
171
|
+
*/
|
|
172
|
+
export declare function needsReview(facts: BranchGitFacts, githubFacts?: BranchGitHubFacts): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Determine if a branch should be shown in output
|
|
175
|
+
*
|
|
176
|
+
* @param analysis - Branch analysis
|
|
177
|
+
* @returns true if should be shown
|
|
178
|
+
*/
|
|
179
|
+
export declare function shouldShowBranch(analysis: BranchAnalysis): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Detect merge method from PR data
|
|
182
|
+
*
|
|
183
|
+
* Analyzes PR metadata to determine how it was merged:
|
|
184
|
+
* - Squash: merge commit exists but PR has multiple commits
|
|
185
|
+
* - Merge: merge commit with multiple parents (true merge)
|
|
186
|
+
* - Rebase: commits were rebased onto target branch
|
|
187
|
+
*
|
|
188
|
+
* @param pr - Pull request data
|
|
189
|
+
* @returns Merge method or undefined if cannot determine
|
|
190
|
+
*/
|
|
191
|
+
export declare function detectMergeMethod(pr: GitHubPullRequest): 'merge' | 'squash' | 'rebase' | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Fetch PR data for a list of branches
|
|
194
|
+
*
|
|
195
|
+
* Efficiently batch-fetches merged PRs from GitHub and creates a map
|
|
196
|
+
* of branch name → PR data for quick lookups during enrichment.
|
|
197
|
+
*
|
|
198
|
+
* @param repository - Repository in owner/repo format
|
|
199
|
+
* @param _branches - Branch names (reserved for future filtering)
|
|
200
|
+
* @returns Map of branch name → PR data
|
|
201
|
+
* @throws Error if gh CLI is not available
|
|
202
|
+
*/
|
|
203
|
+
export declare function fetchPRDataForBranches(repository: string, _branches: string[]): Promise<Map<string, GitHubPullRequest>>;
|
|
204
|
+
/**
|
|
205
|
+
* Enrich branch analyses with GitHub PR data
|
|
206
|
+
*
|
|
207
|
+
* Populates the githubFacts field in each analysis by matching branches
|
|
208
|
+
* to merged PRs. This helps identify squash-merged branches that git
|
|
209
|
+
* doesn't recognize as merged.
|
|
210
|
+
*
|
|
211
|
+
* @param analyses - Branch analyses to enrich
|
|
212
|
+
* @param repository - Repository in owner/repo format
|
|
213
|
+
* @throws Error if gh CLI is not available
|
|
214
|
+
*/
|
|
215
|
+
export declare function enrichWithGitHubData(analyses: BranchAnalysis[], repository: string): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Result of branch cleanup operation
|
|
218
|
+
*/
|
|
219
|
+
export interface CleanupResult {
|
|
220
|
+
/** Context about the cleanup operation */
|
|
221
|
+
context: CleanupContext;
|
|
222
|
+
/** Branches that were auto-deleted */
|
|
223
|
+
autoDeleted: Array<{
|
|
224
|
+
name: string;
|
|
225
|
+
reason: string;
|
|
226
|
+
recoveryCommand: string;
|
|
227
|
+
}>;
|
|
228
|
+
/** Branches that need manual review */
|
|
229
|
+
needsReview: Array<{
|
|
230
|
+
name: string;
|
|
231
|
+
verification: BranchGitFacts & Partial<BranchGitHubFacts>;
|
|
232
|
+
assessment: string;
|
|
233
|
+
deleteCommand: string;
|
|
234
|
+
recoveryCommand: string;
|
|
235
|
+
}>;
|
|
236
|
+
/** Summary statistics */
|
|
237
|
+
summary: {
|
|
238
|
+
autoDeletedCount: number;
|
|
239
|
+
needsReviewCount: number;
|
|
240
|
+
totalBranchesAnalyzed: number;
|
|
241
|
+
};
|
|
242
|
+
/** Recovery information */
|
|
243
|
+
recoveryInfo: string;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Setup cleanup context and handle current branch switching
|
|
247
|
+
*
|
|
248
|
+
* If we're on a branch that needs cleanup, switch to default branch first.
|
|
249
|
+
*
|
|
250
|
+
* @returns Cleanup context
|
|
251
|
+
*/
|
|
252
|
+
export declare function setupCleanupContext(): Promise<CleanupContext>;
|
|
253
|
+
/**
|
|
254
|
+
* Generate assessment text for a branch needing review
|
|
255
|
+
*/
|
|
256
|
+
export declare function generateAssessment(gitFacts: BranchGitFacts, githubFacts?: BranchGitHubFacts): string;
|
|
257
|
+
/**
|
|
258
|
+
* Generate assessment for branch with deleted remote
|
|
259
|
+
*/
|
|
260
|
+
export declare function generateDeletedRemoteAssessment(gitFacts: BranchGitFacts, githubFacts?: BranchGitHubFacts): string;
|
|
261
|
+
/**
|
|
262
|
+
* Try to delete a safe branch and return result
|
|
263
|
+
*/
|
|
264
|
+
export declare function tryDeleteBranch(gitFacts: BranchGitFacts): {
|
|
265
|
+
deleted: boolean;
|
|
266
|
+
error?: string;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Categorize branches into auto-delete and needs-review
|
|
270
|
+
*/
|
|
271
|
+
export declare function categorizeBranches(analyses: BranchAnalysis[]): {
|
|
272
|
+
autoDeleted: CleanupResult['autoDeleted'];
|
|
273
|
+
needsReview: CleanupResult['needsReview'];
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Perform comprehensive branch cleanup
|
|
277
|
+
*
|
|
278
|
+
* This is the main entry point for branch cleanup. It:
|
|
279
|
+
* 1. Sets up context and switches branches if needed
|
|
280
|
+
* 2. Gathers all local branches
|
|
281
|
+
* 3. Analyzes each branch (git facts + GitHub enrichment)
|
|
282
|
+
* 4. Categorizes branches (auto-delete vs needs-review)
|
|
283
|
+
* 5. Deletes safe branches
|
|
284
|
+
* 6. Returns structured result with YAML-compatible format
|
|
285
|
+
*
|
|
286
|
+
* @returns Cleanup result with detailed analysis
|
|
287
|
+
*/
|
|
288
|
+
export declare function cleanupBranches(): Promise<CleanupResult>;
|
|
289
|
+
//# sourceMappingURL=branch-cleanup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch-cleanup.d.ts","sourceRoot":"","sources":["../src/branch-cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAoC,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI5F;;GAEG;AACH,MAAM,MAAM,YA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,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAUpG;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,cAAc,EACxB,WAAW,CAAC,EAAE,iBAAiB,GAC9B,MAAM,CAiBR;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAU9F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,cAAc,EAAE,GACzB;IACD,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC1C,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CAC3C,CAqCA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,aAAa,CAAC,CAuD9D"}
|
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branch Cleanup - Core Analysis Functions
|
|
3
|
+
*
|
|
4
|
+
* Git-aware branch cleanup that safely identifies and removes merged branches.
|
|
5
|
+
* This module provides the core analysis functionality for determining which
|
|
6
|
+
* branches are safe to delete automatically and which need manual review.
|
|
7
|
+
*
|
|
8
|
+
* Safety principles:
|
|
9
|
+
* 1. NEVER delete branches with unpushed work
|
|
10
|
+
* 2. Auto-delete only if 100% safe (merged + no unpushed commits)
|
|
11
|
+
* 3. All deletions are recoverable via reflog
|
|
12
|
+
* 4. Never touch protected branches (main/master/develop)
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import { isToolAvailable } from '@vibe-validate/utils';
|
|
17
|
+
import { listPullRequests, fetchPRDetails } from './gh-commands.js';
|
|
18
|
+
import { getCurrentBranch } from './git-commands.js';
|
|
19
|
+
import { execGitCommand, tryGitCommand } from './git-executor.js';
|
|
20
|
+
/**
|
|
21
|
+
* Detect the repository's default branch
|
|
22
|
+
*
|
|
23
|
+
* Tries multiple methods in order of reliability:
|
|
24
|
+
* 1. Remote HEAD symbolic ref (most reliable)
|
|
25
|
+
* 2. Git config init.defaultBranch
|
|
26
|
+
* 3. Fallback to 'main'
|
|
27
|
+
*
|
|
28
|
+
* @param options - Options for detection
|
|
29
|
+
* @returns Default branch name
|
|
30
|
+
* @throws Error if throwOnError is true and detection fails
|
|
31
|
+
*/
|
|
32
|
+
export function detectDefaultBranch(options = {}) {
|
|
33
|
+
const { throwOnError = false } = options;
|
|
34
|
+
try {
|
|
35
|
+
// Try remote HEAD symbolic ref first (most reliable)
|
|
36
|
+
const symbolicRef = execGitCommand(['symbolic-ref', 'refs/remotes/origin/HEAD']);
|
|
37
|
+
const regex = /refs\/heads\/(.+)$/;
|
|
38
|
+
const match = regex.exec(symbolicRef);
|
|
39
|
+
if (match) {
|
|
40
|
+
return match[1];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Fall through to next method
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
// Try git config
|
|
48
|
+
const configBranch = execGitCommand(['config', '--get', 'init.defaultBranch']);
|
|
49
|
+
if (configBranch) {
|
|
50
|
+
// Remove refs/heads/ prefix if present
|
|
51
|
+
return configBranch.replace(/^refs\/heads\//, '');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Fall through to fallback
|
|
56
|
+
}
|
|
57
|
+
// Check if we should throw or use fallback
|
|
58
|
+
if (throwOnError && !tryGitCommand(['rev-parse', '--verify', 'main'])) {
|
|
59
|
+
throw new Error('Unable to detect default branch');
|
|
60
|
+
}
|
|
61
|
+
// Last resort fallback
|
|
62
|
+
return 'main';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check if a branch is protected (should never be deleted)
|
|
66
|
+
*
|
|
67
|
+
* @param name - Branch name
|
|
68
|
+
* @param defaultBranch - Default branch name
|
|
69
|
+
* @returns true if branch is protected
|
|
70
|
+
*/
|
|
71
|
+
export function isProtectedBranch(name, defaultBranch) {
|
|
72
|
+
const protectedBranches = ['main', 'master', 'develop', defaultBranch];
|
|
73
|
+
return protectedBranches.includes(name);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parse remote tracking status from git branch -vv output
|
|
77
|
+
*
|
|
78
|
+
* @param branchVerbose - Output from git branch -vv
|
|
79
|
+
* @returns Remote status and ref
|
|
80
|
+
*/
|
|
81
|
+
export function parseRemoteTracking(branchVerbose) {
|
|
82
|
+
// Extract tracking ref from git branch -vv format
|
|
83
|
+
// Format: "* branch-name abc1234 [origin/branch-name: ahead 2] Commit message"
|
|
84
|
+
// Use non-backtracking character class to avoid catastrophic backtracking
|
|
85
|
+
// eslint-disable-next-line sonarjs/slow-regex
|
|
86
|
+
const trackingRegex = /\[([^\]]*)\]/;
|
|
87
|
+
const trackingMatch = trackingRegex.exec(branchVerbose);
|
|
88
|
+
if (!trackingMatch) {
|
|
89
|
+
return { remoteStatus: 'never_pushed', remoteRef: null };
|
|
90
|
+
}
|
|
91
|
+
const trackingInfo = trackingMatch[1];
|
|
92
|
+
const remoteRef = trackingInfo.split(':')[0].trim();
|
|
93
|
+
return { remoteStatus: 'exists', remoteRef };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get unpushed commit count for a branch
|
|
97
|
+
*
|
|
98
|
+
* @param branch - Branch name
|
|
99
|
+
* @param remoteRef - Remote ref (e.g., 'origin/feature/test')
|
|
100
|
+
* @returns Number of unpushed commits
|
|
101
|
+
*/
|
|
102
|
+
export function getUnpushedCommitCount(branch, remoteRef) {
|
|
103
|
+
if (!remoteRef) {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
const count = execGitCommand(['rev-list', '--count', `${remoteRef}..${branch}`]);
|
|
108
|
+
return Number.parseInt(count, 10) || 0;
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Gather git facts about a branch
|
|
116
|
+
*
|
|
117
|
+
* @param branch - Branch name
|
|
118
|
+
* @param _defaultBranch - Default branch name (reserved for future use)
|
|
119
|
+
* @param mergedBranches - Set of branch names that are merged to main
|
|
120
|
+
* @returns Git facts about the branch
|
|
121
|
+
*/
|
|
122
|
+
export async function gatherBranchGitFacts(branch, _defaultBranch, mergedBranches) {
|
|
123
|
+
// Check if merged to main
|
|
124
|
+
const mergedToMain = mergedBranches.has(branch);
|
|
125
|
+
// Get remote tracking status
|
|
126
|
+
let remoteStatus = 'never_pushed';
|
|
127
|
+
let remoteRef = null;
|
|
128
|
+
try {
|
|
129
|
+
// Check for tracking ref
|
|
130
|
+
const trackingRef = execGitCommand(['config', '--get', `branch.${branch}.merge`]);
|
|
131
|
+
if (trackingRef) {
|
|
132
|
+
// Extract branch name from refs/heads/xxx
|
|
133
|
+
const remoteBranch = trackingRef.replace('refs/heads/', '');
|
|
134
|
+
const remote = execGitCommand(['config', '--get', `branch.${branch}.remote`]) || 'origin';
|
|
135
|
+
remoteRef = `${remote}/${remoteBranch}`;
|
|
136
|
+
// Check if remote ref exists
|
|
137
|
+
try {
|
|
138
|
+
execGitCommand(['rev-parse', '--verify', `refs/remotes/${remoteRef}`]);
|
|
139
|
+
remoteStatus = 'exists';
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
remoteStatus = 'deleted';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
remoteStatus = 'never_pushed';
|
|
148
|
+
}
|
|
149
|
+
// Get unpushed commit count
|
|
150
|
+
const unpushedCommitCount = getUnpushedCommitCount(branch, remoteRef);
|
|
151
|
+
// Get commit info
|
|
152
|
+
const commitInfo = execGitCommand([
|
|
153
|
+
'log',
|
|
154
|
+
'-1',
|
|
155
|
+
'--format=%aI%n%an',
|
|
156
|
+
branch,
|
|
157
|
+
]);
|
|
158
|
+
const [lastCommitDate, lastCommitAuthor] = commitInfo.split('\n');
|
|
159
|
+
// Calculate days since activity
|
|
160
|
+
const commitDate = new Date(lastCommitDate);
|
|
161
|
+
const now = new Date();
|
|
162
|
+
const daysSinceActivity = Math.floor((now.getTime() - commitDate.getTime()) / (1000 * 60 * 60 * 24));
|
|
163
|
+
return {
|
|
164
|
+
name: branch,
|
|
165
|
+
mergedToMain,
|
|
166
|
+
remoteStatus,
|
|
167
|
+
unpushedCommitCount,
|
|
168
|
+
lastCommitDate,
|
|
169
|
+
lastCommitAuthor,
|
|
170
|
+
daysSinceActivity,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Determine if a branch is 100% safe to auto-delete
|
|
175
|
+
*
|
|
176
|
+
* A branch is auto-delete safe if:
|
|
177
|
+
* - Merged to main (detected by git)
|
|
178
|
+
* - Zero unpushed commits
|
|
179
|
+
* - Even if deleted, it's recoverable via reflog
|
|
180
|
+
*
|
|
181
|
+
* @param facts - Git facts about the branch
|
|
182
|
+
* @returns true if safe to auto-delete
|
|
183
|
+
*/
|
|
184
|
+
export function isAutoDeleteSafe(facts) {
|
|
185
|
+
// Must be merged to main
|
|
186
|
+
if (!facts.mergedToMain) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
// Must have no unpushed work
|
|
190
|
+
if (facts.unpushedCommitCount > 0) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Determine if a branch needs manual review before deletion
|
|
197
|
+
*
|
|
198
|
+
* A branch needs review if:
|
|
199
|
+
* - Not merged (could be squash/rebase merged)
|
|
200
|
+
* - Zero unpushed commits (safe from data loss)
|
|
201
|
+
* - Remote deleted OR >30 days old
|
|
202
|
+
* - NOT if has open PR (obviously keep)
|
|
203
|
+
* - NOT if has unpushed work (obviously keep)
|
|
204
|
+
*
|
|
205
|
+
* @param facts - Git facts about the branch
|
|
206
|
+
* @param githubFacts - GitHub facts (used to check PR state)
|
|
207
|
+
* @returns true if needs manual review
|
|
208
|
+
*/
|
|
209
|
+
export function needsReview(facts, githubFacts) {
|
|
210
|
+
// Never review branches with unpushed work
|
|
211
|
+
if (facts.unpushedCommitCount > 0) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
// Never review if PR is still open (obviously keep)
|
|
215
|
+
if (githubFacts?.prState === 'open') {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
// Never review active branches (< 30 days)
|
|
219
|
+
if (facts.daysSinceActivity < 30) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
// Don't review if already auto-delete safe
|
|
223
|
+
if (facts.mergedToMain) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
// Review if PR was merged and remote deleted (squash merge pattern)
|
|
227
|
+
if (githubFacts?.prState === 'merged' && facts.remoteStatus === 'deleted') {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
// Review if remote deleted (likely squash merged, even without PR data)
|
|
231
|
+
if (facts.remoteStatus === 'deleted') {
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
// Review if old and never pushed (abandoned local work)
|
|
235
|
+
if (facts.remoteStatus === 'never_pushed' && facts.daysSinceActivity >= 90) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Determine if a branch should be shown in output
|
|
242
|
+
*
|
|
243
|
+
* @param analysis - Branch analysis
|
|
244
|
+
* @returns true if should be shown
|
|
245
|
+
*/
|
|
246
|
+
export function shouldShowBranch(analysis) {
|
|
247
|
+
// Never show branches with unpushed work
|
|
248
|
+
if (analysis.gitFacts.unpushedCommitCount > 0) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
// Show if auto-delete safe or needs review
|
|
252
|
+
return isAutoDeleteSafe(analysis.gitFacts) || needsReview(analysis.gitFacts, analysis.githubFacts);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Detect merge method from PR data
|
|
256
|
+
*
|
|
257
|
+
* Analyzes PR metadata to determine how it was merged:
|
|
258
|
+
* - Squash: merge commit exists but PR has multiple commits
|
|
259
|
+
* - Merge: merge commit with multiple parents (true merge)
|
|
260
|
+
* - Rebase: commits were rebased onto target branch
|
|
261
|
+
*
|
|
262
|
+
* @param pr - Pull request data
|
|
263
|
+
* @returns Merge method or undefined if cannot determine
|
|
264
|
+
*/
|
|
265
|
+
export function detectMergeMethod(pr) {
|
|
266
|
+
// If no merge commit, can't determine
|
|
267
|
+
if (!pr.mergeCommit?.oid) {
|
|
268
|
+
return undefined;
|
|
269
|
+
}
|
|
270
|
+
// Squash merge: merge commit exists but PR had multiple commits
|
|
271
|
+
// The merge commit will have only 1 parent (squashed into single commit)
|
|
272
|
+
if (pr.commits?.totalCount && pr.commits.totalCount > 1 && pr.mergeCommit.parents?.[0]?.totalCount === 1) {
|
|
273
|
+
return 'squash';
|
|
274
|
+
}
|
|
275
|
+
// True merge: merge commit has 2+ parents
|
|
276
|
+
if (pr.mergeCommit.parents?.[0]?.totalCount && pr.mergeCommit.parents[0].totalCount >= 2) {
|
|
277
|
+
return 'merge';
|
|
278
|
+
}
|
|
279
|
+
// Rebase merge: merge commit exists but is not a true merge commit
|
|
280
|
+
// This is harder to detect reliably, so we use this as fallback
|
|
281
|
+
return 'rebase';
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Fetch PR data for a list of branches
|
|
285
|
+
*
|
|
286
|
+
* Efficiently batch-fetches merged PRs from GitHub and creates a map
|
|
287
|
+
* of branch name → PR data for quick lookups during enrichment.
|
|
288
|
+
*
|
|
289
|
+
* @param repository - Repository in owner/repo format
|
|
290
|
+
* @param _branches - Branch names (reserved for future filtering)
|
|
291
|
+
* @returns Map of branch name → PR data
|
|
292
|
+
* @throws Error if gh CLI is not available
|
|
293
|
+
*/
|
|
294
|
+
export async function fetchPRDataForBranches(repository, _branches) {
|
|
295
|
+
// Check gh CLI availability (hard requirement)
|
|
296
|
+
if (!isToolAvailable('gh')) {
|
|
297
|
+
throw new Error('GitHub CLI (gh) is required for branch cleanup. Install: https://cli.github.com/');
|
|
298
|
+
}
|
|
299
|
+
const prMap = new Map();
|
|
300
|
+
try {
|
|
301
|
+
// Parse repository
|
|
302
|
+
const [owner, repo] = repository.split('/');
|
|
303
|
+
if (!owner || !repo) {
|
|
304
|
+
throw new Error(`Invalid repository format: ${repository}. Expected: owner/repo`);
|
|
305
|
+
}
|
|
306
|
+
// Fetch recent merged PRs (batch operation)
|
|
307
|
+
// Note: 'commits' field excluded to avoid GitHub GraphQL node limit (would exceed 500k nodes for 100 PRs)
|
|
308
|
+
// We fetch commits per-PR in the next step via fetchPRDetails()
|
|
309
|
+
const mergedPRs = listPullRequests(owner, repo, 20, // Last 20 merged PRs covers most cleanup scenarios (most repos have <20 local branches)
|
|
310
|
+
['number', 'title', 'headRefName', 'baseRefName', 'state', 'mergedAt', 'mergedBy'], 'merged');
|
|
311
|
+
// Process PRs in parallel batches with early termination
|
|
312
|
+
// Stop once we've found PRs for all local branches
|
|
313
|
+
const localBranchSet = new Set(_branches);
|
|
314
|
+
const BATCH_SIZE = 5; // Parallel requests per batch
|
|
315
|
+
for (let i = 0; i < mergedPRs.length; i += BATCH_SIZE) {
|
|
316
|
+
// Early termination: stop if we've found all local branches
|
|
317
|
+
if (prMap.size >= localBranchSet.size) {
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
// Process batch in parallel
|
|
321
|
+
const batch = mergedPRs.slice(i, i + BATCH_SIZE);
|
|
322
|
+
const results = await Promise.allSettled(batch.map(async (pr) => fetchPRDetails(pr.number, owner, repo, [
|
|
323
|
+
'number',
|
|
324
|
+
'headRefName',
|
|
325
|
+
'state',
|
|
326
|
+
'mergedAt',
|
|
327
|
+
'mergedBy',
|
|
328
|
+
'mergeCommit',
|
|
329
|
+
'commits',
|
|
330
|
+
])));
|
|
331
|
+
// Add results to map
|
|
332
|
+
for (const [index, result] of results.entries()) {
|
|
333
|
+
const pr = batch[index];
|
|
334
|
+
if (result.status === 'fulfilled') {
|
|
335
|
+
prMap.set(result.value.headRefName, result.value);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
// If individual PR fetch fails, use basic data
|
|
339
|
+
prMap.set(pr.headRefName, pr);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return prMap;
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
// Re-throw with context
|
|
347
|
+
if (error instanceof Error) {
|
|
348
|
+
throw new Error(`Failed to fetch PR data: ${error.message}`);
|
|
349
|
+
}
|
|
350
|
+
throw error;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Enrich branch analyses with GitHub PR data
|
|
355
|
+
*
|
|
356
|
+
* Populates the githubFacts field in each analysis by matching branches
|
|
357
|
+
* to merged PRs. This helps identify squash-merged branches that git
|
|
358
|
+
* doesn't recognize as merged.
|
|
359
|
+
*
|
|
360
|
+
* @param analyses - Branch analyses to enrich
|
|
361
|
+
* @param repository - Repository in owner/repo format
|
|
362
|
+
* @throws Error if gh CLI is not available
|
|
363
|
+
*/
|
|
364
|
+
export async function enrichWithGitHubData(analyses, repository) {
|
|
365
|
+
// Extract branch names
|
|
366
|
+
const branchNames = analyses.map(a => a.gitFacts.name);
|
|
367
|
+
// Fetch PR data (throws if gh not available)
|
|
368
|
+
const prMap = await fetchPRDataForBranches(repository, branchNames);
|
|
369
|
+
// Enrich each analysis
|
|
370
|
+
for (const analysis of analyses) {
|
|
371
|
+
const pr = prMap.get(analysis.gitFacts.name);
|
|
372
|
+
if (pr) {
|
|
373
|
+
// Normalize state to lowercase for consistency
|
|
374
|
+
const prState = pr.state?.toLowerCase();
|
|
375
|
+
analysis.githubFacts = {
|
|
376
|
+
prNumber: pr.number,
|
|
377
|
+
prState,
|
|
378
|
+
mergeMethod: detectMergeMethod(pr),
|
|
379
|
+
mergedAt: pr.mergedAt,
|
|
380
|
+
mergedBy: pr.mergedBy?.login,
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Setup cleanup context and handle current branch switching
|
|
387
|
+
*
|
|
388
|
+
* If we're on a branch that needs cleanup, switch to default branch first.
|
|
389
|
+
*
|
|
390
|
+
* @returns Cleanup context
|
|
391
|
+
*/
|
|
392
|
+
export async function setupCleanupContext() {
|
|
393
|
+
const currentBranch = getCurrentBranch();
|
|
394
|
+
const defaultBranch = detectDefaultBranch();
|
|
395
|
+
const remote = 'origin'; // Currently hardcoded, will be configurable in future
|
|
396
|
+
// Get repository name
|
|
397
|
+
let repository = 'unknown/unknown';
|
|
398
|
+
try {
|
|
399
|
+
const remoteUrl = execGitCommand(['remote', 'get-url', remote]);
|
|
400
|
+
// Match owner/repo pattern from SSH (git@github.com:owner/repo) or HTTPS (https://github.com/owner/repo)
|
|
401
|
+
// Match after last ':' or after last '/' in the path
|
|
402
|
+
const repoRegex = /[:/]([^/:]+\/[^/]+?)(?:\.git)?$/;
|
|
403
|
+
const match = repoRegex.exec(remoteUrl);
|
|
404
|
+
if (match) {
|
|
405
|
+
repository = match[1];
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
// Keep default
|
|
410
|
+
}
|
|
411
|
+
const context = {
|
|
412
|
+
repository,
|
|
413
|
+
remote,
|
|
414
|
+
defaultBranch,
|
|
415
|
+
currentBranch,
|
|
416
|
+
switchedBranch: false,
|
|
417
|
+
};
|
|
418
|
+
// If already on default branch, nothing to do
|
|
419
|
+
if (currentBranch === defaultBranch) {
|
|
420
|
+
return context;
|
|
421
|
+
}
|
|
422
|
+
// Check if current branch needs cleanup
|
|
423
|
+
const mergedBranches = new Set(execGitCommand(['branch', '--merged', defaultBranch])
|
|
424
|
+
.split('\n')
|
|
425
|
+
.map(b => b.trim().replace(/^\*\s+/, ''))
|
|
426
|
+
.filter(Boolean));
|
|
427
|
+
const currentBranchFacts = await gatherBranchGitFacts(currentBranch, defaultBranch, mergedBranches);
|
|
428
|
+
// Decide if we need to switch
|
|
429
|
+
let shouldSwitch = false;
|
|
430
|
+
let switchReason;
|
|
431
|
+
if (isAutoDeleteSafe(currentBranchFacts)) {
|
|
432
|
+
shouldSwitch = true;
|
|
433
|
+
switchReason = 'current branch is auto-delete safe';
|
|
434
|
+
}
|
|
435
|
+
else if (needsReview(currentBranchFacts)) {
|
|
436
|
+
shouldSwitch = true;
|
|
437
|
+
switchReason = 'current branch needs review';
|
|
438
|
+
}
|
|
439
|
+
if (shouldSwitch) {
|
|
440
|
+
// Switch to default branch
|
|
441
|
+
execGitCommand(['checkout', defaultBranch]);
|
|
442
|
+
context.previousBranch = currentBranch;
|
|
443
|
+
context.currentBranch = defaultBranch;
|
|
444
|
+
context.switchedBranch = true;
|
|
445
|
+
context.switchReason = switchReason;
|
|
446
|
+
}
|
|
447
|
+
return context;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Generate assessment text for a branch needing review
|
|
451
|
+
*/
|
|
452
|
+
export function generateAssessment(gitFacts, githubFacts) {
|
|
453
|
+
if (gitFacts.remoteStatus === 'deleted') {
|
|
454
|
+
return generateDeletedRemoteAssessment(gitFacts, githubFacts);
|
|
455
|
+
}
|
|
456
|
+
if (gitFacts.remoteStatus === 'never_pushed' && gitFacts.daysSinceActivity >= 90) {
|
|
457
|
+
return `Old abandoned branch (${gitFacts.daysSinceActivity} days)\nNever pushed to remote\nNo unpushed commits (safe to delete)`;
|
|
458
|
+
}
|
|
459
|
+
return 'Needs manual review';
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Generate assessment for branch with deleted remote
|
|
463
|
+
*/
|
|
464
|
+
export function generateDeletedRemoteAssessment(gitFacts, githubFacts) {
|
|
465
|
+
let text = 'Remote deleted by GitHub\n';
|
|
466
|
+
if (githubFacts?.prNumber) {
|
|
467
|
+
text += `PR #${githubFacts.prNumber} ${githubFacts.prState} ${gitFacts.daysSinceActivity} days ago`;
|
|
468
|
+
if (githubFacts.mergedBy) {
|
|
469
|
+
text += ` by ${githubFacts.mergedBy}`;
|
|
470
|
+
}
|
|
471
|
+
text += '\n';
|
|
472
|
+
if (githubFacts.mergeMethod) {
|
|
473
|
+
text += `${githubFacts.mergeMethod} merge explains why git branch --merged returned false\n`;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
text += 'No unpushed commits (safe to delete)';
|
|
477
|
+
return text;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Try to delete a safe branch and return result
|
|
481
|
+
*/
|
|
482
|
+
export function tryDeleteBranch(gitFacts) {
|
|
483
|
+
try {
|
|
484
|
+
execGitCommand(['branch', '-d', gitFacts.name]);
|
|
485
|
+
return { deleted: true };
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
return {
|
|
489
|
+
deleted: false,
|
|
490
|
+
error: error instanceof Error ? error.message : String(error),
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Categorize branches into auto-delete and needs-review
|
|
496
|
+
*/
|
|
497
|
+
export function categorizeBranches(analyses) {
|
|
498
|
+
const autoDeleted = [];
|
|
499
|
+
const branchesNeedingReview = [];
|
|
500
|
+
for (const analysis of analyses) {
|
|
501
|
+
const { gitFacts, githubFacts, assessment } = analysis;
|
|
502
|
+
if (isAutoDeleteSafe(gitFacts)) {
|
|
503
|
+
const result = tryDeleteBranch(gitFacts);
|
|
504
|
+
if (result.deleted) {
|
|
505
|
+
autoDeleted.push({
|
|
506
|
+
name: gitFacts.name,
|
|
507
|
+
reason: 'merged_to_main',
|
|
508
|
+
recoveryCommand: assessment.recoveryCommand,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
branchesNeedingReview.push({
|
|
513
|
+
name: gitFacts.name,
|
|
514
|
+
verification: { ...gitFacts, ...githubFacts },
|
|
515
|
+
assessment: `Failed to delete: ${result.error}`,
|
|
516
|
+
deleteCommand: assessment.deleteCommand,
|
|
517
|
+
recoveryCommand: assessment.recoveryCommand,
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
else if (needsReview(gitFacts, githubFacts)) {
|
|
522
|
+
branchesNeedingReview.push({
|
|
523
|
+
name: gitFacts.name,
|
|
524
|
+
verification: { ...gitFacts, ...githubFacts },
|
|
525
|
+
assessment: generateAssessment(gitFacts, githubFacts),
|
|
526
|
+
deleteCommand: assessment.deleteCommand,
|
|
527
|
+
recoveryCommand: assessment.recoveryCommand,
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return { autoDeleted, needsReview: branchesNeedingReview };
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Perform comprehensive branch cleanup
|
|
535
|
+
*
|
|
536
|
+
* This is the main entry point for branch cleanup. It:
|
|
537
|
+
* 1. Sets up context and switches branches if needed
|
|
538
|
+
* 2. Gathers all local branches
|
|
539
|
+
* 3. Analyzes each branch (git facts + GitHub enrichment)
|
|
540
|
+
* 4. Categorizes branches (auto-delete vs needs-review)
|
|
541
|
+
* 5. Deletes safe branches
|
|
542
|
+
* 6. Returns structured result with YAML-compatible format
|
|
543
|
+
*
|
|
544
|
+
* @returns Cleanup result with detailed analysis
|
|
545
|
+
*/
|
|
546
|
+
export async function cleanupBranches() {
|
|
547
|
+
// Step 1: Setup context (may switch branches)
|
|
548
|
+
const context = await setupCleanupContext();
|
|
549
|
+
// Step 2: Get all local branches (excluding protected)
|
|
550
|
+
const allBranches = execGitCommand(['branch', '--format=%(refname:short)'])
|
|
551
|
+
.split('\n')
|
|
552
|
+
.map(b => b.trim())
|
|
553
|
+
.filter(Boolean)
|
|
554
|
+
.filter(b => !isProtectedBranch(b, context.defaultBranch));
|
|
555
|
+
// Step 3: Get merged branches list (for efficient lookup)
|
|
556
|
+
const mergedBranches = new Set(execGitCommand(['branch', '--merged', context.defaultBranch])
|
|
557
|
+
.split('\n')
|
|
558
|
+
.map(b => b.trim().replace(/^\*\s+/, ''))
|
|
559
|
+
.filter(Boolean));
|
|
560
|
+
// Step 4: Analyze all branches (gather git facts)
|
|
561
|
+
const analyses = [];
|
|
562
|
+
for (const branch of allBranches) {
|
|
563
|
+
const gitFacts = await gatherBranchGitFacts(branch, context.defaultBranch, mergedBranches);
|
|
564
|
+
analyses.push({
|
|
565
|
+
gitFacts,
|
|
566
|
+
assessment: {
|
|
567
|
+
summary: '',
|
|
568
|
+
deleteCommand: `git branch -D ${branch}`,
|
|
569
|
+
recoveryCommand: `git reflog | grep '${branch}' | head -1`,
|
|
570
|
+
},
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
// Step 5: Enrich with GitHub data (throws if gh not available)
|
|
574
|
+
await enrichWithGitHubData(analyses, context.repository);
|
|
575
|
+
// Step 6: Categorize and delete safe branches
|
|
576
|
+
const { autoDeleted, needsReview } = categorizeBranches(analyses);
|
|
577
|
+
// Step 7: Build result
|
|
578
|
+
return {
|
|
579
|
+
context,
|
|
580
|
+
autoDeleted,
|
|
581
|
+
needsReview,
|
|
582
|
+
summary: {
|
|
583
|
+
autoDeletedCount: autoDeleted.length,
|
|
584
|
+
needsReviewCount: needsReview.length,
|
|
585
|
+
totalBranchesAnalyzed: analyses.length,
|
|
586
|
+
},
|
|
587
|
+
recoveryInfo: 'Deleted branches are recoverable for 30 days via git reflog:\n' +
|
|
588
|
+
' git reflog\n' +
|
|
589
|
+
' git checkout -b <branch-name> <SHA>',
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
//# sourceMappingURL=branch-cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch-cleanup.js","sourceRoot":"","sources":["../src/branch-cleanup.ts"],"names":[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","sourceRoot":"","sources":["../src/branch-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3F,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAwBD;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;gBAE9B,OAAO,GAAE,gBAAqB;IAK1C;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;YA0C7B,gBAAgB;YAUhB,eAAe;YAUf,WAAW;YAUX,gBAAgB;IAW9B;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM;CAK7C;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAG9F"}
|
package/dist/branch-sync.js
CHANGED
|
@@ -10,44 +10,28 @@
|
|
|
10
10
|
* - Explicit instructions when manual intervention needed
|
|
11
11
|
* - Cross-platform compatibility
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
14
|
-
const GIT_TIMEOUT = 30000; // 30 seconds timeout for git operations
|
|
13
|
+
import { executeGitCommand } from './git-executor.js';
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
15
|
+
* Adapt centralized git-executor to the async GitExecutor interface
|
|
16
|
+
*
|
|
17
|
+
* Uses the centralized git command execution from git-executor.ts,
|
|
18
|
+
* wrapping it in a Promise to maintain compatibility with the async
|
|
19
|
+
* GitExecutor interface used for dependency injection in tests.
|
|
17
20
|
*
|
|
18
21
|
* @param args - Git command arguments (e.g., ['rev-parse', '--abbrev-ref', 'HEAD'])
|
|
19
22
|
* @returns Promise resolving to stdout and stderr
|
|
20
23
|
*/
|
|
21
24
|
function execGit(args) {
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
try {
|
|
26
|
+
const result = executeGitCommand(args, { ignoreErrors: false });
|
|
27
|
+
return Promise.resolve({
|
|
28
|
+
stdout: result.stdout,
|
|
29
|
+
stderr: result.stderr,
|
|
26
30
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
stdout += data.toString();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
if (child.stderr) {
|
|
35
|
-
child.stderr.on('data', (data) => {
|
|
36
|
-
stderr += data.toString();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
child.on('error', (error) => {
|
|
40
|
-
reject(error);
|
|
41
|
-
});
|
|
42
|
-
child.on('close', (code) => {
|
|
43
|
-
if (code === 0) {
|
|
44
|
-
resolve({ stdout, stderr });
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
reject(new Error(`git exited with code ${code}: ${stderr}`));
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return Promise.reject(error);
|
|
34
|
+
}
|
|
51
35
|
}
|
|
52
36
|
/**
|
|
53
37
|
* Branch Sync Checker
|
package/dist/branch-sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch-sync.js","sourceRoot":"","sources":["../src/branch-sync.ts"],"names":[],"mappings":"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CAAC,mCAAmC,YAAY,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,MAAuB;QACjC,IAAI,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,CAAC,CAAC,kBAAkB;QAC9C,IAAI,CAAC,MAAM,CAAC,SAAS;YAAE,OAAO,CAAC,CAAC,CAAC,yBAAyB;QAC1D,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,kCAAkC;IACtE,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAA4B,EAAE;IAClE,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC,SAAS,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/gh-commands.d.ts
CHANGED
|
@@ -34,6 +34,20 @@ export interface GitHubPullRequest {
|
|
|
34
34
|
title: string;
|
|
35
35
|
url: string;
|
|
36
36
|
}>;
|
|
37
|
+
state?: 'OPEN' | 'CLOSED' | 'MERGED';
|
|
38
|
+
mergedAt?: string;
|
|
39
|
+
mergedBy?: {
|
|
40
|
+
login: string;
|
|
41
|
+
};
|
|
42
|
+
mergeCommit?: {
|
|
43
|
+
oid: string;
|
|
44
|
+
parents?: Array<{
|
|
45
|
+
totalCount?: number;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
commits?: {
|
|
49
|
+
totalCount?: number;
|
|
50
|
+
};
|
|
37
51
|
}
|
|
38
52
|
/**
|
|
39
53
|
* GitHub Workflow Run
|
|
@@ -48,6 +62,19 @@ export interface GitHubRun {
|
|
|
48
62
|
updatedAt: string;
|
|
49
63
|
url: string;
|
|
50
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* GitHub Workflow Job
|
|
67
|
+
*/
|
|
68
|
+
export interface GitHubJob {
|
|
69
|
+
id: number;
|
|
70
|
+
run_id: number;
|
|
71
|
+
name: string;
|
|
72
|
+
status: string;
|
|
73
|
+
conclusion: string | null;
|
|
74
|
+
started_at: string;
|
|
75
|
+
completed_at: string | null;
|
|
76
|
+
html_url: string;
|
|
77
|
+
}
|
|
51
78
|
/**
|
|
52
79
|
* Fetch PR details from GitHub
|
|
53
80
|
*
|
|
@@ -81,24 +108,30 @@ export declare function fetchPRChecks(prNumber: number, owner?: string, repo?: s
|
|
|
81
108
|
*/
|
|
82
109
|
export declare function getCurrentPR(owner?: string, repo?: string): number | null;
|
|
83
110
|
/**
|
|
84
|
-
* List
|
|
111
|
+
* List pull requests
|
|
85
112
|
*
|
|
86
113
|
* @param owner - Repository owner
|
|
87
114
|
* @param repo - Repository name
|
|
88
115
|
* @param limit - Max number of PRs to return (default: 5)
|
|
89
116
|
* @param fields - Fields to fetch (optional)
|
|
117
|
+
* @param state - PR state filter: 'open', 'closed', 'merged', or 'all' (default: 'open')
|
|
90
118
|
* @returns List of PRs
|
|
91
119
|
*/
|
|
92
|
-
export declare function listPullRequests(owner: string, repo: string, limit?: number, fields?: string[]): GitHubPullRequest[];
|
|
120
|
+
export declare function listPullRequests(owner: string, repo: string, limit?: number, fields?: string[], state?: 'open' | 'closed' | 'merged' | 'all'): GitHubPullRequest[];
|
|
93
121
|
/**
|
|
94
122
|
* Fetch workflow run logs
|
|
95
123
|
*
|
|
96
124
|
* @param runId - GitHub run ID
|
|
97
125
|
* @param owner - Repository owner (optional)
|
|
98
126
|
* @param repo - Repository name (optional)
|
|
127
|
+
* @param jobId - GitHub job ID (optional, for matrix strategy jobs)
|
|
99
128
|
* @returns Raw log output
|
|
129
|
+
*
|
|
130
|
+
* When jobId is provided, fetches logs for a specific job within the run.
|
|
131
|
+
* This is CRITICAL for matrix strategy builds where a single run contains multiple jobs.
|
|
132
|
+
* Without jobId, gh returns combined logs from ALL jobs, making error extraction unreliable.
|
|
100
133
|
*/
|
|
101
|
-
export declare function fetchRunLogs(runId: number, owner?: string, repo?: string): string;
|
|
134
|
+
export declare function fetchRunLogs(runId: number, owner?: string, repo?: string, jobId?: number): string;
|
|
102
135
|
/**
|
|
103
136
|
* Fetch workflow run details
|
|
104
137
|
*
|
|
@@ -109,6 +142,15 @@ export declare function fetchRunLogs(runId: number, owner?: string, repo?: strin
|
|
|
109
142
|
* @returns Run details
|
|
110
143
|
*/
|
|
111
144
|
export declare function fetchRunDetails(runId: number, owner?: string, repo?: string, fields?: string[]): GitHubRun;
|
|
145
|
+
/**
|
|
146
|
+
* Fetch jobs for a workflow run
|
|
147
|
+
*
|
|
148
|
+
* @param runId - Run ID
|
|
149
|
+
* @param owner - Repository owner (optional)
|
|
150
|
+
* @param repo - Repository name (optional)
|
|
151
|
+
* @returns List of jobs for the run
|
|
152
|
+
*/
|
|
153
|
+
export declare function fetchRunJobs(runId: number, owner?: string, repo?: string): GitHubJob[];
|
|
112
154
|
/**
|
|
113
155
|
* List workflow runs for a branch
|
|
114
156
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gh-commands.d.ts","sourceRoot":"","sources":["../src/gh-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjC,uBAAuB,CAAC,EAAE,KAAK,CAAC;QAC9B,MAAM,EAAE,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,KAAK,GAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAc,GACnD,iBAAiB,EAAE,CAYrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CASjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EAAE,GAChB,SAAS,CAaX;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,EAAE,CAiBb;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,EACb,KAAK,SAAK,EACV,MAAM,CAAC,EAAE,MAAM,EAAE,GAChB,SAAS,EAAE,CAab"}
|
package/dist/gh-commands.js
CHANGED
|
@@ -84,17 +84,18 @@ export function getCurrentPR(owner, repo) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* List
|
|
87
|
+
* List pull requests
|
|
88
88
|
*
|
|
89
89
|
* @param owner - Repository owner
|
|
90
90
|
* @param repo - Repository name
|
|
91
91
|
* @param limit - Max number of PRs to return (default: 5)
|
|
92
92
|
* @param fields - Fields to fetch (optional)
|
|
93
|
+
* @param state - PR state filter: 'open', 'closed', 'merged', or 'all' (default: 'open')
|
|
93
94
|
* @returns List of PRs
|
|
94
95
|
*/
|
|
95
|
-
export function listPullRequests(owner, repo, limit = 5, fields) {
|
|
96
|
+
export function listPullRequests(owner, repo, limit = 5, fields, state = 'open') {
|
|
96
97
|
const fieldList = fields ?? ['number', 'title', 'author', 'headRefName'];
|
|
97
|
-
const response = safeExecSync('gh', ['pr', 'list', '--repo', `${owner}/${repo}`, '--limit', String(limit), '--json', fieldList.join(',')], {
|
|
98
|
+
const response = safeExecSync('gh', ['pr', 'list', '--repo', `${owner}/${repo}`, '--limit', String(limit), '--state', state, '--json', fieldList.join(',')], {
|
|
98
99
|
encoding: 'utf8',
|
|
99
100
|
});
|
|
100
101
|
return JSON.parse(response);
|
|
@@ -105,11 +106,17 @@ export function listPullRequests(owner, repo, limit = 5, fields) {
|
|
|
105
106
|
* @param runId - GitHub run ID
|
|
106
107
|
* @param owner - Repository owner (optional)
|
|
107
108
|
* @param repo - Repository name (optional)
|
|
109
|
+
* @param jobId - GitHub job ID (optional, for matrix strategy jobs)
|
|
108
110
|
* @returns Raw log output
|
|
111
|
+
*
|
|
112
|
+
* When jobId is provided, fetches logs for a specific job within the run.
|
|
113
|
+
* This is CRITICAL for matrix strategy builds where a single run contains multiple jobs.
|
|
114
|
+
* Without jobId, gh returns combined logs from ALL jobs, making error extraction unreliable.
|
|
109
115
|
*/
|
|
110
|
-
export function fetchRunLogs(runId, owner, repo) {
|
|
116
|
+
export function fetchRunLogs(runId, owner, repo, jobId) {
|
|
111
117
|
const repoFlag = owner && repo ? ['--repo', `${owner}/${repo}`] : [];
|
|
112
|
-
const
|
|
118
|
+
const jobFlag = jobId ? ['--job', String(jobId)] : [];
|
|
119
|
+
const logs = safeExecSync('gh', ['run', 'view', String(runId), ...repoFlag, ...jobFlag, '--log'], {
|
|
113
120
|
encoding: 'utf8',
|
|
114
121
|
});
|
|
115
122
|
return typeof logs === 'string' ? logs : logs.toString('utf8');
|
|
@@ -131,6 +138,26 @@ export function fetchRunDetails(runId, owner, repo, fields) {
|
|
|
131
138
|
});
|
|
132
139
|
return JSON.parse(response);
|
|
133
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Fetch jobs for a workflow run
|
|
143
|
+
*
|
|
144
|
+
* @param runId - Run ID
|
|
145
|
+
* @param owner - Repository owner (optional)
|
|
146
|
+
* @param repo - Repository name (optional)
|
|
147
|
+
* @returns List of jobs for the run
|
|
148
|
+
*/
|
|
149
|
+
export function fetchRunJobs(runId, owner, repo) {
|
|
150
|
+
// If owner/repo provided, use them in the API path
|
|
151
|
+
// Otherwise rely on gh CLI to infer from current repo
|
|
152
|
+
const apiPath = owner && repo
|
|
153
|
+
? `repos/${owner}/${repo}/actions/runs/${runId}/jobs`
|
|
154
|
+
: `repos/:owner/:repo/actions/runs/${runId}/jobs`;
|
|
155
|
+
const response = safeExecSync('gh', ['api', apiPath], {
|
|
156
|
+
encoding: 'utf8',
|
|
157
|
+
});
|
|
158
|
+
const data = JSON.parse(response);
|
|
159
|
+
return data.jobs ?? [];
|
|
160
|
+
}
|
|
134
161
|
/**
|
|
135
162
|
* List workflow runs for a branch
|
|
136
163
|
*
|
package/dist/gh-commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gh-commands.js","sourceRoot":"","sources":["../src/gh-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"gh-commands.js","sourceRoot":"","sources":["../src/gh-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA4DpD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,KAAc,EACd,IAAa,EACb,MAAiB;IAEjB,MAAM,QAAQ,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,MAAM,SAAS,GAAG,MAAM,IAAI;QAC1B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eGitCommand, execGitCommand, tryGitCommand, validateGitRef, valid
|
|
|
17
17
|
export { addNote, readNote, removeNote, listNotes, hasNote, listNotesRefs, removeNotesRefs, getNotesRefSha } from './git-notes.js';
|
|
18
18
|
export { getPartiallyStagedFiles } from './staging.js';
|
|
19
19
|
export { isCurrentBranchBehindTracking } from './tracking-branch.js';
|
|
20
|
-
export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, listWorkflowRuns, type GitHubPullRequest, type GitHubRun } from './gh-commands.js';
|
|
20
|
+
export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, fetchRunJobs, listWorkflowRuns, type GitHubPullRequest, type GitHubRun, type GitHubJob } from './gh-commands.js';
|
|
21
|
+
export { detectDefaultBranch, isProtectedBranch, isAutoDeleteSafe, needsReview, shouldShowBranch, gatherBranchGitFacts, setupCleanupContext, parseRemoteTracking, getUnpushedCommitCount, detectMergeMethod, fetchPRDataForBranches, enrichWithGitHubData, cleanupBranches, type RemoteStatus, type BranchGitFacts, type BranchGitHubFacts, type BranchAssessment, type BranchAnalysis, type CleanupContext } from './branch-cleanup.js';
|
|
22
|
+
export type { CleanupResult as BranchCleanupResult } from './branch-cleanup.js';
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,EACL,cAAc,EACd,eAAe,EACf,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,eAAe,EACf,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,uBAAuB,EACxB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,6BAA6B,EAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,EACL,cAAc,EACd,eAAe,EACf,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,E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AAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,5 +27,7 @@ export { getPartiallyStagedFiles } from './staging.js';
|
|
|
27
27
|
// Git tracking branch detection (check if current branch is behind remote)
|
|
28
28
|
export { isCurrentBranchBehindTracking } from './tracking-branch.js';
|
|
29
29
|
// GitHub CLI commands (centralized gh command execution)
|
|
30
|
-
export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, listWorkflowRuns } from './gh-commands.js';
|
|
30
|
+
export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, fetchRunJobs, listWorkflowRuns } from './gh-commands.js';
|
|
31
|
+
// Branch cleanup analysis (identify safe-to-delete branches)
|
|
32
|
+
export { detectDefaultBranch, isProtectedBranch, isAutoDeleteSafe, needsReview, shouldShowBranch, gatherBranchGitFacts, setupCleanupContext, parseRemoteTracking, getUnpushedCommitCount, detectMergeMethod, fetchPRDataForBranches, enrichWithGitHubData, cleanupBranches } from './branch-cleanup.js';
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,uDAAuD;AACvD,OAAO,EACL,cAAc,EACd,eAAe,EACf,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,6CAA6C;AAC7C,OAAO,EACL,iBAAiB,EACjB,eAAe,EAGhB,MAAM,kBAAkB,CAAC;AAE1B,8CAA8C;AAC9C,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EAGtB,MAAM,yBAAyB,CAAC;AAEjC,qCAAqC;AACrC,OAAO,EACL,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAExB,wBAAwB;AACxB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,4DAA4D;AAC5D,OAAO,EACL,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAE3B,gDAAgD;AAChD,OAAO,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACP,aAAa,EACb,eAAe,EACf,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,uEAAuE;AACvE,OAAO,EACL,uBAAuB,EACxB,MAAM,cAAc,CAAC;AAEtB,2EAA2E;AAC3E,OAAO,EACL,6BAA6B,EAC9B,MAAM,sBAAsB,CAAC;AAE9B,yDAAyD;AACzD,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,uDAAuD;AACvD,OAAO,EACL,cAAc,EACd,eAAe,EACf,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,6CAA6C;AAC7C,OAAO,EACL,iBAAiB,EACjB,eAAe,EAGhB,MAAM,kBAAkB,CAAC;AAE1B,8CA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qB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-validate/git",
|
|
3
|
-
"version": "0.18.0
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Git utilities for vibe-validate - tree hash calculation, branch sync, and post-merge cleanup",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@vibe-validate/utils": "0.18.0
|
|
41
|
+
"@vibe-validate/utils": "0.18.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^22.19.2",
|