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,195 +0,0 @@
|
|
|
1
|
-
# check-facts.ps1 - Story Facts 引用扫描脚本
|
|
2
|
-
# 扫描章节中的 story-facts 注释,生成引用报告
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[switch]$Json,
|
|
6
|
-
[string]$Story = ""
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
$ErrorActionPreference = "Stop"
|
|
10
|
-
|
|
11
|
-
# 获取项目根目录
|
|
12
|
-
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
13
|
-
$ProjectRoot = (Get-Item (Join-Path $ScriptDir ".." "..")).FullName
|
|
14
|
-
|
|
15
|
-
# 检查 story-facts.json 是否存在
|
|
16
|
-
$FactsFile = Join-Path $ProjectRoot "spec" "tracking" "story-facts.json"
|
|
17
|
-
if (-not (Test-Path $FactsFile)) {
|
|
18
|
-
if ($Json) {
|
|
19
|
-
$errorObj = @{
|
|
20
|
-
error = "story-facts.json not found"
|
|
21
|
-
chapters = @()
|
|
22
|
-
unreferenced_facts = @()
|
|
23
|
-
unknown_ids = @()
|
|
24
|
-
}
|
|
25
|
-
Write-Output ($errorObj | ConvertTo-Json -Compress)
|
|
26
|
-
} else {
|
|
27
|
-
Write-Host "❌ 未找到 story-facts.json" -ForegroundColor Red
|
|
28
|
-
Write-Host " 路径: $FactsFile"
|
|
29
|
-
Write-Host " 请先使用 /facts 命令初始化"
|
|
30
|
-
}
|
|
31
|
-
exit 1
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# 读取已注册的 fact ID 列表
|
|
35
|
-
try {
|
|
36
|
-
$factsData = Get-Content $FactsFile -Raw | ConvertFrom-Json
|
|
37
|
-
$registeredFacts = $factsData.facts | ForEach-Object { $_.id }
|
|
38
|
-
if ($null -eq $registeredFacts) {
|
|
39
|
-
$registeredFacts = @()
|
|
40
|
-
} elseif ($registeredFacts -isnot [array]) {
|
|
41
|
-
$registeredFacts = @($registeredFacts)
|
|
42
|
-
}
|
|
43
|
-
} catch {
|
|
44
|
-
if ($Json) {
|
|
45
|
-
$errorObj = @{
|
|
46
|
-
error = "Failed to parse story-facts.json: $_"
|
|
47
|
-
chapters = @()
|
|
48
|
-
unreferenced_facts = @()
|
|
49
|
-
unknown_ids = @()
|
|
50
|
-
}
|
|
51
|
-
Write-Output ($errorObj | ConvertTo-Json -Compress)
|
|
52
|
-
} else {
|
|
53
|
-
Write-Host "❌ 无法解析 story-facts.json: $_" -ForegroundColor Red
|
|
54
|
-
}
|
|
55
|
-
exit 1
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# 确定扫描目录
|
|
59
|
-
if ($Story) {
|
|
60
|
-
$ContentDir = Join-Path $ProjectRoot "stories" $Story "content"
|
|
61
|
-
if (-not (Test-Path $ContentDir)) {
|
|
62
|
-
if ($Json) {
|
|
63
|
-
$errorObj = @{
|
|
64
|
-
error = "story directory not found: $Story"
|
|
65
|
-
chapters = @()
|
|
66
|
-
unreferenced_facts = @()
|
|
67
|
-
unknown_ids = @()
|
|
68
|
-
}
|
|
69
|
-
Write-Output ($errorObj | ConvertTo-Json -Compress)
|
|
70
|
-
} else {
|
|
71
|
-
Write-Host "❌ 未找到故事目录: $Story" -ForegroundColor Red
|
|
72
|
-
}
|
|
73
|
-
exit 1
|
|
74
|
-
}
|
|
75
|
-
$chapterFiles = Get-ChildItem -Path $ContentDir -Filter "*.md" -File
|
|
76
|
-
} else {
|
|
77
|
-
$storiesDir = Join-Path $ProjectRoot "stories"
|
|
78
|
-
if (Test-Path $storiesDir) {
|
|
79
|
-
$chapterFiles = Get-ChildItem -Path $storiesDir -Recurse -Filter "*.md" -File |
|
|
80
|
-
Where-Object { $_.FullName -match '\\content\\[^\\]+\.md$' }
|
|
81
|
-
} else {
|
|
82
|
-
$chapterFiles = @()
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
# 初始化数据结构
|
|
87
|
-
$chapterFacts = @{} # key: 文件路径, value: fact IDs 数组
|
|
88
|
-
$factReferenced = @{} # key: fact ID, value: $true if referenced
|
|
89
|
-
$unknownIdsMap = @{} # key: unknown ID, value: $true
|
|
90
|
-
|
|
91
|
-
# 扫描章节文件
|
|
92
|
-
foreach ($file in $chapterFiles) {
|
|
93
|
-
$content = Get-Content $file.FullName -Raw
|
|
94
|
-
|
|
95
|
-
# 提取 <!-- story-facts: ... --> 注释
|
|
96
|
-
# 正则:<!-- story-facts: (.+?) -->
|
|
97
|
-
$match = [regex]::Match($content, '<!--\s*story-facts:\s*([^-]+?)\s*-->')
|
|
98
|
-
|
|
99
|
-
if ($match.Success) {
|
|
100
|
-
$factsLine = $match.Groups[1].Value.Trim()
|
|
101
|
-
|
|
102
|
-
# 分割为数组并去除空格
|
|
103
|
-
$factIds = $factsLine -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
|
|
104
|
-
|
|
105
|
-
if ($factIds.Count -gt 0) {
|
|
106
|
-
$cleanedIds = @()
|
|
107
|
-
|
|
108
|
-
foreach ($id in $factIds) {
|
|
109
|
-
$cleanedIds += $id
|
|
110
|
-
|
|
111
|
-
# 检查是否已注册
|
|
112
|
-
if ($registeredFacts -contains $id) {
|
|
113
|
-
$factReferenced[$id] = $true
|
|
114
|
-
} else {
|
|
115
|
-
$unknownIdsMap[$id] = $true
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
$chapterFacts[$file.FullName] = $cleanedIds
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
# 计算未被引用的事实
|
|
125
|
-
$unreferencedFacts = @()
|
|
126
|
-
foreach ($factId in $registeredFacts) {
|
|
127
|
-
if (-not $factReferenced.ContainsKey($factId)) {
|
|
128
|
-
$unreferencedFacts += $factId
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
# 收集 unknown IDs
|
|
133
|
-
$unknownIds = @($unknownIdsMap.Keys)
|
|
134
|
-
|
|
135
|
-
# 输出结果
|
|
136
|
-
if ($Json) {
|
|
137
|
-
# JSON 输出
|
|
138
|
-
$chapters = @()
|
|
139
|
-
foreach ($file in $chapterFacts.Keys) {
|
|
140
|
-
$relPath = $file.Replace($ProjectRoot + "\", "").Replace("\", "/")
|
|
141
|
-
$chapters += @{
|
|
142
|
-
file = $relPath
|
|
143
|
-
facts = $chapterFacts[$file]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
$result = @{
|
|
148
|
-
chapters = $chapters
|
|
149
|
-
unreferenced_facts = $unreferencedFacts
|
|
150
|
-
unknown_ids = $unknownIds
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
Write-Output ($result | ConvertTo-Json -Depth 10 -Compress)
|
|
154
|
-
} else {
|
|
155
|
-
# 人类可读输出
|
|
156
|
-
Write-Host ""
|
|
157
|
-
Write-Host "📊 Story Facts 引用报告" -ForegroundColor Cyan
|
|
158
|
-
Write-Host ("━" * 40)
|
|
159
|
-
Write-Host ""
|
|
160
|
-
|
|
161
|
-
Write-Host "已注册事实: " -NoNewline
|
|
162
|
-
Write-Host "$($registeredFacts.Count) 个" -ForegroundColor Green
|
|
163
|
-
Write-Host "引用章节: " -NoNewline
|
|
164
|
-
Write-Host "$($chapterFacts.Count) 个" -ForegroundColor Green
|
|
165
|
-
Write-Host ""
|
|
166
|
-
|
|
167
|
-
if ($chapterFacts.Count -gt 0) {
|
|
168
|
-
Write-Host "章节引用:" -ForegroundColor White
|
|
169
|
-
foreach ($file in $chapterFacts.Keys) {
|
|
170
|
-
$filename = Split-Path -Leaf $file
|
|
171
|
-
$facts = $chapterFacts[$file] -join ", "
|
|
172
|
-
Write-Host " " -NoNewline
|
|
173
|
-
Write-Host $filename -ForegroundColor Blue -NoNewline
|
|
174
|
-
Write-Host " → $facts"
|
|
175
|
-
}
|
|
176
|
-
Write-Host ""
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if ($unreferencedFacts.Count -gt 0) {
|
|
180
|
-
Write-Host "未被引用的事实: " -ForegroundColor Yellow -NoNewline
|
|
181
|
-
Write-Host ($unreferencedFacts -join ", ")
|
|
182
|
-
Write-Host ""
|
|
183
|
-
} else {
|
|
184
|
-
Write-Host "✓ 所有事实都被至少一个章节引用" -ForegroundColor Green
|
|
185
|
-
Write-Host ""
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if ($unknownIds.Count -gt 0) {
|
|
189
|
-
Write-Host "未知 ID (章节中引用但未注册): " -ForegroundColor Red -NoNewline
|
|
190
|
-
Write-Host ($unknownIds -join ", ")
|
|
191
|
-
Write-Host " 提示: 可能是拼写错误或需要注册到 story-facts.json" -ForegroundColor Yellow
|
|
192
|
-
} else {
|
|
193
|
-
Write-Host "✓ 未检测到未知 ID" -ForegroundColor Green
|
|
194
|
-
}
|
|
195
|
-
}
|
|
@@ -1,139 +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
|
-
$plotPath = Join-Path $storyDir "tracking/plot-tracker.json"
|
|
14
|
-
if (-not (Test-Path $plotPath)) { $plotPath = Join-Path $root "tracking/plot-tracker.json" }
|
|
15
|
-
$outlinePath = Join-Path $storyDir "creative-plan.md"
|
|
16
|
-
$progressPath = Join-Path $storyDir "progress.json"
|
|
17
|
-
|
|
18
|
-
function Ensure-PlotTracker {
|
|
19
|
-
if (-not (Test-Path $plotPath)) {
|
|
20
|
-
Write-Host "⚠️ 未找到情节追踪文件,正在创建..."
|
|
21
|
-
$tpl = Join-Path $root "templates/tracking/plot-tracker.json"
|
|
22
|
-
if (-not (Test-Path $tpl)) { throw "无法找到模板文件" }
|
|
23
|
-
New-Item -ItemType Directory -Path (Split-Path $plotPath -Parent) -Force | Out-Null
|
|
24
|
-
Copy-Item $tpl $plotPath -Force
|
|
25
|
-
}
|
|
26
|
-
if (-not (Test-Path $outlinePath)) { throw "未找到创作计划 creative-plan.md,请先使用 /plan" }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function Get-CurrentProgress {
|
|
30
|
-
if (Test-Path $progressPath) {
|
|
31
|
-
$p = Get-Content -LiteralPath $progressPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
32
|
-
return @{ chapter = ($p.statistics.currentChapter ?? 1); volume = ($p.statistics.currentVolume ?? 1) }
|
|
33
|
-
}
|
|
34
|
-
if (Test-Path $plotPath) {
|
|
35
|
-
$j = Get-Content -LiteralPath $plotPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
36
|
-
return @{ chapter = ($j.currentState.chapter ?? 1); volume = ($j.currentState.volume ?? 1) }
|
|
37
|
-
}
|
|
38
|
-
return @{ chapter = 1; volume = 1 }
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function Analyze-PlotAlignment {
|
|
42
|
-
Write-Host "📊 情节发展检查报告"
|
|
43
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━"
|
|
44
|
-
$cur = Get-CurrentProgress
|
|
45
|
-
Write-Host "📍 当前进度:第$($cur.chapter)章(第$($cur.volume)卷)"
|
|
46
|
-
|
|
47
|
-
if (Test-Path $plotPath) {
|
|
48
|
-
$j = Get-Content -LiteralPath $plotPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
49
|
-
$main = $j.plotlines.main
|
|
50
|
-
$mainPlot = $main.currentNode
|
|
51
|
-
$status = $main.status
|
|
52
|
-
Write-Host "📖 主线进度:$mainPlot [$status]"
|
|
53
|
-
|
|
54
|
-
$completed = @($main.completedNodes)
|
|
55
|
-
Write-Host ""
|
|
56
|
-
Write-Host "✅ 已完成节点:$($completed.Count)个"
|
|
57
|
-
$completed | ForEach-Object { Write-Host " • $_" }
|
|
58
|
-
|
|
59
|
-
$upcoming = @($main.upcomingNodes)
|
|
60
|
-
if ($upcoming.Count -gt 0) {
|
|
61
|
-
Write-Host ""
|
|
62
|
-
Write-Host "→ 接下来的节点:"
|
|
63
|
-
$upcoming | Select-Object -First 3 | ForEach-Object { Write-Host " • $_" }
|
|
64
|
-
}
|
|
65
|
-
return @{ cur = $cur; json = $j }
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function Check-Foreshadowing($state) {
|
|
70
|
-
Write-Host ""
|
|
71
|
-
Write-Host "🎯 伏笔追踪"
|
|
72
|
-
Write-Host "───────────"
|
|
73
|
-
$j = $state.json
|
|
74
|
-
$curCh = [int]$state.cur.chapter
|
|
75
|
-
$fs = @($j.foreshadowing)
|
|
76
|
-
$total = $fs.Count
|
|
77
|
-
$active = @($fs | Where-Object { $_.status -eq 'active' }).Count
|
|
78
|
-
$resolved = @($fs | Where-Object { $_.status -eq 'resolved' }).Count
|
|
79
|
-
Write-Host "统计:总计${total}个,活跃${active}个,已回收${resolved}个"
|
|
80
|
-
|
|
81
|
-
if ($active -gt 0) {
|
|
82
|
-
Write-Host ""
|
|
83
|
-
Write-Host "⚠️ 待处理伏笔:"
|
|
84
|
-
$fs | Where-Object { $_.status -eq 'active' } | ForEach-Object {
|
|
85
|
-
$ch = $_.planted.chapter
|
|
86
|
-
Write-Host " • $($_.content)(第$ch章埋设)"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
$overdue = @($fs | Where-Object { $_.status -eq 'active' -and $_.planted.chapter -and ($curCh - [int]$_.planted.chapter) -gt 30 }).Count
|
|
91
|
-
if ($overdue -gt 0) { Write-Host ""; Write-Host "⚠️ 警告:有${overdue}个伏笔超过30章未处理" }
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function Check-Conflicts($state) {
|
|
95
|
-
Write-Host ""
|
|
96
|
-
Write-Host "⚔️ 冲突追踪"
|
|
97
|
-
Write-Host "───────────"
|
|
98
|
-
$active = @($state.json.conflicts.active)
|
|
99
|
-
$count = $active.Count
|
|
100
|
-
if ($count -gt 0) {
|
|
101
|
-
Write-Host "当前活跃冲突:${count}个"
|
|
102
|
-
$active | ForEach-Object { Write-Host (" • " + $_.name + " [" + $_.intensity + "]") }
|
|
103
|
-
} else { Write-Host "暂无活跃冲突" }
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function Generate-Suggestions($state) {
|
|
107
|
-
Write-Host ""
|
|
108
|
-
Write-Host "💡 建议"
|
|
109
|
-
Write-Host "───────"
|
|
110
|
-
$ch = [int]$state.cur.chapter
|
|
111
|
-
if ($ch -lt 10) { Write-Host "• 前10章是关键,确保有足够的钩子吸引读者" }
|
|
112
|
-
elseif ($ch -lt 30) { Write-Host "• 接近第一个小高潮,检查冲突是否足够激烈" }
|
|
113
|
-
elseif (($ch % 60) -gt 50) { Write-Host "• 接近卷尾,准备高潮和悬念设置" }
|
|
114
|
-
|
|
115
|
-
$activeFo = @($state.json.foreshadowing | Where-Object { $_.status -eq 'active' }).Count
|
|
116
|
-
if ($activeFo -gt 5) { Write-Host "• 活跃伏笔较多,考虑在接下来几章回收部分" }
|
|
117
|
-
$activeConf = @($state.json.conflicts.active).Count
|
|
118
|
-
if ($activeConf -eq 0 -and $ch -gt 5) { Write-Host "• 当前无活跃冲突,考虑引入新的矛盾点" }
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
Write-Host "🔍 开始检查情节一致性..."
|
|
122
|
-
Write-Host ""
|
|
123
|
-
Ensure-PlotTracker
|
|
124
|
-
$st = Analyze-PlotAlignment
|
|
125
|
-
Check-Foreshadowing $st
|
|
126
|
-
Check-Conflicts $st
|
|
127
|
-
Generate-Suggestions $st
|
|
128
|
-
|
|
129
|
-
Write-Host ""
|
|
130
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━"
|
|
131
|
-
Write-Host "✅ 检查完成"
|
|
132
|
-
|
|
133
|
-
# 更新时间戳
|
|
134
|
-
if (Test-Path $plotPath) {
|
|
135
|
-
$json = Get-Content -LiteralPath $plotPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
136
|
-
$json.lastUpdated = (Get-Date).ToString('yyyy-MM-ddTHH:mm:ss')
|
|
137
|
-
$json | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $plotPath -Encoding UTF8
|
|
138
|
-
}
|
|
139
|
-
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# 时间线管理与检查(PowerShell)
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[ValidateSet('show','add','check','sync')]
|
|
6
|
-
[string]$Command = 'show',
|
|
7
|
-
[string]$Param1,
|
|
8
|
-
[string]$Param2
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
Set-StrictMode -Version Latest
|
|
12
|
-
$ErrorActionPreference = 'Stop'
|
|
13
|
-
|
|
14
|
-
. "$PSScriptRoot/common.ps1"
|
|
15
|
-
|
|
16
|
-
$root = Get-ProjectRoot
|
|
17
|
-
$storyDir = Get-CurrentStoryDir
|
|
18
|
-
if (-not $storyDir) { throw "未找到故事项目(stories/*)" }
|
|
19
|
-
|
|
20
|
-
$timelinePath = Join-Path $storyDir "tracking/timeline.json"
|
|
21
|
-
if (-not (Test-Path $timelinePath)) { $timelinePath = Join-Path $root "tracking/timeline.json" }
|
|
22
|
-
|
|
23
|
-
function Init-Timeline {
|
|
24
|
-
if (-not (Test-Path $timelinePath)) {
|
|
25
|
-
Write-Host "⚠️ 未找到时间线文件,正在创建..."
|
|
26
|
-
$tpl = Join-Path $root "templates/tracking/timeline.json"
|
|
27
|
-
if (-not (Test-Path $tpl)) { throw "无法找到模板文件" }
|
|
28
|
-
New-Item -ItemType Directory -Path (Split-Path $timelinePath -Parent) -Force | Out-Null
|
|
29
|
-
Copy-Item $tpl $timelinePath -Force
|
|
30
|
-
Write-Host "✅ 时间线文件已创建"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function Show-Timeline {
|
|
35
|
-
Write-Host "📅 故事时间线"
|
|
36
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━"
|
|
37
|
-
if (-not (Test-Path $timelinePath)) { Write-Host "未找到时间线文件"; return }
|
|
38
|
-
$j = Get-Content -LiteralPath $timelinePath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
39
|
-
$cur = $j.storyTime.current
|
|
40
|
-
if (-not $cur) { $cur = '未设定' }
|
|
41
|
-
Write-Host "⏰ 当前时间:$cur"
|
|
42
|
-
Write-Host ""
|
|
43
|
-
$events = @($j.events)
|
|
44
|
-
if ($events.Count -gt 0) {
|
|
45
|
-
Write-Host "📖 重要事件:"
|
|
46
|
-
Write-Host "───────────────"
|
|
47
|
-
$events | Sort-Object chapter -Descending | Select-Object -First 5 | ForEach-Object {
|
|
48
|
-
Write-Host ("第{0}章 | {1} | {2}" -f $_.chapter, $_.date, $_.event)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
$p = $j.parallelEvents.timepoints
|
|
52
|
-
if ($p) {
|
|
53
|
-
Write-Host ""
|
|
54
|
-
Write-Host "🔄 并行事件:"
|
|
55
|
-
$p.PSObject.Properties | ForEach-Object { Write-Host ("{0}: {1}" -f $_.Name, (@($_.Value) -join ', ')) }
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function Add-Event([int]$chapter, [string]$date, [string]$event) {
|
|
60
|
-
if (-not $chapter -or -not $date -or -not $event) { throw "用法: check-timeline.ps1 add <章节号> <时间> <事件描述>" }
|
|
61
|
-
Init-Timeline
|
|
62
|
-
$j = Get-Content -LiteralPath $timelinePath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
63
|
-
if (-not $j.events) { $j | Add-Member -NotePropertyName events -NotePropertyValue @() }
|
|
64
|
-
$j.events += [pscustomobject]@{ chapter=$chapter; date=$date; event=$event; duration=''; participants=@() }
|
|
65
|
-
$j.events = @($j.events | Sort-Object chapter)
|
|
66
|
-
$j.lastUpdated = (Get-Date).ToString('yyyy-MM-ddTHH:mm:ss')
|
|
67
|
-
$j | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $timelinePath -Encoding UTF8
|
|
68
|
-
Write-Host "✅ 事件已添加:第${chapter}章 - $date - $event"
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function Check-Continuity {
|
|
72
|
-
Write-Host "🔍 检查时间线连续性"
|
|
73
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━"
|
|
74
|
-
if (-not (Test-Path $timelinePath)) { throw "时间线文件不存在" }
|
|
75
|
-
$j = Get-Content -LiteralPath $timelinePath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
76
|
-
$chapters = @($j.events | Sort-Object chapter | ForEach-Object { $_.chapter })
|
|
77
|
-
$issues = 0
|
|
78
|
-
$prev = -1
|
|
79
|
-
foreach ($c in $chapters) {
|
|
80
|
-
if ($prev -ge 0 -and $c -le $prev) {
|
|
81
|
-
Write-Host "⚠️ 章节顺序异常:第$c 章出现在第$prev 章之后"
|
|
82
|
-
$issues++
|
|
83
|
-
}
|
|
84
|
-
$prev = $c
|
|
85
|
-
}
|
|
86
|
-
if ($issues -eq 0) { Write-Host "`n✅ 时间线检查通过,未发现逻辑问题" }
|
|
87
|
-
else { Write-Host "`n⚠️ 发现${issues}个潜在问题,请检查" }
|
|
88
|
-
$j.lastChecked = (Get-Date).ToString('yyyy-MM-ddTHH:mm:ss')
|
|
89
|
-
if (-not $j.anomalies) { $j | Add-Member anomalies (@{}) }
|
|
90
|
-
$j.anomalies.lastCheckIssues = $issues
|
|
91
|
-
$j | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $timelinePath -Encoding UTF8
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function Sync-Parallel([string]$timepoint, [string]$eventsCsv) {
|
|
95
|
-
if (-not $timepoint -or -not $eventsCsv) { throw "用法: check-timeline.ps1 sync <时间点> <事件列表,逗号分隔>" }
|
|
96
|
-
Init-Timeline
|
|
97
|
-
$j = Get-Content -LiteralPath $timelinePath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
98
|
-
if (-not $j.parallelEvents) { $j | Add-Member -NotePropertyName parallelEvents -NotePropertyValue @{ timepoints=@{} } }
|
|
99
|
-
$events = $eventsCsv.Split(',').Trim()
|
|
100
|
-
$j.parallelEvents.timepoints[$timepoint] = $events
|
|
101
|
-
$j.lastUpdated = (Get-Date).ToString('yyyy-MM-ddTHH:mm:ss')
|
|
102
|
-
$j | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $timelinePath -Encoding UTF8
|
|
103
|
-
Write-Host "✅ 并行事件已同步:$timepoint"
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
switch ($Command) {
|
|
107
|
-
'show' { Init-Timeline; Show-Timeline }
|
|
108
|
-
'add' { Add-Event -chapter ([int]$Param1) -date $Param2 -event ($args | Select-Object -Skip 2 | Out-String).Trim() }
|
|
109
|
-
'check' { Check-Continuity }
|
|
110
|
-
'sync' { Sync-Parallel -timepoint $Param1 -eventsCsv $Param2 }
|
|
111
|
-
}
|
|
112
|
-
|