codefactory-cli 0.21.0__tar.gz → 0.21.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.
- {codefactory_cli-0.21.0/codefactory_cli.egg-info → codefactory_cli-0.21.1}/PKG-INFO +2 -2
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/README.md +1 -1
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/__init__.py +1 -1
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/skill.py +32 -1
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1/codefactory_cli.egg-info}/PKG-INFO +2 -2
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/pyproject.toml +1 -1
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_release.py +11 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_skill.py +16 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/LICENSE +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/__main__.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/accept.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/__init__.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/generic.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/parallel.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/python.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/python_parse.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/treewalk.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/ts_helper.js +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/analyzers/typescript.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/apple.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/audit.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/baseline.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/brief.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/cache.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/checks.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/cli.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/config.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/coverage.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/deps.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/diff.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/efficiency.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/export.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/flags.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/graph.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/hotspots.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/infra.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/intent.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/layers.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/org.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/owners.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/patch.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/paths.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/plan.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/privacy.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/profile.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/rerank.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/review.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/rules.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/sarif.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/sbom.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/scope.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/security.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/similar.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/skill_template/SKILL.md +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/skill_template/__init__.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/sqlgraph.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/suppress.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/taint.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/trace.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/viewer/__init__.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/viewer/dashboard.html +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/viewer/factory.css +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/viewer/factory.js +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory/viewer/template.html +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory_cli.egg-info/SOURCES.txt +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory_cli.egg-info/dependency_links.txt +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory_cli.egg-info/entry_points.txt +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory_cli.egg-info/requires.txt +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory_cli.egg-info/top_level.txt +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/setup.cfg +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_accept.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_agent.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_apple.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_audit.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_bench.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_cache.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_cli_errors.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_coverage.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_diff.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_efficiency.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_export.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_findings_review.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_generic.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_go_service.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_golden.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_hotspots.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_intent.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_org.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_parallel.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_patch.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_privacy.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_profile.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_public_repos.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_python_scopes.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_review.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_rules.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_sarif.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_scope.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_security.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_security_audit.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_security_audit2.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_shop.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_sql_trace.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_taint.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_typescript.py +0 -0
- {codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/tests/test_workflow.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codefactory-cli
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.1
|
|
4
4
|
Summary: See a codebase as a factory floor, find what's wrong with it (copies, N+1 loops, dead code, import loops, security and reliability problems), and turn it into ranked work.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/dominickkubica/codefactory
|
|
@@ -186,7 +186,7 @@ jobs:
|
|
|
186
186
|
steps:
|
|
187
187
|
- uses: actions/checkout@v4
|
|
188
188
|
with: { fetch-depth: 0 }
|
|
189
|
-
- uses: dominickkubica/codefactory@v0 # follows releases; or pin v0.21.
|
|
189
|
+
- uses: dominickkubica/codefactory@v0 # follows releases; or pin v0.21.1 or a commit SHA
|
|
190
190
|
with: { fail-on: high }
|
|
191
191
|
```
|
|
192
192
|
|
|
@@ -152,7 +152,7 @@ jobs:
|
|
|
152
152
|
steps:
|
|
153
153
|
- uses: actions/checkout@v4
|
|
154
154
|
with: { fetch-depth: 0 }
|
|
155
|
-
- uses: dominickkubica/codefactory@v0 # follows releases; or pin v0.21.
|
|
155
|
+
- uses: dominickkubica/codefactory@v0 # follows releases; or pin v0.21.1 or a commit SHA
|
|
156
156
|
with: { fail-on: high }
|
|
157
157
|
```
|
|
158
158
|
|
|
@@ -171,8 +171,39 @@ def drop_git_install() -> bool:
|
|
|
171
171
|
capture_output=True).returncode == 0 # fmt: skip
|
|
172
172
|
|
|
173
173
|
|
|
174
|
+
def tool_manager(prefix: str | None = None) -> str:
|
|
175
|
+
""" "pipx" or "uv" when codefactory was installed as a tool by one of them (its environment has no pip of its own:
|
|
176
|
+
upgrading has to go through them), else ""."""
|
|
177
|
+
p = Path(prefix or sys.prefix)
|
|
178
|
+
return "pipx" if (p / "pipx_metadata.json").is_file() else "uv" if (p / "uv-receipt.toml").is_file() else ""
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _tool_upgrade(manager: str, source: str) -> tuple[str, str]:
|
|
182
|
+
import shutil
|
|
183
|
+
|
|
184
|
+
exe = shutil.which(manager)
|
|
185
|
+
if manager == "pipx":
|
|
186
|
+
cmd = (
|
|
187
|
+
["upgrade", "codefactory-cli"] if source == SOURCE else ["runpip", "codefactory-cli", "install", "--upgrade", source]
|
|
188
|
+
)
|
|
189
|
+
else:
|
|
190
|
+
cmd = ["tool", "upgrade", "codefactory-cli"] if source == SOURCE else ["tool", "install", "--force", source]
|
|
191
|
+
if not exe:
|
|
192
|
+
raise RuntimeError(f"codefactory was installed with {manager}, which isn't on PATH here: run `{manager} {' '.join(cmd)}`")
|
|
193
|
+
proc = subprocess.run([exe, *cmd], capture_output=True, text=True)
|
|
194
|
+
if proc.returncode != 0:
|
|
195
|
+
raise RuntimeError(f"{manager} couldn't upgrade codefactory:\n{(proc.stderr or proc.stdout).strip()[-1500:]}")
|
|
196
|
+
new = subprocess.run(
|
|
197
|
+
[sys.executable, "-c", "import codefactory; print(codefactory.__version__)"], capture_output=True, text=True
|
|
198
|
+
).stdout.strip()
|
|
199
|
+
return __version__, new or "?"
|
|
200
|
+
|
|
201
|
+
|
|
174
202
|
def update(source: str = SOURCE) -> tuple[str, str]:
|
|
175
|
-
"""Upgrades codefactory
|
|
203
|
+
"""Upgrades codefactory the way it was installed: pipx or uv for a tool install (their environments have no pip),
|
|
204
|
+
else this Python's pip. Returns (old version, new version)."""
|
|
205
|
+
if manager := tool_manager():
|
|
206
|
+
return _tool_upgrade(manager, source)
|
|
176
207
|
pip = [sys.executable, "-m", "pip", "install", "--quiet", "--upgrade"]
|
|
177
208
|
dropped = drop_git_install()
|
|
178
209
|
proc = subprocess.run([*pip, source], capture_output=True, text=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codefactory-cli
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.1
|
|
4
4
|
Summary: See a codebase as a factory floor, find what's wrong with it (copies, N+1 loops, dead code, import loops, security and reliability problems), and turn it into ranked work.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/dominickkubica/codefactory
|
|
@@ -186,7 +186,7 @@ jobs:
|
|
|
186
186
|
steps:
|
|
187
187
|
- uses: actions/checkout@v4
|
|
188
188
|
with: { fetch-depth: 0 }
|
|
189
|
-
- uses: dominickkubica/codefactory@v0 # follows releases; or pin v0.21.
|
|
189
|
+
- uses: dominickkubica/codefactory@v0 # follows releases; or pin v0.21.1 or a commit SHA
|
|
190
190
|
with: { fail-on: high }
|
|
191
191
|
```
|
|
192
192
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codefactory-cli"
|
|
7
|
-
version = "0.21.
|
|
7
|
+
version = "0.21.1"
|
|
8
8
|
description = "See a codebase as a factory floor, find what's wrong with it (copies, N+1 loops, dead code, import loops, security and reliability problems), and turn it into ranked work."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -26,6 +26,17 @@ def _portable(sarif: dict) -> dict:
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class SbomTest(unittest.TestCase):
|
|
29
|
+
def test_versions_match(self):
|
|
30
|
+
# a version bump on main is a release now: the package and its code must agree before it goes out
|
|
31
|
+
import tomllib
|
|
32
|
+
|
|
33
|
+
from codefactory import __version__
|
|
34
|
+
|
|
35
|
+
root = Path(__file__).parent.parent
|
|
36
|
+
version = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
|
|
37
|
+
self.assertEqual(__version__, version)
|
|
38
|
+
self.assertIn(f"## {version} ·", (root / "CHANGELOG.md").read_text(encoding="utf-8")) # its release notes
|
|
39
|
+
|
|
29
40
|
def setUp(self):
|
|
30
41
|
self.root = Path(tempfile.mkdtemp())
|
|
31
42
|
(self.root / "package-lock.json").write_text(json.dumps({"lockfileVersion": 3, "packages": {
|
|
@@ -97,6 +97,22 @@ class SkillTest(unittest.TestCase):
|
|
|
97
97
|
self.assertEqual(calls.count("codefactory skill ."), 2)
|
|
98
98
|
self.assertIn("9.9.9", proc.stdout)
|
|
99
99
|
|
|
100
|
+
def test_update_goes_through_pipx_or_uv_for_a_tool_install(self):
|
|
101
|
+
# pipx and uv tool environments have no pip: `python -m pip install --upgrade` failed in them
|
|
102
|
+
prefix = Path(self.tmp.name) / "venv"
|
|
103
|
+
prefix.mkdir()
|
|
104
|
+
self.assertEqual(skill.tool_manager(str(prefix)), "")
|
|
105
|
+
(prefix / "pipx_metadata.json").write_text("{}", encoding="utf-8")
|
|
106
|
+
self.assertEqual(skill.tool_manager(str(prefix)), "pipx")
|
|
107
|
+
ok = subprocess.CompletedProcess([], 0, stdout="9.9.9\n", stderr="")
|
|
108
|
+
with mock.patch.object(skill, "tool_manager", return_value="pipx"), \
|
|
109
|
+
mock.patch("shutil.which", return_value="/usr/bin/pipx"), mock.patch("subprocess.run", return_value=ok) as run: # fmt: skip
|
|
110
|
+
self.assertEqual(skill.update(), (__version__, "9.9.9"))
|
|
111
|
+
self.assertEqual(run.call_args_list[0].args[0], ["/usr/bin/pipx", "upgrade", "codefactory-cli"])
|
|
112
|
+
with mock.patch.object(skill, "tool_manager", return_value="uv"), mock.patch("shutil.which", return_value=None), \
|
|
113
|
+
self.assertRaisesRegex(RuntimeError, "uv tool upgrade codefactory-cli"): # fmt: skip
|
|
114
|
+
skill.update()
|
|
115
|
+
|
|
100
116
|
def test_update_reports_versions(self):
|
|
101
117
|
ok = subprocess.CompletedProcess([], 0, stdout="9.9.9\n", stderr="")
|
|
102
118
|
with mock.patch("subprocess.run", return_value=ok) as run:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codefactory_cli-0.21.0 → codefactory_cli-0.21.1}/codefactory_cli.egg-info/dependency_links.txt
RENAMED
|
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
|