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 8907b81da..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 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 (`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/includes/usage.ts b/templates/templates/cli/includes/usage.ts index 52ad641a1..ba5a80ef4 100644 --- a/templates/templates/cli/includes/usage.ts +++ b/templates/templates/cli/includes/usage.ts @@ -1441,104 +1441,92 @@ 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; +} + +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: UsageNodeItem[]; + flags: UsageNodeItem[]; + children: string[]; } -function collectCommandPathSchemas( +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) => ({ + 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, + })), + 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 +2390,47 @@ 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) => { + const fields = [ + `key: ${goStringLiteral(item.key)}`, + `text: ${goTemplateSafeStringExpr(item.text)}`, + ]; + if (item.settings) fields.push("settings: true"); + if (item.hidden) fields.push("hidden: true"); + return `{${fields.join(", ")} }`; + }) + .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: ${goUsageNodeItems(node.args)}`); + } + 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/root.go.stmpl b/templates/templates/cli/root.go.stmpl index 5b1e70533..2533f57b3 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}} @@ -276,8 +277,7 @@ func NewRootCommand() (*cobra.Command, error) { {{- end}} // Cobra creates its default help and completion commands lazily inside Execute. - rootCmd.InitDefaultHelpCmd() - rootCmd.InitDefaultCompletionCmd() + usage.InitDefaultCommands(rootCmd) {{- if hasCliIntents}} applyDeclaredCommandOrder(rootCmd) {{- end}} @@ -1080,6 +1080,7 @@ func NewRootCommand() (*cobra.Command, error) { } {{- end}} + usage.MarkGenerated(rootCmd) {{- if isCustomCommandsEnabled}} {{- addImport "internal/cli/custom" true}} @@ -1087,8 +1088,7 @@ func NewRootCommand() (*cobra.Command, error) { {{- end}} // Cobra creates its default help and completion commands lazily inside Execute. - rootCmd.InitDefaultHelpCmd() - rootCmd.InitDefaultCompletionCmd() + 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 4be56e1fd..390abb7c9 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 []usageItem + flags []usageItem + children []string +} + +{{templateUsageNodeMap}} func UsageRequested(cmd *cobra.Command) bool { if cmd == nil { @@ -81,23 +96,201 @@ 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 + 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" + usageGeneratedAnnotation = "speakeasy_usage_generated" + usageRootName = "{{sanitizeCliName}}" +) + +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] + } + if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != usageFlagSetIdentity(cmd) { + node, static = usageNode{children: node.children}, false + } + dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" + itemPrefix := " " + if isRoot { + itemPrefix = "" } - if schema, ok := usageSchemas[path]; ok { - _, err := io.WriteString(w, schema) - return err + 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, itemPrefix) + } 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, tabled) + } + 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) + } + for _, arg := range node.args { + body = append(body, arg.text) + } + 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, prefix string) []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, prefix+"alias "+kdlQuote(alias)) + } + } + if usageArgsUnchanged(node.args, usagePromptArgs(cmd)) { + for _, arg := range node.args { + body = append(body, arg.text) + } + } else { + body = append(body, liveUsageArgs(cmd, prefix)...) + } + 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, prefix)) + } + }) + 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 && !child.Hidden { + children = append(children, child) + break + } + } + } + for _, child := range cmd.Commands() { + if !listed[child.Name()] && child.IsAvailableCommand() { + children = append(children, child) + } } - return emitLiveSchema(cmd, w) + return children } -// MarkDynamic makes --usage render the command's schema live from its cobra definition. +// 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) + } + } +} + +// 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{} } - cmd.Annotations["speakeasy_usage_dynamic"] = "true" + cmd.Annotations[usageDynamicAnnotation] = "true" +} + +// MarkGenerated records cmd and its subtree as the generated commands the +// 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] = 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. @@ -193,64 +386,78 @@ 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 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 { - for _, arg := range promptArgs.Args { - fmt.Fprintf(&b, " arg %s", kdlQuote(arg.Name)) + 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 { + line := prefix + "arg " + kdlQuote(arg.Name) if arg.Summary != "" { - fmt.Fprintf(&b, " help=%s", kdlQuoteAt(arg.Summary, " ")) + line += " help=" + kdlQuoteAt(arg.Summary, prefix+" ") } 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{prefix + "args " + kdlQuoteAt(args, prefix+" ")} + } + return nil +} + +func liveUsageFlag(f *pflag.Flag, prefix string) 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 := prefix + "flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, prefix+" ") + 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..6a07f5aed 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,197 @@ 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_DynamicRoot(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 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)) + 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) { + 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_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_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.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 + 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) { h := NewCLITestHarness(t) err := h.RunBare([]string{"version", "--usage=false"}) @@ -305,6 +497,27 @@ 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) + + line := "cmd \"{{templateIntentUsageCmdName}}\" help=\"Replacement\"\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + 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 }} {{- if templateIntentUsageSchemaPrecedenceTestEnabled }} diff --git a/zSDKs/sdk-cli/.speakeasy/gen.lock b/zSDKs/sdk-cli/.speakeasy/gen.lock index 491f21ba4..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:36ff704c14aa2e9d8f6cabf8e089acfa011349b8 + 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:22b415ccb2fb4c1c80de2944a995e73ceef459c1 + 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:36269b37c525a27adf10d5af9a0d28fb36191ecb + 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 b2385df3e..f4ca669e7 100644 --- a/zSDKs/sdk-cli/internal/cli/root.go +++ b/zSDKs/sdk-cli/internal/cli/root.go @@ -314,11 +314,12 @@ 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() + 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 d01707798..e28fa7dde 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 []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: []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]\""}, {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: []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]\""}, {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: []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]\""}, {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"}}, + "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: []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]\""}, {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)\""}, {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\""}, + "whoami": {head: "cmd \"whoami\" help=\"Display current authentication and global parameter configuration\""}, } func UsageRequested(cmd *cobra.Command) bool { @@ -223,23 +189,201 @@ 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 + 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" + usageGeneratedAnnotation = "speakeasy_usage_generated" + usageRootName = "cli" +) + +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] + } + if static && !isRoot && cmd.Annotations[usageGeneratedAnnotation] != usageFlagSetIdentity(cmd) { + node, static = usageNode{children: node.children}, false + } + dynamic := !static || cmd.Annotations[usageDynamicAnnotation] == "true" + 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, itemPrefix) + } 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, tabled) + } + 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) + } + for _, arg := range node.args { + body = append(body, arg.text) + } + 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, prefix string) []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, prefix+"alias "+kdlQuote(alias)) + } + } + if usageArgsUnchanged(node.args, usagePromptArgs(cmd)) { + for _, arg := range node.args { + body = append(body, arg.text) + } + } else { + body = append(body, liveUsageArgs(cmd, prefix)...) + } + 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, prefix)) + } + }) + 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 && !child.Hidden { + children = append(children, child) + break + } + } } - if schema, ok := usageSchemas[path]; ok { - _, err := io.WriteString(w, schema) - return err + 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. +// 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{} } - cmd.Annotations["speakeasy_usage_dynamic"] = "true" + cmd.Annotations[usageDynamicAnnotation] = "true" +} + +// MarkGenerated records cmd and its subtree as the generated commands the +// 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] = 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. @@ -335,64 +479,78 @@ 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 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 { - for _, arg := range promptArgs.Args { - fmt.Fprintf(&b, " arg %s", kdlQuote(arg.Name)) + 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 { + line := prefix + "arg " + kdlQuote(arg.Name) if arg.Summary != "" { - fmt.Fprintf(&b, " help=%s", kdlQuoteAt(arg.Summary, " ")) + line += " help=" + kdlQuoteAt(arg.Summary, prefix+" ") } 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{prefix + "args " + kdlQuoteAt(args, prefix+" ")} + } + return nil +} + +func liveUsageFlag(f *pflag.Flag, prefix string) 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 := prefix + "flag " + kdlQuote(name) + " help=" + kdlQuoteAt(f.Usage, prefix+" ") + 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..51db7dda3 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,197 @@ 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_DynamicRoot(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 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)) + 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) { + 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_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_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.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 + 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) { h := NewCLITestHarness(t) err := h.RunBare([]string{"version", "--usage=false"}) @@ -281,6 +473,27 @@ 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) + + line := "cmd \"invite\" help=\"Replacement\"\n" + var own strings.Builder + require.NoError(t, usage.EmitSchema(replacement, &own)) + 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 // commands): KDL comes back, not the request-body JSON Schema. func TestUsageSchema_IntentUsageBeatsSchema(t *testing.T) {