Skip to content

feat(init): redesign the adl init wizard with a branded huh/lipgloss TUI - #188

Merged
edenreich merged 1 commit into
mainfrom
feat/init-wizard-tui
Jun 3, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/init-wizard-tui

Conversation

@edenreich

@edenreich edenreich commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • New internal/tui package (theme.go, banner.go, summary.go, console.go, run.go) wrapping charmbracelet huh v2 + lipgloss v2. Violet/purple brand theme, a banner titled "Agent Definition Language", a boxed run summary, section headers, and label › value rows. Output is routed through lipgloss's color-profile writer so ANSI is stripped in non-TTY (CI/pipes).
  • cmd/init.go refactored around a pure buildADL(answers) core. runInit dispatches to the interactive huh wizard (runInitInteractive in cmd/init_wizard.go) only when both stdin and stdout are a TTY and --defaults is unset; otherwise it takes the plain non-interactive flow (runInitNonInteractive). Both the non-interactive collector and the wizard feed the same buildADL.
  • --defaults console output restyled to use echoRow/tui.Bullet lines instead of literal prompt echoes (stdout-only; the generated agent.yaml is unchanged).
  • Default language changed go → typescript (init default value + wizard select order).
  • AI providers expanded to the gateway's 11 (openai, anthropic, google, groq, mistral, deepseek, cohere, cloudflare, moonshot, ollama, ollama_cloud) via a shared aiProviders list used by the wizard select, the non-interactive choice, and --provider help.
  • AI orchestrators: all 5 offered (claudecode, codex, gemini, opencode, infer) via a wizard multi-select; the answers struct gained per-orchestrator bools and buildADL wires them. claudecode is still driven by --ai on the non-interactive path; the other four are wizard/manifest-only.
  • huh-v2 quirk fixes: multi-selects set an explicit .Height(n+2) (multiSelectHeight) because static .Options() otherwise collapses the viewport to one row; confirms use a leftConfirm() helper (WithButtonAlignment(lipgloss.Left)) since huh defaults to centered buttons.
  • New golden tests in cmd/buildadl_test.go for buildADL.

Behavior preserved

  • The non-interactive / --defaults path and the generated agent.yaml are byte-for-byte unchanged, with one documented exception: the default-language switch go → typescript. A diff of the old (HEAD) vs new binary across 13 flag combinations (default, each language, --ai, --ci --cd, --type minimal, --flox, --devcontainer, --docker-compose, --deployment kubernetes, --provider, --model) shows the only manifest delta in any combo is the 8-line language: hunk, and only when --language is omitted. With --language set explicitly, output is identical to HEAD.
  • TTY gate is correct: tui.IsTTY() requires both stdin and stdout to be terminals, so CI/piped/go test invocations always fall through to runInitNonInteractive even without --defaults. The huh wizard cannot launch in a non-TTY.
  • All orchestrators default to false; only --ai flips claudecode on the non-interactive path.
  • Struct definitions unchanged (adlData, vendorBlock, aiBlock, orchestratorsBlock), so YAML key ordering is unaffected; all extension points (services: [logger], vendor deps:[]/devdeps:[], development.deps:[], orchestrators) still render.
  • All existing tests stay green: the 11 cmd/init_test.go tests (all --defaults-driven) plus the 4 new cmd/buildadl_test.go golden tests pass.

New dependencies

  • charm.land/huh/v2 v2.0.3
  • charm.land/lipgloss/v2 v2.0.3
  • transitive: charm.land/bubbletea/v2 v2.0.2, charm.land/bubbles/v2 v2.0.0
  • golang.org/x/term v0.43.0

Cross-repo follow-up

The ADL schema's spec.agent.provider enum lags the gateway. The vendored internal/schema/schema.json (pinned at ADL_SCHEMA_VERSION: v0.12.0) lists only 7 providers - ["", openai, anthropic, ollama, deepseek, google, mistral, groq] - and is missing 4 of the 11 the wizard now offers: ollama_cloud, cloudflare, cohere, moonshot. Selecting any of those will fail adl validate until:

  1. The enum is updated upstream in inference-gateway/adl, then re-vendored here (bump ADL_SCHEMA_VERSION, task fetch-schema, task generate-types).
  2. The README provider lists are updated to match.
  3. A [DOCS] follow-up lands in inference-gateway/docs.

This PR does NOT include those changes - it only adds the providers to the CLI's selection list (the inline comment at cmd/init.go already documents the gap).

Known pre-existing issues (not addressed here)

  • spec.services rendered as an array vs the schema's expected object - so the default adl init --defaults manifest fails adl validate. Pre-existing, unchanged by this refactor.
  • --provider / --model ignored in --defaults mode - those paths use conditionalPromptChoice/conditionalPrompt, not viper, so the flags are not written.
  • Schema provider lag (the 4 missing enum entries above) - pre-existing; surfaced now because the wizard offers all 11.

