bmsdna-devtools 0.51.0__tar.gz → 0.53.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.51.0 → bmsdna_devtools-0.53.0}/PKG-INFO +23 -4
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/README.md +22 -3
- bmsdna_devtools-0.53.0/bmsdna/devtools/ado_auth.py +177 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/azure_auth.py +6 -2
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/ci_plan_env.py +7 -3
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/cli.py +144 -43
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gh_pr.py +146 -10
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_build.py +258 -13
- bmsdna_devtools-0.53.0/bmsdna/devtools/pr_cancel.py +146 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_info.py +45 -12
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/pipeline.py +14 -6
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/report.py +4 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/04_facts.sql +12 -11
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/05_views.sql +5 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/pyproject.toml +1 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/skills/bmsdna-devtools/SKILL.md +3 -0
- bmsdna_devtools-0.53.0/tests/test_ado_auth.py +233 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_ci_plan_env.py +41 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_commit.py +1 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_issue.py +9 -9
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_pr_create.py +1 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_pr_id.py +3 -3
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_issue_for_me.py +4 -3
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_build.py +3 -3
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_build_flow.py +3 -3
- bmsdna_devtools-0.53.0/tests/test_pr_cancel_build.py +718 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_choice.py +7 -6
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_description_not_truncated.py +1 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_info.py +10 -6
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_usage.py +31 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_wait_timeout.py +1 -1
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/uv.lock +1 -1
- bmsdna_devtools-0.51.0/bmsdna/devtools/ado_auth.py +0 -28
- bmsdna_devtools-0.51.0/tests/test_ado_auth.py +0 -71
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/.github/workflows/python-test.yml +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/.gitignore +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/.python-version +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/_api_dump.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/ado_issue.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/agent_mentions.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/api_usage.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/app_service_logs.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/azure_arm.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/business_user.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/ci_plan.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/cli_tools.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/commit.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/dead_code.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/env_config.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/find_injection.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/find_repo.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gh_args.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gh_issue.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/github_api.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gitrepo.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/injection_frontend.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/injection_python.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/issue_do.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/issue_show.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/issue_watch.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_models.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_sql.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_sql_files.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_tooling.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_typescript.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/logs.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_create_args.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_issue_link.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_labels.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_markdown.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_ref.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pull.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/testdb.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/translate.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/cli.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/worktree.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/justfile +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/conftest.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/fake_github.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_ado_issue.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_ado_issue_flow.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_agent_mentions.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_api_usage.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_azure_arm.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_business_user.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_ci_plan.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_cleanup.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_commit.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_env_config.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_env_files.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_find_injection.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_find_repo.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_gh_issue.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_gh_pr.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_github_api.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_gitrepo.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_issue_do.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_issue_show.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_issue_watch.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_lint.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_lint_models.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_lint_sql.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_lint_sql_files.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_lint_typescript.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_logs.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_build_create_options.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_create_args.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_labels.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_markdown.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_pull.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_testdb.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.0}/tests/test_translate.py +0 -0
- {bmsdna_devtools-0.51.0 → bmsdna_devtools-0.53.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.53.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
|
|
@@ -126,7 +126,7 @@ bdt pr info [--json] [--pr-id PR]... [--target-branch BRANCH] [--all]
|
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
One-shot summary of the current branch's PR: link, state (open/merged/closed, draft), aggregate
|
|
129
|
-
build state (`passing`, `failing`, `pending`, `waiting` for a manual approval, `none`) and the
|
|
129
|
+
build state (`passing`, `failing`, `cancelled`, `pending`, `waiting` for a manual approval, `none`) and the
|
|
130
130
|
issue(s)/work item(s) it closes, with links. Exits 1 when the branch has no PR. `--json` is what
|
|
131
131
|
a status integration reads (e.g. the Claude Code mod planned in bmsuisse/skills#61). Build state is judged the way `bdt pr status` does: on GitHub from
|
|
132
132
|
the check rollup (only a failed check fails it; skipped/cancelled ones don't count), on Azure DevOps
|
|
@@ -185,6 +185,17 @@ by a GitHub Actions run (e.g. a legacy commit status from an external CI)
|
|
|
185
185
|
can't be retried this way and are skipped; if none of the failing checks are
|
|
186
186
|
retryable, the command exits with an error.
|
|
187
187
|
|
|
188
|
+
## `bdt pr cancel-build` / `requeue-build` / `abandon`
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
bdt pr cancel-build --reason "..." [--session ID_OR_URL] [--pr-id N] # comment "CANCELLED BUILD: ..."
|
|
192
|
+
bdt pr requeue-build [--all] [--pr-id N] # new build; `retry` only reruns failed stages
|
|
193
|
+
bdt pr abandon --reason "..." [--session ID_OR_URL] [--pr-id N] # comment "ABANDONED PR: ..."
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`bdt pr info` / `bdt pr status` show the reason (and agent session) of a cancelled build or abandoned PR; run
|
|
197
|
+
`--help` for details.
|
|
198
|
+
|
|
188
199
|
## `bdt pr watch-deploy`
|
|
189
200
|
|
|
190
201
|
Many pipelines have a second build/stage that only runs on the *target*
|
|
@@ -923,8 +934,12 @@ Order of decision, always logged with its reason:
|
|
|
923
934
|
4. Anything unreadable (label API, change list) runs everything: a missing decision never silently skips tests.
|
|
924
935
|
|
|
925
936
|
Outputs (Azure Pipelines variables with `isOutput=true`; plain `name=value` lines elsewhere): `runTests`, and per tier
|
|
926
|
-
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner
|
|
927
|
-
tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`.
|
|
937
|
+
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (repo-
|
|
938
|
+
relative). A tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`. For
|
|
939
|
+
custom sharding or a runner that does not take paths, use `<tier>Areas` (a space-separated list: keep area names free
|
|
940
|
+
of whitespace if you split it): in folder mode the `<tier>Paths` of a full run
|
|
941
|
+
is the bare tier folder, which may also hold things that are not tests (`.venv`, `test-results`); in glob mode it is the
|
|
942
|
+
list of test files either way. A moved file counts as changed under both its old and its new path.
|
|
928
943
|
|
|
929
944
|
```yaml
|
|
930
945
|
- stage: Plan
|
|
@@ -1249,6 +1264,10 @@ writes `report.html` (charts plus a table view, light/dark) with CSV / Parquet e
|
|
|
1249
1264
|
(`~/.cache/bdt/usage/`, or `--db` / `--out`). The report is self-contained and contains your session titles and agent
|
|
1250
1265
|
descriptions, so look at it before sharing it.
|
|
1251
1266
|
|
|
1267
|
+
- **Before vs. after:** the turns of a session before it loaded `dev-workflow` (or ran its first workflow command such as
|
|
1268
|
+
`bdt worktree`) are their own step, "Before dev-workflow was loaded", for the main thread and for the subagents spawned
|
|
1269
|
+
then. Everything from that point on is split into the steps below. The summary has `cost_before_workflow` /
|
|
1270
|
+
`cost_after_workflow`. Sessions that never load it are not counted, unless `--scope all`.
|
|
1252
1271
|
- **Steps:** setup, plan, plan review, implement, test, screenshots, design review, quick review, full review, publish / CI.
|
|
1253
1272
|
Every model turn is assigned to one by markers in its tool calls: skill calls (`bms-code-review --quick|--full`,
|
|
1254
1273
|
`design-review`, `bms-plan-review`; for codex, reading the skill's `SKILL.md`), `bdt` commands, edits (`apply_patch` for
|
|
@@ -108,7 +108,7 @@ bdt pr info [--json] [--pr-id PR]... [--target-branch BRANCH] [--all]
|
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
One-shot summary of the current branch's PR: link, state (open/merged/closed, draft), aggregate
|
|
111
|
-
build state (`passing`, `failing`, `pending`, `waiting` for a manual approval, `none`) and the
|
|
111
|
+
build state (`passing`, `failing`, `cancelled`, `pending`, `waiting` for a manual approval, `none`) and the
|
|
112
112
|
issue(s)/work item(s) it closes, with links. Exits 1 when the branch has no PR. `--json` is what
|
|
113
113
|
a status integration reads (e.g. the Claude Code mod planned in bmsuisse/skills#61). Build state is judged the way `bdt pr status` does: on GitHub from
|
|
114
114
|
the check rollup (only a failed check fails it; skipped/cancelled ones don't count), on Azure DevOps
|
|
@@ -167,6 +167,17 @@ by a GitHub Actions run (e.g. a legacy commit status from an external CI)
|
|
|
167
167
|
can't be retried this way and are skipped; if none of the failing checks are
|
|
168
168
|
retryable, the command exits with an error.
|
|
169
169
|
|
|
170
|
+
## `bdt pr cancel-build` / `requeue-build` / `abandon`
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
bdt pr cancel-build --reason "..." [--session ID_OR_URL] [--pr-id N] # comment "CANCELLED BUILD: ..."
|
|
174
|
+
bdt pr requeue-build [--all] [--pr-id N] # new build; `retry` only reruns failed stages
|
|
175
|
+
bdt pr abandon --reason "..." [--session ID_OR_URL] [--pr-id N] # comment "ABANDONED PR: ..."
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`bdt pr info` / `bdt pr status` show the reason (and agent session) of a cancelled build or abandoned PR; run
|
|
179
|
+
`--help` for details.
|
|
180
|
+
|
|
170
181
|
## `bdt pr watch-deploy`
|
|
171
182
|
|
|
172
183
|
Many pipelines have a second build/stage that only runs on the *target*
|
|
@@ -905,8 +916,12 @@ Order of decision, always logged with its reason:
|
|
|
905
916
|
4. Anything unreadable (label API, change list) runs everything: a missing decision never silently skips tests.
|
|
906
917
|
|
|
907
918
|
Outputs (Azure Pipelines variables with `isOutput=true`; plain `name=value` lines elsewhere): `runTests`, and per tier
|
|
908
|
-
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner
|
|
909
|
-
tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`.
|
|
919
|
+
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (repo-
|
|
920
|
+
relative). A tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`. For
|
|
921
|
+
custom sharding or a runner that does not take paths, use `<tier>Areas` (a space-separated list: keep area names free
|
|
922
|
+
of whitespace if you split it): in folder mode the `<tier>Paths` of a full run
|
|
923
|
+
is the bare tier folder, which may also hold things that are not tests (`.venv`, `test-results`); in glob mode it is the
|
|
924
|
+
list of test files either way. A moved file counts as changed under both its old and its new path.
|
|
910
925
|
|
|
911
926
|
```yaml
|
|
912
927
|
- stage: Plan
|
|
@@ -1231,6 +1246,10 @@ writes `report.html` (charts plus a table view, light/dark) with CSV / Parquet e
|
|
|
1231
1246
|
(`~/.cache/bdt/usage/`, or `--db` / `--out`). The report is self-contained and contains your session titles and agent
|
|
1232
1247
|
descriptions, so look at it before sharing it.
|
|
1233
1248
|
|
|
1249
|
+
- **Before vs. after:** the turns of a session before it loaded `dev-workflow` (or ran its first workflow command such as
|
|
1250
|
+
`bdt worktree`) are their own step, "Before dev-workflow was loaded", for the main thread and for the subagents spawned
|
|
1251
|
+
then. Everything from that point on is split into the steps below. The summary has `cost_before_workflow` /
|
|
1252
|
+
`cost_after_workflow`. Sessions that never load it are not counted, unless `--scope all`.
|
|
1234
1253
|
- **Steps:** setup, plan, plan review, implement, test, screenshots, design review, quick review, full review, publish / CI.
|
|
1235
1254
|
Every model turn is assigned to one by markers in its tool calls: skill calls (`bms-code-review --quick|--full`,
|
|
1236
1255
|
`design-review`, `bms-plan-review`; for codex, reading the skill's `SKILL.md`), `bdt` commands, edits (`apply_patch` for
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"""Azure DevOps auth: explicit PAT (`--pat` / AZURE_DEVOPS_EXT_PAT / AZURE_DEVOPS_PAT), or a token from
|
|
2
|
+
`DefaultAzureCredential` (see `azure_auth`)."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import base64
|
|
7
|
+
import re
|
|
8
|
+
from urllib.parse import parse_qs, urlparse
|
|
9
|
+
|
|
10
|
+
import requests
|
|
11
|
+
|
|
12
|
+
from .azure_auth import get_azure_token
|
|
13
|
+
from .pr_cancel import one_line
|
|
14
|
+
from .gitrepo import AdoRemote, current_remote
|
|
15
|
+
|
|
16
|
+
# Well-known Azure DevOps resource ID; `<id>/.default` is its AAD scope.
|
|
17
|
+
ADO_RESOURCE_ID = "499b84ac-1321-427f-aa17-267ca6975798"
|
|
18
|
+
|
|
19
|
+
PAT_SOURCES = "--pat / AZURE_DEVOPS_EXT_PAT / AZURE_DEVOPS_PAT"
|
|
20
|
+
# What a PAT needs for everything `bdt` does against Azure DevOps (PRs, builds, work items).
|
|
21
|
+
BDT_PAT_SCOPES = "Code (Read & write), Build (Read & execute), Work Items (Read & write)"
|
|
22
|
+
|
|
23
|
+
# REST API area -> the PAT scope a call into it needs at least
|
|
24
|
+
_SCOPE_BY_API = (
|
|
25
|
+
("/_apis/build/", "Build (Read & execute)"),
|
|
26
|
+
("/_apis/git/", "Code (Read & write)"),
|
|
27
|
+
("/_apis/policy/", "Code (Read & write)"),
|
|
28
|
+
("/_apis/wit/", "Work Items (Read & write)"),
|
|
29
|
+
("/_apis/userentitlements/", "MemberEntitlement Management (Read)"),
|
|
30
|
+
("/_apis/identities", "Identity (Read)"),
|
|
31
|
+
("/_apis/graph/", "Graph (Read)"),
|
|
32
|
+
)
|
|
33
|
+
_ORG_RE = re.compile(r"^/([^/]+)")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class AdoAuthError(requests.HTTPError):
|
|
37
|
+
"""Azure DevOps rejected the credentials (401), or accepted them but refuses the call (403): the message
|
|
38
|
+
already says which PAT scope / login to fix, so it is meant to be shown as is."""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def pat_settings_url(org: str | None) -> str:
|
|
42
|
+
if org:
|
|
43
|
+
return f"https://dev.azure.com/{org}/_usersSettings/tokens"
|
|
44
|
+
return "https://dev.azure.com/ (user settings > Personal access tokens)"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _remote_org() -> str | None:
|
|
48
|
+
"""The org of the current checkout's `origin`, if it is an Azure DevOps one (best effort: auth also fails
|
|
49
|
+
outside a checkout)."""
|
|
50
|
+
try:
|
|
51
|
+
remote = current_remote()
|
|
52
|
+
except Exception: # noqa: BLE001 -- not a git checkout / unknown remote: just no org to name
|
|
53
|
+
return None
|
|
54
|
+
return remote.org if isinstance(remote, AdoRemote) else None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_az_devops_token() -> str:
|
|
58
|
+
org = _remote_org()
|
|
59
|
+
hint = (
|
|
60
|
+
"No Azure DevOps credentials: no PAT was given (--pat, AZURE_DEVOPS_EXT_PAT and AZURE_DEVOPS_PAT are all unset) "
|
|
61
|
+
"and there is no usable `az login`.\n"
|
|
62
|
+
"Fix it with either:\n"
|
|
63
|
+
f" - a PAT: create one at {pat_settings_url(org)} (scopes: {BDT_PAT_SCOPES}), then "
|
|
64
|
+
"`export AZURE_DEVOPS_EXT_PAT=<token>` or pass --pat\n"
|
|
65
|
+
" - `az login` as a user with access to the organization"
|
|
66
|
+
)
|
|
67
|
+
return get_azure_token(f"{ADO_RESOURCE_ID}/.default", hint=hint)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def auth_header(pat: str | None) -> dict[str, str]:
|
|
71
|
+
"""Basic-auth header for an explicit PAT, else Bearer via `DefaultAzureCredential`.
|
|
72
|
+
|
|
73
|
+
Never hardcode a PAT literal in a caller — pass it in from an env var
|
|
74
|
+
(e.g. AZURE_DEVOPS_EXT_PAT) or a CLI flag, or omit it and let azure-identity supply a
|
|
75
|
+
short-lived token from the operator's own login.
|
|
76
|
+
"""
|
|
77
|
+
if pat:
|
|
78
|
+
token = base64.b64encode(f":{pat}".encode()).decode()
|
|
79
|
+
return {"Authorization": f"Basic {token}"}
|
|
80
|
+
return {"Authorization": f"Bearer {get_az_devops_token()}"}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _ado_message(response: requests.Response) -> str | None:
|
|
84
|
+
try:
|
|
85
|
+
message = response.json().get("message")
|
|
86
|
+
except (ValueError, AttributeError):
|
|
87
|
+
return None
|
|
88
|
+
return one_line(message) if isinstance(message, str) and message.strip() else None
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _is_sign_in_url(url: str) -> bool:
|
|
92
|
+
return urlparse(url).path.rstrip("/").endswith("/_signin")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _requested_url(response: requests.Response) -> str:
|
|
96
|
+
"""The URL that was asked for. A rejected PAT is redirected to a sign-in page, which is what `response.url` is then
|
|
97
|
+
(and `response.history` is only filled in once the whole redirect chain is done, after the hook ran); the page
|
|
98
|
+
carries the original URL as `reply_to`."""
|
|
99
|
+
if response.history:
|
|
100
|
+
return response.history[0].url
|
|
101
|
+
if _is_sign_in_url(response.url):
|
|
102
|
+
reply_to = parse_qs(urlparse(response.url).query).get("reply_to")
|
|
103
|
+
if reply_to:
|
|
104
|
+
return reply_to[0]
|
|
105
|
+
return response.url
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def auth_failure_message(response: requests.Response, pat_used: bool) -> str:
|
|
109
|
+
"""Why `response` (a 401/403 from Azure DevOps) happened and how to fix it, for the credentials in use."""
|
|
110
|
+
parsed = urlparse(_requested_url(response))
|
|
111
|
+
org_match = _ORG_RE.match(parsed.path) if parsed.netloc == "dev.azure.com" else None
|
|
112
|
+
org = org_match.group(1) if org_match else _remote_org()
|
|
113
|
+
scope = next((s for api, s in _SCOPE_BY_API if api in parsed.path), None)
|
|
114
|
+
where = f"{parsed.scheme}://{parsed.netloc}{parsed.path}"
|
|
115
|
+
lines = []
|
|
116
|
+
if response.status_code == 403:
|
|
117
|
+
lines.append(f"Azure DevOps refused the call (HTTP 403) -- {where}")
|
|
118
|
+
else:
|
|
119
|
+
lines.append(f"Azure DevOps did not accept the credentials (HTTP 401) -- {where}")
|
|
120
|
+
says = _ado_message(response)
|
|
121
|
+
if says:
|
|
122
|
+
lines.append(f"Azure DevOps says: {says}")
|
|
123
|
+
if pat_used:
|
|
124
|
+
lines.append(f"Credentials: the PAT from {PAT_SOURCES}.")
|
|
125
|
+
causes: list[str] = ["it lacks the scope this call needs" + (f" ({scope})" if scope else "")]
|
|
126
|
+
if response.status_code != 403:
|
|
127
|
+
causes += ["it has expired or was revoked", "it was created for a different organization" + (f" than '{org}'" if org else "")]
|
|
128
|
+
else:
|
|
129
|
+
causes += ["your account itself lacks the permission"]
|
|
130
|
+
lines.append("Most likely " + ", or ".join(causes) + ".")
|
|
131
|
+
lines.append(f"Fix or recreate it at {pat_settings_url(org)} (scopes bdt needs: {BDT_PAT_SCOPES}).")
|
|
132
|
+
else:
|
|
133
|
+
lines.append("Credentials: your `az login` token (no PAT given).")
|
|
134
|
+
lines.append(
|
|
135
|
+
"Run `az login` as a user with access to " + (f"organization '{org}'" if org else "the organization")
|
|
136
|
+
+ f", or use a PAT instead: create one at {pat_settings_url(org)} (scopes: {BDT_PAT_SCOPES}) and set AZURE_DEVOPS_EXT_PAT / pass --pat."
|
|
137
|
+
)
|
|
138
|
+
return "\n".join(lines)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _is_sign_in_page(response: requests.Response) -> bool:
|
|
142
|
+
"""Azure DevOps answers credentials it does not recognise by redirecting to a sign-in page (so 203, or 200 with
|
|
143
|
+
HTML) -- for its REST API, which otherwise only ever speaks JSON/text."""
|
|
144
|
+
if "/_apis/" not in _requested_url(response):
|
|
145
|
+
return False
|
|
146
|
+
if _is_sign_in_url(response.url):
|
|
147
|
+
return True
|
|
148
|
+
if response.status_code == 203:
|
|
149
|
+
return True
|
|
150
|
+
return response.status_code == 200 and "text/html" in response.headers.get("Content-Type", "")
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _check_auth_hook(pat_used: bool):
|
|
154
|
+
def hook(response: requests.Response, *args, **kwargs) -> requests.Response:
|
|
155
|
+
if _is_sign_in_page(response):
|
|
156
|
+
# one status for "not signed in", however Azure DevOps phrased it, so callers' `>= 400` checks agree
|
|
157
|
+
response.status_code = 401
|
|
158
|
+
if response.status_code in (401, 403):
|
|
159
|
+
error = AdoAuthError(auth_failure_message(response, pat_used), response=response)
|
|
160
|
+
|
|
161
|
+
def raise_for_status() -> None:
|
|
162
|
+
raise error
|
|
163
|
+
|
|
164
|
+
# replaces the generic "401 Client Error: Unauthorized for url" `raise_for_status` would raise
|
|
165
|
+
setattr(response, "raise_for_status", raise_for_status)
|
|
166
|
+
return response
|
|
167
|
+
|
|
168
|
+
return hook
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def ado_session(pat: str | None) -> requests.Session:
|
|
172
|
+
"""A `requests.Session` authenticated for Azure DevOps whose rejected calls fail with an `AdoAuthError`
|
|
173
|
+
(from `raise_for_status`) explaining which PAT / scope / login to fix, instead of a bare HTTP error."""
|
|
174
|
+
session = requests.Session()
|
|
175
|
+
session.headers.update(auth_header(pat))
|
|
176
|
+
session.hooks["response"].append(_check_auth_hook(bool(pat)))
|
|
177
|
+
return session
|
|
@@ -18,8 +18,9 @@ def _credential():
|
|
|
18
18
|
return DefaultAzureCredential(process_timeout=CLI_TIMEOUT_SECS)
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def get_azure_token(scope: str) -> str:
|
|
22
|
-
"""A bearer token for `scope` (e.g. `https://management.azure.com/.default`).
|
|
21
|
+
def get_azure_token(scope: str, hint: str | None = None) -> str:
|
|
22
|
+
"""A bearer token for `scope` (e.g. `https://management.azure.com/.default`). `hint` replaces the generic
|
|
23
|
+
"try `az login`" advice when the failing caller knows better (see `ado_auth`)."""
|
|
23
24
|
try:
|
|
24
25
|
from azure.core.exceptions import ClientAuthenticationError
|
|
25
26
|
except ImportError: # pragma: no cover -- a declared dependency
|
|
@@ -27,4 +28,7 @@ def get_azure_token(scope: str) -> str:
|
|
|
27
28
|
try:
|
|
28
29
|
return _credential().get_token(scope).token
|
|
29
30
|
except ClientAuthenticationError as e:
|
|
31
|
+
if hint:
|
|
32
|
+
# the credential chain's report lists every credential tried, one block each: the first line says it all
|
|
33
|
+
sys.exit(f"{hint}\n\n(azure-identity: {str(e).strip().splitlines()[0]})")
|
|
30
34
|
sys.exit(f"Azure authentication failed (try `az login`, or set AZURE_DEVOPS_EXT_PAT for Azure DevOps):\n{e}")
|
|
@@ -116,11 +116,15 @@ def _git(
|
|
|
116
116
|
|
|
117
117
|
def changed_files(target: str, *, merge_checkout: bool) -> list[str]:
|
|
118
118
|
"""Files the PR changes: in CI HEAD is the synthetic PR merge commit, compared with its first parent (the target);
|
|
119
|
-
for a local dry run the branch is compared with `origin/<target>` (it may contain ordinary merges).
|
|
119
|
+
for a local dry run the branch is compared with `origin/<target>` (it may contain ordinary merges).
|
|
120
|
+
`--no-renames` lists a moved file under its old path too: rename detection would hide the old path, so code moved
|
|
121
|
+
into a `non_code` folder (or a test moved between areas) would look like nothing happened to the old place.
|
|
122
|
+
`-z` keeps non-ASCII and other unusual names unquoted (git's default quoting would defeat every glob)."""
|
|
120
123
|
diff = ("HEAD^1", "HEAD") if merge_checkout else (f"origin/{target}...HEAD",)
|
|
124
|
+
out = _git("diff", "--name-only", "--no-renames", "-z", *diff).stdout
|
|
121
125
|
return [
|
|
122
|
-
|
|
123
|
-
]
|
|
126
|
+
path for path in out.split("\0") if path
|
|
127
|
+
] # -z: git would quote names like test_\303\274ber.py
|
|
124
128
|
|
|
125
129
|
|
|
126
130
|
def verify_fix_base(env: Mapping[str, str]) -> None:
|