@oh-story/dsh 0.1.0
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/LICENSE +21 -0
- package/README.md +38 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +1201 -0
- package/lib/client.js.map +7 -0
- package/lib/drama/LICENSE.upstream +21 -0
- package/lib/drama/manifest.json +1012 -0
- package/lib/drama/skills/short-drama/SKILL.md +153 -0
- package/lib/drama/skills/short-drama/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama/assets/creator-decision.example.jsonl +4 -0
- package/lib/drama/skills/short-drama/assets/production-observation.example.jsonl +2 -0
- package/lib/drama/skills/short-drama/assets/project-template/short-drama.json +36 -0
- package/lib/drama/skills/short-drama/assets/reference-observation.example.jsonl +2 -0
- package/lib/drama/skills/short-drama/references/audience-reveal.md +74 -0
- package/lib/drama/skills/short-drama/references/contract-and-ownership.md +94 -0
- package/lib/drama/skills/short-drama/references/creator-workflow.md +82 -0
- package/lib/drama/skills/short-drama/references/form-cards/Q/347/211/210/350/241/250/350/276/276.md +73 -0
- package/lib/drama/skills/short-drama/references/form-cards//344/272/214/347/273/264/345/212/250/346/200/201/346/274/253.md +74 -0
- package/lib/drama/skills/short-drama/references/form-cards//345/233/275/346/274/253/344/272/214/346/254/241/345/205/203.md +79 -0
- package/lib/drama/skills/short-drama/references/form-cards//345/256/236/346/213/215.md +75 -0
- package/lib/drama/skills/short-drama/references/form-cards//346/260/264/345/242/250/347/254/224/350/247/246.md +85 -0
- package/lib/drama/skills/short-drama/references/form-cards//351/243/216/346/240/274/345/214/226/344/270/211/347/273/264.md +72 -0
- package/lib/drama/skills/short-drama/references/knowhow-index.md +80 -0
- package/lib/drama/skills/short-drama/references/lifecycle-commands.md +130 -0
- package/lib/drama/skills/short-drama/references/look-development.md +52 -0
- package/lib/drama/skills/short-drama/references/pickup-and-alternate.md +58 -0
- package/lib/drama/skills/short-drama/references/production-form-profiles.md +126 -0
- package/lib/drama/skills/short-drama/references/reference-roles.md +142 -0
- package/lib/drama/skills/short-drama/references/runtime-preflight.md +27 -0
- package/lib/drama/skills/short-drama/scripts/project_tool.py +1963 -0
- package/lib/drama/skills/short-drama/scripts/selftest.py +287 -0
- package/lib/drama/skills/short-drama-assets/SKILL.md +187 -0
- package/lib/drama/skills/short-drama-assets/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-assets/assets/character-look.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-assets/assets/continuity.example.jsonl +4 -0
- package/lib/drama/skills/short-drama-assets/assets/decisions.example.jsonl +5 -0
- package/lib/drama/skills/short-drama-assets/assets/location-view.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-assets/assets/occurrences.example.jsonl +5 -0
- package/lib/drama/skills/short-drama-assets/assets/prop-state.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-assets/examples/minimal/characters.jsonl +2 -0
- package/lib/drama/skills/short-drama-assets/examples/minimal/looks.jsonl +2 -0
- package/lib/drama/skills/short-drama-assets/references/asset-review-checklist.md +89 -0
- package/lib/drama/skills/short-drama-assets/references/character-and-look.md +164 -0
- package/lib/drama/skills/short-drama-assets/references/continuity-delta.md +123 -0
- package/lib/drama/skills/short-drama-assets/references/identity-vs-variant.md +146 -0
- package/lib/drama/skills/short-drama-assets/references/location-and-view.md +84 -0
- package/lib/drama/skills/short-drama-assets/references/occurrence-extraction.md +111 -0
- package/lib/drama/skills/short-drama-assets/references/prop-and-state.md +107 -0
- package/lib/drama/skills/short-drama-assets/references/stage-contract.md +136 -0
- package/lib/drama/skills/short-drama-assets/references/voice-direction.md +171 -0
- package/lib/drama/skills/short-drama-assets/scripts/asset_check.py +267 -0
- package/lib/drama/skills/short-drama-assets/scripts/selftest.py +89 -0
- package/lib/drama/skills/short-drama-develop/SKILL.md +157 -0
- package/lib/drama/skills/short-drama-develop/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-develop/assets/adaptation-map.example.jsonl +1 -0
- package/lib/drama/skills/short-drama-develop/assets/creative-brief.md +120 -0
- package/lib/drama/skills/short-drama-develop/assets/episode-map.jsonl +1 -0
- package/lib/drama/skills/short-drama-develop/assets/story-engine.md +181 -0
- package/lib/drama/skills/short-drama-develop/references/adaptation-craft.md +219 -0
- package/lib/drama/skills/short-drama-develop/references/creative-reference-intake.md +57 -0
- package/lib/drama/skills/short-drama-develop/references/director-brief-craft.md +113 -0
- package/lib/drama/skills/short-drama-develop/references/episode-design.md +509 -0
- package/lib/drama/skills/short-drama-develop/references/genre-and-hook-playbook.md +240 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//344/272/262/345/255/220/351/232/220/347/247/230.md +112 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//344/273/231/344/276/240/344/277/256/347/234/237.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/212/250/344/275/234/344/273/273/345/212/241.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/217/244/350/243/205/346/235/203/350/260/213.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/244/215/344/273/207/346/211/223/350/204/270.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//345/256/266/345/272/255/345/205/263/347/263/273.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//346/202/254/347/226/221/350/247/204/345/210/231.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//347/224/237/346/264/273/346/265/201.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//347/240/264/351/225/234/351/207/215/345/234/206.md +109 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//350/201/214/345/234/272/345/226/234/345/211/247.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//350/261/252/351/227/250/345/251/232/346/201/213.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards//350/272/253/344/273/275/351/224/231/344/275/215.md +51 -0
- package/lib/drama/skills/short-drama-develop/references/genre-cards.md +92 -0
- package/lib/drama/skills/short-drama-develop/references/mechanism-loop.md +282 -0
- package/lib/drama/skills/short-drama-develop/references/multi-episode-intake.md +128 -0
- package/lib/drama/skills/short-drama-develop/references/premise-devices.md +211 -0
- package/lib/drama/skills/short-drama-develop/references/reveal-reversal-payoff.md +99 -0
- package/lib/drama/skills/short-drama-develop/references/serial-character-and-memory.md +293 -0
- package/lib/drama/skills/short-drama-develop/references/stage-contract.md +88 -0
- package/lib/drama/skills/short-drama-develop/references/story-craft.md +359 -0
- package/lib/drama/skills/short-drama-develop/scripts/episode_intake.py +699 -0
- package/lib/drama/skills/short-drama-develop/scripts/selftest.py +47 -0
- package/lib/drama/skills/short-drama-image-prompts/SKILL.md +181 -0
- package/lib/drama/skills/short-drama-image-prompts/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/image-prompt-spec.jsonl.md +187 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/image-prompts.md +37 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/lookdev-frame-spec.jsonl.md +128 -0
- package/lib/drama/skills/short-drama-image-prompts/assets/lookdev-prompts.md +31 -0
- package/lib/drama/skills/short-drama-image-prompts/examples/minimal-image-prompt-specs.jsonl +2 -0
- package/lib/drama/skills/short-drama-image-prompts/references/character-and-look.md +154 -0
- package/lib/drama/skills/short-drama-image-prompts/references/common-recipe.md +231 -0
- package/lib/drama/skills/short-drama-image-prompts/references/edit-and-revision.md +122 -0
- package/lib/drama/skills/short-drama-image-prompts/references/location-plate.md +152 -0
- package/lib/drama/skills/short-drama-image-prompts/references/look-and-state-variant.md +96 -0
- package/lib/drama/skills/short-drama-image-prompts/references/lookdev-frame.md +38 -0
- package/lib/drama/skills/short-drama-image-prompts/references/production-sheet-recipes.md +177 -0
- package/lib/drama/skills/short-drama-image-prompts/references/prop-plate.md +140 -0
- package/lib/drama/skills/short-drama-image-prompts/references/review-and-fixtures.md +92 -0
- package/lib/drama/skills/short-drama-image-prompts/references/stage-contract.md +89 -0
- package/lib/drama/skills/short-drama-image-prompts/scripts/image_prompt_check.py +443 -0
- package/lib/drama/skills/short-drama-image-prompts/scripts/selftest.py +93 -0
- package/lib/drama/skills/short-drama-novel-analyze/SKILL.md +245 -0
- package/lib/drama/skills/short-drama-novel-analyze/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-novel-analyze/assets/episode-candidate.example.jsonl +3 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/adaptation-triage.md +116 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/adaptation-value.md +124 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/aggregation-and-entities.md +155 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/chapter-extraction.md +141 -0
- package/lib/drama/skills/short-drama-novel-analyze/references/stage-contract.md +67 -0
- package/lib/drama/skills/short-drama-novel-analyze/scripts/novel_index.py +651 -0
- package/lib/drama/skills/short-drama-novel-analyze/scripts/selftest.py +51 -0
- package/lib/drama/skills/short-drama-produce/SKILL.md +103 -0
- package/lib/drama/skills/short-drama-produce/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-produce/references/adapter-contract.md +140 -0
- package/lib/drama/skills/short-drama-produce/references/providers/gpt-image-2.md +24 -0
- package/lib/drama/skills/short-drama-produce/references/providers/minimax-music.md +25 -0
- package/lib/drama/skills/short-drama-produce/references/providers/seedance.md +40 -0
- package/lib/drama/skills/short-drama-produce/scripts/fixture_adapter.py +60 -0
- package/lib/drama/skills/short-drama-produce/scripts/production_tool.py +1635 -0
- package/lib/drama/skills/short-drama-produce/scripts/provider_adapters.py +964 -0
- package/lib/drama/skills/short-drama-produce/scripts/selftest.py +134 -0
- package/lib/drama/skills/short-drama-review/SKILL.md +178 -0
- package/lib/drama/skills/short-drama-review/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-review/assets/finding-template.jsonl +2 -0
- package/lib/drama/skills/short-drama-review/assets/supersession-decision.example.json +42 -0
- package/lib/drama/skills/short-drama-review/assets/verdict-template.json +32 -0
- package/lib/drama/skills/short-drama-review/examples/minimal-findings.jsonl +2 -0
- package/lib/drama/skills/short-drama-review/examples/minimal-verdict.json +34 -0
- package/lib/drama/skills/short-drama-review/references/anti-template-repair.md +114 -0
- package/lib/drama/skills/short-drama-review/references/production-quality-gates.md +270 -0
- package/lib/drama/skills/short-drama-review/references/project-calibration.md +85 -0
- package/lib/drama/skills/short-drama-review/references/review-method.md +82 -0
- package/lib/drama/skills/short-drama-review/references/rubric-assets-prompts.md +115 -0
- package/lib/drama/skills/short-drama-review/references/rubric-source-analysis.md +108 -0
- package/lib/drama/skills/short-drama-review/references/rubric-story-script.md +164 -0
- package/lib/drama/skills/short-drama-review/references/rubric-visual-motion.md +166 -0
- package/lib/drama/skills/short-drama-review/references/stage-contract.md +87 -0
- package/lib/drama/skills/short-drama-review/scripts/review_check.py +325 -0
- package/lib/drama/skills/short-drama-review/scripts/selftest.py +87 -0
- package/lib/drama/skills/short-drama-storyboard/SKILL.md +264 -0
- package/lib/drama/skills/short-drama-storyboard/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-storyboard/assets/coverage-audition.example.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/assets/coverage-template.json +49 -0
- package/lib/drama/skills/short-drama-storyboard/assets/keyframe-prompts.md +32 -0
- package/lib/drama/skills/short-drama-storyboard/assets/keyframe-template.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/assets/revision-lineage.fragment.json +12 -0
- package/lib/drama/skills/short-drama-storyboard/assets/scene-visual-plan.example.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/assets/shot-template.jsonl +2 -0
- package/lib/drama/skills/short-drama-storyboard/references/blocking-playbooks.md +241 -0
- package/lib/drama/skills/short-drama-storyboard/references/coverage-audition.md +39 -0
- package/lib/drama/skills/short-drama-storyboard/references/keyframe-craft.md +169 -0
- package/lib/drama/skills/short-drama-storyboard/references/production-shot-grammar.md +264 -0
- package/lib/drama/skills/short-drama-storyboard/references/review-and-fixtures.md +70 -0
- package/lib/drama/skills/short-drama-storyboard/references/scene-visual-plan.md +39 -0
- package/lib/drama/skills/short-drama-storyboard/references/screenplay-to-keyframe-example.md +157 -0
- package/lib/drama/skills/short-drama-storyboard/references/shot-craft.md +192 -0
- package/lib/drama/skills/short-drama-storyboard/references/shot-revision-identity.md +29 -0
- package/lib/drama/skills/short-drama-storyboard/references/stage-contract.md +110 -0
- package/lib/drama/skills/short-drama-storyboard/scripts/selftest.py +191 -0
- package/lib/drama/skills/short-drama-storyboard/scripts/storyboard_check.py +824 -0
- package/lib/drama/skills/short-drama-video-prompts/SKILL.md +245 -0
- package/lib/drama/skills/short-drama-video-prompts/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/coverage-scope.fragment.json +21 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/delivery-container.jsonl.md +101 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/motion-spec.jsonl.md +212 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/motion-terminal.example.jsonl +2 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/music-spec.jsonl.md +31 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/performance.fragment.json +38 -0
- package/lib/drama/skills/short-drama-video-prompts/assets/video-prompts.md +46 -0
- package/lib/drama/skills/short-drama-video-prompts/examples/minimal-music-specs.jsonl +2 -0
- package/lib/drama/skills/short-drama-video-prompts/references/camera-audio-continuity.md +240 -0
- package/lib/drama/skills/short-drama-video-prompts/references/delivery-profile.md +255 -0
- package/lib/drama/skills/short-drama-video-prompts/references/generability.md +93 -0
- package/lib/drama/skills/short-drama-video-prompts/references/motion-recipe.md +304 -0
- package/lib/drama/skills/short-drama-video-prompts/references/performance-action-timing.md +191 -0
- package/lib/drama/skills/short-drama-video-prompts/references/production-prompt-grammar.md +312 -0
- package/lib/drama/skills/short-drama-video-prompts/references/review-and-fixtures.md +168 -0
- package/lib/drama/skills/short-drama-video-prompts/references/stage-contract.md +110 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/container_check.py +329 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/motion_timing_check.py +450 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/music_spec_check.py +327 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/selftest.py +82 -0
- package/lib/drama/skills/short-drama-write/SKILL.md +284 -0
- package/lib/drama/skills/short-drama-write/agents/openai.yaml +4 -0
- package/lib/drama/skills/short-drama-write/assets/beats.jsonl +2 -0
- package/lib/drama/skills/short-drama-write/assets/episode-card-standalone.json +120 -0
- package/lib/drama/skills/short-drama-write/assets/episode-card.json +55 -0
- package/lib/drama/skills/short-drama-write/assets/screenplay.md +36 -0
- package/lib/drama/skills/short-drama-write/assets/voice-record-sheet.jsonl.md +89 -0
- package/lib/drama/skills/short-drama-write/references/dialogue-craft.md +519 -0
- package/lib/drama/skills/short-drama-write/references/production-format-dialect.md +273 -0
- package/lib/drama/skills/short-drama-write/references/scene-handoff-capsule.md +51 -0
- package/lib/drama/skills/short-drama-write/references/scene-sound-dramaturgy.md +43 -0
- package/lib/drama/skills/short-drama-write/references/screenplay-format.md +260 -0
- package/lib/drama/skills/short-drama-write/references/script-craft.md +558 -0
- package/lib/drama/skills/short-drama-write/references/stage-contract.md +94 -0
- package/lib/drama/skills/short-drama-write/references/substitutable-realization.md +107 -0
- package/lib/drama/skills/short-drama-write/scripts/duration_estimate.py +309 -0
- package/lib/drama/skills/short-drama-write/scripts/screenplay_index.py +1091 -0
- package/lib/drama/skills/short-drama-write/scripts/selftest.py +229 -0
- package/lib/drama/skills/short-drama-write/scripts/voice_sheet_check.py +416 -0
- package/lib/index.js +756 -0
- package/lib/index.js.map +7 -0
- package/lib/oh-story/LICENSE.upstream +21 -0
- package/lib/oh-story/manifest.json +1351 -0
- package/lib/oh-story/roles/chapter-extractor.md +314 -0
- package/lib/oh-story/roles/character-designer.md +169 -0
- package/lib/oh-story/roles/consistency-checker.md +190 -0
- package/lib/oh-story/roles/narrative-writer.md +294 -0
- package/lib/oh-story/roles/story-architect.md +195 -0
- package/lib/oh-story/roles/story-explorer.md +364 -0
- package/lib/oh-story/roles/story-researcher.md +304 -0
- package/lib/oh-story/skills/browser-cdp/SKILL.md +175 -0
- package/lib/oh-story/skills/story/SKILL.md +116 -0
- package/lib/oh-story/skills/story/VERSION +1 -0
- package/lib/oh-story/skills/story-cover/SKILL.md +327 -0
- package/lib/oh-story/skills/story-cover/references/cover-styles.md +210 -0
- package/lib/oh-story/skills/story-deslop/SKILL.md +445 -0
- package/lib/oh-story/skills/story-deslop/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-deslop/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-outline-copy.js +241 -0
- package/lib/oh-story/skills/story-deslop/scripts/normalize-punctuation.js +410 -0
- package/lib/oh-story/skills/story-import/SKILL.md +634 -0
- package/lib/oh-story/skills/story-import/references/character-state-reverse.md +82 -0
- package/lib/oh-story/skills/story-import/references/format-and-structure.md +169 -0
- package/lib/oh-story/skills/story-import/references/length-routing.md +134 -0
- package/lib/oh-story/skills/story-import/references/state-tracking.md +108 -0
- package/lib/oh-story/skills/story-import/references/structure-mapping-long.md +442 -0
- package/lib/oh-story/skills/story-import/references/structure-mapping-short.md +175 -0
- package/lib/oh-story/skills/story-import/references/tracking-transaction.md +161 -0
- package/lib/oh-story/skills/story-import/scripts/tracking_commit.py +1139 -0
- package/lib/oh-story/skills/story-long-analyze/SKILL.md +329 -0
- package/lib/oh-story/skills/story-long-analyze/references/deconstruction-notes.md +270 -0
- package/lib/oh-story/skills/story-long-analyze/references/material-decomposition.md +530 -0
- package/lib/oh-story/skills/story-long-analyze/references/output-templates.md +559 -0
- package/lib/oh-story/skills/story-long-analyze/references/pipeline-ops.md +80 -0
- package/lib/oh-story/skills/story-long-analyze/references/style-profile-generator.md +149 -0
- package/lib/oh-story/skills/story-long-analyze/references/style-profile-protocol.md +133 -0
- package/lib/oh-story/skills/story-long-scan/SKILL.md +342 -0
- package/lib/oh-story/skills/story-long-scan/references/genre-trends.md +197 -0
- package/lib/oh-story/skills/story-long-scan/references/publishing-guide.md +114 -0
- package/lib/oh-story/skills/story-long-scan/references/reader-profiling.md +105 -0
- package/lib/oh-story/skills/story-long-scan/references/scan-output-format.md +207 -0
- package/lib/oh-story/skills/story-long-scan/references/topic-decision.md +78 -0
- package/lib/oh-story/skills/story-long-write/SKILL.md +327 -0
- package/lib/oh-story/skills/story-long-write/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-long-write/references/artifact-protocols.md +302 -0
- package/lib/oh-story/skills/story-long-write/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-long-write/references/character-basics.md +445 -0
- package/lib/oh-story/skills/story-long-write/references/character-design-methods.md +428 -0
- package/lib/oh-story/skills/story-long-write/references/character-relations.md +385 -0
- package/lib/oh-story/skills/story-long-write/references/commercial-core-methods.md +502 -0
- package/lib/oh-story/skills/story-long-write/references/cross-book-recall.md +62 -0
- package/lib/oh-story/skills/story-long-write/references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-long-write/references/emotional-arc-design.md +426 -0
- package/lib/oh-story/skills/story-long-write/references/emotional-methods.md +209 -0
- package/lib/oh-story/skills/story-long-write/references/female-audience-writing.md +188 -0
- package/lib/oh-story/skills/story-long-write/references/format-and-structure.md +169 -0
- package/lib/oh-story/skills/story-long-write/references/genre-catalog.md +480 -0
- package/lib/oh-story/skills/story-long-write/references/genre-core-mechanics.md +415 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//344/270/234/346/226/271/344/273/231/344/276/240.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//344/274/240/347/273/237/347/216/204/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/216/206/345/217/262/345/217/244/344/273/243.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/216/206/345/217/262/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/217/214/347/224/267/344/270/273.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/217/244/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/217/244/351/243/216/344/270/226/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/245/263/351/242/221/346/202/254/347/226/221.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/245/263/351/242/221/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/256/253/346/226/227/345/256/205/346/226/227.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/271/264/344/273/243.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//345/277/253/347/251/277.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/202/254/347/226/221/347/201/265/345/274/202.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/202/254/347/226/221/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/210/230/347/245/236/350/265/230/345/251/277.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/212/227/346/210/230/350/260/215/346/210/230.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/230/237/345/205/211/347/222/200/347/222/250.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/260/221/345/233/275/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//346/270/270/346/210/217/344/275/223/350/202/262.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/216/204/345/271/273/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/216/204/345/271/273/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/216/260/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//347/247/221/345/271/273/346/234/253/344/270/226.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//350/201/214/345/234/272/345/251/232/346/201/213.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//350/245/277/346/226/271/345/245/207/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//350/261/252/351/227/250/346/200/273/350/243/201.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/344/277/256/347/234/237.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/346/227/245/345/270/270.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/203/275/345/270/202/351/253/230/346/255/246.md +53 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards//351/235/222/346/230/245/347/224/234/345/256/240.md +51 -0
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards.md +91 -0
- package/lib/oh-story/skills/story-long-write/references/genre-readers.md +235 -0
- package/lib/oh-story/skills/story-long-write/references/genre-writing-formulas.md +444 -0
- package/lib/oh-story/skills/story-long-write/references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-long-write/references/hooks-paragraph.md +146 -0
- package/lib/oh-story/skills/story-long-write/references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-long-write/references/opening-design.md +349 -0
- package/lib/oh-story/skills/story-long-write/references/outline-conflict.md +457 -0
- package/lib/oh-story/skills/story-long-write/references/outline-methods.md +287 -0
- package/lib/oh-story/skills/story-long-write/references/outline-rhythm.md +389 -0
- package/lib/oh-story/skills/story-long-write/references/outline-structure-theory.md +326 -0
- package/lib/oh-story/skills/story-long-write/references/plot-core-methods.md +522 -0
- package/lib/oh-story/skills/story-long-write/references/plot-emotion-system.md +354 -0
- package/lib/oh-story/skills/story-long-write/references/plot-frameworks.md +711 -0
- package/lib/oh-story/skills/story-long-write/references/plot-special-topics.md +622 -0
- package/lib/oh-story/skills/story-long-write/references/quality-checklist.md +184 -0
- package/lib/oh-story/skills/story-long-write/references/reader-contract-and-progression.md +109 -0
- package/lib/oh-story/skills/story-long-write/references/reversal-toolkit.md +349 -0
- package/lib/oh-story/skills/story-long-write/references/state-tracking.md +108 -0
- package/lib/oh-story/skills/story-long-write/references/style-combat-face.md +409 -0
- package/lib/oh-story/skills/story-long-write/references/style-craft.md +347 -0
- package/lib/oh-story/skills/story-long-write/references/style-genre-modules.md +510 -0
- package/lib/oh-story/skills/story-long-write/references/tracking-transaction.md +161 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +140 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +171 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-revision.md +99 -0
- package/lib/oh-story/skills/story-long-write/references/workflow-setup.md +284 -0
- package/lib/oh-story/skills/story-long-write/references/writing-craft.md +421 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-outline-copy.js +241 -0
- package/lib/oh-story/skills/story-long-write/scripts/normalize-punctuation.js +410 -0
- package/lib/oh-story/skills/story-long-write/scripts/tracking_commit.py +1139 -0
- package/lib/oh-story/skills/story-review/SKILL.md +483 -0
- package/lib/oh-story/skills/story-review/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-review/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-review/references/character-relations.md +385 -0
- package/lib/oh-story/skills/story-review/references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-review/references/plot-core-methods.md +522 -0
- package/lib/oh-story/skills/story-review/references/quality-checklist.md +250 -0
- package/lib/oh-story/skills/story-review/references/quality-rubric.md +55 -0
- package/lib/oh-story/skills/story-review/references/rubrics/fanqie.md +18 -0
- package/lib/oh-story/skills/story-review/references/rubrics/qidian.md +19 -0
- package/lib/oh-story/skills/story-review/references/rubrics/zhihu.md +20 -0
- package/lib/oh-story/skills/story-review/references/tracking-transaction.md +161 -0
- package/lib/oh-story/skills/story-review/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-review/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-review/scripts/normalize-punctuation.js +410 -0
- package/lib/oh-story/skills/story-review/scripts/tracking_commit.py +1139 -0
- package/lib/oh-story/skills/story-setup/SKILL.md +495 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/character-basics.md +445 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/character-design-methods.md +428 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/character-relations.md +385 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/emotional-arc-design.md +426 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/emotional-methods.md +179 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/format-and-structure.md +169 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-catalog.md +480 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-core-mechanics.md +415 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//344/270/234/346/226/271/344/273/231/344/276/240.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//344/274/240/347/273/237/347/216/204/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/216/206/345/217/262/345/217/244/344/273/243.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/216/206/345/217/262/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/217/214/347/224/267/344/270/273.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/217/244/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/217/244/351/243/216/344/270/226/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/245/263/351/242/221/346/202/254/347/226/221.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/245/263/351/242/221/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/256/253/346/226/227/345/256/205/346/226/227.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/271/264/344/273/243.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//345/277/253/347/251/277.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/202/254/347/226/221/347/201/265/345/274/202.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/202/254/347/226/221/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/210/230/347/245/236/350/265/230/345/251/277.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/212/227/346/210/230/350/260/215/346/210/230.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/230/237/345/205/211/347/222/200/347/222/250.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/260/221/345/233/275/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//346/270/270/346/210/217/344/275/223/350/202/262.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/216/204/345/271/273/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/216/204/345/271/273/350/250/200/346/203/205.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/216/260/350/250/200/350/204/221/346/264/236.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//347/247/221/345/271/273/346/234/253/344/270/226.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//350/201/214/345/234/272/345/251/232/346/201/213.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//350/245/277/346/226/271/345/245/207/345/271/273.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//350/261/252/351/227/250/346/200/273/350/243/201.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/344/277/256/347/234/237.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/346/227/245/345/270/270.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/347/247/215/347/224/260.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/350/204/221/346/264/236.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/203/275/345/270/202/351/253/230/346/255/246.md +53 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards//351/235/222/346/230/245/347/224/234/345/256/240.md +51 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards.md +91 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-readers.md +235 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-writing-formulas.md +444 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/opening-design.md +349 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/outline-conflict.md +457 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/outline-methods.md +287 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/outline-rhythm.md +389 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/plot-core-methods.md +522 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/quality-checklist.md +247 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/reversal-toolkit.md +349 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/style-combat-face.md +409 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/style-genre-modules.md +510 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/writing-craft.md +421 -0
- package/lib/oh-story/skills/story-short-analyze/SKILL.md +278 -0
- package/lib/oh-story/skills/story-short-analyze/references/anti-ai-writing.md +582 -0
- package/lib/oh-story/skills/story-short-analyze/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-short-analyze/references/character-basics.md +453 -0
- package/lib/oh-story/skills/story-short-analyze/references/character-design-methods.md +438 -0
- package/lib/oh-story/skills/story-short-analyze/references/character-relations.md +395 -0
- package/lib/oh-story/skills/story-short-analyze/references/deconstruction-examples.md +79 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-catalog.md +490 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-core-mechanics.md +425 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-readers.md +245 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-writing-formulas.md +453 -0
- package/lib/oh-story/skills/story-short-analyze/references/genre-writing-techniques.md +475 -0
- package/lib/oh-story/skills/story-short-analyze/references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-short-analyze/references/hooks-paragraph.md +146 -0
- package/lib/oh-story/skills/story-short-analyze/references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-short-analyze/references/material-decomposition.md +685 -0
- package/lib/oh-story/skills/story-short-analyze/references/output-contract.md +165 -0
- package/lib/oh-story/skills/story-short-analyze/references/output-templates.md +561 -0
- package/lib/oh-story/skills/story-short-analyze/references/quality-checklist.md +242 -0
- package/lib/oh-story/skills/story-short-analyze/references/real-market-data.md +90 -0
- package/lib/oh-story/skills/story-short-analyze/references/zhihu-style.md +54 -0
- package/lib/oh-story/skills/story-short-scan/SKILL.md +212 -0
- package/lib/oh-story/skills/story-short-scan/references/real-market-data.md +90 -0
- package/lib/oh-story/skills/story-short-write/SKILL.md +433 -0
- package/lib/oh-story/skills/story-short-write/references/banned-words.md +147 -0
- package/lib/oh-story/skills/story-short-write/references/cross-book-recall.md +62 -0
- package/lib/oh-story/skills/story-short-write/references/dialogue-mastery.md +282 -0
- package/lib/oh-story/skills/story-short-write/references/emotional-methods.md +179 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//344/270/226/346/203/205/346/211/223/350/204/270.md +159 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/217/214/347/224/267/344/270/273.md +156 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/244/215/344/273/207/346/211/223/350/204/270.md +163 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/256/205/346/226/227/345/256/253/346/226/227.md +167 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/200/273/350/243/201/350/261/252/351/227/250.md +178 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/202/254/347/226/221.md +166 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/260/221/344/277/227/346/200/252/350/260/210.md +159 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/262/231/351/233/225/350/204/221/346/264/236.md +151 -0
- package/lib/oh-story/skills/story-short-write/references/genre-styles//347/224/234/345/256/240.md +153 -0
- 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 +210 -0
- package/lib/oh-story/skills/story-short-write/references/genre-writing-formulas.md +444 -0
- package/lib/oh-story/skills/story-short-write/references/genre-writing-techniques.md +488 -0
- package/lib/oh-story/skills/story-short-write/references/hooks-chapter.md +225 -0
- package/lib/oh-story/skills/story-short-write/references/hooks-paragraph.md +146 -0
- package/lib/oh-story/skills/story-short-write/references/hooks-suspense.md +352 -0
- package/lib/oh-story/skills/story-short-write/references/output-contract.md +165 -0
- package/lib/oh-story/skills/story-short-write/references/quality-checklist.md +222 -0
- package/lib/oh-story/skills/story-short-write/references/reversal-toolkit.md +349 -0
- package/lib/oh-story/skills/story-short-write/references/short-craft.md +185 -0
- package/lib/oh-story/skills/story-short-write/references/short-deslop.md +133 -0
- package/lib/oh-story/skills/story-short-write/references/short-format.md +167 -0
- package/lib/oh-story/skills/story-short-write/references/submission-craft.md +35 -0
- package/lib/oh-story/skills/story-short-write/references/villain-and-reveal.md +158 -0
- package/lib/oh-story/skills/story-short-write/references/writing-workflow.md +153 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-ai-patterns.js +1371 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-degeneration.js +330 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-outline-copy.js +241 -0
- package/lib/oh-story/skills/story-short-write/scripts/normalize-punctuation.js +410 -0
- package/lib/types/client/file-activity.d.ts +30 -0
- package/lib/types/client/file-activity.d.ts.map +1 -0
- package/lib/types/client/file-tree.d.ts +20 -0
- package/lib/types/client/file-tree.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +12 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/jsonl-preview.d.ts +15 -0
- package/lib/types/client/jsonl-preview.d.ts.map +1 -0
- package/lib/types/client/markdown-preview.d.ts +38 -0
- package/lib/types/client/markdown-preview.d.ts.map +1 -0
- package/lib/types/index.d.ts +25 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/native-hooks.d.ts +16 -0
- package/lib/types/native-hooks.d.ts.map +1 -0
- package/lib/types/role-provider.d.ts +6 -0
- package/lib/types/role-provider.d.ts.map +1 -0
- package/lib/types/role-tool.d.ts +10 -0
- package/lib/types/role-tool.d.ts.map +1 -0
- package/lib/types/skill-provider.d.ts +15 -0
- package/lib/types/skill-provider.d.ts.map +1 -0
- package/lib/types/workspace-request-trust.d.ts +13 -0
- package/lib/types/workspace-request-trust.d.ts.map +1 -0
- package/lib/types/workspace-route.d.ts +10 -0
- package/lib/types/workspace-route.d.ts.map +1 -0
- package/lib/types/workspace-security.d.ts +9 -0
- package/lib/types/workspace-security.d.ts.map +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Validate standalone image-prompt specs without generating media."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import re
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any, NamedTuple
|
|
12
|
+
|
|
13
|
+
MINIMUM_PYTHON = (3, 9)
|
|
14
|
+
if sys.version_info < MINIMUM_PYTHON:
|
|
15
|
+
raise SystemExit("image_prompt_check.py requires Python 3.9 or newer")
|
|
16
|
+
|
|
17
|
+
# ---------------------------------------------------------------------------
|
|
18
|
+
# REFERENCE RESOLVER -- reference implementation.
|
|
19
|
+
#
|
|
20
|
+
# Each skill checker carries its own copy of this block. The suite has no shared
|
|
21
|
+
# library on purpose: a skill must stay runnable after copying only its own
|
|
22
|
+
# directory, so duplicating these few lines across skills is the correct shape.
|
|
23
|
+
# Copy the block verbatim; do not import it.
|
|
24
|
+
# ---------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
SOURCES_RECORD_TYPE = "sources"
|
|
27
|
+
SOURCES_SCHEMA_VERSION = "1.0.0"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ResolvedRef(NamedTuple):
|
|
31
|
+
"""An upstream reference with its snapshot resolved, whichever form it used."""
|
|
32
|
+
|
|
33
|
+
owner: str
|
|
34
|
+
artifact: str
|
|
35
|
+
record_id: str | None
|
|
36
|
+
field: str | None
|
|
37
|
+
authority: str | None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class RefFinding(NamedTuple):
|
|
41
|
+
"""A structural defect in a reference object."""
|
|
42
|
+
|
|
43
|
+
code: str
|
|
44
|
+
location: str
|
|
45
|
+
detail: str
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def load_sources(document: Any) -> dict[str, dict[str, Any]]:
|
|
49
|
+
"""Return the ``sources`` declaration of a parsed file, or ``{}`` if absent.
|
|
50
|
+
|
|
51
|
+
Accepts a parsed ``.json`` document (a dict) or the parsed record list of a
|
|
52
|
+
``.jsonl`` file, whose declaration lives on the first record.
|
|
53
|
+
"""
|
|
54
|
+
if isinstance(document, list):
|
|
55
|
+
document = document[0] if document else None
|
|
56
|
+
if not isinstance(document, dict):
|
|
57
|
+
return {}
|
|
58
|
+
declared = document.get("sources")
|
|
59
|
+
if not isinstance(declared, dict):
|
|
60
|
+
return {}
|
|
61
|
+
return {key: value for key, value in declared.items() if isinstance(value, dict)}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def resolve_ref(
|
|
65
|
+
ref: Any, sources: dict[str, dict[str, Any]], location: str
|
|
66
|
+
) -> tuple[ResolvedRef | None, RefFinding | None]:
|
|
67
|
+
"""Resolve a reference object written in either the compact or expanded form."""
|
|
68
|
+
if not isinstance(ref, dict):
|
|
69
|
+
return None, RefFinding("REF_IS_NOT_AN_OBJECT", location, f"got {type(ref).__name__}")
|
|
70
|
+
src = ref.get("src")
|
|
71
|
+
if isinstance(src, str):
|
|
72
|
+
entry = sources.get(src)
|
|
73
|
+
if entry is None:
|
|
74
|
+
return None, RefFinding(
|
|
75
|
+
"REF_SRC_IS_NOT_DECLARED", location, f"src {src!r} has no sources entry"
|
|
76
|
+
)
|
|
77
|
+
owner, artifact = entry.get("owner"), entry.get("artifact")
|
|
78
|
+
if not (isinstance(owner, str) and isinstance(artifact, str)):
|
|
79
|
+
return None, RefFinding(
|
|
80
|
+
"SOURCE_ENTRY_IS_INCOMPLETE", location, f"sources[{src!r}] needs owner/artifact"
|
|
81
|
+
)
|
|
82
|
+
elif all(isinstance(ref.get(key), str) for key in ("owner", "artifact")):
|
|
83
|
+
owner, artifact = ref["owner"], ref["artifact"]
|
|
84
|
+
else:
|
|
85
|
+
return None, RefFinding(
|
|
86
|
+
"REF_HAS_NO_UPSTREAM_BINDING", location, "needs src, or owner+artifact"
|
|
87
|
+
)
|
|
88
|
+
optional = {
|
|
89
|
+
key: ref[key] for key in ("record_id", "field", "authority") if isinstance(ref.get(key), str)
|
|
90
|
+
}
|
|
91
|
+
return (
|
|
92
|
+
ResolvedRef(
|
|
93
|
+
owner,
|
|
94
|
+
artifact,
|
|
95
|
+
optional.get("record_id"),
|
|
96
|
+
optional.get("field"),
|
|
97
|
+
optional.get("authority"),
|
|
98
|
+
),
|
|
99
|
+
None,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# ---------------------------------------------------------------------------
|
|
104
|
+
# END REFERENCE RESOLVER
|
|
105
|
+
# ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
SKILL_ROOT = Path(__file__).resolve().parents[1]
|
|
108
|
+
HASH_RE = re.compile(r"[0-9a-f]{64}")
|
|
109
|
+
# `common-recipe.md` forbids weight syntax and any one engine's control words, and
|
|
110
|
+
# `keyframe-craft.md` rejects "cinematic, 8K, masterpiece" as a substitute for
|
|
111
|
+
# subject identity. A generic prompt that carries them has stopped being generic.
|
|
112
|
+
ENGINE_SYNTAX_RE = re.compile(
|
|
113
|
+
r"(?:^|[\s,,((])--(?:ar|v|q|niji|style|no|seed|cref|sref)\b"
|
|
114
|
+
r"|::-?\d"
|
|
115
|
+
# Weight syntax is written (x:1.2); prose writes "(aperture: 1.8)" with a space.
|
|
116
|
+
r"|:[01]\.\d\s*[))]"
|
|
117
|
+
# Quality words only count in a tag slot. A 4K monitor in shot is content.
|
|
118
|
+
r"|(?:^|,\s*)(?:8k|4k|uhd)\s*(?=,|$)"
|
|
119
|
+
r"|(?:^|,\s*)(?:masterpiece|best quality|ultra[- ]detailed|trending on artstation)\s*(?=,|$)",
|
|
120
|
+
re.IGNORECASE,
|
|
121
|
+
)
|
|
122
|
+
PURPOSES = {
|
|
123
|
+
"character_sheet",
|
|
124
|
+
"location_plate",
|
|
125
|
+
"prop_plate",
|
|
126
|
+
"look_state_variant",
|
|
127
|
+
"edit_delta",
|
|
128
|
+
"lookdev_frame",
|
|
129
|
+
}
|
|
130
|
+
VENDOR_FIELDS = {
|
|
131
|
+
"authorization",
|
|
132
|
+
"credential",
|
|
133
|
+
"credentials",
|
|
134
|
+
"model",
|
|
135
|
+
"model_id",
|
|
136
|
+
"model_name",
|
|
137
|
+
"provider",
|
|
138
|
+
"provider_id",
|
|
139
|
+
"api_key",
|
|
140
|
+
"task_id",
|
|
141
|
+
"remote_id",
|
|
142
|
+
"access_token",
|
|
143
|
+
"token",
|
|
144
|
+
"secret",
|
|
145
|
+
"password",
|
|
146
|
+
}
|
|
147
|
+
NORMALIZED_VENDOR_FIELDS = {re.sub(r"[^a-z0-9]", "", key) for key in VENDOR_FIELDS}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# The source policy -> render treatment mapping from `common-recipe.md`. A
|
|
151
|
+
# treatment outside its policy's row is a structural defect: the fix is a
|
|
152
|
+
# creator override that changes the accepted policy, never a quiet widening here.
|
|
153
|
+
ALLOWED_TREATMENTS = {
|
|
154
|
+
"exact_readable": {"readable", "postproduction"},
|
|
155
|
+
"graphic_only": {"symbolic"},
|
|
156
|
+
"no_readable_text": {"blank", "symbolic"},
|
|
157
|
+
"pending_creator_text": {"postproduction"},
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# A blanket "no text in the image" instruction, however it is phrased. Matching
|
|
161
|
+
# two literals (`no text` / `无文字`) let the reference document's own worked
|
|
162
|
+
# counter-example through: `画面中不要任何文字` contains neither.
|
|
163
|
+
NO_TEXT_CONSTRAINT = re.compile(
|
|
164
|
+
r"(无任何(文字|字|文本)|无文字|不要(任何)?(文字|字|文本)|不出现(任何)?(文字|字)"
|
|
165
|
+
r"|没有(任何)?(文字|字)|不含(任何)?(文字|字)|禁止(出现)?(文字|字)"
|
|
166
|
+
r"|no\s+(visible\s+)?(text|lettering|writing|words|typography)"
|
|
167
|
+
r"|without\s+(any\s+)?text|text[-\s]free)",
|
|
168
|
+
re.IGNORECASE,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class ValidationError(ValueError):
|
|
173
|
+
pass
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def resolve_input(value: str | Path) -> Path:
|
|
177
|
+
path = Path(value).expanduser()
|
|
178
|
+
if path.exists() or path.is_absolute():
|
|
179
|
+
return path
|
|
180
|
+
return SKILL_ROOT / path
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def load_jsonl(value: str | Path) -> tuple[dict[str, dict[str, Any]], list[dict[str, Any]]]:
|
|
184
|
+
"""Return the file's ``sources`` declaration and its prompt-spec records.
|
|
185
|
+
|
|
186
|
+
A leading ``{"record_type": "sources", ...}`` header declares the upstream
|
|
187
|
+
snapshots the specs point at; it is not a spec and never counts as one.
|
|
188
|
+
"""
|
|
189
|
+
path = resolve_input(value)
|
|
190
|
+
records: list[dict[str, Any]] = []
|
|
191
|
+
for number, line in enumerate(path.read_text(encoding="utf-8").splitlines(), 1):
|
|
192
|
+
if not line.strip():
|
|
193
|
+
continue
|
|
194
|
+
try:
|
|
195
|
+
record = json.loads(line)
|
|
196
|
+
except json.JSONDecodeError as exc:
|
|
197
|
+
raise ValidationError(f"{path}:{number}: invalid JSON") from exc
|
|
198
|
+
if not isinstance(record, dict):
|
|
199
|
+
raise ValidationError(f"{path}:{number}: each record must be an object")
|
|
200
|
+
records.append(record)
|
|
201
|
+
sources: dict[str, dict[str, Any]] = {}
|
|
202
|
+
if records and records[0].get("record_type") == SOURCES_RECORD_TYPE:
|
|
203
|
+
header = records.pop(0)
|
|
204
|
+
if not isinstance(header.get("sources"), dict):
|
|
205
|
+
raise ValidationError(f"{path}: the sources header must declare a sources object")
|
|
206
|
+
sources = load_sources(header)
|
|
207
|
+
if not records:
|
|
208
|
+
raise ValidationError(f"{path}: no prompt specs")
|
|
209
|
+
return sources, records
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def text(record: dict[str, Any], key: str, label: str) -> str:
|
|
213
|
+
value = record.get(key)
|
|
214
|
+
if not isinstance(value, str) or not value.strip():
|
|
215
|
+
raise ValidationError(f"{label}: {key} must be non-empty text")
|
|
216
|
+
return value
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def nonempty_list(record: dict[str, Any], key: str, label: str) -> list[Any]:
|
|
220
|
+
value = record.get(key)
|
|
221
|
+
if not isinstance(value, list) or not value:
|
|
222
|
+
raise ValidationError(f"{label}: {key} must be a non-empty list")
|
|
223
|
+
return value
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def validate_ref(
|
|
227
|
+
value: Any,
|
|
228
|
+
sources: dict[str, dict[str, Any]],
|
|
229
|
+
label: str,
|
|
230
|
+
*,
|
|
231
|
+
field_allowed: bool = True,
|
|
232
|
+
) -> None:
|
|
233
|
+
if not isinstance(value, dict):
|
|
234
|
+
raise ValidationError(f"{label}: reference must be an object")
|
|
235
|
+
resolved, finding = resolve_ref(value, sources, label)
|
|
236
|
+
if finding is not None:
|
|
237
|
+
raise ValidationError(f"{label}: {finding.code}: {finding.detail}")
|
|
238
|
+
if resolved is None:
|
|
239
|
+
raise ValidationError(f"{label}: reference could not be resolved")
|
|
240
|
+
if not resolved.owner.strip() or not resolved.artifact.strip():
|
|
241
|
+
raise ValidationError(f"{label}: owner and artifact must be non-empty text")
|
|
242
|
+
if "record_id" not in value and (not field_allowed or "field" not in value):
|
|
243
|
+
raise ValidationError(f"{label}: record_id or field is required")
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def validate_reference_bindings(
|
|
247
|
+
record: dict[str, Any], sources: dict[str, dict[str, Any]], label: str
|
|
248
|
+
) -> None:
|
|
249
|
+
bindings = record.get("reference_bindings", [])
|
|
250
|
+
if not isinstance(bindings, list):
|
|
251
|
+
raise ValidationError(f"{label}: reference_bindings must be a list")
|
|
252
|
+
slots: set[str] = set()
|
|
253
|
+
orders: set[int] = set()
|
|
254
|
+
for index, binding in enumerate(bindings, 1):
|
|
255
|
+
item = f"{label}.reference_bindings[{index}]"
|
|
256
|
+
if not isinstance(binding, dict):
|
|
257
|
+
raise ValidationError(f"{item}: binding must be an object")
|
|
258
|
+
slot = text(binding, "slot_id", item)
|
|
259
|
+
order = binding.get("order")
|
|
260
|
+
if slot in slots:
|
|
261
|
+
raise ValidationError(f"{item}: duplicate slot_id {slot}")
|
|
262
|
+
if not isinstance(order, int) or order < 1 or order in orders:
|
|
263
|
+
raise ValidationError(f"{item}: order must be a unique positive integer")
|
|
264
|
+
slots.add(slot)
|
|
265
|
+
orders.add(order)
|
|
266
|
+
validate_ref(binding.get("artifact_ref"), sources, f"{item}.artifact_ref")
|
|
267
|
+
text(binding, "role", item)
|
|
268
|
+
nonempty_list(binding, "may_control", item)
|
|
269
|
+
nonempty_list(binding, "must_not_control", item)
|
|
270
|
+
admission = binding.get("admission_status")
|
|
271
|
+
if admission not in {"unverified", "creator_described", "visually_inspected"}:
|
|
272
|
+
raise ValidationError(f"{item}: invalid admission_status")
|
|
273
|
+
if admission == "unverified" and not binding.get("unresolved_risks"):
|
|
274
|
+
raise ValidationError(f"{item}: unverified references need unresolved_risks")
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def vendor_field_paths(value: object, prefix: str = "") -> list[str]:
|
|
278
|
+
leaked: list[str] = []
|
|
279
|
+
if isinstance(value, dict):
|
|
280
|
+
for key, child in value.items():
|
|
281
|
+
name = str(key)
|
|
282
|
+
path = f"{prefix}.{name}" if prefix else name
|
|
283
|
+
normalized = re.sub(r"[^a-z0-9]", "", name.casefold())
|
|
284
|
+
if normalized in NORMALIZED_VENDOR_FIELDS:
|
|
285
|
+
leaked.append(path)
|
|
286
|
+
leaked.extend(vendor_field_paths(child, path))
|
|
287
|
+
elif isinstance(value, list):
|
|
288
|
+
for index, child in enumerate(value):
|
|
289
|
+
leaked.extend(vendor_field_paths(child, f"{prefix}[{index}]"))
|
|
290
|
+
return leaked
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def validate_asset_spec(
|
|
294
|
+
record: dict[str, Any], sources: dict[str, dict[str, Any]], label: str
|
|
295
|
+
) -> None:
|
|
296
|
+
binding = record.get("asset_binding")
|
|
297
|
+
if not isinstance(binding, dict):
|
|
298
|
+
raise ValidationError(f"{label}: asset_binding must be an object")
|
|
299
|
+
validate_ref(binding.get("identity_ref"), sources, f"{label}.asset_binding.identity_ref")
|
|
300
|
+
validate_ref(binding.get("variant_ref"), sources, f"{label}.asset_binding.variant_ref")
|
|
301
|
+
for index, ref in enumerate(nonempty_list(record, "source_refs", label), 1):
|
|
302
|
+
validate_ref(ref, sources, f"{label}.source_refs[{index}]")
|
|
303
|
+
nonempty_list(record, "identity_or_form_anchors", label)
|
|
304
|
+
|
|
305
|
+
if record["purpose"] == "edit_delta":
|
|
306
|
+
edit = record.get("edit")
|
|
307
|
+
if not isinstance(edit, dict):
|
|
308
|
+
raise ValidationError(f"{label}: edit_delta requires edit")
|
|
309
|
+
validate_ref(edit.get("target_ref"), sources, f"{label}.edit.target_ref")
|
|
310
|
+
nonempty_list(edit, "changes", f"{label}.edit")
|
|
311
|
+
nonempty_list(edit, "preserve", f"{label}.edit")
|
|
312
|
+
text(edit, "continuity_impact", f"{label}.edit")
|
|
313
|
+
|
|
314
|
+
handling = record.get("text_handling")
|
|
315
|
+
if isinstance(handling, dict):
|
|
316
|
+
if "source_policy_ref" in handling:
|
|
317
|
+
validate_ref(
|
|
318
|
+
handling.get("source_policy_ref"),
|
|
319
|
+
sources,
|
|
320
|
+
f"{label}.text_handling.source_policy_ref",
|
|
321
|
+
)
|
|
322
|
+
treatment = handling.get("render_treatment")
|
|
323
|
+
if not isinstance(treatment, dict):
|
|
324
|
+
raise ValidationError(f"{label}: text_handling.render_treatment is required")
|
|
325
|
+
# `common-recipe.md` gives the source policy -> render treatment mapping
|
|
326
|
+
# as a structural check. Nothing implemented it, so a prop whose accepted
|
|
327
|
+
# policy is `no_readable_text` could ask for readable lettering and come
|
|
328
|
+
# back `valid` -- inventing a name or a number the creator never accepted.
|
|
329
|
+
source_mode = handling.get("source_mode")
|
|
330
|
+
allowed = (
|
|
331
|
+
ALLOWED_TREATMENTS.get(source_mode)
|
|
332
|
+
if isinstance(source_mode, str)
|
|
333
|
+
else None
|
|
334
|
+
)
|
|
335
|
+
mode = treatment.get("mode")
|
|
336
|
+
if allowed is not None and mode not in allowed:
|
|
337
|
+
raise ValidationError(
|
|
338
|
+
f"{label}: text policy {source_mode!r} allows "
|
|
339
|
+
f"{' or '.join(sorted(allowed))}, not {mode!r}; a creator "
|
|
340
|
+
f"override must change the policy rather than the treatment"
|
|
341
|
+
)
|
|
342
|
+
if source_mode == "exact_readable" and mode == "readable":
|
|
343
|
+
text(treatment, "exact_text", f"{label}.text_handling.render_treatment")
|
|
344
|
+
negatives = " ".join(str(item) for item in record.get("negative_constraints", []))
|
|
345
|
+
if NO_TEXT_CONSTRAINT.search(negatives):
|
|
346
|
+
raise ValidationError(f"{label}: readable text conflicts with a no-text constraint")
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
def validate_lookdev_spec(
|
|
350
|
+
record: dict[str, Any], sources: dict[str, dict[str, Any]], label: str
|
|
351
|
+
) -> None:
|
|
352
|
+
validate_ref(record.get("direction_ref"), sources, f"{label}.direction_ref")
|
|
353
|
+
validate_ref(record.get("production_profile_ref"), sources, f"{label}.production_profile_ref")
|
|
354
|
+
subjects = nonempty_list(record, "subject_bindings", label)
|
|
355
|
+
for index, subject in enumerate(subjects, 1):
|
|
356
|
+
if not isinstance(subject, dict):
|
|
357
|
+
raise ValidationError(f"{label}.subject_bindings[{index}]: must be an object")
|
|
358
|
+
item = f"{label}.subject_bindings[{index}]"
|
|
359
|
+
validate_ref(subject.get("identity_ref"), sources, f"{item}.identity_ref")
|
|
360
|
+
if "variant_ref" in subject:
|
|
361
|
+
validate_ref(subject.get("variant_ref"), sources, f"{item}.variant_ref")
|
|
362
|
+
text(subject, "role", item)
|
|
363
|
+
text(record, "test_question", label)
|
|
364
|
+
nonempty_list(record, "stable_visual_rules", label)
|
|
365
|
+
if record.get("lookdev_axis") == "high_pressure_scene":
|
|
366
|
+
refs = nonempty_list(record, "story_context_refs", label)
|
|
367
|
+
for index, ref in enumerate(refs, 1):
|
|
368
|
+
validate_ref(ref, sources, f"{label}.story_context_refs[{index}]")
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
def validate_records(
|
|
372
|
+
records: list[dict[str, Any]], sources: dict[str, dict[str, Any]] | None = None
|
|
373
|
+
) -> dict[str, Any]:
|
|
374
|
+
sources = sources or {}
|
|
375
|
+
identifiers: set[str] = set()
|
|
376
|
+
for index, record in enumerate(records, 1):
|
|
377
|
+
label = f"spec[{index}]"
|
|
378
|
+
spec_id = text(record, "spec_id", label)
|
|
379
|
+
if spec_id in identifiers:
|
|
380
|
+
raise ValidationError(f"{label}: duplicate spec_id {spec_id}")
|
|
381
|
+
identifiers.add(spec_id)
|
|
382
|
+
purpose = record.get("purpose")
|
|
383
|
+
if purpose not in PURPOSES:
|
|
384
|
+
raise ValidationError(
|
|
385
|
+
f"{label}: invalid purpose {purpose!r}; "
|
|
386
|
+
f"use one of {', '.join(sorted(PURPOSES))}"
|
|
387
|
+
)
|
|
388
|
+
if record.get("status") not in {"candidate", "accepted"}:
|
|
389
|
+
raise ValidationError(f"{label}: status must be candidate or accepted")
|
|
390
|
+
leaked = sorted(vendor_field_paths(record))
|
|
391
|
+
if leaked:
|
|
392
|
+
raise ValidationError(f"{label}: provider execution fields are forbidden: {', '.join(leaked)}")
|
|
393
|
+
prompt = text(record, "generic_prompt", label)
|
|
394
|
+
if HASH_RE.search(prompt) or "<sha256>" in prompt:
|
|
395
|
+
raise ValidationError(f"{label}: generic_prompt leaks internal hashes")
|
|
396
|
+
engine_syntax = ENGINE_SYNTAX_RE.search(prompt)
|
|
397
|
+
if engine_syntax:
|
|
398
|
+
raise ValidationError(
|
|
399
|
+
f"{label}: generic_prompt carries engine-specific syntax "
|
|
400
|
+
f"{engine_syntax.group(0).strip()!r}; keep it in a provider adapter"
|
|
401
|
+
)
|
|
402
|
+
validate_reference_bindings(record, sources, label)
|
|
403
|
+
if purpose == "lookdev_frame":
|
|
404
|
+
validate_lookdev_spec(record, sources, label)
|
|
405
|
+
else:
|
|
406
|
+
validate_asset_spec(record, sources, label)
|
|
407
|
+
return {
|
|
408
|
+
"status": "valid",
|
|
409
|
+
"specs": len(records),
|
|
410
|
+
"sources": len(sources),
|
|
411
|
+
"checks": [
|
|
412
|
+
"unique_ids",
|
|
413
|
+
"accepted_bindings",
|
|
414
|
+
# Named for what it does: every reference names a snapshot this
|
|
415
|
+
# file declares. Whether that record exists in the target artifact
|
|
416
|
+
# is not knowable here -- the checker is handed this file only.
|
|
417
|
+
"source_declaration",
|
|
418
|
+
"reference_slots",
|
|
419
|
+
"prompt_hygiene",
|
|
420
|
+
],
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
def validate_file(path: str | Path) -> dict[str, Any]:
|
|
425
|
+
sources, records = load_jsonl(path)
|
|
426
|
+
return validate_records(records, sources)
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def main() -> int:
|
|
430
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
431
|
+
parser.add_argument("specs")
|
|
432
|
+
args = parser.parse_args()
|
|
433
|
+
try:
|
|
434
|
+
result = validate_file(args.specs)
|
|
435
|
+
except (OSError, ValidationError) as exc:
|
|
436
|
+
print(f"image prompt check failed: {exc}", file=sys.stderr)
|
|
437
|
+
return 2
|
|
438
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
439
|
+
return 0
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
if __name__ == "__main__":
|
|
443
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Offline self-test for the standalone image-prompt checker."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import copy
|
|
7
|
+
import sys
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from image_prompt_check import SKILL_ROOT, ValidationError, load_jsonl, validate_records
|
|
11
|
+
|
|
12
|
+
MINIMUM_PYTHON = (3, 9)
|
|
13
|
+
if sys.version_info < MINIMUM_PYTHON:
|
|
14
|
+
raise SystemExit("selftest.py requires Python 3.9 or newer")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def require(condition: bool, message: str) -> None:
|
|
18
|
+
if not condition:
|
|
19
|
+
raise AssertionError(message)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def fail(records: list[dict[str, Any]], sources: dict[str, dict[str, Any]], marker: str) -> None:
|
|
23
|
+
try:
|
|
24
|
+
validate_records(records, sources)
|
|
25
|
+
except ValidationError as exc:
|
|
26
|
+
require(marker in str(exc), f"expected {marker!r}, got {exc!s}")
|
|
27
|
+
else:
|
|
28
|
+
raise AssertionError(f"expected failure containing {marker!r}")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def expanded(ref: dict[str, Any], sources: dict[str, dict[str, Any]]) -> dict[str, Any]:
|
|
32
|
+
entry = sources[ref["src"]]
|
|
33
|
+
inline = {key: entry[key] for key in ("owner", "artifact")}
|
|
34
|
+
inline.update({key: value for key, value in ref.items() if key != "src"})
|
|
35
|
+
return inline
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main() -> int:
|
|
39
|
+
sources, records = load_jsonl(SKILL_ROOT / "examples/minimal-image-prompt-specs.jsonl")
|
|
40
|
+
require(validate_records(records, sources)["specs"] == 1, "valid fixture count")
|
|
41
|
+
require(len(sources) == 3, "fixture declares its upstream snapshots once")
|
|
42
|
+
|
|
43
|
+
duplicate = [records[0], copy.deepcopy(records[0])]
|
|
44
|
+
fail(duplicate, sources, "duplicate spec_id")
|
|
45
|
+
|
|
46
|
+
bad_order = copy.deepcopy(records)
|
|
47
|
+
bad_order[0]["reference_bindings"].append(copy.deepcopy(bad_order[0]["reference_bindings"][0]))
|
|
48
|
+
fail(bad_order, sources, "duplicate slot_id")
|
|
49
|
+
|
|
50
|
+
leaked = copy.deepcopy(records)
|
|
51
|
+
leaked[0]["provider"] = "example"
|
|
52
|
+
fail(leaked, sources, "provider execution fields")
|
|
53
|
+
|
|
54
|
+
# A/B Round 2: the suite forbids weight syntax and one engine's quality words,
|
|
55
|
+
# but nothing enforced it — the only prompt check was for leaked hashes.
|
|
56
|
+
for syntax in ("--ar 9:16", "masterpiece, 8k", "(red coat:1.2)", "cat::2"):
|
|
57
|
+
engine_syntax = copy.deepcopy(records)
|
|
58
|
+
engine_syntax[0]["generic_prompt"] += f" {syntax}"
|
|
59
|
+
fail(engine_syntax, sources, "engine-specific syntax")
|
|
60
|
+
|
|
61
|
+
nested_provider = copy.deepcopy(records)
|
|
62
|
+
nested_provider[0]["reference_bindings"][0]["provider"] = "example"
|
|
63
|
+
fail(nested_provider, sources, "reference_bindings[0].provider")
|
|
64
|
+
|
|
65
|
+
nested_secret = copy.deepcopy(records)
|
|
66
|
+
nested_secret[0]["asset_binding"]["credentials"] = {"token": "not-safe"}
|
|
67
|
+
fail(nested_secret, sources, "asset_binding.credentials")
|
|
68
|
+
|
|
69
|
+
undeclared = copy.deepcopy(records)
|
|
70
|
+
undeclared[0]["asset_binding"]["identity_ref"]["src"] = "no-such-source"
|
|
71
|
+
fail(undeclared, sources, "REF_SRC_IS_NOT_DECLARED")
|
|
72
|
+
|
|
73
|
+
unbound = copy.deepcopy(records)
|
|
74
|
+
del unbound[0]["source_refs"][0]["src"]
|
|
75
|
+
fail(unbound, sources, "REF_HAS_NO_UPSTREAM_BINDING")
|
|
76
|
+
|
|
77
|
+
# Projects released before the sources declaration write the snapshot inline on
|
|
78
|
+
# every reference; both forms resolve to the same upstream binding.
|
|
79
|
+
inline = copy.deepcopy(records)
|
|
80
|
+
binding = inline[0]["asset_binding"]
|
|
81
|
+
binding["identity_ref"] = expanded(binding["identity_ref"], sources)
|
|
82
|
+
binding["variant_ref"] = expanded(binding["variant_ref"], sources)
|
|
83
|
+
inline[0]["source_refs"] = [expanded(ref, sources) for ref in inline[0]["source_refs"]]
|
|
84
|
+
for slot in inline[0]["reference_bindings"]:
|
|
85
|
+
slot["artifact_ref"] = expanded(slot["artifact_ref"], sources)
|
|
86
|
+
require(validate_records(inline, {})["specs"] == 1, "inline snapshots resolve without sources")
|
|
87
|
+
|
|
88
|
+
print("10 self-tests passed")
|
|
89
|
+
return 0
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == "__main__":
|
|
93
|
+
raise SystemExit(main())
|