@lexq/cli 0.1.11 → 0.1.13
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/LICENSE +191 -0
- package/dist/index.js +299 -413
- package/dist/mcp/register.js +35 -53
- package/package.json +2 -1
package/dist/mcp/register.js
CHANGED
|
@@ -87,8 +87,7 @@ function registerGroupTools(server, callApi) {
|
|
|
87
87
|
if (args.conflictResolutionStrategy !== void 0)
|
|
88
88
|
body.conflictResolutionStrategy = args.conflictResolutionStrategy;
|
|
89
89
|
if (args.maxSelections !== void 0) body.maxSelections = args.maxSelections;
|
|
90
|
-
if (args.activationGroupId !== void 0)
|
|
91
|
-
body.activationGroupId = args.activationGroupId;
|
|
90
|
+
if (args.activationGroupId !== void 0) body.activationGroupId = args.activationGroupId;
|
|
92
91
|
return callApi("POST", "policy-groups", { body });
|
|
93
92
|
}
|
|
94
93
|
);
|
|
@@ -285,23 +284,27 @@ function registerRuleTools(server, callApi) {
|
|
|
285
284
|
ruleId: z3.string().uuid().describe("Rule ID")
|
|
286
285
|
}
|
|
287
286
|
},
|
|
288
|
-
async ({ groupId, versionId, ruleId }) => callApi(
|
|
289
|
-
"GET",
|
|
290
|
-
`policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`
|
|
291
|
-
)
|
|
287
|
+
async ({ groupId, versionId, ruleId }) => callApi("GET", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`)
|
|
292
288
|
);
|
|
293
289
|
server.registerTool(
|
|
294
290
|
"lexq_rules_create",
|
|
295
291
|
{
|
|
296
292
|
title: "Create Rule",
|
|
297
|
-
description: `Create a rule in a DRAFT version. Requires name, priority, condition tree, and actions array.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
293
|
+
description: `Create a rule in a DRAFT version. Requires name, priority, condition tree, and actions array.
|
|
294
|
+
Condition: { type: "SINGLE", field, operator, value, valueType } or { type: "GROUP", operator: "AND"|"OR", children: [...] }
|
|
295
|
+
Operators: EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, CONTAINS, IN, NOT_IN
|
|
296
|
+
Value types: STRING, NUMBER, BOOLEAN, LIST_STRING, LIST_NUMBER
|
|
297
|
+
|
|
298
|
+
Actions: [{ type, parameters }]
|
|
299
|
+
|
|
300
|
+
Action parameter schemas:
|
|
301
|
+
- DISCOUNT: { refVar: string, method: "PERCENTAGE"|"AMOUNT", rate: number }
|
|
302
|
+
- POINT: { refVar: string, targetVar: string, method: "PERCENTAGE"|"AMOUNT", rate?: number (when PERCENTAGE), value?: number (when AMOUNT), integrationId: uuid }
|
|
303
|
+
- COUPON_ISSUE: { couponId: string, integrationId: uuid }- BLOCK: { reason: string }
|
|
304
|
+
- NOTIFICATION: { channel: "SMS"|"EMAIL"|"PUSH"|"KAKAO", targetVar: string, templateId: string, integrationId: uuid }
|
|
305
|
+
- WEBHOOK: { url: string, method: "POST" }
|
|
306
|
+
- SET_FACT: { key: string, value: string|number|boolean }
|
|
307
|
+
- ADD_TAG: { tag: string, targetVar: string }`,
|
|
305
308
|
inputSchema: {
|
|
306
309
|
groupId: z3.string().uuid().describe("Policy group ID"),
|
|
307
310
|
versionId: z3.string().uuid().describe("Version ID"),
|
|
@@ -312,11 +315,7 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
312
315
|
},
|
|
313
316
|
async ({ groupId, versionId, rule }) => {
|
|
314
317
|
const body = JSON.parse(rule);
|
|
315
|
-
return callApi(
|
|
316
|
-
"POST",
|
|
317
|
-
`policy-groups/${groupId}/versions/${versionId}/rules`,
|
|
318
|
-
{ body }
|
|
319
|
-
);
|
|
318
|
+
return callApi("POST", `policy-groups/${groupId}/versions/${versionId}/rules`, { body });
|
|
320
319
|
}
|
|
321
320
|
);
|
|
322
321
|
server.registerTool(
|
|
@@ -335,11 +334,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
335
334
|
},
|
|
336
335
|
async ({ groupId, versionId, ruleId, rule }) => {
|
|
337
336
|
const body = JSON.parse(rule);
|
|
338
|
-
return callApi(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
{ body }
|
|
342
|
-
);
|
|
337
|
+
return callApi("PATCH", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`, {
|
|
338
|
+
body
|
|
339
|
+
});
|
|
343
340
|
}
|
|
344
341
|
);
|
|
345
342
|
server.registerTool(
|
|
@@ -357,11 +354,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
357
354
|
async ({ groupId, versionId, ruleId, force }) => {
|
|
358
355
|
const params = {};
|
|
359
356
|
if (force) params.force = "true";
|
|
360
|
-
return callApi(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
{ params }
|
|
364
|
-
);
|
|
357
|
+
return callApi("DELETE", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`, {
|
|
358
|
+
params
|
|
359
|
+
});
|
|
365
360
|
}
|
|
366
361
|
);
|
|
367
362
|
server.registerTool(
|
|
@@ -380,11 +375,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
380
375
|
ruleId,
|
|
381
376
|
priority: index
|
|
382
377
|
}));
|
|
383
|
-
return callApi(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
{ body: { rules } }
|
|
387
|
-
);
|
|
378
|
+
return callApi("PUT", `policy-groups/${groupId}/versions/${versionId}/rules/reorder`, {
|
|
379
|
+
body: { rules }
|
|
380
|
+
});
|
|
388
381
|
}
|
|
389
382
|
);
|
|
390
383
|
server.registerTool(
|
|
@@ -399,11 +392,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
399
392
|
isEnabled: z3.boolean().describe("true to enable, false to disable")
|
|
400
393
|
}
|
|
401
394
|
},
|
|
402
|
-
async ({ groupId, versionId, ruleId, isEnabled }) => callApi(
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
{ body: { isEnabled } }
|
|
406
|
-
)
|
|
395
|
+
async ({ groupId, versionId, ruleId, isEnabled }) => callApi("PATCH", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}/toggle`, {
|
|
396
|
+
body: { isEnabled }
|
|
397
|
+
})
|
|
407
398
|
);
|
|
408
399
|
}
|
|
409
400
|
|
|
@@ -483,11 +474,7 @@ function registerDeployTools(server, callApi) {
|
|
|
483
474
|
memo: z5.string().default("").describe("Deployment memo")
|
|
484
475
|
}
|
|
485
476
|
},
|
|
486
|
-
async ({ groupId, versionId, memo }) => callApi(
|
|
487
|
-
"POST",
|
|
488
|
-
`policy-groups/${groupId}/versions/${versionId}/publish`,
|
|
489
|
-
{ body: { memo } }
|
|
490
|
-
)
|
|
477
|
+
async ({ groupId, versionId, memo }) => callApi("POST", `policy-groups/${groupId}/versions/${versionId}/publish`, { body: { memo } })
|
|
491
478
|
);
|
|
492
479
|
server.registerTool(
|
|
493
480
|
"lexq_deploy_live",
|
|
@@ -627,10 +614,7 @@ Always dry-run before publishing to validate rule behavior.`,
|
|
|
627
614
|
versionId: z6.string().uuid().describe("Version ID")
|
|
628
615
|
}
|
|
629
616
|
},
|
|
630
|
-
async ({ groupId, versionId }) => callApi(
|
|
631
|
-
"GET",
|
|
632
|
-
`analytics/groups/${groupId}/versions/${versionId}/requirements`
|
|
633
|
-
)
|
|
617
|
+
async ({ groupId, versionId }) => callApi("GET", `analytics/groups/${groupId}/versions/${versionId}/requirements`)
|
|
634
618
|
);
|
|
635
619
|
server.registerTool(
|
|
636
620
|
"lexq_simulation_start",
|
|
@@ -745,11 +729,9 @@ JSON example:
|
|
|
745
729
|
format: z6.enum(["csv", "json"]).default("csv").describe("Template format")
|
|
746
730
|
}
|
|
747
731
|
},
|
|
748
|
-
async ({ groupId, versionId, format }) => callApi(
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
{ params: { format } }
|
|
752
|
-
)
|
|
732
|
+
async ({ groupId, versionId, format }) => callApi("GET", `analytics/groups/${groupId}/versions/${versionId}/dataset-template`, {
|
|
733
|
+
params: { format }
|
|
734
|
+
})
|
|
753
735
|
);
|
|
754
736
|
}
|
|
755
737
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexq/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "LexQ CLI — manage policies, simulate rules, and deploy from the terminal. Built for humans and AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"cli-table3": "^0.6.5",
|
|
49
49
|
"commander": "^13.1.0",
|
|
50
50
|
"ora": "^8.2.0",
|
|
51
|
+
"prettier": "^3.8.1",
|
|
51
52
|
"zod": "^3.25.76"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|