Skip to content
CAI
Software that uses CAICheck a score

yippee-fun/phlex

51.9

Adequate · 6 November 2026

7.1k

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Phlex is a Ruby library for generating HTML, SVG, and CSV content using a component-based DSL. It features a high-performance compiler that transforms template code into optimized runtime equivalents, alongside built-in security measures against XSS and CSV injection. The system supports fragment caching, selective rendering, and integrates with Ruby LSP for improved developer tooling.

How it got here

2022 — Phlex v2 architectural rewrite

9 changes.

The project underwent a major architectural rewrite for version 2, replacing the legacy component model with a new SGML-based engine featuring a high-performance compiler and Zeitwerk autoloading. This period also involved modernizing the development workflow by switching to the Quickdraw test framework, updating dependencies for Ruby 3.2+, and introducing new features like CSV generation and fragment caching.

2023–2024 — SGML rewrite and test expansion

9 changes.

The project underwent a significant rewrite of the SGML rendering engine to enhance security, performance, and correctness, introducing dedicated attribute validation and efficient buffer management. This core update was accompanied by the addition of standard SVG element definitions and a comprehensive expansion of the test suite using the Quickdraw framework to cover HTML, SVG, and helper functionality.

2025–2026 — Compiler rewrite and indexing stability

5 changes.

The project rewrote the Phlex compiler to introduce an explicit intermediate representation, ensuring exact runtime equivalence and adding support for new HTML helpers and diagnostics. This effort was accompanied by comprehensive test coverage for compilation behavior and the addition of a RubyLSP addon to enhance indexing stability for Phlex components.

Features

Add Phlex SVG standard element definitions

The library now includes \lib/phlex/svg/standard\_elements.rb\, which registers a comprehensive set of standard SVG elements (such as \\<a\>\, \\<circle\>\, \\<defs\>\, and various filter primitives like \\<feBlend\>\) as Phlex components. This enables users to render these specific SVG tags using the Phlex DSL with appropriate attribute support.

lib/phlex/svg · high confidence

Add Phlex addon for RubyLSP indexing

A new Phlex addon has been added to RubyLSP to enhance indexing stability. The addon registers an \IndexingEnhancement\ that detects calls to \register\_element\ and automatically adds the corresponding method signatures to the index, allowing the language server to provide better autocomplete and navigation 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. These components, built on Phlex::HTML, provide reusable templates for testing purposes, with Components::SayHi demonstrating parameterized rendering and composition by including Components::Article.

fixtures/components · 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

Compiler rewritten for exact runtime equivalence

The HTML compiler has been rewritten to ensure that compiled output is exactly equivalent to runtime execution. This change introduces a comprehensive test harness in \quickdraw/compilation\_equivalence\_cases\ that validates the compiler against a wide range of scenarios, including complex attribute handling (arrays, sets, hashes, dynamic values), control flow (conditionals, loops, blocks), interpolation, fragments, caching, and error handling. The diff shows numerous new test cases covering edge cases like mutating attribute values, thrown exceptions, custom elements, and lexical constant resolution, ensuring the compiler faithfully reproduces the behavior of the interpreted runtime.

_quickdraw/compilation\_equivalence\cases · high confidence

Migration to Zeitwerk autoloading and new top-level DSL methods

The library has replaced its previous autoloading mechanism with Zeitwerk, configuring the loader to ignore specific directories (ruby\_lsp, compiler/scope) and setting up custom inflections for acronyms like CSV, FIFO, and SVG. This change introduces top-level convenience methods Phlex.html and Phlex.svg, which allow users to generate HTML or SVG strings directly from a block by instantiating the respective component classes and transferring instance variables from the calling context. Additionally, the old Component module file has been removed, and the main entry point now requires standard libraries like date, erb, and set, while exposing a global constant 💪 that references the Phlex module.

lib · high confidence

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

Phlex has been upgraded to version 2.4.1, introducing a major architectural shift from the previous 0.x API. The rendering engine is now built on a new \Phlex::SGML\ base class that replaces the old \Phlex::Component\ and \Phlex::Context\ abstractions. A new opt-in compiler (\Phlex::Compiler\) rewrites component methods ahead of time to replace element calls with direct buffer appends, significantly improving performance. The library now includes a built-in \Phlex::CSV\ generator with CSV injection protection, a \Phlex::FIFOCacheStore\ for fast in-memory caching, and a \Phlex::Kit\ system for grouping and rendering components. The public API has changed: \template\ is now \view\_template\, \text\ is now \plain\, and \render\ is now \call\. Additionally, the library now supports fragment caching, dynamic tags, and SVG generation via \Phlex::SVG\.

