-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_lock.py
More file actions
30 lines (25 loc) · 943 Bytes
/
gen_lock.py
File metadata and controls
30 lines (25 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import hashlib
import os
import yaml
from pathlib import Path
def generate_lock():
root = Path('anchor/governance')
files = {}
for f in root.rglob('*.anchor'):
if f.is_file():
# Use forward slashes for cross-platform consistency in lockfile
rel_path = f.relative_to(root).as_posix()
content = f.read_bytes().replace(b'\r\n', b'\n')
files[rel_path] = hashlib.sha256(content).hexdigest()
lock_data = {
'version': '4.0.0',
'generated': '2026-03-23T00:00:00Z',
'algorithm': 'sha256',
'offline_behaviour': 'warn',
'files': {k: v for k, v in sorted(files.items())}
}
with open('GOVERNANCE.lock', 'w', encoding='utf-8') as f:
yaml.dump(lock_data, f, default_flow_style=False, sort_keys=False)
print(f"Generated GOVERNANCE.lock with {len(files)} files.")
if __name__ == "__main__":
generate_lock()