mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 19:08:13 +01:00
A project's name is its key (activity, cron jobs and dispatch match on it),
so renaming it hid history. entities.title is now what a person calls it:
the pencil next to the title edits it, and every place a person reads the
name (header, list, invite page and email, shared projects, /my-feedback)
shows projectTitle(). Legacy "<host>-refresh-<request id>" names read as the
site ("Xhiva") until someone names them, and the "Develop a new version of
this existing website: URL" brief reads as "A new version of xhiva.art."
For the person a client site is made for:
- the invite defaults to Client on client work;
- inviting an existing account emails them the link instead of nothing;
- sign-in finds a free handle so onboarding never asks a project invitee
to set up repositories;
- a client or viewer sees one page: the box to ask in (typed or spoken),
where their asks are, and whether something is being built. The
builder's Story/Plan/Activity tabs stay on the builder's page;
- "See where it is" goes to /my-feedback, which names the project;
- Home no longer shows "No builder connected" to someone who only has
shared projects.
Migration 0120 adds entities.title (nullable, no backfill).
Claude-Session: https://claude.ai/code/session_01HyfPCAeTFi2sjpVY44Y1JJ
Co-authored-by: Claude <noreply@anthropic.com>
48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
/**
|
|
* What a person reads as a project's name and one-line summary
|
|
* (lib/project-display): the title when set; the site, not the
|
|
* `<host>-refresh-<32 hex>` key the retired flow minted; and a website brief
|
|
* said as a sentence, not as instructions to an agent. Also the handle a new
|
|
* account is given when the plain one is taken (lib/onboarding-heal).
|
|
*
|
|
* Run: npx tsx scripts/test/project-title.ts
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import { projectHeadline, projectTitle, summarizeDescription } from "@/lib/project-display";
|
|
import { usernameCandidates } from "@/lib/onboarding-heal-decision";
|
|
|
|
const brief =
|
|
"Develop a new version of this existing website: https://www.xhiva.art/\nRequested changes (the customer's exact words):\nHi, I would like you to…";
|
|
const legacy = "xhiva-art-refresh-300d1519783b47d3ab1c7ddb77c5febf";
|
|
|
|
assert.equal(
|
|
projectTitle({ name: legacy, description: brief }),
|
|
"Xhiva",
|
|
"legacy key reads as the site",
|
|
);
|
|
assert.equal(projectTitle({ name: legacy }), "Xhiva", "…even without a description");
|
|
assert.equal(projectTitle({ name: legacy, title: "Xhiva Art" }), "Xhiva Art", "a title wins");
|
|
assert.equal(
|
|
projectTitle({ name: "centersom", title: " " }),
|
|
"centersom",
|
|
"blank title is no title",
|
|
);
|
|
assert.equal(projectTitle({ name: "loki" }), "loki", "ordinary names pass through");
|
|
|
|
assert.equal(projectHeadline(brief), "A new version of xhiva.art.");
|
|
assert.equal(summarizeDescription(brief, 145), "A new version of xhiva.art.");
|
|
assert.equal(
|
|
summarizeDescription("Create a new, independent website inspired by: https://foo.ch/ more", 145),
|
|
"A new website, inspired by foo.ch.",
|
|
);
|
|
assert.equal(
|
|
projectHeadline("A bakery in Zürich."),
|
|
"A bakery in Zürich.",
|
|
"real descriptions untouched",
|
|
);
|
|
|
|
assert.deepEqual(usernameCandidates("ximena").slice(0, 3), ["ximena", "ximena2", "ximena3"]);
|
|
assert.ok(usernameCandidates("ximena").every((u) => /^[a-z0-9-]+$/.test(u)));
|
|
|
|
console.log("project-title: all checks passed");
|