Initial release: aircontext

This commit is contained in:
admin
2026-05-18 11:45:08 +08:00
commit 5914cfb9cd
32 changed files with 1981 additions and 0 deletions

38
scripts/cmd_pause.py Normal file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""Backend for /aircontext-pause [on|off]."""
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.state import StateFile # noqa: E402
def main() -> int:
project = Path(os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd()))
air = project / "AirContext"
if not air.exists():
print("AirContext not initialised. Run /aircontext-init first.")
return 1
state = StateFile(air / "state.json")
arg = (sys.argv[1].lower() if len(sys.argv) > 1 else "").strip()
cur = bool(state.read().get("paused"))
if arg in ("on", "pause", "true", "1"):
new = True
elif arg in ("off", "resume", "false", "0"):
new = False
else:
new = not cur # toggle
state.update(paused=new)
print(f"AirContext automatic compaction: {'PAUSED' if new else 'ACTIVE'}")
return 0
if __name__ == "__main__":
sys.exit(main())