INNER CODE UNIT · Python

cmd_doctor

kangarooking/cangjie-skill · scripts/cangjie.py:45

def cmd_doctor(_args) -> int:
    ok = True
    print(f"{TOOL_VERSION}\npython: {sys.version.split()[0]}")
    for mod, required in (("yaml", True), ("tiktoken", False), ("jsonschema", False)):
        try:
            __import__(mod)
            print(f"  [ok] {mod}")
        except ImportError:
            level = "缺失(必需)" if required else "缺失(可选)"
            print(f"  [{'FAIL' if required else 'warn'}] {mod} {level}")
            ok = ok and not required
    for rel in ("capability-bundle.schema.json", "registry-entry.schema.json", "contracts/source-document.schema.json"):
        p = SCRIPTS.parent / "schemas" / rel
        print(f"  [{'ok' if p.exists() else 'FAIL'}] schemas/{rel}")
        ok = ok and p.exists()
    print("doctor:", "PASS" if ok else "FAIL")
    return 0 if ok else 1

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…