feat: Server-Konfiguration auf Port 8081, Template-Pfade korrigiert sowie brainstorming.md erstellt
This commit is contained in:
parent
cbd48df796
commit
7a774bb182
3 changed files with 332 additions and 34 deletions
47
templates/user/brainstorming.md
Normal file
47
templates/user/brainstorming.md
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Brainstorming Template
|
||||||
|
|
||||||
|
**Kurzbeschreibung:**
|
||||||
|
Ein strukturiertes Brainstorming-Template für schnelle Ideenfindung und Konzeptentwicklung.
|
||||||
|
|
||||||
|
**Tags:** #brainstorming #ideation #konzept #team
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Struktur
|
||||||
|
|
||||||
|
### 1. **Thema / Fragestellung**
|
||||||
|
_Definiere klar, worüber gebrainstormt werden soll:_
|
||||||
|
|
||||||
|
```
|
||||||
|
[Hier Thema eingeben]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. **Lösungsansätze**
|
||||||
|
Liste mögliche Lösungen oder Ideen auf:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
- [ ] Idee 1: ...
|
||||||
|
- [ ] Idee 2: ...
|
||||||
|
- [ ] Idee 3: ...
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. **Bewertung**
|
||||||
|
Bewerte jede Idee nach:
|
||||||
|
- Machbarkeit
|
||||||
|
- Aufwand
|
||||||
|
- Nutzen
|
||||||
|
|
||||||
|
```
|
||||||
|
| Idee | Machbarkeit (1-5) | Aufwand (1-5) | Nutzen (1-5) |
|
||||||
|
|-------|-------------------|---------------|--------------|
|
||||||
|
| Idee 1 | 3 | 2 | 5 |
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. **Nächste Schritte**
|
||||||
|
Definiere konkrete Aktionen:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
- [ ] Idee 1 weiterverfolgen
|
||||||
|
- [ ] Machbarkeitsanalyse durchführen
|
||||||
|
- [ ] Team einbeziehen
|
||||||
|
```
|
||||||
272
web/index.html
272
web/index.html
|
|
@ -43,6 +43,78 @@
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Modal */
|
||||||
|
.modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
display: none;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-overlay.active {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
max-width: 900px;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 80vh;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
padding: 20px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 24px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close:hover {
|
||||||
|
color: var(--text-primary);
|
||||||
|
background: var(--bg-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
background: var(--bg-secondary);
|
background: var(--bg-secondary);
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
|
|
@ -253,9 +325,12 @@
|
||||||
font-family: var(--mono);
|
font-family: var(--mono);
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
white-space: pre;
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Filter bar */
|
/* Filter bar */
|
||||||
|
|
@ -282,6 +357,29 @@
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toast {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
display: none;
|
||||||
|
z-index: 1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast.show {
|
||||||
|
display: block;
|
||||||
|
animation: fadeIn 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from { opacity: 0; transform: translateY(10px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
/* Responsive */
|
/* Responsive */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.container {
|
.container {
|
||||||
|
|
@ -299,10 +397,39 @@
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
.modal {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal-overlay" id="modal">
|
||||||
|
<div class="modal">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2 id="modal-title">Template</h2>
|
||||||
|
<button class="modal-close" onclick="closeModal()">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="code-block" id="modal-content">Lädt...</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="btn" onclick="copyModalContent()">
|
||||||
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
|
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
||||||
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
||||||
|
</svg>
|
||||||
|
Inhalt kopieren
|
||||||
|
</button>
|
||||||
|
<button class="btn" onclick="closeModal()">Schließen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Toast -->
|
||||||
|
<div class="toast" id="toast"></div>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>Prompt Templates</h1>
|
<h1>Prompt Templates</h1>
|
||||||
<span class="badge">Git Managed</span>
|
<span class="badge">Git Managed</span>
|
||||||
|
|
@ -344,24 +471,109 @@
|
||||||
<h2>Usage Beispiel</h2>
|
<h2>Usage Beispiel</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="code-block"># JSON Template
|
<div class="code-block"># Validierung
|
||||||
$ cat templates/system/commit_analysis.json | jq -r '.template'
|
|
||||||
|
|
||||||
# Validierung
|
|
||||||
$ python scripts/validate.py templates/system/commit_analysis.json
|
$ python scripts/validate.py templates/system/commit_analysis.json
|
||||||
|
|
||||||
# Alle validieren
|
# Alle validieren
|
||||||
$ python scripts/validate.py --all</div>
|
$ python scripts/validate.py --all
|
||||||
|
|
||||||
|
# Server starten
|
||||||
|
$ python web/serve.py</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
let allTemplates = [];
|
||||||
|
|
||||||
|
// Modal-Funktionen
|
||||||
|
function showModal(title, content) {
|
||||||
|
document.getElementById('modal-title').textContent = title;
|
||||||
|
document.getElementById('modal-content').textContent = content;
|
||||||
|
document.getElementById('modal').classList.add('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
document.getElementById('modal').classList.remove('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
function showToast(message) {
|
||||||
|
const toast = document.getElementById('toast');
|
||||||
|
toast.textContent = message;
|
||||||
|
toast.classList.add('show');
|
||||||
|
setTimeout(() => toast.classList.remove('show'), 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyModalContent() {
|
||||||
|
const content = document.getElementById('modal-content').textContent;
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(content);
|
||||||
|
showToast('✓ Inhalt kopiert');
|
||||||
|
} catch (e) {
|
||||||
|
// Fallback für ältere Browser
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = content;
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
document.execCommand('copy');
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
showToast('✓ Inhalt kopiert');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Template-Inhalt laden und anzeigen
|
||||||
|
async function viewTemplate(path) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(path);
|
||||||
|
if (!response.ok) throw new Error('Datei nicht gefunden');
|
||||||
|
|
||||||
|
let content = await response.text();
|
||||||
|
|
||||||
|
// Für JSON: formatiert anzeigen
|
||||||
|
if (path.endsWith('.json')) {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(content);
|
||||||
|
content = JSON.stringify(data, null, 2);
|
||||||
|
} catch (e) {
|
||||||
|
// Nicht valides JSON, als Raw Text anzeigen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showModal(path.split('/').pop(), content);
|
||||||
|
} catch (e) {
|
||||||
|
showModal(path, `Fehler beim Laden: ${e.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Template-Inhalt kopieren
|
||||||
|
async function copyContent(path) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(path);
|
||||||
|
if (!response.ok) throw new Error('Datei nicht gefunden');
|
||||||
|
|
||||||
|
let content = await response.text();
|
||||||
|
|
||||||
|
// Für JSON: originalen Inhalt (nicht formatiert) kopieren
|
||||||
|
if (path.endsWith('.json')) {
|
||||||
|
try {
|
||||||
|
JSON.parse(content);
|
||||||
|
// Valides JSON - originalen Inhalt behalten
|
||||||
|
} catch (e) {
|
||||||
|
// Nicht valides JSON
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await navigator.clipboard.writeText(content);
|
||||||
|
showToast('✓ Inhalt kopiert');
|
||||||
|
} catch (e) {
|
||||||
|
showToast(`✗ Fehler: ${e.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Template-Daten laden
|
// Template-Daten laden
|
||||||
async function loadTemplates() {
|
async function loadTemplates() {
|
||||||
const response = await fetch('templates.json');
|
const response = await fetch('/templates.json');
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
// Fallback: manuell scannen
|
|
||||||
return await scanTemplates();
|
return await scanTemplates();
|
||||||
}
|
}
|
||||||
return response.json();
|
return response.json();
|
||||||
|
|
@ -369,18 +581,14 @@ $ python scripts/validate.py --all</div>
|
||||||
|
|
||||||
async function scanTemplates() {
|
async function scanTemplates() {
|
||||||
const templates = [];
|
const templates = [];
|
||||||
|
const systemFiles = ['commit_analysis', 'code_reviewer', 'summarizer'];
|
||||||
// System Templates
|
|
||||||
const systemFiles = [
|
|
||||||
'commit_analysis', 'code_reviewer', 'summarizer'
|
|
||||||
];
|
|
||||||
for (const file of systemFiles) {
|
for (const file of systemFiles) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`templates/system/${file}.json`);
|
const response = await fetch(`/templates/system/${file}.json`);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
templates.push({
|
templates.push({
|
||||||
path: `templates/system/${file}.json`,
|
path: `/templates/system/${file}.json`,
|
||||||
type: 'system',
|
type: 'system',
|
||||||
name: data.name || file,
|
name: data.name || file,
|
||||||
description: data.description || '',
|
description: data.description || '',
|
||||||
|
|
@ -392,16 +600,15 @@ $ python scripts/validate.py --all</div>
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// User Templates (MD)
|
|
||||||
const userFiles = ['email_draft', 'brainstorming'];
|
const userFiles = ['email_draft', 'brainstorming'];
|
||||||
for (const file of userFiles) {
|
for (const file of userFiles) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`templates/user/${file}.md`);
|
const response = await fetch(`/templates/user/${file}.md`);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
const name = text.split('\n')[0].replace('# ', '');
|
const name = text.split('\n')[0].replace('# ', '');
|
||||||
templates.push({
|
templates.push({
|
||||||
path: `templates/user/${file}.md`,
|
path: `/templates/user/${file}.md`,
|
||||||
type: 'user',
|
type: 'user',
|
||||||
name: name,
|
name: name,
|
||||||
description: '',
|
description: '',
|
||||||
|
|
@ -441,24 +648,12 @@ $ python scripts/validate.py --all</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="btn btn-icon" onclick="viewTemplate('${t.path}')">Anzeigen</button>
|
<button class="btn btn-icon" onclick="viewTemplate('${t.path}')">Anzeigen</button>
|
||||||
<button class="btn btn-icon" onclick="copyPath('${t.path}')">Kopieren</button>
|
<button class="btn btn-icon" onclick="copyContent('${t.path}')">Inhalt kopieren</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`).join('');
|
`).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewTemplate(path) {
|
|
||||||
alert(`Template: ${path}\n\nBitte öffne die Datei manuell oder implementiere einen Viewer.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyPath(path) {
|
|
||||||
navigator.clipboard.writeText(path);
|
|
||||||
const btn = event.target;
|
|
||||||
const original = btn.textContent;
|
|
||||||
btn.textContent = '✓ Kopiert';
|
|
||||||
setTimeout(() => btn.textContent = original, 2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
document.getElementById('search').addEventListener('input', async (e) => {
|
document.getElementById('search').addEventListener('input', async (e) => {
|
||||||
const query = e.target.value.toLowerCase();
|
const query = e.target.value.toLowerCase();
|
||||||
|
|
@ -471,8 +666,21 @@ $ python scripts/validate.py --all</div>
|
||||||
renderTemplates(filtered);
|
renderTemplates(filtered);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Close modal on overlay click
|
||||||
|
document.getElementById('modal').addEventListener('click', (e) => {
|
||||||
|
if (e.target === e.currentTarget) closeModal();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Escape key closes modal
|
||||||
|
document.addEventListener('keydown', (e) => {
|
||||||
|
if (e.key === 'Escape') closeModal();
|
||||||
|
});
|
||||||
|
|
||||||
// Initial load
|
// Initial load
|
||||||
loadTemplates().then(renderTemplates);
|
loadTemplates().then(t => {
|
||||||
|
allTemplates = t;
|
||||||
|
renderTemplates(t);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
45
web/serve.py
45
web/serve.py
|
|
@ -7,9 +7,23 @@ Startet auf Port 8080 und dient die statischen Dateien aus.
|
||||||
import http.server
|
import http.server
|
||||||
import socketserver
|
import socketserver
|
||||||
import os
|
import os
|
||||||
|
import socket
|
||||||
|
import json
|
||||||
|
|
||||||
PORT = 8080
|
|
||||||
DIRECTORY = os.path.dirname(os.path.abspath(__file__))
|
DIRECTORY = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
ROOT_DIR = os.path.abspath(os.path.join(DIRECTORY, '..'))
|
||||||
|
|
||||||
|
def find_free_port(start_port=9000):
|
||||||
|
"""Finde einen freien Port ab start_port"""
|
||||||
|
port = start_port
|
||||||
|
while port < 10000:
|
||||||
|
try:
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
|
s.bind(('', port))
|
||||||
|
return port
|
||||||
|
except OSError:
|
||||||
|
port += 1
|
||||||
|
return None
|
||||||
|
|
||||||
class Handler(http.server.SimpleHTTPRequestHandler):
|
class Handler(http.server.SimpleHTTPRequestHandler):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
@ -21,10 +35,39 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
||||||
self.path = '/index.html'
|
self.path = '/index.html'
|
||||||
return super().do_GET()
|
return super().do_GET()
|
||||||
|
|
||||||
|
# Anfragen für /templates.json oder /templates/* umleiten
|
||||||
|
if self.path.startswith('/templates'):
|
||||||
|
# Pfad relativ zur ROOT_DIR konstruieren
|
||||||
|
rel_path = self.path[1:] # '/templates.json' → 'templates.json'
|
||||||
|
file_path = os.path.join(ROOT_DIR, rel_path)
|
||||||
|
|
||||||
|
if os.path.exists(file_path) and not os.path.isdir(file_path):
|
||||||
|
try:
|
||||||
|
self.path = file_path
|
||||||
|
# Einfach die Datei senden
|
||||||
|
with open(file_path, 'rb') as f:
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header('Content-type', 'text/plain' if file_path.endswith('.md') else 'application/json')
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(f.read())
|
||||||
|
return
|
||||||
|
except Exception as e:
|
||||||
|
self.send_error(500, f"Error serving file: {e}")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.send_error(404, "File not found")
|
||||||
|
return
|
||||||
|
|
||||||
|
return super().do_GET()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
PORT = 8081
|
||||||
|
print(f"Serving on http://localhost:{PORT}")
|
||||||
|
|
||||||
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
||||||
print(f"Serving Prompt Templates on http://localhost:{PORT}")
|
print(f"Serving Prompt Templates on http://localhost:{PORT}")
|
||||||
print(f"Press Ctrl+C to stop")
|
print(f"Press Ctrl+C to stop")
|
||||||
|
print(f"Directory: {DIRECTORY}")
|
||||||
try:
|
try:
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue