summaryrefslogtreecommitdiff
path: root/scripts/check_ptrm_gram.sh
blob: 26f5e3e9372be677b6256ee6b02d38389c47d1ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# Weekly check: have PTRM / GRAM official implementations been released?
# - diffs repo lists of SamsungSAILMontreal (PTRM authors) and ahn-ml (GRAM authors)
# - GitHub global search for ptrm / gram-reasoning style repos
# - GRAM project page: does "coming soon" still gate the code link?
# On any hit: writes ALERT_ptrm_gram.txt next to the log. Designed for cron (no env deps).
set -o pipefail

DIR="/home/yurenh2/rrm/scripts/ptrm_gram_watch"
mkdir -p "$DIR"
LOG="$DIR/check.log"
TS="$(date '+%Y-%m-%d %H:%M:%S')"
alert() { echo "[$TS] ALERT: $*" >> "$DIR/ALERT_ptrm_gram.txt"; echo "[$TS] ALERT: $*" >> "$LOG"; }
note() { echo "[$TS] $*" >> "$LOG"; }

fetch_repos() { # org -> sorted repo names
  curl -sL --max-time 60 "https://api.github.com/orgs/$1/repos?per_page=100" \
    | grep -o '"full_name": *"[^"]*"' | cut -d'"' -f4 | sort
}

for org in SamsungSAILMontreal ahn-ml; do
  cur="$DIR/${org}_repos.txt"
  new="$DIR/${org}_repos.new"
  fetch_repos "$org" > "$new"
  if [[ ! -s "$new" ]]; then note "$org: fetch failed/empty, skipping diff"; rm -f "$new"; continue; fi
  if [[ -f "$cur" ]]; then
    added="$(comm -13 "$cur" "$new")"
    if [[ -n "$added" ]]; then alert "$org new repos: $(echo "$added" | tr '\n' ' ')"; fi
  fi
  mv "$new" "$cur"
  note "$org: $(wc -l < "$cur") repos"
done

# global search (unauthenticated; weekly cadence well under rate limits)
for q in "PTRM+recursive+reasoning" "probabilistic+tiny+recursive" "GRAM+recursive+reasoning+model"; do
  hits="$(curl -sL --max-time 60 "https://api.github.com/search/repositories?q=${q}&sort=updated&per_page=5" \
    | grep -o '"full_name": *"[^"]*"' | cut -d'"' -f4)"
  known="$DIR/search_known.txt"; touch "$known"
  while IFS= read -r r; do
    [[ -z "$r" ]] && continue
    if ! grep -qxF "$r" "$known"; then
      echo "$r" >> "$known"
      alert "new search hit ($q): $r"
    fi
  done <<< "$hits"
done

# GRAM project page: code still "coming soon"?
page="$(curl -sL --max-time 60 "https://ahn-ml.github.io/gram-website/" || true)"
if [[ -n "$page" ]]; then
  if echo "$page" | grep -qi "coming soon"; then
    note "GRAM page: still 'coming soon'"
  else
    alert "GRAM page no longer says 'coming soon' — check for code link"
  fi
  link="$(echo "$page" | grep -oiE 'href="[^"]*github\.com[^"]*"' | grep -vi "ahn-ml.github.io\|Academic-project-page-template" | head -3)"
  if [[ -n "$link" ]]; then alert "GRAM page github link(s): $link"; fi
else
  note "GRAM page fetch failed"
fi

note "check complete"