← Files SQL CopilotARCHIVED FILE

scripts/validate_package.py

3.5 KB · Nov 7, 2026 · 12:46 UTC

↓ Download file

See the change to this file →

#!/usr/bin/env python3
"""Validate local plugin file graph and submission metadata (not execution)."""
import json,re,sys
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
checks=0

def check(cond,msg):
    global checks
    checks+=1
    if not cond: raise AssertionError(msg)

m=json.loads((ROOT/'plugin.json').read_text())
interface=m['extensions']['com.openai']['interface']
check(m['name']=='sql-copilot','identity changed')
check(m['version']=='0.2.0','version mismatch')
check(m['author']['name']=='Tekris Labs','wrong publisher')
check(interface['developerName']=='Tekris Labs','wrong developer')
check(interface['displayName']=='SQL Copilot','wrong display name')
check(len(interface['defaultPrompt'])==3,'starter prompt count must be 3')
check(len(interface['shortDescription'])<30,'subtitle must be <30 characters')
check('mcpServers' not in m and not (ROOT/'mcp.json').exists(),'unexpected MCP server config')
check(m['skills']=='./skills','invalid skills directory')
for field in ['websiteURL','supportURL','privacyPolicyURL','termsOfServiceURL']:
    check(interface[field].startswith('https://tekrislabs.com/'),f'missing {field}')
for field in ['logo','composerIcon']:
    check((ROOT/interface[field]).is_file(),f'missing {field}')
check((ROOT/'skills/get-started/SKILL.md').exists(),'onboarding skill missing')

slugs=set()
for skill in (ROOT/'skills').iterdir():
    if not skill.is_dir(): continue
    p=skill/'SKILL.md';check(p.is_file(),f'{skill}: no SKILL.md')
    txt=p.read_text()
    match=re.search(r'^---\s*\nname:\s*(\S+)\s*\ndescription:\s*(.+?)\n---',txt,re.M|re.S)
    check(match is not None,f'{p}: bad frontmatter')
    check(match.group(1)==skill.name,f'{p}: wrong skill name')
    check('## Workflow' in txt,f'{p}: no workflow')
    check('## Evidence and execution' in txt,f'{p}: no execution honesty')
    check(len(txt)>750,f'{p}: suspiciously short')
    for rel in re.findall(r'`(\.\./\.\./references/[^`]+)`',txt):
        check((skill/rel).is_file(),f'{p}: broken reference {rel}')
    slugs.add(skill.name)
check(len(slugs)==19,'unexpected number of focused skills')
refs=list((ROOT/'references').glob('*.md'))
check(len(refs)>=19,'missing new references')
orig=list((ROOT/'references/original').glob('*.md'))
check(len(orig)==6,'original references not preserved')
check((ROOT/'archive/original-sql-copilot-SKILL.md').exists(),'original skill missing')
legacy=json.loads((ROOT/'.codex-plugin/plugin.json').read_text())
check(legacy['name']==m['name'] and legacy['version']==m['version'],'legacy mismatch')
check(legacy['interface']['displayName']==interface['displayName'],'legacy display mismatch')
check(legacy['interface']['developerName']=='Tekris Labs','legacy author mismatch')
check(len(legacy['interface']['defaultPrompt'])==3,'legacy prompts mismatch')
bench=json.loads((ROOT/'benchmarks/cases.json').read_text())
check(bench['run_status']=='not_run','benchmark run status invented')
check(len(bench['cases'])>=30,'too few benchmark scenarios')
check(len({c['id'] for c in bench['cases']})==len(bench['cases']),'duplicate benchmark ids')
check(sum(bool(c['negative']) for c in bench['cases'])>=8,'not enough negative benchmarks')
for case in bench['cases']:
    check(case['category'] in slugs,f'benchmark skill not found {case["category"]}')
    check(bool(case['expected']) and bool(case['prompt']),'incomplete benchmark')
for p in list((ROOT/'templates').glob('*.md'))+refs:
    check(len(p.read_text())>100,f'{p} too short')
print(f'PASS: {checks} structural, content, metadata and cross-reference checks')

SHA-256: 1840ba72b001c4d8873c5a311debf3abafca333e2d0e3be491d8bf6701704487