Skip to content

Commit 2cf3bd6

Browse files
feat: add support for service types and dynamic status updates in documentation
1 parent cb50199 commit 2cf3bd6

File tree

1 file changed

+152
-1
lines changed

1 file changed

+152
-1
lines changed

README.md

Lines changed: 152 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ A terminal UI for managing multiple dev services with colored logs, filtering, a
1616

1717
- **Bubble Tea TUI** - Interactive terminal UI with tabs, viewport, and status bar
1818
- **Colored Logs** - Each service has its own color for easy identification
19+
- **Service Types** - Long-running, oneshot, interval, and HTTP request services
20+
- **Custom Icons** - Emoji icons for services with dynamic status updates
1921
- **Service Filtering** - View logs from all services or filter by specific service
2022
- **Search** - Filter logs by text pattern
2123
- **Port Management** - Detects ports in use and offers to kill them
@@ -109,6 +111,7 @@ All clients share the same daemon and see the same logs in real-time. When Claud
109111
| `1-9` | Select specific service |
110112
| `a` | Show all services |
111113
| `/` | Search logs |
114+
| `c` | Copy logs to clipboard |
112115
| `r` | Restart current service |
113116
| `j/k` | Scroll up/down |
114117
| `q` | Quit |
@@ -144,6 +147,128 @@ defaults:
144147
| `cmd` | Command to run |
145148
| `port` | Port number (for status display) |
146149
| `color` | Log prefix color: `blue`, `green`, `yellow`, `magenta`, `cyan`, `red`, `white` |
150+
| `icon` | Custom emoji/icon for the service |
151+
| `type` | Service type: `service` (default), `oneshot`, `interval`, `http` |
152+
| `interval` | Run interval for `interval` type (e.g., `5s`, `1m`) |
153+
| `url` | URL for `http` type |
154+
| `method` | HTTP method for `http` type (default: `GET`) |
155+
| `body` | Request body for `http` type |
156+
| `headers` | Custom headers for `http` type |
157+
158+
## Service Types
159+
160+
Devir supports 4 different service types:
161+
162+
### `service` (default)
163+
Long-running process. For web servers, APIs, etc.
164+
165+
```yaml
166+
web:
167+
dir: apps/web
168+
cmd: npm run dev
169+
port: 3000
170+
icon: "🌐"
171+
color: blue
172+
```
173+
174+
### `oneshot`
175+
Run once and exit. For migrations, setup scripts, etc.
176+
177+
```yaml
178+
migrate:
179+
type: oneshot
180+
dir: .
181+
cmd: npm run migrate
182+
icon: "⚙️"
183+
color: yellow
184+
```
185+
186+
### `interval`
187+
Run periodically. For health checks, cleanup jobs, etc.
188+
189+
```yaml
190+
health:
191+
type: interval
192+
interval: 5s
193+
dir: .
194+
cmd: bash health.sh
195+
icon: "💓"
196+
color: green
197+
```
198+
199+
### `http`
200+
Make HTTP requests. For API calls, webhooks, etc.
201+
202+
```yaml
203+
api-check:
204+
type: http
205+
url: https://api.example.com/health
206+
method: GET
207+
icon: "📡"
208+
color: magenta
209+
```
210+
211+
With POST body:
212+
213+
```yaml
214+
notify:
215+
type: http
216+
url: https://api.example.com/webhook
217+
method: POST
218+
body: '{"event": "started"}'
219+
headers:
220+
- "Authorization: Bearer token123"
221+
icon: "📤"
222+
color: cyan
223+
```
224+
225+
## Status Symbols
226+
227+
| Symbol | Status | Description |
228+
|:------:|--------|-------------|
229+
| `●` | Running | Service is active |
230+
| `✓` | Completed | Oneshot/HTTP completed successfully |
231+
| `✗` | Failed | Service failed |
232+
| `◐` | Waiting | Interval service waiting for next run |
233+
| `○` | Stopped | Service is stopped |
234+
235+
## Dynamic Status
236+
237+
Services can dynamically update their icon and status by writing to `.devir-status` file in their directory:
238+
239+
```bash
240+
# Simple - just icon
241+
echo "🟢" > .devir-status
242+
243+
# JSON - icon + message
244+
echo '{"icon": "🟢", "message": "All OK"}' > .devir-status
245+
246+
# JSON - full control
247+
echo '{"icon": "🔴", "color": "red", "status": "failed", "message": "DB down!"}' > .devir-status
248+
```
249+
250+
### Dynamic Status Fields
251+
252+
| Field | Description |
253+
|-------|-------------|
254+
| `icon` | Override icon with emoji or short text |
255+
| `color` | Override service color |
256+
| `status` | Override status: `running`, `completed`, `failed`, `waiting` |
257+
| `message` | Status message (shown in MCP response) |
258+
259+
### Example: Health Check with Dynamic Status
260+
261+
```bash
262+
#!/bin/bash
263+
# health.sh
264+
if curl -sf http://localhost:3000/health >/dev/null 2>&1; then
265+
echo '{"icon": "🟢", "message": "All systems operational"}' > .devir-status
266+
echo "Health OK"
267+
else
268+
echo '{"icon": "🔴", "color": "red", "message": "Service down!"}' > .devir-status
269+
echo "Health FAIL"
270+
fi
271+
```
147272

148273
## MCP Integration
149274

@@ -169,12 +294,38 @@ Add to your project's `.mcp.json`:
169294
|------|-------------|
170295
| `devir_start` | Start services |
171296
| `devir_stop` | Stop all services |
172-
| `devir_status` | Get service status |
297+
| `devir_status` | Get service status (includes type, icon, message) |
173298
| `devir_logs` | Get recent logs |
174299
| `devir_restart` | Restart a service |
175300
| `devir_check_ports` | Check if ports are in use |
176301
| `devir_kill_ports` | Kill processes on ports |
177302

303+
### MCP Status Response Example
304+
305+
```json
306+
{
307+
"services": [
308+
{
309+
"name": "web",
310+
"running": true,
311+
"port": 3000,
312+
"type": "service",
313+
"status": "running",
314+
"icon": "🌐"
315+
},
316+
{
317+
"name": "health",
318+
"running": true,
319+
"type": "interval",
320+
"status": "waiting",
321+
"icon": "🟢",
322+
"message": "All systems operational",
323+
"runCount": 5
324+
}
325+
]
326+
}
327+
```
328+
178329
## Development
179330

180331
```bash

0 commit comments

Comments
 (0)