fix(projects): a project with no title reads as a word, not its folder name

projectTitle passed an untitled project's folder name straight through, so
Home, Feedback and the bell listed "murphys-bar" and "aoz-housing". An
all-lowercase slug now reads as a word ("Murphys bar"); a name typed with
capitals is kept as typed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
This commit is contained in:
Claude committed 2026-10-22 07:34:13 +00:00
1 parent c32ce94a2e
commit 3bc9a395e7
2 files changed
+19 -3

No files matched your search

+5 -2
View File
@@ -24,10 +24,13 @@ assert.equal(projectTitle({ name: legacy }), "Xhiva", "…even without a descrip
assert.equal(projectTitle({ name: legacy, title: "Xhiva Art" }), "Xhiva Art", "a title wins");
assert.equal(
projectTitle({ name: "centersom", title: " " }),
"centersom",
"Centersom",
"blank title is no title",
);
assert.equal(projectTitle({ name: "loki" }), "loki", "ordinary names pass through");
assert.equal(projectTitle({ name: "loki" }), "Loki", "a folder name reads as a word");
assert.equal(projectTitle({ name: "murphys-bar" }), "Murphys bar", "dashes become spaces");
assert.equal(projectTitle({ name: "orangecat-2" }), "Orangecat 2");
assert.equal(projectTitle({ name: "BiasLens" }), "BiasLens", "a name typed with capitals is kept");
assert.equal(projectHeadline(brief), "A new version of xhiva.art.");
assert.equal(summarizeDescription(brief, 145), "A new version of xhiva.art.");
+14 -1
View File
@@ -22,12 +22,25 @@ export function projectTitle(project: {
const own = project.title?.trim();
if (own) return own;
const legacy = /^(.+)-refresh-[0-9a-f]{32}$/.exec(project.name);
if (!legacy) return project.name;
if (!legacy) return readableName(project.name);
const host = /https?:\/\/(?:www\.)?([a-z0-9-]+)\./i.exec(project.description ?? "")?.[1];
const word = host ?? legacy[1].split("-")[0]!;
return word.charAt(0).toUpperCase() + word.slice(1);
}
/**
* A folder name, said as a word: "murphys-bar" → "Murphys bar", "loki" →
* "Loki". Only an all-lowercase slug is rewritten — a name someone typed with
* capitals ("BiasLens") is already how they say it. The owner read Home as a
* list of folder names (2026-10-21); a project with no title was shown by its
* folder everywhere this helper is used.
*/
function readableName(name: string): string {
if (!/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/.test(name)) return name;
const words = name.replace(/[-_]+/g, " ");
return words.charAt(0).toUpperCase() + words.slice(1);
}
/**
* A website brief, said as a person would. A project started from /change
* stores the agent's whole brief as its description, so its heading opened