@houserules/payload 0.2.2 → 0.2.3
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/package.json +4 -4
- package/payload-dist/scripts/lib/findings.d.mts +10 -10
- package/payload-dist/scripts/lib/findings.mjs +0 -15
- package/payload-dist/scripts/lib/markdown-segment.d.mts +17 -19
- package/payload-dist/scripts/lib/markdown-segment.mjs +17 -19
- package/payload-dist/scripts/lib/proc.d.mts +1 -1
- package/payload-dist/scripts/lib/proc.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@houserules/payload",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "houserules: shared payload libraries, copied into .claude/scripts/lib and executed on bare node with zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"hooks"
|
|
72
72
|
],
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@types/node": "26.
|
|
74
|
+
"@types/node": "26.4.0",
|
|
75
75
|
"publint": "^0.3.24",
|
|
76
|
-
"type-fest": "^5.
|
|
76
|
+
"type-fest": "^5.9.0",
|
|
77
77
|
"typescript": "^6.0.3",
|
|
78
78
|
"vitest": "^4.1.11",
|
|
79
79
|
"wireit": "^0.14.13",
|
|
80
|
-
"@houserules/test": "0.1.
|
|
80
|
+
"@houserules/test": "0.1.3"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {},
|
|
83
83
|
"peerDependencies": {},
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* `error` means the checker decided and a finding is a defect.
|
|
3
|
+
*
|
|
4
|
+
* `warn` means the checker found a CANDIDATE and a model still has to rule on it. This is
|
|
5
|
+
* the whole distinction between a mechanical clause and a hybrid one. A rule that says
|
|
6
|
+
* "past 20 to 30 lines, look again" produces candidates, not defects, and shipping those
|
|
7
|
+
* at `error` misreads the clause it is enforcing.
|
|
8
|
+
*/
|
|
9
|
+
export type Level = 'error' | 'warn';
|
|
10
|
+
/**
|
|
11
|
+
* What a checker reports about one location, and how it prints.
|
|
3
12
|
*
|
|
4
13
|
* Two shapes already existed when this was written and neither was sufficient.
|
|
5
14
|
* `@houserules/api`'s `Finding` carries a level but no location, because a doctor check
|
|
@@ -13,15 +22,6 @@
|
|
|
13
22
|
* node in a user's repo, so it cannot import from a published package at runtime, and the
|
|
14
23
|
* two shapes answer different questions anyway.
|
|
15
24
|
*/
|
|
16
|
-
/**
|
|
17
|
-
* `error` means the checker decided and a finding is a defect.
|
|
18
|
-
*
|
|
19
|
-
* `warn` means the checker found a CANDIDATE and a model still has to rule on it. This is
|
|
20
|
-
* the whole distinction between a mechanical clause and a hybrid one. A rule that says
|
|
21
|
-
* "past 20 to 30 lines, look again" produces candidates, not defects, and shipping those
|
|
22
|
-
* at `error` misreads the clause it is enforcing.
|
|
23
|
-
*/
|
|
24
|
-
export type Level = 'error' | 'warn';
|
|
25
25
|
export interface Finding {
|
|
26
26
|
/**
|
|
27
27
|
* The clause this violates, not the checker that found it. Several checkers may report
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a checker reports, and how it prints.
|
|
3
|
-
*
|
|
4
|
-
* Two shapes already existed when this was written and neither was sufficient.
|
|
5
|
-
* `@houserules/api`'s `Finding` carries a level but no location, because a doctor check
|
|
6
|
-
* reports about the install rather than about a line. `design-checks.mts` carries a line
|
|
7
|
-
* but no level and no rule id, because it was written for one script that only ever had
|
|
8
|
-
* one severity. A checker that reports a rule-clause violation needs all three: the
|
|
9
|
-
* location so a reader can go there, the level so severity is not guessed, and the clause
|
|
10
|
-
* id so coverage can be verified per clause rather than per checker.
|
|
11
|
-
*
|
|
12
|
-
* This is deliberately NOT the api type. The payload is a copy target that runs on bare
|
|
13
|
-
* node in a user's repo, so it cannot import from a published package at runtime, and the
|
|
14
|
-
* two shapes answer different questions anyway.
|
|
15
|
-
*/
|
|
16
1
|
export function emptyReport() {
|
|
17
2
|
return { findings: [], declined: [] };
|
|
18
3
|
}
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Separates markdown prose from code, so a prose checker never mistakes a code token for a
|
|
3
|
-
* voice violation.
|
|
4
|
-
*
|
|
5
|
-
* A checker built on a naive fence toggle (`` ``` `` flips a boolean, then a same-line
|
|
6
|
-
* backtick regex strips inline spans) measured 0% precision in `PROBE-regex.md`'s b1
|
|
7
|
-
* candidate: both of its two findings were false positives, one from an inline-code span
|
|
8
|
-
* that opens on one line and closes on the next (the toggle only matched a span with no
|
|
9
|
-
* embedded newline), the other from a blockquoted "before" example that the document quotes
|
|
10
|
-
* on purpose to forbid, not a violation of its own voice. This module fixes the first as a
|
|
11
|
-
* lexing bug and treats the second as a naming decision, documented below.
|
|
12
|
-
*
|
|
13
|
-
* DECISION: a blockquoted line (`^ {0,3}>`) is classified `'quoted'`, never `'prose'`. A
|
|
14
|
-
* checker built on `classifyLines` should skip `'quoted'` lines the same way it skips
|
|
15
|
-
* `'code'` ones. The cost: a genuine callout or admonition written with `>` (not a quoted
|
|
16
|
-
* bad example) also goes unchecked. That trade favors the false negative over the false
|
|
17
|
-
* positive, because `prose-voice.md` itself is the corpus that motivated this fix, and it
|
|
18
|
-
* blockquotes bad examples specifically to forbid them without committing them.
|
|
19
|
-
*/
|
|
20
1
|
export type LineKind = 'prose' | 'code' | 'quoted';
|
|
21
2
|
/**
|
|
22
3
|
* One `LineKind` per line of `markdown`, in `split('\n')` order.
|
|
@@ -42,6 +23,23 @@ export declare function stripCode(markdown: string): string;
|
|
|
42
23
|
* blockquoted (`'quoted'`) lines, all replaced by same-length or same-line-count filler.
|
|
43
24
|
* Line numbers are unchanged, same guarantee as `stripCode`.
|
|
44
25
|
*
|
|
26
|
+
* Separates markdown prose from code, so a prose checker never mistakes a code token for a
|
|
27
|
+
* voice violation. A checker built on a naive fence toggle (`` ``` `` flips a boolean, then
|
|
28
|
+
* a same-line backtick regex strips inline spans) measured 0% precision in
|
|
29
|
+
* `PROBE-regex.md`'s b1 candidate: both of its two findings were false positives, one from
|
|
30
|
+
* an inline-code span that opens on one line and closes on the next (the toggle only
|
|
31
|
+
* matched a span with no embedded newline), the other from a blockquoted "before" example
|
|
32
|
+
* that the document quotes on purpose to forbid, not a violation of its own voice. This
|
|
33
|
+
* module fixes the first as a lexing bug and treats the second as a naming decision,
|
|
34
|
+
* documented below.
|
|
35
|
+
*
|
|
36
|
+
* DECISION: a blockquoted line (`^ {0,3}>`) is classified `'quoted'`, never `'prose'`. A
|
|
37
|
+
* checker built on `classifyLines` should skip `'quoted'` lines the same way it skips
|
|
38
|
+
* `'code'` ones. The cost: a genuine callout or admonition written with `>` (not a quoted
|
|
39
|
+
* bad example) also goes unchecked. That trade favors the false negative over the false
|
|
40
|
+
* positive, because `prose-voice.md` itself is the corpus that motivated this fix, and it
|
|
41
|
+
* blockquotes bad examples specifically to forbid them without committing them.
|
|
42
|
+
*
|
|
45
43
|
* Calling `stripCode` alone reintroduces the blockquote false positive this module exists
|
|
46
44
|
* to eliminate: a document that quotes a bad example to forbid it, such as
|
|
47
45
|
* `prose-voice.md`'s own "Punctuation doing work that sentences should do" section, still
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Separates markdown prose from code, so a prose checker never mistakes a code token for a
|
|
3
|
-
* voice violation.
|
|
4
|
-
*
|
|
5
|
-
* A checker built on a naive fence toggle (`` ``` `` flips a boolean, then a same-line
|
|
6
|
-
* backtick regex strips inline spans) measured 0% precision in `PROBE-regex.md`'s b1
|
|
7
|
-
* candidate: both of its two findings were false positives, one from an inline-code span
|
|
8
|
-
* that opens on one line and closes on the next (the toggle only matched a span with no
|
|
9
|
-
* embedded newline), the other from a blockquoted "before" example that the document quotes
|
|
10
|
-
* on purpose to forbid, not a violation of its own voice. This module fixes the first as a
|
|
11
|
-
* lexing bug and treats the second as a naming decision, documented below.
|
|
12
|
-
*
|
|
13
|
-
* DECISION: a blockquoted line (`^ {0,3}>`) is classified `'quoted'`, never `'prose'`. A
|
|
14
|
-
* checker built on `classifyLines` should skip `'quoted'` lines the same way it skips
|
|
15
|
-
* `'code'` ones. The cost: a genuine callout or admonition written with `>` (not a quoted
|
|
16
|
-
* bad example) also goes unchecked. That trade favors the false negative over the false
|
|
17
|
-
* positive, because `prose-voice.md` itself is the corpus that motivated this fix, and it
|
|
18
|
-
* blockquotes bad examples specifically to forbid them without committing them.
|
|
19
|
-
*/
|
|
20
1
|
const FENCE_OPEN_RE = /^ {0,3}(`{3,}|~{3,})/;
|
|
21
2
|
const INDENTED_CODE_RE = /^(?: {4}|\t)/;
|
|
22
3
|
const BLOCKQUOTE_RE = /^ {0,3}>/;
|
|
@@ -99,6 +80,23 @@ export function stripCode(markdown) {
|
|
|
99
80
|
* blockquoted (`'quoted'`) lines, all replaced by same-length or same-line-count filler.
|
|
100
81
|
* Line numbers are unchanged, same guarantee as `stripCode`.
|
|
101
82
|
*
|
|
83
|
+
* Separates markdown prose from code, so a prose checker never mistakes a code token for a
|
|
84
|
+
* voice violation. A checker built on a naive fence toggle (`` ``` `` flips a boolean, then
|
|
85
|
+
* a same-line backtick regex strips inline spans) measured 0% precision in
|
|
86
|
+
* `PROBE-regex.md`'s b1 candidate: both of its two findings were false positives, one from
|
|
87
|
+
* an inline-code span that opens on one line and closes on the next (the toggle only
|
|
88
|
+
* matched a span with no embedded newline), the other from a blockquoted "before" example
|
|
89
|
+
* that the document quotes on purpose to forbid, not a violation of its own voice. This
|
|
90
|
+
* module fixes the first as a lexing bug and treats the second as a naming decision,
|
|
91
|
+
* documented below.
|
|
92
|
+
*
|
|
93
|
+
* DECISION: a blockquoted line (`^ {0,3}>`) is classified `'quoted'`, never `'prose'`. A
|
|
94
|
+
* checker built on `classifyLines` should skip `'quoted'` lines the same way it skips
|
|
95
|
+
* `'code'` ones. The cost: a genuine callout or admonition written with `>` (not a quoted
|
|
96
|
+
* bad example) also goes unchecked. That trade favors the false negative over the false
|
|
97
|
+
* positive, because `prose-voice.md` itself is the corpus that motivated this fix, and it
|
|
98
|
+
* blockquotes bad examples specifically to forbid them without committing them.
|
|
99
|
+
*
|
|
102
100
|
* Calling `stripCode` alone reintroduces the blockquote false positive this module exists
|
|
103
101
|
* to eliminate: a document that quotes a bad example to forbid it, such as
|
|
104
102
|
* `prose-voice.md`'s own "Punctuation doing work that sentences should do" section, still
|
|
@@ -27,7 +27,7 @@ export declare function readStdinJson<T = Record<string, unknown>>(): T;
|
|
|
27
27
|
export declare function tail(text: string, n: number): string;
|
|
28
28
|
/**
|
|
29
29
|
* A path glob compiled to an anchored RegExp: `*` stays within one segment, `**` spans
|
|
30
|
-
* separators
|
|
30
|
+
* separators, and when a doublestar is followed by a slash it also matches zero
|
|
31
31
|
* directories — `?` is one non-separator character. Every other metacharacter is literal.
|
|
32
32
|
*/
|
|
33
33
|
export declare function globToRe(glob: string): RegExp;
|
|
@@ -65,7 +65,7 @@ export function tail(text, n) {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* A path glob compiled to an anchored RegExp: `*` stays within one segment, `**` spans
|
|
68
|
-
* separators
|
|
68
|
+
* separators, and when a doublestar is followed by a slash it also matches zero
|
|
69
69
|
* directories — `?` is one non-separator character. Every other metacharacter is literal.
|
|
70
70
|
*/
|
|
71
71
|
export function globToRe(glob) {
|