Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Unify site publishing: one publish step + fix source-of-truth edits

nyblnet2bf39a0c5997
diff --git a/.gitignore b/.gitignore
index 9d6177a1..fc4ef904 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,10 @@ testing/
# os cruft
.DS_Store
*.tsbuildinfo
+# site/ is the fully GENERATED deploy tree (release.mjs assembles it, then
+# scripts/publish-site.mjs mirrors it into the bento-site repo). Never edit it
+# by hand — the authored sources live in site-src/ (landing/guestbook/404/qr
+# pages, tracked) and scripts/ (gallery decks). Edit those, then rebuild.
site/
working/
.dev.vars
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index 0f44ec44..73e191ee 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -35,15 +35,30 @@ verify the manifest signature against the public key embedded in every shell.
2. Commit, tag: `git tag vX.Y.Z`.
3. `node scripts/release.mjs` — builds, signs, assembles `./site/`
(CNAME, landing page, live demo, download, signed manifest).
-4. Publish `./site/` to the public site repo:
+4. Publish `./site/` to the public site repo — one step:
```sh
- rsync -a --delete --exclude .git site/ ../bento-site/
- git -C ../bento-site add -A
- git -C ../bento-site commit -m "release vX.Y.Z"
- git -C ../bento-site push
+ node scripts/publish-site.mjs "release vX.Y.Z"
```
+ This mirrors the assembled `site/` tree into `../bento-site` (or
+ `$BENTO_SITE_DIR`) and pushes it. **`site/` is fully generated — never edit
+ it by hand.** The authored sources are tracked in *this* repo and assembled
+ into `site/` by `release.mjs`:
+ - `site-src/` — the landing (`landing.html`), guestbook, 404 and QR pages.
+ - `scripts/build-example-decks.mjs` + `scripts/gallery-photos/` — the gallery.
+
+ So a content-only change is: edit `site-src/` (or the deck scripts) → rebuild
+ → publish. For a copy tweak without cutting a new app version you can rebuild
+ just the landing and publish in one go:
+
+ ```sh
+ node scripts/build-landing.mjs site/index.html
+ node scripts/publish-site.mjs "landing: copy tweak" # add --gallery to regen decks
+ ```
+
+ Preview any publish first with `--dry`.
+
5. Also attach `site/releases/slides/Bento_Slides.bento.html` to a GitHub
Release for the tag — download counts, release-watch notifications, and a
permanent per-version archive.
diff --git a/scripts/publish-site.mjs b/scripts/publish-site.mjs
new file mode 100755
index 00000000..4a5879d9
--- /dev/null
+++ b/scripts/publish-site.mjs
@@ -0,0 +1,76 @@
+#!/usr/bin/env node
+// The ONE publish step for bento.page.
+//
+// `site/` is the assembled deploy tree: AUTHORED sources (landing, guestbook
+// page, agents.md, config — tracked in this repo) plus GENERATED artifacts
+// (the signed shell, the manifest, the gallery decks, the *.bento.html demos —
+// gitignored here, rebuilt by release.mjs / build-example-decks.mjs). This
+// script mirrors that tree into the public `bento-site` repo and pushes it, so
+// nothing is hand-copied file-by-file and the guestbook / gallery imagery can't
+// silently drift between sessions.
+//
+// node scripts/publish-site.mjs "commit message" [--gallery] [--dry]
+//
+// --gallery regenerate the gallery decks first (needs a built shell at
+// slides/dist-single/ — run `npm run build:single` or a release).
+// --dry show what would change; don't commit or push.
+//
+// Destination repo: $BENTO_SITE_DIR, else ../bento-site beside this repo.
+
+import { execFileSync } from 'node:child_process'
+import { existsSync, readFileSync } from 'node:fs'
+import { dirname, join, resolve } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const root = dirname(dirname(fileURLToPath(import.meta.url)))
+const site = join(root, 'site')
+const dest = process.env.BENTO_SITE_DIR
+ ? resolve(process.env.BENTO_SITE_DIR)
+ : resolve(root, '..', 'bento-site')
+
+const args = process.argv.slice(2)
+const dry = args.includes('--dry')
+const doGallery = args.includes('--gallery')
+const message = args.find((a) => !a.startsWith('--'))
+
+const die = (m) => { console.error(`✗ ${m}`); process.exit(1) }
+const run = (cmd, cmdArgs, opts = {}) =>
+ execFileSync(cmd, cmdArgs, { stdio: 'inherit', ...opts })
+const capture = (cmd, cmdArgs, opts = {}) =>
+ execFileSync(cmd, cmdArgs, { encoding: 'utf8', ...opts }).trim()
+
+// ---- preflight -------------------------------------------------------------
+if (!existsSync(join(site, 'index.html'))) die(`no assembled site at ${site} — run release.mjs first`)
+if (!existsSync(join(dest, '.git'))) die(`destination is not a git repo: ${dest} (set BENTO_SITE_DIR?)`)
+if (!dry && !message) die('a commit message is required (or pass --dry)')
+
+// ---- optional: regenerate the gallery --------------------------------------
+if (doGallery) {
+ const shell = join(root, 'slides/dist-single/Bento_Slides.bento.html')
+ if (!existsSync(shell)) die('--gallery needs a built shell — run `npm run build:single` first')
+ console.log('• regenerating gallery decks → site/gallery/')
+ run('node', [join(root, 'scripts/build-example-decks.mjs'), join(site, 'gallery')])
+}
+
+// ---- mirror site/ → dest (authoritative; never touches dest/.git) ----------
+const rsyncFlags = ['-a', '--delete', '--exclude', '.git']
+if (dry) rsyncFlags.push('-n', '-v', '--itemize-changes')
+console.log(`• ${dry ? 'DRY-RUN ' : ''}mirroring ${site}/ → ${dest}/`)
+run('rsync', [...rsyncFlags, `${site}/`, `${dest}/`])
+if (dry) { console.log('\n(dry run — the itemized list above is the pending change set; nothing published)'); process.exit(0) }
+
+// ---- commit + push ---------------------------------------------------------
+run('git', ['-C', dest, 'add', '-A'])
+const status = capture('git', ['-C', dest, 'status', '--porcelain'])
+if (!status) { console.log('✓ nothing changed — bento-site already up to date'); process.exit(0) }
+
+run('git', ['-C', dest, 'commit', '-q', '-m', message])
+run('git', ['-C', dest, 'push', '-q', 'origin', 'HEAD'])
+const head = capture('git', ['-C', dest, 'rev-parse', '--short', 'HEAD'])
+const ver = (() => {
+ try {
+ const m = JSON.parse(readFileSync(join(dest, 'releases/slides/manifest.json'), 'utf8'))
+ return JSON.parse(m.payload).version
+ } catch { return '?' }
+})()
+console.log(`\n✓ published to bento-site @ ${head} (app v${ver})`)
diff --git a/site-src/guestbook.html b/site-src/guestbook.html
index 7ac4cbcf..37f2f47a 100644
--- a/site-src/guestbook.html
+++ b/site-src/guestbook.html
@@ -35,7 +35,7 @@ ul { margin: 0 0 18px 1.2em; line-height: 1.9; }
epochs get archived; everything else evaporates.</li>
<li>Your saved copy keeps working forever, offline. That's the product.</li>
</ul>
- <a class="btn" href="/guestbook.bento.html">✍️&nbsp; Open the Guestbook</a>
+ <a class="btn" href="/guestbook.bento.html"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:7px"><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>Open the Guestbook</a>
<a class="ghost" href="/guestbook.bento.html" download="Guestbook.bento.html">⤓ Download</a>
<p class="fine">Under the hood this is stock Bento collaboration — E2EE
(AES-GCM), a <a href="/">blind relay</a> that stores ciphertext, and a CRDT
diff --git a/site-src/landing.html b/site-src/landing.html
index aa646822..3d7fa671 100644
--- a/site-src/landing.html
+++ b/site-src/landing.html
@@ -622,13 +622,14 @@ body.kdeck header, body.kdeck footer { display: none; }
<div class="kicker rv">Local-first · AI-native</div>
<hr class="hairline rv" style="max-width:220px">
<h2 class="rv">Designed for AI.<br>Entirely optional.</h2>
- <p class="lede rv d1">Bento is local-first <b>and</b> built for the AI era. The document is plain JSON sitting openly in the file — so a chatbot round-trips it and an agent harness <b>edits the file directly</b>. That's how the gallery above was made. No converters, no uploads, no .pptx archaeology: <b>orders of magnitude leaner</b> than driving PowerPoint with a bot. And if you never touch AI, nothing here ever will either.</p>
+ <p class="lede rv d1">Bento is local-first <b>and</b> built for the AI era. The document is plain JSON sitting openly in the file — so a chatbot round-trips it and an agent harness <b>edits the file directly</b>. That's how the gallery above was made. No converters, no uploads, no .pptx archaeology: <b>orders of magnitude leaner</b> than driving PowerPoint with a bot. Bringing an old deck across? Hand the <b>.pptx</b> to any AI alongside <b>bento.page/agents.md</b> and ask it to rebuild — you get real Bento slides (morph, live charts), <b>re-authored, not lossily imported</b>. And if you never touch AI, nothing here ever will either.</p>
<div class="chips rv d2">
<span class="chip"><b>The format is the API</b></span>
<span class="chip">No binary .pptx to decode</span>
<span class="chip">Agents edit the file in place</span>
<a class="chip" href="/agents.md" style="text-decoration:none"><b>bento.page/agents.md</b> — the recipe for your agent</a>
<span class="chip">Nothing phones home</span>
+ <span class="chip">You choose the AI to use</span>
</div>
</div>
<div class="codebox rv d1" aria-label="The document format, as it appears inside every file"><span class="c">&lt;!-- inside every .bento.html --&gt;</span>