Repository navigation
feat(cmd)!: Z-Send commands use the CLI login token; remove ai-hub - #286
Conversation
…mands `email send`, `email scheduled list|get|cancel` and `email batch list|get` required --api-key or ZSEND_API_KEY and rejected anything without the zs_ prefix, so a logged-in user could not use them at all. The Z-Send REST API also accepts the CLI login token. Resolve the credential in one place (Factory.ResolveZSendAPIKey): the --api-key flag, then ZSEND_API_KEY, then the logged-in CLI token. The zs_ prefix check now applies only to explicitly supplied keys. Refs: ZEA-10524 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The production GraphQL API no longer serves AI Hub (aihubTenant, updateAIHubAutoRechargeSettings and every other AI Hub query or mutation except aihubRefundStatement), so `zeabur ai-hub status` and `zeabur ai-hub keys list` fail with HTTP 422. Remove the command group, its API client and models. BREAKING CHANGE: `zeabur ai-hub` and all of its subcommands are removed. Refs: ZEA-10524 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
canyugs
left a comment
There was a problem hiding this comment.
LGTM.
Verified independently: production schema introspection shows only aihubRefundStatement left under Query and no AI Hub mutations, so removing the command group matches reality. GetTokenString is on the Config interface, all six former zs_ prefix checks are consolidated into ResolveZSendAPIKey, and nothing else in the repo still hard-codes the prefix. CI is green.
Agree with shipping as v0.24.0 given the feat! footer.
Summary
1. Z-Send REST commands fall back to the CLI login token
email send,email scheduled list|get|cancelandemail batch list|getpreviously required--api-keyorZSEND_API_KEY, and rejected any value without thezs_prefix. A logged-in user gotZ-Send API key is required, and passing the login token gotinvalid API key format: must start with zs_.The Z-Send REST API accepts the CLI login token (verified 2026-10-22:
GET /api/v1/zsend/emails/scheduledwithAuthorization: Bearer <CLI login token>→200 {"scheduled_emails": null, "total_count": 0}).Credential resolution now lives in
Factory.ResolveZSendAPIKey(internal/cmdutil/zsend.go):--api-keyZSEND_API_KEYThe
zs_prefix is still validated for explicitly supplied keys (1 and 2) only.--api-keyhelp and theemail sendlong help describe the fallback. Table tests cover precedence, prefix validation and the no-credential error.2. Remove the
ai-hubcommand group (breaking)The production GraphQL API no longer has
aihubTenant,updateAIHubAutoRechargeSettingsor any AI Hub query/mutation exceptaihubRefundStatement;zeabur ai-hub statusandzeabur ai-hub keys listreturn HTTP 422. This removesinternal/cmd/ai-hub,pkg/api/aihub.go, theAIHubAPIinterface,pkg/model/aihub.goand the registration inroot.go. README, docs andCLAUDE.mdhad no AI Hub references.zeabur ai-huband all its subcommands are removed (they already fail against production). The commit is markedfeat(cmd)!:with aBREAKING CHANGE:footer. Releases are tag-driven via GoReleaser (last:v0.23.0); since the CLI is pre-1.0, suggest releasing this asv0.24.0rather than a patch.Testing
On a Linux machine with Go 1.27.1:
go build ./...,go veton touched packages,go test ./internal/... ./pkg/...: all pass.ZSEND_API_KEYunset (read-only calls only):zeabur email scheduled list→ empty table, exit 0 (wasZ-Send API key is required)zeabur email scheduled list --json→[]zeabur email batch list→ empty tablezeabur email scheduled list --api-key not_a_zs_key→invalid API key format: must start with zs_zeabur ai-hub status→unknown command "ai-hub";zeabur --helpno longer lists itemail scheduled list --helpshows the new--api-keydescriptionRefs: ZEA-10524
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.