@lexq/cli 0.3.1 → 1.0.0

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.
@@ -20,7 +20,11 @@ lexq versions create --group-id <gid> --json '{"commitMessage": "Initial tiered
20
20
 
21
21
  # 3. Register facts (skip if already exist)
22
22
  lexq facts create --key paymentAmount --name "Payment Amount" --type NUMBER --required
23
- lexq facts create --key customerTier --name "Customer Tier" --type STRING
23
+ lexq facts create --key customerTier --name "Customer Tier" --type STRING \
24
+ --allowed-values "VIP, GOLD, SILVER"
25
+ # A value domain says which values the fact accepts. It refuses a rule literal that could
26
+ # never match (a typo like "PLATNUM"), and the Console offers a dropdown instead of a text box.
27
+ # Leave it off when the set is open — a country code, an account id, a free-text label.
24
28
 
25
29
  # 4. Add rules — creation order becomes priority order (first created = priority 1 = highest)
26
30
  lexq rules create --group-id <gid> --version-id <vid> --json '{
@@ -47,6 +47,7 @@ This is the typical lifecycle. **Always follow this order:**
47
47
  1. lexq groups create → Create a policy group
48
48
  2. lexq versions create → Create a DRAFT version inside it
49
49
  3. lexq facts create → Register input variables (if not already defined)
50
+ → --allowed-values / --min / --max constrain what callers may send
50
51
  4. lexq rules create → Add rules with conditions + actions
51
52
  5. lexq analytics dry-run → Test with sample facts (validate before publish)
52
53
  6. lexq deploy publish → DRAFT → ACTIVE (locks the version)
@@ -186,12 +186,18 @@ rule you expect never appears in `decisionTraces`, check the version's `effectiv
186
186
  - **empty** — the condition was evaluated and did not match
187
187
  - **`Evaluation error: <code>`** — the condition could not be evaluated at all
188
188
 
189
- | Code | Meaning |
190
- |-------------------------|--------------------------------------------------------------------|
191
- | `FACT_NOT_PROVIDED` | The rule references a fact absent from the request |
192
- | `FACT_TYPE_MISMATCH` | The fact's runtime type does not match the condition |
193
- | `UNSUPPORTED_FACT_TYPE` | Operator not valid for the fact's type (e.g. `CONTAINS` on a list) |
194
- | `MALFORMED_RULE` | The stored rule is structurally invalid |
189
+ Each code says **who fixes it**.
190
+
191
+ | Code | Who fixes it | Meaning |
192
+ |--------------------------------|--------------|------------------------------------------------------------|
193
+ | `FACT_NOT_PROVIDED` | the caller | The rule reads a fact the request did not include |
194
+ | `FACT_TYPE_MISMATCH` | the caller | The value sent has the wrong type for the condition |
195
+ | `CONDITION_VALUE_TYPE_INVALID` | the author | The literal stored in the rule is wrong for its operator |
196
+ | `MALFORMED_RULE` | nobody | The stored rule is structurally invalid. Report it |
197
+
198
+ `CONDITION_VALUE_TYPE_INVALID` is worth escalating. The right-hand side of a condition belongs
199
+ to the rule, not to your request, so changing the payload will not help — the rule fails the
200
+ same way for every caller. It also got past the check that is supposed to reject it on save.
195
201
 
196
202
  A rule from another group referencing facts you did not send yields `FACT_NOT_PROVIDED` — this
197
203
  is normal, not an error.