-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlanguage-status-tracker.jl
More file actions
executable file
·280 lines (239 loc) · 8.11 KB
/
Copy pathlanguage-status-tracker.jl
File metadata and controls
executable file
·280 lines (239 loc) · 8.11 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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/usr/bin/env julia
# SPDX-License-Identifier: MPL-2.0
# Language Repository Status Tracker
# Run this daily to see exactly what state everything is in
using Dates
const REPOS_DIR = get(ENV, "HYPERPOLYMATH_REPOS_DIR", joinpath(homedir(), "Documents/hyperpolymath-repos"))
# All known language repos
const LANGUAGES = [
# Family languages (14) — must match .machine_readable/LANGUAGES.a2ml
"affinescript", "anvomidav", "betlang", "eclexia", "ephapax",
"error-lang", "haec", "jtv", "my-lang", "oblibeny",
"phronesis", "tangle", "wokelang",
"007", # private: The-Metadatastician/007 (local clone dir name "007")
# Family DSL
"kitchenspeak",
# Supporting tooling (not languages)
"universal-language-server-plugin",
# Playgrounds
"betlang-playground", "ephapax-playground", "error-lang-playground", "mylang-playground",
# Ephapax ecosystem
"ephapax-proven", "ephapax-proven-ffi", "ephapax-proven-sys", "ephapax-ssg",
# WokeLang ecosystem
"wokelang-ssg",
# Umbrella
"nextgen-languages",
]
struct RepoStatus
name::String
exists::Bool
is_git::Bool
src_files::Int
last_commit::String
commit_count::Int
has_cargo::Bool
has_dune::Bool
has_package_json::Bool
end
function count_source_files(path)
count = 0
for ext in [".rs", ".ml", ".js", ".ts", ".res", ".idr", ".zig"]
try
result = read(`find $path -name "*$ext" -type f`, String)
count += length(split(strip(result), '\n'))
catch
continue
end
end
return count
end
function get_repo_status(name)
path = joinpath(REPOS_DIR, name)
if !isdir(path)
return RepoStatus(name, false, false, 0, "", 0, false, false, false)
end
is_git = isdir(joinpath(path, ".git"))
last_commit = ""
commit_count = 0
if is_git
try
cd(path) do
last_commit = strip(read(`git log -1 --format=%ar`, String))
commit_count = parse(Int, strip(read(`git rev-list --count HEAD`, String)))
end
catch
last_commit = "ERROR"
commit_count = 0
end
end
src_files = count_source_files(path)
has_cargo = isfile(joinpath(path, "Cargo.toml"))
has_dune = isfile(joinpath(path, "dune-project"))
has_package_json = isfile(joinpath(path, "package.json"))
return RepoStatus(name, true, is_git, src_files, last_commit, commit_count,
has_cargo, has_dune, has_package_json)
end
function language_type(status)
if status.has_cargo
return "Rust"
elseif status.has_dune
return "OCaml"
elseif status.has_package_json
return "JS/ReScript"
else
return "Unknown"
end
end
# --- Grade extraction (ARG / FRG / TRG / CRG / RSR) -------------------------
#
# Each language's per-grade profile lives at `spec/{ARG,FRG,TRG}-PROFILE.adoc`
# in the language's own repo. The "Current X Grade:" line is the source of
# truth for the language's grade against that standard. We extract by regex
# rather than parsing AsciiDoc, because the profile format is stable.
struct LanguageGrades
arg::String
trg::String
frg::String
crg::String
rsr::String
end
const GRADE_LINE_RE = Dict(
:arg => r"Current ARG Grade\s*\|\s*\*?\*?([XFEDCBA][^*|]*)"i,
:trg => r"Current TRG Grade\s*\|\s*\*?\*?([XFEDCBA][^*|]*)"i,
:frg => r"Current FRG Grade\s*\|\s*\*?\*?([XFEDCBA][^*|]*)"i,
:crg => r"Current CRG Grade\s*\|\s*\*?\*?([XFEDCBA][^*|]*)"i,
:rsr => r"RSR Compliance\s*\|\s*([A-Z]+)"i,
)
function extract_grade(path::String, kind::Symbol)
isfile(path) || return "TBD"
try
text = read(path, String)
m = match(GRADE_LINE_RE[kind], text)
return m === nothing ? "TBD" : strip(m.captures[1])
catch
return "TBD"
end
end
function get_language_grades(name::String)
path = joinpath(REPOS_DIR, name)
isdir(path) || return LanguageGrades("—", "—", "—", "—", "—")
arg_file = joinpath(path, "spec", "ARG-PROFILE.adoc")
frg_file = joinpath(path, "spec", "FRG-PROFILE.adoc")
trg_file = joinpath(path, "spec", "TRG-PROFILE.adoc")
arg = extract_grade(arg_file, :arg)
trg = extract_grade(trg_file, :trg)
frg = extract_grade(frg_file, :frg)
# CRG and RSR may appear in any of the three profile files; first hit wins.
crg = "TBD"
rsr = "TBD"
for f in (arg_file, frg_file, trg_file)
if crg == "TBD"
crg = extract_grade(f, :crg)
end
if rsr == "TBD"
rsr = extract_grade(f, :rsr)
end
end
return LanguageGrades(arg, trg, frg, crg, rsr)
end
function status_emoji(status)
if !status.exists
return "❌"
elseif status.src_files == 0
return "🔴"
elseif status.src_files < 10
return "🟡"
elseif status.src_files < 40
return "🟠"
else
return "🟢"
end
end
println("=" ^ 80)
println("LANGUAGE REPOSITORY STATUS REPORT")
println("Generated: ", Dates.format(now(), "yyyy-mm-dd HH:MM:SS"))
println("=" ^ 80)
println()
# Collect all statuses
statuses = [get_repo_status(lang) for lang in LANGUAGES]
# Summary
total = length(statuses)
existing = count(s -> s.exists, statuses)
with_code = count(s -> s.src_files > 0, statuses)
production_ready = count(s -> s.src_files >= 40, statuses)
println("SUMMARY")
println("-------")
println(" Total repos tracked: $total")
println(" Exist on disk: $existing")
println(" Have source code: $with_code")
println(" Production-ready (40+ files): $production_ready")
println()
# Detailed table
println("DETAILED STATUS")
println("---------------")
println()
println("| Repo | Status | Type | Files | Commits | Last Updated |")
println("|------|--------|------|-------|---------|--------------|")
for status in sort(statuses, by=s->(-s.src_files, s.name))
emoji = status_emoji(status)
type_str = status.exists ? language_type(status) : "N/A"
files = status.exists ? string(status.src_files) : "-"
commits = status.is_git ? string(status.commit_count) : "-"
last = status.is_git ? status.last_commit : "-"
println("| $(status.name) | $emoji | $type_str | $files | $commits | $last |")
end
println()
println("=" ^ 80)
println()
# Grade matrix — sources from spec/{ARG,FRG,TRG}-PROFILE.adoc in each repo.
# Cross-axis invariants: ARG ≤ TRG always; ARG-A requires FRG ≥ B.
println("LANGUAGE GRADE MATRIX (CRG / TRG / ARG / FRG / RSR)")
println("-" ^ 60)
println("| Language | CRG | TRG | ARG | FRG | RSR |")
println("|----------|-----|-----|-----|-----|-----|")
for status in sort(statuses, by=s->s.name)
status.exists || continue
g = get_language_grades(status.name)
println("| $(status.name) | $(g.crg) | $(g.trg) | $(g.arg) | $(g.frg) | $(g.rsr) |")
end
println()
println("Grade source of truth: each language repo's `spec/{ARG,FRG,TRG}-PROFILE.adoc`.")
println("Missing/unparsed entries surface as TBD; '—' means repo not on disk.")
println()
println("=" ^ 80)
println()
# Production ready list
println("🟢 PRODUCTION READY (40+ source files):")
println("-" ^ 40)
for status in filter(s -> s.src_files >= 40, statuses)
println(" • $(status.name) ($(status.src_files) files, $(language_type(status)))")
end
println()
# In progress list
println("🟡 IN PROGRESS (1-39 source files):")
println("-" ^ 40)
for status in filter(s -> s.src_files > 0 && s.src_files < 40, statuses)
println(" • $(status.name) ($(status.src_files) files, $(language_type(status)))")
end
println()
# Not started
println("🔴 NOT STARTED (0 source files):")
println("-" ^ 40)
for status in filter(s -> s.exists && s.src_files == 0, statuses)
println(" • $(status.name) ($(language_type(status)))")
end
println()
# Missing
println("❌ MISSING (not found on disk):")
println("-" ^ 40)
for status in filter(s -> !s.exists, statuses)
println(" • $(status.name)")
end
println()
println("=" ^ 80)
println("Next steps:")
println(" 1. Review production-ready repos for release")
println(" 2. Focus development on in-progress repos")
println(" 3. Decide: continue or archive not-started repos")
println(" 4. Investigate missing repos")
println("=" ^ 80)