diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d6e75f33c..d992a5fb04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,8 @@ checkpoint, and status-only commits are intentionally omitted. `docs.openclaw.ai` links where appropriate. - Clarified `incoherent` close-reason wording so rendered reports no longer collide with `not_actionable_in_repo` (#29). Thanks @xthunder0. +- Normalized repository profile lookup against configured target repos so + mixed-case profile entries resolve correctly (#27). Thanks @xthunder0. - Made apply runs issue-only by default, with no age floor, while still excluding maintainer-authored items. - Made apply runs checkpoint their progress, publish dashboard heartbeats, and diff --git a/src/repository-profiles.ts b/src/repository-profiles.ts index f0a7183c9f..24fa154ebc 100644 --- a/src/repository-profiles.ts +++ b/src/repository-profiles.ts @@ -76,7 +76,9 @@ export const REPOSITORY_PROFILES: readonly RepositoryProfile[] = [ export function repositoryProfileFor(targetRepo: string): RepositoryProfile { const normalized = normalizeRepo(targetRepo); - const profile = REPOSITORY_PROFILES.find((candidate) => candidate.targetRepo === normalized); + const profile = REPOSITORY_PROFILES.find( + (candidate) => normalizeRepo(candidate.targetRepo) === normalized, + ); if (!profile) { throw new Error( `Unsupported target repo: ${targetRepo}. Known repos: ${REPOSITORY_PROFILES.map((candidate) => candidate.targetRepo).join(", ")}`, diff --git a/test/repository-profiles.test.ts b/test/repository-profiles.test.ts new file mode 100644 index 0000000000..dd9e059450 --- /dev/null +++ b/test/repository-profiles.test.ts @@ -0,0 +1,27 @@ +import assert from "node:assert/strict"; +import test from "node:test"; + +import { REPOSITORY_PROFILES, repositoryProfileFor } from "../dist/repository-profiles.js"; + +test("repositoryProfileFor matches mixed-case input against canonical profiles", () => { + const profile = repositoryProfileFor("OpenClaw/ClawHub"); + + assert.equal(profile.targetRepo, "openclaw/clawhub"); + assert.equal(profile.slug, "openclaw-clawhub"); +}); + +test("profile lookup normalizes candidate target repos as well as input", () => { + const mixedCaseProfile = { + ...REPOSITORY_PROFILES[0], + targetRepo: "Example-Org/Mixed-Case-Repo", + slug: "example-org-mixed-case-repo", + }; + REPOSITORY_PROFILES.push(mixedCaseProfile); + + try { + assert.equal(repositoryProfileFor("example-org/mixed-case-repo"), mixedCaseProfile); + assert.equal(repositoryProfileFor("EXAMPLE-ORG/MIXED-CASE-REPO"), mixedCaseProfile); + } finally { + REPOSITORY_PROFILES.pop(); + } +});