Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
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.

migrate-to-gluecron.ps1Blame135 lines · 1 contributor
e1309d5Claude1# =============================================================================
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
23Write-Host "==> Phase B: Migrate gluecron to itself" -ForegroundColor Cyan
24Write-Host ""
25
26# ─── 1. Verify gluecron.com is live ─────────────────────────────────────────
27Write-Host "[1/5] Verifying gluecron.com is live..."
28try {
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 ──────────────────────────────────────────────────────────
37Write-Host "[2/5] Personal Access Token..."
38Write-Host " Open in browser: $GLUECRON/settings/tokens" -ForegroundColor Yellow
39Write-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
44if (-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
50try {
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 ──────────────────────────────────────────
59Write-Host "[3/5] Importing $GH_OWNER/$GH_REPO from GitHub..."
61a6049Claude60$importForm = "repo_url=$([uri]::EscapeDataString("https://github.com/$GH_OWNER/$GH_REPO"))"
e1309d5Claude61try {
61a6049Claude62 $r = Invoke-WebRequest -Method POST -Uri "$GLUECRON/import/github/repo" `
e1309d5Claude63 -Headers @{ Authorization = "Bearer $PAT" } `
61a6049Claude64 -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 }
e1309d5Claude83} catch {
61a6049Claude84 # 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 }
e1309d5Claude95 } else {
61a6049Claude96 Write-Host " ✗ Import call failed: $_" -ForegroundColor Red
97 Write-Host " Manual import: $GLUECRON/import" -ForegroundColor Yellow
e1309d5Claude98 exit 1
99 }
100}
101
102# ─── 4. Output git remote command ───────────────────────────────────────────
103Write-Host "[4/5] Git remote setup..."
104$remoteUrl = "$GLUECRON/$GLUECRON_OWNER/$GH_REPO.git"
105Write-Host " In a clone of the repo, run:" -ForegroundColor Yellow
106Write-Host " git remote add gluecron $remoteUrl"
107Write-Host " git push -u gluecron main"
108Write-Host ""
109
110# ─── 5. Output MCP config ───────────────────────────────────────────────────
111Write-Host "[5/5] Claude Code / Cursor MCP config..."
112Write-Host " Add this to your Claude Desktop config (claude_desktop_config.json):" -ForegroundColor Yellow
113Write-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"@
127Write-Host $mcpConfig -ForegroundColor White
128
129Write-Host ""
130Write-Host "==> Phase B foundation complete." -ForegroundColor Green
131Write-Host " Repo mirrored. From now on you can git push to either remote."
132Write-Host " Phase C (cut the GitHub cord) is unlocked when:"
133Write-Host " - You've pushed to gluecron with no errors for ~1 week"
134Write-Host " - You've moved active issues/PRs over"
135Write-Host " - The .gluecron/workflows/deploy.yml runs cleanly on push"