@warlock.js/grimoire 5.56.0 → 5.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/esm/book/build.d.mts.map +1 -1
- package/esm/book/build.mjs +2 -1
- package/esm/book/build.mjs.map +1 -1
- package/esm/book/render.mjs +10 -0
- package/esm/book/render.mjs.map +1 -1
- package/esm/bookmap/build.d.mts.map +1 -1
- package/esm/bookmap/build.mjs +2 -2
- package/esm/bookmap/build.mjs.map +1 -1
- package/esm/bookmap/steps.mjs +53 -38
- package/esm/bookmap/steps.mjs.map +1 -1
- package/esm/check/check-grimoire.d.mts.map +1 -1
- package/esm/check/check-grimoire.mjs +4 -1
- package/esm/check/check-grimoire.mjs.map +1 -1
- package/esm/check/rules/criteria.mjs +21 -2
- package/esm/check/rules/criteria.mjs.map +1 -1
- package/esm/check/rules/screenshots.mjs +57 -0
- package/esm/check/rules/screenshots.mjs.map +1 -0
- package/esm/codes/codes.d.mts +12 -0
- package/esm/codes/codes.d.mts.map +1 -1
- package/esm/codes/codes.mjs +6 -0
- package/esm/codes/codes.mjs.map +1 -1
- package/esm/contracts/adapter.d.mts +6 -0
- package/esm/contracts/adapter.d.mts.map +1 -1
- package/esm/contracts/book.d.mts +2 -0
- package/esm/contracts/book.d.mts.map +1 -1
- package/esm/contracts/book.mjs.map +1 -1
- package/esm/contracts/bookmap.d.mts +19 -1
- package/esm/contracts/bookmap.d.mts.map +1 -1
- package/esm/contracts/snapshot.d.mts +11 -0
- package/esm/contracts/snapshot.d.mts.map +1 -1
- package/esm/contracts/test-results.d.mts +34 -0
- package/esm/contracts/test-results.d.mts.map +1 -1
- package/esm/contracts/written.d.mts +44 -0
- package/esm/contracts/written.d.mts.map +1 -1
- package/esm/contracts/written.mjs.map +1 -1
- package/esm/devtools/data.mjs +126 -4
- package/esm/devtools/data.mjs.map +1 -1
- package/esm/devtools/index.d.mts +31 -1
- package/esm/devtools/index.d.mts.map +1 -1
- package/esm/devtools/index.mjs +94 -5
- package/esm/devtools/index.mjs.map +1 -1
- package/esm/devtools/product-map.d.mts +14 -0
- package/esm/devtools/product-map.d.mts.map +1 -0
- package/esm/devtools/product-map.mjs +385 -0
- package/esm/devtools/product-map.mjs.map +1 -0
- package/esm/devtools/site.d.mts.map +1 -1
- package/esm/devtools/site.mjs +97 -21
- package/esm/devtools/site.mjs.map +1 -1
- package/esm/devtools/snapshot-source.mjs +71 -22
- package/esm/devtools/snapshot-source.mjs.map +1 -1
- package/esm/graph/index.d.mts +10 -1
- package/esm/graph/index.d.mts.map +1 -1
- package/esm/graph/index.mjs +3 -2
- package/esm/graph/index.mjs.map +1 -1
- package/esm/index.d.mts +4 -4
- package/esm/paths/index.d.mts +2 -0
- package/esm/paths/index.d.mts.map +1 -1
- package/esm/paths/index.mjs +3 -1
- package/esm/paths/index.mjs.map +1 -1
- package/esm/scry/compact.mjs +169 -0
- package/esm/scry/compact.mjs.map +1 -0
- package/esm/scry/format.d.mts.map +1 -1
- package/esm/scry/format.mjs +7 -1
- package/esm/scry/format.mjs.map +1 -1
- package/esm/scry/query.d.mts.map +1 -1
- package/esm/scry/query.mjs +12 -1
- package/esm/scry/query.mjs.map +1 -1
- package/esm/test-results/index.d.mts +7 -2
- package/esm/test-results/index.d.mts.map +1 -1
- package/esm/test-results/index.mjs +79 -12
- package/esm/test-results/index.mjs.map +1 -1
- package/esm/vitest/index.d.mts +6 -0
- package/esm/vitest/index.d.mts.map +1 -1
- package/esm/vitest/index.mjs +22 -6
- package/esm/vitest/index.mjs.map +1 -1
- package/esm/warlock/adapter.d.mts.map +1 -1
- package/esm/warlock/adapter.mjs +6 -2
- package/esm/warlock/adapter.mjs.map +1 -1
- package/esm/warlock/mcp-tools.mjs +48 -12
- package/esm/warlock/mcp-tools.mjs.map +1 -1
- package/esm/workspace/index.d.mts.map +1 -1
- package/esm/workspace/index.mjs +4 -2
- package/esm/workspace/index.mjs.map +1 -1
- package/esm/written/apps.mjs +4 -2
- package/esm/written/apps.mjs.map +1 -1
- package/esm/written/features.mjs +119 -6
- package/esm/written/features.mjs.map +1 -1
- package/esm/written/markdown.mjs +66 -1
- package/esm/written/markdown.mjs.map +1 -1
- package/esm/written/parse-grimoire.d.mts.map +1 -1
- package/esm/written/parse-grimoire.mjs +1 -1
- package/esm/written/parse-grimoire.mjs.map +1 -1
- package/llms-full.txt +77 -2
- package/package.json +3 -3
- package/skills/backfill-a-grimoire/SKILL.md +5 -0
- package/skills/describe-an-app/SKILL.md +12 -0
- package/skills/record-a-change/SKILL.md +8 -0
- package/skills/use-the-grimoire/SKILL.md +15 -0
- package/skills/write-a-feature/SKILL.md +37 -2
- package/ui/grimoire-static.js +4 -0
- package/ui/grimoire-view.js +2283 -428
- package/ui/grimoire.css +1036 -45
- package/ui/product-map.css +636 -0
- package/ui/product-map.js +817 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-grimoire.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/written/parse-grimoire.ts"],"sourcesContent":["/**\n * Walks `<root>/grimoire`, reads each written file once, and hands it to the\n * parser of its kind. Paths are built as project-relative POSIX strings from\n * the folder names, so they read the same on every platform.\n */\nimport { createHash } from \"node:crypto\";\nimport type { Dirent } from \"node:fs\";\nimport { readFile, readdir, realpath, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { GrimoireFinding } from \"../contracts/findings\";\nimport type { Located } from \"../contracts/location\";\nimport type {\n WrittenApp,\n WrittenBlockFile,\n WrittenFeature,\n WrittenGrimoire,\n WrittenLayout,\n WrittenPage,\n WrittenRelease,\n WrittenTask,\n} from \"../contracts/written\";\nimport { GRIMOIRE_DIR } from \"../paths\";\nimport { parseAppReadme, parseBlockFile, parseLayout, parsePage, type AppReadme } from \"./apps\";\nimport { parseChangelog, parseFeatureReadme, parseFlow, parseVersionBrief } from \"./features\";\nimport { lineAt } from \"./markdown\";\nimport { FindingSink } from \"./sink\";\nimport { parseRelease, parseTask, type TaskPlace } from \"./tasks-releases\";\n\n/** What `parseGrimoire()` returns. */\nexport type ParseGrimoireResult = {\n written: WrittenGrimoire;\n /** Structure findings (`GR1xxx`), in file and line order. */\n findings: GrimoireFinding[];\n};\n\ntype PageType = \"page\" | \"screen\";\n\n/** One written file to read, and what it is. */\ntype Job =\n | { type: \"feature-readme\"; file: string; feature: string }\n | { type: \"changelog\"; file: string; feature: string }\n | { type: \"flow\"; file: string; feature: string; name: string }\n | { type: \"version\"; file: string; feature: string; major: number }\n | { type: \"app-readme\"; file: string; app: string; fallbackType: \"site\" | \"mobile\" }\n | { type: \"layout\"; file: string; app: string; id: string }\n | { type: \"page\"; file: string; app: string; pageType: PageType; id: string }\n | { type: \"block\"; file: string; app: string; pageType: PageType; page: string; id: string }\n | { type: \"task\"; file: string; place: TaskPlace }\n | { type: \"release\"; file: string; name: string };\n\ntype Listing = { files: string[]; dirs: string[] };\n\nconst TASK_FILE = /^(T-\\d+)-[a-z0-9]+(?:-[a-z0-9]+)*\\.md$/;\nconst MONTH = /^\\d{4}-(?:0[1-9]|1[0-2])$/;\nconst VERSION_BRIEF = /^v(\\d+)\\.md$/;\nconst decoder = new TextDecoder(\"utf-8\", { fatal: true });\n\n/** The walk over the folders: what to read, and the layout findings. */\nclass Walker {\n public readonly jobs: Job[] = [];\n /** Feature and app folders, in name order. */\n public readonly features: string[] = [];\n public readonly apps: { id: string; dir: string; hasReadme: boolean }[] = [];\n /** Real paths of the folders the deep walks entered: a linked folder loop is walked once. */\n private readonly entered = new Set<string>();\n\n public constructor(\n private readonly root: string,\n private readonly sink: FindingSink,\n ) {}\n\n private absolute(file: string): string {\n return path.join(this.root, ...file.split(\"/\"));\n }\n\n /** The visible files and folders of a folder, each list in name order. Dot files are skipped. */\n public async list(dir: string): Promise<Listing> {\n let entries: Dirent[];\n\n try {\n entries = await readdir(this.absolute(dir), { withFileTypes: true });\n } catch {\n return { files: [], dirs: [] };\n }\n\n const files: string[] = [];\n const dirs: string[] = [];\n\n for (const entry of entries) {\n if (entry.name.startsWith(\".\")) continue;\n\n let isDirectory = entry.isDirectory();\n let isFile = entry.isFile();\n\n if (entry.isSymbolicLink()) {\n const target = await stat(this.absolute(`${dir}/${entry.name}`)).catch(() => null);\n isDirectory = target?.isDirectory() ?? false;\n isFile = target?.isFile() ?? false;\n }\n\n if (isDirectory) dirs.push(entry.name);\n else if (isFile) files.push(entry.name);\n }\n\n const byName = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n return { files: files.sort(byName), dirs: dirs.sort(byName) };\n }\n\n /** GR1020 for a file the layout has no place for. */\n public unknown(file: string, sink: FindingSink = this.sink): void {\n sink.report(\"GR1020\", `the file ${file} is not part of the grimoire layout.`, lineAt(file, 1));\n }\n\n /** Whether a deep walk enters `dir` for the first time (a linked folder loop is entered once). */\n private async enter(dir: string): Promise<boolean> {\n const real = await realpath(this.absolute(dir)).catch(() => null);\n\n if (real === null || this.entered.has(real)) return false;\n\n this.entered.add(real);\n\n return true;\n }\n\n /** GR1020 for every file under a folder the layout has no place for (a linked folder loop is walked once). */\n public async unknownFolder(dir: string, sink: FindingSink = this.sink, depth = 0): Promise<void> {\n if (depth > 16 || !(await this.enter(dir))) return;\n\n const listing = await this.list(dir);\n\n for (const name of listing.files) this.unknown(`${dir}/${name}`, sink);\n for (const name of listing.dirs) await this.unknownFolder(`${dir}/${name}`, sink, depth + 1);\n }\n\n public async walk(): Promise<void> {\n const top = await this.list(GRIMOIRE_DIR);\n\n for (const name of top.files) this.unknown(`${GRIMOIRE_DIR}/${name}`);\n\n for (const name of top.dirs) {\n const dir = `${GRIMOIRE_DIR}/${name}`;\n\n if (name === \"book\") continue;\n else if (name === \"features\") await this.walkFeatures(dir);\n else if (name === \"apps\") await this.walkApps(dir);\n else if (name === \"tasks\") await this.walkTasks(dir);\n else if (name === \"releases\") await this.walkReleases(dir);\n else await this.unknownFolder(dir);\n }\n }\n\n private async walkFeatures(featuresDir: string): Promise<void> {\n const listing = await this.list(featuresDir);\n\n for (const name of listing.files) {\n if (name !== \"index.json\") this.unknown(`${featuresDir}/${name}`);\n }\n\n for (const feature of listing.dirs) {\n const dir = `${featuresDir}/${feature}`;\n const sink = this.sink.scope({ feature });\n const inside = await this.list(dir);\n\n this.features.push(feature);\n\n for (const name of inside.files) {\n const file = `${dir}/${name}`;\n\n if (name === \"README.md\") this.jobs.push({ type: \"feature-readme\", file, feature });\n else if (name === \"CHANGELOG.md\") this.jobs.push({ type: \"changelog\", file, feature });\n else if (!name.endsWith(\".json\")) this.unknown(file, sink);\n }\n\n if (!inside.files.includes(\"README.md\")) {\n sink.report(\n \"GR1021\",\n `the feature folder ${dir} has no README.md.`,\n lineAt(`${dir}/README.md`, 1),\n );\n }\n\n for (const sub of inside.dirs) {\n const subDir = `${dir}/${sub}`;\n\n if (sub === \"flows\") {\n const flows = await this.list(subDir);\n\n for (const name of flows.files) {\n const file = `${subDir}/${name}`;\n\n if (name.endsWith(\".md\"))\n this.jobs.push({ type: \"flow\", file, feature, name: name.slice(0, -3) });\n else if (!name.endsWith(\".bookmap.json\")) this.unknown(file, sink);\n }\n\n for (const name of flows.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n } else if (sub === \"versions\") {\n const versions = await this.list(subDir);\n\n for (const name of versions.files) {\n const match = VERSION_BRIEF.exec(name);\n const file = `${subDir}/${name}`;\n\n if (match) this.jobs.push({ type: \"version\", file, feature, major: Number(match[1]) });\n else this.unknown(file, sink);\n }\n\n for (const name of versions.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n } else {\n await this.unknownFolder(subDir, sink);\n }\n }\n }\n }\n\n private async walkApps(appsDir: string): Promise<void> {\n const listing = await this.list(appsDir);\n\n for (const name of listing.files) this.unknown(`${appsDir}/${name}`);\n\n for (const app of listing.dirs) {\n const dir = `${appsDir}/${app}`;\n const sink = this.sink.scope({ app });\n const inside = await this.list(dir);\n const hasReadme = inside.files.includes(\"README.md\");\n\n this.apps.push({ id: app, dir, hasReadme });\n\n for (const name of inside.files) {\n if (name === \"README.md\") {\n this.jobs.push({\n type: \"app-readme\",\n file: `${dir}/${name}`,\n app,\n fallbackType: inside.dirs.includes(\"screens\") ? \"mobile\" : \"site\",\n });\n } else {\n this.unknown(`${dir}/${name}`, sink);\n }\n }\n\n if (!hasReadme) {\n sink.report(\n \"GR1021\",\n `the app folder ${dir} has no README.md.`,\n lineAt(`${dir}/README.md`, 1),\n );\n }\n\n for (const sub of inside.dirs) {\n const subDir = `${dir}/${sub}`;\n\n if (sub === \"layouts\") {\n const layouts = await this.list(subDir);\n\n for (const name of layouts.files) {\n const file = `${subDir}/${name}`;\n\n if (name.endsWith(\".md\"))\n this.jobs.push({ type: \"layout\", file, app, id: name.slice(0, -3) });\n else this.unknown(file, sink);\n }\n\n for (const name of layouts.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n } else if (sub === \"pages\" || sub === \"screens\") {\n await this.walkPages(subDir, app, sub === \"pages\" ? \"page\" : \"screen\", sink);\n } else {\n await this.unknownFolder(subDir, sink);\n }\n }\n }\n }\n\n private async walkPages(\n pagesDir: string,\n app: string,\n pageType: PageType,\n sink: FindingSink,\n ): Promise<void> {\n const listing = await this.list(pagesDir);\n\n for (const name of listing.files) this.unknown(`${pagesDir}/${name}`, sink);\n\n for (const page of listing.dirs) {\n const dir = `${pagesDir}/${page}`;\n const inside = await this.list(dir);\n\n for (const name of inside.files) {\n if (name === \"README.md\")\n this.jobs.push({ type: \"page\", file: `${dir}/${name}`, app, pageType, id: page });\n else this.unknown(`${dir}/${name}`, sink);\n }\n\n if (!inside.files.includes(\"README.md\")) {\n sink.report(\n \"GR1021\",\n `the ${pageType} folder ${dir} has no README.md.`,\n lineAt(`${dir}/README.md`, 1),\n );\n }\n\n for (const sub of inside.dirs) {\n const subDir = `${dir}/${sub}`;\n\n if (sub !== \"blocks\") {\n await this.unknownFolder(subDir, sink);\n continue;\n }\n\n const blocks = await this.list(subDir);\n\n for (const name of blocks.files) {\n const file = `${subDir}/${name}`;\n\n if (name.endsWith(\".md\"))\n this.jobs.push({ type: \"block\", file, app, pageType, page, id: name.slice(0, -3) });\n else this.unknown(file, sink);\n }\n\n for (const name of blocks.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n }\n }\n }\n\n /** GR1023 for a task file outside `open/` and `done/<yyyy-mm>/`; other files get GR1020. */\n private async misplacedTasks(dir: string, depth = 0): Promise<void> {\n if (depth > 16 || !(await this.enter(dir))) return;\n\n const listing = await this.list(dir);\n\n for (const name of listing.files) this.misplacedTask(`${dir}/${name}`);\n for (const name of listing.dirs) await this.misplacedTasks(`${dir}/${name}`, depth + 1);\n }\n\n private misplacedTask(file: string): void {\n if (!file.endsWith(\".md\")) {\n this.unknown(file);\n return;\n }\n\n this.sink.report(\n \"GR1023\",\n `the task file ${file} is not in tasks/open/ or tasks/done/<yyyy-mm>/; it is not read.`,\n lineAt(file, 1),\n );\n }\n\n private taskFiles(\n dir: string,\n names: readonly string[],\n folder: \"open\" | \"done\",\n month: string | null,\n ): void {\n for (const name of names) {\n const file = `${dir}/${name}`;\n\n if (!name.endsWith(\".md\")) {\n this.unknown(file);\n continue;\n }\n\n const match = TASK_FILE.exec(name);\n\n if (!match) {\n this.sink.report(\n \"GR1023\",\n `the task file name ${name} is not T-<n>-<slug>.md.`,\n lineAt(file, 1),\n );\n }\n\n this.jobs.push({ type: \"task\", file, place: { folder, month, nameId: match?.[1] ?? null } });\n }\n }\n\n private async walkTasks(tasksDir: string): Promise<void> {\n const listing = await this.list(tasksDir);\n\n for (const name of listing.files) {\n if (name !== \"index.json\") this.misplacedTask(`${tasksDir}/${name}`);\n }\n\n for (const sub of listing.dirs) {\n const dir = `${tasksDir}/${sub}`;\n const inside = await this.list(dir);\n\n if (sub === \"open\") {\n this.taskFiles(dir, inside.files, \"open\", null);\n for (const name of inside.dirs) await this.misplacedTasks(`${dir}/${name}`);\n } else if (sub === \"done\") {\n for (const name of inside.files) this.misplacedTask(`${dir}/${name}`);\n\n for (const month of inside.dirs) {\n const monthDir = `${dir}/${month}`;\n\n if (!MONTH.test(month)) {\n await this.misplacedTasks(monthDir);\n continue;\n }\n\n const files = await this.list(monthDir);\n\n this.taskFiles(monthDir, files.files, \"done\", month);\n for (const name of files.dirs) await this.misplacedTasks(`${monthDir}/${name}`);\n }\n } else {\n await this.misplacedTasks(dir);\n }\n }\n }\n\n private async walkReleases(releasesDir: string): Promise<void> {\n const listing = await this.list(releasesDir);\n\n for (const name of listing.files) {\n const file = `${releasesDir}/${name}`;\n\n if (name.endsWith(\".md\")) this.jobs.push({ type: \"release\", file, name: name.slice(0, -3) });\n else this.unknown(file);\n }\n\n for (const name of listing.dirs) await this.unknownFolder(`${releasesDir}/${name}`);\n }\n}\n\n/**\n * Files read at once. A grimoire grows by a task file a change, so reading\n * them all at once runs out of file handles (`EMFILE`) on a large project.\n */\nconst READ_CONCURRENCY = 32;\n\n/** `items.map(run)` with at most `limit` calls in flight; results keep the order of `items`. */\nasync function mapLimited<T, R>(\n items: readonly T[],\n limit: number,\n run: (item: T) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let next = 0;\n\n const worker = async (): Promise<void> => {\n while (next < items.length) {\n const index = next++;\n\n results[index] = await run(items[index] as T);\n }\n };\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));\n\n return results;\n}\n\n/** Read one file as UTF-8; `null` (with GR1025) when it cannot be read or is not UTF-8. */\nasync function readWritten(\n root: string,\n file: string,\n sink: FindingSink,\n): Promise<{ bytes: Uint8Array; text: string } | null> {\n try {\n const bytes = await readFile(path.join(root, ...file.split(\"/\")));\n\n try {\n return { bytes, text: decoder.decode(bytes) };\n } catch {\n sink.report(\"GR1025\", `the file ${file} is not UTF-8 text.`, lineAt(file, 1));\n\n return null;\n }\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n\n sink.report(\"GR1025\", `the file ${file} cannot be read: ${reason}`, lineAt(file, 1));\n\n return null;\n }\n}\n\nfunction sinkFor(job: Job, sink: FindingSink): FindingSink {\n switch (job.type) {\n case \"feature-readme\":\n case \"changelog\":\n case \"version\":\n return sink.scope({ feature: job.feature });\n case \"flow\":\n return sink.scope({ feature: job.feature, flow: `${job.feature}/${job.name}` });\n case \"app-readme\":\n case \"layout\":\n case \"page\":\n case \"block\":\n return sink.scope({ app: job.app });\n case \"task\":\n return sink.scope({ task: job.place.nameId });\n case \"release\":\n return sink;\n }\n}\n\nfunction taskNumber(task: WrittenTask): number {\n const match = /^T-(\\d+)$/.exec(task.id.value) ?? /(?:^|\\/)T-(\\d+)-[^/]*$/.exec(task.file);\n\n return match ? Number(match[1]) : Number.MAX_SAFE_INTEGER;\n}\n\n/**\n * Parse every written file under `<root>/grimoire`. A project without a\n * `grimoire/` folder gives `written.exists === false` and no findings. Bad\n * input never throws: each problem is a `GR1xxx` finding at its line, and\n * the rest of the file is still read.\n *\n * @param root Absolute project root.\n */\nexport async function parseGrimoire(root: string): Promise<ParseGrimoireResult> {\n const absoluteRoot = path.resolve(root);\n const sink = new FindingSink();\n const hash = createHash(\"sha256\");\n const written: WrittenGrimoire = {\n root: absoluteRoot,\n exists: false,\n features: [],\n apps: [],\n tasks: [],\n releases: [],\n hash: \"\",\n };\n\n const grimoireStat = await stat(path.join(absoluteRoot, GRIMOIRE_DIR)).catch(() => null);\n\n if (!grimoireStat?.isDirectory()) {\n written.hash = hash.digest(\"hex\");\n\n return { written, findings: [] };\n }\n\n written.exists = true;\n\n const walker = new Walker(absoluteRoot, sink);\n await walker.walk();\n\n const texts = await mapLimited(walker.jobs, READ_CONCURRENCY, (job) =>\n readWritten(absoluteRoot, job.file, sinkFor(job, sink)),\n );\n const hashed = walker.jobs\n .map((job, index) => ({ file: job.file, read: texts[index] }))\n .sort((left, right) => (left.file < right.file ? -1 : left.file > right.file ? 1 : 0));\n\n for (const { file, read } of hashed) {\n if (!read) continue;\n\n hash.update(file);\n hash.update(\"\\0\");\n hash.update(read.bytes);\n hash.update(\"\\0\");\n }\n\n written.hash = hash.digest(\"hex\");\n\n const features = new Map<string, WrittenFeature>(\n walker.features.map((id) => [\n id,\n {\n id,\n dir: `${GRIMOIRE_DIR}/features/${id}`,\n readme: null,\n changelog: null,\n flows: [],\n versions: [],\n },\n ]),\n );\n const appReadmes = new Map<string, { file: string; readme: AppReadme }>();\n const layouts = new Map<string, WrittenLayout[]>();\n const pages = new Map<string, WrittenPage[]>();\n const blockFiles = new Map<string, WrittenBlockFile[]>();\n const tasks: WrittenTask[] = [];\n const releases: WrittenRelease[] = [];\n const push = <T>(map: Map<string, T[]>, key: string, value: T): void => {\n const list = map.get(key);\n\n if (list) list.push(value);\n else map.set(key, [value]);\n };\n\n walker.jobs.forEach((job, index) => {\n const read = texts[index];\n\n if (!read) return;\n\n const fileSink = sinkFor(job, sink);\n const text = read.text;\n\n switch (job.type) {\n case \"feature-readme\": {\n const feature = features.get(job.feature);\n if (feature) feature.readme = parseFeatureReadme(job.file, text, job.feature, fileSink);\n return;\n }\n case \"changelog\": {\n const feature = features.get(job.feature);\n if (feature) feature.changelog = parseChangelog(job.file, text, job.feature, fileSink);\n return;\n }\n case \"flow\":\n features\n .get(job.feature)\n ?.flows.push(parseFlow(job.file, text, job.feature, job.name, fileSink));\n return;\n case \"version\":\n features\n .get(job.feature)\n ?.versions.push(parseVersionBrief(job.file, text, job.feature, job.major, fileSink));\n return;\n case \"app-readme\":\n appReadmes.set(job.app, {\n file: job.file,\n readme: parseAppReadme(job.file, text, job.app, job.fallbackType, fileSink),\n });\n return;\n case \"layout\":\n push(layouts, job.app, parseLayout(job.file, text, job.app, job.id, fileSink));\n return;\n case \"page\":\n push(\n pages,\n `${job.app}/${job.pageType}/${job.id}`,\n parsePage(job.file, text, job.app, job.pageType, job.id, fileSink),\n );\n return;\n case \"block\":\n push(\n blockFiles,\n `${job.app}/${job.pageType}/${job.page}`,\n parseBlockFile(job.file, text, job.app, job.page, job.id, fileSink),\n );\n return;\n case \"task\":\n tasks.push(parseTask(job.file, text, job.place, fileSink));\n return;\n case \"release\":\n releases.push(parseRelease(job.file, text, job.name, fileSink));\n return;\n }\n });\n\n for (const feature of features.values()) {\n feature.versions.sort((left, right) => left.major - right.major);\n linkFlows(feature, sink.scope({ feature: feature.id }));\n written.features.push(feature);\n }\n\n for (const app of walker.apps) {\n const found = appReadmes.get(app.id);\n const missing = { value: app.id, at: lineAt(`${app.dir}/README.md`, 1) };\n const appPages = (type: PageType): WrittenPage[] =>\n [...pages.entries()]\n .filter(([key]) => key.startsWith(`${app.id}/${type}/`))\n .map(([key, list]) =>\n list.map((page) => ({ ...page, blockFiles: blockFiles.get(key) ?? [] })),\n )\n .flat();\n const pageList = appPages(\"page\");\n const screenList = appPages(\"screen\");\n\n written.apps.push({\n dir: app.dir,\n file: found?.file ?? null,\n id: found?.readme.id ?? missing,\n type: found?.readme.type ?? {\n value: screenList.length > 0 ? \"mobile\" : \"site\",\n at: missing.at,\n },\n root: found?.readme.root ?? { value: \"\", at: missing.at },\n origin: found?.readme.origin ?? null,\n heading: found?.readme.heading ?? null,\n conditions: found?.readme.conditions ?? [],\n layouts: layouts.get(app.id) ?? [],\n pages: pageList,\n screens: screenList,\n } satisfies WrittenApp);\n }\n\n duplicates(\n written.apps\n .filter((app) => app.file !== null)\n .map((app) => ({ id: app.id, subject: { app: app.id.value } })),\n \"app\",\n sink,\n );\n\n tasks.sort(\n (left, right) => taskNumber(left) - taskNumber(right) || (left.file < right.file ? -1 : 1),\n );\n duplicates(\n tasks\n .filter((task) => task.id.value !== \"\")\n .map((task) => ({ id: task.id, subject: { task: task.id.value } })),\n \"task\",\n sink,\n );\n written.tasks = tasks;\n written.releases = releases;\n\n return { written, findings: sink.sorted() };\n}\n\n/** GR1026 for a README flow with no file; GR1027 for a flow file the README does not list. */\nfunction linkFlows(feature: WrittenFeature, sink: FindingSink): void {\n if (feature.readme === null) return;\n\n const files = new Set(feature.flows.map((flow) => flow.ref.slice(feature.id.length + 1)));\n const listed = new Set(feature.readme.flows.map((line) => line.name));\n\n for (const line of feature.readme.flows) {\n if (!files.has(line.name)) {\n sink\n .scope({ flow: `${feature.id}/${line.name}` })\n .report(\n \"GR1026\",\n `the README lists the flow \"${line.name}\", which has no file flows/${line.name}.md.`,\n line.at,\n );\n }\n }\n\n for (const flow of feature.flows) {\n const name = flow.ref.slice(feature.id.length + 1);\n\n if (!listed.has(name)) {\n sink\n .scope({ flow: flow.ref })\n .report(\n \"GR1027\",\n `the flow \"${name}\" is not listed under \"## Flows\" in the feature README.`,\n lineAt(flow.file, 1),\n );\n }\n }\n}\n\n/** GR1022 for each id already used by an earlier file. */\nfunction duplicates(\n items: { id: Located<string>; subject: { app?: string; task?: string } }[],\n what: string,\n sink: FindingSink,\n): void {\n const seen = new Map<string, string>();\n\n for (const item of items) {\n const first = seen.get(item.id.value);\n\n if (first !== undefined) {\n sink\n .scope(item.subject)\n .report(\"GR1022\", `the ${what} id ${item.id.value} is also used by ${first}.`, item.id.at);\n continue;\n }\n\n seen.set(item.id.value, item.id.at.file);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoDA,MAAM,YAAY;AAClB,MAAM,QAAQ;AACd,MAAM,gBAAgB;AACtB,MAAM,UAAU,IAAI,YAAY,SAAS,EAAE,OAAO,KAAK,CAAC;;AAGxD,IAAM,SAAN,MAAa;CASQ;CACA;CATnB,AAAgB,OAAc,CAAC;;CAE/B,AAAgB,WAAqB,CAAC;CACtC,AAAgB,OAA0D,CAAC;;CAE3E,AAAiB,0BAAU,IAAI,IAAY;CAE3C,AAAO,YACL,AAAiB,MACjB,AAAiB,MACjB;EAFiB;EACA;CAChB;CAEH,AAAQ,SAAS,MAAsB;EACrC,OAAO,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,MAAM,GAAG,CAAC;CAChD;;CAGA,MAAa,KAAK,KAA+B;EAC/C,IAAI;EAEJ,IAAI;GACF,UAAU,MAAM,QAAQ,KAAK,SAAS,GAAG,GAAG,EAAE,eAAe,KAAK,CAAC;EACrE,QAAQ;GACN,OAAO;IAAE,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AAQ,MAAM,KAAK,SAAS,KAAK,IAAI,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC;CACxF,MAAM,SAAS,IAAI,IAAI,QAAQ,OAAO,MAAM,KAAK,SAAS,KAAK,IAAI,CAAC;CAEpE,KAAK,MAAM,QAAQ,QAAQ,OAAO,OAChC,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,GACtB,KACG,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,GAAG,KAAK,OAAO,CAAC,CAAC,CAC7C,OACC,UACA,8BAA8B,KAAK,KAAK,6BAA6B,KAAK,KAAK,OAC/E,KAAK,EACP;CAIN,KAAK,MAAM,QAAQ,QAAQ,OAAO;EAChC,MAAM,OAAO,KAAK,IAAI,MAAM,QAAQ,GAAG,SAAS,CAAC;EAEjD,IAAI,CAAC,OAAO,IAAI,IAAI,GAClB,KACG,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CACzB,OACC,UACA,aAAa,KAAK,0DAClB,OAAO,KAAK,MAAM,CAAC,CACrB;CAEN;AACF;;AAGA,SAAS,WACP,OACA,MACA,MACM;CACN,MAAM,uBAAO,IAAI,IAAoB;CAErC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,QAAQ,KAAK,IAAI,KAAK,GAAG,KAAK;EAEpC,IAAI,UAAU,QAAW;GACvB,KACG,MAAM,KAAK,OAAO,CAAC,CACnB,OAAO,UAAU,OAAO,KAAK,MAAM,KAAK,GAAG,MAAM,mBAAmB,MAAM,IAAI,KAAK,GAAG,EAAE;GAC3F;EACF;EAEA,KAAK,IAAI,KAAK,GAAG,OAAO,KAAK,GAAG,GAAG,IAAI;CACzC;AACF"}
|
|
1
|
+
{"version":3,"file":"parse-grimoire.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/written/parse-grimoire.ts"],"sourcesContent":["/**\n * Walks `<root>/grimoire`, reads each written file once, and hands it to the\n * parser of its kind. Paths are built as project-relative POSIX strings from\n * the folder names, so they read the same on every platform.\n */\nimport { createHash } from \"node:crypto\";\nimport type { Dirent } from \"node:fs\";\nimport { readFile, readdir, realpath, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { GrimoireFinding } from \"../contracts/findings\";\nimport type { Located } from \"../contracts/location\";\nimport type {\n WrittenApp,\n WrittenBlockFile,\n WrittenFeature,\n WrittenGrimoire,\n WrittenLayout,\n WrittenPage,\n WrittenRelease,\n WrittenTask,\n} from \"../contracts/written\";\nimport { GRIMOIRE_DIR } from \"../paths\";\nimport { parseAppReadme, parseBlockFile, parseLayout, parsePage, type AppReadme } from \"./apps\";\nimport { parseChangelog, parseFeatureReadme, parseFlow, parseVersionBrief } from \"./features\";\nimport { lineAt } from \"./markdown\";\nimport { FindingSink } from \"./sink\";\nimport { parseRelease, parseTask, type TaskPlace } from \"./tasks-releases\";\n\n/** What `parseGrimoire()` returns. */\nexport type ParseGrimoireResult = {\n written: WrittenGrimoire;\n /** Structure findings (`GR1xxx`), in file and line order. */\n findings: GrimoireFinding[];\n};\n\ntype PageType = \"page\" | \"screen\";\n\n/** One written file to read, and what it is. */\ntype Job =\n | { type: \"feature-readme\"; file: string; feature: string }\n | { type: \"changelog\"; file: string; feature: string }\n | { type: \"flow\"; file: string; feature: string; name: string }\n | { type: \"version\"; file: string; feature: string; major: number }\n | { type: \"app-readme\"; file: string; app: string; fallbackType: \"site\" | \"mobile\" }\n | { type: \"layout\"; file: string; app: string; id: string }\n | { type: \"page\"; file: string; app: string; pageType: PageType; id: string }\n | { type: \"block\"; file: string; app: string; pageType: PageType; page: string; id: string }\n | { type: \"task\"; file: string; place: TaskPlace }\n | { type: \"release\"; file: string; name: string };\n\ntype Listing = { files: string[]; dirs: string[] };\n\nconst TASK_FILE = /^(T-\\d+)-[a-z0-9]+(?:-[a-z0-9]+)*\\.md$/;\nconst MONTH = /^\\d{4}-(?:0[1-9]|1[0-2])$/;\nconst VERSION_BRIEF = /^v(\\d+)\\.md$/;\nconst decoder = new TextDecoder(\"utf-8\", { fatal: true });\n\n/** The walk over the folders: what to read, and the layout findings. */\nclass Walker {\n public readonly jobs: Job[] = [];\n /** Feature and app folders, in name order. */\n public readonly features: string[] = [];\n public readonly apps: { id: string; dir: string; hasReadme: boolean }[] = [];\n /** Real paths of the folders the deep walks entered: a linked folder loop is walked once. */\n private readonly entered = new Set<string>();\n\n public constructor(\n private readonly root: string,\n private readonly sink: FindingSink,\n ) {}\n\n private absolute(file: string): string {\n return path.join(this.root, ...file.split(\"/\"));\n }\n\n /** The visible files and folders of a folder, each list in name order. Dot files are skipped. */\n public async list(dir: string): Promise<Listing> {\n let entries: Dirent[];\n\n try {\n entries = await readdir(this.absolute(dir), { withFileTypes: true });\n } catch {\n return { files: [], dirs: [] };\n }\n\n const files: string[] = [];\n const dirs: string[] = [];\n\n for (const entry of entries) {\n if (entry.name.startsWith(\".\")) continue;\n\n let isDirectory = entry.isDirectory();\n let isFile = entry.isFile();\n\n if (entry.isSymbolicLink()) {\n const target = await stat(this.absolute(`${dir}/${entry.name}`)).catch(() => null);\n isDirectory = target?.isDirectory() ?? false;\n isFile = target?.isFile() ?? false;\n }\n\n if (isDirectory) dirs.push(entry.name);\n else if (isFile) files.push(entry.name);\n }\n\n const byName = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n return { files: files.sort(byName), dirs: dirs.sort(byName) };\n }\n\n /** GR1020 for a file the layout has no place for. */\n public unknown(file: string, sink: FindingSink = this.sink): void {\n sink.report(\"GR1020\", `the file ${file} is not part of the grimoire layout.`, lineAt(file, 1));\n }\n\n /** Whether a deep walk enters `dir` for the first time (a linked folder loop is entered once). */\n private async enter(dir: string): Promise<boolean> {\n const real = await realpath(this.absolute(dir)).catch(() => null);\n\n if (real === null || this.entered.has(real)) return false;\n\n this.entered.add(real);\n\n return true;\n }\n\n /** GR1020 for every file under a folder the layout has no place for (a linked folder loop is walked once). */\n public async unknownFolder(dir: string, sink: FindingSink = this.sink, depth = 0): Promise<void> {\n if (depth > 16 || !(await this.enter(dir))) return;\n\n const listing = await this.list(dir);\n\n for (const name of listing.files) this.unknown(`${dir}/${name}`, sink);\n for (const name of listing.dirs) await this.unknownFolder(`${dir}/${name}`, sink, depth + 1);\n }\n\n public async walk(): Promise<void> {\n const top = await this.list(GRIMOIRE_DIR);\n\n for (const name of top.files) this.unknown(`${GRIMOIRE_DIR}/${name}`);\n\n for (const name of top.dirs) {\n const dir = `${GRIMOIRE_DIR}/${name}`;\n\n // `book/` is generated; `screenshots/` holds the images the written files show.\n if (name === \"book\" || name === \"screenshots\") continue;\n else if (name === \"features\") await this.walkFeatures(dir);\n else if (name === \"apps\") await this.walkApps(dir);\n else if (name === \"tasks\") await this.walkTasks(dir);\n else if (name === \"releases\") await this.walkReleases(dir);\n else await this.unknownFolder(dir);\n }\n }\n\n private async walkFeatures(featuresDir: string): Promise<void> {\n const listing = await this.list(featuresDir);\n\n for (const name of listing.files) {\n if (name !== \"index.json\") this.unknown(`${featuresDir}/${name}`);\n }\n\n for (const feature of listing.dirs) {\n const dir = `${featuresDir}/${feature}`;\n const sink = this.sink.scope({ feature });\n const inside = await this.list(dir);\n\n this.features.push(feature);\n\n for (const name of inside.files) {\n const file = `${dir}/${name}`;\n\n if (name === \"README.md\") this.jobs.push({ type: \"feature-readme\", file, feature });\n else if (name === \"CHANGELOG.md\") this.jobs.push({ type: \"changelog\", file, feature });\n else if (!name.endsWith(\".json\")) this.unknown(file, sink);\n }\n\n if (!inside.files.includes(\"README.md\")) {\n sink.report(\n \"GR1021\",\n `the feature folder ${dir} has no README.md.`,\n lineAt(`${dir}/README.md`, 1),\n );\n }\n\n for (const sub of inside.dirs) {\n const subDir = `${dir}/${sub}`;\n\n if (sub === \"flows\") {\n const flows = await this.list(subDir);\n\n for (const name of flows.files) {\n const file = `${subDir}/${name}`;\n\n if (name.endsWith(\".md\"))\n this.jobs.push({ type: \"flow\", file, feature, name: name.slice(0, -3) });\n else if (!name.endsWith(\".bookmap.json\")) this.unknown(file, sink);\n }\n\n for (const name of flows.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n } else if (sub === \"versions\") {\n const versions = await this.list(subDir);\n\n for (const name of versions.files) {\n const match = VERSION_BRIEF.exec(name);\n const file = `${subDir}/${name}`;\n\n if (match) this.jobs.push({ type: \"version\", file, feature, major: Number(match[1]) });\n else this.unknown(file, sink);\n }\n\n for (const name of versions.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n } else {\n await this.unknownFolder(subDir, sink);\n }\n }\n }\n }\n\n private async walkApps(appsDir: string): Promise<void> {\n const listing = await this.list(appsDir);\n\n for (const name of listing.files) this.unknown(`${appsDir}/${name}`);\n\n for (const app of listing.dirs) {\n const dir = `${appsDir}/${app}`;\n const sink = this.sink.scope({ app });\n const inside = await this.list(dir);\n const hasReadme = inside.files.includes(\"README.md\");\n\n this.apps.push({ id: app, dir, hasReadme });\n\n for (const name of inside.files) {\n if (name === \"README.md\") {\n this.jobs.push({\n type: \"app-readme\",\n file: `${dir}/${name}`,\n app,\n fallbackType: inside.dirs.includes(\"screens\") ? \"mobile\" : \"site\",\n });\n } else {\n this.unknown(`${dir}/${name}`, sink);\n }\n }\n\n if (!hasReadme) {\n sink.report(\n \"GR1021\",\n `the app folder ${dir} has no README.md.`,\n lineAt(`${dir}/README.md`, 1),\n );\n }\n\n for (const sub of inside.dirs) {\n const subDir = `${dir}/${sub}`;\n\n if (sub === \"layouts\") {\n const layouts = await this.list(subDir);\n\n for (const name of layouts.files) {\n const file = `${subDir}/${name}`;\n\n if (name.endsWith(\".md\"))\n this.jobs.push({ type: \"layout\", file, app, id: name.slice(0, -3) });\n else this.unknown(file, sink);\n }\n\n for (const name of layouts.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n } else if (sub === \"pages\" || sub === \"screens\") {\n await this.walkPages(subDir, app, sub === \"pages\" ? \"page\" : \"screen\", sink);\n } else {\n await this.unknownFolder(subDir, sink);\n }\n }\n }\n }\n\n private async walkPages(\n pagesDir: string,\n app: string,\n pageType: PageType,\n sink: FindingSink,\n ): Promise<void> {\n const listing = await this.list(pagesDir);\n\n for (const name of listing.files) this.unknown(`${pagesDir}/${name}`, sink);\n\n for (const page of listing.dirs) {\n const dir = `${pagesDir}/${page}`;\n const inside = await this.list(dir);\n\n for (const name of inside.files) {\n if (name === \"README.md\")\n this.jobs.push({ type: \"page\", file: `${dir}/${name}`, app, pageType, id: page });\n else this.unknown(`${dir}/${name}`, sink);\n }\n\n if (!inside.files.includes(\"README.md\")) {\n sink.report(\n \"GR1021\",\n `the ${pageType} folder ${dir} has no README.md.`,\n lineAt(`${dir}/README.md`, 1),\n );\n }\n\n for (const sub of inside.dirs) {\n const subDir = `${dir}/${sub}`;\n\n if (sub !== \"blocks\") {\n await this.unknownFolder(subDir, sink);\n continue;\n }\n\n const blocks = await this.list(subDir);\n\n for (const name of blocks.files) {\n const file = `${subDir}/${name}`;\n\n if (name.endsWith(\".md\"))\n this.jobs.push({ type: \"block\", file, app, pageType, page, id: name.slice(0, -3) });\n else this.unknown(file, sink);\n }\n\n for (const name of blocks.dirs) await this.unknownFolder(`${subDir}/${name}`, sink);\n }\n }\n }\n\n /** GR1023 for a task file outside `open/` and `done/<yyyy-mm>/`; other files get GR1020. */\n private async misplacedTasks(dir: string, depth = 0): Promise<void> {\n if (depth > 16 || !(await this.enter(dir))) return;\n\n const listing = await this.list(dir);\n\n for (const name of listing.files) this.misplacedTask(`${dir}/${name}`);\n for (const name of listing.dirs) await this.misplacedTasks(`${dir}/${name}`, depth + 1);\n }\n\n private misplacedTask(file: string): void {\n if (!file.endsWith(\".md\")) {\n this.unknown(file);\n return;\n }\n\n this.sink.report(\n \"GR1023\",\n `the task file ${file} is not in tasks/open/ or tasks/done/<yyyy-mm>/; it is not read.`,\n lineAt(file, 1),\n );\n }\n\n private taskFiles(\n dir: string,\n names: readonly string[],\n folder: \"open\" | \"done\",\n month: string | null,\n ): void {\n for (const name of names) {\n const file = `${dir}/${name}`;\n\n if (!name.endsWith(\".md\")) {\n this.unknown(file);\n continue;\n }\n\n const match = TASK_FILE.exec(name);\n\n if (!match) {\n this.sink.report(\n \"GR1023\",\n `the task file name ${name} is not T-<n>-<slug>.md.`,\n lineAt(file, 1),\n );\n }\n\n this.jobs.push({ type: \"task\", file, place: { folder, month, nameId: match?.[1] ?? null } });\n }\n }\n\n private async walkTasks(tasksDir: string): Promise<void> {\n const listing = await this.list(tasksDir);\n\n for (const name of listing.files) {\n if (name !== \"index.json\") this.misplacedTask(`${tasksDir}/${name}`);\n }\n\n for (const sub of listing.dirs) {\n const dir = `${tasksDir}/${sub}`;\n const inside = await this.list(dir);\n\n if (sub === \"open\") {\n this.taskFiles(dir, inside.files, \"open\", null);\n for (const name of inside.dirs) await this.misplacedTasks(`${dir}/${name}`);\n } else if (sub === \"done\") {\n for (const name of inside.files) this.misplacedTask(`${dir}/${name}`);\n\n for (const month of inside.dirs) {\n const monthDir = `${dir}/${month}`;\n\n if (!MONTH.test(month)) {\n await this.misplacedTasks(monthDir);\n continue;\n }\n\n const files = await this.list(monthDir);\n\n this.taskFiles(monthDir, files.files, \"done\", month);\n for (const name of files.dirs) await this.misplacedTasks(`${monthDir}/${name}`);\n }\n } else {\n await this.misplacedTasks(dir);\n }\n }\n }\n\n private async walkReleases(releasesDir: string): Promise<void> {\n const listing = await this.list(releasesDir);\n\n for (const name of listing.files) {\n const file = `${releasesDir}/${name}`;\n\n if (name.endsWith(\".md\")) this.jobs.push({ type: \"release\", file, name: name.slice(0, -3) });\n else this.unknown(file);\n }\n\n for (const name of listing.dirs) await this.unknownFolder(`${releasesDir}/${name}`);\n }\n}\n\n/**\n * Files read at once. A grimoire grows by a task file a change, so reading\n * them all at once runs out of file handles (`EMFILE`) on a large project.\n */\nconst READ_CONCURRENCY = 32;\n\n/** `items.map(run)` with at most `limit` calls in flight; results keep the order of `items`. */\nasync function mapLimited<T, R>(\n items: readonly T[],\n limit: number,\n run: (item: T) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let next = 0;\n\n const worker = async (): Promise<void> => {\n while (next < items.length) {\n const index = next++;\n\n results[index] = await run(items[index] as T);\n }\n };\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));\n\n return results;\n}\n\n/** Read one file as UTF-8; `null` (with GR1025) when it cannot be read or is not UTF-8. */\nasync function readWritten(\n root: string,\n file: string,\n sink: FindingSink,\n): Promise<{ bytes: Uint8Array; text: string } | null> {\n try {\n const bytes = await readFile(path.join(root, ...file.split(\"/\")));\n\n try {\n return { bytes, text: decoder.decode(bytes) };\n } catch {\n sink.report(\"GR1025\", `the file ${file} is not UTF-8 text.`, lineAt(file, 1));\n\n return null;\n }\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n\n sink.report(\"GR1025\", `the file ${file} cannot be read: ${reason}`, lineAt(file, 1));\n\n return null;\n }\n}\n\nfunction sinkFor(job: Job, sink: FindingSink): FindingSink {\n switch (job.type) {\n case \"feature-readme\":\n case \"changelog\":\n case \"version\":\n return sink.scope({ feature: job.feature });\n case \"flow\":\n return sink.scope({ feature: job.feature, flow: `${job.feature}/${job.name}` });\n case \"app-readme\":\n case \"layout\":\n case \"page\":\n case \"block\":\n return sink.scope({ app: job.app });\n case \"task\":\n return sink.scope({ task: job.place.nameId });\n case \"release\":\n return sink;\n }\n}\n\nfunction taskNumber(task: WrittenTask): number {\n const match = /^T-(\\d+)$/.exec(task.id.value) ?? /(?:^|\\/)T-(\\d+)-[^/]*$/.exec(task.file);\n\n return match ? Number(match[1]) : Number.MAX_SAFE_INTEGER;\n}\n\n/**\n * Parse every written file under `<root>/grimoire`. A project without a\n * `grimoire/` folder gives `written.exists === false` and no findings. Bad\n * input never throws: each problem is a `GR1xxx` finding at its line, and\n * the rest of the file is still read.\n *\n * @param root Absolute project root.\n */\nexport async function parseGrimoire(root: string): Promise<ParseGrimoireResult> {\n const absoluteRoot = path.resolve(root);\n const sink = new FindingSink();\n const hash = createHash(\"sha256\");\n const written: WrittenGrimoire = {\n root: absoluteRoot,\n exists: false,\n features: [],\n apps: [],\n tasks: [],\n releases: [],\n hash: \"\",\n };\n\n const grimoireStat = await stat(path.join(absoluteRoot, GRIMOIRE_DIR)).catch(() => null);\n\n if (!grimoireStat?.isDirectory()) {\n written.hash = hash.digest(\"hex\");\n\n return { written, findings: [] };\n }\n\n written.exists = true;\n\n const walker = new Walker(absoluteRoot, sink);\n await walker.walk();\n\n const texts = await mapLimited(walker.jobs, READ_CONCURRENCY, (job) =>\n readWritten(absoluteRoot, job.file, sinkFor(job, sink)),\n );\n const hashed = walker.jobs\n .map((job, index) => ({ file: job.file, read: texts[index] }))\n .sort((left, right) => (left.file < right.file ? -1 : left.file > right.file ? 1 : 0));\n\n for (const { file, read } of hashed) {\n if (!read) continue;\n\n hash.update(file);\n hash.update(\"\\0\");\n hash.update(read.bytes);\n hash.update(\"\\0\");\n }\n\n written.hash = hash.digest(\"hex\");\n\n const features = new Map<string, WrittenFeature>(\n walker.features.map((id) => [\n id,\n {\n id,\n dir: `${GRIMOIRE_DIR}/features/${id}`,\n readme: null,\n changelog: null,\n flows: [],\n versions: [],\n },\n ]),\n );\n const appReadmes = new Map<string, { file: string; readme: AppReadme }>();\n const layouts = new Map<string, WrittenLayout[]>();\n const pages = new Map<string, WrittenPage[]>();\n const blockFiles = new Map<string, WrittenBlockFile[]>();\n const tasks: WrittenTask[] = [];\n const releases: WrittenRelease[] = [];\n const push = <T>(map: Map<string, T[]>, key: string, value: T): void => {\n const list = map.get(key);\n\n if (list) list.push(value);\n else map.set(key, [value]);\n };\n\n walker.jobs.forEach((job, index) => {\n const read = texts[index];\n\n if (!read) return;\n\n const fileSink = sinkFor(job, sink);\n const text = read.text;\n\n switch (job.type) {\n case \"feature-readme\": {\n const feature = features.get(job.feature);\n if (feature) feature.readme = parseFeatureReadme(job.file, text, job.feature, fileSink);\n return;\n }\n case \"changelog\": {\n const feature = features.get(job.feature);\n if (feature) feature.changelog = parseChangelog(job.file, text, job.feature, fileSink);\n return;\n }\n case \"flow\":\n features\n .get(job.feature)\n ?.flows.push(parseFlow(job.file, text, job.feature, job.name, fileSink));\n return;\n case \"version\":\n features\n .get(job.feature)\n ?.versions.push(parseVersionBrief(job.file, text, job.feature, job.major, fileSink));\n return;\n case \"app-readme\":\n appReadmes.set(job.app, {\n file: job.file,\n readme: parseAppReadme(job.file, text, job.app, job.fallbackType, fileSink),\n });\n return;\n case \"layout\":\n push(layouts, job.app, parseLayout(job.file, text, job.app, job.id, fileSink));\n return;\n case \"page\":\n push(\n pages,\n `${job.app}/${job.pageType}/${job.id}`,\n parsePage(job.file, text, job.app, job.pageType, job.id, fileSink),\n );\n return;\n case \"block\":\n push(\n blockFiles,\n `${job.app}/${job.pageType}/${job.page}`,\n parseBlockFile(job.file, text, job.app, job.page, job.id, fileSink),\n );\n return;\n case \"task\":\n tasks.push(parseTask(job.file, text, job.place, fileSink));\n return;\n case \"release\":\n releases.push(parseRelease(job.file, text, job.name, fileSink));\n return;\n }\n });\n\n for (const feature of features.values()) {\n feature.versions.sort((left, right) => left.major - right.major);\n linkFlows(feature, sink.scope({ feature: feature.id }));\n written.features.push(feature);\n }\n\n for (const app of walker.apps) {\n const found = appReadmes.get(app.id);\n const missing = { value: app.id, at: lineAt(`${app.dir}/README.md`, 1) };\n const appPages = (type: PageType): WrittenPage[] =>\n [...pages.entries()]\n .filter(([key]) => key.startsWith(`${app.id}/${type}/`))\n .map(([key, list]) =>\n list.map((page) => ({ ...page, blockFiles: blockFiles.get(key) ?? [] })),\n )\n .flat();\n const pageList = appPages(\"page\");\n const screenList = appPages(\"screen\");\n\n written.apps.push({\n dir: app.dir,\n file: found?.file ?? null,\n id: found?.readme.id ?? missing,\n type: found?.readme.type ?? {\n value: screenList.length > 0 ? \"mobile\" : \"site\",\n at: missing.at,\n },\n root: found?.readme.root ?? { value: \"\", at: missing.at },\n origin: found?.readme.origin ?? null,\n heading: found?.readme.heading ?? null,\n conditions: found?.readme.conditions ?? [],\n layouts: layouts.get(app.id) ?? [],\n pages: pageList,\n screens: screenList,\n } satisfies WrittenApp);\n }\n\n duplicates(\n written.apps\n .filter((app) => app.file !== null)\n .map((app) => ({ id: app.id, subject: { app: app.id.value } })),\n \"app\",\n sink,\n );\n\n tasks.sort(\n (left, right) => taskNumber(left) - taskNumber(right) || (left.file < right.file ? -1 : 1),\n );\n duplicates(\n tasks\n .filter((task) => task.id.value !== \"\")\n .map((task) => ({ id: task.id, subject: { task: task.id.value } })),\n \"task\",\n sink,\n );\n written.tasks = tasks;\n written.releases = releases;\n\n return { written, findings: sink.sorted() };\n}\n\n/** GR1026 for a README flow with no file; GR1027 for a flow file the README does not list. */\nfunction linkFlows(feature: WrittenFeature, sink: FindingSink): void {\n if (feature.readme === null) return;\n\n const files = new Set(feature.flows.map((flow) => flow.ref.slice(feature.id.length + 1)));\n const listed = new Set(feature.readme.flows.map((line) => line.name));\n\n for (const line of feature.readme.flows) {\n if (!files.has(line.name)) {\n sink\n .scope({ flow: `${feature.id}/${line.name}` })\n .report(\n \"GR1026\",\n `the README lists the flow \"${line.name}\", which has no file flows/${line.name}.md.`,\n line.at,\n );\n }\n }\n\n for (const flow of feature.flows) {\n const name = flow.ref.slice(feature.id.length + 1);\n\n if (!listed.has(name)) {\n sink\n .scope({ flow: flow.ref })\n .report(\n \"GR1027\",\n `the flow \"${name}\" is not listed under \"## Flows\" in the feature README.`,\n lineAt(flow.file, 1),\n );\n }\n }\n}\n\n/** GR1022 for each id already used by an earlier file. */\nfunction duplicates(\n items: { id: Located<string>; subject: { app?: string; task?: string } }[],\n what: string,\n sink: FindingSink,\n): void {\n const seen = new Map<string, string>();\n\n for (const item of items) {\n const first = seen.get(item.id.value);\n\n if (first !== undefined) {\n sink\n .scope(item.subject)\n .report(\"GR1022\", `the ${what} id ${item.id.value} is also used by ${first}.`, item.id.at);\n continue;\n }\n\n seen.set(item.id.value, item.id.at.file);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoDA,MAAM,YAAY;AAClB,MAAM,QAAQ;AACd,MAAM,gBAAgB;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M;CACN,MAAM,uBAAO,IAAI,IAAoB;CAErC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,QAAQ,KAAK,IAAI,KAAK,GAAG,KAAK;EAEpC,IAAI,UAAU,QAAW;GACvB,KACG,MAAM,KAAK,OAAO,CAAC,CACnB,OAAO,UAAU,OAAO,KAAK,MAAM,KAAK,GAAG,MAAM,mBAAmB,MAAM,IAAI,KAAK,GAAG,EAAE;GAC3F;EACF;EAEA,KAAK,IAAI,KAAK,GAAG,OAAO,KAAK,GAAG,GAAG,IAAI;CACzC;AACF"}
|
package/llms-full.txt
CHANGED
|
@@ -98,6 +98,11 @@ folders: [src/app/auth]
|
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
- `origin: inferred` on the README and on each flow. The owner changes it to `confirmed`.
|
|
101
|
+
- **Summaries and stories in plain words.** Write the paragraph under each flow's title (what a user
|
|
102
|
+
does and gets, in one or two sentences) and, where the route and page names make the path clear,
|
|
103
|
+
a `## Story` of numbered sentences in the user's words. Add `audience` and a short `## Why` to
|
|
104
|
+
the README when the code shows who uses the feature and for what. Mark all of it inferred and
|
|
105
|
+
leave a screenshot out unless you can capture it; the owner confirms the wording.
|
|
101
106
|
- Start every feature at `1.0`. Do not reconstruct history; the changelog gets one line under `## Unreleased`
|
|
102
107
|
in the feature's own `CHANGELOG.md` (`grimoire/features/auth/CHANGELOG.md`), never in the README:
|
|
103
108
|
|
|
@@ -263,6 +268,8 @@ layout: site
|
|
|
263
268
|
|
|
264
269
|
The first page a visitor sees.
|
|
265
270
|
|
|
271
|
+

