agent-log-digest
v0.1.2
Published
Turn noisy test, lint, typecheck, and build logs into clean JSON for AI coding agents.
Maintainers
Readme
agent-log-digest
Turn noisy test, lint, typecheck, and build logs into compact JSON that AI coding agents can route, summarize, and store.
agent-log-digest is a local-only Node CLI. It runs a command or parses an existing log file, redacts common secrets by default, detects known tool output, and writes deterministic digests without telemetry, hosted services, or LLM calls.
If this CLI saves you time, please star the GitHub repo. It helps other developers discover local-only tooling for AI coding agents.
Install
npm install -D agent-log-digestUse directly with npx during early testing:
npx agent-log-digest --json -- npm testUsage
Wrap a command and preserve its exit code:
agent-log-digest --json -- npm run typecheckParse a saved log:
agent-log-digest parse ./logs/eslint.log --tool eslint --json --output ./digest.jsonKeep CI green while still recording the failing command in the digest:
agent-log-digest --json --always-zero -- npm testWrite a redacted raw log next to the digest:
agent-log-digest --json --raw-log ./raw.log --output ./digest.json -- npm testCheck local runtime assumptions:
agent-log-digest doctor --jsonPrint the project URL:
agent-log-digest repoWrite local example files explicitly:
agent-log-digest initCI Recipe
Keep a CI step green while saving a structured digest for agents:
- name: Test with digest
run: npx agent-log-digest --json --always-zero --output ./agent-log-digest.json -- npm testBefore and After
TypeScript log:
src/user.ts(3,7): error TS2322: Type string is not assignable to number.Digest summary:
{"status":"failed","detectedTools":["typescript"],"summary":{"headline":"TypeScript failed with 1 error in 1 file."}}Vite build log:
[vite]: Rollup failed to resolve import "./missing" from "src/main.ts".
file: /repo/src/main.ts:3:18Digest summary:
{"status":"failed","detectedTools":["vite"],"nextCommands":["vite build"]}Output
The JSON output uses schema version 0.1.
{
"schemaVersion": "0.1",
"status": "failed",
"exitCode": 2,
"command": "npm run typecheck",
"detectedTools": ["typescript"],
"summary": {
"headline": "TypeScript failed with 1 error in 1 file.",
"errors": 1,
"warnings": 0,
"failedTests": 0,
"filesWithProblems": 1
},
"problems": []
}Public TypeScript types and helpers are exported from the package root:
import { SCHEMA_VERSION, createDigest, redactSecrets } from "agent-log-digest"
import type { AgentLogDigest, Problem } from "agent-log-digest"Supported Parsers
- TypeScript
tscdiagnostics - ESLint JSON formatter and minimal stylish output
- Vitest JSON-style failed test results
- Jest JSON-style failed test results
- Next.js text build failures
- Vite/Rollup text build failures
- Playwright text/list reporter failures
- Generic Node-style stack traces and
file:line:columnreferences
CLI Options
--json,--markdown,--pretty: choose formatter.--output <file>: write formatted digest to disk.--raw-log <file>: write the captured raw log after redaction.--no-raw-log: disable raw-log output even if configured.--max-errors <n>: cap reported problems.--max-log-bytes <n>: cap captured command output.--cwd <dir>: run or parse from another working directory.--timeout <ms>: terminate wrapped commands after a timeout.--always-zero: return exit code 0 while preserving the command exit code in JSON.--no-stream: capture command output without live passthrough.--notify: callcode-notifyorcnif available.--redact,--no-redact: enable or disable secret redaction.--tool <name>: force parser preference fortypescript,eslint,vitest,jest,next,vite,playwright, orgeneric.
Usage errors exit 2. Internal CLI errors exit 1. Wrapped command exit codes are preserved unless --always-zero is set.
Trust Model
Runtime behavior is local-only:
- no telemetry
- no runtime network calls
- no install hooks
- no automatic fixing
- no AI API calls
The package uses child_process.spawn with shell: false for wrapped commands.
