feat: Make deployment operations discoverable - #8
Conversation
Operators can discover request fields, accepted values, plan mode, and examples from operation help. Profiles, login, completion, and terminal output now provide a consistent command-line workflow.
Code Review SummaryThis pull request significantly enhances the FlatRun CLI's discoverability and interactive capabilities. It transitions the command-line entry point to a structured Cobra-based architecture, enabling features like shell completion and a more intuitive help system. The introduction of OpenAPI-driven request skeletons and 'plan' support allows users to preview operations without deep-diving into agent source code. Additionally, the presentation layer has been modernized with terminal-aware styling and responsive tables. 🚀 Key Improvements
💡 Minor Suggestions
|
Request skeleton generation stops at recursive schema references instead of overflowing the process stack. Skeletons also remain raw JSON when they contain arrays or null values.
| Required []string `json:"required"` | ||
| Description string `json:"description"` | ||
| AdditionalProperties *Schema `json:"additionalProperties"` | ||
| Enum []string `json:"enum"` |
There was a problem hiding this comment.
OpenAPI enum values can be of any type (e.g., integers, booleans), not just strings. Defining this as []string will cause json.Unmarshal to fail if the agent returns a specification containing non-string enums (like integer status codes).
| Enum []string `json:"enum"` | |
| Enum []any `json:"enum"` |
| client := flatrun.New(profile.URL, "", 30*time.Second, false) | ||
| body := map[string]string{} | ||
| if apiKeyStdin { | ||
| body["api_key"] = strings.TrimSpace(string(credential)) |
There was a problem hiding this comment.
Using strings.TrimSpace on credentials will remove leading and trailing whitespace. While this is often intended to strip a trailing newline from stdin (e.g., via printf), it can corrupt API keys or passwords that legitimately contain spaces. It is safer to specifically trim only the trailing line ending.
| body["api_key"] = strings.TrimSpace(string(credential)) | |
| body["api_key"] = strings.TrimRight(string(credential), "\r\n") | |
| } else { | |
| body["username"] = username | |
| body["password"] = strings.TrimRight(string(credential), "\r\n") |
OpenAPI descriptions now accept enum values of every JSON type. Piped credentials retain legitimate spaces while discarding only line endings.
Make the CLI self-documenting enough to deploy a stack without reading agent source. Operation help exposes request contracts and plan support. Interactive presentation stays separate from raw script output.