mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-03 20:37:06 +01:00
Every account but the founder's hit "Connect GitHub and the build carries
on" at the repository step of a kickoff: the server's org token was offered
only to accounts entitled to fleet infrastructure, so a person with an idea
and no GitHub account could plan but never build. Most people arriving at
Loki have no GitHub account and no wish to open one.
Now the org token creates and seeds the repository for every signed-in
account, and Loki keeps the code. The new user_projects.code_custody column
('loki' | 'own') is the safety boundary that lets it: a destructive
org-token write (archive on delete, make private on retire, rewire CD) is
allowed only on a row that says 'loki', and only the two paths that made
the repository with that token may write that value. A repository a person
linked by hand is theirs — their own token or nothing — so "Loki keeps your
code" cannot become a credential aimed at the org's other repositories.
scripts/test/github-org-token.ts pins the rule.
The code stays the person's. Once the site is live, a line beside the Live
link (and Project settings, always) offers to move it to their own GitHub:
POST /api/projects/[id]/handover transfers the repository to their login,
flips custody to 'own' and records the new address. Connecting GitHub is
asked for there and only there, because it is where the code goes.
Copy follows: the kickoff, provisioning, onboarding, the empty projects
list, the quickstart and /pricing say "Loki keeps the code for you, free"
instead of "creates a GitHub repository", and a link into the private org
repository is shown only to a viewer whose credential opens it.
Claude-Session: https://claude.ai/code/session_01CG9dupSVqoXCCqKfBCfd9B
Co-authored-by: Claude <noreply@anthropic.com>
23 lines
785 B
TypeScript
23 lines
785 B
TypeScript
/**
|
|
* The address a repository has once GitHub has moved it to the person.
|
|
* Run: npx tsx scripts/test/code-handover.ts
|
|
*/
|
|
import { repoUrlAfterTransfer } from "@/lib/github-provision";
|
|
|
|
if (
|
|
repoUrlAfterTransfer("https://github.com/bitbaum/zeitkastli", "anna") !==
|
|
"https://github.com/anna/zeitkastli"
|
|
) {
|
|
throw new Error("the repository keeps its name and takes the person's login as owner");
|
|
}
|
|
if (
|
|
repoUrlAfterTransfer("https://github.com/bitbaum/zeitkastli.git", "anna") !==
|
|
"https://github.com/anna/zeitkastli"
|
|
) {
|
|
throw new Error("a .git suffix is not part of the name");
|
|
}
|
|
if (repoUrlAfterTransfer("not a url", "anna") !== null) {
|
|
throw new Error("an address that is not a GitHub repository yields nothing, never a guess");
|
|
}
|
|
console.log("✓ code handover");
|