novelws 1.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 (320) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/LICENSE +22 -0
  3. package/README.md +372 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +50 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/check.d.ts +6 -0
  9. package/dist/commands/check.d.ts.map +1 -0
  10. package/dist/commands/check.js +32 -0
  11. package/dist/commands/check.js.map +1 -0
  12. package/dist/commands/init.d.ts +6 -0
  13. package/dist/commands/init.d.ts.map +1 -0
  14. package/dist/commands/init.js +160 -0
  15. package/dist/commands/init.js.map +1 -0
  16. package/dist/commands/plugin.d.ts +6 -0
  17. package/dist/commands/plugin.d.ts.map +1 -0
  18. package/dist/commands/plugin.js +135 -0
  19. package/dist/commands/plugin.js.map +1 -0
  20. package/dist/commands/upgrade.d.ts +6 -0
  21. package/dist/commands/upgrade.d.ts.map +1 -0
  22. package/dist/commands/upgrade.js +92 -0
  23. package/dist/commands/upgrade.js.map +1 -0
  24. package/dist/core/config.d.ts +72 -0
  25. package/dist/core/config.d.ts.map +1 -0
  26. package/dist/core/config.js +136 -0
  27. package/dist/core/config.js.map +1 -0
  28. package/dist/core/errors.d.ts +59 -0
  29. package/dist/core/errors.d.ts.map +1 -0
  30. package/dist/core/errors.js +125 -0
  31. package/dist/core/errors.js.map +1 -0
  32. package/dist/core/platform.d.ts +27 -0
  33. package/dist/core/platform.d.ts.map +1 -0
  34. package/dist/core/platform.js +75 -0
  35. package/dist/core/platform.js.map +1 -0
  36. package/dist/core/template.d.ts +35 -0
  37. package/dist/core/template.d.ts.map +1 -0
  38. package/dist/core/template.js +94 -0
  39. package/dist/core/template.js.map +1 -0
  40. package/dist/plugins/identifier.d.ts +13 -0
  41. package/dist/plugins/identifier.d.ts.map +1 -0
  42. package/dist/plugins/identifier.js +72 -0
  43. package/dist/plugins/identifier.js.map +1 -0
  44. package/dist/plugins/installers/base.d.ts +27 -0
  45. package/dist/plugins/installers/base.d.ts.map +1 -0
  46. package/dist/plugins/installers/base.js +30 -0
  47. package/dist/plugins/installers/base.js.map +1 -0
  48. package/dist/plugins/installers/github.d.ts +22 -0
  49. package/dist/plugins/installers/github.d.ts.map +1 -0
  50. package/dist/plugins/installers/github.js +133 -0
  51. package/dist/plugins/installers/github.js.map +1 -0
  52. package/dist/plugins/installers/local.d.ts +16 -0
  53. package/dist/plugins/installers/local.d.ts.map +1 -0
  54. package/dist/plugins/installers/local.js +69 -0
  55. package/dist/plugins/installers/local.js.map +1 -0
  56. package/dist/plugins/installers/npm.d.ts +20 -0
  57. package/dist/plugins/installers/npm.d.ts.map +1 -0
  58. package/dist/plugins/installers/npm.js +99 -0
  59. package/dist/plugins/installers/npm.js.map +1 -0
  60. package/dist/plugins/manager.d.ts +77 -0
  61. package/dist/plugins/manager.d.ts.map +1 -0
  62. package/dist/plugins/manager.js +349 -0
  63. package/dist/plugins/manager.js.map +1 -0
  64. package/dist/plugins/registry.d.ts +48 -0
  65. package/dist/plugins/registry.d.ts.map +1 -0
  66. package/dist/plugins/registry.js +111 -0
  67. package/dist/plugins/registry.js.map +1 -0
  68. package/dist/plugins/types.d.ts +66 -0
  69. package/dist/plugins/types.d.ts.map +1 -0
  70. package/dist/plugins/types.js +2 -0
  71. package/dist/plugins/types.js.map +1 -0
  72. package/dist/plugins/validator.d.ts +19 -0
  73. package/dist/plugins/validator.d.ts.map +1 -0
  74. package/dist/plugins/validator.js +164 -0
  75. package/dist/plugins/validator.js.map +1 -0
  76. package/dist/utils/logger.d.ts +13 -0
  77. package/dist/utils/logger.d.ts.map +1 -0
  78. package/dist/utils/logger.js +48 -0
  79. package/dist/utils/logger.js.map +1 -0
  80. package/dist/utils/project.d.ts +24 -0
  81. package/dist/utils/project.d.ts.map +1 -0
  82. package/dist/utils/project.js +61 -0
  83. package/dist/utils/project.js.map +1 -0
  84. package/dist/version.d.ts +3 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +21 -0
  87. package/dist/version.js.map +1 -0
  88. package/package.json +76 -0
  89. package/plugins/authentic-voice/README.md +31 -0
  90. package/plugins/authentic-voice/commands/authentic-voice.md +73 -0
  91. package/plugins/authentic-voice/commands/authenticity-audit.md +37 -0
  92. package/plugins/authentic-voice/config.yaml +30 -0
  93. package/plugins/authentic-voice/experts/authentic-editor.md +27 -0
  94. package/plugins/export/README.md +319 -0
  95. package/plugins/export/commands/export.md +460 -0
  96. package/plugins/export/commands/generate-cover.md +256 -0
  97. package/plugins/export/commands/metadata.md +309 -0
  98. package/plugins/export/config.yaml +47 -0
  99. package/plugins/export/experts/publishing-expert.md +171 -0
  100. package/plugins/export/templates/epub/chapter-template.html +13 -0
  101. package/plugins/export/templates/epub/cover-template.html +14 -0
  102. package/plugins/export/templates/epub/stylesheet.css +200 -0
  103. package/plugins/export/templates/pdf/ebook-style.css +137 -0
  104. package/plugins/export/templates/pdf/print-style.css +179 -0
  105. package/plugins/export/templates/platforms/jinjiang-format.md +101 -0
  106. package/plugins/export/templates/platforms/qidian-format.md +108 -0
  107. package/plugins/export/templates/platforms/tomato-format.md +95 -0
  108. package/plugins/translate/README.md +265 -0
  109. package/plugins/translate/commands/glossary.md +731 -0
  110. package/plugins/translate/commands/translate-preview.md +543 -0
  111. package/plugins/translate/commands/translate.md +649 -0
  112. package/plugins/translate/config.yaml +43 -0
  113. package/plugins/translate/experts/literary-translator.md +605 -0
  114. package/templates/commands/analyze.md +1485 -0
  115. package/templates/commands/checklist.md +434 -0
  116. package/templates/commands/clarify.md +257 -0
  117. package/templates/commands/constitution.md +257 -0
  118. package/templates/commands/expert.md +136 -0
  119. package/templates/commands/plan.md +749 -0
  120. package/templates/commands/recap.md +613 -0
  121. package/templates/commands/relations.md +96 -0
  122. package/templates/commands/revise.md +341 -0
  123. package/templates/commands/specify.md +682 -0
  124. package/templates/commands/tasks.md +142 -0
  125. package/templates/commands/timeline.md +73 -0
  126. package/templates/commands/track-init.md +137 -0
  127. package/templates/commands/track.md +463 -0
  128. package/templates/commands/write.md +1264 -0
  129. package/templates/config/keyword-mappings.json +106 -0
  130. package/templates/knowledge/audit-config.json +26 -0
  131. package/templates/knowledge/character-profiles.md +152 -0
  132. package/templates/knowledge/character-voices.md +137 -0
  133. package/templates/knowledge/locations.md +184 -0
  134. package/templates/knowledge/world-setting.md +121 -0
  135. package/templates/knowledge-base/README.md +285 -0
  136. package/templates/knowledge-base/character-archetypes/01-hero.md +233 -0
  137. package/templates/knowledge-base/character-archetypes/02-mentor.md +177 -0
  138. package/templates/knowledge-base/character-archetypes/03-shadow.md +221 -0
  139. package/templates/knowledge-base/character-archetypes/04-ally.md +178 -0
  140. package/templates/knowledge-base/character-archetypes/05-shapeshifter.md +177 -0
  141. package/templates/knowledge-base/character-archetypes/06-trickster.md +181 -0
  142. package/templates/knowledge-base/character-archetypes/07-threshold-guardian.md +177 -0
  143. package/templates/knowledge-base/character-archetypes/08-herald.md +180 -0
  144. package/templates/knowledge-base/character-archetypes/09-father.md +249 -0
  145. package/templates/knowledge-base/character-archetypes/10-mother.md +202 -0
  146. package/templates/knowledge-base/character-archetypes/11-child.md +183 -0
  147. package/templates/knowledge-base/character-archetypes/12-sage.md +202 -0
  148. package/templates/knowledge-base/character-archetypes/README.md +60 -0
  149. package/templates/knowledge-base/character-archetypes/application-guide.md +222 -0
  150. package/templates/knowledge-base/character-archetypes/archetype-combinations.md +242 -0
  151. package/templates/knowledge-base/character-archetypes/config.yaml +28 -0
  152. package/templates/knowledge-base/character-archetypes/examples-analysis.md +223 -0
  153. package/templates/knowledge-base/craft/character-arc.md +1153 -0
  154. package/templates/knowledge-base/craft/dialogue.md +1170 -0
  155. package/templates/knowledge-base/craft/pacing.md +1200 -0
  156. package/templates/knowledge-base/craft/scene-structure.md +1136 -0
  157. package/templates/knowledge-base/craft/show-not-tell.md +1012 -0
  158. package/templates/knowledge-base/emotional-beats/01-first-meeting.md +145 -0
  159. package/templates/knowledge-base/emotional-beats/02-bonding-moment.md +226 -0
  160. package/templates/knowledge-base/emotional-beats/03-declaration.md +284 -0
  161. package/templates/knowledge-base/emotional-beats/04-triumph.md +240 -0
  162. package/templates/knowledge-base/emotional-beats/05-reunion.md +396 -0
  163. package/templates/knowledge-base/emotional-beats/06-forgiveness.md +204 -0
  164. package/templates/knowledge-base/emotional-beats/07-betrayal.md +204 -0
  165. package/templates/knowledge-base/emotional-beats/08-loss.md +214 -0
  166. package/templates/knowledge-base/emotional-beats/09-rejection.md +254 -0
  167. package/templates/knowledge-base/emotional-beats/10-failure.md +244 -0
  168. package/templates/knowledge-base/emotional-beats/11-misunderstanding.md +205 -0
  169. package/templates/knowledge-base/emotional-beats/12-farewell.md +283 -0
  170. package/templates/knowledge-base/emotional-beats/13-revelation.md +242 -0
  171. package/templates/knowledge-base/emotional-beats/14-point-of-no-return.md +215 -0
  172. package/templates/knowledge-base/emotional-beats/15-dark-night.md +244 -0
  173. package/templates/knowledge-base/emotional-beats/16-sacrifice.md +246 -0
  174. package/templates/knowledge-base/emotional-beats/17-awakening.md +246 -0
  175. package/templates/knowledge-base/emotional-beats/18-confrontation.md +217 -0
  176. package/templates/knowledge-base/emotional-beats/19-bittersweet-goodbye.md +368 -0
  177. package/templates/knowledge-base/emotional-beats/20-moral-dilemma.md +248 -0
  178. package/templates/knowledge-base/emotional-beats/21-temptation.md +240 -0
  179. package/templates/knowledge-base/emotional-beats/22-redemption.md +210 -0
  180. package/templates/knowledge-base/emotional-beats/README.md +104 -0
  181. package/templates/knowledge-base/emotional-beats/beat-sequences.md +276 -0
  182. package/templates/knowledge-base/emotional-beats/config.yaml +30 -0
  183. package/templates/knowledge-base/emotional-beats/pacing-guide.md +390 -0
  184. package/templates/knowledge-base/genres/historical.md +1127 -0
  185. package/templates/knowledge-base/genres/mystery.md +1123 -0
  186. package/templates/knowledge-base/genres/revenge.md +846 -0
  187. package/templates/knowledge-base/genres/romance.md +948 -0
  188. package/templates/knowledge-base/genres/sci-fi.md +156 -0
  189. package/templates/knowledge-base/genres/thriller.md +166 -0
  190. package/templates/knowledge-base/genres/wuxia.md +143 -0
  191. package/templates/knowledge-base/references/README.md +96 -0
  192. package/templates/knowledge-base/references/china-1920s/culture.md +423 -0
  193. package/templates/knowledge-base/references/china-1920s/daily-life.md +616 -0
  194. package/templates/knowledge-base/references/china-1920s/overview.md +298 -0
  195. package/templates/knowledge-base/references/china-1920s/society.md +703 -0
  196. package/templates/knowledge-base/references/china-1920s/warlords.md +427 -0
  197. package/templates/knowledge-base/references/cultivation-world/daily-life.md +108 -0
  198. package/templates/knowledge-base/references/cultivation-world/overview.md +64 -0
  199. package/templates/knowledge-base/references/cultivation-world/power-system.md +108 -0
  200. package/templates/knowledge-base/references/cultivation-world/sects.md +104 -0
  201. package/templates/knowledge-base/references/cultivation-world/world-setting.md +108 -0
  202. package/templates/knowledge-base/references/modern-workplace/corporate.md +115 -0
  203. package/templates/knowledge-base/references/modern-workplace/daily-life.md +129 -0
  204. package/templates/knowledge-base/references/modern-workplace/overview.md +73 -0
  205. package/templates/knowledge-base/references/modern-workplace/relationships.md +107 -0
  206. package/templates/knowledge-base/references/modern-workplace/tech-industry.md +131 -0
  207. package/templates/knowledge-base/references/tang-dynasty/culture.md +135 -0
  208. package/templates/knowledge-base/references/tang-dynasty/daily-life.md +139 -0
  209. package/templates/knowledge-base/references/tang-dynasty/overview.md +76 -0
  210. package/templates/knowledge-base/references/tang-dynasty/politics.md +121 -0
  211. package/templates/knowledge-base/references/tang-dynasty/society.md +126 -0
  212. package/templates/knowledge-base/requirements/README.md +240 -0
  213. package/templates/knowledge-base/requirements/anti-ai-v3.md +46 -0
  214. package/templates/knowledge-base/requirements/anti-ai-v4.md +430 -0
  215. package/templates/knowledge-base/requirements/fast-paced.md +552 -0
  216. package/templates/knowledge-base/requirements/no-poison.md +60 -0
  217. package/templates/knowledge-base/requirements/romance-angst.md +102 -0
  218. package/templates/knowledge-base/requirements/romance-sweet.md +63 -0
  219. package/templates/knowledge-base/requirements/serious-literature.md +45 -0
  220. package/templates/knowledge-base/requirements/strong-emotion.md +60 -0
  221. package/templates/knowledge-base/styles/README.md +302 -0
  222. package/templates/knowledge-base/styles/ancient-style.md +579 -0
  223. package/templates/knowledge-base/styles/literary.md +439 -0
  224. package/templates/knowledge-base/styles/minimal.md +472 -0
  225. package/templates/knowledge-base/styles/natural-voice.md +930 -0
  226. package/templates/knowledge-base/styles/web-novel.md +525 -0
  227. package/templates/memory/constitution.md +140 -0
  228. package/templates/memory/personal-voice.md +113 -0
  229. package/templates/scripts/README.md +187 -0
  230. package/templates/scripts/bash/analyze-story.sh +170 -0
  231. package/templates/scripts/bash/check-consistency.sh +463 -0
  232. package/templates/scripts/bash/check-plot.sh +374 -0
  233. package/templates/scripts/bash/check-timeline.sh +346 -0
  234. package/templates/scripts/bash/check-world.sh +395 -0
  235. package/templates/scripts/bash/check-writing-state.sh +854 -0
  236. package/templates/scripts/bash/clarify-story.sh +117 -0
  237. package/templates/scripts/bash/common.sh +151 -0
  238. package/templates/scripts/bash/constitution.sh +114 -0
  239. package/templates/scripts/bash/generate-tasks.sh +65 -0
  240. package/templates/scripts/bash/init-tracking.sh +183 -0
  241. package/templates/scripts/bash/manage-relations.sh +174 -0
  242. package/templates/scripts/bash/plan-story.sh +100 -0
  243. package/templates/scripts/bash/specify-story.sh +93 -0
  244. package/templates/scripts/bash/tasks-story.sh +96 -0
  245. package/templates/scripts/bash/test-word-count.sh +182 -0
  246. package/templates/scripts/bash/tests/bench-preload-cache.sh +100 -0
  247. package/templates/scripts/bash/tests/run-all-benchmarks.sh +16 -0
  248. package/templates/scripts/bash/tests/test-cache-semantics.sh +199 -0
  249. package/templates/scripts/bash/tests/test-cross-platform.sh +35 -0
  250. package/templates/scripts/bash/tests/test-edge-cases-bash.sh +60 -0
  251. package/templates/scripts/bash/tests/test-phase1-bash.sh +28 -0
  252. package/templates/scripts/bash/tests/test-preload-cache.sh +123 -0
  253. package/templates/scripts/bash/tests/test-regex-precompile.sh +89 -0
  254. package/templates/scripts/bash/tests/test-regression-bash.sh +42 -0
  255. package/templates/scripts/bash/tests/test-task6-verification.sh +200 -0
  256. package/templates/scripts/bash/text-audit.sh +144 -0
  257. package/templates/scripts/bash/track-progress.sh +194 -0
  258. package/templates/scripts/powershell/analyze-story.ps1 +171 -0
  259. package/templates/scripts/powershell/check-analyze-stage.ps1 +110 -0
  260. package/templates/scripts/powershell/check-consistency.ps1 +138 -0
  261. package/templates/scripts/powershell/check-plot.ps1 +139 -0
  262. package/templates/scripts/powershell/check-timeline.ps1 +112 -0
  263. package/templates/scripts/powershell/check-writing-state.ps1 +490 -0
  264. package/templates/scripts/powershell/check-writing-state.ps1.backup +135 -0
  265. package/templates/scripts/powershell/clarify-story.ps1 +107 -0
  266. package/templates/scripts/powershell/common.ps1 +36 -0
  267. package/templates/scripts/powershell/constitution.ps1 +142 -0
  268. package/templates/scripts/powershell/generate-tasks.ps1 +75 -0
  269. package/templates/scripts/powershell/init-tracking.ps1 +98 -0
  270. package/templates/scripts/powershell/manage-relations.ps1 +134 -0
  271. package/templates/scripts/powershell/plan-story.ps1 +96 -0
  272. package/templates/scripts/powershell/specify-story.ps1 +82 -0
  273. package/templates/scripts/powershell/tests/bench-ps-cache.ps1 +80 -0
  274. package/templates/scripts/powershell/tests/test-cross-platform.ps1 +27 -0
  275. package/templates/scripts/powershell/tests/test-edge-cases-ps.ps1 +29 -0
  276. package/templates/scripts/powershell/tests/test-phase1-ps.ps1 +28 -0
  277. package/templates/scripts/powershell/tests/test-ps-cache.ps1 +73 -0
  278. package/templates/scripts/powershell/tests/test-regression-ps.ps1 +40 -0
  279. package/templates/scripts/powershell/text-audit.ps1 +100 -0
  280. package/templates/scripts/powershell/track-progress.ps1 +105 -0
  281. package/templates/skills/genre-knowledge/fantasy/SKILL.md +355 -0
  282. package/templates/skills/genre-knowledge/mystery/SKILL.md +337 -0
  283. package/templates/skills/genre-knowledge/romance/SKILL.md +228 -0
  284. package/templates/skills/genre-knowledge/sci-fi/SKILL.md +65 -0
  285. package/templates/skills/genre-knowledge/thriller/SKILL.md +95 -0
  286. package/templates/skills/quality-assurance/consistency-checker/SKILL.md +341 -0
  287. package/templates/skills/quality-assurance/continuity-tracker/SKILL.md +157 -0
  288. package/templates/skills/quality-assurance/forgotten-elements/SKILL.md +147 -0
  289. package/templates/skills/quality-assurance/getting-started/SKILL.md +224 -0
  290. package/templates/skills/quality-assurance/pacing-monitor/SKILL.md +143 -0
  291. package/templates/skills/quality-assurance/pov-validator/SKILL.md +135 -0
  292. package/templates/skills/quality-assurance/pre-write-checklist/SKILL.md +583 -0
  293. package/templates/skills/quality-assurance/requirement-detector/CONFLICT_RESOLUTION.md +119 -0
  294. package/templates/skills/quality-assurance/requirement-detector/EXAMPLES.md +146 -0
  295. package/templates/skills/quality-assurance/requirement-detector/KEYWORDS.md +160 -0
  296. package/templates/skills/quality-assurance/requirement-detector/SKILL.md +149 -0
  297. package/templates/skills/quality-assurance/setting-detector/SKILL.md +611 -0
  298. package/templates/skills/quality-assurance/style-detector/CONFLICT_RESOLUTION.md +126 -0
  299. package/templates/skills/quality-assurance/style-detector/EXAMPLES.md +206 -0
  300. package/templates/skills/quality-assurance/style-detector/KEYWORDS.md +207 -0
  301. package/templates/skills/quality-assurance/style-detector/SKILL.md +126 -0
  302. package/templates/skills/quality-assurance/workflow-guide/SKILL.md +381 -0
  303. package/templates/skills/writing-techniques/character-arc/SKILL.md +267 -0
  304. package/templates/skills/writing-techniques/dialogue-techniques/SKILL.md +366 -0
  305. package/templates/skills/writing-techniques/multi-thread-narrative/SKILL.md +553 -0
  306. package/templates/skills/writing-techniques/multi-thread-narrative/experts/thread-analyst.md +226 -0
  307. package/templates/skills/writing-techniques/pacing-control/SKILL.md +377 -0
  308. package/templates/skills/writing-techniques/reader-expectation/SKILL.md +578 -0
  309. package/templates/skills/writing-techniques/reader-expectation/experts/expectation-analyst.md +209 -0
  310. package/templates/skills/writing-techniques/revision-polish/SKILL.md +496 -0
  311. package/templates/skills/writing-techniques/revision-polish/experts/revision-editor.md +221 -0
  312. package/templates/skills/writing-techniques/scene-structure/SKILL.md +361 -0
  313. package/templates/skills/writing-techniques/style-learning/SKILL.md +436 -0
  314. package/templates/specification-example.md +146 -0
  315. package/templates/tracking/character-state.json +78 -0
  316. package/templates/tracking/plot-tracker.json +62 -0
  317. package/templates/tracking/relationships.json +70 -0
  318. package/templates/tracking/timeline.json +49 -0
  319. package/templates/tracking/tracking-log.md +110 -0
  320. package/templates/tracking/validation-rules.json +128 -0
