Files
awesome-coding-agents/site.go
T
tiennm99andGitHub 5051274e52 feat: add 10 agents, fix renamed slugs, add GitHub Pages dashboard (#5)
- Add pi, OpenHands, warp, gpt-pilot, qwen-code, kilocode, onlook,
  dyad, trae-agent, copilot-cli (19 -> 29 tracked repos)
- Update renamed slugs to canonical owners (anomalyco/opencode,
  aaif-goose/goose, AntonOsika/gpt-engineer) with history key
  migrations so star deltas survive the rename
- Generate site/data.json each run and deploy site/ (interactive
  table + star-history chart) to GitHub Pages from the daily
  workflow, since GITHUB_TOKEN bot pushes cannot trigger a separate
  Pages workflow
2026-08-08 23:27:53 +07:00

62 lines
1.8 KiB
Go

package main
import (
"encoding/json"
"os"
"time"
)
// siteRow is one ranked repo in site/data.json, consumed by site/index.html.
type siteRow struct {
Key string `json:"key"` // canonical owner/repo, matches history keys
NameWithOwner string `json:"nameWithOwner"`
URL string `json:"url"`
Stars int `json:"stars"`
Delta7d int `json:"delta7d"`
HasDelta bool `json:"hasDelta"`
Language string `json:"language"`
PushedAt string `json:"pushedAt"`
Description string `json:"description"`
Category string `json:"category"`
Notes string `json:"notes,omitempty"`
}
type siteData struct {
UpdatedAt string `json:"updatedAt"`
Rows []siteRow `json:"rows"`
History []Snapshot `json:"history"`
}
// writeSiteData emits the JSON payload for the GitHub Pages dashboard.
// The file is generated fresh on every updater run and is not committed;
// the Pages deploy step in the workflow picks it up from the working tree.
func writeSiteData(path string, stats []Stat, deltas map[string]int, history []Snapshot) error {
rows := make([]siteRow, len(stats))
for i, s := range stats {
delta, has := deltas[s.CanonicalKey]
rows[i] = siteRow{
Key: s.CanonicalKey,
NameWithOwner: s.NameWithOwner,
URL: s.URL,
Stars: s.Stars,
Delta7d: delta,
HasDelta: has,
Language: s.Language,
PushedAt: s.PushedAt.Format("2006-01-02"),
Description: s.Description,
Category: s.Category,
Notes: s.Notes,
}
}
out, err := json.Marshal(siteData{
UpdatedAt: time.Now().UTC().Format("2006-01-02 15:04 UTC"),
Rows: rows,
History: history,
})
if err != nil {
return err
}
return os.WriteFile(path, out, 0o644)
}