Run TermFlow Sample Apps Quickly

Working sbt commands for launching the sample apps in modules/termflow-sample.

Run these in a real interactive terminal. TermFlow apps are full-screen TUIs driven by JLine; if sbt is invoked with stdin/stdout piped or redirected, JLine falls back to a dumb terminal and the demos won't render correctly. If a TUI exits abnormally and leaves your terminal in a weird state, run reset.

build.sbt defines short command aliases for the headline apps. From the sbt prompt or as a one-shot:

sbt widgetsDemo       # Layout + Theme + Button/ProgressBar/Spinner/StatusBar
sbt formDemo          # TextField + FocusManager + Keymap multi-field form
sbt catalogDemo       # ListView + Select + Table + TextField task catalog
sbt hubDemo           # Sample hub dashboard (launches other demos)
sbt echoDemo          # Echo / chat-style scrollback
sbt counterDemo       # Sync counter (Layout-based)
sbt futureDemo        # Async counter using Cmd.FCmd
sbt clockDemo         # Digital clock driven by Sub.Every
sbt tabsDemo          # Multi-tab dashboard
sbt taskDemo          # Task manager
sbt stressDemo        # High-frequency renders for repaint stress testing
sbt sineDemo          # Animated sine wave
sbt inputDemo         # Prompt / cursor regression repro (#73 / #74)
sbt treeDemo          # File-tree explorer (Tree widget + Layout.Border)
sbt editorDemo        # Multi-buffer editor (MultiLineInput + SplitPane + MenuBar)
sbt chatDemo          # Streaming chat (LogView scrollback + Sub.Every token stream)

Inside an sbt session you can chain them: sbt> widgetsDemo.

Full runMain form

If you need to launch an app the aliases don't cover, the explicit form is:

sbt "termflowSample/runMain <fully.qualified.AppObject>"

For example:

# Diagnostics demo (logging + render metrics)
sbt "termflowSample/runMain termflow.apps.diagnostics.LoggingMetricsDemoApp"

# Clock variant driven by a custom random source
sbt "termflowSample/runMain termflow.apps.clock.DigitalClockWithRandomSource"

# Provider-chat repro reproduction (chat scrollback + render edge cases)
sbt "termflowSample/runMain termflow.apps.chat.ProviderChatRenderReproMain"

What each headline demo shows

AliasAppDemonstrates
widgetsDemoWidgetsDemoAppThe full new stack: Layout.column/row, a given Theme with toggleable dark/light, Button focus, Spinner + ProgressBar driven by Sub.Every, StatusBar at the bottom, FocusManager + Keymap for input dispatch
formDemoFormDemoAppMulti-field form using three TextFields plus Submit / Reset buttons; demonstrates Tab focus cycling and Enter routing across input + button elements
catalogDemoCatalogDemoAppTask manager combining TextField + Select dropdown + ListView (scrollable, selectable) + Table (live summary). Add tasks, remove them, switch priority — exercises every stateful widget at once.
hubDemoSampleHubAppMenu launcher; pick a sub-app by name or number
counterDemoSyncCounterMinimal Elm-style app; the simplest example to read
futureDemoFutureCounterCmd.FCmd for async work, with a spinner while pending
tabsDemoTabsDemoAppMultiple tabs with independent state, layout-driven
clockDemoDigitalClockSub.Every ticking at 1 Hz
stressDemoRenderStressAppHigh-frequency updates — useful for spotting flicker
sineDemoSineWaveAppAnimated sine wave; same purpose as stressDemo with smoother motion
inputDemoInputLineReproAppPinned reproduction of the prompt/cursor regressions behind #73 and #74
treeDemoFileTreeAppFile-tree explorer over the Tree widget on a Layout.Border shell
editorDemoEditorAppMulti-buffer text editor combining MultiLineInput + SplitPane + MenuBar
chatDemoChatStreamAppStreaming chat with LogView scrollback and Sub.Every token streaming

Widgets demo keys

The widgets demo (sbt widgetsDemo) is interactive:

KeyAction
Tabcycle button focus (Save ↔ Cancel)
Enter / Spaceactivate the focused button
ttoggle dark / light theme
+ / -nudge progress ± 10 %
q / Ctrl+C / Escquit

Form demo keys

The form demo (sbt formDemo) is interactive:

KeyAction
Tab / Shift+Tabcycle focus forward / backward (Name → Email → Bio → Submit → Reset)
/ same as Shift+Tab / Tab — work anywhere, including inside a text field
/ (on a button)previous / next focus
/ (in a text field)move the in-field cursor (does not change focus)
Enter (in field)submit the form (capture all field values)
Enter / Space (button)activate Submit or Reset
Backspace / Delete / Home / Endstandard text editing in the focused field
Ctrl+T (anywhere) / t (on a button)toggle dark / light theme
q (on a button) / Ctrl+C / Escquit

Catalog demo keys

The catalog demo (sbt catalogDemo) is interactive:

KeyAction
Tab / Shift+Tabcycle focus (Task field → Priority → Add → Clear → Task list)
Enter (in Task field)add a task with the selected priority
Enter / Space (on Priority)open the dropdown (or, when open, commit the selection and close)
/ (in open Priority or Task list)navigate items within that widget
Enter (on a list row)remove the selected task
Enter / Space (on a button)activate Add / Clear
/ (on a button)previous / next focus
Ctrl+T (anywhere) / t (on a button)toggle dark / light theme
q (on a button) / Ctrl+C / Escquit

Convenience shell snippet (optional)

If you'd rather have shell-level shortcuts, drop this in ~/.zshrc / ~/.bashrc:

termflow-run() {
  local app="$1"
  case "$app" in
    hub|widgets|form|catalog|echo|counter|future|clock|tabs|task|stress|sine|input|tree|editor|chat)
      sbt "${app}Demo" ;;
    *)
      echo "Usage: termflow-run {hub|widgets|form|catalog|echo|counter|future|clock|tabs|task|stress|sine|input|tree|editor|chat}"
      return 1
      ;;
  esac
}

Then run:

termflow-run widgets

Notes

  • These apps run in an interactive TUI; use a normal terminal.
  • If terminal state looks odd after interruption, run reset.
  • termflow.run.TermFlowMain defaults to the sample hub when run without args, so sbt "termflowSample/runMain termflow.run.TermFlowMain" is equivalent to sbt hubDemo.