Expand description
goalctl — 最小 Goal → Contract 编译器。
- 输入:Goal YAML/JSON(id / outcome / risk / acceptance / invariants / …)
- 输出:Contract JSON + 稳定 digest(canonical JSON 的 sha256)
- fail-closed:空 outcome、缺失 AC id、主观词 lint
Structs§
- Acceptance
Item - 验收项。
- Compile
Output - 编译产物。
- Goal
Contract - 编译后的 Contract(确定性字段顺序由 serde 定义 + canonical JSON 保证)。
- Goal
Document - Goal 文档(YAML/JSON 输入)。
Enums§
- Compile
Error - 编译错误。
- Risk
Level - 风险等级。
- Validate
Error - 校验错误。
Constants§
- SUBJECTIVE_
WORDS - 常见主观 / 不可测措辞(小写匹配)。
- VERSION
Functions§
- compile_
goal - 从文件路径编译(按扩展名选 YAML/JSON;未知则先 YAML 再 JSON)。
- compile_
goal_ str - 从字符串编译。
hint:Some("yaml"|"yml"|"json")或None自动。 - lint_
subjective - 扫描文本中的主观词;返回命中列表(原文片段小写)。
- validate_
goal - 校验 Goal;成功返回
Ok(())。