@descent-vtt/spec-brief 0.3.0 → 0.4.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 +32 -0
- package/README.md +4 -4
- package/dist/config.js +1 -2
- package/dist/config.js.map +1 -1
- package/dist/report.js +1 -0
- package/dist/report.js.map +1 -1
- package/dist/rules.js +11 -2
- package/dist/rules.js.map +1 -1
- package/dist/trigger.d.ts +2 -1
- package/dist/trigger.js +5 -60
- package/dist/trigger.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,38 @@ release that can turn a run red. This is the family's policy, recorded in
|
|
|
11
11
|
releases up to 0.2.7 came before it, and several of their patches changed
|
|
12
12
|
what a run reports.
|
|
13
13
|
|
|
14
|
+
## 0.4.0
|
|
15
|
+
|
|
16
|
+
spec-brief reads English only again, and a placeholder is told from a word
|
|
17
|
+
that begins with one: `TBD!` is a placeholder, `TODO.md` and `TODO-driven`
|
|
18
|
+
are not.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- A placeholder ended by `!`, `?`, `;` or an ellipsis is read as one
|
|
23
|
+
ended by a period is: `TBD!` and `TBD?` are a `placeholder`. A trigger
|
|
24
|
+
that is only a placeholder and a stop, `TBD.`, is refused by
|
|
25
|
+
`deferral-trigger` as a placeholder, where it passed as an event
|
|
26
|
+
(ADR-0003). Upgrading: fill the section, or name the event that brings the
|
|
27
|
+
work back.
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
|
|
31
|
+
- spec-brief reads English only (ADR-0003). A deferral trigger that names
|
|
32
|
+
only a time in Chinese (`下個月`, `2026年10月`, full-width `Q3`) passes
|
|
33
|
+
as an event again, the default `placeholders` lose `待定`, `未定`,
|
|
34
|
+
`待補`, `待確認` and their Simplified forms, and a full-width colon after
|
|
35
|
+
a placeholder no longer ends it. Upgrading: write the trigger in English,
|
|
36
|
+
e.g. `trigger: when the second tenant signs`, and list any Chinese
|
|
37
|
+
placeholder the repository uses under `placeholders`.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- A section whose line opens with a placeholder and a dot that goes on into
|
|
42
|
+
a word, `TODO.md lists the open work.`, is no longer a `placeholder`.
|
|
43
|
+
- Nor is one whose placeholder runs into a word by a hyphen, such as
|
|
44
|
+
`TODO-driven work is out.`; `TBD -` and `TBD - later` still are.
|
|
45
|
+
|
|
14
46
|
## 0.3.0
|
|
15
47
|
|
|
16
48
|
Deferral triggers and placeholders written in Chinese are read, the GitLab
|
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Every privilege change issues a new session token and invalidates the old one.
|
|
|
50
50
|
- [ ] a rotated token is rejected by every endpoint
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Work put off for later is a brief too, with `status: deferred` and a `trigger` naming the event that brings it back - "when the second tenant signs", "when p95 exceeds 200 ms",
|
|
53
|
+
Work put off for later is a brief too, with `status: deferred` and a `trigger` naming the event that brings it back - "when the second tenant signs", "when p95 exceeds 200 ms", never a date: not `Q3`, not `2026-10`. A deferred brief stays in the briefs directory, is never ready, and runs in no wave until someone sets it `active`.
|
|
54
54
|
|
|
55
55
|
- The id comes from the file name (`012_rotate-session-tokens.md`) or from an `id` field.
|
|
56
56
|
- `affectedFiles` is the scope the round may write.
|
|
@@ -269,7 +269,7 @@ A run over a briefs directory that does not exist exits 2, because a check over
|
|
|
269
269
|
| `sections` | Intent, Negative Scope, Not Empowered (optional), Invariants (checklist) | Sections every live brief carries: a name, or `{ name, aliases, mustContain, checklist, optional, hint }`. `hint` is below. |
|
|
270
270
|
| `sectionOrder` | `false` | Sections must appear in the listed order. |
|
|
271
271
|
| `types` | `feature`, `defect`, `refactor`, `chore` | Brief types and the sections each adds. |
|
|
272
|
-
| `placeholders` | `TBD`, `TODO`, `FIXME`,
|
|
272
|
+
| `placeholders` | `TBD`, `TODO`, `FIXME`, ... | Words that mark a section as unwritten: alone or ended by `.`, `!`, `?`, `;`, `…` or `-`, and then nothing, or a space, a colon or an em dash and a note. `TODO.md` and `TODO-driven` are words, not placeholders. |
|
|
273
273
|
| `fields` | `[]` | Front-matter keys the repository uses beyond the built-in ones. |
|
|
274
274
|
| `archiving.tasks` | `"all"` | `"all"`, or the sections whose boxes must be closed. |
|
|
275
275
|
| `archiving.dispositions` | `**Delegated`, `**Accepted debt`, `**Rejected` | What a note under an open box starts with to close it. |
|
|
@@ -330,14 +330,14 @@ How a heading fills a section, and what counts as a heading, a task or a link, i
|
|
|
330
330
|
| `missing-section` | error | A required section that is absent. |
|
|
331
331
|
| `duplicate-section` | warning | A section that appears twice. |
|
|
332
332
|
| `empty-section` | error | A section with no content; a comment is not content. A warning in a draft. |
|
|
333
|
-
| `placeholder` | error | A section holding only `TBD`, `TODO
|
|
333
|
+
| `placeholder` | error | A section holding only `TBD`, `TODO` or an empty box. A warning in a draft. |
|
|
334
334
|
| `missing-checklist` | error | A checklist section with no task item. A warning in a draft. |
|
|
335
335
|
| `must-contain` | error | A section without the text the configuration requires of it. |
|
|
336
336
|
| `section-order` | error | Sections out of the configured order, when one is configured. |
|
|
337
337
|
| `dependency` | error | A dependency on itself, or on a brief that does not exist. |
|
|
338
338
|
| `dependency-cycle` | error | Live briefs that depend on each other in a cycle, reported once, as a path. |
|
|
339
339
|
| `wave-order` | error | A live dependency that does not run in an earlier wave. |
|
|
340
|
-
| `deferral-trigger` | error | A deferred brief with no `trigger`, or one that is only a date or a time - `2026-10`, `Q3`, `next month`, `October
|
|
340
|
+
| `deferral-trigger` | error | A deferred brief with no `trigger`, or one that is only a date or a time - `2026-10`, `Q3`, `next month`, `October` - or a placeholder, rather than an event such as "when the second tenant signs". The words for a time are English. |
|
|
341
341
|
| `glob` | error | A scope pattern spec-brief cannot read. |
|
|
342
342
|
| `scope-contradiction` | error | Patterns in `affectedFiles` that `protectedFiles` cover entirely, so nothing of them is writable - one finding per brief, naming each. A pattern the search cannot decide is a warning. |
|
|
343
343
|
| `glob-matches-nothing` | note | A scope pattern that matches no file git sees, tracked or untracked - expected when the round creates it. |
|
package/dist/config.js
CHANGED
|
@@ -183,8 +183,7 @@ export const DEFAULT_CONFIG = {
|
|
|
183
183
|
refactor: [],
|
|
184
184
|
chore: [],
|
|
185
185
|
},
|
|
186
|
-
|
|
187
|
-
placeholders: ['TBD', 'TBA', 'TODO', 'FIXME', 'XXX', '???', '...', '\u2026', '待定', '未定', '待補', '待补', '待確認', '待确认'],
|
|
186
|
+
placeholders: ['TBD', 'TBA', 'TODO', 'FIXME', 'XXX', '???', '...', '\u2026'],
|
|
188
187
|
fields: [],
|
|
189
188
|
archiving: {
|
|
190
189
|
tasks: 'all',
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAe,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAkEnD,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AAEvF,uCAAuC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,MAAM;IACN,SAAS;IACT,IAAI;IACJ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,IAAI;IACJ,OAAO;IACP,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,0EAA0E,CAAC;AAErG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,oDAAoD,CAAC;AAEhF,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T,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK;YACxB,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,YAAY;YACtC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM;YAC1B,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI;SACvB;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Configuration: what it may say, what it says when it says nothing, and how a\n * file becomes a `Config`.\n *\n * Every repository that already keeps briefs keeps them its own way - where\n * they live, what the sections are called, which word means \"done\" - so the\n * conventions are data here rather than code. The defaults describe a brief\n * with the four parts every round needs: an intent, a negative scope, what the\n * round is not empowered to touch, and the invariants that prove it is done.\n *\n * A configuration that does not load stops the run. A typo that silently\n * falls back to defaults produces a clean-looking report about the wrong\n * rules, which is worse than no report.\n */\n\nimport { dirname, join } from 'node:path';\n\nimport { parseGlob } from './glob.js';\nimport { normalisePath } from './links.js';\nimport { type Schema, toJsonSchema, validate } from './schema.js';\nimport { inWords, templateHoles } from './text.js';\nimport type { SeveritySetting } from './types.js';\n\nexport interface SectionRule {\n readonly name: string;\n readonly aliases: readonly string[];\n /** Literal text the section must contain, compared exactly. */\n readonly mustContain: readonly string[];\n /** The section must hold at least one task item. */\n readonly checklist: boolean;\n readonly optional: boolean;\n /**\n * What the section must answer. A new brief carries it as a comment under\n * the heading, a finding that the section is missing or unwritten carries it\n * as its hint, and `list` and `lint` report it, so a tool that helps write a\n * brief can ask for each section without knowing its name in advance.\n */\n readonly hint?: string | undefined;\n}\n\nexport interface PluginReference {\n readonly module: string;\n readonly options: unknown;\n}\n\nexport interface Config {\n /** Directory of live briefs, relative to the root. */\n readonly briefs: string;\n /** Directory of archived briefs, relative to the root. */\n readonly archive: string;\n /** Glob a file name must match to be a brief. */\n readonly files: string;\n /** File-name globs that are never briefs, such as an index. */\n readonly exclude: readonly string[];\n /** A template for `new`, relative to the root; `null` builds one from `sections`. */\n readonly template: string | null;\n readonly id: {\n readonly source: 'filename' | 'frontmatter';\n readonly separator: string;\n readonly digits: number;\n };\n readonly status: {\n readonly field: string | null;\n readonly draft: string | null;\n readonly active: string;\n /** The word for work put off until an event its `trigger` names; `null` when a repository has none. */\n readonly deferred: string | null;\n readonly archived: string;\n };\n readonly sections: readonly SectionRule[];\n readonly sectionOrder: boolean;\n readonly types: Readonly<Record<string, readonly SectionRule[]>>;\n readonly placeholders: readonly string[];\n readonly fields: readonly string[];\n readonly archiving: {\n readonly tasks: 'all' | readonly string[];\n readonly dispositions: readonly string[];\n readonly banner: readonly string[];\n readonly rewriteLinks: boolean;\n readonly freeze: boolean;\n readonly base: string | null;\n };\n readonly rules: Readonly<Record<string, SeveritySetting>>;\n readonly plugins: readonly PluginReference[];\n}\n\nexport const CONFIG_FILES: readonly string[] = ['.spec-brief.json', 'spec-brief.json'];\n\n/** The holes a banner line may use. */\nexport const BANNER_PLACEHOLDERS: readonly string[] = [\n 'date',\n 'summary',\n 'pr',\n 'commit',\n 'diffstat',\n 'links',\n 'id',\n 'title',\n 'author',\n];\n\nexport const SCHEMA_URL = 'https://raw.githubusercontent.com/DescentVTT/spec-brief/main/schema.json';\n\n/**\n * The `$schema` `init` writes, the path the README recommends: the schema of\n * the version installed, which is the one that loads the file. `SCHEMA_URL`\n * follows main, and would flag a key the installed version accepts, or pass\n * one it refuses, as soon as the two differ.\n */\nexport const SCHEMA_PATH = './node_modules/@descent-vtt/spec-brief/schema.json';\n\nconst SEVERITY: Schema = { type: 'string', enum: ['off', 'note', 'warning', 'error'] };\nconst STRINGS: Schema = { type: 'array', items: { type: 'string', minLength: 1 } };\n\nconst SECTION: Schema = {\n type: 'anyOf',\n description: 'A section name, or a section with aliases and content rules.',\n options: [\n { type: 'string', minLength: 1 },\n {\n type: 'object',\n required: ['name'],\n properties: {\n name: { type: 'string', minLength: 1, description: 'The heading text, compared without case or punctuation.' },\n aliases: { ...STRINGS, description: 'Other headings that fill this section.' },\n mustContain: { ...STRINGS, description: 'Literal text the section must contain.' },\n checklist: { type: 'boolean', description: 'The section must hold at least one \"- [ ]\" task item.' },\n optional: { type: 'boolean', description: 'Checked when present, not required.' },\n hint: {\n type: 'string',\n minLength: 1,\n description: 'What the section must answer: a comment under the heading in a new brief, and the hint of a finding that it is missing or unwritten.',\n },\n },\n },\n ],\n};\n\nexport const CONFIG_SCHEMA: Schema = {\n type: 'object',\n properties: {\n $schema: { type: 'string' },\n briefs: { type: 'string', minLength: 1, description: 'Directory of live briefs, relative to this file.' },\n archive: { type: 'string', minLength: 1, description: 'Directory of archived briefs, relative to this file.' },\n files: { type: 'string', minLength: 1, description: 'Glob a file name must match to be a brief.' },\n exclude: { ...STRINGS, description: 'File-name globs that are never briefs.' },\n template: { type: 'string', nullable: true, description: 'Template file for \"new\"; null builds one from the sections.' },\n id: {\n type: 'object',\n properties: {\n source: { type: 'string', enum: ['filename', 'frontmatter'], description: 'Where a brief id comes from.' },\n separator: { type: 'string', minLength: 1, description: 'Separates the id from the slug in a file name.' },\n digits: { type: 'integer', minimum: 1, maximum: 12, description: 'Width of an allocated numeric id.' },\n },\n },\n status: {\n type: 'object',\n properties: {\n field: { type: 'string', nullable: true, description: 'Front-matter key holding the status; null uses location only.' },\n draft: { type: 'string', nullable: true, description: 'The word for a brief still being written, or null.' },\n active: { type: 'string', minLength: 1, description: 'The word for a live brief.' },\n deferred: {\n type: 'string',\n nullable: true,\n description: 'The word for a live brief put off until the event its \"trigger\" names, or null. A deferred brief is never ready and runs in no wave.',\n },\n archived: { type: 'string', minLength: 1, description: 'The word for an archived brief.' },\n },\n },\n sections: { type: 'array', items: SECTION, description: 'Sections every live brief carries.' },\n sectionOrder: { type: 'boolean', description: 'Sections must appear in the order listed.' },\n types: {\n type: 'map',\n description: 'Brief types, each with the sections it adds.',\n values: { type: 'object', properties: { sections: { type: 'array', items: SECTION } } },\n },\n placeholders: { ...STRINGS, description: 'Words that mark a section as unwritten.' },\n fields: { ...STRINGS, description: 'Front-matter keys this repository uses beyond the built-in ones.' },\n archiving: {\n type: 'object',\n properties: {\n tasks: {\n type: 'anyOf',\n description: '\"all\", or the sections whose task items must be closed before archiving.',\n options: [{ type: 'string', enum: ['all'] }, STRINGS],\n },\n dispositions: { ...STRINGS, description: 'Text under an open box that closes it without a tick.' },\n banner: {\n type: 'array',\n items: { type: 'string' },\n description: 'Lines of the frozen banner; a line with an empty {placeholder} is left out, and an empty line separates paragraphs.',\n },\n rewriteLinks: { type: 'boolean', description: 'Rewrite relative links so they resolve from the new directory.' },\n freeze: { type: 'boolean', description: 'Record a content hash so later edits are caught.' },\n base: { type: 'string', nullable: true, description: 'Branch the diff is measured from, such as \"main\".' },\n },\n },\n rules: { type: 'map', values: SEVERITY, description: 'Severity per rule id.' },\n plugins: {\n type: 'array',\n description: 'Modules that contribute rules.',\n items: {\n type: 'anyOf',\n options: [\n { type: 'string', minLength: 1 },\n {\n type: 'object',\n required: ['module'],\n properties: { module: { type: 'string', minLength: 1 }, options: { type: 'any' } },\n },\n ],\n },\n },\n },\n};\n\nfunction section(name: string, extra: Partial<Omit<SectionRule, 'name'>> = {}): SectionRule {\n return { name, aliases: [], mustContain: [], checklist: false, optional: false, ...extra };\n}\n\nexport const DEFAULT_CONFIG: Config = {\n briefs: 'briefs',\n archive: 'briefs/archive',\n files: '[0-9]*.md',\n exclude: [],\n template: null,\n id: { source: 'filename', separator: '_', digits: 3 },\n status: { field: 'status', draft: 'draft', active: 'active', deferred: 'deferred', archived: 'archived' },\n sections: [\n section('Intent', {\n aliases: [\"Commander's Intent\", 'Mission', 'Objective'],\n hint: 'The state of the tree when this round is done, and why it matters. One paragraph.',\n }),\n section('Negative Scope', {\n aliases: ['Out of Scope', 'Non-Goals', 'Not in Scope', 'What this round is NOT', 'What this brief does NOT do'],\n hint: 'What this round must not do, even where it would look helpful.',\n }),\n section('Not Empowered', {\n aliases: ['Non-Empowerment', 'Non-Empowerment List'],\n optional: true,\n hint: 'Files, interfaces and decisions this round may not change.',\n }),\n section('Invariants', {\n aliases: ['Invariant Checklist', 'Definition of Done'],\n checklist: true,\n hint: 'Checks that must hold before the round is called done, each one a task item.',\n }),\n ],\n sectionOrder: false,\n types: {\n feature: [section('Acceptance Criteria', { checklist: true, hint: 'What a reviewer checks to accept the result, each one a task item.' })],\n defect: [\n section('The Defect, Measured', {\n aliases: ['Reproduction'],\n hint: 'How to reproduce the defect, and the measurement that shows it.',\n }),\n ],\n refactor: [],\n chore: [],\n },\n // To be decided, undecided, to be filled in, to be confirmed: Traditional, then Simplified where it differs.\n placeholders: ['TBD', 'TBA', 'TODO', 'FIXME', 'XXX', '???', '...', '\\u2026', '待定', '未定', '待補', '待补', '待確認', '待确认'],\n fields: [],\n archiving: {\n tasks: 'all',\n dispositions: ['**Delegated', '**Accepted debt', '**Rejected'],\n banner: [\n '**Archived {date}.**',\n '{summary}',\n 'Merged in pull request {pr}.',\n 'Recorded at commit `{commit}`: {diffstat}.',\n '{links}',\n 'The body below describes the tree before execution and is not maintained.',\n ],\n rewriteLinks: true,\n freeze: true,\n base: null,\n },\n rules: {},\n plugins: [],\n};\n\ntype Raw = Record<string, unknown>;\n\nfunction sectionFrom(raw: unknown): SectionRule {\n if (typeof raw === 'string') return section(raw);\n const r = raw as Raw;\n return section(r['name'] as string, {\n aliases: (r['aliases'] as string[] | undefined) ?? [],\n mustContain: (r['mustContain'] as string[] | undefined) ?? [],\n checklist: (r['checklist'] as boolean | undefined) ?? false,\n optional: (r['optional'] as boolean | undefined) ?? false,\n hint: r['hint'] as string | undefined,\n });\n}\n\nfunction pluginFrom(raw: unknown): PluginReference {\n if (typeof raw === 'string') return { module: raw, options: undefined };\n const r = raw as Raw;\n return { module: r['module'] as string, options: r['options'] };\n}\n\nexport class ConfigError extends Error {\n readonly problems: readonly string[];\n\n constructor(file: string, problems: readonly string[]) {\n super(`${file}: ${problems.join('; ')}`);\n this.name = 'ConfigError';\n this.problems = problems;\n }\n}\n\n/**\n * Builds a configuration from parsed JSON. Objects merge one level deep over\n * the defaults; lists and `types` replace them, because a repository that\n * names its own sections means those sections and not the defaults as well.\n */\nexport function resolveConfig(raw: unknown, file = 'configuration'): Config {\n const problems = validate(CONFIG_SCHEMA, raw);\n if (problems.length > 0) throw new ConfigError(file, problems);\n const r = raw as Raw;\n const d = DEFAULT_CONFIG;\n const merged = <T extends object>(key: string, base: T): T => ({ ...base, ...((r[key] as Partial<T>) ?? {}) });\n const archiving = merged('archiving', d.archiving);\n const config: Config = {\n briefs: (r['briefs'] as string | undefined) ?? d.briefs,\n archive: (r['archive'] as string | undefined) ?? (r['briefs'] === undefined ? d.archive : `${r['briefs'] as string}/archive`),\n files: (r['files'] as string | undefined) ?? d.files,\n exclude: (r['exclude'] as string[] | undefined) ?? d.exclude,\n template: r['template'] === undefined ? d.template : (r['template'] as string | null),\n id: merged('id', d.id),\n status: merged('status', d.status),\n sections: r['sections'] === undefined ? d.sections : (r['sections'] as unknown[]).map(sectionFrom),\n sectionOrder: (r['sectionOrder'] as boolean | undefined) ?? d.sectionOrder,\n types:\n r['types'] === undefined\n ? d.types\n : Object.fromEntries(\n Object.entries(r['types'] as Record<string, Raw>).map(([name, type]) => [\n name,\n ((type['sections'] as unknown[] | undefined) ?? []).map(sectionFrom),\n ]),\n ),\n placeholders: (r['placeholders'] as string[] | undefined) ?? d.placeholders,\n fields: (r['fields'] as string[] | undefined) ?? d.fields,\n archiving,\n rules: { ...d.rules, ...((r['rules'] as Record<string, SeveritySetting> | undefined) ?? {}) },\n plugins: ((r['plugins'] as unknown[] | undefined) ?? []).map(pluginFrom),\n };\n const semantic = checkConfig(config);\n if (semantic.length > 0) throw new ConfigError(file, semantic);\n return config;\n}\n\n/** The status words a repository uses, in lifecycle order. */\nexport function statusWords(config: Config): string[] {\n const { draft, active, deferred, archived } = config.status;\n return [draft, active, deferred, archived].filter((w) => w !== null);\n}\n\n/** What the schema cannot say: relationships between values. */\nfunction checkConfig(config: Config): string[] {\n const problems: string[] = [];\n const inside = (key: string, path: string): string | null => {\n try {\n return normalisePath(path);\n } catch {\n problems.push(`\"${key}\" must be a directory inside the repository, not \"${path}\"`);\n return null;\n }\n };\n const briefs = inside('briefs', config.briefs);\n const archive = inside('archive', config.archive);\n if (briefs !== null && briefs === archive) problems.push('\"briefs\" and \"archive\" must be different directories');\n // Named by the statuses that share a word: a 0.1 configuration that spelt\n // another status \"deferred\" meets the default for the new one here.\n const sharing = new Map<string, { word: string; keys: string[] }>();\n for (const key of ['draft', 'active', 'deferred', 'archived'] as const) {\n const word = config.status[key];\n if (word === null) continue;\n const group = sharing.get(word.toLowerCase()) ?? { word, keys: [] };\n group.keys.push(key);\n sharing.set(word.toLowerCase(), group);\n }\n for (const { word, keys } of sharing.values()) {\n if (keys.length < 2) continue;\n const orNull = keys.includes('deferred') ? ', or set \"status.deferred\" to null where no work is deferred' : '';\n problems.push(`the status words must differ: \"${word}\" is the word for ${inWords(keys)}; give ${keys.length === 2 ? 'one of them' : 'all but one'} another word${orNull}`);\n }\n // A pattern that does not parse would match nothing, and a run over no briefs reads as clean.\n for (const [key, pattern] of [['files', config.files], ...config.exclude.map((e) => ['exclude', e] as const)] as const) {\n const parsed = parseGlob(pattern);\n if (!parsed.ok) problems.push(`\"${key}\" pattern \"${pattern}\": ${parsed.error}`);\n }\n // An unknown hole is never filled, and a line with an unfilled hole is left\n // out: a misspelt placeholder would silently drop its whole line.\n for (const line of config.archiving.banner) {\n for (const hole of templateHoles(line)) {\n if (!BANNER_PLACEHOLDERS.includes(hole)) {\n problems.push(`\"archiving.banner\" uses {${hole}}; the placeholders are ${BANNER_PLACEHOLDERS.map((p) => `{${p}}`).join(', ')}`);\n }\n }\n }\n return problems;\n}\n\n/** Parses the text of a configuration file. */\nexport function parseConfig(text: string, file: string): Config {\n let raw: unknown;\n try {\n raw = JSON.parse(text.charCodeAt(0) === 0xfeff ? text.slice(1) : text);\n } catch (error) {\n throw new ConfigError(file, [`is not valid JSON (${(error as Error).message})`]);\n }\n return resolveConfig(raw, file);\n}\n\n/**\n * The configuration file for a directory: the nearest one at or above it.\n * `exists` is injected so discovery needs no filesystem of its own.\n */\nexport async function locateConfig(\n start: string,\n exists: (path: string) => Promise<boolean>,\n): Promise<string | undefined> {\n let directory = start;\n // Bounded by the depth of the path: each pass moves one directory up.\n for (let depth = 0; depth < 256; depth += 1) {\n const found: string[] = [];\n for (const name of CONFIG_FILES) {\n const candidate = join(directory, name);\n if (await exists(candidate)) found.push(candidate);\n }\n if (found.length > 1) {\n throw new ConfigError(directory, [`holds both ${CONFIG_FILES.join(' and ')}; keep one`]);\n }\n if (found[0] !== undefined) return found[0];\n const parent = dirname(directory);\n if (parent === directory) return undefined;\n directory = parent;\n }\n /* v8 ignore next -- no path is 256 directories deep; the bound exists so the loop ends by construction. */\n return undefined;\n}\n\n/** The JSON Schema published as `schema.json`. */\nexport function configJsonSchema(): Record<string, unknown> {\n return {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n $id: SCHEMA_URL,\n title: 'spec-brief configuration',\n ...toJsonSchema(CONFIG_SCHEMA),\n };\n}\n\n/** The configuration `init` writes: every default spelled out, so it can be edited rather than looked up. */\nexport function initialConfig(briefs: string, archive: string): Record<string, unknown> {\n const d = DEFAULT_CONFIG;\n const sectionJson = (s: SectionRule): unknown => {\n const out: Record<string, unknown> = { name: s.name };\n if (s.aliases.length > 0) out['aliases'] = s.aliases;\n if (s.mustContain.length > 0) out['mustContain'] = s.mustContain;\n if (s.checklist) out['checklist'] = true;\n if (s.optional) out['optional'] = true;\n if (s.hint !== undefined) out['hint'] = s.hint;\n return Object.keys(out).length === 1 ? s.name : out;\n };\n return {\n $schema: SCHEMA_PATH,\n briefs,\n archive,\n files: d.files,\n id: d.id,\n status: d.status,\n sections: d.sections.map(sectionJson),\n types: Object.fromEntries(Object.entries(d.types).map(([k, v]) => [k, { sections: v.map(sectionJson) }])),\n archiving: {\n tasks: d.archiving.tasks,\n dispositions: d.archiving.dispositions,\n banner: d.archiving.banner,\n base: d.archiving.base,\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","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AAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IACtD,CAAC,CAAC;IACF,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,MAAM;QACN,OAAO;QACP,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;QACrC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;QACzG,SAAS,EAAE;YACT,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK;YACxB,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,YAAY;YACtC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM;YAC1B,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI;SACvB;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Configuration: what it may say, what it says when it says nothing, and how a\n * file becomes a `Config`.\n *\n * Every repository that already keeps briefs keeps them its own way - where\n * they live, what the sections are called, which word means \"done\" - so the\n * conventions are data here rather than code. The defaults describe a brief\n * with the four parts every round needs: an intent, a negative scope, what the\n * round is not empowered to touch, and the invariants that prove it is done.\n *\n * A configuration that does not load stops the run. A typo that silently\n * falls back to defaults produces a clean-looking report about the wrong\n * rules, which is worse than no report.\n */\n\nimport { dirname, join } from 'node:path';\n\nimport { parseGlob } from './glob.js';\nimport { normalisePath } from './links.js';\nimport { type Schema, toJsonSchema, validate } from './schema.js';\nimport { inWords, templateHoles } from './text.js';\nimport type { SeveritySetting } from './types.js';\n\nexport interface SectionRule {\n readonly name: string;\n readonly aliases: readonly string[];\n /** Literal text the section must contain, compared exactly. */\n readonly mustContain: readonly string[];\n /** The section must hold at least one task item. */\n readonly checklist: boolean;\n readonly optional: boolean;\n /**\n * What the section must answer. A new brief carries it as a comment under\n * the heading, a finding that the section is missing or unwritten carries it\n * as its hint, and `list` and `lint` report it, so a tool that helps write a\n * brief can ask for each section without knowing its name in advance.\n */\n readonly hint?: string | undefined;\n}\n\nexport interface PluginReference {\n readonly module: string;\n readonly options: unknown;\n}\n\nexport interface Config {\n /** Directory of live briefs, relative to the root. */\n readonly briefs: string;\n /** Directory of archived briefs, relative to the root. */\n readonly archive: string;\n /** Glob a file name must match to be a brief. */\n readonly files: string;\n /** File-name globs that are never briefs, such as an index. */\n readonly exclude: readonly string[];\n /** A template for `new`, relative to the root; `null` builds one from `sections`. */\n readonly template: string | null;\n readonly id: {\n readonly source: 'filename' | 'frontmatter';\n readonly separator: string;\n readonly digits: number;\n };\n readonly status: {\n readonly field: string | null;\n readonly draft: string | null;\n readonly active: string;\n /** The word for work put off until an event its `trigger` names; `null` when a repository has none. */\n readonly deferred: string | null;\n readonly archived: string;\n };\n readonly sections: readonly SectionRule[];\n readonly sectionOrder: boolean;\n readonly types: Readonly<Record<string, readonly SectionRule[]>>;\n readonly placeholders: readonly string[];\n readonly fields: readonly string[];\n readonly archiving: {\n readonly tasks: 'all' | readonly string[];\n readonly dispositions: readonly string[];\n readonly banner: readonly string[];\n readonly rewriteLinks: boolean;\n readonly freeze: boolean;\n readonly base: string | null;\n };\n readonly rules: Readonly<Record<string, SeveritySetting>>;\n readonly plugins: readonly PluginReference[];\n}\n\nexport const CONFIG_FILES: readonly string[] = ['.spec-brief.json', 'spec-brief.json'];\n\n/** The holes a banner line may use. */\nexport const BANNER_PLACEHOLDERS: readonly string[] = [\n 'date',\n 'summary',\n 'pr',\n 'commit',\n 'diffstat',\n 'links',\n 'id',\n 'title',\n 'author',\n];\n\nexport const SCHEMA_URL = 'https://raw.githubusercontent.com/DescentVTT/spec-brief/main/schema.json';\n\n/**\n * The `$schema` `init` writes, the path the README recommends: the schema of\n * the version installed, which is the one that loads the file. `SCHEMA_URL`\n * follows main, and would flag a key the installed version accepts, or pass\n * one it refuses, as soon as the two differ.\n */\nexport const SCHEMA_PATH = './node_modules/@descent-vtt/spec-brief/schema.json';\n\nconst SEVERITY: Schema = { type: 'string', enum: ['off', 'note', 'warning', 'error'] };\nconst STRINGS: Schema = { type: 'array', items: { type: 'string', minLength: 1 } };\n\nconst SECTION: Schema = {\n type: 'anyOf',\n description: 'A section name, or a section with aliases and content rules.',\n options: [\n { type: 'string', minLength: 1 },\n {\n type: 'object',\n required: ['name'],\n properties: {\n name: { type: 'string', minLength: 1, description: 'The heading text, compared without case or punctuation.' },\n aliases: { ...STRINGS, description: 'Other headings that fill this section.' },\n mustContain: { ...STRINGS, description: 'Literal text the section must contain.' },\n checklist: { type: 'boolean', description: 'The section must hold at least one \"- [ ]\" task item.' },\n optional: { type: 'boolean', description: 'Checked when present, not required.' },\n hint: {\n type: 'string',\n minLength: 1,\n description: 'What the section must answer: a comment under the heading in a new brief, and the hint of a finding that it is missing or unwritten.',\n },\n },\n },\n ],\n};\n\nexport const CONFIG_SCHEMA: Schema = {\n type: 'object',\n properties: {\n $schema: { type: 'string' },\n briefs: { type: 'string', minLength: 1, description: 'Directory of live briefs, relative to this file.' },\n archive: { type: 'string', minLength: 1, description: 'Directory of archived briefs, relative to this file.' },\n files: { type: 'string', minLength: 1, description: 'Glob a file name must match to be a brief.' },\n exclude: { ...STRINGS, description: 'File-name globs that are never briefs.' },\n template: { type: 'string', nullable: true, description: 'Template file for \"new\"; null builds one from the sections.' },\n id: {\n type: 'object',\n properties: {\n source: { type: 'string', enum: ['filename', 'frontmatter'], description: 'Where a brief id comes from.' },\n separator: { type: 'string', minLength: 1, description: 'Separates the id from the slug in a file name.' },\n digits: { type: 'integer', minimum: 1, maximum: 12, description: 'Width of an allocated numeric id.' },\n },\n },\n status: {\n type: 'object',\n properties: {\n field: { type: 'string', nullable: true, description: 'Front-matter key holding the status; null uses location only.' },\n draft: { type: 'string', nullable: true, description: 'The word for a brief still being written, or null.' },\n active: { type: 'string', minLength: 1, description: 'The word for a live brief.' },\n deferred: {\n type: 'string',\n nullable: true,\n description: 'The word for a live brief put off until the event its \"trigger\" names, or null. A deferred brief is never ready and runs in no wave.',\n },\n archived: { type: 'string', minLength: 1, description: 'The word for an archived brief.' },\n },\n },\n sections: { type: 'array', items: SECTION, description: 'Sections every live brief carries.' },\n sectionOrder: { type: 'boolean', description: 'Sections must appear in the order listed.' },\n types: {\n type: 'map',\n description: 'Brief types, each with the sections it adds.',\n values: { type: 'object', properties: { sections: { type: 'array', items: SECTION } } },\n },\n placeholders: { ...STRINGS, description: 'Words that mark a section as unwritten.' },\n fields: { ...STRINGS, description: 'Front-matter keys this repository uses beyond the built-in ones.' },\n archiving: {\n type: 'object',\n properties: {\n tasks: {\n type: 'anyOf',\n description: '\"all\", or the sections whose task items must be closed before archiving.',\n options: [{ type: 'string', enum: ['all'] }, STRINGS],\n },\n dispositions: { ...STRINGS, description: 'Text under an open box that closes it without a tick.' },\n banner: {\n type: 'array',\n items: { type: 'string' },\n description: 'Lines of the frozen banner; a line with an empty {placeholder} is left out, and an empty line separates paragraphs.',\n },\n rewriteLinks: { type: 'boolean', description: 'Rewrite relative links so they resolve from the new directory.' },\n freeze: { type: 'boolean', description: 'Record a content hash so later edits are caught.' },\n base: { type: 'string', nullable: true, description: 'Branch the diff is measured from, such as \"main\".' },\n },\n },\n rules: { type: 'map', values: SEVERITY, description: 'Severity per rule id.' },\n plugins: {\n type: 'array',\n description: 'Modules that contribute rules.',\n items: {\n type: 'anyOf',\n options: [\n { type: 'string', minLength: 1 },\n {\n type: 'object',\n required: ['module'],\n properties: { module: { type: 'string', minLength: 1 }, options: { type: 'any' } },\n },\n ],\n },\n },\n },\n};\n\nfunction section(name: string, extra: Partial<Omit<SectionRule, 'name'>> = {}): SectionRule {\n return { name, aliases: [], mustContain: [], checklist: false, optional: false, ...extra };\n}\n\nexport const DEFAULT_CONFIG: Config = {\n briefs: 'briefs',\n archive: 'briefs/archive',\n files: '[0-9]*.md',\n exclude: [],\n template: null,\n id: { source: 'filename', separator: '_', digits: 3 },\n status: { field: 'status', draft: 'draft', active: 'active', deferred: 'deferred', archived: 'archived' },\n sections: [\n section('Intent', {\n aliases: [\"Commander's Intent\", 'Mission', 'Objective'],\n hint: 'The state of the tree when this round is done, and why it matters. One paragraph.',\n }),\n section('Negative Scope', {\n aliases: ['Out of Scope', 'Non-Goals', 'Not in Scope', 'What this round is NOT', 'What this brief does NOT do'],\n hint: 'What this round must not do, even where it would look helpful.',\n }),\n section('Not Empowered', {\n aliases: ['Non-Empowerment', 'Non-Empowerment List'],\n optional: true,\n hint: 'Files, interfaces and decisions this round may not change.',\n }),\n section('Invariants', {\n aliases: ['Invariant Checklist', 'Definition of Done'],\n checklist: true,\n hint: 'Checks that must hold before the round is called done, each one a task item.',\n }),\n ],\n sectionOrder: false,\n types: {\n feature: [section('Acceptance Criteria', { checklist: true, hint: 'What a reviewer checks to accept the result, each one a task item.' })],\n defect: [\n section('The Defect, Measured', {\n aliases: ['Reproduction'],\n hint: 'How to reproduce the defect, and the measurement that shows it.',\n }),\n ],\n refactor: [],\n chore: [],\n },\n placeholders: ['TBD', 'TBA', 'TODO', 'FIXME', 'XXX', '???', '...', '\\u2026'],\n fields: [],\n archiving: {\n tasks: 'all',\n dispositions: ['**Delegated', '**Accepted debt', '**Rejected'],\n banner: [\n '**Archived {date}.**',\n '{summary}',\n 'Merged in pull request {pr}.',\n 'Recorded at commit `{commit}`: {diffstat}.',\n '{links}',\n 'The body below describes the tree before execution and is not maintained.',\n ],\n rewriteLinks: true,\n freeze: true,\n base: null,\n },\n rules: {},\n plugins: [],\n};\n\ntype Raw = Record<string, unknown>;\n\nfunction sectionFrom(raw: unknown): SectionRule {\n if (typeof raw === 'string') return section(raw);\n const r = raw as Raw;\n return section(r['name'] as string, {\n aliases: (r['aliases'] as string[] | undefined) ?? [],\n mustContain: (r['mustContain'] as string[] | undefined) ?? [],\n checklist: (r['checklist'] as boolean | undefined) ?? false,\n optional: (r['optional'] as boolean | undefined) ?? false,\n hint: r['hint'] as string | undefined,\n });\n}\n\nfunction pluginFrom(raw: unknown): PluginReference {\n if (typeof raw === 'string') return { module: raw, options: undefined };\n const r = raw as Raw;\n return { module: r['module'] as string, options: r['options'] };\n}\n\nexport class ConfigError extends Error {\n readonly problems: readonly string[];\n\n constructor(file: string, problems: readonly string[]) {\n super(`${file}: ${problems.join('; ')}`);\n this.name = 'ConfigError';\n this.problems = problems;\n }\n}\n\n/**\n * Builds a configuration from parsed JSON. Objects merge one level deep over\n * the defaults; lists and `types` replace them, because a repository that\n * names its own sections means those sections and not the defaults as well.\n */\nexport function resolveConfig(raw: unknown, file = 'configuration'): Config {\n const problems = validate(CONFIG_SCHEMA, raw);\n if (problems.length > 0) throw new ConfigError(file, problems);\n const r = raw as Raw;\n const d = DEFAULT_CONFIG;\n const merged = <T extends object>(key: string, base: T): T => ({ ...base, ...((r[key] as Partial<T>) ?? {}) });\n const archiving = merged('archiving', d.archiving);\n const config: Config = {\n briefs: (r['briefs'] as string | undefined) ?? d.briefs,\n archive: (r['archive'] as string | undefined) ?? (r['briefs'] === undefined ? d.archive : `${r['briefs'] as string}/archive`),\n files: (r['files'] as string | undefined) ?? d.files,\n exclude: (r['exclude'] as string[] | undefined) ?? d.exclude,\n template: r['template'] === undefined ? d.template : (r['template'] as string | null),\n id: merged('id', d.id),\n status: merged('status', d.status),\n sections: r['sections'] === undefined ? d.sections : (r['sections'] as unknown[]).map(sectionFrom),\n sectionOrder: (r['sectionOrder'] as boolean | undefined) ?? d.sectionOrder,\n types:\n r['types'] === undefined\n ? d.types\n : Object.fromEntries(\n Object.entries(r['types'] as Record<string, Raw>).map(([name, type]) => [\n name,\n ((type['sections'] as unknown[] | undefined) ?? []).map(sectionFrom),\n ]),\n ),\n placeholders: (r['placeholders'] as string[] | undefined) ?? d.placeholders,\n fields: (r['fields'] as string[] | undefined) ?? d.fields,\n archiving,\n rules: { ...d.rules, ...((r['rules'] as Record<string, SeveritySetting> | undefined) ?? {}) },\n plugins: ((r['plugins'] as unknown[] | undefined) ?? []).map(pluginFrom),\n };\n const semantic = checkConfig(config);\n if (semantic.length > 0) throw new ConfigError(file, semantic);\n return config;\n}\n\n/** The status words a repository uses, in lifecycle order. */\nexport function statusWords(config: Config): string[] {\n const { draft, active, deferred, archived } = config.status;\n return [draft, active, deferred, archived].filter((w) => w !== null);\n}\n\n/** What the schema cannot say: relationships between values. */\nfunction checkConfig(config: Config): string[] {\n const problems: string[] = [];\n const inside = (key: string, path: string): string | null => {\n try {\n return normalisePath(path);\n } catch {\n problems.push(`\"${key}\" must be a directory inside the repository, not \"${path}\"`);\n return null;\n }\n };\n const briefs = inside('briefs', config.briefs);\n const archive = inside('archive', config.archive);\n if (briefs !== null && briefs === archive) problems.push('\"briefs\" and \"archive\" must be different directories');\n // Named by the statuses that share a word: a 0.1 configuration that spelt\n // another status \"deferred\" meets the default for the new one here.\n const sharing = new Map<string, { word: string; keys: string[] }>();\n for (const key of ['draft', 'active', 'deferred', 'archived'] as const) {\n const word = config.status[key];\n if (word === null) continue;\n const group = sharing.get(word.toLowerCase()) ?? { word, keys: [] };\n group.keys.push(key);\n sharing.set(word.toLowerCase(), group);\n }\n for (const { word, keys } of sharing.values()) {\n if (keys.length < 2) continue;\n const orNull = keys.includes('deferred') ? ', or set \"status.deferred\" to null where no work is deferred' : '';\n problems.push(`the status words must differ: \"${word}\" is the word for ${inWords(keys)}; give ${keys.length === 2 ? 'one of them' : 'all but one'} another word${orNull}`);\n }\n // A pattern that does not parse would match nothing, and a run over no briefs reads as clean.\n for (const [key, pattern] of [['files', config.files], ...config.exclude.map((e) => ['exclude', e] as const)] as const) {\n const parsed = parseGlob(pattern);\n if (!parsed.ok) problems.push(`\"${key}\" pattern \"${pattern}\": ${parsed.error}`);\n }\n // An unknown hole is never filled, and a line with an unfilled hole is left\n // out: a misspelt placeholder would silently drop its whole line.\n for (const line of config.archiving.banner) {\n for (const hole of templateHoles(line)) {\n if (!BANNER_PLACEHOLDERS.includes(hole)) {\n problems.push(`\"archiving.banner\" uses {${hole}}; the placeholders are ${BANNER_PLACEHOLDERS.map((p) => `{${p}}`).join(', ')}`);\n }\n }\n }\n return problems;\n}\n\n/** Parses the text of a configuration file. */\nexport function parseConfig(text: string, file: string): Config {\n let raw: unknown;\n try {\n raw = JSON.parse(text.charCodeAt(0) === 0xfeff ? text.slice(1) : text);\n } catch (error) {\n throw new ConfigError(file, [`is not valid JSON (${(error as Error).message})`]);\n }\n return resolveConfig(raw, file);\n}\n\n/**\n * The configuration file for a directory: the nearest one at or above it.\n * `exists` is injected so discovery needs no filesystem of its own.\n */\nexport async function locateConfig(\n start: string,\n exists: (path: string) => Promise<boolean>,\n): Promise<string | undefined> {\n let directory = start;\n // Bounded by the depth of the path: each pass moves one directory up.\n for (let depth = 0; depth < 256; depth += 1) {\n const found: string[] = [];\n for (const name of CONFIG_FILES) {\n const candidate = join(directory, name);\n if (await exists(candidate)) found.push(candidate);\n }\n if (found.length > 1) {\n throw new ConfigError(directory, [`holds both ${CONFIG_FILES.join(' and ')}; keep one`]);\n }\n if (found[0] !== undefined) return found[0];\n const parent = dirname(directory);\n if (parent === directory) return undefined;\n directory = parent;\n }\n /* v8 ignore next -- no path is 256 directories deep; the bound exists so the loop ends by construction. */\n return undefined;\n}\n\n/** The JSON Schema published as `schema.json`. */\nexport function configJsonSchema(): Record<string, unknown> {\n return {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n $id: SCHEMA_URL,\n title: 'spec-brief configuration',\n ...toJsonSchema(CONFIG_SCHEMA),\n };\n}\n\n/** The configuration `init` writes: every default spelled out, so it can be edited rather than looked up. */\nexport function initialConfig(briefs: string, archive: string): Record<string, unknown> {\n const d = DEFAULT_CONFIG;\n const sectionJson = (s: SectionRule): unknown => {\n const out: Record<string, unknown> = { name: s.name };\n if (s.aliases.length > 0) out['aliases'] = s.aliases;\n if (s.mustContain.length > 0) out['mustContain'] = s.mustContain;\n if (s.checklist) out['checklist'] = true;\n if (s.optional) out['optional'] = true;\n if (s.hint !== undefined) out['hint'] = s.hint;\n return Object.keys(out).length === 1 ? s.name : out;\n };\n return {\n $schema: SCHEMA_PATH,\n briefs,\n archive,\n files: d.files,\n id: d.id,\n status: d.status,\n sections: d.sections.map(sectionJson),\n types: Object.fromEntries(Object.entries(d.types).map(([k, v]) => [k, { sections: v.map(sectionJson) }])),\n archiving: {\n tasks: d.archiving.tasks,\n dispositions: d.archiving.dispositions,\n banner: d.archiving.banner,\n base: d.archiving.base,\n },\n };\n}\n"]}
|
package/dist/report.js
CHANGED
|
@@ -270,6 +270,7 @@ function padStart(text, width) {
|
|
|
270
270
|
function table(header, rows) {
|
|
271
271
|
const all = [header, ...rows];
|
|
272
272
|
const widths = header.map((_, c) => Math.max(...all.map((r) => displayWidth(r[c]))));
|
|
273
|
+
// Padding the last cell would change nothing: trimEnd takes it off again.
|
|
273
274
|
return all.map((r) => r
|
|
274
275
|
.map((cell, c) => (c === r.length - 1 ? cell : padEnd(cell, widths[c])))
|
|
275
276
|
.join(' ')
|
package/dist/report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAe,aAAa,EAAE,KAAK,EAAE,KAAK,EAAe,OAAO,EAAi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UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACpE,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Rendering: findings, lists, the collision matrix and plans, for a person at\n * a terminal or for the machine reading the job.\n *\n * `json` is a document with a version, for orchestrators. `sarif` is SARIF\n * 2.1.0, for code-scanning upload. `github` is workflow commands, which put a\n * finding on the line of the pull request with no upload and no permission.\n * `gitlab` is a Code Quality report, the artifact a GitLab merge request reads,\n * so the family is not GitHub's alone.\n */\n\nimport { createHash } from 'node:crypto';\n\nimport type { Plan } from './archive.js';\nimport type { Brief } from './brief.js';\nimport type { Config, SectionRule } from './config.js';\nimport type { CollisionReport, Overlap } from './collisions.js';\nimport { idKey } from './corpus.js';\nimport { summarise } from './lint.js';\nimport { ARCHIVE_RULES, COLLISION_RULES, RULES } from './rules.js';\nimport { type Breach, breachReasons, holds, moves, type Passed, reasons, type Schedule } from './schedule.js';\nimport { witnessText } from './scope.js';\nimport { inWords } from './text.js';\nimport type { Finding, Severity } from './types.js';\nimport { displayWidth } from './vendor/spec-core/text/index.js';\n\nexport type Format = 'pretty' | 'json' | 'sarif' | 'github' | 'gitlab';\n\nexport const FORMATS: readonly Format[] = ['pretty', 'json', 'sarif', 'github', 'gitlab'];\n\n/**\n * The version of the JSON documents this tool prints, every command's alike.\n * Bumped when a field changes meaning. 2: a collision in `matrix` is a pair of\n * briefs, with every pair of patterns that meets and a witness that is always\n * a file; a shared-directory entry lists its directories; and deferred briefs,\n * and the briefs waiting on them, leave `waves[].briefs` for `deferred` and\n * `waiting`.\n */\nexport const JSON_SCHEMA_VERSION = 2;\n\nexport interface Style {\n readonly color: boolean;\n}\n\nconst CODES: Readonly<Record<string, readonly [number, number]>> = {\n red: [31, 39],\n yellow: [33, 39],\n cyan: [36, 39],\n green: [32, 39],\n dim: [2, 22],\n bold: [1, 22],\n};\n\nexport function paint(style: Style, color: keyof typeof CODES, text: string): string {\n const code = CODES[color];\n return style.color && code !== undefined ? `\\u001b[${code[0]}m${text}\\u001b[${code[1]}m` : text;\n}\n\nconst SEVERITY_COLOR: Readonly<Record<Severity, keyof typeof CODES>> = { error: 'red', warning: 'yellow', note: 'cyan' };\n\nfunction plural(count: number, word: string): string {\n return `${count} ${word}${count === 1 ? '' : 's'}`;\n}\n\nexport function summaryLine(findings: readonly Finding[]): string {\n const s = summarise(findings);\n return `${plural(s.errors, 'error')}, ${plural(s.warnings, 'warning')}, ${plural(s.notes, 'note')}`;\n}\n\nexport function prettyFindings(findings: readonly Finding[], style: Style): string {\n const out: string[] = [];\n let file: string | undefined;\n const width = Math.max(1, ...findings.map((f) => String(f.line).length));\n for (const f of findings) {\n if (f.file !== file) {\n if (file !== undefined) out.push('');\n out.push(paint(style, 'bold', f.file));\n file = f.file;\n }\n const severity = paint(style, SEVERITY_COLOR[f.severity], f.severity.padEnd(7));\n out.push(` ${String(f.line).padStart(width)} ${severity} ${f.message} ${paint(style, 'dim', f.rule)}`);\n if (f.hint !== undefined) out.push(` ${' '.repeat(width)} ${paint(style, 'dim', f.hint)}`);\n }\n return out.join('\\n');\n}\n\nexport function jsonDocument(command: string, version: string, body: Record<string, unknown>): string {\n return `${JSON.stringify({ tool: 'spec-brief', version, schemaVersion: JSON_SCHEMA_VERSION, command, ...body }, null, 2)}\\n`;\n}\n\nexport function findingJson(f: Finding): Record<string, unknown> {\n const out: Record<string, unknown> = { rule: f.rule, severity: f.severity, file: f.file, line: f.line, message: f.message };\n if (f.brief !== undefined) out['brief'] = f.brief;\n if (f.hint !== undefined) out['hint'] = f.hint;\n if (f.path !== undefined) out['path'] = f.path;\n if (f.paths !== undefined) out['paths'] = f.paths;\n return out;\n}\n\nconst SARIF_LEVEL: Readonly<Record<Severity, string>> = { error: 'error', warning: 'warning', note: 'note' };\n\nexport function sarif(findings: readonly Finding[], version: string): string {\n const described = new Map([...RULES, ...COLLISION_RULES, ...ARCHIVE_RULES].map((r) => [r.id, r]));\n const ids = [...new Set(findings.map((f) => f.rule))].sort();\n const document = {\n $schema: 'https://json.schemastore.org/sarif-2.1.0.json',\n version: '2.1.0',\n runs: [\n {\n tool: {\n driver: {\n name: 'spec-brief',\n version,\n informationUri: 'https://github.com/DescentVTT/spec-brief',\n rules: ids.map((id) => {\n const rule = described.get(id);\n return {\n id,\n shortDescription: { text: rule?.description ?? id },\n ...(rule !== undefined && rule.severity !== 'off'\n ? { defaultConfiguration: { level: SARIF_LEVEL[rule.severity] } }\n : {}),\n };\n }),\n },\n },\n results: findings.map((f) => ({\n ruleId: f.rule,\n level: SARIF_LEVEL[f.severity],\n message: { text: f.hint === undefined ? f.message : `${f.message}. ${f.hint}` },\n locations: [\n {\n physicalLocation: {\n artifactLocation: { uri: f.file, uriBaseId: '%SRCROOT%' },\n region: { startLine: f.line },\n },\n },\n ],\n })),\n },\n ],\n };\n return `${JSON.stringify(document, null, 2)}\\n`;\n}\n\n/**\n * GitLab's Code Quality severities, as the family maps them: an error is\n * `major`, a warning `minor`, a note `info`. An error fails the run but is not\n * a security hole or a crash, which is what `critical` and `blocker` say in\n * GitLab's own reports, so the scale tops out at `major`.\n */\nconst GITLAB_SEVERITY: Readonly<Record<Severity, string>> = { error: 'major', warning: 'minor', note: 'info' };\n\n/**\n * What a finding is, whatever it says: its rule, its file, its brief, and what\n * it is about there - a section, a pattern, the other brief of a pair, the one\n * path a refusal names. Never the message, the hint or the line.\n */\nfunction identity(f: Finding): readonly string[] {\n return [f.rule, f.file, f.brief ?? '', f.subject ?? f.path ?? ''];\n}\n\n/**\n * GitLab Code Quality: a JSON array of issues, which a merge request shows\n * beside the lines they are on. The fingerprint is how GitLab tells a new\n * issue from one it has seen, so it hashes the finding's identity and nothing\n * that changes while the problem stays: not the line, so a finding that moves\n * down a page is the same finding, and not the message, so rewording one, or\n * naming another file two colliding briefs both write, does not show as one\n * problem fixed and another found. Findings that share an identity - a front\n * matter with two problems - are told apart by their order, the second hashed\n * with a `2`, as spec-graph hashes them. The description carries the next\n * action as well as the message.\n */\nexport function gitlabCodeQuality(findings: readonly Finding[]): string {\n const seen = new Map<string, number>();\n const issues = findings.map((f) => {\n const key = JSON.stringify(identity(f));\n const occurrence = (seen.get(key) ?? 0) + 1;\n seen.set(key, occurrence);\n return {\n description: f.hint === undefined ? f.message : `${f.message}. ${f.hint}`,\n check_name: f.rule,\n fingerprint: createHash('sha256')\n .update(occurrence === 1 ? key : JSON.stringify([...identity(f), occurrence]))\n .digest('hex'),\n severity: GITLAB_SEVERITY[f.severity],\n location: { path: f.file, lines: { begin: f.line } },\n };\n });\n return `${JSON.stringify(issues, null, 2)}\\n`;\n}\n\nfunction escapeData(text: string): string {\n return text.replace(/%/g, '%25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A');\n}\n\nfunction escapeProperty(text: string): string {\n return escapeData(text).replace(/:/g, '%3A').replace(/,/g, '%2C');\n}\n\nconst GITHUB_COMMAND: Readonly<Record<Severity, string>> = { error: 'error', warning: 'warning', note: 'notice' };\n\nexport function githubCommands(findings: readonly Finding[]): string {\n return findings\n .map((f) => {\n const message = f.hint === undefined ? f.message : `${f.message}. ${f.hint}`;\n const properties = `file=${escapeProperty(f.file)},line=${f.line},title=${escapeProperty(`spec-brief ${f.rule}`)}`;\n return `::${GITHUB_COMMAND[f.severity]} ${properties}::${escapeData(message)}\\n`;\n })\n .join('');\n}\n\nexport function briefJson(brief: Brief, extra: Record<string, unknown> = {}): Record<string, unknown> {\n return {\n id: brief.id,\n file: brief.file,\n title: brief.title,\n phase: brief.phase,\n status: brief.status,\n type: brief.type,\n wave: brief.wave,\n dependsOn: brief.dependsOn,\n affectedFiles: brief.affectedFiles,\n protectedFiles: brief.protectedFiles,\n trigger: brief.trigger,\n tasks: { total: brief.tasks.length, checked: brief.tasks.filter((t) => t.checked).length },\n ...extra,\n };\n}\n\n/**\n * The sections the configuration asks for, each with what it must answer:\n * those every live brief carries, with `type` null, then those each type adds.\n * A tool that helps write a brief asks for these rather than for names it\n * knows in advance.\n */\nexport function sectionsJson(config: Config): Record<string, unknown>[] {\n const describe = (rule: SectionRule, type: string | null): Record<string, unknown> => ({\n name: rule.name,\n type,\n aliases: rule.aliases,\n optional: rule.optional,\n checklist: rule.checklist,\n mustContain: rule.mustContain,\n hint: rule.hint ?? null,\n });\n return [\n ...config.sections.map((rule) => describe(rule, null)),\n ...Object.entries(config.types).flatMap(([type, rules]) => rules.map((rule) => describe(rule, type))),\n ];\n}\n\n/**\n * What may stand between an id and the rest of a title: an em or an en dash,\n * a colon, ASCII or full-width, with or without spaces, or a hyphen with a\n * space on each side, so that `001-2 migration` keeps its id.\n */\nconst ID_SEPARATOR = /^(?:\\s*[\\u2014\\u2013:\\uff1a]|\\s+-(?=\\s))\\s*(?=\\S)/u;\n\n/**\n * A title as a table shows it, without the id it repeats: `new` writes\n * `# 012 — Rotate tokens`, and the table has an id column already. Only the\n * brief's own id comes off, compared as ids are, so that `12 - x` in brief\n * `012` loses it and `0010 — x` in brief `001` keeps it, and only before a\n * separator: `Fix - the login bug` and `2026:roadmap` are titles. For\n * display alone: `Brief.title`, and every JSON document, keep the title as\n * written.\n */\nexport function titleWithoutId(title: string, id: string | null): string {\n if (id === null) return title;\n const text = title.trimStart();\n // An id of digits is compared by value, so the title's own leading digits\n // are the candidate. A title with none has `''`, which no id's key equals;\n // any other text in its place fails `startsWith` and answers the same.\n const lead = /^\\d+$/.test(id) ? (/^\\d+/.exec(text)?.[0] ?? '') : id;\n if (!text.startsWith(lead) || idKey(lead) !== idKey(id)) return title;\n const separator = ID_SEPARATOR.exec(text.slice(lead.length));\n return separator === null ? title : text.slice(lead.length + separator[0].length);\n}\n\nfunction shownTitle(brief: Brief): string {\n return brief.title === null ? brief.name : titleWithoutId(brief.title, brief.id);\n}\n\n/**\n * A text padded to `width` columns of a terminal. `padEnd` counts UTF-16\n * units, and a Han character is one unit and two columns, so `已接受` padded\n * so fell three columns short. Every width here is the widest of the texts it\n * pads, so none is longer than its width.\n */\nfunction padEnd(text: string, width: number): string {\n return text + ' '.repeat(width - displayWidth(text));\n}\n\n/** A text padded on the left to `width` columns of a terminal, as {@link padEnd} pads on the right. */\nfunction padStart(text: string, width: number): string {\n return ' '.repeat(width - displayWidth(text)) + text;\n}\n\n/** Columns padded to their widest cell, in a terminal's columns; every row has the header's length. */\nfunction table(header: readonly string[], rows: readonly (readonly string[])[]): string[] {\n const all = [header, ...rows];\n const widths = header.map((_, c) => Math.max(...all.map((r) => displayWidth(r[c] as string))));\n return all.map((r) =>\n r\n .map((cell, c) => (c === r.length - 1 ? cell : padEnd(cell, widths[c] as number)))\n .join(' ')\n .trimEnd(),\n );\n}\n\nexport interface ListRow {\n readonly brief: Brief;\n readonly ready: boolean;\n readonly waitingOn: readonly string[];\n}\n\nexport function prettyList(rows: readonly ListRow[], style: Style): string {\n if (rows.length === 0) return 'no briefs';\n const lines = table(\n ['ID', 'STATUS', 'WAVE', 'TASKS', 'READY', 'TITLE'],\n rows.map(({ brief, ready, waitingOn }) => [\n brief.id ?? '?',\n brief.statusWord ?? brief.status ?? '?',\n brief.wave === null ? '-' : String(brief.wave),\n `${brief.tasks.filter((t) => t.checked).length}/${brief.tasks.length}`,\n brief.phase === 'archived' ? '-' : ready ? 'yes' : waitingOn.length > 0 ? `after ${waitingOn.join(', ')}` : 'no',\n shownTitle(brief),\n ]),\n );\n return [paint(style, 'dim', lines[0] as string), ...lines.slice(1)].join('\\n');\n}\n\nexport function prettyMatrix(report: CollisionReport, style: Style): string {\n const out: string[] = [];\n const label = (b: Brief): string => b.id ?? b.name;\n for (const wave of report.waves) {\n const title = wave.wave === null ? 'all live briefs' : `wave ${wave.wave}`;\n out.push(paint(style, 'bold', `${title} \\u00b7 ${plural(wave.briefs.length, 'brief')}`));\n const names = wave.briefs.map(label);\n const width = Math.max(3, ...names.map(displayWidth));\n const pairs = (list: readonly { readonly a: Brief; readonly b: Brief }[]): Set<string> =>\n new Set(list.flatMap((p) => [`${label(p.a)}\\u0000${label(p.b)}`, `${label(p.b)}\\u0000${label(p.a)}`]));\n const hits = pairs(wave.collisions);\n const unknown = pairs(wave.undecided);\n const near = pairs(wave.shared);\n out.push(` ${' '.repeat(width)} ${names.map((n) => padStart(n, width)).join(' ')}`);\n for (const row of names) {\n const cells = names.map((col) => {\n const key = `${row}\\u0000${col}`;\n const mark =\n row === col\n ? '\\u00b7'\n : hits.has(key)\n ? paint(style, 'red', 'X')\n : unknown.has(key)\n ? paint(style, 'yellow', '?')\n : near.has(key)\n ? paint(style, 'yellow', '~')\n : '\\u00b7';\n return `${' '.repeat(width - 1)}${mark}`;\n });\n out.push(` ${padEnd(row, width)} ${cells.join(' ')}`);\n }\n // One mark per pair of briefs; each further pair of patterns on a line beneath it.\n for (const c of wave.collisions) {\n c.overlaps.forEach((o, i) => {\n out.push(` ${i === 0 ? paint(style, 'red', 'X') : ' '} ${label(c.a)} \"${o.patterns[0]}\" and ${label(c.b)} \"${o.patterns[1]}\" both cover ${witnessText(o)}`);\n });\n }\n for (const u of wave.undecided) {\n u.patterns.forEach(([x, y], i) => {\n out.push(` ${i === 0 ? paint(style, 'yellow', '?') : ' '} ${label(u.a)} \"${x}\" and ${label(u.b)} \"${y}\": undecided within the search's budget`);\n });\n }\n for (const s of wave.shared) {\n out.push(` ${paint(style, 'yellow', '~')} ${label(s.a)} and ${label(s.b)} both write into ${inWords(s.directories.map((d) => `${d}/`))}`);\n }\n for (const b of wave.unscoped) {\n out.push(` ${paint(style, 'cyan', '?')} ${label(b)} declares no affectedFiles and cannot be checked`);\n }\n out.push('');\n }\n if (report.unscheduled.length > 0) {\n out.push(paint(style, 'dim', `no wave: ${report.unscheduled.map(label).join(', ')}`));\n }\n for (const w of report.waiting) {\n const why = w.waitsOn.status === 'deferred' ? 'which is deferred' : 'which waits on deferred work';\n out.push(`${paint(style, 'dim', 'waits:')} ${label(w.brief)} on ${label(w.waitsOn)}, ${why}`);\n }\n if (report.deferred.length > 0) {\n out.push(paint(style, 'dim', `deferred: ${report.deferred.map(label).join(', ')}`));\n }\n if (report.waves.length === 0 && report.unscheduled.length === 0 && report.deferred.length === 0) out.push('no live briefs');\n return out.join('\\n').trimEnd();\n}\n\n/**\n * A pair of patterns that meets, and the file named: `inTree` is `true` for a\n * file the tree holds, `false` for an example the search built, `null` when\n * the tree could not be read. Added to schema 2: a reader of it that does not\n * know the field reads the rest as before.\n */\nfunction overlapJson(o: Overlap): Record<string, unknown> {\n return { patterns: o.patterns, witness: o.witness, inTree: o.inTree };\n}\n\n/** The matrix as JSON: briefs by id, and a collision per pair of briefs. */\nexport function matrixJson(report: CollisionReport): Record<string, unknown> {\n return {\n waves: report.waves.map((w) => ({\n wave: w.wave,\n briefs: w.briefs.map((b) => b.id),\n collisions: w.collisions.map((c) => ({\n a: c.a.id,\n b: c.b.id,\n overlaps: c.overlaps.map(overlapJson),\n })),\n undecided: w.undecided.map((u) => ({ a: u.a.id, b: u.b.id, patterns: u.patterns })),\n sharedDirectories: w.shared.map((s) => ({ a: s.a.id, b: s.b.id, directories: s.directories })),\n unscoped: w.unscoped.map((b) => b.id),\n })),\n unscheduled: report.unscheduled.map((b) => b.id),\n deferred: report.deferred.map((b) => b.id),\n waiting: report.waiting.map((w) => ({ id: w.brief.id, file: w.brief.file, waitsOn: w.waitsOn.id })),\n };\n}\n\n/**\n * The waves a schedule uses, in order. They appear in order too: a brief goes\n * into a wave only when it is the first or the one before it is occupied.\n */\nfunction wavesOf(s: Schedule): number[] {\n return [...new Set(s.placements.map((p) => p.proposed))];\n}\n\n/**\n * The schedule for a person: each wave with its briefs, and under a brief whose\n * wave would change, why it goes where it goes. `written` is `null` when\n * nothing was asked to be written.\n */\nexport function prettySchedule(s: Schedule, written: readonly string[] | null, style: Style): string {\n const label = (b: Brief): string => b.id ?? b.name;\n const out: string[] = [];\n const width = Math.max(3, ...s.placements.map((p) => displayWidth(label(p.brief))));\n const titles = Math.max(0, ...s.placements.map((p) => displayWidth(shownTitle(p.brief))));\n const waves = wavesOf(s);\n for (const wave of waves) {\n const here = s.placements.filter((p) => p.proposed === wave);\n out.push(paint(style, 'bold', `wave ${wave} · ${plural(here.length, 'brief')}`));\n for (const p of here) {\n const title = shownTitle(p.brief);\n if (p.proposed === p.declared) {\n out.push(` ${padEnd(label(p.brief), width)} ${title}`);\n continue;\n }\n const from = p.declared === null ? 'no wave' : `wave ${p.declared}`;\n out.push(` ${padEnd(label(p.brief), width)} ${padEnd(title, titles)} ${paint(style, 'yellow', `moves from ${from}`)}`);\n // Why the declared wave holds or does not comes first: it decides whether the move is asked for.\n const verdict = p.declared === null ? [] : holds(p) ? [`wave ${p.declared} also holds`] : [`wave ${p.declared} does not hold: ${breachReasons(p).join('; ')}`];\n for (const reason of [...verdict, ...reasons(p)]) out.push(` ${' '.repeat(width)} ${paint(style, 'dim', reason)}`);\n }\n }\n if (waves.length > 0) out.push('');\n for (const cycle of s.cycles) out.push(`${paint(style, 'red', 'cycle:')} ${cycle.map(label).join(' -> ')}`);\n for (const u of s.unplaced) {\n const why = u.because === 'deferred' ? 'which is deferred' : u.because === 'cycle' ? 'which is in a cycle' : 'which is not placed';\n out.push(`${paint(style, 'dim', 'waits:')} ${label(u.brief)} on ${label(u.waitsOn)}, ${why}`);\n }\n if (s.deferred.length > 0) out.push(paint(style, 'dim', `deferred: ${s.deferred.map(label).join(', ')}`));\n const moving = moves(s).length;\n if (written !== null && written.length > 0) {\n out.push(`wrote the wave of ${plural(written.length, 'brief')}: ${written.join(', ')}`);\n } else if (written !== null && moving > 0) {\n out.push(paint(style, 'red', s.cycles.length > 0 ? 'nothing was written: the dependencies form a cycle' : 'nothing was written: a front matter cannot be edited'));\n } else if (moving > 0 && moves(s).every(holds)) {\n out.push(`${plural(moving, 'brief')} could move, and the declared waves hold; \"spec-brief schedule --write\" writes the computed ones`);\n } else if (moving > 0) {\n out.push(`${plural(moving, 'brief')} would move; \"spec-brief schedule --write\" writes the waves`);\n } else if (s.placements.length > 0) {\n out.push('the declared waves hold');\n } else if (s.cycles.length === 0 && s.deferred.length === 0) {\n // A brief is unplaced only behind a cycle or a deferral, so this is a corpus with no live brief.\n out.push('no live briefs');\n }\n return out.join('\\n');\n}\n\n/** The schedule as JSON: a row per placed brief with its declared and proposed wave and why. */\nexport function scheduleJson(s: Schedule): Record<string, unknown> {\n const breach = (b: Breach): Record<string, unknown> =>\n b.reason === 'collision'\n ? { reason: b.reason, brief: b.brief.id, overlaps: b.overlaps.map(overlapJson) }\n : { reason: b.reason, brief: b.brief.id, wave: b.wave };\n const passed = (p: Passed): Record<string, unknown> => {\n const base = { wave: p.wave, reason: p.reason, brief: p.brief.id };\n if (p.reason === 'collision') return { ...base, overlaps: p.overlaps.map(overlapJson) };\n if (p.reason === 'undecided') return { ...base, patterns: p.patterns };\n return base;\n };\n const waves = wavesOf(s);\n return {\n first: s.first,\n waves: waves.map((wave) => ({ wave, briefs: s.placements.filter((p) => p.proposed === wave).map((p) => p.brief.id) })),\n briefs: s.placements.map((p) => ({\n id: p.brief.id,\n file: p.brief.file,\n declared: p.declared,\n proposed: p.proposed,\n moves: p.proposed !== p.declared,\n holds: holds(p),\n breaches: p.breaches.map(breach),\n after: p.after === null ? null : { brief: p.after.brief.id, wave: p.after.wave },\n passed: p.passed.map(passed),\n unscoped: p.unscoped,\n reasons: reasons(p),\n })),\n unplaced: s.unplaced.map((u) => ({ id: u.brief.id, file: u.brief.file, waitsOn: u.waitsOn.id, because: u.because })),\n cycles: s.cycles.map((cycle) => cycle.map((b) => b.id)),\n deferred: s.deferred.map((b) => b.id),\n };\n}\n\nexport function prettyPlan(plan: Plan, dryRun: boolean, style: Style): string {\n const out: string[] = [];\n const verb = plan.action === 'archive' ? 'archive' : 'unarchive';\n if (plan.done) return `${plan.brief.file} is already ${plan.action === 'archive' ? 'archived' : 'live'}; nothing to do`;\n if (plan.blocking.length > 0) {\n out.push(paint(style, 'red', `cannot ${verb} ${plan.brief.file}:`), prettyFindings(plan.blocking, style));\n if (plan.warnings.length > 0) out.push('', prettyFindings(plan.warnings, style));\n return out.join('\\n');\n }\n out.push(`${dryRun ? 'would move' : 'moved'} ${plan.from} -> ${plan.to}`);\n if (plan.linksRewritten > 0) out.push(` ${plural(plan.linksRewritten, 'relative link')} rewritten`);\n for (const file of plan.inboundRewritten) out.push(` ${file}: links to it rewritten`);\n for (const f of plan.inboundFrozen) out.push(` ${f.file}:${f.line}: links to the old path, and is frozen, so it was left as it is`);\n if (plan.changes.length > 0) out.push(` the round changed ${plural(plan.changes.length, 'file')}`);\n if (plan.warnings.length > 0) out.push('', prettyFindings(plan.warnings, style));\n if (dryRun && plan.banner.length > 0) out.push('', paint(style, 'dim', 'banner:'), ...plan.banner.map((l) => ` ${l}`));\n if (!dryRun) out.push('', paint(style, 'dim', 'nothing was committed; review the change and commit it with the round'));\n return out.join('\\n');\n}\n\nexport function planJson(plan: Plan): Record<string, unknown> {\n return {\n action: plan.action,\n brief: plan.brief.id,\n from: plan.from,\n to: plan.to,\n done: plan.done,\n refused: plan.blocking.length > 0,\n blocking: plan.blocking.map(findingJson),\n warnings: plan.warnings.map(findingJson),\n linksRewritten: plan.linksRewritten,\n inboundRewritten: plan.inboundRewritten,\n inboundFrozen: plan.inboundFrozen,\n operations: plan.ops.map((op) => ({ kind: op.kind, path: op.path })),\n banner: plan.banner,\n changes: plan.changes,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,EAAE,MA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,CAAC,cAAc;QACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACpE,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Rendering: findings, lists, the collision matrix and plans, for a person at\n * a terminal or for the machine reading the job.\n *\n * `json` is a document with a version, for orchestrators. `sarif` is SARIF\n * 2.1.0, for code-scanning upload. `github` is workflow commands, which put a\n * finding on the line of the pull request with no upload and no permission.\n * `gitlab` is a Code Quality report, the artifact a GitLab merge request reads,\n * so the family is not GitHub's alone.\n */\n\nimport { createHash } from 'node:crypto';\n\nimport type { Plan } from './archive.js';\nimport type { Brief } from './brief.js';\nimport type { Config, SectionRule } from './config.js';\nimport type { CollisionReport, Overlap } from './collisions.js';\nimport { idKey } from './corpus.js';\nimport { summarise } from './lint.js';\nimport { ARCHIVE_RULES, COLLISION_RULES, RULES } from './rules.js';\nimport { type Breach, breachReasons, holds, moves, type Passed, reasons, type Schedule } from './schedule.js';\nimport { witnessText } from './scope.js';\nimport { inWords } from './text.js';\nimport type { Finding, Severity } from './types.js';\nimport { displayWidth } from './vendor/spec-core/text/index.js';\n\nexport type Format = 'pretty' | 'json' | 'sarif' | 'github' | 'gitlab';\n\nexport const FORMATS: readonly Format[] = ['pretty', 'json', 'sarif', 'github', 'gitlab'];\n\n/**\n * The version of the JSON documents this tool prints, every command's alike.\n * Bumped when a field changes meaning. 2: a collision in `matrix` is a pair of\n * briefs, with every pair of patterns that meets and a witness that is always\n * a file; a shared-directory entry lists its directories; and deferred briefs,\n * and the briefs waiting on them, leave `waves[].briefs` for `deferred` and\n * `waiting`.\n */\nexport const JSON_SCHEMA_VERSION = 2;\n\nexport interface Style {\n readonly color: boolean;\n}\n\nconst CODES: Readonly<Record<string, readonly [number, number]>> = {\n red: [31, 39],\n yellow: [33, 39],\n cyan: [36, 39],\n green: [32, 39],\n dim: [2, 22],\n bold: [1, 22],\n};\n\nexport function paint(style: Style, color: keyof typeof CODES, text: string): string {\n const code = CODES[color];\n return style.color && code !== undefined ? `\\u001b[${code[0]}m${text}\\u001b[${code[1]}m` : text;\n}\n\nconst SEVERITY_COLOR: Readonly<Record<Severity, keyof typeof CODES>> = { error: 'red', warning: 'yellow', note: 'cyan' };\n\nfunction plural(count: number, word: string): string {\n return `${count} ${word}${count === 1 ? '' : 's'}`;\n}\n\nexport function summaryLine(findings: readonly Finding[]): string {\n const s = summarise(findings);\n return `${plural(s.errors, 'error')}, ${plural(s.warnings, 'warning')}, ${plural(s.notes, 'note')}`;\n}\n\nexport function prettyFindings(findings: readonly Finding[], style: Style): string {\n const out: string[] = [];\n let file: string | undefined;\n const width = Math.max(1, ...findings.map((f) => String(f.line).length));\n for (const f of findings) {\n if (f.file !== file) {\n if (file !== undefined) out.push('');\n out.push(paint(style, 'bold', f.file));\n file = f.file;\n }\n const severity = paint(style, SEVERITY_COLOR[f.severity], f.severity.padEnd(7));\n out.push(` ${String(f.line).padStart(width)} ${severity} ${f.message} ${paint(style, 'dim', f.rule)}`);\n if (f.hint !== undefined) out.push(` ${' '.repeat(width)} ${paint(style, 'dim', f.hint)}`);\n }\n return out.join('\\n');\n}\n\nexport function jsonDocument(command: string, version: string, body: Record<string, unknown>): string {\n return `${JSON.stringify({ tool: 'spec-brief', version, schemaVersion: JSON_SCHEMA_VERSION, command, ...body }, null, 2)}\\n`;\n}\n\nexport function findingJson(f: Finding): Record<string, unknown> {\n const out: Record<string, unknown> = { rule: f.rule, severity: f.severity, file: f.file, line: f.line, message: f.message };\n if (f.brief !== undefined) out['brief'] = f.brief;\n if (f.hint !== undefined) out['hint'] = f.hint;\n if (f.path !== undefined) out['path'] = f.path;\n if (f.paths !== undefined) out['paths'] = f.paths;\n return out;\n}\n\nconst SARIF_LEVEL: Readonly<Record<Severity, string>> = { error: 'error', warning: 'warning', note: 'note' };\n\nexport function sarif(findings: readonly Finding[], version: string): string {\n const described = new Map([...RULES, ...COLLISION_RULES, ...ARCHIVE_RULES].map((r) => [r.id, r]));\n const ids = [...new Set(findings.map((f) => f.rule))].sort();\n const document = {\n $schema: 'https://json.schemastore.org/sarif-2.1.0.json',\n version: '2.1.0',\n runs: [\n {\n tool: {\n driver: {\n name: 'spec-brief',\n version,\n informationUri: 'https://github.com/DescentVTT/spec-brief',\n rules: ids.map((id) => {\n const rule = described.get(id);\n return {\n id,\n shortDescription: { text: rule?.description ?? id },\n ...(rule !== undefined && rule.severity !== 'off'\n ? { defaultConfiguration: { level: SARIF_LEVEL[rule.severity] } }\n : {}),\n };\n }),\n },\n },\n results: findings.map((f) => ({\n ruleId: f.rule,\n level: SARIF_LEVEL[f.severity],\n message: { text: f.hint === undefined ? f.message : `${f.message}. ${f.hint}` },\n locations: [\n {\n physicalLocation: {\n artifactLocation: { uri: f.file, uriBaseId: '%SRCROOT%' },\n region: { startLine: f.line },\n },\n },\n ],\n })),\n },\n ],\n };\n return `${JSON.stringify(document, null, 2)}\\n`;\n}\n\n/**\n * GitLab's Code Quality severities, as the family maps them: an error is\n * `major`, a warning `minor`, a note `info`. An error fails the run but is not\n * a security hole or a crash, which is what `critical` and `blocker` say in\n * GitLab's own reports, so the scale tops out at `major`.\n */\nconst GITLAB_SEVERITY: Readonly<Record<Severity, string>> = { error: 'major', warning: 'minor', note: 'info' };\n\n/**\n * What a finding is, whatever it says: its rule, its file, its brief, and what\n * it is about there - a section, a pattern, the other brief of a pair, the one\n * path a refusal names. Never the message, the hint or the line.\n */\nfunction identity(f: Finding): readonly string[] {\n return [f.rule, f.file, f.brief ?? '', f.subject ?? f.path ?? ''];\n}\n\n/**\n * GitLab Code Quality: a JSON array of issues, which a merge request shows\n * beside the lines they are on. The fingerprint is how GitLab tells a new\n * issue from one it has seen, so it hashes the finding's identity and nothing\n * that changes while the problem stays: not the line, so a finding that moves\n * down a page is the same finding, and not the message, so rewording one, or\n * naming another file two colliding briefs both write, does not show as one\n * problem fixed and another found. Findings that share an identity - a front\n * matter with two problems - are told apart by their order, the second hashed\n * with a `2`, as spec-graph hashes them. The description carries the next\n * action as well as the message.\n */\nexport function gitlabCodeQuality(findings: readonly Finding[]): string {\n const seen = new Map<string, number>();\n const issues = findings.map((f) => {\n const key = JSON.stringify(identity(f));\n const occurrence = (seen.get(key) ?? 0) + 1;\n seen.set(key, occurrence);\n return {\n description: f.hint === undefined ? f.message : `${f.message}. ${f.hint}`,\n check_name: f.rule,\n fingerprint: createHash('sha256')\n .update(occurrence === 1 ? key : JSON.stringify([...identity(f), occurrence]))\n .digest('hex'),\n severity: GITLAB_SEVERITY[f.severity],\n location: { path: f.file, lines: { begin: f.line } },\n };\n });\n return `${JSON.stringify(issues, null, 2)}\\n`;\n}\n\nfunction escapeData(text: string): string {\n return text.replace(/%/g, '%25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A');\n}\n\nfunction escapeProperty(text: string): string {\n return escapeData(text).replace(/:/g, '%3A').replace(/,/g, '%2C');\n}\n\nconst GITHUB_COMMAND: Readonly<Record<Severity, string>> = { error: 'error', warning: 'warning', note: 'notice' };\n\nexport function githubCommands(findings: readonly Finding[]): string {\n return findings\n .map((f) => {\n const message = f.hint === undefined ? f.message : `${f.message}. ${f.hint}`;\n const properties = `file=${escapeProperty(f.file)},line=${f.line},title=${escapeProperty(`spec-brief ${f.rule}`)}`;\n return `::${GITHUB_COMMAND[f.severity]} ${properties}::${escapeData(message)}\\n`;\n })\n .join('');\n}\n\nexport function briefJson(brief: Brief, extra: Record<string, unknown> = {}): Record<string, unknown> {\n return {\n id: brief.id,\n file: brief.file,\n title: brief.title,\n phase: brief.phase,\n status: brief.status,\n type: brief.type,\n wave: brief.wave,\n dependsOn: brief.dependsOn,\n affectedFiles: brief.affectedFiles,\n protectedFiles: brief.protectedFiles,\n trigger: brief.trigger,\n tasks: { total: brief.tasks.length, checked: brief.tasks.filter((t) => t.checked).length },\n ...extra,\n };\n}\n\n/**\n * The sections the configuration asks for, each with what it must answer:\n * those every live brief carries, with `type` null, then those each type adds.\n * A tool that helps write a brief asks for these rather than for names it\n * knows in advance.\n */\nexport function sectionsJson(config: Config): Record<string, unknown>[] {\n const describe = (rule: SectionRule, type: string | null): Record<string, unknown> => ({\n name: rule.name,\n type,\n aliases: rule.aliases,\n optional: rule.optional,\n checklist: rule.checklist,\n mustContain: rule.mustContain,\n hint: rule.hint ?? null,\n });\n return [\n ...config.sections.map((rule) => describe(rule, null)),\n ...Object.entries(config.types).flatMap(([type, rules]) => rules.map((rule) => describe(rule, type))),\n ];\n}\n\n/**\n * What may stand between an id and the rest of a title: an em or an en dash,\n * a colon, ASCII or full-width, with or without spaces, or a hyphen with a\n * space on each side, so that `001-2 migration` keeps its id.\n */\nconst ID_SEPARATOR = /^(?:\\s*[\\u2014\\u2013:\\uff1a]|\\s+-(?=\\s))\\s*(?=\\S)/u;\n\n/**\n * A title as a table shows it, without the id it repeats: `new` writes\n * `# 012 — Rotate tokens`, and the table has an id column already. Only the\n * brief's own id comes off, compared as ids are, so that `12 - x` in brief\n * `012` loses it and `0010 — x` in brief `001` keeps it, and only before a\n * separator: `Fix - the login bug` and `2026:roadmap` are titles. For\n * display alone: `Brief.title`, and every JSON document, keep the title as\n * written.\n */\nexport function titleWithoutId(title: string, id: string | null): string {\n if (id === null) return title;\n const text = title.trimStart();\n // An id of digits is compared by value, so the title's own leading digits\n // are the candidate. A title with none has `''`, which no id's key equals;\n // any other text in its place fails `startsWith` and answers the same.\n const lead = /^\\d+$/.test(id) ? (/^\\d+/.exec(text)?.[0] ?? '') : id;\n if (!text.startsWith(lead) || idKey(lead) !== idKey(id)) return title;\n const separator = ID_SEPARATOR.exec(text.slice(lead.length));\n return separator === null ? title : text.slice(lead.length + separator[0].length);\n}\n\nfunction shownTitle(brief: Brief): string {\n return brief.title === null ? brief.name : titleWithoutId(brief.title, brief.id);\n}\n\n/**\n * A text padded to `width` columns of a terminal. `padEnd` counts UTF-16\n * units, and a Han character is one unit and two columns, so `已接受` padded\n * so fell three columns short. Every width here is the widest of the texts it\n * pads, so none is longer than its width.\n */\nfunction padEnd(text: string, width: number): string {\n return text + ' '.repeat(width - displayWidth(text));\n}\n\n/** A text padded on the left to `width` columns of a terminal, as {@link padEnd} pads on the right. */\nfunction padStart(text: string, width: number): string {\n return ' '.repeat(width - displayWidth(text)) + text;\n}\n\n/** Columns padded to their widest cell, in a terminal's columns; every row has the header's length. */\nfunction table(header: readonly string[], rows: readonly (readonly string[])[]): string[] {\n const all = [header, ...rows];\n const widths = header.map((_, c) => Math.max(...all.map((r) => displayWidth(r[c] as string))));\n // Padding the last cell would change nothing: trimEnd takes it off again.\n return all.map((r) =>\n r\n .map((cell, c) => (c === r.length - 1 ? cell : padEnd(cell, widths[c] as number)))\n .join(' ')\n .trimEnd(),\n );\n}\n\nexport interface ListRow {\n readonly brief: Brief;\n readonly ready: boolean;\n readonly waitingOn: readonly string[];\n}\n\nexport function prettyList(rows: readonly ListRow[], style: Style): string {\n if (rows.length === 0) return 'no briefs';\n const lines = table(\n ['ID', 'STATUS', 'WAVE', 'TASKS', 'READY', 'TITLE'],\n rows.map(({ brief, ready, waitingOn }) => [\n brief.id ?? '?',\n brief.statusWord ?? brief.status ?? '?',\n brief.wave === null ? '-' : String(brief.wave),\n `${brief.tasks.filter((t) => t.checked).length}/${brief.tasks.length}`,\n brief.phase === 'archived' ? '-' : ready ? 'yes' : waitingOn.length > 0 ? `after ${waitingOn.join(', ')}` : 'no',\n shownTitle(brief),\n ]),\n );\n return [paint(style, 'dim', lines[0] as string), ...lines.slice(1)].join('\\n');\n}\n\nexport function prettyMatrix(report: CollisionReport, style: Style): string {\n const out: string[] = [];\n const label = (b: Brief): string => b.id ?? b.name;\n for (const wave of report.waves) {\n const title = wave.wave === null ? 'all live briefs' : `wave ${wave.wave}`;\n out.push(paint(style, 'bold', `${title} \\u00b7 ${plural(wave.briefs.length, 'brief')}`));\n const names = wave.briefs.map(label);\n const width = Math.max(3, ...names.map(displayWidth));\n const pairs = (list: readonly { readonly a: Brief; readonly b: Brief }[]): Set<string> =>\n new Set(list.flatMap((p) => [`${label(p.a)}\\u0000${label(p.b)}`, `${label(p.b)}\\u0000${label(p.a)}`]));\n const hits = pairs(wave.collisions);\n const unknown = pairs(wave.undecided);\n const near = pairs(wave.shared);\n out.push(` ${' '.repeat(width)} ${names.map((n) => padStart(n, width)).join(' ')}`);\n for (const row of names) {\n const cells = names.map((col) => {\n const key = `${row}\\u0000${col}`;\n const mark =\n row === col\n ? '\\u00b7'\n : hits.has(key)\n ? paint(style, 'red', 'X')\n : unknown.has(key)\n ? paint(style, 'yellow', '?')\n : near.has(key)\n ? paint(style, 'yellow', '~')\n : '\\u00b7';\n return `${' '.repeat(width - 1)}${mark}`;\n });\n out.push(` ${padEnd(row, width)} ${cells.join(' ')}`);\n }\n // One mark per pair of briefs; each further pair of patterns on a line beneath it.\n for (const c of wave.collisions) {\n c.overlaps.forEach((o, i) => {\n out.push(` ${i === 0 ? paint(style, 'red', 'X') : ' '} ${label(c.a)} \"${o.patterns[0]}\" and ${label(c.b)} \"${o.patterns[1]}\" both cover ${witnessText(o)}`);\n });\n }\n for (const u of wave.undecided) {\n u.patterns.forEach(([x, y], i) => {\n out.push(` ${i === 0 ? paint(style, 'yellow', '?') : ' '} ${label(u.a)} \"${x}\" and ${label(u.b)} \"${y}\": undecided within the search's budget`);\n });\n }\n for (const s of wave.shared) {\n out.push(` ${paint(style, 'yellow', '~')} ${label(s.a)} and ${label(s.b)} both write into ${inWords(s.directories.map((d) => `${d}/`))}`);\n }\n for (const b of wave.unscoped) {\n out.push(` ${paint(style, 'cyan', '?')} ${label(b)} declares no affectedFiles and cannot be checked`);\n }\n out.push('');\n }\n if (report.unscheduled.length > 0) {\n out.push(paint(style, 'dim', `no wave: ${report.unscheduled.map(label).join(', ')}`));\n }\n for (const w of report.waiting) {\n const why = w.waitsOn.status === 'deferred' ? 'which is deferred' : 'which waits on deferred work';\n out.push(`${paint(style, 'dim', 'waits:')} ${label(w.brief)} on ${label(w.waitsOn)}, ${why}`);\n }\n if (report.deferred.length > 0) {\n out.push(paint(style, 'dim', `deferred: ${report.deferred.map(label).join(', ')}`));\n }\n if (report.waves.length === 0 && report.unscheduled.length === 0 && report.deferred.length === 0) out.push('no live briefs');\n return out.join('\\n').trimEnd();\n}\n\n/**\n * A pair of patterns that meets, and the file named: `inTree` is `true` for a\n * file the tree holds, `false` for an example the search built, `null` when\n * the tree could not be read. Added to schema 2: a reader of it that does not\n * know the field reads the rest as before.\n */\nfunction overlapJson(o: Overlap): Record<string, unknown> {\n return { patterns: o.patterns, witness: o.witness, inTree: o.inTree };\n}\n\n/** The matrix as JSON: briefs by id, and a collision per pair of briefs. */\nexport function matrixJson(report: CollisionReport): Record<string, unknown> {\n return {\n waves: report.waves.map((w) => ({\n wave: w.wave,\n briefs: w.briefs.map((b) => b.id),\n collisions: w.collisions.map((c) => ({\n a: c.a.id,\n b: c.b.id,\n overlaps: c.overlaps.map(overlapJson),\n })),\n undecided: w.undecided.map((u) => ({ a: u.a.id, b: u.b.id, patterns: u.patterns })),\n sharedDirectories: w.shared.map((s) => ({ a: s.a.id, b: s.b.id, directories: s.directories })),\n unscoped: w.unscoped.map((b) => b.id),\n })),\n unscheduled: report.unscheduled.map((b) => b.id),\n deferred: report.deferred.map((b) => b.id),\n waiting: report.waiting.map((w) => ({ id: w.brief.id, file: w.brief.file, waitsOn: w.waitsOn.id })),\n };\n}\n\n/**\n * The waves a schedule uses, in order. They appear in order too: a brief goes\n * into a wave only when it is the first or the one before it is occupied.\n */\nfunction wavesOf(s: Schedule): number[] {\n return [...new Set(s.placements.map((p) => p.proposed))];\n}\n\n/**\n * The schedule for a person: each wave with its briefs, and under a brief whose\n * wave would change, why it goes where it goes. `written` is `null` when\n * nothing was asked to be written.\n */\nexport function prettySchedule(s: Schedule, written: readonly string[] | null, style: Style): string {\n const label = (b: Brief): string => b.id ?? b.name;\n const out: string[] = [];\n const width = Math.max(3, ...s.placements.map((p) => displayWidth(label(p.brief))));\n const titles = Math.max(0, ...s.placements.map((p) => displayWidth(shownTitle(p.brief))));\n const waves = wavesOf(s);\n for (const wave of waves) {\n const here = s.placements.filter((p) => p.proposed === wave);\n out.push(paint(style, 'bold', `wave ${wave} · ${plural(here.length, 'brief')}`));\n for (const p of here) {\n const title = shownTitle(p.brief);\n if (p.proposed === p.declared) {\n out.push(` ${padEnd(label(p.brief), width)} ${title}`);\n continue;\n }\n const from = p.declared === null ? 'no wave' : `wave ${p.declared}`;\n out.push(` ${padEnd(label(p.brief), width)} ${padEnd(title, titles)} ${paint(style, 'yellow', `moves from ${from}`)}`);\n // Why the declared wave holds or does not comes first: it decides whether the move is asked for.\n const verdict = p.declared === null ? [] : holds(p) ? [`wave ${p.declared} also holds`] : [`wave ${p.declared} does not hold: ${breachReasons(p).join('; ')}`];\n for (const reason of [...verdict, ...reasons(p)]) out.push(` ${' '.repeat(width)} ${paint(style, 'dim', reason)}`);\n }\n }\n if (waves.length > 0) out.push('');\n for (const cycle of s.cycles) out.push(`${paint(style, 'red', 'cycle:')} ${cycle.map(label).join(' -> ')}`);\n for (const u of s.unplaced) {\n const why = u.because === 'deferred' ? 'which is deferred' : u.because === 'cycle' ? 'which is in a cycle' : 'which is not placed';\n out.push(`${paint(style, 'dim', 'waits:')} ${label(u.brief)} on ${label(u.waitsOn)}, ${why}`);\n }\n if (s.deferred.length > 0) out.push(paint(style, 'dim', `deferred: ${s.deferred.map(label).join(', ')}`));\n const moving = moves(s).length;\n if (written !== null && written.length > 0) {\n out.push(`wrote the wave of ${plural(written.length, 'brief')}: ${written.join(', ')}`);\n } else if (written !== null && moving > 0) {\n out.push(paint(style, 'red', s.cycles.length > 0 ? 'nothing was written: the dependencies form a cycle' : 'nothing was written: a front matter cannot be edited'));\n } else if (moving > 0 && moves(s).every(holds)) {\n out.push(`${plural(moving, 'brief')} could move, and the declared waves hold; \"spec-brief schedule --write\" writes the computed ones`);\n } else if (moving > 0) {\n out.push(`${plural(moving, 'brief')} would move; \"spec-brief schedule --write\" writes the waves`);\n } else if (s.placements.length > 0) {\n out.push('the declared waves hold');\n } else if (s.cycles.length === 0 && s.deferred.length === 0) {\n // A brief is unplaced only behind a cycle or a deferral, so this is a corpus with no live brief.\n out.push('no live briefs');\n }\n return out.join('\\n');\n}\n\n/** The schedule as JSON: a row per placed brief with its declared and proposed wave and why. */\nexport function scheduleJson(s: Schedule): Record<string, unknown> {\n const breach = (b: Breach): Record<string, unknown> =>\n b.reason === 'collision'\n ? { reason: b.reason, brief: b.brief.id, overlaps: b.overlaps.map(overlapJson) }\n : { reason: b.reason, brief: b.brief.id, wave: b.wave };\n const passed = (p: Passed): Record<string, unknown> => {\n const base = { wave: p.wave, reason: p.reason, brief: p.brief.id };\n if (p.reason === 'collision') return { ...base, overlaps: p.overlaps.map(overlapJson) };\n if (p.reason === 'undecided') return { ...base, patterns: p.patterns };\n return base;\n };\n const waves = wavesOf(s);\n return {\n first: s.first,\n waves: waves.map((wave) => ({ wave, briefs: s.placements.filter((p) => p.proposed === wave).map((p) => p.brief.id) })),\n briefs: s.placements.map((p) => ({\n id: p.brief.id,\n file: p.brief.file,\n declared: p.declared,\n proposed: p.proposed,\n moves: p.proposed !== p.declared,\n holds: holds(p),\n breaches: p.breaches.map(breach),\n after: p.after === null ? null : { brief: p.after.brief.id, wave: p.after.wave },\n passed: p.passed.map(passed),\n unscoped: p.unscoped,\n reasons: reasons(p),\n })),\n unplaced: s.unplaced.map((u) => ({ id: u.brief.id, file: u.brief.file, waitsOn: u.waitsOn.id, because: u.because })),\n cycles: s.cycles.map((cycle) => cycle.map((b) => b.id)),\n deferred: s.deferred.map((b) => b.id),\n };\n}\n\nexport function prettyPlan(plan: Plan, dryRun: boolean, style: Style): string {\n const out: string[] = [];\n const verb = plan.action === 'archive' ? 'archive' : 'unarchive';\n if (plan.done) return `${plan.brief.file} is already ${plan.action === 'archive' ? 'archived' : 'live'}; nothing to do`;\n if (plan.blocking.length > 0) {\n out.push(paint(style, 'red', `cannot ${verb} ${plan.brief.file}:`), prettyFindings(plan.blocking, style));\n if (plan.warnings.length > 0) out.push('', prettyFindings(plan.warnings, style));\n return out.join('\\n');\n }\n out.push(`${dryRun ? 'would move' : 'moved'} ${plan.from} -> ${plan.to}`);\n if (plan.linksRewritten > 0) out.push(` ${plural(plan.linksRewritten, 'relative link')} rewritten`);\n for (const file of plan.inboundRewritten) out.push(` ${file}: links to it rewritten`);\n for (const f of plan.inboundFrozen) out.push(` ${f.file}:${f.line}: links to the old path, and is frozen, so it was left as it is`);\n if (plan.changes.length > 0) out.push(` the round changed ${plural(plan.changes.length, 'file')}`);\n if (plan.warnings.length > 0) out.push('', prettyFindings(plan.warnings, style));\n if (dryRun && plan.banner.length > 0) out.push('', paint(style, 'dim', 'banner:'), ...plan.banner.map((l) => ` ${l}`));\n if (!dryRun) out.push('', paint(style, 'dim', 'nothing was committed; review the change and commit it with the round'));\n return out.join('\\n');\n}\n\nexport function planJson(plan: Plan): Record<string, unknown> {\n return {\n action: plan.action,\n brief: plan.brief.id,\n from: plan.from,\n to: plan.to,\n done: plan.done,\n refused: plan.blocking.length > 0,\n blocking: plan.blocking.map(findingJson),\n warnings: plan.warnings.map(findingJson),\n linksRewritten: plan.linksRewritten,\n inboundRewritten: plan.inboundRewritten,\n inboundFrozen: plan.inboundFrozen,\n operations: plan.ops.map((op) => ({ kind: op.kind, path: op.path })),\n banner: plan.banner,\n changes: plan.changes,\n };\n}\n"]}
|
package/dist/rules.js
CHANGED
|
@@ -42,6 +42,10 @@ function contentLines(brief, section) {
|
|
|
42
42
|
}
|
|
43
43
|
return lines;
|
|
44
44
|
}
|
|
45
|
+
/** Whether `text` is the placeholder `word`, alone or with the stops that end a sentence: `TBD`, `TBD.`, `TBD?!`. */
|
|
46
|
+
function onlyPlaceholder(text, word) {
|
|
47
|
+
return text.startsWith(word) && /^[.!?;\u2026]*$/.test(text.slice(word.length));
|
|
48
|
+
}
|
|
45
49
|
function isPlaceholder(line, placeholders) {
|
|
46
50
|
const text = line
|
|
47
51
|
.replace(/^\s*(?:[-*+]|\d{1,9}[.)])\s+/, '')
|
|
@@ -53,7 +57,11 @@ function isPlaceholder(line, placeholders) {
|
|
|
53
57
|
const lower = text.toLowerCase();
|
|
54
58
|
return placeholders.some((p) => {
|
|
55
59
|
const word = p.toLowerCase();
|
|
56
|
-
|
|
60
|
+
// A space, a colon or an em dash, after a stop or not, introduces a note on
|
|
61
|
+
// the placeholder: `TBD: ask the vendor`, `TBD. Ask the vendor.`, `TBD - later`.
|
|
62
|
+
// A stop or a hyphen that goes on into a word, `TODO.md`, `TODO-driven`,
|
|
63
|
+
// is part of that word. An em dash joins no words, so none is made across it.
|
|
64
|
+
return lower.startsWith(word) && /^[.!?;\u2026\-]*(?:$|[\s:\u2014])/.test(lower.slice(word.length));
|
|
57
65
|
});
|
|
58
66
|
}
|
|
59
67
|
/** Completeness findings on a draft are reminders, not failures. */
|
|
@@ -478,7 +486,8 @@ export const RULES = [
|
|
|
478
486
|
}
|
|
479
487
|
const line = at(lineOfField(brief, 'trigger'));
|
|
480
488
|
const hint = `name what must happen before the work resumes, ${example}`;
|
|
481
|
-
|
|
489
|
+
// A note after a placeholder is the event itself: `TBD: when the vendor answers`.
|
|
490
|
+
if (config.placeholders.some((p) => onlyPlaceholder(trigger.toLowerCase(), p.toLowerCase()))) {
|
|
482
491
|
return [{ line, message: `the trigger "${trigger}" is a placeholder, not an event`, hint }];
|
|
483
492
|
}
|
|
484
493
|
if (!namesAnEvent(trigger)) {
|
package/dist/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;G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AAK,KAAK,CAAC,SAAS;gBAAE,OAAO,EAAE,CAAC;YAC3D,OAAO;gBACL;oBACE,IAAI,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"]}
|
|
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,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClH,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,E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AM,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\n/** Whether `text` is the placeholder `word`, alone or with the stops that end a sentence: `TBD`, `TBD.`, `TBD?!`. */\nfunction onlyPlaceholder(text: string, word: string): boolean {\n return text.startsWith(word) && /^[.!?;\\u2026]*$/.test(text.slice(word.length));\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 // A space, a colon or an em dash, after a stop or not, introduces a note on\n // the placeholder: `TBD: ask the vendor`, `TBD. Ask the vendor.`, `TBD - later`.\n // A stop or a hyphen that goes on into a word, `TODO.md`, `TODO-driven`,\n // is part of that word. An em dash joins no words, so none is made across it.\n return lower.startsWith(word) && /^[.!?;\\u2026\\-]*(?:$|[\\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 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 // A note after a placeholder is the event itself: `TBD: when the vendor answers`.\n if (config.placeholders.some((p) => onlyPlaceholder(trigger.toLowerCase(), p.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/trigger.d.ts
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
* The lists are deliberately short. A trigger this reads as an event when it
|
|
13
13
|
* is a time is a miss, and a miss costs less here than refusing a real event
|
|
14
|
-
* for looking like a date.
|
|
14
|
+
* for looking like a date. They are English, as the status words are: a time
|
|
15
|
+
* written in another language is a word on no list, so it reads as an event.
|
|
15
16
|
*/
|
|
16
17
|
/** Whether a trigger has a word that says what must happen, rather than only when. */
|
|
17
18
|
export declare function namesAnEvent(trigger: string): boolean;
|
package/dist/trigger.js
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
* The lists are deliberately short. A trigger this reads as an event when it
|
|
13
13
|
* is a time is a miss, and a miss costs less here than refusing a real event
|
|
14
|
-
* for looking like a date.
|
|
14
|
+
* for looking like a date. They are English, as the status words are: a time
|
|
15
|
+
* written in another language is a word on no list, so it reads as an event.
|
|
15
16
|
*/
|
|
16
17
|
const MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
|
17
18
|
const WEEKDAYS = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
|
|
@@ -38,68 +39,12 @@ const WHEN = new Set([
|
|
|
38
39
|
* its numbers: `2026-10-01` and `10/01/2026` are read a number at a time.
|
|
39
40
|
*/
|
|
40
41
|
const DATE = /^(?:q[1-4]|\d+(?:st|nd|rd|th)?)$/;
|
|
41
|
-
/**
|
|
42
|
-
* Chinese is written without spaces, so a trigger in it is one run of Han
|
|
43
|
-
* characters that says when or what: `下個月` (next month), `2026年10月`,
|
|
44
|
-
* `月結完成後` (after the month-end close). A run says only when if taking out
|
|
45
|
-
* the words and characters below leaves nothing, Traditional and Simplified
|
|
46
|
-
* alike.
|
|
47
|
-
*
|
|
48
|
-
* The words come out first, since one may hold a character that alone says
|
|
49
|
-
* nothing about time: `稍後` (later) is `稍` and `後`, and `稍` is not on the
|
|
50
|
-
* list. A word whose every character is on the list, such as `之後`, needs no
|
|
51
|
-
* entry of its own.
|
|
52
|
-
*/
|
|
53
|
-
const HAN_WHEN_WORDS = [
|
|
54
|
-
// A weekday, and the stretches: `星期一`, `禮拜三`, a quarter, a year, an hour, a minute.
|
|
55
|
-
...['星期', '禮拜', '礼拜', '季度', '年度', '小時', '小时', '分鐘', '分钟'],
|
|
56
|
-
// Soon, later, one day, in the future, about.
|
|
57
|
-
...['近期', '稍後', '稍后', '以後', '以后', '將來', '将来', '未來', '未来', '改天', '馬上', '马上', '很快', '不久', '左右'],
|
|
58
|
-
];
|
|
59
|
-
/**
|
|
60
|
-
* Characters that say when, and the ones that join them. `時`, `期` and `每`
|
|
61
|
-
* are not among them: `到期時` (when it expires) and `每月結算完成時` are
|
|
62
|
-
* events, and so is a trigger that starts with `當` (when).
|
|
63
|
-
*/
|
|
64
|
-
const HAN_WHEN_CHARACTERS = new Set([
|
|
65
|
-
// Units: year, month, day, week, quarter, a ten-day stretch, the day of the month, noon.
|
|
66
|
-
...['年', '月', '日', '天', '週', '周', '季', '旬', '號', '号', '午'],
|
|
67
|
-
// Where in one: its start, end, middle, half.
|
|
68
|
-
...['初', '底', '末', '中', '半'],
|
|
69
|
-
// Which one: this, next, last, the one before or after, early, late, the nth.
|
|
70
|
-
...['今', '明', '去', '上', '下', '本', '這', '这', '次', '前', '後', '后', '早', '晚', '第', '個', '个'],
|
|
71
|
-
// How many.
|
|
72
|
-
...['〇', '零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '百', '兩', '两', '幾', '几'],
|
|
73
|
-
// The words that join them: at, in, until, of.
|
|
74
|
-
...['在', '於', '于', '到', '的', '之'],
|
|
75
|
-
]);
|
|
76
|
-
/** A run of Han characters, or of other letters and digits. */
|
|
77
|
-
const WORD = /\p{Script=Han}+|(?:(?!\p{Script=Han})[\p{L}\p{N}])+/gu;
|
|
78
|
-
/** A word is all Han or none of it, so one character says which. */
|
|
79
|
-
const HAN = /\p{Script=Han}/u;
|
|
80
|
-
/**
|
|
81
|
-
* The words of a trigger, in lower case: runs of letters and digits, with Han
|
|
82
|
-
* characters in runs of their own, so that `10月` is `10` and `月`. `mid-2027`
|
|
83
|
-
* is two words, and punctuation none. Read in NFKC first, so that full-width
|
|
84
|
-
* `Q3` is `q3` and `2026` is `2026`.
|
|
85
|
-
*/
|
|
42
|
+
/** The runs of letters and digits, in lower case: `mid-2027` is two words, and punctuation none. */
|
|
86
43
|
function words(text) {
|
|
87
|
-
return text.
|
|
88
|
-
}
|
|
89
|
-
/** Whether a run of Han characters says only when. */
|
|
90
|
-
function hanSaysWhen(run) {
|
|
91
|
-
let rest = run;
|
|
92
|
-
for (const word of HAN_WHEN_WORDS)
|
|
93
|
-
rest = rest.replaceAll(word, '');
|
|
94
|
-
return [...rest].every((character) => HAN_WHEN_CHARACTERS.has(character));
|
|
95
|
-
}
|
|
96
|
-
function saysWhen(word) {
|
|
97
|
-
if (HAN.test(word))
|
|
98
|
-
return hanSaysWhen(word);
|
|
99
|
-
return WHEN.has(word) || DATE.test(word);
|
|
44
|
+
return text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [];
|
|
100
45
|
}
|
|
101
46
|
/** Whether a trigger has a word that says what must happen, rather than only when. */
|
|
102
47
|
export function namesAnEvent(trigger) {
|
|
103
|
-
return words(trigger).some((word) => !
|
|
48
|
+
return words(trigger).some((word) => !WHEN.has(word) && !DATE.test(word));
|
|
104
49
|
}
|
|
105
50
|
//# sourceMappingURL=trigger.js.map
|
package/dist/trigger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.js","sourceRoot":"","sources":["../src/trigger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"trigger.js","sourceRoot":"","sources":["../src/trigger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAC1I,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAEhG,4CAA4C;AAC5C,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC;IACnB,GAAG,MAAM;IACT,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,MAAM;IACN,GAAG,QAAQ;IACX,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CA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CAAC","sourcesContent":["/**\n * Whether a deferral's trigger names an event or only a time.\n *\n * Deferred work comes back when something happens: \"when the second tenant\n * signs\", \"when p95 exceeds 200 ms\". A date is not that. It passes whether or\n * not the reason for the work has arrived, and a deferral that fires on a date\n * is a reminder to look again, which the deferral itself already is. So a\n * trigger made only of words that say when - a date, a quarter, a month or a\n * weekday, a stretch of time and the small words that join them - is refused,\n * and one word that says what is enough to pass.\n *\n * The lists are deliberately short. A trigger this reads as an event when it\n * is a time is a miss, and a miss costs less here than refusing a real event\n * for looking like a date. They are English, as the status words are: a time\n * written in another language is a word on no list, so it reads as an event.\n */\n\nconst MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];\nconst WEEKDAYS = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];\n\n/** Words that say when and nothing else. */\nconst WHEN = new Set([\n ...MONTHS,\n ...MONTHS.map((m) => m.slice(0, 3)),\n 'sept',\n ...WEEKDAYS,\n ...WEEKDAYS.map((d) => d.slice(0, 3)),\n // A stretch of time.\n ...['day', 'week', 'weekend', 'month', 'quarter', 'year', 'sprint'].flatMap((unit) => [unit, `${unit}s`]),\n 'today',\n 'tomorrow',\n 'soon',\n 'later',\n // How many of them.\n ...['a', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'few', 'couple'],\n // The words that join them.\n ...['in', 'on', 'by', 'at', 'after', 'before', 'until', 'from', 'of', 'the', 'next', 'this', 'end', 'start', 'early', 'mid', 'late'],\n]);\n\n/**\n * A number or an ordinal - `2026`, `15`, `15th` - or a quarter, `Q3`. A date is\n * its numbers: `2026-10-01` and `10/01/2026` are read a number at a time.\n */\nconst DATE = /^(?:q[1-4]|\\d+(?:st|nd|rd|th)?)$/;\n\n/** The runs of letters and digits, in lower case: `mid-2027` is two words, and punctuation none. */\nfunction words(text: string): readonly string[] {\n return text.toLowerCase().match(/[\\p{L}\\p{N}]+/gu) ?? [];\n}\n\n/** Whether a trigger has a word that says what must happen, rather than only when. */\nexport function namesAnEvent(trigger: string): boolean {\n return words(trigger).some((word) => !WHEN.has(word) && !DATE.test(word));\n}\n"]}
|
package/package.json
CHANGED