Skip to content

Commit b9dff4e

Browse files
author
SqlRush
committed
Classify PowerShell item property aliases
1 parent 86f91fa commit b9dff4e

4 files changed

Lines changed: 28 additions & 1 deletion

File tree

docs/cc-100-roadmap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ M5 补充:Read/Edit 现在接受 `offset`/`limit` 和 `replace_all` 的 quoted
181181

182182
M5 补充:WebFetch prompt-focused excerpt 的 term scoring 现在会双向匹配常见单复数变体,例如 prompt `cost` 可命中正文 `costs`、prompt `candidates` 可命中正文 `candidate`,同时仍保持词边界匹配避免子串误命中。
183183

184+
M5 补充:PowerShell command canonicalization 现在补齐 mutating ItemProperty aliases:`sp`/`clp`/`cpp`/`mp`/`rp`/`rnp` 会分别归入 `Set/Clear/Copy/Move/Remove/Rename-ItemProperty` destructive 分类,避免属性变更 alias 被当成未知普通命令。
185+
184186
M5 补充:WebFetch HTML-to-text rendering 现在会跳过 `hidden``aria-hidden="true"`、CSS `display:none`/`visibility:hidden` 的不可见元素子树,隐藏文本和图片说明不会进入 rendered body 或 prompt-focused excerpt。
185187

186188
M5 补充:WebFetch HTML-to-text rendering 现在会为无可见文本但带 `aria-label`/`title` 的链接保留可访问名称和 resolved href,icon-only 链接可进入 rendered body 与 prompt-focused excerpt。

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ test/parity/ # golden tests against TS/official behavior
252252
- 本轮补充:PowerShell native read-only classifier 补齐 `netstat -p <protocol>` 只读协议查询形态,协议值走 literal guard,缺值和动态表达式值仍拒绝。
253253
- 本轮补充:PowerShell native read-only classifier 收紧短 flag 合并校验,`netstat -ano` 这类纯开关组合仍允许,但包含 value/path flag 的组合(如 `-anop`)不再绕过缺值校验。
254254
- 本轮补充:PowerShell native read-only classifier 收紧 `/FO` 输出格式参数,`systeminfo`/`tasklist`/`whoami`/`getmac` 只接受 `CSV`/`LIST`/`TABLE` literal 值,无效格式和动态值不再进入只读 fast path。
255+
- 本轮补充:PowerShell command canonicalization 现在补齐 mutating ItemProperty aliases:`sp`/`clp`/`cpp`/`mp`/`rp`/`rnp` 会分别归入 `Set/Clear/Copy/Move/Remove/Rename-ItemProperty` destructive 分类,避免属性变更 alias 被当成未知普通命令。
255256
- 本轮补充:`BashOutput` 现在设置 100k 最大结果大小,和前台 `Bash` 一起覆盖大输出 tool-result preview 截断、完整输出落盘及 `full_output_path` 元数据。
256257
- 本轮补充:Bash/PowerShell 后台命令现在会通过 tool progress 通道发 started/finished 事件,记录后台 ID、shell/status、exit/timed_out/cancelled、duration、时间戳和 stdout/stderr byte count,且 completed、timed_out、cancelled 终态测试确保 progress 不携带 command 文本。
257258
- 本轮补充: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: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2146,7 +2146,7 @@ func destructiveWords(words []string) bool {
21462146
switch command {
21472147
case "git":
21482148
return bashtools.IsDestructiveCommand(powerShellGitCommand(words))
2149-
case "remove-item", "set-content", "add-content", "clear-content", "clear-item", "out-file", "new-item", "move-item", "copy-item", "rename-item", "set-item", "stop-process", "stop-service", "restart-computer", "invoke-expression", "iex", "start-process", "start-transcript", "stop-transcript":
2149+
case "remove-item", "set-content", "add-content", "clear-content", "clear-item", "clear-itemproperty", "out-file", "new-item", "move-item", "move-itemproperty", "copy-item", "copy-itemproperty", "rename-item", "rename-itemproperty", "set-item", "set-itemproperty", "stop-process", "stop-service", "restart-computer", "invoke-expression", "iex", "start-process", "start-transcript", "stop-transcript":
21502150
return true
21512151
default:
21522152
return strings.HasPrefix(command, "remove-") || strings.HasPrefix(command, "set-") || strings.HasPrefix(command, "new-") || strings.HasPrefix(command, "export-")
@@ -2303,8 +2303,20 @@ func powerShellAliasTarget(name string) string {
23032303
return "clear-content"
23042304
case "cli":
23052305
return "clear-item"
2306+
case "clp":
2307+
return "clear-itemproperty"
23062308
case "si":
23072309
return "set-item"
2310+
case "sp":
2311+
return "set-itemproperty"
2312+
case "cpp":
2313+
return "copy-itemproperty"
2314+
case "mp":
2315+
return "move-itemproperty"
2316+
case "rp":
2317+
return "remove-itemproperty"
2318+
case "rnp":
2319+
return "rename-itemproperty"
23082320
case "sls":
23092321
return "select-string"
23102322
case "echo", "write":

internal/tools/powershell/tools_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,18 @@ func TestPowerShellCommandClassification(t *testing.T) {
552552
"ren a b",
553553
"Set-Item variable:x 1",
554554
"si variable:x 1",
555+
"Set-ItemProperty . -Name Mode -Value x",
556+
"sp . -Name Mode -Value x",
557+
"Clear-ItemProperty . -Name Mode",
558+
"clp . -Name Mode",
559+
"Copy-ItemProperty . other -Name Mode",
560+
"cpp . other -Name Mode",
561+
"Move-ItemProperty . other -Name Mode",
562+
"mp . other -Name Mode",
563+
"Remove-ItemProperty . -Name Mode",
564+
"rp . -Name Mode",
565+
"Rename-ItemProperty . -Name Mode -NewName Other",
566+
"rnp . -Name Mode -NewName Other",
555567
"Export-Csv out.csv",
556568
"Start-Transcript out.txt",
557569
"Stop-Process -Id 1",

0 commit comments

Comments
 (0)