This commit is contained in:
Team3
2026-07-22 16:12:23 +02:00
commit f07ef9653d
851 changed files with 501480 additions and 0 deletions

26
phase0/baue-prompt.py Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""Setzt ein Prompt-Template zusammen: <DATEI>, <QUELLE> und optional weitere
Platzhalter ersetzen.
Aufruf: baue-prompt.py <template> <projekt-wurzel> <datei-relpfad> <ausgabe> [k=v-datei ...]
Zusätzliche Platzhalter: k=pfad ersetzt <k> durch den Inhalt der Datei pfad.
"""
import sys
from pathlib import Path
def main():
template, wurzel, datei, ausgabe = sys.argv[1:5]
text = Path(template).read_text(encoding="utf-8")
quelle = (Path(wurzel) / datei).read_text(encoding="utf-8")
text = text.replace("<DATEI>", datei)
text = text.replace("<QUELLE>", "```python\n" + quelle + "```\n")
for extra in sys.argv[5:]:
k, pfad = extra.split("=", 1)
text = text.replace(f"<{k}>", Path(pfad).read_text(encoding="utf-8"))
Path(ausgabe).write_text(text, encoding="utf-8")
print(f"{ausgabe}: {len(text)} Zeichen")
if __name__ == "__main__":
main()