Skip to content

ticket-lint.mjs

Reads one ticket body against this repository's ticket standard and names every section that does not meet it.

Agent toolingticket-lint.mjs

What it does

Splits a body into its ## sections, ignoring headings inside fenced blocks, and checks each against tools/lib/ticket-standard.mjs. The shape it demands: one opening heading of at most 200 characters, the six sections every ticket carries, and no section written twice or named outside the standard.

It then reads the sections themselves. Every path named in Context to load and Scope must be in the tree. The Blocked by section is the literal none, or numbered ids carrying their titles. Exactly one runnable command sits in Acceptance criteria. The stamped Provenance and Request sections carry the shapes a generator writes. The generator tools/ticket-new.mjs calls this same validator before it creates anything.

Usage

Read a body out of a file, or a ticket off the Forge by its number:

bash
node tools/ticket-lint.mjs --file <path.md> [--title <title>]
node tools/ticket-lint.mjs <issue#>

Replace the following:

  • <path.md> — a file holding the body. --title supplies the title alongside it; without one, the file name stands in.
  • <issue#> — an issue number, with or without its #.

Options

FlagValueWhat it doesDefault
--filepath to a markdown fileReads the body from a file rather than from the Forge.Not read; the bare argument is an issue number.
--titletextThe title to check alongside a body read with --file.The file name without its extension.

Inputs and outputs

Reads the named file, or the issue through node tools/forge.mjs issue <n> --json, and the tree for the paths the body names. Writes nothing.

On a clean body, exit 0 and one line: ticket-lint: clean. On findings, exit 1, then one line per finding as <section>: <what is wrong>; a section the standard does not carry adds a closing line naming the sections it does. With neither a file nor an issue number, exit 2 and the usage.

Examples

Check a ticket that was filed before this standard, or edited on the Forge by hand:

bash
node tools/ticket-lint.mjs 209

Check a body still in a file, before it reaches the generator:

bash
node tools/ticket-lint.mjs --file .gwtmp/body.md --title "The repo owns its ticket standard"

Notes

A ticket filed under the earlier standard fails on its Request section, which carried four fields where this one carries a single line. That is a report about the ticket, not about the repository: nothing rewrites a body that is already on the Forge.

A path is read out of an inline code span, so a path named in bare prose is not checked. A path:line citation is carried by its path, and a glob is carried by the directory it sits in.

Source

tools/ticket-lint.mjs — part of Agent tooling

See also: tools/ticket-new.mjs the generator this refuses on behalf of