Editing endpoints.ps1 deletes endpoint script files in subdirectories

Product: PowerShell Universal
Version: 5.6.13

Hi everyone,

I’m experiencing a critical issue with Endpoints files in PowerShell Universal. I manage my configuration directly via VS Code (editing files on disk) and the environment is running on IIS.

Folder Structure: I use a modular structure for my endpoints:

  • .universal/endpoints.ps1

  • .universal/Endpoints/SubFolder/script.ps1 and etc.

The Issue: Whenever I edit endpoints.ps1 in VS Code and save, PSU seems to trigger a sync/cleanup that deletes all .ps1 files inside the Endpoints/ subdirectories, except for the one associated with the specific line I just edited/saved.

Essentially, manually updating the main configuration file causes PSU to wipe out any endpoint scripts it (wrongly) perceives as unreferenced or out of sync.

Has anyone else seen this behavior when working directly on the filesystem? Is there a way to disable this aggressive cleanup?