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,82 @@
1
+ # 故事规格定义脚本
2
+ # 用于 /specify 命令
3
+
4
+ param(
5
+ [switch]$Json,
6
+ [string]$StoryName
7
+ )
8
+
9
+ # 导入通用函数
10
+ . "$PSScriptRoot\common.ps1"
11
+
12
+ # 获取项目根目录
13
+ $ProjectRoot = Get-ProjectRoot
14
+ Set-Location $ProjectRoot
15
+
16
+ # 确定故事名称和路径
17
+ if ([string]::IsNullOrEmpty($StoryName)) {
18
+ # 查找最新的故事
19
+ $StoriesDir = "stories"
20
+ if (Test-Path $StoriesDir) {
21
+ $latestStory = Get-ChildItem $StoriesDir -Directory |
22
+ Sort-Object LastWriteTime -Descending |
23
+ Select-Object -First 1
24
+
25
+ if ($latestStory) {
26
+ $StoryName = $latestStory.Name
27
+ }
28
+ }
29
+
30
+ # 如果还是没有,生成默认名称
31
+ if ([string]::IsNullOrEmpty($StoryName)) {
32
+ $StoryName = "story-$(Get-Date -Format 'yyyyMMdd')"
33
+ }
34
+ }
35
+
36
+ # 设置路径
37
+ $StoryDir = "stories\$StoryName"
38
+ $SpecFile = "$StoryDir\specification.md"
39
+
40
+ # 创建目录
41
+ if (-not (Test-Path $StoryDir)) {
42
+ New-Item -ItemType Directory -Path $StoryDir -Force | Out-Null
43
+ }
44
+
45
+ # 检查文件状态
46
+ $SpecExists = $false
47
+ $Status = "new"
48
+
49
+ if (Test-Path $SpecFile) {
50
+ $SpecExists = $true
51
+ $Status = "exists"
52
+ }
53
+
54
+ # 输出 JSON 格式
55
+ if ($Json) {
56
+ @{
57
+ STORY_NAME = $StoryName
58
+ STORY_DIR = $StoryDir
59
+ SPEC_PATH = $SpecFile
60
+ STATUS = $Status
61
+ PROJECT_ROOT = $ProjectRoot
62
+ } | ConvertTo-Json
63
+ }
64
+ else {
65
+ Write-Host "故事规格初始化"
66
+ Write-Host "================"
67
+ Write-Host "故事名称:$StoryName"
68
+ Write-Host "规格路径:$SpecFile"
69
+
70
+ if ($SpecExists) {
71
+ Write-Host "状态:规格文件已存在,准备更新"
72
+ }
73
+ else {
74
+ Write-Host "状态:准备创建新规格"
75
+ }
76
+
77
+ # 检查宪法
78
+ if (Test-Path ".specify\memory\constitution.md") {
79
+ Write-Host ""
80
+ Write-Host "✅ 检测到创作宪法,规格将遵循宪法原则" -ForegroundColor Green
81
+ }
82
+ }
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env pwsh
2
+
3
+ Write-Host "=== PowerShell 缓存性能测试 ===" -ForegroundColor Cyan
4
+ Write-Host ""
5
+
6
+ # 测试 1: 基准测试(1 个文件 × 100 次)
7
+ Write-Host "测试 1: 基准测试(1 个文件 × 100 次)" -ForegroundColor Yellow
8
+ Write-Host "----------------------------------------" -ForegroundColor Gray
9
+
10
+ Write-Host "无缓存版本:"
11
+ $sw1 = [Diagnostics.Stopwatch]::StartNew()
12
+ for ($i = 1; $i -le 100; $i++) {
13
+ $null = Test-Path "templates/config/keyword-mappings.json" -PathType Leaf
14
+ $null = Get-Item "templates/config/keyword-mappings.json" -ErrorAction SilentlyContinue
15
+ }
16
+ $sw1.Stop()
17
+ Write-Host " 总时间: $($sw1.ElapsedMilliseconds) ms"
18
+
19
+ . .\templates\scripts\powershell\check-writing-state.ps1
20
+ Write-Host "有缓存版本:"
21
+ $sw2 = [Diagnostics.Stopwatch]::StartNew()
22
+ Preload-FileMTimes -FilePathList @("templates/config/keyword-mappings.json")
23
+ for ($i = 1; $i -le 100; $i++) {
24
+ $null = Test-FileExistsCached "templates/config/keyword-mappings.json"
25
+ }
26
+ $sw2.Stop()
27
+ Write-Host " 总时间: $($sw2.ElapsedMilliseconds) ms"
28
+ Write-Host " 性能提升: $([Math]::Round($sw1.ElapsedMilliseconds / $sw2.ElapsedMilliseconds, 2))x" -ForegroundColor Green
29
+
30
+ Write-Host ""
31
+
32
+ # 测试 2: 真实场景(11 个文件 × 3 次检查)
33
+ Write-Host "测试 2: 真实场景(11 个文件 × 3 次检查)" -ForegroundColor Yellow
34
+ Write-Host "----------------------------------------" -ForegroundColor Gray
35
+
36
+ # 构造文件列表(与实际脚本一致)
37
+ $ProjectRoot = Get-Location
38
+ $testFileList = @(
39
+ "templates/knowledge-base/craft/dialogue.md"
40
+ "templates/knowledge-base/craft/scene-structure.md"
41
+ "templates/knowledge-base/craft/character-arc.md"
42
+ "templates/knowledge-base/craft/pacing.md"
43
+ "templates/knowledge-base/craft/show-not-tell.md"
44
+ "templates/skills/writing-techniques/dialogue-techniques/SKILL.md"
45
+ "templates/skills/writing-techniques/scene-structure/SKILL.md"
46
+ "templates/skills/writing-techniques/character-arc/SKILL.md"
47
+ "templates/skills/writing-techniques/pacing-control/SKILL.md"
48
+ "templates/skills/quality-assurance/consistency-checker/SKILL.md"
49
+ "templates/config/keyword-mappings.json" # 替代 specification.md(测试文件)
50
+ )
51
+
52
+ # 无缓存版本
53
+ Write-Host "无缓存版本(11 个文件 × 3 次):"
54
+ $sw3 = [Diagnostics.Stopwatch]::StartNew()
55
+ for ($i = 1; $i -le 3; $i++) {
56
+ foreach ($file in $testFileList) {
57
+ $null = Test-Path $file -PathType Leaf
58
+ $null = Get-Item $file -ErrorAction SilentlyContinue
59
+ }
60
+ }
61
+ $sw3.Stop()
62
+ Write-Host " 总时间: $($sw3.ElapsedMilliseconds) ms"
63
+
64
+ # 有缓存版本
65
+ Write-Host "有缓存版本(1 次预加载 + 3 次查询):"
66
+ $sw4 = [Diagnostics.Stopwatch]::StartNew()
67
+ Preload-FileMTimes -FilePathList $testFileList
68
+ for ($i = 1; $i -le 3; $i++) {
69
+ foreach ($file in $testFileList) {
70
+ $null = Test-FileExistsCached $file
71
+ }
72
+ }
73
+ $sw4.Stop()
74
+ Write-Host " 总时间: $($sw4.ElapsedMilliseconds) ms"
75
+ Write-Host " 预加载耗时: ~$([Math]::Round($sw4.ElapsedMilliseconds * 0.8, 1)) ms (估算)"
76
+ Write-Host " 查询耗时: ~$([Math]::Round($sw4.ElapsedMilliseconds * 0.2, 1)) ms (估算)"
77
+ Write-Host " 性能提升: $([Math]::Round($sw3.ElapsedMilliseconds / $sw4.ElapsedMilliseconds, 2))x" -ForegroundColor Green
78
+
79
+ Write-Host ""
80
+ Write-Host "=== 测试完成 ===" -ForegroundColor Cyan
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env pwsh
2
+
3
+ Write-Host "=== Phase 1 跨平台兼容性测试 (PowerShell) ===" -ForegroundColor Cyan
4
+ Write-Host ""
5
+
6
+ Write-Host "【系统信息】" -ForegroundColor Yellow
7
+ Write-Host "操作系统: $($PSVersionTable.OS)"
8
+ Write-Host "PowerShell 版本: $($PSVersionTable.PSVersion)"
9
+ Write-Host "平台: $($PSVersionTable.Platform)"
10
+ Write-Host ""
11
+
12
+ Write-Host "【路径处理测试】" -ForegroundColor Yellow
13
+ # 测试 Join-Path 跨平台兼容性
14
+ $testPath = Join-Path "templates" "config" "keyword-mappings.json"
15
+ if (Test-Path $testPath) {
16
+ Write-Host "✅ 路径处理正常: $testPath" -ForegroundColor Green
17
+ } else {
18
+ Write-Host "❌ 路径处理失败: $testPath" -ForegroundColor Red
19
+ exit 1
20
+ }
21
+
22
+ Write-Host ""
23
+ if ($PSVersionTable.PSVersion.Major -ge 7) {
24
+ Write-Host "✅ 跨平台兼容性测试通过(PowerShell 7+ 跨平台)" -ForegroundColor Green
25
+ } else {
26
+ Write-Host "✅ 跨平台兼容性测试通过(Windows PowerShell 5.1)" -ForegroundColor Green
27
+ }
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env pwsh
2
+
3
+ Write-Host "=== Phase 1 边界情况测试 (PowerShell) ===" -ForegroundColor Cyan
4
+ Write-Host ""
5
+
6
+ Write-Host "测试 5.1: 文件不存在处理" -ForegroundColor Yellow
7
+
8
+ # 模拟 Get-FileMTimeFromCache 函数
9
+ function Get-FileMTimeFromCache {
10
+ param([string]$filePath)
11
+
12
+ if (-not (Test-Path $filePath)) {
13
+ return $null # 哨兵值
14
+ }
15
+
16
+ return (Get-Item $filePath).LastWriteTimeUtc
17
+ }
18
+
19
+ # 测试不存在的文件
20
+ $mtime = Get-FileMTimeFromCache "templates/nonexistent-file.md"
21
+ if ($null -eq $mtime) {
22
+ Write-Host "✅ 正确处理文件不存在(mtime = null)" -ForegroundColor Green
23
+ } else {
24
+ Write-Host "❌ 文件不存在处理错误:mtime = $mtime" -ForegroundColor Red
25
+ exit 1
26
+ }
27
+
28
+ Write-Host ""
29
+ Write-Host "✅ PowerShell 边界情况测试通过" -ForegroundColor Green
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env pwsh
2
+
3
+ Write-Host "=== Phase 1 PowerShell 缓存测试 ===" -ForegroundColor Cyan
4
+ Write-Host ""
5
+
6
+ # 测试 3.1: 功能测试
7
+ Write-Host "测试 3.1: 运行功能测试" -ForegroundColor Yellow
8
+ pwsh test-ps-cache.ps1
9
+ Write-Host ""
10
+
11
+ # 测试 3.2: 性能测试
12
+ Write-Host "测试 3.2: 运行性能测试" -ForegroundColor Yellow
13
+ pwsh bench-ps-cache.ps1
14
+ Write-Host ""
15
+
16
+ # 测试 3.3: PowerShell 版本检测
17
+ Write-Host "测试 3.3: PowerShell 版本检测" -ForegroundColor Yellow
18
+ Write-Host "当前 PowerShell 版本: $($PSVersionTable.PSVersion)"
19
+ if ($PSVersionTable.PSVersion.Major -ge 7) {
20
+ Write-Host "✅ PowerShell 7+ (跨平台)" -ForegroundColor Green
21
+ } elseif ($PSVersionTable.PSVersion.Major -eq 5) {
22
+ Write-Host "✅ Windows PowerShell 5.1" -ForegroundColor Green
23
+ } else {
24
+ Write-Host "⚠️ 不支持的 PowerShell 版本" -ForegroundColor Yellow
25
+ }
26
+
27
+ Write-Host ""
28
+ Write-Host "✅ PowerShell 缓存测试全部通过" -ForegroundColor Green
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env pwsh
2
+
3
+ # 加载脚本(使用 dot sourcing)
4
+ . .\templates\scripts\powershell\check-writing-state.ps1
5
+
6
+ Write-Host "=== 测试 PowerShell 缓存功能 ===" -ForegroundColor Cyan
7
+ Write-Host ""
8
+
9
+ # 测试 1: 存在的文件
10
+ Write-Host "测试 1: 存在的文件" -ForegroundColor Yellow
11
+ Preload-FileMTimes -FilePathList @("templates/config/keyword-mappings.json")
12
+ if (Test-FileExistsCached "templates/config/keyword-mappings.json") {
13
+ Write-Host "✅ 存在的文件检测正确" -ForegroundColor Green
14
+ } else {
15
+ Write-Host "❌ 存在的文件检测错误" -ForegroundColor Red
16
+ }
17
+
18
+ # 测试 2: 不存在的文件
19
+ Write-Host ""
20
+ Write-Host "测试 2: 不存在的文件" -ForegroundColor Yellow
21
+ Preload-FileMTimes -FilePathList @("templates/nonexistent-file.md")
22
+ if (Test-FileExistsCached "templates/nonexistent-file.md") {
23
+ Write-Host "❌ 不存在的文件被误判为存在" -ForegroundColor Red
24
+ } else {
25
+ Write-Host "✅ 不存在的文件检测正确" -ForegroundColor Green
26
+ }
27
+
28
+ # 测试 3: 检查缓存值
29
+ Write-Host ""
30
+ Write-Host "测试 3: 检查缓存值" -ForegroundColor Yellow
31
+ $mtimeExisting = Get-FileMTimeFromCache "templates/config/keyword-mappings.json"
32
+ $mtimeMissing = Get-FileMTimeFromCache "templates/nonexistent-file.md"
33
+
34
+ Write-Host "存在文件的 mtime: $mtimeExisting"
35
+ Write-Host "不存在文件的 mtime: $mtimeMissing (应该为 null)"
36
+
37
+ if ($null -ne $mtimeExisting -and $null -eq $mtimeMissing) {
38
+ Write-Host "✅ 缓存值语义正确" -ForegroundColor Green
39
+ } else {
40
+ Write-Host "❌ 缓存值语义错误" -ForegroundColor Red
41
+ }
42
+
43
+ # 测试 4: 批量预加载
44
+ Write-Host ""
45
+ Write-Host "测试 4: 批量预加载混合文件" -ForegroundColor Yellow
46
+ $mixedFiles = @(
47
+ "templates/config/keyword-mappings.json" # 存在
48
+ "templates/nonexistent1.md" # 不存在
49
+ "templates/nonexistent2.md" # 不存在
50
+ )
51
+ Preload-FileMTimes -FilePathList $mixedFiles
52
+
53
+ $existsCount = 0
54
+ $missingCount = 0
55
+ foreach ($file in $mixedFiles) {
56
+ if (Test-FileExistsCached $file) {
57
+ $existsCount++
58
+ } else {
59
+ $missingCount++
60
+ }
61
+ }
62
+
63
+ Write-Host "检测到存在的文件: $existsCount (期望 1)"
64
+ Write-Host "检测到不存在的文件: $missingCount (期望 2)"
65
+
66
+ if ($existsCount -eq 1 -and $missingCount -eq 2) {
67
+ Write-Host "✅ 批量预加载检测正确" -ForegroundColor Green
68
+ } else {
69
+ Write-Host "❌ 批量预加载检测错误" -ForegroundColor Red
70
+ }
71
+
72
+ Write-Host ""
73
+ Write-Host "=== 测试完成 ===" -ForegroundColor Cyan
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env pwsh
2
+
3
+ Write-Host "=== Phase 1 回归测试 (PowerShell) ===" -ForegroundColor Cyan
4
+ Write-Host ""
5
+
6
+ Write-Host "测试 7.1: 脚本正常运行" -ForegroundColor Yellow
7
+ try {
8
+ $null = & "templates/scripts/powershell/check-writing-state.ps1" -ErrorAction Stop 2>&1
9
+ Write-Host "✅ 脚本执行成功" -ForegroundColor Green
10
+ } catch {
11
+ Write-Host "⚠️ 脚本执行有警告(可能是正常的)" -ForegroundColor Yellow
12
+ }
13
+
14
+ Write-Host ""
15
+ Write-Host "测试 7.2: JSON 输出格式" -ForegroundColor Yellow
16
+ try {
17
+ $output = & "templates/scripts/powershell/check-writing-state.ps1" 2>$null | Out-String
18
+ $json = $output | ConvertFrom-Json -ErrorAction Stop
19
+ Write-Host "✅ JSON 格式正确" -ForegroundColor Green
20
+ } catch {
21
+ Write-Host "❌ JSON 格式错误: $_" -ForegroundColor Red
22
+ Write-Host "输出内容:"
23
+ Write-Host $output
24
+ exit 1
25
+ }
26
+
27
+ Write-Host ""
28
+ Write-Host "测试 7.3: 必需字段存在性" -ForegroundColor Yellow
29
+ $requiredFields = @("status")
30
+
31
+ foreach ($field in $requiredFields) {
32
+ if ($json.PSObject.Properties.Name -contains $field) {
33
+ Write-Host "✅ 字段存在: $field" -ForegroundColor Green
34
+ } else {
35
+ Write-Host "⚠️ 字段不存在: $field(可能是预期的)" -ForegroundColor Yellow
36
+ }
37
+ }
38
+
39
+ Write-Host ""
40
+ Write-Host "✅ PowerShell 回归测试通过" -ForegroundColor Green
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env pwsh
2
+ # 离线文本人味自查(PowerShell)
3
+
4
+ param(
5
+ [Parameter(Mandatory=$true)][string]$File
6
+ )
7
+
8
+ Set-StrictMode -Version Latest
9
+ $ErrorActionPreference = 'Stop'
10
+
11
+ . "$PSScriptRoot/common.ps1"
12
+
13
+ $root = Get-ProjectRoot
14
+ $cfgProject = Join-Path $root "spec/knowledge/audit-config.json"
15
+ $cfgTemplate = Join-Path $root ".specify/templates/knowledge/audit-config.json"
16
+ $cfg = if (Test-Path $cfgProject) { $cfgProject } elseif (Test-Path $cfgTemplate) { $cfgTemplate } else { '' }
17
+
18
+ if (-not (Test-Path $File)) { throw "用法: text-audit.ps1 -File <路径>" }
19
+
20
+ python3 - << PY
21
+ import json, re, sys, os, math
22
+ path = r'''$File'''
23
+ cfg_path = r'''$cfg'''
24
+ text = open(path, 'r', encoding='utf-8', errors='ignore').read()
25
+ default_cfg = {
26
+ "connector_phrases": ["首先","其次","再次","然后","然而","总而言之","综上所述","在某种程度","众所周知","在当下","随着"],
27
+ "empty_phrases": ["广泛关注","引发热议","影响深远","具有重要意义","有效提升","具有一定的指导意义","值得我们思考"],
28
+ "cliche_pairs": [],
29
+ "sentence_length": {"max_run_long":4, "max_run_short":5, "short_threshold":12, "long_threshold":35},
30
+ "abstract_nouns": ["价值","意义","认知","体系","模式","路径","方法论","趋势"],
31
+ "min_concrete_details": 3
32
+ }
33
+ cfg = default_cfg
34
+ if cfg_path and os.path.exists(cfg_path):
35
+ try: cfg.update(json.load(open(cfg_path,'r',encoding='utf-8')))
36
+ except: pass
37
+ def count_occurrences(text, phrases):
38
+ return {p: len(re.findall(re.escape(p), text)) for p in phrases if p}
39
+ def split_sentences(t):
40
+ parts = re.split(r'[。!?!?\n]+', t)
41
+ return [s.strip() for s in parts if s.strip()]
42
+ def sentence_lengths(sents):
43
+ lens = [len(s) for s in sents]
44
+ if not lens: return lens, 0, 0
45
+ avg = sum(lens)/len(lens)
46
+ var = sum((x-avg)**2 for x in lens)/len(lens)
47
+ return lens, avg, var**0.5
48
+ def runs(lens, short_th, long_th):
49
+ rs=rl=0; mrs=mrl=0
50
+ for L in lens:
51
+ if L<=short_th: rs+=1; mrs=max(mrs,rs); rl=0
52
+ elif L>=long_th: rl+=1; mrl=max(mrl,rl); rs=0
53
+ else: rs=rl=0
54
+ return mrs, mrl
55
+ def abstract_density(sent, words):
56
+ return sum(len(re.findall(re.escape(w), sent)) for w in words)
57
+ connectors = count_occurrences(text, cfg["connector_phrases"])
58
+ empties = count_occurrences(text, cfg["empty_phrases"])
59
+ sents = split_sentences(text)
60
+ lens, avg, std = sentence_lengths(sents)
61
+ mx_run_short, mx_run_long = runs(lens, cfg["sentence_length"]["short_threshold"], cfg["sentence_length"]["long_threshold"])
62
+ abstract_scores = [(i, abstract_density(s, cfg["abstract_nouns"])) for i,s in enumerate(sents)]
63
+ abstract_scores.sort(key=lambda x: x[1], reverse=True)
64
+ abstract_top = [(i,sents[i]) for i,sc in abstract_scores[:5] if sc>=2]
65
+ total_chars = len(text)
66
+ def ratio(c): return (c/max(1,total_chars))*1000
67
+ print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
68
+ print("📊 离线文本人味自查报告")
69
+ print(f"文件: {os.path.basename(path)} 字符数: {total_chars}")
70
+ print("")
71
+ print("连接词密度(每千字出现次数)")
72
+ tc=sum(connectors.values()); print(f" 总计: {tc} | 比率: {ratio(tc):.2f}")
73
+ for k,v in sorted(connectors.items(), key=lambda x: -x[1])[:10]:
74
+ if v>0: print(f" - {k}: {v}")
75
+ print("")
76
+ print("空话/套话计数")
77
+ te=sum(empties.values()); print(f" 总计: {te} | 比率: {ratio(te):.2f}")
78
+ for k,v in sorted(empties.items(), key=lambda x: -x[1])[:10]:
79
+ if v>0: print(f" - {k}: {v}")
80
+ print("")
81
+ print("句长统计")
82
+ print(f" 句子数: {len(lens)} | 平均: {avg:.1f} | 标准差: {std:.1f}")
83
+ print(f" 连续短句最大: {mx_run_short} (阈值 {cfg['sentence_length']['max_run_short']})")
84
+ print(f" 连续长句最大: {mx_run_long} (阈值 {cfg['sentence_length']['max_run_long']})")
85
+ print("")
86
+ print("抽象过载(示例段,≥2 抽象词)")
87
+ if abstract_top:
88
+ for idx,s in abstract_top:
89
+ sn = s[:80] + ("…" if len(s)>80 else "")
90
+ print(f" - 第{idx+1}句: {sn}")
91
+ else:
92
+ print(" 无显著抽象过载片段")
93
+ print("")
94
+ print("建议")
95
+ print(" - 用具体动作/器物/气味替代空话与抽象名词")
96
+ print(" - 打断长长串句子;合并过多的短句以形成起伏")
97
+ print(" - 复查连接词是否可删除或自然过渡")
98
+ print(" - 写前先列3个生活细节作为锚点")
99
+ PY
100
+
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env pwsh
2
+ # 综合追踪小说创作进度(PowerShell)
3
+
4
+ param(
5
+ [switch]$check,
6
+ [switch]$fix,
7
+ [switch]$brief,
8
+ [switch]$plot,
9
+ [switch]$stats
10
+ )
11
+
12
+ Set-StrictMode -Version Latest
13
+ $ErrorActionPreference = 'Stop'
14
+
15
+ . "$PSScriptRoot/common.ps1"
16
+
17
+ $root = Get-ProjectRoot
18
+ $storyDir = Get-CurrentStoryDir
19
+ $progress = Join-Path $root "stories/current/progress.json"
20
+ $plotPath = Join-Path $root "spec/tracking/plot-tracker.json"
21
+
22
+ function Show-BasicReport {
23
+ Write-Host "📊 小说创作综合报告"
24
+ Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
25
+ if (Test-Path $progress) {
26
+ Write-Host "✍️ 写作进度"
27
+ Write-Host " 完成情况等待分析..."
28
+ }
29
+ if (Test-Path $plotPath) {
30
+ Write-Host "📍 情节状态"
31
+ Write-Host " 主线进度等待分析..."
32
+ }
33
+ }
34
+
35
+ function Run-DeepCheck {
36
+ Write-Host "🔍 执行深度验证..."
37
+ Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
38
+ Write-Host "Phase 1: 基础验证"
39
+ Write-Host " [P] 执行情节一致性检查..."
40
+ Write-Host " [P] 执行时间线验证..."
41
+ Write-Host " [P] 执行关系验证..."
42
+ Write-Host " [P] 执行世界观验证..."
43
+ Write-Host "Phase 2: 角色深度验证"
44
+ $rules = Join-Path $root "spec/tracking/validation-rules.json"
45
+ if (Test-Path $rules) {
46
+ Write-Host " ✅ 加载验证规则"
47
+ Set-Content -LiteralPath "$env:TEMP/validation-tasks.md" -Encoding UTF8 -Value @"
48
+ # 验证任务 (自动生成)
49
+
50
+ ## Phase 1: 基础验证 [并行]
51
+ - [ ] T001 [P] 执行情节一致性检查
52
+ - [ ] T002 [P] 执行时间线验证
53
+ - [ ] T003 [P] 执行关系验证
54
+ - [ ] T004 [P] 执行世界观验证
55
+
56
+ ## Phase 2: 角色验证
57
+ - [ ] T005 加载validation-rules.json
58
+ - [ ] T006 扫描章节角色名称
59
+ - [ ] T007 验证名称一致性
60
+ - [ ] T008 检查称呼准确性
61
+ - [ ] T009 验证行为一致性
62
+
63
+ ## Phase 3: 生成报告
64
+ - [ ] T010 汇总结果
65
+ - [ ] T011 标记问题
66
+ - [ ] T012 生成建议
67
+ "@
68
+ Write-Host " ✅ 验证任务已生成"
69
+ } else {
70
+ Write-Host " ⚠️ 未找到验证规则文件"
71
+ }
72
+ Write-Host "📊 深度验证报告"
73
+ Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━"
74
+ Write-Host "AI将分析所有章节并生成详细报告..."
75
+ Write-Host "💡 提示:发现问题后可运行 --fix 自动修复"
76
+ }
77
+
78
+ function Run-AutoFix {
79
+ Write-Host "🔧 执行自动修复..."
80
+ Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
81
+ Set-Content -LiteralPath "$env:TEMP/fix-tasks.md" -Encoding UTF8 -Value @"
82
+ # 修复任务 (自动生成)
83
+
84
+ ## Phase 1: 简单修复 [可自动]
85
+ - [ ] F001 读取验证报告
86
+ - [ ] F002 [P] 修复角色名称错误
87
+ - [ ] F003 [P] 修复称呼错误
88
+ - [ ] F004 [P] 修复简单拼写
89
+
90
+ ## Phase 2: 生成报告
91
+ - [ ] F005 汇总修复结果
92
+ - [ ] F006 更新追踪文件
93
+ "@
94
+ Write-Host "🔧 自动修复报告"
95
+ Write-Host "━━━━━━━━━━━━━━━━━━━"
96
+ Write-Host "AI将自动修复简单问题..."
97
+ }
98
+
99
+ if ($check) { Run-DeepCheck }
100
+ elseif ($fix) { Run-AutoFix }
101
+ else { Show-BasicReport }
102
+
103
+ Write-Host ""
104
+ Write-Host "✅ 追踪分析完成"
105
+