mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-05 09:33:07 +00:00
Fix #684: Prevent Windows reserved filename creation - Add sanitizeFilename() utility to detect and prefix Windows reserved names (NUL, CON, PRN, AUX, COM1-9, LPT1-9) - Apply sanitization to save-image route to prevent "nul" file creation - Add 23 comprehensive tests for filename sanitization edge cases Fix #576: Detect actual dev server port from output - Parse stdout/stderr for real server URLs (Vite, Next.js, generic formats) - Update server URL when detected instead of using allocated PORT - Emit dev-server:url-detected event for frontend updates - Add 6 tests for URL detection patterns Fix #193: Commit only feature-specific changes - Change from 'git add -A' to branch-aware file staging - Use git diff to find files changed on feature branch only - Prevent committing unrelated changes from other features - Maintain backward compatibility with main branch workflow All fixes include comprehensive tests and maintain backward compatibility. Test results: 1,968 tests passed (547 package + 1,421 server tests)
117 lines
2.3 KiB
TypeScript
117 lines
2.3 KiB
TypeScript
/**
|
|
* @automaker/utils
|
|
* Shared utility functions for AutoMaker
|
|
*/
|
|
|
|
// Error handling
|
|
export {
|
|
isAbortError,
|
|
isCancellationError,
|
|
isAuthenticationError,
|
|
isRateLimitError,
|
|
isQuotaExhaustedError,
|
|
extractRetryAfter,
|
|
classifyError,
|
|
getUserFriendlyErrorMessage,
|
|
getErrorMessage,
|
|
} from './error-handler.js';
|
|
|
|
// Conversation utilities
|
|
export {
|
|
extractTextFromContent,
|
|
normalizeContentBlocks,
|
|
formatHistoryAsText,
|
|
convertHistoryToMessages,
|
|
} from './conversation-utils.js';
|
|
|
|
// Image handling
|
|
export {
|
|
getMimeTypeForImage,
|
|
readImageAsBase64,
|
|
convertImagesToContentBlocks,
|
|
formatImagePathsForPrompt,
|
|
} from './image-handler.js';
|
|
|
|
// Prompt building
|
|
export {
|
|
buildPromptWithImages,
|
|
type PromptContent,
|
|
type PromptWithImages,
|
|
} from './prompt-builder.js';
|
|
|
|
// Logger
|
|
export {
|
|
createLogger,
|
|
getLogLevel,
|
|
setLogLevel,
|
|
setColorsEnabled,
|
|
setTimestampsEnabled,
|
|
LogLevel,
|
|
type Logger,
|
|
} from './logger.js';
|
|
|
|
// File system utilities
|
|
export { mkdirSafe, existsSafe } from './fs-utils.js';
|
|
|
|
// Atomic file operations
|
|
export {
|
|
atomicWriteJson,
|
|
readJsonFile,
|
|
updateJsonAtomically,
|
|
readJsonWithRecovery,
|
|
rotateBackups,
|
|
logRecoveryWarning,
|
|
DEFAULT_BACKUP_COUNT,
|
|
type AtomicWriteOptions,
|
|
type ReadJsonRecoveryResult,
|
|
type ReadJsonRecoveryOptions,
|
|
} from './atomic-writer.js';
|
|
|
|
// Path utilities
|
|
export { normalizePath, pathsEqual, sanitizeFilename } from './path-utils.js';
|
|
|
|
// Context file loading
|
|
export {
|
|
loadContextFiles,
|
|
getContextFilesSummary,
|
|
type ContextMetadata,
|
|
type ContextFileInfo,
|
|
type ContextFilesResult,
|
|
type ContextFsModule,
|
|
type LoadContextFilesOptions,
|
|
type MemoryFileInfo,
|
|
type TaskContext,
|
|
} from './context-loader.js';
|
|
|
|
// Memory loading
|
|
export {
|
|
loadRelevantMemory,
|
|
initializeMemoryFolder,
|
|
appendLearning,
|
|
recordMemoryUsage,
|
|
getMemoryDir,
|
|
parseFrontmatter,
|
|
serializeFrontmatter,
|
|
extractTerms,
|
|
calculateUsageScore,
|
|
countMatches,
|
|
incrementUsageStat,
|
|
formatLearning,
|
|
type MemoryFsModule,
|
|
type MemoryMetadata,
|
|
type MemoryFile,
|
|
type MemoryLoadResult,
|
|
type UsageStats,
|
|
type LearningEntry,
|
|
type SimpleMemoryFile,
|
|
} from './memory-loader.js';
|
|
|
|
// Debounce and throttle utilities
|
|
export {
|
|
debounce,
|
|
throttle,
|
|
type DebounceOptions,
|
|
type ThrottleOptions,
|
|
type DebouncedFunction,
|
|
} from './debounce.js';
|