All docs
Authoring · Porting Caret

Porting Caret

Caret is a design language first, an implementation second. The TypeScript registry is one binding. Ports to Go, Rust, Python, or any other ecosystem are encouraged — what binds them is the spec.

What ports must reproduce

LayerSource of truthLatitude
Component anatomyspecs/<name>.mdLayout described per-row — port exactly
Symbol setspecs/look.md + tokens/symbolsUse the same glyphs (^, ▸, ●, ○, ✓, ✗, ⚠)
Color tokenstokens/colors.tsBrand truecolor fixed; semantic emit ANSI names
Capability detectionlib/capability.tsDetect TTY / NO_COLOR / Unicode / reduced motion identically
API shapespecs/<name>.mdMatch field names; idiomatic style allowed
Internal structure— / your callImplementation detail — pick whatever fits the language

Reading a spec

Each spec markdown file follows the same shape: title, one-line description, and a series of ## sections. The standard sections are:

SectionWhat it gives the porter
AnatomyASCII or block diagram of the component's rendered output, row by row
API / OptionsField names, types, defaults — your binding's public surface
BehaviorState machine — what happens on each input event
KeyboardEvery key press the component listens for
CapabilityHow the component degrades when capabilities are missing
ExamplesIdiomatic usage in TypeScript — translate to your language

A worked example: prompt.confirm

From specs/prompt.md:

md
### confirm

  ^ Deploy to production?
    [ Yes ]   No
    ←→ toggle · y/n shortcut · ↵ confirm · esc cancel

API:
  label    string                    required
  default  boolean                   default: false

Keys:
  ←/→         toggle the highlighted choice
  y, Y        select Yes
  n, N        select No
  ↵ Enter     submit the highlighted choice
  Esc         cancel — resolve null

That's enough to write a Go port. The Yes/No glyph is [ ... ] on the highlighted side. Keys are listed explicitly. Cancel resolves a null/None — your language's nullable equivalent. The brand ^ mark and the focus glyph are token references — pull them from your tokens file.

Reference helmets

Two libraries Caret leans on at the visual layer have ports already:

  • Helmlab — color science, palette generation. JS, Python ports exist; github.com/Grkmyldz148/helmlab.
  • figlet — ASCII art for splash banners. Has implementations in nearly every major language.

Spec + AI workflow

For ports specifically, AI assistants are useful. Drop the relevant spec markdown into the LLM context, give it your caret.md-equivalent for the target language, and ask for the implementation. Caret was designed with this loop in mind — every spec is unambiguously parseable.

One symbol, every binding
The reason the manifesto says never customize symbols is portability. If a Go port renders a different glyph than the JS port, the result feels like two products. Hold the line — same glyphs, every language.

For the symbol reference, Symbols. For the capability protocol every port has to reproduce, Capability detection.