架构
Ideon 采用模块化 CLI 流水线架构,支持生成目录输出与阶段产物可恢复。
高层执行流程
- 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
模块边界
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
阶段契约
每个阶段都包含:
idtitlestatusdetail- optional
summary
该契约同时驱动 Ink UI 与纯文本渲染输出。
输出模型
每次运行会写入一个生成目录:
- 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
预览与删除操作都基于该生成结构执行。
预览子系统
预览由两层协作组成:
src/server/previewServer.ts(Express server)src/preview-app/*(React SPA)
服务端负责:
- 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
React 应用负责:
- generation navigation and output variant switching
- channel-specific markdown presentation
- interaction inspection (
Prompt / ResponseandFull JSONmodes) - light/dark theme UX and persisted theme preference
构建路径:
- 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
错误边界策略
- 阶段失败会被局部化并清晰展示
- 已处理的 CLI 错误避免重复堆栈输出
- 未知失败仍返回非零退出码