-
Notifications
You must be signed in to change notification settings - Fork 0
Contributor Manual
harish2222 edited this page Jun 18, 2026
·
2 revisions
Welcome to the Forgum project! This manual details the internal architecture to help contributors understand how the system works and how to extend it.
Forgum is a pure PowerShell module optimized for performance, security, and cross-platform compatibility.
The root module dots-sources functions from the Public/ and Private/ directories.
-
Public Functions: Exported cmdlets intended for end-user interaction (e.g.,
Invoke-Forgum,Set-Forgum). - Private Functions: Internal helper functions for text formatting, color generation, and animation logic.
- Initialization: Handles Virtual Terminal (VT) processing setup on Windows to ensure 24-bit color support.
Forgum utilizes a script-scoped caching system ($script:CowFileCache, $script:FortuneCache) to minimize disk I/O.
- Configuration: The configuration is managed as a JSON object, cached in memory with a Time-To-Live (TTL) to ensure responsiveness while allowing for external updates.
- Atomic Writes: Updates to the configuration file use temporary files and atomic move operations to prevent data corruption.
The rendering engine is built using [System.Text.StringBuilder] for efficient string manipulation.
-
Colorization: The
Format-Lolcat.ps1logic implements a high-performance rainbow colorization algorithm compatible with ANSI truecolor. -
Animation: Animations are coordinated through
Show-CFAnimation.ps1, which utilizes frame-based rendering and precise timing loops.
- Modify functions in
Private/orPublic/. - Follow the Coding Style mandates in
GEMINI.md: strict typing, validation attributes, and comprehensive help blocks. - Ensure all changes are verified with the Pester test suite.
Forgum maintains a high-coverage test suite using Pester 5.
-
Comprehensive Tests:
Tests/Comprehensive.Tests.ps1validates the Permutation Matrix (Cow × Eyes × Animation). -
Security Checks: Automated audits ensure no use of
Invoke-Expressionand validate safe path resolution. - Benchmark Suite: Every release is benchmarked to ensure zero performance regression.