feat(cli): port domains commands to native TypeScript#5391
Open
Coly010 wants to merge 2 commits into
Open
Conversation
Replace the Phase 0 Go-proxy handlers for `supabase domains` (create/get/reverify/activate/delete) with native Effect implementations in the legacy shell, as a strict 1:1 port of the Go CLI. - Each subcommand resolves the project ref, calls the typed Management API custom-hostname endpoint, and mirrors Go's PrintStatus output (status text to stderr, structured output to stdout when -o != pretty) across all --output-format and -o modes. PersistentPostRun parity (linked-project cache + telemetry flush) is preserved on success and failure. - `create` performs the Cloudflare DNS-over-HTTPS CNAME pre-check before initializing, short-circuiting before any POST on failure. - Restore the deprecated `--include-raw-output` flag (was missing from the proxy port); it forces `-o json` when -o is unset/pretty and is inert on delete, matching Go. - Add `projectHost` to LegacyCliConfig, sourced from the single-source legacy-profile.ts map (also consumed by `branches get`); add the `snap` built-in profile so CNAME targets resolve correctly. - Consolidate the five per-subcommand SIDE_EFFECTS.md files into one group-level document and flip the porting-status rows to `ported`. Unit + integration tests cover the PrintStatus state machine, the CNAME verifier, every output mode, and all error paths.
The `domains get --output json` e2e parity test failed: Go's `PrintStatus` writes the `5_services_reconfigured` message with no trailing newline, so it fuses with Go's version-update notice on a single line and is stripped wholesale by the e2e normalizer (normalize.ts rule 11) — making Go's observable stderr empty in machine-output mode. The TS port emitted a clean status line, so it survived normalization and diverged. Suppress the human status on stderr when emitting a structured Go `-o` format (json/yaml/toml/env); pretty/text mode still writes it. This keeps stdout clean in machine-output mode and matches the parity contract. Update the affected integration tests and SIDE_EFFECTS.md.
7ba1424 to
6a9e29e
Compare
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.
Ports
supabase domains(custom hostname management) from the Phase 0 Go-binary proxy to a native TypeScript/Effect implementation in the legacy shell, as a strict 1:1 port of the Go CLI. Closes CLI-1293.What changed
create,get,reverify,activate,delete) replacing the Go-proxy wrappers. Each resolves the project ref, calls the typed Management API custom-hostname endpoint, and reproduces Go'sPrintStatuscontract: status text to stderr, structured output to stdout when-o != pretty. All three--output-formatmodes (text/json/stream-json) and Go's-o {pretty,json,yaml,toml,env}are honored, and PersistentPostRun parity (linked-project cache + telemetry flush) runs on success and failure.createCNAME pre-check — Cloudflare DNS-over-HTTPS (https://1.1.1.1, 10s timeout) verifying the hostname's CNAME points at<ref>.<projectHost>.before initializing; short-circuits before any POST on failure.--include-raw-output(deprecated) — was missing from the proxy port. Forces-o jsonwhen-ois unset/pretty; inert ondelete, matching Go.LegacyCliConfig.projectHost— sourced from the single-sourcelegacy-profile.tsmap (also used bybranches get), with the YAMLproject_hostoverride. Added thesnapbuilt-in profile so its CNAME targets resolve tosnapcloud.dev.SIDE_EFFECTS.mdfiles into one group-level document; flipped the 5domainsrows toportedin the porting-status tracker.Reviewer notes
--include-raw-outputis declared per-subcommand (Effect CLI has no persistent-group-flag support, consistent with how--project-refis handled shell-wide) and cannot reproduce Cobra's help-hiding or deprecation warning. Documented as an intentional divergence inSIDE_EFFECTS.md, alongside the snake-case encoder output and the%+vSSL-struct dump approximation.domains.errors.ts,domains.format.ts(purePrintStatusport),domains.cname.ts(DNS verifier),domains.emit.ts(shared output-mode branching). The per-profile host map lives only inlegacy-profile.ts(single source of truth).