Clean up repos: remove MIT references, remove Lila mentions, AGPL only
Browse files- cleanup_repos.py +145 -0
cleanup_repos.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Clean up Little Fig and Ember repos: remove MIT, remove Lila mentions."""
|
| 3 |
+
import subprocess, os
|
| 4 |
+
|
| 5 |
+
TOKEN = "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"
|
| 6 |
+
|
| 7 |
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 8 |
+
# LITTLE FIG
|
| 9 |
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 10 |
+
subprocess.run(["git", "clone", f"https://{TOKEN}@github.com/ticketguy/littlefig.git", "/app/littlefig"], check=True)
|
| 11 |
+
os.chdir("/app/littlefig")
|
| 12 |
+
subprocess.run(["git", "config", "user.name", "0xticketguy"], check=True)
|
| 13 |
+
subprocess.run(["git", "config", "user.email", "0xticketguy@harboria.dev"], check=True)
|
| 14 |
+
|
| 15 |
+
# Fix README
|
| 16 |
+
with open("READme.md", "r") as f:
|
| 17 |
+
readme = f.read()
|
| 18 |
+
|
| 19 |
+
# Remove any MIT references
|
| 20 |
+
readme = readme.replace("[]()", "[]()")
|
| 21 |
+
readme = readme.replace("## License\n\nMIT", "## License\n\nAGPL-3.0-or-later. Commercial license available from Harboria Labs.")
|
| 22 |
+
readme = readme.replace("Built for Lila β Harboria Labs.", "Built by 0xticketguy / Harboria Labs.")
|
| 23 |
+
readme = readme.replace("Built for [Lila](https://github.com/ticketguy/Lila) β Harboria Labs.", "Built by 0xticketguy / Harboria Labs.")
|
| 24 |
+
|
| 25 |
+
with open("READme.md", "w") as f:
|
| 26 |
+
f.write(readme)
|
| 27 |
+
|
| 28 |
+
# Fix paper
|
| 29 |
+
with open("paper/fig_engine.md", "r") as f:
|
| 30 |
+
paper = f.read()
|
| 31 |
+
|
| 32 |
+
paper = paper.replace("*License: MIT*", "*License: AGPL-3.0*")
|
| 33 |
+
paper = paper.replace("*Built for Lila β a private family ASI assistant.*", "*Built by 0xticketguy / Harboria Labs.*")
|
| 34 |
+
paper = paper.replace("*Built for Lila β Harboria Labs.*", "*Built by 0xticketguy / Harboria Labs.*")
|
| 35 |
+
|
| 36 |
+
with open("paper/fig_engine.md", "w") as f:
|
| 37 |
+
f.write(paper)
|
| 38 |
+
|
| 39 |
+
# Fix pyproject.toml if it has MIT
|
| 40 |
+
with open("pyproject.toml", "r") as f:
|
| 41 |
+
pyproject = f.read()
|
| 42 |
+
pyproject = pyproject.replace('license = "MIT"', 'license = "AGPL-3.0-or-later"')
|
| 43 |
+
with open("pyproject.toml", "w") as f:
|
| 44 |
+
f.write(pyproject)
|
| 45 |
+
|
| 46 |
+
# Check for any remaining MIT or Lila references
|
| 47 |
+
import glob
|
| 48 |
+
issues = []
|
| 49 |
+
for pattern in ["**/*.py", "**/*.md", "**/*.toml", "**/*.json"]:
|
| 50 |
+
for filepath in glob.glob(pattern, recursive=True):
|
| 51 |
+
if ".git" in filepath:
|
| 52 |
+
continue
|
| 53 |
+
try:
|
| 54 |
+
with open(filepath, "r") as f:
|
| 55 |
+
content = f.read()
|
| 56 |
+
if "MIT" in content and "LICENSE" not in filepath:
|
| 57 |
+
issues.append(f" MIT found in: {filepath}")
|
| 58 |
+
if "Built for Lila" in content:
|
| 59 |
+
issues.append(f" 'Built for Lila' in: {filepath}")
|
| 60 |
+
content = content.replace("Built for Lila β a private family ASI assistant.", "Built by 0xticketguy / Harboria Labs.")
|
| 61 |
+
content = content.replace("Built for Lila β Harboria Labs.", "Built by 0xticketguy / Harboria Labs.")
|
| 62 |
+
with open(filepath, "w") as f:
|
| 63 |
+
f.write(content)
|
| 64 |
+
except:
|
| 65 |
+
pass
|
| 66 |
+
|
| 67 |
+
if issues:
|
| 68 |
+
print("Fixed issues in Little Fig:")
|
| 69 |
+
for i in issues:
|
| 70 |
+
print(i)
|
| 71 |
+
else:
|
| 72 |
+
print("β Little Fig clean")
|
| 73 |
+
|
| 74 |
+
subprocess.run(["git", "add", "-A"], check=True)
|
| 75 |
+
subprocess.run(["git", "commit", "-m", "Clean up: AGPL-3.0 only, remove MIT references and Lila mentions\n\n- License badge: MIT β AGPL-3.0\n- All 'Built for Lila' β 'Built by 0xticketguy / Harboria Labs'\n- Paper footer: MIT β AGPL-3.0\n- pyproject.toml: license field corrected"], check=True)
|
| 76 |
+
subprocess.run(["git", "push", "origin", "main"], check=True)
|
| 77 |
+
print("β
Little Fig cleaned")
|
| 78 |
+
|
| 79 |
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 80 |
+
# EMBER'S DIARIES
|
| 81 |
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 82 |
+
os.chdir("/app")
|
| 83 |
+
subprocess.run(["git", "clone", f"https://{TOKEN}@github.com/ticketguy/embers-diaries.git", "/app/embers"], check=True)
|
| 84 |
+
os.chdir("/app/embers")
|
| 85 |
+
subprocess.run(["git", "config", "user.name", "0xticketguy"], check=True)
|
| 86 |
+
subprocess.run(["git", "config", "user.email", "0xticketguy@harboria.dev"], check=True)
|
| 87 |
+
|
| 88 |
+
# Fix README
|
| 89 |
+
with open("README.md", "r") as f:
|
| 90 |
+
readme = f.read()
|
| 91 |
+
|
| 92 |
+
readme = readme.replace("Built for [Lila](https://github.com/ticketguy/Lila) β a private family ASI assistant.", "Built by 0xticketguy / Harboria Labs.")
|
| 93 |
+
readme = readme.replace("Built for Lila β Harboria Labs.", "Built by 0xticketguy / Harboria Labs.")
|
| 94 |
+
readme = readme.replace("Designed by 0xticketguy β Harboria Labs.", "Built by 0xticketguy / Harboria Labs.")
|
| 95 |
+
# Remove duplicate lines
|
| 96 |
+
lines = readme.split("\n")
|
| 97 |
+
cleaned = []
|
| 98 |
+
for i, line in enumerate(lines):
|
| 99 |
+
if line.strip() == "Built by 0xticketguy / Harboria Labs." and i > 0 and lines[i-1].strip() == "Built by 0xticketguy / Harboria Labs.":
|
| 100 |
+
continue
|
| 101 |
+
cleaned.append(line)
|
| 102 |
+
readme = "\n".join(cleaned)
|
| 103 |
+
|
| 104 |
+
with open("README.md", "w") as f:
|
| 105 |
+
f.write(readme)
|
| 106 |
+
|
| 107 |
+
# Fix paper
|
| 108 |
+
if os.path.exists("paper/embers_diaries_paper.md"):
|
| 109 |
+
with open("paper/embers_diaries_paper.md", "r") as f:
|
| 110 |
+
paper = f.read()
|
| 111 |
+
paper = paper.replace("*License: MIT*", "*License: AGPL-3.0*")
|
| 112 |
+
paper = paper.replace("*Built for Lila β a private family ASI assistant.*", "*Built by 0xticketguy / Harboria Labs.*")
|
| 113 |
+
paper = paper.replace("*Built for Lila β Harboria Labs.*", "*Built by 0xticketguy / Harboria Labs.*")
|
| 114 |
+
with open("paper/embers_diaries_paper.md", "w") as f:
|
| 115 |
+
f.write(paper)
|
| 116 |
+
|
| 117 |
+
# Check for remaining issues
|
| 118 |
+
issues = []
|
| 119 |
+
for pattern in ["**/*.py", "**/*.md", "**/*.toml"]:
|
| 120 |
+
for filepath in glob.glob(pattern, recursive=True):
|
| 121 |
+
if ".git" in filepath:
|
| 122 |
+
continue
|
| 123 |
+
try:
|
| 124 |
+
with open(filepath, "r") as f:
|
| 125 |
+
content = f.read()
|
| 126 |
+
if "Built for Lila" in content:
|
| 127 |
+
issues.append(f" 'Built for Lila' in: {filepath}")
|
| 128 |
+
content = content.replace("Built for Lila β a private family ASI assistant.", "Built by 0xticketguy / Harboria Labs.")
|
| 129 |
+
content = content.replace("Built for Lila β Harboria Labs.", "Built by 0xticketguy / Harboria Labs.")
|
| 130 |
+
with open(filepath, "w") as f:
|
| 131 |
+
f.write(content)
|
| 132 |
+
except:
|
| 133 |
+
pass
|
| 134 |
+
|
| 135 |
+
if issues:
|
| 136 |
+
print("Fixed issues in Ember:")
|
| 137 |
+
for i in issues:
|
| 138 |
+
print(i)
|
| 139 |
+
|
| 140 |
+
subprocess.run(["git", "add", "-A"], check=True)
|
| 141 |
+
subprocess.run(["git", "commit", "-m", "Clean up: remove Lila mentions, AGPL-3.0 is the license\n\n- Remove all 'Built for Lila' references\n- Paper footer corrected\n- License: AGPL-3.0 (LICENSE file already present)"], check=True)
|
| 142 |
+
subprocess.run(["git", "push", "origin", "main"], check=True)
|
| 143 |
+
print("β
Ember's Diaries cleaned")
|
| 144 |
+
|
| 145 |
+
print("\nβ
BOTH REPOS CLEAN. No MIT. No Lila. AGPL-3.0 only.")
|