diff --git a/README.md b/README.md index af1e609..a3a4f00 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,16 @@ 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:** Git-Details. Remote eintragen (SSH wie `git@github.com:name/projekt.git` oder https), - **Git einrichten** für Projekte ohne Repository, **Push** bzw. **Commit & Push** mit Nachricht. - Push läuft in einem sichtbaren Konsolenfenster (dort erscheinen Passwort-/SSH-Abfragen und Fehler). - Dein öffentlicher SSH-Schlüssel lässt sich mit einem Klick kopieren. -- **Speicher:** Projekt scannen, Größe sehen und Caches/Build-Ordner gezielt löschen. Ordner mit Dateien, - die in Git sind, werden nie angeboten. -- **Aktionen:** alle erkannten Programme und Befehle (npm, dotnet, flutter, Gradle, Unity, Python …), - jeweils in einem eigenen Konsolenfenster. +- **Info** (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. + - **Sichern & Versionieren:** Git – Remote eintragen (SSH wie `git@github.com:name/projekt.git` oder https), + **Git einrichten**, **Push** bzw. **Commit & Push** (sichtbares Konsolenfenster für SSH-Abfragen und Fehler), + SSH-Schlüssel kopieren; dazu **Backup** nur dieses Projekts. + - **Veröffentlichen:** Release-ZIP und itch.io-Seite (siehe unten). + - **Aufräumen:** Projekt scannen, Caches/Build-Ordner gezielt löschen. Ordner mit Dateien in Git werden nie angeboten. + - **Werkzeuge / Öffnen:** übrige Befehle (npm, dotnet, flutter, Gradle, Unity, Python …), jeweils in eigener Konsole. - **Klonen** und **Umbenennen…** (auch in einen anderen Projektordner verschieben). ### Neues Projekt @@ -115,7 +117,7 @@ Klick auf einen Tag zeigt, woran gearbeitet wurde. Dazu kommen aktive Tage, die und „Zuletzt aktiv“ (7 / 30 / 90 Tage). Im Projekt unter **Info** steht dieselbe Ansicht für ein halbes Jahr. ### Release archivieren (ZIP) -Im Projekt unter **Info → Release archivieren**: einen Build-Ordner (`dist`, `builds`, `release`, `publish`, +Im Projekt unter **Aktionen → Release-ZIP**: einen Build-Ordner (`dist`, `builds`, `release`, `publish`, `bin\Release` …) oder das ganze Projekt als ZIP mit Datum im Namen nach `\releases\` packen. Beim ganzen Projekt bleiben `node_modules`, Build-Ordner, `.git` und `releases` draußen. Optional wird ein fertiger Build-Ordner danach gelöscht, um Platz zu sparen – das ZIP bleibt. @@ -124,6 +126,23 @@ danach gelöscht, um Platz zu sparen – das ZIP bleibt. Trägst du in den Einstellungen dein öffentliches itch.io-Profil ein (`https://name.itch.io`), erkennt das Dashboard, welche Projekte veröffentlicht sind (🚀), und zeigt itch-Spiele, die noch keinem Projekt zugeordnet sind. +### itch.io-Seite erzeugen +Im Projekt unter **Aktionen → itch.io-Seite**: +- **itch.io-Seite erzeugen** öffnet eine Konsole mit [Claude Code](https://claude.com/claude-code) und dem Skill + `itchiocreater`. Er schreibt Titel, Project URL, Tagline, `description.html`, alle Felder für „Edit game“, + Cover/Banner (ComfyUI) und echte Screenshots nach `\docs\itchio\`. Rückfragen beantwortest du in der + Konsole. Voraussetzung: der Befehl `claude` und der Skill sind installiert. +- **Ansehen & kopieren** zeigt das Paket übersichtlich: + - Title und **Short description** mit Zähler (max. 120 Zeichen). Ist sie länger oder fehlt sie, steht darunter ein + gekürzter Vorschlag. + - Die **Description** als große Vorschau mit Wortzahl. **Formatiert kopieren** lässt sich direkt in den itch-Editor + einfügen. + - **Tags:** die aus dem Paket und dazu Ideen aus Text und Technik (z. B. `idle`, `high-score`, `controller`). + Ein Klick kopiert einen Tag. + - Alle Bilder nach Cover / Banner / Screenshots (Klick zeigt die Datei im Explorer, von dort auf itch.io ziehen) und + die übrigen Felder (Genre, KI-Offenlegung …) einzeln kopierbar. +- Nichts wird automatisch hochgeladen. + --- ## Einstellungen @@ -197,6 +216,7 @@ Liegt das Dashboard in `\_Tools\ProjectDashboard`, wird `` a | `lib\storage.js` | Größen-Scan mit Ordner-Aufteilung (Treemap) und Aufräumen über `cleanup.ps1` | | `lib\scheduler.js` | Automatisches Backup nach Zeitplan (Stand in `auto-backup.json` im Datenordner) | | `lib\archive.js` | Release-ZIP nach `\releases` (über `tar.exe` von Windows) | +| `lib\itchpack.js` | itch.io-Paket (`docs\itchio`) lesen, Bilder ausliefern, Claude Code mit Skill `itchiocreater` starten | | `lib\create.js` | Neu, Klonen, Umbenennen/Verschieben | | `lib\git.js` · `lib\tech.js` · `lib\icons.js` | Git-Status, Technik-Erkennung + Aktionen, App-Icons | | `lib\itch.js` · `lib\activity.js` | itch.io-Profil, „zuletzt geändert“ und Aktivität pro Tag | diff --git a/lib/itchpack.js b/lib/itchpack.js new file mode 100644 index 0000000..e88fae8 --- /dev/null +++ b/lib/itchpack.js @@ -0,0 +1,172 @@ +// itch.io package of a project: the folder the itchiocreater skill writes +// (\docs\itchio, older projects: \itchio) - read back for the +// dashboard's copy view, and a console that starts Claude Code with the skill. +// Nothing is uploaded anywhere. +const fs = require('fs') +const path = require('path') +const { run, openConsole } = require('./proc') + +const CANDIDATES = [['docs', 'itchio'], ['itchio']] +const IMG_RE = /\.(png|jpe?g|gif|webp)$/i +const MAX_HTML = 512 * 1024 + +function dir(projectPath) { + for (const parts of CANDIDATES) { + const d = path.join(projectPath, ...parts) + try { if (fs.statSync(d).isDirectory()) return d } catch {} + } + return null +} + +// newest modification inside the folder (first level) - "created 3 days ago" +function stamp(d) { + let at = 0 + try { + for (const e of fs.readdirSync(d, { withFileTypes: true })) { + if (!e.isFile()) continue + try { at = Math.max(at, fs.statSync(path.join(d, e.name)).mtimeMs) } catch {} + } + } catch {} + return at ? new Date(at).toISOString() : null +} + +// cheap: for /details +function summary(projectPath) { + const d = dir(projectPath) + return d ? { exists: true, at: stamp(d), rel: path.relative(projectPath, d) } : { exists: false } +} + +// "**Tags**" / "`a`, `b` - comment" → shown text and the value worth copying: +// a leading run of `code` items (the answer) without the comment after it, +// otherwise the whole text +function cell(raw) { + const plain = raw.replace(/\*\*/g, '').trim() + const lead = plain.match(/^`[^`]+`(\s*,\s*`[^`]+`)*/) + const text = plain.replace(/`/g, '').trim() + const placeholder = /^_[^_]+_$/.test(text) || text === '–' || text === '-' + const copy = placeholder ? '' : lead ? [...lead[0].matchAll(/`([^`]+)`/g)].map((m) => m[1].trim()).join(', ') : text + return { text, copy, placeholder } +} + +// all two+-column markdown tables of the .md files, except file lists +function parseFields(d) { + const fields = [] + const seen = new Set() + let files = [] + try { files = fs.readdirSync(d).filter((f) => /\.md$/i.test(f)) } catch {} + files.sort((a, b) => (a.toLowerCase() === 'readme.md' ? -1 : b.toLowerCase() === 'readme.md' ? 1 : a.localeCompare(b))) + for (const f of files) { + let text = '' + try { text = fs.readFileSync(path.join(d, f), 'utf-8') } catch { continue } + let header = null + let skip = false + for (const line of text.split(/\r?\n/)) { + if (!line.trim().startsWith('|')) { header = null; continue } + const cells = line.trim().replace(/^\||\|$/g, '').split('|').map((c) => c.trim()) + if (cells.length < 2) continue + if (!header) { header = cells; skip = /^(datei|file)/i.test(cells[0].replace(/\*/g, '')); continue } + if (cells.every((c) => /^:?-{2,}:?$/.test(c))) continue + if (skip) continue + const key = cells[0].replace(/\*\*/g, '').replace(/`/g, '').trim() + if (!key || seen.has(key.toLowerCase())) continue + seen.add(key.toLowerCase()) + fields.push({ key, ...cell(cells[1]) }) + } + } + return fields +} + +function kindOf(rel) { + const n = rel.toLowerCase().replace(/\\/g, '/') + const base = n.split('/').pop() + if (/^cover/.test(base)) return 'cover' + if (/^(banner|background|bg)/.test(base)) return 'theme' + if (/^promo\//.test(n) || /^promo/.test(base)) return 'promo' + if (/^(screenshots|screens|shots)\//.test(n) || /^(shot|screen)/.test(base)) return 'screenshot' + return 'other' +} + +function images(d) { + const out = [] + const add = (rel) => { + try { + const st = fs.statSync(path.join(d, rel)) + out.push({ rel, kind: kindOf(rel), mb: Math.round(st.size / 1024 / 1024 * 100) / 100 }) + } catch {} + } + let top = [] + try { top = fs.readdirSync(d, { withFileTypes: true }) } catch {} + for (const e of top) { + if (e.isFile() && IMG_RE.test(e.name)) add(e.name) + else if (e.isDirectory() && !e.name.startsWith('.')) { + try { + for (const f of fs.readdirSync(path.join(d, e.name))) if (IMG_RE.test(f) && !/^raw_/i.test(f)) add(path.join(e.name, f)) + } catch {} + } + } + const order = { cover: 0, theme: 1, promo: 2, screenshot: 3, other: 4 } + return out.sort((a, b) => order[a.kind] - order[b.kind] || a.rel.localeCompare(b.rel)) +} + +function readHtml(d, name) { + const f = path.join(d, name) + try { if (fs.statSync(f).size <= MAX_HTML) return fs.readFileSync(f, 'utf-8') } catch {} + return null +} + +function read(projectPath) { + const d = dir(projectPath) + if (!d) return { exists: false } + const fields = parseFields(d) + const pick = (re) => fields.find((x) => re.test(x.key)) ?? null + let other = [] + try { other = fs.readdirSync(d).filter((f) => /\.(mp4|webm|zip|exe)$/i.test(f)) } catch {} + return { + exists: true, + rel: path.relative(projectPath, d), + at: stamp(d), + title: pick(/^title$/i), + url: pick(/^project url$/i), + tagline: pick(/^short description/i), + fields: fields.filter((x) => !/^(title|project url|short description.*)$/i.test(x.key)), + descriptionHtml: readHtml(d, 'description.html'), + installHtml: readHtml(d, 'install.html'), + images: images(d), + media: other, + } +} + +// a file inside the package folder (image), or null - guards against ..\ +function file(projectPath, rel) { + const d = dir(projectPath) + if (!d || typeof rel !== 'string' || !rel) return null + const f = path.resolve(d, rel) + if (!f.startsWith(d + path.sep)) return null + try { if (fs.statSync(f).isFile()) return f } catch {} + return null +} + +let claudeFound = null +async function hasClaude() { + if (claudeFound) return true + try { + const r = await run('where.exe', ['claude'], { timeout: 5000 }) + claudeFound = r.code === 0 && /claude/i.test(r.stdout ?? '') + } catch { claudeFound = false } + return claudeFound +} + +// Opens a console with Claude Code and the itchiocreater skill in the project. +// Interactive on purpose: the skill asks a few questions (price, kind, …). +async function launch(projectPath, name) { + if (!(await hasClaude())) throw new Error('Claude Code nicht gefunden (Befehl „claude“). Installieren: https://claude.com/claude-code') + const exists = !!dir(projectPath) + // ASCII only: the .cmd file is read in the console's code page + const prompt = exists + ? '/itchiocreater Check and complete the itch.io package of this project - do not overwrite anything without asking.' + : '/itchiocreater Create the itch.io package for this project.' + openConsole(`${name} itch.io`, projectPath, `claude "${prompt}"`) + return { ok: true, update: exists } +} + +module.exports = { dir, summary, read, file, launch } diff --git a/public/app.js b/public/app.js index 2967747..0441ac5 100644 --- a/public/app.js +++ b/public/app.js @@ -1906,40 +1906,54 @@ function addTaskFromInput() { // cleanup paths are "\rest" (relative to the projects folder) → "rest" const inProject = (p) => p.slice(p.indexOf('\\') + 1) -function section(icon, title, body) { - return `

${ic(icon)}${title}

${body}
` +// opts: { id } for jump targets, { right } html at the end of the heading +function section(icon, title, body, opts = {}) { + return `

${ic(icon)}${title}${opts.right ? `${opts.right}` : ''}

${body}
` +} +// "→ in Aktionen": switches the tab and scrolls to the section +const jumpLink = (id, label = 'Aktionen') => `${label}${ic('arrow-right', 'sm')}` +function bindJumps(root) { + for (const a of root.querySelectorAll('.jump')) a.onclick = (e) => { + e.preventDefault() + setSection('actions') + document.getElementById(a.dataset.jump)?.scrollIntoView({ behavior: 'smooth', block: 'start' }) + } } +/* Info tab: read only - what the project is and how it stands */ function renderInfo(name, d) { + const p = projects.find((x) => x.name === name) ?? editing const g = d.git - const key = d.sshKey - const keyHint = key - ? `
${ic('key-round', 'sm')} SSH-Schlüssel: ${escapeHtml(key.file)}
` - : `
${ic('key-round', 'sm')} Kein SSH-Schlüssel gefunden. Anlegen mit ssh-keygen -t ed25519, dann den Inhalt von .ssh\\id_ed25519.pub bei GitHub/GitLab eintragen.
` - const pushBox = !g.remote ? '' : g.dirty - ? `
- - - -
` - : `
` + const s = d.storage + const del = s ? s.deletable.Cache + s.deletable.Release + s.deletable.Output : 0 + const c = cloudInfo(p) + const overview = `
+
Ordner
${escapeHtml(d.path)}
+
Status
${statusHtml(p.status)} · Priorität ${PRIO_LABEL[p.priority] ?? '–'}
+
Geändert
${fmtDate(lastActivity(p))} · ${timeAgo(lastActivity(p))}${p.lastChange?.file ? ` · ${escapeHtml(p.lastChange.file)}` : ''}
+
Backup
${ic('hard-drive', 'sm')}${escapeHtml(c.short)}${backupDue(p) ? ' fällig' : ''}
+
Größe
${s ? `${fmtMB(s.sizeMB)} · gescannt ${timeAgo(s.at)}${del >= 1 ? ` · ${fmtMB(del)} aufräumbar` : ''}` : 'noch nicht gescannt'}
+
` + const gitBody = g.isRepo ? `
-
Status
${gitHtml(g)}
-
Branch
${ic('git-branch', 'sm')} ${escapeHtml(g.branch)}${g.upstream ? ` → ${escapeHtml(g.upstream)}` : ''}
+
Status
${gitHtml(g)}${g.dirty ? ` · ${g.dirty} Änderungen nicht committet` : ''}
+
Branch
${ic('git-branch', 'sm')} ${escapeHtml(g.branch)}${g.upstream ? ` → ${escapeHtml(g.upstream)}` : ''}${g.ahead ? ` · ${g.ahead} nicht gepusht` : ''}
+
Remote
${g.remote ? `${escapeHtml(g.remote)}` : 'keins – liegt nur auf dieser Platte'}
Letzter Commit
${g.lastCommit ? `${g.lastCommit.date} · ${escapeHtml(g.lastCommit.message)}` : '–'}
-
- -
- - -
- ${g.remote ? '' : '
Noch kein Remote – das Projekt liegt nur auf dieser Platte.
'} - ${pushBox} - ${keyHint} -
Push läuft in einem eigenen Konsolenfenster (dort erscheinen SSH-Passphrase und Fehler).
` - : `
${gitHtml(g)}
Kein Git-Repository – Änderungen sind nirgends gesichert.
-
` + ` + : `
${gitHtml(g)}
Kein Git-Repository – Änderungen sind nirgends gesichert.
` + + const ip = d.itchPack ?? { exists: false } + const itchBody = `
+
Veröffentlicht
+
Seiten-Paket
${ip.exists ? `${escapeHtml(ip.rel)} · ${timeAgo(ip.at)}` : 'noch keins'}
+
` + + const arcs = d.archives ?? [] + const arcBody = arcs.length + ? `
${arcs.slice(0, 8).map((a) => `
${new Date(a.at).toLocaleDateString('de-DE')}
${escapeHtml(a.name)} · ${fmtMB(a.mb)}
`).join('')}
${arcs.length > 8 ? `
… und ${arcs.length - 8} ältere
` : ''}` + : '
Noch keine ZIPs in releases\\.
' const gens = d.tools.generators const genBody = gens.length @@ -1955,51 +1969,210 @@ 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` + const el = document.getElementById('sec-info') + el.innerHTML = + 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') })) + + section('cpu', 'Technik', `
${techChips(d.tech.types) || 'nicht erkannt'}${d.tech.needsInstall ? `${ic('download', 'sm')}npm install nötig` : ''}
`) + + `

${ic('activity')}Aktivität

wird geladen…
` + + section('file-archive', 'Release-Archive', arcBody, { right: jumpLink('act-zip', 'ZIP erstellen') }) + + section('wand-sparkles', 'Generator', genBody) + + section('image', 'App-Icon', iconBody) + bindJumps(el) + loadProjectActivity(name) +} + +/* Aktionen tab: everything that does something, grouped */ +function gitActionsHtml(name, d) { + const g = d.git + if (!g.isRepo) { + return `
Kein Git-Repository – Änderungen sind nirgends gesichert.
+
` + } + const key = d.sshKey + const keyHint = key + ? `
${ic('key-round', 'sm')} SSH-Schlüssel: ${escapeHtml(key.file)}
` + : `
${ic('key-round', 'sm')} Kein SSH-Schlüssel gefunden. Anlegen mit ssh-keygen -t ed25519, dann den Inhalt von .ssh\\id_ed25519.pub bei GitHub/GitLab eintragen.
` + const pushBox = !g.remote ? '' : g.dirty + ? `
+ + + +
` + : `
${g.ahead ? '' : 'nichts Neues zu pushen'}
` + return `${pushBox} + +
+ + +
+ ${g.remote ? '' : '
Noch kein Remote – erst eintragen, dann erscheint hier „Push“.
'} + ${keyHint} +
Push läuft in einem eigenen Konsolenfenster (dort erscheinen SSH-Passphrase und Fehler).
` +} + +function archiveHtml(name, d) { const s = d.storage - let storageBody - if (!s) storageBody = '
Noch nicht gescannt.
' + const folder = editing?.folder ?? name + const releaseCands = new Set((s?.candidates ?? []).filter((c) => c.Tier === 'Release' && !c.Skip).map((c) => inProject(c.Path).toLowerCase())) + const rd = d.releaseDirs ?? [] + return ` +
+ + + +
+ +
Landet in ${escapeHtml(folder)}\\releases\\ mit Datum im Namen${rd.length ? '' : ' – kein Build-Ordner gefunden (dist, builds, release, publish …)'}.
` +} + +function itchActionHtml(name, d) { + const ip = d.itchPack ?? { exists: false } + const p = projects.find((x) => x.name === name) ?? editing + if (!ip.exists) { + return `
+
Startet Claude Code mit dem Skill itchiocreater in einer Konsole: Titel, Tagline, Beschreibung, alle Felder, Cover/Banner (ComfyUI) und Screenshots landen in docs\\itchio\\. Rückfragen dort beantworten.
` + } + return `
+ + + + ${p?.published ? `${ic('external-link')}` : ''} +
+
${escapeHtml(ip.rel)} · zuletzt geändert ${timeAgo(ip.at)}
` +} + +function cleanHtml(d) { + const s = d.storage + let body + if (!s) body = '
Noch nicht gescannt – erst scannen, dann zeigt sich, was weg kann.
' else { const rows = s.candidates.filter((c) => c.MB >= 1 || c.Skip) - storageBody = `
Größe
${fmtMB(s.sizeMB)} · gescannt ${timeAgo(s.at)}
+ body = `
Größe
${fmtMB(s.sizeMB)} · gescannt ${timeAgo(s.at)}
Löschbar
Cache ${fmtMB(s.deletable.Cache)} · Builds ${fmtMB(s.deletable.Release)} · Rohbilder ${fmtMB(s.deletable.Output)}
` - storageBody += rows.length + body += rows.length ? `${rows.map((c) => ``).join('')}
${escapeHtml(inProject(c.Path))} ${ic(TIER[c.Tier].icon, 'sm')}${TIER[c.Tier].label}${c.Skip ? ` ${ic('lock', 'sm')}in git` : ''} ${fmtMB(c.MB)}
-
Cache ist vorausgewählt (immer neu erzeugbar). Fertige Builds und Rohbilder nur bewusst anhaken.
` : `
${ic('sparkles', 'sm')} Nichts zum Aufräumen.
` } - storageBody += `
` + const hasRows = s && s.candidates.some((c) => c.MB >= 1 && !c.Skip) + body += `
+ ${hasRows ? `` : ''} + +
` + return body +} - // release archive: ZIP of a build folder (or the whole project) into \releases - const folder = editing?.folder ?? name - const releaseCands = new Set((s?.candidates ?? []).filter((c) => c.Tier === 'Release' && !c.Skip).map((c) => inProject(c.Path).toLowerCase())) - const rd = d.releaseDirs ?? [] - const arcs = d.archives ?? [] - const archiveBody = ` -
- - -
- -
Landet in ${escapeHtml(folder)}\\releases\\ mit Datum im Namen${rd.length ? '' : ' – kein Build-Ordner gefunden (dist, builds, release, publish …)'}.
- ${arcs.length ? `
${arcs.slice(0, 8).map((a) => `
${new Date(a.at).toLocaleDateString('de-DE')}
${escapeHtml(a.name)} · ${fmtMB(a.mb)}
`).join('')}
` : ''} -
` +function renderActions(name, d) { + const groups = {} + for (const a of d.actions) (groups[a.group] ??= []).push(a) + const ACT_ICON = (a) => a.id === 'vscode' ? 'code-xml' : a.id === 'explorer' ? 'folder-open' : a.id === 'console' ? 'square-terminal' + : a.id.startsWith('unity') ? 'box' : a.id.startsWith('exe:') ? 'app-window' : a.id.startsWith('bat:') ? 'file-terminal' : a.id === 'web' ? 'globe' : a.id.startsWith('gen:') ? 'wand-sparkles' + : a.id.startsWith('npm-install') ? 'download' : ACTION_ICON[a.group] - document.getElementById('sec-info').innerHTML = - section('cloud', 'Git & Backup', gitBody) + - section('cpu', 'Technik', `
${techChips(d.tech.types) || 'nicht erkannt'}${d.tech.needsInstall ? `${ic('download', 'sm')}npm install nötig` : ''}
`) + - `

