bmsdna-devtools 1.4.0__tar.gz → 1.5.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.
Files changed (156) hide show
  1. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/PKG-INFO +16 -8
  2. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/README.md +15 -7
  3. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/ci_plan.py +15 -1
  4. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/deps/__init__.py +2 -1
  5. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/deps/advisories.py +34 -5
  6. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/deps/cli.py +18 -10
  7. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/deps/cooldown.py +4 -2
  8. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/deps/lockfiles.py +84 -5
  9. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/deps/osv.py +34 -1
  10. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/deps/versions.py +56 -9
  11. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/pyproject.toml +1 -1
  12. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_ci_plan.py +16 -0
  13. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_deps_advisories.py +61 -0
  14. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_deps_lockfiles.py +120 -0
  15. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_deps_osv.py +31 -0
  16. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_deps_versions.py +32 -0
  17. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/uv.lock +1 -1
  18. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/.github/workflows/auto-release.yml +0 -0
  19. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/.github/workflows/python-publish.yml +0 -0
  20. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/.github/workflows/python-test.yml +0 -0
  21. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/.gitignore +0 -0
  22. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/.python-version +0 -0
  23. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/__init__.py +0 -0
  24. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/_api_dump.py +0 -0
  25. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/ado_auth.py +0 -0
  26. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/ado_issue.py +0 -0
  27. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/agent_mentions.py +0 -0
  28. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/api_usage.py +0 -0
  29. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/app_service_logs.py +0 -0
  30. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/azure_arm.py +0 -0
  31. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/azure_auth.py +0 -0
  32. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/bdt_config.py +0 -0
  33. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/business_user.py +0 -0
  34. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/ci_plan_env.py +0 -0
  35. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/cleanup_scan.py +0 -0
  36. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/cli.py +0 -0
  37. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/cli_tools.py +0 -0
  38. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/commit.py +0 -0
  39. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/dead_code.py +0 -0
  40. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/env_config.py +0 -0
  41. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/env_files.py +0 -0
  42. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/find_injection.py +0 -0
  43. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/find_repo.py +0 -0
  44. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/gh_args.py +0 -0
  45. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/gh_issue.py +0 -0
  46. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/gh_pr.py +0 -0
  47. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/github_api.py +0 -0
  48. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/gitrepo.py +0 -0
  49. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/injection_frontend.py +0 -0
  50. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/injection_python.py +0 -0
  51. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/issue_do.py +0 -0
  52. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/issue_show.py +0 -0
  53. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/issue_watch.py +0 -0
  54. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/lint.py +0 -0
  55. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/lint_findings.py +0 -0
  56. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/lint_models.py +0 -0
  57. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/lint_sql.py +0 -0
  58. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/lint_sql_files.py +0 -0
  59. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/lint_tooling.py +0 -0
  60. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/lint_typescript.py +0 -0
  61. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/logs.py +0 -0
  62. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_build.py +0 -0
  63. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_cancel.py +0 -0
  64. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_choice.py +0 -0
  65. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_create_args.py +0 -0
  66. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_drift.py +0 -0
  67. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_info.py +0 -0
  68. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_issue_link.py +0 -0
  69. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_labels.py +0 -0
  70. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_list.py +0 -0
  71. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_markdown.py +0 -0
  72. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_merge_defaults.py +0 -0
  73. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pr_ref.py +0 -0
  74. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/pull.py +0 -0
  75. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/testdb.py +0 -0
  76. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/translate.py +0 -0
  77. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/__init__.py +0 -0
  78. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/cli.py +0 -0
  79. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/pipeline.py +0 -0
  80. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/pricing.py +0 -0
  81. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/report.py +0 -0
  82. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
  83. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
  84. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
  85. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
  86. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
  87. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
  88. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
  89. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/bmsdna/devtools/worktree.py +0 -0
  90. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/justfile +0 -0
  91. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/prek.toml +0 -0
  92. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/skills/bmsdna-devtools/SKILL.md +0 -0
  93. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/conftest.py +0 -0
  94. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/fake_github.py +0 -0
  95. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_ado_auth.py +0 -0
  96. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_ado_issue.py +0 -0
  97. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_ado_issue_flow.py +0 -0
  98. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_agent_mentions.py +0 -0
  99. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_api_usage.py +0 -0
  100. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_app_service_logs.py +0 -0
  101. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_azure_arm.py +0 -0
  102. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_bdt_config.py +0 -0
  103. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_business_user.py +0 -0
  104. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_ci_plan_env.py +0 -0
  105. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cleanup_scan.py +0 -0
  106. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_cleanup.py +0 -0
  107. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_commit.py +0 -0
  108. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_deps.py +0 -0
  109. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_issue.py +0 -0
  110. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_pr_create.py +0 -0
  111. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_pr_id.py +0 -0
  112. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_pull.py +0 -0
  113. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_tools.py +0 -0
  114. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_cli_version.py +0 -0
  115. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_commit.py +0 -0
  116. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_deps_cooldown.py +0 -0
  117. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_env_config.py +0 -0
  118. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_env_files.py +0 -0
  119. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_find_injection.py +0 -0
  120. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_find_repo.py +0 -0
  121. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_gh_issue.py +0 -0
  122. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_gh_pr.py +0 -0
  123. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_github_api.py +0 -0
  124. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_gitrepo.py +0 -0
  125. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_issue_do.py +0 -0
  126. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_issue_for_me.py +0 -0
  127. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_issue_show.py +0 -0
  128. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_issue_watch.py +0 -0
  129. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_lint.py +0 -0
  130. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_lint_models.py +0 -0
  131. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_lint_sql.py +0 -0
  132. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_lint_sql_files.py +0 -0
  133. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_lint_tooling.py +0 -0
  134. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_lint_typescript.py +0 -0
  135. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_logs.py +0 -0
  136. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_build.py +0 -0
  137. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_build_create_options.py +0 -0
  138. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_build_flow.py +0 -0
  139. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_cancel_build.py +0 -0
  140. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_choice.py +0 -0
  141. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_create_args.py +0 -0
  142. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_description_not_truncated.py +0 -0
  143. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_drift.py +0 -0
  144. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_info.py +0 -0
  145. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_issue_link.py +0 -0
  146. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_labels.py +0 -0
  147. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_list.py +0 -0
  148. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_markdown.py +0 -0
  149. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pr_merge_defaults.py +0 -0
  150. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_pull.py +0 -0
  151. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_testdb.py +0 -0
  152. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_translate.py +0 -0
  153. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_usage.py +0 -0
  154. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_wait_timeout.py +0 -0
  155. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_worktree_clean.py +0 -0
  156. {bmsdna_devtools-1.4.0 → bmsdna_devtools-1.5.1}/tests/test_worktree_create.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bmsdna-devtools
