chaffjs 0.17.0 → 0.19.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/README.md +52 -56
- package/bin/chaff.js +17 -2
- package/dist/acronym-expansions.d.ts +26 -0
- package/dist/acronym-expansions.d.ts.map +1 -0
- package/dist/acronym-expansions.js +88 -0
- package/dist/acronym-expansions.js.map +1 -0
- package/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +138 -0
- package/dist/announced-count.js.map +1 -0
- package/dist/announced-list.d.ts +30 -0
- package/dist/announced-list.d.ts.map +1 -0
- package/dist/announced-list.js +95 -0
- package/dist/announced-list.js.map +1 -0
- package/dist/api.d.ts +168 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +10 -0
- package/dist/api.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 +2 -0
- package/dist/calendar-number.d.ts.map +1 -1
- package/dist/calendar-number.js +9 -2
- 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 +0 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +14 -18
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +83 -84
- package/dist/cli.js.map +1 -1
- package/dist/closing-paragraph.d.ts +7 -0
- package/dist/closing-paragraph.d.ts.map +1 -0
- package/dist/closing-paragraph.js +22 -0
- package/dist/closing-paragraph.js.map +1 -0
- package/dist/commands/compare.d.ts +15 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +64 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/document-commands.d.ts +9 -0
- package/dist/commands/document-commands.d.ts.map +1 -0
- package/dist/commands/document-commands.js +17 -0
- package/dist/commands/document-commands.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +19 -10
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/facts.d.ts +8 -0
- package/dist/commands/facts.d.ts.map +1 -0
- package/dist/commands/facts.js +30 -0
- package/dist/commands/facts.js.map +1 -0
- package/dist/commands/feedback.d.ts +15 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +36 -6
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/fix-plan.d.ts +13 -0
- package/dist/commands/fix-plan.d.ts.map +1 -0
- package/dist/commands/fix-plan.js +44 -0
- package/dist/commands/fix-plan.js.map +1 -0
- package/dist/commands/outline.d.ts +8 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +43 -0
- package/dist/commands/outline.js.map +1 -0
- package/dist/commands/read-document.d.ts +14 -0
- package/dist/commands/read-document.d.ts.map +1 -0
- package/dist/commands/read-document.js +21 -0
- package/dist/commands/read-document.js.map +1 -0
- package/dist/commands/suppressions.d.ts +7 -0
- package/dist/commands/suppressions.d.ts.map +1 -0
- package/dist/commands/suppressions.js +9 -0
- package/dist/commands/suppressions.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +3 -5
- 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 +68 -0
- package/dist/compare/clock-time.js.map +1 -0
- package/dist/compare/distinct.d.ts +9 -0
- package/dist/compare/distinct.d.ts.map +1 -0
- package/dist/compare/distinct.js +12 -0
- package/dist/compare/distinct.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 +60 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-key.d.ts +17 -0
- package/dist/compare/fact-key.d.ts.map +1 -0
- package/dist/compare/fact-key.js +25 -0
- package/dist/compare/fact-key.js.map +1 -0
- package/dist/compare/fact-text.d.ts +28 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +61 -0
- package/dist/compare/fact-text.js.map +1 -0
- package/dist/compare/facts-render.d.ts +17 -0
- package/dist/compare/facts-render.d.ts.map +1 -0
- package/dist/compare/facts-render.js +43 -0
- package/dist/compare/facts-render.js.map +1 -0
- package/dist/compare/facts-text.d.ts +15 -0
- package/dist/compare/facts-text.d.ts.map +1 -0
- package/dist/compare/facts-text.js +27 -0
- package/dist/compare/facts-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 +20 -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 +36 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +46 -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 +43 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +13 -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 +27 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +69 -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 +23 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +6 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +17 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +59 -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 +21 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +48 -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 +11 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +19 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/module-path.d.ts +11 -0
- package/dist/custom/module-path.d.ts.map +1 -0
- package/dist/custom/module-path.js +15 -0
- package/dist/custom/module-path.js.map +1 -0
- package/dist/custom/parse.d.ts +84 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +258 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +8 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +95 -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-language.js +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +30 -2
- package/dist/detect.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +2 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +12 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +23 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +116 -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/bold-label.d.ts +10 -0
- package/dist/detectors/bold-label.d.ts.map +1 -0
- package/dist/detectors/bold-label.js +44 -0
- package/dist/detectors/bold-label.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/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 +7 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +20 -0
- package/dist/detectors/dangling-figure.js.map +1 -0
- package/dist/detectors/definition-use.d.ts +8 -0
- package/dist/detectors/definition-use.d.ts.map +1 -0
- package/dist/detectors/definition-use.js +32 -0
- package/dist/detectors/definition-use.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 +35 -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/duplicate-heading.d.ts +14 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -0
- package/dist/detectors/duplicate-heading.js +39 -0
- package/dist/detectors/duplicate-heading.js.map +1 -0
- package/dist/detectors/empty-section.d.ts +8 -0
- package/dist/detectors/empty-section.d.ts.map +1 -0
- package/dist/detectors/empty-section.js +16 -0
- package/dist/detectors/empty-section.js.map +1 -0
- 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/fullwidth-alnum.d.ts +24 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -0
- package/dist/detectors/fullwidth-alnum.js +88 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -0
- 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/hankaku-kana.d.ts +9 -0
- package/dist/detectors/hankaku-kana.d.ts.map +1 -0
- package/dist/detectors/hankaku-kana.js +27 -0
- package/dist/detectors/hankaku-kana.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 +7 -4
- 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/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 +70 -1
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/invisible-character.d.ts +20 -0
- package/dist/detectors/invisible-character.d.ts.map +1 -0
- package/dist/detectors/invisible-character.js +143 -0
- package/dist/detectors/invisible-character.js.map +1 -0
- 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/lexicon-match.d.ts +14 -1
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +32 -2
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +6 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +31 -13
- 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 +67 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +130 -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 +71 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +8 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +29 -0
- package/dist/detectors/markup-finding.js.map +1 -0
- package/dist/detectors/modal-conflict.d.ts +4 -0
- package/dist/detectors/modal-conflict.d.ts.map +1 -0
- package/dist/detectors/modal-conflict.js +22 -0
- package/dist/detectors/modal-conflict.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/name-variant.d.ts +4 -0
- package/dist/detectors/name-variant.d.ts.map +1 -0
- package/dist/detectors/name-variant.js +13 -0
- package/dist/detectors/name-variant.js.map +1 -0
- package/dist/detectors/nominalization.d.ts +11 -0
- package/dist/detectors/nominalization.d.ts.map +1 -0
- package/dist/detectors/nominalization.js +56 -0
- package/dist/detectors/nominalization.js.map +1 -0
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +72 -37
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outside-announced-list.d.ts +4 -0
- package/dist/detectors/outside-announced-list.d.ts.map +1 -0
- package/dist/detectors/outside-announced-list.js +24 -0
- package/dist/detectors/outside-announced-list.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts +7 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +136 -229
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +4 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +26 -7
- package/dist/detectors/phrase-match.js.map +1 -1
- 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/ra-nuki.d.ts +9 -0
- package/dist/detectors/ra-nuki.d.ts.map +1 -0
- package/dist/detectors/ra-nuki.js +30 -0
- package/dist/detectors/ra-nuki.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/requirement-modal.d.ts +5 -0
- package/dist/detectors/requirement-modal.d.ts.map +1 -0
- package/dist/detectors/requirement-modal.js +54 -0
- package/dist/detectors/requirement-modal.js.map +1 -0
- package/dist/detectors/requirement-smell.d.ts +4 -0
- package/dist/detectors/requirement-smell.d.ts.map +1 -0
- package/dist/detectors/requirement-smell.js +41 -0
- package/dist/detectors/requirement-smell.js.map +1 -0
- 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 +67 -46
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/space-before-punctuation.d.ts +8 -0
- package/dist/detectors/space-before-punctuation.d.ts.map +1 -0
- package/dist/detectors/space-before-punctuation.js +24 -0
- package/dist/detectors/space-before-punctuation.js.map +1 -0
- package/dist/detectors/spelling-variety.d.ts +23 -0
- package/dist/detectors/spelling-variety.d.ts.map +1 -0
- package/dist/detectors/spelling-variety.js +59 -0
- package/dist/detectors/spelling-variety.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 +39 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -3
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +19 -6
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-comparison.d.ts +20 -0
- package/dist/detectors/superlative-comparison.d.ts.map +1 -0
- package/dist/detectors/superlative-comparison.js +32 -0
- package/dist/detectors/superlative-comparison.js.map +1 -0
- 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 +24 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- package/dist/detectors/vague-figure-pointer.d.ts +10 -0
- package/dist/detectors/vague-figure-pointer.d.ts.map +1 -0
- package/dist/detectors/vague-figure-pointer.js +46 -0
- package/dist/detectors/vague-figure-pointer.js.map +1 -0
- package/dist/detectors/word-list.d.ts +2 -0
- package/dist/detectors/word-list.d.ts.map +1 -1
- package/dist/detectors/word-list.js +4 -1
- package/dist/detectors/word-list.js.map +1 -1
- 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 +20 -7
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +140 -125
- 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/extension/document-view.d.ts +7 -0
- package/dist/extension/document-view.d.ts.map +1 -0
- package/dist/extension/document-view.js +91 -0
- package/dist/extension/document-view.js.map +1 -0
- package/dist/extension/failure-text.d.ts +5 -0
- package/dist/extension/failure-text.d.ts.map +1 -0
- package/dist/extension/failure-text.js +33 -0
- package/dist/extension/failure-text.js.map +1 -0
- package/dist/extension/import-default.d.ts +7 -0
- package/dist/extension/import-default.d.ts.map +1 -0
- package/dist/extension/import-default.js +21 -0
- package/dist/extension/import-default.js.map +1 -0
- package/dist/extension/load.d.ts +28 -0
- package/dist/extension/load.d.ts.map +1 -0
- package/dist/extension/load.js +51 -0
- package/dist/extension/load.js.map +1 -0
- package/dist/extension/module-detector.d.ts +21 -0
- package/dist/extension/module-detector.d.ts.map +1 -0
- package/dist/extension/module-detector.js +49 -0
- package/dist/extension/module-detector.js.map +1 -0
- package/dist/extension/plugin-load.d.ts +9 -0
- package/dist/extension/plugin-load.d.ts.map +1 -0
- package/dist/extension/plugin-load.js +68 -0
- package/dist/extension/plugin-load.js.map +1 -0
- package/dist/extension/plugin-name.d.ts +8 -0
- package/dist/extension/plugin-name.d.ts.map +1 -0
- package/dist/extension/plugin-name.js +22 -0
- package/dist/extension/plugin-name.js.map +1 -0
- package/dist/extension/plugin-parse.d.ts +41 -0
- package/dist/extension/plugin-parse.d.ts.map +1 -0
- package/dist/extension/plugin-parse.js +156 -0
- package/dist/extension/plugin-parse.js.map +1 -0
- package/dist/extension/problem-text.d.ts +5 -0
- package/dist/extension/problem-text.d.ts.map +1 -0
- package/dist/extension/problem-text.js +74 -0
- package/dist/extension/problem-text.js.map +1 -0
- package/dist/extension/real-path.d.ts +3 -0
- package/dist/extension/real-path.d.ts.map +1 -0
- package/dist/extension/real-path.js +8 -0
- package/dist/extension/real-path.js.map +1 -0
- package/dist/extension/returned-findings.d.ts +17 -0
- package/dist/extension/returned-findings.d.ts.map +1 -0
- package/dist/extension/returned-findings.js +48 -0
- package/dist/extension/returned-findings.js.map +1 -0
- package/dist/extension/rule-export.d.ts +13 -0
- package/dist/extension/rule-export.d.ts.map +1 -0
- package/dist/extension/rule-export.js +16 -0
- package/dist/extension/rule-export.js.map +1 -0
- package/dist/feedback/draft.d.ts +2 -0
- package/dist/feedback/draft.d.ts.map +1 -1
- package/dist/feedback/draft.js +3 -0
- package/dist/feedback/draft.js.map +1 -1
- package/dist/figure-references.d.ts +39 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +113 -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/finding-order.d.ts +9 -0
- package/dist/finding-order.d.ts.map +1 -0
- package/dist/finding-order.js +3 -0
- package/dist/finding-order.js.map +1 -0
- package/dist/fix-plan/mode.d.ts +21 -0
- package/dist/fix-plan/mode.d.ts.map +1 -0
- package/dist/fix-plan/mode.js +16 -0
- package/dist/fix-plan/mode.js.map +1 -0
- package/dist/fix-plan/plan.d.ts +77 -0
- package/dist/fix-plan/plan.d.ts.map +1 -0
- package/dist/fix-plan/plan.js +100 -0
- package/dist/fix-plan/plan.js.map +1 -0
- package/dist/fix-plan/render.d.ts +6 -0
- package/dist/fix-plan/render.d.ts.map +1 -0
- package/dist/fix-plan/render.js +101 -0
- package/dist/fix-plan/render.js.map +1 -0
- package/dist/fix-plan/text.d.ts +35 -0
- package/dist/fix-plan/text.d.ts.map +1 -0
- package/dist/fix-plan/text.js +95 -0
- package/dist/fix-plan/text.js.map +1 -0
- 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/language-sample.d.ts +2 -0
- package/dist/language-sample.d.ts.map +1 -0
- package/dist/language-sample.js +41 -0
- package/dist/language-sample.js.map +1 -0
- 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 +33 -10
- package/dist/line-paragraphs.js.map +1 -1
- package/dist/link-line.d.ts +8 -0
- package/dist/link-line.d.ts.map +1 -0
- package/dist/link-line.js +12 -0
- package/dist/link-line.js.map +1 -0
- package/dist/long-vowel.d.ts +38 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +78 -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 +182 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.js +8 -5
- package/dist/mask.js.map +1 -1
- package/dist/name-variants.d.ts +25 -0
- package/dist/name-variants.d.ts.map +1 -0
- package/dist/name-variants.js +181 -0
- package/dist/name-variants.js.map +1 -0
- package/dist/node-version.d.ts +7 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +19 -0
- package/dist/node-version.js.map +1 -0
- package/dist/not-run.d.ts +14 -0
- package/dist/not-run.d.ts.map +1 -0
- package/dist/not-run.js +12 -0
- package/dist/not-run.js.map +1 -0
- package/dist/number-name.d.ts +21 -5
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +119 -17
- package/dist/number-name.js.map +1 -1
- package/dist/orthography.d.ts +10 -1
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +42 -16
- package/dist/orthography.js.map +1 -1
- package/dist/outline/render.d.ts +18 -0
- package/dist/outline/render.d.ts.map +1 -0
- package/dist/outline/render.js +60 -0
- package/dist/outline/render.js.map +1 -0
- package/dist/outline/shape.d.ts +26 -0
- package/dist/outline/shape.d.ts.map +1 -0
- package/dist/outline/shape.js +37 -0
- package/dist/outline/shape.js.map +1 -0
- package/dist/outline/text.d.ts +21 -0
- package/dist/outline/text.d.ts.map +1 -0
- package/dist/outline/text.js +30 -0
- package/dist/outline/text.js.map +1 -0
- 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/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 +138 -1
- 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.map +1 -1
- package/dist/quoted-span.js +8 -3
- package/dist/quoted-span.js.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +8 -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/compact.d.ts +3 -1
- package/dist/render/compact.d.ts.map +1 -1
- package/dist/render/compact.js +8 -2
- package/dist/render/compact.js.map +1 -1
- package/dist/render/explain.d.ts +9 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +54 -13
- 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 +110 -16
- 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/suppressions.d.ts +3 -0
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +20 -1
- package/dist/render/suppressions.js.map +1 -1
- 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 +73 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +95 -0
- package/dist/rule-guide.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +87 -33
- 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.map +1 -1
- package/dist/run-semantic.js +2 -1
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +18 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +80 -19
- package/dist/run.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 +8 -1
- package/dist/setting-problems.js.map +1 -1
- package/dist/spacing-minority.d.ts +16 -0
- package/dist/spacing-minority.d.ts.map +1 -0
- package/dist/spacing-minority.js +23 -0
- package/dist/spacing-minority.js.map +1 -0
- 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/stet-block.d.ts +5 -0
- package/dist/stet-block.d.ts.map +1 -0
- package/dist/stet-block.js +59 -0
- package/dist/stet-block.js.map +1 -0
- package/dist/stet.d.ts +4 -0
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +31 -11
- package/dist/stet.js.map +1 -1
- 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 +31 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +77 -0
- package/dist/structure/date-range.js.map +1 -0
- package/dist/structure/definition-use.d.ts +32 -0
- package/dist/structure/definition-use.d.ts.map +1 -0
- package/dist/structure/definition-use.js +102 -0
- package/dist/structure/definition-use.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/lazy-tree.d.ts +8 -0
- package/dist/structure/lazy-tree.d.ts.map +1 -0
- package/dist/structure/lazy-tree.js +14 -0
- package/dist/structure/lazy-tree.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +28 -0
- package/dist/structure/modal-conflict.d.ts.map +1 -0
- package/dist/structure/modal-conflict.js +74 -0
- package/dist/structure/modal-conflict.js.map +1 -0
- package/dist/structure/numbered-clauses.d.ts +4 -0
- package/dist/structure/numbered-clauses.d.ts.map +1 -0
- package/dist/structure/numbered-clauses.js +9 -0
- package/dist/structure/numbered-clauses.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 +76 -30
- 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 +24 -3
- 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 +25 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +88 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +23 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +85 -0
- package/dist/subheading-line.js.map +1 -0
- package/dist/tag-coverage.d.ts +8 -0
- package/dist/tag-coverage.d.ts.map +1 -0
- package/dist/tag-coverage.js +7 -0
- package/dist/tag-coverage.js.map +1 -0
- 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 +68 -0
- package/package.json +9 -3
- package/reference-headings.yaml +17 -0
- package/rules/acronym-expansion-conflict.yaml +82 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +47 -0
- package/rules/agreement-slip.yaml +14 -1
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +57 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +82 -0
- package/rules/assistant-residue.yaml +82 -0
- package/rules/bold-density.yaml +59 -0
- package/rules/bold-label-list.yaml +81 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +58 -0
- package/rules/colon-lead-in.yaml +83 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +88 -0
- package/rules/cushion-phrase-density.yaml +53 -1
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +54 -1
- package/rules/date-order.yaml +34 -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/double-negative.yaml +51 -0
- package/rules/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +18 -2
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/duplicate-heading.yaml +78 -0
- package/rules/emoji-density.yaml +28 -2
- package/rules/empty-conclusion.yaml +28 -0
- package/rules/empty-intensifier.yaml +44 -0
- package/rules/empty-section.yaml +74 -0
- package/rules/excessive-hedging.yaml +49 -2
- package/rules/expletive-construction.yaml +19 -0
- package/rules/fullwidth-alnum-consistency.yaml +53 -0
- package/rules/hankaku-kana.yaml +41 -0
- package/rules/heading-echo.yaml +31 -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/invisible-character.yaml +63 -0
- package/rules/katakana-long-vowel.yaml +99 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +30 -4
- package/rules/max-kanji-continuous.yaml +17 -0
- package/rules/max-paragraph-length.yaml +34 -0
- package/rules/max-sentence-length.yaml +58 -0
- package/rules/modal-conflict.yaml +106 -0
- package/rules/name-variant.yaml +88 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +17 -0
- package/rules/no-em-dash.yaml +49 -0
- package/rules/no-mixed-desumasu.yaml +28 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/nominalization.yaml +89 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/outside-announced-list.yaml +80 -0
- package/rules/oxford-comma-consistency.yaml +18 -0
- package/rules/padded-intro.yaml +44 -0
- package/rules/paragraph-length-variance.yaml +73 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +28 -0
- package/rules/proper-noun-density.yaml +37 -2
- package/rules/ra-nuki.yaml +43 -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/requirement-modal.yaml +94 -0
- package/rules/requirement-smell.yaml +70 -0
- package/rules/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +143 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +113 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +51 -0
- package/rules/space-before-punctuation.yaml +41 -0
- package/rules/spelling-consistency.yaml +47 -0
- package/rules/stock-transition.yaml +86 -0
- package/rules/stray-space.yaml +18 -0
- package/rules/taigen-dome-in-prose.yaml +33 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +38 -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 +20 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/unused-definition.yaml +75 -0
- package/rules/url-run-on.yaml +45 -0
- package/rules/use-before-definition.yaml +77 -0
- package/rules/vague-figure-reference.yaml +66 -0
- package/skills/chaff/SKILL.md +171 -1
- package/src/acronym-expansions.ts +106 -0
- package/src/announced-count.ts +190 -0
- package/src/announced-list.ts +120 -0
- package/src/api.ts +154 -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 +18 -4
- package/src/cli-args.ts +6 -0
- package/src/cli-text.ts +14 -15
- package/src/cli.ts +93 -92
- package/src/closing-paragraph.ts +24 -0
- package/src/commands/compare.ts +73 -0
- package/src/commands/document-commands.ts +19 -0
- package/src/commands/eval.ts +22 -10
- package/src/commands/facts.ts +33 -0
- package/src/commands/feedback.ts +45 -7
- package/src/commands/fix-plan.ts +53 -0
- package/src/commands/outline.ts +49 -0
- package/src/commands/read-document.ts +24 -0
- package/src/commands/suppressions.ts +19 -0
- package/src/commands/test.ts +3 -5
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +89 -0
- package/src/compare/distinct.ts +13 -0
- package/src/compare/extract.ts +80 -0
- package/src/compare/fact-key.ts +31 -0
- package/src/compare/fact-text.ts +87 -0
- package/src/compare/facts-render.ts +63 -0
- package/src/compare/facts-text.ts +41 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +80 -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 +96 -0
- package/src/compare/text.ts +121 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +30 -0
- package/src/config/option-problems.ts +72 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +55 -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 +23 -0
- package/src/custom/module-path.ts +23 -0
- package/src/custom/parse.ts +323 -0
- package/src/custom/problems.ts +111 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect-language.ts +1 -1
- package/src/detect.ts +35 -2
- package/src/detectors/acronym-context.ts +16 -4
- package/src/detectors/ai-phrasing.ts +141 -0
- package/src/detectors/announced-count.ts +25 -0
- package/src/detectors/bold-label.ts +55 -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/contrast-frame.ts +54 -0
- package/src/detectors/custom.ts +89 -0
- package/src/detectors/dangling-figure.ts +26 -0
- package/src/detectors/definition-use.ts +41 -0
- package/src/detectors/doubled-punctuation.ts +52 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/duplicate-heading.ts +47 -0
- package/src/detectors/empty-section.ts +21 -0
- package/src/detectors/enumerated-runs.ts +13 -4
- package/src/detectors/fullwidth-alnum.ts +118 -0
- 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/hankaku-kana.ts +38 -0
- package/src/detectors/heading-case.ts +30 -2
- package/src/detectors/heading-code-words.ts +35 -0
- package/src/detectors/heading-echo.ts +8 -4
- package/src/detectors/heading-level-skip.ts +19 -0
- package/src/detectors/image-alt-text.ts +11 -0
- package/src/detectors/index.ts +79 -1
- package/src/detectors/invisible-character.ts +190 -0
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/lexicon-match.ts +41 -2
- package/src/detectors/lexicon.ts +40 -13
- 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 +198 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +82 -0
- package/src/detectors/markup-finding.ts +39 -0
- package/src/detectors/modal-conflict.ts +26 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/name-variant.ts +15 -0
- package/src/detectors/nominalization.ts +73 -0
- package/src/detectors/orthography.ts +97 -41
- package/src/detectors/outside-announced-list.ts +25 -0
- package/src/detectors/oxford-comma.ts +179 -283
- package/src/detectors/phrase-match.ts +27 -7
- 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/ra-nuki.ts +38 -0
- package/src/detectors/register.ts +37 -10
- package/src/detectors/requirement-modal.ts +67 -0
- package/src/detectors/requirement-smell.ts +52 -0
- 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 +80 -46
- package/src/detectors/space-before-punctuation.ts +32 -0
- package/src/detectors/spelling-variety.ts +81 -0
- package/src/detectors/structure-tree.ts +47 -1
- package/src/detectors/structure.ts +20 -7
- package/src/detectors/superlative-comparison.ts +47 -0
- 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 +33 -0
- package/src/detectors/vague-figure-pointer.ts +58 -0
- package/src/detectors/word-list.ts +6 -1
- package/src/document-sections.ts +46 -0
- package/src/document.ts +188 -173
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/extension/document-view.ts +109 -0
- package/src/extension/failure-text.ts +46 -0
- package/src/extension/import-default.ts +13 -0
- package/src/extension/load.ts +97 -0
- package/src/extension/module-detector.ts +61 -0
- package/src/extension/plugin-load.ts +82 -0
- package/src/extension/plugin-name.ts +26 -0
- package/src/extension/plugin-parse.ts +229 -0
- package/src/extension/problem-text.ts +103 -0
- package/src/extension/real-path.ts +10 -0
- package/src/extension/returned-findings.ts +62 -0
- package/src/extension/rule-export.ts +23 -0
- package/src/feedback/draft.ts +6 -0
- package/src/figure-references.ts +173 -0
- package/src/files.ts +5 -0
- package/src/finding-order.ts +3 -0
- package/src/fix-plan/mode.ts +34 -0
- package/src/fix-plan/plan.ts +181 -0
- package/src/fix-plan/render.ts +128 -0
- package/src/fix-plan/text.ts +133 -0
- package/src/heading-label.ts +55 -0
- package/src/in-page-nav.ts +48 -19
- package/src/joined-view.ts +1 -0
- package/src/language-sample.ts +48 -0
- package/src/levels.ts +14 -1
- package/src/line-paragraphs.ts +52 -9
- package/src/link-line.ts +13 -0
- package/src/long-vowel.ts +109 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +212 -0
- package/src/mask.ts +8 -8
- package/src/name-variants.ts +217 -0
- package/src/node-version.ts +22 -0
- package/src/not-run.ts +16 -0
- package/src/number-name.ts +151 -24
- package/src/orthography.ts +50 -14
- package/src/outline/render.ts +85 -0
- package/src/outline/shape.ts +72 -0
- package/src/outline/text.ts +50 -0
- package/src/page-furniture.ts +11 -2
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +120 -3
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +9 -3
- package/src/reasons.ts +12 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/compact.ts +13 -3
- package/src/render/explain.ts +75 -14
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +140 -18
- 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/suppressions.ts +30 -2
- 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 +173 -0
- package/src/rule-load.ts +91 -34
- package/src/rule-options.ts +131 -0
- package/src/run-semantic.ts +2 -1
- package/src/run.ts +105 -22
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +9 -1
- package/src/spacing-minority.ts +27 -0
- package/src/span-cut.ts +28 -0
- package/src/stet-block.ts +60 -0
- package/src/stet.ts +41 -15
- 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 +117 -0
- package/src/structure/definition-use.ts +130 -0
- package/src/structure/known-mentions.ts +96 -0
- package/src/structure/lazy-tree.ts +15 -0
- package/src/structure/modal-conflict.ts +86 -0
- package/src/structure/numbered-clauses.ts +11 -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 +77 -30
- 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 +33 -5
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +112 -0
- package/src/subheading-line.ts +106 -0
- package/src/tag-coverage.ts +13 -0
- 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 +30 -0
- package/styles/jis-z8301-2011.yaml +28 -0
- package/styles/jis-z8301-2019.yaml +31 -0
- package/styles/koyobun.yaml +35 -0
- package/dist/legal-address.d.ts +0 -2
- package/dist/legal-address.d.ts.map +0 -1
- package/dist/legal-address.js +0 -16
- package/dist/legal-address.js.map +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { bareUrls, type BareUrl } from "../bare-url.ts";
|
|
2
|
+
import { emphasisSpans, linkChrome } from "../document.ts";
|
|
3
|
+
import { opaqueSpans } from "../markdown-read.ts";
|
|
4
|
+
import { spanOf, type MarkdownNode } from "../markdown-node.ts";
|
|
5
|
+
import { maskSpans } from "../mask.ts";
|
|
6
|
+
import { unmaskedSoftBreaks } from "../soft-break.ts";
|
|
7
|
+
import { eachPreOrder } from "../tree-walk.ts";
|
|
8
|
+
import type { Span } from "../plugin.ts";
|
|
9
|
+
import { overlapsAny, spanIndex, type SpanIndex } from "./spans.ts";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The document as the facts in prose are read from it: the same length as the source, with what is not prose
|
|
13
|
+
* blanked. Code, HTML and front matter are compared as code or not at all; a link's target and a bare URL are
|
|
14
|
+
* compared as URLs. Blanking them keeps the digits of a URL from being read again as numbers.
|
|
15
|
+
*/
|
|
16
|
+
export type FactText = {
|
|
17
|
+
/** The source with code and URLs blanked. Offsets are the source's. */
|
|
18
|
+
readonly text: string;
|
|
19
|
+
/** The source with only code blanked: footnote marks are link syntax, so they are read before links are blanked. */
|
|
20
|
+
readonly codeless: string;
|
|
21
|
+
/** Where the blanked parts are. A fact the structure reader found there is not a fact of the prose. */
|
|
22
|
+
readonly blanked: SpanIndex;
|
|
23
|
+
readonly bareUrls: readonly BareUrl[];
|
|
24
|
+
/** Ordered-list markers (`1.`): they number the list, they do not state a number. */
|
|
25
|
+
readonly listMarkers: readonly Span[];
|
|
26
|
+
/**
|
|
27
|
+
* What a reader of the rendered Markdown never sees, sorted: a line break between two wide characters (「系の\nシステム」)
|
|
28
|
+
* and the marks of bold. A plain-text document shows its line breaks, so it has none.
|
|
29
|
+
*/
|
|
30
|
+
readonly unseen: readonly Span[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** Nodes whose whole span is not read as prose: a link reference definition's URL is read as a URL, an image is not text. */
|
|
34
|
+
const WHOLE = new Set(["definition", "image", "imageReference"]);
|
|
35
|
+
const LINKS = new Set(["link", "linkReference"]);
|
|
36
|
+
|
|
37
|
+
/** `1.` or `1)` at the start of an ordered list item. */
|
|
38
|
+
const ORDERED_MARKER = /^\s*\d{1,9}[.)]/u;
|
|
39
|
+
|
|
40
|
+
const listMarker = (node: MarkdownNode, source: string): Span[] => {
|
|
41
|
+
const span = spanOf(node);
|
|
42
|
+
if (node.type !== "listItem" || span === undefined) return [];
|
|
43
|
+
const marker = ORDERED_MARKER.exec(source.slice(span.start, span.end));
|
|
44
|
+
return marker === null ? [] : [{ start: span.start, end: span.start + marker[0].length }];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type MarkdownParts = { readonly chrome: Span[]; readonly linkSpans: Span[]; readonly listMarkers: Span[] };
|
|
48
|
+
|
|
49
|
+
const markdownParts = (root: MarkdownNode, source: string): MarkdownParts => {
|
|
50
|
+
const parts: MarkdownParts = { chrome: [], linkSpans: [], listMarkers: [] };
|
|
51
|
+
eachPreOrder(root, (node) => {
|
|
52
|
+
const span = spanOf(node);
|
|
53
|
+
if (span === undefined) return;
|
|
54
|
+
if (WHOLE.has(node.type)) parts.chrome.push(span);
|
|
55
|
+
if (LINKS.has(node.type)) {
|
|
56
|
+
parts.chrome.push(...linkChrome(node));
|
|
57
|
+
parts.linkSpans.push(span);
|
|
58
|
+
}
|
|
59
|
+
parts.listMarkers.push(...listMarker(node, source));
|
|
60
|
+
});
|
|
61
|
+
return parts;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Line breaks are read the way the rules read them: one next to blanked code or a link's marks is kept. Bold marks are
|
|
66
|
+
* read through, as a reader does not see them: 「系の\n**システム**」 joins too. The break and the marks may touch, so the
|
|
67
|
+
* spans are merged.
|
|
68
|
+
*/
|
|
69
|
+
const unseenOf = (source: string, text: string, root: MarkdownNode | undefined): readonly Span[] => {
|
|
70
|
+
if (root === undefined) return [];
|
|
71
|
+
const emphasis = emphasisSpans(root, source);
|
|
72
|
+
const breaks = unmaskedSoftBreaks(maskSpans(source, emphasis), maskSpans(text, emphasis));
|
|
73
|
+
return spanIndex([...breaks, ...emphasis]);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** root is the Markdown tree, or undefined for a plain-text document, where nothing is code and URLs are bare. */
|
|
77
|
+
export const factTextOf = (source: string, root: MarkdownNode | undefined): FactText => {
|
|
78
|
+
const code = root === undefined ? [] : opaqueSpans(root);
|
|
79
|
+
const codeless = maskSpans(source, code);
|
|
80
|
+
const parts = root === undefined ? { chrome: [], linkSpans: [], listMarkers: [] } : markdownParts(root, source);
|
|
81
|
+
const insideLinks = spanIndex(parts.linkSpans);
|
|
82
|
+
// An autolink's text is its URL: it is read once, as the link.
|
|
83
|
+
const bare = bareUrls(codeless).filter((url) => !overlapsAny(insideLinks, url));
|
|
84
|
+
const blanked = [...code, ...parts.chrome, ...bare];
|
|
85
|
+
const text = maskSpans(source, blanked);
|
|
86
|
+
return { text, codeless, blanked: spanIndex(blanked), bareUrls: bare, listMarkers: parts.listMarkers, unseen: unseenOf(source, text, root) };
|
|
87
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ATOM_KINDS, type Atom, type AtomKind, type Extraction, type Unread } from "./atom.ts";
|
|
2
|
+
import { countsOf } from "./outcome.ts";
|
|
3
|
+
import { atomJson, shown } from "./render.ts";
|
|
4
|
+
import type { FactsText } from "./facts-text.ts";
|
|
5
|
+
|
|
6
|
+
/** One document's facts as `chaff facts` lists them. */
|
|
7
|
+
export type FactList = { readonly path: string; readonly language: string; readonly extraction: Extraction };
|
|
8
|
+
|
|
9
|
+
/** Kind by kind in compare's order, and within a kind in the order the document states them. */
|
|
10
|
+
export const inChecklistOrder = (atoms: readonly Atom[]): Atom[] =>
|
|
11
|
+
atoms.toSorted((left, right) => ATOM_KINDS.indexOf(left.kind) - ATOM_KINDS.indexOf(right.kind) || left.line - right.line);
|
|
12
|
+
|
|
13
|
+
/** Every kind with its count, zeros too: an empty kind reads as "none stated", never as "not looked at". */
|
|
14
|
+
const perKind = (atoms: readonly Atom[], text: FactsText): string => {
|
|
15
|
+
const counts = countsOf(atoms);
|
|
16
|
+
return ATOM_KINDS.map((kind) => text.kindCount(text.kinds[kind], counts[kind])).join(text.separator);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const title = (list: FactList, text: FactsText): string => text.title(list.path, list.extraction.atoms.length, perKind(list.extraction.atoms, text));
|
|
20
|
+
|
|
21
|
+
const checklistLine = (atom: Atom, path: string): string => ` - [ ] ${shown(atom.text)} (${path}:${String(atom.line)})`;
|
|
22
|
+
|
|
23
|
+
const kindBlock = (ordered: readonly Atom[], kind: AtomKind, path: string, text: FactsText): string[] => {
|
|
24
|
+
const ofKind = ordered.filter((atom) => atom.kind === kind);
|
|
25
|
+
return ofKind.length === 0 ? [] : ["", text.kindHeading(text.kinds[kind], ofKind.length), ...ofKind.map((atom) => checklistLine(atom, path))];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const unreadBlock = (unread: readonly Unread[], text: FactsText): string[] =>
|
|
29
|
+
unread.length === 0 ? [] : ["", text.unreadHeading, ...unread.map((entry) => ` ${text.unread(entry.kind, entry.reason)}`)];
|
|
30
|
+
|
|
31
|
+
/** For a person or an AI about to rewrite: a checklist per kind, with the line each fact is on. */
|
|
32
|
+
export const renderFactsFriendly = (list: FactList, text: FactsText): string => {
|
|
33
|
+
const ordered = inChecklistOrder(list.extraction.atoms);
|
|
34
|
+
return [
|
|
35
|
+
title(list, text),
|
|
36
|
+
...ATOM_KINDS.flatMap((kind) => kindBlock(ordered, kind, list.path, text)),
|
|
37
|
+
...unreadBlock(list.extraction.unread, text),
|
|
38
|
+
"",
|
|
39
|
+
text.next(list.path),
|
|
40
|
+
].join("\n");
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** For grep: one fact per line with the kind in English, then what was not read, then the counts. */
|
|
44
|
+
export const renderFactsCompact = (list: FactList, text: FactsText): string =>
|
|
45
|
+
[
|
|
46
|
+
...inChecklistOrder(list.extraction.atoms).map((atom) => `${list.path}:${String(atom.line)}: ${atom.kind} ${shown(atom.text)}`),
|
|
47
|
+
...list.extraction.unread.map((entry) => `${list.path}: unread ${entry.kind} (${entry.reason})`),
|
|
48
|
+
title(list, text),
|
|
49
|
+
].join("\n");
|
|
50
|
+
|
|
51
|
+
/** For an AI to keep as its inventory: every fact with its kind, key, text and line, and the counts per kind. */
|
|
52
|
+
export const renderFactsJson = (list: FactList): string =>
|
|
53
|
+
JSON.stringify(
|
|
54
|
+
{
|
|
55
|
+
path: list.path,
|
|
56
|
+
language: list.language,
|
|
57
|
+
counts: countsOf(list.extraction.atoms),
|
|
58
|
+
unread: list.extraction.unread,
|
|
59
|
+
facts: inChecklistOrder(list.extraction.atoms).map(atomJson),
|
|
60
|
+
},
|
|
61
|
+
null,
|
|
62
|
+
2,
|
|
63
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Texts } from "../ui.ts";
|
|
2
|
+
import { counted } from "../render/plural.ts";
|
|
3
|
+
import { COMPARE_TEXT, type CompareText } from "./text.ts";
|
|
4
|
+
|
|
5
|
+
/** What `chaff facts` says. The names of the kinds and the reasons a kind was not read are compare's own. */
|
|
6
|
+
export type FactsText = Pick<CompareText, "kinds" | "unread" | "unreadHeading" | "separator"> & {
|
|
7
|
+
readonly usage: string;
|
|
8
|
+
/** The first line: the file, how many facts, and the count per kind. */
|
|
9
|
+
readonly title: (path: string, total: number, perKind: string) => string;
|
|
10
|
+
readonly kindHeading: (kindName: string, count: number) => string;
|
|
11
|
+
/** How a kind is counted in the first line (数 12 / numbers 12). */
|
|
12
|
+
readonly kindCount: (kindName: string, count: number) => string;
|
|
13
|
+
/** The last line: the command that checks a rewrite against this list. */
|
|
14
|
+
readonly next: (path: string) => string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const shared = (text: CompareText): Pick<CompareText, "kinds" | "unread" | "unreadHeading" | "separator"> => ({
|
|
18
|
+
kinds: text.kinds,
|
|
19
|
+
unread: text.unread,
|
|
20
|
+
unreadHeading: text.unreadHeading,
|
|
21
|
+
separator: text.separator,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const FACTS_TEXT: Texts<FactsText> = {
|
|
25
|
+
ja: {
|
|
26
|
+
...shared(COMPARE_TEXT.ja),
|
|
27
|
+
usage: "使い方: chaff facts <file> [--compact | --json] [--language ja|en|…] [--genre <ジャンル>]",
|
|
28
|
+
title: (path, total, perKind) => `${path} の事実 ${String(total)} 件(${perKind})`,
|
|
29
|
+
kindHeading: (kindName, count) => `${kindName} ${String(count)} 件`,
|
|
30
|
+
kindCount: (kindName, count) => `${kindName} ${String(count)}`,
|
|
31
|
+
next: (path) => `書き直したら npx chaffjs compare ${path} <書き直した後> で、この一覧が残っているかを確かめます`,
|
|
32
|
+
},
|
|
33
|
+
en: {
|
|
34
|
+
...shared(COMPARE_TEXT.en),
|
|
35
|
+
usage: "usage: chaff facts <file> [--compact | --json] [--language ja|en|…] [--genre <genre>]",
|
|
36
|
+
title: (path, total, perKind) => `${path}: ${counted(total, "fact")} (${perKind})`,
|
|
37
|
+
kindHeading: (kindName, count) => `${kindName}: ${String(count)}`,
|
|
38
|
+
kindCount: (kindName, count) => `${kindName} ${String(count)}`,
|
|
39
|
+
next: (path) => `After rewriting, npx chaffjs compare ${path} <rewritten> checks that every fact on this list is still there`,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { spanOf, type MarkdownNode } from "../markdown-node.ts";
|
|
2
|
+
import { eachPreOrder } from "../tree-walk.ts";
|
|
3
|
+
import type { Markup } from "../plugin.ts";
|
|
4
|
+
import type { BareUrl } from "../bare-url.ts";
|
|
5
|
+
import type { Atom } from "./atom.ts";
|
|
6
|
+
|
|
7
|
+
const CODE = new Set(["code", "inlineCode"]);
|
|
8
|
+
|
|
9
|
+
/** Inline code and code blocks, compared as written: the key is the code itself, without its backticks or fences. */
|
|
10
|
+
export const codeAtoms = (root: MarkdownNode, lineOf: (offset: number) => number): Atom[] => {
|
|
11
|
+
const found: Atom[] = [];
|
|
12
|
+
eachPreOrder(root, (node) => {
|
|
13
|
+
const span = spanOf(node);
|
|
14
|
+
if (!CODE.has(node.type) || span === undefined) return;
|
|
15
|
+
const code = node.value ?? "";
|
|
16
|
+
found.push({ kind: "code", key: code, text: code, line: lineOf(span.start) });
|
|
17
|
+
});
|
|
18
|
+
return found;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Where links point (a Markdown link, an autolink, a used reference definition) and URLs written bare. */
|
|
22
|
+
export const urlAtoms = (markup: Markup | undefined, bare: readonly BareUrl[], lineOf: (offset: number) => number): Atom[] => [
|
|
23
|
+
...(markup?.links ?? []).map((link) => ({ kind: "url" as const, key: link.destination, text: link.destination, line: lineOf(link.start) })),
|
|
24
|
+
...bare.map((url) => ({ kind: "url" as const, key: url.url, text: url.url, line: lineOf(url.start) })),
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/** Markdown headings as structure: the key is the level, so a reworded heading is the same heading in another form. */
|
|
28
|
+
export const headingAtoms = (markup: Markup | undefined, lineOf: (offset: number) => number): Atom[] =>
|
|
29
|
+
(markup?.headings ?? []).map((heading) => ({ kind: "heading", key: "#".repeat(heading.depth), text: heading.text, line: lineOf(heading.start) }));
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Atom } from "./atom.ts";
|
|
2
|
+
|
|
3
|
+
/** The same fact written another way: 1,000円 and 1000円, 2026年4月1日 and 2026/4/1, a reworded heading. */
|
|
4
|
+
export type Reformed = { readonly before: Atom; readonly after: Atom };
|
|
5
|
+
|
|
6
|
+
export type Comparison = {
|
|
7
|
+
/** In the first document and not in the second. */
|
|
8
|
+
readonly dropped: readonly Atom[];
|
|
9
|
+
/** In the second document and not in the first. */
|
|
10
|
+
readonly added: readonly Atom[];
|
|
11
|
+
readonly reformed: readonly Reformed[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const identity = (atom: Atom): string => `${atom.kind}\u0000${atom.key}`;
|
|
15
|
+
|
|
16
|
+
const groupBy = <T>(items: readonly T[], keyOf: (item: T) => string): Map<string, T[]> => {
|
|
17
|
+
const groups = new Map<string, T[]>();
|
|
18
|
+
items.forEach((item) => {
|
|
19
|
+
const key = keyOf(item);
|
|
20
|
+
const group = groups.get(key);
|
|
21
|
+
if (group === undefined) groups.set(key, [item]);
|
|
22
|
+
else group.push(item);
|
|
23
|
+
});
|
|
24
|
+
return groups;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Takes and removes the first item the queue for key holds. */
|
|
28
|
+
type Queues<T> = { readonly groups: Map<string, T[]>; readonly taken: Map<string, number> };
|
|
29
|
+
|
|
30
|
+
const queuesOf = <T>(items: readonly T[], keyOf: (item: T) => string): Queues<T> => ({ groups: groupBy(items, keyOf), taken: new Map() });
|
|
31
|
+
|
|
32
|
+
/** The next item not yet taken under key. A cursor, not shift(): shift moves every item left, which is quadratic over a long queue. */
|
|
33
|
+
const takeFrom = <T>(queues: Queues<T>, key: string): T | undefined => {
|
|
34
|
+
const next = queues.taken.get(key) ?? 0;
|
|
35
|
+
const item = queues.groups.get(key)?.[next];
|
|
36
|
+
if (item !== undefined) queues.taken.set(key, next + 1);
|
|
37
|
+
return item;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Atoms of one fact: written the same way they need no report; written differently they pair as reformed; the rest are surplus. */
|
|
41
|
+
const matchGroup = (before: readonly Atom[], after: readonly Atom[]): Comparison => {
|
|
42
|
+
const afterByText = queuesOf(after, (atom) => atom.text);
|
|
43
|
+
const sameText = new Set<Atom>();
|
|
44
|
+
const unmatchedBefore = before.filter((atom) => {
|
|
45
|
+
const twin = takeFrom(afterByText, atom.text);
|
|
46
|
+
if (twin !== undefined) sameText.add(twin);
|
|
47
|
+
return twin === undefined;
|
|
48
|
+
});
|
|
49
|
+
const unmatchedAfter = after.filter((atom) => !sameText.has(atom));
|
|
50
|
+
const pairs = Math.min(unmatchedBefore.length, unmatchedAfter.length);
|
|
51
|
+
return {
|
|
52
|
+
reformed: unmatchedBefore.slice(0, pairs).map((atom, index) => ({ before: atom, after: unmatchedAfter[index] ?? atom })),
|
|
53
|
+
dropped: unmatchedBefore.slice(pairs),
|
|
54
|
+
added: unmatchedAfter.slice(pairs),
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const unitQueue = (value: string | undefined, unitless: boolean): string => `${value ?? ""}\u0000${unitless ? "bare" : "unit"}`;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A number one side wrote with a unit the language package read (30 GB) and the other wrote so the unit was not read
|
|
62
|
+
* (30GB) is one number in another form. Two different units (5 件, 5 人) stay a dropped and an added fact.
|
|
63
|
+
*/
|
|
64
|
+
const pairUnits = (comparison: Comparison): Comparison => {
|
|
65
|
+
const addedNumbers = queuesOf(
|
|
66
|
+
comparison.added.filter((atom) => atom.kind === "number"),
|
|
67
|
+
(atom) => unitQueue(atom.value, atom.unitless === true),
|
|
68
|
+
);
|
|
69
|
+
const paired = new Set<Atom>();
|
|
70
|
+
const reformed = comparison.dropped.flatMap((atom): Reformed[] => {
|
|
71
|
+
// Two unitless numbers of one value share a key and were already paired; only the other side's kind can match.
|
|
72
|
+
const found = atom.kind === "number" ? takeFrom(addedNumbers, unitQueue(atom.value, atom.unitless !== true)) : undefined;
|
|
73
|
+
if (found === undefined) return [];
|
|
74
|
+
paired.add(atom).add(found);
|
|
75
|
+
return [{ before: atom, after: found }];
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
dropped: comparison.dropped.filter((atom) => !paired.has(atom)),
|
|
79
|
+
added: comparison.added.filter((atom) => !paired.has(atom)),
|
|
80
|
+
reformed: [...comparison.reformed, ...reformed],
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const byLine = (left: Atom, right: Atom): number => left.line - right.line;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The facts of two documents compared as multisets: where a fact is written does not matter, how many times it is
|
|
88
|
+
* stated does. Pure: the same atoms always give the same comparison.
|
|
89
|
+
*/
|
|
90
|
+
export const compareAtoms = (before: readonly Atom[], after: readonly Atom[]): Comparison => {
|
|
91
|
+
const beforeGroups = groupBy(before, identity);
|
|
92
|
+
const afterGroups = groupBy(after, identity);
|
|
93
|
+
const keys = [...new Set([...beforeGroups.keys(), ...afterGroups.keys()])];
|
|
94
|
+
const groups = keys.map((key) => matchGroup(beforeGroups.get(key) ?? [], afterGroups.get(key) ?? []));
|
|
95
|
+
const paired = pairUnits({
|
|
96
|
+
dropped: groups.flatMap((group) => group.dropped),
|
|
97
|
+
added: groups.flatMap((group) => group.added),
|
|
98
|
+
reformed: groups.flatMap((group) => group.reformed),
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
dropped: paired.dropped.toSorted(byLine),
|
|
102
|
+
added: paired.added.toSorted(byLine),
|
|
103
|
+
reformed: paired.reformed.toSorted((left, right) => byLine(left.before, right.before)),
|
|
104
|
+
};
|
|
105
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type Atom, type AtomKind, type Extraction, type Unread } from "./atom.ts";
|
|
2
|
+
import { compareAtoms, type Reformed } from "./match.ts";
|
|
3
|
+
import { unwrittenNames } from "./written-names.ts";
|
|
4
|
+
import { unstatedChanges } from "./distinct.ts";
|
|
5
|
+
|
|
6
|
+
/** One document as compared: where it is, how many facts of each kind it states, and what could not be read. */
|
|
7
|
+
export type Side = {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly counts: Readonly<Record<AtomKind, number>>;
|
|
10
|
+
readonly unread: readonly Unread[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** A dropped or added fact, and whether the command line allowed its kind to change. */
|
|
14
|
+
export type Change = Atom & { readonly allowed: boolean };
|
|
15
|
+
|
|
16
|
+
export type Outcome = {
|
|
17
|
+
readonly before: Side;
|
|
18
|
+
readonly after: Side;
|
|
19
|
+
readonly dropped: readonly Change[];
|
|
20
|
+
readonly added: readonly Change[];
|
|
21
|
+
readonly reformed: readonly Reformed[];
|
|
22
|
+
/** No fact dropped or added, other than of a kind allowed to be. */
|
|
23
|
+
readonly ok: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Kinds whose facts may be dropped or added on purpose (--allow-dropped, --allow-added). */
|
|
27
|
+
export type Allowed = { readonly dropped: ReadonlySet<AtomKind>; readonly added: ReadonlySet<AtomKind> };
|
|
28
|
+
|
|
29
|
+
const NOTHING_ALLOWED: Allowed = { dropped: new Set(), added: new Set() };
|
|
30
|
+
|
|
31
|
+
/** How facts are counted: as-stated compares how many times each is stated, distinct only whether it is stated (--distinct). */
|
|
32
|
+
export type Counting = "as-stated" | "distinct";
|
|
33
|
+
|
|
34
|
+
const NO_FACTS: Readonly<Record<AtomKind, number>> = {
|
|
35
|
+
number: 0,
|
|
36
|
+
date: 0,
|
|
37
|
+
time: 0,
|
|
38
|
+
url: 0,
|
|
39
|
+
code: 0,
|
|
40
|
+
name: 0,
|
|
41
|
+
quote: 0,
|
|
42
|
+
heading: 0,
|
|
43
|
+
reference: 0,
|
|
44
|
+
footnote: 0,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const countsOf = (atoms: readonly Atom[]): Record<AtomKind, number> => {
|
|
48
|
+
const counts = { ...NO_FACTS };
|
|
49
|
+
atoms.forEach((atom) => {
|
|
50
|
+
counts[atom.kind] += 1;
|
|
51
|
+
});
|
|
52
|
+
return counts;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const sideOf = (path: string, extraction: Extraction): Side => ({ path, counts: countsOf(extraction.atoms), unread: extraction.unread });
|
|
56
|
+
|
|
57
|
+
const marked = (atoms: readonly Atom[], allowed: ReadonlySet<AtomKind>): Change[] => atoms.map((atom) => ({ ...atom, allowed: allowed.has(atom.kind) }));
|
|
58
|
+
|
|
59
|
+
export type Compared = { readonly path: string; readonly extraction: Extraction };
|
|
60
|
+
|
|
61
|
+
/** The changes of one side that the other side does not state: as many times (as-stated), or at all (distinct). */
|
|
62
|
+
const changesOf = (changes: readonly Atom[], own: Extraction, other: Extraction, counting: Counting): Atom[] => {
|
|
63
|
+
const unwritten = unwrittenNames(changes, own.atoms, other.nameText);
|
|
64
|
+
return counting === "distinct" ? unstatedChanges(unwritten, other.atoms, other.nameText) : unwritten;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** What `chaff compare` reports: the comparison of two documents' facts, with the allowed kinds set aside. */
|
|
68
|
+
export const outcomeOf = (before: Compared, after: Compared, allowed: Allowed = NOTHING_ALLOWED, counting: Counting = "as-stated"): Outcome => {
|
|
69
|
+
const comparison = compareAtoms(before.extraction.atoms, after.extraction.atoms);
|
|
70
|
+
const dropped = marked(changesOf(comparison.dropped, before.extraction, after.extraction, counting), allowed.dropped);
|
|
71
|
+
const added = marked(changesOf(comparison.added, after.extraction, before.extraction, counting), allowed.added);
|
|
72
|
+
return {
|
|
73
|
+
before: sideOf(before.path, before.extraction),
|
|
74
|
+
after: sideOf(after.path, after.extraction),
|
|
75
|
+
dropped,
|
|
76
|
+
added,
|
|
77
|
+
reformed: comparison.reformed,
|
|
78
|
+
ok: [...dropped, ...added].every((change) => change.allowed),
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ProseDocument, Span, Token } from "../plugin.ts";
|
|
2
|
+
import type { Atom } from "./atom.ts";
|
|
3
|
+
import { overlapsAny, type SpanIndex } from "./spans.ts";
|
|
4
|
+
import { factKey } from "./fact-key.ts";
|
|
5
|
+
|
|
6
|
+
const PROPER_NOUN = "PROPN";
|
|
7
|
+
|
|
8
|
+
/** Two proper nouns with at most one space between them are one name: New York, 日本 銀行. */
|
|
9
|
+
const MAX_GAP = 1;
|
|
10
|
+
|
|
11
|
+
type Run = Span & { readonly words: number };
|
|
12
|
+
|
|
13
|
+
const joins = (run: Run | undefined, token: Token, text: string): run is Run =>
|
|
14
|
+
run !== undefined && token.span.start - run.end <= MAX_GAP && text.slice(run.end, token.span.start).trim() === "";
|
|
15
|
+
|
|
16
|
+
/** Adjacent proper nouns, each run one name. */
|
|
17
|
+
const runsOf = (tokens: readonly Token[], text: string): Run[] =>
|
|
18
|
+
tokens.reduce<Run[]>((runs, token) => {
|
|
19
|
+
if (token.pos !== PROPER_NOUN) return runs;
|
|
20
|
+
const last = runs.at(-1);
|
|
21
|
+
if (joins(last, token, text)) runs[runs.length - 1] = { start: last.start, end: token.span.end, words: last.words + 1 };
|
|
22
|
+
else runs.push({ start: token.span.start, end: token.span.end, words: 1 });
|
|
23
|
+
return runs;
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
/** Words written in lower case. A capitalised word the same document also writes this way is a common word that began a sentence. */
|
|
27
|
+
const LOWER_CASE_WORD = /(?<![\p{L}\p{M}])\p{Ll}[\p{L}\p{M}]*/gu;
|
|
28
|
+
|
|
29
|
+
const lowerCaseWords = (source: string): ReadonlySet<string> => new Set(source.match(LOWER_CASE_WORD) ?? []);
|
|
30
|
+
|
|
31
|
+
const withLowerFirst = (word: string): string => `${word.charAt(0).toLowerCase()}${word.slice(1)}`;
|
|
32
|
+
|
|
33
|
+
/** A one-word name the document also writes in lower case ("Scammers" opening a sentence, "scammers" elsewhere). */
|
|
34
|
+
const isCommonWord = (run: Run, written: string, lowerCase: ReadonlySet<string>): boolean => {
|
|
35
|
+
const lowered = withLowerFirst(written);
|
|
36
|
+
return run.words === 1 && lowered !== written && lowerCase.has(lowered);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type NounInput = {
|
|
40
|
+
readonly doc: ProseDocument;
|
|
41
|
+
/** Facts other readers took and what is not prose: a proper noun inside one is read as that, not again here. */
|
|
42
|
+
readonly taken: SpanIndex;
|
|
43
|
+
readonly lineOf: (offset: number) => number;
|
|
44
|
+
/** What a reader never sees (FactText.unseen): a line break inside a name does not make another name. */
|
|
45
|
+
readonly unseen: readonly Span[];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Whether the language package tagged parts of speech: without them, a document with sentences has no proper nouns to read. */
|
|
49
|
+
export const readsProperNouns = (doc: ProseDocument): boolean => doc.sentences.length === 0 || doc.sentences.some((sentence) => sentence.tokens !== undefined);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Proper nouns as the part-of-speech tagger reads them in sentences. Headings are left out: they are compared as
|
|
53
|
+
* headings, may be reworded, and a title-case heading makes every word look like a name.
|
|
54
|
+
*/
|
|
55
|
+
export const properNouns = (input: NounInput): Atom[] => {
|
|
56
|
+
const { source } = input.doc;
|
|
57
|
+
const lowerCase = lowerCaseWords(source);
|
|
58
|
+
return input.doc.sentences.flatMap((sentence) =>
|
|
59
|
+
runsOf(sentence.tokens ?? [], source).flatMap((run): Atom[] => {
|
|
60
|
+
const text = source.slice(run.start, run.end);
|
|
61
|
+
if (overlapsAny(input.taken, run) || isCommonWord(run, text, lowerCase)) return [];
|
|
62
|
+
return [{ kind: "name", key: factKey(source, run, input.unseen), text, line: input.lineOf(run.start) }];
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ATOM_KINDS, type Atom, type AtomKind } from "./atom.ts";
|
|
2
|
+
import type { Reformed } from "./match.ts";
|
|
3
|
+
import type { Change, Outcome, Side } from "./outcome.ts";
|
|
4
|
+
import type { CompareText } from "./text.ts";
|
|
5
|
+
|
|
6
|
+
/** How much of a fact is shown: a code block is shown by its first line. */
|
|
7
|
+
const SHOWN_WIDTH = 60;
|
|
8
|
+
|
|
9
|
+
/** One line of a fact as written: a code block or a wrapped quotation is shown on one line, cut at SHOWN_WIDTH. */
|
|
10
|
+
export const shown = (text: string): string => {
|
|
11
|
+
const oneLine = text.replace(/\s+/gu, " ").trim();
|
|
12
|
+
return oneLine.length > SHOWN_WIDTH ? `${oneLine.slice(0, SHOWN_WIDTH)}…` : oneLine;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const totalOf = (side: Side): number => ATOM_KINDS.reduce((sum, kind) => sum + side.counts[kind], 0);
|
|
16
|
+
|
|
17
|
+
/** The count line. Every kind is listed, zeros too: "nothing dropped" reads as N facts checked, never as nothing looked at. */
|
|
18
|
+
const checkedLine = (outcome: Outcome, text: CompareText): string => {
|
|
19
|
+
const perKind = ATOM_KINDS.map((kind) => `${text.kinds[kind]} ${String(outcome.before.counts[kind])}→${String(outcome.after.counts[kind])}`);
|
|
20
|
+
return text.checked(totalOf(outcome.before), totalOf(outcome.after), perKind.join(text.separator));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const failing = (changes: readonly Change[]): number => changes.filter((change) => !change.allowed).length;
|
|
24
|
+
|
|
25
|
+
const verdict = (outcome: Outcome, text: CompareText): string => (outcome.ok ? text.clean : text.failed(failing(outcome.dropped), failing(outcome.added)));
|
|
26
|
+
|
|
27
|
+
const kindColumn = (kind: AtomKind, text: CompareText): string => `${text.kind[kind]}: `;
|
|
28
|
+
|
|
29
|
+
const changeLine = (change: Change, path: string, flag: string, text: CompareText): string =>
|
|
30
|
+
` ${kindColumn(change.kind, text)}${shown(change.text)} (${path}:${String(change.line)})${change.allowed ? text.allowed(flag) : ""}`;
|
|
31
|
+
|
|
32
|
+
const reformedLine = (pair: Reformed, text: CompareText): string =>
|
|
33
|
+
` ${kindColumn(pair.before.kind, text)}${shown(pair.before.text)} → ${shown(pair.after.text)} (${text.lines(pair.before.line, pair.after.line)})`;
|
|
34
|
+
|
|
35
|
+
const block = (heading: string, lines: readonly string[]): string[] => (lines.length === 0 ? [] : ["", heading, ...lines]);
|
|
36
|
+
|
|
37
|
+
const unreadBlock = (outcome: Outcome, text: CompareText): string[] => {
|
|
38
|
+
const sides = [outcome.before, outcome.after];
|
|
39
|
+
const lines = sides.flatMap((side) => side.unread.map((unread) => ` ${side.path}: ${text.unread(unread.kind, unread.reason)}`));
|
|
40
|
+
return block(text.unreadHeading, lines);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** For a person: what was dropped and added, with the line in each file, then what only changed its form. */
|
|
44
|
+
export const renderFriendly = (outcome: Outcome, text: CompareText): string => {
|
|
45
|
+
const { before, after } = outcome;
|
|
46
|
+
return [
|
|
47
|
+
`${before.path} → ${after.path}`,
|
|
48
|
+
...block(
|
|
49
|
+
text.droppedHeading(outcome.dropped.length, before.path, after.path),
|
|
50
|
+
outcome.dropped.map((change) => changeLine(change, before.path, "--allow-dropped", text)),
|
|
51
|
+
),
|
|
52
|
+
...block(
|
|
53
|
+
text.addedHeading(outcome.added.length, after.path),
|
|
54
|
+
outcome.added.map((change) => changeLine(change, after.path, "--allow-added", text)),
|
|
55
|
+
),
|
|
56
|
+
...block(
|
|
57
|
+
text.reformedHeading(outcome.reformed.length),
|
|
58
|
+
outcome.reformed.map((pair) => reformedLine(pair, text)),
|
|
59
|
+
),
|
|
60
|
+
...unreadBlock(outcome, text),
|
|
61
|
+
"",
|
|
62
|
+
checkedLine(outcome, text),
|
|
63
|
+
verdict(outcome, text),
|
|
64
|
+
].join("\n");
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const compactChange = (change: Change, path: string, word: string): string =>
|
|
68
|
+
`${path}:${String(change.line)}: ${word} ${change.kind} ${shown(change.text)}${change.allowed ? " (allowed)" : ""}`;
|
|
69
|
+
|
|
70
|
+
/** For an engineer and grep: one line per fact, the words dropped / added / reformed and the kind in English. */
|
|
71
|
+
export const renderCompact = (outcome: Outcome, text: CompareText): string => {
|
|
72
|
+
const { before, after } = outcome;
|
|
73
|
+
return [
|
|
74
|
+
...outcome.dropped.map((change) => compactChange(change, before.path, "dropped")),
|
|
75
|
+
...outcome.added.map((change) => compactChange(change, after.path, "added")),
|
|
76
|
+
...outcome.reformed.map(
|
|
77
|
+
(pair) =>
|
|
78
|
+
`${before.path}:${String(pair.before.line)} → ${after.path}:${String(pair.after.line)}: reformed ${pair.before.kind} ${shown(pair.before.text)} → ${shown(pair.after.text)}`,
|
|
79
|
+
),
|
|
80
|
+
...before.unread.map((unread) => `${before.path}: unread ${unread.kind} (${unread.reason})`),
|
|
81
|
+
...after.unread.map((unread) => `${after.path}: unread ${unread.kind} (${unread.reason})`),
|
|
82
|
+
checkedLine(outcome, text),
|
|
83
|
+
text.tally(failing(outcome.dropped), failing(outcome.added), outcome.reformed.length),
|
|
84
|
+
].join("\n");
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const atomJson = (atom: Atom): Readonly<Record<string, string | number>> => ({ kind: atom.kind, key: atom.key, text: atom.text, line: atom.line });
|
|
88
|
+
|
|
89
|
+
/** For an AI to act on: every dropped and added fact with its line, the reformed pairs, and the counts per kind. */
|
|
90
|
+
export const renderJson = (outcome: Outcome): string =>
|
|
91
|
+
JSON.stringify(
|
|
92
|
+
{
|
|
93
|
+
ok: outcome.ok,
|
|
94
|
+
before: outcome.before,
|
|
95
|
+
after: outcome.after,
|
|
96
|
+
dropped: outcome.dropped.map((change) => ({ ...atomJson(change), allowed: change.allowed })),
|
|
97
|
+
added: outcome.added.map((change) => ({ ...atomJson(change), allowed: change.allowed })),
|
|
98
|
+
reformed: outcome.reformed.map((pair) => ({ kind: pair.before.kind, key: pair.before.key, before: atomJson(pair.before), after: atomJson(pair.after) })),
|
|
99
|
+
},
|
|
100
|
+
null,
|
|
101
|
+
2,
|
|
102
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Span } from "../plugin.ts";
|
|
2
|
+
import { firstEndingAfter } from "../soft-break.ts";
|
|
3
|
+
import { mergeSpans } from "../span-merge.ts";
|
|
4
|
+
|
|
5
|
+
/** Spans made ready for lookups: sorted and merged, so each lookup is a binary search, not a scan of every span. */
|
|
6
|
+
export type SpanIndex = readonly Span[];
|
|
7
|
+
|
|
8
|
+
export const spanIndex = (spans: readonly Span[]): SpanIndex => mergeSpans(spans, false);
|
|
9
|
+
|
|
10
|
+
/** Whether span shares at least one character with a span in the index. */
|
|
11
|
+
export const overlapsAny = (index: SpanIndex, span: Span): boolean => {
|
|
12
|
+
const region = index[firstEndingAfter(index, span.start)];
|
|
13
|
+
return region !== undefined && region.start < span.end;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** Whether the character at offset is inside a span in the index. */
|
|
17
|
+
export const coversOffset = (index: SpanIndex, offset: number): boolean => overlapsAny(index, { start: offset, end: offset + 1 });
|