bmsdna-devtools 0.55.0__tar.gz → 0.57.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.
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/PKG-INFO +52 -6
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/README.md +51 -5
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/cli.py +45 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/deps/advisories.py +12 -1
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/deps/cli.py +83 -6
- bmsdna_devtools-0.57.1/bmsdna/devtools/deps/cooldown.py +83 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/deps/lockfiles.py +104 -15
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/deps/osv.py +42 -1
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/deps/versions.py +154 -5
- bmsdna_devtools-0.57.1/bmsdna/devtools/find_repo.py +599 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/pyproject.toml +1 -1
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/skills/bmsdna-devtools/SKILL.md +12 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_deps.py +90 -0
- bmsdna_devtools-0.57.1/tests/test_deps_cooldown.py +90 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_deps_lockfiles.py +88 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_deps_osv.py +31 -2
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_deps_versions.py +29 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_find_repo.py +452 -1
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/uv.lock +1 -1
- bmsdna_devtools-0.55.0/bmsdna/devtools/find_repo.py +0 -285
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/.github/workflows/python-test.yml +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/.gitignore +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/.python-version +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/_api_dump.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/ado_auth.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/ado_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/agent_mentions.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/api_usage.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/app_service_logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/azure_arm.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/azure_auth.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/business_user.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/ci_plan.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/ci_plan_env.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/cli_tools.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/commit.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/dead_code.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/deps/__init__.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/env_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/find_injection.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/gh_args.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/gh_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/gh_pr.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/github_api.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/gitrepo.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/injection_frontend.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/injection_python.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/issue_do.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/issue_show.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/issue_watch.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/lint.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/lint_models.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/lint_sql.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/lint_sql_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/lint_tooling.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/lint_typescript.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_build.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_cancel.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_create_args.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_drift.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_info.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_issue_link.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_labels.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_markdown.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pr_ref.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/pull.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/testdb.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/translate.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/cli.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/pipeline.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/report.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/bmsdna/devtools/worktree.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/justfile +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/conftest.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/fake_github.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_ado_auth.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_ado_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_ado_issue_flow.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_agent_mentions.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_api_usage.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_azure_arm.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_business_user.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_ci_plan.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_ci_plan_env.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_cleanup.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_commit.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_pr_create.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_pr_id.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_commit.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_deps_advisories.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_env_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_env_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_find_injection.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_gh_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_gh_pr.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_github_api.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_gitrepo.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_issue_do.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_issue_for_me.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_issue_show.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_issue_watch.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_lint.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_lint_models.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_lint_sql.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_lint_sql_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_lint_typescript.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_build.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_build_create_options.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_build_flow.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_cancel_build.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_choice.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_create_args.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_description_not_truncated.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_drift.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_info.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_labels.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_markdown.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_pull.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_testdb.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_translate.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_usage.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/tests/test_wait_timeout.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.57.1}/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.
|
|
3
|
+
Version: 0.57.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
|
|
@@ -706,6 +706,39 @@ Set the org env vars in your shell profile to make `bdt find-repo <name>` work a
|
|
|
706
706
|
the `cross-repo-discovery` skill's `ALL_REPOS.md` sync. Needs ADO auth / a GitHub token only when
|
|
707
707
|
those orgs are searched.
|
|
708
708
|
|
|
709
|
+
## `bdt list-repo`
|
|
710
|
+
|
|
711
|
+
```bash
|
|
712
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json] [--pat PAT]
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
|
|
716
|
+
(same flags and env vars as `find-repo`), sorted by project and name, one line each:
|
|
717
|
+
|
|
718
|
+
```text
|
|
719
|
+
bmsuisse/bicep-cost 2026-11-06 fbf7e85f Adrian Ehrsam CLI for estimating Costs for Azure Infra, based on Bicep
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
The columns are the newest commit's date, short id and author, then a one-line description. With no org
|
|
723
|
+
configured, or with `--local`, it lists the clones under the work dir instead (the path takes the place of
|
|
724
|
+
`project/repo`; the commit is the newest one on any branch of the clone).
|
|
725
|
+
|
|
726
|
+
- **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
|
|
727
|
+
first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
|
|
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.
|
|
732
|
+
- **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
|
|
733
|
+
`project`, `name`, `source` (`ado`/`github`), `git_url` (to clone), `web_url` (to open in the browser),
|
|
734
|
+
`location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
|
|
735
|
+
Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
|
|
736
|
+
`origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
|
|
737
|
+
- **Local clones:** `location` is the path of your clone of that repo under the work dir (found by matching each
|
|
738
|
+
clone's `origin` URL, whether it was cloned via https or ssh), or `null` if it isn't cloned. `--no-local` skips that
|
|
739
|
+
lookup and leaves `location` out of the JSON entirely; the aligned text never shows it. `--local` and `--no-local`
|
|
740
|
+
contradict each other, and `--no-local` needs an org to list.
|
|
741
|
+
|
|
709
742
|
## `bdt cleanup worktrees` / `bdt cleanup orphaned-dbs` / `bdt cleanup db` / `bdt cleanup worktree`
|
|
710
743
|
|
|
711
744
|
```bash
|
|
@@ -1229,17 +1262,21 @@ catch-all, service-to-service endpoints and an external API folder.
|
|
|
1229
1262
|
then on only *new* unused routes fail -- and a baseline line whose route has since been deleted, excluded or
|
|
1230
1263
|
used is reported as `api-route-baseline-stale`, so the list can only shrink.
|
|
1231
1264
|
|
|
1232
|
-
## `bdt deps affected` / `bdt deps advisories`
|
|
1265
|
+
## `bdt deps affected` / `bdt deps advisories` / `bdt deps cooldown`
|
|
1233
1266
|
|
|
1234
|
-
Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched?
|
|
1235
|
-
commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI)
|
|
1236
|
-
|
|
1237
|
-
|
|
1267
|
+
Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? All
|
|
1268
|
+
commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm) and
|
|
1269
|
+
Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`) below each `--path` (default: the
|
|
1270
|
+
current directory; `node_modules`, virtualenvs, `.git`, `.gradle` and `.worktrees` are skipped).
|
|
1271
|
+
Git, path, alias and workspace sources, and Gradle entries without an exact version in the catalog (managed by a BOM, or a
|
|
1272
|
+
range), can't be matched against an advisory: they are listed as `unsupported`, never skipped. A catalog lists the direct
|
|
1273
|
+
dependencies only; transitive ones need Gradle dependency locking (`gradle.lockfile`).
|
|
1238
1274
|
|
|
1239
1275
|
```bash
|
|
1240
1276
|
bdt deps affected lodash --version-spec "<4.17.21" --path ~/projects/CCMT2 --path ~/projects/OneSales
|
|
1241
1277
|
bdt deps advisories --path . # OSV lookup of every locked version, one status per affected package
|
|
1242
1278
|
bdt deps advisories --json # machine-readable
|
|
1279
|
+
bdt deps cooldown --ecosystem Maven --base origin/dev # CI: no Gradle version added or changed within the cooldown
|
|
1243
1280
|
```
|
|
1244
1281
|
|
|
1245
1282
|
`affected PACKAGE` lists the locked versions of one package (PyPI names are normalised, npm names exact; `--ecosystem`
|
|
@@ -1247,6 +1284,15 @@ narrows) and marks those matching `--version-spec` (comparators such as `<4.17.2
|
|
|
1247
1284
|
none matches, 1 a locked version matches, 2 setup error (no lockfile, unreadable lockfile, bad spec), 3 incomplete (a
|
|
1248
1285
|
git/path/alias source of that name could not be matched).
|
|
1249
1286
|
|
|
1287
|
+
`cooldown` answers "is a locked version younger than the dependency cooldown?" (`--cooldown-days`, default 5). uv
|
|
1288
|
+
(`exclude-newer`) and bun (`minimumReleaseAge`) enforce the cooldown while resolving; Gradle has no such setting and
|
|
1289
|
+
pins exact versions, so this is its check. The release time is the upload time of the POM (`Last-Modified`) on Maven
|
|
1290
|
+
Central, Google Maven or the Gradle plugin portal. `--base REV` looks only at versions the file does not have at `REV`
|
|
1291
|
+
(use the target branch in CI, so an old pin never fails a later pull request); without it every locked version is looked
|
|
1292
|
+
up. `--exempt NAME` (repeatable, `group:artifact` for Maven) lets one package through: the per-invocation exception for a
|
|
1293
|
+
security fix younger than the cooldown, as for uv and bun. Exit 0 none inside the cooldown (or all exempt), 1 a version
|
|
1294
|
+
inside it, 2 setup error, 3 a release time could not be read; a version without a public release time is listed, not failed.
|
|
1295
|
+
|
|
1250
1296
|
`advisories` queries [OSV](https://osv.dev) (GHSA, PYSEC and the OpenSSF `MAL-` malicious-package advisories) and the
|
|
1251
1297
|
CISA KEV feed, groups aliases (GHSA = PYSEC = CVE) and reports per locked package one status. The maintenance skill's
|
|
1252
1298
|
cooldown exception flow (`references/audit.md`) acts on it:
|
|
@@ -687,6 +687,39 @@ Set the org env vars in your shell profile to make `bdt find-repo <name>` work a
|
|
|
687
687
|
the `cross-repo-discovery` skill's `ALL_REPOS.md` sync. Needs ADO auth / a GitHub token only when
|
|
688
688
|
those orgs are searched.
|
|
689
689
|
|
|
690
|
+
## `bdt list-repo`
|
|
691
|
+
|
|
692
|
+
```bash
|
|
693
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json] [--pat PAT]
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
|
|
697
|
+
(same flags and env vars as `find-repo`), sorted by project and name, one line each:
|
|
698
|
+
|
|
699
|
+
```text
|
|
700
|
+
bmsuisse/bicep-cost 2026-11-06 fbf7e85f Adrian Ehrsam CLI for estimating Costs for Azure Infra, based on Bicep
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
The columns are the newest commit's date, short id and author, then a one-line description. With no org
|
|
704
|
+
configured, or with `--local`, it lists the clones under the work dir instead (the path takes the place of
|
|
705
|
+
`project/repo`; the commit is the newest one on any branch of the clone).
|
|
706
|
+
|
|
707
|
+
- **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
|
|
708
|
+
first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
|
|
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.
|
|
713
|
+
- **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
|
|
714
|
+
`project`, `name`, `source` (`ado`/`github`), `git_url` (to clone), `web_url` (to open in the browser),
|
|
715
|
+
`location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
|
|
716
|
+
Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
|
|
717
|
+
`origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
|
|
718
|
+
- **Local clones:** `location` is the path of your clone of that repo under the work dir (found by matching each
|
|
719
|
+
clone's `origin` URL, whether it was cloned via https or ssh), or `null` if it isn't cloned. `--no-local` skips that
|
|
720
|
+
lookup and leaves `location` out of the JSON entirely; the aligned text never shows it. `--local` and `--no-local`
|
|
721
|
+
contradict each other, and `--no-local` needs an org to list.
|
|
722
|
+
|
|
690
723
|
## `bdt cleanup worktrees` / `bdt cleanup orphaned-dbs` / `bdt cleanup db` / `bdt cleanup worktree`
|
|
691
724
|
|
|
692
725
|
```bash
|
|
@@ -1210,17 +1243,21 @@ catch-all, service-to-service endpoints and an external API folder.
|
|
|
1210
1243
|
then on only *new* unused routes fail -- and a baseline line whose route has since been deleted, excluded or
|
|
1211
1244
|
used is reported as `api-route-baseline-stale`, so the list can only shrink.
|
|
1212
1245
|
|
|
1213
|
-
## `bdt deps affected` / `bdt deps advisories`
|
|
1246
|
+
## `bdt deps affected` / `bdt deps advisories` / `bdt deps cooldown`
|
|
1214
1247
|
|
|
1215
|
-
Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched?
|
|
1216
|
-
commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI)
|
|
1217
|
-
|
|
1218
|
-
|
|
1248
|
+
Security incidents and supply chain attacks (bmsuisse/devtools#113): which locked dependencies are touched? All
|
|
1249
|
+
commands only read: they never edit a file, a lock or an environment. They cover `uv.lock` (PyPI), `bun.lock` (npm) and
|
|
1250
|
+
Gradle (Maven: `gradle.lockfile` and the version catalog `gradle/libs.versions.toml`) below each `--path` (default: the
|
|
1251
|
+
current directory; `node_modules`, virtualenvs, `.git`, `.gradle` and `.worktrees` are skipped).
|
|
1252
|
+
Git, path, alias and workspace sources, and Gradle entries without an exact version in the catalog (managed by a BOM, or a
|
|
1253
|
+
range), can't be matched against an advisory: they are listed as `unsupported`, never skipped. A catalog lists the direct
|
|
1254
|
+
dependencies only; transitive ones need Gradle dependency locking (`gradle.lockfile`).
|
|
1219
1255
|
|
|
1220
1256
|
```bash
|
|
1221
1257
|
bdt deps affected lodash --version-spec "<4.17.21" --path ~/projects/CCMT2 --path ~/projects/OneSales
|
|
1222
1258
|
bdt deps advisories --path . # OSV lookup of every locked version, one status per affected package
|
|
1223
1259
|
bdt deps advisories --json # machine-readable
|
|
1260
|
+
bdt deps cooldown --ecosystem Maven --base origin/dev # CI: no Gradle version added or changed within the cooldown
|
|
1224
1261
|
```
|
|
1225
1262
|
|
|
1226
1263
|
`affected PACKAGE` lists the locked versions of one package (PyPI names are normalised, npm names exact; `--ecosystem`
|
|
@@ -1228,6 +1265,15 @@ narrows) and marks those matching `--version-spec` (comparators such as `<4.17.2
|
|
|
1228
1265
|
none matches, 1 a locked version matches, 2 setup error (no lockfile, unreadable lockfile, bad spec), 3 incomplete (a
|
|
1229
1266
|
git/path/alias source of that name could not be matched).
|
|
1230
1267
|
|
|
1268
|
+
`cooldown` answers "is a locked version younger than the dependency cooldown?" (`--cooldown-days`, default 5). uv
|
|
1269
|
+
(`exclude-newer`) and bun (`minimumReleaseAge`) enforce the cooldown while resolving; Gradle has no such setting and
|
|
1270
|
+
pins exact versions, so this is its check. The release time is the upload time of the POM (`Last-Modified`) on Maven
|
|
1271
|
+
Central, Google Maven or the Gradle plugin portal. `--base REV` looks only at versions the file does not have at `REV`
|
|
1272
|
+
(use the target branch in CI, so an old pin never fails a later pull request); without it every locked version is looked
|
|
1273
|
+
up. `--exempt NAME` (repeatable, `group:artifact` for Maven) lets one package through: the per-invocation exception for a
|
|
1274
|
+
security fix younger than the cooldown, as for uv and bun. Exit 0 none inside the cooldown (or all exempt), 1 a version
|
|
1275
|
+
inside it, 2 setup error, 3 a release time could not be read; a version without a public release time is listed, not failed.
|
|
1276
|
+
|
|
1231
1277
|
`advisories` queries [OSV](https://osv.dev) (GHSA, PYSEC and the OpenSSF `MAL-` malicious-package advisories) and the
|
|
1232
1278
|
CISA KEV feed, groups aliases (GHSA = PYSEC = CVE) and reports per locked package one status. The maintenance skill's
|
|
1233
1279
|
cooldown exception flow (`references/audit.md`) acts on it:
|
|
@@ -1997,6 +1997,51 @@ def find_repo_cmd(
|
|
|
1997
1997
|
find_repo_mod.run(name, root=root, org=org, github_org=github_org, yes=yes, pat=pat)
|
|
1998
1998
|
|
|
1999
1999
|
|
|
2000
|
+
@app.command("list-repo")
|
|
2001
|
+
def list_repo_cmd(
|
|
2002
|
+
root: Path | None = typer.Option(
|
|
2003
|
+
None,
|
|
2004
|
+
"--root",
|
|
2005
|
+
help="Local work dir to list when no org is set or with --local (default: $AZDO_WORK_DIR/$BMS_WORK_DIR, falling back to ~/projects, or C:/Projects on Windows)",
|
|
2006
|
+
),
|
|
2007
|
+
org: str | None = typer.Option(None, "--org", envvar=["AZDO_ORG", "BMS_ORG"], help="Azure DevOps org to list"),
|
|
2008
|
+
github_org: str | None = typer.Option(
|
|
2009
|
+
None, "--github-org", envvar=["GITHUB_ORG", "BMS_GITHUB_ORG"], help="GitHub org to list"
|
|
2010
|
+
),
|
|
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
|
+
fast: bool = typer.Option(
|
|
2018
|
+
False,
|
|
2019
|
+
"--fast",
|
|
2020
|
+
help="Skip the extra requests per repo (newest commit; for Azure DevOps also the README). GitHub then shows only "
|
|
2021
|
+
"its last push date, Azure DevOps repos no commit and no description",
|
|
2022
|
+
),
|
|
2023
|
+
as_json: bool = typer.Option(False, "--json", help="Print a JSON array instead of aligned text"),
|
|
2024
|
+
pat: str | None = typer.Option(
|
|
2025
|
+
None,
|
|
2026
|
+
"--pat",
|
|
2027
|
+
envvar=["AZURE_DEVOPS_EXT_PAT", "AZURE_DEVOPS_PAT"],
|
|
2028
|
+
help="Azure DevOps PAT (else uses DefaultAzureCredential, e.g. your `az login`)",
|
|
2029
|
+
),
|
|
2030
|
+
) -> None:
|
|
2031
|
+
"""List all repos with last commit (date, id, author) and a one-line description -- the browse counterpart to `find-repo`.
|
|
2032
|
+
|
|
2033
|
+
Lists every repo of the Azure DevOps org and/or GitHub org (same --org/--github-org and env vars
|
|
2034
|
+
as `find-repo`); with no org configured, or with --local, the clones under the work dir.
|
|
2035
|
+
GitHub supplies its own description. Azure DevOps and local repos have none, so the first sentence of
|
|
2036
|
+
the README stands in. The commit is the newest one of the default branch on GitHub / Azure DevOps and of
|
|
2037
|
+
any branch in a local clone. --json gives the same data as an array of objects, with full ids and dates, the
|
|
2038
|
+
git and browser URL, and the path of the local clone (see --no-local).
|
|
2039
|
+
"""
|
|
2040
|
+
find_repo_mod.run_list(
|
|
2041
|
+
root=root, org=org, github_org=github_org, local=local, no_local=no_local, fast=fast, as_json=as_json, pat=pat
|
|
2042
|
+
)
|
|
2043
|
+
|
|
2044
|
+
|
|
2000
2045
|
@cleanup_app.command("worktrees")
|
|
2001
2046
|
def cleanup_worktrees(
|
|
2002
2047
|
root: Path = typer.Argument(Path("."), help="Root folder to scan for git repositories (recursively)"),
|
|
@@ -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
|
-
|
|
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 .
|
|
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
|
|
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
|
|
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[
|
|
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)
|
|
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
|
|
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`,
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|