diff --git a/docs/assets/docs.js b/docs/assets/docs.js index ed81f6e..d6d5f20 100644 --- a/docs/assets/docs.js +++ b/docs/assets/docs.js @@ -6,7 +6,9 @@ // to write the outline), or a document (its blocks, whose each is, and // the rest of the skill). start --new "" makes a new space. // node docs.js -C <folder> outline "<title>" "<heading>" ... [--pages n] the title and every heading, each -// section saying "Writing…", on open tabs and saved. +// section saying "Writing…", on open tabs and saved, after any lines the +// person typed on the blank page. --their-title in place of the title: +// their first line is the title. // node docs.js -C <folder> write <n> <file|-> ["<status>"] section n (0 is the opening, before the // first heading) from plain text: shown on open tabs, then saved. // node docs.js -C <folder> blocks [n] each block: its id, whose it is, its words. Only reads. @@ -245,14 +247,16 @@ function planBlock(html, id, text, { mine, sigWas }) { return { edits, replacements: [{ old_string: secOld, new_string: secNew }, { old_string: LEDGER.exec(html)[0], new_string: ledgerTag(NL) }], kept: [], ledger: NL }; } -// The starter with this document's title and headings, each with a placeholder. -function buildPage(starter, title, headings, pages) { +// The starter with this document's title and headings, each with a placeholder, after whatever its <main> holds +// (the person's typed lines). theirTitle: the person's first line is the title, so the page gets no title of +// the tool's, and the tab takes their line's words. +function buildPage(starter, title, headings, pages, theirTitle) { const L = { v: 1, sections: headings.length, pages: pages || null, next: {}, blocks: {} }; // A placeholder holds no words: the page draws "Writing…" in it only while it's empty, so words a person types // into it look like their words, with nothing of the tool's to take off. const ph = { tag: "p", html: "" }; const blk = (b, id, cls) => { L.blocks[id] = blockSig(b); return render(b, id, cls); }; - const parts = [blk({ tag: "h1", html: esc(title) }, "d-title")]; + const parts = theirTitle ? [] : [blk({ tag: "h1", html: esc(title) }, "d-title")]; const secs = ["", ...headings]; secs.forEach((hd, n) => { const key = `d-s${n}`; L.next[key] = 2; @@ -265,7 +269,7 @@ function buildPage(starter, title, headings, pages) { const swaps = [ [/<title>[\s\S]*?<\/title>/, () => `<title>${esc(title)}`], [//, () => ledgerTag(L)], - [/(
]*>)[\s\S]*?(<\/main>)/, (m, a, b) => `${a}\n${parts.join("\n")}\n${b}`], + [/(
]*>)([\s\S]*?)(<\/main>)/, (m, a, kept, b) => `${a}${kept.replace(/\s+$/, "")}\n${parts.join("\n")}\n${b}`], ]; let page = starter; for (const [re, to] of swaps) { if (!re.test(page)) throw new Error(`the starter has no ${re.source.slice(0, 30)}`); page = page.replace(re, to); } @@ -301,13 +305,55 @@ function newSpaceSlots(html) { return titles.length === 1 && /[^<]*<\/title>/.test(html) ? html.replace(/<title>[^<]*<\/title>/, "<title>T") : null; } let BLANKS = null; +const blanks = () => BLANKS || (BLANKS = [STARTER, BLANK_LIVE_LINK, BLANK_LIVE_LINK_NODESC, BLANK_NEW_SPACE].map((f) => flat(fs.readFileSync(f, "utf8")))); function blank(html) { - BLANKS = BLANKS || [STARTER, BLANK_LIVE_LINK, BLANK_LIVE_LINK_NODESC, BLANK_NEW_SPACE].map((f) => flat(fs.readFileSync(f, "utf8"))); - const h = flat(html), slotted = liveLinkSlots(String(html)), sf = slotted === null ? null : flat(slotted); + const B = blanks(), h = flat(html), slotted = liveLinkSlots(String(html)), sf = slotted === null ? null : flat(slotted); const ns = newSpaceSlots(String(html)), nf = ns === null ? null : flat(ns); - return h === "" || h === BLANKS[0] || sf === BLANKS[1] || sf === BLANKS[2] || nf === BLANKS[3]; + return h === "" || h === B[0] || sf === B[1] || sf === B[2] || nf === B[3]; } -const foreign = (html) => !ledgerOf(html) && !blank(html); +// Docs' starter with lines the person typed on it, and nothing else: the app saves the first line inside the +// starter's
, or in above it (before 16 Nov 2026). The lines are the person's: each stays where it +// is, as it is, and the document goes after them. Text blocks only, so a picture, a frame, a script, a form, a +// handler or an id of the tool's makes the page theirs. Answers the lines with their words, or null. +const TYPED_BLOCK = new Set("p h1 h2 h3 h4 h5 h6 ul ol blockquote pre".split(" ")); +const TYPED_INSIDE = new Set("li p ul ol a b strong i em u s code br span mark sub sup".split(" ")); +// Attributes are read as the browser reads them, quoted or not, and only in forms whose meaning needs no +// character references worked out: what's written is what the browser sees. An id is letters, digits, - and _, +// and never one of the tool's (d-…): a rollback that removes d-title would take the person's line with it. A link +// is http(s), mailto, tel, or within the site, and its only reference is &, so no entity hides a scheme. +const SAFE_ID = /^[A-Za-z0-9_-]+$/; +const SAFE_SCHEMES = new Set(["http", "https", "mailto", "tel"]); +function safeHref(raw) { + if (raw.replace(/&/g, "").includes("&")) return false; + const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(raw.replace(/&/g, "&").replace(/[\s\u0000-\u001f]+/g, "")); + return !scheme || SAFE_SCHEMES.has(scheme[1].toLowerCase()); +} +function typedOk(html, el, top) { + if (!(top ? TYPED_BLOCK : TYPED_INSIDE).has(el.name)) return false; + for (const m of html.slice(el.start + el.name.length + 1, el.openEnd - 1).matchAll(/([^\s=\/]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+))?/g)) { + const name = m[1].toLowerCase(), v = (m[2] || "").replace(/^["']|["']$/g, ""); + if (!["class", "data-ss-id", "href", "title", "dir", "lang"].includes(name)) return false; + if (name === "data-ss-id" && (!SAFE_ID.test(v) || /^d-/i.test(v))) return false; + if (name === "href" && (el.name !== "a" || !safeHref(v))) return false; + } + return el.children.every((c) => typedOk(html, c, false)); +} +function typedLines(html) { + if (ledgerOf(html)) return null; + const root = parse(html), bodies = []; + walk(root, (e) => { if (e.name === "body") bodies.push(e); }); + const main = bodies.length === 1 && byId(root, "d-doc"); + if (!main || main.name !== "main" || main.parent !== bodies[0]) return null; + const sib = bodies[0].children, i = sib.indexOf(main); + if (i !== sib.length - 1) return null; + const lines = [...sib.slice(0, i), ...main.children]; + if (!lines.length || !lines.every((el) => typedOk(html, el, true))) return null; + let rest = html; + for (const el of lines.slice().sort((a, b) => b.start - a.start)) rest = rest.slice(0, el.start) + rest.slice(el.end); + if (flat(rest) !== blanks()[0]) return null; + return lines.map((el) => ({ inMain: el.parent === main, text: words(inner(html, el)) })); +} +const foreign = (html) => !ledgerOf(html) && !blank(html) && !typedLines(html); const isConflict = (e) => e && (e.code === "conflict" || /conflict/i.test(String(e.message))); function describe(html, only) { @@ -498,6 +544,13 @@ const COMMANDS = { ctx.io.push({ status: "Stopped: this space holds another page", stopped: true }); throw new Error("start: this space holds a page someone made, and it's never written over. Nothing changed. Ask the person whether to write it on a new page (start --new, in a new folder). If they say to write on this page anyway, tell them you can't replace a page that has content yet, and write it on a new page all the same. Never save over their page any other way"); } + const said = (typedLines(html) || []).filter((l) => l.text); + if (said.length) { + const one = said.length === 1; + ctx.log(`The page is blank but for ${one ? "a line" : said.length + " lines"} the person typed, quoted below. ${one ? "It's" : "They're"} theirs: ${one ? "it stays" : "they stay"} where ${one ? "it is" : "they are"}, as typed, and the document goes after ${one ? "it" : "them"}. Read ${one ? "it" : "them"} as the brief, in their words:`); + for (const l of said.slice(0, 20)) ctx.log(` ${JSON.stringify(l.text.slice(0, 300))}`); + ctx.log(`If their first line is the document's title, write the outline without a title of yours: outline --their-title "" "" … Their line stays the title.`); + } ctx.log("\n" + fs.readFileSync(OUTLINE, "utf8")); return 0; }, @@ -507,16 +560,36 @@ const COMMANDS = { let pages = null; const i = args.indexOf("--pages"); if (i >= 0) { pages = +args[i + 1]; args = args.slice(0, i).concat(args.slice(i + 2)); if (!(pages >= 1)) throw new Error("--pages takes a number: the length the person asked for"); } - const title = plain("title", args[0]), headings = args.slice(1).map((h) => plain("heading", h)); - if (!title || !headings.length) throw new Error("outline: give the title, then every heading"); + const theirs = args.includes("--their-title"); + if (theirs) args = args.filter((x) => x !== "--their-title"); + const title = theirs ? null : plain("title", args[0]), headings = args.slice(theirs ? 0 : 1).map((h) => plain("heading", h)); + if ((!theirs && !title) || !headings.length) throw new Error("outline: give the title, then every heading (or --their-title, then every heading, when the person's first line is the title)"); const r = ctx.io.read(), html = r.files["index.html"] || ""; if (ledgerOf(html)) throw new Error("outline: this space has its outline already. Write its sections; for another document, start --new in a new folder"); if (foreign(html)) throw new Error("outline: this space holds a page someone made, and it's never written over. Nothing changed. Ask the person whether to write it on a new page (start --new, in a new folder). If they say to write on this page anyway, tell them you can't replace a page that has content yet, and write it on a new page all the same. Never save over their page any other way"); - const page = buildPage(fs.readFileSync(STARTER, "utf8"), title, headings, pages); - const a = ctx.io.push({ html: page }); - ctx.io.save({ parent: r.version, label: "Outline", files: [{ path: "index.html", content: page }] }); + const typed = typedLines(html), first = typed && typed.find((l) => l.text); + if (theirs && !first) throw new Error("outline --their-title: the page has no line the person typed to be its title. Give the title, then every heading"); + const page = buildPage(typed ? html : fs.readFileSync(STARTER, "utf8"), theirs ? first.text : title, headings, pages, theirs); + let a; + if (typed) { + // On the person's lines, the outline goes in after them, as one append on open tabs and exact changes in the + // save: their lines are never redrawn or saved over. + const m0 = byId(parse(html), "d-doc"), m1 = byId(parse(page), "d-doc"), at = m1.openEnd + inner(html, m0).replace(/\s+$/, "").length; + const edit = { anchor: "d-doc", op: "append_into", html: page.slice(at, m1.closeStart).trim() }; + const swap = (re) => ({ old_string: re.exec(html)[0], new_string: re.exec(page)[0] }); + a = ctx.io.push({ edits: [edit] }); + try { ctx.io.save({ parent: r.version, label: "Outline", replacements: [swap(/[\s\S]*?<\/title>/), swap(LEDGER), { old_string: outer(html, m0), new_string: outer(page, m1) }], live_patch: [edit] }); } + catch (e) { + if (!isConflict(e)) throw e; + ctx.io.push({ edits: [...(theirs ? [] : ["d-title"]), ...["", ...headings].map((_, k) => `d-s${k}`)].map((id) => ({ anchor: id, op: "remove" })) }); + throw new Error("outline: the person changed the page while the outline went in, so nothing was saved, and open tabs show their page again. Run outline again"); + } + } else { + a = ctx.io.push({ html: page }); + ctx.io.save({ parent: r.version, label: "Outline", files: [{ path: "index.html", content: page }] }); + } ctx.io.push({ status: "Writing the opening" }); // a save takes the work card down: the work isn't done - ctx.log(`the title and ${headings.length} headings are on the page${a && a.tabs_open !== undefined ? ` (${a.tabs_open} tab${a.tabs_open === 1 ? "" : "s"} open)` : ""}, and saved`); + ctx.log(`${theirs ? "under the person's title, " : "the title and "}${headings.length} headings are on the page${a && a.tabs_open !== undefined ? ` (${a.tabs_open} tab${a.tabs_open === 1 ? "" : "s"} open)` : ""}, and saved`); ctx.log("\n" + fs.readFileSync(WRITING, "utf8")); return 0; }, diff --git a/docs/references/outline.md b/docs/references/outline.md index 68655df..dddc278 100644 --- a/docs/references/outline.md +++ b/docs/references/outline.md @@ -7,6 +7,8 @@ The status is on the page. Next, in a few seconds, put up the outline: - The title is the document's name, in the person's words. - The headings are its sections: three to seven, short and plain, in the order a reader needs them. You can't add one later, so name each part the ask needs. +- When `start` quoted lines the person typed and their first line is the title, give + `--their-title` in place of the title: their line stays the title, as they typed it. - `--pages <n>` when the ask names a length ("a one-page proposal": `--pages 1`). `done` then checks the printed length against it. diff --git a/tests/review.js b/tests/review.js index 55e2ab1..2763030 100644 --- a/tests/review.js +++ b/tests/review.js @@ -377,7 +377,7 @@ module.exports = function ({ test, ROOT }) { "<html><head></head><body></body></html>A loose word", EMPTY, '<!doctype html><html lang="en"><head><meta charset="utf-8"><title>docs d1', - starter.replace("
", "

