mirror of
https://github.com/tiennm99/awesome-coding-agents.git
synced 2026-05-13 21:52:16 +00:00
237d7acd6a
Go updater that fetches AI agent coding tool repo stats via GitHub GraphQL (batched, one query), sorts by star count, appends a daily snapshot to data/history.jsonl, and regenerates README.md from templates/readme.tmpl. Daily workflow at .github/workflows/update.yml refreshes rankings and commits changes. Seed list in data/agents.yml covers 19 tracked repos.
38 lines
702 B
Go
38 lines
702 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
type Agent struct {
|
|
Owner string `yaml:"owner"`
|
|
Repo string `yaml:"repo"`
|
|
Category string `yaml:"category,omitempty"`
|
|
Notes string `yaml:"notes,omitempty"`
|
|
}
|
|
|
|
type Config struct {
|
|
Agents []Agent `yaml:"agents"`
|
|
}
|
|
|
|
func loadAgents(path string) ([]Agent, error) {
|
|
data, err := os.ReadFile(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var cfg Config
|
|
if err := yaml.Unmarshal(data, &cfg); err != nil {
|
|
return nil, err
|
|
}
|
|
// validate each entry has owner + repo
|
|
for i, a := range cfg.Agents {
|
|
if a.Owner == "" || a.Repo == "" {
|
|
return nil, fmt.Errorf("entry %d missing owner or repo", i)
|
|
}
|
|
}
|
|
return cfg.Agents, nil
|
|
}
|