CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
migrate-to-gluecron.ps1
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| e1309d5 | 1 | # ============================================================================= |
| 2 | # Migrate gluecron to itself — Phase B | |
| 3 | # Runs from Windows / PowerShell. Mirrors the GitHub repo onto gluecron.com, | |
| 4 | # wires git remote, prints the Claude Code MCP config snippet. | |
| 5 | # ============================================================================= | |
| 6 | # | |
| 7 | # Prerequisites: | |
| 8 | # - gluecron.com responds 200 on /healthz | |
| 9 | # - ccantynz-alt account registered on gluecron.com (becomes site admin | |
| 10 | # automatically via SITE_ADMIN_USERNAME env var) | |
| 11 | # - You have a Personal Access Token at /settings/tokens on gluecron.com | |
| 12 | # | |
| 13 | # Run: .\scripts\migrate-to-gluecron.ps1 | |
| 14 | # ============================================================================= | |
| 15 | ||
| 16 | $ErrorActionPreference = "Stop" | |
| 17 | ||
| 18 | $GLUECRON = "https://gluecron.com" | |
| 19 | $GH_OWNER = "ccantynz-alt" | |
| 20 | $GH_REPO = "Gluecron.com" | |
| 21 | $GLUECRON_OWNER = "ccantynz-alt" | |
| 22 | ||
| 23 | Write-Host "==> Phase B: Migrate gluecron to itself" -ForegroundColor Cyan | |
| 24 | Write-Host "" | |
| 25 | ||
| 26 | # ─── 1. Verify gluecron.com is live ───────────────────────────────────────── | |
| 27 | Write-Host "[1/5] Verifying gluecron.com is live..." | |
| 28 | try { | |
| 29 | $health = Invoke-RestMethod -Uri "$GLUECRON/healthz" -TimeoutSec 10 | |
| 30 | Write-Host " ✓ gluecron.com /healthz responded" -ForegroundColor Green | |
| 31 | } catch { | |
| 32 | Write-Host " ✗ gluecron.com is not responding. Fix Phase A first." -ForegroundColor Red | |
| 33 | exit 1 | |
| 34 | } | |
| 35 | ||
| 36 | # ─── 2. PAT prompt ────────────────────────────────────────────────────────── | |
| 37 | Write-Host "[2/5] Personal Access Token..." | |
| 38 | Write-Host " Open in browser: $GLUECRON/settings/tokens" -ForegroundColor Yellow | |
| 39 | Write-Host " Generate a token with full scope, copy it, paste below." -ForegroundColor Yellow | |
| 40 | $secureToken = Read-Host " PAT" -AsSecureString | |
| 41 | $ptr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureToken) | |
| 42 | $PAT = [Runtime.InteropServices.Marshal]::PtrToStringAuto($ptr) | |
| 43 | [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ptr) | Out-Null | |
| 44 | if (-not $PAT -or $PAT.Length -lt 10) { | |
| 45 | Write-Host " ✗ Empty / suspicious PAT, aborting." -ForegroundColor Red | |
| 46 | exit 1 | |
| 47 | } | |
| 48 | ||
| 49 | # Verify PAT works | |
| 50 | try { | |
| 51 | $me = Invoke-RestMethod -Uri "$GLUECRON/api/v2/me" -Headers @{ Authorization = "Bearer $PAT" } -TimeoutSec 10 | |
| 52 | Write-Host " ✓ Authenticated as: $($me.username)" -ForegroundColor Green | |
| 53 | } catch { | |
| 54 | Write-Host " ✗ PAT failed auth. Verify the token at $GLUECRON/settings/tokens." -ForegroundColor Red | |
| 55 | exit 1 | |
| 56 | } | |
| 57 | ||
| 58 | # ─── 3. Trigger import from GitHub ────────────────────────────────────────── | |
| 59 | Write-Host "[3/5] Importing $GH_OWNER/$GH_REPO from GitHub..." | |
| 61a6049 | 60 | $importForm = "repo_url=$([uri]::EscapeDataString("https://github.com/$GH_OWNER/$GH_REPO"))" |
| e1309d5 | 61 | try { |
| 61a6049 | 62 | $r = Invoke-WebRequest -Method POST -Uri "$GLUECRON/import/github/repo" ` |
| e1309d5 | 63 | -Headers @{ Authorization = "Bearer $PAT" } ` |
| 61a6049 | 64 | -ContentType "application/x-www-form-urlencoded" ` |
| 65 | -Body $importForm ` | |
| 66 | -MaximumRedirection 0 ` | |
| 67 | -ErrorAction SilentlyContinue | |
| 68 | $loc = $r.Headers.Location | |
| 69 | if ($loc -match "success") { | |
| 70 | Write-Host " ✓ Repo mirrored to $GLUECRON/$GLUECRON_OWNER/$GH_REPO" -ForegroundColor Green | |
| 71 | } elseif ($loc -match "error=([^&]+)") { | |
| 72 | $err = [uri]::UnescapeDataString($matches[1]) | |
| 73 | if ($err -match "already") { | |
| 74 | Write-Host " ✓ Already imported (existing mirror)" -ForegroundColor Yellow | |
| 75 | } else { | |
| 76 | Write-Host " ✗ Import error: $err" -ForegroundColor Red | |
| 77 | Write-Host " Manual import: $GLUECRON/import" -ForegroundColor Yellow | |
| 78 | exit 1 | |
| 79 | } | |
| 80 | } else { | |
| 81 | Write-Host " ? Unexpected response (location: $loc)" -ForegroundColor Yellow | |
| 82 | } | |
| e1309d5 | 83 | } catch { |
| 61a6049 | 84 | # Invoke-WebRequest treats 302 as terminating in some PowerShell versions |
| 85 | if ($_.Exception.Response -and $_.Exception.Response.StatusCode.value__ -eq 302) { | |
| 86 | $loc = $_.Exception.Response.Headers.Location.OriginalString | |
| 87 | if ($loc -match "success") { | |
| 88 | Write-Host " ✓ Repo mirrored to $GLUECRON/$GLUECRON_OWNER/$GH_REPO" -ForegroundColor Green | |
| 89 | } elseif ($loc -match "already") { | |
| 90 | Write-Host " ✓ Already imported (existing mirror)" -ForegroundColor Yellow | |
| 91 | } else { | |
| 92 | Write-Host " ✗ Import response: $loc" -ForegroundColor Red | |
| 93 | Write-Host " Manual import: $GLUECRON/import" -ForegroundColor Yellow | |
| 94 | } | |
| e1309d5 | 95 | } else { |
| 61a6049 | 96 | Write-Host " ✗ Import call failed: $_" -ForegroundColor Red |
| 97 | Write-Host " Manual import: $GLUECRON/import" -ForegroundColor Yellow | |
| e1309d5 | 98 | exit 1 |
| 99 | } | |
| 100 | } | |
| 101 | ||
| 102 | # ─── 4. Output git remote command ─────────────────────────────────────────── | |
| 103 | Write-Host "[4/5] Git remote setup..." | |
| 104 | $remoteUrl = "$GLUECRON/$GLUECRON_OWNER/$GH_REPO.git" | |
| 105 | Write-Host " In a clone of the repo, run:" -ForegroundColor Yellow | |
| 106 | Write-Host " git remote add gluecron $remoteUrl" | |
| 107 | Write-Host " git push -u gluecron main" | |
| 108 | Write-Host "" | |
| 109 | ||
| 110 | # ─── 5. Output MCP config ─────────────────────────────────────────────────── | |
| 111 | Write-Host "[5/5] Claude Code / Cursor MCP config..." | |
| 112 | Write-Host " Add this to your Claude Desktop config (claude_desktop_config.json):" -ForegroundColor Yellow | |
| 113 | Write-Host "" | |
| 114 | $mcpConfig = @" | |
| 115 | { | |
| 116 | "mcpServers": { | |
| 117 | "gluecron": { | |
| 118 | "command": "npx", | |
| 119 | "args": ["-y", "mcp-remote", "$GLUECRON/mcp"], | |
| 120 | "env": { | |
| 121 | "GLUECRON_TOKEN": "$PAT" | |
| 122 | } | |
| 123 | } | |
| 124 | } | |
| 125 | } | |
| 126 | "@ | |
| 127 | Write-Host $mcpConfig -ForegroundColor White | |
| 128 | ||
| 129 | Write-Host "" | |
| 130 | Write-Host "==> Phase B foundation complete." -ForegroundColor Green | |
| 131 | Write-Host " Repo mirrored. From now on you can git push to either remote." | |
| 132 | Write-Host " Phase C (cut the GitHub cord) is unlocked when:" | |
| 133 | Write-Host " - You've pushed to gluecron with no errors for ~1 week" | |
| 134 | Write-Host " - You've moved active issues/PRs over" | |
| 135 | Write-Host " - The .gluecron/workflows/deploy.yml runs cleanly on push" |