3
- Version: 1.4.0
3
+ Version: 1.5.1
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
@@ -980,6 +980,7 @@ the `branching-strategy` skill). Add the table to pyproject.toml (an empty one s
980
980
  [tool.bdt.ci.plan]
981
981
  on_missing = "infer" # PR without a usable label: infer from the changed files (default) or "fail"
982
982
  non_code = ["docs/**", "*.md"] # files no test reads or ships; explicit per repo (full-match globs: `*.md` = root only, `**/*.md` = every folder)
983
+ # the `bdt translate` source file (`[tool.bdt.translate] file`, default translations.toml) always counts too
983
984
 
984
985
  [tool.bdt.ci.plan.tiers.unit] # default tiers: unit = tests/unit, e2e = tests/e2e (a tier whose folder is missing is skipped)
985
986
  dir = "tests/unit" # areas = sub-folders with tests (test_*.py / *_test.py); `route_planning` <-> `test-route-planning`
@@ -1313,9 +1314,12 @@ used is reported as `api-route-baseline-stale`, so the list can only shrink.
1313
1314
  ## `bdt deps affected` / `bdt deps advisories` / `bdt deps cooldown`
1314
1315
 
1315
1316
  Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? All
1316
- commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm) and
1317
- Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`) below each `--path` (default: the
1318
- current directory; `node_modules`, virtualenvs, `.git`, `.gradle` and `.worktrees` are skipped).
1317
+ commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm),
1318
+ Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`), `Cargo.lock` (crates.io) and NuGet's
1319
+ `packages.lock.json` below each `--path` (default: the current directory; `node_modules`, virtualenvs, `.git`, `.gradle`,
1320
+ Rust `target` and `.worktrees` are skipped). Cargo and NuGet are read from the lockfile only: the version ranges live in
1321
+ `Cargo.toml` / the project files, so a `blocked` status (fix outside the declared range) is not computed for them. A NuGet
1322
+ project needs `RestorePackagesWithLockFile` to have a `packages.lock.json`.
1319
1323
  Git, path, alias and workspace sources, and Gradle entries without an exact version in the catalog (managed by a BOM, or a
1320
1324
  range), can't be matched against an advisory: they are listed as `unsupported`, never skipped. A catalog lists the direct
1321
1325
  dependencies only; transitive ones need Gradle dependency locking (`gradle.lockfile`).
@@ -1325,6 +1329,7 @@ bdt deps affected lodash --version-spec "<4.17.21" --path ~/projects/CCMT2 --pat
1325
1329
  bdt deps advisories --path . # OSV lookup of every locked version, one status per affected package
1326
1330
  bdt deps advisories --json # machine-readable
1327
1331
  bdt deps cooldown --ecosystem Maven --base origin/dev # CI: no Gradle version added or changed within the cooldown
