Commit954b19eunknown_key
chore(scripts): list-repos diagnostic — find the right push URL
chore(scripts): list-repos diagnostic — find the right push URL Companion to emergency-pat: when `git push gluecron main` returns "Repository not found" but the PAT is valid, the issue is almost always the owner/name slug in the URL not matching what's on disk (case, dashes, etc). This script dumps all repos for a user (or everyone, if no user specified), with the exact push URL each one would use. Run it and pick the line whose path matches what your local clone has. https://claude.ai/code/session_01QFLWDxWw65DX6enMcS5Lwe
1 file changed+51−0954b19e7d6a047506cb2de916e47045bfb3461c5
1 changed file+51−0
Addedscripts/list-repos.ts+51−0View fileUnifiedSplit
@@ -0,0 +1,51 @@
1// List repos for a user — diagnoses "Repository not found" on push.
2//
3// Run: EMERGENCY_PAT_USER=<username> bun run scripts/list-repos.ts
4// Or just: bun run scripts/list-repos.ts (lists everything)
5//
6// Uses raw SQL to survive any schema drift.
7
8import { neon } from "@neondatabase/serverless";
9
10async function main() {
11 const url = process.env.DATABASE_URL;
12 if (!url) {
13 console.error("DATABASE_URL is not set.");
14 process.exit(1);
15 }
16 const sql = neon(url);
17 const wanted = process.env.EMERGENCY_PAT_USER?.trim();
18
19 const rows = wanted
20 ? (await sql`
21 SELECT r.name, r.is_private, u.username AS owner
22 FROM repositories r JOIN users u ON u.id = r.owner_id
23 WHERE LOWER(u.username) = LOWER(${wanted})
24 ORDER BY r.created_at ASC
25 `) as Array<{ name: string; is_private: boolean; owner: string }>
26 : (await sql`
27 SELECT r.name, r.is_private, u.username AS owner
28 FROM repositories r JOIN users u ON u.id = r.owner_id
29 ORDER BY u.username, r.created_at ASC LIMIT 50
30 `) as Array<{ name: string; is_private: boolean; owner: string }>;
31
32 if (rows.length === 0) {
33 console.log(wanted ? `No repos for user "${wanted}".` : "No repos in DB.");
34 return;
35 }
36
37 console.log("");
38 console.log("Repos found:");
39 console.log("");
40 for (const r of rows) {
41 console.log(
42 ` ${r.owner}/${r.name} private=${r.is_private} push-url=https://gluecron.com/${r.owner}/${r.name}.git`
43 );
44 }
45 console.log("");
46}
47
48main().catch((err) => {
49 console.error("Failed:", err);
50 process.exit(1);
51});
052