Skip to content

Manage AI providers from the CLI - #501

Draft
Stephen Belanger (Qard) wants to merge 2 commits into
mainfrom
sdk-522/ai-providers
Draft

Stephen Belanger (Qard) wants to merge 2 commits into
mainfrom
sdk-522/ai-providers

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Teams can list, create, update, and delete AI providers at the organization or project level from bt. Provider secrets can be piped in or entered at a prompt. Updates can keep the current secret.

Project provider support is waiting on the regenerated Rust client. The backend schema change #28447 merged, and the public OpenAPI sync is running. Once the SDK update lands, this draft can switch to the generated requests and align the CLI and daemon SDK pins.

Validation on the current draft: cargo check --locked --tests passed. Live API verification is pending.

SDK-522

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Latest downloadable build artifacts for this PR commit ed1fbbb54883:

Available artifact names
  • artifacts-build-local-x86_64-apple-darwin
  • artifacts-build-local-x86_64-pc-windows-msvc
  • artifacts-build-local-x86_64-unknown-linux-musl
  • artifacts-plan-dist-manifest
  • artifacts-build-global
  • artifacts-build-local-x86_64-unknown-linux-gnu
  • artifacts-build-local-aarch64-apple-darwin
  • artifacts-build-local-aarch64-unknown-linux-gnu
  • artifacts-build-local-aarch64-pc-windows-msvc
  • cargo-dist-cache

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T17:56:01.595021Z ed1fbbb Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed1fbbb548

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread src/ai_providers/mod.rs
Comment on lines +19 to +20
#[command(subcommand)]
command: Command,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Default the resource command to listing providers

Running bt ai-providers currently fails because command is required, rather than listing providers as the established resource-command pattern requires. In src/projects/mod.rs, the subcommand is optional and None dispatches to list::run; use the same optional-subcommand dispatch here so the new resource behaves consistently.

AGENTS.md reference: AGENTS.md:L35-L35

Useful? React with 👍 / 👎.

Comment on lines +12 to +13
/// Provider name
name: String,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Provide named alternatives for provider identifiers

The new commands accept their primary identifiers only positionally: creation requires name, while update and delete require id. This prevents named-argument automation such as bt ai-providers create --name test-provider ... or bt ai-providers delete --id <UUID> --force, contrary to the CLI review's required positional-plus-flag pattern. Follow the ViewArgs pattern in src/projects/mod.rs by adding corresponding flag alternatives and resolving the positional value first.

AGENTS.md reference: AGENTS.md:L35-L35

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5RetriggerView in Greptile

[High impact] The PR reaches organization and project AI-provider settings and their stored credentials.

The PR appears safe to merge, with non-blocking help and test-coverage gaps.

FindingsFix All in Cursor

  1. P2 Main help hides providers ▶
  2. P2 Secret retention lacks tests ▶
Fix with agent prompt
### Issue 1
src/main.rs:180-181
`ai-providers` is missing from the hard-coded `HELP_TEMPLATE`. Adding `AiProviders` to `Commands` does not add it to this template, so users cannot discover the new command through `bt --help`. Add it under “Projects & resources.”

### Issue 2
src/ai_providers/mod.rs:81-82
The only new test checks argument parsing. None checks the requests sent by these commands, including the promise that metadata-only updates omit the secret at both scopes. Add tests that inspect the method, path, and JSON body for organization and project updates, and confirm that absent secrets stay out of both bodies.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds bt ai-providers commands to list, create, update, and delete providers.

  • Providers can be created at the organization or project level.
  • Provider details can be updated without replacing the current secret.
  • Providers can be deleted from the selected scope.
  • Provider lists show safe details for an organization or project.

Qard explicitly deferred SDK pin alignment until the SDK PR lands; the PR description identifies the mismatch as intentional draft work.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["bt ai-providers"] --> B["Resolve login and selected scope"]
  B --> C{"Project selected?"}
  C -->|Yes| D["Project env_var API"]
  C -->|No| E["Organization ai_secret API"]
  D --> F["Print ID, name, and type"]
  E --> F
Loading

Reviews (1) · Last reviewed commit: "Give AI provider subcommands their own h..." · Reviewed by Greptile

Comment thread src/main.rs
Comment on lines +180 to +181
/// Manage organization and project AI providers
AiProviders(CLIArgs<ai_providers::ProviderArgs>),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Main help hides providers

ai-providers is missing from the hard-coded HELP_TEMPLATE. Adding AiProviders to Commands does not add it to this template, so users cannot discover the new command through bt --help. Add it under “Projects & resources.”

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/main.rs
Line: 180-181

Comment:
**Main help hides providers**

`ai-providers` is missing from the hard-coded `HELP_TEMPLATE`. Adding `AiProviders` to `Commands` does not add it to this template, so users cannot discover the new command through `bt --help`. Add it under “Projects & resources.”

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Cursor Fix in Claude Code Fix in Codex Fix in Devin

Comment thread src/ai_providers/mod.rs
Comment on lines +81 to +82
#[test]
fn update_requires_a_change_at_parse_time() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Secret retention lacks tests

The only new test checks argument parsing. None checks the requests sent by these commands, including the promise that metadata-only updates omit the secret at both scopes. Add tests that inspect the method, path, and JSON body for organization and project updates, and confirm that absent secrets stay out of both bodies.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ai_providers/mod.rs
Line: 81-82

Comment:
**Secret retention lacks tests**

The only new test checks argument parsing. None checks the requests sent by these commands, including the promise that metadata-only updates omit the secret at both scopes. Add tests that inspect the method, path, and JSON body for organization and project updates, and confirm that absent secrets stay out of both bodies.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Cursor Fix in Claude Code Fix in Codex Fix in Devin

This branch has not been deployed

No deployments
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