From 43e16e35e692d73b807dd915a31be58cbfcafd80 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 11 Jul 2026 16:23:06 +0100 Subject: [PATCH] Use GameCult upstream names for source corpus --- scripts/git-post-push-index.mjs | 19 +------------------ scripts/source-repo-discovery.ts | 21 +++++++++++++++++---- scripts/source-repo-indexing.ts | 3 ++- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/scripts/git-post-push-index.mjs b/scripts/git-post-push-index.mjs index d5fb8a1..2d331a5 100644 --- a/scripts/git-post-push-index.mjs +++ b/scripts/git-post-push-index.mjs @@ -86,7 +86,7 @@ async function runWorker() { const sourceRepoRoot = process.env.SOURCE_REPO_ROOT ? resolve(process.env.SOURCE_REPO_ROOT) : undefined; - const repoPath = sourceRepoRoot ? join(sourceRepoRoot, args.repoName) : undefined; + const repoPath = undefined; const startedAt = new Date().toISOString(); await writeStatus({ @@ -116,23 +116,6 @@ async function runWorker() { process.exit(1); } - if (!(await pathExists(repoPath))) { - const message = `Configured repo path does not exist: ${repoPath}`; - process.stderr.write(`${message}\n`); - await writeStatus({ - state: "failed", - repoName: args.repoName, - pid: process.pid, - startedAt, - completedAt: new Date().toISOString(), - exitCode: 1, - logPath, - repoPath, - error: message, - }); - process.exit(1); - } - try { const tsxCliPath = join(voidbotRoot, "node_modules", "tsx", "dist", "cli.mjs"); if (!(await pathExists(tsxCliPath))) { diff --git a/scripts/source-repo-discovery.ts b/scripts/source-repo-discovery.ts index 308c84e..8d3d56d 100644 --- a/scripts/source-repo-discovery.ts +++ b/scripts/source-repo-discovery.ts @@ -7,7 +7,10 @@ const execFile = promisify(execFileCallback); const GAMECULT_ORIGIN_PATTERN = /github\.com[:/]GameCult\//i; export interface SourceRepoMatch { + /** Canonical GameCult upstream slug: the source archive identity. */ repoName: string; + /** Local checkout label; diagnostic only, never an archive key. */ + localRepoName: string; repoPath: string; gitDir: string; } @@ -37,6 +40,7 @@ export async function discoverSourceRepos( repoMatches.push({ repoName: entry.name, + localRepoName: entry.name, repoPath, gitDir, }); @@ -81,7 +85,13 @@ function selectCanonicalGameCultRepos( } return [...byOrigin.values()] - .map((entries) => chooseCanonicalRepo(entries)) + .map((entries) => { + const canonical = chooseCanonicalRepo(entries); + return { + ...canonical, + repoName: repoNameFromOrigin(entries[0].originUrl), + }; + }) .sort((left, right) => left.repoName.localeCompare(right.repoName)); } @@ -94,7 +104,7 @@ function chooseCanonicalRepo(entries: Array<{ repo: SourceRepoMatch; originUrl: } function canonicalRank(repo: SourceRepoMatch, remoteName: string): number { - if (repo.repoName.localeCompare(remoteName, undefined, { sensitivity: "accent" }) === 0) { + if (repo.localRepoName.localeCompare(remoteName, undefined, { sensitivity: "accent" }) === 0) { return 0; } @@ -106,7 +116,7 @@ function normalizeOrigin(originUrl: string): string { } function repoNameFromOrigin(originUrl: string): string { - const normalized = normalizeOrigin(originUrl); + const normalized = originUrl.trim().replace(/\\/g, "/").replace(/\.git$/i, ""); return normalized.slice(normalized.lastIndexOf("/") + 1); } @@ -119,7 +129,10 @@ export function selectSourceRepos( } const lookup = new Map( - availableRepos.map((repo) => [repo.repoName.toLowerCase(), repo] as const), + availableRepos.flatMap((repo) => [ + [repo.repoName.toLowerCase(), repo] as const, + [repo.localRepoName.toLowerCase(), repo] as const, + ]), ); const selectedRepos: SourceRepoMatch[] = []; const missingRepoNames: string[] = []; diff --git a/scripts/source-repo-indexing.ts b/scripts/source-repo-indexing.ts index b7504b1..71dbce0 100644 --- a/scripts/source-repo-indexing.ts +++ b/scripts/source-repo-indexing.ts @@ -69,7 +69,8 @@ export async function indexSourceRepos( for (const repo of repos) { const scan = await crawlRepositoryDocuments(repo.repoPath, repo.repoName, { - includePathPrefixes: config.sourceRepoIncludePrefixes[repo.repoName], + includePathPrefixes: config.sourceRepoIncludePrefixes[repo.repoName] + ?? config.sourceRepoIncludePrefixes[repo.localRepoName], }); const result = await pipeline.syncRepoDocuments(repo.repoName, scan.documents, { forceReindex: options.forceReindex,