johnandersen777.bsky.social/knotless
git that lives in your Atmosphere account
Forked from chadtmiller.com/knotless
0
0
<script lang="ts">
import type { CommitAuthorView, CommitView } from '#lib/lexicons/dev/knotless/defs.ts';
import { urlPath } from '#lib/format.ts';
import Avatar from '#lib/atoms/Avatar.svelte';
import claude from '#lib/assets/claude.png';
/**
* Who wrote a commit, and who its trailers say helped: each by account,
* linked to its profile, when that is one of the repository's own
* people; else by the name git gives.
*/
let { commit: c }: { commit: CommitView } = $props();
const all = $derived([c.author, ...c.coauthors]);
/** Last first: the stack draws them right to left, so the author's lies on top. */
const stacked = $derived([...all].reverse());
/** A coding agent's own face, whoever claims its address; else its account's. */
const faces: Record<string, string> = { claude };
const face = (a: CommitAuthorView) => (a.agent && faces[a.agent]) || a.actor?.avatar;
const joint = (i: number) => (i === 0 ? '' : i === all.length - 1 ? ' and ' : ', ');
</script>
{#snippet who(a: CommitAuthorView)}{#if a.actor}<a href="/{urlPath(a.actor.handle)}"
><b>{a.name}</b></a
>{:else}<b>{a.name}</b>{/if}{/snippet}
{#if c.coauthors.length}<span class="avs"
>{#each stacked as a, i (i)}<Avatar
name={a.name}
did={a.actor?.did}
src={face(a)}
/>{/each}</span
><span
>{#each all as a, i (i)}{joint(i)}{@render who(a)}{/each}</span
>{:else}<Avatar
name={c.author.name}
did={c.author.actor?.did}
src={face(c.author)}
/>{@render who(c.author)}{/if}