Goal: Eliminate half-initialized books by making inkos book create fail-closed: foundation generation must either produce a complete book or leave no book directory behind.
Current book create is not atomic:
PipelineRunner.initBook() writes book.json before foundation generation.ArchitectAgent.parseSections() silently substitutes placeholder text when a required section is missing.This creates dirty books/<bookId>/ directories with partial files. Re-running create on the same title can then behave unpredictably.
initBook() should build the full book in a temporary directory under books/:
book.jsonOnly after all of that succeeds should the temp directory be renamed to the final books/<bookId>/.
If any step fails, the temp directory is deleted.
ArchitectAgent.parseSections() should no longer emit placeholder text like:
[book_rules 生成失败,需要重新生成]Missing required sections should throw an error immediately. This prevents malformed foundations from being persisted as if they were valid content.
CLI should no longer “resume incomplete book creation”.
If books/<bookId>/ exists:
book create should fail with “already exists”This keeps the behavior simple:
In scope:
book createPipelineRunner.initBook()Out of scope:
initFanficBook() atomic stagingAdd regressions for:
ArchitectAgent throws when a required section is missing.PipelineRunner.initBook() leaves no final book directory when foundation generation fails.book create removes stale incomplete directories and does not keep a dirty directory when create fails downstream.