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;
|
||||
}
|
||||
|
||||
/* 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 {
|
||||
background: var(--bg-secondary);
|
||||
border-bottom: 1px solid var(--border);
|
||||
|
|
@ -253,9 +325,12 @@
|
|||
font-family: var(--mono);
|
||||
font-size: 12px;
|
||||
overflow-x: auto;
|
||||
white-space: pre;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
margin-top: 12px;
|
||||
color: var(--text-primary);
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* Filter bar */
|
||||
|
|
@ -282,6 +357,29 @@
|
|||
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 */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
|
|
@ -299,10 +397,39 @@
|
|||
overflow-x: auto;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.modal {
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<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">
|
||||
<h1>Prompt Templates</h1>
|
||||
<span class="badge">Git Managed</span>
|
||||
|
|
@ -344,24 +471,109 @@
|
|||
<h2>Usage Beispiel</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="code-block"># JSON Template
|
||||
$ cat templates/system/commit_analysis.json | jq -r '.template'
|
||||
|
||||
# Validierung
|
||||
<div class="code-block"># Validierung
|
||||
$ python scripts/validate.py templates/system/commit_analysis.json
|
||||
|
||||
# Alle validieren
|
||||
$ python scripts/validate.py --all</div>
|
||||
$ python scripts/validate.py --all
|
||||
|
||||
# Server starten
|
||||
$ python web/serve.py</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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
|
||||
async function loadTemplates() {
|
||||
const response = await fetch('templates.json');
|
||||
const response = await fetch('/templates.json');
|
||||
if (!response.ok) {
|
||||
// Fallback: manuell scannen
|
||||
return await scanTemplates();
|
||||
}
|
||||
return response.json();
|
||||
|
|
@ -369,18 +581,14 @@ $ python scripts/validate.py --all</div>
|
|||
|
||||
async function scanTemplates() {
|
||||
const templates = [];
|
||||
|
||||
// System Templates
|
||||
const systemFiles = [
|
||||
'commit_analysis', 'code_reviewer', 'summarizer'
|
||||
];
|
||||
const systemFiles = ['commit_analysis', 'code_reviewer', 'summarizer'];
|
||||
for (const file of systemFiles) {
|
||||
try {
|
||||
const response = await fetch(`templates/system/${file}.json`);
|
||||
const response = await fetch(`/templates/system/${file}.json`);
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
templates.push({
|
||||
path: `templates/system/${file}.json`,
|
||||
path: `/templates/system/${file}.json`,
|
||||
type: 'system',
|
||||
name: data.name || file,
|
||||
description: data.description || '',
|
||||
|
|
@ -392,16 +600,15 @@ $ python scripts/validate.py --all</div>
|
|||
} catch (e) {}
|
||||
}
|
||||
|
||||
// User Templates (MD)
|
||||
const userFiles = ['email_draft', 'brainstorming'];
|
||||
for (const file of userFiles) {
|
||||
try {
|
||||
const response = await fetch(`templates/user/${file}.md`);
|
||||
const response = await fetch(`/templates/user/${file}.md`);
|
||||
if (response.ok) {
|
||||
const text = await response.text();
|
||||
const name = text.split('\n')[0].replace('# ', '');
|
||||
templates.push({
|
||||
path: `templates/user/${file}.md`,
|
||||
path: `/templates/user/${file}.md`,
|
||||
type: 'user',
|
||||
name: name,
|
||||
description: '',
|
||||
|
|
@ -441,24 +648,12 @@ $ python scripts/validate.py --all</div>
|
|||
</div>
|
||||
<div class="actions">
|
||||
<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>
|
||||
`).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
|
||||
document.getElementById('search').addEventListener('input', async (e) => {
|
||||
const query = e.target.value.toLowerCase();
|
||||
|
|
@ -471,8 +666,21 @@ $ python scripts/validate.py --all</div>
|
|||
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
|
||||
loadTemplates().then(renderTemplates);
|
||||
loadTemplates().then(t => {
|
||||
allTemplates = t;
|
||||
renderTemplates(t);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
47
web/serve.py
47
web/serve.py
|
|
@ -7,24 +7,67 @@ Startet auf Port 8080 und dient die statischen Dateien aus.
|
|||
import http.server
|
||||
import socketserver
|
||||
import os
|
||||
import socket
|
||||
import json
|
||||
|
||||
PORT = 8080
|
||||
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):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, directory=DIRECTORY, **kwargs)
|
||||
|
||||
def do_GET(self):
|
||||
# Für Root-Pfad: index.htmlservieren
|
||||
# Für Root-Pfad: index.html servieren
|
||||
if self.path == '/' or self.path == '/index.html':
|
||||
self.path = '/index.html'
|
||||
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():
|
||||
PORT = 8081
|
||||
print(f"Serving on http://localhost:{PORT}")
|
||||
|
||||
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
||||
print(f"Serving Prompt Templates on http://localhost:{PORT}")
|
||||
print(f"Press Ctrl+C to stop")
|
||||
print(f"Directory: {DIRECTORY}")
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue