Initialize Phase 0 monorepo skeleton (T-001)

This commit is contained in:
ila
2026-07-16 15:28:13 +08:00
parent 0184595ccc
commit cf9fc01c68
23 changed files with 151 additions and 74 deletions
+4 -22
View File
@@ -4,32 +4,14 @@
# - Windows 原生 PowerShell:用本文件 ./init.ps1
# - WSL / Git Bash / macOS / Linux:用 ./init.sh
# 一条命令完成:依赖安装 -> 基础验证 -> 打印启动命令。
# 复制到新项目后,必须先替换下面三个命令,让每轮会话用同一条路径启动,不靠记忆。
# 本文件不绑定任何技术栈;换技术栈时只替换这三个命令,脚本结构不用动。
# 三个命令是仓库统一入口;换工具链时同步更新文档与这里。
$ErrorActionPreference = "Stop"
Set-Location -Path $PSScriptRoot
# 按你的项目实际情况替换这三个命令。未替换前脚本会主动失败。
$InstallCmd = "__REPLACE_INSTALL_CMD__" # 依赖安装,如 uv sync / poetry install / npm install
$VerifyCmd = "__REPLACE_VERIFY_CMD__" # 基础验证 / smoke,如 python -m pytest / go test ./...
$StartCmd = "__REPLACE_START_CMD__" # 开发启动,如 uvicorn app:app --reload / npm run dev
function Assert-Configured {
param(
[string]$Name,
[string]$Value
)
if ($Value -like "__REPLACE_*") {
Write-Error "请先在 init.ps1 中替换 $Name。同步更新 docs/03-tech-stack.md、docs/00-ai-start-here.md 和 docs/current-state.md 中的命令。"
exit 2
}
}
Assert-Configured -Name "InstallCmd" -Value $InstallCmd
Assert-Configured -Name "VerifyCmd" -Value $VerifyCmd
Assert-Configured -Name "StartCmd" -Value $StartCmd
$InstallCmd = "go work sync"
$VerifyCmd = 'go -C core vet ./...; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }; go -C core test -count=1 ./...'
$StartCmd = '$env:GOTOOLCHAIN="go1.25.0"; $env:GOOS="windows"; $env:GOARCH="amd64"; go build -C app-modern -o ../dist/SoftBox.exe ./cmd/softbox; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }; $env:GOTOOLCHAIN="go1.20.14"; go build -C app-win7 -o ../dist/SoftBox-win7.exe ./cmd/softbox'
Write-Host "==> 当前目录: $($PWD.Path)"