worktree-shield 0.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 (56) hide show
  1. worktree_shield-0.1.0/LICENSE +21 -0
  2. worktree_shield-0.1.0/PKG-INFO +151 -0
  3. worktree_shield-0.1.0/README.md +116 -0
  4. worktree_shield-0.1.0/pyproject.toml +133 -0
  5. worktree_shield-0.1.0/pyproject.toml.orig +110 -0
  6. worktree_shield-0.1.0/src/worktree_shield/__init__.py +8 -0
  7. worktree_shield-0.1.0/src/worktree_shield/__main__.py +6 -0
  8. worktree_shield-0.1.0/src/worktree_shield/cli.py +377 -0
  9. worktree_shield-0.1.0/src/worktree_shield/collectors/__init__.py +1 -0
  10. worktree_shield-0.1.0/src/worktree_shield/collectors/base.py +63 -0
  11. worktree_shield-0.1.0/src/worktree_shield/collectors/compose.py +315 -0
  12. worktree_shield-0.1.0/src/worktree_shield/collectors/envfiles.py +130 -0
  13. worktree_shield-0.1.0/src/worktree_shield/collectors/layout.py +106 -0
  14. worktree_shield-0.1.0/src/worktree_shield/collectors/node.py +87 -0
  15. worktree_shield-0.1.0/src/worktree_shield/collectors/procfile.py +134 -0
  16. worktree_shield-0.1.0/src/worktree_shield/collectors/python.py +128 -0
  17. worktree_shield-0.1.0/src/worktree_shield/collectors/runtime.py +167 -0
  18. worktree_shield-0.1.0/src/worktree_shield/collectors/static.py +25 -0
  19. worktree_shield-0.1.0/src/worktree_shield/collectors/vite.py +133 -0
  20. worktree_shield-0.1.0/src/worktree_shield/collisions.py +115 -0
  21. worktree_shield-0.1.0/src/worktree_shield/config.py +188 -0
  22. worktree_shield-0.1.0/src/worktree_shield/exit_codes.py +22 -0
  23. worktree_shield-0.1.0/src/worktree_shield/files.py +70 -0
  24. worktree_shield-0.1.0/src/worktree_shield/git/__init__.py +1 -0
  25. worktree_shield-0.1.0/src/worktree_shield/git/discovery.py +85 -0
  26. worktree_shield-0.1.0/src/worktree_shield/git/porcelain.py +48 -0
  27. worktree_shield-0.1.0/src/worktree_shield/models.py +356 -0
  28. worktree_shield-0.1.0/src/worktree_shield/names.py +83 -0
  29. worktree_shield-0.1.0/src/worktree_shield/orchestrator.py +121 -0
  30. worktree_shield-0.1.0/src/worktree_shield/overlap.py +175 -0
  31. worktree_shield-0.1.0/src/worktree_shield/parsers/__init__.py +1 -0
  32. worktree_shield-0.1.0/src/worktree_shield/parsers/commands.py +158 -0
  33. worktree_shield-0.1.0/src/worktree_shield/parsers/compose.py +148 -0
  34. worktree_shield-0.1.0/src/worktree_shield/parsers/dburl.py +156 -0
  35. worktree_shield-0.1.0/src/worktree_shield/parsers/dotenv.py +91 -0
  36. worktree_shield-0.1.0/src/worktree_shield/parsers/interpolate.py +142 -0
  37. worktree_shield-0.1.0/src/worktree_shield/parsers/jsonc.py +48 -0
  38. worktree_shield-0.1.0/src/worktree_shield/parsers/jstext.py +142 -0
  39. worktree_shield-0.1.0/src/worktree_shield/plan.py +175 -0
  40. worktree_shield-0.1.0/src/worktree_shield/privacy.py +237 -0
  41. worktree_shield-0.1.0/src/worktree_shield/reports/__init__.py +1 -0
  42. worktree_shield-0.1.0/src/worktree_shield/reports/findings.py +176 -0
  43. worktree_shield-0.1.0/src/worktree_shield/reports/json_report.py +61 -0
  44. worktree_shield-0.1.0/src/worktree_shield/reports/markdown.py +103 -0
  45. worktree_shield-0.1.0/src/worktree_shield/reports/sarif.py +116 -0
  46. worktree_shield-0.1.0/src/worktree_shield/reports/terminal.py +327 -0
  47. worktree_shield-0.1.0/src/worktree_shield/rules/__init__.py +1 -0
  48. worktree_shield-0.1.0/src/worktree_shield/rules/catalog.py +28 -0
  49. worktree_shield-0.1.0/src/worktree_shield/rules/common.py +61 -0
  50. worktree_shield-0.1.0/src/worktree_shield/rules/context.py +201 -0
  51. worktree_shield-0.1.0/src/worktree_shield/rules/engine.py +60 -0
  52. worktree_shield-0.1.0/src/worktree_shield/rules/explain.py +27 -0
  53. worktree_shield-0.1.0/src/worktree_shield/rules/rules.md +112 -0
  54. worktree_shield-0.1.0/src/worktree_shield/rules/runtime.py +164 -0
  55. worktree_shield-0.1.0/src/worktree_shield/rules/shared.py +216 -0
  56. worktree_shield-0.1.0/src/worktree_shield/runner.py +273 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BhuwanJoshi-01
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,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: worktree-shield
3
+ Version: 0.1.0
4
+ Summary: Audit parallel Git worktrees for shared ports, databases and Docker resources before your agents collide.
5
+ Keywords: git,worktree,ai-agents,docker-compose,ports,sarif,ci,linter
6
+ Author: BhuwanJoshi-01
7
+ Author-email: BhuwanJoshi-01 <bhuwanj779@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Classifier: Topic :: Software Development :: Version Control :: Git
22
+ Classifier: Topic :: Utilities
23
+ Classifier: Typing :: Typed
24
+ Requires-Dist: psutil>=7.2.2
25
+ Requires-Dist: pyyaml>=6.0.3
26
+ Requires-Dist: rich>=15.0.0
27
+ Requires-Dist: typer>=0.27.3
28
+ Requires-Python: >=3.11
29
+ Project-URL: Homepage, https://bhuwanjoshi-01.github.io/worktree-shield/
30
+ Project-URL: Documentation, https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/cli.md
31
+ Project-URL: Source, https://github.com/BhuwanJoshi-01/worktree-shield
32
+ Project-URL: Issues, https://github.com/BhuwanJoshi-01/worktree-shield/issues
33
+ Project-URL: Changelog, https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/CHANGELOG.md
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Worktree Shield
37
+
38
+ **Audit parallel Git worktrees for shared ports, databases and Docker resources before your agents collide.**
39
+
40
+ [![CI](https://github.com/BhuwanJoshi-01/worktree-shield/actions/workflows/ci.yml/badge.svg)](https://github.com/BhuwanJoshi-01/worktree-shield/actions/workflows/ci.yml)
41
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/LICENSE)
42
+ [![Website](https://img.shields.io/badge/website-worktree--shield-1e1e24.svg)](https://bhuwanjoshi-01.github.io/worktree-shield/)
43
+
44
+ > **Status:** 0.1.0 is the first release. It is tested on Linux and Windows; reports from macOS and from your own
45
+ > worktree setups are very welcome. See the [roadmap](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/roadmap.md).
46
+
47
+ Git worktrees give every agent or task its own checkout, but not its own infrastructure. Three worktrees can still
48
+ start a dev server on the same port, migrate the same `app_dev` database, reuse one Docker Compose project name or
49
+ write to the same absolute folder:
50
+
51
+ ```text
52
+ repo-main/ API -> :8000 DB -> postgres://localhost/app_dev
53
+ repo-feature-login/ API -> :8000 DB -> postgres://localhost/app_dev
54
+ repo-feature-billing/ API -> :8001 DB -> postgres://localhost/app_dev
55
+ ```
56
+
57
+ Worktree Shield finds these shared resources in worktrees that **already exist**, however they were created
58
+ (plain `git worktree`, a worktree manager or a coding agent), and reports each one with the file and line it came
59
+ from and how certain the collision is.
60
+
61
+ ## Install
62
+
63
+ Needs Python 3.11 or newer and Git.
64
+
65
+ ```bash
66
+ uv tool install git+https://github.com/BhuwanJoshi-01/worktree-shield # until the PyPI release
67
+ pipx install git+https://github.com/BhuwanJoshi-01/worktree-shield # or with pipx
68
+ ```
69
+
70
+ ## Use
71
+
72
+ ```bash
73
+ worktree-shield scan # all worktrees of the current repository, read-only
74
+ worktree-shield scan --strict # exit 1 when a finding fails under the policy, for CI and agent preflight
75
+ worktree-shield scan --scope static # configuration only; leave running processes alone
76
+ worktree-shield plan # one change per worktree that would resolve it; never applied
77
+ worktree-shield explain WTS-PORT-001 # what a finding means and how to fix it
78
+ worktree-shield policy # the policy in .worktree-shield.toml, checked, or the defaults
79
+ worktree-shield resources # every port, database, Compose name and path each worktree declares
80
+ worktree-shield report --format sarif --output conflicts.sarif # also markdown, json
81
+ worktree-shield scan --strict --format json # for agents and scripts
82
+ ```
83
+
84
+ ![worktree-shield scan on three worktrees that share a port, a database and a Compose project](https://raw.githubusercontent.com/BhuwanJoshi-01/worktree-shield/main/docs/images/scan.svg)
85
+
86
+ Try it on a repository built to collide:
87
+
88
+ ```bash
89
+ python examples/conflicting-worktrees/build.py /tmp/wts-demo
90
+ worktree-shield scan --repo /tmp/wts-demo/app --scope static
91
+ ```
92
+
93
+ ## In CI
94
+
95
+ A CI checkout is a single worktree, so the GitHub Action checks this branch out next to another ref, as a second
96
+ worktree, and reports what the two would share:
97
+
98
+ ```yaml
99
+ jobs:
100
+ worktree-shield:
101
+ runs-on: ubuntu-latest
102
+ permissions:
103
+ contents: read
104
+ security-events: write # for upload-sarif
105
+ steps:
106
+ - uses: actions/checkout@v7
107
+ - uses: BhuwanJoshi-01/worktree-shield@v0.1.0
108
+ with:
109
+ compare-with: main # refs to check out next to this branch
110
+ strict: "true" # fail when a finding fails under .worktree-shield.toml
111
+ - uses: github/codeql-action/upload-sarif@v4
112
+ if: always() # upload the report even when the scan failed the job
113
+ with:
114
+ sarif_file: worktree-shield.sarif
115
+ ```
116
+
117
+ The scan in CI is static: running processes on a runner say nothing about your machine.
118
+
119
+ ## What it promises
120
+
121
+ - **Read-only.** It never writes to your worktrees or `.git`, never prunes, kills, starts containers or touches
122
+ databases.
123
+ - **Nothing from the repository runs.** Config files are parsed as data; package scripts, Git hooks, Vite configs
124
+ and Compose are never executed. Docker doesn't need to be running.
125
+ - **No secrets in output.** Database URLs are reduced to host, port and database name as soon as they are read.
126
+ `.env` files are only read when you opt in.
127
+ - **Honest certainty.** Two worktrees declaring the same port is a *probable* collision; it is *confirmed* only when
128
+ a running process proves it. Intentionally shared infrastructure (one Postgres for everyone) can be allowed by
129
+ policy.
130
+ - No network access, no telemetry.
131
+
132
+ ## Alternatives
133
+
134
+ Worktree managers can avoid collisions when they create the worktrees:
135
+ [workz](https://github.com/rohansx/workz) allocates ports, database names and Compose project names, and
136
+ [worktree-compose](https://github.com/mostafasudo/worktree-compose) checks port collisions between the worktrees it
137
+ manages with `wtc doctor`. Worktree Shield doesn't create anything; it audits whatever is already there, with a
138
+ policy file, CI exit codes and SARIF.
139
+
140
+ ## Documentation
141
+
142
+ - [Command reference](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/cli.md) and exit codes
143
+ - [Rules](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/rules.md): every finding ID, what decides its status, how to fix it
144
+ - [Policy file](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/policy.md): `.worktree-shield.toml`
145
+ - [What is read](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/what-is-read.md), and what never is
146
+ - [JSON, SARIF and Markdown output](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/json-output.md), with [sample reports](https://github.com/BhuwanJoshi-01/worktree-shield/tree/main/docs/sample-reports)
147
+ - [Architecture](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/architecture.md), [privacy](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/privacy.md), [troubleshooting](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/troubleshooting.md)
148
+
149
+ ## License
150
+
151
+ [MIT](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/LICENSE)
@@ -0,0 +1,116 @@
1
+ # Worktree Shield
2
+
3
+ **Audit parallel Git worktrees for shared ports, databases and Docker resources before your agents collide.**
4
+
5
+ [![CI](https://github.com/BhuwanJoshi-01/worktree-shield/actions/workflows/ci.yml/badge.svg)](https://github.com/BhuwanJoshi-01/worktree-shield/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/LICENSE)
7
+ [![Website](https://img.shields.io/badge/website-worktree--shield-1e1e24.svg)](https://bhuwanjoshi-01.github.io/worktree-shield/)
8
+
9
+ > **Status:** 0.1.0 is the first release. It is tested on Linux and Windows; reports from macOS and from your own
10
+ > worktree setups are very welcome. See the [roadmap](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/roadmap.md).
11
+
12
+ Git worktrees give every agent or task its own checkout, but not its own infrastructure. Three worktrees can still
13
+ start a dev server on the same port, migrate the same `app_dev` database, reuse one Docker Compose project name or
14
+ write to the same absolute folder:
15
+
16
+ ```text
17
+ repo-main/ API -> :8000 DB -> postgres://localhost/app_dev
18
+ repo-feature-login/ API -> :8000 DB -> postgres://localhost/app_dev
19
+ repo-feature-billing/ API -> :8001 DB -> postgres://localhost/app_dev
20
+ ```
21
+
22
+ Worktree Shield finds these shared resources in worktrees that **already exist**, however they were created
23
+ (plain `git worktree`, a worktree manager or a coding agent), and reports each one with the file and line it came
24
+ from and how certain the collision is.
25
+
26
+ ## Install
27
+
28
+ Needs Python 3.11 or newer and Git.
29
+
30
+ ```bash
31
+ uv tool install git+https://github.com/BhuwanJoshi-01/worktree-shield # until the PyPI release
32
+ pipx install git+https://github.com/BhuwanJoshi-01/worktree-shield # or with pipx
33
+ ```
34
+
35
+ ## Use
36
+
37
+ ```bash
38
+ worktree-shield scan # all worktrees of the current repository, read-only
39
+ worktree-shield scan --strict # exit 1 when a finding fails under the policy, for CI and agent preflight
40
+ worktree-shield scan --scope static # configuration only; leave running processes alone
41
+ worktree-shield plan # one change per worktree that would resolve it; never applied
42
+ worktree-shield explain WTS-PORT-001 # what a finding means and how to fix it
43
+ worktree-shield policy # the policy in .worktree-shield.toml, checked, or the defaults
44
+ worktree-shield resources # every port, database, Compose name and path each worktree declares
45
+ worktree-shield report --format sarif --output conflicts.sarif # also markdown, json
46
+ worktree-shield scan --strict --format json # for agents and scripts
47
+ ```
48
+
49
+ ![worktree-shield scan on three worktrees that share a port, a database and a Compose project](https://raw.githubusercontent.com/BhuwanJoshi-01/worktree-shield/main/docs/images/scan.svg)
50
+
51
+ Try it on a repository built to collide:
52
+
53
+ ```bash
54
+ python examples/conflicting-worktrees/build.py /tmp/wts-demo
55
+ worktree-shield scan --repo /tmp/wts-demo/app --scope static
56
+ ```
57
+
58
+ ## In CI
59
+
60
+ A CI checkout is a single worktree, so the GitHub Action checks this branch out next to another ref, as a second
61
+ worktree, and reports what the two would share:
62
+
63
+ ```yaml
64
+ jobs:
65
+ worktree-shield:
66
+ runs-on: ubuntu-latest
67
+ permissions:
68
+ contents: read
69
+ security-events: write # for upload-sarif
70
+ steps:
71
+ - uses: actions/checkout@v7
72
+ - uses: BhuwanJoshi-01/worktree-shield@v0.1.0
73
+ with:
74
+ compare-with: main # refs to check out next to this branch
75
+ strict: "true" # fail when a finding fails under .worktree-shield.toml
76
+ - uses: github/codeql-action/upload-sarif@v4
77
+ if: always() # upload the report even when the scan failed the job
78
+ with:
79
+ sarif_file: worktree-shield.sarif
80
+ ```
81
+
82
+ The scan in CI is static: running processes on a runner say nothing about your machine.
83
+
84
+ ## What it promises
85
+
86
+ - **Read-only.** It never writes to your worktrees or `.git`, never prunes, kills, starts containers or touches
87
+ databases.
88
+ - **Nothing from the repository runs.** Config files are parsed as data; package scripts, Git hooks, Vite configs
89
+ and Compose are never executed. Docker doesn't need to be running.
90
+ - **No secrets in output.** Database URLs are reduced to host, port and database name as soon as they are read.
91
+ `.env` files are only read when you opt in.
92
+ - **Honest certainty.** Two worktrees declaring the same port is a *probable* collision; it is *confirmed* only when
93
+ a running process proves it. Intentionally shared infrastructure (one Postgres for everyone) can be allowed by
94
+ policy.
95
+ - No network access, no telemetry.
96
+
97
+ ## Alternatives
98
+
99
+ Worktree managers can avoid collisions when they create the worktrees:
100
+ [workz](https://github.com/rohansx/workz) allocates ports, database names and Compose project names, and
101
+ [worktree-compose](https://github.com/mostafasudo/worktree-compose) checks port collisions between the worktrees it
102
+ manages with `wtc doctor`. Worktree Shield doesn't create anything; it audits whatever is already there, with a
103
+ policy file, CI exit codes and SARIF.
104
+
105
+ ## Documentation
106
+
107
+ - [Command reference](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/cli.md) and exit codes
108
+ - [Rules](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/rules.md): every finding ID, what decides its status, how to fix it
109
+ - [Policy file](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/policy.md): `.worktree-shield.toml`
110
+ - [What is read](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/what-is-read.md), and what never is
111
+ - [JSON, SARIF and Markdown output](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/json-output.md), with [sample reports](https://github.com/BhuwanJoshi-01/worktree-shield/tree/main/docs/sample-reports)
112
+ - [Architecture](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/architecture.md), [privacy](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/privacy.md), [troubleshooting](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/troubleshooting.md)
113
+
114
+ ## License
115
+
116
+ [MIT](https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/LICENSE)
@@ -0,0 +1,133 @@
1
+ [project]
2
+ name = "worktree-shield"
3
+ version = "0.1.0"
4
+ description = "Audit parallel Git worktrees for shared ports, databases and Docker resources before your agents collide."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.11"
9
+ keywords = [
10
+ "git",
11
+ "worktree",
12
+ "ai-agents",
13
+ "docker-compose",
14
+ "ports",
15
+ "sarif",
16
+ "ci",
17
+ "linter",
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 4 - Beta",
21
+ "Environment :: Console",
22
+ "Intended Audience :: Developers",
23
+ "Operating System :: POSIX :: Linux",
24
+ "Operating System :: Microsoft :: Windows",
25
+ "Programming Language :: Python :: 3 :: Only",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Programming Language :: Python :: 3.13",
29
+ "Programming Language :: Python :: 3.14",
30
+ "Topic :: Software Development :: Quality Assurance",
31
+ "Topic :: Software Development :: Version Control :: Git",
32
+ "Topic :: Utilities",
33
+ "Typing :: Typed",
34
+ ]
35
+ dependencies = [
36
+ "psutil>=7.2.2",
37
+ "pyyaml>=6.0.3",
38
+ "rich>=15.0.0",
39
+ "typer>=0.27.3",
40
+ ]
41
+
42
+ [[project.authors]]
43
+ name = "BhuwanJoshi-01"
44
+ email = "bhuwanj779@gmail.com"
45
+
46
+ [project.urls]
47
+ Homepage = "https://bhuwanjoshi-01.github.io/worktree-shield/"
48
+ Documentation = "https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/cli.md"
49
+ Source = "https://github.com/BhuwanJoshi-01/worktree-shield"
50
+ Issues = "https://github.com/BhuwanJoshi-01/worktree-shield/issues"
51
+ Changelog = "https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/CHANGELOG.md"
52
+
53
+ [project.scripts]
54
+ worktree-shield = "worktree_shield.cli:main"
55
+ wtshield = "worktree_shield.cli:main"
56
+
57
+ [build-system]
58
+ requires = ["uv_build>=0.11.29,<0.12.0"]
59
+ build-backend = "uv_build"
60
+
61
+ [dependency-groups]
62
+ dev = [
63
+ "hypothesis>=6.170.14",
64
+ "jsonschema>=4.26.0",
65
+ "mypy>=2.4.1",
66
+ "pytest>=9.2.0",
67
+ "pytest-cov>=7.1.0",
68
+ "ruff>=0.17.3",
69
+ "types-psutil>=7.2.2.20260906",
70
+ "types-pyyaml>=6.0.12.20261103",
71
+ ]
72
+
73
+ [tool.ruff]
74
+ line-length = 100
75
+ target-version = "py311"
76
+ src = [
77
+ "src",
78
+ "tests",
79
+ ]
80
+
81
+ [tool.ruff.lint]
82
+ select = [
83
+ "E",
84
+ "W",
85
+ "F",
86
+ "I",
87
+ "B",
88
+ "UP",
89
+ "SIM",
90
+ "C4",
91
+ "PTH",
92
+ "S",
93
+ "PT",
94
+ "RUF",
95
+ ]
96
+
97
+ [tool.ruff.lint.isort]
98
+ known-first-party = [
99
+ "worktree_shield",
100
+ "tests",
101
+ ]
102
+
103
+ [tool.ruff.lint.per-file-ignores]
104
+ "tests/**" = [
105
+ "S101",
106
+ "S104",
107
+ "S105",
108
+ "S106",
109
+ ]
110
+
111
+ [tool.mypy]
112
+ python_version = "3.11"
113
+ strict = true
114
+ warn_unreachable = true
115
+ files = ["src"]
116
+
117
+ [tool.pytest.ini_options]
118
+ testpaths = ["tests"]
119
+ pythonpath = ["."]
120
+ addopts = [
121
+ "-ra",
122
+ "--strict-markers",
123
+ "--strict-config",
124
+ ]
125
+ xfail_strict = true
126
+
127
+ [tool.coverage.run]
128
+ source = ["worktree_shield"]
129
+ branch = true
130
+
131
+ [tool.coverage.report]
132
+ show_missing = true
133
+ skip_covered = true
@@ -0,0 +1,110 @@
1
+ [project]
2
+ name = "worktree-shield"
3
+ version = "0.1.0"
4
+ description = "Audit parallel Git worktrees for shared ports, databases and Docker resources before your agents collide."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [
9
+ { name = "BhuwanJoshi-01", email = "bhuwanj779@gmail.com" }
10
+ ]
11
+ requires-python = ">=3.11"
12
+ keywords = ["git", "worktree", "ai-agents", "docker-compose", "ports", "sarif", "ci", "linter"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: POSIX :: Linux",
18
+ "Operating System :: Microsoft :: Windows",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
24
+ "Topic :: Software Development :: Quality Assurance",
25
+ "Topic :: Software Development :: Version Control :: Git",
26
+ "Topic :: Utilities",
27
+ "Typing :: Typed",
28
+ ]
29
+ dependencies = [
30
+ "psutil>=7.2.2",
31
+ "pyyaml>=6.0.3",
32
+ "rich>=15.0.0",
33
+ "typer>=0.27.3",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://bhuwanjoshi-01.github.io/worktree-shield/"
38
+ Documentation = "https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/docs/cli.md"
39
+ Source = "https://github.com/BhuwanJoshi-01/worktree-shield"
40
+ Issues = "https://github.com/BhuwanJoshi-01/worktree-shield/issues"
41
+ Changelog = "https://github.com/BhuwanJoshi-01/worktree-shield/blob/main/CHANGELOG.md"
42
+
43
+ [project.scripts]
44
+ worktree-shield = "worktree_shield.cli:main"
45
+ wtshield = "worktree_shield.cli:main"
46
+
47
+ [build-system]
48
+ requires = ["uv_build>=0.11.29,<0.12.0"]
49
+ build-backend = "uv_build"
50
+
51
+ [dependency-groups]
52
+ dev = [
53
+ "hypothesis>=6.170.14",
54
+ "jsonschema>=4.26.0",
55
+ "mypy>=2.4.1",
56
+ "pytest>=9.2.0",
57
+ "pytest-cov>=7.1.0",
58
+ "ruff>=0.17.3",
59
+ "types-psutil>=7.2.2.20260906",
60
+ "types-pyyaml>=6.0.12.20261103",
61
+ ]
62
+
63
+ [tool.ruff]
64
+ line-length = 100
65
+ target-version = "py311"
66
+ src = ["src", "tests"]
67
+
68
+ [tool.ruff.lint]
69
+ select = [
70
+ "E", "W", "F", # pycodestyle, pyflakes
71
+ "I", # import order
72
+ "B", # bugbear
73
+ "UP", # pyupgrade
74
+ "SIM", # simplify
75
+ "C4", # comprehensions
76
+ "PTH", # pathlib
77
+ "S", # bandit: subprocesses and secret handling must be deliberate
78
+ "PT", # pytest style
79
+ "RUF",
80
+ ]
81
+
82
+ [tool.ruff.lint.isort]
83
+ known-first-party = ["worktree_shield", "tests"]
84
+
85
+ [tool.ruff.lint.per-file-ignores]
86
+ "tests/**" = [
87
+ "S101", # assert is how pytest works
88
+ "S104", # bind addresses such as 0.0.0.0 are test data, nothing binds them
89
+ "S105", "S106", # fake secrets are the point of the redaction tests
90
+ ]
91
+
92
+ [tool.mypy]
93
+ python_version = "3.11"
94
+ strict = true
95
+ warn_unreachable = true
96
+ files = ["src"]
97
+
98
+ [tool.pytest.ini_options]
99
+ testpaths = ["tests"]
100
+ pythonpath = ["."]
101
+ addopts = ["-ra", "--strict-markers", "--strict-config"]
102
+ xfail_strict = true
103
+
104
+ [tool.coverage.run]
105
+ source = ["worktree_shield"]
106
+ branch = true
107
+
108
+ [tool.coverage.report]
109
+ show_missing = true
110
+ skip_covered = true
@@ -0,0 +1,8 @@
1
+ """Worktree Shield: audit parallel Git worktrees for shared resources."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("worktree-shield")
7
+ except PackageNotFoundError: # imported from a source tree that was never installed
8
+ __version__ = "0+unknown"
@@ -0,0 +1,6 @@
1
+ """Allow ``python -m worktree_shield``."""
2
+
3
+ from worktree_shield.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()