catchdev 0.1.0__tar.gz → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchdev
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Tells you what your AI coding agent just broke
5
5
  License: MIT
6
6
  Requires-Python: >=3.9
@@ -97,7 +97,7 @@ jobs:
97
97
  with:
98
98
  python-version: "3.12"
99
99
  - run: pip install -e .
100
- - uses: yourusername/catchdev@v1
100
+ - uses: soham131345/catchdev@v1
101
101
  ```
102
102
 
103
103
  catch runs catch on its own PRs — see
@@ -106,7 +106,7 @@ catch runs catch on its own PRs — see
106
106
  **Pre-commit / pre-push hook** — add to `.pre-commit-config.yaml`:
107
107
 
108
108
  ```yaml
109
- - repo: https://github.com/yourusername/catchdev
109
+ - repo: https://github.com/soham131345/catchdev
110
110
  rev: v0.1.0
111
111
  hooks:
112
112
  - id: catch
@@ -1,123 +1,123 @@
1
- # catchdev
2
-
3
- **Tells you what your AI coding agent just broke.**
4
-
5
- ![catch flags a real 4-month Flask regression in 2 seconds](demo/demo.gif)
6
-
7
- That GIF is real: it's catch flagging the `SECRET_KEY_FALLBACKS` session bug
8
- that lived in Flask 3.1.0 for ~4 months before anyone noticed. catch ran the
9
- affected tests, re-ran the failures against the pre-diff baseline, and pointed
10
- at the exact regression. [Reproduce it yourself.](demo/README.md)
11
-
12
- ## 10-second install
13
-
14
- ```bash
15
- pip install catchdev
16
- ```
17
-
18
- ## Usage
19
-
20
- ```bash
21
- cd some-ai-generated-project
22
- # make some changes (or let an agent make them)
23
- git add .
24
- catch # check staged changes
25
- catch --commit HEAD~1 # check the last commit
26
- catch --all-tests # run the full suite instead of affected tests
27
- catch --skip-deps # skip PyPI dependency risk checks
28
- catch --fail-on-suspicious # also block on suspicious (not just dangerous) deps
29
- catch --output report.md # write a markdown report (for PR comments)
30
- echo $? # 1 = problems found, 0 = clean
31
- ```
32
-
33
- In a GitHub Actions PR, catch automatically diffs against
34
- `origin/$GITHUB_BASE_REF` instead of `HEAD~1` (squash merges break `HEAD~1`).
35
-
36
- ## How it works
37
-
38
- 1. **differ** — parses `git diff --unified=0` into changed files, changed line
39
- numbers, and newly added imports / dependency entries.
40
- 2. **mapper** — builds (and caches in `.catch_cache.json`) an AST import graph
41
- of the project, then walks it backwards from each changed file until it hits
42
- test files. When possible it narrows down to the specific test functions
43
- that call the functions your diff touched.
44
- 3. **runner** — runs the affected tests with pytest, then re-runs any failures
45
- against the pre-diff baseline in a temporary git worktree to distinguish
46
- NEW failures from pre-existing ones.
47
- 4. **depcheck** — queries PyPI for every new dependency: does it exist, how old
48
- is it, how many downloads, and did you mean a similarly-named popular
49
- package? (Hallucinated package names — "slopsquatting" — are a real supply
50
- chain risk with AI-generated code.)
51
- 5. **report** — pretty terminal output and an exit code you can wire into a
52
- hook or CI.
53
-
54
- ## Why not just...?
55
-
56
- | | catch | LLM review (CodeRabbit etc.) | static gates (dont-break, Solumbe) |
57
- |---|---|---|---|
58
- | Actually runs your tests | ✓ | ✗ | ✗ |
59
- | Tells new failures from pre-existing | ✓ | ✗ | ✗ |
60
- | Deterministic (same answer every run) | ✓ | ✗ | ✓ |
61
- | Catches hallucinated packages | ✓ (live registry check) | unreliable | partial |
62
- | Cost per run | free | tokens/subscription | free |
63
- | Works as a hard CI gate | ✓ exit code | ✗ | ✓ |
64
-
65
- ## Use it everywhere
66
-
67
- **GitHub Action** (posts the report as a PR comment):
68
-
69
- ```yaml
70
- # .github/workflows/catch.yml
71
- name: Catch
72
- on: [pull_request]
73
- jobs:
74
- catch:
75
- runs-on: ubuntu-latest
76
- permissions:
77
- issues: write
78
- pull-requests: write
79
- steps:
80
- - uses: actions/checkout@v4
81
- with:
82
- fetch-depth: 0
83
- - uses: actions/setup-python@v5
84
- with:
85
- python-version: "3.12"
86
- - run: pip install -e .
87
- - uses: yourusername/catchdev@v1
88
- ```
89
-
90
- catch runs catch on its own PRs — see
91
- [.github/workflows/catch.yml](.github/workflows/catch.yml) in this repo.
92
-
93
- **Pre-commit / pre-push hook** — add to `.pre-commit-config.yaml`:
94
-
95
- ```yaml
96
- - repo: https://github.com/yourusername/catchdev
97
- rev: v0.1.0
98
- hooks:
99
- - id: catch
100
- ```
101
-
102
- Running tests on every commit annoys people; pre-push is the sweet spot:
103
-
104
- ```yaml
105
- - id: catch
106
- stages: [pre-push]
107
- ```
108
-
109
- **Claude Code skill** — your agent checks its own work before committing.
110
- Copy [skills/catch/SKILL.md](skills/catch/SKILL.md) into
111
- `~/.claude/skills/catch/` (or drop the packaged `catch.skill` from Releases
112
- into your skills directory). After that, Claude runs `catch --staged` before
113
- every commit and fixes what it breaks instead of shipping it.
114
-
115
- ## Exit codes
116
-
117
- - `0` — all affected tests pass, no dangerous dependencies
118
- - `1` — new test failures OR dangerous dependencies
119
- - `2` — catch itself couldn't run (not a git repo, etc.)
120
-
121
- ## License
122
-
123
- MIT
1
+ # catchdev
2
+
3
+ **Tells you what your AI coding agent just broke.**
4
+
5
+ ![catch flags a real 4-month Flask regression in 2 seconds](demo/demo.gif)
6
+
7
+ That GIF is real: it's catch flagging the `SECRET_KEY_FALLBACKS` session bug
8
+ that lived in Flask 3.1.0 for ~4 months before anyone noticed. catch ran the
9
+ affected tests, re-ran the failures against the pre-diff baseline, and pointed
10
+ at the exact regression. [Reproduce it yourself.](demo/README.md)
11
+
12
+ ## 10-second install
13
+
14
+ ```bash
15
+ pip install catchdev
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ cd some-ai-generated-project
22
+ # make some changes (or let an agent make them)
23
+ git add .
24
+ catch # check staged changes
25
+ catch --commit HEAD~1 # check the last commit
26
+ catch --all-tests # run the full suite instead of affected tests
27
+ catch --skip-deps # skip PyPI dependency risk checks
28
+ catch --fail-on-suspicious # also block on suspicious (not just dangerous) deps
29
+ catch --output report.md # write a markdown report (for PR comments)
30
+ echo $? # 1 = problems found, 0 = clean
31
+ ```
32
+
33
+ In a GitHub Actions PR, catch automatically diffs against
34
+ `origin/$GITHUB_BASE_REF` instead of `HEAD~1` (squash merges break `HEAD~1`).
35
+
36
+ ## How it works
37
+
38
+ 1. **differ** — parses `git diff --unified=0` into changed files, changed line
39
+ numbers, and newly added imports / dependency entries.
40
+ 2. **mapper** — builds (and caches in `.catch_cache.json`) an AST import graph
41
+ of the project, then walks it backwards from each changed file until it hits
42
+ test files. When possible it narrows down to the specific test functions
43
+ that call the functions your diff touched.
44
+ 3. **runner** — runs the affected tests with pytest, then re-runs any failures
45
+ against the pre-diff baseline in a temporary git worktree to distinguish
46
+ NEW failures from pre-existing ones.
47
+ 4. **depcheck** — queries PyPI for every new dependency: does it exist, how old
48
+ is it, how many downloads, and did you mean a similarly-named popular
49
+ package? (Hallucinated package names — "slopsquatting" — are a real supply
50
+ chain risk with AI-generated code.)
51
+ 5. **report** — pretty terminal output and an exit code you can wire into a
52
+ hook or CI.
53
+
54
+ ## Why not just...?
55
+
56
+ | | catch | LLM review (CodeRabbit etc.) | static gates (dont-break, Solumbe) |
57
+ |---|---|---|---|
58
+ | Actually runs your tests | ✓ | ✗ | ✗ |
59
+ | Tells new failures from pre-existing | ✓ | ✗ | ✗ |
60
+ | Deterministic (same answer every run) | ✓ | ✗ | ✓ |
61
+ | Catches hallucinated packages | ✓ (live registry check) | unreliable | partial |
62
+ | Cost per run | free | tokens/subscription | free |
63
+ | Works as a hard CI gate | ✓ exit code | ✗ | ✓ |
64
+
65
+ ## Use it everywhere
66
+
67
+ **GitHub Action** (posts the report as a PR comment):
68
+
69
+ ```yaml
70
+ # .github/workflows/catch.yml
71
+ name: Catch
72
+ on: [pull_request]
73
+ jobs:
74
+ catch:
75
+ runs-on: ubuntu-latest
76
+ permissions:
77
+ issues: write
78
+ pull-requests: write
79
+ steps:
80
+ - uses: actions/checkout@v4
81
+ with:
82
+ fetch-depth: 0
83
+ - uses: actions/setup-python@v5
84
+ with:
85
+ python-version: "3.12"
86
+ - run: pip install -e .
87
+ - uses: soham131345/catchdev@v1
88
+ ```
89
+
90
+ catch runs catch on its own PRs — see
91
+ [.github/workflows/catch.yml](.github/workflows/catch.yml) in this repo.
92
+
93
+ **Pre-commit / pre-push hook** — add to `.pre-commit-config.yaml`:
94
+
95
+ ```yaml
96
+ - repo: https://github.com/soham131345/catchdev
97
+ rev: v0.1.0
98
+ hooks:
99
+ - id: catch
100
+ ```
101
+
102
+ Running tests on every commit annoys people; pre-push is the sweet spot:
103
+
104
+ ```yaml
105
+ - id: catch
106
+ stages: [pre-push]
107
+ ```
108
+
109
+ **Claude Code skill** — your agent checks its own work before committing.
110
+ Copy [skills/catch/SKILL.md](skills/catch/SKILL.md) into
111
+ `~/.claude/skills/catch/` (or drop the packaged `catch.skill` from Releases
112
+ into your skills directory). After that, Claude runs `catch --staged` before
113
+ every commit and fixes what it breaks instead of shipping it.
114
+
115
+ ## Exit codes
116
+
117
+ - `0` — all affected tests pass, no dangerous dependencies
118
+ - `1` — new test failures OR dangerous dependencies
119
+ - `2` — catch itself couldn't run (not a git repo, etc.)
120
+
121
+ ## License
122
+
123
+ MIT
@@ -1,18 +1,18 @@
1
- [project]
2
- name = "catchdev"
3
- version = "0.1.0"
4
- description = "Tells you what your AI coding agent just broke"
5
- readme = "README.md"
6
- license = {text = "MIT"}
7
- requires-python = ">=3.9"
8
- dependencies = ["httpx", "rich", "click"]
9
-
10
- [project.scripts]
11
- catch = "catchdev.cli:main"
12
-
13
- [build-system]
14
- requires = ["setuptools"]
15
- build-backend = "setuptools.build_meta"
16
-
17
- [tool.setuptools.packages.find]
18
- where = ["src"]
1
+ [project]
2
+ name = "catchdev"
3
+ version = "0.1.1"
4
+ description = "Tells you what your AI coding agent just broke"
5
+ readme = "README.md"
6
+ license = {text = "MIT"}
7
+ requires-python = ">=3.9"
8
+ dependencies = ["httpx", "rich", "click"]
9
+
10
+ [project.scripts]
11
+ catch = "catchdev.cli:main"
12
+
13
+ [build-system]
14
+ requires = ["setuptools"]
15
+ build-backend = "setuptools.build_meta"
16
+
17
+ [tool.setuptools.packages.find]
18
+ where = ["src"]
@@ -26,6 +26,14 @@ from . import depcheck, differ, mapper, report, runner
26
26
  def main(staged: bool, commit: str | None, all_tests: bool, skip_deps: bool,
27
27
  fail_on_suspicious: bool, output: str | None) -> None:
