mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
COMPLETED MIGRATIONS: - Migrate git utilities from routes/common.ts (383 lines → 39 lines) - Replace duplicated code with imports from @automaker/git-utils - Keep only route-specific utilities (getErrorMessage, createLogError) - All git operations now use shared package consistently - Remove duplicate model constants in UI - Update model-config.ts to import from @automaker/types - Update agent-context-parser.ts to use DEFAULT_MODELS.claude - Removed 40+ lines of duplicated code DEFERRED (Server-Specific): - enhancement-prompts.ts (456 lines) - Server-only, no UI usage - app-spec-format.ts (318 lines) - Server-only, no UI usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
39 lines
941 B
TypeScript
39 lines
941 B
TypeScript
/**
|
|
* Common utilities shared across all route modules
|
|
*/
|
|
|
|
import { createLogger } from "@automaker/utils";
|
|
|
|
// Re-export git utilities from shared package
|
|
export {
|
|
BINARY_EXTENSIONS,
|
|
GIT_STATUS_MAP,
|
|
type FileStatus,
|
|
isGitRepo,
|
|
parseGitStatus,
|
|
generateSyntheticDiffForNewFile,
|
|
appendUntrackedFileDiffs,
|
|
listAllFilesInDirectory,
|
|
generateDiffsForNonGitDirectory,
|
|
getGitRepositoryDiffs,
|
|
} from "@automaker/git-utils";
|
|
|
|
type Logger = ReturnType<typeof createLogger>;
|
|
|
|
/**
|
|
* Get error message from error object
|
|
*/
|
|
export function getErrorMessage(error: unknown): string {
|
|
return error instanceof Error ? error.message : "Unknown error";
|
|
}
|
|
|
|
/**
|
|
* Create a logError function for a specific logger
|
|
* This ensures consistent error logging format across all routes
|
|
*/
|
|
export function createLogError(logger: Logger) {
|
|
return (error: unknown, context: string): void => {
|
|
logger.error(`❌ ${context}:`, error);
|
|
};
|
|
}
|