code nyc

ratcoord πŸ€

terminal ui for coordinating multiple processes with inter-process signaling.

coordinate yr rat nest of code? dunno, but i wanted to run a frontend react app that has two linked packages, and a backend dev server. so i cobbled together this crude process orchestration thingy. it uses ratatui.rs cuz it’s neat; it collects all the stdout & stderr streams and combines them together with some color coding (&time stamps); you can toggle log output off (and on) and filter the logs with a search query (cuz Ghostty doesn’t have ⌘ + f ;(). each process has a setup and teardown command; processes can send SIGHUP (restart) signals to other processes when a regex string pattern matches stdout (triggers).

oh, and my pal claude helped me write most of this, so beware of the ai vibecode. weird time 4 software develz.

scrolling is currently b0rk’d in macos terminal.app (sorry); use Ghostty.

TUI demo

quick start

if you don’t have rust:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env

(my very best opinion: just use rustup.rs, homebrew is pain)

git clone https://github.com/edwardsharp/ratcoord.git
cd ratcoord
cargo install --path .
## cargo will install binary to ~/.cargo/bin
## (which should be in $PATH, so you can run `ratcoord` anywhere!)
ratcoord --init          # creates .ratcoord.toml
ratcoord
## otherwise wise run:
#> cargo run
## or to pass args:
#> cargo run -- -c assets/.ratcoord.example.toml

usage

ratcoord

a terminal ui for coordinating multiple processes with setup/teardown/run commands and inter-process triggers.

configure your processes in a .ratcoord.toml file and use the interactive tui to start, stop, and monitor stdout & stderr.

usage examples:
    ratcoord                    # run with default config (.ratcoord.toml)
    ratcoord -c my-config.toml  # run with custom config file
    ratcoord --init             # create a default config file
    ratcoord --debug            # enable debug logging to ./ratcoord.log file

controls (in tui):
    [1-X]     toggle process X visibility
    [/]       filter logs by search term
    [esc]     clear search filter
    [c]       clear logs
    [s]       start/stop processes
    [r]       restart processes
    [q]       quit application
    [enter]   return to bottom and resume auto-scroll
    [↑↓]      scroll through logs
    [home]    jump to top
    [end]     jump to bottom

vim-style controls:
    [j]       scroll down (towards bottom)
    [k]       scroll up (towards top)
    [g]       jump to top
    [G]       jump to bottom

Usage: ratcoord [OPTIONS]

Options:
  -c, --config <CONFIG>      path to configuration file [default: .ratcoord.toml]
  -d, --debug                enable debug mode (more verbose logging)
  -l, --log-file <LOG_FILE>  log file path for debugging [default: ratcoord.log]
      --init                 initialize a default .ratcoord.toml config file
  -h, --help                 Print help
  -V, --version              Print version

configuration

minimal config requires only command per process:

[processes.server]
command = "npm run dev"

[processes.app]
command = "npm start"

common options:

  • auto_start = true - start automatically when ratcoord starts (default: true)
  • setup_command - run before main command
  • teardown_command - run after process stops (before ratcoord exits)
  • restart_signal = "SIGHUP" - signal for restart trigger (default: SIGHUP)

triggers enable process coordination:

[[processes.app.triggers]]
pattern = "server ready" # string match in stdout that will trigger action
actions = [{ action_type = "start", target = "app" }]

configuration options

# global settings (optional)
[settings]
max_log_lines = 25000                           # log lines to keep in memory
timestamp_format = "%H:%M:%S"                   # log timestamp format
max_line_length = 2500                          # split long lines at this length
max_line_truncate = 10000                       # truncate extremely long lines
ansi_strip_regex = "\\x1b\\[[0-9;]*[a-zA-Z]"   # strip ANSI codes (empty = disable)

# process configuration
[processes.myprocess]
command = "npm run dev"                         # required: command to run
cwd = "."                                       # working directory (default: ".")
auto_start = true                               # start automatically (default: true)
start_delay_seconds = 0                         # delay before start (default: 0)
restart_signal = "SIGHUP"                       # signal for restart (default: "SIGHUP")
color = "#ff69b4"                               # log color (default: "hot_pink")
setup_command = "npm install"                   # run before main command
teardown_command = "npm run cleanup"            # run after process stops

# triggers enable process coordination
[[processes.myprocess.triggers]]
pattern = "server ready"                        # regex string pattern to match stdout
description = "start app when server ready"     # optional description
actions = [
    { action_type = "start", target = "app" },
    { action_type = "restart", target = "worker" },
]

example config

a bit more realistic example, here i’ve got:

  1. a nodejs api server,
  2. a vite hot-reloading frontend app server,
  3. and a npm package that needs to be linked and hooked into the other hot-reloading stuff
[processes.client-pkg]
# builds the client package once, then watches for changes
setup_command = "cd data/client && npm install && npm run build"
command = "cd data/client && npm run build:watch"
auto_start = false
start_delay_seconds = 0
color = "#00bfff"

[[processes.client-pkg.triggers]]
pattern = "build completed successfully"
actions = [
    { action_type = "start", target = "server" }
]

[processes.server]
# starts the data service server
setup_command = "cd data/server && npm install"
command = "cd data/server && npm run dev"
auto_start = true
start_delay_seconds = 0
color = "#32cd32"

[[processes.server.triggers]]
pattern = "server listening|Server running"
actions = [
    { action_type = "start", target = "app" }
]

[processes.app]
# starts the main app
setup_command = "cd app && npm install"
command = "cd app && npm run dev:app-only"
auto_start = true
start_delay_seconds = 2
color = "#ff69b4"

[processes.package]
# manual build trigger for the client package
command = "cd data/client && npm run build && echo 'client package built successfully'"
auto_start = false
color = "#ffa500"

[[processes.package.triggers]]
pattern = "client package built successfully"
actions = [
    { action_type = "restart", target = "server" },
    { action_type = "restart", target = "app" }
]

# settings for better log handling with npm outputs
[settings]
max_log_lines = 30000
max_line_length = 3000
max_line_truncate = 12000

see assets/.ratcoord.example.toml for more examples.


made with πŸ’– in NYC