build: add tooling config and setup script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 16:57:02 +08:00
parent f23296ec82
commit a3eab2d644
3 changed files with 140 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env pwsh
# KollectAI-ETL Bootstrap Setup
#
# Installs all required development tools and configures git hooks.
# Safe to re-run (idempotent) — skips tools that are already installed.
#
# Usage: pwsh ./setup.ps1
$ErrorActionPreference = 'Stop'
function Test-Command($Name) {
$null -ne (Get-Command $Name -ErrorAction SilentlyContinue)
}
function Install-Tool($Name, $ScriptBlock) {
if (Test-Command $Name) {
$version = & $Name --version 2>&1 | Select-Object -First 1
Write-Host "[OK] $Name already installed: $version" -ForegroundColor Green
} else {
Write-Host "[INSTALL] Installing $Name..." -ForegroundColor Yellow
& $ScriptBlock
if ($LASTEXITCODE -ne 0) {
Write-Host "[FAIL] Failed to install $Name" -ForegroundColor Red
exit 1
}
$version = & $Name --version 2>&1 | Select-Object -First 1
Write-Host "[OK] $Name installed: $version" -ForegroundColor Green
}
}
Write-Host ""
Write-Host "KollectAI-ETL Bootstrap Setup" -ForegroundColor Cyan
Write-Host "=============================" -ForegroundColor Cyan
Write-Host ""
# 1. uv (Python package manager / tool runner)
Install-Tool "uv" {
Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression
}
# 2. just (task runner)
Install-Tool "just" {
uv tool install rust-just
}
# 3. Run just setup (installs commitizen, pre-commit, configures git hooks)
Write-Host ""
Write-Host "Running just setup..." -ForegroundColor Cyan
just setup
Write-Host ""
Write-Host "Setup complete!" -ForegroundColor Green
Write-Host ""