@cloud411716/fancy-webnovel 1.0.46 → 3.0.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/client.js +369 -0
- package/cordis.patch.yml +4 -13
- package/docs/douyin-plugin.md +118 -0
- package/docs/material-library/README.md +404 -0
- package/docs/material-library/import.js +437 -0
- package/docs/material-library/prompt.md +370 -0
- package/docs/material-library/queries.surql +94 -0
- package/docs/material-library/sample.jsonl +14 -0
- package/docs/material-library/schema.surql +46 -0
- package/docs/mcp-profile.example.yml +24 -0
- package/docs/story-graph-design.md +602 -0
- package/docs/story-graph-validation.md +81 -0
- package/docs/workspace-mcp.md +284 -0
- package/index.js +26 -38
- package/lib/atomic-write.js +109 -0
- package/lib/chapter-order.js +100 -0
- package/lib/chinese-num.js +111 -0
- package/lib/confirmation.js +80 -0
- package/lib/db-init.js +123 -0
- package/lib/deployed-state.js +141 -0
- package/lib/direction-labels.js +265 -0
- package/lib/error-codes.js +104 -0
- package/lib/infra.js +594 -0
- package/lib/llm-wiki.js +109 -0
- package/lib/material-db.js +149 -0
- package/lib/path-guard.js +150 -0
- package/lib/projects.js +400 -0
- package/lib/scraper-utils.js +305 -0
- package/lib/surreal-server.js +338 -0
- package/lib/topic-decision.js +860 -0
- package/lib/topic-fields.js +251 -0
- package/lib/topic-schema.js +225 -0
- package/lib/workspace.js +501 -0
- package/package.json +62 -5
- package/plugins/fancy-analyze/analyze-definitions.md +519 -0
- package/plugins/fancy-analyze/command-input.js +65 -0
- package/plugins/fancy-analyze/index.js +2024 -0
- package/plugins/fancy-analyze/ingest-coverage.js +107 -0
- package/plugins/fancy-analyze/schema-analyze.md +627 -0
- package/plugins/fancy-analyze/schema-write.md +178 -0
- package/plugins/fancy-analyze/scripts/append-summary-chapter.js +612 -0
- package/plugins/fancy-analyze/scripts/split_source.js +292 -0
- package/plugins/fancy-analyze/summary-progress.js +495 -0
- package/plugins/fancy-analyze/templates.js +1179 -0
- package/plugins/fancy-bootstrap/index.js +313 -0
- package/plugins/fancy-bootstrap/scripts/init.js +177 -0
- package/plugins/fancy-bootstrap/scripts/path-utils.js +21 -0
- package/plugins/fancy-bootstrap/templates.js +71 -0
- package/plugins/fancy-db/index.js +172 -0
- package/plugins/fancy-douyin/deploy.js +134 -0
- package/plugins/fancy-douyin/index.js +551 -0
- package/plugins/fancy-douyin/prompts/01-analysis-prompt.md +84 -0
- package/plugins/fancy-douyin/scripts/crawl-note.cjs +194 -0
- package/plugins/fancy-douyin/scripts/lib.cjs +197 -0
- package/plugins/fancy-douyin/scripts/scan-account.cjs +128 -0
- package/plugins/fancy-douyin/scripts/start-chrome.cjs +203 -0
- package/plugins/fancy-douyin/state.js +197 -0
- package/plugins/fancy-douyin/templates.js +127 -0
- package/plugins/fancy-export/exporter.js +805 -0
- package/plugins/fancy-export/index.js +63 -0
- package/plugins/fancy-import/import-core.js +1118 -0
- package/plugins/fancy-import/import-driver.js +604 -0
- package/plugins/fancy-import/index.js +738 -0
- package/plugins/fancy-import/prompts/01-import-prompt.md +131 -0
- package/plugins/fancy-import/templates.js +58 -0
- package/plugins/fancy-material/exporter.js +153 -0
- package/plugins/fancy-material/genres.js +256 -0
- package/plugins/fancy-material/index.js +835 -0
- package/plugins/fancy-material/inventory.js +143 -0
- package/plugins/fancy-material/kinds.js +313 -0
- package/plugins/fancy-material/queue.js +55 -0
- package/plugins/fancy-material/scripts/query.js +254 -0
- package/plugins/fancy-material/templates.js +258 -0
- package/plugins/fancy-material/tool-deploy.js +138 -0
- package/plugins/fancy-material/validate.js +149 -0
- package/plugins/fancy-project/index.js +133 -0
- package/plugins/fancy-scan/existing-block.js +100 -0
- package/plugins/fancy-scan/index.js +708 -0
- package/plugins/fancy-scan/prompts/01-analysis-prompt.md +302 -0
- package/plugins/fancy-scan/scripts/append-block.js +725 -0
- package/plugins/fancy-scan/scripts/report-validate.js +824 -0
- package/plugins/fancy-scan/scripts/run-scan.js +667 -0
- package/plugins/fancy-scan/scripts/scrapers/fanqie-rank-scraper.js +923 -0
- package/plugins/fancy-scan/scripts/scrapers/jjwxc-rank-scraper.js +469 -0
- package/plugins/fancy-scan/scripts/scrapers/qimao-rank-scraper.js +629 -0
- package/plugins/fancy-scan/templates/blocks.js +155 -0
- package/plugins/fancy-scan/templates/platforms.js +372 -0
- package/plugins/fancy-scan/templates/report-schema.js +90 -0
- package/plugins/fancy-scan/templates.js +694 -0
- package/plugins/fancy-scan/tool-deploy.js +335 -0
- package/plugins/fancy-scan/wait-turn.js +46 -0
- package/plugins/fancy-story-builder/db/README.md +106 -0
- package/plugins/fancy-story-builder/db/client.js +228 -0
- package/plugins/fancy-story-builder/db/commands.js +145 -0
- package/plugins/fancy-story-builder/db/ids.js +39 -0
- package/plugins/fancy-story-builder/db/import.js +798 -0
- package/plugins/fancy-story-builder/db/project.js +299 -0
- package/plugins/fancy-story-builder/db/query.js +361 -0
- package/plugins/fancy-story-builder/db/schema.js +417 -0
- package/plugins/fancy-story-builder/db/stage-sync.js +238 -0
- package/plugins/fancy-story-builder/deploy-manifest.js +239 -0
- package/plugins/fancy-story-builder/deslop-driver.js +821 -0
- package/plugins/fancy-story-builder/flesh-output.js +168 -0
- package/plugins/fancy-story-builder/index.js +6861 -0
- package/plugins/fancy-story-builder/patch-driver.js +390 -0
- package/plugins/fancy-story-builder/prompts/01-skeleton-prompt.md +563 -0
- package/plugins/fancy-story-builder/prompts/02-flesh-prompt.md +602 -0
- package/plugins/fancy-story-builder/prompts/03-rhythm-prompt.md +539 -0
- package/plugins/fancy-story-builder/prompts/04-writing-prompt.md +225 -0
- package/plugins/fancy-story-builder/prompts/05-deslop-prompt.md +96 -0
- package/plugins/fancy-story-builder/purpose-template.md +83 -0
- package/plugins/fancy-story-builder/references/formulas-rhythm.json +302 -0
- package/plugins/fancy-story-builder/references/formulas-skeleton.json +402 -0
- package/plugins/fancy-story-builder/references/genre-profiles.json +3514 -0
- package/plugins/fancy-story-builder/references/glossary.md +594 -0
- package/plugins/fancy-story-builder/references/index.md +581 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/00-index.md +174 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/01-scene.md +150 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/02-chapter-workflow.md +99 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/03-opening-chapter.md +104 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/04-dialogue-mastery.md +274 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/05-genre-formulas.md +432 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/06-tone-ensemble.md +259 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/07-ledger-audit.md +222 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/08-diagnosis-revision.md +205 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/09-reading-power.md +135 -0
- package/plugins/fancy-story-builder/references//345/206/231/344/275/234/346/214/207/345/257/274/10-deslop.md +129 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/00-index.md +98 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/01-upgrade-rhythm.md +300 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/02-arc-rhythm.md +168 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/03-highpoint-hooks.md +189 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/04-satisfaction.md +226 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/05-foreshadow-density.md +195 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/06-chapter-outline.md +226 -0
- package/plugins/fancy-story-builder/references//350/212/202/345/245/217/346/214/207/345/257/274/07-audit.md +181 -0
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/00-index.md +100 -0
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/01-character.md +243 -0
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/02-worldbuilding.md +245 -0
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/03-relations.md +185 -0
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/04-emotion-methods.md +286 -0
- package/plugins/fancy-story-builder/references//350/241/200/350/202/211/346/214/207/345/257/274/05-audit.md +187 -0
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/00-index.md +91 -0
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/01-positioning.md +209 -0
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/02-packaging.md +135 -0
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/03-entities.md +305 -0
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/04-conflict.md +328 -0
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/05-quota.md +187 -0
- package/plugins/fancy-story-builder/references//351/252/250/346/236/266/346/214/207/345/257/274/06-audit.md +160 -0
- package/plugins/fancy-story-builder/rhythm-output.js +140 -0
- package/plugins/fancy-story-builder/schema-setting.json +1100 -0
- package/plugins/fancy-story-builder/schema-setting.md +232 -0
- package/plugins/fancy-story-builder/scripts/ai-patterns.js +619 -0
- package/plugins/fancy-story-builder/scripts/brief-validate.js +164 -0
- package/plugins/fancy-story-builder/scripts/check-guide-compliance.js +289 -0
- package/plugins/fancy-story-builder/scripts/content-quality.js +416 -0
- package/plugins/fancy-story-builder/scripts/deslop-validate.js +143 -0
- package/plugins/fancy-story-builder/scripts/error-classes.js +112 -0
- package/plugins/fancy-story-builder/scripts/flesh-validate.js +1312 -0
- package/plugins/fancy-story-builder/scripts/formula-engine.js +112 -0
- package/plugins/fancy-story-builder/scripts/graph-utils.js +1484 -0
- package/plugins/fancy-story-builder/scripts/label-coverage.js +171 -0
- package/plugins/fancy-story-builder/scripts/prompt-drift-check.js +441 -0
- package/plugins/fancy-story-builder/scripts/reading-power.js +298 -0
- package/plugins/fancy-story-builder/scripts/reference-log.js +110 -0
- package/plugins/fancy-story-builder/scripts/rhythm-validate.js +1312 -0
- package/plugins/fancy-story-builder/scripts/schema-pages.js +2668 -0
- package/plugins/fancy-story-builder/scripts/semantic-lint.js +381 -0
- package/plugins/fancy-story-builder/scripts/skeleton-quota.js +145 -0
- package/plugins/fancy-story-builder/scripts/skeleton-validate.js +1973 -0
- package/plugins/fancy-story-builder/scripts/stage-batches.js +1405 -0
- package/plugins/fancy-story-builder/scripts/stage-contract.js +429 -0
- package/plugins/fancy-story-builder/scripts/story-artifacts.js +933 -0
- package/plugins/fancy-story-builder/scripts/upstream-query.js +198 -0
- package/plugins/fancy-story-builder/scripts/v2/baseline.js +112 -0
- package/plugins/fancy-story-builder/scripts/v2/cast.js +517 -0
- package/plugins/fancy-story-builder/scripts/v2/context.js +434 -0
- package/plugins/fancy-story-builder/scripts/v2/contracts.js +493 -0
- package/plugins/fancy-story-builder/scripts/v2/core.js +419 -0
- package/plugins/fancy-story-builder/scripts/v2/engine.js +1068 -0
- package/plugins/fancy-story-builder/scripts/v2/export-markdown.js +794 -0
- package/plugins/fancy-story-builder/scripts/v2/genre.js +195 -0
- package/plugins/fancy-story-builder/scripts/v2/knowledge.js +321 -0
- package/plugins/fancy-story-builder/scripts/v2/macro.js +409 -0
- package/plugins/fancy-story-builder/scripts/v2/manifest.js +538 -0
- package/plugins/fancy-story-builder/scripts/v2/migrate.js +137 -0
- package/plugins/fancy-story-builder/scripts/v2/prompts.js +1335 -0
- package/plugins/fancy-story-builder/scripts/v2/rhythm.js +618 -0
- package/plugins/fancy-story-builder/scripts/v2/scale.js +843 -0
- package/plugins/fancy-story-builder/scripts/v2/snapshot.js +121 -0
- package/plugins/fancy-story-builder/scripts/v2/stages.js +273 -0
- package/plugins/fancy-story-builder/scripts/v2/writing.js +216 -0
- package/plugins/fancy-story-builder/scripts/writing-rules.js +167 -0
- package/plugins/fancy-story-builder/scripts/writing-validate.js +682 -0
- package/plugins/fancy-story-builder/skeleton-output.js +199 -0
- package/plugins/fancy-story-builder/stage-driver.js +1049 -0
- package/plugins/fancy-story-builder/storydb/README.md +271 -0
- package/plugins/fancy-story-builder/storydb/cli.js +458 -0
- package/plugins/fancy-story-builder/storydb/client.js +351 -0
- package/plugins/fancy-story-builder/storydb/compile.js +452 -0
- package/plugins/fancy-story-builder/storydb/context.js +288 -0
- package/plugins/fancy-story-builder/storydb/definitions.js +699 -0
- package/plugins/fancy-story-builder/storydb/driver.js +106 -0
- package/plugins/fancy-story-builder/storydb/dsh-tools.js +313 -0
- package/plugins/fancy-story-builder/storydb/export.js +175 -0
- package/plugins/fancy-story-builder/storydb/ids.js +31 -0
- package/plugins/fancy-story-builder/storydb/impact.js +170 -0
- package/plugins/fancy-story-builder/storydb/import.js +559 -0
- package/plugins/fancy-story-builder/storydb/mcp.js +99 -0
- package/plugins/fancy-story-builder/storydb/prompts.js +952 -0
- package/plugins/fancy-story-builder/storydb/stage-command.js +379 -0
- package/plugins/fancy-story-builder/storydb/stage.js +426 -0
- package/plugins/fancy-story-builder/storydb/store.js +891 -0
- package/plugins/fancy-story-builder/storydb/tools.js +592 -0
- package/plugins/fancy-story-builder/storydb/validation.js +183 -0
- package/plugins/fancy-story-builder/templates/v2/10-scale/scale-template.json +144 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/emotion-template.json +15 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/endings-template.json +16 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/lines-template.json +28 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/roles-template.json +10 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/story-template.json +19 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/volumes-template.json +24 -0
- package/plugins/fancy-story-builder/templates/v2/20-macro/world-template.json +24 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/characters-template.json +49 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/climaxes-template.json +14 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/conflicts-template.json +30 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/factions-template.json +18 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/foreshadows-template.json +29 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/information-template.json +29 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/items-template.json +13 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/locations-template.json +12 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/payoffs-template.json +16 -0
- package/plugins/fancy-story-builder/templates/v2/30-cast/relations-template.json +44 -0
- package/plugins/fancy-story-builder/templates/v2/40-rhythm/chapter-map-template.json +81 -0
- package/plugins/fancy-story-builder/templates/v2/40-rhythm/outline-template.json +162 -0
- package/plugins/fancy-story-builder/templates/v2/50-writing/ledger-template.json +46 -0
- package/plugins/fancy-story-builder/templates/v2/60-deslop/report-template.json +10 -0
- package/plugins/fancy-story-builder/templates//350/212/202/345/245/217//346/227/266/345/272/217/346/230/240/345/260/204/346/250/241/346/235/277.json +427 -0
- package/plugins/fancy-story-builder/templates//350/212/202/345/245/217//347/253/240/350/212/202/347/273/206/347/272/262/346/250/241/346/235/277.json +34 -0
- package/plugins/fancy-story-builder/templates//350/212/202/345/245/217//347/253/240/350/212/202/350/247/204/345/210/222/346/250/241/346/235/277.json +24 -0
- package/plugins/fancy-story-builder/templates//350/212/202/345/245/217//350/212/202/345/245/217/345/217/202/346/225/260/346/250/241/346/235/277.json +27 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//344/270/226/347/225/214/350/247/202/350/247/204/345/210/231/346/250/241/346/235/277.json +168 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/205/263/351/224/256/351/201/223/345/205/267/346/250/241/346/235/277.json +184 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/205/266/344/273/226/345/256/236/344/275/223/346/250/241/346/235/277.json +62 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/206/262/347/252/201/346/250/241/346/235/277.json +131 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/211/247/346/203/205/346/250/241/346/235/277.json +85 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/212/277/345/212/233/346/250/241/346/235/277.json +103 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//345/234/260/347/202/271/346/250/241/346/235/277.json +68 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//347/273/223/345/261/200/346/250/241/346/235/277.json +142 -0
- package/plugins/fancy-story-builder/templates//350/241/200/350/202/211//350/247/222/350/211/262/346/250/241/346/235/277.json +292 -0
- package/plugins/fancy-story-builder/templates//351/252/250/346/236/266//345/205/263/347/263/273/346/250/241/346/235/277.json +266 -0
- package/plugins/fancy-story-builder/templates//351/252/250/346/236/266//345/256/236/344/275/223/346/250/241/346/235/277.json +336 -0
- package/plugins/fancy-story-builder/templates//351/252/250/346/236/266//345/261/202/347/272/247/346/250/241/346/235/277.json +65 -0
- package/plugins/fancy-story-builder/templates//351/252/250/346/236/266//346/241/206/346/236/266/346/250/241/346/235/277.json +308 -0
- package/plugins/fancy-story-builder/templates.js +1446 -0
- package/plugins/fancy-story-builder/wiki-references.js +540 -0
- package/plugins/fancy-story-builder/writing-driver.js +1388 -0
- package/plugins/fancy-topic/index.js +1057 -0
- package/plugins/fancy-topic/prompts/01-exploration-prompt.md +115 -0
- package/plugins/fancy-topic/scripts/save-suggestion.js +219 -0
- package/plugins/fancy-topic/scripts/select-topic.js +317 -0
- package/plugins/fancy-topic/templates.js +476 -0
- package/plugins/fancy-topic/tool-deploy.js +200 -0
- package/commands/bootstrap/index.js +0 -164
- package/commands/bootstrap/init-project.js +0 -121
- package/commands/scan/index.js +0 -283
- package/commands/scan/platforms/fanqie.js +0 -146
- package/commands/scan/platforms/jinjiang.js +0 -143
- package/commands/scan/platforms/qidian.js +0 -102
- package/commands/scan/platforms/qimao.js +0 -127
- package/commands/scan/scraper.js +0 -195
- package/infra.js +0 -160
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
# 网文创作素材库 · 原子素材版
|
|
2
|
+
|
|
3
|
+
> 一条素材 = 一个小积木:一个名字、一句外貌、一条能力机制、一句代价、一个颜色词、一条世界规则。
|
|
4
|
+
> 不写“人物大卡”“金手指大卡”“武器大卡”;人物、能力、物品、场景由很多小积木拼出来。
|
|
5
|
+
|
|
6
|
+
## 1. 文件说明
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
docs/material-library/
|
|
10
|
+
├── prompt.md # 给 LLM 的原子素材生成提示词
|
|
11
|
+
├── schema.surql # SurrealDB 表、字段、索引
|
|
12
|
+
├── sample.jsonl # 14 条原子素材示例
|
|
13
|
+
├── import.js # 校验 / JSONL → SurrealQL / 追加导入
|
|
14
|
+
├── queries.surql # 常用查询
|
|
15
|
+
└── README.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
插件:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
plugins/fancy-material/
|
|
22
|
+
├── index.js
|
|
23
|
+
├── templates.js
|
|
24
|
+
├── kinds.js # 54 个 kind 的单一事实来源
|
|
25
|
+
├── genres.js # topic_decision / 番茄题材提取
|
|
26
|
+
├── inventory.js # 已有素材索引、按 kind 计数
|
|
27
|
+
├── queue.js # 按 kind 排队、计算每批还差多少
|
|
28
|
+
├── exporter.js # 导出 Markdown
|
|
29
|
+
├── scripts/query.js # 生成前查询数据库
|
|
30
|
+
├── validate.js # 生成后校验 JSONL 格式
|
|
31
|
+
└── scripts/...
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 2. 原子素材模型
|
|
35
|
+
|
|
36
|
+
每条素材有七个字段:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"id": "place_name_gui_xu_v4",
|
|
41
|
+
"kind": "place_name",
|
|
42
|
+
"name": "归墟",
|
|
43
|
+
"tags": ["地名", "海", "尽头", "仙侠", "不祥"],
|
|
44
|
+
"genres": ["仙侠", "通用"],
|
|
45
|
+
"note": "",
|
|
46
|
+
"source": "builtin"
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| 字段 | 必填 | 说明 |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `id` | 是 | `<kind>_<ascii_slug>_v4`,全局唯一 |
|
|
53
|
+
| `kind` | 是 | `source=builtin` 时必须是 54 个原子类型之一;`source=other` 时不受限制 |
|
|
54
|
+
| `name` | 是 | 素材本体:名字、短语、一句话机制/代价/规则/钩子 |
|
|
55
|
+
| `tags` | 是 | 3–8 个短标签 |
|
|
56
|
+
| `genres` | 是 | 1–3 个适用题材;跨题材写 `["通用"]` |
|
|
57
|
+
| `note` | 否 | 只有 `name` 不够清楚时补一句 |
|
|
58
|
+
| `source` | 是 | `builtin` 或 `other`;生成素材固定 `builtin` |
|
|
59
|
+
|
|
60
|
+
`source` 用来区分内置素材和外部素材:`builtin` 的 `kind` 受 54 个类型限制;`other` 可以写任意自定义 `kind`。不再有 `payload`、`summary`、`description`、`core_hook`、`market_diff`、`search_text` 这些复合字段。
|
|
61
|
+
|
|
62
|
+
### 2.1 `name` 是内容,不是标题
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{"kind":"given_name","name":"砚秋"}
|
|
66
|
+
{"kind":"color_word","name":"被雨泡过的朱砂"}
|
|
67
|
+
{"kind":"ability_mechanism","name":"触碰死者眼睛,进入他死前最后24分钟的主观视角"}
|
|
68
|
+
{"kind":"ability_cost","name":"每次使用后永久丢失一段与死者无关的等长记忆"}
|
|
69
|
+
{"kind":"conflict_seed","name":"妻子要保险金救女儿,主角要证明她杀了丈夫"}
|
|
70
|
+
{"kind":"brainstorm","name":"给活人打印死亡证明的打印店"}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2.2 素材必须独立
|
|
74
|
+
|
|
75
|
+
- 武器、法宝、技能名、光影特效、人物名分别成条。
|
|
76
|
+
- 不写“这把剑的专属特效是……”。
|
|
77
|
+
- 需要搭配时用 `tags` 表达,例如 `["剑","雷系","高速"]`;不要写从属关系。
|
|
78
|
+
- 一条素材删掉后正文没有任何损失,就不收。
|
|
79
|
+
|
|
80
|
+
## 3. 54 个 kind
|
|
81
|
+
|
|
82
|
+
### 命名
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
surname, given_name, nickname, place_name, faction_name,
|
|
86
|
+
skill_name, ability_name, item_name, monster_name, mythic_being, rank_name
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 人物
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
person_appearance, person_temperament, person_personality, person_habit,
|
|
93
|
+
person_voice, person_background
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 关系与情绪
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
reaction
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 能力
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
ability_mechanism, ability_activation, ability_cost, ability_limit,
|
|
106
|
+
ability_counter, power_source
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 物品
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
item_form, item_material, item_function, item_visual
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 场景与感官
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
location_feature, weather, sensory_taste, sensory_visual
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 描写词库
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
color_word, light_word, sound_word, smell_word, touch_word,
|
|
125
|
+
effect_word, speed_word, atmosphere_word, appearance_word,
|
|
126
|
+
expression_word, action_verb
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 世界与势力
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
world_rule, faction_culture, faction_symbol, ritual
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 剧情与脑洞
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
brainstorm, conflict_seed, conflict_escalation, plot_twist,
|
|
139
|
+
mystery_seed, payoff_scene, trope
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
完整中文名和 `name` 写法见 `prompt.md` 的「素材类型总表」。
|
|
143
|
+
|
|
144
|
+
## 4. 快速开始
|
|
145
|
+
|
|
146
|
+
### 4.1 建表
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
surreal sql \
|
|
150
|
+
--endpoint http://127.0.0.1:8000 \
|
|
151
|
+
--user root --pass root \
|
|
152
|
+
--namespace fancy --database material_library \
|
|
153
|
+
--multi < docs/material-library/schema.surql
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`/fancy-bootstrap` 和 `/fancy-db init` 也会自动创建这张表。
|
|
157
|
+
|
|
158
|
+
### 4.2 校验并导入
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
node docs/material-library/import.js --check docs/material-library/sample.jsonl
|
|
162
|
+
node docs/material-library/import.js \
|
|
163
|
+
--endpoint http://127.0.0.1:8000 \
|
|
164
|
+
--namespace fancy --database material_library \
|
|
165
|
+
--user root --pass root \
|
|
166
|
+
docs/material-library/sample.jsonl
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
输出:
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
✅ 导入完成:新增 14 条素材,跳过 0 条已存在素材。
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
默认只追加:
|
|
176
|
+
|
|
177
|
+
- 已存在 `id` → 跳过
|
|
178
|
+
- 同 `kind + name` → 跳过
|
|
179
|
+
- 需要修订旧条目时才加 `--update`
|
|
180
|
+
|
|
181
|
+
`sample.jsonl` 的素材都是 `source=builtin`。要导入自定义 kind,写
|
|
182
|
+
`"source":"other"`,例如:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{"id":"custom_note_1","kind":"custom_lore","name":"自定义设定","tags":["自定义","设定","测试"],"genres":["悬疑"],"note":"","source":"other"}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 4.3 大批量导入
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
node docs/material-library/import.js \
|
|
192
|
+
--with-schema \
|
|
193
|
+
--to-surql /tmp/materials.surql \
|
|
194
|
+
docs/material-library/sample.jsonl
|
|
195
|
+
|
|
196
|
+
surreal import \
|
|
197
|
+
--endpoint http://127.0.0.1:8000 \
|
|
198
|
+
--user root --pass root \
|
|
199
|
+
--namespace fancy --database material_library \
|
|
200
|
+
/tmp/materials.surql
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
生成的是带存在性守卫的 `IF ... CREATE`,重复导入不会覆盖。
|
|
204
|
+
|
|
205
|
+
## 5. 查询
|
|
206
|
+
|
|
207
|
+
完整示例见 `queries.surql`。
|
|
208
|
+
|
|
209
|
+
### 5.1 仙侠地名
|
|
210
|
+
|
|
211
|
+
```sql
|
|
212
|
+
SELECT id, kind, name, tags, genres, search::score(1) AS score
|
|
213
|
+
FROM material
|
|
214
|
+
WHERE kind = 'place_name'
|
|
215
|
+
AND genres CONTAINS '仙侠'
|
|
216
|
+
AND name @1@ '海 尽头 旧城'
|
|
217
|
+
ORDER BY score DESC
|
|
218
|
+
LIMIT 10;
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### 5.2 悬疑男主名字
|
|
222
|
+
|
|
223
|
+
```sql
|
|
224
|
+
SELECT id, kind, name, tags, genres
|
|
225
|
+
FROM material
|
|
226
|
+
WHERE kind = 'given_name'
|
|
227
|
+
AND genres CONTAINS '悬疑'
|
|
228
|
+
AND tags CONTAINSANY ['男', '正派']
|
|
229
|
+
LIMIT 20;
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 5.3 红色系描写词
|
|
233
|
+
|
|
234
|
+
```sql
|
|
235
|
+
SELECT id, kind, name, tags, genres
|
|
236
|
+
FROM material
|
|
237
|
+
WHERE kind = 'color_word'
|
|
238
|
+
AND tags CONTAINSANY ['红', '暖色']
|
|
239
|
+
LIMIT 20;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 5.4 能力机制和代价
|
|
243
|
+
|
|
244
|
+
```sql
|
|
245
|
+
SELECT id, kind, name, tags, genres
|
|
246
|
+
FROM material
|
|
247
|
+
WHERE kind IN ['ability_mechanism', 'ability_cost']
|
|
248
|
+
AND name @1@ '记忆 死者 调查'
|
|
249
|
+
LIMIT 10;
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 5.5 生成前查询数据库
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
node plugins/fancy-material/scripts/query.js \
|
|
256
|
+
--workspace /path/to/A --kind place_name --name '归墟' --json
|
|
257
|
+
|
|
258
|
+
node plugins/fancy-material/scripts/query.js \
|
|
259
|
+
--workspace /path/to/A --genre '仙侠·修真文明' --kind color_word --limit 20 --json
|
|
260
|
+
|
|
261
|
+
node plugins/fancy-material/scripts/query.js \
|
|
262
|
+
--workspace /path/to/A --search '残影 高速' --limit 20 --json
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## 6. 索引
|
|
266
|
+
|
|
267
|
+
| 索引 | 字段 | 用途 |
|
|
268
|
+
| --- | --- | --- |
|
|
269
|
+
| `material_kind` | `kind` | 按类型过滤 |
|
|
270
|
+
| `material_name` | `name` | 按名字查 |
|
|
271
|
+
| `material_tags` | `tags` | 标签过滤 |
|
|
272
|
+
| `material_genres` | `genres` | 题材过滤 |
|
|
273
|
+
| `material_kind_name_unique` | `kind, name` | 防止同名同类型重复 |
|
|
274
|
+
| `material_name_search` | `name` | 中文 ngram 全文检索 |
|
|
275
|
+
|
|
276
|
+
中文全文检索:
|
|
277
|
+
|
|
278
|
+
```sql
|
|
279
|
+
DEFINE ANALYZER material_zh
|
|
280
|
+
TOKENIZERS class
|
|
281
|
+
FILTERS lowercase, ngram(1,8);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
单条查询词建议 2–8 个汉字;更长的概念拆成多个短词。
|
|
285
|
+
|
|
286
|
+
## 7. fancy-material 命令
|
|
287
|
+
|
|
288
|
+
```text
|
|
289
|
+
/fancy-material 生成全部素材类型,按 kind 顺序,一个类型写完再下一个
|
|
290
|
+
/fancy-material 地名 只生成地名类,其它规则仍然有效
|
|
291
|
+
/fancy-material 人物 生成人物相关 kind
|
|
292
|
+
/fancy-material 颜色 只生成颜色词
|
|
293
|
+
/fancy-material import <文件> 导入 JSONL
|
|
294
|
+
/fancy-material init 创建/补齐 schema、索引和查询脚本
|
|
295
|
+
/fancy-material remove 删除整个素材库(需确认)
|
|
296
|
+
/fancy-material prompt 展示全类型提示词
|
|
297
|
+
/fancy-material export 导出 <工作区>/素材库.md
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
如果 `扫榜结果` 下有多份 `topic_decision_*.md`,不带参数运行时会先弹窗,
|
|
301
|
+
让你选择本次使用哪一份;插件只读取选中的那份文件里的「选题方向」,不会合并
|
|
302
|
+
多个报告。只有一份时自动使用;没有时回退到番茄扫榜题材。
|
|
303
|
+
|
|
304
|
+
带参数运行(例如 `/fancy-material 地名`)不弹窗,沿用最新的
|
|
305
|
+
`topic_decision` 文件。
|
|
306
|
+
|
|
307
|
+
不带参数时,插件会覆盖全部 54 个 kind:
|
|
308
|
+
|
|
309
|
+
```text
|
|
310
|
+
每次运行,每个 kind 新增 50 条。
|
|
311
|
+
一个 kind 写满本次的 50 条,再进入下一个 kind。
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
带参数时,只处理指定类型:
|
|
315
|
+
|
|
316
|
+
```text
|
|
317
|
+
/fancy-material 地名 只让 place_name 新增 50 条
|
|
318
|
+
/fancy-material 物品 依次让 item_* 各新增 50 条
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
执行方式:
|
|
322
|
+
|
|
323
|
+
```text
|
|
324
|
+
每个 kind 拆成多个批次,每批最多 10 条。
|
|
325
|
+
插件发送一批 → LLM 写一个批次文件 → 校验 → 追加导入 → 插件自动发下一批。
|
|
326
|
+
一个 kind 完成本次 50 条后,插件自动切换到下一个 kind。
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
这不是“数据库里每个 kind 最多 50 条”。50 是**每次运行的新增量**:
|
|
330
|
+
|
|
331
|
+
```text
|
|
332
|
+
第 1 次运行 /fancy-material → 每个 kind 新增 50 条
|
|
333
|
+
第 2 次运行 /fancy-material → 每个 kind 再新增 50 条
|
|
334
|
+
两次运行后 → 每个 kind 累计 100 条
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
已有素材只用于去重,不会让本次配额减少。
|
|
338
|
+
|
|
339
|
+
运行中会写入进度文件:
|
|
340
|
+
|
|
341
|
+
```text
|
|
342
|
+
<工作区>/.tmp/fancy_material_<时间戳>/progress.json
|
|
343
|
+
<工作区>/.tmp/fancy_material_<时间戳>/batches.jsonl
|
|
344
|
+
<工作区>/.tmp/fancy_material_<时间戳>/<序号>_<kind>_<批次>.jsonl
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
`progress.json` 记录本次运行每个 kind 的 db_existing / generated / target / status,
|
|
348
|
+
`batches.jsonl` 逐批记录新增数量,便于核对。
|
|
349
|
+
|
|
350
|
+
调试或试跑时,可以在启动 OpenCode 前设置环境变量覆盖默认值,避免一次生成太多:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
export FANCY_MATERIAL_TARGET_PER_KIND=10
|
|
354
|
+
export FANCY_MATERIAL_BATCH_SIZE=5
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
中断后再次运行 `/fancy-material`:
|
|
358
|
+
|
|
359
|
+
```text
|
|
360
|
+
已经导入的素材保留;
|
|
361
|
+
再次运行会开始新一轮 50 条配额;
|
|
362
|
+
不会从上次中断的位置抵扣本次配额。
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
也就是说,中断发生在某个 kind 的第 3 批,本次已经导入 30 条;再次运行仍会为这个
|
|
366
|
+
kind 再生成 50 条,最终这个 kind 是 80 条。这是“每次运行新增 50 条”的直接结果。
|
|
367
|
+
|
|
368
|
+
`init` 只补齐 schema/索引,不会清空合法素材;`source=builtin` 且已下线的 kind 会被清理。`remove` 会先弹窗确认,再执行
|
|
369
|
+
`REMOVE DATABASE material_library`,删除后可用 `/fancy-material init` 重建。
|
|
370
|
+
|
|
371
|
+
生成器与校验:
|
|
372
|
+
|
|
373
|
+
- 可以直接写 JSONL,也可以使用 Python/Node 生成器;
|
|
374
|
+
- 生成器放在 `<工作区>/.tmp/`,输出必须是目标 JSONL;
|
|
375
|
+
- 生成后运行 `.fancy-tools/fancy-material/validate.js`;
|
|
376
|
+
- 插件最终还会再校验一次,并按 `kind + name` 去重追加导入。
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
node <工作区>/.fancy-tools/fancy-material/validate.js <目标.jsonl>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
校验失败会输出行号和原因;通过后插件再做最终校验并追加导入。
|
|
383
|
+
|
|
384
|
+
## 8. 质量要求摘要
|
|
385
|
+
|
|
386
|
+
完整规则在 `prompt.md`,核心是:
|
|
387
|
+
|
|
388
|
+
- 具体优先,不写空泛形容词。
|
|
389
|
+
- 描写词必须有具体参照物、感官、情绪或处境。
|
|
390
|
+
- 直接废弃“火红、淡红、深红、蓝蓝的、雪白、耀眼、璀璨、神秘、强大”。
|
|
391
|
+
- 名字不要“张三、李四、林婉儿”这种大路货。
|
|
392
|
+
- 命名至少要有具体锚点:数字、地名、材质、动作、职业、年代、禁忌、功能或反差。
|
|
393
|
+
- 直接废弃“复原眼、章眼、旧仓单、神秘剑、黑色长刀”这类功能标签或形容词+通用名词。
|
|
394
|
+
- 可以入库的命名示例:“回魂秤、缺页仓单、三号柜的铜牌、二十四帧瞳、缝尸针”。
|
|
395
|
+
- 能力机制、代价、限制、反制分开成条。
|
|
396
|
+
- 场景要有声音、气味、触感、光线、物件。
|
|
397
|
+
- 每条素材必须能独立复用。
|
|
398
|
+
|
|
399
|
+
## 9. 兼容性
|
|
400
|
+
|
|
401
|
+
- 已在 SurrealDB 2.3.10 上验证。
|
|
402
|
+
- 2.3 使用 `SEARCH ANALYZER`;2.2 及以下需要把全文索引改成 `FULLTEXT` 语法。
|
|
403
|
+
- Node.js >= 18。
|
|
404
|
+
- `import.js` 直接导入依赖 `surrealdb` npm 包;只用 `--to-surql` 时不需要连数据库。
|