novelws 3.1.0 → 5.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 (358) hide show
  1. package/CHANGELOG.md +115 -564
  2. package/README.md +81 -598
  3. package/dist/cli.js +1 -3
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +18 -103
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/upgrade.d.ts.map +1 -1
  9. package/dist/commands/upgrade.js +18 -52
  10. package/dist/commands/upgrade.js.map +1 -1
  11. package/dist/core/config.d.ts +7 -36
  12. package/dist/core/config.d.ts.map +1 -1
  13. package/dist/core/config.js +11 -38
  14. package/dist/core/config.js.map +1 -1
  15. package/dist/core/errors.d.ts +0 -31
  16. package/dist/core/errors.d.ts.map +1 -1
  17. package/dist/core/errors.js +0 -58
  18. package/dist/core/errors.js.map +1 -1
  19. package/dist/utils/diagnostics.d.ts +2 -16
  20. package/dist/utils/diagnostics.d.ts.map +1 -1
  21. package/dist/utils/diagnostics.js +7 -73
  22. package/dist/utils/diagnostics.js.map +1 -1
  23. package/dist/utils/project.d.ts +1 -1
  24. package/dist/utils/project.d.ts.map +1 -1
  25. package/dist/utils/project.js +3 -3
  26. package/dist/utils/project.js.map +1 -1
  27. package/package.json +1 -2
  28. package/templates/commands/analyze.md +65 -265
  29. package/templates/commands/expand.md +70 -0
  30. package/templates/commands/plan.md +47 -452
  31. package/templates/commands/specify.md +43 -869
  32. package/templates/commands/write.md +49 -556
  33. package/templates/dot-claude/CLAUDE.md +38 -202
  34. package/templates/resources/anti-ai.md +16 -0
  35. package/templates/resources/style-reference.md +19 -0
  36. package/templates/tracking/character-state.json +1 -76
  37. package/templates/tracking/plot-tracker.json +3 -60
  38. package/templates/tracking/relationships.json +1 -68
  39. package/templates/tracking/timeline.json +1 -47
  40. package/dist/commands/plugin.d.ts +0 -6
  41. package/dist/commands/plugin.d.ts.map +0 -1
  42. package/dist/commands/plugin.js +0 -135
  43. package/dist/commands/plugin.js.map +0 -1
  44. package/dist/plugins/identifier.d.ts +0 -13
  45. package/dist/plugins/identifier.d.ts.map +0 -1
  46. package/dist/plugins/identifier.js +0 -72
  47. package/dist/plugins/identifier.js.map +0 -1
  48. package/dist/plugins/installers/base.d.ts +0 -27
  49. package/dist/plugins/installers/base.d.ts.map +0 -1
  50. package/dist/plugins/installers/base.js +0 -30
  51. package/dist/plugins/installers/base.js.map +0 -1
  52. package/dist/plugins/installers/github.d.ts +0 -22
  53. package/dist/plugins/installers/github.d.ts.map +0 -1
  54. package/dist/plugins/installers/github.js +0 -133
  55. package/dist/plugins/installers/github.js.map +0 -1
  56. package/dist/plugins/installers/local.d.ts +0 -16
  57. package/dist/plugins/installers/local.d.ts.map +0 -1
  58. package/dist/plugins/installers/local.js +0 -69
  59. package/dist/plugins/installers/local.js.map +0 -1
  60. package/dist/plugins/installers/npm.d.ts +0 -20
  61. package/dist/plugins/installers/npm.d.ts.map +0 -1
  62. package/dist/plugins/installers/npm.js +0 -99
  63. package/dist/plugins/installers/npm.js.map +0 -1
  64. package/dist/plugins/manager.d.ts +0 -77
  65. package/dist/plugins/manager.d.ts.map +0 -1
  66. package/dist/plugins/manager.js +0 -349
  67. package/dist/plugins/manager.js.map +0 -1
  68. package/dist/plugins/registry.d.ts +0 -48
  69. package/dist/plugins/registry.d.ts.map +0 -1
  70. package/dist/plugins/registry.js +0 -111
  71. package/dist/plugins/registry.js.map +0 -1
  72. package/dist/plugins/types.d.ts +0 -66
  73. package/dist/plugins/types.d.ts.map +0 -1
  74. package/dist/plugins/types.js +0 -2
  75. package/dist/plugins/types.js.map +0 -1
  76. package/dist/plugins/validator.d.ts +0 -19
  77. package/dist/plugins/validator.d.ts.map +0 -1
  78. package/dist/plugins/validator.js +0 -164
  79. package/dist/plugins/validator.js.map +0 -1
  80. package/dist/utils/logger.d.ts +0 -13
  81. package/dist/utils/logger.d.ts.map +0 -1
  82. package/dist/utils/logger.js +0 -48
  83. package/dist/utils/logger.js.map +0 -1
  84. package/plugins/authentic-voice/README.md +0 -31
  85. package/plugins/authentic-voice/commands/authentic-voice.md +0 -73
  86. package/plugins/authentic-voice/commands/authenticity-audit.md +0 -37
  87. package/plugins/authentic-voice/config.yaml +0 -30
  88. package/plugins/authentic-voice/experts/authentic-editor.md +0 -27
  89. package/plugins/export/README.md +0 -319
  90. package/plugins/export/commands/export.md +0 -460
  91. package/plugins/export/commands/generate-cover.md +0 -256
  92. package/plugins/export/commands/metadata.md +0 -309
  93. package/plugins/export/config.yaml +0 -47
  94. package/plugins/export/experts/publishing-expert.md +0 -171
  95. package/plugins/export/templates/epub/chapter-template.html +0 -13
  96. package/plugins/export/templates/epub/cover-template.html +0 -14
  97. package/plugins/export/templates/epub/stylesheet.css +0 -200
  98. package/plugins/export/templates/pdf/ebook-style.css +0 -137
  99. package/plugins/export/templates/pdf/print-style.css +0 -179
  100. package/plugins/export/templates/platforms/jinjiang-format.md +0 -101
  101. package/plugins/export/templates/platforms/qidian-format.md +0 -108
  102. package/plugins/export/templates/platforms/tomato-format.md +0 -95
  103. package/plugins/translate/README.md +0 -265
  104. package/plugins/translate/commands/glossary.md +0 -731
  105. package/plugins/translate/commands/translate-preview.md +0 -543
  106. package/plugins/translate/commands/translate.md +0 -649
  107. package/plugins/translate/config.yaml +0 -43
  108. package/plugins/translate/experts/literary-translator.md +0 -605
  109. package/templates/commands/character.md +0 -287
  110. package/templates/commands/checklist.md +0 -744
  111. package/templates/commands/clarify.md +0 -269
  112. package/templates/commands/constitution.md +0 -269
  113. package/templates/commands/expert.md +0 -188
  114. package/templates/commands/facts.md +0 -552
  115. package/templates/commands/guide.md +0 -900
  116. package/templates/commands/help-me.md +0 -221
  117. package/templates/commands/recap.md +0 -748
  118. package/templates/commands/relations.md +0 -385
  119. package/templates/commands/revise.md +0 -450
  120. package/templates/commands/search.md +0 -531
  121. package/templates/commands/tasks.md +0 -396
  122. package/templates/commands/timeline.md +0 -309
  123. package/templates/commands/track-init.md +0 -149
  124. package/templates/commands/track.md +0 -704
  125. package/templates/commands/volume-summary.md +0 -471
  126. package/templates/config/keyword-mappings.json +0 -226
  127. package/templates/knowledge/audit-config.json +0 -26
  128. package/templates/knowledge/character-profiles.md +0 -152
  129. package/templates/knowledge/character-voices.md +0 -137
  130. package/templates/knowledge/locations.md +0 -184
  131. package/templates/knowledge/world-setting.md +0 -121
  132. package/templates/knowledge-base/README.md +0 -285
  133. package/templates/knowledge-base/character-archetypes/01-hero.md +0 -233
  134. package/templates/knowledge-base/character-archetypes/02-mentor.md +0 -177
  135. package/templates/knowledge-base/character-archetypes/03-shadow.md +0 -221
  136. package/templates/knowledge-base/character-archetypes/04-ally.md +0 -178
  137. package/templates/knowledge-base/character-archetypes/05-shapeshifter.md +0 -177
  138. package/templates/knowledge-base/character-archetypes/06-trickster.md +0 -181
  139. package/templates/knowledge-base/character-archetypes/07-threshold-guardian.md +0 -177
  140. package/templates/knowledge-base/character-archetypes/08-herald.md +0 -180
  141. package/templates/knowledge-base/character-archetypes/09-father.md +0 -249
  142. package/templates/knowledge-base/character-archetypes/10-mother.md +0 -202
  143. package/templates/knowledge-base/character-archetypes/11-child.md +0 -183
  144. package/templates/knowledge-base/character-archetypes/12-sage.md +0 -202
  145. package/templates/knowledge-base/character-archetypes/README.md +0 -60
  146. package/templates/knowledge-base/character-archetypes/application-guide.md +0 -222
  147. package/templates/knowledge-base/character-archetypes/archetype-combinations.md +0 -242
  148. package/templates/knowledge-base/character-archetypes/config.yaml +0 -28
  149. package/templates/knowledge-base/character-archetypes/examples-analysis.md +0 -223
  150. package/templates/knowledge-base/craft/character-arc.md +0 -1153
  151. package/templates/knowledge-base/craft/dialogue.md +0 -1170
  152. package/templates/knowledge-base/craft/hook-design.md +0 -345
  153. package/templates/knowledge-base/craft/pacing.md +0 -1200
  154. package/templates/knowledge-base/craft/power-system.md +0 -254
  155. package/templates/knowledge-base/craft/scene-structure.md +0 -1136
  156. package/templates/knowledge-base/craft/show-not-tell.md +0 -1012
  157. package/templates/knowledge-base/craft/story-structures.md +0 -134
  158. package/templates/knowledge-base/craft/tension-management.md +0 -168
  159. package/templates/knowledge-base/emotional-beats/01-first-meeting.md +0 -145
  160. package/templates/knowledge-base/emotional-beats/02-bonding-moment.md +0 -226
  161. package/templates/knowledge-base/emotional-beats/03-declaration.md +0 -284
  162. package/templates/knowledge-base/emotional-beats/04-triumph.md +0 -240
  163. package/templates/knowledge-base/emotional-beats/05-reunion.md +0 -396
  164. package/templates/knowledge-base/emotional-beats/06-forgiveness.md +0 -204
  165. package/templates/knowledge-base/emotional-beats/07-betrayal.md +0 -204
  166. package/templates/knowledge-base/emotional-beats/08-loss.md +0 -214
  167. package/templates/knowledge-base/emotional-beats/09-rejection.md +0 -254
  168. package/templates/knowledge-base/emotional-beats/10-failure.md +0 -244
  169. package/templates/knowledge-base/emotional-beats/11-misunderstanding.md +0 -205
  170. package/templates/knowledge-base/emotional-beats/12-farewell.md +0 -283
  171. package/templates/knowledge-base/emotional-beats/13-revelation.md +0 -242
  172. package/templates/knowledge-base/emotional-beats/14-point-of-no-return.md +0 -215
  173. package/templates/knowledge-base/emotional-beats/15-dark-night.md +0 -244
  174. package/templates/knowledge-base/emotional-beats/16-sacrifice.md +0 -246
  175. package/templates/knowledge-base/emotional-beats/17-awakening.md +0 -246
  176. package/templates/knowledge-base/emotional-beats/18-confrontation.md +0 -217
  177. package/templates/knowledge-base/emotional-beats/19-bittersweet-goodbye.md +0 -368
  178. package/templates/knowledge-base/emotional-beats/20-moral-dilemma.md +0 -248
  179. package/templates/knowledge-base/emotional-beats/21-temptation.md +0 -240
  180. package/templates/knowledge-base/emotional-beats/22-redemption.md +0 -210
  181. package/templates/knowledge-base/emotional-beats/README.md +0 -104
  182. package/templates/knowledge-base/emotional-beats/beat-sequences.md +0 -276
  183. package/templates/knowledge-base/emotional-beats/config.yaml +0 -30
  184. package/templates/knowledge-base/emotional-beats/pacing-guide.md +0 -390
  185. package/templates/knowledge-base/genres/game-lit.md +0 -174
  186. package/templates/knowledge-base/genres/historical.md +0 -1127
  187. package/templates/knowledge-base/genres/horror.md +0 -211
  188. package/templates/knowledge-base/genres/military.md +0 -209
  189. package/templates/knowledge-base/genres/mystery.md +0 -1123
  190. package/templates/knowledge-base/genres/rebirth.md +0 -177
  191. package/templates/knowledge-base/genres/revenge.md +0 -846
  192. package/templates/knowledge-base/genres/romance.md +0 -948
  193. package/templates/knowledge-base/genres/sci-fi.md +0 -156
  194. package/templates/knowledge-base/genres/sports.md +0 -216
  195. package/templates/knowledge-base/genres/thriller.md +0 -166
  196. package/templates/knowledge-base/genres/urban.md +0 -170
  197. package/templates/knowledge-base/genres/workplace.md +0 -214
  198. package/templates/knowledge-base/genres/wuxia.md +0 -143
  199. package/templates/knowledge-base/genres/xuanhuan.md +0 -234
  200. package/templates/knowledge-base/genres/youth.md +0 -219
  201. package/templates/knowledge-base/references/README.md +0 -96
  202. package/templates/knowledge-base/references/china-1920s/culture.md +0 -423
  203. package/templates/knowledge-base/references/china-1920s/daily-life.md +0 -616
  204. package/templates/knowledge-base/references/china-1920s/overview.md +0 -298
  205. package/templates/knowledge-base/references/china-1920s/society.md +0 -703
  206. package/templates/knowledge-base/references/china-1920s/warlords.md +0 -427
  207. package/templates/knowledge-base/references/cultivation-world/daily-life.md +0 -108
  208. package/templates/knowledge-base/references/cultivation-world/overview.md +0 -64
  209. package/templates/knowledge-base/references/cultivation-world/power-system.md +0 -108
  210. package/templates/knowledge-base/references/cultivation-world/sects.md +0 -104
  211. package/templates/knowledge-base/references/cultivation-world/world-setting.md +0 -108
  212. package/templates/knowledge-base/references/modern-workplace/corporate.md +0 -115
  213. package/templates/knowledge-base/references/modern-workplace/daily-life.md +0 -129
  214. package/templates/knowledge-base/references/modern-workplace/overview.md +0 -73
  215. package/templates/knowledge-base/references/modern-workplace/relationships.md +0 -107
  216. package/templates/knowledge-base/references/modern-workplace/tech-industry.md +0 -131
  217. package/templates/knowledge-base/references/tang-dynasty/culture.md +0 -135
  218. package/templates/knowledge-base/references/tang-dynasty/daily-life.md +0 -139
  219. package/templates/knowledge-base/references/tang-dynasty/overview.md +0 -76
  220. package/templates/knowledge-base/references/tang-dynasty/politics.md +0 -121
  221. package/templates/knowledge-base/references/tang-dynasty/society.md +0 -126
  222. package/templates/knowledge-base/requirements/README.md +0 -240
  223. package/templates/knowledge-base/requirements/anti-ai-v3.md +0 -46
  224. package/templates/knowledge-base/requirements/anti-ai-v4-deprecated.md +0 -442
  225. package/templates/knowledge-base/requirements/anti-ai-v5-balanced.md +0 -203
  226. package/templates/knowledge-base/requirements/concretization.md +0 -90
  227. package/templates/knowledge-base/requirements/fast-paced.md +0 -552
  228. package/templates/knowledge-base/requirements/no-poison.md +0 -60
  229. package/templates/knowledge-base/requirements/romance-angst.md +0 -102
  230. package/templates/knowledge-base/requirements/romance-sweet.md +0 -63
  231. package/templates/knowledge-base/requirements/serious-literature.md +0 -45
  232. package/templates/knowledge-base/requirements/strong-emotion.md +0 -60
  233. package/templates/knowledge-base/styles/README.md +0 -302
  234. package/templates/knowledge-base/styles/ancient-style.md +0 -579
  235. package/templates/knowledge-base/styles/literary.md +0 -439
  236. package/templates/knowledge-base/styles/minimal.md +0 -472
  237. package/templates/knowledge-base/styles/natural-voice.md +0 -930
  238. package/templates/knowledge-base/styles/web-novel.md +0 -525
  239. package/templates/memory/personal-voice.md +0 -113
  240. package/templates/scripts/README.md +0 -187
  241. package/templates/scripts/bash/analyze-story.sh +0 -170
  242. package/templates/scripts/bash/check-analyze-stage.sh +0 -108
  243. package/templates/scripts/bash/check-consistency.sh +0 -463
  244. package/templates/scripts/bash/check-facts.sh +0 -214
  245. package/templates/scripts/bash/check-plot.sh +0 -374
  246. package/templates/scripts/bash/check-timeline.sh +0 -346
  247. package/templates/scripts/bash/check-world.sh +0 -395
  248. package/templates/scripts/bash/check-writing-state.sh +0 -854
  249. package/templates/scripts/bash/clarify-story.sh +0 -117
  250. package/templates/scripts/bash/common.sh +0 -151
  251. package/templates/scripts/bash/constitution.sh +0 -114
  252. package/templates/scripts/bash/generate-tasks.sh +0 -65
  253. package/templates/scripts/bash/init-tracking.sh +0 -183
  254. package/templates/scripts/bash/manage-relations.sh +0 -174
  255. package/templates/scripts/bash/migrate-tracking.sh +0 -183
  256. package/templates/scripts/bash/plan-story.sh +0 -100
  257. package/templates/scripts/bash/specify-story.sh +0 -93
  258. package/templates/scripts/bash/tasks-story.sh +0 -96
  259. package/templates/scripts/bash/test-word-count.sh +0 -182
  260. package/templates/scripts/bash/tests/bench-preload-cache.sh +0 -100
  261. package/templates/scripts/bash/tests/run-all-benchmarks.sh +0 -16
  262. package/templates/scripts/bash/tests/test-cache-semantics.sh +0 -199
  263. package/templates/scripts/bash/tests/test-cross-platform.sh +0 -35
  264. package/templates/scripts/bash/tests/test-edge-cases-bash.sh +0 -60
  265. package/templates/scripts/bash/tests/test-phase1-bash.sh +0 -28
  266. package/templates/scripts/bash/tests/test-preload-cache.sh +0 -123
  267. package/templates/scripts/bash/tests/test-regex-precompile.sh +0 -89
  268. package/templates/scripts/bash/tests/test-regression-bash.sh +0 -42
  269. package/templates/scripts/bash/tests/test-task6-verification.sh +0 -200
  270. package/templates/scripts/bash/text-audit.sh +0 -144
  271. package/templates/scripts/bash/track-progress.sh +0 -194
  272. package/templates/scripts/powershell/analyze-story.ps1 +0 -174
  273. package/templates/scripts/powershell/check-analyze-stage.ps1 +0 -110
  274. package/templates/scripts/powershell/check-consistency.ps1 +0 -138
  275. package/templates/scripts/powershell/check-facts.ps1 +0 -195
  276. package/templates/scripts/powershell/check-plot.ps1 +0 -139
  277. package/templates/scripts/powershell/check-timeline.ps1 +0 -112
  278. package/templates/scripts/powershell/check-writing-state.ps1 +0 -486
  279. package/templates/scripts/powershell/clarify-story.ps1 +0 -107
  280. package/templates/scripts/powershell/common.ps1 +0 -36
  281. package/templates/scripts/powershell/constitution.ps1 +0 -145
  282. package/templates/scripts/powershell/generate-tasks.ps1 +0 -70
  283. package/templates/scripts/powershell/init-tracking.ps1 +0 -98
  284. package/templates/scripts/powershell/manage-relations.ps1 +0 -134
  285. package/templates/scripts/powershell/migrate-tracking.ps1 +0 -145
  286. package/templates/scripts/powershell/plan-story.ps1 +0 -99
  287. package/templates/scripts/powershell/specify-story.ps1 +0 -85
  288. package/templates/scripts/powershell/tests/bench-ps-cache.ps1 +0 -80
  289. package/templates/scripts/powershell/tests/test-cross-platform.ps1 +0 -27
  290. package/templates/scripts/powershell/tests/test-edge-cases-ps.ps1 +0 -29
  291. package/templates/scripts/powershell/tests/test-phase1-ps.ps1 +0 -28
  292. package/templates/scripts/powershell/tests/test-ps-cache.ps1 +0 -73
  293. package/templates/scripts/powershell/tests/test-regression-ps.ps1 +0 -40
  294. package/templates/scripts/powershell/text-audit.ps1 +0 -102
  295. package/templates/scripts/powershell/track-progress.ps1 +0 -105
  296. package/templates/skills/analysis/character-analysis/SKILL.md +0 -71
  297. package/templates/skills/analysis/foreshadow-analysis/SKILL.md +0 -45
  298. package/templates/skills/analysis/hook-analysis/SKILL.md +0 -111
  299. package/templates/skills/analysis/logic-analysis/SKILL.md +0 -58
  300. package/templates/skills/analysis/opening-analysis/SKILL.md +0 -59
  301. package/templates/skills/analysis/pacing-analysis/SKILL.md +0 -55
  302. package/templates/skills/analysis/power-analysis/SKILL.md +0 -148
  303. package/templates/skills/analysis/reader-analysis/SKILL.md +0 -117
  304. package/templates/skills/analysis/style-analysis/SKILL.md +0 -60
  305. package/templates/skills/analysis/voice-analysis/SKILL.md +0 -42
  306. package/templates/skills/auto-tracking/SKILL.md +0 -280
  307. package/templates/skills/genre-knowledge/fantasy/SKILL.md +0 -355
  308. package/templates/skills/genre-knowledge/mystery/SKILL.md +0 -337
  309. package/templates/skills/genre-knowledge/romance/SKILL.md +0 -228
  310. package/templates/skills/genre-knowledge/sci-fi/SKILL.md +0 -65
  311. package/templates/skills/genre-knowledge/thriller/SKILL.md +0 -95
  312. package/templates/skills/planning/volume-detail/SKILL.md +0 -219
  313. package/templates/skills/quality-assurance/consistency-checker/SKILL.md +0 -412
  314. package/templates/skills/quality-assurance/continuity-tracker/SKILL.md +0 -157
  315. package/templates/skills/quality-assurance/facts-checker/SKILL.md +0 -405
  316. package/templates/skills/quality-assurance/forgotten-elements/SKILL.md +0 -147
  317. package/templates/skills/quality-assurance/getting-started/SKILL.md +0 -224
  318. package/templates/skills/quality-assurance/hook-checker/SKILL.md +0 -164
  319. package/templates/skills/quality-assurance/hook-checker/experts/hook-analyst.md +0 -33
  320. package/templates/skills/quality-assurance/long-series-continuity/SKILL.md +0 -570
  321. package/templates/skills/quality-assurance/pacing-monitor/SKILL.md +0 -143
  322. package/templates/skills/quality-assurance/pov-validator/SKILL.md +0 -135
  323. package/templates/skills/quality-assurance/pre-write-checklist/SKILL.md +0 -583
  324. package/templates/skills/quality-assurance/requirement-detector/CONFLICT_RESOLUTION.md +0 -119
  325. package/templates/skills/quality-assurance/requirement-detector/EXAMPLES.md +0 -146
  326. package/templates/skills/quality-assurance/requirement-detector/KEYWORDS.md +0 -160
  327. package/templates/skills/quality-assurance/requirement-detector/SKILL.md +0 -149
  328. package/templates/skills/quality-assurance/setting-detector/SKILL.md +0 -611
  329. package/templates/skills/quality-assurance/style-detector/CONFLICT_RESOLUTION.md +0 -126
  330. package/templates/skills/quality-assurance/style-detector/EXAMPLES.md +0 -206
  331. package/templates/skills/quality-assurance/style-detector/KEYWORDS.md +0 -207
  332. package/templates/skills/quality-assurance/style-detector/SKILL.md +0 -264
  333. package/templates/skills/quality-assurance/voice-consistency-checker/SKILL.md +0 -103
  334. package/templates/skills/quality-assurance/voice-consistency-checker/experts/voice-analyst.md +0 -21
  335. package/templates/skills/quality-assurance/workflow-guide/SKILL.md +0 -381
  336. package/templates/skills/writing-techniques/character-arc/SKILL.md +0 -267
  337. package/templates/skills/writing-techniques/dialogue-techniques/SKILL.md +0 -366
  338. package/templates/skills/writing-techniques/multi-thread-narrative/SKILL.md +0 -708
  339. package/templates/skills/writing-techniques/multi-thread-narrative/experts/thread-analyst.md +0 -226
  340. package/templates/skills/writing-techniques/pacing-control/SKILL.md +0 -480
  341. package/templates/skills/writing-techniques/reader-expectation/SKILL.md +0 -1026
  342. package/templates/skills/writing-techniques/reader-expectation/experts/expectation-analyst.md +0 -209
  343. package/templates/skills/writing-techniques/revision-polish/SKILL.md +0 -496
  344. package/templates/skills/writing-techniques/revision-polish/experts/revision-editor.md +0 -221
  345. package/templates/skills/writing-techniques/scene-structure/SKILL.md +0 -361
  346. package/templates/skills/writing-techniques/style-learning/SKILL.md +0 -436
  347. package/templates/skills/writing-techniques/writing-balance/.gitkeep +0 -0
  348. package/templates/skills/writing-techniques/writing-balance/SKILL.md +0 -460
  349. package/templates/skills/writing-techniques/writing-techniques/SKILL.md +0 -727
  350. package/templates/specification-example.md +0 -146
  351. package/templates/tracking/story-facts.json +0 -5
  352. package/templates/tracking/summary/characters-summary.json +0 -7
  353. package/templates/tracking/summary/plot-summary.json +0 -13
  354. package/templates/tracking/summary/timeline-summary.json +0 -8
  355. package/templates/tracking/summary/volume-summaries.json +0 -5
  356. package/templates/tracking/tracking-log.md +0 -110
  357. package/templates/tracking/validation-rules.json +0 -128
  358. /package/templates/{memory → resources}/constitution.md +0 -0
