This commit is contained in:
2026-01-19 21:25:44 -08:00
parent 37e2ff6651
commit fcab85455d
13 changed files with 820 additions and 393 deletions

26
CLI.py
View File

@@ -7,6 +7,28 @@ This module intentionally uses a class-based architecture:
- all REPL/pipeline/cmdlet execution state lives on objects
"""
# When running the CLI directly (not via the 'mm' launcher), honor the
# repository config `debug` flag by enabling `MM_DEBUG` so import-time
# diagnostics and bootstrap debug output are visible without setting the
# environment variable manually.
import os
from pathlib import Path
if not os.environ.get("MM_DEBUG"):
try:
conf_path = Path(__file__).resolve().parent / "config.conf"
if conf_path.exists():
for ln in conf_path.read_text(encoding="utf-8").splitlines():
ln_strip = ln.strip()
if ln_strip.startswith("debug"):
parts = ln_strip.split("=", 1)
if len(parts) >= 2:
val = parts[1].strip().strip('"').strip("'").strip().lower()
if val in ("1", "true", "yes", "on"):
os.environ["MM_DEBUG"] = "1"
break
except Exception:
pass
import json
import re
import shlex
@@ -1325,7 +1347,7 @@ class CmdletExecutor:
console = Console()
class MedeiaCLI:
class CLI:
"""Main CLI application object."""
ROOT = Path(__file__).resolve().parent
@@ -2469,4 +2491,4 @@ Come to love it when others take what you share, as there is no greater joy
if __name__ == "__main__":
MedeiaCLI().run()
CLI().run()