Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Organization-level defaults for the [muxlang](https://github.com/muxlang) org:
- `templates/<repo>/` - canonical issue template sources synced to each repo.
- `scripts/sync-labels.sh` - apply label YAML to org repos (`gh` CLI required).
- `scripts/sync-templates.sh` - copy `templates/<repo>/` into a repo checkout.
- `scripts/retire-labels.sh` - delete retired labels org-wide.
- `scripts/clear-milestones.sh` - bulk-clear milestones from a repo's issues.
- `scripts/validate-labels.py` - diff live labels against the canonical YAML;
exits nonzero on drift (run after any sync).

Policy and workflow rules:
[mux-context/docs/repo-governance.md](https://github.com/muxlang/mux-context/blob/main/docs/repo-governance.md).
Expand Down
28 changes: 0 additions & 28 deletions scripts/clear-milestones.sh

This file was deleted.

21 changes: 0 additions & 21 deletions scripts/retire-labels.sh

This file was deleted.

7 changes: 5 additions & 2 deletions scripts/sync-labels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ apply_yaml() {
case "$line" in
"- name:"*)
name="${line#- name:}"
name="${name#\"}"
name="${name%\"}"
# Trim whitespace BEFORE stripping quotes: quoted names like
# "priority: urgent" used to keep their leading quote because the
# strip ran against ' "priority: urgent"' and missed.
name="${name#"${name%%[![:space:]]*}"}"
name="${name%"${name##*[![:space:]]}"}"
name="${name#\"}"
name="${name%\"}"
;;
" color:"*)
color="${line# color: }"
Expand Down
96 changes: 96 additions & 0 deletions scripts/validate-labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
"""Validate live GitHub labels against the canonical labels/*.yml files.

For every muxlang repo, fetches the live label set with `gh` and diffs it
against labels/labels.yml plus the repo's overlay (labels/<repo>.yml).
Reports labels that are MISSING (canonical but not live), EXTRA (live but
not canonical), or DRIFTED (color or description differs).

Usage: ./scripts/validate-labels.py [repo ...]
Exits nonzero if any repo diverges. Requires gh (authenticated) and python3.
"""
import json
import re
import subprocess
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
LABELS = ROOT / "labels"

ALL_REPOS = [
"mux-compiler", "mux-runtime", "mux-website-api",
"mux-syntax-highlighting", "mux-website", "tree-sitter-mux",
"mux-context", ".github",
]


def parse_yaml(path):
"""Parse the flat '- name/color/description' label YAML (no deps)."""
labels = {}
name = color = None
for raw in path.read_text().splitlines():
m = re.match(r'^- name:\s*(.+)$', raw)
if m:
name = m.group(1).strip().strip('"')
continue
m = re.match(r'^\s+color:\s*(.+)$', raw)
if m:
color = m.group(1).strip().strip('"')
continue
m = re.match(r'^\s+description:\s*(.*)$', raw)
if m and name and color:
labels[name] = (color.lower(), m.group(1).strip().strip('"'))
Comment thread
greptile-apps[bot] marked this conversation as resolved.
name = color = None
return labels


def live_labels(repo):
# gh api --paginate follows Link headers, so repos with more than one
# page of labels are fully covered (gh label list caps at its --limit).
out = subprocess.run(
["gh", "api", f"repos/muxlang/{repo}/labels", "--paginate",
"--jq", ".[] | {name, color, description}"],
check=True, capture_output=True, text=True,
).stdout
return {
l["name"]: (l["color"].lower(), l["description"] or "")
for l in (json.loads(line) for line in out.splitlines() if line)
}


def main():
repos = sys.argv[1:] or ALL_REPOS
base = parse_yaml(LABELS / "labels.yml")
dirty = False

for repo in repos:
expected = dict(base)
overlay = LABELS / f"{repo}.yml"
if overlay.exists():
expected.update(parse_yaml(overlay))
live = live_labels(repo)

missing = sorted(set(expected) - set(live))
extra = sorted(set(live) - set(expected))
drifted = sorted(
n for n in set(expected) & set(live) if expected[n] != live[n]
)

print(f"=== {repo} ===")
if not (missing or extra or drifted):
print(" OK: exact match")
continue
dirty = True
for n in missing:
print(f" MISSING : {n!r} (run sync-labels.sh {repo})")
for n in extra:
print(f" EXTRA : {n!r} (add to a labels yml or retire it)")
for n in drifted:
print(f" DRIFTED : {n!r} live={live[n]} expected={expected[n]}")

return 1 if dirty else 0


if __name__ == "__main__":
sys.exit(main())
34 changes: 0 additions & 34 deletions templates/mux-compiler/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

51 changes: 51 additions & 0 deletions templates/mux-compiler/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Bug report
description: Report incorrect compiler behavior or a crash
labels: ["needs triage"]
assignees: ["DerekCorniello"]
body:
- type: textarea
id: description
attributes:
label: Description
description: What went wrong?
validations:
required: true
- type: textarea
id: repro
attributes:
label: Steps to reproduce
value: |
1.
2.
3.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual behavior
description: Include error output if any.
validations:
required: true
- type: textarea
id: example
attributes:
label: Minimal example
render: mux
description: Smallest Mux program that reproduces the problem.
- type: input
id: version
attributes:
label: mux --version
validations:
required: true
- type: input
id: os
attributes:
label: OS / architecture
17 changes: 0 additions & 17 deletions templates/mux-compiler/ISSUE_TEMPLATE/documentation_fix.md

This file was deleted.

21 changes: 21 additions & 0 deletions templates/mux-compiler/ISSUE_TEMPLATE/documentation_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Documentation fix
description: Report incorrect or missing compiler documentation
labels: ["documentation", "needs triage"]
assignees: ["DerekCorniello"]
body:
- type: textarea
id: wrong
attributes:
label: What is wrong
description: Which doc, README, or error message?
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected content
- type: textarea
id: links
attributes:
label: Links
description: File paths or URLs.
17 changes: 0 additions & 17 deletions templates/mux-compiler/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

26 changes: 26 additions & 0 deletions templates/mux-compiler/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Feature request
description: Suggest a new language or compiler capability
labels: ["needs triage"]
assignees: ["DerekCorniello"]
body:
- type: textarea
id: problem
attributes:
label: Problem
description: What problem would this solve?
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed solution
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
- type: textarea
id: context
attributes:
label: Additional context
15 changes: 0 additions & 15 deletions templates/mux-context/ISSUE_TEMPLATE/adr_proposal.md

This file was deleted.

27 changes: 27 additions & 0 deletions templates/mux-context/ISSUE_TEMPLATE/adr_proposal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ADR or design proposal
description: Propose an architecture decision or cross-repo design change
labels: ["needs triage", "adr"]
assignees: ["DerekCorniello"]
body:
- type: textarea
id: problem
attributes:
label: Problem
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposal
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
- type: textarea
id: repos
attributes:
label: Affected repos
validations:
required: true
Loading
Loading