All products

Build a Ruby terminal interface with AI

Add panes, keyboard navigation and status lines to a Ruby command-line tool. Use the examples to investigate redraw and scrolling problems too.

Build a Ruby terminal interface with AI when your command already returns the right data but is awkward to use. For a folder of recordings, a list on the left and a detail pane on the right let you move between tracks without losing your place. The rcurses skill gives an agent patterns for implementing that behaviour in Ruby.

It is also a reference for an existing application. If an arrow key seems to do nothing on first use, or a refresh jumps back to the top, give the agent the part of the program that reads input and redraws the panes.

What it does

  • Lay out a list, detail area and status line within the current terminal size.
  • Keep the selected item on screen while scrolling.
  • Show the keys that apply to the active view.
  • Open a small dialogue to collect a filename.
  • Check colour and alignment when a line contains terminal formatting.

Install and use

  1. Install the skill in your agent and use Ruby with the rcurses gem in a terminal. The guide describes the 6.1 series.
  2. Supply the relevant Ruby file and describe the interaction you want.
  3. Ask, “Move through this track list with the arrow keys. Keep the selection visible when the details change.”
  4. Run the result with long entries and a narrow window to see how the panes behave.

FAQ

Source

Made by Geir Isene. Original skill: rcurses, published on GitHub under the Unlicense licence.

View on GitHub