Skip to content

feat(cli): port supabase storage ls/cp/mv/rm to native TypeScript#5667

Open
Coly010 wants to merge 1 commit into
developfrom
cli/port-storage-commands
Open

feat(cli): port supabase storage ls/cp/mv/rm to native TypeScript#5667
Coly010 wants to merge 1 commit into
developfrom
cli/port-storage-commands

Conversation

@Coly010

@Coly010 Coly010 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What changed

Replaces the Phase 0 LegacyGoProxy shims for storage ls/cp/mv/rm with native Effect implementations that talk to the Storage gateway directly (apps/cli-go/internal/storage as the reference), and adds TS-only --output-format json|stream-json on top of byte-faithful Go text output.

  • ls — pagination + recursive BFS over buckets/objects.
  • cp — 4-way scheme branch (download/upload, single/recursive), dst-key resolution, bucket auto-create on Bucket not found, content-type sniff/refine, --cache-control/--content-type/--jobs.
  • mv — single move with recursive per-object BFS fallback on not_found.
  • rm — group-by-bucket, confirm prompt, chunked deletes (1000), recursive directory + bucket removal.

Shared-infra promotion (hoist-before-duplicate)

The Storage gateway, credential derivation, bucket-config helpers, content-type sniffing, the gateway runtime layer, and the yes/no prompt are promoted out of seed buckets into legacy/shared/. seed buckets is refactored to consume them in the same change (its existing suite covers the regression).

Reviewer notes

  • --linked/--local are per-leaf, not group scoped globals. Effect CLI requires global-flag names to be unique tree-wide and seed already owns linked/local with opposite Go defaults, so two groups can't both declare them (caught by the bundled-binary smoke test). Cost vs Go's persistent flags: the flags must follow the subcommand token (storage ls --local, not storage --local ls) — the same shape the db family uses. Documented in storage.flags.ts + each SIDE_EFFECTS.md.
  • Parity over hardening: a multi-perspective review flagged a path-traversal write primitive in recursive download (remote object names → local paths). Go's filepath.Join has no boundary guard, so adding one would diverge from the strict 1:1 port; left identical to Go (noted for a future, explicit hardening).
  • Porting tracker flipped to ported; the bogus --copy-metadata cp note removed (no such Go flag).

Related

CLI-1321

@Coly010 Coly010 requested a review from a team as a code owner June 23, 2026 16:30
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Replaces the Phase 0 Go-proxy shims for `storage ls/cp/mv/rm` with native
Effect implementations that talk to the Storage gateway directly, mirroring
`apps/cli-go/internal/storage` byte-for-byte in text mode and adding TS-only
`--output-format json|stream-json` structured output.

Per the hoist-before-duplicate policy, the storage gateway, credential
derivation, bucket-config helpers, content-type sniffing, the gateway runtime
layer, and the yes/no prompt are promoted out of `seed buckets` into
`legacy/shared/`; `seed buckets` is refactored to consume them (regression
covered by its existing suite).

`--linked`/`--local` are declared per-leaf rather than as `storage`-group scoped
globals: Effect CLI requires global-flag names to be unique tree-wide and `seed`
already owns `linked`/`local` with opposite defaults. The only behavioural cost
vs Go's persistent flags is that they must follow the subcommand token
(`storage ls --local`), the same shape the `db` family uses.

Flips `storage ls/cp/mv/rm` to `ported` in the porting-status tracker and
removes the bogus `--copy-metadata` cp note.
@Coly010 Coly010 force-pushed the cli/port-storage-commands branch from 9f57951 to 3fe148c Compare June 23, 2026 20:03
@github-actions

Copy link
Copy Markdown

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@3fe148c9950e3da8b114ab41aff233ac1ec47f6e

Preview package for commit 3fe148c.

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