How neilmacmullen/textrude works
Main Components
• Core Engine Layer – This is represented by the “Engine” directory, which houses the processing logic. It includes submodules for:
• Application processing (e.g., ApplicationEngine.cs, TemplateManager.cs, ScriptLoader.cs)
• Extensions (e.g., DebugMethods, TextrudeMethods, TimeRange recognizer logic)
• Model deserialization and representation (using specialized deserializers for CSV, JSON, YAML)
• Template processing and pre-processing
• CLI Tools – The “Textrude” directory contains the command implementations (e.g., CmdDo, CmdRender, CmdRenderFromFile, etc.), which interact with the engine for command-line operations.
• Interactive UI – The “TextrudeInteractive” project (a WPF-based application) provides a visual interface for rapid prototyping and interactive template development.
• Shared Components – The “SharedApplication” directory provides common utilities like command-line builders, file handling, and other shared functionality across the CLI and UI tools.
• Query and Script Library – Additional projects (“Query” and “ScriptLibrary”) handle specialized processing or provide script libraries to extend Textrude’s capabilities.
• Build & Testing Infrastructure – The “build” directory outlines tasks for building, packaging, and testing. The “Tests” folder houses the comprehensive unit tests that validate the system’s behavior.
Relationships and Interactions
• Data Input – External data files (CSV, JSON, YAML, plain text) are the inputs. These enter the system via file system operations (evident from classes like ConsoleFileSystem, WebFileSystem, HybridFileSystem) and are handed off to the engine.
• Core Processing – The Engine reads the model, utilizes the model deserializers, applies Scriban templates (using Scriban library integration), and produces output text/code.
• Output Generation – Output from the core engine is directed back to file systems or standard output – with dependency checking and template re-use included as features.
• External Libraries – It is important to visually indicate integration with external dependencies such as Scriban (templating), CsvHelper, YamlDotNet, Json.Net, and Humanizer as “service blocks” used by the Engine.
Architectural Patterns and Design Principles
• Layered Architecture – Separate the system into layers: UI/CLI layer, core engine layer (with submodules for model parsing, processing, templating), and supporting services (file operations and shared utilities).
• Modularity – Indicate how the Engine is designed to be extended (see the Extensions folder) and how there is a separation between concerns (e.g., model deserialization is clearly separated, and the template processing module is standalone).
• Reuse and Dependency Injection – Although not explicitly detailed, the utilitarian structure (like ModelDeserializerFactory, TemplateManager, etc.) suggests a design where decoupling and reusability are prioritized.
• Within the Core Engine layer, partition it into submodules that reflect the directories – Application, Extensions, Model, and TemplateProcessing.
• That both the CLI and UI projects interact with the Core Engine and the SharedApplication library.
• Optionally, note the testing and build process as supporting elements that ensure quality and deployment—they might be represented off to the side but clearly linked to the core components.