文笔层:AI 味机检、标点规范化、分块大量扩写(第 1 集成稿 10805 字)

- 修复上次提交把 dfannals/cli.py 写成 0 字节的问题(它是唯一入口,导致管道不可运行)
- 性别:解析 <caste>,人物表与写作素材带性别(Ral Fastenhatchets 实为女性)
- 新增 dfannals/deslop.py:AI 味机械诊断(硬伤词/句式/标点,按千字密度报告)
- 新增 dfannals/normalize.py:标点与结构清理(引号配对、重复段落与句子、模型自加的小节标记)
- 新增 dfannals/expand.py 与 prompts/literary-expander.md:按年份场景分块大量扩写
- 专名防幻觉:每块附史料专名白名单,事后按段自动修复可疑专名
- episode 命令并进文笔层(骨架稿另存 .skeleton.md),新增 expand 命令做 A/B 对照
- 新增 notes/switched-threads.md 与 test_deslop / test_normalize 回归测试
- 提交前拦截「已跟踪文件为空」,防止上述事故复发
This commit is contained in:
Chen Yi
2026-10-05 22:27:02 +08:00
parent 08a032120a
commit 8630dcad55
23 changed files with 1971 additions and 56 deletions
+23 -1
View File
@@ -65,8 +65,30 @@ def ensure_repo() -> None:
_git("config", "user.email", "df-annals@hajim1.art")
def _tracked_empty_sources() -> list[str]:
"""已跟踪的源码/文档里,哪些是 0 字节。"""
suffixes = (".py", ".sh", ".lua", ".md", ".toml", ".json")
out: list[str] = []
for rel in _git("ls-files").stdout.split():
if not rel.endswith(suffixes):
continue
path = PROJECT_DIR / rel
if path.is_file() and path.stat().st_size == 0:
out.append(rel)
return out
def commit_and_push(message: str, paths: list[Path] | None = None) -> str:
"""提交并推送。返回提交哈希;无改动时返回空串。"""
"""提交并推送。返回提交哈希;无改动时返回空串。
提交前硬拦空文件:实测发生过一次 cli.py 被提交为 0 字节的事故——
而 cli.py 是唯一入口,于是远端仓库里的管道完全不可运行,且失败是静默的。
这种错误不能靠人复核,必须在提交口拦住。
"""
empty = _tracked_empty_sources()
if empty:
raise RuntimeError("拒绝提交:以下已跟踪文件是空的 → " + "、".join(empty))
if paths:
for p in paths:
_git("add", "--", str(p.relative_to(PROJECT_DIR)) if p.is_absolute() else str(p))