@ikas/code-components-mcp 1.4.0-beta.12 → 1.4.0-beta.14
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/framework.json +1 -1
- package/data/storefront-api.json +101 -1394
- package/data/storefront-types.json +31 -124
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-
|
|
2
|
+
"generatedAt": "2026-06-02T17:14:56.583Z",
|
|
3
3
|
"types": [
|
|
4
4
|
{
|
|
5
5
|
"name": "IkasProductAttributeDetail",
|
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
],
|
|
120
120
|
"filePath": "blog/category/index.ts",
|
|
121
121
|
"relatedFunctions": [
|
|
122
|
-
"apiListBlogCategory",
|
|
123
122
|
"getIkasBlogCategoryHref"
|
|
124
123
|
]
|
|
125
124
|
},
|
|
@@ -259,7 +258,6 @@
|
|
|
259
258
|
],
|
|
260
259
|
"filePath": "blog/index.ts",
|
|
261
260
|
"relatedFunctions": [
|
|
262
|
-
"apiListBlog",
|
|
263
261
|
"getIkasBlogHref",
|
|
264
262
|
"getIkasBlogFormattedDate"
|
|
265
263
|
]
|
|
@@ -325,10 +323,7 @@
|
|
|
325
323
|
"optional": true
|
|
326
324
|
}
|
|
327
325
|
],
|
|
328
|
-
"filePath": "blog/meta-data/index.ts"
|
|
329
|
-
"relatedFunctions": [
|
|
330
|
-
"apiListBlogMetaData"
|
|
331
|
-
]
|
|
326
|
+
"filePath": "blog/meta-data/index.ts"
|
|
332
327
|
},
|
|
333
328
|
{
|
|
334
329
|
"name": "IkasBlogTag",
|
|
@@ -1014,11 +1009,6 @@
|
|
|
1014
1009
|
],
|
|
1015
1010
|
"filePath": "cart/index.ts",
|
|
1016
1011
|
"relatedFunctions": [
|
|
1017
|
-
"apiGetCartById",
|
|
1018
|
-
"apiSaveCart",
|
|
1019
|
-
"apiSaveCartCouponCode",
|
|
1020
|
-
"apiAddItemToCart",
|
|
1021
|
-
"apiUpdateCartCampaignOffer",
|
|
1022
1012
|
"changeCartItemQuantity",
|
|
1023
1013
|
"isOrderLineItemAutoCreated",
|
|
1024
1014
|
"findExistingCartItem",
|
|
@@ -1440,7 +1430,6 @@
|
|
|
1440
1430
|
],
|
|
1441
1431
|
"filePath": "checkout-settings/index.ts",
|
|
1442
1432
|
"relatedFunctions": [
|
|
1443
|
-
"apiListCheckoutSettings",
|
|
1444
1433
|
"getCustomerAddressValidationResult",
|
|
1445
1434
|
"isValidCustomerAddress",
|
|
1446
1435
|
"getOrderAddressValidationResult",
|
|
@@ -1554,10 +1543,7 @@
|
|
|
1554
1543
|
"optional": false
|
|
1555
1544
|
}
|
|
1556
1545
|
],
|
|
1557
|
-
"filePath": "city/index.ts"
|
|
1558
|
-
"relatedFunctions": [
|
|
1559
|
-
"apiListCity"
|
|
1560
|
-
]
|
|
1546
|
+
"filePath": "city/index.ts"
|
|
1561
1547
|
},
|
|
1562
1548
|
{
|
|
1563
1549
|
"name": "IkasContactForm",
|
|
@@ -1683,10 +1669,7 @@
|
|
|
1683
1669
|
"optional": false
|
|
1684
1670
|
}
|
|
1685
1671
|
],
|
|
1686
|
-
"filePath": "country/index.ts"
|
|
1687
|
-
"relatedFunctions": [
|
|
1688
|
-
"apiListCountry"
|
|
1689
|
-
]
|
|
1672
|
+
"filePath": "country/index.ts"
|
|
1690
1673
|
},
|
|
1691
1674
|
{
|
|
1692
1675
|
"name": "IkasCustomerAddressCity",
|
|
@@ -1990,7 +1973,6 @@
|
|
|
1990
1973
|
],
|
|
1991
1974
|
"filePath": "customer/attribute/index.ts",
|
|
1992
1975
|
"relatedFunctions": [
|
|
1993
|
-
"apiListCustomerAttribute",
|
|
1994
1976
|
"getCustomerAttributeAccountPagePermission",
|
|
1995
1977
|
"getCustomerAttributeRegisterPageRequirement",
|
|
1996
1978
|
"getCustomerAttributes"
|
|
@@ -2319,12 +2301,6 @@
|
|
|
2319
2301
|
],
|
|
2320
2302
|
"filePath": "customer/index.ts",
|
|
2321
2303
|
"relatedFunctions": [
|
|
2322
|
-
"apiLogin",
|
|
2323
|
-
"apiSocialLogin",
|
|
2324
|
-
"apiRegister",
|
|
2325
|
-
"apiGetCustomer",
|
|
2326
|
-
"apiSaveCustomer",
|
|
2327
|
-
"apiValidateOTPCode",
|
|
2328
2304
|
"isCustomerSubscribed",
|
|
2329
2305
|
"getCustomerBasicInfo",
|
|
2330
2306
|
"saveCustomer"
|
|
@@ -2489,8 +2465,6 @@
|
|
|
2489
2465
|
],
|
|
2490
2466
|
"filePath": "customer/review/index.ts",
|
|
2491
2467
|
"relatedFunctions": [
|
|
2492
|
-
"apiCreateCustomerReview",
|
|
2493
|
-
"apiListCustomerReviews",
|
|
2494
2468
|
"getIkasCustomerReviewFormattedDate",
|
|
2495
2469
|
"sendReview"
|
|
2496
2470
|
]
|
|
@@ -2559,10 +2533,7 @@
|
|
|
2559
2533
|
"optional": false
|
|
2560
2534
|
}
|
|
2561
2535
|
],
|
|
2562
|
-
"filePath": "customer/review/summary/index.ts"
|
|
2563
|
-
"relatedFunctions": [
|
|
2564
|
-
"apiListCustomerReviewSummary"
|
|
2565
|
-
]
|
|
2536
|
+
"filePath": "customer/review/summary/index.ts"
|
|
2566
2537
|
},
|
|
2567
2538
|
{
|
|
2568
2539
|
"name": "IkasCustomerReviewSummaryStar",
|
|
@@ -2857,10 +2828,7 @@
|
|
|
2857
2828
|
"optional": false
|
|
2858
2829
|
}
|
|
2859
2830
|
],
|
|
2860
|
-
"filePath": "customer-settings/index.ts"
|
|
2861
|
-
"relatedFunctions": [
|
|
2862
|
-
"apiListCustomerSettings"
|
|
2863
|
-
]
|
|
2831
|
+
"filePath": "customer-settings/index.ts"
|
|
2864
2832
|
},
|
|
2865
2833
|
{
|
|
2866
2834
|
"name": "IkasDistrict",
|
|
@@ -2923,10 +2891,7 @@
|
|
|
2923
2891
|
"optional": false
|
|
2924
2892
|
}
|
|
2925
2893
|
],
|
|
2926
|
-
"filePath": "district/index.ts"
|
|
2927
|
-
"relatedFunctions": [
|
|
2928
|
-
"apiListDistrict"
|
|
2929
|
-
]
|
|
2894
|
+
"filePath": "district/index.ts"
|
|
2930
2895
|
},
|
|
2931
2896
|
{
|
|
2932
2897
|
"name": "IkasFavoriteProduct",
|
|
@@ -2974,10 +2939,7 @@
|
|
|
2974
2939
|
"optional": false
|
|
2975
2940
|
}
|
|
2976
2941
|
],
|
|
2977
|
-
"filePath": "favorite-product/index.ts"
|
|
2978
|
-
"relatedFunctions": [
|
|
2979
|
-
"apiListFavoriteProducts"
|
|
2980
|
-
]
|
|
2942
|
+
"filePath": "favorite-product/index.ts"
|
|
2981
2943
|
},
|
|
2982
2944
|
{
|
|
2983
2945
|
"name": "IkasFilterCategory",
|
|
@@ -3027,7 +2989,6 @@
|
|
|
3027
2989
|
],
|
|
3028
2990
|
"filePath": "filter-category/index.ts",
|
|
3029
2991
|
"relatedFunctions": [
|
|
3030
|
-
"apiGetProductFilterData",
|
|
3031
2992
|
"getIkasFilterCategoryHref",
|
|
3032
2993
|
"getIkasFilterCategorySlug",
|
|
3033
2994
|
"getProductListFilterCategories",
|
|
@@ -3100,10 +3061,7 @@
|
|
|
3100
3061
|
"optional": true
|
|
3101
3062
|
}
|
|
3102
3063
|
],
|
|
3103
|
-
"filePath": "html-meta-data/index.ts"
|
|
3104
|
-
"relatedFunctions": [
|
|
3105
|
-
"apiListHTMLMetaData"
|
|
3106
|
-
]
|
|
3064
|
+
"filePath": "html-meta-data/index.ts"
|
|
3107
3065
|
},
|
|
3108
3066
|
{
|
|
3109
3067
|
"name": "IkasHTMLMetaDataOverride",
|
|
@@ -3307,7 +3265,10 @@
|
|
|
3307
3265
|
"optional": false
|
|
3308
3266
|
}
|
|
3309
3267
|
],
|
|
3310
|
-
"filePath": "language-option/index.ts"
|
|
3268
|
+
"filePath": "language-option/index.ts",
|
|
3269
|
+
"relatedFunctions": [
|
|
3270
|
+
"setLanguage"
|
|
3271
|
+
]
|
|
3311
3272
|
},
|
|
3312
3273
|
{
|
|
3313
3274
|
"name": "IkasLastViewedProduct",
|
|
@@ -3325,10 +3286,7 @@
|
|
|
3325
3286
|
"optional": false
|
|
3326
3287
|
}
|
|
3327
3288
|
],
|
|
3328
|
-
"filePath": "last-viewed-product/index.ts"
|
|
3329
|
-
"relatedFunctions": [
|
|
3330
|
-
"apiGetLastViewedProducts"
|
|
3331
|
-
]
|
|
3289
|
+
"filePath": "last-viewed-product/index.ts"
|
|
3332
3290
|
},
|
|
3333
3291
|
{
|
|
3334
3292
|
"name": "IkasLocaleOption",
|
|
@@ -3366,7 +3324,10 @@
|
|
|
3366
3324
|
"optional": false
|
|
3367
3325
|
}
|
|
3368
3326
|
],
|
|
3369
|
-
"filePath": "locale-option/index.ts"
|
|
3327
|
+
"filePath": "locale-option/index.ts",
|
|
3328
|
+
"relatedFunctions": [
|
|
3329
|
+
"setLocalization"
|
|
3330
|
+
]
|
|
3370
3331
|
},
|
|
3371
3332
|
{
|
|
3372
3333
|
"name": "IkasLocationTranslations",
|
|
@@ -4141,10 +4102,7 @@
|
|
|
4141
4102
|
"optional": true
|
|
4142
4103
|
}
|
|
4143
4104
|
],
|
|
4144
|
-
"filePath": "merchant-settings/index.ts"
|
|
4145
|
-
"relatedFunctions": [
|
|
4146
|
-
"apiListMerchantSettings"
|
|
4147
|
-
]
|
|
4105
|
+
"filePath": "merchant-settings/index.ts"
|
|
4148
4106
|
},
|
|
4149
4107
|
{
|
|
4150
4108
|
"name": "IkasMerchantSettingsCurrencyFormat",
|
|
@@ -4838,9 +4796,6 @@
|
|
|
4838
4796
|
],
|
|
4839
4797
|
"filePath": "order/index.ts",
|
|
4840
4798
|
"relatedFunctions": [
|
|
4841
|
-
"apiGetOrders",
|
|
4842
|
-
"apiGetOrderByEmail",
|
|
4843
|
-
"apiCreateOrderRefundRequest",
|
|
4844
4799
|
"getIkasOrderDistinctItemCount",
|
|
4845
4800
|
"getIkasOrderTotalItemCount",
|
|
4846
4801
|
"getIkasOrderDisplayedPackages",
|
|
@@ -4866,7 +4821,6 @@
|
|
|
4866
4821
|
"getIkasOrderDisplayedAdjustments",
|
|
4867
4822
|
"getIkasOrderHref",
|
|
4868
4823
|
"getIkasOrderVariantNames",
|
|
4869
|
-
"getOrderPackageOrderLineItems",
|
|
4870
4824
|
"submitOrderTrackingForm",
|
|
4871
4825
|
"refundOrder",
|
|
4872
4826
|
"getOrders",
|
|
@@ -5165,7 +5119,6 @@
|
|
|
5165
5119
|
"getOrderLineItemRefundQuantity",
|
|
5166
5120
|
"setOrderLineItemRefundQuantity",
|
|
5167
5121
|
"editOrderLineItem",
|
|
5168
|
-
"getOrderPackageOrderLineItems",
|
|
5169
5122
|
"changeItemQuantity",
|
|
5170
5123
|
"changeCartItemQuantity",
|
|
5171
5124
|
"isOrderLineItemAutoCreated",
|
|
@@ -5755,10 +5708,7 @@
|
|
|
5755
5708
|
"optional": false
|
|
5756
5709
|
}
|
|
5757
5710
|
],
|
|
5758
|
-
"filePath": "order/package/index.ts"
|
|
5759
|
-
"relatedFunctions": [
|
|
5760
|
-
"getOrderPackageOrderLineItems"
|
|
5761
|
-
]
|
|
5711
|
+
"filePath": "order/package/index.ts"
|
|
5762
5712
|
},
|
|
5763
5713
|
{
|
|
5764
5714
|
"name": "IkasDisplayedPackage",
|
|
@@ -5959,10 +5909,7 @@
|
|
|
5959
5909
|
"optional": false
|
|
5960
5910
|
}
|
|
5961
5911
|
],
|
|
5962
|
-
"filePath": "order/refund/settings/index.ts"
|
|
5963
|
-
"relatedFunctions": [
|
|
5964
|
-
"apiListOrderRefundSettings"
|
|
5965
|
-
]
|
|
5912
|
+
"filePath": "order/refund/settings/index.ts"
|
|
5966
5913
|
},
|
|
5967
5914
|
{
|
|
5968
5915
|
"name": "IkasOrderShippingLine",
|
|
@@ -6159,7 +6106,6 @@
|
|
|
6159
6106
|
],
|
|
6160
6107
|
"filePath": "order/transaction/index.ts",
|
|
6161
6108
|
"relatedFunctions": [
|
|
6162
|
-
"apiListOrderTransactions",
|
|
6163
6109
|
"getOrderTransactionFormattedAmount",
|
|
6164
6110
|
"getOrderTransactionPaymentMethodTranslation",
|
|
6165
6111
|
"getOrderTransactions"
|
|
@@ -6382,7 +6328,6 @@
|
|
|
6382
6328
|
],
|
|
6383
6329
|
"filePath": "payment-gateway/index.ts",
|
|
6384
6330
|
"relatedFunctions": [
|
|
6385
|
-
"apiListPaymentGateway",
|
|
6386
6331
|
"getCheckoutTotalFinalPrice",
|
|
6387
6332
|
"getPaymentGatewayCalculatedAdditionalPrices"
|
|
6388
6333
|
]
|
|
@@ -6497,10 +6442,7 @@
|
|
|
6497
6442
|
"optional": true
|
|
6498
6443
|
}
|
|
6499
6444
|
],
|
|
6500
|
-
"filePath": "product/attribute/index.ts"
|
|
6501
|
-
"relatedFunctions": [
|
|
6502
|
-
"apiListProductAttribute"
|
|
6503
|
-
]
|
|
6445
|
+
"filePath": "product/attribute/index.ts"
|
|
6504
6446
|
},
|
|
6505
6447
|
{
|
|
6506
6448
|
"name": "IkasProductAttributeOption",
|
|
@@ -6893,7 +6835,6 @@
|
|
|
6893
6835
|
],
|
|
6894
6836
|
"filePath": "product/campaign/index.ts",
|
|
6895
6837
|
"relatedFunctions": [
|
|
6896
|
-
"apiGetProductCampaigns",
|
|
6897
6838
|
"getProductCampaigns"
|
|
6898
6839
|
]
|
|
6899
6840
|
},
|
|
@@ -7094,7 +7035,6 @@
|
|
|
7094
7035
|
"isAcceptedProductOffer",
|
|
7095
7036
|
"acceptProductOffer",
|
|
7096
7037
|
"rejectProductOffer",
|
|
7097
|
-
"isProductOfferAccepted",
|
|
7098
7038
|
"changeItemQuantity",
|
|
7099
7039
|
"changeCartItemQuantity",
|
|
7100
7040
|
"getAcceptedOffers"
|
|
@@ -7183,7 +7123,6 @@
|
|
|
7183
7123
|
],
|
|
7184
7124
|
"filePath": "product/filter/index.ts",
|
|
7185
7125
|
"relatedFunctions": [
|
|
7186
|
-
"apiGetProductFilterData",
|
|
7187
7126
|
"isCustomValueFilter",
|
|
7188
7127
|
"isBoxFilter",
|
|
7189
7128
|
"isListFilter",
|
|
@@ -7732,9 +7671,6 @@
|
|
|
7732
7671
|
"filePath": "product/index.ts",
|
|
7733
7672
|
"relatedFunctions": [
|
|
7734
7673
|
"apiSearchProducts",
|
|
7735
|
-
"apiGetRelatedProducts",
|
|
7736
|
-
"apiGetSuggestedProducts",
|
|
7737
|
-
"apiListProductOptionSet",
|
|
7738
7674
|
"getProductCustomerReviews",
|
|
7739
7675
|
"getIkasProductAttributeProducts",
|
|
7740
7676
|
"hasProductVariant",
|
|
@@ -8025,7 +7961,6 @@
|
|
|
8025
7961
|
],
|
|
8026
7962
|
"filePath": "product/option-set/index.ts",
|
|
8027
7963
|
"relatedFunctions": [
|
|
8028
|
-
"apiListProductOptionSet",
|
|
8029
7964
|
"initProductOptionSet",
|
|
8030
7965
|
"setChildOptions",
|
|
8031
7966
|
"initOptionValues",
|
|
@@ -8448,9 +8383,7 @@
|
|
|
8448
8383
|
],
|
|
8449
8384
|
"filePath": "product/stock-location/index.ts",
|
|
8450
8385
|
"relatedFunctions": [
|
|
8451
|
-
"
|
|
8452
|
-
"getProductAvailableStockLocations",
|
|
8453
|
-
"getStockLocationFullAddressText"
|
|
8386
|
+
"getProductAvailableStockLocations"
|
|
8454
8387
|
]
|
|
8455
8388
|
},
|
|
8456
8389
|
{
|
|
@@ -9289,10 +9222,7 @@
|
|
|
9289
9222
|
"optional": false
|
|
9290
9223
|
}
|
|
9291
9224
|
],
|
|
9292
|
-
"filePath": "product-option-file/index.ts"
|
|
9293
|
-
"relatedFunctions": [
|
|
9294
|
-
"apiUploadFile"
|
|
9295
|
-
]
|
|
9225
|
+
"filePath": "product-option-file/index.ts"
|
|
9296
9226
|
},
|
|
9297
9227
|
{
|
|
9298
9228
|
"name": "IkasRaffleDateRangeField",
|
|
@@ -9380,7 +9310,6 @@
|
|
|
9380
9310
|
],
|
|
9381
9311
|
"filePath": "raffle/index.ts",
|
|
9382
9312
|
"relatedFunctions": [
|
|
9383
|
-
"apiListStorefrontRaffle",
|
|
9384
9313
|
"isRaffleAvailable"
|
|
9385
9314
|
]
|
|
9386
9315
|
},
|
|
@@ -9445,10 +9374,7 @@
|
|
|
9445
9374
|
"optional": false
|
|
9446
9375
|
}
|
|
9447
9376
|
],
|
|
9448
|
-
"filePath": "raffle/index.ts"
|
|
9449
|
-
"relatedFunctions": [
|
|
9450
|
-
"apiListRaffleMetaData"
|
|
9451
|
-
]
|
|
9377
|
+
"filePath": "raffle/index.ts"
|
|
9452
9378
|
},
|
|
9453
9379
|
{
|
|
9454
9380
|
"name": "IkasRaffleParticipant",
|
|
@@ -9541,11 +9467,7 @@
|
|
|
9541
9467
|
"optional": false
|
|
9542
9468
|
}
|
|
9543
9469
|
],
|
|
9544
|
-
"filePath": "raffle/index.ts"
|
|
9545
|
-
"relatedFunctions": [
|
|
9546
|
-
"apiSaveRaffleParticipant",
|
|
9547
|
-
"apiListRaffleParticipants"
|
|
9548
|
-
]
|
|
9470
|
+
"filePath": "raffle/index.ts"
|
|
9549
9471
|
},
|
|
9550
9472
|
{
|
|
9551
9473
|
"name": "IkasRaffleAppliedProduct",
|
|
@@ -9733,10 +9655,7 @@
|
|
|
9733
9655
|
"optional": false
|
|
9734
9656
|
}
|
|
9735
9657
|
],
|
|
9736
|
-
"filePath": "shipping-zone/index.ts"
|
|
9737
|
-
"relatedFunctions": [
|
|
9738
|
-
"apiGetAvailableShippingZones"
|
|
9739
|
-
]
|
|
9658
|
+
"filePath": "shipping-zone/index.ts"
|
|
9740
9659
|
},
|
|
9741
9660
|
{
|
|
9742
9661
|
"name": "IkasShippingZoneDistrict",
|
|
@@ -9891,10 +9810,7 @@
|
|
|
9891
9810
|
"optional": false
|
|
9892
9811
|
}
|
|
9893
9812
|
],
|
|
9894
|
-
"filePath": "state/index.ts"
|
|
9895
|
-
"relatedFunctions": [
|
|
9896
|
-
"apiListState"
|
|
9897
|
-
]
|
|
9813
|
+
"filePath": "state/index.ts"
|
|
9898
9814
|
},
|
|
9899
9815
|
{
|
|
9900
9816
|
"name": "IkasStockLocationAddressCity",
|
|
@@ -10067,10 +9983,7 @@
|
|
|
10067
9983
|
"optional": false
|
|
10068
9984
|
}
|
|
10069
9985
|
],
|
|
10070
|
-
"filePath": "stock-location/available/index.ts"
|
|
10071
|
-
"relatedFunctions": [
|
|
10072
|
-
"apiGetAvailableStockLocations"
|
|
10073
|
-
]
|
|
9986
|
+
"filePath": "stock-location/available/index.ts"
|
|
10074
9987
|
},
|
|
10075
9988
|
{
|
|
10076
9989
|
"name": "IkasStockLocation",
|
|
@@ -10118,10 +10031,7 @@
|
|
|
10118
10031
|
"optional": false
|
|
10119
10032
|
}
|
|
10120
10033
|
],
|
|
10121
|
-
"filePath": "stock-location/index.ts"
|
|
10122
|
-
"relatedFunctions": [
|
|
10123
|
-
"apiListStockLocations"
|
|
10124
|
-
]
|
|
10034
|
+
"filePath": "stock-location/index.ts"
|
|
10125
10035
|
},
|
|
10126
10036
|
{
|
|
10127
10037
|
"name": "IkasStorefrontB2BSettings",
|
|
@@ -10553,10 +10463,7 @@
|
|
|
10553
10463
|
"optional": false
|
|
10554
10464
|
}
|
|
10555
10465
|
],
|
|
10556
|
-
"filePath": "storefront/settings/index.ts"
|
|
10557
|
-
"relatedFunctions": [
|
|
10558
|
-
"apiGetStorefrontSettings"
|
|
10559
|
-
]
|
|
10466
|
+
"filePath": "storefront/settings/index.ts"
|
|
10560
10467
|
},
|
|
10561
10468
|
{
|
|
10562
10469
|
"name": "IkasStorefrontTheme",
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { execFile } from "child_process";
|
|
4
5
|
import * as fs from "fs";
|
|
6
|
+
import * as os from "os";
|
|
5
7
|
import * as path from "path";
|
|
6
8
|
import { fileURLToPath } from "url";
|
|
7
9
|
import { z } from "zod";
|
|
@@ -3015,6 +3017,130 @@ server.tool("get_section_migration_plan", "Returns concrete CLI commands and pro
|
|
|
3015
3017
|
};
|
|
3016
3018
|
}
|
|
3017
3019
|
});
|
|
3020
|
+
// =============================================================================
|
|
3021
|
+
// Editor-action tools — drive the connected editor over the dev server's WS
|
|
3022
|
+
// (port 5201) by shelling out to `ikas-component <cmd>`. The CLI is the
|
|
3023
|
+
// canonical implementation; these tools are thin advertisements for the LLM.
|
|
3024
|
+
// =============================================================================
|
|
3025
|
+
function resolveIkasComponentBinary(projectRoot) {
|
|
3026
|
+
if (!path.isAbsolute(projectRoot)) {
|
|
3027
|
+
throw new Error(`project_root must be absolute: ${projectRoot}`);
|
|
3028
|
+
}
|
|
3029
|
+
if (!fs.existsSync(projectRoot) || !fs.statSync(projectRoot).isDirectory()) {
|
|
3030
|
+
throw new Error(`project_root is not a directory: ${projectRoot}`);
|
|
3031
|
+
}
|
|
3032
|
+
const binDir = path.join(projectRoot, "node_modules", ".bin");
|
|
3033
|
+
const candidates = os.platform() === "win32"
|
|
3034
|
+
? ["ikas-component.cmd", "ikas-component.exe", "ikas-component"]
|
|
3035
|
+
: ["ikas-component"];
|
|
3036
|
+
for (const name of candidates) {
|
|
3037
|
+
const full = path.join(binDir, name);
|
|
3038
|
+
if (fs.existsSync(full))
|
|
3039
|
+
return full;
|
|
3040
|
+
}
|
|
3041
|
+
throw new Error(`ikas-component CLI not found at ${binDir}. Run \`npm install\` (or \`pnpm install\`) in ${projectRoot} first.`);
|
|
3042
|
+
}
|
|
3043
|
+
async function runIkasComponentCli(projectRoot, args) {
|
|
3044
|
+
const bin = resolveIkasComponentBinary(projectRoot);
|
|
3045
|
+
return new Promise((resolve) => {
|
|
3046
|
+
execFile(bin, args, { cwd: projectRoot, windowsHide: true }, (err, stdout, stderr) => {
|
|
3047
|
+
const exitCode = err && typeof err.code === "number"
|
|
3048
|
+
? err.code
|
|
3049
|
+
: err
|
|
3050
|
+
? 1
|
|
3051
|
+
: 0;
|
|
3052
|
+
resolve({ stdout: stdout?.toString() ?? "", stderr: stderr?.toString() ?? "", exitCode });
|
|
3053
|
+
});
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
function parseCliJson(stdout) {
|
|
3057
|
+
const trimmed = stdout.trim();
|
|
3058
|
+
if (!trimmed)
|
|
3059
|
+
return null;
|
|
3060
|
+
// CLI prints exactly one JSON object on stdout; if multiple lines appeared
|
|
3061
|
+
// (e.g., warnings on stderr leaked), take the last non-empty line.
|
|
3062
|
+
const last = trimmed.split("\n").map(l => l.trim()).filter(Boolean).pop();
|
|
3063
|
+
if (!last)
|
|
3064
|
+
return null;
|
|
3065
|
+
try {
|
|
3066
|
+
return JSON.parse(last);
|
|
3067
|
+
}
|
|
3068
|
+
catch {
|
|
3069
|
+
return null;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
async function callEditorAction(projectRoot, args) {
|
|
3073
|
+
try {
|
|
3074
|
+
const { stdout, stderr, exitCode } = await runIkasComponentCli(projectRoot, args);
|
|
3075
|
+
const parsed = parseCliJson(stdout);
|
|
3076
|
+
if (parsed) {
|
|
3077
|
+
return { content: [{ type: "text", text: JSON.stringify(parsed, null, 2) }] };
|
|
3078
|
+
}
|
|
3079
|
+
return {
|
|
3080
|
+
content: [
|
|
3081
|
+
{
|
|
3082
|
+
type: "text",
|
|
3083
|
+
text: `CLI exited with code ${exitCode} and produced no parseable JSON.\n` +
|
|
3084
|
+
`stdout:\n${stdout || "(empty)"}\nstderr:\n${stderr || "(empty)"}`,
|
|
3085
|
+
},
|
|
3086
|
+
],
|
|
3087
|
+
};
|
|
3088
|
+
}
|
|
3089
|
+
catch (err) {
|
|
3090
|
+
return {
|
|
3091
|
+
content: [
|
|
3092
|
+
{
|
|
3093
|
+
type: "text",
|
|
3094
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
3095
|
+
},
|
|
3096
|
+
],
|
|
3097
|
+
};
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
// Tool: list_editor_pages
|
|
3101
|
+
server.tool("list_editor_pages", "List pages in the connected editor's project. Returns id, name, pageType, slug for each page. Requires `ikas-component dev` to be running with the editor connected. Use the returned `id`s as the `pageId` argument to `add_section_to_page`.", {
|
|
3102
|
+
project_root: z.string().describe("Absolute path to the code-component project (where `node_modules/.bin/ikas-component` lives)."),
|
|
3103
|
+
port: z.number().optional().describe("Dev server WebSocket port (default 5201)."),
|
|
3104
|
+
}, async ({ project_root, port }) => {
|
|
3105
|
+
const args = ["list-pages", ...(port ? ["--port", String(port)] : [])];
|
|
3106
|
+
return callEditorAction(project_root, args);
|
|
3107
|
+
});
|
|
3108
|
+
// Tool: list_imported_sections
|
|
3109
|
+
server.tool("list_imported_sections", "List section-type code components already imported into the editor's project (theme.codeComponents, filtered to type=section). Use to confirm a component is ready to be placed on a page. The component must be built (`ikas-component build`/`dev`) and imported (`import_section`) before it can be added to a page. The returned `id` is the editor's id for the imported component — normally identical to the id in `ikas.config.json`, but it can differ if the dev component was deleted and re-scaffolded after a previous import. Always use the `id` from this tool, not from `ikas.config.json`, when calling `add_section_to_page`.", {
|
|
3110
|
+
project_root: z.string().describe("Absolute path to the code-component project."),
|
|
3111
|
+
port: z.number().optional().describe("Dev server WebSocket port (default 5201)."),
|
|
3112
|
+
}, async ({ project_root, port }) => {
|
|
3113
|
+
const args = ["list-imported", "--sections-only", ...(port ? ["--port", String(port)] : [])];
|
|
3114
|
+
return callEditorAction(project_root, args);
|
|
3115
|
+
});
|
|
3116
|
+
// Tool: import_section
|
|
3117
|
+
server.tool("import_section", "Import a built section-type code component into the editor's project. This copies the compiled JS/CSS/props into `theme.codeComponents` and auto-creates the wrapper section needed to place it on a page. Idempotent: re-running updates the existing entry in place. Required before `add_section_to_page`. The component must have been built (`ikas-component build`/`dev`).", {
|
|
3118
|
+
project_root: z.string().describe("Absolute path to the code-component project."),
|
|
3119
|
+
component_id: z.string().describe("Component id from `ikas.config.json` (strict — no name resolution)."),
|
|
3120
|
+
port: z.number().optional().describe("Dev server WebSocket port (default 5201)."),
|
|
3121
|
+
}, async ({ project_root, component_id, port }) => {
|
|
3122
|
+
const args = ["import", "--id", component_id, ...(port ? ["--port", String(port)] : [])];
|
|
3123
|
+
return callEditorAction(project_root, args);
|
|
3124
|
+
});
|
|
3125
|
+
// Tool: add_section_to_page
|
|
3126
|
+
server.tool("add_section_to_page", "Place an already-imported section-type code component on a page in the editor. Equivalent to right-clicking the section in the dev-components panel and choosing \"Add to Page\". Errors if the component is not imported, is not section-type, or the page id is unknown. Use `list_editor_pages` to discover page ids and `list_imported_sections` to discover component ids.", {
|
|
3127
|
+
project_root: z.string().describe("Absolute path to the code-component project."),
|
|
3128
|
+
component_id: z.string().describe("Imported code component id from `list_imported_sections` — NOT the id in `ikas.config.json` (the two are usually the same but can diverge after a rescaffold)."),
|
|
3129
|
+
page_id: z.string().describe("Target page id (from `list_editor_pages`)."),
|
|
3130
|
+
index: z.number().int().nonnegative().optional().describe("Zero-based insertion index in the page; appends when omitted."),
|
|
3131
|
+
port: z.number().optional().describe("Dev server WebSocket port (default 5201)."),
|
|
3132
|
+
}, async ({ project_root, component_id, page_id, index, port }) => {
|
|
3133
|
+
const args = [
|
|
3134
|
+
"add-to-page",
|
|
3135
|
+
"--component-id",
|
|
3136
|
+
component_id,
|
|
3137
|
+
"--page-id",
|
|
3138
|
+
page_id,
|
|
3139
|
+
...(typeof index === "number" ? ["--index", String(index)] : []),
|
|
3140
|
+
...(port ? ["--port", String(port)] : []),
|
|
3141
|
+
];
|
|
3142
|
+
return callEditorAction(project_root, args);
|
|
3143
|
+
});
|
|
3018
3144
|
// --- Start server ---
|
|
3019
3145
|
async function main() {
|
|
3020
3146
|
const transport = new StdioServerTransport();
|