FenCore Library
FenCore is a pure logic library for WoW addons - no UI dependencies, just utility functions.
Design Philosophy
- Pure Functions: No side effects, predictable outputs
- No UI Dependencies: Works in any layer of your addon
- Testable: All functions can be unit tested without WoW
- Documented: Every function has clear input/output contracts
MCP Tools
| Task |
MCP Tool |
| List All Functions |
fencore.catalog() |
| Search Functions |
fencore.search(query="clamp") |
| Get Function Details |
fencore.info(domain="Math", function="Clamp") |
Domains
FenCore organizes functions by domain:
| Domain |
Purpose |
Examples |
| Math |
Numeric operations |
Clamp, Round, Lerp, InRange |
| Table |
Table manipulation |
Copy, Merge, Filter, Map |
| String |
String utilities |
Split, Trim, StartsWith, Format |
| Color |
Color manipulation |
HexToRGB, RGBToHex, Lighten, Darken |
| Time |
Time formatting |
FormatDuration, FormatTime, ParseDuration |
| Environment |
WoW detection |
IsRetail, IsClassic, GetExpansion |
Usage Pattern
local FenCore = LibStub("FenCore")
-- Access by domain
local Math = FenCore.Math
local result = Math.Clamp(value, 0, 100)
-- Or direct access
local clamped = FenCore.Math.Clamp(value, 0, 100)
Common Functions
Math
FenCore.Math.Clamp(value, min, max) -- Constrain value to range
FenCore.Math.Round(value, decimals) -- Round to decimal places
FenCore.Math.Lerp(a, b, t) -- Linear interpolation
FenCore.Math.InRange(value, min, max) -- Check if value in range
Table
FenCore.Table.Copy(tbl) -- Shallow copy
FenCore.Table.DeepCopy(tbl) -- Deep copy
FenCore.Table.Merge(base, override) -- Merge tables
FenCore.Table.Filter(tbl, predicate) -- Filter by function
FenCore.Table.Map(tbl, transform) -- Transform values
Environment
FenCore.Environment.IsRetail() -- true if retail client
FenCore.Environment.IsClassic() -- true if classic client
FenCore.Environment.GetExpansion() -- "TWW", "Classic", etc.
FenCore.Environment.GetBuildInfo() -- version, build, date
Best Practices
- Use for Core layer - FenCore belongs in your addon's pure logic layer
- Don't wrap unnecessarily - Call FenCore directly, don't create wrappers
- Check domain first - Use
fencore.search to find existing functions before writing your own
- Prefer pure functions - If you need state, that belongs in Bridge layer
1---2name: k-fencore3description: Context for FenCore - the pure logic library for WoW addons. Covers utility functions, math helpers, table operations, and environment detection. Load this when working with FenCore or needing utility functions. Triggers: fencore, utility, math, table, logic, pure functions.4---5
6# FenCore Library
7
8FenCore is a pure logic library for WoW addons - no UI dependencies, just utility functions.
9
10## Design Philosophy
11
12- **Pure Functions**: No side effects, predictable outputs
13- **No UI Dependencies**: Works in any layer of your addon
14- **Testable**: All functions can be unit tested without WoW
15- **Documented**: Every function has clear input/output contracts
16
17## MCP Tools
18
19| Task | MCP Tool |
20|------|----------|
21| List All Functions | `fencore.catalog()` |
22| Search Functions | `fencore.search(query="clamp")` |
23| Get Function Details | `fencore.info(domain="Math", function="Clamp")` |
24
25## Domains
26
27FenCore organizes functions by domain:
28
29| Domain | Purpose | Examples |
30|--------|---------|----------|
31| **Math** | Numeric operations | `Clamp`, `Round`, `Lerp`, `InRange` |
32| **Table** | Table manipulation | `Copy`, `Merge`, `Filter`, `Map` |
33| **String** | String utilities | `Split`, `Trim`, `StartsWith`, `Format` |
34| **Color** | Color manipulation | `HexToRGB`, `RGBToHex`, `Lighten`, `Darken` |
35| **Time** | Time formatting | `FormatDuration`, `FormatTime`, `ParseDuration` |
36| **Environment** | WoW detection | `IsRetail`, `IsClassic`, `GetExpansion` |
37
38## Usage Pattern
39
40```lua
41local FenCore = LibStub("FenCore")
42
43-- Access by domain
44local Math = FenCore.Math
45local result = Math.Clamp(value, 0, 100)
46
47-- Or direct access
48local clamped = FenCore.Math.Clamp(value, 0, 100)
49```
50
51## Common Functions
52
53### Math
54
55```lua
56FenCore.Math.Clamp(value, min, max) -- Constrain value to range
57FenCore.Math.Round(value, decimals) -- Round to decimal places
58FenCore.Math.Lerp(a, b, t) -- Linear interpolation
59FenCore.Math.InRange(value, min, max) -- Check if value in range
60```
61
62### Table
63
64```lua
65FenCore.Table.Copy(tbl) -- Shallow copy
66FenCore.Table.DeepCopy(tbl) -- Deep copy
67FenCore.Table.Merge(base, override) -- Merge tables
68FenCore.Table.Filter(tbl, predicate) -- Filter by function
69FenCore.Table.Map(tbl, transform) -- Transform values
70```
71
72### Environment
73
74```lua
75FenCore.Environment.IsRetail() -- true if retail client
76FenCore.Environment.IsClassic() -- true if classic client
77FenCore.Environment.GetExpansion() -- "TWW", "Classic", etc.
78FenCore.Environment.GetBuildInfo() -- version, build, date
79```
80
81## Best Practices
82
831. **Use for Core layer** - FenCore belongs in your addon's pure logic layer
842. **Don't wrap unnecessarily** - Call FenCore directly, don't create wrappers
853. **Check domain first** - Use `fencore.search` to find existing functions before writing your own
864. **Prefer pure functions** - If you need state, that belongs in Bridge layer