MCPcopy
hub / github.com/Narcooo/inkos / getNextChapterNumber

Method getNextChapterNumber

packages/core/src/state/manager.ts:234–246  ·  view source on GitHub ↗
(bookId: string)

Source from the content-addressed store, hash-verified

232 }
233
234 async getNextChapterNumber(bookId: string): Promise<number> {
235 const durableChapter = await resolveDurableStoryProgress({
236 bookDir: this.bookDir(bookId),
237 });
238 // Ensure structured state is bootstrapped (side-effect: creates missing
239 // JSON files), but do NOT trust its chapter number for progress — only
240 // the contiguous durable artifact chain is authoritative.
241 await bootstrapStructuredStateFromMarkdown({
242 bookDir: this.bookDir(bookId),
243 fallbackChapter: durableChapter,
244 });
245 return durableChapter + 1;
246 }
247
248 async getPersistedChapterCount(bookId: string): Promise<number> {
249 const chaptersDir = join(this.bookDir(bookId), "chapters");

Callers 14

createStudioServerFunction · 0.95
writeDraftMethod · 0.45
planChapterMethod · 0.45
composeChapterMethod · 0.45
auditDraftMethod · 0.45
reviseDraftMethod · 0.45
getBookStatusMethod · 0.45
book.tsFile · 0.45
detect.tsFile · 0.45
write.tsFile · 0.45

Calls 3

bookDirMethod · 0.95

Tested by

no test coverage detected