From 535e087129ffd4e916a4fecace85fcfd1b8183c5 Mon Sep 17 00:00:00 2001 From: YuniorGlez Date: Sat, 8 Aug 2026 13:20:15 +0100 Subject: [PATCH] feat: recognize bun.lock as a dependency lock file Bun (bun.sh) is a widely used JS/TS runtime and package manager whose lockfile (bun.lock) pins exact versions like package-lock.json or pnpm-lock.yaml. Repos using Bun were previously scored as having no lock file even though dependencies are fully pinned. Adds bun.lock to the strict lock files list and a unit test covering a Bun-based repository. --- src/agentready/assessors/stub_assessors.py | 1 + tests/unit/test_assessors_stub.py | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/agentready/assessors/stub_assessors.py b/src/agentready/assessors/stub_assessors.py index e6661bba..3cc4f500 100644 --- a/src/agentready/assessors/stub_assessors.py +++ b/src/agentready/assessors/stub_assessors.py @@ -50,6 +50,7 @@ def assess(self, repository: Repository) -> Finding: "package-lock.json", # npm "yarn.lock", # Yarn "pnpm-lock.yaml", # pnpm + "bun.lock", # Bun "poetry.lock", # Poetry "Pipfile.lock", # Pipenv "uv.lock", # uv diff --git a/tests/unit/test_assessors_stub.py b/tests/unit/test_assessors_stub.py index 2854f7da..bfa2d882 100644 --- a/tests/unit/test_assessors_stub.py +++ b/tests/unit/test_assessors_stub.py @@ -225,6 +225,30 @@ def test_multiple_lock_files(self, tmp_path): assert "package-lock.json" in finding.measured_value assert "Cargo.lock" in finding.measured_value + def test_bun_lock_file(self, tmp_path): + """Test that bun.lock is recognized as a valid lock file.""" + subprocess.run(["git", "init"], cwd=tmp_path, capture_output=True, check=True) + + (tmp_path / "bun.lock").write_text("# bun lockfile\n") + + repo = Repository( + path=tmp_path, + name="test-repo", + url=None, + branch="main", + commit_hash="abc123", + languages={"TypeScript": 100}, + total_files=10, + total_lines=100, + ) + + assessor = DependencyPinningAssessor() + finding = assessor.assess(repo) + + assert finding.status == "pass" + assert finding.score == 100.0 + assert "bun.lock" in finding.measured_value + def test_backward_compatibility_alias(self): """Test that LockFilesAssessor is an alias for DependencyPinningAssessor.""" from agentready.assessors.stub_assessors import LockFilesAssessor