feat(tpagectl): implement site create subcommand #548
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!548
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cli-site-create"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements the
site createsubcommand for tpagectl.--name,--owner,--visibility; optional--domain,--preview-enabled./api/v1/sitesand decodes the created site.authentication failed: ….Supporting refactor: moves the HTTP client context helpers into
internal/tpagectl/client(WithContext/FromContext) so subcommands can retrieve the client.FromContextreturns an error when no client is present instead of silently returning nil — addressing the footgun filed as #543.Why
Phase 2 roadmap task #171. First functional site subcommand, validating the client-context pattern for the remaining commands.
Testing
WithContext/FromContextroundtrip, missing-client errorgo test -race ./...passesgolangci-lint runcleanBreaking Changes
None.
Notes
FromContextnow returns(*Client, error); the root command'sBeforehook usesclient.WithContext. The remaining site subcommands (list/get/delete/update) are still stubs tracked by their own issues.Closes #165
Closes #166
Closes #167
Closes #168
Closes #169
Closes #170
Closes #171
Summary
site createsubcommand for tpagectl. Verified:go test -race ./...passes (includinginternal/tpagectl/site) andgolangci-lint run ./...is clean. Closes #165-171.Verified daemon parity:
createRequestmatchesRegisterSiteRequest(service.go:16),createResponsematchesSite(site.go:20), and validation inbuildCreateRequestmirrorsvalidateRequest(service.go:356) — same regexes, ≤63-char limit, and identical error strings.No blocking issues.
Suggestions (filed as issues)
cmd/tpagectl/main.go:124–clientFromContextstill swallows theFromContexterror and returns nil, keeping the #543 footgun alive for the old accessor; consider removing it and usingclient.FromContextdirectly. Filed as #549internal/tpagectl/site/create.go:91– 401 and 403 both render as "authentication failed", but daemon 403 means "not authorized to register for this owner" (authorization); also 403 and non-auth passthrough paths are untested. Filed as #550Praise
WithContext/FromContexterror-returning pattern addressing #543Requiredflags plusbuildCreateRequestvalidation is good belt-and-suspenders