Repository navigation
chore(cli): spike command facts for the command contract - #7557
Draft
mdonnalley wants to merge 4 commits into
Draft
mdonnalley wants to merge 4 commits into
mdonnalley wants to merge 4 commits into
Conversation
kanadgupta
reviewed
Nov 10, 2026
Comment on lines
+21
to
+22
| readonly readonly: boolean; | ||
| readonly destructive: boolean; |
Member
There was a problem hiding this comment.
quickly skimming this PR and this caught my eye — is it possible for a command to be both readonly and destructive? should CatalogTraits be a string enum instead (e.g., 'readonly' | 'destructive' | 'other')?
This branch has not been deployed
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.
Proof of concept for a command contract built from Effect CLI's existing slots and per-fact annotations. Not intended to merge as is; it will be split into separate PRs.
Each fact a command declares lives where Effect already has a slot (input in
Command.make, descriptions and examples inCommand.with*) or as oneContextkey onCommand.annotations, written by a combinator that also installs the fact's check. A registry pairs each fact with a Schema and its check kinds (compiler, render, runtime or none), andcommandCatalogwalks the command tree and returns every command's facts as data.What it adds:
command-internal/command-facts/):registerFact,COMMAND_FACTS, a test that fails on unregistered annotations, andcommandCatalog. Permissions, target policy, output, global flags and stage are registered.withGlobalFlagsRead): a two-way check against the leaf's requirement type, so an undeclared read or an unused declaration fails to compile. Help lists only the global flags a command declares. Adopted onbranches delete.CommandOutput.withHandler): the handler returns the output schema's type, and a wrapper encodes and writes it. Adopted onbranches delete.withStage): declares experimental status and installs the gate before the handler and its layers. The docs spec reads it. Adopted onnetwork-bans getandremove.parseExample,checkDocsExamples):pnpm docs:specparses every published example against the command tree without running handlers.Known gaps: global flag reads through
Effect.serviceOptionbypass the check; the catalog omits positional arguments and flag value types.