Files
QuantEngineByItz/tools/validate_completion_harness_instructions_v1.py
T
kjh2064 27730704ae
Snapshot Admin Web Validation / validate-snapshot-admin-smoke (push) Has been cancelled
Snapshot Admin Web Validation / validate-snapshot-admin-full (push) Has been cancelled
Quant Engine CI/CD Pipeline / validate-core (pull_request) Has been cancelled
Quant Engine CI/CD Pipeline / validate-ui-and-storage (pull_request) Has been cancelled
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (pull_request) Has been cancelled
test(validation): 토큰 위생 및 플랫폼 통합 검증 체계 고도화
2026-06-24 18:06:05 +09:00

117 lines
3.4 KiB
Python

#!/usr/bin/env python3
from __future__ import annotations
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def _read(rel: str) -> str:
path = ROOT / rel
if not path.exists():
return ""
return path.read_text(encoding="utf-8", errors="replace").lower()
def _require_any(text: str, options: list[str]) -> bool:
return any(option.lower() in text for option in options)
def _require_all(text: str, groups: list[list[str]]) -> bool:
return all(_require_any(text, group) for group in groups)
def main() -> int:
files: dict[str, list[list[str]]] = {
"AGENTS.md": [
["0b. 기본 하네스 완료 조건"],
["yaml"],
["코드"],
["데이터 실체"],
["검증 증빙"],
],
"docs/runbook.md": [
["complete only when", "완료"],
["yaml"],
["code"],
["data artifact", "data artifacts", "data/artifact"],
["validation evidence", "검증 증빙"],
],
"docs/ROADMAP_WBS.md": [
["완료 조건"],
["yaml"],
["코드"],
["데이터 실체"],
["검증 증빙"],
["wbs 작성"],
["성공판단 데이터"],
],
"REPORT_GUIDE.md": [
["completion harness"],
["yaml"],
["code"],
["data artifact", "data artifacts", "data/artifact"],
["validation evidence", "검증 증빙"],
],
"docs/doctrine.md": [
["completion harness"],
["yaml"],
["code"],
["data artifact", "data artifacts", "data/artifact"],
["validation evidence", "검증 증빙"],
],
"prompts/analysis_prompt.md": [
["default completion harness"],
["yaml"],
["코드"],
["데이터 실체"],
["검증 증빙"],
["wbs"],
["성공판단"],
],
"prompts/review_prompt.md": [
["default completion harness"],
["yaml"],
["code"],
["data artifact", "data/artifact"],
["validation evidence", "검증 증빙"],
["wbs"],
["success criteria", "성공판단"],
],
"prompts/capture_parse_prompt.md": [
["기본 완료 조건"],
["yaml"],
["코드"],
["데이터 실체"],
["검증 증빙"],
["wbs"],
["성공판단"],
],
}
missing: list[dict[str, object]] = []
for rel, groups in files.items():
text = _read(rel)
if not text:
missing.append({"file": rel, "reason": "missing_file"})
continue
if not _require_all(text, groups):
missing.append({"file": rel, "reason": "missing_required_text", "required_groups": groups})
result = {
"formula_id": "COMPLETION_HARNESS_INSTRUCTIONS_V1",
"gate": "PASS" if not missing else "FAIL",
"checked_files": len(files),
"missing": missing,
}
out = ROOT / "Temp" / "completion_harness_instructions_v1.json"
out.write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8")
print(json.dumps(result, ensure_ascii=False, indent=2))
return 0 if not missing else 1
if __name__ == "__main__":
raise SystemExit(main())