@lexq/cli 0.1.12 → 0.1.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/dist/index.js +318 -443
- package/dist/mcp/register.js +54 -83
- package/package.json +2 -1
package/dist/mcp/register.js
CHANGED
|
@@ -35,18 +35,14 @@ function registerGroupTools(server, callApi) {
|
|
|
35
35
|
"lexq_groups_list",
|
|
36
36
|
{
|
|
37
37
|
title: "List Policy Groups",
|
|
38
|
-
description: "List all policy groups
|
|
38
|
+
description: "List all policy groups with pagination.",
|
|
39
39
|
inputSchema: {
|
|
40
40
|
page: z.number().int().min(0).default(0).describe("Page number (0-indexed)"),
|
|
41
|
-
size: z.number().int().min(1).max(100).default(20).describe("Page size")
|
|
42
|
-
status: z.enum(["ACTIVE", "DISABLED", "ARCHIVED"]).optional().describe("Filter by status"),
|
|
43
|
-
keyword: z.string().optional().describe("Search keyword")
|
|
41
|
+
size: z.number().int().min(1).max(100).default(20).describe("Page size")
|
|
44
42
|
}
|
|
45
43
|
},
|
|
46
|
-
async ({ page, size
|
|
44
|
+
async ({ page, size }) => {
|
|
47
45
|
const params = paginationParams(page, size);
|
|
48
|
-
if (status) params.status = status;
|
|
49
|
-
if (keyword) params.keyword = keyword;
|
|
50
46
|
return callApi("GET", "policy-groups", { params });
|
|
51
47
|
}
|
|
52
48
|
);
|
|
@@ -87,8 +83,7 @@ function registerGroupTools(server, callApi) {
|
|
|
87
83
|
if (args.conflictResolutionStrategy !== void 0)
|
|
88
84
|
body.conflictResolutionStrategy = args.conflictResolutionStrategy;
|
|
89
85
|
if (args.maxSelections !== void 0) body.maxSelections = args.maxSelections;
|
|
90
|
-
if (args.activationGroupId !== void 0)
|
|
91
|
-
body.activationGroupId = args.activationGroupId;
|
|
86
|
+
if (args.activationGroupId !== void 0) body.activationGroupId = args.activationGroupId;
|
|
92
87
|
return callApi("POST", "policy-groups", { body });
|
|
93
88
|
}
|
|
94
89
|
);
|
|
@@ -108,7 +103,7 @@ function registerGroupTools(server, callApi) {
|
|
|
108
103
|
maxSelections: z.number().int().min(1).optional().describe("Max selections")
|
|
109
104
|
}
|
|
110
105
|
},
|
|
111
|
-
async ({ groupId, ...body }) => callApi("
|
|
106
|
+
async ({ groupId, ...body }) => callApi("PUT", `policy-groups/${groupId}`, { body })
|
|
112
107
|
);
|
|
113
108
|
server.registerTool(
|
|
114
109
|
"lexq_groups_delete",
|
|
@@ -125,41 +120,37 @@ function registerGroupTools(server, callApi) {
|
|
|
125
120
|
"lexq_ab_test_start",
|
|
126
121
|
{
|
|
127
122
|
title: "Start A/B Test",
|
|
128
|
-
description: "Start an A/B test on a policy group. Requires a challenger version ID and traffic
|
|
123
|
+
description: "Start an A/B test on a policy group. Requires a challenger version ID and traffic rate.",
|
|
129
124
|
inputSchema: {
|
|
130
125
|
groupId: z.string().uuid().describe("Policy group ID"),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
challengerWeight: z.number().int().min(1).max(99).describe("Challenger traffic weight (%)"),
|
|
134
|
-
identityKey: z.string().optional().describe("Fact key for sticky assignment (e.g. customer_id)")
|
|
126
|
+
testVersionId: z.string().uuid().describe("Challenger version ID to test"),
|
|
127
|
+
trafficRate: z.number().int().min(1).max(99).describe("Traffic percentage routed to challenger (1-99)")
|
|
135
128
|
}
|
|
136
129
|
},
|
|
137
|
-
async ({ groupId, ...body }) => callApi("POST", `policy-groups/${groupId}/ab-test
|
|
130
|
+
async ({ groupId, ...body }) => callApi("POST", `policy-groups/${groupId}/ab-test`, { body })
|
|
138
131
|
);
|
|
139
132
|
server.registerTool(
|
|
140
133
|
"lexq_ab_test_stop",
|
|
141
134
|
{
|
|
142
135
|
title: "Stop A/B Test",
|
|
143
|
-
description: "Stop a running A/B test.
|
|
136
|
+
description: "Stop a running A/B test. All traffic is restored to the control (current) version.",
|
|
144
137
|
inputSchema: {
|
|
145
|
-
groupId: z.string().uuid().describe("Policy group ID")
|
|
146
|
-
winnerVersionId: z.string().uuid().describe("Version ID to keep as live")
|
|
138
|
+
groupId: z.string().uuid().describe("Policy group ID")
|
|
147
139
|
}
|
|
148
140
|
},
|
|
149
|
-
async ({ groupId
|
|
141
|
+
async ({ groupId }) => callApi("DELETE", `policy-groups/${groupId}/ab-test`)
|
|
150
142
|
);
|
|
151
143
|
server.registerTool(
|
|
152
144
|
"lexq_ab_test_adjust",
|
|
153
145
|
{
|
|
154
146
|
title: "Adjust A/B Test",
|
|
155
|
-
description: "Adjust traffic
|
|
147
|
+
description: "Adjust traffic rate of a running A/B test.",
|
|
156
148
|
inputSchema: {
|
|
157
149
|
groupId: z.string().uuid().describe("Policy group ID"),
|
|
158
|
-
|
|
159
|
-
challengerWeight: z.number().int().min(1).max(99).describe("New challenger weight (%)")
|
|
150
|
+
trafficRate: z.number().int().min(1).max(99).describe("New traffic percentage for challenger (1-99)")
|
|
160
151
|
}
|
|
161
152
|
},
|
|
162
|
-
async ({ groupId, ...body }) => callApi("
|
|
153
|
+
async ({ groupId, ...body }) => callApi("PATCH", `policy-groups/${groupId}/ab-test/traffic-rate`, { body })
|
|
163
154
|
);
|
|
164
155
|
}
|
|
165
156
|
|
|
@@ -220,7 +211,7 @@ function registerVersionTools(server, callApi) {
|
|
|
220
211
|
effectiveTo: z2.string().optional().describe("New effective end date")
|
|
221
212
|
}
|
|
222
213
|
},
|
|
223
|
-
async ({ groupId, versionId, ...body }) => callApi("
|
|
214
|
+
async ({ groupId, versionId, ...body }) => callApi("PUT", `policy-groups/${groupId}/versions/${versionId}`, { body })
|
|
224
215
|
);
|
|
225
216
|
server.registerTool(
|
|
226
217
|
"lexq_versions_delete",
|
|
@@ -241,15 +232,12 @@ function registerVersionTools(server, callApi) {
|
|
|
241
232
|
description: "Clone an existing version to create a new DRAFT. Useful when the source version is already published.",
|
|
242
233
|
inputSchema: {
|
|
243
234
|
groupId: z2.string().uuid().describe("Policy group ID"),
|
|
244
|
-
versionId: z2.string().uuid().describe("Source version ID to clone")
|
|
245
|
-
commitMessage: z2.string().optional().describe("Commit message for the cloned version")
|
|
235
|
+
versionId: z2.string().uuid().describe("Source version ID to clone")
|
|
246
236
|
}
|
|
247
237
|
},
|
|
248
|
-
async ({ groupId, versionId
|
|
249
|
-
const body = {};
|
|
250
|
-
if (commitMessage !== void 0) body.commitMessage = commitMessage;
|
|
238
|
+
async ({ groupId, versionId }) => {
|
|
251
239
|
return callApi("POST", `policy-groups/${groupId}/versions/${versionId}/clone`, {
|
|
252
|
-
body
|
|
240
|
+
body: {}
|
|
253
241
|
});
|
|
254
242
|
}
|
|
255
243
|
);
|
|
@@ -285,23 +273,27 @@ function registerRuleTools(server, callApi) {
|
|
|
285
273
|
ruleId: z3.string().uuid().describe("Rule ID")
|
|
286
274
|
}
|
|
287
275
|
},
|
|
288
|
-
async ({ groupId, versionId, ruleId }) => callApi(
|
|
289
|
-
"GET",
|
|
290
|
-
`policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`
|
|
291
|
-
)
|
|
276
|
+
async ({ groupId, versionId, ruleId }) => callApi("GET", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`)
|
|
292
277
|
);
|
|
293
278
|
server.registerTool(
|
|
294
279
|
"lexq_rules_create",
|
|
295
280
|
{
|
|
296
281
|
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
|
-
|
|
282
|
+
description: `Create a rule in a DRAFT version. Requires name, priority, condition tree, and actions array.
|
|
283
|
+
Condition: { type: "SINGLE", field, operator, value, valueType } or { type: "GROUP", operator: "AND"|"OR", children: [...] }
|
|
284
|
+
Operators: EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, CONTAINS, IN, NOT_IN
|
|
285
|
+
Value types: STRING, NUMBER, BOOLEAN, LIST_STRING, LIST_NUMBER
|
|
286
|
+
|
|
287
|
+
Actions: [{ type, parameters }]
|
|
288
|
+
|
|
289
|
+
Action parameter schemas:
|
|
290
|
+
- DISCOUNT: { refVar: string, method: "PERCENTAGE"|"AMOUNT", rate?: number (when PERCENTAGE), value?: number (when AMOUNT) }
|
|
291
|
+
- POINT: { refVar: string, targetVar: string, method: "PERCENTAGE"|"AMOUNT", rate?: number (when PERCENTAGE), value?: number (when AMOUNT), integrationId: uuid }
|
|
292
|
+
- COUPON_ISSUE: { couponId: string, integrationId: uuid }- BLOCK: { reason: string }
|
|
293
|
+
- NOTIFICATION: { channel: "SMS"|"EMAIL"|"PUSH"|"KAKAO", targetVar: string, templateId: string, integrationId: uuid }
|
|
294
|
+
- WEBHOOK: { url: string, method: "POST" }
|
|
295
|
+
- SET_FACT: { key: string, value: string|number|boolean }
|
|
296
|
+
- ADD_TAG: { tag: string, targetVar: string }`,
|
|
305
297
|
inputSchema: {
|
|
306
298
|
groupId: z3.string().uuid().describe("Policy group ID"),
|
|
307
299
|
versionId: z3.string().uuid().describe("Version ID"),
|
|
@@ -312,11 +304,7 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
312
304
|
},
|
|
313
305
|
async ({ groupId, versionId, rule }) => {
|
|
314
306
|
const body = JSON.parse(rule);
|
|
315
|
-
return callApi(
|
|
316
|
-
"POST",
|
|
317
|
-
`policy-groups/${groupId}/versions/${versionId}/rules`,
|
|
318
|
-
{ body }
|
|
319
|
-
);
|
|
307
|
+
return callApi("POST", `policy-groups/${groupId}/versions/${versionId}/rules`, { body });
|
|
320
308
|
}
|
|
321
309
|
);
|
|
322
310
|
server.registerTool(
|
|
@@ -335,11 +323,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
335
323
|
},
|
|
336
324
|
async ({ groupId, versionId, ruleId, rule }) => {
|
|
337
325
|
const body = JSON.parse(rule);
|
|
338
|
-
return callApi(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
{ body }
|
|
342
|
-
);
|
|
326
|
+
return callApi("PUT", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`, {
|
|
327
|
+
body
|
|
328
|
+
});
|
|
343
329
|
}
|
|
344
330
|
);
|
|
345
331
|
server.registerTool(
|
|
@@ -357,11 +343,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
357
343
|
async ({ groupId, versionId, ruleId, force }) => {
|
|
358
344
|
const params = {};
|
|
359
345
|
if (force) params.force = "true";
|
|
360
|
-
return callApi(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
{ params }
|
|
364
|
-
);
|
|
346
|
+
return callApi("DELETE", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}`, {
|
|
347
|
+
params
|
|
348
|
+
});
|
|
365
349
|
}
|
|
366
350
|
);
|
|
367
351
|
server.registerTool(
|
|
@@ -380,11 +364,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
380
364
|
ruleId,
|
|
381
365
|
priority: index
|
|
382
366
|
}));
|
|
383
|
-
return callApi(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
{ body: { rules } }
|
|
387
|
-
);
|
|
367
|
+
return callApi("PATCH", `policy-groups/${groupId}/versions/${versionId}/rules/reorder`, {
|
|
368
|
+
body: { rules }
|
|
369
|
+
});
|
|
388
370
|
}
|
|
389
371
|
);
|
|
390
372
|
server.registerTool(
|
|
@@ -399,11 +381,9 @@ Types: DISCOUNT, POINT, COUPON_ISSUE, BLOCK, NOTIFICATION, WEBHOOK, SET_FACT, AD
|
|
|
399
381
|
isEnabled: z3.boolean().describe("true to enable, false to disable")
|
|
400
382
|
}
|
|
401
383
|
},
|
|
402
|
-
async ({ groupId, versionId, ruleId, isEnabled }) => callApi(
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
{ body: { isEnabled } }
|
|
406
|
-
)
|
|
384
|
+
async ({ groupId, versionId, ruleId, isEnabled }) => callApi("PATCH", `policy-groups/${groupId}/versions/${versionId}/rules/${ruleId}/enabled`, {
|
|
385
|
+
body: { isEnabled }
|
|
386
|
+
})
|
|
407
387
|
);
|
|
408
388
|
}
|
|
409
389
|
|
|
@@ -454,7 +434,7 @@ function registerFactTools(server, callApi) {
|
|
|
454
434
|
isRequired: z4.boolean().describe("Required flag")
|
|
455
435
|
}
|
|
456
436
|
},
|
|
457
|
-
async ({ factId, ...body }) => callApi("
|
|
437
|
+
async ({ factId, ...body }) => callApi("PUT", `schema/facts/${factId}`, { body })
|
|
458
438
|
);
|
|
459
439
|
server.registerTool(
|
|
460
440
|
"lexq_facts_delete",
|
|
@@ -483,11 +463,7 @@ function registerDeployTools(server, callApi) {
|
|
|
483
463
|
memo: z5.string().default("").describe("Deployment memo")
|
|
484
464
|
}
|
|
485
465
|
},
|
|
486
|
-
async ({ groupId, versionId, memo }) => callApi(
|
|
487
|
-
"POST",
|
|
488
|
-
`policy-groups/${groupId}/versions/${versionId}/publish`,
|
|
489
|
-
{ body: { memo } }
|
|
490
|
-
)
|
|
466
|
+
async ({ groupId, versionId, memo }) => callApi("POST", `policy-groups/${groupId}/versions/${versionId}/publish`, { body: { memo } })
|
|
491
467
|
);
|
|
492
468
|
server.registerTool(
|
|
493
469
|
"lexq_deploy_live",
|
|
@@ -627,10 +603,7 @@ Always dry-run before publishing to validate rule behavior.`,
|
|
|
627
603
|
versionId: z6.string().uuid().describe("Version ID")
|
|
628
604
|
}
|
|
629
605
|
},
|
|
630
|
-
async ({ groupId, versionId }) => callApi(
|
|
631
|
-
"GET",
|
|
632
|
-
`analytics/groups/${groupId}/versions/${versionId}/requirements`
|
|
633
|
-
)
|
|
606
|
+
async ({ groupId, versionId }) => callApi("GET", `analytics/groups/${groupId}/versions/${versionId}/requirements`)
|
|
634
607
|
);
|
|
635
608
|
server.registerTool(
|
|
636
609
|
"lexq_simulation_start",
|
|
@@ -745,11 +718,9 @@ JSON example:
|
|
|
745
718
|
format: z6.enum(["csv", "json"]).default("csv").describe("Template format")
|
|
746
719
|
}
|
|
747
720
|
},
|
|
748
|
-
async ({ groupId, versionId, format }) => callApi(
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
{ params: { format } }
|
|
752
|
-
)
|
|
721
|
+
async ({ groupId, versionId, format }) => callApi("GET", `analytics/groups/${groupId}/versions/${versionId}/dataset-template`, {
|
|
722
|
+
params: { format }
|
|
723
|
+
})
|
|
753
724
|
);
|
|
754
725
|
}
|
|
755
726
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexq/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
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": {
|