@sadrmanesh/commerce-agent-skills 0.3.2 → 0.3.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/CHANGELOG.md +15 -0
- package/README.md +20 -0
- package/package.json +1 -1
- package/skills/b2b-pricing/SKILL.md +1 -1
- package/skills/catalog-import-and-migration/SKILL.md +1 -1
- package/skills/checkout-ux-and-conversion/SKILL.md +1 -1
- package/skills/conversion-event-tracking/SKILL.md +1 -1
- package/skills/ecommerce-seo-structured-data/SKILL.md +1 -1
- package/skills/fraud-and-risk-basics/SKILL.md +1 -1
- package/skills/google-merchant-product-feeds/SKILL.md +1 -1
- package/skills/headless-nextjs-storefront/SKILL.md +1 -1
- package/skills/inventory-and-multi-warehouse/SKILL.md +1 -1
- package/skills/inventory-and-multi-warehouse/scripts/allocate-stock.mjs +16 -2
- package/skills/iranian-payment-gateways/SKILL.md +1 -1
- package/skills/marketplace-search-and-ranking/SKILL.md +1 -1
- package/skills/mcp-store-tooling/SKILL.md +1 -1
- package/skills/multi-vendor-payouts/SKILL.md +1 -1
- package/skills/order-and-webhook-reliability/SKILL.md +1 -1
- package/skills/payment-gateway-integration/SKILL.md +1 -1
- package/skills/product-catalog-modeling/SKILL.md +1 -1
- package/skills/product-description-guardrails/SKILL.md +1 -1
- package/skills/returns-and-refunds/SKILL.md +1 -1
- package/skills/rtl-and-persian-localization/SKILL.md +1 -1
- package/skills/shopify-app-development/SKILL.md +1 -1
- package/skills/storefront-accessibility/SKILL.md +1 -1
- package/skills/storefront-performance/SKILL.md +1 -1
- package/skills/stripe-payments/SKILL.md +1 -1
- package/skills/subscription-billing/SKILL.md +1 -1
- package/skills/tax-and-shipping/SKILL.md +1 -1
- package/skills/vector-product-search/SKILL.md +1 -1
- package/skills/woocommerce-plugin-development/SKILL.md +1 -1
- package/skills/woocommerce-rest-api/SKILL.md +1 -1
- package/skills/wordpress-plugin-security/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.3.3] - 2026-11-04
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `allocate-stock.mjs` could oversell when an order had two lines for the same SKU. The one-location check looked at each line alone, so two lines of 3 both fit a location with 4 free. It now sums quantities per SKU first.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `reserve()` in `allocate-stock.mjs`, a check-and-set step that reserves stock only when enough is free. The allocator uses it.
|
|
14
|
+
- Tests for two concurrent checkouts racing for the last unit, plus a test that runs the same race against a read-then-write reserve and expects it to oversell, so the race test shows it can fail. Removing the stock decrement, the availability check, or the per-SKU sum now fails the suite; before this change, removing the decrement still passed.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- The package and every skill are now version 0.3.3.
|
|
19
|
+
|
|
5
20
|
## [0.3.2] - 2026-10-31
|
|
6
21
|
|
|
7
22
|
### Added
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ Skills and rules for AI coding agents that build e-commerce and marketplace prod
|
|
|
4
4
|
|
|
5
5
|
**Documentation:** <https://sadrmanesh.github.io/commerce-agent-skills/> · **Dataset:** [Hugging Face](https://huggingface.co/datasets/sadrmanesh/commerce-agent-skills)
|
|
6
6
|
|
|
7
|
+
**Read more:** [Treat agent skills like code: evals, a strict validator, and an npx installer for commerce skills](https://dev.to/sadrmanesh/treat-agent-skills-like-code-evals-a-strict-validator-and-an-npx-installer-for-commerce-skills-13dk) on Dev.to · [The knowledge your senior engineers carry, packaged for coding agents](https://www.linkedin.com/pulse/knowledge-your-senior-engineers-carry-packaged-coding-sadrmanesh-xtenf/) on LinkedIn
|
|
8
|
+
|
|
7
9
|
The skills follow the [Agent Skills](https://agentskills.io/specification) format: a folder, a `SKILL.md` file with `name` and `description`, and optional reference files and scripts. An agent that supports that format can load them. The format does not name an install path. [Installation](docs/installation.md) explains how to point your agent at these folders.
|
|
8
10
|
|
|
9
11
|
Version 0.3.0 adds store operations to the library. It keeps the twenty skills from 0.1.0 and 0.2.0 and adds Stripe payments, Iranian payment gateways such as Zarinpal, inventory across warehouses, returns and refunds, B2B pricing, catalog import and migration, storefront accessibility, storefront performance, and MCP store tooling. It also adds a stricter validator and an eval runner that scores answers against the fixtures.
|
|
@@ -132,6 +134,24 @@ Later releases can add:
|
|
|
132
134
|
|
|
133
135
|
See [CONTRIBUTING.md](CONTRIBUTING.md). Run the validator before opening a pull request. New skills need a matching rule, a row in `skills/catalog-order.txt`, and a place in `website/categories.json`.
|
|
134
136
|
|
|
137
|
+
## Technical report
|
|
138
|
+
|
|
139
|
+
[](https://doi.org/10.5281/zenodo.23883598)
|
|
140
|
+
|
|
141
|
+
commerce-agent-skills: Architectural Specification, Domain Constraints, and Evaluation Framework for E-Commerce AI Coding Agents. M. N. Sadrmanesh, Zenodo, 2026. <https://doi.org/10.5281/zenodo.23883598>
|
|
142
|
+
|
|
143
|
+
```bibtex
|
|
144
|
+
@techreport{sadrmanesh2026commerceagentskills,
|
|
145
|
+
author = {Sadrmanesh, Mohammad Naser},
|
|
146
|
+
title = {commerce-agent-skills: Architectural Specification, Domain Constraints, and Evaluation Framework for E-Commerce AI Coding Agents},
|
|
147
|
+
institution = {Zenodo},
|
|
148
|
+
year = {2026},
|
|
149
|
+
version = {1.0},
|
|
150
|
+
doi = {10.5281/zenodo.23883598},
|
|
151
|
+
url = {https://doi.org/10.5281/zenodo.23883598}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
135
155
|
## License
|
|
136
156
|
|
|
137
157
|
[MIT](LICENSE). Copyright (c) 2026 Naser Sadrmanesh.
|
package/package.json
CHANGED
|
@@ -13,6 +13,17 @@ export function availableAt(location, sku) {
|
|
|
13
13
|
return Math.max(0, (level.onHand ?? 0) - (level.reserved ?? 0) - (level.safetyStock ?? 0));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Reserves quantity units of sku in levels as one check-and-set step, so nothing can run
|
|
18
|
+
* between reading what is free and writing the new reserved count. Returns false and
|
|
19
|
+
* changes nothing when fewer units are free. A database version is one conditional UPDATE.
|
|
20
|
+
*/
|
|
21
|
+
export function reserve(levels, sku, quantity) {
|
|
22
|
+
if (availableAt({ levels }, sku) < quantity) return false;
|
|
23
|
+
levels[sku] = { ...levels[sku], reserved: (levels[sku].reserved ?? 0) + quantity };
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
/**
|
|
17
28
|
* Returns { allocations: [{ sku, location, quantity }], shortfalls: [{ sku, quantity }], locations }.
|
|
18
29
|
* Never allocates more than a location has available.
|
|
@@ -27,7 +38,10 @@ export function allocateOrder(order, stock) {
|
|
|
27
38
|
if (!Number.isInteger(line.quantity) || line.quantity <= 0) throw new Error(`${line.sku}: quantity must be a positive whole number`);
|
|
28
39
|
}
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
// Sum repeated SKUs so two lines for the same item cannot each pass the check alone.
|
|
42
|
+
const totals = new Map();
|
|
43
|
+
for (const line of lines) totals.set(line.sku, (totals.get(line.sku) ?? 0) + line.quantity);
|
|
44
|
+
const single = eligible.find((location) => [...totals].every(([sku, quantity]) => availableAt(location, sku) >= quantity));
|
|
31
45
|
if (single) {
|
|
32
46
|
const allocations = lines.map((line) => ({ sku: line.sku, location: single.location, quantity: line.quantity }));
|
|
33
47
|
return { allocations, shortfalls: [], locations: [single.location] };
|
|
@@ -48,7 +62,7 @@ export function allocateOrder(order, stock) {
|
|
|
48
62
|
if (free === 0) continue;
|
|
49
63
|
const take = Math.min(free, needed);
|
|
50
64
|
allocations.push({ sku: line.sku, location: location.location, quantity: take });
|
|
51
|
-
levels
|
|
65
|
+
reserve(levels, line.sku, take);
|
|
52
66
|
used.add(location.location);
|
|
53
67
|
needed -= take;
|
|
54
68
|
}
|