@oh-story/dsh 0.1.4 → 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.
- package/README.md +56 -12
- package/lib/client.js +2692 -268
- package/lib/client.js.map +4 -4
- package/lib/drama/manifest.json +136 -101
- package/lib/drama/skills/short-drama/SKILL.md +61 -1
- package/lib/drama/skills/short-drama/references/contract-and-ownership.md +7 -4
- package/lib/drama/skills/short-drama/references/creator-documents.md +133 -8
- package/lib/drama/skills/short-drama/references/creator-workflow.md +38 -2
- package/lib/drama/skills/short-drama/references/knowhow-index.md +3 -0
- package/lib/drama/skills/short-drama/references/reference-roles.md +10 -7
- package/lib/drama/skills/short-drama/references/runtime-preflight.md +3 -0
- package/lib/drama/skills/short-drama/scripts/creator_markdown_check.py +1002 -0
- package/lib/drama/skills/short-drama/scripts/project_tool.py +485 -5
- package/lib/drama/skills/short-drama-assets/SKILL.md +13 -3
- package/lib/drama/skills/short-drama-assets/references/continuity-lock.md +116 -0
- package/lib/drama/skills/short-drama-assets/references/identity-vs-variant.md +2 -1
- package/lib/drama/skills/short-drama-assets/references/prop-and-state.md +19 -0
- package/lib/drama/skills/short-drama-assets/references/stage-contract.md +2 -0
- package/lib/drama/skills/short-drama-assets/scripts/asset_check.py +1 -1
- package/lib/drama/skills/short-drama-image-prompts/SKILL.md +6 -2
- package/lib/drama/skills/short-drama-image-prompts/references/common-recipe.md +4 -3
- package/lib/drama/skills/short-drama-image-prompts/references/lookdev-frame.md +1 -1
- package/lib/drama/skills/short-drama-image-prompts/references/review-and-fixtures.md +1 -1
- package/lib/drama/skills/short-drama-image-prompts/references/stage-contract.md +3 -1
- package/lib/drama/skills/short-drama-image-prompts/scripts/image_prompt_check.py +8 -8
- package/lib/drama/skills/short-drama-image-prompts/scripts/selftest.py +4 -2
- package/lib/drama/skills/short-drama-produce/SKILL.md +46 -10
- package/lib/drama/skills/short-drama-produce/references/adapter-contract.md +65 -8
- package/lib/drama/skills/short-drama-produce/references/providers/minimax-h3-video.md +85 -0
- package/lib/drama/skills/short-drama-produce/references/providers/seedance.md +27 -10
- package/lib/drama/skills/short-drama-produce/scripts/production_tool.py +362 -3
- package/lib/drama/skills/short-drama-produce/scripts/provider_adapters.py +627 -40
- package/lib/drama/skills/short-drama-produce/scripts/selftest.py +5 -4
- package/lib/drama/skills/short-drama-review/references/rubric-visual-motion.md +12 -0
- package/lib/drama/skills/short-drama-review/scripts/review_check.py +1 -1
- package/lib/drama/skills/short-drama-storyboard/SKILL.md +76 -7
- package/lib/drama/skills/short-drama-storyboard/assets/shot-template.jsonl +1 -1
- package/lib/drama/skills/short-drama-storyboard/references/keyframe-craft.md +6 -2
- package/lib/drama/skills/short-drama-storyboard/references/production-shot-grammar.md +19 -4
- package/lib/drama/skills/short-drama-storyboard/references/review-and-fixtures.md +5 -2
- package/lib/drama/skills/short-drama-storyboard/references/screenplay-to-keyframe-example.md +16 -0
- package/lib/drama/skills/short-drama-storyboard/references/stage-contract.md +8 -3
- package/lib/drama/skills/short-drama-storyboard/scripts/storyboard_check.py +1 -1
- package/lib/drama/skills/short-drama-video-prompts/SKILL.md +81 -13
- package/lib/drama/skills/short-drama-video-prompts/assets/motion-spec.jsonl.md +6 -1
- package/lib/drama/skills/short-drama-video-prompts/assets/video-prompts.md +17 -1
- package/lib/drama/skills/short-drama-video-prompts/references/delivery-profile.md +21 -1
- package/lib/drama/skills/short-drama-video-prompts/references/minimax-h3.md +154 -0
- package/lib/drama/skills/short-drama-video-prompts/references/motion-recipe.md +24 -6
- package/lib/drama/skills/short-drama-video-prompts/references/production-prompt-grammar.md +11 -7
- package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.0.md +41 -0
- package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.5.md +66 -0
- package/lib/drama/skills/short-drama-video-prompts/references/stage-contract.md +5 -2
- package/lib/drama/skills/short-drama-video-prompts/references/target-model-profile.md +115 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/container_check.py +1 -1
- package/lib/drama/skills/short-drama-video-prompts/scripts/music_spec_check.py +1 -1
- package/lib/drama/skills/short-drama-write/SKILL.md +3 -2
- package/lib/drama/skills/short-drama-write/scripts/duration_estimate.py +1 -1
- package/lib/drama/skills/short-drama-write/scripts/screenplay_index.py +2 -2
- package/lib/drama/skills/short-drama-write/scripts/voice_sheet_check.py +1 -1
- package/lib/index.js +865 -33
- package/lib/index.js.map +4 -4
- package/lib/novel-to-game/LICENSE +21 -0
- package/lib/novel-to-game/README.md +180 -0
- package/lib/novel-to-game/README_ZH.md +178 -0
- package/lib/novel-to-game/VERSION +1 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/BUILD_BRIEF.md +217 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/.vercelignore +3 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/RUN.md +130 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/bg/compound_new_guofeng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/fate_coda.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/meng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pan.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/xuee.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/yue.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_accord_five.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_afterglow_five.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_alliance.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day10.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day15.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day5.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/title_new_guofeng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_xuee.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_meng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pan.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/meng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pan.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/xuee.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/yue.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/meng/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pan/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pinger/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/xuee/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/yue/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/household/li_jiaoer.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/scene/gate_collector.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/new-guofeng.css +1105 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/style.css +2539 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/index.html +18 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/assets.js +147 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/audio.js +332 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/data.js +7472 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/engine.js +13077 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/main.js +3028 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/text.js +32 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/package.json +10 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/vercel.json +23 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/art/generated-art.json +161 -0
- package/lib/novel-to-game/examples/jin-ping-mei/example.json +12 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/README.md +31 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/playable-model.json +99 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/verification.json +41 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/verify_playable_model.mjs +129 -0
- package/lib/novel-to-game/manifest.json +508 -0
- package/lib/novel-to-game/skills/game-art-direction/SKILL.md +73 -0
- package/lib/novel-to-game/skills/game-art-direction/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-art-direction/references/art-direction-method.md +119 -0
- package/lib/novel-to-game/skills/game-build/SKILL.md +84 -0
- package/lib/novel-to-game/skills/game-build/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-build/references/build-brief-contract.md +109 -0
- package/lib/novel-to-game/skills/game-build/references/generative-media-pipeline.md +56 -0
- package/lib/novel-to-game/skills/game-build/references/playable-model-contract.md +81 -0
- package/lib/novel-to-game/skills/game-build/references/tts-production-contract.md +37 -0
- package/lib/novel-to-game/skills/game-concept/SKILL.md +72 -0
- package/lib/novel-to-game/skills/game-concept/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-concept/references/concept-method.md +94 -0
- package/lib/novel-to-game/skills/game-qa/SKILL.md +50 -0
- package/lib/novel-to-game/skills/game-qa/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-qa/references/qa-contract.md +66 -0
- package/lib/novel-to-game/skills/game-qa/references/test-design-method.md +45 -0
- package/lib/novel-to-game/skills/game-world-design/SKILL.md +63 -0
- package/lib/novel-to-game/skills/game-world-design/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-world-design/references/dialogue-design-method.md +59 -0
- package/lib/novel-to-game/skills/game-world-design/references/game-writing-craft.md +53 -0
- package/lib/novel-to-game/skills/game-world-design/references/narrative-design-method.md +84 -0
- package/lib/novel-to-game/skills/game-world-design/references/numeric-design-method.md +56 -0
- package/lib/novel-to-game/skills/game-world-design/references/world-design-method.md +124 -0
- package/lib/novel-to-game/skills/novel-game-analyze/SKILL.md +77 -0
- package/lib/novel-to-game/skills/novel-game-analyze/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/novel-game-analyze/references/gameability-protocol.md +65 -0
- package/lib/novel-to-game/skills/novel-to-game/SKILL.md +71 -0
- package/lib/novel-to-game/skills/novel-to-game/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/novel-to-game/references/intake-benchmark-reference.md +42 -0
- package/lib/novel-to-game/skills/novel-to-game/references/intake-method.md +51 -0
- package/lib/novel-to-game/skills/novel-to-game/references/pipeline-contract.md +65 -0
- package/lib/oh-story/manifest.json +415 -305
- package/lib/oh-story/roles/consistency-checker.md +1 -1
- package/lib/oh-story/roles/narrative-writer.md +32 -33
- package/lib/oh-story/roles/story-architect.md +16 -26
- package/lib/oh-story/skills/browser-cdp/SKILL.md +1 -1
- package/lib/oh-story/skills/story/SKILL.md +16 -9
- package/lib/oh-story/skills/story/VERSION +1 -1
- package/lib/oh-story/skills/story/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-cover/SKILL.md +1 -1
- package/lib/oh-story/skills/story-deslop/SKILL.md +10 -5
- package/lib/oh-story/skills/story-deslop/references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-deslop/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-deslop/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-deslop/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-import/SKILL.md +19 -10
- package/lib/oh-story/skills/story-import/references/format-and-structure.md +9 -10
- package/lib/oh-story/skills/story-import/references/structure-mapping-long.md +2 -2
- package/lib/oh-story/skills/story-import/references/structure-mapping-short.md +1 -1
- package/lib/oh-story/skills/story-import/references/tracking-transaction.md +14 -6
- package/lib/oh-story/skills/story-import/scripts/check-outline-contract.js +251 -0
- package/lib/oh-story/skills/story-import/scripts/tracking_commit.py +98 -9
- package/lib/oh-story/skills/story-import/scripts/wordcount_core.py +246 -0
- package/lib/oh-story/skills/story-long-analyze/SKILL.md +4 -4
- package/lib/oh-story/skills/story-long-scan/SKILL.md +1 -1
- package/lib/oh-story/skills/story-long-write/SKILL.md +35 -21
- package/lib/oh-story/skills/story-long-write/references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-long-write/references/artifact-protocols.md +7 -3
- package/lib/oh-story/skills/story-long-write/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-long-write/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-long-write/references/cross-book-recall.md +6 -6
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/genre-readers.md +1 -1
- package/lib/oh-story/skills/{story-setup/references/agent-references/hooks-chapter.md → story-long-write/references/long-chapter-hooks.md} +5 -5
- package/lib/oh-story/skills/story-long-write/references/{quality-checklist.md → long-chapter-quality.md} +2 -1
- package/lib/oh-story/skills/story-long-write/references/long-format.md +42 -0
- package/lib/oh-story/skills/{story-setup/references/agent-references/genre-catalog.md → story-long-write/references/long-genre-catalog.md} +11 -97
- package/lib/oh-story/skills/{story-setup/references/agent-references/genre-core-mechanics.md → story-long-write/references/long-genre-mechanics.md} +1 -1
- package/lib/oh-story/skills/{story-short-write/references/reversal-toolkit.md → story-long-write/references/long-reversal.md} +18 -32
- package/lib/oh-story/skills/story-long-write/references/{hooks-suspense.md → long-suspense.md} +6 -6
- package/lib/oh-story/skills/story-long-write/references/opening-design.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/outline-structure-theory.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/style-genre-modules.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/tracking-transaction.md +14 -6
- package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +32 -27
- package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +4 -4
- package/lib/oh-story/skills/story-long-write/references/workflow-revision.md +2 -2
- package/lib/oh-story/skills/story-long-write/references/workflow-setup.md +14 -14
- package/lib/oh-story/skills/story-long-write/references/writing-craft.md +54 -54
- package/lib/oh-story/skills/story-long-write/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-long-write/scripts/check-outline-contract.js +251 -0
- package/lib/oh-story/skills/story-long-write/scripts/storyctl.py +303 -0
- package/lib/oh-story/skills/story-long-write/scripts/tracking_commit.py +98 -9
- package/lib/oh-story/skills/story-long-write/scripts/wordcount_core.py +246 -0
- package/lib/oh-story/skills/story-review/SKILL.md +26 -17
- package/lib/oh-story/skills/story-review/references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-review/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-review/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-review/references/{quality-checklist.md → review-quality.md} +22 -21
- package/lib/oh-story/skills/story-review/references/tracking-transaction.md +14 -6
- package/lib/oh-story/skills/story-review/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-review/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-review/scripts/tracking_commit.py +98 -9
- package/lib/oh-story/skills/story-review/scripts/wordcount_core.py +246 -0
- package/lib/oh-story/skills/story-setup/SKILL.md +74 -33
- package/lib/oh-story/skills/story-setup/references/agent-references/agent-quality.md +72 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/agent-reference-profiles.md +55 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-setup/references/agent-references/format-and-structure.md +9 -10
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards.md +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-readers.md +1 -1
- package/lib/oh-story/skills/{story-short-analyze/references/hooks-chapter.md → story-setup/references/agent-references/long-chapter-hooks.md} +5 -5
- package/lib/oh-story/skills/story-setup/references/agent-references/long-emotional-methods.md +209 -0
- package/lib/oh-story/skills/{story-long-write/references/genre-catalog.md → story-setup/references/agent-references/long-genre-catalog.md} +11 -97
- package/lib/oh-story/skills/{story-long-write/references/genre-core-mechanics.md → story-setup/references/agent-references/long-genre-mechanics.md} +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/long-quality.md +40 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/{reversal-toolkit.md → long-reversal.md} +18 -32
- package/lib/oh-story/skills/{story-short-write/references/hooks-suspense.md → story-setup/references/agent-references/long-suspense.md} +6 -6
- package/lib/oh-story/skills/story-setup/references/agent-references/opening-design.md +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/{emotional-methods.md → short-emotional-methods.md} +4 -4
- package/lib/oh-story/skills/{story-long-write/references/genre-writing-formulas.md → story-setup/references/agent-references/short-genre-formulas.md} +32 -44
- package/lib/oh-story/skills/story-setup/references/agent-references/short-quality.md +39 -0
- package/lib/oh-story/skills/{story-long-write/references/reversal-toolkit.md → story-setup/references/agent-references/short-reversal.md} +29 -23
- package/lib/oh-story/skills/story-setup/references/agent-references/{hooks-suspense.md → short-suspense.md} +31 -31
- package/lib/oh-story/skills/story-setup/references/agent-references/style-genre-modules.md +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/writing-craft.md +55 -55
- package/lib/oh-story/skills/story-short-analyze/SKILL.md +28 -28
- package/lib/oh-story/skills/story-short-analyze/references/{character-basics.md → analysis-character-basics.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{character-design-methods.md → analysis-character-design.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{character-relations.md → analysis-character-relations.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{hooks-paragraph.md → analysis-paragraph-hooks.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{genre-readers.md → analysis-reader-profile.md} +2 -2
- package/lib/oh-story/skills/story-short-analyze/references/analysis-report-style.md +45 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-genres.md +65 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-hooks.md +77 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-mechanics.md +82 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-patterns.md +50 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-suspense.md +98 -0
- package/lib/oh-story/skills/story-short-analyze/references/{genre-writing-techniques.md → analysis-writing-techniques.md} +21 -19
- package/lib/oh-story/skills/story-short-analyze/references/deconstruction-examples.md +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/material-decomposition.md +21 -28
- package/lib/oh-story/skills/story-short-analyze/references/output-contract.md +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/output-templates.md +17 -17
- package/lib/oh-story/skills/story-short-analyze/references/{quality-checklist.md → source-story-quality.md} +28 -49
- package/lib/oh-story/skills/story-short-analyze/references/zhihu-style.md +2 -2
- package/lib/oh-story/skills/story-short-scan/SKILL.md +1 -1
- package/lib/oh-story/skills/story-short-write/SKILL.md +78 -55
- package/lib/oh-story/skills/story-short-write/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-short-write/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-short-write/references/cross-book-recall.md +3 -3
- package/lib/oh-story/skills/story-short-write/references/emotional-methods.md +4 -4
- 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
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/217/214/347/224/267/344/270/273.md +2 -2
- 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
- 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
- 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
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/202/254/347/226/221.md +4 -4
- 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
- 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
- package/lib/oh-story/skills/story-short-write/references/genre-styles//347/224/234/345/256/240.md +4 -4
- 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
- package/lib/oh-story/skills/story-short-write/references/genre-writing-formulas.md +32 -44
- package/lib/oh-story/skills/story-short-write/references/genre-writing-techniques.md +20 -18
- package/lib/oh-story/skills/story-short-write/references/output-contract.md +1 -1
- package/lib/oh-story/skills/story-short-write/references/short-craft.md +18 -18
- package/lib/oh-story/skills/story-short-write/references/short-deslop.md +1 -1
- package/lib/oh-story/skills/story-short-write/references/short-format.md +38 -8
- package/lib/oh-story/skills/story-short-write/references/{quality-checklist.md → short-prose-quality.md} +22 -21
- package/lib/oh-story/skills/story-short-write/references/short-reversal.md +355 -0
- package/lib/oh-story/skills/{story-short-analyze/references/hooks-suspense.md → story-short-write/references/short-suspense.md} +31 -31
- package/lib/oh-story/skills/story-short-write/references/submission-craft.md +2 -2
- package/lib/oh-story/skills/story-short-write/references/writing-workflow.md +31 -22
- package/lib/oh-story/skills/story-short-write/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-short-write/scripts/check-delivery-contract.js +212 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-phase2-contract.js +363 -0
- package/lib/types/client/drama-production-view.d.ts +34 -0
- package/lib/types/client/drama-production-view.d.ts.map +1 -0
- package/lib/types/client/drama-production.d.ts +92 -0
- package/lib/types/client/drama-production.d.ts.map +1 -0
- package/lib/types/client/file-activity.d.ts +4 -2
- package/lib/types/client/file-activity.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/production-intents.d.ts +9 -0
- package/lib/types/client/production-intents.d.ts.map +1 -0
- package/lib/types/client/production-prompts.d.ts +9 -0
- package/lib/types/client/production-prompts.d.ts.map +1 -0
- package/lib/types/client/production-runtime.d.ts +58 -0
- package/lib/types/client/production-runtime.d.ts.map +1 -0
- package/lib/types/client/video-studio.d.ts +41 -0
- package/lib/types/client/video-studio.d.ts.map +1 -0
- package/lib/types/client/workbench-ui.d.ts +5 -0
- package/lib/types/client/workbench-ui.d.ts.map +1 -0
- package/lib/types/game-verification.d.ts +16 -0
- package/lib/types/game-verification.d.ts.map +1 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/production-intent.d.ts +21 -0
- package/lib/types/production-intent.d.ts.map +1 -0
- package/lib/types/production-tool.d.ts +5 -0
- package/lib/types/production-tool.d.ts.map +1 -0
- package/lib/types/role-tool.d.ts.map +1 -1
- package/lib/types/skill-provider.d.ts +7 -0
- package/lib/types/skill-provider.d.ts.map +1 -1
- package/lib/types/video-project.d.ts +42 -0
- package/lib/types/video-project.d.ts.map +1 -0
- package/lib/types/workspace-request-trust.d.ts +6 -0
- package/lib/types/workspace-request-trust.d.ts.map +1 -1
- package/lib/types/workspace-route.d.ts +20 -0
- package/lib/types/workspace-route.d.ts.map +1 -1
- package/lib/video-recap/CHANGELOG.md +282 -0
- package/lib/video-recap/LICENSE +21 -0
- package/lib/video-recap/README.en.md +257 -0
- package/lib/video-recap/README.md +255 -0
- package/lib/video-recap/manifest.json +684 -0
- package/lib/video-recap/skills/video-assemble/SKILL.md +97 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/LICENSE.duo-video +21 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/SOURCE.md +15 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_draft_meta_info.json +69 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_segment.json +84 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_video_material.json +98 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_draft.json +204 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_material_video.json +83 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_meta_material_value.json +23 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_project_info.json +133 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_segment.json +70 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_text_styles.json +30 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_audio.json +41 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_text.json +109 -0
- package/lib/video-recap/skills/video-assemble/scripts/artifacts.py +88 -0
- package/lib/video-recap/skills/video-assemble/scripts/assemble.py +345 -0
- package/lib/video-recap/skills/video-assemble/scripts/assemble_constants.py +34 -0
- package/lib/video-recap/skills/video-assemble/scripts/assembly_contract.py +305 -0
- package/lib/video-recap/skills/video-assemble/scripts/assembly_settings.py +94 -0
- package/lib/video-recap/skills/video-assemble/scripts/audio_automation.py +205 -0
- package/lib/video-recap/skills/video-assemble/scripts/audio_mix.py +555 -0
- package/lib/video-recap/skills/video-assemble/scripts/export_jianying.py +261 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_builders.py +767 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_model.py +111 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_optional.py +24 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_schema.py +109 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_templates.py +37 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_timeline_contract.py +191 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_tracks.py +75 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_writer.py +394 -0
- package/lib/video-recap/skills/video-assemble/scripts/lib.py +239 -0
- package/lib/video-recap/skills/video-assemble/scripts/media.py +243 -0
- package/lib/video-recap/skills/video-assemble/scripts/narration_audio.py +477 -0
- package/lib/video-recap/skills/video-assemble/scripts/render_preflight.py +46 -0
- package/lib/video-recap/skills/video-assemble/scripts/source_subtitles.py +486 -0
- package/lib/video-recap/skills/video-assemble/scripts/subtitle_core.py +376 -0
- package/lib/video-recap/skills/video-assemble/scripts/subtitle_render.py +88 -0
- package/lib/video-recap/skills/video-assemble/scripts/timeline.py +248 -0
- package/lib/video-recap/skills/video-assemble/scripts/timeline_emit.py +89 -0
- package/lib/video-recap/skills/video-assemble/scripts/visual_render.py +512 -0
- package/lib/video-recap/skills/video-cut/SKILL.md +90 -0
- package/lib/video-recap/skills/video-cut/scripts/cut.py +67 -0
- package/lib/video-recap/skills/video-cut/scripts/cut_cli.py +320 -0
- package/lib/video-recap/skills/video-cut/scripts/cut_contract.py +545 -0
- package/lib/video-recap/skills/video-cut/scripts/cut_render.py +348 -0
- package/lib/video-recap/skills/video-cut/scripts/lib.py +77 -0
- package/lib/video-recap/skills/video-cut/scripts/media_geometry.py +341 -0
- package/lib/video-recap/skills/video-cut/scripts/narration_mapping.py +249 -0
- package/lib/video-recap/skills/video-cut/scripts/sentence_boundaries.py +745 -0
- package/lib/video-recap/skills/video-recap/SKILL.md +216 -0
- package/lib/video-recap/skills/video-recap/references/config-playbook.md +61 -0
- package/lib/video-recap/skills/video-recap/references/creative-editing-playbook.md +225 -0
- package/lib/video-recap/skills/video-recap/references/data-schema.md +534 -0
- package/lib/video-recap/skills/video-recap/references/research-guide.md +74 -0
- package/lib/video-recap/skills/video-recap/references/shift-left-qc-schema.md +23 -0
- package/lib/video-recap/skills/video-recap/references/timeline-and-jianying.md +251 -0
- package/lib/video-recap/skills/video-recap/scripts/doctor.py +483 -0
- package/lib/video-recap/skills/video-recap/scripts/final_qc.py +737 -0
- package/lib/video-recap/skills/video-recap/scripts/lib.py +242 -0
- package/lib/video-recap/skills/video-recap/scripts/materials.py +457 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc.py +95 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_client.py +18 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_contract.py +9 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_evidence.py +371 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_observations.py +201 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_payload.py +227 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_report.py +362 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_runner.py +129 -0
- package/lib/video-recap/skills/video-recap/scripts/qc_contract.py +338 -0
- package/lib/video-recap/skills/video-recap/scripts/recap.py +9 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_cli.py +140 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_inspect.py +550 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_review.py +77 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_runner.py +654 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_runtime.py +335 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_stage_qc.py +217 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_timeline.py +795 -0
- package/lib/video-recap/skills/video-script/SKILL.md +248 -0
- package/lib/video-recap/skills/video-script/references/creative-editing-playbook.md +225 -0
- package/lib/video-recap/skills/video-script/references/research-guide.md +75 -0
- package/lib/video-recap/skills/video-script/scripts/agent_brief.py +399 -0
- package/lib/video-recap/skills/video-script/scripts/agent_text.py +410 -0
- package/lib/video-recap/skills/video-script/scripts/brief_context.py +403 -0
- package/lib/video-recap/skills/video-script/scripts/brief_inputs.py +332 -0
- package/lib/video-recap/skills/video-script/scripts/brief_timeline.py +442 -0
- package/lib/video-recap/skills/video-script/scripts/deslop_qc.py +237 -0
- package/lib/video-recap/skills/video-script/scripts/evidence_bundle.py +492 -0
- package/lib/video-recap/skills/video-script/scripts/lib.py +327 -0
- package/lib/video-recap/skills/video-script/scripts/narration.py +12 -0
- package/lib/video-recap/skills/video-script/scripts/narration_lint.py +678 -0
- package/lib/video-recap/skills/video-script/scripts/review.py +42 -0
- package/lib/video-recap/skills/video-script/scripts/review_grounding.py +262 -0
- package/lib/video-recap/skills/video-script/scripts/review_response.py +761 -0
- package/lib/video-recap/skills/video-script/scripts/review_runner.py +200 -0
- package/lib/video-recap/skills/video-script/scripts/speech_ownership.py +204 -0
- package/lib/video-recap/skills/video-script/scripts/timeline_fusion.py +199 -0
- package/lib/video-recap/skills/video-script/scripts/validate.py +164 -0
- package/lib/video-recap/skills/video-understanding/SKILL.md +75 -0
- package/lib/video-recap/skills/video-understanding/references/data-schema.md +299 -0
- package/lib/video-recap/skills/video-understanding/references/prompt-templates.md +37 -0
- package/lib/video-recap/skills/video-understanding/references/research-guide.md +74 -0
- package/lib/video-recap/skills/video-understanding/scripts/agent_brief.py +399 -0
- package/lib/video-recap/skills/video-understanding/scripts/agent_text.py +410 -0
- package/lib/video-recap/skills/video-understanding/scripts/asr.py +260 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief.py +12 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief_context.py +403 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief_inputs.py +332 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief_timeline.py +442 -0
- package/lib/video-recap/skills/video-understanding/scripts/consolidate.py +647 -0
- package/lib/video-recap/skills/video-understanding/scripts/deslop_qc.py +237 -0
- package/lib/video-recap/skills/video-understanding/scripts/detect.py +513 -0
- package/lib/video-recap/skills/video-understanding/scripts/extract.py +62 -0
- package/lib/video-recap/skills/video-understanding/scripts/lib.py +470 -0
- package/lib/video-recap/skills/video-understanding/scripts/narration_lint.py +678 -0
- package/lib/video-recap/skills/video-understanding/scripts/speech_ownership.py +204 -0
- package/lib/video-recap/skills/video-understanding/scripts/storyboard.py +507 -0
- package/lib/video-recap/skills/video-understanding/scripts/timeline_fusion.py +199 -0
- package/lib/video-recap/skills/video-understanding/scripts/understand.py +9 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_brief.py +216 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_cache.py +327 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_runner.py +367 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_storyboard.py +162 -0
- package/lib/video-recap/skills/video-understanding/scripts/vlm.py +705 -0
- package/lib/video-recap/skills/video-voiceover/SKILL.md +81 -0
- package/lib/video-recap/skills/video-voiceover/scripts/dub.py +637 -0
- package/lib/video-recap/skills/video-voiceover/scripts/fish_audio.py +109 -0
- package/lib/video-recap/skills/video-voiceover/scripts/lib.py +421 -0
- package/lib/video-recap/skills/video-voiceover/scripts/tts_audio.py +113 -0
- package/lib/video-recap/skills/video-voiceover/scripts/voiceover.py +782 -0
- package/package.json +55 -40
- package/lib/oh-story/skills/story-deslop/scripts/check-outline-copy.js +0 -241
- package/lib/oh-story/skills/story-long-write/references/format-and-structure.md +0 -169
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-writing-formulas.md +0 -444
- package/lib/oh-story/skills/story-setup/references/agent-references/quality-checklist.md +0 -247
- package/lib/oh-story/skills/story-short-analyze/references/anti-ai-writing.md +0 -582
- package/lib/oh-story/skills/story-short-analyze/references/banned-words.md +0 -147
- package/lib/oh-story/skills/story-short-analyze/references/genre-catalog.md +0 -490
- package/lib/oh-story/skills/story-short-analyze/references/genre-core-mechanics.md +0 -425
- package/lib/oh-story/skills/story-short-analyze/references/genre-writing-formulas.md +0 -453
- /package/lib/oh-story/skills/{story-long-write/references/hooks-chapter.md → story-setup/references/agent-references/short-chapter-hooks.md} +0 -0
- /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())
|