@vibe-validate/git 0.19.5 → 0.19.6

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.
@@ -70,6 +70,20 @@ export declare function hasNotesRef(notesRef: string): boolean;
70
70
  * @returns true if MERGE_HEAD exists (merge in progress), false otherwise
71
71
  */
72
72
  export declare function isMergeInProgress(): boolean;
73
+ /**
74
+ * Check if git is currently in the middle of a rebase.
75
+ *
76
+ * Git uses two different scratch directories depending on which rebase
77
+ * backend is active: `rebase-merge` (interactive / default since git 2.26)
78
+ * and `rebase-apply` (legacy `am`-based). Either being present means a
79
+ * rebase is mid-flight.
80
+ *
81
+ * Returns `false` (rather than throwing) when called outside a git
82
+ * repository, matching the contract of `isMergeInProgress()`.
83
+ *
84
+ * @returns true if a rebase is in progress, false otherwise
85
+ */
86
+ export declare function isRebaseInProgress(): boolean;
73
87
  /**
74
88
  * Get diff statistics between two refs
75
89
  * @param baseRef - Base reference (e.g., 'origin/main')
@@ -1 +1 @@
1
- {"version":3,"file":"git-commands.d.ts","sourceRoot":"","sources":["../src/git-commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAW,GAAG,MAAM,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,C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;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAS,GAAG,MAAM,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAS,GAAG,MAAM,CAExE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -4,6 +4,8 @@
4
4
  * High-level git operations built on top of the secure git-executor.
5
5
  * These functions provide convenient access to common git commands.
6
6
  */
7
+ import { existsSync } from 'node:fs';
8
+ import { join } from 'node:path';
7
9
  import { execGitCommand, tryGitCommand } from './git-executor.js';
