boxmux 0.240.3373

YAML-driven terminal UI framework for rich, interactive CLI applications and dashboards with PTY support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
---
title: Configuration Examples
description: BoxMux configuration examples for various use cases and application types
---


## System Monitoring Dashboard

A system monitoring application with real-time stats and interactive controls.

```yaml
# system_monitor.yaml
title: "System Monitor Dashboard"
refresh_rate: 50

variables:
  hostname: "{{HOSTNAME}}"
  user: "{{USER}}"

layouts:
  main:
    type: "MuxBox"
    bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "100%" }
    children:
      header:
        bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "15%" }
        content: "πŸ“Š {{hostname}} System Monitor - User: {{user}}"
        border_color: "BrightCyan"
        title_color: "BrightYellow"
        
      cpu_stats:
        bounds: { x1: "0%", y1: "15%", x2: "33%", y2: "60%" }
        title: "CPU Usage"
        border_color: "BrightGreen"
        script: |
          #!/bin/bash
          while true; do
            top -l1 | grep "CPU usage" | awk '{print $3, $5}'
            sleep 1
          done
        refresh_interval: 1000
        thread: true
        streaming: true
        
      memory_stats:
        bounds: { x1: "33%", y1: "15%", x2: "66%", y2: "60%" }
        title: "Memory Usage"
        border_color: "BrightBlue" 
        script: |
          #!/bin/bash
          vm_stat | grep -E "(Pages free|Pages active|Pages wired)" | 
          awk '{printf "%s: %d MB\n", $1$2, $3*4/1024}'
        refresh_interval: 2000
        thread: true
        
      disk_stats:
        bounds: { x1: "66%", y1: "15%", x2: "100%", y2: "60%" }
        title: "Disk Usage"
        border_color: "BrightMagenta"
        script: "df -h | grep -E '^/dev/'"
        refresh_interval: 5000
        
      control_panel:
        bounds: { x1: "0%", y1: "60%", x2: "50%", y2: "100%" }
        title: "Actions"
        border_color: "BrightYellow"
        choices:
          - name: "πŸ”„ Refresh All Stats"
            script: "echo 'Refreshing all statistics...'"
            redirect_output: "log_output"
            
          - name: "πŸ“‹ Copy System Info"
            script: |
              echo "System: $(uname -a)"
              echo "Uptime: $(uptime)"
              echo "Load: $(uptime | awk '{print $NF}')"
            redirect_output: "log_output"
            
          - name: "⚑ Interactive Terminal"
            script: "bash"
            pty: true
            redirect_output: "terminal_box"
            
      log_output:
        bounds: { x1: "50%", y1: "60%", x2: "100%", y2: "85%" }
        title: "Output Log"
        border_color: "BrightWhite"
        content: "Action output will appear here..."
        auto_scroll: true
        
      status_bar:
        bounds: { x1: "50%", y1: "85%", x2: "100%", y2: "100%" }
        border_color: "BrightBlack"
        script: "date '+Last Updated: %Y-%m-%d %H:%M:%S'"
        refresh_interval: 1000

active: "main"

# Global key bindings
on_keypress:
  "Ctrl+r": "refresh_all"
  "Ctrl+q": "quit"
  "F1": "show_help"
```

## Development Dashboard

A developer-focused dashboard for project management, testing, and deployment.

