Skip to main content

Local-first CLI that records the meaningful context of a debugging session and turns it into a useful markdown brief.

Project description

DebugBrief

CI PyPI

Turn a debugging session into an honest markdown brief for a PR, a handoff, or an incident note.

You record notes and run commands through DebugBrief while you work. When you are done, it writes a report built only from what actually happened: what you tried, what failed, what then passed, and which files changed in between. It never invents a root cause and never claims a test result you did not get.

It is local-first and dependency-free: standard library plus native git, no network, no AI, no telemetry. Unix-like systems only.

See a real generated report: examples/sample-pr.md.

Install

pip install debugbrief

Or from a clone: pip install -e .. Needs Python 3.9+ and native git on a Unix-like system (Linux, macOS, BSD).

Quickstart

debugbrief start "Fix add() returning wrong result"
debugbrief note "add() subtracts instead of adds; the test expects 5."
debugbrief run -- python -m pytest -q test_calc.py   # fails
# ... make your fix ...
debugbrief redo                                      # same test again: passes
debugbrief end                                       # writes the pr-style brief

Everything after -- runs exactly as you typed it, with its output streaming live to your terminal; DebugBrief flags (--timeout, --shell, --no-redact) go before the --. Quoting the whole command also works: debugbrief run "pytest -q". redo re-runs the last captured command, and end defaults to the pr report mode.

Tip: a one-line alias makes the capture prefix disappear in daily use:

alias db="debugbrief run --"
db pytest -q

run and note auto-start a session if you forget to, so a capture is never lost (and debugbrief cancel discards a session you did not mean to start). The resulting report leads with a derived one-liner like:

Failing check python -m pytest -q test_calc.py passed after 2 attempts over 2s, changes touched calc.py.

How it works

  • run executes a command, records its real exit code, bounded output, duration, and a per-command git snapshot, then returns the command's own exit code.
  • Pass/fail comes only from the exit code. A command counts as "verified" only if a recognized test/build/lint/typecheck command actually exited 0.
  • end derives the report from those events: the red-to-green window, the reproduce/verify commands, a timeline, the observed error verbatim, and what was ruled out. Empty sections are omitted, never padded.
  • Secret-like values in captured output are replaced with [redacted] before anything is written to disk (best effort; --no-redact opts out).

Commands

Command What it does
start "<title>" Start a session
note <text ...> Record a note (quoting optional)
run -- <command ...> Execute and capture a command
redo Re-run the last captured command
end [--mode pr|handoff|incident] Finalize and write a report (default pr)
cancel [--yes] Discard the active session, no report
status Show the active session
doctor [--fix] Health-check the project and state
last / open Find or open the most recent report
list / show <id> Browse recorded sessions

Full detail, flags, and the report modes: docs/COMMANDS.md.

Post a brief straight to a PR (GitHub CLI optional):

debugbrief end --stdout | gh pr comment --body-file -

Limitations

  • Unix-like only; no Windows/PowerShell.
  • Capture is explicit via debugbrief run. There is no terminal transcript or PTY capture, and output is stored as bounded previews, not full logs.
  • Interactive and TUI commands (a pdb session, watch modes) will behave oddly under run, because output is piped for capture rather than attached to a terminal. Run those directly and record the outcome with note.
  • Redaction is conservative and best effort; it does not catch every secret.
  • Git sections need native git; outside a repo they are omitted honestly.

Development

pip install -e ".[dev]"
pytest

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debugbrief-1.1.0.tar.gz (67.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debugbrief-1.1.0-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

Details for the file debugbrief-1.1.0.tar.gz.

File metadata

  • Download URL: debugbrief-1.1.0.tar.gz
  • Upload date:
  • Size: 67.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for debugbrief-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7834c7960eee2a8651e8707f2e18c82e57da57139ee0890d7d1bc5b2e0d1c2c4
MD5 5bb3bff2f8cb009d383f72ab10c862ae
BLAKE2b-256 2a445dc231021ca83d217e313adeb0ef1111713cb2a8af159985d2d9149c63fc

See more details on using hashes here.

File details

Details for the file debugbrief-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: debugbrief-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 51.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for debugbrief-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ee304c9587b0ebc866e20c4ce386b5ff0cf40866f2caad023a67e2aa3e7eb2d
MD5 2a178d769c2c685955082899f8aa8a75
BLAKE2b-256 093f4380810e74f43c88dd4fa383f9db40bf1b2cd9f35e5e5f0d24287d634dc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page