Skip to content

Commit 4db2d65

Browse files
author
SqlRush
committed
Map PowerShell compare aliases
1 parent b57f225 commit 4db2d65

4 files changed

Lines changed: 8 additions & 0 deletions

File tree

docs/cc-100-roadmap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ M5 补充:PowerShell command canonicalization 现在保留与 PowerShell alias
215215

216216
M5 补充:PowerShell native read-only classifier 现在覆盖 Windows `fc.exe``comp.exe` 的双文件比较安全子集,要求刚好两个安全相对路径,并拒绝空/单路径、裸 `comp`、越界路径、pass-through 和动态 `/n` 参数。
217217

218+
M5 补充:PowerShell command canonicalization 现在补齐 `Compare-Object` 的常见 `compare`/`diff` alias,同时继续保留 `diff.exe` 这类原生命令后缀,避免外部命令误套 cmdlet 分类。
219+
218220
M5 补充:Bash 前台输出和 `BashOutput` 现在都走统一 tool-result budget 截断/落盘路径;`BashOutput` 增加 100k 最大结果限制,大后台输出会保存完整内容并返回 `full_output_path` 元数据。
219221

220222
M5 补充:Bash/PowerShell 后台任务现在会发 `*_background_started``*_background_finished` tool progress 事件,包含后台 ID、shell/status、exit/timed_out/cancelled、duration、时间戳和输出字节数,不携带 command 文本;completed、timed_out、cancelled 终态均已覆盖测试。

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ test/parity/ # golden tests against TS/official behavior
219219
- 本轮补充:PowerShell read-only classifier 继续覆盖 Windows `certutil -hashfile <path> [algorithm]` 的安全相对路径 checksum 形态,同时拒绝 `certutil` 其它子命令、pass-through、越界路径、动态算法和额外参数。
220220
- 本轮补充:PowerShell command canonicalization 现在保留与 PowerShell alias 碰撞的 `.exe`/`.cmd`/`.bat`/`.com` 原生命令名,避免 `fc.exe``sort.exe``sc.exe` 等被误当成 `Format-Custom``Sort-Object``Set-Content` 分类。
221221
- 本轮补充:PowerShell native read-only classifier 现在覆盖 Windows `fc.exe``comp.exe` 的双文件比较安全子集,要求刚好两个安全相对路径,并拒绝空/单路径、裸 `comp`、越界路径、pass-through 和动态 `/n` 参数。
222+
- 本轮补充:PowerShell command canonicalization 现在补齐 `Compare-Object` 的常见 `compare`/`diff` alias,同时继续保留 `diff.exe` 这类原生命令后缀,避免外部命令误套 cmdlet 分类。
222223
- 本轮补充:`BashOutput` 现在设置 100k 最大结果大小,和前台 `Bash` 一起覆盖大输出 tool-result preview 截断、完整输出落盘及 `full_output_path` 元数据。
223224
- 本轮补充:Bash/PowerShell 后台命令现在会通过 tool progress 通道发 started/finished 事件,记录后台 ID、shell/status、exit/timed_out/cancelled、duration、时间戳和 stdout/stderr byte count,且 completed、timed_out、cancelled 终态测试确保 progress 不携带 command 文本。
224225
- 本轮补充:WebSearch domain filters 现在在 schema 层声明 array `items:string`,通用 tool schema validator 同步支持 `items` 校验;`allowed_domains`/`blocked_domains` 会拒绝空字符串、URL/port、非法 wildcard 和非域名 label。

internal/tools/powershell/tools.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,8 @@ func powerShellAliasTarget(name string) string {
21692169
return "format-wide"
21702170
case "fc":
21712171
return "format-custom"
2172+
case "compare", "diff":
2173+
return "compare-object"
21722174
case "measure":
21732175
return "measure-object"
21742176
default:

internal/tools/powershell/tools_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ func TestPowerShellCommandClassification(t *testing.T) {
126126
"Get-Member -Name Length",
127127
"Get-Unique -AsString value",
128128
"Compare-Object -ReferenceObject a -DifferenceObject b",
129+
"compare -ReferenceObject a -DifferenceObject b",
130+
"diff a b",
129131
"Join-String -Separator , a b",
130132
"Get-Random -Minimum 1 -Maximum 10",
131133
"Convert-Path README.md",
@@ -359,6 +361,7 @@ func TestPowerShellCommandClassification(t *testing.T) {
359361
`comp.exe old.bin C:\Users\secret.bin`,
360362
"comp.exe old.bin new.bin /n $env:COUNT",
361363
"sort.exe /etc/passwd",
364+
"diff.exe README.md /etc/passwd",
362365
"dotnet build",
363366
"dotnet --info $env:SECRET",
364367
"docker run alpine",

0 commit comments

Comments
 (0)