```yaml
# dev_dashboard.yaml
title: "Development Dashboard"
refresh_rate: 100

variables:
  project_name: "My Awesome Project"
  git_branch: "{{GIT_BRANCH}}"
  node_env: "development"

layouts:
  main:
    type: "MuxBox"
    bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "100%" }
    children:
      header:
        bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "10%" }
        content: "πŸš€ {{project_name}} - Branch: {{git_branch}}"
        border_color: "BrightCyan"
        
      git_status:
        bounds: { x1: "0%", y1: "10%", x2: "30%", y2: "50%" }
        title: "Git Status"
        border_color: "BrightGreen"
        script: |
          git status --porcelain | head -20
          echo "---"
          git log --oneline -5
        refresh_interval: 3000
        
      actions:
        bounds: { x1: "30%", y1: "10%", x2: "60%", y2: "50%" }
        title: "Quick Actions"
        border_color: "BrightYellow"
        choices:
          - name: "πŸ”¨ Build Project"
            script: "npm run build"
            redirect_output: "build_log"
            streaming: true
            thread: true
            
          - name: "πŸ§ͺ Run Tests"
            script: "npm test"
            redirect_output: "test_log"
            streaming: true
            pty: true
            
          - name: "πŸ“¦ Install Dependencies"
            script: "npm install"
            redirect_output: "build_log"
            streaming: true
            
          - name: "🌐 Start Dev Server"
            script: "npm run dev"
            pty: true
            streaming: true
            
          - name: "πŸ“ Open Editor"
            script: "code ."
            
      package_info:
        bounds: { x1: "60%", y1: "10%", x2: "100%", y2: "50%" }
        title: "Package Info"
        border_color: "BrightBlue"
        script: |
          echo "Dependencies:"
          cat package.json | jq -r '.dependencies | keys[]' | head -10
          echo ""
          echo "Scripts:"
          cat package.json | jq -r '.scripts | keys[]'
        refresh_interval: 10000
        
      build_log:
        bounds: { x1: "0%", y1: "50%", x2: "50%", y2: "85%" }
        title: "Build Output"
        border_color: "BrightMagenta"
        content: "Build output will appear here..."
        overflow_behavior: "scroll"
        auto_scroll: true
        
      test_log:
        bounds: { x1: "50%", y1: "50%", x2: "100%", y2: "85%" }
        title: "Test Results"
        border_color: "BrightRed"
        content: "Test results will appear here..."
        overflow_behavior: "scroll"
        auto_scroll: true
        
      footer:
        bounds: { x1: "0%", y1: "85%", x2: "100%", y2: "100%" }
        border_color: "BrightBlack"
        script: |
          echo "Node: $(node --version) | NPM: $(npm --version) | $(date)"

active: "main"

# Hot keys for common actions
hot_keys:
  "Ctrl+b": 
    choice_id: "build"
    box_id: "actions"
  "Ctrl+t":
    choice_id: "test"
    box_id: "actions"
```

## Server Management Interface

A server administration interface with PTY terminals and monitoring.

```yaml
# server_admin.yaml  
title: "Server Administration"
refresh_rate: 75

variables:
  server_ip: "192.168.1.100"
  admin_user: "admin"

layouts:
  main:
    type: "MuxBox"
    bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "100%" }
    children:
      title_bar:
        bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "8%" }
        content: "πŸ–₯️  Server Admin Panel - {{server_ip}}"
        border_color: "BrightCyan"
        
      server_menu:
        bounds: { x1: "0%", y1: "8%", x2: "25%", y2: "100%" }
        title: "Server Actions"
        border_color: "BrightGreen"
        choices:
          - name: "πŸ“Š System Status"
            script: |
              uptime
              free -h
              df -h
            redirect_output: "main_output"
            
          - name: "πŸ” Process Monitor"
            script: "htop"
            pty: true
            redirect_output: "terminal_area"
            
          - name: "πŸ“ File Manager" 
            script: "ranger"
            pty: true
            redirect_output: "terminal_area"
            
          - name: "🌐 Network Status"
            script: |
              netstat -tulpn | head -20
              echo "---"
              ss -tuln
            redirect_output: "main_output"
            
          - name: "πŸ” SSH to Remote"
            script: "ssh {{admin_user}}@{{server_ip}}"
            pty: true
            redirect_output: "terminal_area"
            
          - name: "πŸ“‹ Service Status"
            script: "systemctl status"
            redirect_output: "main_output"
            
      main_output:
        bounds: { x1: "25%", y1: "8%", x2: "65%", y2: "100%" }
        title: "Command Output"
        border_color: "BrightBlue"
        content: "Select an action to see output..."
        overflow_behavior: "scroll"
        auto_scroll: true
        
      terminal_area:
        bounds: { x1: "65%", y1: "8%", x2: "100%", y2: "80%" }
        title: "⚑ Interactive Terminal"
        border_color: "BrightCyan"
        pty: true
        script: "bash"
        
      system_info:
        bounds: { x1: "65%", y1: "80%", x2: "100%", y2: "100%" }
        title: "Live Stats"
        border_color: "BrightYellow"
        script: |
          echo "Load: $(uptime | awk '{print $NF}')"
          echo "Memory: $(free | awk '/^Mem:/{printf "%.1f%%", $3/$2*100}')"
          echo "Disk: $(df / | awk 'NR==2{print $5}')"
        refresh_interval: 2000
        thread: true

active: "main"
```

