-
Notifications
You must be signed in to change notification settings - Fork 1
Log Crushing And ctxrun
ContextClean includes a log crusher for CI logs, terminal output, and stack traces.
The log cleaner should make logs smaller without losing the reason the command failed.
It preserves:
- unique error lines
- failed test names
- final error summaries
- important stack frames
- timestamps around repeated failures
- command context in
ctxrun
It removes or collapses:
- repeated identical lines
- duplicate stack frames
- install summaries
- package-manager noise
- safe build chatter
- provider-specific CI progress lines
Use:
ctxclean gha failed-log.txt --max-tokens 8000 --format markdownThe gha alias defaults to aggressive mode and is tuned for CI failure logs.
Current provider-specific rules include:
- GitHub Actions grouping and runner boilerplate
- npm install/fetch/deprecated noise
- pnpm progress lines
- cargo compile/check/download noise
- pytest collection/progress noise
- Docker Buildx progress lines
- Playwright run/pass noise
The intent is not to delete all build output. The intent is to remove lines that are usually not the failure.
Repeated lines are collapsed into markers such as:
[Repeated 1284 times] Connection timeout to database
Timestamped repeats preserve the first and last timestamps when possible.
Duplicate stack frames are collapsed while distinct locations are preserved.
Example:
[Collapsed stack frames: 93 duplicate frames removed]
Use ctxrun when you want a command wrapper:
ctxrun --max-tokens 8000 npm test
ctxrun --format markdown cargo testBehavior:
- success: output passes through
- failure: output is cleaned
- exit code: preserved
- timeout: exits
124
Useful options:
ctxrun --capture-limit-bytes 4194304 --timeout-seconds 120 npm test--capture-limit-bytes limits failed-output capture memory per stream. It does not silently truncate successful output.