CLAUDE.md §5's 110-line cap on SKILL.md held only in prose, so it decayed twice — 013 split moor and 016 deduped call-charon and commit-atomic-jj, both hand-fixes. `okf-check` has enforced the same integer across OKF/ since 009; skills/ now gets its own gate. A sibling script, not a flag on okf-check: the two trees share the integer 110 and nothing else, and threading a tree-kind flag through a 275-line OKF-page-shaped validator to reuse a two-line comparison fails sieve's Minimal test. - feat(conjure-a-skill): add scripts/skill-check <skills-dir>, walking */*/SKILL.md — ERROR over 110, WARN in the 101-110 headroom band with the count and the room left. Mirrors okf-check's argv, WARN /ERROR prefixes, closing tally and 1/0/2 exit codes - docs(conjure-a-skill): swap the done-criteria line asserting the cap in prose for the script invocation, as write-OKF obliges okf-check; one line for one, leaving the file at 105 - docs(blueprint): flip 017 to implemented and update its index line The tree lands green: 0 errors, 9 warnings, with write-OKF and bdd at the cap itself. Verify exercises the error leg against a synthetic over-cap skill — a check that cannot fail is not a check. implements blueprint 017
48 lines
1.5 KiB
Python
Executable File
48 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Validate skill line counts. Usage: skill-check <skills-dir>
|
|
|
|
Errors (exit 1): a SKILL.md over the 110-line house cap. Warnings
|
|
(exit 0): a SKILL.md in the 101-110 headroom band — legal, but with
|
|
nowhere left to grow, so the next edit needs a topic-named sibling
|
|
rather than more lines.
|
|
|
|
The cap errors rather than warns because a legal move always exists:
|
|
push reference into a sibling. Only `<category>/<name>/SKILL.md` is
|
|
read — siblings load on demand and carry no cap.
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
CAP = 110
|
|
WARN_AT = 100
|
|
|
|
|
|
def main(argv):
|
|
if len(argv) != 2:
|
|
print("usage: skill-check <skills-dir>", file=sys.stderr)
|
|
return 2
|
|
root = Path(argv[1]).resolve()
|
|
if not root.is_dir():
|
|
print(f"not a directory: {root}", file=sys.stderr)
|
|
return 2
|
|
|
|
errors, warnings = [], []
|
|
for page in sorted(root.glob("*/*/SKILL.md")):
|
|
rel = page.relative_to(root.parent)
|
|
lines = page.read_text().count("\n") # `wc -l`, the count the cap is stated in
|
|
if lines > CAP:
|
|
errors.append(f"{rel}: {lines} lines, over the {CAP}-line cap")
|
|
elif lines > WARN_AT:
|
|
warnings.append(f"{rel}: {lines} lines, {CAP - lines} under the cap")
|
|
|
|
for line in warnings:
|
|
print(f"WARN {line}")
|
|
for line in errors:
|
|
print(f"ERROR {line}")
|
|
print(f"{len(errors)} error(s), {len(warnings)} warning(s)")
|
|
return 1 if errors else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main(sys.argv))
|