Compare commits

...

2 Commits

Author SHA1 Message Date
cf3f0ae990 fix: default git tag message from UTF-8 bytes for Windows PowerShell 5.1
All checks were successful
技能自动化发布 / release (push) Successful in 5s
2026-08-18 10:19:47 +08:00
a11cdf4e7e fix: write git tag/commit messages via UTF-8 -F file
All checks were successful
技能自动化发布 / release (push) Successful in 5s
2026-08-18 10:16:33 +08:00
4 changed files with 44 additions and 11 deletions

View File

@@ -9,10 +9,19 @@
- 小节正文写用户能看懂的变化(新能力、修复、注意事项),避免堆砌内部实现细节 - 小节正文写用户能看懂的变化(新能力、修复、注意事项),避免堆砌内部实现细节
- 打 tag 前**必须**为即将发布的版本新增一节;找不到匹配小节时,本次发布不会更新 changelog 字段 - 打 tag 前**必须**为即将发布的版本新增一节;找不到匹配小节时,本次发布不会更新 changelog 字段
## 1.0.88
- `release.ps1` 默认 tag 说明改为 UTF-8 字节写入,不再依赖脚本源码里的中文默认参数(Windows PowerShell 5.1 会把无 BOM 的 UTF-8 按系统代码页解析)
- 不改写已发布 tag(v1.0.86 / v1.0.87 说明仍可能乱码)
## 1.0.87
- `release.ps1` 打 annotated tag / 自动 commit 改为 UTF-8 消息文件 + `git -F`,避免 `-m` 走控制台代码页
- 默认说明仍可能乱码(见 1.0.88)
## 1.0.86 ## 1.0.86
- 修复 `release.ps1` 在中文 Windows 下经 `cmd /c` 打 annotated tag 时,默认说明「正式发布」被 OEM 代码页转成乱码的问题 - 去掉 `release.ps1` 里通过 `cmd /c` 调 git 的写法;中文 tag 说明在部分 Windows 控制台代码页下仍可能乱码,见 1.0.87
- 改为直接调用 `git.exe` 并按参数数组传 `-m`,commit / tag 中文说明保持 UTF-8;不改写历史 tag
## 1.0.85 ## 1.0.85

View File

@@ -1,7 +1,7 @@
--- ---
name: 技能开发模板(通用业务版) name: 技能开发模板(通用业务版)
description: "OpenClaw 通用业务技能开发模板,供复制后定制新业务 skill。定制步骤见 development/DEVELOPMENT.md。" description: "OpenClaw 通用业务技能开发模板,供复制后定制新业务 skill。定制步骤见 development/DEVELOPMENT.md。"
version: 1.0.86 version: 1.0.88
author: 深圳匠厂科技有限公司 author: 深圳匠厂科技有限公司
metadata: metadata:
openclaw: openclaw:

View File

