@bitcobblers/wod-wiki-tools 0.36.2136 → 0.37.2139

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.
Files changed (60) hide show
  1. package/dist/bin/wod.cjs +522 -246
  2. package/dist/bin/wod.cjs.map +1 -1
  3. package/dist/bin/wod.mjs +4 -3
  4. package/dist/bin/wod.mjs.map +1 -1
  5. package/dist/{chunk-FZKXOYMJ.mjs → chunk-CVFMFD7D.mjs} +153 -188
  6. package/dist/chunk-CVFMFD7D.mjs.map +1 -0
  7. package/dist/{chunk-6QNX4FED.mjs → chunk-HRFOKCYI.mjs} +139 -47
  8. package/dist/chunk-HRFOKCYI.mjs.map +1 -0
  9. package/dist/{chunk-CYKNTEGY.mjs → chunk-IWT7U3WX.mjs} +8 -3
  10. package/dist/chunk-IWT7U3WX.mjs.map +1 -0
  11. package/dist/chunk-JUBKCRNV.mjs +12 -0
  12. package/dist/chunk-JUBKCRNV.mjs.map +1 -0
  13. package/dist/{chunk-MA6BBTWC.mjs → chunk-RWNL6APX.mjs} +3 -3
  14. package/dist/{chunk-MA6BBTWC.mjs.map → chunk-RWNL6APX.mjs.map} +1 -1
  15. package/dist/compiler-OXEXGIZG.mjs +9 -0
  16. package/dist/{compiler-CTPLIZJK.mjs.map → compiler-OXEXGIZG.mjs.map} +1 -1
  17. package/dist/index.cjs +522 -246
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.mjs +5 -4
  22. package/dist/scaffoldCatalog-OIU4FEKJ.mjs +205 -0
  23. package/dist/scaffoldCatalog-OIU4FEKJ.mjs.map +1 -0
  24. package/dist/{server-JXECWS4A.mjs → server-2DVBA35J.mjs} +4 -4
  25. package/dist/{server-JXECWS4A.mjs.map → server-2DVBA35J.mjs.map} +1 -1
  26. package/dist/web/playground/assets/main-2qCz3_0z.js +194 -0
  27. package/dist/web/playground/assets/main-BUcjhK2w.css +2 -0
  28. package/dist/web/playground/assets/{statementBuilderFlow-ugwi0fu0.js → statementBuilderFlow-DKhL-YLz.js} +2 -2
  29. package/dist/web/playground/assets/{vendor-g-NJOjvC.js → vendor-DaJxNU_W.js} +3 -3
  30. package/dist/web/playground/assets/{vendor-codemirror-C41SFn-r.js → vendor-codemirror-BtDM22HA.js} +2 -2
  31. package/dist/web/playground/index.html +4 -4
  32. package/dist/web/playground/seed/core/chunks/canvas.a45c409e.json +1 -0
  33. package/dist/web/playground/seed/core/chunks/efforts.e68f2093.json +1 -0
  34. package/dist/web/playground/seed/core/chunks/equipment.c4fb1d64.json +1 -0
  35. package/dist/web/playground/seed/core/chunks/{template.e5e0e82d.json → template.0120276c.json} +1 -1
  36. package/dist/web/playground/seed/core/manifest.json +27 -10
  37. package/dist/web/playground/seed/core/report.html +15 -13
  38. package/dist/web/server/assets/main-BUcjhK2w.css +2 -0
  39. package/dist/web/server/assets/main-DxsZ-yOz.js +193 -0
  40. package/dist/web/server/assets/{statementBuilderFlow-40WaYjdq.js → statementBuilderFlow-CI5vrd60.js} +2 -2
  41. package/dist/web/server/assets/{vendor-g-NJOjvC.js → vendor-DaJxNU_W.js} +3 -3
  42. package/dist/web/server/assets/{vendor-codemirror-C41SFn-r.js → vendor-codemirror-BtDM22HA.js} +2 -2
  43. package/dist/web/server/index.html +4 -4
  44. package/dist/web/server/seed/core/chunks/canvas.a45c409e.json +1 -0
  45. package/dist/web/server/seed/core/chunks/efforts.e68f2093.json +1 -0
  46. package/dist/web/server/seed/core/chunks/equipment.c4fb1d64.json +1 -0
  47. package/dist/web/server/seed/core/chunks/{template.e5e0e82d.json → template.0120276c.json} +1 -1
  48. package/dist/web/server/seed/core/manifest.json +27 -10
  49. package/dist/web/server/seed/core/report.html +15 -13
  50. package/package.json +6 -6
  51. package/dist/chunk-6QNX4FED.mjs.map +0 -1
  52. package/dist/chunk-CYKNTEGY.mjs.map +0 -1
  53. package/dist/chunk-FZKXOYMJ.mjs.map +0 -1
  54. package/dist/compiler-CTPLIZJK.mjs +0 -9
  55. package/dist/web/playground/assets/main-B-bffxwE.css +0 -2
  56. package/dist/web/playground/assets/main-iLSeEl2E.js +0 -188
  57. package/dist/web/playground/seed/core/chunks/canvas.20048125.json +0 -1
  58. package/dist/web/server/assets/main-B-bffxwE.css +0 -2
  59. package/dist/web/server/assets/main-CRyLxlPN.js +0 -187
  60. package/dist/web/server/seed/core/chunks/canvas.20048125.json +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/seedbuild/contract.ts","../src/seedbuild/filename.ts","../src/seedbuild/git-version.ts","../src/seedbuild/report.ts","../src/seedbuild/frontmatter.ts","../src/seedbuild/validation.ts","../src/seedbuild/compiler.ts"],"names":["join","execSync","parseDocumentSections","section","blockContentId","writeFileSync"],"mappings":";;;;;;;;;;;;AAGO,IAAM,WAAA,GAAc;AACpB,IAAM,uBAAA,GAA0B,qBAAA;AA2ChC,IAAM,gBAAA,GAAmB,SAAA;AACzB,IAAM,kBAAA,GAAqB,WAAA;AAC3B,IAAM,eAAA,GAAkB,QAAA;AACxB,IAAM,mBAAA,GAAsB,YAAA;AAC5B,IAAM,iBAAA,GAAoB,UAAA;AAK1B,SAAS,kBAAkB,OAAA,EAAqC;AACrE,EAAA,MAAM,KAAA,GAAQ,6BAAA,CAA8B,IAAA,CAAK,OAAO,IAAI,CAAC,CAAA;AAC7D,EAAA,OAAO,KAAA,IAAS,KAAA,KAAU,OAAA,GAAU,KAAA,GAAQ,MAAA;AAC9C;AACO,SAAS,gBAAgB,OAAA,EAAgC;AAC9D,EAAA,MAAM,EAAA,GAAK,6BAAA,CAA8B,IAAA,CAAK,OAAO,CAAA;AACrD,EAAA,IAAI,EAAA,GAAK,CAAC,CAAA,IAAK,CAAC,0BAAA,CAA2B,KAAK,EAAA,CAAG,CAAC,CAAC,CAAA,EAAG,OAAO,IAAA;AAC/D,EAAA,OAAO,EAAA,GAAK,CAAC,CAAA,EAAG,KAAA,CAAM,sBAAsB,CA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A,EAAY,YAAY,MAAA,EAAO;AAC5D","file":"chunk-CVFMFD7D.mjs","sourcesContent":["import type { BlockEffort, BlockEquipment, BlockIndexRow, NoteBlock } from '@bitcobblers/wod-wiki-core';\nimport { KNOWN_SECTION_WIDGETS } from '@bitcobblers/wod-wiki-core';\n\nexport const SEED_SCHEMA = 9;\nexport const SEED_REGISTERED_WIDGETS = KNOWN_SECTION_WIDGETS;\n\n/** Source and all current derived rows commit as one chunk. */\nexport interface SeedRow {\n path: string;\n content: string;\n blocks: Record<string, NoteBlock>;\n blockIndex: BlockIndexRow[];\n blockEfforts: BlockEffort[];\n blockEquipment: BlockEquipment[];\n}\n\nexport type ChunkKind = 'notes';\nexport interface ManifestChunk {\n id: string;\n path: string;\n sha256: string;\n bytes: number;\n count: number;\n kind?: ChunkKind;\n}\nexport interface SeedManifest {\n name?: string;\n description?: string;\n repositoryUrl?: string;\n schema: number;\n version: number;\n versionLabel?: string;\n commit?: string;\n dirty?: boolean;\n builtAt: string;\n chunks: ManifestChunk[];\n}\nexport interface SeedMetaRecord {\n key: string;\n schema: number;\n seedVersion: number;\n builtAt: string;\n importedAt: number;\n chunks: Record<string, { sha256: string; noteIds?: string[] }>;\n claim?: { owner: string; at: number } | null;\n}\nexport const SEED_BROADCAST_CHANNEL = 'wodwiki.seed';\nexport const EFFORTS_CHUNK_ID = 'efforts';\nexport const EQUIPMENT_CHUNK_ID = 'equipment';\nexport const CANVAS_CHUNK_ID = 'canvas';\nexport const DASHBOARDS_CHUNK_ID = 'dashboards';\nexport const TEMPLATE_CHUNK_ID = 'template';\nexport function seedMetaKey(sourceId: string): string { return `seed:${sourceId}`; }\nexport function emptySeedMeta(key: string): SeedMetaRecord {\n return { key, schema: SEED_SCHEMA, seedVersion: 0, builtAt: '', importedAt: 0, chunks: {}, claim: null };\n}\nexport function catalogForChunkId(chunkId: string): string | undefined {\n const value = /^(?:collection|feed)\\.(.+)$/.exec(chunkId)?.[1];\n return value && value !== '_root' ? value : undefined;\n}\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 return fm?.[1]?.match(/^route:\\s*(\\S+)\\s*$/m)?.[1]?.replace(/^\\//, '') || null;\n}\nexport function seedNoteSourceId(path: string, content: string, chunkId: string): string | undefined {\n const parts = path.split('/');\n const stem = (parts.at(-1) ?? '').replace(/\\.md$/i, '');\n const under = parts.slice(2).map((p) => p.replace(/\\.md$/i, '')).join('/');\n if (chunkId === CANVAS_CHUNK_ID) return `guides:${canvasRouteSlug(content) ?? under}`;\n if (chunkId === DASHBOARDS_CHUNK_ID) return 'dashboards';\n if (chunkId === EFFORTS_CHUNK_ID) return 'efforts';\n if (chunkId === EQUIPMENT_CHUNK_ID) return 'equipment';\n if (chunkId === TEMPLATE_CHUNK_ID) return 'playground';\n if (chunkId.startsWith('collection.')) {\n const catalog = catalogForChunkId(chunkId);\n return !catalog ? 'collection:_root' : stem.toLowerCase() === 'readme' ? `collection:${catalog}` : `collection:${catalog}/${stem}`;\n }\n if (chunkId.startsWith('feed.')) return `feed:feeds/${under}`;\n return undefined;\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 * 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; parseGate: 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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\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 syntax gate</dt><dd>${passMs.parseGate} 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 * 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","import { blockContentId, parseDocumentSections, validateNoteBlocks } from '@bitcobblers/wod-wiki-core';\nimport { SEED_REGISTERED_WIDGETS, SEED_SCHEMA, type SeedManifest, type SeedRow } from './contract';\n\nfunction object(value: unknown): value is Record<string, unknown> { return typeof value === 'object' && value !== null && !Array.isArray(value); }\nfunction positive(value: unknown): value is number { return typeof value === 'number' && Number.isSafeInteger(value) && value > 0; }\nfunction nonnegative(value: unknown): value is number { return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0; }\nexport function assertSeedManifest(value: unknown): SeedManifest {\n if (!object(value) || value.schema !== SEED_SCHEMA) throw new Error('Incompatible seed schema; rebuild seed artifacts');\n if (!nonnegative(value.version) || typeof value.builtAt !== 'string' || !Number.isFinite(Date.parse(value.builtAt)) || !Array.isArray(value.chunks)) throw new Error('seed manifest failed shape validation');\n for (const key of ['versionLabel', 'commit', 'name', 'description']) if (value[key] !== undefined && typeof value[key] !== 'string') throw new Error('invalid seed manifest metadata');\n if (value.repositoryUrl !== undefined && (typeof value.repositoryUrl !== 'string' || !/^https:\\/\\//.test(value.repositoryUrl) || new URL(value.repositoryUrl).username || new URL(value.repositoryUrl).password)) throw new Error('invalid seed repository URL');\n if (value.dirty !== undefined && typeof value.dirty !== 'boolean') throw new Error('invalid seed manifest metadata');\n const ids = new Set<string>(), paths = new Set<string>();\n for (const chunk of value.chunks) {\n if (!object(chunk) || typeof chunk.id !== 'string' || !chunk.id || typeof chunk.path !== 'string' || !/^chunks\\/[a-zA-Z0-9._-]+\\.json$/.test(chunk.path) || typeof chunk.sha256 !== 'string' || !/^[0-9a-f]{64}$/.test(chunk.sha256) || !nonnegative(chunk.bytes) || !nonnegative(chunk.count) || (chunk.kind !== undefined && chunk.kind !== 'notes') || ids.has(chunk.id) || paths.has(chunk.path)) throw new Error('seed manifest failed shape validation');\n ids.add(chunk.id); paths.add(chunk.path);\n }\n return value as unknown as SeedManifest;\n}\nexport function assertSeedRows(value: unknown): SeedRow[] {\n if (!Array.isArray(value)) throw new Error('seed chunk is not an array');\n const paths = new Set<string>();\n for (const row of value) {\n if (!object(row) || typeof row.path !== 'string' || !row.path || row.path.startsWith('/') || row.path.split('/').includes('..') || paths.has(row.path) || typeof row.content !== 'string' || !object(row.blocks) || !Array.isArray(row.blockIndex) || !Array.isArray(row.blockEfforts)) throw new Error('seed chunk row failed shape validation');\n paths.add(row.path);\n for (const [id, block] of Object.entries(row.blocks)) {\n if (!object(block) || block.id !== id || !id || block.version !== 1 || block.sourceRevision !== 1 || !nonnegative(block.from) || !positive(block.to) || block.from >= block.to || block.to > row.content.length || !['wod', 'query', 'widget', 'embed'].includes(String(block.kind)) || (block.kind === 'wod' ? !['time', 'log'].includes(String(block.dialect)) : block.dialect !== undefined) || (block.sport !== undefined && typeof block.sport !== 'string')) throw new Error('invalid seed block range or revision');\n }\n validateNoteBlocks(row.content, row.blocks as SeedRow['blocks'], 1, { registeredWidgets: SEED_REGISTERED_WIDGETS });\n const indexed = new Set<string>();\n const sections = parseDocumentSections(row.content, { registeredWidgets: SEED_REGISTERED_WIDGETS });\n for (const projection of row.blockIndex) {\n if (!object(projection) || typeof projection.blockId !== 'string') throw new Error('invalid seed projection');\n const block = row.blocks[projection.blockId];\n if (!object(block) || indexed.has(projection.blockId) || typeof projection.id !== 'string' || typeof projection.noteId !== 'string' || projection.id !== `${projection.noteId}:${projection.blockId}` || projection.blockVersion !== 1 || projection.sourceRevision !== 1 || projection.from !== block.from || projection.to !== block.to || projection.dataType !== block.kind || projection.rawContent !== row.content.slice(Number(block.from), Number(block.to)) || typeof projection.noteTitle !== 'string' || typeof projection.createdAt !== 'number' || !Number.isFinite(projection.createdAt) || projection.sourcePath !== row.path || projection.isStatic !== true) throw new Error('orphan or incompatible seed projection');\n if ('segmentId' in projection || 'segmentVersion' in projection) throw new Error('incompatible seed projection');\n for (const key of ['sourceId', 'routeId', 'blockContentId']) if (projection[key] !== undefined && typeof projection[key] !== 'string') throw new Error('invalid seed projection metadata');\n if (projection.position !== undefined && !nonnegative(projection.position)) throw new Error('invalid seed projection position');\n if (block.kind === 'wod') {\n const section = sections.find((s) => s.from === block.from && s.to === block.to);\n if (projection.blockContentId !== blockContentId(section?.scriptBlock?.content ?? row.content.slice(Number(block.from), Number(block.to)))) throw new Error('invalid seed workout fingerprint');\n } else if (projection.blockContentId !== undefined) throw new Error('non-workout seed fingerprint');\n indexed.add(projection.blockId);\n }\n if (indexed.size !== Object.keys(row.blocks).length) throw new Error('missing actionable seed projection');\n const links = new Set<string>();\n for (const link of row.blockEfforts) {\n if (!object(link) || typeof link.blockId !== 'string' || typeof link.noteId !== 'string' || typeof link.effortSlug !== 'string' || !link.effortSlug) throw new Error('invalid seed effort identity');\n const block = row.blocks[link.blockId];\n if (link.id !== `${link.noteId}:${link.blockId}:${link.effortSlug}` || links.has(String(link.id)) || !object(block) || block.kind !== 'wod' || !indexed.has(link.blockId) || link.sourcePath !== row.path || link.isStatic !== true || typeof link.createdAt !== 'number') throw new Error('orphan or incompatible seed effort link');\n const projection = row.blockIndex.find((p: unknown) => object(p) && p.blockId === link.blockId);\n if (!object(projection) || link.noteId !== projection.noteId || link.blockContentId !== projection.blockContentId || !Number.isFinite(link.createdAt)) throw new Error('invalid seed effort metadata');\n links.add(String(link.id));\n }\n }\n return value as SeedRow[];\n}","/** Compiles exact source, occurrence maps and sparse projections into atomic notes chunks. */\nimport { parseScript, whiteboardParser } from '@bitcobblers/wod-wiki-lang';\nimport { blockContentId, parseDocumentSections, reconcileNoteBlocks } from '@bitcobblers/wod-wiki-core';\nimport type { BlockEffort, BlockEquipment, 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 DASHBOARDS_CHUNK_ID,\n SEED_SCHEMA,\n SEED_REGISTERED_WIDGETS,\n TEMPLATE_CHUNK_ID,\n canvasRouteSlug,\n seedNoteSourceId,\n type ManifestChunk,\n type SeedManifest,\n type SeedRow,\n} from './contract';\nimport { fileToDisplayName } from './filename';\nimport { createReferenceIndex, extractStatementRefs, parseEffortFile, parseEquipmentFile, slugifyRefLabel, type IEffort, type IEquipment } from '@bitcobblers/wod-wiki-lang';\nimport { resolveGitVersion } from './git-version';\nimport { writeBuildReport } from './report';\nimport { getScalar, parseFrontmatter } from './frontmatter';\nimport { assertSeedManifest } from './validation';\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; parseGate: 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 case 'equipment':\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 | equipment | 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/** 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/**\n * Frontmatter `date: YYYY-MM-DD` → epoch ms at noon UTC (mirrors the seed\n * importer's Note.date, so the block and note planes place a post on the\n * same civil day). Absent/empty → undefined; anything else that is not a\n * real calendar day throws — the build fails loudly instead of silently\n * misdating or rolling the post to another day.\n */\nexport function frontmatterDateToCreatedAt(raw: string, path: string): number | undefined {\n const value = getScalar(parseFrontmatter(raw).meta, 'date');\n if (value === undefined || value === '') return undefined;\n const text = String(value);\n const parts = text.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/);\n const ts = parts ? Date.parse(`${text}T12:00:00Z`) : NaN;\n // Some engines roll impossible days (2026-02-30 → March 2) instead of\n // failing — round-trip the UTC components so the post can never silently\n // move to another day.\n const valid = !!parts && Number.isFinite(ts)\n && new Date(ts).getUTCMonth() === Number(parts[2]) - 1\n && new Date(ts).getUTCDate() === Number(parts[3]);\n if (!valid) {\n throw new Error(`[wod build] invalid frontmatter date '${text}' in '${path}' — expected a real calendar day (YYYY-MM-DD)`);\n }\n return ts;\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\nexport function compileSeedRow(path: string, content: string, metadata: { routeId?: string; noteTitle?: string; sourceId?: string; createdAt?: number } = {}): SeedRow {\n let ordinal = 0;\n const blocks = reconcileNoteBlocks(content, { sourceRevision: 1, registeredWidgets: SEED_REGISTERED_WIDGETS, createId: () => `seed:${path}:${ordinal++}` });\n const noteId = metadata.routeId ?? path;\n const sections = parseDocumentSections(content);\n const blockIndex: BlockIndexRow[] = Object.values(blocks).map((block, position) => {\n const section = sections.find((section) => section.from === block.from && section.to === block.to);\n return { id: `${noteId}:${block.id}`, noteId, blockId: block.id, blockVersion: 1, sourceRevision: 1, from: block.from, to: block.to, position, dataType: block.kind, ...(block.kind === 'wod' ? { blockContentId: blockContentId(section?.scriptBlock?.content ?? content.slice(block.from, block.to)) } : {}), rawContent: content.slice(block.from, block.to), noteTitle: metadata.noteTitle ?? fileToDisplayName(path.split('/').at(-1) ?? path), createdAt: metadata.createdAt ?? 0, isStatic: true, sourceId: metadata.sourceId, sourcePath: path, routeId: metadata.routeId };\n });\n return { path, content, blocks, blockIndex, blockEfforts: [], blockEquipment: [] };\n}\n\nexport function buildBlockIndexRows(markdownDir: string, corpusRoot: string): BlockIndexRow[] {\n const rows: BlockIndexRow[] = [];\n for (const path of collectCorpusMarkdown(markdownDir)) {\n const chunkId = chunkIdFor(path);\n if (!chunkId) continue;\n const content = readFileSync(join(corpusRoot, path), 'utf8');\n const parts = path.split('/');\n const stem = (parts.at(-1) ?? '').replace(/\\.md$/, '');\n const catalog = parts[2];\n const routeId = chunkId === 'canvas' ? canvasRouteSlug(content) ?? undefined : chunkId.startsWith('collection.') ? (stem.toLowerCase() === 'readme' ? catalog : `${catalog}/${stem}`) : chunkId.startsWith('feed.') ? parts.slice(1).join('/').replace(/\\.md$/, '') : undefined;\n const sourceId = seedNoteSourceId(path, content, chunkId);\n // Authored frontmatter date wins regardless of filename/directory; undated\n // feeds keep their historical path-date placement, everything else falls\n // back to the corpus repo's git history.\n const createdAt = frontmatterDateToCreatedAt(content, path)\n ?? (chunkId.startsWith('feed.') ? feedDateToCreatedAt(parts.at(-2) ?? '') : getFileCreatedAt(path, corpusRoot));\n rows.push(...compileSeedRow(path, content, { routeId, sourceId, createdAt }).blockIndex);\n }\n return rows;\n}\n\n/**\n * Syntax gate — every `wod` block's script must parse cleanly.\n *\n * Plain fences get a strict scan of the Lezer tree for error nodes\n * (`WhiteboardScript.errors` only carries mapper exceptions; the parser\n * recovers silently, so the tree is scanned directly) with `path:line`\n * diagnostics. Dialect-fenced blocks (`log:climbing`, …) are owned by the\n * dialect stack — their `key: value` lines are recovered by dialect\n * handlers, not the base grammar — so those gate on the exception channel\n * of a dialect-aware parse instead, matching how the app consumes them.\n */\nexport function validateWodBlockSyntax(blocks: BlockIndexRow[]): string[] {\n const problems: string[] = [];\n for (const block of blocks) {\n if (block.dataType !== 'wod' || !block.rawContent?.trim()) continue;\n const section = parseDocumentSections(block.rawContent, { registeredWidgets: SEED_REGISTERED_WIDGETS })\n .find((s) => s.scriptBlock);\n const source = section?.scriptBlock?.content ?? block.rawContent;\n if (!source.trim()) continue;\n\n const where = block.sourcePath ?? block.noteId;\n if (section?.sport) {\n const parsed = parseScript(source, { sport: section.sport });\n for (const error of parsed.errors ?? []) {\n problems.push(`${where}: ${error.message}`);\n }\n continue;\n }\n\n const doc = source.endsWith('\\n') ? source : source + '\\n';\n const tree = whiteboardParser.parse(doc);\n tree.iterate({\n enter: (node) => {\n if (!node.type.isError) return;\n const line = doc.slice(0, node.from).split('\\n').length;\n const snippet = source.slice(node.from, Math.min(node.to, node.from + 60)).split('\\n')[0];\n problems.push(`${where}:${line} \\`${snippet}\\``);\n },\n });\n }\n return problems;\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\n/**\n * ONE corpus reference catalog — both definition families parsed once into\n * real arrays, the direct feed for lang's `createReferenceIndex`. Effort and\n * equipment containment rows, discovery and the runtime all resolve through\n * that single index, so the static plane and runtime agree on canonical\n * slugs with no per-family copies.\n */\nexport function loadCorpusReferenceCatalog(markdownDir: string): { efforts: IEffort[]; equipment: IEquipment[] } {\n const efforts: IEffort[] = [];\n const equipment: IEquipment[] = [];\n const effortsDir = join(markdownDir, 'efforts');\n for (const file of listMarkdownFiles(effortsDir)) {\n const parsed = parseEffortFile(readFileSync(join(effortsDir, file), 'utf8'));\n if (parsed) efforts.push(parsed);\n }\n const equipmentDir = join(markdownDir, 'equipment');\n for (const file of listMarkdownFiles(equipmentDir)) {\n const parsed = parseEquipmentFile(readFileSync(join(equipmentDir, file), 'utf8'));\n if (parsed) equipment.push(parsed);\n }\n return { efforts, equipment };\n}\n\nexport function discoverUncatalogedEfforts(markdownDir: string, corpusRoot: string): DiscoveredEffort[] {\n const catalog = loadCorpusReferenceCatalog(markdownDir);\n const index = createReferenceIndex(catalog);\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 section = parseDocumentSections(block.rawContent, { registeredWidgets: SEED_REGISTERED_WIDGETS }).find((section) => section.scriptBlock);\n const script = parseScript(section?.scriptBlock?.content ?? block.rawContent, { references: index });\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 = slugifyRefLabel(effortLabel);\n if (!slugified || NON_EFFORT_SLUGS[slugified]) continue;\n\n // Known efforts are exactly the catalog's canonical slugs — discovery\n // only reports labels the shared index cannot resolve.\n if (index.resolveEffort(slugified) || index.resolveEffort(effortLabel)) 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 * (with the corpus reference index configured, so statements carry canonical\n * refs), which is safe because the corpus is static and compile-time.\n *\n * Only VALIDATED refs enter the durable index: a slug that survives is\n * confirmed by the shared index (`resolveEffort`); uncataloged movements\n * produce no durable link — that is discovery's reporting job.\n */\nexport function buildBlockEffortRows(markdownDir: string, corpusRoot: string, blocks: BlockIndexRow[] = buildBlockIndexRows(markdownDir, corpusRoot)): BlockEffort[] {\n const efforts: BlockEffort[] = [];\n const index = createReferenceIndex(loadCorpusReferenceCatalog(markdownDir));\n for (const block of blocks) {\n if (block.dataType !== 'wod' || !block.rawContent) continue;\n const section = parseDocumentSections(block.rawContent, { registeredWidgets: SEED_REGISTERED_WIDGETS }).find((section) => section.scriptBlock);\n const script = parseScript(section?.scriptBlock?.content ?? block.rawContent, { references: index });\n const linked = new Set<string>();\n for (const rawSlug of extractStatementRefs(script.statements).efforts) {\n const canonical = index.resolveEffort(rawSlug);\n const canonicalSlug = canonical?.slug;\n if (!canonicalSlug || NON_EFFORT_SLUGS[canonicalSlug] || NON_EFFORT_SLUGS[rawSlug]) {\n continue;\n }\n if (linked.has(canonicalSlug)) continue;\n linked.add(canonicalSlug);\n efforts.push({\n id: `${block.id}:${canonicalSlug}`,\n noteId: block.noteId,\n blockId: block.blockId,\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 * Derive BlockEquipment[] containment rows — the equipment twin of\n * {@link buildBlockEffortRows}. Parsed with the corpus reference index so\n * statements carry canonical equipment refs; only slugs the shared index\n * confirms (`resolveEquipment`) produce a durable link. Unknown equipment\n * stays visible as authored source + parser diagnostics.\n */\nexport function buildBlockEquipmentRows(markdownDir: string, corpusRoot: string, blocks: BlockIndexRow[] = buildBlockIndexRows(markdownDir, corpusRoot)): BlockEquipment[] {\n const links: BlockEquipment[] = [];\n const index = createReferenceIndex(loadCorpusReferenceCatalog(markdownDir));\n for (const block of blocks) {\n if (block.dataType !== 'wod' || !block.rawContent) continue;\n const section = parseDocumentSections(block.rawContent, { registeredWidgets: SEED_REGISTERED_WIDGETS }).find((s) => s.scriptBlock);\n const script = parseScript(section?.scriptBlock?.content ?? block.rawContent, { references: index });\n const linked = new Set<string>();\n for (const rawSlug of extractStatementRefs(script.statements).equipment) {\n const canonicalSlug = index.resolveEquipment(rawSlug)?.slug;\n if (!canonicalSlug || linked.has(canonicalSlug)) continue;\n linked.add(canonicalSlug);\n links.push({\n id: `${block.id}:${canonicalSlug}`,\n noteId: block.noteId,\n blockId: block.blockId,\n blockContentId: block.blockContentId,\n equipmentSlug: canonicalSlug,\n isStatic: block.isStatic,\n sourcePath: block.sourcePath,\n createdAt: block.createdAt,\n });\n }\n }\n return links;\n}\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, parseGate: 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 const packageFile = join(corpusRoot, 'package.json');\n const packageMetadata: unknown = existsSync(packageFile) ? JSON.parse(readFileSync(packageFile, 'utf8')) : {};\n const metadata = packageMetadata && typeof packageMetadata === 'object' ? packageMetadata : {};\n const repository = 'repository' in metadata ? metadata.repository : undefined;\n const repositoryUrl = typeof repository === 'string' ? repository : repository && typeof repository === 'object' && 'url' in repository && typeof repository.url === 'string' ? repository.url : undefined;\n const webRepositoryUrl = repositoryUrl?.replace(/^git\\+/, '').replace(/\\.git$/, '');\n const repositoryLink = webRepositoryUrl && URL.canParse(webRepositoryUrl) ? new URL(webRepositoryUrl) : undefined;\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 tBlockIndex = Date.now();\n const blockRows = buildBlockIndexRows(markdownDir, corpusRoot);\n passMs.blockIndex = Date.now() - tBlockIndex;\n const tParseGate = Date.now();\n const syntaxProblems = validateWodBlockSyntax(blockRows);\n passMs.parseGate = Date.now() - tParseGate;\n if (syntaxProblems.length > 0) {\n const shown = syntaxProblems.slice(0, 20).map((p) => ` ${p}`).join('\\n');\n const more = syntaxProblems.length > 20 ? `\\n … and ${syntaxProblems.length - 20} more` : '';\n throw new Error(`[wod build] block syntax gate failed — ${syntaxProblems.length} block(s) do not parse:\\n${shown}${more}`);\n }\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 const tBlockEfforts = Date.now();\n const effortRows = buildBlockEffortRows(markdownDir, corpusRoot, blockRows);\n const equipmentRows = buildBlockEquipmentRows(markdownDir, corpusRoot, blockRows);\n passMs.blockEfforts = Date.now() - tBlockEfforts;\n const blocksByPath = new Map<string, BlockIndexRow[]>();\n const effortsByPath = new Map<string, BlockEffort[]>();\n const equipmentByPath = new Map<string, BlockEquipment[]>();\n for (const row of blockRows) {\n const rows = blocksByPath.get(row.sourcePath!) ?? [];\n rows.push(row); blocksByPath.set(row.sourcePath!, rows);\n }\n for (const row of effortRows) {\n const rows = effortsByPath.get(row.sourcePath!) ?? [];\n rows.push(row); effortsByPath.set(row.sourcePath!, rows);\n }\n for (const row of equipmentRows) {\n const rows = equipmentByPath.get(row.sourcePath!) ?? [];\n rows.push(row); equipmentByPath.set(row.sourcePath!, rows);\n }\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 const raw = readFileSync(templateSource ?? join(corpusRoot, p), 'utf8');\n const content = id === TEMPLATE_CHUNK_ID ? raw.replace(/\\$CURSOR/g, '') : raw;\n const compiled = compileSeedRow(p, content);\n compiled.blockIndex = blocksByPath.get(p) ?? compiled.blockIndex;\n compiled.blockEfforts = effortsByPath.get(p) ?? [];\n compiled.blockEquipment = equipmentByPath.get(p) ?? [];\n return compiled;\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 passMs.write = Date.now() - tWrite;\n\n const manifest: SeedManifest = {\n name: 'name' in metadata && typeof metadata.name === 'string' ? metadata.name : undefined,\n description: 'description' in metadata && typeof metadata.description === 'string' ? metadata.description : undefined,\n repositoryUrl: repositoryLink?.protocol === 'https:' && !repositoryLink.username && !repositoryLink.password ? repositoryLink.href : undefined,\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 assertSeedManifest(manifest);\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"]}
@@ -1,11 +1,12 @@
1
1
  import { createRequire } from 'module';
2
- import { compileSeedRow, SEED_SCHEMA, writeBuildReport } from './chunk-FZKXOYMJ.mjs';
3
- import { openCliDb, nodeFs, sqliteIndexStore, sqliteEffortStore, sqliteBlockStore, sqliteNoteStore, sqliteEventStore, getNoteBundle, getSessionBundle, getEffortBySlug, listTagsByType, nodePath, loadSql, uuid5, CLI_UUID_NAMESPACE, nodeCrypto, stableNoteId, randomId } from './chunk-CYKNTEGY.mjs';
2
+ import { compileSeedRow, SEED_SCHEMA, writeBuildReport } from './chunk-CVFMFD7D.mjs';
3
+ import { VERSION } from './chunk-JUBKCRNV.mjs';
4
+ import { openCliDb, nodeFs, sqliteIndexStore, sqliteEffortStore, sqliteBlockStore, sqliteNoteStore, sqliteEventStore, getNoteBundle, getSessionBundle, getEffortBySlug, getEquipmentBySlug, listTagsByType, nodePath, loadSql, uuid5, CLI_UUID_NAMESPACE, nodeCrypto, stableNoteId, randomId } from './chunk-IWT7U3WX.mjs';
4
5
  import { __require } from './chunk-6L5ZDZJ7.mjs';
5
- import { createParser, frozenNow, createCompiler, createMockClock, RuntimeStack, EventBus, ScriptRuntime, createAnalyticsEngineForBlock, StartSessionAction, NextEvent, toStoredOutputStatement, bundledEfforts, parseScript } from '@bitcobblers/wod-wiki-lang';
6
- import { buildStatementTree, createIRFile, registerLanguagePack, extractNoteIdentity, extractTypedTags, composeNoteMarkdown, sessionToCsv, effortToMarkdown, equipmentToCsv, markdownToEffort, csvToEquipmentLabels, csvToSessionRows, isIRFile, inMemoryEventStore, readFrontmatterMeta, assertSeedManifest, seedMetaKey, SEED_SCHEMA as SEED_SCHEMA$1, emptySeedMeta, CANVAS_CHUNK_ID, assertSeedRows, seedNoteId, applySeedChunk } from '@bitcobblers/wod-wiki-engine';
6
+ import { createParser, frozenNow, createCompiler, createMockClock, RuntimeStack, EventBus, ScriptRuntime, createAnalyticsEngineForBlock, StartSessionAction, NextEvent, toStoredOutputStatement, bundledEfforts, parseEffortFile, parseEquipmentFile, createReferenceIndex, parseScript, extractStatementRefs } from '@bitcobblers/wod-wiki-lang';
7
+ import { buildStatementTree, createIRFile, registerLanguagePack, extractNoteIdentity, extractTypedTags, composeNoteMarkdown, sessionToCsv, effortToMarkdown, equipmentToMarkdown, equipmentToCsv, csvToEquipmentLabels, csvToSessionRows, isIRFile, inMemoryEventStore, readFrontmatterMeta, assertSeedManifest, seedMetaKey, SEED_SCHEMA as SEED_SCHEMA$1, emptySeedMeta, CANVAS_CHUNK_ID, assertSeedRows, seedNoteId, applySeedChunk } from '@bitcobblers/wod-wiki-engine';
7
8
  import { toEventRows, toSummaryEventRows, parseQuery, QueryService, isPipelineQuery, isFindQuery, catalogOfItem } from '@bitcobblers/wod-wiki-wql';
8
- import { validateNoteBlocks, parseDocumentSections, blockContentId, reconcileNoteBlocks, KNOWN_SECTION_WIDGETS } from '@bitcobblers/wod-wiki-core';
9
+ import { validateNoteBlocks, parseDocumentSections, blockContentId, reconcileNoteBlocks, KNOWN_SECTION_WIDGETS, MetricType } from '@bitcobblers/wod-wiki-core';
9
10
  import { rowsEqual } from '@bitcobblers/wod-wiki-storage';
10
11
 
11
12
  if (typeof globalThis.require === 'undefined') {
@@ -923,23 +924,7 @@ ${escapeCsvField(data.parsed.metric)},${data.scalar},${escapeCsvField(data.unit
923
924
  return lines.join("\n");
924
925
  }
925
926
  var registeredWidgets = KNOWN_SECTION_WIDGETS;
926
- var saveStores = ["notes", "block_revisions", "block_index", "block_efforts", "tags", "note_tags", "sessions"];
927
- function extractEffortSlugs(statements) {
928
- const slugs = /* @__PURE__ */ new Set();
929
- for (const statement of statements) {
930
- if (statement.exerciseId) {
931
- slugs.add(statement.exerciseId);
932
- } else {
933
- const effortMetric = statement.metrics?.getMetric?.("effort");
934
- const effort = effortMetric && "effort" in effortMetric ? effortMetric.effort : void 0;
935
- if (typeof effort === "string") {
936
- const slug = effort.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
937
- if (slug) slugs.add(slug);
938
- }
939
- }
940
- }
941
- return [...slugs];
942
- }
927
+ var saveStores = ["notes", "block_revisions", "block_index", "block_efforts", "block_equipment", "efforts", "equipment", "tags", "note_tags", "sessions"];
943
928
  function titleFromLabel(sourceLabel) {
944
929
  if (!sourceLabel || sourceLabel === "-") return "stdin";
945
930
  const stem = sourceLabel.split("/").pop() ?? sourceLabel;
@@ -1011,9 +996,19 @@ async function saveSource(db, options, startTime) {
1011
996
  };
1012
997
  const priorRows = await tx.readonly("block_index").getAllFromIndex("by-note", noteId);
1013
998
  const priorEfforts = await tx.readonly("block_efforts").getAllFromIndex("by-note", noteId);
999
+ const priorEquipment = await tx.readonly("block_equipment").getAllFromIndex("by-note", noteId);
1000
+ const storedEfforts = await tx.readonly("efforts").getAll();
1001
+ const effortsBySlug = /* @__PURE__ */ new Map();
1002
+ for (const effort of bundledEfforts) effortsBySlug.set(effort.slug, effort);
1003
+ for (const effort of storedEfforts) effortsBySlug.set(effort.slug, effort);
1004
+ const referenceIndex = createReferenceIndex({
1005
+ efforts: [...effortsBySlug.values()],
1006
+ equipment: await tx.readonly("equipment").getAll()
1007
+ });
1014
1008
  const priorById = new Map(priorRows.map((row) => [row.id, row]));
1015
1009
  const nextRows = [];
1016
1010
  const nextEfforts = [];
1011
+ const nextEquipment = [];
1017
1012
  for (const [position, block] of Object.values(blocks).sort((a, b) => a.from - b.from).entries()) {
1018
1013
  const id = `${noteId}:${block.id}`;
1019
1014
  const prior = priorById.get(id);
@@ -1039,7 +1034,20 @@ async function saveSource(db, options, startTime) {
1039
1034
  ...note.sourceId ? { sourceId: note.sourceId } : {}
1040
1035
  });
1041
1036
  if (block.kind === "wod") {
1042
- for (const effortSlug of extractEffortSlugs(parseScript(body, { sport: block.sport, dialect: block.dialect }).statements)) {
1037
+ const statements = parseScript(body, { sport: block.sport, dialect: block.dialect, references: referenceIndex }).statements;
1038
+ const refs = extractStatementRefs(statements);
1039
+ const effortSlugs = new Set(refs.efforts);
1040
+ if (effortSlugs.size === 0) {
1041
+ for (const s of statements) {
1042
+ const m = s.metrics?.getMetric?.(MetricType.Effort);
1043
+ const val = typeof m?.value === "string" ? m.value : m && "effort" in m ? String(m.effort) : "";
1044
+ const slug = val.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
1045
+ if (slug && !["rest", "amrap", "emom", "tabata", "for-time"].includes(slug)) {
1046
+ effortSlugs.add(slug);
1047
+ }
1048
+ }
1049
+ }
1050
+ for (const effortSlug of effortSlugs) {
1043
1051
  const effortId = `${noteId}:${block.id}:${effortSlug}`;
1044
1052
  const previous = priorEfforts.find((row) => row.id === effortId);
1045
1053
  nextEfforts.push({
@@ -1052,12 +1060,26 @@ async function saveSource(db, options, startTime) {
1052
1060
  createdAt: previous?.createdAt ?? now
1053
1061
  });
1054
1062
  }
1063
+ for (const equipmentSlug of refs.equipment) {
1064
+ const equipmentId = `${noteId}:${block.id}:${equipmentSlug}`;
1065
+ const previous = priorEquipment.find((row) => row.id === equipmentId);
1066
+ nextEquipment.push({
1067
+ ...previous,
1068
+ id: equipmentId,
1069
+ noteId,
1070
+ blockId: block.id,
1071
+ blockContentId: fingerprint,
1072
+ equipmentSlug,
1073
+ createdAt: previous?.createdAt ?? now
1074
+ });
1075
+ }
1055
1076
  }
1056
1077
  }
1057
1078
  if (!rowsEqual(existing, note)) await tx.readwrite("notes").put(note);
1058
1079
  if (revisions.length) await tx.readwrite("block_revisions").putMany(revisions);
1059
1080
  await diffProjection(tx, "block_index", priorRows, nextRows);
1060
1081
  await diffProjection(tx, "block_efforts", priorEfforts, nextEfforts);
1082
+ await diffProjection(tx, "block_equipment", priorEquipment, nextEquipment);
1061
1083
  const tags = await saveTags(tx, noteId, options.tags, now);
1062
1084
  let session;
1063
1085
  let revision;
@@ -1093,6 +1115,7 @@ async function diffProjection(tx, store, previous, next) {
1093
1115
  if (!rowsEqual(old.get(row.id), row)) {
1094
1116
  if (store === "block_index" && "blockVersion" in row) await tx.readwrite("block_index").put(row);
1095
1117
  if (store === "block_efforts" && "effortSlug" in row) await tx.readwrite("block_efforts").put(row);
1118
+ if (store === "block_equipment" && "equipmentSlug" in row) await tx.readwrite("block_equipment").put(row);
1096
1119
  }
1097
1120
  }
1098
1121
  }
@@ -1184,6 +1207,12 @@ async function persistEffort(db, effort) {
1184
1207
  await sql.putRow(tx, sql.storeDefinition("efforts"), effort);
1185
1208
  });
1186
1209
  }
1210
+ async function persistEquipment(db, equipment) {
1211
+ const sql = await loadSql();
1212
+ await db.db.transaction(async (tx) => {
1213
+ await sql.putRow(tx, sql.storeDefinition("equipment"), equipment);
1214
+ });
1215
+ }
1187
1216
  async function persistTypedTags(db, labels, type) {
1188
1217
  return db.storage.transaction(["tags"], "readwrite", async (tx) => {
1189
1218
  let added = 0;
@@ -1206,17 +1235,18 @@ async function importSeedDir(db, dir, sourceId) {
1206
1235
  const source = sourceId || path.basename(dir);
1207
1236
  const manifest = assertSeedManifest(JSON.parse(fs.readFileSync(path.resolve(dir, "manifest.json"), "utf-8")));
1208
1237
  const key = seedMetaKey(source);
1209
- let expected = await db.storage.readonly("meta").get(key);
1210
- if (expected && expected.schema !== SEED_SCHEMA$1) throw new Error("Incompatible seed checkpoint; recreate storage");
1238
+ const stored = await db.storage.readonly("meta").get(key);
1239
+ let expected = stored?.schema === SEED_SCHEMA$1 ? stored : void 0;
1211
1240
  let meta = expected ?? emptySeedMeta(key);
1212
1241
  if (manifest.version < meta.seedVersion) throw new Error("Seed manifest is older than stored checkpoint");
1213
- const summary = { sourceId: source, version: manifest.version, notes: 0, efforts: 0, blocks: 0, blockEfforts: 0, deleted: 0, skippedUserOwned: 0 };
1242
+ const summary = { sourceId: source, version: manifest.version, notes: 0, efforts: 0, equipment: 0, blocks: 0, blockEfforts: 0, deleted: 0, skippedUserOwned: 0 };
1214
1243
  const metadataChanged = manifest.version !== meta.seedVersion || manifest.builtAt !== meta.builtAt;
1215
1244
  const plan = manifest.chunks.filter((c) => metadataChanged || meta.chunks[c.id]?.sha256 !== c.sha256);
1216
1245
  plan.sort((a, b) => Number(b.id === CANVAS_CHUNK_ID) - Number(a.id === CANVAS_CHUNK_ID));
1217
1246
  const accumulate = (result) => {
1218
1247
  summary.notes += result.totalNotes;
1219
1248
  summary.efforts += result.totalEfforts;
1249
+ summary.equipment += result.totalEquipment;
1220
1250
  summary.blocks += result.totalBlocks;
1221
1251
  summary.deleted += result.deleted;
1222
1252
  summary.skippedUserOwned += result.skippedUserOwned;
@@ -1286,6 +1316,7 @@ async function publishCatalogSeed(db, options) {
1286
1316
  }
1287
1317
  const allIndexRows = await db.storage.readonly("block_index").getAll();
1288
1318
  const allEffortRows = await db.storage.readonly("block_efforts").getAll();
1319
+ const allEquipmentRows = await db.storage.readonly("block_equipment").getAll();
1289
1320
  const indexByNote = /* @__PURE__ */ new Map();
1290
1321
  for (const row of allIndexRows) {
1291
1322
  const list = indexByNote.get(row.noteId) ?? [];
@@ -1298,6 +1329,12 @@ async function publishCatalogSeed(db, options) {
1298
1329
  list.push(row);
1299
1330
  effortsByNote.set(row.noteId, list);
1300
1331
  }
1332
+ const equipmentByNote = /* @__PURE__ */ new Map();
1333
+ for (const row of allEquipmentRows) {
1334
+ const list = equipmentByNote.get(row.noteId) ?? [];
1335
+ list.push(row);
1336
+ equipmentByNote.set(row.noteId, list);
1337
+ }
1301
1338
  const outDir = path.resolve(process.cwd(), options.outDir);
1302
1339
  const chunksDir = path.join(outDir, "chunks");
1303
1340
  fs.mkdirSync(chunksDir, { recursive: true });
@@ -1312,6 +1349,7 @@ async function publishCatalogSeed(db, options) {
1312
1349
  const notePath = note.sourcePath ?? `markdown/collections/${catalogName}/${stem}.md`;
1313
1350
  const noteBlockIndex = indexByNote.get(note.id) ?? [];
1314
1351
  const noteBlockEfforts = effortsByNote.get(note.id) ?? [];
1352
+ const noteBlockEquipment = equipmentByNote.get(note.id) ?? [];
1315
1353
  const blockIndex = noteBlockIndex.length > 0 ? noteBlockIndex.map((b) => ({
1316
1354
  ...b,
1317
1355
  isStatic: true,
@@ -1321,7 +1359,9 @@ async function publishCatalogSeed(db, options) {
1321
1359
  })) : compileSeedRow(notePath, note.rawContent, {
1322
1360
  routeId: `${catalogName}/${stem}`,
1323
1361
  sourceId: `collection:${catalogName}/${stem}`,
1324
- createdAt: note.createdAt,
1362
+ // Authored frontmatter date first — exports keep the post's own
1363
+ // day, never the import/publish time.
1364
+ createdAt: note.date ?? note.createdAt,
1325
1365
  noteTitle: note.title
1326
1366
  }).blockIndex;
1327
1367
  const blockEfforts = noteBlockEfforts.map((e) => ({
@@ -1329,12 +1369,18 @@ async function publishCatalogSeed(db, options) {
1329
1369
  isStatic: true,
1330
1370
  sourcePath: e.sourcePath ?? notePath
1331
1371
  }));
1372
+ const blockEquipment = noteBlockEquipment.map((e) => ({
1373
+ ...e,
1374
+ isStatic: true,
1375
+ sourcePath: e.sourcePath ?? notePath
1376
+ }));
1332
1377
  chunkRows.push({
1333
1378
  path: notePath,
1334
1379
  content: note.rawContent,
1335
1380
  blocks: note.blocks,
1336
1381
  blockIndex,
1337
- blockEfforts
1382
+ blockEfforts,
1383
+ blockEquipment
1338
1384
  });
1339
1385
  }
1340
1386
  const chunkId = `collection.${catalogName}`;
@@ -1375,11 +1421,6 @@ async function publishCatalogSeed(db, options) {
1375
1421
  totalNotes
1376
1422
  };
1377
1423
  }
1378
-
1379
- // src/version.ts
1380
- var VERSION = "0.36.2136";
1381
-
1382
- // src/cli/runner.ts
1383
1424
  function getFs2() {
1384
1425
  if (typeof globalThis.process?.versions?.node === "undefined" && typeof globalThis.Bun === "undefined") {
1385
1426
  throw new Error("File system operations are only supported in Node / Bun environments");
@@ -1531,7 +1572,7 @@ function parseCliArgs(args) {
1531
1572
  if (Number.isSafeInteger(v) && v >= 0) result.seedVersion = v;
1532
1573
  i++;
1533
1574
  } else if (!result.subcommand) {
1534
- if (arg === "parse" || arg === "run" || arg === "query" || arg === "download" || arg === "export" || arg === "import" || arg === "publish" || arg === "build" || arg === "seed" || arg === "reset" || arg === "init" || arg === "server" || arg === "serve" || arg === "playground" || arg === "help" || arg === "version") {
1575
+ if (arg === "parse" || arg === "run" || arg === "query" || arg === "download" || arg === "export" || arg === "import" || arg === "publish" || arg === "build" || arg === "seed" || arg === "reset" || arg === "init" || arg === "server" || arg === "serve" || arg === "playground" || arg === "init-catalog" || arg === "help" || arg === "version") {
1535
1576
  result.subcommand = arg;
1536
1577
  } else {
1537
1578
  result.target = arg;
@@ -1597,6 +1638,10 @@ USAGE:
1597
1638
  wod import <note|playground|session|effort|equipment> <file> [options]
1598
1639
  wod publish [catalog] [options]
1599
1640
  wod build [dir] [options]
1641
+ wod init-catalog <name>
1642
+ Scaffold a new catalog repository (package.json, example
1643
+ collection, GitHub Actions Pages workflow). Refuses an
1644
+ existing destination.
1600
1645
  wod seed [options]
1601
1646
  wod reset [options]
1602
1647
  wod init Initialize the configured database (idempotent)
@@ -1799,6 +1844,22 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
1799
1844
  }
1800
1845
  };
1801
1846
  try {
1847
+ if (parsed.subcommand === "init-catalog") {
1848
+ if (!parsed.target) {
1849
+ writeErr("[wod init-catalog] Error: Missing catalog name (a single new directory name)");
1850
+ return 1;
1851
+ }
1852
+ const { scaffoldCatalog } = await import('./scaffoldCatalog-OIU4FEKJ.mjs');
1853
+ try {
1854
+ const result = scaffoldCatalog(parsed.target);
1855
+ writeOut(`[wod init-catalog] Created ${result.dir} (${result.files.length} files)`);
1856
+ writeOut(`Next: cd ${parsed.target} && bun install && bunx wod build . --output dist`);
1857
+ return 0;
1858
+ } catch (error) {
1859
+ writeErr(`[wod init-catalog] ${error.message}`);
1860
+ return 1;
1861
+ }
1862
+ }
1802
1863
  if (parsed.subcommand === "parse") {
1803
1864
  if (!parsed.target) {
1804
1865
  writeErr('[wod parse] Error: Missing input file or "-" for stdin');
@@ -1999,7 +2060,9 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
1999
2060
  writeErr(`[wod ${verb}] Effort not found in ${db.path}: ${id}`);
2000
2061
  return 1;
2001
2062
  }
2002
- const markdown = effortToMarkdown(effort);
2063
+ const ownerNoteId = typeof effort.ownerNoteId === "string" ? effort.ownerNoteId : `effort/${effort.slug}`;
2064
+ const owner = await db.storage.readonly("notes").get(ownerNoteId);
2065
+ const markdown = owner?.rawContent ?? effortToMarkdown(effort);
2003
2066
  const target = parsed.output && parsed.output !== "-" ? parsed.output : `${id}.md`;
2004
2067
  if (parsed.output === "-") {
2005
2068
  writeOut(markdown);
@@ -2008,15 +2071,29 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
2008
2071
  }
2009
2072
  writeOut(`[wod ${verb}] effort ${id} \u2192 ${target}`);
2010
2073
  } else {
2011
- const labels = (await listTagsByType(db.db, "equipment")).map((t) => t.label).sort();
2012
- const csv = equipmentToCsv(labels);
2013
- const target = parsed.output && parsed.output !== "-" ? parsed.output : "equipment.csv";
2014
- if (parsed.output === "-") {
2015
- writeOut(csv);
2074
+ const equipment = id ? await getEquipmentBySlug(db.db, targetId) : void 0;
2075
+ if (equipment) {
2076
+ const ownerNoteId = typeof equipment.ownerNoteId === "string" ? equipment.ownerNoteId : `equipment/${equipment.slug}`;
2077
+ const owner = await db.storage.readonly("notes").get(ownerNoteId);
2078
+ const markdown = owner?.rawContent ?? equipmentToMarkdown(equipment);
2079
+ const target = parsed.output && parsed.output !== "-" ? parsed.output : `${id}.md`;
2080
+ if (parsed.output === "-") {
2081
+ writeOut(markdown);
2082
+ } else {
2083
+ nodeFs().writeFileSync(target, markdown, "utf-8");
2084
+ }
2085
+ writeOut(`[wod ${verb}] equipment ${id} \u2192 ${target}`);
2016
2086
  } else {
2017
- nodeFs().writeFileSync(target, csv, "utf-8");
2087
+ const labels = (await listTagsByType(db.db, "equipment")).map((t) => t.label).sort();
2088
+ const csv = equipmentToCsv(labels);
2089
+ const target = parsed.output && parsed.output !== "-" ? parsed.output : "equipment.csv";
2090
+ if (parsed.output === "-") {
2091
+ writeOut(csv);
2092
+ } else {
2093
+ nodeFs().writeFileSync(target, csv, "utf-8");
2094
+ }
2095
+ writeOut(`[wod ${verb}] equipment \u2192 ${target} (${labels.length} labels)`);
2018
2096
  }
2019
- writeOut(`[wod ${verb}] equipment \u2192 ${target} (${labels.length} labels)`);
2020
2097
  }
2021
2098
  } finally {
2022
2099
  await db.close();
@@ -2058,7 +2135,7 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
2058
2135
  return 0;
2059
2136
  }
2060
2137
  if (kind === "effort") {
2061
- const effort = markdownToEffort(fs.readFileSync(file, "utf-8"));
2138
+ const effort = parseEffortFile(fs.readFileSync(file, "utf-8"));
2062
2139
  if (!effort) {
2063
2140
  writeErr(`[wod import] Unparseable effort file (need frontmatter id/slug/label + numeric baseAttributes.met): ${file}`);
2064
2141
  return 1;
@@ -2072,6 +2149,21 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
2072
2149
  }
2073
2150
  return 0;
2074
2151
  }
2152
+ if (kind === "equipment" && /\.md$/i.test(file)) {
2153
+ const equipment = parseEquipmentFile(fs.readFileSync(file, "utf-8"));
2154
+ if (!equipment) {
2155
+ writeErr(`[wod import] Unparseable equipment file (need frontmatter type: equipment + id/slug/label): ${file}`);
2156
+ return 1;
2157
+ }
2158
+ const db2 = await openCliDb(cliDb());
2159
+ try {
2160
+ await persistEquipment(db2, { ...equipment, registrySource: "user" });
2161
+ writeOut(`[wod import] equipment ${equipment.slug} \u2014 ${equipment.label} \u2192 ${db2.path}`);
2162
+ } finally {
2163
+ await db2.close();
2164
+ }
2165
+ return 0;
2166
+ }
2075
2167
  if (kind === "equipment") {
2076
2168
  const labels = csvToEquipmentLabels(fs.readFileSync(file, "utf-8"));
2077
2169
  if (labels.length === 0) {
@@ -2126,7 +2218,7 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
2126
2218
  writeErr(`[wod build] No markdown/ corpus under ${root} \u2014 run from the content repo root (or pass its directory).`);
2127
2219
  return 1;
2128
2220
  }
2129
- const { generateSeed } = await import('./compiler-CTPLIZJK.mjs');
2221
+ const { generateSeed } = await import('./compiler-OXEXGIZG.mjs');
2130
2222
  try {
2131
2223
  const result = generateSeed({
2132
2224
  corpusRoot: root,
@@ -2196,7 +2288,7 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
2196
2288
  }
2197
2289
  if (parsed.subcommand === "server" || parsed.subcommand === "serve" || parsed.subcommand === "playground") {
2198
2290
  const mode = parsed.subcommand === "playground" ? "playground" : "server";
2199
- const { runCliServer } = await import('./server-JXECWS4A.mjs');
2291
+ const { runCliServer } = await import('./server-2DVBA35J.mjs');
2200
2292
  const options = { env: cliEnv() };
2201
2293
  if (mode === "server") options.database = cliDb();
2202
2294
  if (parsed.host !== void 0) options.host = parsed.host;
@@ -2222,5 +2314,5 @@ async function cliMain(argv = process.argv.slice(2), io = {}) {
2222
2314
  }
2223
2315
 
2224
2316
  export { PackLoadError, ParseSyntaxError, WqlSyntaxError, cliMain, formatExecutionOutput, formatParseOutput, formatQueryOutput, loadCliEnvironment, loadLanguagePack, loadQueryData, parseCliArgs, readStdin, resolveDatabaseConfig, runExecution, runParse, runQueryCli };
2225
- //# sourceMappingURL=chunk-6QNX4FED.mjs.map
2226
- //# sourceMappingURL=chunk-6QNX4FED.mjs.map
2317
+ //# sourceMappingURL=chunk-HRFOKCYI.mjs.map
2318
+ //# sourceMappingURL=chunk-HRFOKCYI.mjs.map