From d871343ec7e52480377006fe35f39a792adb480e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 12 Nov 2026 02:24:38 +0000 Subject: [PATCH 1/2] Add sync-demo-content script for demo releases and docs YAML Generate apps/demo releases.yaml from CHANGELOG.md and docs.yaml from the README and docs tree, with a --check mode for CI-style drift detection. Regenerated content adds v0.4.0 and fixes the console readme hint slug. Co-authored-by: Charles Berret --- apps/demo/site.config.ts | 2 +- apps/demo/src/content/docs.yaml | 137 +++++++++---- apps/demo/src/content/releases.yaml | 55 +++--- scripts/sync-demo-content.mjs | 290 ++++++++++++++++++++++++++++ scripts/sync-demo-content.test.mjs | 22 +++ 5 files changed, 437 insertions(+), 69 deletions(-) create mode 100644 scripts/sync-demo-content.mjs create mode 100644 scripts/sync-demo-content.test.mjs diff --git a/apps/demo/site.config.ts b/apps/demo/site.config.ts index a6e8ec0..756397c 100644 --- a/apps/demo/site.config.ts +++ b/apps/demo/site.config.ts @@ -11,7 +11,7 @@ export default defineShellsiteConfig({ }, homeFiles: { "readme.txt": - "This site is built on the kit it describes.\nEach file under packages/ is one shellside package; docs/ holds the kit docs.\nls packages/ · cat docs/architecture.txt · cat releases/v0.3.0.txt", + "This site is built on the kit it describes.\nEach file under packages/ is one shellside package; docs/ holds the kit docs.\nls packages/ · cat docs/architecture.txt · cat releases/v0-4-0.txt", }, }, edit: { diff --git a/apps/demo/src/content/docs.yaml b/apps/demo/src/content/docs.yaml index 9039a5a..0cbdcb8 100644 --- a/apps/demo/src/content/docs.yaml +++ b/apps/demo/src/content/docs.yaml @@ -1,40 +1,99 @@ -# docs.yaml — managed by the shellside dev desk -title: Docs +# Generated by scripts/sync-demo-content.mjs — run the script to refresh. +title: 'Docs' items: - - id: readme - title: README — what shellside is - kind: doc - summary: The kit's own front page — contracts over copies, both surfaces, the desk. - url: https://github.com/charlesberret/shellside - visibility: published - - id: architecture - title: Architecture — dual-surface system diagram - kind: doc - summary: How content, visibility, the console VFS, and the dev desk fit together. - url: https://github.com/charlesberret/shellside/blob/main/docs/ARCHITECTURE.md - visibility: published - - id: extraction-map - title: Extraction map — what stays site-local vs kit - kind: doc - summary: The ledger of every marquee piece promoted into a contract. - url: https://github.com/charlesberret/shellside/blob/main/docs/EXTRACTION_MAP.md - visibility: published - - id: divergences - title: Divergences — marquee↔kit alignment log - kind: doc - summary: Where the two trees speak differently, and what was reconciled. - url: https://github.com/charlesberret/shellside/blob/main/docs/DIVERGENCES.md - visibility: published - - id: site-instance-adr - title: ADR — the site-instance contract - kind: decision - summary: site.config.ts + taste + content; the host injects generic surfaces. - url: >- - https://github.com/charlesberret/shellside/blob/main/docs/decisions/2026-10-16-site-instance-contract.md - visibility: published - - id: roadmap - title: Roadmap — release bars and phases - kind: doc - summary: R1 portability, R2 packaging, and the inversion into config-driven sites. - url: https://github.com/charlesberret/shellside/blob/main/docs/ROADMAP.md - visibility: published + - id: 'readme' + title: 'README — what shellside is' + kind: 'doc' + summary: 'The kit''s own front page — contracts over copies, both surfaces, the desk.' + url: 'https://github.com/charlesberret/shellside' + visibility: 'published' + - id: 'alignment' + title: 'Alignment plan — shellside ↔ charlesberret.net' + kind: 'doc' + summary: '**Date:** 2026-10-16 · **Drivers:** a marquee handoff memo (roadmap alignment); patron ask: the marquee ends as an *instance* of shellside — content + config + taste, with the framework carrying the machinery.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/ALIGNMENT.md' + visibility: 'published' + - id: 'architecture' + title: 'Architecture — dual surface' + kind: 'doc' + summary: '- Multi-tenant hosting - Auth for remote editors (local DEV only) - WYSIWYG block editor - Database-backed content' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/ARCHITECTURE.md' + visibility: 'published' + - id: 'are-you-insane' + title: 'Are you insane? This is a really bad idea. — the public console' + kind: 'doc' + summary: 'The editorial desk does write to the server. It is an HTTP API in the dev process, it has no accounts, and a passing `Host` header is the whole of its network check. Running that process where other people can open the port gives them the content files.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/ARE_YOU_INSANE.md' + visibility: 'published' + - id: 'divergences' + title: 'Marquee ↔ kit divergence log — 2026-10-17 — filesystem-ia (kit ahead of marquee)' + kind: 'doc' + summary: 'A running list of places where `charlesberret.net` and shellside describe the same machinery differently. Kit conventions defer to the marquee — the site is product truth; the kit extracts *its* vocabulary.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/DIVERGENCES.md' + visibility: 'published' + - id: 'extraction-map' + title: 'Extraction map (marquee → shellside) — promote soon (high reuse' + kind: 'doc' + summary: 'New since 2026-10-15: `@shellside/edit-protocol` owns `ADMIN_PREVIEW_PARAM` + URL flag helpers.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/EXTRACTION_MAP.md' + visibility: 'published' + - id: 'live-edit' + title: 'Live edit / editorial desk (contract) — guarantees' + kind: 'doc' + summary: 'Full operational notes for the marquee implementation live in `charlesberret.net/docs/LIVE_EDIT_MODE.md`. This doc is the **portable contract**.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/LIVE_EDIT.md' + visibility: 'published' + - id: 'marquee-switch' + title: 'Marquee switch (proof A) — DONE 2026-10-11' + kind: 'doc' + summary: 'charlesberret.net consumes shellside packages. Since the deploy runner only checks out the marquee repo, consumption is via **vendored builds**:' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/MARQUEE_SWITCH.md' + visibility: 'published' + - id: 'product-notes' + title: 'Product notes — positioning (working)' + kind: 'doc' + summary: 'Shellside is a **filesystem-first dual-surface portfolio kit** with a **dev editorial desk** — not WordPress, not Sanity, not a SaaS.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/PRODUCT_NOTES.md' + visibility: 'published' + - id: 'releasing' + title: 'Releasing shellside — steps' + kind: 'doc' + summary: 'The kit is consumed via vendored builds, not a registry — a "release" is a semver tag plus a vendor re-sync into each consumer.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/RELEASING.md' + visibility: 'published' + - id: 'retro-r1' + title: 'R1 retrospective — second-site release + full content portability' + kind: 'doc' + summary: '**Date:** 2026-10-18 · **Scope:** the R1 milestone (edit protocol, content-model, look, dev-api, preview-bridge, reference collections, site-instance contract; the README-path ruling still open inside it) plus the post-milestone IA arc that landed in the same week (console-engine, the host, create-site, filesystem-IA). Written as the R1 close-out.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/RETRO-R1.md' + visibility: 'published' + - id: 'roadmap' + title: 'Shellside roadmap — scaffold → release' + kind: 'doc' + summary: 'This document defines **what release means**, the **feature set**, phased delivery, and a **sync protocol** so framework work tracks marquee refinements instead of forking them.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/ROADMAP.md' + visibility: 'published' + - id: 'visibility' + title: 'Visibility (draft / published) — principle' + kind: 'doc' + summary: '**Visibility is not lifecycle.**' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/VISIBILITY.md' + visibility: 'published' + - id: 'filesystem-ia' + title: 'ADR — filesystem as information architecture' + kind: 'decision' + summary: '**Context:** patron ask — "a simple system directory architecture in which the flat file and folder structure determines page content, headings, subheadings, etc. for the main page, whereas dotfiles and hidden directories appear only in the console view. Site and page configs are given in hidden plaintext files with read-only access in console mode." Extends `2026-10-16-site-instance-contract.md`.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/decisions/2026-10-17-filesystem-ia.md' + visibility: 'published' + - id: 'site-instance-contract' + title: 'ADR — site-instance contract: what a shellside site declares' + kind: 'decision' + summary: '**Context:** the alignment plan (`docs/ALIGNMENT.md`) aims at the marquee becoming an *instance* of shellside — content + config + taste. This is the design spike for the boundary. The marquee''s own Phase-4 roadmap row ("site config, nav-from-config, portable kit") names the same target.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/decisions/2026-10-16-site-instance-contract.md' + visibility: 'published' + - id: 'vendored-package-consumption' + title: 'ADR 2026-10-11: Marquee consumes shellside via vendored builds — context' + kind: 'decision' + summary: 'The marquee (charlesberret.net) deploys from a self-hosted runner that checks out only the marquee repo. A `file:../shellside` dependency cannot resolve there (marquee commit `0ef4785` removed it for exactly this reason), and the kit is not published to any registry. Meanwhile every promoted contract (content-model, edit-protocol, look, dev-api) needs a working consumer for proof A to be real.' + url: 'https://github.com/charlesberret/shellside/blob/main/docs/decisions/2026-10-11-vendored-package-consumption.md' + visibility: 'published' diff --git a/apps/demo/src/content/releases.yaml b/apps/demo/src/content/releases.yaml index 1454f14..42447a9 100644 --- a/apps/demo/src/content/releases.yaml +++ b/apps/demo/src/content/releases.yaml @@ -1,33 +1,30 @@ -title: Releases +title: 'Releases' items: - - id: v0-1-0 - title: v0.1.0 - type: release + - id: 'v0-1-0' + title: 'v0.1.0' + type: 'release' date: '2026-10-15' - summary: First cut — content-model, edit-protocol, look, dev-api contracts. - url: https://github.com/charlesberret/shellside/releases/tag/v0.1.0 - visibility: published - - id: v0-2-0 - title: v0.2.0 - type: release + summary: 'R0: the extraction gate. Contracts and machinery extracted from charlesberret.net and consumed by it.' + url: 'https://github.com/charlesberret/shellside/releases/tag/v0.1.0' + visibility: 'published' + - id: 'v0-2-0' + title: 'v0.2.0' + type: 'release' date: '2026-10-15' - summary: console-vfs + reference /console — the VFS surface shipped. - url: https://github.com/charlesberret/shellside/releases/tag/v0.2.0 - visibility: published - - id: v0-3-0 - title: v0.3.0 - type: release + summary: 'R1 progress: the kit now covers the console surface. Anyone consuming the packages can project their filtered collections into a VFS and serve a working `ls`/`cat` console — as the reference app does — without writing tree plumbing. No consumer action needed; nothing a site relies on broke.' + url: 'https://github.com/charlesberret/shellside/releases/tag/v0.2.0' + visibility: 'published' + - id: 'v0-3-0' + title: 'v0.3.0' + type: 'release' date: '2026-10-16' - summary: >- - console-engine, @shellside/site host, create-site scaffold, leakAudit. - Breaking (0.x): VFS node vocabulary. - url: https://github.com/charlesberret/shellside/releases/tag/v0.3.0 - visibility: published - - id: marquee-adoption - title: Marquee adoption - type: milestone - date: '2026-10-15' - summary: >- - charlesberret.net consumes vendored packages — field styles, design - tokens, edit protocol, console engine — live in production. - visibility: published + summary: 'The kit completes the grand-plan lane: engine mechanics, the config-driven host, the create-site scaffold, and the shared leak audit are all in. The console-vfs node-vocabulary change is **breaking within 0.x** — consumers using `t:"chr"`/`read`/`bin.href` must adopt `t:"c"`/`gen()`/`bin.url`.' + url: 'https://github.com/charlesberret/shellside/releases/tag/v0.3.0' + visibility: 'published' + - id: 'v0-4-0' + title: 'v0.4.0' + type: 'release' + date: '2026-10-17' + summary: 'The filesystem-IA + public-surface release: the content tree is now the site''s information architecture, and the packaged console became a real engine-driven shell.' + url: 'https://github.com/charlesberret/shellside/releases/tag/v0.4.0' + visibility: 'published' diff --git a/scripts/sync-demo-content.mjs b/scripts/sync-demo-content.mjs new file mode 100644 index 0000000..1b5d151 --- /dev/null +++ b/scripts/sync-demo-content.mjs @@ -0,0 +1,290 @@ +/** + * Regenerate apps/demo/src/content/releases.yaml from CHANGELOG.md and + * docs.yaml from README.md and all docs/ markdown files. + * + * node scripts/sync-demo-content.mjs # write + * node scripts/sync-demo-content.mjs --check # exit 1 if out of date + */ +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import yaml from "js-yaml"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const demoContent = path.join(root, "apps", "demo", "src", "content"); +const releasesPath = path.join(demoContent, "releases.yaml"); +const docsPath = path.join(demoContent, "docs.yaml"); +const changelogPath = path.join(root, "CHANGELOG.md"); +const docsDir = path.join(root, "docs"); +const readmePath = path.join(root, "README.md"); + +const REPO = "https://github.com/charlesberret/shellside"; +const check = process.argv.includes("--check"); + +function kebab(name) { + return name.replace(/\.[^.]+$/, "").replace(/_/g, "-").toLowerCase(); +} + +function docIdFromPath(rel) { + const base = path.basename(rel, ".md"); + const m = /^(\d{4}-\d{2}-\d{2}-)(.+)$/.exec(base); + if (m) return m[2]; + return kebab(base); +} + +function parseMarkdown(text) { + const lines = text.replace(/\r\n/g, "\n").split("\n"); + let h1 = ""; + let h2 = ""; + const paragraphs = []; + let buf = []; + let inFence = false; + const flush = () => { + const p = buf.join(" ").trim(); + if (p) paragraphs.push(p); + buf = []; + }; + for (const line of lines) { + if (/^```/.test(line.trim())) { + flush(); + inFence = !inFence; + continue; + } + if (inFence) continue; + if (/^#\s+/.test(line) && !h1) { + flush(); + h1 = line.replace(/^#\s+/, "").trim(); + continue; + } + if (/^##\s+/.test(line) && !h2) { + flush(); + h2 = line.replace(/^##\s+/, "").trim(); + continue; + } + if (/^#+\s/.test(line)) { + flush(); + continue; + } + if (!line.trim()) { + flush(); + continue; + } + if (/^\*\*Status:\*\*/.test(line) || /^---$/.test(line) || /^\|/.test(line)) { + flush(); + continue; + } + buf.push(line.trim()); + } + flush(); + return { h1, h2, paragraphs }; +} + +function docTitle({ h1, h2 }) { + if (!h1) return "Untitled"; + if (!h2) return h1; + if (h1.includes("—") || h1.includes(" - ")) return h1; + const subtitle = h2.replace(/,.*$/, "").toLowerCase(); + return `${h1} — ${subtitle}`; +} + +function pickSummary(paragraphs, fallback = "", h2 = "") { + const skip = (p) => + p.startsWith("|") || + p.length < 12 || + /^[A-Z][a-z]+:\s/.test(p) || + /^(\d+\.|\* )/.test(p) || + /[┌└├│]/.test(p) || + (p.match(/`/g) ?? []).length > 4; + const p = paragraphs.find((x) => !skip(x)); + if (p) return p.replace(/\s+/g, " ").trim(); + if (h2) return h2.replace(/\*\*/g, "").trim(); + return (fallback || paragraphs[0] || "").replace(/\s+/g, " ").trim(); +} + +function compareSemver(a, b) { + const pa = a.split(".").map(Number); + const pb = b.split(".").map(Number); + for (let i = 0; i < 3; i++) { + if ((pa[i] ?? 0) !== (pb[i] ?? 0)) return (pa[i] ?? 0) - (pb[i] ?? 0); + } + return 0; +} + +export function parseChangelogReleases(changelogText) { + const lines = changelogText.replace(/\r\n/g, "\n").split("\n"); + const footerLinks = new Map(); + for (const line of lines) { + const lm = /^\[([^\]]+)\]:\s+(\S+)/.exec(line); + if (lm) footerLinks.set(lm[1], lm[2]); + } + + const releases = []; + let i = 0; + while (i < lines.length) { + const m = /^## \[(\d+\.\d+\.\d+)\]\s*[—-]\s*(\d{4}-\d{2}-\d{2})/.exec(lines[i]); + if (!m) { + i++; + continue; + } + const version = m[1]; + const date = m[2]; + i++; + const summaryLines = []; + while (i < lines.length) { + const line = lines[i]; + if (/^## \[/.test(line) || /^## \[Unreleased\]/.test(line)) break; + if (/^###\s/.test(line)) break; + if (/^-\s+\*\*/.test(line)) break; + if (line.trim() === "") { + if (summaryLines.length) break; + i++; + continue; + } + summaryLines.push(line.trim()); + i++; + } + let summary = summaryLines.join(" ").replace(/\s+/g, " ").trim(); + if (!summary) { + summary = `Release ${version}.`; + } + const tag = `v${version}`; + releases.push({ + id: tag.replace(/\./g, "-"), + title: tag, + type: "release", + date, + summary, + url: footerLinks.get(version) ?? `${REPO}/releases/tag/${tag}`, + visibility: "published", + }); + } + releases.sort((a, b) => compareSemver(a.title.slice(1), b.title.slice(1))); + return releases; +} + +function walkDocs(dir, base = dir, acc = []) { + for (const ent of fs.readdirSync(dir, { withFileTypes: true })) { + const abs = path.join(dir, ent.name); + if (ent.isDirectory()) walkDocs(abs, base, acc); + else if (ent.isFile() && /\.md$/i.test(ent.name)) { + acc.push(path.relative(base, abs).replace(/\\/g, "/")); + } + } + return acc; +} + +export function buildDocsItems() { + const items = []; + if (fs.existsSync(readmePath)) { + const text = fs.readFileSync(readmePath, "utf8"); + const { h1, paragraphs } = parseMarkdown(text); + items.push({ + id: "readme", + title: "README — what shellside is", + kind: "doc", + summary: + "The kit's own front page — contracts over copies, both surfaces, the desk.", + url: REPO, + visibility: "published", + }); + } + + for (const rel of walkDocs(docsDir).sort()) { + const abs = path.join(docsDir, rel); + const text = fs.readFileSync(abs, "utf8"); + const { h1, h2, paragraphs } = parseMarkdown(text); + const inDecisions = rel.startsWith("decisions/"); + items.push({ + id: docIdFromPath(rel), + title: docTitle({ h1: h1 || kebab(path.basename(rel, ".md")), h2 }), + kind: inDecisions ? "decision" : "doc", + summary: pickSummary(paragraphs, "", h2), + url: `${REPO}/blob/main/docs/${rel}`, + visibility: "published", + }); + } + + items.sort((a, b) => { + if (a.id === "readme") return -1; + if (b.id === "readme") return 1; + if (a.kind !== b.kind) { + if (a.kind === "decision" && b.kind !== "decision") return 1; + if (b.kind === "decision" && a.kind !== "decision") return -1; + } + return a.id.localeCompare(b.id); + }); + return items; +} + +/** Fold long strings like committed hand-edited yaml (not js-yaml dump). */ +function formatListFile(title, items, headerComment) { + const body = { title, items }; + let out = headerComment ? `# ${headerComment}\n` : ""; + out += yaml.dump(body, { + lineWidth: 78, + quotingType: "'", + forceQuotes: true, + noRefs: true, + }); + return out; +} + +export function generateReleasesYaml() { + const changelog = fs.readFileSync(changelogPath, "utf8"); + const items = parseChangelogReleases(changelog); + if (!items.length) throw new Error("No semver releases found in CHANGELOG.md"); + return formatListFile("Releases", items); +} + +export function generateDocsYaml() { + const items = buildDocsItems(); + return formatListFile( + "Docs", + items, + "Generated by scripts/sync-demo-content.mjs — run the script to refresh.", + ); +} + +function readUtf8(p) { + return fs.readFileSync(p, "utf8"); +} + +function failIfDiff(label, expected, actualPath) { + const actual = fs.existsSync(actualPath) ? readUtf8(actualPath) : ""; + if (expected !== actual) { + console.error(`${label}: out of date (run node scripts/sync-demo-content.mjs)`); + if (check) process.exitCode = 1; + return false; + } + return true; +} + +const isMain = + process.argv[1] && + path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url)); + +if (isMain) { + const releasesYaml = generateReleasesYaml(); + const docsYaml = generateDocsYaml(); + + if (check) { + failIfDiff("releases.yaml", releasesYaml, releasesPath); + failIfDiff("docs.yaml", docsYaml, docsPath); + const changelogVersions = parseChangelogReleases(readUtf8(changelogPath)).map((r) => r.title); + for (const v of changelogVersions) { + if (!releasesYaml.includes(v)) { + console.error(`releases.yaml: missing ${v}`); + process.exitCode = 1; + } + } + if (process.exitCode) process.exit(process.exitCode); + console.log(`sync-demo-content: ok (${changelogVersions.length} releases, docs current)`); + } else { + fs.writeFileSync(releasesPath, releasesYaml); + fs.writeFileSync(docsPath, docsYaml); + const n = parseChangelogReleases(readUtf8(changelogPath)).length; + const d = buildDocsItems().length; + console.log(`Wrote ${releasesPath} (${n} releases)`); + console.log(`Wrote ${docsPath} (${d} docs)`); + } +} diff --git a/scripts/sync-demo-content.test.mjs b/scripts/sync-demo-content.test.mjs new file mode 100644 index 0000000..1b1e1aa --- /dev/null +++ b/scripts/sync-demo-content.test.mjs @@ -0,0 +1,22 @@ +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { parseChangelogReleases } from "./sync-demo-content.mjs"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const changelog = fs.readFileSync(path.join(root, "CHANGELOG.md"), "utf8"); + +const releases = parseChangelogReleases(changelog); +assert.equal(releases.length, 4); +assert.ok(releases.some((r) => r.id === "v0-4-0" && r.title === "v0.4.0")); +assert.ok(compareSemverOrder(releases[0].title, releases[releases.length - 1].title) < 0); + +function compareSemverOrder(a, b) { + const pa = a.slice(1).split(".").map(Number); + const pb = b.slice(1).split(".").map(Number); + for (let i = 0; i < 3; i++) { + if ((pa[i] ?? 0) !== (pb[i] ?? 0)) return (pa[i] ?? 0) - (pb[i] ?? 0); + } + return 0; +} From 43788201d26a0b429e77801ac5de19430a68d0dd Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 12 Nov 2026 02:28:26 +0000 Subject: [PATCH 2/2] Fix reference dev desk paths for filesystem-IA content layout Drop profile and pageCopy from edit.files until the packaged admin page enumerates per-dir IA layouts; unblocks check-desk CI smoke. Co-authored-by: Charles Berret --- apps/reference/site.config.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/reference/site.config.ts b/apps/reference/site.config.ts index 531fd9e..0762e81 100644 --- a/apps/reference/site.config.ts +++ b/apps/reference/site.config.ts @@ -17,8 +17,6 @@ export default defineShellsiteConfig({ work: "work", writing: "writing.yaml", records: "records.yaml", - profile: "profile.yaml", - pageCopy: "page-copy.yaml", }, policy: "./src/lib/edit-policy.ts", },