28
28
  """Tells you what your AI coding agent just broke."""
29
+ # Windows consoles default to cp1252; make every printable we emit
30
+ # (✓, ✗, ⚠, ─, …) survive regardless of the terminal's codepage.
31
+ for stream in (sys.stdout, sys.stderr):
32
+ try:
33
+ stream.reconfigure(encoding="utf-8", errors="replace")
34
+ except Exception:
35
+ pass
36
+
29
37
  # In CI pull requests, diff against the PR base, not HEAD~1
30
38
  # (squash merges break HEAD~1). GITHUB_BASE_REF is set by GitHub Actions.
31
39
  base_ref_env = os.environ.get("GITHUB_BASE_REF")
@@ -72,4 +80,4 @@ def main(staged: bool, commit: str | None, all_tests: bool, skip_deps: bool,
72
80
 
73
81
 
74
82
  if __name__ == "__main__":
75
- main()
83
+ main()
@@ -61,7 +61,8 @@ class GitError(RuntimeError):
61
61
 
62
62
  def _git(args: list[str], cwd: str) -> str:
63
63
  proc = subprocess.run(
64
- ["git", *args], cwd=cwd, capture_output=True, text=True
64
+ ["git", *args], cwd=cwd, capture_output=True,
65
+ text=True, encoding="utf-8", errors="replace",
65
66
  )
66
67
  if proc.returncode != 0:
67
68
  raise GitError(proc.stderr.strip() or f"git {' '.join(args)} failed")
@@ -239,4 +240,4 @@ def _local_top_level_modules(root: str) -> set[str]:
239
240
  mods.add(sub.stem)
240
241
  elif child.suffix == ".py":
241
242
  mods.add(child.stem)
242
- return mods
243
+ return mods
@@ -22,7 +22,7 @@ _IGNORE_DIRS = {
22
22
  "node_modules", ".mypy_cache", ".pytest_cache", ".tox", ".idea",
23
23
  "dist", "build", ".eggs",
24
24
  }
25
- _CACHE_VERSION = 3
25
+ _CACHE_VERSION = 4
26
26
 
27
27
 
28
28
  @dataclass
@@ -51,7 +51,7 @@ def _discover_python_files(root: Path) -> list[str]:
51
51
  rel = p.relative_to(root)
52
52
  if any(part in _IGNORE_DIRS or part.startswith(".") for part in rel.parts):
53
53
  continue
54
- out.append(str(rel))
54
+ out.append(rel.as_posix())
55
55
  return out
56
56
 
57
57
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catchdev
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Tells you what your AI coding agent just broke
5
5
  License: MIT
6
6
  Requires-Python: >=3.9
@@ -97,7 +97,7 @@ jobs:
97
97
  with:
98
98
  python-version: "3.12"
99
99
  - run: pip install -e .
100
- - uses: yourusername/catchdev@v1
100
+ - uses: soham131345/catchdev@v1
101
101
  ```
102
102
 
103
103
  catch runs catch on its own PRs — see
@@ -106,7 +106,7 @@ catch runs catch on its own PRs — see
106
106
  **Pre-commit / pre-push hook** — add to `.pre-commit-config.yaml`:
107
107
 
108
108
  ```yaml
109
- - repo: https://github.com/yourusername/catchdev
109
+ - repo: https://github.com/soham131345/catchdev
110
110
  rev: v0.1.0
111
111
  hooks:
112
112
  - id: catch
File without changes
File without changes