Skip to content

feat(cli): port domains commands to native TypeScript#5391

Open
Coly010 wants to merge 2 commits into
developfrom
cli/port-domains-commands
Open

feat(cli): port domains commands to native TypeScript#5391
Coly010 wants to merge 2 commits into
developfrom
cli/port-domains-commands

Conversation

@Coly010
Copy link
Copy Markdown
Contributor

@Coly010 Coly010 commented May 29, 2026

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

  • 5 native handlers (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's PrintStatus contract: status text to stderr, structured output to stdout when -o != pretty. All three --output-format modes (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.
  • create CNAME 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.
  • Restored --include-raw-output (deprecated) — was missing from the proxy port. Forces -o json when -o is unset/pretty; inert on delete, matching Go.
  • LegacyCliConfig.projectHost — sourced from the single-source legacy-profile.ts map (also used by branches get), with the YAML project_host override. Added the snap built-in profile so its CNAME targets resolve to snapcloud.dev.
  • Docs — consolidated the 5 per-subcommand SIDE_EFFECTS.md files into one group-level document; flipped the 5 domains rows to ported in the porting-status tracker.

Reviewer notes

  • --include-raw-output is declared per-subcommand (Effect CLI has no persistent-group-flag support, consistent with how --project-ref is handled shell-wide) and cannot reproduce Cobra's help-hiding or deprecation warning. Documented as an intentional divergence in SIDE_EFFECTS.md, alongside the snake-case encoder output and the %+v SSL-struct dump approximation.
  • New colocated modules: domains.errors.ts, domains.format.ts (pure PrintStatus port), domains.cname.ts (DNS verifier), domains.emit.ts (shared output-mode branching). The per-profile host map lives only in legacy-profile.ts (single source of truth).

@Coly010 Coly010 requested a review from a team as a code owner May 29, 2026 12:15
@Coly010 Coly010 self-assigned this May 29, 2026
Coly010 added 2 commits May 29, 2026 17:09
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.
@Coly010 Coly010 force-pushed the cli/port-domains-commands branch from 7ba1424 to 6a9e29e Compare May 29, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant