You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): port link and unlink commands to native TypeScript (#5426)
## What changed
Promotes `supabase link` and `supabase unlink` from Phase-0 Go-binary
proxy wrappers to native Effect TypeScript in the legacy
(stable-channel) shell. Behaviour follows the Go source
(`apps/cli-go/internal/{link,unlink}`) verbatim — same flags,
stdout/stderr text, `supabase/.temp/*` file writes, API routes, and exit
codes.
### `supabase link`
- Resolves the project ref `--project-ref` → `SUPABASE_PROJECT_ID` → TTY
prompt, **skipping** the on-disk ref file (matching Go's
empty-MemMapFs), and emits the cobra `required flag(s) "project-ref" not
set` error on a non-TTY.
- Checks remote project status: 404 tolerated (branch projects),
`INACTIVE` → paused error + dashboard unpause suggestion,
non-`ACTIVE_HEALTHY` → stderr warning; writes `postgres-version`.
- Fetches api-keys (`reveal=true`), then best-effort links:
`storage-migration`, `pooler-url` (placeholder-stripped, session-mode
rewrite; removed on `--skip-pooler`), and `rest`/`gotrue`/`storage`
tenant versions.
- Writes `project-ref` + `linked-project.json` and fires
`cli_project_linked` (org/project `groupIdentify`, groups keyed by org
**id**).
### `supabase unlink`
- Reads the project ref, removes `supabase/.temp/`, deletes the keyring
database-password entry, and surfaces all failures together (Go
`errors.Join` parity).
- Uses a minimal runtime layer — `unlink` makes no API calls and
requires no access token (the management-API layer eagerly requires
one).
### Shared / supporting
- New `legacy-temp-paths` and `legacy-tenant-versions` helpers in
`legacy/shared/` (existing `legacy-project-ref` /
`legacy-linked-project-cache` call sites refactored onto the former).
- `resolveForLink` on `LegacyProjectRefResolver`;
`deleteProjectCredential` on `LegacyCredentials`.
- The legacy credentials layer now honours `SUPABASE_NO_KEYRING=1`
(matching `next/` and the cli-e2e harness), preventing non-interactive
Keychain hangs for keyring-touching commands.
### Reviewer notes — intentional divergences from Go
- The cosmetic `WARNING: Local database version differs…` message is
omitted (it needs `config.toml [db].major_version` with CLI defaults,
not surfaced by the legacy shell); the `postgres-version` file is still
written.
- The four discarded Go config probes (`/config/database/postgres`,
`/postgrest`, `/config/auth`, `/network-restrictions`) are omitted —
they only populated in-process config that standalone `link` discards.
- The `Finished …` lines render plain (Go's `utils.Aqua` cyan), matching
the established legacy-port convention.
Both `SIDE_EFFECTS.md` files and `docs/go-cli-porting-status.md` (rows
flipped to `ported`) are updated.
0 commit comments