Mine.

"), + starter.replace("
", '

Mine.

'), // typed lines are written around; a picture isn't one llA.replace('

Mine.

]*>)[^<]*/, "$1Bold title"), llA.replace("", ''), diff --git a/tests/run.js b/tests/run.js index 91b55e2..2f72f30 100644 --- a/tests/run.js +++ b/tests/run.js @@ -7,7 +7,7 @@ function test(name, fn) { try { fn(); pass++; console.log(`ok ${name}`); } catch (e) { fail++; console.log(`FAIL ${name}\n ${String(e && e.stack || e).split("\n").slice(0, 3).join("\n ")}`); } } -for (const f of ["ownership", "commands", "comments", "property", "review"]) { +for (const f of ["ownership", "commands", "comments", "property", "review", "typed"]) { try { require(path.join(__dirname, f + ".js"))({ test, ROOT }); } catch (e) { fail++; console.log(`FAIL ${f}.js didn't load: ${String(e.message).split("\n")[0]}`); } } diff --git a/tests/typed.js b/tests/typed.js new file mode 100644 index 0000000..3e0b1fb --- /dev/null +++ b/tests/typed.js @@ -0,0 +1,157 @@ +// Docs' starter with lines the person typed on it: Docs' page to write on. Every typed line stays where it is, +// byte for byte, on open tabs and in every save; the document goes after them; start quotes them to the agent. +// Anything else on the starter makes the page the person's, as before. Loaded by tests/run.js. +"use strict"; +const assert = require("assert"); +const path = require("path"); +const fs = require("fs"); +const os = require("os"); +const { fakeSpace } = require("./fake"); + +module.exports = function ({ test, ROOT }) { + const D = require(path.join(ROOT, "docs/assets/docs.js")); + const starter = fs.readFileSync(path.join(ROOT, "docs/references/page.html"), "utf8"); + const go = (s, dir, args, stdin) => { const lines = []; const code = D.run({ io: s.io, dir, log: (l) => lines.push(String(l)), stdin: () => stdin }, args); return { code, out: lines.join("\n") }; }; + const tmp = () => fs.mkdtempSync(path.join(os.tmpdir(), "docs-typed-")); + const count = (hay, needle) => hay.split(needle).length - 1; + // The two places the app saves a first line on the starter: inside its

(from 16 Nov 2026), and in + // above it (before). Both as the app writes them: a bare element on its own line. + const inMain = (lines) => starter.replace('
\n', `
\n${lines}\n`); + const aboveMain = (lines) => starter.replace('\n', `\n${lines}\n`); + + // The whole run on a page with typed lines: each one is checked after every command, saved and on open tabs. + const walk = (page, lines, outline) => { + const s = fakeSpace({ "index.html": page }), dir = tmp(), runs = []; + const check = (what) => { + for (const l of lines) assert.strictEqual(count(s.files["index.html"], l), 1, `${what}: ${l} kept as typed`); + for (const p of s.pushes) { + assert.ok(!p.html, `${what}: no whole page pushed over the person's lines`); + for (const e of p.edits || []) for (const l of lines) assert.ok(!(e.html || "").includes(l), `${what}: a live ${e.op} carries ${l}`); + } + for (const v of s.saves) { + assert.ok(!v.files, `${what}: no whole-page save over the person's lines`); + for (const r of v.replacements || []) for (const l of lines) assert.strictEqual(count(r.old_string, l), count(r.new_string, l), `${what}: a save changes ${l}`); + } + }; + for (const args of [["start", s.id], outline, ["write", "0", "-", "Why I'm writing."], ["write", "1", "-", "The first part."], ["write", "2", "-", "The second part."], ["blocks"], ["done"]]) { + const stdin = args[0] === "write" ? args.pop() : null; + const r = go(s, dir, args, stdin); + assert.strictEqual(r.code, 0, `${args[0]}: ${r.out}`); + runs.push(r); + check(args.join(" ")); + } + return { s, runs, page: s.files["index.html"] }; + }; + + test("a typed line inside the starter's main: start quotes it as the person's, and the document goes in after it", () => { + const line = "

Hello from a blank Docs page

"; + const { s, runs, page } = walk(inMain(line), [line], ["outline", "A letter", "One", "Two"]); + assert.match(runs[0].out, /blank but for a line the person typed[\s\S]*\n "Hello from a blank Docs page"\n/); + assert.match(runs[0].out, /outline --their-title/); + assert.ok(page.indexOf(line) > page.indexOf('
') && page.indexOf(line) < page.indexOf('data-ss-id="d-title"'), "their line first in main, then the title"); + assert.ok(page.includes("The second part.") && /

A letter<\/h1>/.test(page)); + const appended = s.pushes.flatMap((p) => p.edits || []).find((e) => e.op === "append_into" && e.anchor === "d-doc"); + assert.ok(appended && appended.html.startsWith('

'), "the outline went to open tabs as one append into the document"); + assert.match(runs[6].out, /the person wrote 1 block on the page, left as they wrote it: 1 outside the sections/); + assert.ok(!runs[6].out.includes("Hello from"), "done doesn't quote it"); + }); + + test("a typed line above the starter's main, where the app saved it before: it stays there, and the document goes in main", () => { + const line = "

Hello from a blank Docs page

"; + const { page } = walk(aboveMain(line), [line], ["outline", "A letter", "One", "Two"]); + assert.ok(page.indexOf(line) < page.indexOf('
'), "still above main"); + assert.ok(page.indexOf('data-ss-id="d-title"') > page.indexOf('
')); + }); + + test("a typed heading, a list and several lines all stay, in their order", () => { + const lines = ["

Bins on Elm Road

", "

For the council, by Friday.

", "
    \n
  • missed twice
  • \n
  • lids broken
  • \n
", "

Keep it short.

"]; + const r = walk(inMain(lines.join("\n")), lines, ["outline", "Bins", "One", "Two"]); + assert.ok(lines.every((l, i) => i === 0 || r.page.indexOf(l) > r.page.indexOf(lines[i - 1])), "in their order"); + assert.match(r.runs[0].out, /blank but for 4 lines[\s\S]*"Bins on Elm Road"\n "For the council, by Friday."\n "missed twice lids broken"\n "Keep it short."/); + }); + + test("their first line as the title: the outline has no title of the tool's, the tab takes their words, and done passes", () => { + const line = "

Letter to the council about the bins

"; + const { runs, page } = walk(inMain(line), [line], ["outline", "--their-title", "One", "Two"]); + assert.ok(!page.includes('data-ss-id="d-title"'), "no title of the tool's"); + assert.match(page, /Letter to the council about the bins<\/title>/); + assert.ok(page.indexOf(line) < page.indexOf('<section data-ss-id="d-s0"'), "their title first, then the opening"); + assert.match(runs[1].out, /under the person's title, 2 headings are on the page/); + assert.match(runs[6].out, /checked and saved/); + // On a page with no typed line there's no title of theirs to keep: refused, nothing saved. + const s = fakeSpace({ "index.html": starter }), dir = tmp(); + go(s, dir, ["start", s.id]); + const r = go(s, dir, ["outline", "--their-title", "One"]); + assert.notStrictEqual(r.code, 0); + assert.match(r.out, /no line the person typed to be its title/); + assert.strictEqual(s.saves.length, 0); + }); + + test("a typed line that lands while the outline goes in: nothing saved, the outline comes off open tabs, their lines stay", () => { + const line = "<p>Hello</p>", later = "<p>And one more thing.</p>"; + const s = fakeSpace({ "index.html": inMain(line) }), dir = tmp(); + go(s, dir, ["start", s.id]); + s.beforeSave = (sp) => { sp.files["index.html"] = sp.files["index.html"].replace(line, `${line}\n${later}`); }; + const r = go(s, dir, ["outline", "T", "One"]); + assert.notStrictEqual(r.code, 0); + assert.match(r.out, /changed the page while the outline went in/); + assert.strictEqual(s.files["index.html"], inMain(`${line}\n${later}`), "their page, as they left it"); + assert.deepStrictEqual(s.pushes[s.pushes.length - 1].edits.map((e) => e.op + " " + e.anchor), ["remove d-title", "remove d-s0", "remove d-s1"]); + const again = go(s, dir, ["outline", "T", "One"]); + assert.strictEqual(again.code, 0, again.out); + assert.ok(s.files["index.html"].includes(`${line}\n${later}\n<h1 data-ss-id="d-title">T</h1>`)); + }); + + test("plain links and the ids staging and the app give a typed line stay typed lines, as they are", () => { + const lines = [ + '<p data-ss-id="auto-p-1a2b">See <a href="https://example.com/plan?a=1&b=2">the plan</a> and <a href="mailto:me@example.com">mail me</a>.</p>', + "<p data-ss-id=auto-p-9c>Back to <a href=\"#top\">the top</a>, <a href='/notes'>the notes</a> or <a href=\"tel:+441234567\">ring</a>.</p>", + ]; + const { runs } = walk(inMain(lines.join("\n")), lines, ["outline", "A letter", "One", "Two"]); + assert.match(runs[0].out, /blank but for 2 lines/); + }); + + test("the starter with anything but typed lines is still the person's: refused, and left as it was", () => { + const off = [ + inMain('<p>Mine.</p>\n<img src="plan.png">'), + inMain("<p>Mine.</p>\n<canvas></canvas>"), + inMain("<p>Mine.<script>x()</script></p>"), + inMain('<p onclick="x()">Mine.</p>'), + inMain('<p style="color:red">Mine.</p>'), + inMain('<p><a href="javascript:alert(1)">Mine.</a></p>'), + inMain('<p><a href=" java\tscript:alert(1)">Mine.</a></p>'), + inMain('<p data-ss-id="d-title">Mine.</p>'), + // An id or a link read as the browser reads it: unquoted, or behind a character reference. + inMain("<p data-ss-id=d-title>Mine.</p>"), + inMain('<p data-ss-id="d-title">Mine.</p>'), + inMain('<p data-ss-id="d-s0">Mine.</p>'), + inMain("<p DATA-SS-ID='D-s0'>Mine.</p>"), + inMain("<p>Mine, <b data-ss-id=d-title>bold</b>.</p>"), + inMain('<p data-ss-id="auto-p-1" data-ss-id="d-title">Mine.</p>'), + inMain('<p><a href="javascript:alert(1)">Mine.</a></p>'), + inMain('<p><a href="javascript:alert(1)">Mine.</a></p>'), + inMain('<p><a href="java script:alert(1)">Mine.</a></p>'), + inMain("<p><a href=javascript:alert(1)>Mine.</a></p>"), + inMain('<p><a href="data:text/html,x">Mine.</a></p>'), + inMain('<p><a href="ftp://example.com/x">Mine.</a></p>'), + inMain("<div>Mine.</div>"), + inMain("<table><tr><td>Mine.</td></tr></table>"), + inMain("<p>Mine.</p>\nA loose word"), + inMain("<p>Mine.</p>").replace("</main>", "</main>\n<p>After main.</p>"), + inMain("<p>Mine.</p>").replace("</head>", "<script>draw()</script>\n</head>"), + inMain("<p>Mine.</p>").replace("--paper: #fdfcfa", "--paper: #000000"), + inMain("<p>Mine.</p>").replace("<title>Document", "Mine"), + inMain("

Mine.

").replace('
', '
'), + ]; + for (const page of off) { + const s = fakeSpace({ "index.html": page }), dir = tmp(); + const start = go(s, dir, ["start", s.id]), outline = go(s, dir, ["outline", "T", "One"]); + assert.notStrictEqual(start.code, 0, `refused: ${page.slice(page.indexOf(""), page.indexOf("") + 120)}`); + assert.match(start.out, /never written over/); + assert.notStrictEqual(outline.code, 0); + assert.strictEqual(s.files["index.html"], page); + assert.strictEqual(s.saves.length, 0); + assert.ok(!s.pushes.some((p) => p.html || p.edits), "nothing drawn on it"); + } + }); +};