- 프로젝트 AGENTS 지침에 커밋 후 푸시 확인 규칙과 런타임 콘텐츠 에이전트 규칙을 보강 - 보스 설계 플레이북과 멀티플레이 보스 설계 철학 문서를 추가해 사람용 설계 기준을 정리 - Codex-Tools 디렉터리에 Markdown→YAML→검증 파이프라인 스크립트와 프롬프트, 스키마, 설정 파일을 추가
92 lines
2.6 KiB
Python
Executable File
92 lines
2.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Run the full Markdown -> YAML -> Validation pipeline.
|
|
|
|
Canonical config keys used everywhere:
|
|
- design_root
|
|
- game_project_root
|
|
- schema_path
|
|
- runtime_boss_output_dir
|
|
- validation_report_suffix
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
from typing import Any, Dict
|
|
|
|
import yaml
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
|
|
REQUIRED_CONFIG_KEYS = [
|
|
"design_root",
|
|
"game_project_root",
|
|
"schema_path",
|
|
"runtime_boss_output_dir",
|
|
"validation_report_suffix",
|
|
]
|
|
|
|
|
|
def load_config(path: str) -> Dict[str, Any]:
|
|
with open(path, "r", encoding="utf-8") as file:
|
|
data = yaml.safe_load(file) or {}
|
|
missing = [key for key in REQUIRED_CONFIG_KEYS if key not in data]
|
|
if missing:
|
|
raise SystemExit(f"Missing config keys in {path}: {', '.join(missing)}")
|
|
return data
|
|
|
|
|
|
def infer_boss_id(md_path: str) -> str:
|
|
stem = Path(md_path).stem
|
|
stem = stem.replace(" 기획", "").replace("_기획", "")
|
|
stem = stem.strip()
|
|
return stem.lower().replace(" ", "_")
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Run boss pipeline")
|
|
parser.add_argument("--md", required=True, help="Path to boss Markdown document")
|
|
parser.add_argument("--config", required=True, help="Path to paths.yaml config")
|
|
parser.add_argument("--boss-id", default=None, help="Optional runtime boss_id / yaml filename override")
|
|
args = parser.parse_args()
|
|
|
|
config = load_config(args.config)
|
|
md_path = os.path.abspath(args.md)
|
|
if not os.path.exists(md_path):
|
|
raise SystemExit(f"Markdown file not found: {md_path}")
|
|
|
|
boss_id = args.boss_id or infer_boss_id(md_path)
|
|
yaml_output = os.path.join(config["runtime_boss_output_dir"], f"{boss_id}.yaml")
|
|
report_output = os.path.join(
|
|
os.path.dirname(md_path),
|
|
f"{boss_id}{config['validation_report_suffix']}",
|
|
)
|
|
|
|
schema_path = config["schema_path"]
|
|
if not os.path.exists(schema_path):
|
|
print(f"Warning: schema_path does not exist yet: {schema_path}")
|
|
|
|
gen_script = str(HERE / "generate_boss_yaml.py")
|
|
val_script = str(HERE / "validate_boss_yaml.py")
|
|
|
|
subprocess.run(
|
|
[sys.executable, gen_script, "--md", md_path, "--output", yaml_output, "--boss-id", boss_id],
|
|
check=True,
|
|
)
|
|
subprocess.run(
|
|
[sys.executable, val_script, "--yaml", yaml_output, "--output", report_output],
|
|
check=True,
|
|
)
|
|
|
|
print("Pipeline complete")
|
|
print(f"Markdown: {md_path}")
|
|
print(f"YAML: {yaml_output}")
|
|
print(f"Report: {report_output}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|