[FEATURE] ClaudCode TUI Components
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I have a number of prompts that I've built up for doing common tasks. I also have a number of scripts I've written for ClaudCode to use to automate some of the work I do. Many of my scripts have selection or multi-selection TUIs when I run them outside of the ClaudeCode prompt context. For ClaudeCode, I've allowed them to accept optional arguments for a lot of the interactive TUI selections, so CC can call them non-interactively.
It would be great if there was some way to create ClaudCode interactive prompt UI components. For example, take the idea of multi select. It would be great if CC had some kind of multi select TUI, usable from within the CC prompt, that could be initiated by me from either the prompt, a prompt stored in a file, or from a custom script.
Proposed Solution
The prompt UI could look something like:
# With a natural language prompt
> I'd like to import CSV data from {CCUI:MultiSelect[prompt: 'CSV files from the `db/source_data/csvs` directory']} into my SQLite database `db/my_data.sqlite` using the `src/process-csv.js` script.
# Or, with a script that returns data
> I'd like to import CSV data from {CCUI:MultiSelect[script: src/find-source-csv-files.js]} into my SQLite database `db/my_data.sqlite` using the `src/process-csv.js` script.
For the script version of this, maybe CC calls the script with an environment variable RUNNING_FROM_CLAUDE_CODE=true db/process-csv.js. The script could have a conditional branch around the TUI for multi select. If the CC env var is present, it could just generate a formatted JSON response to it's process's stdout with the options in a format that CC could recognize as a call to present a multi-select UI:
{
"CCUI:MultiSelect": {
"title": "Choose file",
"options": [
{ "name": "File 1", "value": "db/source_data/csvs/source_file_01.csv" },
... etc.
]
}
}
The CC could present the UI to select via its prompt. Once the user selects an option, it's passed back to the script's running process.
The UI for multi select could be something like Clack Prompt's multi select:
❯ ./my-script
│
◆ Select a file:
│
│ Search: _
│ ○ File 1
│ ○ File 2
│ ○ File 3
│ ↑/↓ to select • Enter: confirm • Type: to search
I'm imaging the CCUI components could be standard elements to start with:
- Single select
- Multi select
- Text entry
- Yes/no
- [maybe] File selection (opening an OS file selection dialog
Then, potentially allow people to create custom TUI components.
Alternative Solutions
_No response_
Priority
Low - Nice to have
Feature Category
Interactive mode (TUI)
Use Case Example
_No response_
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