debugbrief 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. debugbrief-1.1.0/LICENSE +21 -0
  2. debugbrief-1.1.0/PKG-INFO +143 -0
  3. debugbrief-1.1.0/README.md +113 -0
  4. debugbrief-1.1.0/pyproject.toml +67 -0
  5. debugbrief-1.1.0/setup.cfg +4 -0
  6. debugbrief-1.1.0/src/debugbrief/__init__.py +13 -0
  7. debugbrief-1.1.0/src/debugbrief/__main__.py +10 -0
  8. debugbrief-1.1.0/src/debugbrief/cli.py +843 -0
  9. debugbrief-1.1.0/src/debugbrief/command_runner.py +233 -0
  10. debugbrief-1.1.0/src/debugbrief/derive.py +353 -0
  11. debugbrief-1.1.0/src/debugbrief/doctor.py +324 -0
  12. debugbrief-1.1.0/src/debugbrief/filters.py +280 -0
  13. debugbrief-1.1.0/src/debugbrief/git_utils.py +268 -0
  14. debugbrief-1.1.0/src/debugbrief/models.py +320 -0
  15. debugbrief-1.1.0/src/debugbrief/paths.py +130 -0
  16. debugbrief-1.1.0/src/debugbrief/redaction.py +103 -0
  17. debugbrief-1.1.0/src/debugbrief/reporters/__init__.py +108 -0
  18. debugbrief-1.1.0/src/debugbrief/reporters/base.py +396 -0
  19. debugbrief-1.1.0/src/debugbrief/reporters/handoff.py +96 -0
  20. debugbrief-1.1.0/src/debugbrief/reporters/incident.py +99 -0
  21. debugbrief-1.1.0/src/debugbrief/reporters/pr.py +28 -0
  22. debugbrief-1.1.0/src/debugbrief/reports_index.py +50 -0
  23. debugbrief-1.1.0/src/debugbrief/session_manager.py +361 -0
  24. debugbrief-1.1.0/src/debugbrief/sessions_index.py +78 -0
  25. debugbrief-1.1.0/src/debugbrief/utils.py +151 -0
  26. debugbrief-1.1.0/src/debugbrief.egg-info/PKG-INFO +143 -0
  27. debugbrief-1.1.0/src/debugbrief.egg-info/SOURCES.txt +49 -0
  28. debugbrief-1.1.0/src/debugbrief.egg-info/dependency_links.txt +1 -0
  29. debugbrief-1.1.0/src/debugbrief.egg-info/entry_points.txt +2 -0
  30. debugbrief-1.1.0/src/debugbrief.egg-info/requires.txt +3 -0
  31. debugbrief-1.1.0/src/debugbrief.egg-info/top_level.txt +1 -0
  32. debugbrief-1.1.0/tests/test_autostart.py +87 -0
  33. debugbrief-1.1.0/tests/test_cancel.py +105 -0
  34. debugbrief-1.1.0/tests/test_ci_workflow.py +29 -0
  35. debugbrief-1.1.0/tests/test_cli_ergonomics.py +136 -0
  36. debugbrief-1.1.0/tests/test_command_runner.py +151 -0
  37. debugbrief-1.1.0/tests/test_derive.py +212 -0
  38. debugbrief-1.1.0/tests/test_doctor.py +97 -0
  39. debugbrief-1.1.0/tests/test_e2e_cli.py +137 -0
  40. debugbrief-1.1.0/tests/test_filters.py +158 -0
  41. debugbrief-1.1.0/tests/test_git_utils.py +163 -0
  42. debugbrief-1.1.0/tests/test_json_report.py +118 -0
  43. debugbrief-1.1.0/tests/test_last_open.py +134 -0
  44. debugbrief-1.1.0/tests/test_list_show.py +155 -0
  45. debugbrief-1.1.0/tests/test_paths.py +71 -0
  46. debugbrief-1.1.0/tests/test_redaction.py +189 -0
  47. debugbrief-1.1.0/tests/test_reporters.py +259 -0
  48. debugbrief-1.1.0/tests/test_run_passthrough.py +80 -0
  49. debugbrief-1.1.0/tests/test_session_lifecycle.py +172 -0
  50. debugbrief-1.1.0/tests/test_snapshots.py +296 -0
  51. debugbrief-1.1.0/tests/test_utils.py +60 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DebugBrief contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: debugbrief
