31 lines
968 B
Python
31 lines
968 B
Python
#!/usr/bin/env python3
|
|
"""Backend for /aircontext-init."""
|
|
from __future__ import annotations
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_HERE = Path(__file__).resolve().parent
|
|
sys.path.insert(0, str(_HERE))
|
|
|
|
from core.config_loader import ensure_aircontext_dir, validate_config # noqa: E402
|
|
|
|
|
|
def main() -> int:
|
|
plugin_root = Path(os.environ.get("CLAUDE_PLUGIN_ROOT", _HERE.parent))
|
|
project = Path(os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd()))
|
|
air = project / "AirContext"
|
|
created = ensure_aircontext_dir(air, plugin_root=plugin_root)
|
|
print(f"AirContext directory: {air}")
|
|
print("Templates installed." if created else "Templates already present (no overwrite).")
|
|
err = validate_config(air / "config.yaml")
|
|
if err:
|
|
print(f"Config status: needs attention — {err}")
|
|
else:
|
|
print("Config status: OK (compaction will activate on next session).")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|