Files
Jarvis-Ai/scripts/verify_structure.py

62 lines
1.6 KiB
Python

"""Verify the dependency-free phase-0 repository structure."""
from __future__ import annotations
import sys
import tomllib
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
REQUIRED = (
"README.md",
"AGENTS.md",
"CHANGELOG.md",
"PLANS.md",
"pyproject.toml",
".gitignore",
".gitattributes",
"config/javis.example.toml",
"docs/ARCHITECTURE.md",
"docs/ENVIRONMENT_VERIFICATION.md",
"docs/SECURITY.md",
"docs/THREAT_MODEL.md",
"docs/PROJECT_STATUS.md",
"docs/NEXT_SESSION.md",
"docs/CHATGPT_HANDOFF.md",
"src/javis/__init__.py",
"interface/living-mind/STATUS.md",
)
def main() -> int:
missing = [relative for relative in REQUIRED if not (ROOT / relative).is_file()]
if missing:
print("Missing required files:")
for relative in missing:
print(f"- {relative}")
return 1
with (ROOT / "pyproject.toml").open("rb") as handle:
project = tomllib.load(handle)["project"]
if project["name"] != "javis-ai":
print("Unexpected project name in pyproject.toml")
return 1
forbidden = [
path
for path in ROOT.rglob("*")
if path.is_file() and path.name.lower() in {"key-pw.xml", "secrets.local.xml", ".env"}
]
if forbidden:
print("Forbidden local secret files are present:")
for path in forbidden:
print(f"- {path.relative_to(ROOT)}")
return 1
print(f"Structure verified: {len(REQUIRED)} required files present.")
return 0
if __name__ == "__main__":
sys.exit(main())