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,145 +0,0 @@
|
|
|
1
|
-
# 小说创作宪法管理脚本
|
|
2
|
-
# 用于 /constitution 命令
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[string]$Command = "check"
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
Set-StrictMode -Version Latest
|
|
9
|
-
$ErrorActionPreference = 'Stop'
|
|
10
|
-
|
|
11
|
-
# 导入通用函数
|
|
12
|
-
. "$PSScriptRoot\common.ps1"
|
|
13
|
-
|
|
14
|
-
# 获取项目根目录
|
|
15
|
-
$ProjectRoot = Get-ProjectRoot
|
|
16
|
-
Set-Location $ProjectRoot
|
|
17
|
-
|
|
18
|
-
# 定义文件路径
|
|
19
|
-
$ConstitutionFile = "resources\memory\constitution.md"
|
|
20
|
-
|
|
21
|
-
switch ($Command) {
|
|
22
|
-
"check" {
|
|
23
|
-
# 检查宪法文件是否存在
|
|
24
|
-
if (Test-Path $ConstitutionFile) {
|
|
25
|
-
Write-Host "✅ 宪法文件已存在:$ConstitutionFile" -ForegroundColor Green
|
|
26
|
-
|
|
27
|
-
# 提取版本信息
|
|
28
|
-
$content = Get-Content $ConstitutionFile -Raw
|
|
29
|
-
if ($content -match "- 版本:(.+)") {
|
|
30
|
-
$version = $matches[1].Trim()
|
|
31
|
-
} else {
|
|
32
|
-
$version = "未知"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if ($content -match "- 最后修订:(.+)") {
|
|
36
|
-
$updated = $matches[1].Trim()
|
|
37
|
-
} else {
|
|
38
|
-
$updated = "未知"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Write-Host " 版本:$version"
|
|
42
|
-
Write-Host " 最后修订:$updated"
|
|
43
|
-
exit 0
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
Write-Host "❌ 尚未创建宪法文件" -ForegroundColor Red
|
|
47
|
-
Write-Host " 建议:运行 /constitution 创建创作宪法"
|
|
48
|
-
exit 1
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
"init" {
|
|
53
|
-
# 初始化宪法文件
|
|
54
|
-
$dir = Split-Path $ConstitutionFile -Parent
|
|
55
|
-
if (-not (Test-Path $dir)) {
|
|
56
|
-
New-Item -ItemType Directory -Path $dir -Force | Out-Null
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (Test-Path $ConstitutionFile) {
|
|
60
|
-
Write-Host "宪法文件已存在,准备更新"
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
Write-Host "准备创建新的宪法文件"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
"validate" {
|
|
68
|
-
# 验证宪法文件格式
|
|
69
|
-
if (-not (Test-Path $ConstitutionFile)) {
|
|
70
|
-
Write-Host "错误:宪法文件不存在" -ForegroundColor Red
|
|
71
|
-
exit 1
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
Write-Host "验证宪法文件..."
|
|
75
|
-
|
|
76
|
-
# 检查必要章节
|
|
77
|
-
$requiredSections = @("核心价值观", "质量标准", "创作风格", "内容规范", "读者契约")
|
|
78
|
-
$content = Get-Content $ConstitutionFile -Raw
|
|
79
|
-
$missingSections = @()
|
|
80
|
-
|
|
81
|
-
foreach ($section in $requiredSections) {
|
|
82
|
-
if ($content -notmatch "## .* $section") {
|
|
83
|
-
$missingSections += $section
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if ($missingSections.Count -gt 0) {
|
|
88
|
-
Write-Host "⚠️ 缺少以下章节:" -ForegroundColor Yellow
|
|
89
|
-
foreach ($section in $missingSections) {
|
|
90
|
-
Write-Host " - $section"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
Write-Host "✅ 所有必要章节都存在" -ForegroundColor Green
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
# 检查版本信息
|
|
98
|
-
if ($content -match "^- 版本:") {
|
|
99
|
-
Write-Host "✅ 版本信息完整" -ForegroundColor Green
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
Write-Host "⚠️ 缺少版本信息" -ForegroundColor Yellow
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
"export" {
|
|
107
|
-
# 导出宪法摘要
|
|
108
|
-
if (-not (Test-Path $ConstitutionFile)) {
|
|
109
|
-
Write-Host "错误:宪法文件不存在" -ForegroundColor Red
|
|
110
|
-
exit 1
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
Write-Host "# 创作宪法摘要"
|
|
114
|
-
Write-Host ""
|
|
115
|
-
|
|
116
|
-
$content = Get-Content $ConstitutionFile -Raw
|
|
117
|
-
|
|
118
|
-
# 提取核心原则
|
|
119
|
-
Write-Host "## 核心原则"
|
|
120
|
-
if ($content -match "### 原则[\s\S]*?\*\*声明\*\*:(.+)") {
|
|
121
|
-
Write-Host $matches[1]
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
Write-Host "(未找到原则声明)"
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
Write-Host ""
|
|
128
|
-
Write-Host "## 质量底线"
|
|
129
|
-
if ($content -match "### 标准[\s\S]*?\*\*要求\*\*:(.+)") {
|
|
130
|
-
Write-Host $matches[1]
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
Write-Host "(未找到质量标准)"
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
Write-Host ""
|
|
137
|
-
Write-Host "详细内容请查看:$ConstitutionFile"
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
default {
|
|
141
|
-
Write-Host "未知命令:$Command" -ForegroundColor Red
|
|
142
|
-
Write-Host "支持的命令:check, init, validate, export"
|
|
143
|
-
exit 1
|
|
144
|
-
}
|
|
145
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# 生成写作任务
|
|
3
|
-
# 用于 /tasks 命令
|
|
4
|
-
|
|
5
|
-
Set-StrictMode -Version Latest
|
|
6
|
-
$ErrorActionPreference = 'Stop'
|
|
7
|
-
|
|
8
|
-
. "$PSScriptRoot/common.ps1"
|
|
9
|
-
|
|
10
|
-
$root = Get-ProjectRoot
|
|
11
|
-
Set-Location $root
|
|
12
|
-
|
|
13
|
-
$storyDir = Get-CurrentStoryDir
|
|
14
|
-
if (-not $storyDir) {
|
|
15
|
-
Write-Host "错误:没有找到故事项目"
|
|
16
|
-
Write-Host "请先使用 /specify 命令创建故事规格"
|
|
17
|
-
exit 1
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
$storyName = Split-Path $storyDir -Leaf
|
|
21
|
-
$outlineFile = Join-Path $storyDir "creative-plan.md"
|
|
22
|
-
$tasksFile = Join-Path $storyDir "tasks.md"
|
|
23
|
-
$progressFile = Join-Path $storyDir "progress.json"
|
|
24
|
-
|
|
25
|
-
if (-not (Test-Path $outlineFile)) {
|
|
26
|
-
Write-Host "错误:没有找到创作计划"
|
|
27
|
-
Write-Host "请先使用 /plan 命令创建创作计划"
|
|
28
|
-
exit 1
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
# 获取当前日期
|
|
32
|
-
$currentDate = Get-Date -Format "yyyy-MM-dd"
|
|
33
|
-
$currentDateTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
|
34
|
-
|
|
35
|
-
# 创建任务文件,预先填充基础信息
|
|
36
|
-
$tasksContent = @"
|
|
37
|
-
# 写作任务清单
|
|
38
|
-
|
|
39
|
-
## 任务概览
|
|
40
|
-
- **创建日期**:$currentDate
|
|
41
|
-
- **最后更新**:$currentDate
|
|
42
|
-
- **任务状态**:待生成
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
"@
|
|
46
|
-
$tasksContent | Out-File -FilePath $tasksFile -Encoding UTF8
|
|
47
|
-
|
|
48
|
-
# 创建或更新进度文件
|
|
49
|
-
if (-not (Test-Path $progressFile)) {
|
|
50
|
-
$progressContent = @{
|
|
51
|
-
created_at = $currentDateTime
|
|
52
|
-
updated_at = $currentDateTime
|
|
53
|
-
total_chapters = 0
|
|
54
|
-
completed = 0
|
|
55
|
-
in_progress = 0
|
|
56
|
-
word_count = 0
|
|
57
|
-
} | ConvertTo-Json
|
|
58
|
-
$progressContent | Out-File -FilePath $progressFile -Encoding UTF8
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
Write-Host "故事目录: $storyDir"
|
|
62
|
-
Write-Host "规划文件: $outlineFile"
|
|
63
|
-
Write-Host "任务文件: $tasksFile"
|
|
64
|
-
Write-Host "当前日期: $currentDate"
|
|
65
|
-
Write-Host ""
|
|
66
|
-
Write-Host "基于章节规划生成任务:"
|
|
67
|
-
Write-Host "- 章节写作任务"
|
|
68
|
-
Write-Host "- 角色完善任务"
|
|
69
|
-
Write-Host "- 世界观补充"
|
|
70
|
-
Write-Host "- 修订任务"
|
|
@@ -1,98 +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
|
-
Write-Host "🚀 初始化追踪系统..."
|
|
10
|
-
|
|
11
|
-
$root = Get-ProjectRoot
|
|
12
|
-
$storyDir = Get-CurrentStoryDir
|
|
13
|
-
if (-not $storyDir) { throw "请先完成 /specify 和 /plan,未找到 stories/*/ 目录" }
|
|
14
|
-
|
|
15
|
-
$storyName = Split-Path $storyDir -Leaf
|
|
16
|
-
$specTrack = Join-Path $root "tracking"
|
|
17
|
-
New-Item -ItemType Directory -Path $specTrack -Force | Out-Null
|
|
18
|
-
|
|
19
|
-
Write-Host "📖 为《$storyName》初始化追踪系统..."
|
|
20
|
-
|
|
21
|
-
$utc = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
|
|
22
|
-
|
|
23
|
-
# plot-tracker.json
|
|
24
|
-
$plotPath = Join-Path $specTrack "plot-tracker.json"
|
|
25
|
-
if (-not (Test-Path $plotPath)) {
|
|
26
|
-
Write-Host "📝 创建 plot-tracker.json..."
|
|
27
|
-
$plot = @{
|
|
28
|
-
novel = $storyName
|
|
29
|
-
lastUpdated = $utc
|
|
30
|
-
currentState = @{ chapter = 0; volume = 1; mainPlotStage = '准备阶段'; location = '待定'; timepoint = '故事开始前' }
|
|
31
|
-
plotlines = @{ main = @{ name='主线剧情'; description='待从大纲提取'; status='待开始'; currentNode='起点'; completedNodes=@(); upcomingNodes=@(); plannedClimax=@{ chapter=$null; description='待规划' } }; subplots=@() }
|
|
32
|
-
foreshadowing = @()
|
|
33
|
-
conflicts = @{ active=@(); resolved=@(); upcoming=@() }
|
|
34
|
-
checkpoints = @{ volumeEnd=@(); majorEvents=@() }
|
|
35
|
-
notes = @{ plotHoles=@(); inconsistencies=@(); reminders=@('请根据实际故事内容更新追踪数据') }
|
|
36
|
-
} | ConvertTo-Json -Depth 12
|
|
37
|
-
Set-Content -LiteralPath $plotPath -Value $plot -Encoding UTF8
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
# timeline.json
|
|
41
|
-
$timelinePath = Join-Path $specTrack "timeline.json"
|
|
42
|
-
if (-not (Test-Path $timelinePath)) {
|
|
43
|
-
Write-Host "⏰ 创建 timeline.json..."
|
|
44
|
-
$timeline = @{
|
|
45
|
-
novel = $storyName
|
|
46
|
-
lastUpdated = $utc
|
|
47
|
-
storyTimeUnit = '天'
|
|
48
|
-
realWorldReference = $null
|
|
49
|
-
timeline = @(@{ chapter=0; storyTime='第0天'; description='故事开始前'; events=@('待添加'); location='待定' })
|
|
50
|
-
parallelEvents = @()
|
|
51
|
-
timeSpan = @{ start='第0天'; current='第0天'; elapsed='0天' }
|
|
52
|
-
} | ConvertTo-Json -Depth 12
|
|
53
|
-
Set-Content -LiteralPath $timelinePath -Value $timeline -Encoding UTF8
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# relationships.json
|
|
57
|
-
$relationsPath = Join-Path $specTrack "relationships.json"
|
|
58
|
-
if (-not (Test-Path $relationsPath)) {
|
|
59
|
-
Write-Host "👥 创建 relationships.json..."
|
|
60
|
-
$relations = @{
|
|
61
|
-
novel = $storyName
|
|
62
|
-
lastUpdated = $utc
|
|
63
|
-
characters = @{ '主角' = @{ name='待设定'; relationships=@{ allies=@(); enemies=@(); romantic=@(); neutral=@() } } }
|
|
64
|
-
factions = @{}
|
|
65
|
-
relationshipChanges = @()
|
|
66
|
-
currentTensions = @()
|
|
67
|
-
} | ConvertTo-Json -Depth 12
|
|
68
|
-
Set-Content -LiteralPath $relationsPath -Value $relations -Encoding UTF8
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
# character-state.json
|
|
72
|
-
$charStatePath = Join-Path $specTrack "character-state.json"
|
|
73
|
-
if (-not (Test-Path $charStatePath)) {
|
|
74
|
-
Write-Host "📍 创建 character-state.json..."
|
|
75
|
-
$cs = @{
|
|
76
|
-
novel = $storyName
|
|
77
|
-
lastUpdated = $utc
|
|
78
|
-
characters = @{ '主角' = @{ name='待设定'; status='健康'; location='待定'; possessions=@(); skills=@(); lastSeen=@{ chapter=0; description='尚未出场' }; development=@{ physical=0; mental=0; emotional=0; power=0 } } }
|
|
79
|
-
groupPositions = @{}
|
|
80
|
-
importantItems = @{}
|
|
81
|
-
} | ConvertTo-Json -Depth 12
|
|
82
|
-
Set-Content -LiteralPath $charStatePath -Value $cs -Encoding UTF8
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
Write-Host ""
|
|
86
|
-
Write-Host "✅ 追踪系统初始化完成!"
|
|
87
|
-
Write-Host ""
|
|
88
|
-
Write-Host "📊 已创建以下追踪文件:"
|
|
89
|
-
Write-Host " • tracking/plot-tracker.json - 情节追踪"
|
|
90
|
-
Write-Host " • tracking/timeline.json - 时间线管理"
|
|
91
|
-
Write-Host " • tracking/relationships.json - 关系网络"
|
|
92
|
-
Write-Host " • tracking/character-state.json - 角色状态"
|
|
93
|
-
Write-Host ""
|
|
94
|
-
Write-Host "💡 下一步:"
|
|
95
|
-
Write-Host " 1. 使用 /write 开始创作(会自动更新追踪数据)"
|
|
96
|
-
Write-Host " 2. 定期使用 /track 查看综合报告"
|
|
97
|
-
Write-Host " 3. 使用 /checklist 等命令进行一致性检查"
|
|
98
|
-
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# 角色关系管理(PowerShell)
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[ValidateSet('show','update','history','check')]
|
|
6
|
-
[string]$Command = 'show',
|
|
7
|
-
[string]$A,
|
|
8
|
-
[ValidateSet('allies','enemies','romantic','neutral','family','mentors')]
|
|
9
|
-
[string]$Relation,
|
|
10
|
-
[string]$B,
|
|
11
|
-
[int]$Chapter,
|
|
12
|
-
[string]$Note
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
Set-StrictMode -Version Latest
|
|
16
|
-
$ErrorActionPreference = 'Stop'
|
|
17
|
-
|
|
18
|
-
. "$PSScriptRoot/common.ps1"
|
|
19
|
-
|
|
20
|
-
$root = Get-ProjectRoot
|
|
21
|
-
$storyDir = Get-CurrentStoryDir
|
|
22
|
-
$relPath = $null
|
|
23
|
-
if ($storyDir -and (Test-Path (Join-Path $storyDir 'tracking/relationships.json'))) {
|
|
24
|
-
$relPath = Join-Path $storyDir 'tracking/relationships.json'
|
|
25
|
-
} elseif (Test-Path (Join-Path $root 'tracking/relationships.json')) {
|
|
26
|
-
$relPath = Join-Path $root 'tracking/relationships.json'
|
|
27
|
-
} else {
|
|
28
|
-
$tpl1 = Join-Path $root 'tracking/relationships.json'
|
|
29
|
-
$tpl2 = Join-Path $root 'templates/tracking/relationships.json'
|
|
30
|
-
$dest = Join-Path $root 'tracking/relationships.json'
|
|
31
|
-
New-Item -ItemType Directory -Path (Split-Path $dest -Parent) -Force | Out-Null
|
|
32
|
-
if (Test-Path $tpl1) { Copy-Item $tpl1 $dest -Force; $relPath = $dest }
|
|
33
|
-
elseif (Test-Path $tpl2) { Copy-Item $tpl2 $dest -Force; $relPath = $dest }
|
|
34
|
-
else { throw '未找到 relationships.json,且无法从模板创建' }
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function Show-Header { Write-Host "👥 角色关系管理"; Write-Host "━━━━━━━━━━━━━━━━━━━━" }
|
|
38
|
-
|
|
39
|
-
function Show-Relations {
|
|
40
|
-
Show-Header
|
|
41
|
-
try { $j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json } catch { throw 'relationships.json 格式无效' }
|
|
42
|
-
Write-Host "文件:$relPath"; Write-Host ''
|
|
43
|
-
$main = $j.characters.PSObject.Properties.Name | Select-Object -First 1
|
|
44
|
-
if (-not $main) { Write-Host '无角色记录'; return }
|
|
45
|
-
Write-Host "主角:$main"
|
|
46
|
-
$c = $j.characters.$main
|
|
47
|
-
$r = if ($c.relationships) { $c.relationships } else { $c }
|
|
48
|
-
$map = @{
|
|
49
|
-
romantic = '💕 爱慕'; allies='🤝 盟友'; mentors='📚 导师'; enemies='⚔️ 敌对'; family='👪 家人'; neutral='・ 关系'
|
|
50
|
-
}
|
|
51
|
-
foreach ($k in 'romantic','allies','mentors','enemies','family','neutral') {
|
|
52
|
-
$lst = @($r.$k)
|
|
53
|
-
if ($lst.Count -gt 0) { Write-Host ("├─ {0}:{1}" -f $map[$k], ($lst -join '、')) }
|
|
54
|
-
}
|
|
55
|
-
Write-Host ''
|
|
56
|
-
if ($j.history) {
|
|
57
|
-
Write-Host '最近变化:'
|
|
58
|
-
$last = $j.history[-1]
|
|
59
|
-
if ($last) { $last.changes | ForEach-Object { Write-Host ("- " + ($_.characters -join '↔') + ":" + ($_.relation ?? $_.type)) } }
|
|
60
|
-
} elseif ($j.relationshipChanges) {
|
|
61
|
-
Write-Host '最近变化:'
|
|
62
|
-
$j.relationshipChanges | Select-Object -Last 5 | ForEach-Object { Write-Host ("- " + ($_.type ?? '变化') + ": " + ($_.characters -join '↔')) }
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function Ensure-Character($json, [string]$name) {
|
|
67
|
-
if (-not $json.characters.$name) {
|
|
68
|
-
$json.characters | Add-Member -NotePropertyName $name -NotePropertyValue (@{ name=$name; relationships=@{ allies=@(); enemies=@(); romantic=@(); family=@(); mentors=@(); neutral=@() } })
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function Update-Relation([string]$a, [string]$rel, [string]$b) {
|
|
73
|
-
if (-not $a -or -not $rel -or -not $b) { throw '用法: manage-relations.ps1 update -A 人物A -Relation allies|enemies|romantic|neutral|family|mentors -B 人物B [-Chapter N] [-Note 说明]' }
|
|
74
|
-
$j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
75
|
-
Ensure-Character $j $a
|
|
76
|
-
Ensure-Character $j $b
|
|
77
|
-
$lst = @($j.characters.$a.relationships.$rel)
|
|
78
|
-
if ($lst -notcontains $b) { $lst += $b }
|
|
79
|
-
$j.characters.$a.relationships.$rel = $lst
|
|
80
|
-
$j.lastUpdated = (Get-Date).ToString('yyyy-MM-ddTHH:mm:ss')
|
|
81
|
-
if ($j.history) {
|
|
82
|
-
$chg = [pscustomobject]@{ type='update'; characters=@($a,$b); relation=$rel; note=($Note ?? '') }
|
|
83
|
-
$rec = [pscustomobject]@{ chapter=($Chapter ? $Chapter : $null); date=(Get-Date).ToString('s'); changes=@($chg) }
|
|
84
|
-
$j.history += $rec
|
|
85
|
-
} elseif ($j.relationshipChanges) {
|
|
86
|
-
$j.relationshipChanges += [pscustomobject]@{ type='update'; characters=@($a,$b); relation=$rel }
|
|
87
|
-
} else {
|
|
88
|
-
$j | Add-Member -NotePropertyName history -NotePropertyValue @()
|
|
89
|
-
}
|
|
90
|
-
$j | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $relPath -Encoding UTF8
|
|
91
|
-
Write-Host "✅ 已更新关系:$a [$rel] $b"
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function Show-History {
|
|
95
|
-
Show-Header
|
|
96
|
-
$j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
97
|
-
if ($j.history) {
|
|
98
|
-
foreach ($h in $j.history) {
|
|
99
|
-
$chap = if ($h.chapter) { $h.chapter } else { 0 }
|
|
100
|
-
$desc = ($h.changes | ForEach-Object { ($_.characters -join '↔') + '→' + ($_.relation ?? $_.type) }) -join ';'
|
|
101
|
-
Write-Host ("第{0}章:{1}" -f $chap, $desc)
|
|
102
|
-
}
|
|
103
|
-
} elseif ($j.relationshipChanges) {
|
|
104
|
-
foreach ($h in $j.relationshipChanges) { Write-Host ((($h.date ?? '') + ' ' + ($h.type ?? '') + ': ' + ($h.characters -join '↔') + '→' + ($h.relation ?? ''))) }
|
|
105
|
-
} else { Write-Host '暂无历史记录' }
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function Check-Relations {
|
|
109
|
-
Show-Header
|
|
110
|
-
$j = Get-Content -LiteralPath $relPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
111
|
-
$names = @($j.characters.PSObject.Properties.Name)
|
|
112
|
-
$refs = @()
|
|
113
|
-
foreach ($name in $names) {
|
|
114
|
-
$rel = $j.characters.$name.relationships
|
|
115
|
-
if (-not $rel) { continue }
|
|
116
|
-
foreach ($k in 'allies','enemies','romantic','family','mentors','neutral') {
|
|
117
|
-
$refs += @($rel.$k)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
$refs = $refs | Where-Object { $_ } | Select-Object -Unique
|
|
121
|
-
$missing = @($refs | Where-Object { $names -notcontains $_ })
|
|
122
|
-
if ($missing.Count -gt 0) {
|
|
123
|
-
Write-Host "⚠ 发现未建档角色引用,建议补充:"
|
|
124
|
-
$missing | ForEach-Object { Write-Host " - $_" }
|
|
125
|
-
} else { Write-Host "✅ 关系数据检查通过" }
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
switch ($Command) {
|
|
129
|
-
'show' { Show-Relations }
|
|
130
|
-
'update' { Update-Relation -a $A -rel $Relation -b $B }
|
|
131
|
-
'history'{ Show-History }
|
|
132
|
-
'check' { Check-Relations }
|
|
133
|
-
}
|
|
134
|
-
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# migrate-tracking.ps1
|
|
2
|
-
# 用法: migrate-tracking.ps1 [-Mode <auto|check|backup>] [-Json]
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[ValidateSet('auto', 'check', 'backup')]
|
|
6
|
-
[string]$Mode = 'check',
|
|
7
|
-
[switch]$Json
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
$trackingDir = Join-Path $PWD 'tracking'
|
|
11
|
-
$backupDir = Join-Path $trackingDir 'backup'
|
|
12
|
-
$summaryDir = Join-Path $trackingDir 'summary'
|
|
13
|
-
$volumesDir = Join-Path $trackingDir 'volumes'
|
|
14
|
-
|
|
15
|
-
$trackingFiles = @(
|
|
16
|
-
'character-state.json',
|
|
17
|
-
'plot-tracker.json',
|
|
18
|
-
'timeline.json',
|
|
19
|
-
'relationships.json'
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
function Get-TrackingStatus {
|
|
23
|
-
$status = @{
|
|
24
|
-
mode = 'single-file'
|
|
25
|
-
files = @()
|
|
26
|
-
totalSize = 0
|
|
27
|
-
needsMigration = $false
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (Test-Path $volumesDir) {
|
|
31
|
-
$status.mode = 'sharded'
|
|
32
|
-
$volumes = Get-ChildItem $volumesDir -Directory | Where-Object { $_.Name -match '^vol-\d+$' }
|
|
33
|
-
$status.volumes = @($volumes).Count
|
|
34
|
-
return $status
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
foreach ($file in $trackingFiles) {
|
|
38
|
-
$filePath = Join-Path $trackingDir $file
|
|
39
|
-
if (Test-Path $filePath) {
|
|
40
|
-
$size = (Get-Item $filePath).Length
|
|
41
|
-
$status.files += @{
|
|
42
|
-
name = $file
|
|
43
|
-
size = $size
|
|
44
|
-
sizeKB = [math]::Round($size / 1024, 1)
|
|
45
|
-
}
|
|
46
|
-
$status.totalSize += $size
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
# 50KB threshold
|
|
51
|
-
$status.needsMigration = $status.totalSize -gt (50 * 1024)
|
|
52
|
-
return $status
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function Backup-TrackingFiles {
|
|
56
|
-
$timestamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
|
57
|
-
$backupPath = Join-Path $backupDir $timestamp
|
|
58
|
-
|
|
59
|
-
if (-not (Test-Path $backupPath)) {
|
|
60
|
-
New-Item -ItemType Directory -Path $backupPath -Force | Out-Null
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
foreach ($file in $trackingFiles) {
|
|
64
|
-
$src = Join-Path $trackingDir $file
|
|
65
|
-
if (Test-Path $src) {
|
|
66
|
-
Copy-Item $src (Join-Path $backupPath $file)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
# Also backup story-facts.json
|
|
71
|
-
$factsFile = Join-Path $trackingDir 'story-facts.json'
|
|
72
|
-
if (Test-Path $factsFile) {
|
|
73
|
-
Copy-Item $factsFile (Join-Path $backupPath 'story-facts.json')
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return $backupPath
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function Initialize-ShardedStructure {
|
|
80
|
-
if (-not (Test-Path $summaryDir)) {
|
|
81
|
-
New-Item -ItemType Directory -Path $summaryDir -Force | Out-Null
|
|
82
|
-
}
|
|
83
|
-
if (-not (Test-Path $volumesDir)) {
|
|
84
|
-
New-Item -ItemType Directory -Path $volumesDir -Force | Out-Null
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
# Main execution
|
|
89
|
-
switch ($Mode) {
|
|
90
|
-
'check' {
|
|
91
|
-
$status = Get-TrackingStatus
|
|
92
|
-
if ($Json) {
|
|
93
|
-
$status | ConvertTo-Json -Depth 5
|
|
94
|
-
} else {
|
|
95
|
-
Write-Host "Tracking mode: $($status.mode)"
|
|
96
|
-
if ($status.mode -eq 'single-file') {
|
|
97
|
-
Write-Host "Total size: $([math]::Round($status.totalSize / 1024, 1)) KB"
|
|
98
|
-
Write-Host "Needs migration: $($status.needsMigration)"
|
|
99
|
-
foreach ($f in $status.files) {
|
|
100
|
-
Write-Host " $($f.name): $($f.sizeKB) KB"
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
Write-Host "Volumes: $($status.volumes)"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
'backup' {
|
|
108
|
-
$backupPath = Backup-TrackingFiles
|
|
109
|
-
if ($Json) {
|
|
110
|
-
@{ backupPath = $backupPath } | ConvertTo-Json
|
|
111
|
-
} else {
|
|
112
|
-
Write-Host "Backup created at: $backupPath"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
'auto' {
|
|
116
|
-
$status = Get-TrackingStatus
|
|
117
|
-
if ($status.mode -eq 'sharded') {
|
|
118
|
-
if ($Json) {
|
|
119
|
-
@{ status = 'already-sharded' } | ConvertTo-Json
|
|
120
|
-
} else {
|
|
121
|
-
Write-Host "Already in sharded mode."
|
|
122
|
-
}
|
|
123
|
-
exit 0
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
# Backup first
|
|
127
|
-
$backupPath = Backup-TrackingFiles
|
|
128
|
-
|
|
129
|
-
# Create directory structure
|
|
130
|
-
Initialize-ShardedStructure
|
|
131
|
-
|
|
132
|
-
if ($Json) {
|
|
133
|
-
@{
|
|
134
|
-
status = 'ready'
|
|
135
|
-
backupPath = $backupPath
|
|
136
|
-
summaryDir = $summaryDir
|
|
137
|
-
volumesDir = $volumesDir
|
|
138
|
-
message = 'Directory structure created. AI should now split data by volume boundaries.'
|
|
139
|
-
} | ConvertTo-Json -Depth 3
|
|
140
|
-
} else {
|
|
141
|
-
Write-Host "Backup: $backupPath"
|
|
142
|
-
Write-Host "Structure created. AI should now split data by volume boundaries."
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# 创作计划脚本
|
|
2
|
-
# 用于 /plan 命令
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[string]$StoryName
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
Set-StrictMode -Version Latest
|
|
9
|
-
$ErrorActionPreference = 'Stop'
|
|
10
|
-
|
|
11
|
-
# 导入通用函数
|
|
12
|
-
. "$PSScriptRoot\common.ps1"
|
|
13
|
-
|
|
14
|
-
# 获取项目根目录
|
|
15
|
-
$ProjectRoot = Get-ProjectRoot
|
|
16
|
-
Set-Location $ProjectRoot
|
|
17
|
-
|
|
18
|
-
# 确定故事名称
|
|
19
|
-
if ([string]::IsNullOrEmpty($StoryName)) {
|
|
20
|
-
$StoryName = Get-ActiveStory
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
$StoryDir = "stories\$StoryName"
|
|
24
|
-
$SpecFile = "$StoryDir\specification.md"
|
|
25
|
-
$ClarifyFile = "$StoryDir\clarification.md"
|
|
26
|
-
$PlanFile = "$StoryDir\creative-plan.md"
|
|
27
|
-
|
|
28
|
-
Write-Host "创作计划制定"
|
|
29
|
-
Write-Host "============"
|
|
30
|
-
Write-Host "故事:$StoryName"
|
|
31
|
-
Write-Host ""
|
|
32
|
-
|
|
33
|
-
# 检查前置文档
|
|
34
|
-
$missing = @()
|
|
35
|
-
|
|
36
|
-
if (-not (Test-Path "resources\memory\constitution.md")) {
|
|
37
|
-
$missing += "宪法文件"
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (-not (Test-Path $SpecFile)) {
|
|
41
|
-
$missing += "规格文件"
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if ($missing.Count -gt 0) {
|
|
45
|
-
Write-Host "⚠️ 缺少以下前置文档:" -ForegroundColor Yellow
|
|
46
|
-
foreach ($doc in $missing) {
|
|
47
|
-
Write-Host " - $doc"
|
|
48
|
-
}
|
|
49
|
-
Write-Host ""
|
|
50
|
-
Write-Host "请先完成:"
|
|
51
|
-
if (-not (Test-Path "resources\memory\constitution.md")) {
|
|
52
|
-
Write-Host " 1. /constitution - 创建创作宪法"
|
|
53
|
-
}
|
|
54
|
-
if (-not (Test-Path $SpecFile)) {
|
|
55
|
-
Write-Host " 2. /specify - 定义故事规格"
|
|
56
|
-
}
|
|
57
|
-
exit 1
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
# 检查是否有未澄清的点
|
|
61
|
-
if (Test-Path $SpecFile) {
|
|
62
|
-
$content = Get-Content $SpecFile -Raw
|
|
63
|
-
$unclearCount = ([regex]::Matches($content, '\[需要澄清\]')).Count
|
|
64
|
-
|
|
65
|
-
if ($unclearCount -gt 0) {
|
|
66
|
-
Write-Host "⚠️ 规格中有 $unclearCount 处需要澄清" -ForegroundColor Yellow
|
|
67
|
-
Write-Host "建议先运行 /clarify 澄清关键决策"
|
|
68
|
-
Write-Host ""
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
# 检查澄清记录
|
|
73
|
-
if (Test-Path $ClarifyFile) {
|
|
74
|
-
Write-Host "✅ 已完成澄清,将基于澄清决策制定计划" -ForegroundColor Green
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
Write-Host "📝 未找到澄清记录,将基于原始规格制定计划"
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# 检查计划文件
|
|
81
|
-
if (Test-Path $PlanFile) {
|
|
82
|
-
Write-Host ""
|
|
83
|
-
Write-Host "📋 计划文件已存在,将更新现有计划"
|
|
84
|
-
|
|
85
|
-
# 显示当前版本
|
|
86
|
-
$planContent = Get-Content $PlanFile -Raw
|
|
87
|
-
if ($planContent -match "版本:(.+)") {
|
|
88
|
-
Write-Host " 当前版本:$($matches[1])"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
Write-Host ""
|
|
93
|
-
Write-Host "📝 将创建新的创作计划"
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
Write-Host ""
|
|
97
|
-
Write-Host "计划文件路径:$PlanFile"
|
|
98
|
-
Write-Host ""
|
|
99
|
-
Write-Host "准备就绪,可以制定创作计划"
|