Core without documents: no slugs; a node's top; targets by titles from the library root
The model has no slug any more (field, ops, canonical row, slugFor, freeSlug, RESERVED, findDoc). The child of the root a node is under is a derived relation, topOf (docOf and documents stay as deprecated aliases for the UI until step 2); ancestorsInDoc becomes ancestorsBelowRoot. Slug keys and a target's old `doc` in stored libraries are ignored. A node target's path is the titles down from the library root; `rel` marks a path read below a top (a file being imported, what the agent or a person typed). Where two sections share a title, the one the link is written in wins. The text format writes /Top title/…, and ./… inside the exported subtree. The agent may give a node id as a target. renderContext renders the top's outline in an <outline> tag, and steps down the focus path when even titles are over budget. Prompts, the reviewer and the scanner speak of the library, trees and tops; the scanner's unit is the top, with the same behaviour (scripts/linkEval.ts gives identical metrics). src/core/library.ts keeps a slug-free shim for the UI's document features (names made from titles) until step 2 removes them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
626dc19e1b
commit
44d2e437eb
32 files changed
+634
-577
No files matched your search
+5
-5
@@ -1,9 +1,9 @@
|
||||
/** The seed tree against the prompt it was grown from: the first document of a new library. */
|
||||
/** The seed tree against the prompt it was grown from: the first tree of a new library. */
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { Doc, descendants, isStale, notesOf, sections } from "../src/core/model";
|
||||
import { verifyHistory } from "../src/core/repo";
|
||||
import { SEED_SLUG, writeSeed } from "../src/core/seed";
|
||||
import { SEED_TITLE, writeSeed } from "../src/core/seed";
|
||||
import { overlaps, sentences, wordCount } from "../src/core/text";
|
||||
import { seed } from "../src/seed/tree";
|
||||
|
||||
@@ -14,9 +14,9 @@ const snap = doc.snap();
|
||||
const root = snap.nodes[first];
|
||||
|
||||
describe("seed tree", () => {
|
||||
it("keeps the prompt verbatim as the document's text, written by a human and pinned, as a section of the library", () => {
|
||||
it("keeps the prompt verbatim as the text of its top, written by a human and pinned, as a section of the library", () => {
|
||||
expect(root.body).toBe(prompt.trim());
|
||||
expect(root).toMatchObject({ by: "human", pinned: true, parent: snap.root, slug: SEED_SLUG });
|
||||
expect(root).toMatchObject({ by: "human", pinned: true, parent: snap.root, title: SEED_TITLE });
|
||||
expect(snap.library).toBe(true);
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ describe("seed tree", () => {
|
||||
expect(Object.keys(snap.nodes).filter((id) => isStale(snap, id as never))).toEqual([]);
|
||||
const v = verifyHistory(doc);
|
||||
expect(v.mismatches).toEqual([]);
|
||||
// The library, the document, and one commit per top-level section.
|
||||
// The library, the tree's top, and one commit per section under it.
|
||||
expect(v.checked).toBe(seed.length + 2);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user