Skip to content

feat: add Go SDK and CLI generation from OpenAPI spec - #107

Merged
markturansky merged 8 commits into
mainfrom
add-hypershell-cli
Aug 15, 2026
Merged

feat: add Go SDK and CLI generation from OpenAPI spec#107
markturansky merged 8 commits into
mainfrom
add-hypershell-cli

Conversation

@markturansky

Copy link
Copy Markdown
Collaborator

Summary

  • Port openapi-ir library from rh-trex-ai into scripts/openapi-ir/ — canonical intermediate representation for OpenAPI specs with bounded preflight scanning, normalization, graph building, and safety validation
  • Port cli-generator from rh-trex-ai into scripts/cli-generator/ — generates a complete cobra CLI project from OpenAPI specs (23 templates covering login/logout/version/config/completion + per-resource list/get/create commands)
  • Upgrade sdk-generator to use openapi-ir instead of raw gopkg.in/yaml.v3 parsing, aligning with the upstream rh-trex-ai implementation
  • Generate typed Go SDK into components/sdk-go/ with client and types packages for all 6 Kinds
  • Generate CLI into components/cli/ with full cobra command tree for all 6 Kinds (Fleet, Gateway, GatewayNetwork, GatewayRelease, ManagedCluster, ManagedDatabase)
  • Add Makefile targets: generate-sdk-go, generate-cli
  • Fix upstream bug: resource matching in cli-generator used strings.Contains which caused prefix collisions (e.g. Gateway matching GatewayNetwork); replaced with direct resource pointer association
  • Filter ObjectReference from both generators (it's a base type, not a Kind)

Test plan

  • scripts/openapi-ir/ builds: cd scripts/openapi-ir && GOWORK=off go build ./...
  • scripts/sdk-generator/ builds: cd scripts/sdk-generator && GOWORK=off go build ./...
  • scripts/cli-generator/ builds: cd scripts/cli-generator && GOWORK=off go build ./...
  • make generate-sdk-go produces 6 resources (no ObjectReference)
  • make generate-cli produces 6 resources (no ObjectReference)
  • components/sdk-go/ builds: cd components/sdk-go && GOWORK=off go build ./...
  • components/cli/ builds: cd components/cli && GOWORK=off go build ./...
  • CLI --help shows all commands: login, logout, version, config, completion, list, get, create
  • CLI list --help shows all 6 resource subcommands
  • CLI create gateway --help shows all 16 writable field flags

🤖 Generated with Claude Code

@markturansky
markturansky force-pushed the add-hypershell-cli branch 7 times, most recently from 0009ccb to c4851b3 Compare August 13, 2026 23:32
user and others added 3 commits August 13, 2026 19:34
Port openapi-ir library and cli-generator from rh-trex-ai, upgrade
sdk-generator to use openapi-ir instead of raw YAML parsing, and
generate typed Go SDK (components/sdk-go) and cobra CLI
(components/cli) for all 6 HyperShell Kinds.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Rename binary from hypershell to hsctl to match kubectl/acpctl patterns.
Implement all missing CRUD operations for complete CLI coverage.

Changes:
- Rename binary: hypershell → hsctl
- Add delete commands for all 8 resource types (Fleet, Gateway, GatewayNetwork, GatewayRelease, ManagedCluster, ManagedDatabase, Role, RoleBinding)
- Add apply command with -f flag for declarative resource management
- Update all import paths: cmd/hypershell → cmd/hsctl
- Update Makefile build-cli target
- Update e2e test to use hsctl throughout
- Update all command examples in help text

CLI Coverage:
- create: ✅ All 8 resource types
- delete: ✅ All 8 resource types (NEW)
- get: ✅ All 8 resource types
- list: ✅ All 8 resource types
- apply: ✅ -f file/directory support (NEW)
- login/logout/config/version: ✅

E2E tested against hypershell-stage cluster - all CLI commands verified.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@markturansky
markturansky enabled auto-merge August 15, 2026 03:28
@markturansky
markturansky added this pull request to the merge queue Aug 15, 2026
Merged via the queue into main with commit b330dc5 Aug 15, 2026
15 of 16 checks passed
@markturansky
markturansky deleted the add-hypershell-cli branch August 15, 2026 03:34
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