Skip to the content.

aifmt

Make visual text content just work.

An MCP server + Copilot CLI plugin that fixes, validates, and generates visual text content β€” boxes, tables, bars, tree diagrams β€” for AI coding assistants.

The Problem

LLMs generate text token-by-token with no concept of column alignment. len("πŸ“¦") returns 1, but the character renders wider on screen. This causes every AI-generated box, table, and tree diagram to be misaligned.

Before (LLM output β€” borders don’t line up):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Status: deployed     β”‚
β”‚ Tests: 142 passing β”‚
β”‚ Coverage: 98.5%       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

After fix(content, mode="boxes"):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Status: deployed   β”‚
β”‚ Tests: 142 passing β”‚
β”‚ Coverage: 98.5%    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

aifmt replaces len() with rendering-profile-aware visual width measurement so alignment is always correct.

Key Discovery: GitHub Emoji = 2.5 Columns

Through empirical testing, we discovered that GitHub renders emoji at 2.5 monospace columns β€” not the 2.0 that Unicode specifies and terminals use.

Platform Emoji width CJK width
Terminal emulators 2.0 cols 2.0 cols
GitHub markdown 2.5 cols 2.0 cols

This has a critical consequence:

aifmt detects this and emits ⚠ warnings instead of silently producing broken output.

Read the full discovery story β†’

MCP Tools

Tool Description
fix Repair misaligned boxes, tables, bars, and tree diagrams
validate Check for alignment issues without modifying
generate Create diagrams via Mermaid or PlantUML
targets List rendering profiles (GitHub, terminal, custom)