feat(website): projects cast (vi-nav load picker) + --demo on all casts
- New projects cast: create → save as library → new (fresh) → load → navigate the picker to the saved project (j, now possible via #24 vi-nav) → Enter loads it, the table is restored. Runs under an isolated --data-dir so the picker lists only this cast's projects. - Turn on the demonstration overlay (--demo, #22 / ADR-0047) for ALL casts, for a consistent viewer experience: special keys show a badge — e.g. [ENTER], and [TAB] at the assistive-editor's completion moment, finally making that keystroke visible. Plain j/k navigation stays unbadged, so the picker navigation is not surfaced. - Generator: per-cast `dataDir` (isolated data root) + default-on `--demo` (opt out with demo:false). All 7 casts regenerated. Convert projects.md → .mdx and embed. Build clean (26 pages). Visual playback of all casts pending a tunnel check.
This commit is contained in:
@@ -19,6 +19,28 @@
|
||||
|
||||
/** The shared library narrative, trimmed per cast. */
|
||||
export const casts = [
|
||||
{
|
||||
name: 'projects',
|
||||
title: 'Save a project, start fresh, then load it back',
|
||||
width: 90,
|
||||
height: 26,
|
||||
typeSpeed: '45ms',
|
||||
dataDir: true, // isolated data root → picker lists only this cast's projects
|
||||
steps: [
|
||||
{ wait: 1000 },
|
||||
{ type: 'create table books with pk', after: 600 },
|
||||
{ type: 'add column to books: title (text)', after: 700 },
|
||||
{ type: "insert into books (title) values ('A Wizard of Earthsea')", after: 700 },
|
||||
{ type: 'show data books', after: 1500 }, // a saved project with content
|
||||
{ type: 'save as', after: 900 }, // opens the name prompt
|
||||
{ type: 'library', enter: true, after: 1500 }, // name it → saved as "library"
|
||||
{ type: 'new', after: 1500 }, // start fresh — the table is gone
|
||||
{ type: 'load', after: 1200 }, // opens the project picker
|
||||
{ type: 'j', enter: false, after: 1000 }, // move the selection to "library"
|
||||
{ key: 'Enter', after: 2000 }, // load it — the table is back
|
||||
{ key: 'CtrlC' }, // quit invisibly (Ctrl-C) — cast ends on the last content frame
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'modes',
|
||||
title: 'Simple mode, then advanced — with the SQL the playground runs for you',
|
||||
|
||||
@@ -110,10 +110,18 @@ function trimCast(outPath, { holdEnd = 1.5 } = {}) {
|
||||
);
|
||||
}
|
||||
|
||||
function yamlFor(cast) {
|
||||
function yamlFor(cast, dataDir) {
|
||||
const keys = keysFor(cast.steps)
|
||||
.map((k) => ` - ${k}`)
|
||||
.join('\n');
|
||||
// Build the launch command. `--demo` turns on the demonstration overlay
|
||||
// (ADR-0047): automatic keystroke badges (so otherwise-invisible keys like
|
||||
// `j` / Tab / Enter are shown) plus `Ctrl+]`-delimited step captions.
|
||||
// `--data-dir` isolates the recording from the user's real projects (and
|
||||
// keeps the load picker listing only this cast's projects).
|
||||
const cmd = ['rdbms-playground'];
|
||||
if (cast.demo !== false) cmd.push('--demo'); // on for all casts (opt out with demo:false)
|
||||
if (dataDir) cmd.push('--data-dir', dataDir);
|
||||
return [
|
||||
'settings:',
|
||||
` width: ${cast.width ?? 90}`,
|
||||
@@ -124,7 +132,7 @@ function yamlFor(cast) {
|
||||
' prompt: "$ "',
|
||||
'instructions:',
|
||||
' - !Interactive',
|
||||
' command: rdbms-playground',
|
||||
` command: ${cmd.join(' ')}`,
|
||||
' keys:',
|
||||
keys,
|
||||
'',
|
||||
@@ -145,7 +153,16 @@ let failures = 0;
|
||||
for (const cast of selected) {
|
||||
const yamlPath = resolve(os.tmpdir(), `autocast-${cast.name}.yaml`);
|
||||
const outPath = resolve(outDir, `${cast.name}.cast`);
|
||||
writeFileSync(yamlPath, yamlFor(cast));
|
||||
// Per-cast isolated data root (so the load picker lists only this cast's
|
||||
// projects and nothing touches the user's real data dir). Wiped fresh each
|
||||
// run for a deterministic picker order.
|
||||
let dataDir = null;
|
||||
if (cast.dataDir) {
|
||||
dataDir = resolve(os.tmpdir(), `rdbms-cast-data-${cast.name}`);
|
||||
rmSync(dataDir, { recursive: true, force: true });
|
||||
mkdirSync(dataDir, { recursive: true });
|
||||
}
|
||||
writeFileSync(yamlPath, yamlFor(cast, dataDir));
|
||||
console.log(`▶ recording ${cast.name} → public/casts/${cast.name}.cast`);
|
||||
const res = spawnSync('autocast', ['--overwrite', yamlPath, outPath], {
|
||||
env,
|
||||
|
||||
Reference in New Issue
Block a user