ai-driven-development
ai-driven-development copied to clipboard
Windows cleanup apply rejects UTF-8 BOM selection JSON
Summary
apply-cleanup-selection.py rejects cleanup selection JSON files that contain a UTF-8 BOM.
Reproduction
- In Windows PowerShell, write a selection JSON with
Set-Content -Encoding UTF8. - Run
python skills/maintaining-windows-health/assets/apply-cleanup-selection.py <selection.json> --dry-run. - The script fails while parsing the JSON before validation or dry-run execution.
Actual behavior
The loader uses read_text(encoding=utf-8). A BOM is preserved and json.loads reports an unexpected UTF-8 BOM.
Expected behavior
The apply helper should accept both BOM-prefixed and BOM-less UTF-8 selection JSON.
Impact
Selection files generated or edited by Windows PowerShell cannot be previewed or applied, even when all cleanup commands are valid.
Environment
- Windows 11
- Windows PowerShell
- Python 3
Candidate fix
Read the selection with encoding=utf-8-sig and add a regression test covering BOM-prefixed JSON. A local working-tree change using utf-8-sig makes the dry-run succeed.