Skip to content
CAI
Software that uses CAICheck a score

yippee-fun/phlex

59.1

Adequate · 19 September 2026

3.9k

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Phlex is a Ruby library that generates HTML, SVG, and CSV output using a compiled rendering engine for high performance. It provides an inline DSL for defining templates, featuring automatic autoloading, strict XSS sanitization, and support for fragment caching. The system includes specialized classes for SGML-based rendering, CSV generation with injection protection, and in-memory caching, all supported by a modernized development workflow and test suite.

How it got here

2022 — Phlex v2 architectural rewrite

11 changes.

The project underwent a major architectural rewrite for version 2, shifting from a component-based model to an SGML-based rendering engine with a new compiler. This period involved restructuring the codebase to use Zeitwerk for autoloading, replacing the test suite with Quickdraw and Sus, and introducing features like CSV support and XSS protection.

2023–2024 — SVG support and SGML security refactoring

8 changes.

This period focused on extending Phlex to support SVG elements and refactoring the SGML rendering engine to improve security through strict attribute validation and XSS prevention. Comprehensive test coverage was added across HTML, SVG, and helper modules to verify the new functionality and ensure robust behavior for core rendering features.

2025 — Phlex compiler and LSP integration

4 changes.

This period focused on introducing a new compilation pipeline for Phlex to optimize HTML generation and enhance performance by replacing interpretation-based rendering. Concurrently, a RubyLSP addon was developed to improve indexing stability for Phlex components by automatically detecting element registrations.

Features

Add Phlex addon for RubyLSP indexing

A new RubyLSP addon for the Phlex library has been added to improve indexing stability. This addon includes an indexing enhancement that detects calls to \register\_element\ and automatically registers the corresponding method signatures in the Ruby indexer, enabling better code navigation and autocomplete for Phlex components.

_lib/ruby\lsp · high confidence

Add fixture components for testing

New fixture components, Components::Article and Components::SayHi, have been added to the fixtures/components directory. Components::Article provides a simple wrapper for an HTML article element, while Components::SayHi accepts a name and repetition count to render multiple headings within an article, facilitating component testing.

fixtures/components · high confidence

Initial support for SVG elements in Phlex

This change introduces the \Phlex::SVG::StandardElements\ module, which registers a comprehensive set of standard SVG tags (such as \\<a\>\, \\<circle\>\, \\<defs\>\, and various filter primitives like \\<feBlend\>\) as Phlex components. Users can now render these SVG elements directly within their Phlex views, extending the library's capabilities beyond standard HTML to include full SVG markup support.

lib/phlex/svg · high confidence

Introduction of a new Phlex compiler for optimized HTML generation

The library now includes a new compilation pipeline (lib/phlex/compiler) that transforms Phlex component definitions into optimized Ruby code. This system, comprising ClassCompiler, FileCompiler, MethodCompiler, and Compactor, enables significant performance improvements by pre-compiling HTML structures. The compiler supports standard and void HTML elements, attributes, blocks, and specific helpers like whitespace, doctype, plain, comment, and raw. It also handles interpolated strings, source maps for debugging, and selective rendering optimizations, effectively replacing or augmenting the previous interpretation-based rendering path with a faster, compiled alternative.

lib/phlex/compiler · high confidence

Behavioural changes

Added fixture for testing selective rendering in compiled components

A new fixture file (quickdraw/fixtures/standard\_element\_example.rb) has been added to support the new selective rendering capability in compiled components. This fixture defines a Phlex HTML component that includes various DOM elements, comments, and specific fragment targets (e.g., 'target', 'image') to facilitate testing how the rendering engine selectively updates parts of the DOM.

quickdraw/fixtures · high confidence

Adopts Zeitwerk for autoloading and introduces inline DSL helpers

The library now uses Zeitwerk for class autoloading, replacing the previous custom loader and removing the empty \Component\ module. This change introduces \Phlex.html\ and \Phlex.svg\ methods that allow users to generate HTML and SVG strings directly via an inline DSL, automatically capturing instance variables from the calling context. Additionally, the codebase switches to \ERB::Escape\ for HTML escaping and adds a \💪\ shorthand method to access the \Phlex\ module.

lib · high confidence

Phlex 2.4.1: Complete architectural rewrite with compiler, CSV support, and new caching

Phlex has been upgraded to version 2.4.1, introducing a major architectural shift from the previous component-based model to a new SGML-based rendering engine. The old \Phlex::Component\, \Phlex::Context\, and \Phlex::Tag\ classes have been removed and replaced by \Phlex::SGML\, which manages rendering state and buffers directly. A new \Phlex::Compiler\ has been added, utilizing the Prism and Refract libraries to parse and compile Ruby source files into optimized execution paths. The library now includes a dedicated \Phlex::CSV\ class for generating CSV files with configurable delimiters and CSV injection protection, as well as a high-performance \Phlex::FIFOCacheStore\ for in-memory caching. Additionally, the \Phlex::Kit\ module has been re-implemented to support lazy loading of components and nested kits, while the \Phlex::HTML\ and \Phlex::SVG\ classes now inherit from \SGML\ and provide specialized tag handling and CDATA support.

lib/phlex · high confidence

Project initialization and configuration for Phlex v2

The repository has been restructured for the v2 release, introducing a new development workflow and security posture. A \mise.toml\ configuration now manages tooling and tasks (test, lint, bench), replacing the previous \Rakefile\. Code style is enforced via a new \.rubocop.yml\ inheriting from \goodcop.style\ with tab indentation, alongside a \.editorconfig\ for consistent formatting. Security is formalized with a \SECURITY.md\ outlining private vulnerability reporting. The test suite has migrated to the \quickdraw\ framework (with tests in the \quickdraw\ folder), and browser-based XSS tests have been added to validate input sanitization. Documentation is now hosted at \phlex.fun\, and the project has adopted BreakVer for versioning.

