Convert TUI to PySide6 desktop GUI

Major UI overhaul replacing the urwid-based Terminal UI with a modern
PySide6 desktop application.

New GUI features:
- Sidebar navigation (My Tools, Registry, Providers)
- Tool Builder with visual form for creating/editing tools
- Registry browser with search and one-click install
- Provider management page
- Connect dialog for account pairing
- Publish dialog for sharing tools

- Keyboard shortcuts (Ctrl+N, Ctrl+S, Ctrl+R, Ctrl+1/2/3, Escape, Ctrl+Q)
- Window geometry persistence (remembers size/position)
- Modern clean stylesheet

Removed:
- ui.py, ui_snack.py, ui_registry.py, ui_urwid.py
- ui_urwid/ directory (urwid TUI implementation)

Updated:
- pyproject.toml: PySide6 now required, removed urwid
- CLI entry points to launch GUI
- All documentation (README, CLAUDE.md, AGENTS.md, wiki)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
rob
2026-01-14 04:38:35 -04:00
co-authored by Claude Opus 4.5
parent 604b473806
commit 4fe2d26244
30 changed files with 2726 additions and 5102 deletions
+80 -50
View File
@@ -66,10 +66,10 @@ export PATH="$HOME/.local/bin:$PATH"
# Install an AI provider (interactive guide)
cmdforge providers install
# Launch the UI
cmdforge ui
# Launch the GUI
cmdforge
# Or create your first tool
# Or create your first tool via CLI
cmdforge create summarize
```
@@ -95,7 +95,7 @@ pip install -e ".[dev]"
- Python 3.10+
- At least one AI CLI tool installed (see [Provider Setup](docs/PROVIDERS.md))
- Optional: `urwid` for the TUI (`pip install urwid`)
- PySide6 (included automatically - requires display server on Linux)
### Post-Install
@@ -113,13 +113,16 @@ cmdforge refresh
## Usage
### UI Mode (Recommended for Beginners)
### GUI Mode (Recommended for Beginners)
```bash
cmdforge ui
cmdforge
```
Navigate with arrow keys, Tab, Enter, and mouse. Create tools visually with the built-in prompt editor.
Opens the graphical interface where you can create and manage tools visually. Features include:
- **My Tools** - Browse, create, edit, and delete tools organized by category
- **Registry** - Search and install community tools from the CmdForge registry
- **Providers** - Manage AI provider configurations
### CLI Mode
@@ -410,55 +413,82 @@ vnoremap <leader>fg :!fix-grammar<CR>
vnoremap <leader>ec :!explain-code<CR>
```
## UI Navigation
## GUI Features
| Action | Keys |
|--------|------|
| Cycle sections | `Tab` |
| Go back | `Escape` |
| Select | `Enter` or click |
| Navigate | Arrow keys |
| **Scroll content** | Mouse wheel |
| **Scroll up** | Click top of scrollbar |
| **Scroll down** | Click bottom of scrollbar |
| **Page up/down** | Click middle of scrollbar |
| **Select text** | `Shift` + mouse drag |
| **Copy** | Terminal native (with Shift) |
| **Paste** | `Ctrl+Shift+V` |
| **Undo** (code editor) | `Alt+U` |
| **Redo** (code editor) | `Alt+R` |
The graphical interface provides a modern desktop experience:
**Tips:**
- Hold `Shift` while using mouse for terminal-native text selection.
- Code/Prompt editors have DOS-style scrollbars with `▲` and `▼` arrow buttons.
- In step dialogs, use `Tab` to cycle between File, Editor, and Output fields.
- The code editor supports undo/redo (up to 50 states) with `Alt+U` and `Alt+R`.
- Use the `$EDITOR` button to open code or prompts in your external editor.
### My Tools Page
- View all your tools organized by category (Text, Developer, Data, Other)
- Double-click a tool to edit it
- Create new tools with the built-in Tool Builder
- Connect to the registry to publish your tools
## AI-Assisted Code Generation
### Tool Builder
- Visual form for creating and editing tools
- Add arguments with flags and default values
- Add prompt steps (AI calls) or code steps (Python)
- Preview the generated YAML configuration
- Test tools before saving
When adding or editing a **Code Step**, the dialog includes an AI assist panel:
### Registry Browser
- Search community tools by name or keyword
- View tool details, downloads, and ratings
- One-click install to your local machine
```
┌─ Code ─────────────┐ ┌─ AI Assisted Auto-adjust ─────────────┐
│ result = input... │ │ Provider: [opencode-deepseek] [▼] │
│ │ │ ┌─ Prompt ──────────────────────────┐ │
│ │ │ │ Modify this code to... │ │
│ │ │ │ {code} │ │
│ │ │ └──────────────────────────────────┘ │
│ │ │ ┌─ Output & Feedback ───────────────┐ │
│ │ │ │ ✓ Code updated successfully! │ │
│ │ │ └──────────────────────────────────┘ │
│ │ │ < Auto-adjust > │
└────────────────────┘ └───────────────────────────────────────┘
### Provider Management
- Add and configure AI providers
- Test provider connectivity
- Set default providers for new tools
### Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
| `Ctrl+N` | Create new tool |
| `Ctrl+S` | Save tool (in builder) |
| `Ctrl+R` | Refresh current page |
| `Ctrl+1` | Go to My Tools |
| `Ctrl+2` | Go to Registry |
| `Ctrl+3` | Go to Providers |
| `Escape` | Close tool builder |
| `Ctrl+Q` | Quit application |
## Multi-Step Tool Patterns
CmdForge supports powerful multi-step workflows combining AI and code:
### Code → AI
Extract or transform data with Python, then pass to AI:
```yaml
steps:
- type: code
code: |
# Extract just the error lines
errors = [l for l in input_text.split('\n') if 'error' in l.lower()]
result = '\n'.join(errors[-10:]) # Last 10 errors
output_var: errors
- type: prompt
prompt: "Explain these errors:\n{errors}"
output_var: explanation
```
- **Provider**: Select any configured AI provider
- **Prompt**: Fully editable template - use `{code}` placeholder for current code
- **Output**: Shows status, success/error messages, and provider feedback
- **Auto-adjust**: Sends prompt to AI and replaces code with response
This lets you generate or modify Python code using AI directly within the tool builder.
### AI → Code
Generate content with AI, then validate/process with Python:
```yaml
steps:
- type: prompt
prompt: "Generate Python code to: {input}"
output_var: generated
- type: code
code: |
import ast
try:
ast.parse(generated) # Syntax check
result = generated
except SyntaxError as e:
result = f"# Syntax Error: {e}\n{generated}"
output_var: validated
```
## Philosophy
@@ -515,7 +545,7 @@ docker run -it --rm -v cmdforge-data:/home/user/.cmdforge cmdforge-ready
Inside the container, CmdForge is ready to use:
```bash
cmdforge list # See 27 pre-installed tools
cmdforge ui # Launch the TUI
cmdforge # Launch the GUI (requires display)
cmdforge run summarize # Run a tool
```