Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/cli/docs/go-cli-porting-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ Legend:
| `gen signing-key` | `ported` | [`../src/legacy/commands/gen/signing-key/signing-key.command.ts`](../src/legacy/commands/gen/signing-key/signing-key.command.ts) |
| `gen bearer-jwt` | `wrapped` | [`../src/legacy/commands/gen/bearer-jwt/bearer-jwt.command.ts`](../src/legacy/commands/gen/bearer-jwt/bearer-jwt.command.ts) |
| `gen keys` | `wrapped` | [`../src/legacy/commands/gen/keys/keys.command.ts`](../src/legacy/commands/gen/keys/keys.command.ts) |
| `functions list` | `wrapped` | [`../src/legacy/commands/functions/list/list.command.ts`](../src/legacy/commands/functions/list/list.command.ts) |
| `functions list` | `ported` | [`../src/legacy/commands/functions/list/list.command.ts`](../src/legacy/commands/functions/list/list.command.ts) |
| `functions delete` | `ported` | [`../src/legacy/commands/functions/delete/delete.command.ts`](../src/legacy/commands/functions/delete/delete.command.ts) |
| `functions download` | `ported` | [`../src/legacy/commands/functions/download/download.command.ts`](../src/legacy/commands/functions/download/download.command.ts) |
| `functions deploy` | `ported` | [`../src/legacy/commands/functions/deploy/deploy.command.ts`](../src/legacy/commands/functions/deploy/deploy.command.ts) |
Expand Down
56 changes: 38 additions & 18 deletions apps/cli/src/legacy/commands/functions/list/SIDE_EFFECTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,36 @@

## Files Read

| Path | Format | When |
| -------------------------- | ---------- | ---------------------------------------------------------- |
| `~/.supabase/access-token` | plain text | when `SUPABASE_ACCESS_TOKEN` unset and keyring unavailable |
| Path | Format | When |
| ------------------------------ | ---------- | ------------------------------------------------------------- |
| `~/.supabase/access-token` | plain text | when `SUPABASE_ACCESS_TOKEN` unset and keyring unavailable |
| `~/.supabase/profile` | plain text | when `--profile` and `SUPABASE_PROFILE` are both unset |
| `<profile>.yaml` | YAML | when `SUPABASE_PROFILE` or `--profile` points to a file |
| `./supabase/.temp/project-ref` | plain text | when `--project-ref` and `SUPABASE_PROJECT_ID` are both unset |
Comment thread
7ttp marked this conversation as resolved.

## Files Written

| Path | Format | When |
| ---- | ------ | ---- |
| — | — | — |
| Path | Format | When |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------- |
| `./supabase/.temp/linked-project.json` | JSON | after resolving a project ref, cached on both success and failure paths |
| `<SUPABASE_HOME or ~/.supabase>/telemetry.json` | JSON | after command completion, flushed on both success and failure paths |

## API Routes

| Method | Path | Auth | Request body | Response (used fields) |
| ------ | ------------------------------ | ------------ | ------------ | --------------------------------- |
| `GET` | `/v1/projects/{ref}/functions` | Bearer token | none | `[{id, slug, name, status, ...}]` |
| Method | Path | Auth | Request body | Response (used fields) |
| ------ | ------------------------------ | ------------ | ------------ | ------------------------------------------------------ |
| `GET` | `/v1/projects/{ref}/functions` | Bearer token | none | `[{id, name, slug, status, version, updated_at, ...}]` |
Comment thread
7ttp marked this conversation as resolved.
| `GET` | `/v1/projects` | Bearer token | none | project picker options when no ref is supplied in TTY |
| `GET` | `/v1/projects/{ref}` | Bearer token | none | linked project metadata used by the post-run cache |
Comment thread
7ttp marked this conversation as resolved.

## Environment Variables

