一、技能重组(动作-对象命名) - 旧目录 clean/confirm/continuation/db/detect/embed/… 重组为 clean-book-text/decide-candidate/write-next-chapter/access-database/ check-content-consistency/embed-knowledge/…(git 识别为 rename,内容保持) - agents/*.md、AGENTS.md/CLAUDE.md 收编、example_skill 登记表同步新名 二、先审后入创作闭环(本次核心) 正文接受从"机械门一过就写正典"改为"机械门+语义审查双通过+用户批准+单事务原子提交", DB 级兜底,编排层跳步即被硬拒。 - candidate_cas.py + example_candidate_cas(109):持久化 CAS 状态链 - fact_delta.py + example_fact_delta/example_fact_ledger(106):结构化事实增量, 模型只提六型闭集增量+正文证据引文,仅用户批准的增量随正文同事务入账本 - projection_registry.py + example_projection_run(107):投影登记与恢复 - acceptance_state.py:接受前置实时状态重读 - lesson_registry.py + example_lesson(108):经验升格链,禁止自动升格 - DDL 105:example_candidate 增 semantic_status/semantic_report_sha256 - write_canonical.accept:语义兜底+同事务合并增量+登记投影; run_writer_pipeline/persist_writer_run/run_writer_semantic_detector/step2 接入全链 - claude_runtime:兼容新 CLI modelUsage 信息字段 三、审查修复(独立子代理四维审查后) - 事实增量 propose→approve 翻态正道,不撞唯一键 - 冻结配置探针重刷(CLI 2.1.211→2.1.231 漂移),profileSha256/adapterVersion 再登记 - 可视化合同悬空路径/五六空间矛盾、 SoT 旧技能名漂移、行尾空白清理 测试:离线 65 套 + 真实库集成 5 套(CAS/接受故障注入/事实增量/投影/经验升格)+ 回放 79 项全绿。 创作内容(docs/design、生成正文 artifacts)按"框架与创作分开"未入本提交。
56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Skill 目录命名与 frontmatter 一致性的离线测试。"""
|
|
|
|
import pathlib
|
|
import tempfile
|
|
import unittest
|
|
|
|
from sync_agent_registry import validate_skill_catalog
|
|
|
|
|
|
class SkillCatalogTest(unittest.TestCase):
|
|
def test_current_catalog_is_valid(self):
|
|
entries = validate_skill_catalog()
|
|
self.assertGreater(len(entries), 0)
|
|
self.assertEqual(len(entries), len({fm["name"] for _, fm in entries}))
|
|
|
|
def test_directory_and_name_must_match(self):
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
root = pathlib.Path(tmp)
|
|
skill = root / "plan-story"
|
|
skill.mkdir()
|
|
(skill / "SKILL.md").write_text(
|
|
"---\nname: planning\ndescription: test\n---\n",
|
|
encoding="utf-8",
|
|
)
|
|
with self.assertRaisesRegex(ValueError, "目录名"):
|
|
validate_skill_catalog(root)
|
|
|
|
def test_name_must_be_action_object(self):
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
root = pathlib.Path(tmp)
|
|
skill = root / "runtime"
|
|
skill.mkdir()
|
|
(skill / "SKILL.md").write_text(
|
|
"---\nname: runtime\ndescription: test\n---\n",
|
|
encoding="utf-8",
|
|
)
|
|
with self.assertRaisesRegex(ValueError, "动作-对象"):
|
|
validate_skill_catalog(root)
|
|
|
|
def test_unknown_frontmatter_key_is_rejected(self):
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
root = pathlib.Path(tmp)
|
|
skill = root / "plan-story"
|
|
skill.mkdir()
|
|
(skill / "SKILL.md").write_text(
|
|
"---\nname: plan-story\ndescription: test\nunknown: value\n---\n",
|
|
encoding="utf-8",
|
|
)
|
|
with self.assertRaisesRegex(ValueError, "未登记字段"):
|
|
validate_skill_catalog(root)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|