Recognize PowerShell Get-Content file reads (#38415)

## What changed

- Classify simple PowerShell `Get-Content` commands, including `gc` and `type` aliases, as file reads while preserving Windows paths.
- Reuse the shared classification for implicit skill invocation detection on Windows and render recognized commands as `Read <file>` in the TUI.
- Leave commands with unsupported flags, multiple operands, wildcards, or expressions unclassified.

## Testing

- Cover supported and rejected PowerShell forms, Windows executor skill detection, and the TUI read summary.

GitOrigin-RevId: 4e8f5470f2ae31c08d74091f9634c2926e516ccf
This commit is contained in:
iceweasel-oai
2026-08-13 18:30:51 +00:00
committed by copyberry
parent 73862481e5
commit 2aba3219e6
5 changed files with 231 additions and 64 deletions
+28
View File
@@ -964,6 +964,34 @@ mod tests {
);
}
#[test]
fn powershell_skill_read_snapshot() {
let command = vec![
"powershell.exe".to_string(),
"-Command".to_string(),
r"Get-Content C:\skills\demo\SKILL.md".to_string(),
];
let parsed = codex_shell_command::parse_command::parse_command(&command);
let cell = new_active_exec_command(
"call-id".to_string(),
command,
parsed,
ExecCommandSource::Agent,
/*interaction_input*/ None,
/*animations_enabled*/ false,
);
let rendered = cell
.display_lines(/*width*/ 80)
.iter()
.map(render_line_text)
.join("\n");
insta::assert_snapshot!(rendered, @r"
• Exploring
└ Read SKILL.md
");
}
#[test]
fn command_truncation_ellipsis_does_not_include_transcript_hint() {
let truncated = ExecCell::limit_lines_from_start(