feat: first attempt at a gui for managing sessions

This commit is contained in:
Joe Fleming
2026-03-07 11:52:39 -07:00
commit ad7030ae38
9 changed files with 1046 additions and 0 deletions

63
README.md Normal file
View File

@@ -0,0 +1,63 @@
# Session Mover TUI
A Python Textual TUI for easily moving OpenCode sessions between projects and workspaces without writing SQL.
## Quick Start
```bash
# Install dependencies
pip install -r requirements.txt
# Run (looks for opencode.db in current directory)
python session-mover.py
# Or specify a database path
python session-mover.py /path/to/opencode.db
```
## How to Use
1. **Browse** - See all sessions organized by project/workspace on the left
2. **Select** - Click or use arrow keys + Enter to select sessions (multiple with Shift+Click)
3. **Filter** - Type in the filter box to search session titles
4. **Move** - Press `m` to move selected sessions to another project
5. **Copy** - Press `c` to duplicate sessions to another project
6. **Backup** - Press `b` to manually create a database backup
### Hotkeys (always visible at bottom)
- `b` - Backup database
- `m` - Move selected sessions
- `c` - Copy selected sessions
- `a` - Toggle archived sessions visibility
- `r` - Refresh all data
- `q` - Quit
- `Escape` - Deselect / close dialogs
### Move/Copy Dialog
1. Select destination project (dropdown)
2. Optionally select a workspace within that project
3. Review the SQL preview to see what will execute
4. Press `Enter` or click Confirm to execute
5. A backup is automatically created before the first write operation
### Safety
- Before any move/copy, a timestamped backup is created: `opencode-YYYYMMDD-HHMMSS.db`
- Confirmation dialog shows exactly what will happen
- Changes appear immediately in the UI after success
## Database Schema Support
Works with OpenCode's `opencode.db` with tables:
- `session` (with project_id, workspace_id, parent_id)
- `project`, `workspace`
- `message``part`, `todo`, `session_share` (all cascade automatically)
## Tips
- Filter by typing in the search box (searches title and slug)
- Toggle archived sessions with `a` (hidden by default)
- The left panel shows Projects → Workspaces hierarchy
- Selected sessions remain selected when filtering, so you can search, select, then clear filter