@oh-story/dsh 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (524) hide show
  1. package/README.md +58 -12
  2. package/lib/client.js +2970 -537
  3. package/lib/client.js.map +4 -4
  4. package/lib/drama/manifest.json +218 -178
  5. package/lib/drama/skills/short-drama/SKILL.md +110 -117
  6. package/lib/drama/skills/short-drama/references/audience-reveal.md +14 -67
  7. package/lib/drama/skills/short-drama/references/contract-and-ownership.md +26 -77
  8. package/lib/drama/skills/short-drama/references/creator-documents.md +204 -0
  9. package/lib/drama/skills/short-drama/references/creator-workflow.md +73 -63
  10. package/lib/drama/skills/short-drama/references/knowhow-index.md +5 -0
  11. package/lib/drama/skills/short-drama/references/look-development.md +2 -3
  12. package/lib/drama/skills/short-drama/references/pickup-and-alternate.md +14 -48
  13. package/lib/drama/skills/short-drama/references/production-form-profiles.md +1 -1
  14. package/lib/drama/skills/short-drama/references/reference-roles.md +32 -135
  15. package/lib/drama/skills/short-drama/references/runtime-preflight.md +16 -19
  16. package/lib/drama/skills/short-drama/scripts/creator_markdown_check.py +1002 -0
  17. package/lib/drama/skills/short-drama/scripts/project_tool.py +485 -5
  18. package/lib/drama/skills/short-drama-assets/SKILL.md +59 -170
  19. package/lib/drama/skills/short-drama-assets/references/asset-review-checklist.md +18 -25
  20. package/lib/drama/skills/short-drama-assets/references/character-and-look.md +13 -15
  21. package/lib/drama/skills/short-drama-assets/references/continuity-delta.md +11 -14
  22. package/lib/drama/skills/short-drama-assets/references/continuity-lock.md +116 -0
  23. package/lib/drama/skills/short-drama-assets/references/identity-vs-variant.md +6 -12
  24. package/lib/drama/skills/short-drama-assets/references/occurrence-extraction.md +8 -11
  25. package/lib/drama/skills/short-drama-assets/references/prop-and-state.md +21 -2
  26. package/lib/drama/skills/short-drama-assets/references/stage-contract.md +12 -105
  27. package/lib/drama/skills/short-drama-assets/references/voice-direction.md +12 -32
  28. package/lib/drama/skills/short-drama-assets/scripts/asset_check.py +1 -1
  29. package/lib/drama/skills/short-drama-image-prompts/SKILL.md +45 -155
  30. package/lib/drama/skills/short-drama-image-prompts/references/character-and-look.md +12 -13
  31. package/lib/drama/skills/short-drama-image-prompts/references/common-recipe.md +12 -13
  32. package/lib/drama/skills/short-drama-image-prompts/references/edit-and-revision.md +39 -51
  33. package/lib/drama/skills/short-drama-image-prompts/references/location-plate.md +3 -4
  34. package/lib/drama/skills/short-drama-image-prompts/references/look-and-state-variant.md +15 -14
  35. package/lib/drama/skills/short-drama-image-prompts/references/lookdev-frame.md +11 -15
  36. package/lib/drama/skills/short-drama-image-prompts/references/production-sheet-recipes.md +1 -1
  37. package/lib/drama/skills/short-drama-image-prompts/references/prop-plate.md +4 -7
  38. package/lib/drama/skills/short-drama-image-prompts/references/review-and-fixtures.md +23 -23
  39. package/lib/drama/skills/short-drama-image-prompts/references/stage-contract.md +8 -65
  40. package/lib/drama/skills/short-drama-image-prompts/scripts/image_prompt_check.py +8 -8
  41. package/lib/drama/skills/short-drama-image-prompts/scripts/selftest.py +4 -2
  42. package/lib/drama/skills/short-drama-produce/SKILL.md +67 -15
  43. package/lib/drama/skills/short-drama-produce/references/adapter-contract.md +65 -8
  44. package/lib/drama/skills/short-drama-produce/references/providers/minimax-h3-video.md +85 -0
  45. package/lib/drama/skills/short-drama-produce/references/providers/seedance.md +27 -10
  46. package/lib/drama/skills/short-drama-produce/scripts/production_tool.py +362 -3
  47. package/lib/drama/skills/short-drama-produce/scripts/provider_adapters.py +627 -40
  48. package/lib/drama/skills/short-drama-produce/scripts/selftest.py +5 -4
  49. package/lib/drama/skills/short-drama-review/SKILL.md +61 -123
  50. package/lib/drama/skills/short-drama-review/references/anti-template-repair.md +10 -15
  51. package/lib/drama/skills/short-drama-review/references/production-quality-gates.md +15 -16
  52. package/lib/drama/skills/short-drama-review/references/project-calibration.md +7 -9
  53. package/lib/drama/skills/short-drama-review/references/review-method.md +8 -9
  54. package/lib/drama/skills/short-drama-review/references/rubric-assets-prompts.md +9 -13
  55. package/lib/drama/skills/short-drama-review/references/rubric-story-script.md +104 -4
  56. package/lib/drama/skills/short-drama-review/references/rubric-visual-motion.md +27 -19
  57. package/lib/drama/skills/short-drama-review/references/stage-contract.md +4 -63
  58. package/lib/drama/skills/short-drama-review/scripts/review_check.py +1 -1
  59. package/lib/drama/skills/short-drama-storyboard/SKILL.md +116 -238
  60. package/lib/drama/skills/short-drama-storyboard/assets/shot-template.jsonl +1 -1
  61. package/lib/drama/skills/short-drama-storyboard/references/blocking-playbooks.md +9 -34
  62. package/lib/drama/skills/short-drama-storyboard/references/comic-keyframe-lexicon.md +156 -0
  63. package/lib/drama/skills/short-drama-storyboard/references/coverage-audition.md +5 -10
  64. package/lib/drama/skills/short-drama-storyboard/references/keyframe-craft.md +12 -7
  65. package/lib/drama/skills/short-drama-storyboard/references/production-shot-grammar.md +19 -4
  66. package/lib/drama/skills/short-drama-storyboard/references/review-and-fixtures.md +27 -62
  67. package/lib/drama/skills/short-drama-storyboard/references/scene-visual-plan.md +16 -25
  68. package/lib/drama/skills/short-drama-storyboard/references/screenplay-to-keyframe-example.md +21 -23
  69. package/lib/drama/skills/short-drama-storyboard/references/shot-craft.md +8 -10
  70. package/lib/drama/skills/short-drama-storyboard/references/shot-revision-identity.md +9 -13
  71. package/lib/drama/skills/short-drama-storyboard/references/stage-contract.md +16 -71
  72. package/lib/drama/skills/short-drama-storyboard/scripts/storyboard_check.py +1 -1
  73. package/lib/drama/skills/short-drama-video-prompts/SKILL.md +123 -230
  74. package/lib/drama/skills/short-drama-video-prompts/assets/motion-spec.jsonl.md +6 -1
  75. package/lib/drama/skills/short-drama-video-prompts/assets/video-prompts.md +17 -1
  76. package/lib/drama/skills/short-drama-video-prompts/references/camera-audio-continuity.md +10 -8
  77. package/lib/drama/skills/short-drama-video-prompts/references/delivery-profile.md +24 -6
  78. package/lib/drama/skills/short-drama-video-prompts/references/generability.md +2 -2
  79. package/lib/drama/skills/short-drama-video-prompts/references/minimax-h3.md +154 -0
  80. package/lib/drama/skills/short-drama-video-prompts/references/motion-recipe.md +35 -27
  81. package/lib/drama/skills/short-drama-video-prompts/references/performance-action-timing.md +8 -11
  82. package/lib/drama/skills/short-drama-video-prompts/references/production-prompt-grammar.md +13 -10
  83. package/lib/drama/skills/short-drama-video-prompts/references/review-and-fixtures.md +34 -63
  84. package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.0.md +41 -0
  85. package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.5.md +66 -0
  86. package/lib/drama/skills/short-drama-video-prompts/references/stage-contract.md +17 -73
  87. package/lib/drama/skills/short-drama-video-prompts/references/target-model-profile.md +115 -0
  88. package/lib/drama/skills/short-drama-video-prompts/scripts/container_check.py +1 -1
  89. package/lib/drama/skills/short-drama-video-prompts/scripts/music_spec_check.py +1 -1
  90. package/lib/drama/skills/short-drama-write/SKILL.md +74 -268
  91. package/lib/drama/skills/short-drama-write/references/dialogue-craft.md +7 -0
  92. package/lib/drama/skills/short-drama-write/references/scene-handoff-capsule.md +17 -43
  93. package/lib/drama/skills/short-drama-write/references/screenplay-format.md +15 -15
  94. package/lib/drama/skills/short-drama-write/references/script-craft.md +208 -21
  95. package/lib/drama/skills/short-drama-write/references/stage-contract.md +11 -70
  96. package/lib/drama/skills/short-drama-write/scripts/duration_estimate.py +1 -1
  97. package/lib/drama/skills/short-drama-write/scripts/screenplay_index.py +2 -2
  98. package/lib/drama/skills/short-drama-write/scripts/voice_sheet_check.py +1 -1
  99. package/lib/index.js +971 -46
  100. package/lib/index.js.map +4 -4
  101. package/lib/novel-to-game/LICENSE +21 -0
  102. package/lib/novel-to-game/README.md +180 -0
  103. package/lib/novel-to-game/README_ZH.md +178 -0
  104. package/lib/novel-to-game/VERSION +1 -0
  105. package/lib/novel-to-game/examples/jin-ping-mei/build/BUILD_BRIEF.md +217 -0
  106. package/lib/novel-to-game/examples/jin-ping-mei/build/app/.vercelignore +3 -0
  107. package/lib/novel-to-game/examples/jin-ping-mei/build/app/RUN.md +130 -0
  108. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/bg/compound_new_guofeng.webp +0 -0
  109. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/fate_coda.webp +0 -0
  110. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/meng.webp +0 -0
  111. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pan.webp +0 -0
  112. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pinger.webp +0 -0
  113. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/xuee.webp +0 -0
  114. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/yue.webp +0 -0
  115. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_accord_five.webp +0 -0
  116. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_afterglow_five.webp +0 -0
  117. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_alliance.webp +0 -0
  118. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day10.webp +0 -0
  119. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day15.webp +0 -0
  120. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day5.webp +0 -0
  121. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/title_new_guofeng.webp +0 -0
  122. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_pinger.webp +0 -0
  123. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_xuee.webp +0 -0
  124. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_meng.webp +0 -0
  125. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pan.webp +0 -0
  126. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pinger.webp +0 -0
  127. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/explicit.webp +0 -0
  128. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/prelude.webp +0 -0
  129. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/meng.webp +0 -0
  130. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pan.webp +0 -0
  131. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pinger.webp +0 -0
  132. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/xuee.webp +0 -0
  133. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/yue.webp +0 -0
  134. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/explicit.webp +0 -0
  135. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/prelude.webp +0 -0
  136. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/explicit.webp +0 -0
  137. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/prelude.webp +0 -0
  138. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/explicit.webp +0 -0
  139. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/prelude.webp +0 -0
  140. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/explicit.webp +0 -0
  141. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/prelude.webp +0 -0
  142. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/meng/night.webp +0 -0
  143. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pan/night.webp +0 -0
  144. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pinger/night.webp +0 -0
  145. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/xuee/night.webp +0 -0
  146. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/yue/night.webp +0 -0
  147. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/household/li_jiaoer.webp +0 -0
  148. package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/scene/gate_collector.webp +0 -0
  149. package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/new-guofeng.css +1105 -0
  150. package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/style.css +2539 -0
  151. package/lib/novel-to-game/examples/jin-ping-mei/build/app/index.html +18 -0
  152. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/assets.js +147 -0
  153. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/audio.js +332 -0
  154. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/data.js +7472 -0
  155. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/engine.js +13077 -0
  156. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/main.js +3028 -0
  157. package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/text.js +32 -0
  158. package/lib/novel-to-game/examples/jin-ping-mei/build/app/package.json +10 -0
  159. package/lib/novel-to-game/examples/jin-ping-mei/build/app/vercel.json +23 -0
  160. package/lib/novel-to-game/examples/jin-ping-mei/build/art/generated-art.json +161 -0
  161. package/lib/novel-to-game/examples/jin-ping-mei/example.json +12 -0
  162. package/lib/novel-to-game/examples/jin-ping-mei/qa/README.md +31 -0
  163. package/lib/novel-to-game/examples/jin-ping-mei/qa/playable-model.json +99 -0
  164. package/lib/novel-to-game/examples/jin-ping-mei/qa/verification.json +41 -0
  165. package/lib/novel-to-game/examples/jin-ping-mei/qa/verify_playable_model.mjs +129 -0
  166. package/lib/novel-to-game/manifest.json +508 -0
  167. package/lib/novel-to-game/skills/game-art-direction/SKILL.md +73 -0
  168. package/lib/novel-to-game/skills/game-art-direction/agents/openai.yaml +4 -0
  169. package/lib/novel-to-game/skills/game-art-direction/references/art-direction-method.md +119 -0
  170. package/lib/novel-to-game/skills/game-build/SKILL.md +84 -0
  171. package/lib/novel-to-game/skills/game-build/agents/openai.yaml +4 -0
  172. package/lib/novel-to-game/skills/game-build/references/build-brief-contract.md +109 -0
  173. package/lib/novel-to-game/skills/game-build/references/generative-media-pipeline.md +56 -0
  174. package/lib/novel-to-game/skills/game-build/references/playable-model-contract.md +81 -0
  175. package/lib/novel-to-game/skills/game-build/references/tts-production-contract.md +37 -0
  176. package/lib/novel-to-game/skills/game-concept/SKILL.md +72 -0
  177. package/lib/novel-to-game/skills/game-concept/agents/openai.yaml +4 -0
  178. package/lib/novel-to-game/skills/game-concept/references/concept-method.md +94 -0
  179. package/lib/novel-to-game/skills/game-qa/SKILL.md +50 -0
  180. package/lib/novel-to-game/skills/game-qa/agents/openai.yaml +4 -0
  181. package/lib/novel-to-game/skills/game-qa/references/qa-contract.md +66 -0
  182. package/lib/novel-to-game/skills/game-qa/references/test-design-method.md +45 -0
  183. package/lib/novel-to-game/skills/game-world-design/SKILL.md +63 -0
  184. package/lib/novel-to-game/skills/game-world-design/agents/openai.yaml +4 -0
  185. package/lib/novel-to-game/skills/game-world-design/references/dialogue-design-method.md +59 -0
  186. package/lib/novel-to-game/skills/game-world-design/references/game-writing-craft.md +53 -0
  187. package/lib/novel-to-game/skills/game-world-design/references/narrative-design-method.md +84 -0
  188. package/lib/novel-to-game/skills/game-world-design/references/numeric-design-method.md +56 -0
  189. package/lib/novel-to-game/skills/game-world-design/references/world-design-method.md +124 -0
  190. package/lib/novel-to-game/skills/novel-game-analyze/SKILL.md +77 -0
  191. package/lib/novel-to-game/skills/novel-game-analyze/agents/openai.yaml +4 -0
  192. package/lib/novel-to-game/skills/novel-game-analyze/references/gameability-protocol.md +65 -0
  193. package/lib/novel-to-game/skills/novel-to-game/SKILL.md +71 -0
  194. package/lib/novel-to-game/skills/novel-to-game/agents/openai.yaml +4 -0
  195. package/lib/novel-to-game/skills/novel-to-game/references/intake-benchmark-reference.md +42 -0
  196. package/lib/novel-to-game/skills/novel-to-game/references/intake-method.md +51 -0
  197. package/lib/novel-to-game/skills/novel-to-game/references/pipeline-contract.md +65 -0
  198. package/lib/oh-story/manifest.json +419 -309
  199. package/lib/oh-story/roles/character-designer.md +4 -4
  200. package/lib/oh-story/roles/consistency-checker.md +1 -1
  201. package/lib/oh-story/roles/narrative-writer.md +41 -42
  202. package/lib/oh-story/roles/story-architect.md +19 -23
  203. package/lib/oh-story/roles/story-explorer.md +8 -5
  204. package/lib/oh-story/skills/browser-cdp/SKILL.md +1 -1
  205. package/lib/oh-story/skills/story/SKILL.md +16 -9
  206. package/lib/oh-story/skills/story/VERSION +1 -1
  207. package/lib/oh-story/skills/story/references/author-memory.md +163 -0
  208. package/lib/oh-story/skills/story/scripts/author_memory_commit.py +871 -0
  209. package/lib/oh-story/skills/story-cover/SKILL.md +1 -1
  210. package/lib/oh-story/skills/story-deslop/SKILL.md +10 -5
  211. package/lib/oh-story/skills/story-deslop/references/anti-ai-writing.md +2 -1
  212. package/lib/oh-story/skills/story-deslop/references/author-memory.md +163 -0
  213. package/lib/oh-story/skills/story-deslop/references/banned-words.md +6 -4
  214. package/lib/oh-story/skills/story-deslop/scripts/author_memory_commit.py +871 -0
  215. package/lib/oh-story/skills/story-deslop/scripts/check-ai-patterns.js +64 -1
  216. package/lib/oh-story/skills/story-import/SKILL.md +21 -8
  217. package/lib/oh-story/skills/story-import/references/format-and-structure.md +9 -10
  218. package/lib/oh-story/skills/story-import/references/structure-mapping-long.md +2 -2
  219. package/lib/oh-story/skills/story-import/references/structure-mapping-short.md +1 -1
  220. package/lib/oh-story/skills/story-import/references/tracking-transaction.md +14 -6
  221. package/lib/oh-story/skills/story-import/scripts/check-outline-contract.js +251 -0
  222. package/lib/oh-story/skills/story-import/scripts/tracking_commit.py +98 -9
  223. package/lib/oh-story/skills/story-import/scripts/wordcount_core.py +246 -0
  224. package/lib/oh-story/skills/story-long-analyze/SKILL.md +4 -4
  225. package/lib/oh-story/skills/story-long-scan/SKILL.md +1 -1
  226. package/lib/oh-story/skills/story-long-write/SKILL.md +35 -21
  227. package/lib/oh-story/skills/story-long-write/references/anti-ai-writing.md +2 -1
  228. package/lib/oh-story/skills/story-long-write/references/artifact-protocols.md +7 -3
  229. package/lib/oh-story/skills/story-long-write/references/author-memory.md +163 -0
  230. package/lib/oh-story/skills/story-long-write/references/banned-words.md +6 -4
  231. package/lib/oh-story/skills/story-long-write/references/cross-book-recall.md +6 -6
  232. package/lib/oh-story/skills/story-long-write/references/genre-prose-cards.md +1 -1
  233. package/lib/oh-story/skills/story-long-write/references/genre-readers.md +1 -1
  234. package/lib/oh-story/skills/{story-setup/references/agent-references/hooks-chapter.md → story-long-write/references/long-chapter-hooks.md} +5 -5
  235. package/lib/oh-story/skills/story-long-write/references/{quality-checklist.md → long-chapter-quality.md} +2 -1
  236. package/lib/oh-story/skills/story-long-write/references/long-format.md +42 -0
  237. package/lib/oh-story/skills/{story-setup/references/agent-references/genre-catalog.md → story-long-write/references/long-genre-catalog.md} +11 -97
  238. package/lib/oh-story/skills/story-long-write/references/{genre-core-mechanics.md → long-genre-mechanics.md} +1 -1
  239. package/lib/oh-story/skills/story-long-write/references/{reversal-toolkit.md → long-reversal.md} +18 -32
  240. package/lib/oh-story/skills/story-long-write/references/{hooks-suspense.md → long-suspense.md} +6 -6
  241. package/lib/oh-story/skills/story-long-write/references/opening-design.md +1 -1
  242. package/lib/oh-story/skills/story-long-write/references/outline-structure-theory.md +1 -1
  243. package/lib/oh-story/skills/story-long-write/references/style-genre-modules.md +1 -1
  244. package/lib/oh-story/skills/story-long-write/references/tracking-transaction.md +14 -6
  245. package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +32 -27
  246. package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +5 -4
  247. package/lib/oh-story/skills/story-long-write/references/workflow-revision.md +2 -2
  248. package/lib/oh-story/skills/story-long-write/references/workflow-setup.md +17 -11
  249. package/lib/oh-story/skills/story-long-write/references/writing-craft.md +54 -54
  250. package/lib/oh-story/skills/story-long-write/scripts/author_memory_commit.py +871 -0
  251. package/lib/oh-story/skills/story-long-write/scripts/check-ai-patterns.js +64 -1
  252. package/lib/oh-story/skills/story-long-write/scripts/check-outline-contract.js +251 -0
  253. package/lib/oh-story/skills/story-long-write/scripts/storyctl.py +303 -0
  254. package/lib/oh-story/skills/story-long-write/scripts/tracking_commit.py +98 -9
  255. package/lib/oh-story/skills/story-long-write/scripts/wordcount_core.py +246 -0
  256. package/lib/oh-story/skills/story-review/SKILL.md +26 -17
  257. package/lib/oh-story/skills/story-review/references/anti-ai-writing.md +2 -1
  258. package/lib/oh-story/skills/story-review/references/author-memory.md +163 -0
  259. package/lib/oh-story/skills/story-review/references/banned-words.md +6 -4
  260. package/lib/oh-story/skills/story-review/references/{quality-checklist.md → review-quality.md} +22 -21
  261. package/lib/oh-story/skills/story-review/references/tracking-transaction.md +14 -6
  262. package/lib/oh-story/skills/story-review/scripts/author_memory_commit.py +871 -0
  263. package/lib/oh-story/skills/story-review/scripts/check-ai-patterns.js +64 -1
  264. package/lib/oh-story/skills/story-review/scripts/tracking_commit.py +98 -9
  265. package/lib/oh-story/skills/story-review/scripts/wordcount_core.py +246 -0
  266. package/lib/oh-story/skills/story-setup/SKILL.md +85 -41
  267. package/lib/oh-story/skills/story-setup/references/agent-references/agent-quality.md +72 -0
  268. package/lib/oh-story/skills/story-setup/references/agent-references/agent-reference-profiles.md +55 -0
  269. package/lib/oh-story/skills/story-setup/references/agent-references/anti-ai-writing.md +2 -1
  270. package/lib/oh-story/skills/story-setup/references/agent-references/banned-words.md +6 -4
  271. package/lib/oh-story/skills/story-setup/references/agent-references/format-and-structure.md +9 -10
  272. package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards.md +1 -1
  273. package/lib/oh-story/skills/story-setup/references/agent-references/genre-readers.md +1 -1
  274. package/lib/oh-story/skills/{story-short-analyze/references/hooks-chapter.md → story-setup/references/agent-references/long-chapter-hooks.md} +5 -5
  275. package/lib/oh-story/skills/story-setup/references/agent-references/long-emotional-methods.md +209 -0
  276. package/lib/oh-story/skills/{story-long-write/references/genre-catalog.md → story-setup/references/agent-references/long-genre-catalog.md} +11 -97
  277. package/lib/oh-story/skills/story-setup/references/agent-references/{genre-core-mechanics.md → long-genre-mechanics.md} +1 -1
  278. package/lib/oh-story/skills/story-setup/references/agent-references/long-quality.md +40 -0
  279. package/lib/oh-story/skills/{story-short-write/references/reversal-toolkit.md → story-setup/references/agent-references/long-reversal.md} +18 -32
  280. package/lib/oh-story/skills/{story-short-write/references/hooks-suspense.md → story-setup/references/agent-references/long-suspense.md} +6 -6
  281. package/lib/oh-story/skills/story-setup/references/agent-references/opening-design.md +1 -1
  282. package/lib/oh-story/skills/story-setup/references/agent-references/{emotional-methods.md → short-emotional-methods.md} +4 -4
  283. package/lib/oh-story/skills/{story-long-write/references/genre-writing-formulas.md → story-setup/references/agent-references/short-genre-formulas.md} +32 -44
  284. package/lib/oh-story/skills/story-setup/references/agent-references/short-quality.md +39 -0
  285. package/lib/oh-story/skills/story-setup/references/agent-references/{reversal-toolkit.md → short-reversal.md} +29 -23
  286. package/lib/oh-story/skills/story-setup/references/agent-references/{hooks-suspense.md → short-suspense.md} +31 -31
  287. package/lib/oh-story/skills/story-setup/references/agent-references/style-genre-modules.md +1 -1
  288. package/lib/oh-story/skills/story-setup/references/agent-references/writing-craft.md +55 -55
  289. package/lib/oh-story/skills/story-short-analyze/SKILL.md +28 -28
  290. package/lib/oh-story/skills/story-short-analyze/references/{character-basics.md → analysis-character-basics.md} +1 -1
  291. package/lib/oh-story/skills/story-short-analyze/references/{character-design-methods.md → analysis-character-design.md} +1 -1
  292. package/lib/oh-story/skills/story-short-analyze/references/{character-relations.md → analysis-character-relations.md} +1 -1
  293. package/lib/oh-story/skills/story-short-analyze/references/{hooks-paragraph.md → analysis-paragraph-hooks.md} +1 -1
  294. package/lib/oh-story/skills/story-short-analyze/references/{genre-readers.md → analysis-reader-profile.md} +2 -2
  295. package/lib/oh-story/skills/story-short-analyze/references/analysis-report-style.md +45 -0
  296. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-genres.md +65 -0
  297. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-hooks.md +77 -0
  298. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-mechanics.md +82 -0
  299. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-patterns.md +50 -0
  300. package/lib/oh-story/skills/story-short-analyze/references/analysis-short-suspense.md +98 -0
  301. package/lib/oh-story/skills/story-short-analyze/references/{genre-writing-techniques.md → analysis-writing-techniques.md} +21 -19
  302. package/lib/oh-story/skills/story-short-analyze/references/deconstruction-examples.md +1 -1
  303. package/lib/oh-story/skills/story-short-analyze/references/material-decomposition.md +21 -28
  304. package/lib/oh-story/skills/story-short-analyze/references/output-contract.md +1 -1
  305. package/lib/oh-story/skills/story-short-analyze/references/output-templates.md +17 -17
  306. package/lib/oh-story/skills/story-short-analyze/references/{quality-checklist.md → source-story-quality.md} +28 -49
  307. package/lib/oh-story/skills/story-short-analyze/references/zhihu-style.md +2 -2
  308. package/lib/oh-story/skills/story-short-scan/SKILL.md +1 -1
  309. package/lib/oh-story/skills/story-short-write/SKILL.md +78 -55
  310. package/lib/oh-story/skills/story-short-write/references/author-memory.md +163 -0
  311. package/lib/oh-story/skills/story-short-write/references/banned-words.md +6 -4
  312. package/lib/oh-story/skills/story-short-write/references/cross-book-recall.md +3 -3
  313. package/lib/oh-story/skills/story-short-write/references/emotional-methods.md +4 -4
  314. package/lib/oh-story/skills/story-short-write/references/genre-styles//344/270/226/346/203/205/346/211/223/350/204/270.md +3 -3
  315. package/lib/oh-story/skills/story-short-write/references/genre-styles//345/217/214/347/224/267/344/270/273.md +2 -2
  316. package/lib/oh-story/skills/story-short-write/references/genre-styles//345/244/215/344/273/207/346/211/223/350/204/270.md +3 -3
  317. package/lib/oh-story/skills/story-short-write/references/genre-styles//345/256/205/346/226/227/345/256/253/346/226/227.md +6 -6
  318. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/200/273/350/243/201/350/261/252/351/227/250.md +3 -3
  319. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/202/254/347/226/221.md +4 -4
  320. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/260/221/344/277/227/346/200/252/350/260/210.md +7 -7
  321. package/lib/oh-story/skills/story-short-write/references/genre-styles//346/262/231/351/233/225/350/204/221/346/264/236.md +5 -5
  322. package/lib/oh-story/skills/story-short-write/references/genre-styles//347/224/234/345/256/240.md +4 -4
  323. package/lib/oh-story/skills/story-short-write/references/genre-styles//350/277/275/345/246/273/347/201/253/350/221/254/345/234/272.md +3 -3
  324. package/lib/oh-story/skills/story-short-write/references/genre-writing-formulas.md +32 -44
  325. package/lib/oh-story/skills/story-short-write/references/genre-writing-techniques.md +20 -18
  326. package/lib/oh-story/skills/story-short-write/references/output-contract.md +1 -1
  327. package/lib/oh-story/skills/story-short-write/references/short-craft.md +18 -18
  328. package/lib/oh-story/skills/story-short-write/references/short-deslop.md +1 -1
  329. package/lib/oh-story/skills/story-short-write/references/short-format.md +38 -8
  330. package/lib/oh-story/skills/story-short-write/references/{quality-checklist.md → short-prose-quality.md} +22 -21
  331. package/lib/oh-story/skills/story-short-write/references/short-reversal.md +355 -0
  332. package/lib/oh-story/skills/{story-short-analyze/references/hooks-suspense.md → story-short-write/references/short-suspense.md} +31 -31
  333. package/lib/oh-story/skills/story-short-write/references/submission-craft.md +2 -2
  334. package/lib/oh-story/skills/story-short-write/references/writing-workflow.md +31 -22
  335. package/lib/oh-story/skills/story-short-write/scripts/author_memory_commit.py +871 -0
  336. package/lib/oh-story/skills/story-short-write/scripts/check-ai-patterns.js +64 -1
  337. package/lib/oh-story/skills/story-short-write/scripts/check-delivery-contract.js +212 -0
  338. package/lib/oh-story/skills/story-short-write/scripts/check-phase2-contract.js +363 -0
  339. package/lib/types/client/drama-production-view.d.ts +34 -0
  340. package/lib/types/client/drama-production-view.d.ts.map +1 -0
  341. package/lib/types/client/drama-production.d.ts +92 -0
  342. package/lib/types/client/drama-production.d.ts.map +1 -0
  343. package/lib/types/client/file-activity.d.ts +9 -2
  344. package/lib/types/client/file-activity.d.ts.map +1 -1
  345. package/lib/types/client/index.d.ts +1 -1
  346. package/lib/types/client/index.d.ts.map +1 -1
  347. package/lib/types/client/production-intents.d.ts +9 -0
  348. package/lib/types/client/production-intents.d.ts.map +1 -0
  349. package/lib/types/client/production-prompts.d.ts +9 -0
  350. package/lib/types/client/production-prompts.d.ts.map +1 -0
  351. package/lib/types/client/production-runtime.d.ts +58 -0
  352. package/lib/types/client/production-runtime.d.ts.map +1 -0
  353. package/lib/types/client/video-studio.d.ts +41 -0
  354. package/lib/types/client/video-studio.d.ts.map +1 -0
  355. package/lib/types/client/workbench-ui.d.ts +5 -0
  356. package/lib/types/client/workbench-ui.d.ts.map +1 -0
  357. package/lib/types/game-verification.d.ts +16 -0
  358. package/lib/types/game-verification.d.ts.map +1 -0
  359. package/lib/types/index.d.ts +5 -2
  360. package/lib/types/index.d.ts.map +1 -1
  361. package/lib/types/production-intent.d.ts +21 -0
  362. package/lib/types/production-intent.d.ts.map +1 -0
  363. package/lib/types/production-tool.d.ts +5 -0
  364. package/lib/types/production-tool.d.ts.map +1 -0
  365. package/lib/types/reference-tool.d.ts +6 -0
  366. package/lib/types/reference-tool.d.ts.map +1 -0
  367. package/lib/types/role-provider.d.ts.map +1 -1
  368. package/lib/types/role-tool.d.ts +3 -1
  369. package/lib/types/role-tool.d.ts.map +1 -1
  370. package/lib/types/skill-provider.d.ts +7 -0
  371. package/lib/types/skill-provider.d.ts.map +1 -1
  372. package/lib/types/video-project.d.ts +42 -0
  373. package/lib/types/video-project.d.ts.map +1 -0
  374. package/lib/types/workspace-request-trust.d.ts +6 -0
  375. package/lib/types/workspace-request-trust.d.ts.map +1 -1
  376. package/lib/types/workspace-route.d.ts +20 -0
  377. package/lib/types/workspace-route.d.ts.map +1 -1
  378. package/lib/video-recap/CHANGELOG.md +282 -0
  379. package/lib/video-recap/LICENSE +21 -0
  380. package/lib/video-recap/README.en.md +257 -0
  381. package/lib/video-recap/README.md +255 -0
  382. package/lib/video-recap/manifest.json +684 -0
  383. package/lib/video-recap/skills/video-assemble/SKILL.md +97 -0
  384. package/lib/video-recap/skills/video-assemble/references/jianying/LICENSE.duo-video +21 -0
  385. package/lib/video-recap/skills/video-assemble/references/jianying/SOURCE.md +15 -0
  386. package/lib/video-recap/skills/video-assemble/references/jianying/empty_draft_meta_info.json +69 -0
  387. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_segment.json +84 -0
  388. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_video_material.json +98 -0
  389. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_draft.json +204 -0
  390. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_material_video.json +83 -0
  391. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_meta_material_value.json +23 -0
  392. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_project_info.json +133 -0
  393. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_segment.json +70 -0
  394. package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_text_styles.json +30 -0
  395. package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_audio.json +41 -0
  396. package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_text.json +109 -0
  397. package/lib/video-recap/skills/video-assemble/scripts/artifacts.py +88 -0
  398. package/lib/video-recap/skills/video-assemble/scripts/assemble.py +345 -0
  399. package/lib/video-recap/skills/video-assemble/scripts/assemble_constants.py +34 -0
  400. package/lib/video-recap/skills/video-assemble/scripts/assembly_contract.py +305 -0
  401. package/lib/video-recap/skills/video-assemble/scripts/assembly_settings.py +94 -0
  402. package/lib/video-recap/skills/video-assemble/scripts/audio_automation.py +205 -0
  403. package/lib/video-recap/skills/video-assemble/scripts/audio_mix.py +555 -0
  404. package/lib/video-recap/skills/video-assemble/scripts/export_jianying.py +261 -0
  405. package/lib/video-recap/skills/video-assemble/scripts/jianying_builders.py +767 -0
  406. package/lib/video-recap/skills/video-assemble/scripts/jianying_model.py +111 -0
  407. package/lib/video-recap/skills/video-assemble/scripts/jianying_optional.py +24 -0
  408. package/lib/video-recap/skills/video-assemble/scripts/jianying_schema.py +109 -0
  409. package/lib/video-recap/skills/video-assemble/scripts/jianying_templates.py +37 -0
  410. package/lib/video-recap/skills/video-assemble/scripts/jianying_timeline_contract.py +191 -0
  411. package/lib/video-recap/skills/video-assemble/scripts/jianying_tracks.py +75 -0
  412. package/lib/video-recap/skills/video-assemble/scripts/jianying_writer.py +394 -0
  413. package/lib/video-recap/skills/video-assemble/scripts/lib.py +239 -0
  414. package/lib/video-recap/skills/video-assemble/scripts/media.py +243 -0
  415. package/lib/video-recap/skills/video-assemble/scripts/narration_audio.py +477 -0
  416. package/lib/video-recap/skills/video-assemble/scripts/render_preflight.py +46 -0
  417. package/lib/video-recap/skills/video-assemble/scripts/source_subtitles.py +486 -0
  418. package/lib/video-recap/skills/video-assemble/scripts/subtitle_core.py +376 -0
  419. package/lib/video-recap/skills/video-assemble/scripts/subtitle_render.py +88 -0
  420. package/lib/video-recap/skills/video-assemble/scripts/timeline.py +248 -0
  421. package/lib/video-recap/skills/video-assemble/scripts/timeline_emit.py +89 -0
  422. package/lib/video-recap/skills/video-assemble/scripts/visual_render.py +512 -0
  423. package/lib/video-recap/skills/video-cut/SKILL.md +90 -0
  424. package/lib/video-recap/skills/video-cut/scripts/cut.py +67 -0
  425. package/lib/video-recap/skills/video-cut/scripts/cut_cli.py +320 -0
  426. package/lib/video-recap/skills/video-cut/scripts/cut_contract.py +545 -0
  427. package/lib/video-recap/skills/video-cut/scripts/cut_render.py +348 -0
  428. package/lib/video-recap/skills/video-cut/scripts/lib.py +77 -0
  429. package/lib/video-recap/skills/video-cut/scripts/media_geometry.py +341 -0
  430. package/lib/video-recap/skills/video-cut/scripts/narration_mapping.py +249 -0
  431. package/lib/video-recap/skills/video-cut/scripts/sentence_boundaries.py +745 -0
  432. package/lib/video-recap/skills/video-recap/SKILL.md +216 -0
  433. package/lib/video-recap/skills/video-recap/references/config-playbook.md +61 -0
  434. package/lib/video-recap/skills/video-recap/references/creative-editing-playbook.md +225 -0
  435. package/lib/video-recap/skills/video-recap/references/data-schema.md +534 -0
  436. package/lib/video-recap/skills/video-recap/references/research-guide.md +74 -0
  437. package/lib/video-recap/skills/video-recap/references/shift-left-qc-schema.md +23 -0
  438. package/lib/video-recap/skills/video-recap/references/timeline-and-jianying.md +251 -0
  439. package/lib/video-recap/skills/video-recap/scripts/doctor.py +483 -0
  440. package/lib/video-recap/skills/video-recap/scripts/final_qc.py +737 -0
  441. package/lib/video-recap/skills/video-recap/scripts/lib.py +242 -0
  442. package/lib/video-recap/skills/video-recap/scripts/materials.py +457 -0
  443. package/lib/video-recap/skills/video-recap/scripts/mimo_qc.py +95 -0
  444. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_client.py +18 -0
  445. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_contract.py +9 -0
  446. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_evidence.py +371 -0
  447. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_observations.py +201 -0
  448. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_payload.py +227 -0
  449. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_report.py +362 -0
  450. package/lib/video-recap/skills/video-recap/scripts/mimo_qc_runner.py +129 -0
  451. package/lib/video-recap/skills/video-recap/scripts/qc_contract.py +338 -0
  452. package/lib/video-recap/skills/video-recap/scripts/recap.py +9 -0
  453. package/lib/video-recap/skills/video-recap/scripts/recap_cli.py +140 -0
  454. package/lib/video-recap/skills/video-recap/scripts/recap_inspect.py +550 -0
  455. package/lib/video-recap/skills/video-recap/scripts/recap_review.py +77 -0
  456. package/lib/video-recap/skills/video-recap/scripts/recap_runner.py +654 -0
  457. package/lib/video-recap/skills/video-recap/scripts/recap_runtime.py +335 -0
  458. package/lib/video-recap/skills/video-recap/scripts/recap_stage_qc.py +217 -0
  459. package/lib/video-recap/skills/video-recap/scripts/recap_timeline.py +795 -0
  460. package/lib/video-recap/skills/video-script/SKILL.md +248 -0
  461. package/lib/video-recap/skills/video-script/references/creative-editing-playbook.md +225 -0
  462. package/lib/video-recap/skills/video-script/references/research-guide.md +75 -0
  463. package/lib/video-recap/skills/video-script/scripts/agent_brief.py +399 -0
  464. package/lib/video-recap/skills/video-script/scripts/agent_text.py +410 -0
  465. package/lib/video-recap/skills/video-script/scripts/brief_context.py +403 -0
  466. package/lib/video-recap/skills/video-script/scripts/brief_inputs.py +332 -0
  467. package/lib/video-recap/skills/video-script/scripts/brief_timeline.py +442 -0
  468. package/lib/video-recap/skills/video-script/scripts/deslop_qc.py +237 -0
  469. package/lib/video-recap/skills/video-script/scripts/evidence_bundle.py +492 -0
  470. package/lib/video-recap/skills/video-script/scripts/lib.py +327 -0
  471. package/lib/video-recap/skills/video-script/scripts/narration.py +12 -0
  472. package/lib/video-recap/skills/video-script/scripts/narration_lint.py +678 -0
  473. package/lib/video-recap/skills/video-script/scripts/review.py +42 -0
  474. package/lib/video-recap/skills/video-script/scripts/review_grounding.py +262 -0
  475. package/lib/video-recap/skills/video-script/scripts/review_response.py +761 -0
  476. package/lib/video-recap/skills/video-script/scripts/review_runner.py +200 -0
  477. package/lib/video-recap/skills/video-script/scripts/speech_ownership.py +204 -0
  478. package/lib/video-recap/skills/video-script/scripts/timeline_fusion.py +199 -0
  479. package/lib/video-recap/skills/video-script/scripts/validate.py +164 -0
  480. package/lib/video-recap/skills/video-understanding/SKILL.md +75 -0
  481. package/lib/video-recap/skills/video-understanding/references/data-schema.md +299 -0
  482. package/lib/video-recap/skills/video-understanding/references/prompt-templates.md +37 -0
  483. package/lib/video-recap/skills/video-understanding/references/research-guide.md +74 -0
  484. package/lib/video-recap/skills/video-understanding/scripts/agent_brief.py +399 -0
  485. package/lib/video-recap/skills/video-understanding/scripts/agent_text.py +410 -0
  486. package/lib/video-recap/skills/video-understanding/scripts/asr.py +260 -0
  487. package/lib/video-recap/skills/video-understanding/scripts/brief.py +12 -0
  488. package/lib/video-recap/skills/video-understanding/scripts/brief_context.py +403 -0
  489. package/lib/video-recap/skills/video-understanding/scripts/brief_inputs.py +332 -0
  490. package/lib/video-recap/skills/video-understanding/scripts/brief_timeline.py +442 -0
  491. package/lib/video-recap/skills/video-understanding/scripts/consolidate.py +647 -0
  492. package/lib/video-recap/skills/video-understanding/scripts/deslop_qc.py +237 -0
  493. package/lib/video-recap/skills/video-understanding/scripts/detect.py +513 -0
  494. package/lib/video-recap/skills/video-understanding/scripts/extract.py +62 -0
  495. package/lib/video-recap/skills/video-understanding/scripts/lib.py +470 -0
  496. package/lib/video-recap/skills/video-understanding/scripts/narration_lint.py +678 -0
  497. package/lib/video-recap/skills/video-understanding/scripts/speech_ownership.py +204 -0
  498. package/lib/video-recap/skills/video-understanding/scripts/storyboard.py +507 -0
  499. package/lib/video-recap/skills/video-understanding/scripts/timeline_fusion.py +199 -0
  500. package/lib/video-recap/skills/video-understanding/scripts/understand.py +9 -0
  501. package/lib/video-recap/skills/video-understanding/scripts/understanding_brief.py +216 -0
  502. package/lib/video-recap/skills/video-understanding/scripts/understanding_cache.py +327 -0
  503. package/lib/video-recap/skills/video-understanding/scripts/understanding_runner.py +367 -0
  504. package/lib/video-recap/skills/video-understanding/scripts/understanding_storyboard.py +162 -0
  505. package/lib/video-recap/skills/video-understanding/scripts/vlm.py +705 -0
  506. package/lib/video-recap/skills/video-voiceover/SKILL.md +81 -0
  507. package/lib/video-recap/skills/video-voiceover/scripts/dub.py +637 -0
  508. package/lib/video-recap/skills/video-voiceover/scripts/fish_audio.py +109 -0
  509. package/lib/video-recap/skills/video-voiceover/scripts/lib.py +421 -0
  510. package/lib/video-recap/skills/video-voiceover/scripts/tts_audio.py +113 -0
  511. package/lib/video-recap/skills/video-voiceover/scripts/voiceover.py +782 -0
  512. package/package.json +57 -41
  513. package/lib/drama/skills/short-drama/references/lifecycle-commands.md +0 -130
  514. package/lib/oh-story/skills/story-deslop/scripts/check-outline-copy.js +0 -241
  515. package/lib/oh-story/skills/story-long-write/references/format-and-structure.md +0 -169
  516. package/lib/oh-story/skills/story-setup/references/agent-references/genre-writing-formulas.md +0 -444
  517. package/lib/oh-story/skills/story-setup/references/agent-references/quality-checklist.md +0 -247
  518. package/lib/oh-story/skills/story-short-analyze/references/anti-ai-writing.md +0 -582
  519. package/lib/oh-story/skills/story-short-analyze/references/banned-words.md +0 -147
  520. package/lib/oh-story/skills/story-short-analyze/references/genre-catalog.md +0 -490
  521. package/lib/oh-story/skills/story-short-analyze/references/genre-core-mechanics.md +0 -425
  522. package/lib/oh-story/skills/story-short-analyze/references/genre-writing-formulas.md +0 -453
  523. /package/lib/oh-story/skills/{story-long-write/references/hooks-chapter.md → story-setup/references/agent-references/short-chapter-hooks.md} +0 -0
  524. /package/lib/oh-story/skills/{story-long-write/references/hooks-paragraph.md → story-setup/references/agent-references/short-paragraph-hooks.md} +0 -0
