Skip to content

feat(cli): add hidden flag support for legacy commands#5278

Merged
avallete merged 3 commits into
developfrom
claude/add-hidden-flags-ts-vQb0w
May 18, 2026
Merged

feat(cli): add hidden flag support for legacy commands#5278
avallete merged 3 commits into
developfrom
claude/add-hidden-flags-ts-vQb0w

Conversation

@avallete
Copy link
Copy Markdown
Member

@avallete avallete commented May 18, 2026

Adds the remaining Go-hidden flags to the legacy shell so the TS shim parses them transparently (no help-output divergence), and accepts seed buckets --linked / --local for runtime parity. Closes the last open items from the CLI-1483 audit.

Hidden-flag mechanism

Effect's CLI DSL does not expose a hidden-flag modifier, so this PR introduces one:

  • apps/cli/src/shared/cli/hidden-flag.ts
    • withHidden(flag) registers the flag's underlying single name in a module-scoped set and returns the same flag instance unchanged.
    • stripHiddenFlagsFromHelpDoc(doc) filters those names out of both flags and globalFlags.
  • shared/output/text-formatter.ts and json-formatter.ts now run every HelpDoc through that filter before rendering, so hidden flags are parsed normally but never appear in --help.

Go-parity hidden flags added to the legacy shell

Each flag is forwarded to the Go binary by the proxy handler when set:

  • start --preview (bool)
  • projects create --interactive / -i (bool, tri-state via Option) and --plan (string)
  • functions deploy --use-docker, --legacy-bundle (bool)
  • functions download --use-docker, --legacy-bundle (bool)
  • functions serve --all (bool, tri-state via Option)

Persistent group flags

Go declares --linked / --local as persistent flags on the seed group. Effect's CLI doesn't expose group-level persistent flags, so this PR adds them as explicit (visible) flags on the seed buckets subcommand and forwards them to the Go binary. The Go implementation hardcodes linked=true for buckets, so the behavior is a no-op — but the invocation now matches.

Other places where Go has --linked / --local (e.g. gen types, db diff/push/pull/reset, migration *, test db, inspect db *, storage *) already declare them per-subcommand in the TS shim, so no other commands changed.

Tests

  • New unit test hidden-flag.unit.test.ts covers withHidden() (identity preservation, registration through wrapped combinators) and stripHiddenFlagsFromHelpDoc() (flags, globalFlags, and untouched docs).
  • pnpm check:all and pnpm test:core pass locally.

Closes: #5277
Closes: CLI-1483

https://claude.ai/code/session_01KEg7JPF7EM7gicUD8KVpaa

Introduces a withHidden() helper that registers a flag's name and
filters it out of help-doc rendering, mirroring Cobra's MarkHidden
which Effect's CLI does not yet expose. Help output for both text and
JSON formatters now strips hidden flags.

Adds the remaining Go-hidden flags to the legacy shell so the TS shim
matches the Go CLI surface exactly:

- start --preview
- projects create --interactive (-i), --plan
- functions deploy --use-docker, --legacy-bundle
- functions download --use-docker, --legacy-bundle
- functions serve --all

Each flag is forwarded to the Go binary via the proxy handler when set.

https://claude.ai/code/session_01KEg7JPF7EM7gicUD8KVpaa
@avallete avallete requested a review from a team as a code owner May 18, 2026 14:39
claude and others added 2 commits May 18, 2026 14:44
The Go CLI defines --linked and --local as persistent flags on the
seed group, so seed buckets accepts them (as a no-op, since buckets
hardcodes linked=true). Effect CLI does not expose group-level
persistent flags, so the TS shim previously rejected them. Adds them
as explicit flags on the buckets subcommand and forwards to the Go
binary to preserve invocation parity.

https://claude.ai/code/session_01KEg7JPF7EM7gicUD8KVpaa
@avallete avallete merged commit 9a22aff into develop May 18, 2026
13 checks passed
@avallete avallete deleted the claude/add-hidden-flags-ts-vQb0w branch May 18, 2026 15:02
avallete pushed a commit that referenced this pull request May 19, 2026
## TL;DR

hide legacy subcommands from help output when the go cli marks them
hidden, while keeping them callable

## prob

the legacy ts cli still showed a few subcommands in `--help` that the go
cli explicitly marks as hidden:

- `branches disable`
- `db branch`
- `db remote`
- `db test`

this happened because the existing hidden help mechanism only covered
flags, not subcommands

change extends the same pattern to hidden subcommands and 
annotates the affected parent commands accordingly

execution is unchanged, so the subcommands remain callable directly

## ref: 

- extends #5278
avallete added a commit that referenced this pull request May 20, 2026
…the right baseline (#5321)

Fixes `bun apps/cli/scripts/backfill-release-notes.ts --tag
v2.100.0-beta.2`, which currently errors with `semantic-release did not
compute a next release for v2.100.0-beta.2`.

## Why it fails today

semantic-release's `lastRelease` picker accepts both prerelease tags on
the branch's channel **and** stable tags via the prerelease filter's
stable-fallback clause, then sorts the survivors by semver. When a
stable and a beta share a commit (e.g. `v2.100.0` and `v2.100.0-beta.2`
are both at `9a22aff6`), the stable wins the sort — and since it points
at HEAD itself, semantic-release reports "Found 0 commits since last
release" and emits no `nextRelease`. The script's version-mismatch guard
then exits with the "did not compute a next release" error.

## Fix

After resolving the target tag's commit, delete *every* local tag that
points at that commit, not just the target. Co-located tags are by
definition the same release, and dropping them lets semantic-release
fall back to the genuine prior release on the channel (`v2.100.0-beta.1`
in the example).

## Sample output (`v2.100.0-beta.2`)

```sh
$ bun apps/cli/scripts/backfill-release-notes.ts --tag v2.100.0-beta.2
```

```markdown
# [2.100.0-beta.2](v2.100.0-beta.1...v2.100.0-beta.2) (2026-05-20)


### Features

* **cli:** add hidden flag support for legacy commands ([#5278](#5278)) ([9a22aff](9a22aff)), closes [#5277](#5277)
```

Regression-checked locally that `v2.99.0-beta.2` (where stable and beta
are on different commits) and `v2.100.1` (stable backfill) still produce
the same output as before.

---
_Generated by [Claude
Code](https://claude.ai/code/session_016p4TNXziTipWocxmgLDc8b)_

Co-authored-by: Claude <noreply@anthropic.com>
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.

2.99.0 broke passing --linked to various commands, including seed buckets

3 participants