code-auditor-mcp 4.1.1 → 5.0.2
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +381 -0
- package/README.md +4 -4
- package/configs/hhra-compat.json +0 -8
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts +1 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js +7 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts +2 -8
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js +4 -4
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts +1 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts +2 -2
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts +1 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js.map +1 -1
- package/dist/analyzers/applicability.d.ts +42 -0
- package/dist/analyzers/applicability.d.ts.map +1 -1
- package/dist/analyzers/applicability.js +74 -0
- package/dist/analyzers/applicability.js.map +1 -1
- package/dist/analyzers/cross-language/APIContractAnalyzer.js +18 -24
- package/dist/analyzers/cross-language/APIContractAnalyzer.js.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts +30 -23
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js +113 -76
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.d.ts +2 -0
- package/dist/analyzers/cross-language/SchemaValidator.d.ts.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.js +8 -3
- package/dist/analyzers/cross-language/SchemaValidator.js.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +210 -148
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -1
- package/dist/analyzers/documentationAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/documentationAnalyzer.js +23 -28
- package/dist/analyzers/documentationAnalyzer.js.map +1 -1
- package/dist/analyzers/handleIdentification.d.ts +356 -0
- package/dist/analyzers/handleIdentification.d.ts.map +1 -0
- package/dist/analyzers/handleIdentification.js +427 -0
- package/dist/analyzers/handleIdentification.js.map +1 -0
- package/dist/analyzers/manifestStaleness.d.ts +64 -0
- package/dist/analyzers/manifestStaleness.d.ts.map +1 -0
- package/dist/analyzers/manifestStaleness.js +115 -0
- package/dist/analyzers/manifestStaleness.js.map +1 -0
- package/dist/analyzers/orgFilterTiers.d.ts +73 -1
- package/dist/analyzers/orgFilterTiers.d.ts.map +1 -1
- package/dist/analyzers/orgFilterTiers.js +166 -1
- package/dist/analyzers/orgFilterTiers.js.map +1 -1
- package/dist/analyzers/provenance.d.ts +251 -57
- package/dist/analyzers/provenance.d.ts.map +1 -1
- package/dist/analyzers/provenance.js +1109 -429
- package/dist/analyzers/provenance.js.map +1 -1
- package/dist/analyzers/reactAnalyzer.d.ts +2 -0
- package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/reactAnalyzer.js +2 -0
- package/dist/analyzers/reactAnalyzer.js.map +1 -1
- package/dist/analyzers/receiverResolution.d.ts +183 -0
- package/dist/analyzers/receiverResolution.d.ts.map +1 -0
- package/dist/analyzers/receiverResolution.js +540 -0
- package/dist/analyzers/receiverResolution.js.map +1 -0
- package/dist/analyzers/receiverRoot.d.ts +348 -0
- package/dist/analyzers/receiverRoot.d.ts.map +1 -0
- package/dist/analyzers/receiverRoot.js +1032 -0
- package/dist/analyzers/receiverRoot.js.map +1 -0
- package/dist/analyzers/ruleRegistry.d.ts +12 -68
- package/dist/analyzers/ruleRegistry.d.ts.map +1 -1
- package/dist/analyzers/ruleRegistry.js +32 -342
- package/dist/analyzers/ruleRegistry.js.map +1 -1
- package/dist/analyzers/ruleTiming.d.ts +10 -0
- package/dist/analyzers/ruleTiming.d.ts.map +1 -1
- package/dist/analyzers/ruleTiming.js +20 -0
- package/dist/analyzers/ruleTiming.js.map +1 -1
- package/dist/analyzers/sqlLiteral.d.ts +76 -0
- package/dist/analyzers/sqlLiteral.d.ts.map +1 -0
- package/dist/analyzers/sqlLiteral.js +419 -0
- package/dist/analyzers/sqlLiteral.js.map +1 -0
- package/dist/analyzers/tsEcosystem.d.ts +115 -0
- package/dist/analyzers/tsEcosystem.d.ts.map +1 -0
- package/dist/analyzers/tsEcosystem.js +241 -0
- package/dist/analyzers/tsEcosystem.js.map +1 -0
- package/dist/analyzers/tsExpressionDescriptor.d.ts +156 -0
- package/dist/analyzers/tsExpressionDescriptor.d.ts.map +1 -0
- package/dist/analyzers/tsExpressionDescriptor.js +374 -0
- package/dist/analyzers/tsExpressionDescriptor.js.map +1 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts +6 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +107 -44
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js +23 -35
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +287 -49
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +2130 -512
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +2 -18
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +0 -33
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +20 -143
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts +4 -3
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +36 -13
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSecretsAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSecretsAnalyzer.js +6 -0
- package/dist/analyzers/universal/UniversalSecretsAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.d.ts +15 -0
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.js +25 -0
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +21 -32
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js +166 -196
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/functionConcerns.d.ts +3 -0
- package/dist/analyzers/universal/functionConcerns.d.ts.map +1 -1
- package/dist/analyzers/universal/functionConcerns.js +4 -1
- package/dist/analyzers/universal/functionConcerns.js.map +1 -1
- package/dist/analyzers/universal/schema/codeAnalysis.d.ts +310 -69
- package/dist/analyzers/universal/schema/codeAnalysis.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/codeAnalysis.js +709 -383
- package/dist/analyzers/universal/schema/codeAnalysis.js.map +1 -1
- package/dist/analyzers/universal/schema/config.d.ts +3 -14
- package/dist/analyzers/universal/schema/config.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/config.js +3 -16
- package/dist/analyzers/universal/schema/config.js.map +1 -1
- package/dist/analyzers/universal/schema/discovery.d.ts +22 -1
- package/dist/analyzers/universal/schema/discovery.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/discovery.js +36 -20
- package/dist/analyzers/universal/schema/discovery.js.map +1 -1
- package/dist/analyzers/universal/schema/jsonSchema.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/jsonSchema.js +13 -3
- package/dist/analyzers/universal/schema/jsonSchema.js.map +1 -1
- package/dist/analyzers/universal/schema/migrations.d.ts +187 -27
- package/dist/analyzers/universal/schema/migrations.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/migrations.js +443 -186
- package/dist/analyzers/universal/schema/migrations.js.map +1 -1
- package/dist/analyzers/universal/schema/types.d.ts +17 -3
- package/dist/analyzers/universal/schema/types.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/violations.js +1 -1
- package/dist/analyzers/universal/schema/violations.js.map +1 -1
- package/dist/analyzers/universal/styleScale.d.ts +52 -0
- package/dist/analyzers/universal/styleScale.d.ts.map +1 -0
- package/dist/analyzers/universal/styleScale.js +95 -0
- package/dist/analyzers/universal/styleScale.js.map +1 -0
- package/dist/applyDataDirEnv.js +1 -1
- package/dist/applyDataDirEnv.js.map +1 -1
- package/dist/auditRouter.d.ts +26 -30
- package/dist/auditRouter.d.ts.map +1 -1
- package/dist/auditRouter.js +373 -143
- package/dist/auditRouter.js.map +1 -1
- package/dist/auditRunner.d.ts +66 -1
- package/dist/auditRunner.d.ts.map +1 -1
- package/dist/auditRunner.js +1544 -1034
- package/dist/auditRunner.js.map +1 -1
- package/dist/baseline.d.ts +30 -3
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +70 -9
- package/dist/baseline.js.map +1 -1
- package/dist/cli.js +983 -821
- package/dist/cli.js.map +1 -1
- package/dist/codeIndex/analyzerConfig.d.ts +60 -0
- package/dist/codeIndex/analyzerConfig.d.ts.map +1 -0
- package/dist/codeIndex/analyzerConfig.js +98 -0
- package/dist/codeIndex/analyzerConfig.js.map +1 -0
- package/dist/codeIndex/auditResults.d.ts +39 -0
- package/dist/codeIndex/auditResults.d.ts.map +1 -0
- package/dist/codeIndex/auditResults.js +99 -0
- package/dist/codeIndex/auditResults.js.map +1 -0
- package/dist/codeIndex/codeMap.d.ts +59 -0
- package/dist/codeIndex/codeMap.d.ts.map +1 -0
- package/dist/codeIndex/codeMap.js +72 -0
- package/dist/codeIndex/codeMap.js.map +1 -0
- package/dist/codeIndex/conventions.d.ts +33 -0
- package/dist/codeIndex/conventions.d.ts.map +1 -0
- package/dist/codeIndex/conventions.js +84 -0
- package/dist/codeIndex/conventions.js.map +1 -0
- package/dist/codeIndex/coverage.d.ts +78 -0
- package/dist/codeIndex/coverage.d.ts.map +1 -0
- package/dist/codeIndex/coverage.js +164 -0
- package/dist/codeIndex/coverage.js.map +1 -0
- package/dist/codeIndex/dependencyGraph.d.ts +97 -0
- package/dist/codeIndex/dependencyGraph.d.ts.map +1 -0
- package/dist/codeIndex/dependencyGraph.js +241 -0
- package/dist/codeIndex/dependencyGraph.js.map +1 -0
- package/dist/codeIndex/functionIndex.d.ts +111 -0
- package/dist/codeIndex/functionIndex.d.ts.map +1 -0
- package/dist/codeIndex/functionIndex.js +306 -0
- package/dist/codeIndex/functionIndex.js.map +1 -0
- package/dist/codeIndex/inferredReceivers.d.ts +32 -0
- package/dist/codeIndex/inferredReceivers.d.ts.map +1 -0
- package/dist/codeIndex/inferredReceivers.js +41 -0
- package/dist/codeIndex/inferredReceivers.js.map +1 -0
- package/dist/codeIndex/meta.d.ts +30 -0
- package/dist/codeIndex/meta.d.ts.map +1 -0
- package/dist/codeIndex/meta.js +37 -0
- package/dist/codeIndex/meta.js.map +1 -0
- package/dist/codeIndex/migrations.d.ts +96 -0
- package/dist/codeIndex/migrations.d.ts.map +1 -0
- package/dist/codeIndex/migrations.js +1302 -0
- package/dist/codeIndex/migrations.js.map +1 -0
- package/dist/codeIndex/projectTasks.d.ts +54 -0
- package/dist/codeIndex/projectTasks.d.ts.map +1 -0
- package/dist/codeIndex/projectTasks.js +81 -0
- package/dist/codeIndex/projectTasks.js.map +1 -0
- package/dist/codeIndex/provenance.d.ts +47 -0
- package/dist/codeIndex/provenance.d.ts.map +1 -0
- package/dist/codeIndex/provenance.js +48 -0
- package/dist/codeIndex/provenance.js.map +1 -0
- package/dist/codeIndex/rawSql.d.ts +54 -0
- package/dist/codeIndex/rawSql.d.ts.map +1 -0
- package/dist/codeIndex/rawSql.js +71 -0
- package/dist/codeIndex/rawSql.js.map +1 -0
- package/dist/codeIndex/schema.d.ts +99 -0
- package/dist/codeIndex/schema.d.ts.map +1 -0
- package/dist/codeIndex/schema.js +174 -0
- package/dist/codeIndex/schema.js.map +1 -0
- package/dist/codeIndex/search.d.ts +40 -0
- package/dist/codeIndex/search.d.ts.map +1 -0
- package/dist/codeIndex/search.js +316 -0
- package/dist/codeIndex/search.js.map +1 -0
- package/dist/codeIndex/shared.d.ts +27 -0
- package/dist/codeIndex/shared.d.ts.map +1 -0
- package/dist/codeIndex/shared.js +46 -0
- package/dist/codeIndex/shared.js.map +1 -0
- package/dist/codeIndex/sqliteCollection.d.ts +81 -0
- package/dist/codeIndex/sqliteCollection.d.ts.map +1 -0
- package/dist/codeIndex/sqliteCollection.js +250 -0
- package/dist/codeIndex/sqliteCollection.js.map +1 -0
- package/dist/codeIndex/whitelist.d.ts +59 -0
- package/dist/codeIndex/whitelist.d.ts.map +1 -0
- package/dist/codeIndex/whitelist.js +188 -0
- package/dist/codeIndex/whitelist.js.map +1 -0
- package/dist/codeIndexDB.d.ts +132 -271
- package/dist/codeIndexDB.d.ts.map +1 -1
- package/dist/codeIndexDB.js +365 -2729
- package/dist/codeIndexDB.js.map +1 -1
- package/dist/codeIndexService.d.ts +87 -12
- package/dist/codeIndexService.d.ts.map +1 -1
- package/dist/codeIndexService.js +110 -34
- package/dist/codeIndexService.js.map +1 -1
- package/dist/componentScanner.d.ts +35 -0
- package/dist/componentScanner.d.ts.map +1 -1
- package/dist/componentScanner.js +114 -80
- package/dist/componentScanner.js.map +1 -1
- package/dist/config/configGeneratePath.d.ts +4 -0
- package/dist/config/configGeneratePath.d.ts.map +1 -1
- package/dist/config/configGeneratePath.js +4 -0
- package/dist/config/configGeneratePath.js.map +1 -1
- package/dist/config/configLoader.d.ts +15 -0
- package/dist/config/configLoader.d.ts.map +1 -1
- package/dist/config/configLoader.js +15 -16
- package/dist/config/configLoader.js.map +1 -1
- package/dist/config/defaults.d.ts +11 -7
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +16 -14
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/effectiveConfig.d.ts +17 -2
- package/dist/config/effectiveConfig.d.ts.map +1 -1
- package/dist/config/effectiveConfig.js +32 -25
- package/dist/config/effectiveConfig.js.map +1 -1
- package/dist/config/lintConfigReader.d.ts +6 -0
- package/dist/config/lintConfigReader.d.ts.map +1 -1
- package/dist/config/lintConfigReader.js +6 -0
- package/dist/config/lintConfigReader.js.map +1 -1
- package/dist/config/staticObjectExtract.d.ts +4 -0
- package/dist/config/staticObjectExtract.d.ts.map +1 -1
- package/dist/config/staticObjectExtract.js +7 -3
- package/dist/config/staticObjectExtract.js.map +1 -1
- package/dist/config/thresholdRationales.d.ts +2 -0
- package/dist/config/thresholdRationales.d.ts.map +1 -1
- package/dist/config/thresholdRationales.js +5 -2
- package/dist/config/thresholdRationales.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/conventions/conventionMiner.d.ts +105 -2
- package/dist/conventions/conventionMiner.d.ts.map +1 -1
- package/dist/conventions/conventionMiner.js +334 -259
- package/dist/conventions/conventionMiner.js.map +1 -1
- package/dist/coverage/coverageService.js +4 -4
- package/dist/coverage/coverageService.js.map +1 -1
- package/dist/daemon/args.d.ts +3 -0
- package/dist/daemon/args.d.ts.map +1 -1
- package/dist/daemon/args.js +3 -0
- package/dist/daemon/args.js.map +1 -1
- package/dist/daemon/core.d.ts +33 -27
- package/dist/daemon/core.d.ts.map +1 -1
- package/dist/daemon/core.js +198 -162
- package/dist/daemon/core.js.map +1 -1
- package/dist/daemon/lspServer.d.ts +8 -0
- package/dist/daemon/lspServer.d.ts.map +1 -1
- package/dist/daemon/lspServer.js +8 -0
- package/dist/daemon/lspServer.js.map +1 -1
- package/dist/daemon/main.d.ts +2 -0
- package/dist/daemon/main.d.ts.map +1 -1
- package/dist/daemon/main.js +22 -4
- package/dist/daemon/main.js.map +1 -1
- package/dist/daemon/resolve.d.ts +18 -3
- package/dist/daemon/resolve.d.ts.map +1 -1
- package/dist/daemon/resolve.js +25 -4
- package/dist/daemon/resolve.js.map +1 -1
- package/dist/daemon/socketClient.d.ts +10 -1
- package/dist/daemon/socketClient.d.ts.map +1 -1
- package/dist/daemon/socketClient.js +10 -1
- package/dist/daemon/socketClient.js.map +1 -1
- package/dist/daemon/socketServer.d.ts +13 -0
- package/dist/daemon/socketServer.d.ts.map +1 -1
- package/dist/daemon/socketServer.js +13 -0
- package/dist/daemon/socketServer.js.map +1 -1
- package/dist/dataPaths.d.ts +17 -8
- package/dist/dataPaths.d.ts.map +1 -1
- package/dist/dataPaths.js +16 -44
- package/dist/dataPaths.js.map +1 -1
- package/dist/dismissals.d.ts +22 -1
- package/dist/dismissals.d.ts.map +1 -1
- package/dist/dismissals.js +22 -1
- package/dist/dismissals.js.map +1 -1
- package/dist/enforcement/gate.d.ts +1 -0
- package/dist/enforcement/gate.d.ts.map +1 -1
- package/dist/enforcement/gate.js +1 -0
- package/dist/enforcement/gate.js.map +1 -1
- package/dist/fingerprint.d.ts +6 -0
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +46 -1
- package/dist/fingerprint.js.map +1 -1
- package/dist/functionScanner.d.ts +30 -1
- package/dist/functionScanner.d.ts.map +1 -1
- package/dist/functionScanner.js +258 -256
- package/dist/functionScanner.js.map +1 -1
- package/dist/generators/AWSQConfigGenerator.d.ts +23 -0
- package/dist/generators/AWSQConfigGenerator.d.ts.map +1 -1
- package/dist/generators/AWSQConfigGenerator.js +23 -0
- package/dist/generators/AWSQConfigGenerator.js.map +1 -1
- package/dist/generators/BaseConfigGenerator.d.ts +7 -0
- package/dist/generators/BaseConfigGenerator.d.ts.map +1 -1
- package/dist/generators/BaseConfigGenerator.js +7 -0
- package/dist/generators/BaseConfigGenerator.js.map +1 -1
- package/dist/generators/ClaudeConfigGenerator.d.ts +23 -0
- package/dist/generators/ClaudeConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ClaudeConfigGenerator.js +23 -0
- package/dist/generators/ClaudeConfigGenerator.js.map +1 -1
- package/dist/generators/ClineConfigGenerator.d.ts +23 -0
- package/dist/generators/ClineConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ClineConfigGenerator.js +23 -0
- package/dist/generators/ClineConfigGenerator.js.map +1 -1
- package/dist/generators/CodeiumConfigGenerator.d.ts +23 -0
- package/dist/generators/CodeiumConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CodeiumConfigGenerator.js +23 -0
- package/dist/generators/CodeiumConfigGenerator.js.map +1 -1
- package/dist/generators/CodexConfigGenerator.d.ts +23 -0
- package/dist/generators/CodexConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CodexConfigGenerator.js +23 -0
- package/dist/generators/CodexConfigGenerator.js.map +1 -1
- package/dist/generators/ConfigGeneratorFactory.d.ts +9 -0
- package/dist/generators/ConfigGeneratorFactory.d.ts.map +1 -1
- package/dist/generators/ConfigGeneratorFactory.js +9 -0
- package/dist/generators/ConfigGeneratorFactory.js.map +1 -1
- package/dist/generators/ContinueConfigGenerator.d.ts +23 -0
- package/dist/generators/ContinueConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ContinueConfigGenerator.js +23 -0
- package/dist/generators/ContinueConfigGenerator.js.map +1 -1
- package/dist/generators/CopilotConfigGenerator.d.ts +23 -0
- package/dist/generators/CopilotConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CopilotConfigGenerator.js +23 -0
- package/dist/generators/CopilotConfigGenerator.js.map +1 -1
- package/dist/generators/CursorConfigGenerator.d.ts +23 -0
- package/dist/generators/CursorConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CursorConfigGenerator.js +23 -0
- package/dist/generators/CursorConfigGenerator.js.map +1 -1
- package/dist/generators/GeminiConfigGenerator.d.ts +23 -0
- package/dist/generators/GeminiConfigGenerator.d.ts.map +1 -1
- package/dist/generators/GeminiConfigGenerator.js +23 -0
- package/dist/generators/GeminiConfigGenerator.js.map +1 -1
- package/dist/generators/VSCodeConfigGenerator.d.ts +23 -0
- package/dist/generators/VSCodeConfigGenerator.d.ts.map +1 -1
- package/dist/generators/VSCodeConfigGenerator.js +23 -0
- package/dist/generators/VSCodeConfigGenerator.js.map +1 -1
- package/dist/generators/ZCodeConfigGenerator.d.ts +23 -0
- package/dist/generators/ZCodeConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ZCodeConfigGenerator.js +23 -0
- package/dist/generators/ZCodeConfigGenerator.js.map +1 -1
- package/dist/graph/blastRadius.d.ts.map +1 -1
- package/dist/graph/blastRadius.js +12 -7
- package/dist/graph/blastRadius.js.map +1 -1
- package/dist/graph/callGraph.d.ts +31 -0
- package/dist/graph/callGraph.d.ts.map +1 -1
- package/dist/graph/callGraph.js +62 -32
- package/dist/graph/callGraph.js.map +1 -1
- package/dist/graph/importClassification.d.ts +28 -0
- package/dist/graph/importClassification.d.ts.map +1 -1
- package/dist/graph/importClassification.js +57 -0
- package/dist/graph/importClassification.js.map +1 -1
- package/dist/graph/importGraph.d.ts +38 -0
- package/dist/graph/importGraph.d.ts.map +1 -1
- package/dist/graph/importGraph.js +38 -0
- package/dist/graph/importGraph.js.map +1 -1
- package/dist/graph/outputFormatter.d.ts +12 -4
- package/dist/graph/outputFormatter.d.ts.map +1 -1
- package/dist/graph/outputFormatter.js +12 -62
- package/dist/graph/outputFormatter.js.map +1 -1
- package/dist/graph/resolutionEnvironment.d.ts +61 -0
- package/dist/graph/resolutionEnvironment.d.ts.map +1 -0
- package/dist/graph/resolutionEnvironment.js +57 -0
- package/dist/graph/resolutionEnvironment.js.map +1 -0
- package/dist/hooks/codex.d.ts +8 -1
- package/dist/hooks/codex.d.ts.map +1 -1
- package/dist/hooks/codex.js +7 -0
- package/dist/hooks/codex.js.map +1 -1
- package/dist/hooks/core.d.ts +6 -0
- package/dist/hooks/core.d.ts.map +1 -1
- package/dist/hooks/core.js +6 -1
- package/dist/hooks/core.js.map +1 -1
- package/dist/hooks/cursor.d.ts +11 -1
- package/dist/hooks/cursor.d.ts.map +1 -1
- package/dist/hooks/cursor.js +10 -0
- package/dist/hooks/cursor.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/installConfig.d.ts +23 -5
- package/dist/installConfig.d.ts.map +1 -1
- package/dist/installConfig.js +23 -5
- package/dist/installConfig.js.map +1 -1
- package/dist/installer.d.ts +6 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +6 -0
- package/dist/installer.js.map +1 -1
- package/dist/invariants/ruleEngine.d.ts +3 -0
- package/dist/invariants/ruleEngine.d.ts.map +1 -1
- package/dist/invariants/ruleEngine.js +156 -119
- package/dist/invariants/ruleEngine.js.map +1 -1
- package/dist/invariants/ruleValidator.d.ts +3 -0
- package/dist/invariants/ruleValidator.d.ts.map +1 -1
- package/dist/invariants/ruleValidator.js +185 -178
- package/dist/invariants/ruleValidator.js.map +1 -1
- package/dist/languages/LanguageOrchestrator.d.ts +4 -1
- package/dist/languages/LanguageOrchestrator.d.ts.map +1 -1
- package/dist/languages/LanguageOrchestrator.js +8 -19
- package/dist/languages/LanguageOrchestrator.js.map +1 -1
- package/dist/languages/RuntimeManager.d.ts +8 -0
- package/dist/languages/RuntimeManager.d.ts.map +1 -1
- package/dist/languages/RuntimeManager.js +55 -5
- package/dist/languages/RuntimeManager.js.map +1 -1
- package/dist/languages/UniversalAnalyzer.js +1 -1
- package/dist/languages/UniversalAnalyzer.js.map +1 -1
- package/dist/languages/adapterBridge.d.ts +4 -0
- package/dist/languages/adapterBridge.d.ts.map +1 -1
- package/dist/languages/adapterBridge.js +37 -3
- package/dist/languages/adapterBridge.js.map +1 -1
- package/dist/languages/go/GoAdapter.d.ts.map +1 -1
- package/dist/languages/go/GoAdapter.js +11 -14
- package/dist/languages/go/GoAdapter.js.map +1 -1
- package/dist/languages/go/analyzer-darwin-amd64 +0 -0
- package/dist/languages/go/analyzer-darwin-arm64 +0 -0
- package/dist/languages/go/analyzer-linux-amd64 +0 -0
- package/dist/languages/go/analyzer-linux-arm64 +0 -0
- package/dist/languages/go/analyzer-src/analyzer.go +2 -0
- package/dist/languages/go/analyzer-src/dataaccess.go +388 -0
- package/dist/languages/go/analyzer-src/types.go +8 -0
- package/dist/languages/go/analyzer-windows-amd64.exe +0 -0
- package/dist/languages/go/database-packages.json +8 -0
- package/dist/languages/go/goResolution.d.ts +229 -0
- package/dist/languages/go/goResolution.d.ts.map +1 -0
- package/dist/languages/go/goResolution.js +799 -0
- package/dist/languages/go/goResolution.js.map +1 -0
- package/dist/languages/go/stdlib-packages.json +353 -0
- package/dist/languages/go/tenantInputs.d.ts +37 -0
- package/dist/languages/go/tenantInputs.d.ts.map +1 -0
- package/dist/languages/go/tenantInputs.js +121 -0
- package/dist/languages/go/tenantInputs.js.map +1 -0
- package/dist/languages/index.d.ts +1 -0
- package/dist/languages/index.d.ts.map +1 -1
- package/dist/languages/index.js +5 -0
- package/dist/languages/index.js.map +1 -1
- package/dist/languages/json/JsonAdapter.d.ts +177 -0
- package/dist/languages/json/JsonAdapter.d.ts.map +1 -0
- package/dist/languages/json/JsonAdapter.js +531 -0
- package/dist/languages/json/JsonAdapter.js.map +1 -0
- package/dist/languages/locationIndex.d.ts +41 -0
- package/dist/languages/locationIndex.d.ts.map +1 -0
- package/dist/languages/locationIndex.js +42 -0
- package/dist/languages/locationIndex.js.map +1 -0
- package/dist/languages/sql/dialectDetection.d.ts +57 -0
- package/dist/languages/sql/dialectDetection.d.ts.map +1 -0
- package/dist/languages/sql/dialectDetection.js +135 -0
- package/dist/languages/sql/dialectDetection.js.map +1 -0
- package/dist/languages/sql/sqlAst.d.ts +494 -0
- package/dist/languages/sql/sqlAst.d.ts.map +1 -0
- package/dist/languages/sql/sqlAst.js +1817 -0
- package/dist/languages/sql/sqlAst.js.map +1 -0
- package/dist/languages/testConventions.d.ts +12 -1
- package/dist/languages/testConventions.d.ts.map +1 -1
- package/dist/languages/testConventions.js +13 -1
- package/dist/languages/testConventions.js.map +1 -1
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.js +1 -1
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.js.map +1 -1
- package/dist/languages/tree-sitter/converter.js +2 -2
- package/dist/languages/tree-sitter/converter.js.map +1 -1
- package/dist/languages/tree-sitter/parser.d.ts +3 -4
- package/dist/languages/tree-sitter/parser.d.ts.map +1 -1
- package/dist/languages/tree-sitter/parser.js +10 -4
- package/dist/languages/tree-sitter/parser.js.map +1 -1
- package/dist/languages/tree-sitter/rawNode.d.ts +3 -0
- package/dist/languages/tree-sitter/rawNode.d.ts.map +1 -1
- package/dist/languages/tree-sitter/rawNode.js +3 -0
- package/dist/languages/tree-sitter/rawNode.js.map +1 -1
- package/dist/languages/types.d.ts +7 -0
- package/dist/languages/types.d.ts.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts +36 -0
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +168 -45
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -1
- package/dist/languages/typescript/database-packages.json +19 -0
- package/dist/ledger.d.ts +118 -2
- package/dist/ledger.d.ts.map +1 -1
- package/dist/ledger.js +167 -45
- package/dist/ledger.js.map +1 -1
- package/dist/legacyIndexNotice.d.ts +32 -0
- package/dist/legacyIndexNotice.d.ts.map +1 -0
- package/dist/legacyIndexNotice.js +89 -0
- package/dist/legacyIndexNotice.js.map +1 -0
- package/dist/mcp-tools/discoveryQueries.d.ts +55 -0
- package/dist/mcp-tools/discoveryQueries.d.ts.map +1 -0
- package/dist/mcp-tools/discoveryQueries.js +157 -0
- package/dist/mcp-tools/discoveryQueries.js.map +1 -0
- package/dist/mcp-tools/projectTasks.d.ts +9 -123
- package/dist/mcp-tools/projectTasks.d.ts.map +1 -1
- package/dist/mcp-tools/projectTasks.js +180 -170
- package/dist/mcp-tools/projectTasks.js.map +1 -1
- package/dist/mcp-tools/whitelistTools.d.ts +20 -0
- package/dist/mcp-tools/whitelistTools.d.ts.map +1 -1
- package/dist/mcp-tools/whitelistTools.js +20 -0
- package/dist/mcp-tools/whitelistTools.js.map +1 -1
- package/dist/mcp-tools/workflowGuide.d.ts +9 -0
- package/dist/mcp-tools/workflowGuide.d.ts.map +1 -1
- package/dist/mcp-tools/workflowGuide.js +13 -5
- package/dist/mcp-tools/workflowGuide.js.map +1 -1
- package/dist/mcp-tools-shared.d.ts +78 -0
- package/dist/mcp-tools-shared.d.ts.map +1 -1
- package/dist/mcp-tools-shared.js +203 -340
- package/dist/mcp-tools-shared.js.map +1 -1
- package/dist/mcp-ui-simple.d.ts +2 -0
- package/dist/mcp-ui-simple.d.ts.map +1 -1
- package/dist/mcp-ui-simple.js +12 -5
- package/dist/mcp-ui-simple.js.map +1 -1
- package/dist/mcp.d.ts +6 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +827 -850
- package/dist/mcp.js.map +1 -1
- package/dist/mcpAuditJobs.d.ts +29 -33
- package/dist/mcpAuditJobs.d.ts.map +1 -1
- package/dist/mcpAuditJobs.js +102 -791
- package/dist/mcpAuditJobs.js.map +1 -1
- package/dist/mcpAutoIndex.d.ts +5 -0
- package/dist/mcpAutoIndex.d.ts.map +1 -1
- package/dist/mcpAutoIndex.js +7 -2
- package/dist/mcpAutoIndex.js.map +1 -1
- package/dist/mcpDiagnostics.d.ts +7 -0
- package/dist/mcpDiagnostics.d.ts.map +1 -1
- package/dist/mcpDiagnostics.js +34 -9
- package/dist/mcpDiagnostics.js.map +1 -1
- package/dist/mcpToolErrors.d.ts +16 -0
- package/dist/mcpToolErrors.d.ts.map +1 -1
- package/dist/mcpToolErrors.js +16 -0
- package/dist/mcpToolErrors.js.map +1 -1
- package/dist/nextFile.d.ts +6 -0
- package/dist/nextFile.d.ts.map +1 -1
- package/dist/nextFile.js +6 -0
- package/dist/nextFile.js.map +1 -1
- package/dist/nextFileIncremental.d.ts +44 -4
- package/dist/nextFileIncremental.d.ts.map +1 -1
- package/dist/nextFileIncremental.js +47 -7
- package/dist/nextFileIncremental.js.map +1 -1
- package/dist/phase/batchFunctions.d.ts +38 -0
- package/dist/phase/batchFunctions.d.ts.map +1 -0
- package/dist/phase/batchFunctions.js +64 -0
- package/dist/phase/batchFunctions.js.map +1 -0
- package/dist/phase/checks.d.ts +39 -0
- package/dist/phase/checks.d.ts.map +1 -0
- package/dist/phase/checks.js +48 -0
- package/dist/phase/checks.js.map +1 -0
- package/dist/phase/codeBlocks.d.ts +25 -0
- package/dist/phase/codeBlocks.d.ts.map +1 -0
- package/dist/phase/codeBlocks.js +268 -0
- package/dist/phase/codeBlocks.js.map +1 -0
- package/dist/phase/colorMath.d.ts +41 -0
- package/dist/phase/colorMath.d.ts.map +1 -0
- package/dist/phase/colorMath.js +109 -0
- package/dist/phase/colorMath.js.map +1 -0
- package/dist/phase/config.d.ts +29 -0
- package/dist/phase/config.d.ts.map +1 -0
- package/dist/phase/config.js +54 -0
- package/dist/phase/config.js.map +1 -0
- package/dist/phase/consumed.d.ts +47 -0
- package/dist/phase/consumed.d.ts.map +1 -0
- package/dist/phase/consumed.js +22 -0
- package/dist/phase/consumed.js.map +1 -0
- package/dist/phase/conventionMining.d.ts +59 -0
- package/dist/phase/conventionMining.d.ts.map +1 -0
- package/dist/phase/conventionMining.js +152 -0
- package/dist/phase/conventionMining.js.map +1 -0
- package/dist/phase/coverage.d.ts +65 -0
- package/dist/phase/coverage.d.ts.map +1 -0
- package/dist/phase/coverage.js +121 -0
- package/dist/phase/coverage.js.map +1 -0
- package/dist/phase/dag.d.ts +49 -0
- package/dist/phase/dag.d.ts.map +1 -0
- package/dist/phase/dag.js +120 -0
- package/dist/phase/dag.js.map +1 -0
- package/dist/phase/dataAccessCalls.d.ts +33 -0
- package/dist/phase/dataAccessCalls.d.ts.map +1 -0
- package/dist/phase/dataAccessCalls.js +42 -0
- package/dist/phase/dataAccessCalls.js.map +1 -0
- package/dist/phase/dataAccessCallsCandidates.d.ts +25 -0
- package/dist/phase/dataAccessCallsCandidates.d.ts.map +1 -0
- package/dist/phase/dataAccessCallsCandidates.js +27 -0
- package/dist/phase/dataAccessCallsCandidates.js.map +1 -0
- package/dist/phase/dynamicSql.d.ts +18 -0
- package/dist/phase/dynamicSql.d.ts.map +1 -0
- package/dist/phase/dynamicSql.js +20 -0
- package/dist/phase/dynamicSql.js.map +1 -0
- package/dist/phase/exportForm.d.ts +23 -0
- package/dist/phase/exportForm.d.ts.map +1 -0
- package/dist/phase/exportForm.js +29 -0
- package/dist/phase/exportForm.js.map +1 -0
- package/dist/phase/exportSymbols.d.ts +21 -0
- package/dist/phase/exportSymbols.d.ts.map +1 -0
- package/dist/phase/exportSymbols.js +28 -0
- package/dist/phase/exportSymbols.js.map +1 -0
- package/dist/phase/fileHeader.d.ts +15 -0
- package/dist/phase/fileHeader.d.ts.map +1 -0
- package/dist/phase/fileHeader.js +33 -0
- package/dist/phase/fileHeader.js.map +1 -0
- package/dist/phase/fileImports.d.ts +39 -0
- package/dist/phase/fileImports.d.ts.map +1 -0
- package/dist/phase/fileImports.js +138 -0
- package/dist/phase/fileImports.js.map +1 -0
- package/dist/phase/fileSymbols.d.ts +25 -0
- package/dist/phase/fileSymbols.d.ts.map +1 -0
- package/dist/phase/fileSymbols.js +302 -0
- package/dist/phase/fileSymbols.js.map +1 -0
- package/dist/phase/functionBodies.d.ts +28 -0
- package/dist/phase/functionBodies.d.ts.map +1 -0
- package/dist/phase/functionBodies.js +67 -0
- package/dist/phase/functionBodies.js.map +1 -0
- package/dist/phase/functionIndex.d.ts +28 -0
- package/dist/phase/functionIndex.d.ts.map +1 -0
- package/dist/phase/functionIndex.js +152 -0
- package/dist/phase/functionIndex.js.map +1 -0
- package/dist/phase/goFunctionAnalysis.d.ts +47 -0
- package/dist/phase/goFunctionAnalysis.d.ts.map +1 -0
- package/dist/phase/goFunctionAnalysis.js +291 -0
- package/dist/phase/goFunctionAnalysis.js.map +1 -0
- package/dist/phase/goFunctions.d.ts +38 -0
- package/dist/phase/goFunctions.d.ts.map +1 -0
- package/dist/phase/goFunctions.js +154 -0
- package/dist/phase/goFunctions.js.map +1 -0
- package/dist/phase/goImports.d.ts +29 -0
- package/dist/phase/goImports.d.ts.map +1 -0
- package/dist/phase/goImports.js +68 -0
- package/dist/phase/goImports.js.map +1 -0
- package/dist/phase/goPackageBindings.d.ts +22 -0
- package/dist/phase/goPackageBindings.d.ts.map +1 -0
- package/dist/phase/goPackageBindings.js +30 -0
- package/dist/phase/goPackageBindings.js.map +1 -0
- package/dist/phase/goSwitches.d.ts +28 -0
- package/dist/phase/goSwitches.d.ts.map +1 -0
- package/dist/phase/goSwitches.js +52 -0
- package/dist/phase/goSwitches.js.map +1 -0
- package/dist/phase/importForm.d.ts +20 -0
- package/dist/phase/importForm.d.ts.map +1 -0
- package/dist/phase/importForm.js +27 -0
- package/dist/phase/importForm.js.map +1 -0
- package/dist/phase/importSpecifiers.d.ts +20 -0
- package/dist/phase/importSpecifiers.d.ts.map +1 -0
- package/dist/phase/importSpecifiers.js +30 -0
- package/dist/phase/importSpecifiers.js.map +1 -0
- package/dist/phase/imports.d.ts +18 -0
- package/dist/phase/imports.d.ts.map +1 -0
- package/dist/phase/imports.js +25 -0
- package/dist/phase/imports.js.map +1 -0
- package/dist/phase/jsonDocument.d.ts +26 -0
- package/dist/phase/jsonDocument.d.ts.map +1 -0
- package/dist/phase/jsonDocument.js +36 -0
- package/dist/phase/jsonDocument.js.map +1 -0
- package/dist/phase/localBinding.d.ts +33 -0
- package/dist/phase/localBinding.d.ts.map +1 -0
- package/dist/phase/localBinding.js +208 -0
- package/dist/phase/localBinding.js.map +1 -0
- package/dist/phase/loopQueries.d.ts +31 -0
- package/dist/phase/loopQueries.d.ts.map +1 -0
- package/dist/phase/loopQueries.js +44 -0
- package/dist/phase/loopQueries.js.map +1 -0
- package/dist/phase/loopQueryCandidates.d.ts +26 -0
- package/dist/phase/loopQueryCandidates.d.ts.map +1 -0
- package/dist/phase/loopQueryCandidates.js +28 -0
- package/dist/phase/loopQueryCandidates.js.map +1 -0
- package/dist/phase/oracles.d.ts +216 -0
- package/dist/phase/oracles.d.ts.map +1 -0
- package/dist/phase/oracles.js +484 -0
- package/dist/phase/oracles.js.map +1 -0
- package/dist/phase/phaseModel.d.ts +190 -0
- package/dist/phase/phaseModel.d.ts.map +1 -0
- package/dist/phase/phaseModel.js +491 -0
- package/dist/phase/phaseModel.js.map +1 -0
- package/dist/phase/producers.d.ts +450 -0
- package/dist/phase/producers.d.ts.map +1 -0
- package/dist/phase/producers.js +1030 -0
- package/dist/phase/producers.js.map +1 -0
- package/dist/phase/querySiteCandidates.d.ts +27 -0
- package/dist/phase/querySiteCandidates.d.ts.map +1 -0
- package/dist/phase/querySiteCandidates.js +66 -0
- package/dist/phase/querySiteCandidates.js.map +1 -0
- package/dist/phase/querySites.d.ts +30 -0
- package/dist/phase/querySites.d.ts.map +1 -0
- package/dist/phase/querySites.js +93 -0
- package/dist/phase/querySites.js.map +1 -0
- package/dist/phase/reachability.d.ts +61 -0
- package/dist/phase/reachability.d.ts.map +1 -0
- package/dist/phase/reachability.js +104 -0
- package/dist/phase/reachability.js.map +1 -0
- package/dist/phase/reactComponents.d.ts +33 -0
- package/dist/phase/reactComponents.d.ts.map +1 -0
- package/dist/phase/reactComponents.js +47 -0
- package/dist/phase/reactComponents.js.map +1 -0
- package/dist/phase/receiverActivity.d.ts +35 -0
- package/dist/phase/receiverActivity.d.ts.map +1 -0
- package/dist/phase/receiverActivity.js +66 -0
- package/dist/phase/receiverActivity.js.map +1 -0
- package/dist/phase/receiverConsumers.d.ts +207 -0
- package/dist/phase/receiverConsumers.d.ts.map +1 -0
- package/dist/phase/receiverConsumers.js +1063 -0
- package/dist/phase/receiverConsumers.js.map +1 -0
- package/dist/phase/receiverProvenance.d.ts +120 -0
- package/dist/phase/receiverProvenance.d.ts.map +1 -0
- package/dist/phase/receiverProvenance.js +377 -0
- package/dist/phase/receiverProvenance.js.map +1 -0
- package/dist/phase/routing.d.ts +47 -0
- package/dist/phase/routing.d.ts.map +1 -0
- package/dist/phase/routing.js +62 -0
- package/dist/phase/routing.js.map +1 -0
- package/dist/phase/rules/conventions.d.ts +61 -0
- package/dist/phase/rules/conventions.d.ts.map +1 -0
- package/dist/phase/rules/conventions.js +403 -0
- package/dist/phase/rules/conventions.js.map +1 -0
- package/dist/phase/rules/crossDomain.d.ts +102 -0
- package/dist/phase/rules/crossDomain.d.ts.map +1 -0
- package/dist/phase/rules/crossDomain.js +918 -0
- package/dist/phase/rules/crossDomain.js.map +1 -0
- package/dist/phase/rules/dataAccess.d.ts +62 -0
- package/dist/phase/rules/dataAccess.d.ts.map +1 -0
- package/dist/phase/rules/dataAccess.js +480 -0
- package/dist/phase/rules/dataAccess.js.map +1 -0
- package/dist/phase/rules/dependencyGraph.d.ts +44 -0
- package/dist/phase/rules/dependencyGraph.d.ts.map +1 -0
- package/dist/phase/rules/dependencyGraph.js +260 -0
- package/dist/phase/rules/dependencyGraph.js.map +1 -0
- package/dist/phase/rules/documentation.d.ts +45 -0
- package/dist/phase/rules/documentation.d.ts.map +1 -0
- package/dist/phase/rules/documentation.js +340 -0
- package/dist/phase/rules/documentation.js.map +1 -0
- package/dist/phase/rules/dry.d.ts +109 -0
- package/dist/phase/rules/dry.d.ts.map +1 -0
- package/dist/phase/rules/dry.js +803 -0
- package/dist/phase/rules/dry.js.map +1 -0
- package/dist/phase/rules/fileDocumentation.d.ts +36 -0
- package/dist/phase/rules/fileDocumentation.d.ts.map +1 -0
- package/dist/phase/rules/fileDocumentation.js +134 -0
- package/dist/phase/rules/fileDocumentation.js.map +1 -0
- package/dist/phase/rules/functionBodies.d.ts +33 -0
- package/dist/phase/rules/functionBodies.d.ts.map +1 -0
- package/dist/phase/rules/functionBodies.js +71 -0
- package/dist/phase/rules/functionBodies.js.map +1 -0
- package/dist/phase/rules/goRules.d.ts +49 -0
- package/dist/phase/rules/goRules.d.ts.map +1 -0
- package/dist/phase/rules/goRules.js +209 -0
- package/dist/phase/rules/goRules.js.map +1 -0
- package/dist/phase/rules/querySites.d.ts +29 -0
- package/dist/phase/rules/querySites.d.ts.map +1 -0
- package/dist/phase/rules/querySites.js +94 -0
- package/dist/phase/rules/querySites.js.map +1 -0
- package/dist/phase/rules/react.d.ts +38 -0
- package/dist/phase/rules/react.d.ts.map +1 -0
- package/dist/phase/rules/react.js +202 -0
- package/dist/phase/rules/react.js.map +1 -0
- package/dist/phase/rules/registry.d.ts +170 -0
- package/dist/phase/rules/registry.d.ts.map +1 -0
- package/dist/phase/rules/registry.js +103 -0
- package/dist/phase/rules/registry.js.map +1 -0
- package/dist/phase/rules/schema.d.ts +79 -0
- package/dist/phase/rules/schema.d.ts.map +1 -0
- package/dist/phase/rules/schema.js +273 -0
- package/dist/phase/rules/schema.js.map +1 -0
- package/dist/phase/rules/schemaJson.d.ts +32 -0
- package/dist/phase/rules/schemaJson.d.ts.map +1 -0
- package/dist/phase/rules/schemaJson.js +81 -0
- package/dist/phase/rules/schemaJson.js.map +1 -0
- package/dist/phase/rules/schemaValidator.d.ts +38 -0
- package/dist/phase/rules/schemaValidator.d.ts.map +1 -0
- package/dist/phase/rules/schemaValidator.js +107 -0
- package/dist/phase/rules/schemaValidator.js.map +1 -0
- package/dist/phase/rules/secrets.d.ts +34 -0
- package/dist/phase/rules/secrets.d.ts.map +1 -0
- package/dist/phase/rules/secrets.js +208 -0
- package/dist/phase/rules/secrets.js.map +1 -0
- package/dist/phase/rules/security.d.ts +30 -0
- package/dist/phase/rules/security.d.ts.map +1 -0
- package/dist/phase/rules/security.js +85 -0
- package/dist/phase/rules/security.js.map +1 -0
- package/dist/phase/rules/securityDefects.d.ts +37 -0
- package/dist/phase/rules/securityDefects.d.ts.map +1 -0
- package/dist/phase/rules/securityDefects.js +167 -0
- package/dist/phase/rules/securityDefects.js.map +1 -0
- package/dist/phase/rules/solid.d.ts +61 -0
- package/dist/phase/rules/solid.d.ts.map +1 -0
- package/dist/phase/rules/solid.js +562 -0
- package/dist/phase/rules/solid.js.map +1 -0
- package/dist/phase/rules/styles.d.ts +77 -0
- package/dist/phase/rules/styles.d.ts.map +1 -0
- package/dist/phase/rules/styles.js +868 -0
- package/dist/phase/rules/styles.js.map +1 -0
- package/dist/phase/rules/unreferencedModule.d.ts +26 -0
- package/dist/phase/rules/unreferencedModule.d.ts.map +1 -0
- package/dist/phase/rules/unreferencedModule.js +61 -0
- package/dist/phase/rules/unreferencedModule.js.map +1 -0
- package/dist/phase/runner.d.ts +549 -0
- package/dist/phase/runner.d.ts.map +1 -0
- package/dist/phase/runner.js +1098 -0
- package/dist/phase/runner.js.map +1 -0
- package/dist/phase/schemaCode.d.ts +34 -0
- package/dist/phase/schemaCode.d.ts.map +1 -0
- package/dist/phase/schemaCode.js +53 -0
- package/dist/phase/schemaCode.js.map +1 -0
- package/dist/phase/schemaObjects.d.ts +37 -0
- package/dist/phase/schemaObjects.d.ts.map +1 -0
- package/dist/phase/schemaObjects.js +139 -0
- package/dist/phase/schemaObjects.js.map +1 -0
- package/dist/phase/schemaUsage.d.ts +30 -0
- package/dist/phase/schemaUsage.d.ts.map +1 -0
- package/dist/phase/schemaUsage.js +99 -0
- package/dist/phase/schemaUsage.js.map +1 -0
- package/dist/phase/schemaUsageCandidates.d.ts +32 -0
- package/dist/phase/schemaUsageCandidates.d.ts.map +1 -0
- package/dist/phase/schemaUsageCandidates.js +165 -0
- package/dist/phase/schemaUsageCandidates.js.map +1 -0
- package/dist/phase/schemaValidations.d.ts +34 -0
- package/dist/phase/schemaValidations.d.ts.map +1 -0
- package/dist/phase/schemaValidations.js +53 -0
- package/dist/phase/schemaValidations.js.map +1 -0
- package/dist/phase/secretCandidates.d.ts +28 -0
- package/dist/phase/secretCandidates.d.ts.map +1 -0
- package/dist/phase/secretCandidates.js +132 -0
- package/dist/phase/secretCandidates.js.map +1 -0
- package/dist/phase/securityCandidates.d.ts +29 -0
- package/dist/phase/securityCandidates.d.ts.map +1 -0
- package/dist/phase/securityCandidates.js +469 -0
- package/dist/phase/securityCandidates.js.map +1 -0
- package/dist/phase/seeded-defects.d.ts +18 -0
- package/dist/phase/seeded-defects.d.ts.map +1 -0
- package/dist/phase/seeded-defects.js +61 -0
- package/dist/phase/seeded-defects.js.map +1 -0
- package/dist/phase/stringLiterals.d.ts +24 -0
- package/dist/phase/stringLiterals.d.ts.map +1 -0
- package/dist/phase/stringLiterals.js +35 -0
- package/dist/phase/stringLiterals.js.map +1 -0
- package/dist/phase/stylesCss.d.ts +25 -0
- package/dist/phase/stylesCss.d.ts.map +1 -0
- package/dist/phase/stylesCss.js +34 -0
- package/dist/phase/stylesCss.js.map +1 -0
- package/dist/phase/stylesMarkup.d.ts +31 -0
- package/dist/phase/stylesMarkup.d.ts.map +1 -0
- package/dist/phase/stylesMarkup.js +48 -0
- package/dist/phase/stylesMarkup.js.map +1 -0
- package/dist/phase/stylesSource.d.ts +36 -0
- package/dist/phase/stylesSource.d.ts.map +1 -0
- package/dist/phase/stylesSource.js +50 -0
- package/dist/phase/stylesSource.js.map +1 -0
- package/dist/phase/typeDeclarations.d.ts +33 -0
- package/dist/phase/typeDeclarations.d.ts.map +1 -0
- package/dist/phase/typeDeclarations.js +76 -0
- package/dist/phase/typeDeclarations.js.map +1 -0
- package/dist/phase/types.d.ts +2199 -0
- package/dist/phase/types.d.ts.map +1 -0
- package/dist/phase/types.js +27 -0
- package/dist/phase/types.js.map +1 -0
- package/dist/phase/withinFileProvenance.d.ts +50 -0
- package/dist/phase/withinFileProvenance.d.ts.map +1 -0
- package/dist/phase/withinFileProvenance.js +112 -0
- package/dist/phase/withinFileProvenance.js.map +1 -0
- package/dist/pipeline.d.ts +37 -30
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +131 -326
- package/dist/pipeline.js.map +1 -1
- package/dist/pipelineAdapters.d.ts +104 -21
- package/dist/pipelineAdapters.d.ts.map +1 -1
- package/dist/pipelineAdapters.js +1144 -984
- package/dist/pipelineAdapters.js.map +1 -1
- package/dist/pipelineTypes.d.ts +21 -0
- package/dist/pipelineTypes.d.ts.map +1 -1
- package/dist/pipelineTypes.js +21 -10
- package/dist/pipelineTypes.js.map +1 -1
- package/dist/presets/presets.d.ts +9 -2
- package/dist/presets/presets.d.ts.map +1 -1
- package/dist/presets/presets.js +15 -26
- package/dist/presets/presets.js.map +1 -1
- package/dist/reporting/csvReportGenerator.d.ts +14 -3
- package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
- package/dist/reporting/csvReportGenerator.js +14 -3
- package/dist/reporting/csvReportGenerator.js.map +1 -1
- package/dist/reporting/htmlReportGenerator.d.ts +5 -1
- package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
- package/dist/reporting/htmlReportGenerator.js +5 -1
- package/dist/reporting/htmlReportGenerator.js.map +1 -1
- package/dist/reporting/jsonReportGenerator.d.ts +9 -2
- package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
- package/dist/reporting/jsonReportGenerator.js +19 -5
- package/dist/reporting/jsonReportGenerator.js.map +1 -1
- package/dist/reporting/reportGenerator.d.ts +9 -2
- package/dist/reporting/reportGenerator.d.ts.map +1 -1
- package/dist/reporting/reportGenerator.js +9 -2
- package/dist/reporting/reportGenerator.js.map +1 -1
- package/dist/reporting/sarifReportGenerator.d.ts +14 -0
- package/dist/reporting/sarifReportGenerator.d.ts.map +1 -1
- package/dist/reporting/sarifReportGenerator.js +14 -0
- package/dist/reporting/sarifReportGenerator.js.map +1 -1
- package/dist/reporting/sizeDistribution.d.ts +19 -2
- package/dist/reporting/sizeDistribution.d.ts.map +1 -1
- package/dist/reporting/sizeDistribution.js +23 -5
- package/dist/reporting/sizeDistribution.js.map +1 -1
- package/dist/ruleAliases.d.ts +6 -8
- package/dist/ruleAliases.d.ts.map +1 -1
- package/dist/ruleAliases.js +29 -4
- package/dist/ruleAliases.js.map +1 -1
- package/dist/search/QueryParser.d.ts +1 -0
- package/dist/search/QueryParser.d.ts.map +1 -1
- package/dist/search/QueryParser.js +32 -91
- package/dist/search/QueryParser.js.map +1 -1
- package/dist/services/CodeMapGenerator.d.ts +19 -20
- package/dist/services/CodeMapGenerator.d.ts.map +1 -1
- package/dist/services/CodeMapGenerator.js +214 -194
- package/dist/services/CodeMapGenerator.js.map +1 -1
- package/dist/services/ProjectTaskRepository.d.ts +65 -3
- package/dist/services/ProjectTaskRepository.d.ts.map +1 -1
- package/dist/services/ProjectTaskRepository.js +94 -25
- package/dist/services/ProjectTaskRepository.js.map +1 -1
- package/dist/services/auditJobService.d.ts +17 -1
- package/dist/services/auditJobService.d.ts.map +1 -1
- package/dist/services/auditJobService.js +16 -0
- package/dist/services/auditJobService.js.map +1 -1
- package/dist/services/fileAccounting.d.ts +43 -5
- package/dist/services/fileAccounting.d.ts.map +1 -1
- package/dist/services/fileAccounting.js +48 -9
- package/dist/services/fileAccounting.js.map +1 -1
- package/dist/services/projectTaskHelpers.d.ts +45 -0
- package/dist/services/projectTaskHelpers.d.ts.map +1 -1
- package/dist/services/projectTaskHelpers.js +45 -0
- package/dist/services/projectTaskHelpers.js.map +1 -1
- package/dist/services/whitelistService.d.ts +40 -5
- package/dist/services/whitelistService.d.ts.map +1 -1
- package/dist/services/whitelistService.js +87 -46
- package/dist/services/whitelistService.js.map +1 -1
- package/dist/sqlite/betterSqlite3.d.ts +35 -1
- package/dist/sqlite/betterSqlite3.d.ts.map +1 -1
- package/dist/sqlite/betterSqlite3.js +35 -1
- package/dist/sqlite/betterSqlite3.js.map +1 -1
- package/dist/sqlite/driver.d.ts +23 -0
- package/dist/sqlite/driver.d.ts.map +1 -1
- package/dist/sqlite/driver.js +23 -0
- package/dist/sqlite/driver.js.map +1 -1
- package/dist/sqlite/nodeSqlite.d.ts +35 -1
- package/dist/sqlite/nodeSqlite.d.ts.map +1 -1
- package/dist/sqlite/nodeSqlite.js +35 -1
- package/dist/sqlite/nodeSqlite.js.map +1 -1
- package/dist/structuralSignature.d.ts +9 -0
- package/dist/structuralSignature.d.ts.map +1 -1
- package/dist/structuralSignature.js +9 -0
- package/dist/structuralSignature.js.map +1 -1
- package/dist/styles/cssAstExtractor.d.ts +15 -0
- package/dist/styles/cssAstExtractor.d.ts.map +1 -1
- package/dist/styles/cssAstExtractor.js +15 -0
- package/dist/styles/cssAstExtractor.js.map +1 -1
- package/dist/styles/normalizer.d.ts +6 -0
- package/dist/styles/normalizer.d.ts.map +1 -1
- package/dist/styles/normalizer.js +6 -0
- package/dist/styles/normalizer.js.map +1 -1
- package/dist/styles/styleExtractor.d.ts +29 -2
- package/dist/styles/styleExtractor.d.ts.map +1 -1
- package/dist/styles/styleExtractor.js +67 -48
- package/dist/styles/styleExtractor.js.map +1 -1
- package/dist/styles/styleIndexer.d.ts +8 -0
- package/dist/styles/styleIndexer.d.ts.map +1 -1
- package/dist/styles/styleIndexer.js +135 -138
- package/dist/styles/styleIndexer.js.map +1 -1
- package/dist/styles/tailwindConfigLoader.d.ts +12 -0
- package/dist/styles/tailwindConfigLoader.d.ts.map +1 -1
- package/dist/styles/tailwindConfigLoader.js +12 -0
- package/dist/styles/tailwindConfigLoader.js.map +1 -1
- package/dist/styles/tailwindExpander.d.ts +3 -0
- package/dist/styles/tailwindExpander.d.ts.map +1 -1
- package/dist/styles/tailwindExpander.js +8 -4
- package/dist/styles/tailwindExpander.js.map +1 -1
- package/dist/styles/tailwindProbe.d.ts +9 -0
- package/dist/styles/tailwindProbe.d.ts.map +1 -1
- package/dist/styles/tailwindProbe.js +181 -166
- package/dist/styles/tailwindProbe.js.map +1 -1
- package/dist/styles/tailwindUtilityExpander.d.ts +13 -0
- package/dist/styles/tailwindUtilityExpander.d.ts.map +1 -1
- package/dist/styles/tailwindUtilityExpander.js +13 -0
- package/dist/styles/tailwindUtilityExpander.js.map +1 -1
- package/dist/symbols.d.ts +13 -11
- package/dist/symbols.d.ts.map +1 -1
- package/dist/symbols.js +14 -21
- package/dist/symbols.js.map +1 -1
- package/dist/telemetry.d.ts +31 -3
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +31 -3
- package/dist/telemetry.js.map +1 -1
- package/dist/tool-registry.d.ts +37 -1
- package/dist/tool-registry.d.ts.map +1 -1
- package/dist/tool-registry.js +37 -1
- package/dist/tool-registry.js.map +1 -1
- package/dist/types.d.ts +114 -71
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -16
- package/dist/types.js.map +1 -1
- package/dist/ui/InteractivePrompts.d.ts +12 -0
- package/dist/ui/InteractivePrompts.d.ts.map +1 -1
- package/dist/ui/InteractivePrompts.js +12 -0
- package/dist/ui/InteractivePrompts.js.map +1 -1
- package/dist/utils/astParser.d.ts +15 -0
- package/dist/utils/astParser.d.ts.map +1 -1
- package/dist/utils/astParser.js +15 -0
- package/dist/utils/astParser.js.map +1 -1
- package/dist/utils/astUtils.d.ts +60 -0
- package/dist/utils/astUtils.d.ts.map +1 -1
- package/dist/utils/astUtils.js +350 -362
- package/dist/utils/astUtils.js.map +1 -1
- package/dist/utils/contentHash.d.ts +22 -0
- package/dist/utils/contentHash.d.ts.map +1 -0
- package/dist/utils/contentHash.js +26 -0
- package/dist/utils/contentHash.js.map +1 -0
- package/dist/utils/dependencyExtractor.d.ts +28 -0
- package/dist/utils/dependencyExtractor.d.ts.map +1 -1
- package/dist/utils/dependencyExtractor.js +28 -1
- package/dist/utils/dependencyExtractor.js.map +1 -1
- package/dist/utils/errorMessage.d.ts +10 -0
- package/dist/utils/errorMessage.d.ts.map +1 -0
- package/dist/utils/errorMessage.js +12 -0
- package/dist/utils/errorMessage.js.map +1 -0
- package/dist/utils/fileDiscovery.d.ts +61 -2
- package/dist/utils/fileDiscovery.d.ts.map +1 -1
- package/dist/utils/fileDiscovery.js +131 -23
- package/dist/utils/fileDiscovery.js.map +1 -1
- package/dist/utils/reactDetection.d.ts +34 -5
- package/dist/utils/reactDetection.d.ts.map +1 -1
- package/dist/utils/reactDetection.js +73 -52
- package/dist/utils/reactDetection.js.map +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/workers/auditWorker.js +7 -3
- package/dist/workers/auditWorker.js.map +1 -1
- package/examples/.auditrc.example.json +0 -8
- package/examples/.auditrc.json +0 -11
- package/examples/.code-auditor.json +0 -2
- package/examples/nextjs.auditrc.json +0 -8
- package/examples/node-api.auditrc.json +0 -7
- package/examples/react.auditrc.json +0 -6
- package/examples/tolerant-solid.auditrc.json +0 -5
- package/package.json +18 -9
- package/plugin/.claude-plugin/manifest.json +16 -0
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +7 -3
- package/plugin/scripts/hook-audit.sh +46 -16
- package/plugin/scripts/hook-common.sh +81 -12
- package/plugin/scripts/hook-drift-check.sh +76 -0
- package/plugin/scripts/hook-self-audit.sh +22 -14
- package/plugin/scripts/hook-warm.sh +5 -6
- package/plugin/skills/code-auditor/SKILL.md +1 -1
- package/server.json +10 -4
|
@@ -74,7 +74,7 @@ const BUILT_IN_CALLEES = new Set([
|
|
|
74
74
|
export function escapeRegex(s) {
|
|
75
75
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
76
76
|
}
|
|
77
|
-
/** Detect whether a string contains non-Latin-script characters (Spec 21 R5.4). */
|
|
77
|
+
/** Detect whether a string contains non-Latin-script characters (Spec 21 R5.4). @param name The string to inspect. @returns True when the string contains non-Latin-script characters. */
|
|
78
78
|
export function hasNonLatinChars(name) {
|
|
79
79
|
// Latin script covers Basic Latin (U+0000–U+007F), Latin-1 Supplement
|
|
80
80
|
// (U+0080–U+00FF), and Latin Extended-A/B (U+0100–U+024F). Allow digits,
|
|
@@ -99,7 +99,9 @@ export function hasNonLatinChars(name) {
|
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
/** Classify a symbol name into a casing convention. Returns null for
|
|
102
|
-
* non-Latin, unclassifiable, or ambiguous names.
|
|
102
|
+
* non-Latin, unclassifiable, or ambiguous names.
|
|
103
|
+
* @param name The symbol name to classify.
|
|
104
|
+
* @returns The casing convention name, or null when unclassifiable. */
|
|
103
105
|
export function detectCase(name) {
|
|
104
106
|
if (!name || name.length === 0)
|
|
105
107
|
return null;
|
|
@@ -128,6 +130,8 @@ export function detectCase(name) {
|
|
|
128
130
|
* Handles: import default, import named, import namespace, import side-effect,
|
|
129
131
|
* require default, require destructured.
|
|
130
132
|
* Multi-line imports supported via {}-accumulation.
|
|
133
|
+
* @param content The raw file content.
|
|
134
|
+
* @returns The parsed import statements.
|
|
131
135
|
*/
|
|
132
136
|
export function parseFileImports(content) {
|
|
133
137
|
const results = [];
|
|
@@ -236,6 +240,9 @@ export function parseFileImports(content) {
|
|
|
236
240
|
/**
|
|
237
241
|
* Parse the export form for a specific exported function from AST-extracted
|
|
238
242
|
* export data. Returns null if the function isn't found in the export list.
|
|
243
|
+
* @param functionName The function name to look up.
|
|
244
|
+
* @param exports The AST-extracted export list.
|
|
245
|
+
* @returns The export form, or null when the function is not in the list.
|
|
239
246
|
*/
|
|
240
247
|
export function detectExportForm(functionName, exports) {
|
|
241
248
|
const match = exports.find(e => e.name === functionName);
|
|
@@ -289,6 +296,8 @@ function _detectExportFormFromSource(filePath, functionName, sourceCode) {
|
|
|
289
296
|
* A string/comment containing `try {` or `if (err)` no longer registers, and a
|
|
290
297
|
* body that mixes two shapes is no longer collapsed to whichever the regex
|
|
291
298
|
* happened to see first.
|
|
299
|
+
* @param body The function body source (may be null/undefined).
|
|
300
|
+
* @returns The detected error-handling shape, or null when none is present.
|
|
292
301
|
*/
|
|
293
302
|
export function detectErrorHandlingShape(body) {
|
|
294
303
|
if (!body)
|
|
@@ -409,8 +418,8 @@ function isErrorPresenceCheck(n) {
|
|
|
409
418
|
function computeHash(inputs) {
|
|
410
419
|
return crypto.createHash('md5').update(JSON.stringify(inputs)).digest('hex');
|
|
411
420
|
}
|
|
412
|
-
/** Cap the number of conventions per domain. */
|
|
413
|
-
function capPerDomain(conventions, max) {
|
|
421
|
+
/** Cap the number of conventions per domain. @param conventions The conventions to cap. @param max The per-domain maximum. @returns The capped conventions. */
|
|
422
|
+
export function capPerDomain(conventions, max) {
|
|
414
423
|
const byDomain = new Map();
|
|
415
424
|
for (const c of conventions) {
|
|
416
425
|
const list = byDomain.get(c.domain) ?? [];
|
|
@@ -433,98 +442,71 @@ function capPerDomain(conventions, max) {
|
|
|
433
442
|
* and support ≥ minCorpus.
|
|
434
443
|
*/
|
|
435
444
|
function mineUsagePairs(db, config) {
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
const rows = db
|
|
439
|
-
.prepare(`SELECT f.id, f.name as func_name, f.file_path, f.line_number,
|
|
440
|
-
f.metadata_json
|
|
441
|
-
FROM functions f`)
|
|
445
|
+
const funcs = db
|
|
446
|
+
.prepare(`SELECT id, name, file_path, line_number FROM functions`)
|
|
442
447
|
.all();
|
|
443
|
-
|
|
444
|
-
const callSets = new Map();
|
|
445
|
-
const callRows = db
|
|
448
|
+
const calls = db
|
|
446
449
|
.prepare(`SELECT caller_id, callee_name FROM function_calls`)
|
|
447
450
|
.all();
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
//
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
451
|
+
return mineUsagePairsFromFacts(funcs, calls, config);
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* The pure import-form miner — byte-identical logic to the legacy `mineImportForm`
|
|
455
|
+
* DB miner, over a per-file import projection.
|
|
456
|
+
*
|
|
457
|
+
* The legacy miner read `SELECT DISTINCT file_path FROM functions` (files that
|
|
458
|
+
* *have indexed functions*), parsed each file's source with `parseFileImports`,
|
|
459
|
+
* and reduced the `(source, directory)` histogram to a dominant-form convention.
|
|
460
|
+
* This pure miner drives off the same distinct file set (the caller derives it
|
|
461
|
+
* from the `function-index` fact, preserving first-appearance order) and reads
|
|
462
|
+
* each file's imports from the projection — so a file with imports but no
|
|
463
|
+
* indexed functions contributes nothing on either path.
|
|
464
|
+
* @param files The distinct file paths to mine.
|
|
465
|
+
* @param getImports Callback returning a file's parsed imports.
|
|
466
|
+
* @param config The convention mining config.
|
|
467
|
+
* @returns The mined import-form conventions.
|
|
468
|
+
*/
|
|
469
|
+
export function mineImportFormFromFacts(files, getImports, config) {
|
|
470
|
+
const conventions = [];
|
|
471
|
+
// (source, directory) -> Map<form, count>
|
|
472
|
+
const formCounts = new Map();
|
|
473
|
+
// (source, directory) -> exemplar
|
|
474
|
+
const exemplars = new Map();
|
|
475
|
+
for (const file of files) {
|
|
476
|
+
const imports = getImports(file);
|
|
477
|
+
if (!imports)
|
|
475
478
|
continue;
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
continue;
|
|
489
|
-
coOccurCounts.set(callee, (coOccurCounts.get(callee) ?? 0) + 1);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
for (const [consequent, support] of coOccurCounts) {
|
|
493
|
-
const confidence = support / total;
|
|
494
|
-
if (confidence >= config.pairConfidence && support >= config.minCorpus) {
|
|
495
|
-
// Find an exemplar: a function that calls both A and X
|
|
496
|
-
let exemplarFile = null;
|
|
497
|
-
let exemplarLine = null;
|
|
498
|
-
for (const cid of callerIds) {
|
|
499
|
-
const cs = callSets.get(cid);
|
|
500
|
-
if (cs && cs.has(consequent)) {
|
|
501
|
-
const funcRow = rows.find((r) => r.id === cid);
|
|
502
|
-
if (funcRow) {
|
|
503
|
-
exemplarFile = funcRow.file_path;
|
|
504
|
-
exemplarLine = funcRow.line_number;
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
conventions.push({
|
|
510
|
-
domain: 'usage-pair',
|
|
511
|
-
rule_id: 'conventions/usage-pair',
|
|
512
|
-
antecedent,
|
|
513
|
-
consequent,
|
|
514
|
-
pattern: null,
|
|
515
|
-
directory: null,
|
|
516
|
-
file_path: null,
|
|
517
|
-
line: null,
|
|
518
|
-
support,
|
|
519
|
-
total_cases: total,
|
|
520
|
-
confidence: Math.round(confidence * 10000) / 10000,
|
|
521
|
-
exemplar_file: exemplarFile,
|
|
522
|
-
exemplar_line: exemplarLine,
|
|
523
|
-
hash: computeHash([antecedent, consequent, support, total]),
|
|
524
|
-
});
|
|
479
|
+
const directory = path.dirname(file) || '.';
|
|
480
|
+
for (const imp of imports) {
|
|
481
|
+
const source = imp.source;
|
|
482
|
+
const form = imp.form;
|
|
483
|
+
const key = `${source}::${directory}`;
|
|
484
|
+
if (!formCounts.has(key))
|
|
485
|
+
formCounts.set(key, new Map());
|
|
486
|
+
const fc = formCounts.get(key);
|
|
487
|
+
fc.set(form, (fc.get(form) ?? 0) + 1);
|
|
488
|
+
// Track exemplar (first one wins; line 0 mirrors the legacy miner)
|
|
489
|
+
if (!exemplars.has(key)) {
|
|
490
|
+
exemplars.set(key, { file, line: 0, form });
|
|
525
491
|
}
|
|
526
492
|
}
|
|
527
493
|
}
|
|
494
|
+
// For each (source, directory) pair, find dominant form
|
|
495
|
+
for (const [key, fc] of formCounts) {
|
|
496
|
+
const [source, directory] = key.split('::');
|
|
497
|
+
const mode = summarizeModes(fc, config);
|
|
498
|
+
if (!mode)
|
|
499
|
+
continue;
|
|
500
|
+
pushModeConvention(conventions, mode, {
|
|
501
|
+
domain: 'import-form',
|
|
502
|
+
antecedent: source,
|
|
503
|
+
consequent: mode.dominant,
|
|
504
|
+
pattern: minorityLabel(fc, mode.dominant) || null,
|
|
505
|
+
directory,
|
|
506
|
+
exemplar: exemplars.get(key),
|
|
507
|
+
hash: computeHash([source, directory, mode.dominant, mode.maxCount, mode.total]),
|
|
508
|
+
});
|
|
509
|
+
}
|
|
528
510
|
return conventions;
|
|
529
511
|
}
|
|
530
512
|
/**
|
|
@@ -532,27 +514,25 @@ function mineUsagePairs(db, config) {
|
|
|
532
514
|
*
|
|
533
515
|
* Per (source, directory) pair, compute the dominant import form. Reads source
|
|
534
516
|
* files from disk to parse import statements, since import form data is not
|
|
535
|
-
* persisted in the functions table.
|
|
517
|
+
* persisted in the functions table. Thin wrapper over
|
|
518
|
+
* {@link mineImportFormFromFacts} — it reads the same distinct-file set the pure
|
|
519
|
+
* miner drives off, parses each source with `parseFileImports`, and projects to
|
|
520
|
+
* the `{source, form, line}` shape the pure miner consumes.
|
|
536
521
|
*/
|
|
537
522
|
function mineImportForm(db, config, projectRoot, getSource) {
|
|
538
|
-
|
|
539
|
-
//
|
|
523
|
+
// Get unique file paths (the directory is derived from the path, not queried —
|
|
524
|
+
// `path.dirname(file) || '.'` is equivalent to the old `dir_part` discriminator).
|
|
540
525
|
const rows = db
|
|
541
|
-
.prepare(`SELECT DISTINCT file_path
|
|
542
|
-
substr(file_path, 1, length(file_path) - length(replace(file_path, '/', '')) - 1) as dir_part
|
|
543
|
-
FROM functions
|
|
544
|
-
WHERE file_path IS NOT NULL`)
|
|
526
|
+
.prepare(`SELECT DISTINCT file_path FROM functions WHERE file_path IS NOT NULL`)
|
|
545
527
|
.all();
|
|
546
|
-
|
|
528
|
+
const files = [];
|
|
529
|
+
const importsByFile = new Map();
|
|
547
530
|
const seen = new Set();
|
|
548
|
-
// (source, directory) -> Map<form, count>
|
|
549
|
-
const formCounts = new Map();
|
|
550
|
-
// (source, directory) -> exemplar
|
|
551
|
-
const exemplars = new Map();
|
|
552
531
|
for (const row of rows) {
|
|
553
532
|
if (seen.has(row.file_path))
|
|
554
533
|
continue;
|
|
555
534
|
seen.add(row.file_path);
|
|
535
|
+
files.push(row.file_path);
|
|
556
536
|
const fullPath = projectRoot && !path.isAbsolute(row.file_path)
|
|
557
537
|
? path.join(projectRoot, row.file_path)
|
|
558
538
|
: row.file_path;
|
|
@@ -569,64 +549,9 @@ function mineImportForm(db, config, projectRoot, getSource) {
|
|
|
569
549
|
continue;
|
|
570
550
|
}
|
|
571
551
|
}
|
|
572
|
-
|
|
573
|
-
const imports = parseFileImports(content);
|
|
574
|
-
for (const imp of imports) {
|
|
575
|
-
const source = imp.source;
|
|
576
|
-
const form = imp.form;
|
|
577
|
-
const key = `${source}::${directory}`;
|
|
578
|
-
if (!formCounts.has(key))
|
|
579
|
-
formCounts.set(key, new Map());
|
|
580
|
-
const fc = formCounts.get(key);
|
|
581
|
-
fc.set(form, (fc.get(form) ?? 0) + 1);
|
|
582
|
-
// Track exemplar (first one wins)
|
|
583
|
-
if (!exemplars.has(key)) {
|
|
584
|
-
exemplars.set(key, { file: row.file_path, line: 0, form });
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
// For each (source, directory) pair, find dominant form
|
|
589
|
-
for (const [key, fc] of formCounts) {
|
|
590
|
-
const [source, directory] = key.split('::');
|
|
591
|
-
const total = [...fc.values()].reduce((s, c) => s + c, 0);
|
|
592
|
-
if (total < config.minCorpus)
|
|
593
|
-
continue;
|
|
594
|
-
// Find the mode (most common form)
|
|
595
|
-
let maxCount = 0;
|
|
596
|
-
let dominantForm = '';
|
|
597
|
-
for (const [form, count] of fc) {
|
|
598
|
-
if (count > maxCount) {
|
|
599
|
-
maxCount = count;
|
|
600
|
-
dominantForm = form;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
const modeShare = maxCount / total;
|
|
604
|
-
if (modeShare >= config.modeShare && maxCount >= config.minCorpus) {
|
|
605
|
-
// List the minority forms (for reference)
|
|
606
|
-
const minorityForms = [...fc.entries()]
|
|
607
|
-
.filter(([f]) => f !== dominantForm)
|
|
608
|
-
.map(([f, c]) => `${f}:${c}`)
|
|
609
|
-
.join(',');
|
|
610
|
-
const exemplar = exemplars.get(key);
|
|
611
|
-
conventions.push({
|
|
612
|
-
domain: 'import-form',
|
|
613
|
-
rule_id: 'conventions/import-form',
|
|
614
|
-
antecedent: source,
|
|
615
|
-
consequent: dominantForm,
|
|
616
|
-
pattern: minorityForms || null,
|
|
617
|
-
directory,
|
|
618
|
-
file_path: null,
|
|
619
|
-
line: null,
|
|
620
|
-
support: maxCount,
|
|
621
|
-
total_cases: total,
|
|
622
|
-
confidence: Math.round(modeShare * 10000) / 10000,
|
|
623
|
-
exemplar_file: exemplar?.file ?? null,
|
|
624
|
-
exemplar_line: exemplar?.line ?? null,
|
|
625
|
-
hash: computeHash([source, directory, dominantForm, maxCount, total]),
|
|
626
|
-
});
|
|
627
|
-
}
|
|
552
|
+
importsByFile.set(row.file_path, parseFileImports(content).map((imp) => ({ source: imp.source, form: imp.form, line: imp.line })));
|
|
628
553
|
}
|
|
629
|
-
return
|
|
554
|
+
return mineImportFormFromFacts(files, (fp) => importsByFile.get(fp), config);
|
|
630
555
|
}
|
|
631
556
|
/**
|
|
632
557
|
* Mine `error-handling` conventions.
|
|
@@ -636,73 +561,133 @@ function mineImportForm(db, config, projectRoot, getSource) {
|
|
|
636
561
|
* excluded from the corpus and never flagged as deviants.
|
|
637
562
|
*/
|
|
638
563
|
function mineErrorHandling(db, config) {
|
|
639
|
-
const
|
|
640
|
-
const rows = db
|
|
564
|
+
const funcs = db
|
|
641
565
|
.prepare(`SELECT id, name, file_path, line_number, body
|
|
642
566
|
FROM functions
|
|
643
567
|
WHERE body IS NOT NULL`)
|
|
644
568
|
.all();
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
569
|
+
return mineErrorHandlingFromFacts(funcs, config);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Join a group's non-dominant forms into a `form:count,form:count` label. The
|
|
573
|
+
* import-form, export-shape, and error-handling miners all reduce a
|
|
574
|
+
* `Map<form, count>` to its dominant form plus a minority reference label; this
|
|
575
|
+
* is the shared label computation.
|
|
576
|
+
*/
|
|
577
|
+
function minorityLabel(counts, dominant) {
|
|
578
|
+
return [...counts.entries()]
|
|
579
|
+
.filter(([f]) => f !== dominant)
|
|
580
|
+
.map(([f, c]) => `${f}:${c}`)
|
|
581
|
+
.join(',');
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Reduce a group's `Map<form, count>` to its dominant form, or null when the
|
|
585
|
+
* group is below the corpus minimum or the dominant form does not clear the
|
|
586
|
+
* mode-share gate. Shared by the import-form, export-shape, and error-handling
|
|
587
|
+
* miners so the total/dominant/mode-share math lives once.
|
|
588
|
+
*/
|
|
589
|
+
function summarizeModes(counts, config) {
|
|
590
|
+
const total = [...counts.values()].reduce((s, c) => s + c, 0);
|
|
591
|
+
if (total < config.minCorpus)
|
|
592
|
+
return null;
|
|
593
|
+
let maxCount = 0;
|
|
594
|
+
let dominant = '';
|
|
595
|
+
for (const [form, count] of counts) {
|
|
596
|
+
if (count > maxCount) {
|
|
597
|
+
maxCount = count;
|
|
598
|
+
dominant = form;
|
|
665
599
|
}
|
|
666
600
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
601
|
+
const modeShare = maxCount / total;
|
|
602
|
+
if (modeShare < config.modeShare || maxCount < config.minCorpus)
|
|
603
|
+
return null;
|
|
604
|
+
return { dominant, maxCount, total };
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Push one dominant-form convention onto `conventions`. The import-form,
|
|
608
|
+
* export-shape, and error-handling miners each reduce a group's histogram to a
|
|
609
|
+
* dominant form and emit a single `Convention` whose `file_path`/`line` are
|
|
610
|
+
* always null, `confidence` is the mode share rounded to 4 decimals, and the
|
|
611
|
+
* exemplar anchors are null-coalesced — so that tail lives here once and the
|
|
612
|
+
* three miners pass only their domain-specific fields.
|
|
613
|
+
*/
|
|
614
|
+
function pushModeConvention(conventions, mode, fields) {
|
|
615
|
+
conventions.push({
|
|
616
|
+
domain: fields.domain,
|
|
617
|
+
rule_id: `conventions/${fields.domain}`,
|
|
618
|
+
antecedent: fields.antecedent,
|
|
619
|
+
consequent: fields.consequent,
|
|
620
|
+
pattern: fields.pattern,
|
|
621
|
+
directory: fields.directory,
|
|
622
|
+
file_path: null,
|
|
623
|
+
line: null,
|
|
624
|
+
support: mode.maxCount,
|
|
625
|
+
total_cases: mode.total,
|
|
626
|
+
confidence: Math.round((mode.maxCount / mode.total) * 10000) / 10000,
|
|
627
|
+
exemplar_file: fields.exemplar?.file ?? null,
|
|
628
|
+
exemplar_line: fields.exemplar?.line ?? null,
|
|
629
|
+
hash: fields.hash,
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Shared histogram → conventions tail for export-shape mining. `dirForms` is
|
|
634
|
+
* directory → Map<form, count> and `dirExemplars` directory → first-seen anchor;
|
|
635
|
+
* both the pure (`mineExportShapeFromFacts`) and DB (`mineExportShape`) miners
|
|
636
|
+
* build these maps and reduce them through this one function, so the dominant-
|
|
637
|
+
* form selection and confidence math can never drift between the two paths.
|
|
638
|
+
*/
|
|
639
|
+
function buildExportShapeConventions(dirForms, dirExemplars, config) {
|
|
640
|
+
const conventions = [];
|
|
641
|
+
for (const [directory, forms] of dirForms) {
|
|
642
|
+
const mode = summarizeModes(forms, config);
|
|
643
|
+
if (!mode)
|
|
670
644
|
continue;
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
if (modeShare >= config.modeShare && maxCount >= config.minCorpus) {
|
|
681
|
-
const minorityShapes = [...shapes.entries()]
|
|
682
|
-
.filter(([s]) => s !== dominantShape)
|
|
683
|
-
.map(([s, c]) => `${s}:${c}`)
|
|
684
|
-
.join(',');
|
|
685
|
-
const exemplar = dirExemplars.get(directory);
|
|
686
|
-
conventions.push({
|
|
687
|
-
domain: 'error-handling',
|
|
688
|
-
rule_id: 'conventions/error-handling',
|
|
689
|
-
antecedent: null,
|
|
690
|
-
consequent: null,
|
|
691
|
-
pattern: dominantShape,
|
|
692
|
-
directory,
|
|
693
|
-
file_path: null,
|
|
694
|
-
line: null,
|
|
695
|
-
support: maxCount,
|
|
696
|
-
total_cases: total,
|
|
697
|
-
confidence: Math.round(modeShare * 10000) / 10000,
|
|
698
|
-
exemplar_file: exemplar?.file ?? null,
|
|
699
|
-
exemplar_line: exemplar?.line ?? null,
|
|
700
|
-
hash: computeHash([directory, dominantShape, maxCount, total]),
|
|
701
|
-
});
|
|
702
|
-
}
|
|
645
|
+
pushModeConvention(conventions, mode, {
|
|
646
|
+
domain: 'export-shape',
|
|
647
|
+
antecedent: null,
|
|
648
|
+
consequent: null,
|
|
649
|
+
pattern: mode.dominant,
|
|
650
|
+
directory,
|
|
651
|
+
exemplar: dirExemplars.get(directory),
|
|
652
|
+
hash: computeHash([directory, mode.dominant, mode.maxCount, mode.total]),
|
|
653
|
+
});
|
|
703
654
|
}
|
|
704
655
|
return conventions;
|
|
705
656
|
}
|
|
657
|
+
/**
|
|
658
|
+
* Mine `export-shape` conventions from facts — the pure, AST-served path the
|
|
659
|
+
* phase model runs (`function-index` + `export-form` facts). `getExportForm`
|
|
660
|
+
* resolves a file's exported `(name, isDefault)` pairs from the `export-form`
|
|
661
|
+
* fact, which is the AST-extracted exports set (`extractExports`) the legacy
|
|
662
|
+
* reducer read as `exportsMap`. No source fallback: the phase model always has
|
|
663
|
+
* the export-form fact, so an absent file simply contributes no row.
|
|
664
|
+
* @param funcs The function-index rows to mine.
|
|
665
|
+
* @param config The convention mining config.
|
|
666
|
+
* @param getExportForm Callback resolving a file's exported (name, isDefault) pairs.
|
|
667
|
+
* @returns The mined export-shape conventions.
|
|
668
|
+
*/
|
|
669
|
+
export function mineExportShapeFromFacts(funcs, config, getExportForm) {
|
|
670
|
+
const dirForms = new Map();
|
|
671
|
+
const dirExemplars = new Map();
|
|
672
|
+
for (const row of funcs) {
|
|
673
|
+
const fileExports = getExportForm?.(row.file_path);
|
|
674
|
+
if (!fileExports)
|
|
675
|
+
continue;
|
|
676
|
+
const match = fileExports.find((e) => e.name === row.name);
|
|
677
|
+
if (!match)
|
|
678
|
+
continue;
|
|
679
|
+
const form = match.isDefault ? 'default' : 'named';
|
|
680
|
+
const directory = path.dirname(row.file_path) || '.';
|
|
681
|
+
if (!dirForms.has(directory))
|
|
682
|
+
dirForms.set(directory, new Map());
|
|
683
|
+
const forms = dirForms.get(directory);
|
|
684
|
+
forms.set(form, (forms.get(form) ?? 0) + 1);
|
|
685
|
+
if (!dirExemplars.has(directory)) {
|
|
686
|
+
dirExemplars.set(directory, { file: row.file_path, line: row.line_number, form });
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return buildExportShapeConventions(dirForms, dirExemplars, config);
|
|
690
|
+
}
|
|
706
691
|
/**
|
|
707
692
|
* Mine `export-shape` conventions.
|
|
708
693
|
*
|
|
@@ -711,7 +696,6 @@ function mineErrorHandling(db, config) {
|
|
|
711
696
|
* form, since it is not stored in the functions table metadata.
|
|
712
697
|
*/
|
|
713
698
|
function mineExportShape(db, config, projectRoot, getSource, getExports) {
|
|
714
|
-
const conventions = [];
|
|
715
699
|
const rows = db
|
|
716
700
|
.prepare(`SELECT id, name, file_path, line_number
|
|
717
701
|
FROM functions
|
|
@@ -762,44 +746,7 @@ function mineExportShape(db, config, projectRoot, getSource, getExports) {
|
|
|
762
746
|
});
|
|
763
747
|
}
|
|
764
748
|
}
|
|
765
|
-
|
|
766
|
-
const total = [...forms.values()].reduce((s, c) => s + c, 0);
|
|
767
|
-
if (total < config.minCorpus)
|
|
768
|
-
continue;
|
|
769
|
-
let maxCount = 0;
|
|
770
|
-
let dominantForm = '';
|
|
771
|
-
for (const [form, count] of forms) {
|
|
772
|
-
if (count > maxCount) {
|
|
773
|
-
maxCount = count;
|
|
774
|
-
dominantForm = form;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
const modeShare = maxCount / total;
|
|
778
|
-
if (modeShare >= config.modeShare && maxCount >= config.minCorpus) {
|
|
779
|
-
const minorityForms = [...forms.entries()]
|
|
780
|
-
.filter(([f]) => f !== dominantForm)
|
|
781
|
-
.map(([f, c]) => `${f}:${c}`)
|
|
782
|
-
.join(',');
|
|
783
|
-
const exemplar = dirExemplars.get(directory);
|
|
784
|
-
conventions.push({
|
|
785
|
-
domain: 'export-shape',
|
|
786
|
-
rule_id: 'conventions/export-shape',
|
|
787
|
-
antecedent: null,
|
|
788
|
-
consequent: null,
|
|
789
|
-
pattern: dominantForm,
|
|
790
|
-
directory,
|
|
791
|
-
file_path: null,
|
|
792
|
-
line: null,
|
|
793
|
-
support: maxCount,
|
|
794
|
-
total_cases: total,
|
|
795
|
-
confidence: Math.round(modeShare * 10000) / 10000,
|
|
796
|
-
exemplar_file: exemplar?.file ?? null,
|
|
797
|
-
exemplar_line: exemplar?.line ?? null,
|
|
798
|
-
hash: computeHash([directory, dominantForm, maxCount, total]),
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
return conventions;
|
|
749
|
+
return buildExportShapeConventions(dirForms, dirExemplars, config);
|
|
803
750
|
}
|
|
804
751
|
/**
|
|
805
752
|
* Classify a function into its export kind for naming-convention partitioning.
|
|
@@ -832,15 +779,133 @@ function classifyExportKind(row) {
|
|
|
832
779
|
* minCorpus populations produce nothing.
|
|
833
780
|
*/
|
|
834
781
|
function mineNaming(db, config) {
|
|
835
|
-
const
|
|
836
|
-
const rows = db
|
|
782
|
+
const funcs = db
|
|
837
783
|
.prepare(`SELECT id, name, file_path, line_number, entity_type, component_type
|
|
838
784
|
FROM functions
|
|
839
785
|
WHERE is_exported = 1`)
|
|
840
786
|
.all();
|
|
787
|
+
return mineNamingFromFacts(funcs, config);
|
|
788
|
+
}
|
|
789
|
+
/** The pure usage-pair miner — byte-identical logic to `mineUsagePairs`, over rows. @param funcs The function rows. @param calls The caller→callee call rows. @param config The convention mining config. @returns The mined usage-pair conventions. */
|
|
790
|
+
export function mineUsagePairsFromFacts(funcs, calls, config) {
|
|
791
|
+
const conventions = [];
|
|
792
|
+
const callSets = new Map();
|
|
793
|
+
for (const cr of calls) {
|
|
794
|
+
if (!callSets.has(cr.caller_id))
|
|
795
|
+
callSets.set(cr.caller_id, new Set());
|
|
796
|
+
callSets.get(cr.caller_id).add(cr.callee_name);
|
|
797
|
+
}
|
|
798
|
+
const projectSymbols = new Set();
|
|
799
|
+
for (const r of funcs) {
|
|
800
|
+
projectSymbols.add(r.name);
|
|
801
|
+
}
|
|
802
|
+
const antecedentCallers = new Map();
|
|
803
|
+
for (const cr of calls) {
|
|
804
|
+
if (!antecedentCallers.has(cr.callee_name))
|
|
805
|
+
antecedentCallers.set(cr.callee_name, new Set());
|
|
806
|
+
antecedentCallers.get(cr.callee_name).add(cr.caller_id);
|
|
807
|
+
}
|
|
808
|
+
for (const [antecedent, callerIds] of antecedentCallers) {
|
|
809
|
+
if (BUILT_IN_CALLEES.has(antecedent) || !projectSymbols.has(antecedent))
|
|
810
|
+
continue;
|
|
811
|
+
const total = callerIds.size;
|
|
812
|
+
if (total < config.minCorpus)
|
|
813
|
+
continue;
|
|
814
|
+
const coOccurCounts = new Map();
|
|
815
|
+
for (const cid of callerIds) {
|
|
816
|
+
const callSet = callSets.get(cid);
|
|
817
|
+
if (!callSet)
|
|
818
|
+
continue;
|
|
819
|
+
for (const callee of callSet) {
|
|
820
|
+
if (callee === antecedent)
|
|
821
|
+
continue;
|
|
822
|
+
if (BUILT_IN_CALLEES.has(callee))
|
|
823
|
+
continue;
|
|
824
|
+
coOccurCounts.set(callee, (coOccurCounts.get(callee) ?? 0) + 1);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
for (const [consequent, support] of coOccurCounts) {
|
|
828
|
+
const confidence = support / total;
|
|
829
|
+
if (confidence >= config.pairConfidence && support >= config.minCorpus) {
|
|
830
|
+
let exemplarFile = null;
|
|
831
|
+
let exemplarLine = null;
|
|
832
|
+
for (const cid of callerIds) {
|
|
833
|
+
const cs = callSets.get(cid);
|
|
834
|
+
if (cs && cs.has(consequent)) {
|
|
835
|
+
const funcRow = funcs.find((r) => r.id === cid);
|
|
836
|
+
if (funcRow) {
|
|
837
|
+
exemplarFile = funcRow.file_path;
|
|
838
|
+
exemplarLine = funcRow.line_number;
|
|
839
|
+
break;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
conventions.push({
|
|
844
|
+
domain: 'usage-pair',
|
|
845
|
+
rule_id: 'conventions/usage-pair',
|
|
846
|
+
antecedent,
|
|
847
|
+
consequent,
|
|
848
|
+
pattern: null,
|
|
849
|
+
directory: null,
|
|
850
|
+
file_path: null,
|
|
851
|
+
line: null,
|
|
852
|
+
support,
|
|
853
|
+
total_cases: total,
|
|
854
|
+
confidence: Math.round(confidence * 10000) / 10000,
|
|
855
|
+
exemplar_file: exemplarFile,
|
|
856
|
+
exemplar_line: exemplarLine,
|
|
857
|
+
hash: computeHash([antecedent, consequent, support, total]),
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
return conventions;
|
|
863
|
+
}
|
|
864
|
+
/** The pure error-handling miner — byte-identical logic to `mineErrorHandling`. @param funcs The function rows carrying bodies. @param config The convention mining config. @returns The mined error-handling conventions. */
|
|
865
|
+
export function mineErrorHandlingFromFacts(funcs, config) {
|
|
866
|
+
const conventions = [];
|
|
867
|
+
const dirShapes = new Map();
|
|
868
|
+
const dirExemplars = new Map();
|
|
869
|
+
for (const row of funcs) {
|
|
870
|
+
const body = row.body ?? undefined;
|
|
871
|
+
const shape = detectErrorHandlingShape(body);
|
|
872
|
+
if (!shape)
|
|
873
|
+
continue; // no error handling → skip
|
|
874
|
+
const directory = path.dirname(row.file_path) || '.';
|
|
875
|
+
if (!dirShapes.has(directory))
|
|
876
|
+
dirShapes.set(directory, new Map());
|
|
877
|
+
const shapes = dirShapes.get(directory);
|
|
878
|
+
shapes.set(shape, (shapes.get(shape) ?? 0) + 1);
|
|
879
|
+
if (!dirExemplars.has(directory)) {
|
|
880
|
+
dirExemplars.set(directory, {
|
|
881
|
+
file: row.file_path,
|
|
882
|
+
line: row.line_number,
|
|
883
|
+
shape,
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
for (const [directory, shapes] of dirShapes) {
|
|
888
|
+
const mode = summarizeModes(shapes, config);
|
|
889
|
+
if (!mode)
|
|
890
|
+
continue;
|
|
891
|
+
pushModeConvention(conventions, mode, {
|
|
892
|
+
domain: 'error-handling',
|
|
893
|
+
antecedent: null,
|
|
894
|
+
consequent: null,
|
|
895
|
+
pattern: mode.dominant,
|
|
896
|
+
directory,
|
|
897
|
+
exemplar: dirExemplars.get(directory),
|
|
898
|
+
hash: computeHash([directory, mode.dominant, mode.maxCount, mode.total]),
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
return conventions;
|
|
902
|
+
}
|
|
903
|
+
/** The pure naming miner — byte-identical logic to `mineNaming`. @param funcs The function rows to classify. @param config The convention mining config. @returns The mined naming conventions. */
|
|
904
|
+
export function mineNamingFromFacts(funcs, config) {
|
|
905
|
+
const conventions = [];
|
|
841
906
|
const dirKindCases = new Map();
|
|
842
907
|
const dirKindExemplars = new Map();
|
|
843
|
-
for (const row of
|
|
908
|
+
for (const row of funcs) {
|
|
844
909
|
const casing = detectCase(row.name);
|
|
845
910
|
if (!casing)
|
|
846
911
|
continue; // non-Latin or unclassifiable → skip
|
|
@@ -919,15 +984,23 @@ export const MINER_VERSION = 2;
|
|
|
919
984
|
* Compute a content hash of the miner inputs for change detection.
|
|
920
985
|
* Callers can store this in the meta table to skip re-mining when unchanged.
|
|
921
986
|
* Includes MINER_VERSION so that algorithm changes force a re-mine.
|
|
987
|
+
* @param db The SQLite database to hash inputs from.
|
|
988
|
+
* @param config The convention mining config.
|
|
989
|
+
* @returns The computed input hash string.
|
|
922
990
|
*/
|
|
923
991
|
export function computeMinerInputHash(db, config) {
|
|
924
992
|
// Hash actual content — not just counts — so two corpora with identical
|
|
925
993
|
// counts but different functions produce different hashes and are mined.
|
|
926
|
-
|
|
994
|
+
// Read the body LENGTH via SQL, not the full body text: the hash only needs
|
|
995
|
+
// the length (content identity is already carried by `content_hash`), and
|
|
996
|
+
// loading the whole `body` column here would be an O(total-source) read on
|
|
997
|
+
// the single-file `changed` hook path — the same cost scoped-DRY introduced
|
|
998
|
+
// and the whole-table-read guard forbids.
|
|
999
|
+
const rows = db.prepare('SELECT name, content_hash, LENGTH(COALESCE(body, \'\')) as body_len FROM functions ORDER BY name, content_hash').all();
|
|
927
1000
|
const callRows = db.prepare('SELECT fc.callee_name FROM function_calls fc ORDER BY fc.callee_name').all();
|
|
928
1001
|
return computeHash([
|
|
929
1002
|
MINER_VERSION,
|
|
930
|
-
rows.map(r => [r.name, r.content_hash, r.
|
|
1003
|
+
rows.map(r => [r.name, r.content_hash, r.body_len]),
|
|
931
1004
|
callRows.map(r => r.callee_name),
|
|
932
1005
|
config,
|
|
933
1006
|
]);
|
|
@@ -939,6 +1012,8 @@ export function computeMinerInputHash(db, config) {
|
|
|
939
1012
|
* @param config Threshold configuration for the miner.
|
|
940
1013
|
* @param projectRoot Optional project root — required for import-form and
|
|
941
1014
|
* export-shape mining to resolve file paths.
|
|
1015
|
+
* @param getSource Optional callback to read a file's source (avoids disk reads).
|
|
1016
|
+
* @param getExports Optional callback for AST-based export-form detection.
|
|
942
1017
|
* @returns Array of mined conventions (uncapped — caller should upsert).
|
|
943
1018
|
*/
|
|
944
1019
|
export function mineConventions(db, config, projectRoot, getSource, getExports) {
|