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:
38
scripts/build.ps1
Normal file
38
scripts/build.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# Cross-compile factory for all platforms (Windows-friendly)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$VERSION = if ($env:VERSION) { $env:VERSION } else { "0.1.0" }
|
||||
$DIST_DIR = "dist"
|
||||
|
||||
Push-Location (Split-Path $PSScriptRoot)
|
||||
Write-Host "Building factory v$VERSION..."
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $DIST_DIR | Out-Null
|
||||
|
||||
$Targets = @(
|
||||
@{ Name = "linux-amd64"; GOOS = "linux"; GOARCH = "amd64" }
|
||||
@{ Name = "linux-arm64"; GOOS = "linux"; GOARCH = "arm64" }
|
||||
@{ Name = "windows-amd64"; GOOS = "windows"; GOARCH = "amd64" }
|
||||
@{ Name = "windows-arm64"; GOOS = "windows"; GOARCH = "arm64" }
|
||||
@{ Name = "darwin-amd64"; GOOS = "darwin"; GOARCH = "amd64" }
|
||||
@{ Name = "darwin-arm64"; GOOS = "darwin"; GOARCH = "arm64" }
|
||||
)
|
||||
|
||||
foreach ($t in $Targets) {
|
||||
$output = "$DIST_DIR/factory-$($t.GOOS)-$($t.GOARCH)"
|
||||
if ($t.GOOS -eq "windows") { $output += ".exe" }
|
||||
|
||||
Write-Host " → $($t.Name)"
|
||||
|
||||
$env:GOOS = $t.GOOS
|
||||
$env:GOARCH = $t.GOARCH
|
||||
$env:CGO_ENABLED = "0"
|
||||
|
||||
go build -ldflags="-s -w -X main.Version=$VERSION" -o $output ./cmd/factory
|
||||
}
|
||||
|
||||
Pop-Location
|
||||
|
||||
Write-Host "`n✓ Built to $DIST_DIR/"
|
||||
Get-ChildItem $DIST_DIR | Format-Table Name, Length
|
||||
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