Skip to content

tools: read the governance files as UTF-8 - #13

Merged
cadywang merged 1 commit into
mainfrom
tools/read-governance-as-utf8
Oct 23, 2026
Merged

cadywang merged 1 commit into
mainfrom
tools/read-governance-as-utf8

Conversation

@cadywang

Copy link
Copy Markdown
Owner

变更说明

PowerShell 5.1 的 Get-Content -Raw 默认按 ANSI 代码页解码。两个 governance JSON 目前是纯 ASCII,
所以没暴露;一旦 description 或 _comment 出现中文,ConvertFrom-Json 会解析失败——skills 与
blog 仓库在施加设置时已经踩过这个坑(dry-run 直接报 Invalid object passed in)。

现在两个文件都显式用 -Encoding UTF8 读入。

变更类型

  • 缺陷修复(fix)
  • 构建、CI、打包(build / ci)

影响面清单

  • 文档 / 仓库治理文件

测试

ps1 parse OK
tools/create-github-repo.ps1 -Owner cadywang -DryRun  -> rc=0
  dry-run 前后当前分支不变;payload 含 6 个 contexts
python tools/check-commits.py --range origin/main..HEAD -> 1/1
  • 已在真实设备上验证(如适用),命令:bash tests/verify-live.sh <client>:<port>

设备与链路信息(涉及传输改动时必填):

项 值
client OS 不适用(未改动传输路径)
串口 / 波特率 不适用
设备 shell / 系统 不适用
可用工具(base64/awk/od/md5sum) 不适用

合并前清单

  • 本地 mock 自测已全部通过,输出贴在「测试」小节
  • 协议 / 传输行为有改动时,PROTOCOL.md 与 agent/*、cli/* 四个实现已同步更新
  • 代码与注释为英文,文档为中文
  • 文件为 UTF-8(无 BOM)+ LF
  • 未提交临时产物(.tmp-*/、*.log、__pycache__/)
  • 每个 commit 遵循内核规范:<subsystem>: 祈使句摘要、正文 72 列折行,并带 Signed-off-by:(git commit -s)
  • PR 标题遵循内核规范 <subsystem>: 祈使句摘要>(网页端 squash 会把它写成提交标题)
  • 已更新 CHANGELOG.md(如面向用户的行为有变化)
  • 已阅读并遵守 SECURITY.md(不引入默认对外暴露、无鉴权的行为)

关联 Issue

无独立 Issue。对齐 skills / blog 仓库的同名修复。

PowerShell 5.1 decodes Get-Content -Raw with the ANSI code page unless it
is told otherwise. The two governance JSON files happen to be ASCII
today, so nothing breaks -- until a description or a comment carries
Chinese, which is exactly what the other two repositories hit while
applying their settings: ConvertFrom-Json rejected the file halfway
through the UTF-8 bytes.

Read both files explicitly as UTF-8. The skills and blog repositories
already do.

Signed-off-by: cadywang <cadywang@users.noreply.github.com>
@cadywang
cadywang merged commit 4aefc5b into main Oct 23, 2026
6 checks passed
@cadywang
cadywang deleted the tools/read-governance-as-utf8 branch October 23, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant