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
|
||||
Reference in New Issue
Block a user