49 lines
1.7 KiB
Python
Executable File
49 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
DEFAULT_POC_ROOT = os.environ.get("SOC_MEMORY_POC_ROOT", "/home/tom/soc_memory_poc")
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Generate an Obsidian case note from a normalized SOC case JSON file.")
|
|
parser.add_argument("--input", required=True, help="Normalized case JSON path")
|
|
parser.add_argument("--output-dir", default=None, help="Override Obsidian output directory")
|
|
parser.add_argument("--enrich-from-openviking", action="store_true", help="Enrich with OpenViking recommendations")
|
|
parser.add_argument("--top-k", type=int, default=3, help="Recommendation count per type")
|
|
parser.add_argument("--poc-root", default=DEFAULT_POC_ROOT, help="SOC Memory POC root")
|
|
args = parser.parse_args()
|
|
|
|
poc_root = Path(args.poc_root)
|
|
script_path = poc_root / "skills" / "summarize_case_skill" / "generate_case_note.py"
|
|
if not script_path.exists():
|
|
raise SystemExit(f"SOC Memory POC summarize script not found: {script_path}")
|
|
|
|
output_dir = args.output_dir or str(poc_root / "obsidian-vault" / "02_Cases")
|
|
cmd = [
|
|
sys.executable,
|
|
str(script_path),
|
|
"--input",
|
|
args.input,
|
|
"--output-dir",
|
|
output_dir,
|
|
"--top-k",
|
|
str(args.top_k),
|
|
]
|
|
if args.enrich_from_openviking:
|
|
cmd.append("--enrich-from-openviking")
|
|
|
|
env = os.environ.copy()
|
|
existing = env.get("PYTHONPATH", "")
|
|
env["PYTHONPATH"] = str(poc_root) + (os.pathsep + existing if existing else "")
|
|
subprocess.run(cmd, check=True, env=env)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|