A mechanism has been released to describe the behavior of the terminal UI components in a common specification and to generate code for multiple languages and frameworks.TUIKit uses the definitions of the implementation to create a prompt and assign the LLM agent to generate code.
Set the behavior of the components into a common Markdown specification.
The terminal UI component development system “TUIKit” released by GitHub defines each component in a Markdown specification that does not depend on the language.
The parts specification includes design tokens, tests, and display examples that specify roles in addition to behavioral and accessibility requirements, colours, etc. Even if the implementation is different, the starting point for the conditions required for the parts will be common.
The implementation defines a common specification for each framework.
When translating common specifications into code, the specifications for each implementation define the correspondence to language and framework.The configuration describes the condition of the components and the specific treatment of the implementation separately.
The implementations include Bubbletea and Lipgloss for Go, Ink and React for TypeScript, OpenTUI and React for TypeScript on Bun, Ratatui and Crossterm for Rust.
Create a prompt from a modified specification.
Compilation scripts detect modified specifications and generate self-finishing prompts for specified implementations. This prompts pass the common specifications and implementation conditions to the code generation process.
The LLM agent reads the prompt and generates the code matched to the target framework. "compilation" in TUIKit refers to the process involving the generation by this agent.
Separate and manage the code and specification.
The generated code is sent to the dist directory for each implementation.The specifications of the parts remain and are managed separately from the products.
After verifying how the generated code works, the hash of the compiled specifications can be recorded with the lock command, which allows you to decide which version of the specifications you treat as compiled before implementation.