| Variable | Purpose | Required? |
| ----------------------- | ---------------------------------------------------- | ------------------------------------------------------- |
| `SUPABASE_ACCESS_TOKEN` | auth token (bypasses credential file/keyring lookup) | no (falls back to keyring → `~/.supabase/access-token`) |
| `SUPABASE_API_URL` | override Management API base URL | no (defaults to `https://api.supabase.com`) |
| Variable | Purpose | Required? |
| ----------------------- | -------------------------------------------------------------- | -------------------------------------------------------- |
| `SUPABASE_ACCESS_TOKEN` | auth token (bypasses credential file/keyring lookup) | no (falls back to keyring -> `~/.supabase/access-token`) |
| `SUPABASE_PROFILE` | select a built-in profile or YAML profile file with `api_url:` | no (falls back to `~/.supabase/profile` -> `supabase`) |
| `SUPABASE_PROJECT_ID` | provides the project ref when `--project-ref` is unset | no (falls back to `./supabase/.temp/project-ref`) |
| ~~`SUPABASE_API_URL`~~ | **not honored** - Go parity. Use `SUPABASE_PROFILE` instead. | - |

## Exit Codes

Expand All @@ -33,22 +41,34 @@
| `1` | API error (non-2xx response) |
| `1` | authentication error (no token found) |
| `1` | network / connection failure |
| `1` | unsupported Go output mode (`env`) |

## Telemetry Events Fired

| Event | When | Notable properties / groups |
| ---------------------- | ------------------------------------------ | ----------------------------------- |
| `cli_command_executed` | post-run, success or failure (via wrapper) | `exit_code`, `duration_ms`, `flags` |

## Output

### `--output-format text` (Go CLI compatible)

Prints a table of Edge Functions with columns for slug, status, version, and region.
Prints a Glamour-style ASCII table with columns `ID`, `NAME`, `SLUG`, `STATUS`, `VERSION`, and `UPDATED_AT (UTC)`.

### `--output-format json`

Not applicable (proxied to Go binary).
Prints a structured success result shaped as `{ "functions": [...] }`.

### `--output-format stream-json`

Not applicable (proxied to Go binary).
Prints a structured success result shaped as `{ "functions": [...] }`.

## Notes

- Requires a linked project (`--project-ref` or linked project config).
- Phase 0 proxy: all invocations are forwarded to the bundled Go binary.
- Requires a linked project (`--project-ref`, `SUPABASE_PROJECT_ID`, or `./supabase/.temp/project-ref`).
- Native TypeScript port using the Management API.
- Go `--output` parity:
- `json` emits the raw array.
- `yaml` emits the raw array.
- `toml` emits `{ functions = [...] }`.
- `env` fails with `--output env flag is not supported`.
21 changes: 20 additions & 1 deletion apps/cli/src/legacy/commands/functions/list/list.command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Command, Flag } from "effect/unstable/cli";
import type * as CliCommand from "effect/unstable/cli/Command";
import { withJsonErrorHandling } from "../../../../shared/output/json-error-handling.ts";
import { legacyManagementApiRuntimeLayer } from "../../../shared/legacy-management-api-runtime.layer.ts";
import { withLegacyCommandInstrumentation } from "../../../telemetry/legacy-command-instrumentation.ts";
import { legacyFunctionsList } from "./list.handler.ts";

const config = {
Expand All @@ -14,5 +17,21 @@ export type LegacyFunctionsListFlags = CliCommand.Command.Config.Infer<typeof co
export const legacyFunctionsListCommand = Command.make("list", config).pipe(
Command.withDescription("List all Functions in the linked Supabase project."),
Command.withShortDescription("List all Functions in Supabase"),
Command.withHandler((flags) => legacyFunctionsList(flags)),
Command.withExamples([
{
command: "supabase functions list",
description: "List all deployed functions in the linked project",
},
{
command: "supabase functions list --project-ref abcdefghijklmnopqrst",
description: "List all deployed functions in a specific project",
},
]),
Command.withHandler((flags) =>
legacyFunctionsList(flags).pipe(
withLegacyCommandInstrumentation({ flags, safeFlags: ["project-ref"] }),
withJsonErrorHandling,
),
),
Command.provide(legacyManagementApiRuntimeLayer(["functions", "list"])),
);
Loading
Loading