bmsdna-devtools 0.56.0__tar.gz → 0.57.2__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 (150) hide show
  1. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/PKG-INFO +36 -12
  2. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/README.md +35 -11
  3. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/cli.py +18 -5
  4. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/advisories.py +12 -1
  5. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/cli.py +83 -6
  6. bmsdna_devtools-0.57.2/bmsdna/devtools/deps/cooldown.py +83 -0
  7. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/lockfiles.py +104 -15
  8. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/osv.py +42 -1
  9. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/versions.py +154 -5
  10. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/find_repo.py +188 -67
  11. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/pyproject.toml +1 -1
  12. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/skills/bmsdna-devtools/SKILL.md +5 -3
  13. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_deps.py +90 -0
  14. bmsdna_devtools-0.57.2/tests/test_deps_cooldown.py +90 -0
  15. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_deps_lockfiles.py +88 -0
  16. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_deps_osv.py +31 -2
  17. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_deps_versions.py +29 -0
  18. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_find_repo.py +263 -56
  19. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/uv.lock +1 -1
  20. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/.github/workflows/auto-release.yml +0 -0
  21. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/.github/workflows/python-publish.yml +0 -0
  22. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/.github/workflows/python-test.yml +0 -0
  23. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/.gitignore +0 -0
  24. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/.python-version +0 -0
  25. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/__init__.py +0 -0
  26. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/_api_dump.py +0 -0
  27. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ado_auth.py +0 -0
  28. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ado_issue.py +0 -0
  29. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/agent_mentions.py +0 -0
  30. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/api_usage.py +0 -0
  31. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/app_service_logs.py +0 -0
  32. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/azure_arm.py +0 -0
  33. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/azure_auth.py +0 -0
  34. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/bdt_config.py +0 -0
  35. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/business_user.py +0 -0
  36. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ci_plan.py +0 -0
  37. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ci_plan_env.py +0 -0
  38. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/cli_tools.py +0 -0
  39. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/commit.py +0 -0
  40. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/dead_code.py +0 -0
  41. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/__init__.py +0 -0
  42. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/env_config.py +0 -0
  43. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/env_files.py +0 -0
  44. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/find_injection.py +0 -0
  45. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gh_args.py +0 -0
  46. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gh_issue.py +0 -0
  47. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gh_pr.py +0 -0
  48. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/github_api.py +0 -0
  49. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gitrepo.py +0 -0
  50. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/injection_frontend.py +0 -0
  51. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/injection_python.py +0 -0
  52. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/issue_do.py +0 -0
  53. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/issue_show.py +0 -0
  54. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/issue_watch.py +0 -0
  55. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint.py +0 -0
  56. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_findings.py +0 -0
  57. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_models.py +0 -0
  58. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_sql.py +0 -0
  59. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_sql_files.py +0 -0
  60. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_tooling.py +0 -0
  61. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_typescript.py +0 -0
  62. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/logs.py +0 -0
  63. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_build.py +0 -0
  64. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_cancel.py +0 -0
  65. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_choice.py +0 -0
  66. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_create_args.py +0 -0
  67. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_drift.py +0 -0
  68. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_info.py +0 -0
  69. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_issue_link.py +0 -0
  70. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_labels.py +0 -0
  71. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_markdown.py +0 -0
  72. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_merge_defaults.py +0 -0
  73. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_ref.py +0 -0
  74. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pull.py +0 -0
  75. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/testdb.py +0 -0
  76. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/translate.py +0 -0
  77. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/__init__.py +0 -0
  78. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/cli.py +0 -0
  79. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/pipeline.py +0 -0
  80. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/pricing.py +0 -0
  81. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/report.py +0 -0
  82. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
  83. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
  84. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
  85. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
  86. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
  87. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
  88. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
  89. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/bmsdna/devtools/worktree.py +0 -0
  90. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/justfile +0 -0
  91. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/conftest.py +0 -0
  92. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/fake_github.py +0 -0
  93. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_ado_auth.py +0 -0
  94. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_ado_issue.py +0 -0
  95. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_ado_issue_flow.py +0 -0
  96. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_agent_mentions.py +0 -0
  97. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_api_usage.py +0 -0
  98. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_app_service_logs.py +0 -0
  99. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_azure_arm.py +0 -0
  100. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_bdt_config.py +0 -0
  101. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_business_user.py +0 -0
  102. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_ci_plan.py +0 -0
  103. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_ci_plan_env.py +0 -0
  104. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_cleanup.py +0 -0
  105. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_commit.py +0 -0
  106. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_issue.py +0 -0
  107. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_pr_create.py +0 -0
  108. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_pr_id.py +0 -0
  109. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_pull.py +0 -0
  110. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_tools.py +0 -0
  111. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_cli_version.py +0 -0
  112. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_commit.py +0 -0
  113. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_deps_advisories.py +0 -0
  114. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_env_config.py +0 -0
  115. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_env_files.py +0 -0
  116. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_find_injection.py +0 -0
  117. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_gh_issue.py +0 -0
  118. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_gh_pr.py +0 -0
  119. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_github_api.py +0 -0
  120. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_gitrepo.py +0 -0
  121. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_issue_do.py +0 -0
  122. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_issue_for_me.py +0 -0
  123. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_issue_show.py +0 -0
  124. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_issue_watch.py +0 -0
  125. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_lint.py +0 -0
  126. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_lint_models.py +0 -0
  127. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_lint_sql.py +0 -0
  128. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_lint_sql_files.py +0 -0
  129. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_lint_tooling.py +0 -0
  130. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_lint_typescript.py +0 -0
  131. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_logs.py +0 -0
  132. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_build.py +0 -0
  133. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_build_create_options.py +0 -0
  134. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_build_flow.py +0 -0
  135. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_cancel_build.py +0 -0
  136. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_choice.py +0 -0
  137. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_create_args.py +0 -0
  138. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_description_not_truncated.py +0 -0
  139. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_drift.py +0 -0
  140. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_info.py +0 -0
  141. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_issue_link.py +0 -0
  142. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_labels.py +0 -0
  143. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_markdown.py +0 -0
  144. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pr_merge_defaults.py +0 -0
  145. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_pull.py +0 -0
  146. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_testdb.py +0 -0
  147. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_translate.py +0 -0
  148. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_usage.py +0 -0
  149. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_wait_timeout.py +0 -0
  150. {bmsdna_devtools-0.56.0 → bmsdna_devtools-0.57.2}/tests/test_worktree_clean.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bmsdna-devtools
