novelws 4.0.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.
- package/CHANGELOG.md +100 -623
- package/README.md +79 -594
- package/dist/cli.js +1 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -99
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +17 -108
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/core/config.d.ts +1 -37
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +6 -45
- package/dist/core/config.js.map +1 -1
- package/dist/core/errors.d.ts +0 -31
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +0 -58
- package/dist/core/errors.js.map +1 -1
- package/dist/utils/diagnostics.d.ts +2 -16
- package/dist/utils/diagnostics.d.ts.map +1 -1
- package/dist/utils/diagnostics.js +5 -72
- package/dist/utils/diagnostics.js.map +1 -1
- package/dist/utils/project.d.ts +1 -1
- package/dist/utils/project.d.ts.map +1 -1
- package/dist/utils/project.js +3 -3
- package/dist/utils/project.js.map +1 -1
- package/package.json +1 -2
- package/templates/commands/analyze.md +65 -265
- package/templates/commands/expand.md +70 -0
- package/templates/commands/plan.md +47 -452
- package/templates/commands/specify.md +43 -869
- package/templates/commands/write.md +49 -643
- package/templates/dot-claude/CLAUDE.md +38 -202
- package/templates/resources/anti-ai.md +16 -0
- package/templates/resources/style-reference.md +19 -0
- package/templates/tracking/character-state.json +1 -76
- package/templates/tracking/plot-tracker.json +3 -60
- package/templates/tracking/relationships.json +1 -68
- package/templates/tracking/timeline.json +1 -47
- package/dist/commands/plugin.d.ts +0 -6
- package/dist/commands/plugin.d.ts.map +0 -1
- package/dist/commands/plugin.js +0 -135
- package/dist/commands/plugin.js.map +0 -1
- package/dist/plugins/identifier.d.ts +0 -13
- package/dist/plugins/identifier.d.ts.map +0 -1
- package/dist/plugins/identifier.js +0 -72
- package/dist/plugins/identifier.js.map +0 -1
- package/dist/plugins/installers/base.d.ts +0 -27
- package/dist/plugins/installers/base.d.ts.map +0 -1
- package/dist/plugins/installers/base.js +0 -30
- package/dist/plugins/installers/base.js.map +0 -1
- package/dist/plugins/installers/github.d.ts +0 -22
- package/dist/plugins/installers/github.d.ts.map +0 -1
- package/dist/plugins/installers/github.js +0 -133
- package/dist/plugins/installers/github.js.map +0 -1
- package/dist/plugins/installers/local.d.ts +0 -16
- package/dist/plugins/installers/local.d.ts.map +0 -1
- package/dist/plugins/installers/local.js +0 -69
- package/dist/plugins/installers/local.js.map +0 -1
- package/dist/plugins/installers/npm.d.ts +0 -20
- package/dist/plugins/installers/npm.d.ts.map +0 -1
- package/dist/plugins/installers/npm.js +0 -99
- package/dist/plugins/installers/npm.js.map +0 -1
- package/dist/plugins/manager.d.ts +0 -77
- package/dist/plugins/manager.d.ts.map +0 -1
- package/dist/plugins/manager.js +0 -349
- package/dist/plugins/manager.js.map +0 -1
- package/dist/plugins/registry.d.ts +0 -48
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -111
- package/dist/plugins/registry.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -66
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/plugins/types.js +0 -2
- package/dist/plugins/types.js.map +0 -1
- package/dist/plugins/validator.d.ts +0 -19
- package/dist/plugins/validator.d.ts.map +0 -1
- package/dist/plugins/validator.js +0 -164
- package/dist/plugins/validator.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -13
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -48
- package/dist/utils/logger.js.map +0 -1
- package/plugins/authentic-voice/README.md +0 -31
- package/plugins/authentic-voice/commands/authentic-voice.md +0 -73
- package/plugins/authentic-voice/commands/authenticity-audit.md +0 -37
- package/plugins/authentic-voice/config.yaml +0 -30
- package/plugins/authentic-voice/experts/authentic-editor.md +0 -27
- package/plugins/export/README.md +0 -319
- package/plugins/export/commands/export.md +0 -460
- package/plugins/export/commands/generate-cover.md +0 -256
- package/plugins/export/commands/metadata.md +0 -309
- package/plugins/export/config.yaml +0 -47
- package/plugins/export/experts/publishing-expert.md +0 -171
- package/plugins/export/templates/epub/chapter-template.html +0 -13
- package/plugins/export/templates/epub/cover-template.html +0 -14
- package/plugins/export/templates/epub/stylesheet.css +0 -200
- package/plugins/export/templates/pdf/ebook-style.css +0 -137
- package/plugins/export/templates/pdf/print-style.css +0 -179
- package/plugins/export/templates/platforms/jinjiang-format.md +0 -101
- package/plugins/export/templates/platforms/qidian-format.md +0 -108
- package/plugins/export/templates/platforms/tomato-format.md +0 -95
- package/plugins/translate/README.md +0 -265
- package/plugins/translate/commands/glossary.md +0 -731
- package/plugins/translate/commands/translate-preview.md +0 -543
- package/plugins/translate/commands/translate.md +0 -649
- package/plugins/translate/config.yaml +0 -43
- package/plugins/translate/experts/literary-translator.md +0 -605
- package/templates/commands/character.md +0 -287
- package/templates/commands/checklist.md +0 -744
- package/templates/commands/clarify.md +0 -269
- package/templates/commands/constitution.md +0 -269
- package/templates/commands/expert.md +0 -188
- package/templates/commands/facts.md +0 -552
- package/templates/commands/guide.md +0 -900
- package/templates/commands/help-me.md +0 -221
- package/templates/commands/recap.md +0 -748
- package/templates/commands/relations.md +0 -385
- package/templates/commands/revise.md +0 -450
- package/templates/commands/search.md +0 -531
- package/templates/commands/tasks.md +0 -396
- package/templates/commands/timeline.md +0 -309
- package/templates/commands/track-init.md +0 -149
- package/templates/commands/track.md +0 -704
- package/templates/commands/volume-summary.md +0 -471
- package/templates/knowledge/audit-config.json +0 -26
- package/templates/knowledge/character-profiles.md +0 -152
- package/templates/knowledge/character-voices.md +0 -137
- package/templates/knowledge/locations.md +0 -184
- package/templates/knowledge/world-setting.md +0 -121
- package/templates/resources/character-archetypes/01-hero.md +0 -233
- package/templates/resources/character-archetypes/02-mentor.md +0 -177
- package/templates/resources/character-archetypes/03-shadow.md +0 -221
- package/templates/resources/character-archetypes/04-ally.md +0 -178
- package/templates/resources/character-archetypes/05-shapeshifter.md +0 -177
- package/templates/resources/character-archetypes/06-trickster.md +0 -181
- package/templates/resources/character-archetypes/07-threshold-guardian.md +0 -177
- package/templates/resources/character-archetypes/08-herald.md +0 -180
- package/templates/resources/character-archetypes/09-father.md +0 -249
- package/templates/resources/character-archetypes/10-mother.md +0 -202
- package/templates/resources/character-archetypes/11-child.md +0 -183
- package/templates/resources/character-archetypes/12-sage.md +0 -202
- package/templates/resources/character-archetypes/README.md +0 -60
- package/templates/resources/character-archetypes/application-guide.md +0 -222
- package/templates/resources/character-archetypes/archetype-combinations.md +0 -242
- package/templates/resources/character-archetypes/config.yaml +0 -28
- package/templates/resources/character-archetypes/examples-analysis.md +0 -223
- package/templates/resources/config/keyword-mappings.json +0 -226
- package/templates/resources/config/specification-example.md +0 -146
- package/templates/resources/craft/character-arc.md +0 -1153
- package/templates/resources/craft/dialogue.md +0 -1170
- package/templates/resources/craft/hook-design.md +0 -345
- package/templates/resources/craft/pacing.md +0 -1200
- package/templates/resources/craft/power-system.md +0 -254
- package/templates/resources/craft/scene-structure.md +0 -1136
- package/templates/resources/craft/show-not-tell.md +0 -1012
- package/templates/resources/craft/story-structures.md +0 -134
- package/templates/resources/craft/tension-management.md +0 -168
- package/templates/resources/emotional-beats/01-first-meeting.md +0 -145
- package/templates/resources/emotional-beats/02-bonding-moment.md +0 -226
- package/templates/resources/emotional-beats/03-declaration.md +0 -284
- package/templates/resources/emotional-beats/04-triumph.md +0 -240
- package/templates/resources/emotional-beats/05-reunion.md +0 -396
- package/templates/resources/emotional-beats/06-forgiveness.md +0 -204
- package/templates/resources/emotional-beats/07-betrayal.md +0 -204
- package/templates/resources/emotional-beats/08-loss.md +0 -214
- package/templates/resources/emotional-beats/09-rejection.md +0 -254
- package/templates/resources/emotional-beats/10-failure.md +0 -244
- package/templates/resources/emotional-beats/11-misunderstanding.md +0 -205
- package/templates/resources/emotional-beats/12-farewell.md +0 -283
- package/templates/resources/emotional-beats/13-revelation.md +0 -242
- package/templates/resources/emotional-beats/14-point-of-no-return.md +0 -215
- package/templates/resources/emotional-beats/15-dark-night.md +0 -244
- package/templates/resources/emotional-beats/16-sacrifice.md +0 -246
- package/templates/resources/emotional-beats/17-awakening.md +0 -246
- package/templates/resources/emotional-beats/18-confrontation.md +0 -217
- package/templates/resources/emotional-beats/19-bittersweet-goodbye.md +0 -368
- package/templates/resources/emotional-beats/20-moral-dilemma.md +0 -248
- package/templates/resources/emotional-beats/21-temptation.md +0 -240
- package/templates/resources/emotional-beats/22-redemption.md +0 -210
- package/templates/resources/emotional-beats/README.md +0 -104
- package/templates/resources/emotional-beats/beat-sequences.md +0 -276
- package/templates/resources/emotional-beats/config.yaml +0 -30
- package/templates/resources/emotional-beats/pacing-guide.md +0 -390
- package/templates/resources/genres/game-lit.md +0 -174
- package/templates/resources/genres/historical.md +0 -1127
- package/templates/resources/genres/horror.md +0 -211
- package/templates/resources/genres/military.md +0 -209
- package/templates/resources/genres/mystery.md +0 -1123
- package/templates/resources/genres/rebirth.md +0 -177
- package/templates/resources/genres/revenge.md +0 -846
- package/templates/resources/genres/romance.md +0 -948
- package/templates/resources/genres/sci-fi.md +0 -156
- package/templates/resources/genres/sports.md +0 -216
- package/templates/resources/genres/thriller.md +0 -166
- package/templates/resources/genres/urban.md +0 -170
- package/templates/resources/genres/workplace.md +0 -214
- package/templates/resources/genres/wuxia.md +0 -143
- package/templates/resources/genres/xuanhuan.md +0 -234
- package/templates/resources/genres/youth.md +0 -219
- package/templates/resources/memory/personal-voice.md +0 -113
- package/templates/resources/references/README.md +0 -96
- package/templates/resources/references/china-1920s/culture.md +0 -423
- package/templates/resources/references/china-1920s/daily-life.md +0 -616
- package/templates/resources/references/china-1920s/overview.md +0 -298
- package/templates/resources/references/china-1920s/society.md +0 -703
- package/templates/resources/references/china-1920s/warlords.md +0 -427
- package/templates/resources/references/cultivation-world/daily-life.md +0 -108
- package/templates/resources/references/cultivation-world/overview.md +0 -64
- package/templates/resources/references/cultivation-world/power-system.md +0 -108
- package/templates/resources/references/cultivation-world/sects.md +0 -104
- package/templates/resources/references/cultivation-world/world-setting.md +0 -108
- package/templates/resources/references/modern-workplace/corporate.md +0 -115
- package/templates/resources/references/modern-workplace/daily-life.md +0 -129
- package/templates/resources/references/modern-workplace/overview.md +0 -73
- package/templates/resources/references/modern-workplace/relationships.md +0 -107
- package/templates/resources/references/modern-workplace/tech-industry.md +0 -131
- package/templates/resources/references/tang-dynasty/culture.md +0 -135
- package/templates/resources/references/tang-dynasty/daily-life.md +0 -139
- package/templates/resources/references/tang-dynasty/overview.md +0 -76
- package/templates/resources/references/tang-dynasty/politics.md +0 -121
- package/templates/resources/references/tang-dynasty/society.md +0 -126
- package/templates/resources/requirements/README.md +0 -240
- package/templates/resources/requirements/anti-ai-v3.md +0 -46
- package/templates/resources/requirements/anti-ai-v4-deprecated.md +0 -442
- package/templates/resources/requirements/anti-ai-v5-balanced.md +0 -203
- package/templates/resources/requirements/concretization.md +0 -90
- package/templates/resources/requirements/fast-paced.md +0 -552
- package/templates/resources/requirements/no-poison.md +0 -60
- package/templates/resources/requirements/romance-angst.md +0 -102
- package/templates/resources/requirements/romance-sweet.md +0 -63
- package/templates/resources/requirements/serious-literature.md +0 -45
- package/templates/resources/requirements/strong-emotion.md +0 -60
- package/templates/resources/scripts/README.md +0 -187
- package/templates/resources/scripts/bash/analyze-story.sh +0 -170
- package/templates/resources/scripts/bash/check-analyze-stage.sh +0 -108
- package/templates/resources/scripts/bash/check-consistency.sh +0 -463
- package/templates/resources/scripts/bash/check-facts.sh +0 -214
- package/templates/resources/scripts/bash/check-plot.sh +0 -374
- package/templates/resources/scripts/bash/check-timeline.sh +0 -346
- package/templates/resources/scripts/bash/check-world.sh +0 -395
- package/templates/resources/scripts/bash/check-writing-state.sh +0 -854
- package/templates/resources/scripts/bash/clarify-story.sh +0 -117
- package/templates/resources/scripts/bash/common.sh +0 -151
- package/templates/resources/scripts/bash/constitution.sh +0 -114
- package/templates/resources/scripts/bash/generate-tasks.sh +0 -65
- package/templates/resources/scripts/bash/init-tracking.sh +0 -183
- package/templates/resources/scripts/bash/manage-relations.sh +0 -174
- package/templates/resources/scripts/bash/migrate-tracking.sh +0 -183
- package/templates/resources/scripts/bash/plan-story.sh +0 -100
- package/templates/resources/scripts/bash/specify-story.sh +0 -93
- package/templates/resources/scripts/bash/tasks-story.sh +0 -96
- package/templates/resources/scripts/bash/test-word-count.sh +0 -182
- package/templates/resources/scripts/bash/tests/bench-preload-cache.sh +0 -100
- package/templates/resources/scripts/bash/tests/run-all-benchmarks.sh +0 -16
- package/templates/resources/scripts/bash/tests/test-cache-semantics.sh +0 -199
- package/templates/resources/scripts/bash/tests/test-cross-platform.sh +0 -35
- package/templates/resources/scripts/bash/tests/test-edge-cases-bash.sh +0 -60
- package/templates/resources/scripts/bash/tests/test-phase1-bash.sh +0 -28
- package/templates/resources/scripts/bash/tests/test-preload-cache.sh +0 -123
- package/templates/resources/scripts/bash/tests/test-regex-precompile.sh +0 -89
- package/templates/resources/scripts/bash/tests/test-regression-bash.sh +0 -42
- package/templates/resources/scripts/bash/tests/test-task6-verification.sh +0 -200
- package/templates/resources/scripts/bash/text-audit.sh +0 -144
- package/templates/resources/scripts/bash/track-progress.sh +0 -194
- package/templates/resources/scripts/powershell/analyze-story.ps1 +0 -174
- package/templates/resources/scripts/powershell/check-analyze-stage.ps1 +0 -110
- package/templates/resources/scripts/powershell/check-consistency.ps1 +0 -138
- package/templates/resources/scripts/powershell/check-facts.ps1 +0 -195
- package/templates/resources/scripts/powershell/check-plot.ps1 +0 -139
- package/templates/resources/scripts/powershell/check-timeline.ps1 +0 -112
- package/templates/resources/scripts/powershell/check-writing-state.ps1 +0 -486
- package/templates/resources/scripts/powershell/clarify-story.ps1 +0 -107
- package/templates/resources/scripts/powershell/common.ps1 +0 -36
- package/templates/resources/scripts/powershell/constitution.ps1 +0 -145
- package/templates/resources/scripts/powershell/generate-tasks.ps1 +0 -70
- package/templates/resources/scripts/powershell/init-tracking.ps1 +0 -98
- package/templates/resources/scripts/powershell/manage-relations.ps1 +0 -134
- package/templates/resources/scripts/powershell/migrate-tracking.ps1 +0 -145
- package/templates/resources/scripts/powershell/plan-story.ps1 +0 -99
- package/templates/resources/scripts/powershell/specify-story.ps1 +0 -85
- package/templates/resources/scripts/powershell/tests/bench-ps-cache.ps1 +0 -80
- package/templates/resources/scripts/powershell/tests/test-cross-platform.ps1 +0 -27
- package/templates/resources/scripts/powershell/tests/test-edge-cases-ps.ps1 +0 -29
- package/templates/resources/scripts/powershell/tests/test-phase1-ps.ps1 +0 -28
- package/templates/resources/scripts/powershell/tests/test-ps-cache.ps1 +0 -73
- package/templates/resources/scripts/powershell/tests/test-regression-ps.ps1 +0 -40
- package/templates/resources/scripts/powershell/text-audit.ps1 +0 -102
- package/templates/resources/scripts/powershell/track-progress.ps1 +0 -105
- package/templates/resources/styles/README.md +0 -302
- package/templates/resources/styles/ancient-style.md +0 -579
- package/templates/resources/styles/literary.md +0 -439
- package/templates/resources/styles/minimal.md +0 -472
- package/templates/resources/styles/natural-voice.md +0 -930
- package/templates/resources/styles/web-novel.md +0 -525
- package/templates/skills/analysis/character-analysis/SKILL.md +0 -71
- package/templates/skills/analysis/foreshadow-analysis/SKILL.md +0 -45
- package/templates/skills/analysis/hook-analysis/SKILL.md +0 -111
- package/templates/skills/analysis/logic-analysis/SKILL.md +0 -58
- package/templates/skills/analysis/opening-analysis/SKILL.md +0 -59
- package/templates/skills/analysis/pacing-analysis/SKILL.md +0 -55
- package/templates/skills/analysis/power-analysis/SKILL.md +0 -148
- package/templates/skills/analysis/reader-analysis/SKILL.md +0 -117
- package/templates/skills/analysis/style-analysis/SKILL.md +0 -60
- package/templates/skills/analysis/voice-analysis/SKILL.md +0 -42
- package/templates/skills/auto-tracking/SKILL.md +0 -280
- package/templates/skills/genre-knowledge/fantasy/SKILL.md +0 -355
- package/templates/skills/genre-knowledge/mystery/SKILL.md +0 -337
- package/templates/skills/genre-knowledge/romance/SKILL.md +0 -228
- package/templates/skills/genre-knowledge/sci-fi/SKILL.md +0 -65
- package/templates/skills/genre-knowledge/thriller/SKILL.md +0 -95
- package/templates/skills/planning/volume-detail/SKILL.md +0 -219
- package/templates/skills/quality-assurance/consistency-checker/SKILL.md +0 -412
- package/templates/skills/quality-assurance/continuity-tracker/SKILL.md +0 -157
- package/templates/skills/quality-assurance/facts-checker/SKILL.md +0 -405
- package/templates/skills/quality-assurance/forgotten-elements/SKILL.md +0 -147
- package/templates/skills/quality-assurance/getting-started/SKILL.md +0 -224
- package/templates/skills/quality-assurance/hook-checker/SKILL.md +0 -164
- package/templates/skills/quality-assurance/hook-checker/experts/hook-analyst.md +0 -33
- package/templates/skills/quality-assurance/long-series-continuity/SKILL.md +0 -570
- package/templates/skills/quality-assurance/pacing-monitor/SKILL.md +0 -143
- package/templates/skills/quality-assurance/pov-validator/SKILL.md +0 -135
- package/templates/skills/quality-assurance/pre-write-checklist/SKILL.md +0 -583
- package/templates/skills/quality-assurance/requirement-detector/CONFLICT_RESOLUTION.md +0 -119
- package/templates/skills/quality-assurance/requirement-detector/EXAMPLES.md +0 -146
- package/templates/skills/quality-assurance/requirement-detector/KEYWORDS.md +0 -160
- package/templates/skills/quality-assurance/requirement-detector/SKILL.md +0 -149
- package/templates/skills/quality-assurance/setting-detector/SKILL.md +0 -611
- package/templates/skills/quality-assurance/style-detector/CONFLICT_RESOLUTION.md +0 -126
- package/templates/skills/quality-assurance/style-detector/EXAMPLES.md +0 -206
- package/templates/skills/quality-assurance/style-detector/KEYWORDS.md +0 -207
- package/templates/skills/quality-assurance/style-detector/SKILL.md +0 -264
- package/templates/skills/quality-assurance/voice-consistency-checker/SKILL.md +0 -103
- package/templates/skills/quality-assurance/voice-consistency-checker/experts/voice-analyst.md +0 -21
- package/templates/skills/quality-assurance/workflow-guide/SKILL.md +0 -381
- package/templates/skills/writing-techniques/character-arc/SKILL.md +0 -267
- package/templates/skills/writing-techniques/dialogue-techniques/SKILL.md +0 -366
- package/templates/skills/writing-techniques/multi-thread-narrative/SKILL.md +0 -708
- package/templates/skills/writing-techniques/multi-thread-narrative/experts/thread-analyst.md +0 -226
- package/templates/skills/writing-techniques/pacing-control/SKILL.md +0 -480
- package/templates/skills/writing-techniques/reader-expectation/SKILL.md +0 -1026
- package/templates/skills/writing-techniques/reader-expectation/experts/expectation-analyst.md +0 -209
- package/templates/skills/writing-techniques/revision-polish/SKILL.md +0 -496
- package/templates/skills/writing-techniques/revision-polish/experts/revision-editor.md +0 -221
- package/templates/skills/writing-techniques/scene-structure/SKILL.md +0 -361
- package/templates/skills/writing-techniques/style-learning/SKILL.md +0 -436
- package/templates/skills/writing-techniques/writing-balance/.gitkeep +0 -0
- package/templates/skills/writing-techniques/writing-balance/SKILL.md +0 -460
- package/templates/skills/writing-techniques/writing-techniques/SKILL.md +0 -727
- package/templates/tracking/story-facts.json +0 -5
- package/templates/tracking/summary/characters-summary.json +0 -7
- package/templates/tracking/summary/plot-summary.json +0 -13
- package/templates/tracking/summary/timeline-summary.json +0 -8
- package/templates/tracking/summary/volume-summaries.json +0 -5
- package/templates/tracking/tracking-log.md +0 -110
- package/templates/tracking/validation-rules.json +0 -128
- /package/templates/resources/{memory/constitution.md → constitution.md} +0 -0
package/dist/plugins/registry.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 插件注册表管理
|
|
3
|
-
*
|
|
4
|
-
* 独立管理 .specify/plugins.json 的读写,
|
|
5
|
-
* 从 manager.ts 中拆出以实现职责单一。
|
|
6
|
-
*/
|
|
7
|
-
import fs from 'fs-extra';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { ConfigError } from '../core/errors.js';
|
|
10
|
-
const EMPTY_REGISTRY = {
|
|
11
|
-
version: '1.0.0',
|
|
12
|
-
plugins: [],
|
|
13
|
-
};
|
|
14
|
-
export class PluginRegistry {
|
|
15
|
-
registryPath;
|
|
16
|
-
data;
|
|
17
|
-
loaded = false;
|
|
18
|
-
constructor(registryPath) {
|
|
19
|
-
this.registryPath = registryPath;
|
|
20
|
-
this.data = { ...EMPTY_REGISTRY, plugins: [] };
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 从磁盘加载注册表
|
|
24
|
-
*/
|
|
25
|
-
async load() {
|
|
26
|
-
try {
|
|
27
|
-
if (await fs.pathExists(this.registryPath)) {
|
|
28
|
-
const raw = await fs.readJson(this.registryPath);
|
|
29
|
-
if (raw && typeof raw === 'object' && Array.isArray(raw.plugins)) {
|
|
30
|
-
this.data = raw;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.data = { ...EMPTY_REGISTRY, plugins: [] };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
this.data = { ...EMPTY_REGISTRY, plugins: [] };
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
// 注册表损坏,使用空注册表
|
|
42
|
-
this.data = { ...EMPTY_REGISTRY, plugins: [] };
|
|
43
|
-
}
|
|
44
|
-
this.loaded = true;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* 保存注册表到磁盘
|
|
48
|
-
*/
|
|
49
|
-
async save() {
|
|
50
|
-
try {
|
|
51
|
-
await fs.ensureDir(path.dirname(this.registryPath));
|
|
52
|
-
await fs.writeJson(this.registryPath, this.data, { spaces: 2 });
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
throw new ConfigError(this.registryPath, `保存注册表失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* 添加插件元数据
|
|
60
|
-
*/
|
|
61
|
-
add(metadata) {
|
|
62
|
-
this.ensureLoaded();
|
|
63
|
-
// 如果已存在同名插件,先移除
|
|
64
|
-
this.data.plugins = this.data.plugins.filter(p => p.name !== metadata.name);
|
|
65
|
-
this.data.plugins.push(metadata);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* 移除插件
|
|
69
|
-
* 返回 true 表示成功移除,false 表示未找到
|
|
70
|
-
*/
|
|
71
|
-
remove(name) {
|
|
72
|
-
this.ensureLoaded();
|
|
73
|
-
const before = this.data.plugins.length;
|
|
74
|
-
this.data.plugins = this.data.plugins.filter(p => p.name !== name);
|
|
75
|
-
return this.data.plugins.length < before;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* 查找插件
|
|
79
|
-
*/
|
|
80
|
-
find(name) {
|
|
81
|
-
this.ensureLoaded();
|
|
82
|
-
return this.data.plugins.find(p => p.name === name);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 检查插件是否存在
|
|
86
|
-
*/
|
|
87
|
-
has(name) {
|
|
88
|
-
this.ensureLoaded();
|
|
89
|
-
return this.data.plugins.some(p => p.name === name);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* 列出所有插件
|
|
93
|
-
*/
|
|
94
|
-
list() {
|
|
95
|
-
this.ensureLoaded();
|
|
96
|
-
return [...this.data.plugins];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 获取原始注册表数据
|
|
100
|
-
*/
|
|
101
|
-
getData() {
|
|
102
|
-
this.ensureLoaded();
|
|
103
|
-
return { ...this.data, plugins: [...this.data.plugins] };
|
|
104
|
-
}
|
|
105
|
-
ensureLoaded() {
|
|
106
|
-
if (!this.loaded) {
|
|
107
|
-
throw new Error('注册表未加载,请先调用 load()');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;A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AC,IAAY;QACf,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,IAAI;QACF,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3D,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF"}
|
package/dist/plugins/types.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export type PluginSource = 'builtin' | 'npm' | 'github' | 'local';
|
|
2
|
-
export type PluginType = 'feature' | 'expert' | 'workflow';
|
|
3
|
-
export interface PluginMetadata {
|
|
4
|
-
name: string;
|
|
5
|
-
version: string;
|
|
6
|
-
source: PluginSource;
|
|
7
|
-
installedAt: string;
|
|
8
|
-
path: string;
|
|
9
|
-
registry?: string;
|
|
10
|
-
repository?: string;
|
|
11
|
-
commit?: string;
|
|
12
|
-
commands?: string[];
|
|
13
|
-
skills?: string[];
|
|
14
|
-
dependencies?: string[];
|
|
15
|
-
}
|
|
16
|
-
export interface PluginRegistryData {
|
|
17
|
-
version: string;
|
|
18
|
-
plugins: PluginMetadata[];
|
|
19
|
-
}
|
|
20
|
-
export interface PluginIdentifier {
|
|
21
|
-
type: PluginSource;
|
|
22
|
-
name: string;
|
|
23
|
-
version?: string;
|
|
24
|
-
scope?: string;
|
|
25
|
-
repository?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ValidationResult {
|
|
28
|
-
valid: boolean;
|
|
29
|
-
errors: string[];
|
|
30
|
-
warnings: string[];
|
|
31
|
-
}
|
|
32
|
-
export interface PluginConfig {
|
|
33
|
-
name: string;
|
|
34
|
-
version: string;
|
|
35
|
-
description: string;
|
|
36
|
-
type: PluginType;
|
|
37
|
-
commands?: Array<{
|
|
38
|
-
id: string;
|
|
39
|
-
file: string;
|
|
40
|
-
description: string;
|
|
41
|
-
}>;
|
|
42
|
-
skills?: Array<{
|
|
43
|
-
id: string;
|
|
44
|
-
file: string;
|
|
45
|
-
description: string;
|
|
46
|
-
}>;
|
|
47
|
-
dependencies?: {
|
|
48
|
-
core: string;
|
|
49
|
-
};
|
|
50
|
-
installation?: {
|
|
51
|
-
message?: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export interface InstallerOptions {
|
|
55
|
-
/** 自定义 npm registry URL */
|
|
56
|
-
registryUrl?: string;
|
|
57
|
-
/** GitHub token(用于私有仓库) */
|
|
58
|
-
githubToken?: string;
|
|
59
|
-
}
|
|
60
|
-
export interface InstallResult {
|
|
61
|
-
/** 安装的版本 */
|
|
62
|
-
version: string;
|
|
63
|
-
/** 插件在磁盘上的路径 */
|
|
64
|
-
pluginPath: string;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,Y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MAAM,CAAC;KACrB,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,YAAY,CAAC,EAAE;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/plugins/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 插件验证器
|
|
3
|
-
*
|
|
4
|
-
* 验证插件目录结构和 config.yaml 内容。
|
|
5
|
-
* 增强:schema 校验、运行时类型检查、文件名合法性验证。
|
|
6
|
-
*/
|
|
7
|
-
import { ValidationResult, PluginConfig } from './types.js';
|
|
8
|
-
export declare class PluginValidator {
|
|
9
|
-
/**
|
|
10
|
-
* 验证插件目录
|
|
11
|
-
*/
|
|
12
|
-
static validate(pluginPath: string): Promise<ValidationResult>;
|
|
13
|
-
/**
|
|
14
|
-
* 安全解析 config.yaml 为 PluginConfig
|
|
15
|
-
* 返回 null 表示解析失败
|
|
16
|
-
*/
|
|
17
|
-
static parseConfig(configPath: string): Promise<PluginConfig | null>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/plugins/validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAU5D,qBAAa,eAAe;IAC1B;;OAEG;WACU,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8HpE;;;OAGG;WACU,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CA+B3E"}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 插件验证器
|
|
3
|
-
*
|
|
4
|
-
* 验证插件目录结构和 config.yaml 内容。
|
|
5
|
-
* 增强:schema 校验、运行时类型检查、文件名合法性验证。
|
|
6
|
-
*/
|
|
7
|
-
import fs from 'fs-extra';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import yaml from 'js-yaml';
|
|
10
|
-
/** 合法的插件类型 */
|
|
11
|
-
const VALID_PLUGIN_TYPES = ['feature', 'expert', 'workflow'];
|
|
12
|
-
/** 检查 ID 是否为合法文件名 */
|
|
13
|
-
function isValidId(id) {
|
|
14
|
-
return /^[\w-]+$/.test(id);
|
|
15
|
-
}
|
|
16
|
-
export class PluginValidator {
|
|
17
|
-
/**
|
|
18
|
-
* 验证插件目录
|
|
19
|
-
*/
|
|
20
|
-
static async validate(pluginPath) {
|
|
21
|
-
const result = {
|
|
22
|
-
valid: true,
|
|
23
|
-
errors: [],
|
|
24
|
-
warnings: [],
|
|
25
|
-
};
|
|
26
|
-
// 1. 检查 config.yaml 存在
|
|
27
|
-
const configPath = path.join(pluginPath, 'config.yaml');
|
|
28
|
-
if (!await fs.pathExists(configPath)) {
|
|
29
|
-
result.valid = false;
|
|
30
|
-
result.errors.push('config.yaml 未找到');
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
// 2. 解析 YAML
|
|
34
|
-
let rawConfig;
|
|
35
|
-
try {
|
|
36
|
-
const content = await fs.readFile(configPath, 'utf-8');
|
|
37
|
-
rawConfig = yaml.load(content);
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
result.valid = false;
|
|
41
|
-
result.errors.push('config.yaml 不是有效的 YAML 格式');
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
if (!rawConfig || typeof rawConfig !== 'object') {
|
|
45
|
-
result.valid = false;
|
|
46
|
-
result.errors.push('config.yaml 内容为空或无效');
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
const config = rawConfig;
|
|
50
|
-
// 3. 验证必填字段
|
|
51
|
-
if (!config.name || typeof config.name !== 'string') {
|
|
52
|
-
result.valid = false;
|
|
53
|
-
result.errors.push('config.yaml 缺少必填字段: name');
|
|
54
|
-
}
|
|
55
|
-
if (!config.version || typeof config.version !== 'string') {
|
|
56
|
-
result.warnings.push('config.yaml 缺少 version 字段');
|
|
57
|
-
}
|
|
58
|
-
if (!config.description || typeof config.description !== 'string') {
|
|
59
|
-
result.warnings.push('config.yaml 缺少 description 字段');
|
|
60
|
-
}
|
|
61
|
-
// 4. 验证 type 字段
|
|
62
|
-
if (config.type) {
|
|
63
|
-
if (typeof config.type !== 'string' || !VALID_PLUGIN_TYPES.includes(config.type)) {
|
|
64
|
-
result.warnings.push(`config.yaml 的 type 字段无效: "${config.type}",有效值: ${VALID_PLUGIN_TYPES.join(', ')}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// 5. 验证命令声明
|
|
68
|
-
if (config.commands) {
|
|
69
|
-
if (!Array.isArray(config.commands)) {
|
|
70
|
-
result.valid = false;
|
|
71
|
-
result.errors.push('config.yaml 的 commands 字段必须是数组');
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
for (const cmd of config.commands) {
|
|
75
|
-
if (!cmd || typeof cmd !== 'object') {
|
|
76
|
-
result.errors.push('commands 数组中包含无效条目');
|
|
77
|
-
result.valid = false;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
const cmdObj = cmd;
|
|
81
|
-
if (!cmdObj.id || typeof cmdObj.id !== 'string') {
|
|
82
|
-
result.errors.push('命令缺少 id 字段');
|
|
83
|
-
result.valid = false;
|
|
84
|
-
}
|
|
85
|
-
else if (!isValidId(cmdObj.id)) {
|
|
86
|
-
result.errors.push(`命令 ID 不合法: "${cmdObj.id}"(只允许字母、数字、下划线、连字符)`);
|
|
87
|
-
result.valid = false;
|
|
88
|
-
}
|
|
89
|
-
// 检查命令文件是否存在
|
|
90
|
-
const cmdFile = cmdObj.file || `${cmdObj.id || 'unknown'}.md`;
|
|
91
|
-
const cmdPath = path.join(pluginPath, cmdFile);
|
|
92
|
-
if (!await fs.pathExists(cmdPath)) {
|
|
93
|
-
result.warnings.push(`声明的命令文件不存在: ${cmdFile}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// 6. 验证 Skills 声明
|
|
99
|
-
if (config.skills) {
|
|
100
|
-
if (!Array.isArray(config.skills)) {
|
|
101
|
-
result.valid = false;
|
|
102
|
-
result.errors.push('config.yaml 的 skills 字段必须是数组');
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
for (const skill of config.skills) {
|
|
106
|
-
if (!skill || typeof skill !== 'object') {
|
|
107
|
-
result.errors.push('skills 数组中包含无效条目');
|
|
108
|
-
result.valid = false;
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
const skillObj = skill;
|
|
112
|
-
if (!skillObj.id || typeof skillObj.id !== 'string') {
|
|
113
|
-
result.errors.push('Skill 缺少 id 字段');
|
|
114
|
-
result.valid = false;
|
|
115
|
-
}
|
|
116
|
-
else if (!isValidId(skillObj.id)) {
|
|
117
|
-
result.errors.push(`Skill ID 不合法: "${skillObj.id}"(只允许字母、数字、下划线、连字符)`);
|
|
118
|
-
result.valid = false;
|
|
119
|
-
}
|
|
120
|
-
// 检查 Skill 文件是否存在
|
|
121
|
-
const skillFile = skillObj.file || path.join('skills', String(skillObj.id || 'unknown'), 'SKILL.md');
|
|
122
|
-
const skillPath = path.join(pluginPath, skillFile);
|
|
123
|
-
if (!await fs.pathExists(skillPath)) {
|
|
124
|
-
result.warnings.push(`声明的 Skill 文件不存在: ${skillFile}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return result;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* 安全解析 config.yaml 为 PluginConfig
|
|
133
|
-
* 返回 null 表示解析失败
|
|
134
|
-
*/
|
|
135
|
-
static async parseConfig(configPath) {
|
|
136
|
-
try {
|
|
137
|
-
const content = await fs.readFile(configPath, 'utf-8');
|
|
138
|
-
const raw = yaml.load(content);
|
|
139
|
-
if (!raw || typeof raw !== 'object') {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
const config = raw;
|
|
143
|
-
if (!config.name || typeof config.name !== 'string') {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
name: config.name,
|
|
148
|
-
version: typeof config.version === 'string' ? config.version : '0.0.0',
|
|
149
|
-
description: typeof config.description === 'string' ? config.description : '',
|
|
150
|
-
type: VALID_PLUGIN_TYPES.includes(config.type)
|
|
151
|
-
? config.type
|
|
152
|
-
: 'feature',
|
|
153
|
-
commands: Array.isArray(config.commands) ? config.commands : undefined,
|
|
154
|
-
skills: Array.isArray(config.skills) ? config.skills : undefined,
|
|
155
|
-
dependencies: config.dependencies,
|
|
156
|
-
installation: config.installation,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRo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EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAoC,CAAC,CAAC,CAAC,SAAS;gBAClG,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAgC,CAAC,CAAC,CAAC,SAAS;gBAC1F,YAAY,EAAE,MAAM,CAAC,YAA4C;gBACjE,YAAY,EAAE,MAAM,CAAC,YAA4C;aAClE,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
2
|
-
export declare const logger: {
|
|
3
|
-
/** 设置日志级别 */
|
|
4
|
-
setLevel(level: LogLevel): void;
|
|
5
|
-
/** 获取当前日志级别 */
|
|
6
|
-
getLevel(): LogLevel;
|
|
7
|
-
info: (message: string, ...args: any[]) => void;
|
|
8
|
-
success: (message: string, ...args: any[]) => void;
|
|
9
|
-
warn: (message: string, ...args: any[]) => void;
|
|
10
|
-
error: (message: string, ...args: any[]) => void;
|
|
11
|
-
debug: (message: string, ...args: any[]) => void;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAgBtE,eAAO,MAAM,MAAM;IACjB,aAAa;oBACG,QAAQ,GAAG,IAAI;IAI/B,eAAe;gBACH,QAAQ;oBAIJ,MAAM,WAAW,GAAG,EAAE;uBAMnB,MAAM,WAAW,GAAG,EAAE;oBAMzB,MAAM,WAAW,GAAG,EAAE;qBAMrB,MAAM,WAAW,GAAG,EAAE;qBAMtB,MAAM,WAAW,GAAG,EAAE;CAKxC,CAAC"}
|
package/dist/utils/logger.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
const LEVEL_PRIORITY = {
|
|
3
|
-
debug: 0,
|
|
4
|
-
info: 1,
|
|
5
|
-
warn: 2,
|
|
6
|
-
error: 3,
|
|
7
|
-
silent: 4,
|
|
8
|
-
};
|
|
9
|
-
let _currentLevel = 'info';
|
|
10
|
-
function shouldLog(level) {
|
|
11
|
-
return LEVEL_PRIORITY[level] >= LEVEL_PRIORITY[_currentLevel];
|
|
12
|
-
}
|
|
13
|
-
export const logger = {
|
|
14
|
-
/** 设置日志级别 */
|
|
15
|
-
setLevel(level) {
|
|
16
|
-
_currentLevel = level;
|
|
17
|
-
},
|
|
18
|
-
/** 获取当前日志级别 */
|
|
19
|
-
getLevel() {
|
|
20
|
-
return _currentLevel;
|
|
21
|
-
},
|
|
22
|
-
info: (message, ...args) => {
|
|
23
|
-
if (shouldLog('info')) {
|
|
24
|
-
console.log(chalk.blue('ℹ'), message, ...args);
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
success: (message, ...args) => {
|
|
28
|
-
if (shouldLog('info')) {
|
|
29
|
-
console.log(chalk.green('✓'), message, ...args);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
warn: (message, ...args) => {
|
|
33
|
-
if (shouldLog('warn')) {
|
|
34
|
-
console.log(chalk.yellow('⚠'), message, ...args);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
error: (message, ...args) => {
|
|
38
|
-
if (shouldLog('error')) {
|
|
39
|
-
console.log(chalk.red('✗'), message, ...args);
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
debug: (message, ...args) => {
|
|
43
|
-
if (shouldLog('debug') && process.env.DEBUG) {
|
|
44
|
-
console.log(chalk.gray('🐛'), message, ...args);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,cAAc,GAA6B;IAC/C,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,IAAI,aAAa,GAAa,MAAM,CAAC;AAErC,SAAS,SAAS,CAAC,KAAe;IAChC,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,aAAa;IACb,QAAQ,CAAC,KAAe;QACtB,aAAa,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,eAAe;IACf,QAAQ;QACN,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QAC3C,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Authentic Voice 插件
|
|
2
|
-
|
|
3
|
-
让文字更像你自己写的:强调生活细节、口语节奏与个体词库的一致性。该插件聚焦“提升原创度与自然度”,不涉及也不用于任何检测规避场景
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
novel plugins add authentic-voice
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 准备个人语料
|
|
12
|
-
|
|
13
|
-
在 `.specify/memory/personal-voice.md` 中补全:
|
|
14
|
-
- 口头禅与常用表达
|
|
15
|
-
- 固定句式与节奏偏好
|
|
16
|
-
- 生活经历清单与行业/地域词汇
|
|
17
|
-
- 写作忌口与避讳
|
|
18
|
-
- 比喻口味与意象库
|
|
19
|
-
|
|
20
|
-
## 常用命令
|
|
21
|
-
|
|
22
|
-
- `/authentic-voice` 启动真实人声写作,自动读取个人语料并在输出前给出“取材卡”
|
|
23
|
-
- `/authenticity-audit` 对既有文本做人味自查与改写建议
|
|
24
|
-
- `/expert authentic-editor` 召唤真实人声编辑专家,进行更细致的行级改写
|
|
25
|
-
|
|
26
|
-
## 适用场景
|
|
27
|
-
|
|
28
|
-
- 正稿创作:需要稳态的个人风格与节奏
|
|
29
|
-
- 二次打磨:避免空话、模板化与节奏单一
|
|
30
|
-
- 长线项目:逐步沉淀个人词库与意象,形成稳定“作者指纹”
|
|
31
|
-
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 真实人声写作模式 - /authentic-voice
|
|
3
|
-
description: 以更贴近生活与个人表达的方式进行创作,强调具体细节、口语节奏与个体词汇
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 真实人声写作模式
|
|
7
|
-
|
|
8
|
-
目标:基于作者的生活经验与个人用语,输出自然、有细节、有温度的文字;避免模板化句式与空泛表达,保持叙述的节奏变化与真实思考过程
|
|
9
|
-
|
|
10
|
-
## 使用方法
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
/authentic-voice [可选参数]
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
- `--tone <自由/克制/热烈/冷静>` 设定整体语气偏好,默认自由
|
|
17
|
-
- `--pace <慢/适中/快>` 控制叙述节奏,默认适中
|
|
18
|
-
- `--persona <file>` 指定个人语料文件,默认读取 `.specify/memory/personal-voice.md`
|
|
19
|
-
|
|
20
|
-
## 输入准备
|
|
21
|
-
|
|
22
|
-
- 若存在 `.specify/memory/personal-voice.md`,在创作前读取该文件的要点:
|
|
23
|
-
- 口头禅与常用表达
|
|
24
|
-
- 固定句式与偏好节奏
|
|
25
|
-
- 生活经历清单与行业/地域词汇
|
|
26
|
-
- 写作忌口与避讳
|
|
27
|
-
- 比喻口味与意象库
|
|
28
|
-
|
|
29
|
-
如果文件为空或缺失,以当前对话中提供的个人信息为准,并在输出开头提示需要完善个人语料
|
|
30
|
-
|
|
31
|
-
## 写作要则
|
|
32
|
-
|
|
33
|
-
请按以下方式组织创作:
|
|
34
|
-
|
|
35
|
-
- 具体细节优先:尽量用可感知的场景与动作替代抽象总结
|
|
36
|
-
- 节奏有起伏:段落长短交替,长段推进,短句落锤
|
|
37
|
-
- 真实思路:允许小范围犹疑、转折与补充,而不是一口气给出完美结构
|
|
38
|
-
- 口语混搭:语气词与书面语并存,但不要过度修饰
|
|
39
|
-
- 个体词库:自然使用作者在 personal-voice.md 中记录的用语与意象
|
|
40
|
-
- 避免空话:少用“众所周知、在某种程度、某种意义”这类虚化表达
|
|
41
|
-
|
|
42
|
-
## 结构建议(可弹性使用)
|
|
43
|
-
|
|
44
|
-
### 开头
|
|
45
|
-
- 由具体画面/细节入手,不讲大道理,先把人和事摆出来
|
|
46
|
-
|
|
47
|
-
### 展开
|
|
48
|
-
- 以“一个细节→一个联想→一个判断”的节拍推进,可在熟悉话题里加入个人角度
|
|
49
|
-
|
|
50
|
-
### 深入
|
|
51
|
-
- 说出自己真实的矛盾与拿不准之处,再给出现阶段可行的做法或更谨慎的表述
|
|
52
|
-
|
|
53
|
-
### 收束
|
|
54
|
-
- 回到生活层面的落点,用一句朴素的话作结,留一点余味
|
|
55
|
-
|
|
56
|
-
## 语言提示
|
|
57
|
-
|
|
58
|
-
- 混用长短句,口语为骨,书面为皮
|
|
59
|
-
- 对话尽量自然,保留个体口头禅,但避免滥用
|
|
60
|
-
- 少用模板连接词;根据语义自然转折
|
|
61
|
-
- 允许小瑕疵,但避免语义不清
|
|
62
|
-
|
|
63
|
-
## 输出要求
|
|
64
|
-
|
|
65
|
-
- 先给出一小段“写作取材卡”,用 3-6 行列出:将要使用的个人词汇、生活细节与意象
|
|
66
|
-
- 之后输出正文,不插入执行过程解释
|
|
67
|
-
|
|
68
|
-
## 若用户提供标题或主题
|
|
69
|
-
|
|
70
|
-
当收到 `标题:...` 或明确主题时:
|
|
71
|
-
- 用“标题拆解→生活联想→叙述落点”三步在内部完成构思,再按上文要则直接写正文
|
|
72
|
-
- 若无个人语料,先尝试向用户询问一到两个能落地的小细节
|
|
73
|
-
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 人味自查与改写 - /authenticity-audit
|
|
3
|
-
description: 对现有文本做“人味”体检,给出可执行的微调与改写建议,提升自然度与个体风格一致性
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 人味自查与改写
|
|
7
|
-
|
|
8
|
-
目标:帮助作者发现文本中的模板化痕迹、空话与节奏单一的问题,并提供面向行/段落的微调建议。强调“更像你写的”,而非追求任何形式的检测规避
|
|
9
|
-
|
|
10
|
-
## 使用方法
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
/authenticity-audit
|
|
14
|
-
|
|
15
|
-
[粘贴需要检查的文本]
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## 检查维度(给出计数与示例)
|
|
19
|
-
|
|
20
|
-
若存在 `spec/knowledge/audit-config.json`,以其中的连接词、空话清单、句长阈值为准;否则使用内置默认规则
|
|
21
|
-
|
|
22
|
-
- 模板连接词密度:如“首先、其次、再者、总而言之”等的出现次数与替换建议
|
|
23
|
-
- 空泛表达:如“在某种程度、众所周知、众多领域”等,给出更具体的改写
|
|
24
|
-
- 句长方差:统计平均句长与方差,标记“连续长句”或“连续短句”的片段,并给出节奏打断/合并建议
|
|
25
|
-
- 陈词滥调:识别可替换的套话,提供两到三种更贴近内容的改写版本
|
|
26
|
-
- 抽象过载:提示哪些段落抽象名词密度过高,并建议补充可感知的细节
|
|
27
|
-
- 人设一致性:对比 `.specify/memory/personal-voice.md` 中的口头禅/词汇,标记缺失的“个体信号”并建议自然融入点
|
|
28
|
-
|
|
29
|
-
## 改写输出
|
|
30
|
-
|
|
31
|
-
- 分段输出:原句 → 问题简述 → 微调版 → 更大胆的个人化版本
|
|
32
|
-
- 控制幅度:优先微调,尽量保留原意;仅在必要时提供更大幅度的改写
|
|
33
|
-
- 体例保持:不改变原文的文体与叙述角度,除非用户明确请求
|
|
34
|
-
|
|
35
|
-
## 末尾建议卡片
|
|
36
|
-
|
|
37
|
-
- 给出 5-8 条“下次写作时可直接使用”的个体化提示,来源于本次文本暴露的问题
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: authentic-voice
|
|
2
|
-
version: 1.0.0
|
|
3
|
-
description: 真实人声写作插件——提升原创度、生活质感与个体声音一致性
|
|
4
|
-
type: feature
|
|
5
|
-
author: Novel Writer Community
|
|
6
|
-
commands:
|
|
7
|
-
- id: authentic-voice
|
|
8
|
-
file: commands/authentic-voice.md
|
|
9
|
-
description: 启动真实人声写作模式(基于个人语料与生活细节)
|
|
10
|
-
- id: authenticity-audit
|
|
11
|
-
file: commands/authenticity-audit.md
|
|
12
|
-
description: 对现有文本进行“人味”自查与改写建议
|
|
13
|
-
experts:
|
|
14
|
-
- id: authentic-editor
|
|
15
|
-
file: experts/authentic-editor.md
|
|
16
|
-
title: 真实人声编辑
|
|
17
|
-
description: 擅长将文本改写为更自然、更具生活细节的表达
|
|
18
|
-
dependencies:
|
|
19
|
-
core: ">=0.5.0"
|
|
20
|
-
installation:
|
|
21
|
-
message: |
|
|
22
|
-
✅ 真实人声写作插件安装成功
|
|
23
|
-
|
|
24
|
-
用法建议:
|
|
25
|
-
1. 在 .specify/memory/personal-voice.md 中填写你的口头禅、常用句式、生活经历与行业词汇
|
|
26
|
-
2. 在 AI 助手中使用 /authentic-voice 进入真实人声写作模式
|
|
27
|
-
3. 对既有文本运行 /authenticity-audit 获取自查清单与修改建议
|
|
28
|
-
|
|
29
|
-
目标:提升原创度、生活质感和你的个人表达一致性,帮助构建可信的人设与稳定文风
|
|
30
|
-
|