From 7824ddb6dc784f9012f36c994d29a2b63608bd4e Mon Sep 17 00:00:00 2001 From: Michi Date: Thu, 12 Nov 2026 19:50:38 +0100 Subject: [PATCH] added description to all projekt --- .claude/settings.json | 7 ++++- README.md | 5 +++- public/app.js | 61 +++++++++++++++++++++++++++++++++++++++++++ public/index.html | 3 +++ server.js | 38 +++++++++++++++++++++++++-- 5 files changed, 110 insertions(+), 4 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 157803d..5718cd8 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -5,7 +5,12 @@ "PowerShell(\\(Get-Content public\\\\app.js -Raw\\) -replace 'const rootPaths = \\\\\\(\\\\\\) =>', 'const rowRootPaths = \\(\\) =>' -replace 'have: rootPaths\\\\\\(\\\\\\)', 'have: rowRootPaths\\(\\)' | Set-Content public\\\\app.js -Encoding utf8 -NoNewline; Select-String -Path public\\\\app.js -Pattern 'rootPaths\\\\\\(\\\\\\)|rowRootPaths' | ForEach-Object { \"$\\($_.LineNumber\\): $\\($_.Line.Trim\\(\\)\\)\" }; node --check public/app.js; if \\($?\\) { 'OK' })", "PowerShell($b = [IO.File]::ReadAllBytes\\(\"$PWD\\\\public\\\\app.js\"\\); if \\($b[0] -eq 0xEF -and $b[1] -eq 0xBB\\) { [IO.File]::WriteAllBytes\\(\"$PWD\\\\public\\\\app.js\", $b[3..\\($b.Length-1\\)]\\); 'BOM removed' } else { 'no BOM' }; node --check public/app.js; if \\($?\\) { 'OK' })", "PowerShell($f = \"$PWD\\\\public\\\\app.js\"; $txt = [IO.File]::ReadAllText\\($f, [Text.UTF8Encoding]::new\\($false\\)\\); $orig = [Text.Encoding]::GetEncoding\\(1252\\).GetBytes\\($txt\\); $fixed = [Text.UTF8Encoding]::new\\($false, $true\\).GetString\\($orig\\); [IO.File]::WriteAllText\\($f, $fixed, [Text.UTF8Encoding]::new\\($false\\)\\); \"mojibake left: \" + \\([regex]::Matches\\($fixed, 'Ã|Â'\\).Count\\); \"umlauts: \" + \\([regex]::Matches\\($fixed, '[äöüÄÖÜß–…→]'\\).Count\\); node --check public/app.js; if \\($?\\) { 'OK' })", - "PowerShell($c = Get-NetTCPConnection -LocalPort 4848 -State Listen -ErrorAction SilentlyContinue; foreach \\($x in $c\\) { Get-CimInstance Win32_Process -Filter \"ProcessId=$\\($x.OwningProcess\\)\" | Select-Object ProcessId, CreationDate, CommandLine, ExecutablePath | Format-List }; \\(Get-Item server.js\\).LastWriteTime; try { \\(Invoke-WebRequest -UseBasicParsing -Method Post -Uri 'http://127.0.0.1:4848/api/projects/xyz/git-init' -Headers @{Origin='http://127.0.0.1:4848'} -ContentType 'application/json' -Body '{}'\\).Content } catch { $_.Exception.Response.StatusCode; \\(New-Object IO.StreamReader\\($_.Exception.Response.GetResponseStream\\(\\)\\)\\).ReadToEnd\\(\\).Substring\\(0,120\\) })" + "PowerShell($c = Get-NetTCPConnection -LocalPort 4848 -State Listen -ErrorAction SilentlyContinue; foreach \\($x in $c\\) { Get-CimInstance Win32_Process -Filter \"ProcessId=$\\($x.OwningProcess\\)\" | Select-Object ProcessId, CreationDate, CommandLine, ExecutablePath | Format-List }; \\(Get-Item server.js\\).LastWriteTime; try { \\(Invoke-WebRequest -UseBasicParsing -Method Post -Uri 'http://127.0.0.1:4848/api/projects/xyz/git-init' -Headers @{Origin='http://127.0.0.1:4848'} -ContentType 'application/json' -Body '{}'\\).Content } catch { $_.Exception.Response.StatusCode; \\(New-Object IO.StreamReader\\($_.Exception.Response.GetResponseStream\\(\\)\\)\\).ReadToEnd\\(\\).Substring\\(0,120\\) })", + "Bash(node --check server.js)", + "Bash(node -e ' *)" + ], + "additionalDirectories": [ + "d:\\Oculusquest\\Projekt\\ProjectDashboard" ] } } diff --git a/README.md b/README.md index a3a4f00..840a1a2 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,10 @@ Fertig. Eine Verknüpfung auf dem Desktop legst du wie bei jedem Programm an (Re ### Projekt-Panel (Klick auf ein Projekt) - **Bearbeiten:** Status, Priorität, Tags, Notizen, Aufgaben, eigener Start-Befehl, Vorschaubild. -- **Info** (nur lesen): Übersicht (Ordner, Status, letzte Änderung, Backup, Größe), Git-Stand, itch.io-Stand, +- **Info:** oben die **Beschreibung** – was das für ein Projekt ist. Direkt dort über „Schreiben“/„Ändern“ + editierbar (Strg+Enter speichert), gespeichert in `.dashboard.json`, durchsuchbar. Ohne eigene Beschreibung + steht der Anfang der README da, mit einem Klick übernehmbar. Darunter (nur lesen): + Übersicht (Ordner, Status, letzte Änderung, Backup, Größe), Git-Stand, itch.io-Stand, Technik, Aktivität, vorhandene Release-ZIPs, Generator und App-Icon. Kleine Links springen zur passenden Aktion. - **Aktionen** (alles, was etwas tut), in Gruppen: - **Starten:** eigene Programme (exe/HTML, 📌 legt fest, was ▶ startet), Starten · Einrichten · Bauen. diff --git a/public/app.js b/public/app.js index 0441ac5..f51910e 100644 --- a/public/app.js +++ b/public/app.js @@ -992,6 +992,7 @@ function matchesSearch(p) { if (!term) return true return p.name.toLowerCase().includes(term) || p.notes.toLowerCase().includes(term) || + (p.description ?? '').toLowerCase().includes(term) || (p.tags ?? []).some((t) => t.toLowerCase().includes(term)) || (p.tech?.types ?? []).some((t) => t.toLowerCase().includes(term)) } @@ -1969,8 +1970,29 @@ function renderInfo(name, d) {
${genDir ? 'Mit ComfyGen erzeugen (Prompt „icon“ in prompts.py eintragen):' : 'Generator-Vorlage aus _Tools\\ComfyGen\\template kopieren, dann:'}
cd "${escapeHtml(d.path)}\\${escapeHtml(genDir ? genDir.rel : 'sprite-generator')}" && gen generate icon && gen adopt icon` + // description: own text (.dashboard.json), else the README's intro as a suggestion + const desc = p.description ?? '' + const descBody = desc + ? `
${escapeHtml(desc)}
` + : d.readme + ? `
${escapeHtml(d.readme)}
+
${ic('file-text', 'sm')} Aus der README – noch keine eigene Beschreibung. +
` + : '
Noch keine Beschreibung. Kurz notieren, was das für ein Projekt ist.
' + const descEdit = `` + const el = document.getElementById('sec-info') el.innerHTML = + section('notebook-text', 'Beschreibung', `
${descBody}
${descEdit}`, + { id: 'info-desc', right: `${ic('pencil', 'sm')}${desc ? 'Ändern' : 'Schreiben'}` }) + section('info', 'Übersicht', overview, { right: del >= 1 ? jumpLink('act-clean', 'Aufräumen') : '' }) + section('git-branch', 'Git', gitBody, { right: jumpLink('act-git', g.isRepo ? 'Push & Remote' : 'Einrichten') }) + (name === '_Tools' ? '' : section('rocket', 'itch.io', itchBody, { right: jumpLink('act-itch', ip.exists ? 'Ansehen' : 'Erzeugen') })) + @@ -1980,9 +2002,48 @@ function renderInfo(name, d) { section('wand-sparkles', 'Generator', genBody) + section('image', 'App-Icon', iconBody) bindJumps(el) + bindDescription(name, d, el) loadProjectActivity(name) } +function bindDescription(name, d, el) { + const view = el.querySelector('.pdesc-view') + const edit = el.querySelector('.pdesc-edit') + const ta = document.getElementById('fDesc') + const link = document.getElementById('btnDescEdit') + const open = (text) => { + ta.value = text + view.hidden = true + edit.hidden = false + link.style.visibility = 'hidden' + ta.focus() + } + const close = () => { view.hidden = false; edit.hidden = true; link.style.visibility = '' } + const save = async (text) => { + try { + const res = await fetch(`/api/projects/${encodeURIComponent(name)}`, { + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ description: text }), + }) + const r = await res.json().catch(() => ({})) + if (!res.ok) throw new Error(r.error ?? 'Speichern fehlgeschlagen') + for (const p of [editing, projects.find((x) => x.name === name)]) if (p) p.description = r.description + toast(r.description ? 'Beschreibung gespeichert' : 'Beschreibung entfernt', 'notebook-text') + if (editing?.name === name) renderInfo(name, d) + } catch (e) { toast(e.message, 'triangle-alert') } + } + link.onclick = (e) => { e.preventDefault(); open(editing?.description || '') } + document.getElementById('btnDescTake')?.addEventListener('click', () => save(d.readme)) + document.getElementById('btnDescReadme')?.addEventListener('click', () => { ta.value = ta.value.trim() ? `${ta.value.trim()}\n\n${d.readme}` : d.readme; ta.focus() }) + document.getElementById('btnDescCancel').onclick = close + document.getElementById('btnDescSave').onclick = () => save(ta.value) + ta.onkeydown = (e) => { + if (e.key === 'Enter' && e.ctrlKey) { e.preventDefault(); save(ta.value) } + if (e.key === 'Escape') { e.stopPropagation(); close() } + } +} + /* Aktionen tab: everything that does something, grouped */ function gitActionsHtml(name, d) { const g = d.git diff --git a/public/index.html b/public/index.html index 0970394..b564778 100644 --- a/public/index.html +++ b/public/index.html @@ -555,6 +555,9 @@ .card-sec h4 .h4r .i, .isec h4 .h4r .i { color: inherit; } a.jump { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--accent-text); text-decoration: none; } a.jump:hover { text-decoration: underline; } + .pdesc { font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; } + .pdesc.muted { color: var(--muted); font-style: italic; } + .pdesc-edit textarea { width: 100%; min-height: 120px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.5; } .flabel { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin: 0 0 5px; } details.progset summary { cursor: pointer; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; list-style: none; } details.progset summary::-webkit-details-marker { display: none; } diff --git a/server.js b/server.js index 53bbe32..4251b81 100644 --- a/server.js +++ b/server.js @@ -83,6 +83,37 @@ function sanitizeTasks(tasks) { })).filter((t) => t.text.length > 0) } +const MAX_DESCRIPTION = 4000 + +// First real paragraph(s) of the project's README - suggestion for the +// description in the Info tab. Skips headings, badges, images, tables, code. +function readmeIntro(projectPath) { + let text = '' + for (const f of ['README.md', 'readme.md', 'Readme.md', 'README.txt', 'README']) { + try { text = fs.readFileSync(path.join(projectPath, f), 'utf-8'); break } catch {} + } + if (!text) return '' + text = text.replace(/^---[\s\S]*?\n---\s*\n/, '').replace(//g, '').replace(/```[\s\S]*?```/g, '') + const paras = [] + let cur = [] + const flush = () => { if (cur.length) paras.push(cur.join(' ')); cur = [] } + for (const raw of text.split(/\r?\n/)) { + const line = raw.trim() + if (!line) { flush(); continue } + if (/^(#|\||!\[|\[!\[|<|>|---|===|\*\*\*)/.test(line)) { flush(); continue } + cur.push(line.replace(/^[-*]\s+/, '• ')) + } + flush() + const clean = (p) => p.replace(/\*\*|__|`/g, '').replace(/\[([^\]]+)\]\([^)]+\)/g, '$1').trim() + let out = '' + for (const p of paras.map(clean).filter((p) => p.length > 20)) { + if (out && out.length + p.length > 600) break + out = out ? `${out}\n\n${p}` : p + if (out.length > 300) break + } + return out.length > 800 ? out.slice(0, 797).replace(/\s+\S*$/, '') + '…' : out +} + function readStatusFile(projectPath) { const file = path.join(projectPath, STATUS_FILE) try { @@ -92,6 +123,7 @@ function readStatusFile(projectPath) { status: STATUSES.includes(data.status) ? data.status : 'idea', priority: PRIORITIES.includes(data.priority) ? data.priority : 'medium', notes: typeof data.notes === 'string' ? data.notes : '', + description: typeof data.description === 'string' ? data.description.slice(0, MAX_DESCRIPTION) : '', tags: Array.isArray(data.tags) ? data.tags.map(String).slice(0, 10) : [], tasks: sanitizeTasks(data.tasks), thumbnail: typeof data.thumbnail === 'string' ? data.thumbnail.slice(0, 300) : '', @@ -101,7 +133,7 @@ function readStatusFile(projectPath) { updatedAt: data.updatedAt ?? null, } } catch { - return { status: 'idea', priority: 'medium', notes: '', tags: [], tasks: [], thumbnail: '', start: '', program: '', itch: '', updatedAt: null } + return { status: 'idea', priority: 'medium', notes: '', description: '', tags: [], tasks: [], thumbnail: '', start: '', program: '', itch: '', updatedAt: null } } } @@ -536,7 +568,7 @@ app.patch('/api/projects/:name', (req, res) => { const projectPath = resolveProject(req.params.name) if (!projectPath) return res.status(404).json({ error: 'unknown project' }) const current = readStatusFile(projectPath) - const { status, priority, notes, tags, tasks, thumbnail, start, program, itch: itchLink } = req.body ?? {} + const { status, priority, notes, description, tags, tasks, thumbnail, start, program, itch: itchLink } = req.body ?? {} // itch: '' = automatic, '-' = not published, otherwise the game's page let nextItch = current.itch if (typeof itchLink === 'string') { @@ -560,6 +592,7 @@ app.patch('/api/projects/:name', (req, res) => { status: STATUSES.includes(status) ? status : current.status, priority: PRIORITIES.includes(priority) ? priority : current.priority, notes: typeof notes === 'string' ? notes : current.notes, + description: typeof description === 'string' ? description.trim().slice(0, MAX_DESCRIPTION) : current.description, tags: Array.isArray(tags) ? tags.map(String).slice(0, 10) : current.tags, tasks: tasks !== undefined ? sanitizeTasks(tasks) : current.tasks, thumbnail: typeof thumbnail === 'string' ? thumbnail.slice(0, 300) : current.thumbnail, @@ -616,6 +649,7 @@ app.get('/api/projects/:name/details', handle(async (req, res) => { releaseDirs: archive.findReleaseDirs(projectPath), archives: archive.listArchives(projectPath), itchPack: itchpack.summary(projectPath), + readme: readmeIntro(projectPath), }) }))