diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ceaad5..6c50e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ - 小节正文写用户能看懂的变化(新能力、修复、注意事项),避免堆砌内部实现细节 - 打 tag 前**必须**为即将发布的版本新增一节;找不到匹配小节时,本次发布不会更新 changelog 字段 +## 1.0.86 + +- 修复 `release.ps1` 在中文 Windows 下经 `cmd /c` 打 annotated tag 时,默认说明「正式发布」被 OEM 代码页转成乱码的问题 +- 改为直接调用 `git.exe` 并按参数数组传 `-m`,commit / tag 中文说明保持 UTF-8;不改写历史 tag + ## 1.0.85 - 新增开发主文 `development/PRODUCT_SURFACES.md`:说明对话 / 数据管理 / 定时任务平级关系、何时走哪个入口、如何做入口定位 diff --git a/SKILL.md b/SKILL.md index dd86077..9cba0f5 100644 --- a/SKILL.md +++ b/SKILL.md @@ -1,7 +1,7 @@ --- name: 技能开发模板(通用业务版) description: "OpenClaw 通用业务技能开发模板,供复制后定制新业务 skill。定制步骤见 development/DEVELOPMENT.md。" -version: 1.0.85 +version: 1.0.86 author: 深圳匠厂科技有限公司 metadata: openclaw: diff --git a/release.ps1 b/release.ps1 index ba0a25f..fabfcec 100644 --- a/release.ps1 +++ b/release.ps1 @@ -35,40 +35,68 @@ function Remove-GitNoise { }) } +function Convert-GitOutputLines { + param($Output) + return @( + @($Output) | ForEach-Object { + if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.ToString() } + else { "$_" } + } + ) +} + +# Call git.exe directly. Do not wrap with `cmd /c` — on Chinese Windows, cmd +# re-encodes -m / -F arguments through the OEM code page and garbles UTF-8 +# annotated tag / commit messages (e.g. 「正式发布」 → 「姝e紡鍙戝竷」). +function Invoke-GitRaw { + param([Parameter(Mandatory = $true)][string[]]$GitArgs) + $prev = $ErrorActionPreference + $ErrorActionPreference = "Continue" + try { + $output = & git @GitArgs 2>&1 + $code = $LASTEXITCODE + } finally { + $ErrorActionPreference = $prev + } + return [pscustomobject]@{ + ExitCode = $code + Lines = @(Remove-GitNoise -Lines @(Convert-GitOutputLines -Output $output)) + } +} + function Invoke-Git { - param([Parameter(Mandatory = $true)][string]$Args) - Write-Host ">> git $Args" -ForegroundColor DarkGray - & cmd /c "git $Args 2>&1" | Out-Null - if ($LASTEXITCODE -ne 0) { - throw "git command failed: git $Args" + param([Parameter(Mandatory = $true)][string[]]$GitArgs) + Write-Host (">> git " + ($GitArgs -join " ")) -ForegroundColor DarkGray + $r = Invoke-GitRaw -GitArgs $GitArgs + if ($r.ExitCode -ne 0) { + throw "git command failed: git $($GitArgs -join ' ')" } } function Get-GitOutput { - param([Parameter(Mandatory = $true)][string]$Args) - $output = & cmd /c "git $Args 2>&1" - if ($LASTEXITCODE -ne 0) { - throw "git command failed: git $Args" + param([Parameter(Mandatory = $true)][string[]]$GitArgs) + $r = Invoke-GitRaw -GitArgs $GitArgs + if ($r.ExitCode -ne 0) { + throw "git command failed: git $($GitArgs -join ' ')" } - return @(Remove-GitNoise -Lines @($output)) + return @($r.Lines) } function Test-Repo { - $output = & cmd /c "git rev-parse --is-inside-work-tree 2>&1" - if ($LASTEXITCODE -ne 0) { + $r = Invoke-GitRaw -GitArgs @("rev-parse", "--is-inside-work-tree") + if ($r.ExitCode -ne 0) { return $false } - $clean = Remove-GitNoise -Lines @($output) - return (($clean | Select-Object -First 1) -eq "true") + return (($r.Lines | Select-Object -First 1) -eq "true") } function Get-CurrentBranch { - $b = (Get-GitOutput "branch --show-current" | Select-Object -First 1).Trim() + $b = (Get-GitOutput -GitArgs @("branch", "--show-current") | Select-Object -First 1).Trim() return $b } function Get-StatusPorcelain { - $lines = @(Get-GitOutput "status --porcelain") + $lines = @(Get-GitOutput -GitArgs @("status", "--porcelain")) return $lines } @@ -92,7 +120,7 @@ function Parse-SemVerTag { function Get-NextTag { param([string]$TagPrefix) - $tags = Get-GitOutput "tag --list" + $tags = Get-GitOutput -GitArgs @("tag", "--list") $parsed = @() foreach ($t in $tags) { @@ -181,7 +209,7 @@ function Ensure-CleanOrAutoCommit { if ($NeedClean) { Write-Host "Working tree is not clean and -RequireClean is enabled." -ForegroundColor Yellow - Remove-GitNoise -Lines @(& cmd /c "git status --short 2>&1") | ForEach-Object { Write-Host $_ } + (Invoke-GitRaw -GitArgs @("status", "--short")).Lines | ForEach-Object { Write-Host $_ } throw "Abort: dirty working tree." } @@ -200,8 +228,8 @@ function Ensure-CleanOrAutoCommit { return } - Invoke-Git "add -A" - Invoke-Git "commit -m `"$commitMsg`"" + Invoke-Git -GitArgs @("add", "-A") + Invoke-Git -GitArgs @("commit", "-m", $commitMsg) } try { @@ -223,10 +251,10 @@ try { if ($DryRun) { Write-Host "[DryRun] Would run: git fetch --tags --prune origin" -ForegroundColor Yellow } else { - Invoke-Git "fetch --tags --prune origin" + Invoke-Git -GitArgs @("fetch", "--tags", "--prune", "origin") } - $skillRoot = (Get-GitOutput "rev-parse --show-toplevel" | Select-Object -First 1).Trim() + $skillRoot = (Get-GitOutput -GitArgs @("rev-parse", "--show-toplevel") | Select-Object -First 1).Trim() if (Test-Path -LiteralPath (Join-Path $skillRoot "SKILL.md")) { Assert-SkillReleasePackagingSources -SkillRoot $skillRoot } @@ -235,8 +263,8 @@ try { Ensure-CleanOrAutoCommit -DoAutoCommit:$AutoCommit -NeedClean:$RequireClean -IsDryRun:$DryRun -Msg $CommitMessage - $null = Remove-GitNoise -Lines @(& cmd /c 'git rev-parse --abbrev-ref --symbolic-full-name "@{u}" 2>&1') - $hasUpstream = ($LASTEXITCODE -eq 0) + $upstream = Invoke-GitRaw -GitArgs @("rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}") + $hasUpstream = ($upstream.ExitCode -eq 0) if ($DryRun) { if ($hasUpstream) { @@ -246,16 +274,16 @@ try { } } else { if ($hasUpstream) { - Invoke-Git "push" + Invoke-Git -GitArgs @("push") } else { - Invoke-Git "push -u origin $branch" + Invoke-Git -GitArgs @("push", "-u", "origin", $branch) } } $nextTag = Get-NextTag -TagPrefix $Prefix Write-Host "Next tag: $nextTag" -ForegroundColor Green - $existing = @(Get-GitOutput "tag --list `"$nextTag`"") + $existing = @(Get-GitOutput -GitArgs @("tag", "--list", $nextTag)) if ($existing.Length -gt 0) { throw "Tag already exists: $nextTag" } @@ -267,8 +295,8 @@ try { exit 0 } - Invoke-Git "tag -a $nextTag -m `"$Message`"" - Invoke-Git "push origin $nextTag" + Invoke-Git -GitArgs @("tag", "-a", $nextTag, "-m", $Message) + Invoke-Git -GitArgs @("push", "origin", $nextTag) Write-Host "Release success: $nextTag" -ForegroundColor Green Write-Host "=== Release Script Done ===" -ForegroundColor Cyan diff --git a/scripts/util/constants.py b/scripts/util/constants.py index b50d062..2b95e84 100644 --- a/scripts/util/constants.py +++ b/scripts/util/constants.py @@ -1,6 +1,6 @@ """技能标识、版本与平台公共库约束(复制后请修改 slug/version/logger)。""" SKILL_SLUG = "your-skill-slug" -SKILL_VERSION = "1.0.85" +SKILL_VERSION = "1.0.86" LOG_LOGGER_NAME = "openclaw.skill.your_skill_slug" PLATFORM_KIT_MIN_VERSION = "1.2.11"