(repo-wide) · high confidence

Refactored HTML element registration into dedicated modules

The library has reorganized how HTML elements are defined and registered. The previous single \tags.rb\ file containing a static list of element names has been removed and replaced with two new modules: \StandardElements\ (for elements that accept content and have closing tags) and \VoidElements\ (for self-closing elements). This change introduces new element support, including \canvas\, \fencedframe\ (experimental), and \selectedcontent\, while removing deprecated or obsolete elements such as \menuitem\, \param\, and \portal\. Users will now interact with these elements through the new module structure, which also includes improved documentation and LSP support for better developer experience.

lib/phlex/html · high confidence

Removal of Phlex RBS signature file

The RBS type signature file for the Phlex module has been removed from the repository. This eliminates static type definitions for the Phlex version constant, affecting tools that rely on RBS for type checking or documentation generation within this specific signature location.

sig · high confidence

SGML rendering engine refactored with new security and state management

The SGML rendering layer has been restructured to improve security and performance. Attribute generation is now handled by a dedicated module that enforces strict validation, blocking unsafe attribute names (like event handlers) and sanitizing URL-based attributes to prevent XSS attacks. The rendering state has been consolidated into a new \State\ object, which manages capturing, fragment caching, and output buffering. Additionally, the system now supports 'safe values' via a \SafeObject\ interface, allowing pre-escaped content to be rendered without double-escaping, and introduces support for comma-separated token attributes (e.g., \srcset\, \media\) that automatically handle array inputs.

lib/phlex/sgml · high confidence

Streamlined development workflow with new test and coverage scripts

The repository's development workflow has been restructured to simplify local testing and reporting. A new \bin/test\ script now automates the execution of the test suite (via \qt\ and \sus\), linting (\rubocop\), and browser tests in a single command. A \bin/coverage\ script has been added to generate and open code coverage reports. The previous \bin/setup\ script has been removed, and \bin/console\ has been simplified to directly launch an IRB session with the library loaded, removing bundler setup boilerplate.

bin · high confidence

Test coverage

Add fixture components and XSS test vectors; Added Quickdraw test suite for Phlex core features; Added compilation equivalence test cases for new template features; Added comprehensive test suite for SGML rendering behavior; Added test coverage for HTML rendering components; Added test coverage for Quickdraw helper methods; Added tests for SVG standard elements; Added tests for custom elements and XSS prevention; New test configuration files for Quickdraw and Sus runners; Removed Minitest-based test suite.

Dependencies

Update gem dependencies and metadata

The project has updated its dependency configuration by switching the Ruby gem source to gem.coop and adding new development and test dependencies including sus, quickdraw, simplecov, selenium-webdriver, rubocop, ruby-lsp, and benchmark-ips. The gemspec now specifies a minimum Ruby version of 3.2, adds runtime dependencies on zeitwerk (\~\> 2.7) and refract (\~\> 1.0), and updates metadata such as the homepage, source code URI, and funding information.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 59.

Lenses

  • Code Health 94
  • Architecture 99
  • Maturity 43
  • Readiness 59
  • Security 81

Changes since last survey

  • 300 commits — 268 feature/other, 32 fixes

By area

  • lib/phlex — 165 commits
  • (root) — 41 commits
  • (repo) — 39 commits
  • .github/workflows — 14 commits
  • quickdraw/sgml — 10 commits
  • lib/phlex.rb — 8 commits
  • quickdraw/compilation_equivalence_cases — 4 commits
  • quickdraw/csv.test.rb — 3 commits
  • config/quickdraw.rb — 2 commits
  • quickdraw/fifo.test.rb — 2 commits
  • quickdraw/html — 2 commits
  • test/phlex — 2 commits
  • bin/console — 1 commit
  • fixtures/components.rb — 1 commit
  • fixtures/page.rb — 1 commit
  • lib/ruby_lsp — 1 commit
  • quickdraw/attribute_cache_expansion.test.rb — 1 commit
  • quickdraw/erb.test.rb — 1 commit
  • quickdraw/svg — 1 commit
  • sig/phlex.rbs — 1 commit

Notable commits

  • fix: :rotating_light: Fix warning: assigned but unused variable - k
  • fix: :rotating_light: Fix warning: assigned but unused variable - k (#953)
  • fix: Detect and fix invalid autoloads
  • fix: Fix BlackHole reference in vanish
  • fix: Fix Kit rendering context error when render? is false
  • fix: Fix Kit rendering context error when render? is false (#980)
  • fix: Fix MDN Doc links
  • fix: Fix Rubocop
  • fix: Fix Rubocop issues
  • fix: Fix Ruby 4.0 warning in default before_template and after_template (#986)
  • fix: Fix Ruby 4.0 warning: default before_template/after_template now accept a block
  • fix: Fix XSS issues
  • fix: Fix mix to accept old or new nil values (#780)
  • fix: Fix a bug when nesting attributes more than two levels with hashes
  • fix: Fix an attribute serialization bug when using nested attributes with symbol values
  • fix: Fix an issue with include multiple Phlex Kits (#794)
  • fix: Fix call node formatter
  • fix: Fix compilation error on empty blocks
  • fix: Fix component kit rendering context
  • fix: Fix component kit rendering context (#971)
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

yippee-fun/phlex was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit b787d0bad3cff3bea7560f6876c46b0cb4737600 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.