Skip to content

feat(cli): add github command group for workspace GitHub connections#113

Draft
AmanVarshney01 wants to merge 1 commit into
mainfrom
feat/github-connect
Draft

feat(cli): add github command group for workspace GitHub connections#113
AmanVarshney01 wants to merge 1 commit into
mainfrom
feat/github-connect

Conversation

@AmanVarshney01

Copy link
Copy Markdown
Member

Why

Agent-friendly counterpart to the Console work in pdp-control-plane#4396/#4402/#4406/#4407: agents and headless sessions need to drive the GitHub connection flow without a browser. The critical piece is connecting an org that already has the Prisma GitHub App installed — the only path GitHub itself cannot round-trip (no callback fires when nothing changes), now exposed by pdp-control-plane#4408.

Commands

prisma-cli github list              # connected + connectable accounts for the active workspace
prisma-cli github connect <account> # connect an already-installed account, by login or installation id
prisma-cli github install           # mint the GitHub App install URL for a brand-new account
  • Non-interactive by design: connect without an account fails with GITHUB_ACCOUNT_REQUIRED, carrying the connectable options in error.meta.connectable and as runnable next steps — an agent picks and reruns, no prompt-blocking. Unknown accounts fail the same way with GITHUB_ACCOUNT_NOT_FOUND.
  • Authorization is platform-enforced (same rule as the Console): member of a workspace the installation is already connected to. A GitHub-side uninstall surfaces as GITHUB_CONNECT_FAILED after the platform self-heals its stale rows.
  • JSON envelopes, error codes registered in error-conventions.md, spec section added to command-spec.md, runner-formatted next steps.

Draft status: one dependency

Real mode calls the two new Management API endpoints from pdp-control-plane#4408 (open). The published @prisma/management-api-sdk does not carry those paths yet, so they go through a single documented, fully-typed seam in lib/github/provider.ts — delete-marked for when the SDK regen lands after #4408 merges. Everything else (/v1/scm-installations, install-intents) uses the typed SDK client directly.

Undraft once #4408 is merged and the SDK is bumped (seam removal is a follow-up commit here).

Testing

6 fixture-mode CLI tests (tests/github.test.ts): list with per-account dedupe (newest installation wins), connect by login and by numeric id, structured GITHUB_ACCOUNT_REQUIRED with machine-readable options, GITHUB_ACCOUNT_NOT_FOUND with the same, install URL. Full suite 615 green; typecheck clean. Real mode needs a live check against #4408 once deployed.

Adds prisma-cli github list/connect/install so agents and headless sessions
can drive the GitHub connection flow the Console gained in
pdp-control-plane#4406: list connected and connectable accounts, connect an
already-installed account to the active workspace without a GitHub round
trip, and mint the install URL for brand-new accounts. Connect resolution is
non-interactive by design: missing or unknown accounts fail with structured
errors carrying the connectable options in meta and as runnable next steps.

Real mode calls the Management API endpoints from pdp-control-plane#4408;
the connectable/connect paths are called through a single typed seam until
the published SDK carries them. Fixture mode is fully covered by tests.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5e61825d-b15e-469e-a798-01509f9fa32d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/github-connect
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/github-connect

Comment @coderabbitai help to get the list of available commands.

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