fix: 保留 apply-patch CRLF 完整性

This commit is contained in:
Codex
2026-07-10 15:03:56 +02:00
parent fe7b0bf290
commit 760a92ee11
5 changed files with 246 additions and 4 deletions
+5
View File
@@ -12,6 +12,11 @@ UniDesk 的统一 CLI 实现入口是根目录 `scripts/cli.ts`,运行方式
Windows `ps` 的参数语义分为两种:单个参数是完整 PowerShell source;多个参数是边界明确的 argv。后者对 native application 使用 Windows 命令行引用规则,必须保留 `python -c` 代码中的路径、`encoding="utf-8"`、字典 key 和嵌套引号,并继承 route 对应的 Windows workspace。PowerShell prelude 将 `Get-Content` 默认编码固定为 UTF-8Windows fs helper 的 `head` / `tail` 同时支持 `-n N``-nN``--lines=N` 和 GNU `-N``wc -l` 必须把选项与路径分开解析。
- Windows/WSL `apply-patch v2` 文本完整性合同:
- localized replacement 必须保留纯 CRLF 文件的 CRLF 风格,不能把新增行写成 bare LF,也不能把整个文件静默改写为 LF。
- original/final integrity mismatch 后必须重新只读采集当前文件,输出 adapter、stage、expected/current bytes、SHA-256、newline 和 encoding;摘要不得包含文件正文。
- Windows 与 WSL route 对同一文件使用同一 replacement plan 和 payload 合同;失败不能自动或人工建议回退 Windows 不支持的 `apply-patch-v1`
CLI 可以从 `master` 快速演进,但必须兼容 `deploy.json` 固定的 CI/CD server 和生产运行面。CLI/server 能力协商、unsupported-version 失败语义和 release-line 边界由 `docs/reference/release-governance.md` 与 [GitHub issue #6](https://github.com/pikasTech/unidesk/issues/6) 约束。
## CI/CD Control Boundary