3
- Version: 0.56.0
3
+ Version: 0.57.2
4
4
  Summary: Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects
5
5
  Requires-Python: >=3.14
6
6
  Requires-Dist: azure-identity>=1.19.0
@@ -709,7 +709,7 @@ those orgs are searched.
709
709
  ## `bdt list-repo`
710
710
 
711
711
  ```bash
712
- bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--fast] [--json] [--pat PAT]
712
+ bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json] [--pat PAT]
713
713
  ```
714
714
 
715
715
  The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
@@ -726,12 +726,23 @@ configured, or with `--local`, it lists the clones under the work dir instead (t
726
726
  - **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
727
727
  first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
728
728
  - **Commit:** the newest commit of the default branch (GitHub / Azure DevOps).
729
- - **Cost:** GitHub needs one extra request per repo for the commit, Azure DevOps two (commit and README); all run concurrently
730
- (about 15 s for ~400 Azure DevOps repos). `--fast` skips them: GitHub then shows only its last push date,
731
- Azure DevOps repos no commit and no description. Repos without commits, or whose commits can't be read, have empty fields.
729
+ - **Disabled repos:** Azure DevOps (and GitHub) repos that are disabled are left out. `--include-disabled` lists them too,
730
+ marked `(DISABLED)` in the description column of the text output and `"disabled": true` in `--json`. A disabled Azure DevOps
731
+ repo has no commit or description (they aren't readable, so they aren't requested). Azure DevOps has no disabled *projects*,
732
+ only disabled repos.
733
+ - **Cost:** GitHub returns descriptions and newest commits in one GraphQL query per 100 repos (about 5 s for 43 repos).
734
+ Azure DevOps needs a commit request per repo, plus README requests for repos that have commits, 16 at a time
735
+ (about 9 s for ~300 repos). `--fast` skips those for Azure DevOps, leaving commit and description empty.
736
+ Repos without commits, or whose commits can't be read, have empty fields.
732
737
  - **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
733
- `project`, `name`, `source` (`ado`/`github`), `url`, `last_commit_id`, `last_commit_date` (ISO 8601),
734
- `last_commit_author`, `description` -- local clones have `name` and `location` instead of `project`/`source`/`url`.
738
+ `project`, `name`, `source` (`ado`/`github`), `disabled`, `git_url` (to clone), `web_url` (to open in the browser),
739
+ `location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
740
+ Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
741
+ `origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
742
+ - **Local clones:** `location` is the path of your clone of that repo under the work dir (found by matching each
743
+ clone's `origin` URL, whether it was cloned via https or ssh), or `null` if it isn't cloned. `--no-local` skips that
744
+ lookup and leaves `location` out of the JSON entirely; the aligned text never shows it. `--local` and `--no-local`
745
+ contradict each other, and `--no-local` needs an org to list.
735
746
 
736
747
  ## `bdt cleanup worktrees` / `bdt cleanup orphaned-dbs` / `bdt cleanup db` / `bdt cleanup worktree`
737
748
 
@@ -1256,17 +1267,21 @@ catch-all, service-to-service endpoints and an external API folder.
1256
1267
  then on only *new* unused routes fail -- and a baseline line whose route has since been deleted, excluded or
1257
1268
  used is reported as `api-route-baseline-stale`, so the list can only shrink.
1258
1269
 
1259
- ## `bdt deps affected` / `bdt deps advisories`
1270
+ ## `bdt deps affected` / `bdt deps advisories` / `bdt deps cooldown`
1260
1271
 
1261
- Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? Both
1262
- commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI) and `bun.lock` (npm)
1263
- below each `--path` (default: the current directory; `node_modules`, virtualenvs, `.git` and `.worktrees` are skipped).
1264
- Git, path, alias and workspace sources can't be matched against an advisory: they are listed as `unsupported`, never skipped.
1272
+ Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? All
1273
+ commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm) and
1274
+ Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`) below each `--path` (default: the
1275
+ current directory; `node_modules`, virtualenvs, `.git`, `.gradle` and `.worktrees` are skipped).
1276
+ Git, path, alias and workspace sources, and Gradle entries without an exact version in the catalog (managed by a BOM, or a
1277
+ range), can't be matched against an advisory: they are listed as `unsupported`, never skipped. A catalog lists the direct
1278
+ dependencies only; transitive ones need Gradle dependency locking (`gradle.lockfile`).
1265
1279
 
1266
1280
  ```bash
1267
1281
  bdt deps affected lodash --version-spec "<4.17.21" --path ~/projects/CCMT2 --path ~/projects/OneSales
1268
1282
  bdt deps advisories --path . # OSV lookup of every locked version, one status per affected package
1269
1283
  bdt deps advisories --json # machine-readable
