← Files Power BI Report CopilotARCHIVED FILE

scripts/validate_package.py

3.55 KB · Nov 20, 2026 · 06:46 UTC

↓ Download file

See the change to this file →

#!/usr/bin/env python3
"""Static packaging checker. Does not execute any Power BI action."""
from pathlib import Path
import json, re, sys
R=Path(__file__).resolve().parents[1]
issues=[]; checks=0

def check(ok,message):
    global checks
    checks+=1
    if not ok:issues.append(message)

p=json.loads((R/'plugin.json').read_text())
legacy=json.loads((R/'.codex-plugin/plugin.json').read_text())
iface=p['extensions']['com.openai']['interface']
check(p['name']=='power-bi-report-builder-copilot','internal name changed')
check(p['version']=='0.2.0','wrong version')
check(iface['displayName']=='Power BI Report Copilot','display name changed')
check(iface['developerName']=='Tekris Labs' and p['author']['name']=='Tekris Labs','publisher mismatch')
check(len(iface['shortDescription'])<=30,'subtitle too long')
check(len(iface['defaultPrompt'])==3,'need exactly 3 starter prompts')
for pr in iface['defaultPrompt']:check(len(pr)<=128,'prompt too long')
for k,suffix in [('websiteURL','/'),('supportURL','/contact'),('privacyPolicyURL','/privacy'),('termsOfServiceURL','/terms')]:
    check(iface.get(k)=='https://tekrislabs.com'+suffix,k+' mismatch')
for k in ['logo','composerIcon','onboardingSkill']:
    val=iface.get(k) if k!='onboardingSkill' else p['extensions']['com.openai'][k]
    check(bool(val) and (R/val).is_file(),k+' missing '+str(val))
check(legacy['interface']['displayName']==iface['displayName'],'legacy display mismatch')
check(legacy['interface']['developerName']==iface['developerName'],'legacy developer mismatch')
check(legacy['version']==p['version'] and legacy['name']==p['name'],'legacy identity mismatch')
check(len(legacy['interface']['defaultPrompt'])==3,'legacy prompts mismatch')
skills=sorted((R/'skills').glob('*/SKILL.md'))
check(len(skills)==18,f'expected 18 skills, got {len(skills)}')
for skill in skills:
    data=skill.read_text()
    check(data.startswith('---\nname: '),f'frontmatter missing {skill}')
    check('description: ' in data and '\n---\n' in data,f'bad frontmatter {skill}')
    check('## Non-negotiable principles' in data,f'missing safeguards {skill}')
    for ref in re.findall(r'`(\.\./\.\./(?:references|templates)/[^`]+)`',data):
        check((skill.parent/ref).exists(),f'broken reference from {skill}: {ref}')
refs=list((R/'references').glob('*.md'))
original=list((R/'references/original').glob('*.md'))
check(len(refs)==17,'expected 17 new references')
check(len(original)==6,'expected 6 preserved original references')
check(len(list((R/'templates').glob('*.md')))==11,'expected 11 templates')
check((R/'archive/original-skill.md').is_file(),'missing original skill')
b=json.loads((R/'benchmarks/cases.json').read_text())
check(len(b['cases'])==32,'need 32 benchmark cases')
check(len([x for x in b['cases'] if x['category']=='negative'])>=8,'need 8 negative cases')
for case in b['cases']:
    check(case['status']=='NOT RUN','benchmark improperly marked as run')
    check(bool(case.get('prompt')) and bool(case.get('expected_behaviors')),'empty benchmark')
for n in ['README.md','CHANGELOG.md','UPGRADE_AUDIT.md','SUBMISSION.md','scripts/rdl_lint.py','tests/test_rdl_lint.py','assets/icon.svg','assets/logo.svg']:
    check((R/n).is_file(),n+' missing')
check(not (R/'mcp.json').exists(),'skills only should not include MCP config')
for path in [R/'plugin.json',R/'.codex-plugin/plugin.json']:
    s=path.read_text()
    check('Krishna Sathvik' not in s,'personal attribution in manifest')
if issues:
    print(f'FAILED: {checks-len(issues)}/{checks} checks passed')
    for issue in issues:print(' -',issue)
    sys.exit(1)
print(f'PASS: {checks} package checks')

SHA-256: 05959ee8cc04c64477dae558fa642c89c9699273bdfd05c84d4963fc5646b4f0