# nexxbiz/jlio architecture

> Architecture diagram of the GitHub repository nexxbiz/jlio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nexxbiz/jlio
- Repository: https://github.com/nexxbiz/jlio

## Overview

#### Purpose and Entry Points
JLio is a .NET library ecosystem for declarative JSON transformation: JSON-formatted scripts are parsed into executable commands and applied to Newtonsoft `JToken` data. Primary embedding API is `JLioConvert.Parse` and engine construction in `JLio.CLient/JLioConvert.cs` and `JLio.CLient/JLioEngineBuilder.cs`. A separate MCP host exposes JLio capabilities via `JLio.MCP/Program.cs`.

#### Engine Assembly and Script Lifecycle
`JLioEngine` builds the execution environment from registered command/function providers and configurable parse behavior. `JLioVersionedEngine` supports versioned engine configurations, providing an isolation/compatibility boundary for different registered capability sets.
- `JLio.CLient/JLioEngine.cs`
- `JLio.CLient/JLioVersionedEngine.cs`
- `JLio.CLient/JLioEngineConfigurations.cs`

Flow: script JSON or fluent `JLioScript` → parse/convert registrations into command instances → execute sequentially against a mutable JSON token → return execution result and logging data.

#### Core Parsing, Dispatch, and Execution
Core contracts define the extension boundary: commands implement `ICommand`; functions implement `IFunction`; providers register and resolve both. `CommandConverter` and `FunctionConverter` translate script notation into runtime objects. `ExecutionContext` carries current/root token state, while `ConditionEvaluator` evaluates conditional behavior.
- `JLio.Core/CommandConverter.cs`
- `JLio.Core/FunctionsProvider.cs`
- `JLio.Core/Models/ExecutionContext.cs`

Unknown command handling is explicit through `JLio.Core/NotFoundCommand.cs`; execution results and logging are modeled in `JLio.Core/Models/JLioExecutionResult.cs` and `JLio.Core/Models/ExecutionLogger.cs`.

#### JSON Addressing and Mutation Commands
JSONPath selection is a central boundary between declarative script paths and token mutation. Path parsing, selection, and fetch abstraction reside in core extensions; command implementations then add, set, put, remove, copy, or move selected properties/array entries. Function-capable values are evaluated before applicable mutations.
- `JLio.Core/Extensions/JsonPathMethods.cs`
- `JLio.Commands/Logic/PropertyChangeCommand.cs`
- `JLio.Commands/Logic/CopyMove.cs`

Control-oriented and advanced transformations include conditional branches, decision tables, comparison, and merge:
- `JLio.Commands/IfElse.cs`
- `JLio.Commands/DecisionTable.cs`
- `JLio.Commands/Advanced/Merge.cs`

#### Function and Extension-Pack Model
Functions evaluate literals, nested expressions, and JSONPath-referenced values during command execution. Base functions cover fetch/indirection/script-relative paths; optional packs add domain capabilities and are registered as packs rather than hardwired into core.
- `JLio.Functions/Fetch.cs`
- `JLio.Extensions.Math/RegisterMathPack.cs`
- `JLio.Extensions.Text/RegisterTextPack.cs`

Additional packs provide date/time functions, JSON-schema ordering/filtering, and ETL transformations such as flatten, resolve, restore, and CSV serialization.
- `JLio.Extensions.TimeDate/RegisterTimeDatePack.cs`
- `JLio.Extensions.JSchema/RegisterJSchemaPack.cs`
- `JLio.Extensions.ETL/RegisterETLPack.cs`

#### Validation and MCP Integration
Pre-execution validation is a separate subsystem: script validation applies command specifications and JSONPath validation, yielding structured issues rather than coupling validation to execution.
- `JLio.Validation/JLioScriptValidator.cs`
- `JLio.Validation/Commands/ICommandSpec.cs`
- `JLio.Validation/Paths/BasicJsonPathValidator.cs`

The MCP executable wraps engine creation and exposes tool groups for search, reference material, script proposal, and JLio operations. No external datastore or web application is represented; material runtime infrastructure is .NET/NuGet, GitHub Actions CI/release workflows, and an MCP-compatible host.
- `JLio.MCP/JLioEngineFactory.cs`
- `JLio.MCP/JLioTools.cs`
- `.github/workflows/ci.yml`

