laramux 1.3.1

A TUI application for managing Laravel development processes
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
# LaraMux

A terminal UI application for managing Laravel development processes in a single terminal window.

![Rust](https://img.shields.io/badge/rust-1.70%2B-orange)
![License](https://img.shields.io/badge/license-MIT-blue)
![Downloads](https://img.shields.io/github/downloads/jonaspauleta/laramux/v1.0.0/total)

![LaraMux Preview](public/preview.gif)

## Table of Contents

- [Features]#features
- [Installation]#installation
  - [Quick Install]#quick-install-linux--macos
  - [Cargo]#cargo-cratesio
  - [Homebrew]#homebrew-macos--linux
  - [apt (Debian/Ubuntu)]#apt-debianubuntu
  - [dnf (Fedora/RHEL)]#dnf-fedorarhel
  - [Download Binary]#download-binary
  - [Build from Source]#build-from-source
- [Updating]#updating
- [Usage]#usage
  - [Requirements]#requirements
  - [Keyboard Controls]#keyboard-controls
- [Detected Services]#detected-services
- [Laravel Sail]#laravel-sail
  - [Automatic Detection]#automatic-detection
  - [Supervisor Support]#supervisor-support
  - [How Supervisor Detection Works]#how-supervisor-detection-works
  - [Sail Configuration]#sail-configuration
- [Configuration]#configuration
  - [Disable Built-in Processes]#disable-built-in-processes
  - [Override Process Commands]#override-process-commands
  - [Add Custom Processes]#add-custom-processes
  - [Quality Tools Configuration]#quality-tools-configuration
  - [Log Configuration]#log-configuration
  - [Artisan Configuration]#artisan-configuration
  - [Restart Policies]#restart-policies
  - [Complete Example]#complete-example
- [Troubleshooting]#troubleshooting
- [Development]#development
- [License]#license
- [Contributing]#contributing

## Features

- **Unified Process Management** - Run `artisan serve`, Vite, queue workers, and Reverb in one terminal
- **Auto-Discovery** - Automatically detects available services from `composer.json` and `package.json`
- **Real-time Log Viewing** - Watch `storage/logs/laravel.log` updates in real-time
- **Smart Package Manager Detection** - Detects npm, yarn, pnpm, or bun for running Vite
- **Hotkey Controls** - Quickly restart individual processes or all at once
- **Custom Processes** - Add your own processes via [configuration]#configuration
- **Graceful Shutdown** - Properly terminates all child processes on exit

## Installation

### Quick Install (Linux & macOS)

```bash
curl -fsSL https://raw.githubusercontent.com/jonaspauleta/laramux/main/install.sh | sh
```

### Cargo (crates.io)

```bash
cargo install laramux
```

### Homebrew (macOS & Linux)

```bash
brew tap jonaspauleta/tap
brew install laramux
```

### apt (Debian/Ubuntu)

```bash
# Download the .deb package
curl -LO https://github.com/jonaspauleta/laramux/releases/latest/download/laramux_amd64.deb

# Install
sudo dpkg -i laramux_amd64.deb
```

For ARM64 systems, use `laramux_arm64.deb` instead.

### dnf (Fedora/RHEL)

```bash
# Download the .rpm package
curl -LO https://github.com/jonaspauleta/laramux/releases/latest/download/laramux_x86_64.rpm

# Install
sudo dnf install ./laramux_x86_64.rpm
```

For ARM64 systems, use `laramux_aarch64.rpm` instead.

### Download Binary

Download pre-built binaries from [GitHub Releases](https://github.com/jonaspauleta/laramux/releases):

| Platform | Binary |
|----------|--------|
| macOS (Apple Silicon) | `laramux-macos-aarch64` |
| macOS (Intel) | `laramux-macos-x86_64` |
| Linux (x86_64) | `laramux-linux-x86_64` |
| Linux (ARM64) | `laramux-linux-aarch64` |
| Windows | `laramux-windows-x86_64.exe` |

```bash
# Example: macOS Apple Silicon
curl -L https://github.com/jonaspauleta/laramux/releases/latest/download/laramux-macos-aarch64 -o laramux
chmod +x laramux
sudo mv laramux /usr/local/bin/
```

### Build from Source

Requires [Rust](https://rustup.rs/) 1.70 or later.

```bash
git clone https://github.com/jonaspauleta/laramux.git
cd laramux
cargo install --path .
```

## Updating

Update to the latest version with:

```bash
laramux update
```

## Usage

Navigate to your Laravel project directory and run:

```bash
cd /path/to/your/laravel-project
laramux
```

### Requirements

LaraMux expects to be run from a Laravel project root containing:
- `composer.json` with `laravel/framework` as a dependency
- Optionally `package.json` with Vite for frontend assets

### Keyboard Controls

| Key | Action |
|-----|--------|
| `↑` / `↓` | Navigate process list |
| `s` | Restart Laravel serve |
| `v` | Restart Vite dev server |
| `q` | Restart queue worker |
| `h` | Restart Horizon |
| `b` | Restart Reverb (websockets) |
| `r` | Restart all processes |
| `c` | Clear selected process output |
| `f` | Toggle favorite (Artisan/Make tabs) |
| `Page Up` / `Page Down` | Scroll output |
| `Ctrl+C` | Quit and stop all processes |

Custom processes can define their own hotkeys (see [Configuration](#configuration)).

## Detected Services

LaraMux automatically detects and manages:

| Service | Detection | Command |
|---------|-----------|---------|
| **Serve** | Always (unless Laravel Herd detected) | `php artisan serve` |
| **Queue** | Always (unless Horizon detected) | `php artisan queue:work --tries=3` |
| **Horizon** | `laravel/horizon` in composer.json | `php artisan horizon` |
| **Vite** | `vite` in package.json | `npm/yarn/pnpm/bun run dev` |
| **Reverb** | `laravel/reverb` in composer.json | `php artisan reverb:start` |

> **Note:** If [Laravel Herd]https://herd.laravel.com is installed on macOS, LaraMux will skip `artisan serve` since Herd handles serving automatically.

## Laravel Sail

LaraMux has full support for [Laravel Sail](https://laravel.com/docs/sail) projects. When Sail is detected, all commands are automatically routed through the Sail CLI to run inside the Docker container.

### Automatic Detection

LaraMux detects Sail by checking for `vendor/bin/sail` in your project. When active:

- `artisan serve` is skipped (Sail's Docker container handles serving)
- Artisan commands run via `./vendor/bin/sail artisan <command>`
- PHP vendor tools run via `./vendor/bin/sail php ./vendor/bin/<tool>`
- JS scripts run via `./vendor/bin/sail <package-manager> run <script>`
- Sail takes precedence over Laravel Herd (project-specific vs system-level)

### Supervisor Support

Many Sail projects use [supervisord](http://supervisord.org/) to manage long-running services like Horizon, Reverb, queue workers, and Vite inside the container. LaraMux automatically detects these supervised services and adapts its behavior:

- **No duplicate processes** - Instead of starting a second instance, LaraMux tails the supervisor-managed log output
- **Supervised status indicator** - Supervised processes show a blue `◆` indicator and `[sup]` label in the sidebar
- **Contextual controls** - Action hints change to reflect supervised behavior:

| Status | Actions |
|--------|---------|
| Running | `[x]detach` `[r]reconnect` |
| Stopped | `[s]tail logs` |

- **No auto-restart** - Supervisor manages the process lifecycle, so LaraMux won't attempt to restart supervised services

### How Supervisor Detection Works

LaraMux reads the supervisord config at `/etc/supervisor/conf.d/supervisord.conf` inside the Sail container and parses `[program:X]` sections. Program names are matched to LaraMux process types:

| Program name contains | Mapped to |
|-----------------------|-----------|
| `horizon` | Horizon |
| `reverb` | Reverb |
| `worker` or `queue` | Queue |
| `vite` | Vite |

**Auto log setup:** If supervised programs log to `/dev/stdout` (the default in many Sail configurations), LaraMux automatically patches the supervisor config inside the container to redirect output to individual log files under `/var/log/supervisor/`. This allows per-program log tailing. The change is non-destructive — it only affects the running container and does not modify your project files. A marker file prevents re-running on subsequent LaraMux starts within the same container session.

### Sail Configuration

You can force-enable or force-disable Sail mode in `.laramux.json`:

```json
{
  "sail": true
}
```

| Value | Behavior |
|-------|----------|
| `true` | Force Sail mode on (even without `vendor/bin/sail`) |
| `false` | Force Sail mode off (ignore Sail even if present) |
| *omitted* | Auto-detect based on `vendor/bin/sail` (default) |

## Configuration

Create a `.laramux.json` file in your Laravel project root to customize LaraMux behavior. All sections are optional.

For IDE autocompletion and validation, add the schema reference:

```json
{
  "$schema": "https://raw.githubusercontent.com/jonaspauleta/laramux/main/.laramux.schema.json"
}
```

### Disable Built-in Processes

```json
{
  "disabled": {
    "serve": true,
    "queue": true
  }
}
```

Available processes to disable: `serve`, `vite`, `queue`, `horizon`, `reverb`

### Override Process Commands

Override command, arguments, working directory, environment variables, and restart behavior:

```json
{
  "overrides": {
    "serve": {
      "command": "php",
      "args": ["artisan", "serve", "--port=8080", "--host=0.0.0.0"],
      "working_dir": "backend",
      "env": {
        "APP_DEBUG": "true"
      },
      "restart_policy": "on_failure"
    },
    "queue": {
      "args": ["artisan", "queue:work", "--tries=5", "--timeout=90"],
      "restart_policy": "always"
    }
  }
}
```

| Field | Description |
|-------|-------------|
| `command` | Override the executable |
| `args` | Override command arguments |
| `working_dir` | Relative path from project root (no `..` allowed) |
| `env` | Environment variables (keys must be alphanumeric with underscores) |
| `restart_policy` | `never` (default), `on_failure`, or `always` |

### Add Custom Processes

```json
{
  "custom": [
    {
      "name": "scheduler",
      "display_name": "Scheduler",
      "hotkey": "d",
      "command": "php",
      "args": ["artisan", "schedule:work"],
      "working_dir": "backend",
      "env": {
        "LOG_LEVEL": "debug"
      },
      "restart_policy": "always"
    },
    {
      "name": "octane",
      "display_name": "Octane",
      "hotkey": "o",
      "command": "php",
      "args": ["artisan", "octane:start", "--watch"]
    }
  ]
}
```

| Field | Required | Description |
|-------|----------|-------------|
| `name` | Yes | Unique identifier for the process |
| `display_name` | Yes | Name shown in the sidebar |
| `command` | Yes | Executable to run |
| `args` | No | Command arguments (default: `[]`) |
| `hotkey` | No | Single lowercase letter for quick restart |
| `enabled` | No | Set to `false` to disable (default: `true`) |
| `working_dir` | No | Relative path from project root |
| `env` | No | Environment variables |
| `restart_policy` | No | `never`, `on_failure`, or `always` |

**Reserved hotkeys:** `r` (restart all), `c` (clear output), `s`, `v`, `q`, `h`, `b` (built-in processes)

### Quality Tools Configuration

Customize the Quality tab tools - disable tools, add custom ones, or set default arguments:

```json
{
  "quality": {
    "disabled_tools": ["phpcs", "PHP_CodeSniffer"],
    "custom_tools": [
      {
        "name": "custom-lint",
        "display_name": "Custom Linter",
        "command": "./scripts/lint.sh",
        "args": ["--fix"],
        "category": "quality"
      },
      {
        "name": "dusk",
        "display_name": "Laravel Dusk",
        "command": "php",
        "args": ["artisan", "dusk"],
        "category": "testing"
      }
    ],
    "default_args": {
      "phpstan": ["--memory-limit=512M"],
      "pest": ["--parallel"]
    }
  }
}
```

| Field | Description |
|-------|-------------|
| `disabled_tools` | List of tool display names to hide |
| `custom_tools` | Add custom quality or testing tools |
| `default_args` | Extra arguments to append (keyed by lowercase tool name) |

Custom tool fields:

| Field | Required | Description |
|-------|----------|-------------|
| `name` | Yes | Unique identifier |
| `display_name` | Yes | Name shown in Quality tab |
| `command` | Yes | Executable to run |
| `args` | No | Command arguments |
| `category` | Yes | `quality` or `testing` |

### Log Configuration

Customize log viewing behavior:

```json
{
  "logs": {
    "max_lines": 500,
    "files": [
      "storage/logs/queue.log",
      "storage/logs/horizon.log"
    ],
    "default_filter": "warning"
  }
}
```

| Field | Description |
|-------|-------------|
| `max_lines` | Max log lines to keep (10-10000, default: 100) |
| `files` | Additional log files to watch (relative paths) |
| `default_filter` | Default level filter: `debug`, `info`, `notice`, `warning`, `error`, `critical`, `alert`, `emergency` |

### Artisan & Make Favorites

Mark your frequently used commands as favorites by pressing `f` while viewing them in the Artisan or Make tabs. Favorites appear at the top of the command list with a ★ indicator and are automatically saved to your config file.

You can also configure favorites manually:

```json
{
  "artisan": {
    "favorites": ["migrate:fresh", "cache:clear", "optimize:clear"]
  },
  "make": {
    "favorites": ["make:model", "make:controller", "make:migration"]
  }
}
```

| Section | Description |
|---------|-------------|
| `artisan.favorites` | Array of artisan command names to mark as favorites |
| `make.favorites` | Array of make command names to mark as favorites |

### Restart Policies

Processes can be configured to automatically restart:

| Policy | Behavior |
|--------|----------|
| `never` | Never auto-restart (default) |
| `on_failure` | Restart only if exit code is non-zero |
| `always` | Always restart regardless of exit code |

Auto-restart uses exponential backoff (2^failures seconds, max 60s) to prevent rapid restart loops.

### Complete Example

```json
{
  "$schema": "https://raw.githubusercontent.com/jonaspauleta/laramux/main/.laramux.schema.json",
  "disabled": {
    "serve": true
  },
  "overrides": {
    "queue": {
      "args": ["artisan", "queue:work", "--queue=high,default"],
      "restart_policy": "on_failure"
    }
  },
  "custom": [
    {
      "name": "scheduler",
      "display_name": "Scheduler",
      "hotkey": "d",
      "command": "php",
      "args": ["artisan", "schedule:work"],
      "restart_policy": "always"
    }
  ],
  "quality": {
    "disabled_tools": ["phpcs"],
    "default_args": {
      "phpstan": ["--memory-limit=512M"]
    }
  },
  "logs": {
    "max_lines": 500,
    "default_filter": "warning"
  },
  "artisan": {
    "favorites": ["migrate:fresh", "cache:clear"]
  },
  "make": {
    "favorites": ["make:model", "make:controller"]
  }
}
```

## Troubleshooting

### "composer.json not found"
Make sure you're running LaraMux from your Laravel project's root directory.

### "Not a Laravel project"
Ensure `laravel/framework` is listed in your `composer.json` dependencies.

### Vite not starting
Check that:
- `package.json` exists with a `dev` script
- `vite` or `laravel-vite-plugin` is in your devDependencies
- Node modules are installed (`npm install`)

### Processes not stopping on exit
LaraMux sends SIGTERM and waits 5 seconds before SIGKILL. If processes persist, they may be ignoring signals.

## Development

```bash
# Run in development
cargo run

# Run tests
cargo test

# Check formatting
cargo fmt --check

# Run linter
cargo clippy
```

## License

MIT License - see [LICENSE](LICENSE) for details.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.