import assert from "node:assert/strict"; import { mergeInterviewIntoDescription } from "@/lib/project-interview"; import { PROJECT_ATTR } from "@/config/project-attrs"; import { answer, cleanDescription, projectHeadline, projectTitle, isPublicTestArtifact, publicHeroNote, summarizeDescription, } from "../../src/lib/project-display"; assert.equal(cleanDescription("Local repository imported from loki-ui"), null); assert.equal( cleanDescription("A weatherproof capsule you leave somewhere."), "A weatherproof capsule you leave somewhere.", ); assert.equal(isPublicTestArtifact("smoke-1783188931860-gh"), true); assert.equal(isPublicTestArtifact("orangecat"), false); const dumpAfterPitch = "Life OS + AI agent fleet command center. MUTUAL DOGFOOD WITH ORANGECAT: KNOWN BUG — v1 entity-create from bearer-token callers hits RLS 42501."; const pitch = publicHeroNote(dumpAfterPitch); assert.ok(pitch); assert.ok(!/known bug|mutual dogfood|42501/i.test(pitch), pitch); const dumpFirst = "KNOWN BUG — v1 entity-create hits RLS 42501 and the ORANGECAT_WEBHOOK_SECRET is unset."; assert.equal(publicHeroNote(dumpFirst), null, "a dump that starts as a dump stays hidden"); const short = "Zeitkastli is a weatherproof capsule you leave somewhere."; assert.equal(publicHeroNote(short), short); const essay = "Prime tower is a project generated by Loki, a command center for AI agent fleets, using Next.js, Tailwind CSS, and TypeScript. Extra sentences should not reach the hero."; const summarized = publicHeroNote(essay); assert.ok(summarized); assert.ok(summarized!.length <= 80, summarized); assert.equal(summarized, summarizeDescription(essay, 72)); // A phone report from 2026-08-18: "Suggested next (profile): Keep // projects/.md accu…" — an enrichment template's own placeholder, // leaked verbatim as if it were a real next step. assert.equal( answer("Keep projects/.md accurate and current."), null, "an unsubstituted placeholder is not a real answer", ); assert.equal( answer("Wire up the CI badge"), null, "any bare placeholder, not just ", ); assert.equal( answer("Ship the parser rewrite for datacat."), "Ship the parser rewrite for datacat.", "real prose with no placeholder passes through unchanged", ); assert.equal( answer("Support generics like List in the parser"), "Support generics like List in the parser", "a real generic-type mention is not mistaken for a placeholder (no bare )", ); // A header shows what the project IS, not the owner's interview transcript. // Skif, 2026-09-25: "…freedom. From the owner: Who is this for, and who pays…" const withBrief = mergeInterviewIntoDescription( "Holistic safety for people and the places they live.", { [PROJECT_ATTR.CUSTOMERS]: "People in Zürich who want a calm person with them" }, ); assert.match(withBrief, /From the owner:/, "fixture: the brief really is appended"); assert.equal( projectHeadline(withBrief), "Holistic safety for people and the places they live.", "the headline stops before the owner's answers", ); assert.equal( projectHeadline("Just a line."), "Just a line.", "no brief: the description is the headline", ); assert.match( projectHeadline(mergeInterviewIntoDescription("", { [PROJECT_ATTR.CUSTOMERS]: "Cafés" })) ?? "", /Cafés/, "only a brief: show it rather than nothing", ); assert.equal( projectHeadline("Local repository imported from loki-ui"), null, "placeholders stay hidden", ); console.log("✓ project-display tests passed"); // A run's own lane reads as its project, never as "substrata~39554470" // (owner audit, 2026-11-12). { assert.equal(projectTitle({ name: "substrata~39554470" }), "Substrata"); assert.equal(projectTitle({ name: "substrata" }), "Substrata"); }