#!/usr/bin/env python3 """Check Code4History's local framework and three repository-level Codex skills.""" from __future__ import annotations from pathlib import Path import sys ROOT = Path(__file__).resolve().parents[1] SKILLS = ROOT / '.agents/skills' CHECKS = { 'Python 3.10+': sys.version_info >= (3,10), 'Code4History framework guide': (ROOT/'code4history.md').is_file(), 'User global override file (may be empty)': (ROOT/'USERINFO.md').is_file(), 'Editable topic with Q1-Q20': (ROOT/'topic.md').is_file() and all(f'**Q{i}.' in (ROOT/'topic.md').read_text(encoding='utf-8') for i in range(1,21)), 'Codex default entry AGENTS.md': (ROOT/'AGENTS.md').is_file(), 'No retired legacy agent.md entry': not (ROOT/'agent.md').exists() and not (ROOT/'AGENT.md').exists(), 'Main history-writing-workflow-c4h Skill': (SKILLS/'history-writing-workflow-c4h/SKILL.md').is_file(), 'Source intake Skill': (SKILLS/'source-intake-c4h/SKILL.md').is_file(), 'Discussion-to-topic Skill': (SKILLS/'discussion-to-topic-c4h/SKILL.md').is_file(), 'Main Skill nine-stage references': all((SKILLS/'history-writing-workflow-c4h/references'/n).is_file() for n in [ 'stage1-problem-literature.md', 'stage2-reading-outline.md', 'stage3-draft-finalize.md', 'evaluation-rubrics.md', 'repository-map.md', 'provenance-and-audit.md']), 'User guide for conversation import': (ROOT/'DISCUSSION_TO_TOPIC.md').is_file(), 'Human Agent exchange protocol': (ROOT/'INTERACTION.md').is_file(), 'Upload inbox with instructions': (ROOT/'upload/readme.md').is_file(), 'Requests inbox with archive': (ROOT/'requests/readme.md').is_file() and (ROOT/'requests/archive/readme.md').is_file(), 'TODO workspace with archive': (ROOT/'todo/readme.md').is_file() and (ROOT/'todo/archive/readme.md').is_file(), 'Handoff workspace': (ROOT/'handoff/readme.md').is_file() and (ROOT/'handoff/latest.md').is_file(), 'Interaction CLI': (ROOT/'tools/interaction.py').is_file(), 'Human checkpoints': (ROOT/'00_governance/checkpoints.md').is_file(), 'Primary source records': (ROOT/'01_sources/records/primary').is_dir(), 'Evidence records': (ROOT/'02_evidence').is_dir(), 'Card creation CLI': (ROOT/'tools/new_item.py').is_file(), } for description, good in CHECKS.items(): print(('OK ' if good else 'FAIL ') + description) print('All Skills are local to this repository; no download or global install is necessary.') print('Doctor only checks framework readiness, not provenance or historical accuracy.') if not all(CHECKS.values()): raise SystemExit(1)