July 2024

Terminal Toolkit

A collection of composable CLI utilities for developer workflow automation — log parsing, process supervision, structured output formatting — all in a single binary.

  • Rust
  • CLI
  • Linux
  • Developer Tools

Interactive demo loading…

Set demoUrl in frontmatter to embed a live demo

Overview

A batteries-included CLI binary (tt) with sub-commands for the tasks I kept reinventing across projects:

  • tt logs — structured log parsing (JSON, logfmt, plaintext) with filtering, highlighting, and tail-follow
  • tt proc — lightweight process supervisor with health checks, restart policies, and a live TUI dashboard
  • tt fmt — piped output formatter: tables, trees, key-value, diff highlighting
  • tt env — dotenv diffing, validation, and secret detection

Why a monorepo binary?

Instead of maintaining four separate crates with separate release cycles, everything ships as one binary with sub-commands. This means:

  • One cargo install to get everything
  • Shared core utilities (error types, config parsing, terminal detection)
  • A single man page and shell completion file

Technical notes

Log parsing

tt logs uses a streaming parser that handles GB-scale log files without loading them into memory. The filtering engine compiles filter expressions to a small bytecode interpreter rather than chaining .filter() closures — this shaved ~40% off parsing time for complex filters with many field checks.

tt logs --filter 'level=error AND service=auth AND latency>500ms' app.log

Process supervisor

The supervisor is intentionally minimal — it’s not trying to replace systemd or supervisord. It targets the “run this dev dependency stack locally and restart it when it crashes” use case.

# tt.toml
[[process]]
name = "postgres"
cmd = "docker run --rm -p 5432:5432 postgres:16-alpine"
health = { tcp = "127.0.0.1:5432", interval = "2s", timeout = "30s" }

[[process]]
name = "api"
cmd = "cargo run --bin api"
depends_on = ["postgres"]
restart = "on-failure"

Status

The log parser and formatter are stable. The process supervisor is functional but the TUI dashboard is still rough. Shell completions exist for zsh and bash.