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,85 +0,0 @@
|
|
|
1
|
-
# 故事规格定义脚本
|
|
2
|
-
# 用于 /specify 命令
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[switch]$Json,
|
|
6
|
-
[string]$StoryName
|
|
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
|
-
# 查找最新的故事
|
|
22
|
-
$StoriesDir = "stories"
|
|
23
|
-
if (Test-Path $StoriesDir) {
|
|
24
|
-
$latestStory = Get-ChildItem $StoriesDir -Directory |
|
|
25
|
-
Sort-Object LastWriteTime -Descending |
|
|
26
|
-
Select-Object -First 1
|
|
27
|
-
|
|
28
|
-
if ($latestStory) {
|
|
29
|
-
$StoryName = $latestStory.Name
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# 如果还是没有,生成默认名称
|
|
34
|
-
if ([string]::IsNullOrEmpty($StoryName)) {
|
|
35
|
-
$StoryName = "story-$(Get-Date -Format 'yyyyMMdd')"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# 设置路径
|
|
40
|
-
$StoryDir = "stories\$StoryName"
|
|
41
|
-
$SpecFile = "$StoryDir\specification.md"
|
|
42
|
-
|
|
43
|
-
# 创建目录
|
|
44
|
-
if (-not (Test-Path $StoryDir)) {
|
|
45
|
-
New-Item -ItemType Directory -Path $StoryDir -Force | Out-Null
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# 检查文件状态
|
|
49
|
-
$SpecExists = $false
|
|
50
|
-
$Status = "new"
|
|
51
|
-
|
|
52
|
-
if (Test-Path $SpecFile) {
|
|
53
|
-
$SpecExists = $true
|
|
54
|
-
$Status = "exists"
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
# 输出 JSON 格式
|
|
58
|
-
if ($Json) {
|
|
59
|
-
@{
|
|
60
|
-
STORY_NAME = $StoryName
|
|
61
|
-
STORY_DIR = $StoryDir
|
|
62
|
-
SPEC_PATH = $SpecFile
|
|
63
|
-
STATUS = $Status
|
|
64
|
-
PROJECT_ROOT = $ProjectRoot
|
|
65
|
-
} | ConvertTo-Json
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
Write-Host "故事规格初始化"
|
|
69
|
-
Write-Host "================"
|
|
70
|
-
Write-Host "故事名称:$StoryName"
|
|
71
|
-
Write-Host "规格路径:$SpecFile"
|
|
72
|
-
|
|
73
|
-
if ($SpecExists) {
|
|
74
|
-
Write-Host "状态:规格文件已存在,准备更新"
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
Write-Host "状态:准备创建新规格"
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# 检查宪法
|
|
81
|
-
if (Test-Path "resources\memory\constitution.md") {
|
|
82
|
-
Write-Host ""
|
|
83
|
-
Write-Host "✅ 检测到创作宪法,规格将遵循宪法原则" -ForegroundColor Green
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
|
|
3
|
-
Write-Host "=== PowerShell 缓存性能测试 ===" -ForegroundColor Cyan
|
|
4
|
-
Write-Host ""
|
|
5
|
-
|
|
6
|
-
# 测试 1: 基准测试(1 个文件 × 100 次)
|
|
7
|
-
Write-Host "测试 1: 基准测试(1 个文件 × 100 次)" -ForegroundColor Yellow
|
|
8
|
-
Write-Host "----------------------------------------" -ForegroundColor Gray
|
|
9
|
-
|
|
10
|
-
Write-Host "无缓存版本:"
|
|
11
|
-
$sw1 = [Diagnostics.Stopwatch]::StartNew()
|
|
12
|
-
for ($i = 1; $i -le 100; $i++) {
|
|
13
|
-
$null = Test-Path "resources/config/keyword-mappings.json" -PathType Leaf
|
|
14
|
-
$null = Get-Item "resources/config/keyword-mappings.json" -ErrorAction SilentlyContinue
|
|
15
|
-
}
|
|
16
|
-
$sw1.Stop()
|
|
17
|
-
Write-Host " 总时间: $($sw1.ElapsedMilliseconds) ms"
|
|
18
|
-
|
|
19
|
-
. .\templates\scripts\powershell\check-writing-state.ps1
|
|
20
|
-
Write-Host "有缓存版本:"
|
|
21
|
-
$sw2 = [Diagnostics.Stopwatch]::StartNew()
|
|
22
|
-
Preload-FileMTimes -FilePathList @("resources/config/keyword-mappings.json")
|
|
23
|
-
for ($i = 1; $i -le 100; $i++) {
|
|
24
|
-
$null = Test-FileExistsCached "resources/config/keyword-mappings.json"
|
|
25
|
-
}
|
|
26
|
-
$sw2.Stop()
|
|
27
|
-
Write-Host " 总时间: $($sw2.ElapsedMilliseconds) ms"
|
|
28
|
-
Write-Host " 性能提升: $([Math]::Round($sw1.ElapsedMilliseconds / $sw2.ElapsedMilliseconds, 2))x" -ForegroundColor Green
|
|
29
|
-
|
|
30
|
-
Write-Host ""
|
|
31
|
-
|
|
32
|
-
# 测试 2: 真实场景(11 个文件 × 3 次检查)
|
|
33
|
-
Write-Host "测试 2: 真实场景(11 个文件 × 3 次检查)" -ForegroundColor Yellow
|
|
34
|
-
Write-Host "----------------------------------------" -ForegroundColor Gray
|
|
35
|
-
|
|
36
|
-
# 构造文件列表(与实际脚本一致)
|
|
37
|
-
$ProjectRoot = Get-Location
|
|
38
|
-
$testFileList = @(
|
|
39
|
-
"resources/craft/dialogue.md"
|
|
40
|
-
"resources/craft/scene-structure.md"
|
|
41
|
-
"resources/craft/character-arc.md"
|
|
42
|
-
"resources/craft/pacing.md"
|
|
43
|
-
"resources/craft/show-not-tell.md"
|
|
44
|
-
"templates/skills/writing-techniques/dialogue-techniques/SKILL.md"
|
|
45
|
-
"templates/skills/writing-techniques/scene-structure/SKILL.md"
|
|
46
|
-
"templates/skills/writing-techniques/character-arc/SKILL.md"
|
|
47
|
-
"templates/skills/writing-techniques/pacing-control/SKILL.md"
|
|
48
|
-
"templates/skills/quality-assurance/consistency-checker/SKILL.md"
|
|
49
|
-
"resources/config/keyword-mappings.json" # 替代 specification.md(测试文件)
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
# 无缓存版本
|
|
53
|
-
Write-Host "无缓存版本(11 个文件 × 3 次):"
|
|
54
|
-
$sw3 = [Diagnostics.Stopwatch]::StartNew()
|
|
55
|
-
for ($i = 1; $i -le 3; $i++) {
|
|
56
|
-
foreach ($file in $testFileList) {
|
|
57
|
-
$null = Test-Path $file -PathType Leaf
|
|
58
|
-
$null = Get-Item $file -ErrorAction SilentlyContinue
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
$sw3.Stop()
|
|
62
|
-
Write-Host " 总时间: $($sw3.ElapsedMilliseconds) ms"
|
|
63
|
-
|
|
64
|
-
# 有缓存版本
|
|
65
|
-
Write-Host "有缓存版本(1 次预加载 + 3 次查询):"
|
|
66
|
-
$sw4 = [Diagnostics.Stopwatch]::StartNew()
|
|
67
|
-
Preload-FileMTimes -FilePathList $testFileList
|
|
68
|
-
for ($i = 1; $i -le 3; $i++) {
|
|
69
|
-
foreach ($file in $testFileList) {
|
|
70
|
-
$null = Test-FileExistsCached $file
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
$sw4.Stop()
|
|
74
|
-
Write-Host " 总时间: $($sw4.ElapsedMilliseconds) ms"
|
|
75
|
-
Write-Host " 预加载耗时: ~$([Math]::Round($sw4.ElapsedMilliseconds * 0.8, 1)) ms (估算)"
|
|
76
|
-
Write-Host " 查询耗时: ~$([Math]::Round($sw4.ElapsedMilliseconds * 0.2, 1)) ms (估算)"
|
|
77
|
-
Write-Host " 性能提升: $([Math]::Round($sw3.ElapsedMilliseconds / $sw4.ElapsedMilliseconds, 2))x" -ForegroundColor Green
|
|
78
|
-
|
|
79
|
-
Write-Host ""
|
|
80
|
-
Write-Host "=== 测试完成 ===" -ForegroundColor Cyan
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
|
|
3
|
-
Write-Host "=== Phase 1 跨平台兼容性测试 (PowerShell) ===" -ForegroundColor Cyan
|
|
4
|
-
Write-Host ""
|
|
5
|
-
|
|
6
|
-
Write-Host "【系统信息】" -ForegroundColor Yellow
|
|
7
|
-
Write-Host "操作系统: $($PSVersionTable.OS)"
|
|
8
|
-
Write-Host "PowerShell 版本: $($PSVersionTable.PSVersion)"
|
|
9
|
-
Write-Host "平台: $($PSVersionTable.Platform)"
|
|
10
|
-
Write-Host ""
|
|
11
|
-
|
|
12
|
-
Write-Host "【路径处理测试】" -ForegroundColor Yellow
|
|
13
|
-
# 测试 Join-Path 跨平台兼容性
|
|
14
|
-
$testPath = Join-Path "templates" "config" "keyword-mappings.json"
|
|
15
|
-
if (Test-Path $testPath) {
|
|
16
|
-
Write-Host "✅ 路径处理正常: $testPath" -ForegroundColor Green
|
|
17
|
-
} else {
|
|
18
|
-
Write-Host "❌ 路径处理失败: $testPath" -ForegroundColor Red
|
|
19
|
-
exit 1
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Write-Host ""
|
|
23
|
-
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
|
24
|
-
Write-Host "✅ 跨平台兼容性测试通过(PowerShell 7+ 跨平台)" -ForegroundColor Green
|
|
25
|
-
} else {
|
|
26
|
-
Write-Host "✅ 跨平台兼容性测试通过(Windows PowerShell 5.1)" -ForegroundColor Green
|
|
27
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
|
|
3
|
-
Write-Host "=== Phase 1 边界情况测试 (PowerShell) ===" -ForegroundColor Cyan
|
|
4
|
-
Write-Host ""
|
|
5
|
-
|
|
6
|
-
Write-Host "测试 5.1: 文件不存在处理" -ForegroundColor Yellow
|
|
7
|
-
|
|
8
|
-
# 模拟 Get-FileMTimeFromCache 函数
|
|
9
|
-
function Get-FileMTimeFromCache {
|
|
10
|
-
param([string]$filePath)
|
|
11
|
-
|
|
12
|
-
if (-not (Test-Path $filePath)) {
|
|
13
|
-
return $null # 哨兵值
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return (Get-Item $filePath).LastWriteTimeUtc
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
# 测试不存在的文件
|
|
20
|
-
$mtime = Get-FileMTimeFromCache "templates/nonexistent-file.md"
|
|
21
|
-
if ($null -eq $mtime) {
|
|
22
|
-
Write-Host "✅ 正确处理文件不存在(mtime = null)" -ForegroundColor Green
|
|
23
|
-
} else {
|
|
24
|
-
Write-Host "❌ 文件不存在处理错误:mtime = $mtime" -ForegroundColor Red
|
|
25
|
-
exit 1
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
Write-Host ""
|
|
29
|
-
Write-Host "✅ PowerShell 边界情况测试通过" -ForegroundColor Green
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
|
|
3
|
-
Write-Host "=== Phase 1 PowerShell 缓存测试 ===" -ForegroundColor Cyan
|
|
4
|
-
Write-Host ""
|
|
5
|
-
|
|
6
|
-
# 测试 3.1: 功能测试
|
|
7
|
-
Write-Host "测试 3.1: 运行功能测试" -ForegroundColor Yellow
|
|
8
|
-
pwsh test-ps-cache.ps1
|
|
9
|
-
Write-Host ""
|
|
10
|
-
|
|
11
|
-
# 测试 3.2: 性能测试
|
|
12
|
-
Write-Host "测试 3.2: 运行性能测试" -ForegroundColor Yellow
|
|
13
|
-
pwsh bench-ps-cache.ps1
|
|
14
|
-
Write-Host ""
|
|
15
|
-
|
|
16
|
-
# 测试 3.3: PowerShell 版本检测
|
|
17
|
-
Write-Host "测试 3.3: PowerShell 版本检测" -ForegroundColor Yellow
|
|
18
|
-
Write-Host "当前 PowerShell 版本: $($PSVersionTable.PSVersion)"
|
|
19
|
-
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
|
20
|
-
Write-Host "✅ PowerShell 7+ (跨平台)" -ForegroundColor Green
|
|
21
|
-
} elseif ($PSVersionTable.PSVersion.Major -eq 5) {
|
|
22
|
-
Write-Host "✅ Windows PowerShell 5.1" -ForegroundColor Green
|
|
23
|
-
} else {
|
|
24
|
-
Write-Host "⚠️ 不支持的 PowerShell 版本" -ForegroundColor Yellow
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Write-Host ""
|
|
28
|
-
Write-Host "✅ PowerShell 缓存测试全部通过" -ForegroundColor Green
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
|
|
3
|
-
# 加载脚本(使用 dot sourcing)
|
|
4
|
-
. .\templates\scripts\powershell\check-writing-state.ps1
|
|
5
|
-
|
|
6
|
-
Write-Host "=== 测试 PowerShell 缓存功能 ===" -ForegroundColor Cyan
|
|
7
|
-
Write-Host ""
|
|
8
|
-
|
|
9
|
-
# 测试 1: 存在的文件
|
|
10
|
-
Write-Host "测试 1: 存在的文件" -ForegroundColor Yellow
|
|
11
|
-
Preload-FileMTimes -FilePathList @("resources/config/keyword-mappings.json")
|
|
12
|
-
if (Test-FileExistsCached "resources/config/keyword-mappings.json") {
|
|
13
|
-
Write-Host "✅ 存在的文件检测正确" -ForegroundColor Green
|
|
14
|
-
} else {
|
|
15
|
-
Write-Host "❌ 存在的文件检测错误" -ForegroundColor Red
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
# 测试 2: 不存在的文件
|
|
19
|
-
Write-Host ""
|
|
20
|
-
Write-Host "测试 2: 不存在的文件" -ForegroundColor Yellow
|
|
21
|
-
Preload-FileMTimes -FilePathList @("templates/nonexistent-file.md")
|
|
22
|
-
if (Test-FileExistsCached "templates/nonexistent-file.md") {
|
|
23
|
-
Write-Host "❌ 不存在的文件被误判为存在" -ForegroundColor Red
|
|
24
|
-
} else {
|
|
25
|
-
Write-Host "✅ 不存在的文件检测正确" -ForegroundColor Green
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
# 测试 3: 检查缓存值
|
|
29
|
-
Write-Host ""
|
|
30
|
-
Write-Host "测试 3: 检查缓存值" -ForegroundColor Yellow
|
|
31
|
-
$mtimeExisting = Get-FileMTimeFromCache "resources/config/keyword-mappings.json"
|
|
32
|
-
$mtimeMissing = Get-FileMTimeFromCache "templates/nonexistent-file.md"
|
|
33
|
-
|
|
34
|
-
Write-Host "存在文件的 mtime: $mtimeExisting"
|
|
35
|
-
Write-Host "不存在文件的 mtime: $mtimeMissing (应该为 null)"
|
|
36
|
-
|
|
37
|
-
if ($null -ne $mtimeExisting -and $null -eq $mtimeMissing) {
|
|
38
|
-
Write-Host "✅ 缓存值语义正确" -ForegroundColor Green
|
|
39
|
-
} else {
|
|
40
|
-
Write-Host "❌ 缓存值语义错误" -ForegroundColor Red
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
# 测试 4: 批量预加载
|
|
44
|
-
Write-Host ""
|
|
45
|
-
Write-Host "测试 4: 批量预加载混合文件" -ForegroundColor Yellow
|
|
46
|
-
$mixedFiles = @(
|
|
47
|
-
"resources/config/keyword-mappings.json" # 存在
|
|
48
|
-
"templates/nonexistent1.md" # 不存在
|
|
49
|
-
"templates/nonexistent2.md" # 不存在
|
|
50
|
-
)
|
|
51
|
-
Preload-FileMTimes -FilePathList $mixedFiles
|
|
52
|
-
|
|
53
|
-
$existsCount = 0
|
|
54
|
-
$missingCount = 0
|
|
55
|
-
foreach ($file in $mixedFiles) {
|
|
56
|
-
if (Test-FileExistsCached $file) {
|
|
57
|
-
$existsCount++
|
|
58
|
-
} else {
|
|
59
|
-
$missingCount++
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
Write-Host "检测到存在的文件: $existsCount (期望 1)"
|
|
64
|
-
Write-Host "检测到不存在的文件: $missingCount (期望 2)"
|
|
65
|
-
|
|
66
|
-
if ($existsCount -eq 1 -and $missingCount -eq 2) {
|
|
67
|
-
Write-Host "✅ 批量预加载检测正确" -ForegroundColor Green
|
|
68
|
-
} else {
|
|
69
|
-
Write-Host "❌ 批量预加载检测错误" -ForegroundColor Red
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
Write-Host ""
|
|
73
|
-
Write-Host "=== 测试完成 ===" -ForegroundColor Cyan
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
|
|
3
|
-
Write-Host "=== Phase 1 回归测试 (PowerShell) ===" -ForegroundColor Cyan
|
|
4
|
-
Write-Host ""
|
|
5
|
-
|
|
6
|
-
Write-Host "测试 7.1: 脚本正常运行" -ForegroundColor Yellow
|
|
7
|
-
try {
|
|
8
|
-
$null = & "templates/scripts/powershell/check-writing-state.ps1" -ErrorAction Stop 2>&1
|
|
9
|
-
Write-Host "✅ 脚本执行成功" -ForegroundColor Green
|
|
10
|
-
} catch {
|
|
11
|
-
Write-Host "⚠️ 脚本执行有警告(可能是正常的)" -ForegroundColor Yellow
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
Write-Host ""
|
|
15
|
-
Write-Host "测试 7.2: JSON 输出格式" -ForegroundColor Yellow
|
|
16
|
-
try {
|
|
17
|
-
$output = & "templates/scripts/powershell/check-writing-state.ps1" 2>$null | Out-String
|
|
18
|
-
$json = $output | ConvertFrom-Json -ErrorAction Stop
|
|
19
|
-
Write-Host "✅ JSON 格式正确" -ForegroundColor Green
|
|
20
|
-
} catch {
|
|
21
|
-
Write-Host "❌ JSON 格式错误: $_" -ForegroundColor Red
|
|
22
|
-
Write-Host "输出内容:"
|
|
23
|
-
Write-Host $output
|
|
24
|
-
exit 1
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Write-Host ""
|
|
28
|
-
Write-Host "测试 7.3: 必需字段存在性" -ForegroundColor Yellow
|
|
29
|
-
$requiredFields = @("status")
|
|
30
|
-
|
|
31
|
-
foreach ($field in $requiredFields) {
|
|
32
|
-
if ($json.PSObject.Properties.Name -contains $field) {
|
|
33
|
-
Write-Host "✅ 字段存在: $field" -ForegroundColor Green
|
|
34
|
-
} else {
|
|
35
|
-
Write-Host "⚠️ 字段不存在: $field(可能是预期的)" -ForegroundColor Yellow
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
Write-Host ""
|
|
40
|
-
Write-Host "✅ PowerShell 回归测试通过" -ForegroundColor Green
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# 离线文本人味自查(PowerShell)
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[Parameter(Mandatory=$true)][string]$File
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
Set-StrictMode -Version Latest
|
|
9
|
-
$ErrorActionPreference = 'Stop'
|
|
10
|
-
|
|
11
|
-
. "$PSScriptRoot/common.ps1"
|
|
12
|
-
|
|
13
|
-
$root = Get-ProjectRoot
|
|
14
|
-
$cfgProject = Join-Path $root "resources/knowledge/audit-config.json"
|
|
15
|
-
$cfgTemplate = Join-Path $root "resources/knowledge/audit-config.json"
|
|
16
|
-
$cfg = if (Test-Path $cfgProject) { $cfgProject } elseif (Test-Path $cfgTemplate) { $cfgTemplate } else { '' }
|
|
17
|
-
|
|
18
|
-
if (-not (Test-Path $File)) { throw "用法: text-audit.ps1 -File <路径>" }
|
|
19
|
-
|
|
20
|
-
# 使用 PowerShell here-string 传递 Python 脚本
|
|
21
|
-
$pyScript = @"
|
|
22
|
-
import json, re, sys, os, math
|
|
23
|
-
path = r'''$File'''
|
|
24
|
-
cfg_path = r'''$cfg'''
|
|
25
|
-
text = open(path, 'r', encoding='utf-8', errors='ignore').read()
|
|
26
|
-
default_cfg = {
|
|
27
|
-
"connector_phrases": ["首先","其次","再次","然后","然而","总而言之","综上所述","在某种程度","众所周知","在当下","随着"],
|
|
28
|
-
"empty_phrases": ["广泛关注","引发热议","影响深远","具有重要意义","有效提升","具有一定的指导意义","值得我们思考"],
|
|
29
|
-
"cliche_pairs": [],
|
|
30
|
-
"sentence_length": {"max_run_long":4, "max_run_short":5, "short_threshold":12, "long_threshold":35},
|
|
31
|
-
"abstract_nouns": ["价值","意义","认知","体系","模式","路径","方法论","趋势"],
|
|
32
|
-
"min_concrete_details": 3
|
|
33
|
-
}
|
|
34
|
-
cfg = default_cfg
|
|
35
|
-
if cfg_path and os.path.exists(cfg_path):
|
|
36
|
-
try: cfg.update(json.load(open(cfg_path,'r',encoding='utf-8')))
|
|
37
|
-
except: pass
|
|
38
|
-
def count_occurrences(text, phrases):
|
|
39
|
-
return {p: len(re.findall(re.escape(p), text)) for p in phrases if p}
|
|
40
|
-
def split_sentences(t):
|
|
41
|
-
parts = re.split(r'[。!?!?\n]+', t)
|
|
42
|
-
return [s.strip() for s in parts if s.strip()]
|
|
43
|
-
def sentence_lengths(sents):
|
|
44
|
-
lens = [len(s) for s in sents]
|
|
45
|
-
if not lens: return lens, 0, 0
|
|
46
|
-
avg = sum(lens)/len(lens)
|
|
47
|
-
var = sum((x-avg)**2 for x in lens)/len(lens)
|
|
48
|
-
return lens, avg, var**0.5
|
|
49
|
-
def runs(lens, short_th, long_th):
|
|
50
|
-
rs=rl=0; mrs=mrl=0
|
|
51
|
-
for L in lens:
|
|
52
|
-
if L<=short_th: rs+=1; mrs=max(mrs,rs); rl=0
|
|
53
|
-
elif L>=long_th: rl+=1; mrl=max(mrl,rl); rs=0
|
|
54
|
-
else: rs=rl=0
|
|
55
|
-
return mrs, mrl
|
|
56
|
-
def abstract_density(sent, words):
|
|
57
|
-
return sum(len(re.findall(re.escape(w), sent)) for w in words)
|
|
58
|
-
connectors = count_occurrences(text, cfg["connector_phrases"])
|
|
59
|
-
empties = count_occurrences(text, cfg["empty_phrases"])
|
|
60
|
-
sents = split_sentences(text)
|
|
61
|
-
lens, avg, std = sentence_lengths(sents)
|
|
62
|
-
mx_run_short, mx_run_long = runs(lens, cfg["sentence_length"]["short_threshold"], cfg["sentence_length"]["long_threshold"])
|
|
63
|
-
abstract_scores = [(i, abstract_density(s, cfg["abstract_nouns"])) for i,s in enumerate(sents)]
|
|
64
|
-
abstract_scores.sort(key=lambda x: x[1], reverse=True)
|
|
65
|
-
abstract_top = [(i,sents[i]) for i,sc in abstract_scores[:5] if sc>=2]
|
|
66
|
-
total_chars = len(text)
|
|
67
|
-
def ratio(c): return (c/max(1,total_chars))*1000
|
|
68
|
-
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
|
69
|
-
print("📊 离线文本人味自查报告")
|
|
70
|
-
print(f"文件: {os.path.basename(path)} 字符数: {total_chars}")
|
|
71
|
-
print("")
|
|
72
|
-
print("连接词密度(每千字出现次数)")
|
|
73
|
-
tc=sum(connectors.values()); print(f" 总计: {tc} | 比率: {ratio(tc):.2f}")
|
|
74
|
-
for k,v in sorted(connectors.items(), key=lambda x: -x[1])[:10]:
|
|
75
|
-
if v>0: print(f" - {k}: {v}")
|
|
76
|
-
print("")
|
|
77
|
-
print("空话/套话计数")
|
|
78
|
-
te=sum(empties.values()); print(f" 总计: {te} | 比率: {ratio(te):.2f}")
|
|
79
|
-
for k,v in sorted(empties.items(), key=lambda x: -x[1])[:10]:
|
|
80
|
-
if v>0: print(f" - {k}: {v}")
|
|
81
|
-
print("")
|
|
82
|
-
print("句长统计")
|
|
83
|
-
print(f" 句子数: {len(lens)} | 平均: {avg:.1f} | 标准差: {std:.1f}")
|
|
84
|
-
print(f" 连续短句最大: {mx_run_short} (阈值 {cfg['sentence_length']['max_run_short']})")
|
|
85
|
-
print(f" 连续长句最大: {mx_run_long} (阈值 {cfg['sentence_length']['max_run_long']})")
|
|
86
|
-
print("")
|
|
87
|
-
print("抽象过载(示例段,≥2 抽象词)")
|
|
88
|
-
if abstract_top:
|
|
89
|
-
for idx,s in abstract_top:
|
|
90
|
-
sn = s[:80] + ("…" if len(s)>80 else "")
|
|
91
|
-
print(f" - 第{idx+1}句: {sn}")
|
|
92
|
-
else:
|
|
93
|
-
print(" 无显著抽象过载片段")
|
|
94
|
-
print("")
|
|
95
|
-
print("建议")
|
|
96
|
-
print(" - 用具体动作/器物/气味替代空话与抽象名词")
|
|
97
|
-
print(" - 打断长长串句子;合并过多的短句以形成起伏")
|
|
98
|
-
print(" - 复查连接词是否可删除或自然过渡")
|
|
99
|
-
print(" - 写前先列3个生活细节作为锚点")
|
|
100
|
-
"@
|
|
101
|
-
|
|
102
|
-
$pyScript | python3 -
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# 综合追踪小说创作进度(PowerShell)
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[switch]$check,
|
|
6
|
-
[switch]$fix,
|
|
7
|
-
[switch]$brief,
|
|
8
|
-
[switch]$plot,
|
|
9
|
-
[switch]$stats
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
Set-StrictMode -Version Latest
|
|
13
|
-
$ErrorActionPreference = 'Stop'
|
|
14
|
-
|
|
15
|
-
. "$PSScriptRoot/common.ps1"
|
|
16
|
-
|
|
17
|
-
$root = Get-ProjectRoot
|
|
18
|
-
$storyDir = Get-CurrentStoryDir
|
|
19
|
-
$progress = if ($storyDir) { Join-Path $storyDir "progress.json" } else { "" }
|
|
20
|
-
$plotPath = Join-Path $root "tracking/plot-tracker.json"
|
|
21
|
-
|
|
22
|
-
function Show-BasicReport {
|
|
23
|
-
Write-Host "📊 小说创作综合报告"
|
|
24
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
25
|
-
if (Test-Path $progress) {
|
|
26
|
-
Write-Host "✍️ 写作进度"
|
|
27
|
-
Write-Host " 完成情况等待分析..."
|
|
28
|
-
}
|
|
29
|
-
if (Test-Path $plotPath) {
|
|
30
|
-
Write-Host "📍 情节状态"
|
|
31
|
-
Write-Host " 主线进度等待分析..."
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function Run-DeepCheck {
|
|
36
|
-
Write-Host "🔍 执行深度验证..."
|
|
37
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
38
|
-
Write-Host "Phase 1: 基础验证"
|
|
39
|
-
Write-Host " [P] 执行情节一致性检查..."
|
|
40
|
-
Write-Host " [P] 执行时间线验证..."
|
|
41
|
-
Write-Host " [P] 执行关系验证..."
|
|
42
|
-
Write-Host " [P] 执行世界观验证..."
|
|
43
|
-
Write-Host "Phase 2: 角色深度验证"
|
|
44
|
-
$rules = Join-Path $root "tracking/validation-rules.json"
|
|
45
|
-
if (Test-Path $rules) {
|
|
46
|
-
Write-Host " ✅ 加载验证规则"
|
|
47
|
-
Set-Content -LiteralPath "$env:TEMP/validation-tasks.md" -Encoding UTF8 -Value @"
|
|
48
|
-
# 验证任务 (自动生成)
|
|
49
|
-
|
|
50
|
-
## Phase 1: 基础验证 [并行]
|
|
51
|
-
- [ ] T001 [P] 执行情节一致性检查
|
|
52
|
-
- [ ] T002 [P] 执行时间线验证
|
|
53
|
-
- [ ] T003 [P] 执行关系验证
|
|
54
|
-
- [ ] T004 [P] 执行世界观验证
|
|
55
|
-
|
|
56
|
-
## Phase 2: 角色验证
|
|
57
|
-
- [ ] T005 加载validation-rules.json
|
|
58
|
-
- [ ] T006 扫描章节角色名称
|
|
59
|
-
- [ ] T007 验证名称一致性
|
|
60
|
-
- [ ] T008 检查称呼准确性
|
|
61
|
-
- [ ] T009 验证行为一致性
|
|
62
|
-
|
|
63
|
-
## Phase 3: 生成报告
|
|
64
|
-
- [ ] T010 汇总结果
|
|
65
|
-
- [ ] T011 标记问题
|
|
66
|
-
- [ ] T012 生成建议
|
|
67
|
-
"@
|
|
68
|
-
Write-Host " ✅ 验证任务已生成"
|
|
69
|
-
} else {
|
|
70
|
-
Write-Host " ⚠️ 未找到验证规则文件"
|
|
71
|
-
}
|
|
72
|
-
Write-Host "📊 深度验证报告"
|
|
73
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
74
|
-
Write-Host "AI将分析所有章节并生成详细报告..."
|
|
75
|
-
Write-Host "💡 提示:发现问题后可运行 --fix 自动修复"
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function Run-AutoFix {
|
|
79
|
-
Write-Host "🔧 执行自动修复..."
|
|
80
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
81
|
-
Set-Content -LiteralPath "$env:TEMP/fix-tasks.md" -Encoding UTF8 -Value @"
|
|
82
|
-
# 修复任务 (自动生成)
|
|
83
|
-
|
|
84
|
-
## Phase 1: 简单修复 [可自动]
|
|
85
|
-
- [ ] F001 读取验证报告
|
|
86
|
-
- [ ] F002 [P] 修复角色名称错误
|
|
87
|
-
- [ ] F003 [P] 修复称呼错误
|
|
88
|
-
- [ ] F004 [P] 修复简单拼写
|
|
89
|
-
|
|
90
|
-
## Phase 2: 生成报告
|
|
91
|
-
- [ ] F005 汇总修复结果
|
|
92
|
-
- [ ] F006 更新追踪文件
|
|
93
|
-
"@
|
|
94
|
-
Write-Host "🔧 自动修复报告"
|
|
95
|
-
Write-Host "━━━━━━━━━━━━━━━━━━━"
|
|
96
|
-
Write-Host "AI将自动修复简单问题..."
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if ($check) { Run-DeepCheck }
|
|
100
|
-
elseif ($fix) { Run-AutoFix }
|
|
101
|
-
else { Show-BasicReport }
|
|
102
|
-
|
|
103
|
-
Write-Host ""
|
|
104
|
-
Write-Host "✅ 追踪分析完成"
|
|
105
|
-
|