lib/phlex · high confidence

Project initialization and configuration for Phlex v2

The repository has been restructured for the v2 release, replacing the previous Rake-based test setup with a new workflow using the Quickdraw test framework and the Mise task runner. A new RuboCop configuration enforces tab-based indentation and targets Ruby 3.2+, while a dedicated SECURITY.md file establishes a private advisory process for vulnerabilities. Documentation has been updated to reflect the switch from SemVer to BreakVer, and the previous CHANGELOG.md has been removed.

(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

Rewritten SGML rendering engine with improved security and performance

The SGML rendering layer has been rewritten to improve security, performance, and correctness. Attribute generation is now handled by a dedicated module that validates names against unsafe patterns (such as event handlers) and safely serializes values, including support for Date, Time, and objects responding to to\_h. A new SafeObject/SafeValue system ensures that pre-escaped content is rendered without double-escaping. Element rendering now uses a state object to manage buffers, capturing, and fragment caching more efficiently, reducing allocations and fixing issues with cached fragment offsets and buffer flushes. Normalizers for specific elements (img, link, input) handle complex attribute transformations like srcset and media queries.

lib/phlex/sgml · high confidence

Rewritten compiler with explicit IR and runtime-equivalence guarantees

The Phlex compiler has been rewritten to produce code that is exactly equivalent to the runtime, introducing an intermediate representation (IR) via the new \Refract\ node system. This change brings several user-facing improvements: the compiler now supports \whitespace\, \doctype\, \plain\, \comment\, and \raw\ helpers; it handles void elements and interpolated strings in content blocks; and it preserves \\_\FILE\\_\ and refinements correctly within compiled methods. Additionally, the compiler now provides detailed diagnostics explaining why certain code was left to the runtime or refused compilation, and it supports selective rendering and source maps for better debugging.

lib/phlex/compiler · high confidence

Simplified development workflow with new test and coverage scripts

The repository now provides dedicated \bin/test\ and \bin/coverage\ scripts to streamline local development. Running \bin/test\ executes the Quickdraw test suite, Rubocop linting, and browser tests in a single step, while \bin/coverage\ generates and opens an HTML coverage report. The legacy \bin/setup\ script has been removed, and \bin/console\ has been refactored to directly launch IRB with the Phlex library loaded, removing unnecessary bundler setup boilerplate.

bin · high confidence

Test coverage

Add Quickdraw test configuration with coverage support; Add fixture components and XSS test vectors; Added compiler diagnostics and lifecycle tests; Added test coverage for HTML rendering features; Added test coverage for Quickdraw helper methods; Added test suite for Quickdraw testing framework; Added test suite for SGML rendering behavior; Added tests for SVG standard elements; Removed Minitest-based test suite.

Dependencies

Update gem dependencies and metadata

The project now sources gems from gem.coop instead of rubygems.org and adds development dependencies including quickdraw, simplecov, selenium-webdriver, rubocop, ruby-lsp, and benchmark-ips, along with runtime dependencies on nokogiri, zeitwerk (\~\> 2.7), and refract (\~\> 1.0). The gemspec also updates the required Ruby version to \>= 3.2, adds a new author, updates the homepage and repository URLs, and includes metadata for funding and mailing list.

(dependencies) · high confidence

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

How this codebase got here

Score

  • CAI 52 → 52 (-0.4)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 61 → 61 (+0.0)
  • Architecture 87 → 85 (-2.0)
  • Maturity 46 → 46 (+0.0)
  • Readiness 44 → 44 (+0.0)
  • Security 83 → 77 (-6.6)
  • Performance 80 → 80 (+0.0)

Resolved (3)

  • Ambiguous public exposure of internal rendering mechanics. internal_call is exposed as a public method but its name and signature strongly suggest it is an internal implementation detail used by the framework's rendering engine, not a user-facing API. Exposing it alongside render creates confusion about the correct way to programmatically render components.
  • Documentation: no installation or build instructions (README.md)
  • Redundant caching methods with unclear distinction. low_level_cache appears to be a wrapper or variant of cache but exposes an options parameter. Without documentation, it is unclear if cache is a simplified version of low_level_cache or if they serve distinct performance/security purposes. This creates confusion for users choosing between the two.

Written by cca.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 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit fdfb78eb819dc2be9fc4dc9c06e6bb03e2de33e3 — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.