Skip to content

Categorize TODO items in PowerShell files + Implement obslink.ps1 URI encoding fix#2

Draft
Copilot wants to merge 14 commits intomainfrom
copilot/categorize-todo-items-in-ps1-files
Draft

Categorize TODO items in PowerShell files + Implement obslink.ps1 URI encoding fix#2
Copilot wants to merge 14 commits intomainfrom
copilot/categorize-todo-items-in-ps1-files

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

Analyzed all TODO comments and - [ ] checkbox items in .ps1 files 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 to win/ directory
    • compress-jpg.ps1 → add .jpeg extension support
    • obslink.ps1:86 → replace HttpUtility.UrlEncode with [uri]::EscapeDataStringImplemented
    • hard_disk_copy.ps1 / win/winocr.ps1 → literal "TODO" in paths
  • 3 Mistaken/Outdated

    • win/Microsoft.PowerShell_profile.ps1:41 → PSCommandNotFoundSuggestion now mainstream in PS 7.5+
    • gitodo.ps1:29 → suggests git add --intent-to-add but functionality already exists
    • c.ps1:47 → entire script incomplete/abandoned
  • 20 Complex - Design decisions, API integrations, substantial refactoring

    • Smart fetch caching, scoring systems, GraphQL extensions, error handling strategies
  • 1 Checkbox - Documentation note about Windows symlink behavior

Deliverable

Created TODO-CATEGORIZATION.md with 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

  • Replaced [System.Web.HttpUtility]::UrlEncode() with [uri]::EscapeDataString()
  • Removed TODO comment about using EscapeDataString (line 86)
  • More standard URI encoding: spaces as %20 instead of +

tests/obslink.Tests.ps1 (NEW)

  • 7 comprehensive Pester tests covering:
    • URL encoding behavior verification (EscapeDataString vs HttpUtility)
    • Symlink creation in vault directory
    • Idempotent symlink creation
    • Error handling for conflicts
    • Symlink removal with -Remove switch
    • Error handling for removing non-symlinks

Why EscapeDataString is Better

[uri]::EscapeDataString is the proper method for encoding URI path components:

  • Encodes spaces as %20 (not + like HttpUtility)
  • Follows URI RFC 3986 standard
  • Built into .NET, no additional assembly needed
  • Better for URI paths vs query strings

Testing

  • ✅ All 7 obslink.ps1 tests pass
  • ✅ Existing rgg.ps1 tests pass (requires ripgrep in CI)
  • ✅ Changes are minimal and focused
Original prompt

look through all TODO in .ps1 files, and categorize any that look trivial to implement or are haven't mistaken assumption

also consider

  • [ ]
    at the start of any line to be a to-do

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 9, 2026 01:51
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 AI changed the title [WIP] Categorize trivial TODOs in PowerShell scripts Categorize TODO items in PowerShell files Jan 9, 2026
Copilot AI requested a review from darthwalsh January 9, 2026 01:56
@darthwalsh
Copy link
Owner

@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

Copy link
Contributor Author

Copilot AI commented Jan 18, 2026

@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 o...

Rebased successfully onto main (commit dc0d661).

From the 9 trivial TODOs, the best candidates for Pester tests are:

#8 obslink.ps1:86 - Replace HttpUtility.UrlEncode with [uri]::EscapeDataString

  • Test can mock Start-Process to verify correct URL encoding
  • Test can verify symlink creation with temp files
  • Most straightforward to test

#2 compress-jpg.ps1 - Add .jpeg extension support

  • Test can verify both .jpg and .jpeg are accepted

#4 Get-Links.ps1 - Verify cross-platform support

  • Test can verify it works on Linux/macOS (CI runs Ubuntu)

Starting with obslink.ps1 as suggested. Will create a separate PR with tests.

darthwalsh and others added 10 commits January 19, 2026 00:00
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>
Copilot AI changed the title Categorize TODO items in PowerShell files Categorize TODO items in PowerShell files + Implement obslink.ps1 URI encoding fix Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants