-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull_sample.sh
More file actions
34 lines (34 loc) · 1.67 KB
/
Copy pathpull_sample.sh
File metadata and controls
34 lines (34 loc) · 1.67 KB
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
#!/usr/bin/env bash
# Outcome-blind stratified pull: AI/LLM devtools created 2025, 5 star buckets, ~60 each.
# Within each bucket we sort by 'created' ASC (NOT stars) so selection is blind to outcome-within-stratum.
# As-run 2026-07-07 for the controlled study (STUDY-empirical-validation.md).
set -euo pipefail
OUT="./study-data"
mkdir -p "$OUT"
Q_BASE='llm OR "ai agent" OR "coding agent" OR "mcp server" created:2025-01-01..2025-12-31'
: > "$OUT/sample.jsonl"
# parallel arrays: tag | star-range (avoid assoc-array subscript arithmetic on "1..9")
TAGS=(b1_lt10 b2_10-99 b3_100-999 b4_1k-9k b5_10k+)
RANGES=("1..9" "10..99" "100..999" "1000..9999" "10000..*")
for i in "${!TAGS[@]}"; do
TAG="${TAGS[$i]}"; B="${RANGES[$i]}"
echo "[pull] bucket $B ($TAG) ..." >&2
for PAGE in 1 2; do
gh api -X GET search/repositories \
--field q="$Q_BASE stars:$B" \
--field sort=created --field order=asc \
--field per_page=30 --field page="$PAGE" \
--jq ".items[] | {bucket:\"$TAG\", full_name, stars:.stargazers_count, forks:.forks_count, watchers:.watchers_count, open_issues:.open_issues_count, created:.created_at, pushed:.pushed_at, language, description, owner:.owner.login, owner_type:.owner.type, homepage, license:(.license.spdx_id // null)}" \
>> "$OUT/sample.jsonl" 2>/dev/null || echo "[warn] page $PAGE bucket $B failed" >&2
sleep 3
done
done
echo "[done] $(wc -l < "$OUT/sample.jsonl") repos pulled -> $OUT/sample.jsonl" >&2
python3 -c "
import json,collections
c=collections.Counter()
for l in open('$OUT/sample.jsonl'):
c[json.loads(l)['bucket']]+=1
for k in ['b1_lt10','b2_10-99','b3_100-999','b4_1k-9k','b5_10k+']:
print(f' {k}: {c[k]}')
" >&2