Ubunatic Coding

Stories · Terminal & TUI Stack · 🔧 settings

Source (Codeberg) ↗ Copied from settings/docs/studies/2026-10-04-settings-story.md.

From one font setting to a spec driven settings editor

The first job for settings was deliberately narrow: let someone change the font size in the foot terminal emulator without hand-editing its INI file. That small goal exposed a broader problem. A tool's settings are spread across formats, keys, defaults and user-specific files; building a separate editor for every option would quickly become hard to maintain.

The project instead describes tool knowledge in YAML. An embedded spec says which settings exist, what type they have, and how they map to the tool's configuration file. User overrides extend that spec under ~/.config/settings/. Go code loads and validates the data, then uses it to generate both Cobra CLI commands and an inline terminal editor. Today, the first embedded tool is foot, with INI editing that preserves comments, spacing and order while saving atomically and keeping a backup. The supported value types have grown from numbers to text and choices, including presets for yes/no, booleans and 0/1 values.

The project reached its initial foot editor milestone on September 29, 2026. Tickets 001–007 recorded the scaffold, a loom capability probe, the spec loader, line-preserving INI editing, CLI commands, the TUI and user overrides. The first probe found loom lacked numeric input; that finding became loom issue 164 and led to KindNumber, rather than a private workaround in this repository. The milestone was verified in foot by the user and recorded in ticket 006.

One particularly useful episode came while making new settings easier to add. Ticket 009 added text and choice types as a prerequisite for ticket 008, the settings new wizard. The wizard walks through a config file and key, proposes a setting, previews YAML, and writes a validated user override. Its steps are composed from loom widgets because loom has no stepper; the project kept this composition in its own code while still filing missing shared UI capabilities in loom. The tests exercise the widget model with HandleKey, and config-path tests use temporary home directories so they cannot edit a developer's real files.

The wizard also surfaced a data-model conflict: one INI key can be represented as a whole value and as a sub-value. For foot's font line, a text setting and a numeric font-size setting could both claim the same key. A September 29 fix marks shared keys, warns in the preview and refuses a save if both conflicting settings changed during one session. A subsequent feature lets the wizard add a key that is not yet in the config. The remaining composed-value case is explicit in open ticket 010: describe font family and size as independently editable parts while preserving the rest of the comma-separated value.

A smaller October 1 fix shows why integrations need careful event boundaries. When the wizard advanced from file selection to key selection, the widget had already consumed the key press, but the wizard did not report that consumption to loom. The patch made both transition paths return a handled event. That keeps a navigation key from leaking into the newly displayed step. The commit references loom issue 235. It is a narrow repair, but it demonstrates the value of having an upstream UI library with a ticket trail and keeping the application responsible for its own workflow semantics.

The repository's history shows concentrated, ticket-led work: 48 commits from September 29 through October 1, 2026, including 27 issue-related commits. Nine of the ten numbered tickets are closed. The Go code totals about 2,694 lines, with 36 test functions across CLI, spec, configuration, INI and widget-model packages. Those numbers do not prove that one person could not build the project; they do show a compact foundation with unusually explicit coverage of cross-package behavior and a clear path for growing it. The strongest agentic-development lesson is the discipline around the work: probe shared tooling first, turn discoveries into tickets, keep the spec as the source of truth, and test interactive behavior through deterministic widget events. The current story is a focused Linux tool editor, not yet a cross-platform settings catalogue, but its architecture keeps that expansion plausible.

Facts

Topic Verified fact
Stack Go 1.25, Cobra CLI, YAML specs, loom inline TUI, INI configuration
Size 2,694 Go lines; 36 test functions; 10 numbered tickets (9 closed)
Dates Initial editor milestone closed September 29, 2026; wizard event fix October 1, 2026
Recent work 48 commits from September 29 to October 1, 2026; 27 issue-related commits
Scope Linux foot configuration today; CLI, inline TUI and user-defined tool specs