Verification

  • go build ./... → PASS (clean)
  • go test ./... -count=1 → PASS - all packages green (cmd incl. buildadl_test.go + init_test.go, internal/generator incl. the gpt-5.5 fixture edits, and the rest). internal/tui compiles/lints clean but has no test files of its own.
  • golangci-lint run ./... → PASS - 0 issues.
  • gofmt -l cmd/ internal/tui/ → PASS (no output)
  • go vet ./... → PASS

Also includes user-made fixture edits in internal/generator/typescript_test.go and internal/templates/common/docs/README.md.tmpl (example model names gpt-4o/gpt-4o-mini → gpt-5.5).

@edenreich
edenreich requested a review from a team as a code owner June 3, 2026 21:11
Replace the plain readline prompts with an interactive huh v2 + lipgloss v2
wizard (new internal/tui package): violet brand theme, an "Agent Definition
Language" banner, grouped form pages, multi-selects, and a boxed summary. The
--defaults / non-interactive flow is also restyled but its generated agent.yaml
stays byte-for-byte identical (verified across 13 flag combos) — the only
intentional manifest change is the default language go -> typescript.

cmd/init.go is refactored around a pure buildADL(answers) core fed by both the
non-interactive collector and the wizard. The wizard now offers all 5 AI
orchestrators (claudecode, codex, gemini, opencode, infer) and all 11 gateway
providers. Output is routed through lipgloss's color-profile writer so ANSI is
stripped in non-TTY (CI/pipes); the huh wizard only launches when both stdin
and stdout are a TTY and --defaults is unset.
@edenreich
edenreich force-pushed the feat/init-wizard-tui branch from 9b0d17b to f0e0a0b Compare June 3, 2026 21:12
@edenreich
edenreich merged commit 5fdc32c into main Jun 3, 2026
@edenreich
edenreich deleted the feat/init-wizard-tui branch June 3, 2026 21:13
inference-gateway-releaser Bot added a commit that referenced this pull request Jun 3, 2026
## [0.42.0](v0.41.4...v0.42.0) (2026-06-03)

### ✨ Features

* **init:** redesign the adl init wizard with a branded huh/lipgloss TUI ([#188](#188)) ([5fdc32c](5fdc32c))
@edenreich

Copy link
Copy Markdown
Contributor Author

@claude Can you create the follow ups? use /maintainer (file max 5 issues).

@claude

claude Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @edenreich's task in 6m 57s —— View job


Follow-up issues created (5)

All five follow-ups from the PR description are filed. Each was verified against the code first, and templates/labels were taken from the org defaults in inference-gateway/.github.

# Repo Issue Type Label
1 adl #54 — [FEATURE] Add cohere, cloudflare, moonshot, ollama_cloud to spec.agent.provider enum Feature ⚠️ not applied
2 adl-cli #189 — [TASK] Refactor re-vendor ADL schema and sync provider lists Task refactor
3 docs #156 — [DOCS] Document expanded ADL agent provider list Documentation ⚠️ not applied
4 adl-cli #190 — [BUG] adl init writes spec.services as array but schema expects object Bug bug
5 adl-cli #191 — [BUG] --provider/--model ignored in adl init --defaults Bug bug

Dependency chain: #189 is marked blocked by adl#54; #54 + #189 + #156 together cover the 3-part cross-repo provider follow-up (upstream enum → re-vendor + README → docs). #190 and #191 are the two pre-existing bugs surfaced by the PR.

Limitations (need a maintainer with broader scope)

  • Native Issue Types could not be set on any issue — the GraphQL updateIssueIssueType mutation returns FORBIDDEN: Resource not accessible by integration for this bot token. The title prefixes ([FEATURE]/[TASK] Refactor/[DOCS]/[BUG]) and labels encode the category in the meantime; types can be set in the UI.
  • Cross-repo labels on adl#54 (enhancement) and docs#156 (documentation) could not be applied — same integration permission limit (addLabelsToLabelable is forbidden outside adl-cli). The three adl-cli issues got their labels fine. These two labels just need to be added manually.

Not filed (respecting the max-5 limit)

  • A 6th candidate — tests for the new internal/tui package (it compiles/lints clean but has no tests of its own) — was left out to stay within the 5-issue cap. Happy to file it if you want it tracked.

  • Read PR context and identify the documented follow-ups

  • Invoke /maintainer skill for org context

  • Verify claims against the code

  • Confirm issue templates + labels exist on adl, adl-cli, docs

  • File follow-up issues (5) across the right repos

  • Summarize created issues

@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.42.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant