Architecture
Ideon is organized as a modular CLI pipeline with generation-directory outputs and resumable stage artifacts.
High-Level Execution
- Resolve config and secrets
- Build generation directory and run metadata (
job.json) - Conditionally run article planning + section writing
- Conditionally expand image prompts + render assets
- Write one or more output markdown files + analytics
Module Boundaries
src/bin: executable entrypointsrc/cli: command layer and renderingsrc/config: schema, env parsing, merging, persistencesrc/pipeline: orchestration and stage statesrc/generation: article planning/writing + non-article single-shot generationsrc/llm: OpenRouter client and prompt builderssrc/images: Replicate client + image pipelinesrc/models/t2i: model registry + override coercionsrc/output: markdown and filesystem utilitiessrc/server: local preview server, generation discovery helpers, API routessrc/preview-app: React + Ant Design preview client (Vite-built static app)src/types: domain and validation schemas
Stage Contract
Each stage carries:
idtitlestatusdetail- optional
summary
This contract drives both Ink UI and plain text renderer output.
Output Model
Each run writes a generation directory:
- numbered markdown outputs (
article-1.md,x-thread-1.md,x-post-1.md, etc.) job.jsonwith resolved run definition metadatageneration.analytics.json- shared assets for that generation
Preview and delete operations work against this generation structure.
Preview Subsystem
Preview is split into two cooperating layers:
src/server/previewServer.ts(Express server)src/preview-app/*(React SPA)
The server is responsible for:
- generation discovery and initial selection
- API endpoints for bootstrap, list, and article detail payloads
- generation-scoped asset serving
- serving static client files from
dist/preview - graceful fallback HTML shell when client build is unavailable
The React app is responsible for:
- generation navigation and output variant switching
- channel-specific markdown presentation
- interaction inspection (
Prompt / ResponseandFull JSONmodes) - light/dark theme UX and persisted theme preference
Build path:
- Vite builds
src/preview-appintodist/preview npm run buildincludesnpm run build:previewideon previewlaunches the preview server and appnpm run preview(repo convenience script) builds preview client first, then launchesideon preview
Error Boundary Strategy
- Stage failures are localized and clearly surfaced
- Handled CLI errors avoid redundant stack traces
- Unknown failures still return non-zero exit codes