|
|
272
|
+
|
|
266
273
|
## Blocks
|
|
267
274
|
|
|
268
275
|
| Block | Flow | Who sees it | Changes with |
|
|
@@ -296,11 +303,21 @@ flow: catalog/new-arrivals
|
|
|
296
303
|
|
|
297
304
|
# New arrivals on the home page
|
|
298
305
|
|
|
306
|
+

|
|
307
|
+
|
|
299
308
|
- position second row, under Featured products
|
|
300
309
|
- shows a grid of up to 20 products
|
|
301
310
|
- phones one row that scrolls sideways
|
|
302
311
|
```
|
|
303
312
|
|
|
313
|
+
## Screenshots
|
|
314
|
+
|
|
315
|
+
Keep image files in `grimoire/screenshots/` (`.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`), for example
|
|
316
|
+
`grimoire/screenshots/web/home.png`. Write an image line `` anywhere in a page, screen
|
|
317
|
+
or block file, with the path relative to the Markdown file or starting with `/grimoire/screenshots/`.
|
|
318
|
+
The Product map shows these as "where you see it". An image outside the folder is a warning
|
|
319
|
+
(`GR1029`); a missing file is a warning (`GR2014`).
|
|
320
|
+
|
|
304
321
|
## Where a difference between apps goes
|
|
305
322
|
|
|
306
323
|
| The difference | Goes in |
|
|
@@ -494,11 +511,19 @@ npx warlock grimoire check
|
|
|
494
511
|
| A step names a route, page, mail or job that does not exist | Fix the name in the flow, or the code |
|
|
495
512
|
| A criterion has no test | Write the test, or say in the task why not |
|
|
496
513
|
| A test points at a criterion that does not exist | Fix the `@proves` line |
|
|
514
|
+
| Proofs exist but no test results were found (`GR4009`) | Record results, see below |
|
|
515
|
+
| A proving test the reporter could not match (`GR4010`) | Fix the `@proves` line or the test name |
|
|
497
516
|
| A file has no header, or no feature | `document-a-file` |
|
|
498
517
|
| A file in the feature's folders that no flow reaches | Describe the behaviour in a flow, or delete dead code |
|
|
499
518
|
| A README `updated` older than its newest changelog entry | Reshape the README |
|
|
500
519
|
| A changelog version that does not fit the word (`added` with `2.1`) | Fix the version |
|
|
501
520
|
|
|
521
|
+
**Recording results.** The check and the devtools tab read test results from
|
|
522
|
+
`grimoire/book/test-results.json`, written by the Grimoire Vitest reporter when the tests run. That
|
|
523
|
+
folder is not committed, so run the tests with the reporter in CI and ship the results file with the
|
|
524
|
+
deploy. To write it elsewhere, pass `grimoireReporter({ file })` and point the devtools panel at it
|
|
525
|
+
with the `testResultsFile` option.
|
|
526
|
+
|
|
502
527
|
Fix every line it prints. Do not finish with problems you caused. Findings on a flow or feature
|
|
503
528
|
with `status: proposed` print with `(expected)` and do not fail the check: leave them until the
|
|
504
529
|
code exists.
|
|
@@ -678,6 +703,11 @@ From `@warlock.js/grimoire` (no dependency on core or web):
|
|
|
678
703
|
release between `COLLECTED_START_MARKER` and `COLLECTED_END_MARKER`.
|
|
679
704
|
- `scanProofs` and `scanProofsInText` read `// @proves` lines; `criterionStatus` turns test
|
|
680
705
|
results into a criterion's status; `CASE_QUESTIONS` lists the questions every flow answers.
|
|
706
|
+
- Flow steps list `entries` (every file the step starts from), `direct` (their direct imports), `files` (what
|
|
707
|
+
runs: type-only imports are not followed) and `typeOnlyFiles` (reached only through type-only imports).
|
|
708
|
+
`importClosure(graph, start, { skipTypeOnly: true })` leaves type-only edges out. `warlock scry --flow --json`
|
|
709
|
+
keeps every list; the MCP tool `grimoire_flow` and the devtools flow route send counts and the first 50 direct
|
|
710
|
+
imports per step, and list one step's files on request (`files: "reachable"` or `"type-only"` with `step`).
|
|
681
711
|
- Helpers: `loadBook`, `readFrontMatter`, `fileGraph`, `importClosure`, `importerClosure`,
|
|
682
712
|
`bookEntryPath`, `bookEntryPaths`, `toPosixPath`, `GRIMOIRE_DIR`, `GRIMOIRE_PATHS`,
|
|
683
713
|
`GRIMOIRE_IGNORE_RULES` (the `.gitignore` lines) and `BOOK_SCHEMA_VERSION`.
|
|
@@ -689,10 +719,20 @@ the `grimoire` and `scry` commands for `cli.commands` in `warlock.config.ts`;
|
|
|
689
719
|
|
|
690
720
|
From `@warlock.js/grimoire/vitest`: `grimoireReporter` records the last result of every test marked
|
|
691
721
|
`// @proves` into `grimoire/book/test-results.json`. Add it to the Vitest `reporters` list.
|
|
722
|
+
`grimoireReporter({ file })` writes to another path (for a deploy that ships CI results); `readTestResults(root, file?)`
|
|
723
|
+
reads it, and the panel option `testResultsFile` and `openGrimoire` option `testResultsFile` point the tab at it.
|
|
724
|
+
The check warns with `GR4009` when `@proves` lines exist and no results were found, and with `GR4010` when the
|
|
725
|
+
reporter could not match a proving test.
|
|
692
726
|
|
|
693
727
|
From `@warlock.js/grimoire/devtools`: `grimoireDevtoolsPanel` (the default export) is the Grimoire
|
|
694
728
|
tab for `@warlock.js/devtools`, listed in `panels` of `src/config/devtools.ts`;
|
|
695
729
|
`exportGrimoireSite` writes the same view as a static site.
|
|
730
|
+
The tab keeps its snapshot until the book changes in production and refreshes it in the background in
|
|
731
|
+
development; the results file's modified time is part of the change stamp, so new results show without a restart.
|
|
732
|
+
The tab also has a Product map: the features, flows, apps, releases and planned work in plain words, from the written
|
|
733
|
+
files (summaries, `audience`, `## Why`, `## Story`) and the images in `grimoire/screenshots/`. Its routes are
|
|
734
|
+
`/product`, `/product/features/:feature` and `/product/flows/:feature/:flow`; `/check/groups` and `/check?code=`
|
|
735
|
+
give the check by code and a page of one code's findings. Set `ttlMs` with `panels: [["@warlock.js/grimoire/devtools", { ttlMs: 60_000 }]]`.
|
|
696
736
|
|
|
697
737
|
|
|
698
738
|
## write-a-feature `@warlock.js/grimoire/skills/write-a-feature/SKILL.md`
|
|
@@ -761,12 +801,17 @@ version: 3.0
|
|
|
761
801
|
updated: 2026-11-16
|
|
762
802
|
apps: [web-client, mobile]
|
|
763
803
|
folders: [src/app/catalog, src/web/$sites/client/products]
|
|
804
|
+
audience: [shoppers, store staff]
|
|
764
805
|
---
|
|
765
806
|
|
|
766
807
|
# Product catalog
|
|
767
808
|
|
|
768
809
|
Customers browse products, search them and see what is new.
|
|
769
810
|
|
|
811
|
+
## Why
|
|
812
|
+
|
|
813
|
+
Shoppers decide what to buy from the catalog, so it has to be quick to browse and clear about what is new.
|
|
814
|
+
|
|
770
815
|
## Flows
|
|
771
816
|
|
|
772
817
|
- browse-products list and filter products
|
|
@@ -778,6 +823,9 @@ Customers browse products, search them and see what is new.
|
|
|
778
823
|
- affected by orders/place-order (lowers stock)
|
|
779
824
|
```
|
|
780
825
|
|
|
826
|
+
`audience` (optional) lists who the feature is for, in plain words. `## Why` (optional) says why the
|
|
827
|
+
feature exists in a few sentences. Without `audience`, readers use the `who` of the flows.
|
|
828
|
+
|
|
781
829
|
`id` never changes. `folders` are the folders whose files belong to this feature. An entry with a
|
|
782
830
|
code-file extension names one file (`src/web/components/client/home/pricing-table.tsx`), for a
|
|
783
831
|
feature that owns a few files in a folder shared with others. A file entry wins over the folder
|
|
@@ -799,6 +847,15 @@ who: customer
|
|
|
799
847
|
|
|
800
848
|
# Save a product to the wishlist
|
|
801
849
|
|
|
850
|
+
A customer saves a product they like and finds it again later on their wishlist.
|
|
851
|
+
|
|
852
|
+
## Story
|
|
853
|
+
|
|
854
|
+
1. The customer opens a product and taps "Save for later".
|
|
855
|
+
2. The product shows a filled heart.
|
|
856
|
+

