Created
December 9, 2025 06:50
-
-
Save bhaktatejas922/5d3e9881fce5e1c51e5cef73ef8b554c to your computer and use it in GitHub Desktop.
delve_offboarding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # morphllm Offboarding Script for Windows | |
| # Usage: irm https://gist.githubusercontent.com/USER/ID/raw/offboarding.ps1 | iex | |
| $ErrorActionPreference = "Stop" | |
| $ORG = "morphllm" | |
| # Require Administrator privileges | |
| if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
| Write-Host "ERROR: This script requires Administrator privileges." -ForegroundColor Red | |
| Write-Host "Right-click PowerShell and select 'Run as Administrator'" -ForegroundColor Yellow | |
| exit 1 | |
| } | |
| Write-Host "============================================================" -ForegroundColor Cyan | |
| Write-Host "morphllm Offboarding Script" -ForegroundColor Cyan | |
| Write-Host "============================================================" | |
| Write-Host "`nScanning $env:USERPROFILE for github.com/$ORG repos...`n" | |
| $found = 0; $deleted = 0; $failed = 0 | |
| # Find all .git directories | |
| Get-ChildItem -Path $env:USERPROFILE -Filter ".git" -Recurse -Directory -ErrorAction SilentlyContinue -Force | ForEach-Object { | |
| $gitDir = $_.FullName | |
| $repoPath = Split-Path $gitDir -Parent | |
| $configFile = Join-Path $gitDir "config" | |
| if (Test-Path $configFile) { | |
| $content = Get-Content $configFile -Raw -ErrorAction SilentlyContinue | |
| if ($content -match "github\.com[:/]$ORG/") { | |
| $found++ | |
| $url = ($content | Select-String -Pattern "url\s*=\s*(.+)" | ForEach-Object { $_.Matches.Groups[1].Value.Trim() } | Select-Object -First 1) | |
| Write-Host "[MATCH] $repoPath" -ForegroundColor Green | |
| Write-Host " Remote: $url" -ForegroundColor Gray | |
| try { | |
| Remove-Item -Path $repoPath -Recurse -Force -ErrorAction Stop | |
| Write-Host " Deleted!" -ForegroundColor Green | |
| $deleted++ | |
| } catch { | |
| Write-Host " FAILED: $_" -ForegroundColor Red | |
| $failed++ | |
| } | |
| } | |
| } | |
| } | |
| Write-Host "`n============================================================" | |
| Write-Host "SUMMARY - Git Repositories" | |
| Write-Host "============================================================" | |
| Write-Host "Found: $found | Deleted: $deleted | Failed: $failed" | |
| if ($found -eq 0) { Write-Host "`nNo morphllm repos found." -ForegroundColor Yellow } | |
| elseif ($failed -eq 0) { Write-Host "`nAll morphllm repos removed!" -ForegroundColor Green } | |
| else { Write-Host "`nSome repos failed to delete. Check manually." -ForegroundColor Red } | |
| # Clean shell config files | |
| Write-Host "`n============================================================" -ForegroundColor Cyan | |
| Write-Host "Cleaning Shell Configurations" -ForegroundColor Cyan | |
| Write-Host "============================================================`n" | |
| $configFiles = @( | |
| $PROFILE, | |
| $PROFILE.CurrentUserAllHosts, | |
| "$env:USERPROFILE\.bashrc", | |
| "$env:USERPROFILE\.zshrc", | |
| "$env:USERPROFILE\.bash_profile", | |
| "$env:USERPROFILE\.zprofile" | |
| ) | |
| $totalLinesRemoved = 0 | |
| foreach ($file in $configFiles) { | |
| if ($file -and (Test-Path $file)) { | |
| $lines = Get-Content $file | |
| $cleaned = $lines | Where-Object { $_ -notmatch "morph" } | |
| $removed = $lines.Count - $cleaned.Count | |
| if ($removed -gt 0) { | |
| Set-Content -Path $file -Value $cleaned | |
| Write-Host "[CONFIG] $file - removed $removed line(s)" -ForegroundColor Green | |
| $totalLinesRemoved += $removed | |
| } else { | |
| Write-Host "[CONFIG] $file - no changes needed" -ForegroundColor Gray | |
| } | |
| } | |
| } | |
| Write-Host "`n============================================================" | |
| Write-Host "SUMMARY - Shell Configs" | |
| Write-Host "============================================================" | |
| Write-Host "Total lines removed: $totalLinesRemoved" | |
| Write-Host "`n============================================================" -ForegroundColor Green | |
| Write-Host "Offboarding Complete!" -ForegroundColor Green | |
| Write-Host "============================================================" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment