feat(cli): 分离 hose-aipro 独立命令体系并升级至 v0.9.0

1. 架构对称性与声明式注册表抽取:
   - 新增 src/cli/aipro-registry.ts,声明式定义 AIPRO_COMMAND_REGISTRY 及其别名映射与 mutating 突变检查
   - 重构 src/aipro-cli.ts,移除过程式 switch-case 分发,改为查表式声明分发,与 hose-use 的 CLI_COMMAND_REGISTRY 保持 100% 对称
   - 在 src/cli/registry.ts 统一重导出 aipro-registry,巩固其作为顶层声明注册表的单一事实源地位
   - 增加 aipro-cli 测试用例,强制校验 COMMAND_METADATA["hose-aipro"] 与声明式注册表双向一致性

2. 双 Skill 独立打包与内嵌部署:
   - 注册两个独立技能:skills/hose-use 与 skills/hose-aipro,互相关联引用
   - src/packaging/embedded-skill.ts 增加双 Skill 编译期嵌入与 installSkillFiles 全量同步
   - hose-use / hose-aipro 下的 skill status/dump/install 完全对齐

3. 守护服务交叉治理:
   - src/cli/service.ts 支持 ServiceTargetName ("hose-use" | "hose-aipro"),默认端口 8888 与 8889
   - 支持 hose-use aipro <start|stop|...> 与 hose-aipro hose-use <start|stop|...> 双向服务纳管
   - 误触非本领域业务命令时提供友好互导拦截

4. 审批领域数据层防御加固:
   - 迁移 004:approval_runs 增加 short_id 唯一约束
   - 增加 allocateUniqueShortId 冲突重试,多步写操作纳入事务

5. 版本升级至 v0.9.0:
   - package.json、README.md、specs、.zcode-plugin 及两套 Skill 同步更新至 0.9.0
   - bump-version 脚本适配多 Skill 自动递增
This commit is contained in:
gitea committed 2026-11-03 19:16:12 +08:00
1 parent c3e39fe77a
commit 362acfba58
38 files changed
+1380 -690

No files matched your search

+71 -16
View File
@@ -32,20 +32,23 @@ export const COMMAND_METADATA: Record<string, CliCommandMetadata> = {
flags: { ...flagList("offline cached", "boolean") }
},
"aipro": {
"summary": "AI PRO 确定性审批仲裁",
"usage": "hose-use aipro <子命令>",
"summary": "管理本机 hose-aipro 审批网关常驻服务",
"usage": "hose-use aipro <start|stop|restart|status|logs>",
"commands": {
"status": "查看网关状态",
"bind": "绑定单据",
"review": "核验要点",
"decide": "执行仲裁",
"init": "初始化审批上下文",
"scopes": "列出审批规则场景",
"translate": "转译单据",
"rules": "查看审批规则",
"points": "查看审核要点",
"checklist": "查看核验清单",
"logs": "查看审批日志",
"start": "启动本机 hose-aipro 网关服务",
"stop": "停止本机 hose-aipro 网关服务",
"restart": "重启本机 hose-aipro 网关服务",
"status": "查看本机 hose-aipro 网关服务状态",
"logs": "查看本机 hose-aipro 网关服务日志",
"bind": "绑定单据 (已独立为 hose-aipro bind)",
"review": "核验要点 (已独立为 hose-aipro review)",
"decide": "执行仲裁 (已独立为 hose-aipro decide)",
"init": "初始化审批会话 (已独立为 hose-aipro init)",
"scopes": "列出审批规则场景 (已独立为 hose-aipro scopes)",
"translate": "转译单据 (已独立为 hose-aipro translate)",
"rules": "查看审批规则 (已独立为 hose-aipro rules)",
"points": "查看审核要点 (已独立为 hose-aipro points)",
"checklist": "查看核验清单 (已独立为 hose-aipro checklist)",
"help": "help 命令"
},
"aliases": [],
@@ -71,7 +74,59 @@ export const COMMAND_METADATA: Record<string, CliCommandMetadata> = {
"history": "logs",
"trail": "logs"
},
flags: { ...flagList("apply confirm do execute j json v version y yes", "boolean"), ...flagList("run a action c code codes comment corp e eval evidence findings i id index indexes limit m message n opinion p point proof r reason reasoning rule rules s scope scopes sn state status target 审批意见 意见", "value") }
flags: { ...flagList("apply confirm do execute j json v version y yes", "boolean"), ...flagList("run a action c code codes comment corp e eval evidence findings host i id index indexes limit m message n opinion p point port proof r reason reasoning rule rules s scope scopes sn state status target 审批意见 意见", "value") }
},
"hose-aipro": {
"summary": "合思 AI PRO 确定性审批仲裁网关",
"usage": "hose-aipro <子命令>",
"commands": {
"status": "查看网关状态",
"bind": "绑定单据",
"review": "核验要点",
"decide": "执行仲裁",
"init": "初始化审批上下文",
"scopes": "列出审批规则场景",
"translate": "转译单据",
"rules": "查看审批规则",
"points": "查看审核要点",
"checklist": "查看核验清单",
"logs": "查看审批日志",
"service": "管理本机 hose-aipro 常驻服务",
"hose-use": "管理本机 hose-use 常驻服务",
"update": "检查并升级版本",
"skill": "管理 Agent 技能",
"version": "查看版本信息",
"help": "help 命令"
},
"aliases": [],
"commandAliases": {
"whoami": "status",
"context": "status",
"info": "status",
"start": "init",
"index": "scopes",
"indexes": "scopes",
"doc": "translate",
"markdown": "translate",
"render": "translate",
"rule": "rules",
"mount": "bind",
"clauses": "points",
"list": "checklist",
"eval": "review",
"evaluate": "review",
"approve": "decide",
"reject": "decide",
"log": "logs",
"history": "logs",
"trail": "logs",
"self-update": "update",
"skills": "skill",
"daemon": "service",
"hose": "hose-use",
"v": "version"
},
flags: { ...flagList("apply confirm do execute j json v version y yes", "boolean"), ...flagList("run a action c code codes comment corp e eval evidence findings host i id index indexes limit m message n opinion p point port proof r reason reasoning rule rules s scope scopes sn state status target 审批意见 意见", "value") }
},
"auth": {
"summary": "认证与凭证管理(支持主账号登录与企业级 OpenAPI 持久化)",
@@ -869,11 +924,11 @@ export function localCommandFlags(area?: string, action?: string): Record<string
|| (["bill", "flow"].includes(resolved?.area || "") && ["list", "link"].includes(canonical || "list"))
|| (resolved?.area === "workflow" && canonical === "node")
|| (resolved?.area === "platform" && canonical === "record")
|| (resolved?.area === "aipro" && canonical === "bind");
|| (["aipro", "hose-aipro"].includes(resolved?.area || "") && canonical === "bind");
if (!localC) delete flags.c;
if (resolved?.area === "workflow" && canonical === "create") flags.f = "value";
// --run historically accepts a session ID and, for decide, an apply boolean.
if (resolved?.area === "aipro" && canonical === "decide") flags.run = "boolean-or-value";
if (["aipro", "hose-aipro"].includes(resolved?.area || "") && canonical === "decide") flags.run = "boolean-or-value";
return flags;
}