@@ -1,99 +0,0 @@
1
- /**
2
- * NPM 安装器
3
- *
4
- * 从 npm registry 下载并安装插件。
5
- * 继承 BaseInstaller,复用公共 tar 解压逻辑。
6
- */
7
- import fs from 'fs-extra';
8
- import path from 'path';
9
- import { pipeline } from 'stream/promises';
10
- import { createWriteStream } from 'fs';
11
- import { BaseInstaller } from './base.js';
12
- import { NetworkError, PluginInstallError } from '../../core/errors.js';
13
- import { logger } from '../../utils/logger.js';
14
- export class NpmInstaller extends BaseInstaller {
15
- registry;
16
- constructor(options) {
17
- super();
18
- this.registry = options?.registryUrl || 'https://registry.npmjs.org';
19
- }
20
- async getPackageInfo(name) {
21
- const url = `${this.registry}/${encodeURIComponent(name).replace('%40', '@')}`;
22
- let response;
23
- try {
24
- response = await fetch(url);
25
- }
26
- catch (error) {
27
- throw new NetworkError(url, undefined, error instanceof Error ? error.message : '网络连接失败');
28
- }
29
- if (!response.ok) {
30
- if (response.status === 404) {
31
- throw new PluginInstallError(name, 'npm', `包 ${name} 在 npm registry 中未找到`);
32
- }
33
- throw new NetworkError(url, response.status);
34
- }
35
- return await response.json();
36
- }
37
- async getTarballUrl(name, version) {
38
- const info = await this.getPackageInfo(name);
39
- const targetVersion = version || info['dist-tags']?.latest;
40
- if (!targetVersion) {
41
- throw new PluginInstallError(name, 'npm', '未找到可用版本');
42
- }
43
- const versionInfo = info.versions?.[targetVersion];
44
- if (!versionInfo) {
45
- throw new PluginInstallError(name, 'npm', `版本 ${targetVersion} 不存在`);
46
- }
47
- return {
48
- url: versionInfo.dist.tarball,
49
- version: targetVersion,
50
- };
51
- }
52
- async downloadTarball(url, destPath) {
53
- let response;
54
- try {
55
- response = await fetch(url);
56
- }
57
- catch (error) {
58
- throw new NetworkError(url, undefined, error instanceof Error ? error.message : '下载失败');
59
- }
60
- if (!response.ok || !response.body) {
61
- throw new NetworkError(url, response.status, '下载 tarball 失败');
62
- }
63
- const fileStream = createWriteStream(destPath);
64
- // @ts-ignore - Node.js fetch body is a ReadableStream
65
- await pipeline(response.body, fileStream);
66
- }
67
- async install(identifier, destDir) {
68
- const { name, version } = identifier;
69
- logger.info(`从 npm registry 获取 ${name}...`);
70
- // 1. 获取 tarball URL
71
- const tarball = await this.getTarballUrl(name, version);
72
- // 2. 创建临时目录
73
- const tmpDir = await this.createTempDir('nws-npm-');
74
- const tarballPath = path.join(tmpDir, 'package.tgz');
75
- try {
76
- // 3. 下载
77
- logger.info(`下载 ${name}@${tarball.version}...`);
78
- await this.downloadTarball(tarball.url, tarballPath);
79
- // 4. 解压(npm tarball 有一层 package/ 包装)
80
- const extractPath = path.join(tmpDir, 'extracted');
81
- await this.extractTarball(tarballPath, extractPath, 1);
82
- // 5. 验证 config.yaml
83
- const configPath = path.join(extractPath, 'config.yaml');
84
- if (!await fs.pathExists(configPath)) {
85
- throw new PluginInstallError(name, 'npm', `包 ${name} 中未找到 config.yaml`);
86
- }
87
- // 6. 移动到目标
88
- const pluginName = path.basename(name);
89
- const pluginDir = path.join(destDir, pluginName);
90
- await fs.ensureDir(path.dirname(pluginDir));
91
- await fs.move(extractPath, pluginDir, { overwrite: true });
92
- return { version: tarball.version, pluginPath: pluginDir };
93
- }
94
- finally {
95
- await this.cleanup(tmpDir);
96
- }
97
- }
98
- }
99
- //# sourceMappingURL=npm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../src/plugins/installers/npm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,MAAM,OAAO,YAAa,SAAQ,aAAa;IACrC,QAAQ,CAAS;IAEzB,YAAY,OAA0B;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,WAAW,IAAI,4BAA4B,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,IAAY;QAC/B,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;QAE/E,IAAI,QAAkB,CAAC;QACvB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9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,EAAE,WAAW,CAAC,CAAC;YAErD,qCAAqC;YACrC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACnD,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;YAEvD,oBAAoB;YACpB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YACzD,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBACrC,MAAM,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,mBAAmB,CAAC,CAAC;YAC1E,CAAC;YAED,WAAW;YACX,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACvC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACjD,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;YAC5C,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAE3D,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;QAC7D,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
@@ -1,77 +0,0 @@
1
- /**
2
- * 插件管理器
3
- *
4
- * 协调层:安装器选择 → 安装 → 验证 → 注册 → 注入。
5
- * 注册表管理已拆到 registry.ts,安装器已拆到 installers/。
6
- *
7
- * Bug 修复:
8
- * - removePlugin() 现在会清理注入的命令文件
9
- * - installPlugin() 统一更新注册表
10
- */
11
- import { PluginConfig } from './types.js';
12
- import { PluginRegistry } from './registry.js';
13
- export declare class PluginManager {
14
- private projectRoot;
15
- private pluginsDir;
16
- private commandsDir;
17
- private skillsDir;
18
- private registry;
19
- private npmInstaller;
20
- private githubInstaller;
21
- private localInstaller;
22
- constructor(projectRoot: string);
23
- /**
24
- * 扫描并加载所有插件
25
- */
26
- loadPlugins(): Promise<void>;
27
- /**
28
- * 扫描插件目录
29
- */
30
- private scanPlugins;
31
- /**
32
- * 加载单个插件(注入 commands 和 skills)
33
- */
34
- private loadPlugin;
35
- /**
36
- * 注入插件命令
37
- */
38
- private injectCommands;
39
- /**
40
- * 注入插件 Skills
41
- */
42
- private injectSkills;
43
- /**
44
- * 清理插件注入的命令文件
45
- */
46
- private cleanupCommands;
47
- /**
48
- * 列出所有已安装的插件
49
- */
50
- listPlugins(): Promise<PluginConfig[]>;
51
- /**
52
- * 从本地路径安装插件(内置插件)
53
- */
54
- installPlugin(pluginName: string, source?: string): Promise<void>;
55
- /**
56
- * 移除插件
57
- * 修复: 现在会读取配置并清理注入的命令文件
58
- */
59
- removePlugin(pluginName: string): Promise<void>;
60
- /**
61
- * 检查插件是否已安装
62
- */
63
- isPluginInstalled(name: string): Promise<boolean>;
64
- /**
65
- * 远程安装插件(支持 npm/GitHub/local)
66
- */
67
- installRemotePlugin(input: string): Promise<void>;
68
- /**
69
- * 更新插件
70
- */
71
- updatePlugin(name: string): Promise<void>;
72
- /**
73
- * 获取已安装插件的注册表信息
74
- */
75
- getRegistry(): Promise<PluginRegistry>;
76
- }
77
- //# sourceMappingURL=manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/plugins/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC;AAM1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAS/C,qBAAa,aAAa;IACxB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,cAAc,CAAiB;gBAE3B,WAAW,EAAE,MAAM;IAY/B;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBlC;;OAEG;YACW,WAAW;IAyBzB;;OAEG;YACW,UAAU;IA8BxB;;OAEG;YACW,cAAc;IAkB5B;;OAEG;YACW,YAAY;IAkB1B;;OAEG;YACW,eAAe;IAc7B;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAe5C;;OAEG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCvE;;;OAGG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCrD;;OAEG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvD;;OAEG;IACG,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8EvD;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB/C;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC;CAI7C"}
@@ -1,349 +0,0 @@
1
- /**
2
- * 插件管理器
3
- *
4
- * 协调层:安装器选择 → 安装 → 验证 → 注册 → 注入。
5
- * 注册表管理已拆到 registry.ts,安装器已拆到 installers/。
6
- *
7
- * Bug 修复:
8
- * - removePlugin() 现在会清理注入的命令文件
9
- * - installPlugin() 统一更新注册表
10
- */
11
- import fs from 'fs-extra';
12
- import path from 'path';
13
- import { logger } from '../utils/logger.js';
14
- import { parsePluginIdentifier } from './identifier.js';
15
- import { NpmInstaller } from './installers/npm.js';
16
- import { GitHubInstaller } from './installers/github.js';
17
- import { LocalInstaller } from './installers/local.js';
18
- import { PluginValidator } from './validator.js';
19
- import { PluginRegistry } from './registry.js';
20
- import { getProjectPaths } from '../core/config.js';
21
- import { PluginNotFoundError, PluginAlreadyInstalledError, PluginValidationError, PluginInstallError, } from '../core/errors.js';
22
- export class PluginManager {
23
- projectRoot;
24
- pluginsDir;
25
- commandsDir;
26
- skillsDir;
27
- registry;
28
- npmInstaller;
29
- githubInstaller;
30
- localInstaller;
31
- constructor(projectRoot) {
32
- this.projectRoot = projectRoot;
33
- const paths = getProjectPaths(projectRoot);
34
- this.pluginsDir = paths.plugins;
35
- this.commandsDir = paths.commands;
36
- this.skillsDir = paths.skills;
37
- this.registry = new PluginRegistry(paths.pluginRegistry);
38
- this.npmInstaller = new NpmInstaller();
39
- this.githubInstaller = new GitHubInstaller();
40
- this.localInstaller = new LocalInstaller();
41
- }
42
- /**
43
- * 扫描并加载所有插件
44
- */
45
- async loadPlugins() {
46
- try {
47
- await fs.ensureDir(this.pluginsDir);
48
- const plugins = await this.scanPlugins();
49
- if (plugins.length === 0) {
50
- logger.info('没有发现插件');
51
- return;
52
- }
53
- logger.info(`发现 ${plugins.length} 个插件`);
54
- for (const pluginName of plugins) {
55
- await this.loadPlugin(pluginName);
56
- }
57
- logger.success('所有插件加载完成');
58
- }
59
- catch (error) {
60
- logger.error('加载插件失败:', error);
61
- }
62
- }
63
- /**
64
- * 扫描插件目录
65
- */
66
- async scanPlugins() {
67
- try {
68
- if (!await fs.pathExists(this.pluginsDir)) {
69
- return [];
70
- }
71
- const entries = await fs.readdir(this.pluginsDir, { withFileTypes: true });
72
- const plugins = [];
73
- for (const entry of entries) {
74
- if (entry.isDirectory()) {
75
- const configPath = path.join(this.pluginsDir, entry.name, 'config.yaml');
76
- if (await fs.pathExists(configPath)) {
77
- plugins.push(entry.name);
78
- }
79
- }
80
- }
81
- return plugins;
82
- }
83
- catch (error) {
84
- logger.error('扫描插件目录失败:', error);
85
- return [];
86
- }
87
- }
88
- /**
89
- * 加载单个插件(注入 commands 和 skills)
90
- */
91
- async loadPlugin(pluginName) {
92
- try {
93
- logger.info(`加载插件: ${pluginName}`);
94
- const configPath = path.join(this.pluginsDir, pluginName, 'config.yaml');
95
- const config = await PluginValidator.parseConfig(configPath);
96
- if (!config) {
97
- logger.warn(`插件 ${pluginName} 配置无效`);
98
- return;
99
- }
100
- if (config.commands && config.commands.length > 0) {
101
- await this.injectCommands(pluginName, config.commands);
102
- }
103
- if (config.skills && config.skills.length > 0) {
104
- await this.injectSkills(pluginName, config.skills);
105
- }
106
- logger.success(`插件 ${pluginName} 加载成功`);
107
- if (config.installation?.message) {
108
- console.log(config.installation.message);
109
- }
110
- }
111
- catch (error) {
112
- logger.error(`加载插件 ${pluginName} 失败:`, error);
113
- }
114
- }
115
- /**
116
- * 注入插件命令
117
- */
118
- async injectCommands(pluginName, commands) {
119
- for (const cmd of commands) {
120
- try {
121
- const sourcePath = path.join(this.pluginsDir, pluginName, cmd.file);
122
- const destPath = path.join(this.commandsDir, `${cmd.id}.md`);
123
- await fs.ensureDir(this.commandsDir);
124
- await fs.copy(sourcePath, destPath);
125
- logger.debug(`注入命令: /${cmd.id}`);
126
- }
127
- catch (error) {
128
- logger.error(`注入命令 ${cmd.id} 失败:`, error);
129
- }
130
- }
131
- }
132
- /**
133
- * 注入插件 Skills
134
- */
135
- async injectSkills(pluginName, skills) {
136
- for (const skill of skills) {
137
- try {
138
- const sourcePath = path.join(this.pluginsDir, pluginName, skill.file);
139
- const destPath = path.join(this.skillsDir, pluginName, path.basename(skill.file));
140
- await fs.ensureDir(path.dirname(destPath));
141
- await fs.copy(sourcePath, destPath);
142
- logger.debug(`注入 Skill: ${skill.id}`);
143
- }
144
- catch (error) {
145
- logger.error(`注入 Skill ${skill.id} 失败:`, error);
146
- }
147
- }
148
- }
149
- /**
150
- * 清理插件注入的命令文件
151
- */
152
- async cleanupCommands(commands) {
153
- for (const cmd of commands) {
154
- try {
155
- const cmdPath = path.join(this.commandsDir, `${cmd.id}.md`);
156
- if (await fs.pathExists(cmdPath)) {
157
- await fs.remove(cmdPath);
158
- logger.debug(`清理命令: /${cmd.id}`);
159
- }
160
- }
161
- catch (error) {
162
- logger.error(`清理命令 ${cmd.id} 失败:`, error);
163
- }
164
- }
165
- }
166
- /**
167
- * 列出所有已安装的插件
168
- */
169
- async listPlugins() {
170
- const plugins = await this.scanPlugins();
171
- const configs = [];
172
- for (const pluginName of plugins) {
173
- const configPath = path.join(this.pluginsDir, pluginName, 'config.yaml');
174
- const config = await PluginValidator.parseConfig(configPath);
175
- if (config) {
176
- configs.push(config);
177
- }
178
- }
179
- return configs;
180
- }
181
- /**
182
- * 从本地路径安装插件(内置插件)
183
- */
184
- async installPlugin(pluginName, source) {
185
- try {
186
- logger.info(`安装插件: ${pluginName}`);
187
- if (source) {
188
- const result = await this.localInstaller.installFromPath(source, pluginName, this.pluginsDir);
189
- // 更新注册表
190
- await this.registry.load();
191
- const configPath = path.join(this.pluginsDir, pluginName, 'config.yaml');
192
- const config = await PluginValidator.parseConfig(configPath);
193
- this.registry.add({
194
- name: pluginName,
195
- version: result.version,
196
- source: 'builtin',
197
- installedAt: new Date().toISOString(),
198
- path: `plugins/${pluginName}`,
199
- commands: config?.commands?.map(c => c.id),
200
- skills: config?.skills?.map(s => s.id),
201
- });
202
- await this.registry.save();
203
- }
204
- else {
205
- logger.warn('未指定安装源,请使用 installRemotePlugin() 进行远程安装');
206
- return;
207
- }
208
- await this.loadPlugin(pluginName);
209
- logger.success(`插件 ${pluginName} 安装成功`);
210
- }
211
- catch (error) {
212
- logger.error(`安装插件 ${pluginName} 失败:`, error);
213
- throw error;
214
- }
215
- }
216
- /**
217
- * 移除插件
218
- * 修复: 现在会读取配置并清理注入的命令文件
219
- */
220
- async removePlugin(pluginName) {
221
- try {
222
- logger.info(`移除插件: ${pluginName}`);
223
- const pluginPath = path.join(this.pluginsDir, pluginName);
224
- // 先读取配置,获取需要清理的命令和 Skills
225
- const configPath = path.join(pluginPath, 'config.yaml');
226
- const config = await PluginValidator.parseConfig(configPath);
227
- // 清理注入的命令文件
228
- if (config?.commands && config.commands.length > 0) {
229
- await this.cleanupCommands(config.commands);
230
- }
231
- // 清理注入的 Skills
232
- const pluginSkillsDir = path.join(this.skillsDir, pluginName);
233
- if (await fs.pathExists(pluginSkillsDir)) {
234
- await fs.remove(pluginSkillsDir);
235
- }
236
- // 删除插件目录
237
- await fs.remove(pluginPath);
238
- // 更新注册表
239
- await this.registry.load();
240
- this.registry.remove(pluginName);
241
- await this.registry.save();
242
- logger.success(`插件 ${pluginName} 移除成功`);
243
- }
244
- catch (error) {
245
- logger.error(`移除插件 ${pluginName} 失败:`, error);
246
- throw error;
247
- }
248
- }
249
- /**
250
- * 检查插件是否已安装
251
- */
252
- async isPluginInstalled(name) {
253
- await this.registry.load();
254
- return this.registry.has(name);
255
- }
256
- /**
257
- * 远程安装插件(支持 npm/GitHub/local)
258
- */
259
- async installRemotePlugin(input) {
260
- const identifier = parsePluginIdentifier(input);
261
- // 检查是否已安装
262
- if (await this.isPluginInstalled(identifier.name)) {
263
- throw new PluginAlreadyInstalledError(identifier.name);
264
- }
265
- logger.info(`安装插件: ${input}`);
266
- let installedVersion;
267
- let pluginPath;
268
- // 根据类型选择安装器
269
- switch (identifier.type) {
270
- case 'npm': {
271
- const result = await this.npmInstaller.install(identifier, this.pluginsDir);
272
- installedVersion = result.version;
273
- pluginPath = result.pluginPath;
274
- break;
275
- }
276
- case 'github': {
277
- const result = await this.githubInstaller.install(identifier, this.pluginsDir);
278
- installedVersion = result.version;
279
- pluginPath = result.pluginPath;
280
- break;
281
- }
282
- case 'local': {
283
- const result = await this.localInstaller.install(identifier, this.pluginsDir);
284
- installedVersion = result.version;
285
- pluginPath = result.pluginPath;
286
- break;
287
- }
288
- default:
289
- throw new PluginInstallError(identifier.name, identifier.type, '不支持的插件来源');
290
- }
291
- // 验证插件
292
- const validation = await PluginValidator.validate(pluginPath);
293
- if (!validation.valid) {
294
- await fs.remove(pluginPath);
295
- throw new PluginValidationError(identifier.name, validation.errors, validation.warnings);
296
- }
297
- if (validation.warnings.length > 0) {
298
- for (const warning of validation.warnings) {
299
- logger.warn(warning);
300
- }
301
- }
302
- // 加载插件(注入 commands 和 skills)
303
- await this.loadPlugin(identifier.name);
304
- // 读取配置获取 commands/skills 信息
305
- const configPath = path.join(pluginPath, 'config.yaml');
306
- const config = await PluginValidator.parseConfig(configPath);
307
- // 更新注册表
308
- await this.registry.load();
309
- const metadata = {
310
- name: identifier.name,
311
- version: installedVersion,
312
- source: identifier.type,
313
- installedAt: new Date().toISOString(),
314
- path: `plugins/${identifier.name}`,
315
- registry: identifier.type === 'npm' ? 'https://registry.npmjs.org' : undefined,
316
- repository: identifier.repository,
317
- commands: config?.commands?.map(c => c.id),
318
- skills: config?.skills?.map(s => s.id),
319
- };
320
- this.registry.add(metadata);
321
- await this.registry.save();
322
- logger.success(`插件 ${identifier.name}@${installedVersion} 安装成功`);
323
- }
324
- /**
325
- * 更新插件
326
- */
327
- async updatePlugin(name) {
328
- await this.registry.load();
329
- const plugin = this.registry.find(name);
330
- if (!plugin) {
331
- throw new PluginNotFoundError(name);
332
- }
333
- // 移除旧版本
334
- await this.removePlugin(name);
335
- // 重新安装
336
- const input = plugin.source === 'npm'
337
- ? plugin.name
338
- : plugin.repository || plugin.name;
339
- await this.installRemotePlugin(input);
340
- }
341
- /**
342
- * 获取已安装插件的注册表信息
343
- */
344
- async getRegistry() {
345
- await this.registry.load();
346
- return this.registry;
347
- }
348
- }
349
- //# sourceMappingURL=manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/plugins/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAA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,OAAO,CAAC,MAAM,UAAU,CAAC,IAAI,IAAI,gBAAgB,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAExC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QAED,QAAQ;QACR,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAE9B,OAAO;QACP,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,KAAK,KAAK;YACnC,CAAC,CAAC,MAAM,CAAC,IAAI;YACb,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC;QAErC,MAAM,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
@@ -1,48 +0,0 @@
1
- /**
2
- * 插件注册表管理
3
- *
4
- * 独立管理 .specify/plugins.json 的读写,
5
- * 从 manager.ts 中拆出以实现职责单一。
6
- */
7
- import { PluginRegistryData, PluginMetadata } from './types.js';
8
- export declare class PluginRegistry {
9
- private registryPath;
10
- private data;
11
- private loaded;
12
- constructor(registryPath: string);
13
- /**
14
- * 从磁盘加载注册表
15
- */
16
- load(): Promise<void>;
17
- /**
18
- * 保存注册表到磁盘
19
- */
20
- save(): Promise<void>;
21
- /**
22
- * 添加插件元数据
23
- */
24
- add(metadata: PluginMetadata): void;
25
- /**
26
- * 移除插件
27
- * 返回 true 表示成功移除,false 表示未找到
28
- */
29
- remove(name: string): boolean;
30
- /**
31
- * 查找插件
32
- */
33
- find(name: string): PluginMetadata | undefined;
34
- /**
35
- * 检查插件是否存在
36
- */
37
- has(name: string): boolean;
38
- /**
39
- * 列出所有插件
40
- */
41
- list(): PluginMetadata[];
42
- /**
43
- * 获取原始注册表数据
44
- */
45
- getData(): PluginRegistryData;
46
- private ensureLoaded;
47
- }
48
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQhE,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAkB;gBAEpB,YAAY,EAAE,MAAM;IAKhC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB3B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAOnC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO7B;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAK9C;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK1B;;OAEG;IACH,IAAI,IAAI,cAAc,EAAE;IAKxB;;OAEG;IACH,OAAO,IAAI,kBAAkB;IAK7B,OAAO,CAAC,YAAY;CAKrB"}