# Generates a simple web view of open TODOs in the depot. # # Only TODOs that match the form 'TODO($username)' are considered, and # only for users that are known to us. { depot, lib, pkgs, ... }: let inherit (pkgs) jq ripgrep runCommand writeTextFile ; inherit (builtins) elem filter fromJSON head readFile map ; inherit (lib) concatStringsSep; inherit (depot.nix.yants) defun int string struct ; knownUsers = map (u: u.username) depot.ops.users; todo = struct { file = string; line = int; todo = string; user = string; }; allTodos = fromJSON (readFile (runCommand "depot-todos.json" { } '' ${ripgrep}/bin/rg --json 'TODO\(\w+\):.*$' ${depot.path} | \ ${jq}/bin/jq -s -f ${./extract-todos.jq} > $out '')); knownUserTodos = filter (todos: elem (head todos).user knownUsers) allTodos; fileLink = defun [ todo string ] (t: '' //${t.file}:${toString t.line}''); todoElement = defun [ todo string ] (t: ''

${fileLink t}:

${t.todo}
''); userParagraph = todos: let user = (head todos).user; in ''

${user}

${concatStringsSep "\n" (map todoElement todos)}


''; staticUrl = "https://static.tvl.fyi/${depot.web.static.drvHash}"; in writeTextFile { name = "tvl-todos"; destination = "/index.html"; text = '' TVL's todo-list

The Virus Lounge's todo-list


${concatStringsSep "\n" (map userParagraph knownUserTodos)}
''; }