diff --git a/.twicc-tmux.json b/.twicc-tmux.json new file mode 100644 index 0000000..41ee400 --- /dev/null +++ b/.twicc-tmux.json @@ -0,0 +1,22 @@ +[ + { + "name": "Restart Twicc", + "command": "exec uv run ./devctl.py restart" + }, + { + "name": "Restart Twicc Backend", + "command": "exec uv run ./devctl.py restart back" + }, + { + "name": "Restart Twicc Frontend", + "command": "exec uv run ./devctl.py restart front" + }, + { + "name": "Backend Logs", + "command": "tail -f ~/.twicc/logs/backend.log" + }, + { + "name": "Frontend Logs", + "command": "tail -f ~/.twicc/logs/frontend.log" + } +] diff --git a/docs/terminal-presets.md b/docs/terminal-presets.md new file mode 100644 index 0000000..04bde14 --- /dev/null +++ b/docs/terminal-presets.md @@ -0,0 +1,35 @@ +# Terminal Presets (`.twicc-tmux.json`) + +Define preset shell sessions for the terminal's tmux navigator by placing a `.twicc-tmux.json` file at the root of your project directory. + +## Format + +The file is a JSON array of preset objects: + +| Field | Type | Required | Description | +|-----------|--------|----------|----------------------------------------------------------| +| `name` | string | **yes** | Display name, also used as the tmux window name | +| `command` | string | no | Command to run automatically when the window is created | +| `cwd` | string | no | Working directory (absolute, or relative to project root) | + +## Example + +```json +[ + { "name": "dev", "cwd": "./frontend", "command": "npm run dev" }, + { "name": "logs", "command": "tail -f logs/backend.log" }, + { "name": "shell" } +] +``` + +## Behavior + +- Presets appear in the terminal's **shell navigator** (the full-page picker) and are prefixed with a ▶ icon in the **tab bar** (desktop) and **dropdown** (mobile). +- A preset that is currently running shows a green ▶ icon in the navigator. Clicking it switches to the existing window instead of creating a duplicate. +- When a preset window is created, its `command` (if any) is sent as keystrokes to the new tmux window. +- Relative `cwd` paths are resolved against the project directory. +- The file is re-read every time the window list is refreshed, so changes take effect without restarting the server. + +## Implementation + +Loaded by `load_tmux_presets()` in `src/twicc/terminal.py`. diff --git a/frontend/src/components/TerminalPanel.vue b/frontend/src/components/TerminalPanel.vue index 64859db..5d2d454 100644 --- a/frontend/src/components/TerminalPanel.vue +++ b/frontend/src/components/TerminalPanel.vue @@ -1,6 +1,10 @@