Refactor cfg out of CAPI Client by williammartin · Pull Request #12148 · cli/cli

Pull Request Overview

This PR refactors the CAPI Client to remove its dependency on the gh package by accepting explicit token and host parameters instead of an authentication configuration object. This simplifies the client's dependencies and makes it more self-contained.

Key Changes:

  • Modified NewCAPIClient signature to accept token and host strings directly instead of gh.AuthConfig
  • Moved authentication configuration resolution logic to the client factory function
  • Updated all test cases to use the new constructor signature with explicit parameters

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/cmd/agent-task/capi/client.go Updated CAPIClient struct and NewCAPIClient constructor to accept token and host directly, removing gh.AuthConfig dependency
pkg/cmd/agent-task/shared/capi.go Moved host and token resolution logic from client constructor to factory function
pkg/cmd/agent-task/capi/sessions.go Updated to use stored host field instead of resolving from authCfg
pkg/cmd/agent-task/capi/sessions_test.go Updated test instantiations to use new constructor signature with explicit empty token and host values
pkg/cmd/agent-task/capi/job_test.go Updated test instantiations to use new constructor signature with explicit empty token and host values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.