Files
computer-playbook/cli/meta/runtime/__main__.py
T
kevinveenbirkenbach d2694566e5 feat(runtime): add development runtime marker and unified runtime detection
- introduce env.development marker for local dev runtime
- add cli.meta.runtime module with library API and CLI entrypoint
- detect runtime via ACT/GitHub/marker with explicit RUNTIME override
- use env.development as docker-compose env override
- pass RUNTIME=dev into development inventory generation
- add make setup-development helper

https://chatgpt.com/share/69720fd6-a1c8-800f-b1e2-6909aa63643a
2026-01-22 12:53:42 +01:00

53 lines
1.1 KiB
Python

from __future__ import annotations
import argparse
import json
from . import detect_runtime, get_project_root
def _build_parser() -> argparse.ArgumentParser:
p = argparse.ArgumentParser(
prog="python -m cli.meta.runtime",
description="Detect and print the current Infinito runtime environment.",
)
p.add_argument(
"--print-root",
action="store_true",
help="Also print the detected project root.",
)
p.add_argument(
"--json",
action="store_true",
help="Print result as JSON object.",
)
return p
def main() -> int:
parser = _build_parser()
args = parser.parse_args()
root = get_project_root()
runtime = detect_runtime(project_root=root)
if args.json:
payload = {
"runtime": runtime,
"project_root": str(root),
}
print(json.dumps(payload, indent=2))
else:
print(runtime)
if args.print_root:
print(f"project_root={root}")
return 0
if __name__ == "__main__":
raise SystemExit(main())