bmsdna-devtools 0.57.1__tar.gz → 0.58.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.57.1 → bmsdna_devtools-0.58.0}/PKG-INFO +11 -6
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/README.md +10 -5
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/cli.py +13 -5
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/cli_tools.py +106 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/find_repo.py +90 -51
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/pyproject.toml +1 -1
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/skills/bmsdna-devtools/SKILL.md +6 -4
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_find_repo.py +129 -54
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_wait_timeout.py +120 -1
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/uv.lock +1 -1
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/.github/workflows/python-test.yml +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/.gitignore +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/.python-version +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/_api_dump.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/ado_auth.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/ado_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/agent_mentions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/api_usage.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/app_service_logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/azure_arm.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/azure_auth.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/business_user.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/ci_plan.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/ci_plan_env.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/commit.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/dead_code.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/deps/__init__.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/deps/advisories.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/deps/cli.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/deps/cooldown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/deps/lockfiles.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/deps/osv.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/deps/versions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/env_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/find_injection.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/gh_args.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/gh_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/gh_pr.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/github_api.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/gitrepo.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/injection_frontend.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/injection_python.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/issue_do.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/issue_show.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/issue_watch.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/lint.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/lint_models.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/lint_sql.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/lint_sql_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/lint_tooling.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/lint_typescript.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_build.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_cancel.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_create_args.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_drift.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_info.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_issue_link.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_labels.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_markdown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pr_ref.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/pull.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/testdb.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/translate.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/cli.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/pipeline.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/report.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/bmsdna/devtools/worktree.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/justfile +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/conftest.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/fake_github.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_ado_auth.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_ado_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_ado_issue_flow.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_agent_mentions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_api_usage.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_azure_arm.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_business_user.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_ci_plan.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_ci_plan_env.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_cleanup.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_commit.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_deps.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_pr_create.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_pr_id.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_commit.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_deps_advisories.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_deps_cooldown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_deps_lockfiles.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_deps_osv.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_deps_versions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_env_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_env_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_find_injection.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_gh_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_gh_pr.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_github_api.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_gitrepo.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_issue_do.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_issue_for_me.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_issue_show.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_issue_watch.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_lint.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_lint_models.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_lint_sql.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_lint_sql_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_lint_typescript.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_build.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_build_create_options.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_build_flow.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_cancel_build.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_choice.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_create_args.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_description_not_truncated.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_drift.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_info.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_labels.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_markdown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_pull.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_testdb.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_translate.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/tests/test_usage.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.58.0}/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.58.0
|
|
4
4
|
Summary: Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects
|
|
5
5
|
Requires-Python: >=3.14
|
|
6
6
|
Requires-Dist: azure-identity>=1.19.0
|
|
@@ -709,7 +709,7 @@ those orgs are searched.
|
|
|
709
709
|
## `bdt list-repo`
|
|
710
710
|
|
|
711
711
|
```bash
|
|
712
|
-
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json] [--pat PAT]
|
|
712
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json] [--pat PAT]
|
|
713
713
|
```
|
|
714
714
|
|
|
715
715
|
The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
|
|
@@ -726,11 +726,16 @@ configured, or with `--local`, it lists the clones under the work dir instead (t
|
|
|
726
726
|
- **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
|
|
727
727
|
first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
|
|
728
728
|
- **Commit:** the newest commit of the default branch (GitHub / Azure DevOps).
|
|
729
|
-
- **
|
|
730
|
-
(
|
|
731
|
-
|
|
729
|
+
- **Disabled repos:** Azure DevOps (and GitHub) repos that are disabled are left out. `--include-disabled` lists them too,
|
|
730
|
+
marked `(DISABLED)` in the description column of the text output and `"disabled": true` in `--json`. A disabled Azure DevOps
|
|
731
|
+
repo has no commit or description (they aren't readable, so they aren't requested). Azure DevOps has no disabled *projects*,
|
|
732
|
+
only disabled repos.
|
|
733
|
+
- **Cost:** GitHub returns descriptions and newest commits in one GraphQL query per 100 repos (about 5 s for 43 repos).
|
|
734
|
+
Azure DevOps needs a commit request per repo, plus README requests for repos that have commits, 16 at a time
|
|
735
|
+
(about 9 s for ~300 repos). `--fast` skips those for Azure DevOps, leaving commit and description empty.
|
|
736
|
+
Repos without commits, or whose commits can't be read, have empty fields.
|
|
732
737
|
- **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
|
|
733
|
-
`project`, `name`, `source` (`ado`/`github`), `git_url` (to clone), `web_url` (to open in the browser),
|
|
738
|
+
`project`, `name`, `source` (`ado`/`github`), `disabled`, `git_url` (to clone), `web_url` (to open in the browser),
|
|
734
739
|
`location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
|
|
735
740
|
Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
|
|
736
741
|
`origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
|
|
@@ -690,7 +690,7 @@ those orgs are searched.
|
|
|
690
690
|
## `bdt list-repo`
|
|
691
691
|
|
|
692
692
|
```bash
|
|
693
|
-
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json] [--pat PAT]
|
|
693
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json] [--pat PAT]
|
|
694
694
|
```
|
|
695
695
|
|
|
696
696
|
The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
|
|
@@ -707,11 +707,16 @@ configured, or with `--local`, it lists the clones under the work dir instead (t
|
|
|
707
707
|
- **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
|
|
708
708
|
first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
|
|
709
709
|
- **Commit:** the newest commit of the default branch (GitHub / Azure DevOps).
|
|
710
|
-
- **
|
|
711
|
-
(
|
|
712
|
-
|
|
710
|
+
- **Disabled repos:** Azure DevOps (and GitHub) repos that are disabled are left out. `--include-disabled` lists them too,
|
|
711
|
+
marked `(DISABLED)` in the description column of the text output and `"disabled": true` in `--json`. A disabled Azure DevOps
|
|
712
|
+
repo has no commit or description (they aren't readable, so they aren't requested). Azure DevOps has no disabled *projects*,
|
|
713
|
+
only disabled repos.
|
|
714
|
+
- **Cost:** GitHub returns descriptions and newest commits in one GraphQL query per 100 repos (about 5 s for 43 repos).
|
|
715
|
+
Azure DevOps needs a commit request per repo, plus README requests for repos that have commits, 16 at a time
|
|
716
|
+
(about 9 s for ~300 repos). `--fast` skips those for Azure DevOps, leaving commit and description empty.
|
|
717
|
+
Repos without commits, or whose commits can't be read, have empty fields.
|
|
713
718
|
- **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
|
|
714
|
-
`project`, `name`, `source` (`ado`/`github`), `git_url` (to clone), `web_url` (to open in the browser),
|
|
719
|
+
`project`, `name`, `source` (`ado`/`github`), `disabled`, `git_url` (to clone), `web_url` (to open in the browser),
|
|
715
720
|
`location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
|
|
716
721
|
Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
|
|
717
722
|
`origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
|
|
@@ -38,7 +38,7 @@ from . import translate as translate_mod
|
|
|
38
38
|
from . import pr_build, pr_cancel, pr_info as pr_info_mod, pr_issue_link, pr_merge_defaults, pr_ref, pr_labels, pull as pull_mod, worktree as worktree_mod
|
|
39
39
|
from .ado_auth import AdoAuthError, ado_session, auth_header
|
|
40
40
|
from .bdt_config import find_pyproject, load_bdt_table
|
|
41
|
-
from .cli_tools import CLI_TIMEOUT_SECS, EXIT_WAIT_TIMEOUT, detect_agent_session, require_gh
|
|
41
|
+
from .cli_tools import CLI_TIMEOUT_SECS, EXIT_WAIT_TIMEOUT, detect_agent_session, limit_by_enclosing_timeout, require_gh
|
|
42
42
|
from .github_api import GitHubClient
|
|
43
43
|
from .pr_create_args import PrCreateArgsError, extract_labels, parse_pr_create_args, resolve_body, unsupported_notes
|
|
44
44
|
from .deps.cli import deps_app
|
|
@@ -575,7 +575,8 @@ def pr_status(
|
|
|
575
575
|
"--timeout",
|
|
576
576
|
help="With --wait: stop after this many seconds if the checks are still running, print their current state and exit "
|
|
577
577
|
f"{EXIT_WAIT_TIMEOUT} (0 = wait forever, the default). Use it where the caller's own time limit is shorter than CI, "
|
|
578
|
-
"e.g. an agent's shell tool, then re-run the same command to keep waiting"
|
|
578
|
+
"e.g. an agent's shell tool, then re-run the same command to keep waiting. Under an enclosing `timeout N` (as in "
|
|
579
|
+
"`timeout 590 bdt pr status --wait`) it is cut to end shortly before that kills us, even without --timeout",
|
|
579
580
|
),
|
|
580
581
|
pr_id: int | None = typer.Option(None, "--pr-id", help=_PR_ID_HELP),
|
|
581
582
|
pat: str | None = typer.Option(None, "--pat", envvar=["AZURE_DEVOPS_EXT_PAT", "AZURE_DEVOPS_PAT"], help="Azure DevOps PAT (else uses DefaultAzureCredential, e.g. your `az login`)"),
|
|
@@ -586,6 +587,8 @@ def pr_status(
|
|
|
586
587
|
if timeout and not wait:
|
|
587
588
|
raise typer.BadParameter("--timeout only works together with --wait", param_hint="--timeout")
|
|
588
589
|
_check_poll_options(None, timeout)
|
|
590
|
+
if wait:
|
|
591
|
+
timeout = limit_by_enclosing_timeout(timeout)
|
|
589
592
|
remote = current_remote()
|
|
590
593
|
if isinstance(remote, GitHubRemote):
|
|
591
594
|
gh = require_gh()
|
|
@@ -2014,11 +2017,16 @@ def list_repo_cmd(
|
|
|
2014
2017
|
"--no-local",
|
|
2015
2018
|
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
2019
|
),
|
|
2020
|
+
include_disabled: bool = typer.Option(
|
|
2021
|
+
False,
|
|
2022
|
+
"--include-disabled",
|
|
2023
|
+
help="Also list disabled repos (left out by default): marked `(DISABLED)` in the text, `\"disabled\": true` in --json",
|
|
2024
|
+
),
|
|
2017
2025
|
fast: bool = typer.Option(
|
|
2018
2026
|
False,
|
|
2019
2027
|
"--fast",
|
|
2020
|
-
help="
|
|
2021
|
-
"
|
|
2028
|
+
help="Azure DevOps only: skip the commit and README requests per repo, leaving those columns empty "
|
|
2029
|
+
"(GitHub always comes with them, in one query per 100 repos)",
|
|
2022
2030
|
),
|
|
2023
2031
|
as_json: bool = typer.Option(False, "--json", help="Print a JSON array instead of aligned text"),
|
|
2024
2032
|
pat: str | None = typer.Option(
|
|
@@ -2038,7 +2046,7 @@ def list_repo_cmd(
|
|
|
2038
2046
|
git and browser URL, and the path of the local clone (see --no-local).
|
|
2039
2047
|
"""
|
|
2040
2048
|
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
|
|
2049
|
+
root=root, org=org, github_org=github_org, local=local, no_local=no_local, include_disabled=include_disabled, fast=fast, as_json=as_json, pat=pat
|
|
2042
2050
|
)
|
|
2043
2051
|
|
|
2044
2052
|
|
|
@@ -9,8 +9,11 @@ concerns for arguments that come from user input, e.g. PR titles).
|
|
|
9
9
|
|
|
10
10
|
from __future__ import annotations
|
|
11
11
|
|
|
12
|
+
import math
|
|
12
13
|
import os
|
|
14
|
+
import re
|
|
13
15
|
import shutil
|
|
16
|
+
import subprocess
|
|
14
17
|
import sys
|
|
15
18
|
import time
|
|
16
19
|
from collections.abc import Callable
|
|
@@ -39,6 +42,11 @@ EXIT_WAIT_TIMEOUT = 4
|
|
|
39
42
|
# not to spam a captured log.
|
|
40
43
|
POLL_HEARTBEAT_SECS = 600.0
|
|
41
44
|
|
|
45
|
+
# How long before an enclosing `timeout N bdt pr status --wait` would kill us the wait loop gives up on its own
|
|
46
|
+
# (see `limit_by_enclosing_timeout`): enough for a poll that is in flight (HTTP_TIMEOUT_SECS) plus printing the
|
|
47
|
+
# per-build details of the final status.
|
|
48
|
+
ENCLOSING_TIMEOUT_MARGIN_SECS = 30.0
|
|
49
|
+
|
|
42
50
|
# Bounds a single call to an external CLI (`gh`/`az`/`git`) or a single Azure DevOps REST
|
|
43
51
|
# request. Without a timeout, a stalled network call or the CLI blocking on an interactive
|
|
44
52
|
# prompt (e.g. an expired `az`/`gh` login) could hang a command -- most importantly a
|
|
@@ -114,6 +122,104 @@ def exit_wait_timeout(msg: str, print_details: Callable[[], object], deadline: W
|
|
|
114
122
|
sys.exit(EXIT_WAIT_TIMEOUT)
|
|
115
123
|
|
|
116
124
|
|
|
125
|
+
_TIMEOUT_COMMANDS = ("timeout", "gtimeout") # GNU coreutils; macOS has it as `gtimeout` unless aliased
|
|
126
|
+
_TIMEOUT_LONG_OPTIONS_WITH_VALUE = ("--kill-after", "--signal")
|
|
127
|
+
_DURATION_UNITS = {"": 1, "s": 1, "m": 60, "h": 3600, "d": 86400}
|
|
128
|
+
_ETIME_RE = re.compile(r"^(?:(?:(\d+)-)?(\d+):)?(\d+):(\d+)$") # [[dd-]hh:]mm:ss, as printed by `ps -o etime`
|
|
129
|
+
_MAX_ANCESTORS = 8
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def parse_timeout_command(args: list[str]) -> float | None:
|
|
133
|
+
"""The duration (seconds) of a `timeout [OPTION]... DURATION COMMAND...` command line, or None if `args` isn't
|
|
134
|
+
one, the duration is 0 / infinite (= no limit) or the options can't be read with confidence: not detecting a
|
|
135
|
+
limit is harmless, a wrong one would cut the wait short."""
|
|
136
|
+
if not args or os.path.basename(args[0]) not in _TIMEOUT_COMMANDS:
|
|
137
|
+
return None
|
|
138
|
+
rest = iter(args[1:])
|
|
139
|
+
for arg in rest:
|
|
140
|
+
if arg == "--":
|
|
141
|
+
arg = next(rest, "")
|
|
142
|
+
elif arg.startswith("--"):
|
|
143
|
+
# getopt accepts any unambiguous prefix of a long option (`--kill 5`)
|
|
144
|
+
if "=" not in arg and len(arg) > 2 and any(opt.startswith(arg) for opt in _TIMEOUT_LONG_OPTIONS_WITH_VALUE):
|
|
145
|
+
next(rest, None)
|
|
146
|
+
continue
|
|
147
|
+
elif arg.startswith("-") and arg != "-":
|
|
148
|
+
for pos, flag in enumerate(arg[1:], start=1):
|
|
149
|
+
if flag in "ks": # the value is the rest of the cluster (`-k5`), else the next argument
|
|
150
|
+
if pos == len(arg) - 1:
|
|
151
|
+
next(rest, None)
|
|
152
|
+
break
|
|
153
|
+
if flag not in "fpv":
|
|
154
|
+
return None
|
|
155
|
+
continue
|
|
156
|
+
return _parse_duration(arg)
|
|
157
|
+
return None
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _parse_duration(text: str) -> float | None:
|
|
161
|
+
m = re.fullmatch(r"(.+?)([smhd]?)", text)
|
|
162
|
+
try:
|
|
163
|
+
seconds = float(m.group(1)) * _DURATION_UNITS[m.group(2)] if m else 0.0
|
|
164
|
+
except ValueError:
|
|
165
|
+
return None
|
|
166
|
+
return seconds if math.isfinite(seconds) and seconds > 0 else None
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def _parse_etime(text: str) -> float | None:
|
|
170
|
+
m = _ETIME_RE.match(text.strip())
|
|
171
|
+
if not m:
|
|
172
|
+
return None
|
|
173
|
+
days, hours, minutes, seconds = (int(g or 0) for g in m.groups())
|
|
174
|
+
return float(((days * 24 + hours) * 60 + minutes) * 60 + seconds)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _process_info(pid: int) -> tuple[int, float, list[str]] | None:
|
|
178
|
+
"""(parent pid, seconds since it started, command line) of process `pid`, via `ps` (Linux and macOS; None
|
|
179
|
+
anywhere it isn't available, e.g. Windows)."""
|
|
180
|
+
try:
|
|
181
|
+
r = subprocess.run(["ps", "-o", "ppid=,etime=,args=", "-p", str(pid)], capture_output=True, encoding="utf-8", timeout=CLI_TIMEOUT_SECS, check=False)
|
|
182
|
+
except (OSError, subprocess.SubprocessError):
|
|
183
|
+
return None
|
|
184
|
+
parts = r.stdout.split(None, 2)
|
|
185
|
+
if r.returncode != 0 or len(parts) < 3 or not parts[0].isdigit():
|
|
186
|
+
return None
|
|
187
|
+
elapsed = _parse_etime(parts[1])
|
|
188
|
+
return (int(parts[0]), elapsed, parts[2].split()) if elapsed is not None else None
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def enclosing_timeout_remaining() -> float | None:
|
|
192
|
+
"""Seconds until a `timeout N ...` wrapped around this process (as in `timeout 590 bdt pr status --wait`) kills
|
|
193
|
+
it, or None when there is none (the closest limit when several are nested). Best-effort: walks up the parent
|
|
194
|
+
processes, so it also sees through the shells and launcher shims in between."""
|
|
195
|
+
remaining: float | None = None
|
|
196
|
+
pid = os.getppid()
|
|
197
|
+
for _ in range(_MAX_ANCESTORS):
|
|
198
|
+
if pid < 1 or (info := _process_info(pid)) is None:
|
|
199
|
+
break
|
|
200
|
+
ppid, elapsed, args = info
|
|
201
|
+
limit = parse_timeout_command(args)
|
|
202
|
+
if limit is not None:
|
|
203
|
+
remaining = min(remaining if remaining is not None else limit, max(limit - elapsed, 0.0))
|
|
204
|
+
pid = ppid
|
|
205
|
+
return remaining
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def limit_by_enclosing_timeout(timeout_secs: float) -> float:
|
|
209
|
+
"""`timeout_secs` of a `--wait` loop (0 = forever), cut down to end `ENCLOSING_TIMEOUT_MARGIN_SECS` before an
|
|
210
|
+
enclosing `timeout N` would kill us. Otherwise that kill drops everything we would have printed, which is
|
|
211
|
+
exactly what `--timeout` is there to avoid -- and callers (agents) keep wrapping the command in `timeout`
|
|
212
|
+
instead of passing `--timeout`."""
|
|
213
|
+
remaining = enclosing_timeout_remaining()
|
|
214
|
+
if remaining is None:
|
|
215
|
+
return timeout_secs
|
|
216
|
+
limit = max(remaining - ENCLOSING_TIMEOUT_MARGIN_SECS, 1.0)
|
|
217
|
+
if timeout_secs and timeout_secs <= limit:
|
|
218
|
+
return timeout_secs
|
|
219
|
+
print(f"Enclosing `timeout` ends in {remaining:.0f} s: giving up waiting after {limit:.0f} s so the status gets printed first.", file=sys.stderr)
|
|
220
|
+
return limit
|
|
221
|
+
|
|
222
|
+
|
|
117
223
|
def is_claude_code() -> bool:
|
|
118
224
|
"""True if this process is running as a subprocess of Claude Code.
|
|
119
225
|
|
|
@@ -86,10 +86,12 @@ class RemoteRepo:
|
|
|
86
86
|
source: str = "ado"
|
|
87
87
|
description: str = ""
|
|
88
88
|
last_commit: CommitInfo = CommitInfo()
|
|
89
|
+
disabled: bool = False
|
|
89
90
|
|
|
90
91
|
|
|
91
92
|
ADO_API_VERSION = "7.1"
|
|
92
93
|
ADO_PAGE_SIZE = 100
|
|
94
|
+
ADO_DETAIL_WORKERS = 16
|
|
93
95
|
|
|
94
96
|
|
|
95
97
|
def _ado_get(url: str, headers: dict[str, str], params: dict[str, str | int] | None = None) -> tuple[bool, dict | str]:
|
|
@@ -155,7 +157,10 @@ def _ado_all_repos(org: str, headers: dict[str, str]) -> list[RemoteRepo]:
|
|
|
155
157
|
print(f"warning: couldn't list repos for project '{project['name']}': {str(data).strip()}", file=sys.stderr)
|
|
156
158
|
return []
|
|
157
159
|
assert isinstance(data, dict)
|
|
158
|
-
return [
|
|
160
|
+
return [
|
|
161
|
+
RemoteRepo(project["name"], r["name"], r["remoteUrl"], disabled=bool(r.get("isDisabled")))
|
|
162
|
+
for r in data.get("value", [])
|
|
163
|
+
]
|
|
159
164
|
|
|
160
165
|
all_repos: list[RemoteRepo] = []
|
|
161
166
|
with ThreadPoolExecutor(max_workers=8) as pool:
|
|
@@ -170,7 +175,7 @@ def find_remote(org: str, name: str, pat: str | None = None) -> list[RemoteRepo]
|
|
|
170
175
|
return _prefer_exact(_ado_all_repos(org, headers), name, key=lambda r: r.name)
|
|
171
176
|
|
|
172
177
|
|
|
173
|
-
def _github_all_repos(client: GitHubClient, org: str
|
|
178
|
+
def _github_all_repos(client: GitHubClient, org: str) -> list[RemoteRepo]:
|
|
174
179
|
"""Every repo of `org`'s GitHub account.
|
|
175
180
|
|
|
176
181
|
Unlike Azure DevOps, GitHub has a single flat list of repos per org/user
|
|
@@ -185,13 +190,8 @@ def _github_all_repos(client: GitHubClient, org: str, limit: int | None = 1000)
|
|
|
185
190
|
path, params = "user/repos", {"affiliation": "owner"}
|
|
186
191
|
else:
|
|
187
192
|
path = f"users/{org_path}/repos"
|
|
188
|
-
items = client.paginate(path, params, 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
|
-
]
|
|
193
|
+
items = client.paginate(path, params, limit=1000)
|
|
194
|
+
return [RemoteRepo(org, r["name"], r["html_url"], source="github") for r in items]
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
def find_github(client: GitHubClient, org: str, name: str) -> list[RemoteRepo]:
|
|
@@ -243,9 +243,17 @@ def readme_summary(text: str) -> str:
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
def _ado_details(org: str, repo: RemoteRepo, headers: dict[str, str]) -> RemoteRepo:
|
|
246
|
-
"""`repo` plus
|
|
246
|
+
"""`repo` plus its default-branch newest commit and a README-derived description (Azure DevOps has neither on the repo)."""
|
|
247
247
|
base = f"https://dev.azure.com/{quote(org)}/{quote(repo.project)}/_apis/git/repositories/{quote(repo.name)}"
|
|
248
|
-
#
|
|
248
|
+
# Failures below are a blank field, not a failed listing (no access, empty repo, no README).
|
|
249
|
+
ok, commits = _ado_get(f"{base}/commits", headers, {"searchCriteria.$top": 1})
|
|
250
|
+
commit_list = commits.get("value") if ok and isinstance(commits, dict) else None
|
|
251
|
+
if commit_list == []:
|
|
252
|
+
return repo # a successful answer with no commits: no README either, don't spend requests on it
|
|
253
|
+
last_commit = CommitInfo() # also what a failed commit request leaves; the README may still be readable
|
|
254
|
+
if commit_list:
|
|
255
|
+
c = commit_list[0]
|
|
256
|
+
last_commit = CommitInfo(c.get("commitId", ""), c.get("committer", {}).get("date", ""), c.get("author", {}).get("name", ""))
|
|
249
257
|
# JSON is requested explicitly: without it the items API answers with the raw file instead of `content`.
|
|
250
258
|
description = ""
|
|
251
259
|
for name in README_NAMES:
|
|
@@ -255,42 +263,63 @@ def _ado_details(org: str, repo: RemoteRepo, headers: dict[str, str]) -> RemoteR
|
|
|
255
263
|
if ok and isinstance(readme, dict):
|
|
256
264
|
description = readme_summary(readme.get("content") or "")
|
|
257
265
|
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
266
|
return replace(repo, description=description, last_commit=last_commit)
|
|
264
267
|
|
|
265
268
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
269
|
+
_GITHUB_REPOS_QUERY = """
|
|
270
|
+
query($login: String!, $after: String) {
|
|
271
|
+
repositoryOwner(login: $login) {
|
|
272
|
+
repositories(first: 100, after: $after, ownerAffiliations: OWNER) {
|
|
273
|
+
pageInfo { hasNextPage endCursor }
|
|
274
|
+
nodes {
|
|
275
|
+
name url description pushedAt isDisabled
|
|
276
|
+
defaultBranchRef { target { ... on Commit { oid committedDate author { name } } } }
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
"""
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _github_repos_with_commits(client: GitHubClient, org: str) -> list[RemoteRepo]:
|
|
285
|
+
"""Every repo of `org` (an org or a user) with description and default-branch newest commit, 100 repos per request.
|
|
286
|
+
|
|
287
|
+
One GraphQL query per page gets what would take a REST request per repo for the commit. An empty
|
|
288
|
+
repo has no default branch: it keeps its push time.
|
|
289
|
+
"""
|
|
290
|
+
repos: list[RemoteRepo] = []
|
|
291
|
+
after: str | None = None
|
|
292
|
+
while True:
|
|
293
|
+
owner = client.graphql(_GITHUB_REPOS_QUERY, login=org, after=after)["repositoryOwner"]
|
|
294
|
+
if owner is None:
|
|
295
|
+
sys.exit(f"GitHub account '{org}' not found (or not visible to your token).")
|
|
296
|
+
page = owner["repositories"]
|
|
297
|
+
for r in page["nodes"]:
|
|
298
|
+
commit = ((r.get("defaultBranchRef") or {}).get("target")) or {}
|
|
299
|
+
last_commit = (
|
|
300
|
+
CommitInfo(commit.get("oid", ""), commit.get("committedDate", ""), (commit.get("author") or {}).get("name") or "")
|
|
301
|
+
if commit
|
|
302
|
+
else CommitInfo(date=r.get("pushedAt") or "")
|
|
303
|
+
)
|
|
304
|
+
repos.append(
|
|
305
|
+
RemoteRepo(
|
|
306
|
+
org, r["name"], r["url"], source="github", description=r.get("description") or "", last_commit=last_commit, disabled=bool(r.get("isDisabled"))
|
|
307
|
+
)
|
|
308
|
+
)
|
|
309
|
+
if not page["pageInfo"]["hasNextPage"]:
|
|
310
|
+
return repos
|
|
311
|
+
after = page["pageInfo"]["endCursor"]
|
|
284
312
|
|
|
285
313
|
|
|
286
314
|
def list_remote(
|
|
287
|
-
*, org: str | None, github_org: str | None, pat: str | None = None, fast: bool = False
|
|
315
|
+
*, org: str | None, github_org: str | None, pat: str | None = None, fast: bool = False, include_disabled: bool = False
|
|
288
316
|
) -> list[RemoteRepo]:
|
|
289
317
|
"""Every repo of `org` (Azure DevOps) and/or `github_org` (GitHub), sorted by project and name.
|
|
290
318
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
319
|
+
Disabled repos are left out unless `include_disabled` (they can't be cloned, and their commits and
|
|
320
|
+
README aren't readable, so they get no description or commit either). GitHub comes with description and
|
|
321
|
+
newest commit in one query per 100 repos. Azure DevOps costs a commit request plus up to a few README
|
|
322
|
+
requests per repo, run concurrently like the project fan-out, unless `fast`.
|
|
294
323
|
"""
|
|
295
324
|
repos: list[RemoteRepo] = []
|
|
296
325
|
headers = auth_header(pat) if org else {}
|
|
@@ -300,19 +329,19 @@ def list_remote(
|
|
|
300
329
|
if org:
|
|
301
330
|
searches.append(pool.submit(_ado_all_repos, org, headers))
|
|
302
331
|
if github_org and gh:
|
|
303
|
-
searches.append(pool.submit(
|
|
332
|
+
searches.append(pool.submit(_github_repos_with_commits, gh, github_org))
|
|
304
333
|
for search in searches:
|
|
305
334
|
repos += search.result()
|
|
306
335
|
|
|
307
|
-
if not
|
|
336
|
+
if not include_disabled:
|
|
337
|
+
repos = [r for r in repos if not r.disabled]
|
|
338
|
+
|
|
339
|
+
if org and not fast:
|
|
340
|
+
|
|
308
341
|
def details(r: RemoteRepo) -> RemoteRepo:
|
|
309
|
-
if r.source
|
|
310
|
-
assert gh
|
|
311
|
-
return _github_last_commit(gh, r)
|
|
312
|
-
assert org
|
|
313
|
-
return _ado_details(org, r, headers)
|
|
342
|
+
return r if r.source != "ado" or r.disabled else _ado_details(org, r, headers)
|
|
314
343
|
|
|
315
|
-
with ThreadPoolExecutor(max_workers=
|
|
344
|
+
with ThreadPoolExecutor(max_workers=ADO_DETAIL_WORKERS) as pool:
|
|
316
345
|
repos = list(pool.map(details, repos))
|
|
317
346
|
return sorted(repos, key=lambda r: (r.project.lower(), r.name.lower()))
|
|
318
347
|
|
|
@@ -413,6 +442,7 @@ def run_list(
|
|
|
413
442
|
github_org: str | None = None,
|
|
414
443
|
local: bool = False,
|
|
415
444
|
no_local: bool = False,
|
|
445
|
+
include_disabled: bool = False,
|
|
416
446
|
fast: bool = False,
|
|
417
447
|
as_json: bool = False,
|
|
418
448
|
pat: str | None = None,
|
|
@@ -425,7 +455,7 @@ def run_list(
|
|
|
425
455
|
"""
|
|
426
456
|
if local and no_local:
|
|
427
457
|
sys.exit("--local and --no-local contradict each other.")
|
|
428
|
-
entries: list[dict[str, str | None]]
|
|
458
|
+
entries: list[dict[str, str | bool | None]]
|
|
429
459
|
search_root = root or work_dir()
|
|
430
460
|
if local or not (org or github_org):
|
|
431
461
|
if no_local:
|
|
@@ -449,19 +479,28 @@ def run_list(
|
|
|
449
479
|
for r in list_local(search_root)
|
|
450
480
|
]
|
|
451
481
|
labels = [str(e["location"]) for e in entries]
|
|
482
|
+
descriptions = [str(e["description"]) for e in entries]
|
|
452
483
|
else:
|
|
453
|
-
remote = list_remote(org=org, github_org=github_org, pat=pat, fast=fast)
|
|
484
|
+
remote = list_remote(org=org, github_org=github_org, pat=pat, fast=fast, include_disabled=include_disabled)
|
|
454
485
|
# Without a work dir there is simply nothing cloned; only the --local listing insists that it exists.
|
|
455
486
|
clones = {} if no_local or not search_root.is_dir() else local_clones_by_web_url(search_root)
|
|
456
487
|
entries = []
|
|
457
488
|
for r in remote:
|
|
458
489
|
git_url, browse_url = _remote_urls(r)
|
|
459
|
-
entry: dict[str, str | None] = {
|
|
490
|
+
entry: dict[str, str | bool | None] = {
|
|
491
|
+
"project": r.project,
|
|
492
|
+
"name": r.name,
|
|
493
|
+
"source": r.source,
|
|
494
|
+
"disabled": r.disabled,
|
|
495
|
+
"git_url": git_url,
|
|
496
|
+
"web_url": browse_url,
|
|
497
|
+
}
|
|
460
498
|
if not no_local:
|
|
461
499
|
clone_path = clones.get(browse_url.lower())
|
|
462
500
|
entry["location"] = str(clone_path) if clone_path else None
|
|
463
501
|
entries.append({**entry, **_commit_fields(r.last_commit), "description": r.description})
|
|
464
502
|
labels = [f"{r.project}/{r.name}" for r in remote]
|
|
503
|
+
descriptions = ["(DISABLED) " * r.disabled + r.description for r in remote]
|
|
465
504
|
|
|
466
505
|
if as_json:
|
|
467
506
|
print(json.dumps(entries, indent=2, ensure_ascii=False))
|
|
@@ -470,9 +509,9 @@ def run_list(
|
|
|
470
509
|
labels = [_printable(label) for label in labels]
|
|
471
510
|
authors = [_printable(str(e["last_commit_author"])) for e in entries]
|
|
472
511
|
label_w, author_w = max(map(len, labels), default=0), max(map(len, authors), default=0)
|
|
473
|
-
for label, author, e in zip(labels, authors, entries):
|
|
512
|
+
for label, author, description, e in zip(labels, authors, descriptions, entries):
|
|
474
513
|
commit = f"{str(e['last_commit_date'])[:10]:<10} {str(e['last_commit_id'])[:8]:<8} {author:<{author_w}}"
|
|
475
|
-
print(f"{label:<{label_w}} {commit} {_printable(
|
|
514
|
+
print(f"{label:<{label_w}} {commit} {_printable(description)}".rstrip())
|
|
476
515
|
|
|
477
516
|
|
|
478
517
|
def _printable(text: str) -> str:
|
|
@@ -10,7 +10,7 @@ packages = ["bmsdna"]
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "bmsdna-devtools"
|
|
13
|
-
version = "0.
|
|
13
|
+
version = "0.58.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
|
|
@@ -54,7 +54,8 @@ only informational.
|
|
|
54
54
|
|
|
55
55
|
Where your shell tool has a time limit shorter than CI (it kills the command and drops its output), run
|
|
56
56
|
`bdt pr status --wait --timeout 540` (seconds, below the limit): after that long it prints the current state and
|
|
57
|
-
exits 4 — just run the same command again to keep waiting.
|
|
57
|
+
exits 4 — just run the same command again to keep waiting. (Wrapping it as `timeout 590 bdt pr status --wait` works
|
|
58
|
+
too: `bdt` sees the enclosing `timeout` and stops 30 s before it.) Exit 3 = a stage needs a human's approval.
|
|
58
59
|
|
|
59
60
|
`pr status`, `info`, `retry`, `publish`, `update`, `comment` (and `issue take`
|
|
60
61
|
without a number) find the PR opened from the current branch into **any**
|
|
@@ -198,14 +199,15 @@ copies an env file in (auto-detects `.local_env` then `.env`), and runs
|
|
|
198
199
|
## Listing all repos
|
|
199
200
|
|
|
200
201
|
```bash
|
|
201
|
-
bdt list-repo [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json]
|
|
202
|
+
bdt list-repo [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json]
|
|
202
203
|
```
|
|
203
204
|
|
|
204
205
|
Every repo of the Azure DevOps / GitHub org (`AZDO_ORG`, `GITHUB_ORG`; else the local clones) with newest commit
|
|
205
206
|
(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`, `git_url`, `web_url`, `location`, `last_commit_id`,
|
|
207
|
+
locates or clones one. `--json` gives an array of objects (`project`, `name`, `disabled`, `git_url`, `web_url`, `location`, `last_commit_id`,
|
|
207
208
|
`last_commit_date`, `last_commit_author`, `description`) for processing; `location` is your local clone of the repo (null if
|
|
208
|
-
none; `--no-local` skips the lookup and drops the key).
|
|
209
|
+
none; `--no-local` skips the lookup and drops the key). Disabled repos are hidden unless `--include-disabled`. `--fast` skips
|
|
210
|
+
the per-repo requests for commit and README (Azure DevOps).
|
|
209
211
|
|
|
210
212
|
## Committing and pushing
|
|
211
213
|
|