@lexq/cli 0.1.20 → 0.1.22
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 +12 -10
- package/dist/mcp/register.js +8 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -876,7 +876,7 @@ ${data.totalElements} total \xB7 page ${data.pageNo + 1}/${data.totalPages}`);
|
|
|
876
876
|
"valueType": "STRING"
|
|
877
877
|
},
|
|
878
878
|
"actions": [
|
|
879
|
-
{ "type": "
|
|
879
|
+
{ "type": "MUTATE_FACT", "parameters": { "refVar": "payment_amount", "operator": "SUB", "method": "PERCENTAGE", "rate": 20 } }
|
|
880
880
|
]
|
|
881
881
|
}'
|
|
882
882
|
|
|
@@ -885,7 +885,7 @@ ${data.totalElements} total \xB7 page ${data.pageNo + 1}/${data.totalPages}`);
|
|
|
885
885
|
LESS_THAN, LESS_THAN_OR_EQUAL, CONTAINS, IN, NOT_IN
|
|
886
886
|
|
|
887
887
|
Action Types:
|
|
888
|
-
|
|
888
|
+
MUTATE_FACT, INCREMENT_FACT, EMIT_EVENT, BLOCK, EMIT_NOTIFICATION, EMIT_WEBHOOK, SET_FACT, ADD_TAG
|
|
889
889
|
|
|
890
890
|
Value Types: STRING, NUMBER, BOOLEAN, LIST_STRING, LIST_NUMBER
|
|
891
891
|
|
|
@@ -925,7 +925,7 @@ ${data.totalElements} total \xB7 page ${data.pageNo + 1}/${data.totalPages}`);
|
|
|
925
925
|
$ lexq rules update --group-id <gid> --version-id <vid> --id <rid> --json '{
|
|
926
926
|
"name": "VIP 25% Discount",
|
|
927
927
|
"actions": [
|
|
928
|
-
{ "type": "
|
|
928
|
+
{ "type": "MUTATE_FACT", "parameters": { "refVar": "payment_amount", "operator": "SUB", "method": "PERCENTAGE", "rate": 25 } }
|
|
929
929
|
]
|
|
930
930
|
}'
|
|
931
931
|
`
|
|
@@ -2139,7 +2139,7 @@ ${data.totalElements} total \xB7 page ${data.pageNo + 1}/${data.totalPages}`);
|
|
|
2139
2139
|
dedent9`
|
|
2140
2140
|
|
|
2141
2141
|
Returns the full execution detail including request facts, result traces,
|
|
2142
|
-
and decision traces (SELECTED,
|
|
2142
|
+
and decision traces (SELECTED, NO_MATCH, BLOCKED, etc.).
|
|
2143
2143
|
`
|
|
2144
2144
|
).action(async (opts) => {
|
|
2145
2145
|
try {
|
|
@@ -3124,18 +3124,20 @@ function registerRuleTools(server, callApi) {
|
|
|
3124
3124
|
Actions: [{ type, parameters }]
|
|
3125
3125
|
|
|
3126
3126
|
Action parameter schemas:
|
|
3127
|
-
-
|
|
3128
|
-
-
|
|
3129
|
-
-
|
|
3127
|
+
- MUTATE_FACT: { refVar: string, operator: "ASSIGN"|"ADD"|"SUB"|"MUL"|"DIV", method: "PERCENTAGE"|"AMOUNT", rate?: number (when PERCENTAGE), value?: number (when AMOUNT), rounding?: RoundingOption } Constraints: DIV + PERCENTAGE is invalid (use MUL with rate/100 inverse). DIV + AMOUNT requires value !== 0.
|
|
3128
|
+
- INCREMENT_FACT: { targetVar: string, method: "PERCENTAGE"|"AMOUNT", refVar?: string (required when PERCENTAGE), rate?: number (when PERCENTAGE), value?: number (when AMOUNT), rounding?: RoundingOption } Note: external system call (e.g. point system sync) is NOT a primitive responsibility. Compose [INCREMENT_FACT, EMIT_EVENT] chain instead.
|
|
3129
|
+
- EMIT_EVENT: { integrationId: uuid, eventPayload: object (Map<string,unknown>, ≥1 entry) } eventPayload is passed through to the integration provider as-is. Domain-specific keys (couponId, ticketId, etc.) are routed by the provider, not validated by the engine.
|
|
3130
3130
|
- BLOCK: { reason: string }
|
|
3131
|
-
-
|
|
3132
|
-
-
|
|
3131
|
+
- EMIT_NOTIFICATION: { integrationId: uuid, targetVar: string, notificationPayload: object (Map<string,unknown>, ≥1 entry) } targetVar identifies the recipient fact (e.g. phone_number / email / device_token). notificationPayload (channel, templateId, body, variables, etc.) is passed through to the provider.
|
|
3132
|
+
- EMIT_WEBHOOK: { url: string, method: "POST", payloadTemplate?: object } payloadTemplate is optional. Without it, all facts are sent as-is. With it, the object is sent as the HTTP body with {{variables}} replaced at execution time. Variables: {{fact.xxx}}, {{output.xxx}}, {{timestamp}}, {{ruleName}}, {{groupName}}, {{versionNo}}, {{xxx}} (shorthand).
|
|
3133
3133
|
Platform examples:
|
|
3134
3134
|
Slack: { "text": "Rule {{ruleName}} fired — {{fact.customer_tier}}" }
|
|
3135
3135
|
Discord: { "content": "Rule {{ruleName}} fired — {{fact.customer_tier}}" }
|
|
3136
3136
|
Generic: { "event": "rule_matched", "rule": "{{ruleName}}", "amount": "{{output.payment_amount}}" }
|
|
3137
3137
|
- SET_FACT: { key: string, value: string|number|boolean }
|
|
3138
3138
|
- ADD_TAG: { tag: string, targetVar: string }
|
|
3139
|
+
|
|
3140
|
+
RoundingOption (optional, MUTATE_FACT / INCREMENT_FACT only): { scale: integer (0..16), mode?: "HALF_UP"|"HALF_DOWN"|"HALF_EVEN"|"FLOOR"|"CEILING"|"DOWN"|"UP" } mode defaults to HALF_UP. When omitted, calculator output is preserved at full precision (lossless).
|
|
3139
3141
|
`,
|
|
3140
3142
|
inputSchema: {
|
|
3141
3143
|
groupId: z3.string().uuid().describe("Policy group ID"),
|
|
@@ -3448,7 +3450,7 @@ function registerAnalyticsTools(server, callApi) {
|
|
|
3448
3450
|
mutatedFacts — input facts changed by rule actions (e.g. DISCOUNT mutates payment_amount)
|
|
3449
3451
|
generatedVariables — new variables created by rules (e.g. last_discount_amount)
|
|
3450
3452
|
executionTraces — per-rule match status
|
|
3451
|
-
decisionTraces — per-rule decision (SELECTED /
|
|
3453
|
+
decisionTraces — per-rule decision (SELECTED / NO_MATCH / BLOCKED / etc.)
|
|
3452
3454
|
|
|
3453
3455
|
Example input: { "facts": { "payment_amount": 100000, "customer_tier": "VIP" } }
|
|
3454
3456
|
Always dry-run before publishing to validate rule behavior.`,
|
package/dist/mcp/register.js
CHANGED
|
@@ -293,18 +293,20 @@ function registerRuleTools(server, callApi) {
|
|
|
293
293
|
Actions: [{ type, parameters }]
|
|
294
294
|
|
|
295
295
|
Action parameter schemas:
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
296
|
+
- MUTATE_FACT: { refVar: string, operator: "ASSIGN"|"ADD"|"SUB"|"MUL"|"DIV", method: "PERCENTAGE"|"AMOUNT", rate?: number (when PERCENTAGE), value?: number (when AMOUNT), rounding?: RoundingOption } Constraints: DIV + PERCENTAGE is invalid (use MUL with rate/100 inverse). DIV + AMOUNT requires value !== 0.
|
|
297
|
+
- INCREMENT_FACT: { targetVar: string, method: "PERCENTAGE"|"AMOUNT", refVar?: string (required when PERCENTAGE), rate?: number (when PERCENTAGE), value?: number (when AMOUNT), rounding?: RoundingOption } Note: external system call (e.g. point system sync) is NOT a primitive responsibility. Compose [INCREMENT_FACT, EMIT_EVENT] chain instead.
|
|
298
|
+
- EMIT_EVENT: { integrationId: uuid, eventPayload: object (Map<string,unknown>, ≥1 entry) } eventPayload is passed through to the integration provider as-is. Domain-specific keys (couponId, ticketId, etc.) are routed by the provider, not validated by the engine.
|
|
299
299
|
- BLOCK: { reason: string }
|
|
300
|
-
-
|
|
301
|
-
-
|
|
300
|
+
- EMIT_NOTIFICATION: { integrationId: uuid, targetVar: string, notificationPayload: object (Map<string,unknown>, ≥1 entry) } targetVar identifies the recipient fact (e.g. phone_number / email / device_token). notificationPayload (channel, templateId, body, variables, etc.) is passed through to the provider.
|
|
301
|
+
- EMIT_WEBHOOK: { url: string, method: "POST", payloadTemplate?: object } payloadTemplate is optional. Without it, all facts are sent as-is. With it, the object is sent as the HTTP body with {{variables}} replaced at execution time. Variables: {{fact.xxx}}, {{output.xxx}}, {{timestamp}}, {{ruleName}}, {{groupName}}, {{versionNo}}, {{xxx}} (shorthand).
|
|
302
302
|
Platform examples:
|
|
303
303
|
Slack: { "text": "Rule {{ruleName}} fired — {{fact.customer_tier}}" }
|
|
304
304
|
Discord: { "content": "Rule {{ruleName}} fired — {{fact.customer_tier}}" }
|
|
305
305
|
Generic: { "event": "rule_matched", "rule": "{{ruleName}}", "amount": "{{output.payment_amount}}" }
|
|
306
306
|
- SET_FACT: { key: string, value: string|number|boolean }
|
|
307
307
|
- ADD_TAG: { tag: string, targetVar: string }
|
|
308
|
+
|
|
309
|
+
RoundingOption (optional, MUTATE_FACT / INCREMENT_FACT only): { scale: integer (0..16), mode?: "HALF_UP"|"HALF_DOWN"|"HALF_EVEN"|"FLOOR"|"CEILING"|"DOWN"|"UP" } mode defaults to HALF_UP. When omitted, calculator output is preserved at full precision (lossless).
|
|
308
310
|
`,
|
|
309
311
|
inputSchema: {
|
|
310
312
|
groupId: z3.string().uuid().describe("Policy group ID"),
|
|
@@ -617,7 +619,7 @@ function registerAnalyticsTools(server, callApi) {
|
|
|
617
619
|
mutatedFacts — input facts changed by rule actions (e.g. DISCOUNT mutates payment_amount)
|
|
618
620
|
generatedVariables — new variables created by rules (e.g. last_discount_amount)
|
|
619
621
|
executionTraces — per-rule match status
|
|
620
|
-
decisionTraces — per-rule decision (SELECTED /
|
|
622
|
+
decisionTraces — per-rule decision (SELECTED / NO_MATCH / BLOCKED / etc.)
|
|
621
623
|
|
|
622
624
|
Example input: { "facts": { "payment_amount": 100000, "customer_tier": "VIP" } }
|
|
623
625
|
Always dry-run before publishing to validate rule behavior.`,
|