@youzan-cloud/zan-saas-cli 0.0.0-stage → 0.1.0-beta.3
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/DEPENDENCIES.json +50 -0
- package/INSTALL.md +79 -0
- package/LICENSE +21 -0
- package/NOTICE +1 -0
- package/README.md +151 -2
- package/THIRD_PARTY_NOTICES.txt +162 -0
- package/bin/zan-saas-cli.js +28 -0
- package/internal/registry/index.js +123 -0
- package/internal/registry/manifest.json +424 -0
- package/npm-shrinkwrap.json +86 -0
- package/package.json +33 -4
- package/skills/README.md +30 -0
- package/skills/zan-saas/SKILL.md +54 -0
- package/skills/zan-saas/references/host-entry.md +25 -0
- package/skills/zan-saas-access/SKILL.md +37 -0
- package/skills/zan-saas-access/references/role-list.md +11 -0
- package/skills/zan-saas-access/references/staff-perms-get.md +11 -0
- package/skills/zan-saas-aftersale/SKILL.md +31 -0
- package/skills/zan-saas-aftersale/references/case-list.md +13 -0
- package/skills/zan-saas-aftersale/references/case-scan.md +31 -0
- package/skills/zan-saas-benefit/SKILL.md +46 -0
- package/skills/zan-saas-benefit/references/card-get.md +7 -0
- package/skills/zan-saas-benefit/references/card-grant-list.md +11 -0
- package/skills/zan-saas-benefit/references/card-list.md +7 -0
- package/skills/zan-saas-benefit/references/customer-card-get.md +7 -0
- package/skills/zan-saas-benefit/references/customer-card-list.md +7 -0
- package/skills/zan-saas-coupon/SKILL.md +41 -0
- package/skills/zan-saas-coupon/references/activity-get.md +11 -0
- package/skills/zan-saas-coupon/references/activity-list.md +15 -0
- package/skills/zan-saas-coupon/references/voucher-get.md +13 -0
- package/skills/zan-saas-coupon/references/voucher-list.md +25 -0
- package/skills/zan-saas-customer/SKILL.md +73 -0
- package/skills/zan-saas-customer/references/customer-scan.md +11 -0
- package/skills/zan-saas-customer/references/segment-list.md +22 -0
- package/skills/zan-saas-fulfillment/SKILL.md +36 -0
- package/skills/zan-saas-fulfillment/references/delivery-get.md +11 -0
- package/skills/zan-saas-fulfillment/references/shipment-list.md +11 -0
- package/skills/zan-saas-fulfillment/references/waybill-get.md +9 -0
- package/skills/zan-saas-interaction/SKILL.md +37 -0
- package/skills/zan-saas-interaction/references/lottery-get.md +11 -0
- package/skills/zan-saas-interaction/references/lottery-list.md +19 -0
- package/skills/zan-saas-item/SKILL.md +61 -0
- package/skills/zan-saas-item/references/attribute-list.md +11 -0
- package/skills/zan-saas-item/references/brand-list.md +7 -0
- package/skills/zan-saas-item/references/classification-get.md +7 -0
- package/skills/zan-saas-item/references/classification-list.md +7 -0
- package/skills/zan-saas-item/references/group-list.md +9 -0
- package/skills/zan-saas-item/references/item-content.md +9 -0
- package/skills/zan-saas-item/references/item-get.md +9 -0
- package/skills/zan-saas-item/references/item-search.md +23 -0
- package/skills/zan-saas-item/references/product-identity.md +11 -0
- package/skills/zan-saas-member/SKILL.md +41 -0
- package/skills/zan-saas-member/references/customer-level-get.md +7 -0
- package/skills/zan-saas-member/references/growth-log-list.md +17 -0
- package/skills/zan-saas-member/references/membership-get.md +7 -0
- package/skills/zan-saas-order/SKILL.md +56 -0
- package/skills/zan-saas-order/references/order-get.md +26 -0
- package/skills/zan-saas-order/references/order-list.md +25 -0
- package/skills/zan-saas-order/references/order-scan.md +35 -0
- package/skills/zan-saas-org/SKILL.md +37 -0
- package/skills/zan-saas-org/references/staff-get.md +15 -0
- package/skills/zan-saas-org/references/staff-role-get.md +11 -0
- package/skills/zan-saas-org/references/unit-get.md +11 -0
- package/skills/zan-saas-org/references/unit-list.md +15 -0
- package/skills/zan-saas-points/SKILL.md +42 -0
- package/skills/zan-saas-points/references/account-get.md +7 -0
- package/skills/zan-saas-points/references/log-list.md +17 -0
- package/skills/zan-saas-points/references/rule-list.md +2 -0
- package/skills/zan-saas-privacy/SKILL.md +30 -0
- package/skills/zan-saas-privacy/references/field-decrypt.md +19 -0
- package/skills/zan-saas-shared/SKILL.md +94 -0
- package/skills/zan-saas-shared/references/authentication.md +52 -0
- package/skills/zan-saas-shared/references/value-processing.md +27 -0
- package/skills/zan-saas-stock/SKILL.md +28 -0
- package/skills/zan-saas-stock/references/log-list.md +11 -0
- package/skills/zan-saas-valuecard/SKILL.md +37 -0
- package/skills/zan-saas-valuecard/references/card-get.md +13 -0
- package/skills/zan-saas-valuecard/references/card-list.md +11 -0
- package/src/auth/browser.js +28 -0
- package/src/auth/callback-server.js +99 -0
- package/src/auth/config.js +53 -0
- package/src/auth/credential-store.js +109 -0
- package/src/auth/oauth-client.js +105 -0
- package/src/auth/pkce.js +28 -0
- package/src/auth/session.js +178 -0
- package/src/auth/tool.js +25 -0
- package/src/cli/command-paths.js +126 -0
- package/src/cli/context-help.js +102 -0
- package/src/cli/diagnostic-command.js +57 -0
- package/src/cli/domain-catalog.js +42 -0
- package/src/cli/help-text.js +32 -0
- package/src/cli/native-loader.js +120 -0
- package/src/cli/native-path.js +22 -0
- package/src/cli/parser-policy.js +141 -0
- package/src/cli/program.js +134 -0
- package/src/cli/skill-catalog.js +241 -0
- package/src/commands/native/access/commands.index.json +24 -0
- package/src/commands/native/access/domain.json +3 -0
- package/src/commands/native/access/role/list/command.js +141 -0
- package/src/commands/native/access/role/list/schema.json +393 -0
- package/src/commands/native/access/staff-perms/get/command.js +119 -0
- package/src/commands/native/access/staff-perms/get/schema.json +703 -0
- package/src/commands/native/aftersale/case/get/command.js +104 -0
- package/src/commands/native/aftersale/case/get/exact-json.js +52 -0
- package/src/commands/native/aftersale/case/get/money.js +28 -0
- package/src/commands/native/aftersale/case/get/projection.js +120 -0
- package/src/commands/native/aftersale/case/get/query.js +72 -0
- package/src/commands/native/aftersale/case/get/schema.json +134 -0
- package/src/commands/native/aftersale/case/list/command.js +135 -0
- package/src/commands/native/aftersale/case/list/schema.json +1095 -0
- package/src/commands/native/aftersale/case/scan/command.js +110 -0
- package/src/commands/native/aftersale/case/scan/query.js +62 -0
- package/src/commands/native/aftersale/case/scan/scan.js +78 -0
- package/src/commands/native/aftersale/case/scan/schema.json +964 -0
- package/src/commands/native/aftersale/case/scan/search.js +108 -0
- package/src/commands/native/aftersale/commands.index.json +42 -0
- package/src/commands/native/aftersale/domain.json +3 -0
- package/src/commands/native/aftersale/refund/list/command.js +97 -0
- package/src/commands/native/aftersale/refund/list/money.js +25 -0
- package/src/commands/native/aftersale/refund/list/projection.js +50 -0
- package/src/commands/native/aftersale/refund/list/query.js +73 -0
- package/src/commands/native/aftersale/refund/list/schema.json +130 -0
- package/src/commands/native/aftersale/shared/query.js +58 -0
- package/src/commands/native/aftersale/shared/search.js +128 -0
- package/src/commands/native/benefit/card-definition/get/command.js +110 -0
- package/src/commands/native/benefit/card-definition/get/schema.json +545 -0
- package/src/commands/native/benefit/card-definition/list/command.js +105 -0
- package/src/commands/native/benefit/card-definition/list/schema.json +690 -0
- package/src/commands/native/benefit/card-grant/list/command.js +135 -0
- package/src/commands/native/benefit/card-grant/list/schema.json +758 -0
- package/src/commands/native/benefit/commands.index.json +51 -0
- package/src/commands/native/benefit/customer-card/get/command.js +110 -0
- package/src/commands/native/benefit/customer-card/get/schema.json +340 -0
- package/src/commands/native/benefit/customer-card/list/command.js +102 -0
- package/src/commands/native/benefit/customer-card/list/schema.json +731 -0
- package/src/commands/native/benefit/domain.json +3 -0
- package/src/commands/native/coupon/activity/get/command.js +183 -0
- package/src/commands/native/coupon/activity/get/schema.json +624 -0
- package/src/commands/native/coupon/activity/list/command.js +169 -0
- package/src/commands/native/coupon/activity/list/schema.json +845 -0
- package/src/commands/native/coupon/commands.index.json +42 -0
- package/src/commands/native/coupon/domain.json +3 -0
- package/src/commands/native/coupon/shared/query.js +15 -0
- package/src/commands/native/coupon/voucher/get/command.js +113 -0
- package/src/commands/native/coupon/voucher/get/schema.json +147 -0
- package/src/commands/native/coupon/voucher/list/command.js +155 -0
- package/src/commands/native/coupon/voucher/list/schema.json +772 -0
- package/src/commands/native/customer/commands.index.json +96 -0
- package/src/commands/native/customer/customer/get/adapter.js +82 -0
- package/src/commands/native/customer/customer/get/command.js +106 -0
- package/src/commands/native/customer/customer/get/schema.json +958 -0
- package/src/commands/native/customer/customer/list/command.js +78 -0
- package/src/commands/native/customer/customer/list/input.js +145 -0
- package/src/commands/native/customer/customer/list/query.js +103 -0
- package/src/commands/native/customer/customer/list/schema.json +969 -0
- package/src/commands/native/customer/customer/scan/command.js +80 -0
- package/src/commands/native/customer/customer/scan/scan.js +92 -0
- package/src/commands/native/customer/customer/scan/schema.json +211 -0
- package/src/commands/native/customer/customer-tag/get/command.js +166 -0
- package/src/commands/native/customer/customer-tag/get/schema.json +317 -0
- package/src/commands/native/customer/customer-tag/list/command.js +143 -0
- package/src/commands/native/customer/customer-tag/list/schema.json +259 -0
- package/src/commands/native/customer/domain.json +3 -0
- package/src/commands/native/customer/segment/list/command.js +96 -0
- package/src/commands/native/customer/segment/list/query.js +98 -0
- package/src/commands/native/customer/segment/list/schema.json +135 -0
- package/src/commands/native/customer/segment-customer/list/command.js +171 -0
- package/src/commands/native/customer/segment-customer/list/schema.json +123 -0
- package/src/commands/native/customer/shared/search-input.js +179 -0
- package/src/commands/native/customer/shared/search-page.js +54 -0
- package/src/commands/native/customer/tag/get/command.js +73 -0
- package/src/commands/native/customer/tag/get/schema.json +339 -0
- package/src/commands/native/customer/tagcategory/get/command.js +80 -0
- package/src/commands/native/customer/tagcategory/get/query.js +98 -0
- package/src/commands/native/customer/tagcategory/get/schema.json +339 -0
- package/src/commands/native/customer/tagcategory/list/command.js +127 -0
- package/src/commands/native/customer/tagcategory/list/schema.json +394 -0
- package/src/commands/native/fulfillment/commands.index.json +33 -0
- package/src/commands/native/fulfillment/delivery/get/command.js +107 -0
- package/src/commands/native/fulfillment/delivery/get/projection.js +142 -0
- package/src/commands/native/fulfillment/delivery/get/schema.json +173 -0
- package/src/commands/native/fulfillment/domain.json +3 -0
- package/src/commands/native/fulfillment/shipment/list/command.js +83 -0
- package/src/commands/native/fulfillment/shipment/list/projection.js +130 -0
- package/src/commands/native/fulfillment/shipment/list/schema.json +752 -0
- package/src/commands/native/fulfillment/waybill/get/command.js +193 -0
- package/src/commands/native/fulfillment/waybill/get/response.js +68 -0
- package/src/commands/native/fulfillment/waybill/get/schema.json +190 -0
- package/src/commands/native/interaction/commands.index.json +24 -0
- package/src/commands/native/interaction/domain.json +3 -0
- package/src/commands/native/interaction/lottery/get/command.js +61 -0
- package/src/commands/native/interaction/lottery/get/query.js +152 -0
- package/src/commands/native/interaction/lottery/get/schema.json +1004 -0
- package/src/commands/native/interaction/lottery/list/command.js +176 -0
- package/src/commands/native/interaction/lottery/list/schema.json +898 -0
- package/src/commands/native/item/attribute/list/command.js +122 -0
- package/src/commands/native/item/attribute/list/schema.json +727 -0
- package/src/commands/native/item/brand/list/command.js +114 -0
- package/src/commands/native/item/brand/list/schema.json +725 -0
- package/src/commands/native/item/classification/get/command.js +87 -0
- package/src/commands/native/item/classification/get/schema.json +596 -0
- package/src/commands/native/item/classification/list/command.js +105 -0
- package/src/commands/native/item/classification/list/schema.json +676 -0
- package/src/commands/native/item/commands.index.json +87 -0
- package/src/commands/native/item/domain.json +1 -0
- package/src/commands/native/item/group/list/command.js +122 -0
- package/src/commands/native/item/group/list/schema.json +809 -0
- package/src/commands/native/item/item/get/command.js +122 -0
- package/src/commands/native/item/item/get/schema.json +3799 -0
- package/src/commands/native/item/item/list/command.js +7 -0
- package/src/commands/native/item/item/list/schema.json +1118 -0
- package/src/commands/native/item/item/scan/command.js +7 -0
- package/src/commands/native/item/item/scan/schema.json +1046 -0
- package/src/commands/native/item/item-content/get/command.js +54 -0
- package/src/commands/native/item/item-content/get/schema.json +677 -0
- package/src/commands/native/item/shared/api.js +31 -0
- package/src/commands/native/item/shared/content.js +20 -0
- package/src/commands/native/item/shared/diagnostics.js +61 -0
- package/src/commands/native/item/shared/h5.js +63 -0
- package/src/commands/native/item/shared/identity.js +62 -0
- package/src/commands/native/item/shared/normalize.js +49 -0
- package/src/commands/native/item/shared/scope.js +22 -0
- package/src/commands/native/item/shared/search-command.js +61 -0
- package/src/commands/native/item/shared/search-options.js +150 -0
- package/src/commands/native/item/shared/search.js +158 -0
- package/src/commands/native/member/commands.index.json +60 -0
- package/src/commands/native/member/customer-level/get/command.js +122 -0
- package/src/commands/native/member/customer-level/get/schema.json +300 -0
- package/src/commands/native/member/domain.json +3 -0
- package/src/commands/native/member/growth/get/command.js +64 -0
- package/src/commands/native/member/growth/get/schema.json +283 -0
- package/src/commands/native/member/growth-log/list/command.js +203 -0
- package/src/commands/native/member/growth-log/list/schema.json +695 -0
- package/src/commands/native/member/level/get/command.js +70 -0
- package/src/commands/native/member/level/get/query.js +125 -0
- package/src/commands/native/member/level/get/schema.json +339 -0
- package/src/commands/native/member/level/list/command.js +50 -0
- package/src/commands/native/member/level/list/query.js +109 -0
- package/src/commands/native/member/level/list/schema.json +104 -0
- package/src/commands/native/member/membership/get/command.js +78 -0
- package/src/commands/native/member/membership/get/schema.json +283 -0
- package/src/commands/native/order/commands.index.json +33 -0
- package/src/commands/native/order/domain.json +3 -0
- package/src/commands/native/order/order/get/command.js +155 -0
- package/src/commands/native/order/order/get/schema.json +1167 -0
- package/src/commands/native/order/order/list/command.js +230 -0
- package/src/commands/native/order/order/list/schema.json +1363 -0
- package/src/commands/native/order/order/scan/command.js +148 -0
- package/src/commands/native/order/order/scan/scan.js +89 -0
- package/src/commands/native/order/order/scan/schema.json +1445 -0
- package/src/commands/native/order/shared/projection.js +183 -0
- package/src/commands/native/order/shared/query.js +84 -0
- package/src/commands/native/order/shared/search.js +112 -0
- package/src/commands/native/org/commands.index.json +42 -0
- package/src/commands/native/org/domain.json +3 -0
- package/src/commands/native/org/shared/single-staff.js +115 -0
- package/src/commands/native/org/staff/get/command.js +148 -0
- package/src/commands/native/org/staff/get/schema.json +114 -0
- package/src/commands/native/org/staff-role/get/command.js +45 -0
- package/src/commands/native/org/staff-role/get/schema.json +93 -0
- package/src/commands/native/org/unit/get/command.js +131 -0
- package/src/commands/native/org/unit/get/schema.json +478 -0
- package/src/commands/native/org/unit/list/command.js +187 -0
- package/src/commands/native/org/unit/list/schema.json +828 -0
- package/src/commands/native/points/account/get/command.js +65 -0
- package/src/commands/native/points/account/get/schema.json +303 -0
- package/src/commands/native/points/commands.index.json +33 -0
- package/src/commands/native/points/domain.json +3 -0
- package/src/commands/native/points/log/list/command.js +141 -0
- package/src/commands/native/points/log/list/schema.json +761 -0
- package/src/commands/native/points/rule/list/command.js +82 -0
- package/src/commands/native/points/rule/list/schema.json +294 -0
- package/src/commands/native/privacy/commands.index.json +15 -0
- package/src/commands/native/privacy/domain.json +3 -0
- package/src/commands/native/privacy/field/decrypt/command.js +185 -0
- package/src/commands/native/privacy/field/decrypt/schema.json +656 -0
- package/src/commands/native/privacy/shared/order-source.js +33 -0
- package/src/commands/native/stock/commands.index.json +15 -0
- package/src/commands/native/stock/domain.json +3 -0
- package/src/commands/native/stock/log/list/command.js +207 -0
- package/src/commands/native/stock/log/list/schema.json +922 -0
- package/src/commands/native/valuecard/card/get/command.js +107 -0
- package/src/commands/native/valuecard/card/get/schema.json +683 -0
- package/src/commands/native/valuecard/card/list/command.js +136 -0
- package/src/commands/native/valuecard/card/list/pagination.js +23 -0
- package/src/commands/native/valuecard/card/list/schema.json +780 -0
- package/src/commands/native/valuecard/commands.index.json +24 -0
- package/src/commands/native/valuecard/domain.json +3 -0
- package/src/commands/native/valuecard/shared/projection.js +57 -0
- package/src/commands/system/api.js +47 -0
- package/src/commands/system/auth.js +118 -0
- package/src/commands/system/contracts.js +373 -0
- package/src/commands/system/doctor.js +24 -0
- package/src/commands/system/install.js +41 -0
- package/src/commands/system/printer.js +16 -0
- package/src/commands/system/schema.js +162 -0
- package/src/commands/system/shop-guidance.js +9 -0
- package/src/commands/system/shop.js +237 -0
- package/src/commands/system/skills.js +49 -0
- package/src/execution/beijing-date-time.js +29 -0
- package/src/execution/beijing-time.js +21 -0
- package/src/execution/bounded-input.js +42 -0
- package/src/execution/command-io.js +137 -0
- package/src/execution/command-policy.js +41 -0
- package/src/execution/command-schema.js +131 -0
- package/src/execution/datetime.js +83 -0
- package/src/execution/error-details.js +399 -0
- package/src/execution/error-model.js +82 -0
- package/src/execution/exact-json.js +80 -0
- package/src/execution/list-total.js +10 -0
- package/src/execution/money.js +59 -0
- package/src/execution/parser-error.js +66 -0
- package/src/execution/privacy.js +197 -0
- package/src/execution/public-schema.js +52 -0
- package/src/execution/query-api.js +101 -0
- package/src/execution/range.js +84 -0
- package/src/execution/request-state.js +55 -0
- package/src/execution/schema-completeness.js +116 -0
- package/src/execution/shop-query.js +54 -0
- package/src/execution/target-shop-default.js +23 -0
- package/src/execution/target-shop.js +49 -0
- package/src/identity/context-store.js +54 -0
- package/src/identity/context.js +38 -0
- package/src/installation/install.js +158 -0
- package/src/installation/npm-error.js +93 -0
- package/src/installation/skill.js +113 -0
- package/src/transport/account-api.js +152 -0
- package/src/transport/api.js +199 -0
- package/src/transport/shop-app.js +63 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"path": "node_modules/ajv",
|
|
4
|
+
"name": "ajv",
|
|
5
|
+
"version": "8.20.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
|
|
8
|
+
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"path": "node_modules/commander",
|
|
12
|
+
"name": "commander",
|
|
13
|
+
"version": "12.1.0",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==",
|
|
16
|
+
"resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"path": "node_modules/fast-deep-equal",
|
|
20
|
+
"name": "fast-deep-equal",
|
|
21
|
+
"version": "3.1.3",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
|
24
|
+
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "node_modules/fast-uri",
|
|
28
|
+
"name": "fast-uri",
|
|
29
|
+
"version": "3.1.9",
|
|
30
|
+
"license": "BSD-3-Clause",
|
|
31
|
+
"integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
|
|
32
|
+
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"path": "node_modules/json-schema-traverse",
|
|
36
|
+
"name": "json-schema-traverse",
|
|
37
|
+
"version": "1.0.0",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
|
40
|
+
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"path": "node_modules/require-from-string",
|
|
44
|
+
"name": "require-from-string",
|
|
45
|
+
"version": "2.0.2",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
|
|
48
|
+
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz"
|
|
49
|
+
}
|
|
50
|
+
]
|
package/INSTALL.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# 有赞 SaaS CLI 安装指南
|
|
2
|
+
|
|
3
|
+
本指南面向 AI Agent。安装 CLI 和当前宿主的入口 Skill 后,再按用户任务登录和选店。
|
|
4
|
+
|
|
5
|
+
发布包名为 `@youzan-cloud/zan-saas-cli`,终端命令为 `zan-saas`。安装入口统一使用 `latest` 标签,实际版本及 beta 状态以包版本号为准。
|
|
6
|
+
|
|
7
|
+
## 1. 检查环境
|
|
8
|
+
|
|
9
|
+
确认 Node.js 18+、npm 8 至 11,以及 npm/npx 可用。缺少环境时说明需要安装的组件。保留用户现有的 npm registry、凭证及其他 Agent Skill。
|
|
10
|
+
|
|
11
|
+
## 2. 安装
|
|
12
|
+
|
|
13
|
+
交互终端运行:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @youzan-cloud/zan-saas-cli@latest install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
安装器检测常用 Agent,提示选择,默认个人安装。它会持久安装同版 CLI,并将轻量入口放到所选宿主。无需克隆仓库、查找 npm 目录或手工复制 Skill。
|
|
20
|
+
|
|
21
|
+
Agent 使用非交互命令,明确当前宿主,例如:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npx --yes @youzan-cloud/zan-saas-cli@latest install --yes --host workbuddy
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`--host` 可选 `workbuddy`、`codebuddy`、`codex`、`claude-code`、`cursor`、`trae`。`trae` 表示 Trae 中国版。多个宿主用逗号分隔。已在检测范围内时也可省略 `--host`,使用 `--yes` 安装到检测到的宿主;没有检测结果时须补充宿主。
|
|
28
|
+
|
|
29
|
+
用户指定只用于当前项目时,在该项目目录追加 `--scope project`。其他宿主已知 Skill 目录时可用 `--directory <目录>`;不猜未知宿主路径。
|
|
30
|
+
|
|
31
|
+
WorkBuddy 个人目录为 `~/.workbuddy/skills`,CodeBuddy 为 `~/.codebuddy/skills`;项目目录均为 `.codebuddy/skills`。
|
|
32
|
+
|
|
33
|
+
安装器只迁移本项目旧的 `zan-saas-cli` 开发链接或 `@youzan-cloud/zan-saas` 候选包占用的命令入口;同名外部命令、外部 Skill 或被手工修改的入口会保留并报错。发生冲突时报告具体路径,让用户处理,不使用 `--force`。
|
|
34
|
+
|
|
35
|
+
## 3. 验证
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
zan-saas --version
|
|
39
|
+
zan-saas skills read zan-saas
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
核对安装器返回的 Skill 路径,并在宿主技能列表确认 `zan-saas` 已启用,再打开新会话。Skill 内已记录持久 CLI 的 Node.js 与入口路径;宿主没有加载 nvm 时,也按该启动方式调用后续指引中的 `zan-saas`。
|
|
43
|
+
|
|
44
|
+
安装文件与 CLI 验证通过后,报告版本、宿主和安装位置。JSON 结果的 `success: true` 表示安装完成,`skillLoading: not_verified` 表示尚未验证宿主加载;按 `nextStep` 在宿主中检查。未发现入口时,先确认宿主配置的 Skill 根目录,再用 `--directory <目录>` 重新安装入口,不根据目录是否存在猜测加载路径。
|
|
45
|
+
|
|
46
|
+
安装失败时读取错误的 `details`:`operation` 是失败步骤,`npmCode` 是已识别的错误码,`nextStep` 是处理建议。`ENOTEMPTY` 表示 npm 目录冲突,先核对返回的冲突路径,备份并移走确认属于旧版本的残留目录,再重试。不要自动删除全局目录或强制覆盖。未识别的错误不猜根因,保留本次失败并查看 npm 本机日志。
|
|
47
|
+
|
|
48
|
+
## 4. 按需登录和选店
|
|
49
|
+
|
|
50
|
+
用户开始业务查询时,先运行 `zan-saas auth status`。未登录则执行 `zan-saas auth login`,把授权地址交给用户,等待命令成功后再次检查状态。浏览器授权完成但命令失败时,按认证错误核查并停止。
|
|
51
|
+
|
|
52
|
+
先运行 `zan-saas shop current`,已有有效上下文且用户未要求切店时沿用。需要选店时,运行 `zan-saas shop list`,按入口 Skill 核对用户指定的店名或展示候选店名供选择;Agent 将明确目标映射为 `kdtId`,执行 `zan-saas shop use <kdtId>` 后用 `zan-saas shop current` 核对实际生效的店铺。后续按入口 Skill 读取同版领域指引、help 和 schema。安装器本身不登录、不选店,也不执行业务请求。
|
|
53
|
+
|
|
54
|
+
## 本地候选包测试
|
|
55
|
+
|
|
56
|
+
收到 `.tgz` 后,用 `npm exec` 准备候选包的依赖并运行其安装器;不依赖旧版全局 CLI 是否支持 `install`,也不直接运行尚未安装依赖的解包目录。下面的 `candidate` 和 `skill_dir` 替换为实际绝对路径;`skill_dir` 是宿主配置的 Skill 根目录,安装器会在其下创建 `zan-saas/SKILL.md`。
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
candidate=/absolute/path/candidate.tgz
|
|
60
|
+
skill_dir=/absolute/path/skills
|
|
61
|
+
# 准备候选运行环境并查看计划;不改全局 CLI 和 Skill
|
|
62
|
+
npm exec --yes --package "$candidate" -- zan-saas install --yes \
|
|
63
|
+
--directory "$skill_dir" --package "$candidate" --dry-run --json
|
|
64
|
+
|
|
65
|
+
# 核对计划后安装同一份包
|
|
66
|
+
npm exec --yes --package "$candidate" -- zan-saas install --yes \
|
|
67
|
+
--directory "$skill_dir" --package "$candidate" --json
|
|
68
|
+
|
|
69
|
+
zan-saas --version
|
|
70
|
+
zan-saas skills read zan-saas
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
也可将 `--directory "$skill_dir"` 替换为已有支持的 `--host <宿主>`。安装沿用 npm 的全局 prefix;仅做隔离验收时,应事先配置临时 prefix 和临时 Skill 目录。终端找不到 `zan-saas` 时,用安装结果的 `launcher` 与本次 Node.js 执行相同检查。
|
|
74
|
+
|
|
75
|
+
`npm exec` 首次准备运行环境可能下载依赖并写入 npm 缓存;`--dry-run` 只约束随后运行的安装器,不会改变全局 CLI 或 Skill。本地候选不保证首次安装可以断网完成,不代表候选已发布到 npm,也不会自动登录或选店。
|
|
76
|
+
|
|
77
|
+
## 当前交付状态
|
|
78
|
+
|
|
79
|
+
本指南随新版 npm 包发行。发布后的包页面为 https://www.npmjs.com/package/@youzan-cloud/zan-saas-cli;Agent 可通过 https://unpkg.com/@youzan-cloud/zan-saas-cli@latest/INSTALL.md 读取同一包内的原始 Markdown。只有包已发布到官方 npm registry 并设置 `latest` 标签后,上述地址和 npx 命令才能供外部用户使用。本地候选用 `--package <候选.tgz>` 验证,不能把候选测试称为 npm 已发布。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 有赞
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Youzan SaaS CLI preview. Project code: MIT. See THIRD_PARTY_NOTICES.txt.
|
package/README.md
CHANGED
|
@@ -1,3 +1,152 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 有赞 SaaS CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在终端查询有赞商品、订单、客户、会员权益和履约数据,也可以让 AI Agent 使用自然语言完成查询。适用于商家员工、自动化脚本和支持 Skill 的 AI 助手。
|
|
4
|
+
|
|
5
|
+
包名为 `@youzan-cloud/zan-saas-cli`,安装后的命令为 `zan-saas`。当前为 beta 版本。
|
|
6
|
+
|
|
7
|
+
[安装](#安装) · [快速开始](#快速开始) · [Agent 使用](#在-agent-中使用) · [支持范围](#支持范围) · [常见问题](#常见问题)
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
需要 **Node.js 18+、npm 8 至 11**,以及可访问 npm registry 的网络环境。
|
|
12
|
+
|
|
13
|
+
### 手动安装
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @youzan-cloud/zan-saas-cli@latest install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
按提示选择 Agent。安装向导会安装 CLI 和对应的入口 Skill,默认使用个人目录;无需克隆仓库或手动复制文件。
|
|
20
|
+
|
|
21
|
+
仅需要命令行工具时,也可以使用:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install -g @youzan-cloud/zan-saas-cli@latest --ignore-scripts --engine-strict
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 让 AI Agent 安装
|
|
28
|
+
|
|
29
|
+
把下面这句话发给你的 AI 助手:
|
|
30
|
+
|
|
31
|
+
> 帮我安装有赞 SaaS CLI:https://unpkg.com/@youzan-cloud/zan-saas-cli@latest/INSTALL.md
|
|
32
|
+
|
|
33
|
+
支持为 WorkBuddy、CodeBuddy、Codex、Claude Code、Cursor 和 Trae 中国版安装入口 Skill。其他宿主可指定 Skill 目录,详见[安装指南](https://unpkg.com/@youzan-cloud/zan-saas-cli@latest/INSTALL.md)。
|
|
34
|
+
|
|
35
|
+
## 快速开始
|
|
36
|
+
|
|
37
|
+
### 1. 登录
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
zan-saas auth login
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
按提示在浏览器完成授权,等待终端显示登录成功。
|
|
44
|
+
|
|
45
|
+
### 2. 选择店铺
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
zan-saas shop list
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
从列表中找到目标店铺,用它的 `kdtId` 替换下方的 `<kdtId>`:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
zan-saas shop use <kdtId>
|
|
55
|
+
zan-saas shop current
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
已有有效店铺上下文时可跳过选店。切换店铺不需要重新登录。
|
|
59
|
+
|
|
60
|
+
### 3. 开始查询
|
|
61
|
+
|
|
62
|
+
查询当前店铺的一页待发货订单:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
zan-saas order order list --status WAIT_SELLER_SEND_GOODS
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
先预览同一查询的请求计划,不访问业务接口:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
zan-saas order order list --status WAIT_SELLER_SEND_GOODS --dry-run
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 在 Agent 中使用
|
|
75
|
+
|
|
76
|
+
安装 Skill 后,在宿主中新建对话,例如:
|
|
77
|
+
|
|
78
|
+
> 使用 zan-saas,帮我查询当前店铺的待发货订单。
|
|
79
|
+
|
|
80
|
+
Agent 会读取当前安装版的使用指引,选择命令并解释查询结果。需要登录时,你在浏览器完成授权;需要选店时,可以提供店名或选择它展示的候选店铺。
|
|
81
|
+
|
|
82
|
+
CLI 与领域指引随同一个 npm 包发行。升级后,入口 Skill 会按需读取同版内容,无需手工维护各领域的副本。
|
|
83
|
+
|
|
84
|
+
## 支持范围
|
|
85
|
+
|
|
86
|
+
| 领域 | 查询内容 |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| 商品 | 商品资料、规格、图文、分组、分类、品牌和属性 |
|
|
89
|
+
| 订单与售后 | 交易订单、支付事实、售后单和退款资金记录 |
|
|
90
|
+
| 客户与会员 | 客户档案、标签、分群、会员身份、等级和成长值 |
|
|
91
|
+
| 积分与权益 | 积分账户、流水、规则,权益卡定义、持卡实例和发放记录 |
|
|
92
|
+
| 储值卡 | 持卡、状态和余额 |
|
|
93
|
+
| 履约与库存 | 发货单、配送单、物流轨迹和库存变化日志 |
|
|
94
|
+
| 组织与访问控制 | 组织、员工、角色关联和权限点 |
|
|
95
|
+
| 互动营销 | 抽奖活动及其配置与统计 |
|
|
96
|
+
|
|
97
|
+
具体命令、产品适用范围和参数以当前安装版的 help、schema 和 Skill 为准。
|
|
98
|
+
|
|
99
|
+
## 查找命令
|
|
100
|
+
|
|
101
|
+
| 目标 | 命令 |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| 浏览命令目录 | `zan-saas --help` |
|
|
104
|
+
| 查看订单列表用法 | `zan-saas help order order list` |
|
|
105
|
+
| 获取简洁的能力目录 | `zan-saas schema --summary` |
|
|
106
|
+
| 读取某条命令的输入契约 | `zan-saas schema order.order.list --section input` |
|
|
107
|
+
| 读取返回字段说明 | `zan-saas schema order.order.list --section output` |
|
|
108
|
+
| 阅读 Agent 入口指引 | `zan-saas skills read zan-saas` |
|
|
109
|
+
| 检查本地安装环境 | `zan-saas doctor` |
|
|
110
|
+
|
|
111
|
+
## 输出与权限
|
|
112
|
+
|
|
113
|
+
业务查询成功时输出 JSON,退出码为 `0`;失败时退出码非零,错误 JSON 写入 stderr。脚本应检查退出码并分别处理 stdout 和 stderr。
|
|
114
|
+
|
|
115
|
+
列表默认读取一页,跨页范围和数量限制由具体命令定义。金额单位、时间格式及分页含义可从 schema 读取。
|
|
116
|
+
|
|
117
|
+
当前已发布的业务命令均为只读查询。业务访问需要有效账号、目标店铺和相应的服务端权限。`api` 是独立的原始接口调用入口,使用前须核对目标 API 的副作用,不能自动替代未提供的业务操作。
|
|
118
|
+
|
|
119
|
+
## 升级与卸载
|
|
120
|
+
|
|
121
|
+
升级 CLI,并同步所选 Agent 的入口:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
npx @youzan-cloud/zan-saas-cli@latest install
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
查看版本或卸载 CLI:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
zan-saas --version
|
|
131
|
+
npm uninstall -g @youzan-cloud/zan-saas-cli
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
卸载 CLI 后,如不再使用,请在 Agent 中移除对应的 `zan-saas` 入口 Skill。
|
|
135
|
+
|
|
136
|
+
## 常见问题
|
|
137
|
+
|
|
138
|
+
### 安装后找不到 `zan-saas`
|
|
139
|
+
|
|
140
|
+
重新打开终端,并确认当前 Node.js 环境的 npm 全局命令目录已加入 PATH。使用 nvm 切换 Node.js 版本后,需要在新环境下重新安装。安装器生成的 Skill 记录了 CLI 的持久启动路径,供桌面 Agent 调用。
|
|
141
|
+
|
|
142
|
+
### 登录成功,但查询提示权限不足
|
|
143
|
+
|
|
144
|
+
先运行 `zan-saas shop current` 确认目标店铺,再根据命令帮助核对产品支持范围和账号权限。登录成功不代表已获得所有接口的访问权限。
|
|
145
|
+
|
|
146
|
+
### 查询提示店铺没有可用应用
|
|
147
|
+
|
|
148
|
+
部分查询遇到网关错误 `1106` 时会尝试初始化店铺应用,该操作需要店铺高级管理员身份。设置 `ZAN_SAAS_SHOP_APP_INIT=0` 可关闭自动初始化。权益卡持卡列表和单笔订单读取禁用此流程,具体行为以同版命令契约为准。
|
|
149
|
+
|
|
150
|
+
## 许可证
|
|
151
|
+
|
|
152
|
+
采用 MIT 许可证。第三方依赖的许可材料随包附带,见 `LICENSE`、`NOTICE` 和 `THIRD_PARTY_NOTICES.txt`。
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
ajv@8.20.0 (MIT)
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
-----
|
|
27
|
+
|
|
28
|
+
commander@12.1.0 (MIT)
|
|
29
|
+
(The MIT License)
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
34
|
+
a copy of this software and associated documentation files (the
|
|
35
|
+
'Software'), to deal in the Software without restriction, including
|
|
36
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
37
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
38
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
39
|
+
the following conditions:
|
|
40
|
+
|
|
41
|
+
The above copyright notice and this permission notice shall be
|
|
42
|
+
included in all copies or substantial portions of the Software.
|
|
43
|
+
|
|
44
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
45
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
46
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
47
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
48
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
49
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
50
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
-----
|
|
54
|
+
|
|
55
|
+
fast-deep-equal@3.1.3 (MIT)
|
|
56
|
+
MIT License
|
|
57
|
+
|
|
58
|
+
Copyright (c) 2017 Evgeny Poberezkin
|
|
59
|
+
|
|
60
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
61
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
62
|
+
in the Software without restriction, including without limitation the rights
|
|
63
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
64
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
65
|
+
furnished to do so, subject to the following conditions:
|
|
66
|
+
|
|
67
|
+
The above copyright notice and this permission notice shall be included in all
|
|
68
|
+
copies or substantial portions of the Software.
|
|
69
|
+
|
|
70
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
71
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
72
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
73
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
74
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
75
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
76
|
+
SOFTWARE.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
-----
|
|
80
|
+
|
|
81
|
+
fast-uri@3.1.9 (BSD-3-Clause)
|
|
82
|
+
Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
|
|
83
|
+
Copyright (c) 2021-present The Fastify team <https://github.com/fastify/fastify#team>
|
|
84
|
+
All rights reserved.
|
|
85
|
+
|
|
86
|
+
Redistribution and use in source and binary forms, with or without
|
|
87
|
+
modification, are permitted provided that the following conditions are met:
|
|
88
|
+
* Redistributions of source code must retain the above copyright
|
|
89
|
+
notice, this list of conditions and the following disclaimer.
|
|
90
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
91
|
+
notice, this list of conditions and the following disclaimer in the
|
|
92
|
+
documentation and/or other materials provided with the distribution.
|
|
93
|
+
* The names of any contributors may not be used to endorse or promote
|
|
94
|
+
products derived from this software without specific prior written
|
|
95
|
+
permission.
|
|
96
|
+
|
|
97
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
98
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
99
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
100
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
|
|
101
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
102
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
103
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
104
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
105
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
106
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
107
|
+
|
|
108
|
+
* * *
|
|
109
|
+
|
|
110
|
+
The complete list of contributors can be found at:
|
|
111
|
+
- https://github.com/garycourt/uri-js/graphs/contributors
|
|
112
|
+
|
|
113
|
+
-----
|
|
114
|
+
|
|
115
|
+
json-schema-traverse@1.0.0 (MIT)
|
|
116
|
+
MIT License
|
|
117
|
+
|
|
118
|
+
Copyright (c) 2017 Evgeny Poberezkin
|
|
119
|
+
|
|
120
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
121
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
122
|
+
in the Software without restriction, including without limitation the rights
|
|
123
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
124
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
125
|
+
furnished to do so, subject to the following conditions:
|
|
126
|
+
|
|
127
|
+
The above copyright notice and this permission notice shall be included in all
|
|
128
|
+
copies or substantial portions of the Software.
|
|
129
|
+
|
|
130
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
131
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
132
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
133
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
134
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
135
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
136
|
+
SOFTWARE.
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
-----
|
|
140
|
+
|
|
141
|
+
require-from-string@2.0.2 (MIT)
|
|
142
|
+
The MIT License (MIT)
|
|
143
|
+
|
|
144
|
+
Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
|
|
145
|
+
|
|
146
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
147
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
148
|
+
in the Software without restriction, including without limitation the rights
|
|
149
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
150
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
151
|
+
furnished to do so, subject to the following conditions:
|
|
152
|
+
|
|
153
|
+
The above copyright notice and this permission notice shall be included in
|
|
154
|
+
all copies or substantial portions of the Software.
|
|
155
|
+
|
|
156
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
157
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
158
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
159
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
160
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
161
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
162
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { createProgram } = require('../src/cli/program');
|
|
5
|
+
const { runWithApiSession } = require('../src/transport/api');
|
|
6
|
+
const { finalizeError } = require('../src/execution/error-details');
|
|
7
|
+
const { visibleCommands } = require('../src/commands/system/schema');
|
|
8
|
+
const { commandSchema } = require('../src/execution/command-schema');
|
|
9
|
+
|
|
10
|
+
let program;
|
|
11
|
+
Promise.resolve().then(() =>
|
|
12
|
+
runWithApiSession(() => {
|
|
13
|
+
program = createProgram();
|
|
14
|
+
if (process.argv.length === 2) {
|
|
15
|
+
program.outputHelp();
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return program.parseAsync(process.argv);
|
|
19
|
+
})
|
|
20
|
+
).catch(error => {
|
|
21
|
+
if (['commander.helpDisplayed', 'commander.version'].includes(error.code)) return;
|
|
22
|
+
if (error.code === 'commander.help' && error.exitCode === 0) return;
|
|
23
|
+
const registered = program && visibleCommands(program)
|
|
24
|
+
.find(entry => entry.path === error.cliDetails?.command);
|
|
25
|
+
const context = registered && { ...registered, schema: commandSchema(registered.command) };
|
|
26
|
+
process.stderr.write(`${JSON.stringify(finalizeError(error, context))}\n`);
|
|
27
|
+
process.exitCode = 1;
|
|
28
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const crypto = require('node:crypto');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const { validateAt } = require('../../src/execution/command-policy');
|
|
7
|
+
const { nativeCommandLocation } = require('../../src/cli/native-path');
|
|
8
|
+
const { validateAvailability } = require('../../src/cli/command-paths');
|
|
9
|
+
|
|
10
|
+
const manifestFile = path.join(__dirname, 'manifest.json');
|
|
11
|
+
const nativeRoot = path.join(__dirname, '../../src/commands/native');
|
|
12
|
+
const domainNamePattern = /^[a-z][a-z0-9-]*$/;
|
|
13
|
+
const risks = new Set(['read', 'low', 'medium', 'high']);
|
|
14
|
+
const digestPattern = /^[a-f0-9]{64}$/;
|
|
15
|
+
|
|
16
|
+
function validateManifest(manifest) {
|
|
17
|
+
if (!manifest || manifest.schemaVersion !== 6 ||
|
|
18
|
+
!Number.isSafeInteger(manifest.businessCommandCount) ||
|
|
19
|
+
manifest.businessCommandCount < 0 ||
|
|
20
|
+
!Array.isArray(manifest.domains) || !Array.isArray(manifest.skills)) {
|
|
21
|
+
throw new Error('Invalid command catalog manifest');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const domains = new Set();
|
|
25
|
+
let commandCount = 0;
|
|
26
|
+
for (const entry of manifest.domains) {
|
|
27
|
+
if (!entry || !domainNamePattern.test(entry.name) || domains.has(entry.name) ||
|
|
28
|
+
typeof entry.description !== 'string' || !entry.description.trim() ||
|
|
29
|
+
entry.skill !== `zan-saas-${entry.name}` ||
|
|
30
|
+
entry.indexFile !== `${entry.name}/commands.index.json` ||
|
|
31
|
+
!Number.isSafeInteger(entry.commandCount) || entry.commandCount < 0 ||
|
|
32
|
+
!Number.isSafeInteger(entry.indexSize) || entry.indexSize < 1 ||
|
|
33
|
+
!digestPattern.test(entry.indexSha256) ||
|
|
34
|
+
!digestPattern.test(entry.fingerprint)) {
|
|
35
|
+
throw new Error(`Invalid command catalog domain entry: ${entry?.name}`);
|
|
36
|
+
}
|
|
37
|
+
domains.add(entry.name);
|
|
38
|
+
commandCount += entry.commandCount;
|
|
39
|
+
}
|
|
40
|
+
if (commandCount !== manifest.businessCommandCount) {
|
|
41
|
+
throw new Error('Command catalog business command count does not match its domains');
|
|
42
|
+
}
|
|
43
|
+
return manifest;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function validateDomainIndex(index, domain, { historical = false } = {}) {
|
|
47
|
+
const legacy = historical && [1, 2].includes(index?.schemaVersion);
|
|
48
|
+
if (!index || (!legacy && index.schemaVersion !== 3) || index.domain !== domain.name ||
|
|
49
|
+
!Array.isArray(index.businessCommands) ||
|
|
50
|
+
index.businessCommands.length !== domain.commandCount) {
|
|
51
|
+
throw new Error(`Invalid command index for domain: ${domain.name}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const paths = new Set();
|
|
55
|
+
for (const entry of index.businessCommands) {
|
|
56
|
+
if (!entry || typeof entry.path !== 'string' || paths.has(entry.path) ||
|
|
57
|
+
typeof entry.module !== 'string' || !digestPattern.test(entry.fingerprint)) {
|
|
58
|
+
throw new Error(`Invalid command index entry in domain: ${domain.name}`);
|
|
59
|
+
}
|
|
60
|
+
const location = nativeCommandLocation(entry.module, entry.resourcePath);
|
|
61
|
+
const risk = legacy ? entry.mutationRisk : entry.risk;
|
|
62
|
+
if (!location || location.domain !== domain.name || entry.path !== location.path || entry.kind !== location.kind ||
|
|
63
|
+
!risks.has(risk) || (!legacy && Object.hasOwn(entry, 'mutationRisk'))) {
|
|
64
|
+
throw new Error(`Invalid command index entry: ${entry.path}`);
|
|
65
|
+
}
|
|
66
|
+
if (index.schemaVersion !== 1) validateAt(entry.at);
|
|
67
|
+
validateAvailability(entry.availability);
|
|
68
|
+
paths.add(entry.path);
|
|
69
|
+
}
|
|
70
|
+
return index;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function createRegistry(manifest, readIndex, { historical = false } = {}) {
|
|
74
|
+
validateManifest(manifest);
|
|
75
|
+
if (typeof readIndex !== 'function') throw new Error('Command catalog reader is missing');
|
|
76
|
+
|
|
77
|
+
const domains = new Map(manifest.domains.map(entry => [entry.name, entry]));
|
|
78
|
+
const cache = new Map();
|
|
79
|
+
|
|
80
|
+
function loadDomain(name) {
|
|
81
|
+
if (cache.has(name)) return cache.get(name);
|
|
82
|
+
const entry = domains.get(name);
|
|
83
|
+
if (!entry) throw new Error(`Native domain not published: ${name}`);
|
|
84
|
+
|
|
85
|
+
const raw = readIndex(entry);
|
|
86
|
+
const bytes = Buffer.isBuffer(raw) ? raw : Buffer.from(raw);
|
|
87
|
+
if (bytes.length !== entry.indexSize) {
|
|
88
|
+
throw new Error(`Command index size does not match manifest: ${name}`);
|
|
89
|
+
}
|
|
90
|
+
const digest = crypto.createHash('sha256').update(bytes).digest('hex');
|
|
91
|
+
if (digest !== entry.indexSha256) {
|
|
92
|
+
throw new Error(`Command index fingerprint does not match manifest: ${name}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let index;
|
|
96
|
+
try {
|
|
97
|
+
index = JSON.parse(bytes.toString('utf8'));
|
|
98
|
+
} catch {
|
|
99
|
+
throw new Error(`Command index is not valid JSON: ${name}`);
|
|
100
|
+
}
|
|
101
|
+
validateDomainIndex(index, entry, { historical });
|
|
102
|
+
cache.set(name, index);
|
|
103
|
+
return index;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return Object.freeze({ manifest, loadDomain });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function openRegistry({ manifestPath = manifestFile, commandsRoot = nativeRoot } = {}) {
|
|
110
|
+
let manifest;
|
|
111
|
+
try {
|
|
112
|
+
manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
113
|
+
} catch {
|
|
114
|
+
throw new Error('Command catalog manifest is missing or invalid');
|
|
115
|
+
}
|
|
116
|
+
validateManifest(manifest);
|
|
117
|
+
return createRegistry(manifest, entry => {
|
|
118
|
+
const filename = path.join(commandsRoot, entry.indexFile);
|
|
119
|
+
return fs.readFileSync(filename);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = { createRegistry, openRegistry, validateManifest, validateDomainIndex };
|