Skip to content

atbuy/carrier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

carrier

CI Docs codecov

carrier is a local developer command logger for Go-based single-binary installs. It records command executions, working directory, timing, exit code, output logs, Git metadata, and optional desktop notifications.

Documentation: https://atbuy.github.io/carrier/

Most users will alias it:

alias c='carrier'

Quick usage:

c run go test ./...
c last
c show 1

Features

  • carrier run <command...> records one command while preserving the child exit code.
  • stdout and stderr stream live to the terminal and are stored separately.
  • persisted logs are redacted by default with buffered matching for split secrets.
  • persisted logs are capped by storage.max_output_mb to protect disk usage.
  • search uses SQLite FTS over commands, working directories, and output snippets.
  • SQLite metadata is stored in ~/.local/share/carrier/carrier.db.
  • output logs are stored in ~/.local/share/carrier/runs/.
  • optional notifications use notify-send on Linux.
  • human-readable output is colorized on TTYs; use NO_COLOR=1 to disable or CARRIER_COLOR=always to force.
  • carrier shell starts a PTY-backed tracked shell session (alpha). Each shell session groups its runs in carrier history carrier history --session my-session carrier history --sessions-only. Label sessions with carrier shell 'label' or carrier shell --label label.
  • carrier attach <id-or-label> re-opens an existing shell session from a different terminal.
  • carrier session list lists shell sessions; carrier session label sets or clears a session label.

Install

Installer Script

Linux and macOS:

curl -fsSL https://raw.githubusercontent.com/atbuy/carrier/main/install.sh | sh

Install a specific version:

curl -fsSL https://raw.githubusercontent.com/atbuy/carrier/main/install.sh | sh -s -- --version v0.1.0

Windows PowerShell:

irm https://raw.githubusercontent.com/atbuy/carrier/main/install.ps1 | iex

Install a specific version on Windows:

powershell -NoProfile -ExecutionPolicy Bypass -Command "& ([scriptblock]::Create((irm https://raw.githubusercontent.com/atbuy/carrier/main/install.ps1))) -Version v0.1.0"

Installers download prebuilt binaries from GitHub Releases. Release notes include checksum verification details for users who want manual validation.

With Go

Install the latest released module with:

go install github.com/atbuy/carrier/cmd/carrier@latest

Make sure Go's bin directory is on your PATH:

export PATH="$PATH:$(go env GOPATH)/bin"

Then verify the install:

carrier --help

From Source

Clone the repository and build the local binary:

git clone https://github.com/atbuy/carrier.git
cd carrier
make build
./bin/carrier --help

To install from a source checkout:

make install

Recommended Alias

Most examples assume this shell alias:

alias c='carrier'

Add it to your shell config, for example ~/.zshrc or ~/.bashrc.

Common Commands

carrier run go test ./...
carrier -n run docker compose build
carrier -N run ls
carrier shell                      # alpha: start tracked shell session
carrier shell 'my-session'         # alpha: start named session
carrier attach my-session          # alpha: re-join existing session
carrier session list               # list sessions
carrier session label 5 my-label   # label a session
carrier last
carrier last --json
carrier show 42
carrier show 42 --json
carrier tail 42
carrier tail 42 --stream stdout
carrier tail 42 --stream stderr
carrier failed
carrier running
carrier running --json
carrier search "connection refused"
carrier stats
carrier stats --json
carrier export 42
carrier rerun 42
carrier doctor
carrier config path
carrier config show
carrier config check
carrier config init
carrier version
carrier clean --older-than 30d --dry-run
carrier clean --older-than 30d -d
carrier clean --older-than 30d --yes

Configuration

Config is read from ~/.config/carrier/config.toml. Defaults are used when the file is absent.

[storage]
data_dir = "~/.local/share/carrier"
max_output_mb = 20

[redaction]
enabled = true
patterns = [
  'Bearer [A-Za-z0-9._-]+',
  '(?i)(password|passwd|token|api[_-]?key|secret|access[_-]?token|refresh[_-]?token)\s*[:=]\s*\S+',
  'AKIA[0-9A-Z]{16}',
  '-----BEGIN PRIVATE KEY-----[\s\S]*?-----END PRIVATE KEY-----',
]

[notify]
min_duration = "10s"
success = true
failure = true

[shell]
program = ""
ignore_commands = ["nvim", "vim", "less", "man", "fzf", "yazi", "lazygit", "tmux"]

Shell Mode Status

carrier shell is experimental. It uses a PTY plus injected zsh/bash hooks to detect command boundaries, so prompts, tmux, shell plugins, aliases, and interactive programs may affect tracking. Use carrier run when precise stdout/stderr capture matters.

Development

make fmt
make lint
make test
make build
make run ARGS="run echo hello"

Documentation is built with Zensical:

make docs-build
make docs-serve

If Go VCS stamping fails in a checkout with dubious Git ownership, use:

go build -buildvcs=false ./cmd/carrier

Packages

 
 
 

Contributors

Languages