novel-maker 2.2.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.
Files changed (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -0
  3. package/bin/novel-maker.js +229 -0
  4. package/package.json +33 -0
  5. package/skill/CHANGELOG.md +82 -0
  6. package/skill/QUICK-REF.md +168 -0
  7. package/skill/README.md +75 -0
  8. package/skill/SKILL.md +715 -0
  9. package/skill/agents/README.md +59 -0
  10. package/skill/agents/auditor.md +234 -0
  11. package/skill/agents/coordinator.md +150 -0
  12. package/skill/agents/planner.md +220 -0
  13. package/skill/agents/reviewer.md +249 -0
  14. package/skill/agents/reviser.md +144 -0
  15. package/skill/agents/writer.md +213 -0
  16. package/skill/arc-templates/README.md +43 -0
  17. package/skill/arc-templates/apocalypse/ability.md +81 -0
  18. package/skill/arc-templates/apocalypse/faction.md +81 -0
  19. package/skill/arc-templates/apocalypse/humanity.md +81 -0
  20. package/skill/arc-templates/apocalypse/survival.md +81 -0
  21. package/skill/arc-templates/game/competition.md +81 -0
  22. package/skill/arc-templates/game/dungeon.md +81 -0
  23. package/skill/arc-templates/game/guild-war.md +81 -0
  24. package/skill/arc-templates/game/leveling.md +80 -0
  25. package/skill/arc-templates/general/challenge.md +44 -0
  26. package/skill/arc-templates/general/conflict.md +71 -0
  27. package/skill/arc-templates/general/explore.md +71 -0
  28. package/skill/arc-templates/general/growth.md +71 -0
  29. package/skill/arc-templates/general/mystery.md +71 -0
  30. package/skill/arc-templates/general/relation.md +71 -0
  31. package/skill/arc-templates/history/battle.md +71 -0
  32. package/skill/arc-templates/history/politics.md +71 -0
  33. package/skill/arc-templates/history/reform.md +71 -0
  34. package/skill/arc-templates/infinite-flow/boss.md +71 -0
  35. package/skill/arc-templates/infinite-flow/dungeon.md +71 -0
  36. package/skill/arc-templates/infinite-flow/enhance.md +71 -0
  37. package/skill/arc-templates/infinite-flow/team.md +71 -0
  38. package/skill/arc-templates/mystery/case.md +71 -0
  39. package/skill/arc-templates/mystery/deduction.md +71 -0
  40. package/skill/arc-templates/mystery/twist.md +71 -0
  41. package/skill/arc-templates/romance/angst.md +80 -0
  42. package/skill/arc-templates/romance/chase.md +71 -0
  43. package/skill/arc-templates/romance/slow-burn.md +71 -0
  44. package/skill/arc-templates/romance/sweet.md +80 -0
  45. package/skill/arc-templates/sci-fi/awakening.md +81 -0
  46. package/skill/arc-templates/sci-fi/breakthrough.md +81 -0
  47. package/skill/arc-templates/sci-fi/contact.md +81 -0
  48. package/skill/arc-templates/sci-fi/exploration.md +81 -0
  49. package/skill/arc-templates/urban/business.md +71 -0
  50. package/skill/arc-templates/urban/revenge.md +71 -0
  51. package/skill/arc-templates/urban/rise.md +71 -0
  52. package/skill/arc-templates/urban/romance.md +71 -0
  53. package/skill/arc-templates/western-fantasy/adventure.md +80 -0
  54. package/skill/arc-templates/western-fantasy/kingdom.md +71 -0
  55. package/skill/arc-templates/western-fantasy/magic-awakening.md +71 -0
  56. package/skill/arc-templates/western-fantasy/racial-conflict.md +71 -0
  57. package/skill/arc-templates/wuxia/breakthrough.md +71 -0
  58. package/skill/arc-templates/wuxia/grudge.md +71 -0
  59. package/skill/arc-templates/wuxia/hero-path.md +71 -0
  60. package/skill/arc-templates/wuxia/sect-war.md +71 -0
  61. package/skill/arc-templates/xianxia/breakthrough.md +71 -0
  62. package/skill/arc-templates/xianxia/dungeon.md +71 -0
  63. package/skill/arc-templates/xianxia/tournament.md +71 -0
  64. package/skill/arc-templates/xianxia/tribulation.md +71 -0
  65. package/skill/docs/examples.md +61 -0
  66. package/skill/docs/faq.md +81 -0
  67. package/skill/docs/installation.md +87 -0
  68. package/skill/docs/quickstart.md +83 -0
  69. package/skill/genre-packs/README.md +47 -0
  70. package/skill/genre-packs/_default/arc-types.md +153 -0
  71. package/skill/genre-packs/_default/rules.md +56 -0
  72. package/skill/genre-packs/_default/templates.md +135 -0
  73. package/skill/genre-packs/apocalypse/arc-types.md +109 -0
  74. package/skill/genre-packs/apocalypse/rules.md +113 -0
  75. package/skill/genre-packs/apocalypse/settings.md +106 -0
  76. package/skill/genre-packs/apocalypse/templates.md +192 -0
  77. package/skill/genre-packs/game/arc-types.md +109 -0
  78. package/skill/genre-packs/game/rules.md +113 -0
  79. package/skill/genre-packs/game/settings.md +103 -0
  80. package/skill/genre-packs/game/templates.md +173 -0
  81. package/skill/genre-packs/history/arc-types.md +109 -0
  82. package/skill/genre-packs/history/rules.md +107 -0
  83. package/skill/genre-packs/history/settings.md +126 -0
  84. package/skill/genre-packs/history/templates.md +179 -0
  85. package/skill/genre-packs/infinite-flow/arc-types.md +101 -0
  86. package/skill/genre-packs/infinite-flow/rules.md +75 -0
  87. package/skill/genre-packs/infinite-flow/settings.md +102 -0
  88. package/skill/genre-packs/infinite-flow/templates.md +226 -0
  89. package/skill/genre-packs/mystery/arc-types.md +109 -0
  90. package/skill/genre-packs/mystery/rules.md +107 -0
  91. package/skill/genre-packs/mystery/settings.md +103 -0
  92. package/skill/genre-packs/mystery/templates.md +178 -0
  93. package/skill/genre-packs/romance/arc-types.md +130 -0
  94. package/skill/genre-packs/romance/rules.md +88 -0
  95. package/skill/genre-packs/romance/settings.md +146 -0
  96. package/skill/genre-packs/romance/templates.md +245 -0
  97. package/skill/genre-packs/sci-fi/arc-types.md +109 -0
  98. package/skill/genre-packs/sci-fi/rules.md +113 -0
  99. package/skill/genre-packs/sci-fi/settings.md +99 -0
  100. package/skill/genre-packs/sci-fi/templates.md +170 -0
  101. package/skill/genre-packs/urban/arc-types.md +101 -0
  102. package/skill/genre-packs/urban/rules.md +75 -0
  103. package/skill/genre-packs/urban/settings.md +82 -0
  104. package/skill/genre-packs/urban/templates.md +212 -0
  105. package/skill/genre-packs/western-fantasy/arc-types.md +128 -0
  106. package/skill/genre-packs/western-fantasy/rules.md +88 -0
  107. package/skill/genre-packs/western-fantasy/settings.md +160 -0
  108. package/skill/genre-packs/western-fantasy/templates.md +225 -0
  109. package/skill/genre-packs/wuxia/arc-types.md +126 -0
  110. package/skill/genre-packs/wuxia/rules.md +86 -0
  111. package/skill/genre-packs/wuxia/settings.md +150 -0
  112. package/skill/genre-packs/wuxia/templates.md +195 -0
  113. package/skill/genre-packs/xianxia/arc-types.md +101 -0
  114. package/skill/genre-packs/xianxia/rules.md +74 -0
  115. package/skill/genre-packs/xianxia/settings.md +107 -0
  116. package/skill/genre-packs/xianxia/templates.md +202 -0
  117. package/skill/hooks/README.md +102 -0
  118. package/skill/hooks/chapter-complete.md +176 -0
  119. package/skill/hooks/context-injection.md +152 -0
  120. package/skill/hooks/intent-detection.md +183 -0
  121. package/skill/hooks/review-trigger.md +219 -0
  122. package/skill/hooks/summary-trigger.md +185 -0
  123. package/skill/references/act-guidance.md +228 -0
  124. package/skill/references/audit-core.md +130 -0
  125. package/skill/references/audit-dimensions.md +202 -0
  126. package/skill/references/character-voice-card.md +196 -0
  127. package/skill/references/consistency-checker.md +209 -0
  128. package/skill/references/content-expansion.md +68 -0
  129. package/skill/references/creative-constraints.md +200 -0
  130. package/skill/references/data-agent.md +286 -0
  131. package/skill/references/dialogue-writing.md +104 -0
  132. package/skill/references/editorial-perspective.md +166 -0
  133. package/skill/references/emotion-curve.md +127 -0
  134. package/skill/references/genre-rules.md +389 -0
  135. package/skill/references/golden-opening.md +81 -0
  136. package/skill/references/memory-system.md +288 -0
  137. package/skill/references/pacing-analysis.md +201 -0
  138. package/skill/references/platform-rules.md +244 -0
  139. package/skill/references/plot-structures.md +108 -0
  140. package/skill/references/reader-feedback.md +119 -0
  141. package/skill/references/rhythm-system.md +204 -0
  142. package/skill/references/style-imitation.md +193 -0
  143. package/skill/references/sweet-spot-tracking.md +182 -0
  144. package/skill/references/usage-guide.md +174 -0
  145. package/skill/references/writing-methods.md +169 -0
  146. package/skill/rules/anti-ai-expressions.md +206 -0
  147. package/skill/rules/character-voice.md +184 -0
  148. package/skill/rules/consistency-check.md +232 -0
  149. package/skill/rules/smart-query.md +263 -0
  150. package/skill/scripts/README.md +380 -0
  151. package/skill/scripts/auditor/chapter_transition.py +217 -0
  152. package/skill/scripts/auditor/consistency_scan.py +194 -0
  153. package/skill/scripts/auditor/dialogue_checker.py +194 -0
  154. package/skill/scripts/auditor/hook_report.py +115 -0
  155. package/skill/scripts/auditor/pacing_optimizer.py +303 -0
  156. package/skill/scripts/auditor/pacing_report.py +275 -0
  157. package/skill/scripts/auditor/pre_audit.py +203 -0
  158. package/skill/scripts/auditor/style_check.py +158 -0
  159. package/skill/scripts/auditor/worldbuilding_checker.py +637 -0
  160. package/skill/scripts/common/analyze.py +129 -0
  161. package/skill/scripts/common/init_guide.py +796 -0
  162. package/skill/scripts/common/install.py +169 -0
  163. package/skill/scripts/common/nm_utils.py +296 -0
  164. package/skill/scripts/common/validate.py +215 -0
  165. package/skill/scripts/coordinator/stats_report.py +165 -0
  166. package/skill/scripts/coordinator/volume_batch.py +121 -0
  167. package/skill/scripts/planner/outline_extractor.py +89 -0
  168. package/skill/scripts/planner/planner_context.py +220 -0
  169. package/skill/scripts/planner/query_engine.py +289 -0
  170. package/skill/scripts/reviewer/chapter_diff.py +143 -0
  171. package/skill/scripts/reviewer/character_arc_tracker.py +191 -0
  172. package/skill/scripts/reviewer/emotion_curve.py +340 -0
  173. package/skill/scripts/reviewer/foreshadowing_tracker.py +286 -0
  174. package/skill/scripts/reviewer/subplot_tracker.py +207 -0
  175. package/skill/scripts/reviewer/summary_generator.py +130 -0
  176. package/skill/scripts/reviewer/truth_diff.py +227 -0
  177. package/skill/scripts/reviewer/truth_manager.py +120 -0
  178. package/skill/scripts/test_scripts.py +366 -0
  179. package/skill/scripts/writer/build_write_context.py +255 -0
  180. package/skill/scripts/writer/chapter_info.py +67 -0
  181. package/skill/scripts/writer/check_wordcount.py +115 -0
  182. package/skill/scripts/writer/scene_builder.py +227 -0
  183. package/skill/scripts/writer/style_anchor.py +135 -0
  184. package/skill/styles/author-styles.md +53 -0
  185. package/skill/styles/authors//344/270/245/350/260/250/350/256/276/345/256/232/346/265/201//345/277/230/350/257/255.md +110 -0
  186. package/skill/styles/authors//344/270/245/350/260/250/350/256/276/345/256/232/346/265/201//347/210/261/346/275/234/346/260/264/347/232/204/344/271/214/350/264/274.md +110 -0
  187. package/skill/styles/authors//344/270/245/350/260/250/350/256/276/345/256/232/346/265/201//350/250/200/345/275/222/346/255/243/344/274/240.md +110 -0
  188. package/skill/styles/authors//345/244/232/347/245/236/350/257/235/347/203/255/350/241/200/346/265/201//344/270/211/344/271/235/351/237/263/345/237/237.md +108 -0
  189. package/skill/styles/authors//346/202/254/347/226/221/346/216/250/347/220/206/346/265/201//346/235/200/350/231/253/351/230/237/351/230/237/345/221/230.md +108 -0
  190. package/skill/styles/authors//346/220/236/347/254/221/345/271/275/351/273/230/346/265/201//344/270/211/345/244/251/344/270/244/350/247/211.md +110 -0
  191. package/skill/styles/authors//346/220/236/347/254/221/345/271/275/351/273/230/346/265/201//344/274/232/350/257/264/350/257/235/347/232/204/350/202/230/345/255/220.md +110 -0
  192. package/skill/styles/authors//346/220/236/347/254/221/345/271/275/351/273/230/346/265/201//345/215/226/346/212/245/345/260/217/351/203/216/345/220/233.md +108 -0
  193. package/skill/styles/authors//346/220/236/347/254/221/345/271/275/351/273/230/346/265/201//345/274/210/351/235/222/345/263/260.md +123 -0
  194. package/skill/styles/authors//347/203/255/350/241/200/345/215/207/347/272/247/346/265/201//345/224/220/345/256/266/344/270/211/345/260/221.md +109 -0
  195. package/skill/styles/authors//347/203/255/350/241/200/345/215/207/347/272/247/346/265/201//345/244/251/350/232/225/345/234/237/350/261/206.md +110 -0
  196. package/skill/styles/authors//347/203/255/350/241/200/345/215/207/347/272/247/346/265/201//346/210/221/345/220/203/350/245/277/347/272/242/346/237/277.md +108 -0
  197. package/skill/styles/authors//347/203/255/350/241/200/345/215/207/347/272/247/346/265/201//346/273/232/345/274/200.md +109 -0
  198. package/skill/styles/authors//347/203/255/350/241/200/345/215/207/347/272/247/346/265/201//350/276/260/344/270/234.md +109 -0
  199. package/skill/styles/authors//347/211/271/350/211/262/351/242/206/345/237/237/346/265/201//345/244/251/344/270/213/351/234/270/345/224/261.md +110 -0
  200. package/skill/styles/authors//347/211/271/350/211/262/351/242/206/345/237/237/346/265/201//346/234/210/345/205/263.md +108 -0
  201. package/skill/styles/authors//347/211/271/350/211/262/351/242/206/345/237/237/346/265/201//350/220/247/351/274/216.md +109 -0
  202. package/skill/styles/authors//347/211/271/350/211/262/351/242/206/345/237/237/346/265/201//350/235/264/350/235/266/350/223/235.md +112 -0
  203. package/skill/styles/authors//347/273/206/350/205/273/346/226/207/351/235/222/346/265/201//346/204/244/346/200/222/347/232/204/351/246/231/350/225/211.md +109 -0
  204. package/skill/styles/authors//347/273/206/350/205/273/346/226/207/351/235/222/346/265/201//347/203/275/347/201/253/346/210/217/350/257/270/344/276/257.md +109 -0
  205. package/skill/styles/authors//347/273/206/350/205/273/346/226/207/351/235/222/346/265/201//347/214/253/350/205/273.md +110 -0
  206. package/skill/styles/authors//347/273/206/350/205/273/346/226/207/351/235/222/346/265/201//350/200/263/346/240/271.md +109 -0
  207. package/skill/templates/INDEX.md +48 -0
  208. package/skill/templates/act-plan.md +72 -0
  209. package/skill/templates/chapter.md +53 -0
  210. package/skill/templates/character-profile.md +107 -0
  211. package/skill/templates/character-voice.md +106 -0
  212. package/skill/templates/constitution.md +90 -0
  213. package/skill/templates/emotional-arcs.md +37 -0
  214. package/skill/templates/hook-template.md +68 -0
  215. package/skill/templates/outline.md +155 -0
  216. package/skill/templates/plot-card.md +432 -0
  217. package/skill/templates/power-system.md +124 -0
  218. package/skill/templates/presets.json +69 -0
  219. package/skill/templates/review-report.md +135 -0
  220. package/skill/templates/scene-plan.md +221 -0
  221. package/skill/templates/scene-template.md +78 -0
  222. package/skill/templates/subplot-board.md +48 -0
  223. package/skill/templates/summary-10chapters.md +79 -0
  224. package/skill/templates/summary-50chapters.md +131 -0
  225. package/skill/templates/summary-volume.md +148 -0
  226. package/skill/templates/timeline.md +37 -0
  227. package/skill/templates/volume-plan.md +44 -0
  228. package/skill/templates/world-setting.md +151 -0
@@ -0,0 +1,263 @@
1
+ # 智能查询规则
2
+
3
+ ## 核心原则
4
+
5
+ 智能查询系统提供4种意图的快速查询,帮助用户快速获取小说相关信息,无需手动翻阅文档。
6
+
7
+ ---
8
+
9
+ ## 查询类型
10
+
11
+ ### 1. 角色查询
12
+
13
+ **查询内容**:
14
+ - 角色设定(姓名、身份、背景)
15
+ - 角色状态(等级、位置、情绪)
16
+ - 角色关系(血缘、师徒、敌对、恋人)
17
+ - 角色技能(能力、功法、武器)
18
+
19
+ **示例查询**:
20
+ ```
21
+ 用户:林风是什么等级?
22
+ AI:林风当前等级为高级修士,擅长剑法,拥有"御风术"技能。
23
+
24
+ 用户:苏雨和林风什么关系?
25
+ AI:苏雨和林风是恋人关系,第3章相遇,第20章表白。
26
+
27
+ 用户:列出所有反派角色
28
+ AI:当前主要反派角色:
29
+ 1. 张天(林风的师兄,黑化叛变)
30
+ 2. 魔尊(终极BOSS,幕后黑手)
31
+ ```
32
+
33
+ **查询来源**:
34
+ - `truth-files/characters.md` - 角色档案
35
+ - `truth-files/current-state.md` - 世界状态
36
+ - `novels/volume-XX/chapters/` - 章节内容
37
+
38
+ ### 2. 设定查询
39
+
40
+ **查询内容**:
41
+ - 世界观设定(地理、历史、文化)
42
+ - 力量体系(等级、修炼、技能)
43
+ - 社会制度(等级、法律、习俗)
44
+ - 特殊设定(魔法、科技、规则)
45
+
46
+ **示例查询**:
47
+ ```
48
+ 用户:这个世界有几种修炼体系?
49
+ AI:本世界有3种修炼体系:
50
+ 1. 剑修体系(初级→中级→高级→大师→宗师)
51
+ 2. 法修体系(初级→中级→高级→大师→宗师)
52
+ 3. 体修体系(初级→中级→高级→大师→宗师)
53
+
54
+ 用户:王都在哪里?
55
+ AI:王都位于大陆中央,是政治、经济、文化中心。从北境骑马需要7天,从东海坐船需要3天。
56
+ ```
57
+
58
+ **查询来源**:
59
+ - `truth-files/world-setting.md` - 世界观设定
60
+ - `truth-files/power-system.md` - 力量体系
61
+ - `skill/genre-packs/` - 题材包设定
62
+
63
+ ### 3. 剧情查询
64
+
65
+ **查询内容**:
66
+ - 章节摘要(某章发生了什么)
67
+ - 事件追踪(某事件的详细过程)
68
+ - 角色经历(某角色遇到过什么)
69
+ - 剧情进展(当前剧情到哪里)
70
+
71
+ **示例查询**:
72
+ ```
73
+ 用户:第三章发生了什么?
74
+ AI:第三章主要内容:
75
+ - 林风在山林中遇到神秘老人
76
+ - 老人赠予林风一把古剑
77
+ - 林风发现古剑有封印
78
+ - 章末伏笔:老人身份成谜
79
+
80
+ 用户:主角遇到过哪些敌人?
81
+ AI:林风遇到的主要敌人:
82
+ 1. 第5章:山贼(被林风击败)
83
+ 2. 第15章:张天(师兄,黑化后成为敌人)
84
+ 3. 第30章:魔尊手下(试探性攻击)
85
+ ```
86
+
87
+ **查询来源**:
88
+ - `novels/volume-XX/chapters/` - 章节内容
89
+ - `.novel-maker/summaries/` - 阶段总结
90
+ - `novels/outline.md` - 总大纲
91
+
92
+ ### 4. 伏笔查询
93
+
94
+ **查询内容**:
95
+ - 伏笔状态(已埋设/已回收/未回收)
96
+ - 伏笔详情(埋设章节、内容、预期回收)
97
+ - 伏笔关联(与其他伏笔的关系)
98
+ - 回收建议(如何回收某个伏笔)
99
+
100
+ **示例查询**:
101
+ ```
102
+ 用户:有哪些未回收的伏笔?
103
+ AI:当前未回收的伏笔:
104
+ 1. 第3章:神秘老人赠剑(预期第50章回收)
105
+ 2. 第10章:古籍预言(预期第80章回收)
106
+ 3. 第15章:林风的怪病(未设定回收点)
107
+
108
+ 用户:神秘老人的剑后来怎样了?
109
+ AI:神秘老人的剑(古剑·风吟):
110
+ - 第3章埋设:老人赠剑,剑有封印
111
+ - 第20章进展:林风尝试解封,失败
112
+ - 第50章回收:剑中封印觉醒,释放剑灵
113
+ - 当前状态:已回收
114
+ ```
115
+
116
+ **查询来源**:
117
+ - `truth-files/pending-hooks.md` - 伏笔表
118
+ - `novels/volume-XX/chapters/` - 章节内容
119
+
120
+ ---
121
+
122
+ ## 查询引擎实现
123
+
124
+ ### 查询意图识别
125
+
126
+ ```python
127
+ def detect_query_intent(query: str) -> str:
128
+ """识别查询意图"""
129
+ # 角色相关关键词
130
+ character_keywords = ["角色", "人物", "主角", "反派", "等级", "技能", "关系", "谁", "名字"]
131
+
132
+ # 设定相关关键词
133
+ setting_keywords = ["世界", "设定", "体系", "规则", "地理", "历史", "制度", "魔法", "修炼"]
134
+
135
+ # 剧情相关关键词
136
+ plot_keywords = ["剧情", "章节", "发生", "事件", "遇到", "经历", "进展", "故事"]
137
+
138
+ # 伏笔相关关键词
139
+ hook_keywords = ["伏笔", "埋设", "回收", "悬念", "谜团", "暗示", "铺垫"]
140
+
141
+ # 关键词匹配
142
+ for keyword in character_keywords:
143
+ if keyword in query:
144
+ return "character"
145
+
146
+ for keyword in setting_keywords:
147
+ if keyword in query:
148
+ return "setting"
149
+
150
+ for keyword in plot_keywords:
151
+ if keyword in query:
152
+ return "plot"
153
+
154
+ for keyword in hook_keywords:
155
+ if keyword in query:
156
+ return "hook"
157
+
158
+ # 默认为剧情查询
159
+ return "plot"
160
+ ```
161
+
162
+ ### 查询路由
163
+
164
+ ```python
165
+ def route_query(intent: str, query: str) -> str:
166
+ """根据意图路由查询"""
167
+ if intent == "character":
168
+ return query_character(query)
169
+ elif intent == "setting":
170
+ return query_setting(query)
171
+ elif intent == "plot":
172
+ return query_plot(query)
173
+ elif intent == "hook":
174
+ return query_hook(query)
175
+ else:
176
+ return "抱歉,我无法理解您的查询。请尝试更具体的描述。"
177
+ ```
178
+
179
+ ### 查询结果格式化
180
+
181
+ ```python
182
+ def format_query_result(intent: str, result: dict) -> str:
183
+ """格式化查询结果"""
184
+ if intent == "character":
185
+ return format_character_result(result)
186
+ elif intent == "setting":
187
+ return format_setting_result(result)
188
+ elif intent == "plot":
189
+ return format_plot_result(result)
190
+ elif intent == "hook":
191
+ return format_hook_result(result)
192
+ else:
193
+ return str(result)
194
+ ```
195
+
196
+ ---
197
+
198
+ ## 使用方式
199
+
200
+ ### 指令触发
201
+
202
+ ```
203
+ /novel-maker query 林风是什么等级?
204
+ /novel-maker query 有哪些未回收的伏笔?
205
+ /novel-maker query 第三章发生了什么?
206
+ ```
207
+
208
+ ### 自然语言触发
209
+
210
+ ```
211
+ 用户:主角现在什么境界?
212
+ AI:[自动识别为角色查询] 林风当前等级为高级修士...
213
+
214
+ 用户:这个世界有几种修炼体系?
215
+ AI:[自动识别为设定查询] 本世界有3种修炼体系...
216
+ ```
217
+
218
+ ### 查询结果展示
219
+
220
+ ```markdown
221
+ ## 查询结果
222
+
223
+ **查询**:林风是什么等级?
224
+
225
+ **结果**:
226
+ - **当前等级**:高级修士
227
+ - **擅长技能**:剑法、御风术
228
+ - **武器**:古剑·风吟(已解封)
229
+ - **状态**:健康,正在前往王都
230
+
231
+ **来源**:
232
+ - 角色档案:truth-files/characters.md
233
+ - 世界状态:truth-files/current-state.md
234
+ - 最新章节:第50章
235
+ ```
236
+
237
+ ---
238
+
239
+ ## 查询优化
240
+
241
+ ### 1. 缓存机制
242
+
243
+ - 缓存常用查询结果
244
+ - 缓存失效策略:章节更新后自动失效
245
+
246
+ ### 2. 模糊匹配
247
+
248
+ - 支持角色别名(如"主角"→"林风")
249
+ - 支持同义词(如"等级"→"境界")
250
+
251
+ ### 3. 上下文关联
252
+
253
+ - 记忆用户之前的查询
254
+ - 支持追问(如"他有什么技能?")
255
+
256
+ ---
257
+
258
+ ## 参考资源
259
+
260
+ - 角色档案:`truth-files/characters.md`
261
+ - 世界状态:`truth-files/current-state.md`
262
+ - 伏笔表:`truth-files/pending-hooks.md`
263
+ - 章节内容:`novels/volume-XX/chapters/`
@@ -0,0 +1,380 @@
1
+ # 辅助脚本
2
+
3
+ 预处理章节数据和项目文件,将全文(~4000 token)压缩为结构化 JSON(~200 token),**节省约 90% token 消耗**。
4
+
5
+ 所有脚本共用 `nm_utils.py` 公共模块,提供 Markdown 清理、字数统计、角色提取、地点提取、钩子检测、章节排序、摘要生成、节奏评级、大纲解析、真相文件读取等工具函数。
6
+
7
+ ---
8
+
9
+ ## nm_utils.py — 公共工具模块
10
+
11
+ 所有脚本共用的基础函数,脚本通过 `from nm_utils import ...` 调用:
12
+
13
+ | 函数 | 说明 |
14
+ |------|------|
15
+ | `clean_markdown(text)` | 去除 Markdown 格式标记 |
16
+ | `count_chinese(text)` | 统计中文字符数 |
17
+ | `extract_title(content)` | 提取章节标题 |
18
+ | `read_chapter(filepath)` | 读取章节,返回 `(raw, title, clean, wc)` |
19
+ | `extract_content_from_chapter(path)` | 提取章节正文(跳过标题行) |
20
+ | `extract_characters(text)` | 从对话模式提取角色名(已过滤代词/动词噪音) |
21
+ | `extract_locations(text)` | 从位移模式提取地点名 |
22
+ | `detect_hook(text)` | 检测章节结尾钩子类型(6种) |
23
+ | `detect_hook_type_from_patterns(text)` | 用预编译正则快速检测钩子类型 |
24
+ | `generate_summary(text)` | 生成开头+结尾摘要 |
25
+ | `detect_structure(text)` | 检测对话/动作/描写比例 |
26
+ | `estimate_pacing(text)` | 估算章节节奏等级(S1-S5) |
27
+ | `parse_outline_headings(text)` | 解析 Markdown 大纲标题树 |
28
+ | `read_truth_section(filepath)` | 解析真相文件分段内容 |
29
+ | `chapter_sort_key(filepath)` | 章节文件名排序键(支持中文数字) |
30
+ | `list_chapters(dir, recent_n)` | 列出目录中排序后的章节文件 |
31
+
32
+ ---
33
+
34
+ ## init_guide.py — 初始化引导脚本
35
+
36
+ **用途:** 交互式引导脚本,帮助用户完成初始化流程
37
+
38
+ **使用方式:**
39
+ ```bash
40
+ python scripts/common/init_guide.py [--ide trae|claude] [--auto] [--verify]
41
+ ```
42
+
43
+ **参数说明:**
44
+ - `--ide`: 指定IDE类型(trae 或 claude)
45
+ - `--auto`: 自动模式,使用默认配置
46
+ - `--verify`: 验证安装是否成功
47
+
48
+ **示例:**
49
+ ```bash
50
+ # 交互式引导
51
+ python scripts/common/init_guide.py
52
+
53
+ # 指定IDE类型
54
+ python scripts/common/init_guide.py --ide trae
55
+
56
+ # 自动模式
57
+ python scripts/common/init_guide.py --auto
58
+
59
+ # 验证安装
60
+ python scripts/common/init_guide.py --verify
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 统一分析脚本 (推荐)
66
+
67
+ ### analyze.py — 三合一分析
68
+
69
+ 整合了 `chapter_info.py` + `style_check.py` + `hook_report.py` 的功能,支持三种模式:
70
+
71
+ ```bash
72
+ # 单章分析 (代替 chapter_info.py)
73
+ python scripts/common/analyze.py novels/volume-01/chapters/ch01.md --mode single --json
74
+
75
+ # 风格检测 (代替 style_check.py)
76
+ python scripts/common/analyze.py novels/volume-01/chapters/ch01.md --mode style --json
77
+
78
+ # 批量分析 (代替 hook_report.py + 卷级统计)
79
+ python scripts/common/analyze.py novels/volume-01/chapters/ --mode batch --recent 5 --json
80
+ ```
81
+
82
+ **输出模式**:
83
+ - `--json`: 纯JSON格式(供AI读取)
84
+ - 默认: 人类可读格式
85
+
86
+ **批量模式增强功能**:
87
+ - 钩子类型分布 + 连续相同钩子警告
88
+ - 节奏S1-S5分布 + 连续高潮/平淡警告
89
+ - 总字数/均章字数统计
90
+
91
+ ---
92
+
93
+ ## 写作流程脚本
94
+
95
+ ### check_wordcount.py — 字数检查
96
+
97
+ ```bash
98
+ python scripts/writer/check_wordcount.py novels/volume-01/chapters/ch01.md
99
+ python scripts/writer/check_wordcount.py novels/volume-01/chapters/ch01.md 2500 3500 # 自定义区间
100
+ python scripts/writer/check_wordcount.py --all novels/volume-01/chapters/ # 批量检查
101
+ ```
102
+
103
+ ### chapter_info.py — 单章结构化提取
104
+
105
+ ```bash
106
+ python scripts/writer/chapter_info.py novels/volume-01/chapters/ch01.md --json
107
+ ```
108
+
109
+ 输出:`word_count` / `characters` / `locations` / `structure` / `hook` / `summary`
110
+
111
+ ### volume_batch.py — 卷级批量汇总
112
+
113
+ ```bash
114
+ python scripts/coordinator/volume_batch.py novels/volume-01/chapters/ --json
115
+ python scripts/coordinator/volume_batch.py novels/volume-01/chapters/ --recent 5 --json
116
+ ```
117
+
118
+ 输出:`total_chapters` / `total_words` / `chapters[]` / `main_characters` / `character_matrix` / `foreshadowing_summary` / `hook_distribution`
119
+
120
+ ---
121
+
122
+ ## 审查脚本
123
+
124
+ ### consistency_scan.py — 一致性扫描
125
+
126
+ ```bash
127
+ python scripts/auditor/consistency_scan.py novels/volume-01/chapters/ novels/volume-01/truth-files/ --json
128
+ ```
129
+
130
+ 输出:`truth_characters_count` / `summary`(新角色/等级冲突/警告)
131
+
132
+ ### style_check.py — AI味检测
133
+
134
+ ```bash
135
+ python scripts/auditor/style_check.py novels/volume-01/chapters/ch01.md --json
136
+ python scripts/auditor/style_check.py novels/volume-01/chapters/ --recent 5 --json
137
+ ```
138
+
139
+ 输出:`ai_density_per_1000` / `ai_words_found` / `repetitive_words` / `dialogue_ratio_pct` / `issues`
140
+
141
+ ### hook_report.py — 钩子密度报告
142
+
143
+ ```bash
144
+ python scripts/auditor/hook_report.py novels/volume-01/chapters/ --json
145
+ python scripts/auditor/hook_report.py novels/volume-01/chapters/ --recent 5 --json
146
+ ```
147
+
148
+ 输出:`hook_distribution` / `warnings`(连续相同钩子/未知钩子)
149
+
150
+ ### pacing_report.py — 卷级节奏报告
151
+
152
+ ```bash
153
+ python scripts/auditor/pacing_report.py novels/volume-01/chapters/ --json
154
+ python scripts/auditor/pacing_report.py novels/volume-01/chapters/ --recent 10 --json
155
+ ```
156
+
157
+ 输出:`pacing_distribution`(S1-S5分布) / `problems`(连续高潮/平淡/峰值间隔) / `read_trends`(追读力趋势) / `suggestions`
158
+
159
+ ---
160
+
161
+ ## 统计与总结脚本
162
+
163
+ ### stats_report.py — 项目统计报告
164
+
165
+ ```bash
166
+ python scripts/coordinator/stats_report.py novels/ --json
167
+ python scripts/coordinator/stats_report.py novels/ --volume volume-01 --json
168
+ ```
169
+
170
+ 输出:`volumes` / `total_chapters` / `total_words` / `volume_details`(章节/角色/场景/节奏分布)
171
+
172
+ ### summary_generator.py — 阶段总结辅助
173
+
174
+ ```bash
175
+ python scripts/reviewer/summary_generator.py novels/volume-01/chapters/ --range 1-10 --json
176
+ python scripts/reviewer/summary_generator.py novels/volume-01/chapters/ --last 5 --json
177
+ ```
178
+
179
+ 输出:`timeline`(每章角色/开头/结尾/钩子) / `characters_involved` / `locations_visited`
180
+
181
+ ---
182
+
183
+ ## 大纲与实体脚本
184
+
185
+ ### outline_extractor.py — 大纲快速提取
186
+
187
+ ```bash
188
+ python scripts/planner/outline_extractor.py novels/ --json
189
+ python scripts/planner/outline_extractor.py novels/outline.md --json
190
+ ```
191
+
192
+ 输出:`outline` / `volume-01` / `volume-01/act-plan` 等文件的标题树
193
+
194
+ ### truth_manager.py — 真相文件管理器
195
+
196
+ ```bash
197
+ python scripts/reviewer/truth_manager.py .novel-maker/truth-files/ --json
198
+ python scripts/reviewer/truth_manager.py .novel-maker/truth-files/ --entity characters --json
199
+ ```
200
+
201
+ 输出:`characters`(角色名提取) / `pending-hooks`(伏笔提取) / `power-system` / `world-setting` / `current-state`
202
+
203
+ ---
204
+
205
+ ## 安装脚本
206
+
207
+ ### install.py — Python 安装脚本
208
+
209
+ 当 `npx novel-maker` 不可用时的备选方案:
210
+
211
+ ```bash
212
+ python scripts/common/install.py [--tool trae|claude|cursor] [--list]
213
+ ```
214
+
215
+ ---
216
+
217
+ ## 智能查询脚本
218
+
219
+ ### query_engine.py — 智能查询引擎
220
+
221
+ 4种查询类型:角色查询、设定查询、剧情查询、伏笔查询。
222
+
223
+ ```bash
224
+ python scripts/planner/query_engine.py '林风是什么等级?'
225
+ python scripts/planner/query_engine.py --type character '林风'
226
+ python scripts/planner/query_engine.py --type foreshadow '魔剑'
227
+ ```
228
+
229
+ ---
230
+
231
+ ## 风格分析脚本
232
+
233
+ ### style_anchor.py — 风格锚点提取
234
+
235
+ 从最近5章提取句长分布、对话比例、高频词,输出 style-anchor.json。
236
+
237
+ ```bash
238
+ python scripts/writer/style_anchor.py novels/volume-01/chapters/
239
+ python scripts/writer/style_anchor.py novels/volume-01/chapters/ --recent 10 --json
240
+ ```
241
+
242
+ 输出:`avg_sentence_length` / `dialogue_ratio` / `top_words` / `style_signature`
243
+
244
+ ---
245
+
246
+ ## 节奏报告脚本(含可视化)
247
+
248
+ ### pacing_report.py — 卷级节奏报告
249
+
250
+ 分析卷内所有章节的节奏分布、问题区域、追读力趋势,支持 emoji 可视化。
251
+
252
+ ```bash
253
+ python scripts/auditor/pacing_report.py 章节目录 --json
254
+ python scripts/auditor/pacing_report.py 章节目录 --visualize
255
+ python scripts/auditor/pacing_report.py 章节目录 --recent 10
256
+ ```
257
+
258
+ 输出:`pacing_distribution`(S1-S5分布) / `problems`(问题区域) / `read_trends`(追读力趋势) / `hook_distribution`(钩子分布) / `suggestions`(改进建议) / `heatmap`(热力图,--visualize时) / `emotion_stats`(情绪统计,--visualize时)
259
+
260
+ **功能说明:**
261
+ - 节奏分布统计(S1-S5五级)
262
+ - 问题区域检测(连续高潮/连续平淡/峰值间隔)
263
+ - 追读力趋势评估(每5章一组)
264
+ - 钩子类型分布
265
+ - 后续写作建议
266
+ - 节奏热力图(--visualize)
267
+ - 多维度情绪统计(--visualize)
268
+
269
+ ---
270
+
271
+ ## Token 优化脚本
272
+
273
+ ### build_write_context.py — 写手上下文构建器
274
+
275
+ 一键生成写作所需的精简上下文,将 15+ 个文件压缩为 ~3000 token 的 JSON。
276
+
277
+ ```bash
278
+ python scripts/writer/build_write_context.py novels/volume-01/chapters/ch15.md --json
279
+ python scripts/writer/build_write_context.py --chapter 15 --volume 01 --json
280
+ ```
281
+
282
+ 输出:`truth_files`(精简真相文件) / `prev_chapters`(前章摘要) / `outline`(大纲目标) / `constitution`(宪法要点)
283
+
284
+ **节省:每章约 40,000-60,000 token**
285
+
286
+ ### pre_audit.py — 预审计管线
287
+
288
+ 一键运行所有可自动化的审计维度(字数/钩子/节奏/AI味/一致性)。
289
+
290
+ ```bash
291
+ python scripts/auditor/pre_audit.py novels/volume-01/chapters/ch15.md --json
292
+ ```
293
+
294
+ 输出:`word_count` / `characters` / `hook` / `pacing` / `ai_style` / `consistency` / `summary`
295
+
296
+ **节省:每章约 20,000-30,000 token**
297
+
298
+ ### truth_diff.py — 真相文件变更检测
299
+
300
+ 自动检测章节变更并生成更新 diff(新角色/新地点/伏笔/情感)。
301
+
302
+ ```bash
303
+ python scripts/reviewer/truth_diff.py ch15.md --truth-dir .novel-maker/truth-files/ --prev ch14.md --json
304
+ ```
305
+
306
+ 输出:`new_characters` / `new_locations` / `hook_keywords` / `emotions` / `continuing_characters`
307
+
308
+ **节省:每章约 35,000-50,000 token**
309
+
310
+ ### planner_context.py — 规划师上下文包
311
+
312
+ 一键生成规划所需的精简上下文,将 10+ 个文件压缩为 ~5000 token 的 JSON。
313
+
314
+ ```bash
315
+ python scripts/planner/planner_context.py --volume 01 --act 2 --json
316
+ ```
317
+
318
+ 输出:`volume_progress`(卷进度) / `truth_files`(真相文件摘要) / `outline`(大纲目标) / `active_hooks`(活跃伏笔) / `active_subplots`(活跃支线)
319
+
320
+ **节省:每次规划约 25,000 token**
321
+
322
+ ### chapter_diff.py — 章节修订对比
323
+
324
+ 比较原稿和修订稿的结构化差异(角色/伏笔/字数/结构/节奏)。
325
+
326
+ ```bash
327
+ python scripts/reviewer/chapter_diff.py temp/draft.md temp/revised.md --json
328
+ ```
329
+
330
+ 输出:`word_count` / `characters` / `locations` / `hook` / `structure` / `pacing` / `summary`
331
+
332
+ **节省:每次修订约 8,000 token**
333
+
334
+ ---
335
+
336
+ ## 验证脚本
337
+
338
+ ### validate.py — 技能完整性验证
339
+
340
+ 验证所有技能文件的完整性和正确性(脚本语法/文件引用/角色/题材包/弧线模板/规则/模板/Hook)。
341
+
342
+ ```bash
343
+ python scripts/common/validate.py
344
+ ```
345
+
346
+ 输出:134项检查结果(通过/警告/失败),覆盖8个维度。
347
+
348
+ ---
349
+
350
+ ## 在 NovelMaker 工作流中的位置
351
+
352
+ ```
353
+ /novel-maker write 继续
354
+ ↓ ① python scripts/writer/chapter_info.py 前章.md --json → AI 读 ~200 token 代替 ~4000 token
355
+ ↓ ② AI 写作 → 审查 → 更新大纲/记忆
356
+ ↓ ③ python scripts/writer/check_wordcount.py 本章.md → 验证字数达标
357
+
358
+ /novel-maker review
359
+ ↓ ① python scripts/auditor/consistency_scan.py 章节/ 真相/ --json → 一致性扫描
360
+ ↓ ② python scripts/auditor/style_check.py 章节/ --json → AI味检测
361
+ ↓ ③ python scripts/auditor/hook_report.py 章节/ --json → 钩子密度
362
+ ↓ ④ python scripts/auditor/pacing_report.py 章节/ --json → 节奏报告
363
+
364
+ /novel-maker act 下一幕怎么走
365
+ ↓ ① python scripts/coordinator/volume_batch.py chapters/ --recent 5 --json → 批量上下文
366
+ ↓ ② python scripts/auditor/hook_report.py chapters/ --recent 5 --json → 钩子趋势
367
+ ↓ ③ AI 展示现状 + 6条分支 → 用户选择 → 偏离检查 → 同步更新
368
+
369
+ /novel-maker stats
370
+ ↓ python scripts/coordinator/stats_report.py novels/ --json → 项目统计
371
+
372
+ /novel-maker summary
373
+ ↓ python scripts/reviewer/summary_generator.py chapters/ --last 10 --json → 阶段总结辅助
374
+
375
+ /novel-maker memory outline
376
+ ↓ python scripts/planner/outline_extractor.py novels/ --json → 大纲树
377
+
378
+ /novel-maker memory entity
379
+ ↓ python scripts/reviewer/truth_manager.py truth-files/ --json → 真相文件管理
380
+ ```