@ikas/code-components-mcp 1.4.0-beta.176 → 1.4.0-beta.178
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/data/storefront-api.json +67 -7
- package/data/storefront-types.json +79 -54
- package/dist/index.js +124 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/data/storefront-api.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-
|
|
2
|
+
"generatedAt": "2026-09-01T07:21:40.959Z",
|
|
3
3
|
"functions": [
|
|
4
4
|
{
|
|
5
5
|
"name": "apiListProductBrand",
|
|
@@ -101,16 +101,16 @@
|
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"name": "apiListLoyaltyProgramPointHistory",
|
|
104
|
-
"signature": "async function apiListLoyaltyProgramPointHistory(params: ListLoyaltyProgramPointHistoryQueryParams): Promise<APIResponse<
|
|
104
|
+
"signature": "async function apiListLoyaltyProgramPointHistory(params: ListLoyaltyProgramPointHistoryQueryParams): Promise<APIResponse<IkasLoyaltyProgramPointHistory[]>>",
|
|
105
105
|
"description": "",
|
|
106
106
|
"params": [],
|
|
107
|
-
"returnType": "Promise<APIResponse<
|
|
107
|
+
"returnType": "Promise<APIResponse<IkasLoyaltyProgramPointHistory[]>>",
|
|
108
108
|
"categories": [],
|
|
109
109
|
"related": [],
|
|
110
110
|
"isAsync": true,
|
|
111
111
|
"isClass": false,
|
|
112
112
|
"parameterTypes": [
|
|
113
|
-
"
|
|
113
|
+
"IkasLoyaltyProgramPointHistory"
|
|
114
114
|
]
|
|
115
115
|
},
|
|
116
116
|
{
|
|
@@ -3085,6 +3085,35 @@
|
|
|
3085
3085
|
"IkasOrderGiftPackageLine"
|
|
3086
3086
|
]
|
|
3087
3087
|
},
|
|
3088
|
+
{
|
|
3089
|
+
"name": "getIkasOrderGiftCardTotalPrice",
|
|
3090
|
+
"displayName": "getGiftCardTotalPrice",
|
|
3091
|
+
"signature": "function getIkasOrderGiftCardTotalPrice(order: IkasOrder): number",
|
|
3092
|
+
"description": "Returns the total amount covered by the gift cards (and store credits) applied to the order or cart.\n\nThis is a derived value, the API does not return it: it sums `amount` over `order.giftCardLines`.\nSubtract it from `order.totalFinalPrice` to get the amount still due.",
|
|
3093
|
+
"params": [
|
|
3094
|
+
{
|
|
3095
|
+
"name": "order",
|
|
3096
|
+
"description": "- The IkasOrder or IkasCart holding the gift card lines"
|
|
3097
|
+
}
|
|
3098
|
+
],
|
|
3099
|
+
"returns": "The summed gift card amount, or 0 when no gift card is applied",
|
|
3100
|
+
"returnType": "number",
|
|
3101
|
+
"example": "```typescript\nimport { getIkasOrderGiftCardTotalPrice } from \"@ikas/bp-storefront\";\n\nconst giftCardTotal = getIkasOrderGiftCardTotalPrice(cart);\nconst remainingPrice = cart.totalFinalPrice - giftCardTotal;\n```",
|
|
3102
|
+
"categories": [
|
|
3103
|
+
"Order",
|
|
3104
|
+
"Cart"
|
|
3105
|
+
],
|
|
3106
|
+
"related": [
|
|
3107
|
+
"removeGiftCardLine",
|
|
3108
|
+
"saveCouponCode"
|
|
3109
|
+
],
|
|
3110
|
+
"isAsync": false,
|
|
3111
|
+
"isClass": false,
|
|
3112
|
+
"parameterTypes": [
|
|
3113
|
+
"IkasOrderGiftCardTotalPrice",
|
|
3114
|
+
"IkasOrder"
|
|
3115
|
+
]
|
|
3116
|
+
},
|
|
3088
3117
|
{
|
|
3089
3118
|
"name": "getIkasOrderDistinctItemCount",
|
|
3090
3119
|
"displayName": "getDistinctItemCount",
|
|
@@ -13168,6 +13197,37 @@
|
|
|
13168
13197
|
"IkasCartOperationResult"
|
|
13169
13198
|
]
|
|
13170
13199
|
},
|
|
13200
|
+
{
|
|
13201
|
+
"name": "removeGiftCardLine",
|
|
13202
|
+
"signature": "async function removeGiftCardLine(cart: IkasCart, giftCardId?: string | null): Promise<IkasCartOperationResult>",
|
|
13203
|
+
"description": "Remove a gift card (or store credit) line from the cart.\n\nGift cards are applied through `saveCouponCode` with the gift card code, and the applied\ncards are listed on `cart.giftCardLines`. Pass the `giftCardId` of the line to remove; when\nomitted, every gift card line is removed from the cart.",
|
|
13204
|
+
"params": [
|
|
13205
|
+
{
|
|
13206
|
+
"name": "cart",
|
|
13207
|
+
"description": "- The cart object"
|
|
13208
|
+
},
|
|
13209
|
+
{
|
|
13210
|
+
"name": "giftCardId",
|
|
13211
|
+
"description": "- The gift card to remove, or null/undefined to remove all of them"
|
|
13212
|
+
}
|
|
13213
|
+
],
|
|
13214
|
+
"returns": "Result with success flag",
|
|
13215
|
+
"returnType": "Promise<IkasCartOperationResult>",
|
|
13216
|
+
"example": "```typescript\nimport { cartStore, removeGiftCardLine } from \"@ikas/bp-storefront\";\n\nasync function handleRemoveGiftCard(giftCardId: string) {\n if (!cartStore.cart) return;\n\n const result = await removeGiftCardLine(cartStore.cart, giftCardId);\n if (result.success) {\n showToast(\"Gift card removed\");\n }\n}\n```",
|
|
13217
|
+
"categories": [
|
|
13218
|
+
"Cart"
|
|
13219
|
+
],
|
|
13220
|
+
"related": [
|
|
13221
|
+
"saveCouponCode",
|
|
13222
|
+
"getIkasOrderGiftCardTotalPrice"
|
|
13223
|
+
],
|
|
13224
|
+
"isAsync": true,
|
|
13225
|
+
"isClass": false,
|
|
13226
|
+
"parameterTypes": [
|
|
13227
|
+
"IkasCart",
|
|
13228
|
+
"IkasCartOperationResult"
|
|
13229
|
+
]
|
|
13230
|
+
},
|
|
13171
13231
|
{
|
|
13172
13232
|
"name": "getCart",
|
|
13173
13233
|
"signature": "async function getCart(): Promise<void>",
|
|
@@ -14435,17 +14495,17 @@
|
|
|
14435
14495
|
{
|
|
14436
14496
|
"name": "cs_listLoyaltyProgramPointHistory",
|
|
14437
14497
|
"displayName": "listLoyaltyProgramPointHistory",
|
|
14438
|
-
"signature": "async function cs_listLoyaltyProgramPointHistory(customerStore: IkasCustomerStore, params: ListLoyaltyProgramPointHistoryQueryParams): Promise<
|
|
14498
|
+
"signature": "async function cs_listLoyaltyProgramPointHistory(customerStore: IkasCustomerStore, params: ListLoyaltyProgramPointHistoryQueryParams): Promise<IkasLoyaltyProgramPointHistory[] | undefined>",
|
|
14439
14499
|
"description": "",
|
|
14440
14500
|
"params": [],
|
|
14441
|
-
"returnType": "Promise<
|
|
14501
|
+
"returnType": "Promise<IkasLoyaltyProgramPointHistory[] | undefined>",
|
|
14442
14502
|
"categories": [],
|
|
14443
14503
|
"related": [],
|
|
14444
14504
|
"isAsync": true,
|
|
14445
14505
|
"isClass": false,
|
|
14446
14506
|
"parameterTypes": [
|
|
14447
14507
|
"IkasCustomerStore",
|
|
14448
|
-
"
|
|
14508
|
+
"IkasLoyaltyProgramPointHistory"
|
|
14449
14509
|
]
|
|
14450
14510
|
},
|
|
14451
14511
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-
|
|
2
|
+
"generatedAt": "2026-09-01T07:21:40.992Z",
|
|
3
3
|
"types": [
|
|
4
4
|
{
|
|
5
5
|
"name": "TextElementTagTypes",
|
|
@@ -2467,6 +2467,7 @@
|
|
|
2467
2467
|
"findExistingCartItemWithProduct",
|
|
2468
2468
|
"saveCouponCode",
|
|
2469
2469
|
"removeCouponCode",
|
|
2470
|
+
"removeGiftCardLine",
|
|
2470
2471
|
"setCart"
|
|
2471
2472
|
]
|
|
2472
2473
|
},
|
|
@@ -5370,16 +5371,6 @@
|
|
|
5370
5371
|
"type": "number",
|
|
5371
5372
|
"optional": false
|
|
5372
5373
|
},
|
|
5373
|
-
{
|
|
5374
|
-
"name": "baseAmount",
|
|
5375
|
-
"type": "number | null",
|
|
5376
|
-
"optional": false
|
|
5377
|
-
},
|
|
5378
|
-
{
|
|
5379
|
-
"name": "baseQuantity",
|
|
5380
|
-
"type": "number | null",
|
|
5381
|
-
"optional": false
|
|
5382
|
-
},
|
|
5383
5374
|
{
|
|
5384
5375
|
"name": "createdAt",
|
|
5385
5376
|
"type": "any | null",
|
|
@@ -5430,16 +5421,6 @@
|
|
|
5430
5421
|
"type": "string | null",
|
|
5431
5422
|
"optional": false
|
|
5432
5423
|
},
|
|
5433
|
-
{
|
|
5434
|
-
"name": "refundTransactionId",
|
|
5435
|
-
"type": "string | null",
|
|
5436
|
-
"optional": false
|
|
5437
|
-
},
|
|
5438
|
-
{
|
|
5439
|
-
"name": "retroactiveCalculationId",
|
|
5440
|
-
"type": "string | null",
|
|
5441
|
-
"optional": false
|
|
5442
|
-
},
|
|
5443
5424
|
{
|
|
5444
5425
|
"name": "type",
|
|
5445
5426
|
"type": "LoyaltyProgramPointHistoryTypeEnum",
|
|
@@ -5451,39 +5432,6 @@
|
|
|
5451
5432
|
"optional": false
|
|
5452
5433
|
}
|
|
5453
5434
|
],
|
|
5454
|
-
"filePath": "loyalty-program/point-history/index.ts"
|
|
5455
|
-
},
|
|
5456
|
-
{
|
|
5457
|
-
"name": "IkasLoyaltyProgramPointHistoryPaginationResponse",
|
|
5458
|
-
"kind": "type",
|
|
5459
|
-
"domain": "loyalty-program",
|
|
5460
|
-
"properties": [
|
|
5461
|
-
{
|
|
5462
|
-
"name": "count",
|
|
5463
|
-
"type": "number",
|
|
5464
|
-
"optional": false
|
|
5465
|
-
},
|
|
5466
|
-
{
|
|
5467
|
-
"name": "data",
|
|
5468
|
-
"type": "IkasLoyaltyProgramPointHistory[]",
|
|
5469
|
-
"optional": false
|
|
5470
|
-
},
|
|
5471
|
-
{
|
|
5472
|
-
"name": "hasNext",
|
|
5473
|
-
"type": "boolean",
|
|
5474
|
-
"optional": false
|
|
5475
|
-
},
|
|
5476
|
-
{
|
|
5477
|
-
"name": "limit",
|
|
5478
|
-
"type": "number",
|
|
5479
|
-
"optional": false
|
|
5480
|
-
},
|
|
5481
|
-
{
|
|
5482
|
-
"name": "page",
|
|
5483
|
-
"type": "number",
|
|
5484
|
-
"optional": false
|
|
5485
|
-
}
|
|
5486
|
-
],
|
|
5487
5435
|
"filePath": "loyalty-program/point-history/index.ts",
|
|
5488
5436
|
"relatedFunctions": [
|
|
5489
5437
|
"apiListLoyaltyProgramPointHistory",
|
|
@@ -6373,6 +6321,77 @@
|
|
|
6373
6321
|
"hasIkasOrderCustomer"
|
|
6374
6322
|
]
|
|
6375
6323
|
},
|
|
6324
|
+
{
|
|
6325
|
+
"name": "IkasOrderGiftCardLine",
|
|
6326
|
+
"kind": "type",
|
|
6327
|
+
"domain": "order",
|
|
6328
|
+
"properties": [
|
|
6329
|
+
{
|
|
6330
|
+
"name": "id",
|
|
6331
|
+
"type": "string",
|
|
6332
|
+
"optional": false
|
|
6333
|
+
},
|
|
6334
|
+
{
|
|
6335
|
+
"name": "amount",
|
|
6336
|
+
"type": "number",
|
|
6337
|
+
"optional": false
|
|
6338
|
+
},
|
|
6339
|
+
{
|
|
6340
|
+
"name": "code",
|
|
6341
|
+
"type": "string",
|
|
6342
|
+
"optional": false
|
|
6343
|
+
},
|
|
6344
|
+
{
|
|
6345
|
+
"name": "giftCardId",
|
|
6346
|
+
"type": "string",
|
|
6347
|
+
"optional": false
|
|
6348
|
+
},
|
|
6349
|
+
{
|
|
6350
|
+
"name": "type",
|
|
6351
|
+
"type": "IkasGiftCardType | null",
|
|
6352
|
+
"optional": false
|
|
6353
|
+
},
|
|
6354
|
+
{
|
|
6355
|
+
"name": "appliedTransactions",
|
|
6356
|
+
"type": "IkasOrderGiftCardLineAppliedTransaction[]",
|
|
6357
|
+
"optional": false
|
|
6358
|
+
}
|
|
6359
|
+
],
|
|
6360
|
+
"filePath": "order/gift-card-line/index.ts"
|
|
6361
|
+
},
|
|
6362
|
+
{
|
|
6363
|
+
"name": "IkasOrderGiftCardLineAppliedTransaction",
|
|
6364
|
+
"kind": "type",
|
|
6365
|
+
"domain": "order",
|
|
6366
|
+
"properties": [
|
|
6367
|
+
{
|
|
6368
|
+
"name": "id",
|
|
6369
|
+
"type": "string",
|
|
6370
|
+
"optional": false
|
|
6371
|
+
},
|
|
6372
|
+
{
|
|
6373
|
+
"name": "amount",
|
|
6374
|
+
"type": "number",
|
|
6375
|
+
"optional": false
|
|
6376
|
+
},
|
|
6377
|
+
{
|
|
6378
|
+
"name": "type",
|
|
6379
|
+
"type": "IkasTransactionType",
|
|
6380
|
+
"optional": false
|
|
6381
|
+
}
|
|
6382
|
+
],
|
|
6383
|
+
"filePath": "order/gift-card-line/index.ts"
|
|
6384
|
+
},
|
|
6385
|
+
{
|
|
6386
|
+
"name": "IkasGiftCardType",
|
|
6387
|
+
"kind": "type",
|
|
6388
|
+
"domain": "order",
|
|
6389
|
+
"unionValues": [
|
|
6390
|
+
"GIFT_CARD",
|
|
6391
|
+
"STORE_CREDIT"
|
|
6392
|
+
],
|
|
6393
|
+
"filePath": "order/gift-card-line/index.ts"
|
|
6394
|
+
},
|
|
6376
6395
|
{
|
|
6377
6396
|
"name": "IkasOrderGiftPackageLine",
|
|
6378
6397
|
"kind": "type",
|
|
@@ -6464,6 +6483,11 @@
|
|
|
6464
6483
|
"type": "string | null",
|
|
6465
6484
|
"optional": false
|
|
6466
6485
|
},
|
|
6486
|
+
{
|
|
6487
|
+
"name": "giftCardLines",
|
|
6488
|
+
"type": "IkasOrderGiftCardLine[] | null",
|
|
6489
|
+
"optional": false
|
|
6490
|
+
},
|
|
6467
6491
|
{
|
|
6468
6492
|
"name": "giftPackageLines",
|
|
6469
6493
|
"type": "IkasOrderGiftPackageLine[] | null",
|
|
@@ -6577,6 +6601,7 @@
|
|
|
6577
6601
|
],
|
|
6578
6602
|
"filePath": "order/index.ts",
|
|
6579
6603
|
"relatedFunctions": [
|
|
6604
|
+
"getIkasOrderGiftCardTotalPrice",
|
|
6580
6605
|
"getIkasOrderDistinctItemCount",
|
|
6581
6606
|
"getIkasOrderTotalItemCount",
|
|
6582
6607
|
"getIkasOrderDisplayedPackages",
|
package/dist/index.js
CHANGED
|
@@ -1969,7 +1969,7 @@ const server = new McpServer({
|
|
|
1969
1969
|
version: "0.1.0",
|
|
1970
1970
|
}, {
|
|
1971
1971
|
instructions: "Examples and section templates from this server are API reference only — reuse imports, function calls, and data-access patterns; create your own JSX structure, CSS class names, and visual design.\n\n" +
|
|
1972
|
-
"Live-editor actions (require `ikas theme dev` running with the editor connected): `list_editor_pages` → page ids; `list_imported_sections` → imported component ids; `import_section` → import a built component; `add_section_to_page` → place one section (`add_sections_to_page` places MANY at once and can set their props in the same call — fastest way to build a page); `list_page_sections` → the sections placed on a page (LEAN roster: per-placement `elementId`, `componentId`, `propCount`, which props are filled — NO schema/values, so it never truncates); `move_page_section` → reorder a section already placed on a page (by `direction` up/down or an absolute `to_index`) — the only way to change section order, since the editor UI offers it solely as a drag; `get_component_props` → a component's prop blueprint (types, ENUM valid `options`, COMPONENT_LIST `allowedComponentIds`) for any section OR child id; `get_section_values` → one section's current prop values (for read-modify-write); `get_page_by_type` → a theme page id by pageType (e.g. CATEGORY), to build PAGE links to entities (`create_page` adds that page if it does not exist yet, so you never guess a slug); `update_section_prop` → change a single prop value of a placed section (`update_page_sections` fills MANY sections/props of a page in ONE call — strongly prefer it to cut round-trips when filling content); `upload_image` → upload one image (file or URL) and get an image id (`upload_images` uploads many in one call — prefer it for several); `search_products` / `list_categories` / `list_brands` / `list_blogs` / `list_blog_categories` → find real entity ids for PRODUCT/CATEGORY/BRAND/BLOG/BLOG_CATEGORY prop values; `publish_theme` → publish the theme LIVE and get back the preview URL to review (guarded — needs `confirm:true`, and `confirm_production:true` for the main theme; only call it when the user explicitly asks to publish). For the full end-to-end process (placing a section and filling its content, with per-prop value shapes and COMPONENT_LIST rules), call `get_editor_workflow` first.\n\n" +
|
|
1972
|
+
"Live-editor actions (require `ikas theme dev` running with the editor connected): `list_editor_pages` → page ids; `list_imported_sections` → imported component ids; `import_section` → import a built component; `add_section_to_page` → place one section (`add_sections_to_page` places MANY at once and can set their props in the same call — fastest way to build a page); `list_page_sections` → the sections placed on a page (LEAN roster: per-placement `elementId`, `componentId`, `propCount`, which props are filled — NO schema/values, so it never truncates); `move_page_section` → reorder a section already placed on a page (by `direction` up/down or an absolute `to_index`) — the only way to change section order, since the editor UI offers it solely as a drag; `get_component_props` → a component's prop blueprint (types, ENUM valid `options`, COMPONENT_LIST `allowedComponentIds`) for any section OR child id; `get_section_values` → one section's current prop values (for read-modify-write); `get_page_by_type` → a theme page id by pageType (e.g. CATEGORY), to build PAGE links to entities (`create_page` adds that page if it does not exist yet, so you never guess a slug); `update_section_prop` → change a single prop value of a placed section (`update_page_sections` fills MANY sections/props of a page in ONE call — strongly prefer it to cut round-trips when filling content); `upload_image` → upload one image (file or URL) and get an image id (`upload_images` uploads many in one call — prefer it for several); `search_products` / `list_categories` / `list_brands` / `list_blogs` / `list_blog_categories` → find real entity ids for PRODUCT/CATEGORY/BRAND/BLOG/BLOG_CATEGORY prop values; `publish_theme` → publish the theme LIVE and get back the preview URL to review (guarded — needs `confirm:true`, and `confirm_production:true` for the main theme; only call it when the user explicitly asks to publish); `list_builtin_pages` / `update_builtin_page_prop` / `enable_builtin_pages` → the ikas-rendered built-in account/membership pages (login, register, my account, orders, …) — these are NOT sections and the section tools cannot edit them; use these three to enable the groups, read their prop schemas, and brand/localize them. When the user asks to BUILD a login/register/password/my-account/orders/addresses page, FIRST offer these ready-made built-in pages instead of assembling one from sections — they are fully functional out of the box and brandable; build a custom section page only if the user prefers a custom design. Offer, don't flip: `enable_builtin_pages` creates/removes pages, so get the user's explicit OK before calling it. For the full end-to-end process (placing a section and filling its content, with per-prop value shapes and COMPONENT_LIST rules), call `get_editor_workflow` first.\n\n" +
|
|
1973
1973
|
"To CHANGE/EDIT a prop value (text, color, boolean, number, etc.) of a section that is already on a page, this IS supported: call `list_page_sections(page_id)` to get the placement `elementId` and the prop names/ids, then `update_section_prop(page_id, element_id, prop_name|prop_id, value)`. Do not assume prop editing is unavailable.\n\n" +
|
|
1974
1974
|
"TWO DISTINCT JOBS — do not confuse them, and do not jump to writing code for the second one:\n" +
|
|
1975
1975
|
"(A) DEFINING props / authoring a component = changing which props a component HAS. This edits the component source/config (types.ts via `ikas-component config add-prop`/`add-component`, JSX in index.tsx, etc.) and requires a rebuild. Use this ONLY when the needed prop does not exist yet, or the user explicitly asks to build/modify the component's code or prop schema.\n" +
|
|
@@ -4308,6 +4308,129 @@ server.tool("create_page", 'Create a theme page of a given pageType in the conne
|
|
|
4308
4308
|
return callEditorAction(project_root, args);
|
|
4309
4309
|
});
|
|
4310
4310
|
// Tool: publish_theme
|
|
4311
|
+
// Tool: list_builtin_pages
|
|
4312
|
+
server.tool("list_builtin_pages", "List the ikas-rendered BUILT-IN account/membership pages (login, register, forgot/recover password, my account, orders, addresses, favorites, email verification) and how to customize them. These pages are rendered by ikas's own components, NOT by sections: a built-in page carries no sections, so `list_page_sections` shows nothing and `update_section_prop` cannot touch it — `update_builtin_page_prop` is the write tool. Without arguments returns the roster: per-group (`membership` = login/register/password flows, `account` = my-account pages) enabled state, every built-in page type with its theme pageId and which props the merchant already edited, plus the SHARED SCOPES (logo, palette, account-menu labels — values edited once that reach every page in the scope's group). Pass `page_type` (e.g. LOGIN) or `scope_id` for that page's/scope's FULL prop schema (types, defaults, ENUM options, translations) and current values (`values` = what the page renders with; `ownValues` = what this page's own layer stores). Pass `sf_routing_id` to read what one storefront routing/locale sees — the no-argument call lists the store's routings (id, path, locale; `isDefault: true` = the base, needing no sf_routing_id). Typical branding flow: read the theme's palette via `list_theme_globals`, then set the shared scope's colors as `{ \"patternValueId\": \"<global color id>\" }` bindings so the pages follow the theme's colors live.", {
|
|
4313
|
+
project_root: z
|
|
4314
|
+
.string()
|
|
4315
|
+
.describe("Absolute path to the code-component project."),
|
|
4316
|
+
page_type: z
|
|
4317
|
+
.string()
|
|
4318
|
+
.optional()
|
|
4319
|
+
.describe("One built-in page's full prop schema and values (e.g. LOGIN, ACCOUNT, ORDERS)."),
|
|
4320
|
+
scope_id: z
|
|
4321
|
+
.string()
|
|
4322
|
+
.optional()
|
|
4323
|
+
.describe("One shared scope's full prop schema and values (scope ids come from the no-argument call)."),
|
|
4324
|
+
sf_routing_id: z
|
|
4325
|
+
.string()
|
|
4326
|
+
.optional()
|
|
4327
|
+
.describe("Read the values one storefront routing/locale sees (default: the base routing)."),
|
|
4328
|
+
port: z
|
|
4329
|
+
.number()
|
|
4330
|
+
.optional()
|
|
4331
|
+
.describe("Dev server WebSocket port (default 5201)."),
|
|
4332
|
+
}, async ({ project_root, page_type, scope_id, sf_routing_id, port }) => {
|
|
4333
|
+
const args = [
|
|
4334
|
+
"list-builtin-pages",
|
|
4335
|
+
...(page_type ? ["--page-type", page_type] : []),
|
|
4336
|
+
...(scope_id ? ["--scope-id", scope_id] : []),
|
|
4337
|
+
...(sf_routing_id ? ["--sf-routing-id", sf_routing_id] : []),
|
|
4338
|
+
...(port ? ["--port", String(port)] : []),
|
|
4339
|
+
];
|
|
4340
|
+
return callEditorAction(project_root, args);
|
|
4341
|
+
});
|
|
4342
|
+
// Tool: update_builtin_page_prop
|
|
4343
|
+
server.tool("update_builtin_page_prop", 'Set, bind, or clear ONE prop of an ikas-rendered built-in account/membership page — the write half of `list_builtin_pages`, and the ONLY way to customize those pages (they have no sections, so `update_section_prop` cannot reach them). Target a page\'s own prop with `page_type` (e.g. LOGIN) or a SHARED prop — logo, palette, menu labels, edited once for every page in the scope\'s group — with `scope_id`. Identify the prop by `prop_id` or `prop_name` from `list_builtin_pages`. VALUES ARE RAW (no `{ "value": ... }` envelope — an envelope is tolerated and unwrapped): TEXT = the plain string; BOOLEAN = true/false; NUMBER = a number; ENUM = one of the prop\'s `enumOptions` VALUES; COLOR = "#rrggbb" OR `{ "patternValueId": "<global color id>" }` to follow a theme color live (ids from `list_theme_globals` → colors[].id — prefer the binding when branding, so a palette change updates the pages); IMAGE = `{ "id": "<image id>" }` (id from `upload_image`); LINK/LIST_OF_LINK = copy the shape from `list_builtin_pages` values. `bind_global` (a global\'s `name` from `list_theme_globals`) makes the prop follow a Theme Setting instead of holding a value; `clear: true` deletes the stored value so the prop falls back to the shared value or the manifest default. `sf_routing_id` writes one routing\'s override — use it to localize texts per language; without it you write the base value every routing inherits. Writes are undoable in the editor.', {
|
|
4344
|
+
project_root: z
|
|
4345
|
+
.string()
|
|
4346
|
+
.describe("Absolute path to the code-component project."),
|
|
4347
|
+
page_type: z
|
|
4348
|
+
.string()
|
|
4349
|
+
.optional()
|
|
4350
|
+
.describe("Built-in page type whose OWN prop to write (e.g. LOGIN). Pass this or scope_id."),
|
|
4351
|
+
scope_id: z
|
|
4352
|
+
.string()
|
|
4353
|
+
.optional()
|
|
4354
|
+
.describe("Shared scope whose prop to write — reaches every built-in page in its group."),
|
|
4355
|
+
prop_id: z
|
|
4356
|
+
.string()
|
|
4357
|
+
.optional()
|
|
4358
|
+
.describe("Prop id from list_builtin_pages. Provide this or prop_name."),
|
|
4359
|
+
prop_name: z
|
|
4360
|
+
.string()
|
|
4361
|
+
.optional()
|
|
4362
|
+
.describe("Prop name (alternative to prop_id)."),
|
|
4363
|
+
value: z
|
|
4364
|
+
.any()
|
|
4365
|
+
.optional()
|
|
4366
|
+
.describe("The RAW value (see the tool description for per-type shapes). Omit when using bind_global or clear."),
|
|
4367
|
+
bind_global: z
|
|
4368
|
+
.string()
|
|
4369
|
+
.optional()
|
|
4370
|
+
.describe("Bind the prop to a global variable (Theme Setting) — pass the global's `name` from list_theme_globals."),
|
|
4371
|
+
clear: z
|
|
4372
|
+
.boolean()
|
|
4373
|
+
.optional()
|
|
4374
|
+
.describe("true deletes the stored value; the prop falls back to the shared value or the manifest default."),
|
|
4375
|
+
sf_routing_id: z
|
|
4376
|
+
.string()
|
|
4377
|
+
.optional()
|
|
4378
|
+
.describe("Write one storefront routing's override (localization). Omit to write the base value."),
|
|
4379
|
+
port: z
|
|
4380
|
+
.number()
|
|
4381
|
+
.optional()
|
|
4382
|
+
.describe("Dev server WebSocket port (default 5201)."),
|
|
4383
|
+
}, async ({ project_root, page_type, scope_id, prop_id, prop_name, value, bind_global, clear, sf_routing_id, port, }) => {
|
|
4384
|
+
const args = [
|
|
4385
|
+
"update-builtin-page-prop",
|
|
4386
|
+
...(page_type ? ["--page-type", page_type] : []),
|
|
4387
|
+
...(scope_id ? ["--scope-id", scope_id] : []),
|
|
4388
|
+
...(prop_id ? ["--prop-id", prop_id] : []),
|
|
4389
|
+
...(prop_name ? ["--prop-name", prop_name] : []),
|
|
4390
|
+
...(bind_global
|
|
4391
|
+
? ["--bind-global", bind_global]
|
|
4392
|
+
: clear
|
|
4393
|
+
? ["--clear"]
|
|
4394
|
+
: value !== undefined
|
|
4395
|
+
? [
|
|
4396
|
+
"--value",
|
|
4397
|
+
// ALWAYS JSON-encode: the CLI JSON.parses --value (raw-string fallback), so a
|
|
4398
|
+
// verbatim TEXT string that happens to parse — "2024", "true", "null" — would
|
|
4399
|
+
// arrive as a number/boolean/clear. Encoded, it round-trips as the string it is.
|
|
4400
|
+
JSON.stringify(value),
|
|
4401
|
+
]
|
|
4402
|
+
: []),
|
|
4403
|
+
...(sf_routing_id ? ["--sf-routing-id", sf_routing_id] : []),
|
|
4404
|
+
...(port ? ["--port", String(port)] : []),
|
|
4405
|
+
];
|
|
4406
|
+
return callEditorAction(project_root, args);
|
|
4407
|
+
});
|
|
4408
|
+
// Tool: enable_builtin_pages
|
|
4409
|
+
server.tool("enable_builtin_pages", 'Turn one GROUP of ikas-rendered built-in pages on or off: "membership" (login, register, forgot/recover password, email verification) or "account" (my account, orders, order detail, addresses, favorites). Enabling records the choice and creates any page of the group the theme does not have yet — each born rendered by ikas\'s built-in component; customize them right after with `update_builtin_page_prop`. Disabling removes ONLY the untouched pages the toggle itself created — a page the merchant built on is never deleted. The flip is one undo step in the editor. Check the current state first with `list_builtin_pages`.', {
|
|
4410
|
+
project_root: z
|
|
4411
|
+
.string()
|
|
4412
|
+
.describe("Absolute path to the code-component project."),
|
|
4413
|
+
group: z
|
|
4414
|
+
.enum(["membership", "account"])
|
|
4415
|
+
.describe('"membership" = login/register/password flows; "account" = my-account pages.'),
|
|
4416
|
+
enabled: z
|
|
4417
|
+
.boolean()
|
|
4418
|
+
.describe("true to enable the group, false to disable it."),
|
|
4419
|
+
port: z
|
|
4420
|
+
.number()
|
|
4421
|
+
.optional()
|
|
4422
|
+
.describe("Dev server WebSocket port (default 5201)."),
|
|
4423
|
+
}, async ({ project_root, group, enabled, port }) => {
|
|
4424
|
+
const args = [
|
|
4425
|
+
"enable-builtin-pages",
|
|
4426
|
+
"--group",
|
|
4427
|
+
group,
|
|
4428
|
+
"--enabled",
|
|
4429
|
+
String(enabled),
|
|
4430
|
+
...(port ? ["--port", String(port)] : []),
|
|
4431
|
+
];
|
|
4432
|
+
return callEditorAction(project_root, args);
|
|
4433
|
+
});
|
|
4311
4434
|
server.tool("publish_theme", "Publish the current theme LIVE — the same action as the editor's Publish button (uploads the whole project to the storefront). This is REAL and customer-facing: the published site changes. SAFETY: it publishes nothing unless `confirm: true` is passed; if you omit it you get a dry-run with the `previewUrl` and a warning describing the impact. The MAIN/production theme additionally requires `confirm_production: true` (its URL is the live customer-facing domain). Use this when the user explicitly asks to publish/go live — do NOT publish on your own initiative. On success returns `{ published: true, previewUrl, isMainTheme }`; open `previewUrl` to review the result. Requires `ikas theme dev` running with the editor connected.", {
|
|
4312
4435
|
project_root: z
|
|
4313
4436
|
.string()
|