fix: ensure chapters/ and story/ subdirectories are created before writing files (fixes Windows ENOENT)#42
Open
y-chell wants to merge 1 commit intoNarcooo:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
inkos write nextandinkos draftfail withENOENT: no such file or directorybecause thechapters/andstory/subdirectories under a book's directory are not created before writing files.inkos book createonly creates the book root directory andbook.json. The subdirectories are expected to exist when the writer agent tries to save chapter content and truth files.Related issue: #41
Root Cause
In
packages/core/src/agents/writer.ts, thesaveChaptermethod createschapters/withmkdir({ recursive: true })but does not createstory/before writingcurrent_state.md,particle_ledger.md, andpending_hooks.md.In
packages/core/src/pipeline/runner.ts, there are two additional code paths inrunWriteChapterthat write tostoryDirandchaptersDirwithout ensuring the directories exist first.Fix
packages/core/src/agents/writer.ts: addawait mkdir(storyDir, { recursive: true })insaveChapterpackages/core/src/pipeline/runner.ts: addawait mkdir(storyDir, { recursive: true })in two revise paths, addawait mkdir(chaptersDir, { recursive: true })in the final chapter save pathTesting
Verified on Windows 11 Pro (Node.js v24.12.0, inkos 0.4.5):
inkos write nextfails with ENOENT after LLM generates chapter contentwrite nextpipeline completes successfully including auditCloses #41