code-auditor-mcp 4.1.1 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +338 -0
- package/README.md +4 -4
- package/configs/hhra-compat.json +0 -8
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts +1 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js +7 -1
- package/dist/__tests__/fixtures/spec-52/item-03-exec-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts +2 -8
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js +4 -4
- package/dist/__tests__/fixtures/spec-52/item-04-storage-sql-exec-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts +1 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-06-chained-prepare-run-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts +2 -2
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-07-chained-prepare-bind-first-in-loop.js.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts +1 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.d.ts.map +1 -1
- package/dist/__tests__/fixtures/spec-52/item-10-promise-all-map-of-eager-all-in-loop.js.map +1 -1
- package/dist/analyzers/applicability.d.ts +42 -0
- package/dist/analyzers/applicability.d.ts.map +1 -1
- package/dist/analyzers/applicability.js +74 -0
- package/dist/analyzers/applicability.js.map +1 -1
- package/dist/analyzers/cross-language/APIContractAnalyzer.js +18 -24
- package/dist/analyzers/cross-language/APIContractAnalyzer.js.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts +30 -23
- package/dist/analyzers/cross-language/DependencyGraphBuilder.d.ts.map +1 -1
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js +113 -76
- package/dist/analyzers/cross-language/DependencyGraphBuilder.js.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.d.ts +2 -0
- package/dist/analyzers/cross-language/SchemaValidator.d.ts.map +1 -1
- package/dist/analyzers/cross-language/SchemaValidator.js +8 -3
- package/dist/analyzers/cross-language/SchemaValidator.js.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +210 -148
- package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -1
- package/dist/analyzers/documentationAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/documentationAnalyzer.js +23 -28
- package/dist/analyzers/documentationAnalyzer.js.map +1 -1
- package/dist/analyzers/handleIdentification.d.ts +356 -0
- package/dist/analyzers/handleIdentification.d.ts.map +1 -0
- package/dist/analyzers/handleIdentification.js +424 -0
- package/dist/analyzers/handleIdentification.js.map +1 -0
- package/dist/analyzers/manifestStaleness.d.ts +64 -0
- package/dist/analyzers/manifestStaleness.d.ts.map +1 -0
- package/dist/analyzers/manifestStaleness.js +115 -0
- package/dist/analyzers/manifestStaleness.js.map +1 -0
- package/dist/analyzers/orgFilterTiers.d.ts +73 -1
- package/dist/analyzers/orgFilterTiers.d.ts.map +1 -1
- package/dist/analyzers/orgFilterTiers.js +166 -1
- package/dist/analyzers/orgFilterTiers.js.map +1 -1
- package/dist/analyzers/provenance.d.ts +251 -57
- package/dist/analyzers/provenance.d.ts.map +1 -1
- package/dist/analyzers/provenance.js +1109 -429
- package/dist/analyzers/provenance.js.map +1 -1
- package/dist/analyzers/reactAnalyzer.d.ts +2 -0
- package/dist/analyzers/reactAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/reactAnalyzer.js +2 -0
- package/dist/analyzers/reactAnalyzer.js.map +1 -1
- package/dist/analyzers/receiverResolution.d.ts +183 -0
- package/dist/analyzers/receiverResolution.d.ts.map +1 -0
- package/dist/analyzers/receiverResolution.js +540 -0
- package/dist/analyzers/receiverResolution.js.map +1 -0
- package/dist/analyzers/receiverRoot.d.ts +328 -0
- package/dist/analyzers/receiverRoot.d.ts.map +1 -0
- package/dist/analyzers/receiverRoot.js +990 -0
- package/dist/analyzers/receiverRoot.js.map +1 -0
- package/dist/analyzers/ruleRegistry.d.ts +12 -68
- package/dist/analyzers/ruleRegistry.d.ts.map +1 -1
- package/dist/analyzers/ruleRegistry.js +32 -342
- package/dist/analyzers/ruleRegistry.js.map +1 -1
- package/dist/analyzers/ruleTiming.d.ts +10 -0
- package/dist/analyzers/ruleTiming.d.ts.map +1 -1
- package/dist/analyzers/ruleTiming.js +20 -0
- package/dist/analyzers/ruleTiming.js.map +1 -1
- package/dist/analyzers/sqlLiteral.d.ts +76 -0
- package/dist/analyzers/sqlLiteral.d.ts.map +1 -0
- package/dist/analyzers/sqlLiteral.js +419 -0
- package/dist/analyzers/sqlLiteral.js.map +1 -0
- package/dist/analyzers/tsEcosystem.d.ts +115 -0
- package/dist/analyzers/tsEcosystem.d.ts.map +1 -0
- package/dist/analyzers/tsEcosystem.js +231 -0
- package/dist/analyzers/tsEcosystem.js.map +1 -0
- package/dist/analyzers/tsExpressionDescriptor.d.ts +156 -0
- package/dist/analyzers/tsExpressionDescriptor.d.ts.map +1 -0
- package/dist/analyzers/tsExpressionDescriptor.js +374 -0
- package/dist/analyzers/tsExpressionDescriptor.js.map +1 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts +6 -0
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +107 -44
- package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDRYAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js +23 -35
- package/dist/analyzers/universal/UniversalDRYAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +287 -49
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +2130 -512
- package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js +2 -18
- package/dist/analyzers/universal/UniversalDocumentationAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts +0 -33
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js +20 -143
- package/dist/analyzers/universal/UniversalSOLIDAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts +4 -3
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +36 -13
- package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSecretsAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSecretsAnalyzer.js +6 -0
- package/dist/analyzers/universal/UniversalSecretsAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.d.ts +15 -0
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.js +25 -0
- package/dist/analyzers/universal/UniversalSecurityAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +21 -32
- package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js +166 -196
- package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
- package/dist/analyzers/universal/functionConcerns.d.ts +3 -0
- package/dist/analyzers/universal/functionConcerns.d.ts.map +1 -1
- package/dist/analyzers/universal/functionConcerns.js +4 -1
- package/dist/analyzers/universal/functionConcerns.js.map +1 -1
- package/dist/analyzers/universal/schema/codeAnalysis.d.ts +310 -69
- package/dist/analyzers/universal/schema/codeAnalysis.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/codeAnalysis.js +709 -383
- package/dist/analyzers/universal/schema/codeAnalysis.js.map +1 -1
- package/dist/analyzers/universal/schema/config.d.ts +3 -14
- package/dist/analyzers/universal/schema/config.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/config.js +3 -16
- package/dist/analyzers/universal/schema/config.js.map +1 -1
- package/dist/analyzers/universal/schema/discovery.d.ts +22 -1
- package/dist/analyzers/universal/schema/discovery.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/discovery.js +36 -20
- package/dist/analyzers/universal/schema/discovery.js.map +1 -1
- package/dist/analyzers/universal/schema/jsonSchema.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/jsonSchema.js +13 -3
- package/dist/analyzers/universal/schema/jsonSchema.js.map +1 -1
- package/dist/analyzers/universal/schema/migrations.d.ts +187 -27
- package/dist/analyzers/universal/schema/migrations.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/migrations.js +443 -186
- package/dist/analyzers/universal/schema/migrations.js.map +1 -1
- package/dist/analyzers/universal/schema/types.d.ts +17 -3
- package/dist/analyzers/universal/schema/types.d.ts.map +1 -1
- package/dist/analyzers/universal/schema/violations.js +1 -1
- package/dist/analyzers/universal/schema/violations.js.map +1 -1
- package/dist/analyzers/universal/styleScale.d.ts +52 -0
- package/dist/analyzers/universal/styleScale.d.ts.map +1 -0
- package/dist/analyzers/universal/styleScale.js +95 -0
- package/dist/analyzers/universal/styleScale.js.map +1 -0
- package/dist/applyDataDirEnv.js +1 -1
- package/dist/applyDataDirEnv.js.map +1 -1
- package/dist/auditRouter.d.ts +26 -30
- package/dist/auditRouter.d.ts.map +1 -1
- package/dist/auditRouter.js +373 -143
- package/dist/auditRouter.js.map +1 -1
- package/dist/auditRunner.d.ts +64 -1
- package/dist/auditRunner.d.ts.map +1 -1
- package/dist/auditRunner.js +1538 -1033
- package/dist/auditRunner.js.map +1 -1
- package/dist/baseline.d.ts +30 -3
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +70 -9
- package/dist/baseline.js.map +1 -1
- package/dist/cli.js +969 -821
- package/dist/cli.js.map +1 -1
- package/dist/codeIndex/analyzerConfig.d.ts +60 -0
- package/dist/codeIndex/analyzerConfig.d.ts.map +1 -0
- package/dist/codeIndex/analyzerConfig.js +98 -0
- package/dist/codeIndex/analyzerConfig.js.map +1 -0
- package/dist/codeIndex/auditResults.d.ts +39 -0
- package/dist/codeIndex/auditResults.d.ts.map +1 -0
- package/dist/codeIndex/auditResults.js +99 -0
- package/dist/codeIndex/auditResults.js.map +1 -0
- package/dist/codeIndex/codeMap.d.ts +59 -0
- package/dist/codeIndex/codeMap.d.ts.map +1 -0
- package/dist/codeIndex/codeMap.js +72 -0
- package/dist/codeIndex/codeMap.js.map +1 -0
- package/dist/codeIndex/conventions.d.ts +33 -0
- package/dist/codeIndex/conventions.d.ts.map +1 -0
- package/dist/codeIndex/conventions.js +84 -0
- package/dist/codeIndex/conventions.js.map +1 -0
- package/dist/codeIndex/coverage.d.ts +78 -0
- package/dist/codeIndex/coverage.d.ts.map +1 -0
- package/dist/codeIndex/coverage.js +164 -0
- package/dist/codeIndex/coverage.js.map +1 -0
- package/dist/codeIndex/dependencyGraph.d.ts +97 -0
- package/dist/codeIndex/dependencyGraph.d.ts.map +1 -0
- package/dist/codeIndex/dependencyGraph.js +241 -0
- package/dist/codeIndex/dependencyGraph.js.map +1 -0
- package/dist/codeIndex/functionIndex.d.ts +111 -0
- package/dist/codeIndex/functionIndex.d.ts.map +1 -0
- package/dist/codeIndex/functionIndex.js +306 -0
- package/dist/codeIndex/functionIndex.js.map +1 -0
- package/dist/codeIndex/inferredReceivers.d.ts +32 -0
- package/dist/codeIndex/inferredReceivers.d.ts.map +1 -0
- package/dist/codeIndex/inferredReceivers.js +41 -0
- package/dist/codeIndex/inferredReceivers.js.map +1 -0
- package/dist/codeIndex/meta.d.ts +30 -0
- package/dist/codeIndex/meta.d.ts.map +1 -0
- package/dist/codeIndex/meta.js +37 -0
- package/dist/codeIndex/meta.js.map +1 -0
- package/dist/codeIndex/migrations.d.ts +96 -0
- package/dist/codeIndex/migrations.d.ts.map +1 -0
- package/dist/codeIndex/migrations.js +1302 -0
- package/dist/codeIndex/migrations.js.map +1 -0
- package/dist/codeIndex/projectTasks.d.ts +54 -0
- package/dist/codeIndex/projectTasks.d.ts.map +1 -0
- package/dist/codeIndex/projectTasks.js +81 -0
- package/dist/codeIndex/projectTasks.js.map +1 -0
- package/dist/codeIndex/provenance.d.ts +47 -0
- package/dist/codeIndex/provenance.d.ts.map +1 -0
- package/dist/codeIndex/provenance.js +48 -0
- package/dist/codeIndex/provenance.js.map +1 -0
- package/dist/codeIndex/rawSql.d.ts +54 -0
- package/dist/codeIndex/rawSql.d.ts.map +1 -0
- package/dist/codeIndex/rawSql.js +71 -0
- package/dist/codeIndex/rawSql.js.map +1 -0
- package/dist/codeIndex/schema.d.ts +99 -0
- package/dist/codeIndex/schema.d.ts.map +1 -0
- package/dist/codeIndex/schema.js +174 -0
- package/dist/codeIndex/schema.js.map +1 -0
- package/dist/codeIndex/search.d.ts +40 -0
- package/dist/codeIndex/search.d.ts.map +1 -0
- package/dist/codeIndex/search.js +316 -0
- package/dist/codeIndex/search.js.map +1 -0
- package/dist/codeIndex/shared.d.ts +27 -0
- package/dist/codeIndex/shared.d.ts.map +1 -0
- package/dist/codeIndex/shared.js +46 -0
- package/dist/codeIndex/shared.js.map +1 -0
- package/dist/codeIndex/sqliteCollection.d.ts +81 -0
- package/dist/codeIndex/sqliteCollection.d.ts.map +1 -0
- package/dist/codeIndex/sqliteCollection.js +250 -0
- package/dist/codeIndex/sqliteCollection.js.map +1 -0
- package/dist/codeIndex/whitelist.d.ts +59 -0
- package/dist/codeIndex/whitelist.d.ts.map +1 -0
- package/dist/codeIndex/whitelist.js +188 -0
- package/dist/codeIndex/whitelist.js.map +1 -0
- package/dist/codeIndexDB.d.ts +132 -271
- package/dist/codeIndexDB.d.ts.map +1 -1
- package/dist/codeIndexDB.js +365 -2729
- package/dist/codeIndexDB.js.map +1 -1
- package/dist/codeIndexService.d.ts +87 -12
- package/dist/codeIndexService.d.ts.map +1 -1
- package/dist/codeIndexService.js +110 -34
- package/dist/codeIndexService.js.map +1 -1
- package/dist/componentScanner.d.ts +35 -0
- package/dist/componentScanner.d.ts.map +1 -1
- package/dist/componentScanner.js +114 -80
- package/dist/componentScanner.js.map +1 -1
- package/dist/config/configGeneratePath.d.ts +4 -0
- package/dist/config/configGeneratePath.d.ts.map +1 -1
- package/dist/config/configGeneratePath.js +4 -0
- package/dist/config/configGeneratePath.js.map +1 -1
- package/dist/config/configLoader.d.ts +15 -0
- package/dist/config/configLoader.d.ts.map +1 -1
- package/dist/config/configLoader.js +15 -16
- package/dist/config/configLoader.js.map +1 -1
- package/dist/config/defaults.d.ts +11 -7
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +16 -14
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/effectiveConfig.d.ts +17 -2
- package/dist/config/effectiveConfig.d.ts.map +1 -1
- package/dist/config/effectiveConfig.js +32 -25
- package/dist/config/effectiveConfig.js.map +1 -1
- package/dist/config/lintConfigReader.d.ts +6 -0
- package/dist/config/lintConfigReader.d.ts.map +1 -1
- package/dist/config/lintConfigReader.js +6 -0
- package/dist/config/lintConfigReader.js.map +1 -1
- package/dist/config/staticObjectExtract.d.ts +4 -0
- package/dist/config/staticObjectExtract.d.ts.map +1 -1
- package/dist/config/staticObjectExtract.js +7 -3
- package/dist/config/staticObjectExtract.js.map +1 -1
- package/dist/config/thresholdRationales.d.ts +2 -0
- package/dist/config/thresholdRationales.d.ts.map +1 -1
- package/dist/config/thresholdRationales.js +5 -2
- package/dist/config/thresholdRationales.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/conventions/conventionMiner.d.ts +105 -2
- package/dist/conventions/conventionMiner.d.ts.map +1 -1
- package/dist/conventions/conventionMiner.js +334 -259
- package/dist/conventions/conventionMiner.js.map +1 -1
- package/dist/coverage/coverageService.js +4 -4
- package/dist/coverage/coverageService.js.map +1 -1
- package/dist/daemon/args.d.ts +3 -0
- package/dist/daemon/args.d.ts.map +1 -1
- package/dist/daemon/args.js +3 -0
- package/dist/daemon/args.js.map +1 -1
- package/dist/daemon/core.d.ts +33 -27
- package/dist/daemon/core.d.ts.map +1 -1
- package/dist/daemon/core.js +198 -162
- package/dist/daemon/core.js.map +1 -1
- package/dist/daemon/lspServer.d.ts +8 -0
- package/dist/daemon/lspServer.d.ts.map +1 -1
- package/dist/daemon/lspServer.js +8 -0
- package/dist/daemon/lspServer.js.map +1 -1
- package/dist/daemon/main.d.ts +2 -0
- package/dist/daemon/main.d.ts.map +1 -1
- package/dist/daemon/main.js +2 -0
- package/dist/daemon/main.js.map +1 -1
- package/dist/daemon/resolve.d.ts +18 -3
- package/dist/daemon/resolve.d.ts.map +1 -1
- package/dist/daemon/resolve.js +25 -4
- package/dist/daemon/resolve.js.map +1 -1
- package/dist/daemon/socketClient.d.ts +10 -1
- package/dist/daemon/socketClient.d.ts.map +1 -1
- package/dist/daemon/socketClient.js +10 -1
- package/dist/daemon/socketClient.js.map +1 -1
- package/dist/daemon/socketServer.d.ts +13 -0
- package/dist/daemon/socketServer.d.ts.map +1 -1
- package/dist/daemon/socketServer.js +13 -0
- package/dist/daemon/socketServer.js.map +1 -1
- package/dist/dataPaths.d.ts +17 -8
- package/dist/dataPaths.d.ts.map +1 -1
- package/dist/dataPaths.js +16 -44
- package/dist/dataPaths.js.map +1 -1
- package/dist/dismissals.d.ts +22 -1
- package/dist/dismissals.d.ts.map +1 -1
- package/dist/dismissals.js +22 -1
- package/dist/dismissals.js.map +1 -1
- package/dist/enforcement/gate.d.ts +1 -0
- package/dist/enforcement/gate.d.ts.map +1 -1
- package/dist/enforcement/gate.js +1 -0
- package/dist/enforcement/gate.js.map +1 -1
- package/dist/fingerprint.d.ts +6 -0
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +46 -1
- package/dist/fingerprint.js.map +1 -1
- package/dist/functionScanner.d.ts +30 -1
- package/dist/functionScanner.d.ts.map +1 -1
- package/dist/functionScanner.js +258 -256
- package/dist/functionScanner.js.map +1 -1
- package/dist/generators/AWSQConfigGenerator.d.ts +23 -0
- package/dist/generators/AWSQConfigGenerator.d.ts.map +1 -1
- package/dist/generators/AWSQConfigGenerator.js +23 -0
- package/dist/generators/AWSQConfigGenerator.js.map +1 -1
- package/dist/generators/BaseConfigGenerator.d.ts +7 -0
- package/dist/generators/BaseConfigGenerator.d.ts.map +1 -1
- package/dist/generators/BaseConfigGenerator.js +7 -0
- package/dist/generators/BaseConfigGenerator.js.map +1 -1
- package/dist/generators/ClaudeConfigGenerator.d.ts +23 -0
- package/dist/generators/ClaudeConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ClaudeConfigGenerator.js +23 -0
- package/dist/generators/ClaudeConfigGenerator.js.map +1 -1
- package/dist/generators/ClineConfigGenerator.d.ts +23 -0
- package/dist/generators/ClineConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ClineConfigGenerator.js +23 -0
- package/dist/generators/ClineConfigGenerator.js.map +1 -1
- package/dist/generators/CodeiumConfigGenerator.d.ts +23 -0
- package/dist/generators/CodeiumConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CodeiumConfigGenerator.js +23 -0
- package/dist/generators/CodeiumConfigGenerator.js.map +1 -1
- package/dist/generators/CodexConfigGenerator.d.ts +23 -0
- package/dist/generators/CodexConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CodexConfigGenerator.js +23 -0
- package/dist/generators/CodexConfigGenerator.js.map +1 -1
- package/dist/generators/ConfigGeneratorFactory.d.ts +9 -0
- package/dist/generators/ConfigGeneratorFactory.d.ts.map +1 -1
- package/dist/generators/ConfigGeneratorFactory.js +9 -0
- package/dist/generators/ConfigGeneratorFactory.js.map +1 -1
- package/dist/generators/ContinueConfigGenerator.d.ts +23 -0
- package/dist/generators/ContinueConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ContinueConfigGenerator.js +23 -0
- package/dist/generators/ContinueConfigGenerator.js.map +1 -1
- package/dist/generators/CopilotConfigGenerator.d.ts +23 -0
- package/dist/generators/CopilotConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CopilotConfigGenerator.js +23 -0
- package/dist/generators/CopilotConfigGenerator.js.map +1 -1
- package/dist/generators/CursorConfigGenerator.d.ts +23 -0
- package/dist/generators/CursorConfigGenerator.d.ts.map +1 -1
- package/dist/generators/CursorConfigGenerator.js +23 -0
- package/dist/generators/CursorConfigGenerator.js.map +1 -1
- package/dist/generators/GeminiConfigGenerator.d.ts +23 -0
- package/dist/generators/GeminiConfigGenerator.d.ts.map +1 -1
- package/dist/generators/GeminiConfigGenerator.js +23 -0
- package/dist/generators/GeminiConfigGenerator.js.map +1 -1
- package/dist/generators/VSCodeConfigGenerator.d.ts +23 -0
- package/dist/generators/VSCodeConfigGenerator.d.ts.map +1 -1
- package/dist/generators/VSCodeConfigGenerator.js +23 -0
- package/dist/generators/VSCodeConfigGenerator.js.map +1 -1
- package/dist/generators/ZCodeConfigGenerator.d.ts +23 -0
- package/dist/generators/ZCodeConfigGenerator.d.ts.map +1 -1
- package/dist/generators/ZCodeConfigGenerator.js +23 -0
- package/dist/generators/ZCodeConfigGenerator.js.map +1 -1
- package/dist/graph/blastRadius.d.ts.map +1 -1
- package/dist/graph/blastRadius.js +12 -7
- package/dist/graph/blastRadius.js.map +1 -1
- package/dist/graph/callGraph.d.ts +31 -0
- package/dist/graph/callGraph.d.ts.map +1 -1
- package/dist/graph/callGraph.js +62 -32
- package/dist/graph/callGraph.js.map +1 -1
- package/dist/graph/importClassification.d.ts +28 -0
- package/dist/graph/importClassification.d.ts.map +1 -1
- package/dist/graph/importClassification.js +57 -0
- package/dist/graph/importClassification.js.map +1 -1
- package/dist/graph/importGraph.d.ts +38 -0
- package/dist/graph/importGraph.d.ts.map +1 -1
- package/dist/graph/importGraph.js +38 -0
- package/dist/graph/importGraph.js.map +1 -1
- package/dist/graph/outputFormatter.d.ts +12 -4
- package/dist/graph/outputFormatter.d.ts.map +1 -1
- package/dist/graph/outputFormatter.js +12 -62
- package/dist/graph/outputFormatter.js.map +1 -1
- package/dist/hooks/codex.d.ts +8 -1
- package/dist/hooks/codex.d.ts.map +1 -1
- package/dist/hooks/codex.js +7 -0
- package/dist/hooks/codex.js.map +1 -1
- package/dist/hooks/core.d.ts +6 -0
- package/dist/hooks/core.d.ts.map +1 -1
- package/dist/hooks/core.js +6 -1
- package/dist/hooks/core.js.map +1 -1
- package/dist/hooks/cursor.d.ts +11 -1
- package/dist/hooks/cursor.d.ts.map +1 -1
- package/dist/hooks/cursor.js +10 -0
- package/dist/hooks/cursor.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/installConfig.d.ts +23 -5
- package/dist/installConfig.d.ts.map +1 -1
- package/dist/installConfig.js +23 -5
- package/dist/installConfig.js.map +1 -1
- package/dist/installer.d.ts +6 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +6 -0
- package/dist/installer.js.map +1 -1
- package/dist/invariants/ruleEngine.d.ts +3 -0
- package/dist/invariants/ruleEngine.d.ts.map +1 -1
- package/dist/invariants/ruleEngine.js +156 -119
- package/dist/invariants/ruleEngine.js.map +1 -1
- package/dist/invariants/ruleValidator.d.ts +3 -0
- package/dist/invariants/ruleValidator.d.ts.map +1 -1
- package/dist/invariants/ruleValidator.js +185 -178
- package/dist/invariants/ruleValidator.js.map +1 -1
- package/dist/languages/LanguageOrchestrator.d.ts +4 -1
- package/dist/languages/LanguageOrchestrator.d.ts.map +1 -1
- package/dist/languages/LanguageOrchestrator.js +8 -19
- package/dist/languages/LanguageOrchestrator.js.map +1 -1
- package/dist/languages/RuntimeManager.d.ts +8 -0
- package/dist/languages/RuntimeManager.d.ts.map +1 -1
- package/dist/languages/RuntimeManager.js +55 -5
- package/dist/languages/RuntimeManager.js.map +1 -1
- package/dist/languages/UniversalAnalyzer.js +1 -1
- package/dist/languages/UniversalAnalyzer.js.map +1 -1
- package/dist/languages/adapterBridge.d.ts +4 -0
- package/dist/languages/adapterBridge.d.ts.map +1 -1
- package/dist/languages/adapterBridge.js +37 -3
- package/dist/languages/adapterBridge.js.map +1 -1
- package/dist/languages/go/GoAdapter.d.ts.map +1 -1
- package/dist/languages/go/GoAdapter.js +11 -14
- package/dist/languages/go/GoAdapter.js.map +1 -1
- package/dist/languages/go/analyzer-darwin-amd64 +0 -0
- package/dist/languages/go/analyzer-darwin-arm64 +0 -0
- package/dist/languages/go/analyzer-linux-amd64 +0 -0
- package/dist/languages/go/analyzer-linux-arm64 +0 -0
- package/dist/languages/go/analyzer-src/analyzer.go +2 -0
- package/dist/languages/go/analyzer-src/dataaccess.go +388 -0
- package/dist/languages/go/analyzer-src/types.go +8 -0
- package/dist/languages/go/analyzer-windows-amd64.exe +0 -0
- package/dist/languages/go/database-packages.json +8 -0
- package/dist/languages/go/goResolution.d.ts +229 -0
- package/dist/languages/go/goResolution.d.ts.map +1 -0
- package/dist/languages/go/goResolution.js +799 -0
- package/dist/languages/go/goResolution.js.map +1 -0
- package/dist/languages/go/stdlib-packages.json +353 -0
- package/dist/languages/go/tenantInputs.d.ts +37 -0
- package/dist/languages/go/tenantInputs.d.ts.map +1 -0
- package/dist/languages/go/tenantInputs.js +121 -0
- package/dist/languages/go/tenantInputs.js.map +1 -0
- package/dist/languages/index.d.ts +1 -0
- package/dist/languages/index.d.ts.map +1 -1
- package/dist/languages/index.js +5 -0
- package/dist/languages/index.js.map +1 -1
- package/dist/languages/json/JsonAdapter.d.ts +177 -0
- package/dist/languages/json/JsonAdapter.d.ts.map +1 -0
- package/dist/languages/json/JsonAdapter.js +531 -0
- package/dist/languages/json/JsonAdapter.js.map +1 -0
- package/dist/languages/locationIndex.d.ts +41 -0
- package/dist/languages/locationIndex.d.ts.map +1 -0
- package/dist/languages/locationIndex.js +42 -0
- package/dist/languages/locationIndex.js.map +1 -0
- package/dist/languages/sql/dialectDetection.d.ts +57 -0
- package/dist/languages/sql/dialectDetection.d.ts.map +1 -0
- package/dist/languages/sql/dialectDetection.js +135 -0
- package/dist/languages/sql/dialectDetection.js.map +1 -0
- package/dist/languages/sql/sqlAst.d.ts +494 -0
- package/dist/languages/sql/sqlAst.d.ts.map +1 -0
- package/dist/languages/sql/sqlAst.js +1817 -0
- package/dist/languages/sql/sqlAst.js.map +1 -0
- package/dist/languages/testConventions.d.ts +12 -1
- package/dist/languages/testConventions.d.ts.map +1 -1
- package/dist/languages/testConventions.js +13 -1
- package/dist/languages/testConventions.js.map +1 -1
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.js +1 -1
- package/dist/languages/tree-sitter/TreeSitterCssAdapter.js.map +1 -1
- package/dist/languages/tree-sitter/converter.js +2 -2
- package/dist/languages/tree-sitter/converter.js.map +1 -1
- package/dist/languages/tree-sitter/parser.d.ts +3 -4
- package/dist/languages/tree-sitter/parser.d.ts.map +1 -1
- package/dist/languages/tree-sitter/parser.js +10 -4
- package/dist/languages/tree-sitter/parser.js.map +1 -1
- package/dist/languages/tree-sitter/rawNode.d.ts +3 -0
- package/dist/languages/tree-sitter/rawNode.d.ts.map +1 -1
- package/dist/languages/tree-sitter/rawNode.js +3 -0
- package/dist/languages/tree-sitter/rawNode.js.map +1 -1
- package/dist/languages/types.d.ts +7 -0
- package/dist/languages/types.d.ts.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts +36 -0
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.d.ts.map +1 -1
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js +168 -45
- package/dist/languages/typescript/TreeSitterTypeScriptAdapter.js.map +1 -1
- package/dist/languages/typescript/database-packages.json +19 -0
- package/dist/ledger.d.ts +118 -2
- package/dist/ledger.d.ts.map +1 -1
- package/dist/ledger.js +167 -45
- package/dist/ledger.js.map +1 -1
- package/dist/legacyIndexNotice.d.ts +32 -0
- package/dist/legacyIndexNotice.d.ts.map +1 -0
- package/dist/legacyIndexNotice.js +89 -0
- package/dist/legacyIndexNotice.js.map +1 -0
- package/dist/mcp-tools/discoveryQueries.d.ts +55 -0
- package/dist/mcp-tools/discoveryQueries.d.ts.map +1 -0
- package/dist/mcp-tools/discoveryQueries.js +157 -0
- package/dist/mcp-tools/discoveryQueries.js.map +1 -0
- package/dist/mcp-tools/projectTasks.d.ts +9 -123
- package/dist/mcp-tools/projectTasks.d.ts.map +1 -1
- package/dist/mcp-tools/projectTasks.js +180 -170
- package/dist/mcp-tools/projectTasks.js.map +1 -1
- package/dist/mcp-tools/whitelistTools.d.ts +20 -0
- package/dist/mcp-tools/whitelistTools.d.ts.map +1 -1
- package/dist/mcp-tools/whitelistTools.js +20 -0
- package/dist/mcp-tools/whitelistTools.js.map +1 -1
- package/dist/mcp-tools/workflowGuide.d.ts +9 -0
- package/dist/mcp-tools/workflowGuide.d.ts.map +1 -1
- package/dist/mcp-tools/workflowGuide.js +13 -5
- package/dist/mcp-tools/workflowGuide.js.map +1 -1
- package/dist/mcp-tools-shared.d.ts +78 -0
- package/dist/mcp-tools-shared.d.ts.map +1 -1
- package/dist/mcp-tools-shared.js +203 -340
- package/dist/mcp-tools-shared.js.map +1 -1
- package/dist/mcp-ui-simple.d.ts +2 -0
- package/dist/mcp-ui-simple.d.ts.map +1 -1
- package/dist/mcp-ui-simple.js +12 -5
- package/dist/mcp-ui-simple.js.map +1 -1
- package/dist/mcp.d.ts +6 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +827 -850
- package/dist/mcp.js.map +1 -1
- package/dist/mcpAuditJobs.d.ts +29 -33
- package/dist/mcpAuditJobs.d.ts.map +1 -1
- package/dist/mcpAuditJobs.js +102 -791
- package/dist/mcpAuditJobs.js.map +1 -1
- package/dist/mcpAutoIndex.d.ts +5 -0
- package/dist/mcpAutoIndex.d.ts.map +1 -1
- package/dist/mcpAutoIndex.js +7 -2
- package/dist/mcpAutoIndex.js.map +1 -1
- package/dist/mcpDiagnostics.d.ts +7 -0
- package/dist/mcpDiagnostics.d.ts.map +1 -1
- package/dist/mcpDiagnostics.js +34 -9
- package/dist/mcpDiagnostics.js.map +1 -1
- package/dist/mcpToolErrors.d.ts +16 -0
- package/dist/mcpToolErrors.d.ts.map +1 -1
- package/dist/mcpToolErrors.js +16 -0
- package/dist/mcpToolErrors.js.map +1 -1
- package/dist/nextFile.d.ts +6 -0
- package/dist/nextFile.d.ts.map +1 -1
- package/dist/nextFile.js +6 -0
- package/dist/nextFile.js.map +1 -1
- package/dist/nextFileIncremental.d.ts +44 -4
- package/dist/nextFileIncremental.d.ts.map +1 -1
- package/dist/nextFileIncremental.js +47 -7
- package/dist/nextFileIncremental.js.map +1 -1
- package/dist/phase/batchFunctions.d.ts +38 -0
- package/dist/phase/batchFunctions.d.ts.map +1 -0
- package/dist/phase/batchFunctions.js +64 -0
- package/dist/phase/batchFunctions.js.map +1 -0
- package/dist/phase/checks.d.ts +39 -0
- package/dist/phase/checks.d.ts.map +1 -0
- package/dist/phase/checks.js +48 -0
- package/dist/phase/checks.js.map +1 -0
- package/dist/phase/codeBlocks.d.ts +25 -0
- package/dist/phase/codeBlocks.d.ts.map +1 -0
- package/dist/phase/codeBlocks.js +268 -0
- package/dist/phase/codeBlocks.js.map +1 -0
- package/dist/phase/colorMath.d.ts +41 -0
- package/dist/phase/colorMath.d.ts.map +1 -0
- package/dist/phase/colorMath.js +109 -0
- package/dist/phase/colorMath.js.map +1 -0
- package/dist/phase/config.d.ts +29 -0
- package/dist/phase/config.d.ts.map +1 -0
- package/dist/phase/config.js +54 -0
- package/dist/phase/config.js.map +1 -0
- package/dist/phase/consumed.d.ts +47 -0
- package/dist/phase/consumed.d.ts.map +1 -0
- package/dist/phase/consumed.js +22 -0
- package/dist/phase/consumed.js.map +1 -0
- package/dist/phase/conventionMining.d.ts +59 -0
- package/dist/phase/conventionMining.d.ts.map +1 -0
- package/dist/phase/conventionMining.js +152 -0
- package/dist/phase/conventionMining.js.map +1 -0
- package/dist/phase/coverage.d.ts +65 -0
- package/dist/phase/coverage.d.ts.map +1 -0
- package/dist/phase/coverage.js +121 -0
- package/dist/phase/coverage.js.map +1 -0
- package/dist/phase/dag.d.ts +49 -0
- package/dist/phase/dag.d.ts.map +1 -0
- package/dist/phase/dag.js +120 -0
- package/dist/phase/dag.js.map +1 -0
- package/dist/phase/dataAccessCalls.d.ts +33 -0
- package/dist/phase/dataAccessCalls.d.ts.map +1 -0
- package/dist/phase/dataAccessCalls.js +42 -0
- package/dist/phase/dataAccessCalls.js.map +1 -0
- package/dist/phase/dataAccessCallsCandidates.d.ts +25 -0
- package/dist/phase/dataAccessCallsCandidates.d.ts.map +1 -0
- package/dist/phase/dataAccessCallsCandidates.js +27 -0
- package/dist/phase/dataAccessCallsCandidates.js.map +1 -0
- package/dist/phase/dynamicSql.d.ts +18 -0
- package/dist/phase/dynamicSql.d.ts.map +1 -0
- package/dist/phase/dynamicSql.js +20 -0
- package/dist/phase/dynamicSql.js.map +1 -0
- package/dist/phase/exportForm.d.ts +23 -0
- package/dist/phase/exportForm.d.ts.map +1 -0
- package/dist/phase/exportForm.js +29 -0
- package/dist/phase/exportForm.js.map +1 -0
- package/dist/phase/exportSymbols.d.ts +21 -0
- package/dist/phase/exportSymbols.d.ts.map +1 -0
- package/dist/phase/exportSymbols.js +28 -0
- package/dist/phase/exportSymbols.js.map +1 -0
- package/dist/phase/fileHeader.d.ts +15 -0
- package/dist/phase/fileHeader.d.ts.map +1 -0
- package/dist/phase/fileHeader.js +33 -0
- package/dist/phase/fileHeader.js.map +1 -0
- package/dist/phase/fileImports.d.ts +39 -0
- package/dist/phase/fileImports.d.ts.map +1 -0
- package/dist/phase/fileImports.js +138 -0
- package/dist/phase/fileImports.js.map +1 -0
- package/dist/phase/fileSymbols.d.ts +25 -0
- package/dist/phase/fileSymbols.d.ts.map +1 -0
- package/dist/phase/fileSymbols.js +302 -0
- package/dist/phase/fileSymbols.js.map +1 -0
- package/dist/phase/functionBodies.d.ts +28 -0
- package/dist/phase/functionBodies.d.ts.map +1 -0
- package/dist/phase/functionBodies.js +67 -0
- package/dist/phase/functionBodies.js.map +1 -0
- package/dist/phase/functionIndex.d.ts +28 -0
- package/dist/phase/functionIndex.d.ts.map +1 -0
- package/dist/phase/functionIndex.js +152 -0
- package/dist/phase/functionIndex.js.map +1 -0
- package/dist/phase/goFunctionAnalysis.d.ts +47 -0
- package/dist/phase/goFunctionAnalysis.d.ts.map +1 -0
- package/dist/phase/goFunctionAnalysis.js +291 -0
- package/dist/phase/goFunctionAnalysis.js.map +1 -0
- package/dist/phase/goFunctions.d.ts +38 -0
- package/dist/phase/goFunctions.d.ts.map +1 -0
- package/dist/phase/goFunctions.js +154 -0
- package/dist/phase/goFunctions.js.map +1 -0
- package/dist/phase/goImports.d.ts +29 -0
- package/dist/phase/goImports.d.ts.map +1 -0
- package/dist/phase/goImports.js +68 -0
- package/dist/phase/goImports.js.map +1 -0
- package/dist/phase/goPackageBindings.d.ts +22 -0
- package/dist/phase/goPackageBindings.d.ts.map +1 -0
- package/dist/phase/goPackageBindings.js +30 -0
- package/dist/phase/goPackageBindings.js.map +1 -0
- package/dist/phase/goSwitches.d.ts +28 -0
- package/dist/phase/goSwitches.d.ts.map +1 -0
- package/dist/phase/goSwitches.js +52 -0
- package/dist/phase/goSwitches.js.map +1 -0
- package/dist/phase/importForm.d.ts +20 -0
- package/dist/phase/importForm.d.ts.map +1 -0
- package/dist/phase/importForm.js +27 -0
- package/dist/phase/importForm.js.map +1 -0
- package/dist/phase/importSpecifiers.d.ts +20 -0
- package/dist/phase/importSpecifiers.d.ts.map +1 -0
- package/dist/phase/importSpecifiers.js +30 -0
- package/dist/phase/importSpecifiers.js.map +1 -0
- package/dist/phase/imports.d.ts +18 -0
- package/dist/phase/imports.d.ts.map +1 -0
- package/dist/phase/imports.js +25 -0
- package/dist/phase/imports.js.map +1 -0
- package/dist/phase/jsonDocument.d.ts +26 -0
- package/dist/phase/jsonDocument.d.ts.map +1 -0
- package/dist/phase/jsonDocument.js +36 -0
- package/dist/phase/jsonDocument.js.map +1 -0
- package/dist/phase/localBinding.d.ts +33 -0
- package/dist/phase/localBinding.d.ts.map +1 -0
- package/dist/phase/localBinding.js +208 -0
- package/dist/phase/localBinding.js.map +1 -0
- package/dist/phase/loopQueries.d.ts +31 -0
- package/dist/phase/loopQueries.d.ts.map +1 -0
- package/dist/phase/loopQueries.js +44 -0
- package/dist/phase/loopQueries.js.map +1 -0
- package/dist/phase/loopQueryCandidates.d.ts +26 -0
- package/dist/phase/loopQueryCandidates.d.ts.map +1 -0
- package/dist/phase/loopQueryCandidates.js +28 -0
- package/dist/phase/loopQueryCandidates.js.map +1 -0
- package/dist/phase/oracles.d.ts +216 -0
- package/dist/phase/oracles.d.ts.map +1 -0
- package/dist/phase/oracles.js +484 -0
- package/dist/phase/oracles.js.map +1 -0
- package/dist/phase/phaseModel.d.ts +190 -0
- package/dist/phase/phaseModel.d.ts.map +1 -0
- package/dist/phase/phaseModel.js +468 -0
- package/dist/phase/phaseModel.js.map +1 -0
- package/dist/phase/producers.d.ts +450 -0
- package/dist/phase/producers.d.ts.map +1 -0
- package/dist/phase/producers.js +1027 -0
- package/dist/phase/producers.js.map +1 -0
- package/dist/phase/querySiteCandidates.d.ts +27 -0
- package/dist/phase/querySiteCandidates.d.ts.map +1 -0
- package/dist/phase/querySiteCandidates.js +66 -0
- package/dist/phase/querySiteCandidates.js.map +1 -0
- package/dist/phase/querySites.d.ts +30 -0
- package/dist/phase/querySites.d.ts.map +1 -0
- package/dist/phase/querySites.js +93 -0
- package/dist/phase/querySites.js.map +1 -0
- package/dist/phase/reachability.d.ts +61 -0
- package/dist/phase/reachability.d.ts.map +1 -0
- package/dist/phase/reachability.js +104 -0
- package/dist/phase/reachability.js.map +1 -0
- package/dist/phase/reactComponents.d.ts +33 -0
- package/dist/phase/reactComponents.d.ts.map +1 -0
- package/dist/phase/reactComponents.js +47 -0
- package/dist/phase/reactComponents.js.map +1 -0
- package/dist/phase/receiverActivity.d.ts +35 -0
- package/dist/phase/receiverActivity.d.ts.map +1 -0
- package/dist/phase/receiverActivity.js +66 -0
- package/dist/phase/receiverActivity.js.map +1 -0
- package/dist/phase/receiverConsumers.d.ts +200 -0
- package/dist/phase/receiverConsumers.d.ts.map +1 -0
- package/dist/phase/receiverConsumers.js +1025 -0
- package/dist/phase/receiverConsumers.js.map +1 -0
- package/dist/phase/receiverProvenance.d.ts +97 -0
- package/dist/phase/receiverProvenance.d.ts.map +1 -0
- package/dist/phase/receiverProvenance.js +337 -0
- package/dist/phase/receiverProvenance.js.map +1 -0
- package/dist/phase/routing.d.ts +47 -0
- package/dist/phase/routing.d.ts.map +1 -0
- package/dist/phase/routing.js +62 -0
- package/dist/phase/routing.js.map +1 -0
- package/dist/phase/rules/conventions.d.ts +61 -0
- package/dist/phase/rules/conventions.d.ts.map +1 -0
- package/dist/phase/rules/conventions.js +403 -0
- package/dist/phase/rules/conventions.js.map +1 -0
- package/dist/phase/rules/crossDomain.d.ts +102 -0
- package/dist/phase/rules/crossDomain.d.ts.map +1 -0
- package/dist/phase/rules/crossDomain.js +918 -0
- package/dist/phase/rules/crossDomain.js.map +1 -0
- package/dist/phase/rules/dataAccess.d.ts +62 -0
- package/dist/phase/rules/dataAccess.d.ts.map +1 -0
- package/dist/phase/rules/dataAccess.js +480 -0
- package/dist/phase/rules/dataAccess.js.map +1 -0
- package/dist/phase/rules/dependencyGraph.d.ts +44 -0
- package/dist/phase/rules/dependencyGraph.d.ts.map +1 -0
- package/dist/phase/rules/dependencyGraph.js +260 -0
- package/dist/phase/rules/dependencyGraph.js.map +1 -0
- package/dist/phase/rules/documentation.d.ts +45 -0
- package/dist/phase/rules/documentation.d.ts.map +1 -0
- package/dist/phase/rules/documentation.js +340 -0
- package/dist/phase/rules/documentation.js.map +1 -0
- package/dist/phase/rules/dry.d.ts +109 -0
- package/dist/phase/rules/dry.d.ts.map +1 -0
- package/dist/phase/rules/dry.js +803 -0
- package/dist/phase/rules/dry.js.map +1 -0
- package/dist/phase/rules/fileDocumentation.d.ts +36 -0
- package/dist/phase/rules/fileDocumentation.d.ts.map +1 -0
- package/dist/phase/rules/fileDocumentation.js +134 -0
- package/dist/phase/rules/fileDocumentation.js.map +1 -0
- package/dist/phase/rules/functionBodies.d.ts +33 -0
- package/dist/phase/rules/functionBodies.d.ts.map +1 -0
- package/dist/phase/rules/functionBodies.js +71 -0
- package/dist/phase/rules/functionBodies.js.map +1 -0
- package/dist/phase/rules/goRules.d.ts +49 -0
- package/dist/phase/rules/goRules.d.ts.map +1 -0
- package/dist/phase/rules/goRules.js +209 -0
- package/dist/phase/rules/goRules.js.map +1 -0
- package/dist/phase/rules/querySites.d.ts +29 -0
- package/dist/phase/rules/querySites.d.ts.map +1 -0
- package/dist/phase/rules/querySites.js +94 -0
- package/dist/phase/rules/querySites.js.map +1 -0
- package/dist/phase/rules/react.d.ts +38 -0
- package/dist/phase/rules/react.d.ts.map +1 -0
- package/dist/phase/rules/react.js +202 -0
- package/dist/phase/rules/react.js.map +1 -0
- package/dist/phase/rules/registry.d.ts +170 -0
- package/dist/phase/rules/registry.d.ts.map +1 -0
- package/dist/phase/rules/registry.js +103 -0
- package/dist/phase/rules/registry.js.map +1 -0
- package/dist/phase/rules/schema.d.ts +79 -0
- package/dist/phase/rules/schema.d.ts.map +1 -0
- package/dist/phase/rules/schema.js +273 -0
- package/dist/phase/rules/schema.js.map +1 -0
- package/dist/phase/rules/schemaJson.d.ts +32 -0
- package/dist/phase/rules/schemaJson.d.ts.map +1 -0
- package/dist/phase/rules/schemaJson.js +81 -0
- package/dist/phase/rules/schemaJson.js.map +1 -0
- package/dist/phase/rules/schemaValidator.d.ts +38 -0
- package/dist/phase/rules/schemaValidator.d.ts.map +1 -0
- package/dist/phase/rules/schemaValidator.js +107 -0
- package/dist/phase/rules/schemaValidator.js.map +1 -0
- package/dist/phase/rules/secrets.d.ts +34 -0
- package/dist/phase/rules/secrets.d.ts.map +1 -0
- package/dist/phase/rules/secrets.js +208 -0
- package/dist/phase/rules/secrets.js.map +1 -0
- package/dist/phase/rules/security.d.ts +30 -0
- package/dist/phase/rules/security.d.ts.map +1 -0
- package/dist/phase/rules/security.js +85 -0
- package/dist/phase/rules/security.js.map +1 -0
- package/dist/phase/rules/securityDefects.d.ts +37 -0
- package/dist/phase/rules/securityDefects.d.ts.map +1 -0
- package/dist/phase/rules/securityDefects.js +167 -0
- package/dist/phase/rules/securityDefects.js.map +1 -0
- package/dist/phase/rules/solid.d.ts +61 -0
- package/dist/phase/rules/solid.d.ts.map +1 -0
- package/dist/phase/rules/solid.js +562 -0
- package/dist/phase/rules/solid.js.map +1 -0
- package/dist/phase/rules/styles.d.ts +77 -0
- package/dist/phase/rules/styles.d.ts.map +1 -0
- package/dist/phase/rules/styles.js +868 -0
- package/dist/phase/rules/styles.js.map +1 -0
- package/dist/phase/rules/unreferencedModule.d.ts +26 -0
- package/dist/phase/rules/unreferencedModule.d.ts.map +1 -0
- package/dist/phase/rules/unreferencedModule.js +61 -0
- package/dist/phase/rules/unreferencedModule.js.map +1 -0
- package/dist/phase/runner.d.ts +549 -0
- package/dist/phase/runner.d.ts.map +1 -0
- package/dist/phase/runner.js +1098 -0
- package/dist/phase/runner.js.map +1 -0
- package/dist/phase/schemaCode.d.ts +34 -0
- package/dist/phase/schemaCode.d.ts.map +1 -0
- package/dist/phase/schemaCode.js +53 -0
- package/dist/phase/schemaCode.js.map +1 -0
- package/dist/phase/schemaObjects.d.ts +37 -0
- package/dist/phase/schemaObjects.d.ts.map +1 -0
- package/dist/phase/schemaObjects.js +139 -0
- package/dist/phase/schemaObjects.js.map +1 -0
- package/dist/phase/schemaUsage.d.ts +30 -0
- package/dist/phase/schemaUsage.d.ts.map +1 -0
- package/dist/phase/schemaUsage.js +99 -0
- package/dist/phase/schemaUsage.js.map +1 -0
- package/dist/phase/schemaUsageCandidates.d.ts +32 -0
- package/dist/phase/schemaUsageCandidates.d.ts.map +1 -0
- package/dist/phase/schemaUsageCandidates.js +165 -0
- package/dist/phase/schemaUsageCandidates.js.map +1 -0
- package/dist/phase/schemaValidations.d.ts +34 -0
- package/dist/phase/schemaValidations.d.ts.map +1 -0
- package/dist/phase/schemaValidations.js +53 -0
- package/dist/phase/schemaValidations.js.map +1 -0
- package/dist/phase/secretCandidates.d.ts +28 -0
- package/dist/phase/secretCandidates.d.ts.map +1 -0
- package/dist/phase/secretCandidates.js +132 -0
- package/dist/phase/secretCandidates.js.map +1 -0
- package/dist/phase/securityCandidates.d.ts +29 -0
- package/dist/phase/securityCandidates.d.ts.map +1 -0
- package/dist/phase/securityCandidates.js +469 -0
- package/dist/phase/securityCandidates.js.map +1 -0
- package/dist/phase/seeded-defects.d.ts +18 -0
- package/dist/phase/seeded-defects.d.ts.map +1 -0
- package/dist/phase/seeded-defects.js +61 -0
- package/dist/phase/seeded-defects.js.map +1 -0
- package/dist/phase/stringLiterals.d.ts +24 -0
- package/dist/phase/stringLiterals.d.ts.map +1 -0
- package/dist/phase/stringLiterals.js +35 -0
- package/dist/phase/stringLiterals.js.map +1 -0
- package/dist/phase/stylesCss.d.ts +25 -0
- package/dist/phase/stylesCss.d.ts.map +1 -0
- package/dist/phase/stylesCss.js +34 -0
- package/dist/phase/stylesCss.js.map +1 -0
- package/dist/phase/stylesMarkup.d.ts +31 -0
- package/dist/phase/stylesMarkup.d.ts.map +1 -0
- package/dist/phase/stylesMarkup.js +48 -0
- package/dist/phase/stylesMarkup.js.map +1 -0
- package/dist/phase/stylesSource.d.ts +36 -0
- package/dist/phase/stylesSource.d.ts.map +1 -0
- package/dist/phase/stylesSource.js +50 -0
- package/dist/phase/stylesSource.js.map +1 -0
- package/dist/phase/typeDeclarations.d.ts +33 -0
- package/dist/phase/typeDeclarations.d.ts.map +1 -0
- package/dist/phase/typeDeclarations.js +76 -0
- package/dist/phase/typeDeclarations.js.map +1 -0
- package/dist/phase/types.d.ts +2191 -0
- package/dist/phase/types.d.ts.map +1 -0
- package/dist/phase/types.js +27 -0
- package/dist/phase/types.js.map +1 -0
- package/dist/phase/withinFileProvenance.d.ts +50 -0
- package/dist/phase/withinFileProvenance.d.ts.map +1 -0
- package/dist/phase/withinFileProvenance.js +112 -0
- package/dist/phase/withinFileProvenance.js.map +1 -0
- package/dist/pipeline.d.ts +37 -30
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +131 -326
- package/dist/pipeline.js.map +1 -1
- package/dist/pipelineAdapters.d.ts +104 -21
- package/dist/pipelineAdapters.d.ts.map +1 -1
- package/dist/pipelineAdapters.js +1144 -984
- package/dist/pipelineAdapters.js.map +1 -1
- package/dist/pipelineTypes.d.ts +21 -0
- package/dist/pipelineTypes.d.ts.map +1 -1
- package/dist/pipelineTypes.js +21 -10
- package/dist/pipelineTypes.js.map +1 -1
- package/dist/presets/presets.d.ts +9 -2
- package/dist/presets/presets.d.ts.map +1 -1
- package/dist/presets/presets.js +15 -26
- package/dist/presets/presets.js.map +1 -1
- package/dist/reporting/csvReportGenerator.d.ts +14 -3
- package/dist/reporting/csvReportGenerator.d.ts.map +1 -1
- package/dist/reporting/csvReportGenerator.js +14 -3
- package/dist/reporting/csvReportGenerator.js.map +1 -1
- package/dist/reporting/htmlReportGenerator.d.ts +5 -1
- package/dist/reporting/htmlReportGenerator.d.ts.map +1 -1
- package/dist/reporting/htmlReportGenerator.js +5 -1
- package/dist/reporting/htmlReportGenerator.js.map +1 -1
- package/dist/reporting/jsonReportGenerator.d.ts +9 -2
- package/dist/reporting/jsonReportGenerator.d.ts.map +1 -1
- package/dist/reporting/jsonReportGenerator.js +19 -5
- package/dist/reporting/jsonReportGenerator.js.map +1 -1
- package/dist/reporting/reportGenerator.d.ts +9 -2
- package/dist/reporting/reportGenerator.d.ts.map +1 -1
- package/dist/reporting/reportGenerator.js +9 -2
- package/dist/reporting/reportGenerator.js.map +1 -1
- package/dist/reporting/sarifReportGenerator.d.ts +14 -0
- package/dist/reporting/sarifReportGenerator.d.ts.map +1 -1
- package/dist/reporting/sarifReportGenerator.js +14 -0
- package/dist/reporting/sarifReportGenerator.js.map +1 -1
- package/dist/reporting/sizeDistribution.d.ts +19 -2
- package/dist/reporting/sizeDistribution.d.ts.map +1 -1
- package/dist/reporting/sizeDistribution.js +23 -5
- package/dist/reporting/sizeDistribution.js.map +1 -1
- package/dist/ruleAliases.d.ts +6 -8
- package/dist/ruleAliases.d.ts.map +1 -1
- package/dist/ruleAliases.js +29 -4
- package/dist/ruleAliases.js.map +1 -1
- package/dist/search/QueryParser.d.ts +1 -0
- package/dist/search/QueryParser.d.ts.map +1 -1
- package/dist/search/QueryParser.js +32 -91
- package/dist/search/QueryParser.js.map +1 -1
- package/dist/services/CodeMapGenerator.d.ts +19 -20
- package/dist/services/CodeMapGenerator.d.ts.map +1 -1
- package/dist/services/CodeMapGenerator.js +214 -194
- package/dist/services/CodeMapGenerator.js.map +1 -1
- package/dist/services/ProjectTaskRepository.d.ts +65 -3
- package/dist/services/ProjectTaskRepository.d.ts.map +1 -1
- package/dist/services/ProjectTaskRepository.js +94 -25
- package/dist/services/ProjectTaskRepository.js.map +1 -1
- package/dist/services/auditJobService.d.ts +17 -1
- package/dist/services/auditJobService.d.ts.map +1 -1
- package/dist/services/auditJobService.js +16 -0
- package/dist/services/auditJobService.js.map +1 -1
- package/dist/services/fileAccounting.d.ts +43 -5
- package/dist/services/fileAccounting.d.ts.map +1 -1
- package/dist/services/fileAccounting.js +48 -9
- package/dist/services/fileAccounting.js.map +1 -1
- package/dist/services/projectTaskHelpers.d.ts +45 -0
- package/dist/services/projectTaskHelpers.d.ts.map +1 -1
- package/dist/services/projectTaskHelpers.js +45 -0
- package/dist/services/projectTaskHelpers.js.map +1 -1
- package/dist/services/whitelistService.d.ts +40 -5
- package/dist/services/whitelistService.d.ts.map +1 -1
- package/dist/services/whitelistService.js +87 -46
- package/dist/services/whitelistService.js.map +1 -1
- package/dist/sqlite/betterSqlite3.d.ts +35 -1
- package/dist/sqlite/betterSqlite3.d.ts.map +1 -1
- package/dist/sqlite/betterSqlite3.js +35 -1
- package/dist/sqlite/betterSqlite3.js.map +1 -1
- package/dist/sqlite/driver.d.ts +23 -0
- package/dist/sqlite/driver.d.ts.map +1 -1
- package/dist/sqlite/driver.js +23 -0
- package/dist/sqlite/driver.js.map +1 -1
- package/dist/sqlite/nodeSqlite.d.ts +35 -1
- package/dist/sqlite/nodeSqlite.d.ts.map +1 -1
- package/dist/sqlite/nodeSqlite.js +35 -1
- package/dist/sqlite/nodeSqlite.js.map +1 -1
- package/dist/structuralSignature.d.ts +9 -0
- package/dist/structuralSignature.d.ts.map +1 -1
- package/dist/structuralSignature.js +9 -0
- package/dist/structuralSignature.js.map +1 -1
- package/dist/styles/cssAstExtractor.d.ts +15 -0
- package/dist/styles/cssAstExtractor.d.ts.map +1 -1
- package/dist/styles/cssAstExtractor.js +15 -0
- package/dist/styles/cssAstExtractor.js.map +1 -1
- package/dist/styles/normalizer.d.ts +6 -0
- package/dist/styles/normalizer.d.ts.map +1 -1
- package/dist/styles/normalizer.js +6 -0
- package/dist/styles/normalizer.js.map +1 -1
- package/dist/styles/styleExtractor.d.ts +29 -2
- package/dist/styles/styleExtractor.d.ts.map +1 -1
- package/dist/styles/styleExtractor.js +67 -48
- package/dist/styles/styleExtractor.js.map +1 -1
- package/dist/styles/styleIndexer.d.ts +8 -0
- package/dist/styles/styleIndexer.d.ts.map +1 -1
- package/dist/styles/styleIndexer.js +135 -138
- package/dist/styles/styleIndexer.js.map +1 -1
- package/dist/styles/tailwindConfigLoader.d.ts +12 -0
- package/dist/styles/tailwindConfigLoader.d.ts.map +1 -1
- package/dist/styles/tailwindConfigLoader.js +12 -0
- package/dist/styles/tailwindConfigLoader.js.map +1 -1
- package/dist/styles/tailwindExpander.d.ts +3 -0
- package/dist/styles/tailwindExpander.d.ts.map +1 -1
- package/dist/styles/tailwindExpander.js +8 -4
- package/dist/styles/tailwindExpander.js.map +1 -1
- package/dist/styles/tailwindProbe.d.ts +9 -0
- package/dist/styles/tailwindProbe.d.ts.map +1 -1
- package/dist/styles/tailwindProbe.js +181 -166
- package/dist/styles/tailwindProbe.js.map +1 -1
- package/dist/styles/tailwindUtilityExpander.d.ts +13 -0
- package/dist/styles/tailwindUtilityExpander.d.ts.map +1 -1
- package/dist/styles/tailwindUtilityExpander.js +13 -0
- package/dist/styles/tailwindUtilityExpander.js.map +1 -1
- package/dist/symbols.d.ts +13 -11
- package/dist/symbols.d.ts.map +1 -1
- package/dist/symbols.js +14 -21
- package/dist/symbols.js.map +1 -1
- package/dist/telemetry.d.ts +31 -3
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +31 -3
- package/dist/telemetry.js.map +1 -1
- package/dist/tool-registry.d.ts +37 -1
- package/dist/tool-registry.d.ts.map +1 -1
- package/dist/tool-registry.js +37 -1
- package/dist/tool-registry.js.map +1 -1
- package/dist/types.d.ts +101 -71
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -16
- package/dist/types.js.map +1 -1
- package/dist/ui/InteractivePrompts.d.ts +12 -0
- package/dist/ui/InteractivePrompts.d.ts.map +1 -1
- package/dist/ui/InteractivePrompts.js +12 -0
- package/dist/ui/InteractivePrompts.js.map +1 -1
- package/dist/utils/astParser.d.ts +15 -0
- package/dist/utils/astParser.d.ts.map +1 -1
- package/dist/utils/astParser.js +15 -0
- package/dist/utils/astParser.js.map +1 -1
- package/dist/utils/astUtils.d.ts +60 -0
- package/dist/utils/astUtils.d.ts.map +1 -1
- package/dist/utils/astUtils.js +350 -362
- package/dist/utils/astUtils.js.map +1 -1
- package/dist/utils/contentHash.d.ts +22 -0
- package/dist/utils/contentHash.d.ts.map +1 -0
- package/dist/utils/contentHash.js +26 -0
- package/dist/utils/contentHash.js.map +1 -0
- package/dist/utils/dependencyExtractor.d.ts +28 -0
- package/dist/utils/dependencyExtractor.d.ts.map +1 -1
- package/dist/utils/dependencyExtractor.js +28 -1
- package/dist/utils/dependencyExtractor.js.map +1 -1
- package/dist/utils/errorMessage.d.ts +10 -0
- package/dist/utils/errorMessage.d.ts.map +1 -0
- package/dist/utils/errorMessage.js +12 -0
- package/dist/utils/errorMessage.js.map +1 -0
- package/dist/utils/fileDiscovery.d.ts +61 -2
- package/dist/utils/fileDiscovery.d.ts.map +1 -1
- package/dist/utils/fileDiscovery.js +131 -23
- package/dist/utils/fileDiscovery.js.map +1 -1
- package/dist/utils/reactDetection.d.ts +34 -5
- package/dist/utils/reactDetection.d.ts.map +1 -1
- package/dist/utils/reactDetection.js +73 -52
- package/dist/utils/reactDetection.js.map +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/workers/auditWorker.js +7 -3
- package/dist/workers/auditWorker.js.map +1 -1
- package/examples/.auditrc.example.json +0 -8
- package/examples/.auditrc.json +0 -11
- package/examples/.code-auditor.json +0 -2
- package/examples/nextjs.auditrc.json +0 -8
- package/examples/node-api.auditrc.json +0 -7
- package/examples/react.auditrc.json +0 -6
- package/examples/tolerant-solid.auditrc.json +0 -5
- package/package.json +11 -5
- package/plugin/.claude-plugin/manifest.json +16 -0
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +6 -2
- package/plugin/scripts/hook-audit.sh +41 -14
- package/plugin/scripts/hook-common.sh +50 -5
- package/plugin/scripts/hook-drift-check.sh +72 -0
- package/plugin/scripts/hook-self-audit.sh +17 -12
- package/plugin/skills/code-auditor/SKILL.md +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,2191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec 68 — the phase model's type system.
|
|
3
|
+
*
|
|
4
|
+
* Three strictly-ordered phases (Parse → Process → Analyze) are made real by
|
|
5
|
+
* these types. The central move: a rule no longer *selects* an analyzer or an
|
|
6
|
+
* input; it *declares* what it needs, and that declaration is load-bearing —
|
|
7
|
+
* it drives the schedule (§5), the coverage states (§8), and the compile-time
|
|
8
|
+
* residue checks (§2.3 / §3.1 / §4).
|
|
9
|
+
*
|
|
10
|
+
* This file is types only. No runtime value here (except the mapped-type and
|
|
11
|
+
* assertion declarations that TypeScript erases). The producers live in
|
|
12
|
+
* `producers.ts`; the consumed-set derivation and the residue/serializability
|
|
13
|
+
* assertions live in `checks.ts`.
|
|
14
|
+
*
|
|
15
|
+
* A tree-sitter tree (or any AST) is deliberately absent from every type a
|
|
16
|
+
* rule can reach. `FactShapes['ast']` is `never` and `FactKind` excludes it —
|
|
17
|
+
* a rule cannot even name `ast` in its `needs.facts`, so a tree cannot cross a
|
|
18
|
+
* phase boundary by construction.
|
|
19
|
+
*
|
|
20
|
+
* Fact shapes are `type` aliases (object-literal types), not `interface`s:
|
|
21
|
+
* §4's serializability assertion checks `FactShapes[K] extends Serializable`,
|
|
22
|
+
* and TypeScript gives object-literal `type`s — but not `interface`s — the
|
|
23
|
+
* implicit index signature that makes a plain-data shape satisfiable against
|
|
24
|
+
* `Serializable`'s `{ readonly [k: string]: Serializable }` arm.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The single namespace of fact kinds. Adding a kind here without a producer in
|
|
28
|
+
* {@link PRODUCERS} (producers.ts) fails compilation at the residue check.
|
|
29
|
+
*
|
|
30
|
+
* Each shape is a serializable value (§4): plain data, no functions, no class
|
|
31
|
+
* instances, no handles, no `Date`. Where the processor migration (§3.2) pins
|
|
32
|
+
* a shape more precisely than this initial declaration, it narrows the type —
|
|
33
|
+
* the serializability assertion is the guardrail that keeps any such narrowing
|
|
34
|
+
* honest.
|
|
35
|
+
*/
|
|
36
|
+
import type { AST, LanguageAdapter } from '../languages/types.js';
|
|
37
|
+
import type { IndexHandle } from '../types.js';
|
|
38
|
+
import type { DdlForeignKey } from '../analyzers/universal/schema/migrations.js';
|
|
39
|
+
import type { ProvenanceReason } from '../analyzers/provenance.js';
|
|
40
|
+
import type { TsExpressionDescriptor, PropagationRule, ClassCall } from '../analyzers/tsExpressionDescriptor.js';
|
|
41
|
+
import type { BindingKind, ImportKind, ValueDescriptor } from '../analyzers/receiverRoot.js';
|
|
42
|
+
import type { HandleVerdict } from '../analyzers/handleIdentification.js';
|
|
43
|
+
import type { Dialect } from '../mcp-tools/discoveryQueries.js';
|
|
44
|
+
import type { UnresolvedQuery } from '../analyzers/universal/schema/codeAnalysis.js';
|
|
45
|
+
export interface FactShapes {
|
|
46
|
+
/** Reserved: an AST is not a fact and cannot be declared. */
|
|
47
|
+
ast: never;
|
|
48
|
+
'file-symbols': FileSymbols[];
|
|
49
|
+
'function-index': FunctionIndexFact[];
|
|
50
|
+
'query-sites': QuerySiteFact[];
|
|
51
|
+
'query-site-candidates': QuerySiteCandidatesFact[];
|
|
52
|
+
'imports': ImportFact[];
|
|
53
|
+
'import-specifiers': ImportSpecifiersFact[];
|
|
54
|
+
'export-symbols': ExportSymbolFact[];
|
|
55
|
+
'export-form': ExportFormFact[];
|
|
56
|
+
'import-form': ImportFormFact[];
|
|
57
|
+
'string-literals': StringLiteralFact[];
|
|
58
|
+
'secret-candidates': SecretCandidate[];
|
|
59
|
+
'security-candidates': SecurityCandidate[];
|
|
60
|
+
'ddl-declarations': SchemaDeclaration[];
|
|
61
|
+
'schema-usage': SchemaUsageFact[];
|
|
62
|
+
'schema-usage-candidates': SchemaUsageCandidatesFact[];
|
|
63
|
+
'schema-objects': SchemaObject[];
|
|
64
|
+
'style-declarations': StyleDeclarationsFile[];
|
|
65
|
+
'color-values': ColorValuesFact[];
|
|
66
|
+
'cross-language-entities': Entity[];
|
|
67
|
+
'data-access-calls': ResolvedQuery[];
|
|
68
|
+
'data-access-calls-candidates': DataAccessCallCandidate[];
|
|
69
|
+
'loop-queries': LoopQueryFact[];
|
|
70
|
+
'loop-query-candidates': LoopQueryRawCandidate[];
|
|
71
|
+
'dynamic-sql': DynamicSqlFact[];
|
|
72
|
+
'resolution': ResolutionFact;
|
|
73
|
+
'migration-history': MigrationHistory;
|
|
74
|
+
'mined-conventions': MinedConvention[];
|
|
75
|
+
'react-component': ReactComponentScan[];
|
|
76
|
+
'file-header': FileHeaderFact[];
|
|
77
|
+
'code-block': CodeBlockFact[];
|
|
78
|
+
'json-document': JsonDocumentFact[];
|
|
79
|
+
'schema-validations': SchemaValidationFact[];
|
|
80
|
+
'file-imports': FileImportsFact[];
|
|
81
|
+
'reachability': ReachabilityFact;
|
|
82
|
+
'type-declarations': TypeDeclarationsFact[];
|
|
83
|
+
'go-functions': GoFunctionFact[];
|
|
84
|
+
'go-switches': GoSwitchFact[];
|
|
85
|
+
'error-bindings': ErrorBindingsFact[];
|
|
86
|
+
'concurrency-primitives': ConcurrencyPrimitivesFact[];
|
|
87
|
+
'channel-operations': ChannelOperationsFact[];
|
|
88
|
+
'go-package-bindings': GoPackageBindingFact[];
|
|
89
|
+
'within-file-provenance': WithinFileProvenanceFact[];
|
|
90
|
+
'receiver-activity': ReceiverActivityFact[];
|
|
91
|
+
'receiver-provenance': ReceiverProvenanceFact;
|
|
92
|
+
'call-graph': CallGraphFact;
|
|
93
|
+
'batch-functions': BatchFunctionFact[];
|
|
94
|
+
'hotspot': HotspotFact[];
|
|
95
|
+
'coverage': CoverageFact;
|
|
96
|
+
'clone-pair-history': ClonePairHistoryFact;
|
|
97
|
+
'defined-classes': DefinedClassesFact[];
|
|
98
|
+
'unread-style-sources': UnreadStyleSourceFact[];
|
|
99
|
+
}
|
|
100
|
+
/** Every fact kind a rule or processor may declare. `ast` is excluded. */
|
|
101
|
+
export type FactKind = Exclude<keyof FactShapes, 'ast'>;
|
|
102
|
+
/**
|
|
103
|
+
* The file formats the phase model reads.
|
|
104
|
+
*
|
|
105
|
+
* `'json'` was added in Amendment 1 of the fact-vocabulary pass: a JSON file is
|
|
106
|
+
* a *format* like any other, parsed by a position-preserving JSON adapter, so
|
|
107
|
+
* the `declared-schemas` / `schema-validations` rules go through the same
|
|
108
|
+
* per-file model as every other rule instead of reading `.json` files off disk
|
|
109
|
+
* through a config callback.
|
|
110
|
+
*
|
|
111
|
+
* `'sql'` is the one text-only format: a `.sql` migration file has no grammar
|
|
112
|
+
* and no adapter, so its `ParsedFile` carries no `ast`/`adapter`. It supplies
|
|
113
|
+
* exactly one fact (`ddl-declarations`) whose producer reads `.source`/`.file`
|
|
114
|
+
* only — the whole file *is* DDL, unlike code where DDL is embedded in string/
|
|
115
|
+
* template literals.
|
|
116
|
+
*
|
|
117
|
+
* `'markup'` is the second text-only format: an `.astro`/`.vue`/`.svelte`/
|
|
118
|
+
* `.html` component has no grammar or adapter either (the language registry only
|
|
119
|
+
* resolves TS/JS/Go/CSS/JSON), so its `ParsedFile` likewise carries no
|
|
120
|
+
* `ast`/`adapter`. It supplies the `style-declarations` fact via the same regex
|
|
121
|
+
* extractors the legacy style indexer ran (`extractDeclarations`' markup branch +
|
|
122
|
+
* `extractClassUsage`), so class usage and embedded `<style>` declarations from
|
|
123
|
+
* component files survive the phase-model migration — otherwise `undefined-class`
|
|
124
|
+
* would lose every markup finding.
|
|
125
|
+
*/
|
|
126
|
+
export type Format = 'typescript' | 'tsx' | 'javascript' | 'go' | 'css' | 'scss' | 'json' | 'sql' | 'markup';
|
|
127
|
+
/** A rule's declaration: the formats it can evaluate and the facts it reads. */
|
|
128
|
+
export interface Needs {
|
|
129
|
+
readonly formats: readonly Format[];
|
|
130
|
+
readonly facts: readonly FactKind[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* One symbol extracted from a parsed file by the per-file symbol processor.
|
|
134
|
+
*
|
|
135
|
+
* The shape is the *serializable projection* of the adapter's `FunctionInfo` /
|
|
136
|
+
* `ClassInfo` / `InterfaceInfo`, plus every metric a symbol-level rule needs —
|
|
137
|
+
* computed in the processor, where the AST lives, so that `analyze` is pure
|
|
138
|
+
* threshold comparison over plain data. No tree-sitter node survives here: a
|
|
139
|
+
* node carries methods and cannot satisfy §4's `Serializable` arm.
|
|
140
|
+
*
|
|
141
|
+
* The name is plural (inherited from the spec's `FactShapes` key) but each
|
|
142
|
+
* element is ONE symbol; `FactShapes['file-symbols']` is the corpus-wide array
|
|
143
|
+
* of them, and a per-file processor returns the subset for its one file.
|
|
144
|
+
*
|
|
145
|
+
* §3.2 vertical slice (this landing's first fact kind) migrates the SOLID
|
|
146
|
+
* rules onto the `function`/`class`/`interface` arms; `concernGroups`,
|
|
147
|
+
* `instanceofTargets`, `throws` and `aggregateComplexity` are the pre-computed
|
|
148
|
+
* signals those rules used to walk the AST to obtain. `jsDoc` (the comment
|
|
149
|
+
* *text*, not a boolean) and
|
|
150
|
+
* `returnType` serve the documentation rules; the DRY / security / react rules
|
|
151
|
+
* that currently declare `file-symbols` are re-declared against their own facts
|
|
152
|
+
* in the "repeat for the other twelve" step, not served by this shape.
|
|
153
|
+
*/
|
|
154
|
+
export type FileSymbols = FileFunctionSymbol | FileClassSymbol | FileInterfaceSymbol;
|
|
155
|
+
/** A method, as a class symbol carries it (metrics pre-computed at process time). */
|
|
156
|
+
export type FileMethodSymbol = {
|
|
157
|
+
name: string;
|
|
158
|
+
line: number;
|
|
159
|
+
column?: number;
|
|
160
|
+
parameterCount: number;
|
|
161
|
+
parameterNames: string[];
|
|
162
|
+
lineCount: number;
|
|
163
|
+
complexity: number;
|
|
164
|
+
/** True when the method body contains a `throw` (LSP override signal). */
|
|
165
|
+
throws: boolean;
|
|
166
|
+
/** Voting concern-group labels (empty = single-purpose); SRP reads these. */
|
|
167
|
+
concernGroups: string[];
|
|
168
|
+
/** JSDoc comment text, or null when absent (method-documentation reads it). */
|
|
169
|
+
jsDoc: string | null;
|
|
170
|
+
/** True when private/protected/#-named/_-prefixed (R1.2 non-public skip). */
|
|
171
|
+
isNonPublic: boolean;
|
|
172
|
+
/** Return-type annotation (return-documentation reads this). */
|
|
173
|
+
returnType?: string;
|
|
174
|
+
};
|
|
175
|
+
/** A standalone function (or a method surfaced outside its class for size rules). */
|
|
176
|
+
export type FileFunctionSymbol = {
|
|
177
|
+
kind: 'function';
|
|
178
|
+
file: string;
|
|
179
|
+
name: string;
|
|
180
|
+
/** Set when this function is a method; empty/absent for a free function. */
|
|
181
|
+
className?: string;
|
|
182
|
+
line: number;
|
|
183
|
+
column?: number;
|
|
184
|
+
endLine: number;
|
|
185
|
+
isExported?: boolean;
|
|
186
|
+
isAsync?: boolean;
|
|
187
|
+
parameterCount: number;
|
|
188
|
+
parameterNames: string[];
|
|
189
|
+
lineCount: number;
|
|
190
|
+
complexity: number;
|
|
191
|
+
/** Voting concern-group labels (empty = single-purpose); SRP reads these. */
|
|
192
|
+
concernGroups: string[];
|
|
193
|
+
/** JSDoc comment text, or null when absent (documentation rules read it). */
|
|
194
|
+
jsDoc: string | null;
|
|
195
|
+
/** Return-type annotation (return-documentation reads this). */
|
|
196
|
+
returnType?: string;
|
|
197
|
+
/** True when an anonymous/inline callable (arrow or function expression used
|
|
198
|
+
* as a call argument, JSX value, or IIFE) — R1.1 skip. */
|
|
199
|
+
isAnonymousOrCallback: boolean;
|
|
200
|
+
};
|
|
201
|
+
/** A class, with its methods and the class-level signals pre-computed. */
|
|
202
|
+
export type FileClassSymbol = {
|
|
203
|
+
kind: 'class';
|
|
204
|
+
file: string;
|
|
205
|
+
name: string;
|
|
206
|
+
line: number;
|
|
207
|
+
column?: number;
|
|
208
|
+
isExported?: boolean;
|
|
209
|
+
extends?: string;
|
|
210
|
+
/** The interface names this class `implements`, resolved in-repo by the
|
|
211
|
+
* resolution fact (Spec 69 R3 — class → what it implements). */
|
|
212
|
+
implements?: string[];
|
|
213
|
+
methodCount: number;
|
|
214
|
+
/** Σ of method cyclomatic complexity (class-size's second threshold). */
|
|
215
|
+
aggregateComplexity: number;
|
|
216
|
+
/** The non-builtin `instanceof` target names in the class body (open-closed
|
|
217
|
+
* resolves these against repo declarations to skip Error subclasses). */
|
|
218
|
+
instanceofTargets: string[];
|
|
219
|
+
methods: FileMethodSymbol[];
|
|
220
|
+
/** JSDoc comment text, or null when absent (class-documentation reads it). */
|
|
221
|
+
jsDoc: string | null;
|
|
222
|
+
};
|
|
223
|
+
/** An interface, with the member-count / method-member signals pre-computed. */
|
|
224
|
+
export type FileInterfaceSymbol = {
|
|
225
|
+
kind: 'interface';
|
|
226
|
+
file: string;
|
|
227
|
+
name: string;
|
|
228
|
+
line: number;
|
|
229
|
+
column?: number;
|
|
230
|
+
/** The interface names this interface `extends`, resolved in-repo by the
|
|
231
|
+
* resolution fact (Spec 69 R3 — interface → what it extends). */
|
|
232
|
+
extends?: string[];
|
|
233
|
+
memberCount: number;
|
|
234
|
+
/** True when any member is a method signature (interface-size's discriminator). */
|
|
235
|
+
hasMethodMembers: boolean;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* One function/method/component row, as the `function-index` producer extracts
|
|
239
|
+
* it (§3.2 re-homes `createFunctionIndexVisitor`). This is the serializable
|
|
240
|
+
* projection of the visitor's `FunctionIndexEntry`, widened with the fields the
|
|
241
|
+
* conventions rules read that were previously fetched from the DB:
|
|
242
|
+
* `entityType`/`componentType` (naming's `NamingFunctionRow`) and
|
|
243
|
+
* `functionCalls` (usage-pair's `FunctionCallRow`). The DB-assigned `id` is
|
|
244
|
+
* dropped — a function's identity is `(file, name, line)`, which is what the
|
|
245
|
+
* diff-scoped content hash keys on. `is_exported` is a boolean here, not the
|
|
246
|
+
* DB's 0/1.
|
|
247
|
+
*/
|
|
248
|
+
export type FunctionIndexFact = {
|
|
249
|
+
file: string;
|
|
250
|
+
name: string;
|
|
251
|
+
line: number;
|
|
252
|
+
endLine: number;
|
|
253
|
+
entityType: 'function' | 'method' | 'component';
|
|
254
|
+
componentType: string | null;
|
|
255
|
+
isExported: boolean;
|
|
256
|
+
complexity: number;
|
|
257
|
+
body: string | null;
|
|
258
|
+
functionCalls: string[];
|
|
259
|
+
/** The imported local names this function's body uses, in first-use order —
|
|
260
|
+
* the phase-parse equivalent of `functions.used_imports` (Item 4 2b). Computed
|
|
261
|
+
* by `extractIdentifierUsage(node, source, importNames)` over the same
|
|
262
|
+
* `importNames` set the functionScanner sync path built, so it reproduces the
|
|
263
|
+
* identifier-usage analysis that previously only `index.sync` produced. */
|
|
264
|
+
usedImports: string[];
|
|
265
|
+
language: string;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* One DB-query site, the serializable projection of the located query-site scan
|
|
269
|
+
* (`extractQuerySiteOffsets` over the raw source). Each site is attributed to its
|
|
270
|
+
* innermost enclosing function — `functionLine`/`functionColumn` are the
|
|
271
|
+
* enclosing function's 1-based start coordinate, `null` when the site is
|
|
272
|
+
* top-level (outside any function). `method` is the query mechanism label
|
|
273
|
+
* (`run`/`query`/`all`/`exec`/`SELECT`/…). A function's query count is then the
|
|
274
|
+
* number of sites whose enclosing function is that function — a relation that
|
|
275
|
+
* cannot double-count a nested closure by construction (Spec 69 R2).
|
|
276
|
+
*/
|
|
277
|
+
export type QuerySiteFact = {
|
|
278
|
+
file: string;
|
|
279
|
+
/** Query site's 1-based start line. */
|
|
280
|
+
line: number;
|
|
281
|
+
/** Query site's 1-based start column. */
|
|
282
|
+
column: number;
|
|
283
|
+
/** Query mechanism label (`run`, `query`, `all`, `exec`, `SELECT`, …). */
|
|
284
|
+
method: string;
|
|
285
|
+
/** Enclosing function's 1-based start line, or null when top-level. */
|
|
286
|
+
functionLine: number | null;
|
|
287
|
+
/** Enclosing function's 1-based start column, or null when top-level. */
|
|
288
|
+
functionColumn: number | null;
|
|
289
|
+
/** Enclosing function's declaration name, or null when anonymous/top-level. */
|
|
290
|
+
functionName: string | null;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* One file's un-gated query-site candidates — the raw, provenance-free extract
|
|
294
|
+
* the corpus `query-sites` producer re-gates (Spec 70 Item 4, step 3). The
|
|
295
|
+
* `query-sites` producer splits: the *sites* (attributed to their enclosing
|
|
296
|
+
* function) are extracted here while the AST lives, because `extractQuerySiteOffsets`
|
|
297
|
+
* + `extractFunctions` need the tree; the *gate* (glob || dbProvenanced ||
|
|
298
|
+
* dbActivity || hasSqlTag) is applied corpus-side once the `receiver-provenance`
|
|
299
|
+
* fixed point supplies the cross-file seed. `hasSqlTag` is the one gate input a
|
|
300
|
+
* corpus producer cannot re-derive (it scans source text), so it is projected
|
|
301
|
+
* here; `dbActivity` travels in `receiver-activity` and `dbProvenanced` is
|
|
302
|
+
* re-derived by `classifyBuildProvenance`. Emits one fragment per TS-family file
|
|
303
|
+
* (null-or-value, like `receiver-activity`), so a file with no sites still marks
|
|
304
|
+
* its presence for the corpus producer.
|
|
305
|
+
*/
|
|
306
|
+
export type QuerySiteCandidatesFact = {
|
|
307
|
+
readonly file: string;
|
|
308
|
+
readonly sites: readonly QuerySiteFact[];
|
|
309
|
+
readonly hasSqlTag: boolean;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* One import statement, the serializable projection of the adapter's
|
|
313
|
+
* `ImportInfo` (types.ts) — `source` plus the 1-based start position. The
|
|
314
|
+
* `duplicate-import` rule groups by `(file, source)`: the legacy
|
|
315
|
+
* `checkDuplicateImports` ran per AST, so two files importing the same module
|
|
316
|
+
* once are NOT duplicates — only repeats within one file are. `specifiers` is
|
|
317
|
+
* not projected (no migrated rule reads it; `conventions/import-form`, which
|
|
318
|
+
* does, stays on the legacy path and reads source text via `parseFileImports`).
|
|
319
|
+
*
|
|
320
|
+
* `alias` is the Go local import name (`import f "os"` → `f`, `import . "x"` →
|
|
321
|
+
* `.`, `import _ "embed"` → `_`), `null`/absent for an unnamed import. The
|
|
322
|
+
* Go `import-style` rule reads `alias === '.'` (dot-import detection); the
|
|
323
|
+
* TypeScript producers leave it absent (TS has no Go-style local name — its
|
|
324
|
+
* import shape is `import-form`'s concern).
|
|
325
|
+
*/
|
|
326
|
+
export type ImportFact = {
|
|
327
|
+
file: string;
|
|
328
|
+
source: string;
|
|
329
|
+
line: number;
|
|
330
|
+
column: number;
|
|
331
|
+
alias?: string | null;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* One import statement's full specifier detail — the serializable projection of
|
|
335
|
+
* the adapter's `extractImports` (`ImportInfo[]`) that the cross-file
|
|
336
|
+
* receiver-provenance fixed point (Spec 70 Item 4, 2a) reads. The existing
|
|
337
|
+
* `imports` fact drops `name`/`isDefault`/`isNamespace` and collapses the
|
|
338
|
+
* specifier list to one row per statement (it serves `duplicate-import`, which
|
|
339
|
+
* only groups by `(file, source)`); this fact keeps every specifier so the fixed
|
|
340
|
+
* point can resolve which local binding is a namespace/default/named import of a
|
|
341
|
+
* DB-provenanced re-export. `location` is dropped — the fixed point keys by
|
|
342
|
+
* `source` + specifier, never position.
|
|
343
|
+
*/
|
|
344
|
+
export type ImportSpecifierDetail = {
|
|
345
|
+
name: string;
|
|
346
|
+
alias?: string;
|
|
347
|
+
isDefault: boolean;
|
|
348
|
+
isNamespace: boolean;
|
|
349
|
+
};
|
|
350
|
+
export type ImportSpecifiersFact = {
|
|
351
|
+
file: string;
|
|
352
|
+
source: string;
|
|
353
|
+
specifiers: ImportSpecifierDetail[];
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* One import statement's *form*, the serializable projection of
|
|
357
|
+
* `parseFileImports` (conventionMiner.ts) that `conventions/import-form` reads:
|
|
358
|
+
* the module source plus the classified import shape (`default` / `named` /
|
|
359
|
+
* `namespace` / `side-effect` / `require`) and the 1-based line the finding
|
|
360
|
+
* anchors to. This is deliberately NOT derivable from the AST `imports` fact —
|
|
361
|
+
* `conventions/import-form`'s legacy detector ran the regex `parseFileImports`
|
|
362
|
+
* over raw source text (which classifies forms like `default`-plus-`named` and
|
|
363
|
+
* `require` destructuring the AST extractor does not), so the producer re-runs
|
|
364
|
+
* that same regex over `file.source` to stay byte-identical. `localNames` is
|
|
365
|
+
* dropped: the legacy finding carried it only in `details`, which the unified
|
|
366
|
+
* `Finding` shape has no field for.
|
|
367
|
+
*/
|
|
368
|
+
export type ImportFormFact = {
|
|
369
|
+
file: string;
|
|
370
|
+
source: string;
|
|
371
|
+
form: 'default' | 'named' | 'namespace' | 'side-effect' | 'require';
|
|
372
|
+
line: number;
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* One export declaration, the serializable projection of the adapter's
|
|
376
|
+
* `extractExports` (`ExportInfo[]`) that `conventions/export-shape` reads: the
|
|
377
|
+
* exported name plus whether it is a default export. The `location` the adapter
|
|
378
|
+
* returns is dropped — the export-shape finding anchors to the *function*'s
|
|
379
|
+
* `function-index` line, never the export statement's, so position is a key the
|
|
380
|
+
* rule does not read. One element per `export_statement` (the producer walks
|
|
381
|
+
* `extractExports` in source order, matching the legacy `exportsMap` built from
|
|
382
|
+
* the same adapter call).
|
|
383
|
+
*/
|
|
384
|
+
export type ExportFormFact = {
|
|
385
|
+
file: string;
|
|
386
|
+
name: string;
|
|
387
|
+
isDefault: boolean;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* One exported symbol, the serializable projection of `collectExports`
|
|
391
|
+
* (receiverResolution.ts) that the cross-file receiver-provenance fixed point
|
|
392
|
+
* (Spec 70 Item 4, 2a) reads. Unlike `export-form` — which drops re-export
|
|
393
|
+
* `source` and the star re-export (`export * from '…'`), and emits only the
|
|
394
|
+
* first name of a multi-name clause — this fact keeps the *complete* export set
|
|
395
|
+
* the fixed point resolves against: `name` (including `'*'`), the re-export
|
|
396
|
+
* `source` when present, and `isDefault`. It calls the exact `collectExports`
|
|
397
|
+
* the legacy `resolveCorpusReceivers` used, so the export set is byte-identical
|
|
398
|
+
* by construction, not re-implemented.
|
|
399
|
+
*/
|
|
400
|
+
export type ExportSymbolFact = {
|
|
401
|
+
file: string;
|
|
402
|
+
name: string;
|
|
403
|
+
/** The re-export source (`export … from '…'`); absent for a local export. */
|
|
404
|
+
source?: string;
|
|
405
|
+
isDefault: boolean;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* One string or template-string literal, the serializable projection of its
|
|
409
|
+
* node: the raw source text (`getNodeText` — quotes/backticks included, so the
|
|
410
|
+
* grouping key matches the legacy `checkDuplicateStrings` exactly) plus the
|
|
411
|
+
* 1-based start position. The `duplicate-string-literal` rule groups by
|
|
412
|
+
* `(file, value)`.
|
|
413
|
+
*
|
|
414
|
+
* `enclosingFunction` is the enclosing identity label
|
|
415
|
+
* (`functionIdentityLabel(findEnclosingFunctionIdentity(...))`) the producer
|
|
416
|
+
* computes where the AST still lived; `hardcoded-connection` uses it for its
|
|
417
|
+
* symbol. Top-level literals carry `'top-level'`.
|
|
418
|
+
*/
|
|
419
|
+
export type StringLiteralFact = {
|
|
420
|
+
file: string;
|
|
421
|
+
value: string;
|
|
422
|
+
line: number;
|
|
423
|
+
column: number;
|
|
424
|
+
enclosingFunction: string;
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* One loop-query candidate: a loop (including a nested loop) whose body issues a
|
|
428
|
+
* DB call, the serializable projection the `loop-query` rule reads. The producer
|
|
429
|
+
* computes everything the legacy `checkLoopQueries` needed from the AST — the
|
|
430
|
+
* anchor line/column (the resolved query-call callee), the enclosing loop's line
|
|
431
|
+
* and nesting depth, and the stable per-file symbol (`nextSymbol(enclosingIdentity(…),
|
|
432
|
+
* 'loop-query', …)`) — so `analyze` is a pure projection. Dedup (one fact element
|
|
433
|
+
* per *loop*, not per query) and the LLM/queue suppression both ran in the
|
|
434
|
+
* producer where the AST lived, matching the legacy one-finding-per-loop contract
|
|
435
|
+
* (defect #51).
|
|
436
|
+
*/
|
|
437
|
+
export type LoopQueryFact = {
|
|
438
|
+
file: string;
|
|
439
|
+
/** 1-based line of the resolved query-call anchor (the `db` receiver). */
|
|
440
|
+
line: number;
|
|
441
|
+
/** 1-based column of the resolved query-call anchor. */
|
|
442
|
+
column: number;
|
|
443
|
+
/** The stable per-file symbol key the legacy finding carried as `functionName`. */
|
|
444
|
+
symbol: string;
|
|
445
|
+
/** 1-based line of the enclosing loop's opening token. */
|
|
446
|
+
loopLine: number;
|
|
447
|
+
/** Nesting depth of the enclosing loop (1 = top-level, 2 = nested once, …). */
|
|
448
|
+
depth: number;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* One un-gated, un-deduped loop-query candidate — the raw projection of one
|
|
452
|
+
* in-loop DB call, pre-`isDbCallNode`-filter and pre-loop-dedup. The corpus
|
|
453
|
+
* `loop-queries` producer re-folds the strict-handle verdict (`isDbCallNode`'s
|
|
454
|
+
* `identifyHandle`), drops non-handles, dedups by loop byte-offset (one finding
|
|
455
|
+
* per loop), and assigns the stable symbol — the three steps that depend on the
|
|
456
|
+
* cross-file `dbProvenanced` seed, which the raw producer (empty seed) cannot
|
|
457
|
+
* see. The provenance-free discriminators (statement-construction, for-of-iterable,
|
|
458
|
+
* hoisted-reuse, batch-argument, LLM/queue suppression) already ran here while
|
|
459
|
+
* the AST lived.
|
|
460
|
+
*/
|
|
461
|
+
export type LoopQueryRawCandidate = {
|
|
462
|
+
readonly file: string;
|
|
463
|
+
/** 1-based line/column of the resolved query-call anchor (`getCallExpressionCallee`). */
|
|
464
|
+
readonly line: number;
|
|
465
|
+
readonly column: number;
|
|
466
|
+
/** The enclosing-function identity label the symbol is keyed on. */
|
|
467
|
+
readonly enclosingFunction: string;
|
|
468
|
+
/** The enclosing loop's start byte offset — the dedup key (one finding per loop). */
|
|
469
|
+
readonly loopStartOffset: number;
|
|
470
|
+
/** 1-based line of the enclosing loop's opening token. */
|
|
471
|
+
readonly loopLine: number;
|
|
472
|
+
readonly depth: number;
|
|
473
|
+
readonly handleCalleeType: 'identifier' | 'member' | null;
|
|
474
|
+
readonly handleName: string | null;
|
|
475
|
+
readonly handleRoot: string | null;
|
|
476
|
+
readonly handleReceiver: string | null;
|
|
477
|
+
readonly handleMethod: string | null;
|
|
478
|
+
readonly handleThisField: boolean;
|
|
479
|
+
/** The enclosing class's base-class heritage text (`WorkflowEntrypoint<Env>`),
|
|
480
|
+
* or null when not `this`-rooted or the class has no base class (Spec 70 Q3).
|
|
481
|
+
* Resolved at fold time via the env's `resolveHeritageField`. */
|
|
482
|
+
readonly handleThisHeritage: string | null;
|
|
483
|
+
/** The handle verdict's site-dialect receiver (raw nullable
|
|
484
|
+
* `getMemberExpressionReceiver` of the callee) — `resolveSiteDialect` reads
|
|
485
|
+
* the nullable raw, distinct from `handleReceiver` (`receiver ?? root`). */
|
|
486
|
+
readonly handleSiteReceiver: string | null;
|
|
487
|
+
/** The static SQL argument (unquoted), or null — feeds the handle verdict's
|
|
488
|
+
* sql-argument source. */
|
|
489
|
+
readonly sqlArg: string | null;
|
|
490
|
+
/** The handle verdict's binding scope (enclosing function start offset) — the
|
|
491
|
+
* corpus-side fold resolves the handle root's binding name in this scope so two
|
|
492
|
+
* same-named bindings in different functions disambiguate (Spec 70 §6). */
|
|
493
|
+
readonly handleRootScope?: number;
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* One dynamic-SQL construction candidate: a `query(`/`execute(` call site whose
|
|
497
|
+
* string argument is built by interpolation or concatenation and is not provably
|
|
498
|
+
* taint-safe. The producer runs the full legacy `checkSQLInjection` extraction —
|
|
499
|
+
* the regex scan, the parameterized-query skip (`query(sql, params)`), the
|
|
500
|
+
* enclosing-call + dynamic-parts safety analysis, and the per-function symbol
|
|
501
|
+
* ordinal — so `analyze` is a pure projection. `enclosingFn` is the bare
|
|
502
|
+
* function label the message interpolates; `symbol` is the full
|
|
503
|
+
* `<enclosingFn>:dynamic-sql-construction[:ordinal]` key the legacy finding
|
|
504
|
+
* carried as `functionName`.
|
|
505
|
+
*/
|
|
506
|
+
export type DynamicSqlFact = {
|
|
507
|
+
file: string;
|
|
508
|
+
/** 1-based line of the matched query/execute string argument. */
|
|
509
|
+
line: number;
|
|
510
|
+
/** 1-based column of the matched query/execute string argument. */
|
|
511
|
+
column: number;
|
|
512
|
+
/** The enclosing function/method label (`functionIdentityLabel`), or 'top-level'. */
|
|
513
|
+
enclosingFn: string;
|
|
514
|
+
/** The stable per-file symbol key the legacy finding carried as `functionName`. */
|
|
515
|
+
symbol: string;
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* One hardcoded-credential *candidate*: a string in a credential position, as
|
|
519
|
+
* the `secret-candidates` producer extracts it from a variable/assignment/pair
|
|
520
|
+
* or a call's sibling string arguments. The producer computes only what the AST
|
|
521
|
+
* makes reachable — the name/key/args plus the enclosing node's start position
|
|
522
|
+
* (the legacy analyzer anchored at the enclosing node, not the string). The
|
|
523
|
+
* `isSecretName` / `looksLikeRealSecret` / `isCredentialSelector` classification
|
|
524
|
+
* is the rule's: the producer never decides "is this a secret", it only projects
|
|
525
|
+
* the positional context. A `call` candidate carries the *sibling* string-arg
|
|
526
|
+
* values so the rule can re-run the selector/secret split the legacy
|
|
527
|
+
* `checkCredentialCall` did.
|
|
528
|
+
*/
|
|
529
|
+
export type SecretCandidate = {
|
|
530
|
+
/** The credential position: a variable, an assignment, or an object pair. */
|
|
531
|
+
position: 'declarator' | 'assignment' | 'pair';
|
|
532
|
+
/** The credential name/key (`password`, `apiKey`, …). */
|
|
533
|
+
name: string;
|
|
534
|
+
/** The candidate value (quotes/backticks stripped). */
|
|
535
|
+
value: string;
|
|
536
|
+
file: string;
|
|
537
|
+
line: number;
|
|
538
|
+
column: number;
|
|
539
|
+
} | {
|
|
540
|
+
position: 'call';
|
|
541
|
+
/** The call's sibling string-argument values (selector + secret), in order. */
|
|
542
|
+
args: readonly string[];
|
|
543
|
+
file: string;
|
|
544
|
+
line: number;
|
|
545
|
+
column: number;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* One candidate for the three single-file security rules (`UniversalSecurity
|
|
549
|
+
* Analyzer`), as the `security-candidates` producer extracts it. The producer
|
|
550
|
+
* runs the structural half the legacy `analyzeAST` walk did — it identifies the
|
|
551
|
+
* unsafe shell invocation, the computed require/import specifier, and the
|
|
552
|
+
* sink-reaching unescaped HTML interpolation — and projects each onto a plain
|
|
553
|
+
* tuple plus the enclosing node's start position. The rule owns the pure-text
|
|
554
|
+
* classification (`isConfigPath`, the test/fixture skip) and the finding
|
|
555
|
+
* construction (message/resolution/severity).
|
|
556
|
+
*/
|
|
557
|
+
export type SecurityCandidate = {
|
|
558
|
+
/** A shell/process invocation whose command is built by interpolation or
|
|
559
|
+
* concatenation (the producer already resolved `unsafe`). */
|
|
560
|
+
kind: 'command-injection';
|
|
561
|
+
fnName: string;
|
|
562
|
+
file: string;
|
|
563
|
+
line: number;
|
|
564
|
+
column: number;
|
|
565
|
+
} | {
|
|
566
|
+
/** A `require()`/`import()`/`createRequire(...)()` whose specifier is
|
|
567
|
+
* computed (not a literal); `argText` is the raw specifier source and
|
|
568
|
+
* `calleeText` the callee's raw text (`require`/`import`/`createRequire(…)`),
|
|
569
|
+
* which the resolution's `symbols` names. */
|
|
570
|
+
kind: 'dynamic-require';
|
|
571
|
+
argText: string;
|
|
572
|
+
calleeText: string;
|
|
573
|
+
file: string;
|
|
574
|
+
line: number;
|
|
575
|
+
column: number;
|
|
576
|
+
} | {
|
|
577
|
+
/** A template substitution that reaches an HTML sink unescaped; `prop` is
|
|
578
|
+
* the member-access property interpolated. */
|
|
579
|
+
kind: 'unescaped-html';
|
|
580
|
+
prop: string;
|
|
581
|
+
file: string;
|
|
582
|
+
line: number;
|
|
583
|
+
column: number;
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* One DDL state transition parsed from migration SQL — the serializable
|
|
587
|
+
* projection of the schema analyzer's `MigrationOp` (same three arms), carried
|
|
588
|
+
* so the `migration-history` corpus processor can replay CREATE/DROP/RENAME
|
|
589
|
+
* across files in migration order.
|
|
590
|
+
*/
|
|
591
|
+
export type MigrationOpFact = {
|
|
592
|
+
op: 'CREATE' | 'DROP' | 'RENAME';
|
|
593
|
+
table: string;
|
|
594
|
+
newTable?: string;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* The DDL facts extracted from one file — the per-file projection of the schema
|
|
598
|
+
* analyzer's migration replay. One entry per file that contains DDL, even a
|
|
599
|
+
* migration whose net effect is only to DROP tables (zero surviving tables):
|
|
600
|
+
* `ops` is the ordered CREATE/DROP/RENAME sequence, and `tableColumns` the
|
|
601
|
+
* per-table column names the file declares. The corpus processors replay `ops`
|
|
602
|
+
* across files in migration order — a table dropped in a later migration is a
|
|
603
|
+
* stale reference, not a declaration — so the fact must carry a DROP-only file
|
|
604
|
+
* too, not just the tables that survive it.
|
|
605
|
+
*/
|
|
606
|
+
export type SchemaDeclaration = {
|
|
607
|
+
file: string;
|
|
608
|
+
ops: readonly MigrationOpFact[];
|
|
609
|
+
tableColumns: Readonly<Record<string, readonly string[]>>;
|
|
610
|
+
/** Per-table columns the file declares as natural UNIQUE (SQL names,
|
|
611
|
+
* lowercased) — the bootstrap-lookup signal `missing-org-filter` reads: a
|
|
612
|
+
* query whose predicate carries one of these is a lookup by that natural key.
|
|
613
|
+
* PRIMARY KEY is excluded — a surrogate PK is the IDOR surface, not a
|
|
614
|
+
* bootstrap signal. */
|
|
615
|
+
uniqueColumns: Readonly<Record<string, readonly string[]>>;
|
|
616
|
+
/** Per-table PRIMARY KEY columns (SQL names, lowercased) — kept *separate*
|
|
617
|
+
* from `uniqueColumns` so the resolution fact can distinguish a surrogate PK
|
|
618
|
+
* (the IDOR surface) from a natural key (the bootstrap signal). */
|
|
619
|
+
primaryKeyColumns: Readonly<Record<string, readonly string[]>>;
|
|
620
|
+
/** Per-table NOT NULL columns (SQL names, lowercased). */
|
|
621
|
+
notNullColumns: Readonly<Record<string, readonly string[]>>;
|
|
622
|
+
/** Per-table foreign-key references (declaring column → referenced table +
|
|
623
|
+
* column), all lowercased. */
|
|
624
|
+
foreignKeys: Readonly<Record<string, readonly DdlForeignKey[]>>;
|
|
625
|
+
};
|
|
626
|
+
/**
|
|
627
|
+
* One ORM schema-object declaration: a `const <identifier> = pgTable|mysqlTable|
|
|
628
|
+
* sqliteTable('<table>', …)` binding. The identifier is the JS name the code
|
|
629
|
+
* references (`.from(sampleOwnership)`), and `table` is the SQL name the DDL
|
|
630
|
+
* catalog keys on (`sample_ownership`). The `resolution` corpus reducer
|
|
631
|
+
* builds an alias map from these so a query referencing the identifier reaches
|
|
632
|
+
* the catalog entry the identifier names — the Drizzle chain that was broken
|
|
633
|
+
* before: `.from(sampleOwnership)` extracted `sampleOwnership`, which matches no
|
|
634
|
+
* catalog key (`sample_ownership`), so tenant-scoped tables queried through a
|
|
635
|
+
* schema object were invisible to `missing-org-filter`.
|
|
636
|
+
*/
|
|
637
|
+
export type SchemaObject = {
|
|
638
|
+
file: string;
|
|
639
|
+
/** The JS binding name (`sampleOwnership`). */
|
|
640
|
+
identifier: string;
|
|
641
|
+
/** The declared SQL table name (`sample_ownership`). */
|
|
642
|
+
table: string;
|
|
643
|
+
/** The `.unique()` (natural, not `.primaryKey()`) columns, each carried as its
|
|
644
|
+
* JS field name (`prefix`) and, when different, its SQL column name
|
|
645
|
+
* (`hashed_token`) — so a query filtering on either name is recognized as a
|
|
646
|
+
* structurally-scoped (bootstrap) lookup by `missing-org-filter`. A surrogate
|
|
647
|
+
* primary key is excluded: it is the IDOR surface, not a bootstrap signal. */
|
|
648
|
+
uniqueColumns: readonly string[];
|
|
649
|
+
/** The `.primaryKey()` columns (surrogate key), kept *separate* from
|
|
650
|
+
* `uniqueColumns` so the resolution fact distinguishes PK from UNIQUE. */
|
|
651
|
+
primaryKeyColumns: readonly string[];
|
|
652
|
+
};
|
|
653
|
+
/**
|
|
654
|
+
* The serializable projection of `SchemaUsage` (types.ts). The source type is
|
|
655
|
+
* an `interface`, which does not satisfy §4's `Serializable` index-signature
|
|
656
|
+
* arm; the fact is the same data as a plain object-literal shape.
|
|
657
|
+
*/
|
|
658
|
+
export type SchemaUsageFact = {
|
|
659
|
+
tableName: string;
|
|
660
|
+
filePath: string;
|
|
661
|
+
functionName: string | null;
|
|
662
|
+
functionStartLine?: number | null;
|
|
663
|
+
functionStartColumn?: number | null;
|
|
664
|
+
usageType: 'select' | 'insert' | 'update' | 'delete' | 'create' | 'reference';
|
|
665
|
+
line: number;
|
|
666
|
+
column?: number;
|
|
667
|
+
rawQuery?: string;
|
|
668
|
+
parameters?: string[];
|
|
669
|
+
origin?: 'query-builder' | 'collection-adapter';
|
|
670
|
+
};
|
|
671
|
+
/** A function/method span, the projection of one enclosing-function node the
|
|
672
|
+
* corpus `schema-usage` producer uses to re-home a reference to its innermost
|
|
673
|
+
* enclosing function with no AST. `name` is `adapter.getNodeName`'s text (null
|
|
674
|
+
* for an anonymous arrow). */
|
|
675
|
+
export type FunctionSpanFact = {
|
|
676
|
+
readonly startLine: number;
|
|
677
|
+
readonly startColumn: number;
|
|
678
|
+
readonly endLine: number;
|
|
679
|
+
readonly endColumn: number;
|
|
680
|
+
readonly name: string | null;
|
|
681
|
+
};
|
|
682
|
+
/** A string-fragment span, the projection of one `string_fragment` leaf the
|
|
683
|
+
* corpus `schema-usage` producer uses to re-home a *top-level* reference with no
|
|
684
|
+
* AST. The legacy re-home (`findClosestNodeAt` + `findEnclosingFunctionIdentity`)
|
|
685
|
+
* returned the deepest node containing the reference — for a table name inside a
|
|
686
|
+
* SQL string that node is a `string_fragment`, whose start (the content start,
|
|
687
|
+
* right after the backtick/quote or a `${…}` substitution) becomes the
|
|
688
|
+
* top-level coordinate. The end is projected so the corpus producer can test
|
|
689
|
+
* containment. */
|
|
690
|
+
export type StringFragmentFact = {
|
|
691
|
+
readonly startLine: number;
|
|
692
|
+
readonly startColumn: number;
|
|
693
|
+
readonly endLine: number;
|
|
694
|
+
readonly endColumn: number;
|
|
695
|
+
};
|
|
696
|
+
/** One tagged-template SQL candidate (`sql\`SELECT …\``), extracted un-gated. */
|
|
697
|
+
export type TaggedTemplateCandidate = {
|
|
698
|
+
readonly tagName: string;
|
|
699
|
+
readonly templateText: string;
|
|
700
|
+
readonly location: {
|
|
701
|
+
line: number;
|
|
702
|
+
column: number;
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
/** One DB-call candidate, split by callee shape so the corpus producer can mirror
|
|
706
|
+
* `dbCallVerdict`'s identifier / member arms. `sqlArgument` feeds
|
|
707
|
+
* `identifyHandle`'s sql-argument source; `sqlText` is the resolved SQL
|
|
708
|
+
* `parseSqlTables` reads — or null when the argument is held in an unresolvable
|
|
709
|
+
* identifier, in which case `unresolved` carries the identifier + location so the
|
|
710
|
+
* corpus-side reduction can re-admit the call and emit the `unresolved-query`
|
|
711
|
+
* coverage diagnostic (Spec 70 1b). `sqlText` and `unresolved` are mutually
|
|
712
|
+
* exclusive: `resolveQuerySql` returns at most one. */
|
|
713
|
+
export type DbCallCandidate = {
|
|
714
|
+
readonly calleeType: 'identifier';
|
|
715
|
+
readonly name: string;
|
|
716
|
+
readonly sqlArgument: string | null;
|
|
717
|
+
readonly sqlText: string | null;
|
|
718
|
+
readonly unresolved: UnresolvedQuery | null;
|
|
719
|
+
readonly location: {
|
|
720
|
+
line: number;
|
|
721
|
+
column: number;
|
|
722
|
+
};
|
|
723
|
+
} | {
|
|
724
|
+
readonly calleeType: 'member';
|
|
725
|
+
readonly method: string;
|
|
726
|
+
readonly root: string;
|
|
727
|
+
readonly receiver: string | null;
|
|
728
|
+
readonly thisField: boolean;
|
|
729
|
+
readonly sqlArgument: string | null;
|
|
730
|
+
readonly sqlText: string | null;
|
|
731
|
+
readonly unresolved: UnresolvedQuery | null;
|
|
732
|
+
readonly location: {
|
|
733
|
+
line: number;
|
|
734
|
+
column: number;
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
/** One re-admitted DB-call whose SQL argument is held in an unresolvable
|
|
738
|
+
* identifier (Spec 70 1b) — the corpus-side `unresolved-query` record, re-derived
|
|
739
|
+
* from the raw `schema-usage-candidates` fact + the `receiver-provenance` fixed
|
|
740
|
+
* point with no AST. `identifyHandle` already re-admitted the call (a DB handle),
|
|
741
|
+
* so the query's table read/write status is genuinely unknown, not "no tables".
|
|
742
|
+
* Feeds the `unresolved-query` coverage diagnostic re-homed in the caller. */
|
|
743
|
+
export type UnresolvedQuerySite = {
|
|
744
|
+
readonly file: string;
|
|
745
|
+
readonly identifier: string;
|
|
746
|
+
readonly location: {
|
|
747
|
+
line: number;
|
|
748
|
+
column: number;
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* One file's un-gated schema-usage candidates — the raw, provenance-free extract
|
|
753
|
+
* the corpus `schema-usage` producer re-gates and re-derives (Spec 70 Item 4,
|
|
754
|
+
* step 3). The split mirrors `query-site-candidates`: the provenance-free half of
|
|
755
|
+
* `findTableReferences` — strategies (4)/(5)/(6) ORM / query-builder /
|
|
756
|
+
* collection-adapter — is extracted *and re-homed* here while the AST lives,
|
|
757
|
+
* while the two provenance-dependent strategies (1) tagged-template and (2)
|
|
758
|
+
* DB-call emit raw candidates the corpus producer re-admits and re-homes once
|
|
759
|
+
* `classifyBuildProvenance` has re-derived `dbProvenanced`. `functions` projects
|
|
760
|
+
* every enclosing-function node so the corpus producer can re-home tagged / DB-call
|
|
761
|
+
* references without walking the tree; `hasSqlTag` is the one gate input a corpus
|
|
762
|
+
* producer cannot re-derive (it scans source text).
|
|
763
|
+
*/
|
|
764
|
+
export type SchemaUsageCandidatesFact = {
|
|
765
|
+
readonly file: string;
|
|
766
|
+
readonly sourceCode: string;
|
|
767
|
+
readonly hasSqlTag: boolean;
|
|
768
|
+
readonly functions: readonly FunctionSpanFact[];
|
|
769
|
+
readonly stringFragments: readonly StringFragmentFact[];
|
|
770
|
+
readonly tagged: readonly TaggedTemplateCandidate[];
|
|
771
|
+
readonly dbCalls: readonly DbCallCandidate[];
|
|
772
|
+
readonly ormRefs: readonly SchemaUsageFact[];
|
|
773
|
+
readonly queryBuilderRefs: readonly SchemaUsageFact[];
|
|
774
|
+
readonly collectionAdapterRefs: readonly SchemaUsageFact[];
|
|
775
|
+
};
|
|
776
|
+
/**
|
|
777
|
+
* The per-file `style-declarations` fact — the serializable projection of the
|
|
778
|
+
* three arrays the styles pipeline extracts from one CSS/SCSS file: normalized
|
|
779
|
+
* declarations, design tokens (custom properties), and class usage. §3.2
|
|
780
|
+
* re-homes `createStylesCssVisitor` (pipelineAdapters.ts), which emits exactly
|
|
781
|
+
* this trio; the styles rules read all three, so a single flat declaration
|
|
782
|
+
* list was never the right shape. Each element carries its own `filePath`, so
|
|
783
|
+
* the corpus-wide fact is the concatenation of per-file fragments and the
|
|
784
|
+
* rules flatten the three sub-arrays. The element shapes are object-literal
|
|
785
|
+
* `type` aliases (not the `NormalizedDeclaration`/`StyleToken`/
|
|
786
|
+
* `StyleClassUsage` interfaces they project) so §4's `Serializable` arm holds.
|
|
787
|
+
*/
|
|
788
|
+
export type StyleDeclarationsFile = {
|
|
789
|
+
declarations: ReadonlyArray<StylesDeclaration>;
|
|
790
|
+
tokens: ReadonlyArray<StylesToken>;
|
|
791
|
+
classUsage: ReadonlyArray<StylesClassUsage>;
|
|
792
|
+
/** Content-level `<style lang="…">` unread reasons, collected by the markup
|
|
793
|
+
* producer (`extractStylesMarkup`) during its own `extractDeclarations` pass.
|
|
794
|
+
* The `unread-style-sources` corpus producer flattens these instead of
|
|
795
|
+
* re-reading the `style_unread_sources` index table (the old path that
|
|
796
|
+
* re-parsed markup files the corpus already parsed). CSS and TS/JS source
|
|
797
|
+
* producers have no content-level reason, so they contribute `[]`. */
|
|
798
|
+
unreadSources: ReadonlyArray<UnreadStyleSourceFact>;
|
|
799
|
+
};
|
|
800
|
+
/** A normalized style declaration, as the CSS/SCSS extractor emits it. */
|
|
801
|
+
export type StylesDeclaration = {
|
|
802
|
+
property: string;
|
|
803
|
+
rawValue: string;
|
|
804
|
+
/** Normalized value for cross-mechanism comparison; null when unresolvable. */
|
|
805
|
+
normalizedValue: StylesNormalizedValue | null;
|
|
806
|
+
mechanism: string;
|
|
807
|
+
filePath: string;
|
|
808
|
+
line: number;
|
|
809
|
+
context: string | null;
|
|
810
|
+
variantContext: string | null;
|
|
811
|
+
tokenRef: string | null;
|
|
812
|
+
};
|
|
813
|
+
/**
|
|
814
|
+
* One color declaration's CIELAB conversion, pre-computed by the `color-values`
|
|
815
|
+
* corpus producer from `style-declarations` (Spec 69 R4). The
|
|
816
|
+
* `styles/value-drift` rule reads this fact instead of parsing raw color strings
|
|
817
|
+
* in its own body: `parseColorToRGB` + `rgbToLab` moved to the producer, so the
|
|
818
|
+
* rule's clustering and flagging decisions operate on pre-computed Lab triples.
|
|
819
|
+
*/
|
|
820
|
+
export type ColorValuesFact = {
|
|
821
|
+
property: string;
|
|
822
|
+
filePath: string;
|
|
823
|
+
line: number;
|
|
824
|
+
rawValue: string;
|
|
825
|
+
/** JSON.stringify(NormalizedValue) encoding, or null — mirrors StyleDeclRow. */
|
|
826
|
+
normalizedValue: string | null;
|
|
827
|
+
/** The sRGB triple ([0..255] per channel), for exact-value dedup. */
|
|
828
|
+
rgb: [number, number, number];
|
|
829
|
+
/** The CIELAB Lab triple (L, a, b), D65 reference white. */
|
|
830
|
+
lab: [number, number, number];
|
|
831
|
+
};
|
|
832
|
+
/** A design token (CSS custom property) defined in a stylesheet. */
|
|
833
|
+
export type StylesToken = {
|
|
834
|
+
name: string;
|
|
835
|
+
value: string;
|
|
836
|
+
filePath: string;
|
|
837
|
+
mechanism: 'css-custom-property' | 'tailwind-theme';
|
|
838
|
+
usageCount?: number;
|
|
839
|
+
bypassCount?: number;
|
|
840
|
+
};
|
|
841
|
+
/** One class name used in a stylesheet (a `.foo` selector occurrence). */
|
|
842
|
+
export type StylesClassUsage = {
|
|
843
|
+
className: string;
|
|
844
|
+
filePath: string;
|
|
845
|
+
line: number;
|
|
846
|
+
mechanism: 'className' | 'class';
|
|
847
|
+
unresolvable: boolean;
|
|
848
|
+
};
|
|
849
|
+
/** One defined CSS class (a `.foo` selector), with its defining file. The
|
|
850
|
+
* corpus fact is the full `style_defined_classes` catalog — the
|
|
851
|
+
* `styles/undefined-class` rule resolves candidate class names against it
|
|
852
|
+
* (membership lookup) and near-miss-suggests against it (Levenshtein ≤2), both
|
|
853
|
+
* in memory rather than through batched `IN (...)` index lookups. */
|
|
854
|
+
export type DefinedClassesFact = {
|
|
855
|
+
className: string;
|
|
856
|
+
filePath: string;
|
|
857
|
+
};
|
|
858
|
+
/** One stylesheet source the style indexer could not read (Spec 45 R5). The
|
|
859
|
+
* `styles/undefined-class` rule carries the full list as
|
|
860
|
+
* `details.incompleteDefinitions` so "undefined" reads as "not defined in any
|
|
861
|
+
* *read* stylesheet" rather than a definitive assertion. The walk-level reasons
|
|
862
|
+
* (unsupported dialect, read failure, unknown extension) are produced by the
|
|
863
|
+
* traverse phase's own read/dialect walk (`runPhaseModel`); the content-level
|
|
864
|
+
* `<style lang="…">` reason is collected by the markup `style-declarations`
|
|
865
|
+
* producer (`extractStylesMarkup`) during its `extractDeclarations` pass and
|
|
866
|
+
* flattened by the `unread-style-sources` corpus producer — the two are merged
|
|
867
|
+
* in `buildFacts`. */
|
|
868
|
+
export type UnreadStyleSourceFact = {
|
|
869
|
+
filePath: string;
|
|
870
|
+
reason: string;
|
|
871
|
+
};
|
|
872
|
+
/** The normalized-value union: a color (hex+alpha), a length, or a literal. */
|
|
873
|
+
export type StylesNormalizedValue = {
|
|
874
|
+
type: 'color';
|
|
875
|
+
hex: string;
|
|
876
|
+
alpha: number;
|
|
877
|
+
} | {
|
|
878
|
+
type: 'length';
|
|
879
|
+
value: number;
|
|
880
|
+
unit: string;
|
|
881
|
+
} | {
|
|
882
|
+
type: 'literal';
|
|
883
|
+
value: string;
|
|
884
|
+
};
|
|
885
|
+
/**
|
|
886
|
+
* A cross-language entity as a serializable fact — the projection of
|
|
887
|
+
* `CrossLanguageEntity` that strips the non-serializable `Date` timestamps and
|
|
888
|
+
* pins `metadata` to the keys the cross-language analyzers actually read
|
|
889
|
+
* (`callees`, `isMethod`, `isExported`, `fileReferences`, `fields`). §3.2's
|
|
890
|
+
* processor emits exactly this shape via `extractCrossLanguageEntities`
|
|
891
|
+
* (pipelineAdapters.ts), which never sets the `Date` fields.
|
|
892
|
+
*/
|
|
893
|
+
export type Entity = {
|
|
894
|
+
id: string;
|
|
895
|
+
name: string;
|
|
896
|
+
language: string;
|
|
897
|
+
file: string;
|
|
898
|
+
type: string;
|
|
899
|
+
signature: string;
|
|
900
|
+
parameters: ReadonlyArray<{
|
|
901
|
+
name: string;
|
|
902
|
+
type?: string;
|
|
903
|
+
optional?: boolean;
|
|
904
|
+
language: string;
|
|
905
|
+
}>;
|
|
906
|
+
calls: ReadonlyArray<{
|
|
907
|
+
sourceId: string;
|
|
908
|
+
targetId: string;
|
|
909
|
+
type: string;
|
|
910
|
+
}>;
|
|
911
|
+
calledBy: ReadonlyArray<{
|
|
912
|
+
sourceId: string;
|
|
913
|
+
targetId: string;
|
|
914
|
+
type: string;
|
|
915
|
+
}>;
|
|
916
|
+
visibility?: string;
|
|
917
|
+
startLine?: number;
|
|
918
|
+
endLine?: number;
|
|
919
|
+
complexity?: number;
|
|
920
|
+
purpose: string;
|
|
921
|
+
context: string;
|
|
922
|
+
searchTokens: string[];
|
|
923
|
+
metadata?: {
|
|
924
|
+
callees?: string[];
|
|
925
|
+
isMethod?: boolean;
|
|
926
|
+
isExported?: boolean;
|
|
927
|
+
fileReferences?: string[];
|
|
928
|
+
fields?: ReadonlyArray<{
|
|
929
|
+
name: string;
|
|
930
|
+
type?: string;
|
|
931
|
+
isExported?: boolean;
|
|
932
|
+
tag?: string;
|
|
933
|
+
}>;
|
|
934
|
+
};
|
|
935
|
+
};
|
|
936
|
+
/**
|
|
937
|
+
* A DB call resolved by the data-access processor — the serializable projection
|
|
938
|
+
* of `UniversalDataAccessAnalyzer`'s `DatabaseCall`. The initial `kind`/`raw`
|
|
939
|
+
* declaration was a guess; §3.2 pins it to what `extractDatabaseCalls` actually
|
|
940
|
+
* emits, because the data-access rules read the full set: `hasFilter`
|
|
941
|
+
* (`unfiltered-query`), `hasSqlInjectionRisk`/`sqlEscaped` (`sql-injection-risk`),
|
|
942
|
+
* `hasParameterizedQuery`, and `enclosingFunction` (stable fingerprinting).
|
|
943
|
+
* `type` is the call's kind label (`db.query` / `db.execute` / …), not a SQL
|
|
944
|
+
* verb — the write/read verb is derived at analysis time from `queryText`.
|
|
945
|
+
*/
|
|
946
|
+
/** One predicate element of a local array binding resolved into a `.where(...)`
|
|
947
|
+
* (Spec 69 R3). The element's own source text is carried verbatim so the rule
|
|
948
|
+
* re-derives the org-predicate signal with *its* vocabulary (the §69 Fix-1
|
|
949
|
+
* "one vocabulary, two consumers" invariant) rather than trusting a boolean the
|
|
950
|
+
* producer baked with the default config. */
|
|
951
|
+
export type ResolvedPredicateElement = {
|
|
952
|
+
/** The element's source text (`eq(orders.organizationId, …)`, …). */
|
|
953
|
+
text: string;
|
|
954
|
+
/** True when the element is present on every path to the query (an initializer
|
|
955
|
+
* element, or a `.push(...)` not gated by a conditional/loop/`&&`). */
|
|
956
|
+
allPaths: boolean;
|
|
957
|
+
/** When `allPaths` is false, the enclosing branch condition the element is
|
|
958
|
+
* gated behind (`if (organizationId)`, a ternary/`&&` guard, …). */
|
|
959
|
+
branch?: string;
|
|
960
|
+
};
|
|
961
|
+
/** The local-binding resolution of a `.where(and(...conditions))` predicate.
|
|
962
|
+
* Present only when the `.where(...)` spread resolves to a local `const`/`let`
|
|
963
|
+
* array binding within the same function body. */
|
|
964
|
+
export type ResolvedWhere = {
|
|
965
|
+
elements: ResolvedPredicateElement[];
|
|
966
|
+
};
|
|
967
|
+
export type ResolvedQuery = {
|
|
968
|
+
type: string;
|
|
969
|
+
method: string | null;
|
|
970
|
+
file: string;
|
|
971
|
+
line: number;
|
|
972
|
+
column: number;
|
|
973
|
+
tables: string[];
|
|
974
|
+
/** The query statement's own text (comments stripped), query-scoped. */
|
|
975
|
+
queryText: string;
|
|
976
|
+
hasOrganizationFilter: boolean;
|
|
977
|
+
hasFilter: boolean;
|
|
978
|
+
/** Spec 70 R2 — AST-derived SQL facts, parsed from the call's static SQL
|
|
979
|
+
* argument. Each is absent (false / empty / null) when the corpus named no
|
|
980
|
+
* dialect or the argument failed to parse: that is `cannot-fire`, not a
|
|
981
|
+
* negative verdict. The write/upsert facts are the raw-SQL statement kind;
|
|
982
|
+
* a Kysely builder verb (`updateTable`) is folded into `isWrite`/`isMassWrite`
|
|
983
|
+
* by the producer (host-language shape, not SQL). */
|
|
984
|
+
isWrite: boolean;
|
|
985
|
+
isMassWrite: boolean;
|
|
986
|
+
isUpsert: boolean;
|
|
987
|
+
isRawInsert: boolean;
|
|
988
|
+
/** The lowercased explicit column list of a raw-SQL INSERT/REPLACE, or `null`
|
|
989
|
+
* for a positional INSERT (`INSERT INTO t VALUES (…)`, no column list). */
|
|
990
|
+
insertColumns: string[] | null;
|
|
991
|
+
/** Lowercased column refs appearing as predicate operands in the WHERE tree;
|
|
992
|
+
* `null` when no SQL was parsed (the tenant-predicate signal `cannot-fire`). */
|
|
993
|
+
sqlWhereColumns: string[] | null;
|
|
994
|
+
hasParameterizedQuery: boolean;
|
|
995
|
+
hasSqlInjectionRisk: boolean;
|
|
996
|
+
/** True when the injection risk is manually quote-escaped (downgrades severity). */
|
|
997
|
+
sqlEscaped: boolean;
|
|
998
|
+
/** Enclosing function name for stable fingerprinting. */
|
|
999
|
+
enclosingFunction?: string;
|
|
1000
|
+
/** True when the call is inside a loop (loop-query reads this). */
|
|
1001
|
+
insideLoop?: boolean;
|
|
1002
|
+
/** Spec 69 R3 — the resolved WHERE predicate when the `.where(...)` spreads a
|
|
1003
|
+
* local array binding (`and(...conditions)`). */
|
|
1004
|
+
resolvedWhere?: ResolvedWhere;
|
|
1005
|
+
/** Spec 70 R1.2 — the handle verdict from `identifyHandle` (`handle` with its
|
|
1006
|
+
* `via`, or `unproven` with its reason). Present only when the call was
|
|
1007
|
+
* admitted through handle identification; absent for shape-only / ORM /
|
|
1008
|
+
* tagged-template / variable-assignment candidates. A `not-handle` site is
|
|
1009
|
+
* rejected at admission and never reaches a resolved query. */
|
|
1010
|
+
handleVerdict?: HandleVerdict;
|
|
1011
|
+
};
|
|
1012
|
+
/**
|
|
1013
|
+
* One un-gated data-access-call candidate — the raw, provenance-free projection
|
|
1014
|
+
* of `buildDatabaseCall`'s AST-derived fields plus the two identities the corpus
|
|
1015
|
+
* `data-access-calls` producer re-folds over the re-derived `dbProvenanced`. The
|
|
1016
|
+
* split mirrors `schema-usage-candidates`: the provenance-free half (text-derived
|
|
1017
|
+
* shape, static security arms 1–3, organization filter, enclosing identity,
|
|
1018
|
+
* resolved WHERE) is computed here while the AST lives; the provenance-dependent
|
|
1019
|
+
* half (the handle verdict → admission + injection-risk gate, and the site
|
|
1020
|
+
* dialect → the SQL parse) is re-derived by `classifyDataAccessCalls` once
|
|
1021
|
+
* `classifyBuildProvenance` supplies `dbProvenanced`.
|
|
1022
|
+
*
|
|
1023
|
+
* `handle*` is the identity of `handleVerdictForCall`'s `CallSite` — the
|
|
1024
|
+
* *enclosing call* callee for a template-string candidate, the node's own callee
|
|
1025
|
+
* otherwise — because the admission verdict and the injection-risk gate fold over
|
|
1026
|
+
* it. `site*` is the identity of `resolveSiteDialect`'s input — the node's *own*
|
|
1027
|
+
* callee, null for a template string — because the parse dialect follows it. The
|
|
1028
|
+
* two diverge for a template argument, which is why both travel.
|
|
1029
|
+
*/
|
|
1030
|
+
export type DataAccessCallCandidate = {
|
|
1031
|
+
readonly file: string;
|
|
1032
|
+
readonly line: number;
|
|
1033
|
+
readonly column: number;
|
|
1034
|
+
/** 'typescript' covers tsx/javascript; 'go' is the Go family (selector callee). */
|
|
1035
|
+
readonly format: 'typescript' | 'go';
|
|
1036
|
+
/** The comment-stripped node text (`queryText`). */
|
|
1037
|
+
readonly nodeText: string;
|
|
1038
|
+
/** `extractMethodName` — the resolved method/property label, or null when the
|
|
1039
|
+
* callee shape cannot be walked to a name (no method name, never a guess). */
|
|
1040
|
+
readonly method: string | null;
|
|
1041
|
+
/** The static SQL argument (unquoted), or null when absent/interpolated. */
|
|
1042
|
+
readonly sqlArg: string | null;
|
|
1043
|
+
/** `isOrmPattern(nodeText)` — an ORM-shaped text, not necessarily SQL. */
|
|
1044
|
+
readonly isOrmCall: boolean;
|
|
1045
|
+
/** `isTaggedTemplateSqlCall` — a tagged-template SQL call (discovery path c). */
|
|
1046
|
+
readonly isTaggedSqlCall: boolean;
|
|
1047
|
+
/** `isQueryBuilderShape` — a query-builder chain (discovery path b). */
|
|
1048
|
+
readonly isQueryBuilderShape: boolean;
|
|
1049
|
+
/** `isVariableAssignment && extractStaticSql !== null` (discovery path d). */
|
|
1050
|
+
readonly isVariableAssignmentSql: boolean;
|
|
1051
|
+
/** `isTemplateLiteral(node)` — the dedup preference (template over declaration). */
|
|
1052
|
+
readonly isTemplateLiteral: boolean;
|
|
1053
|
+
readonly handleCalleeType: 'identifier' | 'member' | null;
|
|
1054
|
+
readonly handleName: string | null;
|
|
1055
|
+
readonly handleRoot: string | null;
|
|
1056
|
+
readonly handleReceiver: string | null;
|
|
1057
|
+
readonly handleMethod: string | null;
|
|
1058
|
+
readonly handleThisField: boolean;
|
|
1059
|
+
/** The enclosing class's base-class heritage text (`WorkflowEntrypoint<Env>`),
|
|
1060
|
+
* or null when not `this`-rooted or the class has no base class (Spec 70 Q3).
|
|
1061
|
+
* Resolved at fold time via the env's `resolveHeritageField`. */
|
|
1062
|
+
readonly handleThisHeritage: string | null;
|
|
1063
|
+
/** `extractStaticSql(callNode)` — the handle verdict's SQL argument (the
|
|
1064
|
+
* enclosing-call first arg for a template, the node's own arg otherwise).
|
|
1065
|
+
* Distinct from `sqlArg` (`extractStaticSql(node)`) for a template that is a
|
|
1066
|
+
* *later* argument of its enclosing call. */
|
|
1067
|
+
readonly handleSqlArg: string | null;
|
|
1068
|
+
/** The handle verdict's site-dialect receiver — the raw nullable
|
|
1069
|
+
* `getMemberExpressionReceiver` of `callNode`'s callee. Distinct from
|
|
1070
|
+
* `handleReceiver` (`receiver ?? root`) because `resolveSiteDialect` reads the
|
|
1071
|
+
* nullable raw (`this.db.prepare` → `db`, not `this.db`). */
|
|
1072
|
+
readonly handleSiteReceiver: string | null;
|
|
1073
|
+
/** The handle verdict's binding scope (enclosing function start offset) — the
|
|
1074
|
+
* corpus-side fold resolves the handle root's binding name in this scope so two
|
|
1075
|
+
* same-named bindings in different functions disambiguate (Spec 70 §6). */
|
|
1076
|
+
readonly handleRootScope?: number;
|
|
1077
|
+
/** `shouldSkipCallForTemplateArg` — drop a call rediscovered via its template
|
|
1078
|
+
* argument (a multi-line template starts on a later line than its call, so the
|
|
1079
|
+
* line dedup does not collapse them). */
|
|
1080
|
+
readonly skipCallForTemplateArg: boolean;
|
|
1081
|
+
readonly siteCalleeType: 'identifier' | 'member' | null;
|
|
1082
|
+
readonly siteName: string | null;
|
|
1083
|
+
readonly siteReceiver: string | null;
|
|
1084
|
+
readonly hasOrganizationFilter: boolean;
|
|
1085
|
+
readonly enclosingFunction: string;
|
|
1086
|
+
readonly resolvedWhere: ResolvedWhere | null;
|
|
1087
|
+
readonly ormTables: readonly string[];
|
|
1088
|
+
readonly builderVerb: 'insert' | 'update' | 'delete' | null;
|
|
1089
|
+
readonly ormHasFilter: boolean;
|
|
1090
|
+
readonly staticParameterized: boolean;
|
|
1091
|
+
readonly staticInjectionRisk: boolean;
|
|
1092
|
+
readonly staticEscaped: boolean;
|
|
1093
|
+
readonly arm4CalleeName: string | null;
|
|
1094
|
+
};
|
|
1095
|
+
/** One column's resolved constraints (Spec 69 R3, criterion 8). PK and natural
|
|
1096
|
+
* UNIQUE are recorded as *separate* flags — the quiet set reads `unique` only,
|
|
1097
|
+
* never `primaryKey`, because a surrogate PK is the IDOR surface the rule
|
|
1098
|
+
* exists to catch, not a bootstrap signal. */
|
|
1099
|
+
export type ResolutionColumn = {
|
|
1100
|
+
name: string;
|
|
1101
|
+
primaryKey: boolean;
|
|
1102
|
+
unique: boolean;
|
|
1103
|
+
notNull: boolean;
|
|
1104
|
+
/** The foreign-key reference, when this column references an in-repo table. */
|
|
1105
|
+
foreignKey: {
|
|
1106
|
+
table: string;
|
|
1107
|
+
column: string;
|
|
1108
|
+
} | null;
|
|
1109
|
+
};
|
|
1110
|
+
/** One resolved table: its last-CREATE source, and each column with its
|
|
1111
|
+
* separately-recorded constraints. */
|
|
1112
|
+
export type ResolutionTable = {
|
|
1113
|
+
name: string;
|
|
1114
|
+
source: string;
|
|
1115
|
+
columns: ReadonlyArray<ResolutionColumn>;
|
|
1116
|
+
};
|
|
1117
|
+
/** One class declaration, resolved to what it extends/implements in-repo. */
|
|
1118
|
+
export type ResolutionClass = {
|
|
1119
|
+
name: string;
|
|
1120
|
+
file: string;
|
|
1121
|
+
extends: string | null;
|
|
1122
|
+
implements: ReadonlyArray<string>;
|
|
1123
|
+
};
|
|
1124
|
+
/** One interface declaration, resolved to what it extends in-repo. */
|
|
1125
|
+
export type ResolutionInterface = {
|
|
1126
|
+
name: string;
|
|
1127
|
+
file: string;
|
|
1128
|
+
extends: ReadonlyArray<string>;
|
|
1129
|
+
};
|
|
1130
|
+
/** The one resolution fact (Spec 69 R3, criterion 7). It answers "what does this
|
|
1131
|
+
* name refer to?" for every declared entity a rule asks about: ORM identifiers
|
|
1132
|
+
* to SQL table names (`aliases`), tables to their columns and per-column
|
|
1133
|
+
* constraints (`tables`), and class/interface declarations to what they extend
|
|
1134
|
+
* and implement (`classes`/`interfaces`). No rule performs its own name
|
|
1135
|
+
* resolution — it reads this fact instead. */
|
|
1136
|
+
export type ResolutionFact = {
|
|
1137
|
+
tables: ReadonlyArray<ResolutionTable>;
|
|
1138
|
+
aliases: Readonly<Record<string, string>>;
|
|
1139
|
+
classes: ReadonlyArray<ResolutionClass>;
|
|
1140
|
+
interfaces: ReadonlyArray<ResolutionInterface>;
|
|
1141
|
+
};
|
|
1142
|
+
/**
|
|
1143
|
+
* A config-declared table the phase `resolution` producer merges alongside
|
|
1144
|
+
* the DDL-derived tables. §5 parity: the legacy schema reducer added the
|
|
1145
|
+
* schema analyzer's `knownTables` string list and structured `schemas` to the
|
|
1146
|
+
* known-table set (the "external authority" the `unknown-table` fail-open guard
|
|
1147
|
+
* requires). The corpus producer must add them too or a config-only schema
|
|
1148
|
+
* silently triggers fail-open and `unknown-table` never fires.
|
|
1149
|
+
*/
|
|
1150
|
+
export type ExternalTableDecl = {
|
|
1151
|
+
name: string;
|
|
1152
|
+
/** Provenance label (`'external-config'` or `Schema: <name>`). */
|
|
1153
|
+
source: string;
|
|
1154
|
+
/** Declared column names (empty for a `knownTables` string entry). */
|
|
1155
|
+
columns: ReadonlyArray<string>;
|
|
1156
|
+
};
|
|
1157
|
+
/**
|
|
1158
|
+
* The drop-provenance catalog built by the corpus `migration-history` processor
|
|
1159
|
+
* (§5) — the serializable projection of the legacy schema reducer's
|
|
1160
|
+
* `dropProvenance` map. A table appears here only when a migration dropped it
|
|
1161
|
+
* and no later migration recreated it (the self-contained scratch-table case —
|
|
1162
|
+
* created and dropped within one file — is excluded). `stale-table-reference`
|
|
1163
|
+
* reads it to distinguish "existed and was dropped" (a stale code reference)
|
|
1164
|
+
* from "never existed" (a typo → `unknown-table`).
|
|
1165
|
+
*/
|
|
1166
|
+
export type MigrationHistory = {
|
|
1167
|
+
/** Dropped table name → which migration dropped it, and what that migration created. */
|
|
1168
|
+
dropped: Readonly<Record<string, {
|
|
1169
|
+
migrationFile: string;
|
|
1170
|
+
createdInSameMigration: readonly string[];
|
|
1171
|
+
}>>;
|
|
1172
|
+
};
|
|
1173
|
+
/**
|
|
1174
|
+
* One mined convention, as the `mined-conventions` corpus fact carries it. This
|
|
1175
|
+
* is the serializable projection of the `Convention` interface (types.ts) minus
|
|
1176
|
+
* the DB-assigned/storage-only fields (`id`, `hash`, `created_at`): detection
|
|
1177
|
+
* reads the domain, the antecedent/consequent/pattern, the directory it scopes,
|
|
1178
|
+
* the confidence the miner computed, and the exemplar anchor — never the
|
|
1179
|
+
* change-detection hash (that belongs to the SQLite index-sync path, which the
|
|
1180
|
+
* phase model has no analogue of).
|
|
1181
|
+
*
|
|
1182
|
+
* Object-literal `type` (not `interface`) so §4's `Serializable` index-signature
|
|
1183
|
+
* arm holds.
|
|
1184
|
+
*/
|
|
1185
|
+
export type MinedConvention = {
|
|
1186
|
+
domain: 'usage-pair' | 'import-form' | 'error-handling' | 'export-shape' | 'naming';
|
|
1187
|
+
rule_id: string;
|
|
1188
|
+
antecedent: string | null;
|
|
1189
|
+
consequent: string | null;
|
|
1190
|
+
pattern: string | null;
|
|
1191
|
+
directory: string | null;
|
|
1192
|
+
file_path: string | null;
|
|
1193
|
+
line: number | null;
|
|
1194
|
+
support: number;
|
|
1195
|
+
total_cases: number;
|
|
1196
|
+
confidence: number;
|
|
1197
|
+
exemplar_file: string | null;
|
|
1198
|
+
exemplar_line: number | null;
|
|
1199
|
+
/** For naming conventions: the sub-population (react-component, hook, function). */
|
|
1200
|
+
export_kind?: string | null;
|
|
1201
|
+
};
|
|
1202
|
+
/**
|
|
1203
|
+
* One scanned React component, as the `react-component` producer projects it.
|
|
1204
|
+
* This is the object-literal (serializable) projection of `ComponentMetadata`
|
|
1205
|
+
* (types.ts), which is an `interface` and so cannot satisfy §4's `Serializable`
|
|
1206
|
+
* index-signature arm. The producer is the `scanParsedFile` half of
|
|
1207
|
+
* `componentScanner.scanFile` — the same tree-sitter walk the legacy react
|
|
1208
|
+
* visitor ran — projected onto plain data before the AST dies with the file.
|
|
1209
|
+
* The rules re-cast this shape back to `ComponentMetadata`/`ComponentScanResult`
|
|
1210
|
+
* (structurally identical) and run the existing `analyzeComponent` /
|
|
1211
|
+
* `checkCircularDependencies` / `checkErrorBoundaryUsage` / `checkRawElements`
|
|
1212
|
+
* detectors, so the classification half is bit-identical to the legacy path.
|
|
1213
|
+
*/
|
|
1214
|
+
export type ReactComponentScan = {
|
|
1215
|
+
filePath: string;
|
|
1216
|
+
components: ReactComponentMetadata[];
|
|
1217
|
+
imports: ReactComponentImport[];
|
|
1218
|
+
fileHash?: string;
|
|
1219
|
+
parseErrors?: string[];
|
|
1220
|
+
};
|
|
1221
|
+
/** The serializable projection of `ComponentMetadata` (the scanner's fields). */
|
|
1222
|
+
export type ReactComponentMetadata = {
|
|
1223
|
+
name: string;
|
|
1224
|
+
filePath: string;
|
|
1225
|
+
lineNumber?: number;
|
|
1226
|
+
startLine?: number;
|
|
1227
|
+
endLine?: number;
|
|
1228
|
+
entityType: 'component';
|
|
1229
|
+
componentType: 'functional' | 'class' | 'memo' | 'forwardRef';
|
|
1230
|
+
dependencies: string[];
|
|
1231
|
+
purpose: string;
|
|
1232
|
+
context: string;
|
|
1233
|
+
isExported: boolean;
|
|
1234
|
+
body?: string;
|
|
1235
|
+
props?: ReactPropDefinition[];
|
|
1236
|
+
hooks?: ReactHookUsage[];
|
|
1237
|
+
jsxElements?: string[];
|
|
1238
|
+
jsxElementDetails?: ReactJsxElementDetail[];
|
|
1239
|
+
hasErrorBoundary?: boolean;
|
|
1240
|
+
complexity?: number;
|
|
1241
|
+
};
|
|
1242
|
+
/** The serializable projection of `ComponentImport`. */
|
|
1243
|
+
export type ReactComponentImport = {
|
|
1244
|
+
name: string;
|
|
1245
|
+
path: string;
|
|
1246
|
+
isDefault: boolean;
|
|
1247
|
+
};
|
|
1248
|
+
/** The serializable projection of `PropDefinition`. */
|
|
1249
|
+
export type ReactPropDefinition = {
|
|
1250
|
+
name: string;
|
|
1251
|
+
type?: string;
|
|
1252
|
+
required: boolean;
|
|
1253
|
+
hasDefault: boolean;
|
|
1254
|
+
};
|
|
1255
|
+
/** The serializable projection of `HookUsage`. */
|
|
1256
|
+
export type ReactHookUsage = {
|
|
1257
|
+
name: string;
|
|
1258
|
+
line: number;
|
|
1259
|
+
customHook: boolean;
|
|
1260
|
+
};
|
|
1261
|
+
/** The serializable projection of `JsxAttributeDetail`. */
|
|
1262
|
+
export type ReactJsxAttributeDetail = {
|
|
1263
|
+
name: string;
|
|
1264
|
+
line: number;
|
|
1265
|
+
valueKind: 'string' | 'arrow' | 'function' | 'identifier' | 'other' | 'none';
|
|
1266
|
+
};
|
|
1267
|
+
/** The serializable projection of `JsxElementDetail`. */
|
|
1268
|
+
export type ReactJsxElementDetail = {
|
|
1269
|
+
tagName: string;
|
|
1270
|
+
line: number;
|
|
1271
|
+
attributes: ReactJsxAttributeDetail[];
|
|
1272
|
+
};
|
|
1273
|
+
/**
|
|
1274
|
+
* The per-file `file-header` fact — the leading documentation comment a file
|
|
1275
|
+
* carries (or `null` when there is none). The producer runs the legacy
|
|
1276
|
+
* `getFileDocumentation` walk (the AST root's first child, or the comment
|
|
1277
|
+
* preceding it) and projects just the trimmed text; the `file-documentation`
|
|
1278
|
+
* rule re-applies `isFileHeaderDoc` (a `@fileoverview`/`@file`/`@module`/
|
|
1279
|
+
* `@overview`/`@purpose` marker) so the *classification* — "is this comment a
|
|
1280
|
+
* file header, or a license block?" — stays the rule's, not the producer's.
|
|
1281
|
+
*/
|
|
1282
|
+
export type FileHeaderFact = {
|
|
1283
|
+
file: string;
|
|
1284
|
+
/** The trimmed leading comment text, or null when the file has none. */
|
|
1285
|
+
headerDoc: string | null;
|
|
1286
|
+
};
|
|
1287
|
+
/**
|
|
1288
|
+
* The per-file `code-block` fact — the serializable projection of the two things
|
|
1289
|
+
* `UniversalDRYAnalyzer` extracted from an AST: *blocks* (function/class/method/
|
|
1290
|
+
* control-flow spans, with the normalized hash and structural skeleton the
|
|
1291
|
+
* duplicate rules compare) and *shape fragments* (an object literal's field
|
|
1292
|
+
* names or a call chain's method names, which `similar-expression` compares).
|
|
1293
|
+
*
|
|
1294
|
+
* One fact kind carries both because the three DRY rules share the one walk; the
|
|
1295
|
+
* `kind` discriminator is the split the rule reads. The producer computes `hash`
|
|
1296
|
+
* and `structuralSkeleton` with the default normalization (comments/whitespace
|
|
1297
|
+
* ignored) but applies no threshold and no dedup — `minLineThreshold`,
|
|
1298
|
+
* `similarityThreshold`, `minShapeNames`, `excludePatterns`, the check-gates and
|
|
1299
|
+
* both dedup passes are the rules', re-applied over this plain data in the
|
|
1300
|
+
* legacy order (filter → dedupe → compare).
|
|
1301
|
+
*/
|
|
1302
|
+
export type CodeBlockFact = CodeBlockBlock | CodeBlockFragment;
|
|
1303
|
+
/** A code block: an extractable span, with the duplicate rules' comparison keys. */
|
|
1304
|
+
export type CodeBlockBlock = {
|
|
1305
|
+
kind: 'block';
|
|
1306
|
+
file: string;
|
|
1307
|
+
nodeType: string;
|
|
1308
|
+
start: {
|
|
1309
|
+
line: number;
|
|
1310
|
+
column: number;
|
|
1311
|
+
};
|
|
1312
|
+
end: {
|
|
1313
|
+
line: number;
|
|
1314
|
+
column: number;
|
|
1315
|
+
};
|
|
1316
|
+
text: string;
|
|
1317
|
+
/** SHA-256 of the normalized text (exact-duplicate grouping key). */
|
|
1318
|
+
hash: string;
|
|
1319
|
+
/** Token-kind skeleton (identifiers→ID, literals→LIT) for Jaccard similarity. */
|
|
1320
|
+
structuralSkeleton: string;
|
|
1321
|
+
lineCount: number;
|
|
1322
|
+
};
|
|
1323
|
+
/** A shape fragment: an object literal's fields or a call chain's methods. */
|
|
1324
|
+
export type CodeBlockFragment = {
|
|
1325
|
+
kind: 'fragment';
|
|
1326
|
+
file: string;
|
|
1327
|
+
/** `'object'` for an object literal, `'chain'` for a call chain. */
|
|
1328
|
+
fragmentKind: 'object' | 'chain';
|
|
1329
|
+
/** Object literals only: the assignment/declaration target (chains leave it undefined). */
|
|
1330
|
+
target?: string;
|
|
1331
|
+
/** Field names (object) or method names (chain), in source order. */
|
|
1332
|
+
names: string[];
|
|
1333
|
+
/** Raw source text, used for the fix patch. */
|
|
1334
|
+
text: string;
|
|
1335
|
+
start: {
|
|
1336
|
+
line: number;
|
|
1337
|
+
column: number;
|
|
1338
|
+
};
|
|
1339
|
+
end: {
|
|
1340
|
+
line: number;
|
|
1341
|
+
column: number;
|
|
1342
|
+
};
|
|
1343
|
+
};
|
|
1344
|
+
/**
|
|
1345
|
+
* The recursive JSON value universe — exactly what `JSON.parse` can produce.
|
|
1346
|
+
* It is a plain-data tree (no functions, no class instances), so it satisfies
|
|
1347
|
+
* §4's `Serializable` arm and a parsed JSON document can be a fact. Unlike
|
|
1348
|
+
* `Serializable`'s permissive `{ readonly [k: string]: Serializable }` object
|
|
1349
|
+
* arm, this union is deliberately exhaustive: it is the value set the JSON
|
|
1350
|
+
* grammar admits, so a JSON document never carries a `Date`, `Map`, or other
|
|
1351
|
+
* non-JSON value through a fact boundary.
|
|
1352
|
+
*/
|
|
1353
|
+
export type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
|
|
1354
|
+
readonly [k: string]: JsonValue;
|
|
1355
|
+
};
|
|
1356
|
+
/**
|
|
1357
|
+
* One parsed JSON document, as the `json-document` producer projects it. The
|
|
1358
|
+
* producer `JSON.parse`s the file's `.source` and stores the raw value (or
|
|
1359
|
+
* `null` on a parse failure) — matching the legacy schema reducer's `readJson`,
|
|
1360
|
+
* which returned `null` for a parse error, the literal `null`, and any
|
|
1361
|
+
* non-object value alike. The corpus `schema-validations` processor re-applies
|
|
1362
|
+
* the `object`-only filter (an array/string/number/boolean document reads back
|
|
1363
|
+
* as `null`), so the two paths stay byte-identical on the value the legacy
|
|
1364
|
+
* `analyzeJsonSchemas` consumed.
|
|
1365
|
+
*/
|
|
1366
|
+
export type JsonDocumentFact = {
|
|
1367
|
+
file: string;
|
|
1368
|
+
/** The parsed JSON value, or null when the file is invalid or a non-object. */
|
|
1369
|
+
json: JsonValue | null;
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* One JSON-schema validation outcome, as the `schema-validations` corpus
|
|
1373
|
+
* processor projects it. This is the serializable projection of a legacy
|
|
1374
|
+
* `analyzeJsonSchemas` violation — the same `(rule, file, severity, message)`
|
|
1375
|
+
* plus the `line:1, column:1` the JSON visitor hardcoded (JSON files have no
|
|
1376
|
+
* AST position the old path used). The 17 schema-json rules filter this fact by
|
|
1377
|
+
* their own rule id and project it to `Finding`: the classification (which rule
|
|
1378
|
+
* fired, at what severity, with what message) is the processor's, re-homed
|
|
1379
|
+
* verbatim from the legacy free functions, so each rule is a thin projection.
|
|
1380
|
+
*/
|
|
1381
|
+
export type SchemaValidationFact = {
|
|
1382
|
+
rule: string;
|
|
1383
|
+
file: string;
|
|
1384
|
+
line: number;
|
|
1385
|
+
column: number;
|
|
1386
|
+
severity: import('../types.js').Severity;
|
|
1387
|
+
message: string;
|
|
1388
|
+
};
|
|
1389
|
+
/**
|
|
1390
|
+
* One file's import specifiers and export declaration, as the `file-imports`
|
|
1391
|
+
* producer extracts it (§8 reachability). The serializable projection of the
|
|
1392
|
+
* legacy `ClFileInfo` the cross-language visitor emitted alongside its entities:
|
|
1393
|
+
* the resolved static import sources, whether the file exposes any symbols
|
|
1394
|
+
* (TS/JS `export_statement`; Go capitalized top-level names), and the
|
|
1395
|
+
* computed-specifier dynamic imports that cannot become an import edge.
|
|
1396
|
+
* `unreferenced-module` reads this fact plus the corpus `reachability` fact.
|
|
1397
|
+
*/
|
|
1398
|
+
export type FileImportsFact = {
|
|
1399
|
+
file: string;
|
|
1400
|
+
/** Resolved static import specifiers (quotes stripped), re-exports included. */
|
|
1401
|
+
imports: string[];
|
|
1402
|
+
/** True when the file exposes symbols to importers (TS/JS `export`, Go public). */
|
|
1403
|
+
hasExports: boolean;
|
|
1404
|
+
/** Dynamic `import()`/`require()` with a computed (non-static) specifier. */
|
|
1405
|
+
unresolvedDynamicImports: ReadonlyArray<{
|
|
1406
|
+
line: number;
|
|
1407
|
+
expression: string;
|
|
1408
|
+
}>;
|
|
1409
|
+
};
|
|
1410
|
+
/**
|
|
1411
|
+
* The corpus-level `reachability` fact, reduced from `file-imports` (§8). It
|
|
1412
|
+
* carries the reverse import adjacency (`importersOf`: target file → the files
|
|
1413
|
+
* that import it) and the package.json entry-point set — the two things
|
|
1414
|
+
* `unreferenced-module` needs beyond the per-file `hasExports`/test/entry
|
|
1415
|
+
* filename heuristics. Both are plain data (a `Set`/`Map` are class instances
|
|
1416
|
+
* and cannot satisfy §4's `Serializable` arm), so they are projected to sorted
|
|
1417
|
+
* `string[]` values and `Record<string, string[]>`.
|
|
1418
|
+
*/
|
|
1419
|
+
export type ReachabilityFact = {
|
|
1420
|
+
/** Absolute target path → the absolute paths that import it (sorted, deduped). */
|
|
1421
|
+
importersOf: Record<string, string[]>;
|
|
1422
|
+
/** package.json entry points (facade-expanded), absolute — entry points, not dead. */
|
|
1423
|
+
packageEntryPoints: string[];
|
|
1424
|
+
};
|
|
1425
|
+
/**
|
|
1426
|
+
* One Go type declaration (a named struct or a named interface), as the
|
|
1427
|
+
* `type-declarations` producer projects it (§9). The serializable projection of
|
|
1428
|
+
* the Go binary's `Struct`/`Interface` extracts — the name, 1-based start line,
|
|
1429
|
+
* and the member count the size rules threshold on:
|
|
1430
|
+
*
|
|
1431
|
+
* - a struct's `fieldCount` is the *expanded* field-name count (a
|
|
1432
|
+
* `GroupA, GroupB, GroupC int` field is three, an embedded `Embedded` field
|
|
1433
|
+
* is one), matching the Go binary's `len(structType.Fields.List)` expansion;
|
|
1434
|
+
* - an interface's `methodCount` is its named `method_elem` count — embedded
|
|
1435
|
+
* types are not methods, matching the Go binary's `len(method.Names) > 0`
|
|
1436
|
+
* filter.
|
|
1437
|
+
*
|
|
1438
|
+
* `struct-size` (fieldCount > 15) and the Go arm of `interface-size`
|
|
1439
|
+
* (methodCount > 10) read this fact. Anonymous struct/interface literals are
|
|
1440
|
+
* never `type_spec` nodes, so they are absent here (the Go binary likewise only
|
|
1441
|
+
* extracts named `*ast.TypeSpec` declarations).
|
|
1442
|
+
*/
|
|
1443
|
+
export type TypeDeclarationsFact = {
|
|
1444
|
+
kind: 'struct';
|
|
1445
|
+
file: string;
|
|
1446
|
+
name: string;
|
|
1447
|
+
line: number;
|
|
1448
|
+
fieldCount: number;
|
|
1449
|
+
} | {
|
|
1450
|
+
kind: 'interface';
|
|
1451
|
+
file: string;
|
|
1452
|
+
name: string;
|
|
1453
|
+
line: number;
|
|
1454
|
+
methodCount: number;
|
|
1455
|
+
};
|
|
1456
|
+
/**
|
|
1457
|
+
* One Go function/method's size + behaviour metrics, as the `go-functions`
|
|
1458
|
+
* producer projects it (§9). The serializable projection of the Go binary's
|
|
1459
|
+
* `Function` extract for the two rules that read it:
|
|
1460
|
+
*
|
|
1461
|
+
* - `function-size` (complexity > 20 AND returnCount > 2 AND
|
|
1462
|
+
* parameterCount > 6 — the Go binary's AND-combined size signal);
|
|
1463
|
+
* - `liskov-substitution` (isMethod && callsPanic — a method whose body has a
|
|
1464
|
+
* direct `panic()` call).
|
|
1465
|
+
*
|
|
1466
|
+
* `line` is the `func` keyword's 1-based line (`funcDecl.Pos().Line`).
|
|
1467
|
+
* `complexity` is the Go binary's `calculateComplexity`: base 1, +1 per
|
|
1468
|
+
* if/for/range/switch/type-switch and per case/default clause. `parameterCount`
|
|
1469
|
+
* is expanded (a `A, B, C int` declaration is three); `returnCount` is the
|
|
1470
|
+
* number of result entries (0 for none, 1 for a single result, N for a
|
|
1471
|
+
* parenthesised list). Test functions (`Test`/`Benchmark`/`Example`/`Fuzz`
|
|
1472
|
+
* prefix) are excluded — the Go binary's `ExtractFunctions` skips them.
|
|
1473
|
+
*/
|
|
1474
|
+
export type GoFunctionFact = {
|
|
1475
|
+
file: string;
|
|
1476
|
+
name: string;
|
|
1477
|
+
line: number;
|
|
1478
|
+
isMethod: boolean;
|
|
1479
|
+
parameterCount: number;
|
|
1480
|
+
returnCount: number;
|
|
1481
|
+
complexity: number;
|
|
1482
|
+
callsPanic: boolean;
|
|
1483
|
+
};
|
|
1484
|
+
/**
|
|
1485
|
+
* One Go `switch` / `type switch` statement's case-clause count, as the
|
|
1486
|
+
* `go-switches` producer projects it (§9). `caseCount` counts `case` and
|
|
1487
|
+
* `default` clauses alike (the Go binary's `countSwitchCases` / `countTypeSwitchCases`
|
|
1488
|
+
* iterate `Body.List`, where a `default:` is a `CaseClause` too). `line` is the
|
|
1489
|
+
* `switch` keyword's 1-based line (`node.Pos().Line`). `switch-size` flags a
|
|
1490
|
+
* count > 8.
|
|
1491
|
+
*/
|
|
1492
|
+
export type GoSwitchFact = {
|
|
1493
|
+
file: string;
|
|
1494
|
+
line: number;
|
|
1495
|
+
caseCount: number;
|
|
1496
|
+
kind: 'switch' | 'type-switch';
|
|
1497
|
+
};
|
|
1498
|
+
/**
|
|
1499
|
+
* One Go function's error-binding positions, as the `error-bindings` producer
|
|
1500
|
+
* projects them (§9). The serializable projection of the Go binary's
|
|
1501
|
+
* `functionDropsError` inputs — the per-function source positions of every
|
|
1502
|
+
* `err` binding-from-a-call and every "checking" use, plus the named-return
|
|
1503
|
+
* signal the bare-`return` arm needs. The `error-handling` rule re-applies the
|
|
1504
|
+
* position-ordering verdict (an assign is dropped iff no check falls strictly
|
|
1505
|
+
* after it and before the next assign) over plain data.
|
|
1506
|
+
*
|
|
1507
|
+
* Positions are byte offsets (`ASTNode.range[0]`), so they carry the same total
|
|
1508
|
+
* order the Go binary's `token.Pos` byte offsets did. `line` is the `func`
|
|
1509
|
+
* keyword's 1-based line (`funcDecl.Pos().Line`). Test functions
|
|
1510
|
+
* (`Test`/`Benchmark`/`Example`/`Fuzz`) are excluded — the Go binary's walk
|
|
1511
|
+
* skips them. `hasNamedErr` is the `funcDeclHasNamedErr` result: the function
|
|
1512
|
+
* names an `err` result, so a bare `return` counts as a check.
|
|
1513
|
+
*/
|
|
1514
|
+
export type ErrorBindingsFact = {
|
|
1515
|
+
file: string;
|
|
1516
|
+
name: string;
|
|
1517
|
+
line: number;
|
|
1518
|
+
hasNamedErr: boolean;
|
|
1519
|
+
/** Byte offsets of `err` identifiers bound from a call-bearing assignment. */
|
|
1520
|
+
assignPositions: number[];
|
|
1521
|
+
/** Byte offsets of `err` checking uses (compare / return / pass / ignore). */
|
|
1522
|
+
checkPositions: number[];
|
|
1523
|
+
};
|
|
1524
|
+
/**
|
|
1525
|
+
* One Go function's goroutine-synchronization signal, as the
|
|
1526
|
+
* `concurrency-primitives` producer projects it (§9). The serializable
|
|
1527
|
+
* projection of the Go binary's `analyzeConcurrency` — whether the body has a
|
|
1528
|
+
* `go` statement and whether it carries any synchronization signal (a
|
|
1529
|
+
* sync.Add/Done/Wait/Lock/Unlock/RLock/RUnlock selector call, or a channel
|
|
1530
|
+
* send/receive). The `concurrency` rule re-applies the `hasGo && !hasSync`
|
|
1531
|
+
* verdict. `line` is the `func` keyword's 1-based line; test functions are
|
|
1532
|
+
* excluded.
|
|
1533
|
+
*/
|
|
1534
|
+
export type ConcurrencyPrimitivesFact = {
|
|
1535
|
+
file: string;
|
|
1536
|
+
name: string;
|
|
1537
|
+
line: number;
|
|
1538
|
+
/** A `go` statement anywhere in the body. */
|
|
1539
|
+
hasGo: boolean;
|
|
1540
|
+
/** Any sync primitive or channel send/receive in the body. */
|
|
1541
|
+
hasSync: boolean;
|
|
1542
|
+
};
|
|
1543
|
+
/**
|
|
1544
|
+
* One Go function's channel-operation counts, as the `channel-operations`
|
|
1545
|
+
* producer projects it (§9). The serializable projection of the Go binary's
|
|
1546
|
+
* `deadlockChannel` inputs — the unbuffered-channel names (`make(chan T)` with
|
|
1547
|
+
* one argument) and the send/receive counts per bare-identifier channel name,
|
|
1548
|
+
* plus the `go`-statement signal that clears the verdict. The
|
|
1549
|
+
* `channel-deadlock` rule re-applies the `hasGo → ""`, `ops[name] >= 2` verdict
|
|
1550
|
+
* over plain data. `line` is the `func` keyword's 1-based line; test functions
|
|
1551
|
+
* are excluded.
|
|
1552
|
+
*/
|
|
1553
|
+
export type ChannelOperationsFact = {
|
|
1554
|
+
file: string;
|
|
1555
|
+
name: string;
|
|
1556
|
+
line: number;
|
|
1557
|
+
/** A `go` statement anywhere in the body (makes the deadlock unprovable). */
|
|
1558
|
+
hasGo: boolean;
|
|
1559
|
+
/** Channel names assigned `make(chan T)` (unbuffered). */
|
|
1560
|
+
unbuffered: string[];
|
|
1561
|
+
/** Send/receive counts per bare-identifier channel name. */
|
|
1562
|
+
ops: Record<string, number>;
|
|
1563
|
+
};
|
|
1564
|
+
/**
|
|
1565
|
+
* One Go file's package-scope declarations, as the `go-package-bindings`
|
|
1566
|
+
* producer projects them (Spec 70 Item 4, 2a). The per-file half of
|
|
1567
|
+
* `buildGoPackageBindings` (`goResolution.ts`): top-level `function_declaration` /
|
|
1568
|
+
* `method_declaration` (name + return type), `type_declaration` → `type_spec`
|
|
1569
|
+
* (name), and `var_declaration` → `var_spec` (name + type + value), first-wins
|
|
1570
|
+
* deduped by name within the file. The cross-file receiver-provenance fixed
|
|
1571
|
+
* point groups these by directory (a Go package is directory-scoped) and merges
|
|
1572
|
+
* first-wins to rebuild the package symbol table — the exact
|
|
1573
|
+
* `Map<string, GoBinding>` the legacy `resolveCorpusReceivers` fed its Go arm.
|
|
1574
|
+
*
|
|
1575
|
+
* `bindings` is the serializable projection of `Map<string, GoBinding>` — one
|
|
1576
|
+
* `{name, binding}` pair per entry. `GoPackageBindingDetail` and
|
|
1577
|
+
* `GoPackageValueDescriptor` are object-literal `type` aliases (not the
|
|
1578
|
+
* `GoBinding` / `GoValueDescriptor` `interface`s they project, which do not
|
|
1579
|
+
* satisfy §4's `Serializable` index-signature arm); they carry the same fields
|
|
1580
|
+
* byte-for-byte so the fixed point rehydrates a `GoBinding` with no translation.
|
|
1581
|
+
*/
|
|
1582
|
+
export type GoPackageBindingFact = {
|
|
1583
|
+
file: string;
|
|
1584
|
+
bindings: readonly GoPackageBinding[];
|
|
1585
|
+
};
|
|
1586
|
+
/** One package-scope binding: the declaration name keyed to its `GoBinding`. */
|
|
1587
|
+
export type GoPackageBinding = {
|
|
1588
|
+
name: string;
|
|
1589
|
+
binding: GoPackageBindingDetail;
|
|
1590
|
+
};
|
|
1591
|
+
/**
|
|
1592
|
+
* The serializable projection of `GoBinding` (`goResolution.ts`). `kind` mirrors
|
|
1593
|
+
* the full `GoBindingKind` union — package scope only ever produces
|
|
1594
|
+
* `function`/`method`/`type`/`variable`, but keeping the wider union makes the
|
|
1595
|
+
* projection assignable from any `GoBinding` with no narrowing.
|
|
1596
|
+
*/
|
|
1597
|
+
export type GoPackageBindingDetail = {
|
|
1598
|
+
kind: GoPackageBindingKind;
|
|
1599
|
+
/** Import source path (kind === 'import'). */
|
|
1600
|
+
source?: string;
|
|
1601
|
+
/** Type-annotation text (variable / parameter / field). */
|
|
1602
|
+
typeText?: string;
|
|
1603
|
+
/** Return-type text (function / method) — `(*sql.DB, error)`. */
|
|
1604
|
+
returnTypeText?: string;
|
|
1605
|
+
/** Initializer / value expression (variable / field), serializable. */
|
|
1606
|
+
value?: GoPackageValueDescriptor;
|
|
1607
|
+
};
|
|
1608
|
+
/** The `GoBindingKind` union, mirrored so the projection needs no import. */
|
|
1609
|
+
export type GoPackageBindingKind = 'import' | 'variable' | 'parameter' | 'field' | 'function' | 'method' | 'type' | 'const';
|
|
1610
|
+
/**
|
|
1611
|
+
* The serializable projection of `GoValueDescriptor` (`goResolution.ts`) — the
|
|
1612
|
+
* node type, its text, and the `function`/`operand`/`type` named children the
|
|
1613
|
+
* classifier reads, recursively bounded (depth 4) in the producer.
|
|
1614
|
+
*/
|
|
1615
|
+
export type GoPackageValueDescriptor = {
|
|
1616
|
+
type: string;
|
|
1617
|
+
text: string;
|
|
1618
|
+
function?: GoPackageValueDescriptor | null;
|
|
1619
|
+
operand?: GoPackageValueDescriptor | null;
|
|
1620
|
+
typeNode?: GoPackageValueDescriptor | null;
|
|
1621
|
+
};
|
|
1622
|
+
/**
|
|
1623
|
+
* One file's within-file-provenance projection, as the `within-file-provenance`
|
|
1624
|
+
* producer serializes it (Spec 70 Item 4 / Item 3). This is the *extract* half
|
|
1625
|
+
* of the TS/Go within-file-provenance split — everything the fixed point reads,
|
|
1626
|
+
* projected with no AST and no live node — so the corpus `receiver-provenance`
|
|
1627
|
+
* producer can re-derive a file's DB-provenanced names without re-parsing it.
|
|
1628
|
+
*
|
|
1629
|
+
* Tagged by `format` so the corpus producer rehydrates the projection into the
|
|
1630
|
+
* owning format's `classify` input. The descriptor pieces (`TsExpressionDescriptor`,
|
|
1631
|
+
* `PropagationRule`, `ClassCall`) are reused *as* the serializable projection:
|
|
1632
|
+
* they are already closed object-literal `type`s with no `interface`/`Map`/`Set`
|
|
1633
|
+
* member, so they satisfy §4's `Serializable` as-is (the `GoPackageValueDescriptor`
|
|
1634
|
+
* parallel exists only because `GoValueDescriptor` is an `interface`). The two
|
|
1635
|
+
* non-serializable members of `TsWithinFileProvenanceExtract` — `seeds`
|
|
1636
|
+
* (`Map<string, ProvenanceEvidence>`) and `localFunctions` (`Set<string>`) — and
|
|
1637
|
+
* the two `interface`s (`OwnCall`, `ProvenanceEvidence`) are projected here as
|
|
1638
|
+
* arrays and `type` aliases respectively.
|
|
1639
|
+
*/
|
|
1640
|
+
export type WithinFileProvenanceFact = {
|
|
1641
|
+
readonly file: string;
|
|
1642
|
+
readonly format: 'typescript' | 'tsx' | 'javascript';
|
|
1643
|
+
readonly ts: TsWithinFileProvenanceProjection;
|
|
1644
|
+
} | {
|
|
1645
|
+
readonly file: string;
|
|
1646
|
+
readonly format: 'go';
|
|
1647
|
+
readonly go: GoWithinFileProvenanceProjection;
|
|
1648
|
+
};
|
|
1649
|
+
/** The serializable TS-family extract projection. */
|
|
1650
|
+
export type TsWithinFileProvenanceProjection = {
|
|
1651
|
+
readonly seeds: readonly ProvenanceEvidenceFact[];
|
|
1652
|
+
readonly bindings: readonly TsBindingFact[];
|
|
1653
|
+
readonly localFunctions: readonly string[];
|
|
1654
|
+
readonly propagationRules: readonly PropagationRule[];
|
|
1655
|
+
readonly wrapperFunctions: readonly {
|
|
1656
|
+
readonly name: string;
|
|
1657
|
+
readonly ownCalls: readonly WithinFileOwnCall[];
|
|
1658
|
+
}[];
|
|
1659
|
+
readonly wrapperClasses: readonly {
|
|
1660
|
+
readonly name: string;
|
|
1661
|
+
readonly classCalls: readonly ClassCall[];
|
|
1662
|
+
}[];
|
|
1663
|
+
readonly returningFunctions: readonly {
|
|
1664
|
+
readonly name: string;
|
|
1665
|
+
readonly returnExprs: readonly TsExpressionDescriptor[];
|
|
1666
|
+
}[];
|
|
1667
|
+
readonly interfaceFields: readonly InterfaceFieldFact[];
|
|
1668
|
+
};
|
|
1669
|
+
/**
|
|
1670
|
+
* The serializable projection of `extractInterfaceFields` (`receiverRoot.ts`) —
|
|
1671
|
+
* one interface/type-alias name → its declared field name → type-text pairs, for
|
|
1672
|
+
* the member-chain resolution arm (Spec 70 decision B3). `interface Env { DB:
|
|
1673
|
+
* D1Database }` projects as `{ name: 'Env', fields: [{ name: 'DB', typeText:
|
|
1674
|
+
* 'D1Database' }] }`.
|
|
1675
|
+
*/
|
|
1676
|
+
export type InterfaceFieldFact = {
|
|
1677
|
+
readonly name: string;
|
|
1678
|
+
readonly fields: readonly {
|
|
1679
|
+
readonly name: string;
|
|
1680
|
+
readonly typeText: string;
|
|
1681
|
+
}[];
|
|
1682
|
+
};
|
|
1683
|
+
/**
|
|
1684
|
+
* The serializable projection of `ProvenanceEvidence` (`provenance.ts`) — an
|
|
1685
|
+
* object-literal `type`, not the `interface` it projects, so it satisfies §4.
|
|
1686
|
+
* `reason` carries the `ProvenanceReason` union; the rehydrator casts it back
|
|
1687
|
+
* (it is a string literal at runtime, so the cast is lossless).
|
|
1688
|
+
*/
|
|
1689
|
+
export type ProvenanceEvidenceFact = {
|
|
1690
|
+
readonly identifier: string;
|
|
1691
|
+
readonly reason: ProvenanceReason;
|
|
1692
|
+
readonly source: string;
|
|
1693
|
+
readonly chain: readonly string[];
|
|
1694
|
+
readonly packageName?: string;
|
|
1695
|
+
};
|
|
1696
|
+
/** The serializable projection of `OwnCall` (`tsExpressionDescriptor.ts`). */
|
|
1697
|
+
export type WithinFileOwnCall = {
|
|
1698
|
+
readonly callee: TsExpressionDescriptor | null;
|
|
1699
|
+
readonly isD1Rest: boolean;
|
|
1700
|
+
};
|
|
1701
|
+
/**
|
|
1702
|
+
* The serializable Go extract projection: the full per-file binding env
|
|
1703
|
+
* `buildGoBindingEnv` produces (imports + parameters + short-vars + fields +
|
|
1704
|
+
* functions + types — *not* the package-scope `go-package-bindings` set), keyed
|
|
1705
|
+
* as name→binding pairs. `GoPackageBinding` already projects the full
|
|
1706
|
+
* `GoBinding` union (`GoPackageBindingDetail.kind` is the 7-member
|
|
1707
|
+
* `GoPackageBindingKind`), so the same projection carries a file-local binding
|
|
1708
|
+
* (parameter/short-var/field) with no narrowing.
|
|
1709
|
+
*/
|
|
1710
|
+
export type GoWithinFileProvenanceProjection = {
|
|
1711
|
+
readonly imports: readonly {
|
|
1712
|
+
readonly name: string;
|
|
1713
|
+
readonly source: string;
|
|
1714
|
+
}[];
|
|
1715
|
+
readonly bindings: readonly GoPackageBinding[];
|
|
1716
|
+
};
|
|
1717
|
+
/**
|
|
1718
|
+
* The per-file receiver-resolution inputs the corpus-side `dbProvenanced`
|
|
1719
|
+
* re-derivation needs beyond the within-file extract (Spec 70 Item 4, step 3):
|
|
1720
|
+
* the TS binding environment (`identifyHandle` reads it for declaration
|
|
1721
|
+
* resolution), the R3 sites (`applyR3FromSites` re-folds `identifyHandle` over
|
|
1722
|
+
* them once the cross-file seed is known), and the DB-shaped activity set
|
|
1723
|
+
* (`passesFileGate`'s `dbActivity` signal — provenance-free, so it must be
|
|
1724
|
+
* extracted while the AST lives, not re-derived). Go files carry none of these:
|
|
1725
|
+
* their binding/import env is already in the Go arm of `within-file-provenance`
|
|
1726
|
+
* and `go-package-bindings`, and both `collectDbActivity` and `extractR3Sites`
|
|
1727
|
+
* return empty for Go, so this fact is TS-family-only.
|
|
1728
|
+
*/
|
|
1729
|
+
export type ReceiverActivityFact = {
|
|
1730
|
+
readonly file: string;
|
|
1731
|
+
readonly format: 'typescript' | 'tsx' | 'javascript';
|
|
1732
|
+
readonly bindings: readonly TsBindingFact[];
|
|
1733
|
+
readonly r3Sites: readonly ReceiverActivityR3Site[];
|
|
1734
|
+
readonly dbActivity: readonly string[];
|
|
1735
|
+
};
|
|
1736
|
+
/** One TS binding projected serializable: the `Binding` interface's fields as a
|
|
1737
|
+
* closed object-literal `type` (`ValueDescriptor` is already a serializable
|
|
1738
|
+
* `type`). */
|
|
1739
|
+
export type TsBindingFact = {
|
|
1740
|
+
readonly name: string;
|
|
1741
|
+
readonly kind: BindingKind;
|
|
1742
|
+
readonly source?: string;
|
|
1743
|
+
readonly importKind?: ImportKind;
|
|
1744
|
+
readonly typeText?: string;
|
|
1745
|
+
readonly value?: ValueDescriptor;
|
|
1746
|
+
/** The binding's enclosing scope (start byte offset of the enclosing function,
|
|
1747
|
+
* `0` for top-level). Carried so the corpus-side classifier can key bindings
|
|
1748
|
+
* on scope rather than name alone. */
|
|
1749
|
+
readonly scope?: number;
|
|
1750
|
+
};
|
|
1751
|
+
/** The serializable projection of `R3Site` (`provenance.ts`, an `interface`). */
|
|
1752
|
+
export type ReceiverActivityR3Site = {
|
|
1753
|
+
readonly root: string;
|
|
1754
|
+
readonly receiver: string;
|
|
1755
|
+
readonly method: string;
|
|
1756
|
+
readonly sqlArgument: string;
|
|
1757
|
+
readonly thisField: boolean;
|
|
1758
|
+
readonly thisHeritage: string | null;
|
|
1759
|
+
};
|
|
1760
|
+
/**
|
|
1761
|
+
* The cross-file receiver-provenance fixed point (Spec 70 Item 4, 2a), re-derived
|
|
1762
|
+
* by the `receiver-provenance` corpus producer from the four additive file facts
|
|
1763
|
+
* (`within-file-provenance`, `import-specifiers`, `export-symbols`,
|
|
1764
|
+
* `go-package-bindings`) with no AST. This is the phase-side replacement for
|
|
1765
|
+
* `resolveCorpusReceivers`' `fileProvenance` + `unresolvedImports` halves — the
|
|
1766
|
+
* per-file DB-provenanced identifiers the four receiver consumers read, plus the
|
|
1767
|
+
* unresolved DB-looking imports the `cannot-fire` diagnostic names. `fileExports`
|
|
1768
|
+
* (the fixed point's internal Phase-2 intermediate) is *not* carried: no consumer
|
|
1769
|
+
* reads it, and the parity assertion compares it through the producer's exported
|
|
1770
|
+
* core, not the fact.
|
|
1771
|
+
*/
|
|
1772
|
+
export type ReceiverProvenanceFact = {
|
|
1773
|
+
readonly files: readonly ReceiverProvenanceFileFact[];
|
|
1774
|
+
readonly unresolvedImports: readonly UnresolvedImportFact[];
|
|
1775
|
+
};
|
|
1776
|
+
/** One file's fixed-point DB-provenanced identifiers (the serializable
|
|
1777
|
+
* `Map<string, ProvenanceEvidence>` = `FileProvenance[file]`). */
|
|
1778
|
+
export type ReceiverProvenanceFileFact = {
|
|
1779
|
+
readonly file: string;
|
|
1780
|
+
readonly provenance: readonly ProvenanceEvidenceFact[];
|
|
1781
|
+
};
|
|
1782
|
+
/** An import whose specifier could not be resolved to an in-repo file (the
|
|
1783
|
+
* `cannot-fire` accounting signal), the serializable projection of
|
|
1784
|
+
* `UnresolvedImport` (`receiverResolution.ts`). */
|
|
1785
|
+
export type UnresolvedImportFact = {
|
|
1786
|
+
readonly importer: string;
|
|
1787
|
+
readonly source: string;
|
|
1788
|
+
readonly names: readonly string[];
|
|
1789
|
+
};
|
|
1790
|
+
/**
|
|
1791
|
+
* The index-backed call-graph fact (§2.2) — the function catalog and the
|
|
1792
|
+
* function→function call edges the legacy `graph_cache` carried, read by the
|
|
1793
|
+
* corpus `call-graph` producer. Plain-data projection: the corpus `IndexHandle`
|
|
1794
|
+
* is read here and its rows collapse to data (`id`, `name`, `filePath`,
|
|
1795
|
+
* `lineNumber`, `isExported`), so no live handle survives past the corpus
|
|
1796
|
+
* boundary. `functions` is read from the index `functions` table, not projected
|
|
1797
|
+
* from the `function-index` fact — the one field that table cannot supply without
|
|
1798
|
+
* the sync path's second parse is `usedImports`, which the producer joins from the
|
|
1799
|
+
* `function-index` fact by the `(file, name, line)` identity the index
|
|
1800
|
+
* `conflictKey` uses (Item 4 2b). `callEdges` are the call-graph edges (`fromId`
|
|
1801
|
+
* → `toId`) read from the `graph_cache` index table, not rebuilt from
|
|
1802
|
+
* `function-index`'s `functionCalls` name join (that re-derivation would turn on
|
|
1803
|
+
* depth-1 expansion during a plain audit, where the sync-only `graph_cache` is
|
|
1804
|
+
* empty).
|
|
1805
|
+
*
|
|
1806
|
+
* `lineNumber` is the `functions` table's `line_number` (the uncovered-risk
|
|
1807
|
+
* ranking reads it as the finding anchor). `usedImports` is the `function-index`
|
|
1808
|
+
* `usedImports` array carried verbatim from the fact. `isExported` is the boolean
|
|
1809
|
+
* projection of the `functions` table's `is_exported` flag.
|
|
1810
|
+
*/
|
|
1811
|
+
export type CallGraphFact = {
|
|
1812
|
+
functions: ReadonlyArray<{
|
|
1813
|
+
id: number;
|
|
1814
|
+
name: string;
|
|
1815
|
+
filePath: string;
|
|
1816
|
+
lineNumber: number | null;
|
|
1817
|
+
usedImports: readonly string[];
|
|
1818
|
+
isExported: boolean;
|
|
1819
|
+
}>;
|
|
1820
|
+
callEdges: ReadonlyArray<{
|
|
1821
|
+
fromId: number;
|
|
1822
|
+
toId: number;
|
|
1823
|
+
}>;
|
|
1824
|
+
};
|
|
1825
|
+
/**
|
|
1826
|
+
* One function whose full source span contains `.batch(` (a Cloudflare D1 /
|
|
1827
|
+
* SQLite transaction-batching commit). The per-file `batch-functions` producer
|
|
1828
|
+
* walks function nodes and projects only the location span; `multi-table-write`
|
|
1829
|
+
* checks whether a writer's line falls inside one of these spans to skip the
|
|
1830
|
+
* transaction-boundary flag — the legacy `enclosingFunctionBatches` re-parse
|
|
1831
|
+
* (`readFileSync` + `parseFile` + ancestor walk) re-homed as a fact. A function
|
|
1832
|
+
* is emitted only when its full node range contains `.batch(` (the legacy test),
|
|
1833
|
+
* so containment here is `startLine <= writeLine <= endLine`.
|
|
1834
|
+
*/
|
|
1835
|
+
export type BatchFunctionFact = {
|
|
1836
|
+
file: string;
|
|
1837
|
+
startLine: number;
|
|
1838
|
+
endLine: number;
|
|
1839
|
+
};
|
|
1840
|
+
/**
|
|
1841
|
+
* One `hotspot_scores` row, read by the corpus `hotspot` producer — the
|
|
1842
|
+
* risk-score side of the uncovered-risk ranking. `target` is the
|
|
1843
|
+
* `file_path || ':' || name` composite key the legacy `queryHighRiskFunctions`
|
|
1844
|
+
* LEFT-JOINed on (`hs.type = 'function'`); the rule re-joins it over the
|
|
1845
|
+
* `call-graph` fact's function identity. Plain data: target, type, score only.
|
|
1846
|
+
*/
|
|
1847
|
+
export type HotspotFact = {
|
|
1848
|
+
target: string;
|
|
1849
|
+
type: string;
|
|
1850
|
+
score: number;
|
|
1851
|
+
};
|
|
1852
|
+
/**
|
|
1853
|
+
* The index-backed coverage fact — the `coverage_data` table plus the two
|
|
1854
|
+
* measured-path metadata reads (`source`/`imported_at` LIMIT 1 and the
|
|
1855
|
+
* `last_full_sync_timestamp` meta key for stale-import detection). `entries`
|
|
1856
|
+
* carries the (functionName, filePath, covered) identity projection the legacy
|
|
1857
|
+
* `getUntestedTopDecile`'s `best_coverage` CTE read (covered=1 rows mark a
|
|
1858
|
+
* function as "tested"); `measuredCount` is `COUNT(*) WHERE basis='measured'`
|
|
1859
|
+
* — the dispatcher between the measured and static-reach paths. `lastFullSync`
|
|
1860
|
+
* is `getMeta('last_full_sync_timestamp')` (or null when absent).
|
|
1861
|
+
*/
|
|
1862
|
+
export type CoverageFact = {
|
|
1863
|
+
measuredCount: number;
|
|
1864
|
+
source: string | null;
|
|
1865
|
+
importedAt: string | null;
|
|
1866
|
+
lastFullSync: string | null;
|
|
1867
|
+
entries: ReadonlyArray<{
|
|
1868
|
+
functionName: string;
|
|
1869
|
+
filePath: string;
|
|
1870
|
+
covered: boolean;
|
|
1871
|
+
}>;
|
|
1872
|
+
};
|
|
1873
|
+
/**
|
|
1874
|
+
* The index-backed clone-pair-history fact — the `dry_pair_history` rows the
|
|
1875
|
+
* `dry/diverging-clone` rule's cross-run divergence pass reads. Grouped by
|
|
1876
|
+
* fingerprint (the pair identity `getDryPairs` seeds, stable across runs), each
|
|
1877
|
+
* group carries the per-run similarity series plus the file/line anchors from
|
|
1878
|
+
* its most recent row — the location the legacy Phase 2 read via
|
|
1879
|
+
* `ORDER BY timestamp DESC LIMIT 1`. Plain data only: no AST, no handle.
|
|
1880
|
+
*/
|
|
1881
|
+
export type ClonePairHistoryFact = ReadonlyArray<{
|
|
1882
|
+
fingerprint: string;
|
|
1883
|
+
file1: string;
|
|
1884
|
+
file2: string;
|
|
1885
|
+
line1: number;
|
|
1886
|
+
line2: number;
|
|
1887
|
+
rows: ReadonlyArray<{
|
|
1888
|
+
similarity: number;
|
|
1889
|
+
timestamp: string;
|
|
1890
|
+
}>;
|
|
1891
|
+
}>;
|
|
1892
|
+
/** The serializable value universe. No functions, no class instances. */
|
|
1893
|
+
export type Serializable = string | number | boolean | null | readonly Serializable[] | {
|
|
1894
|
+
readonly [k: string]: Serializable;
|
|
1895
|
+
};
|
|
1896
|
+
/** A rule ID — the canonical slug, the only identity a finding carries. */
|
|
1897
|
+
export type RuleId = string;
|
|
1898
|
+
/** A config threshold key (dot-separated path within a rule's config surface). */
|
|
1899
|
+
export type ThresholdKey = string;
|
|
1900
|
+
/** The resolved threshold values a rule reads at analysis time. */
|
|
1901
|
+
export type ThresholdValues = Readonly<Record<string, unknown>>;
|
|
1902
|
+
/** A single valid/invalid sample (re-exported shape; defined in ruleRegistry). */
|
|
1903
|
+
export type RuleSample = {
|
|
1904
|
+
code: string;
|
|
1905
|
+
nearMiss?: boolean;
|
|
1906
|
+
resolution?: import('../types.js').Resolution;
|
|
1907
|
+
};
|
|
1908
|
+
export type RuleSamples = {
|
|
1909
|
+
valid: RuleSample[];
|
|
1910
|
+
invalid: RuleSample[];
|
|
1911
|
+
};
|
|
1912
|
+
/** The context a rule's `analyze` receives — derived, never chosen. */
|
|
1913
|
+
export type AnalysisContext<N extends Needs> = {
|
|
1914
|
+
readonly facts: {
|
|
1915
|
+
readonly [K in N['facts'][number]]: FactShapes[K];
|
|
1916
|
+
};
|
|
1917
|
+
readonly formats: N['formats'];
|
|
1918
|
+
readonly thresholds: ThresholdValues;
|
|
1919
|
+
};
|
|
1920
|
+
/** One finding, in the unified shape §7 converges on (one `ruleId` field). */
|
|
1921
|
+
export type Finding = {
|
|
1922
|
+
ruleId: RuleId;
|
|
1923
|
+
severity: import('../types.js').Severity;
|
|
1924
|
+
message: string;
|
|
1925
|
+
file: string;
|
|
1926
|
+
line?: number;
|
|
1927
|
+
column?: number;
|
|
1928
|
+
symbol?: string;
|
|
1929
|
+
resolution?: import('../types.js').Resolution;
|
|
1930
|
+
/** Structured text-replacement patch (DRY `duplicate-string-literal`), carried
|
|
1931
|
+
* verbatim so the phase re-emission preserves the pre-migration `fix` surface. */
|
|
1932
|
+
fix?: string | {
|
|
1933
|
+
oldText: string;
|
|
1934
|
+
newText: string;
|
|
1935
|
+
};
|
|
1936
|
+
/** Free-form structured detail carried verbatim into the re-emitted
|
|
1937
|
+
* `Violation.details` (e.g. `styles/undefined-class`'s
|
|
1938
|
+
* `incompleteDefinitions` unread-source list, Spec 45 R5). */
|
|
1939
|
+
details?: string | Record<string, unknown>;
|
|
1940
|
+
};
|
|
1941
|
+
/** A rule definition. `needs` has no optional form and no default. */
|
|
1942
|
+
export interface RuleDefinition<N extends Needs> {
|
|
1943
|
+
readonly id: RuleId;
|
|
1944
|
+
/** The analyzer namespace the rule re-emits into (Spec 68 §15 — replaces the
|
|
1945
|
+
* deleted `RuleRegistryEntry.analyzer`). It is a bucket label, not a
|
|
1946
|
+
* selection gate: config cannot change it, and every rule carries one so the
|
|
1947
|
+
* full analyzer set is a pure function of `MIGRATED_RULES`. */
|
|
1948
|
+
readonly analyzer: string;
|
|
1949
|
+
readonly needs: N;
|
|
1950
|
+
readonly severity: import('../types.js').Severity;
|
|
1951
|
+
readonly message: string;
|
|
1952
|
+
readonly docs: string;
|
|
1953
|
+
readonly thresholds: readonly ThresholdKey[];
|
|
1954
|
+
readonly thresholdRationale?: string;
|
|
1955
|
+
readonly samples: RuleSamples;
|
|
1956
|
+
/** A rule's evaluation over its declared facts. May be async: corpus-shaped
|
|
1957
|
+
* rules (dependency-graph, schema-validator, …) build derived structures the
|
|
1958
|
+
* legacy reducers computed over the index; the phase model awaits each. The
|
|
1959
|
+
* returned findings are still plain data — async does not let a rule reach
|
|
1960
|
+
* an AST, adapter, or source string. */
|
|
1961
|
+
analyze(ctx: AnalysisContext<N>): readonly Finding[] | Promise<readonly Finding[]>;
|
|
1962
|
+
}
|
|
1963
|
+
export type ProcessorId = string;
|
|
1964
|
+
/** A parsed file handed to a per-file processor — the only place an AST lives. */
|
|
1965
|
+
export interface ParsedFile {
|
|
1966
|
+
readonly file: string;
|
|
1967
|
+
readonly format: Format;
|
|
1968
|
+
/** The source text, present so a processor may re-derive position/context. */
|
|
1969
|
+
readonly source: string;
|
|
1970
|
+
/** The parsed tree. Dies with the file — never crosses a phase boundary.
|
|
1971
|
+
* Absent for the text-only `'sql'` and `'markup'` formats (no grammar, no
|
|
1972
|
+
* adapter): their producers (`ddl-declarations.sql`, `style-declarations.markup`)
|
|
1973
|
+
* read `.source`/`.file` only. */
|
|
1974
|
+
readonly ast?: AST;
|
|
1975
|
+
/** The language adapter that parsed this file — the processor's only handle
|
|
1976
|
+
* on the extraction API (`extractFunctions`, `extractClasses`, …). Absent
|
|
1977
|
+
* for `'sql'` and `'markup'`, alongside `ast`. */
|
|
1978
|
+
readonly adapter?: LanguageAdapter;
|
|
1979
|
+
/** The project root this file was parsed under. Optional because the vertical
|
|
1980
|
+
* slice tests parse single fixtures without a project; present on the full
|
|
1981
|
+
* pipeline. Only the style producer reads it (to load the project's Tailwind
|
|
1982
|
+
* theme tokens for utility expansion — a corpus-level context, not per-file). */
|
|
1983
|
+
readonly projectRoot?: string;
|
|
1984
|
+
/** Spec 70 R1 — the corpus's named SQL dialect, threaded to the
|
|
1985
|
+
* `data-access-calls` producer so its SQL-content facts parse rather than
|
|
1986
|
+
* regex. Absent in the slice tests (single fixture, no corpus) — the producer
|
|
1987
|
+
* then runs on the default (null) dialect and SQL facts `cannot-fire`. */
|
|
1988
|
+
readonly sqlDialect?: Dialect | null;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* The adapter-backed subset of {@link ParsedFile}: a file whose format has a
|
|
1992
|
+
* grammar, so `ast` and `adapter` are always present. Every AST-reading
|
|
1993
|
+
* extractor (`file-symbols`, `function-index`, `schema-usage`, the CSS and
|
|
1994
|
+
* source halves of `style-declarations`, `cross-language-entities`,
|
|
1995
|
+
* `data-access-calls`) is only ever registered for adapter formats, so they
|
|
1996
|
+
* narrow their parameter to this; the text-only `sql` format's one producer
|
|
1997
|
+
* (`ddl-declarations`) reads `.source`/`.file` alone and never narrows.
|
|
1998
|
+
*/
|
|
1999
|
+
export type AstFile = ParsedFile & {
|
|
2000
|
+
readonly ast: AST;
|
|
2001
|
+
readonly adapter: LanguageAdapter;
|
|
2002
|
+
};
|
|
2003
|
+
/** The fragment a per-file processor returns for one file. The fragment is the
|
|
2004
|
+
* fact for that file alone, keyed by file so the parent can assemble corpus
|
|
2005
|
+
* facts; the processor must have stripped any tree-sitter node before it
|
|
2006
|
+
* crosses this boundary (the type enforces it — a node cannot satisfy
|
|
2007
|
+
* {@link Serializable} and so cannot sit inside {@link FactShapes}[K]). */
|
|
2008
|
+
export type FactFragment<K extends FactKind> = FactShapes[K];
|
|
2009
|
+
/**
|
|
2010
|
+
* The formats that supply each *file* fact kind, declared per kind and never
|
|
2011
|
+
* inferred. A kind absent from this interface is corpus-produced
|
|
2012
|
+
* (`resolution`): it has no supplying format, only upstream facts (§5).
|
|
2013
|
+
*
|
|
2014
|
+
* This declaration is load-bearing, not documentation: a format named here
|
|
2015
|
+
* without a producer in {@link PRODUCERS} fails the mapped type, and a format
|
|
2016
|
+
* that cannot supply a concept is simply absent from the kind's set. This is
|
|
2017
|
+
* the Spec 68 §2 fix for the naming rule in its second form — a fact is named
|
|
2018
|
+
* for what it *is*, never for where it came from. `channel-operations` is
|
|
2019
|
+
* supplied by a `go` producer, a `rust` producer and a `typescript` producer;
|
|
2020
|
+
* there is no `go-channels` fact kind.
|
|
2021
|
+
*/
|
|
2022
|
+
export interface SupplyingFormats {
|
|
2023
|
+
'file-symbols': 'typescript' | 'tsx' | 'javascript';
|
|
2024
|
+
'function-index': 'typescript' | 'tsx' | 'javascript';
|
|
2025
|
+
'query-site-candidates': 'typescript' | 'tsx' | 'javascript';
|
|
2026
|
+
'imports': 'typescript' | 'tsx' | 'javascript' | 'go';
|
|
2027
|
+
'import-specifiers': 'typescript' | 'tsx' | 'javascript';
|
|
2028
|
+
'export-symbols': 'typescript' | 'tsx' | 'javascript';
|
|
2029
|
+
'export-form': 'typescript' | 'tsx' | 'javascript';
|
|
2030
|
+
'import-form': 'typescript' | 'tsx' | 'javascript';
|
|
2031
|
+
'string-literals': 'typescript' | 'tsx' | 'javascript';
|
|
2032
|
+
'secret-candidates': 'typescript' | 'tsx' | 'javascript';
|
|
2033
|
+
'security-candidates': 'typescript' | 'tsx' | 'javascript';
|
|
2034
|
+
'ddl-declarations': 'typescript' | 'tsx' | 'javascript' | 'sql';
|
|
2035
|
+
'schema-usage-candidates': 'typescript' | 'tsx' | 'javascript';
|
|
2036
|
+
'schema-objects': 'typescript' | 'tsx' | 'javascript';
|
|
2037
|
+
'style-declarations': 'css' | 'scss' | 'typescript' | 'tsx' | 'javascript' | 'markup';
|
|
2038
|
+
'cross-language-entities': 'typescript' | 'tsx' | 'javascript' | 'go';
|
|
2039
|
+
'data-access-calls-candidates': 'typescript' | 'tsx' | 'javascript' | 'go';
|
|
2040
|
+
'loop-query-candidates': 'typescript' | 'tsx' | 'javascript';
|
|
2041
|
+
'dynamic-sql': 'typescript' | 'tsx' | 'javascript';
|
|
2042
|
+
'react-component': 'typescript' | 'tsx' | 'javascript';
|
|
2043
|
+
'file-header': 'typescript' | 'tsx' | 'javascript';
|
|
2044
|
+
'code-block': 'typescript' | 'tsx' | 'javascript';
|
|
2045
|
+
'json-document': 'json';
|
|
2046
|
+
'file-imports': 'typescript' | 'tsx' | 'javascript' | 'go';
|
|
2047
|
+
'type-declarations': 'go';
|
|
2048
|
+
'go-functions': 'go';
|
|
2049
|
+
'go-switches': 'go';
|
|
2050
|
+
'error-bindings': 'go';
|
|
2051
|
+
'concurrency-primitives': 'go';
|
|
2052
|
+
'channel-operations': 'go';
|
|
2053
|
+
'go-package-bindings': 'go';
|
|
2054
|
+
'within-file-provenance': 'typescript' | 'tsx' | 'javascript' | 'go';
|
|
2055
|
+
'receiver-activity': 'typescript' | 'tsx' | 'javascript';
|
|
2056
|
+
'batch-functions': 'typescript' | 'tsx' | 'javascript';
|
|
2057
|
+
}
|
|
2058
|
+
/** A fact kind supplied from a file — every key of {@link SupplyingFormats}. */
|
|
2059
|
+
export type FileFactKind = keyof SupplyingFormats;
|
|
2060
|
+
/** A fact kind supplied by corpus reduction — every kind with no supplying format. */
|
|
2061
|
+
export type CorpusFactKind = Exclude<FactKind, FileFactKind>;
|
|
2062
|
+
/** A per-(kind, format) file processor: one producer per format, never one per
|
|
2063
|
+
* kind with a format list. Two producers for one (kind, format) is a duplicate
|
|
2064
|
+
* key; a (kind, format) with no producer is a type error against
|
|
2065
|
+
* {@link SupplyingFormats}. */
|
|
2066
|
+
export interface FileProcessor<K extends FileFactKind, F extends SupplyingFormats[K] = SupplyingFormats[K]> {
|
|
2067
|
+
readonly id: ProcessorId;
|
|
2068
|
+
readonly produces: K;
|
|
2069
|
+
/** The one format this producer serves (the map key, mirrored for clarity). */
|
|
2070
|
+
readonly format: F;
|
|
2071
|
+
/** The only place an AST is reachable. */
|
|
2072
|
+
process(file: ParsedFile): FactFragment<K>;
|
|
2073
|
+
/** Spec 69 R1 — the completeness oracle. `counted` carries a cheap, independent
|
|
2074
|
+
* per-file count of the fragments this file *should* yield; `none` states
|
|
2075
|
+
* there is no statable oracle and why (enumerated in the run, never silently
|
|
2076
|
+
* unprovable). Required — a processor without one fails compilation, the
|
|
2077
|
+
* producer-side forcing function mirroring a rule's `needs`. */
|
|
2078
|
+
readonly oracle: CompletenessOracle;
|
|
2079
|
+
}
|
|
2080
|
+
/**
|
|
2081
|
+
* The completeness oracle a {@link FileProcessor} declares (Spec 69 R1). A
|
|
2082
|
+
* `counted` oracle is a cheap, dumb count of what the processor should have
|
|
2083
|
+
* produced, computed from the same input and written for that processor — an
|
|
2084
|
+
* independent upper bound whose emitted shortfall the run records per file.
|
|
2085
|
+
*
|
|
2086
|
+
* `count` is the expected count off the raw input; `measured` reads the actual
|
|
2087
|
+
* count back from the fragments the processor *did* emit. The two must measure
|
|
2088
|
+
* the same unit. For a per-fragment producer they are both a count of the
|
|
2089
|
+
* fragments themselves; for an aggregate producer (one fragment per file whose
|
|
2090
|
+
* payload carries the units — e.g. a style-declarations file holding its
|
|
2091
|
+
* declaration list) `count` is still a count of the units, so `measured` reads
|
|
2092
|
+
* the units *inside* the fragment, not `fragments.length` (which would be a
|
|
2093
|
+
* meaningless 1-against-1).
|
|
2094
|
+
*
|
|
2095
|
+
* A `none` oracle states that no such count exists, with the reason; it is an
|
|
2096
|
+
* explicit report, not an exemption — the failure mode being closed is the
|
|
2097
|
+
* silently-unprovable fact.
|
|
2098
|
+
*/
|
|
2099
|
+
export type CompletenessOracle = {
|
|
2100
|
+
status: 'counted';
|
|
2101
|
+
count(file: ParsedFile): number;
|
|
2102
|
+
measured(fragments: readonly unknown[]): number;
|
|
2103
|
+
} | {
|
|
2104
|
+
status: 'none';
|
|
2105
|
+
reason: string;
|
|
2106
|
+
};
|
|
2107
|
+
/**
|
|
2108
|
+
* Spec 69 R1 — one recorded per-file completeness shortfall: the file, the
|
|
2109
|
+
* processor (by its `${kind}.${format}` id), and the oracle's expected count vs
|
|
2110
|
+
* the fragments actually emitted. Only ever recorded for a `counted` oracle
|
|
2111
|
+
* whose emitted count came in below the expected count — the oracle is an upper
|
|
2112
|
+
* bound, so equality and over-emission are not shortfalls (they are the
|
|
2113
|
+
* non-signal). A `none` oracle never produces one; its absence is enumerated
|
|
2114
|
+
* separately, not measured.
|
|
2115
|
+
*/
|
|
2116
|
+
export interface OracleShortfall {
|
|
2117
|
+
readonly file: string;
|
|
2118
|
+
readonly processor: ProcessorId;
|
|
2119
|
+
readonly expected: number;
|
|
2120
|
+
readonly actual: number;
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* The corpus-level inputs a corpus processor may read beyond its upstream
|
|
2124
|
+
* facts. §8's `reachability` processor needs the discovery list, the virtual
|
|
2125
|
+
* module list, the tsconfig aliases and the package.json entry points — all
|
|
2126
|
+
* derived from the project root, none per-file — so they are threaded here as
|
|
2127
|
+
* one optional context rather than leaking config into the fact shapes. A
|
|
2128
|
+
* processor that needs none of this (resolution, migration-history,
|
|
2129
|
+
* mined-conventions, schema-validations) simply ignores it.
|
|
2130
|
+
*/
|
|
2131
|
+
export interface CorpusContext {
|
|
2132
|
+
/** Absolute project root (alias + entry-point resolution base). */
|
|
2133
|
+
projectRoot?: string;
|
|
2134
|
+
/** Full corpus discovery list (unfiltered) for alias resolution. */
|
|
2135
|
+
corpusFiles?: readonly string[];
|
|
2136
|
+
/** Virtual-module specifiers (exact match), default DEFAULT_VIRTUAL_MODULES. */
|
|
2137
|
+
virtualModules?: readonly string[];
|
|
2138
|
+
/** tsconfig `paths` + `baseUrl` for alias classification + resolution. */
|
|
2139
|
+
tsconfigAliases?: {
|
|
2140
|
+
pathPatterns?: readonly string[];
|
|
2141
|
+
paths?: Readonly<Record<string, readonly string[]>>;
|
|
2142
|
+
baseUrl?: string;
|
|
2143
|
+
};
|
|
2144
|
+
/** package.json entry points (facade-expanded), absolute. */
|
|
2145
|
+
packageEntryPoints?: readonly string[];
|
|
2146
|
+
/** The read-only code-index handle the index-backed corpus producers
|
|
2147
|
+
* (`call-graph`, and later `coverage`/`defined-classes`/`clone-pair-history`)
|
|
2148
|
+
* read their facts from. §2.2: `CrossDomainAnalyzer`'s direct `indexHandle`
|
|
2149
|
+
* read becomes a corpus processor reading this — never a rule. Optional so the
|
|
2150
|
+
* slice tests run a single fixture with no index (the producer degrades to an
|
|
2151
|
+
* empty fact, matching the legacy graceful-degradation). */
|
|
2152
|
+
indexHandle?: IndexHandle;
|
|
2153
|
+
/** Config-declared external tables (schema analyzer's `knownTables` +
|
|
2154
|
+
* `schemas`), merged into the `resolution` corpus fact. See
|
|
2155
|
+
* {@link ExternalTableDecl}. */
|
|
2156
|
+
externalTables?: ReadonlyArray<ExternalTableDecl>;
|
|
2157
|
+
/** Spec 70 R1 — the corpus's named SQL dialect, threaded to the corpus
|
|
2158
|
+
* producers that re-apply provenance to the four receiver consumers (whose
|
|
2159
|
+
* file-fact half reads `ParsedFile.sqlDialect`). Absent in the slice tests
|
|
2160
|
+
* (single fixture, no corpus) — the producers then run on the default (null)
|
|
2161
|
+
* dialect and SQL-argument facts `cannot-fire`. */
|
|
2162
|
+
sqlDialect?: Dialect | null;
|
|
2163
|
+
/** Spec 70 criterion 9 (Item 3) — the project's declared type packages
|
|
2164
|
+
* (package.json `dependencies`/`devDependencies` ∪ tsconfig `compilerOptions.types`),
|
|
2165
|
+
* the ambient-arm gate for an unbound handle-type name. Absent (undefined) the
|
|
2166
|
+
* gate abstains: an unbound `D1Database` without a declared dependency stays
|
|
2167
|
+
* `unproven` rather than being credited `handle`. */
|
|
2168
|
+
declaredTypePackages?: ReadonlySet<string>;
|
|
2169
|
+
/** Spec 70 — a shared memoization cache for the `identifyHandle` verdicts the
|
|
2170
|
+
* receiver consumers re-fold, keyed by the candidate's full handle identity
|
|
2171
|
+
* including the file (whose per-file provenance/env the verdict depends on).
|
|
2172
|
+
* `classifyDataAccessCalls` and `classifyUnprovenQueryReceivers` fold the same
|
|
2173
|
+
* `data-access-calls-candidates` through `identifyHandle`, and
|
|
2174
|
+
* `classifySchemaUsage` and `classifyUnresolvedQuerySites` fold the same
|
|
2175
|
+
* `schema-usage-candidates` dbCalls — without the cache each candidate is
|
|
2176
|
+
* folded twice, and `identifyHandle` is ~2 ms per fold. Threaded here so the
|
|
2177
|
+
* four consumers plus the two post-loop classifiers share one cache across a
|
|
2178
|
+
* single `buildFacts` pass (the verdict is a pure function of (file, identity)
|
|
2179
|
+
* within one pass, so the cache is byte-identical to re-folding). */
|
|
2180
|
+
handleVerdictCache?: Map<string, HandleVerdict | null>;
|
|
2181
|
+
}
|
|
2182
|
+
/** A corpus processor: receives complete upstream facts, no AST, no format. */
|
|
2183
|
+
export interface CorpusProcessor<K extends CorpusFactKind, N extends readonly FactKind[]> {
|
|
2184
|
+
readonly id: ProcessorId;
|
|
2185
|
+
readonly produces: K;
|
|
2186
|
+
readonly needs: N;
|
|
2187
|
+
process(facts: {
|
|
2188
|
+
readonly [J in N[number]]: FactShapes[J];
|
|
2189
|
+
}, ctx?: CorpusContext): FactShapes[K];
|
|
2190
|
+
}
|
|
2191
|
+
//# sourceMappingURL=types.d.ts.map
|