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

Function getFileStatuses

packages/bumpy/src/core/git.ts:197–215  ·  view source on GitHub ↗
(
  dir: string,
  opts?: { cwd?: string },
)

Source from the content-addressed store, hash-verified

195
196/** Get the git status of files in a directory (staged, unstaged, untracked) */
197export function getFileStatuses(
198 dir: string,
199 opts?: { cwd?: string },
200): Map<string, 'committed' | 'staged' | 'untracked'> {
201 const statuses = new Map<string, 'committed' | 'staged' | 'untracked'>();
202 const result = tryRunArgs(['git', 'status', '--porcelain', '--', dir], opts);
203 if (!result) return statuses;
204 for (const line of result.split('\n')) {
205 if (!line.trim()) continue;
206 const indexStatus = line[0]!;
207 const file = line.slice(3);
208 if (indexStatus === '?') {
209 statuses.set(file, 'untracked');
210 } else {
211 statuses.set(file, 'staged');
212 }
213 }
214 return statuses;
215}
216
217/** Get all tags matching a pattern */
218export function listTags(pattern: string, opts?: { cwd?: string }): string[] {

Callers 1

checkCommandFunction · 0.90

Calls 1

tryRunArgsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…