diff --git a/scripts/validate.py b/scripts/validate.py index c73d748..9b8de9f 100755 --- a/scripts/validate.py +++ b/scripts/validate.py @@ -246,7 +246,12 @@ Beispiele: for template_path in sorted(templates): is_valid, errors = validate_template(template_path) - rel_path = str(template_path.relative_to(base_dir)) + # Make path relative to base_dir, handling both absolute and relative paths + try: + rel_path = str(template_path.relative_to(base_dir)) + except ValueError: + # If template_path is not under base_dir, use absolute path + rel_path = str(template_path) if is_valid: print(f"✅ {rel_path}") diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..48ef1f6 --- /dev/null +++ b/web/index.html @@ -0,0 +1,478 @@ + + + + + + Prompt Templates + + + +
+

Prompt Templates

+ Git Managed +
+ +
+
+ +
+ + +
+ +
+ +
+
+

Templates

+ 0 Template(s) +
+
+
+
+
+ +
+
+

Usage Beispiel

+
+
+
# JSON Template +$ cat templates/system/commit_analysis.json | jq -r '.template' + +# Validierung +$ python scripts/validate.py templates/system/commit_analysis.json + +# Alle validieren +$ python scripts/validate.py --all
+
+
+
+ + + + diff --git a/web/serve.py b/web/serve.py new file mode 100755 index 0000000..2c0bfb1 --- /dev/null +++ b/web/serve.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +""" +Minimaler Entwicklungs-Server für die Prompt Templates Webansicht. +Startet auf Port 8080 und dient die statischen Dateien aus. +""" + +import http.server +import socketserver +import os + +PORT = 8080 +DIRECTORY = os.path.dirname(os.path.abspath(__file__)) + +class Handler(http.server.SimpleHTTPRequestHandler): + def __init__(self, *args, **kwargs): + super().__init__(*args, directory=DIRECTORY, **kwargs) + + def do_GET(self): + # Für Root-Pfad: index.htmlservieren + if self.path == '/' or self.path == '/index.html': + self.path = '/index.html' + return super().do_GET() + +def main(): + with socketserver.TCPServer(("", PORT), Handler) as httpd: + print(f"Serving Prompt Templates on http://localhost:{PORT}") + print(f"Press Ctrl+C to stop") + try: + httpd.serve_forever() + except KeyboardInterrupt: + print("\nServer stopped") + +if __name__ == "__main__": + main() diff --git a/web/templates.json b/web/templates.json new file mode 100644 index 0000000..e93302b --- /dev/null +++ b/web/templates.json @@ -0,0 +1,65 @@ +[ + { + "path": "templates/custom/brainstorming.md", + "type": "custom", + "name": "Brainstorming Assistent", + "description": "", + "version": "1.0", + "tags": [], + "format": "md" + }, + { + "path": "templates/user/email_draft.md", + "type": "user", + "name": "Email Entwurf Assistent", + "description": "", + "version": "1.0", + "tags": [], + "format": "md" + }, + { + "path": "templates/system/code_reviewer.json", + "type": "system", + "name": "Code Reviewer", + "description": "Analysiert Code auf Qualität, Best Practices und potenzielle Bugs", + "version": "1.0", + "tags": [ + "code", + "review", + "quality", + "best-practices", + "security" + ], + "format": "json" + }, + { + "path": "templates/system/commit_analysis.json", + "type": "system", + "name": "Git Commit Deep Analysis", + "description": "Erstellt eine tiefe Analyse der letzten Git-Commits mit technischer und fachlicher Bewertung", + "version": "1.0", + "tags": [ + "git", + "code-review", + "audit", + "analysis", + "commit", + "quality" + ], + "format": "json" + }, + { + "path": "templates/system/summarizer.json", + "type": "system", + "name": "Text Summarizer", + "description": "Erstellt präzise Zusammenfassungen von Texten mit konfigurierbarer Länge", + "version": "1.0", + "tags": [ + "summary", + "text", + "condense", + "abstract" + ], + "format": "json" + } +] \ No newline at end of file