@descent-vtt/spec-graph 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +65 -18
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +91 -17
- package/dist/cli.js.map +1 -1
- package/dist/diff.js.map +1 -1
- package/dist/directives.js.map +1 -1
- package/dist/extract.js +3 -1
- package/dist/extract.js.map +1 -1
- package/dist/glob.js.map +1 -1
- package/dist/graph.js.map +1 -1
- package/dist/sections.js +8 -1
- package/dist/sections.js.map +1 -1
- package/dist/select.js +4 -3
- package/dist/select.js.map +1 -1
- package/dist/vendor/spec-core/markdown/frontmatter.js.map +1 -1
- package/dist/vendor/spec-core/markdown/headings.js.map +1 -1
- package/dist/vendor/spec-core/markdown/links.js.map +1 -1
- package/dist/vendor/spec-core/markdown/scan.js.map +1 -1
- package/dist/vendor/spec-core/pattern/automaton.js.map +1 -1
- package/dist/vendor/spec-core/pattern/charset.js.map +1 -1
- package/dist/vendor/spec-core/pattern/regex.js.map +1 -1
- package/dist/vendor/spec-core/text/lines.js.map +1 -1
- package/dist/vendor/spec-core/text/width.js.map +1 -1
- package/package.json +1 -1
package/dist/diff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,6EAA6E;AAC7E,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,yEAAyE;QACzE,uEAAuE;QACvE,sDAAsD;QACtD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAoFD,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,mEAAmE;AACnE,gFAAgF;AAChF,+EAA+E;AAC/E,yCAAyC;AACzC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MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;QAC9I,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;AAC3C,CAAC","sourcesContent":["/**\n * What changed between two states of the graph, read from two JSON exports.\n *\n * Two files in, one report out, and no git underneath: CI already has both\n * checkouts, and the pipeline stays a pure function of text. See ADR-0020.\n *\n * The rule the whole module follows is that a change is reported only against a\n * name that means the same thing in both exports. A document's id does. An\n * item's numbered id does not - it is an ordinal within a section, so one\n * inserted question renumbers every question after it - and keying on it\n * reports a question as reopened when nobody touched it. So an obligation is\n * paired only by a declared id, or by its document, section and title when\n * nothing else shares them; anything unpaired is said to have appeared or\n * disappeared, and never to have changed.\n */\n\n/** Refused input: not JSON, not an export, or a version this cannot read. */\nexport class DiffInputError extends Error {\n constructor(message: string) {\n super(message);\n // For a stack trace, which nothing prints: the command catches every one\n // of these and prints its message, and the library does not export the\n // class. A mutant that blanks the name is equivalent.\n this.name = 'DiffInputError';\n }\n}\n\nexport interface Generator {\n readonly name: string;\n readonly version: string;\n}\n\nexport interface ExportedDocument {\n readonly id: string;\n readonly title: string;\n readonly path: string;\n readonly phase: string;\n readonly status: string | null;\n}\n\nexport interface ExportedItem {\n readonly id: string;\n readonly title: string;\n readonly document: string;\n readonly section: readonly string[];\n readonly openness: string;\n /** `null` when the export predates the flag, so its ids cannot be trusted. */\n readonly declared: boolean | null;\n}\n\nexport interface ExportedRelation {\n readonly kind: string;\n readonly from: string;\n readonly to: string;\n}\n\n/** One side of a diff: a `--graph-format json` export, read and checked. */\nexport interface GraphExport {\n readonly generator: Generator | null;\n readonly documents: readonly ExportedDocument[];\n readonly items: readonly ExportedItem[];\n readonly edges: readonly ExportedRelation[];\n}\n\nexport interface DocumentChange {\n readonly id: string;\n readonly path?: readonly [string, string] | undefined;\n readonly title?: readonly [string, string] | undefined;\n readonly phase?: readonly [string, string] | undefined;\n readonly status?: readonly [string | null, string | null] | undefined;\n}\n\nexport interface ObligationRef {\n readonly document: string;\n readonly section: readonly string[];\n /**\n * The section path as a reader wants it: without the document's own title\n * heading, which every item under it shares and the id already names. Items\n * are matched on the same headings, kept as a list so that no heading holding\n * \" > \" can pass for two.\n */\n readonly place: string;\n readonly title: string;\n}\n\n/** An item with no pair: its state on the one side it exists on, and no more. */\nexport interface UnpairedObligation extends ObligationRef {\n readonly openness: string;\n}\n\nexport interface Transition extends ObligationRef {\n readonly openness: readonly [string, string];\n}\n\nexport interface GraphDiff {\n readonly generators: { readonly before: Generator | null; readonly after: Generator | null };\n readonly documents: {\n readonly added: readonly ExportedDocument[];\n readonly removed: readonly ExportedDocument[];\n readonly changed: readonly DocumentChange[];\n };\n readonly relations: { readonly added: readonly ExportedRelation[]; readonly removed: readonly ExportedRelation[] };\n readonly obligations: {\n readonly transitions: readonly Transition[];\n readonly appeared: readonly UnpairedObligation[];\n readonly disappeared: readonly UnpairedObligation[];\n };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Reading an export */\n/* -------------------------------------------------------------------------- */\n\n// Every caller goes on to read a field and check it with `text` or\n// `Array.isArray`, and a number, string or boolean yields `undefined` for every\n// field read here, which both refuse. So the `typeof` decides nothing a caller\n// can see, and its mutant is equivalent.\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction text(value: unknown): string | null {\n return typeof value === 'string' ? value : null;\n}\n\n/**\n * Reads one export.\n *\n * Checked as far as the comparison reads it and no further: a field this does\n * not use is not a reason to refuse a file, and a later export that adds fields\n * is still version 1.\n */\nexport function parseGraphExport(raw: string, source: string): GraphExport {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n throw new DiffInputError(`${source} is not JSON; make it with \\`spec-graph graph --graph-format json\\``);\n }\n if (!isRecord(parsed) || !Array.isArray(parsed['nodes']) || !Array.isArray(parsed['edges'])) {\n throw new DiffInputError(`${source} is not a graph export; make it with \\`spec-graph graph --graph-format json\\``);\n }\n if (parsed['version'] !== 1) {\n throw new DiffInputError(`${source} is export version ${JSON.stringify(parsed['version'])}, and this reads version 1`);\n }\n\n const generator = isRecord(parsed['generator']) ? parsed['generator'] : null;\n const name = generator ? text(generator['name']) : null;\n const version = generator ? text(generator['version']) : null;\n\n const documents: ExportedDocument[] = [];\n const items: ExportedItem[] = [];\n parsed['nodes'].forEach((node: unknown, index) => {\n const id = isRecord(node) ? text(node['id']) : null;\n if (!isRecord(node) || id === null) throw new DiffInputError(`${source}: node ${index} has no id`);\n if (node['kind'] === 'document') {\n documents.push({\n id,\n title: text(node['title']) ?? '',\n path: text(node['path']) ?? '',\n phase: text(node['phase']) ?? 'unknown',\n status: text(node['status']),\n });\n } else if (node['kind'] === 'item') {\n const section = Array.isArray(node['section']) ? node['section'].filter((part): part is string => typeof part === 'string') : [];\n items.push({\n id,\n title: text(node['title']) ?? '',\n document: text(node['document']) ?? '',\n section,\n openness: text(node['openness']) ?? 'unknown',\n declared: typeof node['declared'] === 'boolean' ? node['declared'] : null,\n });\n } else {\n throw new DiffInputError(`${source}: node ${id} is neither a document nor an item`);\n }\n });\n\n const edges: ExportedRelation[] = parsed['edges'].map((edge: unknown, index) => {\n const kind = isRecord(edge) ? text(edge['kind']) : null;\n const from = isRecord(edge) ? text(edge['from']) : null;\n const to = isRecord(edge) ? text(edge['to']) : null;\n if (kind === null || from === null || to === null) throw new DiffInputError(`${source}: edge ${index} is missing its kind or ends`);\n return { kind, from, to };\n });\n\n return { generator: name !== null && version !== null ? { name, version } : null, documents, items, edges };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Comparing */\n/* -------------------------------------------------------------------------- */\n\n// Code-unit order, not locale order: the same input sorts the same way on every\n// machine, which is what keeps a report byte-identical.\nfunction byText(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** Compares two exports. Pure, and deterministic in everything it returns. */\nexport function diffExports(before: GraphExport, after: GraphExport): GraphDiff {\n return {\n generators: { before: before.generator, after: after.generator },\n documents: compareDocuments(before, after),\n relations: compareRelations(before, after),\n obligations: compareObligations(before, after),\n };\n}\n\nfunction compareDocuments(before: GraphExport, after: GraphExport): GraphDiff['documents'] {\n const was = new Map(before.documents.map((document) => [document.id, document]));\n const now = new Map(after.documents.map((document) => [document.id, document]));\n const changed: DocumentChange[] = [];\n for (const [id, next] of now) {\n const previous = was.get(id);\n if (previous === undefined) continue;\n // The id is the decision's name, so the same id at a new path is the same\n // decision moved, never one removed and another added (ADR-0009).\n const change: DocumentChange = {\n id,\n ...(previous.path !== next.path && { path: [previous.path, next.path] as const }),\n ...(previous.title !== next.title && { title: [previous.title, next.title] as const }),\n ...(previous.phase !== next.phase && { phase: [previous.phase, next.phase] as const }),\n ...(previous.status !== next.status && { status: [previous.status, next.status] as const }),\n };\n if (Object.keys(change).length > 1) changed.push(change);\n }\n const ids = (documents: Iterable<ExportedDocument>) => [...documents].sort((a, b) => byText(a.id, b.id));\n return {\n added: ids([...now.values()].filter((document) => !was.has(document.id))),\n removed: ids([...was.values()].filter((document) => !now.has(document.id))),\n changed: changed.sort((a, b) => byText(a.id, b.id)),\n };\n}\n\n/**\n * The relations between documents, projected the way `--documents-only`\n * projects a graph: an item's edges lifted onto its document, and a relation\n * that ends where it began dropped - which is also what becomes of a document\n * containing its own items, so containment survives only between documents.\n * Where a relation was declared is not part of it - moving a supersession from\n * a sentence into front matter changes nothing a reader relies on.\n */\nfunction relationsOf(graph: GraphExport): Map<string, ExportedRelation> {\n // A document, or a target nothing in the export defines, stands for itself.\n const owners = new Map(graph.items.map((item) => [item.id, item.document]));\n const out = new Map<string, ExportedRelation>();\n for (const edge of graph.edges) {\n const from = owners.get(edge.from) ?? edge.from;\n const to = owners.get(edge.to) ?? edge.to;\n if (from === to) continue;\n // Tab-joined: kinds and ids cannot contain one.\n out.set(`${edge.kind}\\t${from}\\t${to}`, { kind: edge.kind, from, to });\n }\n return out;\n}\n\nfunction compareRelations(before: GraphExport, after: GraphExport): GraphDiff['relations'] {\n const was = relationsOf(before);\n const now = relationsOf(after);\n const sorted = (entries: [string, ExportedRelation][]) => entries.sort(([a], [b]) => byText(a, b)).map(([, relation]) => relation);\n return {\n added: sorted([...now].filter(([key]) => !was.has(key))),\n removed: sorted([...was].filter(([key]) => !now.has(key))),\n };\n}\n\n/**\n * Obligations by where they sit and then by title, heading by heading, so a\n * section's own questions come before those of the sections under it.\n */\nfunction byPlace(a: ObligationRef, b: ObligationRef): number {\n const left = [a.document, ...a.section];\n const right = [b.document, ...b.section];\n // Past the end of the shorter path `byText` meets `undefined`, which is\n // neither less nor greater than anything, and answers 0: the mutants that\n // run the loop on decide nothing the lengths below do not, and are\n // equivalent.\n for (let at = 0; at < left.length && at < right.length; at++) {\n const order = byText(left[at] as string, right[at] as string);\n if (order !== 0) return order;\n }\n return left.length - right.length || byText(a.title, b.title);\n}\n\n/**\n * The headings an item sits under, below its document's own. A section path\n * starts at the document's heading, which is its title, so without this a\n * retitled document would lose track of every question in it.\n */\nfunction headingsIn(graph: GraphExport): (item: ExportedItem) => readonly string[] {\n const titles = new Map(graph.documents.map((document) => [document.id, document.title]));\n return (item) => (item.section[0] === titles.get(item.document) ? item.section.slice(1) : item.section);\n}\n\nfunction compareObligations(before: GraphExport, after: GraphExport): GraphDiff['obligations'] {\n const headingsBefore = headingsIn(before);\n const headingsAfter = headingsIn(after);\n // Seeded with a string, as a mutant seeds it, this holds a \"pair\" of two\n // characters with no openness on either side, which the transition filter\n // drops: that mutant is equivalent.\n const pairs: [ExportedItem, ExportedItem][] = [];\n const paired = new Set<ExportedItem>();\n\n // A declared id names the same item in both states however it was reworded or\n // moved - provided it names one item on each side. An export without the flag\n // cannot say which ids were declared, so none of its ids are trusted.\n const declaredIn = (items: readonly ExportedItem[]) => {\n const out = new Map<string, ExportedItem | null>();\n for (const item of items) {\n if (item.declared !== true) continue;\n out.set(item.id, out.has(item.id) ? null : item);\n }\n return out;\n };\n const declaredBefore = declaredIn(before.items);\n const declaredAfter = declaredIn(after.items);\n for (const [id, item] of declaredBefore) {\n const match = declaredAfter.get(id);\n if (item === null || match === null || match === undefined) continue;\n pairs.push([item, match]);\n paired.add(item);\n paired.add(match);\n }\n\n // Otherwise the same document, headings and title, and only when nothing else\n // on either side shares them: two identical titles in one section cannot be\n // told apart, so neither is paired. Joined as JSON so that no two different\n // triples can produce the same key.\n const group = (items: readonly ExportedItem[], headings: (item: ExportedItem) => readonly string[]) => {\n const out = new Map<string, ExportedItem[]>();\n for (const item of items) {\n if (paired.has(item)) continue;\n const key = JSON.stringify([item.document, headings(item), item.title]);\n out.set(key, [...(out.get(key) ?? []), item]);\n }\n return out;\n };\n const was = group(before.items, headingsBefore);\n const now = group(after.items, headingsAfter);\n for (const [key, previous] of was) {\n const next = now.get(key);\n if (previous.length !== 1 || next?.length !== 1) continue;\n const [a, b] = [previous[0] as ExportedItem, next[0] as ExportedItem];\n pairs.push([a, b]);\n paired.add(a);\n paired.add(b);\n }\n\n const refIn = (headings: (item: ExportedItem) => readonly string[]) => (item: ExportedItem): ObligationRef => ({\n document: item.document,\n section: item.section,\n place: headings(item).join(' > '),\n title: item.title,\n });\n const wasRef = refIn(headingsBefore);\n const nowRef = refIn(headingsAfter);\n return {\n transitions: pairs\n .filter(([a, b]) => a.openness !== b.openness)\n .map(([a, b]) => ({ ...nowRef(b), openness: [a.openness, b.openness] as const }))\n .sort(byPlace),\n appeared: after.items.filter((item) => !paired.has(item)).map((item) => ({ ...nowRef(item), openness: item.openness })).sort(byPlace),\n disappeared: before.items.filter((item) => !paired.has(item)).map((item) => ({ ...wasRef(item), openness: item.openness })).sort(byPlace),\n };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Reporting */\n/* -------------------------------------------------------------------------- */\n\nfunction generatorName(generator: Generator | null): string {\n return generator === null ? 'an unknown version' : `${generator.name} ${generator.version}`;\n}\n\n/**\n * The warning a diff carries when its two exports may disagree for a reason\n * that is not the repository. `null` when both name the same generator.\n */\nexport function generatorWarning(diff: GraphDiff): string | null {\n const { before, after } = diff.generators;\n if (before !== null && after !== null && before.name === after.name && before.version === after.version) return null;\n return `the exports were made by ${generatorName(before)} and ${generatorName(after)}; a change in extraction between versions reads as a change in the repository`;\n}\n\nfunction changeCount(diff: GraphDiff): { documents: number; relations: number; obligations: number } {\n return {\n documents: diff.documents.added.length + diff.documents.removed.length + diff.documents.changed.length,\n relations: diff.relations.added.length + diff.relations.removed.length,\n obligations: diff.obligations.transitions.length + diff.obligations.appeared.length + diff.obligations.disappeared.length,\n };\n}\n\nfunction plural(n: number, word: string): string {\n return `${n} ${n === 1 ? word : `${word}s`}`;\n}\n\n/** One sentence for the whole diff, which is what a pull-request reader sees first. */\nexport function diffVerdict(diff: GraphDiff): string {\n const count = changeCount(diff);\n const parts = [\n count.documents > 0 ? plural(count.documents, 'document') : null,\n count.relations > 0 ? plural(count.relations, 'relation') : null,\n count.obligations > 0 ? plural(count.obligations, 'obligation') : null,\n ].filter((part): part is string => part !== null);\n if (parts.length === 0) return 'No relational change.';\n const listed = parts.length === 1 ? (parts[0] as string) : `${parts.slice(0, -1).join(', ')} and ${parts[parts.length - 1] as string}`;\n return `${listed} changed.`;\n}\n\nfunction where(ref: ObligationRef): string {\n return ref.place === '' ? ref.document : `${ref.document} > ${ref.place}`;\n}\n\nfunction transitionWord([from, to]: readonly [string, string]): string {\n return to === 'closed' ? 'resolved' : from === 'closed' ? 'reopened' : to === 'partial' ? 'narrowed' : 'widened';\n}\n\nfunction describeChange(change: DocumentChange): string {\n const parts: string[] = [];\n if (change.path) parts.push(`moved from ${change.path[0]} to ${change.path[1]}`);\n if (change.phase) parts.push(`${change.phase[0]} -> ${change.phase[1]}`);\n if (change.status) parts.push(`status ${change.status[0] ?? 'none'} -> ${change.status[1] ?? 'none'}`);\n if (change.title) parts.push(`retitled \"${change.title[1]}\"`);\n return parts.join('; ');\n}\n\n/** The report for a terminal. */\nexport function formatDiffText(diff: GraphDiff): string {\n const lines: string[] = [];\n const warning = generatorWarning(diff);\n if (warning !== null) lines.push(`warning: ${warning}`, '');\n lines.push(diffVerdict(diff));\n\n const { documents, relations, obligations } = diff;\n if (documents.added.length + documents.removed.length + documents.changed.length > 0) {\n lines.push('', 'Documents');\n for (const document of documents.added) lines.push(` + ${document.id} ${document.title} (${document.phase})`);\n for (const document of documents.removed) lines.push(` - ${document.id} ${document.title}`);\n for (const change of documents.changed) lines.push(` ~ ${change.id} ${describeChange(change)}`);\n }\n if (relations.added.length + relations.removed.length > 0) {\n lines.push('', 'Relations');\n for (const relation of relations.added) lines.push(` + ${relation.from} -${relation.kind}-> ${relation.to}`);\n for (const relation of relations.removed) lines.push(` - ${relation.from} -${relation.kind}-> ${relation.to}`);\n }\n if (obligations.transitions.length + obligations.appeared.length + obligations.disappeared.length > 0) {\n lines.push('', 'Obligations');\n // Padded to the longest word, so the places line up.\n const word = (text: string) => text.padEnd('disappeared'.length);\n for (const transition of obligations.transitions) {\n lines.push(` ${word(transitionWord(transition.openness))} ${where(transition)}: \"${transition.title}\" (${transition.openness[0]} -> ${transition.openness[1]})`);\n }\n for (const item of obligations.appeared) lines.push(` ${word('appeared')} ${where(item)}: \"${item.title}\" (${item.openness})`);\n for (const item of obligations.disappeared) lines.push(` disappeared ${where(item)}: \"${item.title}\" (was ${item.openness})`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/** The report for a bot: the diff itself, with the verdict and warning beside it. */\nexport function formatDiffJson(diff: GraphDiff): string {\n return `${JSON.stringify({ version: 1, verdict: diffVerdict(diff), warning: generatorWarning(diff), ...diff }, null, 2)}\\n`;\n}\n\n// A table cell: a pipe would end the cell, and a newline would end the row.\nfunction cell(value: string): string {\n return value.replace(/[|]/g, '|').replace(/\\s+/g, ' ');\n}\n\n/** The report for a job summary or a pull-request comment. */\nexport function formatDiffMarkdown(diff: GraphDiff): string {\n const lines: string[] = ['### spec-graph diff', '', diffVerdict(diff), ''];\n const warning = generatorWarning(diff);\n if (warning !== null) lines.push(`> **Warning:** ${cell(warning)}.`, '');\n\n const { documents, relations, obligations } = diff;\n if (documents.added.length + documents.removed.length + documents.changed.length > 0) {\n lines.push('| | Document | Change |', '| --- | --- | --- |');\n for (const document of documents.added) lines.push(`| added | \\`${cell(document.id)}\\` | ${cell(document.title)} - ${cell(document.phase)} |`);\n for (const document of documents.removed) lines.push(`| removed | \\`${cell(document.id)}\\` | ${cell(document.title)} |`);\n for (const change of documents.changed) lines.push(`| changed | \\`${cell(change.id)}\\` | ${cell(describeChange(change))} |`);\n lines.push('');\n }\n if (relations.added.length + relations.removed.length > 0) {\n lines.push('| | From | Relation | To |', '| --- | --- | --- | --- |');\n for (const relation of relations.added) lines.push(`| added | \\`${cell(relation.from)}\\` | ${cell(relation.kind)} | \\`${cell(relation.to)}\\` |`);\n for (const relation of relations.removed) lines.push(`| removed | \\`${cell(relation.from)}\\` | ${cell(relation.kind)} | \\`${cell(relation.to)}\\` |`);\n lines.push('');\n }\n if (obligations.transitions.length + obligations.appeared.length + obligations.disappeared.length > 0) {\n lines.push('| | Where | Obligation |', '| --- | --- | --- |');\n for (const transition of obligations.transitions) {\n lines.push(`| ${transitionWord(transition.openness)} | ${cell(where(transition))} | ${cell(transition.title)} (${transition.openness[0]} -> ${transition.openness[1]}) |`);\n }\n for (const item of obligations.appeared) lines.push(`| appeared | ${cell(where(item))} | ${cell(item.title)} (${item.openness}) |`);\n for (const item of obligations.disappeared) lines.push(`| disappeared | ${cell(where(item))} | ${cell(item.title)} (was ${item.openness}) |`);\n lines.push('');\n }\n return `${lines.join('\\n').trimEnd()}\\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,6EAA6E;AAC7E,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAA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AAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;QACpI,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,WAAW;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;QAC9I,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;AAC3C,CAAC","sourcesContent":["/**\n * What changed between two states of the graph, read from two JSON exports.\n *\n * Two files in, one report out, and no git underneath: CI already has both\n * checkouts, and the pipeline stays a pure function of text. See ADR-0020.\n *\n * The rule the whole module follows is that a change is reported only against a\n * name that means the same thing in both exports. A document's id does. An\n * item's numbered id does not - it is an ordinal within a section, so one\n * inserted question renumbers every question after it - and keying on it\n * reports a question as reopened when nobody touched it. So an obligation is\n * paired only by a declared id, or by its document, section and title when\n * nothing else shares them; anything unpaired is said to have appeared or\n * disappeared, and never to have changed.\n */\n\n/** Refused input: not JSON, not an export, or a version this cannot read. */\nexport class DiffInputError extends Error {\n constructor(message: string) {\n super(message);\n // For a stack trace, which nothing prints: the command catches every one\n // of these and prints its message, and the library does not export the\n // class. A mutant that blanks the name is equivalent.\n this.name = 'DiffInputError';\n }\n}\n\nexport interface Generator {\n readonly name: string;\n readonly version: string;\n}\n\nexport interface ExportedDocument {\n readonly id: string;\n readonly title: string;\n readonly path: string;\n readonly phase: string;\n readonly status: string | null;\n}\n\nexport interface ExportedItem {\n readonly id: string;\n readonly title: string;\n readonly document: string;\n readonly section: readonly string[];\n readonly openness: string;\n /** `null` when the export predates the flag, so its ids cannot be trusted. */\n readonly declared: boolean | null;\n}\n\nexport interface ExportedRelation {\n readonly kind: string;\n readonly from: string;\n readonly to: string;\n}\n\n/** One side of a diff: a `--graph-format json` export, read and checked. */\nexport interface GraphExport {\n readonly generator: Generator | null;\n readonly documents: readonly ExportedDocument[];\n readonly items: readonly ExportedItem[];\n readonly edges: readonly ExportedRelation[];\n}\n\nexport interface DocumentChange {\n readonly id: string;\n readonly path?: readonly [string, string] | undefined;\n readonly title?: readonly [string, string] | undefined;\n readonly phase?: readonly [string, string] | undefined;\n readonly status?: readonly [string | null, string | null] | undefined;\n}\n\nexport interface ObligationRef {\n readonly document: string;\n readonly section: readonly string[];\n /**\n * The section path as a reader wants it: without the document's own title\n * heading, which every item under it shares and the id already names. Items\n * are matched on the same headings, kept as a list so that no heading holding\n * \" > \" can pass for two.\n */\n readonly place: string;\n readonly title: string;\n}\n\n/** An item with no pair: its state on the one side it exists on, and no more. */\nexport interface UnpairedObligation extends ObligationRef {\n readonly openness: string;\n}\n\nexport interface Transition extends ObligationRef {\n readonly openness: readonly [string, string];\n}\n\nexport interface GraphDiff {\n readonly generators: { readonly before: Generator | null; readonly after: Generator | null };\n readonly documents: {\n readonly added: readonly ExportedDocument[];\n readonly removed: readonly ExportedDocument[];\n readonly changed: readonly DocumentChange[];\n };\n readonly relations: { readonly added: readonly ExportedRelation[]; readonly removed: readonly ExportedRelation[] };\n readonly obligations: {\n readonly transitions: readonly Transition[];\n readonly appeared: readonly UnpairedObligation[];\n readonly disappeared: readonly UnpairedObligation[];\n };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Reading an export */\n/* -------------------------------------------------------------------------- */\n\n// Every caller goes on to read a field and check it with `text` or\n// `Array.isArray`, and a number, string or boolean yields `undefined` for every\n// field read here, which both refuse. So the `typeof` decides nothing a caller\n// can see, and its mutant is equivalent.\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction text(value: unknown): string | null {\n return typeof value === 'string' ? value : null;\n}\n\n/**\n * Reads one export.\n *\n * Checked as far as the comparison reads it and no further: a field this does\n * not use is not a reason to refuse a file, and a later export that adds fields\n * is still version 1.\n */\nexport function parseGraphExport(raw: string, source: string): GraphExport {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n throw new DiffInputError(`${source} is not JSON; make it with \\`spec-graph graph --graph-format json\\``);\n }\n if (!isRecord(parsed) || !Array.isArray(parsed['nodes']) || !Array.isArray(parsed['edges'])) {\n throw new DiffInputError(`${source} is not a graph export; make it with \\`spec-graph graph --graph-format json\\``);\n }\n if (parsed['version'] !== 1) {\n throw new DiffInputError(`${source} is export version ${JSON.stringify(parsed['version'])}, and this reads version 1`);\n }\n\n const generator = isRecord(parsed['generator']) ? parsed['generator'] : null;\n const name = generator ? text(generator['name']) : null;\n const version = generator ? text(generator['version']) : null;\n\n const documents: ExportedDocument[] = [];\n const items: ExportedItem[] = [];\n parsed['nodes'].forEach((node: unknown, index) => {\n const id = isRecord(node) ? text(node['id']) : null;\n if (!isRecord(node) || id === null) throw new DiffInputError(`${source}: node ${index} has no id`);\n if (node['kind'] === 'document') {\n documents.push({\n id,\n title: text(node['title']) ?? '',\n path: text(node['path']) ?? '',\n phase: text(node['phase']) ?? 'unknown',\n status: text(node['status']),\n });\n } else if (node['kind'] === 'item') {\n const section = Array.isArray(node['section']) ? node['section'].filter((part): part is string => typeof part === 'string') : [];\n items.push({\n id,\n title: text(node['title']) ?? '',\n document: text(node['document']) ?? '',\n section,\n openness: text(node['openness']) ?? 'unknown',\n declared: typeof node['declared'] === 'boolean' ? node['declared'] : null,\n });\n } else {\n throw new DiffInputError(`${source}: node ${id} is neither a document nor an item`);\n }\n });\n\n const edges: ExportedRelation[] = parsed['edges'].map((edge: unknown, index) => {\n const kind = isRecord(edge) ? text(edge['kind']) : null;\n const from = isRecord(edge) ? text(edge['from']) : null;\n const to = isRecord(edge) ? text(edge['to']) : null;\n if (kind === null || from === null || to === null) throw new DiffInputError(`${source}: edge ${index} is missing its kind or ends`);\n return { kind, from, to };\n });\n\n return { generator: name !== null && version !== null ? { name, version } : null, documents, items, edges };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Comparing */\n/* -------------------------------------------------------------------------- */\n\n// Code-unit order, not locale order: the same input sorts the same way on every\n// machine, which is what keeps a report byte-identical.\nfunction byText(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** Compares two exports. Pure, and deterministic in everything it returns. */\nexport function diffExports(before: GraphExport, after: GraphExport): GraphDiff {\n return {\n generators: { before: before.generator, after: after.generator },\n documents: compareDocuments(before, after),\n relations: compareRelations(before, after),\n obligations: compareObligations(before, after),\n };\n}\n\nfunction compareDocuments(before: GraphExport, after: GraphExport): GraphDiff['documents'] {\n const was = new Map(before.documents.map((document) => [document.id, document]));\n const now = new Map(after.documents.map((document) => [document.id, document]));\n const changed: DocumentChange[] = [];\n for (const [id, next] of now) {\n const previous = was.get(id);\n if (previous === undefined) continue;\n // The id is the decision's name, so the same id at a new path is the same\n // decision moved, never one removed and another added (ADR-0009).\n const change: DocumentChange = {\n id,\n ...(previous.path !== next.path && { path: [previous.path, next.path] satisfies DocumentChange['path'] }),\n ...(previous.title !== next.title && { title: [previous.title, next.title] satisfies DocumentChange['title'] }),\n ...(previous.phase !== next.phase && { phase: [previous.phase, next.phase] satisfies DocumentChange['phase'] }),\n ...(previous.status !== next.status && { status: [previous.status, next.status] satisfies DocumentChange['status'] }),\n };\n if (Object.keys(change).length > 1) changed.push(change);\n }\n const ids = (documents: Iterable<ExportedDocument>) => [...documents].sort((a, b) => byText(a.id, b.id));\n return {\n added: ids([...now.values()].filter((document) => !was.has(document.id))),\n removed: ids([...was.values()].filter((document) => !now.has(document.id))),\n changed: changed.sort((a, b) => byText(a.id, b.id)),\n };\n}\n\n/**\n * The relations between documents, projected the way `--documents-only`\n * projects a graph: an item's edges lifted onto its document, and a relation\n * that ends where it began dropped - which is also what becomes of a document\n * containing its own items, so containment survives only between documents.\n * Where a relation was declared is not part of it - moving a supersession from\n * a sentence into front matter changes nothing a reader relies on.\n */\nfunction relationsOf(graph: GraphExport): Map<string, ExportedRelation> {\n // A document, or a target nothing in the export defines, stands for itself.\n const owners = new Map(graph.items.map((item) => [item.id, item.document]));\n const out = new Map<string, ExportedRelation>();\n for (const edge of graph.edges) {\n const from = owners.get(edge.from) ?? edge.from;\n const to = owners.get(edge.to) ?? edge.to;\n if (from === to) continue;\n // Tab-joined: kinds and ids cannot contain one.\n out.set(`${edge.kind}\\t${from}\\t${to}`, { kind: edge.kind, from, to });\n }\n return out;\n}\n\nfunction compareRelations(before: GraphExport, after: GraphExport): GraphDiff['relations'] {\n const was = relationsOf(before);\n const now = relationsOf(after);\n const sorted = (entries: [string, ExportedRelation][]) => entries.sort(([a], [b]) => byText(a, b)).map(([, relation]) => relation);\n return {\n added: sorted([...now].filter(([key]) => !was.has(key))),\n removed: sorted([...was].filter(([key]) => !now.has(key))),\n };\n}\n\n/**\n * Obligations by where they sit and then by title, heading by heading, so a\n * section's own questions come before those of the sections under it.\n */\nfunction byPlace(a: ObligationRef, b: ObligationRef): number {\n const left = [a.document, ...a.section];\n const right = [b.document, ...b.section];\n // Past the end of the shorter path `byText` meets `undefined`, which is\n // neither less nor greater than anything, and answers 0: the mutants that\n // run the loop on decide nothing the lengths below do not, and are\n // equivalent.\n for (let at = 0; at < left.length && at < right.length; at++) {\n const order = byText(left[at] as string, right[at] as string);\n if (order !== 0) return order;\n }\n return left.length - right.length || byText(a.title, b.title);\n}\n\n/**\n * The headings an item sits under, below its document's own. A section path\n * starts at the document's heading, which is its title, so without this a\n * retitled document would lose track of every question in it.\n */\nfunction headingsIn(graph: GraphExport): (item: ExportedItem) => readonly string[] {\n const titles = new Map(graph.documents.map((document) => [document.id, document.title]));\n return (item) => (item.section[0] === titles.get(item.document) ? item.section.slice(1) : item.section);\n}\n\nfunction compareObligations(before: GraphExport, after: GraphExport): GraphDiff['obligations'] {\n const headingsBefore = headingsIn(before);\n const headingsAfter = headingsIn(after);\n // Seeded with a string, as a mutant seeds it, this holds a \"pair\" of two\n // characters with no openness on either side, which the transition filter\n // drops: that mutant is equivalent.\n const pairs: [ExportedItem, ExportedItem][] = [];\n const paired = new Set<ExportedItem>();\n\n // A declared id names the same item in both states however it was reworded or\n // moved - provided it names one item on each side. An export without the flag\n // cannot say which ids were declared, so none of its ids are trusted.\n const declaredIn = (items: readonly ExportedItem[]) => {\n const out = new Map<string, ExportedItem | null>();\n for (const item of items) {\n if (item.declared !== true) continue;\n out.set(item.id, out.has(item.id) ? null : item);\n }\n return out;\n };\n const declaredBefore = declaredIn(before.items);\n const declaredAfter = declaredIn(after.items);\n for (const [id, item] of declaredBefore) {\n const match = declaredAfter.get(id);\n if (item === null || match === null || match === undefined) continue;\n pairs.push([item, match]);\n paired.add(item);\n paired.add(match);\n }\n\n // Otherwise the same document, headings and title, and only when nothing else\n // on either side shares them: two identical titles in one section cannot be\n // told apart, so neither is paired. Joined as JSON so that no two different\n // triples can produce the same key.\n const group = (items: readonly ExportedItem[], headings: (item: ExportedItem) => readonly string[]) => {\n const out = new Map<string, ExportedItem[]>();\n for (const item of items) {\n if (paired.has(item)) continue;\n const key = JSON.stringify([item.document, headings(item), item.title]);\n out.set(key, [...(out.get(key) ?? []), item]);\n }\n return out;\n };\n const was = group(before.items, headingsBefore);\n const now = group(after.items, headingsAfter);\n for (const [key, previous] of was) {\n const next = now.get(key);\n if (previous.length !== 1 || next?.length !== 1) continue;\n const [a, b] = [previous[0] as ExportedItem, next[0] as ExportedItem];\n pairs.push([a, b]);\n paired.add(a);\n paired.add(b);\n }\n\n const refIn = (headings: (item: ExportedItem) => readonly string[]) => (item: ExportedItem): ObligationRef => ({\n document: item.document,\n section: item.section,\n place: headings(item).join(' > '),\n title: item.title,\n });\n const wasRef = refIn(headingsBefore);\n const nowRef = refIn(headingsAfter);\n return {\n transitions: pairs\n .filter(([a, b]) => a.openness !== b.openness)\n .map(([a, b]) => ({ ...nowRef(b), openness: [a.openness, b.openness] satisfies Transition['openness'] }))\n .sort(byPlace),\n appeared: after.items.filter((item) => !paired.has(item)).map((item) => ({ ...nowRef(item), openness: item.openness })).sort(byPlace),\n disappeared: before.items.filter((item) => !paired.has(item)).map((item) => ({ ...wasRef(item), openness: item.openness })).sort(byPlace),\n };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Reporting */\n/* -------------------------------------------------------------------------- */\n\nfunction generatorName(generator: Generator | null): string {\n return generator === null ? 'an unknown version' : `${generator.name} ${generator.version}`;\n}\n\n/**\n * The warning a diff carries when its two exports may disagree for a reason\n * that is not the repository. `null` when both name the same generator.\n */\nexport function generatorWarning(diff: GraphDiff): string | null {\n const { before, after } = diff.generators;\n if (before !== null && after !== null && before.name === after.name && before.version === after.version) return null;\n return `the exports were made by ${generatorName(before)} and ${generatorName(after)}; a change in extraction between versions reads as a change in the repository`;\n}\n\nfunction changeCount(diff: GraphDiff): { documents: number; relations: number; obligations: number } {\n return {\n documents: diff.documents.added.length + diff.documents.removed.length + diff.documents.changed.length,\n relations: diff.relations.added.length + diff.relations.removed.length,\n obligations: diff.obligations.transitions.length + diff.obligations.appeared.length + diff.obligations.disappeared.length,\n };\n}\n\nfunction plural(n: number, word: string): string {\n return `${n} ${n === 1 ? word : `${word}s`}`;\n}\n\n/** One sentence for the whole diff, which is what a pull-request reader sees first. */\nexport function diffVerdict(diff: GraphDiff): string {\n const count = changeCount(diff);\n const parts = [\n count.documents > 0 ? plural(count.documents, 'document') : null,\n count.relations > 0 ? plural(count.relations, 'relation') : null,\n count.obligations > 0 ? plural(count.obligations, 'obligation') : null,\n ].filter((part): part is string => part !== null);\n if (parts.length === 0) return 'No relational change.';\n const listed = parts.length === 1 ? (parts[0] as string) : `${parts.slice(0, -1).join(', ')} and ${parts[parts.length - 1]!}`;\n return `${listed} changed.`;\n}\n\nfunction where(ref: ObligationRef): string {\n return ref.place === '' ? ref.document : `${ref.document} > ${ref.place}`;\n}\n\nfunction transitionWord([from, to]: readonly [string, string]): string {\n return to === 'closed' ? 'resolved' : from === 'closed' ? 'reopened' : to === 'partial' ? 'narrowed' : 'widened';\n}\n\nfunction describeChange(change: DocumentChange): string {\n const parts: string[] = [];\n if (change.path) parts.push(`moved from ${change.path[0]} to ${change.path[1]}`);\n if (change.phase) parts.push(`${change.phase[0]} -> ${change.phase[1]}`);\n if (change.status) parts.push(`status ${change.status[0] ?? 'none'} -> ${change.status[1] ?? 'none'}`);\n if (change.title) parts.push(`retitled \"${change.title[1]}\"`);\n return parts.join('; ');\n}\n\n/** The report for a terminal. */\nexport function formatDiffText(diff: GraphDiff): string {\n const lines: string[] = [];\n const warning = generatorWarning(diff);\n if (warning !== null) lines.push(`warning: ${warning}`, '');\n lines.push(diffVerdict(diff));\n\n const { documents, relations, obligations } = diff;\n if (documents.added.length + documents.removed.length + documents.changed.length > 0) {\n lines.push('', 'Documents');\n for (const document of documents.added) lines.push(` + ${document.id} ${document.title} (${document.phase})`);\n for (const document of documents.removed) lines.push(` - ${document.id} ${document.title}`);\n for (const change of documents.changed) lines.push(` ~ ${change.id} ${describeChange(change)}`);\n }\n if (relations.added.length + relations.removed.length > 0) {\n lines.push('', 'Relations');\n for (const relation of relations.added) lines.push(` + ${relation.from} -${relation.kind}-> ${relation.to}`);\n for (const relation of relations.removed) lines.push(` - ${relation.from} -${relation.kind}-> ${relation.to}`);\n }\n if (obligations.transitions.length + obligations.appeared.length + obligations.disappeared.length > 0) {\n lines.push('', 'Obligations');\n // Padded to the longest word, so the places line up.\n const word = (text: string) => text.padEnd('disappeared'.length);\n for (const transition of obligations.transitions) {\n lines.push(` ${word(transitionWord(transition.openness))} ${where(transition)}: \"${transition.title}\" (${transition.openness[0]} -> ${transition.openness[1]})`);\n }\n for (const item of obligations.appeared) lines.push(` ${word('appeared')} ${where(item)}: \"${item.title}\" (${item.openness})`);\n for (const item of obligations.disappeared) lines.push(` disappeared ${where(item)}: \"${item.title}\" (was ${item.openness})`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/** The report for a bot: the diff itself, with the verdict and warning beside it. */\nexport function formatDiffJson(diff: GraphDiff): string {\n return `${JSON.stringify({ version: 1, verdict: diffVerdict(diff), warning: generatorWarning(diff), ...diff }, null, 2)}\\n`;\n}\n\n// A table cell: a pipe would end the cell, and a newline would end the row.\nfunction cell(value: string): string {\n return value.replace(/[|]/g, '|').replace(/\\s+/g, ' ');\n}\n\n/** The report for a job summary or a pull-request comment. */\nexport function formatDiffMarkdown(diff: GraphDiff): string {\n const lines: string[] = ['### spec-graph diff', '', diffVerdict(diff), ''];\n const warning = generatorWarning(diff);\n if (warning !== null) lines.push(`> **Warning:** ${cell(warning)}.`, '');\n\n const { documents, relations, obligations } = diff;\n if (documents.added.length + documents.removed.length + documents.changed.length > 0) {\n lines.push('| | Document | Change |', '| --- | --- | --- |');\n for (const document of documents.added) lines.push(`| added | \\`${cell(document.id)}\\` | ${cell(document.title)} - ${cell(document.phase)} |`);\n for (const document of documents.removed) lines.push(`| removed | \\`${cell(document.id)}\\` | ${cell(document.title)} |`);\n for (const change of documents.changed) lines.push(`| changed | \\`${cell(change.id)}\\` | ${cell(describeChange(change))} |`);\n lines.push('');\n }\n if (relations.added.length + relations.removed.length > 0) {\n lines.push('| | From | Relation | To |', '| --- | --- | --- | --- |');\n for (const relation of relations.added) lines.push(`| added | \\`${cell(relation.from)}\\` | ${cell(relation.kind)} | \\`${cell(relation.to)}\\` |`);\n for (const relation of relations.removed) lines.push(`| removed | \\`${cell(relation.from)}\\` | ${cell(relation.kind)} | \\`${cell(relation.to)}\\` |`);\n lines.push('');\n }\n if (obligations.transitions.length + obligations.appeared.length + obligations.disappeared.length > 0) {\n lines.push('| | Where | Obligation |', '| --- | --- | --- |');\n for (const transition of obligations.transitions) {\n lines.push(`| ${transitionWord(transition.openness)} | ${cell(where(transition))} | ${cell(transition.title)} (${transition.openness[0]} -> ${transition.openness[1]}) |`);\n }\n for (const item of obligations.appeared) lines.push(`| appeared | ${cell(where(item))} | ${cell(item.title)} (${item.openness}) |`);\n for (const item of obligations.disappeared) lines.push(`| disappeared | ${cell(where(item))} | ${cell(item.title)} (was ${item.openness}) |`);\n lines.push('');\n }\n return `${lines.join('\\n').trimEnd()}\\n`;\n}\n"]}
|
package/dist/directives.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,cAAc,EAAyD,MAAM,eAAe,CAAC;AAItG,MAAM,KAAK,GAAwB,IAAI,GAAG,CAAgB;IACxD,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;IACb,cAAc;CACf,CAAC,CAAC;AAoBH,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,MAAM,SAAS,GAAG,0EAA0E,CAAC;AAE7F,qFAAqF;AACrF,MAAM,MAAM,GAAuD;IACjE,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;IACzD,0EAA0E;IAC1E,wEAAwE;IACxE,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC;IACtD,WAAW,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC;IAC7C,aAAa,EAAE,CAAC,QAAQ,CAAC;CAC1B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgC;IAC9D,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK;YAAE,SAAS;QACvC,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI;YAAE,SA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;QACX,CAAC;QACD,uEAAuE;QACvE,wBAAwB;QACxB,MAAM,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAChD,IAAI,OAAO,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Explicit annotations, written as HTML comments.\n *\n * Inference covers the overwhelming majority of real documents, but inference\n * that cannot be overridden is a trap: the first time it guesses wrong about a\n * document somebody cannot restructure, the whole tool gets switched off. These\n * directives are the escape hatch, and they are HTML comments so they stay\n * invisible in GitHub, MkDocs, Docusaurus and every other renderer.\n *\n * ```md\n * <!-- @spec-node id=\"ADR-0007\" status=\"accepted\" aliases=\"adr-7, sharding\" -->\n * <!-- @spec-item id=\"shard-key\" state=\"narrowed\" -->\n * <!-- @spec-edge kind=\"delegates-to\" to=\"ADR-0011#scope\" -->\n * <!-- @spec-ignore -->\n * ```\n *\n * A directive always wins over anything inferred, and says so in the report, so\n * an override is visible rather than mysterious.\n */\n\nimport { isMarkdownLine, type HtmlComment, type ListItem, type ScannedDocument } from './markdown.js';\n\nexport type DirectiveName = 'spec-node' | 'spec-item' | 'spec-edge' | 'spec-ignore' | 'spec-history';\n\nconst KNOWN: ReadonlySet<string> = new Set<DirectiveName>([\n 'spec-node',\n 'spec-item',\n 'spec-edge',\n 'spec-ignore',\n 'spec-history',\n]);\n\nexport interface Attribute {\n readonly value: string;\n /** Absolute offset of the value text, quotes excluded. */\n readonly start: number;\n readonly end: number;\n}\n\nexport interface Directive {\n readonly name: DirectiveName;\n readonly attributes: ReadonlyMap<string, Attribute>;\n /** Offset of the enclosing comment. */\n readonly start: number;\n readonly end: number;\n readonly line: number;\n /** Attribute names that were written but are not part of this directive. */\n readonly unknownAttributes: readonly string[];\n}\n\nconst DIRECTIVE_HEAD = /^\\s*@([a-z][a-z0-9-]*)/;\nconst ATTRIBUTE = /([A-Za-z_][A-Za-z0-9_-]*)\\s*(?:=\\s*(\"([^\"]*)\"|'([^']*)'|([^\\s\"'<>]+)))?/g;\n\n/** Attributes each directive understands. Anything else is reported, not ignored. */\nconst SCHEMA: Readonly<Record<DirectiveName, readonly string[]>> = {\n 'spec-node': ['id', 'status', 'title', 'aliases', 'kind'],\n // Takes no attributes: the file either is a record or it is not. A mutant\n // that lists `Stryker was here` lists no name: one never holds a space.\n 'spec-history': [],\n 'spec-item': ['id', 'state', 'title', 'owner', 'note'],\n 'spec-edge': ['kind', 'to', 'from', 'reason'],\n 'spec-ignore': ['reason'],\n};\n\n/**\n * Reads every spec-graph directive out of a document's HTML comments.\n *\n * Only out of a comment that closes. One that opens a line and never does runs\n * to the end of the document, and read as a directive, a stray\n * `<!-- @spec-ignore` would drop the file, and a stray `<!-- @spec-node` would\n * take every `name=value` in the rest of it as an attribute.\n */\nexport function parseDirectives(comments: readonly HtmlComment[]): Directive[] {\n const out: Directive[] = [];\n for (const comment of comments) {\n if (comment.closed === false) continue;\n const head = DIRECTIVE_HEAD.exec(comment.inner);\n if (!head) continue;\n const name = head[1] as string;\n if (!KNOWN.has(name)) continue;\n\n const directiveName = name as DirectiveName;\n // The head is anchored, so it starts where the comment's text does.\n const bodyStart = (head[0] as string).length;\n const body = comment.inner.slice(bodyStart);\n const attributes = new Map<string, Attribute>();\n const unknown: string[] = [];\n const allowed = SCHEMA[directiveName];\n\n for (const m of body.matchAll(ATTRIBUTE)) {\n const key = (m[1] as string).toLowerCase();\n const quoted = m[3] ?? m[4];\n const bare = m[5];\n // A bare attribute is a flag: `<!-- @spec-ignore reason -->`.\n const value = quoted ?? bare ?? 'true';\n const raw = m[2];\n const valueOffset =\n raw === undefined\n ? (m.index ?? 0) + (m[0] as string).length\n : (m.index ?? 0) + (m[0] as string).indexOf(raw) + (quoted === undefined ? 0 : 1);\n const start = comment.innerStart + bodyStart + valueOffset;\n\n if (!allowed.includes(key)) unknown.push(key);\n attributes.set(key, { value, start, end: start + value.length });\n }\n\n out.push({\n name: directiveName,\n attributes,\n start: comment.start,\n end: comment.end,\n line: comment.line,\n unknownAttributes: unknown,\n });\n }\n return out;\n}\n\n/** Reads an attribute, trimmed. Returns `null` when absent or blank. */\nexport function attr(directive: Directive, name: string): Attribute | null {\n const found = directive.attributes.get(name);\n if (!found) return null;\n const trimmed = found.value.trim();\n if (trimmed.length === 0) return null;\n const offset = found.value.indexOf(trimmed);\n return { value: trimmed, start: found.start + offset, end: found.start + offset + trimmed.length };\n}\n\n/** Splits a comma- or whitespace-separated attribute into its parts. */\nexport function attrList(directive: Directive, name: string): string[] {\n const found = attr(directive, name);\n if (!found) return [];\n // Whitespace is a separator, so no part holds any to trim. The filter drops\n // what a separator at either end leaves, and would drop what each separator\n // in a run leaves too, so splitting at one at a time is equivalent.\n return found.value.split(/[,;\\s]+/).filter((part) => part.length > 0);\n}\n\n/**\n * Finds the directive that annotates a given region.\n *\n * A `@spec-item` directive may sit on the line above the item, on the same\n * line, or inside the item body. All three read naturally in the source, so all\n * three are accepted, with the closest preceding directive winning.\n *\n * It answers for one region with no view of the others, so a directive in reach\n * of two items is found for both. Extraction uses `bindItemDirectives`.\n */\nexport function directiveFor(\n directives: readonly Directive[],\n name: DirectiveName,\n region: { start: number; end: number },\n /** How far above the region a directive may sit and still apply. */\n lookBehind: number,\n): Directive | null {\n let best: Directive | null = null;\n for (const directive of directives) {\n if (directive.name !== name) continue;\n const inside = directive.start >= region.start && directive.end <= region.end;\n const above = directive.end <= region.start && region.start - directive.end <= lookBehind;\n if (!inside && !above) continue;\n // Two directives never start at one offset, so `>=` reads the same.\n if (best === null || directive.start > best.start) best = directive;\n }\n return best;\n}\n\n/**\n * Pairs each `@spec-item` directive with the one list item it annotates.\n *\n * A directive is written for one item, so it binds to one: the item directly\n * below it, with nothing but blank lines and other comments between, or else\n * the item it is written in, the innermost where items nest. An item that\n * several bind to takes the last one written.\n *\n * A directive alone on its line is in an item only when indented further than\n * that item's marker, which is how CommonMark reads it. Indented under an item,\n * it annotates that item and not the sibling below; flush between two items, it\n * annotates the second.\n */\nexport function bindItemDirectives(\n scanned: ScannedDocument,\n directives: readonly Directive[],\n): Map<ListItem, Directive> {\n const bound = new Map<ListItem, Directive>();\n const wanted = directives.filter((directive) => directive.name === 'spec-item');\n // Most documents carry none. Sparing them the pass over their lines changes\n // how long this takes and nothing else.\n if (wanted.length === 0) return bound;\n\n const { lines, listItems } = scanned;\n const masked = scanned.masks.structure;\n // The indentation of each line holding nothing but whitespace and comments.\n // Code and raw-text HTML are masked too, so they are told apart by their flags.\n const quiet = new Map<number, number>();\n // For every other line, where the run of quiet lines directly above it began,\n // when there was one.\n const quietFrom = new Map<number, number | undefined>();\n let run: number | undefined;\n for (const line of lines) {\n if (isMarkdownLine(line) && masked.slice(line.contentStart, line.end).trim() === '') {\n quiet.set(line.line, line.indent);\n run ??= line.start;\n continue;\n }\n quietFrom.set(line.line, run);\n run = undefined;\n }\n\n // The items whose text the cursor is in, outermost first. Items nest, so one\n // that has ended is always on top. An item ends at the end of a line, the next\n // thing starts on a later one, and no two things start together, so `<` and\n // `<=` read alike in every comparison of offsets below.\n const open: ListItem[] = [];\n const close = (offset: number): void => {\n while (open.length > 0 && (open[open.length - 1] as ListItem).end <= offset) open.pop();\n };\n let next = 0;\n for (const directive of wanted) {\n while (next < listItems.length && (listItems[next] as ListItem).start < directive.start) {\n const item = listItems[next] as ListItem;\n close(item.start);\n open.push(item);\n next += 1;\n }\n close(directive.start);\n\n // Sharing its line with text, a directive is in whatever that text is in.\n const indent = quiet.get(directive.line) ?? Infinity;\n // No deeper than the scanner already went to find where these items end.\n let depth = open.length - 1;\n while (depth >= 0 && (open[depth] as ListItem).indent >= indent) depth -= 1;\n const holder = open[depth];\n\n const below = listItems[next];\n const directlyAbove = below !== undefined && (quietFrom.get(below.line) ?? Infinity) <= directive.start;\n if (directlyAbove && (holder === undefined || below.start < holder.end)) {\n bound.set(below, directive);\n continue;\n }\n // Flush under an item and above no other, it continues the item as any\n // unindented line does.\n const written = holder ?? open[open.length - 1];\n if (written !== undefined) bound.set(written, directive);\n }\n return bound;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,cAAc,EAAyD,MAAM,eAAe,CAAC;AAItG,MAAM,KAAK,GAAwB,IAAI,GAAG,CAAgB;IACxD,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;IACb,cAAc;CACf,CAAC,CAAC;AAoBH,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,MAAM,SAAS,GAAG,0EAA0E,CAAC;AAE7F,qFAAqF;AACrF,MAAM,MAAM,GAAuD;IACjE,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;IACzD,0EAA0E;IAC1E,wEAAwE;IACxE,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC;IACtD,WAAW,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC;IAC7C,aAAa,EAAE,CAAC,QAAQ,CAAC;CAC1B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgC;IAC9D,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK;YAAE,SAAS;QACvC,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAW,CAAC;QAC/B,IAAI,CA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I,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAChD,IAAI,OAAO,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Explicit annotations, written as HTML comments.\n *\n * Inference covers the overwhelming majority of real documents, but inference\n * that cannot be overridden is a trap: the first time it guesses wrong about a\n * document somebody cannot restructure, the whole tool gets switched off. These\n * directives are the escape hatch, and they are HTML comments so they stay\n * invisible in GitHub, MkDocs, Docusaurus and every other renderer.\n *\n * ```md\n * <!-- @spec-node id=\"ADR-0007\" status=\"accepted\" aliases=\"adr-7, sharding\" -->\n * <!-- @spec-item id=\"shard-key\" state=\"narrowed\" -->\n * <!-- @spec-edge kind=\"delegates-to\" to=\"ADR-0011#scope\" -->\n * <!-- @spec-ignore -->\n * ```\n *\n * A directive always wins over anything inferred, and says so in the report, so\n * an override is visible rather than mysterious.\n */\n\nimport { isMarkdownLine, type HtmlComment, type ListItem, type ScannedDocument } from './markdown.js';\n\nexport type DirectiveName = 'spec-node' | 'spec-item' | 'spec-edge' | 'spec-ignore' | 'spec-history';\n\nconst KNOWN: ReadonlySet<string> = new Set<DirectiveName>([\n 'spec-node',\n 'spec-item',\n 'spec-edge',\n 'spec-ignore',\n 'spec-history',\n]);\n\nexport interface Attribute {\n readonly value: string;\n /** Absolute offset of the value text, quotes excluded. */\n readonly start: number;\n readonly end: number;\n}\n\nexport interface Directive {\n readonly name: DirectiveName;\n readonly attributes: ReadonlyMap<string, Attribute>;\n /** Offset of the enclosing comment. */\n readonly start: number;\n readonly end: number;\n readonly line: number;\n /** Attribute names that were written but are not part of this directive. */\n readonly unknownAttributes: readonly string[];\n}\n\nconst DIRECTIVE_HEAD = /^\\s*@([a-z][a-z0-9-]*)/;\nconst ATTRIBUTE = /([A-Za-z_][A-Za-z0-9_-]*)\\s*(?:=\\s*(\"([^\"]*)\"|'([^']*)'|([^\\s\"'<>]+)))?/g;\n\n/** Attributes each directive understands. Anything else is reported, not ignored. */\nconst SCHEMA: Readonly<Record<DirectiveName, readonly string[]>> = {\n 'spec-node': ['id', 'status', 'title', 'aliases', 'kind'],\n // Takes no attributes: the file either is a record or it is not. A mutant\n // that lists `Stryker was here` lists no name: one never holds a space.\n 'spec-history': [],\n 'spec-item': ['id', 'state', 'title', 'owner', 'note'],\n 'spec-edge': ['kind', 'to', 'from', 'reason'],\n 'spec-ignore': ['reason'],\n};\n\n/**\n * Reads every spec-graph directive out of a document's HTML comments.\n *\n * Only out of a comment that closes. One that opens a line and never does runs\n * to the end of the document, and read as a directive, a stray\n * `<!-- @spec-ignore` would drop the file, and a stray `<!-- @spec-node` would\n * take every `name=value` in the rest of it as an attribute.\n */\nexport function parseDirectives(comments: readonly HtmlComment[]): Directive[] {\n const out: Directive[] = [];\n for (const comment of comments) {\n if (comment.closed === false) continue;\n const head = DIRECTIVE_HEAD.exec(comment.inner);\n if (!head) continue;\n const name = head[1] as string;\n if (!KNOWN.has(name)) continue;\n\n const directiveName = name as DirectiveName;\n // The head is anchored, so it starts where the comment's text does.\n const bodyStart = (head[0] as string).length;\n const body = comment.inner.slice(bodyStart);\n const attributes = new Map<string, Attribute>();\n const unknown: string[] = [];\n const allowed = SCHEMA[directiveName];\n\n for (const m of body.matchAll(ATTRIBUTE)) {\n const key = (m[1] as string).toLowerCase();\n const quoted = m[3] ?? m[4];\n const bare = m[5];\n // A bare attribute is a flag: `<!-- @spec-ignore reason -->`.\n const value = quoted ?? bare ?? 'true';\n const raw = m[2];\n const valueOffset =\n raw === undefined\n ? (m.index ?? 0) + (m[0] as string).length\n : (m.index ?? 0) + (m[0] as string).indexOf(raw) + (quoted === undefined ? 0 : 1);\n const start = comment.innerStart + bodyStart + valueOffset;\n\n if (!allowed.includes(key)) unknown.push(key);\n attributes.set(key, { value, start, end: start + value.length });\n }\n\n out.push({\n name: directiveName,\n attributes,\n start: comment.start,\n end: comment.end,\n line: comment.line,\n unknownAttributes: unknown,\n });\n }\n return out;\n}\n\n/** Reads an attribute, trimmed. Returns `null` when absent or blank. */\nexport function attr(directive: Directive, name: string): Attribute | null {\n const found = directive.attributes.get(name);\n if (!found) return null;\n const trimmed = found.value.trim();\n if (trimmed.length === 0) return null;\n const offset = found.value.indexOf(trimmed);\n return { value: trimmed, start: found.start + offset, end: found.start + offset + trimmed.length };\n}\n\n/** Splits a comma- or whitespace-separated attribute into its parts. */\nexport function attrList(directive: Directive, name: string): string[] {\n const found = attr(directive, name);\n if (!found) return [];\n // Whitespace is a separator, so no part holds any to trim. The filter drops\n // what a separator at either end leaves, and would drop what each separator\n // in a run leaves too, so splitting at one at a time is equivalent.\n return found.value.split(/[,;\\s]+/).filter((part) => part.length > 0);\n}\n\n/**\n * Finds the directive that annotates a given region.\n *\n * A `@spec-item` directive may sit on the line above the item, on the same\n * line, or inside the item body. All three read naturally in the source, so all\n * three are accepted, with the closest preceding directive winning.\n *\n * It answers for one region with no view of the others, so a directive in reach\n * of two items is found for both. Extraction uses `bindItemDirectives`.\n */\nexport function directiveFor(\n directives: readonly Directive[],\n name: DirectiveName,\n region: { start: number; end: number },\n /** How far above the region a directive may sit and still apply. */\n lookBehind: number,\n): Directive | null {\n let best: Directive | null = null;\n for (const directive of directives) {\n if (directive.name !== name) continue;\n const inside = directive.start >= region.start && directive.end <= region.end;\n const above = directive.end <= region.start && region.start - directive.end <= lookBehind;\n if (!inside && !above) continue;\n // Two directives never start at one offset, so `>=` reads the same.\n if (best === null || directive.start > best.start) best = directive;\n }\n return best;\n}\n\n/**\n * Pairs each `@spec-item` directive with the one list item it annotates.\n *\n * A directive is written for one item, so it binds to one: the item directly\n * below it, with nothing but blank lines and other comments between, or else\n * the item it is written in, the innermost where items nest. An item that\n * several bind to takes the last one written.\n *\n * A directive alone on its line is in an item only when indented further than\n * that item's marker, which is how CommonMark reads it. Indented under an item,\n * it annotates that item and not the sibling below; flush between two items, it\n * annotates the second.\n */\nexport function bindItemDirectives(\n scanned: ScannedDocument,\n directives: readonly Directive[],\n): Map<ListItem, Directive> {\n const bound = new Map<ListItem, Directive>();\n const wanted = directives.filter((directive) => directive.name === 'spec-item');\n // Most documents carry none. Sparing them the pass over their lines changes\n // how long this takes and nothing else.\n if (wanted.length === 0) return bound;\n\n const { lines, listItems } = scanned;\n const masked = scanned.masks.structure;\n // The indentation of each line holding nothing but whitespace and comments.\n // Code and raw-text HTML are masked too, so they are told apart by their flags.\n const quiet = new Map<number, number>();\n // For every other line, where the run of quiet lines directly above it began,\n // when there was one.\n const quietFrom = new Map<number, number | undefined>();\n let run: number | undefined;\n for (const line of lines) {\n if (isMarkdownLine(line) && masked.slice(line.contentStart, line.end).trim() === '') {\n quiet.set(line.line, line.indent);\n run ??= line.start;\n continue;\n }\n quietFrom.set(line.line, run);\n run = undefined;\n }\n\n // The items whose text the cursor is in, outermost first. Items nest, so one\n // that has ended is always on top. An item ends at the end of a line, the next\n // thing starts on a later one, and no two things start together, so `<` and\n // `<=` read alike in every comparison of offsets below.\n const open: ListItem[] = [];\n const close = (offset: number): void => {\n while (open.length > 0 && open[open.length - 1]!.end <= offset) open.pop();\n };\n let next = 0;\n for (const directive of wanted) {\n while (next < listItems.length && (listItems[next] as ListItem).start < directive.start) {\n const item = listItems[next] as ListItem;\n close(item.start);\n open.push(item);\n next += 1;\n }\n close(directive.start);\n\n // Sharing its line with text, a directive is in whatever that text is in.\n const indent = quiet.get(directive.line) ?? Infinity;\n // No deeper than the scanner already went to find where these items end.\n let depth = open.length - 1;\n while (depth >= 0 && (open[depth] as ListItem).indent >= indent) depth -= 1;\n const holder = open[depth];\n\n const below = listItems[next];\n const directlyAbove = below !== undefined && (quietFrom.get(below.line) ?? Infinity) <= directive.start;\n if (directlyAbove && (holder === undefined || below.start < holder.end)) {\n bound.set(below, directive);\n continue;\n }\n // Flush under an item and above no other, it continues the item as any\n // unindented line does.\n const written = holder ?? open[open.length - 1];\n if (written !== undefined) bound.set(written, directive);\n }\n return bound;\n}\n"]}
|
package/dist/extract.js
CHANGED
|
@@ -321,7 +321,9 @@ const VERB_RULES = [
|
|
|
321
321
|
* is worse than no inference at all.
|
|
322
322
|
*
|
|
323
323
|
* The `^` never decides anything: the text tested starts just after a phrase,
|
|
324
|
-
* and a phrase only matches where no letter follows it.
|
|
324
|
+
* and a phrase only matches where no letter follows it. The `$` does: the
|
|
325
|
+
* text ends where the reference begins, so a negation written against the
|
|
326
|
+
* bracket, `nobody[ADR-7]`, has nothing after it.
|
|
325
327
|
*/
|
|
326
328
|
const NEGATION = /(?:^|\s)(?:no|not|nobody|none|never|neither|nor|nothing|without)(?:\s|$)/;
|
|
327
329
|
/** How close a governing phrase must sit to the reference it governs. */
|