@descent-vtt/spec-brief 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -1
- package/README.md +162 -29
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +61 -43
- package/dist/cli.js.map +1 -1
- package/dist/collisions.js +13 -8
- package/dist/collisions.js.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/corpus.d.ts +5 -0
- package/dist/corpus.js +7 -0
- package/dist/corpus.js.map +1 -1
- package/dist/glob.d.ts +6 -2
- package/dist/glob.js +27 -5
- package/dist/glob.js.map +1 -1
- package/dist/lint.js +1 -0
- package/dist/lint.js.map +1 -1
- package/dist/report.d.ts +18 -4
- package/dist/report.js +98 -28
- package/dist/report.js.map +1 -1
- package/dist/rules.d.ts +2 -0
- package/dist/rules.js +21 -8
- package/dist/rules.js.map +1 -1
- package/dist/schedule.js +12 -10
- package/dist/schedule.js.map +1 -1
- package/dist/schema.d.ts +5 -1
- package/dist/schema.js +6 -2
- package/dist/schema.js.map +1 -1
- package/dist/scope.d.ts +26 -4
- package/dist/scope.js +64 -8
- package/dist/scope.js.map +1 -1
- package/dist/trigger.js +59 -3
- package/dist/trigger.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.js.map +1 -1
- package/dist/vendor/spec-core/markdown/frontmatter.d.ts +11 -1
- package/dist/vendor/spec-core/markdown/frontmatter.js +20 -3
- package/dist/vendor/spec-core/markdown/frontmatter.js.map +1 -1
- package/dist/vendor/spec-core/pattern/glob.d.ts +88 -2
- package/dist/vendor/spec-core/pattern/glob.js +234 -32
- package/dist/vendor/spec-core/pattern/glob.js.map +1 -1
- package/dist/vendor/spec-core/pattern/index.d.ts +2 -2
- package/dist/vendor/spec-core/pattern/index.js +1 -1
- package/dist/vendor/spec-core/pattern/index.js.map +1 -1
- package/dist/vendor/spec-core/text/index.d.ts +1 -0
- package/dist/vendor/spec-core/text/index.js +1 -0
- package/dist/vendor/spec-core/text/index.js.map +1 -1
- package/dist/vendor/spec-core/text/width.d.ts +30 -0
- package/dist/vendor/spec-core/text/width.js +113 -0
- package/dist/vendor/spec-core/text/width.js.map +1 -0
- package/package.json +1 -1
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,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACtJ,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,CA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E,SAAS;QACnB,WAAW,EAAE,6FAA6F;KAC3G;IACD,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,sDAAsD,EAAE;IACzG,EAAE,EAAE,EAAE,kBAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,0DAA0D,EAAE;IACpH;QACE,EAAE,EAAE,eAAe;QACnB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,oHAAoH;KAClI;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwB;IAChD;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"]}
|
|
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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AI,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;oBACzC,OAAO,EAAE,mCAAmC;oBAC5C,IAAI,EAAE,uFAAuF;iBAC9F;aACF,CAAC;QACJ,CAAC;KACF;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAwB;IAClD,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,gDAAgD,EAAE;IACrG;QACE,EAAE,EAAE,qBAAqB;QACzB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,6FAA6F;KAC3G;IACD,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,sDAAsD,EAAE;IACzG,EAAE,EAAE,EAAE,kBAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,0DAA0D,EAAE;IACpH;QACE,EAAE,EAAE,eAAe;QACnB,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,oHAAoH;KAClI;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwB;IAChD;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, cycleSubject, 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 /** What the finding is about, where the rule can report more than one thing in a brief: a finding's `subject`. */\n readonly subject?: string | 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\\uff1a]/.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 subject: 'covered',\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 subject: 'undecided',\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, subject: p.field })),\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 subject: entry.key,\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 subject: rule.name,\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', subject: rule.name })),\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 subject: rule.name,\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 subject: rule.name,\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 subject: rule.name,\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}\"`, subject: `${rule.name}: \"${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', subject: dependency }];\n }\n if (resolveDependency(corpus, dependency) === undefined) {\n return [{ line, message: `depends on \"${dependency}\", which is not a brief here`, subject: dependency }];\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 subject: cycleSubject(cycle),\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 subject: target.id ?? target.name,\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 subject: `${field}: ${pattern}`,\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 subject: `${field}: ${p.pattern}`,\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 const subject = `${field}: ${pattern}`;\n if (!isGlobSyntax(pattern)) {\n return [{ line, message: `\"${pattern}\" in ${field} is not in the tree and is read as a file`, hint, subject }];\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 subject,\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"]}
|
package/dist/schedule.js
CHANGED
|
@@ -17,22 +17,22 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { lineOfField } from './brief.js';
|
|
19
19
|
import { undecidedFinding, unscopedFinding } from './collisions.js';
|
|
20
|
-
import { byId, dependencyCycles, liveDependencies, waitingOnDeferred } from './corpus.js';
|
|
20
|
+
import { byId, cycleSubject, dependencyCycles, liveDependencies, waitingOnDeferred } from './corpus.js';
|
|
21
21
|
import { editable, setEntryKeepingComment } from './frontmatter.js';
|
|
22
22
|
import { readingIn, WITNESS_BUDGET } from './glob.js';
|
|
23
23
|
import { configuredSeverity } from './lint.js';
|
|
24
|
-
import { meet, scopeOf } from './scope.js';
|
|
24
|
+
import { meet, scopeOf, witnessText } from './scope.js';
|
|
25
25
|
import { encodeLike } from './text.js';
|
|
26
26
|
function label(brief) {
|
|
27
27
|
return brief.id ?? brief.name;
|
|
28
28
|
}
|
|
29
29
|
export { byId } from './corpus.js';
|
|
30
30
|
/** The first brief in a wave this one cannot share it with, or `null` when it can join. */
|
|
31
|
-
function clash(own, wave, here, budget) {
|
|
31
|
+
function clash(own, wave, here, budget, files) {
|
|
32
32
|
for (const other of here) {
|
|
33
33
|
if (own.affected.length === 0 || other.affected.length === 0)
|
|
34
34
|
return { wave, reason: 'unscoped', brief: other.brief };
|
|
35
|
-
const meeting = meet(own, other, budget);
|
|
35
|
+
const meeting = meet(own, other, budget, files);
|
|
36
36
|
if (meeting.overlaps.length > 0)
|
|
37
37
|
return { wave, reason: 'collision', brief: other.brief, overlaps: meeting.overlaps };
|
|
38
38
|
if (meeting.undecided.length > 0)
|
|
@@ -59,14 +59,15 @@ function breachesOf(brief, wave, judge) {
|
|
|
59
59
|
for (const other of judge.compared) {
|
|
60
60
|
if (other === brief || other.wave !== wave)
|
|
61
61
|
continue;
|
|
62
|
-
const overlaps = meet(judge.scope(brief), judge.scope(other), judge.budget).overlaps;
|
|
62
|
+
const overlaps = meet(judge.scope(brief), judge.scope(other), judge.budget, judge.files).overlaps;
|
|
63
63
|
if (overlaps.length > 0)
|
|
64
64
|
out.push({ reason: 'collision', brief: other, overlaps });
|
|
65
65
|
}
|
|
66
66
|
return out;
|
|
67
67
|
}
|
|
68
68
|
export function schedule(corpus, options = {}) {
|
|
69
|
-
const
|
|
69
|
+
const files = options.repoFiles ?? null;
|
|
70
|
+
const reading = readingIn(files);
|
|
70
71
|
const budget = options.budget ?? WITNESS_BUDGET;
|
|
71
72
|
const deferred = corpus.live.filter((b) => b.status === 'deferred').sort(byId);
|
|
72
73
|
const briefs = corpus.live.filter((b) => b.status !== 'deferred').sort(byId);
|
|
@@ -87,7 +88,7 @@ export function schedule(corpus, options = {}) {
|
|
|
87
88
|
for (const d of everyDependency.get(b))
|
|
88
89
|
dependents.set(d, [...(dependents.get(d) ?? []), b]);
|
|
89
90
|
}
|
|
90
|
-
const judge = { compared: briefs.filter((b) => !waiting.has(b)), dependencies: everyDependency, dependents, scope, budget };
|
|
91
|
+
const judge = { compared: briefs.filter((b) => !waiting.has(b)), dependencies: everyDependency, dependents, scope, budget, files };
|
|
91
92
|
const waveOf = new Map();
|
|
92
93
|
const occupants = new Map();
|
|
93
94
|
const placements = [];
|
|
@@ -110,7 +111,7 @@ export function schedule(corpus, options = {}) {
|
|
|
110
111
|
let wave = after === null ? first : after.wave + 1;
|
|
111
112
|
// Ends by construction: a wave past every occupied one is empty, and an empty wave takes anyone.
|
|
112
113
|
for (;;) {
|
|
113
|
-
const found = clash(own, wave, occupants.get(wave) ?? [], budget);
|
|
114
|
+
const found = clash(own, wave, occupants.get(wave) ?? [], budget, files);
|
|
114
115
|
if (found === null)
|
|
115
116
|
break;
|
|
116
117
|
passed.push(found);
|
|
@@ -146,7 +147,7 @@ export function holds(p) {
|
|
|
146
147
|
export function breachReasons(p) {
|
|
147
148
|
return p.breaches.map((b) => {
|
|
148
149
|
if (b.reason === 'collision')
|
|
149
|
-
return `${label(b.brief)} there also writes ${b.overlaps[0]
|
|
150
|
+
return `${label(b.brief)} there also writes ${witnessText(b.overlaps[0])}`;
|
|
150
151
|
if (b.reason === 'dependency')
|
|
151
152
|
return `it depends on ${label(b.brief)}, in wave ${b.wave}`;
|
|
152
153
|
return `${label(b.brief)} depends on it, in wave ${b.wave}`;
|
|
@@ -163,7 +164,7 @@ export function reasons(p) {
|
|
|
163
164
|
const there = `not wave ${passed.wave}, where ${label(passed.brief)}`;
|
|
164
165
|
if (passed.reason === 'collision') {
|
|
165
166
|
const [overlap] = passed.overlaps;
|
|
166
|
-
out.push(`${there} also writes ${overlap
|
|
167
|
+
out.push(`${there} also writes ${witnessText(overlap)} ("${overlap.patterns[0]}" and "${overlap.patterns[1]}")`);
|
|
167
168
|
}
|
|
168
169
|
else if (passed.reason === 'undecided') {
|
|
169
170
|
out.push(`${there} may write the same files: the search could not decide within its budget`);
|
|
@@ -191,6 +192,7 @@ export function scheduleFindings(corpus, s) {
|
|
|
191
192
|
line: lineOfField(start, 'dependsOn') + 1,
|
|
192
193
|
brief: start.id ?? undefined,
|
|
193
194
|
hint: 'a cycle can never become ready; remove the dependency that is not real',
|
|
195
|
+
subject: cycleSubject(members),
|
|
194
196
|
});
|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side, so that no two in\n * one wave can write the same file and every brief runs after the briefs it\n * depends on.\n *\n * Deciding what the rounds of a goal are is prose, and an agent's work. Given\n * the rounds, placing them is not: it is precedence-constrained colouring, and\n * a tool answers it the same way every time (ADR-0011). Briefs are taken in\n * dependency order, ties broken by id, and each goes into the lowest wave that\n * is after every live dependency's and holds nothing it collides with. A brief\n * with no scope cannot be proved apart from anything, so it shares its wave\n * with nobody. The greedy answer is not always the fewest waves - no fast\n * method promises that - but it is always a valid one, and the same one.\n *\n * Nothing is written here. `planWaves` says what `--write` would write, and\n * the engine writes it as the archive writes, as one transaction.\n */\n\nimport type { FileOp } from './archive.js';\nimport { type Brief, lineOfField } from './brief.js';\nimport { undecidedFinding, unscopedFinding } from './collisions.js';\nimport { byId, type Corpus, dependencyCycles, liveDependencies, waitingOnDeferred } from './corpus.js';\nimport { editable, setEntryKeepingComment } from './frontmatter.js';\nimport { readingIn, WITNESS_BUDGET } from './glob.js';\nimport { configuredSeverity } from './lint.js';\nimport { meet, type Overlap, type Scope, scopeOf } from './scope.js';\nimport { encodeLike } from './text.js';\nimport type { Finding } from './types.js';\n\nexport interface ScheduleOptions {\n /** The files the tree holds, which say whether a literal path is a file or a directory. */\n readonly repoFiles?: readonly string[] | null;\n /** How many states one witness search may visit before it answers `undecided`. */\n readonly budget?: number;\n}\n\n/** A wave a brief could not join, and the brief already there that kept it out. */\nexport type Passed =\n | { readonly wave: number; readonly reason: 'collision'; readonly brief: Brief; readonly overlaps: readonly Overlap[] }\n | { readonly wave: number; readonly reason: 'undecided'; readonly brief: Brief; readonly patterns: readonly (readonly [string, string])[] }\n /** One of the two declares no affectedFiles, and an unscoped brief runs alone. */\n | { readonly wave: number; readonly reason: 'unscoped'; readonly brief: Brief };\n\n/**\n * Why a declared wave does not hold: what `matrix` or `lint` would report as\n * an error if the brief ran there.\n */\nexport type Breach =\n /** A brief the matrix compares, declaring the same wave, whose scope meets this one's. Overlaps name this brief's pattern first. */\n | { readonly reason: 'collision'; readonly brief: Brief; readonly overlaps: readonly Overlap[] }\n /** A live dependency declaring the same wave or a later one. */\n | { readonly reason: 'dependency'; readonly brief: Brief; readonly wave: number }\n /** A live brief depending on this one, declaring the same wave or an earlier one. */\n | { readonly reason: 'dependent'; readonly brief: Brief; readonly wave: number };\n\nexport interface Placement {\n readonly brief: Brief;\n /** The wave its front matter declares; `null` when it declares none it can read. */\n readonly declared: number | null;\n readonly proposed: number;\n /** The live dependency in the latest wave, which sets the earliest wave this one may run in. */\n readonly after: { readonly brief: Brief; readonly wave: number } | null;\n /** Every wave from that earliest one that it could not join, in order. Overlaps and patterns name its own pattern first. */\n readonly passed: readonly Passed[];\n /** Declares no affectedFiles, so it shares its wave with nobody. */\n readonly unscoped: boolean;\n /**\n * Why the declared wave does not hold, when it is not the proposed one. Empty\n * when it holds - a person moved the brief, and `lint` and `matrix` accept\n * the wave - and when there is no declared wave to judge.\n */\n readonly breaches: readonly Breach[];\n}\n\n/** A live brief that can be placed in no wave, and the dependency that holds it. */\nexport interface Unplaced {\n readonly brief: Brief;\n readonly waitsOn: Brief;\n /** The dependency is deferred, is in a dependency cycle, or is itself unplaced. */\n readonly because: 'deferred' | 'cycle' | 'unplaced';\n}\n\nexport interface Schedule {\n /** The first wave: the lowest any scheduled brief declares, or 1 when none declares one. */\n readonly first: number;\n /** In the order they were placed: dependency order, ties by id. */\n readonly placements: readonly Placement[];\n /** By id. */\n readonly unplaced: readonly Unplaced[];\n /** Dependency cycles among the scheduled briefs, each as a path back to its start. */\n readonly cycles: readonly (readonly Brief[])[];\n /** Deferred briefs, which wait for their trigger and run in no wave. By id. */\n readonly deferred: readonly Brief[];\n}\n\nfunction label(brief: Brief): string {\n return brief.id ?? brief.name;\n}\n\nexport { byId } from './corpus.js';\n\n/** The first brief in a wave this one cannot share it with, or `null` when it can join. */\nfunction clash(own: Scope, wave: number, here: readonly Scope[], budget: number): Passed | null {\n for (const other of here) {\n if (own.affected.length === 0 || other.affected.length === 0) return { wave, reason: 'unscoped', brief: other.brief };\n const meeting = meet(own, other, budget);\n if (meeting.overlaps.length > 0) return { wave, reason: 'collision', brief: other.brief, overlaps: meeting.overlaps };\n if (meeting.undecided.length > 0) return { wave, reason: 'undecided', brief: other.brief, patterns: meeting.undecided };\n }\n return null;\n}\n\n/** What a declared wave is judged against. */\ninterface Judge {\n /** The briefs the matrix compares: none deferred, none waiting on deferred work. */\n readonly compared: readonly Brief[];\n /** Every live brief's live dependencies, and the live briefs that depend on each, by id. */\n readonly dependencies: ReadonlyMap<Brief, readonly Brief[]>;\n readonly dependents: ReadonlyMap<Brief, readonly Brief[]>;\n readonly scope: (b: Brief) => Scope;\n readonly budget: number;\n}\n\n/**\n * Why a brief's declared wave does not hold, judged as `lint` and `matrix`\n * judge it: against the waves the other briefs declare, not the ones proposed.\n * Collisions are with the briefs the matrix compares; the dependency order is\n * wave-order's, both ways, over every live brief.\n */\nfunction breachesOf(brief: Brief, wave: number, judge: Judge): Breach[] {\n const out: Breach[] = [];\n for (const dependency of judge.dependencies.get(brief) as Brief[]) {\n if (dependency.wave !== null && dependency.wave >= wave) out.push({ reason: 'dependency', brief: dependency, wave: dependency.wave });\n }\n for (const other of judge.dependents.get(brief) ?? []) {\n if (other.wave !== null && other.wave <= wave) out.push({ reason: 'dependent', brief: other, wave: other.wave });\n }\n for (const other of judge.compared) {\n if (other === brief || other.wave !== wave) continue;\n const overlaps = meet(judge.scope(brief), judge.scope(other), judge.budget).overlaps;\n if (overlaps.length > 0) out.push({ reason: 'collision', brief: other, overlaps });\n }\n return out;\n}\n\nexport function schedule(corpus: Corpus, options: ScheduleOptions = {}): Schedule {\n const reading = readingIn(options.repoFiles ?? null);\n const budget = options.budget ?? WITNESS_BUDGET;\n const deferred = corpus.live.filter((b) => b.status === 'deferred').sort(byId);\n const briefs = corpus.live.filter((b) => b.status !== 'deferred').sort(byId);\n const dependencies = new Map(briefs.map((b) => [b, liveDependencies(corpus, b)]));\n const declared = briefs.flatMap((b) => (b.wave === null ? [] : [b.wave]));\n const first = declared.length === 0 ? 1 : Math.min(...declared);\n const scopes = new Map<Brief, Scope>();\n const scope = (b: Brief): Scope => {\n const known = scopes.get(b) ?? scopeOf(b, reading);\n scopes.set(b, known);\n return known;\n };\n const waiting = new Set(waitingOnDeferred(corpus).map((w) => w.brief));\n // Deferred briefs too: lint's wave-order reads every live brief's wave.\n const everyDependency = new Map(corpus.live.map((b) => [b, liveDependencies(corpus, b)]));\n const dependents = new Map<Brief, Brief[]>();\n for (const b of [...corpus.live].sort(byId)) {\n for (const d of everyDependency.get(b) as Brief[]) dependents.set(d, [...(dependents.get(d) ?? []), b]);\n }\n const judge: Judge = { compared: briefs.filter((b) => !waiting.has(b)), dependencies: everyDependency, dependents, scope, budget };\n\n const waveOf = new Map<Brief, number>();\n const occupants = new Map<number, Scope[]>();\n const placements: Placement[] = [];\n const pending = [...briefs];\n // Kahn's order, taking the least id whose dependencies are all placed. A\n // brief waiting on a deferred one, or on a cycle, is never taken.\n for (;;) {\n const next = pending.find((b) => (dependencies.get(b) as Brief[]).every((d) => waveOf.has(d)));\n if (next === undefined) break;\n pending.splice(pending.indexOf(next), 1);\n let after: Placement['after'] = null;\n for (const dependency of dependencies.get(next) as Brief[]) {\n const wave = waveOf.get(dependency) as number;\n if (after === null || wave > after.wave) after = { brief: dependency, wave };\n }\n const own = scope(next);\n const passed: Passed[] = [];\n let wave = after === null ? first : after.wave + 1;\n // Ends by construction: a wave past every occupied one is empty, and an empty wave takes anyone.\n for (;;) {\n const found = clash(own, wave, occupants.get(wave) ?? [], budget);\n if (found === null) break;\n passed.push(found);\n wave += 1;\n }\n waveOf.set(next, wave);\n occupants.set(wave, [...(occupants.get(wave) ?? []), own]);\n const breaches = next.wave === null || next.wave === wave ? [] : breachesOf(next, next.wave, judge);\n placements.push({ brief: next, declared: next.wave, proposed: wave, after, passed, unscoped: own.affected.length === 0, breaches });\n }\n\n const cycles = dependencyCycles(corpus).filter((cycle) => cycle.every((b) => b.status !== 'deferred'));\n const inCycle = new Set(cycles.flat());\n const unplaced = pending.map((brief): Unplaced => {\n const waitsOn = (dependencies.get(brief) as Brief[]).find((d) => !waveOf.has(d)) as Brief;\n const because = waitsOn.status === 'deferred' ? 'deferred' : inCycle.has(waitsOn) ? 'cycle' : 'unplaced';\n return { brief, waitsOn, because };\n });\n return { first, placements, unplaced, cycles, deferred };\n}\n\n/** The briefs whose declared wave the schedule would change. */\nexport function moves(s: Schedule): Placement[] {\n return s.placements.filter((p) => p.proposed !== p.declared);\n}\n\n/**\n * Whether a brief's declared wave holds: it is the proposed one, or one a\n * person chose that `lint` and `matrix` accept. The schedule is one valid\n * answer, not the only one (ADR-0011, amended).\n */\nexport function holds(p: Placement): boolean {\n return p.declared !== null && p.breaches.length === 0;\n}\n\n/** Why a declared wave does not hold, a clause each. */\nexport function breachReasons(p: Placement): string[] {\n return p.breaches.map((b) => {\n if (b.reason === 'collision') return `${label(b.brief)} there also writes ${(b.overlaps[0] as Overlap).witness}`;\n if (b.reason === 'dependency') return `it depends on ${label(b.brief)}, in wave ${b.wave}`;\n return `${label(b.brief)} depends on it, in wave ${b.wave}`;\n });\n}\n\n/** Why a brief is in its wave and not an earlier one, a clause each. */\nexport function reasons(p: Placement): string[] {\n const out: string[] = [];\n if (p.after !== null) out.push(`after ${label(p.after.brief)}, in wave ${p.after.wave}`);\n if (p.unscoped && p.passed.length > 0) out.push('it declares no affectedFiles, so it runs in a wave of its own');\n for (const passed of p.passed) {\n const there = `not wave ${passed.wave}, where ${label(passed.brief)}`;\n if (passed.reason === 'collision') {\n const [overlap] = passed.overlaps as [Overlap];\n out.push(`${there} also writes ${overlap.witness} (\"${overlap.patterns[0]}\" and \"${overlap.patterns[1]}\")`);\n } else if (passed.reason === 'undecided') {\n out.push(`${there} may write the same files: the search could not decide within its budget`);\n } else if (!p.unscoped) {\n out.push(`${there} declares no affectedFiles and runs alone`);\n }\n }\n if (out.length === 0) out.push('nothing holds it later');\n return out;\n}\n\n/** The schedule as findings: cycles, briefs whose waves would move, briefs that run alone, and pairs it could not decide. */\nexport function scheduleFindings(corpus: Corpus, s: Schedule): Finding[] {\n const findings: Finding[] = [];\n const cycle = configuredSeverity(corpus, 'dependency-cycle');\n if (cycle !== null) {\n for (const members of s.cycles) {\n const start = members[0] as Brief;\n findings.push({\n rule: 'dependency-cycle',\n severity: cycle,\n message: `dependencies form a cycle, so no wave can hold them: ${members.map(label).join(' -> ')}`,\n file: start.file,\n line: lineOfField(start, 'dependsOn') + 1,\n brief: start.id ?? undefined,\n hint: 'a cycle can never become ready; remove the dependency that is not real',\n });\n }\n }\n const change = configuredSeverity(corpus, 'wave-schedule');\n if (change !== null) {\n // A wave a person chose that lint and matrix accept is theirs to keep: a\n // note, so that CI passes it. One missing, or one that does not hold, is\n // the rule's finding at its configured severity.\n for (const p of moves(s)) {\n const valid = holds(p);\n const was =\n p.declared === null\n ? 'declares no wave'\n : valid\n ? `declares wave ${p.declared}, which holds`\n : `declares wave ${p.declared}, which does not hold (${breachReasons(p).join('; ')})`;\n findings.push({\n rule: 'wave-schedule',\n severity: valid ? 'note' : change,\n message: `${was}; the schedule puts it in wave ${p.proposed}: ${reasons(p).join('; ')}`,\n file: p.brief.file,\n line: lineOfField(p.brief, 'wave') + 1,\n brief: p.brief.id ?? undefined,\n hint: valid\n ? `keep wave ${p.declared as number}, or run \"spec-brief schedule --write\" for wave ${p.proposed}`\n : `run \"spec-brief schedule --write\", or set \"wave: ${p.proposed}\"`,\n });\n }\n }\n const unscoped = configuredSeverity(corpus, 'unscoped');\n if (unscoped !== null && s.placements.length > 1) {\n for (const p of s.placements.filter((x) => x.unscoped)) {\n findings.push(unscopedFinding(unscoped, p.brief, `the ${s.placements.length - 1} other brief(s) the schedule places; it runs alone in wave ${p.proposed}`));\n }\n }\n const undecided = configuredSeverity(corpus, 'collision-undecided');\n if (undecided !== null) {\n for (const p of s.placements) {\n for (const passed of p.passed) {\n if (passed.reason !== 'undecided') continue;\n const theirsFirst = passed.patterns.map(([own, theirs]) => [theirs, own] as const);\n findings.push(undecidedFinding(undecided, passed.brief, p.brief, theirsFirst, passed.wave));\n }\n }\n }\n return findings;\n}\n\nexport interface WavePlan {\n /** A write of each brief whose wave changes: its front matter's `wave`, and every other line as it was. */\n readonly ops: readonly FileOp[];\n /** Briefs whose wave cannot be written, which refuse the whole write. */\n readonly refused: readonly Finding[];\n}\n\n/** What `--write` writes. */\nexport function planWaves(s: Schedule): WavePlan {\n const ops: FileOp[] = [];\n const refused: Finding[] = [];\n for (const p of moves(s)) {\n const { brief } = p;\n if (brief.frontMatter !== null && !editable(brief.frontMatter)) {\n const open = brief.frontMatter.close < 0;\n refused.push({\n rule: 'front-matter',\n severity: 'error',\n message: `the front matter is ${open ? 'never closed' : 'TOML'}, so wave ${p.proposed} cannot be written into it`,\n file: brief.file,\n line: 1,\n brief: brief.id ?? undefined,\n hint: open ? 'close the front matter with a \"---\" line, and schedule again' : 'write the front matter as YAML between \"---\" lines, and schedule again',\n });\n continue;\n }\n const lines = setEntryKeepingComment(brief.lines, brief.frontMatter, 'wave', String(p.proposed));\n ops.push({ kind: 'write', path: brief.file, content: encodeLike(brief.source, lines), before: brief.source });\n }\n return { ops, refused };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../src/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAc,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAe,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrH,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,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cAAc;gBACpB,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,uBAAuB,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,CAAC,QAAQ,4BAA4B;gBACjH,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,KAAK,CAAC,EAAE,IAAI,SAAS;gBAC5B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,8DAA8D,CAAC,CAAC,CAAC,wEAAwE;aACvJ,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,sBAAsB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjG,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAChH,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * Waves, computed: which live briefs can run side by side, so that no two in\n * one wave can write the same file and every brief runs after the briefs it\n * depends on.\n *\n * Deciding what the rounds of a goal are is prose, and an agent's work. Given\n * the rounds, placing them is not: it is precedence-constrained colouring, and\n * a tool answers it the same way every time (ADR-0011). Briefs are taken in\n * dependency order, ties broken by id, and each goes into the lowest wave that\n * is after every live dependency's and holds nothing it collides with. A brief\n * with no scope cannot be proved apart from anything, so it shares its wave\n * with nobody. The greedy answer is not always the fewest waves - no fast\n * method promises that - but it is always a valid one, and the same one.\n *\n * Nothing is written here. `planWaves` says what `--write` would write, and\n * the engine writes it as the archive writes, as one transaction.\n */\n\nimport type { FileOp } from './archive.js';\nimport { type Brief, lineOfField } from './brief.js';\nimport { undecidedFinding, unscopedFinding } from './collisions.js';\nimport { byId, type Corpus, cycleSubject, dependencyCycles, liveDependencies, waitingOnDeferred } from './corpus.js';\nimport { editable, setEntryKeepingComment } from './frontmatter.js';\nimport { readingIn, WITNESS_BUDGET } from './glob.js';\nimport { configuredSeverity } from './lint.js';\nimport { meet, type Overlap, type Scope, scopeOf, witnessText } from './scope.js';\nimport { encodeLike } from './text.js';\nimport type { Finding } from './types.js';\n\nexport interface ScheduleOptions {\n /** The files the tree holds, which say whether a literal path is a file or a directory. */\n readonly repoFiles?: readonly string[] | null;\n /** How many states one witness search may visit before it answers `undecided`. */\n readonly budget?: number;\n}\n\n/** A wave a brief could not join, and the brief already there that kept it out. */\nexport type Passed =\n | { readonly wave: number; readonly reason: 'collision'; readonly brief: Brief; readonly overlaps: readonly Overlap[] }\n | { readonly wave: number; readonly reason: 'undecided'; readonly brief: Brief; readonly patterns: readonly (readonly [string, string])[] }\n /** One of the two declares no affectedFiles, and an unscoped brief runs alone. */\n | { readonly wave: number; readonly reason: 'unscoped'; readonly brief: Brief };\n\n/**\n * Why a declared wave does not hold: what `matrix` or `lint` would report as\n * an error if the brief ran there.\n */\nexport type Breach =\n /** A brief the matrix compares, declaring the same wave, whose scope meets this one's. Overlaps name this brief's pattern first. */\n | { readonly reason: 'collision'; readonly brief: Brief; readonly overlaps: readonly Overlap[] }\n /** A live dependency declaring the same wave or a later one. */\n | { readonly reason: 'dependency'; readonly brief: Brief; readonly wave: number }\n /** A live brief depending on this one, declaring the same wave or an earlier one. */\n | { readonly reason: 'dependent'; readonly brief: Brief; readonly wave: number };\n\nexport interface Placement {\n readonly brief: Brief;\n /** The wave its front matter declares; `null` when it declares none it can read. */\n readonly declared: number | null;\n readonly proposed: number;\n /** The live dependency in the latest wave, which sets the earliest wave this one may run in. */\n readonly after: { readonly brief: Brief; readonly wave: number } | null;\n /** Every wave from that earliest one that it could not join, in order. Overlaps and patterns name its own pattern first. */\n readonly passed: readonly Passed[];\n /** Declares no affectedFiles, so it shares its wave with nobody. */\n readonly unscoped: boolean;\n /**\n * Why the declared wave does not hold, when it is not the proposed one. Empty\n * when it holds - a person moved the brief, and `lint` and `matrix` accept\n * the wave - and when there is no declared wave to judge.\n */\n readonly breaches: readonly Breach[];\n}\n\n/** A live brief that can be placed in no wave, and the dependency that holds it. */\nexport interface Unplaced {\n readonly brief: Brief;\n readonly waitsOn: Brief;\n /** The dependency is deferred, is in a dependency cycle, or is itself unplaced. */\n readonly because: 'deferred' | 'cycle' | 'unplaced';\n}\n\nexport interface Schedule {\n /** The first wave: the lowest any scheduled brief declares, or 1 when none declares one. */\n readonly first: number;\n /** In the order they were placed: dependency order, ties by id. */\n readonly placements: readonly Placement[];\n /** By id. */\n readonly unplaced: readonly Unplaced[];\n /** Dependency cycles among the scheduled briefs, each as a path back to its start. */\n readonly cycles: readonly (readonly Brief[])[];\n /** Deferred briefs, which wait for their trigger and run in no wave. By id. */\n readonly deferred: readonly Brief[];\n}\n\nfunction label(brief: Brief): string {\n return brief.id ?? brief.name;\n}\n\nexport { byId } from './corpus.js';\n\n/** The first brief in a wave this one cannot share it with, or `null` when it can join. */\nfunction clash(own: Scope, wave: number, here: readonly Scope[], budget: number, files: readonly string[] | null): Passed | null {\n for (const other of here) {\n if (own.affected.length === 0 || other.affected.length === 0) return { wave, reason: 'unscoped', brief: other.brief };\n const meeting = meet(own, other, budget, files);\n if (meeting.overlaps.length > 0) return { wave, reason: 'collision', brief: other.brief, overlaps: meeting.overlaps };\n if (meeting.undecided.length > 0) return { wave, reason: 'undecided', brief: other.brief, patterns: meeting.undecided };\n }\n return null;\n}\n\n/** What a declared wave is judged against. */\ninterface Judge {\n /** The briefs the matrix compares: none deferred, none waiting on deferred work. */\n readonly compared: readonly Brief[];\n /** Every live brief's live dependencies, and the live briefs that depend on each, by id. */\n readonly dependencies: ReadonlyMap<Brief, readonly Brief[]>;\n readonly dependents: ReadonlyMap<Brief, readonly Brief[]>;\n readonly scope: (b: Brief) => Scope;\n readonly budget: number;\n readonly files: readonly string[] | null;\n}\n\n/**\n * Why a brief's declared wave does not hold, judged as `lint` and `matrix`\n * judge it: against the waves the other briefs declare, not the ones proposed.\n * Collisions are with the briefs the matrix compares; the dependency order is\n * wave-order's, both ways, over every live brief.\n */\nfunction breachesOf(brief: Brief, wave: number, judge: Judge): Breach[] {\n const out: Breach[] = [];\n for (const dependency of judge.dependencies.get(brief) as Brief[]) {\n if (dependency.wave !== null && dependency.wave >= wave) out.push({ reason: 'dependency', brief: dependency, wave: dependency.wave });\n }\n for (const other of judge.dependents.get(brief) ?? []) {\n if (other.wave !== null && other.wave <= wave) out.push({ reason: 'dependent', brief: other, wave: other.wave });\n }\n for (const other of judge.compared) {\n if (other === brief || other.wave !== wave) continue;\n const overlaps = meet(judge.scope(brief), judge.scope(other), judge.budget, judge.files).overlaps;\n if (overlaps.length > 0) out.push({ reason: 'collision', brief: other, overlaps });\n }\n return out;\n}\n\nexport function schedule(corpus: Corpus, options: ScheduleOptions = {}): Schedule {\n const files = options.repoFiles ?? null;\n const reading = readingIn(files);\n const budget = options.budget ?? WITNESS_BUDGET;\n const deferred = corpus.live.filter((b) => b.status === 'deferred').sort(byId);\n const briefs = corpus.live.filter((b) => b.status !== 'deferred').sort(byId);\n const dependencies = new Map(briefs.map((b) => [b, liveDependencies(corpus, b)]));\n const declared = briefs.flatMap((b) => (b.wave === null ? [] : [b.wave]));\n const first = declared.length === 0 ? 1 : Math.min(...declared);\n const scopes = new Map<Brief, Scope>();\n const scope = (b: Brief): Scope => {\n const known = scopes.get(b) ?? scopeOf(b, reading);\n scopes.set(b, known);\n return known;\n };\n const waiting = new Set(waitingOnDeferred(corpus).map((w) => w.brief));\n // Deferred briefs too: lint's wave-order reads every live brief's wave.\n const everyDependency = new Map(corpus.live.map((b) => [b, liveDependencies(corpus, b)]));\n const dependents = new Map<Brief, Brief[]>();\n for (const b of [...corpus.live].sort(byId)) {\n for (const d of everyDependency.get(b) as Brief[]) dependents.set(d, [...(dependents.get(d) ?? []), b]);\n }\n const judge: Judge = { compared: briefs.filter((b) => !waiting.has(b)), dependencies: everyDependency, dependents, scope, budget, files };\n\n const waveOf = new Map<Brief, number>();\n const occupants = new Map<number, Scope[]>();\n const placements: Placement[] = [];\n const pending = [...briefs];\n // Kahn's order, taking the least id whose dependencies are all placed. A\n // brief waiting on a deferred one, or on a cycle, is never taken.\n for (;;) {\n const next = pending.find((b) => (dependencies.get(b) as Brief[]).every((d) => waveOf.has(d)));\n if (next === undefined) break;\n pending.splice(pending.indexOf(next), 1);\n let after: Placement['after'] = null;\n for (const dependency of dependencies.get(next) as Brief[]) {\n const wave = waveOf.get(dependency) as number;\n if (after === null || wave > after.wave) after = { brief: dependency, wave };\n }\n const own = scope(next);\n const passed: Passed[] = [];\n let wave = after === null ? first : after.wave + 1;\n // Ends by construction: a wave past every occupied one is empty, and an empty wave takes anyone.\n for (;;) {\n const found = clash(own, wave, occupants.get(wave) ?? [], budget, files);\n if (found === null) break;\n passed.push(found);\n wave += 1;\n }\n waveOf.set(next, wave);\n occupants.set(wave, [...(occupants.get(wave) ?? []), own]);\n const breaches = next.wave === null || next.wave === wave ? [] : breachesOf(next, next.wave, judge);\n placements.push({ brief: next, declared: next.wave, proposed: wave, after, passed, unscoped: own.affected.length === 0, breaches });\n }\n\n const cycles = dependencyCycles(corpus).filter((cycle) => cycle.every((b) => b.status !== 'deferred'));\n const inCycle = new Set(cycles.flat());\n const unplaced = pending.map((brief): Unplaced => {\n const waitsOn = (dependencies.get(brief) as Brief[]).find((d) => !waveOf.has(d)) as Brief;\n const because = waitsOn.status === 'deferred' ? 'deferred' : inCycle.has(waitsOn) ? 'cycle' : 'unplaced';\n return { brief, waitsOn, because };\n });\n return { first, placements, unplaced, cycles, deferred };\n}\n\n/** The briefs whose declared wave the schedule would change. */\nexport function moves(s: Schedule): Placement[] {\n return s.placements.filter((p) => p.proposed !== p.declared);\n}\n\n/**\n * Whether a brief's declared wave holds: it is the proposed one, or one a\n * person chose that `lint` and `matrix` accept. The schedule is one valid\n * answer, not the only one (ADR-0011, amended).\n */\nexport function holds(p: Placement): boolean {\n return p.declared !== null && p.breaches.length === 0;\n}\n\n/** Why a declared wave does not hold, a clause each. */\nexport function breachReasons(p: Placement): string[] {\n return p.breaches.map((b) => {\n if (b.reason === 'collision') return `${label(b.brief)} there also writes ${witnessText(b.overlaps[0] as Overlap)}`;\n if (b.reason === 'dependency') return `it depends on ${label(b.brief)}, in wave ${b.wave}`;\n return `${label(b.brief)} depends on it, in wave ${b.wave}`;\n });\n}\n\n/** Why a brief is in its wave and not an earlier one, a clause each. */\nexport function reasons(p: Placement): string[] {\n const out: string[] = [];\n if (p.after !== null) out.push(`after ${label(p.after.brief)}, in wave ${p.after.wave}`);\n if (p.unscoped && p.passed.length > 0) out.push('it declares no affectedFiles, so it runs in a wave of its own');\n for (const passed of p.passed) {\n const there = `not wave ${passed.wave}, where ${label(passed.brief)}`;\n if (passed.reason === 'collision') {\n const [overlap] = passed.overlaps as [Overlap];\n out.push(`${there} also writes ${witnessText(overlap)} (\"${overlap.patterns[0]}\" and \"${overlap.patterns[1]}\")`);\n } else if (passed.reason === 'undecided') {\n out.push(`${there} may write the same files: the search could not decide within its budget`);\n } else if (!p.unscoped) {\n out.push(`${there} declares no affectedFiles and runs alone`);\n }\n }\n if (out.length === 0) out.push('nothing holds it later');\n return out;\n}\n\n/** The schedule as findings: cycles, briefs whose waves would move, briefs that run alone, and pairs it could not decide. */\nexport function scheduleFindings(corpus: Corpus, s: Schedule): Finding[] {\n const findings: Finding[] = [];\n const cycle = configuredSeverity(corpus, 'dependency-cycle');\n if (cycle !== null) {\n for (const members of s.cycles) {\n const start = members[0] as Brief;\n findings.push({\n rule: 'dependency-cycle',\n severity: cycle,\n message: `dependencies form a cycle, so no wave can hold them: ${members.map(label).join(' -> ')}`,\n file: start.file,\n line: lineOfField(start, 'dependsOn') + 1,\n brief: start.id ?? undefined,\n hint: 'a cycle can never become ready; remove the dependency that is not real',\n subject: cycleSubject(members),\n });\n }\n }\n const change = configuredSeverity(corpus, 'wave-schedule');\n if (change !== null) {\n // A wave a person chose that lint and matrix accept is theirs to keep: a\n // note, so that CI passes it. One missing, or one that does not hold, is\n // the rule's finding at its configured severity.\n for (const p of moves(s)) {\n const valid = holds(p);\n const was =\n p.declared === null\n ? 'declares no wave'\n : valid\n ? `declares wave ${p.declared}, which holds`\n : `declares wave ${p.declared}, which does not hold (${breachReasons(p).join('; ')})`;\n findings.push({\n rule: 'wave-schedule',\n severity: valid ? 'note' : change,\n message: `${was}; the schedule puts it in wave ${p.proposed}: ${reasons(p).join('; ')}`,\n file: p.brief.file,\n line: lineOfField(p.brief, 'wave') + 1,\n brief: p.brief.id ?? undefined,\n hint: valid\n ? `keep wave ${p.declared as number}, or run \"spec-brief schedule --write\" for wave ${p.proposed}`\n : `run \"spec-brief schedule --write\", or set \"wave: ${p.proposed}\"`,\n });\n }\n }\n const unscoped = configuredSeverity(corpus, 'unscoped');\n if (unscoped !== null && s.placements.length > 1) {\n for (const p of s.placements.filter((x) => x.unscoped)) {\n findings.push(unscopedFinding(unscoped, p.brief, `the ${s.placements.length - 1} other brief(s) the schedule places; it runs alone in wave ${p.proposed}`));\n }\n }\n const undecided = configuredSeverity(corpus, 'collision-undecided');\n if (undecided !== null) {\n for (const p of s.placements) {\n for (const passed of p.passed) {\n if (passed.reason !== 'undecided') continue;\n const theirsFirst = passed.patterns.map(([own, theirs]) => [theirs, own] as const);\n findings.push(undecidedFinding(undecided, passed.brief, p.brief, theirsFirst, passed.wave));\n }\n }\n }\n return findings;\n}\n\nexport interface WavePlan {\n /** A write of each brief whose wave changes: its front matter's `wave`, and every other line as it was. */\n readonly ops: readonly FileOp[];\n /** Briefs whose wave cannot be written, which refuse the whole write. */\n readonly refused: readonly Finding[];\n}\n\n/** What `--write` writes. */\nexport function planWaves(s: Schedule): WavePlan {\n const ops: FileOp[] = [];\n const refused: Finding[] = [];\n for (const p of moves(s)) {\n const { brief } = p;\n if (brief.frontMatter !== null && !editable(brief.frontMatter)) {\n const open = brief.frontMatter.close < 0;\n refused.push({\n rule: 'front-matter',\n severity: 'error',\n message: `the front matter is ${open ? 'never closed' : 'TOML'}, so wave ${p.proposed} cannot be written into it`,\n file: brief.file,\n line: 1,\n brief: brief.id ?? undefined,\n hint: open ? 'close the front matter with a \"---\" line, and schedule again' : 'write the front matter as YAML between \"---\" lines, and schedule again',\n });\n continue;\n }\n const lines = setEntryKeepingComment(brief.lines, brief.frontMatter, 'wave', String(p.proposed));\n ops.push({ kind: 'write', path: brief.file, content: encodeLike(brief.source, lines), before: brief.source });\n }\n return { ops, refused };\n}\n"]}
|
package/dist/schema.d.ts
CHANGED
|
@@ -35,7 +35,11 @@ export type Schema = (Described & {
|
|
|
35
35
|
});
|
|
36
36
|
/** The problems with `value`, each naming the path to it. Empty when it conforms. */
|
|
37
37
|
export declare function validate(schema: Schema, value: unknown, path?: string): string[];
|
|
38
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* The known key nearest to a misspelling, when one is near enough to be what
|
|
40
|
+
* was meant. One that keeps no character of the word is no misspelling of it,
|
|
41
|
+
* however short both are: `狀態` is two edits from `id`.
|
|
42
|
+
*/
|
|
39
43
|
export declare function closest(word: string, options: readonly string[]): string | undefined;
|
|
40
44
|
type Json = null | boolean | number | string | Json[] | {
|
|
41
45
|
[key: string]: Json;
|
package/dist/schema.js
CHANGED
|
@@ -126,13 +126,17 @@ export function validate(schema, value, path = '') {
|
|
|
126
126
|
return [];
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* The known key nearest to a misspelling, when one is near enough to be what
|
|
131
|
+
* was meant. One that keeps no character of the word is no misspelling of it,
|
|
132
|
+
* however short both are: `狀態` is two edits from `id`.
|
|
133
|
+
*/
|
|
130
134
|
export function closest(word, options) {
|
|
131
135
|
let best;
|
|
132
136
|
let bestDistance = Math.max(2, Math.floor(word.length / 3)) + 1;
|
|
133
137
|
for (const option of options) {
|
|
134
138
|
const d = distance(word.toLowerCase(), option.toLowerCase());
|
|
135
|
-
if (d < bestDistance) {
|
|
139
|
+
if (d < bestDistance && d < Math.max(word.length, option.length)) {
|
|
136
140
|
best = option;
|
|
137
141
|
bestDistance = d;
|
|
138
142
|
}
|