From ed76a9c8dfce50e932a0141618a163fad338041d Mon Sep 17 00:00:00 2001 From: nichinichisou Date: Wed, 14 Oct 2026 19:16:13 +0800 Subject: [PATCH 1/3] feat(story-author): report fixes for script problems, and pace each line A script's problems now say how to fix them, not only what is wrong, and the renderer reports how long each line takes. Every problem whose fix is known carries it as JSON Patch operations on the script document: an unknown key is renamed to the nearest key of the format (when the object does not hold that key already), an unknown name is replaced by the nearest one the site has, a repeated beat id takes the first free suffix, and two characters on one position put the later one on the nearest free position. `--fix ` on `check` and `render` writes the script with those fixes applied (later beats first, so the beats a fix adds do not move the ones after it) and checks the written script again, reporting which fixes went in and where the fixed script stands. A line that overflows the talk window is measured in the browser, laid out again with TextMeshPro's word wrapping (the breaks the game's text engine takes, CJK line breaking rules included), and comes with a fix that breaks the text where the game breaks it and, where the window holds fewer lines, spreads it over beats of the same speaker after it. `render` frames also carry the line's pacing in story seconds: the characters the typewriter types, the time until its text is fully shown, and the hold auto mode adds from the base story's talk timings. Co-Authored-By: Claude Opus 5.5 --- docs/story-author.md | 64 ++++++++-- scripts/lib/story-author/page.js | 51 +++++++- scripts/lib/story-author/script.js | 193 ++++++++++++++++++++++++++--- scripts/story-author.mjs | 61 ++++++--- tests/unit/story-author.test.mjs | 133 +++++++++++++++++++- 5 files changed, 452 insertions(+), 50 deletions(-) diff --git a/docs/story-author.md b/docs/story-author.md index e9d464a..01b375a 100644 --- a/docs/story-author.md +++ b/docs/story-author.md @@ -33,6 +33,7 @@ node scripts/story-author.mjs new stories/10002.json $S > story.json # 4. a st node scripts/story-author.mjs check story.json $S # 5. errors and warnings with JSON pointers node scripts/story-author.mjs render story.json $S --out shots # 6. one picture per line, and a contact sheet # look at shots/sheet.png (and shots/line-*.png), fix, repeat 5-6 +# (--fix on check and render writes the script with the fixes the tool knows applied) node scripts/story-author.mjs build story.json $S --name my-story # 7. into the site node scripts/story-author.mjs serve $S # 8. URLs to watch it in examples/story ``` @@ -98,15 +99,16 @@ stage, three lines). Redirect it to a file and edit it. ### check -`check