Urgent.News

What's breaking now, across hundreds of outlets.

AI

Stop Shipping Mermaid Slop: Building a Zero-LLM Editorial SVG Compiler & Architecture Drift Gate in TypeScript

Every developer has seen the same lifecycle play out in a growing repository: Someone writes a clean Mermaid diagram in README.md on day one. Three months later, half the files have been renamed, two modules silently formed a circular dependency, and a parser started importing directly from the CLI entrypoint. Meanwhile, AI coding agents asked to "document the architecture" either hallucinate…

Archink is an open-source TypeScript CLI and library designed to compile architecture diagrams as verifiable build artifacts, ensuring they align with the real codebase. It addresses common issues with diagrams generated by hand or through AI prompts by providing a deterministic, zero-LLM approach.

The tool extracts module dependency graphs from various programming languages, including TypeScript, JavaScript, Python, and Go, using the official TypeScript compiler parser to avoid issues with different file extensions and aliases. It detects circular dependencies using Tarjan's Strongly Connected Components algorithm and solves Sugiyama layered DAG layouts for consistent diagram representation.

Key features of Archink include:

1. Extraction of real module dependency graphs from ASTs of multiple languages.

2. Detection of circular dependencies using Tarjan's SCC algorithm.

3. Deterministic Sugiyama layered DAG layouts for sequence and matrix diagrams.

4. Rendering zero-shadow vector SVGs in four editorial themes and offline interactive HTML viewers.

5. Failing CI with SARIF 2.1.0 or Markdown reports when diagrams drift from real code or violate layer rules.

Archink's architecture consists of nine single-responsibility TypeScript modules under the src/ folder. The key stages include extracting and parsing the codebase, analyzing topology, solving coordinates, and rendering or gating the diagrams. This ensures that the diagrams are not only aesthetically pleasing but also grounded in the actual code structure, avoiding visual slop and hallucinated elements often found in manually generated or AI-generated diagrams.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in AI

Delegent: A Multi-Agent Harness That Reduces Cost Without Sacrificing Performance

For teams building AI agent systems, a familiar dilemma exists: large frontier models deliver powerful results but come at high computational and financial costs.

  • Delegent reduces frontier model costs by 67% on long-horizon coding tasks
  • 59% cost reduction on agentic search with 27B FP8 model
  • 2B laptop-fitting model cuts coding costs by 66%

More from Tuesday, 1 December 2026 →