Vendor the API client into the CLI, drop the planetscale-go dependency#1286
Open
no-itsbackpack wants to merge 13 commits into
Open
Vendor the API client into the CLI, drop the planetscale-go dependency#1286no-itsbackpack wants to merge 13 commits into
no-itsbackpack wants to merge 13 commits into
Conversation
The CLI was the only internal consumer of planetscale-go, and every API change required a second PR plus a release/tag/bump cycle there before CLI work could start. Copy the client (v0.175.0) into the repo and drop the module dependency so API changes land in a single CLI PR. The User-Agent now reports pscale-cli/<version> only; the separate library version token is gone since the client version is the CLI version. Co-authored-by: Cursor <cursoragent@cursor.com>
doc/api-client.md explains why the planetscale-go dependency was removed and how to add endpoints now; AGENTS.md points developers at it so nobody reintroduces the two-repo workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Brings in the WithReplication field on PostgresRole and CreatePostgresRoleRequest, the only change between v0.175.0 and v0.176.0. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…client branch. Co-authored-by: Cursor <cursoragent@cursor.com>
v0.178.0 splits BranchInfrastructure into Vitess and Postgres variants with a JSON discriminator and adds GlobalKeyspace to move-tables requests. Main's postgres-branch-infra change (#1287) consumes the new types; go.mod keeps the dependency removed. Co-authored-by: Cursor <cursoragent@cursor.com>
…ut). Co-authored-by: Cursor <cursoragent@cursor.com>
The API client is vendored at internal/planetscale, so the external module must not come back. This test fails if planetscale-go appears in go.mod or in any import, and points offenders at doc/api-client.md. Co-authored-by: Cursor <cursoragent@cursor.com>
joshmgross
approved these changes
Jul 9, 2026
Keep planetscale-go's WithUserAgent prepend semantics and build-info default instead of the CLI-specific variant. This makes every file in internal/planetscale identical to upstream, so mirroring back to planetscale-go is a plain copy with no carried patches. The CLI's User-Agent still leads with pscale-cli/<version>. The dependency guard test now parses imports with go/parser instead of substring matching, since the restored client.go mentions the module path in a comment and a string literal. Co-authored-by: Cursor <cursoragent@cursor.com>
The vendored client is canonical; planetscale-go becomes a read-only mirror for external module users. On CLI releases (or manually) the workflow copies internal/planetscale into planetscale-go, builds and tests it standalone, and opens a PR there with a gorelease API report. It never pushes to main, so a human reviews and picks the next tag. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fe792c9. Configure here.
| if git ls-remote --exit-code origin "refs/heads/$branch" > /dev/null 2>&1; then | ||
| echo "exists=true" >> "$GITHUB_OUTPUT" | ||
| echo "Branch $branch already exists, nothing to do" | ||
| exit 0 |
There was a problem hiding this comment.
Mirror skips PR after push
Low Severity
When the mirror branch already exists on planetscale-go, the commit step exits successfully and later steps skip opening a pull request. A rerun after a failed gh pr create (or push without PR) leaves the mirror updated on the remote branch with no PR and no recovery path in the workflow.
Reviewed by Cursor Bugbot for commit fe792c9. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem:
Every API change in the CLI required touching two repos. You had to add the new endpoint to planetscale-go, get that PR merged, tag a release, bump the version in the CLI's go.mod, and only then start the actual CLI work. The CLI is the only thing here that consumes planetscale-go, so this release dance added overhead to every feature without buying us anything.
Solution:
Copy the API client from planetscale-go (v0.175.0, the exact version we were pinned to) into this repo at
internal/planetscale/and remove the module dependency. Adding or changing an endpoint is now a normal change in this repo, done in the same PR as the feature that needs it.Details:
github.com/planetscale/planetscale-go/planetscalenow importgithub.com/planetscale/cli/internal/planetscale. The package name is unchanged so no call sites moved.pscale-cli/<version>. The old second token (planetscale-go/<version>) no longer means anything since the client version is the CLI version.doc/api-client.mdexplains the new workflow for contributors and coding agents, andAGENTS.mdlinks to it so nobody reintroduces the two-repo process out of habit.The planetscale-go repo itself is not touched by this PR. It still exists for external users of the Go SDK; its future is a separate conversation.
Security impact:
None expected. No new dependencies, no auth changes, no behavior changes to requests other than the User-Agent string.
Testing:
go build ./...and the fullgo test ./...suite pass, including the vendored client's own tests.