api-tests-coverage 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/README.md +703 -0
- package/config.yaml.example +227 -0
- package/dist/action/src/index.d.ts +2 -0
- package/dist/action/src/index.d.ts.map +1 -0
- package/dist/action/src/index.js +349 -0
- package/dist/action/src/prComment.d.ts +34 -0
- package/dist/action/src/prComment.d.ts.map +1 -0
- package/dist/action/src/prComment.js +146 -0
- package/dist/src/ast/astAnalysisOrchestrator.d.ts +36 -0
- package/dist/src/ast/astAnalysisOrchestrator.d.ts.map +1 -0
- package/dist/src/ast/astAnalysisOrchestrator.js +123 -0
- package/dist/src/ast/astTypes.d.ts +105 -0
- package/dist/src/ast/astTypes.d.ts.map +1 -0
- package/dist/src/ast/astTypes.js +9 -0
- package/dist/src/ast/languageAnalyzer.d.ts +46 -0
- package/dist/src/ast/languageAnalyzer.d.ts.map +1 -0
- package/dist/src/ast/languageAnalyzer.js +9 -0
- package/dist/src/ast/languageCapabilities.d.ts +24 -0
- package/dist/src/ast/languageCapabilities.d.ts.map +1 -0
- package/dist/src/ast/languageCapabilities.js +92 -0
- package/dist/src/ast/parseFile.d.ts +16 -0
- package/dist/src/ast/parseFile.d.ts.map +1 -0
- package/dist/src/ast/parseFile.js +65 -0
- package/dist/src/ast/parserRegistry.d.ts +39 -0
- package/dist/src/ast/parserRegistry.d.ts.map +1 -0
- package/dist/src/ast/parserRegistry.js +66 -0
- package/dist/src/buildSummary.d.ts +26 -0
- package/dist/src/buildSummary.d.ts.map +1 -0
- package/dist/src/buildSummary.js +193 -0
- package/dist/src/businessCoverage.d.ts +68 -0
- package/dist/src/businessCoverage.d.ts.map +1 -0
- package/dist/src/businessCoverage.js +290 -0
- package/dist/src/compatibilityCoverage.d.ts +83 -0
- package/dist/src/compatibilityCoverage.d.ts.map +1 -0
- package/dist/src/compatibilityCoverage.js +501 -0
- package/dist/src/config/defaultConfig.d.ts +9 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -0
- package/dist/src/config/defaultConfig.js +97 -0
- package/dist/src/config/index.d.ts +12 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +37 -0
- package/dist/src/config/loadConfig.d.ts +29 -0
- package/dist/src/config/loadConfig.d.ts.map +1 -0
- package/dist/src/config/loadConfig.js +135 -0
- package/dist/src/config/mergeConfig.d.ts +15 -0
- package/dist/src/config/mergeConfig.d.ts.map +1 -0
- package/dist/src/config/mergeConfig.js +57 -0
- package/dist/src/config/schema.d.ts +15 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +30 -0
- package/dist/src/config/types.d.ts +175 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config/types.js +9 -0
- package/dist/src/config/validateConfig.d.ts +22 -0
- package/dist/src/config/validateConfig.d.ts.map +1 -0
- package/dist/src/config/validateConfig.js +171 -0
- package/dist/src/config.d.ts +168 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +204 -0
- package/dist/src/coverage/deep-analysis/callGraph.d.ts +67 -0
- package/dist/src/coverage/deep-analysis/callGraph.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/callGraph.js +275 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts +23 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.js +394 -0
- package/dist/src/coverage/deep-analysis/index.d.ts +17 -0
- package/dist/src/coverage/deep-analysis/index.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/index.js +63 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts +60 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.js +121 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.d.ts +36 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.js +92 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.d.ts +55 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.js +152 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts +70 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.js +152 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.d.ts +80 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.js +216 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts +71 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.js +226 -0
- package/dist/src/coverage/deep-analysis/symbolTable.d.ts +58 -0
- package/dist/src/coverage/deep-analysis/symbolTable.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/symbolTable.js +230 -0
- package/dist/src/coverage/deep-analysis/types.d.ts +122 -0
- package/dist/src/coverage/deep-analysis/types.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/types.js +21 -0
- package/dist/src/discovery/fileClassifier.d.ts +50 -0
- package/dist/src/discovery/fileClassifier.d.ts.map +1 -0
- package/dist/src/discovery/fileClassifier.js +238 -0
- package/dist/src/discovery/projectDiscovery.d.ts +66 -0
- package/dist/src/discovery/projectDiscovery.d.ts.map +1 -0
- package/dist/src/discovery/projectDiscovery.js +287 -0
- package/dist/src/endpointCoverage.d.ts +70 -0
- package/dist/src/endpointCoverage.d.ts.map +1 -0
- package/dist/src/endpointCoverage.js +381 -0
- package/dist/src/errorCoverage.d.ts +93 -0
- package/dist/src/errorCoverage.d.ts.map +1 -0
- package/dist/src/errorCoverage.js +698 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +1441 -0
- package/dist/src/inference/businessRuleInference.d.ts +63 -0
- package/dist/src/inference/businessRuleInference.d.ts.map +1 -0
- package/dist/src/inference/businessRuleInference.js +268 -0
- package/dist/src/inference/integrationFlowInference.d.ts +56 -0
- package/dist/src/inference/integrationFlowInference.d.ts.map +1 -0
- package/dist/src/inference/integrationFlowInference.js +266 -0
- package/dist/src/integrationCoverage.d.ts +72 -0
- package/dist/src/integrationCoverage.d.ts.map +1 -0
- package/dist/src/integrationCoverage.js +317 -0
- package/dist/src/intelligence/index.d.ts +20 -0
- package/dist/src/intelligence/index.d.ts.map +1 -0
- package/dist/src/intelligence/index.js +105 -0
- package/dist/src/intelligence/linkageEngine.d.ts +20 -0
- package/dist/src/intelligence/linkageEngine.d.ts.map +1 -0
- package/dist/src/intelligence/linkageEngine.js +522 -0
- package/dist/src/intelligence/markdownReporter.d.ts +12 -0
- package/dist/src/intelligence/markdownReporter.d.ts.map +1 -0
- package/dist/src/intelligence/markdownReporter.js +265 -0
- package/dist/src/intelligence/riskScoring.d.ts +53 -0
- package/dist/src/intelligence/riskScoring.d.ts.map +1 -0
- package/dist/src/intelligence/riskScoring.js +181 -0
- package/dist/src/intelligence/types.d.ts +121 -0
- package/dist/src/intelligence/types.d.ts.map +1 -0
- package/dist/src/intelligence/types.js +8 -0
- package/dist/src/languageDetection.d.ts +100 -0
- package/dist/src/languageDetection.d.ts.map +1 -0
- package/dist/src/languageDetection.js +349 -0
- package/dist/src/languages/java/index.d.ts +16 -0
- package/dist/src/languages/java/index.d.ts.map +1 -0
- package/dist/src/languages/java/index.js +103 -0
- package/dist/src/languages/java/parser.d.ts +7 -0
- package/dist/src/languages/java/parser.d.ts.map +1 -0
- package/dist/src/languages/java/parser.js +50 -0
- package/dist/src/languages/java/semanticBuilder.d.ts +21 -0
- package/dist/src/languages/java/semanticBuilder.d.ts.map +1 -0
- package/dist/src/languages/java/semanticBuilder.js +358 -0
- package/dist/src/languages/javascript/annotationExtractor.d.ts +20 -0
- package/dist/src/languages/javascript/annotationExtractor.d.ts.map +1 -0
- package/dist/src/languages/javascript/annotationExtractor.js +94 -0
- package/dist/src/languages/javascript/assertionResolver.d.ts +18 -0
- package/dist/src/languages/javascript/assertionResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/assertionResolver.js +150 -0
- package/dist/src/languages/javascript/callResolver.d.ts +23 -0
- package/dist/src/languages/javascript/callResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/callResolver.js +236 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.d.ts +23 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.d.ts.map +1 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.js +205 -0
- package/dist/src/languages/javascript/index.d.ts +20 -0
- package/dist/src/languages/javascript/index.d.ts.map +1 -0
- package/dist/src/languages/javascript/index.js +136 -0
- package/dist/src/languages/javascript/parser.d.ts +14 -0
- package/dist/src/languages/javascript/parser.d.ts.map +1 -0
- package/dist/src/languages/javascript/parser.js +38 -0
- package/dist/src/languages/javascript/symbolResolver.d.ts +31 -0
- package/dist/src/languages/javascript/symbolResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/symbolResolver.js +183 -0
- package/dist/src/languages/kotlin/index.d.ts +16 -0
- package/dist/src/languages/kotlin/index.d.ts.map +1 -0
- package/dist/src/languages/kotlin/index.js +151 -0
- package/dist/src/languages/kotlin/parser.d.ts +11 -0
- package/dist/src/languages/kotlin/parser.d.ts.map +1 -0
- package/dist/src/languages/kotlin/parser.js +74 -0
- package/dist/src/languages/python/index.d.ts +15 -0
- package/dist/src/languages/python/index.d.ts.map +1 -0
- package/dist/src/languages/python/index.js +293 -0
- package/dist/src/languages/ruby/index.d.ts +15 -0
- package/dist/src/languages/ruby/index.d.ts.map +1 -0
- package/dist/src/languages/ruby/index.js +274 -0
- package/dist/src/languages/shared/treeSitterUtils.d.ts +43 -0
- package/dist/src/languages/shared/treeSitterUtils.d.ts.map +1 -0
- package/dist/src/languages/shared/treeSitterUtils.js +100 -0
- package/dist/src/languages/typescript/index.d.ts +14 -0
- package/dist/src/languages/typescript/index.d.ts.map +1 -0
- package/dist/src/languages/typescript/index.js +25 -0
- package/dist/src/lib/index.d.ts +228 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +486 -0
- package/dist/src/mcp/client/index.d.ts +37 -0
- package/dist/src/mcp/client/index.d.ts.map +1 -0
- package/dist/src/mcp/client/index.js +235 -0
- package/dist/src/mcp/config.d.ts +50 -0
- package/dist/src/mcp/config.d.ts.map +1 -0
- package/dist/src/mcp/config.js +125 -0
- package/dist/src/mcp/events.d.ts +24 -0
- package/dist/src/mcp/events.d.ts.map +1 -0
- package/dist/src/mcp/events.js +48 -0
- package/dist/src/mcp/fallback/index.d.ts +50 -0
- package/dist/src/mcp/fallback/index.d.ts.map +1 -0
- package/dist/src/mcp/fallback/index.js +216 -0
- package/dist/src/mcp/index.d.ts +67 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +212 -0
- package/dist/src/mcp/normalizer.d.ts +21 -0
- package/dist/src/mcp/normalizer.d.ts.map +1 -0
- package/dist/src/mcp/normalizer.js +99 -0
- package/dist/src/mcp/prompts/index.d.ts +86 -0
- package/dist/src/mcp/prompts/index.d.ts.map +1 -0
- package/dist/src/mcp/prompts/index.js +304 -0
- package/dist/src/mcp/templates/index.d.ts +35 -0
- package/dist/src/mcp/templates/index.d.ts.map +1 -0
- package/dist/src/mcp/templates/index.js +143 -0
- package/dist/src/mcp/testing/mock-server/index.d.ts +47 -0
- package/dist/src/mcp/testing/mock-server/index.d.ts.map +1 -0
- package/dist/src/mcp/testing/mock-server/index.js +157 -0
- package/dist/src/mcp/types.d.ts +127 -0
- package/dist/src/mcp/types.d.ts.map +1 -0
- package/dist/src/mcp/types.js +8 -0
- package/dist/src/observability.d.ts +138 -0
- package/dist/src/observability.d.ts.map +1 -0
- package/dist/src/observability.js +519 -0
- package/dist/src/parameterCoverage.d.ts +75 -0
- package/dist/src/parameterCoverage.d.ts.map +1 -0
- package/dist/src/parameterCoverage.js +629 -0
- package/dist/src/perfResilienceCoverage.d.ts +155 -0
- package/dist/src/perfResilienceCoverage.d.ts.map +1 -0
- package/dist/src/perfResilienceCoverage.js +670 -0
- package/dist/src/pluginLoader.d.ts +51 -0
- package/dist/src/pluginLoader.d.ts.map +1 -0
- package/dist/src/pluginLoader.js +72 -0
- package/dist/src/publishing.d.ts +63 -0
- package/dist/src/publishing.d.ts.map +1 -0
- package/dist/src/publishing.js +379 -0
- package/dist/src/qualityGate.d.ts +58 -0
- package/dist/src/qualityGate.d.ts.map +1 -0
- package/dist/src/qualityGate.js +118 -0
- package/dist/src/reporting.d.ts +41 -0
- package/dist/src/reporting.d.ts.map +1 -0
- package/dist/src/reporting.js +278 -0
- package/dist/src/screenshots.d.ts +71 -0
- package/dist/src/screenshots.d.ts.map +1 -0
- package/dist/src/screenshots.js +141 -0
- package/dist/src/security/gate/index.d.ts +11 -0
- package/dist/src/security/gate/index.d.ts.map +1 -0
- package/dist/src/security/gate/index.js +65 -0
- package/dist/src/security/index.d.ts +30 -0
- package/dist/src/security/index.d.ts.map +1 -0
- package/dist/src/security/index.js +342 -0
- package/dist/src/security/normalizers/semgrep.d.ts +10 -0
- package/dist/src/security/normalizers/semgrep.d.ts.map +1 -0
- package/dist/src/security/normalizers/semgrep.js +104 -0
- package/dist/src/security/normalizers/trivy.d.ts +10 -0
- package/dist/src/security/normalizers/trivy.d.ts.map +1 -0
- package/dist/src/security/normalizers/trivy.js +78 -0
- package/dist/src/security/normalizers/zap.d.ts +10 -0
- package/dist/src/security/normalizers/zap.d.ts.map +1 -0
- package/dist/src/security/normalizers/zap.js +104 -0
- package/dist/src/security/scanners/semgrep.d.ts +6 -0
- package/dist/src/security/scanners/semgrep.d.ts.map +1 -0
- package/dist/src/security/scanners/semgrep.js +125 -0
- package/dist/src/security/scanners/trivy.d.ts +6 -0
- package/dist/src/security/scanners/trivy.d.ts.map +1 -0
- package/dist/src/security/scanners/trivy.js +115 -0
- package/dist/src/security/scanners/zap.d.ts +6 -0
- package/dist/src/security/scanners/zap.d.ts.map +1 -0
- package/dist/src/security/scanners/zap.js +135 -0
- package/dist/src/security/types.d.ts +146 -0
- package/dist/src/security/types.d.ts.map +1 -0
- package/dist/src/security/types.js +6 -0
- package/dist/src/securityCoverage.d.ts +116 -0
- package/dist/src/securityCoverage.d.ts.map +1 -0
- package/dist/src/securityCoverage.js +725 -0
- package/dist/src/summary/buildSummary.d.ts +28 -0
- package/dist/src/summary/buildSummary.d.ts.map +1 -0
- package/dist/src/summary/buildSummary.js +257 -0
- package/dist/src/summary/evaluateMetrics.d.ts +31 -0
- package/dist/src/summary/evaluateMetrics.d.ts.map +1 -0
- package/dist/src/summary/evaluateMetrics.js +118 -0
- package/dist/src/summary/index.d.ts +10 -0
- package/dist/src/summary/index.d.ts.map +1 -0
- package/dist/src/summary/index.js +22 -0
- package/dist/src/summary/markdownRenderer.d.ts +139 -0
- package/dist/src/summary/markdownRenderer.d.ts.map +1 -0
- package/dist/src/summary/markdownRenderer.js +459 -0
- package/dist/src/summary/prSummary.d.ts +24 -0
- package/dist/src/summary/prSummary.d.ts.map +1 -0
- package/dist/src/summary/prSummary.js +233 -0
- package/dist/src/summary/summaryTypes.d.ts +35 -0
- package/dist/src/summary/summaryTypes.d.ts.map +1 -0
- package/dist/src/summary/summaryTypes.js +27 -0
- package/package.json +84 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JavaScript/TypeScript AST parser.
|
|
3
|
+
*
|
|
4
|
+
* Uses @typescript-eslint/typescript-estree which handles both JS and TS
|
|
5
|
+
* files using the TypeScript compiler's parser in tolerant mode.
|
|
6
|
+
*/
|
|
7
|
+
import type { ParsedSourceFile, SupportedLanguage } from '../../ast/astTypes';
|
|
8
|
+
/**
|
|
9
|
+
* Parse a JS or TS source file using @typescript-eslint/typescript-estree.
|
|
10
|
+
*
|
|
11
|
+
* Never throws. Sets `parseError` if parsing fails so the caller can fall back.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseJsTs(filePath: string, content: string, language?: SupportedLanguage): ParsedSourceFile;
|
|
14
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/languages/javascript/parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,iBAAgC,GACzC,gBAAgB,CAsBlB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* JavaScript/TypeScript AST parser.
|
|
4
|
+
*
|
|
5
|
+
* Uses @typescript-eslint/typescript-estree which handles both JS and TS
|
|
6
|
+
* files using the TypeScript compiler's parser in tolerant mode.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.parseJsTs = parseJsTs;
|
|
10
|
+
/**
|
|
11
|
+
* Parse a JS or TS source file using @typescript-eslint/typescript-estree.
|
|
12
|
+
*
|
|
13
|
+
* Never throws. Sets `parseError` if parsing fails so the caller can fall back.
|
|
14
|
+
*/
|
|
15
|
+
function parseJsTs(filePath, content, language = 'typescript') {
|
|
16
|
+
try {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
18
|
+
const { parse } = require('@typescript-eslint/typescript-estree');
|
|
19
|
+
const ast = parse(content, {
|
|
20
|
+
jsx: filePath.endsWith('.jsx') || filePath.endsWith('.tsx'),
|
|
21
|
+
range: true,
|
|
22
|
+
loc: true,
|
|
23
|
+
// tolerant: do not throw on recoverable syntax errors in test files
|
|
24
|
+
errorOnUnknownASTType: false,
|
|
25
|
+
allowInvalidAST: true,
|
|
26
|
+
});
|
|
27
|
+
return { filePath, language, ast, content };
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
return {
|
|
31
|
+
filePath,
|
|
32
|
+
language,
|
|
33
|
+
ast: null,
|
|
34
|
+
content,
|
|
35
|
+
parseError: err instanceof Error ? err : new Error(String(err)),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JavaScript/TypeScript symbol resolver.
|
|
3
|
+
*
|
|
4
|
+
* Walks a @typescript-eslint/typescript-estree AST and extracts:
|
|
5
|
+
* - top-level const/let/var declarations with string literal values
|
|
6
|
+
* - TypeScript enum declarations with string member values
|
|
7
|
+
* - object property constants: const Routes = { USERS: '/users' }
|
|
8
|
+
*
|
|
9
|
+
* The extracted symbols are stored in a flat map keyed by identifier name
|
|
10
|
+
* (for simple constants) or "Object.MEMBER" notation (for object properties
|
|
11
|
+
* and enum members) so that call-site references like `Routes.USERS` resolve.
|
|
12
|
+
*/
|
|
13
|
+
import type { SemanticSymbol } from '../../ast/astTypes';
|
|
14
|
+
type AstNode = any;
|
|
15
|
+
/**
|
|
16
|
+
* Extract all statically-known string symbols from the AST.
|
|
17
|
+
* Returns two maps:
|
|
18
|
+
* constants — module-level named constants
|
|
19
|
+
* localVariables — function-scoped variables (populated per-function by callResolver)
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractSymbols(ast: AstNode): {
|
|
22
|
+
constants: Map<string, SemanticSymbol>;
|
|
23
|
+
localVariables: Map<string, SemanticSymbol>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a token (variable name or dotted path) against a symbol map.
|
|
27
|
+
* e.g. "Routes.USERS" → "/users"
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveSymbol(token: string, constants: Map<string, SemanticSymbol>, localVars?: Map<string, SemanticSymbol>): string | undefined;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=symbolResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbolResolver.d.ts","sourceRoot":"","sources":["../../../../src/languages/javascript/symbolResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,OAAO,GAAG,GAAG,CAAC;AAEnB;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG;IAC5C,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC7C,CAWA;AA8JD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EACtC,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GACtC,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* JavaScript/TypeScript symbol resolver.
|
|
4
|
+
*
|
|
5
|
+
* Walks a @typescript-eslint/typescript-estree AST and extracts:
|
|
6
|
+
* - top-level const/let/var declarations with string literal values
|
|
7
|
+
* - TypeScript enum declarations with string member values
|
|
8
|
+
* - object property constants: const Routes = { USERS: '/users' }
|
|
9
|
+
*
|
|
10
|
+
* The extracted symbols are stored in a flat map keyed by identifier name
|
|
11
|
+
* (for simple constants) or "Object.MEMBER" notation (for object properties
|
|
12
|
+
* and enum members) so that call-site references like `Routes.USERS` resolve.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.extractSymbols = extractSymbols;
|
|
16
|
+
exports.resolveSymbol = resolveSymbol;
|
|
17
|
+
/**
|
|
18
|
+
* Extract all statically-known string symbols from the AST.
|
|
19
|
+
* Returns two maps:
|
|
20
|
+
* constants — module-level named constants
|
|
21
|
+
* localVariables — function-scoped variables (populated per-function by callResolver)
|
|
22
|
+
*/
|
|
23
|
+
function extractSymbols(ast) {
|
|
24
|
+
const constants = new Map();
|
|
25
|
+
const localVariables = new Map();
|
|
26
|
+
if (!ast || !ast.body)
|
|
27
|
+
return { constants, localVariables };
|
|
28
|
+
for (const node of ast.body) {
|
|
29
|
+
visitTopLevelNode(node, constants);
|
|
30
|
+
}
|
|
31
|
+
return { constants, localVariables };
|
|
32
|
+
}
|
|
33
|
+
function visitTopLevelNode(node, map) {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
if (!node)
|
|
36
|
+
return;
|
|
37
|
+
switch (node.type) {
|
|
38
|
+
case 'VariableDeclaration':
|
|
39
|
+
for (const decl of (_a = node.declarations) !== null && _a !== void 0 ? _a : []) {
|
|
40
|
+
extractVariableDecl(decl, (_b = node.kind) !== null && _b !== void 0 ? _b : 'var', map);
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
case 'ExportNamedDeclaration':
|
|
44
|
+
if (node.declaration)
|
|
45
|
+
visitTopLevelNode(node.declaration, map);
|
|
46
|
+
break;
|
|
47
|
+
case 'TSEnumDeclaration':
|
|
48
|
+
extractTsEnum(node, map);
|
|
49
|
+
break;
|
|
50
|
+
case 'ExpressionStatement':
|
|
51
|
+
// module.exports = { ... }
|
|
52
|
+
if (((_c = node.expression) === null || _c === void 0 ? void 0 : _c.type) === 'AssignmentExpression') {
|
|
53
|
+
extractModuleExports(node.expression, map);
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function extractVariableDecl(decl, kind, map) {
|
|
59
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
60
|
+
if (!(decl === null || decl === void 0 ? void 0 : decl.id) || !decl.init)
|
|
61
|
+
return;
|
|
62
|
+
const name = decl.id.name;
|
|
63
|
+
if (!name)
|
|
64
|
+
return;
|
|
65
|
+
const line = (_b = (_a = decl.id.loc) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.line;
|
|
66
|
+
// Simple string: const USERS = '/users'
|
|
67
|
+
if (decl.init.type === 'Literal' && typeof decl.init.value === 'string') {
|
|
68
|
+
map.set(name, {
|
|
69
|
+
name,
|
|
70
|
+
kind: kind,
|
|
71
|
+
value: decl.init.value,
|
|
72
|
+
resolvedValue: decl.init.value,
|
|
73
|
+
line,
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Template literal with no expressions: const USERS = `/users`
|
|
78
|
+
if (decl.init.type === 'TemplateLiteral' &&
|
|
79
|
+
((_c = decl.init.expressions) === null || _c === void 0 ? void 0 : _c.length) === 0 &&
|
|
80
|
+
((_d = decl.init.quasis) === null || _d === void 0 ? void 0 : _d.length) === 1) {
|
|
81
|
+
const raw = (_k = (_g = (_f = (_e = decl.init.quasis[0]) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.cooked) !== null && _g !== void 0 ? _g : (_j = (_h = decl.init.quasis[0]) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.raw) !== null && _k !== void 0 ? _k : '';
|
|
82
|
+
map.set(name, { name, kind: kind, value: raw, resolvedValue: raw, line });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// Object literal with string properties: const Routes = { USERS: '/users' }
|
|
86
|
+
if (decl.init.type === 'ObjectExpression') {
|
|
87
|
+
extractObjectProps(name, decl.init, kind, map);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// "as const" satisfies pattern: treat the inner value
|
|
91
|
+
if (decl.init.type === 'TSAsExpression' || decl.init.type === 'TSSatisfiesExpression') {
|
|
92
|
+
const inner = { ...decl, init: decl.init.expression };
|
|
93
|
+
extractVariableDecl(inner, kind, map);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function extractObjectProps(prefix, objNode, kind, map) {
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
99
|
+
for (const prop of (_a = objNode.properties) !== null && _a !== void 0 ? _a : []) {
|
|
100
|
+
if (prop.type !== 'Property' && prop.type !== 'ObjectProperty')
|
|
101
|
+
continue;
|
|
102
|
+
const keyName = (_c = (_b = prop.key) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : (_d = prop.key) === null || _d === void 0 ? void 0 : _d.value;
|
|
103
|
+
if (!keyName)
|
|
104
|
+
continue;
|
|
105
|
+
const fullName = `${prefix}.${keyName}`;
|
|
106
|
+
const line = (_f = (_e = prop.loc) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.line;
|
|
107
|
+
if (((_g = prop.value) === null || _g === void 0 ? void 0 : _g.type) === 'Literal' && typeof prop.value.value === 'string') {
|
|
108
|
+
map.set(fullName, {
|
|
109
|
+
name: fullName,
|
|
110
|
+
kind: 'const',
|
|
111
|
+
value: prop.value.value,
|
|
112
|
+
resolvedValue: prop.value.value,
|
|
113
|
+
line,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else if (((_h = prop.value) === null || _h === void 0 ? void 0 : _h.type) === 'ObjectExpression') {
|
|
117
|
+
// Nested objects: const Routes = { USER: { LIST: '/users' } }
|
|
118
|
+
extractObjectProps(fullName, prop.value, kind, map);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function extractTsEnum(node, map) {
|
|
123
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
124
|
+
const enumName = (_a = node.id) === null || _a === void 0 ? void 0 : _a.name;
|
|
125
|
+
if (!enumName)
|
|
126
|
+
return;
|
|
127
|
+
for (const member of (_b = node.members) !== null && _b !== void 0 ? _b : []) {
|
|
128
|
+
const memberName = (_d = (_c = member.id) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : (_e = member.id) === null || _e === void 0 ? void 0 : _e.value;
|
|
129
|
+
if (!memberName)
|
|
130
|
+
continue;
|
|
131
|
+
const fullName = `${enumName}.${memberName}`;
|
|
132
|
+
const line = (_g = (_f = member.loc) === null || _f === void 0 ? void 0 : _f.start) === null || _g === void 0 ? void 0 : _g.line;
|
|
133
|
+
if (((_h = member.initializer) === null || _h === void 0 ? void 0 : _h.type) === 'Literal' && typeof member.initializer.value === 'string') {
|
|
134
|
+
map.set(fullName, {
|
|
135
|
+
name: fullName,
|
|
136
|
+
kind: 'enum-member',
|
|
137
|
+
value: member.initializer.value,
|
|
138
|
+
resolvedValue: member.initializer.value,
|
|
139
|
+
line,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function extractModuleExports(assign, map) {
|
|
145
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
146
|
+
// module.exports = { USERS: '/users' }
|
|
147
|
+
const left = assign.left;
|
|
148
|
+
const right = assign.right;
|
|
149
|
+
if (((_a = left === null || left === void 0 ? void 0 : left.object) === null || _a === void 0 ? void 0 : _a.name) === 'module' &&
|
|
150
|
+
((_b = left === null || left === void 0 ? void 0 : left.property) === null || _b === void 0 ? void 0 : _b.name) === 'exports' &&
|
|
151
|
+
(right === null || right === void 0 ? void 0 : right.type) === 'ObjectExpression') {
|
|
152
|
+
extractObjectProps('exports', right, 'const', map);
|
|
153
|
+
// Also index without prefix for default patterns
|
|
154
|
+
for (const prop of (_c = right.properties) !== null && _c !== void 0 ? _c : []) {
|
|
155
|
+
if (prop.type !== 'Property')
|
|
156
|
+
continue;
|
|
157
|
+
const keyName = (_e = (_d = prop.key) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : (_f = prop.key) === null || _f === void 0 ? void 0 : _f.value;
|
|
158
|
+
if (!keyName)
|
|
159
|
+
continue;
|
|
160
|
+
if (((_g = prop.value) === null || _g === void 0 ? void 0 : _g.type) === 'Literal' && typeof prop.value.value === 'string') {
|
|
161
|
+
map.set(keyName, {
|
|
162
|
+
name: keyName,
|
|
163
|
+
kind: 'const',
|
|
164
|
+
value: prop.value.value,
|
|
165
|
+
resolvedValue: prop.value.value,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Resolve a token (variable name or dotted path) against a symbol map.
|
|
173
|
+
* e.g. "Routes.USERS" → "/users"
|
|
174
|
+
*/
|
|
175
|
+
function resolveSymbol(token, constants, localVars) {
|
|
176
|
+
const local = localVars === null || localVars === void 0 ? void 0 : localVars.get(token);
|
|
177
|
+
if ((local === null || local === void 0 ? void 0 : local.resolvedValue) !== undefined)
|
|
178
|
+
return local.resolvedValue;
|
|
179
|
+
const sym = constants.get(token);
|
|
180
|
+
if ((sym === null || sym === void 0 ? void 0 : sym.resolvedValue) !== undefined)
|
|
181
|
+
return sym.resolvedValue;
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kotlin language analyzer.
|
|
3
|
+
* Reuses Java semantic builder logic since Kotlin syntax is similar for HTTP patterns.
|
|
4
|
+
*/
|
|
5
|
+
import type { LanguageAnalyzer } from '../../ast/languageAnalyzer';
|
|
6
|
+
import type { SupportedLanguage, ParsedSourceFile, SemanticModel, ResolvedHttpInteraction, SemanticAssertion, BusinessRuleRef, FlowRef, AnalysisContext } from '../../ast/astTypes';
|
|
7
|
+
export declare class KotlinAnalyzer implements LanguageAnalyzer {
|
|
8
|
+
readonly language: SupportedLanguage;
|
|
9
|
+
parse(filePath: string, content: string): ParsedSourceFile;
|
|
10
|
+
buildSemanticModel(parsed: ParsedSourceFile, _context: AnalysisContext): SemanticModel;
|
|
11
|
+
extractHttpInteractions(model: SemanticModel, _context: AnalysisContext): ResolvedHttpInteraction[];
|
|
12
|
+
extractAssertions(model: SemanticModel): SemanticAssertion[];
|
|
13
|
+
extractBusinessRuleRefs(model: SemanticModel): BusinessRuleRef[];
|
|
14
|
+
extractFlowRefs(model: SemanticModel): FlowRef[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/languages/kotlin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAmB5B,qBAAa,cAAe,YAAW,gBAAgB;IACrD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAY;IAEhD,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAI1D,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,GAAG,aAAa;IAqCtF,uBAAuB,CACrB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,eAAe,GACxB,uBAAuB,EAAE;IA2B5B,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,iBAAiB,EAAE;IAG5D,uBAAuB,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,EAAE;IAGhE,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,EAAE;CAGjD"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Kotlin language analyzer.
|
|
4
|
+
* Reuses Java semantic builder logic since Kotlin syntax is similar for HTTP patterns.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.KotlinAnalyzer = void 0;
|
|
8
|
+
const parserRegistry_1 = require("../../ast/parserRegistry");
|
|
9
|
+
const parser_1 = require("./parser");
|
|
10
|
+
const semanticBuilder_1 = require("../java/semanticBuilder");
|
|
11
|
+
const treeSitterUtils_1 = require("../shared/treeSitterUtils");
|
|
12
|
+
const resolvePaths_1 = require("../../coverage/deep-analysis/resolvePaths");
|
|
13
|
+
class KotlinAnalyzer {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.language = 'kotlin';
|
|
16
|
+
}
|
|
17
|
+
parse(filePath, content) {
|
|
18
|
+
return (0, parser_1.parseKotlin)(filePath, content);
|
|
19
|
+
}
|
|
20
|
+
buildSemanticModel(parsed, _context) {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
const astPayload = parsed.ast;
|
|
23
|
+
const root = (_c = (_b = (_a = astPayload === null || astPayload === void 0 ? void 0 : astPayload.tree) === null || _a === void 0 ? void 0 : _a.rootNode) !== null && _b !== void 0 ? _b : astPayload === null || astPayload === void 0 ? void 0 : astPayload.rootNode) !== null && _c !== void 0 ? _c : astPayload;
|
|
24
|
+
if (!root) {
|
|
25
|
+
return emptyModel(parsed.filePath, 'kotlin');
|
|
26
|
+
}
|
|
27
|
+
// Use Java semantic builder as base (reuses tree-sitter traversal)
|
|
28
|
+
const { constants, enums } = (0, semanticBuilder_1.extractJavaSymbols)(root);
|
|
29
|
+
// Augment with Kotlin-specific: val/var top-level properties
|
|
30
|
+
extractKotlinProperties(root, constants);
|
|
31
|
+
const functions = (0, semanticBuilder_1.extractJavaFunctions)(root, constants);
|
|
32
|
+
// Add Ktor-specific HTTP calls
|
|
33
|
+
augmentWithKtorCalls(root, constants, functions);
|
|
34
|
+
const assertions = (0, semanticBuilder_1.extractJavaAssertions)(root);
|
|
35
|
+
const businessRuleRefs = (0, semanticBuilder_1.extractJavaBusinessRuleRefs)(root);
|
|
36
|
+
const flowRefs = (0, semanticBuilder_1.extractJavaFlowRefs)(root);
|
|
37
|
+
return {
|
|
38
|
+
filePath: parsed.filePath,
|
|
39
|
+
language: 'kotlin',
|
|
40
|
+
localVariables: new Map(),
|
|
41
|
+
constants,
|
|
42
|
+
enums,
|
|
43
|
+
functions,
|
|
44
|
+
httpInteractions: [],
|
|
45
|
+
assertions,
|
|
46
|
+
businessRuleRefs,
|
|
47
|
+
flowRefs,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
extractHttpInteractions(model, _context) {
|
|
51
|
+
var _a;
|
|
52
|
+
const results = [];
|
|
53
|
+
const seen = new Set();
|
|
54
|
+
for (const fn of model.functions.values()) {
|
|
55
|
+
for (const c of fn.bodyHttpCalls) {
|
|
56
|
+
const path = (_a = c.resolvedPath) !== null && _a !== void 0 ? _a : c.rawPathArg;
|
|
57
|
+
if (!path)
|
|
58
|
+
continue;
|
|
59
|
+
const key = `${c.method}:${path}`;
|
|
60
|
+
if (seen.has(key))
|
|
61
|
+
continue;
|
|
62
|
+
seen.add(key);
|
|
63
|
+
const normalizedPath = path.startsWith('/') ? (0, resolvePaths_1.normalizePathToTemplate)(path) : undefined;
|
|
64
|
+
results.push({
|
|
65
|
+
method: c.method,
|
|
66
|
+
path,
|
|
67
|
+
normalizedPath,
|
|
68
|
+
sourceFile: model.filePath,
|
|
69
|
+
sourceLanguage: 'kotlin',
|
|
70
|
+
resolutionType: c.resolutionType,
|
|
71
|
+
confidence: c.confidence,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return results;
|
|
76
|
+
}
|
|
77
|
+
extractAssertions(model) {
|
|
78
|
+
return model.assertions;
|
|
79
|
+
}
|
|
80
|
+
extractBusinessRuleRefs(model) {
|
|
81
|
+
return model.businessRuleRefs;
|
|
82
|
+
}
|
|
83
|
+
extractFlowRefs(model) {
|
|
84
|
+
return model.flowRefs;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.KotlinAnalyzer = KotlinAnalyzer;
|
|
88
|
+
/** Extract Kotlin val/var property declarations */
|
|
89
|
+
function extractKotlinProperties(root, constants) {
|
|
90
|
+
var _a, _b, _c;
|
|
91
|
+
// Kotlin tree-sitter uses property_declaration
|
|
92
|
+
const propDecls = (0, treeSitterUtils_1.findNodes)(root, ['property_declaration']);
|
|
93
|
+
for (const prop of propDecls) {
|
|
94
|
+
const nameNode = (_a = (0, treeSitterUtils_1.firstChildOfType)(prop, 'simple_identifier')) !== null && _a !== void 0 ? _a : (0, treeSitterUtils_1.firstChildOfType)(prop, 'identifier');
|
|
95
|
+
const valueNode = (0, treeSitterUtils_1.firstChildOfType)(prop, 'string_literal');
|
|
96
|
+
if (nameNode && valueNode) {
|
|
97
|
+
const name = (_b = nameNode.text) !== null && _b !== void 0 ? _b : '';
|
|
98
|
+
const value = (_c = (0, treeSitterUtils_1.extractStringValue)(valueNode)) !== null && _c !== void 0 ? _c : '';
|
|
99
|
+
if (name && value.startsWith('/')) {
|
|
100
|
+
constants.set(name, { name, kind: 'const', value, resolvedValue: value });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Detect Ktor client DSL: client.get("/path") { ... } */
|
|
106
|
+
function augmentWithKtorCalls(root, constants, functions) {
|
|
107
|
+
var _a, _b;
|
|
108
|
+
// Ktor uses call_expression with method name get/post/put etc.
|
|
109
|
+
const callExprs = (0, treeSitterUtils_1.findNodes)(root, ['call_expression', 'function_call']);
|
|
110
|
+
for (const call of callExprs) {
|
|
111
|
+
const callText = (_a = call.text) !== null && _a !== void 0 ? _a : '';
|
|
112
|
+
// Heuristic: detect client.METHOD("/path")
|
|
113
|
+
const ktorMatch = callText.match(/(?:client|httpClient)\.(get|post|put|patch|delete)\s*[\({]\s*["'`]([^"'`]+)["'`]/);
|
|
114
|
+
if (ktorMatch) {
|
|
115
|
+
const [, method, path] = ktorMatch;
|
|
116
|
+
const fakeCall = {
|
|
117
|
+
method: method.toUpperCase(),
|
|
118
|
+
rawPathArg: path,
|
|
119
|
+
resolvedPath: path,
|
|
120
|
+
normalizedPath: path.startsWith('/') ? (0, resolvePaths_1.normalizePathToTemplate)(path) : undefined,
|
|
121
|
+
resolutionType: 'direct',
|
|
122
|
+
confidence: 'high',
|
|
123
|
+
};
|
|
124
|
+
// Attach to a synthetic function
|
|
125
|
+
const syntheticFn = (_b = functions.get('_kotlin_ktor_calls')) !== null && _b !== void 0 ? _b : {
|
|
126
|
+
name: '_kotlin_ktor_calls',
|
|
127
|
+
parameters: [],
|
|
128
|
+
bodyHttpCalls: [],
|
|
129
|
+
calledFunctions: [],
|
|
130
|
+
};
|
|
131
|
+
syntheticFn.bodyHttpCalls.push(fakeCall);
|
|
132
|
+
functions.set('_kotlin_ktor_calls', syntheticFn);
|
|
133
|
+
}
|
|
134
|
+
void constants; // suppress unused warning
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function emptyModel(filePath, language) {
|
|
138
|
+
return {
|
|
139
|
+
filePath,
|
|
140
|
+
language,
|
|
141
|
+
localVariables: new Map(),
|
|
142
|
+
constants: new Map(),
|
|
143
|
+
enums: new Map(),
|
|
144
|
+
functions: new Map(),
|
|
145
|
+
httpInteractions: [],
|
|
146
|
+
assertions: [],
|
|
147
|
+
businessRuleRefs: [],
|
|
148
|
+
flowRefs: [],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
(0, parserRegistry_1.registerAnalyzer)('kotlin', () => new KotlinAnalyzer());
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kotlin AST parser.
|
|
3
|
+
*
|
|
4
|
+
* Three-tier fallback:
|
|
5
|
+
* 1. tree-sitter-kotlin (if available on npm)
|
|
6
|
+
* 2. tree-sitter-java (approximate — syntax is close enough for basic detection)
|
|
7
|
+
* 3. parse error → orchestrator uses regex fallback
|
|
8
|
+
*/
|
|
9
|
+
import type { ParsedSourceFile } from '../../ast/astTypes';
|
|
10
|
+
export declare function parseKotlin(filePath: string, content: string): ParsedSourceFile;
|
|
11
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/languages/kotlin/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAoC3D,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CA6B/E"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Kotlin AST parser.
|
|
4
|
+
*
|
|
5
|
+
* Three-tier fallback:
|
|
6
|
+
* 1. tree-sitter-kotlin (if available on npm)
|
|
7
|
+
* 2. tree-sitter-java (approximate — syntax is close enough for basic detection)
|
|
8
|
+
* 3. parse error → orchestrator uses regex fallback
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.parseKotlin = parseKotlin;
|
|
12
|
+
const treeSitterUtils_1 = require("../shared/treeSitterUtils");
|
|
13
|
+
let cachedParser = undefined;
|
|
14
|
+
let parserLoaded = false;
|
|
15
|
+
function getKotlinParser() {
|
|
16
|
+
if (!parserLoaded) {
|
|
17
|
+
parserLoaded = true;
|
|
18
|
+
// Tier 1: tree-sitter-kotlin
|
|
19
|
+
try {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
|
+
const grammar = require('tree-sitter-kotlin');
|
|
22
|
+
const parser = (0, treeSitterUtils_1.createParser)(grammar);
|
|
23
|
+
if (parser) {
|
|
24
|
+
cachedParser = { parser, approximate: false };
|
|
25
|
+
return cachedParser;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch { /* not available */ }
|
|
29
|
+
// Tier 2: tree-sitter-java as approximation
|
|
30
|
+
try {
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
32
|
+
const grammar = require('tree-sitter-java');
|
|
33
|
+
const parser = (0, treeSitterUtils_1.createParser)(grammar);
|
|
34
|
+
if (parser) {
|
|
35
|
+
cachedParser = { parser, approximate: true };
|
|
36
|
+
return cachedParser;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch { /* not available */ }
|
|
40
|
+
cachedParser = null;
|
|
41
|
+
}
|
|
42
|
+
return cachedParser;
|
|
43
|
+
}
|
|
44
|
+
function parseKotlin(filePath, content) {
|
|
45
|
+
const result = getKotlinParser();
|
|
46
|
+
if (!result) {
|
|
47
|
+
return {
|
|
48
|
+
filePath,
|
|
49
|
+
language: 'kotlin',
|
|
50
|
+
ast: null,
|
|
51
|
+
content,
|
|
52
|
+
parseError: new Error('No Kotlin parser available'),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
const tree = result.parser.parse(content);
|
|
58
|
+
return {
|
|
59
|
+
filePath,
|
|
60
|
+
language: 'kotlin',
|
|
61
|
+
ast: { tree, approximate: result.approximate },
|
|
62
|
+
content,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return {
|
|
67
|
+
filePath,
|
|
68
|
+
language: 'kotlin',
|
|
69
|
+
ast: null,
|
|
70
|
+
content,
|
|
71
|
+
parseError: err instanceof Error ? err : new Error(String(err)),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python language analyzer using tree-sitter-python.
|
|
3
|
+
*/
|
|
4
|
+
import type { LanguageAnalyzer } from '../../ast/languageAnalyzer';
|
|
5
|
+
import type { SupportedLanguage, ParsedSourceFile, SemanticModel, ResolvedHttpInteraction, SemanticAssertion, BusinessRuleRef, FlowRef, AnalysisContext } from '../../ast/astTypes';
|
|
6
|
+
export declare class PythonAnalyzer implements LanguageAnalyzer {
|
|
7
|
+
readonly language: SupportedLanguage;
|
|
8
|
+
parse(filePath: string, content: string): ParsedSourceFile;
|
|
9
|
+
buildSemanticModel(parsed: ParsedSourceFile, _context: AnalysisContext): SemanticModel;
|
|
10
|
+
extractHttpInteractions(model: SemanticModel, _ctx: AnalysisContext): ResolvedHttpInteraction[];
|
|
11
|
+
extractAssertions(model: SemanticModel): SemanticAssertion[];
|
|
12
|
+
extractBusinessRuleRefs(model: SemanticModel): BusinessRuleRef[];
|
|
13
|
+
extractFlowRefs(_model: SemanticModel): FlowRef[];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/languages/python/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EAIb,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,eAAe,EAChB,MAAM,oBAAoB,CAAC;AA8B5B,qBAAa,cAAe,YAAW,gBAAgB;IACrD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAY;IAEhD,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAc1D,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,GAAG,aAAa;IAuBtF,uBAAuB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,GAAG,uBAAuB,EAAE;IAwB/F,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,iBAAiB,EAAE;IAG5D,uBAAuB,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,EAAE;IAGhE,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,EAAE;CAGlD"}
|