feat: Add version information injection to CLI build script (#6780)
* feat: add version information injection to CLI build script - Extract version from package.json - Capture git commit hash, build date, and builder info - Inject version info into CLI binaries via Go ldflags - Update both cline and cline-host builds with version data * chore: add changeset for CLI version injection
This commit is contained in:
1 parent
1241a2fce2
commit
7135fe4c49
2 files changed
+22
-6
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
Add version information injection to CLI build script. The CLI binaries now include version, commit hash, build date, and builder information extracted from package.json and git, improving debugging and version tracking capabilities.
|
||||
+17
-6
@@ -7,15 +7,26 @@ npm run protos-go
|
||||
mkdir -p dist-standalone/extension
|
||||
cp package.json dist-standalone/extension
|
||||
|
||||
cd cli
|
||||
GO111MODULE=on go build -o bin/cline ./cmd/cline
|
||||
echo 'cli/bin/cline built'
|
||||
GO111MODULE=on go build -o bin/cline-host ./cmd/cline-host
|
||||
echo 'cli/bin/cline-host built'
|
||||
# Extract version information for ldflags
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||
DATE=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||||
BUILT_BY="${USER:-unknown}"
|
||||
|
||||
# Build ldflags to inject version info
|
||||
LDFLAGS="-X 'github.com/cline/cli/pkg/cli.Version=${VERSION}' \
|
||||
-X 'github.com/cline/cli/pkg/cli.Commit=${COMMIT}' \
|
||||
-X 'github.com/cline/cli/pkg/cli.Date=${DATE}' \
|
||||
-X 'github.com/cline/cli/pkg/cli.BuiltBy=${BUILT_BY}'"
|
||||
|
||||
cd cli
|
||||
GO111MODULE=on go build -ldflags "$LDFLAGS" -o bin/cline ./cmd/cline
|
||||
echo 'cli/bin/cline built'
|
||||
GO111MODULE=on go build -ldflags "$LDFLAGS" -o bin/cline-host ./cmd/cline-host
|
||||
echo 'cli/bin/cline-host built'
|
||||
# Copy binaries to dist-standalone/bin
|
||||
cd ..
|
||||
mkdir -p dist-standalone/bin
|
||||
cp cli/bin/cline dist-standalone/bin/cline
|
||||
cp cli/bin/cline-host dist-standalone/bin/cline-host
|
||||
echo 'Copied binaries to dist-standalone/bin/'
|
||||
echo 'Copied binaries to dist-standalone/bin/'
|
||||
Reference in new issue
Block a user