You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Build & Test Commands
6
+
7
+
-`yarn install` - Install dependencies
8
+
-`yarn build` - Lint and compile TypeScript
9
+
-`yarn compile` - Compile TypeScript only
10
+
-`yarn test` - Run linting, type tests, and coverage tests
11
+
-`yarn test:unit` - Run unit tests only
12
+
-`yarn test:cover` - Run unit tests with coverage
13
+
-`yarn test:tsd` - Run TypeScript definition tests
14
+
-`yarn lint` - Run TSLint
15
+
-`yarn ci` - Full CI pipeline (lint, compile, type tests, coverage)
16
+
17
+
Run a single test:
18
+
```sh
19
+
yarn test:unit --grep "test name pattern"
20
+
```
21
+
22
+
## Architecture
23
+
24
+
### Two Evaluation Systems
25
+
26
+
1.**Expression Evaluator** (`src/lib/evaluator.ts`): Evaluates boolean expressions against a context
27
+
-`evaluate()` - Returns boolean result
28
+
-`evaluateWithReason()` - Returns `{result, reason}` where reason is the minimal expression that caused the result. For `and`/`or`, reason is always wrapped in array form (e.g., `{or: [reason]}`)
29
+
-`validate()` - Validates expression structure against a full context
30
+
31
+
2.**Rule Engine** (`src/lib/engine.ts`): Evaluates rules with conditions and consequences
32
+
- Rules have a condition (expression) and consequence (message + custom payload)
33
+
- Can also use rule functions that combine condition checking and consequence in one
34
+
35
+
### Type System (Critical)
36
+
37
+
The type system uses `ts-toolbelt` for advanced type manipulation. Generic parameters follow this pattern:
The `evaluateWithReason` function evaluates an expression and returns not only the boolean result, but also the minimal sub-expression that led to that result. This is useful for debugging and understanding why an expression evaluated to a specific value.
0 commit comments