@bitcobblers/wod-wiki-engine 0.35.2115 → 0.35.2117
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/dist/bin/wod.cjs +912 -937
- package/dist/bin/wod.cjs.map +1 -1
- package/dist/bin/wod.mjs +2 -2
- package/dist/{chunk-B2OYLNEZ.mjs → chunk-AKNXDA75.mjs} +735 -679
- package/dist/chunk-AKNXDA75.mjs.map +1 -0
- package/dist/chunk-Y6WO6MXS.mjs +187 -0
- package/dist/chunk-Y6WO6MXS.mjs.map +1 -0
- package/dist/{compiler-KTBR6OEL.mjs → compiler-MQRZVZQW.mjs} +64 -326
- package/dist/compiler-MQRZVZQW.mjs.map +1 -0
- package/dist/index.cjs +924 -936
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -23
- package/dist/index.d.ts +93 -23
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -5
- package/dist/chunk-6L5ZDZJ7.mjs +0 -15
- package/dist/chunk-6L5ZDZJ7.mjs.map +0 -1
- package/dist/chunk-B2OYLNEZ.mjs.map +0 -1
- package/dist/compiler-KTBR6OEL.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/seedbuild/contract.ts","../src/cli/seedbuild/effort-slugs.ts","../src/cli/seedbuild/filename.ts","../src/cli/seedbuild/frontmatter.ts","../src/cli/seedbuild/effort-file.ts","../src/cli/seedbuild/git-version.ts","../src/cli/seedbuild/report.ts","../src/cli/seedbuild/compiler.ts"],"names":["join","execSync","writeFileSync"],"mappings":";;;;;;;;;;;;;;;AA+DO,IAAM,WAAA,GAAc,CAAA;AAEpB,IAAM,iBAAA,GAAoB,UAAA;AAE1B,IAAM,mBAAA,GAAsB,YAAA;AAE5B,IAAM,wBAAA,GAA2B,cAAA;AAEjC,IAAM,0BAAA,GAA6B,gBAAA;AAQnC,SAAS,gBAAgB,OAAA,EAAgC;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OEL.mjs","sourcesContent":["/**\n * Seed contract — producer side.\n *\n * Mirrors the runtime consumer copy in the wod-wiki app\n * (apps/playground/src/types/seed.ts). The two MUST stay shape-compatible:\n * the app validates the manifest with `assertManifest` (required fields\n * only, extra fields tolerated) and applies chunk rows structurally.\n *\n * ponytail: the contract is duplicated rather than shared via a published\n * package to keep this repo standalone for content contributors; upgrade\n * path is moving these types into @bitcobblers/wod-wiki-core and importing\n * from both sides.\n */\n\n/** One row of a seed chunk — a source file's identity + raw text. */\nexport interface SeedRow {\n /** Repo-relative POSIX path of the source markdown (`markdown/…`). */\n path: string;\n /** Raw file text. */\n content: string;\n}\n\n/** Chunk payload kinds. `'block-index'` chunks carry precomputed BlockIndexRow[]; `'block-efforts'` chunks carry precomputed BlockEffort[]. */\nexport type ChunkKind = 'notes' | 'block-index' | 'block-efforts';\n\n/** One chunk entry in the seed manifest. */\nexport interface ManifestChunk {\n id: string;\n /** Path under the seed dir, e.g. `chunks/efforts.ab12cd34.json`. */\n path: string;\n /**\n * Full hex sha256 of the chunk bytes — the change-detection token for\n * checkpointed re-import.\n */\n sha256: string;\n bytes: number;\n /** Row count. */\n count: number;\n /** Row payload kind — defaults to `'notes'` (raw markdown rows). */\n kind?: ChunkKind;\n}\n\n/** `seed/manifest.json` — the only file a boot version check must fetch. */\nexport interface SeedManifest {\n /** Seed format version — bump on incompatible row-shape changes. */\n schema: number;\n /**\n * Monotonic import-order version: commit count of this repo\n * (`git rev-list --count HEAD`). Advances with every merged MR, so the\n * app can order checkpoints; per-chunk sha256 is the real change token.\n */\n version: number;\n /** Human-readable git version, e.g. `v1.2.0-4-gdeadbee` (git describe --long --always --dirty). */\n versionLabel?: string;\n /** Full HEAD commit sha this artifact was built from. */\n commit?: string;\n /** True when the working tree had uncommitted changes at build time. */\n dirty?: boolean;\n builtAt: string;\n chunks: ManifestChunk[];\n}\n\n/** v7 — notes carry their real corpus `sourceId` and dashboards chunk rows type 'dashboard'. Keep in sync with the app's copy. */\nexport const SEED_SCHEMA = 7;\n/** Playground template chunk — the new-playground template is playground intake, not journal content. */\nexport const TEMPLATE_CHUNK_ID = 'template';\n/** The prebuilt dashboard notes corpus — one notes chunk, gated by validateDashboardNote. */\nexport const DASHBOARDS_CHUNK_ID = 'dashboards';\n/** Prefix of the split block-index chunks (`block-index.<n>`). */\nexport const BLOCK_INDEX_CHUNK_PREFIX = 'block-index.';\n/** Prefix of the split block-efforts chunks (`block-efforts.<n>`). */\nexport const BLOCK_EFFORTS_CHUNK_PREFIX = 'block-efforts.';\n\n/** Frontmatter `route:` of a canvas page, minus the leading slash; null when\n * absent, degenerate ('/'), or the file is not a canvas page (`template:\n * canvas` required — section fragments and snippets carry `title:`/`section:`\n * frontmatter instead and must never become Library entries). Mirrors the\n * runtime's route resolution, so a guide's block-index noteId doubles as\n * its deep-link path. */\nexport function canvasRouteSlug(content: string): string | null {\n const fm = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---/.exec(content);\n if (fm?.[1] && !/^template:\\s*canvas\\s*$/m.test(fm[1])) return null;\n const route = fm?.[1]?.match(/^route:\\s*(\\S+)\\s*$/m)?.[1];\n if (!route) return null;\n return route.replace(/^\\//, '') || null;\n}\n","/**\n * extractEffortSlugs — port of wod-wiki's\n * apps/playground/src/services/storage/StorageService.ts (the pure function\n * only). Derives canonical effort slugs referenced by script statements for\n * the block-efforts containment index.\n */\nimport type { ICodeStatement } from '@bitcobblers/wod-wiki-core';\n\nexport function extractEffortSlugs(statements: ICodeStatement[]): string[] {\n const slugs = new Set<string>();\n for (const statement of statements) {\n if (statement.exerciseId) {\n slugs.add(statement.exerciseId);\n } else {\n const effortMetric = statement.metrics?.getMetric?.('effort');\n const effort = effortMetric && typeof effortMetric.value === 'string' ? effortMetric.value : undefined;\n if (effort) {\n const slug = effort.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\n if (slug) slugs.add(slug);\n }\n }\n }\n return Array.from(slugs);\n}\n","/**\n * fileToDisplayName — port of wod-wiki's\n * apps/playground/src/repositories/groupings.ts (display-name derivation\n * only). Block-index rows carry the same note titles the app renders, so\n * titles must derive identically on both sides.\n */\n\n/** Lowercased mid-title words — \"and\", \"of\", \"70.3\"-style fragments read wrong capped. */\nconst FILE_TITLE_STOP_WORDS: Record<string, true> = {\n and: true, or: true, of: true, for: true, to: true, in: true, on: true,\n at: true, by: true, with: true, the: true, a: true, an: true,\n};\n\n/**\n * Parse a filename into a display name.\n * \"simple-and-sinister.md\" -> \"Simple and Sinister\"\n */\nexport function fileToDisplayName(filename: string): string {\n const base = filename.replace(/\\.md$/, '');\n if (base.toUpperCase() === 'README') return 'Overview';\n // Strip leading \"day-01-\" prefixes if present, then humanise\n const cleaned = base.replace(/^day-\\d+-/, '');\n const tokens = cleaned.split(/[-_]/);\n const titled: string[] = [];\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]!;\n const next = tokens[i + 1];\n const after = tokens[i + 2];\n const prev = tokens[i - 1];\n // Race distances keep their dot: a lone 1-2-digit pair (\"70-3\" -> \"70.3\").\n // Longer numeric runs are dates (2009-12-01) or rep ladders (5-3-1) —\n // only an isolated pair between words is a distance.\n if (\n /^\\d{1,2}$/.test(token) && /^\\d{1,2}$/.test(next ?? '')\n && !/^\\d+$/.test(prev ?? '') && !/^\\d+$/.test(after ?? '')\n ) {\n titled.push(`${token}.${next}`);\n i++;\n continue;\n }\n if (titled.length > 0 && FILE_TITLE_STOP_WORDS[token.toLowerCase()]) {\n titled.push(token.toLowerCase());\n continue;\n }\n titled.push(token.charAt(0).toUpperCase() + token.slice(1));\n }\n return titled.join(' ');\n}\n","/**\n * Frontmatter parser — port of wod-wiki's apps/playground/src/lib/frontmatter.ts\n * (parseFrontmatter/getScalar/getList only; the editor-only helpers\n * (LinkWidget, YouTube, serialize) stay in the app).\n *\n * ponytail: semantics must match the app's parser exactly — the seed\n * compiler and the app runtime derive frontmatter from the same corpus.\n * Upgrade path: publish the parser in @bitcobblers/wod-wiki-core and import\n * from both sides.\n */\n\nexport interface ParsedFrontmatter {\n meta: Record<string, string | number | string[]>\n body: string\n}\n\n/** Leading `---` … `---` block; body is everything after the closing delimiter. */\nconst FRONTMATTER_RE = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n?/;\n\n/** Strip matched wrapping quotes: `\"x\"` / `'x'` → `x`; mismatched quotes are kept.\n * Double-quoted values also collapse the serializer's escapes (`\\\\\"`, `\\\\\\\\`). */\nfunction unquote(value: string): string {\n return value.replace(/^(['\"])(.*)\\1$/, (_match, quote: string, inner: string) =>\n quote === '\"' ? inner.replace(/\\\\([\"\\\\])/g, '$1') : inner,\n );\n}\n\n/**\n * Parse the leading YAML frontmatter block of a markdown string.\n *\n * Semantics (mirrors the app):\n * - Scalar `key: value` (key `/^[A-Za-z][\\w.-]*$/`, dots allow flat nested\n * keys like `book.title`): wrapping quotes stripped; bare numeric strings\n * become `number`, quoted scalars always stay strings.\n * - `key:` with empty value followed by indented `- item` lines → `string[]`.\n * - `key:` with empty value and no list items → `''`.\n * - Inline `key: [a, b]` stays a plain scalar string.\n */\nexport function parseFrontmatter(raw: string): ParsedFrontmatter {\n const match = raw.match(FRONTMATTER_RE);\n if (!match) return { meta: {}, body: raw };\n return { meta: parseMetaLines(match[1].split(/\\r?\\n/)), body: raw.slice(match[0].length) };\n}\n\nfunction parseMetaLines(lines: string[]): ParsedFrontmatter['meta'] {\n const meta: ParsedFrontmatter['meta'] = {};\n\n for (let i = 0; i < lines.length; i++) {\n const keyMatch = lines[i].match(/^([A-Za-z][\\w.-]*)\\s*:(.*)$/);\n if (!keyMatch) continue; // indented/nested/list lines are not top-level keys\n\n const key = keyMatch[1];\n const rawVal = keyMatch[2].trim();\n\n if (rawVal === '') {\n const items: string[] = [];\n while (i + 1 < lines.length) {\n const itemMatch = lines[i + 1].match(/^\\s+-\\s+(.+)$/);\n if (!itemMatch) break;\n items.push(itemMatch[1].trim());\n i++;\n }\n meta[key] = items.length > 0 ? items : '';\n } else {\n const wasQuoted = /^(['\"])(.*)\\1$/.test(rawVal);\n const value = unquote(rawVal);\n const num = Number(value);\n meta[key] = !wasQuoted && value !== '' && !isNaN(num) ? num : value;\n }\n }\n\n return meta;\n}\n\n/** Scalar value at `key`, or `undefined` when absent or a list. */\nexport function getScalar(\n meta: ParsedFrontmatter['meta'],\n key: string,\n): string | number | undefined {\n const value = meta[key];\n return typeof value === 'string' || typeof value === 'number' ? value : undefined;\n}\n\n/** List value at `key`, or `[]` when absent or a scalar. */\nexport function getList(meta: ParsedFrontmatter['meta'], key: string): string[] {\n const value = meta[key];\n return Array.isArray(value) ? value : [];\n}\n","/**\n * Effort-file parsing — port of wod-wiki's\n * apps/playground/src/repositories/effort-markdown.ts (parse-frontmatter\n * direction only; effortToDocument/documentToEffort stay in the app).\n *\n * The compiler needs `parseEffortFile` to build the effort alias map used by\n * block-efforts row derivation. Semantics MUST match the app's runtime effort\n * materialization — alias/slug drift would desync the block plane from the\n * note plane.\n *\n * ponytail: duplicated rather than package-shared to keep this repo\n * standalone; upgrade path is the same published effort-format module\n * imported by both sides.\n */\nimport {\n isEffortDiscipline,\n type IEffort,\n type EffortRegistrySource,\n type IntensityTier,\n} from '@bitcobblers/wod-wiki-lang';\nimport { parseFrontmatter, getScalar, getList } from './frontmatter';\n\n/** Validate a parsed discipline against the canonical vocabulary. */\nfunction parseDiscipline(val: string | undefined): IEffort['baseAttributes']['discipline'] {\n if (!val) return undefined;\n const normalized = unquoteYaml(val.trim()).toLowerCase();\n if (isEffortDiscipline(normalized)) return normalized as IEffort['baseAttributes']['discipline'];\n console.warn(`[effort-file] unknown discipline '${val}' — treating as unset`);\n return undefined;\n}\n\nfunction unquoteYaml(val: string): string {\n if (val.startsWith('\"') && val.endsWith('\"')) {\n return val.slice(1, -1).replace(/\\\\([\"\\\\])/g, '$1');\n }\n if (val.startsWith(\"'\") && val.endsWith(\"'\")) {\n return val.slice(1, -1).replace(/\\\\'/g, \"'\");\n }\n return val;\n}\n\n/** Coerce a scalar from a nested block: booleans/numbers are coerced; everything else stays a string. */\nfunction coerceNestedScalar(raw: string): unknown {\n if (raw === 'true') return true;\n if (raw === 'false') return false;\n if (raw !== '' && !Number.isNaN(Number(raw))) return Number(raw);\n return raw;\n}\n\n/**\n * Read a nested (`key:` followed by indented entries) section from frontmatter\n * lines. Two levels are supported (`derivation.coefficients.*`).\n */\nfunction readNestedSection(lines: string[], key: string): Record<string, unknown> | undefined {\n const start = lines.findIndex(l => new RegExp(`^${key}:\\\\s*$`).test(l));\n if (start === -1) return undefined;\n\n const result: Record<string, unknown> = {};\n let subKey: string | null = null;\n\n for (let i = start + 1; i < lines.length; i++) {\n const line = lines[i];\n if (/^\\S/.test(line)) break; // next top-level key ends the block\n\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('#')) continue;\n\n const indent = line.length - line.trimStart().length;\n const m = trimmed.match(/^([\\w.-]+):\\s*(.*)$/);\n if (!m) continue;\n const [, k, rawVal] = m;\n\n if (indent === 2) {\n if (rawVal === '') {\n subKey = k;\n result[k] = {};\n } else {\n subKey = null;\n result[k] = coerceNestedScalar(rawVal);\n }\n } else if (indent >= 4 && subKey !== null) {\n (result[subKey] as Record<string, unknown>)[k] = coerceNestedScalar(rawVal);\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/** Parse a single bundled effort markdown file into an IEffort (null when malformed). */\nexport function parseEffortFile(raw: string): IEffort | null {\n const blockMatch = raw.match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---/);\n if (!blockMatch) return null;\n\n const { meta, body } = parseFrontmatter(raw);\n const innerLines = blockMatch[1].split(/\\r?\\n/);\n\n const id = getScalar(meta, 'id');\n const slug = getScalar(meta, 'slug');\n const label = getScalar(meta, 'label');\n const aliases = getList(meta, 'aliases');\n\n const baseAttrs = readNestedSection(innerLines, 'baseAttributes');\n const hints = readNestedSection(innerLines, 'hints');\n const derivation = readNestedSection(innerLines, 'derivation');\n\n const metRaw = baseAttrs?.met;\n const met = typeof metRaw === 'number' ? metRaw : Number(metRaw);\n if (!id || !slug || !label || metRaw === undefined || Number.isNaN(met)) return null;\n\n const discipline = parseDiscipline(\n typeof baseAttrs?.discipline === 'string' ? baseAttrs.discipline : undefined,\n );\n const intensityTier = baseAttrs?.intensityTier;\n const trimmedBody = body.trim();\n\n return {\n id: String(id),\n slug: String(slug),\n label: String(label),\n aliases,\n baseAttributes: {\n met,\n ...(discipline ? { discipline } : {}),\n ...(intensityTier ? { intensityTier: intensityTier as IntensityTier } : {}),\n },\n registrySource: 'bundled' as EffortRegistrySource,\n ...(trimmedBody ? { body: trimmedBody } : {}),\n ...(hints ? { hints } : {}),\n ...(derivation ? { derivation: derivation as IEffort['derivation'] } : {}),\n };\n}\n","/**\n * Git-derived versioning — the seed artifact's version IS this repo's git\n * history. Every merged MR advances `version` (commit count), and\n * `versionLabel`/`commit` make an artifact traceable to its exact source\n * tree, so the app (and humans diffing manifests) can answer \"what changed\n * and what needs syncing\" from the manifest alone.\n */\nimport { execSync } from 'node:child_process';\n\nexport interface GitVersion {\n /** Monotonic commit count — the import-order version stamped on the manifest. */\n version: number;\n /** `git describe --tags --long --always --dirty`, e.g. `v1.2.0-4-gdeadbee`. */\n versionLabel: string;\n /** Full HEAD sha. */\n commit: string;\n /** True when built with uncommitted working-tree changes. */\n dirty: boolean;\n}\n\n/** Unversioned fallback for source trees without git history (e.g. exported tarballs). */\nexport const UNKNOWN_GIT_VERSION: GitVersion = {\n version: 0,\n versionLabel: 'unknown',\n commit: '',\n dirty: false,\n};\n\nexport function resolveGitVersion(repoRoot: string): GitVersion {\n try {\n const run = (args: string): string =>\n execSync(`git ${args}`, { cwd: repoRoot, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();\n const count = Number(run('rev-list --count HEAD'));\n return {\n version: Number.isFinite(count) && count > 0 ? count : 0,\n versionLabel: run('describe --tags --long --always --dirty'),\n commit: run('rev-parse HEAD'),\n dirty: run('status --porcelain') !== '',\n };\n } catch {\n return UNKNOWN_GIT_VERSION;\n }\n}\n","/**\n * Build report — a static HTML benchmark page for each seed build\n * (`dist/report.html`). Per-chunk sizes, row counts, pass timings, and the\n * git version stamp, so CI and contributors see build health at a glance.\n * Deliberately dependency-free (one string template + a file write).\n */\nimport { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { SeedManifest } from './contract';\n\nexport interface BuildReportData {\n manifest: SeedManifest;\n /** Wall-clock ms for the full build. */\n totalMs: number;\n /** Per-pass timings (ms): corpus scan, block-index derivation, effort-row derivation, chunk writes. */\n passMs: { scan: number; blockIndex: number; blockEfforts: number; write: number };\n /** Number of corpus markdown files. */\n fileCount: number;\n outDir: string;\n}\n\nfunction escapeHtml(s: string): string {\n return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n}\n\nfunction rowHtml(c: SeedManifest['chunks'][number]): string {\n const kind = c.kind ?? 'notes';\n return `<tr><td>${escapeHtml(c.id)}</td><td>${kind}</td><td>${c.count}</td><td>${(c.bytes / 1024).toFixed(1)} KB</td><td><code>${c.sha256.slice(0, 8)}</code></td></tr>`;\n}\n\nexport function writeBuildReport(outDir: string, data: BuildReportData): string {\n const { manifest, totalMs, passMs, fileCount } = data;\n const totalBytes = manifest.chunks.reduce((s, c) => s + c.bytes, 0);\n const dirtyBadge = manifest.dirty\n ? ' <strong style=\"color:#b45309\">(dirty working tree — not reproducible from <code>' + escapeHtml(manifest.commit ?? '') + '</code>)</strong>'\n : '';\n const html = `<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n<title>Seed build report</title>\n<style>\n body { font-family: system-ui, sans-serif; max-width: 960px; margin: 2rem auto; padding: 0 1rem; color: #1f2937; }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.1rem; margin-top: 2rem; }\n table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }\n th, td { text-align: left; padding: 0.3rem 0.6rem; border-bottom: 1px solid #e5e7eb; }\n code { font-size: 0.85em; }\n dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; font-size: 0.95rem; }\n dt { font-weight: 600; }\n</style>\n</head>\n<body>\n<h1>Seed build report</h1>\n<h2>Version</h2>\n<dl>\n <dt>version</dt><dd>${manifest.version} <code>${escapeHtml(manifest.versionLabel ?? '')}</code>${dirtyBadge}</dd>\n <dt>commit</dt><dd><code>${escapeHtml(manifest.commit ?? 'unknown')}</code></dd>\n <dt>built at</dt><dd>${escapeHtml(manifest.builtAt)}</dd>\n <dt>schema</dt><dd>v${manifest.schema}</dd>\n</dl>\n<h2>Benchmarks</h2>\n<dl>\n <dt>total</dt><dd>${totalMs} ms</dd>\n <dt>corpus scan + partition</dt><dd>${passMs.scan} ms (${fileCount} files)</dd>\n <dt>block-index derivation</dt><dd>${passMs.blockIndex} ms</dd>\n <dt>block-efforts derivation</dt><dd>${passMs.blockEfforts} ms</dd>\n <dt>chunk writes</dt><dd>${passMs.write} ms</dd>\n</dl>\n<h2>Chunks (${manifest.chunks.length}, ${(totalBytes / 1024).toFixed(0)} KB total)</h2>\n<table>\n<thead><tr><th>id</th><th>kind</th><th>rows</th><th>size</th><th>sha256</th></tr></thead>\n<tbody>\n${manifest.chunks.map(rowHtml).join('\\n')}\n</tbody>\n</table>\n</body>\n</html>\n`;\n const file = join(outDir, 'report.html');\n writeFileSync(file, html, 'utf8');\n return file;\n}\n","/**\n * Seed compiler — compiles a `markdown/` corpus into versioned seed\n * artifacts (manifest.json + content-hashed chunks + report.html).\n *\n * Ported from the wod-wiki-community content repo (its src/compiler.ts);\n * that repo's CI now builds through this module via `wod build`, and the\n * wod-wiki host (scripts/sync-seed.ts) imports generateSeed from the\n * engine package instead of a sibling checkout.\n *\n * <root>/dist/ (or --out <dir>)\n * ├── manifest.json ← schema + git version + chunk index (small, no-cache)\n * ├── report.html ← build benchmarks (sizes, timings, version stamp)\n * ├── block-parent-map.json ← legacy static-parent → sourcePath map (API migration)\n * └── chunks/\n * └── <id>.<sha256-8>.json ← immutable, content-hashed row arrays\n *\n * Notes chunks are JSON arrays of `{ path, content }` rows; `path` is the\n * repo-relative POSIX path of the source markdown, `content` the raw file\n * text. Chunk granularity is one corpus part — `canvas`, `dashboards`,\n * `efforts`, `template`, one chunk per collection/feed slug — so a content\n * edit re-fetches only the chunk that changed.\n *\n * `block-index.<n>` chunks (kind `'block-index'`) carry precomputed\n * BlockIndexRow[] rows for the collections/feeds/guides (canvas) corpus, and\n * `block-efforts.<n>` chunks carry precomputed BlockEffort[] containment\n * rows, so the runtime importer can populate its stores directly.\n *\n * The PARITY GATE: every `.md` file under `markdown/` must land in exactly\n * one notes chunk, or the build fails. Unknown top-level corpora are a hard\n * error, so a new directory cannot silently bypass the seed pipeline. The\n * DASHBOARD GATE (#906): every `markdown/dashboards/*.md` must be a\n * well-formed dashboard note in the locked #899 format with parseable WQL\n * bodies, so invalid dashboard content fails the build before the app ever\n * sees it.\n *\n * Determinism: chunk bytes depend only on corpus content (block-index\n * created-at derives from the corpus repo's git history, so it shifts only\n * when history does); the manifest `version` (commit count) is what\n * advances. Re-import compares per-chunk hashes against the stored\n * checkpoint, so a bumped version with identical hashes is a no-op.\n *\n * Versioning: `manifest.version` is the corpus repo's commit count,\n * `versionLabel` is `git describe --long --always --dirty`, `commit` is the\n * HEAD sha — see git-version.ts. CI checkouts must fetch full history.\n */\nimport { parseScript } from '@bitcobblers/wod-wiki-lang';\nimport { parseDocumentSections, type SegmentDataType, type Section } from '@bitcobblers/wod-wiki-core';\nimport type { BlockEffort, BlockIndexRow } from '@bitcobblers/wod-wiki-storage';\nimport {\n buildDashboardDocument,\n isDashboardWidgetType,\n parseDashboardNote,\n parseQuery,\n resolveWidgetType,\n} from '@bitcobblers/wod-wiki-wql';\nimport {\n BLOCK_EFFORTS_CHUNK_PREFIX,\n BLOCK_INDEX_CHUNK_PREFIX,\n DASHBOARDS_CHUNK_ID,\n SEED_SCHEMA,\n TEMPLATE_CHUNK_ID,\n canvasRouteSlug,\n type ChunkKind,\n type ManifestChunk,\n type SeedManifest,\n type SeedRow,\n} from './contract';\nimport { extractEffortSlugs } from './effort-slugs';\nimport { fileToDisplayName } from './filename';\nimport { parseEffortFile } from './effort-file';\nimport { resolveGitVersion } from './git-version';\nimport { writeBuildReport } from './report';\nimport { parseFrontmatter } from './frontmatter';\nimport { createHash } from 'node:crypto';\nimport { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';\nimport { execSync } from 'node:child_process';\nimport { join, relative } from 'node:path';\n\n// BlockEffort/BlockIndexRow row types come from @bitcobblers/wod-wiki-storage\n// (type-only import — chunk rows are plain JSON applied structurally by the\n// app, mirroring cli/seed.ts).\n\n/** Scan `dir` recursively for `*.md` files; returns POSIX paths relative to `dir`, sorted. */\nfunction listMarkdownFiles(dir: string, prefix = ''): string[] {\n if (!existsSync(dir)) return [];\n const out: string[] = [];\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n const rel = prefix ? `${prefix}/${entry.name}` : entry.name;\n if (entry.isDirectory()) out.push(...listMarkdownFiles(join(dir, entry.name), rel));\n else if (entry.isFile() && entry.name.endsWith('.md')) out.push(rel);\n }\n return out.sort();\n}\n\n// ── Types ─────────────────────────────────────────────────────────────────\n\nexport interface ChunkGroup {\n id: string;\n files: string[];\n}\n\nexport interface GenerateSeedOptions {\n /** The corpus directory (`markdown/`). Defaults to `<corpusRoot>/markdown`. */\n markdownDir?: string;\n /** Optional playground template file — the host passes its own; standalone builds omit the `template` chunk. */\n templateFile?: string;\n /**\n * Row path recorded for the template chunk (the runtime derives the\n * template note's id from it, so it must stay stable across builds). The\n * host pins its historical in-repo path; defaults to the path relative to\n * `corpusRoot`.\n */\n templateRowPath?: string;\n /** Output directory. Defaults to `<corpusRoot>/dist`. */\n outDir?: string;\n /**\n * Explicit manifest version (tests). Defaults to the corpus repo's git\n * commit count — see git-version.ts.\n */\n version?: number;\n /** Repo root the corpus paths resolve against and versioning derives from. Defaults to cwd. */\n corpusRoot?: string;\n /** Automatically scaffold markdown files for newly discovered efforts. */\n scaffoldDiscoveredEfforts?: boolean;\n}\n\nexport interface GenerateSeedResult {\n manifest: SeedManifest;\n outDir: string;\n totalFiles: number;\n reportPath: string;\n /** ms timings per pass (mirrored into report.html). */\n passMs: { scan: number; blockIndex: number; blockEfforts: number; write: number };\n}\n\n// ── Corpus partition ──────────────────────────────────────────────────────\n\n/**\n * Map one `markdown/…` path to its chunk id. Returns null for files outside\n * the known corpora — callers MUST treat that as a parity failure so new\n * content directories cannot bypass the seed.\n */\nexport function chunkIdFor(relPath: string): string | null {\n const parts = relPath.split('/');\n if (parts[0] !== 'markdown' || parts.length < 2) return null;\n const corpus = parts[1];\n // markdown/<corpus>/<rest…>; a file directly under markdown/ has no corpus.\n if (parts.length === 2) return null;\n const slug = parts[2]?.replace(/\\.md$/, '');\n switch (corpus) {\n case 'canvas':\n case 'dashboards':\n case 'efforts':\n return corpus;\n case 'collections':\n return parts.length === 3 ? `collection._root` : `collection.${slug}`;\n case 'feeds':\n return parts.length === 3 ? `feed._root` : `feed.${slug}`;\n default:\n return null;\n }\n}\n\n/** Scan the markdown corpus; returns repo-relative POSIX paths of all .md files. */\nexport function collectCorpusMarkdown(markdownDir: string): string[] {\n return listMarkdownFiles(markdownDir).map((p) => `markdown/${p}`);\n}\n\n/** Group markdown corpus paths into chunk groups; throws on paths outside the known corpora. */\nexport function partitionIntoChunks(paths: string[]): ChunkGroup[] {\n const byId = new Map<string, string[]>();\n for (const p of paths) {\n const id = chunkIdFor(p);\n if (id === null) {\n throw new Error(\n `[generate-seed] Parity failure: '${p}' is not part of any known corpus ` +\n `(canvas | dashboards | efforts | collections | feeds). ` +\n `Extend chunkIdFor() if this is a new corpus.`,\n );\n }\n const list = byId.get(id);\n if (list) list.push(p);\n else byId.set(id, [p]);\n }\n return [...byId.entries()]\n .sort(([a], [b]) => (a < b ? -1 : 1))\n .map(([id, files]) => ({ id, files }));\n}\n\n// ── Dashboard gate (#906) ─────────────────────────────────────────────────\n\n/**\n * Validate one dashboard note in the locked #899 format: dashboard\n * frontmatter, a title, known widget types, WQL bodies that parse (and are\n * aggregate queries, not find queries), and every `$token` reference\n * declared. Returns the problems found (empty = valid).\n */\nexport function validateDashboardNote(raw: string): string[] {\n const problems: string[] = [];\n const { meta } = parseFrontmatter(raw);\n const { sections } = parseDashboardNote(raw);\n const doc = buildDashboardDocument(sections, meta);\n if (!doc.isDashboard) return ['file is not a dashboard note (missing dashboard frontmatter)'];\n if (doc.title === undefined) problems.push('dashboard has no title');\n if (doc.widgets.length < 3) problems.push(`dashboard has only ${doc.widgets.length} widgets (the locked format has ≥ 3)`);\n const declared = new Set(doc.tokens.map((t) => t.name));\n for (const widget of doc.widgets) {\n const where = `widget '${widget.title ?? widget.body.slice(0, 40)}'`;\n if (widget.title === undefined) problems.push(`${where}: missing title`);\n if (!isDashboardWidgetType(resolveWidgetType(widget.type))) {\n problems.push(`${where}: unknown widget type '${widget.type}'`);\n }\n const parsed = parseQuery(widget.body);\n if (parsed.error !== undefined) problems.push(`${where}: WQL parse error: ${parsed.error}`);\n for (const ref of [\n ...widget.body.matchAll(/\\$([A-Za-z][\\w-]*)/g),\n ...Object.values(widget.attributes).flatMap((v) => [...String(v).matchAll(/\\$([A-Za-z][\\w-]*)/g)]),\n ]) {\n if (!declared.has(ref[1])) problems.push(`${where}: undeclared token $${ref[1]}`);\n }\n }\n return problems;\n}\n\n/** Validate every dashboard file in a chunk group; throws on the first invalid file. */\nfunction gateDashboards(groups: ChunkGroup[], corpusRoot: string): void {\n for (const group of groups) {\n if (group.id !== DASHBOARDS_CHUNK_ID) continue;\n for (const p of group.files) {\n const problems = validateDashboardNote(readFileSync(join(corpusRoot, p), 'utf8'));\n if (problems.length > 0) {\n throw new Error(`[generate-seed] Dashboard validation failed for '${p}':\\n - ${problems.join('\\n - ')}`);\n }\n }\n }\n}\n\n// ── Block index derivation ────────────────────────────────────────────────\n\n/**\n * precompute the collections/feeds/guides (canvas) corpus into BlockIndexRow[]\n * at build time so the runtime importer can populate the `block_index` store\n * directly. Row identity (`static:<noteId>:<sectionId>:1`) matches what\n * analytics joins expect.\n */\nfunction toSegmentDataType(section: Pick<Section, 'type' | 'level'>): SegmentDataType {\n switch (section.type) {\n case 'time':\n case 'log':\n return 'wod';\n case 'title': {\n const l = section.level ?? 1;\n return `h${Math.min(Math.max(l, 1), 6)}` as SegmentDataType;\n }\n case 'frontmatter': return 'frontmatter';\n case 'markdown':\n case 'widget':\n case 'embed':\n case 'code':\n return 'markdown';\n default:\n return 'markdown';\n }\n}\n\n/** Created-at from the corpus repo's git history (collections/guides), 0 fallback when unknown. */\nfunction getFileCreatedAt(file: string, repoRoot: string): number {\n try {\n const out = execSync(`git log -1 --format=%ct -- '${file}'`, { cwd: repoRoot, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();\n const ts = Number(out) * 1000;\n return Number.isFinite(ts) && ts > 0 ? ts : 0;\n } catch {\n return 0;\n }\n}\n\n/** Created-at timestamp for a feed entry's date key (`yyyy-mm-dd` from the path). */\nexport function feedDateToCreatedAt(dateKey: string): number {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(dateKey)) return 0;\n const ts = Date.parse(`${dateKey}T00:00:00Z`);\n return Number.isNaN(ts) ? 0 : ts;\n}\n\n// canvasRouteSlug lives in contract.ts — one derivation shared by the\n// block plane (here) and the app's importer (note plane).\n\n/** Rows per block-index chunk (~4k rows keeps fetch + transaction sizes sane). */\nconst BLOCK_INDEX_ROWS_PER_CHUNK = 4000;\n\nexport function buildBlockIndexRows(markdownDir: string, corpusRoot: string): BlockIndexRow[] {\n const index: BlockIndexRow[] = [];\n\n // Collections: collections/{dir}/{file}.md (including collection READMEs as collection pages).\n for (const file of listMarkdownFiles(join(markdownDir, 'collections'))) {\n const rel = `markdown/collections/${file}`;\n const parts = rel.split('/');\n if (parts.length < 4) continue;\n const dirName = parts[parts.length - 2];\n const fileNameExt = parts[parts.length - 1];\n const isReadme = fileNameExt.toLowerCase() === 'readme.md';\n const fileName = fileNameExt.replace(/\\.md$/, '');\n const noteId = isReadme ? dirName : `${dirName}/${fileName}`;\n const content = readFileSync(join(corpusRoot, rel), 'utf8');\n const headingMatch = isReadme ? content.match(/^#\\s+(.+)$/m) : null;\n const noteTitle = headingMatch?.[1]?.trim() || fileToDisplayName(isReadme ? dirName : fileNameExt);\n const createdAt = getFileCreatedAt(rel, corpusRoot);\n\n const sections = parseDocumentSections(content);\n let position = 0;\n for (const section of sections) {\n const blockContentId = section.scriptBlock?.contentId ?? undefined;\n index.push({\n id: `static:${noteId}:${section.id}:1`,\n noteId,\n segmentId: section.id,\n segmentVersion: 1,\n position: position++,\n dataType: toSegmentDataType(section),\n blockContentId,\n rawContent: section.displayContent,\n noteTitle,\n createdAt,\n isStatic: true,\n sourceId: isReadme ? `collection:${dirName}` : `collection:${noteId}`,\n sourcePath: rel,\n });\n }\n }\n\n // Feeds: feeds/{dir}/{date}/{file}.md (READMEs excluded).\n for (const file of listMarkdownFiles(join(markdownDir, 'feeds'))) {\n const rel = `markdown/feeds/${file}`;\n const parts = rel.split('/');\n if (parts.length < 5) continue;\n const dirName = parts[parts.length - 3];\n const dateKey = parts[parts.length - 2];\n const fileNameExt = parts[parts.length - 1];\n if (fileNameExt.toLowerCase() === 'readme.md') continue;\n\n const fileName = fileNameExt.replace(/\\.md$/, '');\n const noteId = `feeds/${dirName}/${dateKey}/${fileName}`;\n const noteTitle = fileToDisplayName(fileNameExt);\n const content = readFileSync(join(corpusRoot, rel), 'utf8');\n\n const sections = parseDocumentSections(content);\n let position = 0;\n for (const section of sections) {\n const blockContentId = section.scriptBlock?.contentId ?? undefined;\n index.push({\n id: `static:${noteId}:${section.id}:1`,\n noteId,\n segmentId: section.id,\n segmentVersion: 1,\n position: position++,\n dataType: toSegmentDataType(section),\n blockContentId,\n rawContent: section.displayContent,\n noteTitle,\n createdAt: feedDateToCreatedAt(dateKey),\n isStatic: true,\n sourceId: `feed:${noteId}`,\n sourcePath: rel,\n });\n }\n }\n\n // Guides: canvas/{dir}/{file}.md — the syntax/guide corpus. Indexed pages\n // are exactly the routable ones (`template: canvas` + a non-degenerate\n // frontmatter `route:`); noteId is that route minus the leading slash, so a\n // Library row deep-links straight to the canvas page. READMEs and routeless\n // fragments fail the same test (home/README's route is '/', with no path\n // identity) — no special-casing needed.\n for (const file of listMarkdownFiles(join(markdownDir, 'canvas'))) {\n const rel = `markdown/canvas/${file}`;\n const content = readFileSync(join(corpusRoot, rel), 'utf8');\n const noteId = canvasRouteSlug(content);\n if (!noteId) continue;\n\n const fileNameExt = file.split('/').pop() ?? file;\n const noteTitle = fileToDisplayName(fileNameExt);\n const createdAt = getFileCreatedAt(rel, corpusRoot);\n const sections = parseDocumentSections(content);\n let position = 0;\n for (const section of sections) {\n const blockContentId = section.scriptBlock?.contentId ?? undefined;\n index.push({\n id: `static:${noteId}:${section.id}:1`,\n noteId,\n segmentId: section.id,\n segmentVersion: 1,\n position: position++,\n dataType: toSegmentDataType(section),\n blockContentId,\n rawContent: section.displayContent,\n noteTitle,\n createdAt,\n isStatic: true,\n sourceId: `guides:${noteId}`,\n sourcePath: rel,\n });\n }\n }\n\n return index;\n}\n\n/**\n * Uncataloged effort discovered during workout block analysis.\n */\nexport interface DiscoveredEffort {\n slug: string;\n label: string;\n rawLabels: string[];\n}\n\n/** Static lookup — syntax/structure keywords and known non-effort labels that must never scaffold. */\nconst NON_EFFORT_SLUGS: Record<string, true> = {\n 'amrap': true, 'emom': true, 'tabata': true, 'for-time': true, 'rounds': true, 'sets': true,\n 'repetitions': true, 'count-down': true, 'total-reps': true,\n 'warmup': true, 'cooldown': true, 'cool-down': true, 'transition': true, 'rest': true, 'break': true, 'work': true,\n 'i-suck-at-this': true, 'isuckatthis': true, 'movement': true, 'movement-you': true, 'selected-exercise': true,\n 'training-setup': true, 'grade-system': true, 'hangs': true, 'warm-light-wind': true, 'basin': true, 'rock-canyon': true,\n 'b-onsight': true, 'a-redpoint': true, 'd-redpoint': true, 'v0-flash': true, 'v2-flash': true, 'v7-redpoint': true,\n 'avgrpe-mean': true, 'calculate': true, 'totalload-sum': true, 'query': true, 'by': true,\n '': true, '-': true, '...': true, 'x': true, 's': true, 'bw': true,\n};\n\nfunction formatDiscoveredLabel(raw: string): string {\n const clean = raw.replace(/[-_]+/g, ' ').trim();\n return clean\n .split(/\\s+/)\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())\n .join(' ');\n}\n\nexport function loadExistingEffortMap(markdownDir: string): {\n slugs: Set<string>;\n aliasToCanonical: Map<string, string>;\n} {\n const slugs = new Set<string>();\n const aliasToCanonical = new Map<string, string>();\n const effortsDir = join(markdownDir, 'efforts');\n for (const file of listMarkdownFiles(effortsDir)) {\n const raw = readFileSync(join(effortsDir, file), 'utf8');\n const parsed = parseEffortFile(raw);\n if (!parsed) continue;\n\n slugs.add(parsed.slug);\n aliasToCanonical.set(parsed.slug, parsed.slug);\n aliasToCanonical.set(parsed.label.toLowerCase(), parsed.slug);\n aliasToCanonical.set(parsed.slug.replace(/-/g, ' '), parsed.slug);\n\n for (const alias of parsed.aliases) {\n aliasToCanonical.set(alias.toLowerCase(), parsed.slug);\n aliasToCanonical.set(alias.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, ''), parsed.slug);\n }\n }\n\n return { slugs, aliasToCanonical };\n}\n\nexport function discoverUncatalogedEfforts(markdownDir: string, corpusRoot: string): DiscoveredEffort[] {\n const { slugs, aliasToCanonical } = loadExistingEffortMap(markdownDir);\n const blocks = buildBlockIndexRows(markdownDir, corpusRoot);\n const discovered = new Map<string, { label: string; rawLabels: Set<string> }>();\n\n for (const block of blocks) {\n if (block.dataType !== 'wod' || !block.rawContent) continue;\n const script = parseScript(block.rawContent);\n for (const statement of script.statements) {\n const effortMetric = statement.metrics?.getMetric?.('effort');\n const effortLabel = (effortMetric && typeof effortMetric.value === 'string' ? effortMetric.value : undefined) ?? statement.exerciseId;\n if (!effortLabel) continue;\n\n const slugified = effortLabel.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');\n if (!slugified || NON_EFFORT_SLUGS[slugified]) continue;\n\n const canonical = aliasToCanonical.get(slugified) ?? aliasToCanonical.get(effortLabel.toLowerCase());\n if (canonical && slugs.has(canonical)) continue;\n\n const existing = discovered.get(slugified);\n if (existing) {\n existing.rawLabels.add(effortLabel);\n } else {\n discovered.set(slugified, {\n label: formatDiscoveredLabel(effortLabel),\n rawLabels: new Set([effortLabel]),\n });\n }\n }\n }\n\n return Array.from(discovered.entries()).map(([slug, data]) => ({\n slug,\n label: data.label,\n rawLabels: Array.from(data.rawLabels),\n }));\n}\n\nexport function scaffoldDiscoveredEfforts(\n discovered: DiscoveredEffort[],\n markdownDir: string,\n): string[] {\n const targetDir = join(markdownDir, 'efforts', 'discovered');\n if (!existsSync(targetDir)) {\n mkdirSync(targetDir, { recursive: true });\n }\n\n const createdPaths: string[] = [];\n for (const effort of discovered) {\n const filePath = join(targetDir, `${effort.slug}.md`);\n if (existsSync(filePath)) continue;\n\n const aliases = effort.rawLabels\n .filter((l) => l.toLowerCase() !== effort.label.toLowerCase())\n .map((l) => ` - \"${l.replace(/\"/g, '\\\\\"')}\"`);\n\n const content = [\n '---',\n `id: effort-bundled-${effort.slug}`,\n `slug: ${effort.slug}`,\n `label: \"${effort.label.replace(/\"/g, '\\\\\"')}\"`,\n aliases.length > 0 ? `aliases:\\n${aliases.join('\\n')}` : 'aliases: []',\n 'baseAttributes:',\n ' met: 5.0',\n ' discipline: general',\n ' intensityTier: moderate',\n 'registrySource: bundled',\n '---',\n '',\n ].join('\\n');\n\n writeFileSync(filePath, content, 'utf8');\n createdPaths.push(filePath);\n }\n\n return createdPaths;\n}\n\n/**\n * Derive BlockEffort[] containment rows from the block-index row set.\n * Requires a second pass over the source markdown to parse the script AST,\n * which is safe because the corpus is static and the pass is compile-time.\n */\nexport function buildBlockEffortRows(markdownDir: string, corpusRoot: string): BlockEffort[] {\n const efforts: BlockEffort[] = [];\n const { aliasToCanonical } = loadExistingEffortMap(markdownDir);\n const blocks = buildBlockIndexRows(markdownDir, corpusRoot);\n for (const block of blocks) {\n if (block.dataType !== 'wod' || !block.rawContent) continue;\n const script = parseScript(block.rawContent);\n const effortSlugs = extractEffortSlugs(script.statements);\n for (const rawSlug of effortSlugs) {\n const norm = rawSlug.toLowerCase().trim();\n const canonicalSlug =\n aliasToCanonical.get(norm) ??\n aliasToCanonical.get(norm.replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '')) ??\n norm.replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');\n if (!canonicalSlug || NON_EFFORT_SLUGS[canonicalSlug] || NON_EFFORT_SLUGS[norm]) {\n continue;\n }\n efforts.push({\n id: `${block.id}:${canonicalSlug}`,\n noteId: block.noteId,\n blockId: block.segmentId,\n blockContentId: block.blockContentId,\n effortSlug: canonicalSlug,\n isStatic: block.isStatic,\n sourcePath: block.sourcePath,\n createdAt: block.createdAt,\n });\n }\n }\n return efforts;\n}\n\n/**\n * legacy route parent id → canonical corpus source path. The API migration\n * (and the runtime importer's noteId mapping) reconcile legacy static block\n * rows — whose noteId is a path stem — onto imported notes through the full\n * sourcePath; ambiguity here is a generation bug and fails the build.\n */\nexport function buildStaticParentMap(blockRows: BlockIndexRow[]): Record<string, { sourcePath: string; sourceId?: string }> {\n const map: Record<string, { sourcePath: string; sourceId?: string }> = {};\n for (const row of blockRows) {\n if (!row.sourcePath) continue;\n const prev = map[row.noteId];\n if (prev && prev.sourcePath !== row.sourcePath) {\n throw new Error(\n `[generate-seed] ambiguous static parent '${row.noteId}' maps to both '${prev.sourcePath}' and '${row.sourcePath}'`,\n );\n }\n map[row.noteId] = { sourcePath: row.sourcePath, sourceId: row.sourceId };\n }\n return map;\n}\n\n// ── Generation ────────────────────────────────────────────────────────────\n\nfunction sha256Hex(data: string | Buffer): string {\n return createHash('sha256').update(data).digest('hex');\n}\n\nexport function generateSeed(options: GenerateSeedOptions = {}): GenerateSeedResult {\n const t0 = Date.now();\n const passMs = { scan: 0, blockIndex: 0, blockEfforts: 0, write: 0 };\n const corpusRoot = options.corpusRoot ?? process.cwd();\n const markdownDir = options.markdownDir ?? join(corpusRoot, 'markdown');\n const outDir = options.outDir ?? join(corpusRoot, 'dist');\n const gitVersion = options.version !== undefined\n ? { ...resolveGitVersion(corpusRoot), version: options.version }\n : resolveGitVersion(corpusRoot);\n if (options.scaffoldDiscoveredEfforts) {\n const discovered = discoverUncatalogedEfforts(markdownDir, corpusRoot);\n if (discovered.length > 0) {\n scaffoldDiscoveredEfforts(discovered, markdownDir);\n }\n }\n\n const tScan = Date.now();\n const paths = collectCorpusMarkdown(markdownDir);\n const groups = partitionIntoChunks(paths);\n gateDashboards(groups, corpusRoot);\n if (options.templateFile && existsSync(options.templateFile)) {\n const templateRowPath = options.templateRowPath\n ?? relative(corpusRoot, options.templateFile).split('\\\\').join('/');\n groups.push({ id: TEMPLATE_CHUNK_ID, files: [templateRowPath] });\n }\n passMs.scan = Date.now() - tScan;\n\n const chunksDir = join(outDir, 'chunks');\n rmSync(outDir, { recursive: true, force: true });\n mkdirSync(chunksDir, { recursive: true });\n\n const manifestChunks: ManifestChunk[] = [];\n let totalFiles = 0;\n\n const tWrite = Date.now();\n for (const { id, files } of groups) {\n // The template chunk's row path is the host-pinned historical identity,\n // not a path inside this repo — read it from the template file itself.\n const templateSource = id === TEMPLATE_CHUNK_ID ? options.templateFile : undefined;\n const rows: SeedRow[] = files.map((p) => ({\n path: p,\n content: readFileSync(templateSource ?? join(corpusRoot, p), 'utf8'),\n }));\n const bytes = Buffer.from(JSON.stringify(rows), 'utf8');\n const sha = sha256Hex(bytes);\n const file = `chunks/${id}.${sha.slice(0, 8)}.json`;\n writeFileSync(join(outDir, file), bytes);\n manifestChunks.push({ id, path: file, sha256: sha, bytes: bytes.length, count: rows.length });\n totalFiles += rows.length;\n }\n\n // ── Block-index chunks: precomputed corpus rows for the `block_index` store ──\n const tBlockIndex = Date.now();\n const blockRows = buildBlockIndexRows(markdownDir, corpusRoot);\n passMs.blockIndex = Date.now() - tBlockIndex;\n // Legacy parent → sourcePath canonical map, for API-side migration of real\n // snapshots whose static rows predate the sourcePath field.\n writeFileSync(\n join(outDir, 'block-parent-map.json'),\n JSON.stringify(buildStaticParentMap(blockRows), null, 2) + '\\n',\n );\n for (let i = 0; blockRows.length > 0 && i * BLOCK_INDEX_ROWS_PER_CHUNK < blockRows.length; i++) {\n const part = blockRows.slice(i * BLOCK_INDEX_ROWS_PER_CHUNK, (i + 1) * BLOCK_INDEX_ROWS_PER_CHUNK);\n if (part.length === 0) break;\n const id = `${BLOCK_INDEX_CHUNK_PREFIX}${i}`;\n const bytes = Buffer.from(JSON.stringify(part), 'utf8');\n const sha = sha256Hex(bytes);\n const file = `chunks/${id}.${sha.slice(0, 8)}.json`;\n writeFileSync(join(outDir, file), bytes);\n manifestChunks.push({ id, path: file, sha256: sha, bytes: bytes.length, count: part.length, kind: 'block-index' satisfies ChunkKind });\n }\n\n // ── Block-efforts chunks: precomputed exercise containment rows ──\n const tBlockEfforts = Date.now();\n const effortRows = buildBlockEffortRows(markdownDir, corpusRoot);\n passMs.blockEfforts = Date.now() - tBlockEfforts;\n for (let i = 0; effortRows.length > 0 && i * BLOCK_INDEX_ROWS_PER_CHUNK < effortRows.length; i++) {\n const part = effortRows.slice(i * BLOCK_INDEX_ROWS_PER_CHUNK, (i + 1) * BLOCK_INDEX_ROWS_PER_CHUNK);\n if (part.length === 0) break;\n const id = `${BLOCK_EFFORTS_CHUNK_PREFIX}${i}`;\n const bytes = Buffer.from(JSON.stringify(part), 'utf8');\n const sha = sha256Hex(bytes);\n const file = `chunks/${id}.${sha.slice(0, 8)}.json`;\n writeFileSync(join(outDir, file), bytes);\n manifestChunks.push({ id, path: file, sha256: sha, bytes: bytes.length, count: part.length, kind: 'block-efforts' satisfies ChunkKind });\n }\n passMs.write = Date.now() - tWrite;\n\n const manifest: SeedManifest = {\n schema: SEED_SCHEMA,\n version: gitVersion.version,\n versionLabel: gitVersion.versionLabel,\n commit: gitVersion.commit,\n dirty: gitVersion.dirty,\n builtAt: new Date().toISOString(),\n chunks: manifestChunks,\n };\n writeFileSync(join(outDir, 'manifest.json'), JSON.stringify(manifest, null, 2) + '\\n');\n\n const reportPath = writeBuildReport(outDir, {\n manifest,\n totalMs: Date.now() - t0,\n passMs,\n fileCount: paths.length,\n outDir,\n });\n\n return { manifest, outDir, totalFiles, reportPath, passMs };\n}\n"]}
|