@@ -13,6 +13,7 @@ Detect high-risk AI-flavor prose patterns that need human rewrite:
13
13
  - repeated negative setup followed by positive flip
14
14
  - em-dash (按功能改写), 碎句号 (连续短叙述句), 长段落 (按镜头断段)
15
15
  - 微动作复读 (「了下/了一下」式轻量补语高密度,电报体指纹)
16
+ - 套式反应细节 (指尖/指节/目光等无功能微动作与「平静得像在念」式语气比喻成片)
16
17
  - 抽象总结复读 (命运/棋局/这一刻终于明白/才刚刚开始,AI 结尾腔)
17
18
  - 套词密度过高 (仿佛/一丝/深吸一口气/平静无波等禁用词聚集)
18
19
  - 比喻密度过高 (像/好像/仿佛/如同等比喻标记成片复现)
@@ -30,7 +31,7 @@ Detect high-risk AI-flavor prose patterns that need human rewrite:
30
31
  - 引号强调滥用 (叙述里 1-4 字短词加引号强调,密度型)
31
32
 
32
33
  Each finding carries severity: blocking by default for generation/deslop cleanup (not-is-comparison / em-dash / voice-contrast / negation-parade / reverse-not-is / trailer-ending / trailer-summary). This is a local style/readability gate, not an AIGC detector score; functional human text can be marked for review instead of hard-edited for a detector.