${ic('activity')}Aktivität

wird geladen…
` + - section('hard-drive', 'Speicher', storageBody) + - section('file-archive', 'Release archivieren (ZIP)', archiveBody) + - section('wand-sparkles', 'Generator', genBody) + - section('image', 'App-Icon', iconBody) + // the project's own programs (exe + html pages) come first, as big start buttons; + // the pin chooses which one the ▶ on the cards starts + const programs = groups['Programm'] ?? [] + const hasBuild = !!groups['Bauen'] + const prog = d.program // { rel, missing } or null + const progHtml = (programs.length + ? `
${programs.map((a, i) => { + const pinned = a.id === 'program' + return `
+ + ${a.rel ? `` : ''} +
` + }).join('')}
` + : `
Keine fertige exe oder HTML-Seite im Projekt gefunden.${hasBuild ? ' Unter „Bauen“ erzeugen, dann hier starten.' : ''}
`) + + (prog?.missing ? `
${ic('triangle-alert', 'sm')} Festgelegte Datei fehlt: ${escapeHtml(prog.rel)} – neu wählen oder zurücksetzen.
` : '') + + `
+ ${ic('pin', 'sm')}Für ▶ starten festlegen${prog ? `: ${escapeHtml(prog.rel)}` : ' (automatisch)'} +
+ + ${hasPicker ? `` : ''} + + ${prog ? `` : ''} +
+
exe, html, bat oder lnk – Pfad im Projekt.
+
` - loadProjectActivity(name) + const btnGroup = (g) => groups[g] + ? section(ACTION_ICON[g], g, `
${groups[g].map((a) => + ``).join('')}
`) + : '' + const head = (icon, title) => `
${ic(icon, 'sm')}${title}
` + const tools = name === '_Tools' + + projectLastBackup = d.lastBackup ?? null + projectTargets = d.backupTargets ?? [] + const el = document.getElementById('sec-actions') + el.innerHTML = + head('play', 'Starten') + + section('app-window', 'Programm', progHtml) + + btnGroup('Starten') + btnGroup('Einrichten') + btnGroup('Bauen') + + head('shield-check', 'Sichern & Versionieren') + + section('git-branch', 'Git', gitActionsHtml(name, d), { id: 'act-git' }) + + (tools ? '' : section('hard-drive-upload', 'Backup', '
', { id: 'act-backup' })) + + head('rocket', 'Veröffentlichen') + + section('file-archive', 'Release-ZIP', archiveHtml(name, d), { id: 'act-zip' }) + + (tools ? '' : section('rocket', 'itch.io-Seite', itchActionHtml(name, d), { id: 'act-itch' })) + + head('brush-cleaning', 'Aufräumen') + + section('hard-drive', 'Speicher', cleanHtml(d), { id: 'act-clean' }) + + (groups['Werkzeuge'] || groups['Öffnen'] ? head('wrench', 'Werkzeuge') + btnGroup('Werkzeuge') + btnGroup('Öffnen') : '') + + `
${ic('shield-check', 'sm')} Programme starten direkt, Befehle und .bat laufen sichtbar in einem eigenen Konsolenfenster. Eigenen Start-Befehl unter „Bearbeiten“ festlegen.
` + + for (const btn of el.querySelectorAll('.act')) btn.onclick = () => runAction(name, btn.dataset.id) + for (const btn of el.querySelectorAll('.pin')) btn.onclick = () => setProgram(name, btn.dataset.rel) + const input = document.getElementById('fProgram') + document.getElementById('btnSetProgram').onclick = () => setProgram(name, input.value) + input.onkeydown = (e) => { if (e.key === 'Enter') setProgram(name, input.value) } + document.getElementById('btnClearProgram')?.addEventListener('click', () => setProgram(name, '')) + document.getElementById('btnPickProgram')?.addEventListener('click', async () => { + const file = await pickFile(`Programm für ${name} wählen`, d.path) + if (file) setProgram(name, file) + }) + bindGit(name, d) + bindArchive(name) + bindItch(name) + bindClean(name, d) + renderProjectBackup(name) + if (!backup) loadBackup() +} + +function bindGit(name, d) { + const on = (id, fn) => { const el = document.getElementById(id); if (el) el.onclick = fn } + const refreshInfo = () => { load(); loadDetails(name) } + on('btnPush', async () => { + try { await postJson(api(name, 'push')); toast('Push läuft in eigener Konsole', 'cloud-upload') } catch (e) { toast(e.message, 'triangle-alert') } + }) + on('btnCommitPush', async () => { + const msg = document.getElementById('gMsg').value.trim() + if (!msg) { document.getElementById('gMsg').focus(); return toast('Bitte eine Commit-Nachricht eingeben', 'info') } + try { await postJson(api(name, 'push'), { message: msg }); toast('Commit & Push läuft in eigener Konsole', 'cloud-upload') } catch (e) { toast(e.message, 'triangle-alert') } + }) + on('btnRemote', async () => { + try { await postJson(api(name, 'remote'), { url: document.getElementById('gRemote').value }); toast('Remote gespeichert', 'link'); refreshInfo() } catch (e) { toast(e.message, 'triangle-alert') } + }) + const rem = document.getElementById('gRemote') + if (rem) rem.onkeydown = (e) => { if (e.key === 'Enter') document.getElementById('btnRemote').click() } + on('btnGitInit', async () => { + try { await postJson(api(name, 'git-init')); toast('Git eingerichtet (Branch main)', 'git-branch'); refreshInfo() } catch (e) { toast(e.message, 'triangle-alert') } + }) + on('btnCopyKey', async () => { + try { await navigator.clipboard.writeText(d.sshKey.key); toast('SSH-Schlüssel kopiert', 'copy') } catch { toast('Kopieren nicht möglich', 'triangle-alert') } + }) +} + +function bindArchive(name) { const arcSel = document.getElementById('arcWhat') const syncArc = () => { document.getElementById('arcDelWrap').style.display = arcSel.selectedOptions[0]?.dataset.del ? '' : 'none' } arcSel.onchange = syncArc @@ -2023,29 +2196,22 @@ function renderInfo(name, d) { } } document.getElementById('btnArcOpen').onclick = () => postJson(api(name, 'archive/open')).catch((ex) => toast(ex.message, 'triangle-alert')) +} +function bindItch(name) { + document.getElementById('btnItchGen')?.addEventListener('click', async () => { + try { + const r = await postJson(api(name, 'itch/generate')) + toast(r.update ? 'Claude Code prüft das itch.io-Paket – siehe Konsole' : 'Claude Code erstellt das itch.io-Paket – siehe Konsole', 'sparkles') + } catch (e) { toast(e.message, 'triangle-alert') } + }) + document.getElementById('btnItchView')?.addEventListener('click', () => openItch(name)) + document.getElementById('btnItchOpen')?.addEventListener('click', () => postJson(api(name, 'itch/open')).catch((e) => toast(e.message, 'triangle-alert'))) +} + +function bindClean(name, d) { + const s = d.storage document.getElementById('btnScanOne').onclick = () => startScan(name) - const on = (id, fn) => { const el = document.getElementById(id); if (el) el.onclick = fn } - const refreshInfo = () => { load(); loadDetails(name) } - on('btnPush', async () => { - try { await postJson(api(name, 'push')); toast('Push läuft in eigener Konsole', 'cloud-upload') } catch (e) { toast(e.message, 'triangle-alert') } - }) - on('btnCommitPush', async () => { - const msg = document.getElementById('gMsg').value.trim() - if (!msg) { document.getElementById('gMsg').focus(); return toast('Bitte eine Commit-Nachricht eingeben', 'info') } - try { await postJson(api(name, 'push'), { message: msg }); toast('Commit & Push läuft in eigener Konsole', 'cloud-upload') } catch (e) { toast(e.message, 'triangle-alert') } - }) - on('btnRemote', async () => { - try { await postJson(api(name, 'remote'), { url: document.getElementById('gRemote').value }); toast('Remote gespeichert', 'link'); refreshInfo() } catch (e) { toast(e.message, 'triangle-alert') } - }) - const rem = document.getElementById('gRemote') - if (rem) rem.onkeydown = (e) => { if (e.key === 'Enter') document.getElementById('btnRemote').click() } - on('btnGitInit', async () => { - try { await postJson(api(name, 'git-init')); toast('Git eingerichtet (Branch main)', 'git-branch'); refreshInfo() } catch (e) { toast(e.message, 'triangle-alert') } - }) - on('btnCopyKey', async () => { - try { await navigator.clipboard.writeText(d.sshKey.key); toast('SSH-Schlüssel kopiert', 'copy') } catch { toast('Kopieren nicht möglich', 'triangle-alert') } - }) const clean = document.getElementById('btnClean') if (clean) clean.onclick = async () => { const paths = [...document.querySelectorAll('.candcb:checked')].map((cb) => cb.dataset.path) @@ -2063,62 +2229,195 @@ function renderInfo(name, d) { } } -function renderActions(name, d) { - const groups = {} - for (const a of d.actions) (groups[a.group] ??= []).push(a) - const order = ['Einrichten', 'Starten', 'Bauen', 'Werkzeuge', 'Öffnen'] - const ACT_ICON = (a) => a.id === 'vscode' ? 'code-xml' : a.id === 'explorer' ? 'folder-open' : a.id === 'console' ? 'square-terminal' - : a.id.startsWith('unity') ? 'box' : a.id.startsWith('exe:') ? 'app-window' : a.id.startsWith('bat:') ? 'file-terminal' : a.id === 'web' ? 'globe' : a.id.startsWith('gen:') ? 'wand-sparkles' - : a.id.startsWith('npm-install') ? 'download' : ACTION_ICON[a.group] +/* ── itch.io copy view (docs\itchio of the project, lib/itchpack.js) ───── */ - // the project's own programs (exe + html pages) come first, as big start buttons; - // the pin chooses which one the ▶ on the cards starts - const programs = groups['Programm'] ?? [] - const hasBuild = !!groups['Bauen'] - const prog = d.program // { rel, missing } or null - const progHtml = (programs.length - ? `
${programs.map((a, i) => { - const pinned = a.id === 'program' - return `
- - ${a.rel ? `` : ''} -
` - }).join('')}
` - : `
Keine fertige exe oder HTML-Seite im Projekt gefunden.${hasBuild ? ' Unter „Bauen“ erzeugen, dann hier starten.' : ''}
`) - + (prog?.missing ? `
${ic('triangle-alert', 'sm')} Festgelegte Datei fehlt: ${escapeHtml(prog.rel)} – neu wählen oder zurücksetzen.
` : '') - + `
- -
- - ${hasPicker ? `` : ''} - - ${prog ? `` : ''} -
-
` +let itchName = null +let itchData = null - projectLastBackup = d.lastBackup ?? null - projectTargets = d.backupTargets ?? [] - document.getElementById('sec-actions').innerHTML = section('app-window', 'Programm starten', progHtml) - + (name === '_Tools' ? '' : section('hard-drive-upload', 'Sichern', '
')) - + order.filter((g) => groups[g]).map((g) => - section(ACTION_ICON[g], g, `
${groups[g].map((a) => - ``).join('')}
`)).join('') - + `
${ic('shield-check', 'sm')} Programme starten direkt, Befehle und .bat laufen sichtbar in einem eigenen Konsolenfenster. Eigenen Start-Befehl unter „Bearbeiten“ festlegen.
` - for (const btn of document.querySelectorAll('#sec-actions .act')) btn.onclick = () => runAction(name, btn.dataset.id) - for (const btn of document.querySelectorAll('#sec-actions .pin')) btn.onclick = () => setProgram(name, btn.dataset.rel) - const input = document.getElementById('fProgram') - document.getElementById('btnSetProgram').onclick = () => setProgram(name, input.value) - input.onkeydown = (e) => { if (e.key === 'Enter') setProgram(name, input.value) } - document.getElementById('btnClearProgram')?.addEventListener('click', () => setProgram(name, '')) - document.getElementById('btnPickProgram')?.addEventListener('click', async () => { - const file = await pickFile(`Programm für ${name} wählen`, d.path) - if (file) setProgram(name, file) - }) - renderProjectBackup(name) - if (!backup) loadBackup() +async function copyText(text, what) { + try { await navigator.clipboard.writeText(text); toast(`${what} kopiert`, 'copy') } catch { toast('Kopieren nicht möglich', 'triangle-alert') } +} +// formatted: pastes as rich text into itch.io's description editor +async function copyHtml(html, what) { + try { + const tmp = document.createElement('div') + tmp.innerHTML = html + await navigator.clipboard.write([new ClipboardItem({ + 'text/html': new Blob([html], { type: 'text/html' }), + 'text/plain': new Blob([tmp.innerText], { type: 'text/plain' }), + })]) + toast(`${what} formatiert kopiert`, 'copy') + } catch { copyText(html, `${what} (HTML)`) } +} + +async function openItch(name) { + itchName = name + const dlg = document.getElementById('itchDlg') + document.getElementById('itchTitle').textContent = `itch.io-Seite · ${name}` + document.getElementById('itchBody').innerHTML = `
${ic('loader', 'sm')} Lädt…
` + if (!dlg.open) dlg.showModal() + try { + const r = await fetch(api(name, 'itch')) + itchData = await r.json() + if (!r.ok) throw new Error(itchData.error) + renderItch() + } catch (e) { + document.getElementById('itchBody').innerHTML = `
Fehler: ${escapeHtml(e.message)}
` + } +} + +const ITCH_SHORT_MAX = 120 // itch.io "Short description or tagline" + +function htmlText(html) { + const t = document.createElement('template') + t.innerHTML = html + return (t.content.textContent ?? '').replace(/\s+/g, ' ').trim() +} +function firstParagraph(html) { + const t = document.createElement('template') + t.innerHTML = html + const p = [...t.content.querySelectorAll('p')].map((x) => x.textContent.replace(/\s+/g, ' ').trim()).find((x) => x.length > 30) + return p ?? '' +} +// ≤ 120 characters: the first part before " – " / ". " if it fits, else cut at a word +function shorten(s) { + s = String(s ?? '').trim() + if (!s || s.length <= ITCH_SHORT_MAX) return s + for (const sep of [' – ', ' - ', '. ', ': ', ', ']) { + let cut = '' + for (const part of s.split(sep)) { + const next = cut ? cut + sep + part : part + if (next.length > ITCH_SHORT_MAX) break + cut = next + } + if (cut.length >= 40) return cut.replace(/[,:;–-]\s*$/, '').trim() + (sep === '. ' && !/[.!?]$/.test(cut) ? '.' : '') + } + return s.slice(0, ITCH_SHORT_MAX - 1).replace(/\s+\S*$/, '') + '…' +} + +// itch.io tag ideas from the texts and the tech (lowercase, hyphenated like on itch) +const TAG_RULES = [ + [/\bidle\b/, ['idle', 'incremental']], [/clicker/, ['clicker']], [/incremental/, ['incremental']], + [/puzzle|riddle/, ['puzzle', 'casual']], [/\brpg\b|role[- ]playing/, ['rpg']], [/rogue(like|lite)/, ['roguelike']], + [/platform(er)?/, ['platformer']], [/shoot|bullet/, ['shooter']], [/tower defen[cs]e/, ['tower-defense']], + [/strateg/, ['strategy']], [/simulat|management|manage\b|tycoon/, ['simulation', 'management']], + [/arcade/, ['arcade']], [/high ?score|leaderboard/, ['high-score']], [/retro|8-bit|16-bit/, ['retro']], + [/pixel/, ['pixel-art']], [/\b3d\b/, ['3d']], [/\b2d\b/, ['2d']], [/fantasy|magic|dragon/, ['fantasy']], + [/horror|creepy|scary/, ['horror']], [/sci-?fi|spaceship|outer space|galaxy|alien|robot/, ['sci-fi']], + [/relax|cozy|calm|chill/, ['relaxing', 'cozy']], [/cute/, ['cute']], [/funny|humou?r|silly/, ['funny']], + [/physics|ragdoll/, ['physics']], [/survival/, ['survival']], [/card game|card-game|deck-?build/, ['card-game']], + [/rhythm/, ['rhythm']], [/racing|race car|kart/, ['racing']], [/fight|combat|duel|arena/, ['fighting']], + [/medieval|knight|castle/, ['medieval']], [/roman|rome|gladiator|ancient/, ['historical']], + [/zombie/, ['zombies']], [/ocean|underwater|fish|aquarium/, ['underwater']], [/time attack|timer|speed/, ['time-attack']], + [/multiplayer|co-?op\b/, ['multiplayer']], [/local (co-?op|multiplayer)|split ?screen/, ['local-multiplayer']], + [/gamepad|controller/, ['controller']], [/mouse only|mouse-only/, ['mouse-only']], [/touch|mobile|android/, ['mobile']], + [/short|minutes/, ['short']], [/procedural|random(ly)? generated/, ['procedural-generation']], + [/singleplayer|single-player|solo/, ['singleplayer']], [/\bvr\b|virtual reality|quest/, ['virtual-reality']], +] +function suggestTags(text, techTypes) { + const t = String(text).toLowerCase() + const out = [] + const add = (x) => { if (!out.includes(x)) out.push(x) } + for (const [re, tags] of TAG_RULES) if (re.test(t)) tags.forEach(add) + if (techTypes.includes('Unity')) add('unity') + if (techTypes.some((x) => ['Web', 'Vite'].includes(x))) add('html5') + if (!/multiplayer/.test(t)) add('singleplayer') + add('indie') + if (!out.includes('3d') && !out.includes('2d')) add('2d') + if (!out.some((x) => ['rpg', 'horror', 'strategy', 'roguelike'].includes(x))) add('casual') + return out.slice(0, 16) +} + +const ITCH_KINDS = [ + ['cover', 'Cover (Cover image)'], ['theme', 'Banner & Hintergrund (Edit theme)'], + ['promo', 'Promo-Bilder'], ['screenshot', 'Screenshots'], ['other', 'Weitere Bilder'], +] + +function renderItch() { + const d = itchData + const name = itchName + const body = document.getElementById('itchBody') + if (!d.exists) { + body.innerHTML = `
Noch kein itch.io-Paket im Projekt. „itch.io-Seite erzeugen“ in Aktionen startet Claude Code.
` + return + } + const row = (label, f, extra = '') => { + const v = f?.copy ?? '' + return `
+
${label}
+
${v ? escapeHtml(v) : `${f?.placeholder ? 'noch offen' : 'nicht gefunden'}`}${extra}
+ +
` + } + // short description: itch.io allows 120 characters; a longer one gets a shortened suggestion + const descText = htmlText(d.descriptionHtml ?? '') + const tl = d.tagline?.copy ?? '' + const tlCount = tl ? ` ${tl.length} / ${ITCH_SHORT_MAX}` : '' + const shortSugg = tl.length > ITCH_SHORT_MAX ? shorten(tl) : !tl ? shorten(firstParagraph(d.descriptionHtml ?? '')) : '' + const shortRow = shortSugg + ? row(tl ? 'Kürzer (Vorschlag)' : 'Short description (Vorschlag)', { copy: shortSugg }, ` ${shortSugg.length} / ${ITCH_SHORT_MAX}`) + : '' + const words = descText ? descText.split(/\s+/).filter(Boolean).length : 0 + const htmlBlock = (key, title, html, info = '') => html == null ? '' : ` +

