Extracted 5 helper functions from the monolithic runCook function: - parseCookFlags: Parse and validate command-line flags (~40 lines) - loadAndResolveFormula: Parse, resolve, apply transformations (~60 lines) - outputCookDryRun: Display dry-run preview (~60 lines) - outputCookEphemeral: Output resolved formula as JSON (~30 lines) - persistCookFormula: Create proto bead in database (~45 lines) Main runCook function reduced from ~275 to ~65 lines with clear flow: 1. Parse flags → 2. Validate store → 3. Load formula 4. Extract metadata → 5. Handle mode (dry-run/ephemeral/persist) Benefits: - Each helper is single-responsibility and testable - Added cookFlags struct for type-safe flag passing - Error handling uses proper error returns instead of os.Exit - Clear separation of concerns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 KiB
29 KiB