123 lines
4.5 KiB
Python
123 lines
4.5 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
"""Extract Blitzkrieg plan from transcript .md and write consolidated BLITZKRIEG doc."""
|
|||
|
|
import json
|
|||
|
|
import re
|
|||
|
|
import sys
|
|||
|
|
|
|||
|
|
SRC = "2026-2-13 15-18-51-Blitzkrieg_Super_Pro_Max_Plan.md"
|
|||
|
|
DEST = "docs/00-meta/BLITZKRIEG_SUPER_PRO_MAX_MASTER_PLAN.md"
|
|||
|
|
|
|||
|
|
# Path fix: canonical tokens from plan's reference to repo path
|
|||
|
|
CANONICAL_OLD = "../../token-lists/src/canonical-tokens.ts"
|
|||
|
|
CANONICAL_NEW = "../../smom-dbis-138/services/token-aggregation/src/config/canonical-tokens.ts"
|
|||
|
|
|
|||
|
|
|
|||
|
|
def extract_json_from_line(line: str):
|
|||
|
|
"""Parse first JSON object from line and return (content or replacement, kind)."""
|
|||
|
|
line = line.strip()
|
|||
|
|
if not line.startswith("{"):
|
|||
|
|
return None, None
|
|||
|
|
# Find matching brace (simple: first { then find last })
|
|||
|
|
depth = 0
|
|||
|
|
end = -1
|
|||
|
|
for i, c in enumerate(line):
|
|||
|
|
if c == "{":
|
|||
|
|
depth += 1
|
|||
|
|
elif c == "}":
|
|||
|
|
depth -= 1
|
|||
|
|
if depth == 0:
|
|||
|
|
end = i
|
|||
|
|
break
|
|||
|
|
if end == -1:
|
|||
|
|
return None, None
|
|||
|
|
try:
|
|||
|
|
obj = json.loads(line[: end + 1])
|
|||
|
|
except json.JSONDecodeError:
|
|||
|
|
return None, None
|
|||
|
|
if "content" in obj:
|
|||
|
|
return obj["content"], "content"
|
|||
|
|
if "updates" in obj and obj["updates"]:
|
|||
|
|
rep = obj["updates"][0].get("replacement")
|
|||
|
|
return rep, "replacement"
|
|||
|
|
return None, None
|
|||
|
|
|
|||
|
|
|
|||
|
|
def main():
|
|||
|
|
with open(SRC, "r", encoding="utf-8") as f:
|
|||
|
|
lines = f.readlines()
|
|||
|
|
|
|||
|
|
parts = []
|
|||
|
|
for line in lines:
|
|||
|
|
content, kind = extract_json_from_line(line)
|
|||
|
|
if content is None:
|
|||
|
|
continue
|
|||
|
|
if kind == "content":
|
|||
|
|
# First message: base is "Super Pro" not "Ultra Uber Max Pro"; skip, we want the replacement from "Ultra Uber Max Pro"
|
|||
|
|
if "Ultra Uber Max Pro" in content or "Super Pro Max" in content:
|
|||
|
|
if "Ultra Uber Max Pro" in content and "Supreme Command" not in content and "Absolute Air Superiority" not in content:
|
|||
|
|
parts.append(("base", content))
|
|||
|
|
continue
|
|||
|
|
if kind == "replacement":
|
|||
|
|
if content.startswith("# Blitzkrieg Ultra Uber Max Pro Master Plan") and "8. Supreme Command" not in content:
|
|||
|
|
parts.append(("base", content))
|
|||
|
|
elif content.startswith("# 8. Supreme Command Tier"):
|
|||
|
|
parts.append(("s8_9", content))
|
|||
|
|
elif "Zero Drift Doctrine." in content and "# 10. Absolute Air Superiority" in content:
|
|||
|
|
parts.append(("s10_11", content))
|
|||
|
|
|
|||
|
|
# Build ordered: base, then 8+9, then 10+11 (strip leading "Zero Drift Doctrine.\n\n" from 10+11 to avoid duplicate)
|
|||
|
|
base = s8_9 = s10_11 = None
|
|||
|
|
for tag, text in parts:
|
|||
|
|
if tag == "base":
|
|||
|
|
base = text
|
|||
|
|
elif tag == "s8_9":
|
|||
|
|
s8_9 = text
|
|||
|
|
elif tag == "s10_11":
|
|||
|
|
s10_11 = text
|
|||
|
|
|
|||
|
|
if not base:
|
|||
|
|
# Fallback: get from "updates" replacement that is the full Ultra Uber Max Pro (line with pattern ".*")
|
|||
|
|
for line in lines:
|
|||
|
|
if '"updates":[{"pattern":".*"' in line and '"replacement":"# Blitzkrieg Ultra Uber Max Pro' in line:
|
|||
|
|
content, _ = extract_json_from_line(line)
|
|||
|
|
if content and "8. Supreme Command" not in content:
|
|||
|
|
base = content
|
|||
|
|
break
|
|||
|
|
if not s8_9:
|
|||
|
|
for line in lines:
|
|||
|
|
if "# 8. Supreme Command Tier" in line:
|
|||
|
|
content, _ = extract_json_from_line(line)
|
|||
|
|
if content:
|
|||
|
|
s8_9 = content
|
|||
|
|
break
|
|||
|
|
if not s10_11:
|
|||
|
|
for line in lines:
|
|||
|
|
if "# 10. Absolute Air Superiority" in line:
|
|||
|
|
content, _ = extract_json_from_line(line)
|
|||
|
|
if content:
|
|||
|
|
s10_11 = content
|
|||
|
|
break
|
|||
|
|
|
|||
|
|
if not base or not s8_9 or not s10_11:
|
|||
|
|
print("Missing parts:", "base" if not base else "", "s8_9" if not s8_9 else "", "s10_11" if not s10_11 else "", file=sys.stderr)
|
|||
|
|
sys.exit(1)
|
|||
|
|
|
|||
|
|
# Avoid duplicating "Zero Drift Doctrine." between section 9 and 10
|
|||
|
|
if s10_11.startswith("Zero Drift Doctrine.\n\n"):
|
|||
|
|
s10_11 = s10_11[len("Zero Drift Doctrine.\n\n") :]
|
|||
|
|
|
|||
|
|
full = base.rstrip() + "\n\n" + s8_9.rstrip() + "\n\n" + s10_11
|
|||
|
|
|
|||
|
|
# Path fix
|
|||
|
|
full = full.replace(CANONICAL_OLD, CANONICAL_NEW)
|
|||
|
|
|
|||
|
|
header = "<!-- Last Updated: 2026-02-13. Status: Consolidated Ultra Uber Max Pro through Absolute Air Superiority (Sections 1–11). -->\n\n"
|
|||
|
|
with open(DEST, "w", encoding="utf-8") as f:
|
|||
|
|
f.write(header + full)
|
|||
|
|
|
|||
|
|
print("Wrote", DEST, "(%d chars)" % len(full))
|
|||
|
|
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
main()
|