42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
|
|
import time
|
||
|
|
from typing import Dict, Any, List, Optional
|
||
|
|
from datetime import datetime
|
||
|
|
|
||
|
|
|
||
|
|
class ManifestBuilder:
|
||
|
|
@staticmethod
|
||
|
|
def build(
|
||
|
|
source_file: str,
|
||
|
|
source_type: str,
|
||
|
|
segments: List[Dict[str, Any]],
|
||
|
|
version: str = "1.0.0",
|
||
|
|
glyphs: Optional[List[str]] = None,
|
||
|
|
superpowers: Optional[List[str]] = None,
|
||
|
|
contributor: str = "GlyphRunner",
|
||
|
|
epoch: Optional[int] = None
|
||
|
|
) -> Dict[str, Any]:
|
||
|
|
if glyphs is None:
|
||
|
|
glyphs = []
|
||
|
|
if superpowers is None:
|
||
|
|
superpowers = []
|
||
|
|
if epoch is None:
|
||
|
|
epoch = int(time.time() * 1000)
|
||
|
|
|
||
|
|
manifest = {
|
||
|
|
"version": version,
|
||
|
|
"origin": "gx_compiler",
|
||
|
|
"timestamp": datetime.utcnow().isoformat(),
|
||
|
|
"source_file": source_file,
|
||
|
|
"source_type": source_type,
|
||
|
|
"compression_model": "gsz3",
|
||
|
|
"glyphs": glyphs,
|
||
|
|
"superpowers": superpowers,
|
||
|
|
"codex_lineage": {
|
||
|
|
"segments": segments
|
||
|
|
},
|
||
|
|
"contributor": contributor,
|
||
|
|
"epoch": epoch
|
||
|
|
}
|
||
|
|
|
||
|
|
return manifest
|