feat: L0b bootstrap scripts + L1 Go CLI structure
L0b (factory bootstrap): - bootstrap.ps1 (Windows): pre-checks, interactive config, clone .factory, home.toml - bootstrap.sh (Linux/Mac): same functionality for bash - Idempotent re-run with home.toml verification L1 (Go CLI): - factory.yaml: manifest schema with components, deps, health-checks - cmd/factory: Cobra CLI (install/update/status/diagnose) - pkg/config: home.toml reader - pkg/manifest: factory.yaml parser + topological sort - pkg/health: health-check logic (file/dir/mcp_tool/command) Scripts: - build.sh: cross-compile for linux/win/darwin × amd64/arm64 - build.ps1: PowerShell cross-compile Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
41
scripts/build.sh
Normal file
41
scripts/build.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
# Cross-compile factory for all platforms
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
VERSION=${VERSION:-"0.1.0"}
|
||||
DIST_DIR="dist"
|
||||
|
||||
echo "Building factory v$VERSION..."
|
||||
|
||||
mkdir -p "$DIST_DIR"
|
||||
|
||||
# Cross-compile targets
|
||||
declare -A TARGETS=(
|
||||
["linux-amd64"]="linux/amd64"
|
||||
["linux-arm64"]="linux/arm64"
|
||||
["windows-amd64"]="windows/amd64"
|
||||
["windows-arm64"]="windows/arm64"
|
||||
["darwin-amd64"]="darwin/amd64"
|
||||
["darwin-arm64"]="darwin/arm64"
|
||||
)
|
||||
|
||||
for name in "${!TARGETS[@]}"; do
|
||||
goos="${name%%-*}"
|
||||
goarch="${name##*-}"
|
||||
platform="${TARGETS[$name]}"
|
||||
output="$DIST_DIR/factory-$goos-$goarch"
|
||||
[[ "$goos" == "windows" ]] && output="$output.exe"
|
||||
|
||||
echo " → $name ($platform)"
|
||||
|
||||
GOOS="$goos" GOARCH="$goarch" \
|
||||
CGO_ENABLED=0 \
|
||||
go build -ldflags="-s -w -X main.Version=$VERSION" \
|
||||
-o "$output" ./cmd/factory
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✓ Built to $DIST_DIR/"
|
||||
ls -lh "$DIST_DIR/"
|
||||
Reference in New Issue
Block a user