MCPcopy Index your code
hub / github.com/dmno-dev/bumpy / getBumpFileCreationOrder

Function getBumpFileCreationOrder

packages/bumpy/src/core/bump-file.ts:95–124  ·  view source on GitHub ↗

* Use `git log` to get the commit timestamp when each bump file was first added. * Returns a map of bump file ID → unix timestamp (seconds).

(rootDir: string)

Source from the content-addressed store, hash-verified

93 * Returns a map of bump file ID → unix timestamp (seconds).
94 */
95function getBumpFileCreationOrder(rootDir: string): Map<string, number> {
96 const order = new Map<string, number>();
97
98 // git log with --diff-filter=A shows only commits that added files
99 // --format="%at" gives unix timestamp, --name-only lists files
100 const result = tryRunArgs(['git', 'log', '--diff-filter=A', '--format=%at', '--name-only', '--', '.bumpy/*.md'], {
101 cwd: rootDir,
102 });
103 if (!result) return order;
104
105 // Output format: timestamp line, then filename lines, then blank line, repeat
106 let currentTimestamp = 0;
107 for (const line of result.split('\n')) {
108 const trimmed = line.trim();
109 if (!trimmed) continue;
110 if (/^\d+$/.test(trimmed)) {
111 currentTimestamp = parseInt(trimmed, 10);
112 } else if (trimmed.startsWith('.bumpy/') && trimmed.endsWith('.md')) {
113 // Use the basename as the ID — bump files keep their ID when moved into
114 // a channel subdir, and the move shows up as a new "A" entry, so taking
115 // the oldest timestamp below preserves the original creation order.
116 const id = fileToId(trimmed);
117 // Only record the first (oldest) commit — git log is newest-first,
118 // so later entries overwrite with earlier timestamps
119 order.set(id, currentTimestamp);
120 }
121 }
122
123 return order;
124}
125
126/** Parse a single bump file from disk */
127export async function parseBumpFileFromPath(filePath: string): Promise<BumpFileParseResult> {

Callers 1

readBumpFilesFunction · 0.85

Calls 2

tryRunArgsFunction · 0.90
fileToIdFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…