Guide-Adding-New-Field-Types
Guide: Adding a New Field Type to the TUI
When extending the configuration schema, touch these layers in order so the new field stays coherent across pour-design-spec and the running app:
- Config Layer (
src/config.rs): Add the new variant to theFieldTypeenum. Updatevalidate()if the field requires specific properties, likestatic_selectrequiringoptions. - State Layer (
src/app.rs): UpdateApp::init_form()to handle any default state population for the new field, andApp::validate_form()if it requires custom validation logic before submission. - Presentation Layer (
src/tui/form.rs): Add the render logic torender(). Determine if it renders inline like text or requires a popup overlay like selects. - Input Handling (
src/tui/form.rs): Update theKeyEventmatcher to handle how the user interacts with this specific field when it is active. - Output Layer (
src/output/mod.rs): Ensure the field's data structure is properly routed to eitherfrontmatterorbodytargets during submission.
For the current TUI shape and event routing, see System-Architecture-Overview and sprint-5-tui-report.