feat: add @automaker/git-utils package

ELIMINATES routes/common.ts: Extract all git operations (382 lines) into dedicated package.

- Extract git status parsing (parseGitStatus, isGitRepo)
- Extract diff generation (generateSyntheticDiffForNewFile, etc.)
- Extract repository analysis (getGitRepositoryDiffs)
- Handle both git repos and non-git directories
- Support binary file detection
- Generate synthetic diffs for untracked files

Split into logical modules:
- types.ts: Constants and interfaces
- status.ts: Git status operations
- diff.ts: Diff generation utilities

This package will replace:
- apps/server/src/routes/common.ts (to be deleted)

Dependencies: @automaker/types, @automaker/utils

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Kacper
2025-12-19 23:31:08 +01:00
parent 8b31039557
commit 6f4269aacd
6 changed files with 445 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/**
* @automaker/git-utils
* Git operations utilities for AutoMaker
*/
// Export types and constants
export {
BINARY_EXTENSIONS,
GIT_STATUS_MAP,
type FileStatus,
} from './types';
// Export status utilities
export {
isGitRepo,
parseGitStatus,
} from './status';
// Export diff utilities
export {
generateSyntheticDiffForNewFile,
appendUntrackedFileDiffs,
listAllFilesInDirectory,
generateDiffsForNonGitDirectory,
getGitRepositoryDiffs,
} from './diff';