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