novelws 3.0.0 → 4.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.
Files changed (237) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/README.md +94 -66
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +35 -33
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/upgrade.d.ts.map +1 -1
  7. package/dist/commands/upgrade.js +63 -6
  8. package/dist/commands/upgrade.js.map +1 -1
  9. package/dist/core/config.d.ts +22 -15
  10. package/dist/core/config.d.ts.map +1 -1
  11. package/dist/core/config.js +28 -16
  12. package/dist/core/config.js.map +1 -1
  13. package/dist/core/errors.d.ts +16 -0
  14. package/dist/core/errors.d.ts.map +1 -1
  15. package/dist/core/errors.js +26 -0
  16. package/dist/core/errors.js.map +1 -1
  17. package/dist/utils/diagnostics.d.ts +64 -0
  18. package/dist/utils/diagnostics.d.ts.map +1 -0
  19. package/dist/utils/diagnostics.js +227 -0
  20. package/dist/utils/diagnostics.js.map +1 -0
  21. package/package.json +1 -1
  22. package/templates/commands/analyze.md +27 -110
  23. package/templates/commands/character.md +32 -180
  24. package/templates/commands/checklist.md +27 -27
  25. package/templates/commands/clarify.md +2 -2
  26. package/templates/commands/constitution.md +8 -8
  27. package/templates/commands/expert.md +3 -3
  28. package/templates/commands/facts.md +9 -9
  29. package/templates/commands/guide.md +129 -19
  30. package/templates/commands/help-me.md +221 -0
  31. package/templates/commands/plan.md +27 -26
  32. package/templates/commands/recap.md +16 -16
  33. package/templates/commands/relations.md +13 -13
  34. package/templates/commands/revise.md +16 -15
  35. package/templates/commands/search.md +11 -10
  36. package/templates/commands/specify.md +4 -4
  37. package/templates/commands/tasks.md +9 -9
  38. package/templates/commands/timeline.md +13 -13
  39. package/templates/commands/track-init.md +8 -8
  40. package/templates/commands/track.md +177 -552
  41. package/templates/commands/volume-summary.md +6 -6
  42. package/templates/commands/write.md +148 -38
  43. package/templates/dot-claude/CLAUDE.md +5 -5
  44. package/templates/{config → resources/config}/keyword-mappings.json +19 -19
  45. package/templates/resources/genres/horror.md +211 -0
  46. package/templates/resources/genres/military.md +209 -0
  47. package/templates/resources/genres/sports.md +216 -0
  48. package/templates/resources/genres/workplace.md +214 -0
  49. package/templates/resources/genres/youth.md +219 -0
  50. package/templates/{knowledge-base/requirements/anti-ai-v4.md → resources/requirements/anti-ai-v4-deprecated.md} +13 -1
  51. package/templates/resources/requirements/anti-ai-v5-balanced.md +203 -0
  52. package/templates/{scripts → resources/scripts}/README.md +8 -8
  53. package/templates/{scripts → resources/scripts}/bash/analyze-story.sh +1 -1
  54. package/templates/resources/scripts/bash/check-analyze-stage.sh +108 -0
  55. package/templates/{scripts → resources/scripts}/bash/check-consistency.sh +7 -7
  56. package/templates/{scripts → resources/scripts}/bash/check-facts.sh +1 -1
  57. package/templates/{scripts → resources/scripts}/bash/check-plot.sh +2 -2
  58. package/templates/{scripts → resources/scripts}/bash/check-timeline.sh +3 -3
  59. package/templates/{scripts → resources/scripts}/bash/check-world.sh +5 -5
  60. package/templates/{scripts → resources/scripts}/bash/check-writing-state.sh +26 -26
  61. package/templates/{scripts → resources/scripts}/bash/common.sh +3 -3
  62. package/templates/{scripts → resources/scripts}/bash/constitution.sh +1 -1
  63. package/templates/{scripts → resources/scripts}/bash/init-tracking.sh +13 -13
  64. package/templates/{scripts → resources/scripts}/bash/manage-relations.sh +10 -10
  65. package/templates/resources/scripts/bash/migrate-tracking.sh +183 -0
  66. package/templates/{scripts → resources/scripts}/bash/plan-story.sh +2 -2
  67. package/templates/{scripts → resources/scripts}/bash/specify-story.sh +1 -1
  68. package/templates/{scripts → resources/scripts}/bash/tasks-story.sh +2 -2
  69. package/templates/{scripts → resources/scripts}/bash/tests/bench-preload-cache.sh +3 -3
  70. package/templates/{scripts → resources/scripts}/bash/tests/test-cross-platform.sh +1 -1
  71. package/templates/{scripts → resources/scripts}/bash/tests/test-preload-cache.sh +1 -1
  72. package/templates/{scripts → resources/scripts}/bash/tests/test-regex-precompile.sh +4 -4
  73. package/templates/{scripts → resources/scripts}/bash/text-audit.sh +3 -3
  74. package/templates/{scripts → resources/scripts}/bash/track-progress.sh +5 -5
  75. package/templates/{scripts → resources/scripts}/powershell/analyze-story.ps1 +1 -1
  76. package/templates/{scripts → resources/scripts}/powershell/check-consistency.ps1 +8 -8
  77. package/templates/{scripts → resources/scripts}/powershell/check-plot.ps1 +2 -2
  78. package/templates/{scripts → resources/scripts}/powershell/check-timeline.ps1 +2 -2
  79. package/templates/{scripts → resources/scripts}/powershell/check-writing-state.ps1 +31 -31
  80. package/templates/{scripts → resources/scripts}/powershell/common.ps1 +2 -2
  81. package/templates/{scripts → resources/scripts}/powershell/constitution.ps1 +1 -1
  82. package/templates/{scripts → resources/scripts}/powershell/init-tracking.ps1 +5 -5
  83. package/templates/{scripts → resources/scripts}/powershell/manage-relations.ps1 +6 -6
  84. package/templates/{scripts → resources/scripts}/powershell/migrate-tracking.ps1 +1 -1
  85. package/templates/{scripts → resources/scripts}/powershell/plan-story.ps1 +2 -2
  86. package/templates/{scripts → resources/scripts}/powershell/specify-story.ps1 +1 -1
  87. package/templates/{scripts → resources/scripts}/powershell/tests/bench-ps-cache.ps1 +10 -10
  88. package/templates/{scripts → resources/scripts}/powershell/tests/test-ps-cache.ps1 +4 -4
  89. package/templates/{scripts → resources/scripts}/powershell/text-audit.ps1 +2 -2
  90. package/templates/{scripts → resources/scripts}/powershell/track-progress.ps1 +2 -2
  91. package/templates/skills/analysis/character-analysis/SKILL.md +1 -1
  92. package/templates/skills/analysis/foreshadow-analysis/SKILL.md +1 -1
  93. package/templates/skills/analysis/hook-analysis/SKILL.md +2 -2
  94. package/templates/skills/analysis/logic-analysis/SKILL.md +2 -2
  95. package/templates/skills/analysis/opening-analysis/SKILL.md +1 -1
  96. package/templates/skills/analysis/pacing-analysis/SKILL.md +1 -1
  97. package/templates/skills/analysis/power-analysis/SKILL.md +3 -3
  98. package/templates/skills/analysis/reader-analysis/SKILL.md +1 -1
  99. package/templates/skills/analysis/style-analysis/SKILL.md +1 -1
  100. package/templates/skills/analysis/voice-analysis/SKILL.md +1 -1
  101. package/templates/skills/auto-tracking/SKILL.md +1 -1
  102. package/templates/skills/quality-assurance/consistency-checker/SKILL.md +1 -1
  103. package/templates/skills/quality-assurance/facts-checker/SKILL.md +2 -2
  104. package/templates/skills/quality-assurance/hook-checker/SKILL.md +2 -2
  105. package/templates/skills/quality-assurance/long-series-continuity/SKILL.md +7 -7
  106. package/templates/skills/quality-assurance/pre-write-checklist/SKILL.md +22 -22
  107. package/templates/skills/quality-assurance/setting-detector/SKILL.md +15 -15
  108. package/templates/skills/quality-assurance/voice-consistency-checker/SKILL.md +1 -1
  109. package/templates/skills/writing-techniques/character-arc/SKILL.md +1 -1
  110. package/templates/skills/writing-techniques/multi-thread-narrative/SKILL.md +1 -1
  111. package/templates/skills/writing-techniques/reader-expectation/SKILL.md +1 -1
  112. package/templates/skills/writing-techniques/revision-polish/SKILL.md +1 -1
  113. package/templates/skills/writing-techniques/style-learning/SKILL.md +2 -2
  114. package/templates/skills/writing-techniques/writing-balance/.gitkeep +0 -0
  115. package/templates/skills/writing-techniques/writing-balance/SKILL.md +460 -0
  116. package/templates/skills/writing-techniques/writing-techniques/SKILL.md +727 -0
  117. package/templates/knowledge-base/README.md +0 -285
  118. package/templates/scripts/powershell/check-writing-state.ps1.backup +0 -135
  119. /package/templates/{knowledge-base → resources}/character-archetypes/01-hero.md +0 -0
  120. /package/templates/{knowledge-base → resources}/character-archetypes/02-mentor.md +0 -0
  121. /package/templates/{knowledge-base → resources}/character-archetypes/03-shadow.md +0 -0
  122. /package/templates/{knowledge-base → resources}/character-archetypes/04-ally.md +0 -0
  123. /package/templates/{knowledge-base → resources}/character-archetypes/05-shapeshifter.md +0 -0
  124. /package/templates/{knowledge-base → resources}/character-archetypes/06-trickster.md +0 -0
  125. /package/templates/{knowledge-base → resources}/character-archetypes/07-threshold-guardian.md +0 -0
  126. /package/templates/{knowledge-base → resources}/character-archetypes/08-herald.md +0 -0
  127. /package/templates/{knowledge-base → resources}/character-archetypes/09-father.md +0 -0
  128. /package/templates/{knowledge-base → resources}/character-archetypes/10-mother.md +0 -0
  129. /package/templates/{knowledge-base → resources}/character-archetypes/11-child.md +0 -0
  130. /package/templates/{knowledge-base → resources}/character-archetypes/12-sage.md +0 -0
  131. /package/templates/{knowledge-base → resources}/character-archetypes/README.md +0 -0
  132. /package/templates/{knowledge-base → resources}/character-archetypes/application-guide.md +0 -0
  133. /package/templates/{knowledge-base → resources}/character-archetypes/archetype-combinations.md +0 -0
  134. /package/templates/{knowledge-base → resources}/character-archetypes/config.yaml +0 -0
  135. /package/templates/{knowledge-base → resources}/character-archetypes/examples-analysis.md +0 -0
  136. /package/templates/{specification-example.md → resources/config/specification-example.md} +0 -0
  137. /package/templates/{knowledge-base → resources}/craft/character-arc.md +0 -0
  138. /package/templates/{knowledge-base → resources}/craft/dialogue.md +0 -0
  139. /package/templates/{knowledge-base → resources}/craft/hook-design.md +0 -0
  140. /package/templates/{knowledge-base → resources}/craft/pacing.md +0 -0
  141. /package/templates/{knowledge-base → resources}/craft/power-system.md +0 -0
  142. /package/templates/{knowledge-base → resources}/craft/scene-structure.md +0 -0
  143. /package/templates/{knowledge-base → resources}/craft/show-not-tell.md +0 -0
  144. /package/templates/{knowledge-base → resources}/craft/story-structures.md +0 -0
  145. /package/templates/{knowledge-base → resources}/craft/tension-management.md +0 -0
  146. /package/templates/{knowledge-base → resources}/emotional-beats/01-first-meeting.md +0 -0
  147. /package/templates/{knowledge-base → resources}/emotional-beats/02-bonding-moment.md +0 -0
  148. /package/templates/{knowledge-base → resources}/emotional-beats/03-declaration.md +0 -0
  149. /package/templates/{knowledge-base → resources}/emotional-beats/04-triumph.md +0 -0
  150. /package/templates/{knowledge-base → resources}/emotional-beats/05-reunion.md +0 -0
  151. /package/templates/{knowledge-base → resources}/emotional-beats/06-forgiveness.md +0 -0
  152. /package/templates/{knowledge-base → resources}/emotional-beats/07-betrayal.md +0 -0
  153. /package/templates/{knowledge-base → resources}/emotional-beats/08-loss.md +0 -0
  154. /package/templates/{knowledge-base → resources}/emotional-beats/09-rejection.md +0 -0
  155. /package/templates/{knowledge-base → resources}/emotional-beats/10-failure.md +0 -0
  156. /package/templates/{knowledge-base → resources}/emotional-beats/11-misunderstanding.md +0 -0
  157. /package/templates/{knowledge-base → resources}/emotional-beats/12-farewell.md +0 -0
  158. /package/templates/{knowledge-base → resources}/emotional-beats/13-revelation.md +0 -0
  159. /package/templates/{knowledge-base → resources}/emotional-beats/14-point-of-no-return.md +0 -0
  160. /package/templates/{knowledge-base → resources}/emotional-beats/15-dark-night.md +0 -0
  161. /package/templates/{knowledge-base → resources}/emotional-beats/16-sacrifice.md +0 -0
  162. /package/templates/{knowledge-base → resources}/emotional-beats/17-awakening.md +0 -0
  163. /package/templates/{knowledge-base → resources}/emotional-beats/18-confrontation.md +0 -0
  164. /package/templates/{knowledge-base → resources}/emotional-beats/19-bittersweet-goodbye.md +0 -0
  165. /package/templates/{knowledge-base → resources}/emotional-beats/20-moral-dilemma.md +0 -0
  166. /package/templates/{knowledge-base → resources}/emotional-beats/21-temptation.md +0 -0
  167. /package/templates/{knowledge-base → resources}/emotional-beats/22-redemption.md +0 -0
  168. /package/templates/{knowledge-base → resources}/emotional-beats/README.md +0 -0
  169. /package/templates/{knowledge-base → resources}/emotional-beats/beat-sequences.md +0 -0
  170. /package/templates/{knowledge-base → resources}/emotional-beats/config.yaml +0 -0
  171. /package/templates/{knowledge-base → resources}/emotional-beats/pacing-guide.md +0 -0
  172. /package/templates/{knowledge-base → resources}/genres/game-lit.md +0 -0
  173. /package/templates/{knowledge-base → resources}/genres/historical.md +0 -0
  174. /package/templates/{knowledge-base → resources}/genres/mystery.md +0 -0
  175. /package/templates/{knowledge-base → resources}/genres/rebirth.md +0 -0
  176. /package/templates/{knowledge-base → resources}/genres/revenge.md +0 -0
  177. /package/templates/{knowledge-base → resources}/genres/romance.md +0 -0
  178. /package/templates/{knowledge-base → resources}/genres/sci-fi.md +0 -0
  179. /package/templates/{knowledge-base → resources}/genres/thriller.md +0 -0
  180. /package/templates/{knowledge-base → resources}/genres/urban.md +0 -0
  181. /package/templates/{knowledge-base → resources}/genres/wuxia.md +0 -0
  182. /package/templates/{knowledge-base → resources}/genres/xuanhuan.md +0 -0
  183. /package/templates/{memory → resources/memory}/constitution.md +0 -0
  184. /package/templates/{memory → resources/memory}/personal-voice.md +0 -0
  185. /package/templates/{knowledge-base → resources}/references/README.md +0 -0
  186. /package/templates/{knowledge-base → resources}/references/china-1920s/culture.md +0 -0
  187. /package/templates/{knowledge-base → resources}/references/china-1920s/daily-life.md +0 -0
  188. /package/templates/{knowledge-base → resources}/references/china-1920s/overview.md +0 -0
  189. /package/templates/{knowledge-base → resources}/references/china-1920s/society.md +0 -0
  190. /package/templates/{knowledge-base → resources}/references/china-1920s/warlords.md +0 -0
  191. /package/templates/{knowledge-base → resources}/references/cultivation-world/daily-life.md +0 -0
  192. /package/templates/{knowledge-base → resources}/references/cultivation-world/overview.md +0 -0
  193. /package/templates/{knowledge-base → resources}/references/cultivation-world/power-system.md +0 -0
  194. /package/templates/{knowledge-base → resources}/references/cultivation-world/sects.md +0 -0
  195. /package/templates/{knowledge-base → resources}/references/cultivation-world/world-setting.md +0 -0
  196. /package/templates/{knowledge-base → resources}/references/modern-workplace/corporate.md +0 -0
  197. /package/templates/{knowledge-base → resources}/references/modern-workplace/daily-life.md +0 -0
  198. /package/templates/{knowledge-base → resources}/references/modern-workplace/overview.md +0 -0
  199. /package/templates/{knowledge-base → resources}/references/modern-workplace/relationships.md +0 -0
  200. /package/templates/{knowledge-base → resources}/references/modern-workplace/tech-industry.md +0 -0
  201. /package/templates/{knowledge-base → resources}/references/tang-dynasty/culture.md +0 -0
  202. /package/templates/{knowledge-base → resources}/references/tang-dynasty/daily-life.md +0 -0
  203. /package/templates/{knowledge-base → resources}/references/tang-dynasty/overview.md +0 -0
  204. /package/templates/{knowledge-base → resources}/references/tang-dynasty/politics.md +0 -0
  205. /package/templates/{knowledge-base → resources}/references/tang-dynasty/society.md +0 -0
  206. /package/templates/{knowledge-base → resources}/requirements/README.md +0 -0
  207. /package/templates/{knowledge-base → resources}/requirements/anti-ai-v3.md +0 -0
  208. /package/templates/{knowledge-base → resources}/requirements/concretization.md +0 -0
  209. /package/templates/{knowledge-base → resources}/requirements/fast-paced.md +0 -0
  210. /package/templates/{knowledge-base → resources}/requirements/no-poison.md +0 -0
  211. /package/templates/{knowledge-base → resources}/requirements/romance-angst.md +0 -0
  212. /package/templates/{knowledge-base → resources}/requirements/romance-sweet.md +0 -0
  213. /package/templates/{knowledge-base → resources}/requirements/serious-literature.md +0 -0
  214. /package/templates/{knowledge-base → resources}/requirements/strong-emotion.md +0 -0
  215. /package/templates/{scripts → resources/scripts}/bash/clarify-story.sh +0 -0
  216. /package/templates/{scripts → resources/scripts}/bash/generate-tasks.sh +0 -0
  217. /package/templates/{scripts → resources/scripts}/bash/test-word-count.sh +0 -0
  218. /package/templates/{scripts → resources/scripts}/bash/tests/run-all-benchmarks.sh +0 -0
  219. /package/templates/{scripts → resources/scripts}/bash/tests/test-cache-semantics.sh +0 -0
  220. /package/templates/{scripts → resources/scripts}/bash/tests/test-edge-cases-bash.sh +0 -0
  221. /package/templates/{scripts → resources/scripts}/bash/tests/test-phase1-bash.sh +0 -0
  222. /package/templates/{scripts → resources/scripts}/bash/tests/test-regression-bash.sh +0 -0
  223. /package/templates/{scripts → resources/scripts}/bash/tests/test-task6-verification.sh +0 -0
  224. /package/templates/{scripts → resources/scripts}/powershell/check-analyze-stage.ps1 +0 -0
  225. /package/templates/{scripts → resources/scripts}/powershell/check-facts.ps1 +0 -0
  226. /package/templates/{scripts → resources/scripts}/powershell/clarify-story.ps1 +0 -0
  227. /package/templates/{scripts → resources/scripts}/powershell/generate-tasks.ps1 +0 -0
  228. /package/templates/{scripts → resources/scripts}/powershell/tests/test-cross-platform.ps1 +0 -0
  229. /package/templates/{scripts → resources/scripts}/powershell/tests/test-edge-cases-ps.ps1 +0 -0
  230. /package/templates/{scripts → resources/scripts}/powershell/tests/test-phase1-ps.ps1 +0 -0
  231. /package/templates/{scripts → resources/scripts}/powershell/tests/test-regression-ps.ps1 +0 -0
  232. /package/templates/{knowledge-base → resources}/styles/README.md +0 -0
  233. /package/templates/{knowledge-base → resources}/styles/ancient-style.md +0 -0
  234. /package/templates/{knowledge-base → resources}/styles/literary.md +0 -0
  235. /package/templates/{knowledge-base → resources}/styles/minimal.md +0 -0
  236. /package/templates/{knowledge-base → resources}/styles/natural-voice.md +0 -0
  237. /package/templates/{knowledge-base → resources}/styles/web-novel.md +0 -0
