init: company-haness 설계
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Validate any design engine adapter against the kernel-owned output contract."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import jsonschema
|
||||
import yaml
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT = os.environ.get("CLAUDE_PROJECT_DIR") or os.path.dirname(os.path.dirname(HERE))
|
||||
SCHEMA = os.path.join(ROOT, ".claude", "schemas", "design-engine-output.artifact.schema.json")
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("path")
|
||||
args = parser.parse_args(argv)
|
||||
try:
|
||||
with open(args.path, encoding="utf-8") as handle:
|
||||
document = yaml.safe_load(handle)
|
||||
if isinstance(document, dict) and isinstance(document.get("payload"), dict):
|
||||
document = document["payload"]
|
||||
with open(SCHEMA, encoding="utf-8") as handle:
|
||||
schema = json.load(handle)
|
||||
errors = sorted(jsonschema.Draft7Validator(schema).iter_errors(document), key=lambda item: list(item.path))
|
||||
except Exception as exc:
|
||||
print(f"[design-engine] ERROR: {exc}", file=sys.stderr)
|
||||
return 2
|
||||
if errors:
|
||||
for error in errors:
|
||||
location = "/".join(str(value) for value in error.path) or "payload"
|
||||
print(f"[design-engine] ERROR {location}: {error.message}", file=sys.stderr)
|
||||
return 2
|
||||
print(f"[design-engine] OK: {document.get('engine')}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user