Skip to content

Commit dde9855

Browse files
committed
feat: adds push command to cli
Adds a new command to the CLI that allows users to push local flag configurations to a remote flag management service over HTTP/HTTPS. It also prevents local file scheme usage to avoid overwriting local files and validates if flags have default values set. Signed-off-by: Kris Coleman <[email protected]>
1 parent fe326f6 commit dde9855

File tree

20 files changed

+3215
-16
lines changed

20 files changed

+3215
-16
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ generated/
3939
# generated files from running the CLI
4040
flags.json
4141
generated/
42+
43+
openfeature
44+
45+
# Build output directory
46+
/bin

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,34 @@
22
help:
33
@echo "Available commands:"
44
@echo " help - Show this help message"
5+
@echo " build - Build the CLI binary to bin/openfeature"
6+
@echo " install - Install the CLI binary to system path"
57
@echo " test - Run unit tests"
68
@echo " test-integration - Run all integration tests"
79
@echo " test-integration-csharp - Run C# integration tests"
810
@echo " test-integration-go - Run Go integration tests"
911
@echo " test-integration-nodejs - Run NodeJS integration tests"
12+
@echo " generate - Generate all code (API clients, docs, schema)"
13+
@echo " generate-api - Generate API clients from OpenAPI specs"
1014
@echo " generate-docs - Generate documentation"
1115
@echo " generate-schema - Generate schema"
1216
@echo " fmt - Format Go code"
1317

18+
.PHONY: build
19+
build:
20+
@echo "Building CLI binary..."
21+
@mkdir -p bin
22+
@go build -o bin/openfeature ./cmd/openfeature
23+
@echo "CLI binary built successfully at bin/openfeature"
24+
25+
.PHONY: install
26+
install: build
27+
@echo "Installing CLI binary..."
28+
@GOPATH=$${GOPATH:-$$(go env GOPATH)}; \
29+
mkdir -p $$GOPATH/bin; \
30+
cp bin/openfeature $$GOPATH/bin/openfeature; \
31+
echo "CLI installed successfully to $$GOPATH/bin/openfeature"
32+
1433
.PHONY: test
1534
test:
1635
@echo "Running tests..."
@@ -48,6 +67,18 @@ generate-schema:
4867
@go run ./schema/generate-schema.go
4968
@echo "Schema generated successfully!"
5069

70+
.PHONY: generate-api
71+
generate-api:
72+
@echo "Generating API clients from OpenAPI specs..."
73+
@go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest \
74+
--config api/v1/push-codegen.yaml \
75+
api/v1/push.yaml > internal/api/client/push_client.gen.go
76+
@echo "API clients generated successfully!"
77+
78+
.PHONY: generate
79+
generate: generate-api generate-docs generate-schema
80+
@echo "All code generation completed successfully!"
81+
5182
.PHONY: fmt
5283
fmt:
5384
@echo "Running go fmt..."

api/v1/push-codegen.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# oapi-codegen configuration for push API client generation
2+
package: pushclient
3+
generate:
4+
- client
5+
- models
6+
output: internal/api/client/push_client.gen.go

0 commit comments

Comments
 (0)