asw_component/__init__.py +3−0 View file@@ -0,0 +1,3 @@
1 +
from .component import execute 2 +
3 +
__all__ = ["execute"][참조 MVP] A-SW 공유·협업 서비스 플랫폼 — 컴포넌트 릴리스의 제출·검증·승인·공개 생명주기를 집행하는 플랫폼 코어입니다.
https://git.agrithing.ai/via/asw-service-platform.git ab9e3ed 91dc795 f1bc631 0033c98 edea914 72991ee 0dbe22f 72991eeee0038a8967d7bba535a6400ecbfe4f68 asw_component/__init__.py +3−0 View filefrom .component import execute__all__ = ["execute"]asw_component/component.py +18−0 View filefrom __future__ import annotationsTRANSITIONS = { ("DRAFT", "submit", "component_owner"): "SUBMITTED", ("SUBMITTED", "verify", "validator"): "VERIFIED", ("VERIFIED", "approve", "integration_approver"): "APPROVED", ("APPROVED", "publish", "release_manager"): "PUBLISHED",}def execute(payload: dict) -> dict: current = str(payload["current_state"]).upper() action, role = payload["action"], payload["actor_role"] if action in {"verify", "approve", "publish"} and int(payload.get("evidence_count", 0)) < 1: return {"accepted": False, "state": current, "reason": "evidence_required"} target = TRANSITIONS.get((current, action, role)) if not target: return {"accepted": False, "state": current, "reason": "transition_not_allowed"} return {"accepted": True, "previous_state": current, "state": target, "audit_event": f"{current}:{action}:{role}:{target}"}examples/input.json +6−0 View file{ "current_state": "VERIFIED", "action": "approve", "actor_role": "integration_approver", "evidence_count": 4}pyproject.toml +8−0 View file[project]name = "asw_service_platform"version = "0.1.0"description = "컴포넌트 릴리스의 제출·검증·승인·공개 생명주기를 집행하는 플랫폼 코어입니다."requires-python = ">=3.11"[tool.unittest]test-path = "tests"run.py +10−0 View filefrom __future__ import annotationsimport jsonimport sysfrom asw_component import executeif __name__ == "__main__": path = sys.argv[1] if len(sys.argv) > 1 else None with open(path, encoding="utf-8") if path else sys.stdin as source: payload = json.load(source) print(json.dumps(execute(payload), ensure_ascii=False, indent=2))