8
10
  /**
9
11
  * Check if the current directory is inside a git repository
@@ -93,6 +95,27 @@ export function hasNotesRef(notesRef) {
93
95
  export function isMergeInProgress() {
94
96
  return tryGitCommand(['rev-parse', '--verify', '--quiet', 'MERGE_HEAD']);
95
97
  }
98
+ /**
99
+ * Check if git is currently in the middle of a rebase.
100
+ *
101
+ * Git uses two different scratch directories depending on which rebase
102
+ * backend is active: `rebase-merge` (interactive / default since git 2.26)
103
+ * and `rebase-apply` (legacy `am`-based). Either being present means a
104
+ * rebase is mid-flight.
105
+ *
106
+ * Returns `false` (rather than throwing) when called outside a git
107
+ * repository, matching the contract of `isMergeInProgress()`.
108
+ *
109
+ * @returns true if a rebase is in progress, false otherwise
110
+ */
111
+ export function isRebaseInProgress() {
112
+ if (!isGitRepository()) {
113
+ return false;
114
+ }
115
+ const gitDir = getGitDir();
116
+ return existsSync(join(gitDir, 'rebase-merge'))
117
+ || existsSync(join(gitDir, 'rebase-apply'));
118
+ }
96
119
  /**
97
120
  * Get diff statistics between two refs
98
121
  * @param baseRef - Base reference (e.g., 'origin/main')
@@ -1 +1 @@
1
- {"version":3,"file":"git-commands.js","sourceRoot":"","sources":["../src/git-commands.ts"],"names":[],"mappings":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EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;WAC1C,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,OAAO,GAAG,MAAM;IAC5D,OAAO,cAAc,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,OAAO,GAAG,MAAM;IAC9D,OAAO,cAAc,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,cAAc,CAAC,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;AACnD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,12 +12,12 @@ export { BranchSyncChecker, checkBranchSync, type SyncCheckResult, type SyncChec
12
12
  export { PostPRMergeCleanup, cleanupMergedBranches, type CleanupResult, type CleanupOptions } from './post-merge-cleanup.js';
13
13
  export { encodeRunCacheKey } from './cache-key.js';
14
14
  export { extractYamlContent, extractYamlWithPreamble } from './yaml-detection.js';
15
- export { isGitRepository, getGitDir, getRepositoryRoot, getCurrentBranch, getRemoteUrl, getHeadCommitSha, getHeadTreeSha, verifyRef, verifyRefOrThrow, hasNotesRef, isMergeInProgress, getDiffStats, getCommitCount, getNotesRefs } from './git-commands.js';
15
+ export { isGitRepository, getGitDir, getRepositoryRoot, getCurrentBranch, getRemoteUrl, getHeadCommitSha, getHeadTreeSha, verifyRef, verifyRefOrThrow, hasNotesRef, isMergeInProgress, isRebaseInProgress, getDiffStats, getCommitCount, getNotesRefs } from './git-commands.js';
16
16
  export { executeGitCommand, execGitCommand, tryGitCommand, validateGitRef, validateNotesRef, validateTreeHash, type GitExecutionOptions, type GitExecutionResult } from './git-executor.js';
17
17
  export { addNote, readNote, removeNote, listNoteObjects, hasNote, listNotesRefs, removeNotesRefs, getNotesRefSha, mergeReplace, mergeAppendRuns, } from './git-notes.js';
18
18
  export type { NoteMergeStrategy } from './git-notes.js';
19
19
  export { getStagedFiles, getPartiallyStagedFiles } from './staging.js';
20
- export { isCurrentBranchBehindTracking } from './tracking-branch.js';
20
+ export { getTrackingDivergence, isCurrentBranchBehindTracking, type TrackingDivergence } from './tracking-branch.js';
21
21
  export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, fetchRunJobs, listWorkflowRuns, type GitHubPullRequest, type GitHubRun, type GitHubJob } from './gh-commands.js';
22
22
  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';
23
23
  export type { CleanupResult as BranchCleanupResult } from './branch-cleanup.js';
@@ -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,cAAc,EAAE,MAAM,YAAY,CAAC;AAGhF,O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7B,YAAY,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EACL,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -17,15 +17,15 @@ export { encodeRunCacheKey } from './cache-key.js';
17
17
  // YAML output detection
18
18
  export { extractYamlContent, extractYamlWithPreamble } from './yaml-detection.js';
19
19
  // Git command utilities (standardized rev-parse operations)
20
- export { isGitRepository, getGitDir, getRepositoryRoot, getCurrentBranch, getRemoteUrl, getHeadCommitSha, getHeadTreeSha, verifyRef, verifyRefOrThrow, hasNotesRef, isMergeInProgress, getDiffStats, getCommitCount, getNotesRefs } from './git-commands.js';
20
+ export { isGitRepository, getGitDir, getRepositoryRoot, getCurrentBranch, getRemoteUrl, getHeadCommitSha, getHeadTreeSha, verifyRef, verifyRefOrThrow, hasNotesRef, isMergeInProgress, isRebaseInProgress, getDiffStats, getCommitCount, getNotesRefs } from './git-commands.js';
21
21
  // Secure git command execution (low-level - use high-level APIs when possible)
22
22
  export { executeGitCommand, execGitCommand, tryGitCommand, validateGitRef, validateNotesRef, validateTreeHash } from './git-executor.js';
23
23
  // Git notes operations (high-level abstraction)
24
24
  export { addNote, readNote, removeNote, listNoteObjects, hasNote, listNotesRefs, removeNotesRefs, getNotesRefSha, mergeReplace, mergeAppendRuns, } from './git-notes.js';
25
25
  // Git staging detection (prevent partially staged files in pre-commit)
26
26
  export { getStagedFiles, getPartiallyStagedFiles } from './staging.js';
27
- // Git tracking branch detection (check if current branch is behind remote)
28
- export { isCurrentBranchBehindTracking } from './tracking-branch.js';
27
+ // Git tracking branch detection (check if current branch diverges from remote)
28
+ export { getTrackingDivergence, isCurrentBranchBehindTracking } from './tracking-branch.js';
29
29
  // GitHub CLI commands (centralized gh command execution)
30
30
  export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, fetchRunJobs, listWorkflowRuns } from './gh-commands.js';
31
31
  // Branch cleanup analysis (identify safe-to-delete branches)
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,eAAe,EACf,OAAO,EACP,aAAa,EACb,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,uEAAuE;AACvE,OAAO,EACL,cAAc,EACd,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,YAAY,EACZ,gBAAgB,EAIjB,MAAM,kBAAkB,CAAC;AAE1B,6DAA6D;AAC7D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EAOhB,MAAM,qBAAqB,CAAC;AAK7B,4EAA4E;AAC5E,OAAO,EACL,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC"}
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,E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,gBAAgB,EACjB,MAAM,mBAAmB,CAAC"}
@@ -1,34 +1,73 @@
1
1
  /**
2
- * Git Tracking Branch Detection
2
+ * Git Tracking Branch Divergence Detection
3
3
  *
4
- * Detects if current branch is behind its remote tracking branch.
4
+ * Compares the current branch against its remote tracking branch and reports
5
+ * how many commits diverge on each side.
5
6
  *
6
7
  * ## The Problem
7
8
  *
8
- * If you're working on local `fix-issue-X` and someone else pushes to `origin/fix-issue-X`:
9
- * 1. Your local branch is now behind the remote tracking branch
10
- * 2. If you commit and push, you may create conflicts or lose their changes
11
- * 3. You should pull/merge before committing
9
+ * Two different real-world conditions can leave the local branch out of sync
10
+ * with its upstream, and the pre-commit hook needs to treat them differently:
11
+ *
12
+ * 1. **Purely behind** someone else pushed to origin while we worked locally.
13
+ * `ahead = 0`, `behind > 0`. The user must pull before committing.
14
+ * 2. **Diverged** — we rebased our feature branch onto an updated base; the
15
+ * upstream branch still has the pre-rebase commits. `ahead > 0`, `behind > 0`.
16
+ * The user will force-push-with-lease when ready; pre-commit should NOT block.
17
+ *
18
+ * A simple "is the branch behind?" check (e.g. counting `HEAD..@{u}`) cannot
19
+ * tell these apart, because in both cases the upstream contains commits not
20
+ * reachable from HEAD. We need both sides of the comparison.
12
21
  *
13
22
  * ## Solution
14
23
  *
15
- * Pre-commit hook should detect and warn when current branch is behind its tracking branch.
24
+ * Use `git rev-list --left-right --count HEAD...@{u}`, which returns
25
+ * `<ahead>\t<behind>` in a single deterministic call.
26
+ */
27
+ /**
28
+ * Divergence between HEAD and its remote tracking branch.
29
+ *
30
+ * - `ahead`: commits on HEAD that are not on upstream
31
+ * - `behind`: commits on upstream that are not on HEAD
16
32
  */
