bugcap 0.4.0__tar.gz → 0.5.1__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.
- {bugcap-0.4.0/src/bugcap.egg-info → bugcap-0.5.1}/PKG-INFO +14 -9
- {bugcap-0.4.0 → bugcap-0.5.1}/README.md +12 -8
- {bugcap-0.4.0 → bugcap-0.5.1}/pyproject.toml +12 -2
- bugcap-0.5.1/src/bugcap/__init__.py +1 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/cli.py +17 -10
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/ingest.py +36 -4
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/live.py +1 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/service.py +11 -3
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/store.py +8 -0
- {bugcap-0.4.0 → bugcap-0.5.1/src/bugcap.egg-info}/PKG-INFO +14 -9
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap.egg-info/requires.txt +1 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_backends.py +0 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_attach.py +75 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_init_capture_list.py +1 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_live_headless.py +5 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_media.py +2 -2
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_no_image_delete.py +1 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_setup.py +9 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_triage.py +0 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_drafts.py +2 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_github_media_sync.py +2 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_github_sync.py +1 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_ingest.py +4 -2
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_live_session.py +2 -2
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_mcp.py +0 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_mcp_logging.py +0 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_recorder_run.py +3 -3
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_refs_validate_rewrite.py +3 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_regression_output.py +1 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_repo_values.py +0 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_sync_consent.py +0 -3
- bugcap-0.4.0/src/bugcap/__init__.py +0 -1
- {bugcap-0.4.0 → bugcap-0.5.1}/LICENSE +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/setup.cfg +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/agent_api.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/backends.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/capture.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/config.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/dashboard/__init__.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/dashboard/api.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/dashboard/media.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/dashboard/server.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/dashboard/static/app.css +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/dashboard/static/app.js +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/dashboard/static/index.html +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/drafts.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/errors.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/ghcli.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/live_session.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/logs.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/mcp_server.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/paths.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/recorder.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/refs.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/repo.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/sync.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/tomlio.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap/validation.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap.egg-info/SOURCES.txt +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap.egg-info/dependency_links.txt +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap.egg-info/entry_points.txt +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/src/bugcap.egg-info/top_level.txt +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_agent_api.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_capture.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_dashboard.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_cli_record.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_dashboard_api.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_dashboard_media.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_dashboard_mutations.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_dashboard_security.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_dashboard_ui_static.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_ghcli.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_github_pull.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_image_refs.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_ingest_url.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_paths.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_recorder_argv.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_recorder_devices.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_recorder_media_real.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_refs.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_repo_config.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_service_media.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_service_refs.py +0 -0
- {bugcap-0.4.0 → bugcap-0.5.1}/tests/test_store_migration.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bugcap
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Local-first, agent-readable bug capture: annotated screenshots + notes, stored locally, synced to trackers on your own schedule.
|
|
5
5
|
Author: Konrad Tagnon Amen ALAHASSA
|
|
6
6
|
License: MIT
|
|
@@ -12,10 +12,11 @@ Provides-Extra: mcp
|
|
|
12
12
|
Requires-Dist: mcp<2,>=1.2; extra == "mcp"
|
|
13
13
|
Provides-Extra: dev
|
|
14
14
|
Requires-Dist: pytest>=7; extra == "dev"
|
|
15
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
15
16
|
Dynamic: license-file
|
|
16
17
|
|
|
17
18
|
<p align="center">
|
|
18
|
-
<img src="docs/assets/logo.svg" alt="bugcap" width="96">
|
|
19
|
+
<img src="https://raw.githubusercontent.com/amenalahassa/bugcap/master/docs/assets/logo.svg" alt="bugcap" width="96">
|
|
19
20
|
</p>
|
|
20
21
|
|
|
21
22
|
<h1 align="center">bugcap</h1>
|
|
@@ -28,7 +29,7 @@ Dynamic: license-file
|
|
|
28
29
|
<p align="center">
|
|
29
30
|
<a href="https://github.com/amenalahassa/bugcap/actions/workflows/release.yml"><img alt="tests" src="https://github.com/amenalahassa/bugcap/actions/workflows/release.yml/badge.svg"></a>
|
|
30
31
|
<img alt="python" src="https://img.shields.io/badge/python-3.10%2B-3776ab?logo=python&logoColor=white">
|
|
31
|
-
<a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-green"></a>
|
|
32
|
+
<a href="https://github.com/amenalahassa/bugcap/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-green"></a>
|
|
32
33
|
<a href="https://amenalahassa.github.io/bugcap/"><img alt="docs" src="https://img.shields.io/badge/docs-website-d9480f"></a>
|
|
33
34
|
</p>
|
|
34
35
|
|
|
@@ -37,11 +38,11 @@ Dynamic: license-file
|
|
|
37
38
|
<a href="https://amenalahassa.github.io/bugcap/usage.html">Usage guide</a> ·
|
|
38
39
|
<a href="#quick-start">Quick start</a> ·
|
|
39
40
|
<a href="#connect-your-agent-mcp">Agents (MCP)</a> ·
|
|
40
|
-
<a href="CHANGELOG.md">Changelog</a>
|
|
41
|
+
<a href="https://github.com/amenalahassa/bugcap/blob/master/CHANGELOG.md">Changelog</a>
|
|
41
42
|
</p>
|
|
42
43
|
|
|
43
44
|
<p align="center">
|
|
44
|
-
<img src="docs/assets/demo.gif" alt="bugcap
|
|
45
|
+
<img src="https://raw.githubusercontent.com/amenalahassa/bugcap/master/docs/assets/demo.gif" alt="bugcap live: screenshot a broken page, file a bug with a note, then read it back with bugcap show" width="760">
|
|
45
46
|
</p>
|
|
46
47
|
|
|
47
48
|
---
|
|
@@ -120,7 +121,7 @@ the error toast"*. It can read the picture because it's a local file, not a CDN
|
|
|
120
121
|
Working. Roadmap items 1–5, 7 and 8 are implemented and tested, along with spec 002 (images,
|
|
121
122
|
`@` references, recording, live mode and the dashboard). S3/R2 object storage (item 6) and other
|
|
122
123
|
trackers (item 9) are deferred. The `Destination` seam is in place, so they can be added without
|
|
123
|
-
changing the CLI. See [ROADMAP.md](ROADMAP.md).
|
|
124
|
+
changing the CLI. See [ROADMAP.md](https://github.com/amenalahassa/bugcap/blob/master/ROADMAP.md).
|
|
124
125
|
|
|
125
126
|
## Installation
|
|
126
127
|
|
|
@@ -150,9 +151,13 @@ Notes on the more involved behaviour:
|
|
|
150
151
|
- **Repo values** (`init`, `sync`, `config repo set`) are checked for format and, with `gh`, for existence. Changing the repo identity offers to move existing reports.
|
|
151
152
|
- **Media sync** over `[sync] max_upload_mb` (default 25) is skipped with a warning.
|
|
152
153
|
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
Contributions are welcome. Read [CONTRIBUTING.md](https://github.com/amenalahassa/bugcap/blob/master/CONTRIBUTING.md) for the workflow and project rules, and the [Code of Conduct](https://github.com/amenalahassa/bugcap/blob/master/CODE_OF_CONDUCT.md). Report security issues privately, see [SECURITY.md](https://github.com/amenalahassa/bugcap/blob/master/SECURITY.md).
|
|
157
|
+
|
|
153
158
|
## Development
|
|
154
159
|
|
|
155
|
-
See [DEVELOPMENT.md](DEVELOPMENT.md). Run the tests with:
|
|
160
|
+
See [DEVELOPMENT.md](https://github.com/amenalahassa/bugcap/blob/master/DEVELOPMENT.md). Run the tests with:
|
|
156
161
|
|
|
157
162
|
```bash
|
|
158
163
|
uv run --extra dev --extra mcp pytest -q
|
|
@@ -203,7 +208,7 @@ succeeds, so a re-run skips what is already recorded.
|
|
|
203
208
|
|
|
204
209
|
## Roadmap
|
|
205
210
|
|
|
206
|
-
See [ROADMAP.md](ROADMAP.md).
|
|
211
|
+
See [ROADMAP.md](https://github.com/amenalahassa/bugcap/blob/master/ROADMAP.md).
|
|
207
212
|
|
|
208
213
|
## Design notes / deliberate non-goals
|
|
209
214
|
|
|
@@ -222,4 +227,4 @@ See [ROADMAP.md](ROADMAP.md).
|
|
|
222
227
|
|
|
223
228
|
## License
|
|
224
229
|
|
|
225
|
-
MIT — see [LICENSE](LICENSE).
|
|
230
|
+
MIT — see [LICENSE](https://github.com/amenalahassa/bugcap/blob/master/LICENSE).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="docs/assets/logo.svg" alt="bugcap" width="96">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/amenalahassa/bugcap/master/docs/assets/logo.svg" alt="bugcap" width="96">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">bugcap</h1>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<p align="center">
|
|
13
13
|
<a href="https://github.com/amenalahassa/bugcap/actions/workflows/release.yml"><img alt="tests" src="https://github.com/amenalahassa/bugcap/actions/workflows/release.yml/badge.svg"></a>
|
|
14
14
|
<img alt="python" src="https://img.shields.io/badge/python-3.10%2B-3776ab?logo=python&logoColor=white">
|
|
15
|
-
<a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-green"></a>
|
|
15
|
+
<a href="https://github.com/amenalahassa/bugcap/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-green"></a>
|
|
16
16
|
<a href="https://amenalahassa.github.io/bugcap/"><img alt="docs" src="https://img.shields.io/badge/docs-website-d9480f"></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
<a href="https://amenalahassa.github.io/bugcap/usage.html">Usage guide</a> ·
|
|
22
22
|
<a href="#quick-start">Quick start</a> ·
|
|
23
23
|
<a href="#connect-your-agent-mcp">Agents (MCP)</a> ·
|
|
24
|
-
<a href="CHANGELOG.md">Changelog</a>
|
|
24
|
+
<a href="https://github.com/amenalahassa/bugcap/blob/master/CHANGELOG.md">Changelog</a>
|
|
25
25
|
</p>
|
|
26
26
|
|
|
27
27
|
<p align="center">
|
|
28
|
-
<img src="docs/assets/demo.gif" alt="bugcap
|
|
28
|
+
<img src="https://raw.githubusercontent.com/amenalahassa/bugcap/master/docs/assets/demo.gif" alt="bugcap live: screenshot a broken page, file a bug with a note, then read it back with bugcap show" width="760">
|
|
29
29
|
</p>
|
|
30
30
|
|
|
31
31
|
---
|
|
@@ -104,7 +104,7 @@ the error toast"*. It can read the picture because it's a local file, not a CDN
|
|
|
104
104
|
Working. Roadmap items 1–5, 7 and 8 are implemented and tested, along with spec 002 (images,
|
|
105
105
|
`@` references, recording, live mode and the dashboard). S3/R2 object storage (item 6) and other
|
|
106
106
|
trackers (item 9) are deferred. The `Destination` seam is in place, so they can be added without
|
|
107
|
-
changing the CLI. See [ROADMAP.md](ROADMAP.md).
|
|
107
|
+
changing the CLI. See [ROADMAP.md](https://github.com/amenalahassa/bugcap/blob/master/ROADMAP.md).
|
|
108
108
|
|
|
109
109
|
## Installation
|
|
110
110
|
|
|
@@ -134,9 +134,13 @@ Notes on the more involved behaviour:
|
|
|
134
134
|
- **Repo values** (`init`, `sync`, `config repo set`) are checked for format and, with `gh`, for existence. Changing the repo identity offers to move existing reports.
|
|
135
135
|
- **Media sync** over `[sync] max_upload_mb` (default 25) is skipped with a warning.
|
|
136
136
|
|
|
137
|
+
## Contributing
|
|
138
|
+
|
|
139
|
+
Contributions are welcome. Read [CONTRIBUTING.md](https://github.com/amenalahassa/bugcap/blob/master/CONTRIBUTING.md) for the workflow and project rules, and the [Code of Conduct](https://github.com/amenalahassa/bugcap/blob/master/CODE_OF_CONDUCT.md). Report security issues privately, see [SECURITY.md](https://github.com/amenalahassa/bugcap/blob/master/SECURITY.md).
|
|
140
|
+
|
|
137
141
|
## Development
|
|
138
142
|
|
|
139
|
-
See [DEVELOPMENT.md](DEVELOPMENT.md). Run the tests with:
|
|
143
|
+
See [DEVELOPMENT.md](https://github.com/amenalahassa/bugcap/blob/master/DEVELOPMENT.md). Run the tests with:
|
|
140
144
|
|
|
141
145
|
```bash
|
|
142
146
|
uv run --extra dev --extra mcp pytest -q
|
|
@@ -187,7 +191,7 @@ succeeds, so a re-run skips what is already recorded.
|
|
|
187
191
|
|
|
188
192
|
## Roadmap
|
|
189
193
|
|
|
190
|
-
See [ROADMAP.md](ROADMAP.md).
|
|
194
|
+
See [ROADMAP.md](https://github.com/amenalahassa/bugcap/blob/master/ROADMAP.md).
|
|
191
195
|
|
|
192
196
|
## Design notes / deliberate non-goals
|
|
193
197
|
|
|
@@ -206,4 +210,4 @@ See [ROADMAP.md](ROADMAP.md).
|
|
|
206
210
|
|
|
207
211
|
## License
|
|
208
212
|
|
|
209
|
-
MIT — see [LICENSE](LICENSE).
|
|
213
|
+
MIT — see [LICENSE](https://github.com/amenalahassa/bugcap/blob/master/LICENSE).
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bugcap"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.1"
|
|
8
8
|
description = "Local-first, agent-readable bug capture: annotated screenshots + notes, stored locally, synced to trackers on your own schedule."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -14,7 +14,7 @@ dependencies = ["tomli>=2; python_version < '3.11'"]
|
|
|
14
14
|
|
|
15
15
|
[project.optional-dependencies]
|
|
16
16
|
mcp = ["mcp>=1.2,<2"]
|
|
17
|
-
dev = ["pytest>=7"]
|
|
17
|
+
dev = ["pytest>=7", "ruff>=0.6"]
|
|
18
18
|
|
|
19
19
|
[project.scripts]
|
|
20
20
|
bugcap = "bugcap.cli:main"
|
|
@@ -27,3 +27,13 @@ bugcap = ["dashboard/static/*"]
|
|
|
27
27
|
|
|
28
28
|
[tool.pytest.ini_options]
|
|
29
29
|
testpaths = ["tests"]
|
|
30
|
+
|
|
31
|
+
[tool.ruff]
|
|
32
|
+
line-length = 120
|
|
33
|
+
target-version = "py310"
|
|
34
|
+
|
|
35
|
+
[tool.ruff.lint]
|
|
36
|
+
select = ["E4", "E7", "E9", "F", "I"]
|
|
37
|
+
|
|
38
|
+
[tool.ruff.lint.per-file-ignores]
|
|
39
|
+
"tests/*" = ["E702", "E731"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.1"
|
|
@@ -7,13 +7,12 @@ import threading
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Optional
|
|
9
9
|
|
|
10
|
-
from . import backends, capture, config, ghcli, recorder, refs, repo, service, sync, validation
|
|
10
|
+
from . import __version__, backends, capture, config, ghcli, recorder, refs, repo, service, sync, validation
|
|
11
11
|
from .capture import CaptureError
|
|
12
12
|
from .errors import ServiceError
|
|
13
13
|
from .ghcli import GhError
|
|
14
14
|
from .store import STATUSES, Store
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
# --- shared helpers (T014) ----------------------------------------------------
|
|
18
17
|
|
|
19
18
|
def current_repo():
|
|
@@ -152,12 +151,8 @@ def cmd_list(args: argparse.Namespace) -> int:
|
|
|
152
151
|
return 0
|
|
153
152
|
|
|
154
153
|
|
|
155
|
-
def
|
|
156
|
-
|
|
157
|
-
report = resolve_report(store, args.id)
|
|
158
|
-
if report is None:
|
|
159
|
-
return 1
|
|
160
|
-
|
|
154
|
+
def print_report(report) -> None:
|
|
155
|
+
"""The multi-line details of one report, as `bugcap show` prints them."""
|
|
161
156
|
print(f"#{report.id} {report.title}")
|
|
162
157
|
print(f" created_at: {report.created_at}")
|
|
163
158
|
print(f" status: {report.status}")
|
|
@@ -165,7 +160,7 @@ def cmd_show(args: argparse.Namespace) -> int:
|
|
|
165
160
|
print(f" repo: {report.repo}")
|
|
166
161
|
print(f" tags: {', '.join(report.tags) or '(none)'}")
|
|
167
162
|
print(f" notes: {refs.display_notes(report.notes, report.media) or '(none)'}")
|
|
168
|
-
print(
|
|
163
|
+
print(" images:")
|
|
169
164
|
for path in report.image_paths:
|
|
170
165
|
print(f" - {path}")
|
|
171
166
|
detailed = [m for m in report.media if not (m.kind == "image" and m.source == "legacy")]
|
|
@@ -175,12 +170,21 @@ def cmd_show(args: argparse.Namespace) -> int:
|
|
|
175
170
|
where = m.path or f"({len(m.frames)} frames)"
|
|
176
171
|
origin = f" (source: {m.source})" if m.source else ""
|
|
177
172
|
print(f" {refs.media_token(m)} {m.kind:8s} {m.label or '-':12s} {where} {human_size(m.size_bytes)}{origin}")
|
|
178
|
-
print(
|
|
173
|
+
print(" synced_refs:")
|
|
179
174
|
if report.synced_refs:
|
|
180
175
|
for tracker, ref in report.synced_refs.items():
|
|
181
176
|
print(f" - {tracker}: {ref}")
|
|
182
177
|
else:
|
|
183
178
|
print(" (not synced to any tracker yet)")
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def cmd_show(args: argparse.Namespace) -> int:
|
|
182
|
+
with Store() as store:
|
|
183
|
+
report = resolve_report(store, args.id)
|
|
184
|
+
if report is None:
|
|
185
|
+
return 1
|
|
186
|
+
|
|
187
|
+
print_report(report)
|
|
184
188
|
return 0
|
|
185
189
|
|
|
186
190
|
|
|
@@ -574,6 +578,8 @@ def cmd_attach(args: argparse.Namespace) -> int:
|
|
|
574
578
|
print(f"Attached {shot_path} to report #{args.id}")
|
|
575
579
|
elif note and added:
|
|
576
580
|
print(f"Added note to report #{args.id}")
|
|
581
|
+
print()
|
|
582
|
+
print_report(current)
|
|
577
583
|
return 1 if rejected or (note and not added) else 0
|
|
578
584
|
|
|
579
585
|
|
|
@@ -843,6 +849,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
843
849
|
prog="bugcap",
|
|
844
850
|
description="Local-first, agent-readable bug capture: annotated screenshots + notes.",
|
|
845
851
|
)
|
|
852
|
+
parser.add_argument("--version", action="version", version=f"bugcap {__version__}")
|
|
846
853
|
sub = parser.add_subparsers(dest="command", required=True)
|
|
847
854
|
|
|
848
855
|
p = sub.add_parser("setup", help="Detect a capture tool, or recommend/install one.")
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"""Bring existing images into the store: local paths, globs and http(s) URLs.
|
|
2
2
|
|
|
3
3
|
Every input is validated by its magic bytes (never its extension or Content-Type), copied
|
|
4
|
-
into the images directory under a
|
|
5
|
-
atomically.
|
|
4
|
+
into the images directory under a name derived from its content (the original path is not
|
|
5
|
+
kept) and written atomically. The same image is therefore stored once, however many reports
|
|
6
|
+
use it. Network access is limited to plain http(s) GETs with no credentials."""
|
|
6
7
|
from __future__ import annotations
|
|
7
8
|
|
|
8
9
|
import glob
|
|
10
|
+
import hashlib
|
|
9
11
|
import os
|
|
10
12
|
import socket
|
|
11
13
|
import urllib.error
|
|
@@ -32,6 +34,7 @@ class StoredFile:
|
|
|
32
34
|
mime: str
|
|
33
35
|
size_bytes: int
|
|
34
36
|
source: str
|
|
37
|
+
reused: bool = False # the content was already in the store; no new file was written
|
|
35
38
|
|
|
36
39
|
|
|
37
40
|
@dataclass
|
|
@@ -70,10 +73,16 @@ def sniff_image(data: bytes) -> str:
|
|
|
70
73
|
raise ServiceError("invalid_image", "not an image (PNG, JPEG, GIF or WebP expected)")
|
|
71
74
|
|
|
72
75
|
|
|
76
|
+
def content_name(data: bytes, mime: str) -> str:
|
|
77
|
+
return f"{hashlib.sha256(data).hexdigest()}{_EXT[mime]}"
|
|
78
|
+
|
|
79
|
+
|
|
73
80
|
def _store(data: bytes, source: str) -> StoredFile:
|
|
74
81
|
mime = sniff_image(data)
|
|
75
|
-
dest = images_dir() /
|
|
76
|
-
|
|
82
|
+
dest = images_dir() / content_name(data, mime)
|
|
83
|
+
if dest.is_file() and dest.stat().st_size == len(data):
|
|
84
|
+
return StoredFile(to_data_relative(dest), dest, mime, len(data), source, reused=True)
|
|
85
|
+
tmp = dest.with_name(f"{dest.name}.{uuid.uuid4().hex}.part")
|
|
77
86
|
try:
|
|
78
87
|
tmp.write_bytes(data)
|
|
79
88
|
os.replace(tmp, dest)
|
|
@@ -82,6 +91,29 @@ def _store(data: bytes, source: str) -> StoredFile:
|
|
|
82
91
|
return StoredFile(to_data_relative(dest), dest, mime, len(data), source)
|
|
83
92
|
|
|
84
93
|
|
|
94
|
+
def adopt(path) -> Path:
|
|
95
|
+
"""Give a screenshot the capture tool already saved in the store its content-derived
|
|
96
|
+
name. If the same image is stored already, the new copy is dropped and the existing
|
|
97
|
+
path returned. Anything that is not a recognisable image, or sits outside the store, is
|
|
98
|
+
left where it is."""
|
|
99
|
+
path = Path(path)
|
|
100
|
+
if path.parent != images_dir():
|
|
101
|
+
return path
|
|
102
|
+
try:
|
|
103
|
+
data = path.read_bytes()
|
|
104
|
+
mime = sniff_image(data)
|
|
105
|
+
except (OSError, ServiceError):
|
|
106
|
+
return path
|
|
107
|
+
dest = images_dir() / content_name(data, mime)
|
|
108
|
+
if dest == path:
|
|
109
|
+
return path
|
|
110
|
+
if dest.is_file() and dest.stat().st_size == len(data):
|
|
111
|
+
path.unlink(missing_ok=True)
|
|
112
|
+
return dest
|
|
113
|
+
os.replace(path, dest)
|
|
114
|
+
return dest
|
|
115
|
+
|
|
116
|
+
|
|
85
117
|
def import_local(path: Path) -> StoredFile:
|
|
86
118
|
path = Path(path).expanduser()
|
|
87
119
|
if path.is_dir():
|
|
@@ -85,7 +85,7 @@ class _App:
|
|
|
85
85
|
|
|
86
86
|
def style(self) -> None:
|
|
87
87
|
"""One consistent look for every window: a flat light theme with an accent button."""
|
|
88
|
-
|
|
88
|
+
ttk = self.ttk
|
|
89
89
|
import tkinter.font as tkfont
|
|
90
90
|
|
|
91
91
|
base = tkfont.nametofont("TkDefaultFont")
|
|
@@ -81,6 +81,8 @@ class AddResult:
|
|
|
81
81
|
|
|
82
82
|
def _discard(stored_files) -> None:
|
|
83
83
|
for stored in stored_files:
|
|
84
|
+
if stored.reused: # shared with other media; not ours to delete
|
|
85
|
+
continue
|
|
84
86
|
try:
|
|
85
87
|
stored.abs_path.unlink()
|
|
86
88
|
except OSError:
|
|
@@ -158,6 +160,7 @@ def create_report(
|
|
|
158
160
|
with store.transaction():
|
|
159
161
|
report = store.add(title=title, notes="", tags=tags, repo=repo, body=body, status=status)
|
|
160
162
|
if captured is not None:
|
|
163
|
+
captured = str(ingest.adopt(captured))
|
|
161
164
|
result.added.append(
|
|
162
165
|
store.insert_media(report.id, kind="image", path=captured,
|
|
163
166
|
label=captured_label or None, source="captured")
|
|
@@ -194,7 +197,7 @@ def delete_report(store: Store, report_id: int) -> Report:
|
|
|
194
197
|
report = _require(store, report_id)
|
|
195
198
|
store.delete(report_id)
|
|
196
199
|
for item in report.media:
|
|
197
|
-
_delete_files(item)
|
|
200
|
+
_delete_files(store, item)
|
|
198
201
|
return report
|
|
199
202
|
|
|
200
203
|
|
|
@@ -202,6 +205,7 @@ def attach_captured(store: Store, report_id: int, path: str, label: Optional[str
|
|
|
202
205
|
"""Attach a screenshot the capture tool already saved in the store (no copy)."""
|
|
203
206
|
report = _require(store, report_id)
|
|
204
207
|
_check_new_labels(report.media, [label])
|
|
208
|
+
path = ingest.adopt(path)
|
|
205
209
|
return store.insert_media(report_id, kind="image", path=str(path), label=label or None, source="captured")
|
|
206
210
|
|
|
207
211
|
|
|
@@ -343,14 +347,18 @@ def remove_media(store: Store, report_id: int, ref: str, force: bool = False) ->
|
|
|
343
347
|
notes, count = refs.rewrite_references_counted(report.notes, mapping)
|
|
344
348
|
if count:
|
|
345
349
|
store.update(report_id, notes=notes)
|
|
346
|
-
_delete_files(item)
|
|
350
|
+
_delete_files(store, item)
|
|
347
351
|
return count
|
|
348
352
|
|
|
349
353
|
|
|
350
|
-
def _delete_files(item: Media) -> None:
|
|
354
|
+
def _delete_files(store: Store, item: Media) -> None:
|
|
355
|
+
"""Delete an item's files unless another media item still uses them (identical images
|
|
356
|
+
are stored once and shared). Call after the item's rows are gone."""
|
|
351
357
|
paths = [item.path] if item.path else []
|
|
352
358
|
paths += [f.path for f in item.frames]
|
|
353
359
|
for rel in paths:
|
|
360
|
+
if store.path_in_use(rel):
|
|
361
|
+
continue
|
|
354
362
|
try:
|
|
355
363
|
os.unlink(resolve_data_path(rel))
|
|
356
364
|
except (ValueError, OSError):
|
|
@@ -425,6 +425,14 @@ class Store:
|
|
|
425
425
|
).fetchall()
|
|
426
426
|
return [self._load_media(r) for r in rows]
|
|
427
427
|
|
|
428
|
+
def path_in_use(self, path: str) -> bool:
|
|
429
|
+
"""Whether any media item or frame still points at this stored file."""
|
|
430
|
+
row = self._conn.execute(
|
|
431
|
+
"SELECT EXISTS(SELECT 1 FROM media WHERE path = ?) OR EXISTS(SELECT 1 FROM media_frames WHERE path = ?)",
|
|
432
|
+
(path, path),
|
|
433
|
+
).fetchone()
|
|
434
|
+
return bool(row[0])
|
|
435
|
+
|
|
428
436
|
def get_media(self, media_id: int) -> Optional[Media]:
|
|
429
437
|
row = self._conn.execute("SELECT * FROM media WHERE id = ?", (media_id,)).fetchone()
|
|
430
438
|
return self._load_media(row) if row else None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bugcap
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Local-first, agent-readable bug capture: annotated screenshots + notes, stored locally, synced to trackers on your own schedule.
|
|
5
5
|
Author: Konrad Tagnon Amen ALAHASSA
|
|
6
6
|
License: MIT
|
|
@@ -12,10 +12,11 @@ Provides-Extra: mcp
|
|
|
12
12
|
Requires-Dist: mcp<2,>=1.2; extra == "mcp"
|
|
13
13
|
Provides-Extra: dev
|
|
14
14
|
Requires-Dist: pytest>=7; extra == "dev"
|
|
15
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
15
16
|
Dynamic: license-file
|
|
16
17
|
|
|
17
18
|
<p align="center">
|
|
18
|
-
<img src="docs/assets/logo.svg" alt="bugcap" width="96">
|
|
19
|
+
<img src="https://raw.githubusercontent.com/amenalahassa/bugcap/master/docs/assets/logo.svg" alt="bugcap" width="96">
|
|
19
20
|
</p>
|
|
20
21
|
|
|
21
22
|
<h1 align="center">bugcap</h1>
|
|
@@ -28,7 +29,7 @@ Dynamic: license-file
|
|
|
28
29
|
<p align="center">
|
|
29
30
|
<a href="https://github.com/amenalahassa/bugcap/actions/workflows/release.yml"><img alt="tests" src="https://github.com/amenalahassa/bugcap/actions/workflows/release.yml/badge.svg"></a>
|
|
30
31
|
<img alt="python" src="https://img.shields.io/badge/python-3.10%2B-3776ab?logo=python&logoColor=white">
|
|
31
|
-
<a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-green"></a>
|
|
32
|
+
<a href="https://github.com/amenalahassa/bugcap/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-green"></a>
|
|
32
33
|
<a href="https://amenalahassa.github.io/bugcap/"><img alt="docs" src="https://img.shields.io/badge/docs-website-d9480f"></a>
|
|
33
34
|
</p>
|
|
34
35
|
|
|
@@ -37,11 +38,11 @@ Dynamic: license-file
|
|
|
37
38
|
<a href="https://amenalahassa.github.io/bugcap/usage.html">Usage guide</a> ·
|
|
38
39
|
<a href="#quick-start">Quick start</a> ·
|
|
39
40
|
<a href="#connect-your-agent-mcp">Agents (MCP)</a> ·
|
|
40
|
-
<a href="CHANGELOG.md">Changelog</a>
|
|
41
|
+
<a href="https://github.com/amenalahassa/bugcap/blob/master/CHANGELOG.md">Changelog</a>
|
|
41
42
|
</p>
|
|
42
43
|
|
|
43
44
|
<p align="center">
|
|
44
|
-
<img src="docs/assets/demo.gif" alt="bugcap
|
|
45
|
+
<img src="https://raw.githubusercontent.com/amenalahassa/bugcap/master/docs/assets/demo.gif" alt="bugcap live: screenshot a broken page, file a bug with a note, then read it back with bugcap show" width="760">
|
|
45
46
|
</p>
|
|
46
47
|
|
|
47
48
|
---
|
|
@@ -120,7 +121,7 @@ the error toast"*. It can read the picture because it's a local file, not a CDN
|
|
|
120
121
|
Working. Roadmap items 1–5, 7 and 8 are implemented and tested, along with spec 002 (images,
|
|
121
122
|
`@` references, recording, live mode and the dashboard). S3/R2 object storage (item 6) and other
|
|
122
123
|
trackers (item 9) are deferred. The `Destination` seam is in place, so they can be added without
|
|
123
|
-
changing the CLI. See [ROADMAP.md](ROADMAP.md).
|
|
124
|
+
changing the CLI. See [ROADMAP.md](https://github.com/amenalahassa/bugcap/blob/master/ROADMAP.md).
|
|
124
125
|
|
|
125
126
|
## Installation
|
|
126
127
|
|
|
@@ -150,9 +151,13 @@ Notes on the more involved behaviour:
|
|
|
150
151
|
- **Repo values** (`init`, `sync`, `config repo set`) are checked for format and, with `gh`, for existence. Changing the repo identity offers to move existing reports.
|
|
151
152
|
- **Media sync** over `[sync] max_upload_mb` (default 25) is skipped with a warning.
|
|
152
153
|
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
Contributions are welcome. Read [CONTRIBUTING.md](https://github.com/amenalahassa/bugcap/blob/master/CONTRIBUTING.md) for the workflow and project rules, and the [Code of Conduct](https://github.com/amenalahassa/bugcap/blob/master/CODE_OF_CONDUCT.md). Report security issues privately, see [SECURITY.md](https://github.com/amenalahassa/bugcap/blob/master/SECURITY.md).
|
|
157
|
+
|
|
153
158
|
## Development
|
|
154
159
|
|
|
155
|
-
See [DEVELOPMENT.md](DEVELOPMENT.md). Run the tests with:
|
|
160
|
+
See [DEVELOPMENT.md](https://github.com/amenalahassa/bugcap/blob/master/DEVELOPMENT.md). Run the tests with:
|
|
156
161
|
|
|
157
162
|
```bash
|
|
158
163
|
uv run --extra dev --extra mcp pytest -q
|
|
@@ -203,7 +208,7 @@ succeeds, so a re-run skips what is already recorded.
|
|
|
203
208
|
|
|
204
209
|
## Roadmap
|
|
205
210
|
|
|
206
|
-
See [ROADMAP.md](ROADMAP.md).
|
|
211
|
+
See [ROADMAP.md](https://github.com/amenalahassa/bugcap/blob/master/ROADMAP.md).
|
|
207
212
|
|
|
208
213
|
## Design notes / deliberate non-goals
|
|
209
214
|
|
|
@@ -222,4 +227,4 @@ See [ROADMAP.md](ROADMAP.md).
|
|
|
222
227
|
|
|
223
228
|
## License
|
|
224
229
|
|
|
225
|
-
MIT — see [LICENSE](LICENSE).
|
|
230
|
+
MIT — see [LICENSE](https://github.com/amenalahassa/bugcap/blob/master/LICENSE).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""T026: `bugcap attach`."""
|
|
2
2
|
import pytest
|
|
3
|
-
|
|
4
3
|
from fixtures.make_images import png_bytes
|
|
4
|
+
|
|
5
5
|
from bugcap import backends, capture, cli
|
|
6
6
|
from bugcap.store import Store
|
|
7
7
|
|
|
@@ -169,3 +169,77 @@ def test_pull_ask_flow_appends_note(bugcap_home, monkeypatch, tmp_path):
|
|
|
169
169
|
sync._attach_answer(store, rid, None)
|
|
170
170
|
report = store.get(rid)
|
|
171
171
|
assert len(report.media) == 2 and report.notes.endswith("@i1: seen on pull")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
# --- details after attach / shared storage -----------------------------------------------
|
|
175
|
+
|
|
176
|
+
def test_attach_prints_the_bug_details_after_the_usual_output(bugcap_home, tmp_path, capsys):
|
|
177
|
+
with Store() as store:
|
|
178
|
+
rid = store.add("Login fails", tags=["auth"]).id
|
|
179
|
+
img = tmp_path / "new.png"
|
|
180
|
+
img.write_bytes(png_bytes())
|
|
181
|
+
assert cli.main(["attach", str(rid), "--image", str(img), "--note", "see this"]) == 0
|
|
182
|
+
out = capsys.readouterr().out
|
|
183
|
+
assert out.index("added @i1") < out.index(f"#{rid} Login fails")
|
|
184
|
+
assert "tags: auth" in out and "see this" in out and "media:" in out and "i1" in out
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def test_attach_with_a_rejected_image_still_shows_the_unchanged_bug(bugcap_home, tmp_path, capsys):
|
|
188
|
+
with Store() as store:
|
|
189
|
+
rid = store.add("Bug").id
|
|
190
|
+
assert cli.main(["attach", str(rid), "--image", str(tmp_path / "missing.png")]) == 1
|
|
191
|
+
captured = capsys.readouterr()
|
|
192
|
+
assert "skipped" in captured.err and f"#{rid} Bug" in captured.out and "media:" not in captured.out
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def test_attach_unknown_id_prints_no_details(bugcap_home, capsys):
|
|
196
|
+
assert cli.main(["attach", "999", "--image", "x.png"]) == 1
|
|
197
|
+
assert capsys.readouterr().out == ""
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def test_same_image_on_two_bugs_is_stored_once(bugcap_home, tmp_path):
|
|
201
|
+
from bugcap.paths import images_dir
|
|
202
|
+
|
|
203
|
+
with Store() as store:
|
|
204
|
+
a, b = store.add("A").id, store.add("B").id
|
|
205
|
+
img = tmp_path / "same.png"
|
|
206
|
+
img.write_bytes(png_bytes())
|
|
207
|
+
assert cli.main(["attach", str(a), "--image", str(img)]) == 0
|
|
208
|
+
assert cli.main(["attach", str(b), "--image", str(img)]) == 0
|
|
209
|
+
with Store() as store:
|
|
210
|
+
pa, pb = store.get(a).media[0].path, store.get(b).media[0].path
|
|
211
|
+
assert pa == pb and len(list(images_dir().iterdir())) == 1
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def test_shared_file_survives_until_its_last_user_is_gone(bugcap_home, tmp_path):
|
|
215
|
+
from bugcap import service
|
|
216
|
+
|
|
217
|
+
with Store() as store:
|
|
218
|
+
a, b = store.add("A").id, store.add("B").id
|
|
219
|
+
img = tmp_path / "same.png"
|
|
220
|
+
img.write_bytes(png_bytes())
|
|
221
|
+
for rid in (a, b):
|
|
222
|
+
assert cli.main(["attach", str(rid), "--image", str(img)]) == 0
|
|
223
|
+
with Store() as store:
|
|
224
|
+
path = store.get(a).media[0].abs_path
|
|
225
|
+
service.remove_media(store, a, "i1")
|
|
226
|
+
assert __import__("os").path.isfile(path) # B still uses it
|
|
227
|
+
service.delete_report(store, b)
|
|
228
|
+
assert not __import__("os").path.exists(path)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def test_same_image_twice_in_one_attach_and_failed_attach_keep_shared_file(bugcap_home, tmp_path):
|
|
232
|
+
from bugcap import service
|
|
233
|
+
|
|
234
|
+
with Store() as store:
|
|
235
|
+
a, b = store.add("A").id, store.add("B").id
|
|
236
|
+
img = tmp_path / "same.png"
|
|
237
|
+
img.write_bytes(png_bytes())
|
|
238
|
+
service.add_media(store, a, [str(img)])
|
|
239
|
+
# B asks for the same image with a label that cannot be used: nothing may be deleted
|
|
240
|
+
with pytest.raises(Exception):
|
|
241
|
+
service.add_media(store, b, [str(img)], labels=["i1"])
|
|
242
|
+
path = store.get(a).media[0].abs_path
|
|
243
|
+
assert __import__("os").path.isfile(path)
|
|
244
|
+
res = service.add_media(store, b, [str(img), str(img)])
|
|
245
|
+
assert len(res.added) == 2 and len({m.path for m in res.added}) == 1
|
|
@@ -20,8 +20,12 @@ def test_missing_tkinter_exits_3_with_install_hint(monkeypatch, capsys):
|
|
|
20
20
|
assert "python3-tk" in capsys.readouterr().err
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
@pytest.mark.skipif(
|
|
24
|
+
sys.platform in ("win32", "darwin"),
|
|
25
|
+
reason="DISPLAY only means something on X11; elsewhere Tk opens a real window and blocks",
|
|
26
|
+
)
|
|
23
27
|
def test_unreachable_display_exits_3(monkeypatch, capsys):
|
|
24
|
-
|
|
28
|
+
pytest.importorskip("tkinter")
|
|
25
29
|
monkeypatch.setenv("DISPLAY", ":99999")
|
|
26
30
|
assert cli.main(["live"]) == 3
|
|
27
31
|
assert "cannot open a window" in capsys.readouterr().err
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""`capture --no-image` saves a text-only report; `delete` removes a report and its files."""
|
|
2
|
-
import pytest
|
|
3
2
|
|
|
4
3
|
from fixtures.make_images import png_bytes
|
|
4
|
+
|
|
5
5
|
from bugcap import cli, service
|
|
6
6
|
from bugcap.paths import resolve_data_path
|
|
7
7
|
from bugcap.store import Store
|
|
@@ -79,3 +79,12 @@ def test_no_package_manager_prints_guidance(monkeypatch, record_run, capsys):
|
|
|
79
79
|
assert cli.main(["setup"]) == 1
|
|
80
80
|
assert "manually" in capsys.readouterr().err.lower()
|
|
81
81
|
assert record_run == []
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_version_flag(capsys):
|
|
85
|
+
from bugcap import __version__
|
|
86
|
+
|
|
87
|
+
with pytest.raises(SystemExit) as exc:
|
|
88
|
+
cli.main(["--version"])
|
|
89
|
+
assert exc.value.code == 0
|
|
90
|
+
assert capsys.readouterr().out.strip() == f"bugcap {__version__}"
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import base64
|
|
3
3
|
import json
|
|
4
4
|
|
|
5
|
+
from fixtures.make_images import png_bytes
|
|
6
|
+
|
|
5
7
|
from bugcap import service, sync
|
|
6
8
|
from bugcap.store import Store
|
|
7
9
|
from bugcap.sync import GitHubDestination, ImagesTarget, SyncOptions
|
|
8
|
-
from fixtures.make_images import png_bytes
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def _setup(fake_gh):
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
1
3
|
import pytest
|
|
4
|
+
from fixtures.make_images import gif_bytes, jpeg_bytes, png_bytes, webp_bytes
|
|
2
5
|
|
|
3
6
|
from bugcap import ingest
|
|
4
7
|
from bugcap.errors import ServiceError
|
|
5
|
-
from fixtures.make_images import gif_bytes, jpeg_bytes, png_bytes, webp_bytes
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
def test_classify_sources(tmp_path):
|
|
@@ -54,7 +56,7 @@ def test_import_copies_into_store(bugcap_home, sample_images):
|
|
|
54
56
|
|
|
55
57
|
def test_glob_sorted_and_no_match(sample_images):
|
|
56
58
|
matches = ingest.resolve_glob(str(sample_images / "sample.*"))
|
|
57
|
-
assert [m.
|
|
59
|
+
assert [Path(m).name for m in matches] == ["sample.gif", "sample.jpg", "sample.png", "sample.webp"]
|
|
58
60
|
items = ingest.expand_sources([str(sample_images / "nope-*.png")])
|
|
59
61
|
assert items[0].error.code == "not_found" and "nope-*.png" in items[0].error.message
|
|
60
62
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
|
+
from fixtures.make_images import png_bytes
|
|
4
5
|
|
|
5
6
|
from bugcap import drafts, live_session, recorder
|
|
6
7
|
from bugcap.errors import ServiceError
|
|
7
8
|
from bugcap.live_session import LiveSession, LiveState
|
|
8
9
|
from bugcap.paths import images_dir, media_dir
|
|
9
10
|
from bugcap.store import Store
|
|
10
|
-
from fixtures.make_images import png_bytes
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class Cfg:
|
|
@@ -97,7 +97,7 @@ def test_save_combines_images_and_a_video_in_order(session):
|
|
|
97
97
|
assert report.title == "Login broken" and report.repo == "owner/proj"
|
|
98
98
|
assert report.tags == ["auth", "proj"] and report.status == "in-progress"
|
|
99
99
|
assert [(m.idx, m.kind) for m in report.media] == [(1, "image"), (2, "video"), (3, "image")]
|
|
100
|
-
assert
|
|
100
|
+
assert all(Path(m.abs_path).is_file() for m in report.media) # captured files stay in the store
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
def test_two_reports_in_a_row(session):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import signal
|
|
2
2
|
import subprocess
|
|
3
|
+
from pathlib import Path
|
|
3
4
|
|
|
4
5
|
import pytest
|
|
5
6
|
|
|
@@ -156,11 +157,10 @@ def test_animated_runs_postprocess_and_removes_raw(env, tmp_path):
|
|
|
156
157
|
|
|
157
158
|
|
|
158
159
|
def test_frames_result(env, tmp_path):
|
|
159
|
-
frames_dir_files = []
|
|
160
160
|
|
|
161
161
|
def runner(argv, **kw):
|
|
162
162
|
pattern = argv[-1]
|
|
163
|
-
folder =
|
|
163
|
+
folder = Path(pattern).parent
|
|
164
164
|
for n in (1, 2, 3):
|
|
165
165
|
(folder / f"frame-00{n}.png").write_bytes(b"x")
|
|
166
166
|
return subprocess.CompletedProcess(argv, 0, "", "")
|
|
@@ -168,7 +168,7 @@ def test_frames_result(env, tmp_path):
|
|
|
168
168
|
result = recorder.run_recording("ffmpeg", "frames", 5, 30, 25, tmp_path, lambda: True,
|
|
169
169
|
**env.kwargs(runner=runner))
|
|
170
170
|
assert result.kind == "frames" and len(result.frames) == 3 and result.path is None
|
|
171
|
-
assert [p.
|
|
171
|
+
assert [Path(p).name for p, _ in result.frames] == ["frame-001.png", "frame-002.png", "frame-003.png"]
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
def test_macos_probes_screen_device(env, tmp_path):
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
The expected strings below are the exact pre-feature formats; the test fails if any
|
|
4
4
|
scoping/repo change leaks into output when there is no .bugcap.toml in scope."""
|
|
5
|
-
import pytest
|
|
6
5
|
|
|
7
6
|
from fixtures.make_images import png_bytes
|
|
7
|
+
|
|
8
8
|
from bugcap import cli
|
|
9
9
|
from bugcap.store import Store
|
|
10
10
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"""T031: image-commit consent rules (FR-018a) and images-target resolution (FR-018b/R2)."""
|
|
2
|
-
import base64
|
|
3
2
|
import json
|
|
4
3
|
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
4
|
from bugcap import config, repo, sync
|
|
8
5
|
from bugcap.store import Store
|
|
9
6
|
from bugcap.sync import GitHubDestination, ImagesTarget, SyncOptions, resolve_images_target
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|