File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11opencode-litellm-config
2+ dist /
Original file line number Diff line number Diff line change 1+ BINARY := opencode-litellm-config
2+ VERSION ?= $(shell git describe --tags --always)
3+ DIST := dist
4+
5+ PLATFORMS := linux/amd64 darwin/amd64 darwin/arm64 windows/amd64
6+
7+ .PHONY : build-all checksums release clean
8+
9+ build-all : clean
10+ @mkdir -p $(DIST )
11+ @for platform in $(PLATFORMS ) ; do \
12+ os=$$ {platform%/* }; \
13+ arch=$$ {platform#* /}; \
14+ output=$(DIST ) /$(BINARY ) -$$ os-$$ arch; \
15+ if [ " $$ os" = " windows" ]; then output=$$ output.exe; fi ; \
16+ echo " Building $$ os/$$ arch..." ; \
17+ CGO_ENABLED=0 GOOS=$$ os GOARCH=$$ arch go build -ldflags " -X main.version=$( VERSION) " -o $$ output . ; \
18+ done
19+
20+ checksums : build-all
21+ @cd $(DIST ) && sha256sum * > checksums.txt
22+ @echo " Checksums written to $( DIST) /checksums.txt"
23+
24+ release :
25+ ifndef VERSION
26+ $(error VERSION is required. Usage: make release VERSION=0.1.0)
27+ endif
28+ @if git rev-parse v$(VERSION) >/dev/null 2>&1; then \
29+ echo "Error: tag v$(VERSION) already exists"; \
30+ exit 1; \
31+ fi
32+ $(MAKE) checksums VERSION=$(VERSION)
33+ git tag v$(VERSION)
34+ git push origin v$(VERSION)
35+ gh release create v$(VERSION) $(DIST)/* --generate-notes --title "v$(VERSION)"
36+
37+ clean :
38+ rm -rf $(DIST )
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import (
1010 "time"
1111)
1212
13+ var version = "dev"
14+
1315const usage = `Usage: %s [flags] <output-file>
1416
1517Generates OpenCode config from LiteLLM models endpoint.
@@ -63,6 +65,10 @@ type Config struct {
6365}
6466
6567func main () {
68+ if len (os .Args ) > 1 && (os .Args [1 ] == "--version" || os .Args [1 ] == "-v" ) {
69+ fmt .Println (version )
70+ os .Exit (0 )
71+ }
6672 cfg := parseFlags ()
6773 apiKey := requireEnvVar ("DIUS_LITELLM_SK" )
6874 models := fetchModels (cfg .baseURL , apiKey )
You can’t perform that action at this time.
0 commit comments