|
|
857
|
+
3. Later, the customer opens their wishlist and sees the product there.
|
|
858
|
+
|
|
802
859
|
## Steps
|
|
803
860
|
|
|
804
861
|
1. page /products/:id
|
|
@@ -815,7 +872,7 @@ who: customer
|
|
|
815
872
|
- invalid input a product id that is not an id → 422
|
|
816
873
|
- not allowed guest → sent to sign in, then back to the product
|
|
817
874
|
- not found the product does not exist → 404
|
|
818
|
-
- duplicate already saved → stays saved, no error
|
|
875
|
+
- duplicate already saved → stays saved, no error (AC-2)
|
|
819
876
|
- limits at most 200 products
|
|
820
877
|
- expiry does not apply: saved products do not expire
|
|
821
878
|
- double submit two taps save once
|
|
@@ -829,6 +886,23 @@ who: customer
|
|
|
829
886
|
- AC-4 [mobile] the product card has a save button
|
|
830
887
|
```
|
|
831
888
|
|
|
889
|
+
**Summary.** The paragraph under the `# Title`: one or two plain sentences saying who does what and
|
|
890
|
+
what they get. A flow with none gets a warning (`GR1030`).
|
|
891
|
+
|
|
892
|
+
**Story.** Optional. Numbered sentences in the user's words, without file names or code, for readers
|
|
893
|
+
who do not read code. Indent a second line to continue a sentence. An image line
|
|
894
|
+
`` under a step attaches a screenshot to it.
|
|
895
|
+
|
|
896
|
+
**Screenshots.** Keep image files in `grimoire/screenshots/` (any subfolders; `.png`, `.jpg`,
|
|
897
|
+
`.jpeg`, `.webp` or `.gif`). Write the path relative to the Markdown file, so it also shows on a git
|
|
898
|
+
host (`../../../screenshots/web/wishlist-saved.png` from a flow file), or start it with
|
|
899
|
+
`/grimoire/screenshots/`. An image outside that folder is a warning (`GR1029`), a missing file too
|
|
900
|
+
(`GR2014`).
|
|
901
|
+
|
|
902
|
+
**Product map.** The Grimoire tab has a Product map for readers who are not developers. They see the
|
|
903
|
+
flow summary, the feature's why and audience, the story in plain words and the screenshots there,
|
|
904
|
+
so write them for a person who has never opened the code.
|
|
905
|
+
|
|
832
906
|
**Steps.** Each step has a kind and the name used in code: `page`, `route`, `mail`,
|
|
833
907
|
`notification`, `job`, `event`, `outside service`. Use `affects` for an effect on another
|
|
834
908
|
feature (`affects catalog/stock`). Warlock checks every name exists. A mail is a `*.mail.ts` or
|
|
@@ -839,7 +913,8 @@ When two sites, or a site and the mobile app, have a page with the same path, na
|
|
|
839
913
|
the path in brackets: `page /support [web-admin]`. The step then looks in that app only (its
|
|
840
914
|
pages, or its screens for a mobile app). Without brackets it looks in the apps the feature lists.
|
|
841
915
|
|
|
842
|
-
**Cases.**
|
|
916
|
+
**Cases.** End a case line with `(AC-n)` (or `(AC-1, AC-2)`) to link it to the criterion that
|
|
917
|
+
proves it; a number the flow does not have is an error (`GR2013`). Answer all eight questions (invalid input, not allowed, not found, duplicate, limits,
|
|
843
918
|
expiry, double submit, outside service down), each with a case or "does not apply" and the
|
|
844
919
|
reason. A flow that skips one gets a finding. Do not invent cases beyond the questions unless the owner described one.
|
|
845
920
|
|
package/package.json
CHANGED
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"environment": "server"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@warlock.js/core": "5.
|
|
30
|
-
"@warlock.js/web": "5.
|
|
29
|
+
"@warlock.js/core": "5.58.0",
|
|
30
|
+
"@warlock.js/web": "5.58.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependenciesMeta": {
|
|
33
33
|
"@warlock.js/web": {
|
|
34
34
|
"optional": true
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
"version": "5.
|
|
37
|
+
"version": "5.58.0",
|
|
38
38
|
"type": "module",
|
|
39
39
|
"main": "./esm/index.mjs",
|
|
40
40
|
"module": "./esm/index.mjs",
|
|
@@ -60,6 +60,11 @@ folders: [src/app/auth]
|
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
- `origin: inferred` on the README and on each flow. The owner changes it to `confirmed`.
|
|
63
|
+
- **Summaries and stories in plain words.** Write the paragraph under each flow's title (what a user
|
|
64
|
+
does and gets, in one or two sentences) and, where the route and page names make the path clear,
|
|
65
|
+
a `## Story` of numbered sentences in the user's words. Add `audience` and a short `## Why` to
|
|
66
|
+
the README when the code shows who uses the feature and for what. Mark all of it inferred and
|
|
67
|
+
leave a screenshot out unless you can capture it; the owner confirms the wording.
|
|
63
68
|
- Start every feature at `1.0`. Do not reconstruct history; the changelog gets one line under `## Unreleased`
|
|
64
69
|
in the feature's own `CHANGELOG.md` (`grimoire/features/auth/CHANGELOG.md`), never in the README:
|
|
65
70
|
|
|
@@ -93,6 +93,8 @@ layout: site
|
|
|
93
93
|
|
|
94
94
|
The first page a visitor sees.
|
|
95
95
|
|
|
96
|
+

|
|
97
|
+
|
|
96
98
|
## Blocks
|
|
97
99
|
|
|
98
100
|
| Block | Flow | Who sees it | Changes with |
|
|
@@ -126,11 +128,21 @@ flow: catalog/new-arrivals
|
|
|
126
128
|
|
|
127
129
|
# New arrivals on the home page
|
|
128
130
|
|
|
131
|
+

|
|
132
|
+
|
|
129
133
|
- position second row, under Featured products
|
|
130
134
|
- shows a grid of up to 20 products
|
|
131
135
|
- phones one row that scrolls sideways
|
|
132
136
|
```
|
|
133
137
|
|
|
138
|
+
## Screenshots
|
|
139
|
+
|
|
140
|
+
Keep image files in `grimoire/screenshots/` (`.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`), for example
|
|
141
|
+
`grimoire/screenshots/web/home.png`. Write an image line `` anywhere in a page, screen
|
|
142
|
+
or block file, with the path relative to the Markdown file or starting with `/grimoire/screenshots/`.
|
|
143
|
+
The Product map shows these as "where you see it". An image outside the folder is a warning
|
|
144
|
+
(`GR1029`); a missing file is a warning (`GR2014`).
|
|
145
|
+
|
|
134
146
|
## Where a difference between apps goes
|
|
135
147
|
|
|
136
148
|
| The difference | Goes in |
|
|
@@ -79,11 +79,19 @@ npx warlock grimoire check
|
|
|
79
79
|
| A step names a route, page, mail or job that does not exist | Fix the name in the flow, or the code |
|
|
80
80
|
| A criterion has no test | Write the test, or say in the task why not |
|
|
81
81
|
| A test points at a criterion that does not exist | Fix the `@proves` line |
|
|
82
|
+
| Proofs exist but no test results were found (`GR4009`) | Record results, see below |
|
|
83
|
+
| A proving test the reporter could not match (`GR4010`) | Fix the `@proves` line or the test name |
|
|
82
84
|
| A file has no header, or no feature | `document-a-file` |
|
|
83
85
|
| A file in the feature's folders that no flow reaches | Describe the behaviour in a flow, or delete dead code |
|
|
84
86
|
| A README `updated` older than its newest changelog entry | Reshape the README |
|
|
85
87
|
| A changelog version that does not fit the word (`added` with `2.1`) | Fix the version |
|
|
86
88
|
|
|
89
|
+
**Recording results.** The check and the devtools tab read test results from
|
|
90
|
+
`grimoire/book/test-results.json`, written by the Grimoire Vitest reporter when the tests run. That
|
|
91
|
+
folder is not committed, so run the tests with the reporter in CI and ship the results file with the
|
|
92
|
+
deploy. To write it elsewhere, pass `grimoireReporter({ file })` and point the devtools panel at it
|
|
93
|
+
with the `testResultsFile` option.
|
|
94
|
+
|
|
87
95
|
Fix every line it prints. Do not finish with problems you caused. Findings on a flow or feature
|
|
88
96
|
with `status: proposed` print with `(expected)` and do not fail the check: leave them until the
|
|
89
97
|
code exists.
|
|
@@ -120,6 +120,11 @@ From `@warlock.js/grimoire` (no dependency on core or web):
|
|
|
120
120
|
release between `COLLECTED_START_MARKER` and `COLLECTED_END_MARKER`.
|
|
121
121
|
- `scanProofs` and `scanProofsInText` read `// @proves` lines; `criterionStatus` turns test
|
|
122
122
|
results into a criterion's status; `CASE_QUESTIONS` lists the questions every flow answers.
|
|
123
|
+
- Flow steps list `entries` (every file the step starts from), `direct` (their direct imports), `files` (what
|
|
124
|
+
runs: type-only imports are not followed) and `typeOnlyFiles` (reached only through type-only imports).
|
|
125
|
+
`importClosure(graph, start, { skipTypeOnly: true })` leaves type-only edges out. `warlock scry --flow --json`
|
|
126
|
+
keeps every list; the MCP tool `grimoire_flow` and the devtools flow route send counts and the first 50 direct
|
|
127
|
+
imports per step, and list one step's files on request (`files: "reachable"` or `"type-only"` with `step`).
|
|
123
128
|
- Helpers: `loadBook`, `readFrontMatter`, `fileGraph`, `importClosure`, `importerClosure`,
|
|
124
129
|
`bookEntryPath`, `bookEntryPaths`, `toPosixPath`, `GRIMOIRE_DIR`, `GRIMOIRE_PATHS`,
|
|
125
130
|
`GRIMOIRE_IGNORE_RULES` (the `.gitignore` lines) and `BOOK_SCHEMA_VERSION`.
|
|
@@ -131,7 +136,17 @@ the `grimoire` and `scry` commands for `cli.commands` in `warlock.config.ts`;
|
|
|
131
136
|
|
|
132
137
|
From `@warlock.js/grimoire/vitest`: `grimoireReporter` records the last result of every test marked
|
|
133
138
|
`// @proves` into `grimoire/book/test-results.json`. Add it to the Vitest `reporters` list.
|
|
139
|
+
`grimoireReporter({ file })` writes to another path (for a deploy that ships CI results); `readTestResults(root, file?)`
|
|
140
|
+
reads it, and the panel option `testResultsFile` and `openGrimoire` option `testResultsFile` point the tab at it.
|
|
141
|
+
The check warns with `GR4009` when `@proves` lines exist and no results were found, and with `GR4010` when the
|
|
142
|
+
reporter could not match a proving test.
|
|
134
143
|
|
|
135
144
|
From `@warlock.js/grimoire/devtools`: `grimoireDevtoolsPanel` (the default export) is the Grimoire
|
|
136
145
|
tab for `@warlock.js/devtools`, listed in `panels` of `src/config/devtools.ts`;
|
|
137
146
|
`exportGrimoireSite` writes the same view as a static site.
|
|
147
|
+
The tab keeps its snapshot until the book changes in production and refreshes it in the background in
|
|
148
|
+
development; the results file's modified time is part of the change stamp, so new results show without a restart.
|
|
149
|
+
The tab also has a Product map: the features, flows, apps, releases and planned work in plain words, from the written
|
|
150
|
+
files (summaries, `audience`, `## Why`, `## Story`) and the images in `grimoire/screenshots/`. Its routes are
|
|
151
|
+
`/product`, `/product/features/:feature` and `/product/flows/:feature/:flow`; `/check/groups` and `/check?code=`
|
|
152
|
+
give the check by code and a page of one code's findings. Set `ttlMs` with `panels: [["@warlock.js/grimoire/devtools", { ttlMs: 60_000 }]]`.
|
|
@@ -62,12 +62,17 @@ version: 3.0
|
|
|
62
62
|
updated: 2026-11-16
|
|
63
63
|
apps: [web-client, mobile]
|
|
64
64
|
folders: [src/app/catalog, src/web/$sites/client/products]
|
|
65
|
+
audience: [shoppers, store staff]
|
|
65
66
|
---
|
|
66
67
|
|
|
67
68
|
# Product catalog
|
|
68
69
|
|
|
69
70
|
Customers browse products, search them and see what is new.
|
|
70
71
|
|
|
72
|
+
## Why
|
|
73
|
+
|
|
74
|
+
Shoppers decide what to buy from the catalog, so it has to be quick to browse and clear about what is new.
|
|
75
|
+
|
|
71
76
|
## Flows
|
|
72
77
|
|
|
73
78
|
- browse-products list and filter products
|
|
@@ -79,6 +84,9 @@ Customers browse products, search them and see what is new.
|
|
|
79
84
|
- affected by orders/place-order (lowers stock)
|
|
80
85
|
```
|
|
81
86
|
|
|
87
|
+
`audience` (optional) lists who the feature is for, in plain words. `## Why` (optional) says why the
|
|
88
|
+
feature exists in a few sentences. Without `audience`, readers use the `who` of the flows.
|
|
89
|
+
|
|
82
90
|
`id` never changes. `folders` are the folders whose files belong to this feature. An entry with a
|
|
83
91
|
code-file extension names one file (`src/web/components/client/home/pricing-table.tsx`), for a
|
|
84
92
|
feature that owns a few files in a folder shared with others. A file entry wins over the folder
|
|
@@ -100,6 +108,15 @@ who: customer
|
|
|
100
108
|
|
|
101
109
|
# Save a product to the wishlist
|
|
102
110
|
|
|
111
|
+
A customer saves a product they like and finds it again later on their wishlist.
|
|
112
|
+
|
|
113
|
+
## Story
|
|
114
|
+
|
|
115
|
+
1. The customer opens a product and taps "Save for later".
|
|
116
|
+
2. The product shows a filled heart.
|
|
117
|
+

|
|
118
|
+
3. Later, the customer opens their wishlist and sees the product there.
|
|
119
|
+
|
|
103
120
|
## Steps
|
|
104
121
|
|
|
105
122
|
1. page /products/:id
|
|
@@ -116,7 +133,7 @@ who: customer
|
|
|
116
133
|
- invalid input a product id that is not an id → 422
|
|
117
134
|
- not allowed guest → sent to sign in, then back to the product
|
|
118
135
|
- not found the product does not exist → 404
|
|
119
|
-
- duplicate already saved → stays saved, no error
|
|
136
|
+
- duplicate already saved → stays saved, no error (AC-2)
|
|
120
137
|
- limits at most 200 products
|
|
121
138
|
- expiry does not apply: saved products do not expire
|
|
122
139
|
- double submit two taps save once
|
|
@@ -130,6 +147,23 @@ who: customer
|
|
|
130
147
|
- AC-4 [mobile] the product card has a save button
|
|
131
148
|
```
|
|
132
149
|
|
|
150
|
+
**Summary.** The paragraph under the `# Title`: one or two plain sentences saying who does what and
|
|
151
|
+
what they get. A flow with none gets a warning (`GR1030`).
|
|
152
|
+
|
|
153
|
+
**Story.** Optional. Numbered sentences in the user's words, without file names or code, for readers
|
|
154
|
+
who do not read code. Indent a second line to continue a sentence. An image line
|
|
155
|
+
`` under a step attaches a screenshot to it.
|
|
156
|
+
|
|
157
|
+
**Screenshots.** Keep image files in `grimoire/screenshots/` (any subfolders; `.png`, `.jpg`,
|
|
158
|
+
`.jpeg`, `.webp` or `.gif`). Write the path relative to the Markdown file, so it also shows on a git
|
|
159
|
+
host (`../../../screenshots/web/wishlist-saved.png` from a flow file), or start it with
|
|
160
|
+
`/grimoire/screenshots/`. An image outside that folder is a warning (`GR1029`), a missing file too
|
|
161
|
+
(`GR2014`).
|
|
162
|
+
|
|
163
|
+
**Product map.** The Grimoire tab has a Product map for readers who are not developers. They see the
|
|
164
|
+
flow summary, the feature's why and audience, the story in plain words and the screenshots there,
|
|
165
|
+
so write them for a person who has never opened the code.
|
|
166
|
+
|
|
133
167
|
**Steps.** Each step has a kind and the name used in code: `page`, `route`, `mail`,
|
|
134
168
|
`notification`, `job`, `event`, `outside service`. Use `affects` for an effect on another
|
|
135
169
|
feature (`affects catalog/stock`). Warlock checks every name exists. A mail is a `*.mail.ts` or
|
|
@@ -140,7 +174,8 @@ When two sites, or a site and the mobile app, have a page with the same path, na
|
|
|
140
174
|
the path in brackets: `page /support [web-admin]`. The step then looks in that app only (its
|
|
141
175
|
pages, or its screens for a mobile app). Without brackets it looks in the apps the feature lists.
|
|
142
176
|
|
|
143
|
-
**Cases.**
|
|
177
|
+
**Cases.** End a case line with `(AC-n)` (or `(AC-1, AC-2)`) to link it to the criterion that
|
|
178
|
+
proves it; a number the flow does not have is an error (`GR2013`). Answer all eight questions (invalid input, not allowed, not found, duplicate, limits,
|
|
144
179
|
expiry, double submit, outside service down), each with a case or "does not apply" and the
|
|
145
180
|
reason. A flow that skips one gets a finding. Do not invent cases beyond the questions unless the owner described one.
|
|
146
181
|
|
package/ui/grimoire-static.js
CHANGED
|
@@ -104,6 +104,10 @@ function grimoireStaticContext(data, root, rerender) {
|
|
|
104
104
|
else location.hash = next;
|
|
105
105
|
},
|
|
106
106
|
refresh: rerender,
|
|
107
|
+
// Screenshots sit next to index.html, in the same folder layout as grimoire/screenshots/.
|
|
108
|
+
file: (src) => `screenshots/${String(src).split("/").map(encodeURIComponent).join("/")}`,
|
|
109
|
+
shared: false,
|
|
110
|
+
share: null,
|
|
107
111
|
el,
|
|
108
112
|
svg: (tag, attrs = {}, children = []) =>
|
|
109
113
|
build(document.createElementNS(GRIMOIRE_STATIC_SVG, tag), attrs, children),
|