chore(M00-A): 建立单仓库基线和参考清单

This commit is contained in:
Codex
2026-06-15 15:34:50 +08:00
commit 28613b2093
62 changed files with 5830 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
param(
[Parameter(Mandatory = $true)]
[string]$Message,
[string[]]$Paths = @(),
[switch]$Amend
)
$ErrorActionPreference = "Stop"
function Run-Step {
param(
[string]$Name,
[scriptblock]$Block
)
Write-Host "== $Name =="
& $Block
}
Run-Step "workspace check" {
powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-workspace.ps1
}
Run-Step "local tests" {
powershell -ExecutionPolicy Bypass -File scripts/dev/windows/test-all.ps1
powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-secrets.ps1
}
Run-Step "git preflight" {
$branch = & git branch --show-current
if ($branch -ne "main") {
throw "Branch must be main, actual: $branch"
}
$origin = & git remote get-url origin
if ($origin -ne "ssh://git@git.txyundm.cn:2222/panda/qipai.git") {
throw "Invalid origin: $origin"
}
& git status --short --branch --untracked-files=all
}
Run-Step "stage files" {
if ($Paths.Count -gt 0) {
foreach ($path in $Paths) {
& git add -- $path
}
}
else {
Write-Host "No paths supplied. Review status and stage files manually, then rerun with -Paths."
throw "No paths supplied."
}
& git diff --cached --stat
if (-not (& git diff --cached --name-only)) {
throw "No staged changes."
}
}
Run-Step "commit" {
if ($Amend) {
& git commit --amend --no-edit
}
else {
& git commit -m $Message
}
}
Run-Step "push" {
& git push origin main
}
Run-Step "remote verify" {
& git fetch origin main
$head = & git rev-parse HEAD
$remote = & git rev-parse origin/main
if ($head -ne $remote) {
throw "Remote verification failed: HEAD=$head origin/main=$remote"
}
& git log -1 --oneline origin/main
}
Write-Host "PASS: module pushed and verified."