diff --git a/canticle.py b/canticle.py new file mode 100644 index 0000000..e9d17e7 --- /dev/null +++ b/canticle.py @@ -0,0 +1,25 @@ +import json +import hashlib + +class CanticlePolicy: + def __init__(self, name, scopes): + self.name = name + self.scopes = scopes # list of strings like "network:egress:allow" + + def to_json(self): + return json.dumps({"name": self.name, "scopes": self.scopes}, sort_keys=True) + + def fingerprint(self): + return hashlib.sha256(self.to_json().encode()).hexdigest() + + def generate_poem(self): + # A simple poetic summary generator for the policy + lines = [f"The canticle of {self.name} resonates:"] + for scope in self.scopes: + lines.append(f" Enshrined: {scope}") + lines.append(f"Witnessed at {self.fingerprint()[:8]}") + return "\n".join(lines) + +if __name__ == "__main__": + p = CanticlePolicy("MastermanGate", ["network:egress:allow", "filesystem:read:restricted"]) + print(p.generate_poem()) diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..5f853c8 --- /dev/null +++ b/test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python3 canticle.py | grep -q "Enshrined: network:egress:allow" && echo "Tests Passed" || (echo "Tests Failed" && exit 1)