Categorize TODO items in PowerShell files + Implement obslink.ps1 URI encoding fix#2
Categorize TODO items in PowerShell files + Implement obslink.ps1 URI encoding fix#2
Conversation
Co-authored-by: darthwalsh <2829438+darthwalsh@users.noreply.github.com>
Co-authored-by: darthwalsh <2829438+darthwalsh@users.noreply.github.com>
Co-authored-by: darthwalsh <2829438+darthwalsh@users.noreply.github.com>
|
@copilot Ok, rebase your branch now that i changed a few. Go through the recommendations, and filter to things that you can add new pester tests for. We'll implement each change per PR. My guess is obslink could use EscapeDataString, and the test could use pester mocking how Start-Process was invoked? (and that the symlink was created) -- but feel free to suggest another |
Rebased successfully onto main (commit dc0d661). From the 9 trivial TODOs, the best candidates for Pester tests are: #8 obslink.ps1:86 - Replace
#2 compress-jpg.ps1 - Add .jpeg extension support
#4 Get-Links.ps1 - Verify cross-platform support
Starting with obslink.ps1 as suggested. Will create a separate PR with tests. |
now finds items in subdirectories doesn't use shell to expand globs (wasn't working for hidden files
## Plan for Adding Test Instructions and GitHub Actions - [x] Explore repository structure - [x] Understand testing setup (Pester for PowerShell tests) - [x] Identify issues with current test setup - [x] Create missing test data directory (dir1) - [x] Update tests/README.md with complete test running instructions - [x] Create GitHub Actions workflow for Linux with PowerShell support - [x] Test the workflow configuration locally - [x] Verify tests run correctly with dependencies installed - [x] Update main README.md with link to testing docs - [x] Document manual steps needed to enable GitHub Actions - [x] Run code review - [x] Fix security issues (added explicit permissions) - [x] Fix PowerShell PATH syntax issue in workflow - [x] Remove unnecessary PowerShell installation step - [x] Remove redundant Pester installation step ### All Tests Pass: ✅ All 3 Pester tests pass locally ✅ Uses pre-installed PowerShell and Pester ✅ Code review: No issues ✅ Security scan: No vulnerabilities <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > add instructions for running tests so that an agent is able to run it, and also add a GitHub action for just for running on Linux using a well-supported operating system. it looks like it will need to support running powershell so maybe that could come from a GitHub action or a docker container or something > > if you're not able to take some manual step using the GUI, then do your best with all of the files and give me a clear list of steps for how to enable GitHub actions on my repo </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: darthwalsh <2829438+darthwalsh@users.noreply.github.com> Co-authored-by: Carl Walsh <darthwalsh@gmail.com>
Add comprehensive Pester tests for obslink.ps1 covering: - URL encoding verification (EscapeDataString vs HttpUtility) - Symlink creation and management - Remove symlink functionality - Error handling for conflicts Fixes #8 from TODO-CATEGORIZATION.md - use proper URI encoding Co-authored-by: darthwalsh <2829438+darthwalsh@users.noreply.github.com>
Analyzed all TODO comments and
- [ ]checkbox items in.ps1files to identify trivial implementations and mistaken assumptions.Analysis
Found 33 items across 32 PowerShell files:
9 Trivial - File moves, one-line fixes, path corrections
ocr.ps1→ move towin/directorycompress-jpg.ps1→ add.jpegextension supportobslink.ps1:86→ replaceHttpUtility.UrlEncodewith[uri]::EscapeDataString✅ Implementedhard_disk_copy.ps1/win/winocr.ps1→ literal "TODO" in paths3 Mistaken/Outdated
win/Microsoft.PowerShell_profile.ps1:41→ PSCommandNotFoundSuggestion now mainstream in PS 7.5+gitodo.ps1:29→ suggestsgit add --intent-to-addbut functionality already existsc.ps1:47→ entire script incomplete/abandoned20 Complex - Design decisions, API integrations, substantial refactoring
1 Checkbox - Documentation note about Windows symlink behavior
Deliverable
Created
TODO-CATEGORIZATION.mdwith detailed context, reasoning, and prioritized recommendations for each item.Implementation: obslink.ps1 URI Encoding
Implemented the first trivial TODO (#8) with comprehensive test coverage:
Changes Made
obslink.ps1
[System.Web.HttpUtility]::UrlEncode()with[uri]::EscapeDataString()%20instead of+tests/obslink.Tests.ps1 (NEW)
-RemoveswitchWhy EscapeDataString is Better
[uri]::EscapeDataStringis the proper method for encoding URI path components:%20(not+like HttpUtility)Testing
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.