3
+ Version: 1.1.0
4
+ Summary: Local-first CLI that records the meaningful context of a debugging session and turns it into a useful markdown brief.
5
+ Author: DebugBrief
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/harihkk/Debug-Brief
8
+ Project-URL: Repository, https://github.com/harihkk/Debug-Brief
9
+ Project-URL: Changelog, https://github.com/harihkk/Debug-Brief/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/harihkk/Debug-Brief/issues
11
+ Keywords: cli,debugging,pull-request,handoff,incident,report
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: POSIX
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # DebugBrief
32
+
33
+ [![CI](https://github.com/harihkk/Debug-Brief/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/harihkk/Debug-Brief/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/debugbrief)](https://pypi.org/project/debugbrief/)
34
+
35
+ Turn a debugging session into an honest markdown brief for a PR, a handoff, or an
36
+ incident note.
37
+
38
+ You record notes and run commands through DebugBrief while you work. When you are
39
+ done, it writes a report built only from what actually happened: what you tried,
40
+ what failed, what then passed, and which files changed in between. It never
41
+ invents a root cause and never claims a test result you did not get.
42
+
43
+ It is local-first and dependency-free: standard library plus native `git`, no
44
+ network, no AI, no telemetry. Unix-like systems only.
45
+
46
+ See a real generated report: [examples/sample-pr.md](examples/sample-pr.md).
47
+
48
+ ## Install
49
+
50
+ ```bash
51
+ pip install debugbrief
52
+ ```
53
+
54
+ Or from a clone: `pip install -e .`. Needs Python 3.9+ and native `git` on a
55
+ Unix-like system (Linux, macOS, BSD).
56
+
57
+ ## Quickstart
58
+
59
+ ```bash
60
+ debugbrief start "Fix add() returning wrong result"
61
+ debugbrief note "add() subtracts instead of adds; the test expects 5."
62
+ debugbrief run -- python -m pytest -q test_calc.py # fails
63
+ # ... make your fix ...
64
+ debugbrief redo # same test again: passes
65
+ debugbrief end # writes the pr-style brief
66
+ ```
67
+
68
+ Everything after `--` runs exactly as you typed it, with its output streaming
69
+ live to your terminal; DebugBrief flags (`--timeout`, `--shell`, `--no-redact`)
70
+ go before the `--`. Quoting the whole command also works: `debugbrief run
71
+ "pytest -q"`. `redo` re-runs the last captured command, and `end` defaults to
72
+ the `pr` report mode.
73
+
74
+ Tip: a one-line alias makes the capture prefix disappear in daily use:
75
+
76
+ ```bash
77
+ alias db="debugbrief run --"
78
+ db pytest -q
79
+ ```
80
+
81
+ `run` and `note` auto-start a session if you forget to, so a capture is never
82
+ lost (and `debugbrief cancel` discards a session you did not mean to start).
83
+ The resulting report leads with a derived one-liner like:
84
+
85
+ > Failing check `python -m pytest -q test_calc.py` passed after 2 attempts over
86
+ > 2s, changes touched calc.py.
87
+
88
+ ## How it works
89
+
90
+ - `run` executes a command, records its real exit code, bounded output, duration,
91
+ and a per-command git snapshot, then returns the command's own exit code.
92
+ - Pass/fail comes only from the exit code. A command counts as "verified" only if
93
+ a recognized test/build/lint/typecheck command actually exited `0`.
94
+ - `end` derives the report from those events: the red-to-green window, the
95
+ reproduce/verify commands, a timeline, the observed error verbatim, and what
96
+ was ruled out. Empty sections are omitted, never padded.
97
+ - Secret-like values in captured output are replaced with `[redacted]` before
98
+ anything is written to disk (best effort; `--no-redact` opts out).
99
+
100
+ ## Commands
101
+
102
+ | Command | What it does |
103
+ | --- | --- |
104
+ | `start "<title>"` | Start a session |
105
+ | `note <text ...>` | Record a note (quoting optional) |
106
+ | `run -- <command ...>` | Execute and capture a command |
107
+ | `redo` | Re-run the last captured command |
108
+ | `end [--mode pr\|handoff\|incident]` | Finalize and write a report (default `pr`) |
109
+ | `cancel [--yes]` | Discard the active session, no report |
110
+ | `status` | Show the active session |
111
+ | `doctor [--fix]` | Health-check the project and state |
112
+ | `last` / `open` | Find or open the most recent report |
113
+ | `list` / `show <id>` | Browse recorded sessions |
114
+
115
+ Full detail, flags, and the report modes: [docs/COMMANDS.md](docs/COMMANDS.md).
116
+
117
+ Post a brief straight to a PR (GitHub CLI optional):
118
+
119
+ ```bash
120
+ debugbrief end --stdout | gh pr comment --body-file -
121
+ ```
122
+
123
+ ## Limitations
124
+
125
+ - Unix-like only; no Windows/PowerShell.
126
+ - Capture is explicit via `debugbrief run`. There is no terminal transcript or
127
+ PTY capture, and output is stored as bounded previews, not full logs.
128
+ - Interactive and TUI commands (a pdb session, watch modes) will behave oddly
129
+ under `run`, because output is piped for capture rather than attached to a
130
+ terminal. Run those directly and record the outcome with `note`.
131
+ - Redaction is conservative and best effort; it does not catch every secret.
132
+ - Git sections need native `git`; outside a repo they are omitted honestly.
133
+
134
+ ## Development
135
+
136
+ ```bash
137
+ pip install -e ".[dev]"
138
+ pytest
139
+ ```
140
+
141
+ ## License
142
+
143
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,113 @@
1
+ # DebugBrief
2
+
3
+ [![CI](https://github.com/harihkk/Debug-Brief/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/harihkk/Debug-Brief/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/debugbrief)](https://pypi.org/project/debugbrief/)
4
+
5
+ Turn a debugging session into an honest markdown brief for a PR, a handoff, or an
6
+ incident note.
7
+
8
+ You record notes and run commands through DebugBrief while you work. When you are
9
+ done, it writes a report built only from what actually happened: what you tried,
10
+ what failed, what then passed, and which files changed in between. It never
11
+ invents a root cause and never claims a test result you did not get.
12
+
13
+ It is local-first and dependency-free: standard library plus native `git`, no
14
+ network, no AI, no telemetry. Unix-like systems only.
15
+
16
+ See a real generated report: [examples/sample-pr.md](examples/sample-pr.md).
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install debugbrief
22
+ ```
23
+
24
+ Or from a clone: `pip install -e .`. Needs Python 3.9+ and native `git` on a
25
+ Unix-like system (Linux, macOS, BSD).
26
+
27
+ ## Quickstart
28
+
29
+ ```bash
30
+ debugbrief start "Fix add() returning wrong result"
31
+ debugbrief note "add() subtracts instead of adds; the test expects 5."
32
+ debugbrief run -- python -m pytest -q test_calc.py # fails
33
+ # ... make your fix ...
34
+ debugbrief redo # same test again: passes
35
+ debugbrief end # writes the pr-style brief
36
+ ```
37
+
38
+ Everything after `--` runs exactly as you typed it, with its output streaming
39
+ live to your terminal; DebugBrief flags (`--timeout`, `--shell`, `--no-redact`)
40
+ go before the `--`. Quoting the whole command also works: `debugbrief run
41
+ "pytest -q"`. `redo` re-runs the last captured command, and `end` defaults to
42
+ the `pr` report mode.
43
+
44
+ Tip: a one-line alias makes the capture prefix disappear in daily use:
45
+
46
+ ```bash
47
+ alias db="debugbrief run --"
48
+ db pytest -q
49
+ ```
50
+
51
+ `run` and `note` auto-start a session if you forget to, so a capture is never
52
+ lost (and `debugbrief cancel` discards a session you did not mean to start).
53
+ The resulting report leads with a derived one-liner like:
54
+
55
+ > Failing check `python -m pytest -q test_calc.py` passed after 2 attempts over
56
+ > 2s, changes touched calc.py.
57
+
58
+ ## How it works
59
+
60
+ - `run` executes a command, records its real exit code, bounded output, duration,
61
+ and a per-command git snapshot, then returns the command's own exit code.
62
+ - Pass/fail comes only from the exit code. A command counts as "verified" only if
63
+ a recognized test/build/lint/typecheck command actually exited `0`.
64
+ - `end` derives the report from those events: the red-to-green window, the
65
+ reproduce/verify commands, a timeline, the observed error verbatim, and what
66
+ was ruled out. Empty sections are omitted, never padded.
67
+ - Secret-like values in captured output are replaced with `[redacted]` before
68
+ anything is written to disk (best effort; `--no-redact` opts out).
69
+
70
+ ## Commands
71
+
72
+ | Command | What it does |
73
+ | --- | --- |
74
+ | `start "<title>"` | Start a session |
75
+ | `note <text ...>` | Record a note (quoting optional) |
76
+ | `run -- <command ...>` | Execute and capture a command |
77
+ | `redo` | Re-run the last captured command |
78
+ | `end [--mode pr\|handoff\|incident]` | Finalize and write a report (default `pr`) |
79
+ | `cancel [--yes]` | Discard the active session, no report |
80
+ | `status` | Show the active session |
81
+ | `doctor [--fix]` | Health-check the project and state |
82
+ | `last` / `open` | Find or open the most recent report |
83
+ | `list` / `show <id>` | Browse recorded sessions |
84
+
85
+ Full detail, flags, and the report modes: [docs/COMMANDS.md](docs/COMMANDS.md).
86
+
87
+ Post a brief straight to a PR (GitHub CLI optional):
88
+
89
+ ```bash
90
+ debugbrief end --stdout | gh pr comment --body-file -
91
+ ```
92
+
93
+ ## Limitations
94
+
95
+ - Unix-like only; no Windows/PowerShell.
96
+ - Capture is explicit via `debugbrief run`. There is no terminal transcript or
97
+ PTY capture, and output is stored as bounded previews, not full logs.
98
+ - Interactive and TUI commands (a pdb session, watch modes) will behave oddly
99
+ under `run`, because output is piped for capture rather than attached to a
100
+ terminal. Run those directly and record the outcome with `note`.
101
+ - Redaction is conservative and best effort; it does not catch every secret.
102
+ - Git sections need native `git`; outside a repo they are omitted honestly.
103
+
104
+ ## Development
105
+
106
+ ```bash
107
+ pip install -e ".[dev]"
108
+ pytest
109
+ ```
110
+
111
+ ## License
112
+
113
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,67 @@
1
+ [build-system]
2
+ # 77+ understands the PEP 639 SPDX `license` string below.
3
+ requires = ["setuptools>=77.0"]
4
+ build-backend = "setuptools.build_meta"
5
+
6
+ [project]
7
+ name = "debugbrief"
8
+ version = "1.1.0"
9
+ description = "Local-first CLI that records the meaningful context of a debugging session and turns it into a useful markdown brief."
10
+ readme = "README.md"
11
+ requires-python = ">=3.9"
12
+ license = "MIT"
13
+ license-files = ["LICENSE"]
14
+ authors = [{ name = "DebugBrief" }]
15
+ keywords = ["cli", "debugging", "pull-request", "handoff", "incident", "report"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: POSIX",
21
+ "Operating System :: MacOS",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Topic :: Software Development",
29
+ ]
30
+
31
+ # DebugBrief intentionally has ZERO runtime dependencies.
32
+ # It uses only the Python standard library and native `git`.
33
+ dependencies = []
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/harihkk/Debug-Brief"
37
+ Repository = "https://github.com/harihkk/Debug-Brief"
38
+ Changelog = "https://github.com/harihkk/Debug-Brief/blob/main/CHANGELOG.md"
39
+ Issues = "https://github.com/harihkk/Debug-Brief/issues"
40
+
41
+ [project.optional-dependencies]
42
+ dev = ["pytest>=7.0"]
43
+
44
+ [project.scripts]
45
+ debugbrief = "debugbrief.cli:main"
46
+
47
+ [tool.setuptools]
48
+ package-dir = { "" = "src" }
49
+
50
+ [tool.setuptools.packages.find]
51
+ where = ["src"]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+
56
+ [tool.ruff]
57
+ line-length = 100
58
+ target-version = "py39"
59
+
60
+ [tool.ruff.lint]
61
+ # "UP" is deliberately excluded to preserve the explicit typing.List/Optional
62
+ # style required for Python 3.9 support.
63
+ select = ["E", "F", "W", "I", "B", "SIM", "C4", "RET", "PIE"]
64
+
65
+ [tool.ruff.lint.per-file-ignores]
66
+ # Test files carry long assertion and snapshot literals.
67
+ "tests/*" = ["E501"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,13 @@
1
+ """DebugBrief: a local-first CLI for recording debugging sessions.
2
+
3
+ DebugBrief captures the useful path of a debugging session -- notes, executed
4
+ commands and their outcomes, Git state changes, and verification steps -- and
5
+ turns it into a concise, honest markdown brief (PR, handoff, or incident).
6
+
7
+ It uses only the Python standard library and native ``git``. No AI, no
8
+ telemetry, no cloud sync, no background daemon.
9
+ """
10
+
11
+ __version__ = "1.1.0"
12
+
13
+ __all__ = ["__version__"]
@@ -0,0 +1,10 @@
1
+ """Allow running the CLI via ``python -m debugbrief``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ from .cli import main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())