import assert from "node:assert/strict"; import { answer, cleanDescription, 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 )", ); console.log("✓ project-display tests passed");