@opencodereview/core 1.9.1
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/ai/anthropic-provider.d.ts +41 -0
- package/dist/ai/anthropic-provider.d.ts.map +1 -0
- package/dist/ai/anthropic-provider.js +139 -0
- package/dist/ai/anthropic-provider.js.map +1 -0
- package/dist/ai/index.d.ts +39 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +41 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/ollama-provider.d.ts +46 -0
- package/dist/ai/ollama-provider.d.ts.map +1 -0
- package/dist/ai/ollama-provider.js +149 -0
- package/dist/ai/ollama-provider.js.map +1 -0
- package/dist/ai/openai-provider.d.ts +44 -0
- package/dist/ai/openai-provider.d.ts.map +1 -0
- package/dist/ai/openai-provider.js +137 -0
- package/dist/ai/openai-provider.js.map +1 -0
- package/dist/ai/orchestrator.d.ts +60 -0
- package/dist/ai/orchestrator.d.ts.map +1 -0
- package/dist/ai/orchestrator.js +188 -0
- package/dist/ai/orchestrator.js.map +1 -0
- package/dist/ai/prompts.d.ts +27 -0
- package/dist/ai/prompts.d.ts.map +1 -0
- package/dist/ai/prompts.js +112 -0
- package/dist/ai/prompts.js.map +1 -0
- package/dist/ai/types.d.ts +75 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +10 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/ai/v4/embedding/index.d.ts +10 -0
- package/dist/ai/v4/embedding/index.d.ts.map +1 -0
- package/dist/ai/v4/embedding/index.js +10 -0
- package/dist/ai/v4/embedding/index.js.map +1 -0
- package/dist/ai/v4/embedding/local.d.ts +68 -0
- package/dist/ai/v4/embedding/local.d.ts.map +1 -0
- package/dist/ai/v4/embedding/local.js +167 -0
- package/dist/ai/v4/embedding/local.js.map +1 -0
- package/dist/ai/v4/embedding/ollama.d.ts +58 -0
- package/dist/ai/v4/embedding/ollama.d.ts.map +1 -0
- package/dist/ai/v4/embedding/ollama.js +101 -0
- package/dist/ai/v4/embedding/ollama.js.map +1 -0
- package/dist/ai/v4/embedding/openai.d.ts +36 -0
- package/dist/ai/v4/embedding/openai.d.ts.map +1 -0
- package/dist/ai/v4/embedding/openai.js +76 -0
- package/dist/ai/v4/embedding/openai.js.map +1 -0
- package/dist/ai/v4/embedding/similarity.d.ts +36 -0
- package/dist/ai/v4/embedding/similarity.d.ts.map +1 -0
- package/dist/ai/v4/embedding/similarity.js +60 -0
- package/dist/ai/v4/embedding/similarity.js.map +1 -0
- package/dist/ai/v4/index.d.ts +51 -0
- package/dist/ai/v4/index.d.ts.map +1 -0
- package/dist/ai/v4/index.js +54 -0
- package/dist/ai/v4/index.js.map +1 -0
- package/dist/ai/v4/llm/anthropic.d.ts +38 -0
- package/dist/ai/v4/llm/anthropic.d.ts.map +1 -0
- package/dist/ai/v4/llm/anthropic.js +86 -0
- package/dist/ai/v4/llm/anthropic.js.map +1 -0
- package/dist/ai/v4/llm/index.d.ts +9 -0
- package/dist/ai/v4/llm/index.d.ts.map +1 -0
- package/dist/ai/v4/llm/index.js +9 -0
- package/dist/ai/v4/llm/index.js.map +1 -0
- package/dist/ai/v4/llm/ollama.d.ts +39 -0
- package/dist/ai/v4/llm/ollama.d.ts.map +1 -0
- package/dist/ai/v4/llm/ollama.js +95 -0
- package/dist/ai/v4/llm/ollama.js.map +1 -0
- package/dist/ai/v4/llm/openai.d.ts +38 -0
- package/dist/ai/v4/llm/openai.d.ts.map +1 -0
- package/dist/ai/v4/llm/openai.js +88 -0
- package/dist/ai/v4/llm/openai.js.map +1 -0
- package/dist/ai/v4/patterns/defect-patterns.d.ts +57 -0
- package/dist/ai/v4/patterns/defect-patterns.d.ts.map +1 -0
- package/dist/ai/v4/patterns/defect-patterns.js +331 -0
- package/dist/ai/v4/patterns/defect-patterns.js.map +1 -0
- package/dist/ai/v4/patterns/index.d.ts +8 -0
- package/dist/ai/v4/patterns/index.d.ts.map +1 -0
- package/dist/ai/v4/patterns/index.js +7 -0
- package/dist/ai/v4/patterns/index.js.map +1 -0
- package/dist/ai/v4/pipeline.d.ts +74 -0
- package/dist/ai/v4/pipeline.d.ts.map +1 -0
- package/dist/ai/v4/pipeline.js +381 -0
- package/dist/ai/v4/pipeline.js.map +1 -0
- package/dist/ai/v4/sla.d.ts +62 -0
- package/dist/ai/v4/sla.d.ts.map +1 -0
- package/dist/ai/v4/sla.js +136 -0
- package/dist/ai/v4/sla.js.map +1 -0
- package/dist/ai/v4/types.d.ts +117 -0
- package/dist/ai/v4/types.d.ts.map +1 -0
- package/dist/ai/v4/types.js +16 -0
- package/dist/ai/v4/types.js.map +1 -0
- package/dist/ai-healer/prompt-builder.d.ts +33 -0
- package/dist/ai-healer/prompt-builder.d.ts.map +1 -0
- package/dist/ai-healer/prompt-builder.js +89 -0
- package/dist/ai-healer/prompt-builder.js.map +1 -0
- package/dist/config/defaults.d.ts +14 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +57 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +33 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +245 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/types.d.ts +58 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +7 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/v4-config.d.ts +77 -0
- package/dist/config/v4-config.d.ts.map +1 -0
- package/dist/config/v4-config.js +336 -0
- package/dist/config/v4-config.js.map +1 -0
- package/dist/detectors/ai-detector.d.ts +38 -0
- package/dist/detectors/ai-detector.d.ts.map +1 -0
- package/dist/detectors/ai-detector.js +62 -0
- package/dist/detectors/ai-detector.js.map +1 -0
- package/dist/detectors/context-break.d.ts +57 -0
- package/dist/detectors/context-break.d.ts.map +1 -0
- package/dist/detectors/context-break.js +199 -0
- package/dist/detectors/context-break.js.map +1 -0
- package/dist/detectors/deep-hallucination.d.ts +42 -0
- package/dist/detectors/deep-hallucination.d.ts.map +1 -0
- package/dist/detectors/deep-hallucination.js +297 -0
- package/dist/detectors/deep-hallucination.js.map +1 -0
- package/dist/detectors/duplication.d.ts +61 -0
- package/dist/detectors/duplication.d.ts.map +1 -0
- package/dist/detectors/duplication.js +204 -0
- package/dist/detectors/duplication.js.map +1 -0
- package/dist/detectors/hallucination.d.ts +80 -0
- package/dist/detectors/hallucination.d.ts.map +1 -0
- package/dist/detectors/hallucination.js +350 -0
- package/dist/detectors/hallucination.js.map +1 -0
- package/dist/detectors/index.d.ts +35 -0
- package/dist/detectors/index.d.ts.map +1 -0
- package/dist/detectors/index.js +33 -0
- package/dist/detectors/index.js.map +1 -0
- package/dist/detectors/logic-gap.d.ts +58 -0
- package/dist/detectors/logic-gap.d.ts.map +1 -0
- package/dist/detectors/logic-gap.js +284 -0
- package/dist/detectors/logic-gap.js.map +1 -0
- package/dist/detectors/over-engineering.d.ts +44 -0
- package/dist/detectors/over-engineering.d.ts.map +1 -0
- package/dist/detectors/over-engineering.js +257 -0
- package/dist/detectors/over-engineering.js.map +1 -0
- package/dist/detectors/security-pattern.d.ts +43 -0
- package/dist/detectors/security-pattern.d.ts.map +1 -0
- package/dist/detectors/security-pattern.js +235 -0
- package/dist/detectors/security-pattern.js.map +1 -0
- package/dist/detectors/stale-api.d.ts +44 -0
- package/dist/detectors/stale-api.d.ts.map +1 -0
- package/dist/detectors/stale-api.js +160 -0
- package/dist/detectors/stale-api.js.map +1 -0
- package/dist/detectors/type-safety.d.ts +41 -0
- package/dist/detectors/type-safety.d.ts.map +1 -0
- package/dist/detectors/type-safety.js +306 -0
- package/dist/detectors/type-safety.js.map +1 -0
- package/dist/detectors/v4/context-coherence.d.ts +67 -0
- package/dist/detectors/v4/context-coherence.d.ts.map +1 -0
- package/dist/detectors/v4/context-coherence.js +319 -0
- package/dist/detectors/v4/context-coherence.js.map +1 -0
- package/dist/detectors/v4/hallucinated-import.d.ts +52 -0
- package/dist/detectors/v4/hallucinated-import.d.ts.map +1 -0
- package/dist/detectors/v4/hallucinated-import.js +206 -0
- package/dist/detectors/v4/hallucinated-import.js.map +1 -0
- package/dist/detectors/v4/index.d.ts +28 -0
- package/dist/detectors/v4/index.d.ts.map +1 -0
- package/dist/detectors/v4/index.js +40 -0
- package/dist/detectors/v4/index.js.map +1 -0
- package/dist/detectors/v4/over-engineering.d.ts +69 -0
- package/dist/detectors/v4/over-engineering.d.ts.map +1 -0
- package/dist/detectors/v4/over-engineering.js +234 -0
- package/dist/detectors/v4/over-engineering.js.map +1 -0
- package/dist/detectors/v4/security-pattern.d.ts +46 -0
- package/dist/detectors/v4/security-pattern.d.ts.map +1 -0
- package/dist/detectors/v4/security-pattern.js +233 -0
- package/dist/detectors/v4/security-pattern.js.map +1 -0
- package/dist/detectors/v4/stale-api.d.ts +59 -0
- package/dist/detectors/v4/stale-api.d.ts.map +1 -0
- package/dist/detectors/v4/stale-api.js +470 -0
- package/dist/detectors/v4/stale-api.js.map +1 -0
- package/dist/detectors/v4/types.d.ts +74 -0
- package/dist/detectors/v4/types.d.ts.map +1 -0
- package/dist/detectors/v4/types.js +10 -0
- package/dist/detectors/v4/types.js.map +1 -0
- package/dist/diff/filter.d.ts +35 -0
- package/dist/diff/filter.d.ts.map +1 -0
- package/dist/diff/filter.js +65 -0
- package/dist/diff/filter.js.map +1 -0
- package/dist/diff/index.d.ts +9 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +8 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/diff/parser.d.ts +61 -0
- package/dist/diff/parser.d.ts.map +1 -0
- package/dist/diff/parser.js +203 -0
- package/dist/diff/parser.js.map +1 -0
- package/dist/i18n/en.d.ts +18 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +83 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +13 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +14 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/provider.d.ts +54 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +88 -0
- package/dist/i18n/provider.js.map +1 -0
- package/dist/i18n/types.d.ts +37 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +10 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/i18n/zh.d.ts +14 -0
- package/dist/i18n/zh.d.ts.map +1 -0
- package/dist/i18n/zh.js +83 -0
- package/dist/i18n/zh.js.map +1 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/ir/index.d.ts +10 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/index.js +9 -0
- package/dist/ir/index.js.map +1 -0
- package/dist/ir/types.d.ts +126 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/types.js +33 -0
- package/dist/ir/types.js.map +1 -0
- package/dist/languages/go/index.d.ts +7 -0
- package/dist/languages/go/index.d.ts.map +1 -0
- package/dist/languages/go/index.js +7 -0
- package/dist/languages/go/index.js.map +1 -0
- package/dist/languages/go/parser.d.ts +89 -0
- package/dist/languages/go/parser.d.ts.map +1 -0
- package/dist/languages/go/parser.js +509 -0
- package/dist/languages/go/parser.js.map +1 -0
- package/dist/languages/index.d.ts +13 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +14 -0
- package/dist/languages/index.js.map +1 -0
- package/dist/languages/java/index.d.ts +7 -0
- package/dist/languages/java/index.d.ts.map +1 -0
- package/dist/languages/java/index.js +7 -0
- package/dist/languages/java/index.js.map +1 -0
- package/dist/languages/java/parser.d.ts +82 -0
- package/dist/languages/java/parser.d.ts.map +1 -0
- package/dist/languages/java/parser.js +492 -0
- package/dist/languages/java/parser.js.map +1 -0
- package/dist/languages/kotlin/index.d.ts +7 -0
- package/dist/languages/kotlin/index.d.ts.map +1 -0
- package/dist/languages/kotlin/index.js +7 -0
- package/dist/languages/kotlin/index.js.map +1 -0
- package/dist/languages/kotlin/parser.d.ts +84 -0
- package/dist/languages/kotlin/parser.d.ts.map +1 -0
- package/dist/languages/kotlin/parser.js +507 -0
- package/dist/languages/kotlin/parser.js.map +1 -0
- package/dist/languages/python/index.d.ts +7 -0
- package/dist/languages/python/index.d.ts.map +1 -0
- package/dist/languages/python/index.js +7 -0
- package/dist/languages/python/index.js.map +1 -0
- package/dist/languages/python/parser.d.ts +91 -0
- package/dist/languages/python/parser.d.ts.map +1 -0
- package/dist/languages/python/parser.js +375 -0
- package/dist/languages/python/parser.js.map +1 -0
- package/dist/languages/registry.d.ts +81 -0
- package/dist/languages/registry.d.ts.map +1 -0
- package/dist/languages/registry.js +150 -0
- package/dist/languages/registry.js.map +1 -0
- package/dist/languages/types.d.ts +137 -0
- package/dist/languages/types.d.ts.map +1 -0
- package/dist/languages/types.js +10 -0
- package/dist/languages/types.js.map +1 -0
- package/dist/languages/typescript/index.d.ts +7 -0
- package/dist/languages/typescript/index.d.ts.map +1 -0
- package/dist/languages/typescript/index.js +7 -0
- package/dist/languages/typescript/index.js.map +1 -0
- package/dist/languages/typescript/parser.d.ts +51 -0
- package/dist/languages/typescript/parser.d.ts.map +1 -0
- package/dist/languages/typescript/parser.js +286 -0
- package/dist/languages/typescript/parser.js.map +1 -0
- package/dist/license/generator.d.ts +43 -0
- package/dist/license/generator.d.ts.map +1 -0
- package/dist/license/generator.js +72 -0
- package/dist/license/generator.js.map +1 -0
- package/dist/license/index.d.ts +11 -0
- package/dist/license/index.d.ts.map +1 -0
- package/dist/license/index.js +12 -0
- package/dist/license/index.js.map +1 -0
- package/dist/license/types.d.ts +85 -0
- package/dist/license/types.d.ts.map +1 -0
- package/dist/license/types.js +10 -0
- package/dist/license/types.js.map +1 -0
- package/dist/license/validator.d.ts +77 -0
- package/dist/license/validator.d.ts.map +1 -0
- package/dist/license/validator.js +275 -0
- package/dist/license/validator.js.map +1 -0
- package/dist/parser/extractor.d.ts +31 -0
- package/dist/parser/extractor.d.ts.map +1 -0
- package/dist/parser/extractor.js +10 -0
- package/dist/parser/extractor.js.map +1 -0
- package/dist/parser/extractors/go.d.ts +21 -0
- package/dist/parser/extractors/go.d.ts.map +1 -0
- package/dist/parser/extractors/go.js +569 -0
- package/dist/parser/extractors/go.js.map +1 -0
- package/dist/parser/extractors/index.d.ts +13 -0
- package/dist/parser/extractors/index.d.ts.map +1 -0
- package/dist/parser/extractors/index.js +13 -0
- package/dist/parser/extractors/index.js.map +1 -0
- package/dist/parser/extractors/java.d.ts +24 -0
- package/dist/parser/extractors/java.d.ts.map +1 -0
- package/dist/parser/extractors/java.js +611 -0
- package/dist/parser/extractors/java.js.map +1 -0
- package/dist/parser/extractors/kotlin.d.ts +25 -0
- package/dist/parser/extractors/kotlin.d.ts.map +1 -0
- package/dist/parser/extractors/kotlin.js +665 -0
- package/dist/parser/extractors/kotlin.js.map +1 -0
- package/dist/parser/extractors/python.d.ts +21 -0
- package/dist/parser/extractors/python.d.ts.map +1 -0
- package/dist/parser/extractors/python.js +514 -0
- package/dist/parser/extractors/python.js.map +1 -0
- package/dist/parser/extractors/typescript.d.ts +23 -0
- package/dist/parser/extractors/typescript.d.ts.map +1 -0
- package/dist/parser/extractors/typescript.js +664 -0
- package/dist/parser/extractors/typescript.js.map +1 -0
- package/dist/parser/index.d.ts +15 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +14 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/manager.d.ts +50 -0
- package/dist/parser/manager.d.ts.map +1 -0
- package/dist/parser/manager.js +159 -0
- package/dist/parser/manager.js.map +1 -0
- package/dist/registry/builtins/go-builtins.d.ts +13 -0
- package/dist/registry/builtins/go-builtins.d.ts.map +1 -0
- package/dist/registry/builtins/go-builtins.js +63 -0
- package/dist/registry/builtins/go-builtins.js.map +1 -0
- package/dist/registry/builtins/java-builtins.d.ts +10 -0
- package/dist/registry/builtins/java-builtins.d.ts.map +1 -0
- package/dist/registry/builtins/java-builtins.js +59 -0
- package/dist/registry/builtins/java-builtins.js.map +1 -0
- package/dist/registry/builtins/kotlin-builtins.d.ts +10 -0
- package/dist/registry/builtins/kotlin-builtins.d.ts.map +1 -0
- package/dist/registry/builtins/kotlin-builtins.js +38 -0
- package/dist/registry/builtins/kotlin-builtins.js.map +1 -0
- package/dist/registry/builtins/node-builtins.d.ts +10 -0
- package/dist/registry/builtins/node-builtins.d.ts.map +1 -0
- package/dist/registry/builtins/node-builtins.js +36 -0
- package/dist/registry/builtins/node-builtins.js.map +1 -0
- package/dist/registry/builtins/python-builtins.d.ts +10 -0
- package/dist/registry/builtins/python-builtins.d.ts.map +1 -0
- package/dist/registry/builtins/python-builtins.js +43 -0
- package/dist/registry/builtins/python-builtins.js.map +1 -0
- package/dist/registry/cache.d.ts +53 -0
- package/dist/registry/cache.d.ts.map +1 -0
- package/dist/registry/cache.js +147 -0
- package/dist/registry/cache.js.map +1 -0
- package/dist/registry/go-registry.d.ts +52 -0
- package/dist/registry/go-registry.d.ts.map +1 -0
- package/dist/registry/go-registry.js +148 -0
- package/dist/registry/go-registry.js.map +1 -0
- package/dist/registry/index.d.ts +18 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +21 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/maven-registry.d.ts +57 -0
- package/dist/registry/maven-registry.d.ts.map +1 -0
- package/dist/registry/maven-registry.js +155 -0
- package/dist/registry/maven-registry.js.map +1 -0
- package/dist/registry/npm-registry.d.ts +40 -0
- package/dist/registry/npm-registry.d.ts.map +1 -0
- package/dist/registry/npm-registry.js +155 -0
- package/dist/registry/npm-registry.js.map +1 -0
- package/dist/registry/pypi-registry.d.ts +49 -0
- package/dist/registry/pypi-registry.d.ts.map +1 -0
- package/dist/registry/pypi-registry.js +175 -0
- package/dist/registry/pypi-registry.js.map +1 -0
- package/dist/registry/registry-manager.d.ts +45 -0
- package/dist/registry/registry-manager.d.ts.map +1 -0
- package/dist/registry/registry-manager.js +107 -0
- package/dist/registry/registry-manager.js.map +1 -0
- package/dist/registry/types.d.ts +83 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +12 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/reporter/html-reporter.d.ts +20 -0
- package/dist/reporter/html-reporter.d.ts.map +1 -0
- package/dist/reporter/html-reporter.js +612 -0
- package/dist/reporter/html-reporter.js.map +1 -0
- package/dist/reporter/index.d.ts +28 -0
- package/dist/reporter/index.d.ts.map +1 -0
- package/dist/reporter/index.js +48 -0
- package/dist/reporter/index.js.map +1 -0
- package/dist/reporter/markdown-reporter.d.ts +16 -0
- package/dist/reporter/markdown-reporter.d.ts.map +1 -0
- package/dist/reporter/markdown-reporter.js +182 -0
- package/dist/reporter/markdown-reporter.js.map +1 -0
- package/dist/reporter/sarif-reporter.d.ts +67 -0
- package/dist/reporter/sarif-reporter.d.ts.map +1 -0
- package/dist/reporter/sarif-reporter.js +73 -0
- package/dist/reporter/sarif-reporter.js.map +1 -0
- package/dist/reporter/terminal-reporter.d.ts +14 -0
- package/dist/reporter/terminal-reporter.d.ts.map +1 -0
- package/dist/reporter/terminal-reporter.js +126 -0
- package/dist/reporter/terminal-reporter.js.map +1 -0
- package/dist/reporter/types.d.ts +43 -0
- package/dist/reporter/types.d.ts.map +1 -0
- package/dist/reporter/types.js +10 -0
- package/dist/reporter/types.js.map +1 -0
- package/dist/reporter/v4-html.d.ts +24 -0
- package/dist/reporter/v4-html.d.ts.map +1 -0
- package/dist/reporter/v4-html.js +359 -0
- package/dist/reporter/v4-html.js.map +1 -0
- package/dist/reporter/v4-terminal.d.ts +55 -0
- package/dist/reporter/v4-terminal.d.ts.map +1 -0
- package/dist/reporter/v4-terminal.js +199 -0
- package/dist/reporter/v4-terminal.js.map +1 -0
- package/dist/scanner/index.d.ts +9 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +9 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/v4-scanner.d.ts +162 -0
- package/dist/scanner/v4-scanner.d.ts.map +1 -0
- package/dist/scanner/v4-scanner.js +327 -0
- package/dist/scanner/v4-scanner.js.map +1 -0
- package/dist/scorer/report.d.ts +52 -0
- package/dist/scorer/report.d.ts.map +1 -0
- package/dist/scorer/report.js +347 -0
- package/dist/scorer/report.js.map +1 -0
- package/dist/scorer/scoring-engine.d.ts +170 -0
- package/dist/scorer/scoring-engine.d.ts.map +1 -0
- package/dist/scorer/scoring-engine.js +308 -0
- package/dist/scorer/scoring-engine.js.map +1 -0
- package/dist/scorer/v4-adapter.d.ts +87 -0
- package/dist/scorer/v4-adapter.d.ts.map +1 -0
- package/dist/scorer/v4-adapter.js +145 -0
- package/dist/scorer/v4-adapter.js.map +1 -0
- package/dist/sla/index.d.ts +7 -0
- package/dist/sla/index.d.ts.map +1 -0
- package/dist/sla/index.js +6 -0
- package/dist/sla/index.js.map +1 -0
- package/dist/sla/tracker.d.ts +70 -0
- package/dist/sla/tracker.d.ts.map +1 -0
- package/dist/sla/tracker.js +151 -0
- package/dist/sla/tracker.js.map +1 -0
- package/dist/sla/types.d.ts +67 -0
- package/dist/sla/types.d.ts.map +1 -0
- package/dist/sla/types.js +42 -0
- package/dist/sla/types.js.map +1 -0
- package/dist/types.d.ts +172 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +69 -0
- package/dist/types.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Code Review V4 — Language Extractor Interface
|
|
3
|
+
*
|
|
4
|
+
* Each supported language implements a LanguageExtractor that converts
|
|
5
|
+
* a tree-sitter CST into the unified CodeUnit IR.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.4.0
|
|
8
|
+
*/
|
|
9
|
+
import type Parser from 'web-tree-sitter';
|
|
10
|
+
import type { CodeUnit, SupportedLanguage } from '../ir/types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Interface for language-specific CST → IR extractors.
|
|
13
|
+
*
|
|
14
|
+
* Each language implements this interface to extract CodeUnits from
|
|
15
|
+
* a tree-sitter parse tree. This is the ONLY place where language-specific
|
|
16
|
+
* CST node types should appear.
|
|
17
|
+
*/
|
|
18
|
+
export interface LanguageExtractor {
|
|
19
|
+
/** The language this extractor handles */
|
|
20
|
+
readonly language: SupportedLanguage;
|
|
21
|
+
/**
|
|
22
|
+
* Extract CodeUnits from a tree-sitter parse tree.
|
|
23
|
+
*
|
|
24
|
+
* @param tree - The tree-sitter parse tree (CST)
|
|
25
|
+
* @param filePath - Relative file path (used as part of CodeUnit IDs)
|
|
26
|
+
* @param source - Original source code string
|
|
27
|
+
* @returns Array of CodeUnits extracted from the tree
|
|
28
|
+
*/
|
|
29
|
+
extract(tree: Parser.Tree, filePath: string, source: string): CodeUnit[];
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../src/parser/extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAErC;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;CAC1E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Code Review V4 — Language Extractor Interface
|
|
3
|
+
*
|
|
4
|
+
* Each supported language implements a LanguageExtractor that converts
|
|
5
|
+
* a tree-sitter CST into the unified CodeUnit IR.
|
|
6
|
+
*
|
|
7
|
+
* @since 0.4.0
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../src/parser/extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Code Review V4 — Go Extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts CodeUnits from Go tree-sitter CSTs.
|
|
5
|
+
* Handles: imports (single, grouped, aliased, dot, blank), functions, methods (with receiver),
|
|
6
|
+
* calls, structs, type declarations, complexity, symbols.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.4.0
|
|
9
|
+
*/
|
|
10
|
+
import type Parser from 'web-tree-sitter';
|
|
11
|
+
import type { LanguageExtractor } from '../extractor.js';
|
|
12
|
+
import type { CodeUnit, SupportedLanguage } from '../../ir/types.js';
|
|
13
|
+
export declare class GoExtractor implements LanguageExtractor {
|
|
14
|
+
readonly language: SupportedLanguage;
|
|
15
|
+
extract(tree: Parser.Tree, filePath: string, source: string): CodeUnit[];
|
|
16
|
+
private extractFileImports;
|
|
17
|
+
private extractFileDefinitions;
|
|
18
|
+
private extractFunctions;
|
|
19
|
+
private extractTypeDeclarations;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=go.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../../src/parser/extractors/go.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EAMlB,MAAM,mBAAmB,CAAC;AA8S3B,qBAAa,WAAY,YAAW,iBAAiB;IACnD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAQ;IAE5C,OAAO,CACL,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,QAAQ,EAAE;IAqCb,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,sBAAsB;IA8E9B,OAAO,CAAC,gBAAgB;IAiJxB,OAAO,CAAC,uBAAuB;CA2EhC"}
|
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Code Review V4 — Go Extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts CodeUnits from Go tree-sitter CSTs.
|
|
5
|
+
* Handles: imports (single, grouped, aliased, dot, blank), functions, methods (with receiver),
|
|
6
|
+
* calls, structs, type declarations, complexity, symbols.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.4.0
|
|
9
|
+
*/
|
|
10
|
+
import { createCodeUnit } from '../../ir/types.js';
|
|
11
|
+
// ─── Tree-sitter node type constants ───────────────────────────────
|
|
12
|
+
/** Node types that represent branching (for cyclomatic complexity) */
|
|
13
|
+
const BRANCHING_NODES = new Set([
|
|
14
|
+
'if_statement',
|
|
15
|
+
'for_statement',
|
|
16
|
+
'expression_switch_statement',
|
|
17
|
+
'type_switch_statement',
|
|
18
|
+
'expression_case',
|
|
19
|
+
'type_case',
|
|
20
|
+
'communication_case',
|
|
21
|
+
'select_statement',
|
|
22
|
+
'binary_expression', // for && and ||
|
|
23
|
+
]);
|
|
24
|
+
/** Node types that increase nesting depth */
|
|
25
|
+
const NESTING_NODES = new Set([
|
|
26
|
+
'if_statement',
|
|
27
|
+
'for_statement',
|
|
28
|
+
'expression_switch_statement',
|
|
29
|
+
'type_switch_statement',
|
|
30
|
+
'select_statement',
|
|
31
|
+
]);
|
|
32
|
+
/** Node types for cognitive complexity */
|
|
33
|
+
const COGNITIVE_NODES = new Set([
|
|
34
|
+
'if_statement',
|
|
35
|
+
'for_statement',
|
|
36
|
+
'expression_switch_statement',
|
|
37
|
+
'type_switch_statement',
|
|
38
|
+
'select_statement',
|
|
39
|
+
'expression_case',
|
|
40
|
+
'type_case',
|
|
41
|
+
'communication_case',
|
|
42
|
+
]);
|
|
43
|
+
// ─── Helper: Get node location ─────────────────────────────────────
|
|
44
|
+
function getLocation(node) {
|
|
45
|
+
return {
|
|
46
|
+
startLine: node.startPosition.row,
|
|
47
|
+
startColumn: node.startPosition.column,
|
|
48
|
+
endLine: node.endPosition.row,
|
|
49
|
+
endColumn: node.endPosition.column,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// ─── Helper: Count lines of code ───────────────────────────────────
|
|
53
|
+
function countLinesOfCode(source) {
|
|
54
|
+
const lines = source.split('\n');
|
|
55
|
+
let count = 0;
|
|
56
|
+
for (const line of lines) {
|
|
57
|
+
const trimmed = line.trim();
|
|
58
|
+
if (trimmed.length > 0 && !trimmed.startsWith('//') && !trimmed.startsWith('/*') && !trimmed.startsWith('*')) {
|
|
59
|
+
count++;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return count;
|
|
63
|
+
}
|
|
64
|
+
// ─── Helper: Check if name is exported (capitalized) ───────────────
|
|
65
|
+
function isExportedName(name) {
|
|
66
|
+
if (name.length === 0)
|
|
67
|
+
return false;
|
|
68
|
+
const first = name.charAt(0);
|
|
69
|
+
return first === first.toUpperCase() && first !== first.toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
// ─── Helper: Extract string literal content ────────────────────────
|
|
72
|
+
function extractStringContent(node) {
|
|
73
|
+
// Go string literals: "fmt" or `fmt`
|
|
74
|
+
const text = node.text;
|
|
75
|
+
if (text.startsWith('"') && text.endsWith('"')) {
|
|
76
|
+
return text.slice(1, -1);
|
|
77
|
+
}
|
|
78
|
+
if (text.startsWith('`') && text.endsWith('`')) {
|
|
79
|
+
return text.slice(1, -1);
|
|
80
|
+
}
|
|
81
|
+
return text;
|
|
82
|
+
}
|
|
83
|
+
// ─── Helper: Extract imports from import_declaration ───────────────
|
|
84
|
+
function extractImports(node) {
|
|
85
|
+
const imports = [];
|
|
86
|
+
if (node.type !== 'import_declaration')
|
|
87
|
+
return imports;
|
|
88
|
+
// Can be single: import "fmt"
|
|
89
|
+
// Or grouped: import ( "fmt" ; "os" )
|
|
90
|
+
const specList = node.children.find(c => c.type === 'import_spec_list');
|
|
91
|
+
if (specList) {
|
|
92
|
+
// Grouped imports
|
|
93
|
+
for (const spec of specList.children) {
|
|
94
|
+
if (spec.type === 'import_spec') {
|
|
95
|
+
const info = extractImportSpec(spec);
|
|
96
|
+
if (info)
|
|
97
|
+
imports.push(info);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Single import
|
|
103
|
+
const spec = node.children.find(c => c.type === 'import_spec');
|
|
104
|
+
if (spec) {
|
|
105
|
+
const info = extractImportSpec(spec);
|
|
106
|
+
if (info)
|
|
107
|
+
imports.push(info);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// Fallback: look for a string literal directly
|
|
111
|
+
const strNode = node.children.find(c => c.type === 'interpreted_string_literal' || c.type === 'raw_string_literal');
|
|
112
|
+
if (strNode) {
|
|
113
|
+
const modulePath = extractStringContent(strNode);
|
|
114
|
+
imports.push({
|
|
115
|
+
module: modulePath,
|
|
116
|
+
symbols: [],
|
|
117
|
+
line: node.startPosition.row,
|
|
118
|
+
isRelative: modulePath.startsWith('.'),
|
|
119
|
+
raw: node.text,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return imports;
|
|
125
|
+
}
|
|
126
|
+
function extractImportSpec(spec) {
|
|
127
|
+
const strNode = spec.children.find(c => c.type === 'interpreted_string_literal' || c.type === 'raw_string_literal');
|
|
128
|
+
if (!strNode)
|
|
129
|
+
return null;
|
|
130
|
+
const modulePath = extractStringContent(strNode);
|
|
131
|
+
const symbols = [];
|
|
132
|
+
// Check for alias, dot import, or blank import
|
|
133
|
+
const aliasNode = spec.children.find(c => c.type === 'package_identifier');
|
|
134
|
+
const dotNode = spec.children.find(c => c.type === 'dot');
|
|
135
|
+
const blankNode = spec.children.find(c => c.type === 'blank_identifier');
|
|
136
|
+
if (dotNode) {
|
|
137
|
+
symbols.push('.');
|
|
138
|
+
}
|
|
139
|
+
else if (blankNode) {
|
|
140
|
+
symbols.push('_');
|
|
141
|
+
}
|
|
142
|
+
else if (aliasNode) {
|
|
143
|
+
symbols.push(aliasNode.text);
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
module: modulePath,
|
|
147
|
+
symbols,
|
|
148
|
+
line: spec.startPosition.row,
|
|
149
|
+
isRelative: modulePath.startsWith('.'),
|
|
150
|
+
raw: spec.text,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// ─── Helper: Extract calls from a subtree ──────────────────────────
|
|
154
|
+
function extractCalls(node) {
|
|
155
|
+
const calls = [];
|
|
156
|
+
function walk(n) {
|
|
157
|
+
if (n.type === 'call_expression') {
|
|
158
|
+
const funcNode = n.children[0];
|
|
159
|
+
const argListNode = n.children.find(c => c.type === 'argument_list');
|
|
160
|
+
if (funcNode) {
|
|
161
|
+
const callee = funcNode.text;
|
|
162
|
+
let object;
|
|
163
|
+
let method;
|
|
164
|
+
if (funcNode.type === 'selector_expression') {
|
|
165
|
+
// e.g., fmt.Println
|
|
166
|
+
const objectNode = funcNode.children[0];
|
|
167
|
+
const fieldNode = funcNode.children.find(c => c.type === 'field_identifier');
|
|
168
|
+
object = objectNode?.text;
|
|
169
|
+
method = fieldNode?.text ?? callee;
|
|
170
|
+
}
|
|
171
|
+
else if (funcNode.type === 'identifier') {
|
|
172
|
+
method = funcNode.text;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
// Could be a func literal call or other complex expression
|
|
176
|
+
method = callee;
|
|
177
|
+
}
|
|
178
|
+
let argCount = 0;
|
|
179
|
+
if (argListNode) {
|
|
180
|
+
for (const arg of argListNode.children) {
|
|
181
|
+
if (arg.type !== ',' && arg.type !== '(' && arg.type !== ')') {
|
|
182
|
+
argCount++;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
calls.push({
|
|
187
|
+
callee,
|
|
188
|
+
object,
|
|
189
|
+
method,
|
|
190
|
+
line: n.startPosition.row,
|
|
191
|
+
argCount,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
for (let i = 0; i < n.childCount; i++) {
|
|
196
|
+
walk(n.child(i));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
walk(node);
|
|
200
|
+
return calls;
|
|
201
|
+
}
|
|
202
|
+
// ─── Helper: Compute complexity ────────────────────────────────────
|
|
203
|
+
function computeComplexity(node, source) {
|
|
204
|
+
let cyclomatic = 1; // base complexity
|
|
205
|
+
let cognitive = 0;
|
|
206
|
+
let maxDepth = 0;
|
|
207
|
+
function walk(n, nestingDepth) {
|
|
208
|
+
// Cyclomatic complexity
|
|
209
|
+
if (BRANCHING_NODES.has(n.type)) {
|
|
210
|
+
if (n.type === 'binary_expression') {
|
|
211
|
+
const op = n.children.find(c => c.text === '&&' || c.text === '||');
|
|
212
|
+
if (op) {
|
|
213
|
+
cyclomatic++;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
cyclomatic++;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Cognitive complexity
|
|
221
|
+
if (COGNITIVE_NODES.has(n.type)) {
|
|
222
|
+
if (n.type === 'expression_case' ||
|
|
223
|
+
n.type === 'type_case' ||
|
|
224
|
+
n.type === 'communication_case') {
|
|
225
|
+
cognitive += 1; // cases don't get nesting increment
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
cognitive += 1 + nestingDepth;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (n.type === 'binary_expression') {
|
|
232
|
+
const op = n.children.find(c => c.text === '&&' || c.text === '||');
|
|
233
|
+
if (op) {
|
|
234
|
+
cognitive += 1;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// Nesting
|
|
238
|
+
let newDepth = nestingDepth;
|
|
239
|
+
if (NESTING_NODES.has(n.type)) {
|
|
240
|
+
newDepth = nestingDepth + 1;
|
|
241
|
+
if (newDepth > maxDepth)
|
|
242
|
+
maxDepth = newDepth;
|
|
243
|
+
}
|
|
244
|
+
for (let i = 0; i < n.childCount; i++) {
|
|
245
|
+
walk(n.child(i), newDepth);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
walk(node, 0);
|
|
249
|
+
return {
|
|
250
|
+
cyclomaticComplexity: cyclomatic,
|
|
251
|
+
cognitiveComplexity: cognitive,
|
|
252
|
+
maxNestingDepth: maxDepth,
|
|
253
|
+
linesOfCode: countLinesOfCode(source),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
// ─── Helper: Count parameters (Go) ────────────────────────────────
|
|
257
|
+
function countParameters(paramsNode) {
|
|
258
|
+
let count = 0;
|
|
259
|
+
for (const child of paramsNode.children) {
|
|
260
|
+
if (child.type === 'parameter_declaration') {
|
|
261
|
+
// A parameter_declaration can declare multiple params: x, y int
|
|
262
|
+
const identifiers = child.children.filter(c => c.type === 'identifier');
|
|
263
|
+
count += Math.max(identifiers.length, 1);
|
|
264
|
+
}
|
|
265
|
+
else if (child.type === 'variadic_parameter_declaration') {
|
|
266
|
+
count++;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return count;
|
|
270
|
+
}
|
|
271
|
+
// ─── GoExtractor ───────────────────────────────────────────────────
|
|
272
|
+
export class GoExtractor {
|
|
273
|
+
language = 'go';
|
|
274
|
+
extract(tree, filePath, source) {
|
|
275
|
+
const units = [];
|
|
276
|
+
const root = tree.rootNode;
|
|
277
|
+
// 1. File-level CodeUnit
|
|
278
|
+
const fileImports = this.extractFileImports(root);
|
|
279
|
+
const fileCalls = extractCalls(root);
|
|
280
|
+
const fileDefs = this.extractFileDefinitions(root);
|
|
281
|
+
const fileComplexity = computeComplexity(root, source);
|
|
282
|
+
const fileUnit = createCodeUnit({
|
|
283
|
+
id: `file:${filePath}`,
|
|
284
|
+
file: filePath,
|
|
285
|
+
language: 'go',
|
|
286
|
+
kind: 'file',
|
|
287
|
+
location: getLocation(root),
|
|
288
|
+
source,
|
|
289
|
+
imports: fileImports,
|
|
290
|
+
calls: fileCalls,
|
|
291
|
+
complexity: fileComplexity,
|
|
292
|
+
definitions: fileDefs,
|
|
293
|
+
references: [],
|
|
294
|
+
childIds: [],
|
|
295
|
+
});
|
|
296
|
+
units.push(fileUnit);
|
|
297
|
+
// 2. Extract functions and methods
|
|
298
|
+
this.extractFunctions(root, filePath, fileUnit, units);
|
|
299
|
+
// 3. Extract type declarations (structs, interfaces) as class-like units
|
|
300
|
+
this.extractTypeDeclarations(root, filePath, fileUnit, units);
|
|
301
|
+
return units;
|
|
302
|
+
}
|
|
303
|
+
// ─── File-level imports ──────────────────────────────────────────
|
|
304
|
+
extractFileImports(root) {
|
|
305
|
+
const imports = [];
|
|
306
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
307
|
+
const child = root.child(i);
|
|
308
|
+
if (child.type === 'import_declaration') {
|
|
309
|
+
imports.push(...extractImports(child));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return imports;
|
|
313
|
+
}
|
|
314
|
+
// ─── File-level definitions ──────────────────────────────────────
|
|
315
|
+
extractFileDefinitions(root) {
|
|
316
|
+
const defs = [];
|
|
317
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
318
|
+
const child = root.child(i);
|
|
319
|
+
if (child.type === 'function_declaration') {
|
|
320
|
+
const nameNode = child.children.find(c => c.type === 'identifier');
|
|
321
|
+
if (nameNode) {
|
|
322
|
+
defs.push({
|
|
323
|
+
name: nameNode.text,
|
|
324
|
+
kind: 'function',
|
|
325
|
+
line: child.startPosition.row,
|
|
326
|
+
exported: isExportedName(nameNode.text),
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else if (child.type === 'method_declaration') {
|
|
331
|
+
const nameNode = child.children.find(c => c.type === 'field_identifier');
|
|
332
|
+
if (nameNode) {
|
|
333
|
+
defs.push({
|
|
334
|
+
name: nameNode.text,
|
|
335
|
+
kind: 'method',
|
|
336
|
+
line: child.startPosition.row,
|
|
337
|
+
exported: isExportedName(nameNode.text),
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else if (child.type === 'type_declaration') {
|
|
342
|
+
for (const spec of child.children) {
|
|
343
|
+
if (spec.type === 'type_spec') {
|
|
344
|
+
const nameNode = spec.children.find(c => c.type === 'type_identifier');
|
|
345
|
+
if (nameNode) {
|
|
346
|
+
defs.push({
|
|
347
|
+
name: nameNode.text,
|
|
348
|
+
kind: 'type',
|
|
349
|
+
line: spec.startPosition.row,
|
|
350
|
+
exported: isExportedName(nameNode.text),
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else if (child.type === 'var_declaration') {
|
|
357
|
+
for (const spec of child.children) {
|
|
358
|
+
if (spec.type === 'var_spec') {
|
|
359
|
+
for (const id of spec.children) {
|
|
360
|
+
if (id.type === 'identifier') {
|
|
361
|
+
defs.push({
|
|
362
|
+
name: id.text,
|
|
363
|
+
kind: 'variable',
|
|
364
|
+
line: spec.startPosition.row,
|
|
365
|
+
exported: isExportedName(id.text),
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else if (child.type === 'const_declaration') {
|
|
373
|
+
for (const spec of child.children) {
|
|
374
|
+
if (spec.type === 'const_spec') {
|
|
375
|
+
for (const id of spec.children) {
|
|
376
|
+
if (id.type === 'identifier') {
|
|
377
|
+
defs.push({
|
|
378
|
+
name: id.text,
|
|
379
|
+
kind: 'variable',
|
|
380
|
+
line: spec.startPosition.row,
|
|
381
|
+
exported: isExportedName(id.text),
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return defs;
|
|
390
|
+
}
|
|
391
|
+
// ─── Extract functions and methods ───────────────────────────────
|
|
392
|
+
extractFunctions(root, filePath, fileUnit, units) {
|
|
393
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
394
|
+
const child = root.child(i);
|
|
395
|
+
if (child.type === 'function_declaration') {
|
|
396
|
+
const nameNode = child.children.find(c => c.type === 'identifier');
|
|
397
|
+
if (!nameNode)
|
|
398
|
+
continue;
|
|
399
|
+
const funcName = nameNode.text;
|
|
400
|
+
const funcId = `func:${filePath}:${funcName}`;
|
|
401
|
+
const funcSource = child.text;
|
|
402
|
+
// Get parameters (first parameter_list is params, second is return types)
|
|
403
|
+
const paramLists = child.children.filter(c => c.type === 'parameter_list');
|
|
404
|
+
const paramsNode = paramLists[0];
|
|
405
|
+
const paramCount = paramsNode ? countParameters(paramsNode) : 0;
|
|
406
|
+
const complexity = computeComplexity(child, funcSource);
|
|
407
|
+
complexity.parameterCount = paramCount;
|
|
408
|
+
const calls = extractCalls(child);
|
|
409
|
+
const funcDefs = [
|
|
410
|
+
{
|
|
411
|
+
name: funcName,
|
|
412
|
+
kind: 'function',
|
|
413
|
+
line: child.startPosition.row,
|
|
414
|
+
exported: isExportedName(funcName),
|
|
415
|
+
},
|
|
416
|
+
];
|
|
417
|
+
// Extract parameter definitions
|
|
418
|
+
if (paramsNode) {
|
|
419
|
+
for (const param of paramsNode.children) {
|
|
420
|
+
if (param.type === 'parameter_declaration') {
|
|
421
|
+
const ids = param.children.filter(c => c.type === 'identifier');
|
|
422
|
+
for (const id of ids) {
|
|
423
|
+
funcDefs.push({
|
|
424
|
+
name: id.text,
|
|
425
|
+
kind: 'parameter',
|
|
426
|
+
line: param.startPosition.row,
|
|
427
|
+
exported: false,
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
const funcUnit = createCodeUnit({
|
|
434
|
+
id: funcId,
|
|
435
|
+
file: filePath,
|
|
436
|
+
language: 'go',
|
|
437
|
+
kind: 'function',
|
|
438
|
+
location: getLocation(child),
|
|
439
|
+
source: funcSource,
|
|
440
|
+
calls,
|
|
441
|
+
complexity,
|
|
442
|
+
definitions: funcDefs,
|
|
443
|
+
parentId: fileUnit.id,
|
|
444
|
+
});
|
|
445
|
+
units.push(funcUnit);
|
|
446
|
+
fileUnit.childIds.push(funcId);
|
|
447
|
+
}
|
|
448
|
+
else if (child.type === 'method_declaration') {
|
|
449
|
+
// Go methods have a receiver parameter list
|
|
450
|
+
const nameNode = child.children.find(c => c.type === 'field_identifier');
|
|
451
|
+
if (!nameNode)
|
|
452
|
+
continue;
|
|
453
|
+
const methodName = nameNode.text;
|
|
454
|
+
// Extract receiver type
|
|
455
|
+
const paramLists = child.children.filter(c => c.type === 'parameter_list');
|
|
456
|
+
const receiverList = paramLists[0]; // First param list is receiver
|
|
457
|
+
const paramsNode = paramLists[1]; // Second is actual params
|
|
458
|
+
let receiverType = '';
|
|
459
|
+
if (receiverList) {
|
|
460
|
+
const paramDecl = receiverList.children.find(c => c.type === 'parameter_declaration');
|
|
461
|
+
if (paramDecl) {
|
|
462
|
+
const typeNode = paramDecl.children.find(c => c.type === 'type_identifier') ??
|
|
463
|
+
paramDecl.children.find(c => c.type === 'pointer_type');
|
|
464
|
+
if (typeNode) {
|
|
465
|
+
if (typeNode.type === 'pointer_type') {
|
|
466
|
+
const inner = typeNode.children.find(c => c.type === 'type_identifier');
|
|
467
|
+
receiverType = inner?.text ?? typeNode.text;
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
receiverType = typeNode.text;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
const paramCount = paramsNode ? countParameters(paramsNode) : 0;
|
|
476
|
+
const methodId = `method:${filePath}:${receiverType}.${methodName}`;
|
|
477
|
+
const methodSource = child.text;
|
|
478
|
+
const complexity = computeComplexity(child, methodSource);
|
|
479
|
+
complexity.parameterCount = paramCount;
|
|
480
|
+
const calls = extractCalls(child);
|
|
481
|
+
const methodDefs = [
|
|
482
|
+
{
|
|
483
|
+
name: methodName,
|
|
484
|
+
kind: 'method',
|
|
485
|
+
line: child.startPosition.row,
|
|
486
|
+
exported: isExportedName(methodName),
|
|
487
|
+
},
|
|
488
|
+
];
|
|
489
|
+
const methodUnit = createCodeUnit({
|
|
490
|
+
id: methodId,
|
|
491
|
+
file: filePath,
|
|
492
|
+
language: 'go',
|
|
493
|
+
kind: 'method',
|
|
494
|
+
location: getLocation(child),
|
|
495
|
+
source: methodSource,
|
|
496
|
+
calls,
|
|
497
|
+
complexity,
|
|
498
|
+
definitions: methodDefs,
|
|
499
|
+
parentId: fileUnit.id,
|
|
500
|
+
});
|
|
501
|
+
units.push(methodUnit);
|
|
502
|
+
fileUnit.childIds.push(methodId);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
// ─── Extract type declarations (struct, interface) ───────────────
|
|
507
|
+
extractTypeDeclarations(root, filePath, fileUnit, units) {
|
|
508
|
+
for (let i = 0; i < root.childCount; i++) {
|
|
509
|
+
const child = root.child(i);
|
|
510
|
+
if (child.type !== 'type_declaration')
|
|
511
|
+
continue;
|
|
512
|
+
for (const spec of child.children) {
|
|
513
|
+
if (spec.type !== 'type_spec')
|
|
514
|
+
continue;
|
|
515
|
+
const nameNode = spec.children.find(c => c.type === 'type_identifier');
|
|
516
|
+
if (!nameNode)
|
|
517
|
+
continue;
|
|
518
|
+
const typeName = nameNode.text;
|
|
519
|
+
const typeId = `class:${filePath}:${typeName}`;
|
|
520
|
+
const typeSource = child.text;
|
|
521
|
+
const typeCalls = extractCalls(child);
|
|
522
|
+
const typeComplexity = computeComplexity(child, typeSource);
|
|
523
|
+
const typeDefs = [
|
|
524
|
+
{
|
|
525
|
+
name: typeName,
|
|
526
|
+
kind: 'type',
|
|
527
|
+
line: spec.startPosition.row,
|
|
528
|
+
exported: isExportedName(typeName),
|
|
529
|
+
},
|
|
530
|
+
];
|
|
531
|
+
// Extract struct field definitions
|
|
532
|
+
const structType = spec.children.find(c => c.type === 'struct_type');
|
|
533
|
+
if (structType) {
|
|
534
|
+
const fieldList = structType.children.find(c => c.type === 'field_declaration_list');
|
|
535
|
+
if (fieldList) {
|
|
536
|
+
for (const field of fieldList.children) {
|
|
537
|
+
if (field.type === 'field_declaration') {
|
|
538
|
+
const fieldName = field.children.find(c => c.type === 'field_identifier');
|
|
539
|
+
if (fieldName) {
|
|
540
|
+
typeDefs.push({
|
|
541
|
+
name: fieldName.text,
|
|
542
|
+
kind: 'variable',
|
|
543
|
+
line: field.startPosition.row,
|
|
544
|
+
exported: isExportedName(fieldName.text),
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
const typeUnit = createCodeUnit({
|
|
552
|
+
id: typeId,
|
|
553
|
+
file: filePath,
|
|
554
|
+
language: 'go',
|
|
555
|
+
kind: 'class',
|
|
556
|
+
location: getLocation(child),
|
|
557
|
+
source: typeSource,
|
|
558
|
+
calls: typeCalls,
|
|
559
|
+
complexity: typeComplexity,
|
|
560
|
+
definitions: typeDefs,
|
|
561
|
+
parentId: fileUnit.id,
|
|
562
|
+
});
|
|
563
|
+
units.push(typeUnit);
|
|
564
|
+
fileUnit.childIds.push(typeId);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
//# sourceMappingURL=go.js.map
|