33
- 或 advisory (period-stutter / long-paragraph / micro-action-tic / action-list-tic / abstract-summary-tic / cliche-density-tic / metaphor-density-tic / reasoning-chain-tic / system-notice-formality-tic / overcompressed-prose-tic / low-connective-density-tic / quote-emphasis-tic / formulaic-parallelism,是提示,justified 的长推理/氛围段可保留)。
34
+ 或 advisory (period-stutter / long-paragraph / micro-action-tic / stock-reaction-tic / action-list-tic / abstract-summary-tic / cliche-density-tic / metaphor-density-tic / reasoning-chain-tic / system-notice-formality-tic / overcompressed-prose-tic / low-connective-density-tic / quote-emphasis-tic / formulaic-parallelism,是提示,justified 的长推理/氛围段可保留)。
34
35
  --fail-on=blocking 只在出现 blocking finding 时退出 1;默认 --fail-on=all 有任何 finding 即退出 1。
35
36
 
36
37
  The script reports findings only. It never rewrites text, because the safe fix is
@@ -57,6 +58,26 @@ const MICRO_TIC_PATTERN = /了(?:[一两三几半])?[下阵圈道声眼口气会
57
58
  const MICRO_TIC_MIN_HITS = 5;
58
59
  const MICRO_TIC_PER_KILO = 6;
59
60
 
61
+ // 套式反应细节:不是禁写身体,而是提示成片出现的“部位 + 轻微动作/状态”、
62
+ // “胸口像被撞了一下”、喉结/眼圈/声音放轻等通用情绪尾巴,以及“平静语气 +
63
+ // 像在念/宣判”模板。此类句子词面变化大,不能逐词 blocking;按章聚集到 4 处才
64
+ // advisory,要求逐处做删除测试。正常受伤、打斗、生理反应若承担物理后果可保留。
65
+ const STOCK_REACTION_PATTERNS = [
66
+ /(?:指尖|手指|指节|手背|掌心|拳头|袖口|衣角|裙角|下唇|嘴唇|唇角|嘴角|眉头|眼底|眸光|目光|视线|肩膀|呼吸)[^。!?!?\n]{0,16}(?:轻轻|微微|缓缓|悄然|不自觉|无意识|下意识|攥紧|握紧|收紧|绞紧|泛白|发白|叩|敲|摩挲|抿紧|抿成|移开|垂下|躲开|一颤|颤了?一下|停了?一下|顿了?一下)/g,
67
+ /(?:语气|声音)[^。!?!?\n]{0,12}(?:平静|冷静|平淡|冷淡|淡漠|平直)[^。!?!?\n]{0,12}(?:像|仿佛|如同|好像)[^。!?!?\n]{0,16}(?:念|读|报|说|陈述|宣判|背诵)/g,
68
+ /(?:胸口|心口)[^。!?!?\n]{0,16}(?:像|仿佛|如同|好像)[^。!?!?\n]{0,16}(?:撞|锤|压|攥|堵)[^。!?!?\n]{0,8}(?:一下|一记|一拳)?/g,
69
+ /(?:声音|嗓音|语气)[^。!?!?\n]{0,12}(?:放轻|压低|发紧|发颤|很轻|轻了些)/g,
70
+ /(?:喉结|喉头|喉咙)[^。!?!?\n]{0,10}(?:滚|动|紧|堵|发涩|发干)/g,
71
+ /(?:眼眶|眼圈|鼻子)[^。!?!?\n]{0,8}(?:发红|红了|发热|发酸|一酸)/g,
72
+ /(?:抿了?下唇|抿了?抿唇|抿了?下嘴|抿着笑)/g,
73
+ ];
74
+ const STOCK_REACTION_MIN_HITS = 4;
75
+ // 校准(真人语料,<br> 已还原为换行):qimao 长篇 5584 章 + heiyan 短篇整篇 3983 篇。
76
+ // 长篇章尺度(中位约 2100 字)per-kilo 1.0→1.5 误报 0.43%→0.39%,几乎不动;
77
+ // 短篇整篇 8000-20000 字下 MIN_HITS 形同虚设、只剩密度门,1.0 时误报 5.57%,
78
+ // 1.5 降到 1.46%。故取 1.5,把两个总体拉到同一量级(四份副本共用一组阈值)。
79
+ const STOCK_REACTION_PER_KILO = 1.5;
80
+
60
81
  // 监控摄像头式动作清单:同一段连续堆叠通用动作动词(伸手/拿起/取过/挑开/放下/转身等),
61
82
  // 且用逗号/顿号串联成步骤表时,读感像无视角温度的监控记录。只做 advisory;
62
83
  // 打斗/追逐等功能性动作编排可保留或人工复核。
@@ -406,6 +427,7 @@ function scanProsePatterns(proseLines) {
406
427
  findings.push(...findQuoteEmphasisTic(proseLines));
407
428
  findings.push(...findPeriodStutter(proseLines));
408
429
  findings.push(...findMicroActionTic(proseLines));
430
+ findings.push(...findStockReactionTic(proseLines));
409
431
  findings.push(...findActionListTic(proseLines));
410
432
  findings.push(...findAbstractSummaryTic(proseLines));
411
433
  findings.push(...findClicheDensityTic(proseLines));
@@ -700,6 +722,47 @@ function findMicroActionTic(proseLines) {
700
722
  }];
701
723
  }
