@vibe-validate/git 0.19.0-rc.1 → 0.19.0-rc.11
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.map +1 -1
- package/dist/branch-cleanup.js +3 -2
- package/dist/branch-cleanup.js.map +1 -1
- package/dist/branch-sync.d.ts.map +1 -1
- package/dist/branch-sync.js +1 -0
- package/dist/branch-sync.js.map +1 -1
- package/dist/git-executor.d.ts +3 -1
- package/dist/git-executor.d.ts.map +1 -1
- package/dist/git-executor.js +8 -4
- package/dist/git-executor.js.map +1 -1
- package/dist/git-notes.d.ts +51 -20
- package/dist/git-notes.d.ts.map +1 -1
- package/dist/git-notes.js +79 -231
- package/dist/git-notes.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/post-merge-cleanup.js +4 -4
- package/dist/post-merge-cleanup.js.map +1 -1
- package/dist/staging.d.ts +18 -0
- package/dist/staging.d.ts.map +1 -1
- package/dist/staging.js +45 -2
- package/dist/staging.js.map +1 -1
- package/dist/test-helpers.d.ts +144 -0
- package/dist/test-helpers.d.ts.map +1 -0
- package/dist/test-helpers.js +195 -0
- package/dist/test-helpers.js.map +1 -0
- package/dist/tree-hash.d.ts +86 -4
- package/dist/tree-hash.d.ts.map +1 -1
- package/dist/tree-hash.js +180 -8
- package/dist/tree-hash.js.map +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -3
package/dist/git-notes.js
CHANGED
|
@@ -10,262 +10,115 @@ import { toForwardSlash } from '@vibe-validate/utils';
|
|
|
10
10
|
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
11
11
|
import { executeGitCommand, tryGitCommand, validateNotesRef, validateTreeHash, } from './git-executor.js';
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Merge strategy: replace existing note entirely with incoming content.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* @returns The blob SHA
|
|
15
|
+
* Used by run cache where each entry is deterministic (same tree + command = same result).
|
|
17
16
|
*/
|
|
18
|
-
|
|
19
|
-
const result = executeGitCommand(['hash-object', '-w', '--stdin'], {
|
|
20
|
-
stdin: content,
|
|
21
|
-
});
|
|
22
|
-
return result.stdout;
|
|
23
|
-
}
|
|
17
|
+
export const mergeReplace = (_existing, incoming) => incoming;
|
|
24
18
|
/**
|
|
25
|
-
*
|
|
19
|
+
* Merge strategy: append runs arrays from both notes, new fields win.
|
|
26
20
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
function readTreeEntries(commitSha) {
|
|
31
|
-
const result = executeGitCommand(['ls-tree', commitSha], {
|
|
32
|
-
ignoreErrors: true,
|
|
33
|
-
});
|
|
34
|
-
if (!result.success || !result.stdout) {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
const entries = [];
|
|
38
|
-
for (const line of result.stdout.split('\n')) {
|
|
39
|
-
if (!line)
|
|
40
|
-
continue;
|
|
41
|
-
// Format: "MODE TYPE SHA\tNAME" (note: TAB before name, not space)
|
|
42
|
-
// Use split to avoid backtracking regex issues
|
|
43
|
-
const parts = line.split(/\s+/);
|
|
44
|
-
if (parts.length < 4)
|
|
45
|
-
continue;
|
|
46
|
-
const mode = parts[0];
|
|
47
|
-
const type = parts[1];
|
|
48
|
-
const sha = parts[2];
|
|
49
|
-
// Name may contain spaces, so join the rest
|
|
50
|
-
const name = parts.slice(3).join(' ');
|
|
51
|
-
// Validate format
|
|
52
|
-
if (!/^\d+$/.test(mode))
|
|
53
|
-
continue;
|
|
54
|
-
if (type !== 'blob' && type !== 'tree')
|
|
55
|
-
continue;
|
|
56
|
-
if (!/^[0-9a-f]+$/.test(sha))
|
|
57
|
-
continue;
|
|
58
|
-
entries.push({
|
|
59
|
-
mode,
|
|
60
|
-
type,
|
|
61
|
-
sha,
|
|
62
|
-
name,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return entries;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Create a tree from entries using git mktree
|
|
69
|
-
*
|
|
70
|
-
* @param entries - Array of tree entries
|
|
71
|
-
* @returns The tree SHA
|
|
72
|
-
*/
|
|
73
|
-
function createTree(entries) {
|
|
74
|
-
// Format for mktree: "MODE TYPE SHA\tNAME"
|
|
75
|
-
const input = entries
|
|
76
|
-
.map((e) => `${e.mode} ${e.type} ${e.sha}\t${e.name}`)
|
|
77
|
-
.join('\n');
|
|
78
|
-
const result = executeGitCommand(['mktree'], {
|
|
79
|
-
stdin: input,
|
|
80
|
-
});
|
|
81
|
-
return result.stdout;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Create a notes commit using git commit-tree
|
|
21
|
+
* Used by validation history where multiple runs accumulate per tree hash.
|
|
22
|
+
* Parses YAML with `uniqueKeys: false` to tolerate corrupted notes with duplicate keys.
|
|
85
23
|
*
|
|
86
|
-
* @
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Existing note has run-1, incoming has run-2 → merged has both
|
|
27
|
+
* const merged = mergeAppendRuns(existingYaml, incomingYaml);
|
|
28
|
+
* ```
|
|
90
29
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
30
|
+
export const mergeAppendRuns = (existing, incoming) => {
|
|
31
|
+
try {
|
|
32
|
+
const existingData = parseYaml(existing, { uniqueKeys: false });
|
|
33
|
+
const newData = parseYaml(incoming, { uniqueKeys: false });
|
|
34
|
+
const existingRuns = Array.isArray(existingData?.runs) ? existingData.runs : [];
|
|
35
|
+
const newRuns = Array.isArray(newData?.runs) ? newData.runs : [];
|
|
36
|
+
const merged = {
|
|
37
|
+
...existingData,
|
|
38
|
+
...newData,
|
|
39
|
+
};
|
|
40
|
+
// Only include runs when at least one side has them (avoids spurious runs: [] on cache notes)
|
|
41
|
+
if (existingRuns.length > 0 || newRuns.length > 0) {
|
|
42
|
+
merged.runs = [...existingRuns, ...newRuns];
|
|
43
|
+
}
|
|
44
|
+
return stringifyYaml(merged);
|
|
95
45
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Atomically update a ref using compare-and-swap
|
|
101
|
-
*
|
|
102
|
-
* @param ref - The ref to update (e.g., 'refs/notes/vibe-validate/validate')
|
|
103
|
-
* @param newSha - The new commit SHA
|
|
104
|
-
* @param oldSha - The expected current commit SHA (or null for new ref)
|
|
105
|
-
* @returns true if update succeeded, false if ref changed (CAS failure)
|
|
106
|
-
*/
|
|
107
|
-
function atomicUpdateRef(ref, newSha, oldSha) {
|
|
108
|
-
const args = ['update-ref', ref, newSha];
|
|
109
|
-
if (oldSha) {
|
|
110
|
-
args.push(oldSha);
|
|
46
|
+
catch {
|
|
47
|
+
// If parsing fails, prefer new note (latest data)
|
|
48
|
+
return incoming;
|
|
111
49
|
}
|
|
112
|
-
|
|
113
|
-
ignoreErrors: true,
|
|
114
|
-
suppressStderr: true,
|
|
115
|
-
});
|
|
116
|
-
return result.success;
|
|
117
|
-
}
|
|
50
|
+
};
|
|
118
51
|
/**
|
|
119
|
-
* Attempt
|
|
52
|
+
* Attempt to merge an existing note with new content
|
|
53
|
+
*
|
|
54
|
+
* Uses `git notes add -f` for the write, which correctly handles
|
|
55
|
+
* git notes fan-out (2-character subdirectories).
|
|
120
56
|
*
|
|
121
57
|
* @param notesRef - The notes reference
|
|
122
|
-
* @param fullRef - The full ref path (refs/notes/...)
|
|
123
58
|
* @param object - The object to attach the note to
|
|
124
59
|
* @param content - The new note content to merge
|
|
125
|
-
* @
|
|
60
|
+
* @param merge - The merge strategy to apply
|
|
61
|
+
* @returns true if merge succeeded, false on error
|
|
126
62
|
*/
|
|
127
|
-
function
|
|
128
|
-
// Step 1:
|
|
129
|
-
const currentCommitSha = getNotesRefSha(notesRef);
|
|
130
|
-
if (!currentCommitSha) {
|
|
131
|
-
return false; // Ref disappeared
|
|
132
|
-
}
|
|
133
|
-
// Step 2: Read existing note and merge
|
|
63
|
+
function attemptMerge(notesRef, object, content, merge = mergeAppendRuns) {
|
|
64
|
+
// Step 1: Read existing note
|
|
134
65
|
const existingNote = readNote(notesRef, object);
|
|
135
66
|
if (existingNote === null) {
|
|
136
|
-
return false; // Note disappeared
|
|
137
|
-
}
|
|
138
|
-
const merged = mergeNotes(existingNote, content);
|
|
139
|
-
// Step 3: Build new notes commit atomically
|
|
140
|
-
try {
|
|
141
|
-
// Read current tree entries
|
|
142
|
-
const entries = readTreeEntries(currentCommitSha);
|
|
143
|
-
// Create blob with merged content
|
|
144
|
-
const blobSha = createBlob(merged);
|
|
145
|
-
// Update or add entry for this object
|
|
146
|
-
const existingEntryIndex = entries.findIndex((e) => e.name === object);
|
|
147
|
-
const newEntry = {
|
|
148
|
-
mode: '100644',
|
|
149
|
-
type: 'blob',
|
|
150
|
-
sha: blobSha,
|
|
151
|
-
name: object,
|
|
152
|
-
};
|
|
153
|
-
if (existingEntryIndex >= 0) {
|
|
154
|
-
entries[existingEntryIndex] = newEntry;
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
entries.push(newEntry);
|
|
158
|
-
}
|
|
159
|
-
// Create new tree
|
|
160
|
-
const treeSha = createTree(entries);
|
|
161
|
-
// Create new commit
|
|
162
|
-
const commitSha = createNotesCommit(treeSha, currentCommitSha, 'Notes added by vibe-validate');
|
|
163
|
-
// Step 4: Atomically update ref (compare-and-swap)
|
|
164
|
-
return atomicUpdateRef(fullRef, commitSha, currentCommitSha);
|
|
165
|
-
}
|
|
166
|
-
catch {
|
|
167
|
-
return false; // Git plumbing operation failed
|
|
67
|
+
return false; // Note disappeared (benign race condition)
|
|
168
68
|
}
|
|
69
|
+
// Step 2: Apply merge strategy
|
|
70
|
+
const merged = merge(existingNote, content);
|
|
71
|
+
// Step 3: Force-write merged content (git handles fan-out correctly)
|
|
72
|
+
const result = executeGitCommand(['notes', `--ref=${notesRef}`, 'add', '-f', '-F', '-', object], {
|
|
73
|
+
stdin: merged,
|
|
74
|
+
ignoreErrors: true,
|
|
75
|
+
suppressStderr: true,
|
|
76
|
+
});
|
|
77
|
+
return result.success;
|
|
169
78
|
}
|
|
170
79
|
/**
|
|
171
|
-
*
|
|
80
|
+
* Add or update a git note
|
|
172
81
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
82
|
+
* One code path for all callers:
|
|
83
|
+
* 1. Try `git notes add` (fast path for new notes — no merge needed)
|
|
84
|
+
* 2. If note exists: read → apply merge strategy → `git notes add -f`
|
|
175
85
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*/
|
|
180
|
-
function mergeNotes(existingNote, newNote) {
|
|
181
|
-
try {
|
|
182
|
-
const existing = parseYaml(existingNote);
|
|
183
|
-
const newData = parseYaml(newNote);
|
|
184
|
-
// Extract runs arrays (handle both single object and array formats)
|
|
185
|
-
const existingRuns = Array.isArray(existing.runs) ? existing.runs : [];
|
|
186
|
-
const newRuns = Array.isArray(newData.runs) ? newData.runs : [];
|
|
187
|
-
// Merge: append new runs to existing
|
|
188
|
-
const merged = {
|
|
189
|
-
...existing,
|
|
190
|
-
runs: [...existingRuns, ...newRuns],
|
|
191
|
-
};
|
|
192
|
-
return stringifyYaml(merged);
|
|
193
|
-
}
|
|
194
|
-
catch {
|
|
195
|
-
// If parsing fails, prefer new note (latest data)
|
|
196
|
-
return newNote;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Add or update a git note with atomic compare-and-swap
|
|
86
|
+
* The merge strategy controls what happens when a note already exists.
|
|
87
|
+
* Default is `mergeReplace` (incoming content wins). Use `mergeAppendRuns`
|
|
88
|
+
* for validation history where runs accumulate per tree hash.
|
|
201
89
|
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* 1. Read the current notes ref commit SHA (snapshot)
|
|
205
|
-
* 2. Read and merge the existing note
|
|
206
|
-
* 3. Build a new notes commit with merged content
|
|
207
|
-
* 4. Atomically update the ref only if it hasn't changed (compare-and-swap)
|
|
208
|
-
* 5. If ref changed, retry from step 1
|
|
209
|
-
*
|
|
210
|
-
* This prevents data loss when multiple worktrees validate simultaneously.
|
|
90
|
+
* Note: There is a small TOCTOU window between read and force-write.
|
|
91
|
+
* This is acceptable for history/cache data.
|
|
211
92
|
*
|
|
212
93
|
* @param notesRef - The notes reference (e.g., 'vibe-validate/validate')
|
|
213
94
|
* @param object - The git tree hash to attach the note to (must be from getGitTreeHash())
|
|
214
95
|
* @param content - The note content
|
|
215
|
-
* @param
|
|
96
|
+
* @param merge - Strategy for merging with existing note (default: mergeReplace)
|
|
216
97
|
* @returns true if note was added successfully
|
|
217
98
|
*
|
|
218
99
|
* @example
|
|
219
100
|
* ```typescript
|
|
220
|
-
*
|
|
221
|
-
* addNote('vibe-validate/
|
|
101
|
+
* // Run cache: replace existing (default)
|
|
102
|
+
* addNote('vibe-validate/run/abc/key', treeHash, cacheYaml);
|
|
103
|
+
*
|
|
104
|
+
* // Validation history: append runs
|
|
105
|
+
* addNote('vibe-validate/validate', treeHash, historyYaml, mergeAppendRuns);
|
|
222
106
|
* ```
|
|
223
107
|
*/
|
|
224
|
-
export function addNote(notesRef, object, content,
|
|
108
|
+
export function addNote(notesRef, object, content, merge = mergeReplace) {
|
|
225
109
|
validateNotesRef(notesRef);
|
|
226
110
|
validateTreeHash(object);
|
|
227
|
-
//
|
|
228
|
-
const fullRef = notesRef.startsWith('refs/')
|
|
229
|
-
? notesRef
|
|
230
|
-
: `refs/notes/${notesRef}`;
|
|
231
|
-
// If force is true, skip optimistic locking (legacy behavior)
|
|
232
|
-
if (force) {
|
|
233
|
-
const args = ['notes', `--ref=${notesRef}`, 'add', '-f', '-F', '-', object];
|
|
234
|
-
const result = executeGitCommand(args, {
|
|
235
|
-
stdin: content,
|
|
236
|
-
ignoreErrors: true,
|
|
237
|
-
suppressStderr: true,
|
|
238
|
-
});
|
|
239
|
-
return result.success;
|
|
240
|
-
}
|
|
241
|
-
// Fast path: Try to add note without force (for new notes)
|
|
111
|
+
// Fast path: Try to add note (works for new notes — no merge needed)
|
|
242
112
|
const addResult = executeGitCommand(['notes', `--ref=${notesRef}`, 'add', '-F', '-', object], {
|
|
243
113
|
stdin: content,
|
|
244
114
|
ignoreErrors: true,
|
|
245
115
|
suppressStderr: true,
|
|
246
116
|
});
|
|
247
117
|
if (addResult.success) {
|
|
248
|
-
return true; //
|
|
249
|
-
}
|
|
250
|
-
// Check if this is a conflict (note already exists)
|
|
251
|
-
const isConflict = addResult.stderr.includes('already exists');
|
|
252
|
-
if (!isConflict) {
|
|
253
|
-
// Not a conflict - real error, return failure
|
|
254
|
-
return false;
|
|
255
|
-
}
|
|
256
|
-
// Conflict detected - enter atomic merge path with retry
|
|
257
|
-
const maxRetries = 3;
|
|
258
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
259
|
-
const success = attemptAtomicMerge(notesRef, fullRef, object, content);
|
|
260
|
-
if (success) {
|
|
261
|
-
return true; // Success! Atomic merge succeeded
|
|
262
|
-
}
|
|
263
|
-
// Failed - retry if not last attempt
|
|
264
|
-
if (attempt === maxRetries) {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
118
|
+
return true; // Note didn't exist, added cleanly
|
|
267
119
|
}
|
|
268
|
-
|
|
120
|
+
// Note exists — read, apply merge strategy, force-write
|
|
121
|
+
return attemptMerge(notesRef, object, content, merge);
|
|
269
122
|
}
|
|
270
123
|
/**
|
|
271
124
|
* Read a git note
|
|
@@ -314,22 +167,22 @@ export function removeNote(notesRef, object) {
|
|
|
314
167
|
});
|
|
315
168
|
}
|
|
316
169
|
/**
|
|
317
|
-
* List all
|
|
170
|
+
* List all note object hashes in a notes reference (O(1) - single git spawn)
|
|
171
|
+
*
|
|
172
|
+
* Returns only the object hashes that have notes attached, without reading
|
|
173
|
+
* any note content. Use readNote() to read individual note content when needed.
|
|
318
174
|
*
|
|
319
175
|
* @param notesRef - The notes reference
|
|
320
|
-
* @returns Array of
|
|
176
|
+
* @returns Array of tree hashes that have notes, or empty array if no notes
|
|
321
177
|
*
|
|
322
178
|
* @example
|
|
323
179
|
* ```typescript
|
|
324
|
-
* const
|
|
325
|
-
*
|
|
326
|
-
* console.log(`${treeHash}: ${content}`);
|
|
327
|
-
* }
|
|
180
|
+
* const hashes = listNoteObjects('vibe-validate/validate');
|
|
181
|
+
* console.log(`${hashes.length} notes exist`);
|
|
328
182
|
* ```
|
|
329
183
|
*/
|
|
330
|
-
export function
|
|
184
|
+
export function listNoteObjects(notesRef) {
|
|
331
185
|
validateNotesRef(notesRef);
|
|
332
|
-
// Get list of objects that have notes
|
|
333
186
|
const objectsResult = executeGitCommand(['notes', `--ref=${notesRef}`, 'list'], {
|
|
334
187
|
ignoreErrors: true,
|
|
335
188
|
suppressStderr: true,
|
|
@@ -337,19 +190,14 @@ export function listNotes(notesRef) {
|
|
|
337
190
|
if (!objectsResult.success || !objectsResult.stdout) {
|
|
338
191
|
return [];
|
|
339
192
|
}
|
|
340
|
-
const
|
|
341
|
-
// Parse "note_sha object_sha" pairs
|
|
193
|
+
const objects = [];
|
|
342
194
|
for (const line of objectsResult.stdout.split('\n')) {
|
|
343
195
|
const [, objectSha] = line.split(/\s+/);
|
|
344
196
|
if (!objectSha)
|
|
345
197
|
continue;
|
|
346
|
-
|
|
347
|
-
const content = readNote(notesRef, objectSha);
|
|
348
|
-
if (content !== null) {
|
|
349
|
-
notes.push([objectSha, content]);
|
|
350
|
-
}
|
|
198
|
+
objects.push(objectSha);
|
|
351
199
|
}
|
|
352
|
-
return
|
|
200
|
+
return objects;
|
|
353
201
|
}
|
|
354
202
|
/**
|
|
355
203
|
* Check if a note exists
|
package/dist/git-notes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-notes.js","sourceRoot":"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js';
|
|
9
|
+
export type { TreeHash, CommitSha, NotesRef, TreeHashResult } from './types.js';
|
|
10
10
|
export { getGitTreeHash, getHeadTreeHash, hasWorkingTreeChanges } from './tree-hash.js';
|
|
11
11
|
export { BranchSyncChecker, checkBranchSync, type SyncCheckResult, type SyncCheckOptions } from './branch-sync.js';
|
|
12
12
|
export { PostPRMergeCleanup, cleanupMergedBranches, type CleanupResult, type CleanupOptions } from './post-merge-cleanup.js';
|
|
@@ -14,10 +14,12 @@ export { encodeRunCacheKey } from './cache-key.js';
|
|
|
14
14
|
export { extractYamlContent, extractYamlWithPreamble } from './yaml-detection.js';
|
|
15
15
|
export { isGitRepository, getGitDir, getRepositoryRoot, getCurrentBranch, getRemoteUrl, getHeadCommitSha, getHeadTreeSha, verifyRef, verifyRefOrThrow, hasNotesRef, isMergeInProgress, 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
|
-
export { addNote, readNote, removeNote,
|
|
18
|
-
export {
|
|
17
|
+
export { addNote, readNote, removeNote, listNoteObjects, hasNote, listNotesRefs, removeNotesRefs, getNotesRefSha, mergeReplace, mergeAppendRuns, } from './git-notes.js';
|
|
18
|
+
export type { NoteMergeStrategy } from './git-notes.js';
|
|
19
|
+
export { getStagedFiles, getPartiallyStagedFiles } from './staging.js';
|
|
19
20
|
export { isCurrentBranchBehindTracking } from './tracking-branch.js';
|
|
20
21
|
export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, fetchRunJobs, listWorkflowRuns, type GitHubPullRequest, type GitHubRun, type GitHubJob } from './gh-commands.js';
|
|
21
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';
|
|
22
23
|
export type { CleanupResult as BranchCleanupResult } from './branch-cleanup.js';
|
|
24
|
+
export { initTestRepo, configTestUser, configTestSubmoduleProtocol, stageTestFiles, commitTestChanges, getTestTreeHash, getTestCommitHash, readTestNote, setupTestRepoWithCommit, registerTestSubmodule, initTestSubmodules, addTestSubmodule } from './test-helpers.js';
|
|
23
25
|
//# 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;
|
|
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,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,YAA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AAc,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
|
@@ -21,13 +21,15 @@ export { isGitRepository, getGitDir, getRepositoryRoot, getCurrentBranch, getRem
|
|
|
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
|
-
export { addNote, readNote, removeNote,
|
|
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
|
-
export { getPartiallyStagedFiles } from './staging.js';
|
|
26
|
+
export { getStagedFiles, 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
30
|
export { fetchPRDetails, fetchPRChecks, getCurrentPR, listPullRequests, fetchRunLogs, fetchRunDetails, fetchRunJobs, listWorkflowRuns } from './gh-commands.js';
|
|
31
31
|
// Branch cleanup analysis (identify safe-to-delete branches)
|
|
32
32
|
export { detectDefaultBranch, isProtectedBranch, isAutoDeleteSafe, needsReview, shouldShowBranch, gatherBranchGitFacts, setupCleanupContext, parseRemoteTracking, getUnpushedCommitCount, detectMergeMethod, fetchPRDataForBranches, enrichWithGitHubData, cleanupBranches } from './branch-cleanup.js';
|
|
33
|
+
// Test helpers (centralized git operations for test setup and verification)
|
|
34
|
+
export { initTestRepo, configTestUser, configTestSubmoduleProtocol, stageTestFiles, commitTestChanges, getTestTreeHash, getTestCommitHash, readTestNote, setupTestRepoWithCommit, registerTestSubmodule, initTestSubmodules, addTestSubmodule } from './test-helpers.js';
|
|
33
35
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,uDAAuD;AACvD,OAAO,EACL,cAAc,EACd,e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,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"}
|
|
@@ -87,7 +87,7 @@ export class PostPRMergeCleanup {
|
|
|
87
87
|
return execGitSync(['branch', '--show-current']).trim();
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
|
-
throw new Error(`Failed to get current branch: ${error}`);
|
|
90
|
+
throw new Error(`Failed to get current branch: ${error instanceof Error ? error.message : String(error)}`);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
@@ -98,7 +98,7 @@ export class PostPRMergeCleanup {
|
|
|
98
98
|
execGitSync(['checkout', this.mainBranch]);
|
|
99
99
|
}
|
|
100
100
|
catch (error) {
|
|
101
|
-
throw new Error(`Failed to switch to ${this.mainBranch} branch: ${error}`);
|
|
101
|
+
throw new Error(`Failed to switch to ${this.mainBranch} branch: ${error instanceof Error ? error.message : String(error)}`);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
@@ -112,7 +112,7 @@ export class PostPRMergeCleanup {
|
|
|
112
112
|
execGitSync(['merge', `${this.remoteName}/${this.mainBranch}`, '--ff-only']);
|
|
113
113
|
}
|
|
114
114
|
catch (error) {
|
|
115
|
-
throw new Error(`Failed to sync ${this.mainBranch} branch: ${error}`);
|
|
115
|
+
throw new Error(`Failed to sync ${this.mainBranch} branch: ${error instanceof Error ? error.message : String(error)}`);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -123,7 +123,7 @@ export class PostPRMergeCleanup {
|
|
|
123
123
|
execGitSync(['fetch', this.remoteName, '--prune']);
|
|
124
124
|
}
|
|
125
125
|
catch (error) {
|
|
126
|
-
throw new Error(`Failed to fetch remote info: ${error}`);
|
|
126
|
+
throw new Error(`Failed to fetch remote info: ${error instanceof Error ? error.message : String(error)}`);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-merge-cleanup.js","sourceRoot":"","sources":["../src/post-merge-cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,wCAAwC;AAE/D;;;GAGG;AACH,SAAS,WAAW,CAAC,IAAc;IACjC,+FAA+F;IAC/F,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE;QACpC,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KAChC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,MAAM,CAAC,KAAK,CAAC;IACrB,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,YAAY,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAgBD;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACZ,UAAU,CAAS;IACnB,UAAU,CAAS;IACnB,MAAM,CAAU;IAEjC,YAAY,UAA0B,EAAE;QACtC,IAAI,CAAC,UAAU,GAAG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AC;AAC9B,CAAC"}
|
package/dist/staging.d.ts
CHANGED
|
@@ -18,6 +18,24 @@
|
|
|
18
18
|
* - Unstage all changes: `git restore --staged <file>`
|
|
19
19
|
* - Skip validation: `git commit --no-verify` (not recommended)
|
|
20
20
|
*/
|
|
21
|
+
/**
|
|
22
|
+
* Get list of staged files (files in git index)
|
|
23
|
+
*
|
|
24
|
+
* Returns file paths relative to repository root for all files
|
|
25
|
+
* currently staged (Added, Copied, Modified, or Renamed).
|
|
26
|
+
*
|
|
27
|
+
* @param cwd - Working directory (defaults to process.cwd())
|
|
28
|
+
* @returns Array of staged file paths, empty if none or not a git repo
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const files = getStagedFiles();
|
|
33
|
+
* if (files.length > 0) {
|
|
34
|
+
* console.log('Staged files:', files);
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function getStagedFiles(cwd?: string): string[];
|
|
21
39
|
/**
|
|
22
40
|
* Get list of files with partially staged changes
|
|
23
41
|
*
|
package/dist/staging.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../src/staging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../src/staging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,EAAE,CA4BpE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CAgDlD"}
|