Skip to content

feat: replace az/gh CLI calls with raw HTTP - #105

Merged
aersam merged 10 commits into
mainfrom
raw-http
Oct 20, 2026
Merged

aersam merged 10 commits into
mainfrom
raw-http

Conversation

@aersam

@aersam aersam commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

bdt no longer shells out to az or gh: every call is raw HTTP (requests), so neither CLI needs to be installed.

  • GitHub: new github_api.GitHubClient (REST + GraphQL, pagination, host-pinned auth). Token from GH_TOKEN / GITHUB_TOKEN, falling back to gh auth token if gh happens to be installed. gh_pr.py, gh_issue.py, issue_do.py, find_repo.py migrated (PRs, check rollup, reruns, Projects v2 boards, sub-issues / dependencies, comments, search).
  • Azure DevOps: az repos pr create is now POST .../pullrequests (pr_build.create_pr). Auth is --pat / AZURE_DEVOPS_EXT_PAT / AZURE_DEVOPS_PAT, else azure-identity DefaultAzureCredential (new dependency).
  • Azure Monitor / App Service: bdt logs and app-service log download use ARM / Application Insights / Kudu over HTTP (azure_arm.py). Subscription: AZURE_SUBSCRIPTION_ID, else the isDefault one in azureProfile.json, else the only enabled one.
  • README and skills/bmsdna-devtools/SKILL.md updated; require_az removed.

Backend-agnostic pr create / issue create flags

One shared parser (pr_create_args.py) accepts the union of gh pr create and az repos pr create spellings and maps them per host (see the flag table in the README): title/body/body-file, draft, base/head (--target-branch/--source-branch), labels, reviewers (+ required), assignees, milestone, project, work items / issue links, squash, delete-source-branch, auto-complete / auto-merge (ADO autoCompleteSetBy, GitHub enablePullRequestAutoMerge), merge-commit-message, bypass-policy, fill variants, --web/--open, --dry-run, ADO org/project/repo overrides. Short flags that differ per host (-d, -r, -p) follow the active host. A flag the host cannot honour prints a one-line stderr note instead of being dropped silently; an unknown flag is a usage error listing the supported ones. issue create accepts title/body/body-file/label/assignee/milestone/project/web.

Behaviour changes to know about

  • Unknown labels are auto-created by GitHub (it used to reject them).
  • Failed-run logs on GitHub are the tail (200 lines) of each failed job's log, not scoped to the failing step.
  • PR lookup assumes origin is the repo the PR lives in (forks with origin != base repo unsupported).
  • Not supported: gh pr create --template/--recover, gh issue create --template/--recover (clear error).

Testing

  • 1412 unit tests pass locally (tests mock at the client boundary: tests/fake_github.py).
  • Verified live against GitHub: this PR was created with the new client (bdt pr create), and bdt pr status / bdt pr update --pr-id / bdt issue search ran against the real API.
  • Not exercised live: Azure DevOps and Azure Monitor paths (no credentials in the sandbox).
  • Review: BMS code review (correctness x2, security, backend) — findings fixed; a codex review's one P1 (statusCheckRollup not on PullRequest) was checked against the live API and is a false positive.

No UI change, so no screenshots.

Claude Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo

aersam and others added 6 commits October 19, 2026 16:09
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo
… REST, azure-identity)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo
…ult, error handling, auth caching)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo
@aersam
aersam marked this pull request as ready for review October 19, 2026 14:25
aersam and others added 4 commits October 19, 2026 17:34
…er, host mapping, notes for unsupported)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo
…, label groups, auto-complete warning, dash values)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo
…sts and GraphQL queries

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVJeRBSVDA7arVP1baZkuo
@aersam
aersam enabled auto-merge (squash) October 20, 2026 09:59
@aersam
aersam merged commit 3b97737 into main Oct 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant