Skip to content

feat: Make deployment operations discoverable - #8

Merged
nfebe merged 3 commits into
mainfrom
fix/first-deployment-findings
Aug 23, 2026
Merged

feat: Make deployment operations discoverable#8
nfebe merged 3 commits into
mainfrom
fix/first-deployment-findings

Conversation

@nfebe

@nfebe nfebe commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@sourceant

sourceant Bot commented Aug 23, 2026

Copy link
Copy Markdown

Code Review Summary

This 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

  • Implemented per-operation help that dynamically exposes request fields, types, and permissions directly from the agent's OpenAPI specification.
  • Added support for --generate-cli-skeleton, providing a JSON template for complex request bodies.
  • Introduced a --plan mode for operations that declare support in the agent, enabling safe previews of changes.
  • Improved the image deployment flow (deployment image set) to automatically detect and update environment variables referenced in Docker Compose files, favoring environment overrides over YAML mutations.
  • Modernized terminal output using lipgloss for semantic color-coding of statuses and responsive table layouts that wrap to terminal width.

💡 Minor Suggestions

  • The version comparison logic in clientTrackNewer uses fmt.Sscanf with %d.%d, which is sufficient for major.minor tracking but might omit patch-level nuances in complex pre-release strings. For a simple version warning, this is acceptable.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. No specific code suggestions were generated. See the overview comment for a summary.

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.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread internal/spec/spec.go Outdated
Required []string `json:"required"`
Description string `json:"description"`
AdditionalProperties *Schema `json:"additionalProperties"`
Enum []string `json:"enum"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
Enum []string `json:"enum"`
Enum []any `json:"enum"`

Comment thread internal/command/root.go Outdated
client := flatrun.New(profile.URL, "", 30*time.Second, false)
body := map[string]string{}
if apiKeyStdin {
body["api_key"] = strings.TrimSpace(string(credential))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. No specific code suggestions were generated. See the overview comment for a summary.

@nfebe
nfebe merged commit bfd440d into main Aug 23, 2026
6 checks passed
@nfebe
nfebe deleted the fix/first-deployment-findings branch August 23, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant