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
3 changes: 3 additions & 0 deletions apps/cli/docs/go-cli-porting-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ Flag divergences from the Go reference:
`reveal=true` so the Management API returns the full secret keys (`sb_secret_...`) in
full instead of redacting them, addressing issue #4775. Default behavior (omitted flag)
matches Go exactly.
- `projects create` has a TS-only `--high-availability` flag (no Go equivalent). It sets
`high_availability` in the create request body. Default behavior (omitted flag) matches
Go exactly.

Behavioral divergences from the Go reference:

Expand Down
30 changes: 17 additions & 13 deletions apps/cli/src/legacy/commands/projects/create/SIDE_EFFECTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@

## Telemetry Events Fired

| Event | When | Notable properties / groups |
| ---------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------ |
| `cli_command_executed` | post-run, success or failure (via wrapper) | `exit_code`, `duration_ms`, `flags` (`--org-id`, `--high-availability` are telemetry-safe) |
| Event | When | Notable properties / groups |
| ---------------------- | ------------------------------------------ | ------------------------------------------------------------------------------- |
| `cli_command_executed` | post-run, success or failure (via wrapper) | `exit_code`, `duration_ms`, `flags` (`--org-id` is telemetry-safe, matching Go) |

## Flags

| Flag | Type | Required (non-interactive) | Description |
| --------------------- | ------ | -------------------------- | ----------------------------------------------- |
| `[project name]` | arg | yes (non-interactive) | Name of the project (positional argument) |
| `--org-id` | string | yes (non-interactive) | Organization ID (slug) to create the project in |
| `--db-password` | string | yes (non-interactive) | Database password for the project |
| `--region` | enum | yes (non-interactive) | AWS region for the project |
| `--size` | enum | no | Desired instance size |
| `--high-availability` | bool | no | Enable high availability for the project |
| `--interactive` | bool | no (default: true) | Enable interactive mode (hidden flag) |
| `--plan` | string | no | Plan selection (hidden flag) |
| Flag | Type | Required (non-interactive) | Description |
| --------------------- | ------ | -------------------------- | ---------------------------------------------------------------------------- |
| `[project name]` | arg | yes (non-interactive) | Name of the project (positional argument) |
| `--org-id` | string | yes (non-interactive) | Organization ID (slug) to create the project in |
| `--db-password` | string | yes (non-interactive) | Database password for the project |
| `--region` | enum | yes (non-interactive) | AWS region for the project |
| `--size` | enum | no | Desired instance size |
| `--high-availability` | bool | no | Enable high availability for the project (**TS-only, no Go CLI equivalent**) |
| `--interactive` | bool | no (default: true) | Enable interactive mode (hidden flag) |
| `--plan` | string | no | Plan selection (hidden flag) |

## Output

Expand Down Expand Up @@ -93,4 +93,8 @@ One `result` event on success.
flags and the positional project name argument are required.
- The `--size` flag, when provided, sets the `desired_instance_size` field in the request body.
- The `--high-availability` flag, when provided, sets the `high_availability` field in the request body.
This is a TS-only flag with no Go CLI equivalent: `apps/cli-go/cmd/projects.go`'s `init()` (~line 133)
never registers a `high-availability` flag, and the create command's `RunE` closure (~line 74) never sets
`HighAvailability` on the request body, even though the underlying API field exists — matching how
`--reveal` is disclosed on `projects api-keys`.
- The `--plan` flag is hidden and reserved.
16 changes: 11 additions & 5 deletions apps/cli/src/legacy/commands/projects/create/create.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const config = {
Flag.withDescription("Select a desired instance size for your project."),
Flag.optional,
),
// TS-only, no Go CLI equivalent: `cmd/projects.go`'s `init()` never registers a
// `high-availability` flag, and the `RunE` closure's `api.V1CreateProjectBody{...}`
// never sets `HighAvailability` even though the API field exists — disclosed in
// SIDE_EFFECTS.md, matching how `--reveal` is disclosed on `projects api-keys`.
highAvailability: Flag.boolean("high-availability").pipe(
Flag.withDescription("Enable high availability for the project."),
Flag.optional,
Expand Down Expand Up @@ -99,11 +103,13 @@ export const legacyProjectsCreateCommand = Command.make("create", config).pipe(
]),
Command.withHandler((flags) =>
legacyProjectsCreate(flags).pipe(
withLegacyCommandInstrumentation({
flags,
safeFlags: ["org-id", "high-availability"],
config,
}),
// `high-availability` is intentionally not in `safeFlags`: Go marks only
// `org-id` telemetry-safe (`markFlagTelemetrySafe`), and it's a boolean flag
// anyway — boolean values are always logged verbatim by the instrumentation
// regardless of `safeFlags`. See the same pattern on `projects api-keys`'s
// `--reveal`. `config` is passed so `region`/`size` (both `Flag.choice`)
// are auto-detected as telemetry-safe, matching Go's `isEnumFlag`.
withLegacyCommandInstrumentation({ flags, safeFlags: ["org-id"], config }),
withJsonErrorHandling,
),
),
Expand Down
Loading