Ailit cli

From infometa/workbuddyskills · View interactive version

Ailit cli is an AI agent skill from the GitHub repository infometa/workbuddyskills. 通过本地 `ailit` CLI查询和操作智慧记 AI 进销存。适用于查询客户、商品、销售单、账户、库存、采购、欠款、对账和经营报表,以及创建客户或商品、商品调价、销售开单与退货、打印分享单据、导出对账单,或根据文字、图片、Excel 批量创建商品和销售单等场景。

How to use this skill

Skill file

Ailit CLI

ailit-cli 是操作智慧记 AI 进销存的本地命令行 Skill,支持客户、商品、销售单、库存、采购、欠款、对账及经营报表查询。

它还可创建客户和商品、处理销售开单与退货,并从图片、文字或 Excel 提取数据,完成批量建商品、对账单及销售单导出。

使用本地 ailit 命令作为操作智慧记AI进销存的主要接口。“智慧记 Web”指 space.zhihuiji.cn;“Ailit Client”指通过 AILIT_HOME 提供运行时认证的宿主应用。

简单请求与复杂场景

复杂场景路由:

| 仅在满足以下复杂目标时读取 | Reference |

|---|---|

| 组合筛选或批量查询欠款,并生成、下载、命名一个或多个对账单 | 组合欠款查询与对账单导出 |

| 查询指定客户的未结清销售单后,批量逐单生成图片/PDF并准备微信分享 | 批量未结清销售单导出与分享 |

| 从用户文字或图片提取订货信息,匹配客户和商品,生成销售单预览并在确认后创建 | 根据文字或图片创建销售单 |

| 从图片、文字、普通 Excel 或官方 Excel 模板批量创建商品 | 根据图片或 Excel 创建商品 |

复合请求按阶段路由。例如图文开销售单时发现商品不存在,先暂停销售单流程;用户同意建商品后读取商品创建 Reference,完成后再返回销售单流程。

核心规则

认证与健康检查

ailit auth login --non-interactive --format json
ailit auth login --resume <workflowId> --result-set <resultSetId> --select <token> --format json

输出与格式

搜索与选择

ailit customer search <keyword>
ailit product search <keyword>
ailit account search <keyword>

需要结构化处理时添加 --format json。规则:

查询范围一致性(强制)

执行查询前,识别用户期望的数据范围;查询完成后,根据实际执行参数、CLI 返回信息及命令当前能力,判断本次实际查询范围。

1. 用户期望的范围;

2. 本次实际查询的范围;

3. 未被覆盖的部分;

4. 当前结果不能视为用户所要求范围的完整结果。

变更操作安全

不支持场景处理

销售单草稿默认值

草稿中省略的字段由 CLI 填充:

销售单备注只能使用用户明确提供的内容。用户没有明确提供备注时,备注必须留空,不得由 Agent 自动生成、总结或补充。

基础 CLI 能力

以下命令用于简单请求,可以直接执行;需要未列出的参数时运行 ailit <command> --help。

查询销售单

ailit sale list                             # 默认:最近6个月、每页100条、按业务日期降序、全部收款状态
ailit sale list --pay-status unpaid         # 仅查询未结清
ailit sale list --pay-status paid           # 仅查询已结清
ailit sale list --pay-status all            # 查询全部状态
ailit sale list --customer "王老板"          # 按客户名称筛选
ailit sale list --today                     # 查询今天
ailit sale list --week                      # 查询本周
ailit sale list --start 2026-06-01 --end 2026-07-01
ailit sale list --customer "张三" --today --format json
ailit sale get <单据ID>                      # 使用 sale list 返回的数字ID,不是单据编号

规则:

销售单打印与分享

ailit sale print image <单据ID>              # 返回默认模板图片 URL
ailit sale print pdf <单据ID>                # 返回默认模板 PDF URL
ailit sale print pdf <单据ID> --format json  # 返回 {"url":"..."}
ailit sale share <单据ID>                    # 返回分享凭证、链接和微信小程序码
ailit sale share <单据ID> -o out.png         # 保存小程序码图片

这些命令不会自动下载 URL,也不会直接发送到微信联系人。只有文件实际下载或宿主收到发送成功回执后才能报告成功。

销售退货

sale return 没有 --dry-run。复制 templates/sale-return.json 为临时草稿,替换占位字段后先向用户复述关键字段,等待“确认”后再执行:

ailit sale return --json <临时草稿文件>

查询商品

ailit product list                   # 默认20条/页;-p 页码,-z 每页数量
ailit product get <商品ID>            # 查询商品详情
ailit product search <keyword>       # 关键字搜索,支持结构化选择

通过 product search --format json 已取得所需 meta 字段时,不要重复调用 product get。

查询客户、欠款和对账

ailit customer list                                      # 客户列表
ailit customer get <客户ID>                               # 客户详情
ailit customer search <keyword>
ailit customer debt                                      # 欠款客户列表
ailit report customer-check list                         # 默认本月、隐藏零欠款、累计欠款降序、100条/页
ailit report customer-check list --keyword "张三"         # 名称或联系人模糊查询
ailit report customer-check detail <company-id>          # 客户对账明细
ailit report supplier-check list                         # 供应商对账列表
ailit report supplier-check detail <company-id>          # 供应商对账明细
ailit customer print pdf <company-id> -s 2026-08-01 -e 2026-08-31

对账默认日期为当月,开始日期最多回溯最近6个月。客户支持官方对账单 PDF URL;当前 CLI 没有供应商对账单 PDF 命令。

查询库存、采购和报表

ailit stock list
ailit stock low                     # 按库存升序返回库存最低的一页
ailit stock low --threshold 5       # 返回库存 <= 阈值 的商品
ailit stock out                     # 缺货商品

ailit purchase list --today
ailit purchase list --week
ailit purchase supplier

ailit report all                    # 今日/本周/本月汇总及热销,日常概览优先使用
ailit report today
ailit report week
ailit report month
ailit report hot-sale
ailit report hot-sale --start 2026-08-01 --end 2026-08-31

创建单个商品

创建前先搜索同名商品,服务端不一定阻止重复:

ailit product search "粉色可口可乐"

ailit product create --name "粉色可口可乐" --barcode 6901234567890 --spec "500ml/瓶" --code "Coca-001" --unit "瓶" --cost 2.50 --price 3.50 --wholesale 3.20 --member-price 3.00 --stock 100 --remark "新品上架" --dry-run

只有用户确认后,才运行去掉 --dry-run 的相同命令。关键默认值:

更新商品与商品元数据

ailit product update <商品ID> --price 39.9 --cost 12

ailit product type list
ailit product type create "饮料"
ailit product type create "可乐" --parent 1234

ailit product unit list
ailit product unit create "瓶"

ailit product spec list
ailit product spec create "颜色" --detail 红 --detail 蓝 --detail 绿

创建客户

创建前运行 customer search 防止重名,并通过 customer type list 取得分类:

ailit customer type list
ailit customer price-level list
ailit customer create --name "王老板" --type <分类ID> --contact "王五" --phone 13700001111 --address "广州市天河区" --balance 300 --remark "VIP客户"

复杂 Reference 的使用原则

模板与示例

不要直接执行模板原文件。复制为临时草稿,替换全部示例值和占位 ID,完成校验及试运行后再使用。

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.