Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/disk-hygiene/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
"name": "disk-hygiene",
"version": "0.17.10",
"version": "0.17.11",
"description": "Context-aware disk hygiene for arbitrary directory trees: inventories orphaned and temporary artifacts, classifies evidence into review tiers, and offers exact-path cleanup only after a fresh safety preview and explicit per-tier approval. The target is read-only by default; OS-managed paths, links and mount points, VCS-tracked content, changed entries, and live-handle uncertainty fail closed.",
"author": {
"name": "Melodic Software",
Expand Down
13 changes: 13 additions & 0 deletions plugins/disk-hygiene/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
All notable changes to the `disk-hygiene` plugin are documented here. Format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning.

## [0.17.11]

### Fixed

- **PowerShell stream merges (`2>&1`, `*>&1`) are no longer flagged as file-overwriting
redirection (#2615).** `_POWERSHELL_OUTPUT_REDIRECT` matched the `>` inside `2>&1` because
its lookaround only excluded adjacent `<`, `>`, and `=`. In PowerShell `>&` is only ever a
stream merge and never designates a file, so ordinary diagnostic commands that capture
combined output were prompting as mutations — approval-fatigue noise that blunts real
deletion prompts, especially once the belt stays armed for the rest of the session (#2591).
The detector now also excludes a following `&`; `2>out.txt` and `'data' > file` still
prompt.

## [0.17.10]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,9 @@ def is_exact_kill_switch_probe(command: str) -> bool:
_POWERSHELL_NEW_ITEM_FORCE = re.compile(
r"(?i)(?<![\w./\\-])new-item(?![\w-]).*-force\b"
)
_POWERSHELL_OUTPUT_REDIRECT = re.compile(r"(?<![<>])>(?![=>])")
# Exclude stream merges (`2>&1`, `1>&2`, `*>&1`): in PowerShell `>&` only merges
# streams and never designates a file. File redirects like `2>out.txt` still match.
_POWERSHELL_OUTPUT_REDIRECT = re.compile(r"(?<![<>])>(?![=>&])")
_POWERSHELL_DOTNET_DELETE = re.compile(r"(?i)(::\s*delete|\.\s*delete\s*\()")
# robocopy is an executable normally invocable by full path
# (C:\Windows\System32\robocopy.exe), so unlike the cmdlet word list its
Expand Down
12 changes: 12 additions & 0 deletions plugins/disk-hygiene/skills/clean/scripts/test_hygiene.py
Original file line number Diff line number Diff line change
Expand Up @@ -4574,6 +4574,7 @@ def test_powershell_deletion_spellings_force_final_prompt(self) -> None:
"Out-File C:/tmp/file.txt -Force",
"New-Item C:/tmp/file.txt -ItemType File -Force",
"'data' > C:/tmp/file.txt",
"Get-ChildItem C:/tmp 2>out.txt",
):
result = self.run_guard_powershell(command)
assert result is not None, command
Expand All @@ -4583,6 +4584,17 @@ def test_powershell_deletion_spellings_force_final_prompt(self) -> None:
command,
)

def test_powershell_stream_merges_are_not_file_redirects(self) -> None:
"""#2615: `2>&1` / `*>&1` merge streams; they must not prompt as file redirects."""
for command in (
"bash plugins/disk-hygiene/skills/clean/scripts/hygiene.test.sh 2>&1 | Select-Object -Last 8",
"git status --short 2>&1",
"Get-ChildItem C:/tmp 1>&2",
"Get-ChildItem C:/tmp *>&1",
"Get-ChildItem C:/tmp 2>&1 | Select-Object -First 1",
):
self.assertIsNone(self.run_guard_powershell(command), command)

def test_powershell_bare_name_mentions_defer_but_engine_identity_denies(self) -> None:
"""F6 (#1112): mentions defer via the invocation classifier; a command
whose argument IS the bundled engine still denies — verb names prove
Expand Down