justinmclean commented on code in PR #215:
URL: https://github.com/apache/airflow-steward/pull/215#discussion_r3295817018


##########
tools/skill-validator/src/skill_validator/__init__.py:
##########
@@ -68,9 +68,47 @@
 REQUIRED_FRONTMATTER_KEYS = {"name", "description", "license"}
 OPTIONAL_FRONTMATTER_KEYS = {"when_to_use", "mode"}
 ALLOWED_LICENSES = {"Apache-2.0"}
-# MISSION mode taxonomy — see docs/modes.md.
-# "Auto-merge" deliberately excluded: it is off per MISSION sequencing.
-ALLOWED_MODES = {"Triage", "Mentoring", "Drafting", "Pairing"}
+
+
+def _read_mode_table() -> dict[str, str]:
+    """Read the canonical MISSION mode table from ``docs/modes.md``."""
+    starts = [Path.cwd().resolve(), Path(__file__).resolve().parent]
+    roots = []
+    for start in starts:
+        roots.extend([start, *start.parents])
+
+    for root in roots:
+        modes_doc = root / DOCS_DIR / "modes.md"
+        if not modes_doc.is_file():
+            continue
+        text = modes_doc.read_text(encoding="utf-8")
+        try:
+            modes_table = text.split("## Modes at a glance", 1)[1].split("## 
Triage", 1)[0]
+        except IndexError:
+            break
+        modes: dict[str, str] = {}
+        for line in modes_table.splitlines():
+            if not line.startswith("| **"):
+                continue
+            cells = [cell.strip() for cell in line.strip("|").split("|")]
+            if len(cells) < 3:
+                continue
+            mode = cells[0].strip("*")
+            status = cells[2].strip()
+            if mode and status:
+                modes[mode] = status
+        if modes:
+            return modes
+
+    msg = "could not read mode taxonomy from docs/modes.md"
+    raise RuntimeError(msg)
+
+
+# MISSION mode taxonomy — docs/modes.md is canonical.
+_MODE_STATUS_BY_NAME = _read_mode_table()
+_MODE_TAXONOMY = set(_MODE_STATUS_BY_NAME)
+_OFF_MODES = {mode for mode, status in _MODE_STATUS_BY_NAME.items() if status 
== "off"}
+ALLOWED_MODES = _MODE_TAXONOMY - _OFF_MODES
 

Review Comment:
   This doesn't really apply — skill-validator isn't a redistributable library, 
it's a repo-bound CI tool (uv run --project tools/skill-validator) that only 
validates this repo's .claude/skills/ against docs/. "Installed without docs" 
is a state where the whole tool is a no-op anyway, so there's nothing to harden 
for.
   
   The cwd concern is already handled: _read_mode_table() also searches from 
Path(__file__).resolve().parent upward, so it finds <repo>/docs/modes.md 
regardless of cwd.
   
   Fallback table is a no — docs/modes.md is intentionally the single source of 
truth for the taxonomy; an embedded copy reintroduces the drift this validator 
exists to catch.
   
   Fair point that the import-time read raises instead of failing open like the 
rest of the module, but that's the behavior I want from a consistency check. If 
we ever soften it, lazy-loading in run_validation is the route.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to