feat: add @automaker/utils package

- Extract error handling utilities (isAbortError, classifyError, etc.)
- Extract conversation utilities (formatHistoryAsText, etc.)
- Extract image handling utilities (readImageAsBase64, etc.)
- Extract prompt building utilities (buildPromptWithImages)
- Extract logger utilities (createLogger, setLogLevel)
- Extract file system utilities (mkdirSafe, existsSafe)

All utilities now use @automaker/types for type imports.
Provides shared utility functions for both server and UI.

Dependencies: @automaker/types

🤖 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:30:24 +01:00
parent b149607747
commit f4b95ea5bf
9 changed files with 632 additions and 0 deletions

50
libs/utils/src/index.ts Normal file
View File

@@ -0,0 +1,50 @@
/**
* @automaker/utils
* Shared utility functions for AutoMaker
*/
// Error handling
export {
isAbortError,
isCancellationError,
isAuthenticationError,
classifyError,
getUserFriendlyErrorMessage,
} from './error-handler';
// Conversation utilities
export {
extractTextFromContent,
normalizeContentBlocks,
formatHistoryAsText,
convertHistoryToMessages,
} from './conversation-utils';
// Image handling
export {
getMimeTypeForImage,
readImageAsBase64,
convertImagesToContentBlocks,
formatImagePathsForPrompt,
} from './image-handler';
// Prompt building
export {
buildPromptWithImages,
type PromptContent,
type PromptWithImages,
} from './prompt-builder';
// Logger
export {
createLogger,
getLogLevel,
setLogLevel,
LogLevel,
} from './logger';
// File system utilities
export {
mkdirSafe,
existsSafe,
} from './fs-utils';