@vaubaan/harness 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +207 -83
- package/dist/cli/index.js +4165 -843
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/harn-canvas.cmd.md +23 -0
- package/dist/commands/{decision.cmd.md → harn-decision.cmd.md} +6 -6
- package/dist/commands/{doc-audit.cmd.md → harn-doc-audit.cmd.md} +7 -7
- package/dist/commands/{drift.cmd.md → harn-drift.cmd.md} +6 -6
- package/dist/commands/{handbook.cmd.md → harn-handbook.cmd.md} +6 -6
- package/dist/commands/harn-improve.cmd.md +20 -0
- package/dist/commands/{intent.cmd.md → harn-intent.cmd.md} +9 -9
- package/dist/commands/{readme.cmd.md → harn-readme.cmd.md} +6 -6
- package/dist/commands/{spec.cmd.md → harn-spec.cmd.md} +6 -6
- package/dist/commands/{test-plan.cmd.md → harn-test-plan.cmd.md} +6 -6
- package/dist/commands/harn-upgrade.cmd.md +22 -0
- package/dist/commands/{workflow.cmd.md → harn-workflow.cmd.md} +6 -6
- package/dist/index.d.ts +32 -3
- package/dist/index.js +533 -96
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +468 -93
- package/dist/init.js.map +1 -1
- package/dist/linters/index.d.ts +3 -34
- package/dist/linters/index.js +996 -554
- package/dist/linters/index.js.map +1 -1
- package/dist/parser/index.d.ts +96 -6
- package/dist/parser/index.js +220 -10
- package/dist/parser/index.js.map +1 -1
- package/dist/render-BhUar2gf.d.ts +81 -0
- package/dist/render.d.ts +1 -1
- package/dist/render.js +233 -22
- package/dist/render.js.map +1 -1
- package/dist/skills/harn-canvas-review.skill.md +87 -0
- package/dist/skills/{decision-record-writer.skill.md → harn-decision-record-writer.skill.md} +2 -1
- package/dist/skills/{doc-audit.skill.md → harn-doc-audit.skill.md} +75 -26
- package/dist/skills/{drift-detector.skill.md → harn-drift-detector.skill.md} +15 -14
- package/dist/skills/harn-guide.skill.md +137 -0
- package/dist/skills/{handbook-writer.skill.md → harn-handbook-writer.skill.md} +2 -1
- package/dist/skills/{intent-writer.skill.md → harn-intent-writer.skill.md} +83 -16
- package/dist/skills/{readme-writer.skill.md → harn-readme-writer.skill.md} +4 -4
- package/dist/skills/harn-self-improve.skill.md +84 -0
- package/dist/skills/{spec-writer.skill.md → harn-spec-writer.skill.md} +8 -8
- package/dist/skills/{test-plan-writer.skill.md → harn-test-plan-writer.skill.md} +6 -5
- package/dist/skills/harn-upgrade.skill.md +171 -0
- package/dist/skills/{workflow-writer.skill.md → harn-workflow-writer.skill.md} +6 -5
- package/dist/templates/decisions-index.md.tmpl +11 -0
- package/dist/templates/handbook-index.md.tmpl +8 -0
- package/dist/templates/profile.md.tmpl +30 -0
- package/dist/types-CfUByAIr.d.ts +35 -0
- package/dist/view/index.d.ts +117 -0
- package/dist/view/index.js +3987 -0
- package/dist/view/index.js.map +1 -0
- package/package.json +5 -1
- package/dist/render-CTx7VNOK.d.ts +0 -45
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/view/graph.ts","../../src/cli/manifest.ts","../../src/version.ts","../../src/cli/managed-paths.ts","../../src/cli/plan-render.ts","../../src/loader.ts","../../src/parser/common.ts","../../src/parser/schemas.ts","../../src/pillars.ts","../../src/types.ts","../../src/parser/cmd.ts","../../src/parser/skill.ts","../../src/util/yaml.ts","../../src/parser/intent.ts","../../src/parser/profile.ts","../../src/parser/docs.ts","../../src/linters/intent-util.ts","../../src/linters/util.ts","../../src/linters/intent-vocabulary.ts","../../src/renderers/common.ts","../../src/renderers/claude-code.ts","../../src/renderers/codex-cli.ts","../../src/renderers/opencode.ts","../../src/renderers/index.ts","../../src/renderers/intents-index.ts","../../src/renderers/profiles-index.ts","../../src/render.ts","../../src/linters/cross-links.ts","../../src/linters/adr-no-tracks.ts","../../src/linters/cardinal-files.ts","../../src/linters/config.ts","../../src/linters/decision-schema.ts","../../src/linters/doc-layout.ts","../../src/linters/frontmatter-tracks.ts","../../src/linters/generated-fresh.ts","../../src/linters/gitignore-harness.ts","../../src/linters/intent-anchors.ts","../../src/linters/intent-graph.ts","../../src/linters/intent-profiles.ts","../../src/linters/intent-schema.ts","../../src/linters/orphan-decisions.ts","../../src/linters/profile-schema.ts","../../src/linters/quality-schema.ts","../../src/linters/readme-presence.ts","../../src/linters/readme-sections.ts","../../src/linters/spec-has-content.ts","../../src/linters/spec-tech-agnostic.ts","../../src/linters/tracks-drift.ts","../../src/linters/index.ts","../../src/view/html.ts","../../src/view/assets.ts","../../src/cli/view.ts"],"sourcesContent":["/**\n * The context graph (docs/spec/coding-agent-harness.md §10.4): the meta\n * database as one index of nodes and typed edges, built with the readers the\n * linters use and carrying the lint report. Deterministic: an identical tree\n * gives identical bytes.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { basename, join, posix, relative } from \"node:path\";\nimport fg from \"fast-glob\";\nimport { readManifest } from \"../cli/manifest.js\";\nimport { defaultPackageDir } from \"../cli/plan-render.js\";\nimport { LINKED_DOC_IGNORES, resolveLink } from \"../linters/cross-links.js\";\nimport { ALL_LINTERS, loadLintConfig, runLinters } from \"../linters/index.js\";\nimport { intentFileSpecs, resolveSpecPath } from \"../linters/intent-util.js\";\nimport { driftOf } from \"../linters/tracks-drift.js\";\nimport type { LintIssue, LintReport } from \"../linters/types.js\";\nimport { parseFrontmatter, trackedPathExists } from \"../linters/util.js\";\nimport { loadHarness, loadOverrides, loadProjectSkills } from \"../loader.js\";\nimport {\n headingSlug,\n isExternalOrAnchor,\n readAdr,\n readHeadings,\n readKnownGaps,\n readLede,\n readLinks,\n stripFragment,\n vocabularyTerms,\n} from \"../parser/docs.js\";\nimport { type IntentNode, readIntentFiles } from \"../parser/intent.js\";\nimport { VERSION } from \"../version.js\";\n\nexport type Domain = \"harness\" | \"project\" | \"local\";\n\nexport const NODE_TYPES = [\n \"readme\",\n \"spec\",\n \"section\",\n \"term\",\n \"decision\",\n \"alternative\",\n \"handbook\",\n \"test-plan\",\n \"known-gap\",\n \"workflow\",\n \"quality\",\n \"doc\",\n \"intent-file\",\n \"intent\",\n \"linter\",\n \"skill\",\n \"command\",\n \"rendered-file\",\n \"path\",\n \"glob\",\n \"lesson\",\n] as const;\nexport type NodeType = (typeof NODE_TYPES)[number];\n\nexport type EdgeType =\n | \"contains\"\n | \"tracks\"\n | \"anchors\"\n | \"requires\"\n | \"creates\"\n | \"spec\"\n | \"links-to\"\n | \"gap-of\"\n | \"checks\"\n | \"suggests\"\n | \"invokes\"\n | \"renders-to\";\n\nexport type AttrValue = string | number | boolean | null | string[] | { [k: string]: AttrValue };\n\nexport interface GraphNode {\n id: string;\n type: NodeType;\n domain: Domain;\n title: string;\n /** Path from the repo root, or the package name for a harness node. */\n sourcePath: string;\n /** 1-based; 0 when the node has no line of its own. */\n line: number;\n parent?: string;\n attrs: Record<string, AttrValue>;\n issues: LintIssue[];\n}\n\nexport interface GraphEdge {\n from: string;\n to: string;\n type: EdgeType;\n line: number;\n}\n\nexport interface ContextGraph {\n version: 1;\n harness: string;\n nodes: GraphNode[];\n edges: GraphEdge[];\n lint: { ran: boolean; errors: number; warnings: number; unattached: LintIssue[] };\n}\n\nexport interface BuildOptions {\n /** Run the linters and attach their issues (default true). */\n lint?: boolean;\n /** A report already computed; skips running the linters. */\n report?: LintReport;\n /** Directory holding the shipped `skills/` and `commands/`. */\n packageDir?: string;\n}\n\nexport const HARNESS_SOURCE = \"@vaubaan/harness\";\nconst LESSONS_FILE = \".vaubaan/lessons/lessons.json\";\n\n/** The pillar each linter pillar name checks, as a path prefix or file. */\nconst PILLAR_PATHS: Record<string, ReadonlyArray<string>> = {\n readme: [\"README.md\"],\n spec: [\"docs/spec/\"],\n decisions: [\"docs/decisions/\"],\n handbook: [\"docs/handbook/\"],\n tests: [\"docs/tests/\"],\n workflow: [\"docs/workflow/\"],\n quality: [\"docs/quality/\"],\n intents: [\"docs/intents/\"],\n profiles: [\"docs/profiles/\"],\n};\n\nconst RENDERED_SKILL_DIRS = [\".claude/skills\", \".agents/skills\", \".opencode/skills\"];\nconst RENDERED_COMMAND_DIRS = [\".claude/commands\", \".opencode/commands\"];\n\nfunction docType(path: string): NodeType {\n if (path === \"README.md\") return \"readme\";\n if (path.endsWith(\"/README.md\")) return \"doc\";\n if (path.startsWith(\"docs/spec/\")) return \"spec\";\n if (path.startsWith(\"docs/decisions/\")) return \"decision\";\n if (path.startsWith(\"docs/handbook/\")) return \"handbook\";\n if (path.startsWith(\"docs/tests/\")) return \"test-plan\";\n if (path.startsWith(\"docs/workflow/\")) return \"workflow\";\n if (path.startsWith(\"docs/quality/\")) return \"quality\";\n if (path.startsWith(\"docs/intents/\")) return \"intent-file\";\n return \"doc\";\n}\n\nfunction dateString(value: unknown): string | undefined {\n if (value instanceof Date) return value.toISOString().slice(0, 10);\n if (typeof value === \"string\" && value) return value;\n return undefined;\n}\n\nfunction truncate(text: string | undefined, max = 280): string | undefined {\n if (!text) return undefined;\n const flat = text.replace(/\\s+/g, \" \").trim();\n return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;\n}\n\nfunction compact(attrs: Record<string, AttrValue | undefined>): Record<string, AttrValue> {\n const out: Record<string, AttrValue> = {};\n for (const [k, v] of Object.entries(attrs)) if (v !== undefined) out[k] = v;\n return out;\n}\n\nfunction engineOf(path: string): string | undefined {\n if (path.startsWith(\".claude/\") || path === \"CLAUDE.md\") return \"claude-code\";\n if (path.startsWith(\".agents/\")) return \"codex-cli\";\n if (path.startsWith(\".opencode/\")) return \"opencode\";\n return undefined;\n}\n\nclass Builder {\n readonly nodes = new Map<string, GraphNode>();\n readonly edges = new Map<string, GraphEdge>();\n\n add(\n node: Omit<GraphNode, \"issues\" | \"attrs\"> & { attrs?: Record<string, AttrValue | undefined> },\n ) {\n const existing = this.nodes.get(node.id);\n if (existing) return existing;\n const full: GraphNode = { ...node, attrs: compact(node.attrs ?? {}), issues: [] };\n this.nodes.set(node.id, full);\n return full;\n }\n\n edge(from: string, to: string, type: EdgeType, line: number) {\n if (from === to) return;\n const key = `${from}\\u0000${type}\\u0000${to}`;\n const existing = this.edges.get(key);\n if (!existing || line < existing.line) this.edges.set(key, { from, to, type, line });\n }\n\n /** A `tracks:` entry or an anchor, as a path or glob node. */\n target(repoRoot: string, pattern: string): string {\n const isGlob = pattern.includes(\"*\");\n const id = `${isGlob ? \"glob\" : \"path\"}:${pattern}`;\n if (!this.nodes.has(id)) {\n const matches = isGlob ? fg.sync(pattern, { cwd: repoRoot }).length : undefined;\n this.add({\n id,\n type: isGlob ? \"glob\" : \"path\",\n domain: \"project\",\n title: pattern,\n sourcePath: pattern,\n line: 0,\n attrs: {\n exists: isGlob ? (matches ?? 0) > 0 : trackedPathExists(repoRoot, pattern),\n matches,\n },\n });\n }\n return id;\n }\n}\n\nfunction intentSlugPath(nodes: ReadonlyArray<IntentNode>, index: number): string {\n const parts: string[] = [];\n let i: number | undefined = index;\n while (i !== undefined) {\n const n: IntentNode | undefined = nodes[i];\n if (!n) break;\n parts.unshift(headingSlug(n.title));\n i = n.parent;\n }\n return parts.join(\"/\");\n}\n\n/** The node of a relative doc link: a section when its fragment names one, else the doc. */\nfunction linkTarget(b: Builder, repoRoot: string, from: string, url: string): string | undefined {\n const abs = resolveLink(repoRoot, from, url);\n const rel = relative(repoRoot, abs).split(\"\\\\\").join(\"/\");\n const hash = url.includes(\"#\") ? url.slice(url.indexOf(\"#\") + 1) : \"\";\n if (hash && b.nodes.has(`sec:${rel}#${hash}`)) return `sec:${rel}#${hash}`;\n if (b.nodes.has(`doc:${rel}`)) return `doc:${rel}`;\n return undefined;\n}\n\nexport function buildGraph(repoRoot: string, opts: BuildOptions = {}): ContextGraph {\n const b = new Builder();\n const config = loadLintConfig(repoRoot);\n const manifest = (() => {\n try {\n return readManifest(repoRoot);\n } catch {\n return null;\n }\n })();\n const rendered = new Set(manifest?.files ?? []);\n\n // ------------------------------------------------------------ doc files\n const docFiles = fg\n .sync([\"README.md\", \"docs/**/*.md\"], {\n cwd: repoRoot,\n ignore: [...LINKED_DOC_IGNORES, ...config.ignore],\n })\n .filter((f) => !rendered.has(f))\n .sort();\n const texts = new Map<string, string>();\n for (const path of docFiles) {\n const text = readFileSync(join(repoRoot, path), \"utf8\");\n texts.set(path, text);\n const { data } = parseFrontmatter(text);\n const h1 = readHeadings(text).find((h) => h.depth === 1);\n const title =\n (typeof data.title === \"string\" && data.title) || h1?.title || basename(path, \".md\");\n const type = docType(path);\n b.add({\n id: `doc:${path}`,\n type,\n domain: \"project\",\n title,\n sourcePath: path,\n line: 1,\n attrs: {\n lede: truncate(readLede(text)),\n status: typeof data.status === \"string\" ? data.status : undefined,\n lastReviewed: dateString(data.last_reviewed),\n lines: text.split(\"\\n\").length,\n },\n });\n }\n\n // ----------------------------------------------------- spec: sections, terms\n for (const path of docFiles.filter((p) => docType(p) === \"spec\")) {\n const text = texts.get(path) ?? \"\";\n for (const h of readHeadings(text)) {\n if (h.depth < 2 || h.depth > 3) continue;\n b.add({\n id: `sec:${path}#${h.slug}`,\n type: \"section\",\n domain: \"project\",\n title: h.title,\n sourcePath: path,\n line: h.line,\n parent: `doc:${path}`,\n attrs: { depth: h.depth },\n });\n b.edge(`doc:${path}`, `sec:${path}#${h.slug}`, \"contains\", h.line);\n }\n for (const term of vocabularyTerms(text) ?? []) {\n const id = `term:${term.slug}`;\n b.add({\n id,\n type: \"term\",\n domain: \"project\",\n title: term.term,\n sourcePath: path,\n line: term.line,\n parent: `doc:${path}`,\n attrs: { defined: true, definition: truncate(term.definition, 400) },\n });\n b.edge(`doc:${path}`, id, \"contains\", term.line);\n }\n }\n\n // ------------------------------------------------- decisions: alternatives\n for (const path of docFiles.filter((p) => docType(p) === \"decision\")) {\n const adr = readAdr(texts.get(path) ?? \"\");\n const node = b.nodes.get(`doc:${path}`);\n if (node) {\n node.attrs = compact({\n ...node.attrs,\n decision: truncate(adr.decision, 600),\n missingSections: adr.missing.length ? adr.missing : undefined,\n });\n }\n const stem = basename(path, \".md\");\n for (const alt of adr.alternatives) {\n const id = `alt:${stem}/${headingSlug(alt.title)}`;\n b.add({\n id,\n type: \"alternative\",\n domain: \"project\",\n title: alt.title,\n sourcePath: path,\n line: alt.line,\n parent: `doc:${path}`,\n attrs: { text: truncate(alt.text, 400) },\n });\n b.edge(`doc:${path}`, id, \"contains\", alt.line);\n }\n }\n\n // ------------------------------------------- tracked docs: tracks, drift\n for (const path of docFiles) {\n const type = docType(path);\n if (type !== \"handbook\" && type !== \"test-plan\" && type !== \"workflow\") continue;\n const text = texts.get(path) ?? \"\";\n const { data } = parseFrontmatter(text);\n const lines = text.split(\"\\n\");\n if (Array.isArray(data.tracks)) {\n for (const entry of data.tracks) {\n if (typeof entry !== \"string\") continue;\n const line = lines.findIndex((l) => l.includes(entry)) + 1 || 1;\n b.edge(`doc:${path}`, b.target(repoRoot, entry), \"tracks\", line);\n }\n }\n }\n\n // --------------------------------------------------------- known gaps\n for (const path of docFiles.filter((p) => docType(p) === \"test-plan\")) {\n for (const gap of readKnownGaps(texts.get(path) ?? \"\")) {\n const id = `gap:${path}:${gap.line}`;\n b.add({\n id,\n type: \"known-gap\",\n domain: \"project\",\n title: truncate(gap.text.replace(/⚠️|\\*/gu, \"\").trim(), 120) ?? gap.text,\n sourcePath: path,\n line: gap.line,\n parent: `doc:${path}`,\n attrs: { text: gap.text },\n });\n b.edge(`doc:${path}`, id, \"contains\", gap.line);\n }\n }\n\n // -------------------------------------------------------------- intents\n for (const file of readIntentFiles(repoRoot)) {\n const fileId = `doc:${file.path}`;\n const fileNode = b.nodes.get(fileId);\n if (fileNode) {\n fileNode.title = file.title;\n fileNode.attrs = compact({\n ...fileNode.attrs,\n status: file.meta?.status,\n actors: file.meta?.actors ? [...file.meta.actors] : undefined,\n statement: truncate(file.statement, 400),\n });\n }\n const stem = basename(file.path, \".md\");\n const ids = file.nodes.map((_, i) => `intent:${stem}/${intentSlugPath(file.nodes, i)}`);\n file.nodes.forEach((n, i) => {\n const id = ids[i] as string;\n const parent = n.parent !== undefined ? (ids[n.parent] as string) : fileId;\n b.add({\n id,\n type: \"intent\",\n domain: \"project\",\n title: n.title,\n sourcePath: file.path,\n line: n.line,\n parent,\n attrs: {\n level: n.level,\n terminal: n.isTerminal,\n status: n.status,\n effectiveStatus: n.effectiveStatus,\n acceptance: n.acceptance.length ? [...n.acceptance] : undefined,\n },\n });\n b.edge(parent, id, \"contains\", n.line);\n for (const entity of n.requires)\n b.edge(id, termId(b, entity, file.path, n.line), \"requires\", n.line);\n for (const entity of n.creates)\n b.edge(id, termId(b, entity, file.path, n.line), \"creates\", n.line);\n for (const anchor of n.anchors)\n b.edge(id, b.target(repoRoot, anchor), \"anchors\", n.fieldLines.anchors ?? n.line);\n if (n.spec) {\n const target = linkTarget(b, repoRoot, file.path, n.spec);\n if (target) b.edge(id, target, \"spec\", n.fieldLines.spec ?? n.line);\n }\n });\n // Progress of every node: implemented terminal intents under it.\n const progress = (index: number): [number, number] => {\n const n = file.nodes[index];\n if (!n) return [0, 0];\n if (n.isTerminal) return [n.effectiveStatus === \"implemented\" ? 1 : 0, 1];\n let done = 0;\n let total = 0;\n file.nodes.forEach((c, j) => {\n if (c.parent !== index) return;\n const [d, t] = progress(j);\n done += d;\n total += t;\n });\n return [done, total];\n };\n let fileDone = 0;\n let fileTotal = 0;\n file.nodes.forEach((n, i) => {\n const [done, total] = progress(i);\n const node = b.nodes.get(ids[i] as string);\n if (node) node.attrs = { ...node.attrs, done, total };\n if (n.parent === undefined) {\n fileDone += done;\n fileTotal += total;\n }\n });\n if (fileNode) fileNode.attrs = { ...fileNode.attrs, done: fileDone, total: fileTotal };\n for (const spec of intentFileSpecs(file.meta)) {\n const path = resolveSpecPath(file.path, spec);\n if (b.nodes.has(`doc:${path}`)) b.edge(fileId, `doc:${path}`, \"spec\", 1);\n }\n }\n\n // ------------------------------------------------------- links between docs\n for (const path of docFiles) {\n for (const { url, line } of readLinks(texts.get(path) ?? \"\")) {\n if (isExternalOrAnchor(url) || stripFragment(url) === \"\") continue;\n const target = linkTarget(b, repoRoot, path, url);\n if (target) b.edge(`doc:${path}`, target, \"links-to\", line);\n }\n }\n\n // ----------------------------------------------------- skills and commands\n const packageDir = opts.packageDir ?? defaultPackageDir();\n const shipped = existsSync(join(packageDir, \"skills\"))\n ? loadHarness(packageDir)\n : { skills: [], cmds: [] };\n const overridesParent = manifest?.overridesDir ? join(repoRoot, manifest.overridesDir) : repoRoot;\n const overrides = loadOverrides(overridesParent);\n const disabled = new Set(overrides?.disable ?? []);\n const skillLayers: Array<\n [ReturnType<typeof loadProjectSkills>, \"shipped\" | \"project\" | \"override\"]\n > = [\n [[...shipped.skills], \"shipped\"],\n [loadProjectSkills(repoRoot), \"project\"],\n [[...(overrides?.add?.skills ?? [])], \"override\"],\n ];\n for (const [skills, layer] of skillLayers) {\n for (const skill of skills) {\n const id = `skill:${skill.meta.id}`;\n const replaced = b.nodes.get(id);\n if (replaced) b.nodes.delete(id);\n const relSource =\n layer === \"shipped\"\n ? HARNESS_SOURCE\n : relative(repoRoot, skill.sourcePath).split(\"\\\\\").join(\"/\");\n b.add({\n id,\n type: \"skill\",\n domain: layer === \"shipped\" ? \"harness\" : layer === \"project\" ? \"project\" : \"local\",\n title: skill.meta.id,\n sourcePath: relSource,\n line: layer === \"shipped\" ? 0 : 1,\n attrs: {\n layer,\n replaces: replaced ? (replaced.attrs.layer as string) : undefined,\n disabled: disabled.has(skill.meta.id) || undefined,\n description: truncate(skill.meta.description, 400),\n tags: skill.meta.tags ? [...skill.meta.tags] : undefined,\n requires: skill.meta.requires ? [...skill.meta.requires] : undefined,\n engines: skill.meta.engines ? [...skill.meta.engines] : undefined,\n lines: skill.body.split(\"\\n\").length,\n },\n });\n }\n }\n const cmdLayers: Array<[ReadonlyArray<(typeof shipped.cmds)[number]>, \"shipped\" | \"override\"]> = [\n [shipped.cmds, \"shipped\"],\n [overrides?.add?.cmds ?? [], \"override\"],\n ];\n const triggerToSkill = new Map<string, string>();\n for (const [cmds, layer] of cmdLayers) {\n for (const cmd of cmds) {\n const id = `cmd:${cmd.meta.id}`;\n b.nodes.delete(id);\n b.add({\n id,\n type: \"command\",\n domain: layer === \"shipped\" ? \"harness\" : \"local\",\n title: cmd.meta.trigger,\n sourcePath: layer === \"shipped\" ? HARNESS_SOURCE : relative(repoRoot, cmd.sourcePath),\n line: 0,\n attrs: {\n layer,\n skill: cmd.meta.invokes_skill,\n description: truncate(cmd.meta.description),\n },\n });\n triggerToSkill.set(cmd.meta.trigger, `skill:${cmd.meta.invokes_skill}`);\n b.edge(id, `skill:${cmd.meta.invokes_skill}`, \"invokes\", 0);\n }\n }\n\n // ------------------------------------------------------- rendered files\n for (const path of [...rendered].sort()) {\n b.add({\n id: `rendered:${path}`,\n type: \"rendered-file\",\n domain: \"project\",\n title: path,\n sourcePath: path,\n line: 1,\n attrs: {\n engine: engineOf(path),\n preserved: manifest?.preservedFiles?.includes(path) || undefined,\n },\n });\n const skillDir = RENDERED_SKILL_DIRS.find((d) => path.startsWith(`${d}/`));\n if (skillDir) {\n const skillId = path.slice(skillDir.length + 1).split(\"/\")[0];\n if (skillId) b.edge(`skill:${skillId}`, `rendered:${path}`, \"renders-to\", 0);\n }\n const cmdDir = RENDERED_COMMAND_DIRS.find((d) => path.startsWith(`${d}/`));\n if (cmdDir) b.edge(`cmd:${basename(path, \".md\")}`, `rendered:${path}`, \"renders-to\", 0);\n }\n\n // -------------------------------------------------------------- linters\n for (const linter of ALL_LINTERS) {\n const id = `linter:${linter.id.replace(/^lint:/, \"\")}`;\n b.add({\n id,\n type: \"linter\",\n domain: \"harness\",\n title: linter.id,\n sourcePath: HARNESS_SOURCE,\n line: 0,\n attrs: {\n pillars: [...linter.pillars],\n severity: linter.defaultSeverity,\n suggests: linter.suggestedSkills?.length ? [...linter.suggestedSkills] : undefined,\n },\n });\n for (const trigger of linter.suggestedSkills ?? []) {\n const skill = triggerToSkill.get(trigger);\n if (skill) b.edge(id, skill, \"suggests\", 0);\n }\n for (const pillar of linter.pillars) {\n for (const prefix of PILLAR_PATHS[pillar] ?? []) {\n for (const path of docFiles) {\n if (path === prefix || (prefix.endsWith(\"/\") && path.startsWith(prefix))) {\n b.edge(id, `doc:${path}`, \"checks\", 0);\n }\n }\n }\n }\n }\n\n // --------------------------------------------------------------- lessons\n const lessonsPath = join(repoRoot, LESSONS_FILE);\n if (existsSync(lessonsPath)) {\n try {\n const lessons = JSON.parse(readFileSync(lessonsPath, \"utf8\")) as unknown;\n if (Array.isArray(lessons)) {\n for (const raw of lessons) {\n if (!raw || typeof raw !== \"object\") continue;\n const l = raw as Record<string, unknown>;\n if (typeof l.id !== \"string\" || typeof l.rule !== \"string\") continue;\n b.add({\n id: `lesson:${l.id}`,\n type: \"lesson\",\n domain: \"local\",\n title: l.rule,\n sourcePath: LESSONS_FILE,\n line: 0,\n attrs: JSON.parse(\n JSON.stringify({\n status: typeof l.status === \"string\" ? l.status : \"proposed\",\n domain: l.domain,\n pillar: l.pillar,\n seen: typeof l.seen === \"number\" ? l.seen : undefined,\n evidence: Array.isArray(l.evidence)\n ? l.evidence.map((e) => (typeof e === \"string\" ? e : JSON.stringify(e)))\n : undefined,\n }),\n ) as Record<string, AttrValue>,\n });\n }\n }\n } catch {\n // A broken local file is not the graph's concern.\n }\n }\n\n // ----------------------------------------------------------------- lint\n const ran = opts.report !== undefined || opts.lint !== false;\n const report = opts.report ?? (opts.lint === false ? undefined : runLinters(repoRoot));\n const unattached: LintIssue[] = [];\n const byFile = new Map<string, GraphNode[]>();\n for (const node of b.nodes.values()) {\n if (node.domain === \"harness\" || (node.line === 0 && node.type !== \"path\")) continue;\n const list = byFile.get(node.sourcePath) ?? [];\n list.push(node);\n byFile.set(node.sourcePath, list);\n }\n for (const issue of report?.issues ?? []) {\n const candidates = byFile.get(issue.file) ?? [];\n const fileNode = b.nodes.get(`doc:${issue.file}`) ?? b.nodes.get(`rendered:${issue.file}`);\n let target: GraphNode | undefined;\n if (issue.line !== undefined) {\n for (const n of candidates) {\n if (n.line <= issue.line && (!target || n.line > target.line)) target = n;\n }\n }\n target = target ?? fileNode;\n if (target) target.issues.push(issue);\n else unattached.push(issue);\n const linter = b.nodes.get(`linter:${issue.linter.replace(/^lint:/, \"\")}`);\n if (linter)\n linter.attrs = { ...linter.attrs, issues: ((linter.attrs.issues as number) ?? 0) + 1 };\n }\n\n // ----------------------------------------------------------------- drift\n for (const node of b.nodes.values()) {\n if (\n node.type !== \"handbook\" &&\n node.type !== \"test-plan\" &&\n node.type !== \"workflow\" &&\n node.type !== \"intent-file\"\n )\n continue;\n const drift = driftOf(repoRoot, node.sourcePath);\n if (drift)\n node.attrs = { ...node.attrs, drift: { commits: drift.commits, threshold: drift.threshold } };\n }\n\n const nodes = [...b.nodes.values()].sort((x, y) => (x.id < y.id ? -1 : x.id > y.id ? 1 : 0));\n const known = new Set(nodes.map((n) => n.id));\n const edges = [...b.edges.values()]\n .filter((e) => known.has(e.from) && known.has(e.to))\n .sort((x, y) =>\n x.from !== y.from\n ? x.from < y.from\n ? -1\n : 1\n : x.type !== y.type\n ? x.type < y.type\n ? -1\n : 1\n : x.to < y.to\n ? -1\n : x.to > y.to\n ? 1\n : 0,\n );\n return {\n version: 1,\n harness: VERSION,\n nodes,\n edges,\n lint: {\n ran,\n errors: report?.summary.errors ?? 0,\n warnings: report?.summary.warnings ?? 0,\n unattached,\n },\n };\n}\n\n/** A vocabulary term, or a node marking an entity no spec defines. */\nfunction termId(b: Builder, entity: string, file: string, line: number): string {\n const id = `term:${entity}`;\n if (!b.nodes.has(id)) {\n b.add({\n id,\n type: \"term\",\n domain: \"project\",\n title: entity,\n sourcePath: file,\n line,\n attrs: { defined: false },\n });\n }\n return id;\n}\n\n/** The graph as written to `.vaubaan/graph.json`. */\nexport function serializeGraph(graph: ContextGraph): string {\n return `${JSON.stringify(graph, null, 2)}\\n`;\n}\n\nexport const GRAPH_PATH = posix.join(\".vaubaan\", \"graph.json\");\n","import { createHash } from \"node:crypto\";\nimport { chmodSync, existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { z } from \"zod\";\nimport type { Engine } from \"../types.js\";\nimport { VERSION } from \"../version.js\";\nimport { assertManagedPaths } from \"./managed-paths.js\";\n\nexport const MANIFEST_FILENAME = \".harness-manifest.json\";\nexport const MANIFEST_VERSION = \"6\";\n\n// Fields written by 1.x and dropped on read as unknown keys: the entry\n// ownership of shared files (`hookConfigs`, `opencodeConfig`, `mcpConfig`)\n// and the Stop hook preference (`stopHookInstalled`, `stopHookEngines`).\n// Decisions: safe-init, lint-in-ci-and-pre-commit.\nconst ManifestSchema = z.object({\n version: z.enum([\"4\", \"5\", MANIFEST_VERSION]),\n engines: z.array(z.string()),\n renderedAt: z.string(),\n files: z.array(z.string()),\n harnessVersion: z.string().optional(),\n overridesDir: z.string().optional(),\n fileHashes: z.record(z.string().regex(/^[a-f0-9]{64}$/)).optional(),\n preservedFiles: z.array(z.string()).optional(),\n});\n\nexport type Manifest = z.infer<typeof ManifestSchema>;\n\nexport interface WriteManifestExtras {\n overridesDir?: string;\n preservedFiles?: string[];\n}\n\nexport function manifestPath(targetDir: string): string {\n return join(targetDir, MANIFEST_FILENAME);\n}\n\nexport function writeManifest(\n targetDir: string,\n engines: ReadonlyArray<Engine>,\n files: string[],\n extras: WriteManifestExtras = {},\n): void {\n assertManagedPaths(targetDir, [MANIFEST_FILENAME]);\n const manifest: Manifest = {\n version: MANIFEST_VERSION,\n harnessVersion: VERSION,\n engines: [...engines].sort(),\n renderedAt: new Date().toISOString(),\n files: [...files].sort(),\n fileHashes: Object.fromEntries(\n files\n .filter((file) => existsSync(join(targetDir, file)))\n .sort()\n .map((file) => [file, hashContent(readFileSync(join(targetDir, file)))]),\n ),\n ...(extras.overridesDir ? { overridesDir: extras.overridesDir } : {}),\n ...(extras.preservedFiles ? { preservedFiles: extras.preservedFiles } : {}),\n };\n const path = manifestPath(targetDir);\n if (existsSync(path)) chmodSync(path, 0o600);\n writeFileSync(path, `${JSON.stringify(manifest, null, 2)}\\n`, { mode: 0o600 });\n}\n\nexport function hashContent(content: string | Buffer): string {\n return createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nexport function readManifest(targetDir: string): Manifest | null {\n assertManagedPaths(targetDir, [MANIFEST_FILENAME]);\n const path = manifestPath(targetDir);\n if (!existsSync(path)) return null;\n const raw = JSON.parse(readFileSync(path, \"utf8\"));\n return ManifestSchema.parse(raw);\n}\n","export const VERSION = \"3.0.0\";\n","import { lstatSync, realpathSync, statSync } from \"node:fs\";\nimport { basename, dirname, isAbsolute, join, resolve, win32 } from \"node:path\";\n\nconst MANAGED_FILES = new Set([\n \"AGENTS.md\",\n \"CLAUDE.md\",\n \".harness-manifest.json\",\n // Indexes of the intents and profiles pillars, rendered while the pillar is active.\n \"docs/intents/README.md\",\n \"docs/profiles/README.md\",\n // Its 2.2 location, kept managed so `update` can remove it (see MOVED_PATHS).\n \"docs/journeys/README.md\",\n]);\n\n/**\n * Generated files whose path changed. A manifest entry at the old path\n * follows the file to its new path once the project moved it; while the\n * file still sits at the old path, `update` removes it there.\n */\n/**\n * 3.0: every shipped skill and command id carries the `harn-` prefix, so a\n * project's own `/spec` or `spec-writer` never collides with the harness's.\n * A project skill, an override or a `disable.yaml` entry still naming an old\n * id no longer replaces or disables anything: `update` warns.\n */\nexport const RENAMED_IDS: ReadonlyMap<string, string> = new Map([\n [\"canvas-review\", \"harn-canvas-review\"],\n [\"decision-record-writer\", \"harn-decision-record-writer\"],\n [\"doc-audit\", \"harn-doc-audit\"],\n [\"drift-detector\", \"harn-drift-detector\"],\n [\"handbook-writer\", \"harn-handbook-writer\"],\n [\"harness-guide\", \"harn-guide\"],\n [\"harness-upgrade\", \"harn-upgrade\"],\n [\"intent-writer\", \"harn-intent-writer\"],\n [\"lesson-miner\", \"harn-self-improve\"],\n [\"readme-writer\", \"harn-readme-writer\"],\n [\"spec-writer\", \"harn-spec-writer\"],\n [\"test-plan-writer\", \"harn-test-plan-writer\"],\n [\"workflow-writer\", \"harn-workflow-writer\"],\n [\"canvas\", \"harn-canvas\"],\n [\"decision\", \"harn-decision\"],\n [\"drift\", \"harn-drift\"],\n [\"handbook\", \"harn-handbook\"],\n [\"intent\", \"harn-intent\"],\n [\"lessons\", \"harn-improve\"],\n [\"readme\", \"harn-readme\"],\n [\"spec\", \"harn-spec\"],\n [\"test-plan\", \"harn-test-plan\"],\n [\"workflow\", \"harn-workflow\"],\n]);\n\nexport const MOVED_PATHS: ReadonlyMap<string, string> = new Map([\n // 2.3: the journeys pillar became the intents pillar.\n [\"docs/journeys/README.md\", \"docs/intents/README.md\"],\n]);\n\n/**\n * Files 1.x wrote or edited and 2.0 never touches again: MCP configurations\n * and engine settings holding the Stop hook. A manifest that still lists one\n * drops it with a warning; the file stays in place as the project's.\n */\nexport const RELEASED_PATHS: ReadonlyArray<string> = [\n \".mcp.json\",\n \".codex/config.toml\",\n \".opencode/opencode.json\",\n \".opencode/mcp.json\",\n \".claude/settings.json\",\n \".codex/hooks.json\",\n];\n\n// Includes legacy layouts so upgrades can remove their generated artifacts.\nconst MANAGED_DIRECTORIES = [\n \".claude/agents/\",\n \".claude/commands/\",\n \".claude/skills/\",\n \".codex/agents/\",\n \".codex/commands/\",\n \".codex/skills/\",\n \".agents/skills/\",\n \".opencode/agents/\",\n \".opencode/commands/\",\n \".opencode/skills/\",\n \".opencode/plugins/\",\n];\n\nfunction canonicalTargetRoot(root: string): string {\n let ancestor = resolve(root);\n const missing: string[] = [];\n while (!lstatSync(ancestor, { throwIfNoEntry: false })) {\n missing.unshift(basename(ancestor));\n ancestor = dirname(ancestor);\n }\n const canonical = realpathSync(ancestor);\n if (!statSync(canonical).isDirectory()) {\n throw new Error(`harness target is not a directory: ${root}`);\n }\n return join(canonical, ...missing);\n}\n\nfunction assertManagedLocation(path: string): void {\n const invalidSegment = path\n .split(\"/\")\n .some((part) => part === \"\" || part === \".\" || part === \"..\");\n if (\n isAbsolute(path) ||\n win32.isAbsolute(path) ||\n path.includes(\"\\\\\") ||\n path.includes(\"\\0\") ||\n invalidSegment\n ) {\n throw new Error(`unsafe harness path: ${path}`);\n }\n if (!MANAGED_FILES.has(path) && !MANAGED_DIRECTORIES.some((prefix) => path.startsWith(prefix))) {\n throw new Error(`path is outside harness-managed locations: ${path}`);\n }\n}\n\nfunction assertNoSymbolicComponents(root: string, path: string): void {\n const parts = path.split(\"/\");\n let current = root;\n for (const [index, part] of parts.entries()) {\n current = join(current, part);\n const info = lstatSync(current, { throwIfNoEntry: false });\n if (!info) return;\n if (info.isSymbolicLink()) {\n throw new Error(`symbolic link in harness path: ${path}`);\n }\n const isLeaf = index === parts.length - 1;\n if (isLeaf ? !info.isFile() : !info.isDirectory()) {\n throw new Error(`unexpected file type in harness path: ${path}`);\n }\n }\n}\n\n/**\n * Preflight the complete list before callers mutate any artifact. The target\n * itself may resolve through a symlink; every component below it, including\n * leaf files and the manifest, must be a regular file or directory, never a\n * symlink (even one pointing inside the target). Missing targets are allowed.\n * This checks the current filesystem, not concurrent changes by other processes.\n */\nexport function assertManagedPaths(root: string, files: ReadonlyArray<string>): void {\n for (const path of files) assertManagedLocation(path);\n const canonicalRoot = canonicalTargetRoot(root);\n for (const path of files) assertNoSymbolicComponents(canonicalRoot, path);\n}\n","import { existsSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { loadHarness, loadOverrides, loadProjectSkills } from \"../loader.js\";\nimport { loadIntentFiles } from \"../parser/intent.js\";\nimport { readProfileFiles } from \"../parser/profile.js\";\nimport { activePillars } from \"../pillars.js\";\nimport { type RenderOutput, render } from \"../render.js\";\nimport { ENGINES, type Engine } from \"../types.js\";\n\nexport interface RenderPlanArgs {\n targetDir: string;\n engines: ReadonlyArray<string>;\n overridesDir?: string;\n packageDir?: string;\n}\n\n/**\n * The engine choice is mandatory: nothing is rendered for a tool the project\n * does not use (docs/spec/coding-agent-harness.md §8).\n */\nexport function resolveEngineList(requested: ReadonlyArray<string> | undefined): Engine[] {\n if (!requested || requested.length === 0) {\n throw new Error(\n `no engine selected: pass --engines=<list> with one or more of ${ENGINES.join(\", \")}`,\n );\n }\n const engines = requested.map((e) => {\n if (!ENGINES.includes(e as Engine)) {\n throw new Error(`unknown engine: ${e} (expected one of ${ENGINES.join(\", \")})`);\n }\n return e as Engine;\n });\n return [...new Set(engines)];\n}\n\n/**\n * Resolves the harness package's bundled content directory. The harness\n * tsup config emits this module into every entry that needs it\n * (`dist/init.js`, `dist/cli/index.js`, `dist/linters/index.js`). The\n * content (`skills/`, `commands/`, `templates/`) always sits at `dist/`:\n * same dir as `dist/init.js`, parent of `dist/cli/index.js` and\n * `dist/linters/index.js`. In dev (`src/cli/plan-render.ts`) the content\n * also sits at `src/`. We disambiguate by checking which ancestor contains\n * `skills/`.\n */\nexport function defaultPackageDir(): string {\n const here = dirname(fileURLToPath(import.meta.url));\n if (existsSync(join(here, \"skills\"))) return here;\n return resolve(here, \"..\");\n}\n\nexport function planInit(args: RenderPlanArgs): { engines: Engine[]; output: RenderOutput } {\n const engines = resolveEngineList(args.engines);\n const packageDir = args.packageDir ?? defaultPackageDir();\n const harness = loadHarness(packageDir);\n const overrides = args.overridesDir ? loadOverrides(args.overridesDir) : undefined;\n const projectSkills = loadProjectSkills(args.targetDir);\n // The tree is the switch: a pillar is active when its folder exists (spec §9.1.2).\n const active = activePillars(args.targetDir);\n const output = render({\n harness,\n engines,\n overrides,\n projectSkills,\n activePillars: active,\n ...(active.has(\"intents\") ? { intentFiles: loadIntentFiles(args.targetDir) } : {}),\n ...(active.has(\"profiles\") ? { profileFiles: readProfileFiles(args.targetDir) } : {}),\n });\n return { engines, output };\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport fg from \"fast-glob\";\nimport { z } from \"zod\";\nimport { parseCmd } from \"./parser/cmd.js\";\nimport { type Skill, parseSkill } from \"./parser/skill.js\";\nimport type { Harness, HarnessOverrides } from \"./render.js\";\nimport { parseYAML } from \"./util/yaml.js\";\n\nexport const DisableYamlSchema = z\n .object({ disable: z.array(z.string()).optional() })\n .passthrough();\n\nexport interface LoadOptions {\n skillsDir?: string;\n commandsDir?: string;\n}\n\nexport function loadHarness(packageDir: string, opts: LoadOptions = {}): Harness {\n const skillsDir = opts.skillsDir ?? join(packageDir, \"skills\");\n const commandsDir = opts.commandsDir ?? join(packageDir, \"commands\");\n\n const skillFiles = fg.sync(\"*.skill.md\", { cwd: skillsDir, absolute: true });\n const cmdFiles = fg.sync(\"*.cmd.md\", { cwd: commandsDir, absolute: true });\n\n return {\n skills: skillFiles.map((f) => parseSkill(f, readFileSync(f, \"utf8\"))),\n cmds: cmdFiles.map((f) => parseCmd(f, readFileSync(f, \"utf8\"))),\n };\n}\n\nexport function loadProjectSkills(targetDir: string): Skill[] {\n const skillsDir = join(targetDir, \"docs\", \"skills\");\n if (!existsSync(skillsDir)) return [];\n const skillFiles = fg.sync(\"*.skill.md\", { cwd: skillsDir, absolute: true });\n return skillFiles.map((f) => parseSkill(f, readFileSync(f, \"utf8\")));\n}\n\nexport function loadOverrides(worktreeDir: string): HarnessOverrides | undefined {\n const overridesDir = join(worktreeDir, \".harness-overrides\");\n if (!existsSync(overridesDir)) return undefined;\n\n const added = loadHarness(overridesDir, {\n skillsDir: join(overridesDir, \"skills\"),\n commandsDir: join(overridesDir, \"commands\"),\n });\n\n const disablePath = join(overridesDir, \"disable.yaml\");\n let disable: string[] = [];\n if (existsSync(disablePath)) {\n try {\n const parsed = DisableYamlSchema.safeParse(parseYAML(readFileSync(disablePath, \"utf8\")));\n if (parsed.success && parsed.data.disable) {\n disable = parsed.data.disable;\n }\n } catch {\n // corrupt YAML — leave disable as []\n }\n }\n\n return { add: added, disable };\n}\n","import { readFileSync } from \"node:fs\";\nimport matter from \"gray-matter\";\nimport type { z } from \"zod\";\nimport { ParseError } from \"./schemas.js\";\n\nexport interface ParsedFile<T> {\n meta: T;\n body: string;\n sourcePath: string;\n}\n\nexport function parseWithSchema<T extends z.ZodTypeAny>(\n filePath: string,\n source: string,\n schema: T,\n): ParsedFile<z.infer<T>> {\n const parsed = matter(source);\n const result = schema.safeParse(parsed.data);\n if (!result.success) {\n throw new ParseError(filePath, result.error.issues);\n }\n return {\n meta: result.data,\n body: parsed.content.trim(),\n sourcePath: filePath,\n };\n}\n\nexport function parseFileWithSchema<T extends z.ZodTypeAny>(\n filePath: string,\n schema: T,\n): ParsedFile<z.infer<T>> {\n const source = readFileSync(filePath, \"utf8\");\n return parseWithSchema(filePath, source, schema);\n}\n","import { z } from \"zod\";\nimport { PILLAR_IDS } from \"../pillars.js\";\nimport { CAPABILITIES, ENGINES } from \"../types.js\";\n\nconst IdSchema = z\n .string()\n .min(1)\n .regex(/^[a-z][a-z0-9-]*$/, \"id must be kebab-case (lowercase + digits + hyphens)\");\n\nconst SkillFrontmatterSchema = z\n .object({\n id: IdSchema,\n description: z.string().min(1),\n engines: z.array(z.enum(ENGINES)).min(1).optional(),\n requires: z.array(z.enum(CAPABILITIES)).optional(),\n /** Rendered while one of these pillars is active; omitted = always. */\n pillars: z.array(z.enum(PILLAR_IDS)).min(1).optional(),\n tags: z.array(z.string()).optional(),\n })\n .strict();\n\nexport type SkillFrontmatter = z.infer<typeof SkillFrontmatterSchema>;\n\nconst CmdArgEnumSchema = z\n .object({\n name: z.string().min(1),\n type: z.literal(\"enum\"),\n values: z.array(z.string()).min(1),\n default: z.string().optional(),\n /** False when the command runs without the argument. Defaults to true. */\n required: z.boolean().optional(),\n })\n .strict();\n\nconst CmdArgStringSchema = z\n .object({\n name: z.string().min(1),\n type: z.literal(\"string\"),\n default: z.string().optional(),\n /** False when the command runs without the argument. Defaults to true. */\n required: z.boolean().optional(),\n })\n .strict();\n\nconst CmdArgSchema = z.discriminatedUnion(\"type\", [CmdArgEnumSchema, CmdArgStringSchema]);\n\nexport type CmdArg = z.infer<typeof CmdArgSchema>;\n\nconst CmdFrontmatterSchema = z\n .object({\n id: IdSchema,\n trigger: z.string().regex(/^\\/[a-z][a-z0-9-]*$/, \"trigger must be /kebab-case\"),\n invokes_skill: IdSchema,\n args: z.array(CmdArgSchema).optional(),\n description: z.string().min(1),\n })\n .strict();\n\nexport type CmdFrontmatter = z.infer<typeof CmdFrontmatterSchema>;\n\nexport const INTENT_STATUSES = [\"proposed\", \"implemented\", \"deprecated\"] as const;\nexport type IntentStatus = (typeof INTENT_STATUSES)[number];\n\n// gray-matter parses a bare YAML date (`2026-11-09`) into a Date object.\nconst IntentFrontmatterSchema = z\n .object({\n title: z.string().min(1),\n status: z.enum(INTENT_STATUSES),\n actors: z.array(z.string().min(1)).min(1),\n spec: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),\n last_reviewed: z.union([z.date(), z.string().min(1)]),\n })\n .strict();\n\nexport type IntentFrontmatter = z.infer<typeof IntentFrontmatterSchema>;\n\nexport const PROFILE_STATUSES = [\"hypothesis\", \"validated\"] as const;\nexport type ProfileStatus = (typeof PROFILE_STATUSES)[number];\n\nconst ProfileFrontmatterSchema = z\n .object({\n title: z.string().min(1),\n status: z.enum(PROFILE_STATUSES),\n evidence: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).optional(),\n last_reviewed: z.union([z.date(), z.string().min(1)]),\n })\n .strict();\n\nexport type ProfileFrontmatter = z.infer<typeof ProfileFrontmatterSchema>;\n\nexport const Schemas = {\n Skill: SkillFrontmatterSchema,\n Cmd: CmdFrontmatterSchema,\n Intent: IntentFrontmatterSchema,\n Profile: ProfileFrontmatterSchema,\n} as const;\n\nexport class ParseError extends Error {\n constructor(\n public readonly file: string,\n public readonly issues: z.ZodIssue[],\n ) {\n const messages = issues\n .map((i) => ` - ${i.path.join(\".\") || \"<root>\"}: ${i.message}`)\n .join(\"\\n\");\n super(`Frontmatter validation failed for ${file}:\\n${messages}`);\n this.name = \"ParseError\";\n }\n}\n","import { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/**\n * The pillars of the meta database (docs/spec/coding-agent-harness.md\n * §9.1.2). README and spec are the core, always active; every other pillar\n * is active when its folder under `docs/` exists\n * (docs/decisions/pillars-on-demand.md).\n */\nexport const PILLAR_IDS = [\n \"readme\",\n \"spec\",\n \"decisions\",\n \"handbook\",\n \"tests\",\n \"workflow\",\n \"quality\",\n \"skills\",\n \"intents\",\n \"profiles\",\n] as const;\nexport type PillarId = (typeof PILLAR_IDS)[number];\n\nexport interface StarterFile {\n /** Template under the package's `templates/`. */\n template: string;\n /** Destination from the repo root. */\n path: string;\n}\n\nexport interface Pillar {\n id: PillarId;\n /** Folder from the repo root; the README pillar has none. */\n dir?: string;\n /** Always active: its absence never deactivates anything. */\n core: boolean;\n /** Written by `add`, never over an existing file. Absent: `add` does not apply. */\n starters?: ReadonlyArray<StarterFile>;\n /** What to do once the pillar is added. */\n next?: string;\n}\n\nexport const PILLARS: ReadonlyArray<Pillar> = [\n { id: \"readme\", core: true },\n { id: \"spec\", dir: \"docs/spec\", core: true },\n {\n id: \"decisions\",\n dir: \"docs/decisions\",\n core: false,\n starters: [{ template: \"decisions-index.md.tmpl\", path: \"docs/decisions/README.md\" }],\n next: \"write the first decision with the `harn-decision-record-writer` skill (`/harn-decision`)\",\n },\n {\n id: \"handbook\",\n dir: \"docs/handbook\",\n core: false,\n starters: [{ template: \"handbook-index.md.tmpl\", path: \"docs/handbook/README.md\" }],\n next: \"write the first handbook with the `harn-handbook-writer` skill (`/harn-handbook`)\",\n },\n {\n id: \"tests\",\n dir: \"docs/tests\",\n core: false,\n starters: [\n { template: \"integration-tests.md.tmpl\", path: \"docs/tests/integration-tests.md\" },\n { template: \"e2e-tests.md.tmpl\", path: \"docs/tests/e2e-tests.md\" },\n ],\n next: \"fill both test plans with the `harn-test-plan-writer` skill (`/harn-test-plan`); the lint fails on their placeholders until then\",\n },\n {\n id: \"workflow\",\n dir: \"docs/workflow\",\n core: false,\n starters: [{ template: \"coding-workflow.md.tmpl\", path: \"docs/workflow/coding-workflow.md\" }],\n next: \"fill the workflow with the `harn-workflow-writer` skill (`/harn-workflow`); the lint fails on its placeholders until then\",\n },\n {\n id: \"quality\",\n dir: \"docs/quality\",\n core: false,\n starters: [{ template: \"code-quality.md.tmpl\", path: \"docs/quality/code-quality.md\" }],\n next: \"fill docs/quality/code-quality.md by hand: the tools, the project's rules, the accepted deviations\",\n },\n // Active as soon as it holds a `*.skill.md`: nothing to add.\n { id: \"skills\", dir: \"docs/skills\", core: false },\n {\n id: \"intents\",\n dir: \"docs/intents\",\n core: false,\n starters: [],\n next: \"write the first intent with the `harn-intent-writer` skill (`/harn-intent <verb + object>`)\",\n },\n {\n id: \"profiles\",\n dir: \"docs/profiles\",\n core: false,\n starters: [],\n next: \"describe the first profile with the `harn-intent-writer` skill, from the research you point it to\",\n },\n];\n\n/** The pillars `add` accepts. */\nexport const ADDABLE_PILLARS: ReadonlyArray<Pillar> = PILLARS.filter(\n (pillar) => pillar.starters !== undefined,\n);\n\nexport function getPillar(id: string): Pillar | undefined {\n return PILLARS.find((pillar) => pillar.id === id);\n}\n\nfunction isDirectory(path: string): boolean {\n return existsSync(path) && statSync(path).isDirectory();\n}\n\n/** A pillar is active when it is core or when its folder exists. */\nexport function isPillarActive(repoRoot: string, id: PillarId): boolean {\n const pillar = getPillar(id);\n if (!pillar) return false;\n if (pillar.core) return true;\n return pillar.dir !== undefined && isDirectory(join(repoRoot, pillar.dir));\n}\n\nexport function activePillars(repoRoot: string): Set<PillarId> {\n return new Set(PILLARS.filter((p) => isPillarActive(repoRoot, p.id)).map((p) => p.id));\n}\n\n/** Every pillar: what a preview render shows, with no project to read. */\nexport function allPillars(): Set<PillarId> {\n return new Set(PILLAR_IDS);\n}\n\n/**\n * Pillar folders that exist and hold no file at any depth. Git does not\n * record them, so the pillar would be active on one machine only.\n */\nexport function emptyPillarDirs(repoRoot: string): string[] {\n const holdsFile = (dir: string): boolean =>\n readdirSync(dir, { withFileTypes: true }).some((entry) =>\n entry.isDirectory() ? holdsFile(join(dir, entry.name)) : true,\n );\n return PILLARS.flatMap((pillar) => {\n if (!pillar.dir) return [];\n const full = join(repoRoot, pillar.dir);\n return isDirectory(full) && !holdsFile(full) ? [pillar.dir] : [];\n });\n}\n","export const ENGINES = [\"claude-code\", \"codex-cli\", \"opencode\"] as const;\nexport type Engine = (typeof ENGINES)[number];\n\nexport const ENGINE_ROOT_DIR: Record<Engine, string> = {\n \"claude-code\": \".claude\",\n \"codex-cli\": \".codex\",\n opencode: \".opencode\",\n};\n\nexport const CAPABILITIES = [\"multi-step\", \"slash-command\", \"inline-exec\"] as const;\nexport type Capability = (typeof CAPABILITIES)[number];\n\nexport interface RenderedFile {\n path: string;\n content: string;\n}\n\nexport interface CapabilitiesMatrix {\n [engine: string]: ReadonlyArray<Capability>;\n}\n\nexport const CAPABILITIES_MATRIX: Record<Engine, ReadonlyArray<Capability>> = {\n \"claude-code\": [\"multi-step\", \"slash-command\", \"inline-exec\"],\n \"codex-cli\": [\"multi-step\", \"slash-command\", \"inline-exec\"],\n opencode: [\"multi-step\", \"slash-command\", \"inline-exec\"],\n};\n\nexport const DEGRADED_CAPABILITIES: Partial<Record<Engine, ReadonlyArray<Capability>>> = {\n \"codex-cli\": [\"multi-step\"],\n};\n\nexport function engineSupports(engine: Engine, capability: Capability): boolean {\n return CAPABILITIES_MATRIX[engine].includes(capability);\n}\n","import { parseFileWithSchema, parseWithSchema } from \"./common.js\";\nimport type { ParsedFile } from \"./common.js\";\nimport { type CmdFrontmatter, Schemas } from \"./schemas.js\";\n\nexport type Cmd = ParsedFile<CmdFrontmatter>;\n\nexport function parseCmd(filePath: string, source: string): Cmd {\n return parseWithSchema(filePath, source, Schemas.Cmd);\n}\n\nexport function parseCmdFile(filePath: string): Cmd {\n return parseFileWithSchema(filePath, Schemas.Cmd);\n}\n","import { parseFileWithSchema, parseWithSchema } from \"./common.js\";\nimport type { ParsedFile } from \"./common.js\";\nimport { Schemas, type SkillFrontmatter } from \"./schemas.js\";\n\nexport type Skill = ParsedFile<SkillFrontmatter>;\n\nexport function parseSkill(filePath: string, source: string): Skill {\n return parseWithSchema(filePath, source, Schemas.Skill);\n}\n\nexport function parseSkillFile(filePath: string): Skill {\n return parseFileWithSchema(filePath, Schemas.Skill);\n}\n","import { parse as yamlParse } from \"yaml\";\n\nexport function parseYAML(source: string): unknown {\n return yamlParse(source);\n}\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport matter from \"gray-matter\";\nimport { INTENT_STATUSES, type IntentFrontmatter, type IntentStatus, Schemas } from \"./schemas.js\";\n\n/** The optional intents pillar (docs/spec/coding-agent-harness.md §9.1.3). */\nexport const INTENTS_DIR = \"docs/intents\";\n/** The generated index of the pillar; never an intent file. */\nexport const INTENTS_INDEX_PATH = `${INTENTS_DIR}/README.md`;\n\nexport const NODE_FIELDS = [\n \"status\",\n \"spec\",\n \"anchors\",\n \"acceptance\",\n \"requires\",\n \"creates\",\n \"relieves\",\n \"delivers\",\n] as const;\nexport type NodeField = (typeof NODE_FIELDS)[number];\n/** Fields only a terminal intent (a node with no sub-intent) may carry. */\nexport const TERMINAL_FIELDS: ReadonlyArray<NodeField> = [\n \"anchors\",\n \"acceptance\",\n \"requires\",\n \"creates\",\n \"relieves\",\n \"delivers\",\n];\n\nexport interface IntentError {\n line?: number;\n message: string;\n}\n\nexport interface IntentNode {\n title: string;\n /** Heading depth minus one: `##` is level 1. */\n level: number;\n /** 1-based line of the heading in the file. */\n line: number;\n /** Index of the parent node in `nodes`, absent for a level-1 node. */\n parent?: number;\n /** True when the node has no sub-intent: a terminal intent. */\n isTerminal: boolean;\n /** Line of each known field the node declares. */\n fieldLines: Partial<Record<NodeField, number>>;\n status?: IntentStatus;\n spec?: string;\n anchors: string[];\n acceptance: string[];\n requires: string[];\n creates: string[];\n /** Pains relieved and gains delivered: slugs of the actors' profiles (§9.1.4). */\n relieves: string[];\n delivers: string[];\n unknownFields: Array<{ key: string; line: number }>;\n /** Nearest `status:` up the tree, else the file status. */\n effectiveStatus?: IntentStatus;\n}\n\nexport interface IntentFile {\n meta?: IntentFrontmatter;\n title: string;\n statement?: string;\n nodes: IntentNode[];\n errors: IntentError[];\n}\n\nexport interface ParsedIntentFile extends IntentFile {\n /** Path from the repo root, e.g. `docs/intents/harness-a-project.md`. */\n path: string;\n /** File name, e.g. `harness-a-project.md`. */\n file: string;\n}\n\n/** Stands for a line of fenced code: not blank, not a field, not a heading. */\nconst MASKED_LINE = \"\\u0000\";\nconst FENCE_RE = /^ {0,3}(`{3,}|~{3,})/;\nconst HEADING_RE = /^(#{1,6})[ \\t]+(.+?)(?:[ \\t]+#+)?[ \\t]*$/;\nconst FIELD_RE = /^([a-z][a-z-]*):\\s*(.*)$/;\nconst LIST_ITEM_RE = /^\\s*-\\s+(.*)$/;\n\n/** Replaces every line of fenced code (fences included), keeping line numbers. */\nexport function maskFencedCode(lines: ReadonlyArray<string>): string[] {\n let fence: string | undefined;\n return lines.map((line) => {\n const m = FENCE_RE.exec(line);\n if (fence !== undefined) {\n if (m?.[1] && m[1][0] === fence[0] && m[1].length >= fence.length) fence = undefined;\n return MASKED_LINE;\n }\n if (m?.[1]) {\n fence = m[1];\n return MASKED_LINE;\n }\n return line;\n });\n}\n\nexport function parseHeading(line: string): { depth: number; title: string } | undefined {\n const m = HEADING_RE.exec(line);\n if (!m?.[1] || !m[2]) return undefined;\n return { depth: m[1].length, title: m[2] };\n}\n\nfunction splitList(value: string): string[] {\n return value\n .split(\",\")\n .map((v) => v.trim())\n .filter(Boolean);\n}\n\n/** Index of the first body line, after the frontmatter block when there is one. */\nfunction bodyStart(lines: ReadonlyArray<string>): number {\n if (lines[0]?.trim() !== \"---\") return 0;\n for (let i = 1; i < lines.length; i++) {\n const l = lines[i]?.trim();\n if (l === \"---\" || l === \"...\") return i + 1;\n }\n return lines.length;\n}\n\nfunction parseFrontmatter(text: string, errors: IntentError[]): IntentFrontmatter | undefined {\n let data: Record<string, unknown>;\n try {\n data = matter(text).data;\n } catch (error) {\n const reason = error instanceof Error ? error.message.split(\"\\n\")[0] : String(error);\n errors.push({ line: 1, message: `invalid frontmatter YAML: ${reason}` });\n return undefined;\n }\n const result = Schemas.Intent.safeParse(data);\n if (result.success) return result.data;\n for (const issue of result.error.issues) {\n const where = issue.path.length ? ` \\`${issue.path.join(\".\")}\\`` : \"\";\n errors.push({ line: 1, message: `frontmatter${where}: ${issue.message}` });\n }\n return undefined;\n}\n\nfunction newNode(title: string, level: number, line: number): IntentNode {\n return {\n title,\n level,\n line,\n isTerminal: true,\n fieldLines: {},\n anchors: [],\n acceptance: [],\n requires: [],\n creates: [],\n relieves: [],\n delivers: [],\n unknownFields: [],\n };\n}\n\n/** Reads the field block directly under a heading, up to its first non-field line. */\nfunction parseFields(\n node: IntentNode,\n lines: ReadonlyArray<string>,\n from: number,\n to: number,\n errors: IntentError[],\n): void {\n let lastKey: string | undefined;\n for (let i = from; i < to; i++) {\n const line = lines[i] ?? \"\";\n if (line.trim() === \"\") continue;\n const lineNo = i + 1;\n const field = FIELD_RE.exec(line.trimEnd());\n if (field?.[1] !== undefined) {\n const key = field[1];\n const value = (field[2] ?? \"\").trim();\n lastKey = key;\n if (!(NODE_FIELDS as ReadonlyArray<string>).includes(key)) {\n node.unknownFields.push({ key, line: lineNo });\n continue;\n }\n const known = key as NodeField;\n node.fieldLines[known] = lineNo;\n if (known === \"status\") {\n if ((INTENT_STATUSES as ReadonlyArray<string>).includes(value)) {\n node.status = value as IntentStatus;\n } else {\n errors.push({\n line: lineNo,\n message: `invalid status \\`${value}\\` (expected ${INTENT_STATUSES.join(\" | \")})`,\n });\n }\n } else if (known === \"spec\") {\n node.spec = value;\n } else if (known === \"acceptance\") {\n if (value) node.acceptance.push(value);\n } else {\n node[known] = splitList(value);\n }\n continue;\n }\n const item = LIST_ITEM_RE.exec(line);\n if (lastKey === \"acceptance\" && item) {\n const text = (item[1] ?? \"\").trim();\n if (text) node.acceptance.push(text);\n continue;\n }\n return;\n }\n}\n\n/**\n * Parses one intent file (docs/spec/coding-agent-harness.md §9.1.3). Never\n * throws: frontmatter and node problems are collected in `errors` and the\n * nodes are parsed regardless, so a linter reports everything at once.\n */\nexport function parseIntentFile(relPath: string, text: string): IntentFile {\n const errors: IntentError[] = [];\n const meta = parseFrontmatter(text, errors);\n const lines = maskFencedCode(text.split(/\\r?\\n/));\n const start = bodyStart(lines);\n\n const headings: Array<{ index: number; depth: number; title: string }> = [];\n for (let i = start; i < lines.length; i++) {\n const h = parseHeading(lines[i] ?? \"\");\n if (h) headings.push({ index: i, ...h });\n }\n\n const h1 = headings.find((h) => h.depth === 1);\n let statement: string | undefined;\n if (h1) {\n const paragraph: string[] = [];\n for (let i = h1.index + 1; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n if (line.trim() === \"\") {\n if (paragraph.length) break;\n continue;\n }\n if (line === MASKED_LINE || parseHeading(line)) break;\n paragraph.push(line.trim());\n }\n if (paragraph.length) statement = paragraph.join(\" \");\n }\n\n const nodes: IntentNode[] = [];\n const stack: number[] = [];\n for (const [k, h] of headings.entries()) {\n if (h.depth < 2) continue;\n const node = newNode(h.title, h.depth - 1, h.index + 1);\n while (stack.length) {\n const top = nodes[stack[stack.length - 1] as number];\n if (top && top.level < node.level) break;\n stack.pop();\n }\n const parentIndex = stack[stack.length - 1];\n if (parentIndex !== undefined) {\n node.parent = parentIndex;\n const parent = nodes[parentIndex];\n if (parent) parent.isTerminal = false;\n }\n const next = headings[k + 1];\n parseFields(node, lines, h.index + 1, next ? next.index : lines.length, errors);\n const inherited =\n parentIndex !== undefined ? nodes[parentIndex]?.effectiveStatus : meta?.status;\n node.effectiveStatus = node.status ?? inherited;\n stack.push(nodes.length);\n nodes.push(node);\n }\n\n const title = meta?.title ?? h1?.title ?? basename(relPath, \".md\");\n return { ...(meta ? { meta } : {}), title, ...(statement ? { statement } : {}), nodes, errors };\n}\n\n/** Intent files: `docs/intents/*.md` minus the generated index, sorted by file name. */\nexport function listIntentFiles(targetDir: string): string[] {\n const dir = join(targetDir, INTENTS_DIR);\n if (!existsSync(dir) || !statSync(dir).isDirectory()) return [];\n return readdirSync(dir)\n .filter((f) => f.endsWith(\".md\") && f !== \"README.md\")\n .filter((f) => statSync(join(dir, f)).isFile())\n .sort();\n}\n\n/** Parses every intent file without throwing; linters read their `errors`. */\nexport function readIntentFiles(targetDir: string): ParsedIntentFile[] {\n return listIntentFiles(targetDir).map((file) => {\n const path = `${INTENTS_DIR}/${file}`;\n const text = readFileSync(join(targetDir, path), \"utf8\");\n return { path, file, ...parseIntentFile(path, text) };\n });\n}\n\n/**\n * The intent files the render needs. One that does not parse fails the\n * render, like an invalid project skill: `init`, `update` and\n * `lint:generated-fresh` report it.\n */\nexport function loadIntentFiles(targetDir: string): ParsedIntentFile[] {\n const intentFiles = readIntentFiles(targetDir);\n const problems = intentFiles.flatMap((j) =>\n j.errors.map((e) => ` - ${j.path}${e.line !== undefined ? `:${e.line}` : \"\"}: ${e.message}`),\n );\n if (problems.length) {\n throw new Error(\n `invalid intents (run \\`npx @vaubaan/harness lint --pillar intents\\`):\\n${problems.join(\"\\n\")}`,\n );\n }\n return intentFiles;\n}\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport matter from \"gray-matter\";\nimport { entitySlug } from \"../linters/intent-vocabulary.js\";\nimport { maskFencedCode, parseHeading } from \"./intent.js\";\nimport { type ProfileFrontmatter, Schemas } from \"./schemas.js\";\n\n/** The profiles pillar (docs/spec/coding-agent-harness.md §9.1.4). */\nexport const PROFILES_DIR = \"docs/profiles\";\n/** The generated index of the pillar; never a profile file. */\nexport const PROFILES_INDEX_PATH = `${PROFILES_DIR}/README.md`;\n\nexport interface ProfileError {\n line?: number;\n message: string;\n}\n\n/** A pain or a gain: a bullet that opens with its name in bold. */\nexport interface ProfileItem {\n name: string;\n /** `**Context rot**` gives `context-rot`, like an entity of the spec. */\n slug: string;\n /** 1-based line of the bullet. */\n line: number;\n}\n\nexport interface ProfileFile {\n meta?: ProfileFrontmatter;\n title: string;\n /** In rank order: the first is the most severe. */\n pains: ProfileItem[];\n gains: ProfileItem[];\n errors: ProfileError[];\n}\n\nexport interface ParsedProfileFile extends ProfileFile {\n /** Path from the repo root, e.g. `docs/profiles/lead-developer.md`. */\n path: string;\n /** File name, e.g. `lead-developer.md`. */\n file: string;\n /** The profile's name wherever it is referred to: the file name without `.md`. */\n slug: string;\n}\n\n// English headings are canonical; the French ones are accepted like the\n// ADR and quality headings.\nconst PAINS_HEADING = /^(Pains|Irritants|Douleurs)\\s*$/i;\nconst GAINS_HEADING = /^(Gains|B[ée]n[ée]fices)\\s*$/i;\nconst BULLET = /^[-*]\\s+(.*)$/;\nconst NAMED = /^\\*\\*([^*]+)\\*\\*/;\n\nfunction parseFrontmatter(text: string, errors: ProfileError[]): ProfileFrontmatter | undefined {\n let data: Record<string, unknown>;\n try {\n data = matter(text).data;\n } catch (error) {\n const reason = error instanceof Error ? error.message.split(\"\\n\")[0] : String(error);\n errors.push({ line: 1, message: `invalid frontmatter YAML: ${reason}` });\n return undefined;\n }\n const result = Schemas.Profile.safeParse(data);\n if (result.success) return result.data;\n for (const issue of result.error.issues) {\n const where = issue.path.length ? ` \\`${issue.path.join(\".\")}\\`` : \"\";\n errors.push({ line: 1, message: `frontmatter${where}: ${issue.message}` });\n }\n return undefined;\n}\n\n/**\n * Parses one profile file. Never throws: problems are collected in `errors`\n * so a linter reports everything at once and the index still renders.\n */\nexport function parseProfileFile(relPath: string, text: string): ProfileFile {\n const errors: ProfileError[] = [];\n const meta = parseFrontmatter(text, errors);\n const lines = maskFencedCode(text.split(/\\r?\\n/));\n const pains: ProfileItem[] = [];\n const gains: ProfileItem[] = [];\n let h1: string | undefined;\n let current: { kind: \"pain\" | \"gain\"; depth: number; items: ProfileItem[] } | undefined;\n // Skip the frontmatter block: its `---` lines and keys are not body.\n let start = 0;\n if (lines[0]?.trim() === \"---\") {\n const end = lines.findIndex((line, i) => i > 0 && /^(---|\\.\\.\\.)\\s*$/.test(line));\n start = end < 0 ? lines.length : end + 1;\n }\n for (let i = start; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n const heading = parseHeading(line);\n if (heading) {\n if (heading.depth === 1 && h1 === undefined) h1 = heading.title;\n if (current && heading.depth > current.depth) continue;\n if (PAINS_HEADING.test(heading.title)) {\n current = { kind: \"pain\", depth: heading.depth, items: pains };\n } else if (GAINS_HEADING.test(heading.title)) {\n current = { kind: \"gain\", depth: heading.depth, items: gains };\n } else {\n current = undefined;\n }\n continue;\n }\n if (!current) continue;\n const bullet = BULLET.exec(line)?.[1];\n if (bullet === undefined) continue;\n const name = NAMED.exec(bullet)?.[1]?.trim();\n const slug = name ? entitySlug(name) : \"\";\n if (!name || !slug) {\n errors.push({ line: i + 1, message: `a ${current.kind} opens with its name in bold` });\n continue;\n }\n if (current.items.some((item) => item.slug === slug)) {\n errors.push({ line: i + 1, message: `duplicate ${current.kind} \\`${slug}\\`` });\n continue;\n }\n current.items.push({ name, slug, line: i + 1 });\n }\n if (pains.length === 0 && gains.length === 0) {\n errors.push({ message: \"a profile names at least one pain or one gain\" });\n }\n const title = meta?.title ?? h1 ?? basename(relPath, \".md\");\n return { ...(meta ? { meta } : {}), title, pains, gains, errors };\n}\n\n/** Profile files: `docs/profiles/*.md` minus the generated index, sorted by file name. */\nexport function listProfileFiles(targetDir: string): string[] {\n const dir = join(targetDir, PROFILES_DIR);\n if (!existsSync(dir) || !statSync(dir).isDirectory()) return [];\n return readdirSync(dir)\n .filter((f) => f.endsWith(\".md\") && f !== \"README.md\")\n .filter((f) => statSync(join(dir, f)).isFile())\n .sort();\n}\n\n/** Parses every profile file without throwing; linters read their `errors`. */\nexport function readProfileFiles(targetDir: string): ParsedProfileFile[] {\n return listProfileFiles(targetDir).map((file) => {\n const path = `${PROFILES_DIR}/${file}`;\n const text = readFileSync(join(targetDir, path), \"utf8\");\n return { path, file, slug: basename(file, \".md\"), ...parseProfileFile(path, text) };\n });\n}\n\n/** The frontmatter `evidence:` as a list. */\nexport function profileEvidence(meta: ProfileFrontmatter | undefined): string[] {\n if (!meta?.evidence) return [];\n return typeof meta.evidence === \"string\" ? [meta.evidence] : [...meta.evidence];\n}\n","/**\n * Readers of the doc pillars shared by the linters and the context graph\n * (docs/spec/coding-agent-harness.md §10.4): a fact the view shows comes from\n * a reader a linter uses, never from a reader of its own.\n */\nimport { maskFencedCode, parseHeading } from \"./intent.js\";\n\nexport interface Heading {\n depth: number;\n title: string;\n /** 1-based line in the file. */\n line: number;\n /** GitHub-style anchor: `10.4 View and review` gives `104-view-and-review`. */\n slug: string;\n}\n\n/** The GitHub-style anchor of a heading. */\nexport function headingSlug(title: string): string {\n return title\n .toLowerCase()\n .replace(/[`*_]/g, \"\")\n .replace(/[^\\p{L}\\p{N}\\s-]/gu, \"\")\n .trim()\n .replace(/\\s/g, \"-\");\n}\n\n/** The headings of a Markdown file, fenced code excluded. */\nexport function readHeadings(text: string): Heading[] {\n const lines = maskFencedCode(text.split(/\\r?\\n/));\n const out: Heading[] = [];\n for (const [i, line] of lines.entries()) {\n const h = parseHeading(line);\n if (h) out.push({ depth: h.depth, title: h.title, line: i + 1, slug: headingSlug(h.title) });\n }\n return out;\n}\n\n// ---------------------------------------------------------------- vocabulary\n\nconst VOCABULARY_HEADING = /^#+\\s*(\\d+(\\.\\d+)*\\.?\\s*)?(Vocabulary|Vocabulaire)\\b/i;\nconst TERM = /^\\s*[-*]\\s+\\*\\*([^*]+)\\*\\*\\s*(?:[—–:-]+\\s*)?(.*)$/;\nconst TABLE_ROW = /^\\s*\\|(.+)\\|\\s*$/;\nconst TABLE_SEPARATOR = /^\\s*\\|?\\s*:?-{3,}/;\n\n/** `**Generated file**` gives `generated-file`. */\nexport function entitySlug(term: string): string {\n return term\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nexport interface VocabularyTerm {\n term: string;\n slug: string;\n line: number;\n /** The rest of the bullet, or the second cell of the row. */\n definition: string;\n}\n\n/** A Vocabulary table row: its first cell, without emphasis; `undefined` for a header or a placeholder. */\nfunction tableTerm(line: string, next: string | undefined): [string, string] | undefined {\n const row = TABLE_ROW.exec(line)?.[1];\n if (row === undefined || TABLE_SEPARATOR.test(line)) return undefined;\n // The header row is the one right above the separator.\n if (next !== undefined && TABLE_SEPARATOR.test(next)) return undefined;\n const cells = row.split(\"|\").map((c) => c.trim());\n const cell = (cells[0] ?? \"\").replace(/[*_`]/g, \"\").trim();\n if (!cell || /^<.*>$/.test(cell)) return undefined;\n return [cell, cells[1] ?? \"\"];\n}\n\n/**\n * The terms of a spec's Vocabulary section: the bold terms opening a bullet,\n * and the first cell of each table row (the spec template's form), up to the\n * next heading of the same or a higher level. `undefined` when the spec has\n * no Vocabulary section.\n */\nexport function vocabularyTerms(specText: string): VocabularyTerm[] | undefined {\n const lines = maskFencedCode(specText.split(/\\r?\\n/));\n let depth: number | undefined;\n let terms: VocabularyTerm[] | undefined;\n for (const [i, line] of lines.entries()) {\n const heading = parseHeading(line);\n if (depth !== undefined) {\n if (heading && heading.depth <= depth) break;\n const bullet = TERM.exec(line);\n const found: [string, string] | undefined = bullet?.[1]\n ? [bullet[1], bullet[2] ?? \"\"]\n : tableTerm(line, lines[i + 1]);\n if (found) {\n const [term, definition] = found;\n terms?.push({ term: term.trim(), slug: entitySlug(term), line: i + 1, definition });\n }\n continue;\n }\n if (heading && VOCABULARY_HEADING.test(line)) {\n depth = heading.depth;\n terms = [];\n }\n }\n return terms;\n}\n\n/** The entity slugs of a spec's Vocabulary section, `undefined` without one. */\nexport function vocabularyOf(specText: string): Set<string> | undefined {\n const terms = vocabularyTerms(specText);\n return terms ? new Set(terms.map((t) => t.slug)) : undefined;\n}\n\n// --------------------------------------------------------------------- links\n\nconst LINK_REGEX = /\\[([^\\]]+)\\]\\(([^)]+)\\)/g;\n\nfunction maskCodeSpans(text: string): string {\n return text\n .replace(/```[\\s\\S]*?```/g, (m) => m.replace(/[^\\n]/g, \" \"))\n .replace(/`[^`\\n]*`/g, (m) => \" \".repeat(m.length));\n}\n\nexport interface DocLink {\n url: string;\n line: number;\n}\n\n/** Every Markdown link outside code, with its line. */\nexport function readLinks(text: string): DocLink[] {\n const lines = maskCodeSpans(text).split(\"\\n\");\n const out: DocLink[] = [];\n for (const [i, line] of lines.entries()) {\n LINK_REGEX.lastIndex = 0;\n let match = LINK_REGEX.exec(line);\n while (match !== null) {\n if (match[2]) out.push({ url: match[2], line: i + 1 });\n match = LINK_REGEX.exec(line);\n }\n }\n return out;\n}\n\n/** A link that leaves the repository or stays in the same page. */\nexport function isExternalOrAnchor(url: string): boolean {\n return /^(https?:|mailto:|#)/.test(url);\n}\n\nexport function stripFragment(url: string): string {\n const i = url.indexOf(\"#\");\n return i < 0 ? url : url.slice(0, i);\n}\n\n// ---------------------------------------------------------------------- ADRs\n\n// English headings are canonical; the French ones are still accepted so\n// projects written before the switch to English keep passing.\nexport const ADR_SECTIONS: ReadonlyArray<{ label: string; pattern: RegExp }> = [\n { label: \"Context\", pattern: /^##\\s+(Context|Contexte)\\b/m },\n { label: \"Decision\", pattern: /^##\\s+(Decision|D[ée]cision)\\b/m },\n { label: \"Consequences\", pattern: /^##\\s+(Consequences|Cons[ée]quences)\\b/m },\n {\n label: \"Rejected alternatives\",\n pattern: /^##\\s+(Rejected\\s+alternatives|Alternatives(\\s+rejet[ée]es)?)\\b/im,\n },\n];\n\nexport interface AdrDoc {\n /** Required sections the ADR lacks, by English label. */\n missing: string[];\n /** The first paragraph of the Decision section, on one line. */\n decision?: string;\n /** The `###` headings under Rejected alternatives. */\n alternatives: Array<{ title: string; line: number; text: string }>;\n}\n\nexport function readAdr(text: string): AdrDoc {\n const missing = ADR_SECTIONS.filter((s) => !s.pattern.test(text)).map((s) => s.label);\n const lines = maskFencedCode(text.split(/\\r?\\n/));\n const decisionPattern = ADR_SECTIONS[1]?.pattern;\n const alternativesPattern = ADR_SECTIONS[3]?.pattern;\n let section: \"decision\" | \"alternatives\" | undefined;\n const paragraph: string[] = [];\n let paragraphDone = false;\n const alternatives: AdrDoc[\"alternatives\"] = [];\n for (const [i, line] of lines.entries()) {\n const heading = parseHeading(line);\n if (heading && heading.depth <= 2) {\n section = decisionPattern?.test(line)\n ? \"decision\"\n : alternativesPattern?.test(line)\n ? \"alternatives\"\n : undefined;\n continue;\n }\n if (section === \"decision\" && !paragraphDone) {\n if (line.trim() === \"\") {\n if (paragraph.length) paragraphDone = true;\n } else paragraph.push(line.trim());\n }\n if (section === \"alternatives\") {\n if (heading && heading.depth === 3) {\n alternatives.push({ title: heading.title, line: i + 1, text: \"\" });\n } else if (line.trim() && alternatives.length) {\n const last = alternatives[alternatives.length - 1];\n if (last) last.text = last.text ? `${last.text} ${line.trim()}` : line.trim();\n }\n }\n }\n return {\n missing,\n ...(paragraph.length ? { decision: paragraph.join(\" \") } : {}),\n alternatives,\n };\n}\n\n// -------------------------------------------------------------- known gaps\n\nexport interface KnownGap {\n line: number;\n text: string;\n links: string[];\n}\n\nconst KNOWN_GAPS_HEADING = /^#+\\s*(\\d+(\\.\\d+)*\\.?\\s*)?(Known gaps|Lacunes connues|Trous connus)\\b/i;\n\n/** The bullets of a test plan's Known gaps section. */\nexport function readKnownGaps(text: string): KnownGap[] {\n const lines = maskFencedCode(text.split(/\\r?\\n/));\n let depth: number | undefined;\n const out: KnownGap[] = [];\n for (const [i, line] of lines.entries()) {\n const heading = parseHeading(line);\n if (depth !== undefined) {\n if (heading && heading.depth <= depth) break;\n const bullet = /^\\s*[-*]\\s+(.*)$/.exec(line);\n if (bullet?.[1]) {\n out.push({\n line: i + 1,\n text: bullet[1].trim(),\n links: readLinks(line).map((l) => l.url),\n });\n }\n continue;\n }\n if (heading && KNOWN_GAPS_HEADING.test(line)) depth = heading.depth;\n }\n return out;\n}\n\n/** The first non-empty paragraph after the H1, on one line. */\nexport function readLede(text: string): string | undefined {\n const lines = maskFencedCode(text.split(/\\r?\\n/));\n let afterTitle = false;\n const paragraph: string[] = [];\n let inFrontmatter = lines[0]?.trim() === \"---\";\n for (const [i, line] of lines.entries()) {\n if (inFrontmatter) {\n if (i > 0 && line.trim() === \"---\") inFrontmatter = false;\n continue;\n }\n const heading = parseHeading(line);\n if (!afterTitle) {\n if (heading?.depth === 1) afterTitle = true;\n continue;\n }\n if (heading) break;\n if (line.trim() === \"\" || line.startsWith(\">\") || line.startsWith(\"<!--\")) {\n if (paragraph.length) break;\n continue;\n }\n if (line === \"\\u0000\") break;\n paragraph.push(line.trim());\n }\n return paragraph.length ? paragraph.join(\" \") : undefined;\n}\n","import { posix } from \"node:path\";\nimport type { IntentFrontmatter } from \"../parser/schemas.js\";\n\n/** The frontmatter `spec:` as a list. */\nexport function intentFileSpecs(meta: IntentFrontmatter | undefined): string[] {\n if (!meta) return [];\n return typeof meta.spec === \"string\" ? [meta.spec] : [...meta.spec];\n}\n\n/** A `spec:` path, relative to the intent file, as a path from the repo root (fragment stripped). */\nexport function resolveSpecPath(filePath: string, spec: string): string {\n const withoutFragment = spec.split(\"#\")[0] ?? \"\";\n return posix.normalize(posix.join(posix.dirname(filePath), withoutFragment));\n}\n","import { execFileSync } from \"node:child_process\";\nimport { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport fg from \"fast-glob\";\nimport matter from \"gray-matter\";\n\nexport function fileExists(repoRoot: string, relativePath: string): boolean {\n return existsSync(join(repoRoot, relativePath));\n}\n\nexport function readText(repoRoot: string, relativePath: string): string {\n return readFileSync(join(repoRoot, relativePath), \"utf8\");\n}\n\n/**\n * A `tracks:` entry or an intent anchor: a path from the repo root, or a glob\n * (any `*`) that must match at least one file.\n */\nexport function trackedPathExists(repoRoot: string, pattern: string): boolean {\n if (pattern.includes(\"*\")) {\n return fg.sync(pattern, { cwd: repoRoot, absolute: false }).length > 0;\n }\n return existsSync(join(repoRoot, pattern));\n}\n\nexport function listMarkdown(repoRoot: string, dir: string): string[] {\n const cwd = join(repoRoot, dir);\n if (!existsSync(cwd)) return [];\n return fg\n .sync(\"**/*.md\", { cwd, absolute: false, ignore: [\"**/node_modules/**\", \"**/dist/**\"] })\n .filter((f) => !f.endsWith(\"README.md\"))\n .map((f) => join(dir, f));\n}\n\nexport function listAllMarkdown(repoRoot: string, dir: string): string[] {\n const cwd = join(repoRoot, dir);\n if (!existsSync(cwd)) return [];\n return fg\n .sync(\"**/*.md\", { cwd, absolute: false, ignore: [\"**/node_modules/**\", \"**/dist/**\"] })\n .map((f) => join(dir, f));\n}\n\nexport function dirExists(repoRoot: string, relativePath: string): boolean {\n const full = join(repoRoot, relativePath);\n if (!existsSync(full)) return false;\n return statSync(full).isDirectory();\n}\n\nexport function parseFrontmatter(text: string): { data: Record<string, unknown>; body: string } {\n const m = matter(text);\n return { data: m.data, body: m.content };\n}\n\nexport interface GitLogEntry {\n hash: string;\n timestamp: number;\n}\n\nexport function gitLastCommitForPath(\n repoRoot: string,\n relativePath: string,\n): GitLogEntry | undefined {\n try {\n const out = execFileSync(\"git\", [\"log\", \"-1\", \"--format=%H:%ct\", \"--\", relativePath], {\n cwd: repoRoot,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n if (!out) return undefined;\n const idx = out.indexOf(\":\");\n if (idx < 0) return undefined;\n const hash = out.slice(0, idx);\n const ts = Number.parseInt(out.slice(idx + 1), 10);\n return { hash, timestamp: ts };\n } catch {\n return undefined;\n }\n}\n\nexport function gitCommitsSince(\n repoRoot: string,\n relativePath: string,\n sinceCommit: string,\n): number {\n try {\n const out = execFileSync(\n \"git\",\n [\"log\", `${sinceCommit}..HEAD`, \"--format=%H\", \"--\", relativePath],\n {\n cwd: repoRoot,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n },\n ).trim();\n if (!out) return 0;\n return out.split(\"\\n\").filter(Boolean).length;\n } catch {\n return 0;\n }\n}\n\nexport function relPath(repoRoot: string, abs: string): string {\n return relative(repoRoot, abs);\n}\n\nexport function findLineNumber(text: string, needle: string | RegExp): number | undefined {\n const lines = text.split(\"\\n\");\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n if (typeof needle === \"string\" ? line.includes(needle) : needle.test(line)) {\n return i + 1;\n }\n }\n return undefined;\n}\n","import { vocabularyOf } from \"../parser/docs.js\";\nimport { readIntentFiles } from \"../parser/intent.js\";\nimport { intentFileSpecs, resolveSpecPath } from \"./intent-util.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\nimport { fileExists, readText } from \"./util.js\";\n\n/** Shared with the context graph; re-exported for the linters' callers. */\nexport { entitySlug, vocabularyOf } from \"../parser/docs.js\";\n\n/**\n * Every entity a terminal intent requires or creates is a term of the\n * Vocabulary section of one of the file's specs. Downgraded to one\n * warning per intent file when none of its specs has a Vocabulary section.\n */\nexport const intentVocabulary: Linter = {\n id: \"lint:intent-vocabulary\",\n pillars: [\"intents\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-spec\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n for (const intentFile of readIntentFiles(repoRoot)) {\n const used = intentFile.nodes.flatMap((node) =>\n [...node.requires, ...node.creates].map((entity) => ({ entity, node })),\n );\n if (used.length === 0) continue;\n // A spec that does not resolve is lint:intent-schema's report.\n const specs = intentFileSpecs(intentFile.meta)\n .map((spec) => resolveSpecPath(intentFile.path, spec))\n .filter((path) => fileExists(repoRoot, path));\n if (specs.length === 0) continue;\n const entities = new Set<string>();\n let hasVocabulary = false;\n for (const spec of specs) {\n const terms = vocabularyOf(readText(repoRoot, spec));\n if (!terms) continue;\n hasVocabulary = true;\n for (const term of terms) entities.add(term);\n }\n if (!hasVocabulary) {\n issues.push({\n linter: this.id,\n severity: \"warning\",\n file: intentFile.path,\n message: `no Vocabulary section in ${specs.join(\", \")}; entities not checked`,\n });\n continue;\n }\n for (const { entity, node } of used) {\n if (entities.has(entity)) continue;\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: intentFile.path,\n line: node.line,\n message: `\"${node.title}\": entity \\`${entity}\\` is not a Vocabulary term of ${specs.join(\", \")}`,\n });\n }\n }\n return issues;\n },\n};\n","import { stringify as yamlStringify } from \"yaml\";\nimport type { Cmd } from \"../parser/cmd.js\";\nimport type { Skill } from \"../parser/skill.js\";\nimport { ADDABLE_PILLARS, type PillarId } from \"../pillars.js\";\nimport {\n CAPABILITIES_MATRIX,\n type Capability,\n DEGRADED_CAPABILITIES,\n type Engine,\n type RenderedFile,\n} from \"../types.js\";\n\nexport interface UmbrellaExtras {\n availableSkills: ReadonlyArray<Skill>;\n availableCommands: ReadonlyArray<Cmd>;\n hasProjectSkills?: boolean;\n /** The pillars active in the project: the map and the rules hold a line only for them. */\n activePillars: ReadonlySet<PillarId>;\n}\n\nexport interface RenderResult {\n files: RenderedFile[];\n warnings: string[];\n}\n\nexport interface Renderer {\n readonly engine: Engine;\n renderSkill(skill: Skill): RenderResult;\n renderCmd(cmd: Cmd): RenderResult;\n}\n\nexport interface CapabilityCheck {\n blockingWarnings: string[];\n degradedWarnings: string[];\n}\n\nexport function checkSkillCapabilities(skill: Skill, engine: Engine): CapabilityCheck {\n const blockingWarnings: string[] = [];\n const degradedWarnings: string[] = [];\n const supported = CAPABILITIES_MATRIX[engine];\n const degraded = DEGRADED_CAPABILITIES[engine] ?? [];\n if (!skill.meta.requires) return { blockingWarnings, degradedWarnings };\n for (const cap of skill.meta.requires) {\n if (!supported.includes(cap as Capability)) {\n blockingWarnings.push(\n `skill \"${skill.meta.id}\" requires \"${cap}\" not supported by \"${engine}\" — skipped`,\n );\n } else if (degraded.includes(cap as Capability)) {\n degradedWarnings.push(\n `skill \"${skill.meta.id}\" requires \"${cap}\" — supported by \"${engine}\" with degradation`,\n );\n }\n }\n return { blockingWarnings, degradedWarnings };\n}\n\nexport function isSkillEngineAllowed(skill: Skill, engine: Engine): boolean {\n if (!skill.meta.engines) return true;\n return skill.meta.engines.includes(engine);\n}\n\nexport function yamlFrontmatter(data: Record<string, unknown>): string {\n const rendered = yamlStringify(data, { lineWidth: 0 }).trimEnd();\n return `---\\n${rendered}\\n---\\n`;\n}\n\nexport function frontmatterDataForSkill(skill: Skill): Record<string, unknown> {\n // Agent Skills spec (agentskills.io): `name` must match the directory name.\n const data: Record<string, unknown> = {\n name: skill.meta.id,\n description: skill.meta.description,\n };\n if (skill.meta.tags && skill.meta.tags.length > 0) data.tags = skill.meta.tags;\n return data;\n}\n\nexport function frontmatterDataForCmd(cmd: Cmd): Record<string, unknown> {\n const data: Record<string, unknown> = {\n id: cmd.meta.id,\n trigger: cmd.meta.trigger,\n description: cmd.meta.description,\n };\n if (cmd.meta.args && cmd.meta.args.length > 0) {\n // `required` is rendered only when false: an argument is required by default.\n data.args = cmd.meta.args.map((a) => ({\n name: a.name,\n type: a.type,\n ...(a.type === \"enum\" ? { values: a.values } : {}),\n ...(a.default !== undefined ? { default: a.default } : {}),\n ...(a.required === false ? { required: false } : {}),\n }));\n }\n return data;\n}\n\n/**\n * The engine-neutral umbrella: the one working rule the harness imposes,\n * the project map, the checks, and the doc skills the engines expose.\n * Everything project-specific lives in `README.md` and `docs/`.\n */\nexport function buildUmbrellaBody(extras: UmbrellaExtras): string {\n // One skill may be invoked by several commands: list every trigger, in\n // command order.\n const triggersBySkill = new Map<string, string[]>();\n for (const c of extras.availableCommands) {\n const triggers = triggersBySkill.get(c.meta.invokes_skill) ?? [];\n triggers.push(c.meta.trigger);\n triggersBySkill.set(c.meta.invokes_skill, triggers);\n }\n const skillLines = extras.availableSkills.map((s) => {\n const triggers = triggersBySkill.get(s.meta.id) ?? [];\n const label =\n triggers.length > 0\n ? `\\`${s.meta.id}\\` (${triggers.map((t) => `\\`${t}\\``).join(\", \")})`\n : `\\`${s.meta.id}\\``;\n return `- ${label} — ${s.meta.description.split(\"\\n\")[0]}`;\n });\n const has = (pillar: PillarId): boolean => extras.activePillars.has(pillar);\n const exposes = (id: string): boolean => extras.availableSkills.some((s) => s.meta.id === id);\n const when = (condition: boolean, ...lines: string[]): string[] => (condition ? lines : []);\n const inactive = ADDABLE_PILLARS.filter((pillar) => !has(pillar.id)).map((p) => `\\`${p.id}\\``);\n const sections: string[] = [\n \"# How we work\",\n \"\",\n \"This file describes **how to work in this project**. The **business context** (what the project does, how to run it, which subsystems it contains) lives in `README.md` and `docs/`. Read them first.\",\n \"\",\n \"## Project map\",\n \"\",\n \"- `README.md` — pitch, quick start, scripts. Entry point.\",\n \"- `docs/spec/<subsystem>.md` — *what* and *why* (tech-agnostic).\",\n ...when(\n has(\"handbook\"),\n \"- `docs/handbook/<feature>.md` — what the code does not say: entry points, traps, settings outside the repo, manual procedures.\",\n ),\n ...when(\n has(\"decisions\"),\n \"- `docs/decisions/<slug>.md` — ADRs: structural choices and rejected alternatives.\",\n ),\n ...when(\n has(\"tests\"),\n \"- `docs/tests/integration-tests.md` & `e2e-tests.md` — test scope, stack, conventions, known gaps.\",\n ),\n ...when(\n has(\"workflow\"),\n \"- `docs/workflow/coding-workflow.md` — CI, branches, PR, release. How this team works: follow it.\",\n ),\n ...when(\n extras.hasProjectSkills === true,\n \"- `docs/skills/*.skill.md` — the project's domain skills.\",\n ),\n ...when(\n has(\"quality\"),\n \"- `docs/quality/code-quality.md` — the project's code-quality rules: mechanical checks, judgment rules, accepted deviations. Read it before writing or auditing code.\",\n ),\n ...when(\n has(\"intents\"),\n \"- `docs/intents/<intent>.md` — user intents, one tree per level-1 intent, anchored to the code. `docs/intents/README.md` is the generated index.\",\n ),\n ...when(\n has(\"profiles\"),\n \"- `docs/profiles/<profile>.md` — who the project serves, their pains and gains. `docs/profiles/README.md` is the generated index: which intent serves which pain.\",\n ),\n ...when(\n inactive.length > 0,\n \"\",\n `Not in this project yet: ${inactive.join(\", \")}. A pillar is added the day the project needs it, with \\`npx @vaubaan/harness add <pillar>\\`${\n exposes(\"harn-guide\") ? \"; the `harn-guide` skill says when each one is worth it\" : \"\"\n }. Propose it to the human, never create the folder unasked.`,\n ),\n \"\",\n \"## Doc-first\",\n \"\",\n \"The order is: **understand the docs → fill the gaps → code → update the docs → commit**. If the docs are silent or stale on something you change, fill the gap upfront with the doc-skill writers — not downstream, not after the fact.\",\n \"\",\n ...when(\n has(\"intents\"),\n \"- Visible change of behavior → a `proposed` intent first (`/harn-intent <verb + object>`), never the code first.\",\n ),\n \"- Missing spec for a subsystem you touch → **do not code**, report the gap.\",\n ...when(\n has(\"decisions\"),\n \"- Implicit structural decision in your changes → an ADR (`/harn-decision`).\",\n ),\n ...when(\n has(\"handbook\"),\n \"- Changed feature behavior → update the matching handbook (`/harn-handbook`).\",\n ),\n ...when(\n exposes(\"harn-drift-detector\"),\n \"- Suspected code ↔ doc drift → `/harn-drift` before moving on.\",\n ),\n \"\",\n \"## Checks\",\n \"\",\n \"Run `npx @vaubaan/harness lint` before you commit; CI runs the same linters on every pull request. Fix what it reports with the skill it suggests.\",\n \"\",\n \"The files the harness generates (`AGENTS.md`, `CLAUDE.md`, the `.claude/`, `.agents/` and `.opencode/` folders, `.harness-manifest.json`) are committed. Never edit them by hand: change their source in `docs/` or `.harness-overrides/`, run `npx @vaubaan/harness update .`, and commit the result. The linter fails when a generated file no longer matches its render.\",\n ];\n if (skillLines.length > 0) {\n sections.push(\"\", \"## Skills\", \"\", skillLines.join(\"\\n\"));\n }\n return `${sections.join(\"\\n\")}\\n`;\n}\n","import type { Cmd } from \"../parser/cmd.js\";\nimport type { Skill } from \"../parser/skill.js\";\nimport type { Engine } from \"../types.js\";\nimport {\n type RenderResult,\n type Renderer,\n checkSkillCapabilities,\n frontmatterDataForCmd,\n frontmatterDataForSkill,\n isSkillEngineAllowed,\n yamlFrontmatter,\n} from \"./common.js\";\n\nconst ENGINE: Engine = \"claude-code\";\nconst BASE = \".claude\";\n\nexport const claudeCodeRenderer: Renderer = {\n engine: ENGINE,\n renderSkill(skill: Skill): RenderResult {\n if (!isSkillEngineAllowed(skill, ENGINE)) {\n return {\n files: [],\n warnings: [`skill \"${skill.meta.id}\" excluded from engine \"${ENGINE}\"`],\n };\n }\n const check = checkSkillCapabilities(skill, ENGINE);\n if (check.blockingWarnings.length > 0) {\n return { files: [], warnings: check.blockingWarnings };\n }\n const content = `${yamlFrontmatter(frontmatterDataForSkill(skill))}\\n${skill.body}\\n`;\n return {\n files: [{ path: `${BASE}/skills/${skill.meta.id}/SKILL.md`, content }],\n warnings: check.degradedWarnings,\n };\n },\n renderCmd(cmd: Cmd): RenderResult {\n const content = `${yamlFrontmatter(frontmatterDataForCmd(cmd))}\\n${cmd.body}\\n`;\n return {\n files: [{ path: `${BASE}/commands/${cmd.meta.id}.md`, content }],\n warnings: [],\n };\n },\n};\n","import type { Cmd } from \"../parser/cmd.js\";\nimport type { Skill } from \"../parser/skill.js\";\nimport type { Engine } from \"../types.js\";\nimport {\n type RenderResult,\n type Renderer,\n checkSkillCapabilities,\n frontmatterDataForSkill,\n isSkillEngineAllowed,\n yamlFrontmatter,\n} from \"./common.js\";\n\nconst ENGINE: Engine = \"codex-cli\";\n// Codex discovers repo skills under `.agents/skills/` only — `.codex/skills/` is not scanned.\nconst SKILLS_BASE = \".agents/skills\";\n\nexport const codexCliRenderer: Renderer = {\n engine: ENGINE,\n renderSkill(skill: Skill): RenderResult {\n if (!isSkillEngineAllowed(skill, ENGINE)) {\n return {\n files: [],\n warnings: [`skill \"${skill.meta.id}\" excluded from engine \"${ENGINE}\"`],\n };\n }\n const check = checkSkillCapabilities(skill, ENGINE);\n if (check.blockingWarnings.length > 0) {\n return { files: [], warnings: check.blockingWarnings };\n }\n const content = `${yamlFrontmatter(frontmatterDataForSkill(skill))}\\n${skill.body}\\n`;\n return {\n files: [{ path: `${SKILLS_BASE}/${skill.meta.id}/SKILL.md`, content }],\n warnings: check.degradedWarnings,\n };\n },\n // Codex custom prompts are deprecated in favour of skills: nothing to render.\n renderCmd(_cmd: Cmd): RenderResult {\n return { files: [], warnings: [] };\n },\n};\n","import type { Cmd } from \"../parser/cmd.js\";\nimport type { Skill } from \"../parser/skill.js\";\nimport type { Engine } from \"../types.js\";\nimport {\n type RenderResult,\n type Renderer,\n checkSkillCapabilities,\n frontmatterDataForSkill,\n isSkillEngineAllowed,\n yamlFrontmatter,\n} from \"./common.js\";\n\nconst ENGINE: Engine = \"opencode\";\nconst BASE = \".opencode\";\n\nexport const opencodeRenderer: Renderer = {\n engine: ENGINE,\n renderSkill(skill: Skill): RenderResult {\n if (!isSkillEngineAllowed(skill, ENGINE)) {\n return {\n files: [],\n warnings: [`skill \"${skill.meta.id}\" excluded from engine \"${ENGINE}\"`],\n };\n }\n const check = checkSkillCapabilities(skill, ENGINE);\n if (check.blockingWarnings.length > 0) {\n return { files: [], warnings: check.blockingWarnings };\n }\n const content = `${yamlFrontmatter(frontmatterDataForSkill(skill))}\\n${skill.body}\\n`;\n return {\n files: [{ path: `${BASE}/skills/${skill.meta.id}/SKILL.md`, content }],\n warnings: check.degradedWarnings,\n };\n },\n renderCmd(cmd: Cmd): RenderResult {\n // OpenCode names the command after the file; only `description` is a known key.\n const content = `${yamlFrontmatter({ description: cmd.meta.description })}\\n${cmd.body}\\n`;\n return {\n files: [{ path: `${BASE}/commands/${cmd.meta.id}.md`, content }],\n warnings: [],\n };\n },\n};\n","import type { Engine } from \"../types.js\";\nimport { claudeCodeRenderer } from \"./claude-code.js\";\nimport { codexCliRenderer } from \"./codex-cli.js\";\nimport type { Renderer } from \"./common.js\";\nimport { opencodeRenderer } from \"./opencode.js\";\n\nexport const RENDERERS: Record<Engine, Renderer> = {\n \"claude-code\": claudeCodeRenderer,\n \"codex-cli\": codexCliRenderer,\n opencode: opencodeRenderer,\n};\n\nexport function getRenderer(engine: Engine): Renderer {\n return RENDERERS[engine];\n}\n\nexport type { Renderer, RenderResult } from \"./common.js\";\n","import type { ParsedIntentFile } from \"../parser/intent.js\";\n\nconst INTRO =\n \"User intents of this project, anchored to the code. Generated by `@vaubaan/harness` from `docs/intents/*.md`: edit the intents, not this file, then run `npx @vaubaan/harness update .`.\";\n\nconst EMPTY =\n \"No intent yet. `/harn-intent <verb + object>` writes the first one, before the code.\";\n\n/**\n * `docs/intents/README.md`: every intent file (sorted by file name) and its\n * whole tree, one line per node with its effective status, the actors on\n * the level-1 intent line (docs/spec/coding-agent-harness.md §9.1.3).\n */\nexport function buildIntentsIndex(intentFiles: ReadonlyArray<ParsedIntentFile>): string {\n const lines = [\"# Intents\", \"\", INTRO, \"\"];\n if (intentFiles.length === 0) lines.push(EMPTY);\n const sorted = [...intentFiles].sort((a, b) => (a.file < b.file ? -1 : a.file > b.file ? 1 : 0));\n for (const intentFile of sorted) {\n const status = intentFile.meta?.status ?? \"proposed\";\n const actors = intentFile.meta?.actors.join(\", \") ?? \"\";\n lines.push(`- [${intentFile.title}](./${intentFile.file}) — ${status} · ${actors}`);\n for (const node of intentFile.nodes) {\n lines.push(`${\" \".repeat(node.level)}- ${node.title} — ${node.effectiveStatus ?? status}`);\n }\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n","import type { IntentNode, ParsedIntentFile } from \"../parser/intent.js\";\nimport type { ParsedProfileFile, ProfileItem } from \"../parser/profile.js\";\n\nconst INTRO =\n \"Who this project serves, and what the intents do for them. Generated by `@vaubaan/harness` from `docs/profiles/*.md` and `docs/intents/*.md`: edit those, not this file, then run `npx @vaubaan/harness update .`.\";\nconst EMPTY =\n \"No profile yet. The `harn-intent-writer` skill writes the first one from the research you point it to.\";\n\n/**\n * `docs/profiles/README.md`: each profile with its status, the level-1\n * intents that name it as an actor, and under each pain and gain the\n * terminal intents that serve it (docs/spec/coding-agent-harness.md §9.1.4).\n */\nexport function buildProfilesIndex(\n profiles: ReadonlyArray<ParsedProfileFile>,\n intentFiles: ReadonlyArray<ParsedIntentFile> = [],\n): string {\n const lines = [\"# Profiles\", \"\", INTRO];\n if (profiles.length === 0) lines.push(\"\", EMPTY);\n const sortedIntents = [...intentFiles].sort((a, b) =>\n a.file < b.file ? -1 : a.file > b.file ? 1 : 0,\n );\n for (const profile of [...profiles].sort((a, b) => (a.file < b.file ? -1 : 1))) {\n const theirs = sortedIntents.filter((file) => file.meta?.actors.includes(profile.slug));\n lines.push(\n \"\",\n `## [${profile.title}](./${profile.file}) — ${profile.meta?.status ?? \"hypothesis\"}`,\n \"\",\n );\n lines.push(\n theirs.length\n ? `Intents: ${theirs.map((f) => `[${f.title}](../intents/${f.file})`).join(\", \")}.`\n : \"Intents: none names this profile yet.\",\n );\n const served = (kind: \"relieves\" | \"delivers\", item: ProfileItem): string => {\n const by: string[] = [];\n for (const file of theirs) {\n for (const node of file.nodes as ReadonlyArray<IntentNode>) {\n if (node[kind].includes(item.slug)) {\n by.push(`[${node.title}](../intents/${file.file})`);\n }\n }\n }\n if (by.length) return by.join(\", \");\n return kind === \"relieves\" ? \"*no intent relieves it yet*\" : \"*no intent delivers it yet*\";\n };\n if (profile.pains.length) {\n lines.push(\"\", \"Pains, most severe first:\", \"\");\n for (const pain of profile.pains) {\n lines.push(`- **${pain.name}** (\\`${pain.slug}\\`) — ${served(\"relieves\", pain)}`);\n }\n }\n if (profile.gains.length) {\n lines.push(\"\", \"Gains:\", \"\");\n for (const gain of profile.gains) {\n lines.push(`- **${gain.name}** (\\`${gain.slug}\\`) — ${served(\"delivers\", gain)}`);\n }\n }\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n","import type { Cmd } from \"./parser/cmd.js\";\nimport { INTENTS_INDEX_PATH, type ParsedIntentFile } from \"./parser/intent.js\";\nimport { PROFILES_INDEX_PATH, type ParsedProfileFile } from \"./parser/profile.js\";\nimport type { Skill } from \"./parser/skill.js\";\nimport { type PillarId, allPillars } from \"./pillars.js\";\nimport { buildUmbrellaBody } from \"./renderers/common.js\";\nimport { getRenderer } from \"./renderers/index.js\";\nimport { buildIntentsIndex } from \"./renderers/intents-index.js\";\nimport { buildProfilesIndex } from \"./renderers/profiles-index.js\";\nimport type { Engine, RenderedFile } from \"./types.js\";\n\nexport interface Harness {\n skills: ReadonlyArray<Skill>;\n cmds: ReadonlyArray<Cmd>;\n}\n\nexport interface HarnessOverrides {\n add?: Partial<Harness>;\n disable?: ReadonlyArray<string>;\n}\n\nexport interface RenderInput {\n harness: Harness;\n engines: ReadonlyArray<Engine>;\n overrides?: HarnessOverrides;\n projectSkills?: ReadonlyArray<Skill>;\n /**\n * The pillars active in the target project (spec §9.1.2). A skill that\n * declares `pillars:` is rendered while one of them is active. Omitted:\n * every pillar, which is what a preview with no project shows.\n */\n activePillars?: ReadonlySet<PillarId>;\n /** The project's parsed `docs/intents/*.md`; given, their index is rendered. */\n intentFiles?: ReadonlyArray<ParsedIntentFile>;\n /** The project's parsed `docs/profiles/*.md`; given, their index is rendered. */\n profileFiles?: ReadonlyArray<ParsedProfileFile>;\n}\n\nexport interface RenderOutput {\n files: RenderedFile[];\n warnings: string[];\n}\n\nexport class RenderError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"RenderError\";\n }\n}\n\nfunction mergeById<T extends { meta: { id: string } }>(\n stock: ReadonlyArray<T>,\n added: ReadonlyArray<T> | undefined,\n): T[] {\n const result = new Map<string, T>();\n for (const item of stock) result.set(item.meta.id, item);\n if (added) {\n for (const item of added) result.set(item.meta.id, item);\n }\n return Array.from(result.values());\n}\n\nfunction removeByIds<T extends { meta: { id: string } }>(\n items: ReadonlyArray<T>,\n disabled: ReadonlyArray<string>,\n): T[] {\n if (disabled.length === 0) return [...items];\n const disabledSet = new Set(disabled);\n return items.filter((item) => !disabledSet.has(item.meta.id));\n}\n\nexport function applyOverrides(harness: Harness, overrides: HarnessOverrides | undefined): Harness {\n const disabled = overrides?.disable ?? [];\n return {\n skills: removeByIds(mergeById(harness.skills, overrides?.add?.skills), disabled),\n cmds: removeByIds(mergeById(harness.cmds, overrides?.add?.cmds), disabled),\n };\n}\n\n// `@AGENTS.md` is Claude Code's import syntax: the umbrella is really loaded,\n// on every version and provider, and never read twice alongside native\n// AGENTS.md support (cf. ADR engine-native-layouts-1-0).\nconst CLAUDE_MD_STUB = \"@AGENTS.md\\n\";\n\n// OpenCode also scans `.claude/skills/` and `.agents/skills/`. It goes last so\n// its own copy of a skill is dropped when another rendered engine exposes it.\nfunction opencodeLast(engines: ReadonlyArray<Engine>): Engine[] {\n return [...engines].sort((a, b) => Number(a === \"opencode\") - Number(b === \"opencode\"));\n}\n\n/** A skill with no `pillars:` is always rendered; otherwise one of them must be active. */\nfunction servesAnActivePillar(skill: Skill, active: ReadonlySet<PillarId>): boolean {\n return !skill.meta.pillars || skill.meta.pillars.some((pillar) => active.has(pillar));\n}\n\n/**\n * Pure transformation `(catalog, engines, overrides, active pillars) → files`. The harness\n * ships no agent persona and no engine hook: only the doc skills, their\n * commands, and the engine-neutral umbrella\n * (docs/decisions/no-personas-no-code-judgment.md,\n * docs/decisions/lint-in-ci-and-pre-commit.md).\n */\nexport function render(input: RenderInput): RenderOutput {\n const { engines } = input;\n if (engines.length === 0) {\n throw new RenderError(\"at least one engine must be selected\");\n }\n const base: Harness = input.projectSkills?.length\n ? { ...input.harness, skills: mergeById(input.harness.skills, input.projectSkills) }\n : input.harness;\n const active = input.activePillars ?? allPillars();\n const merged = applyOverrides(base, input.overrides);\n const harness: Harness = {\n ...merged,\n skills: merged.skills.filter((skill) => servesAnActivePillar(skill, active)),\n };\n\n const files: RenderedFile[] = [];\n const warnings: string[] = [];\n\n // Track skills + commands successfully exposed on at least one engine,\n // for the engine-neutral umbrella's \"Doc-skills\" section.\n const exposedSkills = new Map<string, Skill>();\n const exposedCmds = new Map<string, Cmd>();\n\n for (const engine of opencodeLast(engines)) {\n const renderer = getRenderer(engine);\n\n const renderedSkillIds = new Set<string>();\n for (const skill of harness.skills) {\n const result = renderer.renderSkill(skill);\n warnings.push(...result.warnings);\n if (result.files.length > 0) {\n const alreadyVisible = engine === \"opencode\" && exposedSkills.has(skill.meta.id);\n if (!alreadyVisible) files.push(...result.files);\n renderedSkillIds.add(skill.meta.id);\n exposedSkills.set(skill.meta.id, skill);\n }\n }\n\n for (const cmd of harness.cmds) {\n if (!renderedSkillIds.has(cmd.meta.invokes_skill)) continue;\n const result = renderer.renderCmd(cmd);\n warnings.push(...result.warnings);\n if (result.files.length > 0) {\n files.push(...result.files);\n exposedCmds.set(cmd.meta.id, cmd);\n }\n }\n }\n\n // Engine-neutral umbrella at the root\n const umbrellaContent = buildUmbrellaBody({\n availableSkills: Array.from(exposedSkills.values()),\n availableCommands: Array.from(exposedCmds.values()),\n hasProjectSkills: (input.projectSkills?.length ?? 0) > 0,\n activePillars: active,\n });\n files.push({ path: \"AGENTS.md\", content: umbrellaContent });\n\n // CLAUDE.md stub only if claude-code is enabled (Claude Code reads it historically)\n if (engines.includes(\"claude-code\")) {\n files.push({ path: \"CLAUDE.md\", content: CLAUDE_MD_STUB });\n }\n\n // The indexes are generated files too, rendered while their pillar is active:\n // the caller passes the parsed files of an active pillar, even when there are none.\n if (input.intentFiles) {\n files.push({ path: INTENTS_INDEX_PATH, content: buildIntentsIndex(input.intentFiles) });\n }\n if (input.profileFiles) {\n files.push({\n path: PROFILES_INDEX_PATH,\n content: buildProfilesIndex(input.profileFiles, input.intentFiles ?? []),\n });\n }\n\n return { files, warnings };\n}\n","import { existsSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport fg from \"fast-glob\";\nimport { isExternalOrAnchor, readLinks, stripFragment } from \"../parser/docs.js\";\nimport type { LintContext, LintIssue, Linter } from \"./types.js\";\nimport { readText } from \"./util.js\";\n\n/** The Markdown files whose links are checked, and that the context graph links. */\nexport const LINKED_DOC_IGNORES: ReadonlyArray<string> = [\n \"**/node_modules/**\",\n \"**/dist/**\",\n \".harness-overrides/**\",\n \"skills/**\",\n \"agents/**\",\n \"commands/**\",\n \"templates/**\",\n \"**/*.skill.md\",\n \"**/*.cmd.md\",\n \"**/*.agent.md\",\n];\n\n/** A relative link of `sourceFile` as an absolute path. */\nexport function resolveLink(repoRoot: string, sourceFile: string, link: string): string {\n const noFrag = stripFragment(link);\n if (isAbsolute(noFrag)) return join(repoRoot, noFrag);\n return resolve(dirname(join(repoRoot, sourceFile)), noFrag);\n}\n\nexport const crossLinks: Linter = {\n id: \"lint:cross-links\",\n pillars: [\"all\"],\n defaultSeverity: \"error\",\n run(repoRoot: string, ctx?: LintContext): LintIssue[] {\n const extra = ctx?.config.ignore ?? [];\n const issues: LintIssue[] = [];\n const allDocs = fg.sync(\"**/*.md\", {\n cwd: repoRoot,\n absolute: false,\n ignore: [...LINKED_DOC_IGNORES, ...extra],\n });\n for (const f of allDocs) {\n for (const { url, line } of readLinks(readText(repoRoot, f))) {\n if (isExternalOrAnchor(url)) continue;\n const noFrag = stripFragment(url);\n if (noFrag === \"\" || noFrag.startsWith(\"data:\")) continue;\n if (!existsSync(resolveLink(repoRoot, f, url))) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: f,\n line,\n message: `broken link: ${url}`,\n });\n }\n }\n }\n return issues;\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { listMarkdown, parseFrontmatter, readText } from \"./util.js\";\n\nconst ADR_DIR = \"docs/decisions\";\n\nexport const adrNoTracks: Linter = {\n id: \"lint:adr-no-tracks\",\n pillars: [\"decisions\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-decision\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n const files = listMarkdown(repoRoot, ADR_DIR);\n for (const f of files) {\n const text = readText(repoRoot, f);\n const { data } = parseFrontmatter(text);\n if (!(\"tracks\" in data)) continue;\n const value = data.tracks;\n if (Array.isArray(value) && value.length === 0) continue;\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: f,\n message:\n \"ADRs must not declare `tracks:` (or must set it to []). ADRs document a decision frozen in time, not the current state of code — use status: superseded to mark them obsolete instead.\",\n });\n }\n return issues;\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { dirExists, fileExists } from \"./util.js\";\n\n/** The files a pillar requires once it is active; nothing while its folder is absent. */\nconst REQUIRED_FILES: ReadonlyArray<{ dir: string; files: ReadonlyArray<string> }> = [\n { dir: \"docs/tests\", files: [\"docs/tests/integration-tests.md\", \"docs/tests/e2e-tests.md\"] },\n { dir: \"docs/workflow\", files: [\"docs/workflow/coding-workflow.md\"] },\n];\n\nexport const cardinalFiles: Linter = {\n id: \"lint:cardinal-files\",\n pillars: [\"tests\", \"workflow\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-test-plan\", \"/harn-workflow\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n for (const { dir, files } of REQUIRED_FILES) {\n if (!dirExists(repoRoot, dir)) continue;\n for (const f of files) {\n if (!fileExists(repoRoot, f)) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: f,\n message: `missing required cardinal file: ${f}`,\n });\n }\n }\n }\n return issues;\n },\n};\n","import { cosmiconfigSync } from \"cosmiconfig\";\n\nexport interface HarnessLintConfig {\n ignore: ReadonlyArray<string>;\n}\n\nconst DEFAULT_CONFIG: HarnessLintConfig = { ignore: [] };\n\nexport function loadLintConfig(repoRoot: string): HarnessLintConfig {\n const explorer = cosmiconfigSync(\"harness\", {\n searchPlaces: [\n \"package.json\",\n \".harnessrc\",\n \".harnessrc.json\",\n \".harnessrc.yaml\",\n \".harnessrc.yml\",\n \"harness.config.js\",\n \"harness.config.cjs\",\n ],\n });\n const result = explorer.search(repoRoot);\n if (!result || result.isEmpty) return DEFAULT_CONFIG;\n\n const raw = result.config as Record<string, unknown> | undefined;\n if (!raw) return DEFAULT_CONFIG;\n\n const lint = raw.lint as Record<string, unknown> | undefined;\n if (!lint) return DEFAULT_CONFIG;\n\n const ignore = lint.ignore;\n if (!Array.isArray(ignore)) return DEFAULT_CONFIG;\n\n return { ignore: ignore.filter((x): x is string => typeof x === \"string\") };\n}\n","import { ADR_SECTIONS } from \"../parser/docs.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\nimport { listMarkdown, readText } from \"./util.js\";\n\nexport const decisionSchema: Linter = {\n id: \"lint:decision-schema\",\n pillars: [\"decisions\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-decision\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n const files = listMarkdown(repoRoot, \"docs/decisions\");\n for (const f of files) {\n const text = readText(repoRoot, f);\n for (const { label, pattern } of ADR_SECTIONS) {\n if (!pattern.test(text)) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: f,\n message: `missing required section: \"${label}\"`,\n });\n }\n }\n }\n return issues;\n },\n};\n","import { emptyPillarDirs } from \"../pillars.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\n\n/**\n * No pillar folder is required: a pillar is active when its folder exists\n * (docs/decisions/pillars-on-demand.md). What this linter refuses is a\n * pillar folder holding no file: git does not record it, so the pillar\n * would be active on one machine and inactive on the next.\n */\nexport const docLayout: Linter = {\n id: \"lint:doc-layout\",\n pillars: [\"all\"],\n defaultSeverity: \"error\",\n run(repoRoot: string): LintIssue[] {\n return emptyPillarDirs(repoRoot).map((dir) => ({\n linter: this.id,\n severity: \"error\" as const,\n file: dir,\n message: `empty pillar folder: git does not record ${dir}/, so the pillar would be active on this machine only — fill it (\\`npx @vaubaan/harness add ${dir.replace(\"docs/\", \"\")}\\`) or remove it`,\n }));\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { listMarkdown, parseFrontmatter, readText, trackedPathExists } from \"./util.js\";\n\nconst TRACKED_DIRS = [\"docs/handbook\", \"docs/tests\", \"docs/workflow\"];\n\nexport const frontmatterTracks: Linter = {\n id: \"lint:frontmatter-tracks\",\n pillars: [\"handbook\", \"tests\", \"workflow\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-handbook\", \"/harn-test-plan\", \"/harn-workflow\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n for (const dir of TRACKED_DIRS) {\n const files = listMarkdown(repoRoot, dir);\n for (const f of files) {\n const text = readText(repoRoot, f);\n const { data } = parseFrontmatter(text);\n if (!Array.isArray(data.tracks)) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: f,\n message: \"missing frontmatter `tracks:` array\",\n });\n continue;\n }\n for (const tracked of data.tracks as unknown[]) {\n if (typeof tracked !== \"string\") {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: f,\n message: \"`tracks` entries must be strings\",\n });\n continue;\n }\n if (!trackedPathExists(repoRoot, tracked)) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: f,\n message: `tracked path does not exist: ${tracked}`,\n });\n }\n }\n }\n }\n return issues;\n },\n};\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { RELEASED_PATHS } from \"../cli/managed-paths.js\";\nimport { readManifest } from \"../cli/manifest.js\";\nimport { planInit } from \"../cli/plan-render.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\n\nconst FIX = \"run `npx @vaubaan/harness update .` and commit the result\";\n\n/**\n * Generated files are committed; this linter is what keeps them honest. It\n * renders the harness with the engines and overrides the manifest records\n * and compares every file with the working tree\n * (docs/decisions/generated-files-committed.md).\n */\nexport const generatedFresh: Linter = {\n id: \"lint:generated-fresh\",\n pillars: [\"repo-root\"],\n defaultSeverity: \"error\",\n run(repoRoot: string): LintIssue[] {\n const issue = (file: string, message: string): LintIssue => ({\n linter: this.id,\n severity: \"error\",\n file,\n message,\n });\n let manifest: ReturnType<typeof readManifest>;\n try {\n manifest = readManifest(repoRoot);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n return [issue(\".harness-manifest.json\", `invalid harness manifest: ${reason}`)];\n }\n if (!manifest) return [];\n const overridesParent = manifest.overridesDir\n ? resolve(repoRoot, manifest.overridesDir)\n : repoRoot;\n const hasOverrides = existsSync(join(overridesParent, \".harness-overrides\"));\n let rendered: ReturnType<typeof planInit>;\n try {\n rendered = planInit({\n targetDir: repoRoot,\n engines: manifest.engines,\n overridesDir: hasOverrides ? overridesParent : undefined,\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n return [issue(\".harness-manifest.json\", `cannot render the harness: ${reason}`)];\n }\n const preserved = new Set(manifest.preservedFiles ?? []);\n const issues: LintIssue[] = [];\n const renderedPaths = new Set<string>();\n for (const file of rendered.output.files) {\n if (preserved.has(file.path)) continue;\n renderedPaths.add(file.path);\n const full = join(repoRoot, file.path);\n if (!existsSync(full)) {\n issues.push(issue(file.path, `generated file is missing; ${FIX}`));\n } else if (readFileSync(full, \"utf8\") !== file.content) {\n issues.push(\n issue(\n file.path,\n `generated file differs from the current render; edit its source in docs/ or .harness-overrides/, then ${FIX}`,\n ),\n );\n }\n }\n for (const path of manifest.files) {\n if (renderedPaths.has(path) || preserved.has(path) || RELEASED_PATHS.includes(path)) continue;\n if (existsSync(join(repoRoot, path))) {\n issues.push(issue(path, `stale generated file, no longer rendered; ${FIX}`));\n }\n }\n return issues;\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { fileExists, readText } from \"./util.js\";\n\n/** Local, disposable state: never in Git. */\nexport const REQUIRED_GITIGNORE_ENTRIES: ReadonlyArray<string> = [\n \".harness-overrides/\",\n \".vaubaan/\",\n];\n\n/**\n * Generated files are committed, so a clone has the whole context without\n * the harness installed (docs/decisions/generated-files-committed.md).\n */\nexport const FORBIDDEN_GITIGNORE_ENTRIES: ReadonlyArray<string> = [\n \"AGENTS.md\",\n \"CLAUDE.md\",\n \".claude/\",\n \".codex/\",\n \".agents/\",\n \".opencode/\",\n \".harness-manifest.json\",\n \"docs/intents/README.md\",\n \"docs/profiles/README.md\",\n];\n\n/** Non-empty, non-comment lines, with a leading `/` and a trailing `/` normalized away. */\nexport function gitignoreEntries(text: string): Set<string> {\n const entries = new Set<string>();\n for (const raw of text.split(\"\\n\")) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\")) continue;\n entries.add(line.replace(/^\\//, \"\").replace(/\\/$/, \"\"));\n }\n return entries;\n}\n\nfunction normalize(entry: string): string {\n return entry.replace(/\\/$/, \"\");\n}\n\nexport function missingGitignoreEntries(text: string): string[] {\n const lines = gitignoreEntries(text);\n return REQUIRED_GITIGNORE_ENTRIES.filter((entry) => !lines.has(normalize(entry)));\n}\n\nexport function forbiddenGitignoreEntries(text: string): string[] {\n const lines = gitignoreEntries(text);\n return FORBIDDEN_GITIGNORE_ENTRIES.filter((entry) => lines.has(normalize(entry)));\n}\n\nexport const gitignoreHarness: Linter = {\n id: \"lint:gitignore-harness\",\n pillars: [\"repo-root\"],\n defaultSeverity: \"error\",\n run(repoRoot: string): LintIssue[] {\n if (!fileExists(repoRoot, \".gitignore\")) {\n return [\n {\n linter: this.id,\n severity: \"error\",\n file: \".gitignore\",\n message: \".gitignore is missing at repo root\",\n },\n ];\n }\n const text = readText(repoRoot, \".gitignore\");\n const issues: LintIssue[] = [];\n for (const entry of missingGitignoreEntries(text)) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: \".gitignore\",\n message: `.gitignore must contain \"${entry}\"`,\n });\n }\n for (const entry of forbiddenGitignoreEntries(text)) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: \".gitignore\",\n message: `.gitignore must not contain \"${entry}\": files the harness generates are committed`,\n });\n }\n return issues;\n },\n};\n","import { readIntentFiles } from \"../parser/intent.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\nimport { trackedPathExists } from \"./util.js\";\n\n/**\n * Every anchor of an intent matches at least one file, with the\n * resolution of `tracks:`. A `deprecated` node is skipped: its anchors may\n * already be gone (docs/spec/coding-agent-harness.md §9.1.3).\n */\nexport const intentAnchors: Linter = {\n id: \"lint:intent-anchors\",\n pillars: [\"intents\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-intent\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n for (const intentFile of readIntentFiles(repoRoot)) {\n for (const node of intentFile.nodes) {\n if (node.effectiveStatus === \"deprecated\") continue;\n for (const anchor of node.anchors) {\n if (trackedPathExists(repoRoot, anchor)) continue;\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: intentFile.path,\n line: node.line,\n message: `\"${node.title}\": anchor matches no file: ${anchor}`,\n });\n }\n }\n }\n return issues;\n },\n};\n","import { readIntentFiles } from \"../parser/intent.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\n\n/**\n * Across all intent files, an entity a terminal intent requires that no terminal\n * intent creates: the intent is unreachable in the doc\n * (docs/spec/coding-agent-harness.md §9.1.3).\n */\nexport const intentGraph: Linter = {\n id: \"lint:intent-graph\",\n pillars: [\"intents\"],\n defaultSeverity: \"warning\",\n suggestedSkills: [\"/harn-intent\"],\n run(repoRoot: string): LintIssue[] {\n const intentFiles = readIntentFiles(repoRoot);\n const terminals = intentFiles.flatMap((intentFile) =>\n intentFile.nodes.filter((node) => node.isTerminal).map((node) => ({ intentFile, node })),\n );\n const created = new Set(terminals.flatMap(({ node }) => node.creates));\n const issues: LintIssue[] = [];\n for (const { intentFile, node } of terminals) {\n for (const entity of node.requires) {\n if (created.has(entity)) continue;\n issues.push({\n linter: this.id,\n severity: \"warning\",\n file: intentFile.path,\n line: node.line,\n message: `\"${node.title}\": entity \\`${entity}\\` is required here but no terminal intent creates it`,\n });\n }\n }\n return issues;\n },\n};\n","import { readIntentFiles } from \"../parser/intent.js\";\nimport { PROFILES_DIR, readProfileFiles } from \"../parser/profile.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\nimport { dirExists } from \"./util.js\";\n\n/**\n * The link from the intents to the profiles (docs/spec/coding-agent-harness.md\n * §9.1.4). A check between two pillars runs only while both are active:\n * with intents alone, actors stay free strings and only a dangling\n * `relieves:` / `delivers:` is reported.\n */\nexport const intentProfiles: Linter = {\n id: \"lint:intent-profiles\",\n pillars: [\"intents\", \"profiles\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-intent\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n const intentFiles = readIntentFiles(repoRoot);\n const profilesActive = dirExists(repoRoot, PROFILES_DIR);\n const profiles = new Map(readProfileFiles(repoRoot).map((p) => [p.slug, p]));\n for (const intentFile of intentFiles) {\n const report = (message: string, line?: number): void => {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: intentFile.path,\n ...(line !== undefined ? { line } : {}),\n message,\n });\n };\n const actors = intentFile.meta?.actors ?? [];\n if (profilesActive) {\n for (const actor of actors) {\n if (!profiles.has(actor)) {\n report(`actor \\`${actor}\\` is not a profile: no ${PROFILES_DIR}/${actor}.md`, 1);\n }\n }\n }\n const theirs = actors.flatMap((actor) => profiles.get(actor) ?? []);\n const pains = new Set(theirs.flatMap((p) => p.pains.map((item) => item.slug)));\n const gains = new Set(theirs.flatMap((p) => p.gains.map((item) => item.slug)));\n for (const node of intentFile.nodes) {\n const fields = [\n { key: \"relieves\", values: node.relieves, known: pains, kind: \"pain\" },\n { key: \"delivers\", values: node.delivers, known: gains, kind: \"gain\" },\n ] as const;\n for (const { key, values, known, kind } of fields) {\n if (values.length === 0) continue;\n const line = node.fieldLines[key] ?? node.line;\n if (!profilesActive) {\n report(\n `\"${node.title}\": \\`${key}:\\` needs the profiles pillar — \\`npx @vaubaan/harness add profiles\\``,\n line,\n );\n continue;\n }\n for (const slug of values) {\n if (!known.has(slug)) {\n report(\n `\"${node.title}\": \\`${slug}\\` is not a ${kind} of ${\n actors.length ? actors.map((a) => `\\`${a}\\``).join(\", \") : \"any actor\"\n }`,\n line,\n );\n }\n }\n }\n }\n }\n return issues;\n },\n};\n","import { TERMINAL_FIELDS, readIntentFiles } from \"../parser/intent.js\";\nimport { intentFileSpecs, resolveSpecPath } from \"./intent-util.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\nimport { fileExists } from \"./util.js\";\n\n/** Facts the code or the tree already says: never declared on a node. */\nconst DERIVABLE_FIELDS = new Set([\"uses\", \"guards\"]);\n\n/**\n * The grammar of the optional intents pillar\n * (docs/spec/coding-agent-harness.md §9.1.3). No effect when\n * `docs/intents/` is absent.\n */\nexport const intentSchema: Linter = {\n id: \"lint:intent-schema\",\n pillars: [\"intents\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-intent\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n for (const intentFile of readIntentFiles(repoRoot)) {\n const report = (message: string, line?: number): void => {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: intentFile.path,\n ...(line !== undefined ? { line } : {}),\n message,\n });\n };\n for (const error of intentFile.errors) report(error.message, error.line);\n for (const spec of intentFileSpecs(intentFile.meta)) {\n if (!fileExists(repoRoot, resolveSpecPath(intentFile.path, spec))) {\n report(`frontmatter \\`spec\\` does not resolve: ${spec}`, 1);\n }\n }\n for (const node of intentFile.nodes) {\n const at = (message: string): void => report(`\"${node.title}\": ${message}`, node.line);\n for (const { key, line } of node.unknownFields) {\n report(\n DERIVABLE_FIELDS.has(key)\n ? `\"${node.title}\": \\`${key}:\\` is derivable, never declared`\n : `\"${node.title}\": unknown field \\`${key}:\\``,\n line,\n );\n }\n if (\n node.spec !== undefined &&\n !fileExists(repoRoot, resolveSpecPath(intentFile.path, node.spec))\n ) {\n report(`\"${node.title}\": \\`spec:\\` does not resolve: ${node.spec}`, node.fieldLines.spec);\n }\n if (!node.isTerminal) {\n for (const field of TERMINAL_FIELDS) {\n const line = node.fieldLines[field];\n if (line !== undefined) {\n report(\n `\"${node.title}\": \\`${field}:\\` is a field of a terminal intent, this node has sub-intents`,\n line,\n );\n }\n }\n continue;\n }\n if (Object.keys(node.fieldLines).length === 0) {\n at(\"a terminal intent carries at least one field\");\n continue;\n }\n if (node.effectiveStatus === \"implemented\" && node.anchors.length === 0) {\n at(\"an `implemented` intent needs `anchors:`\");\n }\n if (node.effectiveStatus === \"proposed\" && node.acceptance.length === 0) {\n at(\"a `proposed` intent needs `acceptance:` with at least one `- ` item\");\n }\n }\n }\n return issues;\n },\n};\n","import { basename } from \"node:path\";\nimport fg from \"fast-glob\";\nimport type { LintContext, LintIssue, Linter } from \"./types.js\";\nimport { listMarkdown, readText } from \"./util.js\";\n\nexport const orphanDecisions: Linter = {\n id: \"lint:orphan-decisions\",\n pillars: [\"decisions\"],\n defaultSeverity: \"warning\",\n suggestedSkills: [\"/harn-handbook\"],\n run(repoRoot: string, ctx?: LintContext): LintIssue[] {\n const extra = ctx?.config.ignore ?? [];\n const issues: LintIssue[] = [];\n const adrs = listMarkdown(repoRoot, \"docs/decisions\");\n if (adrs.length === 0) return issues;\n\n const otherDocs = fg.sync(\"**/*.md\", {\n cwd: repoRoot,\n absolute: false,\n ignore: [\n \"**/node_modules/**\",\n \"**/dist/**\",\n \".harness-overrides/**\",\n \"docs/decisions/**\",\n \"skills/**\",\n \"agents/**\",\n \"commands/**\",\n \"templates/**\",\n ...extra,\n ],\n });\n\n const referenceCorpus = otherDocs.map((f) => readText(repoRoot, f)).join(\"\\n\");\n\n for (const adr of adrs) {\n const filename = basename(adr);\n const stem = filename.replace(/\\.md$/, \"\");\n const referenced = referenceCorpus.includes(filename) || referenceCorpus.includes(stem);\n if (!referenced) {\n issues.push({\n linter: this.id,\n severity: \"warning\",\n file: adr,\n message: \"ADR is not referenced by any other doc file (orphan)\",\n });\n }\n }\n return issues;\n },\n};\n","import { posix } from \"node:path\";\nimport { profileEvidence, readProfileFiles } from \"../parser/profile.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\nimport { fileExists } from \"./util.js\";\n\n/** `https://…`, `mailto:…`: evidence kept outside the repo, never resolved. */\nconst EXTERNAL = /^[a-z][a-z0-9+.-]*:/i;\n\n/**\n * The grammar of the profiles pillar (docs/spec/coding-agent-harness.md\n * §9.1.4). No effect when `docs/profiles/` is absent.\n */\nexport const profileSchema: Linter = {\n id: \"lint:profile-schema\",\n pillars: [\"profiles\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-intent\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n for (const profile of readProfileFiles(repoRoot)) {\n const report = (message: string, line?: number): void => {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: profile.path,\n ...(line !== undefined ? { line } : {}),\n message,\n });\n };\n for (const error of profile.errors) report(error.message, error.line);\n const evidence = profileEvidence(profile.meta);\n if (profile.meta?.status === \"validated\" && evidence.length === 0) {\n report(\"a `validated` profile needs `evidence:` — without it, it is a `hypothesis`\", 1);\n }\n for (const link of evidence) {\n if (EXTERNAL.test(link)) continue;\n const target = posix.normalize(\n posix.join(posix.dirname(profile.path), link.split(\"#\")[0] ?? \"\"),\n );\n if (!fileExists(repoRoot, target)) report(`\\`evidence\\` does not resolve: ${link}`, 1);\n }\n }\n return issues;\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { dirExists, fileExists, readText } from \"./util.js\";\n\nconst QUALITY_DIR = \"docs/quality\";\nconst CARDINAL_FILE = `${QUALITY_DIR}/code-quality.md`;\n\n// English headings are canonical; the French ones are still accepted so\n// projects written before the switch to English keep passing.\nconst REQUIRED_SECTIONS: ReadonlyArray<{ label: string; pattern: RegExp }> = [\n {\n label: \"Mechanical checks\",\n pattern: /^##\\s+(Mechanical\\s+checks|V[ée]rifications\\s+m[ée]caniques)\\s*$/im,\n },\n { label: \"Project rules\", pattern: /^##\\s+(Project\\s+rules|R[èe]gles\\s+du\\s+projet)\\s*$/im },\n {\n label: \"Accepted deviations\",\n pattern: /^##\\s+(Accepted\\s+deviations|[ÉE]carts\\s+assum[ée]s)\\s*$/im,\n },\n];\n\n/**\n * `docs/quality/` is an optional pillar: absent directory = nothing to\n * report. Once the directory exists, its cardinal file and sections are\n * required.\n */\nexport const qualitySchema: Linter = {\n id: \"lint:quality-schema\",\n pillars: [\"quality\"],\n defaultSeverity: \"error\",\n run(repoRoot: string): LintIssue[] {\n if (!dirExists(repoRoot, QUALITY_DIR)) return [];\n if (!fileExists(repoRoot, CARDINAL_FILE)) {\n return [\n {\n linter: this.id,\n severity: \"error\",\n file: CARDINAL_FILE,\n message: `missing required cardinal file: ${CARDINAL_FILE}`,\n },\n ];\n }\n const text = readText(repoRoot, CARDINAL_FILE);\n return REQUIRED_SECTIONS.filter(({ pattern }) => !pattern.test(text)).map(({ label }) => ({\n linter: this.id,\n severity: \"error\" as const,\n file: CARDINAL_FILE,\n message: `missing required section: \"${label}\"`,\n }));\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { fileExists } from \"./util.js\";\n\nexport const readmePresence: Linter = {\n id: \"lint:readme-presence\",\n pillars: [\"readme\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-readme\"],\n run(repoRoot: string): LintIssue[] {\n if (fileExists(repoRoot, \"README.md\")) return [];\n return [\n {\n linter: this.id,\n severity: \"error\",\n file: \"README.md\",\n message: \"README.md is missing at repo root\",\n },\n ];\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { fileExists, readText } from \"./util.js\";\n\nconst REQUIRED_SECTIONS = [\n /^#\\s+\\S/m,\n /^##?\\s+(What is this|Quick start)/im,\n /^##?\\s+(Quick start|Install|Getting started)/im,\n];\n\nconst REQUIRED_LABELS = [\"title (# H1)\", \"What is this / intro\", \"Quick start / Install\"];\n\nexport const readmeSections: Linter = {\n id: \"lint:readme-sections\",\n pillars: [\"readme\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-readme\"],\n run(repoRoot: string): LintIssue[] {\n if (!fileExists(repoRoot, \"README.md\")) return [];\n const text = readText(repoRoot, \"README.md\");\n const issues: LintIssue[] = [];\n for (let i = 0; i < REQUIRED_SECTIONS.length; i++) {\n const pattern = REQUIRED_SECTIONS[i];\n const label = REQUIRED_LABELS[i];\n if (pattern && !pattern.test(text)) {\n issues.push({\n linter: this.id,\n severity: \"error\",\n file: \"README.md\",\n message: `missing required section: ${label}`,\n });\n }\n }\n return issues;\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { listMarkdown } from \"./util.js\";\n\n/** The spec is core, but a project that just started is warned, not failed. */\nexport const specHasContent: Linter = {\n id: \"lint:spec-has-content\",\n pillars: [\"spec\"],\n defaultSeverity: \"warning\",\n suggestedSkills: [\"/harn-spec\"],\n run(repoRoot: string): LintIssue[] {\n const files = listMarkdown(repoRoot, \"docs/spec\");\n if (files.length > 0) return [];\n return [\n {\n linter: this.id,\n severity: \"warning\",\n file: \"docs/spec\",\n message: \"no spec yet: docs/spec/ has no markdown file — write the first spec document\",\n },\n ];\n },\n};\n","import type { LintIssue, Linter } from \"./types.js\";\nimport { findLineNumber, listMarkdown, readText } from \"./util.js\";\n\nfunction maskFencedBlocks(text: string): string {\n return text.replace(/```[\\s\\S]*?```/g, (m) => m.replace(/[^\\n]/g, \" \"));\n}\n\nconst TECH_BLOCKLIST: Array<{ pattern: RegExp; keyword: string }> = [\n { pattern: /\\bNext\\.?js\\b/i, keyword: \"Next.js\" },\n { pattern: /\\bSupabase\\b/i, keyword: \"Supabase\" },\n { pattern: /\\bVercel\\b/i, keyword: \"Vercel\" },\n { pattern: /\\bReact\\b/, keyword: \"React\" },\n { pattern: /\\bTypeScript\\b/, keyword: \"TypeScript\" },\n { pattern: /\\bDocker\\b/, keyword: \"Docker\" },\n { pattern: /\\bKubernetes\\b/i, keyword: \"Kubernetes\" },\n { pattern: /\\bPostgres(QL)?\\b/i, keyword: \"Postgres\" },\n { pattern: /\\bMySQL\\b/i, keyword: \"MySQL\" },\n { pattern: /\\bRedis\\b/i, keyword: \"Redis\" },\n { pattern: /\\bnpm\\b/, keyword: \"npm\" },\n { pattern: /\\bpnpm\\b/, keyword: \"pnpm\" },\n { pattern: /\\byarn\\b/, keyword: \"yarn\" },\n];\n\nexport const specTechAgnostic: Linter = {\n id: \"lint:spec-tech-agnostic\",\n pillars: [\"spec\"],\n defaultSeverity: \"error\",\n suggestedSkills: [\"/harn-spec\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n const files = listMarkdown(repoRoot, \"docs/spec\");\n for (const f of files) {\n const text = maskFencedBlocks(readText(repoRoot, f));\n for (const { pattern, keyword } of TECH_BLOCKLIST) {\n if (pattern.test(text)) {\n const issue: LintIssue = {\n linter: this.id,\n severity: \"error\",\n file: f,\n message: `forbidden tech keyword \"${keyword}\" — should be in handbook/ or decisions/`,\n };\n const line = findLineNumber(text, pattern);\n if (line !== undefined) issue.line = line;\n issues.push(issue);\n }\n }\n }\n return issues;\n },\n};\n","import fg from \"fast-glob\";\nimport { parseIntentFile } from \"../parser/intent.js\";\nimport type { LintIssue, Linter } from \"./types.js\";\nimport {\n gitCommitsSince,\n gitLastCommitForPath,\n listMarkdown,\n parseFrontmatter,\n readText,\n} from \"./util.js\";\n\nconst TRACKED_DIRS = [\"docs/handbook\", \"docs/tests\", \"docs/workflow\"];\n/** An intent file declares no `tracks:`: its tracked paths are the union of its nodes' anchors. */\nconst INTENTS_DIR = \"docs/intents\";\nconst DEFAULT_DRIFT_THRESHOLD = 10;\n\nfunction expandGlob(repoRoot: string, pattern: string): string[] {\n if (pattern.includes(\"*\")) {\n return fg.sync(pattern, { cwd: repoRoot, absolute: false });\n }\n return [pattern];\n}\n\nfunction trackedPaths(dir: string, file: string, text: string, data: Record<string, unknown>) {\n if (dir === INTENTS_DIR) {\n const anchors = parseIntentFile(file, text).nodes.flatMap((node) => node.anchors);\n return anchors.length > 0 ? [...new Set(anchors)] : undefined;\n }\n return Array.isArray(data.tracks) ? (data.tracks as unknown[]) : undefined;\n}\n\nexport interface Drift {\n /** Commits on the tracked paths since the doc's last commit. */\n commits: number;\n threshold: number;\n /** The tracked paths: `tracks:`, or the union of an intent file's anchors. */\n tracked: string[];\n}\n\n/**\n * The drift of one doc, or `undefined` when it tracks nothing or was never\n * committed. Shared by the linter and the context graph.\n */\nexport function driftOf(repoRoot: string, file: string): Drift | undefined {\n const dir =\n TRACKED_DIRS.find((d) => file.startsWith(`${d}/`)) ??\n (file.startsWith(`${INTENTS_DIR}/`) ? INTENTS_DIR : undefined);\n if (!dir) return undefined;\n const text = readText(repoRoot, file);\n const { data } = parseFrontmatter(text);\n const tracks = trackedPaths(dir, file, text, data);\n if (!tracks) return undefined;\n const docCommit = gitLastCommitForPath(repoRoot, file);\n if (!docCommit) return undefined;\n const threshold =\n typeof data.driftThreshold === \"number\" && data.driftThreshold > 0\n ? data.driftThreshold\n : DEFAULT_DRIFT_THRESHOLD;\n let commits = 0;\n const tracked: string[] = [];\n for (const entry of tracks) {\n if (typeof entry !== \"string\") continue;\n tracked.push(entry);\n const targets = expandGlob(repoRoot, entry);\n for (const t of targets.length > 0 ? targets : [entry]) {\n commits += gitCommitsSince(repoRoot, t, docCommit.hash);\n }\n }\n return { commits, threshold, tracked };\n}\n\nexport const tracksDrift: Linter = {\n id: \"lint:tracks-drift\",\n pillars: [\"handbook\", \"tests\", \"workflow\", \"intents\"],\n defaultSeverity: \"warning\",\n suggestedSkills: [\"/harn-drift\", \"/harn-handbook\"],\n run(repoRoot: string): LintIssue[] {\n const issues: LintIssue[] = [];\n for (const dir of [...TRACKED_DIRS, INTENTS_DIR]) {\n for (const f of listMarkdown(repoRoot, dir)) {\n const drift = driftOf(repoRoot, f);\n if (!drift || drift.commits <= drift.threshold) continue;\n issues.push({\n linter: this.id,\n severity: \"warning\",\n file: f,\n message: `tracked files changed in ${drift.commits} commits since doc last edit (threshold ${drift.threshold})`,\n });\n }\n }\n return issues;\n },\n};\n","import { adrNoTracks } from \"./adr-no-tracks.js\";\nimport { cardinalFiles } from \"./cardinal-files.js\";\nimport { loadLintConfig } from \"./config.js\";\nimport { crossLinks } from \"./cross-links.js\";\nimport { decisionSchema } from \"./decision-schema.js\";\nimport { docLayout } from \"./doc-layout.js\";\nimport { frontmatterTracks } from \"./frontmatter-tracks.js\";\nimport { generatedFresh } from \"./generated-fresh.js\";\nimport { gitignoreHarness } from \"./gitignore-harness.js\";\nimport { intentAnchors } from \"./intent-anchors.js\";\nimport { intentGraph } from \"./intent-graph.js\";\nimport { intentProfiles } from \"./intent-profiles.js\";\nimport { intentSchema } from \"./intent-schema.js\";\nimport { intentVocabulary } from \"./intent-vocabulary.js\";\nimport { orphanDecisions } from \"./orphan-decisions.js\";\nimport { profileSchema } from \"./profile-schema.js\";\nimport { qualitySchema } from \"./quality-schema.js\";\nimport { readmePresence } from \"./readme-presence.js\";\nimport { readmeSections } from \"./readme-sections.js\";\nimport { specHasContent } from \"./spec-has-content.js\";\nimport { specTechAgnostic } from \"./spec-tech-agnostic.js\";\nimport { tracksDrift } from \"./tracks-drift.js\";\nimport type { LintContext, LintIssue, LintReport, Linter } from \"./types.js\";\n\nexport const ALL_LINTERS: ReadonlyArray<Linter> = [\n readmePresence,\n readmeSections,\n docLayout,\n cardinalFiles,\n decisionSchema,\n adrNoTracks,\n frontmatterTracks,\n tracksDrift,\n specTechAgnostic,\n specHasContent,\n crossLinks,\n orphanDecisions,\n gitignoreHarness,\n qualitySchema,\n intentSchema,\n intentAnchors,\n intentVocabulary,\n intentGraph,\n intentProfiles,\n profileSchema,\n generatedFresh,\n];\n\nexport interface RunOptions {\n pillar?: string;\n only?: ReadonlyArray<string>;\n}\n\nexport function runLinters(repoRoot: string, opts: RunOptions = {}): LintReport {\n const config = loadLintConfig(repoRoot);\n const ctx: LintContext = { repoRoot, config };\n const filtered = ALL_LINTERS.filter((l) => {\n if (opts.only && !opts.only.includes(l.id)) return false;\n if (opts.pillar && !l.pillars.includes(opts.pillar) && !l.pillars.includes(\"all\")) return false;\n return true;\n });\n const issues: LintIssue[] = [];\n for (const linter of filtered) {\n try {\n issues.push(...linter.run(repoRoot, ctx));\n } catch (err) {\n issues.push({\n linter: linter.id,\n severity: \"error\",\n file: \"<internal>\",\n message: `linter crashed: ${err instanceof Error ? err.message : String(err)}`,\n });\n }\n }\n const errors = issues.filter((i) => i.severity === \"error\").length;\n const warnings = issues.filter((i) => i.severity === \"warning\").length;\n return {\n version: 1,\n summary: { errors, warnings, pass: errors === 0 },\n issues,\n };\n}\n\nfunction suggestedSkillsFor(linterId: string): ReadonlyArray<string> {\n const linter = ALL_LINTERS.find((l) => l.id === linterId);\n return linter?.suggestedSkills ?? [];\n}\n\nexport function formatReportText(report: LintReport): string {\n const lines: string[] = [];\n for (const issue of report.issues) {\n const location = issue.line !== undefined ? `:${issue.line}` : \"\";\n lines.push(`${issue.file}${location}: ${issue.severity}[${issue.linter}]\\n ${issue.message}`);\n const hints = suggestedSkillsFor(issue.linter);\n if (hints.length > 0) {\n lines.push(` → Try: ${hints.join(\", \")}`);\n }\n }\n const { errors, warnings, pass } = report.summary;\n lines.push(\"\");\n lines.push(\n `${errors} ${errors === 1 ? \"error\" : \"errors\"}, ${warnings} ${warnings === 1 ? \"warning\" : \"warnings\"}. ${pass ? \"✔ CI passes.\" : \"✘ CI fails.\"}`,\n );\n return lines.join(\"\\n\");\n}\n\nexport type { HarnessLintConfig } from \"./config.js\";\nexport { loadLintConfig } from \"./config.js\";\nexport type { LintContext, Linter, LintIssue, LintReport, Severity } from \"./types.js\";\n","/**\n * The view (docs/spec/coding-agent-harness.md §10.4): one self-contained page\n * rendered from the context graph. Content lives in the markup; the inline\n * script only switches views, selects cards, pans and zooms, and, in a review\n * session, talks to the local server. No network request, deterministic bytes.\n */\nimport { createHash } from \"node:crypto\";\nimport type { LintIssue } from \"../linters/types.js\";\nimport { VIEW_SCRIPT, VIEW_STYLE } from \"./assets.js\";\nimport type { AttrValue, ContextGraph, GraphEdge, GraphNode, NodeType } from \"./graph.js\";\n\n// ------------------------------------------------------------------ session\n\nexport interface ThreadMessage {\n author: \"human\" | \"agent\";\n body: string;\n at: string;\n changes?: Array<{ path: string; line: number }>;\n}\n\nexport interface Thread {\n id: string;\n anchor: { nodeId: string; sourcePath: string; line: number };\n status: \"open\" | \"submitted\" | \"answered\" | \"resolved\";\n batch?: number;\n messages: ThreadMessage[];\n}\n\nexport interface JournalEntry {\n at: string;\n files: string[];\n errors: number;\n warnings: number;\n note?: string;\n}\n\n/** What a review session adds to the view; absent for the static page. */\nexport interface SessionView {\n id: string;\n /** The graph at the session start, for the differences. */\n base: ContextGraph;\n threads: Thread[];\n journal: JournalEntry[];\n /** Graph revision, bumped on each rebuild. */\n revision: number;\n}\n\nexport interface RenderOptions {\n session?: SessionView;\n /** Prefix of source links; the static page sits two levels under the repo root. */\n sourcePrefix?: string;\n}\n\n// ------------------------------------------------------------------ helpers\n\nexport function esc(text: string): string {\n return text\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\");\n}\n\n/** Inline code spans of a doc line as `<code>`, the rest escaped. */\nfunction md(text: string): string {\n return text\n .split(/(`[^`]+`)/g)\n .map((part) =>\n part.startsWith(\"`\") && part.endsWith(\"`\") && part.length > 1\n ? `<code>${esc(part.slice(1, -1))}</code>`\n : esc(part.replace(/\\*\\*([^*]+)\\*\\*/g, \"$1\").replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, \"$1\")),\n )\n .join(\"\");\n}\n\n/** A stable HTML id for a node id. */\nexport function htmlId(nodeId: string): string {\n return `n-${createHash(\"sha1\").update(nodeId).digest(\"hex\").slice(0, 10)}`;\n}\n\nfunction str(v: AttrValue | undefined): string | undefined {\n return typeof v === \"string\" ? v : undefined;\n}\nfunction num(v: AttrValue | undefined): number | undefined {\n return typeof v === \"number\" ? v : undefined;\n}\nfunction arr(v: AttrValue | undefined): string[] {\n return Array.isArray(v) ? v : [];\n}\nfunction drift(n: GraphNode): { commits: number; threshold: number } | undefined {\n const d = n.attrs.drift;\n if (d && typeof d === \"object\" && !Array.isArray(d)) {\n const commits = num(d.commits);\n const threshold = num(d.threshold);\n if (commits !== undefined && threshold !== undefined) return { commits, threshold };\n }\n return undefined;\n}\n\nfunction pill(text: string, tone: \"ok\" | \"warn\" | \"err\" | \"acc\" | \"mut\" = \"mut\"): string {\n return `<span class=\"pill p-${tone}\">${esc(text)}</span>`;\n}\n\nfunction statusPill(status: string | undefined): string {\n if (!status) return \"\";\n const tone = status === \"implemented\" ? \"ok\" : status === \"proposed\" ? \"warn\" : \"mut\";\n return pill(status, tone);\n}\n\nfunction driftPill(n: GraphNode): string {\n const d = drift(n);\n if (!d) return \"\";\n const tone = d.commits > d.threshold ? \"err\" : d.commits >= d.threshold * 0.8 ? \"warn\" : \"ok\";\n return pill(`drift ${d.commits}/${d.threshold}`, tone);\n}\n\nfunction issuesPill(issues: ReadonlyArray<LintIssue>): string {\n if (issues.length === 0) return \"\";\n const errors = issues.filter((i) => i.severity === \"error\").length;\n return errors\n ? pill(`${errors} error${errors > 1 ? \"s\" : \"\"}`, \"err\")\n : pill(`${issues.length} warning${issues.length > 1 ? \"s\" : \"\"}`, \"warn\");\n}\n\nconst TYPE_LABEL: Record<NodeType, string> = {\n readme: \"README\",\n spec: \"spec\",\n section: \"section\",\n term: \"term\",\n decision: \"decision\",\n alternative: \"rejected alternative\",\n handbook: \"handbook\",\n \"test-plan\": \"test plan\",\n \"known-gap\": \"known gap\",\n workflow: \"workflow\",\n quality: \"quality\",\n doc: \"doc\",\n \"intent-file\": \"level-1 intent\",\n intent: \"intent\",\n linter: \"linter\",\n skill: \"skill\",\n command: \"command\",\n \"rendered-file\": \"generated file\",\n path: \"path\",\n glob: \"glob\",\n lesson: \"lesson\",\n};\n\nclass Index {\n readonly byId = new Map<string, GraphNode>();\n readonly out = new Map<string, GraphEdge[]>();\n readonly in = new Map<string, GraphEdge[]>();\n constructor(readonly graph: ContextGraph) {\n for (const n of graph.nodes) this.byId.set(n.id, n);\n for (const e of graph.edges) {\n this.out.set(e.from, [...(this.out.get(e.from) ?? []), e]);\n this.in.set(e.to, [...(this.in.get(e.to) ?? []), e]);\n }\n }\n of(type: NodeType): GraphNode[] {\n return this.graph.nodes.filter((n) => n.type === type);\n }\n outOf(id: string, type?: GraphEdge[\"type\"]): GraphEdge[] {\n return (this.out.get(id) ?? []).filter((e) => !type || e.type === type);\n }\n inOf(id: string, type?: GraphEdge[\"type\"]): GraphEdge[] {\n return (this.in.get(id) ?? []).filter((e) => !type || e.type === type);\n }\n}\n\ntype DiffState = \"add\" | \"chg\" | \"del\" | undefined;\n\nfunction signature(n: GraphNode): string {\n return JSON.stringify([n.title, n.attrs, n.issues.map((i) => `${i.linter}|${i.message}`)]);\n}\n\n// --------------------------------------------------------------- the canvas\n//\n// A map, not an inventory: one card per document, grouped by pillar, with\n// the links between documents drawn at rest. Terms, code paths, rejected\n// alternatives and lint issues are counts on their document's card.\n// Selecting a card shows its focus layer: every neighbour, grouped by\n// relation, next to the card; the rest of the map fades.\n\nconst MAP_TYPES: ReadonlyArray<NodeType> = [\n \"readme\",\n \"spec\",\n \"decision\",\n \"handbook\",\n \"test-plan\",\n \"workflow\",\n \"quality\",\n \"doc\",\n \"intent-file\",\n];\nconst HARNESS_LINTERS = \"harness:linters\";\nconst HARNESS_SKILLS = \"harness:skills\";\n\nconst CARD_W = 214;\nconst CARD_H = 100;\nconst GAP = 10;\nconst FRAME_PAD = 14;\nconst FRAME_HEAD = 30;\nconst FRAME_GAP = 30;\nconst ITEM_W = 196;\nconst ITEM_H = 34;\nconst ITEM_GAP = 6;\nconst BLOCK_ROWS = 10;\nconst FOCUS_ROW_W = 1100;\n\ninterface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** The map card a node belongs to: itself, its document, or a harness card. */\nfunction mapOf(ix: Index, id: string): string | undefined {\n let n = ix.byId.get(id);\n while (n) {\n if (MAP_TYPES.includes(n.type)) return n.id;\n if (n.type === \"linter\") return HARNESS_LINTERS;\n if (n.type === \"skill\" || n.type === \"command\") return HARNESS_SKILLS;\n n = n.parent ? ix.byId.get(n.parent) : undefined;\n }\n return undefined;\n}\n\n/** A document and everything that belongs to it. */\nfunction familyOf(ix: Index, docId: string): GraphNode[] {\n return ix.graph.nodes.filter(\n (n) => n.id === docId || (n.id !== docId && mapOf(ix, n.id) === docId),\n );\n}\n\nfunction worstDiff(states: DiffState[]): DiffState {\n if (states.includes(\"del\")) return states.every((s) => s === \"del\") ? \"del\" : \"chg\";\n if (states.includes(\"add\")) return states.every((s) => s === \"add\") ? \"add\" : \"chg\";\n return states.includes(\"chg\") ? \"chg\" : undefined;\n}\n\ninterface MapFrame {\n title: string;\n domain: \"project\" | \"harness\";\n cards: GraphNode[];\n}\n\nfunction mapFrames(ix: Index, removed: GraphNode[]): MapFrame[] {\n const all = [...ix.graph.nodes, ...removed.filter((n) => MAP_TYPES.includes(n.type))];\n const pick = (types: NodeType[]) => all.filter((n) => types.includes(n.type));\n return [\n { title: \"Intents\", domain: \"project\" as const, cards: pick([\"intent-file\"]) },\n { title: \"README & spec\", domain: \"project\" as const, cards: pick([\"readme\", \"spec\"]) },\n { title: \"Decisions\", domain: \"project\" as const, cards: pick([\"decision\"]) },\n { title: \"Handbook\", domain: \"project\" as const, cards: pick([\"handbook\"]) },\n {\n title: \"Tests, workflow, quality\",\n domain: \"project\" as const,\n cards: pick([\"test-plan\", \"workflow\", \"quality\"]),\n },\n { title: \"Other docs\", domain: \"project\" as const, cards: pick([\"doc\"]) },\n ].filter((f) => f.cards.length > 0);\n}\n\nfunction count(n: number, one: string, many = `${one}s`): string {\n return `${n} ${n === 1 ? one : many}`;\n}\n\n/** The summary of a document card: counts of what belongs to it. */\nfunction mapCardBody(n: GraphNode, ix: Index, family: GraphNode[]): string {\n const of = (t: NodeType) => family.filter((m) => m.type === t);\n const sub: string[] = [];\n const pills: string[] = [];\n switch (n.type) {\n case \"intent-file\": {\n const terminals = of(\"intent\").filter((m) => m.attrs.terminal === true);\n const proposed = terminals.filter((m) => m.attrs.effectiveStatus === \"proposed\").length;\n const done = num(n.attrs.done) ?? 0;\n const total = num(n.attrs.total) ?? terminals.length;\n sub.push(`${done}/${total} delivered`);\n if (proposed) pills.push(pill(`${proposed} proposed`, \"warn\"));\n pills.push(\n total\n ? `<span class=\"bar\" title=\"${done}/${total}\"><i style=\"width:${Math.round((done / total) * 100)}%\"></i></span>`\n : \"\",\n );\n break;\n }\n case \"spec\":\n sub.push(`${count(of(\"term\").length, \"term\")} · ${count(of(\"section\").length, \"section\")}`);\n break;\n case \"decision\": {\n const refs = ix.inOf(n.id, \"links-to\").length;\n sub.push(count(of(\"alternative\").length, \"alternative\"));\n pills.push(pill(`cited ×${refs}`, refs <= 1 ? \"warn\" : \"mut\"));\n break;\n }\n case \"handbook\":\n case \"test-plan\":\n case \"workflow\": {\n const gaps = of(\"known-gap\").length;\n sub.push(\n `tracks ${count(ix.outOf(n.id, \"tracks\").length, \"path\")}${gaps ? ` · ${count(gaps, \"known gap\")}` : \"\"}`,\n );\n pills.push(driftPill(n));\n break;\n }\n default:\n sub.push(n.sourcePath);\n }\n pills.push(issuesPill(family.flatMap((m) => m.issues)));\n return `<span class=\"k\">${esc(TYPE_LABEL[n.type])}</span><span class=\"t\">${md(n.title)}</span><span class=\"s\">${esc(sub.join(\" · \"))}</span><span class=\"row\">${pills.join(\"\")}</span>`;\n}\n\ninterface FocusGroup {\n label: string;\n items: Array<{ node: GraphNode; note?: string; indent?: number }>;\n}\n\n/** The neighbours of a document, grouped by relation. */\nfunction focusGroups(ix: Index, doc: GraphNode, family: GraphNode[]): FocusGroup[] {\n const inFamily = new Set(family.map((n) => n.id));\n const groups = new Map<\n string,\n Map<string, { node: GraphNode; note?: string; indent?: number }>\n >();\n const add = (label: string, node: GraphNode | undefined, note?: string, indent?: number) => {\n if (!node || node.id === doc.id) return;\n const g = groups.get(label) ?? new Map();\n if (!g.has(node.id))\n g.set(node.id, {\n node,\n ...(note ? { note } : {}),\n ...(indent !== undefined ? { indent } : {}),\n });\n groups.set(label, g);\n };\n /** A neighbour inside another document is shown as that document; terms, and intents using words, stay themselves. */\n const other = (id: string, keepIntent = false) => {\n const n = ix.byId.get(id);\n if (!n) return undefined;\n if (n.type === \"term\" || (keepIntent && n.type === \"intent\")) return n;\n const m = mapOf(ix, id);\n return m && m !== HARNESS_LINTERS && m !== HARNESS_SKILLS ? ix.byId.get(m) : n;\n };\n // What belongs to the document.\n const contents: Record<string, NodeType> = {\n \"intent-file\": \"intent\",\n spec: \"term\",\n decision: \"alternative\",\n \"test-plan\": \"known-gap\",\n };\n const child = contents[doc.type];\n if (child) {\n const label = {\n intent: \"Intents\",\n term: \"Vocabulary\",\n alternative: \"Rejected alternatives\",\n \"known-gap\": \"Known gaps\",\n }[child as \"intent\"];\n for (const n of family.filter((m) => m.type === child).sort((a, b) => a.line - b.line)) {\n add(\n label,\n n,\n n.type === \"intent\" && n.attrs.terminal === true ? str(n.attrs.effectiveStatus) : undefined,\n n.type === \"intent\" ? (num(n.attrs.level) ?? 1) - 1 : undefined,\n );\n }\n }\n for (const m of family) {\n for (const e of ix.outOf(m.id)) {\n if (inFamily.has(e.to) || e.type === \"contains\") continue;\n const label = {\n \"links-to\": \"Cites\",\n spec: \"Cites\",\n tracks: \"Tracks\",\n anchors: \"Code anchors\",\n requires: \"Uses words\",\n creates: \"Uses words\",\n }[e.type as \"spec\"];\n if (label)\n add(\n label,\n other(e.to),\n e.type === \"creates\" ? \"creates\" : e.type === \"requires\" ? \"requires\" : undefined,\n );\n }\n for (const e of ix.inOf(m.id)) {\n if (inFamily.has(e.from) || e.type === \"contains\") continue;\n const label = {\n \"links-to\": \"Cited by\",\n spec: \"Cited by\",\n requires: \"Words used by\",\n creates: \"Words used by\",\n checks: \"Checked by\",\n }[e.type as \"spec\"];\n if (label)\n add(\n label,\n other(e.from, e.type === \"requires\" || e.type === \"creates\"),\n e.type === \"creates\" ? \"creates\" : e.type === \"requires\" ? \"requires\" : undefined,\n );\n }\n }\n const order = [\n \"Intents\",\n \"Vocabulary\",\n \"Rejected alternatives\",\n \"Known gaps\",\n \"Cites\",\n \"Cited by\",\n \"Uses words\",\n \"Words used by\",\n \"Tracks\",\n \"Code anchors\",\n \"Checked by\",\n ];\n return order\n .filter((l) => groups.has(l))\n .map((label) => ({ label, items: [...(groups.get(label)?.values() ?? [])] }));\n}\n\nfunction focusItem(\n it: { node: GraphNode; note?: string; indent?: number },\n x: number,\n y: number,\n diff: Map<string, DiffState>,\n ix: Index,\n): string {\n const n = it.node;\n const isDoc = MAP_TYPES.includes(n.type);\n const cls = [\"fi\", `t-${n.type}`, `d-${n.domain}`];\n const state = isDoc ? worstDiff(familyOf(ix, n.id).map((m) => diff.get(m.id))) : diff.get(n.id);\n if (state) cls.push(`is-${state}`);\n if (\n n.issues.some((i) => i.severity === \"error\") ||\n n.attrs.exists === false ||\n n.attrs.defined === false\n )\n cls.push(\"has-err\");\n const indent = (it.indent ?? 0) * 12;\n const tone = it.note === \"implemented\" ? \"ok\" : it.note === \"proposed\" ? \"warn\" : \"mut\";\n return `<a class=\"${cls.join(\" \")}\" href=\"#${htmlId(n.id)}\" data-n=\"${htmlId(n.id)}\"${isDoc ? ' data-doc=\"1\"' : \"\"} style=\"left:${x + indent}px;top:${y}px;width:${ITEM_W - indent}px\"><span class=\"t\">${md(n.title)}</span>${it.note === \"implemented\" || it.note === \"proposed\" ? `<i class=\"dot ${tone}\" title=\"${esc(it.note)}\"></i>` : it.note ? `<span class=\"k\">${esc(it.note)}</span>` : `<span class=\"k\">${esc(TYPE_LABEL[n.type])}</span>`}</a>`;\n}\n\nfunction renderFocus(\n ix: Index,\n doc: GraphNode,\n at: Box,\n family: GraphNode[],\n diff: Map<string, DiffState>,\n): { html: string; box: Box } {\n const groups = focusGroups(ix, doc, family);\n const parts: string[] = [];\n const lines: string[] = [];\n const x0 = at.x + at.w + 90;\n let x = x0;\n let top = at.y - 20;\n let rowH = 0;\n let right = x0;\n let bottom = at.y + at.h;\n for (const g of groups) {\n const cols = Math.ceil(g.items.length / BLOCK_ROWS);\n const rows = Math.min(BLOCK_ROWS, g.items.length);\n const w = cols * (ITEM_W + ITEM_GAP) - ITEM_GAP + 2 * 10;\n const h = 28 + rows * (ITEM_H + ITEM_GAP) + 6;\n if (x > x0 && x + w > x0 + FOCUS_ROW_W) {\n x = x0;\n top += rowH + 24;\n rowH = 0;\n }\n parts.push(\n `<div class=\"fb\" style=\"left:${x}px;top:${top}px;width:${w}px;height:${h}px\"><span class=\"fbt\">${esc(g.label)} <i>${g.items.length}</i></span></div>`,\n );\n g.items.forEach((it, i) => {\n const col = Math.floor(i / BLOCK_ROWS);\n const row = i % BLOCK_ROWS;\n parts.push(\n focusItem(\n it,\n x + 10 + col * (ITEM_W + ITEM_GAP),\n top + 28 + row * (ITEM_H + ITEM_GAP),\n diff,\n ix,\n ),\n );\n });\n const x1 = at.x + at.w;\n const y1 = at.y + at.h / 2;\n const y2 = top + 14;\n lines.push(`<path d=\"M${x1} ${y1} C${x1 + 50} ${y1},${x - 50} ${y2},${x} ${y2}\"/>`);\n rowH = Math.max(rowH, h);\n right = Math.max(right, x + w);\n bottom = Math.max(bottom, top + h);\n x += w + 24;\n }\n const start = at.y - 20;\n const box = {\n x: at.x - 20,\n y: Math.min(start, at.y) - 20,\n w: right - at.x + 40,\n h: bottom - start + 40,\n };\n const empty = groups.length\n ? \"\"\n : `<div class=\"fb fb-empty\" style=\"left:${at.x + at.w + 90}px;top:${at.y}px;width:220px;height:${at.h}px\"><span class=\"fbt\">Linked to nothing</span></div>`;\n return {\n html: `<div class=\"focus\" data-for=\"${htmlId(doc.id)}\" data-box=\"${box.x},${box.y},${box.w},${box.h}\"><svg class=\"fl\" aria-hidden=\"true\">${lines.join(\"\")}</svg>${parts.join(\"\")}${empty}</div>`,\n box,\n };\n}\n\nfunction renderCanvas(ix: Index, diff: Map<string, DiffState>, removed: GraphNode[]): string {\n const placed = new Map<string, Box>();\n const frameHtml: string[] = [];\n const cards: string[] = [];\n const focus: string[] = [];\n const families = new Map<string, GraphNode[]>();\n const famOf = (n: GraphNode) => {\n const f = families.get(n.id) ?? (ix.byId.has(n.id) ? familyOf(ix, n.id) : [n]);\n families.set(n.id, f);\n return f;\n };\n type Item = { id: string; html: (b: Box) => string };\n const specs: Array<{ title: string; domain: string; items: Item[] }> = mapFrames(ix, removed).map(\n (f) => ({\n title: f.title,\n domain: f.domain,\n items: f.cards.map((n) => ({\n id: n.id,\n html: (b: Box) => {\n const family = famOf(n);\n const state = worstDiff(family.map((m) => diff.get(m.id)));\n const cls = [\"n\", `t-${n.type}`, `d-${n.domain}`];\n if (state) cls.push(`is-${state}`);\n if (family.some((m) => m.issues.some((i) => i.severity === \"error\"))) cls.push(\"has-err\");\n const tag = state\n ? `<span class=\"diff-tag\">${state === \"add\" ? \"added\" : state === \"chg\" ? \"changed\" : \"removed\"}</span>`\n : \"\";\n const q = family\n .map((m) => m.title)\n .join(\" \")\n .toLowerCase();\n if (ix.byId.has(n.id)) focus.push(renderFocus(ix, n, b, family, diff).html);\n return `<a class=\"${cls.join(\" \")}\" id=\"c-${htmlId(n.id).slice(2)}\" href=\"#${htmlId(n.id)}\" data-n=\"${htmlId(n.id)}\" data-q=\"${esc(`${q} ${n.sourcePath}`.toLowerCase())}\" style=\"left:${b.x}px;top:${b.y}px;width:${b.w}px;height:${b.h}px\">${tag}${mapCardBody(n, ix, family)}</a>`;\n },\n })),\n }),\n );\n // The harness: two cards that open their views.\n const linters = ix.of(\"linter\");\n const skills = ix.of(\"skill\");\n const lintIssues = linters.reduce((s, l) => s + (num(l.attrs.issues) ?? 0), 0);\n specs.push({\n title: \"Harness\",\n domain: \"harness\",\n items: [\n {\n id: HARNESS_LINTERS,\n html: (b) =>\n `<a class=\"n t-harness d-harness\" href=\"#view-linters\" data-tab=\"linters\" style=\"left:${b.x}px;top:${b.y}px;width:${b.w}px;height:${b.h}px\"><span class=\"k\">harness</span><span class=\"t\">Linters</span><span class=\"s\">${esc(count(linters.length, \"linter\"))}</span><span class=\"row\">${pill(`${lintIssues} issues`, lintIssues ? \"err\" : \"ok\")}</span></a>`,\n },\n {\n id: HARNESS_SKILLS,\n html: (b) =>\n `<a class=\"n t-harness d-harness\" href=\"#view-skills\" data-tab=\"skills\" style=\"left:${b.x}px;top:${b.y}px;width:${b.w}px;height:${b.h}px\"><span class=\"k\">harness</span><span class=\"t\">Skills</span><span class=\"s\">${esc(`${count(skills.length, \"skill\")} · ${count(ix.of(\"command\").length, \"command\")}`)}</span><span class=\"row\"></span></a>`,\n },\n ],\n });\n // Shelf packing of the frames; the layout that is read at the highest zoom\n // on a 16:10 screen wins. Deterministic: candidates in a fixed order.\n const layout = (shelfW: number, ratio: number) => {\n let x = 20;\n let y = 20;\n let shelfH = 0;\n let maxX = 0;\n const frames = specs.map((f) => {\n const n = f.items.length;\n const cols = Math.max(1, Math.min(n, Math.round(Math.sqrt(n * ratio))));\n const rows = Math.ceil(n / cols);\n const w = 2 * FRAME_PAD + cols * CARD_W + (cols - 1) * GAP;\n const h = FRAME_HEAD + FRAME_PAD + rows * CARD_H + (rows - 1) * GAP;\n if (x > 20 && x + w > shelfW) {\n x = 20;\n y += shelfH + FRAME_GAP;\n shelfH = 0;\n }\n const at = { x, y, w, h, cols };\n x += w + FRAME_GAP;\n shelfH = Math.max(shelfH, h);\n maxX = Math.max(maxX, at.x + w);\n return at;\n });\n const W = maxX + 40;\n const H = y + shelfH + 40;\n return { frames, W, H, scale: Math.min(1440 / W, 860 / H) };\n };\n let best = layout(1640, 1.6);\n for (let r = 2; r <= 20; r++) {\n const ratio = r / 4;\n for (let shelfW = 1000; shelfW <= 3600; shelfW += 50) {\n const l = layout(shelfW, ratio);\n if (l.scale > best.scale + 1e-9) best = l;\n }\n }\n specs.forEach((f, k) => {\n const at = best.frames[k];\n if (!at) return;\n frameHtml.push(\n `<div class=\"frame f-${f.domain}\" style=\"left:${at.x}px;top:${at.y}px;width:${at.w}px;height:${at.h}px\"><span class=\"ft\">${esc(f.title)} <i>${f.items.length}</i></span></div>`,\n );\n f.items.forEach((it, i) => {\n const b = {\n x: at.x + FRAME_PAD + (i % at.cols) * (CARD_W + GAP),\n y: at.y + FRAME_HEAD + Math.floor(i / at.cols) * (CARD_H + GAP),\n w: CARD_W,\n h: CARD_H,\n };\n placed.set(it.id, b);\n cards.push(it.html(b));\n });\n });\n const worldW = best.W;\n const worldH = best.H;\n // Links between documents, one line per pair, at rest.\n const pairs = new Map<string, { a: string; b: string; n: number }>();\n for (const e of ix.graph.edges) {\n if (![\"links-to\", \"spec\", \"requires\", \"creates\", \"suggests\", \"checks\"].includes(e.type))\n continue;\n if (e.type === \"checks\") continue;\n const a = mapOf(ix, e.from);\n const b = mapOf(ix, e.to);\n if (!a || !b || a === b) continue;\n const [p, q] = a < b ? [a, b] : [b, a];\n const key = `${p}\\u0000${q}`;\n const cur = pairs.get(key) ?? { a: p, b: q, n: 0 };\n cur.n += 1;\n pairs.set(key, cur);\n }\n const edges: string[] = [];\n for (const { a, b, n } of [...pairs.values()].sort((x, y) => (x.a + x.b < y.a + y.b ? -1 : 1))) {\n const A = placed.get(a);\n const B = placed.get(b);\n if (!A || !B) continue;\n const ax = A.x + A.w / 2;\n const ay = A.y + A.h / 2;\n const bx = B.x + B.w / 2;\n const by = B.y + B.h / 2;\n const mx = (ax + bx) / 2;\n const my = (ay + by) / 2 - Math.min(80, Math.abs(bx - ax) / 6);\n const ida = a.startsWith(\"harness:\") ? a : htmlId(a);\n const idb = b.startsWith(\"harness:\") ? b : htmlId(b);\n edges.push(\n `<path class=\"me\" data-a=\"${ida}\" data-b=\"${idb}\" stroke-width=\"${(1 + Math.log2(n)).toFixed(2)}\" d=\"M${ax} ${ay} Q${mx} ${my} ${bx} ${by}\"><title>${n} link${n > 1 ? \"s\" : \"\"}</title></path>`,\n );\n }\n return `<div class=\"cv\" id=\"cv\" data-view=\"now\" tabindex=\"0\" aria-label=\"Context map\">\n<div class=\"cv-world\" id=\"world\" style=\"width:${worldW}px;height:${worldH}px\">\n<svg class=\"edges\" width=\"${worldW}\" height=\"${worldH}\" aria-hidden=\"true\">${edges.join(\"\")}</svg>\n${frameHtml.join(\"\\n\")}\n${cards.join(\"\\n\")}\n<div class=\"focus-layers\">${focus.join(\"\\n\")}</div>\n</div>\n<p class=\"cv-hint\">Select a card to see what it is linked to. Esc or a click on the background returns to the map.</p>\n<div class=\"cv-tools\"><button type=\"button\" data-zoom=\"out\" aria-label=\"Zoom out\">−</button><button type=\"button\" data-zoom=\"fit\">Fit</button><button type=\"button\" data-zoom=\"in\" aria-label=\"Zoom in\">+</button></div>\n</div>`;\n}\n\n// ------------------------------------------------------------ detail panels\n\nfunction sourceLink(n: GraphNode, prefix: string): string {\n if (n.domain === \"harness\" || !n.sourcePath || n.type === \"glob\")\n return `<span class=\"mono\">${esc(n.sourcePath)}</span>`;\n const where = n.line > 0 ? `${n.sourcePath}:${n.line}` : n.sourcePath;\n return `<a class=\"mono src\" href=\"${esc(prefix + n.sourcePath)}\">${esc(where)}</a>`;\n}\n\nfunction nodeRef(ix: Index, id: string): string {\n const n = ix.byId.get(id);\n if (!n) return esc(id);\n return `<a href=\"#${htmlId(id)}\" data-n=\"${htmlId(id)}\">${md(n.title)}</a> <span class=\"k\">${esc(TYPE_LABEL[n.type])}</span>`;\n}\n\nfunction attrRows(n: GraphNode): string {\n const rows: string[] = [];\n const add = (k: string, v: string) => rows.push(`<dt>${esc(k)}</dt><dd>${v}</dd>`);\n const a = n.attrs;\n if (str(a.lede) && !str(a.statement)) add(\"Says\", md(str(a.lede) ?? \"\"));\n if (str(a.statement)) add(\"Statement\", md(str(a.statement) ?? \"\"));\n if (str(a.definition)) add(\"Definition\", md(str(a.definition) ?? \"\"));\n if (str(a.decision)) add(\"Decision\", md(str(a.decision) ?? \"\"));\n if (str(a.text) && n.type !== \"known-gap\") add(\"Text\", md(str(a.text) ?? \"\"));\n if (str(a.description)) add(\"Description\", md(str(a.description) ?? \"\"));\n if (str(a.status) || str(a.effectiveStatus))\n add(\"Status\", statusPill(str(a.status) ?? str(a.effectiveStatus)));\n if (arr(a.actors).length) add(\"Actors\", esc(arr(a.actors).join(\", \")));\n const d = drift(n);\n if (d) add(\"Drift\", `${driftPill(n)} commits on the tracked files since this doc's last commit`);\n if (str(a.lastReviewed)) add(\"Reviewed\", esc(str(a.lastReviewed) ?? \"\"));\n const acc = arr(a.acceptance);\n if (acc.length) add(\"Acceptance\", `<ul>${acc.map((c) => `<li>${md(c)}</li>`).join(\"\")}</ul>`);\n if (arr(a.missingSections).length) add(\"Missing\", esc(arr(a.missingSections).join(\", \")));\n if (arr(a.pillars).length) add(\"Pillars\", esc(arr(a.pillars).join(\", \")));\n if (str(a.severity)) add(\"Severity\", esc(str(a.severity) ?? \"\"));\n if (str(a.layer))\n add(\n \"Layer\",\n esc(`${str(a.layer)}${str(a.replaces) ? ` (replaces the ${str(a.replaces)} one)` : \"\"}`),\n );\n if (arr(a.tags).length) add(\"Tags\", esc(arr(a.tags).join(\", \")));\n if (arr(a.requires).length) add(\"Needs\", esc(arr(a.requires).join(\", \")));\n if (num(a.lines)) add(\"Lines\", String(num(a.lines)));\n if (typeof a.exists === \"boolean\")\n add(\"Exists\", a.exists ? pill(\"yes\", \"ok\") : pill(\"no\", \"err\"));\n if (num(a.matches) !== undefined) add(\"Matches\", `${num(a.matches)} files`);\n if (str(a.engine)) add(\"Engine\", esc(str(a.engine) ?? \"\"));\n if (str(a.pillar)) add(\"Goes to\", esc(str(a.pillar) ?? \"\"));\n if (arr(a.evidence).length)\n add(\n \"Evidence\",\n `<ul>${arr(a.evidence)\n .map((e) => `<li>${md(e)}</li>`)\n .join(\"\")}</ul>`,\n );\n return rows.length ? `<dl>${rows.join(\"\")}</dl>` : \"\";\n}\n\nfunction edgeList(ix: Index, n: GraphNode): string {\n const groups = new Map<string, string[]>();\n const push = (label: string, item: string) =>\n groups.set(label, [...(groups.get(label) ?? []), item]);\n const OUT: Record<string, string> = {\n tracks: \"Tracks\",\n anchors: \"Anchored in\",\n requires: \"Requires\",\n creates: \"Creates\",\n spec: \"Spec\",\n \"links-to\": \"Links to\",\n \"gap-of\": \"Gap of\",\n checks: \"Checks\",\n suggests: \"Suggests\",\n invokes: \"Invokes\",\n \"renders-to\": \"Rendered to\",\n contains: \"Contains\",\n };\n const IN: Record<string, string> = {\n tracks: \"Tracked by\",\n anchors: \"Anchor of\",\n requires: \"Required by\",\n creates: \"Created by\",\n spec: \"Spec of\",\n \"links-to\": \"Cited by\",\n \"gap-of\": \"Known gaps\",\n checks: \"Checked by\",\n suggests: \"Suggested by\",\n invokes: \"Command\",\n \"renders-to\": \"Rendered from\",\n contains: \"Part of\",\n };\n for (const e of ix.outOf(n.id)) push(OUT[e.type] ?? e.type, nodeRef(ix, e.to));\n for (const e of ix.inOf(n.id)) push(IN[e.type] ?? e.type, nodeRef(ix, e.from));\n if (!groups.size) return \"\";\n return `<dl class=\"rel\">${[...groups.entries()]\n .map(\n ([k, items]) =>\n `<dt>${esc(k)} <span class=\"k\">${items.length}</span></dt><dd><ul>${items.map((i) => `<li>${i}</li>`).join(\"\")}</ul></dd>`,\n )\n .join(\"\")}</dl>`;\n}\n\nfunction issueList(issues: ReadonlyArray<LintIssue>): string {\n if (!issues.length) return \"\";\n return `<ul class=\"issues\">${issues\n .map(\n (i) =>\n `<li class=\"sev-${i.severity}\">${pill(i.severity, i.severity === \"error\" ? \"err\" : \"warn\")} <span class=\"mono\">${esc(i.linter)}</span>${i.line !== undefined ? ` <span class=\"k\">line ${i.line}</span>` : \"\"}<br>${esc(i.message)}</li>`,\n )\n .join(\"\")}</ul>`;\n}\n\nfunction threadHtml(t: Thread, ix: Index): string {\n return `<article class=\"thread st-${t.status}\" id=\"t-${esc(t.id)}\"><header>${pill(t.status, t.status === \"answered\" ? \"acc\" : t.status === \"resolved\" ? \"ok\" : t.status === \"submitted\" ? \"warn\" : \"mut\")} <span class=\"k\">${esc(t.id)}</span> ${nodeRef(ix, t.anchor.nodeId)}</header>${t.messages\n .map(\n (m) =>\n `<div class=\"msg m-${m.author}\"><span class=\"who\">${m.author === \"human\" ? \"you\" : \"agent\"}</span><p>${esc(m.body)}</p>${(m.changes ?? []).map((c) => `<span class=\"mono chg\">${esc(`${c.path}:${c.line}`)}</span>`).join(\" \")}</div>`,\n )\n .join(\"\")}${\n t.status === \"answered\" || t.status === \"open\"\n ? `<form class=\"reply\" data-thread=\"${esc(t.id)}\"><label class=\"sr\" for=\"r-${esc(t.id)}\">Reply</label><textarea id=\"r-${esc(t.id)}\" rows=\"2\" placeholder=\"Reply\"></textarea><div class=\"btns\"><button type=\"submit\">Reply</button>${t.status === \"answered\" ? `<button type=\"button\" data-resolve=\"${esc(t.id)}\">Resolve</button>` : \"\"}</div></form>`\n : \"\"\n }</article>`;\n}\n\nfunction renderDetails(\n ix: Index,\n prefix: string,\n removed: GraphNode[],\n session?: SessionView,\n): string {\n const threadsOf = new Map<string, Thread[]>();\n for (const t of session?.threads ?? [])\n threadsOf.set(t.anchor.nodeId, [...(threadsOf.get(t.anchor.nodeId) ?? []), t]);\n const all = [...ix.graph.nodes, ...removed];\n return all\n .map((n) => {\n const domainLabel =\n n.domain === \"harness\" ? \"harness (read-only: change it upstream)\" : n.domain;\n const threads = threadsOf.get(n.id) ?? [];\n const comment = session\n ? `<section class=\"comments\"><h4>Comments</h4>${threads.map((t) => threadHtml(t, ix)).join(\"\")}<form class=\"comment\" data-node=\"${esc(n.id)}\"><label class=\"sr\" for=\"cm-${htmlId(n.id)}\">Comment on this card</label><textarea id=\"cm-${htmlId(n.id)}\" rows=\"3\" placeholder=\"${n.domain === \"harness\" ? \"Comment: the agent drafts an upstream issue\" : \"Comment: the agent changes the source\"}\"></textarea><button type=\"submit\">Add comment</button></form></section>`\n : \"\";\n return `<article class=\"detail\" id=\"${htmlId(n.id)}\" data-node=\"${esc(n.id)}\"${(() => {\n const m = mapOf(ix, n.id);\n return m && !m.startsWith(\"harness:\") ? ` data-map=\"${htmlId(m)}\"` : \"\";\n })()}><header><span class=\"k\">${esc(TYPE_LABEL[n.type])} · ${esc(domainLabel)}</span><h3>${md(n.title)}</h3>${sourceLink(n, prefix)}</header>${issueList(n.issues)}${attrRows(n)}${edgeList(ix, n)}${comment}</article>`;\n })\n .join(\"\\n\");\n}\n\n// ------------------------------------------------------------------- views\n\nfunction overview(ix: Index): string {\n const g = ix.graph;\n const terminals = ix.of(\"intent\").filter((n) => n.attrs.terminal === true);\n const delivered = terminals.filter((n) => n.attrs.effectiveStatus === \"implemented\").length;\n const proposed = terminals.filter((n) => n.attrs.effectiveStatus === \"proposed\");\n const tracked = g.nodes.filter((n) => drift(n));\n const maxDrift = tracked.reduce((m, n) => Math.max(m, drift(n)?.commits ?? 0), 0);\n const decisions = ix.of(\"decision\");\n const orphans = decisions.filter((d) => ix.inOf(d.id, \"links-to\").length === 0).length;\n const unresolved = g.nodes.filter(\n (n) => (n.type === \"path\" || n.type === \"glob\") && n.attrs.exists === false,\n ).length;\n const tile = (label: string, value: string, sub: string, tone = \"\") =>\n `<div class=\"tile ${tone}\"><span class=\"tl\">${esc(label)}</span><span class=\"tv\">${esc(value)}</span><span class=\"ts\">${esc(sub)}</span></div>`;\n const review = [...tracked]\n .sort((a, b) => {\n const ra = (drift(a)?.commits ?? 0) / (drift(a)?.threshold ?? 1);\n const rb = (drift(b)?.commits ?? 0) / (drift(b)?.threshold ?? 1);\n return rb - ra || (a.id < b.id ? -1 : 1);\n })\n .slice(0, 6);\n return `<section class=\"view\" id=\"view-overview\" data-title=\"Overview\"><h2>State of the context</h2>\n<div class=\"tiles\">\n${tile(\"Lint\", g.lint.ran ? `${g.lint.errors} · ${g.lint.warnings}` : \"not run\", \"errors · warnings\", g.lint.errors ? \"bad\" : \"\")}\n${tile(\"Intents\", `${delivered}/${terminals.length}`, `terminal intents delivered, ${proposed.length} proposed`)}\n${tile(\"Tracked docs\", String(tracked.length), `highest drift ${maxDrift} commits`)}\n${tile(\"Decisions\", String(decisions.length), `${orphans} cited by no doc`, orphans ? \"warn\" : \"\")}\n${tile(\"Pointers\", String(ix.of(\"path\").length + ix.of(\"glob\").length), `${unresolved} do not resolve`, unresolved ? \"bad\" : \"\")}\n</div>\n<div class=\"cols\"><div class=\"panel\"><h3>Review first</h3><p class=\"k\">Tracked docs closest to their drift threshold.</p><ul class=\"list\">${review\n .map((n) => `<li>${driftPill(n)} ${nodeRef(ix, n.id)}</li>`)\n .join(\"\")}</ul></div>\n<div class=\"panel\"><h3>Proposed, not delivered</h3><ul class=\"list\">${\n proposed\n .map(\n (n) =>\n `<li>${nodeRef(ix, n.id)} <span class=\"k\">${arr(n.attrs.acceptance).length} criteria</span></li>`,\n )\n .join(\"\") || '<li class=\"k\">Nothing proposed.</li>'\n }</ul></div>\n<div class=\"panel\"><h3>Lint</h3>${\n g.lint.ran\n ? g.nodes.some((n) => n.issues.length) || g.lint.unattached.length\n ? `<ul class=\"list\">${g.nodes\n .filter((n) => n.issues.length)\n .map((n) => `<li>${issuesPill(n.issues)} ${nodeRef(ix, n.id)}</li>`)\n .join(\n \"\",\n )}${g.lint.unattached.map((i) => `<li>${pill(i.severity, \"err\")} ${esc(`${i.file}: ${i.message}`)}</li>`).join(\"\")}</ul>`\n : '<p class=\"k\">Every linter passes.</p>'\n : '<p class=\"k\">Run without lint (<code>--no-lint</code>).</p>'\n }</div></div></section>`;\n}\n\nfunction intentsView(ix: Index): string {\n const rows: string[] = [];\n const children = new Map<string, GraphNode[]>();\n for (const n of ix.of(\"intent\"))\n children.set(n.parent ?? \"\", [...(children.get(n.parent ?? \"\") ?? []), n]);\n for (const list of children.values()) list.sort((a, b) => a.line - b.line);\n const bar = (n: GraphNode) => {\n const done = num(n.attrs.done) ?? 0;\n const total = num(n.attrs.total) ?? 0;\n if (!total) return \"\";\n return `<span class=\"bar\" title=\"${done}/${total}\"><i style=\"width:${Math.round((done / total) * 100)}%\"></i></span><span class=\"mono k\">${done}/${total}</span>`;\n };\n const walk = (id: string, depth: number) => {\n for (const n of children.get(id) ?? []) {\n const status = str(n.attrs.effectiveStatus);\n const terminal = n.attrs.terminal === true;\n const acc = arr(n.attrs.acceptance);\n rows.push(\n `<li class=\"tr l${depth}${terminal && status === \"proposed\" ? \" pr\" : \"\"}\" style=\"--d:${depth}\"><span class=\"ttl\">${nodeRef(ix, n.id)}</span>${terminal ? statusPill(status) : bar(n)}${acc.length ? `<ul class=\"acc\">${acc.map((c) => `<li>${md(c)}</li>`).join(\"\")}</ul>` : \"\"}</li>`,\n );\n walk(n.id, depth + 1);\n }\n };\n for (const f of ix.of(\"intent-file\")) {\n rows.push(\n `<li class=\"tr l0\" style=\"--d:0\"><span class=\"ttl\"><b>${nodeRef(ix, f.id)}</b></span>${bar(f)}</li>`,\n );\n walk(f.id, 1);\n }\n return `<section class=\"view\" id=\"view-intents\" data-title=\"Intents\"><h2>Intent tree</h2><p class=\"k\">What the product does, what is left: the share of delivered terminal intents under each node.</p><ul class=\"tree\">${rows.join(\"\")}</ul></section>`;\n}\n\nfunction vocabularyView(ix: Index): string {\n const terms = ix.of(\"term\");\n const cards = terms.map((t) => {\n const req = ix.inOf(t.id, \"requires\").length;\n const cre = ix.inOf(t.id, \"creates\").length;\n const tone =\n t.attrs.defined === false\n ? \"bad\"\n : req > 0 && cre === 0\n ? \"warn\"\n : req + cre === 0\n ? \"dim\"\n : \"\";\n const note =\n t.attrs.defined === false\n ? \"used, not in any Vocabulary\"\n : req > 0 && cre === 0\n ? \"required, created by no intent\"\n : req + cre === 0\n ? \"defined, used by no intent\"\n : \"\";\n return `<div class=\"term ${tone}\">${nodeRef(ix, t.id)}<span class=\"k\">created by ${cre} · required by ${req}</span>${note ? `<span class=\"note\">${esc(note)}</span>` : \"\"}</div>`;\n });\n return `<section class=\"view\" id=\"view-vocabulary\" data-title=\"Vocabulary\"><h2>Vocabulary</h2><p class=\"k\">The spec's words, and the intents that create and require them.</p><div class=\"terms\">${cards.join(\"\")}</div></section>`;\n}\n\nfunction decisionsView(ix: Index): string {\n const items = ix.of(\"decision\").map((d) => {\n const alts = ix\n .outOf(d.id, \"contains\")\n .map((e) => ix.byId.get(e.to))\n .filter((n): n is GraphNode => !!n);\n const refs = ix.inOf(d.id, \"links-to\").length;\n return `<details class=\"adr\"><summary>${nodeRef(ix, d.id)} ${pill(`cited ×${refs}`, refs <= 1 ? \"warn\" : \"mut\")} ${issuesPill(d.issues)}</summary>${str(d.attrs.decision) ? `<p>${md(str(d.attrs.decision) ?? \"\")}</p>` : \"\"}${alts\n .map(\n (a) =>\n `<div class=\"alt\"><b>Rejected · ${md(a.title)}</b> ${md(str(a.attrs.text) ?? \"\")}</div>`,\n )\n .join(\"\")}</details>`;\n });\n return `<section class=\"view\" id=\"view-decisions\" data-title=\"Decisions\"><h2>Decisions in force</h2><p class=\"k\">Why it is done this way, and what was set aside.</p><div class=\"adrs\">${items.join(\"\")}</div></section>`;\n}\n\nfunction lintersView(ix: Index): string {\n const groups = new Map<string, GraphNode[]>();\n for (const l of ix.of(\"linter\")) {\n const key = arr(l.attrs.pillars).join(\", \");\n groups.set(key, [...(groups.get(key) ?? []), l]);\n }\n const rows = [...groups.entries()].map(([pillars, list]) => {\n const skills = [...new Set(list.flatMap((l) => arr(l.attrs.suggests)))];\n return `<div class=\"lr\"><span class=\"lp\">${esc(pillars)}</span><span class=\"lc\">${list\n .map(\n (l) =>\n `<a class=\"lk ${str(l.attrs.severity) === \"error\" ? \"e\" : \"w\"}\" href=\"#${htmlId(l.id)}\" data-n=\"${htmlId(l.id)}\">${esc(l.title.replace(/^lint:/, \"\"))} <i class=\"${num(l.attrs.issues) ? \"bad\" : \"\"}\">${num(l.attrs.issues) ?? 0}</i></a>`,\n )\n .join(\n \"\",\n )}</span><span class=\"ls${skills.length ? \"\" : \" none\"}\">${skills.length ? `→ ${esc(skills.join(\", \"))}` : \"no skill suggested\"}</span></div>`;\n });\n return `<section class=\"view\" id=\"view-linters\" data-title=\"Linters\"><h2>Linters <span class=\"k\">harness domain</span></h2><p class=\"k\">What is checked, where, with which result, and which skill fixes it. Solid border: error. Dashed: warning. The number is the current issues.</p><div class=\"lint-map\">${rows.join(\"\")}</div></section>`;\n}\n\nfunction skillsView(ix: Index): string {\n const skills = ix.of(\"skill\");\n const layers = [\"shipped\", \"project\", \"override\"].map((l) => {\n const n = skills.filter((s) => s.attrs.layer === l).length;\n return `<span class=\"ly${n ? \" on\" : \"\"}\">${esc(l === \"shipped\" ? \"Shipped (harness)\" : l === \"project\" ? \"Project docs/skills/\" : \"Local overrides\")} · ${n}</span>`;\n });\n const disabled = skills.filter((s) => s.attrs.disabled).length;\n const engines = [\"claude-code\", \"codex-cli\", \"opencode\"];\n const rows = skills.map((s) => {\n const cmd = ix\n .inOf(s.id, \"invokes\")\n .map((e) => ix.byId.get(e.from)?.title)\n .filter(Boolean)\n .join(\", \");\n const suggestedBy = ix.inOf(s.id, \"suggests\").length;\n const rendered = ix.outOf(s.id, \"renders-to\").map((e) => str(ix.byId.get(e.to)?.attrs.engine));\n const cells = engines.map((eng) => {\n const has =\n rendered.includes(eng) ||\n (eng === \"opencode\" &&\n rendered.length > 0 &&\n ix.graph.nodes.some((n) => n.type === \"rendered-file\" && n.attrs.engine === \"opencode\"));\n return `<td class=\"${has ? \"ok\" : \"no\"}\">${has ? \"✓\" : \"—\"}</td>`;\n });\n return `<tr><td>${nodeRef(ix, s.id)}</td><td class=\"mono\">${esc(cmd || \"—\")}</td><td>${esc(arr(s.attrs.tags).join(\", \"))}</td><td class=\"${suggestedBy ? \"\" : \"warn\"}\">${suggestedBy ? `${suggestedBy} linter${suggestedBy > 1 ? \"s\" : \"\"}` : \"none\"}</td>${cells.join(\"\")}<td class=\"num\">${num(s.attrs.lines) ?? 0}</td></tr>`;\n });\n return `<section class=\"view\" id=\"view-skills\" data-title=\"Skills\"><h2>Skills</h2><p class=\"k\">What the agent can load, where it comes from, where it is rendered. Lines hint at the context a skill costs when loaded.</p><div class=\"layers\">${layers.join(\"\")}${disabled ? `<span class=\"ly\">Disabled · ${disabled}</span>` : \"\"}</div><div class=\"tbl\"><table><thead><tr><th>Skill</th><th>Command</th><th>Tags</th><th>Suggested by</th><th>Claude Code</th><th>Codex</th><th>OpenCode</th><th>Lines</th></tr></thead><tbody>${rows.join(\"\")}</tbody></table></div></section>`;\n}\n\nfunction lessonsView(ix: Index): string {\n const lessons = ix.of(\"lesson\");\n if (!lessons.length) return \"\";\n return `<section class=\"view\" id=\"view-lessons\" data-title=\"Lessons\"><h2>Lessons proposed <span class=\"k\">local</span></h2><p class=\"k\">Patches reviews keep asking for, and the rule that would prevent them. Accept, edit or reject them with <code>/harn-improve</code>.</p><div class=\"lessons\">${lessons\n .map(\n (l) =>\n `<div class=\"lesson\">${nodeRef(ix, l.id)}<span class=\"row\">${pill(str(l.attrs.status) ?? \"proposed\", str(l.attrs.status) === \"accepted\" ? \"ok\" : str(l.attrs.status) === \"rejected\" ? \"mut\" : \"acc\")}${str(l.attrs.domain) ? pill(str(l.attrs.domain) ?? \"\", \"mut\") : \"\"}${num(l.attrs.seen) ? pill(`seen ${num(l.attrs.seen)}×`, \"mut\") : \"\"}${str(l.attrs.pillar) ? `<span class=\"k\">→ ${esc(str(l.attrs.pillar) ?? \"\")}</span>` : \"\"}</span></div>`,\n )\n .join(\"\")}</div></section>`;\n}\n\nfunction sessionView(ix: Index, s: SessionView, diff: Map<string, DiffState>): string {\n const count = (state: DiffState) => [...diff.values()].filter((d) => d === state).length;\n const baseIssues = new Set(\n s.base.nodes\n .flatMap((n) => n.issues)\n .concat(s.base.lint.unattached)\n .map((i) => `${i.linter}|${i.file}|${i.message}`),\n );\n const nowIssues = ix.graph.nodes.flatMap((n) => n.issues).concat(ix.graph.lint.unattached);\n const nowKeys = new Set(nowIssues.map((i) => `${i.linter}|${i.file}|${i.message}`));\n const added = nowIssues.filter((i) => !baseIssues.has(`${i.linter}|${i.file}|${i.message}`));\n const gone = s.base.nodes\n .flatMap((n) => n.issues)\n .filter((i) => !nowKeys.has(`${i.linter}|${i.file}|${i.message}`));\n const open = s.threads.filter((t) => t.status === \"open\").length;\n return `<section class=\"view\" id=\"view-session\" data-title=\"Session\"><h2>Review session <span class=\"k\">${esc(s.id)}</span></h2>\n<div class=\"tiles\"><div class=\"tile\"><span class=\"tl\">Cards</span><span class=\"tv\">+${count(\"add\")} ~${count(\"chg\")} −${count(\"del\")}</span><span class=\"ts\">since the session start</span></div><div class=\"tile ${added.length ? \"bad\" : \"\"}\"><span class=\"tl\">Lint</span><span class=\"tv\">+${added.length} −${gone.length}</span><span class=\"ts\">issues since the start</span></div><div class=\"tile\"><span class=\"tl\">Comments</span><span class=\"tv\">${s.threads.length}</span><span class=\"ts\">${open} not handed over yet</span></div></div>\n<div class=\"session-actions\"><button type=\"button\" data-submit ${open ? \"\" : \"disabled\"}>Hand over to the agent (${open})</button><button type=\"button\" data-end>End the review</button></div>\n<div class=\"cols\"><div class=\"panel\"><h3>Lint since the start</h3><ul class=\"list\">${added\n .map(\n (i) =>\n `<li>${pill(`+ ${i.severity}`, \"err\")} <span class=\"mono\">${esc(i.linter)}</span> ${esc(`${i.file}${i.line ? `:${i.line}` : \"\"}: ${i.message}`)}</li>`,\n )\n .join(\n \"\",\n )}${gone.map((i) => `<li>${pill(`− ${i.severity}`, \"ok\")} <span class=\"mono\">${esc(i.linter)}</span> ${esc(`${i.file}: ${i.message}`)}</li>`).join(\"\") || (added.length ? \"\" : '<li class=\"k\">No change.</li>')}</ul></div>\n<div class=\"panel\"><h3>Journal</h3><ol class=\"journal\">${\n [...s.journal]\n .reverse()\n .map(\n (j) =>\n `<li><span class=\"mono k\">${esc(j.at.slice(11, 19))}</span> ${esc(j.files.join(\", \") || \"—\")} ${pill(`${j.errors} · ${j.warnings}`, j.errors ? \"err\" : \"ok\")}${j.note ? `<br><em>${esc(j.note)}</em>` : \"\"}</li>`,\n )\n .join(\"\") || '<li class=\"k\">No change yet.</li>'\n }</ol></div></div>\n<h3>Comments</h3><div class=\"threads\">${s.threads.map((t) => threadHtml(t, ix)).join(\"\") || '<p class=\"k\">Select a card, then comment it in the side panel.</p>'}</div></section>`;\n}\n\n// -------------------------------------------------------------------- page\n\nfunction diffOf(\n graph: ContextGraph,\n base: ContextGraph | undefined,\n): { diff: Map<string, DiffState>; removed: GraphNode[] } {\n const diff = new Map<string, DiffState>();\n if (!base) return { diff, removed: [] };\n const before = new Map(base.nodes.map((n) => [n.id, n]));\n for (const n of graph.nodes) {\n const b = before.get(n.id);\n if (!b) diff.set(n.id, \"add\");\n else if (signature(b) !== signature(n)) diff.set(n.id, \"chg\");\n }\n const now = new Set(graph.nodes.map((n) => n.id));\n const removed = base.nodes.filter((n) => !now.has(n.id) && n.type !== \"section\");\n for (const n of removed) diff.set(n.id, \"del\");\n return { diff, removed };\n}\n\nexport function renderView(graph: ContextGraph, opts: RenderOptions = {}): string {\n const ix = new Index(graph);\n const prefix = opts.sourcePrefix ?? (opts.session ? \"/\" : \"../../\");\n const { diff, removed } = diffOf(graph, opts.session?.base);\n const project = ix.of(\"readme\")[0]?.title ?? \"Project\";\n const views = [\n overview(ix),\n intentsView(ix),\n vocabularyView(ix),\n decisionsView(ix),\n lintersView(ix),\n skillsView(ix),\n lessonsView(ix),\n opts.session ? sessionView(ix, opts.session, diff) : \"\",\n ].filter(Boolean);\n const tabs = [\n [\"canvas\", \"Canvas\"],\n ...views.map((v) => {\n const id = /id=\"view-([a-z]+)\"/.exec(v)?.[1] ?? \"\";\n const title = /data-title=\"([^\"]+)\"/.exec(v)?.[1] ?? id;\n return [id, title];\n }),\n ];\n const lintTone = !graph.lint.ran\n ? \"mut\"\n : graph.lint.errors\n ? \"err\"\n : graph.lint.warnings\n ? \"warn\"\n : \"ok\";\n const lintText = graph.lint.ran\n ? `lint ${graph.lint.errors} · ${graph.lint.warnings}`\n : \"lint not run\";\n return `<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<meta name=\"generator\" content=\"@vaubaan/harness ${esc(graph.harness)}\">\n<title>${esc(project)} — context</title>\n<style>${VIEW_STYLE}</style>\n</head>\n<body${opts.session ? ` data-session=\"${esc(opts.session.id)}\" data-revision=\"${opts.session.revision}\"` : \"\"}>\n<header class=\"top\">\n<div class=\"brand\"><b>${esc(project)}</b><span class=\"k\">context · harness ${esc(graph.harness)}</span></div>\n<nav class=\"tabs\" aria-label=\"Views\">${tabs.map(([id, label]) => `<a href=\"#view-${id}\" data-tab=\"${id}\">${esc(label ?? \"\")}</a>`).join(\"\")}</nav>\n<div class=\"status\"><span id=\"hs\">${pill(lintText, lintTone)}${opts.session ? '<span class=\"live\" title=\"Live review session\"><i></i>live</span>' : \"\"}</span>${opts.session ? `<span class=\"seg\" role=\"group\" aria-label=\"Differences\"><button type=\"button\" data-diff=\"before\">Before</button><button type=\"button\" data-diff=\"now\" aria-pressed=\"true\">Now</button><button type=\"button\" data-diff=\"diff\">Differences</button></span>` : \"\"}<label class=\"sr\" for=\"q\">Search</label><input id=\"q\" type=\"search\" placeholder=\"Search /\" autocomplete=\"off\"></div>\n</header>\n<main>\n<section class=\"view active\" id=\"view-canvas\" data-title=\"Canvas\">${renderCanvas(ix, diff, removed)}</section>\n${views.join(\"\\n\")}\n</main>\n<aside class=\"side\" id=\"side\" aria-label=\"Card details\"><button type=\"button\" class=\"close\" data-close aria-label=\"Close\">×</button><p class=\"k empty\">Select a card to see where it comes from and what it is linked to.</p>\n${renderDetails(ix, prefix, removed, opts.session)}\n</aside>\n<script>${VIEW_SCRIPT}</script>\n</body>\n</html>\n`;\n}\n","/** Inline style and script of the view: no network, no build step. */\n\nexport const VIEW_STYLE = `\n:root{--bg:#f4f6f5;--surface:#fff;--sunk:#e9edeb;--fg:#17211d;--muted:#5b6862;--line:#d3d9d5;--accent:#0f6e62;--accent-soft:#d6ebe6;\n--ok:#2f7d3c;--ok-soft:#e0f0e2;--warn:#9a6200;--warn-soft:#f8ecd2;--err:#b3361f;--err-soft:#f7dfd9;--dot:#c8cfca;\n--f:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif;--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color-scheme:light}\n@media (prefers-color-scheme:dark){:root{--bg:#111614;--surface:#1a201d;--sunk:#0d1110;--fg:#e3eae5;--muted:#95a39b;--line:#2c3530;--accent:#4fc2b0;--accent-soft:#163430;\n--ok:#6cc47a;--ok-soft:#183019;--warn:#e7ad45;--warn-soft:#352a12;--err:#f0806a;--err-soft:#3b1d17;--dot:#29312d;color-scheme:dark}}\n*{box-sizing:border-box}html,body{height:100%}\nbody{margin:0;background:var(--bg);color:var(--fg);font:14px/1.5 var(--f);display:flex;flex-direction:column}\na{color:var(--accent)}code,.mono{font-family:var(--mono);font-size:.86em}code{background:var(--sunk);padding:0 .3em;border-radius:3px}\nh2{font-size:1.3rem;margin:0 0 .3rem}h3{font-size:1rem;margin:0 0 .4rem}h4{margin:.8rem 0 .3rem;font-size:.8rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}\n.k{color:var(--muted);font-size:.85em}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}\nbutton{font:inherit;cursor:pointer;border:1px solid var(--line);background:var(--surface);color:var(--fg);border-radius:6px;padding:4px 10px}\nbutton:hover{border-color:var(--accent)}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid var(--accent);outline-offset:1px}\nbutton[disabled]{opacity:.5;cursor:default}\nheader.top{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;padding:8px 16px;border-bottom:1px solid var(--line);background:var(--surface);position:relative;z-index:5}\n.brand{display:flex;flex-direction:column;line-height:1.2;min-width:0}\n.tabs{display:flex;flex-wrap:wrap;gap:2px}\n.tabs a{padding:4px 10px;border-radius:6px;text-decoration:none;color:var(--muted)}\n.tabs a.on{background:var(--accent-soft);color:var(--accent);font-weight:600}\n.status{margin-left:auto;display:flex;gap:8px;align-items:center;flex-wrap:wrap}\n#q{border:1px solid var(--line);background:var(--bg);color:var(--fg);border-radius:6px;padding:4px 8px;width:180px}\n.live{display:inline-flex;gap:5px;align-items:center;font-size:.8rem;color:var(--muted)}.live i{width:7px;height:7px;border-radius:50%;background:var(--ok)}\n.seg{display:inline-flex;border:1px solid var(--line);border-radius:7px;padding:1px}.seg button{border:0;padding:3px 8px;font-size:.8rem}\n.seg button[aria-pressed=true]{background:var(--accent-soft);color:var(--accent);font-weight:600}\nmain{flex:1;min-height:0;position:relative;overflow:auto}\n.view{padding:16px 20px}.js .view:not(.active){display:none}\n#view-canvas{padding:0;height:100%}\n.pill{display:inline-block;font-size:.72rem;font-weight:600;padding:0 .5em;border-radius:99px;white-space:nowrap;margin-right:3px}\n.p-ok{background:var(--ok-soft);color:var(--ok)}.p-warn{background:var(--warn-soft);color:var(--warn)}.p-err{background:var(--err-soft);color:var(--err)}\n.p-acc{background:var(--accent-soft);color:var(--accent)}.p-mut{background:var(--sunk);color:var(--muted)}\n.cv{position:relative;height:100%;min-height:420px;overflow:hidden;background-image:radial-gradient(var(--dot) 1.1px,transparent 1.2px);background-size:22px 22px;touch-action:none;cursor:grab;outline:none}\n.cv.drag{cursor:grabbing}.cv-world{position:absolute;left:0;top:0;transform-origin:0 0}\n.frame{position:absolute;border:1.5px solid var(--line);border-radius:14px;background:color-mix(in srgb,var(--surface) 70%,transparent)}\n.frame.f-harness{border-style:dashed;border-color:var(--accent)}\n.ft{position:absolute;top:-11px;left:14px;background:var(--bg);padding:0 8px;font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}\n.n{position:absolute;height:100px;overflow:hidden;display:flex;flex-direction:column;gap:1px;z-index:1;background:var(--surface);border:1px solid var(--line);border-radius:9px;padding:7px 10px;color:var(--fg);text-decoration:none;box-shadow:0 1px 2px rgb(0 0 0/.05)}\n.n:hover{border-color:var(--accent)}.n .t{font-weight:600;font-size:.82rem;line-height:1.25;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}\n.n .s{font-size:.7rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.n .row{margin-top:auto;white-space:nowrap;overflow:hidden;display:flex;gap:4px;align-items:center}.n>.k{font-size:.66rem;text-transform:uppercase;letter-spacing:.06em}\n.n .bar{width:60px}\n.n.d-harness{border-style:dashed}.n.has-err{border-color:var(--err)}\n.n.t-intent-file,.n.t-readme,.n.t-spec{background:var(--sunk)}\n.n.sel{outline:2px solid var(--accent);outline-offset:2px;z-index:2}.n.dim{opacity:.25}\n.edges{position:absolute;left:0;top:0;pointer-events:none;overflow:visible}\n.edges path{fill:none;stroke:var(--muted);opacity:.45}.edges path.on{stroke:var(--accent);opacity:1}\n.cv.focusing .frame,.cv.focusing .n:not(.sel):not(.nb),.cv.focusing .edges path:not(.on){opacity:.12}\n.focus{display:none;position:absolute;left:0;top:0}.focus.on{display:block}\n.fl{position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;pointer-events:none}.fl path{fill:none;stroke:var(--accent);stroke-width:1.6}\n.fb{position:absolute;z-index:3;background:var(--surface);border:1px solid var(--accent);border-radius:10px;box-shadow:0 6px 18px rgb(0 0 0/.12)}\n.fbt{position:absolute;left:10px;top:6px;font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--accent)}.fbt i{font-style:normal;color:var(--muted)}\n.fi{position:absolute;z-index:4;height:34px;display:flex;align-items:center;gap:6px;padding:0 8px;border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--fg);text-decoration:none;font-size:.76rem;overflow:hidden}\n.fi .t{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}.fi .k{font-size:.68rem;white-space:nowrap}\n.dot{width:8px;height:8px;border-radius:50%;flex:none;background:var(--muted)}.dot.ok{background:var(--ok)}.dot.warn{background:var(--warn)}\n.fi:hover,.fi.sel{border-color:var(--accent);outline:1px solid var(--accent)}.fi[data-doc]{background:var(--sunk)}.fi.has-err{border-color:var(--err)}\n.cv[data-view=diff] .fi.is-add{border:2px solid var(--ok)}.cv[data-view=diff] .fi.is-chg{border:2px solid var(--warn)}.cv[data-view=diff] .fi.is-del{border:2px dashed var(--err)}\n.cv-hint{position:absolute;left:12px;bottom:6px;margin:0;font-size:.75rem;color:var(--muted);pointer-events:none}\n.cv-tools{position:absolute;right:12px;bottom:12px;display:flex;gap:4px;z-index:3}.cv-tools button{box-shadow:0 1px 3px rgb(0 0 0/.1)}\n.cv-tools button[aria-pressed=true]{background:var(--accent-soft);color:var(--accent)}\n.cv[data-view=before] .is-add{display:none}.cv[data-view=now] .is-del{display:none}\n.cv[data-view=diff] .n.is-add{border:2px solid var(--ok);box-shadow:0 0 0 4px var(--ok-soft)}\n.cv[data-view=diff] .n.is-chg{border:2px solid var(--warn);box-shadow:0 0 0 4px var(--warn-soft)}\n.cv[data-view=diff] .n.is-del{border:2px dashed var(--err);opacity:.75}.cv[data-view=diff] .n.is-del .t{text-decoration:line-through}\n.diff-tag{display:none;position:absolute;top:2px;right:6px;font-size:.6rem;font-weight:700;padding:0 5px;border-radius:99px;color:var(--surface)}\n.cv[data-view=diff] .diff-tag{display:block}.is-add .diff-tag{background:var(--ok)}.is-chg .diff-tag{background:var(--warn)}.is-del .diff-tag{background:var(--err)}\n.side{position:fixed;right:0;top:0;bottom:0;width:min(420px,100%);background:var(--surface);border-left:1px solid var(--line);z-index:10;overflow:auto;padding:16px 18px;box-shadow:-6px 0 20px rgb(0 0 0/.08)}\n.js .side{transform:translateX(105%);transition:transform .15s}.js .side.open{transform:none}\n@media (prefers-reduced-motion:reduce){.js .side{transition:none}}\n.side .close{position:absolute;right:10px;top:8px;border:0;font-size:1.3rem;padding:0 6px}\n.js .detail{display:none}.js .detail.on{display:block}.js .side.open .empty{display:none}\n.detail{border-bottom:1px solid var(--line);padding-bottom:12px;margin-bottom:12px}.detail header{margin-bottom:8px}.detail h3{font-size:1.05rem;margin:2px 0}\ndl{display:grid;grid-template-columns:96px 1fr;gap:4px 10px;margin:8px 0}dt{color:var(--muted);font-size:.8rem}dd{margin:0;min-width:0;overflow-wrap:anywhere}\ndd ul{margin:0;padding-left:1.1em}dl.rel dt{grid-column:1/-1;margin-top:6px;font-weight:600}dl.rel dd{grid-column:1/-1}\n.issues{list-style:none;padding:0;margin:8px 0}.issues li{border-left:3px solid var(--err);background:var(--err-soft);padding:6px 8px;border-radius:0 6px 6px 0;margin-bottom:4px}\n.issues li.sev-warning{border-color:var(--warn);background:var(--warn-soft)}\n.comments textarea,.reply textarea{width:100%;border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--fg);font:inherit;padding:6px}\n.comments form,.reply{display:grid;gap:6px;margin-top:6px}.btns{display:flex;gap:6px}\n.thread{border:1px solid var(--line);border-radius:8px;padding:8px;margin:6px 0;background:var(--bg)}\n.thread header{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.msg{margin-top:6px}.msg p{margin:2px 0;white-space:pre-wrap}\n.who{font-size:.72rem;font-weight:700;color:var(--muted)}.m-agent .who{color:var(--accent)}.chg{background:var(--accent-soft);padding:0 4px;border-radius:3px}\n.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;margin:12px 0}\n.tile{background:var(--surface);border:1px solid var(--line);border-radius:9px;padding:10px 12px;display:grid}\n.tile.bad{border-color:var(--err)}.tile.warn{border-color:var(--warn)}\n.tl{font-size:.68rem;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:700}.tv{font-size:1.4rem;font-weight:700;font-variant-numeric:tabular-nums}.ts{font-size:.75rem;color:var(--muted)}\n.cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px}\n.panel{background:var(--surface);border:1px solid var(--line);border-radius:9px;padding:12px}\n.list{list-style:none;padding:0;margin:0;display:grid;gap:5px}\n.tree{list-style:none;padding:0;margin:0;display:grid;gap:4px;max-width:980px}\n.tr{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-left:calc(var(--d)*20px);background:var(--surface);border:1px solid var(--line);border-radius:7px;padding:6px 10px}\n.tr .ttl{flex:1;min-width:200px}.tr.pr{border-color:var(--warn)}.tr .acc{flex-basis:100%;margin:2px 0 0;padding-left:1.2em;color:var(--muted);font-size:.85rem}\n.bar{display:inline-block;width:90px;height:6px;background:var(--sunk);border-radius:99px;overflow:hidden}.bar i{display:block;height:100%;background:var(--ok)}\n.terms{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:8px}\n.term{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:8px 10px;display:grid;gap:2px}\n.term.warn{border-color:var(--warn)}.term.bad{border-color:var(--err)}.term.dim{border-style:dashed;opacity:.7}.term .note{font-size:.78rem;color:var(--warn)}\n.adrs{display:grid;gap:6px;max-width:980px}.adr{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:8px 12px}\n.adr summary{cursor:pointer}.adr p{margin:6px 0}.alt{font-size:.85rem;color:var(--muted);border-left:2px solid var(--line);padding-left:8px;margin:4px 0}\n.lint-map{display:grid;gap:6px;max-width:1100px}\n.lr{display:grid;grid-template-columns:200px 1fr 220px;gap:10px;align-items:center;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:7px 10px}\n.lp{font-weight:600}.lc{display:flex;flex-wrap:wrap;gap:5px}\n.lk{font-family:var(--mono);font-size:.76rem;border:1px solid var(--err);border-radius:5px;padding:1px 7px;text-decoration:none;color:var(--fg)}\n.lk.w{border-color:var(--warn);border-style:dashed}.lk i{font-style:normal;font-weight:700;color:var(--ok)}.lk i.bad{color:var(--err)}\n.ls{font-family:var(--mono);font-size:.76rem;color:var(--accent)}.ls.none{color:var(--warn)}\n@media (max-width:760px){.lr{grid-template-columns:1fr}}\n.layers{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}.ly{border:1px solid var(--line);border-radius:99px;padding:1px 10px;font-size:.8rem;color:var(--muted)}\n.ly.on{border-color:var(--accent);color:var(--accent);font-weight:600}\n.tbl{overflow-x:auto;border:1px solid var(--line);border-radius:8px;background:var(--surface);max-width:1100px}\ntable{border-collapse:collapse;width:100%}th,td{text-align:left;padding:6px 10px;border-bottom:1px solid var(--line);white-space:nowrap}\nth{font-size:.7rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);background:var(--sunk)}\ntd.ok{color:var(--ok)}td.no{color:var(--muted)}td.warn{color:var(--warn)}td.num{text-align:right;font-variant-numeric:tabular-nums}\n.lessons{display:grid;gap:8px;max-width:980px}.lesson{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:8px 12px;display:grid;gap:4px}\n.session-actions{display:flex;gap:8px;margin:8px 0}.session-actions [data-submit]{background:var(--accent);color:var(--surface);border-color:var(--accent)}\n.journal{margin:0;padding-left:1.2em;display:grid;gap:4px}.threads{display:grid;gap:6px;max-width:900px}\n`;\n\nexport const VIEW_SCRIPT = `\n(function(){\n\"use strict\";\nvar d=document,B=d.body;B.classList.add(\"js\");\nvar st={tab:\"canvas\",sel:null,s:1,x:0,y:0,fitted:false,diff:\"now\",edges:false,q:\"\"};\nfunction $(s,r){return (r||d).querySelector(s)}function $$(s,r){return Array.prototype.slice.call((r||d).querySelectorAll(s))}\nfunction cv(){return $(\"#cv\")}function world(){return $(\"#world\")}\nfunction apply(){var w=world();if(w)w.style.transform=\"translate(\"+st.x+\"px,\"+st.y+\"px) scale(\"+st.s+\")\"}\nfunction fit(){var c=cv(),w=world();if(!c||!w||!c.clientWidth)return;var W=w.offsetWidth,H=w.offsetHeight;\nst.s=Math.min(1,Math.max(.12,Math.min(c.clientWidth/W,c.clientHeight/Math.min(H,2400))));st.x=Math.max(8,(c.clientWidth-W*st.s)/2);st.y=10;st.fitted=true;apply()}\nfunction zoomAt(f,cx,cy){var ns=Math.min(2.5,Math.max(.08,st.s*f));st.x=cx-(cx-st.x)*ns/st.s;st.y=cy-(cy-st.y)*ns/st.s;st.s=ns;apply()}\nfunction showTab(t){if(!d.getElementById(\"view-\"+t))t=\"canvas\";st.tab=t;$$(\".view\").forEach(function(v){v.classList.toggle(\"active\",v.id===\"view-\"+t)});\n$$(\"[data-tab]\").forEach(function(a){a.classList.toggle(\"on\",a.getAttribute(\"data-tab\")===t)});if(t===\"canvas\"&&!st.fitted)setTimeout(fit,0)}\nfunction zoomBox(b){var c=cv();if(!c||!b)return;var side=$(\"#side\"),cw=c.clientWidth-(side&&side.classList.contains(\"open\")?side.offsetWidth:0);var s=Math.min(1.05,Math.max(.2,Math.min(cw/b[2],(c.clientHeight-30)/b[3])));st.s=s;st.x=(cw-b[2]*s)/2-b[0]*s;st.y=Math.max(10,(c.clientHeight-b[3]*s)/2)-b[1]*s;apply()}\nfunction unfocus(){st.focus=null;var c=cv();if(c)c.classList.remove(\"focusing\");$$(\".focus.on,.n.nb,.n.sel,.fi.sel,.edges path.on\").forEach(function(x){x.classList.remove(\"on\",\"nb\",\"sel\")})}\nfunction focusOn(doc,move){unfocus();var layer=$('.focus[data-for=\"'+doc+'\"]');var card=d.getElementById(\"c-\"+doc.slice(2));if(!layer||!card)return false;st.focus=doc;\ncv().classList.add(\"focusing\");layer.classList.add(\"on\");card.classList.add(\"sel\");\n$$(\"[data-doc]\",layer).forEach(function(i){var nc=d.getElementById(\"c-\"+i.getAttribute(\"data-n\").slice(2));if(nc)nc.classList.add(\"nb\")});\n$$('.edges path[data-a=\"'+doc+'\"],.edges path[data-b=\"'+doc+'\"]').forEach(function(p){p.classList.add(\"on\")});\nif(move)zoomBox((layer.getAttribute(\"data-box\")||\"\").split(\",\").map(Number));return true}\nfunction select(nid,o){o=o||{};st.sel=nid;$$(\".detail.on\").forEach(function(x){x.classList.remove(\"on\")});$$(\".fi.sel\").forEach(function(x){x.classList.remove(\"sel\")});var side=$(\"#side\");\nif(!nid){side.classList.remove(\"open\");return}var det=d.getElementById(nid);if(det){det.classList.add(\"on\");side.classList.add(\"open\");side.scrollTop=0}\nif(!o.keep){var doc=d.getElementById(\"c-\"+nid.slice(2))?nid:det&&det.getAttribute(\"data-map\");if(doc&&doc!==st.focus)focusOn(doc,o.move!==false);else if(doc&&o.move)focusOn(doc,true)}\n$$('.focus.on .fi[data-n=\"'+nid+'\"]').forEach(function(x){x.classList.add(\"sel\")})}\nfunction filter(){var q=st.q.toLowerCase();$$(\".n\").forEach(function(n){n.classList.toggle(\"dim\",!!q&&(n.getAttribute(\"data-q\")||\"\").indexOf(q)<0)})}\nfunction restore(){showTab(st.tab);var c=cv();if(c)c.setAttribute(\"data-view\",st.diff);var f=st.focus;if(f)focusOn(f,false);apply();if(st.sel)select(st.sel,{keep:true,move:false});filter();\n$$(\"[data-diff]\").forEach(function(b){b.setAttribute(\"aria-pressed\",String(b.getAttribute(\"data-diff\")===st.diff))});var eb=$(\"[data-edges]\");if(eb)eb.setAttribute(\"aria-pressed\",String(st.edges))}\nd.addEventListener(\"click\",function(e){var t=e.target.closest(\"a,button\");if(!t)return;\nvar n=t.getAttribute(\"data-n\");if(n){e.preventDefault();if(moved)return;var inFocus=!!t.closest(\".focus\");select(n,{keep:inFocus&&!t.hasAttribute(\"data-doc\"),move:true});return}\nvar tab=t.getAttribute(\"data-tab\");if(tab){e.preventDefault();showTab(tab);try{history.replaceState(null,\"\",\"#view-\"+tab)}catch(_){}return}\nvar z=t.getAttribute(\"data-zoom\");if(z){var c=cv();if(z===\"fit\")fit();else zoomAt(z===\"in\"?1.25:.8,c.clientWidth/2,c.clientHeight/2);return}\nif(t.hasAttribute(\"data-edges\")){st.edges=!st.edges;restore();return}\nvar df=t.getAttribute(\"data-diff\");if(df){st.diff=df;restore();return}\nif(t.hasAttribute(\"data-close\")){select(null);return}\nif(t.hasAttribute(\"data-submit\")){post(\"/api/submit\",{});return}\nif(t.hasAttribute(\"data-end\")){if(confirm(\"End the review? The agent then keeps or discards the changes.\"))post(\"/api/end\",{});return}\nvar rs=t.getAttribute(\"data-resolve\");if(rs){post(\"/api/threads/\"+encodeURIComponent(rs)+\"/resolve\",{});return}});\nd.addEventListener(\"submit\",function(e){var f=e.target;var ta=$(\"textarea\",f);var body=ta&&ta.value.trim();e.preventDefault();if(!body)return;\nif(f.classList.contains(\"comment\"))post(\"/api/threads\",{nodeId:f.getAttribute(\"data-node\"),body:body}).then(function(ok){if(ok)ta.value=\"\"});\nelse if(f.classList.contains(\"reply\"))post(\"/api/threads/\"+encodeURIComponent(f.getAttribute(\"data-thread\"))+\"/messages\",{body:body}).then(function(ok){if(ok)ta.value=\"\"})});\nvar q=$(\"#q\");if(q)q.addEventListener(\"input\",function(){st.q=q.value;filter()});\nif(q)q.addEventListener(\"keydown\",function(e){if(e.key===\"Enter\"){var m=$(\".n:not(.dim)\");if(m&&st.q){showTab(\"canvas\");select(m.getAttribute(\"data-n\"),{move:true})}}});\nd.addEventListener(\"keydown\",function(e){if(/INPUT|TEXTAREA/.test((e.target.tagName||\"\")))return;\nif(e.key===\"/\"){e.preventDefault();if(q)q.focus()}else if(e.key===\"f\")fit();else if(e.key===\"l\"){st.edges=!st.edges;restore()}\nelse if(e.key===\"d\"&&B.hasAttribute(\"data-session\")){st.diff=st.diff===\"diff\"?\"now\":\"diff\";restore()}else if(e.key===\"Escape\"){select(null);unfocus();fit()}});\nvar drag=null,moved=false,pts={},pinch=null;\nd.addEventListener(\"pointerdown\",function(e){var c=cv();if(!c||!c.contains(e.target)||e.target.closest(\".cv-tools\"))return;\npts[e.pointerId]={x:e.clientX,y:e.clientY};var k=Object.keys(pts);moved=false;\nif(k.length===1){drag={x:e.clientX-st.x,y:e.clientY-st.y,sx:e.clientX,sy:e.clientY};c.classList.add(\"drag\")}\nelse if(k.length===2){var a=pts[k[0]],b=pts[k[1]];pinch={d:Math.hypot(a.x-b.x,a.y-b.y),s:st.s};drag=null}});\nd.addEventListener(\"pointermove\",function(e){if(!pts[e.pointerId])return;pts[e.pointerId]={x:e.clientX,y:e.clientY};var k=Object.keys(pts),c=cv();\nif(pinch&&k.length===2){var a=pts[k[0]],b=pts[k[1]],r=c.getBoundingClientRect();zoomAt(pinch.s*Math.hypot(a.x-b.x,a.y-b.y)/pinch.d/st.s,(a.x+b.x)/2-r.left,(a.y+b.y)/2-r.top);moved=true}\nelse if(drag){if(Math.abs(e.clientX-drag.sx)+Math.abs(e.clientY-drag.sy)>4)moved=true;st.x=e.clientX-drag.x;st.y=e.clientY-drag.y;apply()}});\nfunction up(e){var c=cv();if(c&&!moved&&drag&&c.contains(e.target)&&!e.target.closest(\"a,button,.fb\")&&st.focus){select(null);unfocus();fit()}delete pts[e.pointerId];if(Object.keys(pts).length<2)pinch=null;if(!Object.keys(pts).length){drag=null;var c=cv();if(c)c.classList.remove(\"drag\");setTimeout(function(){moved=false},0)}}\nd.addEventListener(\"pointerup\",up);d.addEventListener(\"pointercancel\",up);\nd.addEventListener(\"wheel\",function(e){var c=cv();if(!c||!c.contains(e.target))return;e.preventDefault();var r=c.getBoundingClientRect();\nif(e.ctrlKey||e.metaKey||Math.abs(e.deltaY)>=Math.abs(e.deltaX)&&!e.shiftKey)zoomAt(Math.exp(-e.deltaY*.0015),e.clientX-r.left,e.clientY-r.top);else{st.x-=e.deltaX;st.y-=e.deltaY;apply()}},{passive:false});\nwindow.addEventListener(\"resize\",function(){if(st.tab===\"canvas\"&&!st.sel)fit()});\nvar h=location.hash.replace(/^#/,\"\");if(/^view-/.test(h))showTab(h.slice(5));else{showTab(\"canvas\");if(/^n-/.test(h))setTimeout(function(){select(h,{move:true})},0)}\nsetTimeout(fit,0);\n// ---------------------------------------------------------------- session\nvar live=B.hasAttribute(\"data-session\");\nfunction post(url,body){return fetch(url,{method:\"POST\",headers:{\"content-type\":\"application/json\"},body:JSON.stringify(body),credentials:\"same-origin\"})\n.then(function(r){if(!r.ok)return r.text().then(function(t){alert(t||(\"error \"+r.status));return false});return refresh().then(function(){return true})})\n.catch(function(){return false})}\nfunction refresh(){if(!live)return Promise.resolve();return fetch(location.pathname,{cache:\"no-store\",credentials:\"same-origin\"}).then(function(r){return r.text()}).then(function(html){\nvar doc=new DOMParser().parseFromString(html,\"text/html\");var drafts={};$$(\"textarea\").forEach(function(t){if(t.id&&t.value)drafts[t.id]=t.value});\n[\"main\",\"#side\",\"#hs\"].forEach(function(sel){var a=$(sel),b=$(sel,doc);if(a&&b)a.replaceChildren.apply(a,Array.prototype.slice.call(b.childNodes).map(function(n){return d.importNode(n,true)}))});\nB.setAttribute(\"data-revision\",doc.body.getAttribute(\"data-revision\")||\"\");Object.keys(drafts).forEach(function(id){var t=d.getElementById(id);if(t)t.value=drafts[id]});restore()})}\nif(live&&window.EventSource){var es=new EventSource(\"/api/events\");es.addEventListener(\"update\",function(ev){if(ev.data!==B.getAttribute(\"data-revision\"))refresh()});\nes.addEventListener(\"end\",function(){var l=$(\".live\");if(l)l.textContent=\"review ended\";es.close()})}\n})();\n`;\n","import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { type ContextGraph, GRAPH_PATH, buildGraph, serializeGraph } from \"../view/graph.js\";\nimport { renderView } from \"../view/html.js\";\n\nexport interface ViewArgs {\n targetDir: string;\n /** Directory receiving `graph.json` and `view/index.html`; default `<target>/.vaubaan`. */\n outDir?: string;\n /** Skip the linters (faster; no issue attached). */\n lint?: boolean;\n packageDir?: string;\n}\n\nexport interface ViewResult {\n graph: ContextGraph;\n graphPath: string;\n htmlPath: string;\n}\n\nexport const VIEW_PATH = \".vaubaan/view/index.html\";\n\n/** Builds the context graph and renders the view (docs/spec/coding-agent-harness.md §10.4). */\nexport function viewCommand(args: ViewArgs): ViewResult {\n const root = resolve(args.targetDir);\n const outDir = args.outDir ? resolve(args.outDir) : join(root, \".vaubaan\");\n const graph = buildGraph(root, {\n ...(args.lint === false ? { lint: false } : {}),\n ...(args.packageDir ? { packageDir: args.packageDir } : {}),\n });\n const graphPath = join(outDir, \"graph.json\");\n const htmlPath = join(outDir, \"view\", \"index.html\");\n mkdirSync(dirname(htmlPath), { recursive: true });\n writeFileSync(graphPath, serializeGraph(graph));\n writeFileSync(htmlPath, renderView(graph));\n return { graph, graphPath, htmlPath };\n}\n\nexport { GRAPH_PATH };\n"],"mappings":";AAMA,SAAS,cAAAA,cAAY,gBAAAC,qBAAoB;AACzC,SAAS,YAAAC,WAAU,QAAAC,QAAM,SAAAC,QAAO,YAAAC,iBAAgB;AAChD,OAAOC,SAAQ;;;ACRf,SAAS,kBAAkB;AAC3B,SAAS,WAAW,YAAY,cAAc,qBAAqB;AACnE,SAAS,QAAAC,aAAY;AACrB,SAAS,SAAS;;;ACHX,IAAM,UAAU;;;ACAvB,SAAS,WAAW,cAAc,gBAAgB;AAClD,SAAS,UAAU,SAAS,YAAY,MAAM,SAAS,aAAa;AAEpE,IAAM,gBAAgB,oBAAI,IAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AACF,CAAC;AAiDM,IAAM,iBAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGA,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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C,SAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AAChD,EAAAC,eAAc,WAAW,eAAe,KAAK,CAAC;AAC9C,EAAAA,eAAc,UAAU,WAAW,KAAK,CAAC;AACzC,SAAO,EAAE,OAAO,WAAW,SAAS;AACtC;","names":["existsSync","readFileSync","basename","join","posix","relative","fg","join","join","existsSync","dirname","join","resolve","existsSync","readFileSync","join","z","readFileSync","z","existsSync","statSync","join","z","z","join","readFileSync","existsSync","existsSync","readFileSync","readdirSync","statSync","basename","join","matter","matter","basename","join","existsSync","statSync","readdirSync","readFileSync","existsSync","readFileSync","readdirSync","statSync","basename","join","matter","existsSync","readFileSync","statSync","join","fg","matter","join","existsSync","statSync","parseFrontmatter","matter","parseFrontmatter","matter","basename","join","existsSync","statSync","readdirSync","readFileSync","ENGINE","ENGINE","BASE","INTRO","EMPTY","dirname","existsSync","join","resolve","existsSync","dirname","isAbsolute","join","resolve","fg","isAbsolute","join","resolve","dirname","fg","existsSync","parseFrontmatter","parseFrontmatter","existsSync","readFileSync","join","resolve","resolve","existsSync","join","readFileSync","basename","fg","fg","basename","posix","posix","REQUIRED_SECTIONS","fg","TRACKED_DIRS","INTENTS_DIR","fg","parseFrontmatter","drift","fg","relative","readFileSync","join","parseFrontmatter","basename","existsSync","drift","posix","createHash","createHash","count","writeFileSync","dirname","join","resolve","resolve","join","dirname","writeFileSync"]}
|