trunc

Smart truncation for pipe output. Like head + tail combined.

$ some-long-build-command | trunc Building project... Compiling src/main.rs Compiling src/lib.rs Compiling dependency 4... Compiling dependency 5... [... truncated ...] Compiling dependency 96... Linking... Optimizing... Running tests... Finished release build in 12.4s
some-command | trunc

Show first 10 and last 10 lines, truncate the middle.

some-command | trunc -f 5 -l 5

Customize line counts for head and tail.

some-command | trunc "error"

Pattern mode: also show matches from the middle with context.

Install

# Linux x86_64 curl -Lo ~/.local/bin/trunc https://trunc.maxeonyx.com/releases/trunc-x86_64-linux chmod +x ~/.local/bin/trunc

Agent Skill

For OpenCode and compatible agents.

mkdir -p ~/.config/opencode/skills/trunc curl -sLo ~/.config/opencode/skills/trunc/SKILL.md \ https://maxeonyx.github.io/trunc/SKILL.md
--- name: trunc description: When CLI tools are available in the project --- # trunc Pipe long command output through `trunc` to avoid flooding context. # Install curl -Lo ~/.local/bin/trunc https://trunc.maxeonyx.com/releases/trunc-x86_64-linux chmod +x ~/.local/bin/trunc # Usage some-command | trunc # First 10 + last 10 lines some-command | trunc -f 5 -l 5 # Custom counts some-command | trunc "error" # Pattern mode