clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / test / scenarios / repo-front-about.sh
repo-front-about.sh 2.6K
1# A repo's code page opens with its front matter: its name, what it is2# about, its topics (its shelf, then its .forge/topics, linked where the3# home page's topics go when a shelf has that name), and facts read from4# the default branch: the license (an SPDX id when the text says which)5# and its languages by bytes, without vendored, generated or lock files,6# an executable counted by its #! line. Facts with nothing to say are left7# out.8. "$(dirname "$0")/../lib.sh"9user ana10repo ana/chess "a chess engine for the terminal"11clone ana ana/chess "$T/w/c"12mkdir -p "$T/w/c/.forge" "$T/w/c/src" "$T/w/c/vendor" "$T/w/c/bin"13printf 'chess\n# a comment\nBoard Games\n\n' >"$T/w/c/.forge/topics"14printf 'MIT License\n\nCopyright (c) 2026 ana\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction.\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n' >"$T/w/c/LICENSE"15head -c 6000 /dev/zero | tr '\0' 'a' >"$T/w/c/src/engine.ts"16head -c 3000 /dev/zero | tr '\0' 'b' >"$T/w/c/src/board.go"17head -c 1000 /dev/zero | tr '\0' 'c' >"$T/w/c/src/style.css"18head -c 90000 /dev/zero | tr '\0' 'v' >"$T/w/c/vendor/lib.js"19head -c 50000 /dev/zero | tr '\0' 'l' >"$T/w/c/package-lock.json"20{ printf '#!/bin/sh\n'; head -c 2000 /dev/zero | tr '\0' 's'; } >"$T/w/c/bin/chess"21chmod +x "$T/w/c/bin/chess"22at "$T/w/c" commit "first" README.md23push_as ana "$T/w/c" origin main24printf 'games\n' >"$FORGE_ROOT/ana/chess.git/category"25export FORGE_STRICT=126build27p=$FORGE_WWW/ana/chess/index.html28has "$p" '<h1>chess</h1>'29has "$p" '<p class="about">a chess engine for the terminal</p>'30has "$p" '<p class="rf-topics" aria-label="topics"><a href="/ana/#games">games</a><span>chess</span><span>board games</span></p>'31has "$p" '<dt>license</dt><dd><a href="/ana/chess/blob/main/LICENSE/">MIT</a></dd>'32has "$p" '<span class="langs"><span><i class="lc1" aria-hidden="true"></i>TypeScript <b>50%</b></span><span><i class="lc2" aria-hidden="true"></i>Go <b>25%</b></span><span><i class="lc3" aria-hidden="true"></i>Shell <b>16.7%</b></span></span>'33lacks "$p" 'JavaScript|<dt>(site|release|ci|reviews)</dt>'34# A license the page can't name is a link to its file.35printf 'You may do anything with this, except sell it.\n' >"$T/w/c/LICENSE"36at "$T/w/c" commit "own terms" README.md37push_as ana "$T/w/c" origin main38build ana/chess39has "$p" '<dt>license</dt><dd><a href="/ana/chess/blob/main/LICENSE/" class="mono">see LICENSE</a></dd>'