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,135 +0,0 @@
1
- /**
2
- * plugin 系列命令 - 插件管理
3
- */
4
- import chalk from 'chalk';
5
- import path from 'path';
6
- import fs from 'fs-extra';
7
- import ora from 'ora';
8
- import { PluginManager } from '../plugins/manager.js';
9
- import { ensureProjectRoot, getProjectInfo } from '../utils/project.js';
10
- import { getPackageRoot } from '../core/config.js';
11
- import { ProjectNotFoundError } from '../core/errors.js';
12
- export function registerPluginCommands(program) {
13
- // plugin 帮助命令
14
- program
15
- .command('plugin')
16
- .description('插件管理 (使用 plugin:list, plugin:add, plugin:remove)')
17
- .action(() => {
18
- console.log(chalk.cyan('\n📦 插件管理命令:\n'));
19
- console.log(' novelws plugin:list - 列出已安装的插件');
20
- console.log(' novelws plugin:add <name> - 安装插件');
21
- console.log(' novelws plugin:remove <name> - 移除插件');
22
- console.log('\n' + chalk.gray('可用插件:'));
23
- console.log(' authentic-voice - 真实人声写作插件');
24
- });
25
- // plugin:list
26
- program
27
- .command('plugin:list')
28
- .description('列出已安装的插件')
29
- .action(async () => {
30
- try {
31
- const projectPath = await ensureProjectRoot();
32
- const projectInfo = await getProjectInfo(projectPath);
33
- if (!projectInfo) {
34
- console.log(chalk.red('❌ 无法读取项目信息'));
35
- process.exit(1);
36
- }
37
- const pluginManager = new PluginManager(projectPath);
38
- const plugins = await pluginManager.listPlugins();
39
- console.log(chalk.cyan('\n📦 已安装的插件\n'));
40
- console.log(chalk.gray(`项目: ${path.basename(projectPath)}\n`));
41
- if (plugins.length === 0) {
42
- console.log(chalk.yellow('暂无插件'));
43
- console.log(chalk.gray('\n使用 "novelws plugin:add <name>" 安装插件'));
44
- console.log(chalk.gray('可用插件: authentic-voice\n'));
45
- return;
46
- }
47
- for (const plugin of plugins) {
48
- console.log(chalk.yellow(` ${plugin.name}`) + ` (v${plugin.version})`);
49
- console.log(chalk.gray(` ${plugin.description}`));
50
- if (plugin.commands && plugin.commands.length > 0) {
51
- console.log(chalk.gray(` 命令: ${plugin.commands.map(c => `/${c.id}`).join(', ')}`));
52
- }
53
- if (plugin.skills && plugin.skills.length > 0) {
54
- console.log(chalk.gray(` Skills: ${plugin.skills.map(s => s.id).join(', ')}`));
55
- }
56
- console.log('');
57
- }
58
- }
59
- catch (error) {
60
- if (error instanceof ProjectNotFoundError) {
61
- console.log(chalk.red(`\n❌ ${error.message}`));
62
- console.log(chalk.gray(' 请在项目根目录运行此命令\n'));
63
- process.exit(1);
64
- }
65
- console.error(chalk.red('❌ 列出插件失败:'), error);
66
- process.exit(1);
67
- }
68
- });
69
- // plugin:add
70
- program
71
- .command('plugin:add <name>')
72
- .description('安装插件')
73
- .action(async (name) => {
74
- try {
75
- const projectPath = await ensureProjectRoot();
76
- const projectInfo = await getProjectInfo(projectPath);
77
- if (!projectInfo) {
78
- console.log(chalk.red('❌ 无法读取项目信息'));
79
- process.exit(1);
80
- }
81
- console.log(chalk.cyan('\n📦 NovelWrite 插件安装\n'));
82
- console.log(chalk.gray(`项目版本: ${projectInfo.version}\n`));
83
- const packageRoot = getPackageRoot();
84
- const builtinPluginPath = path.join(packageRoot, 'plugins', name);
85
- if (!await fs.pathExists(builtinPluginPath)) {
86
- console.log(chalk.red(`❌ 插件 ${name} 未找到\n`));
87
- console.log(chalk.gray('可用插件:'));
88
- console.log(chalk.gray(' - authentic-voice (真实人声插件)'));
89
- process.exit(1);
90
- }
91
- const spinner = ora('正在安装插件...').start();
92
- const pluginManager = new PluginManager(projectPath);
93
- await pluginManager.installPlugin(name, builtinPluginPath);
94
- spinner.succeed(chalk.green('插件安装成功!\n'));
95
- }
96
- catch (error) {
97
- if (error instanceof ProjectNotFoundError) {
98
- console.log(chalk.red(`\n❌ ${error.message}`));
99
- console.log(chalk.gray(' 请在项目根目录运行此命令\n'));
100
- process.exit(1);
101
- }
102
- console.log(chalk.red('\n❌ 安装插件失败'));
103
- console.error(chalk.gray(error.message || error));
104
- console.log('');
105
- process.exit(1);
106
- }
107
- });
108
- // plugin:remove
109
- program
110
- .command('plugin:remove <name>')
111
- .description('移除插件')
112
- .action(async (name) => {
113
- try {
114
- const projectPath = await ensureProjectRoot();
115
- const pluginManager = new PluginManager(projectPath);
116
- console.log(chalk.cyan('\n📦 NovelWrite 插件移除\n'));
117
- console.log(chalk.gray(`准备移除插件: ${name}\n`));
118
- const spinner = ora('正在移除插件...').start();
119
- await pluginManager.removePlugin(name);
120
- spinner.succeed(chalk.green('插件移除成功!\n'));
121
- }
122
- catch (error) {
123
- if (error instanceof ProjectNotFoundError) {
124
- console.log(chalk.red(`\n❌ ${error.message}`));
125
- console.log(chalk.gray(' 请在项目根目录运行此命令\n'));
126
- process.exit(1);
127
- }
128
- console.log(chalk.red('\n❌ 移除插件失败'));
129
- console.error(chalk.gray(error.message || error));
130
- console.log('');
131
- process.exit(1);
132
- }
133
- });
134
- }
135
- //# sourceMappingURL=plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/commands/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,cAAc;IACd,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,kDAAkD,CAAC;SAC/D,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEL,cAAc;IACd,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,UAAU,CAAC;SACvB,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,iB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AAG,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;YACzC,MAAM,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACvC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;gBAC1C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;gBAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * 插件标识符解析
3
- *
4
- * 支持格式:
5
- * - npm scoped: @scope/name 或 @scope/name@version
6
- * - npm: name 或 name@version(支持版本范围如 ^1.0.0、~1.2.0)
7
- * - GitHub URL: https://github.com/user/repo
8
- * - GitHub shorthand: user/repo 或 user/repo@ref
9
- * - Local tarball: ./path.tgz 或 ./path.tar.gz
10
- */
11
- import { PluginIdentifier } from './types.js';
12
- export declare function parsePluginIdentifier(input: string): PluginIdentifier;
13
- //# sourceMappingURL=identifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../src/plugins/identifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAU9C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CA6DrE"}
@@ -1,72 +0,0 @@
1
- /**
2
- * 插件标识符解析
3
- *
4
- * 支持格式:
5
- * - npm scoped: @scope/name 或 @scope/name@version
6
- * - npm: name 或 name@version(支持版本范围如 ^1.0.0、~1.2.0)
7
- * - GitHub URL: https://github.com/user/repo
8
- * - GitHub shorthand: user/repo 或 user/repo@ref
9
- * - Local tarball: ./path.tgz 或 ./path.tar.gz
10
- */
11
- import path from 'path';
12
- const SUPPORTED_FORMATS = [
13
- 'npm 包名 (如 my-plugin 或 my-plugin@1.0.0)',
14
- 'npm scoped 包名 (如 @scope/my-plugin)',
15
- 'GitHub 仓库 (如 user/repo 或 user/repo@tag)',
16
- 'GitHub URL (如 https://github.com/user/repo)',
17
- '本地 tarball (如 ./plugin.tgz)',
18
- ].join('\n - ');
19
- export function parsePluginIdentifier(input) {
20
- const trimmed = input.trim();
21
- if (!trimmed) {
22
- throw new Error(`插件标识符不能为空。支持的格式:\n - ${SUPPORTED_FORMATS}`);
23
- }
24
- // npm scoped package: @scope/name 或 @scope/name@version
25
- const scopedNpmMatch = trimmed.match(/^(@[\w-]+\/[\w-]+)(?:@(.+))?$/);
26
- if (scopedNpmMatch) {
27
- return {
28
- type: 'npm',
29
- name: scopedNpmMatch[1],
30
- version: scopedNpmMatch[2],
31
- scope: scopedNpmMatch[1].split('/')[0],
32
- };
33
- }
34
- // GitHub URL: 严格匹配 https://github.com/user/repo
35
- const githubUrlMatch = trimmed.match(/^https?:\/\/github\.com\/([\w.-]+)\/([\w.-]+?)(?:\.git)?(?:\/.*)?$/);
36
- if (githubUrlMatch) {
37
- return {
38
- type: 'github',
39
- repository: `${githubUrlMatch[1]}/${githubUrlMatch[2]}`,
40
- name: githubUrlMatch[2],
41
- };
42
- }
43
- // Local tarball: *.tgz 或 *.tar.gz(在 GitHub shorthand 之前检查)
44
- if (trimmed.endsWith('.tgz') || trimmed.endsWith('.tar.gz')) {
45
- const ext = trimmed.endsWith('.tar.gz') ? '.tar.gz' : '.tgz';
46
- return {
47
- type: 'local',
48
- name: path.basename(trimmed, ext),
49
- };
50
- }
51
- // GitHub shorthand: user/repo 或 user/repo@ref
52
- const githubMatch = trimmed.match(/^([\w.-]+)\/([\w.-]+)(?:@([\w./-]+))?$/);
53
- if (githubMatch) {
54
- return {
55
- type: 'github',
56
- repository: `${githubMatch[1]}/${githubMatch[2]}`,
57
- name: githubMatch[2],
58
- version: githubMatch[3] || 'main',
59
- };
60
- }
61
- // npm package: name 或 name@version(支持版本范围如 ^1.0.0、~1.2.0、>=1.0.0)
62
- const npmMatch = trimmed.match(/^([\w-]+)(?:@(.+))?$/);
63
- if (npmMatch) {
64
- return {
65
- type: 'npm',
66
- name: npmMatch[1],
67
- version: npmMatch[2],
68
- };
69
- }
70
- throw new Error(`无法识别的插件格式: "${trimmed}"。支持的格式:\n - ${SUPPORTED_FORMATS}`);
71
- }
72
- //# sourceMappingURL=identifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../src/plugins/identifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,iBAAiB,GAAG;IACxB,wCAAwC;IACxC,oCAAoC;IACpC,yCAAyC;IACzC,6CAA6C;IAC7C,6BAA6B;CAC9B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAEjB,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,iBAAiB,EAAE,CAAC,CAAC;IAChE,CA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AAC,EAAE;YACjD,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;YACpB,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,MAAM;SAClC,CAAC;IACJ,CAAC;IAED,kEAAkE;IAClE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACvD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;YACjB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;SACrB,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,KAAK,CACb,eAAe,OAAO,iBAAiB,iBAAiB,EAAE,CAC3D,CAAC;AACJ,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * 安装器抽象基类
3
- *
4
- * 提取 npm/github/local 安装器的公共逻辑:
5
- * 临时目录管理、tar 解压。
6
- */
7
- import { PluginIdentifier, InstallResult } from '../types.js';
8
- export declare abstract class BaseInstaller {
9
- /**
10
- * 解压 tarball 到指定目录
11
- */
12
- protected extractTarball(tarballPath: string, extractPath: string, stripComponents?: number): Promise<void>;
13
- /**
14
- * 创建临时工作目录
15
- */
16
- protected createTempDir(prefix?: string): Promise<string>;
17
- /**
18
- * 清理临时目录
19
- */
20
- protected cleanup(tempDir: string): Promise<void>;
21
- /**
22
- * 安装插件到目标目录
23
- * 子类必须实现此方法
24
- */
25
- abstract install(identifier: PluginIdentifier, destDir: string): Promise<InstallResult>;
26
- }
27
- //# sourceMappingURL=base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/plugins/installers/base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG9D,8BAAsB,aAAa;IACjC;;OAEG;cACa,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAMhB;;OAEG;cACa,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/D;;OAEG;cACa,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CACxF"}
@@ -1,30 +0,0 @@
1
- /**
2
- * 安装器抽象基类
3
- *
4
- * 提取 npm/github/local 安装器的公共逻辑:
5
- * 临时目录管理、tar 解压。
6
- */
7
- import { extractTarball, createTempDir, cleanupTempDir } from '../../core/platform.js';
8
- export class BaseInstaller {
9
- /**
10
- * 解压 tarball 到指定目录
11
- */
12
- async extractTarball(tarballPath, extractPath, stripComponents) {
13
- await extractTarball(tarballPath, extractPath, {
14
- stripComponents: stripComponents ?? 0,
15
- });
16
- }
17
- /**
18
- * 创建临时工作目录
19
- */
20
- async createTempDir(prefix) {
21
- return createTempDir(prefix);
22
- }
23
- /**
24
- * 清理临时目录
25
- */
26
- async cleanup(tempDir) {
27
- await cleanupTempDir(tempDir);
28
- }
29
- }
30
- //# sourceMappingURL=base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/plugins/installers/base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEvF,MAAM,OAAgB,aAAa;IACjC;;OAEG;IACO,KAAK,CAAC,cAAc,CAC5B,WAAmB,EACnB,WAAmB,EACnB,eAAwB;QAExB,MAAM,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE;YAC7C,eAAe,EAAE,eAAe,IAAI,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,aAAa,CAAC,MAAe;QAC3C,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,OAAO,CAAC,OAAe;QACrC,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;CAOF"}
@@ -1,22 +0,0 @@
1
- /**
2
- * GitHub 安装器
3
- *
4
- * 从 GitHub 仓库下载并安装插件。
5
- * 继承 BaseInstaller,复用公共 tar 解压逻辑。
6
- * 支持 GITHUB_TOKEN 环境变量用于私有仓库。
7
- */
8
- import { PluginIdentifier, InstallResult, InstallerOptions } from '../types.js';
9
- import { BaseInstaller } from './base.js';
10
- export declare class GitHubInstaller extends BaseInstaller {
11
- private token?;
12
- constructor(options?: InstallerOptions);
13
- private getHeaders;
14
- getRepoInfo(repository: string): Promise<any>;
15
- downloadArchive(repository: string, ref: string, destPath: string): Promise<void>;
16
- /**
17
- * 在目录中查找 config.yaml,限制搜索深度
18
- */
19
- private findConfigYaml;
20
- install(identifier: PluginIdentifier, destDir: string): Promise<InstallResult>;
21
- }
22
- //# sourceMappingURL=github.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/plugins/installers/github.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAO1C,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,KAAK,CAAC,CAAS;gBAEX,OAAO,CAAC,EAAE,gBAAgB;IAKtC,OAAO,CAAC,UAAU;IAWZ,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB7C,eAAe,CACnB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAsBhB;;OAEG;YACW,cAAc;IAyBtB,OAAO,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAkDrF"}
@@ -1,133 +0,0 @@
1
- /**
2
- * GitHub 安装器
3
- *
4
- * 从 GitHub 仓库下载并安装插件。
5
- * 继承 BaseInstaller,复用公共 tar 解压逻辑。
6
- * 支持 GITHUB_TOKEN 环境变量用于私有仓库。
7
- */
8
- import fs from 'fs-extra';
9
- import path from 'path';
10
- import { pipeline } from 'stream/promises';
11
- import { createWriteStream } from 'fs';
12
- import { BaseInstaller } from './base.js';
13
- import { NetworkError, PluginInstallError } from '../../core/errors.js';
14
- import { logger } from '../../utils/logger.js';
15
- /** config.yaml 搜索最大深度 */
16
- const MAX_SEARCH_DEPTH = 3;
17
- export class GitHubInstaller extends BaseInstaller {
18
- token;
19
- constructor(options) {
20
- super();
21
- this.token = options?.githubToken || process.env.GITHUB_TOKEN;
22
- }
23
- getHeaders() {
24
- const headers = {
25
- 'User-Agent': 'novel-writer-skills',
26
- 'Accept': 'application/vnd.github.v3+json',
27
- };
28
- if (this.token) {
29
- headers['Authorization'] = `Bearer ${this.token}`;
30
- }
31
- return headers;
32
- }
33
- async getRepoInfo(repository) {
34
- const url = `https://api.github.com/repos/${repository}`;
35
- let response;
36
- try {
37
- response = await fetch(url, { headers: this.getHeaders() });
38
- }
39
- catch (error) {
40
- throw new NetworkError(url, undefined, error instanceof Error ? error.message : '网络连接失败');
41
- }
42
- if (!response.ok) {
43
- if (response.status === 404) {
44
- throw new PluginInstallError(repository, 'github', `仓库 ${repository} 在 GitHub 上未找到`);
45
- }
46
- throw new NetworkError(url, response.status);
47
- }
48
- return await response.json();
49
- }
50
- async downloadArchive(repository, ref, destPath) {
51
- const url = `https://api.github.com/repos/${repository}/tarball/${ref}`;
52
- let response;
53
- try {
54
- response = await fetch(url, {
55
- headers: { ...this.getHeaders(), 'Accept': '*/*' },
56
- redirect: 'follow',
57
- });
58
- }
59
- catch (error) {
60
- throw new NetworkError(url, undefined, error instanceof Error ? error.message : '下载失败');
61
- }
62
- if (!response.ok || !response.body) {
63
- throw new NetworkError(url, response.status, `从 GitHub 下载失败: ${repository}@${ref}`);
64
- }
65
- const fileStream = createWriteStream(destPath);
66
- // @ts-ignore - Node.js fetch body is a ReadableStream
67
- await pipeline(response.body, fileStream);
68
- }
69
- /**
70
- * 在目录中查找 config.yaml,限制搜索深度
71
- */
72
- async findConfigYaml(dir, depth = 0) {
73
- if (depth > MAX_SEARCH_DEPTH) {
74
- return null;
75
- }
76
- const files = await fs.readdir(dir, { withFileTypes: true });
77
- // 先检查当前目录
78
- for (const file of files) {
79
- if (file.isFile() && file.name === 'config.yaml') {
80
- return path.join(dir, file.name);
81
- }
82
- }
83
- // 再递归子目录
84
- for (const file of files) {
85
- if (file.isDirectory() && !file.name.startsWith('.') && file.name !== 'node_modules') {
86
- const result = await this.findConfigYaml(path.join(dir, file.name), depth + 1);
87
- if (result)
88
- return result;
89
- }
90
- }
91
- return null;
92
- }
93
- async install(identifier, destDir) {
94
- const { repository, version, name } = identifier;
95
- if (!repository) {
96
- throw new PluginInstallError(name, 'github', '缺少 GitHub 仓库地址');
97
- }
98
- logger.info(`从 GitHub 获取 ${repository}...`);
99
- // 1. 创建临时目录
100
- const tmpDir = await this.createTempDir('nws-gh-');
101
- const tarballPath = path.join(tmpDir, 'repo.tar.gz');
102
- try {
103
- // 2. 下载 tarball
104
- const ref = version || 'main';
105
- logger.info(`下载 ${repository}@${ref}...`);
106
- await this.downloadArchive(repository, ref, tarballPath);
107
- // 3. 解压(GitHub tarball 有一层 repo-name-sha/ 包装)
108
- const extractPath = path.join(tmpDir, 'extracted');
109
- await this.extractTarball(tarballPath, extractPath, 0);
110
- // 找到解压后的顶层目录
111
- const entries = await fs.readdir(extractPath, { withFileTypes: true });
112
- const topDir = entries.find(e => e.isDirectory());
113
- if (!topDir) {
114
- throw new PluginInstallError(name, 'github', '无效的归档结构');
115
- }
116
- const repoDir = path.join(extractPath, topDir.name);
117
- // 4. 查找 config.yaml
118
- const configPath = await this.findConfigYaml(repoDir);
119
- if (!configPath) {
120
- throw new PluginInstallError(name, 'github', `仓库 ${repository} 中未找到 config.yaml`);
121
- }
122
- const pluginRoot = path.dirname(configPath);
123
- // 5. 移动到目标
124
- const pluginDir = path.join(destDir, name);
125
- await fs.move(pluginRoot, pluginDir, { overwrite: true });
126
- return { version: ref, pluginPath: pluginDir };
127
- }
128
- finally {
129
- await this.cleanup(tmpDir);
130
- }
131
- }
132
- }
133
- //# sourceMappingURL=github.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/plugins/installers/github.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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,yBAAyB;AACzB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,OAAO,eAAgB,SAAQ,aAAa;IACxC,KAAK,CAAU;IAEvB,YAAY,OAA0B;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAChE,CAAC;IAEO,UAAU;QAChB,MAAM,OAAO,GAA2B;YACtC,YAAY,EAAE,qBAAqB;YACnC,QAAQ,EAAE,gCAAg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from '../types.js';
7
- import { BaseInstaller } from './base.js';
8
- export declare class LocalInstaller extends BaseInstaller {
9
- install(identifier: PluginIdentifier, destDir: string): Promise<InstallResult>;
10
- /**
11
- * 从本地路径直接复制插件
12
- */
13
- installFromPath(sourcePath: string, pluginName: string, destDir: string): Promise<InstallResult>;
14
- private installFromTarball;
15
- }
16
- //# sourceMappingURL=local.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/plugins/installers/local.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,qBAAa,cAAe,SAAQ,aAAa;IACzC,OAAO,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAWpF;;OAEG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;YA2BxF,kBAAkB;CA2BjC"}
@@ -1,69 +0,0 @@
1
- /**
2
- * 本地安装器
3
- *
4
- * 从本地路径复制插件到项目的 plugins 目录。
5
- */
6
- import fs from 'fs-extra';
7
- import path from 'path';
8
- import { BaseInstaller } from './base.js';
9
- import { PluginInstallError } from '../../core/errors.js';
10
- export class LocalInstaller extends BaseInstaller {
11
- async install(identifier, destDir) {
12
- const { name } = identifier;
13
- // 本地 tarball 安装
14
- if (name.endsWith('.tgz') || name.endsWith('.tar.gz')) {
15
- return this.installFromTarball(identifier, destDir);
16
- }
17
- throw new PluginInstallError(name, 'local', '不支持的本地安装格式');
18
- }
19
- /**
20
- * 从本地路径直接复制插件
21
- */
22
- async installFromPath(sourcePath, pluginName, destDir) {
23
- if (!await fs.pathExists(sourcePath)) {
24
- throw new PluginInstallError(pluginName, 'local', `源路径不存在: ${sourcePath}`);
25
- }
26
- const pluginDir = path.join(destDir, pluginName);
27
- await fs.copy(sourcePath, pluginDir, { overwrite: true });
28
- // 尝试读取版本号
29
- let version = '0.0.0';
30
- try {
31
- const yaml = (await import('js-yaml')).default;
32
- const configPath = path.join(pluginDir, 'config.yaml');
33
- if (await fs.pathExists(configPath)) {
34
- const content = await fs.readFile(configPath, 'utf-8');
35
- const config = yaml.load(content);
36
- if (config && typeof config.version === 'string') {
37
- version = config.version;
38
- }
39
- }
40
- }
41
- catch {
42
- // 读取版本失败不阻塞安装
43
- }
44
- return { version, pluginPath: pluginDir };
45
- }
46
- async installFromTarball(identifier, destDir) {
47
- const { name } = identifier;
48
- const tarballPath = path.resolve(name);
49
- if (!await fs.pathExists(tarballPath)) {
50
- throw new PluginInstallError(name, 'local', `文件不存在: ${tarballPath}`);
51
- }
52
- const tmpDir = await this.createTempDir('nws-local-');
53
- try {
54
- const extractPath = path.join(tmpDir, 'extracted');
55
- await this.extractTarball(tarballPath, extractPath, 1);
56
- // 确定插件名
57
- const ext = name.endsWith('.tar.gz') ? '.tar.gz' : '.tgz';
58
- const pluginName = path.basename(name, ext);
59
- const pluginDir = path.join(destDir, pluginName);
60
- await fs.ensureDir(path.dirname(pluginDir));
61
- await fs.move(extractPath, pluginDir, { overwrite: true });
62
- return { version: '0.0.0', pluginPath: pluginDir };
63
- }
64
- finally {
65
- await this.cleanup(tmpDir);
66
- }
67
- }
68
- }
69
- //# sourceMappingURL=local.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local.js","sourceRoot":"","sources":["../../../src/plugins/installers/local.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,OAAO,cAA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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,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;QACrD,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
@@ -1,20 +0,0 @@
1
- /**
2
- * NPM 安装器
3
- *
4
- * 从 npm registry 下载并安装插件。
5
- * 继承 BaseInstaller,复用公共 tar 解压逻辑。
6
- */
7
- import { PluginIdentifier, InstallResult, InstallerOptions } from '../types.js';
8
- import { BaseInstaller } from './base.js';
9
- export declare class NpmInstaller extends BaseInstaller {
10
- private registry;
11
- constructor(options?: InstallerOptions);
12
- getPackageInfo(name: string): Promise<any>;
13
- getTarballUrl(name: string, version?: string): Promise<{
14
- url: string;
15
- version: string;
16
- }>;
17
- downloadTarball(url: string, destPath: string): Promise<void>;
18
- install(identifier: PluginIdentifier, destDir: string): Promise<InstallResult>;
19
- }
20
- //# sourceMappingURL=npm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../../src/plugins/installers/npm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,qBAAa,YAAa,SAAQ,aAAa;IAC7C,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,CAAC,EAAE,gBAAgB;IAKhC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB1C,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAmBxF,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB7D,OAAO,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAsCrF"}