Main entry points: [`JLio.CLient/JLioEngine.cs`](https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngine.cs) (JLioEngine), [`JLio.CLient/JLioEngineBuilder.cs`](https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngineBuilder.cs) (Engine Builder), [`JLio.Commands/Logic/PropertyChangeCommand.cs`](https://github.com/nexxbiz/jlio/blob/main/JLio.Commands/Logic/PropertyChangeCommand.cs) (Mutation Commands), [`JLio.Core/Models/ExecutionContext.cs`](https://github.com/nexxbiz/jlio/blob/main/JLio.Core/Models/ExecutionContext.cs) (Execution Context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client API"]
  node_convert["JLioConvert<br/>embedding API<br/>[JLioConvert.cs]"]
  node_builder["Engine Builder<br/>engine assembly"]
  node_engine["JLioEngine<br/>execution engine<br/>[JLioEngine.cs]"]
  node_versioned["Versioned Engine<br/>compatibility boundary"]
  node_configurations["Engine Configurations"]
end

subgraph group_core["Core Runtime"]
  node_converters["Command &amp; Function Conversion<br/>script parser"]
  node_providers["Function Provider<br/>extension registry"]
  node_execution["Execution Context<br/>runtime state"]
  node_result["Execution Result &amp; Log<br/>outcome"]
  node_jsonpath["JSONPath Selection<br/>addressing layer<br/>[JsonPathMethods.cs]"]
end

subgraph group_capabilities["Commands &amp; Functions"]
  node_commands["Mutation Commands<br/>ICommand implementations"]
  node_control["Control Transformations<br/>advanced commands<br/>[IfElse.cs]"]
  node_functions["Base Functions<br/>IFunction implementations<br/>[Fetch.cs]"]
  node_packs["Optional Extension Packs<br/>capability packs<br/>[RegisterETLPack.cs]"]
end

subgraph group_integration["Validation &amp; MCP"]
  node_validator["Script Validator<br/>pre-execution validation"]
  node_mcp{{"MCP Host<br/>MCP executable<br/>[Program.cs]"}}
  node_mcpfactory["MCP Engine Factory<br/>host composition"]
end

node_script["Script JSON / JLioScript<br/>input"]
node_token["Newtonsoft JToken<br/>JSON data"]

node_script -->|"parse"| node_convert
node_convert -->|"constructs"| node_builder
node_builder -->|"applies"| node_configurations
node_builder -->|"registers"| node_providers
node_builder -->|"builds"| node_engine
node_configurations -->|"versions"| node_versioned
node_versioned -->|"selects"| node_engine
node_engine -->|"parses via"| node_converters
node_converters -->|"resolves runtime types"| node_providers
node_engine -->|"executes with"| node_execution
node_token -->|"supplies mutable state"| node_execution
node_execution -->|"runs"| node_commands
node_commands -->|"selects targets"| node_jsonpath
node_commands -->|"evaluates values"| node_functions
node_control -->|"evaluates conditions"| node_functions
node_packs -->|"register with"| node_providers
node_engine -->|"returns"| node_result
node_script -.->|"validates before execution"| node_validator
node_validator -.->|"checks paths"| node_jsonpath
node_mcp -->|"starts"| node_mcpfactory
node_mcpfactory -->|"creates engine"| node_builder
node_mcp -->|"invokes JLio operations"| node_engine

click node_convert "https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioConvert.cs"
click node_builder "https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngineBuilder.cs"
click node_engine "https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngine.cs"
click node_versioned "https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioVersionedEngine.cs"
click node_configurations "https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngineConfigurations.cs"
click node_converters "https://github.com/nexxbiz/jlio/blob/main/JLio.Core/CommandConverter.cs"
click node_providers "https://github.com/nexxbiz/jlio/blob/main/JLio.Core/FunctionsProvider.cs"
click node_execution "https://github.com/nexxbiz/jlio/blob/main/JLio.Core/Models/ExecutionContext.cs"
click node_result "https://github.com/nexxbiz/jlio/blob/main/JLio.Core/Models/JLioExecutionResult.cs"
click node_jsonpath "https://github.com/nexxbiz/jlio/blob/main/JLio.Core/Extensions/JsonPathMethods.cs"
click node_commands "https://github.com/nexxbiz/jlio/blob/main/JLio.Commands/Logic/PropertyChangeCommand.cs"
click node_control "https://github.com/nexxbiz/jlio/blob/main/JLio.Commands/IfElse.cs"
click node_functions "https://github.com/nexxbiz/jlio/blob/main/JLio.Functions/Fetch.cs"
click node_packs "https://github.com/nexxbiz/jlio/blob/main/JLio.Extensions.ETL/RegisterETLPack.cs"
click node_validator "https://github.com/nexxbiz/jlio/blob/main/JLio.Validation/JLioScriptValidator.cs"
click node_mcp "https://github.com/nexxbiz/jlio/blob/main/JLio.MCP/Program.cs"
click node_mcpfactory "https://github.com/nexxbiz/jlio/blob/main/JLio.MCP/JLioEngineFactory.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_convert,node_builder,node_engine,node_versioned,node_configurations toneBlue
class node_converters,node_providers,node_execution,node_result,node_jsonpath toneAmber
class node_commands,node_control,node_functions,node_packs toneMint
class node_validator,node_mcp,node_mcpfactory toneRose
class node_script,node_token toneNeutral
```

## Components

### Client API

- [JLioConvert](https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioConvert.cs): embedding API · `JLio.CLient/JLioConvert.cs`
- [Engine Builder](https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngineBuilder.cs): engine assembly · Registers command and function capabilities. · `JLio.CLient/JLioEngineBuilder.cs`
- [JLioEngine](https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngine.cs): execution engine · Parses scripts and runs command sequences. · `JLio.CLient/JLioEngine.cs`
- [Versioned Engine](https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioVersionedEngine.cs): compatibility boundary · Isolates registered capability sets by version. · `JLio.CLient/JLioVersionedEngine.cs`
- [Engine Configurations](https://github.com/nexxbiz/jlio/blob/main/JLio.CLient/JLioEngineConfigurations.cs): engine configuration · `JLio.CLient/JLioEngineConfigurations.cs`

### Core Runtime

- [Command & Function Conversion](https://github.com/nexxbiz/jlio/blob/main/JLio.Core/CommandConverter.cs): script parser · Converts script notation into runtime objects. · `JLio.Core/CommandConverter.cs`
- [Function Provider](https://github.com/nexxbiz/jlio/blob/main/JLio.Core/FunctionsProvider.cs): extension registry · Resolves registered functions and commands. · `JLio.Core/FunctionsProvider.cs`
- [Execution Context](https://github.com/nexxbiz/jlio/blob/main/JLio.Core/Models/ExecutionContext.cs): runtime state · Carries current and root token state. · `JLio.Core/Models/ExecutionContext.cs`
- [Execution Result & Log](https://github.com/nexxbiz/jlio/blob/main/JLio.Core/Models/JLioExecutionResult.cs): outcome · Returns transformed data and execution logging. · `JLio.Core/Models/JLioExecutionResult.cs`
- [JSONPath Selection](https://github.com/nexxbiz/jlio/blob/main/JLio.Core/Extensions/JsonPathMethods.cs): addressing layer · Parses and selects mutation targets. · `JLio.Core/Extensions/JsonPathMethods.cs`

### Commands & Functions

- [Mutation Commands](https://github.com/nexxbiz/jlio/blob/main/JLio.Commands/Logic/PropertyChangeCommand.cs): ICommand implementations · Add, set, put, remove, copy, and move selected JSON values. · `JLio.Commands/Logic/PropertyChangeCommand.cs`
- [Control Transformations](https://github.com/nexxbiz/jlio/blob/main/JLio.Commands/IfElse.cs): advanced commands · Conditional, decision-table, comparison, and merge behavior. · `JLio.Commands/IfElse.cs`
- [Base Functions](https://github.com/nexxbiz/jlio/blob/main/JLio.Functions/Fetch.cs): IFunction implementations · Evaluates literals, expressions, and path-referenced values. · `JLio.Functions/Fetch.cs`
- [Optional Extension Packs](https://github.com/nexxbiz/jlio/blob/main/JLio.Extensions.ETL/RegisterETLPack.cs): capability packs · Math, text, date/time, schema, and ETL functions. · `JLio.Extensions.ETL/RegisterETLPack.cs`

### Validation & MCP

- [Script Validator](https://github.com/nexxbiz/jlio/blob/main/JLio.Validation/JLioScriptValidator.cs): pre-execution validation · Produces structured command and JSONPath issues. · `JLio.Validation/JLioScriptValidator.cs`
- [MCP Host](https://github.com/nexxbiz/jlio/blob/main/JLio.MCP/Program.cs): MCP executable · Exposes JLio operations and script tooling as MCP tools. · `JLio.MCP/Program.cs`
- [MCP Engine Factory](https://github.com/nexxbiz/jlio/blob/main/JLio.MCP/JLioEngineFactory.cs): host composition · `JLio.MCP/JLioEngineFactory.cs`

### Other components

- **Script JSON / JLioScript**: input · Declarative transformation program.
- **Newtonsoft JToken**: JSON data · Mutable source and result document.

## Connections

- Script JSON / JLioScript → JLioConvert: parse
- JLioConvert → Engine Builder: constructs
- Engine Builder → Engine Configurations: applies
- Engine Builder → Function Provider: registers
- Engine Builder → JLioEngine: builds
- Engine Configurations → Versioned Engine: versions
- Versioned Engine → JLioEngine: selects
- JLioEngine → Command & Function Conversion: parses via
- Command & Function Conversion → Function Provider: resolves runtime types
- JLioEngine → Execution Context: executes with
- Newtonsoft JToken → Execution Context: supplies mutable state
- Execution Context → Mutation Commands: runs
- Mutation Commands → JSONPath Selection: selects targets
- Mutation Commands → Base Functions: evaluates values
- Control Transformations → Base Functions: evaluates conditions
- Optional Extension Packs → Function Provider: register with
- JLioEngine → Execution Result & Log: returns
- Script JSON / JLioScript → Script Validator: validates before execution
- Script Validator → JSONPath Selection: checks paths
- MCP Host → MCP Engine Factory: starts
- MCP Engine Factory → Engine Builder: creates engine
- MCP Host → JLioEngine: invokes JLio operations
