@descent-vtt/spec-graph 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +158 -0
- package/README.md +92 -9
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +241 -46
- package/dist/cli.js.map +1 -1
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -1
- package/dist/extract.js +87 -8
- package/dist/extract.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,164 @@ the family's
|
|
|
11
11
|
[versioning policy](https://github.com/DescentVTT/spec-core/blob/main/docs/adr/0009-versions-before-1-0.md)
|
|
12
12
|
records.
|
|
13
13
|
|
|
14
|
+
## 0.18.0
|
|
15
|
+
|
|
16
|
+
Two values for an option that takes one are compared as each is read, a
|
|
17
|
+
wrong command line is refused with `--help` or `--version` on it, and
|
|
18
|
+
`--help` beside `--version` is refused. A flag that asks for a family the
|
|
19
|
+
configuration ignores reads it, and a recording or a `--history` refuses
|
|
20
|
+
what it would leave unread. And a negation just before a phrase cancels
|
|
21
|
+
it, as one after it did: `Not blocked by [ADR-0002](0002.md)` was a
|
|
22
|
+
`blocked-by` edge, the opposite of its sentence.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **Two values for an option that takes one are compared as each is
|
|
27
|
+
read.** They were compared as typed, so `check --root . --root ./` was
|
|
28
|
+
refused, exit `2`, for naming one directory two ways. A path is resolved
|
|
29
|
+
now as the run reads it, a baseline from the root a `--root` names, and a
|
|
30
|
+
count is the number it reads as, so `.` beside `./`, `held.json` beside
|
|
31
|
+
`./held.json` and `1` beside `" 1"` are each one value, taken once. Two
|
|
32
|
+
that read as two are refused as before
|
|
33
|
+
([ADR-0010](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0010-configuration-belongs-to-the-repository.md)).
|
|
34
|
+
Upgrading: nothing to do; a line refused for this runs now.
|
|
35
|
+
- **A wrong command line is refused with `--help` or `--version` on it.**
|
|
36
|
+
Every refusal the command line makes of itself was answered with the help
|
|
37
|
+
or the version instead where either was on the line, as `--root a --root
|
|
38
|
+
b --help` printed the help, exit `0`: a pair beside its opposite, two
|
|
39
|
+
values, `--baseline` beside `--record-baseline`, a family asked for and
|
|
40
|
+
ignored, an option of another command, a format a command does not write,
|
|
41
|
+
`rules a b` and `diff` given three exports or an empty one. Each is exit
|
|
42
|
+
`2` now with the line it has without them, as an option nobody knows
|
|
43
|
+
always was. `query --help` and `diff --help` still print the help, and so
|
|
44
|
+
does a line only the run would refuse, `--root nowhere --help`. Upgrading:
|
|
45
|
+
where a script asks for the help or the version on a line it builds, mend
|
|
46
|
+
the line the refusal names, or ask with `--help` or `--version` alone.
|
|
47
|
+
- **`--help` beside `--version` is refused.** The help was printed and the
|
|
48
|
+
version went unread, in either order. It is exit `2` now, `--help is given
|
|
49
|
+
beside --version, and a run prints the help or the version: give one of
|
|
50
|
+
the two`; either given twice is that one once. Upgrading: ask for one of
|
|
51
|
+
the two.
|
|
52
|
+
- **`--family` reads a family the configuration's `ignoreFamilies` passes
|
|
53
|
+
over.** The list that ignores was asked first, so `check --family RFC`
|
|
54
|
+
over `"ignoreFamilies": ["RFC"]` passed over every RFC it asked for and
|
|
55
|
+
printed `the specification graph is consistent`, exit `0`, where the file
|
|
56
|
+
alone fails the check. A flag says what the run does where the file says
|
|
57
|
+
otherwise, as for every other key: the family is read now, so a check
|
|
58
|
+
that passed can fail
|
|
59
|
+
([ADR-0010](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0010-configuration-belongs-to-the-repository.md)).
|
|
60
|
+
`--ignore-family` over `"families"` passes over the family it names, as
|
|
61
|
+
before. Upgrading: run `check` with the `--family` your scripts give; a
|
|
62
|
+
citation it now reports was one the run asked for and never read.
|
|
63
|
+
- **One family under both `families` and `ignoreFamilies` is a problem in
|
|
64
|
+
the configuration.** The name under `families` read as applied and did
|
|
65
|
+
nothing: `"families": ["RFC"]` beside `"ignoreFamilies": ["rfc"]` passed
|
|
66
|
+
over every citation in prose and reported a consistent graph. It stops
|
|
67
|
+
every command now, exit `2`, `"RFC" is in both "families" and
|
|
68
|
+
"ignoreFamilies", and a family's citations are read or they are passed
|
|
69
|
+
over: take it off one of the two`. Upgrading: keep the family on the list
|
|
70
|
+
that says what the repository does with it.
|
|
71
|
+
- **A recording refuses the options it does not read, and writes JSON as
|
|
72
|
+
JSON.** `--record-baseline` beside `--format json` wrote the line
|
|
73
|
+
`recorded ... in ...` where a script expected a document, and `--ratchet`,
|
|
74
|
+
`--strict`, `--max`, `--max-warnings`, `--color`, `--no-ascii` and
|
|
75
|
+
`--format sarif`, `github` or `gitlab` went unread with no word of them.
|
|
76
|
+
Those are exit `2` now, nothing written, `--strict is given beside
|
|
77
|
+
--record-baseline, and a recording writes the findings down and reports
|
|
78
|
+
none: give one of the two`, with `--help` or `--version` on the line too;
|
|
79
|
+
`--format json` writes `{ "version": 1,
|
|
80
|
+
"recorded": { "file", "findings", "entries" } }`; `human` and `markdown`
|
|
81
|
+
write the line as before. Upgrading: record with the options that choose
|
|
82
|
+
the findings alone, and read the document's `recorded` where a script
|
|
83
|
+
parsed the line.
|
|
84
|
+
- **A `--history` whose files an ignore leaves out is refused.** A pattern
|
|
85
|
+
marks the files a run reads, so `--ignore archive --history
|
|
86
|
+
"docs/archive/**"` read no journal, checked none of its links, and said
|
|
87
|
+
nothing. Where a `--history` typed on the line matches no file the run
|
|
88
|
+
reads and matches one an `--ignore`, or the configuration's `"ignore"`,
|
|
89
|
+
leaves out, the run is exit `2` now, naming the pattern and the ignores
|
|
90
|
+
there are. A pattern that matches no file at all is read as before.
|
|
91
|
+
Upgrading: drop the ignore that covers the journals, or the pattern that
|
|
92
|
+
names them.
|
|
93
|
+
- **A negation before the phrase cancels it, as one after it does.** `Not
|
|
94
|
+
blocked by [ADR-0002](0002.md)` was a `blocked-by` edge, `This doesn't
|
|
95
|
+
depend on` a dependency, and `It has not been superseded by [ADR-0002]`
|
|
96
|
+
made ADR-0002 the successor of the document that says it has none. A
|
|
97
|
+
negation as the last word before the phrase, or before a word of tense or
|
|
98
|
+
doubt such as `been`, `yet`, `longer` or `necessarily`, makes the
|
|
99
|
+
reference a citation now, contractions and `cannot` among them. `not
|
|
100
|
+
only`, `nothing but`, a quoted `"never"` and `Not in this release:
|
|
101
|
+
deferred to` state the relation and are read as before. And a negation is
|
|
102
|
+
read whatever mark stands before it, `blocked by:none`; `no-one` is read
|
|
103
|
+
as `no one`; and a code span that holds nothing but the word, ``blocked by
|
|
104
|
+
`none`:``, is read as the word, as `**none**` was. A `ghost-handover`,
|
|
105
|
+
`stale-premise` or a supersession such a sentence caused goes; an open
|
|
106
|
+
question in a retired document read as handed on by such a sentence is an
|
|
107
|
+
`orphaned-obligation`, so a check that passed can fail
|
|
108
|
+
([ADR-0006](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0006-false-positives-cost-more.md)).
|
|
109
|
+
Upgrading: run `check`; where it now reports an `orphaned-obligation`, the
|
|
110
|
+
question is owed by nobody, as its sentence says: close it, or hand it to a
|
|
111
|
+
live document in so many words.
|
|
112
|
+
|
|
113
|
+
## 0.17.0
|
|
114
|
+
|
|
115
|
+
Two things of which one went unread are refused, exit 2: an option that
|
|
116
|
+
takes one value given two, `--baseline` beside `--record-baseline`, and a
|
|
117
|
+
family given to both `--family` and `--ignore-family`. And a negation is
|
|
118
|
+
read whatever mark stands after it: `Blocked by none: [ADR-0002](0002.md)`
|
|
119
|
+
was a `blocked-by` edge, the opposite of its sentence.
|
|
120
|
+
|
|
121
|
+
### Changed
|
|
122
|
+
|
|
123
|
+
- **An option that takes one value is refused given two.** The later was
|
|
124
|
+
read and the earlier went unread, with no word of it: `check --root
|
|
125
|
+
nowhere --root .` checked `.` and never said that `nowhere` is not there,
|
|
126
|
+
and `query --format sarif --format json` wrote JSON where the two the
|
|
127
|
+
other way round are refused. `--root`, `--baseline`, `--record-baseline`,
|
|
128
|
+
`--format`, `--graph-format`, `--max` and `--max-warnings` given two
|
|
129
|
+
values, and one rule given two severities by `--rule`, are exit `2` now,
|
|
130
|
+
with a line that names both: `--root is given "nowhere" and ".", and takes
|
|
131
|
+
one value: give one of the two`. The same value twice is that value once,
|
|
132
|
+
compared as typed, an option that is repeatable takes each of its values
|
|
133
|
+
as before, and `--help` and `--version` are answered first
|
|
134
|
+
([ADR-0010](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0010-configuration-belongs-to-the-repository.md)).
|
|
135
|
+
Upgrading: where a script adds such an option to a command line that may
|
|
136
|
+
already hold it, keep the value the run should have and drop the other.
|
|
137
|
+
- **`--baseline` beside `--record-baseline` is refused.** A recording writes
|
|
138
|
+
every finding of the run and opens no baseline, so the file `--baseline`
|
|
139
|
+
named went unread: `check --baseline nowhere.json --record-baseline
|
|
140
|
+
out.json` recorded and exited `0`, where `--baseline nowhere.json` alone
|
|
141
|
+
is exit `2`. The two together are exit `2` now, in either order, and
|
|
142
|
+
nothing is written. A `"baseline"` in the configuration is recorded over
|
|
143
|
+
as before. Upgrading: to record, give `--record-baseline` alone; to check
|
|
144
|
+
against a baseline, `--baseline` alone.
|
|
145
|
+
- **A family given to both `--family` and `--ignore-family` is refused.**
|
|
146
|
+
The list that ignores decided, and the family's name on the other said
|
|
147
|
+
nothing: `check --family ADR --ignore-family ADR` passed over every
|
|
148
|
+
citation in prose and printed `the specification graph is consistent`,
|
|
149
|
+
exit `0`, where either option alone exits `1` on a citation nobody wrote.
|
|
150
|
+
It is exit `2` now, in either order and in any case of the name, `--family
|
|
151
|
+
ADR is given beside --ignore-family ADR, and a family's citations are read
|
|
152
|
+
or they are passed over: give one of the two`. One family asked for beside
|
|
153
|
+
another ignored is taken as before. Upgrading: take the family off the
|
|
154
|
+
option that does not say what the run should do with it.
|
|
155
|
+
- **A negation is read whatever mark stands after it.** A governing phrase
|
|
156
|
+
is cancelled by a negation between it and the reference, and the word was
|
|
157
|
+
read only where a space or the reference followed it: `Blocked by none:
|
|
158
|
+
[ADR-0002](0002.md)` was a `blocked-by` edge and `Deferred to nothing: see
|
|
159
|
+
[ADR-0002](0002.md)` a delegation, each the opposite of its sentence. The
|
|
160
|
+
word ends now at anything but a letter, a digit or a hyphen, a colon and a
|
|
161
|
+
dash among them, and those are citations and no more. A hyphen joins the
|
|
162
|
+
word to the next, so `blocked by the no-op in` is read as it was. A
|
|
163
|
+
`ghost-handover` or `stale-premise` such a sentence caused goes; an open
|
|
164
|
+
question in a retired document that was read as handed to a live one by
|
|
165
|
+
such a sentence is an `orphaned-obligation`, so a check that passed can
|
|
166
|
+
fail
|
|
167
|
+
([ADR-0006](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0006-false-positives-cost-more.md)).
|
|
168
|
+
Upgrading: run `check`; where it now reports an `orphaned-obligation`, the
|
|
169
|
+
question is owed by nobody, as its sentence says: close it, or hand it to
|
|
170
|
+
a live document in so many words.
|
|
171
|
+
|
|
14
172
|
## 0.16.0
|
|
15
173
|
|
|
16
174
|
`--color` beside `--no-color` is refused, exit 2, where the later of the
|
package/README.md
CHANGED
|
@@ -461,7 +461,19 @@ Blocked by [ADR-0009](0009-compliance.md). → blocked-by
|
|
|
461
461
|
A phrase governs a reference when it stands no more than 40 characters before
|
|
462
462
|
it, in the same statement: a sentence, a paragraph, a list item or a table cell.
|
|
463
463
|
|
|
464
|
-
- A negation between the two - `owned by nobody` - cancels it
|
|
464
|
+
- A negation between the two - `owned by nobody` - cancels it, whatever mark
|
|
465
|
+
stands before or after the word: `blocked by none: [ADR-0002](0002.md)` and
|
|
466
|
+
`blocked by:none` are each a citation and no more, and so is a code span
|
|
467
|
+
that holds nothing but the word, `` blocked by `none` ``. A hyphen joins the
|
|
468
|
+
word to the next, which names a thing, so `blocked by the no-op in` cancels
|
|
469
|
+
nothing; `no-one` is `no one`, and cancels.
|
|
470
|
+
- So does a negation just before the phrase: `not blocked by`, `never
|
|
471
|
+
deferred to`, `has not been superseded by`, `doesn't depend on`, `no longer
|
|
472
|
+
blocked by`. Only a space and a word of tense or doubt (`be`, `been`, `is`,
|
|
473
|
+
`yet`, `longer`, `necessarily` and a few more) stand between: `not only
|
|
474
|
+
blocked by`, `nothing but blocked by`, the option `"never" blocked by` and
|
|
475
|
+
`Not in this release: deferred to` each state the relation, and are read as
|
|
476
|
+
they state it.
|
|
465
477
|
- A sentence written in Chinese ends at `。`, `?`, `!` or `;`, with a space
|
|
466
478
|
after it or none, so `Deferred to later。另見 ADR-0002` hands nothing to
|
|
467
479
|
ADR-0002. A stop only ends a statement sooner: it reads less, never more.
|
|
@@ -620,6 +632,19 @@ silenced the whole lot, including the links, and a journal full of 404s is
|
|
|
620
632
|
exactly what this tool is for. See
|
|
621
633
|
[ADR-0011](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0011-a-record-is-not-a-specification.md).
|
|
622
634
|
|
|
635
|
+
So the two are not given together. A `--history` pattern that matches no file
|
|
636
|
+
the run reads, where the files it names are left out by `--ignore` or by
|
|
637
|
+
`"ignore"` in the configuration, stops the run with exit `2`, since no journal
|
|
638
|
+
it names would be read:
|
|
639
|
+
|
|
640
|
+
```text
|
|
641
|
+
spec-graph: --history "docs/archive/**" names only files --ignore leaves out, and a journal is read or it is left out: give one of the two
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
A pattern that matches no file at all is read as before, and `historyPatterns`
|
|
645
|
+
in the configuration under an `--ignore` is the flag deciding: the files are
|
|
646
|
+
left out.
|
|
647
|
+
|
|
623
648
|
## The query language
|
|
624
649
|
|
|
625
650
|
The two flagship rules are not hand-written traversals. They are selectors,
|
|
@@ -780,6 +805,20 @@ git add .spec-graph-baseline.json
|
|
|
780
805
|
}
|
|
781
806
|
```
|
|
782
807
|
|
|
808
|
+
A recording writes every finding down and judges none, so the options that
|
|
809
|
+
judge, show or colour a report are refused beside it, exit `2`: `--ratchet`,
|
|
810
|
+
`--strict`, `--max`, `--max-warnings`, `--color`, `--no-ascii`, and `--format`
|
|
811
|
+
`sarif`, `github` or `gitlab`, each a report of findings, of which a recording
|
|
812
|
+
makes none. `--format json` writes what was recorded as a document,
|
|
813
|
+
|
|
814
|
+
```json
|
|
815
|
+
{ "version": 1, "recorded": { "file": ".spec-graph-baseline.json", "findings": 2, "entries": 2 } }
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
and `--format markdown` the line, which reads as Markdown already. The options
|
|
819
|
+
that choose what is found, `--rule` among them, are read by a recording as by a
|
|
820
|
+
check.
|
|
821
|
+
|
|
783
822
|
CI is green from the first commit, every specification written afterwards is
|
|
784
823
|
checked in full, and a new finding fails the build. When debt is paid, the run
|
|
785
824
|
says so:
|
|
@@ -869,7 +908,8 @@ SARIF — and is 8 unless set; `0` lists none.
|
|
|
869
908
|
|
|
870
909
|
A broken config stops the run with exit `2`, each problem named on stderr:
|
|
871
910
|
invalid JSON, a value of the wrong type, an unknown key, a rule that does not
|
|
872
|
-
compile, a family name no family has, a
|
|
911
|
+
compile, a family name no family has, a family in both `families` and
|
|
912
|
+
`ignoreFamilies`, a file that is there and cannot be read.
|
|
873
913
|
Why a mistake stops the run:
|
|
874
914
|
|
|
875
915
|
- A configuration that did not load checks a different repository than the one
|
|
@@ -1037,6 +1077,14 @@ A list whose every name has a document sees none of them. `ignoreFamilies`
|
|
|
1037
1077
|
needs no such check: a name on it passes over citations of that family alone,
|
|
1038
1078
|
so a mistyped one passes over nothing and the run reports more, not less.
|
|
1039
1079
|
|
|
1080
|
+
A family is read or passed over, not both. The list that ignores is asked
|
|
1081
|
+
first, so a name on both lists passed over the family whatever the other said:
|
|
1082
|
+
one family under both keys of the file is a problem in it, exit `2`, as
|
|
1083
|
+
`--family` beside `--ignore-family` is on the command line. A flag says what
|
|
1084
|
+
the run does where the file says otherwise: `--family RFC` over
|
|
1085
|
+
`"ignoreFamilies": ["RFC"]` reads the RFCs' citations, and `--ignore-family ADR`
|
|
1086
|
+
over `"families": ["ADR"]` passes over the ADRs'.
|
|
1087
|
+
|
|
1040
1088
|
Both are consulted only after resolution has already failed, so `RFC 0001` still
|
|
1041
1089
|
resolves to your local RFC-0001 with `RFC` on the ignore list. No configuration
|
|
1042
1090
|
can delete an edge. See
|
|
@@ -1130,13 +1178,48 @@ variable in `--family "$FAMILIES"` is the usual way to write one:
|
|
|
1130
1178
|
- an option beside its own opposite, `--color` beside `--no-color` or
|
|
1131
1179
|
`--ascii` beside `--no-ascii`, in either order: the later would decide and
|
|
1132
1180
|
the earlier go unread ([Colour and glyphs](#colour-and-glyphs));
|
|
1181
|
+
- an option that takes one value, given two: `--root`, `--baseline`,
|
|
1182
|
+
`--record-baseline`, `--format`, `--graph-format`, `--max` or
|
|
1183
|
+
`--max-warnings`, and one rule given two severities by `--rule`. The later
|
|
1184
|
+
would be read and the earlier go unread: `--root nowhere --root .` would
|
|
1185
|
+
check `.` and never say that `nowhere` is not there. The line names both,
|
|
1186
|
+
`--root is given "nowhere" and ".", and takes one value: give one of the
|
|
1187
|
+
two`. Two values are compared as each is read, so one value twice is that
|
|
1188
|
+
value once however it is spelled: `--root .` beside `--root ./` names one
|
|
1189
|
+
directory, a baseline is a path resolved as the root is, and `--max 1`
|
|
1190
|
+
beside `--max " 1"` is one number. An option that is repeatable above
|
|
1191
|
+
takes each of its values;
|
|
1192
|
+
- `--baseline` beside `--record-baseline`: a recording writes every finding
|
|
1193
|
+
of the run and opens no baseline, so the one to read would go unread. A
|
|
1194
|
+
`"baseline"` in the configuration is no option, and is recorded over as
|
|
1195
|
+
before. So are the options a recording does not read: `--ratchet`,
|
|
1196
|
+
`--strict`, `--max`, `--max-warnings`, `--color`, `--no-ascii`, and
|
|
1197
|
+
`--format sarif`, `github` or `gitlab`
|
|
1198
|
+
([Adopting this on a repository that predates it](#adopting-this-on-a-repository-that-predates-it));
|
|
1199
|
+
- a `--history` pattern whose files an ignore leaves out, so that no journal
|
|
1200
|
+
it names is read ([Journals, changelogs and minutes](#journals-changelogs-and-minutes));
|
|
1201
|
+
- one family given to both `--family` and `--ignore-family`, whose citations
|
|
1202
|
+
are passed over whatever asked for them: alone on the allowlist it would
|
|
1203
|
+
leave every citation as prose. One family asked for beside another ignored
|
|
1204
|
+
is taken, since both are read;
|
|
1133
1205
|
- a value that begins with `--`, which reads as the option after one whose
|
|
1134
1206
|
value was forgotten: `--ignore --strict` would ignore a directory called
|
|
1135
1207
|
`--strict`, and `--record-baseline --verbose` write a file of that name.
|
|
1136
1208
|
A name that does begin so is written `./--name` for a file, `[-]-name` in
|
|
1137
1209
|
a pattern and `\--name` for a reference target;
|
|
1138
1210
|
- a configuration file that is there and cannot be read, a directory called
|
|
1139
|
-
`.spec-graph.json` among them
|
|
1211
|
+
`.spec-graph.json` among them;
|
|
1212
|
+
- `--help` beside `--version`, in either order: one of the two answers would
|
|
1213
|
+
go unread.
|
|
1214
|
+
|
|
1215
|
+
Each of those the command line can tell from itself, an option a recording
|
|
1216
|
+
does not read among them, is refused with `--help` or `--version` on the
|
|
1217
|
+
line too, as an option nobody knows always was: answered first, the help
|
|
1218
|
+
told a script nothing of the line it wrote, and the version answered as if
|
|
1219
|
+
the line were right. What a command still needs, a selector or two exports,
|
|
1220
|
+
is what the help is for, so `query --help` and `diff --help` print it; and
|
|
1221
|
+
so does a line only the run would find wrong, `--root nowhere --help` or a
|
|
1222
|
+
`--history` an ignore leaves out, since the help reads no disk.
|
|
1140
1223
|
|
|
1141
1224
|
An option belongs to the commands that read it. Any other command refuses it
|
|
1142
1225
|
by name, `--strict belongs to check, not to query`, rather than run as if the
|
|
@@ -1198,8 +1281,8 @@ that adds `--no-color` to a line already holding `--color` would be told
|
|
|
1198
1281
|
nothing of which it got. Those are the two pairs the command line has; no
|
|
1199
1282
|
other option has an opposite to be given beside. Either of a pair alone wins
|
|
1200
1283
|
over the environment, which is what it is for, and the same option given
|
|
1201
|
-
twice is that option once. `--help`
|
|
1202
|
-
|
|
1284
|
+
twice is that option once. A pair is refused with `--help` or `--version`
|
|
1285
|
+
on the line as well.
|
|
1203
1286
|
|
|
1204
1287
|
Without either, `SPEC_GRAPH_ASCII` set to anything but `0`, `false` or nothing
|
|
1205
1288
|
asks for ASCII; and without that, a Windows console that sets neither
|
|
@@ -1243,13 +1326,13 @@ steps:
|
|
|
1243
1326
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
1244
1327
|
with:
|
|
1245
1328
|
persist-credentials: false
|
|
1246
|
-
- uses: actions/setup-node@
|
|
1329
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
1247
1330
|
with:
|
|
1248
1331
|
node-version: '24'
|
|
1249
1332
|
- run: npm ci
|
|
1250
1333
|
- run: npx --no-install @descent-vtt/spec-graph --format sarif > spec-graph.sarif
|
|
1251
1334
|
continue-on-error: true
|
|
1252
|
-
- uses: github/codeql-action/upload-sarif@
|
|
1335
|
+
- uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
|
|
1253
1336
|
with:
|
|
1254
1337
|
sarif_file: spec-graph.sarif
|
|
1255
1338
|
```
|
|
@@ -1467,9 +1550,9 @@ tools share, whose code is copied into `src/vendor/` and checked by hash rather
|
|
|
1467
1550
|
than installed. So the whole package is auditable in an afternoon — and nothing
|
|
1468
1551
|
in the pipeline can take longer than its input.
|
|
1469
1552
|
|
|
1470
|
-
**Verified, not just covered.** 2,
|
|
1553
|
+
**Verified, not just covered.** 2,330 tests; 99.4% statement and 99.8% line
|
|
1471
1554
|
coverage. Coverage says a line ran, so the suite is also held to a mutation
|
|
1472
|
-
score - 96.
|
|
1555
|
+
score - 96.60% over 9,107 mutants, measured by CI's full sweep, and a build
|
|
1473
1556
|
fails under 93 - because a vocabulary entry or a boundary
|
|
1474
1557
|
condition can be weakened by an ordinary-looking refactor without a single test
|
|
1475
1558
|
going red. [ADR-0007](https://github.com/DescentVTT/spec-graph/blob/main/docs/adr/0007-mutation-testing.md) is straight about what
|
package/dist/cli.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export interface CliIO {
|
|
|
78
78
|
readonly env?: Readonly<Record<string, string | undefined>> | undefined;
|
|
79
79
|
readonly isTTY?: boolean | undefined;
|
|
80
80
|
}
|
|
81
|
-
export declare const HELP = "spec-graph - turn Markdown specifications into a verifiable graph\n\nUSAGE\n spec-graph [check] [patterns...] [options]\n spec-graph query <selector|project:rule> [patterns...] [options]\n spec-graph graph [patterns...] [--graph-format dot|mermaid|json]\n spec-graph rules [rule-id] [--explain]\n spec-graph diff <before.json> <after.json> [--format human|json|markdown]\n\nCOMMANDS\n check Validate the specification graph. The default.\n query Run a selector - or a registered project rule, by its id - and\n print the matching paths.\n graph Export the graph for Graphviz, Mermaid, or another tool.\n rules List the diagnostics that will run, built in and project. Name one\n to see only that one; --explain adds its selector and the ADR that\n decided it.\n diff Compare two graph exports: documents added, removed, moved or\n accepted; relations added or removed; and obligations resolved or\n reopened where they can be told apart. Make both exports with the\n same spec-graph. Exits 0 whether anything changed or not.\n\nOPTIONS\n --root <dir> Directory the patterns resolve against. Without it,\n .spec-graph.json is looked for in the working\n directory and then upward as far as the repository,\n and the directory holding it becomes the root - so a\n run from a subdirectory reports what a run from the\n top reports. Paths typed on the command line stay\n relative to where they were typed. It has to be a\n directory that is there.\n --ignore <glob> Skip paths. Repeatable.\n --ignore-ref <glob> Do not report these reference targets when they fail\n to resolve, for repositories where [[...]] tags a\n concept rather than naming a file. Repeatable.\n Suppresses findings only, never edges.\n --family <name> Families a bare identifier in prose may name. When\n given, everything else stays prose. Repeatable: one\n name each time, the prefix its identifiers are\n written with, ADR for ADR-0007. A document here has\n to belong to one of them, or the check stops: a list\n that names none allows nothing. It stops too where\n a name has no document and the list leaves out a\n family the documents do belong to, as RFCS for RFC\n does: one is most likely meant for the other.\n --ignore-family <name> Families that are never citations - RFC when the repo\n cites RFC 2119 and keeps its own RFCs. Repeatable,\n one name each time.\n --history <glob> Files that log what was decided rather than deciding\n it - journals, changelogs, minutes. Their links are\n still checked; their obligations are not. Repeatable.\n --baseline <file> Accept the findings recorded in this file and report\n only what is new since. The file has to be there: a\n path that reads nothing accepts nothing and says so\n nowhere. A \"baseline\" in the configuration may name a\n file not recorded yet; a path typed here may not.\n --record-baseline <f> Write today's findings to this file as accepted debt,\n and exit 0 without judging them.\n --ratchet Also fail when a baseline entry no longer occurs, so\n a paid-off exemption cannot outlive the defect.\n --no-config Ignore .spec-graph.json and the package.json key.\n --format <fmt> human, json, sarif, github, gitlab or markdown. json\n is for check, query or diff. sarif is the interchange\n format GitHub code scanning and editors already read,\n github the workflow commands a GitHub Actions log\n turns into annotations, and gitlab the Code Quality\n report a GitLab merge request reads, all three for\n check; markdown is a table for a pull-request comment\n or $GITHUB_STEP_SUMMARY, for check or diff (default:\n human)\n --graph-format <fmt> dot, mermaid or json (default: dot)\n --documents-only Leave items out of the exported graph\n --rule <id>=<severity> Override one rule: error, warn, info or off. A project\n rule is named in full: project:no-draft-dependency.\n Repeatable.\n --max <n> Show at most n findings (0 = no limit)\n --max-warnings <n> Fail when warnings exceed n (default: no limit)\n --strict Raise every warning to an error. An explicit --rule\n still wins, so --strict --rule x=warn exempts x.\n --color / --no-color Force colour on or off, whatever NO_COLOR, FORCE_COLOR\n and the terminal say. The two together are refused\n --ascii / --no-ascii ASCII glyphs or Unicode ones. SPEC_GRAPH_ASCII asks\n for ASCII, unless it is empty, 0 or false. Either\n option wins over it, and over what the terminal is\n taken for. The two together are refused\n --verbose Include parse problems, per-file detail, and every\n reference --ignore-ref or --ignore-family silenced\n --explain With rules: add each rule's selector and the ADR\n that decided it\n -h, --help Show this help\n -v, --version Show the version\n\n An option belongs to the commands that read it, and any other command\n refuses it by name:\n\n --root, --verbose check, query, graph, rules\n --ignore, --history check, query, graph\n --format check, query, diff\n --graph-format, --documents-only graph\n --explain rules\n every other option check\n\n --no-config, --no-color and --ascii are taken by every command: each is\n true already of a command with nothing to read it for. --color and\n --no-ascii are not: each would say that a command drew what only a check\n draws.\n\n An option beside its own opposite is refused, whichever comes first:\n --color beside --no-color, and --ascii beside --no-ascii. The later would\n decide and the earlier go unread. Either alone wins over the environment,\n and the same option twice is that option once.\n\n A value that begins with -- reads as an option, so the option before it is\n refused as missing its value. A name that does begin so is written ./--name\n for a file, [-]-name in a pattern and \\--name for a reference target.\n\nSELECTORS\n A selector is a path through the graph.\n\n item[openness=open] -delegates-to-> document[phase=retired]\n document[phase=active] -assumes-> document[phase=retired]\n document =supersedes=> document\n *[path^=docs/adr] -contains-> item[state=accepted-debt]\n\n Node types: document, item, * (any)\n Attributes: id, kind, title, path, file, line, phase, status, receptivity,\n alias, document, state (or disposition), openness, section,\n text, body, evidence, conflicted, fm.<front-matter-key>\n Operators: = != ^= $= *= ~= and [attr] for \"is present\"\n ~= is a regular expression, matched by an automaton that cannot\n backtrack: linear in the subject, whatever the pattern. It reads\n the usual syntax minus backreferences and lookaround, which are\n not regular - both are refused when the selector is read, with\n the character pointed at\n Relations: -kind-> <-kind- =kind=> <=kind= (= forms are transitive)\n\nEXIT CODES\n 0 clean\n 1 findings at error severity (or over --max-warnings)\n 2 the tool could not run\n\n An input that is set and names nothing is a 2, named on stderr, and never\n read as if it had not been given: an empty value, a family name no family\n has, a list of families no document here belongs to, a --root that is no\n directory, a second word after rules, an option of another command. So is\n an option beside its own opposite, of which one would go unread.\n\nCONFIGURATION\n Anything repeated on every run belongs in the repository rather than in the\n command. spec-graph reads the first of these that exists:\n\n .spec-graph.json, spec-graph.config.json, or a \"spec-graph\" key in\n package.json\n\n { \"patterns\": [\"docs/**/*.md\"],\n \"ignoreReferences\": [\"trap *\"],\n \"ignoreFamilies\": [\"RFC\"],\n \"historyPatterns\": [\"**/JOURNAL_*.md\", \"archive/**\"],\n \"baseline\": \".spec-graph-baseline.json\",\n \"severities\": { \"self-reference\": \"off\" },\n \"strict\": true,\n \"maxRelated\": 3 }\n\n A flag always wins over the file, and list flags add to it rather than\n replacing it. maxRelated has no flag: it caps how many related locations one\n finding lists, 8 unless set, and 0 lists none.\n\n A problem in that file stops the run with exit 2, named on stderr: invalid\n JSON, an unknown key, a rule that does not compile, a file that is there and\n cannot be read. A configuration that did not load checks a different\n repository than the one configured, and would report that one as consistent.\n --no-config runs on defaults instead.\n\nPROJECT RULES\n A convention spec-graph never anticipated is a selector plus a sentence, and\n belongs in the same file. Every rule declared here runs beside the built-ins\n and is reported, baselined, escalated by --strict and silenced by --rule in\n exactly the same way.\n\n { \"rules\": {\n \"no-draft-dependency\": {\n \"query\": \"document[phase=active] -depends-on-> document[phase=draft]\",\n \"message\": \"{0} depends on {1}, which is still a draft\",\n \"hint\": \"wait for {1} to be accepted, or drop it from {0.path}\",\n \"severity\": \"error\" } } }\n\n query One selector, or a list of them read as a union.\n message The headline. {0} is the first node on the path, {1} the next;\n {1.phase} and {0.fm.owner} read any selector attribute.\n hint The next action. Optional, and templated the same way.\n severity error, warn, info or off. Defaults to warn - a rule a team has\n just written has not yet earned the right to fail their build.\n\n The id is the name with project: in front, which is why it can never collide\n with a built-in. A selector that does not parse, or a {2} the query can never\n reach, is reported when the file is read rather than found missing later.\n\n To see what one matches without copying its selector out of the file:\n\n spec-graph query project:no-draft-dependency --verbose\n\nADOPTING THIS ON AN OLD REPOSITORY\n Record what is already wrong, then report only what happens next:\n\n spec-graph check --record-baseline .spec-graph-baseline.json\n git add .spec-graph-baseline.json\n\n The file is keyed by specification and citation, not by line number, so it\n survives edits, moves and renames. Findings that stop occurring are reported\n so the file can be tightened; nothing new gets in.\n\nEXAMPLES\n spec-graph \"docs/**/*.md\"\n spec-graph check --rule self-reference=off --format json\n spec-graph query 'item[openness=open] -delegates-to-> document[phase=retired]'\n spec-graph check --ignore-ref \"trap *\" # [[trap 55]] tags a concept, not a file\n spec-graph graph --documents-only --graph-format mermaid > graph.mmd\n spec-graph check --history \"**/JOURNAL_*.md\" # a log is not a specification\n spec-graph check --baseline .spec-graph-baseline.json\n spec-graph rules --explain # including this repository's own\n spec-graph rules ghost-handover --explain # and why it exists\n spec-graph check --rule project:no-draft-dependency=off\n spec-graph query project:no-draft-dependency # what does that rule match?\n spec-graph check --format markdown >> \"$GITHUB_STEP_SUMMARY\"\n spec-graph check --format github # annotations from an Actions log\n spec-graph check --format gitlab > gl-code-quality-report.json\n spec-graph diff base.json head.json --format markdown >> \"$GITHUB_STEP_SUMMARY\"\n";
|
|
81
|
+
export declare const HELP = "spec-graph - turn Markdown specifications into a verifiable graph\n\nUSAGE\n spec-graph [check] [patterns...] [options]\n spec-graph query <selector|project:rule> [patterns...] [options]\n spec-graph graph [patterns...] [--graph-format dot|mermaid|json]\n spec-graph rules [rule-id] [--explain]\n spec-graph diff <before.json> <after.json> [--format human|json|markdown]\n\nCOMMANDS\n check Validate the specification graph. The default.\n query Run a selector - or a registered project rule, by its id - and\n print the matching paths.\n graph Export the graph for Graphviz, Mermaid, or another tool.\n rules List the diagnostics that will run, built in and project. Name one\n to see only that one; --explain adds its selector and the ADR that\n decided it.\n diff Compare two graph exports: documents added, removed, moved or\n accepted; relations added or removed; and obligations resolved or\n reopened where they can be told apart. Make both exports with the\n same spec-graph. Exits 0 whether anything changed or not.\n\nOPTIONS\n --root <dir> Directory the patterns resolve against. Without it,\n .spec-graph.json is looked for in the working\n directory and then upward as far as the repository,\n and the directory holding it becomes the root - so a\n run from a subdirectory reports what a run from the\n top reports. Paths typed on the command line stay\n relative to where they were typed. It has to be a\n directory that is there.\n --ignore <glob> Skip paths. Repeatable.\n --ignore-ref <glob> Do not report these reference targets when they fail\n to resolve, for repositories where [[...]] tags a\n concept rather than naming a file. Repeatable.\n Suppresses findings only, never edges.\n --family <name> Families a bare identifier in prose may name. When\n given, everything else stays prose. Repeatable: one\n name each time, the prefix its identifiers are\n written with, ADR for ADR-0007. A document here has\n to belong to one of them, or the check stops: a list\n that names none allows nothing. It stops too where\n a name has no document and the list leaves out a\n family the documents do belong to, as RFCS for RFC\n does: one is most likely meant for the other.\n --ignore-family <name> Families that are never citations - RFC when the repo\n cites RFC 2119 and keeps its own RFCs. Repeatable,\n one name each time.\n --history <glob> Files that log what was decided rather than deciding\n it - journals, changelogs, minutes. Their links are\n still checked; their obligations are not. Repeatable.\n A pattern whose files an ignore leaves out is\n refused: no journal it names would be read.\n --baseline <file> Accept the findings recorded in this file and report\n only what is new since. The file has to be there: a\n path that reads nothing accepts nothing and says so\n nowhere. A \"baseline\" in the configuration may name a\n file not recorded yet; a path typed here may not.\n --record-baseline <f> Write today's findings to this file as accepted debt,\n and exit 0 without judging them. With --format json\n the recording is a JSON document.\n --ratchet Also fail when a baseline entry no longer occurs, so\n a paid-off exemption cannot outlive the defect.\n --no-config Ignore .spec-graph.json and the package.json key.\n --format <fmt> human, json, sarif, github, gitlab or markdown. json\n is for check, query or diff. sarif is the interchange\n format GitHub code scanning and editors already read,\n github the workflow commands a GitHub Actions log\n turns into annotations, and gitlab the Code Quality\n report a GitLab merge request reads, all three for\n check; markdown is a table for a pull-request comment\n or $GITHUB_STEP_SUMMARY, for check or diff (default:\n human)\n --graph-format <fmt> dot, mermaid or json (default: dot)\n --documents-only Leave items out of the exported graph\n --rule <id>=<severity> Override one rule: error, warn, info or off. A project\n rule is named in full: project:no-draft-dependency.\n Repeatable.\n --max <n> Show at most n findings (0 = no limit)\n --max-warnings <n> Fail when warnings exceed n (default: no limit)\n --strict Raise every warning to an error. An explicit --rule\n still wins, so --strict --rule x=warn exempts x.\n --color / --no-color Force colour on or off, whatever NO_COLOR, FORCE_COLOR\n and the terminal say. The two together are refused\n --ascii / --no-ascii ASCII glyphs or Unicode ones. SPEC_GRAPH_ASCII asks\n for ASCII, unless it is empty, 0 or false. Either\n option wins over it, and over what the terminal is\n taken for. The two together are refused\n --verbose Include parse problems, per-file detail, and every\n reference --ignore-ref or --ignore-family silenced\n --explain With rules: add each rule's selector and the ADR\n that decided it\n -h, --help Show this help\n -v, --version Show the version\n\n An option belongs to the commands that read it, and any other command\n refuses it by name:\n\n --root, --verbose check, query, graph, rules\n --ignore, --history check, query, graph\n --format check, query, diff\n --graph-format, --documents-only graph\n --explain rules\n every other option check\n\n --no-config, --no-color and --ascii are taken by every command: each is\n true already of a command with nothing to read it for. --color and\n --no-ascii are not: each would say that a command drew what only a check\n draws.\n\n An option beside its own opposite is refused, whichever comes first:\n --color beside --no-color, and --ascii beside --no-ascii. The later would\n decide and the earlier go unread. Either alone wins over the environment,\n and the same option twice is that option once.\n\n An option that takes one value is refused given two, as in --root a\n --root b: the later would be read and the earlier go unread. That is each\n option above with a value that is not marked Repeatable, and one rule\n given two severities by --rule. Two values are compared as each is read,\n so one value twice is that value once however it is spelled: --root .\n beside --root ./ names one directory.\n\n A baseline to read is refused beside one to record, --baseline beside\n --record-baseline: a recording writes every finding and opens no\n baseline. So is each option a recording does not read, since it judges,\n shows and colours no finding: --ratchet, --strict, --max, --max-warnings,\n --color, --no-ascii, and --format sarif, github or gitlab. So is one\n family given to both --family and --ignore-family, whose citations are\n passed over whatever asked for them. One family asked for beside another\n ignored is taken.\n\n A value that begins with -- reads as an option, so the option before it is\n refused as missing its value. A name that does begin so is written ./--name\n for a file, [-]-name in a pattern and \\--name for a reference target.\n\n A line that is wrong is refused with --help or --version on it too, an\n option a recording does not read among them, and --help beside --version\n is refused: one of the two answers would go unread. What a command still\n needs, a selector or two exports, is what --help is for: query --help and\n diff --help print it. The help reads no disk, so what only the run finds,\n a --root that is not there or a --history an ignore leaves out, is\n answered by it.\n\nSELECTORS\n A selector is a path through the graph.\n\n item[openness=open] -delegates-to-> document[phase=retired]\n document[phase=active] -assumes-> document[phase=retired]\n document =supersedes=> document\n *[path^=docs/adr] -contains-> item[state=accepted-debt]\n\n Node types: document, item, * (any)\n Attributes: id, kind, title, path, file, line, phase, status, receptivity,\n alias, document, state (or disposition), openness, section,\n text, body, evidence, conflicted, fm.<front-matter-key>\n Operators: = != ^= $= *= ~= and [attr] for \"is present\"\n ~= is a regular expression, matched by an automaton that cannot\n backtrack: linear in the subject, whatever the pattern. It reads\n the usual syntax minus backreferences and lookaround, which are\n not regular - both are refused when the selector is read, with\n the character pointed at\n Relations: -kind-> <-kind- =kind=> <=kind= (= forms are transitive)\n\nEXIT CODES\n 0 clean\n 1 findings at error severity (or over --max-warnings)\n 2 the tool could not run\n\n An input that is set and names nothing is a 2, named on stderr, and never\n read as if it had not been given: an empty value, a family name no family\n has, a list of families no document here belongs to, a --root that is no\n directory, a second word after rules, an option of another command. So\n are two things of which one would go unread: an option beside its own\n opposite, an option that takes one value given two, --baseline beside\n --record-baseline, an option a recording does not read, a family both\n asked for and ignored, a --history whose files an ignore leaves out,\n --help beside --version.\n\nCONFIGURATION\n Anything repeated on every run belongs in the repository rather than in the\n command. spec-graph reads the first of these that exists:\n\n .spec-graph.json, spec-graph.config.json, or a \"spec-graph\" key in\n package.json\n\n { \"patterns\": [\"docs/**/*.md\"],\n \"ignoreReferences\": [\"trap *\"],\n \"ignoreFamilies\": [\"RFC\"],\n \"historyPatterns\": [\"**/JOURNAL_*.md\", \"archive/**\"],\n \"baseline\": \".spec-graph-baseline.json\",\n \"severities\": { \"self-reference\": \"off\" },\n \"strict\": true,\n \"maxRelated\": 3 }\n\n A flag always wins over the file, and list flags add to it rather than\n replacing it: --family RFC reads the citations \"ignoreFamilies\" passes\n over. maxRelated has no flag: it caps how many related locations one\n finding lists, 8 unless set, and 0 lists none.\n\n A problem in that file stops the run with exit 2, named on stderr: invalid\n JSON, an unknown key, a rule that does not compile, one family in both\n \"families\" and \"ignoreFamilies\", a file that is there and cannot be read. A configuration that did not load checks a different\n repository than the one configured, and would report that one as consistent.\n --no-config runs on defaults instead.\n\nPROJECT RULES\n A convention spec-graph never anticipated is a selector plus a sentence, and\n belongs in the same file. Every rule declared here runs beside the built-ins\n and is reported, baselined, escalated by --strict and silenced by --rule in\n exactly the same way.\n\n { \"rules\": {\n \"no-draft-dependency\": {\n \"query\": \"document[phase=active] -depends-on-> document[phase=draft]\",\n \"message\": \"{0} depends on {1}, which is still a draft\",\n \"hint\": \"wait for {1} to be accepted, or drop it from {0.path}\",\n \"severity\": \"error\" } } }\n\n query One selector, or a list of them read as a union.\n message The headline. {0} is the first node on the path, {1} the next;\n {1.phase} and {0.fm.owner} read any selector attribute.\n hint The next action. Optional, and templated the same way.\n severity error, warn, info or off. Defaults to warn - a rule a team has\n just written has not yet earned the right to fail their build.\n\n The id is the name with project: in front, which is why it can never collide\n with a built-in. A selector that does not parse, or a {2} the query can never\n reach, is reported when the file is read rather than found missing later.\n\n To see what one matches without copying its selector out of the file:\n\n spec-graph query project:no-draft-dependency --verbose\n\nADOPTING THIS ON AN OLD REPOSITORY\n Record what is already wrong, then report only what happens next:\n\n spec-graph check --record-baseline .spec-graph-baseline.json\n git add .spec-graph-baseline.json\n\n The file is keyed by specification and citation, not by line number, so it\n survives edits, moves and renames. Findings that stop occurring are reported\n so the file can be tightened; nothing new gets in.\n\nEXAMPLES\n spec-graph \"docs/**/*.md\"\n spec-graph check --rule self-reference=off --format json\n spec-graph query 'item[openness=open] -delegates-to-> document[phase=retired]'\n spec-graph check --ignore-ref \"trap *\" # [[trap 55]] tags a concept, not a file\n spec-graph graph --documents-only --graph-format mermaid > graph.mmd\n spec-graph check --history \"**/JOURNAL_*.md\" # a log is not a specification\n spec-graph check --baseline .spec-graph-baseline.json\n spec-graph rules --explain # including this repository's own\n spec-graph rules ghost-handover --explain # and why it exists\n spec-graph check --rule project:no-draft-dependency=off\n spec-graph query project:no-draft-dependency # what does that rule match?\n spec-graph check --format markdown >> \"$GITHUB_STEP_SUMMARY\"\n spec-graph check --format github # annotations from an Actions log\n spec-graph check --format gitlab > gl-code-quality-report.json\n spec-graph diff base.json head.json --format markdown >> \"$GITHUB_STEP_SUMMARY\"\n";
|
|
82
82
|
/** Parses argv into options. Throws {@link UsageError} on anything malformed. */
|
|
83
83
|
export declare function parseArgs(argv: readonly string[], cwd: string): CliOptions;
|
|
84
84
|
/**
|