scripts/docs.md
Path: @/scripts
The scripts directory contains build and release automation utilities for the beads project. These scripts handle version management, installation with embedded build info, and release orchestration across multiple distribution channels.
Key scripts include version bumping, installation helpers that inject git information at build time, and release coordination across GitHub, Homebrew, PyPI, and npm.
Build Integration: The install.sh script is referenced in documentation and release processes as the primary user-facing installation mechanism. It integrates directly with the Go build system to ensure full version information is embedded.
Version Pipeline: Works alongside the version infrastructure in @/cmd/bd/version.go by extracting and passing git information at build time via ldflags.
Release Automation: The release.sh and bump-version.sh scripts orchestrate the release process documented in @/RELEASING.md, ensuring version consistency across all components (CLI, plugin, MCP server, npm package).
CI/CD Integration: Goreleaser (configured in @/.goreleaser.yml) uses the same ldflag patterns established by these scripts, ensuring consistency across all installation methods.
Multi-Channel Distribution: These scripts ensure that whether a user installs via Homebrew, npm, GitHub releases, or direct go install, they get consistent version reporting with full git information.
install.sh (GitHub issue #503 fix):
The script simplifies local installation from source while ensuring full version information is available in the resulting binary:
Usage (lines 1-6):
./scripts/install.sh installs to $(go env GOPATH)/bin./scripts/install.sh /usr/local/bin installs to custom locationGit Information Extraction (lines 12-14):
git rev-parse HEADgit rev-parse --abbrev-ref HEADBuild Information Display (lines 16-18):
Installation with Ldflags (line 20):
go install with explicit -ldflags to set main.Commit and main.BranchresolveCommitHash() and resolveBranch() in @/cmd/bd/version.goPost-Install Verification (lines 22-24):
bd version to show the user that installation succeededMakefile Integration (@/Makefile, lines 37-41):
The Makefile's install target uses identical logic:
go install via ldflagsmake install produces binaries with full version info, not just make buildGoreleaser Configuration (@/.goreleaser.yml):
All 5 platform builds (linux-amd64, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64) use goreleaser's built-in git variables:
-X main.Commit={{.Commit}} uses goreleaser's detected commit-X main.Branch={{.Branch}} uses goreleaser's detected branchVersion Bumping (bump-version.sh and release.sh):
@/RELEASING.mdWhy Explicit Ldflags Are Necessary:
go install does not automatically embed VCS information like go build does (even though Go supports it)Installation Path Resolution:
$(go env GOPATH)/bin as the default installation target/usr/local/bin)Git Information Fallbacks:
@/cmd/bd/version.go has its own fallback chainTesting the Version Pipeline:
./scripts/install.sh, users should immediately see full version info via bd versionbd version 0.29.0 (dev: main@7e70940)commit and branch fieldsRelease Coordination:
install.sh script is independent of release automationrelease.sh, update-homebrew.sh) handle orchestration across channels and are documented separately in @/RELEASING.mdPlatform Compatibility:
Security Considerations:
set -e to fail fast on any errors2>/dev/null to suppress errors)Created and maintained by Nori.