name: contract-cli-contract
version: 1.0.0
description: "contract-cli 合同命令技能:支持 user/bot 双身份下的合同详情、合同搜索、合同创建、同步用户组、读取合同文本、查询合同分类、列出模板、查看模板详情、创建模板实例,bot 身份下的文件上传,以及 user 身份下的枚举查询。当用户要使用 contract-cli contract ... 操作合同能力时触发。"
contract-cli Contract
CRITICAL — 开始前 MUST 先读取 ../contract-cli-shared/SKILL.md。
适用命令
contract-cli contract get <contract-id>contract-cli contract searchcontract-cli contract createcontract-cli contract sync-user-groupscontract-cli contract text <contract-id>contract-cli contract category listcontract-cli contract template listcontract-cli contract template get <template-id>contract-cli contract template instantiatecontract-cli contract upload-filecontract-cli contract enum list --type <enum_type>
快速决策
- 想直接拿合同详情:用
contract get - 想按条件查合同列表:用
contract search - 想直接透传创建合同请求体:用
contract create - 想拿正文文本:用
contract text - 想看分类树:用
contract category list - 想看模板或创建模板实例:用
contract template ... - 想上传合同正文或附件文件:用
contract upload-file --as bot - 想查创建合同相关枚举:用
contract enum list - 若需求是审批、授权、付款:当前 skill 不覆盖,别伪造命令
关键规则
contract get、contract search、contract create、contract sync-user-groups、contract text、contract category list、contract template list、contract template get、contract template instantiate同时支持--as user和--as botcontract upload-file当前仅支持--as bot- 除这九条双身份命令和
contract upload-file外,其余命令仍然只支持--as user contract create当前直接接收原始创建请求体,不额外暴露--templatecontract create --as bot走POST /open-apis/contract/v1/contractscontract create --as bot的请求体必须自己带create_user_idcontract create的推荐阅读顺序是:- 先读 references/create-contract-fields.md 选场景和最小请求体
- 再读 references/create-contract-field-tree.md 查嵌套对象和 JSON Path
- 最后读 references/create-contract-enums.md 确认 code 取值
- 这三份文档一起构成
contract create的完整参数主档,不需要再回查旧接口清单 contract get --as bot走开放平台标准接口/open-apis/contract/v1/contracts/{contract_id}--user-id-type/--user-id是通用 query 参数:--user-id-type不传时默认拼接user_id_type=user_id- 显式传
--user-id-type <type>时会覆盖默认值 --user-id传了就原样拼到底层接口,不传就不带- 不区分
user/bot - 不做命令级校验
contract search会把--contract-number、--page-size、--page-token合并进--input-file/--data里的 JSON 对象contract search --as bot走开放平台标准接口/open-apis/contract/v1/contracts/searchcontract sync-user-groups --as bot走/open-apis/contract/v1/contracts/user-groups/synccontract text --as bot走POST /open-apis/contract/v1/contracts/{contract_id}/textcontract category list --as bot走/open-apis/contract/v1/contract_categoryscontract template list --as bot走/open-apis/contract/v1/templates- 按生产文档,
contract template list --as bot的category_number、user_id、user_id_type都属于 query 参数;CLI 仍只透传,不做本地必填校验 contract template get --as bot走/open-apis/contract/v1/templates/{template_id}- 按生产文档,
contract template get --as bot的user_id、user_id_type都属于 query 参数;CLI 仍只透传,不做本地必填校验 contract template instantiate --as bot走POST /open-apis/contract/v1/template_instances- 按生产文档,
contract template instantiate --as bot的 query 只有user_id_type,请求体里需要create_user_id;CLI 仍只透传,不做本地必填校验 contract upload-file --as bot走POST /open-apis/contract/v1/files/uploadcontract upload-file使用multipart/form-data,字段是file_name、file_type、filecontract upload-file的--file是本地真实文件路径,不是 JSON 请求体文件contract upload-file不接受--input-file/--datacontract upload-file本地限制文件大小小于等于200MB- 常用
file_type:text合同文本、attachment其他附件、scan归档扫描件、cause合同附件、archiveAttachment归档附件、customPictureAttachment图片附件、customTableAttachment表格附件、customFileAttachment文件附件 contract text支持--full-text、--offset、--limitcontract template instantiate只接收请求体,不再接模板 ID 位置参数
实现来源
- internal/cli/contract_command.go
- internal/openplatform/contract/service.go
- references/commands.md
- references/create-contract-fields.md
- references/create-contract-field-tree.md
- references/create-contract-enums.md
操作建议
- 先确认 profile 已完成目标身份的登录:
- user 详情、user 搜索、user 创建、user 同步用户组、user 合同文本、user 分类查询、user 模板列表、user 模板详情、user 模板实例和其他 user-only 命令:
auth login --as user - bot 详情、bot 搜索、bot 创建、bot 同步用户组、bot 合同文本、bot 分类查询、bot 模板列表、bot 模板详情、bot 模板实例、bot 文件上传:
auth login --as bot
- user 详情、user 搜索、user 创建、user 同步用户组、user 合同文本、user 分类查询、user 模板列表、user 模板详情、user 模板实例和其他 user-only 命令:
- 复杂请求体优先用
--input-file - 需要脚本消费时加
--output json - 需要对照后端原始 envelope 时加
--raw - 创建合同前,先根据是“文件正文模式”“模板实例模式”“合同变更”还是“合同终止”选主文档里的场景配方
- 复杂对象不要平铺查表,直接去字段树附录按 JSON Path 找
- 遇到 code 型字段,不要凭印象写值,直接看枚举附录
- 交易方/我方主体、金额、期限、合同分类这几个字段最容易缺,优先核对
不要这样做
- 不要对
contract enum传--as bot - 不要继续写
--file contract.json;JSON 请求体用--input-file - 不要对
contract upload-file传--as user - 不要把
contract template fields当成已实现能力