|
| 1 | +# multiapps-cli-plugin — CLAUDE.md |
| 2 | + |
| 3 | +## Project Role |
| 4 | + |
| 5 | +This is the **multiapps-cli-plugin**: a Go-based Cloud Foundry CLI plugin that extends |
| 6 | +the CF CLI (v8) with commands for managing MTA deployments (`deploy`, `undeploy`, |
| 7 | +`bg-deploy`, `mtas`, `mta-ops`, `dmol`). It communicates with the |
| 8 | +**multiapps-controller** backend via auto-generated OpenAPI clients (go-openapi/runtime). |
| 9 | + |
| 10 | +## Security Boundary |
| 11 | + |
| 12 | +**This is an OPEN SOURCE repository.** |
| 13 | +Never introduce proprietary logic, credentials, or internal company context into this |
| 14 | +codebase. No SAP-internal service integrations, no hardcoded tokens or URLs. |
| 15 | + |
| 16 | +## Tech Stack |
| 17 | + |
| 18 | +- **Language**: Go 1.25.4 (go modules — `go.mod` is the source of truth) |
| 19 | +- **CF CLI integration**: `code.cloudfoundry.org/cli/v8` |
| 20 | +- **REST clients**: auto-generated via `swagger generate client` (see `regen-client.sh`) |
| 21 | + — do NOT hand-edit files under `clients/` |
| 22 | +- **Testing**: Ginkgo v1 + Gomega (`github.com/onsi/ginkgo`, `github.com/onsi/gomega`) |
| 23 | + |
| 24 | +## Key Directory Layout |
| 25 | + |
| 26 | +``` |
| 27 | +commands/ — CF CLI command implementations (deploy, undeploy, etc.) |
| 28 | +clients/ — AUTO-GENERATED OpenAPI REST clients (v1 + v2); never edit manually |
| 29 | +cli/ — CF CLI plugin registration and bootstrapping |
| 30 | +util/ — shared helpers (HTTP, logging, formatting) |
| 31 | +secure_parameters/ — secrets collection logic (--collect-secrets flag) |
| 32 | +cfg/VERSION — authoritative version string consumed by build.sh |
| 33 | +regen-client.sh — regenerate clients/ from multiapps-controller Swagger specs |
| 34 | +``` |
| 35 | + |
| 36 | +## Build Commands |
| 37 | + |
| 38 | +**Local dev binary (current platform):** |
| 39 | +```bash |
| 40 | +go build -ldflags "-X main.Version=$(cat cfg/VERSION)" -o multiapps-plugin |
| 41 | +``` |
| 42 | + |
| 43 | +**All platforms (cross-compiled, output to `build/`):** |
| 44 | +```bash |
| 45 | +./build.sh |
| 46 | +``` |
| 47 | +`build.sh` produces both static (`CGO_ENABLED=0`) and non-static variants for |
| 48 | +linux/32, linux/64, linux/arm64, windows/32, windows/64, darwin/amd64, darwin/arm64. |
| 49 | + |
| 50 | +## Running Tests |
| 51 | + |
| 52 | +```bash |
| 53 | +go test ./... |
| 54 | +``` |
| 55 | +Or with Ginkgo's verbose output: |
| 56 | +```bash |
| 57 | +ginkgo -r ./... |
| 58 | +``` |
| 59 | + |
| 60 | +## Regenerating the Go REST Client |
| 61 | + |
| 62 | +Run `regen-client.sh` after the multiapps-controller Swagger specs change. The script |
| 63 | +rebuilds the controller API module, then calls `swagger generate client` for both v1 |
| 64 | +and v2. Copy the generated output into `clients/`. |
| 65 | + |
| 66 | +## Adding CLI Flags |
| 67 | + |
| 68 | +New flags must be registered in the command's `GetPluginCommand()` `Options` map and |
| 69 | +documented in the CF CLI help text. Update the parent `CLAUDE.md` documentation |
| 70 | +checklist when adding user-visible flags. |
| 71 | + |
| 72 | +## Mandatory Formatting Rule |
| 73 | + |
| 74 | +**Before completing any task or committing code, you MUST run:** |
| 75 | +```bash |
| 76 | +go fmt ./... |
| 77 | +``` |
| 78 | +All committed Go source must conform to standard `gofmt` formatting. |
0 commit comments