@greyworld/code-check-core 1.0.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/facade/code-checker.d.ts +14 -0
- package/dist/facade/code-checker.d.ts.map +1 -0
- package/dist/facade/code-checker.js +63 -0
- package/dist/facade/code-checker.js.map +1 -0
- package/dist/facade/index.d.ts +3 -0
- package/dist/facade/index.d.ts.map +1 -0
- package/dist/facade/index.js +6 -0
- package/dist/facade/index.js.map +1 -0
- package/dist/facade/types.d.ts +24 -0
- package/dist/facade/types.d.ts.map +1 -0
- package/dist/facade/types.js +3 -0
- package/dist/facade/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/ast-parser/go/index.d.ts +3 -0
- package/dist/tools/ast-parser/go/index.d.ts.map +1 -0
- package/dist/tools/ast-parser/go/index.js +6 -0
- package/dist/tools/ast-parser/go/index.js.map +1 -0
- package/dist/tools/ast-parser/go/parser.d.ts +56 -0
- package/dist/tools/ast-parser/go/parser.d.ts.map +1 -0
- package/dist/tools/ast-parser/go/parser.js +147 -0
- package/dist/tools/ast-parser/go/parser.js.map +1 -0
- package/dist/tools/ast-parser/go/schema-extractor.d.ts +103 -0
- package/dist/tools/ast-parser/go/schema-extractor.d.ts.map +1 -0
- package/dist/tools/ast-parser/go/schema-extractor.js +487 -0
- package/dist/tools/ast-parser/go/schema-extractor.js.map +1 -0
- package/dist/tools/ast-parser/go/semantic-normalizer.d.ts +51 -0
- package/dist/tools/ast-parser/go/semantic-normalizer.d.ts.map +1 -0
- package/dist/tools/ast-parser/go/semantic-normalizer.js +263 -0
- package/dist/tools/ast-parser/go/semantic-normalizer.js.map +1 -0
- package/dist/tools/ast-parser/go/types.d.ts +131 -0
- package/dist/tools/ast-parser/go/types.d.ts.map +1 -0
- package/dist/tools/ast-parser/go/types.js +3 -0
- package/dist/tools/ast-parser/go/types.js.map +1 -0
- package/dist/tools/ast-parser/markdown/index.d.ts +28 -0
- package/dist/tools/ast-parser/markdown/index.d.ts.map +1 -0
- package/dist/tools/ast-parser/markdown/index.js +31 -0
- package/dist/tools/ast-parser/markdown/index.js.map +1 -0
- package/dist/tools/ast-parser/markdown/parser.d.ts +271 -0
- package/dist/tools/ast-parser/markdown/parser.d.ts.map +1 -0
- package/dist/tools/ast-parser/markdown/parser.js +613 -0
- package/dist/tools/ast-parser/markdown/parser.js.map +1 -0
- package/dist/tools/ast-parser/markdown/types.d.ts +131 -0
- package/dist/tools/ast-parser/markdown/types.d.ts.map +1 -0
- package/dist/tools/ast-parser/markdown/types.js +3 -0
- package/dist/tools/ast-parser/markdown/types.js.map +1 -0
- package/dist/tools/env/index.d.ts +2 -0
- package/dist/tools/env/index.d.ts.map +1 -0
- package/dist/tools/env/index.js +6 -0
- package/dist/tools/env/index.js.map +1 -0
- package/dist/tools/env/load-env.d.ts +9 -0
- package/dist/tools/env/load-env.d.ts.map +1 -0
- package/dist/tools/env/load-env.js +39 -0
- package/dist/tools/env/load-env.js.map +1 -0
- package/dist/tools/line-pattern/index.d.ts +15 -0
- package/dist/tools/line-pattern/index.d.ts.map +1 -0
- package/dist/tools/line-pattern/index.js +25 -0
- package/dist/tools/line-pattern/index.js.map +1 -0
- package/dist/tools/line-pattern/line-pattern.d.ts +53 -0
- package/dist/tools/line-pattern/line-pattern.d.ts.map +1 -0
- package/dist/tools/line-pattern/line-pattern.js +88 -0
- package/dist/tools/line-pattern/line-pattern.js.map +1 -0
- package/dist/tools/line-pattern/segment.d.ts +24 -0
- package/dist/tools/line-pattern/segment.d.ts.map +1 -0
- package/dist/tools/line-pattern/segment.js +15 -0
- package/dist/tools/line-pattern/segment.js.map +1 -0
- package/dist/tools/line-pattern/segments.d.ts +43 -0
- package/dist/tools/line-pattern/segments.d.ts.map +1 -0
- package/dist/tools/line-pattern/segments.js +91 -0
- package/dist/tools/line-pattern/segments.js.map +1 -0
- package/dist/tools/llm/description-intent/format-spec.d.ts +3 -0
- package/dist/tools/llm/description-intent/format-spec.d.ts.map +1 -0
- package/dist/tools/llm/description-intent/format-spec.js +167 -0
- package/dist/tools/llm/description-intent/format-spec.js.map +1 -0
- package/dist/tools/llm/description-intent/index.d.ts +7 -0
- package/dist/tools/llm/description-intent/index.d.ts.map +1 -0
- package/dist/tools/llm/description-intent/index.js +15 -0
- package/dist/tools/llm/description-intent/index.js.map +1 -0
- package/dist/tools/llm/description-intent/intent-detector.d.ts +8 -0
- package/dist/tools/llm/description-intent/intent-detector.d.ts.map +1 -0
- package/dist/tools/llm/description-intent/intent-detector.js +103 -0
- package/dist/tools/llm/description-intent/intent-detector.js.map +1 -0
- package/dist/tools/llm/description-intent/normalizer.d.ts +12 -0
- package/dist/tools/llm/description-intent/normalizer.d.ts.map +1 -0
- package/dist/tools/llm/description-intent/normalizer.js +73 -0
- package/dist/tools/llm/description-intent/normalizer.js.map +1 -0
- package/dist/tools/llm/description-intent/slot-extractor.d.ts +3 -0
- package/dist/tools/llm/description-intent/slot-extractor.d.ts.map +1 -0
- package/dist/tools/llm/description-intent/slot-extractor.js +66 -0
- package/dist/tools/llm/description-intent/slot-extractor.js.map +1 -0
- package/dist/tools/llm/description-intent/types.d.ts +28 -0
- package/dist/tools/llm/description-intent/types.d.ts.map +1 -0
- package/dist/tools/llm/description-intent/types.js +19 -0
- package/dist/tools/llm/description-intent/types.js.map +1 -0
- package/dist/tools/llm/index.d.ts +16 -0
- package/dist/tools/llm/index.d.ts.map +1 -0
- package/dist/tools/llm/index.js +26 -0
- package/dist/tools/llm/index.js.map +1 -0
- package/dist/tools/llm/model.d.ts +3 -0
- package/dist/tools/llm/model.d.ts.map +1 -0
- package/dist/tools/llm/model.js +18 -0
- package/dist/tools/llm/model.js.map +1 -0
- package/dist/tools/llm/structured-caller.d.ts +86 -0
- package/dist/tools/llm/structured-caller.d.ts.map +1 -0
- package/dist/tools/llm/structured-caller.js +181 -0
- package/dist/tools/llm/structured-caller.js.map +1 -0
- package/dist/tools/node-pattern/index.d.ts +17 -0
- package/dist/tools/node-pattern/index.d.ts.map +1 -0
- package/dist/tools/node-pattern/index.js +36 -0
- package/dist/tools/node-pattern/index.js.map +1 -0
- package/dist/tools/node-pattern/matchers.d.ts +61 -0
- package/dist/tools/node-pattern/matchers.d.ts.map +1 -0
- package/dist/tools/node-pattern/matchers.js +154 -0
- package/dist/tools/node-pattern/matchers.js.map +1 -0
- package/dist/tools/node-pattern/node-matcher.d.ts +69 -0
- package/dist/tools/node-pattern/node-matcher.d.ts.map +1 -0
- package/dist/tools/node-pattern/node-matcher.js +122 -0
- package/dist/tools/node-pattern/node-matcher.js.map +1 -0
- package/dist/tools/node-pattern/node-pattern.d.ts +65 -0
- package/dist/tools/node-pattern/node-pattern.d.ts.map +1 -0
- package/dist/tools/node-pattern/node-pattern.js +129 -0
- package/dist/tools/node-pattern/node-pattern.js.map +1 -0
- package/dist/tools/section-check/index.d.ts +4 -0
- package/dist/tools/section-check/index.d.ts.map +1 -0
- package/dist/tools/section-check/index.js +10 -0
- package/dist/tools/section-check/index.js.map +1 -0
- package/dist/tools/section-check/section-check.d.ts +46 -0
- package/dist/tools/section-check/section-check.d.ts.map +1 -0
- package/dist/tools/section-check/section-check.js +264 -0
- package/dist/tools/section-check/section-check.js.map +1 -0
- package/dist/tools/section-check/types.d.ts +35 -0
- package/dist/tools/section-check/types.d.ts.map +1 -0
- package/dist/tools/section-check/types.js +23 -0
- package/dist/tools/section-check/types.js.map +1 -0
- package/dist/tools/text-grep/index.d.ts +10 -0
- package/dist/tools/text-grep/index.d.ts.map +1 -0
- package/dist/tools/text-grep/index.js +13 -0
- package/dist/tools/text-grep/index.js.map +1 -0
- package/dist/tools/text-grep/regex-grep.d.ts +92 -0
- package/dist/tools/text-grep/regex-grep.d.ts.map +1 -0
- package/dist/tools/text-grep/regex-grep.js +141 -0
- package/dist/tools/text-grep/regex-grep.js.map +1 -0
- package/dist/workflow/context/context.d.ts +13 -0
- package/dist/workflow/context/context.d.ts.map +1 -0
- package/dist/workflow/context/context.js +29 -0
- package/dist/workflow/context/context.js.map +1 -0
- package/dist/workflow/implement/resource-check/context-keys.d.ts +30 -0
- package/dist/workflow/implement/resource-check/context-keys.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/context-keys.js +33 -0
- package/dist/workflow/implement/resource-check/context-keys.js.map +1 -0
- package/dist/workflow/implement/resource-check/resource-check-workflow.d.ts +20 -0
- package/dist/workflow/implement/resource-check/resource-check-workflow.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/resource-check-workflow.js +325 -0
- package/dist/workflow/implement/resource-check/resource-check-workflow.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/index.d.ts +5 -0
- package/dist/workflow/implement/resource-check/rules/index.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/index.js +21 -0
- package/dist/workflow/implement/resource-check/rules/index.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.js +51 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/arguments/argument-section-format-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.js +60 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/attributes/attribute-section-format-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.d.ts +9 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.js +80 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/blank-line-between-blocks-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.js +42 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example/example-section-exists-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.js +34 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/example-section-exists-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.js +33 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter/frontmatter-check-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.js +33 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/frontmatter-check-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.js +34 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/h1-exists-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/index.d.ts +11 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/index.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/index.js +38 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/index.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.d.ts +15 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.js +77 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/line-length-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.d.ts +23 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.js +128 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.d.ts +9 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.js +19 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.d.ts +8 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.js +44 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.d.ts +9 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.js +80 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.d.ts +15 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.js +77 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.d.ts +23 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.js +128 -0
- package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.d.ts +11 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.js +145 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/argument-section-semantic-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.d.ts +11 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.js +145 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/arguments/argument-section-semantic-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.d.ts +9 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.js +83 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attribute-section-semantic-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.d.ts +9 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.js +83 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/attributes/attribute-section-semantic-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.d.ts +7 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.js +15 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/index.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.d.ts +9 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.js +96 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/section-existence-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.d.ts +9 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.js +109 -0
- package/dist/workflow/implement/resource-check/rules/markdown-semantic/total/section-existence-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.d.ts +19 -0
- package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.js +31 -0
- package/dist/workflow/implement/resource-check/rules/stage-placeholder-rule.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.d.ts +15 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.js +554 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/builder.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/index.d.ts +5 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/index.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/index.js +16 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/index.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/types.d.ts +94 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/types.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/types.js +42 -0
- package/dist/workflow/implement/resource-check/tools/doc-semantic/types.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.d.ts +4 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.js +103 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/builder.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/index.d.ts +3 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/index.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/index.js +6 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/index.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/types.d.ts +47 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/types.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/types.js +3 -0
- package/dist/workflow/implement/resource-check/tools/schema-semantic/types.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/index.d.ts +4 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/index.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/index.js +8 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/index.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.d.ts +108 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.js +498 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/schema-extractor.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.d.ts +51 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.js +271 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/semantic-normalizer.js.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/types.d.ts +133 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/types.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/types.js +3 -0
- package/dist/workflow/implement/resource-check/tools/terraform-schema/types.js.map +1 -0
- package/dist/workflow/implement/resource-check/types.d.ts +18 -0
- package/dist/workflow/implement/resource-check/types.d.ts.map +1 -0
- package/dist/workflow/implement/resource-check/types.js +107 -0
- package/dist/workflow/implement/resource-check/types.js.map +1 -0
- package/dist/workflow/types/rule/rule.d.ts +72 -0
- package/dist/workflow/types/rule/rule.d.ts.map +1 -0
- package/dist/workflow/types/rule/rule.js +110 -0
- package/dist/workflow/types/rule/rule.js.map +1 -0
- package/dist/workflow/workflow.d.ts +52 -0
- package/dist/workflow/workflow.d.ts.map +1 -0
- package/dist/workflow/workflow.js +121 -0
- package/dist/workflow/workflow.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Rule, RuleCheckResult } from "../../../../types/rule/rule";
|
|
2
|
+
import type { Context } from "../../../../context/context";
|
|
3
|
+
export declare class NumberFormatRule extends Rule {
|
|
4
|
+
private readonly parser;
|
|
5
|
+
constructor();
|
|
6
|
+
test(code: string, ast?: unknown, _parentCtx?: Context): Promise<RuleCheckResult[]>;
|
|
7
|
+
private buildSkipRanges;
|
|
8
|
+
private isInSkipRange;
|
|
9
|
+
/**
|
|
10
|
+
* Skip lines that are not prose: HTML anchors, blank lines,
|
|
11
|
+
* heading markers, code fence markers.
|
|
12
|
+
*/
|
|
13
|
+
private isNonProseLine;
|
|
14
|
+
/**
|
|
15
|
+
* Replace already-wrapped numbers with placeholder text
|
|
16
|
+
* so they don't trigger false positives.
|
|
17
|
+
*/
|
|
18
|
+
private maskWrappedNumbers;
|
|
19
|
+
private checkLine;
|
|
20
|
+
private hasThousandsSeparator;
|
|
21
|
+
private formatThousands;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=number-format-rule.d.ts.map
|
package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-format-rule.d.ts","sourceRoot":"","sources":["../../../../../../src/workflow/implement/resource-check/rules/markdown-format/number-format-rule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAiB,MAAM,6BAA6B,CAAC;AACnF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAoC3D,qBAAa,gBAAiB,SAAQ,IAAI;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;;IAMlC,IAAI,CACb,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,eAAe,EAAE,CAAC;IA+B7B,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAStB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,SAAS;IA6CjB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,eAAe;CAG1B"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberFormatRule = void 0;
|
|
4
|
+
const markdown_1 = require("../../../../../tools/ast-parser/markdown");
|
|
5
|
+
const rule_1 = require("../../../../types/rule/rule");
|
|
6
|
+
const META = {
|
|
7
|
+
name: "md-number-format",
|
|
8
|
+
description: "Numbers in prose must be wrapped with backticks or bold markers, " +
|
|
9
|
+
"and large numbers should use thousands separators",
|
|
10
|
+
messages: {
|
|
11
|
+
bareNumber: (line, num) => `Line ${line}: bare number "${num}" should be wrapped ` +
|
|
12
|
+
"with backticks (`) or bold (**)",
|
|
13
|
+
missingThousandsSep: (line, num, formatted) => `Line ${line}: number "${num}" should use thousands ` +
|
|
14
|
+
`separator format: "${formatted}"`,
|
|
15
|
+
summary: (count) => `${count} number formatting issue(s) found`,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Match numbers already wrapped in backticks or bold:
|
|
20
|
+
* `123` `65,535` **123** **65,535**
|
|
21
|
+
*/
|
|
22
|
+
const WRAPPED_NUMBER = /(?:`[^`]*\d[^`]*`|\*\*[^*]*\d[^*]*\*\*)/g;
|
|
23
|
+
/**
|
|
24
|
+
* Match bare numbers in text (integers only, not part of identifiers).
|
|
25
|
+
* Excludes numbers preceded/followed by word chars (e.g. "var123", "v2").
|
|
26
|
+
*/
|
|
27
|
+
const BARE_NUMBER = /(?<![`*\w])(\d[\d,]*)(?![`*\w])/g;
|
|
28
|
+
class NumberFormatRule extends rule_1.Rule {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(META, "markdown");
|
|
31
|
+
this.parser = new markdown_1.MarkdownParser();
|
|
32
|
+
}
|
|
33
|
+
async test(code, ast, _parentCtx) {
|
|
34
|
+
const lines = code.split(/\r?\n/);
|
|
35
|
+
const skipRanges = ast ? this.buildSkipRanges(ast) : [];
|
|
36
|
+
const violations = [];
|
|
37
|
+
for (let i = 0; i < lines.length; i++) {
|
|
38
|
+
const lineNum = i + 1;
|
|
39
|
+
if (this.isInSkipRange(lineNum, skipRanges))
|
|
40
|
+
continue;
|
|
41
|
+
const line = lines[i];
|
|
42
|
+
if (this.isNonProseLine(line))
|
|
43
|
+
continue;
|
|
44
|
+
const masked = this.maskWrappedNumbers(line);
|
|
45
|
+
this.checkLine(masked, line, lineNum, violations);
|
|
46
|
+
}
|
|
47
|
+
if (violations.length === 0) {
|
|
48
|
+
return [rule_1.RuleCheckResult.pass("All numbers are properly formatted")];
|
|
49
|
+
}
|
|
50
|
+
return [
|
|
51
|
+
new rule_1.RuleCheckResult(false, this.msg("summary", violations.length), "", "", violations),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
buildSkipRanges(doc) {
|
|
55
|
+
const ranges = [];
|
|
56
|
+
const codeBlocks = this.parser.getCodeBlocks(doc);
|
|
57
|
+
for (const cb of codeBlocks) {
|
|
58
|
+
const sr = cb.node.sourceRange;
|
|
59
|
+
if (sr)
|
|
60
|
+
ranges.push({ start: sr.start.line, end: sr.end.line });
|
|
61
|
+
}
|
|
62
|
+
const fm = this.parser.findFirst(doc, (n) => n.type === "frontmatter");
|
|
63
|
+
if (fm?.sourceRange) {
|
|
64
|
+
ranges.push({ start: fm.sourceRange.start.line, end: fm.sourceRange.end.line });
|
|
65
|
+
}
|
|
66
|
+
const headings = this.parser.getHeadings(doc);
|
|
67
|
+
for (const h of headings) {
|
|
68
|
+
const sr = h.node.sourceRange;
|
|
69
|
+
if (sr)
|
|
70
|
+
ranges.push({ start: sr.start.line, end: sr.end.line });
|
|
71
|
+
}
|
|
72
|
+
return ranges;
|
|
73
|
+
}
|
|
74
|
+
isInSkipRange(line, ranges) {
|
|
75
|
+
return ranges.some((r) => line >= r.start && line <= r.end);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Skip lines that are not prose: HTML anchors, blank lines,
|
|
79
|
+
* heading markers, code fence markers.
|
|
80
|
+
*/
|
|
81
|
+
isNonProseLine(line) {
|
|
82
|
+
const trimmed = line.trim();
|
|
83
|
+
if (!trimmed)
|
|
84
|
+
return true;
|
|
85
|
+
if (trimmed.startsWith("```"))
|
|
86
|
+
return true;
|
|
87
|
+
if (trimmed.startsWith("#"))
|
|
88
|
+
return true;
|
|
89
|
+
if (trimmed.startsWith("<a "))
|
|
90
|
+
return true;
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Replace already-wrapped numbers with placeholder text
|
|
95
|
+
* so they don't trigger false positives.
|
|
96
|
+
*/
|
|
97
|
+
maskWrappedNumbers(line) {
|
|
98
|
+
return line.replace(WRAPPED_NUMBER, (m) => "_".repeat(m.length));
|
|
99
|
+
}
|
|
100
|
+
checkLine(masked, original, lineNum, violations) {
|
|
101
|
+
let match;
|
|
102
|
+
BARE_NUMBER.lastIndex = 0;
|
|
103
|
+
while ((match = BARE_NUMBER.exec(masked)) !== null) {
|
|
104
|
+
const raw = match[1];
|
|
105
|
+
const digits = raw.replace(/,/g, "");
|
|
106
|
+
if (!/^\d+$/.test(digits))
|
|
107
|
+
continue;
|
|
108
|
+
if (digits.length === 1)
|
|
109
|
+
continue;
|
|
110
|
+
const numValue = parseInt(digits, 10);
|
|
111
|
+
if (numValue >= 1000 && !this.hasThousandsSeparator(raw)) {
|
|
112
|
+
const formatted = this.formatThousands(digits);
|
|
113
|
+
violations.push(new rule_1.RuleCheckResult(false, this.msg("missingThousandsSep", lineNum, raw, formatted), original, original.replace(raw, `\`${formatted}\``), [], rule_1.RuleCheckResult.fromLine(lineNum)));
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
violations.push(new rule_1.RuleCheckResult(false, this.msg("bareNumber", lineNum, raw), original, original, [], rule_1.RuleCheckResult.fromLine(lineNum)));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
hasThousandsSeparator(num) {
|
|
121
|
+
return /^\d{1,3}(,\d{3})+$/.test(num);
|
|
122
|
+
}
|
|
123
|
+
formatThousands(digits) {
|
|
124
|
+
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.NumberFormatRule = NumberFormatRule;
|
|
128
|
+
//# sourceMappingURL=number-format-rule.js.map
|
package/dist/workflow/implement/resource-check/rules/markdown-format/number-format-rule.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-format-rule.js","sourceRoot":"","sources":["../../../../../../src/workflow/implement/resource-check/rules/markdown-format/number-format-rule.ts"],"names":[],"mappings":";;;AACA,uEAA0E;AAC1E,sDAAmF;AAGnF,MAAM,IAAI,GAAa;IACnB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACP,mEAAmE;QACnE,mDAAmD;IACvD,QAAQ,EAAE;QACN,UAAU,EAAE,CAAC,IAAa,EAAE,GAAY,EAAE,EAAE,CACxC,QAAQ,IAAI,kBAAkB,GAAG,sBAAsB;YACvD,iCAAiC;QACrC,mBAAmB,EAAE,CAAC,IAAa,EAAE,GAAY,EAAE,SAAkB,EAAE,EAAE,CACrE,QAAQ,IAAI,aAAa,GAAG,yBAAyB;YACrD,sBAAsB,SAAS,GAAG;QACtC,OAAO,EAAE,CAAC,KAAc,EAAE,EAAE,CACxB,GAAG,KAAK,mCAAmC;KAClD;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,cAAc,GAAG,0CAA0C,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAOvD,MAAa,gBAAiB,SAAQ,WAAI;IAGtC;QACI,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAHX,WAAM,GAAG,IAAI,yBAAc,EAAE,CAAC;IAI/C,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,IAAY,EACZ,GAAa,EACb,UAAoB;QAEpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,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I,CACX,IAAI,sBAAe,CACf,KAAK,EACL,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,EACxD,QAAQ,EACR,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,SAAS,IAAI,CAAC,EACzC,EAAE,EACF,sBAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CACpC,CACJ,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,UAAU,CAAC,IAAI,CACX,IAAI,sBAAe,CACf,KAAK,EACL,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,EACpC,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,sBAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CACpC,CACJ,CAAC;YACN,CAAC;QACL,CAAC;IACL,CAAC;IAEO,qBAAqB,CAAC,GAAW;QACrC,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAEO,eAAe,CAAC,MAAc;QAClC,OAAO,MAAM,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IACxD,CAAC;CACJ;AA9ID,4CA8IC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CheckFailure } from "../../../../../../tools/section-check";
|
|
2
|
+
import { RuleCheckResult } from "../../../../../types/rule/rule";
|
|
3
|
+
interface SectionRuleResultOptions {
|
|
4
|
+
passMessage: string;
|
|
5
|
+
summaryMessage: (count: number) => string;
|
|
6
|
+
}
|
|
7
|
+
export declare function toSectionRuleResults(failures: CheckFailure[], options: SectionRuleResultOptions): RuleCheckResult[];
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=section-check-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-check-result.d.ts","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,UAAU,wBAAwB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C;AAED,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE,wBAAwB,GAClC,eAAe,EAAE,CAqBnB"}
|
package/dist/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toSectionRuleResults = toSectionRuleResults;
|
|
4
|
+
const rule_1 = require("../../../../../types/rule/rule");
|
|
5
|
+
function toSectionRuleResults(failures, options) {
|
|
6
|
+
if (failures.length === 0) {
|
|
7
|
+
return [rule_1.RuleCheckResult.pass(options.passMessage)];
|
|
8
|
+
}
|
|
9
|
+
const children = failures.map((failure) => {
|
|
10
|
+
const range = failure.line
|
|
11
|
+
? rule_1.RuleCheckResult.fromLine(failure.line)
|
|
12
|
+
: undefined;
|
|
13
|
+
return new rule_1.RuleCheckResult(false, failure.message, "", "", [], range);
|
|
14
|
+
});
|
|
15
|
+
return [
|
|
16
|
+
new rule_1.RuleCheckResult(false, options.summaryMessage(children.length), "", "", children),
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=section-check-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-check-result.js","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/shared/section-check-result.ts"],"names":[],"mappings":";;AAQA,oDAwBC;AA/BD,yDAAiE;AAOjE,SAAgB,oBAAoB,CAChC,QAAwB,EACxB,OAAiC;IAEjC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,sBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI;YACtB,CAAC,CAAC,sBAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;YACxC,CAAC,CAAC,SAAS,CAAC;QAChB,OAAO,IAAI,sBAAe,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,OAAO;QACH,IAAI,sBAAe,CACf,KAAK,EACL,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EACvC,EAAE,EACF,EAAE,EACF,QAAQ,CACX;KACJ,CAAC;AACN,CAAC"}
|
package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Rule, RuleCheckResult } from "../../../../../types/rule/rule";
|
|
2
|
+
import type { Context } from "../../../../../context/context";
|
|
3
|
+
export declare class H1ExistsRule extends Rule {
|
|
4
|
+
private readonly parser;
|
|
5
|
+
constructor();
|
|
6
|
+
test(code: string, ast?: unknown, _parentCtx?: Context): Promise<RuleCheckResult[]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=h1-exists-rule.d.ts.map
|
package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h1-exists-rule.d.ts","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAU9D,qBAAa,YAAa,SAAQ,IAAI;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;;IAMlC,IAAI,CACb,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,eAAe,EAAE,CAAC;CA8BhC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.H1ExistsRule = void 0;
|
|
4
|
+
const markdown_1 = require("../../../../../../tools/ast-parser/markdown");
|
|
5
|
+
const section_check_1 = require("../../../../../../tools/section-check");
|
|
6
|
+
const rule_1 = require("../../../../../types/rule/rule");
|
|
7
|
+
const META = {
|
|
8
|
+
name: "md-h1-exists",
|
|
9
|
+
description: "Document must contain at least one level-1 heading",
|
|
10
|
+
messages: {
|
|
11
|
+
missing: "Document must contain a level-1 heading (# Title)",
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
class H1ExistsRule extends rule_1.Rule {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(META, "markdown");
|
|
17
|
+
this.parser = new markdown_1.MarkdownParser();
|
|
18
|
+
}
|
|
19
|
+
async test(code, ast, _parentCtx) {
|
|
20
|
+
if (!ast) {
|
|
21
|
+
return [this.fail("missing", "")];
|
|
22
|
+
}
|
|
23
|
+
const doc = ast;
|
|
24
|
+
const failures = await (0, section_check_1.bodyCheck)()
|
|
25
|
+
.validate(({ nodes, startLine }) => {
|
|
26
|
+
const hasH1 = nodes.some((node) => node.type === "heading" && (node.level ?? 0) === 1);
|
|
27
|
+
if (hasH1)
|
|
28
|
+
return [];
|
|
29
|
+
return [{ message: this.msg("missing"), line: startLine }];
|
|
30
|
+
})
|
|
31
|
+
.run(doc, code);
|
|
32
|
+
if (failures.length === 0) {
|
|
33
|
+
const headings = this.parser.getHeadings(doc);
|
|
34
|
+
const h1 = headings.find((heading) => heading.level === 1);
|
|
35
|
+
return [
|
|
36
|
+
rule_1.RuleCheckResult.pass("Level-1 heading exists", h1?.node.sourceRange ?? undefined),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
const line = failures[0].line ?? 1;
|
|
40
|
+
return [this.fail("missing", "", undefined, rule_1.RuleCheckResult.fromLine(line))];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.H1ExistsRule = H1ExistsRule;
|
|
44
|
+
//# sourceMappingURL=h1-exists-rule.js.map
|
package/dist/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h1-exists-rule.js","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/title/h1-exists-rule.ts"],"names":[],"mappings":";;;AACA,0EAA6E;AAC7E,yEAAkE;AAClE,yDAAsF;AAGtF,MAAM,IAAI,GAAa;IACnB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,oDAAoD;IACjE,QAAQ,EAAE;QACN,OAAO,EAAE,mDAAmD;KAC/D;CACJ,CAAC;AAEF,MAAa,YAAa,SAAQ,WAAI;IAGlC;QACI,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAHX,WAAM,GAAG,IAAI,yBAAc,EAAE,CAAC;IAI/C,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,IAAY,EACZ,GAAa,EACb,UAAoB;QAEpB,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,GAAG,GAAG,GAAmB,CAAC;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAS,GAAE;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
export declare class BlankLineBetweenBlocksRule extends Rule {
|
|
4
|
+
constructor();
|
|
5
|
+
test(code: string, ast?: unknown, _parentCtx?: Context): Promise<RuleCheckResult[]>;
|
|
6
|
+
private shouldCheckBoundary;
|
|
7
|
+
private hasBlankLineBetween;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=blank-line-between-blocks-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blank-line-between-blocks-rule.d.ts","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAuB9D,qBAAa,0BAA2B,SAAQ,IAAI;;IAKnC,IAAI,CACb,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,eAAe,EAAE,CAAC;IAkD7B,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,mBAAmB;CAY9B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlankLineBetweenBlocksRule = void 0;
|
|
4
|
+
const rule_1 = require("../../../../../types/rule/rule");
|
|
5
|
+
const META = {
|
|
6
|
+
name: "md-blank-line-between-blocks",
|
|
7
|
+
description: "Top-level markdown blocks should be separated by a blank line",
|
|
8
|
+
messages: {
|
|
9
|
+
missing: (prevType, currType, line) => `Missing blank line between ${String(prevType)} and ${String(currType)} blocks ` +
|
|
10
|
+
`before line ${String(line)}.`,
|
|
11
|
+
summary: (count) => `${String(count)} block boundary issue(s) found`,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const BLOCK_TYPES_REQUIRING_SEPARATOR = new Set([
|
|
15
|
+
"heading",
|
|
16
|
+
"paragraph",
|
|
17
|
+
"list",
|
|
18
|
+
"code_block",
|
|
19
|
+
"block_quote",
|
|
20
|
+
"html_block",
|
|
21
|
+
]);
|
|
22
|
+
class BlankLineBetweenBlocksRule extends rule_1.Rule {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(META, "markdown");
|
|
25
|
+
}
|
|
26
|
+
async test(code, ast, _parentCtx) {
|
|
27
|
+
if (!ast) {
|
|
28
|
+
return [rule_1.RuleCheckResult.pass("AST unavailable, rule skipped")];
|
|
29
|
+
}
|
|
30
|
+
const doc = ast;
|
|
31
|
+
const blocks = doc.children.filter((n) => n.type !== "frontmatter");
|
|
32
|
+
const lines = code.split(/\r?\n/);
|
|
33
|
+
const violations = [];
|
|
34
|
+
for (let i = 1; i < blocks.length; i++) {
|
|
35
|
+
const prev = blocks[i - 1];
|
|
36
|
+
const curr = blocks[i];
|
|
37
|
+
if (!this.shouldCheckBoundary(prev, curr))
|
|
38
|
+
continue;
|
|
39
|
+
const prevEnd = prev.sourceRange?.end.line;
|
|
40
|
+
const currStart = curr.sourceRange?.start.line;
|
|
41
|
+
if (!prevEnd || !currStart || currStart <= prevEnd)
|
|
42
|
+
continue;
|
|
43
|
+
if (!this.hasBlankLineBetween(lines, prevEnd, currStart)) {
|
|
44
|
+
const line = currStart;
|
|
45
|
+
violations.push(this.fail("missing", lines[line - 1] ?? "", lines[line - 1] ?? "", rule_1.RuleCheckResult.fromLine(line), prev.type, curr.type, line));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (violations.length === 0) {
|
|
49
|
+
return [rule_1.RuleCheckResult.pass("All top-level block boundaries have blank lines")];
|
|
50
|
+
}
|
|
51
|
+
return [
|
|
52
|
+
new rule_1.RuleCheckResult(false, this.msg("summary", violations.length), "", "", violations),
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
shouldCheckBoundary(prev, curr) {
|
|
56
|
+
if (!BLOCK_TYPES_REQUIRING_SEPARATOR.has(prev.type))
|
|
57
|
+
return false;
|
|
58
|
+
if (!BLOCK_TYPES_REQUIRING_SEPARATOR.has(curr.type))
|
|
59
|
+
return false;
|
|
60
|
+
// Allow adjacent headings for intentionally empty sections.
|
|
61
|
+
if (prev.type === "heading" && curr.type === "heading") {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
hasBlankLineBetween(lines, prevEndLine, currStartLine) {
|
|
67
|
+
const start = prevEndLine + 1;
|
|
68
|
+
const end = currStartLine - 1;
|
|
69
|
+
if (start > end)
|
|
70
|
+
return false;
|
|
71
|
+
for (let line = start; line <= end; line++) {
|
|
72
|
+
if ((lines[line - 1] ?? "").trim() === "") {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.BlankLineBetweenBlocksRule = BlankLineBetweenBlocksRule;
|
|
80
|
+
//# sourceMappingURL=blank-line-between-blocks-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blank-line-between-blocks-rule.js","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/total/blank-line-between-blocks-rule.ts"],"names":[],"mappings":";;;AACA,yDAAsF;AAGtF,MAAM,IAAI,GAAa;IACnB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,+DAA+D;IAC5E,QAAQ,EAAE;QACN,OAAO,EAAE,CAAC,QAAiB,EAAE,QAAiB,EAAE,IAAa,EAAE,EAAE,CAC7D,8BAA8B,MAAM,CAAC,QAAQ,CAAC,QAAQ,MAAM,CAAC,QAAQ,CAAC,UAAU;YAChF,eAAe,MAAM,CAAC,IAAI,CAAC,GAAG;QAClC,OAAO,EAAE,CAAC,KAAc,EAAE,EAAE,CACxB,GAAG,MAAM,CAAC,KAAK,CAAC,gCAAgC;KACvD;CACJ,CAA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QAC9B,MAAM,GAAG,GAAG,aAAa,GAAG,CAAC,CAAC;QAC9B,IAAI,KAAK,GAAG,GAAG;YAAE,OAAO,KAAK,CAAC;QAE9B,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE,IAAI,IAAI,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBACxC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAnFD,gEAmFC"}
|
package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Rule, RuleCheckResult } from "../../../../../types/rule/rule";
|
|
2
|
+
import type { Context } from "../../../../../context/context";
|
|
3
|
+
export declare class LineLengthRule extends Rule {
|
|
4
|
+
private readonly parser;
|
|
5
|
+
constructor();
|
|
6
|
+
test(code: string, ast?: unknown, _parentCtx?: Context): Promise<RuleCheckResult[]>;
|
|
7
|
+
private buildSkipRanges;
|
|
8
|
+
private isInSkipRange;
|
|
9
|
+
/**
|
|
10
|
+
* Skip lines that cannot reasonably be wrapped:
|
|
11
|
+
* HTML anchor tags, pure URLs, markdown link definitions.
|
|
12
|
+
*/
|
|
13
|
+
private shouldSkipLine;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=line-length-rule.d.ts.map
|
package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-length-rule.d.ts","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAqB9D,qBAAa,cAAe,SAAQ,IAAI;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;;IAMlC,IAAI,CACb,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,eAAe,EAAE,CAAC;IAwC7B,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,cAAc;CAOzB"}
|
package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LineLengthRule = void 0;
|
|
4
|
+
const markdown_1 = require("../../../../../../tools/ast-parser/markdown");
|
|
5
|
+
const rule_1 = require("../../../../../types/rule/rule");
|
|
6
|
+
const MAX_LINE_LENGTH = 120;
|
|
7
|
+
const META = {
|
|
8
|
+
name: "md-line-length",
|
|
9
|
+
description: `Lines must not exceed ${MAX_LINE_LENGTH} columns; use soft line breaks to wrap`,
|
|
10
|
+
messages: {
|
|
11
|
+
tooLong: (line, length) => `Line ${line} exceeds ${MAX_LINE_LENGTH} columns (actual: ${length}). ` +
|
|
12
|
+
`Use a soft line break to wrap.`,
|
|
13
|
+
summary: (count) => `${count} line(s) exceed ${MAX_LINE_LENGTH} columns`,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
class LineLengthRule extends rule_1.Rule {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(META, "markdown");
|
|
19
|
+
this.parser = new markdown_1.MarkdownParser();
|
|
20
|
+
}
|
|
21
|
+
async test(code, ast, _parentCtx) {
|
|
22
|
+
const lines = code.split(/\r?\n/);
|
|
23
|
+
const skipRanges = ast ? this.buildSkipRanges(ast) : [];
|
|
24
|
+
const violations = [];
|
|
25
|
+
for (let i = 0; i < lines.length; i++) {
|
|
26
|
+
const lineNum = i + 1;
|
|
27
|
+
const line = lines[i];
|
|
28
|
+
if (line.length <= MAX_LINE_LENGTH)
|
|
29
|
+
continue;
|
|
30
|
+
if (this.isInSkipRange(lineNum, skipRanges))
|
|
31
|
+
continue;
|
|
32
|
+
if (this.shouldSkipLine(line))
|
|
33
|
+
continue;
|
|
34
|
+
violations.push(new rule_1.RuleCheckResult(false, this.msg("tooLong", lineNum, line.length), line, line, [], rule_1.RuleCheckResult.fromLine(lineNum)));
|
|
35
|
+
}
|
|
36
|
+
if (violations.length === 0) {
|
|
37
|
+
return [rule_1.RuleCheckResult.pass("All lines are within length limit")];
|
|
38
|
+
}
|
|
39
|
+
return [
|
|
40
|
+
new rule_1.RuleCheckResult(false, this.msg("summary", violations.length), "", "", violations),
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
buildSkipRanges(doc) {
|
|
44
|
+
const ranges = [];
|
|
45
|
+
const codeBlocks = this.parser.getCodeBlocks(doc);
|
|
46
|
+
for (const cb of codeBlocks) {
|
|
47
|
+
const sr = cb.node.sourceRange;
|
|
48
|
+
if (sr) {
|
|
49
|
+
ranges.push({ start: sr.start.line, end: sr.end.line });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const fm = this.parser.findFirst(doc, (n) => n.type === "frontmatter");
|
|
53
|
+
if (fm?.sourceRange) {
|
|
54
|
+
ranges.push({ start: fm.sourceRange.start.line, end: fm.sourceRange.end.line });
|
|
55
|
+
}
|
|
56
|
+
return ranges;
|
|
57
|
+
}
|
|
58
|
+
isInSkipRange(line, ranges) {
|
|
59
|
+
return ranges.some((r) => line >= r.start && line <= r.end);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Skip lines that cannot reasonably be wrapped:
|
|
63
|
+
* HTML anchor tags, pure URLs, markdown link definitions.
|
|
64
|
+
*/
|
|
65
|
+
shouldSkipLine(line) {
|
|
66
|
+
const trimmed = line.trim();
|
|
67
|
+
if (trimmed.startsWith("<a ") && trimmed.endsWith(">"))
|
|
68
|
+
return true;
|
|
69
|
+
if (/^\[.+\]:\s*https?:\/\//.test(trimmed))
|
|
70
|
+
return true;
|
|
71
|
+
if (/^https?:\/\/\S+$/.test(trimmed))
|
|
72
|
+
return true;
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.LineLengthRule = LineLengthRule;
|
|
77
|
+
//# sourceMappingURL=line-length-rule.js.map
|
package/dist/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-length-rule.js","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/total/line-length-rule.ts"],"names":[],"mappings":";;;AACA,0EAA6E;AAC7E,yDAAsF;AAGtF,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,IAAI,GAAa;IACnB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,yBAAyB,eAAe,wCAAwC;IAC7F,QAAQ,EAAE;QACN,OAAO,EAAE,CAAC,IAAa,EAAE,MAAe,EAAE,EAAE,CACxC,QAAQ,IAAI,YAAY,eAAe,qBAAqB,MAAM,KAAK;YACvE,gCAAgC;QACpC,OAAO,EAAE,CAAC,KAAc,EAAE,EAAE,CACxB,GAAG,KAAK,mBAAmB,eAAe,UAAU;KAC3D;CACJ,CAAC;AAOF,MAAa,cAAe,SAAQ,WAAI;IAGpC;QACI,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAHX,WAAM,GAAG,IAAI,yBAAc,EAAE,CAAC;IAI/C,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,IAAY,EACZ,GAAa,EACb,UAAoB;QAEpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,IA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AC;IACjB,CAAC;CACJ;AArFD,wCAqFC"}
|
package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Rule, RuleCheckResult } from "../../../../../types/rule/rule";
|
|
2
|
+
import type { Context } from "../../../../../context/context";
|
|
3
|
+
export declare class NumberFormatRule extends Rule {
|
|
4
|
+
private readonly parser;
|
|
5
|
+
constructor();
|
|
6
|
+
test(code: string, ast?: unknown, _parentCtx?: Context): Promise<RuleCheckResult[]>;
|
|
7
|
+
private buildSkipRanges;
|
|
8
|
+
private isInSkipRange;
|
|
9
|
+
/**
|
|
10
|
+
* Skip lines that are not prose: HTML anchors, blank lines,
|
|
11
|
+
* heading markers, code fence markers.
|
|
12
|
+
*/
|
|
13
|
+
private isNonProseLine;
|
|
14
|
+
/**
|
|
15
|
+
* Replace already-wrapped numbers with placeholder text
|
|
16
|
+
* so they don't trigger false positives.
|
|
17
|
+
*/
|
|
18
|
+
private maskWrappedNumbers;
|
|
19
|
+
private checkLine;
|
|
20
|
+
private hasThousandsSeparator;
|
|
21
|
+
private formatThousands;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=number-format-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-format-rule.d.ts","sourceRoot":"","sources":["../../../../../../../src/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAoC9D,qBAAa,gBAAiB,SAAQ,IAAI;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;;IAMlC,IAAI,CACb,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,eAAe,EAAE,CAAC;IA+B7B,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAStB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,SAAS;IA6CjB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,eAAe;CAG1B"}
|
package/dist/workflow/implement/resource-check/rules/markdown-format/total/number-format-rule.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberFormatRule = void 0;
|
|
4
|
+
const markdown_1 = require("../../../../../../tools/ast-parser/markdown");
|
|
5
|
+
const rule_1 = require("../../../../../types/rule/rule");
|
|
6
|
+
const META = {
|
|
7
|
+
name: "md-number-format",
|
|
8
|
+
description: "Numbers in prose must be wrapped with backticks or bold markers, " +
|
|
9
|
+
"and large numbers should use thousands separators",
|
|
10
|
+
messages: {
|
|
11
|
+
bareNumber: (line, num) => `Line ${line}: bare number "${num}" should be wrapped ` +
|
|
12
|
+
"with backticks (`) or bold (**)",
|
|
13
|
+
missingThousandsSep: (line, num, formatted) => `Line ${line}: number "${num}" should use thousands ` +
|
|
14
|
+
`separator format: "${formatted}"`,
|
|
15
|
+
summary: (count) => `${count} number formatting issue(s) found`,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Match numbers already wrapped in backticks or bold:
|
|
20
|
+
* `123` `65,535` **123** **65,535**
|
|
21
|
+
*/
|
|
22
|
+
const WRAPPED_NUMBER = /(?:`[^`]*\d[^`]*`|\*\*[^*]*\d[^*]*\*\*)/g;
|
|
23
|
+
/**
|
|
24
|
+
* Match bare numbers in text (integers only, not part of identifiers).
|
|
25
|
+
* Excludes numbers preceded/followed by word chars (e.g. "var123", "v2").
|
|
26
|
+
*/
|
|
27
|
+
const BARE_NUMBER = /(?<![`*\w])(\d[\d,]*)(?![`*\w])/g;
|
|
28
|
+
class NumberFormatRule extends rule_1.Rule {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(META, "markdown");
|
|
31
|
+
this.parser = new markdown_1.MarkdownParser();
|
|
32
|
+
}
|
|
33
|
+
async test(code, ast, _parentCtx) {
|
|
34
|
+
const lines = code.split(/\r?\n/);
|
|
35
|
+
const skipRanges = ast ? this.buildSkipRanges(ast) : [];
|
|
36
|
+
const violations = [];
|
|
37
|
+
for (let i = 0; i < lines.length; i++) {
|
|
38
|
+
const lineNum = i + 1;
|
|
39
|
+
if (this.isInSkipRange(lineNum, skipRanges))
|
|
40
|
+
continue;
|
|
41
|
+
const line = lines[i];
|
|
42
|
+
if (this.isNonProseLine(line))
|
|
43
|
+
continue;
|
|
44
|
+
const masked = this.maskWrappedNumbers(line);
|
|
45
|
+
this.checkLine(masked, line, lineNum, violations);
|
|
46
|
+
}
|
|
47
|
+
if (violations.length === 0) {
|
|
48
|
+
return [rule_1.RuleCheckResult.pass("All numbers are properly formatted")];
|
|
49
|
+
}
|
|
50
|
+
return [
|
|
51
|
+
new rule_1.RuleCheckResult(false, this.msg("summary", violations.length), "", "", violations),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
buildSkipRanges(doc) {
|
|
55
|
+
const ranges = [];
|
|
56
|
+
const codeBlocks = this.parser.getCodeBlocks(doc);
|
|
57
|
+
for (const cb of codeBlocks) {
|
|
58
|
+
const sr = cb.node.sourceRange;
|
|
59
|
+
if (sr)
|
|
60
|
+
ranges.push({ start: sr.start.line, end: sr.end.line });
|
|
61
|
+
}
|
|
62
|
+
const fm = this.parser.findFirst(doc, (n) => n.type === "frontmatter");
|
|
63
|
+
if (fm?.sourceRange) {
|
|
64
|
+
ranges.push({ start: fm.sourceRange.start.line, end: fm.sourceRange.end.line });
|
|
65
|
+
}
|
|
66
|
+
const headings = this.parser.getHeadings(doc);
|
|
67
|
+
for (const h of headings) {
|
|
68
|
+
const sr = h.node.sourceRange;
|
|
69
|
+
if (sr)
|
|
70
|
+
ranges.push({ start: sr.start.line, end: sr.end.line });
|
|
71
|
+
}
|
|
72
|
+
return ranges;
|
|
73
|
+
}
|
|
74
|
+
isInSkipRange(line, ranges) {
|
|
75
|
+
return ranges.some((r) => line >= r.start && line <= r.end);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Skip lines that are not prose: HTML anchors, blank lines,
|
|
79
|
+
* heading markers, code fence markers.
|
|
80
|
+
*/
|
|
81
|
+
isNonProseLine(line) {
|
|
82
|
+
const trimmed = line.trim();
|
|
83
|
+
if (!trimmed)
|
|
84
|
+
return true;
|
|
85
|
+
if (trimmed.startsWith("```"))
|
|
86
|
+
return true;
|
|
87
|
+
if (trimmed.startsWith("#"))
|
|
88
|
+
return true;
|
|
89
|
+
if (trimmed.startsWith("<a "))
|
|
90
|
+
return true;
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Replace already-wrapped numbers with placeholder text
|
|
95
|
+
* so they don't trigger false positives.
|
|
96
|
+
*/
|
|
97
|
+
maskWrappedNumbers(line) {
|
|
98
|
+
return line.replace(WRAPPED_NUMBER, (m) => "_".repeat(m.length));
|
|
99
|
+
}
|
|
100
|
+
checkLine(masked, original, lineNum, violations) {
|
|
101
|
+
let match;
|
|
102
|
+
BARE_NUMBER.lastIndex = 0;
|
|
103
|
+
while ((match = BARE_NUMBER.exec(masked)) !== null) {
|
|
104
|
+
const raw = match[1];
|
|
105
|
+
const digits = raw.replace(/,/g, "");
|
|
106
|
+
if (!/^\d+$/.test(digits))
|
|
107
|
+
continue;
|
|
108
|
+
if (digits.length === 1)
|
|
109
|
+
continue;
|
|
110
|
+
const numValue = parseInt(digits, 10);
|
|
111
|
+
if (numValue >= 1000 && !this.hasThousandsSeparator(raw)) {
|
|
112
|
+
const formatted = this.formatThousands(digits);
|
|
113
|
+
violations.push(new rule_1.RuleCheckResult(false, this.msg("missingThousandsSep", lineNum, raw, formatted), original, original.replace(raw, `\`${formatted}\``), [], rule_1.RuleCheckResult.fromLine(lineNum)));
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
violations.push(new rule_1.RuleCheckResult(false, this.msg("bareNumber", lineNum, raw), original, original, [], rule_1.RuleCheckResult.fromLine(lineNum)));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
hasThousandsSeparator(num) {
|
|
121
|
+
return /^\d{1,3}(,\d{3})+$/.test(num);
|
|
122
|
+
}
|
|
123
|
+
formatThousands(digits) {
|
|
124
|
+
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.NumberFormatRule = NumberFormatRule;
|
|
128
|
+
//# sourceMappingURL=number-format-rule.js.map
|