@descent-vtt/spec-brief 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rules.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAiC,WAAW,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAe,gBAAgB,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAa,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjI,OAAO,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAqB,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAwC5C,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;AAChF,CAAC;AAED,MAAM,EAAE,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;AAEhD,6EAA6E;AAC7E,MAAM,UAAU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E,EAAE,EAAE,YAAY;QAChB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,kEAAkE;KAChF;CACF,CAAC","sourcesContent":["/**\n * The built-in rules. Each is a pure function of one brief and the corpus\n * around it, and returns what it found with 1-based lines.\n *\n * Structure is checked on live briefs only. An archived brief is a frozen\n * record of the tree before a round, and holding it to today's schema would\n * ask somebody to edit what must not be edited; the rules that do reach the\n * archive are about identity and the freeze itself.\n */\n\nimport { BUILT_IN_FIELDS, type Brief, knownFields, lineOfField } from './brief.js';\nimport { type Config, type SectionRule, statusWords } from './config.js';\nimport { type Corpus, dependencyCycles, duplicateIds, idKey, resolveDependency } from './corpus.js';\nimport { findEntry } from './frontmatter.js';\nimport { integrityOf } from './integrity.js';\nimport { type Glob, hasExtension, held, isGlobSyntax, matchGlob, parseGlob, readingIn, treeOf, WITNESS_BUDGET } from './glob.js';\nimport { hasContent, type Section } from './markdown.js';\nimport { closest } from './schema.js';\nimport { contradictions, patternsOf, scopeOf, type ScopePattern } from './scope.js';\nimport { inWords, labelMatches } from './text.js';\nimport { namesAnEvent } from './trigger.js';\nimport type { Severity, SeveritySetting } from './types.js';\n\nexport interface RuleResult {\n /** 1-based. */\n readonly line: number;\n readonly message: string;\n readonly hint?: string | undefined;\n /** Lower than the rule's severity for this one finding, as a draft's unwritten sections are. */\n readonly severity?: Severity | undefined;\n}\n\nexport interface RuleContext {\n readonly brief: Brief;\n readonly corpus: Corpus;\n readonly config: Config;\n /** The files git sees, or every file without git; `null` when unknown. A rule that needs them stays quiet without them. */\n readonly repoFiles: readonly string[] | null;\n /** Analyses computed once per run and shared by every brief. */\n readonly shared: SharedAnalysis;\n /** A plugin's options from the configuration. */\n readonly options?: unknown;\n}\n\n/** What a rule is called, how loud it is by default, and what it checks. */\nexport interface RuleInfo {\n readonly id: string;\n readonly severity: SeveritySetting;\n readonly description: string;\n}\n\nexport interface Rule extends RuleInfo {\n check(context: RuleContext): readonly RuleResult[] | Promise<readonly RuleResult[]>;\n}\n\nexport interface SharedAnalysis {\n readonly cycles: readonly (readonly Brief[])[];\n readonly duplicates: ReadonlyMap<string, readonly Brief[]>;\n}\n\nexport function analyse(corpus: Corpus): SharedAnalysis {\n return { cycles: dependencyCycles(corpus), duplicates: duplicateIds(corpus) };\n}\n\nconst at = (line0: number): number => line0 + 1;\n\n/** The sections a brief must carry: the configured ones, then its type's. */\nexport function sectionRules(brief: Brief, config: Config): SectionRule[] {\n const typed = brief.type === null ? [] : (config.types[brief.type] ?? []);\n return [...config.sections, ...typed];\n}\n\n/** The headings that fill a section rule. */\nexport function sectionsFilling(brief: Brief, rule: SectionRule): Section[] {\n const names = [rule.name, ...rule.aliases];\n return brief.sections.filter((s) => names.some((name) => labelMatches(s.heading.text, name)));\n}\n\n/** A section's own lines that carry content: comments dropped, sub-headings not counted. */\nfunction contentLines(brief: Brief, section: Section): number[] {\n const headingLines = new Set(brief.scan.headings.map((h) => h.line));\n const lines: number[] = [];\n for (let i = section.heading.line + 1; i < section.end; i += 1) {\n if (!headingLines.has(i) && hasContent(brief.scan.prose[i] as string)) lines.push(i);\n }\n return lines;\n}\n\nfunction isPlaceholder(line: string, placeholders: readonly string[]): boolean {\n const text = line\n .replace(/^\\s*(?:[-*+]|\\d{1,9}[.)])\\s+/, '')\n .replace(/^\\[[ xX]\\]\\s*/, '')\n .replace(/[*_]/g, '')\n .trim();\n if (text === '') return true;\n const lower = text.toLowerCase();\n return placeholders.some((p) => {\n const word = p.toLowerCase();\n return lower === word || (lower.startsWith(word) && /^[\\s:.\\-\\u2014]/.test(lower.slice(word.length)));\n });\n}\n\n/** Completeness findings on a draft are reminders, not failures. */\nfunction leniency(brief: Brief): Severity | undefined {\n return brief.status === 'draft' ? 'warning' : undefined;\n}\n\nfunction live(check: (context: RuleContext) => RuleResult[]): (context: RuleContext) => RuleResult[] {\n return (context) => (context.brief.phase === 'live' ? check(context) : []);\n}\n\nconst SCOPE_FIELDS = ['affectedFiles', 'protectedFiles'] as const;\n\nconst quoted = (items: readonly string[]): string => inWords(items.map((item) => `\"${item}\"`));\n\n/**\n * The paths a pattern names with no glob syntax that the tree does not hold\n * and whose names carry no extension. The tree reads each as a file, and the\n * spelling cannot say whether a directory was meant.\n */\nexport function unheldLiterals(glob: Glob, files: readonly string[]): string[] {\n const tree = treeOf(files);\n return glob.literals\n .map((literal) => literal.path)\n .filter((path) => held(tree, path) === null && !hasExtension(path.slice(path.lastIndexOf('/') + 1)));\n}\n\n/**\n * Affected patterns a brief's own protections cover entirely: one error for\n * all of them, and a warning for those the search could not decide.\n */\nexport function scopeContradiction(brief: Brief, repoFiles: readonly string[] | null, budget: number = WITNESS_BUDGET): RuleResult[] {\n const { covered, undecided } = contradictions(scopeOf(brief, readingIn(repoFiles)), budget);\n const line = at(lineOfField(brief, 'protectedFiles'));\n const results: RuleResult[] = [];\n if (covered.length > 0) {\n const one = covered.length === 1;\n results.push({\n line,\n message: `${quoted(covered)} in affectedFiles ${one ? 'is' : 'are'} entirely protected, so nothing of ${one ? 'it' : 'them'} is writable`,\n hint: `drop ${one ? 'it' : 'them'} from affectedFiles, or narrow protectedFiles so that some of ${one ? 'it' : 'each'} is writable`,\n });\n }\n if (undecided.length > 0) {\n results.push({\n line,\n message: `whether ${quoted(undecided)} in affectedFiles ${undecided.length === 1 ? 'is' : 'are'} entirely protected is undecided: the search met its budget`,\n hint: 'simplify the patterns until the question can be answered',\n severity: 'warning',\n });\n }\n return results;\n}\n\nexport const RULES: readonly Rule[] = [\n {\n id: 'front-matter',\n severity: 'error',\n description: 'Front matter parses, with no duplicate keys and no YAML beyond the supported subset.',\n check: ({ brief }) =>\n (brief.frontMatter?.problems ?? []).map((p) => ({\n line: at(p.line),\n message: p.message,\n hint: 'front matter is flat \"key: value\" lines, with lists as [a, b] or \"- item\" lines',\n })),\n },\n {\n id: 'field',\n severity: 'error',\n description: 'Fields spec-brief reads hold values of the right shape.',\n check: ({ brief }) => brief.problems.map((p) => ({ line: at(p.line), message: p.message })),\n },\n {\n id: 'unknown-field',\n severity: 'warning',\n description: 'Front-matter keys are ones spec-brief or the configuration knows.',\n check: ({ brief, config }) => {\n const known = knownFields(config);\n return (brief.frontMatter?.entries ?? [])\n .filter((entry) => !known.has(entry.name))\n .map((entry) => {\n const guess = closest(entry.key, BUILT_IN_FIELDS);\n return {\n line: at(entry.line),\n message: `\"${entry.key}\" is not a key spec-brief knows`,\n hint:\n guess === undefined\n ? `if the repository uses it, list it under \"fields\" in the configuration`\n : `did you mean \"${guess}\"? If not, list \"${entry.key}\" under \"fields\" in the configuration`,\n };\n });\n },\n },\n {\n id: 'status',\n severity: 'error',\n description: 'The status agrees with where the brief lives.',\n check: ({ brief, config }) => {\n const field = config.status.field;\n if (field === null) return [];\n const line = at(lineOfField(brief, field));\n const expected = brief.phase === 'archived' ? config.status.archived : config.status.active;\n if (brief.statusWord === null) {\n return [\n {\n line,\n message: `declares no \"${field}\"`,\n hint: `add \"${field}: ${expected}\" to the front matter`,\n },\n ];\n }\n if (brief.status === null) {\n const words = statusWords(config);\n return [\n {\n line,\n message: `\"${brief.statusWord}\" is not a status here`,\n hint: `use one of ${words.map((w) => `\"${w}\"`).join(', ')}`,\n },\n ];\n }\n if (brief.phase === 'live' && brief.status === 'archived') {\n return [\n {\n line,\n message: `is marked \"${brief.statusWord}\" but lives in ${config.briefs}/`,\n hint: `run \"spec-brief archive ${brief.id ?? brief.name}\", which moves it and writes its banner`,\n },\n ];\n }\n if (brief.phase === 'archived' && brief.status !== 'archived') {\n return [\n {\n line,\n message: `lives in ${config.archive}/ but is marked \"${brief.statusWord}\"`,\n hint: `run \"spec-brief unarchive ${brief.id ?? brief.name}\" to reopen it, or set \"${field}: ${config.status.archived}\"`,\n },\n ];\n }\n return [];\n },\n },\n {\n id: 'id',\n severity: 'error',\n description: 'Every brief has an id with no whitespace or slashes in it.',\n check: ({ brief, config }) => {\n if (brief.id === null) {\n return [\n {\n line: 1,\n message: config.id.source === 'frontmatter' ? 'declares no \"id\"' : 'has no id in its file name',\n hint: config.id.source === 'frontmatter' ? 'add \"id: <id>\" to the front matter' : undefined,\n },\n ];\n }\n if (/[\\s/\\\\]/.test(brief.id)) return [{ line: 1, message: `the id \"${brief.id}\" contains whitespace or a slash` }];\n return [];\n },\n },\n {\n id: 'duplicate-id',\n severity: 'error',\n description: 'No two briefs share an id, live or archived.',\n check: ({ brief, shared }) => {\n if (brief.id === null) return [];\n const group = shared.duplicates.get(idKey(brief.id));\n if (group === undefined || group[0] === brief) return [];\n return [\n {\n line: 1,\n message: `the id \"${brief.id}\" is also ${(group[0] as Brief).file}'s`,\n hint: 'ids are allocated once and never reused; give this brief the next free one',\n },\n ];\n },\n },\n {\n id: 'title',\n severity: 'warning',\n description: 'A brief has a title: a \"title\" field or a level-one heading.',\n check: live(({ brief }) =>\n brief.title === null ? [{ line: at(brief.bodyStart), message: 'has no title', hint: 'start the body with \"# <title>\"' }] : [],\n ),\n },\n {\n id: 'unknown-type',\n severity: 'error',\n description: 'A declared type is one the configuration defines.',\n check: live(({ brief, config }) => {\n if (brief.type === null || config.types[brief.type] !== undefined) return [];\n const names = Object.keys(config.types);\n return [\n {\n line: at(lineOfField(brief, 'type')),\n message: `\"${brief.type}\" is not a brief type here`,\n hint: names.length === 0 ? 'the configuration defines no types' : `use one of ${names.map((n) => `\"${n}\"`).join(', ')}`,\n },\n ];\n }),\n },\n {\n id: 'missing-section',\n severity: 'error',\n description: 'Every required section is present.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config)\n .filter((rule) => !rule.optional && sectionsFilling(brief, rule).length === 0)\n .map((rule) => {\n const heading =\n rule.aliases.length === 0\n ? `add a \"## ${rule.name}\" heading`\n : `add a \"## ${rule.name}\" heading (also accepted: ${rule.aliases.map((a) => `\"${a}\"`).join(', ')})`;\n return {\n line: at(brief.bodyStart),\n message: `has no \"${rule.name}\" section`,\n hint: rule.hint === undefined ? heading : `${heading}. ${rule.hint}`,\n };\n }),\n ),\n },\n {\n id: 'duplicate-section',\n severity: 'warning',\n description: 'A section appears once.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(1)\n .map((s) => ({ line: at(s.heading.line), message: `a second \"${rule.name}\" section`, hint: 'merge the two' })),\n ),\n ),\n },\n {\n id: 'empty-section',\n severity: 'error',\n description: 'A section carries content; a comment alone is not content.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(0, 1)\n .filter((s) => contentLines(brief, s).length === 0)\n .map((s) => ({\n line: at(s.heading.line),\n message: `the \"${rule.name}\" section is empty`,\n hint: rule.hint ?? 'write it; a comment alone is not content',\n severity: leniency(brief),\n })),\n ),\n ),\n },\n {\n id: 'placeholder',\n severity: 'error',\n description: 'A section says something: not only \"TBD\", \"TODO\" or an empty box.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(0, 1)\n .filter((s) => {\n const lines = contentLines(brief, s);\n return lines.length > 0 && lines.every((i) => isPlaceholder(brief.scan.prose[i] as string, config.placeholders));\n })\n .map((s) => ({\n line: at(s.heading.line),\n message: `the \"${rule.name}\" section holds only a placeholder`,\n hint: rule.hint ?? 'replace the placeholder with what the section must say',\n severity: leniency(brief),\n })),\n ),\n ),\n },\n {\n id: 'missing-checklist',\n severity: 'error',\n description: 'A checklist section holds at least one task item.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config)\n .filter((rule) => rule.checklist)\n .flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(0, 1)\n .filter((s) => !brief.tasks.some((t) => t.line > s.heading.line && t.line < s.end))\n .map((s) => ({\n line: at(s.heading.line),\n message: `the \"${rule.name}\" section has no \"- [ ]\" items`,\n hint: 'write each check as a task item, so it has a state that can be closed',\n severity: leniency(brief),\n })),\n ),\n ),\n },\n {\n id: 'must-contain',\n severity: 'error',\n description: 'A section contains the text the configuration requires of it.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) => {\n const section = sectionsFilling(brief, rule)[0];\n if (section === undefined) return [];\n const body = brief.scan.prose.slice(section.heading.line + 1, section.end).join('\\n');\n return rule.mustContain\n .filter((text) => !body.includes(text))\n .map((text) => ({ line: at(section.heading.line), message: `the \"${rule.name}\" section must contain \"${text}\"` }));\n }),\n ),\n },\n {\n id: 'section-order',\n severity: 'error',\n description: 'Sections appear in the configured order, when the configuration asks for one.',\n check: live(({ brief, config }) => {\n if (!config.sectionOrder) return [];\n const placed = sectionRules(brief, config)\n .map((rule) => ({ rule, section: sectionsFilling(brief, rule)[0] }))\n .filter((p): p is { rule: SectionRule; section: Section } => p.section !== undefined);\n for (let i = 1; i < placed.length; i += 1) {\n const before = placed[i - 1] as { rule: SectionRule; section: Section };\n const current = placed[i] as { rule: SectionRule; section: Section };\n if (current.section.heading.line < before.section.heading.line) {\n return [\n {\n line: at(current.section.heading.line),\n message: `\"${current.rule.name}\" comes before \"${before.rule.name}\"`,\n hint: `the order is ${sectionRules(brief, config)\n .map((r) => r.name)\n .join(', ')}`,\n },\n ];\n }\n }\n return [];\n }),\n },\n {\n id: 'dependency',\n severity: 'error',\n description: 'Every dependency names another brief that exists.',\n check: live(({ brief, corpus }) =>\n brief.dependsOn.flatMap((dependency) => {\n const line = at(lineOfField(brief, 'dependsOn'));\n if (brief.id !== null && idKey(dependency) === idKey(brief.id)) {\n return [{ line, message: 'depends on itself' }];\n }\n if (resolveDependency(corpus, dependency) === undefined) {\n return [{ line, message: `depends on \"${dependency}\", which is not a brief here` }];\n }\n return [];\n }),\n ),\n },\n {\n id: 'dependency-cycle',\n severity: 'error',\n description: 'Dependencies between live briefs form no cycle.',\n check: live(({ brief, shared }) =>\n shared.cycles\n .filter((cycle) => cycle[0] === brief)\n .map((cycle) => ({\n line: at(lineOfField(brief, 'dependsOn')),\n message: `dependencies form a cycle: ${cycle.map((b) => b.id ?? b.name).join(' -> ')}`,\n hint: 'a cycle can never become ready; remove the dependency that is not real',\n })),\n ),\n },\n {\n id: 'wave-order',\n severity: 'error',\n description: 'A dependency that is still live runs in an earlier wave.',\n check: live(({ brief, corpus }) => {\n const wave = brief.wave;\n if (wave === null) return [];\n return brief.dependsOn.flatMap((dependency) => {\n const target = resolveDependency(corpus, dependency);\n // A self-dependency is reported once, by the dependency rule.\n if (target === undefined || target === brief || target.phase !== 'live' || target.wave === null || target.wave < wave) return [];\n return [\n {\n line: at(lineOfField(brief, 'dependsOn')),\n message: `depends on ${target.id ?? target.name}, which is in wave ${target.wave}, not before wave ${wave}`,\n hint: `move this brief to a wave after ${target.wave}, or ${target.id ?? target.name} to one before ${wave}`,\n },\n ];\n });\n }),\n },\n {\n id: 'deferral-trigger',\n severity: 'error',\n description: 'A deferred brief names in \"trigger\" the observable event that brings it back, not a date.',\n check: live(({ brief, config }) => {\n // A trigger of the wrong shape is the field rule's finding.\n if (brief.status !== 'deferred' || brief.problems.some((p) => p.field === 'trigger')) return [];\n const example = 'such as \"when the second tenant signs\" or \"when p95 exceeds 200 ms\"';\n const trigger = brief.trigger?.trim() ?? '';\n if (trigger === '') {\n const declared = findEntry(brief.frontMatter, 'trigger') !== undefined;\n return [\n {\n line: at(lineOfField(brief, declared ? 'trigger' : (config.status.field as string))),\n message: 'is deferred and names no \"trigger\"',\n hint: `add \"trigger: <the event that brings it back>\", ${example}`,\n },\n ];\n }\n const line = at(lineOfField(brief, 'trigger'));\n const hint = `name what must happen before the work resumes, ${example}`;\n if (config.placeholders.some((p) => p.toLowerCase() === trigger.toLowerCase())) {\n return [{ line, message: `the trigger \"${trigger}\" is a placeholder, not an event`, hint }];\n }\n if (!namesAnEvent(trigger)) {\n return [{ line, message: `the trigger \"${trigger}\" is a date or a time, not an event`, hint: `${hint}; a date arrives whether or not the reason for the work has` }];\n }\n return [];\n }),\n },\n {\n id: 'glob',\n severity: 'error',\n description: 'Every scope pattern is a glob spec-brief can read.',\n check: live(({ brief }) =>\n SCOPE_FIELDS.flatMap((field) =>\n brief[field].flatMap((pattern) => {\n const parsed = parseGlob(pattern);\n if (parsed.ok) return [];\n return [\n {\n line: at(lineOfField(brief, field)),\n message: `\"${pattern}\" in ${field}: ${parsed.error}`,\n hint: 'a scope is a glob relative to the repository root: \"src/auth/\", \"src/**/*.ts\", \"docs/{a,b}.md\"',\n },\n ];\n }),\n ),\n ),\n },\n {\n id: 'scope-contradiction',\n severity: 'error',\n description: 'Something of every affected pattern is writable: no pattern lies wholly inside protectedFiles.',\n check: live(({ brief, repoFiles }) => scopeContradiction(brief, repoFiles)),\n },\n {\n id: 'glob-matches-nothing',\n severity: 'note',\n description: 'A scope pattern matches at least one file in the tree.',\n check: live(({ brief, repoFiles }) => {\n if (repoFiles === null) return [];\n const reading = readingIn(repoFiles);\n return SCOPE_FIELDS.flatMap((field) =>\n patternsOf(brief[field], reading)\n // A literal the tree does not hold is literal-read-as-file's finding.\n .filter((p) => unheldLiterals(p.glob, repoFiles).length === 0 && !repoFiles.some((file) => matchGlob(p.glob, file)))\n .map((p) => ({\n line: at(lineOfField(brief, field)),\n message: `\"${p.pattern}\" in ${field} matches no file in the tree`,\n hint: 'expected when the round creates it; otherwise check the spelling',\n })),\n );\n }),\n },\n {\n id: 'literal-read-as-file',\n severity: 'note',\n description: 'A path with no glob syntax that the tree does not hold, and whose name has no extension, says whether it is a directory.',\n check: live(({ brief, repoFiles }) => {\n if (repoFiles === null) return [];\n const reading = readingIn(repoFiles);\n return SCOPE_FIELDS.flatMap((field) =>\n patternsOf(brief[field], reading).flatMap(({ pattern, glob }: ScopePattern) => {\n const paths = unheldLiterals(glob, repoFiles);\n if (paths.length === 0) return [];\n const line = at(lineOfField(brief, field));\n if (!isGlobSyntax(pattern)) {\n return [\n {\n line,\n message: `\"${pattern}\" in ${field} is not in the tree and is read as a file`,\n // The reader trims every list item, so the pattern is as meant.\n hint: `write \"${pattern}/\" for a directory`,\n },\n ];\n }\n return [\n {\n line,\n message: `\"${pattern}\" in ${field} names ${inWords(paths)}, which ${paths.length === 1 ? 'is' : 'are'} not in the tree and ${paths.length === 1 ? 'is' : 'are'} read as ${paths.length === 1 ? 'a file' : 'files'}`,\n hint: 'write a directory with a trailing \"/\", in an entry of its own',\n },\n ];\n }),\n );\n }),\n },\n {\n id: 'archive-freeze',\n severity: 'error',\n description: 'An archived brief has not changed since it was archived.',\n check: ({ brief }) => {\n if (brief.phase !== 'archived' || brief.integrity === null) return [];\n if (integrityOf(brief.text) === brief.integrity) return [];\n return [\n {\n line: at(lineOfField(brief, 'integrity')),\n message: 'has changed since it was archived',\n hint: 'an archived brief is frozen: restore it from git, or unarchive it to reopen the round',\n },\n ];\n },\n },\n];\n\n/**\n * The rules the wave analyses - `matrix` and `schedule` - report under. They\n * are not run per brief, so they carry no check: they exist so configuration\n * can set their severity and reports can describe them.\n */\nexport const COLLISION_RULES: readonly RuleInfo[] = [\n { id: 'collision', severity: 'error', description: 'Briefs in one wave do not write the same file.' },\n {\n id: 'collision-undecided',\n severity: 'warning',\n description: 'Whether two briefs in one wave can write the same file is decided within the search budget.',\n },\n { id: 'unscoped', severity: 'note', description: 'A brief sharing a wave declares the files it writes.' },\n { id: 'shared-directory', severity: 'off', description: 'Briefs in one wave do not write into the same directory.' },\n {\n id: 'wave-schedule',\n severity: 'error',\n description: 'A brief declares a wave that holds: the one the schedule computes, or one lint and matrix accept, which is a note.',\n },\n];\n\n/**\n * The rules archival reports under beside its refusals. Like the collision\n * rules they carry no check: the planner raises them, and they exist so\n * configuration can set their severity and reports can describe them.\n */\nexport const ARCHIVE_RULES: readonly RuleInfo[] = [\n {\n id: 'scope-unmeasured',\n severity: 'warning',\n description: 'A brief that declares a scope is archived against the changes its round made.',\n },\n {\n id: 'stale-link',\n severity: 'warning',\n description: 'No live brief is left linking to where a moved brief used to be.',\n },\n];\n"]}
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAc,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CA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;QACE,EAAE,EAAE,kBAAkB;QACtB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,+EAA+E;KAC7F;IACD;QACE,EAAE,EAAE,YAAY;QAChB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,kEAAkE;KAChF;CACF,CAAC","sourcesContent":["/**\n * The built-in rules. Each is a pure function of one brief and the corpus\n * around it, and returns what it found with 1-based lines.\n *\n * Structure is checked on live briefs only. An archived brief is a frozen\n * record of the tree before a round, and holding it to today's schema would\n * ask somebody to edit what must not be edited; the rules that do reach the\n * archive are about identity and the freeze itself.\n */\n\nimport { BUILT_IN_FIELDS, type Brief, knownFields, lineOfField } from './brief.js';\nimport { type Config, type SectionRule, statusWords } from './config.js';\nimport { type Corpus, dependencyCycles, duplicateIds, idKey, resolveDependency } from './corpus.js';\nimport { findEntry } from './frontmatter.js';\nimport { integrityOf } from './integrity.js';\nimport { type Glob, hasExtension, held, isGlobSyntax, matchGlob, parseGlob, readingIn, treeOf, WITNESS_BUDGET, writtenAlternatives } from './glob.js';\nimport { hasContent, type Section } from './markdown.js';\nimport { closest } from './schema.js';\nimport { contradictions, patternsOf, scopeOf, type ScopePattern } from './scope.js';\nimport { inWords, labelMatches } from './text.js';\nimport { namesAnEvent } from './trigger.js';\nimport type { Severity, SeveritySetting } from './types.js';\n\nexport interface RuleResult {\n /** 1-based. */\n readonly line: number;\n readonly message: string;\n readonly hint?: string | undefined;\n /** Lower than the rule's severity for this one finding, as a draft's unwritten sections are. */\n readonly severity?: Severity | undefined;\n}\n\nexport interface RuleContext {\n readonly brief: Brief;\n readonly corpus: Corpus;\n readonly config: Config;\n /** The files git sees, or every file without git; `null` when unknown. A rule that needs them stays quiet without them. */\n readonly repoFiles: readonly string[] | null;\n /** Analyses computed once per run and shared by every brief. */\n readonly shared: SharedAnalysis;\n /** A plugin's options from the configuration. */\n readonly options?: unknown;\n}\n\n/** What a rule is called, how loud it is by default, and what it checks. */\nexport interface RuleInfo {\n readonly id: string;\n readonly severity: SeveritySetting;\n readonly description: string;\n}\n\nexport interface Rule extends RuleInfo {\n check(context: RuleContext): readonly RuleResult[] | Promise<readonly RuleResult[]>;\n}\n\nexport interface SharedAnalysis {\n readonly cycles: readonly (readonly Brief[])[];\n readonly duplicates: ReadonlyMap<string, readonly Brief[]>;\n}\n\nexport function analyse(corpus: Corpus): SharedAnalysis {\n return { cycles: dependencyCycles(corpus), duplicates: duplicateIds(corpus) };\n}\n\nconst at = (line0: number): number => line0 + 1;\n\n/** The sections a brief must carry: the configured ones, then its type's. */\nexport function sectionRules(brief: Brief, config: Config): SectionRule[] {\n const typed = brief.type === null ? [] : (config.types[brief.type] ?? []);\n return [...config.sections, ...typed];\n}\n\n/** The headings that fill a section rule. */\nexport function sectionsFilling(brief: Brief, rule: SectionRule): Section[] {\n const names = [rule.name, ...rule.aliases];\n return brief.sections.filter((s) => names.some((name) => labelMatches(s.heading.text, name)));\n}\n\n/** A section's own lines that carry content: comments dropped, sub-headings not counted. */\nfunction contentLines(brief: Brief, section: Section): number[] {\n const headingLines = new Set(brief.scan.headings.map((h) => h.line));\n const lines: number[] = [];\n for (let i = section.heading.line + 1; i < section.end; i += 1) {\n if (!headingLines.has(i) && hasContent(brief.scan.prose[i] as string)) lines.push(i);\n }\n return lines;\n}\n\nfunction isPlaceholder(line: string, placeholders: readonly string[]): boolean {\n const text = line\n .replace(/^\\s*(?:[-*+]|\\d{1,9}[.)])\\s+/, '')\n .replace(/^\\[[ xX]\\]\\s*/, '')\n .replace(/[*_]/g, '')\n .trim();\n if (text === '') return true;\n const lower = text.toLowerCase();\n return placeholders.some((p) => {\n const word = p.toLowerCase();\n return lower === word || (lower.startsWith(word) && /^[\\s:.\\-\\u2014]/.test(lower.slice(word.length)));\n });\n}\n\n/** Completeness findings on a draft are reminders, not failures. */\nfunction leniency(brief: Brief): Severity | undefined {\n return brief.status === 'draft' ? 'warning' : undefined;\n}\n\nfunction live(check: (context: RuleContext) => RuleResult[]): (context: RuleContext) => RuleResult[] {\n return (context) => (context.brief.phase === 'live' ? check(context) : []);\n}\n\nconst SCOPE_FIELDS = ['affectedFiles', 'protectedFiles'] as const;\n\nconst quoted = (items: readonly string[]): string => inWords(items.map((item) => `\"${item}\"`));\n\n/**\n * The paths a pattern names with no glob syntax that the tree does not hold\n * and whose names carry no extension. The tree reads each as a file, and the\n * spelling cannot say whether a directory was meant.\n */\nexport function unheldLiterals(glob: Glob, files: readonly string[]): string[] {\n const tree = treeOf(files);\n return glob.literals\n .map((literal) => literal.path)\n .filter((path) => held(tree, path) === null && !hasExtension(path.slice(path.lastIndexOf('/') + 1)));\n}\n\n/**\n * What to write for a directory where a pattern names paths the tree reads as\n * files, built from the pattern as written, as spec-core builds its own\n * advice: the pattern with a `/` ending each alternative that names one, since\n * a trailing `/` inside braces says directory as it does alone, or each such\n * alternative in an entry of its own (ADR-0005, amended 2026-09-29). Where\n * more of the pattern follows braces, `{a,b}/new`, no `/` written inside them\n * ends one alternative alone, so an entry of its own is the advice; and an\n * alternative the reader refuses as an entry, one opening with `!`, is left as\n * written. The reader trims every list item, so the pattern is as meant.\n */\nfunction directoryAdvice(pattern: string, paths: readonly string[]): string {\n const alternatives = writtenAlternatives(pattern) ?? [];\n const named = alternatives.filter(({ written }) => {\n const parsed = parseGlob(written);\n return parsed.ok && parsed.glob.literals.some((literal) => paths.includes(literal.path));\n });\n const entries = (named.length === 0 ? paths : named.map(({ written }) => written)).map((entry) => `${entry}/`);\n const one = entries.length === 1;\n const kind = one ? 'a directory' : 'directories';\n const own = one ? 'an entry of its own' : 'entries of their own';\n if (named.length === 0) return `write ${quoted(entries)} for ${kind}, in ${own}`;\n if (alternatives.length === 1) return `write ${quoted(entries)} for ${kind}`;\n let slashed = '';\n let from = 0;\n for (const { end } of named) {\n slashed += `${pattern.slice(from, end)}/`;\n from = end;\n }\n return `write \"${slashed}${pattern.slice(from)}\" for ${kind}, or ${quoted(entries)} in ${own}`;\n}\n\n/**\n * Affected patterns a brief's own protections cover entirely: one error for\n * all of them, and a warning for those the search could not decide.\n */\nexport function scopeContradiction(brief: Brief, repoFiles: readonly string[] | null, budget: number = WITNESS_BUDGET): RuleResult[] {\n const { covered, undecided } = contradictions(scopeOf(brief, readingIn(repoFiles)), budget);\n const line = at(lineOfField(brief, 'protectedFiles'));\n const results: RuleResult[] = [];\n if (covered.length > 0) {\n const one = covered.length === 1;\n results.push({\n line,\n message: `${quoted(covered)} in affectedFiles ${one ? 'is' : 'are'} entirely protected, so nothing of ${one ? 'it' : 'them'} is writable`,\n hint: `drop ${one ? 'it' : 'them'} from affectedFiles, or narrow protectedFiles so that some of ${one ? 'it' : 'each'} is writable`,\n });\n }\n if (undecided.length > 0) {\n results.push({\n line,\n message: `whether ${quoted(undecided)} in affectedFiles ${undecided.length === 1 ? 'is' : 'are'} entirely protected is undecided: the search met its budget`,\n hint: 'simplify the patterns until the question can be answered',\n severity: 'warning',\n });\n }\n return results;\n}\n\nexport const RULES: readonly Rule[] = [\n {\n id: 'front-matter',\n severity: 'error',\n description: 'Front matter parses, with no duplicate keys and no YAML beyond the supported subset.',\n check: ({ brief }) =>\n (brief.frontMatter?.problems ?? []).map((p) => ({\n line: at(p.line),\n message: p.message,\n hint: 'front matter is flat \"key: value\" lines, with lists as [a, b] or \"- item\" lines',\n })),\n },\n {\n id: 'field',\n severity: 'error',\n description: 'Fields spec-brief reads hold values of the right shape.',\n check: ({ brief }) => brief.problems.map((p) => ({ line: at(p.line), message: p.message })),\n },\n {\n id: 'unknown-field',\n severity: 'warning',\n description: 'Front-matter keys are ones spec-brief or the configuration knows.',\n check: ({ brief, config }) => {\n const known = knownFields(config);\n return (brief.frontMatter?.entries ?? [])\n .filter((entry) => !known.has(entry.name))\n .map((entry) => {\n const guess = closest(entry.key, BUILT_IN_FIELDS);\n return {\n line: at(entry.line),\n message: `\"${entry.key}\" is not a key spec-brief knows`,\n hint:\n guess === undefined\n ? `if the repository uses it, list it under \"fields\" in the configuration`\n : `did you mean \"${guess}\"? If not, list \"${entry.key}\" under \"fields\" in the configuration`,\n };\n });\n },\n },\n {\n id: 'status',\n severity: 'error',\n description: 'The status agrees with where the brief lives.',\n check: ({ brief, config }) => {\n const field = config.status.field;\n if (field === null) return [];\n const line = at(lineOfField(brief, field));\n const expected = brief.phase === 'archived' ? config.status.archived : config.status.active;\n if (brief.statusWord === null) {\n return [\n {\n line,\n message: `declares no \"${field}\"`,\n hint: `add \"${field}: ${expected}\" to the front matter`,\n },\n ];\n }\n if (brief.status === null) {\n const words = statusWords(config);\n return [\n {\n line,\n message: `\"${brief.statusWord}\" is not a status here`,\n hint: `use one of ${words.map((w) => `\"${w}\"`).join(', ')}`,\n },\n ];\n }\n if (brief.phase === 'live' && brief.status === 'archived') {\n return [\n {\n line,\n message: `is marked \"${brief.statusWord}\" but lives in ${config.briefs}/`,\n hint: `run \"spec-brief archive ${brief.id ?? brief.name}\", which moves it and writes its banner`,\n },\n ];\n }\n if (brief.phase === 'archived' && brief.status !== 'archived') {\n return [\n {\n line,\n message: `lives in ${config.archive}/ but is marked \"${brief.statusWord}\"`,\n hint: `run \"spec-brief unarchive ${brief.id ?? brief.name}\" to reopen it, or set \"${field}: ${config.status.archived}\"`,\n },\n ];\n }\n return [];\n },\n },\n {\n id: 'id',\n severity: 'error',\n description: 'Every brief has an id with no whitespace or slashes in it.',\n check: ({ brief, config }) => {\n if (brief.id === null) {\n return [\n {\n line: 1,\n message: config.id.source === 'frontmatter' ? 'declares no \"id\"' : 'has no id in its file name',\n hint: config.id.source === 'frontmatter' ? 'add \"id: <id>\" to the front matter' : undefined,\n },\n ];\n }\n if (/[\\s/\\\\]/.test(brief.id)) return [{ line: 1, message: `the id \"${brief.id}\" contains whitespace or a slash` }];\n return [];\n },\n },\n {\n id: 'duplicate-id',\n severity: 'error',\n description: 'No two briefs share an id, live or archived.',\n check: ({ brief, shared }) => {\n if (brief.id === null) return [];\n const group = shared.duplicates.get(idKey(brief.id));\n if (group === undefined || group[0] === brief) return [];\n return [\n {\n line: 1,\n message: `the id \"${brief.id}\" is also ${(group[0] as Brief).file}'s`,\n hint: 'ids are allocated once and never reused; give this brief the next free one',\n },\n ];\n },\n },\n {\n id: 'title',\n severity: 'warning',\n description: 'A brief has a title: a \"title\" field or a level-one heading.',\n check: live(({ brief }) =>\n brief.title === null ? [{ line: at(brief.bodyStart), message: 'has no title', hint: 'start the body with \"# <title>\"' }] : [],\n ),\n },\n {\n id: 'unknown-type',\n severity: 'error',\n description: 'A declared type is one the configuration defines.',\n check: live(({ brief, config }) => {\n if (brief.type === null || config.types[brief.type] !== undefined) return [];\n const names = Object.keys(config.types);\n return [\n {\n line: at(lineOfField(brief, 'type')),\n message: `\"${brief.type}\" is not a brief type here`,\n hint: names.length === 0 ? 'the configuration defines no types' : `use one of ${names.map((n) => `\"${n}\"`).join(', ')}`,\n },\n ];\n }),\n },\n {\n id: 'missing-section',\n severity: 'error',\n description: 'Every required section is present.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config)\n .filter((rule) => !rule.optional && sectionsFilling(brief, rule).length === 0)\n .map((rule) => {\n const heading =\n rule.aliases.length === 0\n ? `add a \"## ${rule.name}\" heading`\n : `add a \"## ${rule.name}\" heading (also accepted: ${rule.aliases.map((a) => `\"${a}\"`).join(', ')})`;\n return {\n line: at(brief.bodyStart),\n message: `has no \"${rule.name}\" section`,\n hint: rule.hint === undefined ? heading : `${heading}. ${rule.hint}`,\n };\n }),\n ),\n },\n {\n id: 'duplicate-section',\n severity: 'warning',\n description: 'A section appears once.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(1)\n .map((s) => ({ line: at(s.heading.line), message: `a second \"${rule.name}\" section`, hint: 'merge the two' })),\n ),\n ),\n },\n {\n id: 'empty-section',\n severity: 'error',\n description: 'A section carries content; a comment alone is not content.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(0, 1)\n .filter((s) => contentLines(brief, s).length === 0)\n .map((s) => ({\n line: at(s.heading.line),\n message: `the \"${rule.name}\" section is empty`,\n hint: rule.hint ?? 'write it; a comment alone is not content',\n severity: leniency(brief),\n })),\n ),\n ),\n },\n {\n id: 'placeholder',\n severity: 'error',\n description: 'A section says something: not only \"TBD\", \"TODO\" or an empty box.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(0, 1)\n .filter((s) => {\n const lines = contentLines(brief, s);\n return lines.length > 0 && lines.every((i) => isPlaceholder(brief.scan.prose[i] as string, config.placeholders));\n })\n .map((s) => ({\n line: at(s.heading.line),\n message: `the \"${rule.name}\" section holds only a placeholder`,\n hint: rule.hint ?? 'replace the placeholder with what the section must say',\n severity: leniency(brief),\n })),\n ),\n ),\n },\n {\n id: 'missing-checklist',\n severity: 'error',\n description: 'A checklist section holds at least one task item.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config)\n .filter((rule) => rule.checklist)\n .flatMap((rule) =>\n sectionsFilling(brief, rule)\n .slice(0, 1)\n .filter((s) => !brief.tasks.some((t) => t.line > s.heading.line && t.line < s.end))\n .map((s) => ({\n line: at(s.heading.line),\n message: `the \"${rule.name}\" section has no \"- [ ]\" items`,\n hint: 'write each check as a task item, so it has a state that can be closed',\n severity: leniency(brief),\n })),\n ),\n ),\n },\n {\n id: 'must-contain',\n severity: 'error',\n description: 'A section contains the text the configuration requires of it.',\n check: live(({ brief, config }) =>\n sectionRules(brief, config).flatMap((rule) => {\n const section = sectionsFilling(brief, rule)[0];\n if (section === undefined) return [];\n const body = brief.scan.prose.slice(section.heading.line + 1, section.end).join('\\n');\n return rule.mustContain\n .filter((text) => !body.includes(text))\n .map((text) => ({ line: at(section.heading.line), message: `the \"${rule.name}\" section must contain \"${text}\"` }));\n }),\n ),\n },\n {\n id: 'section-order',\n severity: 'error',\n description: 'Sections appear in the configured order, when the configuration asks for one.',\n check: live(({ brief, config }) => {\n if (!config.sectionOrder) return [];\n const placed = sectionRules(brief, config)\n .map((rule) => ({ rule, section: sectionsFilling(brief, rule)[0] }))\n .filter((p): p is { rule: SectionRule; section: Section } => p.section !== undefined);\n for (let i = 1; i < placed.length; i += 1) {\n const before = placed[i - 1] as { rule: SectionRule; section: Section };\n const current = placed[i] as { rule: SectionRule; section: Section };\n if (current.section.heading.line < before.section.heading.line) {\n return [\n {\n line: at(current.section.heading.line),\n message: `\"${current.rule.name}\" comes before \"${before.rule.name}\"`,\n hint: `the order is ${sectionRules(brief, config)\n .map((r) => r.name)\n .join(', ')}`,\n },\n ];\n }\n }\n return [];\n }),\n },\n {\n id: 'dependency',\n severity: 'error',\n description: 'Every dependency names another brief that exists.',\n check: live(({ brief, corpus }) =>\n brief.dependsOn.flatMap((dependency) => {\n const line = at(lineOfField(brief, 'dependsOn'));\n if (brief.id !== null && idKey(dependency) === idKey(brief.id)) {\n return [{ line, message: 'depends on itself' }];\n }\n if (resolveDependency(corpus, dependency) === undefined) {\n return [{ line, message: `depends on \"${dependency}\", which is not a brief here` }];\n }\n return [];\n }),\n ),\n },\n {\n id: 'dependency-cycle',\n severity: 'error',\n description: 'Dependencies between live briefs form no cycle.',\n check: live(({ brief, shared }) =>\n shared.cycles\n .filter((cycle) => cycle[0] === brief)\n .map((cycle) => ({\n line: at(lineOfField(brief, 'dependsOn')),\n message: `dependencies form a cycle: ${cycle.map((b) => b.id ?? b.name).join(' -> ')}`,\n hint: 'a cycle can never become ready; remove the dependency that is not real',\n })),\n ),\n },\n {\n id: 'wave-order',\n severity: 'error',\n description: 'A dependency that is still live runs in an earlier wave.',\n check: live(({ brief, corpus }) => {\n const wave = brief.wave;\n if (wave === null) return [];\n return brief.dependsOn.flatMap((dependency) => {\n const target = resolveDependency(corpus, dependency);\n // A self-dependency is reported once, by the dependency rule.\n if (target === undefined || target === brief || target.phase !== 'live' || target.wave === null || target.wave < wave) return [];\n return [\n {\n line: at(lineOfField(brief, 'dependsOn')),\n message: `depends on ${target.id ?? target.name}, which is in wave ${target.wave}, not before wave ${wave}`,\n hint: `move this brief to a wave after ${target.wave}, or ${target.id ?? target.name} to one before ${wave}`,\n },\n ];\n });\n }),\n },\n {\n id: 'deferral-trigger',\n severity: 'error',\n description: 'A deferred brief names in \"trigger\" the observable event that brings it back, not a date.',\n check: live(({ brief, config }) => {\n // A trigger of the wrong shape is the field rule's finding.\n if (brief.status !== 'deferred' || brief.problems.some((p) => p.field === 'trigger')) return [];\n const example = 'such as \"when the second tenant signs\" or \"when p95 exceeds 200 ms\"';\n const trigger = brief.trigger?.trim() ?? '';\n if (trigger === '') {\n const declared = findEntry(brief.frontMatter, 'trigger') !== undefined;\n return [\n {\n line: at(lineOfField(brief, declared ? 'trigger' : (config.status.field as string))),\n message: 'is deferred and names no \"trigger\"',\n hint: `add \"trigger: <the event that brings it back>\", ${example}`,\n },\n ];\n }\n const line = at(lineOfField(brief, 'trigger'));\n const hint = `name what must happen before the work resumes, ${example}`;\n if (config.placeholders.some((p) => p.toLowerCase() === trigger.toLowerCase())) {\n return [{ line, message: `the trigger \"${trigger}\" is a placeholder, not an event`, hint }];\n }\n if (!namesAnEvent(trigger)) {\n return [{ line, message: `the trigger \"${trigger}\" is a date or a time, not an event`, hint: `${hint}; a date arrives whether or not the reason for the work has` }];\n }\n return [];\n }),\n },\n {\n id: 'glob',\n severity: 'error',\n description: 'Every scope pattern is a glob spec-brief can read.',\n check: live(({ brief }) =>\n SCOPE_FIELDS.flatMap((field) =>\n brief[field].flatMap((pattern) => {\n const parsed = parseGlob(pattern);\n if (parsed.ok) return [];\n return [\n {\n line: at(lineOfField(brief, field)),\n message: `\"${pattern}\" in ${field}: ${parsed.error}`,\n hint: 'a scope is a glob relative to the repository root: \"src/auth/\", \"src/**/*.ts\", \"docs/{a,b}.md\"',\n },\n ];\n }),\n ),\n ),\n },\n {\n id: 'scope-contradiction',\n severity: 'error',\n description: 'Something of every affected pattern is writable: no pattern lies wholly inside protectedFiles.',\n check: live(({ brief, repoFiles }) => scopeContradiction(brief, repoFiles)),\n },\n {\n id: 'glob-matches-nothing',\n severity: 'note',\n description: 'A scope pattern matches at least one file in the tree.',\n check: live(({ brief, repoFiles }) => {\n if (repoFiles === null) return [];\n const reading = readingIn(repoFiles);\n return SCOPE_FIELDS.flatMap((field) =>\n patternsOf(brief[field], reading)\n // A literal the tree does not hold is literal-read-as-file's finding.\n .filter((p) => unheldLiterals(p.glob, repoFiles).length === 0 && !repoFiles.some((file) => matchGlob(p.glob, file)))\n .map((p) => ({\n line: at(lineOfField(brief, field)),\n message: `\"${p.pattern}\" in ${field} matches no file in the tree`,\n hint: 'expected when the round creates it; otherwise check the spelling',\n })),\n );\n }),\n },\n {\n id: 'literal-read-as-file',\n severity: 'note',\n description: 'A path with no glob syntax that the tree does not hold, and whose name has no extension, says whether it is a directory.',\n check: live(({ brief, repoFiles }) => {\n if (repoFiles === null) return [];\n const reading = readingIn(repoFiles);\n return SCOPE_FIELDS.flatMap((field) =>\n patternsOf(brief[field], reading).flatMap(({ pattern, glob }: ScopePattern) => {\n const paths = unheldLiterals(glob, repoFiles);\n if (paths.length === 0) return [];\n const line = at(lineOfField(brief, field));\n const hint = directoryAdvice(pattern, paths);\n if (!isGlobSyntax(pattern)) {\n return [{ line, message: `\"${pattern}\" in ${field} is not in the tree and is read as a file`, hint }];\n }\n return [\n {\n line,\n message: `\"${pattern}\" in ${field} names ${inWords(paths)}, which ${paths.length === 1 ? 'is' : 'are'} not in the tree and ${paths.length === 1 ? 'is' : 'are'} read as ${paths.length === 1 ? 'a file' : 'files'}`,\n hint,\n },\n ];\n }),\n );\n }),\n },\n {\n id: 'archive-freeze',\n severity: 'error',\n description: 'An archived brief has not changed since it was archived.',\n check: ({ brief }) => {\n if (brief.phase !== 'archived' || brief.integrity === null) return [];\n if (integrityOf(brief.text) === brief.integrity) return [];\n return [\n {\n line: at(lineOfField(brief, 'integrity')),\n message: 'has changed since it was archived',\n hint: 'an archived brief is frozen: restore it from git, or unarchive it to reopen the round',\n },\n ];\n },\n },\n];\n\n/**\n * The rules the wave analyses - `matrix` and `schedule` - report under. They\n * are not run per brief, so they carry no check: they exist so configuration\n * can set their severity and reports can describe them.\n */\nexport const COLLISION_RULES: readonly RuleInfo[] = [\n { id: 'collision', severity: 'error', description: 'Briefs in one wave do not write the same file.' },\n {\n id: 'collision-undecided',\n severity: 'warning',\n description: 'Whether two briefs in one wave can write the same file is decided within the search budget.',\n },\n { id: 'unscoped', severity: 'note', description: 'A brief sharing a wave declares the files it writes.' },\n { id: 'shared-directory', severity: 'off', description: 'Briefs in one wave do not write into the same directory.' },\n {\n id: 'wave-schedule',\n severity: 'error',\n description: 'A brief declares a wave that holds: the one the schedule computes, or one lint and matrix accept, which is a note.',\n },\n];\n\n/**\n * The rules archival reports under beside its refusals. Like the collision\n * rules they carry no check: the planner raises them, and they exist so\n * configuration can set their severity and reports can describe them.\n */\nexport const ARCHIVE_RULES: readonly RuleInfo[] = [\n {\n id: 'scope-unmeasured',\n severity: 'warning',\n description: 'A brief that declares a scope is archived against the changes its round made.',\n },\n {\n id: 'stale-link',\n severity: 'warning',\n description: 'No live brief is left linking to where a moved brief used to be.',\n },\n];\n"]}
@@ -251,7 +251,10 @@ function readBrackets(layout, definitions, defined) {
251
251
  // structure mask blanks, so those two tests shape the runs and change no
252
252
  // link. A definition's line is no paragraph's: it holds a label, a
253
253
  // destination and a title, none of them a link, and the text after it is a
254
- // paragraph of its own, whose brackets pair with nothing before it.
254
+ // paragraph of its own, whose brackets pair with nothing before it. Past
255
+ // the last line there is no line, and `continues` holds nothing there, so
256
+ // no run reaches past it: the loop below could take one step more, and the
257
+ // test for a line that is not there could go.
255
258
  const inParagraph = (i) => {
256
259
  const line = lines[i];
257
260
  return line !== undefined && isMarkdown(line) && !line.blank && !defined.has(i + 1);
@@ -393,6 +396,8 @@ function readBrackets(layout, definitions, defined) {
393
396
  // when a pair lies inside it, or more than 999 characters; one that is
394
397
  // not leaves the first bracket to be read as a shortcut.
395
398
  const refClose = pairs.get(close + 1);
399
+ // With no second bracket the length is NaN and the comparison false,
400
+ // so the first test only narrows the type.
396
401
  if (refClose !== undefined && refClose - close - 2 <= MAX_LABEL && !brackets.nested.has(close + 1)) {
397
402
  // `[text][]` is read through its text; `[text][label]` through its label.
398
403
  const collapsed = text.slice(close + 2, refClose).trim() === '';
@@ -425,6 +430,8 @@ function readBrackets(layout, definitions, defined) {
425
430
  const link = passed ? null : bracket(at, at, image, line);
426
431
  reach.push(Math.max(reach[reach.length - 1], link === null ? from : link.end));
427
432
  const around = brackets.outer.get(at);
433
+ // `holding` is asked only about offsets, so the first test only
434
+ // narrows the type.
428
435
  if (around !== undefined && (holding.has(at) || (link !== null && !image)))
429
436
  holding.add(around);
430
437
  }
@@ -434,7 +441,10 @@ function readBrackets(layout, definitions, defined) {
434
441
  // `textEnd` is -1 or a `]` that closes a `[`, so never 0, and the `]` is
435
442
  // read as no link. Leaving one step later, past it, resumes at the same
436
443
  // place, or ends the paragraph where a shortcut link ended it anyway: the
437
- // test below reads the same with `textEnd > 0` or `at > textEnd`.
444
+ // test below reads the same with `textEnd > 0` or `at > textEnd`, and so
445
+ // does the one further into the loop with `textEnd > 0`. `resume` is read
446
+ // only while `textEnd` is set, and the two are set together, so its first
447
+ // value is never read.
438
448
  let textEnd = -1;
439
449
  let resume = -1;
440
450
  while (at < to) {
@@ -475,6 +485,9 @@ function readBrackets(layout, definitions, defined) {
475
485
  if (!link.image && link.form !== 'wiki') {
476
486
  textEnd = pairs.get(at);
477
487
  resume = link.end;
488
+ // Into the text. A step back instead reads the character before
489
+ // the `[`, which opens nothing there - it opened no link before
490
+ // this one, or it is escaped - and comes back here.
478
491
  at += 1;
479
492
  }
480
493
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"links.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/markdown/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzD,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,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;YAC7E,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;gBACjB,sEAAsE;gBACtE,kCAAkC;gBAClC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,OAAO,EAAE,CAAC;oBAC/E,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACf,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACN,EAAE,IAAI,CAAC,CAAC;gBACV,CAAC;YACH,CAAC;iBAAM,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBACzB,EAAE,IAAI,CAAC,CAAC;YACV,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACf,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBACxC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAW,CAAC;oBAClC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;oBAClB,EAAE,IAAI,CAAC,CAAC;gBACV,CAAC;qBAAM,CAAC;oBACN,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QACD,KAAK,GAAG,IAAI,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Links, images and reference definitions, read from the structure mask so\n * that nothing in code or a comment is one.\n *\n * Six forms: inline `[text](dest \"title\")`, full and collapsed reference\n * `[text][label]` and `[label][]`, shortcut `[label]`, autolink `<https://x>`,\n * wiki `[[target|text]]`, and the definition `[label]: dest` the reference\n * forms are read through. Each may be an image, written with a leading `!`.\n * A link's text is read again for images, which CommonMark renders there - a\n * badge wrapped in a link has two destinations - and for nothing else; each\n * is listed after the link it lies in.\n *\n * Links may not contain links, as CommonMark has it: in\n * `[a [b](inner.md) c](outer.md)` the inner pair is the link, and the outer\n * brackets and `(outer.md)` are text. So before a paragraph is read its pairs\n * are read innermost first, as CommonMark reads them, to learn which `[`\n * holds a link at any depth.\n *\n * Brackets are paired once per paragraph with a stack, and the tables that\n * say where a destination or a title ends are built once per paragraph, so\n * no bracket searches the text again for its partner. A document of nothing\n * but brackets costs its length.\n *\n * A paragraph ends at `to`, and the character there is a line terminator,\n * which no loop here acts on; nor is any lookup made at the first three\n * offsets of a paragraph, before the shortest `[](` could end. Mutants that\n * move a bound onto those places change no answer, and are equivalent.\n */\n\nimport { inRanges, mergeRanges } from '../text/index.js';\nimport { isMarkdown, isSpaceOrTab, leadOffset, visibleLead, type Layout } from './layout.js';\nimport { atxLevel, isThematicBreak, listMarker } from './syntax.js';\nimport type { Heading, Link, ScannedLine } from './types.js';\n\nconst BANG = 33;\nconst DOUBLE_QUOTE = 34;\nconst SINGLE_QUOTE = 39;\nconst OPEN_PAREN = 40;\nconst CLOSE_PAREN = 41;\nconst LESS_THAN = 60;\nconst GREATER_THAN = 62;\nconst OPEN_BRACKET = 91;\nconst BACKSLASH = 92;\nconst CLOSE_BRACKET = 93;\nconst LF = 10;\nconst CR = 13;\n\n/** CommonMark: a link label holds at most 999 characters. */\nconst MAX_LABEL = 999;\n\n/**\n * A label holds no bracket but an escaped one. Its two alternatives never\n * start on the same character, so a label is read without backtracking.\n */\nconst DEFINITION = /^ {0,3}\\[(?!\\^)((?:[^[\\]\\\\]|\\\\.)+)\\]:[ \\t]*(<[^<>]*>|\\S+)/;\n/** What may follow a definition's destination: nothing, or a title after whitespace. */\nconst TITLE_ONLY = /^(?:[ \\t]+(?:\"[^\"]*\"|'[^']*'|\\([^)]*\\)))?[ \\t]*$/;\nconst AUTOLINK = /<((?:https?|ftp|mailto):[^<>\\s]+)>/g;\n\ninterface Definition {\n readonly target: string;\n readonly targetStart: number;\n readonly targetEnd: number;\n}\n\nexport function findLinks(layout: Layout, headings: readonly Heading[]): Link[] {\n const definitions = new Map<string, Definition>();\n const defined = readDefinitions(layout, headings, definitions);\n const bracketed = readBrackets(layout, definitions, new Set(defined.map((d) => d.line)));\n // `<https://x>` as a link's destination or text is part of that link.\n const taken = mergeRanges([...defined, ...bracketed]);\n const autolinks = readAutolinks(layout).filter((link) => !inRanges(taken, link.start));\n return [...defined, ...bracketed, ...autolinks].sort((a, b) => a.start - b.start);\n}\n\n/**\n * How labels compare: trimmed, whitespace collapsed, and case folded as\n * CommonMark's reference implementations fold it, down and then up, so that\n * `ẞ` and `SS` are one label.\n */\nfunction normalizeLabel(label: string): string {\n return label.trim().replace(/\\s+/g, ' ').toLowerCase().toUpperCase();\n}\n\n/**\n * Definitions come first: the reference forms are read through them, and a\n * definition is conventionally written at the foot of the file, after the\n * links that use it. The first definition of a label wins.\n *\n * `[Note]: this matters` is prose that looks like one, so a definition has\n * nothing after its destination but a title. `[^1]: text` is a footnote.\n *\n * A definition cannot interrupt a paragraph, as CommonMark has it: one\n * written on the line under a paragraph's text is that text. It opens a\n * paragraph, or follows a definition that did.\n */\nfunction readDefinitions(layout: Layout, headings: readonly Heading[], definitions: Map<string, Definition>): Link[] {\n const { text, structure, lines, continues } = layout;\n const closed = closingLines(layout, headings);\n const out: Link[] = [];\n for (const line of lines) {\n if (!isMarkdown(line) || !visibleLead(layout, line)) continue;\n const masked = structure.slice(line.contentStart, line.end);\n const match = DEFINITION.exec(masked);\n if (match === null || !TITLE_ONLY.test(masked.slice(match[0].length))) continue;\n // Under a definition the paragraph holds nothing else yet. `continues`\n // holds no first line, so there is a line above whenever it is asked about.\n const follows = out[out.length - 1]?.line === line.line - 1;\n if (!follows && continues.has(line.line) && paragraphOpen(lines[line.line - 2] as ScannedLine, closed)) continue;\n const between = (match[1] as string).length;\n const start = line.contentStart + match[0].indexOf('[');\n const label = text.slice(start + 1, start + 1 + between).trim();\n if (label.length === 0 || between > MAX_LABEL) continue;\n const written = match[2] as string;\n const end = line.contentStart + match[0].length;\n const angle = written.charCodeAt(0) === LESS_THAN ? 1 : 0;\n const targetStart = end - written.length + angle;\n const targetEnd = end - angle;\n const target = text.slice(targetStart, targetEnd);\n const key = normalizeLabel(label);\n if (!definitions.has(key)) definitions.set(key, { target, targetStart, targetEnd });\n out.push({ form: 'definition', image: false, text: label, target, label, start, end, targetStart, targetEnd, line: line.line });\n }\n return out;\n}\n\n/**\n * The lines after which no paragraph is open, though the line under one\n * would go on with a paragraph written there: the last line of a heading,\n * and of an HTML block a comment opens. Such a block starts where a comment\n * opens a line, after at most three columns, and ends on the line the\n * comment closes on.\n */\nfunction closingLines(layout: Layout, headings: readonly Heading[]): Set<number> {\n const closed = new Set<number>();\n for (const heading of headings) closed.add(heading.endLine);\n for (const comment of layout.comments) {\n const opened = layout.lines[comment.line - 1] as ScannedLine;\n if (opened.indent <= 3 && comment.start === leadOffset(opened)) closed.add(layout.index.positionAt(comment.end).line);\n }\n return closed;\n}\n\n/**\n * Whether a paragraph is open after a line, for the line under it to go on\n * with. None is after a blank line, code, a thematic break or a closing\n * line, and none is open in a list item whose marker has nothing after it,\n * or a heading or a thematic break.\n */\nfunction paragraphOpen(line: ScannedLine, closed: ReadonlySet<number>): boolean {\n if (!isMarkdown(line) || line.blank || closed.has(line.line) || isThematicBreak(line.content)) return false;\n const marker = listMarker(line.content);\n if (marker === null) return true;\n // The marker takes every space after it, so what is left is empty or text.\n const rest = line.content.slice(marker.offset + marker.width);\n return rest.length > 0 && atxLevel(rest) === 0 && !isThematicBreak(rest);\n}\n\nfunction readAutolinks(layout: Layout): Link[] {\n const out: Link[] = [];\n for (const match of layout.structure.matchAll(AUTOLINK)) {\n const start = match.index;\n const end = start + match[0].length;\n out.push({\n form: 'autolink',\n image: false,\n text: '',\n target: match[1] as string,\n label: null,\n start,\n end,\n targetStart: start + 1,\n targetEnd: end - 1,\n line: layout.index.positionAt(start).line,\n });\n }\n return out;\n}\n\n/** The brackets of a paragraph, `[` paired with `]` as a stack pairs them, escaped ones skipped. */\ninterface Brackets {\n /** Each `[` a `]` closes, to that `]`, in the order of the `]`s: every pair after the pairs inside it. */\n readonly pairs: Map<number, number>;\n /** Each paired `[` to the `[` still open around it, where there is one. */\n readonly outer: Map<number, number>;\n /** Each paired `[` to how many pairs had closed when it opened: the pairs wholly before it. */\n readonly before: Map<number, number>;\n /** Every `[` written after an unescaped `!`: an image's. */\n readonly images: Set<number>;\n /** Every `[` with a pair inside it: those whose text holds an unescaped bracket. */\n readonly nested: Set<number>;\n}\n\nfunction pairBrackets(structure: string, from: number, to: number): Brackets {\n const brackets: Brackets = { pairs: new Map(), outer: new Map(), before: new Map(), images: new Set(), nested: new Set() };\n const { pairs } = brackets;\n const open: { readonly at: number; readonly before: number }[] = [];\n let escaped = -1;\n for (let at = from; at < to; at += 1) {\n const ch = structure.charCodeAt(at);\n if (ch === BACKSLASH) {\n escaped = at + 1;\n at += 1;\n } else if (ch === OPEN_BRACKET) {\n open.push({ at, before: pairs.size });\n if (structure.charCodeAt(at - 1) === BANG && escaped !== at - 1) brackets.images.add(at);\n } else if (ch === CLOSE_BRACKET) {\n // A `]` with nothing to close pairs with nothing; recorded under\n // `undefined` it would not be found either, so this test changes no\n // answer, only what the maps hold.\n const opened = open.pop();\n if (opened !== undefined) {\n pairs.set(opened.at, at);\n brackets.before.set(opened.at, opened.before);\n const around = open[open.length - 1];\n if (around !== undefined) {\n brackets.outer.set(opened.at, around.at);\n brackets.nested.add(around.at);\n }\n }\n }\n }\n return brackets;\n}\n\n/**\n * For every offset of a paragraph, where what starts there ends, or the end\n * of the paragraph when nothing does: a bare destination at the next space or\n * control character, or at the first `)` its own parentheses leave unmatched;\n * a title at its next unescaped closing quote or parenthesis. Filled from the\n * right in one pass, so every lookup is a read.\n */\ninterface Ends {\n readonly space: Int32Array;\n readonly paren: Int32Array;\n readonly doubleQuote: Int32Array;\n readonly singleQuote: Int32Array;\n readonly closeParen: Int32Array;\n readonly openParen: Int32Array;\n}\n\nfunction endsOf(structure: string, from: number, to: number): Ends {\n const length = to - from;\n const escaped = new Uint8Array(length + 1);\n for (let x = 0; x < length; x += 1) {\n if (escaped[x] === 0 && structure.charCodeAt(from + x) === BACKSLASH) escaped[x + 1] = 1;\n }\n // Two past the last offset: a `(` whose `)` is the paragraph's last\n // character looks one further for the next unmatched `)`, and finds none.\n const make = (): Int32Array => new Int32Array(length + 2).fill(to);\n const ends: Ends = { space: make(), paren: make(), doubleQuote: make(), singleQuote: make(), closeParen: make(), openParen: make() };\n for (let x = length - 1; x >= 0; x -= 1) {\n const at = from + x;\n const ch = structure.charCodeAt(at);\n const plain = escaped[x] === 0;\n ends.space[x] = ch <= 32 || ch === 127 ? at : (ends.space[x + 1] as number);\n // From a `(`, the first unmatched `)` is the first one after the `)` that\n // closes it, which is the first unmatched `)` after the `(`.\n const unmatched = ends.paren[x + 1] as number;\n if (plain && ch === CLOSE_PAREN) ends.paren[x] = at;\n else if (plain && ch === OPEN_PAREN) ends.paren[x] = ends.paren[unmatched + 1 - from] as number;\n else ends.paren[x] = unmatched;\n ends.doubleQuote[x] = plain && ch === DOUBLE_QUOTE ? at : (ends.doubleQuote[x + 1] as number);\n ends.singleQuote[x] = plain && ch === SINGLE_QUOTE ? at : (ends.singleQuote[x + 1] as number);\n ends.closeParen[x] = plain && ch === CLOSE_PAREN ? at : (ends.closeParen[x + 1] as number);\n ends.openParen[x] = plain && ch === OPEN_PAREN ? at : (ends.openParen[x + 1] as number);\n }\n return ends;\n}\n\ninterface Destination {\n readonly targetStart: number;\n readonly targetEnd: number;\n /** Offset just past the closing `)`. */\n readonly end: number;\n}\n\n/**\n * The bracket forms, a paragraph at a time. A paragraph here is a run of\n * Markdown lines, none blank or a definition, each continuing the one above:\n * a bracket never pairs across a blank line, a heading, a definition, or the\n * start of another block.\n */\nfunction readBrackets(layout: Layout, definitions: ReadonlyMap<string, Definition>, defined: ReadonlySet<number>): Link[] {\n const { lines, continues, structure, text } = layout;\n const out: Link[] = [];\n // The first `]]` at or after the last place one was looked for; the cursor\n // only moves forward, so each is found once.\n let doubleClose = -2;\n\n const lookup = (from: number, to: number): Definition | undefined =>\n to - from > MAX_LABEL ? undefined : definitions.get(normalizeLabel(text.slice(from, to)));\n\n // A blank or code line let into a paragraph would bring only characters the\n // structure mask blanks, so those two tests shape the runs and change no\n // link. A definition's line is no paragraph's: it holds a label, a\n // destination and a title, none of them a link, and the text after it is a\n // paragraph of its own, whose brackets pair with nothing before it.\n const inParagraph = (i: number): boolean => {\n const line = lines[i];\n return line !== undefined && isMarkdown(line) && !line.blank && !defined.has(i + 1);\n };\n\n for (let first = 0; first < lines.length; first += 1) {\n if (!inParagraph(first)) continue;\n let last = first;\n while (inParagraph(last + 1) && continues.has(last + 2)) last += 1;\n const from = (lines[first] as ScannedLine).start;\n const to = (lines[last] as ScannedLine).end;\n const brackets = pairBrackets(structure, from, to);\n const { pairs } = brackets;\n // Each `[` with a link inside it, at any depth.\n const holding = new Set<number>();\n let ends: Ends | null = null;\n\n // Spaces and tabs, and at most one line ending inside the paragraph. The\n // character at `to` ends the paragraph's last line and is none of these.\n const skipSpace = (start: number): number => {\n let at = start;\n while (isSpaceOrTab(structure, at)) at += 1;\n if (at < to) {\n if (structure.charCodeAt(at) === CR) at += 1;\n if (structure.charCodeAt(at) === LF) at += 1;\n while (isSpaceOrTab(structure, at)) at += 1;\n }\n return at;\n };\n\n const destination = (open: number): Destination | null => {\n const at = skipSpace(open);\n let targetStart: number;\n let targetEnd: number;\n let after: number;\n if (structure.charCodeAt(at) === LESS_THAN) {\n // `<dest>`: no line ending and no unescaped `<` inside.\n let close = at + 1;\n for (;;) {\n if (close >= to) return null;\n const ch = structure.charCodeAt(close);\n if (ch === GREATER_THAN) break;\n if (ch === LESS_THAN || ch === LF || ch === CR) return null;\n close += ch === BACKSLASH ? 2 : 1;\n }\n targetStart = at + 1;\n targetEnd = close;\n after = close + 1;\n } else {\n ends ??= endsOf(structure, from, to);\n const space = ends.space[at - from] as number;\n const paren = ends.paren[at - from] as number;\n targetStart = at;\n // The two are equal only when neither is found, at `to`.\n targetEnd = paren < space ? paren : space;\n after = targetEnd;\n // An empty destination points nowhere a reader can follow.\n if (targetEnd === at) return null;\n }\n let k = skipSpace(after);\n if (structure.charCodeAt(k) === CLOSE_PAREN) return { targetStart, targetEnd, end: k + 1 };\n // A title is separated from the destination by whitespace, and quoted.\n if (k === after) return null;\n ends ??= endsOf(structure, from, to);\n const x = k + 1 - from;\n const quote = structure.charCodeAt(k);\n let close: number;\n if (quote === DOUBLE_QUOTE) close = ends.doubleQuote[x] as number;\n else if (quote === SINGLE_QUOTE) close = ends.singleQuote[x] as number;\n // A title in parentheses may not hold an unescaped `(`.\n else if (quote === OPEN_PAREN) close = (ends.openParen[x] as number) < (ends.closeParen[x] as number) ? to : (ends.closeParen[x] as number);\n else return null;\n // Equal ends are `to`, where the title fails either way. Past `to` the\n // next line opens a block of its own, and none opens with `)`.\n if (close === to) return null;\n k = skipSpace(close + 1);\n return structure.charCodeAt(k) === CLOSE_PAREN ? { targetStart, targetEnd, end: k + 1 } : null;\n };\n\n const wiki = (at: number, start: number, image: boolean, line: ScannedLine): Link | null => {\n if (structure.charCodeAt(at + 1) !== OPEN_BRACKET) return null;\n if (doubleClose !== -1 && doubleClose < at + 2) doubleClose = structure.indexOf(']]', at + 2);\n const close = doubleClose;\n if (close < 0 || close + 2 > line.end) return null;\n const inner = text.slice(at + 2, close);\n const written = inner.trim();\n const pipe = written.indexOf('|');\n const target = (pipe < 0 ? written : written.slice(0, pipe)).trim();\n // `[[ ]]` and `[[|text]]` name nothing to link to.\n if (target.length === 0) return null;\n const targetStart = at + 2 + inner.length - inner.trimStart().length;\n return {\n form: 'wiki',\n image,\n text: written,\n target,\n label: null,\n start,\n end: close + 2,\n targetStart,\n targetEnd: targetStart + target.length,\n line: line.line,\n };\n };\n\n const bracket = (at: number, start: number, image: boolean, line: ScannedLine): Link | null => {\n const close = pairs.get(at);\n // A link holding a link is text; an image holding one is still an image.\n if (close === undefined || (!image && holding.has(at))) return null;\n const label = (): string => text.slice(at + 1, close).trim();\n if (structure.charCodeAt(close + 1) === OPEN_PAREN) {\n const dest = destination(close + 2);\n if (dest !== null) {\n const target = text.slice(dest.targetStart, dest.targetEnd);\n return { form: 'inline', image, text: label(), target, label: null, start, line: line.line, ...dest };\n }\n } else {\n // Only a `[` is paired, so a second bracket follows exactly when this\n // finds one. It is a label unless it holds a bracket, which it does\n // when a pair lies inside it, or more than 999 characters; one that is\n // not leaves the first bracket to be read as a shortcut.\n const refClose = pairs.get(close + 1);\n if (refClose !== undefined && refClose - close - 2 <= MAX_LABEL && !brackets.nested.has(close + 1)) {\n // `[text][]` is read through its text; `[text][label]` through its label.\n const collapsed = text.slice(close + 2, refClose).trim() === '';\n const found = collapsed ? lookup(at + 1, close) : lookup(close + 2, refClose);\n if (found === undefined) return null;\n const written = collapsed ? label() : text.slice(close + 2, refClose).trim();\n return { form: 'reference', image, text: label(), label: written, start, end: refClose + 1, line: line.line, ...found };\n }\n }\n // `[text](not a destination)` is a shortcut followed by text, as CommonMark reads it.\n const found = lookup(at + 1, close);\n if (found === undefined) return null;\n return { form: 'shortcut', image, text: label(), label: label(), start, end: close + 1, line: line.line, ...found };\n };\n\n const lineAt = (at: number): ScannedLine => lines[layout.index.positionAt(at).line - 1] as ScannedLine;\n\n // CommonMark reads each pair at its `]`, so the pairs inside a `[` are\n // read before it, and a link among them makes it text, and every `[`\n // open around it: the pairs come innermost first, and fill `holding` on\n // the way out. An image among them does not; a link may hold one. What a\n // link or an image reads past its `]` - a destination, a title, a second\n // label - is not read for links again: `reach` is the furthest any of the\n // first so many pairs read to, and a `[` short of it opens nothing.\n const reach = [from];\n for (const at of pairs.keys()) {\n const line = lineAt(at);\n const image = brackets.images.has(at);\n const passed = (reach[brackets.before.get(at) as number] as number) > at;\n const link = passed ? null : bracket(at, at, image, line);\n reach.push(Math.max(reach[reach.length - 1] as number, link === null ? from : link.end));\n const around = brackets.outer.get(at);\n if (around !== undefined && (holding.has(at) || (link !== null && !image))) holding.add(around);\n }\n\n let at = from;\n // Inside a link's text, up to its `]`, where CommonMark reads an image -\n // a badge wrapped in a link - but no other link; then on past the link.\n // `textEnd` is -1 or a `]` that closes a `[`, so never 0, and the `]` is\n // read as no link. Leaving one step later, past it, resumes at the same\n // place, or ends the paragraph where a shortcut link ended it anyway: the\n // test below reads the same with `textEnd > 0` or `at > textEnd`.\n let textEnd = -1;\n let resume = -1;\n while (at < to) {\n if (textEnd >= 0 && at >= textEnd) {\n at = resume;\n textEnd = -1;\n continue;\n }\n const ch = structure.charCodeAt(at);\n if (ch === BACKSLASH) {\n at += 2;\n continue;\n }\n if (ch !== OPEN_BRACKET) {\n at += 1;\n continue;\n }\n const line = lineAt(at);\n const image = brackets.images.has(at);\n const start = image ? at - 1 : at;\n const link = wiki(at, start, image, line) ?? bracket(at, start, image, line);\n if (textEnd >= 0) {\n // An image that closes inside the text; its own text is alt text, and\n // holds nothing a reader follows.\n if (link !== null && link.image && link.form !== 'wiki' && link.end <= textEnd) {\n out.push(link);\n at = link.end;\n } else {\n at += 1;\n }\n } else if (link === null) {\n at += 1;\n } else {\n out.push(link);\n if (!link.image && link.form !== 'wiki') {\n textEnd = pairs.get(at) as number;\n resume = link.end;\n at += 1;\n } else {\n at = link.end;\n }\n }\n }\n first = last;\n }\n return out;\n}\n"]}
1
+ {"version":3,"file":"links.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/markdown/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzD,OA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AAG,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QACD,KAAK,GAAG,IAAI,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Links, images and reference definitions, read from the structure mask so\n * that nothing in code or a comment is one.\n *\n * Six forms: inline `[text](dest \"title\")`, full and collapsed reference\n * `[text][label]` and `[label][]`, shortcut `[label]`, autolink `<https://x>`,\n * wiki `[[target|text]]`, and the definition `[label]: dest` the reference\n * forms are read through. Each may be an image, written with a leading `!`.\n * A link's text is read again for images, which CommonMark renders there - a\n * badge wrapped in a link has two destinations - and for nothing else; each\n * is listed after the link it lies in.\n *\n * Links may not contain links, as CommonMark has it: in\n * `[a [b](inner.md) c](outer.md)` the inner pair is the link, and the outer\n * brackets and `(outer.md)` are text. So before a paragraph is read its pairs\n * are read innermost first, as CommonMark reads them, to learn which `[`\n * holds a link at any depth.\n *\n * Brackets are paired once per paragraph with a stack, and the tables that\n * say where a destination or a title ends are built once per paragraph, so\n * no bracket searches the text again for its partner. A document of nothing\n * but brackets costs its length.\n *\n * A paragraph ends at `to`, and the character there is a line terminator,\n * which no loop here acts on; nor is any lookup made at the first three\n * offsets of a paragraph, before the shortest `[](` could end. Mutants that\n * move a bound onto those places change no answer, and are equivalent.\n */\n\nimport { inRanges, mergeRanges } from '../text/index.js';\nimport { isMarkdown, isSpaceOrTab, leadOffset, visibleLead, type Layout } from './layout.js';\nimport { atxLevel, isThematicBreak, listMarker } from './syntax.js';\nimport type { Heading, Link, ScannedLine } from './types.js';\n\nconst BANG = 33;\nconst DOUBLE_QUOTE = 34;\nconst SINGLE_QUOTE = 39;\nconst OPEN_PAREN = 40;\nconst CLOSE_PAREN = 41;\nconst LESS_THAN = 60;\nconst GREATER_THAN = 62;\nconst OPEN_BRACKET = 91;\nconst BACKSLASH = 92;\nconst CLOSE_BRACKET = 93;\nconst LF = 10;\nconst CR = 13;\n\n/** CommonMark: a link label holds at most 999 characters. */\nconst MAX_LABEL = 999;\n\n/**\n * A label holds no bracket but an escaped one. Its two alternatives never\n * start on the same character, so a label is read without backtracking.\n */\nconst DEFINITION = /^ {0,3}\\[(?!\\^)((?:[^[\\]\\\\]|\\\\.)+)\\]:[ \\t]*(<[^<>]*>|\\S+)/;\n/** What may follow a definition's destination: nothing, or a title after whitespace. */\nconst TITLE_ONLY = /^(?:[ \\t]+(?:\"[^\"]*\"|'[^']*'|\\([^)]*\\)))?[ \\t]*$/;\nconst AUTOLINK = /<((?:https?|ftp|mailto):[^<>\\s]+)>/g;\n\ninterface Definition {\n readonly target: string;\n readonly targetStart: number;\n readonly targetEnd: number;\n}\n\nexport function findLinks(layout: Layout, headings: readonly Heading[]): Link[] {\n const definitions = new Map<string, Definition>();\n const defined = readDefinitions(layout, headings, definitions);\n const bracketed = readBrackets(layout, definitions, new Set(defined.map((d) => d.line)));\n // `<https://x>` as a link's destination or text is part of that link.\n const taken = mergeRanges([...defined, ...bracketed]);\n const autolinks = readAutolinks(layout).filter((link) => !inRanges(taken, link.start));\n return [...defined, ...bracketed, ...autolinks].sort((a, b) => a.start - b.start);\n}\n\n/**\n * How labels compare: trimmed, whitespace collapsed, and case folded as\n * CommonMark's reference implementations fold it, down and then up, so that\n * `ẞ` and `SS` are one label.\n */\nfunction normalizeLabel(label: string): string {\n return label.trim().replace(/\\s+/g, ' ').toLowerCase().toUpperCase();\n}\n\n/**\n * Definitions come first: the reference forms are read through them, and a\n * definition is conventionally written at the foot of the file, after the\n * links that use it. The first definition of a label wins.\n *\n * `[Note]: this matters` is prose that looks like one, so a definition has\n * nothing after its destination but a title. `[^1]: text` is a footnote.\n *\n * A definition cannot interrupt a paragraph, as CommonMark has it: one\n * written on the line under a paragraph's text is that text. It opens a\n * paragraph, or follows a definition that did.\n */\nfunction readDefinitions(layout: Layout, headings: readonly Heading[], definitions: Map<string, Definition>): Link[] {\n const { text, structure, lines, continues } = layout;\n const closed = closingLines(layout, headings);\n const out: Link[] = [];\n for (const line of lines) {\n if (!isMarkdown(line) || !visibleLead(layout, line)) continue;\n const masked = structure.slice(line.contentStart, line.end);\n const match = DEFINITION.exec(masked);\n if (match === null || !TITLE_ONLY.test(masked.slice(match[0].length))) continue;\n // Under a definition the paragraph holds nothing else yet. `continues`\n // holds no first line, so there is a line above whenever it is asked about.\n const follows = out[out.length - 1]?.line === line.line - 1;\n if (!follows && continues.has(line.line) && paragraphOpen(lines[line.line - 2] as ScannedLine, closed)) continue;\n const between = (match[1] as string).length;\n const start = line.contentStart + match[0].indexOf('[');\n const label = text.slice(start + 1, start + 1 + between).trim();\n if (label.length === 0 || between > MAX_LABEL) continue;\n const written = match[2] as string;\n const end = line.contentStart + match[0].length;\n const angle = written.charCodeAt(0) === LESS_THAN ? 1 : 0;\n const targetStart = end - written.length + angle;\n const targetEnd = end - angle;\n const target = text.slice(targetStart, targetEnd);\n const key = normalizeLabel(label);\n if (!definitions.has(key)) definitions.set(key, { target, targetStart, targetEnd });\n out.push({ form: 'definition', image: false, text: label, target, label, start, end, targetStart, targetEnd, line: line.line });\n }\n return out;\n}\n\n/**\n * The lines after which no paragraph is open, though the line under one\n * would go on with a paragraph written there: the last line of a heading,\n * and of an HTML block a comment opens. Such a block starts where a comment\n * opens a line, after at most three columns, and ends on the line the\n * comment closes on.\n */\nfunction closingLines(layout: Layout, headings: readonly Heading[]): Set<number> {\n const closed = new Set<number>();\n for (const heading of headings) closed.add(heading.endLine);\n for (const comment of layout.comments) {\n const opened = layout.lines[comment.line - 1] as ScannedLine;\n if (opened.indent <= 3 && comment.start === leadOffset(opened)) closed.add(layout.index.positionAt(comment.end).line);\n }\n return closed;\n}\n\n/**\n * Whether a paragraph is open after a line, for the line under it to go on\n * with. None is after a blank line, code, a thematic break or a closing\n * line, and none is open in a list item whose marker has nothing after it,\n * or a heading or a thematic break.\n */\nfunction paragraphOpen(line: ScannedLine, closed: ReadonlySet<number>): boolean {\n if (!isMarkdown(line) || line.blank || closed.has(line.line) || isThematicBreak(line.content)) return false;\n const marker = listMarker(line.content);\n if (marker === null) return true;\n // The marker takes every space after it, so what is left is empty or text.\n const rest = line.content.slice(marker.offset + marker.width);\n return rest.length > 0 && atxLevel(rest) === 0 && !isThematicBreak(rest);\n}\n\nfunction readAutolinks(layout: Layout): Link[] {\n const out: Link[] = [];\n for (const match of layout.structure.matchAll(AUTOLINK)) {\n const start = match.index;\n const end = start + match[0].length;\n out.push({\n form: 'autolink',\n image: false,\n text: '',\n target: match[1] as string,\n label: null,\n start,\n end,\n targetStart: start + 1,\n targetEnd: end - 1,\n line: layout.index.positionAt(start).line,\n });\n }\n return out;\n}\n\n/** The brackets of a paragraph, `[` paired with `]` as a stack pairs them, escaped ones skipped. */\ninterface Brackets {\n /** Each `[` a `]` closes, to that `]`, in the order of the `]`s: every pair after the pairs inside it. */\n readonly pairs: Map<number, number>;\n /** Each paired `[` to the `[` still open around it, where there is one. */\n readonly outer: Map<number, number>;\n /** Each paired `[` to how many pairs had closed when it opened: the pairs wholly before it. */\n readonly before: Map<number, number>;\n /** Every `[` written after an unescaped `!`: an image's. */\n readonly images: Set<number>;\n /** Every `[` with a pair inside it: those whose text holds an unescaped bracket. */\n readonly nested: Set<number>;\n}\n\nfunction pairBrackets(structure: string, from: number, to: number): Brackets {\n const brackets: Brackets = { pairs: new Map(), outer: new Map(), before: new Map(), images: new Set(), nested: new Set() };\n const { pairs } = brackets;\n const open: { readonly at: number; readonly before: number }[] = [];\n let escaped = -1;\n for (let at = from; at < to; at += 1) {\n const ch = structure.charCodeAt(at);\n if (ch === BACKSLASH) {\n escaped = at + 1;\n at += 1;\n } else if (ch === OPEN_BRACKET) {\n open.push({ at, before: pairs.size });\n if (structure.charCodeAt(at - 1) === BANG && escaped !== at - 1) brackets.images.add(at);\n } else if (ch === CLOSE_BRACKET) {\n // A `]` with nothing to close pairs with nothing; recorded under\n // `undefined` it would not be found either, so this test changes no\n // answer, only what the maps hold.\n const opened = open.pop();\n if (opened !== undefined) {\n pairs.set(opened.at, at);\n brackets.before.set(opened.at, opened.before);\n const around = open[open.length - 1];\n if (around !== undefined) {\n brackets.outer.set(opened.at, around.at);\n brackets.nested.add(around.at);\n }\n }\n }\n }\n return brackets;\n}\n\n/**\n * For every offset of a paragraph, where what starts there ends, or the end\n * of the paragraph when nothing does: a bare destination at the next space or\n * control character, or at the first `)` its own parentheses leave unmatched;\n * a title at its next unescaped closing quote or parenthesis. Filled from the\n * right in one pass, so every lookup is a read.\n */\ninterface Ends {\n readonly space: Int32Array;\n readonly paren: Int32Array;\n readonly doubleQuote: Int32Array;\n readonly singleQuote: Int32Array;\n readonly closeParen: Int32Array;\n readonly openParen: Int32Array;\n}\n\nfunction endsOf(structure: string, from: number, to: number): Ends {\n const length = to - from;\n const escaped = new Uint8Array(length + 1);\n for (let x = 0; x < length; x += 1) {\n if (escaped[x] === 0 && structure.charCodeAt(from + x) === BACKSLASH) escaped[x + 1] = 1;\n }\n // Two past the last offset: a `(` whose `)` is the paragraph's last\n // character looks one further for the next unmatched `)`, and finds none.\n const make = (): Int32Array => new Int32Array(length + 2).fill(to);\n const ends: Ends = { space: make(), paren: make(), doubleQuote: make(), singleQuote: make(), closeParen: make(), openParen: make() };\n for (let x = length - 1; x >= 0; x -= 1) {\n const at = from + x;\n const ch = structure.charCodeAt(at);\n const plain = escaped[x] === 0;\n ends.space[x] = ch <= 32 || ch === 127 ? at : (ends.space[x + 1] as number);\n // From a `(`, the first unmatched `)` is the first one after the `)` that\n // closes it, which is the first unmatched `)` after the `(`.\n const unmatched = ends.paren[x + 1] as number;\n if (plain && ch === CLOSE_PAREN) ends.paren[x] = at;\n else if (plain && ch === OPEN_PAREN) ends.paren[x] = ends.paren[unmatched + 1 - from] as number;\n else ends.paren[x] = unmatched;\n ends.doubleQuote[x] = plain && ch === DOUBLE_QUOTE ? at : (ends.doubleQuote[x + 1] as number);\n ends.singleQuote[x] = plain && ch === SINGLE_QUOTE ? at : (ends.singleQuote[x + 1] as number);\n ends.closeParen[x] = plain && ch === CLOSE_PAREN ? at : (ends.closeParen[x + 1] as number);\n ends.openParen[x] = plain && ch === OPEN_PAREN ? at : (ends.openParen[x + 1] as number);\n }\n return ends;\n}\n\ninterface Destination {\n readonly targetStart: number;\n readonly targetEnd: number;\n /** Offset just past the closing `)`. */\n readonly end: number;\n}\n\n/**\n * The bracket forms, a paragraph at a time. A paragraph here is a run of\n * Markdown lines, none blank or a definition, each continuing the one above:\n * a bracket never pairs across a blank line, a heading, a definition, or the\n * start of another block.\n */\nfunction readBrackets(layout: Layout, definitions: ReadonlyMap<string, Definition>, defined: ReadonlySet<number>): Link[] {\n const { lines, continues, structure, text } = layout;\n const out: Link[] = [];\n // The first `]]` at or after the last place one was looked for; the cursor\n // only moves forward, so each is found once.\n let doubleClose = -2;\n\n const lookup = (from: number, to: number): Definition | undefined =>\n to - from > MAX_LABEL ? undefined : definitions.get(normalizeLabel(text.slice(from, to)));\n\n // A blank or code line let into a paragraph would bring only characters the\n // structure mask blanks, so those two tests shape the runs and change no\n // link. A definition's line is no paragraph's: it holds a label, a\n // destination and a title, none of them a link, and the text after it is a\n // paragraph of its own, whose brackets pair with nothing before it. Past\n // the last line there is no line, and `continues` holds nothing there, so\n // no run reaches past it: the loop below could take one step more, and the\n // test for a line that is not there could go.\n const inParagraph = (i: number): boolean => {\n const line = lines[i];\n return line !== undefined && isMarkdown(line) && !line.blank && !defined.has(i + 1);\n };\n\n for (let first = 0; first < lines.length; first += 1) {\n if (!inParagraph(first)) continue;\n let last = first;\n while (inParagraph(last + 1) && continues.has(last + 2)) last += 1;\n const from = (lines[first] as ScannedLine).start;\n const to = (lines[last] as ScannedLine).end;\n const brackets = pairBrackets(structure, from, to);\n const { pairs } = brackets;\n // Each `[` with a link inside it, at any depth.\n const holding = new Set<number>();\n let ends: Ends | null = null;\n\n // Spaces and tabs, and at most one line ending inside the paragraph. The\n // character at `to` ends the paragraph's last line and is none of these.\n const skipSpace = (start: number): number => {\n let at = start;\n while (isSpaceOrTab(structure, at)) at += 1;\n if (at < to) {\n if (structure.charCodeAt(at) === CR) at += 1;\n if (structure.charCodeAt(at) === LF) at += 1;\n while (isSpaceOrTab(structure, at)) at += 1;\n }\n return at;\n };\n\n const destination = (open: number): Destination | null => {\n const at = skipSpace(open);\n let targetStart: number;\n let targetEnd: number;\n let after: number;\n if (structure.charCodeAt(at) === LESS_THAN) {\n // `<dest>`: no line ending and no unescaped `<` inside.\n let close = at + 1;\n for (;;) {\n if (close >= to) return null;\n const ch = structure.charCodeAt(close);\n if (ch === GREATER_THAN) break;\n if (ch === LESS_THAN || ch === LF || ch === CR) return null;\n close += ch === BACKSLASH ? 2 : 1;\n }\n targetStart = at + 1;\n targetEnd = close;\n after = close + 1;\n } else {\n ends ??= endsOf(structure, from, to);\n const space = ends.space[at - from] as number;\n const paren = ends.paren[at - from] as number;\n targetStart = at;\n // The two are equal only when neither is found, at `to`.\n targetEnd = paren < space ? paren : space;\n after = targetEnd;\n // An empty destination points nowhere a reader can follow.\n if (targetEnd === at) return null;\n }\n let k = skipSpace(after);\n if (structure.charCodeAt(k) === CLOSE_PAREN) return { targetStart, targetEnd, end: k + 1 };\n // A title is separated from the destination by whitespace, and quoted.\n if (k === after) return null;\n ends ??= endsOf(structure, from, to);\n const x = k + 1 - from;\n const quote = structure.charCodeAt(k);\n let close: number;\n if (quote === DOUBLE_QUOTE) close = ends.doubleQuote[x] as number;\n else if (quote === SINGLE_QUOTE) close = ends.singleQuote[x] as number;\n // A title in parentheses may not hold an unescaped `(`.\n else if (quote === OPEN_PAREN) close = (ends.openParen[x] as number) < (ends.closeParen[x] as number) ? to : (ends.closeParen[x] as number);\n else return null;\n // Equal ends are `to`, where the title fails either way. Past `to` the\n // next line opens a block of its own, and none opens with `)`.\n if (close === to) return null;\n k = skipSpace(close + 1);\n return structure.charCodeAt(k) === CLOSE_PAREN ? { targetStart, targetEnd, end: k + 1 } : null;\n };\n\n const wiki = (at: number, start: number, image: boolean, line: ScannedLine): Link | null => {\n if (structure.charCodeAt(at + 1) !== OPEN_BRACKET) return null;\n if (doubleClose !== -1 && doubleClose < at + 2) doubleClose = structure.indexOf(']]', at + 2);\n const close = doubleClose;\n if (close < 0 || close + 2 > line.end) return null;\n const inner = text.slice(at + 2, close);\n const written = inner.trim();\n const pipe = written.indexOf('|');\n const target = (pipe < 0 ? written : written.slice(0, pipe)).trim();\n // `[[ ]]` and `[[|text]]` name nothing to link to.\n if (target.length === 0) return null;\n const targetStart = at + 2 + inner.length - inner.trimStart().length;\n return {\n form: 'wiki',\n image,\n text: written,\n target,\n label: null,\n start,\n end: close + 2,\n targetStart,\n targetEnd: targetStart + target.length,\n line: line.line,\n };\n };\n\n const bracket = (at: number, start: number, image: boolean, line: ScannedLine): Link | null => {\n const close = pairs.get(at);\n // A link holding a link is text; an image holding one is still an image.\n if (close === undefined || (!image && holding.has(at))) return null;\n const label = (): string => text.slice(at + 1, close).trim();\n if (structure.charCodeAt(close + 1) === OPEN_PAREN) {\n const dest = destination(close + 2);\n if (dest !== null) {\n const target = text.slice(dest.targetStart, dest.targetEnd);\n return { form: 'inline', image, text: label(), target, label: null, start, line: line.line, ...dest };\n }\n } else {\n // Only a `[` is paired, so a second bracket follows exactly when this\n // finds one. It is a label unless it holds a bracket, which it does\n // when a pair lies inside it, or more than 999 characters; one that is\n // not leaves the first bracket to be read as a shortcut.\n const refClose = pairs.get(close + 1);\n // With no second bracket the length is NaN and the comparison false,\n // so the first test only narrows the type.\n if (refClose !== undefined && refClose - close - 2 <= MAX_LABEL && !brackets.nested.has(close + 1)) {\n // `[text][]` is read through its text; `[text][label]` through its label.\n const collapsed = text.slice(close + 2, refClose).trim() === '';\n const found = collapsed ? lookup(at + 1, close) : lookup(close + 2, refClose);\n if (found === undefined) return null;\n const written = collapsed ? label() : text.slice(close + 2, refClose).trim();\n return { form: 'reference', image, text: label(), label: written, start, end: refClose + 1, line: line.line, ...found };\n }\n }\n // `[text](not a destination)` is a shortcut followed by text, as CommonMark reads it.\n const found = lookup(at + 1, close);\n if (found === undefined) return null;\n return { form: 'shortcut', image, text: label(), label: label(), start, end: close + 1, line: line.line, ...found };\n };\n\n const lineAt = (at: number): ScannedLine => lines[layout.index.positionAt(at).line - 1] as ScannedLine;\n\n // CommonMark reads each pair at its `]`, so the pairs inside a `[` are\n // read before it, and a link among them makes it text, and every `[`\n // open around it: the pairs come innermost first, and fill `holding` on\n // the way out. An image among them does not; a link may hold one. What a\n // link or an image reads past its `]` - a destination, a title, a second\n // label - is not read for links again: `reach` is the furthest any of the\n // first so many pairs read to, and a `[` short of it opens nothing.\n const reach = [from];\n for (const at of pairs.keys()) {\n const line = lineAt(at);\n const image = brackets.images.has(at);\n const passed = (reach[brackets.before.get(at) as number] as number) > at;\n const link = passed ? null : bracket(at, at, image, line);\n reach.push(Math.max(reach[reach.length - 1] as number, link === null ? from : link.end));\n const around = brackets.outer.get(at);\n // `holding` is asked only about offsets, so the first test only\n // narrows the type.\n if (around !== undefined && (holding.has(at) || (link !== null && !image))) holding.add(around);\n }\n\n let at = from;\n // Inside a link's text, up to its `]`, where CommonMark reads an image -\n // a badge wrapped in a link - but no other link; then on past the link.\n // `textEnd` is -1 or a `]` that closes a `[`, so never 0, and the `]` is\n // read as no link. Leaving one step later, past it, resumes at the same\n // place, or ends the paragraph where a shortcut link ended it anyway: the\n // test below reads the same with `textEnd > 0` or `at > textEnd`, and so\n // does the one further into the loop with `textEnd > 0`. `resume` is read\n // only while `textEnd` is set, and the two are set together, so its first\n // value is never read.\n let textEnd = -1;\n let resume = -1;\n while (at < to) {\n if (textEnd >= 0 && at >= textEnd) {\n at = resume;\n textEnd = -1;\n continue;\n }\n const ch = structure.charCodeAt(at);\n if (ch === BACKSLASH) {\n at += 2;\n continue;\n }\n if (ch !== OPEN_BRACKET) {\n at += 1;\n continue;\n }\n const line = lineAt(at);\n const image = brackets.images.has(at);\n const start = image ? at - 1 : at;\n const link = wiki(at, start, image, line) ?? bracket(at, start, image, line);\n if (textEnd >= 0) {\n // An image that closes inside the text; its own text is alt text, and\n // holds nothing a reader follows.\n if (link !== null && link.image && link.form !== 'wiki' && link.end <= textEnd) {\n out.push(link);\n at = link.end;\n } else {\n at += 1;\n }\n } else if (link === null) {\n at += 1;\n } else {\n out.push(link);\n if (!link.image && link.form !== 'wiki') {\n textEnd = pairs.get(at) as number;\n resume = link.end;\n // Into the text. A step back instead reads the character before\n // the `[`, which opens nothing there - it opened no link before\n // this one, or it is escaped - and comes back here.\n at += 1;\n } else {\n at = link.end;\n }\n }\n }\n first = last;\n }\n return out;\n}\n"]}
@@ -29,6 +29,9 @@ export function findTables(layout, atx) {
29
29
  return layout.covered.has(line.line) || heading.has(line.line) ? null : line;
30
30
  };
31
31
  const out = [];
32
+ // A header needs a line under it. `row` answers null for a line past the
33
+ // last, so a bound that lets `i` reach one or two further finds the same
34
+ // tables.
32
35
  for (let i = 0; i + 1 < lines.length; i += 1) {
33
36
  const header = row(i);
34
37
  const delimiter = row(i + 1);
@@ -1 +1 @@
1
- {"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/markdown/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AAGlE,MAAM,IAAI,GAAG,GAAG,CAAC;AACjB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,cAAc,GAAG,UAAU,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,GAAqC;IAC9E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,qEAAqE;IACrE,wDAAwD;IACxD,MAAM,GAAG,GAAG,CAAC,CAAS,EAAsB,EAAE;QAC5C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,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,CAAC;IAEnC,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,2EAA2E;IAC3E,IAAI,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,MAAM,CAAC,KAAK,EAAa,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IACjG,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACtC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,2EAA2E;IAC3E,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7F,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,IAAI,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW;IACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;IACpD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC1F,CAAC","sourcesContent":["/**\n * GFM pipe tables, with an offset for every cell.\n *\n * Cell offsets are the point: a register kept as a table needs findings that\n * name the cell declaring a relation, not the row and not the file. Rows are\n * split on the structure mask, so a pipe inside a code span or a comment\n * cannot invent a column, and the text of each cell comes from the original.\n *\n * Reading one line past the last, or one character past a line's end, finds\n * no row and no pipe, so mutants that move those bounds are equivalent.\n */\n\nimport { isMarkdown, leadOffset, type Layout } from './layout.js';\nimport type { Heading, ScannedLine, Table, TableCell, TableRow } from './types.js';\n\nconst PIPE = 124;\nconst BACKSLASH = 92;\nconst DELIMITER_CELL = /^:?-+:?$/;\n\n/**\n * A header line, a delimiter row with as many cells, and the rows under them\n * up to a line that is blank, holds no pipe, or is not Markdown.\n */\nexport function findTables(layout: Layout, atx: readonly Pick<Heading, 'line'>[]): Table[] {\n const { lines } = layout;\n const heading = new Set(atx.map((h) => h.line));\n // A line starting in a comment is not a row, and neither is one that\n // continues a code span or comment from the line above.\n const row = (i: number): ScannedLine | null => {\n const line = lines[i];\n if (line === undefined || !isMarkdown(line) || line.blank || line.comment) return null;\n return layout.covered.has(line.line) || heading.has(line.line) ? null : line;\n };\n\n const out: Table[] = [];\n for (let i = 0; i + 1 < lines.length; i += 1) {\n const header = row(i);\n const delimiter = row(i + 1);\n if (header === null || delimiter === null) continue;\n const headers = splitRow(layout, header);\n if (headers.length === 0) continue;\n const marks = splitRow(layout, delimiter);\n if (marks.length !== headers.length || !marks.every((cell) => DELIMITER_CELL.test(cell.text))) continue;\n\n const rows: TableRow[] = [];\n let last = delimiter;\n for (let line = row(i + 2); line !== null; line = row(line.line)) {\n const cells = splitRow(layout, line);\n if (cells.length === 0) break;\n rows.push({ cells, start: line.contentStart, end: line.end, line: line.line });\n last = line;\n }\n out.push({ start: header.contentStart, end: last.end, line: header.line, endLine: last.line, headers, rows });\n i = last.line - 1;\n }\n return out;\n}\n\n/** Splits a row into cells, keeping each cell's offsets. A row without a pipe has none. */\nfunction splitRow(layout: Layout, line: ScannedLine): TableCell[] {\n const { text, structure } = layout;\n const bounds: number[] = [];\n for (let at = line.contentStart; at < line.end; at += 1) {\n // A pipe escaped with a backslash is content, not a column edge.\n if (structure.charCodeAt(at) === PIPE && text.charCodeAt(at - 1) !== BACKSLASH) bounds.push(at);\n }\n if (bounds.length === 0) return [];\n\n const cells: TableCell[] = [];\n // A pipe opening the row is a border, not the edge of an empty first cell.\n let cursor = bounds[0] === leadOffset(line) ? (bounds.shift() as number) + 1 : line.contentStart;\n for (const bound of bounds) {\n cells.push(cell(text, cursor, bound));\n cursor = bound + 1;\n }\n // What follows the last pipe is a cell unless the row ended with a border.\n if (text.slice(cursor, line.end).trim().length > 0) cells.push(cell(text, cursor, line.end));\n return cells;\n}\n\nfunction cell(text: string, start: number, end: number): TableCell {\n const raw = text.slice(start, end);\n const leading = raw.length - raw.trimStart().length;\n const trimmed = raw.trim();\n return { text: trimmed, start: start + leading, end: start + leading + trimmed.length };\n}\n"]}
1
+ {"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/markdown/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AAGlE,MAAM,IAAI,GAAG,GAAG,CAAC;AACjB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,cAAc,GAAG,UAAU,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,GAAqC;IAC9E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,qEAAqE;IACrE,wDAAwD;IACxD,MAAM,GAAG,GAAG,CAAC,CAAS,EAAsB,EAAE;QAC5C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI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C;IAC9B,2EAA2E;IAC3E,IAAI,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,MAAM,CAAC,KAAK,EAAa,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IACjG,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACtC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,2EAA2E;IAC3E,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7F,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,IAAI,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW;IACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;IACpD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC1F,CAAC","sourcesContent":["/**\n * GFM pipe tables, with an offset for every cell.\n *\n * Cell offsets are the point: a register kept as a table needs findings that\n * name the cell declaring a relation, not the row and not the file. Rows are\n * split on the structure mask, so a pipe inside a code span or a comment\n * cannot invent a column, and the text of each cell comes from the original.\n *\n * Reading one line past the last, or one character past a line's end, finds\n * no row and no pipe, so mutants that move those bounds are equivalent.\n */\n\nimport { isMarkdown, leadOffset, type Layout } from './layout.js';\nimport type { Heading, ScannedLine, Table, TableCell, TableRow } from './types.js';\n\nconst PIPE = 124;\nconst BACKSLASH = 92;\nconst DELIMITER_CELL = /^:?-+:?$/;\n\n/**\n * A header line, a delimiter row with as many cells, and the rows under them\n * up to a line that is blank, holds no pipe, or is not Markdown.\n */\nexport function findTables(layout: Layout, atx: readonly Pick<Heading, 'line'>[]): Table[] {\n const { lines } = layout;\n const heading = new Set(atx.map((h) => h.line));\n // A line starting in a comment is not a row, and neither is one that\n // continues a code span or comment from the line above.\n const row = (i: number): ScannedLine | null => {\n const line = lines[i];\n if (line === undefined || !isMarkdown(line) || line.blank || line.comment) return null;\n return layout.covered.has(line.line) || heading.has(line.line) ? null : line;\n };\n\n const out: Table[] = [];\n // A header needs a line under it. `row` answers null for a line past the\n // last, so a bound that lets `i` reach one or two further finds the same\n // tables.\n for (let i = 0; i + 1 < lines.length; i += 1) {\n const header = row(i);\n const delimiter = row(i + 1);\n if (header === null || delimiter === null) continue;\n const headers = splitRow(layout, header);\n if (headers.length === 0) continue;\n const marks = splitRow(layout, delimiter);\n if (marks.length !== headers.length || !marks.every((cell) => DELIMITER_CELL.test(cell.text))) continue;\n\n const rows: TableRow[] = [];\n let last = delimiter;\n for (let line = row(i + 2); line !== null; line = row(line.line)) {\n const cells = splitRow(layout, line);\n if (cells.length === 0) break;\n rows.push({ cells, start: line.contentStart, end: line.end, line: line.line });\n last = line;\n }\n out.push({ start: header.contentStart, end: last.end, line: header.line, endLine: last.line, headers, rows });\n i = last.line - 1;\n }\n return out;\n}\n\n/** Splits a row into cells, keeping each cell's offsets. A row without a pipe has none. */\nfunction splitRow(layout: Layout, line: ScannedLine): TableCell[] {\n const { text, structure } = layout;\n const bounds: number[] = [];\n for (let at = line.contentStart; at < line.end; at += 1) {\n // A pipe escaped with a backslash is content, not a column edge.\n if (structure.charCodeAt(at) === PIPE && text.charCodeAt(at - 1) !== BACKSLASH) bounds.push(at);\n }\n if (bounds.length === 0) return [];\n\n const cells: TableCell[] = [];\n // A pipe opening the row is a border, not the edge of an empty first cell.\n let cursor = bounds[0] === leadOffset(line) ? (bounds.shift() as number) + 1 : line.contentStart;\n for (const bound of bounds) {\n cells.push(cell(text, cursor, bound));\n cursor = bound + 1;\n }\n // What follows the last pipe is a cell unless the row ended with a border.\n if (text.slice(cursor, line.end).trim().length > 0) cells.push(cell(text, cursor, line.end));\n return cells;\n}\n\nfunction cell(text: string, start: number, end: number): TableCell {\n const raw = text.slice(start, end);\n const leading = raw.length - raw.trimStart().length;\n const trimmed = raw.trim();\n return { text: trimmed, start: start + leading, end: start + leading + trimmed.length };\n}\n"]}
@@ -46,10 +46,22 @@ interface Hole {
46
46
  * matched slowly.
47
47
  */
48
48
  export declare const MAX_STATES = 65536;
49
+ /**
50
+ * Thrown by the builder past {@link MAX_STATES}. `parseGlob` answers it as a
51
+ * refusal and `compileGlob` as a `GlobError`, so no function the pattern
52
+ * module exports lets it out; it stays exported for callers written when
53
+ * `parseGlob` did.
54
+ */
49
55
  export declare class AutomatonTooLarge extends Error {
50
56
  constructor();
51
57
  }
52
- /** Thompson's construction, one fragment at a time. */
58
+ /**
59
+ * Thompson's construction, one fragment at a time.
60
+ *
61
+ * An arrow written as -1 is a hole that `patch` aims before `finish` returns,
62
+ * or one nothing follows: a CHAR's second and both of a MATCH's. What it
63
+ * starts as is never read, so any other start gives the same automaton.
64
+ */
53
65
  export declare class Builder {
54
66
  private readonly kinds;
55
67
  private readonly first;
@@ -78,7 +90,8 @@ export declare class Builder {
78
90
  * A reusable matcher over one automaton.
79
91
  *
80
92
  * Holds its buffers between subjects; it is not reentrant, and nothing needs
81
- * it to be - matching calls out to nothing.
93
+ * it to be - matching calls out to nothing. `test` empties each buffer before
94
+ * it reads one, so what a buffer starts with is never read.
82
95
  */
83
96
  export declare class Matcher {
84
97
  private readonly automaton;