mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
Resolves merge conflicts: - apps/server/src/routes/terminal/common.ts: Keep randomBytes import, use @automaker/utils for createLogger - apps/ui/eslint.config.mjs: Use main's explicit globals list with XMLHttpRequest and MediaQueryListEvent additions - apps/ui/src/components/views/terminal-view.tsx: Keep our terminal improvements (killAllSessions, beforeunload, better error handling) - apps/ui/src/config/terminal-themes.ts: Keep our search highlight colors for all themes - apps/ui/src/store/app-store.ts: Keep our terminal settings persistence improvements (merge function) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 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);
|
|
};
|
|
}
|