diffcat-cli 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -5
- package/connectors/workbuddy/cli.json +3 -3
- package/connectors/workbuddy/connector-meta.json +10 -4
- package/connectors/workbuddy/skills/diffcat/SKILL.md +39 -15
- package/connectors/workbuddy/skills/diffcat/references/knowledge.md +26 -0
- package/connectors/workbuddy/skills/diffcat/references/operations.md +12 -0
- package/connectors/workbuddy/skills/diffcat/references/safety.md +1 -1
- package/dist/capability-authorization.d.ts +23 -0
- package/dist/capability-authorization.js +36 -0
- package/dist/capability-authorization.js.map +1 -0
- package/dist/client.d.ts +4 -1
- package/dist/client.js +14 -0
- package/dist/client.js.map +1 -1
- package/dist/device-login.d.ts +0 -1
- package/dist/device-login.js +0 -2
- package/dist/device-login.js.map +1 -1
- package/dist/index.js +73 -40
- package/dist/index.js.map +1 -1
- package/dist/knowledge-store.d.ts +55 -0
- package/dist/knowledge-store.js +265 -0
- package/dist/knowledge-store.js.map +1 -0
- package/dist/knowledge-types.d.ts +47 -0
- package/dist/knowledge-types.js +2 -0
- package/dist/knowledge-types.js.map +1 -0
- package/dist/types.d.ts +18 -0
- package/knowledge/catalog.json +542 -0
- package/knowledge/topics/documents/consignment-reconciliation.md +7 -0
- package/knowledge/topics/documents/crowdfunding-order.md +7 -0
- package/knowledge/topics/documents/direct-order.md +7 -0
- package/knowledge/topics/documents/expense-request.md +7 -0
- package/knowledge/topics/documents/inbound-order.md +7 -0
- package/knowledge/topics/documents/invoice-request.md +7 -0
- package/knowledge/topics/documents/leave-request.md +7 -0
- package/knowledge/topics/documents/outbound-order.md +7 -0
- package/knowledge/topics/documents/purchase-request.md +7 -0
- package/knowledge/topics/documents/refund-request.md +7 -0
- package/knowledge/topics/documents/sales-order.md +17 -0
- package/knowledge/topics/documents/stocktake-order.md +7 -0
- package/knowledge/topics/documents/supply-entry-order.md +7 -0
- package/knowledge/topics/documents/supply-issue-request.md +7 -0
- package/knowledge/topics/documents/supply-purchase-request.md +7 -0
- package/knowledge/topics/documents/supply-stocktake-order.md +7 -0
- package/knowledge/topics/guides/document-drafts.md +13 -0
- package/knowledge/topics/guides/login-and-authorization.md +12 -0
- package/knowledge/topics/guides/master-data-and-query.md +13 -0
- package/knowledge/topics/guides/recovery.md +13 -0
- package/knowledge/topics/guides/workflow-tasks.md +12 -0
- package/knowledge/topics/modules/administration.md +12 -0
- package/knowledge/topics/modules/crowdfunding.md +14 -0
- package/knowledge/topics/modules/finance.md +14 -0
- package/knowledge/topics/modules/inventory.md +14 -0
- package/knowledge/topics/modules/operations.md +14 -0
- package/knowledge/topics/modules/organization.md +16 -0
- package/knowledge/topics/modules/partner.md +11 -0
- package/knowledge/topics/modules/project.md +17 -0
- package/knowledge/topics/modules/sales.md +15 -0
- package/knowledge/topics/overview/navigation.md +21 -0
- package/knowledge/topics/overview/system.md +14 -0
- package/knowledge/topics/troubleshooting/document-correction.md +16 -0
- package/knowledge/topics/troubleshooting/permission-and-not-found.md +12 -0
- package/knowledge/topics/troubleshooting/workflow-stuck.md +11 -0
- package/package.json +2 -1
- package/plugins/diffcat/.codex-plugin/plugin.json +7 -5
- package/plugins/diffcat/README.md +7 -1
- package/plugins/diffcat/skills/diffcat/SKILL.md +32 -7
- package/plugins/diffcat/skills/diffcat/agents/openai.yaml +2 -2
- package/plugins/diffcat/skills/diffcat/references/authentication.md +12 -5
- package/plugins/diffcat/skills/diffcat/references/capabilities.md +1 -0
- package/plugins/diffcat/skills/diffcat/references/knowledge.md +40 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 销售订单办理流程
|
|
2
|
+
|
|
3
|
+
销售订单连接客户需求、报价、库存履约和财务结算。创建前应确认客户或合作商、商品、数量、价格、币种、收款方式和交付信息。
|
|
4
|
+
|
|
5
|
+
## 基线流程
|
|
6
|
+
|
|
7
|
+
订单启动后,系统可按创建人类型决定是否进入报价;业务接单时复核交易条件并准备额度或预存资金;随后创建并等待销售出库;实际发货汇总后进入财务处理,最终由相关方确认收货。不同客户类型、金额或配置可能产生不同分支。
|
|
8
|
+
|
|
9
|
+
## 节点职责
|
|
10
|
+
|
|
11
|
+
- 报价:确认商品价格、数量和结算信息。
|
|
12
|
+
- 接单:复核订单可履约性和资金条件,并安排出库。
|
|
13
|
+
- 等待出库:等待全部有效出库完成,汇总实际发货。
|
|
14
|
+
- 财务处理:核对收款方式和应收、收款结果。
|
|
15
|
+
- 确认收货:确认客户收货并结束履约。
|
|
16
|
+
|
|
17
|
+
办理前使用 `knowledge flow SALES_ORDER` 查询当前发布版本、实际节点、分支和办理人。填错时先查询订单详情、流程状态、当前身份和下游出库或财务记录,再参考“单据填错后的处理判断”。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 创建单据草稿
|
|
2
|
+
|
|
3
|
+
创建草稿前先收集业务上确实需要的信息,并通过只读资源解析引用对象。金额、币种、单位、仓库、项目、客户和供应商等字段不应凭空补全。
|
|
4
|
+
|
|
5
|
+
## 推荐步骤
|
|
6
|
+
|
|
7
|
+
1. 查看目标资源或能力说明,确定必填字段与数据类型。
|
|
8
|
+
2. 查询并确认基础资料;对重名结果请用户选择。
|
|
9
|
+
3. 以最小授权创建草稿,保留系统返回的单号或 ID。
|
|
10
|
+
4. 立即回查草稿,向用户展示关键字段供确认。
|
|
11
|
+
5. 提交或审批前再次提示业务影响,并遵守能力的确认要求。
|
|
12
|
+
|
|
13
|
+
创建草稿不等于流程已完成。后续是否可编辑、撤回或重提由单据状态和已登记能力决定,不调用未登记的写能力。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 登录与最小授权
|
|
2
|
+
|
|
3
|
+
DiffCat CLI 使用 profile 保存服务地址和会话。先登录,再查看状态;知识命令会在每次执行前验证当前授权,授权已过期或被撤销时不会继续读取本地知识。
|
|
4
|
+
|
|
5
|
+
## 授权原则
|
|
6
|
+
|
|
7
|
+
- 静态知识只要求当前登录有效,不额外申请知识能力。
|
|
8
|
+
- 查询真实业务数据前,先查看资源说明,再申请所需的只读能力。
|
|
9
|
+
- 查询当前发布流程需要 `knowledge.flows.read`,同时受对应业务菜单权限约束。
|
|
10
|
+
- 创建草稿或办理审批属于写操作,只申请明确需要的能力,并遵循确认策略。
|
|
11
|
+
|
|
12
|
+
`auth status` 返回的 `subject` 可用于判断当前用户 ID、显示名称、用户类型、部门和角色。CLI 授权与业务权限同时生效:有能力但无菜单或对象权限时仍会被拒绝。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 基础资料与业务查询
|
|
2
|
+
|
|
3
|
+
查询业务单据前,通常要先解析客户、供应商、商品、物料、仓库、项目、公司、币种、单位或账号等基础资料。
|
|
4
|
+
|
|
5
|
+
## 查询方法
|
|
6
|
+
|
|
7
|
+
1. 先查看资源说明和输入结构。
|
|
8
|
+
2. 用尽量唯一的编号或名称查询列表,并处理分页。
|
|
9
|
+
3. 若出现重名,不要自行猜测,应使用更多字段缩小范围或请用户确认。
|
|
10
|
+
4. 取得唯一 ID 后再查询详情或作为单据输入。
|
|
11
|
+
5. 对“查不到”分别检查登录、能力授权、菜单权限、对象范围、查询条件和软删除状态。
|
|
12
|
+
|
|
13
|
+
展示名称用于解释,稳定 ID 用于业务引用。不要把未经核实的首条结果当作唯一对象。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 失败恢复与安全重试
|
|
2
|
+
|
|
3
|
+
遇到超时、网络中断或状态未知时,不要立即重复写操作。先用单号、请求标识或业务条件回查结果,确认上一次操作是否已经成功。
|
|
4
|
+
|
|
5
|
+
## 常见处理
|
|
6
|
+
|
|
7
|
+
- 登录或授权失效:重新登录或申请最小能力,再重新查询状态。
|
|
8
|
+
- 输入校验失败:按错误字段修正草稿,不扩大授权。
|
|
9
|
+
- 操作处理中断:先回查单据、流程和下游记录,再决定是否重试。
|
|
10
|
+
- 网页确认未完成:保留待确认状态,让用户完成确认后再继续。
|
|
11
|
+
- 结果校验失败:停止后续写操作,报告已发生的事实和未完成部分。
|
|
12
|
+
|
|
13
|
+
重试必须考虑幂等和副作用。查询可以安全重试;创建、审批、付款、库存执行等写操作必须先确认是否已产生结果。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 流程待办与审批
|
|
2
|
+
|
|
3
|
+
流程待办表示当前用户可以办理的节点。查看单据流程时,要区分当前节点、候选办理人、实际待办、抄送和系统等待节点。
|
|
4
|
+
|
|
5
|
+
## 办理前检查
|
|
6
|
+
|
|
7
|
+
- 查询当前用户身份和单据详情。
|
|
8
|
+
- 查看 `myFlowTasks` 或等效待办字段,确认当前用户确有任务。
|
|
9
|
+
- 查询当前发布流程,理解节点职责、策略和分支。
|
|
10
|
+
- 核对同意、拒绝、退回等操作会带来的业务结果。
|
|
11
|
+
|
|
12
|
+
静态知识描述基线职责;实时发布流程说明当前配置。没有 `knowledge.flows.read` 或菜单权限时,只能提供基线说明,并明确无法确认最新版本、实际办理人和分支。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 行政模块
|
|
2
|
+
|
|
3
|
+
行政模块覆盖办公用品和员工行政申请。用品业务包含用品档案、采购、录入、领用、盘点及库存;费用申请连接费用科目与财务应付;请假申请连接员工归属部门、主管审批和返岗办理。
|
|
4
|
+
|
|
5
|
+
## 建议使用顺序
|
|
6
|
+
|
|
7
|
+
1. 先维护用品、费用科目、用户部门与角色等基础资料。
|
|
8
|
+
2. 发起采购、录入、领用、盘点、费用或请假单据。
|
|
9
|
+
3. 在流程待办中由当前办理人审核或办理。
|
|
10
|
+
4. 完成后检查用品库存、资产、应付或人员状态等业务结果。
|
|
11
|
+
|
|
12
|
+
单据流程可能由管理员更新。静态章节解释业务基线,实际节点、办理人和分支应以当前发布流程为准。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 众筹项目与履约模块
|
|
2
|
+
|
|
3
|
+
## 主要入口
|
|
4
|
+
|
|
5
|
+
先维护众筹平台和项目,再导入平台订单。订单经过来源和冲突检查后进入准备发货,形成履约单和销售出库;发货记录用于追踪实际履约结果。
|
|
6
|
+
|
|
7
|
+
## 使用重点
|
|
8
|
+
|
|
9
|
+
- 平台与项目确定外部订单来源和归集范围。
|
|
10
|
+
- 导入时关注重复订单、来源冲突、地址和商品映射。
|
|
11
|
+
- 准备发货前核对仓库、可用库存和订单拆合规则。
|
|
12
|
+
- 履约结束要检查出库完成数量与发货记录。
|
|
13
|
+
|
|
14
|
+
众筹履约与销售、库存紧密相连。若订单已生成唯一出库或已经发货,纠错前必须检查下游状态,避免重复履约。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 财务模块
|
|
2
|
+
|
|
3
|
+
## 业务范围
|
|
4
|
+
|
|
5
|
+
财务模块管理应收账款、收款单、应付账款、付款单、银行账户、开票申请、退款申请以及由费用等上游业务产生的财务结果。
|
|
6
|
+
|
|
7
|
+
## 业务关系
|
|
8
|
+
|
|
9
|
+
- 销售、代销对账等业务可形成应收并由收款核销。
|
|
10
|
+
- 采购、费用、退款等业务可形成应付并由付款核销。
|
|
11
|
+
- 开票申请依据真实交易和购方资料办理发票。
|
|
12
|
+
- 银行账户参与收付款和资金记录,不能作为普通文本随意替换。
|
|
13
|
+
|
|
14
|
+
处理错单时,要同时检查收付款、核销、发票和上游单据。已完成财务处理的单据通常需要走撤销、冲正或重建等受控路径,不能只修改原单。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 制造与库存模块
|
|
2
|
+
|
|
3
|
+
## 入口与前置资料
|
|
4
|
+
|
|
5
|
+
仓库、供应商和物料是库存业务的基础。物料库存用于查看当前结存,库存流水用于追踪数量变化;采购申请、入库、出库和盘存负责形成受控的库存变更。
|
|
6
|
+
|
|
7
|
+
## 主要业务
|
|
8
|
+
|
|
9
|
+
- 采购申请:提出采购需求,审批和财务办理后等待实际入库。
|
|
10
|
+
- 入库:按来源和入库类型审核、核实明细,必要时进行 IQC,再增加库存。
|
|
11
|
+
- 出库:仓库审核后备货、冻结库存并发货扣减。
|
|
12
|
+
- 盘存:对账面数和实盘数进行审批后处理盘盈、盘亏或平账。
|
|
13
|
+
|
|
14
|
+
库存写入通常发生在流程后段,且可能带有库存锁、批次和来源单据约束。已执行库存变更的单据不能按普通草稿方式修正,应先评估反冲或后续业务路径。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 运维与系统配置模块
|
|
2
|
+
|
|
3
|
+
## 用途
|
|
4
|
+
|
|
5
|
+
本模块面向管理员维护系统运行所需的公共配置,包括菜单、审计与事件日志、数据字典、Flow V2 流程模板、币种汇率、计量单位、编码规则和费用科目。
|
|
6
|
+
|
|
7
|
+
## 使用重点
|
|
8
|
+
|
|
9
|
+
- 菜单与权限决定用户能看到和办理哪些业务。
|
|
10
|
+
- 数据字典、币种、汇率、单位和编码规则会影响业务表单的可选值与编号。
|
|
11
|
+
- 流程模板只有发布且启用的版本才是当前线上流程;草稿不能视为正在执行的版本。
|
|
12
|
+
- 审计日志用于追踪关键操作,事件日志用于判断异步处理和业务联动。
|
|
13
|
+
|
|
14
|
+
配置变更可能影响后续新单据。修改前应确认生效范围,修改后用真实权限账号验证;不要把内部配置、密钥或原始流程条件作为终端用户知识暴露。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 组织与权限模块
|
|
2
|
+
|
|
3
|
+
## 用途与入口
|
|
4
|
+
|
|
5
|
+
本模块维护用户、部门、角色和公司,是菜单可见性、流程办理人、数据范围与审计身份的共同基础。管理员通常先建立公司和部门,再配置角色与用户归属,最后分配菜单和业务权限。
|
|
6
|
+
|
|
7
|
+
## 主要操作
|
|
8
|
+
|
|
9
|
+
- 用户:维护账号、显示名称、用户类型、所属部门和角色。
|
|
10
|
+
- 部门:维护组织层级及业务归属。
|
|
11
|
+
- 角色:归集菜单与操作权限,减少逐人配置。
|
|
12
|
+
- 公司:维护业务主体及其基础信息。
|
|
13
|
+
|
|
14
|
+
## 关联与注意事项
|
|
15
|
+
|
|
16
|
+
流程中的“部门负责人”“指定角色”等办理人依赖这些资料。调整组织关系后,既要关注新任务的分配,也要检查已有待办是否仍有有效办理人。CLI 授权只允许调用能力,不能代替菜单和对象级权限。
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 项目模块使用说明
|
|
2
|
+
|
|
3
|
+
## 入口与准备
|
|
4
|
+
|
|
5
|
+
项目模块用于把预算、计划和实际业务归集到同一个项目。先建立项目档案并确认负责人、周期、状态和业务范围;随后维护预算条目,作为预算申请和核算分类的基础。
|
|
6
|
+
|
|
7
|
+
## 典型使用路径
|
|
8
|
+
|
|
9
|
+
1. 项目档案:定义项目主体、负责人、时间范围和状态。
|
|
10
|
+
2. 预算条目:建立可复用的预算分类与口径。
|
|
11
|
+
3. 预算申请:按项目和条目申请额度,经过业务审批后形成可执行预算。
|
|
12
|
+
4. 项目计划:拆分阶段、任务、采购或行政安排,为后续单据提供来源。
|
|
13
|
+
5. 项目核算:汇总费用、采购、库存或其他实际发生额,与计划和预算比较。
|
|
14
|
+
|
|
15
|
+
## 关联模块
|
|
16
|
+
|
|
17
|
+
项目不是孤立台账。采购申请、用品采购、费用申请等可能引用项目或计划;财务结果进入项目核算。查询差异时要同时核对项目状态、预算口径、来源单据状态与实际入账时间。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 销售与品牌模块
|
|
2
|
+
|
|
3
|
+
## 入口与前置资料
|
|
4
|
+
|
|
5
|
+
先维护客户、门店、合同、商品和价目,再办理销售订单、直销订单或代销对账单。合同和价目提供交易约束,客户与门店决定结算及履约对象,商品明细会继续影响库存和财务。
|
|
6
|
+
|
|
7
|
+
## 主要业务
|
|
8
|
+
|
|
9
|
+
- 销售订单:覆盖报价、接单、出库、财务处理和收货确认。
|
|
10
|
+
- 直销订单:经过业务审核后接单、发货并确认收货。
|
|
11
|
+
- 代销对账:汇总门店销售结果,经业务和财务办理后完成收款核销。
|
|
12
|
+
|
|
13
|
+
## 关联模块
|
|
14
|
+
|
|
15
|
+
销售单据可能创建出库、应收、收款或退款等下游记录。纠错时必须先检查当前状态和下游单据,不能只修改表面字段。当前节点与分支以实时发布流程为准。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 菜单与功能导航
|
|
2
|
+
|
|
3
|
+
员工端当前按九个菜单分组组织 54 个页面;实际可见范围由用户类型、部门、角色和菜单授权共同决定。合作商门户另有四个固定页面,不计入这 54 个员工端菜单。
|
|
4
|
+
|
|
5
|
+
## 员工端九个菜单分组
|
|
6
|
+
|
|
7
|
+
- 工作台:首页、数据中心。
|
|
8
|
+
- 组织权限:用户、部门、角色、公司。
|
|
9
|
+
- 系统运维:菜单、审计日志、事件日志、数据字典、流程模板、币种、汇率、单位、编码规则、费用科目。
|
|
10
|
+
- 销售与品牌:客户、门店、合同、商品、价目、销售订单、直销订单、代销对账。
|
|
11
|
+
- 制造与库存:仓库、供应商、物料、物料库存、库存流水、采购申请、入库单、出库单、盘存单。
|
|
12
|
+
- 行政:行政用品、用品采购、用品领用、用品盘点、用品录入、费用申请、固定支出、请假申请。
|
|
13
|
+
- 财务:应收账款、收款记录、开票记录、应付账款、付款记录、银行账户、银行流水、信用记录、退款申请。
|
|
14
|
+
- 项目:项目档案;预算、计划和核算在项目业务内协同使用。
|
|
15
|
+
- 众筹:众筹平台、众筹项目、发货记录;订单导入、准备发货和履约在项目业务内办理。
|
|
16
|
+
|
|
17
|
+
合作商固定门户包含首页、订单、资金和库存,只展示与当前嘉宾身份相关的数据。
|
|
18
|
+
|
|
19
|
+
## 找不到入口时
|
|
20
|
+
|
|
21
|
+
先确认登录身份和当前公司,再检查对应菜单是否已授权。知道业务名但不知道菜单时,用知识搜索;知道数据对象时,也可以查看相应资源的能力说明。菜单不可见不代表数据不存在,也不应通过其他资源绕过对象范围。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# DiffCat 系统概览
|
|
2
|
+
|
|
3
|
+
DiffCat 把企业日常协作分为组织权限、系统运维、销售品牌、制造库存、行政、财务、项目、众筹履约和合作商门户九个业务领域。基础资料用于统一客户、供应商、商品、物料、仓库、项目、币种、单位等对象;业务单据记录一次具体申请或交易;Flow V2 负责把需要多人协作的单据送到相应节点办理。
|
|
4
|
+
|
|
5
|
+
## 使用知识服务
|
|
6
|
+
|
|
7
|
+
- 不确定从哪里开始时,先查看“菜单与功能导航”或搜索业务名。
|
|
8
|
+
- 想了解模块时,读取模块说明,重点看入口、前置资料、主要操作、状态和关联模块。
|
|
9
|
+
- 想了解当前办理流程时,先读取对应单据主题,再查询当前发布流程。发布流程可能随管理员配置变化,以实时结果为准。
|
|
10
|
+
- 遇到填错、卡住或无权限时,应先取得单号并查询真实状态,不根据经验猜测。
|
|
11
|
+
|
|
12
|
+
## 安全边界
|
|
13
|
+
|
|
14
|
+
知识命令提供说明和诊断依据,不替代业务权限。静态知识要求当前 profile 已有效登录;实时流程还要求显式授权以及对应业务菜单权限。任何新建、审批或其他写操作都必须使用已登记能力并遵循确认要求。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 单据填错后的处理判断
|
|
2
|
+
|
|
3
|
+
先取得准确单号;没有单号时先询问用户。随后查询唯一单据及详情,并结合 `auth status` 的 `subject`、单据创建人、当前状态、`myFlowTasks`、撤回或重提标志以及下游单据作判断。
|
|
4
|
+
|
|
5
|
+
## 判断顺序
|
|
6
|
+
|
|
7
|
+
1. 草稿或未进入流程:若当前用户有编辑权限,通常直接修正后复核。
|
|
8
|
+
2. 流程中:若创建人可撤回且系统明确提供撤回标志,可建议撤回后修改;否则由当前办理人按业务规则退回或拒绝。
|
|
9
|
+
3. 已驳回、拒绝或撤销:检查是否允许重提;不允许时保留原单并按规则重建。
|
|
10
|
+
4. 已完成且没有下游影响:依据单据模块的受控更正规则处理。
|
|
11
|
+
5. 已产生出入库、收付款、核销、发票、资产或其他下游单据:先评估下游反冲、撤销或调整路径,再处理上游,不能只改原单。
|
|
12
|
+
6. 无能力、菜单或对象权限:说明缺少哪一层权限,转交创建人、当前办理人或管理员。
|
|
13
|
+
|
|
14
|
+
## 输出建议
|
|
15
|
+
|
|
16
|
+
向用户说明已确认的状态、当前身份关系、可选路径、每条路径的影响和推荐方案。只提供办理路径,不调用未登记的编辑、撤回、重建或取消能力,也不声称已经修改业务数据。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 没有权限或查不到数据
|
|
2
|
+
|
|
3
|
+
“没有权限”和“查不到”可能来自不同层级,应按顺序定位。
|
|
4
|
+
|
|
5
|
+
1. 当前 profile 是否仍有效登录,授权是否过期或被撤销。
|
|
6
|
+
2. 是否授予目标 CLI 能力,操作是否在授权范围内。
|
|
7
|
+
3. 当前用户是否拥有对应业务菜单。
|
|
8
|
+
4. 对象是否属于当前公司、部门、角色、合作商或仓库范围。
|
|
9
|
+
5. 查询条件、编号、分页和状态筛选是否正确。
|
|
10
|
+
6. 数据是否已删除、归档或尚未创建。
|
|
11
|
+
|
|
12
|
+
服务端对越权对象可能采用“未找到”语义,不能据此推断对象一定不存在。不要尝试更换资源绕过权限,应请有权用户核实或由管理员调整正式授权。
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 流程停滞与待办诊断
|
|
2
|
+
|
|
3
|
+
先查询单据详情、当前发布流程和当前用户待办,再判断停滞类型。
|
|
4
|
+
|
|
5
|
+
- 人工节点:核对办理人策略是否能解析到有效用户,当前用户是否确有 `myFlowTasks`。
|
|
6
|
+
- 条件分支:核对业务字段是否满足某条连线;安全视图只解释标签,不暴露原始条件参数。
|
|
7
|
+
- 等待节点:检查所等待的出库、入库、付款、收货或其他外部业务是否全部完成。
|
|
8
|
+
- 系统节点:查看单据和下游状态,判断是否发生库存、财务或异步事件失败。
|
|
9
|
+
- 版本差异:运行中的实例可能源于启动时的定义;不要用草稿模板冒充当前发布流程。
|
|
10
|
+
|
|
11
|
+
没有实时流程权限时,只能根据静态基线给出排查方向,并明确无法确认当前节点配置、实际办理人和最新分支。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diffcat-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Security-first CLI for AI agents to invoke registered Diffcat capabilities",
|
|
5
5
|
"homepage": "https://diffcat.howcat.cn",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
+
"knowledge",
|
|
12
13
|
"README.md",
|
|
13
14
|
".agents/plugins/marketplace.json",
|
|
14
15
|
"connectors/workbuddy",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diffcat",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Use the DiffCat CLI
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Use the DiffCat CLI after checking login first for business knowledge, diagnostics, authorized queries, drafts, and approvals.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "DiffCat"
|
|
7
7
|
},
|
|
@@ -9,13 +9,15 @@
|
|
|
9
9
|
"skills": "./skills/",
|
|
10
10
|
"interface": {
|
|
11
11
|
"displayName": "DiffCat",
|
|
12
|
-
"shortDescription": "
|
|
13
|
-
"longDescription": "
|
|
12
|
+
"shortDescription": "先检查登录,再用简单自然的话办理 DiffCat 业务",
|
|
13
|
+
"longDescription": "每次使用前先确认 DiffCat 已登录。登录后,可检索内置业务知识、查询当前发布流程、诊断业务问题、查询单据、创建草稿,并在用户确认后办理支持的审批。",
|
|
14
14
|
"developerName": "DiffCat",
|
|
15
15
|
"category": "Productivity",
|
|
16
16
|
"capabilities": ["Read", "Write"],
|
|
17
17
|
"defaultPrompt": [
|
|
18
|
-
"
|
|
18
|
+
"介绍 DiffCat 项目模块怎么用。",
|
|
19
|
+
"查询销售订单当前发布的办理流程和节点职责。",
|
|
20
|
+
"根据订单状态和我的身份判断填错后该怎么处理。",
|
|
19
21
|
"根据现有基础资料创建一张 DiffCat 单据草稿,并核对创建结果。",
|
|
20
22
|
"查看我的 DiffCat 待办;只有我明确指定后才发起受支持的审批。"
|
|
21
23
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DiffCat Codex Plugin
|
|
2
2
|
|
|
3
|
-
这个插件随 `diffcat-cli` npm 包发布,为 Codex 提供 `$diffcat` Companion Skill
|
|
3
|
+
这个插件随 `diffcat-cli` npm 包发布,为 Codex 提供 `$diffcat` Companion Skill。它会按需检索随包发布的业务知识,并可在获得授权后查询当前发布流程。它不会绕过 DiffCat 的服务端权限,也不包含 MCP Server;所有业务操作都由同一 npm 包安装的 `diffcat` CLI 调用服务端登记能力。
|
|
4
4
|
|
|
5
5
|
## 安装 CLI
|
|
6
6
|
|
|
@@ -20,6 +20,12 @@ diffcat setup codex
|
|
|
20
20
|
|
|
21
21
|
安装或更新后新建一个 Codex 会话,让 Codex 重新加载 Skill。CLI 默认连接 `https://diffcat-api.howcat.cn`,并通过 `https://diffcat.howcat.cn` 完成浏览器设备授权;第一次连接或切换环境时需要重新授权。
|
|
22
22
|
|
|
23
|
+
## 使用体验
|
|
24
|
+
|
|
25
|
+
每次使用 DiffCat 插件时,Agent 会先确认当前账号已经登录。未登录或登录已经失效时,它只会提醒用户先完成登录,不会继续查询、分析或办理其他 DiffCat 业务。登录后,Agent 会重新检查一次再继续。
|
|
26
|
+
|
|
27
|
+
面向用户的回复默认使用自然、易懂的表达。模块介绍先检索并按需加载知识章节;流程问题再查询当前发布版;错单诊断会结合单据状态、当前身份、待办和下游影响给出建议,但不会调用未登记的修改或撤回能力。除非用户明确要求排查技术问题,否则不会直接展示程序代码、内部名称、原始返回内容或其他不必要的技术细节。
|
|
28
|
+
|
|
23
29
|
## 从仓库验证 npm 安装物
|
|
24
30
|
|
|
25
31
|
在 `cli` 目录执行:
|
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: diffcat
|
|
3
|
-
description: Use the installed DiffCat CLI
|
|
3
|
+
description: Use the installed DiffCat CLI for built-in business knowledge, module and workflow guidance, issue diagnosis, authorized business queries, document drafts, and workflow approvals. Always verify that the selected profile is logged in before answering or doing any other DiffCat work. Speak to users in plain, non-technical language. Trigger for DiffCat features, modules, business data, documents, statistics, and workflow tasks; do not use for unrelated repository development.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# DiffCat CLI
|
|
7
7
|
|
|
8
8
|
Use `diffcat` as the only business execution surface. The server capability catalog, the current grant, the user's live menu/action permissions, policy constraints, and object-level checks jointly determine access. Never bypass the CLI with internal REST endpoints, database access, browser form automation, GraphQL, SQL, or scripts.
|
|
9
9
|
|
|
10
|
+
## Login gate — always do this first
|
|
11
|
+
|
|
12
|
+
On every invocation of this skill, make the selected profile's login check the first DiffCat action:
|
|
13
|
+
|
|
14
|
+
```powershell
|
|
15
|
+
diffcat --profile <name> --pretty auth status
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use the profile named by the user; otherwise use `default`. Do not inspect the capability catalog, analyze the requested business data, read other task references, or answer the DiffCat question before this check finishes.
|
|
19
|
+
|
|
20
|
+
- If the command is unavailable, briefly tell the user that DiffCat CLI must be installed first, then stop.
|
|
21
|
+
- If the profile is not logged in, its login has expired, or the result does not clearly confirm an active login, stop the turn. Reply only that DiffCat is not logged in and ask the user to complete login first. Do not answer any other question or any other part of the request, including unrelated parts, and do not make another DiffCat call.
|
|
22
|
+
- If the user asks for help logging in, read [references/authentication.md](references/authentication.md) and help only with the login. Resume the original task only after login completes and a fresh `auth status` check succeeds.
|
|
23
|
+
- When the user says they have logged in, always run the check again. Never rely on their message alone or on a check from an earlier turn.
|
|
24
|
+
|
|
10
25
|
## Start safely
|
|
11
26
|
|
|
12
|
-
1.
|
|
13
|
-
2.
|
|
14
|
-
3.
|
|
15
|
-
4. Run `diffcat --pretty capability list` and, before constructing unfamiliar input, `diffcat --pretty capability describe <capability-id>`. Treat the returned capability definition and `inputSchema` as authoritative over examples or cached knowledge.
|
|
27
|
+
1. After the login gate passes, keep using the same profile for every command. Keep environments in separate profiles and never silently switch a request from test to production.
|
|
28
|
+
2. For knowledge-only questions, go directly to `knowledge search` after the login check; static knowledge does not require a separate business capability. Before querying live business data or constructing unfamiliar input, run `diffcat --pretty capability list` and `diffcat --pretty capability describe <capability-id>`. Treat the returned capability definition and `inputSchema` as authoritative over examples or cached knowledge.
|
|
29
|
+
3. If the user needs more access than the current login provides, explain the missing access in plain language and ask before starting a separate `capability request`. Do not repeat login. Request only what is needed for the user's current and reasonably stated recurring workflow.
|
|
16
30
|
|
|
17
31
|
## Route the task
|
|
18
32
|
|
|
33
|
+
- For feature introductions, module guidance, current workflow explanations, or issue diagnosis, read [references/knowledge.md](references/knowledge.md). Search first and load only matched topics; query the live flow only when current configuration matters.
|
|
34
|
+
- `knowledge flow` requires the explicitly granted `knowledge.flows.read` ability and the matching business menu. For a wrong order or document, ask for the order number when it is missing before querying or advising.
|
|
19
35
|
- For base/master data, identifiers, projects, documents, workflow tasks, or statistics, read [references/querying.md](references/querying.md).
|
|
20
36
|
- For creating a business document draft, read [references/drafts-and-approvals.md](references/drafts-and-approvals.md#creating-a-draft).
|
|
21
37
|
- For approving a workflow task, read [references/drafts-and-approvals.md](references/drafts-and-approvals.md#approving-a-task).
|
|
@@ -34,8 +50,17 @@ Use `diffcat` as the only business execution surface. The server capability cata
|
|
|
34
50
|
- Never report a write as successful when its status is `running`, `unknown`, `awaiting_confirmation`, `failed`, `verification_failed`, `rejected`, or `expired`.
|
|
35
51
|
- Do not export or copy access tokens, refresh tokens, or DPoP keys. Do not adapt personal credentials for CI or containers. Use `diffcat auth logout` or `diffcat grant revoke` when the user asks to disconnect.
|
|
36
52
|
|
|
53
|
+
## Speak like a helpful colleague
|
|
54
|
+
|
|
55
|
+
- Match the user's language and use short, natural sentences. Assume the user understands their business, not software internals.
|
|
56
|
+
- Prefer everyday wording such as “可查看的内容”, “需要填写的信息”, “记录”, “单据”, “办理结果”, and “避免重复提交”. Avoid terms such as capability, schema, entity, payload, endpoint, JSON, idempotency, HTTP, and API in user-facing replies.
|
|
57
|
+
- Lead with the business answer or the next action the user needs to take. Translate technical failures into a simple explanation and a practical next step.
|
|
58
|
+
- Do not show source code, request bodies, raw CLI output, internal field names, capability IDs, status codes, or command lines unless the user explicitly asks for technical detail or one exact command is necessary for login or recovery.
|
|
59
|
+
- Refer to people, companies, products, documents, and choices by their readable names. Show an internal identifier only when it is necessary to distinguish duplicate matches or to continue later, and label it in ordinary language.
|
|
60
|
+
- Keep technical details internal when verifying work. Report the outcome in business terms. For example, say that a draft was created and checked, rather than listing raw response fields.
|
|
61
|
+
|
|
37
62
|
## Complete the result
|
|
38
63
|
|
|
39
|
-
For a read, summarize only the requested facts, retain
|
|
64
|
+
For a read, summarize only the requested facts, retain needed identifiers internally for follow-up, and state in plain language when access or result limits make the answer incomplete.
|
|
40
65
|
|
|
41
|
-
For a write, use a stable idempotency key from the first attempt through every retry. After a `succeeded` result, independently read the created or affected object and verify its ID, status, company/department scope, business parties, currency, amounts, and line count as applicable.
|
|
66
|
+
For a write, use a stable idempotency key from the first attempt through every retry. After a `succeeded` result, independently read the created or affected object and verify its ID, status, company/department scope, business parties, currency, amounts, and line count as applicable. Tell the user what was completed and whether the result was checked. Include a reference number only when it will help with follow-up, and label it in ordinary language.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: 'DiffCat CLI'
|
|
3
|
-
short_description: '
|
|
4
|
-
default_prompt: 'Use $diffcat
|
|
3
|
+
short_description: '登录后,介绍、诊断、查询和办理 DiffCat 业务'
|
|
4
|
+
default_prompt: 'Use $diffcat. Check that I am logged in before anything else. If I am not logged in, only ask me to log in and stop. Otherwise, use the built-in knowledge graph and live authorized data to explain or handle my request in plain, non-technical language.'
|
|
5
5
|
policy:
|
|
6
6
|
allow_implicit_invocation: true
|
|
@@ -14,12 +14,18 @@ Use its capability IDs and presets instead of inventing names. The catalog descr
|
|
|
14
14
|
|
|
15
15
|
The CLI defaults to the production API at `https://diffcat-api.howcat.cn`. Use `--server <url>` only when the user explicitly chooses another deployment; keep different deployments in separate profiles.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Login first, then request minimum access
|
|
18
|
+
|
|
19
|
+
Login establishes a long-lived, DPoP-bound device connection without business capabilities:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
diffcat --profile default auth login
|
|
23
|
+
```
|
|
18
24
|
|
|
19
25
|
Request individual capabilities for a narrow task:
|
|
20
26
|
|
|
21
27
|
```powershell
|
|
22
|
-
diffcat --profile default
|
|
28
|
+
diffcat --profile default capability request `
|
|
23
29
|
--capability md.customers.read `
|
|
24
30
|
--capability sales.orders.read
|
|
25
31
|
```
|
|
@@ -29,10 +35,11 @@ For a clearly requested recurring workflow, the server currently advertises thes
|
|
|
29
35
|
- `master-data-read`: all registered base/master-data reads.
|
|
30
36
|
- `document-read`: all 15 registered document reads.
|
|
31
37
|
- `document-draft`: all 15 registered document draft-create abilities; no submit or approval.
|
|
38
|
+
- `all-read`: the server-owned list of every currently registered read-only capability.
|
|
32
39
|
|
|
33
|
-
Do not request a preset merely to avoid deciding which capability is needed.
|
|
40
|
+
Do not request a preset merely to avoid deciding which capability is needed. Use `--all-read` only when the user explicitly wants broad, recurring read-only access; the server expands and snapshots this preset.
|
|
34
41
|
|
|
35
|
-
The CLI prints
|
|
42
|
+
The CLI prints verification URLs and progress to stderr. The user first confirms the device login page, then confirms requested capabilities on a separate DiffCat page. Never approve either browser page for the user or ask for their password, verification code, token, cookie, or DPoP key in chat.
|
|
36
43
|
|
|
37
44
|
The server grants only the intersection of:
|
|
38
45
|
|
|
@@ -50,7 +57,7 @@ diffcat --pretty grant list
|
|
|
50
57
|
diffcat --pretty capability list
|
|
51
58
|
```
|
|
52
59
|
|
|
53
|
-
If a needed capability is absent, explain which operation cannot proceed.
|
|
60
|
+
If a needed capability is absent, explain which operation cannot proceed. Keep the existing login and start a new `capability request` only after the user agrees to that additional access.
|
|
54
61
|
|
|
55
62
|
## Profiles and environments
|
|
56
63
|
|
|
@@ -69,6 +69,7 @@ All current create abilities create `DRAFT` only. They do not submit, start appr
|
|
|
69
69
|
| ------------------------ | ----------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
70
70
|
| `pm.projects.read` | `project list/get` | Authorized project list and detail |
|
|
71
71
|
| `data_center.stats.read` | `stats list/query` | Registered widgets only; no arbitrary SQL |
|
|
72
|
+
| `knowledge.flows.read` | `knowledge flow` | Latest enabled published version for 16 mapped flows; matching business menu required; safe view only |
|
|
72
73
|
| `flow.tasks.read` | `task list/get` when schema permits | Tasks visible to the current handler user |
|
|
73
74
|
| `flow.tasks.approve` | `task approve` | Current user's pending purchase-request APPROVE/APPROVAL task only; high-risk confirmation required |
|
|
74
75
|
|