bmsdna-devtools 0.55.0__tar.gz → 0.56.0__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/README.md → bmsdna_devtools-0.56.0/PKG-INFO +46 -0
- bmsdna_devtools-0.55.0/PKG-INFO → bmsdna_devtools-0.56.0/README.md +27 -19
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/cli.py +37 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/find_repo.py +242 -10
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/pyproject.toml +1 -1
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/skills/bmsdna-devtools/SKILL.md +11 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_find_repo.py +320 -1
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/uv.lock +1 -1
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/.github/workflows/python-test.yml +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/.gitignore +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/.python-version +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/_api_dump.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/ado_auth.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/ado_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/agent_mentions.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/api_usage.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/app_service_logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/azure_arm.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/azure_auth.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/business_user.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/ci_plan.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/ci_plan_env.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/cli_tools.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/commit.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/dead_code.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/deps/__init__.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/deps/advisories.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/deps/cli.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/deps/lockfiles.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/deps/osv.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/deps/versions.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/env_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/find_injection.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/gh_args.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/gh_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/gh_pr.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/github_api.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/gitrepo.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/injection_frontend.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/injection_python.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/issue_do.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/issue_show.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/issue_watch.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/lint.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/lint_models.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/lint_sql.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/lint_sql_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/lint_tooling.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/lint_typescript.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_build.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_cancel.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_create_args.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_drift.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_info.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_issue_link.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_labels.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_markdown.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pr_ref.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/pull.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/testdb.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/translate.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/cli.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/pipeline.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/report.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/bmsdna/devtools/worktree.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/justfile +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/conftest.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/fake_github.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_ado_auth.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_ado_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_ado_issue_flow.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_agent_mentions.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_api_usage.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_azure_arm.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_business_user.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_ci_plan.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_ci_plan_env.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_cleanup.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_commit.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_deps.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_pr_create.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_pr_id.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_commit.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_deps_advisories.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_deps_lockfiles.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_deps_osv.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_deps_versions.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_env_config.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_env_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_find_injection.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_gh_issue.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_gh_pr.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_github_api.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_gitrepo.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_issue_do.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_issue_for_me.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_issue_show.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_issue_watch.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_lint.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_lint_models.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_lint_sql.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_lint_sql_files.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_lint_typescript.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_logs.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_build.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_build_create_options.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_build_flow.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_cancel_build.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_choice.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_create_args.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_description_not_truncated.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_drift.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_info.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_labels.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_markdown.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_pull.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_testdb.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_translate.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_usage.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_wait_timeout.py +0 -0
- {bmsdna_devtools-0.55.0 → bmsdna_devtools-0.56.0}/tests/test_worktree_clean.py +0 -0
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bmsdna-devtools
|
|
3
|
+
Version: 0.56.0
|
|
4
|
+
Summary: Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects
|
|
5
|
+
Requires-Python: >=3.14
|
|
6
|
+
Requires-Dist: azure-identity>=1.19.0
|
|
7
|
+
Requires-Dist: packaging>=24.0
|
|
8
|
+
Requires-Dist: pgdevkit[db]>=0.7.1
|
|
9
|
+
Requires-Dist: requests>=2.32.0
|
|
10
|
+
Requires-Dist: rich>=13.0.0
|
|
11
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
12
|
+
Requires-Dist: typer>=0.26.7
|
|
13
|
+
Provides-Extra: lint
|
|
14
|
+
Requires-Dist: sqlglot>=27.0.0; extra == 'lint'
|
|
15
|
+
Provides-Extra: usage
|
|
16
|
+
Requires-Dist: duckdb>=1.3.0; extra == 'usage'
|
|
17
|
+
Requires-Dist: plotly>=5.24.0; extra == 'usage'
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
1
20
|
# bmsdna-devtools
|
|
2
21
|
|
|
3
22
|
Shared developer tooling for BMS projects: PR build/check status and a
|
|
@@ -687,6 +706,33 @@ Set the org env vars in your shell profile to make `bdt find-repo <name>` work a
|
|
|
687
706
|
the `cross-repo-discovery` skill's `ALL_REPOS.md` sync. Needs ADO auth / a GitHub token only when
|
|
688
707
|
those orgs are searched.
|
|
689
708
|
|
|
709
|
+
## `bdt list-repo`
|
|
710
|
+
|
|
711
|
+
```bash
|
|
712
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--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`), `url`, `last_commit_id`, `last_commit_date` (ISO 8601),
|
|
734
|
+
`last_commit_author`, `description` -- local clones have `name` and `location` instead of `project`/`source`/`url`.
|
|
735
|
+
|
|
690
736
|
## `bdt cleanup worktrees` / `bdt cleanup orphaned-dbs` / `bdt cleanup db` / `bdt cleanup worktree`
|
|
691
737
|
|
|
692
738
|
```bash
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: bmsdna-devtools
|
|
3
|
-
Version: 0.55.0
|
|
4
|
-
Summary: Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects
|
|
5
|
-
Requires-Python: >=3.14
|
|
6
|
-
Requires-Dist: azure-identity>=1.19.0
|
|
7
|
-
Requires-Dist: packaging>=24.0
|
|
8
|
-
Requires-Dist: pgdevkit[db]>=0.7.1
|
|
9
|
-
Requires-Dist: requests>=2.32.0
|
|
10
|
-
Requires-Dist: rich>=13.0.0
|
|
11
|
-
Requires-Dist: tomli-w>=1.0.0
|
|
12
|
-
Requires-Dist: typer>=0.26.7
|
|
13
|
-
Provides-Extra: lint
|
|
14
|
-
Requires-Dist: sqlglot>=27.0.0; extra == 'lint'
|
|
15
|
-
Provides-Extra: usage
|
|
16
|
-
Requires-Dist: duckdb>=1.3.0; extra == 'usage'
|
|
17
|
-
Requires-Dist: plotly>=5.24.0; extra == 'usage'
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
1
|
# bmsdna-devtools
|
|
21
2
|
|
|
22
3
|
Shared developer tooling for BMS projects: PR build/check status and a
|
|
@@ -706,6 +687,33 @@ Set the org env vars in your shell profile to make `bdt find-repo <name>` work a
|
|
|
706
687
|
the `cross-repo-discovery` skill's `ALL_REPOS.md` sync. Needs ADO auth / a GitHub token only when
|
|
707
688
|
those orgs are searched.
|
|
708
689
|
|
|
690
|
+
## `bdt list-repo`
|
|
691
|
+
|
|
692
|
+
```bash
|
|
693
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--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`), `url`, `last_commit_id`, `last_commit_date` (ISO 8601),
|
|
715
|
+
`last_commit_author`, `description` -- local clones have `name` and `location` instead of `project`/`source`/`url`.
|
|
716
|
+
|
|
709
717
|
## `bdt cleanup worktrees` / `bdt cleanup orphaned-dbs` / `bdt cleanup db` / `bdt cleanup worktree`
|
|
710
718
|
|
|
711
719
|
```bash
|
|
@@ -1997,6 +1997,43 @@ 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 the local clones under --root even if an org is configured"),
|
|
2012
|
+
fast: bool = typer.Option(
|
|
2013
|
+
False,
|
|
2014
|
+
"--fast",
|
|
2015
|
+
help="Skip the extra requests per repo (newest commit; for Azure DevOps also the README). GitHub then shows only "
|
|
2016
|
+
"its last push date, Azure DevOps repos no commit and no description",
|
|
2017
|
+
),
|
|
2018
|
+
as_json: bool = typer.Option(False, "--json", help="Print a JSON array instead of aligned text"),
|
|
2019
|
+
pat: str | None = typer.Option(
|
|
2020
|
+
None,
|
|
2021
|
+
"--pat",
|
|
2022
|
+
envvar=["AZURE_DEVOPS_EXT_PAT", "AZURE_DEVOPS_PAT"],
|
|
2023
|
+
help="Azure DevOps PAT (else uses DefaultAzureCredential, e.g. your `az login`)",
|
|
2024
|
+
),
|
|
2025
|
+
) -> None:
|
|
2026
|
+
"""List all repos with last commit (date, id, author) and a one-line description -- the browse counterpart to `find-repo`.
|
|
2027
|
+
|
|
2028
|
+
Lists every repo of the Azure DevOps org and/or GitHub org (same --org/--github-org and env vars
|
|
2029
|
+
as `find-repo`); with no org configured, or with --local, the clones under the work dir.
|
|
2030
|
+
GitHub supplies its own description. Azure DevOps and local repos have none, so the first sentence of
|
|
2031
|
+
the README stands in. The commit is the newest one of the default branch on GitHub / Azure DevOps and of
|
|
2032
|
+
any branch in a local clone. --json gives the same data as an array of objects, with full ids and dates.
|
|
2033
|
+
"""
|
|
2034
|
+
find_repo_mod.run_list(root=root, org=org, github_org=github_org, local=local, fast=fast, as_json=as_json, pat=pat)
|
|
2035
|
+
|
|
2036
|
+
|
|
2000
2037
|
@cleanup_app.command("worktrees")
|
|
2001
2038
|
def cleanup_worktrees(
|
|
2002
2039
|
root: Path = typer.Argument(Path("."), help="Root folder to scan for git repositories (recursively)"),
|
|
@@ -3,6 +3,9 @@ an Azure DevOps org and/or a GitHub org, without needing the full
|
|
|
3
3
|
`ALL_REPOS.md` org sync that the `cross-repo-discovery` skill
|
|
4
4
|
(bmsuisse/skills) used to require.
|
|
5
5
|
|
|
6
|
+
`bdt list-repo` is the browse counterpart: every repo of the same orgs (or the local clones) with its
|
|
7
|
+
newest commit and a one-line description.
|
|
8
|
+
|
|
6
9
|
Env vars mirror that skill's so switching over needs no reconfiguration:
|
|
7
10
|
- `AZDO_WORK_DIR` / `BMS_WORK_DIR`: local clone root to search (and to clone
|
|
8
11
|
a remote match into). Falls back to `C:/Projects` on Windows, `~/projects`
|
|
@@ -18,12 +21,14 @@ Env vars mirror that skill's so switching over needs no reconfiguration:
|
|
|
18
21
|
from __future__ import annotations
|
|
19
22
|
|
|
20
23
|
import base64
|
|
24
|
+
import json
|
|
21
25
|
import os
|
|
26
|
+
import re
|
|
22
27
|
import subprocess
|
|
23
28
|
import sys
|
|
24
29
|
from collections.abc import Callable
|
|
25
30
|
from concurrent.futures import ThreadPoolExecutor
|
|
26
|
-
from dataclasses import dataclass
|
|
31
|
+
from dataclasses import dataclass, replace
|
|
27
32
|
from pathlib import Path
|
|
28
33
|
from typing import TypeVar
|
|
29
34
|
from urllib.parse import quote
|
|
@@ -64,12 +69,23 @@ def find_local(name: str, root: Path) -> list[Path]:
|
|
|
64
69
|
return sorted(_prefer_exact(find_repos(root), name, key=lambda r: r.name))
|
|
65
70
|
|
|
66
71
|
|
|
72
|
+
@dataclass(frozen=True)
|
|
73
|
+
class CommitInfo:
|
|
74
|
+
"""Newest commit of a repo; every field is "" where the source doesn't tell."""
|
|
75
|
+
|
|
76
|
+
id: str = ""
|
|
77
|
+
date: str = "" # ISO 8601
|
|
78
|
+
author: str = ""
|
|
79
|
+
|
|
80
|
+
|
|
67
81
|
@dataclass(frozen=True)
|
|
68
82
|
class RemoteRepo:
|
|
69
83
|
project: str
|
|
70
84
|
name: str
|
|
71
85
|
remote_url: str
|
|
72
86
|
source: str = "ado"
|
|
87
|
+
description: str = ""
|
|
88
|
+
last_commit: CommitInfo = CommitInfo()
|
|
73
89
|
|
|
74
90
|
|
|
75
91
|
ADO_API_VERSION = "7.1"
|
|
@@ -120,8 +136,8 @@ def _ado_projects(org: str, headers: dict[str, str]) -> list[dict]:
|
|
|
120
136
|
skip += len(page)
|
|
121
137
|
|
|
122
138
|
|
|
123
|
-
def
|
|
124
|
-
"""
|
|
139
|
+
def _ado_all_repos(org: str, headers: dict[str, str]) -> list[RemoteRepo]:
|
|
140
|
+
"""Every repo of every project in `org`.
|
|
125
141
|
|
|
126
142
|
Azure DevOps has no "search repos by name across the whole org" API, so
|
|
127
143
|
(as the old skill's script did) this lists every project and then every
|
|
@@ -129,7 +145,6 @@ def find_remote(org: str, name: str, pat: str | None = None) -> list[RemoteRepo]
|
|
|
129
145
|
run concurrently (each is just an HTTP request waiting on network I/O)
|
|
130
146
|
since with dozens of projects a serial fan-out is the dominant cost.
|
|
131
147
|
"""
|
|
132
|
-
headers = auth_header(pat) # resolved once, shared by the worker threads
|
|
133
148
|
projects = _ado_projects(org, headers)
|
|
134
149
|
|
|
135
150
|
def repos_for(project: dict) -> list[RemoteRepo]:
|
|
@@ -146,12 +161,17 @@ def find_remote(org: str, name: str, pat: str | None = None) -> list[RemoteRepo]
|
|
|
146
161
|
with ThreadPoolExecutor(max_workers=8) as pool:
|
|
147
162
|
for repos in pool.map(repos_for, projects):
|
|
148
163
|
all_repos.extend(repos)
|
|
164
|
+
return all_repos
|
|
165
|
+
|
|
149
166
|
|
|
150
|
-
|
|
167
|
+
def find_remote(org: str, name: str, pat: str | None = None) -> list[RemoteRepo]:
|
|
168
|
+
"""Search every project in `org` for a repo matching `name` -- see `_prefer_exact`."""
|
|
169
|
+
headers = auth_header(pat) # resolved once, shared by the worker threads
|
|
170
|
+
return _prefer_exact(_ado_all_repos(org, headers), name, key=lambda r: r.name)
|
|
151
171
|
|
|
152
172
|
|
|
153
|
-
def
|
|
154
|
-
"""
|
|
173
|
+
def _github_all_repos(client: GitHubClient, org: str, limit: int | None = 1000) -> list[RemoteRepo]:
|
|
174
|
+
"""Every repo of `org`'s GitHub account.
|
|
155
175
|
|
|
156
176
|
Unlike Azure DevOps, GitHub has a single flat list of repos per org/user
|
|
157
177
|
(no per-project split), so one paginated listing covers the whole org. `org` may
|
|
@@ -165,9 +185,221 @@ def find_github(client: GitHubClient, org: str, name: str) -> list[RemoteRepo]:
|
|
|
165
185
|
path, params = "user/repos", {"affiliation": "owner"}
|
|
166
186
|
else:
|
|
167
187
|
path = f"users/{org_path}/repos"
|
|
168
|
-
items = client.paginate(path, params, limit=
|
|
169
|
-
|
|
170
|
-
|
|
188
|
+
items = client.paginate(path, params, limit=limit)
|
|
189
|
+
return [
|
|
190
|
+
RemoteRepo(
|
|
191
|
+
org, r["name"], r["html_url"], source="github", description=r.get("description") or "", last_commit=CommitInfo(date=r.get("pushed_at") or "")
|
|
192
|
+
)
|
|
193
|
+
for r in items
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def find_github(client: GitHubClient, org: str, name: str) -> list[RemoteRepo]:
|
|
198
|
+
"""Search `org`'s GitHub repos for a match -- see `_prefer_exact`."""
|
|
199
|
+
return _prefer_exact(_github_all_repos(client, org), name, key=lambda r: r.name)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
DESCRIPTION_MAX_LEN = 120
|
|
203
|
+
README_NAMES = ("README.md", "readme.md", "README.markdown", "README")
|
|
204
|
+
# Lines that open a README but say nothing about the repo: badges, images, HTML, tables, fences, rules.
|
|
205
|
+
_README_NOISE_PREFIXES = ("![", "[![", "<", "|", "`", "---", "===", "***")
|
|
206
|
+
# Numbered-list lines: the default Azure DevOps README template ("1. Installation process 2. ...") is all of them.
|
|
207
|
+
_NUMBERED_LINE = re.compile(r"\d+[.)]\s")
|
|
208
|
+
_SENTENCE_END = re.compile(r"(?<!\d)[.!?](\s|$)")
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def _is_readme_noise(line: str) -> bool:
|
|
212
|
+
return (
|
|
213
|
+
line.startswith(_README_NOISE_PREFIXES)
|
|
214
|
+
or line.upper().startswith("TODO")
|
|
215
|
+
or bool(_NUMBERED_LINE.match(line))
|
|
216
|
+
or not any(c.isalpha() for c in line)
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def readme_summary(text: str) -> str:
|
|
221
|
+
"""One-line description from a README: the first sentence of its first prose paragraph, else its
|
|
222
|
+
first heading's text.
|
|
223
|
+
|
|
224
|
+
Azure DevOps repos have no description field, so the README is the closest thing to one.
|
|
225
|
+
"""
|
|
226
|
+
heading = ""
|
|
227
|
+
paragraph: list[str] = []
|
|
228
|
+
for raw in [*text.splitlines(), ""]: # trailing "" closes a paragraph that runs to the end
|
|
229
|
+
line = raw.strip()
|
|
230
|
+
if line.startswith("#"):
|
|
231
|
+
heading = heading or line.lstrip("#").strip()
|
|
232
|
+
line = ""
|
|
233
|
+
elif _is_readme_noise(line):
|
|
234
|
+
line = ""
|
|
235
|
+
if line:
|
|
236
|
+
paragraph.append(line.lstrip(">-* ").strip())
|
|
237
|
+
elif paragraph:
|
|
238
|
+
break
|
|
239
|
+
summary = " ".join(paragraph)
|
|
240
|
+
match = _SENTENCE_END.search(summary)
|
|
241
|
+
summary = summary[: match.start() + 1] if match else summary or heading
|
|
242
|
+
return summary if len(summary) <= DESCRIPTION_MAX_LEN else summary[: DESCRIPTION_MAX_LEN - 1].rstrip() + "…"
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def _ado_details(org: str, repo: RemoteRepo, headers: dict[str, str]) -> RemoteRepo:
|
|
246
|
+
"""`repo` plus README-derived description and default-branch last commit date (Azure DevOps has neither on the repo)."""
|
|
247
|
+
base = f"https://dev.azure.com/{quote(org)}/{quote(repo.project)}/_apis/git/repositories/{quote(repo.name)}"
|
|
248
|
+
# No README / empty repo / no access to the content: just a blank field, not a failed listing.
|
|
249
|
+
# JSON is requested explicitly: without it the items API answers with the raw file instead of `content`.
|
|
250
|
+
description = ""
|
|
251
|
+
for name in README_NAMES:
|
|
252
|
+
ok, readme = _ado_get(
|
|
253
|
+
f"{base}/items", {**headers, "Accept": "application/json"}, {"path": f"/{name}", "includeContent": "true"}
|
|
254
|
+
)
|
|
255
|
+
if ok and isinstance(readme, dict):
|
|
256
|
+
description = readme_summary(readme.get("content") or "")
|
|
257
|
+
break
|
|
258
|
+
ok, commits = _ado_get(f"{base}/commits", headers, {"searchCriteria.$top": 1})
|
|
259
|
+
last_commit = CommitInfo()
|
|
260
|
+
if ok and isinstance(commits, dict) and commits.get("value"):
|
|
261
|
+
c = commits["value"][0]
|
|
262
|
+
last_commit = CommitInfo(c.get("commitId", ""), c.get("committer", {}).get("date", ""), c.get("author", {}).get("name", ""))
|
|
263
|
+
return replace(repo, description=description, last_commit=last_commit)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def _github_last_commit(client: GitHubClient, repo: RemoteRepo) -> RemoteRepo:
|
|
267
|
+
"""`repo` with its default branch's newest commit (the repo listing only has the last push time)."""
|
|
268
|
+
# Any HTTP error is non-fatal for the listing (like a failing ADO project): keep the push time from the listing.
|
|
269
|
+
# 404/409 (no access / empty repo) are expected; anything else (rate limit, 5xx) is worth a warning.
|
|
270
|
+
r = client.request(
|
|
271
|
+
"GET",
|
|
272
|
+
f"repos/{quote(repo.project, safe='')}/{quote(repo.name, safe='')}/commits",
|
|
273
|
+
ok=tuple(range(400, 600)),
|
|
274
|
+
params={"per_page": 1},
|
|
275
|
+
)
|
|
276
|
+
if r.status_code not in (200, 404, 409):
|
|
277
|
+
print(f"warning: couldn't read the newest commit of '{repo.project}/{repo.name}': HTTP {r.status_code}", file=sys.stderr)
|
|
278
|
+
commits = r.json() if r.status_code == 200 else []
|
|
279
|
+
if not commits:
|
|
280
|
+
return repo
|
|
281
|
+
c = commits[0]
|
|
282
|
+
git = c.get("commit", {})
|
|
283
|
+
return replace(repo, last_commit=CommitInfo(c.get("sha", ""), git.get("committer", {}).get("date", ""), git.get("author", {}).get("name", "")))
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def list_remote(
|
|
287
|
+
*, org: str | None, github_org: str | None, pat: str | None = None, fast: bool = False
|
|
288
|
+
) -> list[RemoteRepo]:
|
|
289
|
+
"""Every repo of `org` (Azure DevOps) and/or `github_org` (GitHub), sorted by project and name.
|
|
290
|
+
|
|
291
|
+
GitHub repos carry their description and last push time already. Unless `fast`, each repo also costs
|
|
292
|
+
one request for its newest commit (id, author, exact date) -- GitHub -- or two (that plus the README
|
|
293
|
+
for a description, which Azure DevOps lacks) -- Azure DevOps. They run concurrently like the project fan-out.
|
|
294
|
+
"""
|
|
295
|
+
repos: list[RemoteRepo] = []
|
|
296
|
+
headers = auth_header(pat) if org else {}
|
|
297
|
+
gh = require_gh() if github_org else None
|
|
298
|
+
with ThreadPoolExecutor(max_workers=2) as pool:
|
|
299
|
+
searches = []
|
|
300
|
+
if org:
|
|
301
|
+
searches.append(pool.submit(_ado_all_repos, org, headers))
|
|
302
|
+
if github_org and gh:
|
|
303
|
+
searches.append(pool.submit(_github_all_repos, gh, github_org, None)) # no cap: it lists *all* repos
|
|
304
|
+
for search in searches:
|
|
305
|
+
repos += search.result()
|
|
306
|
+
|
|
307
|
+
if not fast:
|
|
308
|
+
def details(r: RemoteRepo) -> RemoteRepo:
|
|
309
|
+
if r.source == "github":
|
|
310
|
+
assert gh
|
|
311
|
+
return _github_last_commit(gh, r)
|
|
312
|
+
assert org
|
|
313
|
+
return _ado_details(org, r, headers)
|
|
314
|
+
|
|
315
|
+
with ThreadPoolExecutor(max_workers=8) as pool:
|
|
316
|
+
repos = list(pool.map(details, repos))
|
|
317
|
+
return sorted(repos, key=lambda r: (r.project.lower(), r.name.lower()))
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def _local_last_commit(path: Path) -> CommitInfo:
|
|
321
|
+
"""Newest commit across all of a clone's branches (empty for a clone without commits)."""
|
|
322
|
+
try:
|
|
323
|
+
r = subprocess.run(
|
|
324
|
+
["git", "log", "-1", "--all", "--format=%H%x00%cI%x00%an"], cwd=path, capture_output=True, text=True, check=False
|
|
325
|
+
)
|
|
326
|
+
except FileNotFoundError:
|
|
327
|
+
sys.exit("'git' is required for this command but wasn't found on PATH.")
|
|
328
|
+
parts = r.stdout.strip().split("\x00")
|
|
329
|
+
return CommitInfo(*parts) if len(parts) == 3 else CommitInfo()
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def list_local(root: Path) -> list[tuple[Path, str, CommitInfo]]:
|
|
333
|
+
"""Every clone under `root` as (path, README one-liner, newest commit)."""
|
|
334
|
+
result = []
|
|
335
|
+
for path in sorted(find_repos(root)):
|
|
336
|
+
readme = next((path / n for n in README_NAMES if (path / n).is_file()), None)
|
|
337
|
+
text = readme.read_text(encoding="utf-8", errors="replace") if readme else ""
|
|
338
|
+
result.append((path, readme_summary(text), _local_last_commit(path)))
|
|
339
|
+
return result
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def run_list(
|
|
343
|
+
*,
|
|
344
|
+
root: Path | None,
|
|
345
|
+
org: str | None,
|
|
346
|
+
github_org: str | None = None,
|
|
347
|
+
local: bool = False,
|
|
348
|
+
fast: bool = False,
|
|
349
|
+
as_json: bool = False,
|
|
350
|
+
pat: str | None = None,
|
|
351
|
+
) -> None:
|
|
352
|
+
"""`bdt list-repo`: print every repo with its last commit date and description.
|
|
353
|
+
|
|
354
|
+
Lists `org`'s Azure DevOps repos and/or `github_org`'s GitHub repos; with neither (or with
|
|
355
|
+
`local`) lists the clones under `root` (default `work_dir()`) instead.
|
|
356
|
+
"""
|
|
357
|
+
entries: list[dict[str, str]]
|
|
358
|
+
if local or not (org or github_org):
|
|
359
|
+
search_root = root or work_dir()
|
|
360
|
+
if not search_root.is_dir():
|
|
361
|
+
sys.exit(
|
|
362
|
+
f"Local work dir {search_root} doesn't exist. Set AZDO_WORK_DIR (or BMS_WORK_DIR) to "
|
|
363
|
+
"where your repos are cloned, or pass --root."
|
|
364
|
+
)
|
|
365
|
+
if not local:
|
|
366
|
+
print("No org configured (AZDO_ORG / GITHUB_ORG or --org / --github-org): listing local clones.", file=sys.stderr)
|
|
367
|
+
entries = [{"name": p.name, "location": str(p), **_commit_fields(c), "description": d} for p, d, c in list_local(search_root)]
|
|
368
|
+
labels = [e["location"] for e in entries]
|
|
369
|
+
else:
|
|
370
|
+
remote = list_remote(org=org, github_org=github_org, pat=pat, fast=fast)
|
|
371
|
+
entries = [
|
|
372
|
+
{
|
|
373
|
+
"project": r.project,
|
|
374
|
+
"name": r.name,
|
|
375
|
+
"source": r.source,
|
|
376
|
+
"url": r.remote_url,
|
|
377
|
+
**_commit_fields(r.last_commit),
|
|
378
|
+
"description": r.description,
|
|
379
|
+
}
|
|
380
|
+
for r in remote
|
|
381
|
+
]
|
|
382
|
+
labels = [f"{r.project}/{r.name}" for r in remote]
|
|
383
|
+
|
|
384
|
+
if as_json:
|
|
385
|
+
print(json.dumps(entries, indent=2, ensure_ascii=False))
|
|
386
|
+
return
|
|
387
|
+
# Descriptions and authors are remote-controlled text: don't let them drive the terminal (JSON above keeps them verbatim).
|
|
388
|
+
labels = [_printable(label) for label in labels]
|
|
389
|
+
authors = [_printable(e["last_commit_author"]) for e in entries]
|
|
390
|
+
label_w, author_w = max(map(len, labels), default=0), max(map(len, authors), default=0)
|
|
391
|
+
for label, author, e in zip(labels, authors, entries):
|
|
392
|
+
commit = f"{e['last_commit_date'][:10]:<10} {e['last_commit_id'][:8]:<8} {author:<{author_w}}"
|
|
393
|
+
print(f"{label:<{label_w}} {commit} {_printable(e['description'])}".rstrip())
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def _printable(text: str) -> str:
|
|
397
|
+
"""`text` with control characters (ESC, tabs, newlines, ...) replaced by spaces."""
|
|
398
|
+
return "".join(c if c.isprintable() else " " for c in text)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def _commit_fields(c: CommitInfo) -> dict[str, str]:
|
|
402
|
+
return {"last_commit_id": c.id, "last_commit_date": c.date, "last_commit_author": c.author}
|
|
171
403
|
|
|
172
404
|
|
|
173
405
|
def clone(remote_url: str, dest: Path, auth: dict[str, str] | None = None) -> subprocess.CompletedProcess:
|
|
@@ -10,7 +10,7 @@ packages = ["bmsdna"]
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "bmsdna-devtools"
|
|
13
|
-
version = "0.
|
|
13
|
+
version = "0.56.0"
|
|
14
14
|
description = "Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects"
|
|
15
15
|
readme = "README.md"
|
|
16
16
|
requires-python = ">=3.14" # pgdevkit>=0.7.1 requires 3.14; was >=3.11 before adding it as a dependency
|
|
@@ -195,6 +195,17 @@ copies an env file in (auto-detects `.local_env` then `.env`), and runs
|
|
|
195
195
|
`--install` inside the new worktree if given. Prefer this over raw
|
|
196
196
|
`git worktree add` so env-file copying and submodule init aren't forgotten.
|
|
197
197
|
|
|
198
|
+
## Listing all repos
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
bdt list-repo [--org MYORG] [--github-org MYORG] [--local] [--fast] [--json]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Every repo of the Azure DevOps / GitHub org (`AZDO_ORG`, `GITHUB_ORG`; else the local clones) with newest commit
|
|
205
|
+
(date, id, author) and a README/GitHub one-line description -- use it to see what repos exist before `bdt find-repo <name>`
|
|
206
|
+
locates or clones one. `--json` gives an array of objects (`project`, `name`, `url`, `last_commit_id`, `last_commit_date`,
|
|
207
|
+
`last_commit_author`, `description`) for processing; `--fast` skips the per-repo requests for commit and README.
|
|
208
|
+
|
|
198
209
|
## Committing and pushing
|
|
199
210
|
|
|
200
211
|
```bash
|