Repository navigation
feat(cli): let declarative command flags imply other request body values - #139
Open
TristanSpeakEasy wants to merge 2 commits into
Open
TristanSpeakEasy wants to merge 2 commits into
TristanSpeakEasy wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 10 files
Shadow auto-approve: would not auto-approve because issues were found.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.
View guided diff | Turn on auto-fix | Re-trigger cubic
AshGodfrey
approved these changes
Oct 23, 2026
AshGodfrey
left a comment
Contributor
There was a problem hiding this comment.
Verified on a regenerated CLI with implies: {$.stream: false} on a bool flag: applied on both dispatch routes and through --body, @file, @- and stdin, explicit --stream wins, and the linker rejects misuse.
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.
Why
Some APIs pair a
background: truerequest flag with astreamproperty whose schema default istrue. A declarative intent command can expose both as flags, but there was no way to say that--backgroundshould turn streaming off. The command therefore sent{"background": true, "stream": true}, stayed attached to the event stream and blocked until the run finished, instead of returning the created resource and its ID straight away. Dispatch (multi-route) commands also have no stream toggle, so neither a preset nor a flag default could express it.What changed
Flags in
x-speakeasy-cli-commandsaccept animplies:map of root-level body values to fill in when the request body sets the flag's own property totrue:internal/extensions/cli_commands.go):impliesis rejected on positional args and onoperations:flags, requires the flag to bind a root-level body property, and cannot set the flag's own property.cli_commands_link.go): the flag must be a bool, and every implied property must exist on each request variant that declares the flag and normalise to the same value, so one runtime rule serves every route.flagutil.ApplyImpliedBodyruns after--body/stdin, declared inputs and presets are merged. It applies to both--backgroundand--body '{"background":true}', and never overrides a key the request already carries (an explicit--streamwins).includes/intents.tsandintentcmd.go.stmpl, documented in the CLI README, covered byTestCLICommands_FlagImplies.flagutilhelper changes, since the review spec does not useimplies:); changeset added.Testing
go test ./internal/extensions/: passes.TARGET=review make test-cli,make check-template-cli,make lint: pass.streamdefaulting totrue,backgroundon both routes) plusimplies: {$.stream: false}onbackground, and checked the--dry-run -o jsonbody:backgroundstreamrun hi --backgroundrun hi --backgroundon the second routerun hi --background --streamrun hirun hi --background=false--body '{"input":"hi","background":true}'(and via stdin)--body '{"input":"hi","background":true,"stream":true}'With
stream: falsethe request also negotiates the JSON response, so the command prints the created resource and exits.Public-safety check
.claude/skills/public-repo-communication/SKILL.md).git diff --check.Summary by cubic
Adds an
impliesmap to declarative command flags (x-speakeasy-cli-commands) so a bool flag can fill other root-level body values when set. This lets--backgroundalso sendstream: false, so the command returns the created resource instead of blocking on the event stream.New Features
implies: {$.stream: false}; the runtime applies it after merging--body/stdin, declared inputs, and presets, and never overrides a key already set.impliesis rejected on positional args,operations:flags, non-bool flags, and flags not bound to a root-level body property.TestCLICommands_FlagImpliescovering the behavior.Written for commit 4456a4f. Summary will update on new commits.