Files
claude-task-master/packages
Ralph Khreish 3178c3aeac refactor: migrate git-utils to TypeScript in tm-core
Move git utilities from scripts/modules/utils/git-utils.js to packages/tm-core/src/utils/git-utils.ts for better type safety and reusability.

## Changes

**New File**: `packages/tm-core/src/utils/git-utils.ts`
- Converted from JavaScript to TypeScript with full type annotations
- Added `GitHubRepoInfo` interface for type safety
- Includes all essential git functions needed for Phase 1:
  - `isGitRepository`, `isGitRepositorySync`
  - `getCurrentBranch`, `getCurrentBranchSync`
  - `getLocalBranches`, `getRemoteBranches`
  - `isGhCliAvailable`, `getGitHubRepoInfo`
  - `getDefaultBranch`, `isOnDefaultBranch`
  - `sanitizeBranchNameForTag`, `isValidBranchForTag`

**Updated Files**:
- `preflight-checker.service.ts`: Now imports from local git-utils
- `packages/tm-core/src/utils/index.ts`: Exports git utilities

## Rationale

Phase 1 will need git operations for:
- Creating feature branches (WorkflowOrchestrator)
- Checking git status before execution
- Validating clean working tree
- Branch naming validation

Having these utilities in tm-core provides:
- Type safety (no more `require()` hacks)
- Better testability
- Cleaner imports
- Reusability across services

## Verification

 All tests pass (1298 passed, 121 test suites)
 Typecheck passes (5/5 successful)
 Build successful

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 16:46:34 +02:00
..