@dxbnpm/dxb-cli
v3.1.1
Published
Dianxiaobao CLI for AI product publishing and AI image processing.
Maintainers
Readme
@dxbnpm/dxb-cli
店小宝 CLI for AI product publishing and AI image processing.
Usage
dxb --help
dxb auth login --device --dispatch-warehouse 大陆,台湾
dxb auth status
dxb store list --json
dxb batch submit --store-name <storeName> --action ai_release_products --source-url-list <urls> --dispatch-warehouse CN,TW
dxb batch submit --store-name <amazonStoreName> --action ai_release_products --source-url-list <urls> --site-ids ATVPDKIKX0DER --gtins 6979171900171,6979171900263
dxb batch submit --store-name <shopeeGlobalStoreName> --action ai_release_products --source-url-list <urls> --site-store-names ycmcwl
dxb batch submit --store-name <shopeeNormalStoreName> --action ai_release_products --source-url-list <urls>
dxb status ai --plan-id <planId> --store-name <storeName>
dxb image submit --action agent_use_cut --images <urls>
dxb image submit --action agent_use_translate --src-lang zh --tgt-lang en --images <urls>
dxb image submit --action agent_use_resize --scale-type keepOld --side-type width --change-length 800 --images <urls>
dxb image status --record-id <recordId>查看本地密文
用户明确要求查看时,可运行 dxb auth show --json,返回本地保存的 userCode 和账号。普通 auth status 不输出密文;本地值不代表店小宝后台实时值。
刷新已保存的密文
用户仅要求刷新时,重新执行网页授权 dxb auth login --device,成功后覆盖保存的密文;用户明确提供新密文并要求更换时,使用 dxb auth login --user-code <新密文> 保存。不保存用户ID,不通过用户ID查询密文。
凭证使用规则
- 网页重新授权成功:新账号凭证覆盖本地旧凭证。
- 本次任务主动提供密文:通过
--user-code优先使用,只影响本次调用,不覆盖本地凭证。 - 本次查店铺、发品和状态查询均传同一密文;密文是否有效由服务端判断,不根据长度拒绝。
- 未提供时默认使用已保存的凭证;显式参数优先级高于密文环境变量,环境变量高于保存的凭证。
dxb store list --user-code <本次密文> --json
dxb batch submit --user-code <本次密文> --store-name <店铺名称> --action ai_release_products --source-url-list <urls>
dxb status ai --user-code <本次密文> --plan-id <planId> --store-name <同一店铺名称>AI 发品的店铺选择
CLI 优先使用本次传入的 --user-code,未传入时默认读取保存的用户密文:
- 本次指定店铺:
dxb batch submit --store-name "店铺名称" --action ai_release_products --source-url-list <urls>。 - 未指定店铺:通过
dxb store list --json查询;只有一家默认使用,多家按平台展示店铺名称和平台账号,让用户选择后再提交。 batch submit也支持省略--store-name,会查询/getStoreListGroupByPlatform;唯一店铺自动提交,多店铺返回STORE_SELECTION_REQUIRED和列表,不提交任务;无店铺返回NO_STORES。- 店铺数量按所有分组中的店铺合计;旧配置中的
defaultStoreName不会跳过选择步骤。 - 提交响应顶层返回实际使用的
storeName,查询任务状态时需携带相同名称。 - 查询失败时不提交。店铺列表以服务端支持的平台及权限过滤结果为准。
网页授权
运行 dxb auth login --device:
- POST
/getRegisterUrl申请授权,stdout 立即输出一行 JSON,包含授权链接及设备码。 - Accio Work 根据
cli.webAuth打开链接;手动运行 CLI 时,自己打开verification_uri_complete。 - 网页登录/注册并调用
confirmDeviceAuthorization成功后,CLI 按interval轮询 POST/queryDeviceAuthorization,请求体为{"deviceCode":"..."}。 authorization_pending继续等待;成功后保存data.userCode、data.account到~/.dxb-toolkit/config.json并退出 0。失败或过期退出 1,不写入新凭证。最长等待 600 秒。- 业务命令自动读取保存的凭证,不需要传用户密文。原
auth login --user-code手动方式仍可使用。
联调时可用 --base-url <接口根地址> 指向测试服务,根地址应包含 /productBatchOpenAgent。
网页需保留 user_code 和 code=mcp_login,登录后按后端要求调用确认接口;CLI 不调用确认接口。
新 CLI 的版本为 3.1.1。发布对应 npm 包并更新 Accio 插件后,Connector 才会使用新逻辑。
本地修改不会自动发布 npm,也不会自动部署后端或网页。
Alibaba.com dispatch locations are required for Taiwan and Hong Kong users; other users should omit this setting. Values can be entered as 大陆, 台湾, 香港 or as CN, TW, HK. Separate multiple values with commas. TW and HK are mutually exclusive. The API request serializes the normalized values as a JSON array string, for example "dispatchWarehouse": "[\"CN\",\"TW\"]".
Amazon publishing requires siteIds. dxb store list --json preserves each store's siteList returned by the backend:
{"storeName":"example-store","resourceOwner":"example-account","siteList":[{"id":"ATVPDKIKX0DER","countryName":"美国"}]}Use only the selected store's returned IDs. The US ID above is an example, not a default or an allowed-country list. Missing or empty siteList means site data is unavailable; check store authorization/site synchronization and query again. Do not substitute a static list. The backend must first deploy the updated getStoreListGroupByPlatform method.
Ask for missing choices in ordinary chat, not a blocking question form. Respond to user corrections before continuing publishing. This guidance does not repair an already stuck Accio dialog.
If the user does not have UPC exemption, pass UPC/GTIN codes with --gtins.
If the user has UPC exemption, omit --gtins.
For Shopee stores, --site-store-names is optional. Pass it only when the user provides target site store names; otherwise omit it.
发品失败处理
店铺分组新增 ptName,来自后端字典 aw_platform_management.code,CLI 原样保留。商品发品失败时,只报告接口原因,并引导到 https://erp.dianxiaobao.net/goods/{ptName}/goods-wait/ 编辑优化。编码取本次任务店铺,不使用平台中文名推测,不追加 /1;没有编码时不拼接链接。不自行提供等待配额恢复、重试或草稿箱刊登等未经证实的方案。需部署返回 ptName 的后端接口。