@@ -0,0 +1,227 @@
1
+ /**
2
+ * 项目诊断系统
3
+ *
4
+ * 命令失败时自动诊断并给出修复步骤。
5
+ * 5 项检查:项目结构、JSON 格式、项目模式、依赖状态、修复建议。
6
+ */
7
+ import fs from 'fs-extra';
8
+ import path from 'path';
9
+ import { getProjectPaths } from '../core/config.js';
10
+ export class ProjectDiagnostics {
11
+ /**
12
+ * 对错误进行诊断,返回诊断报告
13
+ */
14
+ async diagnoseError(error, context) {
15
+ const checks = await Promise.all([
16
+ this.checkProjectStructure(context.projectRoot),
17
+ this.checkTrackingFiles(context.projectRoot),
18
+ this.checkProjectMode(context.projectRoot),
19
+ this.checkMCPStatus(context.projectRoot),
20
+ this.checkFileIntegrity(context.projectRoot),
21
+ ]);
22
+ const fixes = checks
23
+ .filter(c => !c.passed && c.fix)
24
+ .map(c => c.fix);
25
+ return {
26
+ error: error.message,
27
+ checks,
28
+ fixes,
29
+ summary: this.generateSummary(checks),
30
+ };
31
+ }
32
+ /**
33
+ * 检查 1: 项目结构是否完整
34
+ */
35
+ async checkProjectStructure(projectRoot) {
36
+ const paths = getProjectPaths(projectRoot);
37
+ const requiredDirs = [
38
+ { path: paths.resources, label: 'resources' },
39
+ { path: paths.claude, label: '.claude' },
40
+ { path: paths.commands, label: '.claude/commands' },
41
+ ];
42
+ const missing = [];
43
+ for (const dir of requiredDirs) {
44
+ if (!await fs.pathExists(dir.path)) {
45
+ missing.push(dir.label);
46
+ }
47
+ }
48
+ if (missing.length === 0) {
49
+ return { name: '项目结构', passed: true, message: '项目结构正常' };
50
+ }
51
+ return {
52
+ name: '项目结构',
53
+ passed: false,
54
+ message: `缺少目录: ${missing.join(', ')}`,
55
+ fix: 'novelws init',
56
+ };
57
+ }
58
+ /**
59
+ * 检查 2: tracking 文件是否存在
60
+ */
61
+ async checkTrackingFiles(projectRoot) {
62
+ const trackingDir = getProjectPaths(projectRoot).tracking;
63
+ if (!await fs.pathExists(trackingDir)) {
64
+ return {
65
+ name: 'Tracking 文件',
66
+ passed: false,
67
+ message: 'tracking 目录不存在',
68
+ fix: '/track --sync',
69
+ };
70
+ }
71
+ const expectedFiles = [
72
+ 'character-state.json',
73
+ 'plot-tracker.json',
74
+ 'timeline.json',
75
+ 'relationships.json',
76
+ ];
77
+ const missing = [];
78
+ for (const file of expectedFiles) {
79
+ if (!await fs.pathExists(path.join(trackingDir, file))) {
80
+ missing.push(file);
81
+ }
82
+ }
83
+ if (missing.length === 0) {
84
+ return { name: 'Tracking 文件', passed: true, message: 'tracking 文件存在' };
85
+ }
86
+ return {
87
+ name: 'Tracking 文件',
88
+ passed: false,
89
+ message: `缺少 tracking 文件: ${missing.join(', ')}`,
90
+ fix: '/track --sync',
91
+ };
92
+ }
93
+ /**
94
+ * 检查 3: 项目模式是否匹配
95
+ */
96
+ async checkProjectMode(projectRoot) {
97
+ const mode = await this.detectProjectMode(projectRoot);
98
+ if (mode === 'unknown') {
99
+ return {
100
+ name: '项目模式',
101
+ passed: false,
102
+ message: '无法检测项目模式',
103
+ fix: '/track --sync',
104
+ };
105
+ }
106
+ return {
107
+ name: '项目模式',
108
+ passed: true,
109
+ message: `当前模式: ${mode}`,
110
+ };
111
+ }
112
+ /**
113
+ * 检查 4: MCP 服务器状态
114
+ */
115
+ async checkMCPStatus(projectRoot) {
116
+ const paths = getProjectPaths(projectRoot);
117
+ const dbPath = paths.trackingDb;
118
+ const mcpConfigPath = paths.mcpServers;
119
+ const hasDb = await fs.pathExists(dbPath);
120
+ const hasMcpConfig = await fs.pathExists(mcpConfigPath);
121
+ if (!hasMcpConfig) {
122
+ return {
123
+ name: 'MCP 状态',
124
+ passed: true,
125
+ message: '未配置 MCP(使用 JSON 模式)',
126
+ };
127
+ }
128
+ if (hasMcpConfig && !hasDb) {
129
+ return {
130
+ name: 'MCP 状态',
131
+ passed: false,
132
+ message: 'MCP 已配置但数据库不存在',
133
+ fix: '/track --migrate --target mcp',
134
+ };
135
+ }
136
+ return { name: 'MCP 状态', passed: true, message: 'MCP 服务正常' };
137
+ }
138
+ /**
139
+ * 检查 5: JSON 文件完整性
140
+ */
141
+ async checkFileIntegrity(projectRoot) {
142
+ const trackingDir = getProjectPaths(projectRoot).tracking;
143
+ if (!await fs.pathExists(trackingDir)) {
144
+ return { name: '文件完整性', passed: true, message: '无 tracking 文件需要验证' };
145
+ }
146
+ const jsonFiles = [
147
+ 'character-state.json',
148
+ 'plot-tracker.json',
149
+ 'timeline.json',
150
+ 'relationships.json',
151
+ ];
152
+ const corrupted = [];
153
+ for (const file of jsonFiles) {
154
+ const filePath = path.join(trackingDir, file);
155
+ if (await fs.pathExists(filePath)) {
156
+ try {
157
+ const content = await fs.readFile(filePath, 'utf-8');
158
+ JSON.parse(content);
159
+ }
160
+ catch {
161
+ corrupted.push(file);
162
+ }
163
+ }
164
+ }
165
+ if (corrupted.length === 0) {
166
+ return { name: '文件完整性', passed: true, message: 'JSON 文件格式正确' };
167
+ }
168
+ return {
169
+ name: '文件完整性',
170
+ passed: false,
171
+ message: `JSON 格式损坏: ${corrupted.join(', ')}`,
172
+ fix: '/track --fix',
173
+ };
174
+ }
175
+ /**
176
+ * 检测项目模式
177
+ */
178
+ async detectProjectMode(projectRoot) {
179
+ const paths = getProjectPaths(projectRoot);
180
+ const dbPath = paths.trackingDb;
181
+ if (await fs.pathExists(dbPath)) {
182
+ return 'mcp';
183
+ }
184
+ if (await fs.pathExists(paths.trackingVolumes)) {
185
+ const entries = await fs.readdir(paths.trackingVolumes).catch(() => []);
186
+ if (entries.length > 0) {
187
+ return 'sharded';
188
+ }
189
+ }
190
+ if (await fs.pathExists(paths.tracking)) {
191
+ return 'single-file';
192
+ }
193
+ return 'unknown';
194
+ }
195
+ /**
196
+ * 格式化诊断报告为用户友好的字符串
197
+ */
198
+ formatReport(report) {
199
+ const lines = [
200
+ `❌ 错误: ${report.error}`,
201
+ '',
202
+ '🔍 诊断结果:',
203
+ ];
204
+ for (const check of report.checks) {
205
+ const icon = check.passed ? '✅' : '❌';
206
+ lines.push(` ${icon} ${check.name}: ${check.message}`);
207
+ }
208
+ if (report.fixes.length > 0) {
209
+ lines.push('');
210
+ lines.push('💡 修复步骤:');
211
+ report.fixes.forEach((fix, i) => {
212
+ lines.push(` ${i + 1}. 运行: ${fix}`);
213
+ });
214
+ }
215
+ return lines.join('\n');
216
+ }
217
+ generateSummary(checks) {
218
+ const passed = checks.filter(c => c.passed).length;
219
+ const total = checks.length;
220
+ if (passed === total) {
221
+ return '所有检查通过,问题可能来自其他原因';
222
+ }
223
+ const failed = checks.filter(c => !c.passed).map(c => c.name);
224
+ return `${passed}/${total} 项检查通过,问题: ${failed.join(', ')}`;
225
+ }
226
+ }
227
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/utils/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA4BpD,MAAM,OAAO,kBAAkB;IAC7B;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,KAAY,EAAE,OAAuB;QACvD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GA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AAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACvB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;gBAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAEO,eAAe,CAAC,MAAqB;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;QAE5B,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,OAAO,mBAAmB,CAAC;QAC7B,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9D,OAAO,GAAG,MAAM,IAAI,KAAK,cAAc,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7D,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "novelws",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "description": "Claude Code 专用的 AI 小说创作工具 - 深度集成 Slash Commands 和 Agent Skills",
6
6
  "keywords": [
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  description: 智能分析:自动选择框架分析(write前)或内容分析(write后),支持 --type 手动指定
3
3
  argument-hint: [--type=framework|content] [--range ch-XXX-YYY | --volume vol-XX | --volume-report vol-XX]
4
+ recommended-model: claude-sonnet-4-5-20250929 # 分析任务,质量与速度平衡;深度分析可用 opus
4
5
  allowed-tools: Bash(find:*), Bash(wc:*), Bash(grep:*), Read(//**), Read(//plugins/**), Read(//plugins/**), Write(//stories/**/analysis-report.md), Bash(*)
5
6
  scripts:
6
- sh: .specify/scripts/bash/check-analyze-stage.sh --json
7
- ps: .specify/scripts/powershell/check-analyze-stage.ps1 -Json
7
+ sh: resources/scripts/bash/check-analyze-stage.sh --json
8
+ ps: resources/scripts/powershell/check-analyze-stage.ps1 -Json
8
9
  ---
9
10
 
10
11
  对小说项目进行智能化综合分析。根据当前创作阶段,自动选择执行**框架一致性分析**(write 之前)或**内容质量分析**(write 之后)。
@@ -15,105 +16,38 @@ scripts:
15
16
 
16
17
  ### 1. 智能阶段检测
17
18
 
18
- 运行 `{SCRIPT}` 获取当前创作状态:
19
-
20
- ```json
21
- {
22
- "analyze_type": "framework|content",
23
- "chapter_count": 0,
24
- "has_spec": true,
25
- "has_plan": true,
26
- "has_tasks": true,
27
- "story_dir": "/path/to/story",
28
- "reason": "原因说明"
29
- }
30
- ```
19
+ 运行 `{SCRIPT}` 获取当前创作状态(返回 `analyze_type`, `chapter_count`, `has_spec/plan/tasks`, `story_dir`, `reason`)。
31
20
 
32
21
  ### 2. 决策逻辑
33
22
 
34
- 解析用户参数 `$ARGUMENTS`:
35
-
36
- **手动指定模式**(优先级最高):
37
- - 包含 `--type=framework` → 强制框架分析
38
- - 包含 `--type=content` → 强制内容分析
39
-
40
- **批量范围分析**:
41
- - `--range ch-XX-YY` → 指定章节范围分析
42
- - `--range vol-XX` → 指定卷分析
43
- - `--range vol-XX-YY` → 多卷范围分析(含跨卷对比)
44
- - `--volume vol-XX` → 等同于 `--range vol-XX`
45
- - `--volume-report vol-XX` → 生成指定卷的综合分析报告(见下方详细说明)
46
-
47
- **专项分析模式**:
48
- - `--focus=opening` → 开篇专项分析(前3章)
49
- - `--focus=pacing` → 节奏专项分析(爽点/冲突分布)
50
- - `--focus=character` → 人物专项分析(人物弧光)
51
- - `--focus=foreshadow` → 伏笔专项分析(埋设与回收)
52
- - `--focus=logic` → 逻辑专项分析(逻辑漏洞)
53
- - `--focus=style` → 风格专项分析(文笔一致性)
54
- - `--focus=reader` → 读者体验分析(爽点密度、钩子强度、信息投喂、期待管理)
55
- - `--focus=hook` → 钩子专项分析(每章结尾钩子类型、强度、兑现率)
56
- - `--focus=power` → 力量体系专项分析(力量等级一致性、战力对比合理性、升级节奏)
57
- - `--focus=voice` → 对话一致性分析(检测各角色对话是否符合语言指纹设定)
58
-
59
- **自动判断模式**:
60
- - 章节数 < 3 → **框架分析**
61
- - 章节数 ≥ 3 → **内容分析**
62
-
63
- ### 4. 数据加载策略(三层 Fallback)
23
+ 解析用户参数 `$ARGUMENTS`,按优先级:
64
24
 
65
- 当执行 `--range` 或 `--volume` 分析时,按以下优先级加载数据:
25
+ 1. **手动指定**:`--type=framework` 或 `--type=content`
26
+ 2. **范围分析**:`--range ch-XX-YY` / `--range vol-XX[-YY]` / `--volume vol-XX` / `--volume-report vol-XX`
27
+ 3. **专项分析 `--focus=`**:`opening`(前3章) | `pacing`(爽点/冲突) | `character`(人物弧光) | `foreshadow`(伏笔) | `logic`(逻辑漏洞) | `style`(文笔一致性) | `reader`(读者体验) | `hook`(钩子强度) | `power`(力量体系) | `voice`(对话一致性)
28
+ 4. **自动判断**:章节数 < 3 → 框架分析,≥ 3 → 内容分析
66
29
 
67
- **Layer 1: MCP 查询(优先)**
68
- - 调用 `query_characters --volume=vol-XX` 获取该卷角色数据
69
- - 调用 `query_plot --volume=vol-XX` 获取该卷情节数据
70
- - 调用 `query_timeline --chapter_from=X --chapter_to=Y` 获取时间线
71
- - 调用 `stats_volume --volume=vol-XX` 获取卷统计数据
30
+ ### 4. 数据加载策略(三层 Fallback)
72
31
 
73
- **Layer 2: 分片 JSON(次优)**
74
- - 检测 `spec/tracking/volumes/vol-XX/` 是否存在
75
- - 读取该卷的 4 个分片文件
76
- - 读取 `spec/tracking/summary/volume-summaries.json` 获取卷元信息
32
+ `--range` / `--volume` 分析时,按优先级加载:
77
33
 
78
- **Layer 3: 单文件 JSON(兜底)**
79
- - 读取 `spec/tracking/` 下的单文件
80
- - 根据章节范围手动过滤数据
34
+ 1. **Layer 1: MCP 查询**:`query_characters`、`query_plot`、`query_timeline`、`stats_volume`(均传 `--volume=vol-XX`)
35
+ 2. **Layer 2: 分片 JSON**:`tracking/volumes/vol-XX/` 4 个分片 + `summary/volume-summaries.json`
36
+ 3. **Layer 3: 单文件 JSON**:`tracking/` 下单文件,按章节范围手动过滤
81
37
 
82
38
  ### 5. --volume-report 综合报告
83
39
 
84
- 当使用 `--volume-report vol-XX` 时,生成该卷的完整分析报告,包含:
40
+ `--volume-report vol-XX` 生成该卷完整分析报告,包含:卷概览、情节分析、角色发展、节奏评估、一致性检查、跨卷对比、改进建议(P0/P1/P2)。
85
41
 
86
- **报告结构:**
87
- 1. **卷概览**:章节范围、总字数、关键事件、主要角色
88
- 2. **情节分析**:该卷的情节线推进、伏笔埋设与回收、高潮设计
89
- 3. **角色发展**:该卷中角色的成长弧线、关系变化
90
- 4. **节奏评估**:爽点分布、钩子强度、情绪曲线
91
- 5. **一致性检查**:逻辑漏洞、时间线问题、角色行为一致性
92
- 6. **跨卷对比**:与前卷的衔接、与后卷的铺垫
93
- 7. **改进建议**:分级建议(P0/P1/P2)
94
-
95
- **数据来源:**
96
- - 优先使用 MCP `stats_volume` 获取预计算的统计数据
97
- - 读取该卷的章节文件(`stories/[current]/content/chapter-XXX.md`)
98
- - 读取该卷的 tracking 数据(分片或单文件)
42
+ 数据来源:MCP `stats_volume` → 章节文件(`stories/[current]/content/chapter-XXX.md`)→ tracking 数据(分片或单文件)。
99
43
 
100
44
  ### 6. 资源加载
101
45
 
102
- **参考 CLAUDE.md 中的资源加载规则**,加载以下基准文档:
103
- - 宪法文件:`.specify/memory/constitution.md`
104
- - 规格文件:`stories/*/specification.md`
105
- - 计划文件:`stories/*/creative-plan.md`
106
- - 任务文件:`stories/*/tasks.md`
107
-
108
- **分析专用资源**(Layer 1 默认加载):
109
- - `templates/knowledge-base/craft/` 下所有 craft 知识库(用于质量对照检查)
110
- - `templates/skills/quality-assurance/` 下的 QA skills(用于一致性验证)
111
-
112
- **Layer 2: 配置覆盖**:如果 `specification.md` 配置了 `resource-loading.analysis`,按配置加载。
46
+ **基准文档**(参考 CLAUDE.md 资源加载规则):`resources/memory/constitution.md`、`stories/*/specification.md`、`stories/*/creative-plan.md`、`stories/*/tasks.md`
113
47
 
114
- **Layer 3: 关键词触发**:读取 `specification.md` 的 `resource-loading.keyword-triggers.enabled`,扫描 `--check` 参数值动态加载 skills
48
+ **分析专用**:`resources/craft/` 全部 + `templates/skills/quality-assurance/` QA skills
115
49
 
116
- **会话级资源复用**:本次对话中已加载的资源直接复用,不重复读取。
50
+ **覆盖与触发**:`specification.md` 的 `resource-loading.analysis` 配置覆盖默认加载;`keyword-triggers.enabled` 扫描 `--check` 参数动态加载 skills。会话级资源复用,不重复读取。
117
51
 
118
52
  ---
119
53
 
@@ -143,27 +77,10 @@ scripts:
143
77
 
144
78
  ### A4. 准备就绪评估
145
79
 
146
- ```markdown
147
- ## 准备就绪评估
148
-
149
- ### 必要条件 (P0)
150
- - [ ] 规格完整且明确
151
- - [ ] 计划覆盖所有 P0 需求
152
- - [ ] 任务分解完整
153
- - [ ] 无致命逻辑矛盾
154
-
155
- ### 建议条件 (P1)
156
- - [ ] 角色档案完善
157
- - [ ] 世界观设定文档详细
158
- - [ ] 时间线规划清晰
159
-
160
- ### 总体评分:[X]/10
161
-
162
- **建议**:
163
- 1. 🔴 必须修复:[P0问题]
164
- 2. 🟡 建议优化:[P1问题]
165
- 3. 🟢 可选:[P2问题]
166
- ```
80
+ 输出总体评分 [X]/10,包含:
81
+ - **P0 必要条件**:规格完整、计划覆盖 P0 需求、任务分解完整、无致命逻辑矛盾
82
+ - **P1 建议条件**:角色档案完善、世界观设定详细、时间线规划清晰
83
+ - **建议**:🔴 必须修复(P0) / 🟡 建议优化(P1) / 🟢 可选(P2)
167
84
 
168
85
  ---
169
86
 
@@ -285,15 +202,15 @@ scripts:
285
202
  应用后追加更新记录到 `tracking-log.md`。
286
203
 
287
204
  **分片模式写入协议**:
288
- - 如果检测到 `spec/tracking/volumes/` 存在,确定章节所属卷
289
- - 更新该卷的分片文件(如 `spec/tracking/volumes/vol-03/character-state.json`)
290
- - 同步更新全局摘要文件(如 `spec/tracking/summary/characters-summary.json`)
205
+ - 如果检测到 `tracking/volumes/` 存在,确定章节所属卷
206
+ - 更新该卷的分片文件(如 `tracking/volumes/vol-03/character-state.json`)
207
+ - 同步更新全局摘要文件(如 `tracking/summary/characters-summary.json`)
291
208
  - 如果 MCP 可用,调用 `sync_from_json` 同步到 SQLite
292
209
 
293
210
  **错误处理**:
294
211
  - tracking 文件不存在 → 建议运行 `/track --init`
295
212
  - JSON 格式错误 → 提示手动修复
296
- - tracking 目录不存在 → 建议创建 `spec/tracking/`
213
+ - tracking 目录不存在 → 建议创建 `tracking/`
297
214
 
298
215
  ---
299
216