1332
+ bdt deps cooldown --ecosystem NuGet --base origin/main # same for packages.lock.json; Cargo >= 1.100 enforces it itself
1328
1333
  ```
1329
1334
 
1330
1335
  `affected PACKAGE` lists the locked versions of one package (PyPI names are normalised, npm names exact; `--ecosystem`
@@ -1333,9 +1338,12 @@ none matches, 1 a locked version matches, 2 setup error (no lockfile, unreadable
1333
1338
  git/path/alias source of that name could not be matched).
1334
1339
 
1335
1340
  `cooldown` answers "is a locked version younger than the dependency cooldown?" (`--cooldown-days`, default 5). uv
1336
- (`exclude-newer`) and bun (`minimumReleaseAge`) enforce the cooldown while resolving; Gradle has no such setting and
1337
- pins exact versions, so this is its check. The release time is the upload time of the POM (`Last-Modified`) on Maven
1338
- Central, Google Maven or the Gradle plugin portal. `--base REV` looks only at versions the file does not have at `REV`
1341
+ (`exclude-newer`), bun (`minimumReleaseAge`) and Cargo >= 1.100 (`[registry] global-min-publish-age = "5 days"` in
1342
+ `.cargo/config.toml`) enforce the cooldown while resolving; Gradle has no such setting and NuGet's (`minPublishAgeHours`
1343
+ per source in `nuget.config`) does not gate a pinned restore, so this is their check. It also works for a Cargo project
1344
+ on an older toolchain. The release time is the upload time of the POM (`Last-Modified`) on Maven Central,
1345
+ Google Maven or the Gradle plugin portal, `created_at` on crates.io, and `published` on nuget.org (an unlisted package,
1346
+ which nuget.org dates 1900, counts as unknown). `--base REV` looks only at versions the file does not have at `REV`
1339
1347
  (use the target branch in CI, so an old pin never fails a later pull request); without it every locked version is looked
1340
1348
  up. `--exempt NAME` (repeatable, `group:artifact` for Maven) lets one package through: the per-invocation exception for a
1341
1349
  security fix younger than the cooldown, as for uv and bun. Exit 0 none inside the cooldown (or all exempt), 1 a version
@@ -1357,7 +1365,7 @@ cooldown exception flow (`references/audit.md`) acts on it:
1357
1365
 
1358
1366
  The target version is the lowest one the advisory data shows to be outside every affected range of the urgent
1359
1367
  advisories (all of them when none is urgent), never "latest". Lower-severity advisories that need a newer version stay open until a normal bump, and the finding names them. `next:` lines give the per-invocation commands. Unsupported sources are listed but don't change the exit code. The fix's age
1360
- comes from the registry (PyPI: youngest file; npm: `time[version]`); `--cooldown-days` (default 5) is the project's
1368
+ comes from the registry (PyPI: youngest file; npm: `time[version]`; crates.io and NuGet: the release date above); `--cooldown-days` (default 5) is the project's
1361
1369
  cooldown. Compatibility with the parents' ranges of a *transitive* dependency isn't known here: re-run after the bump.
1362
1370
 
1363
1371
  It fails closed: OSV, KEV or an advisory record that can't be read is reported as `incomplete` with exit 3, never as
@@ -961,6 +961,7 @@ the `branching-strategy` skill). Add the table to pyproject.toml (an empty one s
961
961
  [tool.bdt.ci.plan]
962
962
  on_missing = "infer" # PR without a usable label: infer from the changed files (default) or "fail"
963
963
  non_code = ["docs/**", "*.md"] # files no test reads or ships; explicit per repo (full-match globs: `*.md` = root only, `**/*.md` = every folder)
964
+ # the `bdt translate` source file (`[tool.bdt.translate] file`, default translations.toml) always counts too
964
965
 
965
966
  [tool.bdt.ci.plan.tiers.unit] # default tiers: unit = tests/unit, e2e = tests/e2e (a tier whose folder is missing is skipped)
966
967
  dir = "tests/unit" # areas = sub-folders with tests (test_*.py / *_test.py); `route_planning` <-> `test-route-planning`
@@ -1294,9 +1295,12 @@ used is reported as `api-route-baseline-stale`, so the list can only shrink.
1294
1295
  ## `bdt deps affected` / `bdt deps advisories` / `bdt deps cooldown`
1295
1296
 
1296
1297
  Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? All
1297
- commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm) and
1298
- Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`) below each `--path` (default: the
1299
- current directory; `node_modules`, virtualenvs, `.git`, `.gradle` and `.worktrees` are skipped).
1298
+ commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm),
1299
+ Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`), `Cargo.lock` (crates.io) and NuGet's
1300
+ `packages.lock.json` below each `--path` (default: the current directory; `node_modules`, virtualenvs, `.git`, `.gradle`,
1301
+ Rust `target` and `.worktrees` are skipped). Cargo and NuGet are read from the lockfile only: the version ranges live in
1302
+ `Cargo.toml` / the project files, so a `blocked` status (fix outside the declared range) is not computed for them. A NuGet
1303
+ project needs `RestorePackagesWithLockFile` to have a `packages.lock.json`.
1300
1304
  Git, path, alias and workspace sources, and Gradle entries without an exact version in the catalog (managed by a BOM, or a
1301
1305
  range), can't be matched against an advisory: they are listed as `unsupported`, never skipped. A catalog lists the direct
1302
1306
  dependencies only; transitive ones need Gradle dependency locking (`gradle.lockfile`).
@@ -1306,6 +1310,7 @@ bdt deps affected lodash --version-spec "<4.17.21" --path ~/projects/CCMT2 --pat
1306
1310
  bdt deps advisories --path . # OSV lookup of every locked version, one status per affected package
1307
1311
  bdt deps advisories --json # machine-readable
1308
1312
  bdt deps cooldown --ecosystem Maven --base origin/dev # CI: no Gradle version added or changed within the cooldown
1313
+ bdt deps cooldown --ecosystem NuGet --base origin/main # same for packages.lock.json; Cargo >= 1.100 enforces it itself
1309
1314
  ```
1310
1315
 
1311
1316
  `affected PACKAGE` lists the locked versions of one package (PyPI names are normalised, npm names exact; `--ecosystem`
@@ -1314,9 +1319,12 @@ none matches, 1 a locked version matches, 2 setup error (no lockfile, unreadable
1314
1319
  git/path/alias source of that name could not be matched).
1315
1320
 
1316
1321
  `cooldown` answers "is a locked version younger than the dependency cooldown?" (`--cooldown-days`, default 5). uv
1317
- (`exclude-newer`) and bun (`minimumReleaseAge`) enforce the cooldown while resolving; Gradle has no such setting and
1318
- pins exact versions, so this is its check. The release time is the upload time of the POM (`Last-Modified`) on Maven
1319
- Central, Google Maven or the Gradle plugin portal. `--base REV` looks only at versions the file does not have at `REV`
1322
+ (`exclude-newer`), bun (`minimumReleaseAge`) and Cargo >= 1.100 (`[registry] global-min-publish-age = "5 days"` in
1323
+ `.cargo/config.toml`) enforce the cooldown while resolving; Gradle has no such setting and NuGet's (`minPublishAgeHours`
1324
+ per source in `nuget.config`) does not gate a pinned restore, so this is their check. It also works for a Cargo project
1325
+ on an older toolchain. The release time is the upload time of the POM (`Last-Modified`) on Maven Central,
1326
+ Google Maven or the Gradle plugin portal, `created_at` on crates.io, and `published` on nuget.org (an unlisted package,
1327
+ which nuget.org dates 1900, counts as unknown). `--base REV` looks only at versions the file does not have at `REV`
1320
1328
  (use the target branch in CI, so an old pin never fails a later pull request); without it every locked version is looked
1321
1329
  up. `--exempt NAME` (repeatable, `group:artifact` for Maven) lets one package through: the per-invocation exception for a
1322
1330
  security fix younger than the cooldown, as for uv and bun. Exit 0 none inside the cooldown (or all exempt), 1 a version
@@ -1338,7 +1346,7 @@ cooldown exception flow (`references/audit.md`) acts on it:
1338
1346
 
1339
1347
  The target version is the lowest one the advisory data shows to be outside every affected range of the urgent
1340
1348
  advisories (all of them when none is urgent), never "latest". Lower-severity advisories that need a newer version stay open until a normal bump, and the finding names them. `next:` lines give the per-invocation commands. Unsupported sources are listed but don't change the exit code. The fix's age
1341
- comes from the registry (PyPI: youngest file; npm: `time[version]`); `--cooldown-days` (default 5) is the project's
1349
+ comes from the registry (PyPI: youngest file; npm: `time[version]`; crates.io and NuGet: the release date above); `--cooldown-days` (default 5) is the project's
1342
1350
  cooldown. Compatibility with the parents' ranges of a *transitive* dependency isn't known here: re-run after the bump.
1343
1351
 
1344
1352
  It fails closed: OSV, KEV or an advisory record that can't be read is reported as `incomplete` with exit 3, never as
@@ -5,6 +5,7 @@ Configured under `[tool.bdt.ci.plan]` in pyproject.toml (the table must exist, e
5
5
  [tool.bdt.ci.plan]
6
6
  on_missing = "infer" # PR without a usable label: "infer" from the changed files (default) or "fail"
7
7
  non_code = ["docs/**", "*.md"] # files no test reads or ships; explicit per repo (`*.md` = root only, `**/*.md` = all)
8
+ # (the `bdt translate` file, translations.toml, is always one of them)
8
9
 
9
10
  [tool.bdt.ci.plan.tiers.unit] # default tiers: unit = tests/unit, e2e = tests/e2e
10
11
  dir = "tests/unit" # areas = sub-folders with tests (snake_case folder <-> kebab-case label)
@@ -33,6 +34,7 @@ Labels: `test-<area>`, `test-full` (everything), `test-none` (no tests; lint and
33
34
  4. Anything unreadable (label API, change list) selects everything.
34
35
  """
35
36
 
37
+ import glob
36
38
  import shlex
37
39
  from collections.abc import Callable, Collection, Iterable, Mapping
38
40
  from dataclasses import dataclass, field
@@ -197,6 +199,15 @@ def _tier(name: str, raw: object) -> Tier:
197
199
  return Tier(name, directory.strip("/"), globs, test_files)
198
200
 
199
201
 
202
+ def _translations_file(start: Path | None) -> str | None:
203
+ """The `bdt translate` source file relative to the project folder: text that tests do not read (they get the
204
+ generated JSON, and `bdt translate --check` guards the keys), so an edit alone needs no tests."""
205
+ file = load_bdt_table("translate", start).get("file", "translations.toml")
206
+ if not isinstance(file, str):
207
+ return None
208
+ return PurePosixPath(file).as_posix()
209
+
210
+
200
211
  def load_plan_config(start: Path | None = None) -> PlanConfig | None:
201
212
  """`[tool.bdt.ci.plan]`, or None when the table is absent (the feature is opt-in per repo)."""
202
213
  raw = load_bdt_table("ci", start).get("plan")
@@ -215,11 +226,14 @@ def load_plan_config(start: Path | None = None) -> PlanConfig | None:
215
226
  paths = {str(area): _strings(globs, f"paths.{area}") for area, globs in paths_raw.items()}
216
227
  if (pyproject.parent / "infra").is_dir():
217
228
  paths.setdefault(INFRA_AREA, ("infra/**",))
229
+ non_code = _strings(raw.get("non_code", []), "non_code")
230
+ if translations := _translations_file(start):
231
+ non_code += (glob.escape(translations),)
218
232
  config = PlanConfig(
219
233
  root=pyproject.parent,
220
234
  tiers=tuple(_tier(name, t) for name, t in tiers_raw.items()),
221
235
  on_missing=on_missing,
222
- non_code=_strings(raw.get("non_code", []), "non_code"),
236
+ non_code=non_code,
223
237
  paths=paths,
224
238
  )
225
239
  if clash := sorted(config.all_areas() & RESERVED_AREAS):
@@ -1,6 +1,7 @@
1
1
  """`bdt deps`: which locked dependencies a security advisory or supply chain incident touches (bmsuisse/devtools#113).
2
2
 
3
- - `lockfiles` -- read `uv.lock` (PyPI) and `bun.lock` (npm) into one shape
3
+ - `lockfiles` -- read `uv.lock` (PyPI), `bun.lock` (npm), Gradle (Maven), `Cargo.lock` (crates.io) and
4
+ `packages.lock.json` (NuGet) into one shape
4
5
  - `versions` -- version parsing, comparison and range matching per ecosystem
5
6
  - `osv` -- OSV / CISA KEV / registry timestamp client (the only network code)
6
7
  - `advisories` -- turns OSV records into a per-package status; pure logic, no I/O
@@ -18,14 +18,16 @@ known here; re-run after the bump to confirm the locked version moved.
18
18
 
19
19
  from __future__ import annotations
20
20
 
21
+ import shlex
21
22
  from collections.abc import Callable, Iterable
22
23
  from dataclasses import dataclass, field
23
24
  from datetime import datetime
24
- from typing import Any, Literal
25
+ from typing import Any, Literal, cast
25
26
 
26
27
  from bmsdna.devtools.deps.lockfiles import LockedPackage, LockfileContent, Unsupported
27
28
  from bmsdna.devtools.deps.osv import AdvisorySource, DataError, PackageQuery
28
29
  from bmsdna.devtools.deps.versions import (
30
+ ECOSYSTEMS,
29
31
  Ecosystem,
30
32
  SemVer,
31
33
  VersionError,
@@ -74,7 +76,9 @@ def parse_vuln(raw: dict[str, Any]) -> Vuln:
74
76
  for aff in raw.get("affected", []):
75
77
  package = aff.get("package") or {}
76
78
  eco = package.get("ecosystem", "")
77
- name = normalize_name("PyPI", package.get("name", "")) if eco == "PyPI" else package.get("name", "")
79
+ name = package.get("name", "")
80
+ if eco in ECOSYSTEMS:
81
+ name = normalize_name(cast("Ecosystem", eco), name)
78
82
  ranges = tuple((r.get("type", ""), tuple(r.get("events", []))) for r in aff.get("ranges", []))
79
83
  entries.append(AffectedEntry(eco, name, ranges, frozenset(aff.get("versions", []))))
80
84
  scores = tuple(
@@ -138,7 +142,7 @@ FixState = Literal["fixed", "no-fix", "unknown"]
138
142
 
139
143
  def _event_version(ecosystem: Ecosystem, text: str) -> Any:
140
144
  if text == "0":
141
- return SemVer(0, 0, 0) if ecosystem == "npm" else parse_version(ecosystem, "0")
145
+ return SemVer(0, 0, 0) if ecosystem in ("npm", "crates.io") else parse_version(ecosystem, "0")
142
146
  return parse_version(ecosystem, text)
143
147
 
144
148
 
@@ -148,7 +152,8 @@ def fix_for(vuln: Vuln, ecosystem: Ecosystem, name: str, version: str) -> tuple[
148
152
  locked = parse_version(ecosystem, version)
149
153
  except VersionError as exc:
150
154
  return "unknown", None, str(exc)
151
- entries = [a for a in vuln.affected if a.ecosystem == ecosystem and a.name == name]
155
+ wanted = normalize_name(ecosystem, name)
156
+ entries = [a for a in vuln.affected if a.ecosystem == ecosystem and normalize_name(ecosystem, a.name) == wanted]
152
157
  if not entries:
153
158
  return "unknown", None, "the advisory has no affected entry for this package"
154
159
  fixed: list[tuple[Any, str]] = []
@@ -283,7 +288,7 @@ def _commands(finding: Finding) -> list[str]:
283
288
  if finding.status not in ("exempt-eligible", "bump") or not target:
284
289
  return []
285
290
  project = pkg.lockfile.parent.parent if pkg.lockfile.parent.name == "gradle" else pkg.lockfile.parent
286
- where = f"cd {project}"
291
+ where = f"cd {shlex.quote(str(project))}"
287
292
  if pkg.ecosystem == "Maven":
288
293
  step = f"{where} && set {pkg.name} to {target} in the Gradle version catalog (gradle/libs.versions.toml)" + (
289
294
  ", then `./gradlew dependencies --write-locks`" if pkg.lockfile.name == "gradle.lockfile" else ""
@@ -294,6 +299,30 @@ def _commands(finding: Finding) -> list[str]:
294
299
  step,
295
300
  f"{where} && bdt deps cooldown --exempt {pkg.name} # Gradle has no cooldown setting: pass the exception here",
296
301
  ]
302
+ if pkg.ecosystem == "crates.io":
303
+ step = f"{where} && cargo update {pkg.name}@{pkg.version} --precise {target}"
304
+ if finding.status == "bump":
305
+ return [step]
306
+ # Cargo >= 1.100 enforces `registry.global-min-publish-age`; the exception is per invocation and, once the
307
+ # version is in Cargo.lock, the lockfile keeps it (versions already locked bypass the age check). The override
308
+ # covers the whole resolve, not just this crate, hence the check of what else the lockfile picked up.
309
+ return [
310
+ f"{where} && CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow cargo update {pkg.name}@{pkg.version} --precise {target}",
311
+ f"{where} && bdt deps cooldown --ecosystem crates.io --base HEAD --exempt {pkg.name}"
312
+ " # the override applies to the whole resolve: no other version the lockfile picked up may be inside the cooldown",
313
+ ]
314
+ if pkg.ecosystem == "NuGet":
315
+ step = (
316
+ f"{where} && dotnet add package {pkg.name} --version {target}"
317
+ if pkg.direct
318
+ else f"{where} && add {pkg.name} {target} as a direct PackageReference (or a central pin)"
319
+ ) + ", then `dotnet restore --force-evaluate` (rewrites packages.lock.json)"
320
+ if finding.status == "bump":
321
+ return [step]
322
+ return [
323
+ step,
324
+ f"{where} && bdt deps cooldown --exempt {pkg.name} # NuGet has no cooldown setting: pass the exception here",
325
+ ]
297
326
  if pkg.ecosystem == "PyPI":
298
327
  if finding.status == "bump":
299
328
  return [f"{where} && uv lock --upgrade-package {pkg.name} && uv sync"]
@@ -25,14 +25,14 @@ from bmsdna.devtools.deps.versions import ECOSYSTEMS, VersionError, normalize_na
25
25
 
26
26
  deps_app = typer.Typer(
27
27
  name="deps",
28
- help="Which locked dependencies (uv.lock, bun.lock, Gradle) a security advisory or supply chain incident touches",
28
+ help="Which locked dependencies (uv.lock, bun.lock, Gradle, Cargo.lock, NuGet) a security advisory or supply chain incident touches",
29
29
  )
30
30
 
31
31
  PathOption = Annotated[
32
32
  list[Path] | None,
33
33
  typer.Option(
34
34
  "--path",
35
- help="Directory (or lockfile) to scan, repeatable; every uv.lock, bun.lock, gradle.lockfile and gradle/*.versions.toml below it. Default: the current directory.",
35
+ help="Directory (or lockfile) to scan, repeatable; every uv.lock, bun.lock, gradle.lockfile, gradle/*.versions.toml, Cargo.lock and packages.lock.json below it. Default: the current directory.",
36
36
  ),
37
37
  ]
38
38
  EXIT_FOUND, EXIT_SETUP, EXIT_INCOMPLETE = 1, 2, 3
@@ -47,7 +47,10 @@ def _read_all(paths: list[Path] | None) -> list[LockfileContent]:
47
47
  try:
48
48
  lockfiles = find_lockfiles(roots)
49
49
  if not lockfiles:
50
- typer.echo("bdt deps: no uv.lock, bun.lock, gradle.lockfile or Gradle version catalog found", err=True)
50
+ typer.echo(
51
+ "bdt deps: no uv.lock, bun.lock, gradle.lockfile, Gradle version catalog, Cargo.lock or packages.lock.json found",
52
+ err=True,
53
+ )
51
54
  raise typer.Exit(EXIT_SETUP)
52
55
  return [read_lockfile(p) for p in lockfiles]
53
56
  except LockfileError as exc:
@@ -57,7 +60,9 @@ def _read_all(paths: list[Path] | None) -> list[LockfileContent]:
57
60
 
58
61
  @deps_app.command("affected")
59
62
  def affected(
60
- package: Annotated[str, typer.Argument(help="Package name (PyPI names are normalised, npm names are exact)")],
63
+ package: Annotated[
64
+ str, typer.Argument(help="Package name (PyPI/crates.io/NuGet names are normalised, npm names are exact)")
65
+ ],
61
66
  version_spec: Annotated[
62
67
  str | None,
63
68
  typer.Option(
@@ -66,7 +71,8 @@ def affected(
66
71
  ),
67
72
  ] = None,
68
73
  ecosystem: Annotated[
69
- str | None, typer.Option("--ecosystem", help="PyPI, npm or Maven (Gradle). Default: all.")
74
+ str | None,
75
+ typer.Option("--ecosystem", help="PyPI, npm, Maven (Gradle), crates.io (Cargo) or NuGet. Default: all."),
70
76
  ] = None,
71
77
  path: PathOption = None,
72
78
  ) -> None:
@@ -139,7 +145,7 @@ def advisories(
139
145
  ] = DEFAULT_COOLDOWN_DAYS,
140
146
  as_json: Annotated[bool, typer.Option("--json", help="Machine-readable output.")] = False,
141
147
  ) -> None:
142
- """OSV advisories for every locked PyPI/npm/Maven version below --path, with a status each (malicious, needs-triage, no-fix,
148
+ """OSV advisories for every locked PyPI/npm/Maven/crates.io/NuGet version below --path, with a status each (malicious, needs-triage, no-fix,
143
149
  blocked, exempt-eligible, bump, informational; see the maintenance skill, audit.md). Fails closed: if OSV, the CISA KEV
144
150
  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,
145
151
  1 affected, 2 setup error, 3 incomplete. Never edits anything; other lockfile sources are listed as unsupported."""
@@ -186,7 +192,8 @@ def cooldown(
186
192
  exempt: Annotated[
187
193
  list[str] | None,
188
194
  typer.Option(
189
- "--exempt", help="Package (exact name, `group:artifact` for Maven) allowed inside the cooldown. Repeatable."
195
+ "--exempt",
196
+ help="Package (name as locked, `group:artifact` for Maven) allowed inside the cooldown. Repeatable.",
190
197
  ),
191
198
  ] = None,
192
199
  base: Annotated[
@@ -197,11 +204,12 @@ def cooldown(
197
204
  ),
198
205
  ] = None,
199
206
  ecosystem: Annotated[
200
- str | None, typer.Option("--ecosystem", help="PyPI, npm or Maven (Gradle). Default: all.")
207
+ str | None,
208
+ typer.Option("--ecosystem", help="PyPI, npm, Maven (Gradle), crates.io (Cargo) or NuGet. Default: all."),
201
209
  ] = None,
202
210
  ) -> None:
203
- """Locked versions younger than the dependency cooldown. uv and bun enforce it while resolving; Gradle can't, so this is
204
- its check (`--ecosystem Maven --base origin/dev`). Exit 0 none inside the cooldown (or all exempt), 1 a version inside
211
+ """Locked versions younger than the dependency cooldown. uv and bun enforce it while resolving; Cargo >= 1.100 does too
212
+ (`registry.global-min-publish-age`); Gradle and NuGet can't, so this is their check (`--ecosystem Maven --base origin/dev`). Exit 0 none inside the cooldown (or all exempt), 1 a version inside
205
213
  it, 2 setup error, 3 a release time could not be read. Versions without a public release time are listed, not failed."""
206
214
  if ecosystem and ecosystem not in ECOSYSTEMS:
207
215
  typer.echo(f"bdt deps: --ecosystem must be one of {', '.join(ECOSYSTEMS)}", err=True)
@@ -1,7 +1,9 @@
1
1
  """`bdt deps cooldown`: is a locked or pinned version younger than the dependency cooldown?
2
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.
3
+ uv (`exclude-newer`), bun (`minimumReleaseAge`) and Cargo >= 1.100 (`registry.global-min-publish-age`) enforce the cooldown
4
+ while resolving. Gradle has no such setting and NuGet's does not gate a pinned restore, so for Maven and NuGet the cooldown
5
+ is checked here, against the version a branch adds or changes (it also works for any other locked version, e.g. Cargo
6
+ projects on an older toolchain).
5
7
  """
6
8
 
7
9
  from __future__ import annotations
@@ -1,4 +1,5 @@
1
- """Read `uv.lock` (PyPI), `bun.lock` (npm), `gradle.lockfile` and Gradle version catalogs (Maven) into `LockedPackage`s.
1
+ """Read `uv.lock` (PyPI), `bun.lock` (npm), `gradle.lockfile` and Gradle version catalogs (Maven), `Cargo.lock` (crates.io)
2
+ and `packages.lock.json` (NuGet) into `LockedPackage`s.
2
3
 
3
4
  Only registry packages are returned; git, path, editable and workspace sources (and Gradle versions a catalog does not pin)
4
5
  are reported as `Unsupported` so a scan never claims to have looked at a dependency it can't match against an advisory.
@@ -17,8 +18,16 @@ from typing import Any, cast
17
18
 
18
19
  from bmsdna.devtools.deps.versions import Ecosystem, normalize_name
19
20
 
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"})
21
+ LOCKFILE_NAMES = {
22
+ "uv.lock": "PyPI",
23
+ "bun.lock": "npm",
24
+ "gradle.lockfile": "Maven",
25
+ "Cargo.lock": "crates.io",
26
+ "packages.lock.json": "NuGet",
27
+ }
28
+ _SKIP_DIRS = frozenset(
29
+ {"node_modules", ".venv", "venv", ".git", ".worktrees", "__pycache__", ".tox", ".gradle", "target"}
30
+ )
22
31
 
23
32
 
24
33
  def is_lockfile(path: Path) -> bool:
@@ -56,8 +65,8 @@ class LockfileContent:
56
65
 
57
66
 
58
67
  def find_lockfiles(roots: Iterable[Path]) -> list[Path]:
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)."""
68
+ """Every `uv.lock` / `bun.lock` / `gradle.lockfile` / `gradle/*.versions.toml` / `Cargo.lock` / `packages.lock.json`
69
+ below the roots; `node_modules`, virtualenvs, `.git`, `.gradle`, Rust `target` and `.worktrees` are not entered (a root that itself lives inside one is still scanned)."""
61
70
  found: list[Path] = []
62
71
  errors: list[str] = []
63
72
  for root in roots:
@@ -81,6 +90,10 @@ def read_lockfile(path: Path, text: str | None = None) -> LockfileContent:
81
90
  return read_uv_lock(path, text)
82
91
  if path.name == "gradle.lockfile":
83
92
  return read_gradle_lockfile(path, text)
93
+ if path.name == "Cargo.lock":
94
+ return read_cargo_lock(path, text)
95
+ if path.name == "packages.lock.json":
96
+ return read_nuget_lock(path, text)
84
97
  if path.name.endswith(".versions.toml"):
85
98
  return read_gradle_catalog(path, text)
86
99
  return read_bun_lock(path, text)
@@ -297,3 +310,69 @@ def read_gradle_lockfile(path: Path, text: str | None = None) -> LockfileContent
297
310
  seen.add((name, version))
298
311
  content.packages.append(LockedPackage("Maven", name, version, name in direct, path))
299
312
  return content
313
+
314
+
315
+ # ── Cargo.lock ───────────────────────────────────────────────────────────────────────────────────────────────────
316
+
317
+ _CRATES_IO_SOURCES = ("registry+https://github.com/rust-lang/crates.io-index", "sparse+https://index.crates.io/")
318
+
319
+
320
+ def read_cargo_lock(path: Path, text: str | None = None) -> LockfileContent:
321
+ """`Cargo.lock`: every package from crates.io. Direct = listed as a dependency by a workspace member (a package with
322
+ no `source`); the version ranges live in `Cargo.toml`, so `declared` stays empty."""
323
+ data = tomllib.loads(text if text is not None else path.read_text(encoding="utf-8"))
324
+ packages = data.get("package")
325
+ if not isinstance(packages, list) or not packages:
326
+ raise ValueError("no [[package]] entries: not a Cargo lockfile")
327
+ direct: set[tuple[str, str | None]] = set()
328
+ for pkg in packages:
329
+ if "source" not in pkg:
330
+ for dep in pkg.get("dependencies", []): # "name", "name version" or "name version (source)"
331
+ name, _, rest = dep.partition(" ")
332
+ direct.add((name, rest.split(" ")[0] or None))
333
+ content = LockfileContent(path, "crates.io")
334
+ seen: set[tuple[str, str]] = set()
335
+ for pkg in packages:
336
+ source = pkg.get("source")
337
+ if source is None: # a workspace member or path dependency: the project's own code
338
+ continue
339
+ name, version = pkg["name"], pkg["version"]
340
+ if not source.startswith(_CRATES_IO_SOURCES):
341
+ kind = source.partition("+")[0]
342
+ reason = "git source" if kind == "git" else f"{kind} source other than crates.io"
343
+ content.unsupported.append(Unsupported(path, f"{name} {version}", reason))
344
+ continue
345
+ if (name, version) in seen:
346
+ continue
347
+ seen.add((name, version))
348
+ is_direct = (name, version) in direct or (name, None) in direct
349
+ content.packages.append(LockedPackage("crates.io", name, version, is_direct, path))
350
+ return content
351
+
352
+
353
+ # ── packages.lock.json (NuGet) ───────────────────────────────────────────────────────────────────────────────────
354
+
355
+
356
+ def read_nuget_lock(path: Path, text: str | None = None) -> LockfileContent:
357
+ """`packages.lock.json` (`RestorePackagesWithLockFile`): one table per target framework. Direct = `type: Direct`;
358
+ project references are the solution's own code and skipped. The requested range is NuGet interval notation, which is
359
+ not evaluated, so `declared` stays empty."""
360
+ data = json.loads(text if text is not None else path.read_text(encoding="utf-8"))
361
+ frameworks = data.get("dependencies") if isinstance(data, dict) else None
362
+ if not isinstance(frameworks, dict):
363
+ raise ValueError('no "dependencies" object: not a NuGet lockfile')
364
+ content = LockfileContent(path, "NuGet")
365
+ found: dict[tuple[str, str], bool] = {}
366
+ for framework in frameworks.values():
367
+ for name, entry in framework.items():
368
+ if entry.get("type") == "Project":
369
+ continue
370
+ version = entry.get("resolved")
371
+ if not version:
372
+ content.unsupported.append(Unsupported(path, name, "no resolved version in the lockfile"))
373
+ continue
374
+ found[(name, version)] = found.get((name, version), False) or entry.get("type") == "Direct"
375
+ content.packages.extend(
376
+ LockedPackage("NuGet", name, version, direct, path) for (name, version), direct in found.items()
377
+ )
378
+ return content
@@ -20,6 +20,11 @@ OSV_URL = "https://api.osv.dev"
20
20
  KEV_URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json"
21
21
  PYPI_URL = "https://pypi.org/pypi"
22
22
  NPM_URL = "https://registry.npmjs.org"
23
+ CRATES_URL = "https://crates.io/api/v1/crates"
24
+ CRATES_USER_AGENT = (
25
+ "bdt (bmsuisse devtools; https://github.com/bmsuisse/devtools)" # crates.io rejects clients without one
26
+ )
27
+ NUGET_URL = "https://api.nuget.org/v3/registration5-gz-semver2"
23
28
  # Where a Gradle dependency can live, in lookup order: the first repository that has the POM gives the release time.
24
29
  MAVEN_REPOS = (
25
30
  "https://repo1.maven.org/maven2",
@@ -161,9 +166,33 @@ class OsvClient:
161
166
  raise DataError(f"{url} unreachable: {last}")
162
167
  return None
163
168
 
169
+ def _crates_release_time(self, name: str, version: str) -> datetime | None:
170
+ """`created_at` of the version on crates.io."""
171
+ url = f"{CRATES_URL}/{quote(name)}/{quote(version)}"
172
+ data = self._request("GET", url, allow_404=True, headers={"User-Agent": CRATES_USER_AGENT})
173
+ if data is None:
174
+ return None
175
+ try:
176
+ return _parse_time(data["version"]["created_at"])
177
+ except (KeyError, TypeError, ValueError) as exc:
178
+ raise DataError(f"{url} has no readable created_at") from exc
179
+
180
+ def _nuget_release_time(self, name: str, version: str) -> datetime | None:
181
+ """`published` of the version's registration leaf on nuget.org (ids and versions are lower-cased there)."""
182
+ url = f"{NUGET_URL}/{quote(name.lower())}/{quote(version.lower())}.json"
183
+ data = self._request("GET", url, allow_404=True)
184
+ if data is None:
185
+ return None
186
+ try:
187
+ published = _parse_time(data["published"])
188
+ except (KeyError, TypeError, ValueError) as exc:
189
+ raise DataError(f"{url} has no readable published date") from exc
190
+ # nuget.org reports 1900-01-01 for an unlisted package: its real date is unknown, not 125 years old
191
+ return None if published.year < 2000 else published
192
+
164
193
  def release_time(self, ecosystem: Ecosystem, name: str, version: str) -> datetime | None:
165
194
  """When the version was published: the youngest file for PyPI (uv gates per file), `time[version]` for npm
166
- (bun's source), the POM's `Last-Modified` for Maven. None when the registry doesn't know it (private package)."""
195
+ (bun's source), `created_at` for crates.io, `published` for NuGet, the POM's `Last-Modified` for Maven. None when the registry doesn't know it (private package)."""
167
196
  if ecosystem == "Maven":
168
197
  return self._maven_release_time(name, version)
169
198
  if ecosystem == "PyPI":
@@ -171,6 +200,10 @@ class OsvClient:
171
200
  files = (data or {}).get("urls") or []
172
201
  times = [f["upload_time_iso_8601"] for f in files if f.get("upload_time_iso_8601")]
173
202
  return max(_parse_time(t) for t in times) if times else None
203
+ if ecosystem == "crates.io":
204
+ return self._crates_release_time(name, version)
205
+ if ecosystem == "NuGet":
206
+ return self._nuget_release_time(name, version)
174
207
  if name not in self._npm_times:
175
208
  data = self._request("GET", f"{NPM_URL}/{quote(name, safe='@')}", allow_404=True)
176
209
  self._npm_times[name] = (data or {}).get("time") or {}