702
724
 
725
+ // 套式反应细节:统计引号外叙述中通用的部位/声线反应与固定语气比喻。
726
+ // 这是删除测试的候选集,不是身体描写黑名单;全篇只报一条,保留有动作后果、
727
+ // 伤势、人物习惯或情节功能的细节。
728
+ function findStockReactionTic(proseLines) {
729
+ let hits = 0;
730
+ let narrativeChars = 0;
731
+ let firstLine = null;
732
+ const samples = [];
733
+
734
+ for (const { text, lineNo } of proseLines) {
735
+ const trimmed = text.trim();
736
+ if (!trimmed || isDivider(trimmed) || isStructural(trimmed)) continue;
737
+ const narrative = stripQuoted(trimmed);
738
+ narrativeChars += visibleLength(narrative);
739
+
740
+ for (const pattern of STOCK_REACTION_PATTERNS) {
741
+ pattern.lastIndex = 0;
742
+ let match;
743
+ while ((match = pattern.exec(narrative)) !== null) {
744
+ hits += 1;
745
+ if (firstLine === null) firstLine = lineNo;
746
+ const sample = sentenceAround(narrative, match.index);
747
+ if (samples.length < 6 && sample && !samples.includes(sample)) samples.push(sample);
748
+ }
749
+ }
750
+ }
751
+
752
+ if (narrativeChars === 0 || hits < STOCK_REACTION_MIN_HITS) return [];
753
+ const perKilo = (hits / narrativeChars) * 1000;
754
+ if (perKilo < STOCK_REACTION_PER_KILO) return [];
755
+
756
+ return [{
757
+ line: firstLine,
758
+ column: 1,
759
+ type: 'stock-reaction-tic',
760
+ severity: 'advisory',
761
+ message: `套式反应细节:指尖/指节/喉结/眼圈/声音放轻等通用反应或“平静得像在念”式语气比喻 ${hits} 处(${perKilo.toFixed(1)}/千字);逐处做删除测试,只标注情绪、不改变选择、关系、物件或动作结果的删掉,不要换部位或同义动作。`,
762
+ excerpt: compact(samples.join(' | ')),
763
+ }];
764
+ }
765
+
703
766
  function findActionListTic(proseLines) {
704
767
  const findings = [];
705
768
 
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Deterministic 细纲 structural verifier for story-long-write.
4
+ *
5
+ * Usage:
6
+ * node scripts/check-outline-contract.js --json <细纲路径...>
7
+ * node scripts/check-outline-contract.js --json --project <书目录> --chapter N
8
+ * Exit: 0 = pass, 1 = blocking contract failures, 2 = invalid invocation.
9
+ *
10
+ * Scope is structural only: it decides whether the blueprint carries the fields,
11
+ * subsections and table shape the authoritative template names. It never judges
12
+ * whether a value is good. The contract itself sets this granularity —
13
+ * artifact-protocols.md 要求未知字段写 `[待补充]`,所以字段必须在场,值可以未知。
14
+ */
15
+
16
+ 'use strict'
17
+
18
+ const fs = require('fs')
19
+ const path = require('path')
20
+
21
+ // 权威模板:references/workflow-setup.md「细纲(全书每章)」
22
+ const FIELDS = [
23
+ '核心事件', '字数目标', '字数口径', '阶段位置', '单元ID/位置', '目标情绪',
24
+ '主角目标/关键选择', '章节定位', '本章结构公式', '章首钩子', '爽点',
25
+ '本章禁止提前释放', '契约风险',
26
+ ]
27
+ const SUBSECTIONS = ['内容概括', '情节安排', '人物关系和出场顺序', '情节细化']
28
+ const FIVE_ACT = ['起因', '发展', '转折', '高潮', '结尾']
29
+ const PLOT_HEADER_FIRST = /^(?:#|序号)$/
30
+ // 这两个字段实测直接影响正文质量,必须有实际内容
31
+ const INTENT_FIELDS = ['目标情绪', '主角目标/关键选择']
32
+ const CALIBER = 'visible_chars_v1'
33
+
34
+ function fieldPattern(name) {
35
+ // 允许 -/*/+ 项目符号、可选 ** 加粗、全角或半角冒号
36
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
37
+ return new RegExp(`^\\s*[-*+]\\s*\\*{0,2}${escaped}\\*{0,2}\\s*[::]`, 'm')
38
+ }
39
+
40
+ function readUtf8(file) {
41
+ try {
42
+ const text = fs.readFileSync(file, 'utf8').replace(/^/, '')
43
+ return { ok: text.trim().length > 0, text }
44
+ } catch (error) {
45
+ return { ok: false, text: '', error: error.message }
46
+ }
47
+ }
48
+
49
+ function makeCheck(id, ok, file, evidence, expected, repair) {
50
+ return {
51
+ id,
52
+ ok,
53
+ severity: 'blocking',
54
+ file,
55
+ evidence,
56
+ expected,
57
+ references: ['references/workflow-setup.md', 'references/artifact-protocols.md'],
58
+ repair,
59
+ }
60
+ }
61
+
62
+ function parseTableRow(line) {
63
+ const trimmed = line.trim()
64
+ if (!trimmed.startsWith('|') || !trimmed.endsWith('|')) return null
65
+ return trimmed.slice(1, -1).split('|').map((cell) => cell.replace(/\*\*/g, '').replace(/`/g, '').trim())
66
+ }
67
+
68
+ function verify(file) {
69
+ const name = path.basename(file)
70
+ const read = readUtf8(file)
71
+ const checks = []
72
+
73
+ checks.push(makeCheck(
74
+ 'outline.readable',
75
+ read.ok,
76
+ name,
77
+ read.ok ? '文件存在且非空' : (read.error || '文件为空'),
78
+ '细纲文件存在且非空',
79
+ '只补建缺失的细纲文件,不改动同批其他章。'
80
+ ))
81
+ if (!read.ok) return report(file, checks)
82
+ const text = read.text
83
+
84
+ const missingFields = FIELDS.filter((field) => !fieldPattern(field).test(text))
85
+ checks.push(makeCheck(
86
+ 'outline.required-fields',
87
+ missingFields.length === 0,
88
+ name,
89
+ missingFields.length ? `缺字段:${missingFields.join('、')}` : `${FIELDS.length} 个字段齐全`,
90
+ `按权威模板列出全部字段:${FIELDS.join('、')};值未知时写 [待补充],不杜撰剧情`,
91
+ '只补报告里缺的字段行;确实还定不下来的写 [待补充],不为补字段新增副线或人物关系。'
92
+ ))
93
+
94
+ // 隔离实验(同章、同写作流程,只改细纲):只补这两个字段就能复现补齐全部字段的收益,
95
+ // 盲评 3/3 胜过不补;补满五个字段与只补这两个不可区分。所以这两个字段不接受占位符,
96
+ // 其余字段仍按契约允许 [待补充]。
97
+ const hollow = INTENT_FIELDS.filter((field) => {
98
+ const match = text.match(new RegExp(`^\\s*[-*+]\\s*\\*{0,2}${field.replace('/', '\\/')}\\*{0,2}\\s*[::]\\s*(.*)$`, 'm'))
99
+ if (!match) return false
100
+ const value = match[1].replace(/\[待补充\]/g, '').replace(/[\s、,,。;;]/g, '')
101
+ return value.length === 0
102
+ })
103
+ checks.push(makeCheck(
104
+ 'outline.intent-fields-substantive',
105
+ hollow.length === 0,
106
+ name,
107
+ hollow.length ? `只有占位符,没有实际内容:${hollow.join('、')}` : '目标情绪与主角目标/关键选择都写了实际内容',
108
+ '目标情绪写清前状态→后状态;主角目标/关键选择写清本章要什么、必须做出的判断。这两项不接受 [待补充]',
109
+ '只把这两个字段替换成本章的实际情绪变化与实际取舍;其余字段不动。'
110
+ ))
111
+
112
+ const missingSubs = SUBSECTIONS.filter((sub) => !new RegExp(`^#{3,4}\\s*${sub}`, 'm').test(text))
113
+ checks.push(makeCheck(
114
+ 'outline.subsections',
115
+ missingSubs.length === 0,
116
+ name,
117
+ missingSubs.length ? `缺小节:${missingSubs.join('、')}` : '四个小节齐全',
118
+ '包含 内容概括 / 情节安排 / 人物关系和出场顺序 / 情节细化 四个小节',
119
+ '只补缺失的小节标题及其条目,不重写已成立的内容。'
120
+ ))
121
+
122
+ const missingActs = FIVE_ACT.filter((act) => !fieldPattern(act).test(text))
123
+ checks.push(makeCheck(
124
+ 'outline.five-act',
125
+ missingActs.length === 0,
126
+ name,
127
+ missingActs.length ? `五段式缺:${missingActs.join('、')}` : '五段式齐全',
128
+ '内容概括写全 起因 / 发展 / 转折 / 高潮 / 结尾',
129
+ '只补缺的那一段,不改其余四段。'
130
+ ))
131
+
132
+ const lines = text.split(/\r?\n/)
133
+ let header = null
134
+ for (const line of lines) {
135
+ const cells = parseTableRow(line)
136
+ if (cells && cells.length === 4 && PLOT_HEADER_FIRST.test(cells[0])) {
137
+ header = cells
138
+ break
139
+ }
140
+ }
141
+ const headerOk = Boolean(header) && header[2].includes('功能标签') && header[3].includes('执行边界')
142
+ checks.push(makeCheck(
143
+ 'outline.plotpoint-table',
144
+ headerOk,
145
+ name,
146
+ header ? `表头:${header.join(' | ')}` : '未找到 | # | 情节点 | 功能标签 | 执行边界 | 表头',
147
+ '情节细化使用四列表格:# / 情节点(谁做了什么) / 功能标签 / 执行边界',
148
+ '只把情节点序列改成四列表格,逐点补功能标签与执行边界;不增删情节点本身。'
149
+ ))
150
+
151
+ const targetMatch = text.match(/字数目标\s*[::]\s*(?:约\s*)?([\d,,]+)/)
152
+ const target = targetMatch ? Number(targetMatch[1].replace(/[,,]/g, '')) : null
153
+ const caliberOk = new RegExp(`字数口径\\s*[::]\\s*${CALIBER}`).test(text)
154
+ checks.push(makeCheck(
155
+ 'outline.wordcount-target',
156
+ Boolean(target) && Number.isFinite(target) && target >= 500 && target <= 20000 && caliberOk,
157
+ name,
158
+ `字数目标:${target === null ? '未识别' : target};字数口径 ${CALIBER}:${caliberOk}`,
159
+ `字数目标为 500-20000 的正整数,并声明 字数口径:${CALIBER}`,
160
+ '只补字数目标或字数口径行,不调整情节安排。'
161
+ ))
162
+
163
+ return report(file, checks)
164
+ }
165
+
166
+ function report(file, checks) {
167
+ const failures = checks.filter((check) => !check.ok)
168
+ return {
169
+ schema_version: 1,
170
+ verifier: 'story-long-write.outline-contract',
171
+ file: path.resolve(file),
172
+ ok: failures.length === 0,
173
+ checks,
174
+ failures,
175
+ repair_scope: failures.map((failure) => ({
176
+ id: failure.id,
177
+ file: failure.file,
178
+ evidence: failure.evidence,
179
+ expected: failure.expected,
180
+ references: failure.references,
181
+ repair: failure.repair,
182
+ })),
183
+ }
184
+ }
185
+
186
+ function resolveChapter(project, chapter) {
187
+ const dir = path.join(project, '大纲')
188
+ let entries
189
+ try {
190
+ entries = fs.readdirSync(dir)
191
+ } catch (error) {
192
+ return { error: `无法读取 ${dir}:${error.message}` }
193
+ }
194
+ const wanted = Number(chapter)
195
+ const hit = entries.find((entry) => {
196
+ const match = entry.match(/^细纲_第0*(\d+)章.*\.md$/)
197
+ return match && Number(match[1]) === wanted
198
+ })
199
+ if (!hit) return { error: `${dir} 下没有第 ${wanted} 章细纲` }
200
+ return { file: path.join(dir, hit) }
201
+ }
202
+
203
+ function parseArgs(argv) {
204
+ const files = []
205
+ let project = null
206
+ let chapter = null
207
+ for (let index = 0; index < argv.length; index++) {
208
+ const arg = argv[index]
209
+ if (arg === '--json') continue
210
+ if (arg === '--project' || arg === '--chapter') {
211
+ if (index + 1 >= argv.length || argv[index + 1].startsWith('--')) return null
212
+ const value = argv[++index]
213
+ if (arg === '--project') project = value
214
+ else chapter = value
215
+ continue
216
+ }
217
+ if (arg.startsWith('--')) return null
218
+ files.push(arg)
219
+ }
220
+ if (project || chapter) {
221
+ if (!project || !chapter || files.length || !/^\d+$/.test(chapter)) return null
222
+ return { project, chapter }
223
+ }
224
+ if (!files.length) return null
225
+ return { files }
226
+ }
227
+
228
+ function main(argv) {
229
+ const parsed = parseArgs(argv)
230
+ if (!parsed) {
231
+ process.stderr.write('用法: node scripts/check-outline-contract.js --json <细纲路径...> | --json --project <书目录> --chapter N\n')
232
+ return 2
233
+ }
234
+ let targets = parsed.files
235
+ if (!targets) {
236
+ const resolved = resolveChapter(parsed.project, parsed.chapter)
237
+ if (resolved.error) {
238
+ process.stderr.write(`${resolved.error}\n`)
239
+ return 2
240
+ }
241
+ targets = [resolved.file]
242
+ }
243
+ const reports = targets.map((file) => verify(file))
244
+ const ok = reports.every((entry) => entry.ok)
245
+ process.stdout.write(`${JSON.stringify(reports.length === 1 ? reports[0] : reports, null, 2)}\n`)
246
+ return ok ? 0 : 1
247
+ }
248
+
249
+ if (require.main === module) process.exitCode = main(process.argv.slice(2))
250
+
251
+ module.exports = { verify, FIELDS, SUBSECTIONS, FIVE_ACT }
@@ -0,0 +1,303 @@
1
+ #!/usr/bin/env python3
2
+ """Measure, checkpoint, check, and commit long-form story chapters."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import importlib.util
8
+ import json
9
+ import shutil
10
+ import subprocess
11
+ import sys
12
+ from pathlib import Path
13
+ from typing import Any, Sequence
14
+
15
+
16
+ def _load_local_module(name: str, filename: str) -> Any:
17
+ path = Path(__file__).with_name(filename)
18
+ spec = importlib.util.spec_from_file_location(name, path)
19
+ if spec is None or spec.loader is None:
20
+ raise RuntimeError(f"TOOL_UNAVAILABLE: {filename}")
21
+ module = importlib.util.module_from_spec(spec)
22
+ spec.loader.exec_module(module)
23
+ return module
24
+
25
+
26
+ core = _load_local_module("story_wordcount_core", "wordcount_core.py")
27
+ for _name in dir(core):
28
+ if not _name.startswith("_"):
29
+ globals()[_name] = getattr(core, _name)
30
+
31
+ CHAPTER_CHECK_SCHEMA = "story-chapter-check/v1"
32
+ CHAPTER_ERROR_SCHEMA = "story-chapter-error/v1"
33
+
34
+
35
+ class CliArgumentError(ValueError):
36
+ pass
37
+
38
+
39
+ class StructuredArgumentParser(argparse.ArgumentParser):
40
+ def error(self, message: str) -> None:
41
+ raise CliArgumentError(message)
42
+
43
+
44
+ def _tracking_module() -> Any:
45
+ return _load_local_module("story_tracking_for_storyctl", "tracking_commit.py")
46
+
47
+
48
+ def _tracking_call(function: Any, *args: Any) -> Any:
49
+ try:
50
+ return function(*args)
51
+ except Exception as exc:
52
+ if exc.__class__.__name__ == "TrackingError":
53
+ raise WordcountError(str(exc)) from exc
54
+ raise
55
+
56
+
57
+ def _json_line(payload: dict[str, Any]) -> None:
58
+ rendered = json.dumps(payload, ensure_ascii=False, separators=(",", ":")) + "\n"
59
+ # Windows runners may expose a cp1252 console even when callers explicitly
60
+ # consume UTF-8. Write protocol output as bytes so JSON never depends on
61
+ # the host console code page.
62
+ sys.stdout.buffer.write(rendered.encode("utf-8"))
63
+ sys.stdout.buffer.flush()
64
+
65
+
66
+ def _read_json_object(path: Path, label: str) -> dict[str, Any]:
67
+ try:
68
+ value = json.loads(path.read_text(encoding="utf-8"))
69
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
70
+ raise WordcountError(f"unable to read {label}: {exc}") from exc
71
+ require(isinstance(value, dict), f"{label} must be an object")
72
+ return value
73
+
74
+
75
+ def _project_files(project: Path, chapter: int) -> tuple[Path, Path, int]:
76
+ root = project.resolve()
77
+ outline = find_chapter_file(root / "大纲", chapter, outline=True)
78
+ body = find_chapter_file(root / "正文", chapter, outline=False)
79
+ try:
80
+ target = target_from_outline(outline.read_text(encoding="utf-8"))
81
+ except (OSError, UnicodeError) as exc:
82
+ raise WordcountError(f"unable to read outline: {exc}") from exc
83
+ return outline, body, target
84
+
85
+
86
+ def _json_findings(output: str) -> list[dict[str, Any]]:
87
+ try:
88
+ value = json.loads(output or "{}")
89
+ except json.JSONDecodeError:
90
+ return []
91
+ findings = value.get("findings", []) if isinstance(value, dict) else []
92
+ return findings if isinstance(findings, list) else []
93
+
94
+
95
+ def check_blocking_quality(outline: Path, body: Path) -> dict[str, Any]:
96
+ node = shutil.which("node")
97
+ if node is None:
98
+ return {
99
+ "status": "fail",
100
+ "blocking_findings": [{"type": "TOOL_UNAVAILABLE", "message": "node is required for quality checks"}],
101
+ "advisories": [],
102
+ }
103
+ root = Path(__file__).parent
104
+ blocking: list[dict[str, Any]] = []
105
+ advisories: list[dict[str, Any]] = []
106
+ for name, script in (
107
+ ("ai-pattern", "check-ai-patterns.js"),
108
+ ("degeneration", "check-degeneration.js"),
109
+ ):
110
+ path = root / script
111
+ if not path.is_file():
112
+ blocking.append({"type": "TOOL_UNAVAILABLE", "message": f"missing {script}"})
113
+ continue
114
+ completed = subprocess.run(
115
+ [node, str(path), "--check", "--json", "--fail-on=blocking", str(body)],
116
+ text=True, encoding="utf-8", capture_output=True, check=False,
117
+ )
118
+ findings = _json_findings(completed.stdout)
119
+ for finding in findings:
120
+ row = {"source": name, **finding}
121
+ (blocking if finding.get("severity") == "blocking" else advisories).append(row)
122
+ if completed.returncode not in {0, 1}:
123
+ blocking.append({"type": "TOOL_ERROR", "source": name, "message": completed.stderr.strip()})
124
+
125
+ punctuation = root / "normalize-punctuation.js"
126
+ if not punctuation.is_file():
127
+ blocking.append({"type": "TOOL_UNAVAILABLE", "message": "missing normalize-punctuation.js"})
128
+ else:
129
+ completed = subprocess.run(
130
+ [node, str(punctuation), "--check", str(body)],
131
+ text=True, encoding="utf-8", capture_output=True, check=False,
132
+ )
133
+ if completed.returncode != 0:
134
+ blocking.append(
135
+ {"type": "PUNCTUATION_NOT_NORMALIZED", "message": (completed.stdout or completed.stderr).strip()}
136
+ )
137
+
138
+ outline_copy = root / "check-outline-copy.js"
139
+ if not outline_copy.is_file():
140
+ blocking.append({"type": "TOOL_UNAVAILABLE", "message": "missing check-outline-copy.js"})
141
+ else:
142
+ completed = subprocess.run(
143
+ [node, str(outline_copy), "--outline", str(outline), str(body)],
144
+ text=True, encoding="utf-8", capture_output=True, check=False,
145
+ )
146
+ if completed.returncode != 0:
147
+ advisories.append(
148
+ {"source": "outline-copy", "type": "OUTLINE_COPY_REVIEW", "message": completed.stdout.strip()}
149
+ )
150
+ return {
151
+ "status": "fail" if blocking else "pass",
152
+ "blocking_findings": blocking,
153
+ "advisories": advisories,
154
+ }
155
+
156
+
157
+ def chapter_check(project: Path, chapter: int) -> dict[str, Any]:
158
+ outline, body_path, target = _project_files(project, chapter)
159
+ try:
160
+ body = body_path.read_text(encoding="utf-8")
161
+ except (OSError, UnicodeError) as exc:
162
+ raise WordcountError(f"unable to read body: {exc}") from exc
163
+ length = evaluate_wordcount(body, target, chapter=chapter)
164
+ quality = check_blocking_quality(outline, body_path)
165
+ length_ok = length["status"] in {"internal_pass", "borderline"}
166
+ if quality["status"] != "pass" or length["status"] == "invalid":
167
+ actions: list[str] = []
168
+ elif length_ok:
169
+ actions = ["commit"]
170
+ elif length["status"] == "over":
171
+ actions = ["compress-once", "accept-current-length", "revise-outline-or-target", "discard"]
172
+ else:
173
+ actions = ["accept-current-length", "revise-outline-or-target", "discard"]
174
+ tracking = _tracking_module()
175
+ state = _tracking_call(tracking.load_state, project)
176
+ compression = None
177
+ if length["status"] == "over" and quality["status"] == "pass":
178
+ actual = length["actual"]
179
+ compression = {
180
+ "mode": "single_pass_remove_only",
181
+ "remove_to_internal_band": {
182
+ "min": actual - length["internal_band"]["max"],
183
+ "max": actual - length["internal_band"]["min"],
184
+ },
185
+ "remove_to_user_band": {
186
+ "min": actual - length["user_band"]["max"],
187
+ "max": actual - length["user_band"]["min"],
188
+ },
189
+ }
190
+ return {
191
+ "schema": CHAPTER_CHECK_SCHEMA,
192
+ "chapter": chapter,
193
+ "length": length,
194
+ "quality": quality,
195
+ "compression": compression,
196
+ "state_revision": state["state_revision"],
197
+ "tracking_committed": state["last_committed_chapter"] >= chapter,
198
+ "next_chapter_started": state["last_committed_chapter"] > chapter,
199
+ "available_actions": actions,
200
+ }
201
+
202
+
203
+ def chapter_commit(project: Path, chapter: int, input_path: Path, *, accept_current_length: bool) -> dict[str, Any]:
204
+ checked = chapter_check(project, chapter)
205
+ require(checked["quality"]["status"] == "pass", "blocking quality findings must be fixed before commit")
206
+ length_status = checked["length"]["status"]
207
+ in_user_band = length_status in {"internal_pass", "borderline"}
208
+ if accept_current_length:
209
+ require(length_status in {"under", "over"}, "accept-current-length requires a valid out-of-band chapter")
210
+ resolution = "accepted_current_length"
211
+ else:
212
+ require(in_user_band, "chapter length is outside the user band; use accept-current-length or revise it")
213
+ resolution = "within_user_band"
214
+ document = _read_json_object(input_path, "tracking transaction")
215
+ require(document.get("chapter") == chapter, "tracking transaction chapter does not match command")
216
+ require("wordcount" not in document, "tracking transaction must not provide wordcount")
217
+ document["wordcount"] = build_project_wordcount_record(project, chapter, resolution=resolution)
218
+ tracking = _tracking_module()
219
+ state = _tracking_call(tracking.apply_transaction, project, document)
220
+ checked["tracking_committed"] = state["last_committed_chapter"] >= chapter
221
+ checked["next_chapter_started"] = state["last_committed_chapter"] > chapter
222
+ checked["wordcount"] = state["wordcount_records"].get(str(chapter))
223
+ return checked
224
+
225
+
226
+ def _build_parser() -> StructuredArgumentParser:
227
+ parser = StructuredArgumentParser(prog="storyctl.py")
228
+ commands = parser.add_subparsers(dest="command", required=True)
229
+ wordcount = commands.add_parser("wordcount")
230
+ wordcount_commands = wordcount.add_subparsers(dest="wordcount_command", required=True)
231
+ for command in ("measure", "check", "checkpoint"):
232
+ subparser = wordcount_commands.add_parser(command)
233
+ subparser.add_argument("--file", required=True)
234
+ subparser.add_argument("--chapter")
235
+ subparser.add_argument("--case-id")
236
+ if command != "measure":
237
+ subparser.add_argument("--target", required=True)
238
+ chapter = commands.add_parser("chapter")
239
+ chapter_commands = chapter.add_subparsers(dest="chapter_command", required=True)
240
+ for command in ("check", "commit", "accept-current-length"):
241
+ subparser = chapter_commands.add_parser(command)
242
+ subparser.add_argument("--project", type=Path, required=True)
243
+ subparser.add_argument("--chapter", type=int, required=True)
244
+ if command != "check":
245
+ subparser.add_argument("--input", type=Path, required=True)
246
+ return parser
247
+
248
+
249
+ def _wordcount_command(args: argparse.Namespace) -> int:
250
+ try:
251
+ body = Path(args.file).read_text(encoding="utf-8")
252
+ except (OSError, UnicodeError):
253
+ result = (
254
+ {"schema": MEASUREMENT_SCHEMA, "metric": METRIC, "chapter": args.chapter, "case_id": args.case_id,
255
+ "actual": None, "status": "invalid", "invalid_reason": "INVALID_FILE"}
256
+ if args.wordcount_command == "measure"
257
+ else invalid_wordcount_result("INVALID_FILE", chapter=args.chapter, case_id=args.case_id)
258
+ )
259
+ _json_line(result)
260
+ return 2
261
+ if args.wordcount_command == "measure":
262
+ result = measure_wordcount(body, chapter=args.chapter, case_id=args.case_id)
263
+ elif args.wordcount_command == "checkpoint":
264
+ try:
265
+ result = checkpoint_wordcount(body, args.target, chapter=args.chapter, case_id=args.case_id)
266
+ except WordcountError:
267
+ result = invalid_wordcount_result("INVALID_TARGET", chapter=args.chapter, case_id=args.case_id)
268
+ else:
269
+ result = evaluate_wordcount(body, args.target, chapter=args.chapter, case_id=args.case_id)
270
+ _json_line(result)
271
+ return 2 if result.get("status") == "invalid" else 0
272
+
273
+
274
+ def main(argv: Sequence[str] | None = None) -> int:
275
+ raw = list(argv) if argv is not None else sys.argv[1:]
276
+ try:
277
+ args = _build_parser().parse_args(raw)
278
+ except CliArgumentError as exc:
279
+ payload = (
280
+ {"schema": CHAPTER_ERROR_SCHEMA, "error_code": "INVALID_ARGUMENT", "message": str(exc)}
281
+ if raw[:1] == ["chapter"] else invalid_wordcount_result("INVALID_ARGUMENT", case_id=str(exc))
282
+ )
283
+ _json_line(payload)
284
+ return 2
285
+ if args.command == "wordcount":
286
+ return _wordcount_command(args)
287
+ try:
288
+ if args.chapter_command == "check":
289
+ result = chapter_check(args.project, args.chapter)
290
+ else:
291
+ result = chapter_commit(
292
+ args.project, args.chapter, args.input,
293
+ accept_current_length=args.chapter_command == "accept-current-length",
294
+ )
295
+ except (WordcountError, OSError, UnicodeError) as exc:
296
+ _json_line({"schema": CHAPTER_ERROR_SCHEMA, "error_code": "CHECK_FAILED", "message": str(exc)})
297
+ return 2
298
+ _json_line(result)
299
+ return 2 if result["quality"]["status"] != "pass" else 0
300
+
301
+
302
+ if __name__ == "__main__":
303
+ raise SystemExit(main())