@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,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SectionCheck = void 0;
|
|
4
|
+
exports.sectionCheck = sectionCheck;
|
|
5
|
+
exports.bodyCheck = bodyCheck;
|
|
6
|
+
const markdown_1 = require("../ast-parser/markdown");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
class SectionCheck {
|
|
9
|
+
constructor(target) {
|
|
10
|
+
this.parser = new markdown_1.MarkdownParser();
|
|
11
|
+
this.steps = [];
|
|
12
|
+
this.target = target;
|
|
13
|
+
}
|
|
14
|
+
structure(pattern) {
|
|
15
|
+
this.steps.push({ kind: "structure", pattern });
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
introLine(expected) {
|
|
19
|
+
this.steps.push({ kind: "introLine", expected });
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
taggedTextEquals(tag, expected, options) {
|
|
23
|
+
this.steps.push({
|
|
24
|
+
kind: "taggedTextEquals",
|
|
25
|
+
tag,
|
|
26
|
+
expected,
|
|
27
|
+
normalize: options?.normalize,
|
|
28
|
+
});
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
eachBulletItem(check, options) {
|
|
32
|
+
this.steps.push({
|
|
33
|
+
kind: "eachBulletItem",
|
|
34
|
+
check,
|
|
35
|
+
includeNestedLists: options?.includeNestedLists ?? false,
|
|
36
|
+
});
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
requireBulletList(options) {
|
|
40
|
+
this.steps.push({
|
|
41
|
+
kind: "requireBulletList",
|
|
42
|
+
includeNestedLists: options?.includeNestedLists ?? false,
|
|
43
|
+
message: options?.message,
|
|
44
|
+
});
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
eachBulletItemAsync(check, options) {
|
|
48
|
+
this.steps.push({
|
|
49
|
+
kind: "eachBulletItemAsync",
|
|
50
|
+
check,
|
|
51
|
+
includeNestedLists: options?.includeNestedLists ?? false,
|
|
52
|
+
});
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
validate(check) {
|
|
56
|
+
this.steps.push({ kind: "validate", check });
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
async run(doc, code) {
|
|
60
|
+
const extracted = this.extractSection(doc, code);
|
|
61
|
+
if (!extracted)
|
|
62
|
+
return [];
|
|
63
|
+
const failures = [];
|
|
64
|
+
let structureMatch = null;
|
|
65
|
+
for (const step of this.steps) {
|
|
66
|
+
if (step.kind === "structure") {
|
|
67
|
+
const result = step.pattern.match(extracted.nodes);
|
|
68
|
+
if (!result.ok) {
|
|
69
|
+
const detail = step.pattern.describeFailure(extracted.nodes) ?? "unknown mismatch";
|
|
70
|
+
failures.push({
|
|
71
|
+
message: `${this.targetDisplay()} structure mismatch: ${detail}. ` +
|
|
72
|
+
`Expected: ${step.pattern.toDisplayFormat()}`,
|
|
73
|
+
line: extracted.startLine,
|
|
74
|
+
});
|
|
75
|
+
return failures;
|
|
76
|
+
}
|
|
77
|
+
structureMatch = result.value;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (step.kind === "introLine") {
|
|
81
|
+
const firstNonEmpty = extracted.lines.find((line) => line.trim().length > 0);
|
|
82
|
+
if (firstNonEmpty && firstNonEmpty.trim() !== step.expected) {
|
|
83
|
+
failures.push({
|
|
84
|
+
message: `${this.targetDisplay()} must start with "${step.expected}".`,
|
|
85
|
+
line: extracted.startLine,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (step.kind === "taggedTextEquals") {
|
|
91
|
+
const tagged = structureMatch?.tagged[step.tag] ?? [];
|
|
92
|
+
const actual = tagged.length > 0
|
|
93
|
+
? this.parser.getTextContent(tagged[0])
|
|
94
|
+
: "";
|
|
95
|
+
const normalize = step.normalize;
|
|
96
|
+
const normalizedActual = normalize ? normalize(actual) : actual;
|
|
97
|
+
const normalizedExpected = normalize
|
|
98
|
+
? normalize(step.expected)
|
|
99
|
+
: step.expected;
|
|
100
|
+
if (normalizedActual !== normalizedExpected) {
|
|
101
|
+
failures.push({
|
|
102
|
+
message: `Tagged "${step.tag}" text mismatch. ` +
|
|
103
|
+
`Expected "${step.expected}", got "${actual}".`,
|
|
104
|
+
line: tagged[0]?.sourceRange?.start.line ?? extracted.startLine,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (step.kind === "eachBulletItem") {
|
|
110
|
+
const bulletItems = this.resolveBulletItems(extracted.nodes, structureMatch?.tagged["bullets"] ?? [], step.includeNestedLists);
|
|
111
|
+
for (const item of bulletItems) {
|
|
112
|
+
const bullet = this.parser.getItemBulletLine(code, item);
|
|
113
|
+
if (!bullet)
|
|
114
|
+
continue;
|
|
115
|
+
const firstLine = new types_1.BulletLine(bullet.text, bullet.startLine);
|
|
116
|
+
const ok = step.check(firstLine);
|
|
117
|
+
if (ok)
|
|
118
|
+
continue;
|
|
119
|
+
const pattern = firstLine.getLastPattern();
|
|
120
|
+
failures.push({
|
|
121
|
+
message: pattern
|
|
122
|
+
? `Invalid ${this.targetDisplay()} bullet format at line ${firstLine.startLine}. ` +
|
|
123
|
+
`Expected: ${pattern.toDisplayFormat()}`
|
|
124
|
+
: `Invalid ${this.targetDisplay()} bullet format at line ${firstLine.startLine}.`,
|
|
125
|
+
line: firstLine.startLine,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (step.kind === "requireBulletList") {
|
|
131
|
+
const listNodes = this.resolveListNodes(structureMatch?.tagged["bullets"]?.length
|
|
132
|
+
? structureMatch.tagged["bullets"]
|
|
133
|
+
: extracted.nodes, step.includeNestedLists);
|
|
134
|
+
if (listNodes.length === 0) {
|
|
135
|
+
failures.push({
|
|
136
|
+
message: step.message ??
|
|
137
|
+
`${this.targetDisplay()} exists but does not contain a bullet list.`,
|
|
138
|
+
line: extracted.startLine,
|
|
139
|
+
});
|
|
140
|
+
return failures;
|
|
141
|
+
}
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (step.kind === "eachBulletItemAsync") {
|
|
145
|
+
const bulletItems = this.resolveBulletItems(extracted.nodes, structureMatch?.tagged["bullets"] ?? [], step.includeNestedLists);
|
|
146
|
+
for (const node of bulletItems) {
|
|
147
|
+
const item = this.buildBulletItem(code, node);
|
|
148
|
+
if (!item)
|
|
149
|
+
continue;
|
|
150
|
+
const failure = await step.check(item);
|
|
151
|
+
if (failure)
|
|
152
|
+
failures.push(failure);
|
|
153
|
+
}
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const customFailures = await step.check({
|
|
157
|
+
nodes: extracted.nodes,
|
|
158
|
+
lines: extracted.lines,
|
|
159
|
+
startLine: extracted.startLine,
|
|
160
|
+
});
|
|
161
|
+
failures.push(...customFailures);
|
|
162
|
+
}
|
|
163
|
+
return failures;
|
|
164
|
+
}
|
|
165
|
+
extractSection(doc, code) {
|
|
166
|
+
if (this.target.kind === "named") {
|
|
167
|
+
const nodes = this.parser.getSection(doc, this.target.level, this.target.title);
|
|
168
|
+
if (!nodes)
|
|
169
|
+
return null;
|
|
170
|
+
const text = this.parser.getSectionText(code, this.target.level, this.target.title);
|
|
171
|
+
const startLine = text?.startLine ??
|
|
172
|
+
nodes[0]?.sourceRange?.start.line ??
|
|
173
|
+
1;
|
|
174
|
+
return {
|
|
175
|
+
nodes,
|
|
176
|
+
lines: text?.lines ?? [],
|
|
177
|
+
startLine,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
const nodes = this.parser.getBodyChildren(doc);
|
|
181
|
+
const bodyText = this.extractBodyText(code, nodes);
|
|
182
|
+
return {
|
|
183
|
+
nodes,
|
|
184
|
+
lines: bodyText?.lines ?? [],
|
|
185
|
+
startLine: bodyText?.startLine ?? (nodes[0]?.sourceRange?.start.line ?? 1),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
extractBodyText(code, body) {
|
|
189
|
+
const firstNode = body[0];
|
|
190
|
+
if (!firstNode?.sourceRange)
|
|
191
|
+
return null;
|
|
192
|
+
const allLines = code.split(/\r?\n/);
|
|
193
|
+
const contentStart = firstNode.sourceRange.start.line;
|
|
194
|
+
let endLine = allLines.length;
|
|
195
|
+
for (let i = 1; i < body.length; i++) {
|
|
196
|
+
const node = body[i];
|
|
197
|
+
if (node.type === "heading" && node.sourceRange) {
|
|
198
|
+
endLine = node.sourceRange.start.line - 1;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
lines: allLines.slice(contentStart, endLine),
|
|
204
|
+
startLine: contentStart + 1,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
resolveBulletItems(sectionNodes, taggedBullets, includeNestedLists) {
|
|
208
|
+
const listNodes = this.resolveListNodes(taggedBullets.length > 0 ? taggedBullets : sectionNodes, includeNestedLists);
|
|
209
|
+
return this.parser.getBulletItems(listNodes);
|
|
210
|
+
}
|
|
211
|
+
resolveListNodes(nodes, includeNestedLists) {
|
|
212
|
+
if (!includeNestedLists) {
|
|
213
|
+
return nodes.filter((n) => n.type === "list");
|
|
214
|
+
}
|
|
215
|
+
const listNodes = [];
|
|
216
|
+
const seen = new Set();
|
|
217
|
+
const walk = (node) => {
|
|
218
|
+
if (node.type === "list" && !seen.has(node)) {
|
|
219
|
+
seen.add(node);
|
|
220
|
+
listNodes.push(node);
|
|
221
|
+
}
|
|
222
|
+
for (const child of node.children) {
|
|
223
|
+
walk(child);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
for (const node of nodes) {
|
|
227
|
+
walk(node);
|
|
228
|
+
}
|
|
229
|
+
return listNodes;
|
|
230
|
+
}
|
|
231
|
+
buildBulletItem(code, node) {
|
|
232
|
+
const bullet = this.parser.getItemBulletLine(code, node);
|
|
233
|
+
if (!bullet)
|
|
234
|
+
return null;
|
|
235
|
+
const logical = this.parser.getLogicalLines(code, node);
|
|
236
|
+
const logicalLines = logical?.lines ?? [];
|
|
237
|
+
const descriptionLines = logicalLines.slice(1);
|
|
238
|
+
const argNameMatch = bullet.text.match(/`([^`]+)`/);
|
|
239
|
+
const argName = argNameMatch ? argNameMatch[1] : "unknown";
|
|
240
|
+
return {
|
|
241
|
+
firstLine: new types_1.BulletLine(bullet.text, bullet.startLine),
|
|
242
|
+
argName,
|
|
243
|
+
descriptionLines,
|
|
244
|
+
descriptionText: descriptionLines.join("\n"),
|
|
245
|
+
node,
|
|
246
|
+
startLine: node.sourceRange?.start.line ?? bullet.startLine,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
targetDisplay() {
|
|
250
|
+
return this.target.kind === "named"
|
|
251
|
+
? `${this.target.title} section`
|
|
252
|
+
: "Body";
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
exports.SectionCheck = SectionCheck;
|
|
256
|
+
/** Target a named section (e.g. "## Argument Reference"). */
|
|
257
|
+
function sectionCheck(title, level) {
|
|
258
|
+
return new SectionCheck({ kind: "named", title, level });
|
|
259
|
+
}
|
|
260
|
+
/** Target the document body (H1 area, excluding frontmatter). */
|
|
261
|
+
function bodyCheck() {
|
|
262
|
+
return new SectionCheck({ kind: "body" });
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=section-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-check.js","sourceRoot":"","sources":["../../../src/tools/section-check/section-check.ts"],"names":[],"mappings":";;;AA6XA,oCAEC;AAGD,8BAEC;AApYD,qDAGgC;AAGhC,mCAAqC;AAqCrC,MAAa,YAAY;IAKrB,YAAmB,MAAqB;QAJvB,WAAM,GAAG,IAAI,yBAAc,EAAE,CAAC;QAE9B,UAAK,GAAW,EAAE,CAAC;QAGhC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEM,SAAS,CAAC,OAAoB;QACjC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,SAAS,CAAC,QAAgB;QAC7B,IAAI,CAAC,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AAI,IAAI,MAAM,CAAC,SAAS;SAC9D,CAAC;IACN,CAAC;IAEO,aAAa;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;YAC/B,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,UAAU;YAChC,CAAC,CAAC,MAAM,CAAC;IACjB,CAAC;CACJ;AA/UD,oCA+UC;AAED,6DAA6D;AAC7D,SAAgB,YAAY,CAAC,KAAa,EAAE,KAAa;IACrD,OAAO,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,iEAAiE;AACjE,SAAgB,SAAS;IACrB,OAAO,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LinePattern } from "../line-pattern";
|
|
2
|
+
import type { MarkdownNode } from "../ast-parser/markdown";
|
|
3
|
+
/** Returned by SectionCheck.run(). */
|
|
4
|
+
export interface CheckFailure {
|
|
5
|
+
message: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class BulletLine {
|
|
9
|
+
readonly text: string;
|
|
10
|
+
readonly startLine: number;
|
|
11
|
+
private lastPattern;
|
|
12
|
+
constructor(text: string, startLine: number);
|
|
13
|
+
/**
|
|
14
|
+
* Record the pattern used by this check so the chain can produce
|
|
15
|
+
* a useful default error message if the caller just returns false.
|
|
16
|
+
*/
|
|
17
|
+
matches(pattern: LinePattern): boolean;
|
|
18
|
+
getLastPattern(): LinePattern | null;
|
|
19
|
+
}
|
|
20
|
+
/** Passed to eachBulletItemAsync callback. */
|
|
21
|
+
export interface BulletItem {
|
|
22
|
+
readonly firstLine: BulletLine;
|
|
23
|
+
readonly argName: string;
|
|
24
|
+
readonly descriptionLines: string[];
|
|
25
|
+
readonly descriptionText: string;
|
|
26
|
+
readonly node: MarkdownNode;
|
|
27
|
+
readonly startLine: number;
|
|
28
|
+
}
|
|
29
|
+
/** Passed to validate callback. */
|
|
30
|
+
export interface SectionData {
|
|
31
|
+
readonly nodes: MarkdownNode[];
|
|
32
|
+
readonly lines: string[];
|
|
33
|
+
readonly startLine: number;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/section-check/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,sCAAsC;AACtC,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,UAAU;IACnB,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,OAAO,CAAC,WAAW,CAA4B;gBAE5B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKlD;;;OAGG;IACI,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAKtC,cAAc,IAAI,WAAW,GAAG,IAAI;CAG9C;AAED,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED,mCAAmC;AACnC,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulletLine = void 0;
|
|
4
|
+
class BulletLine {
|
|
5
|
+
constructor(text, startLine) {
|
|
6
|
+
this.lastPattern = null;
|
|
7
|
+
this.text = text;
|
|
8
|
+
this.startLine = startLine;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Record the pattern used by this check so the chain can produce
|
|
12
|
+
* a useful default error message if the caller just returns false.
|
|
13
|
+
*/
|
|
14
|
+
matches(pattern) {
|
|
15
|
+
this.lastPattern = pattern;
|
|
16
|
+
return pattern.test(this.text);
|
|
17
|
+
}
|
|
18
|
+
getLastPattern() {
|
|
19
|
+
return this.lastPattern;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.BulletLine = BulletLine;
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tools/section-check/types.ts"],"names":[],"mappings":";;;AASA,MAAa,UAAU;IAKnB,YAAmB,IAAY,EAAE,SAAiB;QAF1C,gBAAW,GAAuB,IAAI,CAAC;QAG3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,OAAoB;QAC/B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAEM,cAAc;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;CACJ;AAtBD,gCAsBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Grep Module
|
|
3
|
+
*
|
|
4
|
+
* Provides regex-based text search tools for code and document analysis.
|
|
5
|
+
*
|
|
6
|
+
* @module tools/text-grep
|
|
7
|
+
*/
|
|
8
|
+
export { RegexGrep } from "./regex-grep";
|
|
9
|
+
export type { RegexMatch, RegexGrepOptions } from "./regex-grep";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/text-grep/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Text Grep Module
|
|
4
|
+
*
|
|
5
|
+
* Provides regex-based text search tools for code and document analysis.
|
|
6
|
+
*
|
|
7
|
+
* @module tools/text-grep
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RegexGrep = void 0;
|
|
11
|
+
var regex_grep_1 = require("./regex-grep");
|
|
12
|
+
Object.defineProperty(exports, "RegexGrep", { enumerable: true, get: function () { return regex_grep_1.RegexGrep; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/text-grep/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2CAAyC;AAAhC,uGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex-based text search result
|
|
3
|
+
*/
|
|
4
|
+
export interface RegexMatch {
|
|
5
|
+
/** Matched full text */
|
|
6
|
+
match: string;
|
|
7
|
+
/** 0-based line number */
|
|
8
|
+
line: number;
|
|
9
|
+
/** 0-based column offset in the line */
|
|
10
|
+
column: number;
|
|
11
|
+
/** Capture groups (index 0 is full match) */
|
|
12
|
+
groups: string[];
|
|
13
|
+
/** Start index in the full text */
|
|
14
|
+
index: number;
|
|
15
|
+
/** End index in the full text */
|
|
16
|
+
endIndex: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for regex search
|
|
20
|
+
*/
|
|
21
|
+
export interface RegexGrepOptions {
|
|
22
|
+
/** Regex flags: g (global), i (case insensitive), m (multiline), etc. */
|
|
23
|
+
flags?: string;
|
|
24
|
+
/** Maximum number of matches to return (default: unlimited) */
|
|
25
|
+
maxMatches?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Regex-based text search tool
|
|
29
|
+
*
|
|
30
|
+
* Searches text content using regular expressions and returns matches with
|
|
31
|
+
* line numbers, column positions, and capture groups.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { RegexGrep } from "@code-check/core";
|
|
36
|
+
*
|
|
37
|
+
* const grep = new RegexGrep();
|
|
38
|
+
* const text = "Hello world\nfoo bar\nworld hello";
|
|
39
|
+
* const matches = grep.search(text, /world/gi);
|
|
40
|
+
* // [{ match: "world", line: 0, column: 6, groups: ["world"], ... }, ...]
|
|
41
|
+
*
|
|
42
|
+
* // With capture groups
|
|
43
|
+
* const emailMatches = grep.search(text, /(\w+)@(\w+\.\w+)/g);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class RegexGrep {
|
|
47
|
+
/**
|
|
48
|
+
* Search text with a regex pattern
|
|
49
|
+
*
|
|
50
|
+
* @param text - Text content to search
|
|
51
|
+
* @param pattern - RegExp or pattern string
|
|
52
|
+
* @param options - Search options
|
|
53
|
+
* @returns Array of matches, or null if pattern is invalid
|
|
54
|
+
*/
|
|
55
|
+
search(text: string, pattern: RegExp | string, options?: RegexGrepOptions): RegexMatch[] | null;
|
|
56
|
+
/**
|
|
57
|
+
* Search text and return only the first match
|
|
58
|
+
*
|
|
59
|
+
* @param text - Text content to search
|
|
60
|
+
* @param pattern - RegExp or pattern string
|
|
61
|
+
* @param options - Search options (flags)
|
|
62
|
+
* @returns First match or null
|
|
63
|
+
*/
|
|
64
|
+
searchFirst(text: string, pattern: RegExp | string, options?: RegexGrepOptions): RegexMatch | null;
|
|
65
|
+
/**
|
|
66
|
+
* Check if text contains any match for the pattern
|
|
67
|
+
*
|
|
68
|
+
* @param text - Text content to search
|
|
69
|
+
* @param pattern - RegExp or pattern string
|
|
70
|
+
* @param options - Search options (flags)
|
|
71
|
+
* @returns True if at least one match exists
|
|
72
|
+
*/
|
|
73
|
+
test(text: string, pattern: RegExp | string, options?: RegexGrepOptions): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Search multiple files and return matches with file path
|
|
76
|
+
*
|
|
77
|
+
* @param files - Map of file path to content
|
|
78
|
+
* @param pattern - RegExp or pattern string
|
|
79
|
+
* @param options - Search options
|
|
80
|
+
* @returns Map of file path to matches
|
|
81
|
+
*/
|
|
82
|
+
searchFiles(files: Map<string, string> | Record<string, string>, pattern: RegExp | string, options?: RegexGrepOptions): Map<string, RegexMatch[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Build line start offsets for index-to-line/column conversion
|
|
85
|
+
*/
|
|
86
|
+
private buildLineOffsets;
|
|
87
|
+
/**
|
|
88
|
+
* Convert character index to 0-based line and column
|
|
89
|
+
*/
|
|
90
|
+
private indexToLineColumn;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=regex-grep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex-grep.d.ts","sourceRoot":"","sources":["../../../src/tools/text-grep/regex-grep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,wBAAwB;IACxB,KAA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
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegexGrep = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Regex-based text search tool
|
|
6
|
+
*
|
|
7
|
+
* Searches text content using regular expressions and returns matches with
|
|
8
|
+
* line numbers, column positions, and capture groups.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { RegexGrep } from "@code-check/core";
|
|
13
|
+
*
|
|
14
|
+
* const grep = new RegexGrep();
|
|
15
|
+
* const text = "Hello world\nfoo bar\nworld hello";
|
|
16
|
+
* const matches = grep.search(text, /world/gi);
|
|
17
|
+
* // [{ match: "world", line: 0, column: 6, groups: ["world"], ... }, ...]
|
|
18
|
+
*
|
|
19
|
+
* // With capture groups
|
|
20
|
+
* const emailMatches = grep.search(text, /(\w+)@(\w+\.\w+)/g);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
class RegexGrep {
|
|
24
|
+
/**
|
|
25
|
+
* Search text with a regex pattern
|
|
26
|
+
*
|
|
27
|
+
* @param text - Text content to search
|
|
28
|
+
* @param pattern - RegExp or pattern string
|
|
29
|
+
* @param options - Search options
|
|
30
|
+
* @returns Array of matches, or null if pattern is invalid
|
|
31
|
+
*/
|
|
32
|
+
search(text, pattern, options = {}) {
|
|
33
|
+
const { flags = "g", maxMatches } = options;
|
|
34
|
+
let regex;
|
|
35
|
+
try {
|
|
36
|
+
const effectiveFlags = flags.includes("g") ? flags : flags + "g";
|
|
37
|
+
if (pattern instanceof RegExp) {
|
|
38
|
+
regex = new RegExp(pattern.source, effectiveFlags);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
regex = new RegExp(pattern, effectiveFlags);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const results = [];
|
|
48
|
+
const lineOffsets = this.buildLineOffsets(text);
|
|
49
|
+
for (const match of text.matchAll(regex)) {
|
|
50
|
+
if (maxMatches !== undefined && results.length >= maxMatches) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
const { line, column } = this.indexToLineColumn(match.index, lineOffsets);
|
|
54
|
+
const matchEndIndex = match.index + match[0].length;
|
|
55
|
+
results.push({
|
|
56
|
+
match: match[0],
|
|
57
|
+
line,
|
|
58
|
+
column,
|
|
59
|
+
groups: match.slice(0),
|
|
60
|
+
index: match.index,
|
|
61
|
+
endIndex: matchEndIndex,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return results;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Search text and return only the first match
|
|
68
|
+
*
|
|
69
|
+
* @param text - Text content to search
|
|
70
|
+
* @param pattern - RegExp or pattern string
|
|
71
|
+
* @param options - Search options (flags)
|
|
72
|
+
* @returns First match or null
|
|
73
|
+
*/
|
|
74
|
+
searchFirst(text, pattern, options = {}) {
|
|
75
|
+
const matches = this.search(text, pattern, {
|
|
76
|
+
...options,
|
|
77
|
+
maxMatches: 1,
|
|
78
|
+
});
|
|
79
|
+
return matches && matches.length > 0 ? matches[0] : null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if text contains any match for the pattern
|
|
83
|
+
*
|
|
84
|
+
* @param text - Text content to search
|
|
85
|
+
* @param pattern - RegExp or pattern string
|
|
86
|
+
* @param options - Search options (flags)
|
|
87
|
+
* @returns True if at least one match exists
|
|
88
|
+
*/
|
|
89
|
+
test(text, pattern, options = {}) {
|
|
90
|
+
const match = this.searchFirst(text, pattern, options);
|
|
91
|
+
return match !== null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Search multiple files and return matches with file path
|
|
95
|
+
*
|
|
96
|
+
* @param files - Map of file path to content
|
|
97
|
+
* @param pattern - RegExp or pattern string
|
|
98
|
+
* @param options - Search options
|
|
99
|
+
* @returns Map of file path to matches
|
|
100
|
+
*/
|
|
101
|
+
searchFiles(files, pattern, options = {}) {
|
|
102
|
+
const result = new Map();
|
|
103
|
+
const entries = files instanceof Map ? files.entries() : Object.entries(files);
|
|
104
|
+
for (const [path, content] of entries) {
|
|
105
|
+
const matches = this.search(content, pattern, options);
|
|
106
|
+
if (matches && matches.length > 0) {
|
|
107
|
+
result.set(path, matches);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Build line start offsets for index-to-line/column conversion
|
|
114
|
+
*/
|
|
115
|
+
buildLineOffsets(text) {
|
|
116
|
+
const offsets = [0];
|
|
117
|
+
const re = /\r?\n/g;
|
|
118
|
+
let m;
|
|
119
|
+
while ((m = re.exec(text)) !== null) {
|
|
120
|
+
offsets.push(m.index + m[0].length);
|
|
121
|
+
}
|
|
122
|
+
return offsets;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Convert character index to 0-based line and column
|
|
126
|
+
*/
|
|
127
|
+
indexToLineColumn(index, lineOffsets) {
|
|
128
|
+
let line = 0;
|
|
129
|
+
for (let i = 1; i < lineOffsets.length; i++) {
|
|
130
|
+
if (index < lineOffsets[i]) {
|
|
131
|
+
line = i - 1;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
line = i;
|
|
135
|
+
}
|
|
136
|
+
const column = index - lineOffsets[line];
|
|
137
|
+
return { line, column };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.RegexGrep = RegexGrep;
|
|
141
|
+
//# sourceMappingURL=regex-grep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex-grep.js","sourceRoot":"","sources":["../../../src/tools/text-grep/regex-grep.ts"],"names":[],"mappings":";;;AA4BA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,SAAS;IAClB;;;;;;;OAOG;IACI,MAAM,CACT,IAAY,EACZ,OAAwB,EACxB,UAA4B,EAAE;QAE9B,MAAM,EAAE,KAA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IAED;;OAEG;IACK,gBAAgB,CAAC,IAAY;QACjC,MAAM,OAAO,GAAa,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,EAAE,GAAG,QAAQ,CAAC;QACpB,IAAI,CAAyB,CAAC;QAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;OAEG;IACK,iBAAiB,CACrB,KAAa,EACb,WAAqB;QAErB,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,IAAI,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzB,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;gBACb,MAAM;YACV,CAAC;YACD,IAAI,GAAG,CAAC,CAAC;QACb,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC5B,CAAC;CACJ;AA/ID,8BA+IC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class Context {
|
|
2
|
+
private store;
|
|
3
|
+
private parent;
|
|
4
|
+
constructor(parent?: Context);
|
|
5
|
+
set<T>(key: string, value: T): void;
|
|
6
|
+
/**
|
|
7
|
+
* Looks up the key in this context first, then walks up the parent chain.
|
|
8
|
+
*/
|
|
9
|
+
get<T>(key: string): T | undefined;
|
|
10
|
+
has(key: string): boolean;
|
|
11
|
+
createChild(): Context;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/workflow/context/context.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO;IAElB,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,CAAC,EAAE,OAAO;IAI5B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAInC;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAOlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,WAAW,IAAI,OAAO;CAGvB"}
|