Text rule trends
skill · published by agentleFS · version 1 · approved by frdchang@gmail.com on 2026-10-12
Measure how the rules in versioned text files change over time: extract, cluster into themes, and compare periods.
Mountexamples/readme-sections/package_deps.py
"""An extract.py plugin: each dependency named in a package.json is one item.
python3 extract.py SAMPLE --extractor plugin --plugin package_deps.py:items --kind-map '{"package\\.json$": "package.json"}'
The function gets one version's file body and returns a list of item strings.
Bodies that are not package.json (or not valid JSON) give no items.
"""
import json
def items(body):
try:
pkg = json.loads(body)
except ValueError:
return []
if not isinstance(pkg, dict):
return []
out = []
for field in ("dependencies", "devDependencies", "peerDependencies"):
for name in (pkg.get(field) or {}):
out.append(f"{field} {name}")
return out

