Add session persistence and Cmd+K command palette

Workspace auto-saves every 30s and on exit, restores all tabs on
launch. Sessions persist drawing elements, SVG source, canvas state,
and metadata to ~/Library/Application Support/agcanvas/workspace.json.
Manual save via Cmd+S.

Command palette (Cmd+K) with fuzzy search over all commands: session
management, tool switching, view toggles, canvas operations. Arrow
keys to navigate, Enter to execute, Esc to dismiss.
This commit is contained in:
David Ibia
2026-02-09 17:44:22 +01:00
parent 43f1beea16
commit 233cb5798c
8 changed files with 707 additions and 28 deletions

View File

@@ -35,6 +35,8 @@ agcanvas bridges the gap between visual design and code generation. It's a **col
- **Mermaid Diagrams** — Write Mermaid syntax, render as SVG on canvas
- **Sessions/Tabs** — Multiple canvases in tabs, each with independent state, creator tracking (human vs agent), descriptions, and timestamps
- **Pan/Zoom** — Smooth canvas navigation
- **Session Persistence** — Auto-saves workspace to `~/Library/Application Support/agcanvas/`, restores all tabs on launch
- **Command Palette** — Cmd+K to search and execute any command with fuzzy matching
### AI Agent Integration
- **MCP Server** — `agcanvas-mcp` bridge for Claude Code, OpenCode, and Codex
@@ -132,6 +134,8 @@ agcanvas-mcp --help
| Paste SVG | Cmd+V |
| New Tab | Cmd+T |
| Close Tab | Cmd+W |
| Save workspace | Cmd+S |
| Command palette | Cmd+K |
| Reset zoom | Cmd+0 |
## MCP Server (AI Agent Integration)
@@ -338,6 +342,8 @@ crates/
│ ├── main.rs # Entry point, window setup
│ ├── app.rs # Main app state, UI, toolbar, drawing interaction
│ ├── session.rs # Session/tab state management
│ ├── persistence.rs # Workspace save/load (~/.agcanvas/)
│ ├── command_palette.rs # Cmd+K command palette with fuzzy search
│ ├── element_tree.rs # Structured element representation
│ ├── clipboard.rs # System clipboard integration
│ ├── mermaid.rs # Mermaid → SVG rendering
@@ -372,6 +378,7 @@ crates/
| `arboard` | Clipboard access |
| `tokio-tungstenite` | WebSocket (both server and client) |
| `rmcp` | MCP server SDK (Anthropic official) |
| `dirs` | Platform data directory paths |
| `serde`/`serde_json` | Serialization |
## Roadmap
@@ -383,6 +390,8 @@ crates/
- [x] MCP server bridge for AI coding tools
- [x] Agent draw commands (modify canvas from agent)
- [x] Session metadata (creator tracking, descriptions, timestamps, sorting)
- [x] Session persistence (auto-save/restore workspace)
- [x] Command palette (Cmd+K)
- [ ] Real code generation (not just stubs)
- [ ] Export to file
- [ ] Diff view (before/after agent changes)