Skip to content

SybilGambleyyu/logsnip

Repository files navigation

logsnip

Cut the noise. Keep the stack traces.

logsnip reads CI and build logs (or any text stream) and prints only the failure regions — assertion errors, panics, npm ERR!, GitHub Actions ##[error] lines, rustc error[E…], pytest E lines — with enough context to debug. Repeated download/install spam is collapsed.

Zero dependencies. Python 3.10+.

Install

pip install git+https://github.com/SybilGambleyyu/logsnip.git
# or via the toolkit installer:
# curl -fsSL https://raw.githubusercontent.com/SybilGambleyyu/devkit/main/install.sh | bash

Why

CI logs are 95% package installs and 5% the actual failure. Scrolling a 10,000-line Actions log for one AssertionError burns minutes every day. logsnip is the filter you pipe the log through:

gh run view --log-failed | logsnip
cat job.log | logsnip --last
logsnip build.log --summary

Usage

logsnip [FILE ...] [options]

  -n, --max N        max snippets (default: all)
  --first / --last   only the first or last error region
  -B, --before N     context lines before each hit (default: 3)
  -A, --after N      context lines after each hit (default: 8)
  --summary          one-line headlines only
  --json             machine-readable snippets
  --collapse-only    collapse noise; do not filter to errors
  --no-collapse      keep every line inside snippets
  --no-headers       omit line-range headers
  -e, --pattern RE   extra error regex (repeatable)
  --tail N           only scan the last N lines (huge logs)
  --check            exit 1 if any error-like lines found
  -o FILE            write to FILE

Recipes

# Last failure in a GitHub Actions run
gh run view --log-failed | logsnip --last

# Huge job log: only the end
logsnip huge.log --tail 500 --last

# Summarize every failure in a multi-job log
logsnip ci-full.log --summary

# Gate a log in CI (fail if error-like lines appear)
some-command 2>&1 | tee out.log | logsnip --check

# Just dedupe progress spam
logsnip huge.log --collapse-only -o clean.log

# Safe pack for an AI assistant
logsnip fail.log --last | redactx

What counts as an error?

Built-in patterns cover common CI/test/compiler output, including:

Kind Examples
Generic error, failed, fatal, panic
Python Traceback, AssertionError, pytest E lines, collection errors
JS npm ERR!, at Object.<anonymous> stacks
Rust error[E0308]
TypeScript error TS2322
GitHub Actions ##[error], ::error
Make / exit make: ***, exit code 1

Stack frames and caret lines after a hit are pulled in automatically.

Pipeline with the rest of the toolkit

# Failure context → redact secrets → ask an AI
gh run view --log-failed | logsnip --last | redactx | pbcopy

More tools: developer toolkit.

License

MIT

About

Extract failure snippets from noisy CI and build logs — cut the noise, keep the stack traces

Topics

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages