@01.software/cli 0.11.1 → 0.12.0
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/dist/mcp/.01-cli-mcp-build.json +1 -1
- package/dist/mcp/{chunk-VEFJZ6VK.js → chunk-CBN6MUZE.js} +127 -20
- package/dist/mcp/chunk-CBN6MUZE.js.map +1 -0
- package/dist/mcp/http.js +1 -1
- package/dist/mcp/stdio.js +1 -1
- package/dist/mcp/vercel.js +126 -19
- package/package.json +2 -2
- package/dist/mcp/chunk-VEFJZ6VK.js.map +0 -1
package/dist/mcp/http.js
CHANGED
package/dist/mcp/stdio.js
CHANGED
package/dist/mcp/vercel.js
CHANGED
|
@@ -336,7 +336,6 @@ var productFieldShape = {
|
|
|
336
336
|
weight: z2.number().int().min(0).optional().nullable(),
|
|
337
337
|
minOrderQuantity: z2.number().int().min(1).optional().nullable(),
|
|
338
338
|
maxOrderQuantity: z2.number().int().min(1).optional().nullable(),
|
|
339
|
-
listingPrimaryOption: IdSchema.optional().nullable(),
|
|
340
339
|
isFeatured: z2.boolean().optional(),
|
|
341
340
|
publishedAt: z2.string().optional().nullable(),
|
|
342
341
|
categories: z2.array(IdSchema).optional(),
|
|
@@ -539,6 +538,9 @@ var confirmPaymentSchema = z3.object({
|
|
|
539
538
|
"provider_api_confirm",
|
|
540
539
|
"manual_server"
|
|
541
540
|
]).optional(),
|
|
541
|
+
paymentKey: z3.string().min(1).optional().describe(
|
|
542
|
+
"Optional provider payment key from the client confirm handshake; stored for BFF/provider refund workflows (also accepted as metadata.tossPaymentKey). Local cancel does not read this field."
|
|
543
|
+
),
|
|
542
544
|
metadata: z3.record(z3.string(), z3.unknown()).optional()
|
|
543
545
|
}).strict();
|
|
544
546
|
var ConfirmPaymentSchema = confirmPaymentSchema;
|
|
@@ -591,20 +593,32 @@ var CancelOrderSchema = cancelOrderSchema;
|
|
|
591
593
|
var cancelOrderResponseBaseSchema = {
|
|
592
594
|
orderId: z3.string().min(1)
|
|
593
595
|
};
|
|
594
|
-
var
|
|
596
|
+
var unpaidLocalCancelCommittedResponseFields = {
|
|
595
597
|
refundedAmount: z3.literal(0),
|
|
596
598
|
providerRefunded: z3.literal(false)
|
|
597
599
|
};
|
|
598
|
-
var
|
|
599
|
-
|
|
600
|
-
|
|
600
|
+
var paidLocalCancelCommittedResponseFields = {
|
|
601
|
+
transactionId: z3.string().min(1),
|
|
602
|
+
refundedAmount: z3.literal(0),
|
|
603
|
+
providerRefunded: z3.literal(false),
|
|
604
|
+
refundPending: z3.literal(true)
|
|
601
605
|
};
|
|
602
|
-
var
|
|
606
|
+
var legacyProviderRefundResponseFields = {
|
|
603
607
|
transactionId: z3.string().min(1),
|
|
604
608
|
refundedAmount: z3.number().int().positive(),
|
|
605
609
|
refundSeq: z3.number().int().positive(),
|
|
606
610
|
providerRefunded: z3.literal(true)
|
|
607
611
|
};
|
|
612
|
+
var alreadyCanceledResponseFields = {
|
|
613
|
+
refundedAmount: z3.number().int().nonnegative(),
|
|
614
|
+
providerRefunded: z3.literal(false)
|
|
615
|
+
};
|
|
616
|
+
var alreadyCanceledRefundPendingResponseFields = {
|
|
617
|
+
transactionId: z3.string().min(1),
|
|
618
|
+
refundedAmount: z3.number().int().nonnegative(),
|
|
619
|
+
providerRefunded: z3.literal(false),
|
|
620
|
+
refundPending: z3.literal(true)
|
|
621
|
+
};
|
|
608
622
|
var cancelOrderReconciliationStatusSchema = z3.enum([
|
|
609
623
|
"paid",
|
|
610
624
|
"preparing",
|
|
@@ -619,13 +633,13 @@ var cancelOrderReconciliationStatusSchema = z3.enum([
|
|
|
619
633
|
var cancelOrderResponseSchema = z3.union([
|
|
620
634
|
z3.object({
|
|
621
635
|
...cancelOrderResponseBaseSchema,
|
|
622
|
-
...
|
|
636
|
+
...paidLocalCancelCommittedResponseFields,
|
|
623
637
|
status: z3.literal("canceled"),
|
|
624
638
|
cancelCommitted: z3.literal(true)
|
|
625
639
|
}).strict(),
|
|
626
640
|
z3.object({
|
|
627
641
|
...cancelOrderResponseBaseSchema,
|
|
628
|
-
...
|
|
642
|
+
...unpaidLocalCancelCommittedResponseFields,
|
|
629
643
|
status: z3.literal("canceled"),
|
|
630
644
|
cancelCommitted: z3.literal(true)
|
|
631
645
|
}).strict(),
|
|
@@ -638,12 +652,75 @@ var cancelOrderResponseSchema = z3.union([
|
|
|
638
652
|
}).strict(),
|
|
639
653
|
z3.object({
|
|
640
654
|
...cancelOrderResponseBaseSchema,
|
|
641
|
-
...
|
|
655
|
+
...alreadyCanceledRefundPendingResponseFields,
|
|
656
|
+
status: z3.literal("canceled"),
|
|
657
|
+
cancelCommitted: z3.literal(false),
|
|
658
|
+
alreadyCanceled: z3.literal(true)
|
|
659
|
+
}).strict(),
|
|
660
|
+
z3.object({
|
|
661
|
+
...cancelOrderResponseBaseSchema,
|
|
662
|
+
...legacyProviderRefundResponseFields,
|
|
642
663
|
status: cancelOrderReconciliationStatusSchema,
|
|
643
664
|
cancelCommitted: z3.literal(false),
|
|
644
665
|
reconciliationRequired: z3.literal(true)
|
|
645
666
|
}).strict()
|
|
646
667
|
]);
|
|
668
|
+
var resolveCancelRefundOutcomeSchema = z3.enum(["succeeded", "failed"]);
|
|
669
|
+
var resolveCancelRefundSchema = z3.object({
|
|
670
|
+
orderNumber: z3.string().min(1, "orderNumber is required").describe("Order number whose pending cancel refund is being resolved"),
|
|
671
|
+
idempotencyKey: idempotencyKeySchema.describe(
|
|
672
|
+
"Stable key for this PG refund result report"
|
|
673
|
+
),
|
|
674
|
+
outcome: resolveCancelRefundOutcomeSchema.describe(
|
|
675
|
+
"PG refund result reported by the storefront or BFF"
|
|
676
|
+
),
|
|
677
|
+
refundedAmount: z3.number().int("refundedAmount must be an integer minor-unit amount").nonnegative("refundedAmount must be nonnegative"),
|
|
678
|
+
pgProvider: z3.string().trim().min(1, "pgProvider is required").regex(
|
|
679
|
+
/^[a-z0-9][a-z0-9_-]*$/,
|
|
680
|
+
"pgProvider must be a lowercase provider slug"
|
|
681
|
+
),
|
|
682
|
+
pgRefundId: z3.string().trim().min(1).optional()
|
|
683
|
+
}).strict().superRefine((value, ctx) => {
|
|
684
|
+
if (value.outcome === "succeeded" && value.refundedAmount <= 0) {
|
|
685
|
+
ctx.addIssue({
|
|
686
|
+
code: z3.ZodIssueCode.custom,
|
|
687
|
+
path: ["refundedAmount"],
|
|
688
|
+
message: "refundedAmount must be positive when outcome is succeeded"
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
if (value.outcome === "succeeded" && !value.pgRefundId) {
|
|
692
|
+
ctx.addIssue({
|
|
693
|
+
code: z3.ZodIssueCode.custom,
|
|
694
|
+
path: ["pgRefundId"],
|
|
695
|
+
message: "pgRefundId is required when outcome is succeeded"
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
if (value.outcome === "failed" && value.refundedAmount !== 0) {
|
|
699
|
+
ctx.addIssue({
|
|
700
|
+
code: z3.ZodIssueCode.custom,
|
|
701
|
+
path: ["refundedAmount"],
|
|
702
|
+
message: "refundedAmount must be 0 when outcome is failed"
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
var resolveCancelRefundResponseSchema = z3.union([
|
|
707
|
+
z3.object({
|
|
708
|
+
orderId: z3.string().min(1),
|
|
709
|
+
transactionId: z3.string().min(1),
|
|
710
|
+
refundTransactionId: z3.string().min(1),
|
|
711
|
+
refundedAmount: z3.number().int().positive(),
|
|
712
|
+
refundStatus: z3.literal("succeeded"),
|
|
713
|
+
transactionStatus: z3.literal("refunded")
|
|
714
|
+
}).strict(),
|
|
715
|
+
z3.object({
|
|
716
|
+
orderId: z3.string().min(1),
|
|
717
|
+
transactionId: z3.string().min(1),
|
|
718
|
+
refundTransactionId: z3.string().min(1),
|
|
719
|
+
refundedAmount: z3.literal(0),
|
|
720
|
+
refundStatus: z3.literal("failed"),
|
|
721
|
+
transactionStatus: z3.literal("paid")
|
|
722
|
+
}).strict()
|
|
723
|
+
]);
|
|
647
724
|
|
|
648
725
|
// ../../packages/contracts/src/mcp/index.ts
|
|
649
726
|
var MCP_TOOL_CONTRACT = {
|
|
@@ -4169,7 +4246,7 @@ const order = await client.commerce.orders.checkout({
|
|
|
4169
4246
|
- Requires pgPaymentId and paymentKey for provider-verified refund
|
|
4170
4247
|
|
|
4171
4248
|
### Key Points
|
|
4172
|
-
- Full refund: original transaction \u2192 \`canceled\`
|
|
4249
|
+
- Full refund: original transaction \u2192 \`canceled\` (**return-with-refund only**; order-cancel does NOT cancel the transaction \u2014 it stays \`paid\` until the storefront PG refund resolves it)
|
|
4173
4250
|
- Partial refund: new refund transaction created
|
|
4174
4251
|
- Stock restored: stock += qty, reservedStock -= qty
|
|
4175
4252
|
- Cumulative refunds tracked: refundAmount + order.refundedAmount \u2264 totalAmount
|
|
@@ -4188,23 +4265,24 @@ await client.commerce.orders.returnWithRefund({
|
|
|
4188
4265
|
paymentKey: 'payment_key_xxx'
|
|
4189
4266
|
})
|
|
4190
4267
|
\`\`\``,
|
|
4191
|
-
"order-cancel": `##
|
|
4268
|
+
"order-cancel": `## Local Order Cancellation (PG refund separate)
|
|
4192
4269
|
|
|
4193
4270
|
### Flow
|
|
4194
4271
|
|
|
4195
4272
|
1. **Cancel Order** -> \`cancel-order\` tool
|
|
4196
|
-
- Pending or failed unpaid orders cancel without a
|
|
4197
|
-
- Paid captured orders
|
|
4198
|
-
-
|
|
4199
|
-
-
|
|
4200
|
-
-
|
|
4201
|
-
-
|
|
4273
|
+
- Pending or failed unpaid orders cancel locally without a PG call
|
|
4274
|
+
- Paid captured orders cancel **locally only**: order \`canceled\`, payment transaction stays \`paid\`, reservedStock released
|
|
4275
|
+
- **PG refund is not performed by Console** \u2014 storefront/BFF calls Toss/Portone; webhook sync is a follow-up
|
|
4276
|
+
- \`refundedAmount\` is not incremented on local cancel; new cancels return \`providerRefunded: false\`
|
|
4277
|
+
- \`refundPending: true\` signals storefront PG refund is still required; idempotent retries may return it from server metadata
|
|
4278
|
+
- Legacy inline-PG-cancel rows may still return \`reconciliationRequired: true\` with \`providerRefunded: true\`
|
|
4279
|
+
- Duplicate local success returns \`alreadyCanceled: true\`
|
|
4202
4280
|
|
|
4203
4281
|
### V1 Rejections
|
|
4204
4282
|
- Orders with non-failed fulfillments are rejected
|
|
4205
4283
|
- \`shipped\`, \`delivered\`, \`confirmed\`, and return-axis orders are rejected
|
|
4206
4284
|
- Active returns are rejected; use \`return-with-refund\` after delivery
|
|
4207
|
-
- Partial line-item cancellation
|
|
4285
|
+
- Partial line-item cancellation is not supported in v1
|
|
4208
4286
|
|
|
4209
4287
|
### Code Example
|
|
4210
4288
|
\`\`\`typescript
|
|
@@ -4216,7 +4294,36 @@ await client.commerce.orders.cancelOrder({
|
|
|
4216
4294
|
})
|
|
4217
4295
|
\`\`\`
|
|
4218
4296
|
|
|
4219
|
-
|
|
4297
|
+
### Storefront PG refund (BFF only)
|
|
4298
|
+
|
|
4299
|
+
After \`cancelOrder\`, initiate PG refund **only when all of the following hold**:
|
|
4300
|
+
|
|
4301
|
+
- First response: \`cancelCommitted: true\` **and** \`refundPending: true\`
|
|
4302
|
+
- Idempotent retry: \`alreadyCanceled: true\` **and** \`refundPending: true\` (read from server metadata)
|
|
4303
|
+
- PG lookup confirms the payment is still captured / not yet refunded
|
|
4304
|
+
|
|
4305
|
+
**Never** call PG refund when:
|
|
4306
|
+
|
|
4307
|
+
- \`providerRefunded: true\` (legacy inline-PG-cancel or refund already recorded)
|
|
4308
|
+
- \`reconciliationRequired: true\` (escalate to ops \u2014 do not auto-refund)
|
|
4309
|
+
- \`refundPending\` is absent on an unpaid / never-captured order
|
|
4310
|
+
|
|
4311
|
+
Prefer persisting the first \`cancelOrder\` response; use PG \`getPayment\` before refund when state is uncertain.
|
|
4312
|
+
|
|
4313
|
+
After a PG refund attempt reaches a terminal result, report that exact result back to Console. This is a BFF/server-only operation and requires an \`sk01_\` server API key.
|
|
4314
|
+
|
|
4315
|
+
\`\`\`typescript
|
|
4316
|
+
await client.commerce.orders.resolveCancelRefund({
|
|
4317
|
+
orderNumber: 'ORD-240101-001',
|
|
4318
|
+
idempotencyKey: 'refund-cancel-ORD-240101-001-attempt-1',
|
|
4319
|
+
outcome: 'succeeded',
|
|
4320
|
+
refundedAmount: 59800,
|
|
4321
|
+
pgProvider: 'toss',
|
|
4322
|
+
pgRefundId: 'toss-refund-abc'
|
|
4323
|
+
})
|
|
4324
|
+
\`\`\`
|
|
4325
|
+
|
|
4326
|
+
Use one idempotency key per distinct PG refund attempt/result. For PG refund failure, call \`resolveCancelRefund({ outcome: 'failed', refundedAmount: 0, ... })\` with that attempt key. If a later PG attempt succeeds after a reported failure, use a new key such as \`refund-cancel-ORD-240101-001-attempt-2\`. Reuse the exact same \`idempotencyKey\` only for transport retries of the same reported result; never reuse it for a different order, outcome, provider, amount, or provider refund id.`,
|
|
4220
4327
|
"fulfillment-tracking": `## Fulfillment & Tracking
|
|
4221
4328
|
|
|
4222
4329
|
### Creating Fulfillment
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@01.software/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "CLI tool for 01.software platform",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"commander": "^14.0.3",
|
|
23
23
|
"picocolors": "^1.1.1",
|
|
24
24
|
"zod": "^4.4.3",
|
|
25
|
-
"@01.software/sdk": "^0.
|
|
25
|
+
"@01.software/sdk": "^0.36.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.18",
|