@@ -0,0 +1,107 @@
1
+ param(
2
+ [switch]$Json,
3
+ [switch]$PathsOnly
4
+ )
5
+
6
+ # 澄清故事大纲的支撑脚本
7
+ # 用于 /clarify 命令,扫描并返回当前故事路径
8
+
9
+ Set-StrictMode -Version Latest
10
+ $ErrorActionPreference = "Stop"
11
+
12
+ # Get script directory
13
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
14
+
15
+ # Source common functions
16
+ . "$ScriptDir\common.ps1"
17
+
18
+ # Get project root
19
+ $ProjectRoot = Get-ProjectRoot
20
+ Set-Location $ProjectRoot
21
+
22
+ # Find the current story directory
23
+ $StoriesDir = "stories"
24
+ if (-not (Test-Path $StoriesDir -PathType Container)) {
25
+ if ($Json) {
26
+ Write-Output '{"error": "No stories directory found"}'
27
+ } else {
28
+ Write-Error "错误:未找到 stories 目录,请先运行 /story 创建故事大纲"
29
+ }
30
+ exit 1
31
+ }
32
+
33
+ # Get the latest story
34
+ $StoryDirs = Get-ChildItem -Path $StoriesDir -Directory | Sort-Object Name -Descending
35
+ if ($StoryDirs.Count -eq 0) {
36
+ if ($Json) {
37
+ Write-Output '{"error": "No story found"}'
38
+ } else {
39
+ Write-Error "错误:未找到故事,请先运行 /story 创建故事大纲"
40
+ }
41
+ exit 1
42
+ }
43
+
44
+ $StoryDir = $StoryDirs[0]
45
+ $StoryName = $StoryDir.Name
46
+
47
+ # Find story file (新格式 specification.md)
48
+ $StoryFile = Join-Path $StoryDir.FullName "specification.md"
49
+
50
+ if (-not (Test-Path $StoryFile -PathType Leaf)) {
51
+ if ($Json) {
52
+ Write-Output '{"error": "Story file not found (specification.md required)"}'
53
+ } else {
54
+ Write-Error "错误:未找到故事文件 specification.md"
55
+ }
56
+ exit 1
57
+ }
58
+
59
+ # Check if clarification already exists
60
+ $ClarificationExists = $false
61
+ $StoryContent = Get-Content $StoryFile -Raw
62
+ if ($StoryContent -match "## 澄清记录") {
63
+ $ClarificationExists = $true
64
+ }
65
+
66
+ # Count existing clarification sessions
67
+ $ClarificationCount = 0
68
+ if ($ClarificationExists) {
69
+ $matches = [regex]::Matches($StoryContent, "### 澄清会话")
70
+ $ClarificationCount = $matches.Count
71
+ }
72
+
73
+ # Convert paths to forward slashes for JSON
74
+ $StoryFilePath = $StoryFile.Replace('\', '/')
75
+ $StoryDirPath = $StoryDir.FullName.Replace('\', '/')
76
+ $ProjectRootPath = $ProjectRoot.Replace('\', '/')
77
+
78
+ # Output in JSON format if requested
79
+ if ($Json) {
80
+ if ($PathsOnly) {
81
+ # Minimal output for command template
82
+ $output = @{
83
+ STORY_PATH = $StoryFilePath
84
+ STORY_NAME = $StoryName
85
+ STORY_DIR = $StoryDirPath
86
+ }
87
+ } else {
88
+ # Full output for analysis
89
+ $output = @{
90
+ STORY_PATH = $StoryFilePath
91
+ STORY_NAME = $StoryName
92
+ STORY_DIR = $StoryDirPath
93
+ CLARIFICATION_EXISTS = $ClarificationExists
94
+ CLARIFICATION_COUNT = $ClarificationCount
95
+ PROJECT_ROOT = $ProjectRootPath
96
+ }
97
+ }
98
+ Write-Output (ConvertTo-Json $output -Compress)
99
+ } else {
100
+ Write-Output "找到故事:$StoryName"
101
+ Write-Output "文件路径:$StoryFile"
102
+ if ($ClarificationExists) {
103
+ Write-Output "已有澄清会话:$ClarificationCount 次"
104
+ } else {
105
+ Write-Output "尚未进行过澄清"
106
+ }
107
+ }
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env pwsh
2
+ # 公用函数(PowerShell)
3
+
4
+ Set-StrictMode -Version Latest
5
+ $ErrorActionPreference = 'Stop'
6
+
7
+ function Get-ProjectRoot {
8
+ $current = (Get-Location).Path
9
+ while ($true) {
10
+ $cfg = Join-Path $current ".specify/config.json"
11
+ if (Test-Path $cfg) { return $current }
12
+ $parent = Split-Path $current -Parent
13
+ if (-not $parent -or $parent -eq $current) { break }
14
+ $current = $parent
15
+ }
16
+ throw "未找到项目根目录(缺少 .specify/config.json)"
17
+ }
18
+
19
+ function Get-CurrentStoryDir {
20
+ $root = Get-ProjectRoot
21
+ $stories = Join-Path $root "stories"
22
+ if (-not (Test-Path $stories)) { return $null }
23
+ $dirs = Get-ChildItem -Path $stories -Directory | Sort-Object LastWriteTime -Descending
24
+ if ($dirs.Count -gt 0) { return $dirs[0].FullName }
25
+ return $null
26
+ }
27
+
28
+ function Get-ActiveStory {
29
+ $storyDir = Get-CurrentStoryDir
30
+ if ($storyDir) {
31
+ return Split-Path $storyDir -Leaf
32
+ }
33
+ # 如果没有故事,返回默认名称
34
+ return "story-$(Get-Date -Format 'yyyyMMdd')"
35
+ }
36
+
@@ -0,0 +1,142 @@
1
+ # 小说创作宪法管理脚本
2
+ # 用于 /constitution 命令
3
+
4
+ param(
5
+ [string]$Command = "check"
6
+ )
7
+
8
+ # 导入通用函数
9
+ . "$PSScriptRoot\common.ps1"
10
+
11
+ # 获取项目根目录
12
+ $ProjectRoot = Get-ProjectRoot
13
+ Set-Location $ProjectRoot
14
+
15
+ # 定义文件路径
16
+ $ConstitutionFile = ".specify\memory\constitution.md"
17
+
18
+ switch ($Command) {
19
+ "check" {
20
+ # 检查宪法文件是否存在
21
+ if (Test-Path $ConstitutionFile) {
22
+ Write-Host "✅ 宪法文件已存在:$ConstitutionFile" -ForegroundColor Green
23
+
24
+ # 提取版本信息
25
+ $content = Get-Content $ConstitutionFile -Raw
26
+ if ($content -match "- 版本:(.+)") {
27
+ $version = $matches[1].Trim()
28
+ } else {
29
+ $version = "未知"
30
+ }
31
+
32
+ if ($content -match "- 最后修订:(.+)") {
33
+ $updated = $matches[1].Trim()
34
+ } else {
35
+ $updated = "未知"
36
+ }
37
+
38
+ Write-Host " 版本:$version"
39
+ Write-Host " 最后修订:$updated"
40
+ exit 0
41
+ }
42
+ else {
43
+ Write-Host "❌ 尚未创建宪法文件" -ForegroundColor Red
44
+ Write-Host " 建议:运行 /constitution 创建创作宪法"
45
+ exit 1
46
+ }
47
+ }
48
+
49
+ "init" {
50
+ # 初始化宪法文件
51
+ $dir = Split-Path $ConstitutionFile -Parent
52
+ if (-not (Test-Path $dir)) {
53
+ New-Item -ItemType Directory -Path $dir -Force | Out-Null
54
+ }
55
+
56
+ if (Test-Path $ConstitutionFile) {
57
+ Write-Host "宪法文件已存在,准备更新"
58
+ }
59
+ else {
60
+ Write-Host "准备创建新的宪法文件"
61
+ }
62
+ }
63
+
64
+ "validate" {
65
+ # 验证宪法文件格式
66
+ if (-not (Test-Path $ConstitutionFile)) {
67
+ Write-Host "错误:宪法文件不存在" -ForegroundColor Red
68
+ exit 1
69
+ }
70
+
71
+ Write-Host "验证宪法文件..."
72
+
73
+ # 检查必要章节
74
+ $requiredSections = @("核心价值观", "质量标准", "创作风格", "内容规范", "读者契约")
75
+ $content = Get-Content $ConstitutionFile -Raw
76
+ $missingSections = @()
77
+
78
+ foreach ($section in $requiredSections) {
79
+ if ($content -notmatch "## .* $section") {
80
+ $missingSections += $section
81
+ }
82
+ }
83
+
84
+ if ($missingSections.Count -gt 0) {
85
+ Write-Host "⚠️ 缺少以下章节:" -ForegroundColor Yellow
86
+ foreach ($section in $missingSections) {
87
+ Write-Host " - $section"
88
+ }
89
+ }
90
+ else {
91
+ Write-Host "✅ 所有必要章节都存在" -ForegroundColor Green
92
+ }
93
+
94
+ # 检查版本信息
95
+ if ($content -match "^- 版本:") {
96
+ Write-Host "✅ 版本信息完整" -ForegroundColor Green
97
+ }
98
+ else {
99
+ Write-Host "⚠️ 缺少版本信息" -ForegroundColor Yellow
100
+ }
101
+ }
102
+
103
+ "export" {
104
+ # 导出宪法摘要
105
+ if (-not (Test-Path $ConstitutionFile)) {
106
+ Write-Host "错误:宪法文件不存在" -ForegroundColor Red
107
+ exit 1
108
+ }
109
+
110
+ Write-Host "# 创作宪法摘要"
111
+ Write-Host ""
112
+
113
+ $content = Get-Content $ConstitutionFile -Raw
114
+
115
+ # 提取核心原则
116
+ Write-Host "## 核心原则"
117
+ if ($content -match "### 原则[\s\S]*?\*\*声明\*\*:(.+)") {
118
+ Write-Host $matches[1]
119
+ }
120
+ else {
121
+ Write-Host "(未找到原则声明)"
122
+ }
123
+
124
+ Write-Host ""
125
+ Write-Host "## 质量底线"
126
+ if ($content -match "### 标准[\s\S]*?\*\*要求\*\*:(.+)") {
127
+ Write-Host $matches[1]
128
+ }
129
+ else {
130
+ Write-Host "(未找到质量标准)"
131
+ }
132
+
133
+ Write-Host ""
134
+ Write-Host "详细内容请查看:$ConstitutionFile"
135
+ }
136
+
137
+ default {
138
+ Write-Host "未知命令:$Command" -ForegroundColor Red
139
+ Write-Host "支持的命令:check, init, validate, export"
140
+ exit 1
141
+ }
142
+ }
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env pwsh
2
+ # 生成写作任务
3
+
4
+ $STORIES_DIR = "stories"
5
+
6
+ # 查找最新的故事目录
7
+ function Get-LatestStory {
8
+ $latest = Get-ChildItem -Path $STORIES_DIR -Directory |
9
+ Sort-Object Name -Descending |
10
+ Select-Object -First 1
11
+
12
+ if ($latest) {
13
+ return $latest.FullName
14
+ }
15
+ return $null
16
+ }
17
+
18
+ $storyDir = Get-LatestStory
19
+
20
+ if (!$storyDir) {
21
+ Write-Host "错误:没有找到故事项目"
22
+ Write-Host "请先使用 /story 命令创建故事"
23
+ exit 1
24
+ }
25
+
26
+ $outlineFile = "$storyDir/outline.md"
27
+ $tasksFile = "$storyDir/tasks.md"
28
+ $progressFile = "$storyDir/progress.json"
29
+
30
+ if (!(Test-Path $outlineFile)) {
31
+ Write-Host "错误:没有找到章节规划"
32
+ Write-Host "请先使用 /outline 命令创建章节规划"
33
+ exit 1
34
+ }
35
+
36
+ # 获取当前日期
37
+ $currentDate = Get-Date -Format "yyyy-MM-dd"
38
+ $currentDateTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
39
+
40
+ # 创建任务文件,预先填充基础信息
41
+ $tasksContent = @"
42
+ # 写作任务清单
43
+
44
+ ## 任务概览
45
+ - **创建日期**:$currentDate
46
+ - **最后更新**:$currentDate
47
+ - **任务状态**:待生成
48
+
49
+ ---
50
+ "@
51
+ $tasksContent | Out-File -FilePath $tasksFile -Encoding UTF8
52
+
53
+ # 创建或更新进度文件
54
+ if (!(Test-Path $progressFile)) {
55
+ $progressContent = @{
56
+ created_at = $currentDateTime
57
+ updated_at = $currentDateTime
58
+ total_chapters = 0
59
+ completed = 0
60
+ in_progress = 0
61
+ word_count = 0
62
+ } | ConvertTo-Json
63
+ $progressContent | Out-File -FilePath $progressFile -Encoding UTF8
64
+ }
65
+
66
+ Write-Host "故事目录: $storyDir"
67
+ Write-Host "规划文件: $outlineFile"
68
+ Write-Host "任务文件: $tasksFile"
69
+ Write-Host "当前日期: $currentDate"
70
+ Write-Host ""
71
+ Write-Host "基于章节规划生成任务:"
72
+ Write-Host "- 章节写作任务"
73
+ Write-Host "- 角色完善任务"
74
+ Write-Host "- 世界观补充"
75
+ Write-Host "- 修订任务"
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env pwsh
2
+ # 初始化追踪系统(PowerShell)
3
+
4
+ Set-StrictMode -Version Latest
5
+ $ErrorActionPreference = 'Stop'
6
+
7
+ . "$PSScriptRoot/common.ps1"
8
+
9
+ Write-Host "🚀 初始化追踪系统..."
10
+
11
+ $root = Get-ProjectRoot
12
+ $storyDir = Get-CurrentStoryDir
13
+ if (-not $storyDir) { throw "请先完成 /story 和 /outline,未找到 stories/*/ 目录" }
14
+
15
+ $storyName = Split-Path $storyDir -Leaf
16
+ $specTrack = Join-Path $root "spec/tracking"
17
+ New-Item -ItemType Directory -Path $specTrack -Force | Out-Null
18
+
19
+ Write-Host "📖 为《$storyName》初始化追踪系统..."
20
+
21
+ $utc = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
22
+
23
+ # plot-tracker.json
24
+ $plotPath = Join-Path $specTrack "plot-tracker.json"
25
+ if (-not (Test-Path $plotPath)) {
26
+ Write-Host "📝 创建 plot-tracker.json..."
27
+ $plot = @{
28
+ novel = $storyName
29
+ lastUpdated = $utc
30
+ currentState = @{ chapter = 0; volume = 1; mainPlotStage = '准备阶段'; location = '待定'; timepoint = '故事开始前' }
31
+ plotlines = @{ main = @{ name='主线剧情'; description='待从大纲提取'; status='待开始'; currentNode='起点'; completedNodes=@(); upcomingNodes=@(); plannedClimax=@{ chapter=$null; description='待规划' } }; subplots=@() }
32
+ foreshadowing = @()
33
+ conflicts = @{ active=@(); resolved=@(); upcoming=@() }
34
+ checkpoints = @{ volumeEnd=@(); majorEvents=@() }
35
+ notes = @{ plotHoles=@(); inconsistencies=@(); reminders=@('请根据实际故事内容更新追踪数据') }
36
+ } | ConvertTo-Json -Depth 12
37
+ Set-Content -LiteralPath $plotPath -Value $plot -Encoding UTF8
38
+ }
39
+
40
+ # timeline.json
41
+ $timelinePath = Join-Path $specTrack "timeline.json"
42
+ if (-not (Test-Path $timelinePath)) {
43
+ Write-Host "⏰ 创建 timeline.json..."
44
+ $timeline = @{
45
+ novel = $storyName
46
+ lastUpdated = $utc
47
+ storyTimeUnit = '天'
48
+ realWorldReference = $null
49
+ timeline = @(@{ chapter=0; storyTime='第0天'; description='故事开始前'; events=@('待添加'); location='待定' })
50
+ parallelEvents = @()
51
+ timeSpan = @{ start='第0天'; current='第0天'; elapsed='0天' }
52
+ } | ConvertTo-Json -Depth 12
53
+ Set-Content -LiteralPath $timelinePath -Value $timeline -Encoding UTF8
54
+ }
55
+
56
+ # relationships.json
57
+ $relationsPath = Join-Path $specTrack "relationships.json"
58
+ if (-not (Test-Path $relationsPath)) {
59
+ Write-Host "👥 创建 relationships.json..."
60
+ $relations = @{
61
+ novel = $storyName
62
+ lastUpdated = $utc
63
+ characters = @{ '主角' = @{ name='待设定'; relationships=@{ allies=@(); enemies=@(); romantic=@(); neutral=@() } } }
64
+ factions = @{}
65
+ relationshipChanges = @()
66
+ currentTensions = @()
67
+ } | ConvertTo-Json -Depth 12
68
+ Set-Content -LiteralPath $relationsPath -Value $relations -Encoding UTF8
69
+ }
70
+
71
+ # character-state.json
72
+ $charStatePath = Join-Path $specTrack "character-state.json"
73
+ if (-not (Test-Path $charStatePath)) {
74
+ Write-Host "📍 创建 character-state.json..."
75
+ $cs = @{
76
+ novel = $storyName
77
+ lastUpdated = $utc
78
+ characters = @{ '主角' = @{ name='待设定'; status='健康'; location='待定'; possessions=@(); skills=@(); lastSeen=@{ chapter=0; description='尚未出场' }; development=@{ physical=0; mental=0; emotional=0; power=0 } } }
79
+ groupPositions = @{}
80
+ importantItems = @{}
81
+ } | ConvertTo-Json -Depth 12
82
+ Set-Content -LiteralPath $charStatePath -Value $cs -Encoding UTF8
83
+ }
84
+
85
+ Write-Host ""
86
+ Write-Host "✅ 追踪系统初始化完成!"
87
+ Write-Host ""
88
+ Write-Host "📊 已创建以下追踪文件:"
89
+ Write-Host " • spec/tracking/plot-tracker.json - 情节追踪"
90
+ Write-Host " • spec/tracking/timeline.json - 时间线管理"
91
+ Write-Host " • spec/tracking/relationships.json - 关系网络"
92
+ Write-Host " • spec/tracking/character-state.json - 角色状态"
93
+ Write-Host ""
94
+ Write-Host "💡 下一步:"
95
+ Write-Host " 1. 使用 /write 开始创作(会自动更新追踪数据)"
96
+ Write-Host " 2. 定期使用 /track 查看综合报告"
97
+ Write-Host " 3. 使用 /plot-check 等命令进行一致性检查"
98
+
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env pwsh
2
+ # 角色关系管理(PowerShell)
3
+
4
+ param(
5
+ [ValidateSet('show','update','history','check')]
6
+ [string]$Command = 'show',
7
+ [string]$A,
8
+ [ValidateSet('allies','enemies','romantic','neutral','family','mentors')]
9
+ [string]$Relation,
10
+ [string]$B,
11
+ [int]$Chapter,
12
+ [string]$Note
13
+ )
14
+
15
+ Set-StrictMode -Version Latest
16
+ $ErrorActionPreference = 'Stop'
17
+
18
+ . "$PSScriptRoot/common.ps1"
19
+
20
+ $root = Get-ProjectRoot
21
+ $storyDir = Get-CurrentStoryDir
22
+ $relPath = $null
23
+ if ($storyDir -and (Test-Path (Join-Path $storyDir 'spec/tracking/relationships.json'))) {
24
+ $relPath = Join-Path $storyDir 'spec/tracking/relationships.json'
25
+ } elseif (Test-Path (Join-Path $root 'spec/tracking/relationships.json')) {
26
+ $relPath = Join-Path $root 'spec/tracking/relationships.json'
27
+ } else {
28
+ $tpl1 = Join-Path $root '.specify/templates/tracking/relationships.json'
29
+ $tpl2 = Join-Path $root 'templates/tracking/relationships.json'
30
+ $dest = Join-Path $root 'spec/tracking/relationships.json'
31
+ New-Item -ItemType Directory -Path (Split-Path $dest -Parent) -Force | Out-Null
32
+ if (Test-Path $tpl1) { Copy-Item $tpl1 $dest -Force; $relPath = $dest }
33
+ elseif (Test-Path $tpl2) { Copy-Item $tpl2 $dest -Force; $relPath = $dest }
34
+ else { throw '未找到 relationships.json,且无法从模板创建' }
35
+ }
36
+
37
+ function Show-Header { Write-Host "👥 角色关系管理"; Write-Host "━━━━━━━━━━━━━━━━━━━━" }
38
+
39
+ function Show-Relations {
40
+ Show-Header
41
+ try { $j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json } catch { throw 'relationships.json 格式无效' }
42
+ Write-Host "文件:$relPath"; Write-Host ''
43
+ $main = $j.characters.PSObject.Properties.Name | Select-Object -First 1
44
+ if (-not $main) { Write-Host '无角色记录'; return }
45
+ Write-Host "主角:$main"
46
+ $c = $j.characters.$main
47
+ $r = if ($c.relationships) { $c.relationships } else { $c }
48
+ $map = @{
49
+ romantic = '💕 爱慕'; allies='🤝 盟友'; mentors='📚 导师'; enemies='⚔️ 敌对'; family='👪 家人'; neutral='・ 关系'
50
+ }
51
+ foreach ($k in 'romantic','allies','mentors','enemies','family','neutral') {
52
+ $lst = @($r.$k)
53
+ if ($lst.Count -gt 0) { Write-Host ("├─ {0}:{1}" -f $map[$k], ($lst -join '、')) }
54
+ }
55
+ Write-Host ''
56
+ if ($j.history) {
57
+ Write-Host '最近变化:'
58
+ $last = $j.history[-1]
59
+ if ($last) { $last.changes | ForEach-Object { Write-Host ("- " + ($_.characters -join '↔') + ":" + ($_.relation ?? $_.type)) } }
60
+ } elseif ($j.relationshipChanges) {
61
+ Write-Host '最近变化:'
62
+ $j.relationshipChanges | Select-Object -Last 5 | ForEach-Object { Write-Host ("- " + ($_.type ?? '变化') + ": " + ($_.characters -join '↔')) }
63
+ }
64
+ }
65
+
66
+ function Ensure-Character($json, [string]$name) {
67
+ if (-not $json.characters.$name) {
68
+ $json.characters | Add-Member -NotePropertyName $name -NotePropertyValue (@{ name=$name; relationships=@{ allies=@(); enemies=@(); romantic=@(); family=@(); mentors=@(); neutral=@() } })
69
+ }
70
+ }
71
+
72
+ function Update-Relation([string]$a, [string]$rel, [string]$b) {
73
+ if (-not $a -or -not $rel -or -not $b) { throw '用法: manage-relations.ps1 update -A 人物A -Relation allies|enemies|romantic|neutral|family|mentors -B 人物B [-Chapter N] [-Note 说明]' }
74
+ $j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json
75
+ Ensure-Character $j $a
76
+ Ensure-Character $j $b
77
+ $lst = @($j.characters.$a.relationships.$rel)
78
+ if ($lst -notcontains $b) { $lst += $b }
79
+ $j.characters.$a.relationships.$rel = $lst
80
+ $j.lastUpdated = (Get-Date).ToString('yyyy-MM-ddTHH:mm:ss')
81
+ if ($j.history) {
82
+ $chg = [pscustomobject]@{ type='update'; characters=@($a,$b); relation=$rel; note=($Note ?? '') }
83
+ $rec = [pscustomobject]@{ chapter=($Chapter ? $Chapter : $null); date=(Get-Date).ToString('s'); changes=@($chg) }
84
+ $j.history += $rec
85
+ } elseif ($j.relationshipChanges) {
86
+ $j.relationshipChanges += [pscustomobject]@{ type='update'; characters=@($a,$b); relation=$rel }
87
+ } else {
88
+ $j | Add-Member -NotePropertyName history -NotePropertyValue @()
89
+ }
90
+ $j | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $relPath -Encoding UTF8
91
+ Write-Host "✅ 已更新关系:$a [$rel] $b"
92
+ }
93
+
94
+ function Show-History {
95
+ Show-Header
96
+ $j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json
97
+ if ($j.history) {
98
+ foreach ($h in $j.history) {
99
+ $chap = if ($h.chapter) { $h.chapter } else { 0 }
100
+ $desc = ($h.changes | ForEach-Object { ($_.characters -join '↔') + '→' + ($_.relation ?? $_.type) }) -join ';'
101
+ Write-Host ("第{0}章:{1}" -f $chap, $desc)
102
+ }
103
+ } elseif ($j.relationshipChanges) {
104
+ foreach ($h in $j.relationshipChanges) { Write-Host ((($h.date ?? '') + ' ' + ($h.type ?? '') + ': ' + ($h.characters -join '↔') + '→' + ($h.relation ?? ''))) }
105
+ } else { Write-Host '暂无历史记录' }
106
+ }
107
+
108
+ function Check-Relations {
109
+ Show-Header
110
+ $j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json
111
+ $names = @($j.characters.PSObject.Properties.Name)
112
+ $refs = @()
113
+ foreach ($name in $names) {
114
+ $rel = $j.characters.$name.relationships
115
+ if (-not $rel) { continue }
116
+ foreach ($k in 'allies','enemies','romantic','family','mentors','neutral') {
117
+ $refs += @($rel.$k)
118
+ }
119
+ }
120
+ $refs = $refs | Where-Object { $_ } | Select-Object -Unique
121
+ $missing = @($refs | Where-Object { $names -notcontains $_ })
122
+ if ($missing.Count -gt 0) {
123
+ Write-Host "⚠ 发现未建档角色引用,建议补充:"
124
+ $missing | ForEach-Object { Write-Host " - $_" }
125
+ } else { Write-Host "✅ 关系数据检查通过" }
126
+ }
127
+
128
+ switch ($Command) {
129
+ 'show' { Show-Relations }
130
+ 'update' { Update-Relation -a $A -rel $Relation -b $B }
131
+ 'history'{ Show-History }
132
+ 'check' { Check-Relations }
133
+ }
134
+
@@ -0,0 +1,96 @@
1
+ # 创作计划脚本
2
+ # 用于 /plan 命令
3
+
4
+ param(
5
+ [string]$StoryName
6
+ )
7
+
8
+ # 导入通用函数
9
+ . "$PSScriptRoot\common.ps1"
10
+
11
+ # 获取项目根目录
12
+ $ProjectRoot = Get-ProjectRoot
13
+ Set-Location $ProjectRoot
14
+
15
+ # 确定故事名称
16
+ if ([string]::IsNullOrEmpty($StoryName)) {
17
+ $StoryName = Get-ActiveStory
18
+ }
19
+
20
+ $StoryDir = "stories\$StoryName"
21
+ $SpecFile = "$StoryDir\specification.md"
22
+ $ClarifyFile = "$StoryDir\clarification.md"
23
+ $PlanFile = "$StoryDir\creative-plan.md"
24
+
25
+ Write-Host "创作计划制定"
26
+ Write-Host "============"
27
+ Write-Host "故事:$StoryName"
28
+ Write-Host ""
29
+
30
+ # 检查前置文档
31
+ $missing = @()
32
+
33
+ if (-not (Test-Path ".specify\memory\constitution.md")) {
34
+ $missing += "宪法文件"
35
+ }
36
+
37
+ if (-not (Test-Path $SpecFile)) {
38
+ $missing += "规格文件"
39
+ }
40
+
41
+ if ($missing.Count -gt 0) {
42
+ Write-Host "⚠️ 缺少以下前置文档:" -ForegroundColor Yellow
43
+ foreach ($doc in $missing) {
44
+ Write-Host " - $doc"
45
+ }
46
+ Write-Host ""
47
+ Write-Host "请先完成:"
48
+ if (-not (Test-Path ".specify\memory\constitution.md")) {
49
+ Write-Host " 1. /constitution - 创建创作宪法"
50
+ }
51
+ if (-not (Test-Path $SpecFile)) {
52
+ Write-Host " 2. /specify - 定义故事规格"
53
+ }
54
+ exit 1
55
+ }
56
+
57
+ # 检查是否有未澄清的点
58
+ if (Test-Path $SpecFile) {
59
+ $content = Get-Content $SpecFile -Raw
60
+ $unclearCount = ([regex]::Matches($content, '\[需要澄清\]')).Count
61
+
62
+ if ($unclearCount -gt 0) {
63
+ Write-Host "⚠️ 规格中有 $unclearCount 处需要澄清" -ForegroundColor Yellow
64
+ Write-Host "建议先运行 /clarify 澄清关键决策"
65
+ Write-Host ""
66
+ }
67
+ }
68
+
69
+ # 检查澄清记录
70
+ if (Test-Path $ClarifyFile) {
71
+ Write-Host "✅ 已完成澄清,将基于澄清决策制定计划" -ForegroundColor Green
72
+ }
73
+ else {
74
+ Write-Host "📝 未找到澄清记录,将基于原始规格制定计划"
75
+ }
76
+
77
+ # 检查计划文件
78
+ if (Test-Path $PlanFile) {
79
+ Write-Host ""
80
+ Write-Host "📋 计划文件已存在,将更新现有计划"
81
+
82
+ # 显示当前版本
83
+ $planContent = Get-Content $PlanFile -Raw
84
+ if ($planContent -match "版本:(.+)") {
85
+ Write-Host " 当前版本:$($matches[1])"
86
+ }
87
+ }
88
+ else {
89
+ Write-Host ""
90
+ Write-Host "📝 将创建新的创作计划"
91
+ }
92
+
93
+ Write-Host ""
94
+ Write-Host "计划文件路径:$PlanFile"
95
+ Write-Host ""
96
+ Write-Host "准备就绪,可以制定创作计划"