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
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# track-progress.sh - 综合追踪小说创作进度
|
|
4
|
-
# 支持 --check 深度验证和 --fix 自动修复
|
|
5
|
-
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
8
|
-
|
|
9
|
-
# 颜色输出
|
|
10
|
-
RED='\033[0;31m'
|
|
11
|
-
GREEN='\033[0;32m'
|
|
12
|
-
YELLOW='\033[1;33m'
|
|
13
|
-
BLUE='\033[0;34m'
|
|
14
|
-
NC='\033[0m' # No Color
|
|
15
|
-
|
|
16
|
-
# 解析参数
|
|
17
|
-
MODE="report" # 默认模式
|
|
18
|
-
if [[ "$1" == "--check" ]]; then
|
|
19
|
-
MODE="check"
|
|
20
|
-
elif [[ "$1" == "--fix" ]]; then
|
|
21
|
-
MODE="fix"
|
|
22
|
-
elif [[ "$1" == "--brief" ]]; then
|
|
23
|
-
MODE="brief"
|
|
24
|
-
elif [[ "$1" == "--plot" ]]; then
|
|
25
|
-
MODE="plot"
|
|
26
|
-
elif [[ "$1" == "--stats" ]]; then
|
|
27
|
-
MODE="stats"
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
echo -e "${BLUE}📊 执行追踪分析...${NC}"
|
|
31
|
-
echo ""
|
|
32
|
-
|
|
33
|
-
# 检查基础文件是否存在
|
|
34
|
-
check_files() {
|
|
35
|
-
local has_files=false
|
|
36
|
-
|
|
37
|
-
if [[ -f "stories/current/progress.json" ]]; then
|
|
38
|
-
has_files=true
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
if [[ -f "tracking/plot-tracker.json" ]]; then
|
|
42
|
-
has_files=true
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
if [[ "$has_files" == false ]]; then
|
|
46
|
-
echo -e "${YELLOW}⚠️ 未找到追踪文件,请先初始化项目${NC}"
|
|
47
|
-
exit 1
|
|
48
|
-
fi
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
# 基础报告功能
|
|
52
|
-
show_basic_report() {
|
|
53
|
-
echo -e "${GREEN}📖 小说创作综合报告${NC}"
|
|
54
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
55
|
-
|
|
56
|
-
# 读取进度信息
|
|
57
|
-
if [[ -f "stories/current/progress.json" ]]; then
|
|
58
|
-
echo -e "${BLUE}✍️ 写作进度${NC}"
|
|
59
|
-
# 这里AI会读取并显示进度信息
|
|
60
|
-
echo " 章节完成情况等待分析..."
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
# 读取情节追踪
|
|
64
|
-
if [[ -f "tracking/plot-tracker.json" ]]; then
|
|
65
|
-
echo -e "${BLUE}📍 情节状态${NC}"
|
|
66
|
-
echo " 主线进度等待分析..."
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
echo ""
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
# 深度验证模式
|
|
73
|
-
run_deep_check() {
|
|
74
|
-
echo -e "${GREEN}🔍 执行深度验证...${NC}"
|
|
75
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
76
|
-
|
|
77
|
-
# Phase 1: 基础验证
|
|
78
|
-
echo -e "${BLUE}Phase 1: 基础验证${NC}"
|
|
79
|
-
echo " [P] 执行情节一致性检查..."
|
|
80
|
-
echo " [P] 执行时间线验证..."
|
|
81
|
-
echo " [P] 执行关系验证..."
|
|
82
|
-
echo " [P] 执行世界观验证..."
|
|
83
|
-
|
|
84
|
-
# Phase 2: 角色深度验证
|
|
85
|
-
echo -e "${BLUE}Phase 2: 角色深度验证${NC}"
|
|
86
|
-
|
|
87
|
-
# 检查验证规则文件
|
|
88
|
-
if [[ -f "tracking/validation-rules.json" ]]; then
|
|
89
|
-
echo " ✅ 加载验证规则"
|
|
90
|
-
echo " 扫描章节中的角色名称..."
|
|
91
|
-
echo " 对比character-state.json..."
|
|
92
|
-
echo " 检查称呼准确性..."
|
|
93
|
-
|
|
94
|
-
# 生成验证任务(内部使用)
|
|
95
|
-
cat << EOF > /tmp/validation-tasks.md
|
|
96
|
-
# 验证任务 (自动生成)
|
|
97
|
-
|
|
98
|
-
## Phase 1: 基础验证 [并行]
|
|
99
|
-
- [ ] T001 [P] 执行plot-check逻辑
|
|
100
|
-
- [ ] T002 [P] 执行timeline逻辑
|
|
101
|
-
- [ ] T003 [P] 执行relations逻辑
|
|
102
|
-
- [ ] T004 [P] 执行world-check逻辑
|
|
103
|
-
|
|
104
|
-
## Phase 2: 角色验证
|
|
105
|
-
- [ ] T005 加载validation-rules.json
|
|
106
|
-
- [ ] T006 扫描章节角色名称
|
|
107
|
-
- [ ] T007 验证名称一致性
|
|
108
|
-
- [ ] T008 检查称呼准确性
|
|
109
|
-
- [ ] T009 验证行为一致性
|
|
110
|
-
|
|
111
|
-
## Phase 3: 生成报告
|
|
112
|
-
- [ ] T010 汇总结果
|
|
113
|
-
- [ ] T011 标记问题
|
|
114
|
-
- [ ] T012 生成建议
|
|
115
|
-
EOF
|
|
116
|
-
|
|
117
|
-
echo -e "${GREEN} ✅ 验证任务已生成${NC}"
|
|
118
|
-
else
|
|
119
|
-
echo -e "${YELLOW} ⚠️ 未找到验证规则文件${NC}"
|
|
120
|
-
echo " 建议创建 tracking/validation-rules.json"
|
|
121
|
-
fi
|
|
122
|
-
|
|
123
|
-
# Phase 3: 生成报告
|
|
124
|
-
echo -e "${BLUE}Phase 3: 生成验证报告${NC}"
|
|
125
|
-
echo ""
|
|
126
|
-
echo "📊 深度验证报告"
|
|
127
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
128
|
-
echo "AI将分析所有章节并生成详细报告..."
|
|
129
|
-
echo ""
|
|
130
|
-
echo -e "${YELLOW}💡 提示:发现问题后可运行 $0 --fix 自动修复${NC}"
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
# 自动修复模式
|
|
134
|
-
run_auto_fix() {
|
|
135
|
-
echo -e "${GREEN}🔧 执行自动修复...${NC}"
|
|
136
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
137
|
-
|
|
138
|
-
if [[ ! -f "tracking/validation-rules.json" ]]; then
|
|
139
|
-
echo -e "${RED}❌ 需要先运行 --check 生成验证报告${NC}"
|
|
140
|
-
exit 1
|
|
141
|
-
fi
|
|
142
|
-
|
|
143
|
-
# 生成修复任务
|
|
144
|
-
cat << EOF > /tmp/fix-tasks.md
|
|
145
|
-
# 修复任务 (自动生成)
|
|
146
|
-
|
|
147
|
-
## Phase 1: 简单修复 [可自动]
|
|
148
|
-
- [ ] F001 读取验证报告
|
|
149
|
-
- [ ] F002 [P] 修复角色名称错误
|
|
150
|
-
- [ ] F003 [P] 修复称呼错误
|
|
151
|
-
- [ ] F004 [P] 修复简单拼写
|
|
152
|
-
|
|
153
|
-
## Phase 2: 生成报告
|
|
154
|
-
- [ ] F005 汇总修复结果
|
|
155
|
-
- [ ] F006 更新追踪文件
|
|
156
|
-
EOF
|
|
157
|
-
|
|
158
|
-
echo " 生成修复任务..."
|
|
159
|
-
echo " 执行自动修复..."
|
|
160
|
-
echo ""
|
|
161
|
-
echo "🔧 自动修复报告"
|
|
162
|
-
echo "━━━━━━━━━━━━━━━━━━━"
|
|
163
|
-
echo "AI将自动修复简单问题..."
|
|
164
|
-
echo ""
|
|
165
|
-
echo -e "${GREEN}修复完成后建议重新运行 $0 --check 验证${NC}"
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
# 主执行逻辑
|
|
169
|
-
check_files
|
|
170
|
-
|
|
171
|
-
case $MODE in
|
|
172
|
-
"check")
|
|
173
|
-
run_deep_check
|
|
174
|
-
;;
|
|
175
|
-
"fix")
|
|
176
|
-
run_auto_fix
|
|
177
|
-
;;
|
|
178
|
-
"brief"|"plot"|"stats")
|
|
179
|
-
echo "显示${MODE}模式的报告..."
|
|
180
|
-
show_basic_report
|
|
181
|
-
;;
|
|
182
|
-
*)
|
|
183
|
-
show_basic_report
|
|
184
|
-
echo -e "${BLUE}💡 可用选项:${NC}"
|
|
185
|
-
echo " --check : 深度验证所有内容"
|
|
186
|
-
echo " --fix : 自动修复简单问题"
|
|
187
|
-
echo " --brief : 显示简要信息"
|
|
188
|
-
echo " --plot : 仅显示情节追踪"
|
|
189
|
-
echo " --stats : 仅显示统计数据"
|
|
190
|
-
;;
|
|
191
|
-
esac
|
|
192
|
-
|
|
193
|
-
echo ""
|
|
194
|
-
echo -e "${GREEN}✅ 追踪分析完成${NC}"
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
# 故事分析验证脚本
|
|
2
|
-
# 用于 /analyze 命令
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[string]$StoryName,
|
|
6
|
-
[string]$AnalysisType = "full" # full, compliance, quality, progress
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
Set-StrictMode -Version Latest
|
|
10
|
-
$ErrorActionPreference = 'Stop'
|
|
11
|
-
|
|
12
|
-
# 导入通用函数
|
|
13
|
-
. "$PSScriptRoot\common.ps1"
|
|
14
|
-
|
|
15
|
-
# 获取项目根目录
|
|
16
|
-
$ProjectRoot = Get-ProjectRoot
|
|
17
|
-
Set-Location $ProjectRoot
|
|
18
|
-
|
|
19
|
-
# 确定故事路径
|
|
20
|
-
if ([string]::IsNullOrEmpty($StoryName)) {
|
|
21
|
-
$StoryName = Get-ActiveStory
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
$StoryDir = "stories\$StoryName"
|
|
25
|
-
|
|
26
|
-
# 检查必要文件
|
|
27
|
-
function Test-StoryFiles {
|
|
28
|
-
$missingFiles = @()
|
|
29
|
-
|
|
30
|
-
# 检查基准文档
|
|
31
|
-
if (-not (Test-Path "resources\memory\constitution.md")) {
|
|
32
|
-
$missingFiles += "宪法文件"
|
|
33
|
-
}
|
|
34
|
-
if (-not (Test-Path "$StoryDir\specification.md")) {
|
|
35
|
-
$missingFiles += "规格文件"
|
|
36
|
-
}
|
|
37
|
-
if (-not (Test-Path "$StoryDir\creative-plan.md")) {
|
|
38
|
-
$missingFiles += "计划文件"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if ($missingFiles.Count -gt 0) {
|
|
42
|
-
Write-Host "⚠️ 缺少以下基准文档:" -ForegroundColor Yellow
|
|
43
|
-
foreach ($file in $missingFiles) {
|
|
44
|
-
Write-Host " - $file"
|
|
45
|
-
}
|
|
46
|
-
return $false
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return $true
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
# 统计内容
|
|
53
|
-
function Get-ContentAnalysis {
|
|
54
|
-
$contentDir = "$StoryDir\content"
|
|
55
|
-
$totalWords = 0
|
|
56
|
-
$chapterCount = 0
|
|
57
|
-
|
|
58
|
-
if (Test-Path $contentDir) {
|
|
59
|
-
$mdFiles = Get-ChildItem "$contentDir\*.md" -ErrorAction SilentlyContinue
|
|
60
|
-
|
|
61
|
-
foreach ($file in $mdFiles) {
|
|
62
|
-
$chapterCount++
|
|
63
|
-
# 简单的字数统计(中文按字符算)
|
|
64
|
-
$content = Get-Content $file.FullName -Raw
|
|
65
|
-
$words = ($content -replace '\s', '').Length
|
|
66
|
-
$totalWords += $words
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
Write-Host "内容统计:"
|
|
71
|
-
Write-Host " 总字数:$totalWords"
|
|
72
|
-
Write-Host " 章节数:$chapterCount"
|
|
73
|
-
|
|
74
|
-
if ($chapterCount -gt 0) {
|
|
75
|
-
$avgLength = [math]::Round($totalWords / $chapterCount)
|
|
76
|
-
Write-Host " 平均章节长度:$avgLength"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# 检查任务完成度
|
|
81
|
-
function Test-TaskCompletion {
|
|
82
|
-
$tasksFile = "$StoryDir\tasks.md"
|
|
83
|
-
|
|
84
|
-
if (-not (Test-Path $tasksFile)) {
|
|
85
|
-
Write-Host "任务文件不存在"
|
|
86
|
-
return
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
$content = Get-Content $tasksFile -Raw
|
|
90
|
-
$totalTasks = ([regex]::Matches($content, '^- \[', [System.Text.RegularExpressions.RegexOptions]::Multiline)).Count
|
|
91
|
-
$completedTasks = ([regex]::Matches($content, '^- \[x\]', [System.Text.RegularExpressions.RegexOptions]::Multiline)).Count
|
|
92
|
-
$inProgress = ([regex]::Matches($content, '^- \[~\]', [System.Text.RegularExpressions.RegexOptions]::Multiline)).Count
|
|
93
|
-
$pending = $totalTasks - $completedTasks - $inProgress
|
|
94
|
-
|
|
95
|
-
Write-Host "任务进度:"
|
|
96
|
-
Write-Host " 总任务:$totalTasks"
|
|
97
|
-
Write-Host " 已完成:$completedTasks"
|
|
98
|
-
Write-Host " 进行中:$inProgress"
|
|
99
|
-
Write-Host " 未开始:$pending"
|
|
100
|
-
|
|
101
|
-
if ($totalTasks -gt 0) {
|
|
102
|
-
$completionRate = [math]::Round(($completedTasks * 100) / $totalTasks)
|
|
103
|
-
Write-Host " 完成率:$completionRate%"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
# 检查规格符合度
|
|
108
|
-
function Test-SpecificationCompliance {
|
|
109
|
-
$specFile = "$StoryDir\specification.md"
|
|
110
|
-
|
|
111
|
-
Write-Host "规格符合度检查:"
|
|
112
|
-
|
|
113
|
-
if (Test-Path $specFile) {
|
|
114
|
-
$content = Get-Content $specFile -Raw
|
|
115
|
-
|
|
116
|
-
# 检查P0需求(简化版)
|
|
117
|
-
if ($content -match "### 必须包含(P0)") {
|
|
118
|
-
Write-Host " P0需求:检测到,需人工验证"
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
# 检查是否还有[需要澄清]标记
|
|
122
|
-
$unclearCount = ([regex]::Matches($content, '\[需要澄清\]')).Count
|
|
123
|
-
if ($unclearCount -gt 0) {
|
|
124
|
-
Write-Host " ⚠️ 仍有 $unclearCount 处需要澄清" -ForegroundColor Yellow
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
Write-Host " ✅ 所有决策已澄清" -ForegroundColor Green
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
# 主分析流程
|
|
133
|
-
Write-Host "故事分析报告"
|
|
134
|
-
Write-Host "============"
|
|
135
|
-
Write-Host "故事:$StoryName"
|
|
136
|
-
Write-Host "分析时间:$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')"
|
|
137
|
-
Write-Host ""
|
|
138
|
-
|
|
139
|
-
# 检查基准文档
|
|
140
|
-
if (-not (Test-StoryFiles)) {
|
|
141
|
-
Write-Host ""
|
|
142
|
-
Write-Host "❌ 无法进行完整分析,请先完成基准文档" -ForegroundColor Red
|
|
143
|
-
exit 1
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
Write-Host "✅ 基准文档完整" -ForegroundColor Green
|
|
147
|
-
Write-Host ""
|
|
148
|
-
|
|
149
|
-
# 根据分析类型执行
|
|
150
|
-
switch ($AnalysisType) {
|
|
151
|
-
"full" {
|
|
152
|
-
Get-ContentAnalysis
|
|
153
|
-
Write-Host ""
|
|
154
|
-
Test-TaskCompletion
|
|
155
|
-
Write-Host ""
|
|
156
|
-
Test-SpecificationCompliance
|
|
157
|
-
}
|
|
158
|
-
"quality" {
|
|
159
|
-
Get-ContentAnalysis
|
|
160
|
-
}
|
|
161
|
-
"progress" {
|
|
162
|
-
Test-TaskCompletion
|
|
163
|
-
}
|
|
164
|
-
"compliance" {
|
|
165
|
-
Test-SpecificationCompliance
|
|
166
|
-
}
|
|
167
|
-
default {
|
|
168
|
-
Write-Host "未知的分析类型:$AnalysisType" -ForegroundColor Red
|
|
169
|
-
exit 1
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
Write-Host ""
|
|
174
|
-
Write-Host "分析完成。详细报告已保存到:$StoryDir\analysis-report.md"
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# 检测 analyze 命令应该执行的阶段
|
|
3
|
-
# 返回 JSON 格式的阶段信息
|
|
4
|
-
|
|
5
|
-
param(
|
|
6
|
-
[switch]$Json
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
Set-StrictMode -Version Latest
|
|
10
|
-
$ErrorActionPreference = 'Stop'
|
|
11
|
-
|
|
12
|
-
# 加载公共函数
|
|
13
|
-
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
14
|
-
. (Join-Path $scriptDir "common.ps1")
|
|
15
|
-
|
|
16
|
-
# 获取项目根目录和故事目录
|
|
17
|
-
try {
|
|
18
|
-
$projectRoot = Get-ProjectRoot
|
|
19
|
-
$storyDir = Get-CurrentStoryDir
|
|
20
|
-
} catch {
|
|
21
|
-
Write-Error "错误: $_"
|
|
22
|
-
exit 1
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (-not $storyDir) {
|
|
26
|
-
Write-Error "错误: 未找到故事目录"
|
|
27
|
-
exit 1
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# 默认返回值
|
|
31
|
-
$analyzeType = "content"
|
|
32
|
-
$chapterCount = 0
|
|
33
|
-
$hasSpec = $false
|
|
34
|
-
$hasPlan = $false
|
|
35
|
-
$hasTasks = $false
|
|
36
|
-
$reason = ""
|
|
37
|
-
|
|
38
|
-
# 检查规格文件
|
|
39
|
-
$specPath = Join-Path $storyDir "specification.md"
|
|
40
|
-
if (Test-Path $specPath) {
|
|
41
|
-
$hasSpec = $true
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
# 检查计划文件
|
|
45
|
-
$planPath = Join-Path $storyDir "creative-plan.md"
|
|
46
|
-
if (Test-Path $planPath) {
|
|
47
|
-
$hasPlan = $true
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
# 检查任务文件
|
|
51
|
-
$tasksPath = Join-Path $storyDir "tasks.md"
|
|
52
|
-
if (Test-Path $tasksPath) {
|
|
53
|
-
$hasTasks = $true
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# 统计章节数量
|
|
57
|
-
$contentDir = Join-Path $storyDir "content"
|
|
58
|
-
if (-not (Test-Path $contentDir)) {
|
|
59
|
-
$contentDir = Join-Path $storyDir "chapters"
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (Test-Path $contentDir) {
|
|
63
|
-
# 统计 .md 文件数量(排除索引文件)
|
|
64
|
-
$chapters = Get-ChildItem -Path $contentDir -Filter "*.md" -File |
|
|
65
|
-
Where-Object { $_.Name -notin @("README.md", "index.md") }
|
|
66
|
-
$chapterCount = $chapters.Count
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
# 决策逻辑
|
|
70
|
-
if ($chapterCount -eq 0) {
|
|
71
|
-
# 无章节内容 → 框架分析
|
|
72
|
-
$analyzeType = "framework"
|
|
73
|
-
$reason = "无章节内容,建议进行框架一致性分析"
|
|
74
|
-
} elseif ($chapterCount -lt 3) {
|
|
75
|
-
# 章节数量不足 → 框架分析(但提示可以开始写作)
|
|
76
|
-
$analyzeType = "framework"
|
|
77
|
-
$reason = "章节数量较少($chapterCount 章),建议继续写作或进行框架验证"
|
|
78
|
-
} else {
|
|
79
|
-
# 章节充足 → 内容分析
|
|
80
|
-
$analyzeType = "content"
|
|
81
|
-
$reason = "已完成 $chapterCount 章,可进行内容质量分析"
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
# 输出 JSON 或人类可读格式
|
|
85
|
-
if ($Json) {
|
|
86
|
-
# JSON 格式输出
|
|
87
|
-
$output = @{
|
|
88
|
-
analyze_type = $analyzeType
|
|
89
|
-
chapter_count = $chapterCount
|
|
90
|
-
has_spec = $hasSpec
|
|
91
|
-
has_plan = $hasPlan
|
|
92
|
-
has_tasks = $hasTasks
|
|
93
|
-
story_dir = $storyDir
|
|
94
|
-
reason = $reason
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
$output | ConvertTo-Json -Compress
|
|
98
|
-
} else {
|
|
99
|
-
# 人类可读输出
|
|
100
|
-
Write-Host "分析阶段检测结果"
|
|
101
|
-
Write-Host "=================="
|
|
102
|
-
Write-Host "故事目录: $storyDir"
|
|
103
|
-
Write-Host "章节数量: $chapterCount"
|
|
104
|
-
Write-Host "规格文件: $(if ($hasSpec) { '✅' } else { '❌' })"
|
|
105
|
-
Write-Host "计划文件: $(if ($hasPlan) { '✅' } else { '❌' })"
|
|
106
|
-
Write-Host "任务文件: $(if ($hasTasks) { '✅' } else { '❌' })"
|
|
107
|
-
Write-Host ""
|
|
108
|
-
Write-Host "推荐模式: $analyzeType"
|
|
109
|
-
Write-Host "原因: $reason"
|
|
110
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# 综合一致性检查(PowerShell)
|
|
3
|
-
|
|
4
|
-
Set-StrictMode -Version Latest
|
|
5
|
-
$ErrorActionPreference = 'Stop'
|
|
6
|
-
|
|
7
|
-
. "$PSScriptRoot/common.ps1"
|
|
8
|
-
|
|
9
|
-
$root = Get-ProjectRoot
|
|
10
|
-
$storyDir = Get-CurrentStoryDir
|
|
11
|
-
if (-not $storyDir) { throw "未找到故事项目(stories/*)" }
|
|
12
|
-
|
|
13
|
-
$progress = Join-Path $storyDir "progress.json"
|
|
14
|
-
$plot = Join-Path $storyDir "tracking/plot-tracker.json"
|
|
15
|
-
if (-not (Test-Path $plot)) { $plot = Join-Path $root "tracking/plot-tracker.json" }
|
|
16
|
-
$timeline = Join-Path $storyDir "tracking/timeline.json"
|
|
17
|
-
if (-not (Test-Path $timeline)) { $timeline = Join-Path $root "tracking/timeline.json" }
|
|
18
|
-
$rels = Join-Path $storyDir "tracking/relationships.json"
|
|
19
|
-
if (-not (Test-Path $rels)) { $rels = Join-Path $root "tracking/relationships.json" }
|
|
20
|
-
$charState = Join-Path $storyDir "tracking/character-state.json"
|
|
21
|
-
if (-not (Test-Path $charState)) { $charState = Join-Path $root "tracking/character-state.json" }
|
|
22
|
-
|
|
23
|
-
$TOTAL=0; $PASS=0; $WARN=0; $ERR=0
|
|
24
|
-
function Check([string]$name, [bool]$ok, [string]$msg) {
|
|
25
|
-
$script:TOTAL++
|
|
26
|
-
if ($ok) { Write-Host "✓ $name" -ForegroundColor Green; $script:PASS++ }
|
|
27
|
-
else { Write-Host "✗ $name: $msg" -ForegroundColor Red; $script:ERR++ }
|
|
28
|
-
}
|
|
29
|
-
function Warn([string]$msg) { Write-Host "⚠ $msg" -ForegroundColor Yellow; $script:WARN++ }
|
|
30
|
-
|
|
31
|
-
function Check-FileIntegrity {
|
|
32
|
-
Write-Host "📁 检查文件完整性"
|
|
33
|
-
Write-Host "────────────────"
|
|
34
|
-
Check "progress.json" (Test-Path $progress) "文件不存在"
|
|
35
|
-
Check "plot-tracker.json" (Test-Path $plot) "文件不存在"
|
|
36
|
-
Check "timeline.json" (Test-Path $timeline) "文件不存在"
|
|
37
|
-
Check "relationships.json" (Test-Path $rels) "文件不存在"
|
|
38
|
-
Check "character-state.json" (Test-Path $charState) "文件不存在"
|
|
39
|
-
Write-Host ""
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function Check-ChapterConsistency {
|
|
43
|
-
Write-Host "📖 检查章节号一致性"
|
|
44
|
-
Write-Host "───────────────────"
|
|
45
|
-
if ((Test-Path $progress) -and (Test-Path $plot)) {
|
|
46
|
-
$p = Get-Content -LiteralPath $progress -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
47
|
-
$j = Get-Content -LiteralPath $plot -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
48
|
-
$pCh = [int]($p.statistics.currentChapter ?? 0)
|
|
49
|
-
$plCh = [int]($j.currentState.chapter ?? 0)
|
|
50
|
-
Check "章节号同步" ($pCh -eq $plCh) "progress($pCh) != plot-tracker($plCh)"
|
|
51
|
-
if (Test-Path $charState) {
|
|
52
|
-
$cs = Get-Content -LiteralPath $charState -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
53
|
-
# 示例结构中 protagonist 字段不稳定,回退 characters->主角
|
|
54
|
-
$csCh = [int]($cs.protagonist.currentStatus.chapter)
|
|
55
|
-
if (-not $csCh) { $csCh = [int]($cs.characters.'主角'.lastSeen.chapter) }
|
|
56
|
-
if ($csCh) { Check "角色状态章节同步" ($pCh -eq $csCh) "与character-state($csCh)不一致" }
|
|
57
|
-
}
|
|
58
|
-
} else { Warn "部分追踪文件缺失,无法完成章节检查" }
|
|
59
|
-
Write-Host ""
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function Check-TimelineConsistency {
|
|
63
|
-
Write-Host "⏰ 检查时间线连续性"
|
|
64
|
-
Write-Host "───────────────────"
|
|
65
|
-
if (Test-Path $timeline) {
|
|
66
|
-
$j = Get-Content -LiteralPath $timeline -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
67
|
-
$events = @($j.events | Sort-Object chapter)
|
|
68
|
-
$issues=0; $prev=-1
|
|
69
|
-
foreach ($e in $events) { if ($prev -ge 0 -and $e.chapter -le $prev) { $issues++ }; $prev=$e.chapter }
|
|
70
|
-
Check "时间事件顺序" ($issues -eq 0) "发现${issues}个乱序事件"
|
|
71
|
-
$curTime = $j.storyTime.current
|
|
72
|
-
Check "当前时间设置" ([bool]$curTime) "当前故事时间未设置"
|
|
73
|
-
} else { Warn "时间线文件不存在" }
|
|
74
|
-
Write-Host ""
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function Check-CharacterConsistency {
|
|
78
|
-
Write-Host "👥 检查角色状态合理性"
|
|
79
|
-
Write-Host "─────────────────────"
|
|
80
|
-
if ((Test-Path $charState) -and (Test-Path $rels)) {
|
|
81
|
-
$cs = Get-Content -LiteralPath $charState -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
82
|
-
$rel = Get-Content -LiteralPath $rels -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
83
|
-
$name = $cs.protagonist.name
|
|
84
|
-
if (-not $name) { $name = $cs.characters.'主角'.name }
|
|
85
|
-
if ($name) {
|
|
86
|
-
$has = $false
|
|
87
|
-
if ($rel.characters) { $has = $rel.characters.PSObject.Properties.Name -contains $name }
|
|
88
|
-
Check "主角关系记录" $has "主角'$name'在relationships中无记录"
|
|
89
|
-
}
|
|
90
|
-
$loc = $cs.protagonist.currentStatus.location
|
|
91
|
-
if (-not $loc) { $loc = $cs.characters.'主角'.location }
|
|
92
|
-
Check "主角位置记录" ([bool]$loc) "主角当前位置未记录"
|
|
93
|
-
} else { Warn "角色追踪文件不完整" }
|
|
94
|
-
Write-Host ""
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function Check-ForeshadowingPlan {
|
|
98
|
-
Write-Host "🎯 检查伏笔管理"
|
|
99
|
-
Write-Host "──────────────"
|
|
100
|
-
if (Test-Path $plot) {
|
|
101
|
-
$j = Get-Content -LiteralPath $plot -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
102
|
-
$fs = @($j.foreshadowing)
|
|
103
|
-
$total = $fs.Count
|
|
104
|
-
$active = @($fs | Where-Object { $_.status -eq 'active' }).Count
|
|
105
|
-
Write-Host " 📊 伏笔统计: 总计${total}个,活跃${active}个"
|
|
106
|
-
if ($active -gt 10) { Warn "活跃伏笔过多(${active}个),可能造成读者困惑" }
|
|
107
|
-
} else { Warn "情节追踪文件不存在" }
|
|
108
|
-
Write-Host ""
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
Write-Host "═══════════════════════════════════════"
|
|
112
|
-
Write-Host "📊 综合一致性检查报告"
|
|
113
|
-
Write-Host "═══════════════════════════════════════"
|
|
114
|
-
Write-Host ""
|
|
115
|
-
|
|
116
|
-
Check-FileIntegrity
|
|
117
|
-
Check-ChapterConsistency
|
|
118
|
-
Check-TimelineConsistency
|
|
119
|
-
Check-CharacterConsistency
|
|
120
|
-
Check-ForeshadowingPlan
|
|
121
|
-
|
|
122
|
-
Write-Host "═══════════════════════════════════════"
|
|
123
|
-
Write-Host "📈 检查结果汇总"
|
|
124
|
-
Write-Host "───────────────────"
|
|
125
|
-
Write-Host " 总检查项: $TOTAL"
|
|
126
|
-
Write-Host " 通过: $PASS"
|
|
127
|
-
Write-Host " 警告: $WARN"
|
|
128
|
-
Write-Host " 错误: $ERR"
|
|
129
|
-
|
|
130
|
-
if ($ERR -eq 0 -and $WARN -eq 0) { Write-Host "`n✅ 完美!所有检查项全部通过" -ForegroundColor Green }
|
|
131
|
-
elseif ($ERR -eq 0) { Write-Host "`n⚠️ 存在$WARN 个警告,建议关注" -ForegroundColor Yellow }
|
|
132
|
-
else { Write-Host "`n❌ 发现$ERR 个错误,需要修正" -ForegroundColor Red }
|
|
133
|
-
|
|
134
|
-
Write-Host "═══════════════════════════════════════"
|
|
135
|
-
Write-Host "检查时间: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')"
|
|
136
|
-
|
|
137
|
-
if ($ERR -gt 0) { exit 1 } else { exit 0 }
|
|
138
|
-
|