1284
+ bdt deps cooldown --ecosystem Maven --base origin/dev # CI: no Gradle version added or changed within the cooldown
1270
1285
  ```
1271
1286
 
1272
1287
  `affected PACKAGE` lists the locked versions of one package (PyPI names are normalised, npm names exact; `--ecosystem`
@@ -1274,6 +1289,15 @@ narrows) and marks those matching `--version-spec` (comparators such as `<4.17.2
1274
1289
  none matches, 1 a locked version matches, 2 setup error (no lockfile, unreadable lockfile, bad spec), 3 incomplete (a
1275
1290
  git/path/alias source of that name could not be matched).
1276
1291
 
1292
+ `cooldown` answers "is a locked version younger than the dependency cooldown?" (`--cooldown-days`, default 5). uv
1293
+ (`exclude-newer`) and bun (`minimumReleaseAge`) enforce the cooldown while resolving; Gradle has no such setting and
1294
+ pins exact versions, so this is its check. The release time is the upload time of the POM (`Last-Modified`) on Maven
1295
+ Central, Google Maven or the Gradle plugin portal. `--base REV` looks only at versions the file does not have at `REV`
1296
+ (use the target branch in CI, so an old pin never fails a later pull request); without it every locked version is looked
1297
+ up. `--exempt NAME` (repeatable, `group:artifact` for Maven) lets one package through: the per-invocation exception for a
1298
+ security fix younger than the cooldown, as for uv and bun. Exit 0 none inside the cooldown (or all exempt), 1 a version
1299
+ inside it, 2 setup error, 3 a release time could not be read; a version without a public release time is listed, not failed.
1300
+
1277
1301
  `advisories` queries [OSV](https://osv.dev) (GHSA, PYSEC and the OpenSSF `MAL-` malicious-package advisories) and the
1278
1302
  CISA KEV feed, groups aliases (GHSA = PYSEC = CVE) and reports per locked package one status. The maintenance skill's
1279
1303
  cooldown exception flow (`references/audit.md`) acts on it:
@@ -690,7 +690,7 @@ those orgs are searched.
690
690
  ## `bdt list-repo`
691
691
 
692
692
  ```bash
693
- bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--fast] [--json] [--pat PAT]
693
+ bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json] [--pat PAT]
694
694
  ```
695
695
 
696
696
  The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
@@ -707,12 +707,23 @@ configured, or with `--local`, it lists the clones under the work dir instead (t
707
707
  - **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
708
708
  first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
709
709
  - **Commit:** the newest commit of the default branch (GitHub / Azure DevOps).
710
- - **Cost:** GitHub needs one extra request per repo for the commit, Azure DevOps two (commit and README); all run concurrently
711
- (about 15 s for ~400 Azure DevOps repos). `--fast` skips them: GitHub then shows only its last push date,
712
- Azure DevOps repos no commit and no description. Repos without commits, or whose commits can't be read, have empty fields.
710
+ - **Disabled repos:** Azure DevOps (and GitHub) repos that are disabled are left out. `--include-disabled` lists them too,
711
+ marked `(DISABLED)` in the description column of the text output and `"disabled": true` in `--json`. A disabled Azure DevOps
712
+ repo has no commit or description (they aren't readable, so they aren't requested). Azure DevOps has no disabled *projects*,
713
+ only disabled repos.
714
+ - **Cost:** GitHub returns descriptions and newest commits in one GraphQL query per 100 repos (about 5 s for 43 repos).
715
+ Azure DevOps needs a commit request per repo, plus README requests for repos that have commits, 16 at a time
716
+ (about 9 s for ~300 repos). `--fast` skips those for Azure DevOps, leaving commit and description empty.
717
+ Repos without commits, or whose commits can't be read, have empty fields.
713
718
  - **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
714
- `project`, `name`, `source` (`ado`/`github`), `url`, `last_commit_id`, `last_commit_date` (ISO 8601),
715
- `last_commit_author`, `description` -- local clones have `name` and `location` instead of `project`/`source`/`url`.
719
+ `project`, `name`, `source` (`ado`/`github`), `disabled`, `git_url` (to clone), `web_url` (to open in the browser),
720
+ `location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
721
+ Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
722
+ `origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
723
+ - **Local clones:** `location` is the path of your clone of that repo under the work dir (found by matching each
724
+ clone's `origin` URL, whether it was cloned via https or ssh), or `null` if it isn't cloned. `--no-local` skips that
725
+ lookup and leaves `location` out of the JSON entirely; the aligned text never shows it. `--local` and `--no-local`
726
+ contradict each other, and `--no-local` needs an org to list.
716
727
 
717
728
  ## `bdt cleanup worktrees` / `bdt cleanup orphaned-dbs` / `bdt cleanup db` / `bdt cleanup worktree`
718
729
 
@@ -1237,17 +1248,21 @@ catch-all, service-to-service endpoints and an external API folder.
1237
1248
  then on only *new* unused routes fail -- and a baseline line whose route has since been deleted, excluded or
1238
1249
  used is reported as `api-route-baseline-stale`, so the list can only shrink.
1239
1250
 
1240
- ## `bdt deps affected` / `bdt deps advisories`
1251
+ ## `bdt deps affected` / `bdt deps advisories` / `bdt deps cooldown`
1241
1252
 
1242
- Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? Both
1243
- commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI) and `bun.lock` (npm)
1244
- below each `--path` (default: the current directory; `node_modules`, virtualenvs, `.git` and `.worktrees` are skipped).
1245
- Git, path, alias and workspace sources can't be matched against an advisory: they are listed as `unsupported`, never skipped.
1253
+ Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? All
1254
+ commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm) and
1255
+ Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`) below each `--path` (default: the
1256
+ current directory; `node_modules`, virtualenvs, `.git`, `.gradle` and `.worktrees` are skipped).
1257
+ Git, path, alias and workspace sources, and Gradle entries without an exact version in the catalog (managed by a BOM, or a
1258
+ range), can't be matched against an advisory: they are listed as `unsupported`, never skipped. A catalog lists the direct
1259
+ dependencies only; transitive ones need Gradle dependency locking (`gradle.lockfile`).
1246
1260
 
1247
1261
  ```bash
1248
1262
  bdt deps affected lodash --version-spec "<4.17.21" --path ~/projects/CCMT2 --path ~/projects/OneSales
1249
1263
  bdt deps advisories --path . # OSV lookup of every locked version, one status per affected package
1250
1264
  bdt deps advisories --json # machine-readable
1265
+ bdt deps cooldown --ecosystem Maven --base origin/dev # CI: no Gradle version added or changed within the cooldown
1251
1266
  ```
1252
1267
 
1253
1268
  `affected PACKAGE` lists the locked versions of one package (PyPI names are normalised, npm names exact; `--ecosystem`
@@ -1255,6 +1270,15 @@ narrows) and marks those matching `--version-spec` (comparators such as `<4.17.2
1255
1270
  none matches, 1 a locked version matches, 2 setup error (no lockfile, unreadable lockfile, bad spec), 3 incomplete (a
1256
1271
  git/path/alias source of that name could not be matched).
1257
1272
 
1273
+ `cooldown` answers "is a locked version younger than the dependency cooldown?" (`--cooldown-days`, default 5). uv
1274
+ (`exclude-newer`) and bun (`minimumReleaseAge`) enforce the cooldown while resolving; Gradle has no such setting and
1275
+ pins exact versions, so this is its check. The release time is the upload time of the POM (`Last-Modified`) on Maven
1276
+ Central, Google Maven or the Gradle plugin portal. `--base REV` looks only at versions the file does not have at `REV`
1277
+ (use the target branch in CI, so an old pin never fails a later pull request); without it every locked version is looked
1278
+ up. `--exempt NAME` (repeatable, `group:artifact` for Maven) lets one package through: the per-invocation exception for a
1279
+ security fix younger than the cooldown, as for uv and bun. Exit 0 none inside the cooldown (or all exempt), 1 a version
1280
+ inside it, 2 setup error, 3 a release time could not be read; a version without a public release time is listed, not failed.
1281
+
1258
1282
  `advisories` queries [OSV](https://osv.dev) (GHSA, PYSEC and the OpenSSF `MAL-` malicious-package advisories) and the
1259
1283
  CISA KEV feed, groups aliases (GHSA = PYSEC = CVE) and reports per locked package one status. The maintenance skill's
1260
1284
  cooldown exception flow (`references/audit.md`) acts on it:
@@ -2008,12 +2008,22 @@ def list_repo_cmd(
2008
2008
  github_org: str | None = typer.Option(
2009
2009
  None, "--github-org", envvar=["GITHUB_ORG", "BMS_GITHUB_ORG"], help="GitHub org to list"
2010
2010
  ),
2011
- local: bool = typer.Option(False, "--local", help="List the local clones under --root even if an org is configured"),
2011
+ local: bool = typer.Option(False, "--local", help="List only the local clones under --root, even if an org is configured"),
2012
+ no_local: bool = typer.Option(
2013
+ False,
2014
+ "--no-local",
2015
+ help="Don't look for local clones of the listed repos: --json then has no `location` (otherwise the clone's path, or null if not cloned)",
2016
+ ),
2017
+ include_disabled: bool = typer.Option(
2018
+ False,
2019
+ "--include-disabled",
2020
+ help="Also list disabled repos (left out by default): marked `(DISABLED)` in the text, `\"disabled\": true` in --json",
2021
+ ),
2012
2022
  fast: bool = typer.Option(
2013
2023
  False,
2014
2024
  "--fast",
2015
- help="Skip the extra requests per repo (newest commit; for Azure DevOps also the README). GitHub then shows only "
2016
- "its last push date, Azure DevOps repos no commit and no description",
2025
+ help="Azure DevOps only: skip the commit and README requests per repo, leaving those columns empty "
2026
+ "(GitHub always comes with them, in one query per 100 repos)",
2017
2027
  ),
2018
2028
  as_json: bool = typer.Option(False, "--json", help="Print a JSON array instead of aligned text"),
2019
2029
  pat: str | None = typer.Option(
@@ -2029,9 +2039,12 @@ def list_repo_cmd(
2029
2039
  as `find-repo`); with no org configured, or with --local, the clones under the work dir.
2030
2040
  GitHub supplies its own description. Azure DevOps and local repos have none, so the first sentence of
2031
2041
  the README stands in. The commit is the newest one of the default branch on GitHub / Azure DevOps and of
2032
- any branch in a local clone. --json gives the same data as an array of objects, with full ids and dates.
2042
+ any branch in a local clone. --json gives the same data as an array of objects, with full ids and dates, the
2043
+ git and browser URL, and the path of the local clone (see --no-local).
2033
2044
  """
2034
- find_repo_mod.run_list(root=root, org=org, github_org=github_org, local=local, fast=fast, as_json=as_json, pat=pat)
2045
+ find_repo_mod.run_list(
2046
+ root=root, org=org, github_org=github_org, local=local, no_local=no_local, include_disabled=include_disabled, fast=fast, as_json=as_json, pat=pat
2047
+ )
2035
2048
 
2036
2049
 
2037
2050
  @cleanup_app.command("worktrees")
@@ -287,7 +287,18 @@ def _commands(finding: Finding) -> list[str]:
287
287
  pkg, target = finding.package, finding.target
288
288
  if finding.status not in ("exempt-eligible", "bump") or not target:
289
289
  return []
290
- where = f"cd {pkg.lockfile.parent}"
290
+ project = pkg.lockfile.parent.parent if pkg.lockfile.parent.name == "gradle" else pkg.lockfile.parent
291
+ where = f"cd {project}"
292
+ if pkg.ecosystem == "Maven":
293
+ step = f"{where} && set {pkg.name} to {target} in the Gradle version catalog (gradle/libs.versions.toml)" + (
294
+ ", then `./gradlew dependencies --write-locks`" if pkg.lockfile.name == "gradle.lockfile" else ""
295
+ )
296
+ if finding.status == "bump":
297
+ return [step]
298
+ return [
299
+ step,
300
+ f"{where} && bdt deps cooldown --exempt {pkg.name} # Gradle has no cooldown setting: pass the exception here",
301
+ ]
291
302
  if pkg.ecosystem == "PyPI":
292
303
  if finding.status == "bump":
293
304
  return [f"{where} && uv lock --upgrade-package {pkg.name} && uv sync"]
@@ -11,20 +11,21 @@ from typing import Annotated
11
11
  import typer
12
12
 
13
13
  from .advisories import DEFAULT_COOLDOWN_DAYS, ScanResult, scan
14
- from .lockfiles import LockfileContent, LockfileError, find_lockfiles, read_lockfile
14
+ from .cooldown import CooldownResult, changed_packages, check
15
+ from .lockfiles import LockedPackage, LockfileContent, LockfileError, Unsupported, find_lockfiles, read_lockfile
15
16
  from .osv import DataError, OsvClient
16
17
  from .versions import ECOSYSTEMS, VersionError, normalize_name, spec_matches
17
18
 
18
19
  deps_app = typer.Typer(
19
20
  name="deps",
20
- help="Which locked dependencies (uv.lock, bun.lock) a security advisory or supply chain incident touches",
21
+ help="Which locked dependencies (uv.lock, bun.lock, Gradle) a security advisory or supply chain incident touches",
21
22
  )
22
23
 
23
24
  PathOption = Annotated[
24
25
  list[Path] | None,
25
26
  typer.Option(
26
27
  "--path",
27
- help="Directory (or lockfile) to scan, repeatable; every uv.lock/bun.lock below it. Default: the current directory.",
28
+ help="Directory (or lockfile) to scan, repeatable; every uv.lock, bun.lock, gradle.lockfile and gradle/*.versions.toml below it. Default: the current directory.",
28
29
  ),
29
30
  ]
30
31
  EXIT_FOUND, EXIT_SETUP, EXIT_INCOMPLETE = 1, 2, 3
@@ -39,7 +40,7 @@ def _read_all(paths: list[Path] | None) -> list[LockfileContent]:
39
40
  try:
40
41
  lockfiles = find_lockfiles(roots)
41
42
  if not lockfiles:
42
- typer.echo("bdt deps: no uv.lock or bun.lock found", err=True)
43
+ typer.echo("bdt deps: no uv.lock, bun.lock, gradle.lockfile or Gradle version catalog found", err=True)
43
44
  raise typer.Exit(EXIT_SETUP)
44
45
  return [read_lockfile(p) for p in lockfiles]
45
46
  except LockfileError as exc:
@@ -57,7 +58,9 @@ def affected(
57
58
  help='Affected versions, comparators like "<4.17.21" or ">=1.0,<2" (comma = and). Default: any version.',
58
59
  ),
59
60
  ] = None,
60
- ecosystem: Annotated[str | None, typer.Option("--ecosystem", help="PyPI or npm. Default: both.")] = None,
61
+ ecosystem: Annotated[
62
+ str | None, typer.Option("--ecosystem", help="PyPI, npm or Maven (Gradle). Default: all.")
63
+ ] = None,
61
64
  path: PathOption = None,
62
65
  ) -> None:
63
66
  """Locked versions of PACKAGE in every lockfile below --path. Exit 0 none matches, 1 a locked version matches,
@@ -131,7 +134,7 @@ def advisories(
131
134
  ] = DEFAULT_COOLDOWN_DAYS,
132
135
  as_json: Annotated[bool, typer.Option("--json", help="Machine-readable output.")] = False,
133
136
  ) -> None:
134
- """OSV advisories for every locked PyPI/npm version below --path, with a status each (malicious, needs-triage, no-fix,
137
+ """OSV advisories for every locked PyPI/npm/Maven version below --path, with a status each (malicious, needs-triage, no-fix,
135
138
  blocked, exempt-eligible, bump, informational; see the maintenance skill, audit.md). Fails closed: if OSV, the CISA KEV
136
139
  feed or a record can't be read the exit code is 3 and nothing is reported as clean. Exit 0 no affected locked version,
137
140
  1 affected, 2 setup error, 3 incomplete. Never edits anything; other lockfile sources are listed as unsupported."""
@@ -149,3 +152,77 @@ def advisories(
149
152
  if result.incomplete:
150
153
  raise typer.Exit(EXIT_INCOMPLETE)
151
154
  raise typer.Exit(EXIT_FOUND if result.findings else 0)
155
+
156
+
157
+ def _render_cooldown(result: CooldownResult, cooldown_days: float) -> str:
158
+ lines = [
159
+ f"INSIDE {item.package.lockfile}: {item.package.name} {item.package.version} released {item.released:%Y-%m-%d %H:%M} UTC, {item.age_days} days old (cooldown {cooldown_days:g})"
160
+ for item in result.young
161
+ ]
162
+ lines += [
163
+ f"exempt {item.package.lockfile}: {item.package.name} {item.package.version} is {item.age_days} days old"
164
+ for item in result.exempt
165
+ ]
166
+ lines += [
167
+ f"unknown {pkg.lockfile}: {pkg.name} {pkg.version}: no public release time (private or unlisted)"
168
+ for pkg in result.unknown
169
+ ]
170
+ lines += [f"[unsupported] {item.name}: {item.reason} {item.lockfile}" for item in result.unsupported]
171
+ lines += [f"[incomplete] {reason}" for reason in result.incomplete]
172
+ return "\n".join(lines)
173
+
174
+
175
+ @deps_app.command("cooldown")
176
+ def cooldown(
177
+ path: PathOption = None,
178
+ cooldown_days: Annotated[
179
+ float, typer.Option("--cooldown-days", help="The project's dependency cooldown (see the maintenance skill).")
180
+ ] = DEFAULT_COOLDOWN_DAYS,
181
+ exempt: Annotated[
182
+ list[str] | None,
183
+ typer.Option(
184
+ "--exempt", help="Package (exact name, `group:artifact` for Maven) allowed inside the cooldown. Repeatable."
185
+ ),
186
+ ] = None,
187
+ base: Annotated[
188
+ str | None,
189
+ typer.Option(
190
+ "--base",
191
+ help="Only check versions that are not in the same file at this git revision (CI: origin/<target branch>). Without it every locked version is looked up.",
192
+ ),
193
+ ] = None,
194
+ ecosystem: Annotated[
195
+ str | None, typer.Option("--ecosystem", help="PyPI, npm or Maven (Gradle). Default: all.")
196
+ ] = None,
197
+ ) -> None:
198
+ """Locked versions younger than the dependency cooldown. uv and bun enforce it while resolving; Gradle can't, so this is
199
+ its check (`--ecosystem Maven --base origin/dev`). Exit 0 none inside the cooldown (or all exempt), 1 a version inside
200
+ it, 2 setup error, 3 a release time could not be read. Versions without a public release time are listed, not failed."""
201
+ if ecosystem and ecosystem not in ECOSYSTEMS:
202
+ typer.echo(f"bdt deps: --ecosystem must be one of {', '.join(ECOSYSTEMS)}", err=True)
203
+ raise typer.Exit(EXIT_SETUP)
204
+ contents = [c for c in _read_all(path) if not ecosystem or c.ecosystem == ecosystem]
205
+ packages: list[LockedPackage] = []
206
+ unsupported: list[Unsupported] = []
207
+ try:
208
+ for content in contents:
209
+ packages.extend(changed_packages(content, base) if base else content.packages)
210
+ unsupported.extend(content.unsupported)
211
+ except LockfileError as exc:
212
+ typer.echo(f"bdt deps: {exc}", err=True)
213
+ raise typer.Exit(EXIT_SETUP) from exc
214
+ exempt_names = frozenset(exempt or ())
215
+ result = check(
216
+ packages, OsvClient().release_time, cooldown_days=cooldown_days, exempt=exempt_names, now=datetime.now(UTC)
217
+ )
218
+ result.unsupported = unsupported
219
+ report = _render_cooldown(result, cooldown_days)
220
+ if not result.young and not result.incomplete:
221
+ summary = (
222
+ f"bdt deps: none of the {result.checked} checked versions is inside the {cooldown_days:g}-day cooldown"
223
+ )
224
+ report = f"{report}\n{summary}" if report else summary
225
+ typer.echo(report)
226
+ if result.incomplete:
227
+ raise typer.Exit(EXIT_INCOMPLETE)
228
+ raise typer.Exit(EXIT_FOUND if result.young else 0)
@@ -0,0 +1,83 @@
1
+ """`bdt deps cooldown`: is a locked or pinned version younger than the dependency cooldown?
2
+
3
+ uv (`exclude-newer`) and bun (`minimumReleaseAge`) enforce the cooldown while resolving. Gradle has no such setting and
4
+ catalogs pin exact versions, so for Maven the cooldown is checked here, against the version a branch adds or changes.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import subprocess
10
+ from collections.abc import Callable, Iterable
11
+ from dataclasses import dataclass, field
12
+ from datetime import datetime
13
+
14
+ from .lockfiles import LockedPackage, LockfileContent, LockfileError, Unsupported, read_lockfile
15
+ from .osv import DataError
16
+ from .versions import Ecosystem, normalize_name
17
+
18
+
19
+ @dataclass(frozen=True, slots=True)
20
+ class Young:
21
+ package: LockedPackage
22
+ released: datetime
23
+ age_days: float
24
+
25
+
26
+ @dataclass(slots=True)
27
+ class CooldownResult:
28
+ young: list[Young] = field(default_factory=list)
29
+ exempt: list[Young] = field(default_factory=list)
30
+ unknown: list[LockedPackage] = field(default_factory=list) # release time not known (private or unlisted package)
31
+ unsupported: list[Unsupported] = field(default_factory=list) # entries that could not be matched, never skipped
32
+ incomplete: list[str] = field(default_factory=list)
33
+ checked: int = 0
34
+
35
+
36
+ def changed_packages(content: LockfileContent, base: str) -> list[LockedPackage]:
37
+ """The packages of `content` that are not in the same file at git revision `base` (all of them for a new file)."""
38
+ try:
39
+ shown = subprocess.run(
40
+ ["git", "show", f"{base}:./{content.lockfile.name}"],
41
+ cwd=content.lockfile.parent,
42
+ capture_output=True,
43
+ text=True,
44
+ check=False,
45
+ )
46
+ except OSError as exc:
47
+ raise LockfileError(f"cannot run git: {exc}") from exc
48
+ if shown.returncode != 0:
49
+ if "does not exist" in shown.stderr or "exists on disk, but not in" in shown.stderr:
50
+ return list(content.packages)
51
+ raise LockfileError(f"{content.lockfile}: cannot read it at {base}: {shown.stderr.strip()}")
52
+ before = {(p.name, p.version) for p in read_lockfile(content.lockfile, shown.stdout).packages}
53
+ return [p for p in content.packages if (p.name, p.version) not in before]
54
+
55
+
56
+ def check(
57
+ packages: Iterable[LockedPackage],
58
+ release_time: Callable[[Ecosystem, str, str], datetime | None],
59
+ *,
60
+ cooldown_days: float,
61
+ exempt: frozenset[str],
62
+ now: datetime,
63
+ ) -> CooldownResult:
64
+ result = CooldownResult()
65
+ for pkg in packages:
66
+ result.checked += 1
67
+ try:
68
+ released = release_time(pkg.ecosystem, pkg.name, pkg.version)
69
+ except DataError as exc:
70
+ result.incomplete.append(f"release time of {pkg.name} {pkg.version} unavailable: {exc}")
71
+ continue
72
+ if released is None:
73
+ result.unknown.append(pkg)
74
+ continue
75
+ age = round((now - released).total_seconds() / 86400, 1)
76
+ if age >= cooldown_days:
77
+ continue
78
+ item = Young(pkg, released, age)
79
+ if normalize_name(pkg.ecosystem, pkg.name) in exempt or pkg.name in exempt:
80
+ result.exempt.append(item)
81
+ else:
82
+ result.young.append(item)
83
+ return result
@@ -1,7 +1,7 @@
1
- """Read `uv.lock` (PyPI) and `bun.lock` (npm) into `LockedPackage`s.
1
+ """Read `uv.lock` (PyPI), `bun.lock` (npm), `gradle.lockfile` and Gradle version catalogs (Maven) into `LockedPackage`s.
2
2
 
3
- Only registry packages are returned; git, path, editable and workspace sources are reported as `Unsupported` so a
4
- scan never claims to have looked at a dependency it can't match against an advisory.
3
+ Only registry packages are returned; git, path, editable and workspace sources (and Gradle versions a catalog does not pin)
4
+ are reported as `Unsupported` so a scan never claims to have looked at a dependency it can't match against an advisory.
5
5
  """
6
6
 
7
7
  from __future__ import annotations
@@ -17,8 +17,13 @@ from typing import Any, cast
17
17
 
18
18
  from .versions import Ecosystem, normalize_name
19
19
 
20
- LOCKFILE_NAMES = {"uv.lock": "PyPI", "bun.lock": "npm"}
21
- _SKIP_DIRS = frozenset({"node_modules", ".venv", "venv", ".git", ".worktrees", "__pycache__", ".tox"})
20
+ LOCKFILE_NAMES = {"uv.lock": "PyPI", "bun.lock": "npm", "gradle.lockfile": "Maven"}
21
+ _SKIP_DIRS = frozenset({"node_modules", ".venv", "venv", ".git", ".worktrees", "__pycache__", ".tox", ".gradle"})
22
+
23
+
24
+ def is_lockfile(path: Path) -> bool:
25
+ """A lockfile by name, or a Gradle version catalog (`gradle/*.versions.toml`: the pins of a project without locking)."""
26
+ return path.name in LOCKFILE_NAMES or (path.name.endswith(".versions.toml") and path.parent.name == "gradle")
22
27
 
23
28
 
24
29
  class LockfileError(ValueError):
@@ -51,27 +56,34 @@ class LockfileContent:
51
56
 
52
57
 
53
58
  def find_lockfiles(roots: Iterable[Path]) -> list[Path]:
54
- """Every `uv.lock` / `bun.lock` below the roots; `node_modules`, virtualenvs, `.git` and `.worktrees` are not entered
55
- (a root that itself lives inside one is still scanned)."""
59
+ """Every `uv.lock` / `bun.lock` / `gradle.lockfile` / `gradle/*.versions.toml` below the roots; `node_modules`,
60
+ virtualenvs, `.git`, `.gradle` and `.worktrees` are not entered (a root that itself lives inside one is still scanned)."""
56
61
  found: list[Path] = []
57
62
  errors: list[str] = []
58
63
  for root in roots:
59
- if root.is_file() and root.name in LOCKFILE_NAMES:
64
+ if root.is_file() and is_lockfile(root):
60
65
  found.append(root)
61
66
  continue
62
67
  for dirpath, dirnames, filenames in os.walk(
63
68
  root, onerror=lambda exc: errors.append(f"{exc.filename}: {exc.strerror}")
64
69
  ):
65
70
  dirnames[:] = sorted(d for d in dirnames if d not in _SKIP_DIRS)
66
- found.extend(Path(dirpath) / name for name in sorted(filenames) if name in LOCKFILE_NAMES)
71
+ found.extend(Path(dirpath) / name for name in sorted(filenames) if is_lockfile(Path(dirpath) / name))
67
72
  if errors: # an unreadable directory may hide a lockfile: the scan is incomplete, not clean
68
73
  raise LockfileError(f"cannot read directory ({'; '.join(errors)})")
69
74
  return sorted(dict.fromkeys(p.resolve() for p in found))
70
75
 
71
76
 
72
- def read_lockfile(path: Path) -> LockfileContent:
77
+ def read_lockfile(path: Path, text: str | None = None) -> LockfileContent:
78
+ """Parse the lockfile at `path`; `text` is its content when it was not read from disk (an older git revision)."""
73
79
  try:
74
- return read_uv_lock(path) if path.name == "uv.lock" else read_bun_lock(path)
80
+ if path.name == "uv.lock":
81
+ return read_uv_lock(path, text)
82
+ if path.name == "gradle.lockfile":
83
+ return read_gradle_lockfile(path, text)
84
+ if path.name.endswith(".versions.toml"):
85
+ return read_gradle_catalog(path, text)
86
+ return read_bun_lock(path, text)
75
87
  except (
76
88
  OSError,
77
89
  tomllib.TOMLDecodeError,
@@ -86,8 +98,8 @@ def read_lockfile(path: Path) -> LockfileContent:
86
98
  # ── uv.lock ──────────────────────────────────────────────────────────────────────────────────────────────────────
87
99
 
88
100
 
89
- def read_uv_lock(path: Path) -> LockfileContent:
90
- data = tomllib.loads(path.read_text(encoding="utf-8"))
101
+ def read_uv_lock(path: Path, text: str | None = None) -> LockfileContent:
102
+ data = tomllib.loads(text if text is not None else path.read_text(encoding="utf-8"))
91
103
  if not isinstance(data.get("package"), list) or not data["package"]:
92
104
  raise ValueError("no [[package]] entries: not a uv lockfile")
93
105
  content = LockfileContent(path, "PyPI")
@@ -159,8 +171,8 @@ def loads_jsonc(text: str) -> object:
159
171
  return json.loads(cleaned)
160
172
 
161
173
 
162
- def read_bun_lock(path: Path) -> LockfileContent:
163
- data = loads_jsonc(path.read_text(encoding="utf-8"))
174
+ def read_bun_lock(path: Path, text: str | None = None) -> LockfileContent:
175
+ data = loads_jsonc(text if text is not None else path.read_text(encoding="utf-8"))
164
176
  if (
165
177
  not isinstance(data, dict)
166
178
  or not isinstance(data.get("packages"), dict)
@@ -208,3 +220,80 @@ def read_bun_lock(path: Path) -> LockfileContent:
208
220
  )
209
221
  )
210
222
  return content
223
+
224
+
225
+ # ── Gradle: gradle.lockfile and version catalogs ─────────────────────────────────────────────────────────────────
226
+
227
+ _GRADLE_RANGE_RE = re.compile(r"^[\[(]|[\])]$|\+$|^latest\.")
228
+
229
+
230
+ def _catalog_version(spec: object, versions: dict[str, Any]) -> tuple[str | None, str]:
231
+ """The exact version a catalog entry pins, or None and the reason it can't be matched."""
232
+ if isinstance(spec, dict):
233
+ table = cast("dict[str, Any]", spec)
234
+ if "ref" in table:
235
+ return _catalog_version(versions.get(table["ref"]), versions)
236
+ spec = table.get("strictly") or table.get("require") or table.get("prefer")
237
+ if not isinstance(spec, str) or not spec:
238
+ return (None, "no version in the catalog (managed by a BOM or platform, or by the build script)")
239
+ if _GRADLE_RANGE_RE.search(spec):
240
+ return (None, f"version {spec!r} is a range or dynamic selector, not an exact version")
241
+ return spec, ""
242
+
243
+
244
+ def read_gradle_catalog(path: Path, text: str | None = None) -> LockfileContent:
245
+ """`gradle/libs.versions.toml`: libraries and plugins with their pinned versions. Direct dependencies only (transitive
246
+ ones need Gradle dependency locking); entries without a version are `Unsupported`."""
247
+ data = tomllib.loads(text if text is not None else path.read_text(encoding="utf-8"))
248
+ if not isinstance(data.get("libraries"), dict) and not isinstance(data.get("plugins"), dict):
249
+ raise ValueError("no [libraries] or [plugins] table: not a Gradle version catalog")
250
+ versions = cast("dict[str, Any]", data.get("versions") or {})
251
+ content = LockfileContent(path, "Maven")
252
+ seen: set[tuple[str, str]] = set()
253
+
254
+ def add(name: str, spec: object) -> None:
255
+ version, reason = _catalog_version(spec, versions)
256
+ if version is None:
257
+ content.unsupported.append(Unsupported(path, name, reason))
258
+ elif (name, version) not in seen:
259
+ seen.add((name, version))
260
+ content.packages.append(LockedPackage("Maven", name, version, True, path))
261
+
262
+ for entry in (data.get("libraries") or {}).values():
263
+ if isinstance(entry, str):
264
+ parts = entry.split(":")
265
+ name, spec = ":".join(parts[:2]), (parts[2] if len(parts) > 2 else None)
266
+ else:
267
+ module = entry.get("module") or f"{entry.get('group', '')}:{entry.get('name', '')}"
268
+ name, spec = module, entry.get("version")
269
+ if name.count(":") != 1 or not all(name.split(":")):
270
+ raise ValueError(f"cannot read library coordinates {name!r}")
271
+ add(name, spec)
272
+ for entry in (data.get("plugins") or {}).values():
273
+ if isinstance(entry, str):
274
+ plugin_id, _, spec = entry.partition(":")
275
+ else:
276
+ plugin_id, spec = entry["id"], entry.get("version")
277
+ add(f"{plugin_id}:{plugin_id}.gradle.plugin", spec) # the plugin marker artifact
278
+ return content
279
+
280
+
281
+ def read_gradle_lockfile(path: Path, text: str | None = None) -> LockfileContent:
282
+ """`gradle.lockfile` (dependency locking): one `group:artifact:version=configuration,...` line per resolved module."""
283
+ direct: set[str] = set()
284
+ for catalog in (path.parent / "gradle").glob("*.versions.toml") if (path.parent / "gradle").is_dir() else ():
285
+ direct.update(p.name for p in read_gradle_catalog(catalog).packages)
286
+ content = LockfileContent(path, "Maven")
287
+ seen: set[tuple[str, str]] = set()
288
+ for raw in (text if text is not None else path.read_text(encoding="utf-8")).splitlines():
289
+ line = raw.strip()
290
+ if not line or line.startswith("#") or line.startswith("empty="):
291
+ continue
292
+ coordinates = line.partition("=")[0].split(":")
293
+ if len(coordinates) != 3 or not all(coordinates):
294
+ raise ValueError(f"cannot read line {line!r}")
295
+ name, version = ":".join(coordinates[:2]), coordinates[2]
296
+ if (name, version) not in seen:
297
+ seen.add((name, version))
298
+ content.packages.append(LockedPackage("Maven", name, version, name in direct, path))
299
+ return content