from pathlib import Path import os ROOT=Path(__file__).resolve().parents[1] def owner(name): base=Path(os.environ.get('DELIVERY_OWNER_ROOT',str(ROOT.parent))) direct=base/name/'SKILL.md' found=[direct] if direct.is_file() else list(base.glob('*/'+name+'/SKILL.md')) if len(found)!=1: raise RuntimeError('Owner missing or ambiguous: '+name+' under '+str(base)) return found[0].read_text() def effective(path): text=(ROOT/path).read_text() routes={'references/runtime-and-ci.md':['ci-runtime-skic'], 'references/status-and-reporting.md':['status-reporting-skic'], 'references/failure-and-documentation.md':['ci-runtime-skic','status-reporting-skic','delivery-docs']} return text+'\n'+'\n'.join(owner(n) for n in routes.get(path,[]))