Repository navigation
Add CommandSpec for documenting effect/cli command paths - #10377
Merged
Merged
Conversation
Red tests for the accepted CommandSpec projection design: path resolution, flag provenance, hidden/unlisted inclusion, input surface, structural fallbacks (not executed), annotations, variadic bounds, per-path examples.
Adds a lossless projection of one command path (effective flags with provenance, arguments, subcommands, examples) that never executes handlers, prompts, Config or effectful defaults. Records fallbacks structurally on Param.Transform, adds Param/Flag/Argument.annotate, and shares help's requiredness rule through getParamMetadata().isRequired.
🦋 Changeset detectedLatest commit: f2000ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Red regression tests for the review findings on #10377: bare boolean flags are required, orElse branches carry their own wrapper metadata, per-item defaults inside a variadic do not satisfy an outer minimum, and Action globals are never required.
Each flag/argument entry now carries the facts of the combinators on its own path, outermost first: wrappers outside an orElse apply to every alternative, wrappers inside a branch only to that branch, and nodes beneath a variadic describe items rather than omission. Bare boolean flags are required like any other flag, and global Action flags are never required. Fixes the JSDoc header and documents the branch-local semantics.
…name Red regression for the re-review finding on #10377: the runner resolves local/global name collisions per token and help dedupes globals by identity only, so the shadowed global entry and its aliases must stay.
Drop the unused fallbacks field from getParamMetadata, which CommandSpec derives per branch itself, and share the fields common to flag and argument entries. No behavior change.
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
tim-smart
reviewed
Nov 9, 2026
tim-smart
enabled auto-merge (squash)
November 9, 2026 03:04
This was referenced Nov 13, 2026
brandhaug
added a commit
to brandhaug/b2b-saas-starter
that referenced
this pull request
Nov 13, 2026
## pnpm-workspace.yaml (default) ## Dependency Updates | Package | From | To | Type | | --- | --- | --- | --- | | `@better-auth/cimd` | 1.7.18 | 1.7.19 | patch | | `@better-auth/mcp` | 1.7.18 | 1.7.19 | patch | | `@better-auth/oauth-provider` | 1.7.18 | 1.7.19 | patch | | `@better-auth/passkey` | 1.7.18 | 1.7.19 | patch | | `@better-auth/sso` | 1.7.18 | 1.7.19 | patch | | `@effect/platform-node` | 4.1.2 | 4.1.3 | patch | | `@effect/sql-d1` | 4.1.2 | 4.1.3 | patch | | `@effect/vitest` | 4.1.2 | 4.1.3 | patch | | `@react-email/ui` | 6.11.8 | 6.11.10 | patch | | `better-auth` | 1.7.18 | 1.7.19 | patch | | `effect` | 4.1.2 | 4.1.3 | patch | | `jose` | 6.2.16 | 6.2.17 | patch | | `react-email` | 6.11.8 | 6.11.10 | patch | ## Release Notes <details> <summary><b>@<!---->better-auth/cimd</b> (1.7.18 → 1.7.19)</summary> ## `better-auth` ### Bug Fixes - Fixed `/admin/create-user` leaving a user without a credential account when creating that account failed, such as a database hook throwing, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12338](better-auth/better-auth#12338)) - Fixed `/admin/create-user` leaving a user without a credential account when the password was rejected, such as by the Have I Been Pwned plugin, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12335](better-auth/better-auth#12335)) - Fixed client actions ignoring the HTTP method passed in second-argument fetch options, and attaching a request body when the method was a lowercase `get` or `HEAD` ([#12336](better-auth/better-auth#12336)) - Fixed plugin schema overrides (`modelName` and field names) leaking into other instances of the same plugin in one process ([#12319](better-auth/better-auth#12319)) - Fixed `/device/token` returning `invalid_grant` instead of `invalid_client` when `validateClient` rejects the `client_id`, matching `/device/code` and RFC 6749 section 5.2 ([#12246](better-auth/better-auth#12246)) - Fixed OAuth sign-in failing with `state_mismatch` during the daylight saving time fall-back hour when OAuth state is stored in the database and the server's time zone observes daylight saving time ([#12320](better-auth/better-auth#12320)) - Fixed the OpenAPI schema to document query parameters for endpoints whose query schema is wrapped in `z.optional()`, such as `/get-session` and Stripe's `/subscription/list` ([#12337](better-auth/better-auth#12337)) - Fixed `organization.getInvitation` to return the `INVITATION_NOT_FOUND` code for a missing, expired, or non-pending invitation ([#12332](better-auth/better-auth#12332)) - …[full notes](https://github.com/better-auth/better-auth/releases/tag/v1.7.19) </details> <details> <summary><b>@<!---->better-auth/mcp</b> (1.7.18 → 1.7.19)</summary> ## `better-auth` ### Bug Fixes - Fixed `/admin/create-user` leaving a user without a credential account when creating that account failed, such as a database hook throwing, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12338](better-auth/better-auth#12338)) - Fixed `/admin/create-user` leaving a user without a credential account when the password was rejected, such as by the Have I Been Pwned plugin, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12335](better-auth/better-auth#12335)) - Fixed client actions ignoring the HTTP method passed in second-argument fetch options, and attaching a request body when the method was a lowercase `get` or `HEAD` ([#12336](better-auth/better-auth#12336)) - Fixed plugin schema overrides (`modelName` and field names) leaking into other instances of the same plugin in one process ([#12319](better-auth/better-auth#12319)) - Fixed `/device/token` returning `invalid_grant` instead of `invalid_client` when `validateClient` rejects the `client_id`, matching `/device/code` and RFC 6749 section 5.2 ([#12246](better-auth/better-auth#12246)) - Fixed OAuth sign-in failing with `state_mismatch` during the daylight saving time fall-back hour when OAuth state is stored in the database and the server's time zone observes daylight saving time ([#12320](better-auth/better-auth#12320)) - Fixed the OpenAPI schema to document query parameters for endpoints whose query schema is wrapped in `z.optional()`, such as `/get-session` and Stripe's `/subscription/list` ([#12337](better-auth/better-auth#12337)) - Fixed `organization.getInvitation` to return the `INVITATION_NOT_FOUND` code for a missing, expired, or non-pending invitation ([#12332](better-auth/better-auth#12332)) - …[full notes](https://github.com/better-auth/better-auth/releases/tag/v1.7.19) </details> <details> <summary><b>@<!---->better-auth/oauth-provider</b> (1.7.18 → 1.7.19)</summary> ## `better-auth` ### Bug Fixes - Fixed `/admin/create-user` leaving a user without a credential account when creating that account failed, such as a database hook throwing, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12338](better-auth/better-auth#12338)) - Fixed `/admin/create-user` leaving a user without a credential account when the password was rejected, such as by the Have I Been Pwned plugin, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12335](better-auth/better-auth#12335)) - Fixed client actions ignoring the HTTP method passed in second-argument fetch options, and attaching a request body when the method was a lowercase `get` or `HEAD` ([#12336](better-auth/better-auth#12336)) - Fixed plugin schema overrides (`modelName` and field names) leaking into other instances of the same plugin in one process ([#12319](better-auth/better-auth#12319)) - Fixed `/device/token` returning `invalid_grant` instead of `invalid_client` when `validateClient` rejects the `client_id`, matching `/device/code` and RFC 6749 section 5.2 ([#12246](better-auth/better-auth#12246)) - Fixed OAuth sign-in failing with `state_mismatch` during the daylight saving time fall-back hour when OAuth state is stored in the database and the server's time zone observes daylight saving time ([#12320](better-auth/better-auth#12320)) - Fixed the OpenAPI schema to document query parameters for endpoints whose query schema is wrapped in `z.optional()`, such as `/get-session` and Stripe's `/subscription/list` ([#12337](better-auth/better-auth#12337)) - Fixed `organization.getInvitation` to return the `INVITATION_NOT_FOUND` code for a missing, expired, or non-pending invitation ([#12332](better-auth/better-auth#12332)) - …[full notes](https://github.com/better-auth/better-auth/releases/tag/v1.7.19) </details> <details> <summary><b>@<!---->better-auth/passkey</b> (1.7.18 → 1.7.19)</summary> ## `better-auth` ### Bug Fixes - Fixed `/admin/create-user` leaving a user without a credential account when creating that account failed, such as a database hook throwing, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12338](better-auth/better-auth#12338)) - Fixed `/admin/create-user` leaving a user without a credential account when the password was rejected, such as by the Have I Been Pwned plugin, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12335](better-auth/better-auth#12335)) - Fixed client actions ignoring the HTTP method passed in second-argument fetch options, and attaching a request body when the method was a lowercase `get` or `HEAD` ([#12336](better-auth/better-auth#12336)) - Fixed plugin schema overrides (`modelName` and field names) leaking into other instances of the same plugin in one process ([#12319](better-auth/better-auth#12319)) - Fixed `/device/token` returning `invalid_grant` instead of `invalid_client` when `validateClient` rejects the `client_id`, matching `/device/code` and RFC 6749 section 5.2 ([#12246](better-auth/better-auth#12246)) - Fixed OAuth sign-in failing with `state_mismatch` during the daylight saving time fall-back hour when OAuth state is stored in the database and the server's time zone observes daylight saving time ([#12320](better-auth/better-auth#12320)) - Fixed the OpenAPI schema to document query parameters for endpoints whose query schema is wrapped in `z.optional()`, such as `/get-session` and Stripe's `/subscription/list` ([#12337](better-auth/better-auth#12337)) - Fixed `organization.getInvitation` to return the `INVITATION_NOT_FOUND` code for a missing, expired, or non-pending invitation ([#12332](better-auth/better-auth#12332)) - …[full notes](https://github.com/better-auth/better-auth/releases/tag/v1.7.19) </details> <details> <summary><b>@<!---->better-auth/sso</b> (1.7.18 → 1.7.19)</summary> ## `better-auth` ### Bug Fixes - Fixed `/admin/create-user` leaving a user without a credential account when creating that account failed, such as a database hook throwing, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12338](better-auth/better-auth#12338)) - Fixed `/admin/create-user` leaving a user without a credential account when the password was rejected, such as by the Have I Been Pwned plugin, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12335](better-auth/better-auth#12335)) - Fixed client actions ignoring the HTTP method passed in second-argument fetch options, and attaching a request body when the method was a lowercase `get` or `HEAD` ([#12336](better-auth/better-auth#12336)) - Fixed plugin schema overrides (`modelName` and field names) leaking into other instances of the same plugin in one process ([#12319](better-auth/better-auth#12319)) - Fixed `/device/token` returning `invalid_grant` instead of `invalid_client` when `validateClient` rejects the `client_id`, matching `/device/code` and RFC 6749 section 5.2 ([#12246](better-auth/better-auth#12246)) - Fixed OAuth sign-in failing with `state_mismatch` during the daylight saving time fall-back hour when OAuth state is stored in the database and the server's time zone observes daylight saving time ([#12320](better-auth/better-auth#12320)) - Fixed the OpenAPI schema to document query parameters for endpoints whose query schema is wrapped in `z.optional()`, such as `/get-session` and Stripe's `/subscription/list` ([#12337](better-auth/better-auth#12337)) - Fixed `organization.getInvitation` to return the `INVITATION_NOT_FOUND` code for a missing, expired, or non-pending invitation ([#12332](better-auth/better-auth#12332)) - …[full notes](https://github.com/better-auth/better-auth/releases/tag/v1.7.19) </details> <details> <summary><b>@<!---->effect/platform-node</b> (4.1.2 → 4.1.3)</summary> ### Patch Changes - [#10360](Effect-TS/effect#10360) [`8968d09`](Effect-TS/effect@8968d09) Thanks @<!---->effect-bot! - Fix `NodeHttpServer` shutdown hanging when an upgrade request is refused or answered with a regular HTTP response and the client sends more bytes afterwards. - [#10405](Effect-TS/effect#10405) [`0fe8890`](Effect-TS/effect@0fe8890) Thanks @<!---->yousefelgoharyx! - Fix slow `NodeHttpServer` shutdown with connected WebSocket clients. Shutdown now closes WebSockets with code 1001 as soon as it starts, and destroys upgraded connections that are still open after `gracefulShutdownTimeout` instead of also waiting out the WebSocket closing handshake. - [#10466](Effect-TS/effect#10466) [`ba272c5`](Effect-TS/effect@ba272c5) Thanks @<!---->tim-smart! - Update repository dependencies to their latest compatible releases. - Updated dependencies [[`56bbd6f`](Effect-TS/effect@56bbd6f), [`7150ea1`](Effect-TS/effect@7150ea1), [`7f7b7c3`](Effect-TS/effect@7f7b7c3), [`606ff10`](Effect-TS/effect@606ff10), [`da85361`](Effect-TS/effect@da85361), [`95b01bb`](Effect-TS/effect@95b01bb), [`b09e7a8`](Effect-TS/effect@b09e7a8), [`91386c0`](Effect-TS/effect@91386c0), [`a2b1be0`](Effect-TS/effect@a2b1be0), [`1a2c5a6`](https://githu …[full notes](https://github.com/Effect-TS/effect/releases/tag/%40effect/platform-node%404.1.3) </details> <details> <summary><b>@<!---->effect/sql-d1</b> (4.1.2 → 4.1.3)</summary> ### Patch Changes - [#10387](Effect-TS/effect#10387) [`13c0e77`](Effect-TS/effect@13c0e77) Thanks @<!---->effect-bot! - Fix providing a generic `SqlClient` layer removing a driver service such as `PgClient` from an effect's requirements. The program type-checked as runnable but failed at runtime with `Service not found`. A driver client is no longer a subtype of `SqlClient.SqlClient`. Code that picks between driver layers, such as `cond ? PgClient.layer(...) : MysqlClient.layer(...)`, may need an explicit `Layer.Layer<SqlClient.SqlClient, E>` annotation. - [#10466](Effect-TS/effect#10466) [`ba272c5`](Effect-TS/effect@ba272c5) Thanks @<!---->tim-smart! - Update repository dependencies to their latest compatible releases. - Updated dependencies [[`56bbd6f`](Effect-TS/effect@56bbd6f), [`7150ea1`](Effect-TS/effect@7150ea1), [`da85361`](Effect-TS/effect@da85361), [`95b01bb`](Effect-TS/effect@95b01bb), [`b09e7a8`](Effect-TS/effect@b09e7a8), [`91386c0`](Effect-TS/effect@91386c0), [`a2b1be0`](Effect-TS/effect@a2b1be0), [`1a2c5a6`](Effect-TS/effect@1a2c5a6), [`2a9d989`](Effect-TS/effect@2a9d989), [`66cbcca`](Effect-TS/effect@66cbcca), [`da52437`](Effect-TS/effect@da52437), [`7e8f3fb …[full notes](https://github.com/Effect-TS/effect/releases/tag/%40effect/sql-d1%404.1.3) </details> <details> <summary><b>@<!---->effect/vitest</b> (4.1.2 → 4.1.3)</summary> ### Patch Changes - Updated dependencies [[`56bbd6f`](Effect-TS/effect@56bbd6f), [`7150ea1`](Effect-TS/effect@7150ea1), [`da85361`](Effect-TS/effect@da85361), [`95b01bb`](Effect-TS/effect@95b01bb), [`b09e7a8`](Effect-TS/effect@b09e7a8), [`91386c0`](Effect-TS/effect@91386c0), [`a2b1be0`](Effect-TS/effect@a2b1be0), [`1a2c5a6`](Effect-TS/effect@1a2c5a6), [`2a9d989`](Effect-TS/effect@2a9d989), [`66cbcca`](Effect-TS/effect@66cbcca), [`da52437`](Effect-TS/effect@da52437), [`7e8f3fb`](Effect-TS/effect@7e8f3fb), [`1de4308`](Effect-TS/effect@1de4308), [`cb36ec7`](Effect-TS/effect@cb36ec7), [`693259d`](Effect-TS/effect@693259d), [`0daaa95`](Effect-TS/effect@0daaa95), [`f548e59`](Effect-TS/effect@f548e59), [`005d096`](Effect-TS/effect@005d096), [`188c2b0`](Effect-TS/effect@188c2b0), [`258fb50`](Effect-TS/effect@258fb50 …[full notes](https://github.com/Effect-TS/effect/releases/tag/%40effect/vitest%404.1.3) </details> <details> <summary><b>@<!---->react-email/ui</b> (6.11.8 → 6.11.10) — 2 releases</summary> <details> <summary><b>6.11.10</b></summary> ### Patch Changes * 92484bd: Fix `email build` failing at random with `(void 0) is not a function` when Next.js prerenders pages in several workers. Each worker now writes the JSX runtime to a temporary file and renames it into place, so no worker reads a half-written runtime. </details> <details> <summary><b>6.11.9</b></summary> ### Patch Changes * 44169a6: Scanning the emails directory no longer leaves a file handle open when a file can't be read, which crashed `email dev` on Node.js 25 and later. An unreadable file is now skipped with a warning instead of failing the whole scan. </details> </details> <details> <summary><b>better-auth</b> (1.7.18 → 1.7.19)</summary> ## `better-auth` ### Bug Fixes - Fixed `/admin/create-user` leaving a user without a credential account when creating that account failed, such as a database hook throwing, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12338](better-auth/better-auth#12338)) - Fixed `/admin/create-user` leaving a user without a credential account when the password was rejected, such as by the Have I Been Pwned plugin, which made retrying with the same email fail with `USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL` ([#12335](better-auth/better-auth#12335)) - Fixed client actions ignoring the HTTP method passed in second-argument fetch options, and attaching a request body when the method was a lowercase `get` or `HEAD` ([#12336](better-auth/better-auth#12336)) - Fixed plugin schema overrides (`modelName` and field names) leaking into other instances of the same plugin in one process ([#12319](better-auth/better-auth#12319)) - Fixed `/device/token` returning `invalid_grant` instead of `invalid_client` when `validateClient` rejects the `client_id`, matching `/device/code` and RFC 6749 section 5.2 ([#12246](better-auth/better-auth#12246)) - Fixed OAuth sign-in failing with `state_mismatch` during the daylight saving time fall-back hour when OAuth state is stored in the database and the server's time zone observes daylight saving time ([#12320](better-auth/better-auth#12320)) - Fixed the OpenAPI schema to document query parameters for endpoints whose query schema is wrapped in `z.optional()`, such as `/get-session` and Stripe's `/subscription/list` ([#12337](better-auth/better-auth#12337)) - Fixed `organization.getInvitation` to return the `INVITATION_NOT_FOUND` code for a missing, expired, or non-pending invitation ([#12332](better-auth/better-auth#12332)) - …[full notes](https://github.com/better-auth/better-auth/releases/tag/v1.7.19) </details> <details> <summary><b>effect</b> (4.1.2 → 4.1.3)</summary> ### Patch Changes - [#9990](Effect-TS/effect#9990) [`56bbd6f`](Effect-TS/effect@56bbd6f) Thanks @<!---->effect-bot! - Add `Rational`, an exact fraction type alongside `BigDecimal`, with `Schema.Rational` and `Schema.RationalFromString`. ```ts import { BigDecimal, Rational } from "effect" const third = Rational.makeUnsafe(1n, 3n) Rational.equals(Rational.multiply(third, Rational.fromBigInt(3n)), Rational.fromBigInt(1n)) // true Rational.toBigDecimal(third, { scale: 3 }) // BigDecimal 0.333 ``` - [#9842](Effect-TS/effect#9842) [`7150ea1`](Effect-TS/effect@7150ea1) Thanks @<!---->tim-smart! - Add experimental AG-UI protocol support to `effect/ai` through the new `AgUiSchema`, `AgUi`, and `AgUiServer` modules, and a `keepAlive` option to `HttpApiSchema.StreamSse`. - [#10377](Effect-TS/effect#10377) [`da85361`](Effect-TS/effect@da85361) Thanks @<!---->effect-bot! - Add `CommandSpec`, a lossless projection of an `effect/cli` command path for documentation tooling, plus `Flag.annotate` / `Argument.annotate` / `Param.annotate` for attaching custom metadata to parameters. ```ts import { Config, Context, Option } from "effect" import { Command, CommandSpec, Flag } from "effect/cli" const EnvVar = Context.Service<never, string>("app/EnvVar") const push = Command.make("push", { dbUrl: Flag.String("db-url").pipe( Flag.withFallbackConfig(Config.String("DB_URL")), Flag.annotate(EnvVar, "DB_URL") ) }) const cli = Command.make("app").pipe(Command.withSubcommands([push])) const spec = Option.getOrThrow(CommandSpec.resolve(cli, ["app", "push"])) for (const flag of spec.flags) { // flag.scope, flag.required, flag.fallbacks, Context.getOption(flag.annotations, EnvVar), ... } ``` - …[full notes](https://github.com/Effect-TS/effect/releases/tag/effect%404.1.3) </details> <details> <summary><b>jose</b> (6.2.16 → 6.2.17)</summary> ### Fixes * **jwt:** reject negative maxTokenAge ([a5b422c](panva/jose@a5b422c)) </details> <details> <summary><b>react-email</b> (6.11.8 → 6.11.10) — 2 releases</summary> <details> <summary><b>6.11.10</b></summary> ### Patch Changes * 64fa975: Render `<CodeInline>` as a single `<code>` element, so its text no longer shows up twice in inbox previews and plain text * f20a697: `<Markdown>` now escapes HTML inside code blocks and inline code. Code samples like `<b>bold</b>` were rendered as real HTML instead of showing the snippet. * Updated dependencies \[fe6b066] * @<!---->react-email/[email protected] </details> <details> <summary><b>6.11.9</b></summary> ### Patch Changes * bc2becd: `<Button>` now converts `pt` padding values to `px` instead of treating them as `0`, so `style={{ padding: '9pt 15pt' }}` or `className="px-[15pt] py-[9pt]"` keeps its padding in every client and in the Outlook spacers. * 44169a6: The preview server no longer leaves a file handle open when a file under `static/` can't be read (for example a file locked by another program on Windows). On Node.js 25 and later, that leaked handle crashed `email dev` with `ERR_INVALID_STATE` the next time the garbage collector ran. Requesting a directory under `/static` now returns a 404 instead of a 500. * de32c06: `<Tailwind>` now resolves theme values that utilities pass through their own variables, so gradients (`from-red-500`), shadow and ring colors (`shadow-red-500`, `ring-blue-500`), `blur-*`, `drop-shadow-*` and `translate-*` no longer inline an unresolvable `var(--color-…)` or `var(--spacing)`. * d38e9a2: render block tokens in tight list items </details> </details> --- *This PR was auto-generated by [catalog-update-action](https://github.com/brandhaug/catalog-update-action).* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
CommandSpec, a lossless, documentation-oriented projection of one command path, plusParam.annotate/Flag.annotate/Argument.annotateand structural fallback metadata so documentation generators no longer needeffect/cliinternals.Closes EFF-3379
Why
Completions.fromCommandis completion-shaped on purpose: it drops hidden flags and unlisted subcommands, flattens local and inherited flags without provenance, never sees global flags or built-ins, collapses file primitives intoPath, and knows nothing about defaults, config/prompt fallbacks or variadic bounds.HelpDocis only reachable by running--helpthrough a custom presenter and is already rendered to strings. Defaults and fallbacks were closed over in parser functions, so no projection could report them without this change.What
CommandSpec.resolve(root, path, { builtIns? })returnsOption<Spec>: name/descriptions/alias/unlisted, examples resolved for the path, the effective flags withscope(Local/Inheritedwith the declaring ancestor /Globalwith the declaring command orundefinedfor built-ins), arguments, and direct subcommands including unlisted ones. Only canonical names match; aliases, unknown segments, a foreign root or an empty path givenoneinstead of the deepest matching ancestor, unlike--help.type,typeName,metavar,required,fallbacks,variadicbounds,optionalValue, effectivenegationandannotations.Param.Transformgains an optionalfallbackfield (Defaultwith its literal value,DefaultEffect,Config,Prompt) set bywithDefault,withFallbackConfigandwithFallbackPrompt. PurewithDefaultnow buildsTransform(Optional(...))instead ofMap(Optional(...)); nothing outsideParam.tsmatches on those tags. The fallback is never evaluated.Param.Singlegainsannotations: Context.Context<never>andParam.annotate(key, value)mirrorsCommand.annotate.Flag.annotateandArgument.annotateare thin wrappers.!isOptional && (!isVariadic || min > 0)) moves intogetParamMetadata().isRequiredand is shared by help andCommandSpec. Fix zero-minimum variadic requiredness in CLI completion descriptors #10375 fixes the completions descriptor inline with the same rule; switching it toisRequiredcan follow once both land, to avoid a conflicting edit here.Parsing,
--helpoutput and completion scripts are unchanged.Review guide
packages/effect/src/cli/Param.ts:Fallback,Transform.fallback, the three fallback combinators,annotate,transformSinglecarryingfallback,getParamMetadata.packages/effect/src/cli/CommandSpec.ts: the projection.resolveLineageand the flag collection mirrorinternal/help.ts.packages/effect/test/cli/CommandSpec.test.ts: contract tests written before the implementation. One expectation was reordered to match help's subcommand order (ungrouped first, then groups), sinceCommand.subcommandsno longer carries declaration order.Validation
pnpm vitest run packages/effect/test/cli: 477 passed, 3 skipped.CommandSpec,Param,Flag,Argument: pass.pnpm checkandpnpm lint: pass.