@descent-vtt/spec-brief 0.9.0 → 0.10.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/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,SAAS,EACT,WAAW,EACX,OAAO,EAEP,cAAc,EACd,iBAAiB,EACjB,YAAY,EAEZ,UAAU,EACV,QAAQ,EACR,cAAc,EACd,UAAU,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,KAAK,EACL,YAAY,EACZ,YAAY,EAEZ,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM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AC9D,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["/**\n * The command line: argument parsing, dispatch, output and exit codes.\n *\n * Exit 0: done, nothing found. Exit 1: findings, collisions, or an action\n * refused. Exit 2: the run could not be trusted - a bad flag, a configuration\n * that does not load, a brief that does not exist. A run that checked nothing\n * must never exit as though it found nothing.\n */\n\nimport { readFile, stat } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { parseArgs, type ParseArgsConfig } from 'node:util';\n\nimport { TransactionError, ConflictError } from './apply.js';\nimport type { Plan } from './archive.js';\nimport { reported } from './collisions.js';\nimport { CONFIG_FILES, ConfigError, initialConfig } from './config.js';\nimport { BriefEngine, EngineError, isDate, today } from './engine.js';\nimport { NodeFileSystem } from './fs.js';\nimport { GitError } from './git.js';\nimport { failing, sortFindings, summarise } from './lint.js';\nimport { normalisePath } from './links.js';\nimport {\n briefJson,\n findingJson,\n FORMATS,\n type Format,\n githubCommands,\n gitlabCodeQuality,\n jsonDocument,\n type ListRow,\n matrixJson,\n planJson,\n prettyFindings,\n prettyList,\n prettyMatrix,\n prettyPlan,\n prettySchedule,\n sarif,\n scheduleJson,\n sectionsJson,\n type Style,\n summaryLine,\n} from './report.js';\nimport type { Finding } from './types.js';\n\nexport const EXIT_OK = 0;\nexport const EXIT_FAILED = 1;\nexport const EXIT_ERROR = 2;\n\nexport class UsageError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UsageError';\n }\n}\n\nexport interface CliIO {\n readonly stdout?: { write(text: string): unknown; readonly isTTY?: boolean };\n readonly stderr?: { write(text: string): unknown };\n readonly cwd?: string;\n readonly env?: Readonly<Record<string, string | undefined>>;\n}\n\ntype Values = Record<string, string | boolean | undefined>;\n\n/** An option as `parseArgs` read it, by its name and as it was written, `-h` or `--help`. */\ninterface OptionToken {\n readonly kind: 'option';\n readonly name: string;\n readonly rawName: string;\n readonly value?: string | undefined;\n}\n\ntype Token = OptionToken | { readonly kind: 'positional' | 'option-terminator' };\n\nconst GLOBAL: NonNullable<ParseArgsConfig['options']> = {\n root: { type: 'string' },\n config: { type: 'string' },\n 'no-config': { type: 'boolean' },\n format: { type: 'string' },\n strict: { type: 'boolean' },\n 'no-git': { type: 'boolean' },\n color: { type: 'boolean' },\n 'no-color': { type: 'boolean' },\n help: { type: 'boolean', short: 'h' },\n version: { type: 'boolean', short: 'v' },\n};\n\ninterface CommandSpec {\n readonly options: NonNullable<ParseArgsConfig['options']>;\n readonly formats: readonly Format[];\n /**\n * Set on a command that takes no argument: what its refusal of one adds to\n * the usage, which is where the option a person most likely meant is named.\n */\n readonly noArgument?: string;\n}\n\nconst TABLE: Readonly<Record<string, CommandSpec>> = {\n init: {\n options: { briefs: { type: 'string' }, archive: { type: 'string' } },\n formats: ['pretty', 'json'],\n noArgument: '; --root <dir> names the directory it sets up, and --briefs <dir> the one for the briefs',\n },\n new: {\n options: {\n id: { type: 'string' },\n type: { type: 'string' },\n wave: { type: 'string' },\n 'depends-on': { type: 'string' },\n date: { type: 'string' },\n },\n formats: ['pretty', 'json'],\n },\n lint: { options: {}, formats: FORMATS },\n list: { options: { ready: { type: 'boolean' }, archived: { type: 'boolean' } }, formats: ['pretty', 'json'], noArgument: '' },\n matrix: { options: { 'all-waves': { type: 'boolean' } }, formats: FORMATS, noArgument: '' },\n schedule: { options: { write: { type: 'boolean' } }, formats: FORMATS, noArgument: '' },\n archive: {\n options: {\n pr: { type: 'string' },\n commit: { type: 'string' },\n base: { type: 'string' },\n summary: { type: 'string' },\n date: { type: 'string' },\n 'allow-dirty': { type: 'boolean' },\n 'dry-run': { type: 'boolean' },\n },\n formats: ['pretty', 'json'],\n },\n unarchive: { options: { 'dry-run': { type: 'boolean' } }, formats: ['pretty', 'json'] },\n};\n\n/**\n * Whether taking the option would tell someone what is not so. `init\n * --strict` says the briefs were set up strictly, where nothing was strict;\n * `init --config team.json` that the configuration was written there, where\n * `.spec-brief.json` was; `init --color` and `new --color` that colour was\n * printed, where neither prints any; `new --strict` and `list --strict` that\n * a warning would have failed the run, where neither has one. Each ran as\n * the line without the option does, exit 0.\n *\n * A function, not a table beside the commands': a table built when the\n * module loads is static to Stryker, and each of its mutants then runs the\n * whole suite (ADR-0009).\n */\nfunction untrue(command: string, option: string): boolean {\n switch (option) {\n case 'config':\n return command === 'init';\n case 'strict':\n return command === 'init' || command === 'new' || command === 'list';\n case 'color':\n return command === 'init' || command === 'new';\n }\n // After the switch and not as its `default`: a `default` with its return\n // taken out answers nothing, which each caller reads as false, and no test\n // can tell that mutant from the code (ADR-0009).\n return false;\n}\n\n/**\n * Whether the option asks the command to leave out what it never does, and\n * so asks for what is already so: `init` opens no configuration file and\n * asks git nothing, and neither it nor `new` prints colour. Such an option\n * is taken. A script that runs every command in a tree without git, or into\n * a log, passes it to each of them, as spec-harness passes `--no-color`.\n * The command reads nothing of it, so a refusal's line lists it apart from\n * what the command reads, as taken.\n */\nfunction alreadySo(command: string, option: string): boolean {\n switch (option) {\n case 'no-config':\n case 'no-git':\n return command === 'init';\n case 'no-color':\n return command === 'init' || command === 'new';\n }\n // After the switch, for the reason `untrue` has.\n return false;\n}\n\n/** Options by their names on the command line, as a sentence lists them. */\nfunction listed(names: readonly string[]): string {\n const options = names.map((name) => `--${name}`);\n return options.length === 1 ? (options[0] as string) : `${options.slice(0, -1).join(', ')} and ${options.at(-1)!}`;\n}\n\n/**\n * Why a command line that parsed is still not one to run.\n *\n * An option is refused where taking it would tell someone what is not so,\n * and so are two options of which one would go unread: `--config team.json\n * --no-config` says the file was read, where the defaults ran, and `--color\n * --no-color` that colour was forced on, where it was off. An option that\n * asks a command to leave out what it never does asks for what is already\n * so, and is taken.\n */\nfunction unread(command: string, spec: CommandSpec, values: Values): string | null {\n // The first such option as the line was typed, which is the order the\n // parser keeps.\n const stray = Object.keys(values).find((option) => untrue(command, option));\n if (stray !== undefined) {\n const shared = Object.keys(GLOBAL).filter((option) => option !== 'help' && option !== 'version' && !untrue(command, option));\n const reads = [...shared.filter((option) => !alreadySo(command, option)), ...Object.keys(spec.options)];\n const takes = shared.filter((option) => alreadySo(command, option));\n return `${command} does not read --${stray}; it reads ${listed(reads)}${takes.length > 0 ? `, and takes ${listed(takes)}` : ''}`;\n }\n if (text(values, 'config') !== undefined && flag(values, 'no-config')) {\n return '--config is given beside --no-config, which has the run read no configuration file; give one of the two';\n }\n if (flag(values, 'color') && flag(values, 'no-color')) return '--color is given beside --no-color, which turns colour off; give one of the two';\n // The engine refuses the pair as well, for a caller of the library; here it\n // is refused with the line, where --help and --version are no way past it.\n if (flag(values, 'no-git') && (text(values, 'commit') !== undefined || text(values, 'base') !== undefined)) {\n return 'a commit or a base needs git; drop --no-git, or drop --commit and --base';\n }\n return null;\n}\n\n/**\n * An option's value as the command reads it, so that one thing written two\n * ways is asked for once: a directory as the run resolves it, a number by\n * what its digits count, a list by its ids, a summary as it is trimmed. Any\n * other value is read as it is written, in its own case, which is how each\n * of those options reads it. A revision is read by git, which a line is not\n * checked against, so `HEAD` and the commit it names are two values here.\n */\nfunction asRead(option: string, value: string, root: string): string {\n switch (option) {\n case 'root':\n return resolve(value);\n case 'config':\n return resolve(root, value);\n case 'wave':\n case 'pr':\n return String(digits(value) ?? value);\n case 'depends-on':\n return JSON.stringify(idsOf(value));\n case 'summary':\n return value.trim();\n case 'briefs':\n case 'archive':\n // Last: one outside the repository leaves the switch and is read as it\n // was written, for `directories` to refuse by what it was given. A catch\n // that returned it would have a mutant, its return taken out, that fell\n // into the next case and read it the same, which no test can tell apart.\n try {\n return normalisePath(value);\n } catch {}\n }\n // After the switch, for the reason `untrue` has.\n return value;\n}\n\n/**\n * Why a line that gives one option two values is not one to run: the later\n * was read, and the earlier went unread with no word of it, so `--root\n * nowhere --root .` ran in `.` (spec-core ADR-0005, amended 2026-10-18).\n */\nfunction twice(options: readonly OptionToken[], values: Values, cwd: string): string | null {\n // A configuration is found from the root, as the engine finds it.\n const root = resolve(text(values, 'root') ?? cwd);\n const first = new Map<string, { readonly written: string; readonly read: string }>();\n for (const token of options) {\n // A flag has no value to compare, and one given twice is that flag once.\n // Taken in here it would be read as nothing each time, which decides\n // nothing either: the mutant that takes it in is equivalent.\n if (token.value === undefined) continue;\n const read = asRead(token.name, token.value, root);\n const earlier = first.get(token.name);\n if (earlier === undefined) first.set(token.name, { written: token.value, read });\n else if (earlier.read !== read) {\n // Shown as JSON, as an empty value is, where what cannot be seen can be.\n return `--${token.name} is given ${JSON.stringify(earlier.written)} and ${JSON.stringify(token.value)}, and takes one value; give one of the two`;\n }\n }\n return null;\n}\n\n/**\n * `--help` beside `--version` asks for two answers, and printed one of\n * them; the other went unread. Named as each was written, `-h` or `--help`.\n */\nfunction answers(options: readonly OptionToken[]): string | null {\n let asked: OptionToken | undefined;\n for (const token of options) {\n if (token.name !== 'help' && token.name !== 'version') continue;\n if (asked === undefined) asked = token;\n else if (asked.name !== token.name) return `${asked.rawName} is given beside ${token.rawName}, and one of the two answers would go unread; give one of the two`;\n }\n return null;\n}\n\n/**\n * What a command's own options hold, refused where the line is read, by what\n * each holds: a number, a list of ids, a date, a revision, a directory, and a\n * second brief where a command takes one. What only the tree can answer - a\n * root that is not there, an id that is taken, a type the configuration does\n * not have - is asked by the run, which `--help` and `--version` do not start.\n */\nfunction checkValues(command: string | undefined, values: Values, positionals: readonly string[]): void {\n integer(values, 'wave', 0);\n integer(values, 'pr', 1);\n dependencies(values);\n const date = text(values, 'date');\n if (date !== undefined && !isDate(date)) throw new UsageError(`\"${date}\" is not a date written YYYY-MM-DD`);\n for (const option of ['commit', 'base']) {\n // Handed to git, it would be read as one of git's options.\n const revision = text(values, option);\n if (revision?.startsWith('-') === true) throw new UsageError(`\"${revision}\" is not a revision`);\n }\n // Only init takes --briefs and --archive; for any other command they are\n // the defaults, which are two directories inside the root.\n directories(values);\n if ((command === 'archive' || command === 'unarchive') && positionals.length > 1) {\n throw new UsageError(`${command} takes one brief: spec-brief ${command} <brief>`);\n }\n}\n\n/**\n * The commands by name, and nothing for a command line that names none. A map,\n * because an object answers to more names than it was given: `constructor` and\n * `toString` are no commands.\n */\nconst COMMANDS: ReadonlyMap<string | undefined, CommandSpec> = new Map(Object.entries(TABLE));\n\n/**\n * The formats each command writes, read from the table `main` checks a\n * `--format` against, so the help names no format a command refuses: the\n * finding formats are `lint`'s, `matrix`'s and `schedule`'s alone.\n */\nfunction formatsHelp(): string {\n const groups = new Map<string, string[]>();\n for (const [command, spec] of Object.entries(TABLE)) {\n const formats = spec.formats.join(', ');\n groups.set(formats, [...(groups.get(formats) ?? []), command]);\n }\n const rows = [...groups].map(([formats, commands]): readonly [string, string] => [commands.join(', '), formats]);\n const width = Math.max(...rows.map(([commands]) => commands.length));\n return rows.map(([commands, formats]) => ` ${commands.padEnd(width)} ${formats}`).join('\\n');\n}\n\nexport const HELP = `spec-brief - lint, schedule and archive task briefs\n\nUsage:\n spec-brief <command> [options]\n\nCommands:\n init write .spec-brief.json and the brief directories\n new <title> scaffold a brief with the next free id\n lint [brief...] check briefs against the configuration\n list briefs with their status, wave and readiness\n matrix scope collisions between briefs in the same wave\n schedule the waves the live briefs can run in, computed\n archive <brief> close a round: check it, stamp it, freeze it, move it\n unarchive <brief> reopen an archived brief\n\nOptions for every command, except where a line says otherwise:\n --root <dir> run from this directory instead of the current one; it must exist, unless init makes it\n --config <file> use this configuration file; not for init, which writes .spec-brief.json\n --no-config use the defaults, ignoring any configuration file\n --format <format> the output format, pretty by default; each command's are below\n --strict treat warnings as errors; not for init, new or list, which have none\n --no-git leave git out; read the files on disk instead\n --color, --no-color force colour on or off; --color not for init or new, which print none\n -h, --help show this help\n -v, --version show the version\n\nFormats:\n${formatsHelp()}\n\ninit:\n --briefs <dir> the directory of live briefs; default briefs\n --archive <dir> the directory of archived briefs; default <briefs>/archive\n\nnew:\n --id <id> use this id instead of the next free one\n --type <type> a brief type from the configuration\n --wave <n> the wave it runs in\n --depends-on <ids> comma-separated ids it runs after\n --date <YYYY-MM-DD> the date in its front matter; default SOURCE_DATE_EPOCH's, or today's in UTC\n\nlist:\n --ready only briefs that can run now: dependencies archived, not drafts or deferred\n --archived include archived briefs\n\nmatrix:\n --all-waves compare every live brief, whatever its wave\n\nschedule:\n --write write each proposed wave into its brief's front matter\n\narchive:\n --pr <number> the pull request the round merged in\n --commit <rev> the commit the round landed as\n --base <rev> the branch it started from; the diff runs from the merge base\n --summary <text> what the round did, for the banner\n --date <YYYY-MM-DD> the archival date; default SOURCE_DATE_EPOCH's, or today's in UTC\n --allow-dirty archive although the tree has uncommitted work\n --dry-run print the plan and change nothing\n\nunarchive:\n --dry-run print the plan and change nothing\n\nAn option given an empty value, a list that names nothing and an argument a\ncommand does not take are refused, not read as if they were not there. So is\nan option where taking it would say what is not so, as init --strict, and so\nare --config beside --no-config and --color beside --no-color, of which one\nwould go unread. An option that asks a command to leave out what it never\ndoes is taken, as init --no-git: it asks for what is already so.\n\nAn option that takes one value and is given two is refused, as --root a\n--root b, since the earlier would go unread; one value given twice, however\nit is written, is taken once, as --root . --root ./. A line refused for any\nof these is refused with --help or --version on it too, and so is --help\nbeside --version.\n\nExit codes: 0 clean, 1 findings or refused, 2 the run could not be trusted.\n`;\n\ninterface Parsed {\n readonly command: string | undefined;\n readonly values: Values;\n readonly positionals: readonly string[];\n}\n\n/** Global options that take a value, so the value is not mistaken for the command. */\nconst VALUED = new Set(['--root', '--config', '--format']);\n\nfunction commandOf(argv: readonly string[]): string | undefined {\n for (let i = 0; i < argv.length; i += 1) {\n const arg = argv[i] as string;\n if (arg === '--') return argv[i + 1];\n if (VALUED.has(arg)) {\n i += 1;\n continue;\n }\n if (!arg.startsWith('-')) return arg;\n }\n return undefined;\n}\n\n/**\n * The line, read and checked. Everything the line alone decides is refused\n * here, before `--help` and `--version` are answered, as an option the\n * parser does not know always was: a wrong line is wrong with either of them\n * on it (spec-core ADR-0005, amended 2026-10-18). `cwd` is the directory a\n * run without `--root` starts in, from which a `--config` is found.\n */\nexport function parse(argv: readonly string[], cwd: string = process.cwd()): Parsed {\n const command = commandOf(argv);\n const spec = COMMANDS.get(command);\n if (command !== undefined && spec === undefined) {\n throw new UsageError(`\"${command}\" is not a command; run spec-brief --help`);\n }\n let parsed: { values: Values; positionals: string[]; tokens: Token[] };\n try {\n const read = parseArgs({\n args: [...argv],\n options: { ...GLOBAL, ...(spec?.options ?? {}) },\n allowPositionals: true,\n strict: true,\n tokens: true,\n });\n // The cast stands on the name, with nothing under it: Stryker makes no\n // mutant of what an `as` holds, and the call above is what the parser\n // is asked (ADR-0009).\n parsed = read as { values: Values; positionals: string[]; tokens: Token[] };\n } catch (error) {\n throw new UsageError((error as Error).message);\n }\n const positionals = parsed.positionals.slice(1);\n // What the parser takes is not yet what names something. An option whose\n // value is empty, as `--root \"$DIR\"` is where the variable is not set, was\n // read as the option left out, and an argument no command asked for was\n // dropped: either way the run answered a question nobody had put, exit 0.\n for (const [name, value] of Object.entries(parsed.values)) {\n if (typeof value === 'string' && value.trim() === '') {\n // Shown as JSON, where a tab or a line break in it can be seen.\n throw new UsageError(`--${name} is ${JSON.stringify(value)}, which is no value; give it one, or leave the option out`);\n }\n }\n if (spec?.noArgument !== undefined && positionals.length > 0) {\n const extra = positionals.map((argument) => `\"${argument}\"`).join(', ');\n throw new UsageError(`${command} takes no argument, not ${extra}: spec-brief ${command}${spec.noArgument}`);\n }\n const options = parsed.tokens.filter((token): token is OptionToken => token.kind === 'option');\n const refusal =\n twice(options, parsed.values, cwd) ??\n answers(options) ??\n (spec === undefined ? null : (unread(command!, spec, parsed.values) ?? unwritten(command!, spec, parsed.values)));\n if (refusal !== null) throw new UsageError(refusal);\n checkValues(command, parsed.values, positionals);\n return { command, values: parsed.values, positionals };\n}\n\n/** A `--format` the command does not write, which the help lists by command. */\nfunction unwritten(command: string, spec: CommandSpec, values: Values): string | null {\n const asked = text(values, 'format') ?? 'pretty';\n // Cast on the name, as above. The check below is what makes it true.\n const format = asked as Format;\n return spec.formats.includes(format) ? null : `--format for ${command} is one of ${spec.formats.join(', ')}, not \"${format}\"`;\n}\n\n/** The value of an option declared a string, which is all `parseArgs` gives one. */\nfunction text(values: Values, key: string): string | undefined {\n return values[key] as string | undefined;\n}\n\nfunction flag(values: Values, key: string): boolean {\n return values[key] === true;\n}\n\n/** The number a value's digits count, or nothing for a value that is not digits alone. */\nfunction digits(raw: string): number | undefined {\n return /^\\d+$/.test(raw) ? Number(raw) : undefined;\n}\n\nfunction integer(values: Values, key: string, minimum: number): number | undefined {\n const raw = text(values, key);\n if (raw === undefined) return undefined;\n const number = digits(raw);\n if (number === undefined || number < minimum) throw new UsageError(`--${key} must be a whole number of at least ${minimum}, not \"${raw}\"`);\n return number;\n}\n\n/** The ids of a list written with commas between them, spaces beside each taken off. */\nfunction idsOf(listed: string): string[] {\n return listed.split(',').map((id) => id.trim());\n}\n\n/** `--depends-on` as the ids it names, or nothing where it is not given. */\nfunction dependencies(values: Values): string[] | undefined {\n const listed = text(values, 'depends-on');\n const dependsOn = listed === undefined ? undefined : idsOf(listed);\n // A list that names no brief is not a brief that depends on none: written\n // as given, \",\" scaffolded a brief with no dependency and said nothing.\n if (dependsOn?.every((d) => d === '')) {\n throw new UsageError(`--depends-on is ${JSON.stringify(listed)}, which names no brief; give it ids with commas between them, as in 7,8, or leave the option out`);\n }\n // And a place in it that names none is a brief left out: \"$A,$B\" with one\n // of the two unset scaffolded a brief that depends on the other alone.\n if (dependsOn?.includes('')) {\n throw new UsageError(`--depends-on is ${JSON.stringify(listed)}, which names no brief in one of its places; give it ids with one comma between each two, as in 7,8, and none before or after`);\n }\n return dependsOn;\n}\n\n/**\n * The directories `init` sets up. One above the root is refused as the\n * configuration refuses one (config.ts), in the same words, before anything\n * is written.\n */\nfunction directories(values: Values): { readonly briefs: string; readonly archive: string } {\n const inside = (option: string, given: string): string => {\n try {\n return normalisePath(given);\n } catch {\n throw new UsageError(`--${option} must be a directory inside the repository, not \"${given}\"`);\n }\n };\n const briefs = inside('briefs', text(values, 'briefs') ?? 'briefs');\n const archive = inside('archive', text(values, 'archive') ?? `${briefs}/archive`);\n if (briefs === '' || archive === '' || briefs === archive) throw new UsageError('--briefs and --archive must be two directories');\n return { briefs, archive };\n}\n\nasync function version(): Promise<string> {\n // `JSON.parse` reads a file's bytes as it reads their text in UTF-8, so the\n // encoding says what the manifest is and decides nothing: with none named,\n // the version read is the same, and no test can tell the two apart.\n const pkg: { version: string } = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));\n return pkg.version;\n}\n\ninterface Run {\n /**\n * Today, as the environment the run was given says. Asked only by a command\n * that writes a date and was given none: a `SOURCE_DATE_EPOCH` that cannot\n * be read stops the run that would have written the clock's date for it,\n * and no run whose answer it has no part in.\n */\n readonly today: () => string;\n readonly out: (text: string) => void;\n readonly err: (text: string) => void;\n readonly style: Style;\n readonly format: Format;\n readonly strict: boolean;\n readonly version: string;\n readonly values: Values;\n readonly positionals: readonly string[];\n readonly cwd: string;\n}\n\nfunction useColor(values: Values, io: CliIO): boolean {\n if (flag(values, 'no-color')) return false;\n if (flag(values, 'color')) return true;\n const env = io.env ?? process.env;\n if ((env['NO_COLOR'] ?? '') !== '') return false;\n // Off for exactly \"0\" and exactly \"false\": Node itself and supports-color\n // read \"false\" as off, and here it forced colour on. Any other value that\n // is not empty is on, \"FALSE\" too, which is the one reading the family's\n // tools share (spec-core ADR-0005).\n const force = env['FORCE_COLOR'];\n if (force !== undefined && force !== '') return force !== '0' && force !== 'false';\n // A terminal that says it is dumb has asked for no escape sequence, and\n // Node itself counts one colour for it: the family's tools read it alike.\n if (env['TERM'] === 'dumb') return false;\n return (io.stdout ?? process.stdout).isTTY === true;\n}\n\nasync function openEngine(run: Run): Promise<BriefEngine> {\n return BriefEngine.open({\n cwd: text(run.values, 'root') ?? run.cwd,\n config: text(run.values, 'config'),\n ...(flag(run.values, 'no-git') ? { git: null } : {}),\n noConfig: flag(run.values, 'no-config'),\n });\n}\n\nfunction emitFindings(run: Run, command: string, findings: readonly Finding[], checked: number, extra: Record<string, unknown> = {}): number {\n const failed = failing(findings, run.strict);\n switch (run.format) {\n case 'json':\n run.out(jsonDocument(command, run.version, { ok: !failed, checked, summary: summarise(findings), findings: findings.map(findingJson), ...extra }));\n break;\n case 'sarif':\n run.out(sarif(findings, run.version));\n break;\n case 'github':\n run.out(githubCommands(findings));\n break;\n case 'gitlab':\n run.out(gitlabCodeQuality(findings));\n break;\n case 'pretty':\n if (findings.length > 0) run.out(`${prettyFindings(findings, run.style)}\\n\\n`);\n run.out(`${findings.length === 0 ? `${checked} brief(s) checked, no findings` : `${summaryLine(findings)} in ${checked} brief(s)`}\\n`);\n break;\n }\n return failed ? EXIT_FAILED : EXIT_OK;\n}\n\nasync function runInit(run: Run): Promise<number> {\n const root = text(run.values, 'root') ?? run.cwd;\n const fs = new NodeFileSystem(root);\n for (const name of CONFIG_FILES) {\n if (await fs.exists(name)) throw new UsageError(`${name} already exists here; edit it instead`);\n }\n const { briefs, archive } = directories(run.values);\n const config = `${JSON.stringify(initialConfig(briefs, archive), null, 2)}\\n`;\n await fs.write('.spec-brief.json', config);\n const written = ['.spec-brief.json'];\n for (const dir of [briefs, archive]) {\n const keep = `${dir}/.gitkeep`;\n if ((await fs.list(dir)) === null) {\n await fs.write(keep, '');\n written.push(keep);\n }\n }\n if (run.format === 'json') run.out(jsonDocument('init', run.version, { ok: true, written }));\n else run.out(`${written.map((w) => `wrote ${w}`).join('\\n')}\\nnext: spec-brief new \"<title>\"\\n`);\n return EXIT_OK;\n}\n\nasync function runNew(run: Run): Promise<number> {\n const title = run.positionals.join(' ').trim();\n if (title === '') throw new UsageError('new needs a title: spec-brief new \"<title>\"');\n const dependsOn = dependencies(run.values);\n const engine = await openEngine(run);\n const created = await engine.create({\n title,\n id: text(run.values, 'id'),\n type: text(run.values, 'type'),\n wave: integer(run.values, 'wave', 0),\n dependsOn,\n date: text(run.values, 'date') ?? run.today(),\n });\n if (run.format === 'json') run.out(jsonDocument('new', run.version, { ok: true, file: created.file }));\n else run.out(`wrote ${created.file}\\n`);\n return EXIT_OK;\n}\n\nasync function runLint(run: Run): Promise<number> {\n const engine = await openEngine(run);\n engine.requireBriefs();\n const findings = await engine.lint(run.positionals);\n const checked = run.positionals.length === 0 ? engine.corpus.briefs.length : run.positionals.length;\n return emitFindings(run, 'lint', findings, checked, { sections: sectionsJson(engine.config) });\n}\n\nasync function runList(run: Run): Promise<number> {\n const engine = await openEngine(run);\n engine.requireBriefs();\n const briefs = flag(run.values, 'archived') ? engine.corpus.briefs : engine.corpus.live;\n const ready = new Set(engine.ready());\n const rows: ListRow[] = briefs\n .map((brief) => ({ brief, ready: ready.has(brief), waitingOn: engine.waitingOn(brief) }))\n .filter((row) => !flag(run.values, 'ready') || row.ready);\n if (run.format === 'json') {\n run.out(\n jsonDocument('list', run.version, {\n ok: true,\n briefs: rows.map((r) => briefJson(r.brief, { ready: r.ready, waitingOn: r.waitingOn })),\n sections: sectionsJson(engine.config),\n }),\n );\n } else {\n run.out(`${prettyList(rows, run.style)}\\n`);\n }\n return EXIT_OK;\n}\n\nasync function runMatrix(run: Run): Promise<number> {\n const engine = await openEngine(run);\n engine.requireBriefs();\n const { report, findings } = await engine.collisions({ all: flag(run.values, 'all-waves') });\n const sorted = sortFindings(findings);\n if (run.format === 'pretty') {\n // Drawn from what the run reports, so a rule that is off marks nothing in the grid.\n run.out(`${prettyMatrix(reported(engine.corpus, report), run.style)}\\n`);\n return failing(sorted, run.strict) ? EXIT_FAILED : EXIT_OK;\n }\n return emitFindings(run, 'matrix', sorted, engine.corpus.live.length, matrixJson(report));\n}\n\n/**\n * The waves, computed. The view shows the moves, their reasons and the\n * cycles; the other findings - briefs that run alone, pairs the search could\n * not decide, a front matter that cannot take a wave - print beneath it.\n */\nasync function runSchedule(run: Run): Promise<number> {\n const engine = await openEngine(run);\n engine.requireBriefs();\n const { schedule: computed, findings } = await engine.schedule();\n let written: string[] | null = null;\n let reported: Finding[] = findings;\n if (flag(run.values, 'write')) {\n const result = await engine.writeWaves(computed);\n written = result.written;\n // Written, the waves hold, and the findings that said they did not are answered.\n reported = [...(written.length > 0 ? findings.filter((f) => f.rule !== 'wave-schedule') : findings), ...result.refused];\n }\n const sorted = sortFindings(reported);\n if (run.format === 'pretty') {\n run.out(`${prettySchedule(computed, written, run.style)}\\n`);\n const rest = sorted.filter((f) => f.rule !== 'wave-schedule' && f.rule !== 'dependency-cycle');\n if (rest.length > 0) run.out(`\\n${prettyFindings(rest, run.style)}\\n`);\n return failing(sorted, run.strict) ? EXIT_FAILED : EXIT_OK;\n }\n return emitFindings(run, 'schedule', sorted, engine.corpus.live.length, { ...scheduleJson(computed), written });\n}\n\nasync function runTransition(run: Run, action: 'archive' | 'unarchive'): Promise<number> {\n const reference = run.positionals[0];\n // A second brief is refused with the line; none at all is what --help is asked for.\n if (reference === undefined) throw new UsageError(`${action} takes one brief: spec-brief ${action} <brief>`);\n const engine = await openEngine(run);\n const dryRun = flag(run.values, 'dry-run');\n const plan: Plan =\n action === 'archive'\n ? await engine.planArchive(reference, {\n pr: integer(run.values, 'pr', 1),\n commit: text(run.values, 'commit'),\n base: text(run.values, 'base'),\n summary: text(run.values, 'summary'),\n date: text(run.values, 'date') ?? run.today(),\n allowDirty: flag(run.values, 'allow-dirty'),\n strict: run.strict,\n // No noGit: under --no-git the engine is opened without git, and a\n // commit or a base beside it is refused with the line.\n })\n : engine.planUnarchive(reference, { strict: run.strict });\n const refused = plan.blocking.length > 0;\n if (!refused && !dryRun) await engine.apply(plan);\n if (run.format === 'json') run.out(jsonDocument(action, run.version, { ok: !refused, dryRun, plan: planJson(plan) }));\n else run.out(`${prettyPlan(plan, dryRun, run.style)}\\n`);\n return refused ? EXIT_FAILED : EXIT_OK;\n}\n\nexport async function main(argv: readonly string[] = process.argv.slice(2), io: CliIO = {}): Promise<number> {\n const stdout = io.stdout ?? process.stdout;\n const stderr = io.stderr ?? process.stderr;\n const err = (message: string): void => {\n stderr.write(`spec-brief: ${message}\\n`);\n };\n let parsed: Parsed;\n try {\n parsed = parse(argv, io.cwd ?? process.cwd());\n } catch (error) {\n err((error as Error).message);\n return EXIT_ERROR;\n }\n const { command, values, positionals } = parsed;\n // From here on, so that what comes before a command is covered as the\n // command is: --version and --help, the package's own manifest, the colour.\n // An error there left main as a rejection, which the launcher ended as\n // Node's uncaught error with exit 1, \"findings\" to a script.\n try {\n if (flag(values, 'version')) {\n stdout.write(`${await version()}\\n`);\n return EXIT_OK;\n }\n if (flag(values, 'help') || command === undefined) {\n stdout.write(HELP);\n // Asked for, the help is the answer; printed because no command was named, it is the error.\n return flag(values, 'help') ? EXIT_OK : EXIT_ERROR;\n }\n const asked = text(values, 'format') ?? 'pretty';\n // Cast on the name, as in `parse`, which refused a format the command does not write.\n const format = asked as Format;\n // A file, or a name with nothing behind it, had the search for a\n // configuration go on from its parent: the run reported on a tree nobody\n // had named, and `new` wrote into it. A path that cannot be reached is\n // not there to the run either. `init` alone is given a directory that\n // does not exist yet, which it makes.\n const root = text(values, 'root');\n if (root !== undefined) {\n const found = await stat(root).catch(() => null);\n if (found === null ? command !== 'init' : !found.isDirectory()) {\n throw new UsageError(`--root is \"${root}\", which is no directory; give it one, or leave the option out`);\n }\n }\n const run: Run = {\n today: () => today(io.env ?? process.env),\n out: (t) => {\n stdout.write(t);\n },\n err,\n // Read by the pretty format alone: the others have nothing to colour.\n style: { color: useColor(values, io) },\n format,\n strict: flag(values, 'strict'),\n version: await version(),\n values,\n positionals,\n cwd: io.cwd ?? process.cwd(),\n };\n switch (command) {\n case 'init':\n return await runInit(run);\n case 'new':\n return await runNew(run);\n case 'lint':\n return await runLint(run);\n case 'list':\n return await runList(run);\n case 'matrix':\n return await runMatrix(run);\n case 'schedule':\n return await runSchedule(run);\n case 'archive':\n return await runTransition(run, 'archive');\n default:\n return await runTransition(run, 'unarchive');\n }\n } catch (error) {\n // What git refused or could not do is git's message, and no line here.\n const expected = [ConfigError, UsageError, EngineError, ConflictError, TransactionError, GitError];\n if (expected.some((kind) => error instanceof kind)) {\n err((error as Error).message);\n return EXIT_ERROR;\n }\n // A write its reader had closed the pipe for is no defect either: the\n // answer was not delivered, which is still 2, and no stack sends a person\n // looking for a bug. The process's own streams report it as an event,\n // which the launcher answers in the same words; here it is a caller's\n // stream that throws it. It is read by its code: stdout and stderr are the\n // only pipes spec-brief writes to.\n if (!(error instanceof Error)) err(`unexpected error: ${String(error)}`);\n else if ((error as NodeJS.ErrnoException).code === 'EPIPE') err('stdout was closed before all of the output was written');\n else err(`unexpected error: ${error.stack ?? error.message}`);\n return EXIT_ERROR;\n }\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,SAAS,EACT,WAAW,EACX,OAAO,EAEP,cAAc,EACd,iBAAiB,EACjB,YAAY,EAEZ,UAAU,EACV,QAAQ,EACR,cAAc,EACd,UAAU,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd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,OAAO,CAAC,CAAC;YAC9B,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,sEAAsE;QACtE,0EAA0E;QAC1E,sEAAsE;QACtE,sEAAsE;QACtE,2EAA2E;QAC3E,mCAAmC;QACnC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,GAAG,CAAC,qBAAqB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACpE,IAAK,KAA+B,CAAC,IAAI,KAAK,OAAO;YAAE,GAAG,CAAC,wDAAwD,CAAC,CAAC;;YACrH,GAAG,CAAC,qBAAqB,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9D,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["/**\n * The command line: argument parsing, dispatch, output and exit codes.\n *\n * Exit 0: done, nothing found. Exit 1: findings, collisions, or an action\n * refused. Exit 2: the run could not be trusted - a bad flag, a configuration\n * that does not load, a brief that does not exist. A run that checked nothing\n * must never exit as though it found nothing.\n */\n\nimport { readFile, stat } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { parseArgs, type ParseArgsConfig } from 'node:util';\n\nimport { TransactionError, ConflictError } from './apply.js';\nimport type { Plan } from './archive.js';\nimport { reported } from './collisions.js';\nimport { CONFIG_FILES, ConfigError, initialConfig } from './config.js';\nimport { idKey } from './corpus.js';\nimport { BriefEngine, EngineError, isDate, today } from './engine.js';\nimport { NodeFileSystem } from './fs.js';\nimport { GitError } from './git.js';\nimport { failing, sortFindings, summarise } from './lint.js';\nimport { normalisePath } from './links.js';\nimport {\n briefJson,\n findingJson,\n FORMATS,\n type Format,\n githubCommands,\n gitlabCodeQuality,\n jsonDocument,\n type ListRow,\n matrixJson,\n planJson,\n prettyFindings,\n prettyList,\n prettyMatrix,\n prettyPlan,\n prettySchedule,\n sarif,\n scheduleJson,\n sectionsJson,\n type Style,\n summaryLine,\n} from './report.js';\nimport type { Finding } from './types.js';\n\nexport const EXIT_OK = 0;\nexport const EXIT_FAILED = 1;\nexport const EXIT_ERROR = 2;\n\nexport class UsageError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UsageError';\n }\n}\n\nexport interface CliIO {\n readonly stdout?: { write(text: string): unknown; readonly isTTY?: boolean };\n readonly stderr?: { write(text: string): unknown };\n readonly cwd?: string;\n readonly env?: Readonly<Record<string, string | undefined>>;\n}\n\ntype Values = Record<string, string | boolean | undefined>;\n\n/** An option as `parseArgs` read it, by its name and as it was written, `-h` or `--help`. */\ninterface OptionToken {\n readonly kind: 'option';\n readonly name: string;\n readonly rawName: string;\n readonly value?: string | undefined;\n}\n\ntype Token = OptionToken | { readonly kind: 'positional' | 'option-terminator' };\n\nconst GLOBAL: NonNullable<ParseArgsConfig['options']> = {\n root: { type: 'string' },\n config: { type: 'string' },\n 'no-config': { type: 'boolean' },\n format: { type: 'string' },\n strict: { type: 'boolean' },\n 'no-git': { type: 'boolean' },\n color: { type: 'boolean' },\n 'no-color': { type: 'boolean' },\n help: { type: 'boolean', short: 'h' },\n version: { type: 'boolean', short: 'v' },\n};\n\ninterface CommandSpec {\n readonly options: NonNullable<ParseArgsConfig['options']>;\n readonly formats: readonly Format[];\n /**\n * Set on a command that takes no argument: what its refusal of one adds to\n * the usage, which is where the option a person most likely meant is named.\n */\n readonly noArgument?: string;\n}\n\nconst TABLE: Readonly<Record<string, CommandSpec>> = {\n init: {\n options: { briefs: { type: 'string' }, archive: { type: 'string' } },\n formats: ['pretty', 'json'],\n noArgument: '; --root <dir> names the directory it sets up, and --briefs <dir> the one for the briefs',\n },\n new: {\n options: {\n id: { type: 'string' },\n type: { type: 'string' },\n wave: { type: 'string' },\n 'depends-on': { type: 'string' },\n date: { type: 'string' },\n },\n formats: ['pretty', 'json'],\n },\n lint: { options: {}, formats: FORMATS },\n list: { options: { ready: { type: 'boolean' }, archived: { type: 'boolean' } }, formats: ['pretty', 'json'], noArgument: '' },\n matrix: { options: { 'all-waves': { type: 'boolean' } }, formats: FORMATS, noArgument: '' },\n schedule: { options: { write: { type: 'boolean' } }, formats: FORMATS, noArgument: '' },\n archive: {\n options: {\n pr: { type: 'string' },\n commit: { type: 'string' },\n base: { type: 'string' },\n summary: { type: 'string' },\n date: { type: 'string' },\n 'allow-dirty': { type: 'boolean' },\n 'dry-run': { type: 'boolean' },\n },\n formats: ['pretty', 'json'],\n },\n unarchive: { options: { 'dry-run': { type: 'boolean' } }, formats: ['pretty', 'json'] },\n};\n\n/**\n * Whether taking the option would tell someone what is not so. `init\n * --strict` says the briefs were set up strictly, where nothing was strict;\n * `init --config team.json` that the configuration was written there, where\n * `.spec-brief.json` was; `init --color` and `new --color` that colour was\n * printed, where neither prints any; `new --strict` and `list --strict` that\n * a warning would have failed the run, where neither has one. Each ran as\n * the line without the option does, exit 0.\n *\n * A function, not a table beside the commands': a table built when the\n * module loads is static to Stryker, and each of its mutants then runs the\n * whole suite (ADR-0009).\n */\nfunction untrue(command: string, option: string): boolean {\n switch (option) {\n case 'config':\n return command === 'init';\n case 'strict':\n return command === 'init' || command === 'new' || command === 'list';\n case 'color':\n return command === 'init' || command === 'new';\n }\n // After the switch and not as its `default`: a `default` with its return\n // taken out answers nothing, which each caller reads as false, and no test\n // can tell that mutant from the code (ADR-0009).\n return false;\n}\n\n/**\n * Whether the option asks the command to leave out what it never does, and\n * so asks for what is already so: `init` opens no configuration file and\n * asks git nothing, and neither it nor `new` prints colour. Such an option\n * is taken. A script that runs every command in a tree without git, or into\n * a log, passes it to each of them, as spec-harness passes `--no-color`.\n * The command reads nothing of it, so a refusal's line lists it apart from\n * what the command reads, as taken.\n */\nfunction alreadySo(command: string, option: string): boolean {\n switch (option) {\n case 'no-config':\n case 'no-git':\n return command === 'init';\n case 'no-color':\n return command === 'init' || command === 'new';\n }\n // After the switch, for the reason `untrue` has.\n return false;\n}\n\n/** Options by their names on the command line, as a sentence lists them. */\nfunction listed(names: readonly string[]): string {\n const options = names.map((name) => `--${name}`);\n return options.length === 1 ? (options[0] as string) : `${options.slice(0, -1).join(', ')} and ${options.at(-1)!}`;\n}\n\n/**\n * Why a command line that parsed is still not one to run.\n *\n * An option is refused where taking it would tell someone what is not so,\n * and so are two options of which one would go unread: `--config team.json\n * --no-config` says the file was read, where the defaults ran, and `--color\n * --no-color` that colour was forced on, where it was off. An option that\n * asks a command to leave out what it never does asks for what is already\n * so, and is taken.\n */\nfunction unread(command: string, spec: CommandSpec, values: Values): string | null {\n // The first such option as the line was typed, which is the order the\n // parser keeps.\n const stray = Object.keys(values).find((option) => untrue(command, option));\n if (stray !== undefined) {\n const shared = Object.keys(GLOBAL).filter((option) => option !== 'help' && option !== 'version' && !untrue(command, option));\n const reads = [...shared.filter((option) => !alreadySo(command, option)), ...Object.keys(spec.options)];\n const takes = shared.filter((option) => alreadySo(command, option));\n return `${command} does not read --${stray}; it reads ${listed(reads)}${takes.length > 0 ? `, and takes ${listed(takes)}` : ''}`;\n }\n if (text(values, 'config') !== undefined && flag(values, 'no-config')) {\n return '--config is given beside --no-config, which has the run read no configuration file; give one of the two';\n }\n if (flag(values, 'color') && flag(values, 'no-color')) return '--color is given beside --no-color, which turns colour off; give one of the two';\n // The engine refuses the pair as well, for a caller of the library; here it\n // is refused with the line, where --help and --version are no way past it.\n if (flag(values, 'no-git') && (text(values, 'commit') !== undefined || text(values, 'base') !== undefined)) {\n return 'a commit or a base needs git; drop --no-git, or drop --commit and --base';\n }\n return null;\n}\n\n/**\n * A resolved path as two values of one option compare. On Windows a drive\n * letter names its volume in either case, and a path resolved there starts\n * with its drive letter or a backslash, so its first character is folded;\n * the rest is compared as resolved (spec-core ADR-0005, amended 2026-10-19).\n * A path written `\\\\?\\c:\\x` keeps its letter as written.\n */\nexport function onVolume(path: string, platform: string = process.platform): string {\n // Folded to either case, two letters compare the same, and the folded path is never shown.\n return platform === 'win32' ? `${path.charAt(0).toUpperCase()}${path.slice(1)}` : path;\n}\n\n/**\n * An option's value as the command reads it, so that one thing written two\n * ways is asked for once: a directory as the run resolves it, its drive\n * letter in either case, a number by what its digits count, a list by the\n * set of ids it names, each as a brief's id is matched, a summary as it is\n * trimmed. Any other value is read as it is written, in its own case, which\n * is how each of those options reads it. A revision is read by git, which\n * the run asks once there are two (`sameCommits`).\n */\nfunction asRead(option: string, value: string, root: string): string {\n switch (option) {\n case 'root':\n return onVolume(resolve(value));\n case 'config':\n return onVolume(resolve(root, value));\n case 'wave':\n case 'pr':\n return String(digits(value) ?? value);\n case 'depends-on':\n // `7` and `007` name one brief, and `8,7` the briefs `7,8` does.\n return JSON.stringify([...new Set(idsOf(value).map(idKey))].sort());\n case 'summary':\n return value.trim();\n case 'briefs':\n case 'archive':\n // Last: one outside the repository leaves the switch and is read as it\n // was written, for `directories` to refuse by what it was given. A catch\n // that returned it would have a mutant, its return taken out, that fell\n // into the next case and read it the same, which no test can tell apart.\n try {\n return normalisePath(value);\n } catch {}\n }\n // After the switch, for the reason `untrue` has.\n return value;\n}\n\n/** The refusal of an option given two values, each shown as JSON, as an empty value is, where what cannot be seen can be. */\nfunction twoValues(option: string, first: string, second: string): string {\n return `--${option} is given ${JSON.stringify(first)} and ${JSON.stringify(second)}, and takes one value; give one of the two`;\n}\n\n/**\n * Why a line that gives one option two values is not one to run: the later\n * was read, and the earlier went unread with no word of it, so `--root\n * nowhere --root .` ran in `.` (spec-core ADR-0005, amended 2026-10-18).\n * Two revisions written two ways are kept in `revisions`, where it is\n * given, for git to say whether they name one commit.\n */\nfunction twice(options: readonly OptionToken[], values: Values, cwd: string, revisions: Map<string, string[]> | null): string | null {\n // A configuration is found from the root, as the engine finds it.\n const root = resolve(text(values, 'root') ?? cwd);\n const first = new Map<string, { readonly written: string; readonly read: string }>();\n for (const token of options) {\n // A flag has no value to compare, and one given twice is that flag once.\n // Taken in here it would be read as nothing each time, which decides\n // nothing either: the mutant that takes it in is equivalent.\n if (token.value === undefined) continue;\n const read = asRead(token.name, token.value, root);\n const earlier = first.get(token.name);\n if (earlier === undefined) first.set(token.name, { written: token.value, read });\n else if (earlier.read !== read) {\n if (revisions === null || (token.name !== 'commit' && token.name !== 'base')) return twoValues(token.name, earlier.written, token.value);\n revisions.set(token.name, [...(revisions.get(token.name) ?? [earlier.written]), token.value]);\n }\n }\n return null;\n}\n\n/**\n * `--help` beside `--version` asks for two answers, and printed one of\n * them; the other went unread. Named as each was written, `-h` or `--help`.\n */\nfunction answers(options: readonly OptionToken[]): string | null {\n let asked: OptionToken | undefined;\n for (const token of options) {\n if (token.name !== 'help' && token.name !== 'version') continue;\n if (asked === undefined) asked = token;\n else if (asked.name !== token.name) return `${asked.rawName} is given beside ${token.rawName}, and one of the two answers would go unread; give one of the two`;\n }\n return null;\n}\n\n/**\n * What a command's own options hold, refused where the line is read, by what\n * each holds: a number, a list of ids, a date, a revision, a directory, and a\n * second brief where a command takes one. What only the tree can answer - a\n * root that is not there, an id that is taken, a type the configuration does\n * not have - is asked by the run, which `--help` and `--version` do not start.\n */\nfunction checkValues(command: string | undefined, values: Values, positionals: readonly string[]): void {\n integer(values, 'wave', 0);\n integer(values, 'pr', 1);\n dependencies(values);\n const date = text(values, 'date');\n if (date !== undefined && !isDate(date)) throw new UsageError(`\"${date}\" is not a date written YYYY-MM-DD`);\n for (const option of ['commit', 'base']) {\n // Handed to git, it would be read as one of git's options.\n const revision = text(values, option);\n if (revision?.startsWith('-') === true) throw new UsageError(`\"${revision}\" is not a revision`);\n }\n // Only init takes --briefs and --archive; for any other command they are\n // the defaults, which are two directories inside the root.\n directories(values);\n if ((command === 'archive' || command === 'unarchive') && positionals.length > 1) {\n throw new UsageError(`${command} takes one brief: spec-brief ${command} <brief>`);\n }\n}\n\n/**\n * The commands by name, and nothing for a command line that names none. A map,\n * because an object answers to more names than it was given: `constructor` and\n * `toString` are no commands.\n */\nconst COMMANDS: ReadonlyMap<string | undefined, CommandSpec> = new Map(Object.entries(TABLE));\n\n/**\n * The formats each command writes, read from the table `main` checks a\n * `--format` against, so the help names no format a command refuses: the\n * finding formats are `lint`'s, `matrix`'s and `schedule`'s alone.\n */\nfunction formatsHelp(): string {\n const groups = new Map<string, string[]>();\n for (const [command, spec] of Object.entries(TABLE)) {\n const formats = spec.formats.join(', ');\n groups.set(formats, [...(groups.get(formats) ?? []), command]);\n }\n const rows = [...groups].map(([formats, commands]): readonly [string, string] => [commands.join(', '), formats]);\n const width = Math.max(...rows.map(([commands]) => commands.length));\n return rows.map(([commands, formats]) => ` ${commands.padEnd(width)} ${formats}`).join('\\n');\n}\n\nexport const HELP = `spec-brief - lint, schedule and archive task briefs\n\nUsage:\n spec-brief <command> [options]\n\nCommands:\n init write .spec-brief.json and the brief directories\n new <title> scaffold a brief with the next free id\n lint [brief...] check briefs against the configuration\n list briefs with their status, wave and readiness\n matrix scope collisions between briefs in the same wave\n schedule the waves the live briefs can run in, computed\n archive <brief> close a round: check it, stamp it, freeze it, move it\n unarchive <brief> reopen an archived brief\n\nOptions for every command, except where a line says otherwise:\n --root <dir> run from this directory instead of the current one; it must exist, unless init makes it\n --config <file> use this configuration file; not for init, which writes .spec-brief.json\n --no-config use the defaults, ignoring any configuration file\n --format <format> the output format, pretty by default; each command's are below\n --strict treat warnings as errors; not for init, new or list, which have none\n --no-git leave git out; read the files on disk instead\n --color, --no-color force colour on or off; --color not for init or new, which print none\n -h, --help show this help\n -v, --version show the version\n\nFormats:\n${formatsHelp()}\n\ninit:\n --briefs <dir> the directory of live briefs; default briefs\n --archive <dir> the directory of archived briefs; default <briefs>/archive\n\nnew:\n --id <id> use this id instead of the next free one\n --type <type> a brief type from the configuration\n --wave <n> the wave it runs in\n --depends-on <ids> comma-separated ids it runs after\n --date <YYYY-MM-DD> the date in its front matter; default SOURCE_DATE_EPOCH's, or today's in UTC\n\nlist:\n --ready only briefs that can run now: dependencies archived, not drafts or deferred\n --archived include archived briefs\n\nmatrix:\n --all-waves compare every live brief, whatever its wave\n\nschedule:\n --write write each proposed wave into its brief's front matter\n\narchive:\n --pr <number> the pull request the round merged in\n --commit <rev> the commit the round landed as\n --base <rev> the branch it started from; the diff runs from the merge base\n --summary <text> what the round did, for the banner\n --date <YYYY-MM-DD> the archival date; default SOURCE_DATE_EPOCH's, or today's in UTC\n --allow-dirty archive although the tree has uncommitted work\n --dry-run print the plan and change nothing\n\nunarchive:\n --dry-run print the plan and change nothing\n\nAn option given an empty value, a list that names nothing and an argument a\ncommand does not take are refused, not read as if they were not there. So is\nan option where taking it would say what is not so, as init --strict, and so\nare --config beside --no-config and --color beside --no-color, of which one\nwould go unread. An option that asks a command to leave out what it never\ndoes is taken, as init --no-git: it asks for what is already so.\n\nAn option that takes one value and is given two is refused, as --root a\n--root b, since the earlier would go unread; one value given twice, however\nit is written, is taken once, as --root . --root ./. A line refused for any\nof these is refused with --help or --version on it too, and so is --help\nbeside --version.\n\nExit codes: 0 clean, 1 findings or refused, 2 the run could not be trusted.\n`;\n\ninterface Parsed {\n readonly command: string | undefined;\n readonly values: Values;\n readonly positionals: readonly string[];\n /** Each option's revisions as they were written, where two are written two ways, for git to read. */\n readonly revisions: ReadonlyMap<string, readonly string[]>;\n}\n\n/** Global options that take a value, so the value is not mistaken for the command. */\nconst VALUED = new Set(['--root', '--config', '--format']);\n\nfunction commandOf(argv: readonly string[]): string | undefined {\n for (let i = 0; i < argv.length; i += 1) {\n const arg = argv[i] as string;\n if (arg === '--') return argv[i + 1];\n if (VALUED.has(arg)) {\n i += 1;\n continue;\n }\n if (!arg.startsWith('-')) return arg;\n }\n return undefined;\n}\n\n/**\n * The line, read and checked. Everything the line alone decides is refused\n * here, before `--help` and `--version` are answered, as an option the\n * parser does not know always was: a wrong line is wrong with either of them\n * on it (spec-core ADR-0005, amended 2026-10-18). `cwd` is the directory a\n * run without `--root` starts in, from which a `--config` is found.\n */\nexport function parse(argv: readonly string[], cwd: string = process.cwd()): Parsed {\n const command = commandOf(argv);\n const spec = COMMANDS.get(command);\n if (command !== undefined && spec === undefined) {\n throw new UsageError(`\"${command}\" is not a command; run spec-brief --help`);\n }\n let parsed: { values: Values; positionals: string[]; tokens: Token[] };\n try {\n const read = parseArgs({\n args: [...argv],\n options: { ...GLOBAL, ...(spec?.options ?? {}) },\n allowPositionals: true,\n strict: true,\n tokens: true,\n });\n // The cast stands on the name, with nothing under it: Stryker makes no\n // mutant of what an `as` holds, and the call above is what the parser\n // is asked (ADR-0009).\n parsed = read as { values: Values; positionals: string[]; tokens: Token[] };\n } catch (error) {\n throw new UsageError((error as Error).message);\n }\n const positionals = parsed.positionals.slice(1);\n // What the parser takes is not yet what names something. An option whose\n // value is empty, as `--root \"$DIR\"` is where the variable is not set, was\n // read as the option left out, and an argument no command asked for was\n // dropped: either way the run answered a question nobody had put, exit 0.\n for (const [name, value] of Object.entries(parsed.values)) {\n if (typeof value === 'string' && value.trim() === '') {\n // Shown as JSON, where a tab or a line break in it can be seen.\n throw new UsageError(`--${name} is ${JSON.stringify(value)}, which is no value; give it one, or leave the option out`);\n }\n }\n if (spec?.noArgument !== undefined && positionals.length > 0) {\n const extra = positionals.map((argument) => `\"${argument}\"`).join(', ');\n throw new UsageError(`${command} takes no argument, not ${extra}: spec-brief ${command}${spec.noArgument}`);\n }\n const options = parsed.tokens.filter((token): token is OptionToken => token.kind === 'option');\n // Two revisions written two ways are git's to read, by the run: `--help`\n // and `--version` start none, and `--no-git` asks git nothing, so with\n // any of the three they are two values, as the line reads them.\n const revisions = flag(parsed.values, 'help') || flag(parsed.values, 'version') || flag(parsed.values, 'no-git') ? null : new Map<string, string[]>();\n const refusal =\n twice(options, parsed.values, cwd, revisions) ??\n answers(options) ??\n (spec === undefined ? null : (unread(command!, spec, parsed.values) ?? unwritten(command!, spec, parsed.values)));\n if (refusal !== null) throw new UsageError(refusal);\n checkValues(command, parsed.values, positionals);\n return { command, values: parsed.values, positionals, revisions: revisions ?? new Map() };\n}\n\n/**\n * Two revisions of one option are one value where the run's git says both\n * name one commit, and two where it names two, or cannot say of one: with\n * no repository, outside one, or for a revision that names none. It is asked\n * once, for every revision of both options.\n */\nasync function sameCommits(engine: BriefEngine, revisions: ReadonlyMap<string, readonly string[]>): Promise<void> {\n // Asked nothing, a git process answers nothing: the mutant that starts one is equivalent.\n if (revisions.size === 0) return;\n const asked = [...revisions.values()].flat();\n // A git a caller of the library hands the engine may have no `commits`;\n // the command line's is always NodeGit's, which has, so the mutant that\n // calls it without asking is equivalent here.\n const named = await engine.git?.commits?.(asked);\n const commitOf = new Map(asked.map((revision, index) => [revision, named?.[index] ?? null]));\n for (const [option, [first, ...later]] of revisions) {\n const commit = commitOf.get(first!) ?? null;\n const other = later.find((revision) => commit === null || commitOf.get(revision) !== commit);\n if (other !== undefined) throw new UsageError(twoValues(option, first!, other));\n }\n}\n\n/** A `--format` the command does not write, which the help lists by command. */\nfunction unwritten(command: string, spec: CommandSpec, values: Values): string | null {\n const asked = text(values, 'format') ?? 'pretty';\n // Cast on the name, as above. The check below is what makes it true.\n const format = asked as Format;\n return spec.formats.includes(format) ? null : `--format for ${command} is one of ${spec.formats.join(', ')}, not \"${format}\"`;\n}\n\n/** The value of an option declared a string, which is all `parseArgs` gives one. */\nfunction text(values: Values, key: string): string | undefined {\n return values[key] as string | undefined;\n}\n\nfunction flag(values: Values, key: string): boolean {\n return values[key] === true;\n}\n\n/** The number a value's digits count, or nothing for a value that is not digits alone. */\nfunction digits(raw: string): number | undefined {\n return /^\\d+$/.test(raw) ? Number(raw) : undefined;\n}\n\nfunction integer(values: Values, key: string, minimum: number): number | undefined {\n const raw = text(values, key);\n if (raw === undefined) return undefined;\n const number = digits(raw);\n if (number === undefined || number < minimum) throw new UsageError(`--${key} must be a whole number of at least ${minimum}, not \"${raw}\"`);\n return number;\n}\n\n/** The ids of a list written with commas between them, spaces beside each taken off. */\nfunction idsOf(listed: string): string[] {\n return listed.split(',').map((id) => id.trim());\n}\n\n/** `--depends-on` as the ids it names, or nothing where it is not given. */\nfunction dependencies(values: Values): string[] | undefined {\n const listed = text(values, 'depends-on');\n const dependsOn = listed === undefined ? undefined : idsOf(listed);\n // A list that names no brief is not a brief that depends on none: written\n // as given, \",\" scaffolded a brief with no dependency and said nothing.\n if (dependsOn?.every((d) => d === '')) {\n throw new UsageError(`--depends-on is ${JSON.stringify(listed)}, which names no brief; give it ids with commas between them, as in 7,8, or leave the option out`);\n }\n // And a place in it that names none is a brief left out: \"$A,$B\" with one\n // of the two unset scaffolded a brief that depends on the other alone.\n if (dependsOn?.includes('')) {\n throw new UsageError(`--depends-on is ${JSON.stringify(listed)}, which names no brief in one of its places; give it ids with one comma between each two, as in 7,8, and none before or after`);\n }\n return dependsOn;\n}\n\n/**\n * The directories `init` sets up. One above the root is refused as the\n * configuration refuses one (config.ts), in the same words, before anything\n * is written.\n */\nfunction directories(values: Values): { readonly briefs: string; readonly archive: string } {\n const inside = (option: string, given: string): string => {\n try {\n return normalisePath(given);\n } catch {\n throw new UsageError(`--${option} must be a directory inside the repository, not \"${given}\"`);\n }\n };\n const briefs = inside('briefs', text(values, 'briefs') ?? 'briefs');\n const archive = inside('archive', text(values, 'archive') ?? `${briefs}/archive`);\n if (briefs === '' || archive === '' || briefs === archive) throw new UsageError('--briefs and --archive must be two directories');\n return { briefs, archive };\n}\n\nasync function version(): Promise<string> {\n // `JSON.parse` reads a file's bytes as it reads their text in UTF-8, so the\n // encoding says what the manifest is and decides nothing: with none named,\n // the version read is the same, and no test can tell the two apart.\n const pkg: { version: string } = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));\n return pkg.version;\n}\n\ninterface Run {\n /**\n * Today, as the environment the run was given says. Asked only by a command\n * that writes a date and was given none: a `SOURCE_DATE_EPOCH` that cannot\n * be read stops the run that would have written the clock's date for it,\n * and no run whose answer it has no part in.\n */\n readonly today: () => string;\n readonly out: (text: string) => void;\n readonly err: (text: string) => void;\n readonly style: Style;\n readonly format: Format;\n readonly strict: boolean;\n readonly version: string;\n readonly values: Values;\n readonly positionals: readonly string[];\n readonly revisions: ReadonlyMap<string, readonly string[]>;\n readonly cwd: string;\n}\n\nfunction useColor(values: Values, io: CliIO): boolean {\n if (flag(values, 'no-color')) return false;\n if (flag(values, 'color')) return true;\n const env = io.env ?? process.env;\n if ((env['NO_COLOR'] ?? '') !== '') return false;\n // Off for exactly \"0\" and exactly \"false\": Node itself and supports-color\n // read \"false\" as off, and here it forced colour on. Any other value that\n // is not empty is on, \"FALSE\" too, which is the one reading the family's\n // tools share (spec-core ADR-0005).\n const force = env['FORCE_COLOR'];\n if (force !== undefined && force !== '') return force !== '0' && force !== 'false';\n // A terminal that says it is dumb has asked for no escape sequence, and\n // Node itself counts one colour for it: the family's tools read it alike.\n if (env['TERM'] === 'dumb') return false;\n return (io.stdout ?? process.stdout).isTTY === true;\n}\n\n/** The engine for a run, which asks git nothing where `needsGit` is false and a configuration file names the root. */\nasync function openEngine(run: Run, needsGit = true): Promise<BriefEngine> {\n return BriefEngine.open({\n cwd: text(run.values, 'root') ?? run.cwd,\n config: text(run.values, 'config'),\n ...(flag(run.values, 'no-git') ? { git: null } : {}),\n noConfig: flag(run.values, 'no-config'),\n needsGit,\n });\n}\n\nfunction emitFindings(run: Run, command: string, findings: readonly Finding[], checked: number, extra: Record<string, unknown> = {}): number {\n const failed = failing(findings, run.strict);\n switch (run.format) {\n case 'json':\n run.out(jsonDocument(command, run.version, { ok: !failed, checked, summary: summarise(findings), findings: findings.map(findingJson), ...extra }));\n break;\n case 'sarif':\n run.out(sarif(findings, run.version));\n break;\n case 'github':\n run.out(githubCommands(findings));\n break;\n case 'gitlab':\n run.out(gitlabCodeQuality(findings));\n break;\n case 'pretty':\n if (findings.length > 0) run.out(`${prettyFindings(findings, run.style)}\\n\\n`);\n run.out(`${findings.length === 0 ? `${checked} brief(s) checked, no findings` : `${summaryLine(findings)} in ${checked} brief(s)`}\\n`);\n break;\n }\n return failed ? EXIT_FAILED : EXIT_OK;\n}\n\nasync function runInit(run: Run): Promise<number> {\n const root = text(run.values, 'root') ?? run.cwd;\n const fs = new NodeFileSystem(root);\n for (const name of CONFIG_FILES) {\n if (await fs.exists(name)) throw new UsageError(`${name} already exists here; edit it instead`);\n }\n const { briefs, archive } = directories(run.values);\n const config = `${JSON.stringify(initialConfig(briefs, archive), null, 2)}\\n`;\n await fs.write('.spec-brief.json', config);\n const written = ['.spec-brief.json'];\n for (const dir of [briefs, archive]) {\n const keep = `${dir}/.gitkeep`;\n if ((await fs.list(dir)) === null) {\n await fs.write(keep, '');\n written.push(keep);\n }\n }\n if (run.format === 'json') run.out(jsonDocument('init', run.version, { ok: true, written }));\n else run.out(`${written.map((w) => `wrote ${w}`).join('\\n')}\\nnext: spec-brief new \"<title>\"\\n`);\n return EXIT_OK;\n}\n\nasync function runNew(run: Run): Promise<number> {\n const title = run.positionals.join(' ').trim();\n if (title === '') throw new UsageError('new needs a title: spec-brief new \"<title>\"');\n const dependsOn = dependencies(run.values);\n const engine = await openEngine(run);\n const created = await engine.create({\n title,\n id: text(run.values, 'id'),\n type: text(run.values, 'type'),\n wave: integer(run.values, 'wave', 0),\n dependsOn,\n date: text(run.values, 'date') ?? run.today(),\n });\n if (run.format === 'json') run.out(jsonDocument('new', run.version, { ok: true, file: created.file }));\n else run.out(`wrote ${created.file}\\n`);\n return EXIT_OK;\n}\n\nasync function runLint(run: Run): Promise<number> {\n const engine = await openEngine(run);\n engine.requireBriefs();\n const findings = await engine.lint(run.positionals);\n const checked = run.positionals.length === 0 ? engine.corpus.briefs.length : run.positionals.length;\n return emitFindings(run, 'lint', findings, checked, { sections: sectionsJson(engine.config) });\n}\n\nasync function runList(run: Run): Promise<number> {\n // Nothing `list` answers is read from git, so git is asked nothing where\n // the root is a configuration file's, and the answer can say so.\n const engine = await openEngine(run, false);\n engine.requireBriefs();\n const briefs = flag(run.values, 'archived') ? engine.corpus.briefs : engine.corpus.live;\n const ready = new Set(engine.ready());\n const rows: ListRow[] = briefs\n .map((brief) => ({ brief, ready: ready.has(brief), waitingOn: engine.waitingOn(brief) }))\n .filter((row) => !flag(run.values, 'ready') || row.ready);\n if (run.format === 'json') {\n const { keep, ...read } = engine.inputs();\n run.out(\n jsonDocument('list', run.version, {\n ok: true,\n briefs: rows.map((r) => briefJson(r.brief, { ready: r.ready, waitingOn: r.waitingOn })),\n sections: sectionsJson(engine.config),\n // What the answer was read from, for a tool that would give it again\n // without starting this one, and the version that read it.\n inputs: { keep, tool: run.version, ...read },\n }),\n );\n } else {\n run.out(`${prettyList(rows, run.style)}\\n`);\n }\n return EXIT_OK;\n}\n\nasync function runMatrix(run: Run): Promise<number> {\n const engine = await openEngine(run);\n engine.requireBriefs();\n const { report, findings } = await engine.collisions({ all: flag(run.values, 'all-waves') });\n const sorted = sortFindings(findings);\n if (run.format === 'pretty') {\n // Drawn from what the run reports, so a rule that is off marks nothing in the grid.\n run.out(`${prettyMatrix(reported(engine.corpus, report), run.style)}\\n`);\n return failing(sorted, run.strict) ? EXIT_FAILED : EXIT_OK;\n }\n return emitFindings(run, 'matrix', sorted, engine.corpus.live.length, matrixJson(report));\n}\n\n/**\n * The waves, computed. The view shows the moves, their reasons and the\n * cycles; the other findings - briefs that run alone, pairs the search could\n * not decide, a front matter that cannot take a wave - print beneath it.\n */\nasync function runSchedule(run: Run): Promise<number> {\n const engine = await openEngine(run);\n engine.requireBriefs();\n const { schedule: computed, findings } = await engine.schedule();\n let written: string[] | null = null;\n let reported: Finding[] = findings;\n if (flag(run.values, 'write')) {\n const result = await engine.writeWaves(computed);\n written = result.written;\n // Written, the waves hold, and the findings that said they did not are answered.\n reported = [...(written.length > 0 ? findings.filter((f) => f.rule !== 'wave-schedule') : findings), ...result.refused];\n }\n const sorted = sortFindings(reported);\n if (run.format === 'pretty') {\n run.out(`${prettySchedule(computed, written, run.style)}\\n`);\n const rest = sorted.filter((f) => f.rule !== 'wave-schedule' && f.rule !== 'dependency-cycle');\n if (rest.length > 0) run.out(`\\n${prettyFindings(rest, run.style)}\\n`);\n return failing(sorted, run.strict) ? EXIT_FAILED : EXIT_OK;\n }\n return emitFindings(run, 'schedule', sorted, engine.corpus.live.length, { ...scheduleJson(computed), written });\n}\n\nasync function runTransition(run: Run, action: 'archive' | 'unarchive'): Promise<number> {\n const reference = run.positionals[0];\n // A second brief is refused with the line; none at all is what --help is asked for.\n if (reference === undefined) throw new UsageError(`${action} takes one brief: spec-brief ${action} <brief>`);\n const engine = await openEngine(run);\n await sameCommits(engine, run.revisions);\n const dryRun = flag(run.values, 'dry-run');\n const plan: Plan =\n action === 'archive'\n ? await engine.planArchive(reference, {\n pr: integer(run.values, 'pr', 1),\n commit: text(run.values, 'commit'),\n base: text(run.values, 'base'),\n summary: text(run.values, 'summary'),\n date: text(run.values, 'date') ?? run.today(),\n allowDirty: flag(run.values, 'allow-dirty'),\n strict: run.strict,\n // No noGit: under --no-git the engine is opened without git, and a\n // commit or a base beside it is refused with the line.\n })\n : engine.planUnarchive(reference, { strict: run.strict });\n const refused = plan.blocking.length > 0;\n if (!refused && !dryRun) await engine.apply(plan);\n if (run.format === 'json') run.out(jsonDocument(action, run.version, { ok: !refused, dryRun, plan: planJson(plan) }));\n else run.out(`${prettyPlan(plan, dryRun, run.style)}\\n`);\n return refused ? EXIT_FAILED : EXIT_OK;\n}\n\nexport async function main(argv: readonly string[] = process.argv.slice(2), io: CliIO = {}): Promise<number> {\n const stdout = io.stdout ?? process.stdout;\n const stderr = io.stderr ?? process.stderr;\n const err = (message: string): void => {\n stderr.write(`spec-brief: ${message}\\n`);\n };\n let parsed: Parsed;\n try {\n parsed = parse(argv, io.cwd ?? process.cwd());\n } catch (error) {\n err((error as Error).message);\n return EXIT_ERROR;\n }\n const { command, values, positionals, revisions } = parsed;\n // From here on, so that what comes before a command is covered as the\n // command is: --version and --help, the package's own manifest, the colour.\n // An error there left main as a rejection, which the launcher ended as\n // Node's uncaught error with exit 1, \"findings\" to a script.\n try {\n if (flag(values, 'version')) {\n stdout.write(`${await version()}\\n`);\n return EXIT_OK;\n }\n if (flag(values, 'help') || command === undefined) {\n stdout.write(HELP);\n // Asked for, the help is the answer; printed because no command was named, it is the error.\n return flag(values, 'help') ? EXIT_OK : EXIT_ERROR;\n }\n const asked = text(values, 'format') ?? 'pretty';\n // Cast on the name, as in `parse`, which refused a format the command does not write.\n const format = asked as Format;\n // A file, or a name with nothing behind it, had the search for a\n // configuration go on from its parent: the run reported on a tree nobody\n // had named, and `new` wrote into it. A path that cannot be reached is\n // not there to the run either. `init` alone is given a directory that\n // does not exist yet, which it makes.\n const root = text(values, 'root');\n if (root !== undefined) {\n const found = await stat(root).catch(() => null);\n if (found === null ? command !== 'init' : !found.isDirectory()) {\n throw new UsageError(`--root is \"${root}\", which is no directory; give it one, or leave the option out`);\n }\n }\n const run: Run = {\n today: () => today(io.env ?? process.env),\n out: (t) => {\n stdout.write(t);\n },\n err,\n // Read by the pretty format alone: the others have nothing to colour.\n style: { color: useColor(values, io) },\n format,\n strict: flag(values, 'strict'),\n version: await version(),\n values,\n positionals,\n revisions,\n cwd: io.cwd ?? process.cwd(),\n };\n switch (command) {\n case 'init':\n return await runInit(run);\n case 'new':\n return await runNew(run);\n case 'lint':\n return await runLint(run);\n case 'list':\n return await runList(run);\n case 'matrix':\n return await runMatrix(run);\n case 'schedule':\n return await runSchedule(run);\n case 'archive':\n return await runTransition(run, 'archive');\n default:\n return await runTransition(run, 'unarchive');\n }\n } catch (error) {\n // What git refused or could not do is git's message, and no line here.\n const expected = [ConfigError, UsageError, EngineError, ConflictError, TransactionError, GitError];\n if (expected.some((kind) => error instanceof kind)) {\n err((error as Error).message);\n return EXIT_ERROR;\n }\n // A write its reader had closed the pipe for is no defect either: the\n // answer was not delivered, which is still 2, and no stack sends a person\n // looking for a bug. The process's own streams report it as an event,\n // which the launcher answers in the same words; here it is a caller's\n // stream that throws it. It is read by its code: stdout and stderr are the\n // only pipes spec-brief writes to.\n if (!(error instanceof Error)) err(`unexpected error: ${String(error)}`);\n else if ((error as NodeJS.ErrnoException).code === 'EPIPE') err('stdout was closed before all of the output was written');\n else err(`unexpected error: ${error.stack ?? error.message}`);\n return EXIT_ERROR;\n }\n}\n"]}
package/dist/engine.d.ts CHANGED
@@ -42,6 +42,36 @@ export interface OpenOptions {
42
42
  /** `null` runs without git. Defaults to git when the root is inside a working tree. */
43
43
  readonly git?: Git | null;
44
44
  readonly fs?: FileSystem;
45
+ /**
46
+ * `false` where nothing the caller asks of the engine reads git, as `list`
47
+ * asks it nothing: where a configuration file names the root, git is then
48
+ * not asked where the work tree's top is, and the engine has no git.
49
+ * Without one, git is still asked, since its answer is the root.
50
+ */
51
+ readonly needsGit?: boolean;
52
+ }
53
+ /**
54
+ * Everything an answer was read from, for a tool that would give it again
55
+ * without starting spec-brief (ADR-0002, amended 2026-10-19). Each file is
56
+ * named with the SHA-256 of its bytes, or `null` where it was looked for and
57
+ * was not there; each directory with the names of the files in it, sorted,
58
+ * or `null` where there was no directory to list. Each `null` is a path
59
+ * that must still not be there. Paths are from the root, which wherever `keep` is true is the directory
60
+ * the run started in. `git` is `null`, since no answer named here asks git
61
+ * anything. `keep` is `false`, and the lists are empty, wherever that cannot
62
+ * be named whole.
63
+ */
64
+ export interface Inputs {
65
+ readonly keep: boolean;
66
+ readonly files: readonly {
67
+ readonly path: string;
68
+ readonly sha256: string | null;
69
+ }[];
70
+ readonly directories: readonly {
71
+ readonly path: string;
72
+ readonly entries: readonly string[] | null;
73
+ }[];
74
+ readonly git: null;
45
75
  }
46
76
  export interface ArchiveOptions {
47
77
  readonly pr?: number | undefined;
@@ -85,6 +115,13 @@ export declare class BriefEngine {
85
115
  readonly git: Git | null;
86
116
  private plugins;
87
117
  private loaded;
118
+ /**
119
+ * What the engine has read, where `open` made it, and whether that is
120
+ * every input of an answer made of the briefs and the configuration alone.
121
+ * Set false by a read that is not on it: the files git or a walk lists,
122
+ * and a plugin's module.
123
+ */
124
+ private reading;
88
125
  /** Known once the briefs are read, which every command does before it asks. */
89
126
  private missingBriefs;
90
127
  constructor(setup: EngineSetup);
@@ -127,6 +164,12 @@ export declare class BriefEngine {
127
164
  written: string[];
128
165
  refused: Finding[];
129
166
  }>;
167
+ /**
168
+ * Every input of an answer made of the briefs and the configuration alone,
169
+ * as `list` gives one, read since the engine was opened (ADR-0002, amended
170
+ * 2026-10-19).
171
+ */
172
+ inputs(): Inputs;
130
173
  /** Live briefs that can run now: every dependency archived, and neither a draft nor deferred. */
131
174
  ready(): Brief[];
132
175
  /** The live dependencies holding a brief back. */
package/dist/engine.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * Everything they compose is a pure function that takes those as arguments,
9
9
  * so an engine can equally run over a `MemoryFileSystem` and no git at all.
10
10
  */
11
- import { access } from 'node:fs/promises';
11
+ import { access, stat } from 'node:fs/promises';
12
12
  import { basename, dirname, relative, resolve, sep } from 'node:path';
13
13
  import { applyPlan } from './apply.js';
14
14
  import { applyWaivers, planArchive, planUnarchive, WAIVABLE, } from './archive.js';
@@ -105,6 +105,13 @@ export class BriefEngine {
105
105
  git;
106
106
  plugins;
107
107
  loaded;
108
+ /**
109
+ * What the engine has read, where `open` made it, and whether that is
110
+ * every input of an answer made of the briefs and the configuration alone.
111
+ * Set false by a read that is not on it: the files git or a walk lists,
112
+ * and a plugin's module.
113
+ */
114
+ reading;
108
115
  /** Known once the briefs are read, which every command does before it asks. */
109
116
  missingBriefs;
110
117
  constructor(setup) {
@@ -124,19 +131,38 @@ export class BriefEngine {
124
131
  // Named as git names them, so the root and the work tree compare.
125
132
  const cwd = await canonicalPath(resolve(options.cwd ?? process.cwd()));
126
133
  const explicit = options.config === undefined ? undefined : await canonicalPath(resolve(cwd, options.config));
127
- const configPath = options.noConfig === true ? undefined : (explicit ?? (await locateConfig(cwd, exists)));
128
- // Asking git costs a process; without git there is nothing to ask.
129
- const toplevel = options.git === null ? null : await NodeGit.toplevel(cwd);
134
+ // Each name looked for, so that an answer can say which were not there.
135
+ const looked = [];
136
+ const configPath = options.noConfig === true
137
+ ? undefined
138
+ : (explicit ??
139
+ (await locateConfig(cwd, (path) => {
140
+ looked.push(path);
141
+ return exists(path);
142
+ })));
143
+ // Asking git costs a process; without git there is nothing to ask, and
144
+ // with a root a configuration file names nothing to ask it where the
145
+ // caller reads no git.
146
+ const asksGit = options.git !== null && (configPath === undefined || options.needsGit !== false);
147
+ const toplevel = asksGit ? await NodeGit.toplevel(cwd) : null;
130
148
  const root = configPath === undefined ? (toplevel ?? cwd) : dirname(configPath);
149
+ const reads = { files: new Map(), directories: new Map() };
150
+ // Each is named as not there, and the one found again by its read below.
151
+ // Wherever an answer is kept, each was looked for in the root itself, so
152
+ // its path from there is its name.
153
+ for (const path of looked)
154
+ reads.files.set(relative(root, path), null);
131
155
  let config = DEFAULT_CONFIG;
132
156
  if (configPath !== undefined) {
133
- const text = await new NodeFileSystem(root).read(basename(configPath)).catch((error) => {
134
- // A directory of that name, found or named with --config, is a
135
- // configuration that does not load, and no defect to report a stack for.
136
- if (error.code !== 'EISDIR')
137
- throw error;
138
- throw new ConfigError(relative(cwd, configPath), ['is a directory, not a configuration file']);
139
- });
157
+ // Only a file is read. A named pipe under the configuration's name was
158
+ // read without end, by every command; and a directory, found or named
159
+ // with --config, ended the run on Node's EISDIR. Each is a
160
+ // configuration that does not load, and no defect to report a stack for.
161
+ const found = await stat(configPath).catch(() => null);
162
+ if (found !== null && !found.isFile()) {
163
+ throw new ConfigError(relative(cwd, configPath), [`is ${found.isDirectory() ? 'a directory' : 'neither a file nor a directory'}, not a configuration file`]);
164
+ }
165
+ const text = await new NodeFileSystem(root, reads).read(basename(configPath));
140
166
  if (text === null)
141
167
  throw new EngineError('not-found', `${configPath} does not exist`);
142
168
  config = parseConfig(text, relative(cwd, configPath));
@@ -150,9 +176,18 @@ export class BriefEngine {
150
176
  config,
151
177
  // The root is the configuration's directory, so its path from there is its name.
152
178
  configFile: configPath === undefined ? null : basename(configPath),
153
- fs: options.fs ?? new NodeFileSystem(root),
179
+ fs: options.fs ?? new NodeFileSystem(root, reads),
154
180
  git: options.git === undefined ? (inTree ? new NodeGit(root) : null) : options.git,
155
181
  });
182
+ // Named whole only where each input is read from the directory the run
183
+ // started in, so that a reader finds it by the path named: the engine
184
+ // reads through its own disk, the root is that directory, and a
185
+ // configuration file there names it, or neither a configuration nor git
186
+ // was asked. A configuration not found was looked for above the root as
187
+ // well, and a root git names is decided by what git reads to find the
188
+ // top of a work tree, which no list here names.
189
+ const whole = options.fs === undefined && !asksGit && root === cwd && (configPath !== undefined || options.noConfig === true);
190
+ engine.reading = { reads, whole };
156
191
  await engine.load();
157
192
  return engine;
158
193
  }
@@ -200,6 +235,8 @@ export class BriefEngine {
200
235
  }
201
236
  /** The plugins the configuration names, loaded once. */
202
237
  async loadedPlugins() {
238
+ if (this.reading !== undefined)
239
+ this.reading.whole = false;
203
240
  this.plugins ??= await loadPlugins(this.config.plugins, this.root);
204
241
  return this.plugins;
205
242
  }
@@ -215,6 +252,8 @@ export class BriefEngine {
215
252
  }
216
253
  /** The files git sees, or every file when there is no git; `null` when neither can be read. */
217
254
  async repoFiles() {
255
+ if (this.reading !== undefined)
256
+ this.reading.whole = false;
218
257
  try {
219
258
  return this.git === null ? await this.fs.walk() : await this.git.files();
220
259
  }
@@ -247,6 +286,29 @@ export class BriefEngine {
247
286
  await this.load();
248
287
  return { written: plan.ops.map((op) => op.path), refused: [] };
249
288
  }
289
+ /**
290
+ * Every input of an answer made of the briefs and the configuration alone,
291
+ * as `list` gives one, read since the engine was opened (ADR-0002, amended
292
+ * 2026-10-19).
293
+ */
294
+ inputs() {
295
+ const reading = this.reading;
296
+ if (reading?.whole !== true)
297
+ return { keep: false, files: [], directories: [], git: null };
298
+ // Paths are unique, so no two compare equal.
299
+ const byPath = (a, b) => (a.path < b.path ? -1 : 1);
300
+ return {
301
+ keep: true,
302
+ files: [...reading.reads.files].map(([path, sha256]) => ({ path, sha256 })).sort(byPath),
303
+ // The root is "." where a briefs directory is the root itself. One that
304
+ // was not there, an archive not yet made, is named with no entries: one
305
+ // made with a brief in it changes what `list --archived` answers.
306
+ directories: [...reading.reads.directories]
307
+ .map(([path, entries]) => ({ path: path === '' ? '.' : path, entries: entries === null ? null : [...entries].sort() }))
308
+ .sort(byPath),
309
+ git: null,
310
+ };
311
+ }
250
312
  /** Live briefs that can run now: every dependency archived, and neither a draft nor deferred. */
251
313
  ready() {
252
314
  return this.corpus.live.filter((b) => isReady(this.corpus, b));