${ic('file-code')}${title}${info ? ` ${info}` : ''} + +

+
` + + const otherFields = d.fields.filter((f) => !/^tags/i.test(f.key)) + // tags: the package's own (click = copy one) + suggestions from the texts and the tech + const tagField = d.fields.find((f) => /^tags/i.test(f.key)) + const ownTags = (tagField?.copy ?? '').split(/,\s*/).map((t) => t.trim().toLowerCase()).filter(Boolean) + const genre = d.fields.find((f) => /^genre/i.test(f.key))?.text ?? '' + const sugg = suggestTags(`${d.title?.copy ?? ''} ${tl} ${genre} ${descText}`, editing?.tech?.types ?? []).filter((t) => !ownTags.includes(t)) + const tagChips = (list, cls) => list.map((t) => ``).join('') + const tagsBlock = `

${ic('tags')}Tags itch erlaubt 10 · Klick kopiert einen Tag + ${ownTags.length ? `` : ''}

+ ${ownTags.length ? `
Im Paket (${ownTags.length})${tagChips(ownTags, 'own')}
` : '
Im Paket stehen noch keine Tags.
'} + ${sugg.length ? `
Beispiele / Ideen${tagChips(sugg, 'sugg')}
` : ''} +
` + const imgs = d.images ?? [] + const imgUrl = (rel) => `${api(name, 'itch/file')}?f=${encodeURIComponent(rel)}` + const gallery = ITCH_KINDS.map(([k, label]) => { + const list = imgs.filter((i) => i.kind === k) + if (!list.length) return '' + return `
${label} · ${list.length}
${list.map((i) => + ``).join('')}
` + }).join('') + + body.innerHTML = ` +

${ic('type')}Texte

+ ${row('Title', d.title)} + ${row('Short description', d.tagline, tlCount)} + ${shortRow} +
+ ${d.descriptionHtml == null ? `

${ic('file-code')}Description

Keine description.html im Paket – „Ergänzen mit Claude“ in Aktionen erzeugt sie.
` : ''} + ${htmlBlock('desc', 'Description', d.descriptionHtml, `${words} Wörter`)} + ${tagsBlock} + ${htmlBlock('install', 'Install instructions', d.installHtml)} +

${ic('images')}Bilder Klick zeigt die Datei im Explorer – von dort in itch.io ziehen

+ ${gallery || '
Keine Bilder im Paket.
'} + ${d.media?.length ? `
${ic('film', 'sm')} Weitere Dateien: ${d.media.map(escapeHtml).join(', ')}
` : ''} +
+ ${otherFields.length ? `

${ic('list')}Weitere Felder („Edit game“)

+ ${otherFields.map((f) => `
+
${escapeHtml(f.key)}
+
${f.placeholder ? 'noch offen' : escapeHtml(f.text)}
+ +
`).join('')} +
` : ''} +
${ic('shield-check', 'sm')} Nichts wird automatisch hochgeladen – Texte kopieren, Bilder aus dem Ordner auf itch.io ziehen.
` + + const html = { desc: d.descriptionHtml, install: d.installHtml } + for (const f of body.querySelectorAll('iframe[data-html]')) { + f.srcdoc = `${html[f.dataset.html]}` + } + for (const b of body.querySelectorAll('[data-copy]')) b.onclick = () => copyText(b.dataset.copy, b.dataset.what) + for (const b of body.querySelectorAll('[data-rich]')) b.onclick = () => copyHtml(html[b.dataset.rich], b.dataset.rich === 'desc' ? 'Description' : 'Install-Text') + for (const b of body.querySelectorAll('[data-raw]')) b.onclick = () => copyText(html[b.dataset.raw], 'HTML') + for (const b of body.querySelectorAll('.ishot')) b.onclick = () => postJson(api(name, 'itch/open'), { f: b.dataset.file }).catch((e) => toast(e.message, 'triangle-alert')) } // Saves the program the ▶ starts ('' = choose automatically again). @@ -2508,6 +2807,9 @@ document.getElementById('btnCloseBackup').onclick = closeBackup document.getElementById('search').addEventListener('input', (e) => { searchTerm = e.target.value; render() }) for (const btn of document.querySelectorAll('#tabs button')) btn.onclick = () => { setView(btn.dataset.view); render() } for (const btn of document.querySelectorAll('#ptabs button')) btn.onclick = () => setSection(btn.dataset.sec) +document.getElementById('itchClose').onclick = () => document.getElementById('itchDlg').close() +document.getElementById('itchReload').onclick = () => itchName && openItch(itchName) +document.getElementById('itchOpenDir').onclick = () => itchName && postJson(api(itchName, 'itch/open')).catch((e) => toast(e.message, 'triangle-alert')) document.getElementById('fltStatus').addEventListener('change', render) document.getElementById('fltSort').addEventListener('change', render) document.addEventListener('keydown', (e) => { diff --git a/public/index.html b/public/index.html index de1f64b..0970394 100644 --- a/public/index.html +++ b/public/index.html @@ -547,6 +547,50 @@ .dlg .hint { margin-top: 8px; } body.no-picker #rdPick { display: none; } .dlgfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; } + /* project panel: action groups, jump links, itch.io copy view */ + .agroup-h { display: flex; align-items: center; gap: 6px; margin: 20px 0 -4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); } + .agroup-h::after { content: ""; flex: 1; height: 1px; background: var(--border); } + #sec-actions > .agroup-h:first-child { margin-top: 10px; } + .card-sec h4 .h4r { margin-left: auto; display: flex; gap: 6px; align-items: center; font-weight: 400; } + .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; } + .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; } + details.progset summary::before { content: "▸"; font-size: 10px; } + details.progset[open] summary::before { content: "▾"; } + details.progset .pickrow { margin-top: 8px; } + .dlg.wide { width: 860px; max-height: calc(100vh - 48px); padding: 0; } + .dlg.wide .ihead { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; } + .dlg.wide .ihead h3 { margin: 0; display: flex; gap: 8px; align-items: center; font-size: 16px; } + .dlg.wide .ihead .sp { flex: 1; } + #itchBody { padding: 4px 20px 20px; } + .isec { margin-top: 16px; } + .isec h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 7px; } + .isec h4 > .i { color: var(--accent); } + .isec h4 .h4r { margin-left: auto; display: flex; gap: 6px; } + .copyrow { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; } + .copyrow .cl { color: var(--muted); } + .copyrow .cv { word-break: break-word; } + .copyrow .chip { margin-left: 6px; } + .ipreview { width: 100%; height: 280px; border: 1px solid var(--border); border-radius: 10px; background: #fff; resize: vertical; } + .ipreview.big { height: 520px; } + .tagrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); } + .tagrow .cl { flex: 0 0 150px; color: var(--muted); font-size: 13px; } + .tagc { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; } + .tagc.own { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; } + .tagc.sugg { border-style: dashed; } + .tagc:hover { border-color: var(--accent); } + .igroup { margin-top: 10px; } + .igroup .agroup-h { margin: 0 0 8px; } + .itchgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; } + .ishot { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; font: inherit; font-size: 11px; } + .ishot:hover { border-color: var(--accent); } + .ishot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; background: var(--surface-3); } + .ishot span { display: flex; justify-content: space-between; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } + .ishot small { color: var(--muted); flex: 0 0 auto; } + @media (max-width: 640px) { .copyrow { grid-template-columns: minmax(0, 1fr) auto; } .copyrow .cl { grid-column: 1 / -1; } } /* settings panel: tabs, lists of folders/targets, chips, footer */ #spanel .phead { padding-bottom: 12px; } .sptabs { padding: 0 20px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; } @@ -1063,6 +1107,17 @@ + +
+