@@ -17,7 +17,7 @@
[CmdletBinding()] [CmdletBinding()]
param( param(
[string]$Prefix = "v", [string]$Prefix = "v",
[string]$Message = "正式发布", [string]$Message,
[switch]$AutoCommit, [switch]$AutoCommit,
[switch]$RequireClean, [switch]$RequireClean,
[string]$CommitMessage, [string]$CommitMessage,
@@ -28,6 +28,13 @@ param(
Set-StrictMode -Version Latest Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
# Default tag message is 「正式发布」 from UTF-8 bytes (not a Chinese literal in
# this file). Windows PowerShell 5.1 parses UTF-8 scripts without BOM as the
# system ANSI code page, which would turn a source literal into 「姝e紡鍙戝竷」.
if (-not $PSBoundParameters.ContainsKey("Message") -or [string]::IsNullOrWhiteSpace($Message)) {
$Message = [System.Text.Encoding]::UTF8.GetString([byte[]](0xE6, 0xAD, 0xA3, 0xE5, 0xBC, 0x8F, 0xE5, 0x8F, 0x91, 0xE5, 0xB8, 0x83))
}
function Remove-GitNoise { function Remove-GitNoise {
param([string[]]$Lines) param([string[]]$Lines)
return @($Lines | Where-Object { return @($Lines | Where-Object {
@@ -45,9 +52,11 @@ function Convert-GitOutputLines {
) )
} }
# Call git.exe directly. Do not wrap with `cmd /c` — on Chinese Windows, cmd # Call git.exe directly. Never wrap with `cmd /c`: on Chinese Windows, cmd
# re-encodes -m / -F arguments through the OEM code page and garbles UTF-8 # re-encodes the command line through the OEM code page.
# annotated tag / commit messages (e.g. 「正式发布」 → 「姝e紡鍙戝竷」). # Also never pass Chinese via `git -m`: Windows PowerShell 5.1 encodes native
# argv using the console code page, so 「正式发布」 becomes 「姝e紡鍙戝竷」
# in the annotated tag. Commit/tag messages go through a UTF-8 file + `-F`.
function Invoke-GitRaw { function Invoke-GitRaw {
param([Parameter(Mandatory = $true)][string[]]$GitArgs) param([Parameter(Mandatory = $true)][string[]]$GitArgs)
$prev = $ErrorActionPreference $prev = $ErrorActionPreference
@@ -73,6 +82,21 @@ function Invoke-Git {
} }
} }
function Invoke-GitWithMessageFile {
param(
[Parameter(Mandatory = $true)][string[]]$GitArgsPrefix,
[Parameter(Mandatory = $true)][string]$Message
)
$msgFile = Join-Path ([System.IO.Path]::GetTempPath()) ("jiangchang-git-msg-" + [guid]::NewGuid().ToString("N") + ".txt")
$utf8NoBom = New-Object System.Text.UTF8Encoding $false
[System.IO.File]::WriteAllText($msgFile, ($Message.TrimEnd() + "`n"), $utf8NoBom)
try {
Invoke-Git -GitArgs (@("-c", "i18n.commitEncoding=utf-8") + $GitArgsPrefix + @("-F", $msgFile))
} finally {
Remove-Item -LiteralPath $msgFile -Force -ErrorAction SilentlyContinue
}
}
function Get-GitOutput { function Get-GitOutput {
param([Parameter(Mandatory = $true)][string[]]$GitArgs) param([Parameter(Mandatory = $true)][string[]]$GitArgs)
$r = Invoke-GitRaw -GitArgs $GitArgs $r = Invoke-GitRaw -GitArgs $GitArgs
@@ -229,7 +253,7 @@ function Ensure-CleanOrAutoCommit {
} }
Invoke-Git -GitArgs @("add", "-A") Invoke-Git -GitArgs @("add", "-A")
Invoke-Git -GitArgs @("commit", "-m", $commitMsg) Invoke-GitWithMessageFile -GitArgsPrefix @("commit") -Message $commitMsg
} }
try { try {
@@ -289,13 +313,13 @@ try {
} }
if ($DryRun) { if ($DryRun) {
Write-Host "[DryRun] Would run: git tag -a $nextTag -m `"$Message`"" -ForegroundColor Yellow Write-Host "[DryRun] Would run: git tag -a $nextTag -F <utf8-msg-file> ($Message)" -ForegroundColor Yellow
Write-Host "[DryRun] Would run: git push origin $nextTag" -ForegroundColor Yellow Write-Host "[DryRun] Would run: git push origin $nextTag" -ForegroundColor Yellow
Write-Host "=== DryRun Complete ===" -ForegroundColor Cyan Write-Host "=== DryRun Complete ===" -ForegroundColor Cyan
exit 0 exit 0
} }
Invoke-Git -GitArgs @("tag", "-a", $nextTag, "-m", $Message) Invoke-GitWithMessageFile -GitArgsPrefix @("tag", "-a", $nextTag) -Message $Message
Invoke-Git -GitArgs @("push", "origin", $nextTag) Invoke-Git -GitArgs @("push", "origin", $nextTag)
Write-Host "Release success: $nextTag" -ForegroundColor Green Write-Host "Release success: $nextTag" -ForegroundColor Green

View File

@@ -1,6 +1,6 @@
"""技能标识、版本与平台公共库约束(复制后请修改 slug/version/logger)。""" """技能标识、版本与平台公共库约束(复制后请修改 slug/version/logger)。"""
SKILL_SLUG = "your-skill-slug" SKILL_SLUG = "your-skill-slug"
SKILL_VERSION = "1.0.86" SKILL_VERSION = "1.0.88"
LOG_LOGGER_NAME = "openclaw.skill.your_skill_slug" LOG_LOGGER_NAME = "openclaw.skill.your_skill_slug"
PLATFORM_KIT_MIN_VERSION = "1.2.11" PLATFORM_KIT_MIN_VERSION = "1.2.11"