Skip to content

Commit c7ed2ee

Browse files
author
SqlRush
committed
Map PowerShell getter aliases
1 parent 00256d5 commit c7ed2ee

4 files changed

Lines changed: 23 additions & 1 deletion

File tree

docs/cc-100-roadmap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ M5 补充:PowerShell command canonicalization 现在补齐 `Select-String` 的
229229

230230
M5 补充:PowerShell command canonicalization 现在补齐 `Get-ItemProperty`/`Get-ItemPropertyValue``gip`/`gpv` aliases,继续复用 registry/provider 路径 guard,注册表 provider 和越界文件路径仍拒绝。
231231

232+
M5 补充:PowerShell command canonicalization 现在补齐 `Get-Alias`/`Get-PSDrive`/`Get-Module`/`Get-History`/`Get-Member`/`Get-Unique``gal`/`gdr`/`gmo`/`ghy`/`gm`/`gu` aliases,继续复用现有远程参数和变量输出 guard。
233+
232234
M5 补充:Bash 前台输出和 `BashOutput` 现在都走统一 tool-result budget 截断/落盘路径;`BashOutput` 增加 100k 最大结果限制,大后台输出会保存完整内容并返回 `full_output_path` 元数据。
233235

234236
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
@@ -226,6 +226,7 @@ test/parity/ # golden tests against TS/official behavior
226226
- 本轮补充:PowerShell read-only classifier 现在识别常用 common parameter aliases `-EA`/`-EV`/`-WA`/`-WV`/`-Infa`/`-IV`/`-Proga`/`-OB``-VB`/`-DB`,同时继续拒绝 `-OV`/`-PV` 这类会写入变量的 common aliases。
227227
- 本轮补充:PowerShell command canonicalization 现在补齐 `Select-String``sls` alias,复用既有 pattern/path guard,`sls TODO README.md` 可按只读搜索处理,越界路径仍拒绝。
228228
- 本轮补充:PowerShell command canonicalization 现在补齐 `Get-ItemProperty`/`Get-ItemPropertyValue``gip`/`gpv` aliases,继续复用 registry/provider 路径 guard,注册表 provider 和越界文件路径仍拒绝。
229+
- 本轮补充:PowerShell command canonicalization 现在补齐 `Get-Alias`/`Get-PSDrive`/`Get-Module`/`Get-History`/`Get-Member`/`Get-Unique``gal`/`gdr`/`gmo`/`ghy`/`gm`/`gu` aliases,继续复用现有远程参数和变量输出 guard。
229230
- 本轮补充:`BashOutput` 现在设置 100k 最大结果大小,和前台 `Bash` 一起覆盖大输出 tool-result preview 截断、完整输出落盘及 `full_output_path` 元数据。
230231
- 本轮补充:Bash/PowerShell 后台命令现在会通过 tool progress 通道发 started/finished 事件,记录后台 ID、shell/status、exit/timed_out/cancelled、duration、时间戳和 stdout/stderr byte count,且 completed、timed_out、cancelled 终态测试确保 progress 不携带 command 文本。
231232
- 本轮补充: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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,8 +2176,18 @@ func powerShellAliasTarget(name string) string {
21762176
return "start-process"
21772177
case "gsv":
21782178
return "get-service"
2179-
case "h", "history":
2179+
case "gal":
2180+
return "get-alias"
2181+
case "gdr":
2182+
return "get-psdrive"
2183+
case "gmo":
2184+
return "get-module"
2185+
case "h", "history", "ghy":
21802186
return "get-history"
2187+
case "gm":
2188+
return "get-member"
2189+
case "gu":
2190+
return "get-unique"
21812191
case "rm", "rmdir", "ri":
21822192
return "remove-item"
21832193
case "rd", "del", "erase":

internal/tools/powershell/tools_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,14 @@ func TestPowerShellCommandClassification(t *testing.T) {
178178
"Get-PSDrive -Name C",
179179
"Get-Module -ListAvailable",
180180
"Get-Alias -Name ls",
181+
"gal -Name ls",
181182
"Get-History -Count 5",
182183
"h -Count 5",
184+
"ghy -Count 5",
185+
"gdr -Name C",
186+
"gmo -ListAvailable",
187+
"gm -Name Length",
188+
"gu -AsString value",
183189
"Get-TimeZone -ListAvailable",
184190
"Get-ComputerInfo",
185191
"Get-Host",
@@ -302,6 +308,9 @@ func TestPowerShellCommandClassification(t *testing.T) {
302308
"Get-Command -Name git",
303309
"Get-Help Get-Content",
304310
"Get-Clipboard",
311+
"gal -OV aliases",
312+
"gdr -OV drives",
313+
"gmo -CimSession server",
305314
`Select-Xml -Content '<x />' -XPath /`,
306315
`Test-Json '{}'`,
307316
"ConvertTo-Json -OutFile out.json hello",

0 commit comments

Comments
 (0)