33
+ export interface TrackingDivergence {
34
+ ahead: number;
35
+ behind: number;
36
+ }
17
37
  /**
18
- * Check if current branch is behind its remote tracking branch
38
+ * Check how the current branch diverges from its remote tracking branch.
19
39
  *
20
- * @returns Number of commits behind (0 = up to date), or null if no tracking branch
40
+ * @returns The ahead/behind counts, or `null` if there is no upstream
41
+ * tracking branch (e.g. a freshly created local branch).
21
42
  *
22
43
  * @example
23
44
  * ```typescript
24
- * const behindBy = isCurrentBranchBehindTracking();
25
- * if (behindBy === null) {
26
- * console.log('No remote tracking branch');
27
- * } else if (behindBy > 0) {
28
- * console.error(`Behind by ${behindBy} commit(s)`);
29
- * console.error('Pull changes with: git pull');
45
+ * const div = getTrackingDivergence();
46
+ * if (div === null) {
47
+ * // No upstream nothing to compare against.
48
+ * } else if (div.ahead === 0 && div.behind === 0) {
49
+ * // Fully synced.
50
+ * } else if (div.ahead === 0 && div.behind > 0) {
51
+ * // Purely behind — someone else pushed; pull before committing.
52
+ * } else if (div.ahead > 0 && div.behind === 0) {
53
+ * // Ahead only — local commits not yet pushed.
54
+ * } else {
55
+ * // Diverged (e.g. rebased) — force-push-with-lease when ready.
30
56
  * }
31
57
  * ```
32
58
  */
59
+ export declare function getTrackingDivergence(): TrackingDivergence | null;
60
+ /**
61
+ * Check if the current branch is behind its remote tracking branch.
62
+ *
63
+ * @deprecated Prefer {@link getTrackingDivergence}, which distinguishes
64
+ * "purely behind" (someone pushed) from "diverged" (we rebased). This
65
+ * wrapper only reports the behind count and treats diverged branches the
66
+ * same as purely-behind ones — which incorrectly blocks legitimate
67
+ * post-rebase commits in pre-commit hooks. Retained for backwards
68
+ * compatibility with external consumers of `@vibe-validate/git`.
69
+ *
70
+ * @returns Number of commits behind, or `null` if no tracking branch.
71
+ */
33
72
  export declare function isCurrentBranchBehindTracking(): number | null;