## Docker Container Manager

A Docker management interface with container controls and log monitoring.

```yaml
# docker_manager.yaml
title: "Docker Container Manager"
refresh_rate: 100

variables:
  docker_host: "{{DOCKER_HOST}}"

layouts:
  main:
    type: "MuxBox"
    bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "100%" }
    children:
      header:
        bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "10%" }
        content: "🐳 Docker Manager - Host: {{docker_host}}"
        border_color: "BrightBlue"
        
      container_list:
        bounds: { x1: "0%", y1: "10%", x2: "40%", y2: "100%" }
        title: "Running Containers"
        border_color: "BrightGreen"
        script: "docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"
        refresh_interval: 3000
        overflow_behavior: "scroll"
        
      container_actions:
        bounds: { x1: "40%", y1: "10%", x2: "60%", y2: "60%" }
        title: "Container Actions"
        border_color: "BrightYellow"
        choices:
          - name: "πŸ“‹ List All Containers"
            script: "docker ps -a"
            redirect_output: "docker_output"
            
          - name: "πŸ” Container Stats"
            script: "docker stats --no-stream"
            redirect_output: "docker_output"
            
          - name: "πŸ—„οΈ List Images"
            script: "docker images"
            redirect_output: "docker_output"
            
          - name: "🧹 Clean Up"
            script: |
              docker system prune -f
              docker image prune -f
            redirect_output: "docker_output"
            streaming: true
            
          - name: "πŸ“Š System Info"
            script: "docker system df"
            redirect_output: "docker_output"
            
      docker_compose:
        bounds: { x1: "40%", y1: "60%", x2: "60%", y2: "100%" }
        title: "Docker Compose"
        border_color: "BrightMagenta"
        choices:
          - name: "πŸš€ Compose Up"
            script: "docker-compose up -d"
            redirect_output: "docker_output"
            streaming: true
            
          - name: "⏹️ Compose Down"
            script: "docker-compose down"
            redirect_output: "docker_output"
            
          - name: "πŸ“‹ Compose Status"
            script: "docker-compose ps"
            redirect_output: "docker_output"
            
          - name: "πŸ“„ View Logs"
            script: "docker-compose logs --tail=50 -f"
            pty: true
            redirect_output: "docker_output"
            
      docker_output:
        bounds: { x1: "60%", y1: "10%", x2: "100%", y2: "100%" }
        title: "Docker Output"
        border_color: "BrightWhite"
        content: "Docker command output will appear here..."
        overflow_behavior: "scroll"
        auto_scroll: true

active: "main"

# Quick docker commands via hot keys
hot_keys:
  "Ctrl+l": 
    choice_id: "list_containers"
    box_id: "container_actions"
  "Ctrl+s":
    choice_id: "stats"
    box_id: "container_actions"
```

## Data Visualization Dashboard

A dashboard showcasing BoxMux's data visualization capabilities with charts and tables.

```yaml
# data_dashboard.yaml
title: "Data Visualization Dashboard"
refresh_rate: 200

variables:
  data_source: "/tmp/metrics.json"

layouts:
  main:
    type: "MuxBox"
    bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "100%" }
    children:
      title:
        bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "10%" }
        content: "πŸ“ˆ Data Visualization Dashboard"
        border_color: "BrightCyan"
        
      cpu_chart:
        bounds: { x1: "0%", y1: "10%", x2: "50%", y2: "50%" }
        title: "CPU Usage Trend"
        border_color: "BrightGreen"
        chart:
          type: "line"
          data: [45, 52, 48, 65, 71, 58, 62, 69, 73, 67]
          labels: ["10s", "20s", "30s", "40s", "50s", "60s", "70s", "80s", "90s", "100s"]
          title: "CPU Usage Over Time"
          y_axis_label: "Percentage"
          
      memory_chart:
        bounds: { x1: "50%", y1: "10%", x2: "100%", y2: "50%" }
        title: "Memory Usage"
        border_color: "BrightBlue"
        chart:
          type: "bar"
          data: [2.1, 3.4, 2.8, 4.1, 3.2]
          labels: ["App1", "App2", "App3", "App4", "App5"]
          title: "Memory Usage by Application"
          y_axis_label: "GB"
          
      process_table:
        bounds: { x1: "0%", y1: "50%", x2: "100%", y2: "100%" }
        title: "Process Table"
        border_color: "BrightMagenta"
        table:
          data_source: "csv"
          data: |
            Process,PID,CPU%,Memory,Status
            nginx,1234,2.3%,45MB,Running
            postgres,5678,15.7%,256MB,Running
            redis,9012,0.8%,12MB,Running
            node,3456,8.4%,128MB,Running
            docker,7890,3.2%,89MB,Running
          headers: true
          sortable: true
          zebra_striping: true
          border_style: "rounded"

active: "main"
```

