@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,271 @@
|
|
|
1
|
+
# storydb — 故事图工作台
|
|
2
|
+
|
|
3
|
+
> 分支:`refactor/workspace-mcp`
|
|
4
|
+
> 目标:LLM 通过 MCP 工具在 SurrealDB 故事图上读写,不再生成阶段 JSON。
|
|
5
|
+
>
|
|
6
|
+
> v3 架构:一个工作区一个独立 SurrealDB server;每个项目一个 database + 独立用户;项目目录是 `A/projects/<uuid>`。完整说明见 [docs/workspace-mcp.md](../../../docs/workspace-mcp.md)。CLI 保留为调试/运维入口,不再是指令提示词里的主接口。
|
|
7
|
+
|
|
8
|
+
## 1. 一句话
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
LLM → MCP 工具(story_*) → SurrealDB server(图 + 文档 + 事件 + 时序 + 全文索引)
|
|
12
|
+
运维/调试 → storydb CLI
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- 写入即校验,错误原文返回。
|
|
16
|
+
- 缺细节是 `pending`,不是 `error`。
|
|
17
|
+
- 每次写入是一个 `change_set`,决策和数据同事务。
|
|
18
|
+
- 查询只取相关子图,不读整份文件。
|
|
19
|
+
|
|
20
|
+
## 2. 数据库
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
A/.fancy/surreal/ ← 独立 SurrealDB server 数据
|
|
24
|
+
A/projects/<uuid>/ ← 项目目录
|
|
25
|
+
.fancy-project.json ← UUID / database / db user
|
|
26
|
+
namespace: fancy
|
|
27
|
+
fancy_registry ← 项目注册表
|
|
28
|
+
proj_<uuid> ← 每个项目一个库
|
|
29
|
+
fn::fancy::validate($scope) ← 数据库内置校验
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
项目连接信息由 `.fancy-project.json` 和 `A/.fancy/secrets.json` 提供;不再使用嵌入式 `.fancy-storydb`。初始化/升级 schema:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
/fancy-db init
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 3. 命令
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
node plugins/fancy-story-builder/storydb/cli.js [--db <项目根>] <command>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 看 schema
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
storydb schema foreshadow
|
|
48
|
+
storydb schema
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 读
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
storydb get character C001
|
|
55
|
+
storydb get foreshadow FS012
|
|
56
|
+
storydb search foreshadow --where status=draft --limit 20
|
|
57
|
+
storydb context --chapter 341 --prev 3
|
|
58
|
+
storydb context --entity foreshadow:FS012
|
|
59
|
+
storydb context --chapter 341 --search "旧堤泵房"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`context --chapter` 返回:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"chapter": {...},
|
|
67
|
+
"outline": {...},
|
|
68
|
+
"scenes": [...],
|
|
69
|
+
"cast": [...],
|
|
70
|
+
"locations": [...],
|
|
71
|
+
"knowledge": [...],
|
|
72
|
+
"actions": [{ "kind": "foreshadow", "entity_id": "FS012", "action": "plant", "chapter_no": 341 }],
|
|
73
|
+
"knowledge_events": [{ "subject_id": "FS012", "change": "learns", "coverage": "partial" }],
|
|
74
|
+
"requirements": [...],
|
|
75
|
+
"foreshadows_due": [...],
|
|
76
|
+
"payoffs_due": [...],
|
|
77
|
+
"previous": [
|
|
78
|
+
{ "display_no": 340, "title": "...", "handoff": {...}, "tail": "(最后 600 字)" }
|
|
79
|
+
],
|
|
80
|
+
"search": [{ "display_no": 312, "score": 0.86, "snippet": "..." }]
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 写
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
storydb create foreshadow '{"id":"FS012","name":"空白的来源栏","type":"medium","scope":"volume"}'
|
|
88
|
+
storydb apply ops.json # 一个事务
|
|
89
|
+
storydb apply --per-chapter chapters.json # 多章,每章一个独立事务
|
|
90
|
+
storydb stage-check rhythm
|
|
91
|
+
storydb update foreshadow FS012 '{"status":"draft"}'
|
|
92
|
+
storydb link foreshadow_action chapter:CH341 foreshadow:FS012 '{"action":"plant","chapter_no":341}'
|
|
93
|
+
storydb unlink foreshadow_action chapter:CH341 foreshadow:FS012 --action plant
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 批量(推荐)
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
storydb apply ops.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"workflow": "rhythm",
|
|
105
|
+
"summary": "写第 341 章",
|
|
106
|
+
"ops": [
|
|
107
|
+
{ "op": "create", "kind": "chapter", "data": { "chapter_id": "CH341", "...": "..." } },
|
|
108
|
+
{ "op": "link", "edge": "chapter_cast", "from": "chapter:CH341", "to": "character:C001", "data": { "role": "pov" } },
|
|
109
|
+
{ "op": "link", "edge": "foreshadow_action", "from": "chapter:CH341", "to": "foreshadow:FS012", "data": { "action": "plant", "chapter_no": 341 } },
|
|
110
|
+
{ "op": "knowledge", "data": { "chapter_id": "CH341", "subject_id": "FS012", "character_id": "C001", "change": "learns", "coverage": "partial" } }
|
|
111
|
+
],
|
|
112
|
+
"decisions": [
|
|
113
|
+
{ "subject": "chapter:CH341", "text": "本章让 C001 第一次看到来源栏", "source": "references/节奏指导/..." }
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
一个 `apply` 是一个事务:所有 ops + decisions 要么全成,要么全滚。
|
|
119
|
+
|
|
120
|
+
### 校验 / 待办
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
storydb validate --scope chapter:CH341
|
|
124
|
+
storydb stage-check rhythm
|
|
125
|
+
storydb next --limit 20
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 影响分析
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
storydb impact relation C001 C002 --to 对立 --from 341
|
|
132
|
+
storydb impact foreshadow FS012 --action reveal --chapter 400
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 导出
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
storydb export md 30-cast
|
|
139
|
+
storydb export md all
|
|
140
|
+
storydb export decisions
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 导入旧阶段 JSON
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
storydb import scale
|
|
147
|
+
storydb import macro
|
|
148
|
+
storydb import cast
|
|
149
|
+
storydb import rhythm
|
|
150
|
+
storydb import outline
|
|
151
|
+
storydb import writing
|
|
152
|
+
storydb import all
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
每个 chapter/outline/text 一个 `change_set`;失败的章节回滚,不影响已成功的章节。
|
|
156
|
+
|
|
157
|
+
## 4. 数据模型
|
|
158
|
+
|
|
159
|
+
### 节点
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
story / scale / volume / act / chapter
|
|
163
|
+
world_doc / story_doc / line / line_node / ending / role_slot / emotion_doc
|
|
164
|
+
character / faction / location / item / conflict / foreshadow / payoff / climax / information
|
|
165
|
+
outline / scene / chapter_text / handoff
|
|
166
|
+
requirement / change_set / decision / validation_issue
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 边
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
has_volume / has_act / has_chapter
|
|
173
|
+
chapter_cast / chapter_location / chapter_line_node / chapter_branch / chapter_conflict
|
|
174
|
+
relation / faction_relation / membership
|
|
175
|
+
conflict_participant / climax_participant / foreshadow_payoff
|
|
176
|
+
foreshadow_action / payoff_action / info_action / ending_action
|
|
177
|
+
outline_scene / outline_cast / outline_location / outline_foreshadow
|
|
178
|
+
scene_cast / scene_location / scene_foreshadow
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 生命周期
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
seed → draft → complete → locked → archived
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
- `seed`:只有 id/name,缺细节正常。
|
|
188
|
+
- `complete`:所有 hard requirement 必须 filled,否则 DB 拒绝。
|
|
189
|
+
- `archived`:历史版本,不参与默认查询。
|
|
190
|
+
|
|
191
|
+
### requirement(占位/待办)
|
|
192
|
+
|
|
193
|
+
```text
|
|
194
|
+
foreshadow: plant(hard) / progress(soft) / reveal(hard)
|
|
195
|
+
payoff: setup(hard) / payoff(hard)
|
|
196
|
+
chapter: outline(hard) / draft(hard)
|
|
197
|
+
outline: scenes(hard) / cast(soft)
|
|
198
|
+
character: arc(soft) / voice(soft)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
缺细节不是错误,`next` 会列出来;只有 `status=complete` 时还有 hard pending 才报错。
|
|
202
|
+
|
|
203
|
+
## 5. 事务与决策
|
|
204
|
+
|
|
205
|
+
```text
|
|
206
|
+
change_set = 一次写入事务
|
|
207
|
+
decision = 一条设计决策,必须属于某个 change_set
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
- 数据 + 决策同一个事务;回滚时一起消失。
|
|
211
|
+
- 返工创建新 `change_set`,旧决策标 `superseded`。
|
|
212
|
+
- `storydb why <subject>` 只看 active 决策。
|
|
213
|
+
- `storydb history <subject>` 看全部版本。
|
|
214
|
+
- `.reference-decisions.md` 不再是 append-only 事实源,只能是 `export decisions` 的导出物。
|
|
215
|
+
|
|
216
|
+
## 6. 硬约束 vs 待办 vs 警告
|
|
217
|
+
|
|
218
|
+
| 类型 | 例子 | 行为 |
|
|
219
|
+
|---|---|---|
|
|
220
|
+
| 硬约束 | 悬空边、知识状态回退、`hook` 连续 3 章重复、时间线倒退、`complete` 还有 hard pending | 写入失败、事务回滚 |
|
|
221
|
+
| 待办 | 伏笔缺 reveal、章节缺细纲/正文、爽点缺 setup | 写入成功,`next` 列出 |
|
|
222
|
+
| 警告 | 情绪平流、黄金三章钩子弱、主线/冲突缺章节落点 | 写入成功,`validate` 返回 warning |
|
|
223
|
+
|
|
224
|
+
## 7. 全文索引与连续性
|
|
225
|
+
|
|
226
|
+
- `chapter_text.content` 有 `FULLTEXT` 索引,写入/修改自动维护。
|
|
227
|
+
- 中文用 `TOKENIZERS class FILTERS lowercase, ngram(1,2)`,`@1@` 查询可用。
|
|
228
|
+
- `context --chapter N --prev 3` 返回前三章的 `handoff` + 结尾 600 字。
|
|
229
|
+
- `handoff` 记录:`end_location` / `end_time` / `end_characters` / `open_threads` / `next_scene_hint` / `continuity_notes`。
|
|
230
|
+
|
|
231
|
+
## 8. 从插件命令使用
|
|
232
|
+
|
|
233
|
+
`/fancy-build scale|macro|cast|rhythm|outline|write` 已切到 storydb:
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
1. 插件读取故事图,生成紧凑上下文
|
|
237
|
+
2. 提示 LLM 用 storydb CLI 写库
|
|
238
|
+
3. LLM 每个 apply 一个事务
|
|
239
|
+
4. 插件运行 stage-check,把 DB 错误原文回给 LLM
|
|
240
|
+
5. 通过后进入下一阶段
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
回退旧文件管线:`FANCY_STORY_GRAPH=0`。
|
|
244
|
+
|
|
245
|
+
## 9. LLM 使用方式
|
|
246
|
+
|
|
247
|
+
系统提示词只需要三样:
|
|
248
|
+
|
|
249
|
+
1. 只能通过 `storydb` 读写,不许写阶段 JSON。
|
|
250
|
+
2. 每次写入必须带 `change_set`(`apply`)和决策。
|
|
251
|
+
3. 先 `context` / `get`,再写;写完 `validate`。
|
|
252
|
+
|
|
253
|
+
典型回合:
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
storydb context --chapter 341 --prev 3
|
|
257
|
+
storydb apply ops.json
|
|
258
|
+
storydb validate --scope chapter:CH341
|
|
259
|
+
storydb next --limit 5
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## 10. 已知边界
|
|
263
|
+
|
|
264
|
+
- 嵌入式单进程;同一项目不能同时被两个会话写。
|
|
265
|
+
- 开发期 schema 变更:当前 DDL 用 `IF NOT EXISTS`,不会覆盖旧字段类型;如果之前用早期 story-graph 版本建过 `story` 库,删掉 `.fancy-storydb` 重建即可(旧数据不保留)。
|
|
266
|
+
- `import` 建议一次完成;正式数据以 LLM 直接 `apply` 为主。
|
|
267
|
+
- 章节写入用 `apply --per-chapter`:每章独立 `change_set`,失败只回滚该章。`workflow: "rhythm"` 时默认替换该章的 cast/action 边。
|
|
268
|
+
- `storydb` 首版是 CLI,后续包 MCP。
|
|
269
|
+
- `/fancy-build ...` 已切到 storydb 提示词 + stage-check;`FANCY_STORY_GRAPH=0` 可回退旧文件管线。
|
|
270
|
+
- `tools graph` / `storydb` / MCP 是同一套底层能力。
|
|
271
|
+
- 质量规则只做 warning;硬规则才回滚。
|