xonecas.io
8356
Wx

www-xonecas-io / commit 5ff0fd5

project metadata and tags from git and the hosts, with overrides; the data file drives the build (1005)

Co-Authored-By: Claude Opus 5.5

Sean Caetano Martin2026-11-08 5ff0fd5a7d823cfa3fb18584e3f389e17ca2af39 parent 08b22ce

15 files changed

Makefile+1−1
@@ -15,7 +15,7 @@ index:
1515 go run ./cmd/site index -sources sources.txt -store $(REPOS)
1616
1717 build: bin/tailwindcss
18- go run ./cmd/site build -repos $(REPOS) -out public
18+ go run ./cmd/site build -data data/projects.json -out public
1919
2020 serve: build
2121 go run ./cmd/site serve -dir public
cmd/site/main.go+48−15
@@ -1,8 +1,8 @@
11 // Command site builds xonecas.io from bare git repos and serves it locally.
22 //
3-// site import [-sources sources.txt] [-store repos] [-jobs 8]
4-// site index [-sources sources.txt] [-store repos] [-overrides overrides.txt] [-out data/projects.json]
5-// site build [-repos repos] [-out public] [-tailwind bin/tailwindcss]
3+// site import [-sources sources.txt] [-store repos] [-jobs 8] [-meta data/meta.json]
4+// site index [-sources sources.txt] [-store repos] [-overrides overrides.txt] [-meta data/meta.json] [-out data/projects.json]
5+// site build [-data data/projects.json] [-out public] [-tailwind bin/tailwindcss]
66 // site serve [-dir public] [-addr 127.0.0.1:8080]
77 package main
88
@@ -17,7 +17,6 @@ import (
1717 "sync"
1818
1919 "xonecas.io/site/internal/project"
20- "xonecas.io/site/internal/repo"
2120 "xonecas.io/site/internal/site"
2221 "xonecas.io/site/internal/store"
2322 )
@@ -33,6 +32,7 @@ func main() {
3332 sources := fs.String("sources", "sources.txt", "clone URLs, one per line")
3433 root := fs.String("store", "repos", "folder for the bare mirrors")
3534 jobs := fs.Int("jobs", 8, "remotes to sync at once")
35+ meta := fs.String("meta", "data/meta.json", "where to save the hosts' metadata")
3636 fs.Parse(os.Args[2:])
3737 urls, err := store.Sources(*sources)
3838 if err != nil {
@@ -41,28 +41,40 @@ func main() {
4141 if failed := mirrorAll(*root, urls, *jobs); failed > 0 {
4242 log.Fatalf("%d of %d remotes failed", failed, len(urls))
4343 }
44+ metas, err := store.FetchMeta(urls)
45+ if err != nil {
46+ log.Fatal(err)
47+ }
48+ if err := writeJSON(*meta, metas); err != nil {
49+ log.Fatal(err)
50+ }
4451 case "index":
4552 sources := fs.String("sources", "sources.txt", "clone URLs, one per line")
4653 root := fs.String("store", "repos", "folder of the bare mirrors")
4754 overrides := fs.String("overrides", "overrides.txt", "rules for what the heuristics get wrong")
55+ meta := fs.String("meta", "data/meta.json", "the hosts' metadata, from import")
4856 out := fs.String("out", "data/projects.json", "the data file")
4957 fs.Parse(os.Args[2:])
50- if err := index(*sources, *root, *overrides, *out); err != nil {
58+ if err := index(*sources, *root, *overrides, *meta, *out); err != nil {
5159 log.Fatal(err)
5260 }
5361 case "build":
54- repos := fs.String("repos", "repos", "folder of bare *.git repos")
62+ data := fs.String("data", "data/projects.json", "the data file, from site index")
5563 out := fs.String("out", "public", "output folder")
5664 tailwind := fs.String("tailwind", "bin/tailwindcss", "tailwind binary, empty to skip CSS")
5765 fs.Parse(os.Args[2:])
58- list, err := repo.List(*repos)
66+ var projects []project.Project
67+ b, err := os.ReadFile(*data)
68+ if err == nil {
69+ err = json.Unmarshal(b, &projects)
70+ }
5971 if err != nil {
6072 log.Fatal(err)
6173 }
62- if err := site.Build(list, *out, *tailwind); err != nil {
74+ if err := site.Build(projects, *out, *tailwind); err != nil {
6375 log.Fatal(err)
6476 }
65- log.Printf("built %d repos into %s", len(list), *out)
77+ log.Printf("built %s into %s", *data, *out)
6678 case "serve":
6779 dir := fs.String("dir", "public", "folder to serve")
6880 addr := fs.String("addr", "127.0.0.1:8080", "listen address")
@@ -106,8 +118,8 @@ func mirrorAll(root string, urls []string, jobs int) (failed int) {
106118 return failed
107119 }
108120
109-// index groups the mirrored remotes into projects and writes them to out.
110-func index(sources, root, overrides, out string) error {
121+// index groups the mirrored remotes into projects, describes each one, and writes them to out.
122+func index(sources, root, overrides, meta, out string) error {
111123 urls, err := store.Sources(sources)
112124 if err != nil {
113125 return err
@@ -116,6 +128,14 @@ func index(sources, root, overrides, out string) error {
116128 if err != nil {
117129 return err
118130 }
131+ var metas map[string]store.Meta
132+ b, err := os.ReadFile(meta)
133+ if err != nil {
134+ return fmt.Errorf("%w: run site import first", err)
135+ }
136+ if err := json.Unmarshal(b, &metas); err != nil {
137+ return err
138+ }
119139 srcs := make([]project.Source, len(urls))
120140 for i, url := range urls {
121141 if srcs[i], err = project.ReadSource(url, store.Dir(root, url)); err != nil {
@@ -126,13 +146,26 @@ func index(sources, root, overrides, out string) error {
126146 if err != nil {
127147 return err
128148 }
129- b, err := json.MarshalIndent(projects, "", " ")
149+ shown := 0
150+ for i := range projects {
151+ if err := project.Describe(&projects[i], metas, o); err != nil {
152+ return fmt.Errorf("%s: %w", projects[i].Name, err)
153+ }
154+ if projects[i].Hidden == "" {
155+ shown++
156+ }
157+ }
158+ log.Printf("%d remotes, %d projects, %d shown, written to %s", len(urls), len(projects), shown, out)
159+ return writeJSON(out, projects)
160+}
161+
162+func writeJSON(path string, v any) error {
163+ b, err := json.MarshalIndent(v, "", " ")
130164 if err != nil {
131165 return err
132166 }
133- if err := os.MkdirAll(filepath.Dir(out), 0o755); err != nil {
167+ if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
134168 return err
135169 }
136- log.Printf("%d remotes, %d projects, written to %s", len(urls), len(projects), out)
137- return os.WriteFile(out, append(b, '\n'), 0o644)
170+ return os.WriteFile(path, append(b, '\n'), 0o644)
138171 }
internal/project/describe.go+102−0
@@ -0,0 +1,102 @@
1+package project
2+
3+import (
4+ "regexp"
5+ "strings"
6+
7+ "xonecas.io/site/internal/repo"
8+ "xonecas.io/site/internal/store"
9+)
10+
11+// PostAI is the day the earliest AI instruction file appeared (the-champs-timer's AGENTS.md).
12+// A project whose first commit is on or after it is post-AI.
13+const PostAI = "2025-09-05"
14+
15+// Big is how many of my commits make a project big.
16+const Big = 50
17+
18+// Info is everything the pages show about a project, computed from git and the hosts.
19+type Info struct {
20+ Description string `json:"description"`
21+ First string `json:"first"`
22+ Last string `json:"last"`
23+ Commits int `json:"commits"` // mine
24+ Total int `json:"total"` // everyone's
25+ Months map[string]int `json:"months"` // my commits per YYYY-MM
26+ Stars int `json:"stars"`
27+ Files int `json:"files"`
28+ Languages []Language `json:"languages"`
29+ Readme string `json:"readme"`
30+ Tags []string `json:"tags"`
31+ Hidden string `json:"hidden,omitempty"` // why it is not listed: fork, empty or override
32+}
33+
34+// Describe computes p's Info from its sources, the hosts' metadata and the overrides.
35+func Describe(p *Project, metas map[string]store.Meta, o Overrides) error {
36+ h, err := ReadHistory(p.Sources)
37+ if err != nil {
38+ return err
39+ }
40+ f, err := ReadFiles(p.Sources[0])
41+ if err != nil {
42+ return err
43+ }
44+ in := &p.Info
45+ *in = Info{First: h.First, Last: h.Last, Commits: h.Mine, Total: h.Total, Months: h.Months, Files: f.Count, Languages: f.Languages, Readme: f.Readme}
46+ fork := false
47+ for i, s := range p.Sources {
48+ m := metas[s.URL]
49+ p.Sources[i].Stars = m.Stars
50+ in.Stars += m.Stars
51+ fork = fork || m.Fork
52+ if in.Description == "" {
53+ in.Description = m.Description
54+ }
55+ }
56+ if in.Description == "" && f.Readme != "" {
57+ in.Description = summary(p.Sources[0].Dir, f.Readme)
58+ }
59+
60+ in.Tags = []string{"pre-AI", "small"}
61+ if h.AI || h.First >= PostAI {
62+ in.Tags[0] = "post-AI"
63+ }
64+ if h.Mine >= Big {
65+ in.Tags[1] = "big"
66+ }
67+ if f.Front {
68+ in.Tags = append(in.Tags, "frontend")
69+ }
70+ if f.Back {
71+ in.Tags = append(in.Tags, "backend")
72+ }
73+ in.Tags = o.retag(p.Name, in.Tags)
74+
75+ switch {
76+ case o.Show[p.Name]:
77+ case o.Hide[p.Name]:
78+ in.Hidden = "override"
79+ case fork:
80+ in.Hidden = "fork"
81+ case h.Mine == 0:
82+ in.Hidden = "empty"
83+ }
84+ return nil
85+}
86+
87+var mdLink = regexp.MustCompile(`\[([^\]]*)\]\([^)]*\)`)
88+
89+// summary is the README's first line of prose, for projects with no description.
90+func summary(dir, readme string) string {
91+ text, err := repo.Git(dir, "show", "HEAD:"+readme)
92+ if err != nil {
93+ return ""
94+ }
95+ for _, line := range strings.Split(text, "\n") {
96+ line = strings.TrimSpace(line)
97+ if line != "" && !strings.ContainsAny(line[:1], "#[!<=-|`>*") {
98+ return mdLink.ReplaceAllString(line, "$1")
99+ }
100+ }
101+ return ""
102+}
internal/project/files.go+79−0
@@ -0,0 +1,79 @@
1+package project
2+
3+import (
4+ "path"
5+ "regexp"
6+ "sort"
7+ "strconv"
8+ "strings"
9+
10+ "xonecas.io/site/internal/repo"
11+)
12+
13+var languages = map[string]string{
14+ ".js": "JavaScript", ".mjs": "JavaScript", ".cjs": "JavaScript", ".jsx": "JavaScript", ".ts": "TypeScript", ".tsx": "TypeScript",
15+ ".go": "Go", ".py": "Python", ".rb": "Ruby", ".java": "Java", ".c": "C", ".h": "C", ".cpp": "C++", ".cc": "C++", ".hpp": "C++",
16+ ".rs": "Rust", ".zig": "Zig", ".lua": "Lua", ".vim": "Vim script", ".sh": "Shell", ".bash": "Shell", ".zsh": "Shell",
17+ ".html": "HTML", ".htm": "HTML", ".css": "CSS", ".scss": "SCSS", ".less": "Less", ".coffee": "CoffeeScript", ".php": "PHP",
18+ ".swift": "Swift", ".kt": "Kotlin", ".cs": "C#", ".ex": "Elixir", ".svelte": "Svelte", ".vue": "Vue", ".elm": "Elm",
19+}
20+
21+var (
22+ vendored = regexp.MustCompile(`(^|/)(node_modules|vendor|dist|build|third_party|bower_components)/|\.min\.(js|css)$`)
23+ readme = regexp.MustCompile(`(?i)^readme(\.[a-z]+)?$`)
24+ front = regexp.MustCompile(`\.(html?|css|scss|sass|less|jsx|tsx|vue|svelte|elm)$`)
25+ back = regexp.MustCompile(`(?i)(^|/)(dockerfile|docker-compose\.ya?ml|compose\.ya?ml|procfile|manage\.py|wsgi\.py|server\.(js|ts|go|py)|app\.py|.*\.sql|go\.mod|cargo\.toml)$`)
26+)
27+
28+// Files is what the default branch's tree says about a project.
29+type Files struct {
30+ Count int
31+ Readme string // root README path, "" if none
32+ Languages []Language // by bytes, largest first, 5% and up
33+ Front bool // has browser files
34+ Back bool // has server files
35+}
36+
37+// Language is one language's share of a project's code.
38+type Language struct {
39+ Name string `json:"name"`
40+ Percent int `json:"percent"`
41+}
42+
43+// ReadFiles lists the tree of the source's default branch. An empty repo has no files.
44+func ReadFiles(s Source) (Files, error) {
45+ var f Files
46+ if s.Commits == 0 {
47+ return f, nil
48+ }
49+ out, err := repo.Git(s.Dir, "ls-tree", "-r", "-l", "HEAD")
50+ if err != nil || out == "" {
51+ return f, err
52+ }
53+ bytes, total := map[string]int{}, 0
54+ for _, line := range strings.Split(out, "\n") {
55+ meta, name, _ := strings.Cut(line, "\t")
56+ f.Count++
57+ if !strings.Contains(name, "/") && readme.MatchString(name) && f.Readme == "" {
58+ f.Readme = name
59+ }
60+ if vendored.MatchString(name) {
61+ continue
62+ }
63+ f.Front = f.Front || front.MatchString(name)
64+ f.Back = f.Back || back.MatchString(name)
65+ if lang, ok := languages[strings.ToLower(path.Ext(name))]; ok {
66+ fields := strings.Fields(meta)
67+ n, _ := strconv.Atoi(fields[len(fields)-1])
68+ bytes[lang] += n
69+ total += n
70+ }
71+ }
72+ for name, n := range bytes {
73+ if p := n * 100 / total; p >= 5 {
74+ f.Languages = append(f.Languages, Language{name, p})
75+ }
76+ }
77+ sort.Slice(f.Languages, func(a, b int) bool { return f.Languages[a].Percent > f.Languages[b].Percent })
78+ return f, nil
79+}
internal/project/history.go+70−0
@@ -0,0 +1,70 @@
1+package project
2+
3+import (
4+ "regexp"
5+ "sort"
6+ "strings"
7+
8+ "xonecas.io/site/internal/repo"
9+)
10+
11+// Me is every author name xonecas has committed under, lower case. Other people named Sean are not in it.
12+var Me = map[string]bool{"xonecas": true, "sacenox": true, "sean": true, "sean martin": true, "sean caetano martin": true}
13+
14+// AIFiles are instruction files coding agents read. Any of them in the history makes a project post-AI.
15+var AIFiles = map[string]bool{"AGENTS.md": true, "CLAUDE.md": true, "GEMINI.md": true, ".cursorrules": true, ".windsurfrules": true, ".clinerules": true, "copilot-instructions.md": true, ".aider.conf.yml": true}
16+
17+var aiTrailer = regexp.MustCompile(`(?im)^\s*(co-authored-by:.*\b(claude|copilot|aider|codex|gemini|cursor)\b|.*generated with \[?claude)`)
18+
19+// History is what one project's commits say, across all its sources.
20+type History struct {
21+ Total, Mine int
22+ First, Last string // dates of my first and last commit, YYYY-MM-DD
23+ Months map[string]int // my commits per YYYY-MM
24+ AI bool // an AI instruction file or AI trailer anywhere in the history
25+}
26+
27+// ReadHistory reads every commit of every source once, counting each hash once.
28+func ReadHistory(sources []Source) (History, error) {
29+ h := History{Months: map[string]int{}}
30+ seen := map[string]bool{}
31+ var dates []string
32+ for _, s := range sources {
33+ if s.Commits == 0 {
34+ continue
35+ }
36+ out, err := repo.Git(s.Dir, "log", "--all", "--name-only", "--format=%x00%H%x09%an%x09%as%n%B")
37+ if err != nil {
38+ return h, err
39+ }
40+ for _, rec := range strings.Split(out, "\x00")[1:] {
41+ head, rest, _ := strings.Cut(rec, "\n")
42+ f := strings.SplitN(head, "\t", 3)
43+ if len(f) < 3 || seen[f[0]] {
44+ continue
45+ }
46+ seen[f[0]] = true
47+ h.Total++
48+ h.AI = h.AI || aiTrailer.MatchString(rest) || hasAIFile(rest)
49+ if Me[strings.ToLower(f[1])] {
50+ h.Mine++
51+ h.Months[f[2][:7]]++
52+ dates = append(dates, f[2])
53+ }
54+ }
55+ }
56+ if len(dates) > 0 {
57+ sort.Strings(dates)
58+ h.First, h.Last = dates[0], dates[len(dates)-1]
59+ }
60+ return h, nil
61+}
62+
63+func hasAIFile(text string) bool {
64+ for _, line := range strings.Split(text, "\n") {
65+ if i := strings.LastIndexByte(line, '/'); AIFiles[line[i+1:]] {
66+ return true
67+ }
68+ }
69+ return false
70+}
internal/project/overrides.go+41−3
@@ -6,6 +6,7 @@ import (
66 "fmt"
77 "io/fs"
88 "os"
9+ "slices"
910 "strings"
1011 )
1112
@@ -13,14 +14,35 @@ import (
1314 //
1415 // merge <remote URL> <remote URL> make two remotes one project
1516 // rename <name> <new name> rename a project
17+// hide <name> / show <name> hide a project, or list a fork or empty one
18+// tag <name> +frontend -backend add or drop tags; +post-AI also drops pre-AI, and so on
1619 type Overrides struct {
17- Merge [][2]string
18- Rename map[string]string
20+ Merge [][2]string
21+ Rename map[string]string
22+ Hide, Show map[string]bool
23+ Tag map[string][]string
24+}
25+
26+// opposite pairs the tags a project has exactly one of.
27+var opposite = map[string]string{"pre-AI": "post-AI", "post-AI": "pre-AI", "small": "big", "big": "small"}
28+
29+var known = map[string]bool{"pre-AI": true, "post-AI": true, "small": true, "big": true, "frontend": true, "backend": true}
30+
31+// retag applies the tag rules for name to tags.
32+func (o Overrides) retag(name string, tags []string) []string {
33+ for _, op := range o.Tag[name] {
34+ tag := op[1:]
35+ tags = slices.DeleteFunc(tags, func(t string) bool { return t == tag || t == opposite[tag] })
36+ if op[0] == '+' {
37+ tags = append(tags, tag)
38+ }
39+ }
40+ return tags
1941 }
2042
2143 // ReadOverrides parses path. A missing file means no overrides.
2244 func ReadOverrides(path string) (Overrides, error) {
23- o := Overrides{Rename: map[string]string{}}
45+ o := Overrides{Rename: map[string]string{}, Hide: map[string]bool{}, Show: map[string]bool{}, Tag: map[string][]string{}}
2446 f, err := os.Open(path)
2547 if errors.Is(err, fs.ErrNotExist) {
2648 return o, nil
@@ -38,9 +60,25 @@ func ReadOverrides(path string) (Overrides, error) {
3860 o.Merge = append(o.Merge, [2]string{f[1], f[2]})
3961 case f[0] == "rename" && len(f) == 3:
4062 o.Rename[f[1]] = f[2]
63+ case f[0] == "hide" && len(f) == 2:
64+ o.Hide[f[1]] = true
65+ case f[0] == "show" && len(f) == 2:
66+ o.Show[f[1]] = true
67+ case f[0] == "tag" && len(f) >= 3 && validTags(f[2:]):
68+ o.Tag[f[1]] = append(o.Tag[f[1]], f[2:]...)
4169 default:
4270 return o, fmt.Errorf("%s:%d: unknown rule %q", path, n, line)
4371 }
4472 }
4573 return o, sc.Err()
4674 }
75+
76+// validTags accepts +tag and -tag for known tags, except dropping a tag that must have an opposite.
77+func validTags(ops []string) bool {
78+ for _, op := range ops {
79+ if len(op) < 2 || !known[op[1:]] || (op[0] != '+' && op[0] != '-') || (op[0] == '-' && opposite[op[1:]] != "") {
80+ return false
81+ }
82+ }
83+ return true
84+}
internal/project/project.go+2−0
@@ -18,6 +18,7 @@ type Source struct {
1818 Branch string `json:"branch"`
1919 Commits int `json:"commits"`
2020 First string `json:"first"` // date of the oldest commit, YYYY-MM-DD
21+ Stars int `json:"stars"`
2122 Roots []string `json:"-"`
2223 }
2324
@@ -25,6 +26,7 @@ type Source struct {
2526 type Project struct {
2627 Name string `json:"name"`
2728 Sources []Source `json:"sources"`
29+ Info // filled by Describe
2830 }
2931
3032 // ReadSource reads what grouping needs from the mirror of url in dir.
internal/project/project_test.go+11−0
@@ -61,3 +61,14 @@ func TestReadOverrides(t *testing.T) {
6161 t.Errorf("missing file: %v", err)
6262 }
6363 }
64+
65+func TestRetag(t *testing.T) {
66+ o := Overrides{Tag: map[string][]string{"p": {"+post-AI", "+big", "-backend", "+frontend"}}}
67+ got := o.retag("p", []string{"pre-AI", "small", "backend"})
68+ if want := []string{"post-AI", "big", "frontend"}; !reflect.DeepEqual(got, want) {
69+ t.Fatalf("retag = %v, want %v", got, want)
70+ }
71+ if validTags([]string{"-pre-AI"}) || validTags([]string{"+huge"}) || !validTags([]string{"-frontend", "+small"}) {
72+ t.Error("validTags accepts the wrong rules")
73+ }
74+}
internal/repo/repo.go+1−56
@@ -1,66 +1,11 @@
1-// Package repo reads bare git repositories by shelling out to git.
1+// Package repo runs git against bare repositories.
22 package repo
33
44 import (
5- "io/fs"
65 "os/exec"
7- "path/filepath"
8- "sort"
9- "strconv"
106 "strings"
11- "time"
127 )
138
14-// Repo is one bare git repository on disk.
15-type Repo struct {
16- Name string
17- Path string
18- Commits int
19- Last time.Time
20- Subject string
21-}
22-
23-// List opens every *.git directory under dir, at any depth, most recently changed first.
24-func List(dir string) ([]Repo, error) {
25- var repos []Repo
26- err := filepath.WalkDir(dir, func(p string, d fs.DirEntry, err error) error {
27- if err != nil || !d.IsDir() || !strings.HasSuffix(p, ".git") {
28- return err
29- }
30- r, err := Open(p)
31- repos = append(repos, r)
32- if err == nil {
33- err = filepath.SkipDir
34- }
35- return err
36- })
37- if err != nil {
38- return nil, err
39- }
40- sort.Slice(repos, func(i, j int) bool { return repos[i].Last.After(repos[j].Last) })
41- return repos, nil
42-}
43-
44-// Open reads one bare repository. An empty repository has no commits and a zero Last.
45-func Open(path string) (Repo, error) {
46- r := Repo{Name: strings.TrimSuffix(filepath.Base(path), ".git"), Path: path}
47- count, err := Git(path, "rev-list", "--count", "--all")
48- if err != nil {
49- return r, err
50- }
51- if r.Commits, err = strconv.Atoi(count); err != nil || r.Commits == 0 {
52- return r, err
53- }
54- head, err := Git(path, "log", "-1", "--all", "--format=%ct%x00%s")
55- if err != nil {
56- return r, err
57- }
58- ts, subject, _ := strings.Cut(head, "\x00")
59- unix, err := strconv.ParseInt(ts, 10, 64)
60- r.Last, r.Subject = time.Unix(unix, 0).UTC(), subject
61- return r, err
62-}
63-
649 // Git runs git against the repository at dir and returns its trimmed output.
6510 func Git(dir string, args ...string) (string, error) {
6611 out, err := exec.Command("git", append([]string{"--git-dir", dir}, args...)...).Output()
internal/site/build.go+6−4
@@ -9,9 +9,10 @@ import (
99 "os"
1010 "os/exec"
1111 "path/filepath"
12+ "slices"
1213 "strings"
1314
14- "xonecas.io/site/internal/repo"
15+ "xonecas.io/site/internal/project"
1516 )
1617
1718 //go:embed templates/*.html
@@ -37,13 +38,14 @@ var funcs = template.FuncMap{
3738
3839 var pages = template.Must(template.New("").Funcs(funcs).ParseFS(templates, "templates/*.html"))
3940
40-// Build writes the site for repos into out. With a tailwind binary it also compiles site.css.
41-func Build(repos []repo.Repo, out, tailwind string) error {
41+// Build writes the site for the shown projects into out. With a tailwind binary it also compiles site.css.
42+func Build(projects []project.Project, out, tailwind string) error {
43+ shown := slices.DeleteFunc(slices.Clone(projects), func(p project.Project) bool { return p.Hidden != "" })
4244 for path, page := range map[string]struct {
4345 name string
4446 data any
4547 }{
46- "index.html": {"index.html", repos},
48+ "index.html": {"index.html", shown},
4749 "style/index.html": {"style.html", styleData()},
4850 } {
4951 if err := render(filepath.Join(out, path), page.name, page.data); err != nil {
internal/site/build_test.go+14−31
@@ -2,54 +2,37 @@ package site
22
33 import (
44 "os"
5- "os/exec"
65 "path/filepath"
76 "strings"
87 "testing"
98
10- "xonecas.io/site/internal/repo"
9+ "xonecas.io/site/internal/project"
1110 )
1211
13-// fixture makes a bare repo with one commit, and an empty one, in a temp folder.
14-func fixture(t *testing.T) string {
15- t.Helper()
16- dir, work := t.TempDir(), t.TempDir()
17- run := func(dir string, args ...string) {
18- cmd := exec.Command("git", args...)
19- cmd.Dir = dir
20- cmd.Env = append(os.Environ(), "GIT_AUTHOR_NAME=x", "GIT_AUTHOR_EMAIL=x@x", "GIT_COMMITTER_NAME=x", "GIT_COMMITTER_EMAIL=x@x")
21- if out, err := cmd.CombinedOutput(); err != nil {
22- t.Fatalf("git %v: %v\n%s", args, err, out)
23- }
24- }
25- run(work, "init", "-q", "-b", "main")
26- os.WriteFile(filepath.Join(work, "README.md"), []byte("# hello\n"), 0o644)
27- run(work, "add", ".")
28- run(work, "commit", "-qm", "first commit")
29- run(dir, "clone", "-q", "--bare", work, "hello.git")
30- run(dir, "init", "-q", "--bare", "empty.git")
31- return dir
32-}
33-
3412 func TestBuild(t *testing.T) {
35- repos, err := repo.List(fixture(t))
36- if err != nil {
37- t.Fatal(err)
38- }
39- if len(repos) != 2 || repos[0].Name != "hello" || repos[0].Commits != 1 || repos[1].Commits != 0 {
40- t.Fatalf("repos = %+v", repos)
13+ projects := []project.Project{
14+ {Name: "hello", Info: project.Info{Commits: 3, Last: "2026-11-01", Description: "says hi"}},
15+ {Name: "a-fork", Info: project.Info{Hidden: "fork"}},
4116 }
4217 out := t.TempDir()
43- if err := Build(repos, out, ""); err != nil {
18+ if err := Build(projects, out, ""); err != nil {
4419 t.Fatal(err)
4520 }
4621 page, err := os.ReadFile(filepath.Join(out, "index.html"))
4722 if err != nil {
4823 t.Fatal(err)
4924 }
50- for _, want := range []string{"2 projects", "hello", "first commit", "empty"} {
25+ for _, want := range []string{"1 projects", "hello", "says hi"} {
5126 if !strings.Contains(string(page), want) {
5227 t.Errorf("index.html is missing %q", want)
5328 }
5429 }
30+ if strings.Contains(string(page), "a-fork") {
31+ t.Error("index.html lists a hidden project")
32+ }
33+ for _, f := range []string{"style/index.html", "logo.svg"} {
34+ if _, err := os.Stat(filepath.Join(out, f)); err != nil {
35+ t.Error(err)
36+ }
37+ }
5538 }
internal/site/templates/index.html+1−1
@@ -3,7 +3,7 @@
33 <h1 class="text-3xl font-bold mb-4">{{len .}} projects</h1>
44 <ul>
55 {{range .}}<li class="py-2 border-b border-line">
6- <b>{{.Name}}</b> <span class="text-soft">· {{.Commits}} commits{{if .Commits}} · {{.Last.Format "2006-01-02"}} · {{.Subject}}{{end}}</span>
6+ <b>{{.Name}}</b> <span class="text-soft">· {{.Commits}} commits · {{.Last}} · {{.Description}}</span>
77 </li>{{end}}
88 </ul>
99 </main>
internal/store/meta.go+62−0
@@ -0,0 +1,62 @@
1+package store
2+
3+import (
4+ "encoding/json"
5+ "fmt"
6+ "net/http"
7+ "strings"
8+)
9+
10+// Meta is what a host says about a remote, fetched at import time.
11+type Meta struct {
12+ Fork bool `json:"fork"`
13+ Stars int `json:"stars"`
14+ Description string `json:"description"`
15+}
16+
17+// FetchMeta lists the public repos of every GitHub and GitLab owner in urls, keyed by clone URL.
18+// That is one request per owner, well inside GitHub's 60 unauthenticated requests an hour.
19+func FetchMeta(urls []string) (map[string]Meta, error) {
20+ owners := map[string]bool{}
21+ for _, u := range urls {
22+ host, path, _ := strings.Cut(strings.TrimPrefix(u, "https://"), "/")
23+ owner, _, _ := strings.Cut(path, "/")
24+ owners[host+"/"+owner] = true
25+ }
26+ metas := map[string]Meta{}
27+ for o := range owners {
28+ host, owner, _ := strings.Cut(o, "/")
29+ api := map[string]string{
30+ "github.com": "https://api.github.com/users/" + owner + "/repos?per_page=100&type=owner",
31+ "gitlab.com": "https://gitlab.com/api/v4/users/" + owner + "/projects?per_page=100",
32+ }[host]
33+ if api == "" {
34+ return nil, fmt.Errorf("no API for %s", host)
35+ }
36+ var rows []struct {
37+ CloneURL string `json:"clone_url"`
38+ HTTPURL string `json:"http_url_to_repo"`
39+ Fork bool `json:"fork"`
40+ ForkedFrom any `json:"forked_from_project"`
41+ Stars int `json:"stargazers_count"`
42+ StarCount int `json:"star_count"`
43+ Description string `json:"description"`
44+ }
45+ resp, err := http.Get(api)
46+ if err != nil {
47+ return nil, err
48+ }
49+ err = json.NewDecoder(resp.Body).Decode(&rows)
50+ resp.Body.Close()
51+ if err != nil || resp.StatusCode != 200 {
52+ return nil, fmt.Errorf("%s: %s %v", api, resp.Status, err)
53+ }
54+ if len(rows) == 100 {
55+ return nil, fmt.Errorf("%s: 100 repos, the list needs paging", api)
56+ }
57+ for _, r := range rows {
58+ metas[r.CloneURL+r.HTTPURL] = Meta{r.Fork || r.ForkedFrom != nil, r.Stars + r.StarCount, strings.TrimSpace(r.Description)}
59+ }
60+ }
61+ return metas, nil
62+}
overrides.txt+5−0
@@ -2,3 +2,8 @@
22 #
33 # merge <remote URL> <remote URL> make two remotes one project
44 # rename <name> <new name> rename a project
5+# hide <name> / show <name> hide a project, or list a fork or empty one
6+# tag <name> +frontend -backend add or drop tags; +post-AI also drops pre-AI, and so on
7+
8+hide irvc # a live product; xonecas on 1001: "Dont advertise irvc or space browser"
9+tag sacenox.github.io -backend # a static site; its docker-compose.yml only runs it locally
tickets/1005-generate-project-metadata-and-tags-with.md+23−3
@@ -2,13 +2,13 @@
22 id: 1005
33 title: Generate project metadata and tags, with overrides
44 type: feature
5-status: doing
5+status: review
66 priority: p1
77 area: data
88 created: 2026-11-07T19:30:00Z
9-updated: 2026-11-08T01:11:45Z
9+updated: 2026-11-08T01:28:52Z
1010 source: agent
11-moves: 2026-11-07T19:30:00Z inbox todo agent; 2026-11-08T01:09:34Z todo doing drag
11+moves: 2026-11-07T19:30:00Z inbox todo agent; 2026-11-08T01:09:34Z todo doing drag; 2026-11-08T01:28:52Z doing review agent
1212 ---
1313
1414 Compute for each project: dates, commit counts, languages, stars at import time, sources, README, and tags. Tags are generated from git, with a small override file for what heuristics get wrong.
@@ -29,3 +29,23 @@ Done when: one data file drives all pages, and every project has exactly one of
2929 ## Notes
3030
3131 - 2026-11-08 01:11Z (agent): Decision from xonecas (terminal): accept all recommendations. Post-AI cutoff 2025-09-05 (or an AI file or trailer), big is 50+ of your commits, hide all 20 forks, hide only githubstopannoyingme, show author names only.
32+
33+- 2026-11-08 01:28Z (agent): Done: 'make index' writes data/projects.json, the one data file 'site build' reads. Every project has exactly one of pre-AI/post-AI and one of small/big.
34+
35+ RESULT: 103 projects, 81 shown. Hidden: 20 forks, 1 empty (githubstopannoyingme) and irvc (see CHOICE). Before irvc was hidden, the tag counts matched repos.md on 1000 exactly: 82 shown, 51 pre-AI / 31 post-AI, 70 small / 12 big. 14 shown projects have no README.
36+
37+ WHAT EACH PROJECT HAS (internal/project): description, the first and last of your commits, your commits and everyone's, your commits per month (for the heat walls), stars, file count, languages by bytes (5% and up), the README path, tags, and why it is hidden.
38+ - Your commits are author names xonecas, sacenox, Sean, Sean Martin or Sean Caetano Martin, in any case, with each hash counted once across sources. Five repos are authored as lowercase 'sean'. Emails are never read, so the data holds names only.
39+ - post-AI: an AI instruction file anywhere in the history (AGENTS.md, CLAUDE.md, .cursorrules and similar), an AI co-author trailer, or a first commit on or after 2025-09-05. big: 50+ of your commits. frontend and backend come from file names in the default branch, skipping node_modules, vendor and dist.
40+ - Stars, the fork flag and descriptions come from the GitHub and GitLab APIs. 'site import' saves them to data/meta.json in 3 requests. With no description, the first line of prose in the README is used, with Markdown links stripped.
41+ - overrides.txt gains 'hide', 'show' and 'tag <name> +x -y'. Dropping pre-AI, post-AI, small or big is refused, so the one-of-each rule holds.
42+
43+ DIFFERENCES FROM repos.md:
44+ - dotfiles has 101 commits, not 96, because 5 were pushed since 1000. The total is now 2,775.
45+ - backend: I dropped the misfires that came from package.json-style guesses: startsInvasion, fractal-tree, particle-play, simple-flask-coffee-sass-boilerplate, i3wm-background-desktop-script, cel-tui, diff-scope, tiny-c-agent and mini-coding-agent (TUIs and CLIs). Added: meal_tracker (Django: manage.py, wsgi.py). sacenox.github.io would have read as backend from a docker-compose.yml, so an override drops it.
46+ - Language is now by bytes from git rather than the hosts' guess, so 9 projects differ. For example dotfiles is Lua (the nvim config), dotfiles-2014 and dotfiles-2020 are Python, and xonecas.com is HTML. If you want the hosts' language back, that needs your call.
47+
48+ CHOICE I MADE (easy to change): 'hide irvc' in overrides.txt, following your note on 1001 ('Dont advertise irvc'). Delete that line to list it.
49+
50+ CHECKED: unit tests for tag rules, overrides, grouping and the build, which skips hidden projects. I diffed the data against repos.md row by row, and grepped the data file for email addresses (none).
51+ NOT CHECKED: tags by hand for each project. The frontend/backend rules are heuristics, as expected.