#761·huh

Proposal: Declarative YAML form generator (charm-form)

Author: junhinhowCreated Apr 1, 2026Updated Apr 1, 2026

Problem

Building interactive CLI forms with huh requires Go knowledge. But many use cases just need a simple form:

  • DevOps scripts that need user input
  • Installation wizards
  • Configuration prompts
  • Onboarding flows

These should be as easy as writing a YAML file.

Proposed Solution

charm-form — define forms in YAML, get interactive CLI apps powered by huh.

Define your form

yaml
# deploy.yaml
title: Deploy Configuration
fields:
  - name: environment
    type: select
    label: Target Environment
    options: [staging, production]
    required: true
  - name: version
    type: input
    label: Version
    placeholder: "v1.0.0"
    validate: "^v\d+\.\d+\.\d+$"
  - name: dry_run
    type: confirm
    label: Dry run only?
  - name: services
    type: multiselect
    label: Services to deploy
    options: [api, web, worker]

Run it

bash
charm-form run deploy.yaml
# → Interactive huh form appears
# → Outputs JSON with answers

Supported Field Types

Type huh Equivalent
`input` huh.Input
`text` huh.Text (multiline)
`select` huh.Select
`multiselect` huh.MultiSelect
`confirm` huh.Confirm

Features

  • YAML spec with validation (required fields, regex patterns)
  • `LoadFromFile()` and `LoadFromBytes()` for programmatic use
  • JSON output for easy integration with shell scripts
  • Strict validation on load (invalid types, missing options, etc.)

Working POC

https://github.com/junhinhow/charm-form

Bilingual docs (EN/PT-BR).

Questions

  1. Would this complement huh or overlap too much?
  2. Interest in a `huh.FromYAML()` function directly in huh?
  3. Should we support JSON/TOML specs too, or keep it YAML-only?