34
73
  //# sourceMappingURL=tracking-branch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracking-branch.d.ts","sourceRoot":"","sources":["../src/tracking-branch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,GAAG,IAAI,CAuC7D"}
1
+ {"version":3,"file":"tracking-branch.d.ts","sourceRoot":"","sources":["../src/tracking-branch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,IAAI,CAyCjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,GAAG,IAAI,CAG7D"}
@@ -1,64 +1,99 @@
1
1
  /**
2
- * Git Tracking Branch Detection
2
+ * Git Tracking Branch Divergence Detection
3
3
  *
4
- * Detects if current branch is behind its remote tracking branch.
4
+ * Compares the current branch against its remote tracking branch and reports
5
+ * how many commits diverge on each side.
5
6
  *
6
7
  * ## The Problem
7
8
  *
8
- * If you're working on local `fix-issue-X` and someone else pushes to `origin/fix-issue-X`:
9
- * 1. Your local branch is now behind the remote tracking branch
10
- * 2. If you commit and push, you may create conflicts or lose their changes
11
- * 3. You should pull/merge before committing
9
+ * Two different real-world conditions can leave the local branch out of sync
10
+ * with its upstream, and the pre-commit hook needs to treat them differently:
11
+ *
12
+ * 1. **Purely behind** someone else pushed to origin while we worked locally.
13
+ * `ahead = 0`, `behind > 0`. The user must pull before committing.
14
+ * 2. **Diverged** — we rebased our feature branch onto an updated base; the
15
+ * upstream branch still has the pre-rebase commits. `ahead > 0`, `behind > 0`.
16
+ * The user will force-push-with-lease when ready; pre-commit should NOT block.
17
+ *
18
+ * A simple "is the branch behind?" check (e.g. counting `HEAD..@{u}`) cannot
19
+ * tell these apart, because in both cases the upstream contains commits not
20
+ * reachable from HEAD. We need both sides of the comparison.
12
21
  *
13
22
  * ## Solution
14
23
  *
15
- * Pre-commit hook should detect and warn when current branch is behind its tracking branch.
24
+ * Use `git rev-list --left-right --count HEAD...@{u}`, which returns
25
+ * `<ahead>\t<behind>` in a single deterministic call.
16
26
  */
17
27
  import { executeGitCommand } from './git-executor.js';
18
28
  const GIT_TIMEOUT = 30000;
19
29
  /**
20
- * Check if current branch is behind its remote tracking branch
30
+ * Check how the current branch diverges from its remote tracking branch.
21
31
  *
22
- * @returns Number of commits behind (0 = up to date), or null if no tracking branch
32
+ * @returns The ahead/behind counts, or `null` if there is no upstream
33
+ * tracking branch (e.g. a freshly created local branch).
23
34
  *
24
35
  * @example
25
36
  * ```typescript
26
- * const behindBy = isCurrentBranchBehindTracking();
27
- * if (behindBy === null) {
28
- * console.log('No remote tracking branch');
29
- * } else if (behindBy > 0) {
30
- * console.error(`Behind by ${behindBy} commit(s)`);
31
- * console.error('Pull changes with: git pull');
37
+ * const div = getTrackingDivergence();
38
+ * if (div === null) {
39
+ * // No upstream nothing to compare against.
40
+ * } else if (div.ahead === 0 && div.behind === 0) {
41
+ * // Fully synced.
42
+ * } else if (div.ahead === 0 && div.behind > 0) {
43
+ * // Purely behind — someone else pushed; pull before committing.
44
+ * } else if (div.ahead > 0 && div.behind === 0) {
45
+ * // Ahead only — local commits not yet pushed.
46
+ * } else {
47
+ * // Diverged (e.g. rebased) — force-push-with-lease when ready.
32
48
  * }
33
49
  * ```
34
50
  */
35
- export function isCurrentBranchBehindTracking() {
51
+ export function getTrackingDivergence() {
36
52
  try {
37
- // Get the upstream tracking branch for current branch
38
- // Example output: "origin/fix-issue-X"
39
- // Throws error if no upstream configured
40
- const trackingResult = executeGitCommand(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'], { timeout: GIT_TIMEOUT, ignoreErrors: true });
41
- if (!trackingResult.success || !trackingResult.stdout.trim()) {
42
- // No tracking branch or command failed
53
+ // Confirm an upstream exists first. Without this, the rev-list call
54
+ // below would fail with the same "no upstream" error and we'd have to
55
+ // pattern-match on stderr to distinguish it from real errors.
56
+ const upstreamResult = executeGitCommand(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'], { timeout: GIT_TIMEOUT, ignoreErrors: true });
57
+ if (!upstreamResult.success || !upstreamResult.stdout.trim()) {
43
58
  return null;
44
59
  }
45
- // Count commits behind: HEAD..@{u}
46
- // This shows commits in tracking branch that are not in HEAD
47
- const behindResult = executeGitCommand(['rev-list', '--count', 'HEAD..@{u}'], { timeout: GIT_TIMEOUT, ignoreErrors: true });
48
- if (!behindResult.success) {
60
+ // `--left-right --count HEAD...@{u}` returns `<ahead>\t<behind>`.
61
+ // The triple-dot (...) means "symmetric difference": commits reachable
62
+ // from exactly one side. --left-right tags each commit with < (left
63
+ // side = HEAD) or > (right side = @{u}); --count collapses to counts.
64
+ const divergenceResult = executeGitCommand(['rev-list', '--left-right', '--count', 'HEAD...@{u}'], { timeout: GIT_TIMEOUT, ignoreErrors: true });
65
+ if (!divergenceResult.success) {
49
66
  return null;
50
67
  }
51
- const behindCount = Number.parseInt(behindResult.stdout.trim(), 10);
52
- // Return 0 if parsing failed (defensive)
53
- return Number.isNaN(behindCount) ? 0 : behindCount;
68
+ const [aheadRaw, behindRaw] = divergenceResult.stdout.trim().split(/\s+/);
69
+ const ahead = Number.parseInt(aheadRaw ?? '', 10);
70
+ const behind = Number.parseInt(behindRaw ?? '', 10);
71
+ return {
72
+ ahead: Number.isNaN(ahead) ? 0 : ahead,
73
+ behind: Number.isNaN(behind) ? 0 : behind,
74
+ };
54
75
  }
55
76
  catch (error) {
56
- // Check if error is "no upstream configured" (expected for new branches)
57
77
  if (error instanceof Error && error.message.includes('no upstream')) {
58
78
  return null;
59
79
  }
60
- // Other errors (not in git repo, etc.) - return null
61
80
  return null;
62
81
  }
63
82
  }
83
+ /**
84
+ * Check if the current branch is behind its remote tracking branch.
85
+ *
86
+ * @deprecated Prefer {@link getTrackingDivergence}, which distinguishes
87
+ * "purely behind" (someone pushed) from "diverged" (we rebased). This
88
+ * wrapper only reports the behind count and treats diverged branches the
89
+ * same as purely-behind ones — which incorrectly blocks legitimate
90
+ * post-rebase commits in pre-commit hooks. Retained for backwards
91
+ * compatibility with external consumers of `@vibe-validate/git`.
92
+ *
93
+ * @returns Number of commits behind, or `null` if no tracking branch.
94
+ */
95
+ export function isCurrentBranchBehindTracking() {
96
+ const divergence = getTrackingDivergence();
97
+ return divergence === null ? null : divergence.behind;
98
+ }
64
99
  //# sourceMappingURL=tracking-branch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracking-branch.js","sourceRoot":"","sources":["../src/tracking-branch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,6BAA6B;IAC3C,IAAI,CAAC;QACH,sDAAsD;QACtD,uCAAuC;QACvC,yCAAyC;QACzC,MAAM,cAAc,GAAG,iBAAiB,CACtC,CAAC,WAAW,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAC7D,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,CAC7C,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YAC7D,uCAAuC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,mCAAmC;QACnC,6DAA6D;QAC7D,MAAM,YAAY,GAAG,iBAAiB,CACpC,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,CAAC,EACrC,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,CAC7C,CAAC;QAEF,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAEpE,yCAAyC;QACzC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CA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,CAAC;QAED,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1E,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAEpD,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;YACtC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;SAC1C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YACpE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,6BAA6B;IAC3C,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC;IAC3C,OAAO,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;AACxD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-validate/git",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
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",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "yaml": "^2.8.2",
42
- "@vibe-validate/utils": "0.19.5"
42
+ "@vibe-validate/utils": "0.19.6"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^22.19.2",