code-auditor-mcp 4.1.0 → 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 +374 -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 +1 -12
- package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js +24 -101
- 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 +1537 -1051
- 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 +997 -812
- 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 +130 -277
- package/dist/codeIndexDB.d.ts.map +1 -1
- package/dist/codeIndexDB.js +364 -2748
- 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 +16 -1
- package/dist/config/configLoader.d.ts.map +1 -1
- package/dist/config/configLoader.js +26 -23
- 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 +21 -20
- 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/constants.d.ts.map +1 -1
- package/dist/constants.js +10 -5
- package/dist/constants.js.map +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 +22 -7
- package/dist/daemon/resolve.d.ts.map +1 -1
- package/dist/daemon/resolve.js +29 -8
- 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 +27 -8
- package/dist/dataPaths.d.ts.map +1 -1
- package/dist/dataPaths.js +28 -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 +832 -851
- 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 +1145 -988
- 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 +106 -92
- 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 +14 -8
- 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,1098 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec 68 §3.2 vertical slice — the phase runner: Parse → Process → Analyze.
|
|
3
|
+
*
|
|
4
|
+
* This is the in-process proof of the phase model for ONE fact kind
|
|
5
|
+
* (`file-symbols`) and its SOLID rules. It is deliberately not the full §6
|
|
6
|
+
* distributed runner (bounded work queue, parent/worker, index-backed facts);
|
|
7
|
+
* that lands in §6. What this proves, once, is the contract the whole model
|
|
8
|
+
* turns on:
|
|
9
|
+
*
|
|
10
|
+
* - Parse produces a `ParsedFile` whose `ast` lives only here (it is freed
|
|
11
|
+
* after the processor runs and never crosses the Process→Analyze boundary).
|
|
12
|
+
* - Process runs the `file-symbols` producer per file and concatenates the
|
|
13
|
+
* fragments into the corpus-wide `file-symbols` fact.
|
|
14
|
+
* - Analyze hands that fact — and nothing else — to each SOLID rule, whose
|
|
15
|
+
* `analyze` is pure threshold comparison over plain data.
|
|
16
|
+
*
|
|
17
|
+
* §6 replaces the parse loop with fan-out and the `thresholds` literal with
|
|
18
|
+
* resolved config; the three-phase ordering and the "rules read facts, never
|
|
19
|
+
* ASTs" property are already fixed here.
|
|
20
|
+
*/
|
|
21
|
+
import { LanguageRegistry } from '../languages/LanguageRegistry.js';
|
|
22
|
+
import { STYLE_MARKUP_EXTENSIONS } from '../utils/fileDiscovery.js';
|
|
23
|
+
import { fileProducerFor, CORPUS_PRODUCERS } from './producers.js';
|
|
24
|
+
import { solidRules } from './rules/solid.js';
|
|
25
|
+
import { dataAccessRules, loopQueryRules } from './rules/dataAccess.js';
|
|
26
|
+
import { schemaRules, dynamicSqlRules } from './rules/schema.js';
|
|
27
|
+
import { dependencyGraphRules } from './rules/dependencyGraph.js';
|
|
28
|
+
import { schemaValidatorRules } from './rules/schemaValidator.js';
|
|
29
|
+
import { documentationRules } from './rules/documentation.js';
|
|
30
|
+
import { stylesRules } from './rules/styles.js';
|
|
31
|
+
import { crossDomainRules } from './rules/crossDomain.js';
|
|
32
|
+
import { conventionsRules, conventionsExportShapeRules, conventionsImportFormRules } from './rules/conventions.js';
|
|
33
|
+
import { dryRules } from './rules/dry.js';
|
|
34
|
+
import { securityRules } from './rules/security.js';
|
|
35
|
+
import { secretsRules } from './rules/secrets.js';
|
|
36
|
+
import { securityDefectRules } from './rules/securityDefects.js';
|
|
37
|
+
import { querySiteRules } from './rules/querySites.js';
|
|
38
|
+
import { reactRules } from './rules/react.js';
|
|
39
|
+
import { fileDocumentationRules } from './rules/fileDocumentation.js';
|
|
40
|
+
import { schemaJsonRules } from './rules/schemaJson.js';
|
|
41
|
+
/**
|
|
42
|
+
* The format a path declares, by extension (matches the liveness fixtures).
|
|
43
|
+
*
|
|
44
|
+
* @param path - The file path whose extension determines the format.
|
|
45
|
+
* @returns The `Format` the path declares.
|
|
46
|
+
*/
|
|
47
|
+
export function formatFor(path) {
|
|
48
|
+
if (path.endsWith('.tsx') || path.endsWith('.jsx'))
|
|
49
|
+
return 'tsx';
|
|
50
|
+
if (path.endsWith('.js'))
|
|
51
|
+
return 'javascript';
|
|
52
|
+
if (path.endsWith('.go'))
|
|
53
|
+
return 'go';
|
|
54
|
+
if (path.endsWith('.css'))
|
|
55
|
+
return 'css';
|
|
56
|
+
if (path.endsWith('.scss'))
|
|
57
|
+
return 'scss';
|
|
58
|
+
if (path.endsWith('.json'))
|
|
59
|
+
return 'json';
|
|
60
|
+
if (path.endsWith('.sql'))
|
|
61
|
+
return 'sql';
|
|
62
|
+
const ext = path.slice(path.lastIndexOf('.'));
|
|
63
|
+
if (STYLE_MARKUP_EXTENSIONS.includes(ext))
|
|
64
|
+
return 'markup';
|
|
65
|
+
return 'typescript';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parse one file into a `ParsedFile`. Uses `adapter.parse()` (not the sync
|
|
69
|
+
* bridge) so the adapter's source map is populated — `extractFunctions` /
|
|
70
|
+
* `extractClasses` read the real source through it. Returns `null` when no
|
|
71
|
+
* adapter resolves the path or the parse fails; the caller records the drop
|
|
72
|
+
* (§3.3 makes a per-file failure `incomplete`, which is §8's concern).
|
|
73
|
+
*
|
|
74
|
+
* @param input - The file to parse (path + already-read content).
|
|
75
|
+
* @param projectRoot - The optional project root threaded into the parsed file.
|
|
76
|
+
* @param sqlDialect - The corpus's named SQL dialect (null means cannot-fire for
|
|
77
|
+
* the SQL-reading producers: `ddl-declarations` and `data-access-calls`).
|
|
78
|
+
* @returns The parsed file, or `null` when no adapter resolves or the parse fails.
|
|
79
|
+
*/
|
|
80
|
+
export async function parseOne(input, projectRoot, sqlDialect) {
|
|
81
|
+
// `.sql` and markup (`.astro`/`.vue`/`.svelte`/`.html`) are the text-only
|
|
82
|
+
// formats: no grammar, no adapter, no AST. Their sole producers
|
|
83
|
+
// (ddl-declarations, style-declarations) read `.source`/`.file`, so return a
|
|
84
|
+
// ParsedFile with neither `ast` nor `adapter`.
|
|
85
|
+
const format = formatFor(input.path);
|
|
86
|
+
const sqlDialectSpread = sqlDialect === undefined ? {} : { sqlDialect };
|
|
87
|
+
if (format === 'sql' || format === 'markup') {
|
|
88
|
+
return { file: input.path, format, source: input.content, ...(projectRoot ? { projectRoot } : {}), ...sqlDialectSpread };
|
|
89
|
+
}
|
|
90
|
+
const adapter = LanguageRegistry.getInstance().getAdapterForFile(input.path);
|
|
91
|
+
if (!adapter)
|
|
92
|
+
return null;
|
|
93
|
+
try {
|
|
94
|
+
const ast = await adapter.parse(input.path, input.content);
|
|
95
|
+
return {
|
|
96
|
+
file: input.path,
|
|
97
|
+
format: formatFor(input.path),
|
|
98
|
+
source: input.content,
|
|
99
|
+
ast,
|
|
100
|
+
adapter,
|
|
101
|
+
...(projectRoot ? { projectRoot } : {}),
|
|
102
|
+
...sqlDialectSpread,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Parse → Process the shared body behind every per-file fact build: parse each
|
|
111
|
+
* file (freeing its AST after the producer runs), run the `(kind, format)`
|
|
112
|
+
* producer, and concatenate the fragments into the corpus fact. The single seam
|
|
113
|
+
* behind `buildFileSymbols`, `buildDataAccessCalls`, `buildLoopQueries`,
|
|
114
|
+
* `buildDynamicSql`, `buildSchemaUsage`, `buildDdlDeclarations`, and
|
|
115
|
+
* `buildSchemaObjects` — each was the identical loop over a different fact kind
|
|
116
|
+
* and return type, so the loop lives here and the callers name `kind` (the
|
|
117
|
+
* return type is `FactShapes[K]`, resolved by `kind`). `sqlDialect` stays
|
|
118
|
+
* `undefined` for kinds whose producers do not read SQL; `parseOne` treats an
|
|
119
|
+
* explicit `undefined` as "no dialect" (identical to omitting the argument).
|
|
120
|
+
*/
|
|
121
|
+
async function buildFileFact(files, kind, sqlDialect) {
|
|
122
|
+
const out = [];
|
|
123
|
+
for (const input of files) {
|
|
124
|
+
const parsed = await parseOne(input, undefined, sqlDialect);
|
|
125
|
+
if (!parsed)
|
|
126
|
+
continue;
|
|
127
|
+
try {
|
|
128
|
+
const producer = fileProducerFor(kind, parsed.format);
|
|
129
|
+
if (producer)
|
|
130
|
+
out.push(...producer.process(parsed));
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
parsed.ast?.dispose?.();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Parse → Process for the `file-symbols` fact. Returns the assembled corpus
|
|
140
|
+
* fact (every symbol from every file, files' ASTs already freed).
|
|
141
|
+
*
|
|
142
|
+
* @param files - The input files to parse and process.
|
|
143
|
+
* @returns The assembled `file-symbols` corpus fact.
|
|
144
|
+
*/
|
|
145
|
+
export async function buildFileSymbols(files) {
|
|
146
|
+
return buildFileFact(files, 'file-symbols');
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Run one rule array over an assembled fact context and collect its findings.
|
|
150
|
+
* Every `analyzeX` slice reduces to this single loop — the only per-slice
|
|
151
|
+
* difference is which rules, facts, and formats are handed in — so the loop
|
|
152
|
+
* lives here once instead of being duplicated across the ~19 analyze arms.
|
|
153
|
+
*
|
|
154
|
+
* @param rules - The rule array to run.
|
|
155
|
+
* @param facts - The assembled fact context (declared `needs`, union-shaped).
|
|
156
|
+
* @param formats - The format union the rules may read.
|
|
157
|
+
* @param thresholds - The resolved thresholds (defaults to `{}`).
|
|
158
|
+
* @returns The rules' findings over the facts.
|
|
159
|
+
*/
|
|
160
|
+
async function analyzeWithRules(rules, facts, formats, thresholds) {
|
|
161
|
+
const findings = [];
|
|
162
|
+
for (const rule of rules) {
|
|
163
|
+
findings.push(...(await rule.analyze({ facts, formats, thresholds })));
|
|
164
|
+
}
|
|
165
|
+
return findings;
|
|
166
|
+
}
|
|
167
|
+
/** Analyze the assembled `file-symbols` fact with the SOLID rules. The union
|
|
168
|
+
* context carries the §9 Go facts as `[]` and widens `formats` to include `go`
|
|
169
|
+
* so the Go arms (`interface-size`'s Go branch, `struct-size`, `function-size`,
|
|
170
|
+
* `switch-size`, `liskov-substitution`) reduce an empty fact in this TS-only
|
|
171
|
+
* slice rather than a missing one — they produce nothing because there are no
|
|
172
|
+
* Go files here. `resolution` supplies the class-declaration chain
|
|
173
|
+
* `solid/open-closed` walks (`isErrorSubclass`) for its `instanceof` guard.
|
|
174
|
+
*
|
|
175
|
+
* @param symbols - The assembled `file-symbols` fact to analyze.
|
|
176
|
+
* @param resolution - The one resolution fact (`solid/open-closed` reads its
|
|
177
|
+
* `classes` for the extends-Error check).
|
|
178
|
+
* @param thresholds - The SOLID rule thresholds (defaults to `{}`).
|
|
179
|
+
* @returns The SOLID rules' findings over the fact.
|
|
180
|
+
*/
|
|
181
|
+
export async function analyzeFileSymbols(symbols, resolution, thresholds = {}) {
|
|
182
|
+
return analyzeWithRules(solidRules, {
|
|
183
|
+
'file-symbols': symbols,
|
|
184
|
+
'resolution': resolution,
|
|
185
|
+
'type-declarations': [],
|
|
186
|
+
'go-functions': [],
|
|
187
|
+
'go-switches': [],
|
|
188
|
+
}, ['typescript', 'tsx', 'javascript', 'go'], thresholds);
|
|
189
|
+
}
|
|
190
|
+
/** The whole vertical slice: parse → file-symbols + resolution → SOLID rules →
|
|
191
|
+
* findings.
|
|
192
|
+
*
|
|
193
|
+
* @param files the input files to parse and analyze
|
|
194
|
+
* @param thresholds the SOLID rule thresholds (defaults to `{}`)
|
|
195
|
+
* @returns the SOLID rules' findings over the whole file set
|
|
196
|
+
*/
|
|
197
|
+
export async function runFileSymbolsSlice(files, thresholds) {
|
|
198
|
+
const [symbols, resolution] = await Promise.all([
|
|
199
|
+
buildFileSymbols(files),
|
|
200
|
+
buildResolution(files),
|
|
201
|
+
]);
|
|
202
|
+
return analyzeFileSymbols(symbols, resolution, thresholds);
|
|
203
|
+
}
|
|
204
|
+
// ── documentation slice (same fact, different rules) ─────────────────────────
|
|
205
|
+
/**
|
|
206
|
+
* Analyze the assembled `file-symbols` fact with the documentation rules.
|
|
207
|
+
*
|
|
208
|
+
* @param symbols - The assembled `file-symbols` fact to analyze.
|
|
209
|
+
* @param thresholds - The documentation rule thresholds (defaults to `{}`).
|
|
210
|
+
* @returns The documentation rules' findings over the fact.
|
|
211
|
+
*/
|
|
212
|
+
export async function analyzeDocumentation(symbols, thresholds = {}) {
|
|
213
|
+
return analyzeWithRules(documentationRules, { 'file-symbols': symbols }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
214
|
+
}
|
|
215
|
+
/** The documentation slice: parse → file-symbols → documentation rules → findings. */
|
|
216
|
+
export async function runDocumentationSlice(files, thresholds) {
|
|
217
|
+
const symbols = await buildFileSymbols(files);
|
|
218
|
+
return analyzeDocumentation(symbols, thresholds);
|
|
219
|
+
}
|
|
220
|
+
// ── data-access-calls slice (the "repeat" for a second fact kind) ──────────
|
|
221
|
+
/**
|
|
222
|
+
* Build one of the three receiver-consumer corpus facts (`data-access-calls`,
|
|
223
|
+
* `loop-queries`, `schema-usage`). The three `buildX` arms shared the identical
|
|
224
|
+
* six-parse → receiver-provenance → consumer-process shape, differing only in
|
|
225
|
+
* the candidate fact kind and the producer key, so the loop lives here once and
|
|
226
|
+
* the callers name the two kinds (the return type is `FactShapes[PK]`, resolved
|
|
227
|
+
* by `producerKey`).
|
|
228
|
+
*/
|
|
229
|
+
async function buildReceiverConsumer(files, candidateKind, producerKey, sqlDialect) {
|
|
230
|
+
const [candidates, within, imports, exports, goBindings, activity] = await Promise.all([
|
|
231
|
+
buildFileFact(files, candidateKind),
|
|
232
|
+
buildFileFact(files, 'within-file-provenance'),
|
|
233
|
+
buildFileFact(files, 'import-specifiers'),
|
|
234
|
+
buildFileFact(files, 'export-symbols'),
|
|
235
|
+
buildFileFact(files, 'go-package-bindings'),
|
|
236
|
+
buildFileFact(files, 'receiver-activity'),
|
|
237
|
+
]);
|
|
238
|
+
const provenance = CORPUS_PRODUCERS['receiver-provenance'].process({
|
|
239
|
+
'within-file-provenance': within,
|
|
240
|
+
'import-specifiers': imports,
|
|
241
|
+
'export-symbols': exports,
|
|
242
|
+
'go-package-bindings': goBindings,
|
|
243
|
+
});
|
|
244
|
+
const producer = CORPUS_PRODUCERS[producerKey];
|
|
245
|
+
return producer.process({
|
|
246
|
+
[candidateKind]: candidates,
|
|
247
|
+
'within-file-provenance': within,
|
|
248
|
+
'receiver-provenance': provenance,
|
|
249
|
+
'receiver-activity': activity,
|
|
250
|
+
}, { sqlDialect });
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Parse → Process for the `data-access-calls` fact. Returns the assembled
|
|
254
|
+
* corpus fact (every resolved DB call from every file, ASTs already freed).
|
|
255
|
+
*
|
|
256
|
+
* @param files - The input files to parse and process.
|
|
257
|
+
* @param sqlDialect - The corpus's named dialect for SQL parsing, or null/undefined.
|
|
258
|
+
* @returns The assembled `data-access-calls` corpus fact.
|
|
259
|
+
*/
|
|
260
|
+
export async function buildDataAccessCalls(files, sqlDialect) {
|
|
261
|
+
return buildReceiverConsumer(files, 'data-access-calls-candidates', 'data-access-calls', sqlDialect ?? null);
|
|
262
|
+
}
|
|
263
|
+
/** Analyze the assembled `data-access-calls` + `resolution` facts with the
|
|
264
|
+
* data-access rules. `missing-org-filter` reads the resolution for Tier 3 (DDL)
|
|
265
|
+
* tenancy; the other three rules ignore it (their `needs` declare only
|
|
266
|
+
* `data-access-calls`, and the union context carries both).
|
|
267
|
+
*
|
|
268
|
+
* @param calls - The assembled `data-access-calls` fact to analyze.
|
|
269
|
+
* @param resolution - The one resolution fact (`missing-org-filter` reads it).
|
|
270
|
+
* @param thresholds - The data-access rule thresholds (defaults to `{}`).
|
|
271
|
+
* @returns The data-access rules' findings over the facts.
|
|
272
|
+
*/
|
|
273
|
+
export async function analyzeDataAccessCalls(calls, resolution, thresholds = {}) {
|
|
274
|
+
return analyzeWithRules(dataAccessRules, { 'data-access-calls': calls, 'resolution': resolution }, ['typescript', 'tsx', 'javascript', 'go'], thresholds);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The data-access slice: parse → data-access-calls + resolution → rules → findings.
|
|
278
|
+
*
|
|
279
|
+
* @param files - The input files to parse and process.
|
|
280
|
+
* @param thresholds - The data-access rule thresholds (defaults to `{}`).
|
|
281
|
+
* @param sqlDialect - The corpus's named dialect (null means cannot-fire).
|
|
282
|
+
* @returns The data-access rules' findings over the assembled facts.
|
|
283
|
+
*/
|
|
284
|
+
export async function runDataAccessSlice(files, thresholds, sqlDialect) {
|
|
285
|
+
const [calls, resolution] = await Promise.all([
|
|
286
|
+
buildDataAccessCalls(files, sqlDialect),
|
|
287
|
+
buildResolution(files, sqlDialect),
|
|
288
|
+
]);
|
|
289
|
+
return analyzeDataAccessCalls(calls, resolution, thresholds);
|
|
290
|
+
}
|
|
291
|
+
// ── loop-queries slice (loop-queries → loop-query) ──────────────────────────
|
|
292
|
+
/**
|
|
293
|
+
* Parse → Process for the `loop-queries` fact. Returns the assembled corpus
|
|
294
|
+
* fact (every loop whose body issues a DB call, ASTs already freed). The fact
|
|
295
|
+
* carries no cross-file structure — the `loop-query` rule reduces each element
|
|
296
|
+
* in isolation, exactly as the legacy `checkLoopQueries` ran once per AST.
|
|
297
|
+
*
|
|
298
|
+
* @param files - The input files to parse and process.
|
|
299
|
+
* @param sqlDialect - The corpus's named dialect (null means cannot-fire).
|
|
300
|
+
* @returns The assembled `loop-queries` corpus fact.
|
|
301
|
+
*/
|
|
302
|
+
export async function buildLoopQueries(files, sqlDialect) {
|
|
303
|
+
return buildReceiverConsumer(files, 'loop-query-candidates', 'loop-queries', sqlDialect ?? null);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Analyze the assembled `loop-queries` fact with the loop-query rule.
|
|
307
|
+
*
|
|
308
|
+
* @param facts - The assembled `loop-queries` fact to analyze.
|
|
309
|
+
* @param thresholds - The loop-query rule thresholds (defaults to `{}`).
|
|
310
|
+
* @returns The loop-query rule's findings over the fact.
|
|
311
|
+
*/
|
|
312
|
+
export async function analyzeLoopQueries(facts, thresholds = {}) {
|
|
313
|
+
return analyzeWithRules(loopQueryRules, { 'loop-queries': facts }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The loop-queries slice: parse → loop-queries → loop-query → findings.
|
|
317
|
+
*
|
|
318
|
+
* @param files - The input files to parse and process.
|
|
319
|
+
* @param thresholds - The loop-query rule thresholds (defaults to `{}`).
|
|
320
|
+
* @param sqlDialect - The corpus's named dialect (null means cannot-fire).
|
|
321
|
+
* @returns The loop-query rule's findings over the assembled facts.
|
|
322
|
+
*/
|
|
323
|
+
export async function runLoopQueriesSlice(files, thresholds, sqlDialect) {
|
|
324
|
+
const facts = await buildLoopQueries(files, sqlDialect);
|
|
325
|
+
return analyzeLoopQueries(facts, thresholds);
|
|
326
|
+
}
|
|
327
|
+
// ── dynamic-sql slice (dynamic-sql → dynamic-sql-construction) ──────────────
|
|
328
|
+
/**
|
|
329
|
+
* Parse → Process for the `dynamic-sql` fact. Returns the assembled corpus
|
|
330
|
+
* fact (every dangerous query/execute call site, ASTs already freed). The fact
|
|
331
|
+
* carries no cross-file structure — the `dynamic-sql-construction` rule reduces
|
|
332
|
+
* each element in isolation, exactly as the legacy `checkSQLInjection` ran once
|
|
333
|
+
* per AST.
|
|
334
|
+
*
|
|
335
|
+
* @param files - The input files to parse and process.
|
|
336
|
+
* @returns The assembled `dynamic-sql` corpus fact.
|
|
337
|
+
*/
|
|
338
|
+
export async function buildDynamicSql(files) {
|
|
339
|
+
return buildFileFact(files, 'dynamic-sql');
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Analyze the assembled `dynamic-sql` fact with the dynamic-sql-construction rule.
|
|
343
|
+
*
|
|
344
|
+
* @param facts - The assembled `dynamic-sql` fact to analyze.
|
|
345
|
+
* @param thresholds - The dynamic-sql rule thresholds (defaults to `{}`).
|
|
346
|
+
* @returns The dynamic-sql-construction rule's findings over the fact.
|
|
347
|
+
*/
|
|
348
|
+
export async function analyzeDynamicSql(facts, thresholds = {}) {
|
|
349
|
+
return analyzeWithRules(dynamicSqlRules, { 'dynamic-sql': facts }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
350
|
+
}
|
|
351
|
+
/** The dynamic-sql slice: parse → dynamic-sql → dynamic-sql-construction → findings. */
|
|
352
|
+
export async function runDynamicSqlSlice(files, thresholds) {
|
|
353
|
+
const facts = await buildDynamicSql(files);
|
|
354
|
+
return analyzeDynamicSql(facts, thresholds);
|
|
355
|
+
}
|
|
356
|
+
// ── schema slice (the "repeat" for a corpus-consuming fact kind) ────────────
|
|
357
|
+
/**
|
|
358
|
+
* Parse → Process for the `schema-usage` fact. Returns the assembled corpus
|
|
359
|
+
* fact (every table reference from every file, ASTs already freed).
|
|
360
|
+
*
|
|
361
|
+
* @param files - The input files to parse and process.
|
|
362
|
+
* @param sqlDialect - The corpus's named dialect for SQL parsing, or null/undefined.
|
|
363
|
+
* @returns The assembled `schema-usage` corpus fact.
|
|
364
|
+
*/
|
|
365
|
+
export async function buildSchemaUsage(files, sqlDialect) {
|
|
366
|
+
return buildReceiverConsumer(files, 'schema-usage-candidates', 'schema-usage', sqlDialect ?? null);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Parse → Process for the `ddl-declarations` fact (DDL in code and `.sql`
|
|
370
|
+
* migration files). Returns the raw declarations both corpus processors
|
|
371
|
+
* (`resolution`, `migration-history`) reduce — so the two derive from one
|
|
372
|
+
* parse pass rather than re-parsing the same files twice.
|
|
373
|
+
*
|
|
374
|
+
* @param files - The input files to parse and process.
|
|
375
|
+
* @param sqlDialect - The corpus's named dialect for SQL parsing, or null/undefined.
|
|
376
|
+
* @returns The raw `ddl-declarations` the corpus processors reduce.
|
|
377
|
+
*/
|
|
378
|
+
export async function buildDdlDeclarations(files, sqlDialect) {
|
|
379
|
+
return buildFileFact(files, 'ddl-declarations', sqlDialect);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Parse → Process for the `schema-objects` fact (ORM `const <id> = pgTable(
|
|
383
|
+
* 'name', …)` bindings). Returns the identifier → SQL-name bindings the
|
|
384
|
+
* `resolution` corpus processor folds into its alias map.
|
|
385
|
+
*
|
|
386
|
+
* @param files - The input files to parse and process.
|
|
387
|
+
* @returns The raw `schema-objects` the corpus processor reduces.
|
|
388
|
+
*/
|
|
389
|
+
export async function buildSchemaObjects(files) {
|
|
390
|
+
return buildFileFact(files, 'schema-objects');
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Reduce the `ddl-declarations` + `schema-objects` + `file-symbols` facts
|
|
394
|
+
* through the `resolution` corpus processor into the one resolution fact. The
|
|
395
|
+
* JSON-schema half of the old catalog is config-driven (§10) and not reachable
|
|
396
|
+
* from this simple runner, so it is dropped — this is the DDL-only slice of the
|
|
397
|
+
* resolution, the config-free half the corpus processor consumes.
|
|
398
|
+
*
|
|
399
|
+
* @param files The input files to parse and process.
|
|
400
|
+
* @param sqlDialect The corpus's named dialect (null means cannot-fire).
|
|
401
|
+
* @returns The reduced resolution fact.
|
|
402
|
+
*/
|
|
403
|
+
export async function buildResolution(files, sqlDialect) {
|
|
404
|
+
const [declarations, objects, symbols] = await Promise.all([
|
|
405
|
+
buildDdlDeclarations(files, sqlDialect),
|
|
406
|
+
buildSchemaObjects(files),
|
|
407
|
+
buildFileSymbols(files),
|
|
408
|
+
]);
|
|
409
|
+
return CORPUS_PRODUCERS['resolution'].process({ 'ddl-declarations': declarations, 'schema-objects': objects, 'file-symbols': symbols });
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Reduce the `ddl-declarations` fact through the `migration-history` corpus
|
|
413
|
+
* processor into the cross-file drop provenance (`stale-table-reference` reads
|
|
414
|
+
* it to partition dropped tables from never-existed tables).
|
|
415
|
+
*
|
|
416
|
+
* @param files The input files to parse and process.
|
|
417
|
+
* @param sqlDialect The corpus's named dialect (null means cannot-fire).
|
|
418
|
+
*/
|
|
419
|
+
export async function buildMigrationHistory(files, sqlDialect) {
|
|
420
|
+
const declarations = await buildDdlDeclarations(files, sqlDialect);
|
|
421
|
+
return CORPUS_PRODUCERS['migration-history'].process({ 'ddl-declarations': declarations });
|
|
422
|
+
}
|
|
423
|
+
/** Analyze the `schema-usage` + `resolution` + `migration-history` facts with
|
|
424
|
+
* the schema rules. `unknown-table` reads the resolution and migration-history
|
|
425
|
+
* to hand dropped tables to `stale-table-reference`; `table-naming-convention`
|
|
426
|
+
* reads `schema-usage` alone (its `needs` declares only that fact, and the
|
|
427
|
+
* union context carries all three).
|
|
428
|
+
*
|
|
429
|
+
* @param usages - The assembled `schema-usage` fact to analyze.
|
|
430
|
+
* @param resolution - The one resolution fact (`unknown-table` reads it).
|
|
431
|
+
* @param migrationHistory - The cross-file drop provenance.
|
|
432
|
+
* @param thresholds - The schema rule thresholds (defaults to `{}`).
|
|
433
|
+
* @returns The schema rules' findings over the facts.
|
|
434
|
+
*/
|
|
435
|
+
export async function analyzeSchemaRules(usages, resolution, migrationHistory, thresholds = {}) {
|
|
436
|
+
return analyzeWithRules(schemaRules, { 'schema-usage': usages, 'resolution': resolution, 'migration-history': migrationHistory }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
437
|
+
}
|
|
438
|
+
/** The schema slice: parse → schema-usage + resolution + migration-history →
|
|
439
|
+
* schema rules → findings.
|
|
440
|
+
*
|
|
441
|
+
* @param files - The input files to parse and process.
|
|
442
|
+
* @param thresholds - The schema rule thresholds (defaults to `{}`).
|
|
443
|
+
* @param sqlDialect - The corpus's named dialect (null means cannot-fire).
|
|
444
|
+
* @returns The schema rules' findings over the assembled facts.
|
|
445
|
+
*/
|
|
446
|
+
export async function runSchemaSlice(files, thresholds, sqlDialect) {
|
|
447
|
+
const [usages, declarations, objects, symbols] = await Promise.all([
|
|
448
|
+
buildSchemaUsage(files, sqlDialect),
|
|
449
|
+
buildDdlDeclarations(files, sqlDialect),
|
|
450
|
+
buildSchemaObjects(files),
|
|
451
|
+
buildFileSymbols(files),
|
|
452
|
+
]);
|
|
453
|
+
const resolution = CORPUS_PRODUCERS['resolution'].process({ 'ddl-declarations': declarations, 'schema-objects': objects, 'file-symbols': symbols });
|
|
454
|
+
const migrationHistory = CORPUS_PRODUCERS['migration-history'].process({ 'ddl-declarations': declarations });
|
|
455
|
+
return analyzeSchemaRules(usages, resolution, migrationHistory, thresholds);
|
|
456
|
+
}
|
|
457
|
+
// ── cross-domain lifecycle slice (same `schema-usage` fact, different rules) ─
|
|
458
|
+
/**
|
|
459
|
+
* Analyze the assembled `schema-usage` fact with the cross-domain lifecycle
|
|
460
|
+
* rules (`written-never-read`, `read-never-written`). Like the schema rules,
|
|
461
|
+
* these reduce the whole corpus at once; the two detectors are pure set
|
|
462
|
+
* differences over the flat usage list.
|
|
463
|
+
*
|
|
464
|
+
* @param usages - The assembled `schema-usage` fact to analyze.
|
|
465
|
+
* @param thresholds - The cross-domain rule thresholds (defaults to `{}`).
|
|
466
|
+
* @returns The cross-domain lifecycle rules' findings over the fact.
|
|
467
|
+
*/
|
|
468
|
+
export async function analyzeCrossDomain(usages, thresholds = {}) {
|
|
469
|
+
return analyzeWithRules(crossDomainRules, { 'schema-usage': usages }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
470
|
+
}
|
|
471
|
+
/** The cross-domain slice: parse → schema-usage → lifecycle rules → findings.
|
|
472
|
+
* @param files - The input files to parse and process.
|
|
473
|
+
* @param thresholds - The cross-domain rule thresholds.
|
|
474
|
+
* @param sqlDialect - The corpus's named dialect for SQL parsing, or null/undefined.
|
|
475
|
+
* @returns The cross-domain lifecycle rules' findings over the fact. */
|
|
476
|
+
export async function runCrossDomainSlice(files, thresholds, sqlDialect) {
|
|
477
|
+
const usages = await buildSchemaUsage(files, sqlDialect);
|
|
478
|
+
return analyzeCrossDomain(usages, thresholds);
|
|
479
|
+
}
|
|
480
|
+
// ── cross-language-entities slice (dependency-graph rules) ──────────────────
|
|
481
|
+
/**
|
|
482
|
+
* Parse → Process for the `cross-language-entities` fact. Returns the assembled
|
|
483
|
+
* corpus fact (every entity from every file, ASTs already freed). The
|
|
484
|
+
* dependency-graph rules read the *whole* corpus at once, so unlike the SOLID /
|
|
485
|
+
* data-access slices there is no per-file analysis arm — the fact is the input.
|
|
486
|
+
*
|
|
487
|
+
* @param files - The input files to parse and process.
|
|
488
|
+
* @returns The assembled `cross-language-entities` corpus fact.
|
|
489
|
+
*/
|
|
490
|
+
export async function buildCrossLanguageEntities(files) {
|
|
491
|
+
const entities = [];
|
|
492
|
+
for (const input of files) {
|
|
493
|
+
const parsed = await parseOne(input);
|
|
494
|
+
if (!parsed)
|
|
495
|
+
continue;
|
|
496
|
+
try {
|
|
497
|
+
const producer = fileProducerFor('cross-language-entities', parsed.format);
|
|
498
|
+
if (producer)
|
|
499
|
+
entities.push(...producer.process(parsed));
|
|
500
|
+
}
|
|
501
|
+
finally {
|
|
502
|
+
parsed.ast?.dispose?.();
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return entities;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Analyze the assembled `cross-language-entities` fact with the dependency-graph rules.
|
|
509
|
+
*
|
|
510
|
+
* @param entities - The assembled `cross-language-entities` fact to analyze.
|
|
511
|
+
* @param thresholds - The dependency-graph rule thresholds (defaults to `{}`).
|
|
512
|
+
* @returns The dependency-graph rules' findings over the fact.
|
|
513
|
+
*/
|
|
514
|
+
export async function analyzeDependencyGraph(entities, thresholds = {}) {
|
|
515
|
+
return analyzeWithRules(dependencyGraphRules, { 'cross-language-entities': entities }, ['typescript', 'tsx', 'javascript', 'go'], thresholds);
|
|
516
|
+
}
|
|
517
|
+
/** The dependency-graph slice: parse → cross-language-entities → graph rules → findings. */
|
|
518
|
+
export async function runDependencyGraphSlice(files, thresholds) {
|
|
519
|
+
const entities = await buildCrossLanguageEntities(files);
|
|
520
|
+
return analyzeDependencyGraph(entities, thresholds);
|
|
521
|
+
}
|
|
522
|
+
// ── schema-validator slice (same fact, different rules) ─────────────────────
|
|
523
|
+
/**
|
|
524
|
+
* Analyze the assembled `cross-language-entities` fact with the schema-validator
|
|
525
|
+
* rules. The dependency-graph and schema-validator slices share one producer;
|
|
526
|
+
* they differ only in which rules reduce the fact. Like the dependency-graph
|
|
527
|
+
* rules, the schema-validator rules read the *whole* corpus at once.
|
|
528
|
+
*
|
|
529
|
+
* @param entities - The assembled `cross-language-entities` fact to analyze.
|
|
530
|
+
* @param thresholds - The schema-validator rule thresholds (defaults to `{}`).
|
|
531
|
+
* @returns The schema-validator rules' findings over the fact.
|
|
532
|
+
*/
|
|
533
|
+
export async function analyzeSchemaValidator(entities, thresholds = {}) {
|
|
534
|
+
return analyzeWithRules(schemaValidatorRules, { 'cross-language-entities': entities }, ['typescript', 'tsx', 'javascript', 'go'], thresholds);
|
|
535
|
+
}
|
|
536
|
+
/** The schema-validator slice: parse → cross-language-entities → validator rules → findings. */
|
|
537
|
+
export async function runSchemaValidatorSlice(files, thresholds) {
|
|
538
|
+
const entities = await buildCrossLanguageEntities(files);
|
|
539
|
+
return analyzeSchemaValidator(entities, thresholds);
|
|
540
|
+
}
|
|
541
|
+
// ── style-declarations slice (the eight style rules, undefined-class deferred) ──
|
|
542
|
+
/**
|
|
543
|
+
* Parse → Process for the `style-declarations` fact. Returns the assembled
|
|
544
|
+
* corpus fact (every declaration/token/class-usage from every CSS/SCSS/TS/JS
|
|
545
|
+
* file, ASTs already freed). `projectRoot` threads through to the TS/JS producer
|
|
546
|
+
* so Tailwind utility expansion resolves the project's theme tokens.
|
|
547
|
+
*
|
|
548
|
+
* @param files - The input files to parse and process.
|
|
549
|
+
* @param projectRoot - The optional project root for Tailwind token resolution.
|
|
550
|
+
* @returns The assembled `style-declarations` corpus fact.
|
|
551
|
+
*/
|
|
552
|
+
export async function buildStyleDeclarations(files, projectRoot) {
|
|
553
|
+
const facts = [];
|
|
554
|
+
for (const input of files) {
|
|
555
|
+
const parsed = await parseOne(input, projectRoot);
|
|
556
|
+
if (!parsed)
|
|
557
|
+
continue;
|
|
558
|
+
try {
|
|
559
|
+
const producer = fileProducerFor('style-declarations', parsed.format);
|
|
560
|
+
if (producer)
|
|
561
|
+
facts.push(...producer.process(parsed));
|
|
562
|
+
}
|
|
563
|
+
finally {
|
|
564
|
+
parsed.ast?.dispose?.();
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return facts;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Analyze the assembled `style-declarations` fact with the styles rules.
|
|
571
|
+
*
|
|
572
|
+
* @param facts - The assembled `style-declarations` fact to analyze.
|
|
573
|
+
* @param thresholds - The styles rule thresholds (defaults to `{}`).
|
|
574
|
+
* @returns The styles rules' findings over the fact.
|
|
575
|
+
*/
|
|
576
|
+
export async function analyzeStyles(facts, thresholds = {}) {
|
|
577
|
+
// Spec 69 R4 — `styles/value-drift` reads the derived `color-values` fact, so
|
|
578
|
+
// the slice runner reduces it from `style-declarations` through the corpus
|
|
579
|
+
// producer (the same reduction `buildFacts` runs on the full phase path).
|
|
580
|
+
const colorValues = CORPUS_PRODUCERS['color-values'].process({ 'style-declarations': facts });
|
|
581
|
+
return analyzeWithRules(stylesRules, { 'style-declarations': facts, 'color-values': colorValues }, ['css', 'scss', 'typescript', 'tsx', 'javascript'], thresholds);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* The styles slice: parse → style-declarations → styles rules → findings.
|
|
585
|
+
*
|
|
586
|
+
* @param files - The input files to parse and process.
|
|
587
|
+
* @param projectRoot - The optional project root for Tailwind token resolution.
|
|
588
|
+
* @param thresholds - The styles rule thresholds (defaults to `{}`).
|
|
589
|
+
* @returns The styles rules' findings over the assembled fact.
|
|
590
|
+
*/
|
|
591
|
+
export async function runStylesSlice(files, projectRoot, thresholds) {
|
|
592
|
+
const facts = await buildStyleDeclarations(files, projectRoot);
|
|
593
|
+
return analyzeStyles(facts, thresholds);
|
|
594
|
+
}
|
|
595
|
+
// ── conventions slice (function-index + export-form + import-form → mined-conventions → 5 rules) ──
|
|
596
|
+
/**
|
|
597
|
+
* Parse → Process for the `function-index` fact. Returns the assembled corpus
|
|
598
|
+
* fact (every function/method/component from every file, ASTs already freed).
|
|
599
|
+
*
|
|
600
|
+
* @param files - The input files to parse and process.
|
|
601
|
+
* @returns The assembled `function-index` corpus fact.
|
|
602
|
+
*/
|
|
603
|
+
export async function buildFunctionIndex(files) {
|
|
604
|
+
const facts = [];
|
|
605
|
+
for (const input of files) {
|
|
606
|
+
const parsed = await parseOne(input);
|
|
607
|
+
if (!parsed)
|
|
608
|
+
continue;
|
|
609
|
+
try {
|
|
610
|
+
const producer = fileProducerFor('function-index', parsed.format);
|
|
611
|
+
if (producer)
|
|
612
|
+
facts.push(...producer.process(parsed));
|
|
613
|
+
}
|
|
614
|
+
finally {
|
|
615
|
+
parsed.ast?.dispose?.();
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return facts;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Parse → Process for the `export-form` fact. Returns the assembled corpus fact
|
|
622
|
+
* (every exported `(name, isDefault)` pair from every file, ASTs already freed).
|
|
623
|
+
* The `conventions/export-shape` rule reads it to resolve a function's export
|
|
624
|
+
* form — the same AST-extracted exports the legacy reducer read as `exportsMap`.
|
|
625
|
+
*
|
|
626
|
+
* @param files - The input files to parse and process.
|
|
627
|
+
* @returns The assembled `export-form` corpus fact.
|
|
628
|
+
*/
|
|
629
|
+
export async function buildExportForms(files) {
|
|
630
|
+
const facts = [];
|
|
631
|
+
for (const input of files) {
|
|
632
|
+
const parsed = await parseOne(input);
|
|
633
|
+
if (!parsed)
|
|
634
|
+
continue;
|
|
635
|
+
try {
|
|
636
|
+
const producer = fileProducerFor('export-form', parsed.format);
|
|
637
|
+
if (producer)
|
|
638
|
+
facts.push(...producer.process(parsed));
|
|
639
|
+
}
|
|
640
|
+
finally {
|
|
641
|
+
parsed.ast?.dispose?.();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return facts;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Parse → Process for the `import-form` fact. Returns the assembled corpus fact
|
|
648
|
+
* (every import's classified form from every file). The producer reads
|
|
649
|
+
* `.source` (not the AST) via `parseFileImports`, so the AST is freed without
|
|
650
|
+
* being consumed by this producer — but the parse still validates the file.
|
|
651
|
+
*
|
|
652
|
+
* @param files - The input files to parse and process.
|
|
653
|
+
* @returns The assembled `import-form` corpus fact.
|
|
654
|
+
*/
|
|
655
|
+
export async function buildImportForms(files) {
|
|
656
|
+
const facts = [];
|
|
657
|
+
for (const input of files) {
|
|
658
|
+
const parsed = await parseOne(input);
|
|
659
|
+
if (!parsed)
|
|
660
|
+
continue;
|
|
661
|
+
try {
|
|
662
|
+
const producer = fileProducerFor('import-form', parsed.format);
|
|
663
|
+
if (producer)
|
|
664
|
+
facts.push(...producer.process(parsed));
|
|
665
|
+
}
|
|
666
|
+
finally {
|
|
667
|
+
parsed.ast?.dispose?.();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return facts;
|
|
671
|
+
}
|
|
672
|
+
/** Analyze the assembled `function-index` + `mined-conventions` + `export-form` +
|
|
673
|
+
* `import-form` facts with the five function-index-servable conventions rules
|
|
674
|
+
* (three `function-index`+`mined-conventions` rules plus the `export-form`-
|
|
675
|
+
* reading export-shape rule and the `import-form`-reading import-form rule).
|
|
676
|
+
*
|
|
677
|
+
* @param facts - The assembled `function-index` fact to analyze.
|
|
678
|
+
* @param conventions - The assembled `mined-conventions` fact to analyze.
|
|
679
|
+
* @param exportForms - The assembled `export-form` fact (`export-shape` reads it).
|
|
680
|
+
* @param importForms - The assembled `import-form` fact (`import-form` reads it).
|
|
681
|
+
* @param thresholds - The conventions rule thresholds (defaults to `{}`).
|
|
682
|
+
* @returns The conventions rules' findings over the facts.
|
|
683
|
+
*/
|
|
684
|
+
export async function analyzeConventions(facts, conventions, exportForms, importForms, thresholds = {}) {
|
|
685
|
+
const ctx = {
|
|
686
|
+
'function-index': facts,
|
|
687
|
+
'mined-conventions': conventions,
|
|
688
|
+
'export-form': exportForms,
|
|
689
|
+
'import-form': importForms,
|
|
690
|
+
};
|
|
691
|
+
const formats = ['typescript', 'tsx', 'javascript'];
|
|
692
|
+
return [
|
|
693
|
+
...(await analyzeWithRules(conventionsRules, ctx, formats, thresholds)),
|
|
694
|
+
...(await analyzeWithRules(conventionsExportShapeRules, ctx, formats, thresholds)),
|
|
695
|
+
...(await analyzeWithRules(conventionsImportFormRules, ctx, formats, thresholds)),
|
|
696
|
+
];
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* The conventions slice: parse → function-index + export-form + import-form → mined-conventions → rules → findings.
|
|
700
|
+
*
|
|
701
|
+
* @param files - The input files to parse and process.
|
|
702
|
+
* @param thresholds - The conventions rule thresholds (defaults to `{}`).
|
|
703
|
+
* @returns The conventions rules' findings over the assembled facts.
|
|
704
|
+
*/
|
|
705
|
+
export async function runConventionsSlice(files, thresholds) {
|
|
706
|
+
const [facts, exportForms, importForms] = await Promise.all([
|
|
707
|
+
buildFunctionIndex(files),
|
|
708
|
+
buildExportForms(files),
|
|
709
|
+
buildImportForms(files),
|
|
710
|
+
]);
|
|
711
|
+
const conventions = CORPUS_PRODUCERS['mined-conventions'].process({
|
|
712
|
+
'function-index': facts,
|
|
713
|
+
'export-form': exportForms,
|
|
714
|
+
'import-form': importForms,
|
|
715
|
+
});
|
|
716
|
+
return analyzeConventions(facts, conventions, exportForms, importForms, thresholds);
|
|
717
|
+
}
|
|
718
|
+
// ── dry slice (imports + string-literals + code-block → the five DRY rules) ──
|
|
719
|
+
/**
|
|
720
|
+
* Parse → Process for the `imports` fact. Returns the assembled corpus fact
|
|
721
|
+
* (every import statement from every file, ASTs already freed).
|
|
722
|
+
*
|
|
723
|
+
* @param files - The input files to parse and process.
|
|
724
|
+
* @returns The assembled `imports` corpus fact.
|
|
725
|
+
*/
|
|
726
|
+
export async function buildImports(files) {
|
|
727
|
+
const facts = [];
|
|
728
|
+
for (const input of files) {
|
|
729
|
+
const parsed = await parseOne(input);
|
|
730
|
+
if (!parsed)
|
|
731
|
+
continue;
|
|
732
|
+
try {
|
|
733
|
+
const producer = fileProducerFor('imports', parsed.format);
|
|
734
|
+
if (producer)
|
|
735
|
+
facts.push(...producer.process(parsed));
|
|
736
|
+
}
|
|
737
|
+
finally {
|
|
738
|
+
parsed.ast?.dispose?.();
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return facts;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Parse → Process for the `string-literals` fact. Returns the assembled corpus
|
|
745
|
+
* fact (every string/template-string literal from every file, ASTs already freed).
|
|
746
|
+
*
|
|
747
|
+
* @param files - The input files to parse and process.
|
|
748
|
+
* @returns The assembled `string-literals` corpus fact.
|
|
749
|
+
*/
|
|
750
|
+
export async function buildStringLiterals(files) {
|
|
751
|
+
const facts = [];
|
|
752
|
+
for (const input of files) {
|
|
753
|
+
const parsed = await parseOne(input);
|
|
754
|
+
if (!parsed)
|
|
755
|
+
continue;
|
|
756
|
+
try {
|
|
757
|
+
const producer = fileProducerFor('string-literals', parsed.format);
|
|
758
|
+
if (producer)
|
|
759
|
+
facts.push(...producer.process(parsed));
|
|
760
|
+
}
|
|
761
|
+
finally {
|
|
762
|
+
parsed.ast?.dispose?.();
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
return facts;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Parse → Process for the `code-block` fact. Returns the assembled corpus fact
|
|
769
|
+
* (every code block + shape fragment from every file, ASTs already freed). The
|
|
770
|
+
* producer projects the raw blocks/fragments with no threshold and no dedup;
|
|
771
|
+
* the three block rules re-apply `minLineThreshold`/`similarityThreshold`/
|
|
772
|
+
* `minShapeNames`/`excludePatterns`/check-gates over this plain data.
|
|
773
|
+
*
|
|
774
|
+
* @param files - The input files to parse and process.
|
|
775
|
+
* @returns The assembled `code-block` corpus fact.
|
|
776
|
+
*/
|
|
777
|
+
export async function buildCodeBlocks(files) {
|
|
778
|
+
const facts = [];
|
|
779
|
+
for (const input of files) {
|
|
780
|
+
const parsed = await parseOne(input);
|
|
781
|
+
if (!parsed)
|
|
782
|
+
continue;
|
|
783
|
+
try {
|
|
784
|
+
const producer = fileProducerFor('code-block', parsed.format);
|
|
785
|
+
if (producer)
|
|
786
|
+
facts.push(...producer.process(parsed));
|
|
787
|
+
}
|
|
788
|
+
finally {
|
|
789
|
+
parsed.ast?.dispose?.();
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return facts;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Analyze the assembled `imports` + `string-literals` + `code-block` facts with
|
|
796
|
+
* the six DRY rules. Each rule reads only the fact its `needs` declares; the
|
|
797
|
+
* union context carries all four. The three block rules partition `code-block`
|
|
798
|
+
* by file before their filter → dedupe → compare, because the legacy
|
|
799
|
+
* `analyzeAST` ran once per file (a block in file A is never compared against a
|
|
800
|
+
* block in file B). `diverging-clone` reads `clone-pair-history`, empty here
|
|
801
|
+
* (the slice test has no index), so it emits nothing.
|
|
802
|
+
*
|
|
803
|
+
* @param imports - The assembled `imports` fact to analyze.
|
|
804
|
+
* @param stringLiterals - The assembled `string-literals` fact to analyze.
|
|
805
|
+
* @param codeBlocks - The assembled `code-block` fact to analyze.
|
|
806
|
+
* @param thresholds - The DRY rule thresholds (defaults to `{}`).
|
|
807
|
+
* @returns The DRY rules' findings over the facts.
|
|
808
|
+
*/
|
|
809
|
+
export async function analyzeDry(imports, stringLiterals, codeBlocks, thresholds = {}) {
|
|
810
|
+
return analyzeWithRules(dryRules, { 'imports': imports, 'string-literals': stringLiterals, 'code-block': codeBlocks, 'clone-pair-history': [] }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* The dry slice: parse → imports + string-literals + code-block → DRY rules → findings.
|
|
814
|
+
*
|
|
815
|
+
* @param files - The input files to parse and process.
|
|
816
|
+
* @param thresholds - The DRY rule thresholds (defaults to `{}`).
|
|
817
|
+
* @returns The DRY rules' findings over the assembled facts.
|
|
818
|
+
*/
|
|
819
|
+
export async function runDrySlice(files, thresholds) {
|
|
820
|
+
const [imports, stringLiterals, codeBlocks] = await Promise.all([
|
|
821
|
+
buildImports(files),
|
|
822
|
+
buildStringLiterals(files),
|
|
823
|
+
buildCodeBlocks(files),
|
|
824
|
+
]);
|
|
825
|
+
return analyzeDry(imports, stringLiterals, codeBlocks, thresholds);
|
|
826
|
+
}
|
|
827
|
+
// ── security slice (string-literals → hardcoded-connection) ─────────────────
|
|
828
|
+
/**
|
|
829
|
+
* Analyze the assembled `string-literals` fact with the hardcoded-connection
|
|
830
|
+
* rule. `hardcoded-secret` reads a different fact (`secret-candidates`) and is
|
|
831
|
+
* served by `analyzeSecrets` below, not this slice.
|
|
832
|
+
*
|
|
833
|
+
* @param stringLiterals - The assembled `string-literals` fact to analyze.
|
|
834
|
+
* @param thresholds - The security rule thresholds (defaults to `{}`).
|
|
835
|
+
* @returns The hardcoded-connection rule's findings over the fact.
|
|
836
|
+
*/
|
|
837
|
+
export async function analyzeSecurity(stringLiterals, thresholds = {}) {
|
|
838
|
+
return analyzeWithRules(securityRules, { 'string-literals': stringLiterals }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
839
|
+
}
|
|
840
|
+
/** The security slice: parse → string-literals → hardcoded-credential rules → findings. */
|
|
841
|
+
export async function runSecuritySlice(files, thresholds) {
|
|
842
|
+
const stringLiterals = await buildStringLiterals(files);
|
|
843
|
+
return analyzeSecurity(stringLiterals, thresholds);
|
|
844
|
+
}
|
|
845
|
+
// ── secret-candidates slice (secret-candidates → hardcoded-secret) ──────────
|
|
846
|
+
/**
|
|
847
|
+
* Parse → Process for the `secret-candidates` fact. Returns the assembled corpus
|
|
848
|
+
* fact (every credential-position string from every file, ASTs already freed).
|
|
849
|
+
*
|
|
850
|
+
* @param files - The input files to parse and process.
|
|
851
|
+
* @returns The assembled `secret-candidates` corpus fact.
|
|
852
|
+
*/
|
|
853
|
+
export async function buildSecretCandidates(files) {
|
|
854
|
+
const facts = [];
|
|
855
|
+
for (const input of files) {
|
|
856
|
+
const parsed = await parseOne(input);
|
|
857
|
+
if (!parsed)
|
|
858
|
+
continue;
|
|
859
|
+
try {
|
|
860
|
+
const producer = fileProducerFor('secret-candidates', parsed.format);
|
|
861
|
+
if (producer)
|
|
862
|
+
facts.push(...producer.process(parsed));
|
|
863
|
+
}
|
|
864
|
+
finally {
|
|
865
|
+
parsed.ast?.dispose?.();
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
return facts;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Analyze the assembled `secret-candidates` fact with the hardcoded-secret rule.
|
|
872
|
+
*
|
|
873
|
+
* @param candidates - The assembled `secret-candidates` fact to analyze.
|
|
874
|
+
* @param thresholds - The hardcoded-secret rule thresholds (defaults to `{}`).
|
|
875
|
+
* @returns The hardcoded-secret rule's findings over the fact.
|
|
876
|
+
*/
|
|
877
|
+
export async function analyzeSecrets(candidates, thresholds = {}) {
|
|
878
|
+
return analyzeWithRules(secretsRules, { 'secret-candidates': candidates }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
879
|
+
}
|
|
880
|
+
/** The secret-candidates slice: parse → secret-candidates → hardcoded-secret → findings. */
|
|
881
|
+
export async function runSecretsSlice(files, thresholds) {
|
|
882
|
+
const candidates = await buildSecretCandidates(files);
|
|
883
|
+
return analyzeSecrets(candidates, thresholds);
|
|
884
|
+
}
|
|
885
|
+
// ── security-candidates slice (security-candidates → 3 defect rules) ────────
|
|
886
|
+
/**
|
|
887
|
+
* Parse → Process for the `security-candidates` fact. Returns the assembled
|
|
888
|
+
* corpus fact (every command-injection/dynamic-require/unescaped-html candidate
|
|
889
|
+
* from every file, ASTs already freed).
|
|
890
|
+
*
|
|
891
|
+
* @param files - The input files to parse and process.
|
|
892
|
+
* @returns The assembled `security-candidates` corpus fact.
|
|
893
|
+
*/
|
|
894
|
+
export async function buildSecurityCandidates(files) {
|
|
895
|
+
const facts = [];
|
|
896
|
+
for (const input of files) {
|
|
897
|
+
const parsed = await parseOne(input);
|
|
898
|
+
if (!parsed)
|
|
899
|
+
continue;
|
|
900
|
+
try {
|
|
901
|
+
const producer = fileProducerFor('security-candidates', parsed.format);
|
|
902
|
+
if (producer)
|
|
903
|
+
facts.push(...producer.process(parsed));
|
|
904
|
+
}
|
|
905
|
+
finally {
|
|
906
|
+
parsed.ast?.dispose?.();
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
return facts;
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Analyze the assembled `security-candidates` fact with the three defect rules.
|
|
913
|
+
*
|
|
914
|
+
* @param candidates - The assembled `security-candidates` fact to analyze.
|
|
915
|
+
* @param thresholds - The security-defect rule thresholds (defaults to `{}`).
|
|
916
|
+
* @returns The three defect rules' findings over the fact.
|
|
917
|
+
*/
|
|
918
|
+
export async function analyzeSecurityDefects(candidates, thresholds = {}) {
|
|
919
|
+
return analyzeWithRules(securityDefectRules, { 'security-candidates': candidates }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
920
|
+
}
|
|
921
|
+
/** The security-candidates slice: parse → security-candidates → defect rules → findings. */
|
|
922
|
+
export async function runSecurityDefectsSlice(files, thresholds) {
|
|
923
|
+
const candidates = await buildSecurityCandidates(files);
|
|
924
|
+
return analyzeSecurityDefects(candidates, thresholds);
|
|
925
|
+
}
|
|
926
|
+
// ── query-sites slice (query-sites → too-many-queries) ───────────────────────
|
|
927
|
+
/**
|
|
928
|
+
* Parse → Process → Reduce for the `query-sites` fact (Spec 70 Item 4, step 3).
|
|
929
|
+
* The legacy `query-sites` producer did two jobs — locate each DB-query site and
|
|
930
|
+
* gate the file on DB context — with a second parse of the file's provenance.
|
|
931
|
+
* The collapse splits them: `query-site-candidates` runs the location job
|
|
932
|
+
* un-gated while the AST lives, and the `query-sites` corpus producer re-derives
|
|
933
|
+
* each file's gate (`glob || dbProvenanced || dbActivity || hasSqlTag`) once the
|
|
934
|
+
* `receiver-provenance` fixed point supplies the cross-file seed, then emits the
|
|
935
|
+
* sites of the gated files. This helper builds the raw file facts + the fixed
|
|
936
|
+
* point and reduces through the two corpus producers, so the returned fact is
|
|
937
|
+
* byte-identical to the legacy gated extraction.
|
|
938
|
+
*
|
|
939
|
+
* @param files - The input files to parse and process.
|
|
940
|
+
* @param sqlDialect - The corpus's named dialect for SQL parsing, or null/undefined.
|
|
941
|
+
* @returns The assembled `query-sites` corpus fact.
|
|
942
|
+
*/
|
|
943
|
+
export async function buildQuerySites(files, sqlDialect) {
|
|
944
|
+
const [candidates, within, imports, exports, goBindings, activity] = await Promise.all([
|
|
945
|
+
buildFileFact(files, 'query-site-candidates'),
|
|
946
|
+
buildFileFact(files, 'within-file-provenance'),
|
|
947
|
+
buildFileFact(files, 'import-specifiers'),
|
|
948
|
+
buildFileFact(files, 'export-symbols'),
|
|
949
|
+
buildFileFact(files, 'go-package-bindings'),
|
|
950
|
+
buildFileFact(files, 'receiver-activity'),
|
|
951
|
+
]);
|
|
952
|
+
const provenance = CORPUS_PRODUCERS['receiver-provenance'].process({
|
|
953
|
+
'within-file-provenance': within,
|
|
954
|
+
'import-specifiers': imports,
|
|
955
|
+
'export-symbols': exports,
|
|
956
|
+
'go-package-bindings': goBindings,
|
|
957
|
+
});
|
|
958
|
+
return CORPUS_PRODUCERS['query-sites'].process({
|
|
959
|
+
'query-site-candidates': candidates,
|
|
960
|
+
'within-file-provenance': within,
|
|
961
|
+
'receiver-provenance': provenance,
|
|
962
|
+
'receiver-activity': activity,
|
|
963
|
+
}, { sqlDialect: sqlDialect ?? null });
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Analyze the assembled `query-sites` fact with the too-many-queries rule.
|
|
967
|
+
*
|
|
968
|
+
* @param facts - The assembled `query-sites` fact to analyze.
|
|
969
|
+
* @param thresholds - The too-many-queries rule thresholds (defaults to `{}`).
|
|
970
|
+
* @returns The too-many-queries rule's findings over the fact.
|
|
971
|
+
*/
|
|
972
|
+
export async function analyzeQuerySites(facts, thresholds = {}) {
|
|
973
|
+
return analyzeWithRules(querySiteRules, { 'query-sites': facts }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
974
|
+
}
|
|
975
|
+
/** The query-sites slice: parse → query-sites → too-many-queries → findings. */
|
|
976
|
+
export async function runQuerySitesSlice(files, thresholds, sqlDialect) {
|
|
977
|
+
const facts = await buildQuerySites(files, sqlDialect);
|
|
978
|
+
return analyzeQuerySites(facts, thresholds);
|
|
979
|
+
}
|
|
980
|
+
// ── react-component slice (react-component → 7 react rules) ──────────────────
|
|
981
|
+
/**
|
|
982
|
+
* Parse → Process for the `react-component` fact. Returns the assembled corpus
|
|
983
|
+
* fact (one scan per file, each a full component universe: metadata, imports,
|
|
984
|
+
* JSX elements, hooks, props, complexity), ASTs already freed.
|
|
985
|
+
*
|
|
986
|
+
* @param files - The input files to parse and process.
|
|
987
|
+
* @returns The assembled `react-component` corpus fact.
|
|
988
|
+
*/
|
|
989
|
+
export async function buildReactComponents(files) {
|
|
990
|
+
const facts = [];
|
|
991
|
+
for (const input of files) {
|
|
992
|
+
const parsed = await parseOne(input);
|
|
993
|
+
if (!parsed)
|
|
994
|
+
continue;
|
|
995
|
+
try {
|
|
996
|
+
const producer = fileProducerFor('react-component', parsed.format);
|
|
997
|
+
if (producer)
|
|
998
|
+
facts.push(...producer.process(parsed));
|
|
999
|
+
}
|
|
1000
|
+
finally {
|
|
1001
|
+
parsed.ast?.dispose?.();
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return facts;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Analyze the assembled `react-component` fact with the seven react rules.
|
|
1008
|
+
*
|
|
1009
|
+
* @param facts - The assembled `react-component` fact to analyze.
|
|
1010
|
+
* @param thresholds - The react rule thresholds (defaults to `{}`).
|
|
1011
|
+
* @returns The react rules' findings over the fact.
|
|
1012
|
+
*/
|
|
1013
|
+
export async function analyzeReactComponents(facts, thresholds = {}) {
|
|
1014
|
+
return analyzeWithRules(reactRules, { 'react-component': facts }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
1015
|
+
}
|
|
1016
|
+
/** The react slice: parse → react-component → react rules → findings. */
|
|
1017
|
+
export async function runReactComponentsSlice(files, thresholds) {
|
|
1018
|
+
const facts = await buildReactComponents(files);
|
|
1019
|
+
return analyzeReactComponents(facts, thresholds);
|
|
1020
|
+
}
|
|
1021
|
+
// ── file-header slice (file-header → file-documentation) ─────────────────────
|
|
1022
|
+
/**
|
|
1023
|
+
* Parse → Process for the `file-header` fact. Returns the assembled corpus
|
|
1024
|
+
* fact (one leading comment projection per file, ASTs already freed).
|
|
1025
|
+
*
|
|
1026
|
+
* @param files - The input files to parse and process.
|
|
1027
|
+
* @returns The assembled `file-header` corpus fact.
|
|
1028
|
+
*/
|
|
1029
|
+
export async function buildFileHeaders(files) {
|
|
1030
|
+
const facts = [];
|
|
1031
|
+
for (const input of files) {
|
|
1032
|
+
const parsed = await parseOne(input);
|
|
1033
|
+
if (!parsed)
|
|
1034
|
+
continue;
|
|
1035
|
+
try {
|
|
1036
|
+
const producer = fileProducerFor('file-header', parsed.format);
|
|
1037
|
+
if (producer)
|
|
1038
|
+
facts.push(...producer.process(parsed));
|
|
1039
|
+
}
|
|
1040
|
+
finally {
|
|
1041
|
+
parsed.ast?.dispose?.();
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return facts;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Analyze the assembled `file-header` fact with the file-documentation rule.
|
|
1048
|
+
*
|
|
1049
|
+
* @param facts - The assembled `file-header` fact to analyze.
|
|
1050
|
+
* @param thresholds - The file-documentation rule thresholds (defaults to `{}`).
|
|
1051
|
+
* @returns The file-documentation rule's findings over the fact.
|
|
1052
|
+
*/
|
|
1053
|
+
export async function analyzeFileHeaders(facts, thresholds = {}) {
|
|
1054
|
+
return analyzeWithRules(fileDocumentationRules, { 'file-header': facts }, ['typescript', 'tsx', 'javascript'], thresholds);
|
|
1055
|
+
}
|
|
1056
|
+
/** The file-header slice: parse → file-header → file-documentation → findings. */
|
|
1057
|
+
export async function runFileHeadersSlice(files, thresholds) {
|
|
1058
|
+
const facts = await buildFileHeaders(files);
|
|
1059
|
+
return analyzeFileHeaders(facts, thresholds);
|
|
1060
|
+
}
|
|
1061
|
+
// ── schema-json slice (json-document → schema-validations → 17 rules) ────────
|
|
1062
|
+
/**
|
|
1063
|
+
* Parse → Process for the `json-document` fact. Returns the assembled corpus
|
|
1064
|
+
* fact (one parsed JSON document per `.json` file, ASTs already freed). The
|
|
1065
|
+
* producer reads `.source` (the JsonAdapter has no code constructs), so the
|
|
1066
|
+
* parse still validates the file but the fact is the `JSON.parse` value.
|
|
1067
|
+
*
|
|
1068
|
+
* @param files - The input files to parse and process.
|
|
1069
|
+
* @returns The assembled `json-document` corpus fact.
|
|
1070
|
+
*/
|
|
1071
|
+
export async function buildJsonDocuments(files) {
|
|
1072
|
+
const facts = [];
|
|
1073
|
+
for (const input of files) {
|
|
1074
|
+
const parsed = await parseOne(input);
|
|
1075
|
+
if (!parsed)
|
|
1076
|
+
continue;
|
|
1077
|
+
try {
|
|
1078
|
+
const producer = fileProducerFor('json-document', parsed.format);
|
|
1079
|
+
if (producer)
|
|
1080
|
+
facts.push(...producer.process(parsed));
|
|
1081
|
+
}
|
|
1082
|
+
finally {
|
|
1083
|
+
parsed.ast?.dispose?.();
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
return facts;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Analyze the assembled `schema-validations` fact with the 17 schema-json rules.
|
|
1090
|
+
*
|
|
1091
|
+
* @param validations - The assembled `schema-validations` fact to analyze.
|
|
1092
|
+
* @param thresholds - The schema-json rule thresholds (defaults to `{}`).
|
|
1093
|
+
* @returns The 17 schema-json rules' findings over the fact.
|
|
1094
|
+
*/
|
|
1095
|
+
export async function analyzeSchemaJson(validations, thresholds = {}) {
|
|
1096
|
+
return analyzeWithRules(schemaJsonRules, { 'schema-validations': validations }, ['json'], thresholds);
|
|
1097
|
+
}
|
|
1098
|
+
//# sourceMappingURL=runner.js.map
|