itch.io-Seite

+ + + + +
+
+
+
diff --git a/server.js b/server.js index 543646d..53bbe32 100644 --- a/server.js +++ b/server.js @@ -33,6 +33,7 @@ const activity = require('./lib/activity') const itch = require('./lib/itch') const create = require('./lib/create') const archive = require('./lib/archive') +const itchpack = require('./lib/itchpack') const scheduler = require('./lib/scheduler') // The projects folder comes from the settings (lib/settings.js) and can be @@ -460,6 +461,35 @@ app.post('/api/projects/:name/archive/open', (req, res) => { openDetached('explorer.exe', [dir]) res.json({ ok: true }) }) +// itch.io package (\docs\itchio, lib/itchpack.js): read for the copy +// view, its images, open in Explorer, and Claude Code with the itchiocreater skill. +app.get('/api/projects/:name/itch', (req, res) => { + const projectPath = resolveProject(req.params.name) + if (!projectPath) return res.status(404).json({ error: 'unknown project' }) + res.json(itchpack.read(projectPath)) +}) +app.get('/api/projects/:name/itch/file', (req, res) => { + const projectPath = resolveProject(req.params.name) + const f = projectPath && itchpack.file(projectPath, String(req.query.f ?? '')) + if (!f || !/\.(png|jpe?g|gif|webp)$/i.test(f)) return res.status(404).end() + res.setHeader('Cache-Control', 'no-cache') + res.sendFile(f, (err) => { if (err && !res.headersSent) res.status(404).end() }) +}) +app.post('/api/projects/:name/itch/open', (req, res) => { + const projectPath = resolveProject(req.params.name) + if (!projectPath) return res.status(404).json({ error: 'unknown project' }) + const d = itchpack.dir(projectPath) + if (!d) return res.status(404).json({ error: 'Kein itch.io-Ordner im Projekt' }) + const f = req.body?.f ? itchpack.file(projectPath, String(req.body.f)) : null + // explorer wants "/select," as one argument + openDetached('explorer.exe', f ? [`/select,${f}`] : [d]) + res.json({ ok: true }) +}) +app.post('/api/projects/:name/itch/generate', handle(async (req, res) => { + const projectPath = resolveProject(req.params.name) + if (!projectPath) return res.status(404).json({ error: 'unknown project' }) + try { res.json(await itchpack.launch(projectPath, req.params.name)) } catch (e) { res.status(400).json({ error: String(e.message ?? e) }) } +})) // Rename a project and/or move it into another projects folder (lib/create.js). // body: { name, root (folder id, default: its own) } app.post('/api/projects/:name/move', handle(async (req, res) => { @@ -585,6 +615,7 @@ app.get('/api/projects/:name/details', handle(async (req, res) => { sshKey: sshKey(), releaseDirs: archive.findReleaseDirs(projectPath), archives: archive.listArchives(projectPath), + itchPack: itchpack.summary(projectPath), }) }))