Skip to content

architecture

2CHEVSKII edited this page Jul 10, 2026 · 1 revision

Architecture

gly is built around PowerShell's native formatting pipeline.

Format Data

The standard FileInfo and DirectoryInfo table view is implemented in:

src/formats/FileSystem.format.ps1xml

The format data is loaded with:

Update-FormatData -PrependPath

PowerShell format data is session-wide. It can remain active after Remove-Module gly until the PowerShell session ends.

Module Initialization

src/gly.psm1:

  • parses module types and functions as one combined script block to minimize import overhead;
  • initializes configuration;
  • registers compact built-in theme and glyph-set definitions;
  • calls Enable-Gly.

Built-in theme and glyph-set rules are expanded into detached strongly typed objects only when a registry command returns them. Formatting uses compact immutable definitions directly. Themes and fallback glyph sets use only essential structural rules; Nerd Fonts and Emoji use the complete selector catalog.

Rule Resolution

Themes and glyph sets use the same selector model:

  • Kind
  • Name
  • Extension
  • Glob
  • Attributes

Rules are evaluated from top to bottom. The last matching rule wins.

The built-in resolver indexes kinds, extensions, exact names, globs, and attributes once. User-registered rules retain the general selector evaluator and the same precedence semantics.

The resolver does not read file contents, does not run Git commands, and does not perform expensive file system lookups in the hot path.

Strongly Typed Models

Module state uses PowerShell classes declared in src/GlyTypes.ps1:

  • GlyConfiguration;
  • GlyTheme, GlyThemeRule, GlyStyle;
  • GlyGlyphSet, GlyGlyphRule;
  • GlySelector.

Registration commands still accept hashtables and pscustomobject values. Input is validated and converted before it reaches a registry. Getter and copy commands return detached typed copies, so callers cannot mutate a built-in registry entry through a returned object.

Built-in themes, ANSI, ANSICompact, and Unicode intentionally register only essential structural rules. Nerd Fonts and Emoji use the complete selector catalog.

Session State

The MVP stores state in memory only:

  • active configuration;
  • registered themes;
  • registered glyph sets;
  • format data load flag.

Persistent user configuration is intentionally out of scope for the MVP.

Clone this wiki locally