@vaubaan/harness 2.3.1 → 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 +6 -2
- package/dist/render-CTx7VNOK.d.ts +0 -45
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/parser/intent.ts","../src/parser/schemas.ts","../src/types.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/render.ts"],"sourcesContent":["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] 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];\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 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 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 { z } from \"zod\";\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 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 Schemas = {\n Skill: SkillFrontmatterSchema,\n Cmd: CmdFrontmatterSchema,\n Intent: IntentFrontmatterSchema,\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","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 { stringify as yamlStringify } from \"yaml\";\nimport type { Cmd } from \"../parser/cmd.js\";\nimport type { Skill } from \"../parser/skill.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 hasQualityDoc?: boolean;\n hasIntents?: boolean;\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 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 \"- `docs/handbook/<feature>.md` — what the code does not say: entry points, traps, settings outside the repo, manual procedures.\",\n \"- `docs/decisions/<slug>.md` — ADRs: structural choices and rejected alternatives.\",\n \"- `docs/tests/integration-tests.md` & `e2e-tests.md` — test scope, stack, conventions, known gaps.\",\n \"- `docs/workflow/coding-workflow.md` — CI, branches, PR, release. How this team works: follow it.\",\n ...(extras.hasProjectSkills\n ? [\"- `docs/skills/*.skill.md` — the project's domain skills.\"]\n : []),\n ...(extras.hasQualityDoc\n ? [\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 : []),\n ...(extras.hasIntents\n ? [\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 : []),\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 ...(extras.hasIntents\n ? [\n \"- Visible change of behavior → a `proposed` intent first (`/intent <verb + object>`), never the code first.\",\n ]\n : []),\n \"- Missing spec for a subsystem you touch → **do not code**, report the gap.\",\n \"- Implicit structural decision in your changes → an ADR (`/decision`).\",\n \"- Changed feature behavior → update the matching handbook (`/handbook`).\",\n \"- Suspected code ↔ doc drift → `/drift` before moving on.\",\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(\"\", \"## Doc-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\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 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 { Cmd } from \"./parser/cmd.js\";\nimport { INTENTS_INDEX_PATH, type ParsedIntentFile } from \"./parser/intent.js\";\nimport type { Skill } from \"./parser/skill.js\";\nimport { buildUmbrellaBody } from \"./renderers/common.js\";\nimport { getRenderer } from \"./renderers/index.js\";\nimport { buildIntentsIndex } from \"./renderers/intents-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 /** True when the target project ships `docs/quality/code-quality.md` (optional pillar). */\n hasQualityDoc?: boolean;\n /** The project's parsed `docs/intents/*.md` (optional pillar); renders their index. */\n intentFiles?: ReadonlyArray<ParsedIntentFile>;\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/**\n * Pure transformation `(catalog, engines, overrides) → 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 harness = applyOverrides(base, input.overrides);\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 hasQualityDoc: input.hasQualityDoc === true,\n hasIntents: (input.intentFiles?.length ?? 0) > 0,\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 intents index is a generated file too, rendered only while an intent file exists.\n if (input.intentFiles && input.intentFiles.length > 0) {\n files.push({ path: INTENTS_INDEX_PATH, content: buildIntentsIndex(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mBAAmB,MAAM,eAAe,UAAU,KAAK;AAAA,IACvD,eAAe,MAAM,kBAAkB;AAAA,IACvC,aAAa,MAAM,aAAa,UAAU,KAAK;AAAA,EACjD,CAAC;AACD,QAAM,KAAK,EAAE,MAAM,aAAa,SAAS,gBAAgB,CAAC;AAG1D,MAAI,QAAQ,SAAS,aAAa,GAAG;AACnC,UAAM,KAAK,EAAE,MAAM,aAAa,SAAS,eAAe,CAAC;AAAA,EAC3D;AAGA,MAAI,MAAM,eAAe,MAAM,YAAY,SAAS,GAAG;AACrD,UAAM,KAAK,EAAE,MAAM,oBAAoB,SAAS,kBAAkB,MAAM,WAAW,EAAE,CAAC;AAAA,EACxF;AAEA,SAAO,EAAE,OAAO,SAAS;AAC3B;","names":["ENGINE","ENGINE","BASE"]}
|
|
1
|
+
{"version":3,"sources":["../src/parser/intent.ts","../src/parser/schemas.ts","../src/pillars.ts","../src/types.ts","../src/parser/profile.ts","../src/linters/intent-util.ts","../src/linters/util.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"],"sourcesContent":["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 { 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 { 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","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 { 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"],"mappings":";AAAA,SAAS,cAAAA,aAAY,cAAc,eAAAC,cAAa,YAAAC,iBAAgB;AAChE,SAAS,UAAU,QAAAC,aAAY;AAC/B,OAAO,YAAY;;;ACFnB,SAAS,SAAS;;;ACAlB,SAAS,YAAY,aAAa,gBAAgB;AAClD,SAAS,YAAY;AAQd,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAsBO,IAAM,UAAiC;AAAA,EAC5C,EAAE,IAAI,UAAU,MAAM,KAAK;AAAA,EAC3B,EAAE,IAAI,QAAQ,KAAK,aAAa,MAAM,KAAK;AAAA,EAC3C;AAAA,IACE,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,IACN,UAAU,CAAC,EAAE,UAAU,2BAA2B,MAAM,2BAA2B,CAAC;AAAA,IACpF,MAAM;AAAA,EACR;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,IACN,UAAU,CAAC,EAAE,UAAU,0BAA0B,MAAM,0BAA0B,CAAC;AAAA,IAClF,MAAM;AAAA,EACR;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,MACR,EAAE,UAAU,6BAA6B,MAAM,kCAAkC;AAAA,MACjF,EAAE,UAAU,qBAAqB,MAAM,0BAA0B;AAAA,IACnE;AAAA,IACA,MAAM;AAAA,EACR;AAAA,EACA;AAAA,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S;AAC3B;","names":["existsSync","readdirSync","statSync","join","existsSync","readFileSync","readdirSync","statSync","basename","join","matter","existsSync","readFileSync","statSync","join","matter","ENGINE","ENGINE","BASE","INTRO","EMPTY"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: harn-canvas-review
|
|
3
|
+
description: |
|
|
4
|
+
Runs a review session of the project's context: opens the view of the
|
|
5
|
+
meta database, keeps it live while the human talks or comments, applies
|
|
6
|
+
each comment to its source with the writer rules of its pillar, and
|
|
7
|
+
answers in the thread. Never commits; the human keeps or discards.
|
|
8
|
+
engines: [claude-code, codex-cli, opencode]
|
|
9
|
+
requires: [multi-step, inline-exec]
|
|
10
|
+
tags: [view, review, doc]
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Canvas Review
|
|
14
|
+
|
|
15
|
+
You run a **review session** (spec §10.4 of the harness): the human reads
|
|
16
|
+
the context on a canvas instead of the Markdown, and changes it by talking
|
|
17
|
+
to you or by commenting cards. The CLI is the tool, you are the loop. The
|
|
18
|
+
docs stay the only source: you edit `docs/` and `README.md`, the view
|
|
19
|
+
follows.
|
|
20
|
+
|
|
21
|
+
## Domains: where a change may land
|
|
22
|
+
|
|
23
|
+
- **Project** (`docs/`, `README.md`, `docs/skills/`): the only place you
|
|
24
|
+
write.
|
|
25
|
+
- **Harness** (linters, shipped skills, the files rendered under
|
|
26
|
+
`.claude/`, `.agents/`, `.opencode/`, `AGENTS.md`): never edited. A
|
|
27
|
+
comment on a linter or a shipped skill becomes an upstream issue draft
|
|
28
|
+
in `.vaubaan/reports/upstream.md` (title, the comment, why it holds for
|
|
29
|
+
every project); suggest a `.harness-overrides/` trial if the human wants
|
|
30
|
+
it now. A comment on a generated file changes its source in `docs/` or
|
|
31
|
+
`.harness-overrides/`, then `npx @vaubaan/harness update .`.
|
|
32
|
+
- **Local** (`.vaubaan/`): the session's own files. Never edit
|
|
33
|
+
`.vaubaan/review/` by hand: go through `review reply`, `review note`.
|
|
34
|
+
|
|
35
|
+
## Procedure
|
|
36
|
+
|
|
37
|
+
1. **Start.** Run `npx @vaubaan/harness review start`: it snapshots the
|
|
38
|
+
docs, detaches its server and returns. Give the human the URL it
|
|
39
|
+
prints. If a session was not ended, ask: `--resume`, `keep` or
|
|
40
|
+
`discard`. The server listens on the local machine only; if the human
|
|
41
|
+
cannot reach it, say so and offer `--host <interface>` (the token
|
|
42
|
+
still protects it).
|
|
43
|
+
2. **Talk mode** (`/harn-canvas talk`, or whenever the human speaks): apply
|
|
44
|
+
what they ask to the docs, one pillar at a time, with that pillar's
|
|
45
|
+
writer rules (`harn-spec-writer`, `harn-intent-writer`, `harn-decision-record-writer`,
|
|
46
|
+
`harn-handbook-writer`, `harn-test-plan-writer`, `harn-workflow-writer`,
|
|
47
|
+
`harn-readme-writer`). After each change, say why in the journal:
|
|
48
|
+
`npx @vaubaan/harness review note "<the human's request in a few words>"`.
|
|
49
|
+
The view shows the change within two seconds, with the differences
|
|
50
|
+
and the lint delta.
|
|
51
|
+
3. **Comment mode** (`/harn-canvas comment`, or when the human says they
|
|
52
|
+
commented): wait for a batch with
|
|
53
|
+
`npx @vaubaan/harness review next`. Exit `0` prints the batch as JSON;
|
|
54
|
+
exit `3` means no batch yet, call it again; exit `4` means the human
|
|
55
|
+
ended the review, go to step 5. For each thread of the batch:
|
|
56
|
+
- a question: answer from the docs, cite the file; edit nothing;
|
|
57
|
+
- a change of visible behavior: a `proposed` intent (`harn-intent-writer`);
|
|
58
|
+
- a structural choice: an ADR, admission test first
|
|
59
|
+
(`harn-decision-record-writer`);
|
|
60
|
+
- a wrong map of the code: read the code, then the handbook
|
|
61
|
+
(`harn-handbook-writer`); never touch only `last_reviewed`;
|
|
62
|
+
- a new word: the spec Vocabulary first;
|
|
63
|
+
- a harness element: the upstream draft above.
|
|
64
|
+
Then answer: `npx @vaubaan/harness review reply <thread> --body "<what
|
|
65
|
+
you did, or your question>" --change <path>:<line>` (one `--change`
|
|
66
|
+
per edited place). Unclear comment: reply with a question, change
|
|
67
|
+
nothing.
|
|
68
|
+
4. **After each batch** run `npx @vaubaan/harness update .` if an intent,
|
|
69
|
+
a project skill or an override changed, then
|
|
70
|
+
`npx @vaubaan/harness lint`. Fix what you broke; report what you could
|
|
71
|
+
not. Back to step 3.
|
|
72
|
+
5. **End.** Summarize the changes (`review status` lists them) and ask the
|
|
73
|
+
human: keep or discard. `review keep` leaves them uncommitted;
|
|
74
|
+
`review discard` restores `docs/` and `README.md` as they were at the
|
|
75
|
+
start, untracked files included. The commit, if any, follows
|
|
76
|
+
`docs/workflow/`.
|
|
77
|
+
|
|
78
|
+
## Guardrails
|
|
79
|
+
|
|
80
|
+
- **Never commit, never push.** The session is a draft; the human decides.
|
|
81
|
+
- **Never edit code.** A comment that needs code becomes a `proposed`
|
|
82
|
+
intent or a note in your reply.
|
|
83
|
+
- **Never edit a generated file, a shipped skill or the session files.**
|
|
84
|
+
- **Decide nothing for the human**: a comment you would have to
|
|
85
|
+
interpret broadly gets a question back.
|
|
86
|
+
- **One thread, one answer**: every submitted thread gets a reply, even
|
|
87
|
+
"no change: <why>".
|
package/dist/skills/{decision-record-writer.skill.md → harn-decision-record-writer.skill.md}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
id: decision-record-writer
|
|
2
|
+
id: harn-decision-record-writer
|
|
3
3
|
description: |
|
|
4
4
|
Writes an ADR under `docs/decisions/<slug>.md`, only for a structural
|
|
5
5
|
decision that passes the admission test below. Everything else goes to
|
|
@@ -7,6 +7,7 @@ description: |
|
|
|
7
7
|
one decision, four sections, about 40 lines.
|
|
8
8
|
engines: [claude-code, codex-cli, opencode]
|
|
9
9
|
requires: [multi-step]
|
|
10
|
+
pillars: [decisions]
|
|
10
11
|
tags: [decisions, doc, writer, adr]
|
|
11
12
|
---
|
|
12
13
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
id: doc-audit
|
|
2
|
+
id: harn-doc-audit
|
|
3
3
|
description: |
|
|
4
|
-
Audits the completeness and freshness of the docs
|
|
5
|
-
spec
|
|
4
|
+
Audits the completeness and freshness of the docs: the README, the
|
|
5
|
+
spec and every pillar the project has activated. Reports gaps, implicit
|
|
6
6
|
decisions without an ADR, stale handbooks, and divergences between
|
|
7
7
|
pillars. Output = structured Markdown report placed in
|
|
8
8
|
`.vaubaan/reports/doc-audit.md` (creates the folder if missing).
|
|
@@ -25,28 +25,37 @@ mechanized.
|
|
|
25
25
|
- Before a review: the verdict depends on your report.
|
|
26
26
|
- Before drafting a plan: we need to know whether the existing docs
|
|
27
27
|
are sound.
|
|
28
|
-
- On explicit request via `/doc-audit [scope]` (scope = `spec`,
|
|
29
|
-
`decisions`, `handbook`, `tests`, `workflow`, `readme`, `intents`,
|
|
28
|
+
- On explicit request via `/harn-doc-audit [scope]` (scope = `spec`,
|
|
29
|
+
`decisions`, `handbook`, `tests`, `workflow`, `readme`, `intents`,
|
|
30
|
+
`profiles`, or `all`).
|
|
30
31
|
|
|
31
|
-
## Scope
|
|
32
|
+
## Scope: the active pillars
|
|
33
|
+
|
|
34
|
+
README and spec are the core, always audited:
|
|
32
35
|
|
|
33
36
|
- **README** — `README.md` at the root (outside `docs/`).
|
|
34
37
|
- **spec** — `docs/spec/`: theoretical, tech-agnostic vision.
|
|
38
|
+
|
|
39
|
+
Every other pillar is **active when its folder under `docs/` exists**.
|
|
40
|
+
You audit the active ones and only those:
|
|
41
|
+
|
|
35
42
|
- **decisions** — `docs/decisions/<slug>.md`: ADRs (no numbering).
|
|
36
43
|
- **handbook** — `docs/handbook/<slug>.md`: implementation docs
|
|
37
44
|
(no numbering).
|
|
38
|
-
- **tests** — `docs/tests/integration-tests.md` + `e2e-tests.md
|
|
39
|
-
|
|
40
|
-
- **workflow** — `docs/workflow/coding-workflow.md` (required v1).
|
|
41
|
-
|
|
42
|
-
Three **optional** pillars are added. Their absence is never reported;
|
|
43
|
-
you audit them only if they exist:
|
|
44
|
-
|
|
45
|
+
- **tests** — `docs/tests/integration-tests.md` + `e2e-tests.md`.
|
|
46
|
+
- **workflow** — `docs/workflow/coding-workflow.md`.
|
|
45
47
|
- **skills** — `docs/skills/*.skill.md`: the project's domain skills.
|
|
46
48
|
- **quality** — `docs/quality/code-quality.md`: project-specific
|
|
47
49
|
quality rules.
|
|
48
50
|
- **intents** — `docs/intents/*.md`: what the user does and wants,
|
|
49
51
|
at every scale, one tree of intents anchored to the code (`README.md` there is generated).
|
|
52
|
+
- **profiles** — `docs/profiles/*.md`: who the project serves, their
|
|
53
|
+
pains and gains (`README.md` there is generated).
|
|
54
|
+
|
|
55
|
+
**An inactive pillar is never a gap.** Do not list it as missing, do not
|
|
56
|
+
recommend it, omit its section from the report. Whether the project is
|
|
57
|
+
ready for one more pillar is the `harn-guide` skill's question, asked
|
|
58
|
+
when the work calls for it, never a finding of the audit.
|
|
50
59
|
|
|
51
60
|
## Procedure
|
|
52
61
|
|
|
@@ -57,7 +66,8 @@ you audit them only if they exist:
|
|
|
57
66
|
`packages/<name>/`, or top-level routes of an app, or core modules
|
|
58
67
|
of the repo. An override `.harness-overrides/doc-audit.config.yaml`
|
|
59
68
|
can override this list — read it if it exists.
|
|
60
|
-
3. **Audit pillar by pillar
|
|
69
|
+
3. **Audit pillar by pillar**, the core and the active ones (see
|
|
70
|
+
criteria below; skip the criteria of an inactive pillar).
|
|
61
71
|
4. **Cross-check** between pillars (orphans, broken links).
|
|
62
72
|
5. **Pillar boundaries**: spot spec ↔ handbook ↔ decisions drift.
|
|
63
73
|
6. **Verdict**: `done` (0 errors) or `needs-human` (≥1 error).
|
|
@@ -69,14 +79,16 @@ you audit them only if they exist:
|
|
|
69
79
|
- ❌ `README.md` missing at the root.
|
|
70
80
|
- ❌ Missing required sections: Pitch / What is this / Quick start
|
|
71
81
|
(install + run) / Links / License.
|
|
72
|
-
- ⚠️ No link to `docs/spec/`, `docs/handbook
|
|
73
|
-
`docs/workflow/coding-workflow.md
|
|
82
|
+
- ⚠️ No link to `docs/spec/`, nor to `docs/handbook/` or
|
|
83
|
+
`docs/workflow/coding-workflow.md` when those pillars are active.
|
|
74
84
|
- ⚠️ Quick start that refers to commands / scripts that no longer
|
|
75
85
|
exist in `package.json` or in the repo.
|
|
76
86
|
|
|
77
87
|
### Spec
|
|
78
88
|
- ❌ Major subsystem without a corresponding spec file.
|
|
79
|
-
- ⚠️ Orphan spec (no decision, handbook or test references it
|
|
89
|
+
- ⚠️ Orphan spec (no decision, handbook or test references it, among
|
|
90
|
+
the active pillars; with none of them active, a spec is never an
|
|
91
|
+
orphan).
|
|
80
92
|
- ❌ **Pillar drift**: mention of concrete libs (`Next.js`,
|
|
81
93
|
`Supabase`, `Vercel`, `React`, `TypeScript`, `npm`, `Docker`, code
|
|
82
94
|
file paths, code blocks) in a `spec/` file. Suggest a move to
|
|
@@ -85,6 +97,7 @@ you audit them only if they exist:
|
|
|
85
97
|
has evolved (judgment).
|
|
86
98
|
|
|
87
99
|
### Decisions
|
|
100
|
+
Audit **only if `docs/decisions/` exists**.
|
|
88
101
|
- ❌ ADR without the 4 required sections: **`## Context` /
|
|
89
102
|
`## Decision` / `## Consequences` / `## Rejected alternatives`** (the
|
|
90
103
|
French headings `## Contexte` / `## Décision` / `## Conséquences` /
|
|
@@ -101,6 +114,7 @@ you audit them only if they exist:
|
|
|
101
114
|
- ⚠️ Broken numbering in `docs/decisions/` (gaps, duplicates).
|
|
102
115
|
|
|
103
116
|
### Handbook
|
|
117
|
+
Audit **only if `docs/handbook/` exists**.
|
|
104
118
|
- ❌ Handbook that refers to code that no longer exists (parse
|
|
105
119
|
`tracks: [...]` and check existence; non-existent paths = error).
|
|
106
120
|
- ⚠️ **Freshness**: compare the handbook's commit time vs the latest
|
|
@@ -111,6 +125,7 @@ you audit them only if they exist:
|
|
|
111
125
|
- ⚠️ Handbook without a `tracks:` frontmatter.
|
|
112
126
|
|
|
113
127
|
### Tests
|
|
128
|
+
Audit **only if `docs/tests/` exists**.
|
|
114
129
|
- ❌ `docs/tests/integration-tests.md` missing.
|
|
115
130
|
- ❌ `docs/tests/e2e-tests.md` missing.
|
|
116
131
|
- ⚠️ Spec without tests: no integration or E2E test file exercises the
|
|
@@ -120,6 +135,7 @@ you audit them only if they exist:
|
|
|
120
135
|
(not an error, but to be reported).
|
|
121
136
|
|
|
122
137
|
### Workflow
|
|
138
|
+
Audit **only if `docs/workflow/` exists**.
|
|
123
139
|
- ❌ `docs/workflow/coding-workflow.md` missing.
|
|
124
140
|
- ❌ Missing required section: **CI pipeline / Env variants / PR
|
|
125
141
|
process / Branch model / Release**.
|
|
@@ -129,7 +145,7 @@ you audit them only if they exist:
|
|
|
129
145
|
"we merge via PR template X" while `.github/PULL_REQUEST_TEMPLATE.md`
|
|
130
146
|
no longer exists).
|
|
131
147
|
|
|
132
|
-
### Quality
|
|
148
|
+
### Quality
|
|
133
149
|
Audit **only if `docs/quality/` exists**.
|
|
134
150
|
- ❌ `docs/quality/code-quality.md` missing while the directory
|
|
135
151
|
exists.
|
|
@@ -144,8 +160,8 @@ Audit **only if `docs/quality/` exists**.
|
|
|
144
160
|
longer exists in the repo.
|
|
145
161
|
- ⚠️ An accepted deviation with no reason and no link to an ADR.
|
|
146
162
|
|
|
147
|
-
### Intents
|
|
148
|
-
Audit **only if `docs/intents/`
|
|
163
|
+
### Intents
|
|
164
|
+
Audit **only if `docs/intents/` exists**. The linters
|
|
149
165
|
(`lint:intent-*`) already check the grammar, the anchors and the
|
|
150
166
|
vocabulary; you judge what they cannot.
|
|
151
167
|
- ⚠️ **Spec without intents**: a `docs/spec/*.md` file that no intent
|
|
@@ -165,6 +181,29 @@ vocabulary; you judge what they cannot.
|
|
|
165
181
|
(→ `spec/`) or how the code works (→ `handbook/`); a field the linter
|
|
166
182
|
does not know is already an error.
|
|
167
183
|
|
|
184
|
+
### Profiles
|
|
185
|
+
Audit **only if `docs/profiles/` exists**. The linters
|
|
186
|
+
(`lint:profile-schema`, `lint:intent-profiles`) check the form and the
|
|
187
|
+
links; the generated index `docs/profiles/README.md` already shows which
|
|
188
|
+
intent serves which pain. You judge what they cannot.
|
|
189
|
+
- ⚠️ **Unvalidated profile**: a `hypothesis` whose file has not changed
|
|
190
|
+
for more than N commits (default 10). A guess that nobody checked is
|
|
191
|
+
steering the product.
|
|
192
|
+
- ⚠️ **Unserved pain**: the first-ranked pain of a profile that no
|
|
193
|
+
intent relieves (read it in the index). Not an error: a known gap is a
|
|
194
|
+
product choice. Say it once, at the top.
|
|
195
|
+
- ⚠️ **Intent without a reason**: with intents active, a `proposed`
|
|
196
|
+
terminal intent that relieves no pain and delivers no gain. Ask who
|
|
197
|
+
it is for before it is built.
|
|
198
|
+
- ⚠️ **A feature dressed as a pain**: "no dashboard", "lacks an export".
|
|
199
|
+
A pain is what the user lives ("cannot tell which invoices are late"),
|
|
200
|
+
not the absence of our solution.
|
|
201
|
+
- ⚠️ **Evidence that says something else**: when the evidence is a file
|
|
202
|
+
of the repo, read it; flag a pain or a rank it does not support.
|
|
203
|
+
- ❌ **Pillar drift**: a profile that states a product rule (→ `spec/`),
|
|
204
|
+
lists what the user does (→ `intents/`) or describes an agent role
|
|
205
|
+
(→ a project skill in `docs/skills/`).
|
|
206
|
+
|
|
168
207
|
### Cross-link consistency
|
|
169
208
|
- ⚠️ Orphan spec: no decision, handbook or test references it.
|
|
170
209
|
- ⚠️ Orphan decision: not referenced by any other doc file.
|
|
@@ -184,13 +223,15 @@ This is *the* critical point where docs drift. Heuristics:
|
|
|
184
223
|
implementation (→ handbook).
|
|
185
224
|
- intents/ (if present) must stay intents + pointers → flag an
|
|
186
225
|
intent that explains a rule or an implementation.
|
|
226
|
+
- profiles/ (if present) must stay who, pains and gains → flag a list
|
|
227
|
+
of features, a rule or a journey written there.
|
|
187
228
|
- Any architectural choice mentioned in a commit without an ADR → flag
|
|
188
229
|
(see "Implicit decisions").
|
|
189
230
|
|
|
190
231
|
## Expected output
|
|
191
232
|
|
|
192
233
|
Structured Markdown, placed in `.vaubaan/reports/doc-audit.md`, following this format (adapt to the findings, do not
|
|
193
|
-
invent empty sections):
|
|
234
|
+
invent empty sections, and write no section for an inactive pillar):
|
|
194
235
|
|
|
195
236
|
```markdown
|
|
196
237
|
# Doc Audit Report — <project> @ <short-commit-sha>
|
|
@@ -236,18 +277,24 @@ invent empty sections):
|
|
|
236
277
|
- ⚠️ section "<section>" missing
|
|
237
278
|
- ⚠️ tracks: [...] but drift of N commits since last edit
|
|
238
279
|
|
|
239
|
-
## Quality (
|
|
280
|
+
## Quality (section omitted if docs/quality/ is absent)
|
|
240
281
|
|
|
241
282
|
- ✅/❌ docs/quality/code-quality.md present
|
|
242
283
|
- ❌ section "<section>" missing
|
|
243
284
|
- ⚠️ <cited tool or config file> not found in the repo
|
|
244
285
|
|
|
245
|
-
## Intents (
|
|
286
|
+
## Intents (section omitted if docs/intents/ is absent)
|
|
246
287
|
|
|
247
288
|
- ⚠️ docs/spec/<name>.md — no intent file links it
|
|
248
289
|
- ⚠️ docs/intents/<slug>.md › <intent title> — implemented, no test anchor
|
|
249
290
|
- ⚠️ docs/intents/<slug>.md › <intent title> — proposed for N commits
|
|
250
291
|
|
|
292
|
+
## Profiles (section omitted if docs/profiles/ is absent)
|
|
293
|
+
|
|
294
|
+
- ⚠️ docs/profiles/<slug>.md — hypothesis for N commits
|
|
295
|
+
- ⚠️ docs/profiles/<slug>.md › <pain> — first-ranked, no intent relieves it
|
|
296
|
+
- ⚠️ docs/intents/<slug>.md › <intent title> — proposed, serves no pain or gain
|
|
297
|
+
|
|
251
298
|
## Cross-link consistency
|
|
252
299
|
|
|
253
300
|
- Orphan spec: <path>
|
|
@@ -269,14 +316,16 @@ invent empty sections):
|
|
|
269
316
|
## Guardrails
|
|
270
317
|
|
|
271
318
|
- **Fix nothing**. You audit, you list, you recommend. The writers
|
|
272
|
-
(`spec-writer`, `decision-record-writer`, `handbook-writer`,
|
|
273
|
-
`test-plan-writer`, `workflow-writer`, `readme-writer`,
|
|
274
|
-
`intent-writer`) are there to fix — not you.
|
|
319
|
+
(`harn-spec-writer`, `harn-decision-record-writer`, `harn-handbook-writer`,
|
|
320
|
+
`harn-test-plan-writer`, `harn-workflow-writer`, `harn-readme-writer`,
|
|
321
|
+
`harn-intent-writer`) are there to fix — not you.
|
|
275
322
|
- **Do not re-implement the mechanical linters**. If a check is already
|
|
276
323
|
covered by `vaubaan harness lint` (file presence, frontmatter schema,
|
|
277
324
|
tech keyword regex, cross-links), you may mention it briefly but do
|
|
278
325
|
not do their job for them. Focus on judgment: implicit decisions,
|
|
279
326
|
semantic freshness, subtle pillar boundaries, move suggestions.
|
|
327
|
+
- **Do not recommend a pillar the project has not activated.** The
|
|
328
|
+
report covers what exists.
|
|
280
329
|
- **Do not hallucinate files**. Verify the existence of every path
|
|
281
330
|
you mention via `ls` / `find` / direct reading.
|
|
282
331
|
- **No "done" verdict while a ❌ remains**. The rule is binary: 0
|