$ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path $pluginPath = Join-Path $env:USERPROFILE "plugins\nobgit" $marketplacePath = Join-Path $env:USERPROFILE ".agents\plugins\marketplace.json" $marketplaceDir = Split-Path $marketplacePath New-Item -ItemType Directory -Force $pluginPath | Out-Null New-Item -ItemType Directory -Force $marketplaceDir | Out-Null Copy-Item -Recurse -Force (Join-Path $repoRoot ".codex-plugin") $pluginPath Copy-Item -Recurse -Force (Join-Path $repoRoot "assets") $pluginPath Copy-Item -Recurse -Force (Join-Path $repoRoot "skills") $pluginPath Copy-Item -Force (Join-Path $repoRoot ".mcp.json") (Join-Path $pluginPath ".mcp.json") Copy-Item -Force (Join-Path $repoRoot "readme.md") (Join-Path $pluginPath "readme.md") if (Test-Path $marketplacePath) { $marketplace = Get-Content -Raw $marketplacePath | ConvertFrom-Json } else { $marketplace = [ordered]@{ name = "personal" interface = [ordered]@{ displayName = "Personal" } plugins = @() } } if (-not ($marketplace.PSObject.Properties.Name -contains "plugins")) { $marketplace | Add-Member -MemberType NoteProperty -Name plugins -Value @() } $entry = [ordered]@{ name = "nobgit" source = [ordered]@{ source = "local" path = "./plugins/nobgit" } policy = [ordered]@{ installation = "AVAILABLE" authentication = "ON_INSTALL" } category = "Developer Tools" } $plugins = @($marketplace.plugins | Where-Object { $_.name -ne "nobgit" }) $marketplace.plugins = @($plugins + $entry) $marketplace | ConvertTo-Json -Depth 10 | Set-Content -Encoding UTF8 $marketplacePath if (Get-Command codex -ErrorAction SilentlyContinue) { try { codex plugin add nobgit@personal } catch { Write-Warning "NobGit was added to the personal marketplace, but 'codex plugin add nobgit@personal' failed. Open Codex Plugins and install NobGit from Personal." } } else { Write-Host "NobGit was added to the personal marketplace. Open Codex Plugins and install NobGit from Personal." } Write-Host "Done. Start a new Codex thread after installing NobGit."