SuperAPI AI 工具集

follow-graph-spec

编程与开发

查看项目

更新于 10-15 17:29

技能介绍

用途:把现有 graphspec 规范包作为实施依据,逐个工作单元构建,且每次只提取当前 Component/System 相关的最小子图,而非反复载入整包。CLI 固定以 npx graph-spec-cli … 调用,无需预装;已安装时二进制名为 graphspec。

流程:先运行 npx graph-spec-cli validate <path> --strict 校验规范包,有错误或警告先告知用户;再用 npx graph-spec-cli coverage <path> 查看未满足需求、未测试需求、空特性、悬空约束等缺口,并与用户商定先补哪些;用 npx graph-spec-cli order <path> 取依赖的拓扑构建顺序,出现环则先修复依赖图。

每个工作单元按顺序拉取子图:npx graph-spec-cli graph <path> --from <component-id> --rel exposes,uses,satisfies --depth 1 --format json,获取契约、数据模型与需求,再完整阅读对应概念文件。注意 constrains 与 covers 由标注方指向你的概念,默认 --direction out 查不到,需改用 --direction in,例如 --rel constrains --direction in --depth 1。测试场景用 --rel covers --direction in --depth 1 获取,并据其 level 与 Given/When/Then 编写真实自动化测试。可用 npx graph-spec-cli query <path> --type TestScenario --json 列出全部测试场景,但它不含关系。

限制与收尾:coverage --strict 在任何缺口存在时返回非零,适合作为 CI 闸门。实施后重跑 coverage 确认目标缺口消除,并再次 validate --strict 保持干净;若在实施中新增了需求、组件或关系,应先修正规范包再进入下一单元。其他细节见 references/traversal.md。