## Multi-Environment DevOps Control

A DevOps control panel for managing multiple environments.

```yaml
# devops_control.yaml
title: "DevOps Control Center"
refresh_rate: 150

variables:
  env: "production"
  kubectl_context: "prod-cluster"
  aws_profile: "production"

layouts:
  main:
    type: "MuxBox"
    bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "100%" }
    children:
      header:
        bounds: { x1: "0%", y1: "0%", x2: "100%", y2: "8%" }
        content: "☸️ DevOps Control - Environment: {{env}}"
        border_color: "BrightCyan"
        
      kubernetes_menu:
        bounds: { x1: "0%", y1: "8%", x2: "20%", y2: "50%" }
        title: "Kubernetes"
        border_color: "BrightBlue"
        choices:
          - name: "πŸ“Š Pod Status"
            script: "kubectl get pods -A"
            redirect_output: "main_output"
            
          - name: "πŸ”§ Services"
            script: "kubectl get svc -A"
            redirect_output: "main_output"
            
          - name: "πŸ“ˆ Top Nodes"
            script: "kubectl top nodes"
            redirect_output: "main_output"
            
          - name: "πŸ“‹ Events"
            script: "kubectl get events --sort-by='.lastTimestamp'"
            redirect_output: "main_output"
            
      deployment_menu:
        bounds: { x1: "0%", y1: "50%", x2: "20%", y2: "100%" }
        title: "Deployments"
        border_color: "BrightGreen"
        choices:
          - name: "πŸš€ Deploy App"
            script: "./deploy.sh {{env}}"
            redirect_output: "deployment_log"
            streaming: true
            
          - name: "πŸ”„ Rolling Update"
            script: "kubectl rollout restart deployment/app"
            redirect_output: "deployment_log"
            
          - name: "βͺ Rollback"
            script: "kubectl rollout undo deployment/app"
            redirect_output: "deployment_log"
            
          - name: "πŸ“Š Rollout Status"
            script: "kubectl rollout status deployment/app"
            redirect_output: "deployment_log"
            
      main_output:
        bounds: { x1: "20%", y1: "8%", x2: "70%", y2: "60%" }
        title: "Command Output"
        border_color: "BrightWhite"
        content: "Select a command to see output..."
        overflow_behavior: "scroll"
        auto_scroll: true
        
      deployment_log:
        bounds: { x1: "20%", y1: "60%", x2: "70%", y2: "100%" }
        title: "Deployment Log"
        border_color: "BrightYellow"
        content: "Deployment output will appear here..."
        overflow_behavior: "scroll" 
        auto_scroll: true
        
      monitoring:
        bounds: { x1: "70%", y1: "8%", x2: "100%", y2: "100%" }
        title: "Live Monitoring"
        border_color: "BrightRed"
        script: |
          echo "=== Cluster Status ==="
          kubectl cluster-info --context={{kubectl_context}} | head -3
          echo ""
          echo "=== Resource Usage ==="
          kubectl top nodes --context={{kubectl_context}} | head -5
          echo ""
          echo "=== Recent Events ==="
          kubectl get events --context={{kubectl_context}} --sort-by='.lastTimestamp' | tail -5
        refresh_interval: 10000
        thread: true
        streaming: true

active: "main"

# Environment switching
on_keypress:
  "F2": "switch_layout:staging"
  "F3": "switch_layout:production"
```

These examples show different BoxMux features:

- Real-time monitoring with streaming output
- Interactive terminals using PTY integration  
- Multi-layout applications with environment switching
- Data visualization with charts and tables
- Socket-based remote control capabilities
- Scripting with output redirection
- Mouse interactions and keyboard shortcuts

Use these as starting points for your own BoxMux applications.