A beautiful terminal interface for fabric-ai
Less typing, more piping.
Features β’ Installation β’ Quick Start β’ Usage β’ Configuration β’ Keybindings β’ Project Structure β’ Development
Working with fabric-ai's powerful patterns is amazing, but remembering all the CLI flags and options? Not so much. Fabric TUI gives you a visual, interactive interface with:
- π Fuzzy search - Find patterns, strategies, and contexts instantly
- βοΈ Pipeline builder - Chain multiple patterns together visually
- πΉ Vim-style navigation - Because your hands shouldn't leave home row
- π¦ Zero config - Automatically discovers your fabric installation
- π Live execution - Preview and run commands directly in your terminal
Browse and search through all your fabric patterns with fuzzy filtering. No more scrolling through --help output.
Chain multiple patterns together with a simple keypress. See your entire pipeline before execution:
echo "prompt" | fabric -p summarize | fabric -p improve_writing | fabric -p add_emojis- Select from all available strategies (chain-of-thought, few-shot, etc.)
- Apply multiple contexts from your fabric configuration
- Toggle flags with visual feedback
Automatically finds patterns, strategies, and contexts from:
- Your
$FABRIC_ROOTenvironment variable - Standard fabric locations (
~/.config/fabric,~/Fabric, etc.) - Custom paths in your config
- Dynamic CLI discovery via
fabric --list*commands
Navigate with hjkl, filter with /, toggle with space - all the keybindings you'd expect from a well-designed TUI.
- Python 3.10 or higher
- fabric-ai or
fabricCLI installed
# Clone the repository
git clone https://github.com/stephenmcgurrin/fabric-tui.git
cd fabric-tui
# Install the package
uv pip install .
# Now run the CLI command directly
fabric-tuiFabric TUI uses only the Python standard library (curses), so there are no external dependencies for running.
# Clone and install in editable mode with dev dependencies
git clone https://github.com/stephenmcgurrin/fabric-tui.git
cd fabric-tui
uv venv
uv pip install -e ".[dev]"
# Run the installed command
fabric-tui
# Or run as a module
python -m fabric_tuiFor historical reference, the original monolithic script is preserved in archive/fabric_tui.py but is no longer the recommended way to run the application. After installation, always use the fabric-tui command instead.
# Launch the TUI (recommended - uses the installed CLI command)
fabric-tui
# Use a custom config
fabric-tui --config ~/my-fabric-config.json
# Override fabric roots
fabric-tui --fabric-root ~/my-patterns --fabric-root ~/Fabric
# Alternatively, run as a Python module
python -m fabric_tui- Launch Fabric TUI
- Select a pattern - Use
j/kto navigate,/to filter,enterto select - Add your prompt - Press
lto move to Prompt section,ito edit - Run it - Press
rto execute in your terminal
Want to chain patterns? Press | to add a new stage, select another pattern, and press r to run the entire pipeline!
fabric-tui [OPTIONS]
Options:
--config PATH Path to config file (default: ./fabric_tui_config.json)
--fabric-root PATH Discovery root path (can be repeated, overrides config)
--fabric-cmd PATH Fabric executable path (default: auto-detect)
--print-discovery Print discovered patterns/strategies/flags and exitSee what Fabric TUI found:
fabric-tui --print-discoveryOutput:
Config: /Users/you/fabric_tui_config.json
Fabric command: fabric-ai
Discovery roots:
- /Users/you/Fabric
Patterns (42):
- summarize
- improve_writing
- extract_wisdom
...
Strategies (8):
- chain-of-thought: Think step by step
- few-shot: Learn from examples
...
Fabric TUI excels at building multi-stage pipelines:
- Press
|to create a new pipeline stage - Select pattern for each stage
- Configure strategies/contexts per stage
- Press
rto execute:stage1 | stage2 | stage3
Each stage maintains independent configuration:
- Pattern selection
- Strategy
- Contexts
- Flags
- Extra arguments
Fabric TUI automatically parses all available flags from fabric --help:
- Navigate to the Flags section (
luntil you reach it) - Filter flags with
/ - Toggle boolean flags with
space - For value-taking flags:
spaceopens an input prompt - Press
uto uncheck/remove a flag
Create fabric_tui_config.json in your working directory:
{
"fabric_cmd": "fabric-ai",
"locations": [
"$FABRIC_ROOT",
"~/.config/fabric",
"~/.fabric-config",
"~/Fabric",
"~/fabric"
],
"additional_locations": [
"~/my-custom-patterns",
"/path/to/shared/patterns"
]
}| Option | Type | Description |
|---|---|---|
fabric_cmd |
string | Fabric executable name or full path |
locations |
array | Standard fabric location paths |
additional_locations |
array | Additional custom pattern locations |
$FABRIC_ROOTexpands from environment variable~expands to home directory- Relative paths resolve from config file directory
- If no paths exist, falls back to current directory
| Key | Action |
|---|---|
h / l / β / β / Tab |
Switch between sections |
j / k / β / β |
Move selection up/down |
[ / ] |
Switch to previous/next pipeline stage |
| Key | Action |
|---|---|
/ |
Start fuzzy filter (in Pattern/Strategy/Context/Flags) |
i |
Edit current item (Prompt/Extra Args/Flag values) |
Enter |
Confirm filter/edit, or activate current item |
Esc |
Cancel filter/edit mode |
| Key | Action |
|---|---|
Space |
Toggle/select current item |
u |
Uncheck/remove current item |
Enter |
Activate current item (context-sensitive) |
| Key | Action |
|---|---|
| |
Add new pipeline stage |
[ |
Switch to previous stage |
] |
Switch to next stage |
| Key | Action |
|---|---|
r |
Run command in terminal with live output |
c |
Clear run preview |
q |
Quit |
- Use fuzzy filtering - Type just a few characters to find patterns quickly
- Build reusable pipelines - Create common chains like
summarize | improve_writing - Leverage contexts - Apply domain-specific knowledge consistently
- Preview before running - Check the command preview at the bottom
Multi-stage refinement:
Stage 1: extract_wisdom (get key points)
Stage 2: improve_writing (enhance clarity)
Stage 3: create_summary (condense result)
Context-aware processing:
- Add technical context for code-related prompts
- Include domain context for specialized topics
- Combine multiple contexts for nuanced understanding
The codebase follows a modular package architecture:
fabric-tui/
βββ pyproject.toml # Package metadata and build configuration
βββ fabric_tui/ # Main package
β βββ __init__.py # Package version and exports
β βββ __main__.py # python -m fabric_tui entry point
β βββ cli.py # CLI argument parsing and main() function
β βββ models.py # Data models (AppConfig, StageSelection, etc.)
β βββ config.py # Configuration loading and path resolution
β βββ discovery.py # Pattern, context, strategy, and flag discovery
β βββ command_builder.py # Pipeline command construction
β βββ executor.py # Command execution logic
β βββ filtering.py # Fuzzy search and filtering
β βββ utils.py # Shared utility functions
β βββ ui/ # Terminal UI components
β βββ __init__.py
β βββ tui.py # Main FabricTUI class (assembles mixins)
β βββ drawing.py # DrawingMixin β all rendering/drawing methods
β βββ handlers.py # Input handling mixin β key dispatch and actions
βββ tests/ # Test suite
β βββ __init__.py
β βββ test_filtering.py # Fuzzy search tests
β βββ test_discovery.py # Discovery logic tests
β βββ test_config.py # Configuration loading tests
β βββ test_command_builder.py # Command construction tests
β βββ test_utils.py # Utility function tests
βββ archive/ # Historical reference
βββ fabric_tui.py # Original monolithic script (preserved for reference)
| Module | Purpose |
|---|---|
models.py |
Pure data structures β AppConfig, StageSelection, FlagOption, etc. |
config.py |
Loads JSON config, resolves paths, provides defaults |
discovery.py |
Discovers patterns, contexts, strategies, and flags from the filesystem and CLI |
command_builder.py |
Constructs shell commands from pipeline stage selections |
executor.py |
Runs commands via subprocess with live output |
filtering.py |
Fuzzy scoring and list filtering |
utils.py |
Shared helpers (directory scanning, subprocess wrappers) |
ui/tui.py |
Assembles the FabricTUI class from mixin components |
ui/drawing.py |
Screen rendering β panels, lists, status bar, preview |
ui/handlers.py |
Keyboard input dispatch, cursor movement, editing |
git clone https://github.com/stephenmcgurrin/fabric-tui.git
cd fabric-tui
# Create a virtual environment with uv
uv venv
uv pip install -e ".[dev]"# Run the full test suite
pytest tests/
# Run with verbose output
pytest tests/ -v
# Run a specific test file
pytest tests/test_filtering.py# Using the installed CLI command (recommended)
fabric-tui
# Or using package invocation (uses __main__.py β cli.py)
python -m fabric_tuiContributions are welcome! The codebase has been refactored from a single file into a modular package to make it easier to understand, test, and extend.
Ideas for contributions:
- Additional keybinding schemes
- Color scheme support
- Export/import pipeline configurations
- Pattern usage statistics
- Better error handling
MIT License - feel free to use this in your own projects!
- Built for fabric-ai by Daniel Miessler
- Inspired by modern TUI applications like
lazygitandk9s - Uses Python's
curseslibrary for the terminal interface - curses for good, not evil
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Fabric: Fabric GitHub
Made with β€οΈ for the Fabric community