bmsdna-devtools 0.59.0__tar.gz → 1.1.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.59.0 → bmsdna_devtools-1.1.0}/.github/workflows/python-test.yml +2 -0
- bmsdna_devtools-0.59.0/README.md → bmsdna_devtools-1.1.0/PKG-INFO +38 -2
- bmsdna_devtools-0.59.0/PKG-INFO → bmsdna_devtools-1.1.0/README.md +19 -21
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/_api_dump.py +12 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/ado_auth.py +15 -10
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/ado_issue.py +97 -30
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/agent_mentions.py +1 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/api_usage.py +52 -20
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/app_service_logs.py +2 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/azure_arm.py +6 -4
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/azure_auth.py +6 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/business_user.py +12 -4
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/ci_plan.py +34 -94
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/ci_plan_env.py +43 -34
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/cli.py +520 -143
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/cli_tools.py +39 -22
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/commit.py +53 -20
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/dead_code.py +13 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/deps/advisories.py +9 -14
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/deps/cli.py +15 -10
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/deps/cooldown.py +3 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/deps/lockfiles.py +2 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/deps/osv.py +3 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/env_config.py +2 -5
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/find_injection.py +45 -27
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/find_repo.py +40 -14
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/gh_args.py +4 -5
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/gh_issue.py +38 -18
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/gh_pr.py +71 -33
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/github_api.py +18 -8
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/gitrepo.py +2 -8
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/injection_frontend.py +2 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/injection_python.py +14 -5
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/issue_do.py +12 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/issue_show.py +1 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/issue_watch.py +32 -8
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/lint.py +11 -8
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/lint_models.py +5 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/lint_sql.py +118 -42
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/lint_sql_files.py +6 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/lint_tooling.py +20 -8
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/lint_typescript.py +15 -4
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/logs.py +9 -8
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_build.py +166 -48
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_cancel.py +1 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_create_args.py +3 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_drift.py +23 -12
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_info.py +32 -13
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_issue_link.py +19 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_labels.py +5 -4
- bmsdna_devtools-1.1.0/bmsdna/devtools/pr_list.py +95 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_markdown.py +3 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_merge_defaults.py +6 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_ref.py +5 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pull.py +25 -9
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/testdb.py +8 -7
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/translate.py +9 -25
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/cli.py +45 -15
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/pipeline.py +46 -35
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/report.py +197 -77
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/worktree.py +51 -23
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/justfile +7 -1
- bmsdna_devtools-1.1.0/prek.toml +31 -0
- bmsdna_devtools-1.1.0/pyproject.toml +114 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/fake_github.py +8 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_ado_auth.py +19 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_ado_issue.py +50 -14
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_ado_issue_flow.py +78 -18
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_agent_mentions.py +7 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_api_usage.py +46 -13
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_azure_arm.py +7 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_business_user.py +47 -9
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_ci_plan.py +25 -86
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_ci_plan_env.py +185 -59
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_cleanup.py +3 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_commit.py +17 -5
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_issue.py +194 -21
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_pr_create.py +58 -21
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_pr_id.py +14 -5
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_commit.py +4 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_deps_advisories.py +2 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_env_config.py +2 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_env_files.py +2 -2
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_find_injection.py +19 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_find_repo.py +78 -20
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_gh_issue.py +109 -31
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_gh_pr.py +174 -40
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_github_api.py +7 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_gitrepo.py +4 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_issue_do.py +4 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_issue_for_me.py +83 -24
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_issue_show.py +14 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_issue_watch.py +14 -9
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_lint.py +3 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_lint_models.py +10 -10
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_lint_sql.py +177 -161
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_lint_sql_files.py +13 -4
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_lint_typescript.py +9 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_logs.py +1 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_build.py +22 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_build_create_options.py +22 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_build_flow.py +56 -22
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_cancel_build.py +231 -52
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_choice.py +41 -11
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_create_args.py +20 -3
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_description_not_truncated.py +34 -5
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_drift.py +47 -11
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_info.py +151 -30
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_labels.py +3 -9
- bmsdna_devtools-1.1.0/tests/test_pr_list.py +174 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_markdown.py +3 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pull.py +3 -1
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_testdb.py +21 -7
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_translate.py +2 -6
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_usage.py +288 -77
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_wait_timeout.py +90 -26
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_worktree_clean.py +46 -26
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/uv.lock +44 -44
- bmsdna_devtools-0.59.0/pyproject.toml +0 -56
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/.gitignore +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/.python-version +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/deps/__init__.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/deps/versions.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/skills/bmsdna-devtools/SKILL.md +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/conftest.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_deps.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_deps_cooldown.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_deps_lockfiles.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_deps_osv.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_deps_versions.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-0.59.0 → bmsdna_devtools-1.1.0}/tests/test_pr_merge_defaults.py +0 -0
|
@@ -30,6 +30,8 @@ jobs:
|
|
|
30
30
|
run: uv sync --all-extras --all-groups
|
|
31
31
|
- name: Lint (ruff)
|
|
32
32
|
run: uv run ruff check bmsdna tests
|
|
33
|
+
- name: Format check (ruff)
|
|
34
|
+
run: uv run ruff format --check bmsdna tests
|
|
33
35
|
- name: Type check (ty)
|
|
34
36
|
run: uv run ty check bmsdna
|
|
35
37
|
- name: Test with pytest
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bmsdna-devtools
|
|
3
|
+
Version: 1.1.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
|
|
@@ -113,6 +132,18 @@ locally at all (it also settles which PR when several are open for the branch).
|
|
|
113
132
|
all accept the same option, for the same reason. (`pr watch-deploy` doesn't:
|
|
114
133
|
it watches a branch-triggered build/workflow run, not any particular PR.)
|
|
115
134
|
|
|
135
|
+
## `bdt pr list`
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
bdt pr list [--state open|merged|closed|all] [--limit N] [--json]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The active PRs of the current repo (Azure DevOps or GitHub), newest first: id, state, name (title) and tags
|
|
142
|
+
(labels), one per line: `#42 open (draft) feat: widgets [bug, test-full]`. Only open PRs unless `--state` says
|
|
143
|
+
otherwise (`open` = active; `closed` = abandoned, i.e. not merged); `--limit` defaults to 30. `--json` prints a list of
|
|
144
|
+
`{number, title, state, draft, labels, url}` (`[]` when there is none). No build or merge state per PR, as that
|
|
145
|
+
is a request each: `bdt pr info --pr-id N` has it.
|
|
146
|
+
|
|
116
147
|
## `bdt pr info`
|
|
117
148
|
|
|
118
149
|
```bash
|
|
@@ -972,8 +1003,8 @@ Order of decision, always logged with its reason:
|
|
|
972
1003
|
4. Anything unreadable (label API, change list) runs everything: a missing decision never silently skips tests.
|
|
973
1004
|
|
|
974
1005
|
Outputs (Azure Pipelines variables with `isOutput=true`; plain `name=value` lines elsewhere): `runTests`, and per tier
|
|
975
|
-
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (
|
|
976
|
-
|
|
1006
|
+
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (relative to the
|
|
1007
|
+
`pyproject.toml` folder). A tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`. For
|
|
977
1008
|
custom sharding or a runner that does not take paths, use `<tier>Areas` (a space-separated list: keep area names free
|
|
978
1009
|
of whitespace if you split it): in folder mode the `<tier>Paths` of a full run
|
|
979
1010
|
is the bare tier folder, which may also hold things that are not tests (`.venv`, `test-results`); in glob mode it is the
|
|
@@ -1003,6 +1034,11 @@ list of test files either way. A moved file counts as changed under both its old
|
|
|
1003
1034
|
Dry run locally: `uv run bdt ci plan --pr-source feat/x --pr-target dev --label test-orders` (or without `--label` to
|
|
1004
1035
|
see what the changed files select).
|
|
1005
1036
|
|
|
1037
|
+
A project in a sub-folder of a monorepo: run the plan and the test runner in that folder (where its `pyproject.toml`
|
|
1038
|
+
is). Changed files are matched relative to it, so a file outside is a `../` path: own it with `paths`
|
|
1039
|
+
(`infra = ["../infra/**"]`) or ignore it with `non_code` (`["../other-app/**"]`). Any other outside file (a shared
|
|
1040
|
+
folder) selects everything.
|
|
1041
|
+
|
|
1006
1042
|
## `bdt lint`
|
|
1007
1043
|
|
|
1008
1044
|
Static checks (implementing [bmsuisse/skills#52](https://github.com/bmsuisse/skills/issues/52))
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: bmsdna-devtools
|
|
3
|
-
Version: 0.59.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
|
|
@@ -132,6 +113,18 @@ locally at all (it also settles which PR when several are open for the branch).
|
|
|
132
113
|
all accept the same option, for the same reason. (`pr watch-deploy` doesn't:
|
|
133
114
|
it watches a branch-triggered build/workflow run, not any particular PR.)
|
|
134
115
|
|
|
116
|
+
## `bdt pr list`
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
bdt pr list [--state open|merged|closed|all] [--limit N] [--json]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The active PRs of the current repo (Azure DevOps or GitHub), newest first: id, state, name (title) and tags
|
|
123
|
+
(labels), one per line: `#42 open (draft) feat: widgets [bug, test-full]`. Only open PRs unless `--state` says
|
|
124
|
+
otherwise (`open` = active; `closed` = abandoned, i.e. not merged); `--limit` defaults to 30. `--json` prints a list of
|
|
125
|
+
`{number, title, state, draft, labels, url}` (`[]` when there is none). No build or merge state per PR, as that
|
|
126
|
+
is a request each: `bdt pr info --pr-id N` has it.
|
|
127
|
+
|
|
135
128
|
## `bdt pr info`
|
|
136
129
|
|
|
137
130
|
```bash
|
|
@@ -991,8 +984,8 @@ Order of decision, always logged with its reason:
|
|
|
991
984
|
4. Anything unreadable (label API, change list) runs everything: a missing decision never silently skips tests.
|
|
992
985
|
|
|
993
986
|
Outputs (Azure Pipelines variables with `isOutput=true`; plain `name=value` lines elsewhere): `runTests`, and per tier
|
|
994
|
-
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (
|
|
995
|
-
|
|
987
|
+
(`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (relative to the
|
|
988
|
+
`pyproject.toml` folder). A tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`. For
|
|
996
989
|
custom sharding or a runner that does not take paths, use `<tier>Areas` (a space-separated list: keep area names free
|
|
997
990
|
of whitespace if you split it): in folder mode the `<tier>Paths` of a full run
|
|
998
991
|
is the bare tier folder, which may also hold things that are not tests (`.venv`, `test-results`); in glob mode it is the
|
|
@@ -1022,6 +1015,11 @@ list of test files either way. A moved file counts as changed under both its old
|
|
|
1022
1015
|
Dry run locally: `uv run bdt ci plan --pr-source feat/x --pr-target dev --label test-orders` (or without `--label` to
|
|
1023
1016
|
see what the changed files select).
|
|
1024
1017
|
|
|
1018
|
+
A project in a sub-folder of a monorepo: run the plan and the test runner in that folder (where its `pyproject.toml`
|
|
1019
|
+
is). Changed files are matched relative to it, so a file outside is a `../` path: own it with `paths`
|
|
1020
|
+
(`infra = ["../infra/**"]`) or ignore it with `non_code` (`["../other-app/**"]`). Any other outside file (a shared
|
|
1021
|
+
folder) selects everything.
|
|
1022
|
+
|
|
1025
1023
|
## `bdt lint`
|
|
1026
1024
|
|
|
1027
1025
|
Static checks (implementing [bmsuisse/skills#52](https://github.com/bmsuisse/skills/issues/52))
|
|
@@ -10,13 +10,15 @@ ship its own top-level `bmsdna` package (CCMT2 does) that would shadow ours. `ap
|
|
|
10
10
|
import importlib
|
|
11
11
|
import json
|
|
12
12
|
import sys
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any
|
|
13
15
|
|
|
14
16
|
HTTP_METHODS = ("get", "post", "put", "patch", "delete", "options", "head")
|
|
15
17
|
|
|
16
18
|
|
|
17
|
-
def ops_from_doc(doc, mount=""):
|
|
19
|
+
def ops_from_doc(doc: dict[str, Any], mount: str = "") -> list[dict[str, Any]]:
|
|
18
20
|
"""Operations of one OpenAPI document as dicts, with `mount` prepended to every path."""
|
|
19
|
-
ops = []
|
|
21
|
+
ops: list[dict[str, Any]] = []
|
|
20
22
|
for path, item in (doc.get("paths") or {}).items():
|
|
21
23
|
for method, op in item.items():
|
|
22
24
|
if method in HTTP_METHODS and isinstance(op, dict):
|
|
@@ -32,7 +34,7 @@ def ops_from_doc(doc, mount=""):
|
|
|
32
34
|
return ops
|
|
33
35
|
|
|
34
36
|
|
|
35
|
-
def collect(app, mount=""):
|
|
37
|
+
def collect(app: Any, mount: str = "") -> list[dict[str, Any]]:
|
|
36
38
|
"""Operations of `app` and, recursively, of every mounted sub-app. Uses only `app.openapi()` and the
|
|
37
39
|
`.path`/`.app` attributes of mount routes -- not FastAPI internals, which change between releases (FastAPI 0.141 wraps
|
|
38
40
|
included routers in lazy objects that `app.routes` no longer lists as plain routes)."""
|
|
@@ -42,15 +44,19 @@ def collect(app, mount=""):
|
|
|
42
44
|
ops = ops_from_doc(openapi(), mount)
|
|
43
45
|
for route in getattr(app, "routes", None) or []:
|
|
44
46
|
sub = getattr(route, "app", None)
|
|
45
|
-
if
|
|
47
|
+
if (
|
|
48
|
+
sub is not None
|
|
49
|
+
and callable(getattr(sub, "openapi", None))
|
|
50
|
+
and isinstance(getattr(route, "path", None), str)
|
|
51
|
+
):
|
|
46
52
|
ops.extend(collect(sub, mount + route.path.rstrip("/")))
|
|
47
53
|
return ops
|
|
48
54
|
|
|
49
55
|
|
|
50
|
-
def main(argv):
|
|
56
|
+
def main(argv: list[str]) -> None:
|
|
51
57
|
module_name, _, attr = argv[0].partition(":")
|
|
52
58
|
app = getattr(importlib.import_module(module_name), attr)
|
|
53
|
-
with
|
|
59
|
+
with Path(argv[1]).open("w", encoding="utf-8") as out:
|
|
54
60
|
json.dump(collect(app), out)
|
|
55
61
|
|
|
56
62
|
|
|
@@ -5,13 +5,14 @@ from __future__ import annotations
|
|
|
5
5
|
|
|
6
6
|
import base64
|
|
7
7
|
import re
|
|
8
|
+
from collections.abc import Callable
|
|
8
9
|
from urllib.parse import parse_qs, urlparse
|
|
9
10
|
|
|
10
11
|
import requests
|
|
11
12
|
|
|
12
|
-
from .azure_auth import get_azure_token
|
|
13
|
-
from .
|
|
14
|
-
from .
|
|
13
|
+
from bmsdna.devtools.azure_auth import get_azure_token
|
|
14
|
+
from bmsdna.devtools.gitrepo import AdoRemote, current_remote
|
|
15
|
+
from bmsdna.devtools.pr_cancel import one_line
|
|
15
16
|
|
|
16
17
|
# Well-known Azure DevOps resource ID; `<id>/.default` is its AAD scope.
|
|
17
18
|
ADO_RESOURCE_ID = "499b84ac-1321-427f-aa17-267ca6975798"
|
|
@@ -49,7 +50,7 @@ def _remote_org() -> str | None:
|
|
|
49
50
|
outside a checkout)."""
|
|
50
51
|
try:
|
|
51
52
|
remote = current_remote()
|
|
52
|
-
except Exception:
|
|
53
|
+
except Exception:
|
|
53
54
|
return None
|
|
54
55
|
return remote.org if isinstance(remote, AdoRemote) else None
|
|
55
56
|
|
|
@@ -83,7 +84,7 @@ def auth_header(pat: str | None) -> dict[str, str]:
|
|
|
83
84
|
def _ado_message(response: requests.Response) -> str | None:
|
|
84
85
|
try:
|
|
85
86
|
message = response.json().get("message")
|
|
86
|
-
except
|
|
87
|
+
except ValueError, AttributeError:
|
|
87
88
|
return None
|
|
88
89
|
return one_line(message) if isinstance(message, str) and message.strip() else None
|
|
89
90
|
|
|
@@ -124,7 +125,10 @@ def auth_failure_message(response: requests.Response, pat_used: bool) -> str:
|
|
|
124
125
|
lines.append(f"Credentials: the PAT from {PAT_SOURCES}.")
|
|
125
126
|
causes: list[str] = ["it lacks the scope this call needs" + (f" ({scope})" if scope else "")]
|
|
126
127
|
if response.status_code != 403:
|
|
127
|
-
causes += [
|
|
128
|
+
causes += [
|
|
129
|
+
"it has expired or was revoked",
|
|
130
|
+
"it was created for a different organization" + (f" than '{org}'" if org else ""),
|
|
131
|
+
]
|
|
128
132
|
else:
|
|
129
133
|
causes += ["your account itself lacks the permission"]
|
|
130
134
|
lines.append("Most likely " + ", or ".join(causes) + ".")
|
|
@@ -132,7 +136,8 @@ def auth_failure_message(response: requests.Response, pat_used: bool) -> str:
|
|
|
132
136
|
else:
|
|
133
137
|
lines.append("Credentials: your `az login` token (no PAT given).")
|
|
134
138
|
lines.append(
|
|
135
|
-
"Run `az login` as a user with access to "
|
|
139
|
+
"Run `az login` as a user with access to "
|
|
140
|
+
+ (f"organization '{org}'" if org else "the organization")
|
|
136
141
|
+ 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
142
|
)
|
|
138
143
|
return "\n".join(lines)
|
|
@@ -150,8 +155,8 @@ def _is_sign_in_page(response: requests.Response) -> bool:
|
|
|
150
155
|
return response.status_code == 200 and "text/html" in response.headers.get("Content-Type", "")
|
|
151
156
|
|
|
152
157
|
|
|
153
|
-
def _check_auth_hook(pat_used: bool):
|
|
154
|
-
def hook(response: requests.Response, *args, **kwargs) -> requests.Response:
|
|
158
|
+
def _check_auth_hook(pat_used: bool) -> Callable[..., requests.Response]:
|
|
159
|
+
def hook(response: requests.Response, *args: object, **kwargs: object) -> requests.Response:
|
|
155
160
|
if _is_sign_in_page(response):
|
|
156
161
|
# one status for "not signed in", however Azure DevOps phrased it, so callers' `>= 400` checks agree
|
|
157
162
|
response.status_code = 401
|
|
@@ -162,7 +167,7 @@ def _check_auth_hook(pat_used: bool):
|
|
|
162
167
|
raise error
|
|
163
168
|
|
|
164
169
|
# replaces the generic "401 Client Error: Unauthorized for url" `raise_for_status` would raise
|
|
165
|
-
|
|
170
|
+
response.raise_for_status = raise_for_status
|
|
166
171
|
return response
|
|
167
172
|
|
|
168
173
|
return hook
|
|
@@ -49,14 +49,14 @@ from urllib.parse import quote
|
|
|
49
49
|
|
|
50
50
|
import requests
|
|
51
51
|
|
|
52
|
-
from .bdt_config import load_bdt_table
|
|
53
|
-
from .business_user import BusinessUserDetector
|
|
54
|
-
from .cli_tools import ensure_agent_session_note
|
|
55
|
-
from .gitrepo import AdoRemote
|
|
56
|
-
from .issue_show import IssueDetails
|
|
57
|
-
from .issue_watch import html_to_text, to_comments
|
|
58
|
-
from .pr_issue_link import PR_AVAILABLE_LABEL
|
|
59
|
-
from .pr_markdown import build_comment_content_html
|
|
52
|
+
from bmsdna.devtools.bdt_config import load_bdt_table
|
|
53
|
+
from bmsdna.devtools.business_user import BusinessUserDetector
|
|
54
|
+
from bmsdna.devtools.cli_tools import ensure_agent_session_note
|
|
55
|
+
from bmsdna.devtools.gitrepo import AdoRemote
|
|
56
|
+
from bmsdna.devtools.issue_show import IssueDetails
|
|
57
|
+
from bmsdna.devtools.issue_watch import html_to_text, to_comments
|
|
58
|
+
from bmsdna.devtools.pr_issue_link import PR_AVAILABLE_LABEL
|
|
59
|
+
from bmsdna.devtools.pr_markdown import build_comment_content_html
|
|
60
60
|
|
|
61
61
|
COMMENTS_API_VERSION = "7.1-preview.4"
|
|
62
62
|
|
|
@@ -95,7 +95,9 @@ def check_board(board: str | None, start: Path | None = None, *, creating: bool
|
|
|
95
95
|
allowed = config.get("allowed_boards", [])
|
|
96
96
|
# An explicitly configured but empty list is a misconfiguration, not "no restriction" — silently
|
|
97
97
|
# allowing every board would defeat the point of having configured an allowlist.
|
|
98
|
-
if "allowed_boards" in config and (
|
|
98
|
+
if "allowed_boards" in config and (
|
|
99
|
+
not isinstance(allowed, list) or not allowed or not all(isinstance(a, str) for a in allowed)
|
|
100
|
+
):
|
|
99
101
|
sys.exit("[tool.bdt.ado].allowed_boards in pyproject.toml must be a non-empty list of board/team names.")
|
|
100
102
|
require = config.get("require_board", False)
|
|
101
103
|
if not isinstance(require, bool):
|
|
@@ -109,7 +111,9 @@ def check_board(board: str | None, start: Path | None = None, *, creating: bool
|
|
|
109
111
|
if board and allowed:
|
|
110
112
|
match = next((a for a in allowed if a.casefold() == board.casefold()), None)
|
|
111
113
|
if match is None:
|
|
112
|
-
sys.exit(
|
|
114
|
+
sys.exit(
|
|
115
|
+
f"Board '{board}' isn't allowed here (see [tool.bdt.ado].allowed_boards). Allowed boards: {', '.join(allowed)}."
|
|
116
|
+
)
|
|
113
117
|
return match
|
|
114
118
|
return board
|
|
115
119
|
|
|
@@ -129,7 +133,9 @@ def get_team_area_path(session: requests.Session, remote: AdoRemote, team: str)
|
|
|
129
133
|
params={"api-version": "7.1"},
|
|
130
134
|
)
|
|
131
135
|
if r.status_code == 404:
|
|
132
|
-
sys.exit(
|
|
136
|
+
sys.exit(
|
|
137
|
+
f"Board/team '{team}' not found in project '{remote.project}'. Check --board / [tool.bdt.ado].board in pyproject.toml."
|
|
138
|
+
)
|
|
133
139
|
r.raise_for_status()
|
|
134
140
|
return r.json()["defaultValue"]
|
|
135
141
|
|
|
@@ -194,18 +200,34 @@ def build_relation_ops(
|
|
|
194
200
|
current = [(i, rel) for i, rel in enumerate(existing) if rel.get("rel") == PARENT_REL]
|
|
195
201
|
if not any(_relation_target_id(rel) == parent for _, rel in current):
|
|
196
202
|
ops += [{"op": "remove", "path": f"/relations/{i}"} for i, _ in reversed(current)]
|
|
197
|
-
ops.append(
|
|
203
|
+
ops.append(
|
|
204
|
+
{
|
|
205
|
+
"op": "add",
|
|
206
|
+
"path": "/relations/-",
|
|
207
|
+
"value": {"rel": PARENT_REL, "url": _work_item_api_url(remote, parent)},
|
|
208
|
+
}
|
|
209
|
+
)
|
|
198
210
|
already_blocked_by = {_relation_target_id(rel) for rel in existing if rel.get("rel") == BLOCKED_BY_REL}
|
|
199
211
|
for blocker in dict.fromkeys(blocked_by or []):
|
|
200
212
|
if blocker not in already_blocked_by:
|
|
201
|
-
ops.append(
|
|
213
|
+
ops.append(
|
|
214
|
+
{
|
|
215
|
+
"op": "add",
|
|
216
|
+
"path": "/relations/-",
|
|
217
|
+
"value": {"rel": BLOCKED_BY_REL, "url": _work_item_api_url(remote, blocker)},
|
|
218
|
+
}
|
|
219
|
+
)
|
|
202
220
|
return ops
|
|
203
221
|
|
|
204
222
|
|
|
205
223
|
def build_attach_ops(images: list[tuple[str, str]]) -> list[dict]:
|
|
206
224
|
"""The JSON Patch document body for linking already-uploaded attachments via 'AttachedFile' relations."""
|
|
207
225
|
return [
|
|
208
|
-
{
|
|
226
|
+
{
|
|
227
|
+
"op": "add",
|
|
228
|
+
"path": "/relations/-",
|
|
229
|
+
"value": {"rel": "AttachedFile", "url": url, "attributes": {"comment": name}},
|
|
230
|
+
}
|
|
209
231
|
for name, url in images
|
|
210
232
|
]
|
|
211
233
|
|
|
@@ -276,7 +298,9 @@ def update_work_item(
|
|
|
276
298
|
) -> dict:
|
|
277
299
|
ops = build_update_ops(title, description, area_path, tags, state, iteration_path, relation_ops)
|
|
278
300
|
if not ops:
|
|
279
|
-
sys.exit(
|
|
301
|
+
sys.exit(
|
|
302
|
+
"Nothing to update — provide at least one of --title, --description, --board, --iteration, --tag, --state, --parent, --blocked-by."
|
|
303
|
+
)
|
|
280
304
|
|
|
281
305
|
r = session.patch(
|
|
282
306
|
f"{_base_url(remote)}/_apis/wit/workitems/{work_item_id}",
|
|
@@ -415,7 +439,9 @@ def delete_work_item(session: requests.Session, remote: AdoRemote, work_item_id:
|
|
|
415
439
|
r.raise_for_status()
|
|
416
440
|
|
|
417
441
|
|
|
418
|
-
def upload_attachment(
|
|
442
|
+
def upload_attachment(
|
|
443
|
+
session: requests.Session, remote: AdoRemote, attachment_name: str, file_path: str
|
|
444
|
+
) -> tuple[str, str]:
|
|
419
445
|
"""Upload `file_path` as a work item attachment named `attachment_name`; returns (id, download url).
|
|
420
446
|
|
|
421
447
|
Azure DevOps' WIT attachment-download endpoint only infers Content-Type/Content-Disposition
|
|
@@ -452,7 +478,9 @@ def _upload_attachments(session: requests.Session, remote: AdoRemote, paths: lis
|
|
|
452
478
|
]
|
|
453
479
|
|
|
454
480
|
|
|
455
|
-
def link_attachments(
|
|
481
|
+
def link_attachments(
|
|
482
|
+
session: requests.Session, remote: AdoRemote, work_item_id: int, images: list[tuple[str, str]]
|
|
483
|
+
) -> None:
|
|
456
484
|
"""Link already-uploaded attachments to a work item so they show up in its Attachments tab."""
|
|
457
485
|
ops = build_attach_ops(images)
|
|
458
486
|
r = session.patch(
|
|
@@ -581,7 +609,9 @@ def add_attachments(
|
|
|
581
609
|
)
|
|
582
610
|
|
|
583
611
|
|
|
584
|
-
def add_screenshots(
|
|
612
|
+
def add_screenshots(
|
|
613
|
+
session: requests.Session, remote: AdoRemote, work_item_id: int, screenshot_paths: list[str]
|
|
614
|
+
) -> None:
|
|
585
615
|
"""Upload+link screenshots as attachments, then post a comment embedding them as HTML `<img>` tags."""
|
|
586
616
|
add_attachments(session, remote, work_item_id, screenshot_paths=screenshot_paths)
|
|
587
617
|
|
|
@@ -677,8 +707,7 @@ def build_search_wiql(
|
|
|
677
707
|
f"([System.Title] Contains Words '{_escape_wiql_string(k)}' OR [System.Description] Contains Words '{_escape_wiql_string(k)}')"
|
|
678
708
|
for k in keywords
|
|
679
709
|
]
|
|
680
|
-
for tag in tags or []
|
|
681
|
-
clauses.append(f"[System.Tags] Contains '{_escape_wiql_string(tag)}'")
|
|
710
|
+
clauses.extend(f"[System.Tags] Contains '{_escape_wiql_string(tag)}'" for tag in tags or [])
|
|
682
711
|
if since:
|
|
683
712
|
clauses.append(f"[System.ChangedDate] >= '{since}T00:00:00Z'")
|
|
684
713
|
if area_path:
|
|
@@ -742,7 +771,11 @@ _COMMENT_FILTER_POOL = 200
|
|
|
742
771
|
|
|
743
772
|
|
|
744
773
|
def _filter_by_last_comment(
|
|
745
|
-
session: requests.Session,
|
|
774
|
+
session: requests.Session,
|
|
775
|
+
remote: AdoRemote,
|
|
776
|
+
items: list[dict],
|
|
777
|
+
top: int,
|
|
778
|
+
comment_filter: Callable[[str | None], bool],
|
|
746
779
|
) -> list[dict]:
|
|
747
780
|
"""The first `top` of `items` (in order) whose newest comment `comment_filter` accepts. An
|
|
748
781
|
item from another project (org-wide search) is looked up in its own project."""
|
|
@@ -794,7 +827,13 @@ def search(
|
|
|
794
827
|
area_path = get_team_area_path(session, remote, board) if board else None
|
|
795
828
|
wiql = build_search_wiql(keywords, since, area_path, state, org_wide=org_wide, tags=tags)
|
|
796
829
|
filtered = comment_filter or business_users
|
|
797
|
-
ids = run_wiql(
|
|
830
|
+
ids = run_wiql(
|
|
831
|
+
session,
|
|
832
|
+
remote,
|
|
833
|
+
wiql,
|
|
834
|
+
min((scan_limit or top) * 10, _COMMENT_FILTER_POOL) if filtered else top,
|
|
835
|
+
org_wide=org_wide,
|
|
836
|
+
)
|
|
798
837
|
items = get_work_items(session, remote, ids, org_wide=org_wide, with_creator=business_users is not None)
|
|
799
838
|
if business_users:
|
|
800
839
|
items = [i for i in items if business_users.verdict(i["fields"].get("System.CreatedBy")).business_user]
|
|
@@ -830,7 +869,9 @@ def create(
|
|
|
830
869
|
area_path = get_team_area_path(session, remote, board) if board else None
|
|
831
870
|
description = ensure_agent_session_note(description, also_check=title)
|
|
832
871
|
relation_ops = build_relation_ops(remote, parent, blocked_by)
|
|
833
|
-
work_item = create_work_item(
|
|
872
|
+
work_item = create_work_item(
|
|
873
|
+
session, remote, work_item_type, title, description, area_path, tags, iteration, relation_ops
|
|
874
|
+
)
|
|
834
875
|
work_item_id = work_item["id"]
|
|
835
876
|
|
|
836
877
|
print(f"Created {work_item_type} #{work_item_id}: {title}")
|
|
@@ -904,8 +945,13 @@ def update(
|
|
|
904
945
|
has_tag_change = tags is not None or bool(remove_tags)
|
|
905
946
|
has_link_change = parent is not None or bool(blocked_by)
|
|
906
947
|
if (
|
|
907
|
-
title is None
|
|
908
|
-
and
|
|
948
|
+
title is None
|
|
949
|
+
and description is None
|
|
950
|
+
and area_path is None
|
|
951
|
+
and iteration is None
|
|
952
|
+
and not has_tag_change
|
|
953
|
+
and not has_link_change
|
|
954
|
+
and applied_state is None
|
|
909
955
|
):
|
|
910
956
|
if state is not None:
|
|
911
957
|
print(f"Work item #{work_item_id}: '{state}' isn't a valid state here — noted in a comment.")
|
|
@@ -919,7 +965,9 @@ def update(
|
|
|
919
965
|
if has_link_change:
|
|
920
966
|
if work_item_id == parent or work_item_id in (blocked_by or []):
|
|
921
967
|
sys.exit(f"Work item #{work_item_id} can't be linked to itself.")
|
|
922
|
-
relation_ops = build_relation_ops(
|
|
968
|
+
relation_ops = build_relation_ops(
|
|
969
|
+
remote, parent, blocked_by, get_work_item(session, remote, work_item_id).get("relations")
|
|
970
|
+
)
|
|
923
971
|
|
|
924
972
|
if remove_tags:
|
|
925
973
|
removal_set = {t.casefold() for t in remove_tags}
|
|
@@ -932,16 +980,33 @@ def update(
|
|
|
932
980
|
filtered_tags = [t for t in current_tags if t.casefold() not in removal_set]
|
|
933
981
|
if filtered_tags != current_tags:
|
|
934
982
|
tags = filtered_tags
|
|
935
|
-
elif
|
|
983
|
+
elif (
|
|
984
|
+
title is None
|
|
985
|
+
and description is None
|
|
986
|
+
and area_path is None
|
|
987
|
+
and iteration is None
|
|
988
|
+
and applied_state is None
|
|
989
|
+
and not relation_ops
|
|
990
|
+
):
|
|
936
991
|
# None of `remove_tags` were actually present, and nothing else was given either --
|
|
937
992
|
# mirrors `add_tag`'s own idempotency check (same file) so this doesn't needlessly
|
|
938
993
|
# bump the work item's revision/history with a same-value System.Tags PATCH.
|
|
939
|
-
print(
|
|
994
|
+
print(
|
|
995
|
+
f"Work item #{work_item_id}: none of the given --remove-tag value(s) were present — nothing to do."
|
|
996
|
+
)
|
|
940
997
|
return None
|
|
941
998
|
# else: leave `tags` as None -- other given fields still get their own ops below,
|
|
942
999
|
# without forcing a redundant, unchanged System.Tags op alongside them.
|
|
943
1000
|
|
|
944
|
-
if
|
|
1001
|
+
if (
|
|
1002
|
+
title is None
|
|
1003
|
+
and description is None
|
|
1004
|
+
and area_path is None
|
|
1005
|
+
and iteration is None
|
|
1006
|
+
and tags is None
|
|
1007
|
+
and applied_state is None
|
|
1008
|
+
and not relation_ops
|
|
1009
|
+
):
|
|
945
1010
|
# only --parent / --blocked-by were given, and the work item already has those links
|
|
946
1011
|
if state is not None:
|
|
947
1012
|
print(f"Work item #{work_item_id}: '{state}' isn't a valid state here — noted in a comment.")
|
|
@@ -951,7 +1016,9 @@ def update(
|
|
|
951
1016
|
if description is not None:
|
|
952
1017
|
description = ensure_agent_session_note(description, also_check=title)
|
|
953
1018
|
|
|
954
|
-
work_item = update_work_item(
|
|
1019
|
+
work_item = update_work_item(
|
|
1020
|
+
session, remote, work_item_id, title, description, area_path, tags, applied_state, iteration, relation_ops
|
|
1021
|
+
)
|
|
955
1022
|
print(f"Updated work item #{work_item_id}")
|
|
956
1023
|
return work_item
|
|
957
1024
|
|
|
@@ -34,8 +34,7 @@ _ENV_PREFIXES: tuple[tuple[str, str], ...] = (
|
|
|
34
34
|
def normalize_agent(name: str) -> str:
|
|
35
35
|
"""The mention handle for an agent name or tag: 'Claude' / 'claude-code_2-1_agent' -> 'claude',
|
|
36
36
|
'Codex CLI' -> 'codex', '@Goose' -> 'goose'."""
|
|
37
|
-
|
|
38
|
-
return tag
|
|
37
|
+
return re.split(r"[\s_-]+", name.strip().lstrip("@").lower(), maxsplit=1)[0]
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
def detect_agent(env: Mapping[str, str] | None = None, override: str | None = None) -> str | None:
|