chaffjs 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/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +104 -0
- package/dist/announced-count.js.map +1 -0
- package/dist/bare-url.d.ts +14 -0
- package/dist/bare-url.d.ts.map +1 -0
- package/dist/bare-url.js +28 -0
- package/dist/bare-url.js.map +1 -0
- package/dist/baseline.d.ts +5 -0
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +16 -1
- package/dist/baseline.js.map +1 -1
- package/dist/body-section.d.ts +7 -0
- package/dist/body-section.d.ts.map +1 -0
- package/dist/body-section.js +6 -0
- package/dist/body-section.js.map +1 -0
- package/dist/calendar-number.d.ts +9 -2
- package/dist/calendar-number.d.ts.map +1 -1
- package/dist/calendar-number.js +18 -4
- package/dist/calendar-number.js.map +1 -1
- package/dist/cli-args.d.ts +4 -0
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +8 -4
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.js +33 -30
- package/dist/cli.js.map +1 -1
- package/dist/closing-numbers.d.ts +20 -0
- package/dist/closing-numbers.d.ts.map +1 -0
- package/dist/closing-numbers.js +56 -0
- package/dist/closing-numbers.js.map +1 -0
- package/dist/commands/compare.d.ts +8 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +72 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +17 -9
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/feedback.d.ts +5 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +11 -5
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +13 -13
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/tree.d.ts +13 -0
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +35 -5
- package/dist/commands/tree.js.map +1 -1
- package/dist/compare/atom.d.ts +31 -0
- package/dist/compare/atom.d.ts.map +1 -0
- package/dist/compare/atom.js +4 -0
- package/dist/compare/atom.js.map +1 -0
- package/dist/compare/clock-time.d.ts +8 -0
- package/dist/compare/clock-time.d.ts.map +1 -0
- package/dist/compare/clock-time.js +65 -0
- package/dist/compare/clock-time.js.map +1 -0
- package/dist/compare/extract.d.ts +15 -0
- package/dist/compare/extract.d.ts.map +1 -0
- package/dist/compare/extract.js +58 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-text.d.ts +23 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +47 -0
- package/dist/compare/fact-text.js.map +1 -0
- package/dist/compare/markup-atoms.d.ts +11 -0
- package/dist/compare/markup-atoms.d.ts.map +1 -0
- package/dist/compare/markup-atoms.js +23 -0
- package/dist/compare/markup-atoms.js.map +1 -0
- package/dist/compare/match.d.ts +19 -0
- package/dist/compare/match.d.ts.map +1 -0
- package/dist/compare/match.js +84 -0
- package/dist/compare/match.js.map +1 -0
- package/dist/compare/outcome.d.ts +33 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +40 -0
- package/dist/compare/outcome.js.map +1 -0
- package/dist/compare/proper-nouns.d.ts +19 -0
- package/dist/compare/proper-nouns.d.ts.map +1 -0
- package/dist/compare/proper-nouns.js +44 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +9 -0
- package/dist/compare/render.d.ts.map +1 -0
- package/dist/compare/render.js +64 -0
- package/dist/compare/render.js.map +1 -0
- package/dist/compare/spans.d.ts +9 -0
- package/dist/compare/spans.d.ts.map +1 -0
- package/dist/compare/spans.js +11 -0
- package/dist/compare/spans.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +24 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +67 -0
- package/dist/compare/text-atoms.js.map +1 -0
- package/dist/compare/text.d.ts +24 -0
- package/dist/compare/text.d.ts.map +1 -0
- package/dist/compare/text.js +90 -0
- package/dist/compare/text.js.map +1 -0
- package/dist/compare/tree-atoms.d.ts +20 -0
- package/dist/compare/tree-atoms.d.ts.map +1 -0
- package/dist/compare/tree-atoms.js +58 -0
- package/dist/compare/tree-atoms.js.map +1 -0
- package/dist/compare/written-names.d.ts +8 -0
- package/dist/compare/written-names.d.ts.map +1 -0
- package/dist/compare/written-names.js +24 -0
- package/dist/compare/written-names.js.map +1 -0
- package/dist/config/load.d.ts +15 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +5 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +16 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +58 -0
- package/dist/config/option-problems.js.map +1 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.d.ts.map +1 -0
- package/dist/config/read.js +8 -0
- package/dist/config/read.js.map +1 -0
- package/dist/config/rule-problems.d.ts +2 -4
- package/dist/config/rule-problems.d.ts.map +1 -1
- package/dist/config/rule-problems.js +7 -1
- package/dist/config/rule-problems.js.map +1 -1
- package/dist/config/style.d.ts +16 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +36 -0
- package/dist/config/style.js.map +1 -0
- package/dist/config/warnings.d.ts +6 -0
- package/dist/config/warnings.d.ts.map +1 -0
- package/dist/config/warnings.js +10 -0
- package/dist/config/warnings.js.map +1 -0
- package/dist/config/write.d.ts.map +1 -1
- package/dist/config/write.js +17 -4
- package/dist/config/write.js.map +1 -1
- package/dist/custom/bounded-match.d.ts +15 -0
- package/dist/custom/bounded-match.d.ts.map +1 -0
- package/dist/custom/bounded-match.js +43 -0
- package/dist/custom/bounded-match.js.map +1 -0
- package/dist/custom/load.d.ts +8 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +11 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/parse.d.ts +70 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +215 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +5 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +78 -0
- package/dist/custom/problems.js.map +1 -0
- package/dist/custom/regex-safety.d.ts +11 -0
- package/dist/custom/regex-safety.d.ts.map +1 -0
- package/dist/custom/regex-safety.js +110 -0
- package/dist/custom/regex-safety.js.map +1 -0
- package/dist/custom/token-pattern.d.ts +8 -0
- package/dist/custom/token-pattern.d.ts.map +1 -0
- package/dist/custom/token-pattern.js +75 -0
- package/dist/custom/token-pattern.js.map +1 -0
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +24 -2
- package/dist/detect.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +4 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +25 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-expansion.d.ts +2 -0
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +104 -1
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/agreement-slip.d.ts +32 -0
- package/dist/detectors/agreement-slip.d.ts.map +1 -0
- package/dist/detectors/agreement-slip.js +137 -0
- package/dist/detectors/agreement-slip.js.map +1 -0
- package/dist/detectors/ai-phrasing.d.ts +20 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +112 -0
- package/dist/detectors/ai-phrasing.js.map +1 -0
- package/dist/detectors/announced-count.d.ts +4 -0
- package/dist/detectors/announced-count.d.ts.map +1 -0
- package/dist/detectors/announced-count.js +20 -0
- package/dist/detectors/announced-count.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +17 -0
- package/dist/detectors/broken-link.d.ts.map +1 -0
- package/dist/detectors/broken-link.js +66 -0
- package/dist/detectors/broken-link.js.map +1 -0
- package/dist/detectors/cited-name.d.ts.map +1 -1
- package/dist/detectors/cited-name.js +4 -4
- package/dist/detectors/cited-name.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +11 -0
- package/dist/detectors/cited-title.d.ts.map +1 -0
- package/dist/detectors/cited-title.js +75 -0
- package/dist/detectors/cited-title.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +1 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +2 -1
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/content-morphemes.d.ts +4 -0
- package/dist/detectors/content-morphemes.d.ts.map +1 -0
- package/dist/detectors/content-morphemes.js +12 -0
- package/dist/detectors/content-morphemes.js.map +1 -0
- package/dist/detectors/contrast-frame.d.ts +17 -0
- package/dist/detectors/contrast-frame.d.ts.map +1 -0
- package/dist/detectors/contrast-frame.js +32 -0
- package/dist/detectors/contrast-frame.js.map +1 -0
- package/dist/detectors/custom.d.ts +8 -0
- package/dist/detectors/custom.d.ts.map +1 -0
- package/dist/detectors/custom.js +71 -0
- package/dist/detectors/custom.js.map +1 -0
- package/dist/detectors/dangling-figure.d.ts +4 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +18 -0
- package/dist/detectors/dangling-figure.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +9 -0
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -0
- package/dist/detectors/doubled-punctuation.js +33 -0
- package/dist/detectors/doubled-punctuation.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts +5 -0
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +24 -11
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/en-shape.d.ts +0 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +0 -235
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/enumerated-runs.d.ts +1 -1
- package/dist/detectors/enumerated-runs.d.ts.map +1 -1
- package/dist/detectors/enumerated-runs.js +15 -4
- package/dist/detectors/enumerated-runs.js.map +1 -1
- package/dist/detectors/gram-furniture.d.ts +6 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -0
- package/dist/detectors/gram-furniture.js +21 -0
- package/dist/detectors/gram-furniture.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +2 -0
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +9 -7
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-windows.d.ts +9 -0
- package/dist/detectors/gram-windows.d.ts.map +1 -0
- package/dist/detectors/gram-windows.js +27 -0
- package/dist/detectors/gram-windows.js.map +1 -0
- package/dist/detectors/heading-case.d.ts +2 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +29 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-code-words.d.ts +6 -0
- package/dist/detectors/heading-code-words.d.ts.map +1 -0
- package/dist/detectors/heading-code-words.js +29 -0
- package/dist/detectors/heading-code-words.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +17 -20
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-level-skip.d.ts +12 -0
- package/dist/detectors/heading-level-skip.d.ts.map +1 -0
- package/dist/detectors/heading-level-skip.js +11 -0
- package/dist/detectors/heading-level-skip.js.map +1 -0
- package/dist/detectors/heading-overlap.d.ts +13 -0
- package/dist/detectors/heading-overlap.d.ts.map +1 -0
- package/dist/detectors/heading-overlap.js +52 -0
- package/dist/detectors/heading-overlap.js.map +1 -0
- package/dist/detectors/image-alt-text.d.ts +3 -0
- package/dist/detectors/image-alt-text.d.ts.map +1 -0
- package/dist/detectors/image-alt-text.js +9 -0
- package/dist/detectors/image-alt-text.js.map +1 -0
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +40 -2
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/kutoten-consistency.d.ts +24 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -0
- package/dist/detectors/kutoten-consistency.js +77 -0
- package/dist/detectors/kutoten-consistency.js.map +1 -0
- package/dist/detectors/lead-in.d.ts +1 -0
- package/dist/detectors/lead-in.d.ts.map +1 -1
- package/dist/detectors/lead-in.js +2 -1
- package/dist/detectors/lead-in.js.map +1 -1
- package/dist/detectors/letter-joined-name.d.ts +13 -0
- package/dist/detectors/letter-joined-name.d.ts.map +1 -0
- package/dist/detectors/letter-joined-name.js +11 -0
- package/dist/detectors/letter-joined-name.js.map +1 -0
- package/dist/detectors/lexicon-match.d.ts +4 -0
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +7 -2
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +5 -2
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-item.d.ts +45 -0
- package/dist/detectors/list-item.d.ts.map +1 -0
- package/dist/detectors/list-item.js +88 -0
- package/dist/detectors/list-item.js.map +1 -0
- package/dist/detectors/list-items.d.ts +31 -0
- package/dist/detectors/list-items.d.ts.map +1 -0
- package/dist/detectors/list-items.js +113 -0
- package/dist/detectors/list-items.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts +7 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -0
- package/dist/detectors/list-lead-in.js +28 -0
- package/dist/detectors/list-lead-in.js.map +1 -0
- package/dist/detectors/list-sentence.d.ts +65 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +105 -0
- package/dist/detectors/list-sentence.js.map +1 -0
- package/dist/detectors/list-view.d.ts +34 -0
- package/dist/detectors/list-view.d.ts.map +1 -0
- package/dist/detectors/list-view.js +137 -0
- package/dist/detectors/list-view.js.map +1 -0
- package/dist/detectors/long-vowel.d.ts +7 -0
- package/dist/detectors/long-vowel.d.ts.map +1 -0
- package/dist/detectors/long-vowel.js +57 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +6 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +19 -0
- package/dist/detectors/markup-finding.js.map +1 -0
- package/dist/detectors/name-numeral.d.ts +1 -1
- package/dist/detectors/name-numeral.d.ts.map +1 -1
- package/dist/detectors/name-numeral.js +2 -7
- package/dist/detectors/name-numeral.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +16 -12
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts +9 -0
- package/dist/detectors/oxford-comma.d.ts.map +1 -0
- package/dist/detectors/oxford-comma.js +246 -0
- package/dist/detectors/oxford-comma.js.map +1 -0
- package/dist/detectors/place-run.d.ts.map +1 -1
- package/dist/detectors/place-run.js +10 -6
- package/dist/detectors/place-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +9 -0
- package/dist/detectors/placeholder-text.d.ts.map +1 -0
- package/dist/detectors/placeholder-text.js +18 -0
- package/dist/detectors/placeholder-text.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +3 -0
- package/dist/detectors/quote-around.d.ts.map +1 -0
- package/dist/detectors/quote-around.js +8 -0
- package/dist/detectors/quote-around.js.map +1 -0
- package/dist/detectors/register.d.ts +11 -3
- package/dist/detectors/register.d.ts.map +1 -1
- package/dist/detectors/register.js +28 -9
- package/dist/detectors/register.js.map +1 -1
- package/dist/detectors/roman-numeral.d.ts +2 -0
- package/dist/detectors/roman-numeral.d.ts.map +1 -1
- package/dist/detectors/roman-numeral.js +2 -0
- package/dist/detectors/roman-numeral.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +17 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +13 -7
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +13 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/signals.d.ts +8 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +94 -54
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/stacked-hedge.d.ts +0 -7
- package/dist/detectors/stacked-hedge.d.ts.map +1 -1
- package/dist/detectors/stacked-hedge.js +6 -3
- package/dist/detectors/stacked-hedge.js.map +1 -1
- package/dist/detectors/stray-space.d.ts +7 -0
- package/dist/detectors/stray-space.d.ts.map +1 -0
- package/dist/detectors/stray-space.js +34 -0
- package/dist/detectors/stray-space.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +6 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +37 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +4 -4
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +7 -6
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +8 -5
- package/dist/detectors/superlative-name.js.map +1 -1
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +9 -4
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/token-column.d.ts +46 -0
- package/dist/detectors/token-column.d.ts.map +1 -0
- package/dist/detectors/token-column.js +95 -0
- package/dist/detectors/token-column.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts +22 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -0
- package/dist/detectors/unbalanced-bracket.js +119 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -0
- package/dist/detectors/url-run-on.d.ts +9 -0
- package/dist/detectors/url-run-on.d.ts.map +1 -0
- package/dist/detectors/url-run-on.js +19 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- package/dist/document-sections.d.ts +13 -0
- package/dist/document-sections.d.ts.map +1 -0
- package/dist/document-sections.js +32 -0
- package/dist/document-sections.js.map +1 -0
- package/dist/document.d.ts +11 -4
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +99 -95
- package/dist/document.js.map +1 -1
- package/dist/email-parts.d.ts +28 -0
- package/dist/email-parts.d.ts.map +1 -0
- package/dist/email-parts.js +230 -0
- package/dist/email-parts.js.map +1 -0
- package/dist/eval.d.ts +2 -1
- package/dist/eval.d.ts.map +1 -1
- package/dist/eval.js +16 -4
- package/dist/eval.js.map +1 -1
- package/dist/figure-references.d.ts +30 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +76 -0
- package/dist/figure-references.js.map +1 -0
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +4 -0
- package/dist/files.js.map +1 -1
- package/dist/genre-parse.d.ts +5 -1
- package/dist/genre-parse.d.ts.map +1 -1
- package/dist/genre-parse.js +16 -3
- package/dist/genre-parse.js.map +1 -1
- package/dist/genre-suggest.d.ts.map +1 -1
- package/dist/genre-suggest.js +15 -1
- package/dist/genre-suggest.js.map +1 -1
- package/dist/heading-label.d.ts +22 -0
- package/dist/heading-label.d.ts.map +1 -0
- package/dist/heading-label.js +50 -0
- package/dist/heading-label.js.map +1 -0
- package/dist/in-page-nav.d.ts +4 -1
- package/dist/in-page-nav.d.ts.map +1 -1
- package/dist/in-page-nav.js +53 -18
- package/dist/in-page-nav.js.map +1 -1
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/levels.d.ts +5 -1
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +9 -0
- package/dist/levels.js.map +1 -1
- package/dist/line-paragraphs.d.ts +8 -0
- package/dist/line-paragraphs.d.ts.map +1 -1
- package/dist/line-paragraphs.js +36 -11
- package/dist/line-paragraphs.js.map +1 -1
- package/dist/long-vowel.d.ts +35 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +71 -0
- package/dist/long-vowel.js.map +1 -0
- package/dist/markdown-node.d.ts +19 -0
- package/dist/markdown-node.d.ts.map +1 -0
- package/dist/markdown-node.js +6 -0
- package/dist/markdown-node.js.map +1 -0
- package/dist/markdown-read.d.ts +17 -0
- package/dist/markdown-read.d.ts.map +1 -0
- package/dist/markdown-read.js +37 -0
- package/dist/markdown-read.js.map +1 -0
- package/dist/markup.d.ts +22 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +180 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.d.ts.map +1 -1
- package/dist/mask.js +10 -16
- package/dist/mask.js.map +1 -1
- package/dist/number-name.d.ts +21 -5
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +120 -18
- package/dist/number-name.js.map +1 -1
- package/dist/opening-line.d.ts +3 -0
- package/dist/opening-line.d.ts.map +1 -0
- package/dist/opening-line.js +14 -0
- package/dist/opening-line.js.map +1 -0
- package/dist/orthography.d.ts +7 -1
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +16 -5
- package/dist/orthography.js.map +1 -1
- package/dist/page-furniture.d.ts +5 -2
- package/dist/page-furniture.d.ts.map +1 -1
- package/dist/page-furniture.js +8 -2
- package/dist/page-furniture.js.map +1 -1
- package/dist/paragraph-length.d.ts +7 -0
- package/dist/paragraph-length.d.ts.map +1 -0
- package/dist/paragraph-length.js +10 -0
- package/dist/paragraph-length.js.map +1 -0
- package/dist/plain-source.d.ts +1 -0
- package/dist/plain-source.d.ts.map +1 -1
- package/dist/plain-source.js +2 -1
- package/dist/plain-source.js.map +1 -1
- package/dist/plugin.d.ts +121 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/for-file.d.ts.map +1 -1
- package/dist/profile/for-file.js +3 -1
- package/dist/profile/for-file.js.map +1 -1
- package/dist/quoted-span.d.ts +0 -2
- package/dist/quoted-span.d.ts.map +1 -1
- package/dist/quoted-span.js +9 -4
- package/dist/quoted-span.js.map +1 -1
- package/dist/reasons.d.ts +3 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +6 -0
- package/dist/reasons.js.map +1 -1
- package/dist/reference-lists.d.ts +3 -0
- package/dist/reference-lists.d.ts.map +1 -0
- package/dist/reference-lists.js +75 -0
- package/dist/reference-lists.js.map +1 -0
- package/dist/render/explain.d.ts +7 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +36 -12
- package/dist/render/explain.js.map +1 -1
- package/dist/render/friendly.d.ts.map +1 -1
- package/dist/render/friendly.js +19 -9
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/options.d.ts +7 -0
- package/dist/render/options.d.ts.map +1 -0
- package/dist/render/options.js +50 -0
- package/dist/render/options.js.map +1 -0
- package/dist/render/rules-json.d.ts +4 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +102 -12
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.d.ts +4 -0
- package/dist/render/rules-table.d.ts.map +1 -0
- package/dist/render/rules-table.js +70 -0
- package/dist/render/rules-table.js.map +1 -0
- package/dist/render/sarif.js +4 -4
- package/dist/render/sarif.js.map +1 -1
- package/dist/render/semantic.js +3 -3
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/severity-name.d.ts +6 -0
- package/dist/render/severity-name.d.ts.map +1 -0
- package/dist/render/severity-name.js +7 -0
- package/dist/render/severity-name.js.map +1 -0
- package/dist/render/text.d.ts +7 -2
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +15 -4
- package/dist/render/text.js.map +1 -1
- package/dist/resolve-genre.d.ts +1 -1
- package/dist/resolve-genre.d.ts.map +1 -1
- package/dist/resolve-genre.js +4 -1
- package/dist/resolve-genre.js.map +1 -1
- package/dist/rule-genres.d.ts +24 -0
- package/dist/rule-genres.d.ts.map +1 -0
- package/dist/rule-genres.js +11 -0
- package/dist/rule-genres.js.map +1 -0
- package/dist/rule-guide.d.ts +54 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +81 -0
- package/dist/rule-guide.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +94 -32
- package/dist/rule-load.js.map +1 -1
- package/dist/rule-options.d.ts +50 -0
- package/dist/rule-options.d.ts.map +1 -0
- package/dist/rule-options.js +106 -0
- package/dist/rule-options.js.map +1 -0
- package/dist/run-semantic.d.ts +3 -1
- package/dist/run-semantic.d.ts.map +1 -1
- package/dist/run-semantic.js +8 -3
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +15 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +57 -10
- package/dist/run.js.map +1 -1
- package/dist/semantic.d.ts +1 -1
- package/dist/semantic.d.ts.map +1 -1
- package/dist/semantic.js +10 -3
- package/dist/semantic.js.map +1 -1
- package/dist/sentence-shape.d.ts.map +1 -1
- package/dist/sentence-shape.js +4 -4
- package/dist/sentence-shape.js.map +1 -1
- package/dist/setting-problems.d.ts +2 -1
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +6 -1
- package/dist/setting-problems.js.map +1 -1
- package/dist/span-cut.d.ts +6 -0
- package/dist/span-cut.d.ts.map +1 -0
- package/dist/span-cut.js +22 -0
- package/dist/span-cut.js.map +1 -0
- package/dist/span-merge.d.ts +4 -0
- package/dist/span-merge.d.ts.map +1 -0
- package/dist/span-merge.js +12 -0
- package/dist/span-merge.js.map +1 -0
- package/dist/speaker-labels.d.ts +4 -0
- package/dist/speaker-labels.d.ts.map +1 -0
- package/dist/speaker-labels.js +106 -0
- package/dist/speaker-labels.js.map +1 -0
- package/dist/stray-space.d.ts +17 -0
- package/dist/stray-space.d.ts.map +1 -0
- package/dist/stray-space.js +66 -0
- package/dist/stray-space.js.map +1 -0
- package/dist/structure/aside-depth.d.ts +21 -0
- package/dist/structure/aside-depth.d.ts.map +1 -0
- package/dist/structure/aside-depth.js +65 -0
- package/dist/structure/aside-depth.js.map +1 -0
- package/dist/structure/build.d.ts +5 -1
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +29 -17
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/closed-pairs.d.ts +8 -0
- package/dist/structure/closed-pairs.d.ts.map +1 -0
- package/dist/structure/closed-pairs.js +22 -0
- package/dist/structure/closed-pairs.js.map +1 -0
- package/dist/structure/date-range.d.ts +21 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +45 -0
- package/dist/structure/date-range.js.map +1 -0
- package/dist/structure/known-mentions.d.ts +18 -0
- package/dist/structure/known-mentions.d.ts.map +1 -0
- package/dist/structure/known-mentions.js +78 -0
- package/dist/structure/known-mentions.js.map +1 -0
- package/dist/structure/numbering.d.ts +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +11 -6
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/of.d.ts +3 -1
- package/dist/structure/of.d.ts.map +1 -1
- package/dist/structure/of.js +5 -1
- package/dist/structure/of.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +16 -0
- package/dist/structure/percent-sum.d.ts.map +1 -0
- package/dist/structure/percent-sum.js +104 -0
- package/dist/structure/percent-sum.js.map +1 -0
- package/dist/structure/quoted-number.d.ts +8 -0
- package/dist/structure/quoted-number.d.ts.map +1 -0
- package/dist/structure/quoted-number.js +34 -0
- package/dist/structure/quoted-number.js.map +1 -0
- package/dist/structure/relative-find.d.ts.map +1 -1
- package/dist/structure/relative-find.js +34 -46
- package/dist/structure/relative-find.js.map +1 -1
- package/dist/structure/relative-resolve.d.ts.map +1 -1
- package/dist/structure/relative-resolve.js +94 -42
- package/dist/structure/relative-resolve.js.map +1 -1
- package/dist/structure/runs.d.ts +2 -0
- package/dist/structure/runs.d.ts.map +1 -1
- package/dist/structure/runs.js +2 -2
- package/dist/structure/runs.js.map +1 -1
- package/dist/structure/sexp.d.ts +1 -1
- package/dist/structure/sexp.d.ts.map +1 -1
- package/dist/structure/sexp.js +18 -6
- package/dist/structure/sexp.js.map +1 -1
- package/dist/structure/total.d.ts +3 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +2 -2
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/universal.d.ts +14 -2
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +17 -2
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/wrapped-tail.d.ts +14 -7
- package/dist/structure/wrapped-tail.d.ts.map +1 -1
- package/dist/structure/wrapped-tail.js +33 -8
- package/dist/structure/wrapped-tail.js.map +1 -1
- package/dist/style-load.d.ts +4 -0
- package/dist/style-load.d.ts.map +1 -0
- package/dist/style-load.js +28 -0
- package/dist/style-load.js.map +1 -0
- package/dist/style-parse.d.ts +19 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +60 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +6 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +57 -0
- package/dist/subheading-line.js.map +1 -0
- package/dist/team-names.d.ts.map +1 -1
- package/dist/team-names.js +11 -14
- package/dist/team-names.js.map +1 -1
- package/dist/template-syntax.d.ts +17 -0
- package/dist/template-syntax.d.ts.map +1 -0
- package/dist/template-syntax.js +140 -0
- package/dist/template-syntax.js.map +1 -0
- package/dist/text-above.d.ts +19 -0
- package/dist/text-above.d.ts.map +1 -0
- package/dist/text-above.js +43 -0
- package/dist/text-above.js.map +1 -0
- package/dist/text-figures.d.ts +10 -0
- package/dist/text-figures.d.ts.map +1 -0
- package/dist/text-figures.js +131 -0
- package/dist/text-figures.js.map +1 -0
- package/dist/trailing-aside.d.ts +2 -0
- package/dist/trailing-aside.d.ts.map +1 -0
- package/dist/trailing-aside.js +53 -0
- package/dist/trailing-aside.js.map +1 -0
- package/dist/tree-walk.d.ts +18 -0
- package/dist/tree-walk.d.ts.map +1 -0
- package/dist/tree-walk.js +45 -0
- package/dist/tree-walk.js.map +1 -0
- package/genres.yaml +60 -2
- package/package.json +5 -3
- package/reference-headings.yaml +17 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +19 -0
- package/rules/agreement-slip.yaml +49 -0
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +23 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +51 -0
- package/rules/assistant-residue.yaml +52 -0
- package/rules/bold-density.yaml +31 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +33 -0
- package/rules/colon-lead-in.yaml +59 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +57 -0
- package/rules/cushion-phrase-density.yaml +25 -0
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +53 -1
- package/rules/date-order.yaml +33 -1
- package/rules/date-range-reversed.yaml +46 -0
- package/rules/date-weekday-mismatch.yaml +17 -1
- package/rules/double-keigo.yaml +16 -0
- package/rules/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +17 -1
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/emoji-density.yaml +25 -0
- package/rules/empty-conclusion.yaml +29 -0
- package/rules/empty-intensifier.yaml +19 -0
- package/rules/excessive-hedging.yaml +19 -0
- package/rules/expletive-construction.yaml +19 -0
- package/rules/heading-echo.yaml +32 -0
- package/rules/heading-level-skip.yaml +78 -0
- package/rules/hiragana-fukushi.yaml +16 -0
- package/rules/image-alt-text.yaml +54 -0
- package/rules/internal-jargon.yaml +21 -0
- package/rules/katakana-long-vowel.yaml +98 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +23 -4
- package/rules/max-kanji-continuous.yaml +16 -0
- package/rules/max-paragraph-length.yaml +42 -2
- package/rules/max-sentence-length.yaml +36 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +16 -0
- package/rules/no-em-dash.yaml +25 -0
- package/rules/no-mixed-desumasu.yaml +27 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/oxford-comma-consistency.yaml +19 -1
- package/rules/padded-intro.yaml +19 -0
- package/rules/paragraph-length-variance.yaml +49 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +27 -0
- package/rules/proper-noun-density.yaml +26 -0
- package/rules/repeated-conjunction.yaml +47 -0
- package/rules/repeated-sentence-head.yaml +23 -0
- package/rules/required-sections.yaml +49 -0
- package/rules/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +97 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +89 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +25 -0
- package/rules/stock-transition.yaml +55 -0
- package/rules/stray-space.yaml +56 -0
- package/rules/taigen-dome-in-prose.yaml +19 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +37 -1
- package/rules/unbalanced-bracket.yaml +56 -0
- package/rules/undefined-acronym.yaml +23 -0
- package/rules/unfilled-placeholder.yaml +50 -0
- package/rules/unqualified-superlative.yaml +19 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/url-run-on.yaml +45 -0
- package/skills/chaff/SKILL.md +70 -0
- package/src/announced-count.ts +148 -0
- package/src/bare-url.ts +35 -0
- package/src/baseline.ts +17 -1
- package/src/body-section.ts +7 -0
- package/src/calendar-number.ts +33 -10
- package/src/cli-args.ts +6 -0
- package/src/cli-text.ts +8 -4
- package/src/cli.ts +37 -37
- package/src/closing-numbers.ts +72 -0
- package/src/commands/compare.ts +80 -0
- package/src/commands/eval.ts +19 -8
- package/src/commands/feedback.ts +12 -6
- package/src/commands/test.ts +20 -17
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +86 -0
- package/src/compare/extract.ts +78 -0
- package/src/compare/fact-text.ts +68 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +70 -0
- package/src/compare/proper-nouns.ts +65 -0
- package/src/compare/render.ts +102 -0
- package/src/compare/spans.ts +17 -0
- package/src/compare/text-atoms.ts +95 -0
- package/src/compare/text.ts +120 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +21 -0
- package/src/config/option-problems.ts +70 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +42 -0
- package/src/config/warnings.ts +13 -0
- package/src/config/write.ts +18 -4
- package/src/custom/bounded-match.ts +58 -0
- package/src/custom/load.ts +15 -0
- package/src/custom/parse.ts +274 -0
- package/src/custom/problems.ts +89 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect.ts +28 -2
- package/src/detectors/acronym-context.ts +32 -4
- package/src/detectors/acronym-expansion.ts +132 -1
- package/src/detectors/agreement-slip.ts +191 -0
- package/src/detectors/ai-phrasing.ts +137 -0
- package/src/detectors/announced-count.ts +25 -0
- package/src/detectors/broken-link.ts +90 -0
- package/src/detectors/cited-name.ts +6 -5
- package/src/detectors/cited-title.ts +96 -0
- package/src/detectors/concrete-evidence.ts +3 -2
- package/src/detectors/content-morphemes.ts +19 -0
- package/src/detectors/contrast-frame.ts +54 -0
- package/src/detectors/custom.ts +89 -0
- package/src/detectors/dangling-figure.ts +22 -0
- package/src/detectors/doubled-punctuation.ts +49 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/en-shape.ts +0 -269
- package/src/detectors/enumerated-runs.ts +13 -4
- package/src/detectors/gram-furniture.ts +30 -0
- package/src/detectors/gram-place.ts +9 -5
- package/src/detectors/gram-windows.ts +31 -0
- package/src/detectors/heading-case.ts +30 -2
- package/src/detectors/heading-code-words.ts +35 -0
- package/src/detectors/heading-echo.ts +18 -22
- package/src/detectors/heading-level-skip.ts +19 -0
- package/src/detectors/heading-overlap.ts +65 -0
- package/src/detectors/image-alt-text.ts +11 -0
- package/src/detectors/index.ts +49 -2
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/letter-joined-name.ts +15 -0
- package/src/detectors/lexicon-match.ts +9 -2
- package/src/detectors/lexicon.ts +6 -2
- package/src/detectors/list-item.ts +122 -0
- package/src/detectors/list-items.ts +163 -0
- package/src/detectors/list-lead-in.ts +33 -0
- package/src/detectors/list-sentence.ts +157 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +66 -0
- package/src/detectors/markup-finding.ts +24 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/orthography.ts +24 -18
- package/src/detectors/oxford-comma.ts +297 -0
- package/src/detectors/place-run.ts +7 -4
- package/src/detectors/placeholder-text.ts +27 -0
- package/src/detectors/quote-around.ts +9 -0
- package/src/detectors/register.ts +37 -10
- package/src/detectors/roman-numeral.ts +3 -0
- package/src/detectors/sentence-ending.ts +14 -7
- package/src/detectors/sentence-length.ts +16 -5
- package/src/detectors/signals.ts +110 -53
- package/src/detectors/stacked-hedge.ts +6 -3
- package/src/detectors/stray-space.ts +40 -0
- package/src/detectors/structure-tree.ts +45 -1
- package/src/detectors/structure.ts +13 -6
- package/src/detectors/superlative-name.ts +7 -4
- package/src/detectors/superlative-scope.ts +8 -3
- package/src/detectors/token-column.ts +149 -0
- package/src/detectors/unbalanced-bracket.ts +153 -0
- package/src/detectors/url-run-on.ts +27 -0
- package/src/document-sections.ts +46 -0
- package/src/document.ts +116 -127
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/figure-references.ts +112 -0
- package/src/files.ts +5 -0
- package/src/genre-parse.ts +30 -5
- package/src/genre-suggest.ts +15 -2
- package/src/heading-label.ts +55 -0
- package/src/in-page-nav.ts +48 -19
- package/src/joined-view.ts +1 -0
- package/src/levels.ts +14 -1
- package/src/line-paragraphs.ts +56 -10
- package/src/long-vowel.ts +99 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +210 -0
- package/src/mask.ts +10 -19
- package/src/number-name.ts +152 -25
- package/src/opening-line.ts +17 -0
- package/src/orthography.ts +20 -5
- package/src/page-furniture.ts +11 -2
- package/src/paragraph-length.ts +9 -0
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +107 -1
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +10 -4
- package/src/reasons.ts +9 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/explain.ts +47 -13
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +130 -14
- package/src/render/rules-table.ts +91 -0
- package/src/render/sarif.ts +4 -4
- package/src/render/semantic.ts +3 -3
- package/src/render/severity-name.ts +10 -0
- package/src/render/text.ts +21 -7
- package/src/resolve-genre.ts +4 -1
- package/src/rule-genres.ts +25 -0
- package/src/rule-guide.ts +135 -0
- package/src/rule-load.ts +98 -33
- package/src/rule-options.ts +131 -0
- package/src/run-semantic.ts +28 -20
- package/src/run.ts +78 -11
- package/src/semantic.ts +11 -3
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +7 -1
- package/src/span-cut.ts +28 -0
- package/src/span-merge.ts +13 -0
- package/src/speaker-labels.ts +129 -0
- package/src/stray-space.ts +81 -0
- package/src/structure/aside-depth.ts +67 -0
- package/src/structure/build.ts +38 -19
- package/src/structure/closed-pairs.ts +20 -0
- package/src/structure/date-range.ts +69 -0
- package/src/structure/known-mentions.ts +96 -0
- package/src/structure/numbering.ts +9 -5
- package/src/structure/of.ts +11 -3
- package/src/structure/percent-sum.ts +135 -0
- package/src/structure/quoted-number.ts +36 -0
- package/src/structure/relative-find.ts +34 -47
- package/src/structure/relative-resolve.ts +104 -42
- package/src/structure/runs.ts +2 -2
- package/src/structure/sexp.ts +17 -5
- package/src/structure/total.ts +2 -2
- package/src/structure/universal.ts +24 -4
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +77 -0
- package/src/subheading-line.ts +68 -0
- package/src/team-names.ts +13 -13
- package/src/template-syntax.ts +164 -0
- package/src/text-above.ts +49 -0
- package/src/text-figures.ts +147 -0
- package/src/trailing-aside.ts +50 -0
- package/src/tree-walk.ts +48 -0
- package/styles/bunkacho.yaml +25 -0
- package/styles/ieice.yaml +29 -0
- package/styles/jis-z8301-2011.yaml +25 -0
package/src/cli-text.ts
CHANGED
|
@@ -21,7 +21,9 @@ const USAGE_JA = `chaff — 文章の読みにくいところを見つけます
|
|
|
21
21
|
chaff genres ジャンル(文書の種類)の一覧と、それぞれ何向けか
|
|
22
22
|
chaff tree <file> [--format sexp|json] 文書を番地の付いた木にする(条・項・定義・参照)
|
|
23
23
|
chaff cite <原文> <引用.json> 回答の引用(番地と引用文)が原文にあるかを確かめる
|
|
24
|
-
chaff
|
|
24
|
+
chaff compare <前> <後> 書き換えで事実(数・日付・URL・コード・名前・引用…)が落ちても足されてもいないかを確かめる
|
|
25
|
+
chaff rules ルールの一覧を、グループごとに表で出す(いまの段階つき)
|
|
26
|
+
chaff rules --json いまの設定とルールの説明を JSON で出す(AI に渡す用)
|
|
25
27
|
chaff baseline <dir> いまある指摘を棚上げする(既存の repo に入れるとき)
|
|
26
28
|
chaff suppressions <dir> stet で黙らせている指摘を数える
|
|
27
29
|
chaff relax|strict|off <rule> [--why "理由"]
|
|
@@ -55,7 +57,9 @@ const USAGE_EN = `chaff — finds what makes writing hard to read. It never rewr
|
|
|
55
57
|
chaff genres list the genres (kinds of document) and what each is for
|
|
56
58
|
chaff tree <file> [--format sexp|json] the document as a tree of addresses (sections, clauses, definitions, references)
|
|
57
59
|
chaff cite <source> <quotes.json> check that quoted passages (address and text) are in the source
|
|
58
|
-
chaff
|
|
60
|
+
chaff compare <before> <after> check that a rewrite dropped no fact and added none (numbers, dates, URLs, code, names, quotations…)
|
|
61
|
+
chaff rules the rules as a table, by group, with the level each runs at now
|
|
62
|
+
chaff rules --json the current settings and what each rule is, as JSON (to give to an AI)
|
|
59
63
|
chaff baseline <dir> shelve today's findings (when adding chaff to an existing repository)
|
|
60
64
|
chaff suppressions <dir> count the findings silenced with stet
|
|
61
65
|
chaff relax|strict|off <rule> [--why "reason"]
|
|
@@ -137,7 +141,7 @@ export const CLI_TEXT: Texts<CliText> = {
|
|
|
137
141
|
unknownProfile: (profile, where, known) =>
|
|
138
142
|
`文書の種類 "${profile}" はありません(${where})。使えるのは ${known.join("、")} と、種類を使わない none です。`,
|
|
139
143
|
profileWhere: (where, files) => (where === "config" ? "chaff.yaml の profile" : `chaff.yaml の by_path、files: ${files.join(", ")}`),
|
|
140
|
-
unknownRule: (id) => `${id} というルールはありません。npx chaff rules
|
|
144
|
+
unknownRule: (id) => `${id} というルールはありません。npx chaff rules で一覧が出ます。`,
|
|
141
145
|
unknownRuleWithList: (id, list) => `${id} というルールはありません。\n一覧:\n${list}`,
|
|
142
146
|
unnamed: "(名前なし)",
|
|
143
147
|
sarifWritten: (path, count) => `\n SARIF を書きました: ${path}(${count} 件)`,
|
|
@@ -191,7 +195,7 @@ export const CLI_TEXT: Texts<CliText> = {
|
|
|
191
195
|
unknownProfile: (profile, where, known) =>
|
|
192
196
|
`There is no document profile "${profile}" (${where}). The profiles are ${known.join(", ")}; none uses no profile.`,
|
|
193
197
|
profileWhere: (where, files) => (where === "config" ? "profile in chaff.yaml" : `by_path in chaff.yaml, files: ${files.join(", ")}`),
|
|
194
|
-
unknownRule: (id) => `There is no rule named ${id}. npx chaff rules
|
|
198
|
+
unknownRule: (id) => `There is no rule named ${id}. npx chaff rules lists them.`,
|
|
195
199
|
unknownRuleWithList: (id, list) => `There is no rule named ${id}.\nRules:\n${list}`,
|
|
196
200
|
unnamed: "(no name)",
|
|
197
201
|
sarifWritten: (path, count) => `\n Wrote SARIF: ${path} (${counted(count, "finding")})`,
|
package/src/cli.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
2
|
import { dirname, join } from "node:path";
|
|
4
3
|
import { loadAdapter, packageFor } from "./adapter-load.ts";
|
|
5
|
-
import { CONFIG_FILE,
|
|
4
|
+
import { CONFIG_FILE, type Config } from "./config/load.ts";
|
|
6
5
|
import { applyByPath } from "./config/by-path.ts";
|
|
7
6
|
import { applyLevel } from "./config/write.ts";
|
|
8
7
|
import { buildDocument, teamRules } from "./document.ts";
|
|
9
8
|
import { guessLanguage } from "./detect.ts";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { BASELINE_FILE, fingerprint, readBaseline, splitByBaseline, writeBaseline } from "./baseline.ts";
|
|
9
|
+
import { collectTargets, readDocumentFile } from "./files.ts";
|
|
10
|
+
import { BASELINE_FILE, fingerprints, readBaseline, splitByBaseline, writeBaseline } from "./baseline.ts";
|
|
13
11
|
import { applySuppressions } from "./stet.ts";
|
|
14
12
|
import { renderSuppressions, type PerFile } from "./render/suppressions.ts";
|
|
15
13
|
import { clock, describeChange, snapshotOf, watchPaths, type Snapshot } from "./watch.ts";
|
|
@@ -19,8 +17,8 @@ import { GENRES } from "./genre.ts";
|
|
|
19
17
|
import { resolveGenre } from "./resolve-genre.ts";
|
|
20
18
|
import { runInit } from "./init.ts";
|
|
21
19
|
import { initGenre } from "./commands/init-ask.ts";
|
|
22
|
-
import { targetsOf } from "./cli-args.ts";
|
|
23
|
-
import {
|
|
20
|
+
import { targetsOf, withExperimental } from "./cli-args.ts";
|
|
21
|
+
import { rulesOf } from "./custom/load.ts";
|
|
24
22
|
import { renderCompact } from "./render/compact.ts";
|
|
25
23
|
import { renderExplain } from "./render/explain.ts";
|
|
26
24
|
import { renderFriendly } from "./render/friendly.ts";
|
|
@@ -28,18 +26,21 @@ import { renderGenres } from "./render/genres.ts";
|
|
|
28
26
|
import { loadGenres, presetLevels } from "./genre-load.ts";
|
|
29
27
|
import { fileHeader } from "./file-header.ts";
|
|
30
28
|
import { rulesJson } from "./render/rules-json.ts";
|
|
29
|
+
import { rulesTable } from "./render/rules-table.ts";
|
|
31
30
|
import { renderSarif } from "./render/sarif.ts";
|
|
32
31
|
import { VERSION, VERSION_LINES } from "./version.ts";
|
|
33
32
|
import { runTree, treeTargets, type TreeContext } from "./commands/tree.ts";
|
|
34
33
|
import { citeTargets, runCite } from "./commands/cite.ts";
|
|
34
|
+
import { compareTargets, runCompare } from "./commands/compare.ts";
|
|
35
35
|
import { runSkill } from "./commands/skill.ts";
|
|
36
36
|
import { runFeedback, settingsOf } from "./commands/feedback.ts";
|
|
37
37
|
import { homedir } from "node:os";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import { settingWarnings } from "./config/warnings.ts";
|
|
39
|
+
import { readConfigIn } from "./config/read.ts";
|
|
40
|
+
import { optionLayersOf, settingSourcesOf } from "./config/option-problems.ts";
|
|
40
41
|
import { renderSummary, type FileOutcome } from "./render/summary.ts";
|
|
41
|
-
import { neededBy,
|
|
42
|
-
import type { Level, RuleDefinition } from "./plugin.ts";
|
|
42
|
+
import { neededBy, runRulesWith } from "./run.ts";
|
|
43
|
+
import type { Finding, Level, RuleDefinition } from "./plugin.ts";
|
|
43
44
|
import { CLI_TEXT, type CliText, type GenreSource } from "./cli-text.ts";
|
|
44
45
|
import { hostLanguage, sharedLanguage, uiLanguageOf, type UiLanguage } from "./ui.ts";
|
|
45
46
|
import { profileFor } from "./profile/for-file.ts";
|
|
@@ -48,7 +49,7 @@ import { settingProblems } from "./setting-problems.ts";
|
|
|
48
49
|
/** Text for output that is not about one document. */
|
|
49
50
|
const hostText = (config: Config): CliText => CLI_TEXT[hostLanguage(config.language, process.env)];
|
|
50
51
|
|
|
51
|
-
const readConfig = (): Config => (
|
|
52
|
+
const readConfig = (): Config => readConfigIn(process.cwd());
|
|
52
53
|
|
|
53
54
|
/** resolveGenre with this run's --genre, for the commands that take it as a dependency. */
|
|
54
55
|
const genreFrom =
|
|
@@ -61,7 +62,7 @@ const findRule = (rules: readonly RuleDefinition[], id: string | undefined): Rul
|
|
|
61
62
|
const changeSetting = (command: Level, ruleId: string | undefined, why: string | undefined): number => {
|
|
62
63
|
const config = readConfig();
|
|
63
64
|
const language = config.language ?? hostLanguage(undefined, process.env);
|
|
64
|
-
const rule = findRule(
|
|
65
|
+
const rule = findRule(rulesOf(language, config), ruleId);
|
|
65
66
|
if (rule === undefined) {
|
|
66
67
|
console.error(hostText(config).unknownRule(ruleId ?? hostText(config).unnamed));
|
|
67
68
|
return 1;
|
|
@@ -84,20 +85,21 @@ type Inspected = {
|
|
|
84
85
|
readonly genre: string;
|
|
85
86
|
readonly outcome: FileOutcome;
|
|
86
87
|
readonly perFile: PerFile;
|
|
87
|
-
|
|
88
|
+
/** stet で黙らせたものを除いた、baseline で棚上げする前の指摘。fingerprint は baseline を書くときだけ作る。 */
|
|
89
|
+
readonly kept: readonly Finding[];
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
const inspect = async (path: string, config: Config, argv: readonly string[]): Promise<Inspected> => {
|
|
91
|
-
const source =
|
|
93
|
+
const source = await readDocumentFile(path);
|
|
92
94
|
const language = applyByPath(config.byPath, config.baseDir, path).language ?? config.language ?? guessLanguage(source).language;
|
|
93
95
|
const adapter = await loadAdapter(language);
|
|
94
96
|
const { genre, from, unread } = resolveGenre(path, source, config, flag(argv, "--genre"));
|
|
95
97
|
if (unread !== undefined) console.error(`chaff: ${CLI_TEXT[uiLanguageOf(language)].unreadFrontMatterGenre(path, unread, GENRES)}`);
|
|
96
|
-
const rules =
|
|
98
|
+
const rules = rulesOf(language, config);
|
|
97
99
|
const experimental = config.experimental || argv.includes("--experimental");
|
|
98
100
|
await adapter.prepare?.(neededBy(rules, config.rules, experimental, genre, language));
|
|
99
101
|
const doc = buildDocument(path, source, adapter, teamRules(config), profileFor(config, path, source, language, genre));
|
|
100
|
-
const raw =
|
|
102
|
+
const raw = runRulesWith(doc, rules, { settings: config.rules, experimental, genre, limits: config.limits, optionLayers: optionLayersOf(config) });
|
|
101
103
|
// 応答は 3 つ。stet で黙らせたものは、ここで落とす。
|
|
102
104
|
const applied = applySuppressions(
|
|
103
105
|
source,
|
|
@@ -116,7 +118,7 @@ const inspect = async (path: string, config: Config, argv: readonly string[]): P
|
|
|
116
118
|
genre,
|
|
117
119
|
outcome: { path, findings: split.fresh, notRun: raw.skipped.length },
|
|
118
120
|
perFile: { path, suppressed: applied.suppressed, reasonless: applied.unusedReasonless },
|
|
119
|
-
|
|
121
|
+
kept: applied.kept,
|
|
120
122
|
};
|
|
121
123
|
};
|
|
122
124
|
|
|
@@ -137,10 +139,8 @@ const writeSarif = (results: readonly Inspected[], argv: readonly string[]): voi
|
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
/** 効いていない設定は、結果の前に一度だけ言う。標準エラーに出すので、JSON や SARIF の出力は汚さない。 */
|
|
140
|
-
const warnRuleProblems = (config: Config, language: string): void =>
|
|
141
|
-
|
|
142
|
-
[...ruleProblems(config, loadRules(language), ui), ...nameProblems(config, ui)].forEach((problem) => console.error(`chaff: ${problem}`));
|
|
143
|
-
};
|
|
142
|
+
const warnRuleProblems = (config: Config, language: string): void =>
|
|
143
|
+
settingWarnings(config, rulesOf(language, config), hostLanguage(config.language, process.env)).forEach((problem) => console.error(`chaff: ${problem}`));
|
|
144
144
|
|
|
145
145
|
/** Several files end with one summary: in their language when they share one, else the host's. */
|
|
146
146
|
const summaryLanguage = (results: readonly Inspected[], config: Config): UiLanguage => {
|
|
@@ -214,7 +214,7 @@ const explain = (ruleId: string | undefined, genreFlag: string | undefined): num
|
|
|
214
214
|
// The rule's limits differ by language (characters for Japanese, words for English): explain in the one being written.
|
|
215
215
|
const language = config.language ?? hostLanguage(undefined, process.env);
|
|
216
216
|
const text = CLI_TEXT[uiLanguageOf(language)];
|
|
217
|
-
const rules =
|
|
217
|
+
const rules = rulesOf(language, config);
|
|
218
218
|
const rule = findRule(rules, ruleId);
|
|
219
219
|
if (rule === undefined) {
|
|
220
220
|
const list = rules.map((entry) => ` ${entry.id}`).join("\n");
|
|
@@ -223,7 +223,7 @@ const explain = (ruleId: string | undefined, genreFlag: string | undefined): num
|
|
|
223
223
|
}
|
|
224
224
|
const preset = genre === undefined ? {} : presetLevels(genre);
|
|
225
225
|
const current = config.rules[rule.id] ?? preset[rule.id] ?? (rule.status === "experimental" && !config.experimental ? "off" : "normal");
|
|
226
|
-
console.log(renderExplain(rule, current, language, text.unit(rule.id, language), genre));
|
|
226
|
+
console.log(renderExplain(rule, current, language, text.unit(rule.id, language), genre, settingSourcesOf(config, rule.id)));
|
|
227
227
|
return 0;
|
|
228
228
|
};
|
|
229
229
|
|
|
@@ -235,7 +235,7 @@ const runBaseline = async (targets: readonly string[], argv: readonly string[]):
|
|
|
235
235
|
return 1;
|
|
236
236
|
}
|
|
237
237
|
const results = await Promise.all(paths.map((path) => inspect(path, config, [...argv, "--show-baseline"])));
|
|
238
|
-
const entries = results.flatMap((result) => result.
|
|
238
|
+
const entries = results.flatMap((result) => fingerprints(result.outcome.path, result.kept));
|
|
239
239
|
const file = join(process.cwd(), BASELINE_FILE);
|
|
240
240
|
writeBaseline(file, entries);
|
|
241
241
|
console.log(hostText(config).baselineDone(paths.length, entries.length, BASELINE_FILE).join("\n"));
|
|
@@ -246,12 +246,8 @@ const runSuppressions = async (targets: readonly string[], argv: readonly string
|
|
|
246
246
|
const paths = collectTargets(targets.length > 0 ? targets : ["."]);
|
|
247
247
|
const config = readConfig();
|
|
248
248
|
const results = await Promise.all(paths.map((path) => inspect(path, config, [...argv, "--show-baseline"])));
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
results.map((result) => result.perFile),
|
|
252
|
-
hostLanguage(config.language, process.env),
|
|
253
|
-
),
|
|
254
|
-
);
|
|
249
|
+
const perFile = results.map((result) => result.perFile);
|
|
250
|
+
console.log(renderSuppressions(perFile, hostLanguage(config.language, process.env)));
|
|
255
251
|
return 0;
|
|
256
252
|
};
|
|
257
253
|
|
|
@@ -260,11 +256,14 @@ type Handler = (argv: readonly string[]) => number | Promise<number>;
|
|
|
260
256
|
/** `--` で始まらない引数。対象のパス。 */
|
|
261
257
|
const positional = (argv: readonly string[]): string[] => targetsOf(argv.slice(1));
|
|
262
258
|
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
/** `rules --json` for an AI to read; `rules` alone, a table for a person. */
|
|
260
|
+
const showRules = (argv: readonly string[]): number => {
|
|
261
|
+
const config = withExperimental(readConfig(), argv);
|
|
265
262
|
const language = config.language ?? hostLanguage(undefined, process.env);
|
|
266
263
|
warnRuleProblems(config, language);
|
|
267
|
-
|
|
264
|
+
const genre = flag(argv, "--genre") ?? config.genre ?? "blog/tech";
|
|
265
|
+
const rules = rulesOf(language, config);
|
|
266
|
+
console.log(argv.includes("--json") ? rulesJson(rules, config, language, genre, optionLayersOf(config)) : rulesTable(rules, config, language, genre));
|
|
268
267
|
return 0;
|
|
269
268
|
};
|
|
270
269
|
|
|
@@ -294,11 +293,12 @@ const HANDLERS: Readonly<Record<string, Handler>> = {
|
|
|
294
293
|
return "error" in chosen ? 1 : 0;
|
|
295
294
|
},
|
|
296
295
|
genres: showGenres,
|
|
297
|
-
rules:
|
|
296
|
+
rules: showRules,
|
|
298
297
|
explain: (argv) => explain(argv[1], flag(argv, "--genre")),
|
|
299
298
|
eval: (argv) => runEval(positional(argv), argv, { ...measureContext(argv), flag }),
|
|
300
299
|
tree: (argv) => runTree(treeTargets(argv), argv, treeContext()),
|
|
301
300
|
cite: (argv) => runCite(citeTargets(argv), argv, treeContext()),
|
|
301
|
+
compare: (argv) => runCompare(compareTargets(argv), argv, treeContext()),
|
|
302
302
|
test: (argv) => runTest(positional(argv), argv, { ...measureContext(argv), inspect }),
|
|
303
303
|
baseline: (argv) => runBaseline(positional(argv), argv),
|
|
304
304
|
suppressions: (argv) => runSuppressions(positional(argv), argv),
|
|
@@ -338,7 +338,7 @@ export const main = async (argv: readonly string[]): Promise<number> => {
|
|
|
338
338
|
}
|
|
339
339
|
// 知らないジャンルではどの rule も当たらず、知らない文書の種類では種類の知識が外れる。どちらも素通りに見えるので、何かする前に止める。
|
|
340
340
|
const config = readConfig();
|
|
341
|
-
const problems = settingProblems(first, flag(argv, "--genre"), config, hostText(config));
|
|
341
|
+
const problems = settingProblems(first, flag(argv, "--genre"), config, hostText(config), hostLanguage(config.language, process.env));
|
|
342
342
|
problems.forEach((problem) => console.error(problem));
|
|
343
343
|
if (problems.length > 0) return 1;
|
|
344
344
|
const handler = HANDLERS[first];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { calendarRuns, digitRuns, type CalendarUnits } from "./calendar-number.ts";
|
|
2
|
+
import type { ProseDocument, Section, Sentence, Span } from "./plugin.ts";
|
|
3
|
+
|
|
4
|
+
/** 文書の一続きの文字列と、その中の文。base は text の先頭の位置で、文の span は文書全体の座標。 */
|
|
5
|
+
export type Passage = { readonly text: string; readonly base: number; readonly sentences: readonly Sentence[] };
|
|
6
|
+
|
|
7
|
+
/** 結びの節と、それより前の文書全体(見出し・表・コードも)。 */
|
|
8
|
+
export const closingAndEarlier = (doc: ProseDocument, last: Section): { closing: Passage; earlier: Passage } => ({
|
|
9
|
+
closing: { text: doc.source.slice(last.span.start, last.span.end), base: last.span.start, sentences: last.sentences },
|
|
10
|
+
earlier: { text: doc.source.slice(0, last.span.start), base: 0, sentences: doc.sentences.filter((sentence) => sentence.span.end <= last.span.start) },
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const DIGIT = /\d/u;
|
|
14
|
+
|
|
15
|
+
/** 最後の数字まで。文末の「412.」の点や、範囲の「3-」のハイフンは数の一部ではない。前のハイフンは符号(-1%)なので残す。 */
|
|
16
|
+
const valueOf = (text: string, run: Span): string => {
|
|
17
|
+
const raw = text.slice(run.start, run.end);
|
|
18
|
+
const lastDigit = [...raw].findLastIndex((char) => DIGIT.test(char));
|
|
19
|
+
return raw.slice(0, lastDigit + 1);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** passage の中で、品詞の付いた文の字。見出しや表の字は文ではないので付かない。 */
|
|
23
|
+
const taggedChars = (passage: Passage): Uint8Array => {
|
|
24
|
+
const tagged = new Uint8Array(passage.text.length);
|
|
25
|
+
passage.sentences
|
|
26
|
+
.filter((sentence) => sentence.tokens !== undefined)
|
|
27
|
+
.forEach((sentence) => tagged.fill(1, Math.max(0, sentence.span.start - passage.base), Math.max(0, sentence.span.end - passage.base)));
|
|
28
|
+
return tagged;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** 文の中の日付・時刻の数の単位を、passage の中の位置で。文ごとに読むので、長い文書でも語を探す範囲は文の中だけ。 */
|
|
32
|
+
const calendarUnitsAt = (passage: Passage, units: CalendarUnits): ReadonlyMap<number, string> =>
|
|
33
|
+
new Map(
|
|
34
|
+
passage.sentences.flatMap((sentence) =>
|
|
35
|
+
calendarRuns(sentence.text, sentence.tokens, sentence.span.start, units).map(({ run, unit }): [number, string] => [
|
|
36
|
+
sentence.span.start - passage.base + run.start,
|
|
37
|
+
unit,
|
|
38
|
+
]),
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
/** 品詞の無いところの数の、すぐ後ろ(空白 1 つまで)に字面で続く日付・時刻の単位のうち、いちばん長いもの。無ければ空。 */
|
|
43
|
+
const unitAsWritten = (text: string, run: Span, units: CalendarUnits): string => {
|
|
44
|
+
const at = text[run.end] === " " ? run.end + 1 : run.end;
|
|
45
|
+
const following = [...units.chained, ...units.positional, ...units.year].filter((unit) => text.startsWith(unit, at));
|
|
46
|
+
return following.reduce((longest, unit) => (unit.length > longest.length ? unit : longest), "");
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* passage の中の数の、比べるときの名前を左から。日付・時刻の数は単位ごと(9月)、それ以外は数そのもの(412)。
|
|
51
|
+
* 文の中は品詞で見分ける(calendar-number.ts)。見出しや表は品詞が無いので、数の後ろの字で見分ける(題の「9月の報告」)。
|
|
52
|
+
*/
|
|
53
|
+
const numberKeys = (passage: Passage, units: CalendarUnits): string[] => {
|
|
54
|
+
const unitAt = calendarUnitsAt(passage, units);
|
|
55
|
+
const tagged = taggedChars(passage);
|
|
56
|
+
return digitRuns(passage.text).map((run) => {
|
|
57
|
+
const value = valueOf(passage.text, run);
|
|
58
|
+
const firstDigit = run.start + passage.text.slice(run.start, run.end).search(DIGIT);
|
|
59
|
+
const unit = tagged[firstDigit] === 1 ? (unitAt.get(run.start) ?? "") : unitAsWritten(passage.text, run, units);
|
|
60
|
+
return `${value}${unit}`;
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 結びの数のうち、それより前(見出し・表も)に書いていないもの(重ならないように、書いた順)。
|
|
66
|
+
* 前に同じ名前で書いた数(題の「9月」と結びの「9月」、本文の「412 件」と結びの「412 件」)は新しくない。
|
|
67
|
+
* 日付・時刻と数量は別のもので、本文の「9 件」があっても結びの「9月末」は新しく、題の「9月」があっても結びの「9 件」は新しい。
|
|
68
|
+
*/
|
|
69
|
+
export const newNumbers = (closing: Passage, earlier: Passage, units: CalendarUnits): string[] => {
|
|
70
|
+
const stated = new Set(numberKeys(earlier, units));
|
|
71
|
+
return [...new Set(numberKeys(closing, units).filter((key) => !stated.has(key)))];
|
|
72
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { loadAdapter } from "../adapter-load.ts";
|
|
2
|
+
import { buildDocument, teamRules } from "../document.ts";
|
|
3
|
+
import { readMarkdown } from "../markdown-read.ts";
|
|
4
|
+
import { profileFor } from "../profile/for-file.ts";
|
|
5
|
+
import { resolveGenre } from "../resolve-genre.ts";
|
|
6
|
+
import { isMarkdownPath } from "../structure/markdown-path.ts";
|
|
7
|
+
import { uiLanguageOf } from "../ui.ts";
|
|
8
|
+
import { ATOM_KINDS, isAtomKind, type AtomKind } from "../compare/atom.ts";
|
|
9
|
+
import { extractFacts } from "../compare/extract.ts";
|
|
10
|
+
import { outcomeOf, type Allowed, type Compared } from "../compare/outcome.ts";
|
|
11
|
+
import { renderCompact, renderFriendly, renderJson } from "../compare/render.ts";
|
|
12
|
+
import { COMPARE_TEXT } from "../compare/text.ts";
|
|
13
|
+
import { readSource, treeLanguage, type TreeContext } from "./tree.ts";
|
|
14
|
+
|
|
15
|
+
/** Options whose value is the next argument. That value is not a file. */
|
|
16
|
+
const VALUED: ReadonlySet<string> = new Set(["--language", "--genre", "--allow-dropped", "--allow-added"]);
|
|
17
|
+
|
|
18
|
+
export const compareTargets = (argv: readonly string[]): string[] =>
|
|
19
|
+
argv.slice(1).filter((arg, index, all) => !arg.startsWith("--") && !VALUED.has(all[index - 1] ?? ""));
|
|
20
|
+
|
|
21
|
+
/** Every value given to a repeatable option, split at commas: `--allow-dropped url,code --allow-dropped quote`. */
|
|
22
|
+
const optionValues = (argv: readonly string[], name: string): string[] =>
|
|
23
|
+
argv.flatMap((arg, index) => (arg === name ? (argv[index + 1] ?? "").split(",") : [])).filter((value) => value !== "");
|
|
24
|
+
|
|
25
|
+
type ParsedAllowed = { readonly allowed: Allowed } | { readonly unknown: string };
|
|
26
|
+
|
|
27
|
+
/** The kinds allowed to be dropped and added, or the first word that is not a kind. */
|
|
28
|
+
const parseAllowed = (argv: readonly string[]): ParsedAllowed => {
|
|
29
|
+
const dropped = optionValues(argv, "--allow-dropped");
|
|
30
|
+
const added = optionValues(argv, "--allow-added");
|
|
31
|
+
const unknown = [...dropped, ...added].find((kind) => !isAtomKind(kind));
|
|
32
|
+
if (unknown !== undefined) return { unknown };
|
|
33
|
+
const kinds = (values: readonly string[]): Set<AtomKind> => new Set(values.filter(isAtomKind));
|
|
34
|
+
return { allowed: { dropped: kinds(dropped), added: kinds(added) } };
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type Read = Compared & { readonly language: string };
|
|
38
|
+
|
|
39
|
+
/** One document's facts, read as lint reads it: its language, the team's names, and the parts of speech. */
|
|
40
|
+
const readFacts = async (path: string, argv: readonly string[], context: TreeContext): Promise<Read | undefined> => {
|
|
41
|
+
const source = await readSource(path, context);
|
|
42
|
+
if (source === undefined) return undefined;
|
|
43
|
+
const language = treeLanguage(path, source, argv, context);
|
|
44
|
+
const adapter = await loadAdapter(language);
|
|
45
|
+
await adapter.prepare?.({ pos: true });
|
|
46
|
+
const genre = resolveGenre(path, source, context.config, context.flag(argv, "--genre")).genre;
|
|
47
|
+
const doc = buildDocument(path, source, adapter, teamRules(context.config), profileFor(context.config, path, source, language, genre));
|
|
48
|
+
const root = isMarkdownPath(path) ? readMarkdown(doc.source).root : undefined;
|
|
49
|
+
const extraction = extractFacts({ doc, root, structure: adapter.structure, names: context.config.names ?? [] });
|
|
50
|
+
return { path, extraction, language };
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const renderFor = (argv: readonly string[]): typeof renderFriendly => {
|
|
54
|
+
if (argv.includes("--json")) return (outcome) => renderJson(outcome);
|
|
55
|
+
return argv.includes("--compact") ? renderCompact : renderFriendly;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Whether a rewrite kept every fact: numbers, dates, URLs, code, names, quotations, headings, references and footnotes.
|
|
60
|
+
* Compares; never rewrites. Ends with 1 when a fact was dropped or added, so a rewrite can be checked like a test.
|
|
61
|
+
*/
|
|
62
|
+
export const runCompare = async (targets: readonly string[], argv: readonly string[], context: TreeContext): Promise<number> => {
|
|
63
|
+
const host = COMPARE_TEXT[context.ui ?? "ja"];
|
|
64
|
+
const [beforePath, afterPath] = targets;
|
|
65
|
+
if (beforePath === undefined || afterPath === undefined || targets.length !== 2) {
|
|
66
|
+
console.error(host.usage);
|
|
67
|
+
return 1;
|
|
68
|
+
}
|
|
69
|
+
const parsed = parseAllowed(argv);
|
|
70
|
+
if ("unknown" in parsed) {
|
|
71
|
+
console.error(host.unknownKind(parsed.unknown, ATOM_KINDS.join(", ")));
|
|
72
|
+
return 1;
|
|
73
|
+
}
|
|
74
|
+
const before = await readFacts(beforePath, argv, context);
|
|
75
|
+
const after = before === undefined ? undefined : await readFacts(afterPath, argv, context);
|
|
76
|
+
if (before === undefined || after === undefined) return 1;
|
|
77
|
+
const outcome = outcomeOf(before, after, parsed.allowed);
|
|
78
|
+
console.log(renderFor(argv)(outcome, COMPARE_TEXT[uiLanguageOf(before.language)]));
|
|
79
|
+
return outcome.ok ? 0 : 1;
|
|
80
|
+
};
|
package/src/commands/eval.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { plainSource } from "../plain-source.ts";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
1
|
import { loadAdapter } from "../adapter-load.ts";
|
|
4
2
|
import { applyByPath } from "../config/by-path.ts";
|
|
5
3
|
import { buildDocument, teamRules } from "../document.ts";
|
|
6
4
|
import { guessLanguage } from "../detect.ts";
|
|
7
|
-
import { collectTargets } from "../files.ts";
|
|
8
|
-
import {
|
|
5
|
+
import { collectTargets, readDocumentFile } from "../files.ts";
|
|
6
|
+
import { rulesOf } from "../custom/load.ts";
|
|
9
7
|
import { evaluate } from "../eval.ts";
|
|
10
8
|
import { renderEval } from "../render/eval.ts";
|
|
11
|
-
import { neededBy } from "../run.ts";
|
|
9
|
+
import { neededBy, tokenFeaturesOf, wantsTags } from "../run.ts";
|
|
10
|
+
import type { AdapterNeeds, RuleDefinition } from "../plugin.ts";
|
|
11
|
+
import { optionLayersOf } from "../config/option-problems.ts";
|
|
12
12
|
import type { Config } from "../config/load.ts";
|
|
13
13
|
import { profileFor } from "../profile/for-file.ts";
|
|
14
14
|
import { CLI_TEXT } from "../cli-text.ts";
|
|
@@ -28,6 +28,16 @@ const TEXT: Texts<{
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* What the adapter must prepare. eval measures a rule whatever its level, so a rule named with --rule gets the tags and the
|
|
33
|
+
* token features it reads even when lint would not run it; without --rule, the tags are what lint would prepare.
|
|
34
|
+
*/
|
|
35
|
+
const evalNeeds = (rules: readonly RuleDefinition[], only: string | undefined, config: Config, genre: string, language: string): AdapterNeeds => {
|
|
36
|
+
const measured = rules.filter((rule) => only === undefined || rule.id === only);
|
|
37
|
+
const lint = neededBy(rules, config.rules, config.experimental, genre, language);
|
|
38
|
+
return { pos: lint.pos || (only !== undefined && measured.some(wantsTags)), features: tokenFeaturesOf(measured) };
|
|
39
|
+
};
|
|
40
|
+
|
|
31
41
|
export type Context = {
|
|
32
42
|
readonly config: Config;
|
|
33
43
|
readonly resolveGenre: (path: string, source: string, config: Config) => { genre: string; from: string };
|
|
@@ -51,11 +61,11 @@ export const runEval = async (targets: readonly string[], argv: readonly string[
|
|
|
51
61
|
const only = flag(argv, "--rule");
|
|
52
62
|
const docs = await Promise.all(
|
|
53
63
|
paths.map(async (path) => {
|
|
54
|
-
const source =
|
|
64
|
+
const source = await readDocumentFile(path);
|
|
55
65
|
const language = applyByPath(config.byPath, config.baseDir, path).language ?? config.language ?? guessLanguage(source).language;
|
|
56
66
|
const adapter = await loadAdapter(language);
|
|
57
67
|
const { genre } = resolveGenre(path, source, config);
|
|
58
|
-
await adapter.prepare?.(
|
|
68
|
+
await adapter.prepare?.(evalNeeds(rulesOf(language, config), only, config, genre, language));
|
|
59
69
|
return { doc: buildDocument(path, source, adapter, teamRules(config), profileFor(config, path, source, language, genre)), language, genre };
|
|
60
70
|
}),
|
|
61
71
|
);
|
|
@@ -67,7 +77,7 @@ export const runEval = async (targets: readonly string[], argv: readonly string[
|
|
|
67
77
|
console.error(TEXT[ui].mixed([...mixed].join(", ")));
|
|
68
78
|
return 1;
|
|
69
79
|
}
|
|
70
|
-
const rules =
|
|
80
|
+
const rules = rulesOf(language, config).filter((rule) => only === undefined || rule.id === only);
|
|
71
81
|
if (rules.length === 0) {
|
|
72
82
|
console.error(TEXT[ui].unknownRule(only ?? CLI_TEXT[ui].unnamed));
|
|
73
83
|
return 1;
|
|
@@ -80,6 +90,7 @@ export const runEval = async (targets: readonly string[], argv: readonly string[
|
|
|
80
90
|
genre,
|
|
81
91
|
language,
|
|
82
92
|
config.limits,
|
|
93
|
+
optionLayersOf(config),
|
|
83
94
|
),
|
|
84
95
|
docs.length,
|
|
85
96
|
paths.length,
|
package/src/commands/feedback.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readDocumentFile } from "../files.ts";
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, join } from "node:path";
|
|
4
4
|
import type { Finding, RuleDefinition } from "../plugin.ts";
|
|
@@ -86,15 +86,21 @@ const chosen = (findings: readonly Finding[], rule: string | undefined, line: nu
|
|
|
86
86
|
const describe = (findings: readonly Finding[], none: string): string =>
|
|
87
87
|
findings.length === 0 ? none : findings.map((finding) => ` ${String(finding.line)} ${finding.rule}`).join("\n");
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Pure: the reported rules' own lines of chaff.yaml's rules (a numeric limit wins over a level), under the style chaff.yaml
|
|
91
|
+
* names, or undefined when none is set. A level the style decided is the style's, so only the style line reproduces it.
|
|
92
|
+
*/
|
|
93
|
+
export const settingsOf = (config: Pick<Config, "rules" | "limits" | "applied">, ruleIds: readonly string[]): string | undefined => {
|
|
94
|
+
const fromStyle = new Set(config.applied?.levelsFrom ?? []);
|
|
91
95
|
const lines = [...new Set(ruleIds)].flatMap((id) => {
|
|
92
96
|
const limit = config.limits[id];
|
|
93
97
|
const level = config.rules[id];
|
|
94
98
|
if (limit !== undefined) return [` ${id}: ${String(limit)}`];
|
|
95
|
-
return level === undefined ? [] : [` ${id}: ${level}`];
|
|
99
|
+
return level === undefined || fromStyle.has(id) ? [] : [` ${id}: ${level}`];
|
|
96
100
|
});
|
|
97
|
-
|
|
101
|
+
const style = config.applied === undefined ? [] : [`style: ${config.applied.style}`];
|
|
102
|
+
const rules = lines.length === 0 ? [] : ["rules:", ...lines];
|
|
103
|
+
return style.length + rules.length === 0 ? undefined : [...style, ...rules].join("\n");
|
|
98
104
|
};
|
|
99
105
|
|
|
100
106
|
/** Pure: a title on one line, no longer than GitHub shows. */
|
|
@@ -179,7 +185,7 @@ export const runFeedback = async (targets: readonly string[], argv: readonly str
|
|
|
179
185
|
console.error(text.notFound(request.path));
|
|
180
186
|
return 1;
|
|
181
187
|
}
|
|
182
|
-
const source =
|
|
188
|
+
const source = await readDocumentFile(request.path);
|
|
183
189
|
const checked = await context.check(request.path);
|
|
184
190
|
const picked = pick(request, checked, source.split("\n").length, context.ui);
|
|
185
191
|
if ("error" in picked) {
|
package/src/commands/test.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { plainSource } from "../plain-source.ts";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
1
|
import { join } from "node:path";
|
|
4
2
|
import { loadAdapter } from "../adapter-load.ts";
|
|
5
3
|
import { applyByPath } from "../config/by-path.ts";
|
|
6
4
|
import { buildDocument, teamRules } from "../document.ts";
|
|
7
5
|
import { guessLanguage } from "../detect.ts";
|
|
8
|
-
import { collectTargets } from "../files.ts";
|
|
6
|
+
import { collectTargets, readDocumentFile } from "../files.ts";
|
|
9
7
|
import { loadRules } from "../rule-load.ts";
|
|
10
8
|
import { counted } from "../render/plural.ts";
|
|
11
9
|
import { CHECKS_FILE, loadChecks, type UserCheck } from "../checks.ts";
|
|
12
10
|
import { CACHE_DIR, credentialHint, describeFailure, hasCredentials, type JudgeOptions } from "../judge.ts";
|
|
13
11
|
import { ENV_FILE, loadEnvFile } from "../env.ts";
|
|
14
|
-
import { planSemantic, runSemantic } from "../run-semantic.ts";
|
|
12
|
+
import { planSemantic, runSemantic, semanticNeeds } from "../run-semantic.ts";
|
|
15
13
|
import { machineBanner, renderPlan, renderSemantic } from "../render/semantic.ts";
|
|
16
14
|
import type { Config } from "../config/load.ts";
|
|
17
|
-
import type { Finding, RuleDefinition } from "../plugin.ts";
|
|
15
|
+
import type { Finding, ProseDocument, RuleDefinition } from "../plugin.ts";
|
|
18
16
|
import type { BackendName, Failure } from "../backends/types.ts";
|
|
19
17
|
import { profileFor } from "../profile/for-file.ts";
|
|
20
18
|
import { CLI_TEXT } from "../cli-text.ts";
|
|
@@ -83,6 +81,20 @@ export type TestContext = {
|
|
|
83
81
|
readonly clients?: Pick<JudgeOptions, "anthropicClient" | "openaiClient">;
|
|
84
82
|
};
|
|
85
83
|
|
|
84
|
+
type SemanticDocument = { readonly doc: ProseDocument; readonly rules: RuleDefinition[]; readonly language: string; readonly genre: string };
|
|
85
|
+
|
|
86
|
+
/** 意味を読む検査に渡す文書。絞り込みが品詞を使うなら、解析器を読み込んでから作る。dry-run も本番も同じ文書を見る。 */
|
|
87
|
+
const semanticDocument = async (path: string, config: Config, resolveGenre: TestContext["resolveGenre"]): Promise<SemanticDocument> => {
|
|
88
|
+
const source = await readDocumentFile(path);
|
|
89
|
+
const language = applyByPath(config.byPath, config.baseDir, path).language ?? config.language ?? guessLanguage(source).language;
|
|
90
|
+
const adapter = await loadAdapter(language);
|
|
91
|
+
const { genre } = resolveGenre(path, source, config);
|
|
92
|
+
const rules = loadRules(language);
|
|
93
|
+
await adapter.prepare?.(semanticNeeds(rules, config.rules, genre));
|
|
94
|
+
const doc = buildDocument(path, source, adapter, teamRules(config), profileFor(config, path, source, language, genre));
|
|
95
|
+
return { doc, rules, language, genre };
|
|
96
|
+
};
|
|
97
|
+
|
|
86
98
|
type Judged = { path: string; outcome: Awaited<ReturnType<typeof runSemantic>>; rules: RuleDefinition[]; language: string };
|
|
87
99
|
|
|
88
100
|
const judgeAll = async (
|
|
@@ -94,12 +106,7 @@ const judgeAll = async (
|
|
|
94
106
|
): Promise<Judged[]> =>
|
|
95
107
|
Promise.all(
|
|
96
108
|
paths.map(async (path) => {
|
|
97
|
-
const
|
|
98
|
-
const language = applyByPath(config.byPath, config.baseDir, path).language ?? config.language ?? guessLanguage(source).language;
|
|
99
|
-
const adapter = await loadAdapter(language);
|
|
100
|
-
const { genre } = resolveGenre(path, source, config);
|
|
101
|
-
const doc = buildDocument(path, source, adapter, teamRules(config), profileFor(config, path, source, language, genre));
|
|
102
|
-
const rules = loadRules(language);
|
|
109
|
+
const { doc, rules, language, genre } = await semanticDocument(path, config, resolveGenre);
|
|
103
110
|
return { path, outcome: await runSemantic(doc, rules, checks, config.rules, genre, options), rules, language };
|
|
104
111
|
}),
|
|
105
112
|
);
|
|
@@ -114,12 +121,8 @@ const dryRun = async (
|
|
|
114
121
|
): Promise<void> => {
|
|
115
122
|
const plans = await Promise.all(
|
|
116
123
|
paths.map(async (path) => {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
const adapter = await loadAdapter(language);
|
|
120
|
-
const { genre } = resolveGenre(path, source, config);
|
|
121
|
-
const doc = buildDocument(path, source, adapter, teamRules(config), profileFor(config, path, source, language, genre));
|
|
122
|
-
return { path, jobs: planSemantic(doc, loadRules(language), checks, config.rules, genre), sentences: doc.sentences.length, language };
|
|
124
|
+
const { doc, rules, language, genre } = await semanticDocument(path, config, resolveGenre);
|
|
125
|
+
return { path, jobs: planSemantic(doc, rules, checks, config.rules, genre), sentences: doc.sentences.length, language };
|
|
123
126
|
}),
|
|
124
127
|
);
|
|
125
128
|
plans.forEach(({ path, jobs, sentences, language }) => console.log(renderPlan(path, jobs, sentences, language).join("\n")));
|