配送区域与运费(固定、按重量、按金额、满额包邮),含预计送达时间和物流跟踪链接
代码6 个文件上下文约 445 个 token扫描通过
安装
$
genpm add @core/shipping你将获得
- 源代码位于 src/lib/shipping/,共 6 个文件。 (15 kB)
- AI 规则位于 src/lib/shipping/AGENTS.md,另附 IDE 规则文件。
- 自动为你解析 @core/cart, @core/contracts, @core/db, @core/money。
README
此包没有 README。
约 445 个 token→ src/lib/shipping/AGENTS.md→ .cursor/rules/genpm-core-shipping.mdc
这正是你的 AI 在 src/lib/shipping 中工作时读取的内容。不会向其上下文添加其他任何内容。
@core/shipping — rules for AI agents
Purpose
Shipping zones (ISO country lists, * = rest of world) and rates per zone: flat price, weight and order-value
ranges, free shipping over an amount (after discounts) and delivery estimates in days. Registers the shipping
step (order 200) of the @core/cart totals pipeline and builds tracking URLs for common carriers.
No label purchase or live carrier quotes. Tables: shipping_zones, shipping_rates.
Map
index.ts— public API:upsertZone,upsertRate,ratesFor,zoneFor,trackingUrl,CARRIERS,shippingAdminResources.shipping.ts— rules and the totals step.admin.ts— admin resources.schema.ts— tables.
Integration
- Migrations as in
src/lib/db/AGENTS.md. Import this module at startup (it registers the totals step). - Create zones and rates in the admin (
...shippingAdminResources()insrc/genpm/admin.ts, permissionsshipping:read|update). - At checkout, store the country and the chosen rate on the cart:
setCartMeta(cart.id, { country: 'ES', shippingRateId }); list options withratesFor(totals, country)and showminDays–maxDaysbefore payment. - Tracking:
trackingUrl(carrier, number)when marking an order shipped (@core/orders). - Verify: a cart with country
ESgets the cheapest Spanish rate; one over the free threshold pays 0.
Conventions
- Prices in minor units of
STORE_CURRENCY; weights in grams from catalog variants. - Digital-only carts never get shipping.
- Show
no_shippingissues clearly and block checkout for those countries.
Don't
- Don't hide delivery times or shipping costs until after payment (EU consumer law requires them upfront).
- Don't trust a rate id or amount sent by the browser; the totals step recomputes it.
# @core/shipping — rules for AI agents
## Purpose
Shipping zones (ISO country lists, `*` = rest of world) and rates per zone: flat price, weight and order-value
ranges, free shipping over an amount (after discounts) and delivery estimates in days. Registers the `shipping`
step (order 200) of the @core/cart totals pipeline and builds tracking URLs for common carriers.
No label purchase or live carrier quotes. Tables: `shipping_zones`, `shipping_rates`.
## Map
- `index.ts` — public API: `upsertZone`, `upsertRate`, `ratesFor`, `zoneFor`, `trackingUrl`, `CARRIERS`, `shippingAdminResources`.
- `shipping.ts` — rules and the totals step. `admin.ts` — admin resources. `schema.ts` — tables.
## Integration
1. Migrations as in `src/lib/db/AGENTS.md`. Import this module at startup (it registers the totals step).
2. Create zones and rates in the admin (`...shippingAdminResources()` in `src/genpm/admin.ts`, permissions `shipping:read|update`).
3. At checkout, store the country and the chosen rate on the cart: `setCartMeta(cart.id, { country: 'ES', shippingRateId })`;
list options with `ratesFor(totals, country)` and show `minDays–maxDays` before payment.
4. Tracking: `trackingUrl(carrier, number)` when marking an order shipped (@core/orders).
5. Verify: a cart with country `ES` gets the cheapest Spanish rate; one over the free threshold pays 0.
## Conventions
- Prices in minor units of `STORE_CURRENCY`; weights in grams from catalog variants.
- Digital-only carts never get shipping.
- Show `no_shipping` issues clearly and block checkout for those countries.
## Don't
- Don't hide delivery times or shipping costs until after payment (EU consumer law requires them upfront).
- Don't trust a rate id or amount sent by the browser; the totals step recomputes it.
应用 .genpmignore 后将被注入的确切目录树。固定于
MIT License
Copyright (c) 2026 GenPM
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
此包未声明 MCP 服务器。
| 版本 | 提交 | 发布时间 | 扫描 |
|---|---|---|---|
| 1.0.0 | 4e8e68d | 3小时前 | 扫描通过 |
- npm
- zod ^4.0.0
- 建议
- GenPM 会给出 npm 命令建议,只有你同意时才会运行。
- 扫描
- 扫描通过 · 0 个问题
- 提交
- v1.0.0 → 4e8e68d047c764a7a689d286d2e4119529ae11ee · 获取后已校验
- 脚本
- 无。GenPM 从不运行包中的代码。
- 许可证
- MIT
- 质量
- 100/100
- 可识别的许可证已满足
- AGENTS.md 说明了用途已满足
- AGENTS.md 包含集成步骤已满足
- AGENTS.md 列出约定或禁止事项已满足
- 包含测试已满足
- 通过安全扫描已满足
- 最近 6 个月内发布已满足
- 已验证的发布者已满足
- 摘要和关键词已满足
- 举报
- 发现问题了吗?