From 6c984d7ac62bc2917bc4b03065f3752888e5035a Mon Sep 17 00:00:00 2001 From: 2ynn Date: Fri, 16 Oct 2026 19:58:05 -0400 Subject: [PATCH 1/7] fix(cli): compose --usage schemas from the runtime command tree Root and group `--usage` were served from KDL strings rendered at generation time, one full string per command path. Commands attached after generation (`custom: true` placeholders filled in by `custom.Register`, leaves mounted under generated groups, flags added to generated commands) were missing from every ancestor's schema or appeared as bare nodes, while their own `--usage` was correct. A command marked dynamic was rendered live from cobra, which dropped `suggestions`, `default=`, declared flag order and placeholders, and took arg help/requiredness from the prompt annotation. The generator now emits `usageNodes`: for each command path, its head line, aliases, args, flags (keyed by long name, with settings/hidden markers) and declared child names, rendered once at indent 0. `EmitSchema` composes every schema from the assembled cobra tree: - generated nodes render verbatim; children keep declared order, children removed at runtime are dropped, available children added at runtime are appended; - a command marked with `usage.MarkDynamic`, or absent from the table, takes `help` from the runtime `Short`, keeps the generated alias/arg/flag lines for everything it still has (flags hidden at runtime are dropped) and renders only runtime-added aliases and local flags live; - settings flags stay on a command's own schema only, as before. Commands unchanged at runtime render byte-identically to the previous output. Each node is stored once instead of being repeated in every ancestor's string, roughly halving the generated schema source. Tests: `TestUsageSchema_ComposesRuntimeCommands`, `TestUsageSchema_DynamicCommandKeepsGeneratedLines` and `TestUsageSchema_DynamicRootUnchanged`; the empty-body snapshot test follows the new table shape. README `--usage` section updated; review SDK regenerated. --- .changesets/1792192360-339cd950.yaml | 10 + .../snapshots/cli_empty_body_go_test.go | 12 +- templates/templates/cli/README.md | 2 +- templates/templates/cli/includes/usage.ts | 208 ++++---- templates/templates/cli/usage.go.stmpl | 233 +++++++-- templates/templates/cli/usage_test.go.stmpl | 63 +++ zSDKs/sdk-cli/.speakeasy/gen.lock | 4 +- zSDKs/sdk-cli/internal/usage/schema.go | 452 +++++++++++------- zSDKs/sdk-cli/tests/usage_test.go | 63 +++ 9 files changed, 707 insertions(+), 340 deletions(-) create mode 100644 .changesets/1792192360-339cd950.yaml diff --git a/.changesets/1792192360-339cd950.yaml b/.changesets/1792192360-339cd950.yaml new file mode 100644 index 000000000..de588efce --- /dev/null +++ b/.changesets/1792192360-339cd950.yaml @@ -0,0 +1,10 @@ +id: 1792192360-339cd950 +features: + - core +targets: + - cli +type: fix +bump: patch +description: compose root and group --usage schemas from the runtime command tree so commands and flags attached after generation appear +author: 2ynn +date: "2026-10-16" diff --git a/pkg/generate/snapshots/cli_empty_body_go_test.go b/pkg/generate/snapshots/cli_empty_body_go_test.go index f6cf0e228..02469ac55 100644 --- a/pkg/generate/snapshots/cli_empty_body_go_test.go +++ b/pkg/generate/snapshots/cli_empty_body_go_test.go @@ -228,12 +228,12 @@ func TestSnapCLIEmptyBodyExamplesAndFlags(t *testing.T) { } usageSource, err := os.ReadFile(filepath.Join(outputDir, "internal", "usage", "schema.go")) require.NoError(t, err) - usagePattern := regexp.MustCompile(`"widgets (optional|optionalexample|required|formoptional|formrequired)":\s*"(.*)"`) - usageSchemas := usagePattern.FindAllStringSubmatch(string(usageSource), -1) - require.Len(t, usageSchemas, 5) - for _, schema := range usageSchemas { - require.Contains(t, schema[2], "--body ") - require.NotContains(t, schema[2], "--body-param") + usagePattern := regexp.MustCompile(`"widgets (optional|optionalexample|required|formoptional|formrequired)":\s*\{(.*)\}`) + usageNodes := usagePattern.FindAllStringSubmatch(string(usageSource), -1) + require.Len(t, usageNodes, 5) + for _, node := range usageNodes { + require.Contains(t, node[2], "--body ") + require.NotContains(t, node[2], "--body-param") } for _, name := range []string{"required", "formrequired"} { command := readCommand(name) diff --git a/templates/templates/cli/README.md b/templates/templates/cli/README.md index 168b1a47a..31b811c80 100644 --- a/templates/templates/cli/README.md +++ b/templates/templates/cli/README.md @@ -1395,7 +1395,7 @@ The KDL schema is built at generation time from the command tree in `includes/us Declared commands (`x-speakeasy-cli-commands`) are part of the schema: bound intents mount into the KDL tree under their declared parent path with the same flag surface the runtime registers (declared positional `arg` nodes, operation security flags, the body flag, `--schema`, and declared flags — plus non-body parameter metadata for JSON-body intents (multipart intents keep their upload fields); `buildIntentUsageCommand` in `includes/usage.ts`), and planned placeholders appear with their summary. For commands added after static schema generation, live schema emission reads `speakeasy_prompt_args` and emits the same `arg` nodes. Once Cobra validation succeeds, `--usage` on an intent or planned command emits KDL and wins over the command's other runtime surfaces, including `--schema` and the bare-invocation usage error (`runIntent*Cmd` in `intentcmd.go.stmpl` and `newPlannedCmd` in `intents.go.stmpl` check `usage.UsageRequested` first, matching operation commands). -**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. Commands absent from the static KDL table use live Cobra schema emission, including declared positional `arg` nodes. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. +**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated alias, arg and flag lines for everything it still has (dropping flags hidden at runtime), and renders only runtime-added aliases and local flags live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path, so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. ### Generated README & Command Docs diff --git a/templates/templates/cli/includes/usage.ts b/templates/templates/cli/includes/usage.ts index 52ad641a1..1c38c17b9 100644 --- a/templates/templates/cli/includes/usage.ts +++ b/templates/templates/cli/includes/usage.ts @@ -1441,104 +1441,89 @@ function renderUsageFlag(flag: UsageFlagDef, indent: number): string[] { ]; } -function renderUsageCommand( - cmd: UsageCommandDef, - indent: number, - includeSettings = false, -): string[] { - const lines: string[] = []; - const childLines: string[] = []; - for (const alias of cmd.aliases || []) { - childLines.push(`${" ".repeat(indent + 1)}alias ${kdlQuoted(alias)}`); - } - for (const arg of cmd.args || []) { - const props: string[] = []; - pushIf( - props, - arg.help ? kdlPropAt("help", arg.help, " ".repeat(indent + 2)) : "", - ); - pushIf(props, arg.required ? kdlProp("required", true) : ""); - pushIf(props, arg.variadic ? kdlProp("var", true) : ""); - const line = `${" ".repeat(indent + 1)}arg ${kdlQuoted(arg.name)}${ - props.length ? ` ${props.join(" ")}` : "" - }`; - if (!arg.suggestions || arg.suggestions.length === 0) { - childLines.push(line); - continue; - } - childLines.push( - `${line} {`, - `${" ".repeat(indent + 2)}suggestions ${arg.suggestions - .map(kdlQuoted) - .join(" ")}`, - `${" ".repeat(indent + 1)}}`, - ); - } - for (const flag of cmd.flags || []) { - if (flag.settings && !includeSettings) continue; - childLines.push(...renderUsageFlag(flag, indent + 1)); - } - for (const child of cmd.commands || []) { - childLines.push(...renderUsageCommand(child, indent + 1)); - } - +function renderUsageArg(arg: UsageArgDef, indent: number): string[] { const props: string[] = []; pushIf( props, - cmd.help ? kdlPropAt("help", cmd.help, " ".repeat(indent + 1)) : "", + arg.help ? kdlPropAt("help", arg.help, " ".repeat(indent + 1)) : "", ); - if (childLines.length > 0) { - lines.push( - `${" ".repeat(indent)}cmd ${kdlQuoted(cmd.name)}${ - props.length ? ` ${props.join(" ")}` : "" - } {`, - ); - lines.push(...childLines); - lines.push(`${" ".repeat(indent)}}`); - return lines; - } + pushIf(props, arg.required ? kdlProp("required", true) : ""); + pushIf(props, arg.variadic ? kdlProp("var", true) : ""); + const line = `${" ".repeat(indent)}arg ${kdlQuoted(arg.name)}${ + props.length ? ` ${props.join(" ")}` : "" + }`; + if (!arg.suggestions || arg.suggestions.length === 0) return [line]; + return [ + `${line} {`, + `${" ".repeat(indent + 1)}suggestions ${arg.suggestions + .map(kdlQuoted) + .join(" ")}`, + `${" ".repeat(indent)}}`, + ]; +} - lines.push( - `${" ".repeat(indent)}cmd ${kdlQuoted(cmd.name)}${ - props.length ? ` ${props.join(" ")}` : "" - }`, - ); - return lines; +function renderUsageRootHead(): string { + return [ + `name ${kdlQuoted(getHumanCliName())}`, + `bin ${kdlQuoted(sanitizeCliName())}`, + `about ${kdlStringAt(usageRootAbout(), " ")}`, + `version ${kdlQuoted(context.Global.Config.SDKVersion)}`, + `config {`, + ` file ${kdlQuoted(`~/.config/${sanitizeCliName()}/config.yaml`)}`, + `}`, + ].join("\n"); +} + +function renderUsageCommandHead(cmd: UsageCommandDef): string { + return `cmd ${kdlQuoted(cmd.name)}${ + cmd.help ? ` ${kdlPropAt("help", cmd.help, " ")}` : "" + }`; +} + +function usageFlagKey(flag: UsageFlagDef): string { + return /(?:^|\s)--([^\s<]+)/.exec(flag.spec)?.[1] ?? flag.spec; } -function collectCommandPathSchemas( +interface UsageNodeItem { + key: string; + text: string; + settings?: boolean; + hidden?: boolean; +} + +// Rendered at indent 0; the runtime re-indents each line by depth. +interface UsageNodeEntry { + head: string; + aliases: UsageNodeItem[]; + args: string[]; + flags: UsageNodeItem[]; + children: string[]; +} + +function collectUsageNodes( cmd: UsageCommandDef, path: string[], - out: Map, - includeRootMetadata: boolean, + out: Map, + isRoot: boolean, ) { - const lines: string[] = []; - if (includeRootMetadata) { - lines.push(`name ${kdlQuoted(getHumanCliName())}`); - lines.push(`bin ${kdlQuoted(sanitizeCliName())}`); - lines.push(`about ${kdlStringAt(usageRootAbout(), " ")}`); - lines.push(`version ${kdlQuoted(context.Global.Config.SDKVersion)}`); - lines.push(`config {`); - lines.push( - ` file ${kdlQuoted(`~/.config/${sanitizeCliName()}/config.yaml`)}`, - ); - lines.push(`}`); - for (const flag of cmd.flags || []) { - lines.push(...renderUsageFlag(flag, 0)); - } - for (const child of cmd.commands || []) { - lines.push(...renderUsageCommand(child, 0)); - } - } else { - lines.push(...renderUsageCommand(cmd, 0, true)); - } - const schema = lines.join("\n") + "\n"; - out.set(path.join(" "), schema); - for (const alias of cmd.aliases || []) { - out.set([...path.slice(0, -1), alias].join(" "), schema); - } + const depth = isRoot ? 0 : 1; + out.set(path.join(" "), { + head: isRoot ? renderUsageRootHead() : renderUsageCommandHead(cmd), + aliases: (cmd.aliases || []).map((alias) => ({ + key: alias, + text: `${" ".repeat(depth)}alias ${kdlQuoted(alias)}`, + })), + args: (cmd.args || []).map((arg) => renderUsageArg(arg, depth).join("\n")), + flags: (cmd.flags || []).map((flag) => ({ + key: usageFlagKey(flag), + text: renderUsageFlag(flag, depth).join("\n"), + settings: flag.settings, + hidden: flag.hidden, + })), + children: (cmd.commands || []).map((child) => child.name), + }); for (const child of cmd.commands || []) { - collectCommandPathSchemas(child, [...path, child.name], out, false); + collectUsageNodes(child, [...path, child.name], out, false); } } @@ -2402,15 +2387,48 @@ registerTemplateFunc( templatePlannedUsageCmdName, ); -function templateUsageSchemaMap(): string { - const root = buildRootUsageCommand(); - const schemas = new Map(); - collectCommandPathSchemas(root, [], schemas, true); - const entries = Array.from(schemas.entries()).map( - ([k, v]) => `${goStringLiteral(k)}: ${goTemplateSafeStringExpr(v)}`, +function goUsageNodeItems(items: UsageNodeItem[]): string { + return `[]usageItem{ ${items + .map( + (item) => + `{key: ${goStringLiteral(item.key)}, text: ${goTemplateSafeStringExpr( + item.text, + )}${item.settings ? ", settings: true" : ""}${ + item.hidden ? ", hidden: true" : "" + } }`, + ) + .join(", ")} }`; +} + +function goUsageNodeEntry(node: UsageNodeEntry): string { + const fields = [`head: ${goTemplateSafeStringExpr(node.head)}`]; + if (node.aliases.length) { + fields.push(`aliases: ${goUsageNodeItems(node.aliases)}`); + } + if (node.args.length) { + fields.push( + `args: []string{ ${node.args.map(goTemplateSafeStringExpr).join(", ")} }`, + ); + } + if (node.flags.length) { + fields.push(`flags: ${goUsageNodeItems(node.flags)}`); + } + if (node.children.length) { + fields.push( + `children: []string{ ${node.children.map(goStringLiteral).join(", ")} }`, + ); + } + return `{ ${fields.join(", ")} }`; +} + +function templateUsageNodeMap(): string { + const nodes = new Map(); + collectUsageNodes(buildRootUsageCommand(), [], nodes, true); + const entries = Array.from(nodes.entries()).map( + ([path, node]) => `${goStringLiteral(path)}: ${goUsageNodeEntry(node)}`, ); - return `var usageSchemas = map[string]string{\n\t${entries.join( + return `var usageNodes = map[string]usageNode{\n\t${entries.join( ",\n\t", )},\n}`; } -registerTemplateFunc("templateUsageSchemaMap", templateUsageSchemaMap); +registerTemplateFunc("templateUsageNodeMap", templateUsageNodeMap); diff --git a/templates/templates/cli/usage.go.stmpl b/templates/templates/cli/usage.go.stmpl index 4be56e1fd..eaf350b79 100644 --- a/templates/templates/cli/usage.go.stmpl +++ b/templates/templates/cli/usage.go.stmpl @@ -10,7 +10,22 @@ package usage {{genImports}} -{{templateUsageSchemaMap}} +type usageItem struct { + key string + text string + settings bool + hidden bool +} + +type usageNode struct { + head string + aliases []usageItem + args []string + flags []usageItem + children []string +} + +{{templateUsageNodeMap}} func UsageRequested(cmd *cobra.Command) bool { if cmd == nil { @@ -81,15 +96,138 @@ func selectedCommandPath(cmd *cobra.Command) []string { } func EmitSchema(cmd *cobra.Command, w io.Writer) error { - path := strings.Join(selectedCommandPath(cmd), " ") - if cmd.Annotations["speakeasy_usage_dynamic"] == "true" { - return emitLiveSchema(cmd, w) + var b strings.Builder + renderUsageNode(&b, cmd, strings.Join(selectedCommandPath(cmd), " "), 0, true) + _, err := io.WriteString(w, b.String()) + return err +} + +const usageDynamicAnnotation = "speakeasy_usage_dynamic" + +func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own bool) { + node, static := usageNodes[path] + dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" + isRoot := cmd.Parent() == nil + head := node.head + if dynamic && !isRoot { + head = "cmd " + kdlQuote(cmd.Name()) + " help=" + kdlQuoteAt(cmd.Short, " ") + } + var body []string + if dynamic { + body = mergedUsageBody(cmd, node, own) + } else { + body = staticUsageBody(node, own) + } + children := usageChildren(cmd, node.children) + block := !isRoot && (len(body) > 0 || len(children) > 0) + + writeUsageIndented(b, head, indent) + if block { + b.WriteString(" {") + } + b.WriteByte('\n') + for _, item := range body { + writeUsageIndented(b, item, indent) + b.WriteByte('\n') + } + childIndent := indent + 1 + if isRoot { + childIndent = indent + } + for _, child := range children { + childPath := child.Name() + if path != "" { + childPath = path + " " + childPath + } + renderUsageNode(b, child, childPath, childIndent, false) + } + if block { + b.WriteString(strings.Repeat(" ", indent) + "}\n") + } +} + +// Settings flags are declared once on the root, so only a command's own schema lists them. +func staticUsageBody(node usageNode, own bool) []string { + var body []string + for _, alias := range node.aliases { + body = append(body, alias.text) + } + body = append(body, node.args...) + for _, flag := range node.flags { + if own || !flag.settings { + body = append(body, flag.text) + } + } + return body +} + +func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { + local := cmd.LocalFlags() + var body []string + listed := map[string]bool{} + for _, alias := range node.aliases { + listed[alias.key] = true + if cmd.HasAlias(alias.key) { + body = append(body, alias.text) + } + } + for _, alias := range cmd.Aliases { + if !listed[alias] { + body = append(body, " alias "+kdlQuote(alias)) + } + } + if len(node.args) > 0 { + body = append(body, node.args...) + } else { + body = append(body, liveUsageArgs(cmd)...) } - if schema, ok := usageSchemas[path]; ok { - _, err := io.WriteString(w, schema) - return err + listed = map[string]bool{} + for _, flag := range node.flags { + listed[flag.key] = true + f := cmd.Flags().Lookup(flag.key) + if f != nil && (own || !flag.settings) && (flag.hidden || !f.Hidden) { + body = append(body, flag.text) + } + } + local.VisitAll(func(f *pflag.Flag) { + if !f.Hidden && f.Name != "help" && !listed[f.Name] { + body = append(body, liveUsageFlag(f)) + } + }) + return body +} + +func usageChildren(cmd *cobra.Command, declared []string) []*cobra.Command { + var children []*cobra.Command + listed := map[string]bool{} + for _, name := range declared { + listed[name] = true + for _, child := range cmd.Commands() { + if child.Name() == name { + children = append(children, child) + break + } + } + } + for _, child := range cmd.Commands() { + if !listed[child.Name()] && child.IsAvailableCommand() { + children = append(children, child) + } + } + return children +} + +// KDL multi-line strings keep empty lines unindented, so re-indenting skips them. +func writeUsageIndented(b *strings.Builder, text string, indent int) { + prefix := strings.Repeat(" ", indent) + for i, line := range strings.Split(text, "\n") { + if i > 0 { + b.WriteByte('\n') + } + if line != "" { + b.WriteString(prefix + line) + } } - return emitLiveSchema(cmd, w) } // MarkDynamic makes --usage render the command's schema live from its cobra definition. @@ -97,7 +235,7 @@ func MarkDynamic(cmd *cobra.Command) { if cmd.Annotations == nil { cmd.Annotations = map[string]string{} } - cmd.Annotations["speakeasy_usage_dynamic"] = "true" + cmd.Annotations[usageDynamicAnnotation] = "true" } // Go's %q emits \a, \v, and \xNN escapes that KDL v2 does not define. @@ -193,64 +331,57 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func emitLiveSchema(cmd *cobra.Command, w io.Writer) error { - nl := string(rune(10)) - var b strings.Builder - fmt.Fprintf(&b, "cmd %s help=%s {%s", kdlQuote(cmd.Name()), kdlQuoteAt(cmd.Short, " "), nl) - for _, alias := range cmd.Aliases { - fmt.Fprintf(&b, " alias %s%s", kdlQuote(alias), nl) - } +func liveUsageArgs(cmd *cobra.Command) []string { var promptArgs struct { Version int `json:"version"` - Args []struct { - Name string `json:"name"` - Summary string `json:"summary"` - Required bool `json:"required"` - Variadic bool `json:"variadic"` + Args []struct { + Name string `json:"name"` + Summary string `json:"summary"` + Required bool `json:"required"` + Variadic bool `json:"variadic"` } `json:"args"` } if raw := cmd.Annotations["speakeasy_prompt_args"]; raw != "" && json.Unmarshal([]byte(raw), &promptArgs) == nil && promptArgs.Version == 1 { + var lines []string for _, arg := range promptArgs.Args { - fmt.Fprintf(&b, " arg %s", kdlQuote(arg.Name)) + line := " arg " + kdlQuote(arg.Name) if arg.Summary != "" { - fmt.Fprintf(&b, " help=%s", kdlQuoteAt(arg.Summary, " ")) + line += " help=" + kdlQuoteAt(arg.Summary, " ") } if arg.Required { - b.WriteString(" required=#true") + line += " required=#true" } if arg.Variadic { - b.WriteString(" var=#true") + line += " var=#true" } - b.WriteString(nl) + lines = append(lines, line) } - } else if args := cmd.Annotations["speakeasy_args_help"]; args != "" { - fmt.Fprintf(&b, " args %s%s", kdlQuoteAt(args, " "), nl) + return lines } - cmd.LocalFlags().VisitAll(func(f *pflag.Flag) { - if f.Hidden || f.Name == "help" { - return - } - name := "--" + f.Name - if f.Shorthand != "" { - name = "-" + f.Shorthand + " " + name - } - _, repeatable := f.Value.(pflag.SliceValue) - if f.Value.Type() != "bool" { - placeholder := strings.ReplaceAll(f.Name, "-", "_") - if repeatable { - placeholder += "..." - } - name += " <" + placeholder + ">" - } - fmt.Fprintf(&b, " flag %s help=%s", kdlQuote(name), kdlQuoteAt(f.Usage, " ")) + if args := cmd.Annotations["speakeasy_args_help"]; args != "" { + return []string{" args " + kdlQuoteAt(args, " ")} + } + return nil +} + +func liveUsageFlag(f *pflag.Flag) string { + name := "--" + f.Name + if f.Shorthand != "" { + name = "-" + f.Shorthand + " " + name + } + _, repeatable := f.Value.(pflag.SliceValue) + if f.Value.Type() != "bool" { + placeholder := strings.ReplaceAll(f.Name, "-", "_") if repeatable { - b.WriteString(" var=#true") + placeholder += "..." } - b.WriteString(nl) - }) - b.WriteString("}" + nl) - _, err := io.WriteString(w, b.String()) - return err + name += " <" + placeholder + ">" + } + line := " flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, " ") + if repeatable { + line += " var=#true" + } + return line } func Intercept(root *cobra.Command) { diff --git a/templates/templates/cli/usage_test.go.stmpl b/templates/templates/cli/usage_test.go.stmpl index ef7916eb7..ade4297bd 100644 --- a/templates/templates/cli/usage_test.go.stmpl +++ b/templates/templates/cli/usage_test.go.stmpl @@ -7,6 +7,7 @@ {{- addImport "github.com/stretchr/testify/require" -}} {{- addImport "github.com/spf13/cobra" -}} {{- addImport "internal/cli" true -}} +{{- addImport "internal/usage" true -}} {{- if $custom -}} {{- addImport "github.com/spf13/pflag" -}} {{- end -}} @@ -214,6 +215,68 @@ func TestUsageSchema_GroupSubtree(t *testing.T) { } {{- end }} +func TestUsageSchema_ComposesRuntimeCommands(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + completion, _, err := root.Find([]string{"completion"}) + require.NoError(t, err) + + var before strings.Builder + require.NoError(t, usage.EmitSchema(root, &before)) + + leaf := &cobra.Command{Use: "runtime-leaf", Short: "Runtime leaf", RunE: func(*cobra.Command, []string) error { return nil }} + leaf.Flags().String("runtime-flag", "", "Runtime flag") + usage.MarkDynamic(leaf) + completion.AddCommand(leaf) + + var after strings.Builder + require.NoError(t, usage.EmitSchema(root, &after)) + block := " cmd \"runtime-leaf\" help=\"Runtime leaf\" {\n flag \"--runtime-flag \" help=\"Runtime flag\"\n }\n" + assert.Contains(t, after.String(), block) + assert.Equal(t, before.String(), strings.Replace(after.String(), block, "", 1)) + + var group strings.Builder + require.NoError(t, usage.EmitSchema(completion, &group)) + assert.Contains(t, group.String(), "\n cmd \"runtime-leaf\" help=\"Runtime leaf\" {\n") +} + +func TestUsageSchema_DynamicCommandKeepsGeneratedLines(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + configure, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + + var ownBefore, rootBefore strings.Builder + require.NoError(t, usage.EmitSchema(configure, &ownBefore)) + require.NoError(t, usage.EmitSchema(root, &rootBefore)) + configure.Flags().String("runtime-flag", "", "Runtime flag") + usage.MarkDynamic(configure) + + var ownAfter, rootAfter strings.Builder + require.NoError(t, usage.EmitSchema(configure, &ownAfter)) + require.NoError(t, usage.EmitSchema(root, &rootAfter)) + flag := " flag \"--runtime-flag \" help=\"Runtime flag\"\n" + assert.Equal(t, strings.TrimSuffix(ownBefore.String(), "}\n")+flag+"}\n", ownAfter.String()) + + start := strings.Index(rootBefore.String(), "\ncmd \"configure\"") + require.GreaterOrEqual(t, start, 0) + end := start + strings.Index(rootBefore.String()[start:], "\n}\n") + 1 + assert.Equal(t, rootBefore.String()[:end]+flag+rootBefore.String()[end:], rootAfter.String()) +} + +func TestUsageSchema_DynamicRootUnchanged(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + + var before strings.Builder + require.NoError(t, usage.EmitSchema(root, &before)) + usage.MarkDynamic(root) + + var after strings.Builder + require.NoError(t, usage.EmitSchema(root, &after)) + assert.Equal(t, before.String(), after.String()) +} + func TestUsageSchema_UsageFalseDoesNotEmitSchema(t *testing.T) { h := NewCLITestHarness(t) err := h.RunBare([]string{"version", "--usage=false"}) diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index 012d0562e..f68db2ef0 100644 --- a/zSDKs/sdk-cli/.speakeasy/gen.lock +++ b/zSDKs/sdk-cli/.speakeasy/gen.lock @@ -658,7 +658,7 @@ trackedFiles: internal/usage/bodyschemas.go: last_write_checksum: sha1:775249b69ed405ad072c16a76fe6113f375b3818 internal/usage/schema.go: - last_write_checksum: sha1:22b415ccb2fb4c1c80de2944a995e73ceef459c1 + last_write_checksum: sha1:fc4e1306294a3f2b36dc43d8936cfa6704f9fa93 scripts/install.ps1: last_write_checksum: sha1:9dcf40ea00ecb8ceda83d5056f57235b43cf658a scripts/install.sh: @@ -1120,7 +1120,7 @@ trackedFiles: tests/types_test.go: last_write_checksum: sha1:5ce31f08a3214779ed561d0f37279eb4d5202723 tests/usage_test.go: - last_write_checksum: sha1:36269b37c525a27adf10d5af9a0d28fb36191ecb + last_write_checksum: sha1:fe0b2aacebb2a131a096463b2c5991b65d39458b examples: _operation_with_leading_and_trailing_underscores_: speakeasy-default-operation-with-leading-and-trailing-underscores: diff --git a/zSDKs/sdk-cli/internal/usage/schema.go b/zSDKs/sdk-cli/internal/usage/schema.go index d01707798..1c0c2c6fa 100644 --- a/zSDKs/sdk-cli/internal/usage/schema.go +++ b/zSDKs/sdk-cli/internal/usage/schema.go @@ -12,146 +12,112 @@ import ( "sync" ) -var usageSchemas = map[string]string{ - "": "name \"cli\"\nbin \"cli\"\nabout \"\"\"\n This document will show case as many of our features as possible in as little operations/models as possible.\n This will then generate a SDK that we can more easily review than the test SDKs based on uber.yaml spec.\n \"\"\"\nversion \"0.0.1\"\nconfig {\n file \"~/.config/cli/config.yaml\"\n}\nflag \"--usage\" help=\"Print the CLI Usage schema in KDL format\" global=#true\nflag \"-v --version\" help=\"Print the CLI version\"\nflag \"-o --output-format \" help=\"Specify the output format. Options: pretty, json, yaml, table, toon.\" global=#true config=\"output_format\" default=\"pretty\"\nflag \"--color \" help=\"Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars.\" global=#true default=\"auto\"\nflag \"-q --jq \" help=\"Filter and transform output using a jq expression (e.g., '.name', '.items[] | .id')\" global=#true\nflag \"--raw-output\" help=\"Write --jq string results as raw text instead of JSON strings (like jq -r); non-string results stay JSON\" global=#true default=#false\nflag \"--server-url \" help=\"Override the default server URL\" global=#true\nflag \"--server \" help=\"Select a server by index (for indexed servers) or name (for named servers)\" global=#true\nflag \"-H --header \" help=\"Set a custom HTTP request header (format: \\\"Key: Value\\\"). Can be specified multiple times.\" global=#true var=#true\nflag \"--include-headers\" help=\"Include HTTP response headers in the output\" global=#true default=#false\nflag \"--timeout \" help=\"HTTP request timeout (e.g., 30s, 5m, 100ms)\" global=#true config=\"timeout\"\nflag \"--interactive\" help=\"Prompt for missing inputs and open guided configure/auth forms (forms fall back to line prompts on stdin off-TTY)\" global=#true default=#false\nflag \"--no-interactive\" help=\"Disable all interactive features (auto-prompting, explorer auto-launch, TUI forms)\" global=#true default=#false\nflag \"--dry-run\" help=\"Preview API requests without sending them (no network, no OS keychain). Human preview on stderr; with -o json or --jq, one JSON object per request on stdout. Local mutation commands (auth login, auth logout and configure) make no request: they skip prompts and writes and report a no-op (stderr, or one JSON object on stdout in the machine form)\" global=#true default=#false\nflag \"-d --debug\" help=\"Log request and response diagnostics to stderr\" global=#true default=#false\nflag \"--agent-mode\" help=\"Enable structured errors and default TOON output for AI coding agents.\" global=#true default=#false\nflag \"--no-retries\" help=\"Disable automatic retries (default: retries enabled with exponential backoff)\" global=#true config=\"no_retries\" default=#false\nflag \"--retry-max-elapsed-time \" help=\"Maximum total time for retries (e.g., 30s, 5m). Default: 30s\" global=#true config=\"retry_max_elapsed_time\"\nflag \"--retry-connection-errors\" help=\"Retry on connection errors (EOF, reset, etc.)\" global=#true config=\"retry_connection_errors\" default=#false\nflag \"--retry-config \" help=\"Full retry config as JSON. Schema: {\\\"strategy\\\":\\\"backoff\\\",\\\"backoff\\\":{\\\"initialInterval\\\":500,\\\"maxInterval\\\":10000,\\\"exponent\\\":1.5,\\\"maxElapsedTime\\\":30000},\\\"retryConnectionErrors\\\":false}. Times are in milliseconds.\" global=#true config=\"retry_config\"\nflag \"--subdomain \" help=\"Server template variable: subdomain\" global=#true\nflag \"--version-param \" help=\"Server template variable: version\" global=#true\nflag \"--host-name \" help=\"Server template variable: HostName\" global=#true\nflag \"--port \" help=\"Server template variable: PORT\" global=#true\nflag \"--username \" help=\"HTTP Basic username\" global=#true env=\"CLI_USERNAME\" config=\"security.username\"\nflag \"--password \" help=\"HTTP Basic password\" global=#true env=\"CLI_PASSWORD\" config=\"security.password\"\nflag \"--bearer-auth \" help=\"HTTP Bearer\" global=#true env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"\nflag \"--my-api-key \" help=\"API Key\" global=#true env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"\nflag \"--oauth2 \" help=\"OAuth2 Authorization\" global=#true env=\"CLI_OAUTH2\" config=\"security.oauth2\"\nflag \"--app-id \" help=\"Custom authentication credential\" global=#true env=\"CLI_APP_ID\" config=\"security.app_id\"\nflag \"--secret \" help=\"Custom authentication credential\" global=#true env=\"CLI_SECRET\" config=\"security.secret\"\nflag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" global=#true env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"\nflag \"--client-id \" help=\"Client Credentials flow. client identifier\" global=#true env=\"CLI_CLIENT_ID\" config=\"security.client_id\"\nflag \"--client-secret \" help=\"Client Credentials flow. client secret\" global=#true env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"\nflag \"--token-url \" help=\"Client Credentials flow. token URL\" global=#true env=\"CLI_TOKEN_URL\" config=\"security.token_url\"\nflag \"--no-keyring\" help=\"Never read or write the OS keychain; store secrets in the config file instead\" global=#true env=\"CLI_NO_KEYRING\" config=\"no_keyring\" default=#false\nflag \"--query-param1 \" help=\"A long winded, multi-line description\" global=#true env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"\nflag \"--deprecated-query-param1 \" help=\"A deprecated description\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"\nflag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"\nflag \"--lone-query-param \" help=\"Global lone-query-param parameter\" global=#true env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"\ncmd \"invite\" help=\"Invite a user by email\" {\n arg \"email\" help=\"Email address to invite\" required=#true var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--given-name \" help=\"First name to record\"\n flag \"--user-gender \" help=\"Gender to record (e.g. male, female, other)\" {\n suggestions \"male\" \"female\" \"other\"\n }\n}\ncmd \"enroll\" help=\"Enroll a user by email\" {\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--enrollment-email \" help=\"Email address to enroll\"\n}\ncmd \"render\" help=\"Render an image asset to a file\" {\n arg \"prompt\" help=\"Text prompt to render\" required=#true var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./render-{timestamp}-{rand}.{ext}\"\n flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\"\n}\ncmd \"produce\" help=\"Produce an image asset and wait for completion\" {\n arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./produce-{timestamp}-{rand}.{ext}\"\n flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\"\n flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"\n flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\"\n flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"\n flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"\n}\ncmd \"observe\" help=\"Produce an asset and print its terminal status\" {\n arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"\n flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\"\n flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"\n flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"\n}\ncmd \"say\" help=\"Stream a chat reply\" {\n arg \"prompt\" help=\"Prompt to send\" required=#true var=#true\n flag \"--request \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--stream\" help=\"Stream events as they arrive (default: true)\" default=#true\n}\ncmd \"archive\" help=\"Archive a user account\"\ncmd \"test-group\" help=\"Operations for test-group\" {\n alias \"tg\"\n cmd \"tag2\" help=\"Operations for tag2\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n }\n cmd \"tag3\" help=\"Operations for tag3\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n }\n}\ncmd \"hello\" help=\"Hand-written command that survives regeneration\"\ncmd \"auth\" help=\"Manage authentication credentials\" {\n cmd \"login\" help=\"Interactively configure authentication credentials\"\n cmd \"logout\" help=\"Clear all stored authentication credentials\"\n cmd \"whoami\" help=\"Display current authentication and global parameter configuration\"\n}\ncmd \"binary-and-string-upload\" help=\"Binary And String Upload\" {\n alias \"basu\"\n flag \"-b --binary \" help=\"binary data (file: or b64:)\"\n flag \"-s --string \" help=\"string value\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"chat\" help=\"Chat\" {\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--stream\" help=\"Stream events as they arrive\" default=#true\n flag \"--max-tokens \" help=\"Maximum number of tokens to generate\"\n flag \"--temperature \" help=\"Sampling temperature\"\n}\ncmd \"completion\" help=\"Generate the autocompletion script for the specified shell\" {\n cmd \"bash\" help=\"Generate the autocompletion script for bash\"\n cmd \"fish\" help=\"Generate the autocompletion script for fish\"\n cmd \"powershell\" help=\"Generate the autocompletion script for powershell\"\n cmd \"zsh\" help=\"Generate the autocompletion script for zsh\"\n}\ncmd \"configure\" help=\"Configure authentication, global parameters, and preferences\" {\n flag \"--default-output-format \" help=\"Store the default output format without opening the form. Options: pretty, json, yaml, table, toon. Pass an empty value to clear it.\" {\n suggestions \"pretty\" \"json\" \"yaml\" \"table\" \"toon\"\n }\n}\ncmd \"create-user\" help=\"Create User\" {\n alias \"cu\"\n flag \"-i --id \" help=\"string value\"\n flag \"-e --email \" help=\"[required]\"\n flag \"-f --first-name \" help=\"string value\"\n flag \"-l --last-name \" help=\"string value\"\n flag \"--age \" help=\"number value\"\n flag \"-p --postal-code \" help=\"string value\"\n flag \"-g --gender \" help=\"options: male, female, other\"\n flag \"--associated-ids \" help=\"list of values\" var=#true\n flag \"--metadata \" help=\"JSON object\"\n flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"create-with-union\" help=\"Create with discriminated union request body\" {\n alias \"cwu\"\n flag \"--dry-run-param\" help=\"If true, validates without creating\"\n flag \"-n --name \" help=\"Name for the shape [required]\"\n flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\"\n flag \"--shape.circle \" help=\"Circle variant as JSON\"\n flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\"\n flag \"--shape.circle.color-param \" help=\"Optional color of the circle\"\n flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\"\n flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\"\n flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\"\n flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\"\n flag \"--description \" help=\"Optional description\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"delete-user\" help=\"Delete User\" {\n alias \"du\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n}\ncmd \"explore\" help=\"Interactively browse and run commands\"\ncmd \"get-asset\" help=\"Get Asset\" {\n alias \"ga\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-s --stream\" help=\"boolean flag\" default=#true\n}\ncmd \"get-binary-default-response\" help=\"Get Binary Default Response\" {\n alias \"gbdr\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\ncmd \"get-duplicate-export-collision\" help=\"Tests that a spec-defined error type colliding with a built-in SDK error name does not cause TS2308\" {\n alias \"gdec\"\n}\ncmd \"get-empty-object-error\" help=\"Get Empty Object Error\" {\n alias \"geoe\"\n}\ncmd \"get-error-in-union\" help=\"Get Error In Union\" {\n alias \"geiu\"\n}\ncmd \"get-error-only-example\" help=\"Operation with example only on error response\" {\n alias \"geoex\"\n}\ncmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\" {\n alias \"gffr\"\n flag \"-l --lang \" help=\"[required]\"\n flag \"-m --max-length \" help=\"integer value\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\"\n flag \"-g --gif \" help=\"string value\"\n flag \"-r --reply\" help=\"boolean flag\"\n flag \"-p --private\" help=\"boolean flag\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"get-named-primitive-union\" help=\"Test named primitive union options using title and x-speakeasy-name-override\" {\n alias \"gnpu\"\n}\ncmd \"get-nested-integer-string\" help=\"Test nested struct with integer:string tag\" {\n alias \"gnis\"\n}\ncmd \"get-polymorphism\" help=\"Get Polymorphism\" {\n alias \"gp\"\n}\ncmd \"get-positional-default\" help=\"Get an item with a default path identifier\" {\n alias \"gpd\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\"\n}\ncmd \"get-request-body-flattened-away\" help=\"Get Request Body Flattened Away\" {\n alias \"grbfa\"\n}\ncmd \"get-union-errors\" help=\"Get Union Errors\" {\n alias \"gue\"\n flag \"-p --page \" help=\"[required]\"\n flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"\n flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0\n}\ncmd \"get-user\" help=\"Get User\" {\n alias \"gu\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n}\ncmd \"group\" help=\"Operations for group\" {\n cmd \"root-group-op\" help=\"An operation at the group's root level\" {\n alias \"rgo\"\n }\n cmd \"sub\" help=\"Operations for sub-group\" {\n cmd \"empty\" help=\"Operations for empty\" {\n cmd \"tail\" help=\"Operations for tail\" {\n cmd \"nested-group-op\" help=\"An operation at the group's deepest level\" {\n alias \"ngo\"\n }\n }\n }\n cmd \"op\" help=\"An operation at the group's top level\"\n }\n}\ncmd \"help\" help=\"Help about any command\"\ncmd \"login\" help=\"Login\"\ncmd \"namespace-tests\" help=\"Operations for namespace-tests\" {\n alias \"nt\"\n cmd \"conflicts\" help=\"Operations for conflicts\" {\n cmd \"create-namespace\" help=\"Create Namespace Conflict Test\" {\n alias \"cn\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-namespace\" help=\"Get Namespace Conflict Test\" {\n alias \"gn\"\n }\n cmd \"get-pet-owners\" help=\"Get Pet Owners\" {\n alias \"gpo\"\n }\n cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\" {\n alias \"gtn\"\n }\n cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\" {\n alias \"pn\"\n flag \"--direct \" help=\"JSON object\"\n flag \"-n --namespaced \" help=\"JSON object\"\n flag \"--overridden \" help=\"JSON object\"\n flag \"-a --allof \" help=\"JSON object\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n }\n cmd \"single-bar\" help=\"Operations for single-bar\" {\n alias \"sb\"\n cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\" {\n alias \"gsnbp\"\n }\n }\n cmd \"single-foo\" help=\"Operations for single-foo\" {\n alias \"sf\"\n cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\" {\n alias \"csnfp\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\" {\n alias \"gsnfp\"\n }\n }\n cmd \"types\" help=\"Operations for types\" {\n cmd \"get-namespace\" help=\"Get Namespace Types Test\" {\n alias \"gn\"\n }\n cmd \"get-namespace-animal\" help=\"Get Namespace Animal (Discriminated Union)\" {\n alias \"gna\"\n }\n cmd \"get-namespace-organization\" help=\"Get Namespace Organization (Nested Inline Schemas)\" {\n alias \"gno\"\n }\n cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\" {\n alias \"gnv\"\n }\n }\n}\ncmd \"obsolete\" help=\"A subSDK in which all operations are deprecated\" {\n cmd \"deprecated1\" help=\"Deprecated Operation\"\n}\ncmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\" {\n alias \"owlatu\"\n flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\"\n}\ncmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\" {\n alias \"pipa\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\"\n flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\"\n flag \"--field-with-braces-in-title \" help=\"string value\"\n flag \"--field-with-braces-in-example \" help=\"string value\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"post-file\" help=\"Post File\" {\n alias \"pf\"\n flag \"-u --upload \" help=\"A file\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\ncmd \"render-asset\" help=\"Render Asset\" {\n alias \"ra\"\n flag \"-p --prompt \" help=\"[required]\"\n flag \"--output-modalities \" help=\"options: text, image\" var=#true\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"stream-metadata\" help=\"Streamed events can contain text and an optional resource identifier in separate events.\" {\n alias \"sm\"\n}\ncmd \"tag1\" help=\"The first tag\" {\n cmd \"recent\" help=\"List recent test1 pages via tag1\" {\n flag \"-p --page \" help=\"[required]\"\n flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"\n flag \"--header-param1 \" help=\"[required]\"\n }\n cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\" {\n flag \"--access-token \" help=\"Security credential\"\n }\n cmd \"deprecated1\" help=\"Deprecated Operation\"\n cmd \"list-test1\" help=\"Get Test1\" {\n alias \"lt\"\n arg \"page\" help=\"integer value (or use --page)\"\n flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\"\n flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"\n flag \"--header-param1 \" help=\"[required]\"\n flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"\n flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0\n }\n cmd \"post-file-with-encoding\" help=\"Post File With Encoding\" {\n alias \"pfwe\"\n flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\"\n flag \"-a --attachment \" help=\"An optional binary attachment\"\n flag \"--file-name \" help=\"Optional custom file name\"\n flag \"--file-purpose \" help=\"Purpose of the file upload\"\n flag \"-m --metadata \" help=\"JSON metadata about the file\"\n }\n}\ncmd \"test-endpoint\" help=\"Test Endpoint\" {\n alias \"te\"\n arg \"test-name\" help=\"string value (or use --test-name)\"\n flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\"\n flag \"--test \" help=\"[required]\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\" {\n alias \"tef\"\n flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\"\n flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\"\n flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\"\n flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\"\n flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"update-user\" help=\"Update User\" {\n alias \"uu\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n flag \"--user.id \" help=\"[required]\"\n flag \"--user.email \" help=\"[required]\"\n flag \"--user.first-name \" help=\"string value\"\n flag \"--user.last-name \" help=\"string value\"\n flag \"--user.age \" help=\"number value\"\n flag \"--user.postal-code \" help=\"string value\"\n flag \"--user.gender \" help=\"options: male, female, other\"\n flag \"--user.associated-ids \" help=\"list of values\" var=#true\n flag \"--user.metadata \" help=\"JSON object\"\n flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\ncmd \"url-validation-stress-test\" help=\"Url Validation Stress Test\" {\n alias \"uvst\"\n}\ncmd \"validate\" help=\"Validate\"\ncmd \"version\" help=\"Print the CLI version\"\ncmd \"whoami\" help=\"Display current authentication and global parameter configuration\"\n", - "invite": "cmd \"invite\" help=\"Invite a user by email\" {\n arg \"email\" help=\"Email address to invite\" required=#true var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--given-name \" help=\"First name to record\"\n flag \"--user-gender \" help=\"Gender to record (e.g. male, female, other)\" {\n suggestions \"male\" \"female\" \"other\"\n }\n}\n", - "enroll": "cmd \"enroll\" help=\"Enroll a user by email\" {\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--enrollment-email \" help=\"Email address to enroll\"\n}\n", - "render": "cmd \"render\" help=\"Render an image asset to a file\" {\n arg \"prompt\" help=\"Text prompt to render\" required=#true var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./render-{timestamp}-{rand}.{ext}\"\n flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\"\n}\n", - "produce": "cmd \"produce\" help=\"Produce an image asset and wait for completion\" {\n arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./produce-{timestamp}-{rand}.{ext}\"\n flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\"\n flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"\n flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\"\n flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"\n flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"\n}\n", - "observe": "cmd \"observe\" help=\"Produce an asset and print its terminal status\" {\n arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true\n flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"\n flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\"\n flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"\n flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"\n}\n", - "say": "cmd \"say\" help=\"Stream a chat reply\" {\n arg \"prompt\" help=\"Prompt to send\" required=#true var=#true\n flag \"--request \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--stream\" help=\"Stream events as they arrive (default: true)\" default=#true\n}\n", - "archive": "cmd \"archive\" help=\"Archive a user account\"\n", - "test-group": "cmd \"test-group\" help=\"Operations for test-group\" {\n alias \"tg\"\n cmd \"tag2\" help=\"Operations for tag2\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n }\n cmd \"tag3\" help=\"Operations for tag3\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n }\n}\n", - "tg": "cmd \"test-group\" help=\"Operations for test-group\" {\n alias \"tg\"\n cmd \"tag2\" help=\"Operations for tag2\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n }\n cmd \"tag3\" help=\"Operations for tag3\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n }\n}\n", - "test-group tag2": "cmd \"tag2\" help=\"Operations for tag2\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n}\n", - "test-group tag2 post-test": "cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "test-group tag2 pt": "cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "test-group tag3": "cmd \"tag3\" help=\"Operations for tag3\" {\n cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n }\n}\n", - "test-group tag3 post-test": "cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "test-group tag3 pt": "cmd \"post-test\" help=\"Post Test2\" {\n alias \"pt\"\n flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"\n flag \"-t --type \" help=\"options: type1, type2\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "hello": "cmd \"hello\" help=\"Hand-written command that survives regeneration\"\n", - "auth": "cmd \"auth\" help=\"Manage authentication credentials\" {\n cmd \"login\" help=\"Interactively configure authentication credentials\"\n cmd \"logout\" help=\"Clear all stored authentication credentials\"\n cmd \"whoami\" help=\"Display current authentication and global parameter configuration\"\n}\n", - "auth login": "cmd \"login\" help=\"Interactively configure authentication credentials\" {\n flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"\n flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"\n flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"\n flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"\n flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"\n flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"\n flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"\n flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"\n flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"\n flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"\n flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"\n}\n", - "auth logout": "cmd \"logout\" help=\"Clear all stored authentication credentials\"\n", - "auth whoami": "cmd \"whoami\" help=\"Display current authentication and global parameter configuration\"\n", - "binary-and-string-upload": "cmd \"binary-and-string-upload\" help=\"Binary And String Upload\" {\n alias \"basu\"\n flag \"-b --binary \" help=\"binary data (file: or b64:)\"\n flag \"-s --string \" help=\"string value\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "basu": "cmd \"binary-and-string-upload\" help=\"Binary And String Upload\" {\n alias \"basu\"\n flag \"-b --binary \" help=\"binary data (file: or b64:)\"\n flag \"-s --string \" help=\"string value\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "chat": "cmd \"chat\" help=\"Chat\" {\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n flag \"--stream\" help=\"Stream events as they arrive\" default=#true\n flag \"--max-tokens \" help=\"Maximum number of tokens to generate\"\n flag \"--temperature \" help=\"Sampling temperature\"\n}\n", - "completion": "cmd \"completion\" help=\"Generate the autocompletion script for the specified shell\" {\n cmd \"bash\" help=\"Generate the autocompletion script for bash\"\n cmd \"fish\" help=\"Generate the autocompletion script for fish\"\n cmd \"powershell\" help=\"Generate the autocompletion script for powershell\"\n cmd \"zsh\" help=\"Generate the autocompletion script for zsh\"\n}\n", - "completion bash": "cmd \"bash\" help=\"Generate the autocompletion script for bash\"\n", - "completion fish": "cmd \"fish\" help=\"Generate the autocompletion script for fish\"\n", - "completion powershell": "cmd \"powershell\" help=\"Generate the autocompletion script for powershell\"\n", - "completion zsh": "cmd \"zsh\" help=\"Generate the autocompletion script for zsh\"\n", - "configure": "cmd \"configure\" help=\"Configure authentication, global parameters, and preferences\" {\n flag \"--default-output-format \" help=\"Store the default output format without opening the form. Options: pretty, json, yaml, table, toon. Pass an empty value to clear it.\" {\n suggestions \"pretty\" \"json\" \"yaml\" \"table\" \"toon\"\n }\n flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"\n flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"\n flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"\n flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"\n flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"\n flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"\n flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"\n flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"\n flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"\n flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"\n flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"\n flag \"--query-param1 \" help=\"A long winded, multi-line description\" env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"\n flag \"--deprecated-query-param1 \" help=\"A deprecated description\" env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"\n flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"\n flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"\n}\n", - "create-user": "cmd \"create-user\" help=\"Create User\" {\n alias \"cu\"\n flag \"-i --id \" help=\"string value\"\n flag \"-e --email \" help=\"[required]\"\n flag \"-f --first-name \" help=\"string value\"\n flag \"-l --last-name \" help=\"string value\"\n flag \"--age \" help=\"number value\"\n flag \"-p --postal-code \" help=\"string value\"\n flag \"-g --gender \" help=\"options: male, female, other\"\n flag \"--associated-ids \" help=\"list of values\" var=#true\n flag \"--metadata \" help=\"JSON object\"\n flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "cu": "cmd \"create-user\" help=\"Create User\" {\n alias \"cu\"\n flag \"-i --id \" help=\"string value\"\n flag \"-e --email \" help=\"[required]\"\n flag \"-f --first-name \" help=\"string value\"\n flag \"-l --last-name \" help=\"string value\"\n flag \"--age \" help=\"number value\"\n flag \"-p --postal-code \" help=\"string value\"\n flag \"-g --gender \" help=\"options: male, female, other\"\n flag \"--associated-ids \" help=\"list of values\" var=#true\n flag \"--metadata \" help=\"JSON object\"\n flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "create-with-union": "cmd \"create-with-union\" help=\"Create with discriminated union request body\" {\n alias \"cwu\"\n flag \"--dry-run-param\" help=\"If true, validates without creating\"\n flag \"-n --name \" help=\"Name for the shape [required]\"\n flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\"\n flag \"--shape.circle \" help=\"Circle variant as JSON\"\n flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\"\n flag \"--shape.circle.color-param \" help=\"Optional color of the circle\"\n flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\"\n flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\"\n flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\"\n flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\"\n flag \"--description \" help=\"Optional description\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "cwu": "cmd \"create-with-union\" help=\"Create with discriminated union request body\" {\n alias \"cwu\"\n flag \"--dry-run-param\" help=\"If true, validates without creating\"\n flag \"-n --name \" help=\"Name for the shape [required]\"\n flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\"\n flag \"--shape.circle \" help=\"Circle variant as JSON\"\n flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\"\n flag \"--shape.circle.color-param \" help=\"Optional color of the circle\"\n flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\"\n flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\"\n flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\"\n flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\"\n flag \"--description \" help=\"Optional description\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "delete-user": "cmd \"delete-user\" help=\"Delete User\" {\n alias \"du\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n}\n", - "du": "cmd \"delete-user\" help=\"Delete User\" {\n alias \"du\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n}\n", - "explore": "cmd \"explore\" help=\"Interactively browse and run commands\"\n", - "get-asset": "cmd \"get-asset\" help=\"Get Asset\" {\n alias \"ga\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-s --stream\" help=\"boolean flag\" default=#true\n}\n", - "ga": "cmd \"get-asset\" help=\"Get Asset\" {\n alias \"ga\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-s --stream\" help=\"boolean flag\" default=#true\n}\n", - "get-binary-default-response": "cmd \"get-binary-default-response\" help=\"Get Binary Default Response\" {\n alias \"gbdr\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "gbdr": "cmd \"get-binary-default-response\" help=\"Get Binary Default Response\" {\n alias \"gbdr\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "get-duplicate-export-collision": "cmd \"get-duplicate-export-collision\" help=\"Tests that a spec-defined error type colliding with a built-in SDK error name does not cause TS2308\" {\n alias \"gdec\"\n}\n", - "gdec": "cmd \"get-duplicate-export-collision\" help=\"Tests that a spec-defined error type colliding with a built-in SDK error name does not cause TS2308\" {\n alias \"gdec\"\n}\n", - "get-empty-object-error": "cmd \"get-empty-object-error\" help=\"Get Empty Object Error\" {\n alias \"geoe\"\n}\n", - "geoe": "cmd \"get-empty-object-error\" help=\"Get Empty Object Error\" {\n alias \"geoe\"\n}\n", - "get-error-in-union": "cmd \"get-error-in-union\" help=\"Get Error In Union\" {\n alias \"geiu\"\n}\n", - "geiu": "cmd \"get-error-in-union\" help=\"Get Error In Union\" {\n alias \"geiu\"\n}\n", - "get-error-only-example": "cmd \"get-error-only-example\" help=\"Operation with example only on error response\" {\n alias \"geoex\"\n}\n", - "geoex": "cmd \"get-error-only-example\" help=\"Operation with example only on error response\" {\n alias \"geoex\"\n}\n", - "get-fully-flattened-request": "cmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\" {\n alias \"gffr\"\n flag \"-l --lang \" help=\"[required]\"\n flag \"-m --max-length \" help=\"integer value\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\"\n flag \"-g --gif \" help=\"string value\"\n flag \"-r --reply\" help=\"boolean flag\"\n flag \"-p --private\" help=\"boolean flag\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "gffr": "cmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\" {\n alias \"gffr\"\n flag \"-l --lang \" help=\"[required]\"\n flag \"-m --max-length \" help=\"integer value\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\"\n flag \"-g --gif \" help=\"string value\"\n flag \"-r --reply\" help=\"boolean flag\"\n flag \"-p --private\" help=\"boolean flag\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "get-named-primitive-union": "cmd \"get-named-primitive-union\" help=\"Test named primitive union options using title and x-speakeasy-name-override\" {\n alias \"gnpu\"\n}\n", - "gnpu": "cmd \"get-named-primitive-union\" help=\"Test named primitive union options using title and x-speakeasy-name-override\" {\n alias \"gnpu\"\n}\n", - "get-nested-integer-string": "cmd \"get-nested-integer-string\" help=\"Test nested struct with integer:string tag\" {\n alias \"gnis\"\n}\n", - "gnis": "cmd \"get-nested-integer-string\" help=\"Test nested struct with integer:string tag\" {\n alias \"gnis\"\n}\n", - "get-polymorphism": "cmd \"get-polymorphism\" help=\"Get Polymorphism\" {\n alias \"gp\"\n}\n", - "gp": "cmd \"get-polymorphism\" help=\"Get Polymorphism\" {\n alias \"gp\"\n}\n", - "get-positional-default": "cmd \"get-positional-default\" help=\"Get an item with a default path identifier\" {\n alias \"gpd\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\"\n}\n", - "gpd": "cmd \"get-positional-default\" help=\"Get an item with a default path identifier\" {\n alias \"gpd\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\"\n}\n", - "get-request-body-flattened-away": "cmd \"get-request-body-flattened-away\" help=\"Get Request Body Flattened Away\" {\n alias \"grbfa\"\n}\n", - "grbfa": "cmd \"get-request-body-flattened-away\" help=\"Get Request Body Flattened Away\" {\n alias \"grbfa\"\n}\n", - "get-union-errors": "cmd \"get-union-errors\" help=\"Get Union Errors\" {\n alias \"gue\"\n flag \"-p --page \" help=\"[required]\"\n flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"\n flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0\n}\n", - "gue": "cmd \"get-union-errors\" help=\"Get Union Errors\" {\n alias \"gue\"\n flag \"-p --page \" help=\"[required]\"\n flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"\n flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0\n}\n", - "get-user": "cmd \"get-user\" help=\"Get User\" {\n alias \"gu\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n}\n", - "gu": "cmd \"get-user\" help=\"Get User\" {\n alias \"gu\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n}\n", - "group": "cmd \"group\" help=\"Operations for group\" {\n cmd \"root-group-op\" help=\"An operation at the group's root level\" {\n alias \"rgo\"\n }\n cmd \"sub\" help=\"Operations for sub-group\" {\n cmd \"empty\" help=\"Operations for empty\" {\n cmd \"tail\" help=\"Operations for tail\" {\n cmd \"nested-group-op\" help=\"An operation at the group's deepest level\" {\n alias \"ngo\"\n }\n }\n }\n cmd \"op\" help=\"An operation at the group's top level\"\n }\n}\n", - "group root-group-op": "cmd \"root-group-op\" help=\"An operation at the group's root level\" {\n alias \"rgo\"\n}\n", - "group rgo": "cmd \"root-group-op\" help=\"An operation at the group's root level\" {\n alias \"rgo\"\n}\n", - "group sub": "cmd \"sub\" help=\"Operations for sub-group\" {\n cmd \"empty\" help=\"Operations for empty\" {\n cmd \"tail\" help=\"Operations for tail\" {\n cmd \"nested-group-op\" help=\"An operation at the group's deepest level\" {\n alias \"ngo\"\n }\n }\n }\n cmd \"op\" help=\"An operation at the group's top level\"\n}\n", - "group sub empty": "cmd \"empty\" help=\"Operations for empty\" {\n cmd \"tail\" help=\"Operations for tail\" {\n cmd \"nested-group-op\" help=\"An operation at the group's deepest level\" {\n alias \"ngo\"\n }\n }\n}\n", - "group sub empty tail": "cmd \"tail\" help=\"Operations for tail\" {\n cmd \"nested-group-op\" help=\"An operation at the group's deepest level\" {\n alias \"ngo\"\n }\n}\n", - "group sub empty tail nested-group-op": "cmd \"nested-group-op\" help=\"An operation at the group's deepest level\" {\n alias \"ngo\"\n}\n", - "group sub empty tail ngo": "cmd \"nested-group-op\" help=\"An operation at the group's deepest level\" {\n alias \"ngo\"\n}\n", - "group sub op": "cmd \"op\" help=\"An operation at the group's top level\"\n", - "help": "cmd \"help\" help=\"Help about any command\"\n", - "login": "cmd \"login\" help=\"Login\"\n", - "namespace-tests": "cmd \"namespace-tests\" help=\"Operations for namespace-tests\" {\n alias \"nt\"\n cmd \"conflicts\" help=\"Operations for conflicts\" {\n cmd \"create-namespace\" help=\"Create Namespace Conflict Test\" {\n alias \"cn\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-namespace\" help=\"Get Namespace Conflict Test\" {\n alias \"gn\"\n }\n cmd \"get-pet-owners\" help=\"Get Pet Owners\" {\n alias \"gpo\"\n }\n cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\" {\n alias \"gtn\"\n }\n cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\" {\n alias \"pn\"\n flag \"--direct \" help=\"JSON object\"\n flag \"-n --namespaced \" help=\"JSON object\"\n flag \"--overridden \" help=\"JSON object\"\n flag \"-a --allof \" help=\"JSON object\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n }\n cmd \"single-bar\" help=\"Operations for single-bar\" {\n alias \"sb\"\n cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\" {\n alias \"gsnbp\"\n }\n }\n cmd \"single-foo\" help=\"Operations for single-foo\" {\n alias \"sf\"\n cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\" {\n alias \"csnfp\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\" {\n alias \"gsnfp\"\n }\n }\n cmd \"types\" help=\"Operations for types\" {\n cmd \"get-namespace\" help=\"Get Namespace Types Test\" {\n alias \"gn\"\n }\n cmd \"get-namespace-animal\" help=\"Get Namespace Animal (Discriminated Union)\" {\n alias \"gna\"\n }\n cmd \"get-namespace-organization\" help=\"Get Namespace Organization (Nested Inline Schemas)\" {\n alias \"gno\"\n }\n cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\" {\n alias \"gnv\"\n }\n }\n}\n", - "nt": "cmd \"namespace-tests\" help=\"Operations for namespace-tests\" {\n alias \"nt\"\n cmd \"conflicts\" help=\"Operations for conflicts\" {\n cmd \"create-namespace\" help=\"Create Namespace Conflict Test\" {\n alias \"cn\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-namespace\" help=\"Get Namespace Conflict Test\" {\n alias \"gn\"\n }\n cmd \"get-pet-owners\" help=\"Get Pet Owners\" {\n alias \"gpo\"\n }\n cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\" {\n alias \"gtn\"\n }\n cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\" {\n alias \"pn\"\n flag \"--direct \" help=\"JSON object\"\n flag \"-n --namespaced \" help=\"JSON object\"\n flag \"--overridden \" help=\"JSON object\"\n flag \"-a --allof \" help=\"JSON object\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n }\n cmd \"single-bar\" help=\"Operations for single-bar\" {\n alias \"sb\"\n cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\" {\n alias \"gsnbp\"\n }\n }\n cmd \"single-foo\" help=\"Operations for single-foo\" {\n alias \"sf\"\n cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\" {\n alias \"csnfp\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\" {\n alias \"gsnfp\"\n }\n }\n cmd \"types\" help=\"Operations for types\" {\n cmd \"get-namespace\" help=\"Get Namespace Types Test\" {\n alias \"gn\"\n }\n cmd \"get-namespace-animal\" help=\"Get Namespace Animal (Discriminated Union)\" {\n alias \"gna\"\n }\n cmd \"get-namespace-organization\" help=\"Get Namespace Organization (Nested Inline Schemas)\" {\n alias \"gno\"\n }\n cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\" {\n alias \"gnv\"\n }\n }\n}\n", - "namespace-tests conflicts": "cmd \"conflicts\" help=\"Operations for conflicts\" {\n cmd \"create-namespace\" help=\"Create Namespace Conflict Test\" {\n alias \"cn\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-namespace\" help=\"Get Namespace Conflict Test\" {\n alias \"gn\"\n }\n cmd \"get-pet-owners\" help=\"Get Pet Owners\" {\n alias \"gpo\"\n }\n cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\" {\n alias \"gtn\"\n }\n cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\" {\n alias \"pn\"\n flag \"--direct \" help=\"JSON object\"\n flag \"-n --namespaced \" help=\"JSON object\"\n flag \"--overridden \" help=\"JSON object\"\n flag \"-a --allof \" help=\"JSON object\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n}\n", - "namespace-tests conflicts create-namespace": "cmd \"create-namespace\" help=\"Create Namespace Conflict Test\" {\n alias \"cn\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "namespace-tests conflicts cn": "cmd \"create-namespace\" help=\"Create Namespace Conflict Test\" {\n alias \"cn\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "namespace-tests conflicts get-namespace": "cmd \"get-namespace\" help=\"Get Namespace Conflict Test\" {\n alias \"gn\"\n}\n", - "namespace-tests conflicts gn": "cmd \"get-namespace\" help=\"Get Namespace Conflict Test\" {\n alias \"gn\"\n}\n", - "namespace-tests conflicts get-pet-owners": "cmd \"get-pet-owners\" help=\"Get Pet Owners\" {\n alias \"gpo\"\n}\n", - "namespace-tests conflicts gpo": "cmd \"get-pet-owners\" help=\"Get Pet Owners\" {\n alias \"gpo\"\n}\n", - "namespace-tests conflicts get-triple-namespace": "cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\" {\n alias \"gtn\"\n}\n", - "namespace-tests conflicts gtn": "cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\" {\n alias \"gtn\"\n}\n", - "namespace-tests conflicts put-namespace": "cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\" {\n alias \"pn\"\n flag \"--direct \" help=\"JSON object\"\n flag \"-n --namespaced \" help=\"JSON object\"\n flag \"--overridden \" help=\"JSON object\"\n flag \"-a --allof \" help=\"JSON object\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "namespace-tests conflicts pn": "cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\" {\n alias \"pn\"\n flag \"--direct \" help=\"JSON object\"\n flag \"-n --namespaced \" help=\"JSON object\"\n flag \"--overridden \" help=\"JSON object\"\n flag \"-a --allof \" help=\"JSON object\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "namespace-tests single-bar": "cmd \"single-bar\" help=\"Operations for single-bar\" {\n alias \"sb\"\n cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\" {\n alias \"gsnbp\"\n }\n}\n", - "namespace-tests sb": "cmd \"single-bar\" help=\"Operations for single-bar\" {\n alias \"sb\"\n cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\" {\n alias \"gsnbp\"\n }\n}\n", - "namespace-tests single-bar get-single-namespace-bar-pet": "cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\" {\n alias \"gsnbp\"\n}\n", - "namespace-tests single-bar gsnbp": "cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\" {\n alias \"gsnbp\"\n}\n", - "namespace-tests single-foo": "cmd \"single-foo\" help=\"Operations for single-foo\" {\n alias \"sf\"\n cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\" {\n alias \"csnfp\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\" {\n alias \"gsnfp\"\n }\n}\n", - "namespace-tests sf": "cmd \"single-foo\" help=\"Operations for single-foo\" {\n alias \"sf\"\n cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\" {\n alias \"csnfp\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n }\n cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\" {\n alias \"gsnfp\"\n }\n}\n", - "namespace-tests single-foo create-single-namespace-foo-pet": "cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\" {\n alias \"csnfp\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "namespace-tests single-foo csnfp": "cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\" {\n alias \"csnfp\"\n flag \"-i --id \" help=\"[required]\"\n flag \"-n --name \" help=\"[required]\"\n flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"\n flag \"-m --models \" help=\"A field name that often collides\"\n flag \"-r --request \" help=\"A field name that often collides\"\n flag \"--operations \" help=\"A field name that often collides\"\n flag \"-e --errors \" help=\"A field name that often collides\"\n flag \"-u --utils \" help=\"A field name that often collides\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "namespace-tests single-foo get-single-namespace-foo-pet": "cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\" {\n alias \"gsnfp\"\n}\n", - "namespace-tests single-foo gsnfp": "cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\" {\n alias \"gsnfp\"\n}\n", - "namespace-tests types": "cmd \"types\" help=\"Operations for types\" {\n cmd \"get-namespace\" help=\"Get Namespace Types Test\" {\n alias \"gn\"\n }\n cmd \"get-namespace-animal\" help=\"Get Namespace Animal (Discriminated Union)\" {\n alias \"gna\"\n }\n cmd \"get-namespace-organization\" help=\"Get Namespace Organization (Nested Inline Schemas)\" {\n alias \"gno\"\n }\n cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\" {\n alias \"gnv\"\n }\n}\n", - "namespace-tests types get-namespace": "cmd \"get-namespace\" help=\"Get Namespace Types Test\" {\n alias \"gn\"\n}\n", - "namespace-tests types gn": "cmd \"get-namespace\" help=\"Get Namespace Types Test\" {\n alias \"gn\"\n}\n", - "namespace-tests types get-namespace-animal": "cmd \"get-namespace-animal\" help=\"Get Namespace Animal (Discriminated Union)\" {\n alias \"gna\"\n}\n", - "namespace-tests types gna": "cmd \"get-namespace-animal\" help=\"Get Namespace Animal (Discriminated Union)\" {\n alias \"gna\"\n}\n", - "namespace-tests types get-namespace-organization": "cmd \"get-namespace-organization\" help=\"Get Namespace Organization (Nested Inline Schemas)\" {\n alias \"gno\"\n}\n", - "namespace-tests types gno": "cmd \"get-namespace-organization\" help=\"Get Namespace Organization (Nested Inline Schemas)\" {\n alias \"gno\"\n}\n", - "namespace-tests types get-namespace-vehicle": "cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\" {\n alias \"gnv\"\n}\n", - "namespace-tests types gnv": "cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\" {\n alias \"gnv\"\n}\n", - "obsolete": "cmd \"obsolete\" help=\"A subSDK in which all operations are deprecated\" {\n cmd \"deprecated1\" help=\"Deprecated Operation\"\n}\n", - "obsolete deprecated1": "cmd \"deprecated1\" help=\"Deprecated Operation\"\n", - "operation-with-leading-and-trailing-underscores": "cmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\" {\n alias \"owlatu\"\n flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\"\n}\n", - "owlatu": "cmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\" {\n alias \"owlatu\"\n flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\"\n}\n", - "parentheses-in-path-allowed": "cmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\" {\n alias \"pipa\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\"\n flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\"\n flag \"--field-with-braces-in-title \" help=\"string value\"\n flag \"--field-with-braces-in-example \" help=\"string value\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "pipa": "cmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\" {\n alias \"pipa\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\"\n flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\"\n flag \"--field-with-braces-in-title \" help=\"string value\"\n flag \"--field-with-braces-in-example \" help=\"string value\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "post-file": "cmd \"post-file\" help=\"Post File\" {\n alias \"pf\"\n flag \"-u --upload \" help=\"A file\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "pf": "cmd \"post-file\" help=\"Post File\" {\n alias \"pf\"\n flag \"-u --upload \" help=\"A file\"\n flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"\n flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\"\n}\n", - "render-asset": "cmd \"render-asset\" help=\"Render Asset\" {\n alias \"ra\"\n flag \"-p --prompt \" help=\"[required]\"\n flag \"--output-modalities \" help=\"options: text, image\" var=#true\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "ra": "cmd \"render-asset\" help=\"Render Asset\" {\n alias \"ra\"\n flag \"-p --prompt \" help=\"[required]\"\n flag \"--output-modalities \" help=\"options: text, image\" var=#true\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "stream-metadata": "cmd \"stream-metadata\" help=\"Streamed events can contain text and an optional resource identifier in separate events.\" {\n alias \"sm\"\n}\n", - "sm": "cmd \"stream-metadata\" help=\"Streamed events can contain text and an optional resource identifier in separate events.\" {\n alias \"sm\"\n}\n", - "tag1": "cmd \"tag1\" help=\"The first tag\" {\n cmd \"recent\" help=\"List recent test1 pages via tag1\" {\n flag \"-p --page \" help=\"[required]\"\n flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"\n flag \"--header-param1 \" help=\"[required]\"\n }\n cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\" {\n flag \"--access-token \" help=\"Security credential\"\n }\n cmd \"deprecated1\" help=\"Deprecated Operation\"\n cmd \"list-test1\" help=\"Get Test1\" {\n alias \"lt\"\n arg \"page\" help=\"integer value (or use --page)\"\n flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\"\n flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"\n flag \"--header-param1 \" help=\"[required]\"\n flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"\n flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0\n }\n cmd \"post-file-with-encoding\" help=\"Post File With Encoding\" {\n alias \"pfwe\"\n flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\"\n flag \"-a --attachment \" help=\"An optional binary attachment\"\n flag \"--file-name \" help=\"Optional custom file name\"\n flag \"--file-purpose \" help=\"Purpose of the file upload\"\n flag \"-m --metadata \" help=\"JSON metadata about the file\"\n }\n}\n", - "tag1 recent": "cmd \"recent\" help=\"List recent test1 pages via tag1\" {\n flag \"-p --page \" help=\"[required]\"\n flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"\n flag \"--header-param1 \" help=\"[required]\"\n}\n", - "tag1 auth": "cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\" {\n flag \"--access-token \" help=\"Security credential\"\n}\n", - "tag1 deprecated1": "cmd \"deprecated1\" help=\"Deprecated Operation\"\n", - "tag1 list-test1": "cmd \"list-test1\" help=\"Get Test1\" {\n alias \"lt\"\n arg \"page\" help=\"integer value (or use --page)\"\n flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\"\n flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"\n flag \"--header-param1 \" help=\"[required]\"\n flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"\n flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0\n}\n", - "tag1 lt": "cmd \"list-test1\" help=\"Get Test1\" {\n alias \"lt\"\n arg \"page\" help=\"integer value (or use --page)\"\n flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\"\n flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"\n flag \"--header-param1 \" help=\"[required]\"\n flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"\n flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0\n}\n", - "tag1 post-file-with-encoding": "cmd \"post-file-with-encoding\" help=\"Post File With Encoding\" {\n alias \"pfwe\"\n flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\"\n flag \"-a --attachment \" help=\"An optional binary attachment\"\n flag \"--file-name \" help=\"Optional custom file name\"\n flag \"--file-purpose \" help=\"Purpose of the file upload\"\n flag \"-m --metadata \" help=\"JSON metadata about the file\"\n}\n", - "tag1 pfwe": "cmd \"post-file-with-encoding\" help=\"Post File With Encoding\" {\n alias \"pfwe\"\n flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\"\n flag \"-a --attachment \" help=\"An optional binary attachment\"\n flag \"--file-name \" help=\"Optional custom file name\"\n flag \"--file-purpose \" help=\"Purpose of the file upload\"\n flag \"-m --metadata \" help=\"JSON metadata about the file\"\n}\n", - "test-endpoint": "cmd \"test-endpoint\" help=\"Test Endpoint\" {\n alias \"te\"\n arg \"test-name\" help=\"string value (or use --test-name)\"\n flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\"\n flag \"--test \" help=\"[required]\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "te": "cmd \"test-endpoint\" help=\"Test Endpoint\" {\n alias \"te\"\n arg \"test-name\" help=\"string value (or use --test-name)\"\n flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\"\n flag \"--test \" help=\"[required]\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "test-enum-formats": "cmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\" {\n alias \"tef\"\n flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\"\n flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\"\n flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\"\n flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\"\n flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "tef": "cmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\" {\n alias \"tef\"\n flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\"\n flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\"\n flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\"\n flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\"\n flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "update-user": "cmd \"update-user\" help=\"Update User\" {\n alias \"uu\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n flag \"--user.id \" help=\"[required]\"\n flag \"--user.email \" help=\"[required]\"\n flag \"--user.first-name \" help=\"string value\"\n flag \"--user.last-name \" help=\"string value\"\n flag \"--user.age \" help=\"number value\"\n flag \"--user.postal-code \" help=\"string value\"\n flag \"--user.gender \" help=\"options: male, female, other\"\n flag \"--user.associated-ids \" help=\"list of values\" var=#true\n flag \"--user.metadata \" help=\"JSON object\"\n flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "uu": "cmd \"update-user\" help=\"Update User\" {\n alias \"uu\"\n arg \"id\" help=\"string value (or use --id)\"\n flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"\n flag \"--user.id \" help=\"[required]\"\n flag \"--user.email \" help=\"[required]\"\n flag \"--user.first-name \" help=\"string value\"\n flag \"--user.last-name \" help=\"string value\"\n flag \"--user.age \" help=\"number value\"\n flag \"--user.postal-code \" help=\"string value\"\n flag \"--user.gender \" help=\"options: male, female, other\"\n flag \"--user.associated-ids \" help=\"list of values\" var=#true\n flag \"--user.metadata \" help=\"JSON object\"\n flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"\n flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"\n flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\"\n}\n", - "url-validation-stress-test": "cmd \"url-validation-stress-test\" help=\"Url Validation Stress Test\" {\n alias \"uvst\"\n}\n", - "uvst": "cmd \"url-validation-stress-test\" help=\"Url Validation Stress Test\" {\n alias \"uvst\"\n}\n", - "validate": "cmd \"validate\" help=\"Validate\"\n", - "version": "cmd \"version\" help=\"Print the CLI version\"\n", - "whoami": "cmd \"whoami\" help=\"Display current authentication and global parameter configuration\"\n", +type usageItem struct { + key string + text string + settings bool + hidden bool +} + +type usageNode struct { + head string + aliases []usageItem + args []string + flags []usageItem + children []string +} + +var usageNodes = map[string]usageNode{ + "": {head: "name \"cli\"\nbin \"cli\"\nabout \"\"\"\n This document will show case as many of our features as possible in as little operations/models as possible.\n This will then generate a SDK that we can more easily review than the test SDKs based on uber.yaml spec.\n \"\"\"\nversion \"0.0.1\"\nconfig {\n file \"~/.config/cli/config.yaml\"\n}", flags: []usageItem{{key: "usage", text: "flag \"--usage\" help=\"Print the CLI Usage schema in KDL format\" global=#true"}, {key: "version", text: "flag \"-v --version\" help=\"Print the CLI version\""}, {key: "output-format", text: "flag \"-o --output-format \" help=\"Specify the output format. Options: pretty, json, yaml, table, toon.\" global=#true config=\"output_format\" default=\"pretty\""}, {key: "color", text: "flag \"--color \" help=\"Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars.\" global=#true default=\"auto\""}, {key: "jq", text: "flag \"-q --jq \" help=\"Filter and transform output using a jq expression (e.g., '.name', '.items[] | .id')\" global=#true"}, {key: "raw-output", text: "flag \"--raw-output\" help=\"Write --jq string results as raw text instead of JSON strings (like jq -r); non-string results stay JSON\" global=#true default=#false"}, {key: "server-url", text: "flag \"--server-url \" help=\"Override the default server URL\" global=#true"}, {key: "server", text: "flag \"--server \" help=\"Select a server by index (for indexed servers) or name (for named servers)\" global=#true"}, {key: "header", text: "flag \"-H --header \" help=\"Set a custom HTTP request header (format: \\\"Key: Value\\\"). Can be specified multiple times.\" global=#true var=#true"}, {key: "include-headers", text: "flag \"--include-headers\" help=\"Include HTTP response headers in the output\" global=#true default=#false"}, {key: "timeout", text: "flag \"--timeout \" help=\"HTTP request timeout (e.g., 30s, 5m, 100ms)\" global=#true config=\"timeout\""}, {key: "interactive", text: "flag \"--interactive\" help=\"Prompt for missing inputs and open guided configure/auth forms (forms fall back to line prompts on stdin off-TTY)\" global=#true default=#false"}, {key: "no-interactive", text: "flag \"--no-interactive\" help=\"Disable all interactive features (auto-prompting, explorer auto-launch, TUI forms)\" global=#true default=#false"}, {key: "dry-run", text: "flag \"--dry-run\" help=\"Preview API requests without sending them (no network, no OS keychain). Human preview on stderr; with -o json or --jq, one JSON object per request on stdout. Local mutation commands (auth login, auth logout and configure) make no request: they skip prompts and writes and report a no-op (stderr, or one JSON object on stdout in the machine form)\" global=#true default=#false"}, {key: "debug", text: "flag \"-d --debug\" help=\"Log request and response diagnostics to stderr\" global=#true default=#false"}, {key: "agent-mode", text: "flag \"--agent-mode\" help=\"Enable structured errors and default TOON output for AI coding agents.\" global=#true default=#false"}, {key: "no-retries", text: "flag \"--no-retries\" help=\"Disable automatic retries (default: retries enabled with exponential backoff)\" global=#true config=\"no_retries\" default=#false"}, {key: "retry-max-elapsed-time", text: "flag \"--retry-max-elapsed-time \" help=\"Maximum total time for retries (e.g., 30s, 5m). Default: 30s\" global=#true config=\"retry_max_elapsed_time\""}, {key: "retry-connection-errors", text: "flag \"--retry-connection-errors\" help=\"Retry on connection errors (EOF, reset, etc.)\" global=#true config=\"retry_connection_errors\" default=#false"}, {key: "retry-config", text: "flag \"--retry-config \" help=\"Full retry config as JSON. Schema: {\\\"strategy\\\":\\\"backoff\\\",\\\"backoff\\\":{\\\"initialInterval\\\":500,\\\"maxInterval\\\":10000,\\\"exponent\\\":1.5,\\\"maxElapsedTime\\\":30000},\\\"retryConnectionErrors\\\":false}. Times are in milliseconds.\" global=#true config=\"retry_config\""}, {key: "subdomain", text: "flag \"--subdomain \" help=\"Server template variable: subdomain\" global=#true"}, {key: "version-param", text: "flag \"--version-param \" help=\"Server template variable: version\" global=#true"}, {key: "host-name", text: "flag \"--host-name \" help=\"Server template variable: HostName\" global=#true"}, {key: "port", text: "flag \"--port \" help=\"Server template variable: PORT\" global=#true"}, {key: "username", text: "flag \"--username \" help=\"HTTP Basic username\" global=#true env=\"CLI_USERNAME\" config=\"security.username\""}, {key: "password", text: "flag \"--password \" help=\"HTTP Basic password\" global=#true env=\"CLI_PASSWORD\" config=\"security.password\""}, {key: "bearer-auth", text: "flag \"--bearer-auth \" help=\"HTTP Bearer\" global=#true env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\""}, {key: "my-api-key", text: "flag \"--my-api-key \" help=\"API Key\" global=#true env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\""}, {key: "oauth2", text: "flag \"--oauth2 \" help=\"OAuth2 Authorization\" global=#true env=\"CLI_OAUTH2\" config=\"security.oauth2\""}, {key: "app-id", text: "flag \"--app-id \" help=\"Custom authentication credential\" global=#true env=\"CLI_APP_ID\" config=\"security.app_id\""}, {key: "secret", text: "flag \"--secret \" help=\"Custom authentication credential\" global=#true env=\"CLI_SECRET\" config=\"security.secret\""}, {key: "mobile-auth", text: "flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" global=#true env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\""}, {key: "client-id", text: "flag \"--client-id \" help=\"Client Credentials flow. client identifier\" global=#true env=\"CLI_CLIENT_ID\" config=\"security.client_id\""}, {key: "client-secret", text: "flag \"--client-secret \" help=\"Client Credentials flow. client secret\" global=#true env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\""}, {key: "token-url", text: "flag \"--token-url \" help=\"Client Credentials flow. token URL\" global=#true env=\"CLI_TOKEN_URL\" config=\"security.token_url\""}, {key: "no-keyring", text: "flag \"--no-keyring\" help=\"Never read or write the OS keychain; store secrets in the config file instead\" global=#true env=\"CLI_NO_KEYRING\" config=\"no_keyring\" default=#false"}, {key: "query-param1", text: "flag \"--query-param1 \" help=\"A long winded, multi-line description\" global=#true env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\""}, {key: "deprecated-query-param1", text: "flag \"--deprecated-query-param1 \" help=\"A deprecated description\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\""}, {key: "deprecated-query-param2", text: "flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\""}, {key: "lone-query-param", text: "flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" global=#true env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\""}}, children: []string{"invite", "enroll", "render", "produce", "observe", "say", "archive", "test-group", "hello", "auth", "binary-and-string-upload", "chat", "completion", "configure", "create-user", "create-with-union", "delete-user", "explore", "get-asset", "get-binary-default-response", "get-duplicate-export-collision", "get-empty-object-error", "get-error-in-union", "get-error-only-example", "get-fully-flattened-request", "get-named-primitive-union", "get-nested-integer-string", "get-polymorphism", "get-positional-default", "get-request-body-flattened-away", "get-union-errors", "get-user", "group", "help", "login", "namespace-tests", "obsolete", "operation-with-leading-and-trailing-underscores", "parentheses-in-path-allowed", "post-file", "render-asset", "stream-metadata", "tag1", "test-endpoint", "test-enum-formats", "update-user", "url-validation-stress-test", "validate", "version", "whoami"}}, + "invite": {head: "cmd \"invite\" help=\"Invite a user by email\"", args: []string{" arg \"email\" help=\"Email address to invite\" required=#true var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "given-name", text: " flag \"--given-name \" help=\"First name to record\""}, {key: "user-gender", text: " flag \"--user-gender \" help=\"Gender to record (e.g. male, female, other)\" {\n suggestions \"male\" \"female\" \"other\"\n }"}}}, + "enroll": {head: "cmd \"enroll\" help=\"Enroll a user by email\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "enrollment-email", text: " flag \"--enrollment-email \" help=\"Email address to enroll\""}}}, + "render": {head: "cmd \"render\" help=\"Render an image asset to a file\"", args: []string{" arg \"prompt\" help=\"Text prompt to render\" required=#true var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./render-{timestamp}-{rand}.{ext}\""}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}}}, + "produce": {head: "cmd \"produce\" help=\"Produce an image asset and wait for completion\"", args: []string{" arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./produce-{timestamp}-{rand}.{ext}\""}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\""}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\""}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\""}}}, + "observe": {head: "cmd \"observe\" help=\"Produce an asset and print its terminal status\"", args: []string{" arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\""}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\""}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\""}}}, + "say": {head: "cmd \"say\" help=\"Stream a chat reply\"", args: []string{" arg \"prompt\" help=\"Prompt to send\" required=#true var=#true"}, flags: []usageItem{{key: "request", text: " flag \"--request \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive (default: true)\" default=#true"}}}, + "archive": {head: "cmd \"archive\" help=\"Archive a user account\""}, + "test-group": {head: "cmd \"test-group\" help=\"Operations for test-group\"", aliases: []usageItem{{key: "tg", text: " alias \"tg\""}}, children: []string{"tag2", "tag3"}}, + "test-group tag2": {head: "cmd \"tag2\" help=\"Operations for tag2\"", children: []string{"post-test"}}, + "test-group tag2 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\""}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "test-group tag3": {head: "cmd \"tag3\" help=\"Operations for tag3\"", children: []string{"post-test"}}, + "test-group tag3 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\""}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "hello": {head: "cmd \"hello\" help=\"Hand-written command that survives regeneration\""}, + "auth": {head: "cmd \"auth\" help=\"Manage authentication credentials\"", children: []string{"login", "logout", "whoami"}}, + "auth login": {head: "cmd \"login\" help=\"Interactively configure authentication credentials\"", flags: []usageItem{{key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true}}}, + "auth logout": {head: "cmd \"logout\" help=\"Clear all stored authentication credentials\""}, + "auth whoami": {head: "cmd \"whoami\" help=\"Display current authentication and global parameter configuration\""}, + "binary-and-string-upload": {head: "cmd \"binary-and-string-upload\" help=\"Binary And String Upload\"", aliases: []usageItem{{key: "basu", text: " alias \"basu\""}}, flags: []usageItem{{key: "binary", text: " flag \"-b --binary \" help=\"binary data (file: or b64:)\""}, {key: "string", text: " flag \"-s --string \" help=\"string value\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "chat": {head: "cmd \"chat\" help=\"Chat\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive\" default=#true"}, {key: "max-tokens", text: " flag \"--max-tokens \" help=\"Maximum number of tokens to generate\""}, {key: "temperature", text: " flag \"--temperature \" help=\"Sampling temperature\""}}}, + "completion": {head: "cmd \"completion\" help=\"Generate the autocompletion script for the specified shell\"", children: []string{"bash", "fish", "powershell", "zsh"}}, + "completion bash": {head: "cmd \"bash\" help=\"Generate the autocompletion script for bash\""}, + "completion fish": {head: "cmd \"fish\" help=\"Generate the autocompletion script for fish\""}, + "completion powershell": {head: "cmd \"powershell\" help=\"Generate the autocompletion script for powershell\""}, + "completion zsh": {head: "cmd \"zsh\" help=\"Generate the autocompletion script for zsh\""}, + "configure": {head: "cmd \"configure\" help=\"Configure authentication, global parameters, and preferences\"", flags: []usageItem{{key: "default-output-format", text: " flag \"--default-output-format \" help=\"Store the default output format without opening the form. Options: pretty, json, yaml, table, toon. Pass an empty value to clear it.\" {\n suggestions \"pretty\" \"json\" \"yaml\" \"table\" \"toon\"\n }"}, {key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true}, {key: "query-param1", text: " flag \"--query-param1 \" help=\"A long winded, multi-line description\" env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"", settings: true}, {key: "deprecated-query-param1", text: " flag \"--deprecated-query-param1 \" help=\"A deprecated description\" env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"", settings: true}, {key: "deprecated-query-param2", text: " flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"", settings: true}, {key: "lone-query-param", text: " flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"", settings: true}}}, + "create-user": {head: "cmd \"create-user\" help=\"Create User\"", aliases: []usageItem{{key: "cu", text: " alias \"cu\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value\""}, {key: "email", text: " flag \"-e --email \" help=\"[required]\""}, {key: "first-name", text: " flag \"-f --first-name \" help=\"string value\""}, {key: "last-name", text: " flag \"-l --last-name \" help=\"string value\""}, {key: "age", text: " flag \"--age \" help=\"number value\""}, {key: "postal-code", text: " flag \"-p --postal-code \" help=\"string value\""}, {key: "gender", text: " flag \"-g --gender \" help=\"options: male, female, other\""}, {key: "associated-ids", text: " flag \"--associated-ids \" help=\"list of values\" var=#true"}, {key: "metadata", text: " flag \"--metadata \" help=\"JSON object\""}, {key: "metadata-any", text: " flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "create-with-union": {head: "cmd \"create-with-union\" help=\"Create with discriminated union request body\"", aliases: []usageItem{{key: "cwu", text: " alias \"cwu\""}}, flags: []usageItem{{key: "dry-run-param", text: " flag \"--dry-run-param\" help=\"If true, validates without creating\""}, {key: "name", text: " flag \"-n --name \" help=\"Name for the shape [required]\""}, {key: "shape", text: " flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\""}, {key: "shape.circle", text: " flag \"--shape.circle \" help=\"Circle variant as JSON\""}, {key: "shape.circle.radius", text: " flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\""}, {key: "shape.circle.color-param", text: " flag \"--shape.circle.color-param \" help=\"Optional color of the circle\""}, {key: "shape.rectangle", text: " flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\""}, {key: "shape.rectangle.width", text: " flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\""}, {key: "shape.rectangle.height", text: " flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\""}, {key: "shape.rectangle.color-param", text: " flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\""}, {key: "description", text: " flag \"--description \" help=\"Optional description\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "delete-user": {head: "cmd \"delete-user\" help=\"Delete User\"", aliases: []usageItem{{key: "du", text: " alias \"du\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}}}, + "explore": {head: "cmd \"explore\" help=\"Interactively browse and run commands\""}, + "get-asset": {head: "cmd \"get-asset\" help=\"Get Asset\"", aliases: []usageItem{{key: "ga", text: " alias \"ga\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "stream", text: " flag \"-s --stream\" help=\"boolean flag\" default=#true"}}}, + "get-binary-default-response": {head: "cmd \"get-binary-default-response\" help=\"Get Binary Default Response\"", aliases: []usageItem{{key: "gbdr", text: " alias \"gbdr\""}}, flags: []usageItem{{key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "get-duplicate-export-collision": {head: "cmd \"get-duplicate-export-collision\" help=\"Tests that a spec-defined error type colliding with a built-in SDK error name does not cause TS2308\"", aliases: []usageItem{{key: "gdec", text: " alias \"gdec\""}}}, + "get-empty-object-error": {head: "cmd \"get-empty-object-error\" help=\"Get Empty Object Error\"", aliases: []usageItem{{key: "geoe", text: " alias \"geoe\""}}}, + "get-error-in-union": {head: "cmd \"get-error-in-union\" help=\"Get Error In Union\"", aliases: []usageItem{{key: "geiu", text: " alias \"geiu\""}}}, + "get-error-only-example": {head: "cmd \"get-error-only-example\" help=\"Operation with example only on error response\"", aliases: []usageItem{{key: "geoex", text: " alias \"geoex\""}}}, + "get-fully-flattened-request": {head: "cmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\"", aliases: []usageItem{{key: "gffr", text: " alias \"gffr\""}}, flags: []usageItem{{key: "lang", text: " flag \"-l --lang \" help=\"[required]\""}, {key: "max-length", text: " flag \"-m --max-length \" help=\"integer value\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "emoji", text: " flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\""}, {key: "gif", text: " flag \"-g --gif \" help=\"string value\""}, {key: "reply", text: " flag \"-r --reply\" help=\"boolean flag\""}, {key: "private", text: " flag \"-p --private\" help=\"boolean flag\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "get-named-primitive-union": {head: "cmd \"get-named-primitive-union\" help=\"Test named primitive union options using title and x-speakeasy-name-override\"", aliases: []usageItem{{key: "gnpu", text: " alias \"gnpu\""}}}, + "get-nested-integer-string": {head: "cmd \"get-nested-integer-string\" help=\"Test nested struct with integer:string tag\"", aliases: []usageItem{{key: "gnis", text: " alias \"gnis\""}}}, + "get-polymorphism": {head: "cmd \"get-polymorphism\" help=\"Get Polymorphism\"", aliases: []usageItem{{key: "gp", text: " alias \"gp\""}}}, + "get-positional-default": {head: "cmd \"get-positional-default\" help=\"Get an item with a default path identifier\"", aliases: []usageItem{{key: "gpd", text: " alias \"gpd\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\""}}}, + "get-request-body-flattened-away": {head: "cmd \"get-request-body-flattened-away\" help=\"Get Request Body Flattened Away\"", aliases: []usageItem{{key: "grbfa", text: " alias \"grbfa\""}}}, + "get-union-errors": {head: "cmd \"get-union-errors\" help=\"Get Union Errors\"", aliases: []usageItem{{key: "gue", text: " alias \"gue\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\""}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\""}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0"}}}, + "get-user": {head: "cmd \"get-user\" help=\"Get User\"", aliases: []usageItem{{key: "gu", text: " alias \"gu\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}}}, + "group": {head: "cmd \"group\" help=\"Operations for group\"", children: []string{"root-group-op", "sub"}}, + "group root-group-op": {head: "cmd \"root-group-op\" help=\"An operation at the group's root level\"", aliases: []usageItem{{key: "rgo", text: " alias \"rgo\""}}}, + "group sub": {head: "cmd \"sub\" help=\"Operations for sub-group\"", children: []string{"empty", "op"}}, + "group sub empty": {head: "cmd \"empty\" help=\"Operations for empty\"", children: []string{"tail"}}, + "group sub empty tail": {head: "cmd \"tail\" help=\"Operations for tail\"", children: []string{"nested-group-op"}}, + "group sub empty tail nested-group-op": {head: "cmd \"nested-group-op\" help=\"An operation at the group's deepest level\"", aliases: []usageItem{{key: "ngo", text: " alias \"ngo\""}}}, + "group sub op": {head: "cmd \"op\" help=\"An operation at the group's top level\""}, + "help": {head: "cmd \"help\" help=\"Help about any command\""}, + "login": {head: "cmd \"login\" help=\"Login\""}, + "namespace-tests": {head: "cmd \"namespace-tests\" help=\"Operations for namespace-tests\"", aliases: []usageItem{{key: "nt", text: " alias \"nt\""}}, children: []string{"conflicts", "single-bar", "single-foo", "types"}}, + "namespace-tests conflicts": {head: "cmd \"conflicts\" help=\"Operations for conflicts\"", children: []string{"create-namespace", "get-namespace", "get-pet-owners", "get-triple-namespace", "put-namespace"}}, + "namespace-tests conflicts create-namespace": {head: "cmd \"create-namespace\" help=\"Create Namespace Conflict Test\"", aliases: []usageItem{{key: "cn", text: " alias \"cn\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\""}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\""}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\""}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\""}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\""}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests conflicts get-namespace": {head: "cmd \"get-namespace\" help=\"Get Namespace Conflict Test\"", aliases: []usageItem{{key: "gn", text: " alias \"gn\""}}}, + "namespace-tests conflicts get-pet-owners": {head: "cmd \"get-pet-owners\" help=\"Get Pet Owners\"", aliases: []usageItem{{key: "gpo", text: " alias \"gpo\""}}}, + "namespace-tests conflicts get-triple-namespace": {head: "cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\"", aliases: []usageItem{{key: "gtn", text: " alias \"gtn\""}}}, + "namespace-tests conflicts put-namespace": {head: "cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\"", aliases: []usageItem{{key: "pn", text: " alias \"pn\""}}, flags: []usageItem{{key: "direct", text: " flag \"--direct \" help=\"JSON object\""}, {key: "namespaced", text: " flag \"-n --namespaced \" help=\"JSON object\""}, {key: "overridden", text: " flag \"--overridden \" help=\"JSON object\""}, {key: "allof", text: " flag \"-a --allof \" help=\"JSON object\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests single-bar": {head: "cmd \"single-bar\" help=\"Operations for single-bar\"", aliases: []usageItem{{key: "sb", text: " alias \"sb\""}}, children: []string{"get-single-namespace-bar-pet"}}, + "namespace-tests single-bar get-single-namespace-bar-pet": {head: "cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\"", aliases: []usageItem{{key: "gsnbp", text: " alias \"gsnbp\""}}}, + "namespace-tests single-foo": {head: "cmd \"single-foo\" help=\"Operations for single-foo\"", aliases: []usageItem{{key: "sf", text: " alias \"sf\""}}, children: []string{"create-single-namespace-foo-pet", "get-single-namespace-foo-pet"}}, + "namespace-tests single-foo create-single-namespace-foo-pet": {head: "cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\"", aliases: []usageItem{{key: "csnfp", text: " alias \"csnfp\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\""}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\""}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\""}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\""}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\""}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests single-foo get-single-namespace-foo-pet": {head: "cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\"", aliases: []usageItem{{key: "gsnfp", text: " alias \"gsnfp\""}}}, + "namespace-tests types": {head: "cmd \"types\" help=\"Operations for types\"", children: []string{"get-namespace", "get-namespace-animal", "get-namespace-organization", "get-namespace-vehicle"}}, + "namespace-tests types get-namespace": {head: "cmd \"get-namespace\" help=\"Get Namespace Types Test\"", aliases: []usageItem{{key: "gn", text: " alias \"gn\""}}}, + "namespace-tests types get-namespace-animal": {head: "cmd \"get-namespace-animal\" help=\"Get Namespace Animal (Discriminated Union)\"", aliases: []usageItem{{key: "gna", text: " alias \"gna\""}}}, + "namespace-tests types get-namespace-organization": {head: "cmd \"get-namespace-organization\" help=\"Get Namespace Organization (Nested Inline Schemas)\"", aliases: []usageItem{{key: "gno", text: " alias \"gno\""}}}, + "namespace-tests types get-namespace-vehicle": {head: "cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\"", aliases: []usageItem{{key: "gnv", text: " alias \"gnv\""}}}, + "obsolete": {head: "cmd \"obsolete\" help=\"A subSDK in which all operations are deprecated\"", children: []string{"deprecated1"}}, + "obsolete deprecated1": {head: "cmd \"deprecated1\" help=\"Deprecated Operation\""}, + "operation-with-leading-and-trailing-underscores": {head: "cmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\"", aliases: []usageItem{{key: "owlatu", text: " alias \"owlatu\""}}, flags: []usageItem{{key: "qp1", text: " flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\""}}}, + "parentheses-in-path-allowed": {head: "cmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\"", aliases: []usageItem{{key: "pipa", text: " alias \"pipa\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}, {key: "field-with-braces-in-description", text: " flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\""}, {key: "field-with-braces-in-default", text: " flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\""}, {key: "field-with-braces-in-title", text: " flag \"--field-with-braces-in-title \" help=\"string value\""}, {key: "field-with-braces-in-example", text: " flag \"--field-with-braces-in-example \" help=\"string value\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "post-file": {head: "cmd \"post-file\" help=\"Post File\"", aliases: []usageItem{{key: "pf", text: " alias \"pf\""}}, flags: []usageItem{{key: "upload", text: " flag \"-u --upload \" help=\"A file\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "render-asset": {head: "cmd \"render-asset\" help=\"Render Asset\"", aliases: []usageItem{{key: "ra", text: " alias \"ra\""}}, flags: []usageItem{{key: "prompt", text: " flag \"-p --prompt \" help=\"[required]\""}, {key: "output-modalities", text: " flag \"--output-modalities \" help=\"options: text, image\" var=#true"}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "stream-metadata": {head: "cmd \"stream-metadata\" help=\"Streamed events can contain text and an optional resource identifier in separate events.\"", aliases: []usageItem{{key: "sm", text: " alias \"sm\""}}}, + "tag1": {head: "cmd \"tag1\" help=\"The first tag\"", children: []string{"recent", "auth", "deprecated1", "list-test1", "post-file-with-encoding"}}, + "tag1 recent": {head: "cmd \"recent\" help=\"List recent test1 pages via tag1\"", flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\""}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\""}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\""}}}, + "tag1 auth": {head: "cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\"", flags: []usageItem{{key: "access-token", text: " flag \"--access-token \" help=\"Security credential\""}}}, + "tag1 deprecated1": {head: "cmd \"deprecated1\" help=\"Deprecated Operation\""}, + "tag1 list-test1": {head: "cmd \"list-test1\" help=\"Get Test1\"", aliases: []usageItem{{key: "lt", text: " alias \"lt\""}}, args: []string{" arg \"page\" help=\"integer value (or use --page)\""}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\""}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\""}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\""}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\""}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0"}}}, + "tag1 post-file-with-encoding": {head: "cmd \"post-file-with-encoding\" help=\"Post File With Encoding\"", aliases: []usageItem{{key: "pfwe", text: " alias \"pfwe\""}}, flags: []usageItem{{key: "file", text: " flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\""}, {key: "attachment", text: " flag \"-a --attachment \" help=\"An optional binary attachment\""}, {key: "file-name", text: " flag \"--file-name \" help=\"Optional custom file name\""}, {key: "file-purpose", text: " flag \"--file-purpose \" help=\"Purpose of the file upload\""}, {key: "metadata", text: " flag \"-m --metadata \" help=\"JSON metadata about the file\""}}}, + "test-endpoint": {head: "cmd \"test-endpoint\" help=\"Test Endpoint\"", aliases: []usageItem{{key: "te", text: " alias \"te\""}}, args: []string{" arg \"test-name\" help=\"string value (or use --test-name)\""}, flags: []usageItem{{key: "test-name", text: " flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\""}, {key: "test", text: " flag \"--test \" help=\"[required]\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "test-enum-formats": {head: "cmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\"", aliases: []usageItem{{key: "tef", text: " alias \"tef\""}}, flags: []usageItem{{key: "string-array-format", text: " flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\""}, {key: "string-map-format", text: " flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\""}, {key: "string-partial-map-format", text: " flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\""}, {key: "integer-map-format", text: " flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\""}, {key: "integer-partial-map-format", text: " flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "update-user": {head: "cmd \"update-user\" help=\"Update User\"", aliases: []usageItem{{key: "uu", text: " alias \"uu\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}, {key: "user.id", text: " flag \"--user.id \" help=\"[required]\""}, {key: "user.email", text: " flag \"--user.email \" help=\"[required]\""}, {key: "user.first-name", text: " flag \"--user.first-name \" help=\"string value\""}, {key: "user.last-name", text: " flag \"--user.last-name \" help=\"string value\""}, {key: "user.age", text: " flag \"--user.age \" help=\"number value\""}, {key: "user.postal-code", text: " flag \"--user.postal-code \" help=\"string value\""}, {key: "user.gender", text: " flag \"--user.gender \" help=\"options: male, female, other\""}, {key: "user.associated-ids", text: " flag \"--user.associated-ids \" help=\"list of values\" var=#true"}, {key: "user.metadata", text: " flag \"--user.metadata \" help=\"JSON object\""}, {key: "user.metadata-any", text: " flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "url-validation-stress-test": {head: "cmd \"url-validation-stress-test\" help=\"Url Validation Stress Test\"", aliases: []usageItem{{key: "uvst", text: " alias \"uvst\""}}}, + "validate": {head: "cmd \"validate\" help=\"Validate\""}, + "version": {head: "cmd \"version\" help=\"Print the CLI version\""}, + "whoami": {head: "cmd \"whoami\" help=\"Display current authentication and global parameter configuration\""}, } func UsageRequested(cmd *cobra.Command) bool { @@ -223,15 +189,138 @@ func selectedCommandPath(cmd *cobra.Command) []string { } func EmitSchema(cmd *cobra.Command, w io.Writer) error { - path := strings.Join(selectedCommandPath(cmd), " ") - if cmd.Annotations["speakeasy_usage_dynamic"] == "true" { - return emitLiveSchema(cmd, w) + var b strings.Builder + renderUsageNode(&b, cmd, strings.Join(selectedCommandPath(cmd), " "), 0, true) + _, err := io.WriteString(w, b.String()) + return err +} + +const usageDynamicAnnotation = "speakeasy_usage_dynamic" + +func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own bool) { + node, static := usageNodes[path] + dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" + isRoot := cmd.Parent() == nil + head := node.head + if dynamic && !isRoot { + head = "cmd " + kdlQuote(cmd.Name()) + " help=" + kdlQuoteAt(cmd.Short, " ") + } + var body []string + if dynamic { + body = mergedUsageBody(cmd, node, own) + } else { + body = staticUsageBody(node, own) + } + children := usageChildren(cmd, node.children) + block := !isRoot && (len(body) > 0 || len(children) > 0) + + writeUsageIndented(b, head, indent) + if block { + b.WriteString(" {") + } + b.WriteByte('\n') + for _, item := range body { + writeUsageIndented(b, item, indent) + b.WriteByte('\n') + } + childIndent := indent + 1 + if isRoot { + childIndent = indent + } + for _, child := range children { + childPath := child.Name() + if path != "" { + childPath = path + " " + childPath + } + renderUsageNode(b, child, childPath, childIndent, false) + } + if block { + b.WriteString(strings.Repeat(" ", indent) + "}\n") + } +} + +// Settings flags are declared once on the root, so only a command's own schema lists them. +func staticUsageBody(node usageNode, own bool) []string { + var body []string + for _, alias := range node.aliases { + body = append(body, alias.text) + } + body = append(body, node.args...) + for _, flag := range node.flags { + if own || !flag.settings { + body = append(body, flag.text) + } + } + return body +} + +func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { + local := cmd.LocalFlags() + var body []string + listed := map[string]bool{} + for _, alias := range node.aliases { + listed[alias.key] = true + if cmd.HasAlias(alias.key) { + body = append(body, alias.text) + } + } + for _, alias := range cmd.Aliases { + if !listed[alias] { + body = append(body, " alias "+kdlQuote(alias)) + } + } + if len(node.args) > 0 { + body = append(body, node.args...) + } else { + body = append(body, liveUsageArgs(cmd)...) } - if schema, ok := usageSchemas[path]; ok { - _, err := io.WriteString(w, schema) - return err + listed = map[string]bool{} + for _, flag := range node.flags { + listed[flag.key] = true + f := cmd.Flags().Lookup(flag.key) + if f != nil && (own || !flag.settings) && (flag.hidden || !f.Hidden) { + body = append(body, flag.text) + } + } + local.VisitAll(func(f *pflag.Flag) { + if !f.Hidden && f.Name != "help" && !listed[f.Name] { + body = append(body, liveUsageFlag(f)) + } + }) + return body +} + +func usageChildren(cmd *cobra.Command, declared []string) []*cobra.Command { + var children []*cobra.Command + listed := map[string]bool{} + for _, name := range declared { + listed[name] = true + for _, child := range cmd.Commands() { + if child.Name() == name { + children = append(children, child) + break + } + } + } + for _, child := range cmd.Commands() { + if !listed[child.Name()] && child.IsAvailableCommand() { + children = append(children, child) + } + } + return children +} + +// KDL multi-line strings keep empty lines unindented, so re-indenting skips them. +func writeUsageIndented(b *strings.Builder, text string, indent int) { + prefix := strings.Repeat(" ", indent) + for i, line := range strings.Split(text, "\n") { + if i > 0 { + b.WriteByte('\n') + } + if line != "" { + b.WriteString(prefix + line) + } } - return emitLiveSchema(cmd, w) } // MarkDynamic makes --usage render the command's schema live from its cobra definition. @@ -239,7 +328,7 @@ func MarkDynamic(cmd *cobra.Command) { if cmd.Annotations == nil { cmd.Annotations = map[string]string{} } - cmd.Annotations["speakeasy_usage_dynamic"] = "true" + cmd.Annotations[usageDynamicAnnotation] = "true" } // Go's %q emits \a, \v, and \xNN escapes that KDL v2 does not define. @@ -335,13 +424,7 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func emitLiveSchema(cmd *cobra.Command, w io.Writer) error { - nl := string(rune(10)) - var b strings.Builder - fmt.Fprintf(&b, "cmd %s help=%s {%s", kdlQuote(cmd.Name()), kdlQuoteAt(cmd.Short, " "), nl) - for _, alias := range cmd.Aliases { - fmt.Fprintf(&b, " alias %s%s", kdlQuote(alias), nl) - } +func liveUsageArgs(cmd *cobra.Command) []string { var promptArgs struct { Version int `json:"version"` Args []struct { @@ -352,47 +435,46 @@ func emitLiveSchema(cmd *cobra.Command, w io.Writer) error { } `json:"args"` } if raw := cmd.Annotations["speakeasy_prompt_args"]; raw != "" && json.Unmarshal([]byte(raw), &promptArgs) == nil && promptArgs.Version == 1 { + var lines []string for _, arg := range promptArgs.Args { - fmt.Fprintf(&b, " arg %s", kdlQuote(arg.Name)) + line := " arg " + kdlQuote(arg.Name) if arg.Summary != "" { - fmt.Fprintf(&b, " help=%s", kdlQuoteAt(arg.Summary, " ")) + line += " help=" + kdlQuoteAt(arg.Summary, " ") } if arg.Required { - b.WriteString(" required=#true") + line += " required=#true" } if arg.Variadic { - b.WriteString(" var=#true") + line += " var=#true" } - b.WriteString(nl) + lines = append(lines, line) } - } else if args := cmd.Annotations["speakeasy_args_help"]; args != "" { - fmt.Fprintf(&b, " args %s%s", kdlQuoteAt(args, " "), nl) + return lines } - cmd.LocalFlags().VisitAll(func(f *pflag.Flag) { - if f.Hidden || f.Name == "help" { - return - } - name := "--" + f.Name - if f.Shorthand != "" { - name = "-" + f.Shorthand + " " + name - } - _, repeatable := f.Value.(pflag.SliceValue) - if f.Value.Type() != "bool" { - placeholder := strings.ReplaceAll(f.Name, "-", "_") - if repeatable { - placeholder += "..." - } - name += " <" + placeholder + ">" - } - fmt.Fprintf(&b, " flag %s help=%s", kdlQuote(name), kdlQuoteAt(f.Usage, " ")) + if args := cmd.Annotations["speakeasy_args_help"]; args != "" { + return []string{" args " + kdlQuoteAt(args, " ")} + } + return nil +} + +func liveUsageFlag(f *pflag.Flag) string { + name := "--" + f.Name + if f.Shorthand != "" { + name = "-" + f.Shorthand + " " + name + } + _, repeatable := f.Value.(pflag.SliceValue) + if f.Value.Type() != "bool" { + placeholder := strings.ReplaceAll(f.Name, "-", "_") if repeatable { - b.WriteString(" var=#true") + placeholder += "..." } - b.WriteString(nl) - }) - b.WriteString("}" + nl) - _, err := io.WriteString(w, b.String()) - return err + name += " <" + placeholder + ">" + } + line := " flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, " ") + if repeatable { + line += " var=#true" + } + return line } func Intercept(root *cobra.Command) { diff --git a/zSDKs/sdk-cli/tests/usage_test.go b/zSDKs/sdk-cli/tests/usage_test.go index a8b65577c..4b2e85f50 100644 --- a/zSDKs/sdk-cli/tests/usage_test.go +++ b/zSDKs/sdk-cli/tests/usage_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/require" "openapi/internal/cli" "openapi/internal/clierrors" + "openapi/internal/usage" "regexp" "strings" "testing" @@ -201,6 +202,68 @@ func TestUsageSchema_GroupSubtree(t *testing.T) { assert.Empty(t, stderr) } +func TestUsageSchema_ComposesRuntimeCommands(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + completion, _, err := root.Find([]string{"completion"}) + require.NoError(t, err) + + var before strings.Builder + require.NoError(t, usage.EmitSchema(root, &before)) + + leaf := &cobra.Command{Use: "runtime-leaf", Short: "Runtime leaf", RunE: func(*cobra.Command, []string) error { return nil }} + leaf.Flags().String("runtime-flag", "", "Runtime flag") + usage.MarkDynamic(leaf) + completion.AddCommand(leaf) + + var after strings.Builder + require.NoError(t, usage.EmitSchema(root, &after)) + block := " cmd \"runtime-leaf\" help=\"Runtime leaf\" {\n flag \"--runtime-flag \" help=\"Runtime flag\"\n }\n" + assert.Contains(t, after.String(), block) + assert.Equal(t, before.String(), strings.Replace(after.String(), block, "", 1)) + + var group strings.Builder + require.NoError(t, usage.EmitSchema(completion, &group)) + assert.Contains(t, group.String(), "\n cmd \"runtime-leaf\" help=\"Runtime leaf\" {\n") +} + +func TestUsageSchema_DynamicCommandKeepsGeneratedLines(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + configure, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + + var ownBefore, rootBefore strings.Builder + require.NoError(t, usage.EmitSchema(configure, &ownBefore)) + require.NoError(t, usage.EmitSchema(root, &rootBefore)) + configure.Flags().String("runtime-flag", "", "Runtime flag") + usage.MarkDynamic(configure) + + var ownAfter, rootAfter strings.Builder + require.NoError(t, usage.EmitSchema(configure, &ownAfter)) + require.NoError(t, usage.EmitSchema(root, &rootAfter)) + flag := " flag \"--runtime-flag \" help=\"Runtime flag\"\n" + assert.Equal(t, strings.TrimSuffix(ownBefore.String(), "}\n")+flag+"}\n", ownAfter.String()) + + start := strings.Index(rootBefore.String(), "\ncmd \"configure\"") + require.GreaterOrEqual(t, start, 0) + end := start + strings.Index(rootBefore.String()[start:], "\n}\n") + 1 + assert.Equal(t, rootBefore.String()[:end]+flag+rootBefore.String()[end:], rootAfter.String()) +} + +func TestUsageSchema_DynamicRootUnchanged(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + + var before strings.Builder + require.NoError(t, usage.EmitSchema(root, &before)) + usage.MarkDynamic(root) + + var after strings.Builder + require.NoError(t, usage.EmitSchema(root, &after)) + assert.Equal(t, before.String(), after.String()) +} + func TestUsageSchema_UsageFalseDoesNotEmitSchema(t *testing.T) { h := NewCLITestHarness(t) err := h.RunBare([]string{"version", "--usage=false"}) From 8733c14746abc96ce929bc4832251fb03d76167d Mon Sep 17 00:00:00 2001 From: 2ynn Date: Fri, 16 Oct 2026 20:16:50 -0400 Subject: [PATCH 2/7] fix(cli): handle root, hidden and detached commands in composed --usage - Live-rendered aliases, args and flags take the node's item prefix, so a dynamic root lists runtime root flags at indent 0 instead of 2. - A generated child hidden at runtime is dropped from its parent's schema, matching children added at runtime, which already required an available command. - The root node is a parentless command with subcommands; any other parentless command renders itself from cobra instead of the root schema. Tests: `TestUsageSchema_DynamicRoot` (replaces `TestUsageSchema_DynamicRootUnchanged` and adds the runtime root flag), `TestUsageSchema_HiddenGeneratedCommandDropped`, `TestUsageSchema_DetachedDynamicCommand`. Review SDK regenerated. --- templates/templates/cli/README.md | 2 +- templates/templates/cli/usage.go.stmpl | 33 +++++++++++++-------- templates/templates/cli/usage_test.go.stmpl | 30 +++++++++++++++++-- zSDKs/sdk-cli/.speakeasy/gen.lock | 4 +-- zSDKs/sdk-cli/internal/usage/schema.go | 33 +++++++++++++-------- zSDKs/sdk-cli/tests/usage_test.go | 30 +++++++++++++++++-- 6 files changed, 99 insertions(+), 33 deletions(-) diff --git a/templates/templates/cli/README.md b/templates/templates/cli/README.md index 31b811c80..669cb0676 100644 --- a/templates/templates/cli/README.md +++ b/templates/templates/cli/README.md @@ -1395,7 +1395,7 @@ The KDL schema is built at generation time from the command tree in `includes/us Declared commands (`x-speakeasy-cli-commands`) are part of the schema: bound intents mount into the KDL tree under their declared parent path with the same flag surface the runtime registers (declared positional `arg` nodes, operation security flags, the body flag, `--schema`, and declared flags — plus non-body parameter metadata for JSON-body intents (multipart intents keep their upload fields); `buildIntentUsageCommand` in `includes/usage.ts`), and planned placeholders appear with their summary. For commands added after static schema generation, live schema emission reads `speakeasy_prompt_args` and emits the same `arg` nodes. Once Cobra validation succeeds, `--usage` on an intent or planned command emits KDL and wins over the command's other runtime surfaces, including `--schema` and the bare-invocation usage error (`runIntent*Cmd` in `intentcmd.go.stmpl` and `newPlannedCmd` in `intents.go.stmpl` check `usage.UsageRequested` first, matching operation commands). -**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated alias, arg and flag lines for everything it still has (dropping flags hidden at runtime), and renders only runtime-added aliases and local flags live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path, so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. +**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated alias, arg and flag lines for everything it still has (dropping flags hidden at runtime), and renders only runtime-added aliases and local flags live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path, so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. ### Generated README & Command Docs diff --git a/templates/templates/cli/usage.go.stmpl b/templates/templates/cli/usage.go.stmpl index eaf350b79..882e4dd52 100644 --- a/templates/templates/cli/usage.go.stmpl +++ b/templates/templates/cli/usage.go.stmpl @@ -105,16 +105,23 @@ func EmitSchema(cmd *cobra.Command, w io.Writer) error { const usageDynamicAnnotation = "speakeasy_usage_dynamic" func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own bool) { + isRoot := cmd.Parent() == nil && cmd.HasSubCommands() node, static := usageNodes[path] + if path == "" && !isRoot { + node, static = usageNode{}, false + } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" - isRoot := cmd.Parent() == nil + itemPrefix := " " + if isRoot { + itemPrefix = "" + } head := node.head if dynamic && !isRoot { head = "cmd " + kdlQuote(cmd.Name()) + " help=" + kdlQuoteAt(cmd.Short, " ") } var body []string if dynamic { - body = mergedUsageBody(cmd, node, own) + body = mergedUsageBody(cmd, node, own, itemPrefix) } else { body = staticUsageBody(node, own) } @@ -161,7 +168,7 @@ func staticUsageBody(node usageNode, own bool) []string { return body } -func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { +func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string) []string { local := cmd.LocalFlags() var body []string listed := map[string]bool{} @@ -173,13 +180,13 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { } for _, alias := range cmd.Aliases { if !listed[alias] { - body = append(body, " alias "+kdlQuote(alias)) + body = append(body, prefix+"alias "+kdlQuote(alias)) } } if len(node.args) > 0 { body = append(body, node.args...) } else { - body = append(body, liveUsageArgs(cmd)...) + body = append(body, liveUsageArgs(cmd, prefix)...) } listed = map[string]bool{} for _, flag := range node.flags { @@ -191,7 +198,7 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { } local.VisitAll(func(f *pflag.Flag) { if !f.Hidden && f.Name != "help" && !listed[f.Name] { - body = append(body, liveUsageFlag(f)) + body = append(body, liveUsageFlag(f, prefix)) } }) return body @@ -203,7 +210,7 @@ func usageChildren(cmd *cobra.Command, declared []string) []*cobra.Command { for _, name := range declared { listed[name] = true for _, child := range cmd.Commands() { - if child.Name() == name { + if child.Name() == name && !child.Hidden { children = append(children, child) break } @@ -331,7 +338,7 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func liveUsageArgs(cmd *cobra.Command) []string { +func liveUsageArgs(cmd *cobra.Command, prefix string) []string { var promptArgs struct { Version int `json:"version"` Args []struct { @@ -344,9 +351,9 @@ func liveUsageArgs(cmd *cobra.Command) []string { if raw := cmd.Annotations["speakeasy_prompt_args"]; raw != "" && json.Unmarshal([]byte(raw), &promptArgs) == nil && promptArgs.Version == 1 { var lines []string for _, arg := range promptArgs.Args { - line := " arg " + kdlQuote(arg.Name) + line := prefix + "arg " + kdlQuote(arg.Name) if arg.Summary != "" { - line += " help=" + kdlQuoteAt(arg.Summary, " ") + line += " help=" + kdlQuoteAt(arg.Summary, prefix+" ") } if arg.Required { line += " required=#true" @@ -359,12 +366,12 @@ func liveUsageArgs(cmd *cobra.Command) []string { return lines } if args := cmd.Annotations["speakeasy_args_help"]; args != "" { - return []string{" args " + kdlQuoteAt(args, " ")} + return []string{prefix + "args " + kdlQuoteAt(args, prefix+" ")} } return nil } -func liveUsageFlag(f *pflag.Flag) string { +func liveUsageFlag(f *pflag.Flag, prefix string) string { name := "--" + f.Name if f.Shorthand != "" { name = "-" + f.Shorthand + " " + name @@ -377,7 +384,7 @@ func liveUsageFlag(f *pflag.Flag) string { } name += " <" + placeholder + ">" } - line := " flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, " ") + line := prefix + "flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, prefix+" ") if repeatable { line += " var=#true" } diff --git a/templates/templates/cli/usage_test.go.stmpl b/templates/templates/cli/usage_test.go.stmpl index ade4297bd..1b723c270 100644 --- a/templates/templates/cli/usage_test.go.stmpl +++ b/templates/templates/cli/usage_test.go.stmpl @@ -264,7 +264,7 @@ func TestUsageSchema_DynamicCommandKeepsGeneratedLines(t *testing.T) { assert.Equal(t, rootBefore.String()[:end]+flag+rootBefore.String()[end:], rootAfter.String()) } -func TestUsageSchema_DynamicRootUnchanged(t *testing.T) { +func TestUsageSchema_DynamicRoot(t *testing.T) { root, err := cli.NewRootCommand() require.NoError(t, err) @@ -272,9 +272,35 @@ func TestUsageSchema_DynamicRootUnchanged(t *testing.T) { require.NoError(t, usage.EmitSchema(root, &before)) usage.MarkDynamic(root) + var unchanged strings.Builder + require.NoError(t, usage.EmitSchema(root, &unchanged)) + assert.Equal(t, before.String(), unchanged.String()) + + root.PersistentFlags().String("runtime-root", "", "Runtime root flag") var after strings.Builder require.NoError(t, usage.EmitSchema(root, &after)) - assert.Equal(t, before.String(), after.String()) + assert.Contains(t, after.String(), "\nflag \"--runtime-root \" help=\"Runtime root flag\"\n") +} + +func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + version, _, err := root.Find([]string{"version"}) + require.NoError(t, err) + version.Hidden = true + + var out strings.Builder + require.NoError(t, usage.EmitSchema(root, &out)) + assert.NotContains(t, out.String(), "\ncmd \"version\"") +} + +func TestUsageSchema_DetachedDynamicCommand(t *testing.T) { + detached := &cobra.Command{Use: "detached", Short: "Detached"} + usage.MarkDynamic(detached) + + var out strings.Builder + require.NoError(t, usage.EmitSchema(detached, &out)) + assert.Equal(t, "cmd \"detached\" help=\"Detached\"\n", out.String()) } func TestUsageSchema_UsageFalseDoesNotEmitSchema(t *testing.T) { diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index f68db2ef0..27b489f53 100644 --- a/zSDKs/sdk-cli/.speakeasy/gen.lock +++ b/zSDKs/sdk-cli/.speakeasy/gen.lock @@ -658,7 +658,7 @@ trackedFiles: internal/usage/bodyschemas.go: last_write_checksum: sha1:775249b69ed405ad072c16a76fe6113f375b3818 internal/usage/schema.go: - last_write_checksum: sha1:fc4e1306294a3f2b36dc43d8936cfa6704f9fa93 + last_write_checksum: sha1:46dbe9d03ad8e90472e80bb58f8cf5c5560741bd scripts/install.ps1: last_write_checksum: sha1:9dcf40ea00ecb8ceda83d5056f57235b43cf658a scripts/install.sh: @@ -1120,7 +1120,7 @@ trackedFiles: tests/types_test.go: last_write_checksum: sha1:5ce31f08a3214779ed561d0f37279eb4d5202723 tests/usage_test.go: - last_write_checksum: sha1:fe0b2aacebb2a131a096463b2c5991b65d39458b + last_write_checksum: sha1:68ac681705087a3fa3111c52e8eaa8f7bd1b6008 examples: _operation_with_leading_and_trailing_underscores_: speakeasy-default-operation-with-leading-and-trailing-underscores: diff --git a/zSDKs/sdk-cli/internal/usage/schema.go b/zSDKs/sdk-cli/internal/usage/schema.go index 1c0c2c6fa..54e994344 100644 --- a/zSDKs/sdk-cli/internal/usage/schema.go +++ b/zSDKs/sdk-cli/internal/usage/schema.go @@ -198,16 +198,23 @@ func EmitSchema(cmd *cobra.Command, w io.Writer) error { const usageDynamicAnnotation = "speakeasy_usage_dynamic" func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own bool) { + isRoot := cmd.Parent() == nil && cmd.HasSubCommands() node, static := usageNodes[path] + if path == "" && !isRoot { + node, static = usageNode{}, false + } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" - isRoot := cmd.Parent() == nil + itemPrefix := " " + if isRoot { + itemPrefix = "" + } head := node.head if dynamic && !isRoot { head = "cmd " + kdlQuote(cmd.Name()) + " help=" + kdlQuoteAt(cmd.Short, " ") } var body []string if dynamic { - body = mergedUsageBody(cmd, node, own) + body = mergedUsageBody(cmd, node, own, itemPrefix) } else { body = staticUsageBody(node, own) } @@ -254,7 +261,7 @@ func staticUsageBody(node usageNode, own bool) []string { return body } -func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { +func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string) []string { local := cmd.LocalFlags() var body []string listed := map[string]bool{} @@ -266,13 +273,13 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { } for _, alias := range cmd.Aliases { if !listed[alias] { - body = append(body, " alias "+kdlQuote(alias)) + body = append(body, prefix+"alias "+kdlQuote(alias)) } } if len(node.args) > 0 { body = append(body, node.args...) } else { - body = append(body, liveUsageArgs(cmd)...) + body = append(body, liveUsageArgs(cmd, prefix)...) } listed = map[string]bool{} for _, flag := range node.flags { @@ -284,7 +291,7 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool) []string { } local.VisitAll(func(f *pflag.Flag) { if !f.Hidden && f.Name != "help" && !listed[f.Name] { - body = append(body, liveUsageFlag(f)) + body = append(body, liveUsageFlag(f, prefix)) } }) return body @@ -296,7 +303,7 @@ func usageChildren(cmd *cobra.Command, declared []string) []*cobra.Command { for _, name := range declared { listed[name] = true for _, child := range cmd.Commands() { - if child.Name() == name { + if child.Name() == name && !child.Hidden { children = append(children, child) break } @@ -424,7 +431,7 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func liveUsageArgs(cmd *cobra.Command) []string { +func liveUsageArgs(cmd *cobra.Command, prefix string) []string { var promptArgs struct { Version int `json:"version"` Args []struct { @@ -437,9 +444,9 @@ func liveUsageArgs(cmd *cobra.Command) []string { if raw := cmd.Annotations["speakeasy_prompt_args"]; raw != "" && json.Unmarshal([]byte(raw), &promptArgs) == nil && promptArgs.Version == 1 { var lines []string for _, arg := range promptArgs.Args { - line := " arg " + kdlQuote(arg.Name) + line := prefix + "arg " + kdlQuote(arg.Name) if arg.Summary != "" { - line += " help=" + kdlQuoteAt(arg.Summary, " ") + line += " help=" + kdlQuoteAt(arg.Summary, prefix+" ") } if arg.Required { line += " required=#true" @@ -452,12 +459,12 @@ func liveUsageArgs(cmd *cobra.Command) []string { return lines } if args := cmd.Annotations["speakeasy_args_help"]; args != "" { - return []string{" args " + kdlQuoteAt(args, " ")} + return []string{prefix + "args " + kdlQuoteAt(args, prefix+" ")} } return nil } -func liveUsageFlag(f *pflag.Flag) string { +func liveUsageFlag(f *pflag.Flag, prefix string) string { name := "--" + f.Name if f.Shorthand != "" { name = "-" + f.Shorthand + " " + name @@ -470,7 +477,7 @@ func liveUsageFlag(f *pflag.Flag) string { } name += " <" + placeholder + ">" } - line := " flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, " ") + line := prefix + "flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, prefix+" ") if repeatable { line += " var=#true" } diff --git a/zSDKs/sdk-cli/tests/usage_test.go b/zSDKs/sdk-cli/tests/usage_test.go index 4b2e85f50..e97375700 100644 --- a/zSDKs/sdk-cli/tests/usage_test.go +++ b/zSDKs/sdk-cli/tests/usage_test.go @@ -251,7 +251,7 @@ func TestUsageSchema_DynamicCommandKeepsGeneratedLines(t *testing.T) { assert.Equal(t, rootBefore.String()[:end]+flag+rootBefore.String()[end:], rootAfter.String()) } -func TestUsageSchema_DynamicRootUnchanged(t *testing.T) { +func TestUsageSchema_DynamicRoot(t *testing.T) { root, err := cli.NewRootCommand() require.NoError(t, err) @@ -259,9 +259,35 @@ func TestUsageSchema_DynamicRootUnchanged(t *testing.T) { require.NoError(t, usage.EmitSchema(root, &before)) usage.MarkDynamic(root) + var unchanged strings.Builder + require.NoError(t, usage.EmitSchema(root, &unchanged)) + assert.Equal(t, before.String(), unchanged.String()) + + root.PersistentFlags().String("runtime-root", "", "Runtime root flag") var after strings.Builder require.NoError(t, usage.EmitSchema(root, &after)) - assert.Equal(t, before.String(), after.String()) + assert.Contains(t, after.String(), "\nflag \"--runtime-root \" help=\"Runtime root flag\"\n") +} + +func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + version, _, err := root.Find([]string{"version"}) + require.NoError(t, err) + version.Hidden = true + + var out strings.Builder + require.NoError(t, usage.EmitSchema(root, &out)) + assert.NotContains(t, out.String(), "\ncmd \"version\"") +} + +func TestUsageSchema_DetachedDynamicCommand(t *testing.T) { + detached := &cobra.Command{Use: "detached", Short: "Detached"} + usage.MarkDynamic(detached) + + var out strings.Builder + require.NoError(t, usage.EmitSchema(detached, &out)) + assert.Equal(t, "cmd \"detached\" help=\"Detached\"\n", out.String()) } func TestUsageSchema_UsageFalseDoesNotEmitSchema(t *testing.T) { From c3c0ece6715357eeab65adc1074b2ffcc3263bcc Mon Sep 17 00:00:00 2001 From: 2ynn Date: Fri, 16 Oct 2026 20:35:36 -0400 Subject: [PATCH 3/7] fix(cli): identify the generated root explicitly in composed --usage A parentless command group was treated as the CLI root because root detection only checked `Parent() == nil && HasSubCommands()`, so `EmitSchema` on a detached group printed the generated root's metadata and dropped the group's own `cmd` node. Only commands whose `Root()` is the generated CLI root (`usageRootName`) now use the generated `usageNodes` table; a detached command and its children render from cobra. README: state precisely what a dynamic command keeps (generated arg lines; alias and flag lines it still has; generated `hide=#true` flags) and that detached commands render entirely from cobra. `TestUsageSchema_DetachedCommand` replaces `TestUsageSchema_DetachedDynamicCommand` and adds a detached group whose child shares a generated command's name. Review SDK regenerated. --- templates/templates/cli/README.md | 2 +- templates/templates/cli/usage.go.stmpl | 21 +++++++++++++-------- templates/templates/cli/usage_test.go.stmpl | 14 +++++++++----- zSDKs/sdk-cli/.speakeasy/gen.lock | 4 ++-- zSDKs/sdk-cli/internal/usage/schema.go | 21 +++++++++++++-------- zSDKs/sdk-cli/tests/usage_test.go | 14 +++++++++----- 6 files changed, 47 insertions(+), 29 deletions(-) diff --git a/templates/templates/cli/README.md b/templates/templates/cli/README.md index 669cb0676..d519d4d00 100644 --- a/templates/templates/cli/README.md +++ b/templates/templates/cli/README.md @@ -1395,7 +1395,7 @@ The KDL schema is built at generation time from the command tree in `includes/us Declared commands (`x-speakeasy-cli-commands`) are part of the schema: bound intents mount into the KDL tree under their declared parent path with the same flag surface the runtime registers (declared positional `arg` nodes, operation security flags, the body flag, `--schema`, and declared flags — plus non-body parameter metadata for JSON-body intents (multipart intents keep their upload fields); `buildIntentUsageCommand` in `includes/usage.ts`), and planned placeholders appear with their summary. For commands added after static schema generation, live schema emission reads `speakeasy_prompt_args` and emits the same `arg` nodes. Once Cobra validation succeeds, `--usage` on an intent or planned command emits KDL and wins over the command's other runtime surfaces, including `--schema` and the bare-invocation usage error (`runIntent*Cmd` in `intentcmd.go.stmpl` and `newPlannedCmd` in `intents.go.stmpl` check `usage.UsageRequested` first, matching operation commands). -**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated alias, arg and flag lines for everything it still has (dropping flags hidden at runtime), and renders only runtime-added aliases and local flags live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path, so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. +**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated arg lines, keeps its generated alias and flag lines for the aliases and flags it still has (a flag generated visible and hidden at runtime is dropped; one generated with `hide=#true` keeps that line), and renders only runtime-added aliases and visible local flags live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path under the generated root (a command detached from it renders entirely from Cobra), so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. ### Generated README & Command Docs diff --git a/templates/templates/cli/usage.go.stmpl b/templates/templates/cli/usage.go.stmpl index 882e4dd52..b10dfb1d0 100644 --- a/templates/templates/cli/usage.go.stmpl +++ b/templates/templates/cli/usage.go.stmpl @@ -97,18 +97,23 @@ func selectedCommandPath(cmd *cobra.Command) []string { func EmitSchema(cmd *cobra.Command, w io.Writer) error { var b strings.Builder - renderUsageNode(&b, cmd, strings.Join(selectedCommandPath(cmd), " "), 0, true) + tabled := cmd.Root().Name() == usageRootName + renderUsageNode(&b, cmd, strings.Join(selectedCommandPath(cmd), " "), 0, true, tabled) _, err := io.WriteString(w, b.String()) return err } -const usageDynamicAnnotation = "speakeasy_usage_dynamic" +const ( + usageDynamicAnnotation = "speakeasy_usage_dynamic" + usageRootName = "{{sanitizeCliName}}" +) -func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own bool) { - isRoot := cmd.Parent() == nil && cmd.HasSubCommands() - node, static := usageNodes[path] - if path == "" && !isRoot { - node, static = usageNode{}, false +func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own, tabled bool) { + isRoot := tabled && cmd.Parent() == nil + var node usageNode + static := false + if tabled { + node, static = usageNodes[path] } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" itemPrefix := " " @@ -146,7 +151,7 @@ func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent if path != "" { childPath = path + " " + childPath } - renderUsageNode(b, child, childPath, childIndent, false) + renderUsageNode(b, child, childPath, childIndent, false, tabled) } if block { b.WriteString(strings.Repeat(" ", indent) + "}\n") diff --git a/templates/templates/cli/usage_test.go.stmpl b/templates/templates/cli/usage_test.go.stmpl index 1b723c270..bab1db2f8 100644 --- a/templates/templates/cli/usage_test.go.stmpl +++ b/templates/templates/cli/usage_test.go.stmpl @@ -294,13 +294,17 @@ func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { assert.NotContains(t, out.String(), "\ncmd \"version\"") } -func TestUsageSchema_DetachedDynamicCommand(t *testing.T) { - detached := &cobra.Command{Use: "detached", Short: "Detached"} - usage.MarkDynamic(detached) - +func TestUsageSchema_DetachedCommand(t *testing.T) { + leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder - require.NoError(t, usage.EmitSchema(detached, &out)) + require.NoError(t, usage.EmitSchema(leaf, &out)) assert.Equal(t, "cmd \"detached\" help=\"Detached\"\n", out.String()) + + group := &cobra.Command{Use: "detached", Short: "Detached group"} + group.AddCommand(&cobra.Command{Use: "version", Short: "Detached child", RunE: func(*cobra.Command, []string) error { return nil }}) + out.Reset() + require.NoError(t, usage.EmitSchema(group, &out)) + assert.Equal(t, "cmd \"detached\" help=\"Detached group\" {\n cmd \"version\" help=\"Detached child\"\n}\n", out.String()) } func TestUsageSchema_UsageFalseDoesNotEmitSchema(t *testing.T) { diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index 27b489f53..9b622ce06 100644 --- a/zSDKs/sdk-cli/.speakeasy/gen.lock +++ b/zSDKs/sdk-cli/.speakeasy/gen.lock @@ -658,7 +658,7 @@ trackedFiles: internal/usage/bodyschemas.go: last_write_checksum: sha1:775249b69ed405ad072c16a76fe6113f375b3818 internal/usage/schema.go: - last_write_checksum: sha1:46dbe9d03ad8e90472e80bb58f8cf5c5560741bd + last_write_checksum: sha1:0dbaf69123e8735de634cb95e1a69d43783720b3 scripts/install.ps1: last_write_checksum: sha1:9dcf40ea00ecb8ceda83d5056f57235b43cf658a scripts/install.sh: @@ -1120,7 +1120,7 @@ trackedFiles: tests/types_test.go: last_write_checksum: sha1:5ce31f08a3214779ed561d0f37279eb4d5202723 tests/usage_test.go: - last_write_checksum: sha1:68ac681705087a3fa3111c52e8eaa8f7bd1b6008 + last_write_checksum: sha1:d0e1e37c3f17a2e4f83452c610d71e6882021adc examples: _operation_with_leading_and_trailing_underscores_: speakeasy-default-operation-with-leading-and-trailing-underscores: diff --git a/zSDKs/sdk-cli/internal/usage/schema.go b/zSDKs/sdk-cli/internal/usage/schema.go index 54e994344..c876d2c2f 100644 --- a/zSDKs/sdk-cli/internal/usage/schema.go +++ b/zSDKs/sdk-cli/internal/usage/schema.go @@ -190,18 +190,23 @@ func selectedCommandPath(cmd *cobra.Command) []string { func EmitSchema(cmd *cobra.Command, w io.Writer) error { var b strings.Builder - renderUsageNode(&b, cmd, strings.Join(selectedCommandPath(cmd), " "), 0, true) + tabled := cmd.Root().Name() == usageRootName + renderUsageNode(&b, cmd, strings.Join(selectedCommandPath(cmd), " "), 0, true, tabled) _, err := io.WriteString(w, b.String()) return err } -const usageDynamicAnnotation = "speakeasy_usage_dynamic" +const ( + usageDynamicAnnotation = "speakeasy_usage_dynamic" + usageRootName = "cli" +) -func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own bool) { - isRoot := cmd.Parent() == nil && cmd.HasSubCommands() - node, static := usageNodes[path] - if path == "" && !isRoot { - node, static = usageNode{}, false +func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own, tabled bool) { + isRoot := tabled && cmd.Parent() == nil + var node usageNode + static := false + if tabled { + node, static = usageNodes[path] } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" itemPrefix := " " @@ -239,7 +244,7 @@ func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent if path != "" { childPath = path + " " + childPath } - renderUsageNode(b, child, childPath, childIndent, false) + renderUsageNode(b, child, childPath, childIndent, false, tabled) } if block { b.WriteString(strings.Repeat(" ", indent) + "}\n") diff --git a/zSDKs/sdk-cli/tests/usage_test.go b/zSDKs/sdk-cli/tests/usage_test.go index e97375700..82dc8d473 100644 --- a/zSDKs/sdk-cli/tests/usage_test.go +++ b/zSDKs/sdk-cli/tests/usage_test.go @@ -281,13 +281,17 @@ func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { assert.NotContains(t, out.String(), "\ncmd \"version\"") } -func TestUsageSchema_DetachedDynamicCommand(t *testing.T) { - detached := &cobra.Command{Use: "detached", Short: "Detached"} - usage.MarkDynamic(detached) - +func TestUsageSchema_DetachedCommand(t *testing.T) { + leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder - require.NoError(t, usage.EmitSchema(detached, &out)) + require.NoError(t, usage.EmitSchema(leaf, &out)) assert.Equal(t, "cmd \"detached\" help=\"Detached\"\n", out.String()) + + group := &cobra.Command{Use: "detached", Short: "Detached group"} + group.AddCommand(&cobra.Command{Use: "version", Short: "Detached child", RunE: func(*cobra.Command, []string) error { return nil }}) + out.Reset() + require.NoError(t, usage.EmitSchema(group, &out)) + assert.Equal(t, "cmd \"detached\" help=\"Detached group\" {\n cmd \"version\" help=\"Detached child\"\n}\n", out.String()) } func TestUsageSchema_UsageFalseDoesNotEmitSchema(t *testing.T) { From 152fba11952e0d31de95fcc47e69afaaabbaf137 Mon Sep 17 00:00:00 2001 From: 2ynn Date: Fri, 16 Oct 2026 20:50:57 -0400 Subject: [PATCH 4/7] fix(cli): render changed inputs of dynamic commands live in --usage A dynamic command reused every generated arg line whenever the node had args, and every generated flag line whose long name still existed. A same-named replacement registered with `cobra.NoArgs` and `BoolP("id", "x", ...)` therefore still advertised `arg "id"` and `-i --id `, in its own schema and in every ancestor's. `usageNodes` now records, per generated flag, its shorthand and whether it takes an operand or repeats, and each arg line carries its name. For a dynamic command: - generated arg lines are kept only while the runtime `speakeasy_prompt_args` names match them; otherwise args render live; - a generated flag line is kept only while cobra's flag has the same shorthand, operand and repeatability; otherwise that flag renders live in its generated position. Generated `default=` values are not compared: they are the documented effective defaults, which intents may apply outside cobra, so cobra's `DefValue` differs for unchanged flags. Tests: `TestUsageSchema_ReplacedCommandDropsStaleFlagSyntax` (own and root schema), `TestUsageSchema_ReplacedIntentDropsStaleArgs`; `TestUsageSchema_DynamicRoot` now asserts the exact root output after a runtime root flag is added. README and review SDK updated. --- templates/templates/cli/README.md | 2 +- templates/templates/cli/includes/usage.ts | 37 +++-- templates/templates/cli/usage.go.stmpl | 71 +++++++--- templates/templates/cli/usage_test.go.stmpl | 43 +++++- zSDKs/sdk-cli/.speakeasy/gen.lock | 4 +- zSDKs/sdk-cli/internal/usage/schema.go | 143 +++++++++++++------- zSDKs/sdk-cli/tests/usage_test.go | 43 +++++- 7 files changed, 257 insertions(+), 86 deletions(-) diff --git a/templates/templates/cli/README.md b/templates/templates/cli/README.md index d519d4d00..1482ced23 100644 --- a/templates/templates/cli/README.md +++ b/templates/templates/cli/README.md @@ -1395,7 +1395,7 @@ The KDL schema is built at generation time from the command tree in `includes/us Declared commands (`x-speakeasy-cli-commands`) are part of the schema: bound intents mount into the KDL tree under their declared parent path with the same flag surface the runtime registers (declared positional `arg` nodes, operation security flags, the body flag, `--schema`, and declared flags — plus non-body parameter metadata for JSON-body intents (multipart intents keep their upload fields); `buildIntentUsageCommand` in `includes/usage.ts`), and planned placeholders appear with their summary. For commands added after static schema generation, live schema emission reads `speakeasy_prompt_args` and emits the same `arg` nodes. Once Cobra validation succeeds, `--usage` on an intent or planned command emits KDL and wins over the command's other runtime surfaces, including `--schema` and the bare-invocation usage error (`runIntent*Cmd` in `intentcmd.go.stmpl` and `newPlannedCmd` in `intents.go.stmpl` check `usage.UsageRequested` first, matching operation commands). -**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated arg lines, keeps its generated alias and flag lines for the aliases and flags it still has (a flag generated visible and hidden at runtime is dropped; one generated with `hide=#true` keeps that line), and renders only runtime-added aliases and visible local flags live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path under the generated root (a command detached from it renders entirely from Cobra), so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. +**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated arg lines while the runtime `speakeasy_prompt_args` names match them, keeps its generated alias lines for aliases it still has, and keeps a generated flag line while the flag still exists with the same shorthand, operand and repeatability (generated `default=` values are the documented effective defaults, which intents may apply outside cobra, so they are not compared with cobra's); a flag whose syntax changed renders live in its generated position, a flag generated visible and hidden at runtime is dropped, one generated with `hide=#true` keeps that line, and runtime-added aliases and visible local flags render live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path under the generated root (a command detached from it renders entirely from Cobra), so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. ### Generated README & Command Docs diff --git a/templates/templates/cli/includes/usage.ts b/templates/templates/cli/includes/usage.ts index 1c38c17b9..97f1884dd 100644 --- a/templates/templates/cli/includes/usage.ts +++ b/templates/templates/cli/includes/usage.ts @@ -1489,13 +1489,16 @@ interface UsageNodeItem { text: string; settings?: boolean; hidden?: boolean; + short?: string; + value?: boolean; + repeat?: boolean; } // Rendered at indent 0; the runtime re-indents each line by depth. interface UsageNodeEntry { head: string; aliases: UsageNodeItem[]; - args: string[]; + args: UsageNodeItem[]; flags: UsageNodeItem[]; children: string[]; } @@ -1513,12 +1516,18 @@ function collectUsageNodes( key: alias, text: `${" ".repeat(depth)}alias ${kdlQuoted(alias)}`, })), - args: (cmd.args || []).map((arg) => renderUsageArg(arg, depth).join("\n")), + args: (cmd.args || []).map((arg) => ({ + key: arg.name, + text: renderUsageArg(arg, depth).join("\n"), + })), flags: (cmd.flags || []).map((flag) => ({ key: usageFlagKey(flag), text: renderUsageFlag(flag, depth).join("\n"), settings: flag.settings, hidden: flag.hidden, + short: /^-([^-\s]+)\s/.exec(flag.spec)?.[1], + value: flag.spec.includes(" <"), + repeat: flag.spec.includes("...>"), })), children: (cmd.commands || []).map((child) => child.name), }); @@ -2389,14 +2398,18 @@ registerTemplateFunc( function goUsageNodeItems(items: UsageNodeItem[]): string { return `[]usageItem{ ${items - .map( - (item) => - `{key: ${goStringLiteral(item.key)}, text: ${goTemplateSafeStringExpr( - item.text, - )}${item.settings ? ", settings: true" : ""}${ - item.hidden ? ", hidden: true" : "" - } }`, - ) + .map((item) => { + const fields = [ + `key: ${goStringLiteral(item.key)}`, + `text: ${goTemplateSafeStringExpr(item.text)}`, + ]; + if (item.settings) fields.push("settings: true"); + if (item.hidden) fields.push("hidden: true"); + if (item.short) fields.push(`short: ${goStringLiteral(item.short)}`); + if (item.value) fields.push("value: true"); + if (item.repeat) fields.push("repeat: true"); + return `{${fields.join(", ")} }`; + }) .join(", ")} }`; } @@ -2406,9 +2419,7 @@ function goUsageNodeEntry(node: UsageNodeEntry): string { fields.push(`aliases: ${goUsageNodeItems(node.aliases)}`); } if (node.args.length) { - fields.push( - `args: []string{ ${node.args.map(goTemplateSafeStringExpr).join(", ")} }`, - ); + fields.push(`args: ${goUsageNodeItems(node.args)}`); } if (node.flags.length) { fields.push(`flags: ${goUsageNodeItems(node.flags)}`); diff --git a/templates/templates/cli/usage.go.stmpl b/templates/templates/cli/usage.go.stmpl index b10dfb1d0..700251fd3 100644 --- a/templates/templates/cli/usage.go.stmpl +++ b/templates/templates/cli/usage.go.stmpl @@ -15,12 +15,15 @@ type usageItem struct { text string settings bool hidden bool + short string + value bool + repeat bool } type usageNode struct { head string aliases []usageItem - args []string + args []usageItem flags []usageItem children []string } @@ -164,7 +167,9 @@ func staticUsageBody(node usageNode, own bool) []string { for _, alias := range node.aliases { body = append(body, alias.text) } - body = append(body, node.args...) + for _, arg := range node.args { + body = append(body, arg.text) + } for _, flag := range node.flags { if own || !flag.settings { body = append(body, flag.text) @@ -188,8 +193,10 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string body = append(body, prefix+"alias "+kdlQuote(alias)) } } - if len(node.args) > 0 { - body = append(body, node.args...) + if usageArgsUnchanged(node.args, usagePromptArgs(cmd)) { + for _, arg := range node.args { + body = append(body, arg.text) + } } else { body = append(body, liveUsageArgs(cmd, prefix)...) } @@ -197,7 +204,13 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string for _, flag := range node.flags { listed[flag.key] = true f := cmd.Flags().Lookup(flag.key) - if f != nil && (own || !flag.settings) && (flag.hidden || !f.Hidden) { + switch { + case f == nil || (!own && flag.settings): + case !usageFlagUnchanged(flag, f): + if !f.Hidden { + body = append(body, liveUsageFlag(f, prefix)) + } + case flag.hidden || !f.Hidden: body = append(body, flag.text) } } @@ -343,19 +356,45 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func liveUsageArgs(cmd *cobra.Command, prefix string) []string { +func usageFlagUnchanged(item usageItem, f *pflag.Flag) bool { + _, repeat := f.Value.(pflag.SliceValue) + return f.Shorthand == item.short && (f.NoOptDefVal == "") == item.value && repeat == item.repeat +} + +func usageArgsUnchanged(generated []usageItem, live []usagePromptArg) bool { + if len(generated) == 0 || len(generated) != len(live) { + return false + } + for i, arg := range generated { + if arg.key != live[i].Name { + return false + } + } + return true +} + +type usagePromptArg struct { + Name string `json:"name"` + Summary string `json:"summary"` + Required bool `json:"required"` + Variadic bool `json:"variadic"` +} + +func usagePromptArgs(cmd *cobra.Command) []usagePromptArg { var promptArgs struct { - Version int `json:"version"` - Args []struct { - Name string `json:"name"` - Summary string `json:"summary"` - Required bool `json:"required"` - Variadic bool `json:"variadic"` - } `json:"args"` - } - if raw := cmd.Annotations["speakeasy_prompt_args"]; raw != "" && json.Unmarshal([]byte(raw), &promptArgs) == nil && promptArgs.Version == 1 { + Version int `json:"version"` + Args []usagePromptArg `json:"args"` + } + if raw := cmd.Annotations["speakeasy_prompt_args"]; raw == "" || json.Unmarshal([]byte(raw), &promptArgs) != nil || promptArgs.Version != 1 { + return nil + } + return promptArgs.Args +} + +func liveUsageArgs(cmd *cobra.Command, prefix string) []string { + if promptArgs := usagePromptArgs(cmd); promptArgs != nil { var lines []string - for _, arg := range promptArgs.Args { + for _, arg := range promptArgs { line := prefix + "arg " + kdlQuote(arg.Name) if arg.Summary != "" { line += " help=" + kdlQuoteAt(arg.Summary, prefix+" ") diff --git a/templates/templates/cli/usage_test.go.stmpl b/templates/templates/cli/usage_test.go.stmpl index bab1db2f8..bae9aabc0 100644 --- a/templates/templates/cli/usage_test.go.stmpl +++ b/templates/templates/cli/usage_test.go.stmpl @@ -279,7 +279,10 @@ func TestUsageSchema_DynamicRoot(t *testing.T) { root.PersistentFlags().String("runtime-root", "", "Runtime root flag") var after strings.Builder require.NoError(t, usage.EmitSchema(root, &after)) - assert.Contains(t, after.String(), "\nflag \"--runtime-root \" help=\"Runtime root flag\"\n") + children := strings.Index(before.String(), "\ncmd \"") + 1 + require.Positive(t, children) + want := before.String()[:children] + "flag \"--runtime-root \" help=\"Runtime root flag\"\n" + before.String()[children:] + assert.Equal(t, want, after.String()) } func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { @@ -294,6 +297,27 @@ func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { assert.NotContains(t, out.String(), "\ncmd \"version\"") } +func TestUsageSchema_ReplacedCommandDropsStaleFlagSyntax(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + original, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + root.RemoveCommand(original) + replacement := &cobra.Command{Use: "configure", Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} + replacement.Flags().BoolP("default-output-format", "x", false, "New switch") + root.AddCommand(replacement) + usage.MarkDynamic(replacement) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\ncmd \"configure\" help=\"Replacement\" {\n flag \"-x --default-output-format\" help=\"New switch\"\n}\n") + + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + assert.Contains(t, own.String(), "\n flag \"-x --default-output-format\" help=\"New switch\"\n") + assert.NotContains(t, own.String(), "") +} + func TestUsageSchema_DetachedCommand(t *testing.T) { leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder @@ -398,6 +422,23 @@ func TestUsageSchema_IntentCommandWithArgs(t *testing.T) { assert.Contains(t, stdout, "arg \"") assert.Empty(t, stderr) } + +func TestUsageSchema_ReplacedIntentDropsStaleArgs(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + original, _, err := root.Find([]string{ {{templateIntentUsagePathArgs}} }) + require.NoError(t, err) + parent := original.Parent() + parent.RemoveCommand(original) + replacement := &cobra.Command{Use: original.Name(), Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} + parent.AddCommand(replacement) + usage.MarkDynamic(replacement) + + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + assert.Contains(t, own.String(), "cmd \"{{templateIntentUsageCmdName}}\" help=\"Replacement\"") + assert.NotContains(t, own.String(), "arg \"") +} {{- end }} {{- if templateIntentUsageSchemaPrecedenceTestEnabled }} diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index 9b622ce06..79d7144bb 100644 --- a/zSDKs/sdk-cli/.speakeasy/gen.lock +++ b/zSDKs/sdk-cli/.speakeasy/gen.lock @@ -658,7 +658,7 @@ trackedFiles: internal/usage/bodyschemas.go: last_write_checksum: sha1:775249b69ed405ad072c16a76fe6113f375b3818 internal/usage/schema.go: - last_write_checksum: sha1:0dbaf69123e8735de634cb95e1a69d43783720b3 + last_write_checksum: sha1:cb279236c8c214450e2fcec42d9dd8ee1841635b scripts/install.ps1: last_write_checksum: sha1:9dcf40ea00ecb8ceda83d5056f57235b43cf658a scripts/install.sh: @@ -1120,7 +1120,7 @@ trackedFiles: tests/types_test.go: last_write_checksum: sha1:5ce31f08a3214779ed561d0f37279eb4d5202723 tests/usage_test.go: - last_write_checksum: sha1:d0e1e37c3f17a2e4f83452c610d71e6882021adc + last_write_checksum: sha1:75b062ffa2a66f3991219263cccadb9387c59d20 examples: _operation_with_leading_and_trailing_underscores_: speakeasy-default-operation-with-leading-and-trailing-underscores: diff --git a/zSDKs/sdk-cli/internal/usage/schema.go b/zSDKs/sdk-cli/internal/usage/schema.go index c876d2c2f..e0af23663 100644 --- a/zSDKs/sdk-cli/internal/usage/schema.go +++ b/zSDKs/sdk-cli/internal/usage/schema.go @@ -17,61 +17,64 @@ type usageItem struct { text string settings bool hidden bool + short string + value bool + repeat bool } type usageNode struct { head string aliases []usageItem - args []string + args []usageItem flags []usageItem children []string } var usageNodes = map[string]usageNode{ - "": {head: "name \"cli\"\nbin \"cli\"\nabout \"\"\"\n This document will show case as many of our features as possible in as little operations/models as possible.\n This will then generate a SDK that we can more easily review than the test SDKs based on uber.yaml spec.\n \"\"\"\nversion \"0.0.1\"\nconfig {\n file \"~/.config/cli/config.yaml\"\n}", flags: []usageItem{{key: "usage", text: "flag \"--usage\" help=\"Print the CLI Usage schema in KDL format\" global=#true"}, {key: "version", text: "flag \"-v --version\" help=\"Print the CLI version\""}, {key: "output-format", text: "flag \"-o --output-format \" help=\"Specify the output format. Options: pretty, json, yaml, table, toon.\" global=#true config=\"output_format\" default=\"pretty\""}, {key: "color", text: "flag \"--color \" help=\"Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars.\" global=#true default=\"auto\""}, {key: "jq", text: "flag \"-q --jq \" help=\"Filter and transform output using a jq expression (e.g., '.name', '.items[] | .id')\" global=#true"}, {key: "raw-output", text: "flag \"--raw-output\" help=\"Write --jq string results as raw text instead of JSON strings (like jq -r); non-string results stay JSON\" global=#true default=#false"}, {key: "server-url", text: "flag \"--server-url \" help=\"Override the default server URL\" global=#true"}, {key: "server", text: "flag \"--server \" help=\"Select a server by index (for indexed servers) or name (for named servers)\" global=#true"}, {key: "header", text: "flag \"-H --header \" help=\"Set a custom HTTP request header (format: \\\"Key: Value\\\"). Can be specified multiple times.\" global=#true var=#true"}, {key: "include-headers", text: "flag \"--include-headers\" help=\"Include HTTP response headers in the output\" global=#true default=#false"}, {key: "timeout", text: "flag \"--timeout \" help=\"HTTP request timeout (e.g., 30s, 5m, 100ms)\" global=#true config=\"timeout\""}, {key: "interactive", text: "flag \"--interactive\" help=\"Prompt for missing inputs and open guided configure/auth forms (forms fall back to line prompts on stdin off-TTY)\" global=#true default=#false"}, {key: "no-interactive", text: "flag \"--no-interactive\" help=\"Disable all interactive features (auto-prompting, explorer auto-launch, TUI forms)\" global=#true default=#false"}, {key: "dry-run", text: "flag \"--dry-run\" help=\"Preview API requests without sending them (no network, no OS keychain). Human preview on stderr; with -o json or --jq, one JSON object per request on stdout. Local mutation commands (auth login, auth logout and configure) make no request: they skip prompts and writes and report a no-op (stderr, or one JSON object on stdout in the machine form)\" global=#true default=#false"}, {key: "debug", text: "flag \"-d --debug\" help=\"Log request and response diagnostics to stderr\" global=#true default=#false"}, {key: "agent-mode", text: "flag \"--agent-mode\" help=\"Enable structured errors and default TOON output for AI coding agents.\" global=#true default=#false"}, {key: "no-retries", text: "flag \"--no-retries\" help=\"Disable automatic retries (default: retries enabled with exponential backoff)\" global=#true config=\"no_retries\" default=#false"}, {key: "retry-max-elapsed-time", text: "flag \"--retry-max-elapsed-time \" help=\"Maximum total time for retries (e.g., 30s, 5m). Default: 30s\" global=#true config=\"retry_max_elapsed_time\""}, {key: "retry-connection-errors", text: "flag \"--retry-connection-errors\" help=\"Retry on connection errors (EOF, reset, etc.)\" global=#true config=\"retry_connection_errors\" default=#false"}, {key: "retry-config", text: "flag \"--retry-config \" help=\"Full retry config as JSON. Schema: {\\\"strategy\\\":\\\"backoff\\\",\\\"backoff\\\":{\\\"initialInterval\\\":500,\\\"maxInterval\\\":10000,\\\"exponent\\\":1.5,\\\"maxElapsedTime\\\":30000},\\\"retryConnectionErrors\\\":false}. Times are in milliseconds.\" global=#true config=\"retry_config\""}, {key: "subdomain", text: "flag \"--subdomain \" help=\"Server template variable: subdomain\" global=#true"}, {key: "version-param", text: "flag \"--version-param \" help=\"Server template variable: version\" global=#true"}, {key: "host-name", text: "flag \"--host-name \" help=\"Server template variable: HostName\" global=#true"}, {key: "port", text: "flag \"--port \" help=\"Server template variable: PORT\" global=#true"}, {key: "username", text: "flag \"--username \" help=\"HTTP Basic username\" global=#true env=\"CLI_USERNAME\" config=\"security.username\""}, {key: "password", text: "flag \"--password \" help=\"HTTP Basic password\" global=#true env=\"CLI_PASSWORD\" config=\"security.password\""}, {key: "bearer-auth", text: "flag \"--bearer-auth \" help=\"HTTP Bearer\" global=#true env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\""}, {key: "my-api-key", text: "flag \"--my-api-key \" help=\"API Key\" global=#true env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\""}, {key: "oauth2", text: "flag \"--oauth2 \" help=\"OAuth2 Authorization\" global=#true env=\"CLI_OAUTH2\" config=\"security.oauth2\""}, {key: "app-id", text: "flag \"--app-id \" help=\"Custom authentication credential\" global=#true env=\"CLI_APP_ID\" config=\"security.app_id\""}, {key: "secret", text: "flag \"--secret \" help=\"Custom authentication credential\" global=#true env=\"CLI_SECRET\" config=\"security.secret\""}, {key: "mobile-auth", text: "flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" global=#true env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\""}, {key: "client-id", text: "flag \"--client-id \" help=\"Client Credentials flow. client identifier\" global=#true env=\"CLI_CLIENT_ID\" config=\"security.client_id\""}, {key: "client-secret", text: "flag \"--client-secret \" help=\"Client Credentials flow. client secret\" global=#true env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\""}, {key: "token-url", text: "flag \"--token-url \" help=\"Client Credentials flow. token URL\" global=#true env=\"CLI_TOKEN_URL\" config=\"security.token_url\""}, {key: "no-keyring", text: "flag \"--no-keyring\" help=\"Never read or write the OS keychain; store secrets in the config file instead\" global=#true env=\"CLI_NO_KEYRING\" config=\"no_keyring\" default=#false"}, {key: "query-param1", text: "flag \"--query-param1 \" help=\"A long winded, multi-line description\" global=#true env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\""}, {key: "deprecated-query-param1", text: "flag \"--deprecated-query-param1 \" help=\"A deprecated description\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\""}, {key: "deprecated-query-param2", text: "flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\""}, {key: "lone-query-param", text: "flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" global=#true env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\""}}, children: []string{"invite", "enroll", "render", "produce", "observe", "say", "archive", "test-group", "hello", "auth", "binary-and-string-upload", "chat", "completion", "configure", "create-user", "create-with-union", "delete-user", "explore", "get-asset", "get-binary-default-response", "get-duplicate-export-collision", "get-empty-object-error", "get-error-in-union", "get-error-only-example", "get-fully-flattened-request", "get-named-primitive-union", "get-nested-integer-string", "get-polymorphism", "get-positional-default", "get-request-body-flattened-away", "get-union-errors", "get-user", "group", "help", "login", "namespace-tests", "obsolete", "operation-with-leading-and-trailing-underscores", "parentheses-in-path-allowed", "post-file", "render-asset", "stream-metadata", "tag1", "test-endpoint", "test-enum-formats", "update-user", "url-validation-stress-test", "validate", "version", "whoami"}}, - "invite": {head: "cmd \"invite\" help=\"Invite a user by email\"", args: []string{" arg \"email\" help=\"Email address to invite\" required=#true var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "given-name", text: " flag \"--given-name \" help=\"First name to record\""}, {key: "user-gender", text: " flag \"--user-gender \" help=\"Gender to record (e.g. male, female, other)\" {\n suggestions \"male\" \"female\" \"other\"\n }"}}}, - "enroll": {head: "cmd \"enroll\" help=\"Enroll a user by email\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "enrollment-email", text: " flag \"--enrollment-email \" help=\"Email address to enroll\""}}}, - "render": {head: "cmd \"render\" help=\"Render an image asset to a file\"", args: []string{" arg \"prompt\" help=\"Text prompt to render\" required=#true var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./render-{timestamp}-{rand}.{ext}\""}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}}}, - "produce": {head: "cmd \"produce\" help=\"Produce an image asset and wait for completion\"", args: []string{" arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./produce-{timestamp}-{rand}.{ext}\""}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\""}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\""}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\""}}}, - "observe": {head: "cmd \"observe\" help=\"Produce an asset and print its terminal status\"", args: []string{" arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\""}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\""}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\""}}}, - "say": {head: "cmd \"say\" help=\"Stream a chat reply\"", args: []string{" arg \"prompt\" help=\"Prompt to send\" required=#true var=#true"}, flags: []usageItem{{key: "request", text: " flag \"--request \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive (default: true)\" default=#true"}}}, + "": {head: "name \"cli\"\nbin \"cli\"\nabout \"\"\"\n This document will show case as many of our features as possible in as little operations/models as possible.\n This will then generate a SDK that we can more easily review than the test SDKs based on uber.yaml spec.\n \"\"\"\nversion \"0.0.1\"\nconfig {\n file \"~/.config/cli/config.yaml\"\n}", flags: []usageItem{{key: "usage", text: "flag \"--usage\" help=\"Print the CLI Usage schema in KDL format\" global=#true"}, {key: "version", text: "flag \"-v --version\" help=\"Print the CLI version\"", short: "v"}, {key: "output-format", text: "flag \"-o --output-format \" help=\"Specify the output format. Options: pretty, json, yaml, table, toon.\" global=#true config=\"output_format\" default=\"pretty\"", short: "o", value: true}, {key: "color", text: "flag \"--color \" help=\"Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars.\" global=#true default=\"auto\"", value: true}, {key: "jq", text: "flag \"-q --jq \" help=\"Filter and transform output using a jq expression (e.g., '.name', '.items[] | .id')\" global=#true", short: "q", value: true}, {key: "raw-output", text: "flag \"--raw-output\" help=\"Write --jq string results as raw text instead of JSON strings (like jq -r); non-string results stay JSON\" global=#true default=#false"}, {key: "server-url", text: "flag \"--server-url \" help=\"Override the default server URL\" global=#true", value: true}, {key: "server", text: "flag \"--server \" help=\"Select a server by index (for indexed servers) or name (for named servers)\" global=#true", value: true}, {key: "header", text: "flag \"-H --header \" help=\"Set a custom HTTP request header (format: \\\"Key: Value\\\"). Can be specified multiple times.\" global=#true var=#true", short: "H", value: true, repeat: true}, {key: "include-headers", text: "flag \"--include-headers\" help=\"Include HTTP response headers in the output\" global=#true default=#false"}, {key: "timeout", text: "flag \"--timeout \" help=\"HTTP request timeout (e.g., 30s, 5m, 100ms)\" global=#true config=\"timeout\"", value: true}, {key: "interactive", text: "flag \"--interactive\" help=\"Prompt for missing inputs and open guided configure/auth forms (forms fall back to line prompts on stdin off-TTY)\" global=#true default=#false"}, {key: "no-interactive", text: "flag \"--no-interactive\" help=\"Disable all interactive features (auto-prompting, explorer auto-launch, TUI forms)\" global=#true default=#false"}, {key: "dry-run", text: "flag \"--dry-run\" help=\"Preview API requests without sending them (no network, no OS keychain). Human preview on stderr; with -o json or --jq, one JSON object per request on stdout. Local mutation commands (auth login, auth logout and configure) make no request: they skip prompts and writes and report a no-op (stderr, or one JSON object on stdout in the machine form)\" global=#true default=#false"}, {key: "debug", text: "flag \"-d --debug\" help=\"Log request and response diagnostics to stderr\" global=#true default=#false", short: "d"}, {key: "agent-mode", text: "flag \"--agent-mode\" help=\"Enable structured errors and default TOON output for AI coding agents.\" global=#true default=#false"}, {key: "no-retries", text: "flag \"--no-retries\" help=\"Disable automatic retries (default: retries enabled with exponential backoff)\" global=#true config=\"no_retries\" default=#false"}, {key: "retry-max-elapsed-time", text: "flag \"--retry-max-elapsed-time \" help=\"Maximum total time for retries (e.g., 30s, 5m). Default: 30s\" global=#true config=\"retry_max_elapsed_time\"", value: true}, {key: "retry-connection-errors", text: "flag \"--retry-connection-errors\" help=\"Retry on connection errors (EOF, reset, etc.)\" global=#true config=\"retry_connection_errors\" default=#false"}, {key: "retry-config", text: "flag \"--retry-config \" help=\"Full retry config as JSON. Schema: {\\\"strategy\\\":\\\"backoff\\\",\\\"backoff\\\":{\\\"initialInterval\\\":500,\\\"maxInterval\\\":10000,\\\"exponent\\\":1.5,\\\"maxElapsedTime\\\":30000},\\\"retryConnectionErrors\\\":false}. Times are in milliseconds.\" global=#true config=\"retry_config\"", value: true}, {key: "subdomain", text: "flag \"--subdomain \" help=\"Server template variable: subdomain\" global=#true", value: true}, {key: "version-param", text: "flag \"--version-param \" help=\"Server template variable: version\" global=#true", value: true}, {key: "host-name", text: "flag \"--host-name \" help=\"Server template variable: HostName\" global=#true", value: true}, {key: "port", text: "flag \"--port \" help=\"Server template variable: PORT\" global=#true", value: true}, {key: "username", text: "flag \"--username \" help=\"HTTP Basic username\" global=#true env=\"CLI_USERNAME\" config=\"security.username\"", value: true}, {key: "password", text: "flag \"--password \" help=\"HTTP Basic password\" global=#true env=\"CLI_PASSWORD\" config=\"security.password\"", value: true}, {key: "bearer-auth", text: "flag \"--bearer-auth \" help=\"HTTP Bearer\" global=#true env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", value: true}, {key: "my-api-key", text: "flag \"--my-api-key \" help=\"API Key\" global=#true env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", value: true}, {key: "oauth2", text: "flag \"--oauth2 \" help=\"OAuth2 Authorization\" global=#true env=\"CLI_OAUTH2\" config=\"security.oauth2\"", value: true}, {key: "app-id", text: "flag \"--app-id \" help=\"Custom authentication credential\" global=#true env=\"CLI_APP_ID\" config=\"security.app_id\"", value: true}, {key: "secret", text: "flag \"--secret \" help=\"Custom authentication credential\" global=#true env=\"CLI_SECRET\" config=\"security.secret\"", value: true}, {key: "mobile-auth", text: "flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" global=#true env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", value: true}, {key: "client-id", text: "flag \"--client-id \" help=\"Client Credentials flow. client identifier\" global=#true env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", value: true}, {key: "client-secret", text: "flag \"--client-secret \" help=\"Client Credentials flow. client secret\" global=#true env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", value: true}, {key: "token-url", text: "flag \"--token-url \" help=\"Client Credentials flow. token URL\" global=#true env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", value: true}, {key: "no-keyring", text: "flag \"--no-keyring\" help=\"Never read or write the OS keychain; store secrets in the config file instead\" global=#true env=\"CLI_NO_KEYRING\" config=\"no_keyring\" default=#false"}, {key: "query-param1", text: "flag \"--query-param1 \" help=\"A long winded, multi-line description\" global=#true env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"", value: true}, {key: "deprecated-query-param1", text: "flag \"--deprecated-query-param1 \" help=\"A deprecated description\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"", value: true}, {key: "deprecated-query-param2", text: "flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"", value: true}, {key: "lone-query-param", text: "flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" global=#true env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"", value: true}}, children: []string{"invite", "enroll", "render", "produce", "observe", "say", "archive", "test-group", "hello", "auth", "binary-and-string-upload", "chat", "completion", "configure", "create-user", "create-with-union", "delete-user", "explore", "get-asset", "get-binary-default-response", "get-duplicate-export-collision", "get-empty-object-error", "get-error-in-union", "get-error-only-example", "get-fully-flattened-request", "get-named-primitive-union", "get-nested-integer-string", "get-polymorphism", "get-positional-default", "get-request-body-flattened-away", "get-union-errors", "get-user", "group", "help", "login", "namespace-tests", "obsolete", "operation-with-leading-and-trailing-underscores", "parentheses-in-path-allowed", "post-file", "render-asset", "stream-metadata", "tag1", "test-endpoint", "test-enum-formats", "update-user", "url-validation-stress-test", "validate", "version", "whoami"}}, + "invite": {head: "cmd \"invite\" help=\"Invite a user by email\"", args: []usageItem{{key: "email", text: " arg \"email\" help=\"Email address to invite\" required=#true var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "given-name", text: " flag \"--given-name \" help=\"First name to record\"", value: true}, {key: "user-gender", text: " flag \"--user-gender \" help=\"Gender to record (e.g. male, female, other)\" {\n suggestions \"male\" \"female\" \"other\"\n }", value: true}}}, + "enroll": {head: "cmd \"enroll\" help=\"Enroll a user by email\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "enrollment-email", text: " flag \"--enrollment-email \" help=\"Email address to enroll\"", value: true}}}, + "render": {head: "cmd \"render\" help=\"Render an image asset to a file\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render\" required=#true var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./render-{timestamp}-{rand}.{ext}\"", value: true}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}}}, + "produce": {head: "cmd \"produce\" help=\"Produce an image asset and wait for completion\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./produce-{timestamp}-{rand}.{ext}\"", value: true}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"", value: true}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"", value: true}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"", value: true}}}, + "observe": {head: "cmd \"observe\" help=\"Produce an asset and print its terminal status\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"", value: true}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"", value: true}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"", value: true}}}, + "say": {head: "cmd \"say\" help=\"Stream a chat reply\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Prompt to send\" required=#true var=#true"}}, flags: []usageItem{{key: "request", text: " flag \"--request \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive (default: true)\" default=#true"}}}, "archive": {head: "cmd \"archive\" help=\"Archive a user account\""}, "test-group": {head: "cmd \"test-group\" help=\"Operations for test-group\"", aliases: []usageItem{{key: "tg", text: " alias \"tg\""}}, children: []string{"tag2", "tag3"}}, "test-group tag2": {head: "cmd \"tag2\" help=\"Operations for tag2\"", children: []string{"post-test"}}, - "test-group tag2 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\""}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "test-group tag2 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"", value: true}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\"", short: "t", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, "test-group tag3": {head: "cmd \"tag3\" help=\"Operations for tag3\"", children: []string{"post-test"}}, - "test-group tag3 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\""}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "test-group tag3 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"", value: true}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\"", short: "t", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, "hello": {head: "cmd \"hello\" help=\"Hand-written command that survives regeneration\""}, "auth": {head: "cmd \"auth\" help=\"Manage authentication credentials\"", children: []string{"login", "logout", "whoami"}}, - "auth login": {head: "cmd \"login\" help=\"Interactively configure authentication credentials\"", flags: []usageItem{{key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true}}}, + "auth login": {head: "cmd \"login\" help=\"Interactively configure authentication credentials\"", flags: []usageItem{{key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true, value: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true, value: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true, value: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true, value: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true, value: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true, value: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true, value: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true, value: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true, value: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true, value: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true, value: true}}}, "auth logout": {head: "cmd \"logout\" help=\"Clear all stored authentication credentials\""}, "auth whoami": {head: "cmd \"whoami\" help=\"Display current authentication and global parameter configuration\""}, - "binary-and-string-upload": {head: "cmd \"binary-and-string-upload\" help=\"Binary And String Upload\"", aliases: []usageItem{{key: "basu", text: " alias \"basu\""}}, flags: []usageItem{{key: "binary", text: " flag \"-b --binary \" help=\"binary data (file: or b64:)\""}, {key: "string", text: " flag \"-s --string \" help=\"string value\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "chat": {head: "cmd \"chat\" help=\"Chat\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive\" default=#true"}, {key: "max-tokens", text: " flag \"--max-tokens \" help=\"Maximum number of tokens to generate\""}, {key: "temperature", text: " flag \"--temperature \" help=\"Sampling temperature\""}}}, + "binary-and-string-upload": {head: "cmd \"binary-and-string-upload\" help=\"Binary And String Upload\"", aliases: []usageItem{{key: "basu", text: " alias \"basu\""}}, flags: []usageItem{{key: "binary", text: " flag \"-b --binary \" help=\"binary data (file: or b64:)\"", short: "b", value: true}, {key: "string", text: " flag \"-s --string \" help=\"string value\"", short: "s", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "chat": {head: "cmd \"chat\" help=\"Chat\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive\" default=#true"}, {key: "max-tokens", text: " flag \"--max-tokens \" help=\"Maximum number of tokens to generate\"", value: true}, {key: "temperature", text: " flag \"--temperature \" help=\"Sampling temperature\"", value: true}}}, "completion": {head: "cmd \"completion\" help=\"Generate the autocompletion script for the specified shell\"", children: []string{"bash", "fish", "powershell", "zsh"}}, "completion bash": {head: "cmd \"bash\" help=\"Generate the autocompletion script for bash\""}, "completion fish": {head: "cmd \"fish\" help=\"Generate the autocompletion script for fish\""}, "completion powershell": {head: "cmd \"powershell\" help=\"Generate the autocompletion script for powershell\""}, "completion zsh": {head: "cmd \"zsh\" help=\"Generate the autocompletion script for zsh\""}, - "configure": {head: "cmd \"configure\" help=\"Configure authentication, global parameters, and preferences\"", flags: []usageItem{{key: "default-output-format", text: " flag \"--default-output-format \" help=\"Store the default output format without opening the form. Options: pretty, json, yaml, table, toon. Pass an empty value to clear it.\" {\n suggestions \"pretty\" \"json\" \"yaml\" \"table\" \"toon\"\n }"}, {key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true}, {key: "query-param1", text: " flag \"--query-param1 \" help=\"A long winded, multi-line description\" env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"", settings: true}, {key: "deprecated-query-param1", text: " flag \"--deprecated-query-param1 \" help=\"A deprecated description\" env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"", settings: true}, {key: "deprecated-query-param2", text: " flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"", settings: true}, {key: "lone-query-param", text: " flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"", settings: true}}}, - "create-user": {head: "cmd \"create-user\" help=\"Create User\"", aliases: []usageItem{{key: "cu", text: " alias \"cu\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value\""}, {key: "email", text: " flag \"-e --email \" help=\"[required]\""}, {key: "first-name", text: " flag \"-f --first-name \" help=\"string value\""}, {key: "last-name", text: " flag \"-l --last-name \" help=\"string value\""}, {key: "age", text: " flag \"--age \" help=\"number value\""}, {key: "postal-code", text: " flag \"-p --postal-code \" help=\"string value\""}, {key: "gender", text: " flag \"-g --gender \" help=\"options: male, female, other\""}, {key: "associated-ids", text: " flag \"--associated-ids \" help=\"list of values\" var=#true"}, {key: "metadata", text: " flag \"--metadata \" help=\"JSON object\""}, {key: "metadata-any", text: " flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "create-with-union": {head: "cmd \"create-with-union\" help=\"Create with discriminated union request body\"", aliases: []usageItem{{key: "cwu", text: " alias \"cwu\""}}, flags: []usageItem{{key: "dry-run-param", text: " flag \"--dry-run-param\" help=\"If true, validates without creating\""}, {key: "name", text: " flag \"-n --name \" help=\"Name for the shape [required]\""}, {key: "shape", text: " flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\""}, {key: "shape.circle", text: " flag \"--shape.circle \" help=\"Circle variant as JSON\""}, {key: "shape.circle.radius", text: " flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\""}, {key: "shape.circle.color-param", text: " flag \"--shape.circle.color-param \" help=\"Optional color of the circle\""}, {key: "shape.rectangle", text: " flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\""}, {key: "shape.rectangle.width", text: " flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\""}, {key: "shape.rectangle.height", text: " flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\""}, {key: "shape.rectangle.color-param", text: " flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\""}, {key: "description", text: " flag \"--description \" help=\"Optional description\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "delete-user": {head: "cmd \"delete-user\" help=\"Delete User\"", aliases: []usageItem{{key: "du", text: " alias \"du\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}}}, + "configure": {head: "cmd \"configure\" help=\"Configure authentication, global parameters, and preferences\"", flags: []usageItem{{key: "default-output-format", text: " flag \"--default-output-format \" help=\"Store the default output format without opening the form. Options: pretty, json, yaml, table, toon. Pass an empty value to clear it.\" {\n suggestions \"pretty\" \"json\" \"yaml\" \"table\" \"toon\"\n }", value: true}, {key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true, value: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true, value: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true, value: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true, value: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true, value: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true, value: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true, value: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true, value: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true, value: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true, value: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true, value: true}, {key: "query-param1", text: " flag \"--query-param1 \" help=\"A long winded, multi-line description\" env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"", settings: true, value: true}, {key: "deprecated-query-param1", text: " flag \"--deprecated-query-param1 \" help=\"A deprecated description\" env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"", settings: true, value: true}, {key: "deprecated-query-param2", text: " flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"", settings: true, value: true}, {key: "lone-query-param", text: " flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"", settings: true, value: true}}}, + "create-user": {head: "cmd \"create-user\" help=\"Create User\"", aliases: []usageItem{{key: "cu", text: " alias \"cu\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value\"", short: "i", value: true}, {key: "email", text: " flag \"-e --email \" help=\"[required]\"", short: "e", value: true}, {key: "first-name", text: " flag \"-f --first-name \" help=\"string value\"", short: "f", value: true}, {key: "last-name", text: " flag \"-l --last-name \" help=\"string value\"", short: "l", value: true}, {key: "age", text: " flag \"--age \" help=\"number value\"", value: true}, {key: "postal-code", text: " flag \"-p --postal-code \" help=\"string value\"", short: "p", value: true}, {key: "gender", text: " flag \"-g --gender \" help=\"options: male, female, other\"", short: "g", value: true}, {key: "associated-ids", text: " flag \"--associated-ids \" help=\"list of values\" var=#true", value: true, repeat: true}, {key: "metadata", text: " flag \"--metadata \" help=\"JSON object\"", value: true}, {key: "metadata-any", text: " flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "create-with-union": {head: "cmd \"create-with-union\" help=\"Create with discriminated union request body\"", aliases: []usageItem{{key: "cwu", text: " alias \"cwu\""}}, flags: []usageItem{{key: "dry-run-param", text: " flag \"--dry-run-param\" help=\"If true, validates without creating\""}, {key: "name", text: " flag \"-n --name \" help=\"Name for the shape [required]\"", short: "n", value: true}, {key: "shape", text: " flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\"", short: "s", value: true}, {key: "shape.circle", text: " flag \"--shape.circle \" help=\"Circle variant as JSON\"", value: true}, {key: "shape.circle.radius", text: " flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\"", value: true}, {key: "shape.circle.color-param", text: " flag \"--shape.circle.color-param \" help=\"Optional color of the circle\"", value: true}, {key: "shape.rectangle", text: " flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\"", value: true}, {key: "shape.rectangle.width", text: " flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\"", value: true}, {key: "shape.rectangle.height", text: " flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\"", value: true}, {key: "shape.rectangle.color-param", text: " flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\"", value: true}, {key: "description", text: " flag \"--description \" help=\"Optional description\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "delete-user": {head: "cmd \"delete-user\" help=\"Delete User\"", aliases: []usageItem{{key: "du", text: " alias \"du\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}}}, "explore": {head: "cmd \"explore\" help=\"Interactively browse and run commands\""}, - "get-asset": {head: "cmd \"get-asset\" help=\"Get Asset\"", aliases: []usageItem{{key: "ga", text: " alias \"ga\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "stream", text: " flag \"-s --stream\" help=\"boolean flag\" default=#true"}}}, - "get-binary-default-response": {head: "cmd \"get-binary-default-response\" help=\"Get Binary Default Response\"", aliases: []usageItem{{key: "gbdr", text: " alias \"gbdr\""}}, flags: []usageItem{{key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "get-asset": {head: "cmd \"get-asset\" help=\"Get Asset\"", aliases: []usageItem{{key: "ga", text: " alias \"ga\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\"", short: "i", value: true}, {key: "stream", text: " flag \"-s --stream\" help=\"boolean flag\" default=#true", short: "s"}}}, + "get-binary-default-response": {head: "cmd \"get-binary-default-response\" help=\"Get Binary Default Response\"", aliases: []usageItem{{key: "gbdr", text: " alias \"gbdr\""}}, flags: []usageItem{{key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, "get-duplicate-export-collision": {head: "cmd \"get-duplicate-export-collision\" help=\"Tests that a spec-defined error type colliding with a built-in SDK error name does not cause TS2308\"", aliases: []usageItem{{key: "gdec", text: " alias \"gdec\""}}}, "get-empty-object-error": {head: "cmd \"get-empty-object-error\" help=\"Get Empty Object Error\"", aliases: []usageItem{{key: "geoe", text: " alias \"geoe\""}}}, "get-error-in-union": {head: "cmd \"get-error-in-union\" help=\"Get Error In Union\"", aliases: []usageItem{{key: "geiu", text: " alias \"geiu\""}}}, "get-error-only-example": {head: "cmd \"get-error-only-example\" help=\"Operation with example only on error response\"", aliases: []usageItem{{key: "geoex", text: " alias \"geoex\""}}}, - "get-fully-flattened-request": {head: "cmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\"", aliases: []usageItem{{key: "gffr", text: " alias \"gffr\""}}, flags: []usageItem{{key: "lang", text: " flag \"-l --lang \" help=\"[required]\""}, {key: "max-length", text: " flag \"-m --max-length \" help=\"integer value\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "emoji", text: " flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\""}, {key: "gif", text: " flag \"-g --gif \" help=\"string value\""}, {key: "reply", text: " flag \"-r --reply\" help=\"boolean flag\""}, {key: "private", text: " flag \"-p --private\" help=\"boolean flag\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "get-fully-flattened-request": {head: "cmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\"", aliases: []usageItem{{key: "gffr", text: " alias \"gffr\""}}, flags: []usageItem{{key: "lang", text: " flag \"-l --lang \" help=\"[required]\"", short: "l", value: true}, {key: "max-length", text: " flag \"-m --max-length \" help=\"integer value\"", short: "m", value: true}, {key: "name", text: " flag \"-n --name \" help=\"[required]\"", short: "n", value: true}, {key: "emoji", text: " flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\"", short: "e", value: true}, {key: "gif", text: " flag \"-g --gif \" help=\"string value\"", short: "g", value: true}, {key: "reply", text: " flag \"-r --reply\" help=\"boolean flag\"", short: "r"}, {key: "private", text: " flag \"-p --private\" help=\"boolean flag\"", short: "p"}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "get-named-primitive-union": {head: "cmd \"get-named-primitive-union\" help=\"Test named primitive union options using title and x-speakeasy-name-override\"", aliases: []usageItem{{key: "gnpu", text: " alias \"gnpu\""}}}, "get-nested-integer-string": {head: "cmd \"get-nested-integer-string\" help=\"Test nested struct with integer:string tag\"", aliases: []usageItem{{key: "gnis", text: " alias \"gnis\""}}}, "get-polymorphism": {head: "cmd \"get-polymorphism\" help=\"Get Polymorphism\"", aliases: []usageItem{{key: "gp", text: " alias \"gp\""}}}, - "get-positional-default": {head: "cmd \"get-positional-default\" help=\"Get an item with a default path identifier\"", aliases: []usageItem{{key: "gpd", text: " alias \"gpd\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\""}}}, + "get-positional-default": {head: "cmd \"get-positional-default\" help=\"Get an item with a default path identifier\"", aliases: []usageItem{{key: "gpd", text: " alias \"gpd\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\"", short: "i", value: true}}}, "get-request-body-flattened-away": {head: "cmd \"get-request-body-flattened-away\" help=\"Get Request Body Flattened Away\"", aliases: []usageItem{{key: "grbfa", text: " alias \"grbfa\""}}}, - "get-union-errors": {head: "cmd \"get-union-errors\" help=\"Get Union Errors\"", aliases: []usageItem{{key: "gue", text: " alias \"gue\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\""}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\""}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0"}}}, - "get-user": {head: "cmd \"get-user\" help=\"Get User\"", aliases: []usageItem{{key: "gu", text: " alias \"gu\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}}}, + "get-union-errors": {head: "cmd \"get-union-errors\" help=\"Get Union Errors\"", aliases: []usageItem{{key: "gue", text: " alias \"gue\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\"", short: "p", value: true}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"", short: "a"}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0", value: true}}}, + "get-user": {head: "cmd \"get-user\" help=\"Get User\"", aliases: []usageItem{{key: "gu", text: " alias \"gu\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}}}, "group": {head: "cmd \"group\" help=\"Operations for group\"", children: []string{"root-group-op", "sub"}}, "group root-group-op": {head: "cmd \"root-group-op\" help=\"An operation at the group's root level\"", aliases: []usageItem{{key: "rgo", text: " alias \"rgo\""}}}, "group sub": {head: "cmd \"sub\" help=\"Operations for sub-group\"", children: []string{"empty", "op"}}, @@ -83,15 +86,15 @@ var usageNodes = map[string]usageNode{ "login": {head: "cmd \"login\" help=\"Login\""}, "namespace-tests": {head: "cmd \"namespace-tests\" help=\"Operations for namespace-tests\"", aliases: []usageItem{{key: "nt", text: " alias \"nt\""}}, children: []string{"conflicts", "single-bar", "single-foo", "types"}}, "namespace-tests conflicts": {head: "cmd \"conflicts\" help=\"Operations for conflicts\"", children: []string{"create-namespace", "get-namespace", "get-pet-owners", "get-triple-namespace", "put-namespace"}}, - "namespace-tests conflicts create-namespace": {head: "cmd \"create-namespace\" help=\"Create Namespace Conflict Test\"", aliases: []usageItem{{key: "cn", text: " alias \"cn\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\""}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\""}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\""}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\""}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\""}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests conflicts create-namespace": {head: "cmd \"create-namespace\" help=\"Create Namespace Conflict Test\"", aliases: []usageItem{{key: "cn", text: " alias \"cn\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\"", short: "i", value: true}, {key: "name", text: " flag \"-n --name \" help=\"[required]\"", short: "n", value: true}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"", short: "s", value: true}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\"", short: "m", value: true}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\"", short: "r", value: true}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\"", value: true}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\"", short: "e", value: true}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\"", short: "u", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "namespace-tests conflicts get-namespace": {head: "cmd \"get-namespace\" help=\"Get Namespace Conflict Test\"", aliases: []usageItem{{key: "gn", text: " alias \"gn\""}}}, "namespace-tests conflicts get-pet-owners": {head: "cmd \"get-pet-owners\" help=\"Get Pet Owners\"", aliases: []usageItem{{key: "gpo", text: " alias \"gpo\""}}}, "namespace-tests conflicts get-triple-namespace": {head: "cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\"", aliases: []usageItem{{key: "gtn", text: " alias \"gtn\""}}}, - "namespace-tests conflicts put-namespace": {head: "cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\"", aliases: []usageItem{{key: "pn", text: " alias \"pn\""}}, flags: []usageItem{{key: "direct", text: " flag \"--direct \" help=\"JSON object\""}, {key: "namespaced", text: " flag \"-n --namespaced \" help=\"JSON object\""}, {key: "overridden", text: " flag \"--overridden \" help=\"JSON object\""}, {key: "allof", text: " flag \"-a --allof \" help=\"JSON object\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests conflicts put-namespace": {head: "cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\"", aliases: []usageItem{{key: "pn", text: " alias \"pn\""}}, flags: []usageItem{{key: "direct", text: " flag \"--direct \" help=\"JSON object\"", value: true}, {key: "namespaced", text: " flag \"-n --namespaced \" help=\"JSON object\"", short: "n", value: true}, {key: "overridden", text: " flag \"--overridden \" help=\"JSON object\"", value: true}, {key: "allof", text: " flag \"-a --allof \" help=\"JSON object\"", short: "a", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "namespace-tests single-bar": {head: "cmd \"single-bar\" help=\"Operations for single-bar\"", aliases: []usageItem{{key: "sb", text: " alias \"sb\""}}, children: []string{"get-single-namespace-bar-pet"}}, "namespace-tests single-bar get-single-namespace-bar-pet": {head: "cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\"", aliases: []usageItem{{key: "gsnbp", text: " alias \"gsnbp\""}}}, "namespace-tests single-foo": {head: "cmd \"single-foo\" help=\"Operations for single-foo\"", aliases: []usageItem{{key: "sf", text: " alias \"sf\""}}, children: []string{"create-single-namespace-foo-pet", "get-single-namespace-foo-pet"}}, - "namespace-tests single-foo create-single-namespace-foo-pet": {head: "cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\"", aliases: []usageItem{{key: "csnfp", text: " alias \"csnfp\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\""}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\""}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\""}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\""}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\""}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests single-foo create-single-namespace-foo-pet": {head: "cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\"", aliases: []usageItem{{key: "csnfp", text: " alias \"csnfp\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\"", short: "i", value: true}, {key: "name", text: " flag \"-n --name \" help=\"[required]\"", short: "n", value: true}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"", short: "s", value: true}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\"", short: "m", value: true}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\"", short: "r", value: true}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\"", value: true}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\"", short: "e", value: true}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\"", short: "u", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "namespace-tests single-foo get-single-namespace-foo-pet": {head: "cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\"", aliases: []usageItem{{key: "gsnfp", text: " alias \"gsnfp\""}}}, "namespace-tests types": {head: "cmd \"types\" help=\"Operations for types\"", children: []string{"get-namespace", "get-namespace-animal", "get-namespace-organization", "get-namespace-vehicle"}}, "namespace-tests types get-namespace": {head: "cmd \"get-namespace\" help=\"Get Namespace Types Test\"", aliases: []usageItem{{key: "gn", text: " alias \"gn\""}}}, @@ -100,20 +103,20 @@ var usageNodes = map[string]usageNode{ "namespace-tests types get-namespace-vehicle": {head: "cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\"", aliases: []usageItem{{key: "gnv", text: " alias \"gnv\""}}}, "obsolete": {head: "cmd \"obsolete\" help=\"A subSDK in which all operations are deprecated\"", children: []string{"deprecated1"}}, "obsolete deprecated1": {head: "cmd \"deprecated1\" help=\"Deprecated Operation\""}, - "operation-with-leading-and-trailing-underscores": {head: "cmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\"", aliases: []usageItem{{key: "owlatu", text: " alias \"owlatu\""}}, flags: []usageItem{{key: "qp1", text: " flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\""}}}, - "parentheses-in-path-allowed": {head: "cmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\"", aliases: []usageItem{{key: "pipa", text: " alias \"pipa\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}, {key: "field-with-braces-in-description", text: " flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\""}, {key: "field-with-braces-in-default", text: " flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\""}, {key: "field-with-braces-in-title", text: " flag \"--field-with-braces-in-title \" help=\"string value\""}, {key: "field-with-braces-in-example", text: " flag \"--field-with-braces-in-example \" help=\"string value\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "post-file": {head: "cmd \"post-file\" help=\"Post File\"", aliases: []usageItem{{key: "pf", text: " alias \"pf\""}}, flags: []usageItem{{key: "upload", text: " flag \"-u --upload \" help=\"A file\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, - "render-asset": {head: "cmd \"render-asset\" help=\"Render Asset\"", aliases: []usageItem{{key: "ra", text: " alias \"ra\""}}, flags: []usageItem{{key: "prompt", text: " flag \"-p --prompt \" help=\"[required]\""}, {key: "output-modalities", text: " flag \"--output-modalities \" help=\"options: text, image\" var=#true"}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "operation-with-leading-and-trailing-underscores": {head: "cmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\"", aliases: []usageItem{{key: "owlatu", text: " alias \"owlatu\""}}, flags: []usageItem{{key: "qp1", text: " flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\"", value: true}}}, + "parentheses-in-path-allowed": {head: "cmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\"", aliases: []usageItem{{key: "pipa", text: " alias \"pipa\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}, {key: "field-with-braces-in-description", text: " flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\"", value: true}, {key: "field-with-braces-in-default", text: " flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\"", value: true}, {key: "field-with-braces-in-title", text: " flag \"--field-with-braces-in-title \" help=\"string value\"", value: true}, {key: "field-with-braces-in-example", text: " flag \"--field-with-braces-in-example \" help=\"string value\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "post-file": {head: "cmd \"post-file\" help=\"Post File\"", aliases: []usageItem{{key: "pf", text: " alias \"pf\""}}, flags: []usageItem{{key: "upload", text: " flag \"-u --upload \" help=\"A file\"", short: "u", value: true}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "render-asset": {head: "cmd \"render-asset\" help=\"Render Asset\"", aliases: []usageItem{{key: "ra", text: " alias \"ra\""}}, flags: []usageItem{{key: "prompt", text: " flag \"-p --prompt \" help=\"[required]\"", short: "p", value: true}, {key: "output-modalities", text: " flag \"--output-modalities \" help=\"options: text, image\" var=#true", value: true, repeat: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "stream-metadata": {head: "cmd \"stream-metadata\" help=\"Streamed events can contain text and an optional resource identifier in separate events.\"", aliases: []usageItem{{key: "sm", text: " alias \"sm\""}}}, "tag1": {head: "cmd \"tag1\" help=\"The first tag\"", children: []string{"recent", "auth", "deprecated1", "list-test1", "post-file-with-encoding"}}, - "tag1 recent": {head: "cmd \"recent\" help=\"List recent test1 pages via tag1\"", flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\""}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\""}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\""}}}, - "tag1 auth": {head: "cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\"", flags: []usageItem{{key: "access-token", text: " flag \"--access-token \" help=\"Security credential\""}}}, + "tag1 recent": {head: "cmd \"recent\" help=\"List recent test1 pages via tag1\"", flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\"", short: "p", value: true}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"", value: true}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\"", value: true}}}, + "tag1 auth": {head: "cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\"", flags: []usageItem{{key: "access-token", text: " flag \"--access-token \" help=\"Security credential\"", value: true}}}, "tag1 deprecated1": {head: "cmd \"deprecated1\" help=\"Deprecated Operation\""}, - "tag1 list-test1": {head: "cmd \"list-test1\" help=\"Get Test1\"", aliases: []usageItem{{key: "lt", text: " alias \"lt\""}}, args: []string{" arg \"page\" help=\"integer value (or use --page)\""}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\""}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\""}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\""}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\""}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0"}}}, - "tag1 post-file-with-encoding": {head: "cmd \"post-file-with-encoding\" help=\"Post File With Encoding\"", aliases: []usageItem{{key: "pfwe", text: " alias \"pfwe\""}}, flags: []usageItem{{key: "file", text: " flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\""}, {key: "attachment", text: " flag \"-a --attachment \" help=\"An optional binary attachment\""}, {key: "file-name", text: " flag \"--file-name \" help=\"Optional custom file name\""}, {key: "file-purpose", text: " flag \"--file-purpose \" help=\"Purpose of the file upload\""}, {key: "metadata", text: " flag \"-m --metadata \" help=\"JSON metadata about the file\""}}}, - "test-endpoint": {head: "cmd \"test-endpoint\" help=\"Test Endpoint\"", aliases: []usageItem{{key: "te", text: " alias \"te\""}}, args: []string{" arg \"test-name\" help=\"string value (or use --test-name)\""}, flags: []usageItem{{key: "test-name", text: " flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\""}, {key: "test", text: " flag \"--test \" help=\"[required]\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "test-enum-formats": {head: "cmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\"", aliases: []usageItem{{key: "tef", text: " alias \"tef\""}}, flags: []usageItem{{key: "string-array-format", text: " flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\""}, {key: "string-map-format", text: " flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\""}, {key: "string-partial-map-format", text: " flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\""}, {key: "integer-map-format", text: " flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\""}, {key: "integer-partial-map-format", text: " flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "update-user": {head: "cmd \"update-user\" help=\"Update User\"", aliases: []usageItem{{key: "uu", text: " alias \"uu\""}}, args: []string{" arg \"id\" help=\"string value (or use --id)\""}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}, {key: "user.id", text: " flag \"--user.id \" help=\"[required]\""}, {key: "user.email", text: " flag \"--user.email \" help=\"[required]\""}, {key: "user.first-name", text: " flag \"--user.first-name \" help=\"string value\""}, {key: "user.last-name", text: " flag \"--user.last-name \" help=\"string value\""}, {key: "user.age", text: " flag \"--user.age \" help=\"number value\""}, {key: "user.postal-code", text: " flag \"--user.postal-code \" help=\"string value\""}, {key: "user.gender", text: " flag \"--user.gender \" help=\"options: male, female, other\""}, {key: "user.associated-ids", text: " flag \"--user.associated-ids \" help=\"list of values\" var=#true"}, {key: "user.metadata", text: " flag \"--user.metadata \" help=\"JSON object\""}, {key: "user.metadata-any", text: " flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "tag1 list-test1": {head: "cmd \"list-test1\" help=\"Get Test1\"", aliases: []usageItem{{key: "lt", text: " alias \"lt\""}}, args: []usageItem{{key: "page", text: " arg \"page\" help=\"integer value (or use --page)\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\"", short: "p", value: true}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"", value: true}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\"", value: true}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"", short: "a"}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0", value: true}}}, + "tag1 post-file-with-encoding": {head: "cmd \"post-file-with-encoding\" help=\"Post File With Encoding\"", aliases: []usageItem{{key: "pfwe", text: " alias \"pfwe\""}}, flags: []usageItem{{key: "file", text: " flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\"", value: true}, {key: "attachment", text: " flag \"-a --attachment \" help=\"An optional binary attachment\"", short: "a", value: true}, {key: "file-name", text: " flag \"--file-name \" help=\"Optional custom file name\"", value: true}, {key: "file-purpose", text: " flag \"--file-purpose \" help=\"Purpose of the file upload\"", value: true}, {key: "metadata", text: " flag \"-m --metadata \" help=\"JSON metadata about the file\"", short: "m", value: true}}}, + "test-endpoint": {head: "cmd \"test-endpoint\" help=\"Test Endpoint\"", aliases: []usageItem{{key: "te", text: " alias \"te\""}}, args: []usageItem{{key: "test-name", text: " arg \"test-name\" help=\"string value (or use --test-name)\""}}, flags: []usageItem{{key: "test-name", text: " flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\"", short: "t", value: true}, {key: "test", text: " flag \"--test \" help=\"[required]\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "test-enum-formats": {head: "cmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\"", aliases: []usageItem{{key: "tef", text: " alias \"tef\""}}, flags: []usageItem{{key: "string-array-format", text: " flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\"", value: true}, {key: "string-map-format", text: " flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\"", value: true}, {key: "string-partial-map-format", text: " flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\"", value: true}, {key: "integer-map-format", text: " flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\"", value: true}, {key: "integer-partial-map-format", text: " flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "update-user": {head: "cmd \"update-user\" help=\"Update User\"", aliases: []usageItem{{key: "uu", text: " alias \"uu\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}, {key: "user.id", text: " flag \"--user.id \" help=\"[required]\"", value: true}, {key: "user.email", text: " flag \"--user.email \" help=\"[required]\"", value: true}, {key: "user.first-name", text: " flag \"--user.first-name \" help=\"string value\"", value: true}, {key: "user.last-name", text: " flag \"--user.last-name \" help=\"string value\"", value: true}, {key: "user.age", text: " flag \"--user.age \" help=\"number value\"", value: true}, {key: "user.postal-code", text: " flag \"--user.postal-code \" help=\"string value\"", value: true}, {key: "user.gender", text: " flag \"--user.gender \" help=\"options: male, female, other\"", value: true}, {key: "user.associated-ids", text: " flag \"--user.associated-ids \" help=\"list of values\" var=#true", value: true, repeat: true}, {key: "user.metadata", text: " flag \"--user.metadata \" help=\"JSON object\"", value: true}, {key: "user.metadata-any", text: " flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "url-validation-stress-test": {head: "cmd \"url-validation-stress-test\" help=\"Url Validation Stress Test\"", aliases: []usageItem{{key: "uvst", text: " alias \"uvst\""}}}, "validate": {head: "cmd \"validate\" help=\"Validate\""}, "version": {head: "cmd \"version\" help=\"Print the CLI version\""}, @@ -257,7 +260,9 @@ func staticUsageBody(node usageNode, own bool) []string { for _, alias := range node.aliases { body = append(body, alias.text) } - body = append(body, node.args...) + for _, arg := range node.args { + body = append(body, arg.text) + } for _, flag := range node.flags { if own || !flag.settings { body = append(body, flag.text) @@ -281,8 +286,10 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string body = append(body, prefix+"alias "+kdlQuote(alias)) } } - if len(node.args) > 0 { - body = append(body, node.args...) + if usageArgsUnchanged(node.args, usagePromptArgs(cmd)) { + for _, arg := range node.args { + body = append(body, arg.text) + } } else { body = append(body, liveUsageArgs(cmd, prefix)...) } @@ -290,7 +297,13 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string for _, flag := range node.flags { listed[flag.key] = true f := cmd.Flags().Lookup(flag.key) - if f != nil && (own || !flag.settings) && (flag.hidden || !f.Hidden) { + switch { + case f == nil || (!own && flag.settings): + case !usageFlagUnchanged(flag, f): + if !f.Hidden { + body = append(body, liveUsageFlag(f, prefix)) + } + case flag.hidden || !f.Hidden: body = append(body, flag.text) } } @@ -436,19 +449,45 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func liveUsageArgs(cmd *cobra.Command, prefix string) []string { +func usageFlagUnchanged(item usageItem, f *pflag.Flag) bool { + _, repeat := f.Value.(pflag.SliceValue) + return f.Shorthand == item.short && (f.NoOptDefVal == "") == item.value && repeat == item.repeat +} + +func usageArgsUnchanged(generated []usageItem, live []usagePromptArg) bool { + if len(generated) == 0 || len(generated) != len(live) { + return false + } + for i, arg := range generated { + if arg.key != live[i].Name { + return false + } + } + return true +} + +type usagePromptArg struct { + Name string `json:"name"` + Summary string `json:"summary"` + Required bool `json:"required"` + Variadic bool `json:"variadic"` +} + +func usagePromptArgs(cmd *cobra.Command) []usagePromptArg { var promptArgs struct { - Version int `json:"version"` - Args []struct { - Name string `json:"name"` - Summary string `json:"summary"` - Required bool `json:"required"` - Variadic bool `json:"variadic"` - } `json:"args"` - } - if raw := cmd.Annotations["speakeasy_prompt_args"]; raw != "" && json.Unmarshal([]byte(raw), &promptArgs) == nil && promptArgs.Version == 1 { + Version int `json:"version"` + Args []usagePromptArg `json:"args"` + } + if raw := cmd.Annotations["speakeasy_prompt_args"]; raw == "" || json.Unmarshal([]byte(raw), &promptArgs) != nil || promptArgs.Version != 1 { + return nil + } + return promptArgs.Args +} + +func liveUsageArgs(cmd *cobra.Command, prefix string) []string { + if promptArgs := usagePromptArgs(cmd); promptArgs != nil { var lines []string - for _, arg := range promptArgs.Args { + for _, arg := range promptArgs { line := prefix + "arg " + kdlQuote(arg.Name) if arg.Summary != "" { line += " help=" + kdlQuoteAt(arg.Summary, prefix+" ") diff --git a/zSDKs/sdk-cli/tests/usage_test.go b/zSDKs/sdk-cli/tests/usage_test.go index 82dc8d473..2bbf1908e 100644 --- a/zSDKs/sdk-cli/tests/usage_test.go +++ b/zSDKs/sdk-cli/tests/usage_test.go @@ -266,7 +266,10 @@ func TestUsageSchema_DynamicRoot(t *testing.T) { root.PersistentFlags().String("runtime-root", "", "Runtime root flag") var after strings.Builder require.NoError(t, usage.EmitSchema(root, &after)) - assert.Contains(t, after.String(), "\nflag \"--runtime-root \" help=\"Runtime root flag\"\n") + children := strings.Index(before.String(), "\ncmd \"") + 1 + require.Positive(t, children) + want := before.String()[:children] + "flag \"--runtime-root \" help=\"Runtime root flag\"\n" + before.String()[children:] + assert.Equal(t, want, after.String()) } func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { @@ -281,6 +284,27 @@ func TestUsageSchema_HiddenGeneratedCommandDropped(t *testing.T) { assert.NotContains(t, out.String(), "\ncmd \"version\"") } +func TestUsageSchema_ReplacedCommandDropsStaleFlagSyntax(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + original, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + root.RemoveCommand(original) + replacement := &cobra.Command{Use: "configure", Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} + replacement.Flags().BoolP("default-output-format", "x", false, "New switch") + root.AddCommand(replacement) + usage.MarkDynamic(replacement) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\ncmd \"configure\" help=\"Replacement\" {\n flag \"-x --default-output-format\" help=\"New switch\"\n}\n") + + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + assert.Contains(t, own.String(), "\n flag \"-x --default-output-format\" help=\"New switch\"\n") + assert.NotContains(t, own.String(), "") +} + func TestUsageSchema_DetachedCommand(t *testing.T) { leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder @@ -374,6 +398,23 @@ func TestUsageSchema_IntentCommandWithArgs(t *testing.T) { assert.Empty(t, stderr) } +func TestUsageSchema_ReplacedIntentDropsStaleArgs(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + original, _, err := root.Find([]string{"invite"}) + require.NoError(t, err) + parent := original.Parent() + parent.RemoveCommand(original) + replacement := &cobra.Command{Use: original.Name(), Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} + parent.AddCommand(replacement) + usage.MarkDynamic(replacement) + + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + assert.Contains(t, own.String(), "cmd \"invite\" help=\"Replacement\"") + assert.NotContains(t, own.String(), "arg \"") +} + // --usage documents the command and wins over --schema (matching operation // commands): KDL comes back, not the request-body JSON Schema. func TestUsageSchema_IntentUsageBeatsSchema(t *testing.T) { From 91525a7c8c36fbf8c517d40b40c0d59b15190b9e Mon Sep 17 00:00:00 2001 From: 2ynn Date: Mon, 19 Oct 2026 11:31:50 -0400 Subject: [PATCH 5/7] fix(cli): render commands attached after generation live in --usage `MarkDynamic` merges a command's generated lines with its runtime state, and nothing else rendered fully live, so a same-named replacement of a generated command could still advertise generated `default=`, `suggestions`, `env` and help text it no longer has. Cobra metadata cannot tell an unchanged command from a replacement: generated intents register flags with zero-value defaults while the table documents the effective default the intent applies itself. Use command identity instead. `NewRootCommand` calls `usage.MarkGenerated` on the tree right before `custom.Register`, and on cobra's `help` and `completion` once they are created. Only marked commands use their `usageNodes` entry; anything attached later, including a same-named replacement, renders live from cobra while keeping the node's declared child order. `MarkDynamic` keeps its role for porcelain that extends a generated command in place. This supersedes the per-flag shorthand/operand/repeat signature: pflag cannot remove a flag, so on a marked command every table flag is the generated flag object. The `short`/`value`/`repeat` table fields and `usageFlagUnchanged` are removed. Tests: `TestUsageSchema_ReplacedCommandRendersLive` (exact own and root block for an unmarked replacement), `TestUsageSchema_GeneratedCommandsMarked`; `TestUsageSchema_ReplacedIntentDropsStaleArgs` no longer marks the replacement dynamic. README and review SDK updated. --- templates/templates/cli/README.md | 2 +- templates/templates/cli/includes/usage.ts | 9 -- templates/templates/cli/root.go.stmpl | 12 +++ templates/templates/cli/usage.go.stmpl | 36 ++++--- templates/templates/cli/usage_test.go.stmpl | 31 +++++- zSDKs/sdk-cli/.speakeasy/gen.lock | 6 +- zSDKs/sdk-cli/internal/cli/root.go | 7 ++ zSDKs/sdk-cli/internal/usage/schema.go | 108 ++++++++++---------- zSDKs/sdk-cli/tests/usage_test.go | 31 +++++- 9 files changed, 157 insertions(+), 85 deletions(-) diff --git a/templates/templates/cli/README.md b/templates/templates/cli/README.md index 1482ced23..ecd4a3b6c 100644 --- a/templates/templates/cli/README.md +++ b/templates/templates/cli/README.md @@ -1395,7 +1395,7 @@ The KDL schema is built at generation time from the command tree in `includes/us Declared commands (`x-speakeasy-cli-commands`) are part of the schema: bound intents mount into the KDL tree under their declared parent path with the same flag surface the runtime registers (declared positional `arg` nodes, operation security flags, the body flag, `--schema`, and declared flags — plus non-body parameter metadata for JSON-body intents (multipart intents keep their upload fields); `buildIntentUsageCommand` in `includes/usage.ts`), and planned placeholders appear with their summary. For commands added after static schema generation, live schema emission reads `speakeasy_prompt_args` and emits the same `arg` nodes. Once Cobra validation succeeds, `--usage` on an intent or planned command emits KDL and wins over the command's other runtime surfaces, including `--schema` and the bare-invocation usage error (`runIntent*Cmd` in `intentcmd.go.stmpl` and `newPlannedCmd` in `intents.go.stmpl` check `usage.UsageRequested` first, matching operation commands). -**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. A command marked with `usage.MarkDynamic` (custom placeholders, `custom.Register` porcelain that adds flags) renders its `help` from the runtime `Short`, keeps its generated arg lines while the runtime `speakeasy_prompt_args` names match them, keeps its generated alias lines for aliases it still has, and keeps a generated flag line while the flag still exists with the same shorthand, operand and repeatability (generated `default=` values are the documented effective defaults, which intents may apply outside cobra, so they are not compared with cobra's); a flag whose syntax changed renders live in its generated position, a flag generated visible and hidden at runtime is dropped, one generated with `hide=#true` keeps that line, and runtime-added aliases and visible local flags render live, so `suggestions`, `default=` and declared order survive; generated arg and flag help text wins over runtime rewrites. Nodes are matched by command path under the generated root (a command detached from it renders entirely from Cobra), so porcelain that replaces a generated command with a same-named one must mark it dynamic. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. +**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. `NewRootCommand` calls `usage.MarkGenerated` on the tree right before `custom.Register` (and on cobra's `help`/`completion` once created): only marked commands under the generated root use their table node, so a command attached later — including a same-named replacement of a generated command — renders live from Cobra, as does a command detached from the root. Commands added in the root `custom-commands` region run before the mark and count as generated. `usage.MarkDynamic` is for porcelain that extends a generated command in place (custom placeholders, `custom.Register` adding flags): such a command renders its `help` from the runtime `Short`, keeps its generated arg lines while the runtime `speakeasy_prompt_args` names match them, keeps its generated alias and flag lines for the aliases and flags it still has (a flag generated visible and hidden at runtime is dropped; one generated with `hide=#true` keeps that line), and renders runtime-added aliases and visible local flags live, so generated `suggestions`, `default=`, help text and declared order survive. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. ### Generated README & Command Docs diff --git a/templates/templates/cli/includes/usage.ts b/templates/templates/cli/includes/usage.ts index 97f1884dd..ba5a80ef4 100644 --- a/templates/templates/cli/includes/usage.ts +++ b/templates/templates/cli/includes/usage.ts @@ -1489,9 +1489,6 @@ interface UsageNodeItem { text: string; settings?: boolean; hidden?: boolean; - short?: string; - value?: boolean; - repeat?: boolean; } // Rendered at indent 0; the runtime re-indents each line by depth. @@ -1525,9 +1522,6 @@ function collectUsageNodes( text: renderUsageFlag(flag, depth).join("\n"), settings: flag.settings, hidden: flag.hidden, - short: /^-([^-\s]+)\s/.exec(flag.spec)?.[1], - value: flag.spec.includes(" <"), - repeat: flag.spec.includes("...>"), })), children: (cmd.commands || []).map((child) => child.name), }); @@ -2405,9 +2399,6 @@ function goUsageNodeItems(items: UsageNodeItem[]): string { ]; if (item.settings) fields.push("settings: true"); if (item.hidden) fields.push("hidden: true"); - if (item.short) fields.push(`short: ${goStringLiteral(item.short)}`); - if (item.value) fields.push("value: true"); - if (item.repeat) fields.push("repeat: true"); return `{${fields.join(", ")} }`; }) .join(", ")} }`; diff --git a/templates/templates/cli/root.go.stmpl b/templates/templates/cli/root.go.stmpl index 7c73888cb..00e927f7d 100644 --- a/templates/templates/cli/root.go.stmpl +++ b/templates/templates/cli/root.go.stmpl @@ -269,6 +269,7 @@ func NewRootCommand() (*cobra.Command, error) { } {{- end}} + usage.MarkGenerated(rootCmd) {{- if isCustomCommandsEnabled}} {{- addImport "internal/cli/custom" true}} @@ -278,6 +279,11 @@ func NewRootCommand() (*cobra.Command, error) { // Cobra creates its default help and completion commands lazily inside Execute. rootCmd.InitDefaultHelpCmd() rootCmd.InitDefaultCompletionCmd() + for _, builtin := range rootCmd.Commands() { + if builtin.Name() == "help" || builtin.Name() == "completion" { + usage.MarkGenerated(builtin) + } + } {{- if hasCliIntents}} applyDeclaredCommandOrder(rootCmd) {{- end}} @@ -1083,6 +1089,7 @@ func NewRootCommand() (*cobra.Command, error) { } {{- end}} + usage.MarkGenerated(rootCmd) {{- if isCustomCommandsEnabled}} {{- addImport "internal/cli/custom" true}} @@ -1092,6 +1099,11 @@ func NewRootCommand() (*cobra.Command, error) { // Cobra creates its default help and completion commands lazily inside Execute. rootCmd.InitDefaultHelpCmd() rootCmd.InitDefaultCompletionCmd() + for _, builtin := range rootCmd.Commands() { + if builtin.Name() == "help" || builtin.Name() == "completion" { + usage.MarkGenerated(builtin) + } + } {{- if hasCliIntents}} applyDeclaredCommandOrder(rootCmd) {{- end}} diff --git a/templates/templates/cli/usage.go.stmpl b/templates/templates/cli/usage.go.stmpl index 700251fd3..d1c9cd038 100644 --- a/templates/templates/cli/usage.go.stmpl +++ b/templates/templates/cli/usage.go.stmpl @@ -15,9 +15,6 @@ type usageItem struct { text string settings bool hidden bool - short string - value bool - repeat bool } type usageNode struct { @@ -107,8 +104,9 @@ func EmitSchema(cmd *cobra.Command, w io.Writer) error { } const ( - usageDynamicAnnotation = "speakeasy_usage_dynamic" - usageRootName = "{{sanitizeCliName}}" + usageDynamicAnnotation = "speakeasy_usage_dynamic" + usageGeneratedAnnotation = "speakeasy_usage_generated" + usageRootName = "{{sanitizeCliName}}" ) func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own, tabled bool) { @@ -118,6 +116,9 @@ func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent if tabled { node, static = usageNodes[path] } + if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != "true" { + node, static = usageNode{children: node.children}, false + } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" itemPrefix := " " if isRoot { @@ -204,13 +205,7 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string for _, flag := range node.flags { listed[flag.key] = true f := cmd.Flags().Lookup(flag.key) - switch { - case f == nil || (!own && flag.settings): - case !usageFlagUnchanged(flag, f): - if !f.Hidden { - body = append(body, liveUsageFlag(f, prefix)) - } - case flag.hidden || !f.Hidden: + if f != nil && (own || !flag.settings) && (flag.hidden || !f.Hidden) { body = append(body, flag.text) } } @@ -263,6 +258,18 @@ func MarkDynamic(cmd *cobra.Command) { cmd.Annotations[usageDynamicAnnotation] = "true" } +// MarkGenerated records cmd and its subtree as the generated commands the +// usageNodes table describes; a same-named command attached later renders live. +func MarkGenerated(cmd *cobra.Command) { + if cmd.Annotations == nil { + cmd.Annotations = map[string]string{} + } + cmd.Annotations[usageGeneratedAnnotation] = "true" + for _, child := range cmd.Commands() { + MarkGenerated(child) + } +} + // Go's %q emits \a, \v, and \xNN escapes that KDL v2 does not define. func kdlQuote(s string) string { var b strings.Builder @@ -356,11 +363,6 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func usageFlagUnchanged(item usageItem, f *pflag.Flag) bool { - _, repeat := f.Value.(pflag.SliceValue) - return f.Shorthand == item.short && (f.NoOptDefVal == "") == item.value && repeat == item.repeat -} - func usageArgsUnchanged(generated []usageItem, live []usagePromptArg) bool { if len(generated) == 0 || len(generated) != len(live) { return false diff --git a/templates/templates/cli/usage_test.go.stmpl b/templates/templates/cli/usage_test.go.stmpl index bae9aabc0..d3ca16f73 100644 --- a/templates/templates/cli/usage_test.go.stmpl +++ b/templates/templates/cli/usage_test.go.stmpl @@ -318,6 +318,36 @@ func TestUsageSchema_ReplacedCommandDropsStaleFlagSyntax(t *testing.T) { assert.NotContains(t, own.String(), "") } +func TestUsageSchema_ReplacedCommandRendersLive(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + original, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + root.RemoveCommand(original) + replacement := &cobra.Command{Use: "configure", Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} + replacement.Flags().String("default-output-format", "", "New string") + root.AddCommand(replacement) + + block := "cmd \"configure\" help=\"Replacement\" {\n flag \"--default-output-format \" help=\"New string\"\n}\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + assert.Equal(t, block, own.String()) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\n"+block) +} + +func TestUsageSchema_GeneratedCommandsMarked(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + for _, path := range [][]string{ {"version"}, {"configure"}, {"help"}, {"completion"}, {"completion", "bash"} } { + cmd, _, err := root.Find(path) + require.NoError(t, err) + assert.Equal(t, "true", cmd.Annotations["speakeasy_usage_generated"], strings.Join(path, " ")) + } +} + func TestUsageSchema_DetachedCommand(t *testing.T) { leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder @@ -432,7 +462,6 @@ func TestUsageSchema_ReplacedIntentDropsStaleArgs(t *testing.T) { parent.RemoveCommand(original) replacement := &cobra.Command{Use: original.Name(), Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} parent.AddCommand(replacement) - usage.MarkDynamic(replacement) var own strings.Builder require.NoError(t, usage.EmitSchema(replacement, &own)) diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index 79d7144bb..da1f5e8ad 100644 --- a/zSDKs/sdk-cli/.speakeasy/gen.lock +++ b/zSDKs/sdk-cli/.speakeasy/gen.lock @@ -182,7 +182,7 @@ trackedFiles: internal/cli/renderasset.go: last_write_checksum: sha1:c72bde224ebd3246cce2e14e5f04b1e3ed854ba2 internal/cli/root.go: - last_write_checksum: sha1:aaa8b373e151e3b4f10eda16fede1bb30da0fa92 + last_write_checksum: sha1:eddf8387cbe9d89adab1d09408a20d19a23c9bc2 internal/cli/streammetadata/root.go: last_write_checksum: sha1:42a01737002d2daef8a33be267f7060659fdac65 internal/cli/streammetadata/streammetadata.go: @@ -658,7 +658,7 @@ trackedFiles: internal/usage/bodyschemas.go: last_write_checksum: sha1:775249b69ed405ad072c16a76fe6113f375b3818 internal/usage/schema.go: - last_write_checksum: sha1:cb279236c8c214450e2fcec42d9dd8ee1841635b + last_write_checksum: sha1:e26a787b1b5d11947027f40186b9ca9ce90f6b2a scripts/install.ps1: last_write_checksum: sha1:9dcf40ea00ecb8ceda83d5056f57235b43cf658a scripts/install.sh: @@ -1120,7 +1120,7 @@ trackedFiles: tests/types_test.go: last_write_checksum: sha1:5ce31f08a3214779ed561d0f37279eb4d5202723 tests/usage_test.go: - last_write_checksum: sha1:75b062ffa2a66f3991219263cccadb9387c59d20 + last_write_checksum: sha1:5cbd4a4a2a836864eb8c1e9e94b99d09b434a8a3 examples: _operation_with_leading_and_trailing_underscores_: speakeasy-default-operation-with-leading-and-trailing-underscores: diff --git a/zSDKs/sdk-cli/internal/cli/root.go b/zSDKs/sdk-cli/internal/cli/root.go index 4df8a50c2..557198eb5 100644 --- a/zSDKs/sdk-cli/internal/cli/root.go +++ b/zSDKs/sdk-cli/internal/cli/root.go @@ -314,11 +314,18 @@ func NewRootCommand() (*cobra.Command, error) { return nil, err } + usage.MarkGenerated(rootCmd) + custom.Register(rootCmd) // Cobra creates its default help and completion commands lazily inside Execute. rootCmd.InitDefaultHelpCmd() rootCmd.InitDefaultCompletionCmd() + for _, builtin := range rootCmd.Commands() { + if builtin.Name() == "help" || builtin.Name() == "completion" { + usage.MarkGenerated(builtin) + } + } applyDeclaredCommandOrder(rootCmd) interactive.Intercept(rootCmd) usage.Intercept(rootCmd) diff --git a/zSDKs/sdk-cli/internal/usage/schema.go b/zSDKs/sdk-cli/internal/usage/schema.go index e0af23663..086977ce0 100644 --- a/zSDKs/sdk-cli/internal/usage/schema.go +++ b/zSDKs/sdk-cli/internal/usage/schema.go @@ -17,9 +17,6 @@ type usageItem struct { text string settings bool hidden bool - short string - value bool - repeat bool } type usageNode struct { @@ -31,50 +28,50 @@ type usageNode struct { } var usageNodes = map[string]usageNode{ - "": {head: "name \"cli\"\nbin \"cli\"\nabout \"\"\"\n This document will show case as many of our features as possible in as little operations/models as possible.\n This will then generate a SDK that we can more easily review than the test SDKs based on uber.yaml spec.\n \"\"\"\nversion \"0.0.1\"\nconfig {\n file \"~/.config/cli/config.yaml\"\n}", flags: []usageItem{{key: "usage", text: "flag \"--usage\" help=\"Print the CLI Usage schema in KDL format\" global=#true"}, {key: "version", text: "flag \"-v --version\" help=\"Print the CLI version\"", short: "v"}, {key: "output-format", text: "flag \"-o --output-format \" help=\"Specify the output format. Options: pretty, json, yaml, table, toon.\" global=#true config=\"output_format\" default=\"pretty\"", short: "o", value: true}, {key: "color", text: "flag \"--color \" help=\"Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars.\" global=#true default=\"auto\"", value: true}, {key: "jq", text: "flag \"-q --jq \" help=\"Filter and transform output using a jq expression (e.g., '.name', '.items[] | .id')\" global=#true", short: "q", value: true}, {key: "raw-output", text: "flag \"--raw-output\" help=\"Write --jq string results as raw text instead of JSON strings (like jq -r); non-string results stay JSON\" global=#true default=#false"}, {key: "server-url", text: "flag \"--server-url \" help=\"Override the default server URL\" global=#true", value: true}, {key: "server", text: "flag \"--server \" help=\"Select a server by index (for indexed servers) or name (for named servers)\" global=#true", value: true}, {key: "header", text: "flag \"-H --header \" help=\"Set a custom HTTP request header (format: \\\"Key: Value\\\"). Can be specified multiple times.\" global=#true var=#true", short: "H", value: true, repeat: true}, {key: "include-headers", text: "flag \"--include-headers\" help=\"Include HTTP response headers in the output\" global=#true default=#false"}, {key: "timeout", text: "flag \"--timeout \" help=\"HTTP request timeout (e.g., 30s, 5m, 100ms)\" global=#true config=\"timeout\"", value: true}, {key: "interactive", text: "flag \"--interactive\" help=\"Prompt for missing inputs and open guided configure/auth forms (forms fall back to line prompts on stdin off-TTY)\" global=#true default=#false"}, {key: "no-interactive", text: "flag \"--no-interactive\" help=\"Disable all interactive features (auto-prompting, explorer auto-launch, TUI forms)\" global=#true default=#false"}, {key: "dry-run", text: "flag \"--dry-run\" help=\"Preview API requests without sending them (no network, no OS keychain). Human preview on stderr; with -o json or --jq, one JSON object per request on stdout. Local mutation commands (auth login, auth logout and configure) make no request: they skip prompts and writes and report a no-op (stderr, or one JSON object on stdout in the machine form)\" global=#true default=#false"}, {key: "debug", text: "flag \"-d --debug\" help=\"Log request and response diagnostics to stderr\" global=#true default=#false", short: "d"}, {key: "agent-mode", text: "flag \"--agent-mode\" help=\"Enable structured errors and default TOON output for AI coding agents.\" global=#true default=#false"}, {key: "no-retries", text: "flag \"--no-retries\" help=\"Disable automatic retries (default: retries enabled with exponential backoff)\" global=#true config=\"no_retries\" default=#false"}, {key: "retry-max-elapsed-time", text: "flag \"--retry-max-elapsed-time \" help=\"Maximum total time for retries (e.g., 30s, 5m). Default: 30s\" global=#true config=\"retry_max_elapsed_time\"", value: true}, {key: "retry-connection-errors", text: "flag \"--retry-connection-errors\" help=\"Retry on connection errors (EOF, reset, etc.)\" global=#true config=\"retry_connection_errors\" default=#false"}, {key: "retry-config", text: "flag \"--retry-config \" help=\"Full retry config as JSON. Schema: {\\\"strategy\\\":\\\"backoff\\\",\\\"backoff\\\":{\\\"initialInterval\\\":500,\\\"maxInterval\\\":10000,\\\"exponent\\\":1.5,\\\"maxElapsedTime\\\":30000},\\\"retryConnectionErrors\\\":false}. Times are in milliseconds.\" global=#true config=\"retry_config\"", value: true}, {key: "subdomain", text: "flag \"--subdomain \" help=\"Server template variable: subdomain\" global=#true", value: true}, {key: "version-param", text: "flag \"--version-param \" help=\"Server template variable: version\" global=#true", value: true}, {key: "host-name", text: "flag \"--host-name \" help=\"Server template variable: HostName\" global=#true", value: true}, {key: "port", text: "flag \"--port \" help=\"Server template variable: PORT\" global=#true", value: true}, {key: "username", text: "flag \"--username \" help=\"HTTP Basic username\" global=#true env=\"CLI_USERNAME\" config=\"security.username\"", value: true}, {key: "password", text: "flag \"--password \" help=\"HTTP Basic password\" global=#true env=\"CLI_PASSWORD\" config=\"security.password\"", value: true}, {key: "bearer-auth", text: "flag \"--bearer-auth \" help=\"HTTP Bearer\" global=#true env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", value: true}, {key: "my-api-key", text: "flag \"--my-api-key \" help=\"API Key\" global=#true env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", value: true}, {key: "oauth2", text: "flag \"--oauth2 \" help=\"OAuth2 Authorization\" global=#true env=\"CLI_OAUTH2\" config=\"security.oauth2\"", value: true}, {key: "app-id", text: "flag \"--app-id \" help=\"Custom authentication credential\" global=#true env=\"CLI_APP_ID\" config=\"security.app_id\"", value: true}, {key: "secret", text: "flag \"--secret \" help=\"Custom authentication credential\" global=#true env=\"CLI_SECRET\" config=\"security.secret\"", value: true}, {key: "mobile-auth", text: "flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" global=#true env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", value: true}, {key: "client-id", text: "flag \"--client-id \" help=\"Client Credentials flow. client identifier\" global=#true env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", value: true}, {key: "client-secret", text: "flag \"--client-secret \" help=\"Client Credentials flow. client secret\" global=#true env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", value: true}, {key: "token-url", text: "flag \"--token-url \" help=\"Client Credentials flow. token URL\" global=#true env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", value: true}, {key: "no-keyring", text: "flag \"--no-keyring\" help=\"Never read or write the OS keychain; store secrets in the config file instead\" global=#true env=\"CLI_NO_KEYRING\" config=\"no_keyring\" default=#false"}, {key: "query-param1", text: "flag \"--query-param1 \" help=\"A long winded, multi-line description\" global=#true env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"", value: true}, {key: "deprecated-query-param1", text: "flag \"--deprecated-query-param1 \" help=\"A deprecated description\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"", value: true}, {key: "deprecated-query-param2", text: "flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"", value: true}, {key: "lone-query-param", text: "flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" global=#true env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"", value: true}}, children: []string{"invite", "enroll", "render", "produce", "observe", "say", "archive", "test-group", "hello", "auth", "binary-and-string-upload", "chat", "completion", "configure", "create-user", "create-with-union", "delete-user", "explore", "get-asset", "get-binary-default-response", "get-duplicate-export-collision", "get-empty-object-error", "get-error-in-union", "get-error-only-example", "get-fully-flattened-request", "get-named-primitive-union", "get-nested-integer-string", "get-polymorphism", "get-positional-default", "get-request-body-flattened-away", "get-union-errors", "get-user", "group", "help", "login", "namespace-tests", "obsolete", "operation-with-leading-and-trailing-underscores", "parentheses-in-path-allowed", "post-file", "render-asset", "stream-metadata", "tag1", "test-endpoint", "test-enum-formats", "update-user", "url-validation-stress-test", "validate", "version", "whoami"}}, - "invite": {head: "cmd \"invite\" help=\"Invite a user by email\"", args: []usageItem{{key: "email", text: " arg \"email\" help=\"Email address to invite\" required=#true var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "given-name", text: " flag \"--given-name \" help=\"First name to record\"", value: true}, {key: "user-gender", text: " flag \"--user-gender \" help=\"Gender to record (e.g. male, female, other)\" {\n suggestions \"male\" \"female\" \"other\"\n }", value: true}}}, - "enroll": {head: "cmd \"enroll\" help=\"Enroll a user by email\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "enrollment-email", text: " flag \"--enrollment-email \" help=\"Email address to enroll\"", value: true}}}, - "render": {head: "cmd \"render\" help=\"Render an image asset to a file\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render\" required=#true var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./render-{timestamp}-{rand}.{ext}\"", value: true}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}}}, - "produce": {head: "cmd \"produce\" help=\"Produce an image asset and wait for completion\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./produce-{timestamp}-{rand}.{ext}\"", value: true}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"", value: true}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"", value: true}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"", value: true}}}, - "observe": {head: "cmd \"observe\" help=\"Produce an asset and print its terminal status\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\"", value: true}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\"", value: true}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\"", value: true}}}, - "say": {head: "cmd \"say\" help=\"Stream a chat reply\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Prompt to send\" required=#true var=#true"}}, flags: []usageItem{{key: "request", text: " flag \"--request \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive (default: true)\" default=#true"}}}, + "": {head: "name \"cli\"\nbin \"cli\"\nabout \"\"\"\n This document will show case as many of our features as possible in as little operations/models as possible.\n This will then generate a SDK that we can more easily review than the test SDKs based on uber.yaml spec.\n \"\"\"\nversion \"0.0.1\"\nconfig {\n file \"~/.config/cli/config.yaml\"\n}", flags: []usageItem{{key: "usage", text: "flag \"--usage\" help=\"Print the CLI Usage schema in KDL format\" global=#true"}, {key: "version", text: "flag \"-v --version\" help=\"Print the CLI version\""}, {key: "output-format", text: "flag \"-o --output-format \" help=\"Specify the output format. Options: pretty, json, yaml, table, toon.\" global=#true config=\"output_format\" default=\"pretty\""}, {key: "color", text: "flag \"--color \" help=\"Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars.\" global=#true default=\"auto\""}, {key: "jq", text: "flag \"-q --jq \" help=\"Filter and transform output using a jq expression (e.g., '.name', '.items[] | .id')\" global=#true"}, {key: "raw-output", text: "flag \"--raw-output\" help=\"Write --jq string results as raw text instead of JSON strings (like jq -r); non-string results stay JSON\" global=#true default=#false"}, {key: "server-url", text: "flag \"--server-url \" help=\"Override the default server URL\" global=#true"}, {key: "server", text: "flag \"--server \" help=\"Select a server by index (for indexed servers) or name (for named servers)\" global=#true"}, {key: "header", text: "flag \"-H --header \" help=\"Set a custom HTTP request header (format: \\\"Key: Value\\\"). Can be specified multiple times.\" global=#true var=#true"}, {key: "include-headers", text: "flag \"--include-headers\" help=\"Include HTTP response headers in the output\" global=#true default=#false"}, {key: "timeout", text: "flag \"--timeout \" help=\"HTTP request timeout (e.g., 30s, 5m, 100ms)\" global=#true config=\"timeout\""}, {key: "interactive", text: "flag \"--interactive\" help=\"Prompt for missing inputs and open guided configure/auth forms (forms fall back to line prompts on stdin off-TTY)\" global=#true default=#false"}, {key: "no-interactive", text: "flag \"--no-interactive\" help=\"Disable all interactive features (auto-prompting, explorer auto-launch, TUI forms)\" global=#true default=#false"}, {key: "dry-run", text: "flag \"--dry-run\" help=\"Preview API requests without sending them (no network, no OS keychain). Human preview on stderr; with -o json or --jq, one JSON object per request on stdout. Local mutation commands (auth login, auth logout and configure) make no request: they skip prompts and writes and report a no-op (stderr, or one JSON object on stdout in the machine form)\" global=#true default=#false"}, {key: "debug", text: "flag \"-d --debug\" help=\"Log request and response diagnostics to stderr\" global=#true default=#false"}, {key: "agent-mode", text: "flag \"--agent-mode\" help=\"Enable structured errors and default TOON output for AI coding agents.\" global=#true default=#false"}, {key: "no-retries", text: "flag \"--no-retries\" help=\"Disable automatic retries (default: retries enabled with exponential backoff)\" global=#true config=\"no_retries\" default=#false"}, {key: "retry-max-elapsed-time", text: "flag \"--retry-max-elapsed-time \" help=\"Maximum total time for retries (e.g., 30s, 5m). Default: 30s\" global=#true config=\"retry_max_elapsed_time\""}, {key: "retry-connection-errors", text: "flag \"--retry-connection-errors\" help=\"Retry on connection errors (EOF, reset, etc.)\" global=#true config=\"retry_connection_errors\" default=#false"}, {key: "retry-config", text: "flag \"--retry-config \" help=\"Full retry config as JSON. Schema: {\\\"strategy\\\":\\\"backoff\\\",\\\"backoff\\\":{\\\"initialInterval\\\":500,\\\"maxInterval\\\":10000,\\\"exponent\\\":1.5,\\\"maxElapsedTime\\\":30000},\\\"retryConnectionErrors\\\":false}. Times are in milliseconds.\" global=#true config=\"retry_config\""}, {key: "subdomain", text: "flag \"--subdomain \" help=\"Server template variable: subdomain\" global=#true"}, {key: "version-param", text: "flag \"--version-param \" help=\"Server template variable: version\" global=#true"}, {key: "host-name", text: "flag \"--host-name \" help=\"Server template variable: HostName\" global=#true"}, {key: "port", text: "flag \"--port \" help=\"Server template variable: PORT\" global=#true"}, {key: "username", text: "flag \"--username \" help=\"HTTP Basic username\" global=#true env=\"CLI_USERNAME\" config=\"security.username\""}, {key: "password", text: "flag \"--password \" help=\"HTTP Basic password\" global=#true env=\"CLI_PASSWORD\" config=\"security.password\""}, {key: "bearer-auth", text: "flag \"--bearer-auth \" help=\"HTTP Bearer\" global=#true env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\""}, {key: "my-api-key", text: "flag \"--my-api-key \" help=\"API Key\" global=#true env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\""}, {key: "oauth2", text: "flag \"--oauth2 \" help=\"OAuth2 Authorization\" global=#true env=\"CLI_OAUTH2\" config=\"security.oauth2\""}, {key: "app-id", text: "flag \"--app-id \" help=\"Custom authentication credential\" global=#true env=\"CLI_APP_ID\" config=\"security.app_id\""}, {key: "secret", text: "flag \"--secret \" help=\"Custom authentication credential\" global=#true env=\"CLI_SECRET\" config=\"security.secret\""}, {key: "mobile-auth", text: "flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" global=#true env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\""}, {key: "client-id", text: "flag \"--client-id \" help=\"Client Credentials flow. client identifier\" global=#true env=\"CLI_CLIENT_ID\" config=\"security.client_id\""}, {key: "client-secret", text: "flag \"--client-secret \" help=\"Client Credentials flow. client secret\" global=#true env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\""}, {key: "token-url", text: "flag \"--token-url \" help=\"Client Credentials flow. token URL\" global=#true env=\"CLI_TOKEN_URL\" config=\"security.token_url\""}, {key: "no-keyring", text: "flag \"--no-keyring\" help=\"Never read or write the OS keychain; store secrets in the config file instead\" global=#true env=\"CLI_NO_KEYRING\" config=\"no_keyring\" default=#false"}, {key: "query-param1", text: "flag \"--query-param1 \" help=\"A long winded, multi-line description\" global=#true env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\""}, {key: "deprecated-query-param1", text: "flag \"--deprecated-query-param1 \" help=\"A deprecated description\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\""}, {key: "deprecated-query-param2", text: "flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" global=#true env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\""}, {key: "lone-query-param", text: "flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" global=#true env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\""}}, children: []string{"invite", "enroll", "render", "produce", "observe", "say", "archive", "test-group", "hello", "auth", "binary-and-string-upload", "chat", "completion", "configure", "create-user", "create-with-union", "delete-user", "explore", "get-asset", "get-binary-default-response", "get-duplicate-export-collision", "get-empty-object-error", "get-error-in-union", "get-error-only-example", "get-fully-flattened-request", "get-named-primitive-union", "get-nested-integer-string", "get-polymorphism", "get-positional-default", "get-request-body-flattened-away", "get-union-errors", "get-user", "group", "help", "login", "namespace-tests", "obsolete", "operation-with-leading-and-trailing-underscores", "parentheses-in-path-allowed", "post-file", "render-asset", "stream-metadata", "tag1", "test-endpoint", "test-enum-formats", "update-user", "url-validation-stress-test", "validate", "version", "whoami"}}, + "invite": {head: "cmd \"invite\" help=\"Invite a user by email\"", args: []usageItem{{key: "email", text: " arg \"email\" help=\"Email address to invite\" required=#true var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "given-name", text: " flag \"--given-name \" help=\"First name to record\""}, {key: "user-gender", text: " flag \"--user-gender \" help=\"Gender to record (e.g. male, female, other)\" {\n suggestions \"male\" \"female\" \"other\"\n }"}}}, + "enroll": {head: "cmd \"enroll\" help=\"Enroll a user by email\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "enrollment-email", text: " flag \"--enrollment-email \" help=\"Email address to enroll\""}}}, + "render": {head: "cmd \"render\" help=\"Render an image asset to a file\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render\" required=#true var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./render-{timestamp}-{rand}.{ext}\""}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}}}, + "produce": {head: "cmd \"produce\" help=\"Produce an image asset and wait for completion\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "out", text: " flag \"--out \" help=\"Write the image to this file (or into this directory). Default: ./produce-{timestamp}-{rand}.{ext}\""}, {key: "raw-response", text: " flag \"--raw-response\" help=\"Print the raw API response instead of writing the image to a file\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\""}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\""}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\""}}}, + "observe": {head: "cmd \"observe\" help=\"Produce an asset and print its terminal status\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Text prompt to render (create input; omit with --resume)\" var=#true"}}, flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "resume", text: " flag \"--resume \" help=\"Resume polling an existing operation by ID instead of creating one\""}, {key: "async", text: " flag \"--async\" help=\"Return the operation handle without waiting for a terminal response\""}, {key: "poll-interval", text: " flag \"--poll-interval \" help=\"Override the initial polling interval (positive Go duration, for example 500ms or 2s)\""}, {key: "poll-timeout", text: " flag \"--poll-timeout \" help=\"Override the overall polling deadline (positive Go duration, at least the effective poll interval)\""}}}, + "say": {head: "cmd \"say\" help=\"Stream a chat reply\"", args: []usageItem{{key: "prompt", text: " arg \"prompt\" help=\"Prompt to send\" required=#true var=#true"}}, flags: []usageItem{{key: "request", text: " flag \"--request \" help=\"Request body as JSON (advanced; merges with intent inputs, rejecting duplicate keys). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive (default: true)\" default=#true"}}}, "archive": {head: "cmd \"archive\" help=\"Archive a user account\""}, "test-group": {head: "cmd \"test-group\" help=\"Operations for test-group\"", aliases: []usageItem{{key: "tg", text: " alias \"tg\""}}, children: []string{"tag2", "tag3"}}, "test-group tag2": {head: "cmd \"tag2\" help=\"Operations for tag2\"", children: []string{"post-test"}}, - "test-group tag2 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"", value: true}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\"", short: "t", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "test-group tag2 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\""}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, "test-group tag3": {head: "cmd \"tag3\" help=\"Operations for tag3\"", children: []string{"post-test"}}, - "test-group tag3 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\"", value: true}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\"", short: "t", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "test-group tag3 post-test": {head: "cmd \"post-test\" help=\"Post Test2\"", aliases: []usageItem{{key: "pt", text: " alias \"pt\""}}, flags: []usageItem{{key: "obj", text: " flag \"--obj \" help=\"A simple object that uses all our supported primitive types and enums and has optional properties. [required]\""}, {key: "type", text: " flag \"-t --type \" help=\"options: type1, type2\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, "hello": {head: "cmd \"hello\" help=\"Hand-written command that survives regeneration\""}, "auth": {head: "cmd \"auth\" help=\"Manage authentication credentials\"", children: []string{"login", "logout", "whoami"}}, - "auth login": {head: "cmd \"login\" help=\"Interactively configure authentication credentials\"", flags: []usageItem{{key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true, value: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true, value: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true, value: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true, value: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true, value: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true, value: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true, value: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true, value: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true, value: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true, value: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true, value: true}}}, + "auth login": {head: "cmd \"login\" help=\"Interactively configure authentication credentials\"", flags: []usageItem{{key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true}}}, "auth logout": {head: "cmd \"logout\" help=\"Clear all stored authentication credentials\""}, "auth whoami": {head: "cmd \"whoami\" help=\"Display current authentication and global parameter configuration\""}, - "binary-and-string-upload": {head: "cmd \"binary-and-string-upload\" help=\"Binary And String Upload\"", aliases: []usageItem{{key: "basu", text: " alias \"basu\""}}, flags: []usageItem{{key: "binary", text: " flag \"-b --binary \" help=\"binary data (file: or b64:)\"", short: "b", value: true}, {key: "string", text: " flag \"-s --string \" help=\"string value\"", short: "s", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "chat": {head: "cmd \"chat\" help=\"Chat\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive\" default=#true"}, {key: "max-tokens", text: " flag \"--max-tokens \" help=\"Maximum number of tokens to generate\"", value: true}, {key: "temperature", text: " flag \"--temperature \" help=\"Sampling temperature\"", value: true}}}, + "binary-and-string-upload": {head: "cmd \"binary-and-string-upload\" help=\"Binary And String Upload\"", aliases: []usageItem{{key: "basu", text: " alias \"basu\""}}, flags: []usageItem{{key: "binary", text: " flag \"-b --binary \" help=\"binary data (file: or b64:)\""}, {key: "string", text: " flag \"-s --string \" help=\"string value\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "chat": {head: "cmd \"chat\" help=\"Chat\"", flags: []usageItem{{key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}, {key: "stream", text: " flag \"--stream\" help=\"Stream events as they arrive\" default=#true"}, {key: "max-tokens", text: " flag \"--max-tokens \" help=\"Maximum number of tokens to generate\""}, {key: "temperature", text: " flag \"--temperature \" help=\"Sampling temperature\""}}}, "completion": {head: "cmd \"completion\" help=\"Generate the autocompletion script for the specified shell\"", children: []string{"bash", "fish", "powershell", "zsh"}}, "completion bash": {head: "cmd \"bash\" help=\"Generate the autocompletion script for bash\""}, "completion fish": {head: "cmd \"fish\" help=\"Generate the autocompletion script for fish\""}, "completion powershell": {head: "cmd \"powershell\" help=\"Generate the autocompletion script for powershell\""}, "completion zsh": {head: "cmd \"zsh\" help=\"Generate the autocompletion script for zsh\""}, - "configure": {head: "cmd \"configure\" help=\"Configure authentication, global parameters, and preferences\"", flags: []usageItem{{key: "default-output-format", text: " flag \"--default-output-format \" help=\"Store the default output format without opening the form. Options: pretty, json, yaml, table, toon. Pass an empty value to clear it.\" {\n suggestions \"pretty\" \"json\" \"yaml\" \"table\" \"toon\"\n }", value: true}, {key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true, value: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true, value: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true, value: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true, value: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true, value: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true, value: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true, value: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true, value: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true, value: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true, value: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true, value: true}, {key: "query-param1", text: " flag \"--query-param1 \" help=\"A long winded, multi-line description\" env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"", settings: true, value: true}, {key: "deprecated-query-param1", text: " flag \"--deprecated-query-param1 \" help=\"A deprecated description\" env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"", settings: true, value: true}, {key: "deprecated-query-param2", text: " flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"", settings: true, value: true}, {key: "lone-query-param", text: " flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"", settings: true, value: true}}}, - "create-user": {head: "cmd \"create-user\" help=\"Create User\"", aliases: []usageItem{{key: "cu", text: " alias \"cu\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value\"", short: "i", value: true}, {key: "email", text: " flag \"-e --email \" help=\"[required]\"", short: "e", value: true}, {key: "first-name", text: " flag \"-f --first-name \" help=\"string value\"", short: "f", value: true}, {key: "last-name", text: " flag \"-l --last-name \" help=\"string value\"", short: "l", value: true}, {key: "age", text: " flag \"--age \" help=\"number value\"", value: true}, {key: "postal-code", text: " flag \"-p --postal-code \" help=\"string value\"", short: "p", value: true}, {key: "gender", text: " flag \"-g --gender \" help=\"options: male, female, other\"", short: "g", value: true}, {key: "associated-ids", text: " flag \"--associated-ids \" help=\"list of values\" var=#true", value: true, repeat: true}, {key: "metadata", text: " flag \"--metadata \" help=\"JSON object\"", value: true}, {key: "metadata-any", text: " flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "create-with-union": {head: "cmd \"create-with-union\" help=\"Create with discriminated union request body\"", aliases: []usageItem{{key: "cwu", text: " alias \"cwu\""}}, flags: []usageItem{{key: "dry-run-param", text: " flag \"--dry-run-param\" help=\"If true, validates without creating\""}, {key: "name", text: " flag \"-n --name \" help=\"Name for the shape [required]\"", short: "n", value: true}, {key: "shape", text: " flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\"", short: "s", value: true}, {key: "shape.circle", text: " flag \"--shape.circle \" help=\"Circle variant as JSON\"", value: true}, {key: "shape.circle.radius", text: " flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\"", value: true}, {key: "shape.circle.color-param", text: " flag \"--shape.circle.color-param \" help=\"Optional color of the circle\"", value: true}, {key: "shape.rectangle", text: " flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\"", value: true}, {key: "shape.rectangle.width", text: " flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\"", value: true}, {key: "shape.rectangle.height", text: " flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\"", value: true}, {key: "shape.rectangle.color-param", text: " flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\"", value: true}, {key: "description", text: " flag \"--description \" help=\"Optional description\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "delete-user": {head: "cmd \"delete-user\" help=\"Delete User\"", aliases: []usageItem{{key: "du", text: " alias \"du\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}}}, + "configure": {head: "cmd \"configure\" help=\"Configure authentication, global parameters, and preferences\"", flags: []usageItem{{key: "default-output-format", text: " flag \"--default-output-format \" help=\"Store the default output format without opening the form. Options: pretty, json, yaml, table, toon. Pass an empty value to clear it.\" {\n suggestions \"pretty\" \"json\" \"yaml\" \"table\" \"toon\"\n }"}, {key: "username", text: " flag \"--username \" help=\"HTTP Basic username\" env=\"CLI_USERNAME\" config=\"security.username\"", settings: true}, {key: "password", text: " flag \"--password \" help=\"HTTP Basic password\" env=\"CLI_PASSWORD\" config=\"security.password\"", settings: true}, {key: "bearer-auth", text: " flag \"--bearer-auth \" help=\"HTTP Bearer\" env=\"CLI_BEARER_AUTH\" config=\"security.bearer_auth\"", settings: true}, {key: "my-api-key", text: " flag \"--my-api-key \" help=\"API Key\" env=\"CLI_MY_API_KEY\" config=\"security.my_api_key\"", settings: true}, {key: "oauth2", text: " flag \"--oauth2 \" help=\"OAuth2 Authorization\" env=\"CLI_OAUTH2\" config=\"security.oauth2\"", settings: true}, {key: "app-id", text: " flag \"--app-id \" help=\"Custom authentication credential\" env=\"CLI_APP_ID\" config=\"security.app_id\"", settings: true}, {key: "secret", text: " flag \"--secret \" help=\"Custom authentication credential\" env=\"CLI_SECRET\" config=\"security.secret\"", settings: true}, {key: "mobile-auth", text: " flag \"--mobile-auth \" help=\"\"\"\n OAuth2 Password flow, a flow that is too\n long to describe in a single line.\n \"\"\" env=\"CLI_MOBILE_AUTH\" config=\"security.mobile_auth\"", settings: true}, {key: "client-id", text: " flag \"--client-id \" help=\"Client Credentials flow. client identifier\" env=\"CLI_CLIENT_ID\" config=\"security.client_id\"", settings: true}, {key: "client-secret", text: " flag \"--client-secret \" help=\"Client Credentials flow. client secret\" env=\"CLI_CLIENT_SECRET\" config=\"security.client_secret\"", settings: true}, {key: "token-url", text: " flag \"--token-url \" help=\"Client Credentials flow. token URL\" env=\"CLI_TOKEN_URL\" config=\"security.token_url\"", settings: true}, {key: "query-param1", text: " flag \"--query-param1 \" help=\"A long winded, multi-line description\" env=\"CLI_QUERY_PARAM1\" config=\"globals.query_param1\"", settings: true}, {key: "deprecated-query-param1", text: " flag \"--deprecated-query-param1 \" help=\"A deprecated description\" env=\"CLI_DEPRECATED_QUERY_PARAM1\" config=\"globals.deprecated_query_param1\"", settings: true}, {key: "deprecated-query-param2", text: " flag \"--deprecated-query-param2 \" help=\"Global deprecated-query-param2 parameter\" env=\"CLI_DEPRECATED_QUERY_PARAM2\" config=\"globals.deprecated_query_param2\"", settings: true}, {key: "lone-query-param", text: " flag \"--lone-query-param \" help=\"Global lone-query-param parameter\" env=\"CLI_LONE_QUERY_PARAM\" config=\"globals.lone_query_param\"", settings: true}}}, + "create-user": {head: "cmd \"create-user\" help=\"Create User\"", aliases: []usageItem{{key: "cu", text: " alias \"cu\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value\""}, {key: "email", text: " flag \"-e --email \" help=\"[required]\""}, {key: "first-name", text: " flag \"-f --first-name \" help=\"string value\""}, {key: "last-name", text: " flag \"-l --last-name \" help=\"string value\""}, {key: "age", text: " flag \"--age \" help=\"number value\""}, {key: "postal-code", text: " flag \"-p --postal-code \" help=\"string value\""}, {key: "gender", text: " flag \"-g --gender \" help=\"options: male, female, other\""}, {key: "associated-ids", text: " flag \"--associated-ids \" help=\"list of values\" var=#true"}, {key: "metadata", text: " flag \"--metadata \" help=\"JSON object\""}, {key: "metadata-any", text: " flag \"--metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "create-with-union": {head: "cmd \"create-with-union\" help=\"Create with discriminated union request body\"", aliases: []usageItem{{key: "cwu", text: " alias \"cwu\""}}, flags: []usageItem{{key: "dry-run-param", text: " flag \"--dry-run-param\" help=\"If true, validates without creating\""}, {key: "name", text: " flag \"-n --name \" help=\"Name for the shape [required]\""}, {key: "shape", text: " flag \"-s --shape \" help=\"{ \\\"type\\\": string, \\\"radius\\\": number, ... } | { \\\"type\\\": string, \\\"width\\\": number, \\\"height\\\": number, ... }\""}, {key: "shape.circle", text: " flag \"--shape.circle \" help=\"Circle variant as JSON\""}, {key: "shape.circle.radius", text: " flag \"--shape.circle.radius \" help=\"The radius of the circle [required]\""}, {key: "shape.circle.color-param", text: " flag \"--shape.circle.color-param \" help=\"Optional color of the circle\""}, {key: "shape.rectangle", text: " flag \"--shape.rectangle \" help=\"Rectangle variant as JSON\""}, {key: "shape.rectangle.width", text: " flag \"--shape.rectangle.width \" help=\"The width of the rectangle [required]\""}, {key: "shape.rectangle.height", text: " flag \"--shape.rectangle.height \" help=\"The height of the rectangle [required]\""}, {key: "shape.rectangle.color-param", text: " flag \"--shape.rectangle.color-param \" help=\"Optional color of the rectangle\""}, {key: "description", text: " flag \"--description \" help=\"Optional description\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "delete-user": {head: "cmd \"delete-user\" help=\"Delete User\"", aliases: []usageItem{{key: "du", text: " alias \"du\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}}}, "explore": {head: "cmd \"explore\" help=\"Interactively browse and run commands\""}, - "get-asset": {head: "cmd \"get-asset\" help=\"Get Asset\"", aliases: []usageItem{{key: "ga", text: " alias \"ga\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\"", short: "i", value: true}, {key: "stream", text: " flag \"-s --stream\" help=\"boolean flag\" default=#true", short: "s"}}}, - "get-binary-default-response": {head: "cmd \"get-binary-default-response\" help=\"Get Binary Default Response\"", aliases: []usageItem{{key: "gbdr", text: " alias \"gbdr\""}}, flags: []usageItem{{key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "get-asset": {head: "cmd \"get-asset\" help=\"Get Asset\"", aliases: []usageItem{{key: "ga", text: " alias \"ga\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "stream", text: " flag \"-s --stream\" help=\"boolean flag\" default=#true"}}}, + "get-binary-default-response": {head: "cmd \"get-binary-default-response\" help=\"Get Binary Default Response\"", aliases: []usageItem{{key: "gbdr", text: " alias \"gbdr\""}}, flags: []usageItem{{key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, "get-duplicate-export-collision": {head: "cmd \"get-duplicate-export-collision\" help=\"Tests that a spec-defined error type colliding with a built-in SDK error name does not cause TS2308\"", aliases: []usageItem{{key: "gdec", text: " alias \"gdec\""}}}, "get-empty-object-error": {head: "cmd \"get-empty-object-error\" help=\"Get Empty Object Error\"", aliases: []usageItem{{key: "geoe", text: " alias \"geoe\""}}}, "get-error-in-union": {head: "cmd \"get-error-in-union\" help=\"Get Error In Union\"", aliases: []usageItem{{key: "geiu", text: " alias \"geiu\""}}}, "get-error-only-example": {head: "cmd \"get-error-only-example\" help=\"Operation with example only on error response\"", aliases: []usageItem{{key: "geoex", text: " alias \"geoex\""}}}, - "get-fully-flattened-request": {head: "cmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\"", aliases: []usageItem{{key: "gffr", text: " alias \"gffr\""}}, flags: []usageItem{{key: "lang", text: " flag \"-l --lang \" help=\"[required]\"", short: "l", value: true}, {key: "max-length", text: " flag \"-m --max-length \" help=\"integer value\"", short: "m", value: true}, {key: "name", text: " flag \"-n --name \" help=\"[required]\"", short: "n", value: true}, {key: "emoji", text: " flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\"", short: "e", value: true}, {key: "gif", text: " flag \"-g --gif \" help=\"string value\"", short: "g", value: true}, {key: "reply", text: " flag \"-r --reply\" help=\"boolean flag\"", short: "r"}, {key: "private", text: " flag \"-p --private\" help=\"boolean flag\"", short: "p"}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "get-fully-flattened-request": {head: "cmd \"get-fully-flattened-request\" help=\"Get Fully Flattened Request\"", aliases: []usageItem{{key: "gffr", text: " alias \"gffr\""}}, flags: []usageItem{{key: "lang", text: " flag \"-l --lang \" help=\"[required]\""}, {key: "max-length", text: " flag \"-m --max-length \" help=\"integer value\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "emoji", text: " flag \"-e --emoji \" help=\"options: wave, smiley, thumbsup, tada\""}, {key: "gif", text: " flag \"-g --gif \" help=\"string value\""}, {key: "reply", text: " flag \"-r --reply\" help=\"boolean flag\""}, {key: "private", text: " flag \"-p --private\" help=\"boolean flag\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "get-named-primitive-union": {head: "cmd \"get-named-primitive-union\" help=\"Test named primitive union options using title and x-speakeasy-name-override\"", aliases: []usageItem{{key: "gnpu", text: " alias \"gnpu\""}}}, "get-nested-integer-string": {head: "cmd \"get-nested-integer-string\" help=\"Test nested struct with integer:string tag\"", aliases: []usageItem{{key: "gnis", text: " alias \"gnis\""}}}, "get-polymorphism": {head: "cmd \"get-polymorphism\" help=\"Get Polymorphism\"", aliases: []usageItem{{key: "gp", text: " alias \"gp\""}}}, - "get-positional-default": {head: "cmd \"get-positional-default\" help=\"Get an item with a default path identifier\"", aliases: []usageItem{{key: "gpd", text: " alias \"gpd\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\"", short: "i", value: true}}}, + "get-positional-default": {head: "cmd \"get-positional-default\" help=\"Get an item with a default path identifier\"", aliases: []usageItem{{key: "gpd", text: " alias \"gpd\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\" default=\"default-id\""}}}, "get-request-body-flattened-away": {head: "cmd \"get-request-body-flattened-away\" help=\"Get Request Body Flattened Away\"", aliases: []usageItem{{key: "grbfa", text: " alias \"grbfa\""}}}, - "get-union-errors": {head: "cmd \"get-union-errors\" help=\"Get Union Errors\"", aliases: []usageItem{{key: "gue", text: " alias \"gue\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\"", short: "p", value: true}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"", short: "a"}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0", value: true}}}, - "get-user": {head: "cmd \"get-user\" help=\"Get User\"", aliases: []usageItem{{key: "gu", text: " alias \"gu\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}}}, + "get-union-errors": {head: "cmd \"get-union-errors\" help=\"Get Union Errors\"", aliases: []usageItem{{key: "gue", text: " alias \"gue\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\""}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\""}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0"}}}, + "get-user": {head: "cmd \"get-user\" help=\"Get User\"", aliases: []usageItem{{key: "gu", text: " alias \"gu\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}}}, "group": {head: "cmd \"group\" help=\"Operations for group\"", children: []string{"root-group-op", "sub"}}, "group root-group-op": {head: "cmd \"root-group-op\" help=\"An operation at the group's root level\"", aliases: []usageItem{{key: "rgo", text: " alias \"rgo\""}}}, "group sub": {head: "cmd \"sub\" help=\"Operations for sub-group\"", children: []string{"empty", "op"}}, @@ -86,15 +83,15 @@ var usageNodes = map[string]usageNode{ "login": {head: "cmd \"login\" help=\"Login\""}, "namespace-tests": {head: "cmd \"namespace-tests\" help=\"Operations for namespace-tests\"", aliases: []usageItem{{key: "nt", text: " alias \"nt\""}}, children: []string{"conflicts", "single-bar", "single-foo", "types"}}, "namespace-tests conflicts": {head: "cmd \"conflicts\" help=\"Operations for conflicts\"", children: []string{"create-namespace", "get-namespace", "get-pet-owners", "get-triple-namespace", "put-namespace"}}, - "namespace-tests conflicts create-namespace": {head: "cmd \"create-namespace\" help=\"Create Namespace Conflict Test\"", aliases: []usageItem{{key: "cn", text: " alias \"cn\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\"", short: "i", value: true}, {key: "name", text: " flag \"-n --name \" help=\"[required]\"", short: "n", value: true}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"", short: "s", value: true}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\"", short: "m", value: true}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\"", short: "r", value: true}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\"", value: true}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\"", short: "e", value: true}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\"", short: "u", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests conflicts create-namespace": {head: "cmd \"create-namespace\" help=\"Create Namespace Conflict Test\"", aliases: []usageItem{{key: "cn", text: " alias \"cn\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\""}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\""}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\""}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\""}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\""}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "namespace-tests conflicts get-namespace": {head: "cmd \"get-namespace\" help=\"Get Namespace Conflict Test\"", aliases: []usageItem{{key: "gn", text: " alias \"gn\""}}}, "namespace-tests conflicts get-pet-owners": {head: "cmd \"get-pet-owners\" help=\"Get Pet Owners\"", aliases: []usageItem{{key: "gpo", text: " alias \"gpo\""}}}, "namespace-tests conflicts get-triple-namespace": {head: "cmd \"get-triple-namespace\" help=\"Get Triple Namespace Conflict Test\"", aliases: []usageItem{{key: "gtn", text: " alias \"gtn\""}}}, - "namespace-tests conflicts put-namespace": {head: "cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\"", aliases: []usageItem{{key: "pn", text: " alias \"pn\""}}, flags: []usageItem{{key: "direct", text: " flag \"--direct \" help=\"JSON object\"", value: true}, {key: "namespaced", text: " flag \"-n --namespaced \" help=\"JSON object\"", short: "n", value: true}, {key: "overridden", text: " flag \"--overridden \" help=\"JSON object\"", value: true}, {key: "allof", text: " flag \"-a --allof \" help=\"JSON object\"", short: "a", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests conflicts put-namespace": {head: "cmd \"put-namespace\" help=\"Put Property Name Conflicts Behind\"", aliases: []usageItem{{key: "pn", text: " alias \"pn\""}}, flags: []usageItem{{key: "direct", text: " flag \"--direct \" help=\"JSON object\""}, {key: "namespaced", text: " flag \"-n --namespaced \" help=\"JSON object\""}, {key: "overridden", text: " flag \"--overridden \" help=\"JSON object\""}, {key: "allof", text: " flag \"-a --allof \" help=\"JSON object\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "namespace-tests single-bar": {head: "cmd \"single-bar\" help=\"Operations for single-bar\"", aliases: []usageItem{{key: "sb", text: " alias \"sb\""}}, children: []string{"get-single-namespace-bar-pet"}}, "namespace-tests single-bar get-single-namespace-bar-pet": {head: "cmd \"get-single-namespace-bar-pet\" help=\"Get Single Namespace Bar Pet\"", aliases: []usageItem{{key: "gsnbp", text: " alias \"gsnbp\""}}}, "namespace-tests single-foo": {head: "cmd \"single-foo\" help=\"Operations for single-foo\"", aliases: []usageItem{{key: "sf", text: " alias \"sf\""}}, children: []string{"create-single-namespace-foo-pet", "get-single-namespace-foo-pet"}}, - "namespace-tests single-foo create-single-namespace-foo-pet": {head: "cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\"", aliases: []usageItem{{key: "csnfp", text: " alias \"csnfp\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\"", short: "i", value: true}, {key: "name", text: " flag \"-n --name \" help=\"[required]\"", short: "n", value: true}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\"", short: "s", value: true}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\"", short: "m", value: true}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\"", short: "r", value: true}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\"", value: true}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\"", short: "e", value: true}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\"", short: "u", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "namespace-tests single-foo create-single-namespace-foo-pet": {head: "cmd \"create-single-namespace-foo-pet\" help=\"Create Single Namespace Foo Pet\"", aliases: []usageItem{{key: "csnfp", text: " alias \"csnfp\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"[required]\""}, {key: "name", text: " flag \"-n --name \" help=\"[required]\""}, {key: "species", text: " flag \"-s --species \" help=\"The species of the pet (e.g., dog, cat) [required]\""}, {key: "models", text: " flag \"-m --models \" help=\"A field name that often collides\""}, {key: "request", text: " flag \"-r --request \" help=\"A field name that often collides\""}, {key: "operations", text: " flag \"--operations \" help=\"A field name that often collides\""}, {key: "errors", text: " flag \"-e --errors \" help=\"A field name that often collides\""}, {key: "utils", text: " flag \"-u --utils \" help=\"A field name that often collides\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "namespace-tests single-foo get-single-namespace-foo-pet": {head: "cmd \"get-single-namespace-foo-pet\" help=\"Get Single Namespace Foo Pet\"", aliases: []usageItem{{key: "gsnfp", text: " alias \"gsnfp\""}}}, "namespace-tests types": {head: "cmd \"types\" help=\"Operations for types\"", children: []string{"get-namespace", "get-namespace-animal", "get-namespace-organization", "get-namespace-vehicle"}}, "namespace-tests types get-namespace": {head: "cmd \"get-namespace\" help=\"Get Namespace Types Test\"", aliases: []usageItem{{key: "gn", text: " alias \"gn\""}}}, @@ -103,20 +100,20 @@ var usageNodes = map[string]usageNode{ "namespace-tests types get-namespace-vehicle": {head: "cmd \"get-namespace-vehicle\" help=\"Get Namespace Vehicle (Non-Discriminated Union)\"", aliases: []usageItem{{key: "gnv", text: " alias \"gnv\""}}}, "obsolete": {head: "cmd \"obsolete\" help=\"A subSDK in which all operations are deprecated\"", children: []string{"deprecated1"}}, "obsolete deprecated1": {head: "cmd \"deprecated1\" help=\"Deprecated Operation\""}, - "operation-with-leading-and-trailing-underscores": {head: "cmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\"", aliases: []usageItem{{key: "owlatu", text: " alias \"owlatu\""}}, flags: []usageItem{{key: "qp1", text: " flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\"", value: true}}}, - "parentheses-in-path-allowed": {head: "cmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\"", aliases: []usageItem{{key: "pipa", text: " alias \"pipa\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}, {key: "field-with-braces-in-description", text: " flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\"", value: true}, {key: "field-with-braces-in-default", text: " flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\"", value: true}, {key: "field-with-braces-in-title", text: " flag \"--field-with-braces-in-title \" help=\"string value\"", value: true}, {key: "field-with-braces-in-example", text: " flag \"--field-with-braces-in-example \" help=\"string value\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "post-file": {head: "cmd \"post-file\" help=\"Post File\"", aliases: []usageItem{{key: "pf", text: " alias \"pf\""}}, flags: []usageItem{{key: "upload", text: " flag \"-u --upload \" help=\"A file\"", short: "u", value: true}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\"", value: true}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, - "render-asset": {head: "cmd \"render-asset\" help=\"Render Asset\"", aliases: []usageItem{{key: "ra", text: " alias \"ra\""}}, flags: []usageItem{{key: "prompt", text: " flag \"-p --prompt \" help=\"[required]\"", short: "p", value: true}, {key: "output-modalities", text: " flag \"--output-modalities \" help=\"options: text, image\" var=#true", value: true, repeat: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "operation-with-leading-and-trailing-underscores": {head: "cmd \"operation-with-leading-and-trailing-underscores\" help=\"Operation With Leading And Trailing Underscores\"", aliases: []usageItem{{key: "owlatu", text: " alias \"owlatu\""}}, flags: []usageItem{{key: "qp1", text: " flag \"--qp1 \" help=\"This parameter will not be filled in with the queryParam1 global because it uses x-speakeasy-name-override which results in a non-matching name. [required]\""}}}, + "parentheses-in-path-allowed": {head: "cmd \"parentheses-in-path-allowed\" help=\"A string with \\\\x7b\\\\x7b double braces \\\\x7d\\\\x7d and { single braces }\\\\nand \\\\\\\\{\\\\\\\\{ escaped curlies \\\\\\\\}\\\\\\\\} and `backticks`.\\\\nand \\\\\\\\`escaped backticks\\\\\\\\` and double slashes\\\\\\\\\\\\\\\\\\\\nand 'single quotes' and \\\\\\\"double quotes\\\\\\\".\\\\nand \\\\\\\\'escaped single quotes\\\\\\\\' and \\\\\\\\\\\\\\\"escaped double quotes\\\\\\\\\\\\\\\".\"", aliases: []usageItem{{key: "pipa", text: " alias \"pipa\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}, {key: "field-with-braces-in-description", text: " flag \"--field-with-braces-in-description \" help=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and 'backticks'.\n and \\\\'escaped backticks\\\\' and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n \"\"\""}, {key: "field-with-braces-in-default", text: " flag \"--field-with-braces-in-default \" help=\"string value\" default=\"\"\"\n A string with " + string([]byte{'{', '{'}) + " double braces " + string([]byte{'}', '}'}) + " and { single braces }\n and \\\\{\\\\{ escaped curlies \\\\}\\\\} and `backticks`.\n and \\\\`escaped backticks\\\\` and double slashes\\\\\\\\\n and 'single quotes' and \"double quotes\".\n and \\\\'escaped single quotes\\\\' and \\\\\"escaped double quotes\\\\\".\n\n \"\"\""}, {key: "field-with-braces-in-title", text: " flag \"--field-with-braces-in-title \" help=\"string value\""}, {key: "field-with-braces-in-example", text: " flag \"--field-with-braces-in-example \" help=\"string value\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "post-file": {head: "cmd \"post-file\" help=\"Post File\"", aliases: []usageItem{{key: "pf", text: " alias \"pf\""}}, flags: []usageItem{{key: "upload", text: " flag \"-u --upload \" help=\"A file\""}, {key: "output-file", text: " flag \"--output-file \" help=\"Save the response body to a file path (recommended for binary/file responses)\""}, {key: "output-b64", text: " flag \"--output-b64\" help=\"Encode binary response as base64 and print to stdout\""}}}, + "render-asset": {head: "cmd \"render-asset\" help=\"Render Asset\"", aliases: []usageItem{{key: "ra", text: " alias \"ra\""}}, flags: []usageItem{{key: "prompt", text: " flag \"-p --prompt \" help=\"[required]\""}, {key: "output-modalities", text: " flag \"--output-modalities \" help=\"options: text, image\" var=#true"}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "stream-metadata": {head: "cmd \"stream-metadata\" help=\"Streamed events can contain text and an optional resource identifier in separate events.\"", aliases: []usageItem{{key: "sm", text: " alias \"sm\""}}}, "tag1": {head: "cmd \"tag1\" help=\"The first tag\"", children: []string{"recent", "auth", "deprecated1", "list-test1", "post-file-with-encoding"}}, - "tag1 recent": {head: "cmd \"recent\" help=\"List recent test1 pages via tag1\"", flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\"", short: "p", value: true}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"", value: true}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\"", value: true}}}, - "tag1 auth": {head: "cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\"", flags: []usageItem{{key: "access-token", text: " flag \"--access-token \" help=\"Security credential\"", value: true}}}, + "tag1 recent": {head: "cmd \"recent\" help=\"List recent test1 pages via tag1\"", flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"[required]\""}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\""}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\""}}}, + "tag1 auth": {head: "cmd \"auth\" help=\"\"\"\n This operation aims at testing available OAuth2 scopes collection:\n - only operation with oauth2 authorizationCode security flow\n - belongs to a subSDK\n \"\"\"", flags: []usageItem{{key: "access-token", text: " flag \"--access-token \" help=\"Security credential\""}}}, "tag1 deprecated1": {head: "cmd \"deprecated1\" help=\"Deprecated Operation\""}, - "tag1 list-test1": {head: "cmd \"list-test1\" help=\"Get Test1\"", aliases: []usageItem{{key: "lt", text: " alias \"lt\""}}, args: []usageItem{{key: "page", text: " arg \"page\" help=\"integer value (or use --page)\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\"", short: "p", value: true}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\"", value: true}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\"", value: true}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\"", short: "a"}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0", value: true}}}, - "tag1 post-file-with-encoding": {head: "cmd \"post-file-with-encoding\" help=\"Post File With Encoding\"", aliases: []usageItem{{key: "pfwe", text: " alias \"pfwe\""}}, flags: []usageItem{{key: "file", text: " flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\"", value: true}, {key: "attachment", text: " flag \"-a --attachment \" help=\"An optional binary attachment\"", short: "a", value: true}, {key: "file-name", text: " flag \"--file-name \" help=\"Optional custom file name\"", value: true}, {key: "file-purpose", text: " flag \"--file-purpose \" help=\"Purpose of the file upload\"", value: true}, {key: "metadata", text: " flag \"-m --metadata \" help=\"JSON metadata about the file\"", short: "m", value: true}}}, - "test-endpoint": {head: "cmd \"test-endpoint\" help=\"Test Endpoint\"", aliases: []usageItem{{key: "te", text: " alias \"te\""}}, args: []usageItem{{key: "test-name", text: " arg \"test-name\" help=\"string value (or use --test-name)\""}}, flags: []usageItem{{key: "test-name", text: " flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\"", short: "t", value: true}, {key: "test", text: " flag \"--test \" help=\"[required]\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "test-enum-formats": {head: "cmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\"", aliases: []usageItem{{key: "tef", text: " alias \"tef\""}}, flags: []usageItem{{key: "string-array-format", text: " flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\"", value: true}, {key: "string-map-format", text: " flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\"", value: true}, {key: "string-partial-map-format", text: " flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\"", value: true}, {key: "integer-map-format", text: " flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\"", value: true}, {key: "integer-partial-map-format", text: " flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, - "update-user": {head: "cmd \"update-user\" help=\"Update User\"", aliases: []usageItem{{key: "uu", text: " alias \"uu\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\"", short: "i", value: true}, {key: "user.id", text: " flag \"--user.id \" help=\"[required]\"", value: true}, {key: "user.email", text: " flag \"--user.email \" help=\"[required]\"", value: true}, {key: "user.first-name", text: " flag \"--user.first-name \" help=\"string value\"", value: true}, {key: "user.last-name", text: " flag \"--user.last-name \" help=\"string value\"", value: true}, {key: "user.age", text: " flag \"--user.age \" help=\"number value\"", value: true}, {key: "user.postal-code", text: " flag \"--user.postal-code \" help=\"string value\"", value: true}, {key: "user.gender", text: " flag \"--user.gender \" help=\"options: male, female, other\"", value: true}, {key: "user.associated-ids", text: " flag \"--user.associated-ids \" help=\"list of values\" var=#true", value: true, repeat: true}, {key: "user.metadata", text: " flag \"--user.metadata \" help=\"JSON object\"", value: true}, {key: "user.metadata-any", text: " flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\"", value: true}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\"", value: true}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "tag1 list-test1": {head: "cmd \"list-test1\" help=\"Get Test1\"", aliases: []usageItem{{key: "lt", text: " alias \"lt\""}}, args: []usageItem{{key: "page", text: " arg \"page\" help=\"integer value (or use --page)\""}}, flags: []usageItem{{key: "page", text: " flag \"-p --page \" help=\"integer value (or pass it as the [page] argument)\""}, {key: "query-param2", text: " flag \"--query-param2 \" help=\"\"\"\n An [enum](https://enum.com) \"query parameter\"\n that is not easily described in a single line.\n\n **Available Values:**\n | Value | Description |\n |-------|-------------|\n | 0 | No data |\n | 1 | Partial |\n | 2 | Complete |\n (options: 0, 1, 2) [required]\n \"\"\""}, {key: "header-param1", text: " flag \"--header-param1 \" help=\"[required]\""}, {key: "all", text: " flag \"-a --all\" help=\"Automatically paginate and fetch all results (streams NDJSON for JSON output)\""}, {key: "max-pages", text: " flag \"--max-pages \" help=\"Maximum number of pages to fetch when using --all (0 = no limit)\" default=0"}}}, + "tag1 post-file-with-encoding": {head: "cmd \"post-file-with-encoding\" help=\"Post File With Encoding\"", aliases: []usageItem{{key: "pfwe", text: " alias \"pfwe\""}}, flags: []usageItem{{key: "file", text: " flag \"--file \" help=\"The file to upload (supports CSV, PNG, JPEG, or PDF)\""}, {key: "attachment", text: " flag \"-a --attachment \" help=\"An optional binary attachment\""}, {key: "file-name", text: " flag \"--file-name \" help=\"Optional custom file name\""}, {key: "file-purpose", text: " flag \"--file-purpose \" help=\"Purpose of the file upload\""}, {key: "metadata", text: " flag \"-m --metadata \" help=\"JSON metadata about the file\""}}}, + "test-endpoint": {head: "cmd \"test-endpoint\" help=\"Test Endpoint\"", aliases: []usageItem{{key: "te", text: " alias \"te\""}}, args: []usageItem{{key: "test-name", text: " arg \"test-name\" help=\"string value (or use --test-name)\""}}, flags: []usageItem{{key: "test-name", text: " flag \"-t --test-name \" help=\"string value (or pass it as the [test-name] argument)\""}, {key: "test", text: " flag \"--test \" help=\"[required]\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "test-enum-formats": {head: "cmd \"test-enum-formats\" help=\"Test x-speakeasy-enums in different formats\"", aliases: []usageItem{{key: "tef", text: " alias \"tef\""}}, flags: []usageItem{{key: "string-array-format", text: " flag \"--string-array-format \" help=\"String enum with x-speakeasy-enums as array (full coverage) (options: pending_review, approved_final, rejected_permanently, arch_x86, mobile_ios, custom_field) [required]\""}, {key: "string-map-format", text: " flag \"--string-map-format \" help=\"String enum with x-speakeasy-enums as map (full coverage) (options: low_priority, medium_priority, high_priority, critical_urgent) [required]\""}, {key: "string-partial-map-format", text: " flag \"--string-partial-map-format \" help=\"String enum with x-speakeasy-enums as map (partial coverage) (options: draft_mode, under_review, published_live, archived_old) [required]\""}, {key: "integer-map-format", text: " flag \"--integer-map-format \" help=\"Integer enum with x-speakeasy-enums as map (full coverage) (options: 100, 200, 300, 400) [required]\""}, {key: "integer-partial-map-format", text: " flag \"--integer-partial-map-format \" help=\"Integer enum with x-speakeasy-enums as map (partial coverage) (options: 1, 2, 3, 4, 5) [required]\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, + "update-user": {head: "cmd \"update-user\" help=\"Update User\"", aliases: []usageItem{{key: "uu", text: " alias \"uu\""}}, args: []usageItem{{key: "id", text: " arg \"id\" help=\"string value (or use --id)\""}}, flags: []usageItem{{key: "id", text: " flag \"-i --id \" help=\"string value (or pass it as the [id] argument)\""}, {key: "user.id", text: " flag \"--user.id \" help=\"[required]\""}, {key: "user.email", text: " flag \"--user.email \" help=\"[required]\""}, {key: "user.first-name", text: " flag \"--user.first-name \" help=\"string value\""}, {key: "user.last-name", text: " flag \"--user.last-name \" help=\"string value\""}, {key: "user.age", text: " flag \"--user.age \" help=\"number value\""}, {key: "user.postal-code", text: " flag \"--user.postal-code \" help=\"string value\""}, {key: "user.gender", text: " flag \"--user.gender \" help=\"options: male, female, other\""}, {key: "user.associated-ids", text: " flag \"--user.associated-ids \" help=\"list of values\" var=#true"}, {key: "user.metadata", text: " flag \"--user.metadata \" help=\"JSON object\""}, {key: "user.metadata-any", text: " flag \"--user.metadata-any \" help=\"A metadata object with additionalProperties true (any type) - should be flattened\""}, {key: "body", text: " flag \"--body \" help=\"Request body as JSON (alternative to individual flags). Can also be provided via stdin; @path reads a file, @- reads stdin to EOF. Use --schema to print the exact JSON Schema.\""}, {key: "schema", text: " flag \"--schema\" help=\"Print the exact JSON Schema of the request body and exit\""}}}, "url-validation-stress-test": {head: "cmd \"url-validation-stress-test\" help=\"Url Validation Stress Test\"", aliases: []usageItem{{key: "uvst", text: " alias \"uvst\""}}}, "validate": {head: "cmd \"validate\" help=\"Validate\""}, "version": {head: "cmd \"version\" help=\"Print the CLI version\""}, @@ -200,8 +197,9 @@ func EmitSchema(cmd *cobra.Command, w io.Writer) error { } const ( - usageDynamicAnnotation = "speakeasy_usage_dynamic" - usageRootName = "cli" + usageDynamicAnnotation = "speakeasy_usage_dynamic" + usageGeneratedAnnotation = "speakeasy_usage_generated" + usageRootName = "cli" ) func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent int, own, tabled bool) { @@ -211,6 +209,9 @@ func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent if tabled { node, static = usageNodes[path] } + if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != "true" { + node, static = usageNode{children: node.children}, false + } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" itemPrefix := " " if isRoot { @@ -297,13 +298,7 @@ func mergedUsageBody(cmd *cobra.Command, node usageNode, own bool, prefix string for _, flag := range node.flags { listed[flag.key] = true f := cmd.Flags().Lookup(flag.key) - switch { - case f == nil || (!own && flag.settings): - case !usageFlagUnchanged(flag, f): - if !f.Hidden { - body = append(body, liveUsageFlag(f, prefix)) - } - case flag.hidden || !f.Hidden: + if f != nil && (own || !flag.settings) && (flag.hidden || !f.Hidden) { body = append(body, flag.text) } } @@ -356,6 +351,18 @@ func MarkDynamic(cmd *cobra.Command) { cmd.Annotations[usageDynamicAnnotation] = "true" } +// MarkGenerated records cmd and its subtree as the generated commands the +// usageNodes table describes; a same-named command attached later renders live. +func MarkGenerated(cmd *cobra.Command) { + if cmd.Annotations == nil { + cmd.Annotations = map[string]string{} + } + cmd.Annotations[usageGeneratedAnnotation] = "true" + for _, child := range cmd.Commands() { + MarkGenerated(child) + } +} + // Go's %q emits \a, \v, and \xNN escapes that KDL v2 does not define. func kdlQuote(s string) string { var b strings.Builder @@ -449,11 +456,6 @@ func kdlQuoteAt(s, contentPrefix string) string { return b.String() } -func usageFlagUnchanged(item usageItem, f *pflag.Flag) bool { - _, repeat := f.Value.(pflag.SliceValue) - return f.Shorthand == item.short && (f.NoOptDefVal == "") == item.value && repeat == item.repeat -} - func usageArgsUnchanged(generated []usageItem, live []usagePromptArg) bool { if len(generated) == 0 || len(generated) != len(live) { return false diff --git a/zSDKs/sdk-cli/tests/usage_test.go b/zSDKs/sdk-cli/tests/usage_test.go index 2bbf1908e..f51e13b69 100644 --- a/zSDKs/sdk-cli/tests/usage_test.go +++ b/zSDKs/sdk-cli/tests/usage_test.go @@ -305,6 +305,36 @@ func TestUsageSchema_ReplacedCommandDropsStaleFlagSyntax(t *testing.T) { assert.NotContains(t, own.String(), "") } +func TestUsageSchema_ReplacedCommandRendersLive(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + original, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + root.RemoveCommand(original) + replacement := &cobra.Command{Use: "configure", Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} + replacement.Flags().String("default-output-format", "", "New string") + root.AddCommand(replacement) + + block := "cmd \"configure\" help=\"Replacement\" {\n flag \"--default-output-format \" help=\"New string\"\n}\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + assert.Equal(t, block, own.String()) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\n"+block) +} + +func TestUsageSchema_GeneratedCommandsMarked(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + for _, path := range [][]string{{"version"}, {"configure"}, {"help"}, {"completion"}, {"completion", "bash"}} { + cmd, _, err := root.Find(path) + require.NoError(t, err) + assert.Equal(t, "true", cmd.Annotations["speakeasy_usage_generated"], strings.Join(path, " ")) + } +} + func TestUsageSchema_DetachedCommand(t *testing.T) { leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder @@ -407,7 +437,6 @@ func TestUsageSchema_ReplacedIntentDropsStaleArgs(t *testing.T) { parent.RemoveCommand(original) replacement := &cobra.Command{Use: original.Name(), Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} parent.AddCommand(replacement) - usage.MarkDynamic(replacement) var own strings.Builder require.NoError(t, usage.EmitSchema(replacement, &own)) From f9c5d6f6d1fdd46bc865eda9adef3beab1b2f467 Mon Sep 17 00:00:00 2001 From: 2ynn Date: Mon, 19 Oct 2026 11:48:21 -0400 Subject: [PATCH 6/7] test(cli): check ancestor schema for replaced intents; correct --usage validation docs - `TestUsageSchema_ReplacedIntentDropsStaleArgs` now asserts the exact own schema of the replacement and that root `--usage` renders it as a bare node at its depth, without the generated `arg` lines. - README: under `--usage`, required-flag validation cannot fail (`output.InstallErrorHandling` clears the required-flag annotations via `usage.DisarmRequiredFlags` and re-arms them after `RunE`); only Cobra's flag-group validators can still win. Review SDK regenerated. --- templates/templates/cli/README.md | 2 +- templates/templates/cli/usage_test.go.stmpl | 9 +++++++-- zSDKs/sdk-cli/.speakeasy/gen.lock | 2 +- zSDKs/sdk-cli/tests/usage_test.go | 9 +++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/templates/templates/cli/README.md b/templates/templates/cli/README.md index ecd4a3b6c..ad20f1e64 100644 --- a/templates/templates/cli/README.md +++ b/templates/templates/cli/README.md @@ -1395,7 +1395,7 @@ The KDL schema is built at generation time from the command tree in `includes/us Declared commands (`x-speakeasy-cli-commands`) are part of the schema: bound intents mount into the KDL tree under their declared parent path with the same flag surface the runtime registers (declared positional `arg` nodes, operation security flags, the body flag, `--schema`, and declared flags — plus non-body parameter metadata for JSON-body intents (multipart intents keep their upload fields); `buildIntentUsageCommand` in `includes/usage.ts`), and planned placeholders appear with their summary. For commands added after static schema generation, live schema emission reads `speakeasy_prompt_args` and emits the same `arg` nodes. Once Cobra validation succeeds, `--usage` on an intent or planned command emits KDL and wins over the command's other runtime surfaces, including `--schema` and the bare-invocation usage error (`runIntent*Cmd` in `intentcmd.go.stmpl` and `newPlannedCmd` in `intents.go.stmpl` check `usage.UsageRequested` first, matching operation commands). -**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun required-flag/flag-group validators can win. `output.InstallErrorHandling` skips its eager typed copy of the latter two checks under `--usage`, but does not suppress Cobra's originals; such failures retain Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. `NewRootCommand` calls `usage.MarkGenerated` on the tree right before `custom.Register` (and on cobra's `help`/`completion` once created): only marked commands under the generated root use their table node, so a command attached later — including a same-named replacement of a generated command — renders live from Cobra, as does a command detached from the root. Commands added in the root `custom-commands` region run before the mark and count as generated. `usage.MarkDynamic` is for porcelain that extends a generated command in place (custom placeholders, `custom.Register` adding flags): such a command renders its `help` from the runtime `Short`, keeps its generated arg lines while the runtime `speakeasy_prompt_args` names match them, keeps its generated alias and flag lines for the aliases and flags it still has (a flag generated visible and hidden at runtime is dropped; one generated with `hide=#true` keeps that line), and renders runtime-added aliases and visible local flags live, so generated `suggestions`, `default=`, help text and declared order survive. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. +**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun flag-group validators can win. Required-flag validation cannot: under `--usage`, `output.InstallErrorHandling` skips its eager typed required-flag and flag-group checks and clears the required-flag annotations (`usage.DisarmRequiredFlags`, re-armed after `RunE`) so Cobra's own required-flag check passes; a flag-group failure retains Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. `NewRootCommand` calls `usage.MarkGenerated` on the tree right before `custom.Register` (and on cobra's `help`/`completion` once created): only marked commands under the generated root use their table node, so a command attached later — including a same-named replacement of a generated command — renders live from Cobra, as does a command detached from the root. Commands added in the root `custom-commands` region run before the mark and count as generated. `usage.MarkDynamic` is for porcelain that extends a generated command in place (custom placeholders, `custom.Register` adding flags): such a command renders its `help` from the runtime `Short`, keeps its generated arg lines while the runtime `speakeasy_prompt_args` names match them, keeps its generated alias and flag lines for the aliases and flags it still has (a flag generated visible and hidden at runtime is dropped; one generated with `hide=#true` keeps that line), and renders runtime-added aliases and visible local flags live, so generated `suggestions`, `default=`, help text and declared order survive. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. ### Generated README & Command Docs diff --git a/templates/templates/cli/usage_test.go.stmpl b/templates/templates/cli/usage_test.go.stmpl index d3ca16f73..c4c0761fc 100644 --- a/templates/templates/cli/usage_test.go.stmpl +++ b/templates/templates/cli/usage_test.go.stmpl @@ -463,10 +463,15 @@ func TestUsageSchema_ReplacedIntentDropsStaleArgs(t *testing.T) { replacement := &cobra.Command{Use: original.Name(), Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} parent.AddCommand(replacement) + line := "cmd \"{{templateIntentUsageCmdName}}\" help=\"Replacement\"\n" var own strings.Builder require.NoError(t, usage.EmitSchema(replacement, &own)) - assert.Contains(t, own.String(), "cmd \"{{templateIntentUsageCmdName}}\" help=\"Replacement\"") - assert.NotContains(t, own.String(), "arg \"") + assert.Equal(t, line, own.String()) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + depth := len([]string{ {{templateIntentUsagePathArgs}} }) - 1 + assert.Contains(t, rootOut.String(), "\n"+strings.Repeat(" ", depth)+line) } {{- end }} diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index da1f5e8ad..34f46b962 100644 --- a/zSDKs/sdk-cli/.speakeasy/gen.lock +++ b/zSDKs/sdk-cli/.speakeasy/gen.lock @@ -1120,7 +1120,7 @@ trackedFiles: tests/types_test.go: last_write_checksum: sha1:5ce31f08a3214779ed561d0f37279eb4d5202723 tests/usage_test.go: - last_write_checksum: sha1:5cbd4a4a2a836864eb8c1e9e94b99d09b434a8a3 + last_write_checksum: sha1:9f35ec70688e94b38c43ddd05af7b5b2c887ae80 examples: _operation_with_leading_and_trailing_underscores_: speakeasy-default-operation-with-leading-and-trailing-underscores: diff --git a/zSDKs/sdk-cli/tests/usage_test.go b/zSDKs/sdk-cli/tests/usage_test.go index f51e13b69..7916d7138 100644 --- a/zSDKs/sdk-cli/tests/usage_test.go +++ b/zSDKs/sdk-cli/tests/usage_test.go @@ -438,10 +438,15 @@ func TestUsageSchema_ReplacedIntentDropsStaleArgs(t *testing.T) { replacement := &cobra.Command{Use: original.Name(), Short: "Replacement", Args: cobra.NoArgs, RunE: func(*cobra.Command, []string) error { return nil }} parent.AddCommand(replacement) + line := "cmd \"invite\" help=\"Replacement\"\n" var own strings.Builder require.NoError(t, usage.EmitSchema(replacement, &own)) - assert.Contains(t, own.String(), "cmd \"invite\" help=\"Replacement\"") - assert.NotContains(t, own.String(), "arg \"") + assert.Equal(t, line, own.String()) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + depth := len([]string{"invite"}) - 1 + assert.Contains(t, rootOut.String(), "\n"+strings.Repeat(" ", depth)+line) } // --usage documents the command and wins over --schema (matching operation From 25669b9c8eadca1b3723a8f2f041035f75954b21 Mon Sep 17 00:00:00 2001 From: 2ynn Date: Mon, 19 Oct 2026 12:48:05 -0400 Subject: [PATCH 7/7] fix(cli): mark only cobra-created defaults and detect replaced flag sets in --usage - `NewRootCommand` marked every child named `help` or `completion` as generated after `custom.Register`. Cobra keeps an existing `completion` command, so a custom one was rendered from the built-in table entry and lost its help and flags. `usage.InitDefaultCommands` now wraps `InitDefaultHelpCmd`/`InitDefaultCompletionCmd` and marks only the commands cobra created. - The generated mark now records the identity of the command's flag sets. A marked command whose flags are replaced with `ResetFlags` renders live instead of reusing generated flag lines for flags it no longer has. - `MarkDynamic`'s doc comment describes the merge it performs. Tests: `TestUsageSchema_CustomCompletionRendersLive`, `TestUsageSchema_ResetFlagsRendersLive`. README and review SDK updated. --- templates/templates/cli/README.md | 2 +- templates/templates/cli/root.go.stmpl | 16 +------ templates/templates/cli/usage.go.stmpl | 31 ++++++++++++-- templates/templates/cli/usage_test.go.stmpl | 47 ++++++++++++++++++++- zSDKs/sdk-cli/.speakeasy/gen.lock | 6 +-- zSDKs/sdk-cli/internal/cli/root.go | 8 +--- zSDKs/sdk-cli/internal/usage/schema.go | 31 ++++++++++++-- zSDKs/sdk-cli/tests/usage_test.go | 47 ++++++++++++++++++++- 8 files changed, 153 insertions(+), 35 deletions(-) diff --git a/templates/templates/cli/README.md b/templates/templates/cli/README.md index 04e5a1438..b0639f7bd 100644 --- a/templates/templates/cli/README.md +++ b/templates/templates/cli/README.md @@ -1405,7 +1405,7 @@ The KDL schema is built at generation time from the command tree in `includes/us Declared commands (`x-speakeasy-cli-commands`) are part of the schema: bound intents mount into the KDL tree under their declared parent path with the same flag surface the runtime registers (declared positional `arg` nodes, operation security flags, the body flag, `--schema`, and declared flags — plus non-body parameter metadata for JSON-body intents (multipart intents keep their upload fields); `buildIntentUsageCommand` in `includes/usage.ts`), and planned placeholders appear with their summary. For commands added after static schema generation, live schema emission reads `speakeasy_prompt_args` and emits the same `arg` nodes. Once Cobra validation succeeds, `--usage` on an intent or planned command emits KDL and wins over the command's other runtime surfaces, including `--schema` and the bare-invocation usage error (`runIntent*Cmd` in `intentcmd.go.stmpl` and `newPlannedCmd` in `intents.go.stmpl` check `usage.UsageRequested` first, matching operation commands). -**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun flag-group validators can win. Required-flag validation cannot: under `--usage`, `output.InstallErrorHandling` skips its eager typed required-flag and flag-group checks and clears the required-flag annotations (`usage.DisarmRequiredFlags`, re-armed after `RunE`) so Cobra's own required-flag check passes; a flag-group failure retains Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. `NewRootCommand` calls `usage.MarkGenerated` on the tree right before `custom.Register` (and on cobra's `help`/`completion` once created): only marked commands under the generated root use their table node, so a command attached later — including a same-named replacement of a generated command — renders live from Cobra, as does a command detached from the root. Commands added in the root `custom-commands` region run before the mark and count as generated. `usage.MarkDynamic` is for porcelain that extends a generated command in place (custom placeholders, `custom.Register` adding flags): such a command renders its `help` from the runtime `Short`, keeps its generated arg lines while the runtime `speakeasy_prompt_args` names match them, keeps its generated alias and flag lines for the aliases and flags it still has (a flag generated visible and hidden at runtime is dropped; one generated with `hide=#true` keeps that line), and renders runtime-added aliases and visible local flags live, so generated `suggestions`, `default=`, help text and declared order survive. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. +**`--usage` is one root-level contract**: `NewRootCommand` creates cobra's default `help` and `completion` commands (`usage.InitDefaultCommands`, wrapping `InitDefaultHelpCmd`/`InitDefaultCompletionCmd`, which cobra would otherwise add lazily inside `Execute`), applies declared command order, calls `interactive.Intercept(rootCmd)` when interactive mode is enabled, and then calls `usage.Intercept(rootCmd)` as the outer/last interceptor. Both see every generated, intent, catalog, auth and hand-written (`custom.Register` and root custom region) command. The usage interceptor walks the tree and (a) wraps each command's `Run`/`RunE` — non-runnable groups such as `auth` get a `RunE` that falls back to help — so `--usage` emits the command's KDL schema and nothing runs, and (b) folds every lifecycle hook (`PersistentPreRun(E)`, `PreRun(E)`, `PostRun(E)`, `PersistentPostRun(E)`) into a no-op under `--usage`, so a custom pre-run cannot mutate state either. Cobra's validation still surrounds those hooks: unknown flags, `--help`, non-deferred `Args` validation (`op bogus --usage` is a `NoArgs` error), and Cobra's post-PreRun flag-group validators can win. Required-flag validation cannot: under `--usage`, `output.InstallErrorHandling` skips its eager typed required-flag and flag-group checks and clears the required-flag annotations (`usage.DisarmRequiredFlags`, re-armed after `RunE`) so Cobra's own required-flag check passes; a flag-group failure retains Cobra's existing untyped/runtime classification. The interactive Args wrapper explicitly does not defer under `--usage`, and the interactive PreRunE wrapper also checks the usage/doc-surface gates. Per-command `usage.UsageRequested` checks remain (harmless) as the documented precedence. `usage.EmitSchema` composes every schema, root and subtrees alike, from the assembled Cobra tree: the generated `usageNodes` table holds each node's own lines (head, aliases, args, flags) and its declared child names, so children keep their declared order, children the runtime removed or hid are dropped, and available children attached at runtime are appended. A command absent from the table renders live from Cobra, including declared positional `arg` nodes. `NewRootCommand` calls `usage.MarkGenerated` on the tree right before `custom.Register`, and `usage.InitDefaultCommands` marks only the `help`/`completion` commands Cobra itself creates (a custom `completion` registered earlier stays unmarked). Only marked commands under the generated root use their table node, so a command attached later — including a same-named replacement of a generated command — renders live from Cobra, as does a command detached from the root or a marked command whose flag sets were replaced (`ResetFlags`). Commands added in the root `custom-commands` region run before the mark and count as generated. `usage.MarkDynamic` is for porcelain that extends a generated command in place (custom placeholders, `custom.Register` adding flags): such a command renders its `help` from the runtime `Short`, keeps its generated arg lines while the runtime `speakeasy_prompt_args` names match them, keeps its generated alias and flag lines for the aliases and flags it still has (a flag generated visible and hidden at runtime is dropped; one generated with `hide=#true` keeps that line), and renders runtime-added aliases and visible local flags live, so generated `suggestions`, `default=`, help text and declared order survive. Commands unchanged at runtime render byte-identically to the generated text. The KDL root tree carries the built-in `auth` group (`login`/`whoami`/`logout`, unless a generated command already owns `auth` by name or alias — cobra dispatches to the first registered), `explore`, catalog commands (`x-speakeasy-cli-catalog`; a catalog whose exact name is a generated group lends the group its summary, one that only matches an alias is unreachable and skipped), and cobra's `help` and `completion` (`bash`/`zsh`/`fish`/`powershell`). `cmd/gendocs` skips `help`/`completion` (utility surface, same filter as the explorer) so the docs set is unchanged. ### Generated README & Command Docs diff --git a/templates/templates/cli/root.go.stmpl b/templates/templates/cli/root.go.stmpl index 827fe57ec..2533f57b3 100644 --- a/templates/templates/cli/root.go.stmpl +++ b/templates/templates/cli/root.go.stmpl @@ -277,13 +277,7 @@ func NewRootCommand() (*cobra.Command, error) { {{- end}} // Cobra creates its default help and completion commands lazily inside Execute. - rootCmd.InitDefaultHelpCmd() - rootCmd.InitDefaultCompletionCmd() - for _, builtin := range rootCmd.Commands() { - if builtin.Name() == "help" || builtin.Name() == "completion" { - usage.MarkGenerated(builtin) - } - } + usage.InitDefaultCommands(rootCmd) {{- if hasCliIntents}} applyDeclaredCommandOrder(rootCmd) {{- end}} @@ -1094,13 +1088,7 @@ func NewRootCommand() (*cobra.Command, error) { {{- end}} // Cobra creates its default help and completion commands lazily inside Execute. - rootCmd.InitDefaultHelpCmd() - rootCmd.InitDefaultCompletionCmd() - for _, builtin := range rootCmd.Commands() { - if builtin.Name() == "help" || builtin.Name() == "completion" { - usage.MarkGenerated(builtin) - } - } + usage.InitDefaultCommands(rootCmd) {{- if hasCliIntents}} applyDeclaredCommandOrder(rootCmd) {{- end}} diff --git a/templates/templates/cli/usage.go.stmpl b/templates/templates/cli/usage.go.stmpl index d1c9cd038..390abb7c9 100644 --- a/templates/templates/cli/usage.go.stmpl +++ b/templates/templates/cli/usage.go.stmpl @@ -116,7 +116,7 @@ func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent if tabled { node, static = usageNodes[path] } - if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != "true" { + if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != usageFlagSetIdentity(cmd) { node, static = usageNode{children: node.children}, false } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" @@ -250,7 +250,9 @@ func writeUsageIndented(b *strings.Builder, text string, indent int) { } } -// MarkDynamic makes --usage render the command's schema live from its cobra definition. +// MarkDynamic makes --usage render a generated command's runtime help, aliases, +// args and added flags from its cobra definition, keeping generated lines for +// the inputs it still has. func MarkDynamic(cmd *cobra.Command) { if cmd.Annotations == nil { cmd.Annotations = map[string]string{} @@ -259,17 +261,38 @@ func MarkDynamic(cmd *cobra.Command) { } // MarkGenerated records cmd and its subtree as the generated commands the -// usageNodes table describes; a same-named command attached later renders live. +// usageNodes table describes; a same-named command attached later, or a marked +// command whose flag sets are replaced, renders live. func MarkGenerated(cmd *cobra.Command) { if cmd.Annotations == nil { cmd.Annotations = map[string]string{} } - cmd.Annotations[usageGeneratedAnnotation] = "true" + cmd.Annotations[usageGeneratedAnnotation] = usageFlagSetIdentity(cmd) for _, child := range cmd.Commands() { MarkGenerated(child) } } +// InitDefaultCommands creates cobra's default help and completion commands and +// marks only the ones cobra created, leaving a custom command of the same name live. +func InitDefaultCommands(root *cobra.Command) { + existing := map[*cobra.Command]bool{} + for _, cmd := range root.Commands() { + existing[cmd] = true + } + root.InitDefaultHelpCmd() + root.InitDefaultCompletionCmd() + for _, cmd := range root.Commands() { + if !existing[cmd] { + MarkGenerated(cmd) + } + } +} + +func usageFlagSetIdentity(cmd *cobra.Command) string { + return fmt.Sprintf("%p %p", cmd.Flags(), cmd.PersistentFlags()) +} + // Go's %q emits \a, \v, and \xNN escapes that KDL v2 does not define. func kdlQuote(s string) string { var b strings.Builder diff --git a/templates/templates/cli/usage_test.go.stmpl b/templates/templates/cli/usage_test.go.stmpl index c4c0761fc..6a07f5aed 100644 --- a/templates/templates/cli/usage_test.go.stmpl +++ b/templates/templates/cli/usage_test.go.stmpl @@ -344,10 +344,55 @@ func TestUsageSchema_GeneratedCommandsMarked(t *testing.T) { for _, path := range [][]string{ {"version"}, {"configure"}, {"help"}, {"completion"}, {"completion", "bash"} } { cmd, _, err := root.Find(path) require.NoError(t, err) - assert.Equal(t, "true", cmd.Annotations["speakeasy_usage_generated"], strings.Join(path, " ")) + assert.NotEmpty(t, cmd.Annotations["speakeasy_usage_generated"], strings.Join(path, " ")) } } +func TestUsageSchema_CustomCompletionRendersLive(t *testing.T) { + root := &cobra.Command{Use: "{{sanitizeCliName}}"} + usage.MarkGenerated(root) + completion := &cobra.Command{Use: "completion", Short: "Custom completion", RunE: func(*cobra.Command, []string) error { return nil }} + completion.Flags().String("destination", "", "Destination") + root.AddCommand(completion) + usage.InitDefaultCommands(root) + + help, _, err := root.Find([]string{"help"}) + require.NoError(t, err) + assert.NotEmpty(t, help.Annotations["speakeasy_usage_generated"]) + assert.Empty(t, completion.Annotations["speakeasy_usage_generated"]) + + block := "cmd \"completion\" help=\"Custom completion\" {\n flag \"--destination \" help=\"Destination\"\n}\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(completion, &own)) + assert.Equal(t, block, own.String()) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\n"+block) +} + +func TestUsageSchema_ResetFlagsRendersLive(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + configure, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + configure.ResetFlags() + configure.Flags().BoolP("default-output-format", "x", false, "New switch") + usage.MarkDynamic(configure) + + flag := " flag \"-x --default-output-format\" help=\"New switch\"\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(configure, &own)) + assert.Contains(t, own.String(), "\n"+flag) + assert.NotContains(t, own.String(), "") + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\ncmd \"configure\" help=") + assert.NotContains(t, rootOut.String(), "--default-output-format ") + assert.Contains(t, rootOut.String(), "\n"+flag) +} + func TestUsageSchema_DetachedCommand(t *testing.T) { leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index b7c28c959..542ddc0a8 100644 --- a/zSDKs/sdk-cli/.speakeasy/gen.lock +++ b/zSDKs/sdk-cli/.speakeasy/gen.lock @@ -182,7 +182,7 @@ trackedFiles: internal/cli/renderasset.go: last_write_checksum: sha1:c72bde224ebd3246cce2e14e5f04b1e3ed854ba2 internal/cli/root.go: - last_write_checksum: sha1:7b8443d86ef585967c2ba0a0b4576f812a3502c1 + last_write_checksum: sha1:48f538b9ead4f7b896c5064555a05f04987b0e1c internal/cli/streammetadata/root.go: last_write_checksum: sha1:42a01737002d2daef8a33be267f7060659fdac65 internal/cli/streammetadata/streammetadata.go: @@ -660,7 +660,7 @@ trackedFiles: internal/usage/bodyschemas.go: last_write_checksum: sha1:775249b69ed405ad072c16a76fe6113f375b3818 internal/usage/schema.go: - last_write_checksum: sha1:e26a787b1b5d11947027f40186b9ca9ce90f6b2a + last_write_checksum: sha1:13350f445bdbbcc99e06b70d23316ca7e4a632b9 scripts/install.ps1: last_write_checksum: sha1:9dcf40ea00ecb8ceda83d5056f57235b43cf658a scripts/install.sh: @@ -1122,7 +1122,7 @@ trackedFiles: tests/types_test.go: last_write_checksum: sha1:5ce31f08a3214779ed561d0f37279eb4d5202723 tests/usage_test.go: - last_write_checksum: sha1:9f35ec70688e94b38c43ddd05af7b5b2c887ae80 + last_write_checksum: sha1:6dd7b7205958c3f3f7ea18c7cbb579497327a900 examples: _operation_with_leading_and_trailing_underscores_: speakeasy-default-operation-with-leading-and-trailing-underscores: diff --git a/zSDKs/sdk-cli/internal/cli/root.go b/zSDKs/sdk-cli/internal/cli/root.go index 3afcfaab4..f4ca669e7 100644 --- a/zSDKs/sdk-cli/internal/cli/root.go +++ b/zSDKs/sdk-cli/internal/cli/root.go @@ -319,13 +319,7 @@ func NewRootCommand() (*cobra.Command, error) { custom.Register(rootCmd) // Cobra creates its default help and completion commands lazily inside Execute. - rootCmd.InitDefaultHelpCmd() - rootCmd.InitDefaultCompletionCmd() - for _, builtin := range rootCmd.Commands() { - if builtin.Name() == "help" || builtin.Name() == "completion" { - usage.MarkGenerated(builtin) - } - } + usage.InitDefaultCommands(rootCmd) applyDeclaredCommandOrder(rootCmd) interactive.Intercept(rootCmd) usage.Intercept(rootCmd) diff --git a/zSDKs/sdk-cli/internal/usage/schema.go b/zSDKs/sdk-cli/internal/usage/schema.go index 086977ce0..e28fa7dde 100644 --- a/zSDKs/sdk-cli/internal/usage/schema.go +++ b/zSDKs/sdk-cli/internal/usage/schema.go @@ -209,7 +209,7 @@ func renderUsageNode(b *strings.Builder, cmd *cobra.Command, path string, indent if tabled { node, static = usageNodes[path] } - if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != "true" { + if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != usageFlagSetIdentity(cmd) { node, static = usageNode{children: node.children}, false } dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" @@ -343,7 +343,9 @@ func writeUsageIndented(b *strings.Builder, text string, indent int) { } } -// MarkDynamic makes --usage render the command's schema live from its cobra definition. +// MarkDynamic makes --usage render a generated command's runtime help, aliases, +// args and added flags from its cobra definition, keeping generated lines for +// the inputs it still has. func MarkDynamic(cmd *cobra.Command) { if cmd.Annotations == nil { cmd.Annotations = map[string]string{} @@ -352,17 +354,38 @@ func MarkDynamic(cmd *cobra.Command) { } // MarkGenerated records cmd and its subtree as the generated commands the -// usageNodes table describes; a same-named command attached later renders live. +// usageNodes table describes; a same-named command attached later, or a marked +// command whose flag sets are replaced, renders live. func MarkGenerated(cmd *cobra.Command) { if cmd.Annotations == nil { cmd.Annotations = map[string]string{} } - cmd.Annotations[usageGeneratedAnnotation] = "true" + cmd.Annotations[usageGeneratedAnnotation] = usageFlagSetIdentity(cmd) for _, child := range cmd.Commands() { MarkGenerated(child) } } +// InitDefaultCommands creates cobra's default help and completion commands and +// marks only the ones cobra created, leaving a custom command of the same name live. +func InitDefaultCommands(root *cobra.Command) { + existing := map[*cobra.Command]bool{} + for _, cmd := range root.Commands() { + existing[cmd] = true + } + root.InitDefaultHelpCmd() + root.InitDefaultCompletionCmd() + for _, cmd := range root.Commands() { + if !existing[cmd] { + MarkGenerated(cmd) + } + } +} + +func usageFlagSetIdentity(cmd *cobra.Command) string { + return fmt.Sprintf("%p %p", cmd.Flags(), cmd.PersistentFlags()) +} + // Go's %q emits \a, \v, and \xNN escapes that KDL v2 does not define. func kdlQuote(s string) string { var b strings.Builder diff --git a/zSDKs/sdk-cli/tests/usage_test.go b/zSDKs/sdk-cli/tests/usage_test.go index 7916d7138..51db7dda3 100644 --- a/zSDKs/sdk-cli/tests/usage_test.go +++ b/zSDKs/sdk-cli/tests/usage_test.go @@ -331,10 +331,55 @@ func TestUsageSchema_GeneratedCommandsMarked(t *testing.T) { for _, path := range [][]string{{"version"}, {"configure"}, {"help"}, {"completion"}, {"completion", "bash"}} { cmd, _, err := root.Find(path) require.NoError(t, err) - assert.Equal(t, "true", cmd.Annotations["speakeasy_usage_generated"], strings.Join(path, " ")) + assert.NotEmpty(t, cmd.Annotations["speakeasy_usage_generated"], strings.Join(path, " ")) } } +func TestUsageSchema_CustomCompletionRendersLive(t *testing.T) { + root := &cobra.Command{Use: "cli"} + usage.MarkGenerated(root) + completion := &cobra.Command{Use: "completion", Short: "Custom completion", RunE: func(*cobra.Command, []string) error { return nil }} + completion.Flags().String("destination", "", "Destination") + root.AddCommand(completion) + usage.InitDefaultCommands(root) + + help, _, err := root.Find([]string{"help"}) + require.NoError(t, err) + assert.NotEmpty(t, help.Annotations["speakeasy_usage_generated"]) + assert.Empty(t, completion.Annotations["speakeasy_usage_generated"]) + + block := "cmd \"completion\" help=\"Custom completion\" {\n flag \"--destination \" help=\"Destination\"\n}\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(completion, &own)) + assert.Equal(t, block, own.String()) + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\n"+block) +} + +func TestUsageSchema_ResetFlagsRendersLive(t *testing.T) { + root, err := cli.NewRootCommand() + require.NoError(t, err) + configure, _, err := root.Find([]string{"configure"}) + require.NoError(t, err) + configure.ResetFlags() + configure.Flags().BoolP("default-output-format", "x", false, "New switch") + usage.MarkDynamic(configure) + + flag := " flag \"-x --default-output-format\" help=\"New switch\"\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(configure, &own)) + assert.Contains(t, own.String(), "\n"+flag) + assert.NotContains(t, own.String(), "") + + var rootOut strings.Builder + require.NoError(t, usage.EmitSchema(root, &rootOut)) + assert.Contains(t, rootOut.String(), "\ncmd \"configure\" help=") + assert.NotContains(t, rootOut.String(), "--default-output-format ") + assert.Contains(t, rootOut.String(), "\n"+flag) +} + func TestUsageSchema_DetachedCommand(t *testing.T) { leaf := &cobra.Command{Use: "detached", Short: "Detached"} var out strings.Builder