code-auditor-mcp 4.1.1 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +338 -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 +424 -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 +328 -0
- package/dist/analyzers/receiverRoot.d.ts.map +1 -0
- package/dist/analyzers/receiverRoot.js +990 -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 +231 -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 +64 -1
- package/dist/auditRunner.d.ts.map +1 -1
- package/dist/auditRunner.js +1538 -1033
- 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 +969 -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 +2 -0
- 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/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 +468 -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 +1027 -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 +200 -0
- package/dist/phase/receiverConsumers.d.ts.map +1 -0
- package/dist/phase/receiverConsumers.js +1025 -0
- package/dist/phase/receiverConsumers.js.map +1 -0
- package/dist/phase/receiverProvenance.d.ts +97 -0
- package/dist/phase/receiverProvenance.d.ts.map +1 -0
- package/dist/phase/receiverProvenance.js +337 -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 +2191 -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 +101 -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 +11 -5
- package/plugin/.claude-plugin/manifest.json +16 -0
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +6 -2
- package/plugin/scripts/hook-audit.sh +41 -14
- package/plugin/scripts/hook-common.sh +50 -5
- package/plugin/scripts/hook-drift-check.sh +72 -0
- package/plugin/scripts/hook-self-audit.sh +17 -12
- package/plugin/skills/code-auditor/SKILL.md +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec 68 §3.2 — the cross-domain lifecycle rules, migrated to `analyze(ctx)`.
|
|
3
|
+
*
|
|
4
|
+
* Two of the five `cross-domain` rules are a clean reduction over the
|
|
5
|
+
* `schema-usage` fact: `written-never-read` and `read-never-written`. Both ask
|
|
6
|
+
* "is this table used on one side of the read/write lifecycle but not the
|
|
7
|
+
* other?" — a pure set-difference over the table names in the fact, with the
|
|
8
|
+
* one-sided detector anchored to a single row per table. Their violation logic
|
|
9
|
+
* is re-homed verbatim from `CrossDomainAnalyzer`'s `detectWrittenNeverRead` /
|
|
10
|
+
* `detectReadNeverWritten` (and its `nonQueryBuilderTableFilter` /
|
|
11
|
+
* `usageIdentityLabel` helpers), which were SQL-over-`schema_usage` queries with
|
|
12
|
+
* no other input.
|
|
13
|
+
*
|
|
14
|
+
* The facade-origin exclusion is the one subtlety: a table whose *every* row
|
|
15
|
+
* carries a facade `origin` (`query-builder` for a fluent knex-style builder, or
|
|
16
|
+
* `collection-adapter` for a `SqliteCollectionAdapter` binding) is accessed
|
|
17
|
+
* through a facade whose read/write methods the extractor does not record — not
|
|
18
|
+
* a one-sided lifecycle defect — so both detectors skip it. The read/write
|
|
19
|
+
* *sets* themselves are computed regardless of origin, which is what lets a
|
|
20
|
+
* query-builder read balance a raw-SQL create (cp_test). The filter is
|
|
21
|
+
* therefore: a table participates only if it has at least one non-facade row.
|
|
22
|
+
* (`collection-adapter` is the `whitelist`-table false positive: the extractor
|
|
23
|
+
* records only the constructor's `select` binding — `new SqliteCollectionAdapter(db,
|
|
24
|
+
* 'whitelist')` — and none of the facade's interpolated `INSERT`/`UPDATE`, so a
|
|
25
|
+
* facade-only table read as read-never-written.)
|
|
26
|
+
*
|
|
27
|
+
* The anchor line is the first row after sorting, which reproduces the legacy
|
|
28
|
+
* SQL's `SELECT DISTINCT … ORDER BY table_name, file_path` exactly. SQLite sorts
|
|
29
|
+
* a `DISTINCT` result by the ORDER BY columns first, then the remaining SELECT
|
|
30
|
+
* columns in REVERSE order, so the full key is (table_name, file_path,
|
|
31
|
+
* usage_type, line, function_start_column, function_start_line, function_name)
|
|
32
|
+
* with NULLs first. That reverse-column tiebreak is load-bearing: the composite
|
|
33
|
+
* data-access fixture writes `users` with INSERT/UPDATE/DELETE/INSERT/UPDATE,
|
|
34
|
+
* and the DELETE (not the first INSERT) is the anchor.
|
|
35
|
+
*
|
|
36
|
+
* Also here: `multi-table-write` (transaction-boundary risk) — migrated on top
|
|
37
|
+
* of two further facts, `call-graph` (the `functions` + `graph_cache` identity
|
|
38
|
+
* projection, read from the index) and `batch-functions` (the per-file AST
|
|
39
|
+
* projection of the legacy `.batch(` re-parse). Its `analyze(ctx)` reproduces
|
|
40
|
+
* the legacy `detectTransactionBoundaryRisk` / `groupWriterTables` /
|
|
41
|
+
* `expandWrittenTables` / `flagTransactionBoundaryWrites` verbatim over those
|
|
42
|
+
* facts.
|
|
43
|
+
*
|
|
44
|
+
* Also here: `no-validator-reachable` (validation bypass) — migrated on top of
|
|
45
|
+
* the `call-graph` fact (widened with the `functions` table's `used_imports` /
|
|
46
|
+
* `is_exported` columns for validator provenance) plus `schema-usage`. Its
|
|
47
|
+
* `analyze(ctx)` reproduces the legacy `detectValidationBypass` /
|
|
48
|
+
* `buildValidatorIds` / `bfsReachesValidator` / `computeWriterCoverage` /
|
|
49
|
+
* `groupWritersByDirectory` / `flagUnvalidatedWriters` verbatim over those
|
|
50
|
+
* facts, reading the opt-in `validatorBypass` thresholds (validators, modeShare,
|
|
51
|
+
* minCorpus, depth) from `ctx.thresholds`.
|
|
52
|
+
*
|
|
53
|
+
* Also here: `uncovered-risk` (coverage by importance) — migrated on top of the
|
|
54
|
+
* widened `call-graph` (now carrying `lineNumber`), the `hotspot` fact, and the
|
|
55
|
+
* `coverage` fact. Its `analyze(ctx)` reproduces the legacy `detectUncoveredRisk`
|
|
56
|
+
* / `detectMeasuredUncovered` / `detectStaticReachUncovered` /
|
|
57
|
+
* `queryHighRiskFunctions` / `getUntestedTopDecile` / `computeTestReachableIds`
|
|
58
|
+
* verbatim over those facts, reading the opt-in `coverage` thresholds
|
|
59
|
+
* (topRiskDecile, testGlobs, staticReachDepth) from `ctx.thresholds`. Both
|
|
60
|
+
* `no-validator-reachable` and `uncovered-risk` gate on the opt-in config key
|
|
61
|
+
* being present, exactly as the legacy `runDetectors` did (`if (bypass)` /
|
|
62
|
+
* `if (coverage)`).
|
|
63
|
+
*/
|
|
64
|
+
import * as path from 'node:path';
|
|
65
|
+
import { RULE_REGISTRY } from '../../analyzers/ruleRegistry.js';
|
|
66
|
+
import { VALIDATOR_PACKAGES } from '../../analyzers/provenance.js';
|
|
67
|
+
const META = RULE_REGISTRY;
|
|
68
|
+
/** The write verbs a one-sided write lifecycle treats as "written". */
|
|
69
|
+
const WRITE_TYPES = new Set(['insert', 'update', 'delete', 'create']);
|
|
70
|
+
/**
|
|
71
|
+
* The write verbs that carry transaction-boundary risk. `create` (DDL) is
|
|
72
|
+
* deliberately excluded: a `CREATE TABLE` / `CREATE INDEX` defines a schema
|
|
73
|
+
* rather than mutating data, and migrations run it idempotently and atomically —
|
|
74
|
+
* there is no partial-failure data-integrity risk the way a multi-table
|
|
75
|
+
* INSERT/UPDATE/DELETE spanning transaction boundaries has. A function whose
|
|
76
|
+
* writes are all DDL (`runMigrations`, `createSchema`) is a schema definition,
|
|
77
|
+
* not a transaction-boundary hazard.
|
|
78
|
+
*/
|
|
79
|
+
const TXN_WRITE_TYPES = new Set(['insert', 'update', 'delete']);
|
|
80
|
+
/**
|
|
81
|
+
* The "data flows in" verbs a `written-never-read` table must have at least one
|
|
82
|
+
* of to qualify. `create` (DDL) defines a schema rather than populating it — a
|
|
83
|
+
* table that is only ever `CREATE TABLE`-ed is "defined but never populated",
|
|
84
|
+
* not "written and never read". `delete` — especially the no-`WHERE` truncate
|
|
85
|
+
* form (`DELETE FROM t`) that `unfiltered-query` already flags — clears data
|
|
86
|
+
* rather than writing it in, so a `delete`-only table (a cache cleared between
|
|
87
|
+
* runs, whose `insert`/`select` live in a file the extractor does not scan) is
|
|
88
|
+
* not a dead write path either. `insert` and `update` are the unambiguous "data
|
|
89
|
+
* flows in" verbs, so a table with at least one of them *is* a write path.
|
|
90
|
+
*
|
|
91
|
+
* Note this is a *qualification* gate, not the anchor set: the anchor still
|
|
92
|
+
* sorts the full `WRITE_TYPES` set, so a `users` table written
|
|
93
|
+
* INSERT/UPDATE/DELETE/INSERT/UPDATE still anchors on the `delete` (byte-order
|
|
94
|
+
* `delete` < `insert`), preserving the legacy tiebreak. `read-never-written` is
|
|
95
|
+
* deliberately *not* narrowed the same way: its `writeTables` still counts
|
|
96
|
+
* `create` and `delete`, so a `create`+`select` table stays "written" and does
|
|
97
|
+
* not flip to `read-never-written`.
|
|
98
|
+
*/
|
|
99
|
+
const DATA_WRITE_TYPES = new Set(['insert', 'update']);
|
|
100
|
+
/** FTS5 virtual tables (conventional `_fts` suffix) are read via `MATCH`, not a
|
|
101
|
+
* statically-visible `SELECT`, and their INSERTs are trigger maintenance. A
|
|
102
|
+
* "written never read" flag on one is almost always the dynamic-SQL read being
|
|
103
|
+
* invisible to the extractor, not a dead write path. */
|
|
104
|
+
function isFts5Table(name) {
|
|
105
|
+
return name.endsWith('_fts');
|
|
106
|
+
}
|
|
107
|
+
// ── Ordering (re-homes the SQL DISTINCT + ORDER BY tiebreak) ────────────────
|
|
108
|
+
/**
|
|
109
|
+
* Compare two nullable strings with SQLite's BINARY collation semantics:
|
|
110
|
+
* NULL sorts first, then byte order (JS `<`/`>` coincides for the ASCII
|
|
111
|
+
* table/file/function names these rules see).
|
|
112
|
+
*/
|
|
113
|
+
function cmpNullableString(a, b) {
|
|
114
|
+
if (a == null && b == null)
|
|
115
|
+
return 0;
|
|
116
|
+
if (a == null)
|
|
117
|
+
return -1;
|
|
118
|
+
if (b == null)
|
|
119
|
+
return 1;
|
|
120
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
121
|
+
}
|
|
122
|
+
/** Compare two nullable numbers: NULL first, then numeric order. */
|
|
123
|
+
function cmpNullableNumber(a, b) {
|
|
124
|
+
if (a == null && b == null)
|
|
125
|
+
return 0;
|
|
126
|
+
if (a == null)
|
|
127
|
+
return -1;
|
|
128
|
+
if (b == null)
|
|
129
|
+
return 1;
|
|
130
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The full sort key of the legacy `SELECT DISTINCT … ORDER BY table_name,
|
|
134
|
+
* file_path`: ORDER BY columns first, then the remaining SELECT columns in
|
|
135
|
+
* reverse order — (table_name, file_path, usage_type, line,
|
|
136
|
+
* function_start_column, function_start_line, function_name).
|
|
137
|
+
*/
|
|
138
|
+
function cmpUsage(a, b) {
|
|
139
|
+
return (cmpNullableString(a.tableName, b.tableName) ||
|
|
140
|
+
cmpNullableString(a.filePath, b.filePath) ||
|
|
141
|
+
cmpNullableString(a.usageType, b.usageType) ||
|
|
142
|
+
cmpNullableNumber(a.line, b.line) ||
|
|
143
|
+
cmpNullableNumber(a.functionStartColumn, b.functionStartColumn) ||
|
|
144
|
+
cmpNullableNumber(a.functionStartLine, b.functionStartLine) ||
|
|
145
|
+
cmpNullableString(a.functionName, b.functionName));
|
|
146
|
+
}
|
|
147
|
+
// ── Identity label (re-homed from CrossDomainAnalyzer) ──────────────────────
|
|
148
|
+
/**
|
|
149
|
+
* The display label for a usage row: the declaration name when present, else a
|
|
150
|
+
* coordinate fallback (`fn:<line>:<column>`) for anonymous handlers, else
|
|
151
|
+
* `top-level`. A top-level row carries its own coordinate (`functionName =
|
|
152
|
+
* 'top-level'` + a non-null start line/column), so the coordinate — not the
|
|
153
|
+
* `top-level` sentinel — is the label.
|
|
154
|
+
*/
|
|
155
|
+
function usageIdentityLabel(functionName, startLine, startColumn) {
|
|
156
|
+
if (startLine == null)
|
|
157
|
+
return 'top-level';
|
|
158
|
+
if (functionName === 'top-level')
|
|
159
|
+
return `fn:${startLine}:${startColumn}`;
|
|
160
|
+
return functionName ?? `fn:${startLine}:${startColumn}`;
|
|
161
|
+
}
|
|
162
|
+
// ── Detectors (re-homed from CrossDomainAnalyzer, SQL → fact-array) ─────────
|
|
163
|
+
/** The tables with at least one non-facade row. A facade row is a `query-builder`
|
|
164
|
+
* fluent selector or a `collection-adapter` constructor binding — both are
|
|
165
|
+
* facade accesses whose read/write methods the extractor does not record, so a
|
|
166
|
+
* table that is *only* facade rows has no trustworthy lifecycle signal and is
|
|
167
|
+
* skipped by the one-sided detectors (the `whitelist` read-never-written
|
|
168
|
+
* false positive). A table with even one raw-SQL/ORM/tagged/.sql row still
|
|
169
|
+
* participates. */
|
|
170
|
+
function nonFacadeTables(usages) {
|
|
171
|
+
const tables = new Set();
|
|
172
|
+
for (const u of usages) {
|
|
173
|
+
if (u.origin !== 'query-builder' && u.origin !== 'collection-adapter')
|
|
174
|
+
tables.add(u.tableName);
|
|
175
|
+
}
|
|
176
|
+
return tables;
|
|
177
|
+
}
|
|
178
|
+
/** The tables referenced by at least one `select` usage (origin-agnostic). */
|
|
179
|
+
function selectTables(usages) {
|
|
180
|
+
const tables = new Set();
|
|
181
|
+
for (const u of usages) {
|
|
182
|
+
if (u.usageType === 'select')
|
|
183
|
+
tables.add(u.tableName);
|
|
184
|
+
}
|
|
185
|
+
return tables;
|
|
186
|
+
}
|
|
187
|
+
/** The tables referenced by at least one write usage (origin-agnostic). */
|
|
188
|
+
function writeTables(usages) {
|
|
189
|
+
const tables = new Set();
|
|
190
|
+
for (const u of usages) {
|
|
191
|
+
if (WRITE_TYPES.has(u.usageType))
|
|
192
|
+
tables.add(u.tableName);
|
|
193
|
+
}
|
|
194
|
+
return tables;
|
|
195
|
+
}
|
|
196
|
+
/** The tables with at least one "data flows in" usage — an `insert` or `update`
|
|
197
|
+
* (origin-agnostic). A `written-never-read` flag requires one of these; a table
|
|
198
|
+
* whose only visible writes are `create` (DDL) or `delete` (truncate) is not a
|
|
199
|
+
* dead write path, because its `insert`/`select` live in a file the extractor
|
|
200
|
+
* does not scan (out-of-scope receiver) or a dynamic-SQL read. */
|
|
201
|
+
function dataWrittenTables(usages) {
|
|
202
|
+
const tables = new Set();
|
|
203
|
+
for (const u of usages) {
|
|
204
|
+
if (DATA_WRITE_TYPES.has(u.usageType))
|
|
205
|
+
tables.add(u.tableName);
|
|
206
|
+
}
|
|
207
|
+
return tables;
|
|
208
|
+
}
|
|
209
|
+
/** Tables written (INSERT/UPDATE/DELETE) but never read (SELECT). */
|
|
210
|
+
function detectWrittenNeverRead(usages) {
|
|
211
|
+
const nonQb = nonFacadeTables(usages);
|
|
212
|
+
const selects = selectTables(usages);
|
|
213
|
+
const dataWritten = dataWrittenTables(usages);
|
|
214
|
+
const candidates = usages
|
|
215
|
+
.filter((u) => WRITE_TYPES.has(u.usageType) &&
|
|
216
|
+
nonQb.has(u.tableName) &&
|
|
217
|
+
!selects.has(u.tableName) &&
|
|
218
|
+
dataWritten.has(u.tableName) &&
|
|
219
|
+
!isFts5Table(u.tableName))
|
|
220
|
+
.sort(cmpUsage);
|
|
221
|
+
const seen = new Set();
|
|
222
|
+
const out = [];
|
|
223
|
+
for (const u of candidates) {
|
|
224
|
+
if (seen.has(u.tableName))
|
|
225
|
+
continue;
|
|
226
|
+
seen.add(u.tableName);
|
|
227
|
+
out.push({
|
|
228
|
+
ruleId: 'cross-domain/written-never-read',
|
|
229
|
+
severity: 'high',
|
|
230
|
+
message: `Table '${u.tableName}' is written (${u.usageType}) but never read (SELECT). Consider removing unused writes or adding read paths.`,
|
|
231
|
+
file: u.filePath,
|
|
232
|
+
line: u.line,
|
|
233
|
+
column: 0,
|
|
234
|
+
symbol: usageIdentityLabel(u.functionName, u.functionStartLine, u.functionStartColumn),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return out;
|
|
238
|
+
}
|
|
239
|
+
/** Tables read (SELECT) but never written (INSERT/UPDATE/DELETE/CREATE). */
|
|
240
|
+
function detectReadNeverWritten(usages) {
|
|
241
|
+
const nonQb = nonFacadeTables(usages);
|
|
242
|
+
const writes = writeTables(usages);
|
|
243
|
+
const candidates = usages
|
|
244
|
+
.filter((u) => u.usageType === 'select' && nonQb.has(u.tableName) && !writes.has(u.tableName))
|
|
245
|
+
.sort(cmpUsage);
|
|
246
|
+
const seen = new Set();
|
|
247
|
+
const out = [];
|
|
248
|
+
for (const u of candidates) {
|
|
249
|
+
if (seen.has(u.tableName))
|
|
250
|
+
continue;
|
|
251
|
+
seen.add(u.tableName);
|
|
252
|
+
out.push({
|
|
253
|
+
ruleId: 'cross-domain/read-never-written',
|
|
254
|
+
severity: 'severe',
|
|
255
|
+
message: `Table '${u.tableName}' is read (SELECT) but never written (INSERT/UPDATE/DELETE). This may be an external/managed table, or indicate missing write coverage.`,
|
|
256
|
+
file: u.filePath,
|
|
257
|
+
line: u.line,
|
|
258
|
+
column: 0,
|
|
259
|
+
symbol: usageIdentityLabel(u.functionName, u.functionStartLine, u.functionStartColumn),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
return out;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Sort key of the legacy `GROUP BY … ORDER BY file_path, function_start_line,
|
|
266
|
+
* function_start_column`: the ORDER BY columns, then the remaining GROUP BY
|
|
267
|
+
* column (`table_name`) as the tiebreak. NULLs first, matching SQLite's BINARY
|
|
268
|
+
* collation. The `table_name` tiebreak is the one place SQLite's group ordering
|
|
269
|
+
* is observable — a function writing to several tables at *different* lines
|
|
270
|
+
* anchors to the first table's MIN(line).
|
|
271
|
+
*/
|
|
272
|
+
function cmpWriterGroup(a, b) {
|
|
273
|
+
return (cmpNullableString(a.filePath, b.filePath) ||
|
|
274
|
+
cmpNullableNumber(a.functionStartLine, b.functionStartLine) ||
|
|
275
|
+
cmpNullableNumber(a.functionStartColumn, b.functionStartColumn) ||
|
|
276
|
+
cmpNullableString(a.tableName, b.tableName));
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Re-homes the legacy SQL: group write usages by (file, coordinate, table),
|
|
280
|
+
* taking MIN(line) per group, ordered by (file, coordinate, table).
|
|
281
|
+
*/
|
|
282
|
+
function groupWriteRows(usages) {
|
|
283
|
+
const grouped = new Map();
|
|
284
|
+
for (const u of usages) {
|
|
285
|
+
if (!TXN_WRITE_TYPES.has(u.usageType))
|
|
286
|
+
continue;
|
|
287
|
+
const gkey = JSON.stringify([u.filePath, u.functionStartLine ?? null, u.functionStartColumn ?? null, u.tableName]);
|
|
288
|
+
const existing = grouped.get(gkey);
|
|
289
|
+
if (existing) {
|
|
290
|
+
if (u.line < existing.line)
|
|
291
|
+
existing.line = u.line;
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
grouped.set(gkey, {
|
|
295
|
+
functionName: u.functionName ?? null,
|
|
296
|
+
functionStartLine: u.functionStartLine ?? null,
|
|
297
|
+
functionStartColumn: u.functionStartColumn ?? null,
|
|
298
|
+
filePath: u.filePath,
|
|
299
|
+
tableName: u.tableName,
|
|
300
|
+
line: u.line,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return [...grouped.values()].sort(cmpWriterGroup);
|
|
305
|
+
}
|
|
306
|
+
/** Group write rows by coordinate-identity key (the display name is the label). */
|
|
307
|
+
function groupWriterTables(rows) {
|
|
308
|
+
const funcWrites = new Map();
|
|
309
|
+
for (const row of rows) {
|
|
310
|
+
const label = usageIdentityLabel(row.functionName, row.functionStartLine, row.functionStartColumn);
|
|
311
|
+
const key = `${row.filePath}::${label}`;
|
|
312
|
+
const entry = funcWrites.get(key);
|
|
313
|
+
if (entry) {
|
|
314
|
+
entry.tables.add(row.tableName);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
funcWrites.set(key, { filePath: row.filePath, line: row.line, tables: new Set([row.tableName]) });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return funcWrites;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Depth-1 callee expansion over the `call-graph` fact: the writer's callees
|
|
324
|
+
* (graph_cache `call` edges) contribute their own direct write tables. Degrades
|
|
325
|
+
* to the direct write set when the graph is absent or the key is not a known
|
|
326
|
+
* function id — exactly the legacy `expandWrittenTables` graceful degradation.
|
|
327
|
+
*/
|
|
328
|
+
function expandWrittenTablesFact(key, initialTables, graph, usages, fnIdLookup) {
|
|
329
|
+
const allTables = new Set(initialTables);
|
|
330
|
+
if (!fnIdLookup)
|
|
331
|
+
return allTables;
|
|
332
|
+
const funcId = fnIdLookup.get(key);
|
|
333
|
+
if (funcId === undefined)
|
|
334
|
+
return allTables;
|
|
335
|
+
for (const edge of graph.callEdges) {
|
|
336
|
+
if (edge.fromId !== funcId)
|
|
337
|
+
continue;
|
|
338
|
+
for (const cf of graph.functions) {
|
|
339
|
+
if (cf.id !== edge.toId)
|
|
340
|
+
continue;
|
|
341
|
+
for (const u of usages) {
|
|
342
|
+
if (TXN_WRITE_TYPES.has(u.usageType) && u.functionName === cf.name && u.filePath === cf.filePath) {
|
|
343
|
+
allTables.add(u.tableName);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return allTables;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Whether any `batch-functions` span (same file) encloses the write line. A
|
|
352
|
+
* single `.batch(` commit is the transaction scope, so the multi-table shape
|
|
353
|
+
* carries no boundary risk — the legacy `enclosingFunctionBatches` re-parse
|
|
354
|
+
* re-homed as location containment over the fact.
|
|
355
|
+
*/
|
|
356
|
+
function enclosingFunctionBatchesFact(batches, filePath, writeLine) {
|
|
357
|
+
for (const b of batches) {
|
|
358
|
+
if (b.file === filePath && b.startLine <= writeLine && writeLine <= b.endLine)
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
/** The `filePath::name` → id lookup, built from the call-graph fact's functions
|
|
364
|
+
* only when call edges exist (matching `resolveCallGraphContext`). */
|
|
365
|
+
function resolveCallGraphContext(graph) {
|
|
366
|
+
if (graph.callEdges.length === 0 || graph.functions.length === 0)
|
|
367
|
+
return { fnIdLookup: null };
|
|
368
|
+
const fnIdLookup = new Map();
|
|
369
|
+
for (const f of graph.functions)
|
|
370
|
+
fnIdLookup.set(`${f.filePath}::${f.name}`, f.id);
|
|
371
|
+
return { fnIdLookup };
|
|
372
|
+
}
|
|
373
|
+
/** Flag functions whose depth-1-expanded write set reaches txnTableMax. */
|
|
374
|
+
function flagTransactionBoundaryWrites(funcWrites, usages, graph, fnIdLookup, batches, txnTableMax) {
|
|
375
|
+
const findings = [];
|
|
376
|
+
for (const [key, funcData] of funcWrites) {
|
|
377
|
+
const allTables = expandWrittenTablesFact(key, funcData.tables, graph, usages, fnIdLookup);
|
|
378
|
+
if (allTables.size < txnTableMax)
|
|
379
|
+
continue;
|
|
380
|
+
if (enclosingFunctionBatchesFact(batches, funcData.filePath, funcData.line))
|
|
381
|
+
continue;
|
|
382
|
+
const tableList = [...allTables].sort().join(', ');
|
|
383
|
+
findings.push({
|
|
384
|
+
ruleId: 'cross-domain/multi-table-write',
|
|
385
|
+
severity: 'high',
|
|
386
|
+
message: `Function writes to ${allTables.size} distinct tables (threshold: ${txnTableMax}): ${tableList}. This may indicate transaction-boundary risk — consider splitting writes across smaller transactional scopes.`,
|
|
387
|
+
file: funcData.filePath,
|
|
388
|
+
line: funcData.line,
|
|
389
|
+
column: 0,
|
|
390
|
+
symbol: key.split('::')[1],
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
return findings;
|
|
394
|
+
}
|
|
395
|
+
/** The fact-based detector: group writes, expand depth-1 callees, skip batches. */
|
|
396
|
+
function detectTransactionBoundaryRisk(usages, graph, batches, txnTableMax) {
|
|
397
|
+
const writerRows = groupWriteRows(usages);
|
|
398
|
+
if (writerRows.length === 0)
|
|
399
|
+
return [];
|
|
400
|
+
const funcWrites = groupWriterTables(writerRows);
|
|
401
|
+
const { fnIdLookup } = resolveCallGraphContext(graph);
|
|
402
|
+
return flagTransactionBoundaryWrites(funcWrites, usages, graph, fnIdLookup, batches, txnTableMax);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Re-home the legacy writer query: the schema_usage write rows INNER-JOINed to
|
|
406
|
+
* `functions` on (name, file_path) — a write whose function has no index row is
|
|
407
|
+
* dropped by the join — then DISTINCT on (name, file, line) and ORDER BY
|
|
408
|
+
* (file_path, function_name). The `function_id` resolves through the call-graph
|
|
409
|
+
* fact's `functions` catalog.
|
|
410
|
+
*/
|
|
411
|
+
function collectWriters(usages, graph) {
|
|
412
|
+
const fnIdByNamePath = new Map();
|
|
413
|
+
for (const f of graph.functions) {
|
|
414
|
+
const k = `${f.filePath}::${f.name}`;
|
|
415
|
+
if (!fnIdByNamePath.has(k))
|
|
416
|
+
fnIdByNamePath.set(k, f.id);
|
|
417
|
+
}
|
|
418
|
+
const seen = new Set();
|
|
419
|
+
const writers = [];
|
|
420
|
+
for (const u of usages) {
|
|
421
|
+
if (!WRITE_TYPES.has(u.usageType))
|
|
422
|
+
continue;
|
|
423
|
+
if (u.functionName == null)
|
|
424
|
+
continue;
|
|
425
|
+
const fnId = fnIdByNamePath.get(`${u.filePath}::${u.functionName}`);
|
|
426
|
+
if (fnId === undefined)
|
|
427
|
+
continue; // inner JOIN drops rows with no function row
|
|
428
|
+
const dkey = `${u.functionName}::${u.filePath}::${u.line}`;
|
|
429
|
+
if (seen.has(dkey))
|
|
430
|
+
continue;
|
|
431
|
+
seen.add(dkey);
|
|
432
|
+
writers.push({ function_name: u.functionName, file_path: u.filePath, line: u.line, function_id: fnId });
|
|
433
|
+
}
|
|
434
|
+
writers.sort((a, b) => cmpNullableString(a.file_path, b.file_path) || cmpNullableString(a.function_name, b.function_name));
|
|
435
|
+
return writers;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Build the validator function-ID set in priority order (re-homed from
|
|
439
|
+
* `buildValidatorIds`): user-configured validators, then provenanced validators
|
|
440
|
+
* (exported functions whose own `usedImports` array includes a validator
|
|
441
|
+
* package), then a name-based heuristic fallback only when both prior sources
|
|
442
|
+
* are silent. Item 4 2b — `usedImports` is now the `function-index` array carried
|
|
443
|
+
* verbatim through the `call-graph` fact (no index column, no JSON string), so
|
|
444
|
+
* the provenance test is a plain `array.includes(pkg)`.
|
|
445
|
+
*/
|
|
446
|
+
function buildValidatorIdsFact(graph, userValidators) {
|
|
447
|
+
const validatorIds = new Set();
|
|
448
|
+
const byName = new Map();
|
|
449
|
+
const byPathName = new Map();
|
|
450
|
+
for (const f of graph.functions) {
|
|
451
|
+
const names = byName.get(f.name);
|
|
452
|
+
if (names)
|
|
453
|
+
names.push(f.id);
|
|
454
|
+
else
|
|
455
|
+
byName.set(f.name, [f.id]);
|
|
456
|
+
const k = `${f.filePath}#${f.name}`;
|
|
457
|
+
const pathNames = byPathName.get(k);
|
|
458
|
+
if (pathNames)
|
|
459
|
+
pathNames.push(f.id);
|
|
460
|
+
else
|
|
461
|
+
byPathName.set(k, [f.id]);
|
|
462
|
+
}
|
|
463
|
+
// 1a. User-configured validators (format: "funcName" or "path#funcName").
|
|
464
|
+
for (const v of userValidators) {
|
|
465
|
+
const hashIdx = v.indexOf('#');
|
|
466
|
+
if (hashIdx >= 0) {
|
|
467
|
+
const vPath = v.substring(0, hashIdx);
|
|
468
|
+
const vName = v.substring(hashIdx + 1);
|
|
469
|
+
for (const id of byPathName.get(`${vPath}#${vName}`) ?? [])
|
|
470
|
+
validatorIds.add(id);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
for (const id of byName.get(v) ?? [])
|
|
474
|
+
validatorIds.add(id);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
// 1b. Provenanced validators.
|
|
478
|
+
if (validatorIds.size === 0) {
|
|
479
|
+
for (const f of graph.functions) {
|
|
480
|
+
if (f.usedImports.length === 0 || !f.isExported)
|
|
481
|
+
continue;
|
|
482
|
+
for (const pkg of VALIDATOR_PACKAGES) {
|
|
483
|
+
if (f.usedImports.includes(pkg)) {
|
|
484
|
+
validatorIds.add(f.id);
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
// 1c. Heuristic fallback (only when provenance found nothing AND no
|
|
491
|
+
// user-configured validators exist).
|
|
492
|
+
if (validatorIds.size === 0 && userValidators.length === 0) {
|
|
493
|
+
for (const f of graph.functions) {
|
|
494
|
+
if (!f.isExported)
|
|
495
|
+
continue;
|
|
496
|
+
if (f.name.startsWith('validate') || f.name.startsWith('assert'))
|
|
497
|
+
validatorIds.add(f.id);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return validatorIds;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* BFS through the call graph up to maxDepth, checking whether any path from
|
|
504
|
+
* `startFuncId` reaches a validator id (re-homed from `bfsReachesValidator`).
|
|
505
|
+
*/
|
|
506
|
+
function bfsReachesValidatorFact(graph, startFuncId, validatorIds, maxDepth) {
|
|
507
|
+
const visited = new Set();
|
|
508
|
+
let currentLevel = [startFuncId];
|
|
509
|
+
for (let d = 0; d < maxDepth; d++) {
|
|
510
|
+
const nextLevel = [];
|
|
511
|
+
for (const funcId of currentLevel) {
|
|
512
|
+
if (validatorIds.has(funcId))
|
|
513
|
+
return true;
|
|
514
|
+
if (visited.has(funcId))
|
|
515
|
+
continue;
|
|
516
|
+
visited.add(funcId);
|
|
517
|
+
for (const edge of graph.callEdges) {
|
|
518
|
+
if (edge.fromId !== funcId)
|
|
519
|
+
continue;
|
|
520
|
+
if (!visited.has(edge.toId))
|
|
521
|
+
nextLevel.push(edge.toId);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
currentLevel = nextLevel;
|
|
525
|
+
}
|
|
526
|
+
for (const funcId of currentLevel) {
|
|
527
|
+
if (validatorIds.has(funcId))
|
|
528
|
+
return true;
|
|
529
|
+
}
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
/** BFS from each writer to check validator reach, deduplicated by key. */
|
|
533
|
+
function computeWriterCoverageFact(writers, validatorIds, graph, depth) {
|
|
534
|
+
const writerCoverage = new Map();
|
|
535
|
+
for (const w of writers) {
|
|
536
|
+
const key = `${w.file_path}::${w.function_name}`;
|
|
537
|
+
if (writerCoverage.has(key))
|
|
538
|
+
continue; // deduplicate
|
|
539
|
+
const covered = bfsReachesValidatorFact(graph, w.function_id, validatorIds, depth);
|
|
540
|
+
writerCoverage.set(key, { covered, line: w.line, funcName: w.function_name });
|
|
541
|
+
}
|
|
542
|
+
return writerCoverage;
|
|
543
|
+
}
|
|
544
|
+
/** Group writers by directory, deduplicating multi-row schema_usage entries. */
|
|
545
|
+
function groupWritersByDirectoryFact(writers, writerCoverage) {
|
|
546
|
+
const dirWriters = new Map();
|
|
547
|
+
const dirSeen = new Set();
|
|
548
|
+
for (const w of writers) {
|
|
549
|
+
const dir = path.dirname(w.file_path);
|
|
550
|
+
const key = `${w.file_path}::${w.function_name}`;
|
|
551
|
+
const dirKey = `${dir}::${key}`;
|
|
552
|
+
if (dirSeen.has(dirKey))
|
|
553
|
+
continue;
|
|
554
|
+
dirSeen.add(dirKey);
|
|
555
|
+
const cov = writerCoverage.get(key);
|
|
556
|
+
if (!cov)
|
|
557
|
+
continue;
|
|
558
|
+
if (!dirWriters.has(dir))
|
|
559
|
+
dirWriters.set(dir, []);
|
|
560
|
+
dirWriters.get(dir).push({
|
|
561
|
+
key,
|
|
562
|
+
covered: cov.covered,
|
|
563
|
+
line: cov.line,
|
|
564
|
+
funcName: cov.funcName,
|
|
565
|
+
filePath: w.file_path,
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
return dirWriters;
|
|
569
|
+
}
|
|
570
|
+
/** Flag uncovered writers in validator-dense directories (re-homed verbatim). */
|
|
571
|
+
function flagUnvalidatedWritersFact(dirWriters, minCorpus, modeShare, depth) {
|
|
572
|
+
const violations = [];
|
|
573
|
+
for (const [dir, dirWriterList] of dirWriters) {
|
|
574
|
+
if (dirWriterList.length < minCorpus)
|
|
575
|
+
continue;
|
|
576
|
+
const coveredCount = dirWriterList.filter((w) => w.covered).length;
|
|
577
|
+
const ratio = coveredCount / dirWriterList.length;
|
|
578
|
+
if (ratio >= modeShare) {
|
|
579
|
+
for (const w of dirWriterList) {
|
|
580
|
+
if (w.covered)
|
|
581
|
+
continue;
|
|
582
|
+
violations.push({
|
|
583
|
+
ruleId: 'cross-domain/no-validator-reachable',
|
|
584
|
+
severity: 'severe',
|
|
585
|
+
message: `Function '${w.funcName}' does not reach a validator within BFS depth ≤ ${depth}. ` +
|
|
586
|
+
`${coveredCount}/${dirWriterList.length} peer writers in '${dir}' do. ` +
|
|
587
|
+
`Consider adding input validation.`,
|
|
588
|
+
file: w.filePath,
|
|
589
|
+
line: w.line,
|
|
590
|
+
column: 0,
|
|
591
|
+
symbol: w.funcName,
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return violations;
|
|
597
|
+
}
|
|
598
|
+
/** The fact-based validation-bypass detector (re-homes `detectValidationBypass`). */
|
|
599
|
+
function detectValidationBypass(usages, graph, userValidators, modeShare, minCorpus, depth) {
|
|
600
|
+
const validatorIds = buildValidatorIdsFact(graph, userValidators);
|
|
601
|
+
if (validatorIds.size === 0)
|
|
602
|
+
return [];
|
|
603
|
+
const writers = collectWriters(usages, graph);
|
|
604
|
+
if (writers.length === 0)
|
|
605
|
+
return [];
|
|
606
|
+
const writerCoverage = computeWriterCoverageFact(writers, validatorIds, graph, depth);
|
|
607
|
+
const dirWriters = groupWritersByDirectoryFact(writers, writerCoverage);
|
|
608
|
+
return flagUnvalidatedWritersFact(dirWriters, minCorpus, modeShare, depth);
|
|
609
|
+
}
|
|
610
|
+
/** SQLite `PERCENT_RANK` over a DESC-sorted score list. Ranks use RANK() semantics
|
|
611
|
+
* (ties share a rank — the rank is `1 + count of strictly-greater`), so the
|
|
612
|
+
* result is independent of tie order; `pct = (rank-1)/(n-1)` for n > 1, else 0. */
|
|
613
|
+
function percentRanks(scores) {
|
|
614
|
+
const n = scores.length;
|
|
615
|
+
const pcts = new Array(n);
|
|
616
|
+
for (let i = 0; i < n; i++) {
|
|
617
|
+
let rank = 1;
|
|
618
|
+
for (let j = 0; j < n; j++) {
|
|
619
|
+
if (scores[j] > scores[i])
|
|
620
|
+
rank++;
|
|
621
|
+
}
|
|
622
|
+
pcts[i] = n <= 1 ? 0 : (rank - 1) / (n - 1);
|
|
623
|
+
}
|
|
624
|
+
return pcts;
|
|
625
|
+
}
|
|
626
|
+
/** The `COALESCE(hs.score, 0.0)` risk-score map over the `call-graph` identity,
|
|
627
|
+
* for `hs.type = 'function'` (legacy LEFT JOIN key `file_path || ':' || name`). */
|
|
628
|
+
function functionRiskScores(graph, hotspot) {
|
|
629
|
+
const byTarget = new Map();
|
|
630
|
+
for (const h of hotspot) {
|
|
631
|
+
if (h.type === 'function')
|
|
632
|
+
byTarget.set(h.target, h.score);
|
|
633
|
+
}
|
|
634
|
+
return byTarget;
|
|
635
|
+
}
|
|
636
|
+
/** Rank the exported functions by hotspot score and take the top decile
|
|
637
|
+
* (re-homes `queryHighRiskFunctions`, unscoped — the scope filter is a §12
|
|
638
|
+
* corpus-scope concern, not a rule input). */
|
|
639
|
+
function queryHighRiskFunctionsFact(graph, hotspot, topRiskDecile) {
|
|
640
|
+
const byTarget = functionRiskScores(graph, hotspot);
|
|
641
|
+
const exported = graph.functions.filter((f) => f.isExported);
|
|
642
|
+
const riskScores = exported.map((f) => byTarget.get(`${f.filePath}:${f.name}`) ?? 0.0);
|
|
643
|
+
const pcts = percentRanks(riskScores);
|
|
644
|
+
const ranked = [];
|
|
645
|
+
for (let i = 0; i < exported.length; i++) {
|
|
646
|
+
if (pcts[i] <= topRiskDecile) {
|
|
647
|
+
ranked.push({
|
|
648
|
+
id: exported[i].id,
|
|
649
|
+
name: exported[i].name,
|
|
650
|
+
file_path: exported[i].filePath,
|
|
651
|
+
line_number: exported[i].lineNumber,
|
|
652
|
+
risk_score: riskScores[i],
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
ranked.sort((a, b) => b.risk_score - a.risk_score);
|
|
657
|
+
return ranked;
|
|
658
|
+
}
|
|
659
|
+
/** The measured path's `getUntestedTopDecile`: exported top-decile functions with
|
|
660
|
+
* no `covered=1` coverage row. `basis` is always `'static-reach'` — the legacy
|
|
661
|
+
* SQL's `COALESCE(bc.basis, 'static-reach')` is filtered by `bc.basis IS NULL`,
|
|
662
|
+
* so the measured path inherits the static-reach label. */
|
|
663
|
+
function getUntestedTopDecileFact(graph, hotspot, coverage, topRiskDecile) {
|
|
664
|
+
const byTarget = functionRiskScores(graph, hotspot);
|
|
665
|
+
const exported = graph.functions.filter((f) => f.isExported);
|
|
666
|
+
const riskScores = exported.map((f) => byTarget.get(`${f.filePath}:${f.name}`) ?? 0.0);
|
|
667
|
+
const pcts = percentRanks(riskScores);
|
|
668
|
+
const covered = new Set();
|
|
669
|
+
for (const e of coverage.entries) {
|
|
670
|
+
if (e.covered)
|
|
671
|
+
covered.add(`${e.functionName}${e.filePath}`);
|
|
672
|
+
}
|
|
673
|
+
const out = [];
|
|
674
|
+
for (let i = 0; i < exported.length; i++) {
|
|
675
|
+
if (pcts[i] > topRiskDecile)
|
|
676
|
+
continue;
|
|
677
|
+
if (covered.has(`${exported[i].name}${exported[i].filePath}`))
|
|
678
|
+
continue;
|
|
679
|
+
out.push({
|
|
680
|
+
functionName: exported[i].name,
|
|
681
|
+
filePath: exported[i].filePath,
|
|
682
|
+
lineNumber: exported[i].lineNumber ?? 1,
|
|
683
|
+
riskScore: riskScores[i],
|
|
684
|
+
basis: 'static-reach',
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
out.sort((a, b) => b.riskScore - a.riskScore);
|
|
688
|
+
return out;
|
|
689
|
+
}
|
|
690
|
+
/** SQLite `LIKE` matcher (default case-insensitive, `%`/`_` wildcards) — the test
|
|
691
|
+
* globs are translated to `%`-patterns and matched with `LIKE` in the legacy. */
|
|
692
|
+
function sqlLike(value, pattern) {
|
|
693
|
+
let re = '';
|
|
694
|
+
for (const ch of pattern) {
|
|
695
|
+
if (ch === '%')
|
|
696
|
+
re += '.*';
|
|
697
|
+
else if (ch === '_')
|
|
698
|
+
re += '.';
|
|
699
|
+
else
|
|
700
|
+
re += ch.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
701
|
+
}
|
|
702
|
+
return new RegExp(`^${re}$`, 'i').test(value);
|
|
703
|
+
}
|
|
704
|
+
/** Function IDs in test files (re-homes `collectTestFuncIds`). */
|
|
705
|
+
function collectTestFuncIdsFact(graph, testGlobs) {
|
|
706
|
+
const patterns = testGlobs.map((g) => g.replace(/\*\*/g, '%').replace(/\*/g, '%'));
|
|
707
|
+
if (patterns.length === 0)
|
|
708
|
+
return new Set();
|
|
709
|
+
const ids = new Set();
|
|
710
|
+
for (const f of graph.functions) {
|
|
711
|
+
for (const p of patterns) {
|
|
712
|
+
if (sqlLike(f.filePath, p)) {
|
|
713
|
+
ids.add(f.id);
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return ids;
|
|
719
|
+
}
|
|
720
|
+
/** BFS outward from test-file function IDs through the call graph (re-homes
|
|
721
|
+
* `collectReachableIds`). */
|
|
722
|
+
function collectReachableIdsFact(graph, startIds, maxDepth) {
|
|
723
|
+
const adjacency = new Map();
|
|
724
|
+
for (const e of graph.callEdges) {
|
|
725
|
+
const list = adjacency.get(e.fromId) ?? [];
|
|
726
|
+
list.push(e.toId);
|
|
727
|
+
adjacency.set(e.fromId, list);
|
|
728
|
+
}
|
|
729
|
+
const reachableIds = new Set();
|
|
730
|
+
for (const startId of startIds) {
|
|
731
|
+
const visited = new Set();
|
|
732
|
+
let currentLevel = [startId];
|
|
733
|
+
for (let d = 0; d < maxDepth; d++) {
|
|
734
|
+
const nextLevel = [];
|
|
735
|
+
for (const funcId of currentLevel) {
|
|
736
|
+
if (visited.has(funcId))
|
|
737
|
+
continue;
|
|
738
|
+
visited.add(funcId);
|
|
739
|
+
reachableIds.add(funcId);
|
|
740
|
+
for (const toId of adjacency.get(funcId) ?? []) {
|
|
741
|
+
if (!visited.has(toId))
|
|
742
|
+
nextLevel.push(toId);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
currentLevel = nextLevel;
|
|
746
|
+
}
|
|
747
|
+
for (const funcId of currentLevel) {
|
|
748
|
+
if (!reachableIds.has(funcId))
|
|
749
|
+
reachableIds.add(funcId);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return reachableIds;
|
|
753
|
+
}
|
|
754
|
+
/** Flag high-risk functions not in the reachable set (re-homes
|
|
755
|
+
* `flagUnreachedHighRisk`). */
|
|
756
|
+
function flagUnreachedHighRiskFact(highRiskFns, reachableIds) {
|
|
757
|
+
const findings = [];
|
|
758
|
+
for (const fn of highRiskFns) {
|
|
759
|
+
if (reachableIds.has(fn.id))
|
|
760
|
+
continue;
|
|
761
|
+
findings.push({
|
|
762
|
+
file: fn.file_path,
|
|
763
|
+
line: fn.line_number ?? 1,
|
|
764
|
+
column: 0,
|
|
765
|
+
severity: 'high',
|
|
766
|
+
message: `Exported function '${fn.name}' (risk ${fn.risk_score.toFixed(3)}) is not reachable from known test files. ` +
|
|
767
|
+
`Add test coverage or import measured coverage with 'code-audit coverage --import <path>'.`,
|
|
768
|
+
ruleId: 'cross-domain/uncovered-risk',
|
|
769
|
+
symbol: fn.name,
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
return findings;
|
|
773
|
+
}
|
|
774
|
+
/** The measured path (re-homes `detectMeasuredUncovered`): flag exported top-decile
|
|
775
|
+
* functions with no measured coverage, with stale-import detection. */
|
|
776
|
+
function detectMeasuredUncoveredFact(graph, hotspot, coverage, topRiskDecile) {
|
|
777
|
+
const untested = getUntestedTopDecileFact(graph, hotspot, coverage, topRiskDecile);
|
|
778
|
+
const sourceFormat = coverage.source ?? 'unknown';
|
|
779
|
+
const importedAt = coverage.importedAt;
|
|
780
|
+
let staleWarning = null;
|
|
781
|
+
if (importedAt) {
|
|
782
|
+
const lastSync = coverage.lastFullSync;
|
|
783
|
+
if (lastSync && importedAt < lastSync) {
|
|
784
|
+
staleWarning =
|
|
785
|
+
` — WARNING: this coverage data may be stale (imported ${importedAt}, ` +
|
|
786
|
+
`last index sync was ${lastSync}). ` +
|
|
787
|
+
`Re-import with 'code-audit coverage --import <path>' for accurate results.`;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
const findings = [];
|
|
791
|
+
for (const fn of untested) {
|
|
792
|
+
findings.push({
|
|
793
|
+
file: fn.filePath,
|
|
794
|
+
line: fn.lineNumber,
|
|
795
|
+
column: 0,
|
|
796
|
+
severity: 'high',
|
|
797
|
+
message: `Exported function '${fn.functionName}' (risk ${fn.riskScore.toFixed(3)}) has no measured test coverage. ` +
|
|
798
|
+
`Top imported functions should have test coverage. Import coverage data with 'code-audit coverage --import <path>'.` +
|
|
799
|
+
(staleWarning ?? ''),
|
|
800
|
+
ruleId: 'cross-domain/uncovered-risk',
|
|
801
|
+
symbol: fn.functionName,
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
return findings;
|
|
805
|
+
}
|
|
806
|
+
/** The static-reach fallback (re-homes `detectStaticReachUncovered`). */
|
|
807
|
+
function detectStaticReachUncoveredFact(graph, hotspot, coverage, topRiskDecile, testGlobs, staticReachDepth) {
|
|
808
|
+
const highRiskFns = queryHighRiskFunctionsFact(graph, hotspot, topRiskDecile);
|
|
809
|
+
if (highRiskFns.length === 0)
|
|
810
|
+
return [];
|
|
811
|
+
const reachableIds = collectReachableIdsFact(graph, collectTestFuncIdsFact(graph, testGlobs), staticReachDepth);
|
|
812
|
+
return flagUnreachedHighRiskFact(highRiskFns, reachableIds);
|
|
813
|
+
}
|
|
814
|
+
/** The fact-based uncovered-risk detector (re-homes `detectUncoveredRisk`). */
|
|
815
|
+
function detectUncoveredRiskFact(graph, hotspot, coverage, c) {
|
|
816
|
+
const topRiskDecile = c.topRiskDecile ?? 0.1;
|
|
817
|
+
if (coverage.measuredCount > 0) {
|
|
818
|
+
return detectMeasuredUncoveredFact(graph, hotspot, coverage, topRiskDecile);
|
|
819
|
+
}
|
|
820
|
+
const testGlobs = c.testGlobs ?? ['**/*.test.*', '**/*.spec.*', '**/__tests__/**'];
|
|
821
|
+
const staticReachDepth = c.staticReachDepth ?? 2;
|
|
822
|
+
return detectStaticReachUncoveredFact(graph, hotspot, coverage, topRiskDecile, testGlobs, staticReachDepth);
|
|
823
|
+
}
|
|
824
|
+
// ── Rule definitions ────────────────────────────────────────────────────────
|
|
825
|
+
const writtenNeverRead = {
|
|
826
|
+
id: 'cross-domain/written-never-read',
|
|
827
|
+
analyzer: 'cross-domain',
|
|
828
|
+
needs: { formats: ['typescript', 'tsx', 'javascript'], facts: ['schema-usage'] },
|
|
829
|
+
severity: 'high',
|
|
830
|
+
message: META['cross-domain/written-never-read'].message,
|
|
831
|
+
docs: META['cross-domain/written-never-read'].docs,
|
|
832
|
+
thresholds: META['cross-domain/written-never-read'].thresholds,
|
|
833
|
+
samples: META['cross-domain/written-never-read'].samples,
|
|
834
|
+
analyze(ctx) {
|
|
835
|
+
return detectWrittenNeverRead(ctx.facts['schema-usage']);
|
|
836
|
+
},
|
|
837
|
+
};
|
|
838
|
+
const readNeverWritten = {
|
|
839
|
+
id: 'cross-domain/read-never-written',
|
|
840
|
+
analyzer: 'cross-domain',
|
|
841
|
+
needs: { formats: ['typescript', 'tsx', 'javascript'], facts: ['schema-usage'] },
|
|
842
|
+
severity: 'severe',
|
|
843
|
+
message: META['cross-domain/read-never-written'].message,
|
|
844
|
+
docs: META['cross-domain/read-never-written'].docs,
|
|
845
|
+
thresholds: META['cross-domain/read-never-written'].thresholds,
|
|
846
|
+
samples: META['cross-domain/read-never-written'].samples,
|
|
847
|
+
analyze(ctx) {
|
|
848
|
+
return detectReadNeverWritten(ctx.facts['schema-usage']);
|
|
849
|
+
},
|
|
850
|
+
};
|
|
851
|
+
const multiTableWrite = {
|
|
852
|
+
id: 'cross-domain/multi-table-write',
|
|
853
|
+
analyzer: 'cross-domain',
|
|
854
|
+
needs: { formats: ['typescript', 'tsx', 'javascript'], facts: ['schema-usage', 'call-graph', 'batch-functions'] },
|
|
855
|
+
severity: 'high',
|
|
856
|
+
message: META['cross-domain/multi-table-write'].message,
|
|
857
|
+
docs: META['cross-domain/multi-table-write'].docs,
|
|
858
|
+
thresholds: META['cross-domain/multi-table-write'].thresholds,
|
|
859
|
+
samples: META['cross-domain/multi-table-write'].samples,
|
|
860
|
+
analyze(ctx) {
|
|
861
|
+
const sc = ctx.thresholds['schemaLifecycle'];
|
|
862
|
+
const txnTableMax = sc?.txnTableMax ?? 4;
|
|
863
|
+
return detectTransactionBoundaryRisk(ctx.facts['schema-usage'], ctx.facts['call-graph'], ctx.facts['batch-functions'], txnTableMax);
|
|
864
|
+
},
|
|
865
|
+
};
|
|
866
|
+
const noValidatorReachable = {
|
|
867
|
+
id: 'cross-domain/no-validator-reachable',
|
|
868
|
+
analyzer: 'cross-domain',
|
|
869
|
+
needs: { formats: ['typescript', 'tsx', 'javascript'], facts: ['schema-usage', 'call-graph'] },
|
|
870
|
+
severity: 'severe',
|
|
871
|
+
message: META['cross-domain/no-validator-reachable'].message,
|
|
872
|
+
docs: META['cross-domain/no-validator-reachable'].docs,
|
|
873
|
+
thresholds: META['cross-domain/no-validator-reachable'].thresholds,
|
|
874
|
+
samples: META['cross-domain/no-validator-reachable'].samples,
|
|
875
|
+
analyze(ctx) {
|
|
876
|
+
const vb = ctx.thresholds['validatorBypass'];
|
|
877
|
+
if (!vb)
|
|
878
|
+
return [];
|
|
879
|
+
const userValidators = vb.validators ?? [];
|
|
880
|
+
const modeShare = vb.modeShare ?? 0.8;
|
|
881
|
+
const minCorpus = vb.minCorpus ?? 20;
|
|
882
|
+
const depth = vb.depth ?? 3;
|
|
883
|
+
return detectValidationBypass(ctx.facts['schema-usage'], ctx.facts['call-graph'], userValidators, modeShare, minCorpus, depth);
|
|
884
|
+
},
|
|
885
|
+
};
|
|
886
|
+
const uncoveredRisk = {
|
|
887
|
+
id: 'cross-domain/uncovered-risk',
|
|
888
|
+
analyzer: 'cross-domain',
|
|
889
|
+
needs: { formats: ['typescript', 'tsx', 'javascript'], facts: ['call-graph', 'hotspot', 'coverage'] },
|
|
890
|
+
severity: 'high',
|
|
891
|
+
message: META['cross-domain/uncovered-risk'].message,
|
|
892
|
+
docs: META['cross-domain/uncovered-risk'].docs,
|
|
893
|
+
thresholds: META['cross-domain/uncovered-risk'].thresholds,
|
|
894
|
+
samples: META['cross-domain/uncovered-risk'].samples,
|
|
895
|
+
analyze(ctx) {
|
|
896
|
+
const c = ctx.thresholds['coverage'];
|
|
897
|
+
if (!c)
|
|
898
|
+
return [];
|
|
899
|
+
return detectUncoveredRiskFact(ctx.facts['call-graph'], ctx.facts['hotspot'], ctx.facts['coverage'], c);
|
|
900
|
+
},
|
|
901
|
+
};
|
|
902
|
+
/** The two TypeScript cross-domain rules this slice migrates, in registry order. */
|
|
903
|
+
export const crossDomainRules = [
|
|
904
|
+
writtenNeverRead,
|
|
905
|
+
readNeverWritten,
|
|
906
|
+
];
|
|
907
|
+
/** `multi-table-write` — the index-backed sibling (call-graph + batch-functions
|
|
908
|
+
* facts) registered alongside `crossDomainRules` but typed separately. */
|
|
909
|
+
export const multiTableWriteRule = multiTableWrite;
|
|
910
|
+
/** `no-validator-reachable` — the validation-bypass sibling (call-graph
|
|
911
|
+
* validator provenance + BFS reach) registered alongside the other
|
|
912
|
+
* cross-domain rules but typed separately. */
|
|
913
|
+
export const noValidatorReachableRule = noValidatorReachable;
|
|
914
|
+
/** `uncovered-risk` — the coverage-by-importance sibling (call-graph + hotspot +
|
|
915
|
+
* coverage facts) registered alongside the other cross-domain rules but typed
|
|
916
|
+
* separately. */
|
|
917
|
+
export const uncoveredRiskRule = uncoveredRisk;
|
|
918
|
+
//# sourceMappingURL=crossDomain.js.map
|