@codeyam/codeyam-cli 0.1.0-staging.8aea589 → 0.1.0-staging.8df382d
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/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/common/execAsync.ts +2 -2
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +35 -30
- package/analyzer-template/packages/ai/index.ts +27 -7
- package/analyzer-template/packages/ai/package.json +6 -6
- package/analyzer-template/packages/ai/scripts/ai-test-matrix.mjs +424 -0
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +274 -8
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +245 -40
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +426 -20
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +42 -3
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +48 -2
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1836 -142
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +328 -5
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +28 -11
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +235 -66
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +4669 -732
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.ts +175 -7
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +21 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +976 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +249 -81
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +152 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/DebugTracer.ts +224 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/PathManager.ts +203 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/README.md +294 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +163 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.ts +235 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +71 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +229 -21
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +166 -17
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +455 -88
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/getFunctionCallRoot.ts +33 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/selectBestValue.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.ts +113 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -0
- package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
- package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
- package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityDocumentation.ts +20 -2
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +124 -158
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +139 -346
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +70 -7
- package/analyzer-template/packages/ai/src/lib/generateEntityDocumentation.ts +16 -2
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1437 -195
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +232 -295
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +710 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/generateStatementAnalysis.ts +49 -72
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +170 -37
- package/analyzer-template/packages/ai/src/lib/getLLMCallStats.ts +0 -14
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +135 -7
- package/analyzer-template/packages/ai/src/lib/modelInfo.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +150 -31
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.ts +8 -33
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +54 -62
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +77 -150
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.ts +8 -27
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +139 -40
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +16 -49
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
- package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/types/index.ts +2 -0
- package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +171 -2
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +121 -2
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +230 -54
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +3 -1
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExportedNodes.ts +4 -2
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +49 -9
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +762 -153
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +61 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +4 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findPreviousAnalysis.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findValidExistingAnalysis.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +20 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyze/setActiveAnalysisBranches.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +5 -13
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +65 -30
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +29 -11
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +46 -28
- package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +26 -39
- package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +135 -16
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +313 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +837 -99
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +619 -31
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +264 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +84 -80
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +8 -4
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1144 -129
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +61 -6
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
- package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +3 -2
- package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
- package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.d.ts +23 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.js +30 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.js.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
- package/analyzer-template/packages/aws/package.json +10 -9
- package/analyzer-template/packages/aws/s3/index.ts +5 -0
- package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
- package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
- package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
- package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
- package/analyzer-template/packages/aws/src/lib/s3/getPresignedUrl.ts +62 -0
- package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/client.ts +35 -0
- package/analyzer-template/packages/database/package.json +31 -0
- package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +28 -0
- package/analyzer-template/packages/database/src/lib/analysisToDb.ts +59 -0
- package/analyzer-template/packages/database/src/lib/branchToDb.ts +24 -0
- package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +20 -0
- package/analyzer-template/packages/database/src/lib/commitToDb.ts +47 -0
- package/analyzer-template/packages/database/src/lib/fileToDb.ts +17 -0
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +495 -0
- package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +108 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +67 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +88 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +275 -0
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +223 -0
- package/analyzer-template/packages/database/src/lib/loadBranch.ts +137 -0
- package/analyzer-template/packages/database/src/lib/loadCommit.ts +173 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +279 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +117 -0
- package/analyzer-template/packages/database/src/lib/loadEntity.ts +105 -0
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +178 -0
- package/analyzer-template/packages/database/src/lib/loadFile.ts +42 -0
- package/analyzer-template/packages/database/src/lib/loadFiles.ts +134 -0
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +101 -0
- package/analyzer-template/packages/database/src/lib/loadStatement.ts +23 -0
- package/analyzer-template/packages/database/src/lib/projectToDb.ts +35 -0
- package/analyzer-template/packages/database/src/lib/saveEntityStatements.ts +27 -0
- package/analyzer-template/packages/database/src/lib/saveFiles.ts +43 -0
- package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +35 -0
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +180 -0
- package/analyzer-template/packages/database/src/lib/updateProjectMetadata.ts +95 -0
- package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +18 -0
- package/analyzer-template/packages/generate/index.ts +3 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +44 -21
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.ts +18 -11
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
- package/analyzer-template/packages/generate/src/lib/deepMerge.ts +29 -2
- package/analyzer-template/packages/generate/src/lib/directExecutionScript.ts +17 -2
- package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
- package/analyzer-template/packages/generate/src/lib/scenarioComponent.ts +6 -3
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/index.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +19 -0
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +26 -0
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/backgroundJobToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/backgroundJobToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +18 -0
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +13 -0
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +26 -0
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/createOrUpdateBranchCommitStats.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/createOrUpdateBranchCommitStats.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/createProject.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/createProject.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/createRetryFetch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/createRetryFetch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToAnalysis.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToAnalysis.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToAnalysisBranch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToAnalysisBranch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToBackgroundJob.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToBackgroundJob.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToBranch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToBranch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToCommit.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToCommit.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToCommitBranch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToCommitBranch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToEntity.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToEntity.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToEntityBranch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToEntityBranch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToFile.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToFile.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToProject.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToProject.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToScenario.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToScenario.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToScenarioComment.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToScenarioComment.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToUserScenario.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/dbToUserScenario.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteBranch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteBranch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteEntities.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteEntities.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteFile.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteFile.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteScenarios.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/deleteScenarios.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/entityToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/entityToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +14 -0
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/generateSha.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/generateSha.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/jsonUpdateUtils.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/jsonUpdateUtils.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/aggregationHelpers.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/aggregationHelpers.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +71 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +373 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/schemaHelpers.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/schemaHelpers.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/sqliteBooleanPlugin.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/sqliteBooleanPlugin.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +89 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelationsTypes.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelationsTypes.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +97 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysisBranchesTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysisBranchesTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/backgroundJobsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/backgroundJobsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/branchesTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/branchesTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitBranchesTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitBranchesTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +48 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +47 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +60 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +33 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +68 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entityBranchesTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entityBranchesTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entityStatementsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entityStatementsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/filesTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/filesTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/githubPayloadsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/githubPayloadsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/githubUsersTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/githubUsersTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/projectsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/projectsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenarioCommentsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenarioCommentsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +61 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/statementsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/statementsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/teamsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/teamsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/userScenariosTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/userScenariosTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/userTeamsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/userTeamsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/usersTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/usersTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/upsertHelpers.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/upsertHelpers.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +16 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +174 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +138 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysisBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysisBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadBackgroundJob.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadBackgroundJob.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +100 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +118 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommitBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommitBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommitMetadata.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommitMetadata.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +15 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +209 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +13 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +82 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +123 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadFile.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadFile.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadFiles.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadFiles.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadMostRecentPreviousAnalysis.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadMostRecentPreviousAnalysis.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadProject.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadProject.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +68 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadScenario.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadScenario.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadStatement.d.ts +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadStatement.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadStatement.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/nullsToUndefines.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/nullsToUndefines.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +18 -0
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveBackgroundEvent.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveBackgroundEvent.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveEntityStatements.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveEntityStatements.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +33 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveStatement.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/saveStatement.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +18 -0
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/supabase.d.ts +4 -0
- package/analyzer-template/packages/github/dist/database/src/lib/supabase.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/supabase.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateBackgroundJobProgress.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateBackgroundJobProgress.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +13 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +101 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateEntityBranch.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateEntityBranch.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisMetadata.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisMetadata.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateProjectMetadata.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/updateProjectMetadata.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertAnalyses.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertAnalyses.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertAnalysesWithScenarios.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertAnalysesWithScenarios.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertAnalysisBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertAnalysisBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertBackgroundJob.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertBackgroundJob.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertCommitBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertCommitBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertCommits.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertCommits.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertEntities.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertEntities.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertEntityBranches.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertEntityBranches.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertFiles.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertFiles.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertGithubUser.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertGithubUser.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertProjects.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertProjects.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertScenarios.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/upsertScenarios.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.js +3 -0
- package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +43 -21
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +30 -2
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js +10 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js +5 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/analyzer-template/packages/github/dist/github/src/lib/getCommitsFromGithub.js +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +11 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncBranches.js +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncHeadBranches.js +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +4 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPullRequest.js +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/updateCommitBranchesInDb.js +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/updateFilesInDb.js +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +2 -2
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +87 -9
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +4 -0
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +11 -6
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.js +4 -0
- package/analyzer-template/packages/github/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +65 -7
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.d.ts +13 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.js +14 -2
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts +12 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +14 -2
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +21 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +62 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +42 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +32 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/buildStartCommand.d.ts +18 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/buildStartCommand.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/buildStartCommand.js +45 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/buildStartCommand.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/getWebappInfo.d.ts +26 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/getWebappInfo.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/getWebappInfo.js +67 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/getWebappInfo.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/index.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/index.js +3 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/startCommand/index.js.map +1 -0
- package/analyzer-template/packages/github/package.json +1 -1
- package/analyzer-template/packages/github/src/lib/getCommitsFromGithub.ts +1 -1
- package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +15 -1
- package/analyzer-template/packages/github/src/lib/syncBranches.ts +1 -1
- package/analyzer-template/packages/github/src/lib/syncHeadBranches.ts +1 -1
- package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +3 -1
- package/analyzer-template/packages/github/src/lib/syncPullRequest.ts +1 -1
- package/analyzer-template/packages/github/src/lib/updateCommitBranchesInDb.ts +1 -1
- package/analyzer-template/packages/github/src/lib/updateFilesInDb.ts +1 -1
- package/analyzer-template/packages/process/index.ts +2 -0
- package/analyzer-template/packages/process/package.json +12 -0
- package/analyzer-template/packages/process/tsconfig.json +8 -0
- package/analyzer-template/packages/types/index.ts +5 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +104 -9
- package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
- package/analyzer-template/packages/types/src/types/Entity.ts +4 -0
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +7 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +228 -3
- package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/ui-components/package.json +4 -4
- package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
- package/analyzer-template/packages/ui-components/src/scenario-editor/components/DataItemEditor.tsx +1 -1
- package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +87 -9
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +4 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +11 -6
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.d.ts +3 -0
- package/analyzer-template/packages/utils/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.js +4 -0
- package/analyzer-template/packages/utils/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +65 -7
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.d.ts +13 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.js +14 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts +12 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +14 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +21 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +62 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +42 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +32 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/buildStartCommand.d.ts +18 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/buildStartCommand.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/buildStartCommand.js +45 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/buildStartCommand.js.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/getWebappInfo.d.ts +26 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/getWebappInfo.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/getWebappInfo.js +67 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/getWebappInfo.js.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/index.d.ts +3 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/index.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/index.js +3 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/startCommand/index.js.map +1 -0
- package/analyzer-template/packages/utils/index.ts +11 -0
- package/analyzer-template/packages/utils/src/lib/Semaphore.ts +42 -0
- package/analyzer-template/packages/utils/src/lib/applyUniversalMocks.ts +74 -9
- package/analyzer-template/packages/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.ts +20 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/getRemixRoutePath.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.ts +17 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.ts +1 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.ts +67 -0
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
- package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +43 -0
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +51 -3
- package/analyzer-template/packages/utils/src/lib/startCommand/buildStartCommand.ts +63 -0
- package/analyzer-template/packages/utils/src/lib/startCommand/getWebappInfo.ts +108 -0
- package/analyzer-template/packages/utils/src/lib/startCommand/index.ts +10 -0
- package/analyzer-template/playwright/capture.ts +103 -93
- package/analyzer-template/playwright/captureFromUrl.ts +48 -17
- package/analyzer-template/playwright/captureStatic.ts +2 -2
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/takeElementScreenshot.ts +48 -11
- package/analyzer-template/playwright/takeScreenshot.ts +38 -10
- package/analyzer-template/playwright/updateBackgroundJob.ts +1 -1
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/LazyFileStore.ts +1 -1
- package/analyzer-template/project/TESTING.md +83 -0
- package/analyzer-template/project/analyzeBaselineCommit.ts +10 -1
- package/analyzer-template/project/analyzeBranchCommit.ts +5 -1
- package/analyzer-template/project/analyzeFileEntities.ts +5 -1
- package/analyzer-template/project/analyzeRegularCommit.ts +10 -1
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +30 -27
- package/analyzer-template/project/constructMockCode.ts +1739 -92
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/createEntitiesAndSortFiles.ts +98 -7
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/getFilesWithEntitiesFromRepo.ts +1 -1
- package/analyzer-template/project/getScenarioUrl.ts +73 -5
- package/analyzer-template/project/loadReadyToBeCaptured.ts +198 -38
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +15 -15
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +97 -67
- package/analyzer-template/project/orchestrateCapture/SupabaseAnalysisLoader.ts +6 -6
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +93 -14
- package/analyzer-template/project/prepareRepo.ts +1 -1
- package/analyzer-template/project/reconcileMockDataKeys.ts +258 -2
- package/analyzer-template/project/runAnalysis.ts +12 -1
- package/analyzer-template/project/runMultiScenarioServer.ts +13 -16
- package/analyzer-template/project/runScenarioServer.ts +1 -5
- package/analyzer-template/project/serverOnlyModules.ts +413 -0
- package/analyzer-template/project/start.ts +94 -33
- package/analyzer-template/project/startScenarioCapture.ts +103 -41
- package/analyzer-template/project/startServer.ts +50 -70
- package/analyzer-template/project/trackGeneratedFiles.ts +41 -0
- package/analyzer-template/project/updateCommitBackgroundJob.ts +1 -1
- package/analyzer-template/project/utils/errorHandling.ts +1 -1
- package/analyzer-template/project/writeMockDataTsx.ts +748 -69
- package/analyzer-template/project/writeScenario.ts +1 -1
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +2352 -179
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +125 -2
- package/analyzer-template/project/writeUniversalMocks.ts +88 -9
- package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/scripts/postbuild.cjs +12 -1
- package/analyzer-template/tsconfig.json +2 -1
- package/background/src/lib/local/createLocalAnalyzer.js +2 -30
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/background/src/lib/local/execAsync.js +1 -1
- package/background/src/lib/local/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/common/execAsync.js +2 -2
- package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/project/LazyFileStore.js +1 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +8 -2
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js +3 -2
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +3 -2
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +8 -2
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +4 -4
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +1518 -64
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/controller/startController.js +11 -1
- package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +83 -4
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/getFilesWithEntitiesFromRepo.js +1 -1
- package/background/src/lib/virtualized/project/getScenarioUrl.js +38 -3
- package/background/src/lib/virtualized/project/getScenarioUrl.js.map +1 -1
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +108 -6
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +13 -7
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +73 -49
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +77 -15
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/prepareRepo.js +1 -1
- package/background/src/lib/virtualized/project/prepareRepo.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +216 -2
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +10 -1
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js +13 -14
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +338 -0
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
- package/background/src/lib/virtualized/project/start.js +81 -30
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +79 -31
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/startServer.js +40 -68
- package/background/src/lib/virtualized/project/startServer.js.map +1 -1
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js +30 -0
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js.map +1 -0
- package/background/src/lib/virtualized/project/updateCommitBackgroundJob.js +1 -1
- package/background/src/lib/virtualized/project/utils/errorHandling.js +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +640 -60
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenario.js +1 -1
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +1721 -117
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
- package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +113 -2
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +72 -8
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +181 -1
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/scripts/extract-setup.js +1 -1
- package/codeyam-cli/scripts/populateEntityTimestamps.js +1 -1
- package/codeyam-cli/scripts/populateEntityTimestamps.js.map +1 -1
- package/codeyam-cli/src/cli.js +40 -17
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +18 -2
- package/codeyam-cli/src/codeyam-cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +5 -3
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +176 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/debug.js +253 -0
- package/codeyam-cli/src/commands/debug.js.map +1 -0
- package/codeyam-cli/src/commands/default.js +30 -34
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/entities.js +1 -1
- package/codeyam-cli/src/commands/generate-data-structure.js +17 -8
- package/codeyam-cli/src/commands/generate-data-structure.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +50 -277
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +254 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/commands/recapture.js +228 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -0
- package/codeyam-cli/src/commands/report.js +150 -0
- package/codeyam-cli/src/commands/report.js.map +1 -0
- package/codeyam-cli/src/commands/setup-sandbox.js +167 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -0
- package/codeyam-cli/src/commands/setup-simulations.js +284 -0
- package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
- package/codeyam-cli/src/commands/start.js +8 -12
- package/codeyam-cli/src/commands/start.js.map +1 -1
- package/codeyam-cli/src/commands/status.js +23 -1
- package/codeyam-cli/src/commands/status.js.map +1 -1
- package/codeyam-cli/src/commands/suggest.js +1 -1
- package/codeyam-cli/src/commands/test-startup.js +17 -6
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/verify.js +14 -2
- package/codeyam-cli/src/commands/verify.js.map +1 -1
- package/codeyam-cli/src/commands/wipe.js +108 -0
- package/codeyam-cli/src/commands/wipe.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js +6 -6
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/entityVersioning.test.js +2 -2
- package/codeyam-cli/src/utils/__tests__/fileWatcher.batch.test.js +2 -2
- package/codeyam-cli/src/utils/__tests__/fileWatcher.multiversion.test.js +58 -30
- package/codeyam-cli/src/utils/__tests__/fileWatcher.multiversion.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/fileWatcher.optimization.test.js +2 -2
- package/codeyam-cli/src/utils/__tests__/fileWatcher.versioning.test.js +2 -2
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +128 -74
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +32 -17
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +31 -2
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +104 -23
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/changeDetection.js +1 -1
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js +2 -2
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js.map +1 -1
- package/codeyam-cli/src/utils/database.js +92 -6
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/entityCache.js +1 -1
- package/codeyam-cli/src/utils/entityMetadata.js +1 -1
- package/codeyam-cli/src/utils/entityVersioning.js +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +2 -2
- package/codeyam-cli/src/utils/generateReport.js +366 -0
- package/codeyam-cli/src/utils/generateReport.js.map +1 -0
- package/codeyam-cli/src/utils/git.js +79 -0
- package/codeyam-cli/src/utils/git.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +78 -37
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
- package/codeyam-cli/src/utils/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +3 -3
- package/codeyam-cli/src/utils/queue/__tests__/job.pidTracking.test.js +3 -2
- package/codeyam-cli/src/utils/queue/__tests__/job.pidTracking.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/heartbeat.js +1 -1
- package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +264 -26
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +103 -7
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
- package/codeyam-cli/src/utils/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +229 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +113 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
- package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +7 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +93 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +49 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
- package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
- package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
- package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +137 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/sandbox.js +190 -0
- package/codeyam-cli/src/utils/sandbox.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js +37 -10
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +25 -42
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
- package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/syncUncommittedEntities.js +1 -1
- package/codeyam-cli/src/utils/syncUniversalMocks.js +1 -1
- package/codeyam-cli/src/utils/versionInfo.js +67 -15
- package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +2 -1
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/utils/wipe.js +128 -0
- package/codeyam-cli/src/utils/wipe.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +169 -9
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js +3 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/app/routes/api.agent-transcripts.js +486 -0
- package/codeyam-cli/src/webserver/app/routes/api.agent-transcripts.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +65 -10
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +60 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CtmbP4Gl.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-DlMph_Hm.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-B-0PjGOU.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-DN9eiJAO.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C1rIyZdV.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-rE_fI2h2.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CnatsCw2.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-CSP6DZrh.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-CMK8Q7yk.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-TCV_HBjy.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CG2uh31y.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CU_TDYd8.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-D7IoaWUW.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/_index-B8z7mjR-.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DZu78RI1.js +27 -0
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DxCa1oBt.js +23 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.generate-report-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-Bp5FLkd4.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DQJA9f4o.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-7VptmeIr.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-B6C4LY9o.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/codeyam-name-logo-CvKwUgHo.svg +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/copy-6nzYCu0G.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-D-QUFOwe.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CCKUIm0S.svg +4 -0
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DmzSmblj.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._--zvFJ4OH.js +23 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DVTcUnur.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BVgNO76F.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-C7ysA4Jq.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-CU6EUArK.js +29 -0
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-EWpfFU4X.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-CrxAoWIL.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-BldHtKeW.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-B4MPiL7S.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-7-1FmlHo.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-DuYcwYp_.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-CPPVOSWB.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-BnDcD54R.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-c1fc3656.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CfpYxpNu.js +93 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-DhQX2g22.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-CAAbm4U5.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-DborVoKD.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-BpLDWmGh.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-BtrtCYJg.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/terminal-Bs4NC-VZ.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-DTf3Jojp.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-D_bDZyDU.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DZp6rrQD.js +2 -0
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BsQb6rFd.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-BOur3mUv.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/index-B8A_aaGG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-69rRZnZo.js +286 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/devServer.js +1 -3
- package/codeyam-cli/src/webserver/devServer.js.map +1 -1
- package/codeyam-cli/src/webserver/server.js +35 -25
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-debug.md +601 -0
- package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
- package/codeyam-cli/templates/codeyam-memory.md +396 -0
- package/codeyam-cli/templates/codeyam-new-rule.md +11 -0
- package/codeyam-cli/templates/codeyam-setup.md +600 -0
- package/codeyam-cli/templates/codeyam-sim.md +222 -0
- package/codeyam-cli/templates/codeyam-test.md +178 -0
- package/codeyam-cli/templates/codeyam-verify.md +179 -0
- package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
- package/codeyam-cli/templates/prompts/conversation-guidance.txt +32 -0
- package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
- package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
- package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
- package/codeyam-cli/templates/rule-notification-hook.py +56 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +627 -0
- package/codeyam-cli/templates/rules-instructions.md +77 -0
- package/package.json +29 -28
- package/packages/ai/index.js +9 -8
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +211 -6
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +185 -36
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js +308 -20
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +39 -4
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +31 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +1401 -102
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
- package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +23 -10
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +178 -36
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +3590 -522
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js +164 -2
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +19 -4
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +661 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +184 -58
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +122 -0
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js +176 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js +178 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +140 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js +199 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +66 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +198 -15
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +145 -15
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +385 -79
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/getFunctionCallRoot.js +28 -3
- package/packages/ai/src/lib/dataStructure/helpers/getFunctionCallRoot.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js +62 -0
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js +90 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +130 -0
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
- package/packages/ai/src/lib/deepEqual.js +32 -0
- package/packages/ai/src/lib/deepEqual.js.map +1 -0
- package/packages/ai/src/lib/e2eDataTracking.js +241 -0
- package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js +19 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +111 -152
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +131 -322
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +56 -6
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js +15 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +1138 -181
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +209 -269
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +495 -0
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1807 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/generateStatementAnalysis.js +47 -72
- package/packages/ai/src/lib/generateStatementAnalysis.js.map +1 -1
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +97 -22
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/getLLMCallStats.js +0 -14
- package/packages/ai/src/lib/getLLMCallStats.js.map +1 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +270 -7
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +104 -6
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/modelInfo.js +15 -0
- package/packages/ai/src/lib/modelInfo.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +118 -23
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js +8 -33
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +36 -42
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +49 -99
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js +8 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +103 -29
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +12 -31
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
- package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
- package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
- package/packages/ai/src/lib/types/index.js +2 -0
- package/packages/ai/src/lib/types/index.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +36 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +98 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +196 -41
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
- package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/analysisContext.js +30 -5
- package/packages/analyze/src/lib/analysisContext.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js +2 -1
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +3 -1
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExportedNodes.js +3 -2
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExportedNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +41 -9
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +594 -105
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +48 -3
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findPreviousAnalysis.js +1 -1
- package/packages/analyze/src/lib/files/analyze/findValidExistingAnalysis.js +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +15 -3
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/setActiveAnalysisBranches.js +1 -1
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +5 -8
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +42 -20
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +20 -13
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +30 -19
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeNextRoute.js +1 -1
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js +22 -26
- package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
- package/packages/analyze/src/lib/files/getImportedExports.js +103 -8
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +255 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +646 -72
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +454 -30
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +144 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +61 -67
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +8 -4
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +936 -105
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +49 -6
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/setImportedExports.js +3 -2
- package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/index.js +1 -0
- package/packages/analyze/src/lib/index.js.map +1 -1
- package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
- package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/packages/database/index.js.map +1 -0
- package/packages/database/src/lib/analysisBranchToDb.js +19 -0
- package/packages/database/src/lib/analysisBranchToDb.js.map +1 -0
- package/packages/database/src/lib/analysisToDb.js +26 -0
- package/packages/database/src/lib/analysisToDb.js.map +1 -0
- package/packages/database/src/lib/backgroundJobToDb.js.map +1 -0
- package/packages/database/src/lib/branchToDb.js +18 -0
- package/packages/database/src/lib/branchToDb.js.map +1 -0
- package/packages/database/src/lib/commitBranchToDb.js +13 -0
- package/packages/database/src/lib/commitBranchToDb.js.map +1 -0
- package/packages/database/src/lib/commitToDb.js +26 -0
- package/packages/database/src/lib/commitToDb.js.map +1 -0
- package/packages/database/src/lib/createOrUpdateBranchCommitStats.js.map +1 -0
- package/packages/database/src/lib/createProject.js.map +1 -0
- package/packages/database/src/lib/createRetryFetch.js.map +1 -0
- package/packages/database/src/lib/dbToAnalysis.js.map +1 -0
- package/packages/database/src/lib/dbToAnalysisBranch.js.map +1 -0
- package/packages/database/src/lib/dbToBackgroundJob.js.map +1 -0
- package/packages/database/src/lib/dbToBranch.js.map +1 -0
- package/packages/database/src/lib/dbToCommit.js.map +1 -0
- package/packages/database/src/lib/dbToCommitBranch.js.map +1 -0
- package/packages/database/src/lib/dbToEntity.js.map +1 -0
- package/packages/database/src/lib/dbToEntityBranch.js.map +1 -0
- package/packages/database/src/lib/dbToFile.js.map +1 -0
- package/packages/database/src/lib/dbToProject.js.map +1 -0
- package/packages/database/src/lib/dbToScenario.js.map +1 -0
- package/packages/database/src/lib/dbToScenarioComment.js.map +1 -0
- package/packages/database/src/lib/dbToUserScenario.js.map +1 -0
- package/packages/database/src/lib/deleteBranch.js.map +1 -0
- package/packages/database/src/lib/deleteEntities.js.map +1 -0
- package/packages/database/src/lib/deleteFile.js.map +1 -0
- package/packages/database/src/lib/deleteScenarios.js.map +1 -0
- package/packages/database/src/lib/entityToDb.js.map +1 -0
- package/packages/database/src/lib/fileToDb.js +14 -0
- package/packages/database/src/lib/fileToDb.js.map +1 -0
- package/packages/database/src/lib/generateSha.js.map +1 -0
- package/packages/database/src/lib/jsonUpdateUtils.js.map +1 -0
- package/packages/database/src/lib/kysely/aggregationHelpers.js.map +1 -0
- package/packages/database/src/lib/kysely/db.js +373 -0
- package/packages/database/src/lib/kysely/db.js.map +1 -0
- package/packages/database/src/lib/kysely/schemaHelpers.js.map +1 -0
- package/packages/database/src/lib/kysely/sqliteBooleanPlugin.js.map +1 -0
- package/packages/database/src/lib/kysely/tableRelations.js.map +1 -0
- package/packages/database/src/lib/kysely/tableRelationsTypes.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/analysesTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/analysisBranchesTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/backgroundJobsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/branchesTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/commitBranchesTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js +47 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js +33 -0
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/entitiesTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/entityBranchesTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/entityStatementsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/filesTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/githubPayloadsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/githubUsersTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/projectsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/scenarioCommentsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/scenariosTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/statementsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/teamsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/userScenariosTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/userTeamsTable.js.map +1 -0
- package/packages/database/src/lib/kysely/tables/usersTable.js.map +1 -0
- package/packages/database/src/lib/kysely/upsertHelpers.js.map +1 -0
- package/packages/database/src/lib/loadAnalyses.js +174 -0
- package/packages/database/src/lib/loadAnalyses.js.map +1 -0
- package/packages/database/src/lib/loadAnalysis.js +138 -0
- package/packages/database/src/lib/loadAnalysis.js.map +1 -0
- package/packages/database/src/lib/loadAnalysisBranches.js.map +1 -0
- package/packages/database/src/lib/loadBackgroundJob.js.map +1 -0
- package/packages/database/src/lib/loadBranch.js +100 -0
- package/packages/database/src/lib/loadBranch.js.map +1 -0
- package/packages/database/src/lib/loadBranches.js.map +1 -0
- package/packages/database/src/lib/loadCommit.js +118 -0
- package/packages/database/src/lib/loadCommit.js.map +1 -0
- package/packages/database/src/lib/loadCommitBranches.js.map +1 -0
- package/packages/database/src/lib/loadCommitMetadata.js.map +1 -0
- package/packages/database/src/lib/loadCommits.js +209 -0
- package/packages/database/src/lib/loadCommits.js.map +1 -0
- package/packages/database/src/lib/loadEntities.js +82 -0
- package/packages/database/src/lib/loadEntities.js.map +1 -0
- package/packages/database/src/lib/loadEntity.js.map +1 -0
- package/packages/database/src/lib/loadEntityBranches.js +123 -0
- package/packages/database/src/lib/loadEntityBranches.js.map +1 -0
- package/packages/database/src/lib/loadFile.js.map +1 -0
- package/packages/database/src/lib/loadFiles.js.map +1 -0
- package/packages/database/src/lib/loadMostRecentPreviousAnalysis.js.map +1 -0
- package/packages/database/src/lib/loadProject.js.map +1 -0
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +68 -0
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -0
- package/packages/database/src/lib/loadScenario.js.map +1 -0
- package/packages/database/src/lib/loadStatement.js.map +1 -0
- package/packages/database/src/lib/nullsToUndefines.js.map +1 -0
- package/packages/database/src/lib/projectToDb.js +18 -0
- package/packages/database/src/lib/projectToDb.js.map +1 -0
- package/packages/database/src/lib/saveBackgroundEvent.js.map +1 -0
- package/packages/database/src/lib/saveEntityStatements.js.map +1 -0
- package/packages/database/src/lib/saveFiles.js +33 -0
- package/packages/database/src/lib/saveFiles.js.map +1 -0
- package/packages/database/src/lib/saveStatement.js.map +1 -0
- package/packages/database/src/lib/scenarioToDb.js +18 -0
- package/packages/database/src/lib/scenarioToDb.js.map +1 -0
- package/packages/database/src/lib/supabase.js.map +1 -0
- package/packages/database/src/lib/updateBackgroundJobProgress.js.map +1 -0
- package/packages/database/src/lib/updateCommitMetadata.js +101 -0
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -0
- package/packages/database/src/lib/updateEntityBranch.js.map +1 -0
- package/packages/database/src/lib/updateFreshAnalysisMetadata.js.map +1 -0
- package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -0
- package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -0
- package/packages/database/src/lib/updateProjectMetadata.js.map +1 -0
- package/packages/database/src/lib/upsertAnalyses.js.map +1 -0
- package/packages/database/src/lib/upsertAnalysesWithScenarios.js.map +1 -0
- package/packages/database/src/lib/upsertAnalysisBranches.js.map +1 -0
- package/packages/database/src/lib/upsertBackgroundJob.js.map +1 -0
- package/packages/database/src/lib/upsertBranches.js.map +1 -0
- package/packages/database/src/lib/upsertCommitBranches.js.map +1 -0
- package/packages/database/src/lib/upsertCommits.js.map +1 -0
- package/packages/database/src/lib/upsertEntities.js.map +1 -0
- package/packages/database/src/lib/upsertEntityBranches.js.map +1 -0
- package/packages/database/src/lib/upsertFiles.js.map +1 -0
- package/packages/database/src/lib/upsertGithubUser.js.map +1 -0
- package/packages/database/src/lib/upsertProjects.js.map +1 -0
- package/packages/database/src/lib/upsertScenarios.js.map +1 -0
- package/packages/generate/index.js +3 -0
- package/packages/generate/index.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +43 -21
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/packages/generate/src/lib/deepMerge.js +30 -2
- package/packages/generate/src/lib/deepMerge.js.map +1 -1
- package/packages/generate/src/lib/directExecutionScript.js +10 -1
- package/packages/generate/src/lib/directExecutionScript.js.map +1 -1
- package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/packages/generate/src/lib/getComponentScenarioPath.js.map +1 -1
- package/packages/generate/src/lib/scenarioComponent.js +5 -3
- package/packages/generate/src/lib/scenarioComponent.js.map +1 -1
- package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/packages/github/src/lib/getCommitsFromGithub.js +1 -1
- package/packages/github/src/lib/loadOrCreateCommit.js +11 -1
- package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/packages/github/src/lib/syncHeadBranches.js +1 -1
- package/packages/github/src/lib/syncPrimaryBranch.js +4 -1
- package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/packages/github/src/lib/syncPullRequest.js +1 -1
- package/packages/github/src/lib/updateCommitBranchesInDb.js +1 -1
- package/packages/github/src/lib/updateFilesInDb.js +1 -1
- package/packages/process/index.js +3 -0
- package/packages/process/index.js.map +1 -0
- package/packages/process/src/GlobalProcessManager.js.map +1 -0
- package/packages/process/src/ProcessManager.js +244 -0
- package/packages/process/src/ProcessManager.js.map +1 -0
- package/packages/process/src/index.js.map +1 -0
- package/packages/process/src/managedExecAsync.js.map +1 -0
- package/packages/types/index.js.map +1 -1
- package/packages/utils/index.js +4 -0
- package/packages/utils/index.js.map +1 -1
- package/packages/utils/src/lib/Semaphore.js +40 -0
- package/packages/utils/src/lib/Semaphore.js.map +1 -0
- package/packages/utils/src/lib/applyUniversalMocks.js +65 -7
- package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/packages/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.js +14 -2
- package/packages/utils/src/lib/frameworks/frameworkRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js +2 -1
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +14 -2
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +62 -0
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/packages/utils/src/lib/lightweightEntityExtractor.js +42 -0
- package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +32 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/packages/utils/src/lib/startCommand/buildStartCommand.js +45 -0
- package/packages/utils/src/lib/startCommand/buildStartCommand.js.map +1 -0
- package/packages/utils/src/lib/startCommand/getWebappInfo.js +67 -0
- package/packages/utils/src/lib/startCommand/getWebappInfo.js.map +1 -0
- package/packages/utils/src/lib/startCommand/index.js +3 -0
- package/packages/utils/src/lib/startCommand/index.js.map +1 -0
- package/scripts/finalize-analyzer.cjs +8 -74
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -149
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -235
- package/analyzer-template/packages/ai/src/lib/generateEntityDataMap.ts +0 -375
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -227
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -101
- package/analyzer-template/packages/github/dist/supabase/index.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/index.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/analysisBranchToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/analysisBranchToDb.js +0 -19
- package/analyzer-template/packages/github/dist/supabase/src/lib/analysisBranchToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/analysisToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/analysisToDb.js +0 -26
- package/analyzer-template/packages/github/dist/supabase/src/lib/analysisToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/backgroundJobToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/backgroundJobToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/branchToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/branchToDb.js +0 -18
- package/analyzer-template/packages/github/dist/supabase/src/lib/branchToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/commitBranchToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/commitBranchToDb.js +0 -13
- package/analyzer-template/packages/github/dist/supabase/src/lib/commitBranchToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/commitToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/commitToDb.js +0 -26
- package/analyzer-template/packages/github/dist/supabase/src/lib/commitToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/createOrUpdateBranchCommitStats.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/createOrUpdateBranchCommitStats.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/createProject.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/createProject.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/createRetryFetch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/createRetryFetch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToAnalysis.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToAnalysis.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToAnalysisBranch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToAnalysisBranch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToBackgroundJob.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToBackgroundJob.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToBranch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToBranch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToCommit.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToCommit.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToCommitBranch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToCommitBranch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToEntity.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToEntity.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToEntityBranch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToEntityBranch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToFile.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToFile.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToProject.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToProject.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToScenario.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToScenario.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToScenarioComment.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToScenarioComment.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToUserScenario.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/dbToUserScenario.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteBranch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteBranch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteEntities.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteEntities.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteFile.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteFile.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteScenarios.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/deleteScenarios.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/entityToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/entityToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/fileToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/fileToDb.js +0 -14
- package/analyzer-template/packages/github/dist/supabase/src/lib/fileToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/generateSha.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/generateSha.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/jsonUpdateUtils.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/jsonUpdateUtils.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/aggregationHelpers.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/aggregationHelpers.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.d.ts +0 -67
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.js +0 -360
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/schemaHelpers.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/schemaHelpers.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/sqliteBooleanPlugin.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/sqliteBooleanPlugin.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelations.d.ts +0 -87
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelations.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelations.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelationsTypes.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelationsTypes.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/analysesTable.d.ts +0 -105
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/analysesTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/analysesTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/analysisBranchesTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/analysisBranchesTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/backgroundJobsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/backgroundJobsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/branchesTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/branchesTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/commitBranchesTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/commitBranchesTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/commitsTable.d.ts +0 -47
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/commitsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/commitsTable.js +0 -44
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/commitsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/entitiesTable.d.ts +0 -65
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/entitiesTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/entitiesTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/entityBranchesTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/entityBranchesTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/entityStatementsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/entityStatementsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/filesTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/filesTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/githubPayloadsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/githubPayloadsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/githubUsersTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/githubUsersTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/projectsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/projectsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/scenarioCommentsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/scenarioCommentsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/scenariosTable.d.ts +0 -65
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/scenariosTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/scenariosTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/statementsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/statementsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/teamsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/teamsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/userScenariosTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/userScenariosTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/userTeamsTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/userTeamsTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/usersTable.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/usersTable.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/upsertHelpers.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/upsertHelpers.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalyses.d.ts +0 -14
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalyses.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalyses.js +0 -131
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalyses.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalysis.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalysis.js +0 -130
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalysis.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalysisBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadAnalysisBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadBackgroundJob.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadBackgroundJob.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadBranch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadBranch.js +0 -90
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadBranch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommit.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommit.js +0 -111
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommit.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommitBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommitBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommitMetadata.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommitMetadata.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommits.d.ts +0 -13
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommits.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommits.js +0 -188
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadCommits.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntities.d.ts +0 -11
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntities.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntities.js +0 -63
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntities.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntity.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntity.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntityBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntityBranches.js +0 -114
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadEntityBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadFile.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadFile.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadFiles.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadFiles.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadMostRecentPreviousAnalysis.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadMostRecentPreviousAnalysis.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadProject.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadProject.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadReadyToBeCapturedAnalyses.js +0 -50
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadReadyToBeCapturedAnalyses.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadScenario.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadScenario.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadStatement.d.ts +0 -3
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadStatement.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/loadStatement.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/nullsToUndefines.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/nullsToUndefines.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/projectToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/projectToDb.js +0 -18
- package/analyzer-template/packages/github/dist/supabase/src/lib/projectToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveBackgroundEvent.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveBackgroundEvent.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveEntityStatements.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveEntityStatements.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveFiles.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveFiles.js +0 -33
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveFiles.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveStatement.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/saveStatement.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/scenarioToDb.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/scenarioToDb.js +0 -18
- package/analyzer-template/packages/github/dist/supabase/src/lib/scenarioToDb.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/supabase.d.ts +0 -4
- package/analyzer-template/packages/github/dist/supabase/src/lib/supabase.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/supabase.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateBackgroundJobProgress.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateBackgroundJobProgress.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateCommitMetadata.d.ts +0 -13
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateCommitMetadata.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateCommitMetadata.js +0 -100
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateCommitMetadata.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateEntityBranch.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateEntityBranch.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateFreshAnalysisMetadata.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateFreshAnalysisMetadata.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateFreshAnalysisStatus.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateFreshAnalysisStatus.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateProjectMetadata.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/updateProjectMetadata.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertAnalyses.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertAnalyses.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertAnalysesWithScenarios.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertAnalysesWithScenarios.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertAnalysisBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertAnalysisBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertBackgroundJob.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertBackgroundJob.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertCommitBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertCommitBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertCommits.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertCommits.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertEntities.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertEntities.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertEntityBranches.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertEntityBranches.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertFiles.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertFiles.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertGithubUser.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertGithubUser.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertProjects.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertProjects.js.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertScenarios.d.ts.map +0 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/upsertScenarios.js.map +0 -1
- package/analyzer-template/packages/supabase/client.ts +0 -35
- package/analyzer-template/packages/supabase/package.json +0 -31
- package/analyzer-template/packages/supabase/src/lib/analysisBranchToDb.ts +0 -28
- package/analyzer-template/packages/supabase/src/lib/analysisToDb.ts +0 -59
- package/analyzer-template/packages/supabase/src/lib/branchToDb.ts +0 -24
- package/analyzer-template/packages/supabase/src/lib/commitBranchToDb.ts +0 -20
- package/analyzer-template/packages/supabase/src/lib/commitToDb.ts +0 -47
- package/analyzer-template/packages/supabase/src/lib/fileToDb.ts +0 -17
- package/analyzer-template/packages/supabase/src/lib/kysely/db.ts +0 -476
- package/analyzer-template/packages/supabase/src/lib/kysely/tableRelations.ts +0 -105
- package/analyzer-template/packages/supabase/src/lib/kysely/tables/commitsTable.ts +0 -61
- package/analyzer-template/packages/supabase/src/lib/loadAnalyses.ts +0 -218
- package/analyzer-template/packages/supabase/src/lib/loadAnalysis.ts +0 -210
- package/analyzer-template/packages/supabase/src/lib/loadBranch.ts +0 -122
- package/analyzer-template/packages/supabase/src/lib/loadCommit.ts +0 -163
- package/analyzer-template/packages/supabase/src/lib/loadCommits.ts +0 -251
- package/analyzer-template/packages/supabase/src/lib/loadEntities.ts +0 -94
- package/analyzer-template/packages/supabase/src/lib/loadEntity.ts +0 -110
- package/analyzer-template/packages/supabase/src/lib/loadEntityBranches.ts +0 -166
- package/analyzer-template/packages/supabase/src/lib/loadFile.ts +0 -47
- package/analyzer-template/packages/supabase/src/lib/loadFiles.ts +0 -137
- package/analyzer-template/packages/supabase/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -76
- package/analyzer-template/packages/supabase/src/lib/loadStatement.ts +0 -23
- package/analyzer-template/packages/supabase/src/lib/projectToDb.ts +0 -35
- package/analyzer-template/packages/supabase/src/lib/saveEntityStatements.ts +0 -28
- package/analyzer-template/packages/supabase/src/lib/saveFiles.ts +0 -43
- package/analyzer-template/packages/supabase/src/lib/scenarioToDb.ts +0 -34
- package/analyzer-template/packages/supabase/src/lib/updateCommitMetadata.ts +0 -188
- package/analyzer-template/packages/supabase/src/lib/updateProjectMetadata.ts +0 -96
- package/analyzer-template/packages/supabase/src/lib/userScenarioToDb.ts +0 -18
- package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
- package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
- package/analyzer-template/process/README.md +0 -507
- package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
- package/background/src/lib/process/ProcessManager.js +0 -244
- package/background/src/lib/process/ProcessManager.js.map +0 -1
- package/background/src/lib/process/index.js.map +0 -1
- package/background/src/lib/process/managedExecAsync.js.map +0 -1
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
- package/codeyam-cli/src/commands/list.js +0 -31
- package/codeyam-cli/src/commands/list.js.map +0 -1
- package/codeyam-cli/src/utils/universal-mocks.js +0 -152
- package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-rqv54FUY.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-B0oiPem-.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DqXXjAJ7.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-BKKG1s2B.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DU_jxCPD.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-5DY-YIxu.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DmjXUj6m.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-DvSrcxsk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CsaMd9mb.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/chart-column-VXBS6qOn.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/circle-alert-n5GUC2AS.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/clock-DKqtX8js.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/components-Dj-Ggnl2.js +0 -40
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-C1gnJVOL.svg +0 -4
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BbR3FwNc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-BHiWkb_W.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-L7M9Vr5z.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-C9w-q7P3.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entityVersioning-Bk_YB1jM.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-CdGoUs8A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/file-text-B6Er7j5k.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-KcDVw1FY.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-B9uZ8eSJ.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-B0f88RTV.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-v3c6DFp4.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-fca08d7e.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-Cf8VBqIb.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-DA14wXpu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-COJUrwGu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-NU_ZquhK.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CNaMJ-nR.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-Lumm1t01.js +0 -2
- package/codeyam-cli/src/webserver/build/client/assets/useToast-BRShB17p.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/zap-BvukH0eN.js +0 -1
- package/codeyam-cli/src/webserver/build/client/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/build/client/favicon.svg +0 -13
- package/codeyam-cli/src/webserver/build/server/assets/index-DHr4rT4u.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Bi1mj14J.js +0 -166
- package/codeyam-cli/src/webserver/public/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/public/favicon.svg +0 -13
- package/codeyam-cli/templates/codeyam-debug-skill.md +0 -557
- package/codeyam-cli/templates/codeyam-setup-skill.md +0 -468
- package/codeyam-cli/templates/codeyam-sim-skill.md +0 -222
- package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
- package/codeyam-cli/templates/codeyam-test-skill.md +0 -178
- package/codeyam-cli/templates/codeyam-verify-skill.md +0 -179
- package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
- package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -112
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -190
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityDataMap.js +0 -335
- package/packages/ai/src/lib/generateEntityDataMap.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -182
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/isFrontend.js +0 -5
- package/packages/ai/src/lib/isFrontend.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js +0 -17
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -59
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
- package/packages/supabase/index.js.map +0 -1
- package/packages/supabase/src/lib/analysisBranchToDb.js +0 -19
- package/packages/supabase/src/lib/analysisBranchToDb.js.map +0 -1
- package/packages/supabase/src/lib/analysisToDb.js +0 -26
- package/packages/supabase/src/lib/analysisToDb.js.map +0 -1
- package/packages/supabase/src/lib/backgroundJobToDb.js.map +0 -1
- package/packages/supabase/src/lib/branchToDb.js +0 -18
- package/packages/supabase/src/lib/branchToDb.js.map +0 -1
- package/packages/supabase/src/lib/commitBranchToDb.js +0 -13
- package/packages/supabase/src/lib/commitBranchToDb.js.map +0 -1
- package/packages/supabase/src/lib/commitToDb.js +0 -26
- package/packages/supabase/src/lib/commitToDb.js.map +0 -1
- package/packages/supabase/src/lib/createOrUpdateBranchCommitStats.js.map +0 -1
- package/packages/supabase/src/lib/createProject.js.map +0 -1
- package/packages/supabase/src/lib/createRetryFetch.js.map +0 -1
- package/packages/supabase/src/lib/dbToAnalysis.js.map +0 -1
- package/packages/supabase/src/lib/dbToAnalysisBranch.js.map +0 -1
- package/packages/supabase/src/lib/dbToBackgroundJob.js.map +0 -1
- package/packages/supabase/src/lib/dbToBranch.js.map +0 -1
- package/packages/supabase/src/lib/dbToCommit.js.map +0 -1
- package/packages/supabase/src/lib/dbToCommitBranch.js.map +0 -1
- package/packages/supabase/src/lib/dbToEntity.js.map +0 -1
- package/packages/supabase/src/lib/dbToEntityBranch.js.map +0 -1
- package/packages/supabase/src/lib/dbToFile.js.map +0 -1
- package/packages/supabase/src/lib/dbToProject.js.map +0 -1
- package/packages/supabase/src/lib/dbToScenario.js.map +0 -1
- package/packages/supabase/src/lib/dbToScenarioComment.js.map +0 -1
- package/packages/supabase/src/lib/dbToUserScenario.js.map +0 -1
- package/packages/supabase/src/lib/deleteBranch.js.map +0 -1
- package/packages/supabase/src/lib/deleteEntities.js.map +0 -1
- package/packages/supabase/src/lib/deleteFile.js.map +0 -1
- package/packages/supabase/src/lib/deleteScenarios.js.map +0 -1
- package/packages/supabase/src/lib/entityToDb.js.map +0 -1
- package/packages/supabase/src/lib/fileToDb.js +0 -14
- package/packages/supabase/src/lib/fileToDb.js.map +0 -1
- package/packages/supabase/src/lib/generateSha.js.map +0 -1
- package/packages/supabase/src/lib/jsonUpdateUtils.js.map +0 -1
- package/packages/supabase/src/lib/kysely/aggregationHelpers.js.map +0 -1
- package/packages/supabase/src/lib/kysely/db.js +0 -360
- package/packages/supabase/src/lib/kysely/db.js.map +0 -1
- package/packages/supabase/src/lib/kysely/schemaHelpers.js.map +0 -1
- package/packages/supabase/src/lib/kysely/sqliteBooleanPlugin.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tableRelations.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tableRelationsTypes.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/analysesTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/analysisBranchesTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/backgroundJobsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/branchesTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/commitBranchesTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/commitsTable.js +0 -44
- package/packages/supabase/src/lib/kysely/tables/commitsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/entitiesTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/entityBranchesTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/entityStatementsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/filesTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/githubPayloadsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/githubUsersTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/projectsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/scenarioCommentsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/scenariosTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/statementsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/teamsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/userScenariosTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/userTeamsTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/tables/usersTable.js.map +0 -1
- package/packages/supabase/src/lib/kysely/upsertHelpers.js.map +0 -1
- package/packages/supabase/src/lib/loadAnalyses.js +0 -131
- package/packages/supabase/src/lib/loadAnalyses.js.map +0 -1
- package/packages/supabase/src/lib/loadAnalysis.js +0 -130
- package/packages/supabase/src/lib/loadAnalysis.js.map +0 -1
- package/packages/supabase/src/lib/loadAnalysisBranches.js.map +0 -1
- package/packages/supabase/src/lib/loadBackgroundJob.js.map +0 -1
- package/packages/supabase/src/lib/loadBranch.js +0 -90
- package/packages/supabase/src/lib/loadBranch.js.map +0 -1
- package/packages/supabase/src/lib/loadBranches.js.map +0 -1
- package/packages/supabase/src/lib/loadCommit.js +0 -111
- package/packages/supabase/src/lib/loadCommit.js.map +0 -1
- package/packages/supabase/src/lib/loadCommitBranches.js.map +0 -1
- package/packages/supabase/src/lib/loadCommitMetadata.js.map +0 -1
- package/packages/supabase/src/lib/loadCommits.js +0 -188
- package/packages/supabase/src/lib/loadCommits.js.map +0 -1
- package/packages/supabase/src/lib/loadEntities.js +0 -63
- package/packages/supabase/src/lib/loadEntities.js.map +0 -1
- package/packages/supabase/src/lib/loadEntity.js.map +0 -1
- package/packages/supabase/src/lib/loadEntityBranches.js +0 -114
- package/packages/supabase/src/lib/loadEntityBranches.js.map +0 -1
- package/packages/supabase/src/lib/loadFile.js.map +0 -1
- package/packages/supabase/src/lib/loadFiles.js.map +0 -1
- package/packages/supabase/src/lib/loadMostRecentPreviousAnalysis.js.map +0 -1
- package/packages/supabase/src/lib/loadProject.js.map +0 -1
- package/packages/supabase/src/lib/loadReadyToBeCapturedAnalyses.js +0 -50
- package/packages/supabase/src/lib/loadReadyToBeCapturedAnalyses.js.map +0 -1
- package/packages/supabase/src/lib/loadScenario.js.map +0 -1
- package/packages/supabase/src/lib/loadStatement.js.map +0 -1
- package/packages/supabase/src/lib/nullsToUndefines.js.map +0 -1
- package/packages/supabase/src/lib/projectToDb.js +0 -18
- package/packages/supabase/src/lib/projectToDb.js.map +0 -1
- package/packages/supabase/src/lib/saveBackgroundEvent.js.map +0 -1
- package/packages/supabase/src/lib/saveEntityStatements.js.map +0 -1
- package/packages/supabase/src/lib/saveFiles.js +0 -33
- package/packages/supabase/src/lib/saveFiles.js.map +0 -1
- package/packages/supabase/src/lib/saveStatement.js.map +0 -1
- package/packages/supabase/src/lib/scenarioToDb.js +0 -18
- package/packages/supabase/src/lib/scenarioToDb.js.map +0 -1
- package/packages/supabase/src/lib/supabase.js.map +0 -1
- package/packages/supabase/src/lib/updateBackgroundJobProgress.js.map +0 -1
- package/packages/supabase/src/lib/updateCommitMetadata.js +0 -100
- package/packages/supabase/src/lib/updateCommitMetadata.js.map +0 -1
- package/packages/supabase/src/lib/updateEntityBranch.js.map +0 -1
- package/packages/supabase/src/lib/updateFreshAnalysisMetadata.js.map +0 -1
- package/packages/supabase/src/lib/updateFreshAnalysisStatus.js.map +0 -1
- package/packages/supabase/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +0 -1
- package/packages/supabase/src/lib/updateProjectMetadata.js.map +0 -1
- package/packages/supabase/src/lib/upsertAnalyses.js.map +0 -1
- package/packages/supabase/src/lib/upsertAnalysesWithScenarios.js.map +0 -1
- package/packages/supabase/src/lib/upsertAnalysisBranches.js.map +0 -1
- package/packages/supabase/src/lib/upsertBackgroundJob.js.map +0 -1
- package/packages/supabase/src/lib/upsertBranches.js.map +0 -1
- package/packages/supabase/src/lib/upsertCommitBranches.js.map +0 -1
- package/packages/supabase/src/lib/upsertCommits.js.map +0 -1
- package/packages/supabase/src/lib/upsertEntities.js.map +0 -1
- package/packages/supabase/src/lib/upsertEntityBranches.js.map +0 -1
- package/packages/supabase/src/lib/upsertFiles.js.map +0 -1
- package/packages/supabase/src/lib/upsertGithubUser.js.map +0 -1
- package/packages/supabase/src/lib/upsertProjects.js.map +0 -1
- package/packages/supabase/src/lib/upsertScenarios.js.map +0 -1
- /package/analyzer-template/packages/{supabase → database}/__mocks__/index.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/index.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/backgroundJobToDb.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/client/listenForCommits_Client.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/client/loadAnalysesInClient.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/client/loadAnalysis_Client.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/client/loadBranches_Client.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/client/loadCommit_Client.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/client/upsertFiles_Client.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/createOrUpdateBranchCommitStats.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/createProject.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/createRetryFetch.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToAnalysis.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToAnalysisBranch.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToBackgroundJob.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToBranch.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToCommit.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToCommitBranch.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToEntity.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToEntityBranch.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToFile.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToProject.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToScenario.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToScenarioComment.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/dbToUserScenario.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/deleteBranch.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/deleteEntities.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/deleteFile.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/deleteScenarios.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/entityToDb.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/generateSha.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/jsonUpdateUtils.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/aggregationHelpers.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/schemaHelpers.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/sqliteBooleanPlugin.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tableRelationsTypes.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/analysesTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/analysisBranchesTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/backgroundJobsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/branchesTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/commitBranchesTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/entitiesTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/entityBranchesTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/entityStatementsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/filesTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/githubPayloadsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/githubUsersTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/projectsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/scenarioCommentsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/scenariosTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/statementsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/teamsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/userScenariosTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/userTeamsTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/tables/usersTable.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely/upsertHelpers.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/kysely.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadAnalysisBranches.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadBackgroundJob.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadBranches.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadCommitBranches.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadCommitMetadata.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadMostRecentPreviousAnalysis.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadProject.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/loadScenario.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/nullsToUndefines.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/saveBackgroundEvent.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/saveStatement.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/scenarioCommentToDb.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/supabase.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/updateBackgroundJobProgress.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/updateEntityBranch.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/updateFreshAnalysisMetadata.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/updateFreshAnalysisStatus.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/updateFreshAnalysisStatusWithScenarios.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertAnalyses.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertAnalysesWithScenarios.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertAnalysisBranches.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertBackgroundJob.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertBranches.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertCommitBranches.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertCommits.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertEntities.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertEntityBranches.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertFiles.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertGithubUser.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertProjects.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/src/lib/upsertScenarios.ts +0 -0
- /package/analyzer-template/packages/{supabase → database}/tsconfig.json +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/index.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/index.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/analysisBranchToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/analysisToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/backgroundJobToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/backgroundJobToDb.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/branchToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/commitBranchToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/commitToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/createOrUpdateBranchCommitStats.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/createOrUpdateBranchCommitStats.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/createProject.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/createProject.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/createRetryFetch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/createRetryFetch.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToAnalysis.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToAnalysis.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToAnalysisBranch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToAnalysisBranch.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToBackgroundJob.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToBackgroundJob.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToBranch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToBranch.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToCommit.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToCommit.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToCommitBranch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToCommitBranch.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToEntity.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToEntity.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToEntityBranch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToEntityBranch.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToFile.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToFile.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToProject.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToProject.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToScenario.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToScenario.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToScenarioComment.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToScenarioComment.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToUserScenario.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/dbToUserScenario.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteBranch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteBranch.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteEntities.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteEntities.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteFile.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteFile.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteScenarios.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/deleteScenarios.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/entityToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/entityToDb.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/fileToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/generateSha.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/generateSha.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/jsonUpdateUtils.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/jsonUpdateUtils.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/aggregationHelpers.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/aggregationHelpers.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/schemaHelpers.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/schemaHelpers.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/sqliteBooleanPlugin.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/sqliteBooleanPlugin.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tableRelations.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tableRelationsTypes.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tableRelationsTypes.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/analysesTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/analysisBranchesTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/analysisBranchesTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/backgroundJobsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/backgroundJobsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/branchesTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/branchesTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/commitBranchesTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/commitBranchesTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/entitiesTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/entityBranchesTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/entityBranchesTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/entityStatementsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/entityStatementsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/filesTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/filesTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/githubPayloadsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/githubPayloadsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/githubUsersTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/githubUsersTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/projectsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/projectsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/scenarioCommentsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/scenarioCommentsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/scenariosTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/statementsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/statementsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/teamsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/teamsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/userScenariosTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/userScenariosTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/userTeamsTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/userTeamsTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/usersTable.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/tables/usersTable.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/upsertHelpers.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/kysely/upsertHelpers.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadAnalysis.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadAnalysisBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadAnalysisBranches.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadBackgroundJob.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadBackgroundJob.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadBranch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadBranches.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadCommit.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadCommitBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadCommitBranches.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadCommitMetadata.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadCommitMetadata.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadEntity.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadEntity.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadEntityBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadFile.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadFile.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadFiles.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadFiles.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadMostRecentPreviousAnalysis.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadMostRecentPreviousAnalysis.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadProject.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadProject.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadReadyToBeCapturedAnalyses.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadScenario.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadScenario.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/loadStatement.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/nullsToUndefines.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/nullsToUndefines.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/projectToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/saveBackgroundEvent.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/saveBackgroundEvent.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/saveEntityStatements.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/saveEntityStatements.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/saveFiles.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/saveStatement.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/saveStatement.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/scenarioToDb.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/supabase.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateBackgroundJobProgress.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateBackgroundJobProgress.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateEntityBranch.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateEntityBranch.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateFreshAnalysisMetadata.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateFreshAnalysisMetadata.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateFreshAnalysisStatus.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateFreshAnalysisStatus.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateFreshAnalysisStatusWithScenarios.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateProjectMetadata.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/updateProjectMetadata.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertAnalyses.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertAnalyses.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertAnalysesWithScenarios.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertAnalysesWithScenarios.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertAnalysisBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertAnalysisBranches.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertBackgroundJob.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertBackgroundJob.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertBranches.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertCommitBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertCommitBranches.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertCommits.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertCommits.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertEntities.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertEntities.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertEntityBranches.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertEntityBranches.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertFiles.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertFiles.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertGithubUser.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertGithubUser.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertProjects.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertProjects.js +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertScenarios.d.ts +0 -0
- /package/analyzer-template/packages/github/dist/{supabase → database}/src/lib/upsertScenarios.js +0 -0
- /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
- /package/packages/{supabase → database}/index.js +0 -0
- /package/packages/{supabase → database}/src/lib/backgroundJobToDb.js +0 -0
- /package/packages/{supabase → database}/src/lib/createOrUpdateBranchCommitStats.js +0 -0
- /package/packages/{supabase → database}/src/lib/createProject.js +0 -0
- /package/packages/{supabase → database}/src/lib/createRetryFetch.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToAnalysis.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToAnalysisBranch.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToBackgroundJob.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToBranch.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToCommit.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToCommitBranch.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToEntity.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToEntityBranch.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToFile.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToProject.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToScenario.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToScenarioComment.js +0 -0
- /package/packages/{supabase → database}/src/lib/dbToUserScenario.js +0 -0
- /package/packages/{supabase → database}/src/lib/deleteBranch.js +0 -0
- /package/packages/{supabase → database}/src/lib/deleteEntities.js +0 -0
- /package/packages/{supabase → database}/src/lib/deleteFile.js +0 -0
- /package/packages/{supabase → database}/src/lib/deleteScenarios.js +0 -0
- /package/packages/{supabase → database}/src/lib/entityToDb.js +0 -0
- /package/packages/{supabase → database}/src/lib/generateSha.js +0 -0
- /package/packages/{supabase → database}/src/lib/jsonUpdateUtils.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/aggregationHelpers.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/schemaHelpers.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/sqliteBooleanPlugin.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tableRelations.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tableRelationsTypes.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/analysesTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/analysisBranchesTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/backgroundJobsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/branchesTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/commitBranchesTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/entitiesTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/entityBranchesTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/entityStatementsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/filesTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/githubPayloadsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/githubUsersTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/projectsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/scenarioCommentsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/scenariosTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/statementsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/teamsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/userScenariosTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/userTeamsTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/tables/usersTable.js +0 -0
- /package/packages/{supabase → database}/src/lib/kysely/upsertHelpers.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadAnalysisBranches.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadBackgroundJob.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadBranches.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadCommitBranches.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadCommitMetadata.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadEntity.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadFile.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadFiles.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadMostRecentPreviousAnalysis.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadProject.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadScenario.js +0 -0
- /package/packages/{supabase → database}/src/lib/loadStatement.js +0 -0
- /package/packages/{supabase → database}/src/lib/nullsToUndefines.js +0 -0
- /package/packages/{supabase → database}/src/lib/saveBackgroundEvent.js +0 -0
- /package/packages/{supabase → database}/src/lib/saveEntityStatements.js +0 -0
- /package/packages/{supabase → database}/src/lib/saveStatement.js +0 -0
- /package/packages/{supabase → database}/src/lib/supabase.js +0 -0
- /package/packages/{supabase → database}/src/lib/updateBackgroundJobProgress.js +0 -0
- /package/packages/{supabase → database}/src/lib/updateEntityBranch.js +0 -0
- /package/packages/{supabase → database}/src/lib/updateFreshAnalysisMetadata.js +0 -0
- /package/packages/{supabase → database}/src/lib/updateFreshAnalysisStatus.js +0 -0
- /package/packages/{supabase → database}/src/lib/updateFreshAnalysisStatusWithScenarios.js +0 -0
- /package/packages/{supabase → database}/src/lib/updateProjectMetadata.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertAnalyses.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertAnalysesWithScenarios.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertAnalysisBranches.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertBackgroundJob.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertBranches.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertCommitBranches.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertCommits.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertEntities.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertEntityBranches.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertFiles.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertGithubUser.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertProjects.js +0 -0
- /package/packages/{supabase → database}/src/lib/upsertScenarios.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
|
@@ -1,71 +1,268 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ScopeDataStructure
|
|
2
3
|
*
|
|
3
|
-
* The
|
|
4
|
-
*
|
|
4
|
+
* The core engine for CodeYam's static analysis. Takes AST analysis output and
|
|
5
|
+
* determines the complete data schema for a function by tracking how data flows
|
|
6
|
+
* through the code.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
8
|
+
* ## High-Level Architecture
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
+
* ```
|
|
11
|
+
* ┌─────────────────┐ ┌─────────────────────────────────────────────┐
|
|
12
|
+
* │ AST Analyzer │────▶│ ScopeDataStructure │
|
|
13
|
+
* │ (per-scope) │ │ │
|
|
14
|
+
* └─────────────────┘ │ Phase 1: Discovery (onlyEquivalencies) │
|
|
15
|
+
* │ ├─ Process each scope's analysis │
|
|
16
|
+
* │ ├─ Build equivalency relationships │
|
|
17
|
+
* │ └─ Track nested scope hierarchy │
|
|
18
|
+
* │ │
|
|
19
|
+
* │ Phase 2: Schema Building │
|
|
20
|
+
* │ ├─ Follow all equivalencies │
|
|
21
|
+
* │ ├─ Build complete schemas at data sources │
|
|
22
|
+
* │ └─ Populate equivalencyDatabase │
|
|
23
|
+
* └─────────────────────────────────────────────┘
|
|
24
|
+
* │
|
|
25
|
+
* ▼
|
|
26
|
+
* ┌─────────────────────────────────────────────┐
|
|
27
|
+
* │ Output │
|
|
28
|
+
* │ • Function signature schemas │
|
|
29
|
+
* │ • Return value types │
|
|
30
|
+
* │ • External API call schemas │
|
|
31
|
+
* │ • Data flow (source → usage) mappings │
|
|
32
|
+
* └─────────────────────────────────────────────┘
|
|
33
|
+
* ```
|
|
10
34
|
*
|
|
11
|
-
*
|
|
12
|
-
* source of the data (either the function's signature arguments or an external
|
|
13
|
-
* API call made from within the function). While following the equivalencies the
|
|
14
|
-
* second pass populates the equivalencyDatabase which tracks all equivalent values
|
|
15
|
-
* and provides easy access to determine where data comes from and where it is used
|
|
16
|
-
* to call external functions. This makes it possible to combine schemas between
|
|
17
|
-
* functions to create a complete schema for a dependency tree.
|
|
35
|
+
* ## Key Concepts
|
|
18
36
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
37
|
+
* ### Equivalencies
|
|
38
|
+
* When code assigns one variable to another (`const user = props.user`), we create
|
|
39
|
+
* an "equivalency" linking the two paths. Following these links lets us trace data
|
|
40
|
+
* back to its source (function arguments or API returns).
|
|
41
|
+
*
|
|
42
|
+
* ### Schema Paths
|
|
43
|
+
* Dot-separated strings describing data structure:
|
|
44
|
+
* - `signature[0].user.id` - First arg's user.id property
|
|
45
|
+
* - `items[].name` - name property of array elements
|
|
46
|
+
* - `functionCallReturnValue(fetch).data` - Return from fetch() call
|
|
47
|
+
*
|
|
48
|
+
* ### Two-Phase Processing
|
|
49
|
+
* 1. **Phase 1 (Discovery)**: `onlyEquivalencies = true`
|
|
50
|
+
* - Processes scopes, builds equivalency graph
|
|
51
|
+
* - Does NOT populate schemas yet
|
|
52
|
+
*
|
|
53
|
+
* 2. **Phase 2 (Schema Building)**: `captureCompleteSchema()`
|
|
54
|
+
* - Follows equivalencies to build complete schemas
|
|
55
|
+
* - Populates `equivalencyDatabase` for source/usage queries
|
|
56
|
+
*
|
|
57
|
+
* ## Key Methods (Entry Points)
|
|
58
|
+
*
|
|
59
|
+
* - `constructor(scopeName, scopeText, managers, scopeAnalysis)` - Initialize with root scope
|
|
60
|
+
* - `addScopeAnalysis(scopeName, text, analysis)` - Add nested scope
|
|
61
|
+
* - `captureCompleteSchema()` - Trigger Phase 2 processing
|
|
62
|
+
* - `getSchema({scopeName})` - Get schema for a scope
|
|
63
|
+
* - `getFunctionSignature({functionName})` - Get function signature schema
|
|
64
|
+
* - `getSourceEquivalencies()` - Find where data comes from
|
|
65
|
+
* - `getUsageEquivalencies()` - Find where data is used
|
|
66
|
+
*
|
|
67
|
+
* ## Debugging Tips
|
|
68
|
+
*
|
|
69
|
+
* - Enable metrics: `addToSchemaCallCount`, `followEquivalenciesCallCount`
|
|
70
|
+
* - Check `scopeNode.equivalencies` for raw equivalency data
|
|
71
|
+
* - Use `getEquivalenciesDatabaseEntry(scope, path)` to trace a specific path
|
|
72
|
+
* - The `visitedTracker` prevents infinite loops - if data is missing, check if
|
|
73
|
+
* it was already visited with a different value
|
|
74
|
+
*
|
|
75
|
+
* ## Related Files
|
|
76
|
+
*
|
|
77
|
+
* - `helpers/` - Extracted utility modules (PathManager, VisitedTracker, etc.)
|
|
78
|
+
* - `equivalencyManagers/` - Plugins that create equivalencies from AST patterns
|
|
79
|
+
* - `helpers/README.md` - Overview of the helper module architecture
|
|
22
80
|
*/
|
|
23
|
-
import { joinParenthesesAndArrays, splitOutsideParenthesesAndArrays, } from "../splitOutsideParentheses.js";
|
|
24
81
|
import fillInSchemaGapsAndUnknowns from "./helpers/fillInSchemaGapsAndUnknowns.js";
|
|
82
|
+
import { clearCleanKnownObjectFunctionsCache } from "./helpers/cleanKnownObjectFunctions.js";
|
|
83
|
+
import { clearCleanNonObjectFunctionsCache } from "./helpers/cleanNonObjectFunctions.js";
|
|
84
|
+
/**
|
|
85
|
+
* Patterns that indicate recursive type structures in schema paths.
|
|
86
|
+
* Used by hasExcessivePatternRepetition() to detect exponential path blowup.
|
|
87
|
+
*/
|
|
88
|
+
const RECURSIVE_PATH_PATTERNS = [
|
|
89
|
+
/\.attributes\.properties\[\]/g, // TypeScript AST JSX nodes
|
|
90
|
+
/\.children\[\]/g, // Tree structures
|
|
91
|
+
/\.elements\[\]/g, // Array-like structures
|
|
92
|
+
/\.members\[\]/g, // Class/interface members
|
|
93
|
+
/\.properties\[\]/g, // Object properties
|
|
94
|
+
/\.items\[\]/g, // Generic items arrays
|
|
95
|
+
];
|
|
25
96
|
import ensureSchemaConsistency from "./helpers/ensureSchemaConsistency.js";
|
|
26
|
-
import cleanOutBoundary from "../cleanOutBoundary.js";
|
|
27
97
|
import cleanPath from "./helpers/cleanPath.js";
|
|
98
|
+
import { PathManager } from "./helpers/PathManager.js";
|
|
99
|
+
import { uniqueId, uniqueScopeAndPaths, uniqueScopeVariables, } from "./helpers/uniqueIdUtils.js";
|
|
100
|
+
import selectBestValue from "./helpers/selectBestValue.js";
|
|
101
|
+
import { VisitedTracker } from "./helpers/VisitedTracker.js";
|
|
102
|
+
import { DebugTracer } from "./helpers/DebugTracer.js";
|
|
103
|
+
import { BatchSchemaProcessor } from "./helpers/BatchSchemaProcessor.js";
|
|
104
|
+
import { ROOT_SCOPE_NAME, ScopeTreeManager, } from "./helpers/ScopeTreeManager.js";
|
|
28
105
|
import cleanScopeNodeName from "./helpers/cleanScopeNodeName.js";
|
|
29
106
|
import getFunctionCallRoot from "./helpers/getFunctionCallRoot.js";
|
|
30
107
|
import cleanPathOfNonTransformingFunctions from "./helpers/cleanPathOfNonTransformingFunctions.js";
|
|
31
108
|
import { arrayMethodsSet } from "./helpers/cleanNonObjectFunctions.js";
|
|
32
|
-
const ROOT_SCOPE_NAME = 'root';
|
|
33
109
|
// DEBUG: Performance metrics
|
|
34
110
|
export let maxEquivalencyChainDepth = 0;
|
|
35
111
|
export let addToSchemaCallCount = 0;
|
|
36
112
|
export let followEquivalenciesCallCount = 0;
|
|
113
|
+
export let followEquivalenciesEarlyExitCount = 0;
|
|
114
|
+
export let followEquivalenciesEarlyExitPhase1Count = 0;
|
|
115
|
+
export let followEquivalenciesWithWorkCount = 0;
|
|
116
|
+
export let addEquivalencyCallCount = 0;
|
|
37
117
|
export function resetScopeDataStructureMetrics() {
|
|
38
118
|
maxEquivalencyChainDepth = 0;
|
|
39
119
|
addToSchemaCallCount = 0;
|
|
40
120
|
followEquivalenciesCallCount = 0;
|
|
121
|
+
followEquivalenciesEarlyExitCount = 0;
|
|
122
|
+
followEquivalenciesEarlyExitPhase1Count = 0;
|
|
123
|
+
followEquivalenciesWithWorkCount = 0;
|
|
124
|
+
addEquivalencyCallCount = 0;
|
|
125
|
+
// Clear module-level caches to prevent unbounded memory growth across entities
|
|
126
|
+
const knownObjectCache = clearCleanKnownObjectFunctionsCache();
|
|
127
|
+
const nonObjectCache = clearCleanNonObjectFunctionsCache();
|
|
128
|
+
if (knownObjectCache.count > 0 || nonObjectCache.count > 0) {
|
|
129
|
+
const totalBytes = knownObjectCache.estimatedBytes + nonObjectCache.estimatedBytes;
|
|
130
|
+
console.log('CodeYam: Cleared analysis caches', {
|
|
131
|
+
knownObjectCache: `${knownObjectCache.count} entries, ${(knownObjectCache.estimatedBytes / 1024).toFixed(1)}KB`,
|
|
132
|
+
nonObjectCache: `${nonObjectCache.count} entries, ${(nonObjectCache.estimatedBytes / 1024).toFixed(1)}KB`,
|
|
133
|
+
totalKB: `${(totalBytes / 1024).toFixed(1)}KB`,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
41
136
|
}
|
|
137
|
+
// Performance: Pre-computed Sets for equivalency reason filtering (O(1) vs O(n))
|
|
138
|
+
const ALLOWED_EQUIVALENCY_REASONS = new Set([
|
|
139
|
+
'original equivalency',
|
|
140
|
+
'implicit parent equivalency',
|
|
141
|
+
'explicit parent equivalency',
|
|
142
|
+
'transformed non-object function equivalency - original equivalency',
|
|
143
|
+
'equivalency to external function call',
|
|
144
|
+
'functionCall to function signature equivalency',
|
|
145
|
+
'explicit parent signature',
|
|
146
|
+
'useState setter call equivalency',
|
|
147
|
+
'non-object function argument function signature equivalency1',
|
|
148
|
+
'non-object function argument function signature equivalency2',
|
|
149
|
+
'returnValue to functionCallReturnValue equivalency',
|
|
150
|
+
'.map() function deconstruction',
|
|
151
|
+
'useMemo return value equivalent to first argument return value',
|
|
152
|
+
'useState value equivalency',
|
|
153
|
+
'Node .then() equivalency',
|
|
154
|
+
'Explicit array deconstruction equivalency value',
|
|
155
|
+
'forwardRef equivalency',
|
|
156
|
+
'forwardRef signature to child signature equivalency',
|
|
157
|
+
'captured function call return value equivalency',
|
|
158
|
+
'original equivalency - rerouted via useCallback',
|
|
159
|
+
'non-object function argument function signature equivalency1 - rerouted via useCallback',
|
|
160
|
+
'non-object function argument function signature equivalency2 - rerouted via useCallback',
|
|
161
|
+
'implicit parent equivalency - rerouted via useCallback',
|
|
162
|
+
'Spread operator equivalency key update: implicit parent equivalency',
|
|
163
|
+
'Array.from() equivalency',
|
|
164
|
+
'propagated sub-property equivalency',
|
|
165
|
+
'propagated function call return sub-property equivalency',
|
|
166
|
+
'propagated parent-variable equivalency', // Added: propagate child scope equivalencies to parent scope when variable is defined in parent
|
|
167
|
+
'where was this function called from', // Added: tracks which scope called an external function
|
|
168
|
+
'MUI DataGrid renderCell params.row equivalency', // Added: links DataGrid renderCell params.row to rows array elements
|
|
169
|
+
'MUI Autocomplete getOptionLabel option equivalency', // Added: links Autocomplete getOptionLabel callback param to options array
|
|
170
|
+
'MUI Autocomplete renderOption option equivalency', // Added: links Autocomplete renderOption callback param to options array
|
|
171
|
+
'MUI Autocomplete option property equivalency', // Added: propagates property accesses from Autocomplete callbacks
|
|
172
|
+
]);
|
|
173
|
+
const SILENTLY_IGNORED_EQUIVALENCY_REASONS = new Set([
|
|
174
|
+
'signature of functionCall',
|
|
175
|
+
'transformed non-object function equivalency - implicit parent equivalency',
|
|
176
|
+
'transformed non-object function equivalency - non-object function argument function signature equivalency1',
|
|
177
|
+
'transformed non-object function equivalency - non-object function argument function signature equivalency2',
|
|
178
|
+
'transformed non-object function equivalency - equivalency to external function call',
|
|
179
|
+
'Explicit array deconstruction equivalency key',
|
|
180
|
+
'transformed non-object function equivalency - useState setter call equivalency',
|
|
181
|
+
'transformed non-object function equivalency - implicit parent equivalency - rerouted via useCallback',
|
|
182
|
+
'transformed non-object function equivalency - Array.from() equivalency',
|
|
183
|
+
'Spread operator equivalency key update: Explicit array deconstruction equivalency value',
|
|
184
|
+
// 'transformed non-object function equivalency - Explicit array deconstruction equivalency value',
|
|
185
|
+
]);
|
|
42
186
|
export class ScopeDataStructure {
|
|
187
|
+
// Getter for backward compatibility - returns the tree structure
|
|
188
|
+
get scopeTree() {
|
|
189
|
+
return this.scopeTreeManager.getTree();
|
|
190
|
+
}
|
|
43
191
|
constructor(managers, scopeName = ROOT_SCOPE_NAME, scopeText, scopeAnalysis) {
|
|
44
192
|
this.debugCount = 0;
|
|
45
193
|
this.onlyEquivalencies = true;
|
|
46
194
|
this.equivalencyManagers = [];
|
|
47
195
|
this.scopeNodes = {};
|
|
48
|
-
this.
|
|
196
|
+
this.scopeTreeManager = new ScopeTreeManager();
|
|
49
197
|
this.externalFunctionCalls = [];
|
|
50
198
|
this.environmentVariables = [];
|
|
51
199
|
this.equivalencyDatabase = [];
|
|
200
|
+
/**
|
|
201
|
+
* Conditional usages collected during AST analysis.
|
|
202
|
+
* Maps local variable path to array of usages.
|
|
203
|
+
*/
|
|
204
|
+
this.rawConditionalUsages = {};
|
|
205
|
+
/**
|
|
206
|
+
* Conditional effects collected during AST analysis.
|
|
207
|
+
* Tracks what setter calls happen inside conditionals (if, switch, ternary).
|
|
208
|
+
*/
|
|
209
|
+
this.rawConditionalEffects = [];
|
|
210
|
+
/**
|
|
211
|
+
* Compound conditionals collected during AST analysis.
|
|
212
|
+
* Groups conditions that must all be true together (e.g., a && b && c).
|
|
213
|
+
*/
|
|
214
|
+
this.rawCompoundConditionals = [];
|
|
215
|
+
/**
|
|
216
|
+
* Gating conditions for child component boundaries.
|
|
217
|
+
* Maps child component name to the conditions that must be true for it to render.
|
|
218
|
+
*/
|
|
219
|
+
this.rawChildBoundaryGatingConditions = {};
|
|
220
|
+
/**
|
|
221
|
+
* JSX rendering usages collected during AST analysis.
|
|
222
|
+
* Tracks arrays rendered via .map() and strings interpolated in JSX.
|
|
223
|
+
*/
|
|
224
|
+
this.rawJsxRenderingUsages = [];
|
|
52
225
|
this.lastAddToSchemaId = 0;
|
|
53
226
|
this.lastEquivalencyId = 0;
|
|
54
227
|
this.lastEquivalencyDatabaseId = 0;
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
228
|
+
this.pathManager = new PathManager();
|
|
229
|
+
this.visitedTracker = new VisitedTracker();
|
|
57
230
|
this.equivalencyDatabaseCache = new Map();
|
|
58
231
|
// Inverted index: maps uniqueId -> EquivalencyDatabaseEntry for O(1) lookup
|
|
59
232
|
this.intermediatesOrderIndex = new Map();
|
|
60
|
-
|
|
233
|
+
// Index for O(1) lookup of external function calls by name
|
|
234
|
+
// Invalidated by setting to null; rebuilt lazily on next access
|
|
235
|
+
this.externalFunctionCallsIndex = null;
|
|
236
|
+
// Tracks internal functions that have been filtered out during captureCompleteSchema
|
|
237
|
+
// Prevents re-adding them via subsequent equivalency propagation (e.g., from getReturnValue)
|
|
238
|
+
this.filteredInternalFunctions = new Set();
|
|
239
|
+
// Debug tracer for selective path/scope tracing
|
|
240
|
+
// Enable via: CODEYAM_DEBUG=true CODEYAM_DEBUG_PATHS="user.*,signature" npm test
|
|
241
|
+
this.tracer = new DebugTracer({
|
|
242
|
+
enabled: process.env.CODEYAM_DEBUG === 'true',
|
|
243
|
+
pathPatterns: process.env.CODEYAM_DEBUG_PATHS
|
|
244
|
+
? process.env.CODEYAM_DEBUG_PATHS.split(',').map((p) => new RegExp(p))
|
|
245
|
+
: [],
|
|
246
|
+
scopePatterns: process.env.CODEYAM_DEBUG_SCOPES
|
|
247
|
+
? process.env.CODEYAM_DEBUG_SCOPES.split(',').map((p) => new RegExp(p))
|
|
248
|
+
: [],
|
|
249
|
+
maxDepth: 20,
|
|
250
|
+
});
|
|
251
|
+
// Batch processor for converting recursive addToSchema calls to iterative processing
|
|
252
|
+
// This eliminates deep recursion and allows for better work deduplication
|
|
253
|
+
this.batchProcessor = null;
|
|
254
|
+
// Track items already in the batch queue to prevent duplicates
|
|
255
|
+
// For external function calls, uses path-only keys (no value) for more aggressive deduplication
|
|
256
|
+
this.batchQueuedSet = null;
|
|
61
257
|
this.equivalencyManagers.push(...managers);
|
|
62
|
-
this.
|
|
258
|
+
this.scopeTreeManager.setRootName(scopeName);
|
|
63
259
|
this.addScopeAnalysis(scopeName, scopeText, scopeAnalysis);
|
|
64
260
|
}
|
|
65
261
|
addScopeAnalysis(scopeNodeName, scopeText, scopeAnalysis, parentScopeName, isStatic) {
|
|
66
262
|
try {
|
|
67
|
-
if (scopeNodeName !== this.
|
|
68
|
-
parentScopeName
|
|
263
|
+
if (scopeNodeName !== this.scopeTreeManager.getRootName() &&
|
|
264
|
+
!parentScopeName) {
|
|
265
|
+
parentScopeName = this.scopeTreeManager.getRootName();
|
|
69
266
|
}
|
|
70
267
|
let tree = [];
|
|
71
268
|
if (parentScopeName) {
|
|
@@ -106,7 +303,7 @@ export class ScopeDataStructure {
|
|
|
106
303
|
}
|
|
107
304
|
catch (error) {
|
|
108
305
|
console.log('CodeYam Error: Failed to add scope analysis for scope:', JSON.stringify({
|
|
109
|
-
rootScopeName: this.
|
|
306
|
+
rootScopeName: this.scopeTreeManager.getRootName(),
|
|
110
307
|
scopeNodeName,
|
|
111
308
|
scopeNodeText: scopeText,
|
|
112
309
|
isolatedStructure: scopeAnalysis.isolatedStructure,
|
|
@@ -115,82 +312,175 @@ export class ScopeDataStructure {
|
|
|
115
312
|
throw error;
|
|
116
313
|
}
|
|
117
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Phase 2: Build complete schemas by following all equivalencies.
|
|
317
|
+
*
|
|
318
|
+
* This is the main entry point for schema building. Call this after all
|
|
319
|
+
* scopes have been added via `addScopeAnalysis()`.
|
|
320
|
+
*
|
|
321
|
+
* ## What Happens
|
|
322
|
+
*
|
|
323
|
+
* 1. Resets state (visited tracker, schemas, database)
|
|
324
|
+
* 2. For each scope, follows equivalencies to build complete schemas
|
|
325
|
+
* 3. Filters out internal function calls (keeps only external-facing)
|
|
326
|
+
* 4. Propagates source/usage relationships for querying
|
|
327
|
+
*
|
|
328
|
+
* ## After Calling
|
|
329
|
+
*
|
|
330
|
+
* You can then use:
|
|
331
|
+
* - `getSchema()` - Get the built schema for a scope
|
|
332
|
+
* - `getSourceEquivalencies()` - Find where data comes from
|
|
333
|
+
* - `getUsageEquivalencies()` - Find where data is used
|
|
334
|
+
*/
|
|
118
335
|
async captureCompleteSchema() {
|
|
336
|
+
// Reset state for Phase 2
|
|
119
337
|
this.onlyEquivalencies = false;
|
|
120
338
|
this.equivalencyDatabase = [];
|
|
121
|
-
this.equivalencyDatabaseCache.clear();
|
|
122
|
-
this.intermediatesOrderIndex.clear();
|
|
123
|
-
this.
|
|
339
|
+
this.equivalencyDatabaseCache.clear();
|
|
340
|
+
this.intermediatesOrderIndex.clear();
|
|
341
|
+
this.visitedTracker.resetGlobalVisited();
|
|
124
342
|
for (const externalFunctionCall of this.externalFunctionCalls) {
|
|
125
343
|
externalFunctionCall.schema = {};
|
|
126
344
|
}
|
|
127
|
-
// for
|
|
345
|
+
// Build schemas for all scopes in parallel
|
|
128
346
|
await Promise.all(Object.values(this.scopeNodes).map(async (scopeNode) => {
|
|
129
347
|
scopeNode.schema = {};
|
|
130
348
|
await this.determineEquivalenciesAndBuildSchema(scopeNode);
|
|
131
349
|
}));
|
|
132
|
-
// }
|
|
133
350
|
const validExternalFacingScopeNames = new Set([
|
|
134
|
-
this.
|
|
351
|
+
this.scopeTreeManager.getRootName(),
|
|
135
352
|
]);
|
|
136
353
|
this.externalFunctionCalls = this.externalFunctionCalls.filter((efc) => {
|
|
137
|
-
const efcName = efc.name
|
|
354
|
+
const efcName = this.pathManager.stripGenerics(efc.name);
|
|
138
355
|
for (const manager of this.equivalencyManagers) {
|
|
139
356
|
if (manager.internalFunctions.has(efcName)) {
|
|
357
|
+
// Track this so we don't re-add it via subsequent finalize calls
|
|
358
|
+
this.filteredInternalFunctions.add(efcName);
|
|
140
359
|
return false;
|
|
141
360
|
}
|
|
142
361
|
}
|
|
143
362
|
validExternalFacingScopeNames.add(efcName);
|
|
144
363
|
return true;
|
|
145
364
|
});
|
|
365
|
+
this.invalidateExternalFunctionCallsIndex();
|
|
366
|
+
// Pre-compute array methods list once (avoids Array.from() in hot loop)
|
|
367
|
+
const arrayMethodsList = Array.from(arrayMethodsSet);
|
|
368
|
+
const containsArrayMethod = (path) => arrayMethodsList.some((method) => path.includes(`.${method}(`));
|
|
146
369
|
for (const entry of this.equivalencyDatabase) {
|
|
147
|
-
entry.usages = entry.usages.filter((usage) =>
|
|
148
|
-
(usage.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
370
|
+
entry.usages = entry.usages.filter((usage) => {
|
|
371
|
+
const baseName = this.pathManager.stripGenerics(usage.scopeNodeName);
|
|
372
|
+
return (validExternalFacingScopeNames.has(baseName) &&
|
|
373
|
+
(usage.schemaPath.startsWith('returnValue') ||
|
|
374
|
+
usage.schemaPath.startsWith(baseName)) &&
|
|
375
|
+
!containsArrayMethod(usage.schemaPath));
|
|
376
|
+
});
|
|
377
|
+
entry.sourceCandidates = entry.sourceCandidates.filter((candidate) => {
|
|
378
|
+
const baseName = this.pathManager.stripGenerics(candidate.scopeNodeName);
|
|
379
|
+
// Check if this is a local variable path (doesn't contain function call pattern)
|
|
380
|
+
// Local variables like "surveys[]" or "items[]" are important for tracing data flow
|
|
381
|
+
// from parent to child components (e.g., surveys[] -> SurveyCard().signature[0].survey)
|
|
382
|
+
const isLocalVariablePath = !candidate.schemaPath.includes('()') &&
|
|
383
|
+
!candidate.schemaPath.startsWith('signature[') &&
|
|
384
|
+
!candidate.schemaPath.startsWith('returnValue');
|
|
385
|
+
return (validExternalFacingScopeNames.has(baseName) &&
|
|
386
|
+
(candidate.schemaPath.startsWith('signature[') ||
|
|
387
|
+
candidate.schemaPath.startsWith(baseName) ||
|
|
388
|
+
isLocalVariablePath) &&
|
|
389
|
+
!containsArrayMethod(candidate.schemaPath));
|
|
390
|
+
});
|
|
391
|
+
// If all sourceCandidates were filtered out (e.g., because they belonged to
|
|
392
|
+
// internal functions like useState), look for the highest-order intermediate
|
|
393
|
+
// that belongs to a valid external-facing scope
|
|
394
|
+
if (entry.sourceCandidates.length === 0 &&
|
|
395
|
+
Object.keys(entry.intermediatesOrder).length > 0) {
|
|
396
|
+
// Find intermediates that belong to valid external-facing scopes
|
|
397
|
+
const validIntermediates = Object.entries(entry.intermediatesOrder)
|
|
398
|
+
.filter(([pathId]) => {
|
|
399
|
+
const [scopeNodeName, schemaPath] = pathId.split('::');
|
|
400
|
+
if (!scopeNodeName || !schemaPath)
|
|
401
|
+
return false;
|
|
402
|
+
const baseName = this.pathManager.stripGenerics(scopeNodeName);
|
|
403
|
+
return (validExternalFacingScopeNames.has(baseName) &&
|
|
404
|
+
!containsArrayMethod(schemaPath));
|
|
405
|
+
})
|
|
406
|
+
.sort((a, b) => b[1] - a[1]); // Sort by order descending (highest first)
|
|
407
|
+
if (validIntermediates.length > 0) {
|
|
408
|
+
const [pathId] = validIntermediates[0];
|
|
409
|
+
const [scopeNodeName, schemaPath] = pathId.split('::');
|
|
410
|
+
if (scopeNodeName && schemaPath) {
|
|
411
|
+
entry.sourceCandidates.push({ scopeNodeName, schemaPath });
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
this.propagateSourceAndUsageEquivalencies(this.scopeNodes[this.scopeTreeManager.getRootName()]);
|
|
157
417
|
for (const externalFunctionCall of this.externalFunctionCalls) {
|
|
158
|
-
const t = new Date().getTime();
|
|
159
|
-
// console.info("Start Propagating", JSON.stringify({
|
|
160
|
-
// externalFunctionCallName: externalFunctionCall.name,
|
|
161
|
-
// // sourceEquivalencies: externalFunctionCall.sourceEquivalencies,
|
|
162
|
-
// }, null, 2));
|
|
163
418
|
this.propagateSourceAndUsageEquivalencies(externalFunctionCall);
|
|
164
|
-
const elapsedTime = new Date().getTime() - t;
|
|
165
|
-
if (elapsedTime > 100) {
|
|
166
|
-
console.warn('Long Propagation Time', {
|
|
167
|
-
externalFunctionCallName: externalFunctionCall.name,
|
|
168
|
-
time: elapsedTime,
|
|
169
|
-
});
|
|
170
|
-
// throw new Error("STOP - LONG PROPAGATION TIME")
|
|
171
|
-
}
|
|
172
|
-
// console.info("Done Propagating", JSON.stringify({
|
|
173
|
-
// externalFunctionCallName: externalFunctionCall.name,
|
|
174
|
-
// // sourceEquivalencies: externalFunctionCall.sourceEquivalencies,
|
|
175
|
-
// // usageEquivalencies: externalFunctionCall.usageEquivalencies,
|
|
176
|
-
// time: elapsedTime
|
|
177
|
-
// }, null, 2))
|
|
178
419
|
}
|
|
179
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Core method: Adds a path/value to a scope's schema and follows equivalencies.
|
|
423
|
+
*
|
|
424
|
+
* This is the heart of schema building. For each path, it:
|
|
425
|
+
* 1. Validates the path and checks if already visited
|
|
426
|
+
* 2. Adds the path → value mapping to the scope's schema
|
|
427
|
+
* 3. Follows any equivalencies to propagate the schema to linked paths
|
|
428
|
+
* 4. Tracks the equivalency chain for source/usage database
|
|
429
|
+
*
|
|
430
|
+
* ## Cycle Detection
|
|
431
|
+
*
|
|
432
|
+
* Uses `visitedTracker.checkAndMarkGlobalVisited()` to prevent infinite loops.
|
|
433
|
+
* A path is considered visited if the exact (scope, path, value) tuple has
|
|
434
|
+
* been processed before.
|
|
435
|
+
*
|
|
436
|
+
* ## Equivalency Following
|
|
437
|
+
*
|
|
438
|
+
* When a path has equivalencies (e.g., `user` → `props.user`), this method
|
|
439
|
+
* recursively calls itself to add the equivalent path to its scope's schema.
|
|
440
|
+
*
|
|
441
|
+
* @param path - Schema path to add (e.g., 'user.id')
|
|
442
|
+
* @param value - Type value (e.g., 'string', 'number')
|
|
443
|
+
* @param scopeNode - The scope to add to
|
|
444
|
+
* @param equivalencyValueChain - Tracks the chain for database population
|
|
445
|
+
* @param traceId - Debug ID for tracing specific paths
|
|
446
|
+
*/
|
|
180
447
|
addToSchema({ path, value, scopeNode, equivalencyValueChain = [], traceId, }) {
|
|
181
448
|
addToSchemaCallCount++;
|
|
449
|
+
// Trace entry for debugging
|
|
450
|
+
this.tracer.traceEnter('addToSchema', {
|
|
451
|
+
path,
|
|
452
|
+
scope: scopeNode?.name,
|
|
453
|
+
value,
|
|
454
|
+
chainDepth: equivalencyValueChain.length,
|
|
455
|
+
});
|
|
456
|
+
// Safety: Detect runaway recursion
|
|
457
|
+
if (addToSchemaCallCount > 500000) {
|
|
458
|
+
console.error('INFINITE LOOP DETECTED in addToSchema', {
|
|
459
|
+
callCount: addToSchemaCallCount,
|
|
460
|
+
path,
|
|
461
|
+
value,
|
|
462
|
+
scopeNodeName: scopeNode?.name,
|
|
463
|
+
});
|
|
464
|
+
throw new Error(`Infinite loop detected: addToSchema called ${addToSchemaCallCount} times`);
|
|
465
|
+
}
|
|
182
466
|
// Track max chain depth
|
|
183
467
|
if (equivalencyValueChain.length > maxEquivalencyChainDepth) {
|
|
184
468
|
maxEquivalencyChainDepth = equivalencyValueChain.length;
|
|
185
469
|
}
|
|
186
|
-
if (!scopeNode)
|
|
470
|
+
if (!scopeNode) {
|
|
187
471
|
return;
|
|
472
|
+
}
|
|
188
473
|
if (!this.isValidPath(path)) {
|
|
189
474
|
if (traceId) {
|
|
190
475
|
console.info('Debug propagation: not a valid path', { path, traceId });
|
|
191
476
|
}
|
|
192
477
|
return;
|
|
193
478
|
}
|
|
479
|
+
// PERF: Early exit for paths with repeated function-call signature patterns
|
|
480
|
+
if (this.hasExcessivePatternRepetition(path)) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
// Update chain metadata for database tracking
|
|
194
484
|
if (equivalencyValueChain.length > 0) {
|
|
195
485
|
equivalencyValueChain[equivalencyValueChain.length - 1].addToSchemaId =
|
|
196
486
|
++this.lastAddToSchemaId;
|
|
@@ -200,87 +490,35 @@ export class ScopeDataStructure {
|
|
|
200
490
|
value,
|
|
201
491
|
};
|
|
202
492
|
}
|
|
203
|
-
//
|
|
204
|
-
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
// }
|
|
209
|
-
// if (traceId > 30) {
|
|
210
|
-
// console.warn(
|
|
211
|
-
// 'HIGH TRACEID',
|
|
212
|
-
// JSON.stringify(
|
|
213
|
-
// {
|
|
214
|
-
// path,
|
|
215
|
-
// value,
|
|
216
|
-
// scopeNodeName: scopeNode.name,
|
|
217
|
-
// equivalencyValueChain,
|
|
218
|
-
// },
|
|
219
|
-
// null,
|
|
220
|
-
// 2,
|
|
221
|
-
// ),
|
|
222
|
-
// );
|
|
223
|
-
// throw new Error('STOP - HIGH TRACEID');
|
|
224
|
-
// }
|
|
225
|
-
// Use this debugging to trace a specific path through the propagation
|
|
226
|
-
const debugLevel = 0; // 0 for minimal, 1 for executed paths, 2 for all paths info
|
|
227
|
-
// if ((!this.onlyEquivalencies && path === 'entity.sha') || traceId) {
|
|
228
|
-
// traceId ||= 0;
|
|
229
|
-
// traceId += 1;
|
|
230
|
-
// if (traceId === 1) {
|
|
231
|
-
// this.debugCount += 1;
|
|
232
|
-
// if (this.debugCount > 5) throw new Error('STOP - HIGH DEBUG COUNT');
|
|
233
|
-
// console.warn('START');
|
|
234
|
-
// }
|
|
235
|
-
// console.info(
|
|
236
|
-
// 'Debug Propagation: Adding to schema',
|
|
237
|
-
// JSON.stringify(
|
|
238
|
-
// {
|
|
239
|
-
// // traceId,
|
|
240
|
-
// path,
|
|
241
|
-
// value,
|
|
242
|
-
// scopeNodeName: scopeNode.name,
|
|
243
|
-
// reason:
|
|
244
|
-
// equivalencyValueChain[equivalencyValueChain.length - 1]?.reason,
|
|
245
|
-
// // previous:
|
|
246
|
-
// // equivalencyValueChain[equivalencyValueChain.length - 1],
|
|
247
|
-
// text: scopeNode.text,
|
|
248
|
-
// // tree: scopeNode.tree,
|
|
249
|
-
// // onlyEquivalencies: this.onlyEquivalencies,
|
|
250
|
-
// // equivalencyValueChain,
|
|
251
|
-
// // scopeNode
|
|
252
|
-
// // instatiatedVeriables: scopeNode.instantiatedVariables,
|
|
253
|
-
// // parentInstantiatedVariables: scopeNode.parentInstantiatedVariables,
|
|
254
|
-
// // isolatedStructure: scopeNode.analysis.isolatedStructure,
|
|
255
|
-
// // isolatedEquivalencies: scopeNode.analysis.isolatedEquivalentVariables,
|
|
256
|
-
// // equivalencies: traceId === 1 ? scopeNode.equivalencies : 'skipped',
|
|
257
|
-
// // functionCalls: scopeNode.functionCalls,
|
|
258
|
-
// // externalFunctionCalls: this.externalFunctionCalls.filter(fc => fc.callScope.includes(scopeNode.name))
|
|
259
|
-
// },
|
|
260
|
-
// null,
|
|
261
|
-
// 2,
|
|
262
|
-
// ),
|
|
263
|
-
// );
|
|
264
|
-
// // if (traceId > 1) traceId = undefined;
|
|
265
|
-
// throw new Error('STOP ON ADD');
|
|
266
|
-
// }
|
|
493
|
+
// Debug level: 0=minimal, 1=executed paths, 2=all paths (set via traceId)
|
|
494
|
+
const debugLevel = 0;
|
|
495
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
496
|
+
// SECTION 1: Handle complex source paths (paths with multiple data origins)
|
|
497
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
267
498
|
const equivalenciesDatabaseEntry = this.getEquivalenciesDatabaseEntry(scopeNode.name, path);
|
|
499
|
+
// Process complex source paths (before visited check, per original design)
|
|
268
500
|
this.addComplexSourcePathVariables(equivalenciesDatabaseEntry, scopeNode, path, equivalencyValueChain, traceId);
|
|
269
|
-
|
|
270
|
-
if
|
|
501
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
502
|
+
// SECTION 2: Cycle detection - skip if already visited with this value
|
|
503
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
504
|
+
if (this.visitedTracker.checkAndMarkGlobalVisited(scopeNode.name, path, value)) {
|
|
271
505
|
if (traceId) {
|
|
272
|
-
console.info('Debug
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}, null, 2));
|
|
506
|
+
console.info('Debug: already visited', {
|
|
507
|
+
key: `${scopeNode.name}::${path}::${value}`,
|
|
508
|
+
});
|
|
276
509
|
}
|
|
510
|
+
// Still record in database even if visited (captures full chain)
|
|
277
511
|
if (!this.onlyEquivalencies) {
|
|
278
512
|
this.addToEquivalencyDatabase(equivalencyValueChain, traceId);
|
|
279
513
|
}
|
|
280
514
|
return;
|
|
281
515
|
}
|
|
282
|
-
|
|
516
|
+
// Continue complex source processing after visited check
|
|
283
517
|
this.captureComplexSourcePaths(equivalenciesDatabaseEntry, scopeNode, path, equivalencyValueChain, traceId);
|
|
518
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
519
|
+
// SECTION 3: Process each subpath to follow equivalencies
|
|
520
|
+
// For path "user.profile.name", processes: "user", "user.profile", "user.profile.name"
|
|
521
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
284
522
|
const pathParts = this.splitPath(path);
|
|
285
523
|
this.checkForArrayItemPath(pathParts, scopeNode, equivalencyValueChain);
|
|
286
524
|
let propagated = false;
|
|
@@ -368,45 +606,42 @@ export class ScopeDataStructure {
|
|
|
368
606
|
}
|
|
369
607
|
}
|
|
370
608
|
}
|
|
609
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
610
|
+
// SECTION 4: Write to schema if appropriate
|
|
611
|
+
// Only writes if: (a) path not set or is 'unknown', AND
|
|
612
|
+
// (b) path belongs to this scope (instantiated, signature, or return)
|
|
613
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
371
614
|
const writeToCurrentScopeSchema = (!scopeNode.schema[path] || scopeNode.schema[path] === 'unknown') &&
|
|
372
615
|
(!scopeNode.instantiatedVariables ||
|
|
373
616
|
scopeNode.instantiatedVariables.includes(pathParts[0]) ||
|
|
374
617
|
pathParts[0].startsWith('signature[') ||
|
|
375
618
|
pathParts[0].startsWith('returnValue'));
|
|
376
|
-
//
|
|
619
|
+
// Early exit if schema already has this exact value
|
|
377
620
|
if (scopeNode.schema[path] === value && value !== 'unknown') {
|
|
378
621
|
return;
|
|
379
622
|
}
|
|
380
623
|
if (writeToCurrentScopeSchema) {
|
|
381
624
|
if (traceId && debugLevel > 0) {
|
|
382
|
-
console.info('Debug
|
|
383
|
-
traceId,
|
|
625
|
+
console.info('Debug: writing schema', {
|
|
384
626
|
path,
|
|
385
|
-
|
|
386
|
-
|
|
627
|
+
value,
|
|
628
|
+
scope: scopeNode.name,
|
|
387
629
|
});
|
|
388
630
|
}
|
|
389
631
|
scopeNode.schema[path] = value;
|
|
390
632
|
}
|
|
633
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
634
|
+
// SECTION 5: Record in equivalency database (Phase 2 only)
|
|
635
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
391
636
|
if (!this.onlyEquivalencies) {
|
|
392
637
|
this.addToEquivalencyDatabase(equivalencyValueChain, traceId);
|
|
393
638
|
}
|
|
394
639
|
if (traceId) {
|
|
395
|
-
console.info('Debug
|
|
396
|
-
|
|
397
|
-
scopeNodeName: scopeNode.name,
|
|
640
|
+
console.info('Debug: addToSchema complete', {
|
|
641
|
+
scope: scopeNode.name,
|
|
398
642
|
path,
|
|
399
643
|
value,
|
|
400
|
-
|
|
401
|
-
// propagated,
|
|
402
|
-
// scopeInfoText: scopeNode.text,
|
|
403
|
-
// equivalencyValueChain//: equivalencyValueChain.map(
|
|
404
|
-
// (ev) => ev.currentPath.schemaPath,
|
|
405
|
-
// ),
|
|
406
|
-
// sourceEquivalencies: scopeNode.sourceEquivalencies[path] ?? [],
|
|
407
|
-
// usageEquivalencies: scopeNode.usageEquivalencies[path] ?? [],
|
|
408
|
-
// checkpoints,
|
|
409
|
-
}, null, 2));
|
|
644
|
+
});
|
|
410
645
|
}
|
|
411
646
|
}
|
|
412
647
|
removeFromSchema(path, schema = {}, scopeName) {
|
|
@@ -414,65 +649,117 @@ export class ScopeDataStructure {
|
|
|
414
649
|
}
|
|
415
650
|
addEquivalency(path, equivalentPath, equivalentScopeName, scopeNode, equivalencyReason, equivalencyValueChain, traceId) {
|
|
416
651
|
var _a;
|
|
417
|
-
|
|
418
|
-
if (
|
|
419
|
-
'
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
'useState value equivalency', // 1 failure
|
|
433
|
-
'Node .then() equivalency', // 1 failure
|
|
434
|
-
'Explicit array deconstruction equivalency value', // 1 failure
|
|
435
|
-
'forwardRef equivalency',
|
|
436
|
-
'forwardRef signature to child signature equivalency', // 1 failure
|
|
437
|
-
'captured function call return value equivalency', // 1 failure (in ScopeDataStructure.test.ts)
|
|
438
|
-
'original equivalency - rerouted via useCallback', // 1 failure
|
|
439
|
-
'non-object function argument function signature equivalency1 - rerouted via useCallback', // 1 failure
|
|
440
|
-
'non-object function argument function signature equivalency2 - rerouted via useCallback', // 1 failure
|
|
441
|
-
'implicit parent equivalency - rerouted via useCallback', // 1 failure
|
|
442
|
-
'Spread operator equivalency key update: implicit parent equivalency', // 1 failure
|
|
443
|
-
'Array.from() equivalency',
|
|
444
|
-
].includes(equivalencyReason)) {
|
|
445
|
-
if ([
|
|
446
|
-
'signature of functionCall',
|
|
447
|
-
'transformed non-object function equivalency - implicit parent equivalency',
|
|
448
|
-
'transformed non-object function equivalency - non-object function argument function signature equivalency1',
|
|
449
|
-
'transformed non-object function equivalency - non-object function argument function signature equivalency2',
|
|
450
|
-
'transformed non-object function equivalency - equivalency to external function call',
|
|
451
|
-
'Explicit array deconstruction equivalency key',
|
|
452
|
-
'transformed non-object function equivalency - useState setter call equivalency',
|
|
453
|
-
'transformed non-object function equivalency - implicit parent equivalency - rerouted via useCallback',
|
|
454
|
-
'transformed non-object function equivalency - Array.from() equivalency',
|
|
455
|
-
'Spread operator equivalency key update: Explicit array deconstruction equivalency value',
|
|
456
|
-
].includes(equivalencyReason)) {
|
|
652
|
+
addEquivalencyCallCount++;
|
|
653
|
+
if (addEquivalencyCallCount > 50000) {
|
|
654
|
+
console.error('INFINITE LOOP DETECTED in addEquivalency', {
|
|
655
|
+
callCount: addEquivalencyCallCount,
|
|
656
|
+
path,
|
|
657
|
+
equivalentPath,
|
|
658
|
+
equivalentScopeName,
|
|
659
|
+
scopeNodeName: scopeNode.name,
|
|
660
|
+
equivalencyReason,
|
|
661
|
+
});
|
|
662
|
+
throw new Error(`Infinite loop detected: addEquivalency called ${addEquivalencyCallCount} times`);
|
|
663
|
+
}
|
|
664
|
+
// Filter equivalency reasons - use pre-computed Sets for O(1) lookup
|
|
665
|
+
if (!ALLOWED_EQUIVALENCY_REASONS.has(equivalencyReason)) {
|
|
666
|
+
if (SILENTLY_IGNORED_EQUIVALENCY_REASONS.has(equivalencyReason)) {
|
|
457
667
|
return;
|
|
458
668
|
}
|
|
459
669
|
else {
|
|
670
|
+
// Log and skip - if an equivalency reason isn't in ALLOWED or SILENTLY_IGNORED,
|
|
671
|
+
// it shouldn't be stored (was previously missing the return)
|
|
460
672
|
console.info('Not tracked equivalency reason', { equivalencyReason });
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
// Skip self-referential equivalencies that would create infinite loops.
|
|
677
|
+
// Case 1: Direct self-reference (path === equivalentPath)
|
|
678
|
+
// FunctionCallManager adds equivalency(subPath, subPath, externalFunctionName, ...)
|
|
679
|
+
// For simple calls like buildBranchFileMap(), this is fine.
|
|
680
|
+
// But for chained calls like query.where().where().where(), each method call adds
|
|
681
|
+
// a .functionCallReturnValue segment, and the equivalency processing creates an infinite loop.
|
|
682
|
+
// We detect chained calls by counting .functionCallReturnValue occurrences in the path.
|
|
683
|
+
if (path === equivalentPath &&
|
|
684
|
+
equivalencyReason === 'equivalency to external function call') {
|
|
685
|
+
// Count how many .functionCallReturnValue segments are in the path
|
|
686
|
+
const functionCallReturnValueCount = (path.match(/\.functionCallReturnValue/g) || []).length;
|
|
687
|
+
// Skip if there are multiple chained calls (2+ .functionCallReturnValue segments)
|
|
688
|
+
if (functionCallReturnValueCount >= 2) {
|
|
689
|
+
return;
|
|
461
690
|
}
|
|
462
691
|
}
|
|
692
|
+
// Case 2: Circular reference where equivalentPath contains path as a prefix
|
|
693
|
+
// e.g., path="query" and equivalentPath="query.where(...).functionCallReturnValue"
|
|
694
|
+
// This happens with method chaining patterns where a variable is reassigned to
|
|
695
|
+
// the result of a method call on itself: query = query.where(...)
|
|
696
|
+
// Resolving this equivalency would require resolving query first, creating infinite recursion.
|
|
697
|
+
if (equivalentPath.startsWith(path + '.') ||
|
|
698
|
+
equivalentPath.startsWith(path + '(')) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
463
701
|
if (!equivalentScopeName) {
|
|
464
|
-
console.
|
|
702
|
+
console.error('CodeYam Error: Missing equivalent scope name - FULL CONTEXT:', JSON.stringify({
|
|
465
703
|
path,
|
|
466
704
|
equivalentPath,
|
|
467
705
|
equivalentScopeName,
|
|
468
706
|
scopeNodeName: scopeNode.name,
|
|
469
|
-
|
|
707
|
+
equivalencyReason,
|
|
708
|
+
tree: scopeNode.tree,
|
|
709
|
+
equivalencyValueChain: equivalencyValueChain?.map((ev) => ({
|
|
710
|
+
id: ev.id,
|
|
711
|
+
source: ev.source,
|
|
712
|
+
reason: ev.reason,
|
|
713
|
+
currentPath: ev.currentPath,
|
|
714
|
+
previousPath: ev.previousPath,
|
|
715
|
+
})),
|
|
716
|
+
scopeNodeFunctionCalls: scopeNode.functionCalls?.map((fc) => ({
|
|
717
|
+
name: fc.name,
|
|
718
|
+
callSignature: fc.callSignature,
|
|
719
|
+
callScope: fc.callScope,
|
|
720
|
+
})),
|
|
721
|
+
instantiatedVariables: scopeNode.instantiatedVariables,
|
|
722
|
+
parentInstantiatedVariables: scopeNode.parentInstantiatedVariables,
|
|
723
|
+
}, null, 2));
|
|
470
724
|
throw new Error('CodeYam Error: Missing equivalent scope name');
|
|
471
725
|
}
|
|
472
726
|
(_a = scopeNode.equivalencies)[path] || (_a[path] = []);
|
|
473
727
|
const existing = scopeNode.equivalencies[path];
|
|
474
|
-
|
|
475
|
-
v.scopeNodeName === equivalentScopeName)
|
|
728
|
+
const existingEquivalency = existing.find((v) => v.schemaPath === equivalentPath &&
|
|
729
|
+
v.scopeNodeName === equivalentScopeName);
|
|
730
|
+
if (existingEquivalency) {
|
|
731
|
+
// During Phase 2 (onlyEquivalencies=false), we need to still process the equivalency
|
|
732
|
+
// to build the chain and add to the database, even if the equivalency already exists
|
|
733
|
+
if (!this.onlyEquivalencies) {
|
|
734
|
+
const equivalentScopeNode = this.getScopeOrFunctionCallInfo(equivalentScopeName);
|
|
735
|
+
if (equivalentScopeNode) {
|
|
736
|
+
// Extract function call name from path if it looks like a function call path
|
|
737
|
+
// e.g., "ChildComponent().signature[0].dataItem" -> "ChildComponent"
|
|
738
|
+
const pathMatch = path.match(/^([^().]+)\(\)/);
|
|
739
|
+
const previousPathScopeNodeName = pathMatch
|
|
740
|
+
? pathMatch[1]
|
|
741
|
+
: scopeNode.name;
|
|
742
|
+
this.addToSchema({
|
|
743
|
+
path: equivalentPath,
|
|
744
|
+
value: 'unknown',
|
|
745
|
+
scopeNode: equivalentScopeNode,
|
|
746
|
+
equivalencyValueChain: [
|
|
747
|
+
...(equivalencyValueChain ?? []),
|
|
748
|
+
{
|
|
749
|
+
id: existingEquivalency.id,
|
|
750
|
+
source: 'duplicate equivalency - Phase 2',
|
|
751
|
+
reason: equivalencyReason,
|
|
752
|
+
previousPath: {
|
|
753
|
+
scopeNodeName: previousPathScopeNodeName,
|
|
754
|
+
schemaPath: path,
|
|
755
|
+
value: scopeNode.schema[path],
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
],
|
|
759
|
+
traceId,
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
}
|
|
476
763
|
return;
|
|
477
764
|
}
|
|
478
765
|
const id = ++this.lastEquivalencyId;
|
|
@@ -553,23 +840,60 @@ export class ScopeDataStructure {
|
|
|
553
840
|
if (!functionCallInfo.equivalencies) {
|
|
554
841
|
functionCallInfo.equivalencies = {};
|
|
555
842
|
}
|
|
556
|
-
const
|
|
843
|
+
const searchKey = getFunctionCallRoot(functionCallInfo.callSignature);
|
|
844
|
+
const existingFunctionCall = this.getExternalFunctionCallsIndex().get(searchKey);
|
|
557
845
|
if (existingFunctionCall) {
|
|
558
|
-
|
|
846
|
+
// Preserve per-call schemas BEFORE merging to enable per-variable mock data.
|
|
847
|
+
// This is critical for hooks like useFetcher<UserData>() vs useFetcher<ReportData>()
|
|
848
|
+
// where each call returns different typed data.
|
|
849
|
+
if (!existingFunctionCall.perCallSignatureSchemas) {
|
|
850
|
+
// First merge - save the existing call's schema
|
|
851
|
+
existingFunctionCall.perCallSignatureSchemas = {
|
|
852
|
+
[existingFunctionCall.callSignature]: {
|
|
853
|
+
...existingFunctionCall.schema,
|
|
854
|
+
},
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
// Save the new call's schema before it gets merged
|
|
858
|
+
existingFunctionCall.perCallSignatureSchemas[functionCallInfo.callSignature] = { ...functionCallInfo.schema };
|
|
859
|
+
// Merge schemas using selectBestValue to preserve specific types like 'null'
|
|
860
|
+
// over generic types like 'unknown'. This ensures ref variables detected
|
|
861
|
+
// earlier (marked as 'null') aren't overwritten by later 'unknown' values.
|
|
862
|
+
const mergedSchema = {
|
|
559
863
|
...existingFunctionCall.schema,
|
|
560
|
-
...functionCallInfo.schema,
|
|
561
864
|
};
|
|
865
|
+
for (const key in functionCallInfo.schema) {
|
|
866
|
+
const existingValue = existingFunctionCall.schema[key];
|
|
867
|
+
const newValue = functionCallInfo.schema[key];
|
|
868
|
+
mergedSchema[key] = selectBestValue(existingValue, newValue, newValue);
|
|
869
|
+
}
|
|
870
|
+
existingFunctionCall.schema = mergedSchema;
|
|
562
871
|
existingFunctionCall.equivalencies = {
|
|
563
872
|
...existingFunctionCall.equivalencies,
|
|
564
873
|
...functionCallInfo.equivalencies,
|
|
565
874
|
};
|
|
875
|
+
// Track all call signatures that get merged (e.g., logger.info, logger.debug, etc.)
|
|
876
|
+
if (!existingFunctionCall.allCallSignatures) {
|
|
877
|
+
existingFunctionCall.allCallSignatures = [
|
|
878
|
+
existingFunctionCall.callSignature,
|
|
879
|
+
];
|
|
880
|
+
}
|
|
881
|
+
if (!existingFunctionCall.allCallSignatures.includes(functionCallInfo.callSignature)) {
|
|
882
|
+
existingFunctionCall.allCallSignatures.push(functionCallInfo.callSignature);
|
|
883
|
+
}
|
|
566
884
|
}
|
|
567
885
|
else {
|
|
568
886
|
const functionCallInfoNameParts = this.splitPath(functionCallInfo.name);
|
|
569
887
|
const isExternal = !callingScopeNode.instantiatedVariables?.includes(functionCallInfoNameParts[0]) &&
|
|
570
888
|
!callingScopeNode.parentInstantiatedVariables?.includes(functionCallInfoNameParts[0]);
|
|
571
889
|
if (isExternal) {
|
|
572
|
-
this
|
|
890
|
+
// Check if this function was already filtered out as an internal function
|
|
891
|
+
// (e.g., useState was filtered in captureCompleteSchema but finalize is trying to re-add it)
|
|
892
|
+
const strippedName = this.pathManager.stripGenerics(functionCallInfo.name);
|
|
893
|
+
if (!this.filteredInternalFunctions.has(strippedName)) {
|
|
894
|
+
this.externalFunctionCalls.push(functionCallInfo);
|
|
895
|
+
this.invalidateExternalFunctionCallsIndex();
|
|
896
|
+
}
|
|
573
897
|
}
|
|
574
898
|
}
|
|
575
899
|
}
|
|
@@ -591,7 +915,7 @@ export class ScopeDataStructure {
|
|
|
591
915
|
// );
|
|
592
916
|
// }
|
|
593
917
|
const getRootOrExternalFunctionCallInfo = (name) => {
|
|
594
|
-
return name === this.
|
|
918
|
+
return name === this.scopeTreeManager.getRootName()
|
|
595
919
|
? this.getScopeNode()
|
|
596
920
|
: this.getExternalFunctionCallInfo(name);
|
|
597
921
|
};
|
|
@@ -609,82 +933,70 @@ export class ScopeDataStructure {
|
|
|
609
933
|
schemaPath === safePath ||
|
|
610
934
|
safePath.startsWith(schemaPath));
|
|
611
935
|
});
|
|
936
|
+
// PERF: Build a Map for O(1) lookup instead of O(n) inner loop
|
|
937
|
+
// Map from "remaining parts joined" to equivalentSchemaPath
|
|
938
|
+
const equivalentSchemaPathMap = new Map();
|
|
939
|
+
for (const equivalentSchemaPath of Object.keys(equivalentScopeNode.schema)) {
|
|
940
|
+
// Quick string check before expensive path splitting
|
|
941
|
+
if (!(equivalentSchemaPath.startsWith(equivalentPath) ||
|
|
942
|
+
equivalentSchemaPath === equivalentPath ||
|
|
943
|
+
equivalentPath.startsWith(equivalentSchemaPath))) {
|
|
944
|
+
continue;
|
|
945
|
+
}
|
|
946
|
+
const equivalentSchemaPathParts = this.splitPath(equivalentSchemaPath);
|
|
947
|
+
if (!equivalentPathParts.every((p, i) => equivalentSchemaPathParts[i] === p)) {
|
|
948
|
+
continue;
|
|
949
|
+
}
|
|
950
|
+
const remainingEquivalentSchemaPathParts = equivalentSchemaPathParts.slice(equivalentPathParts.length);
|
|
951
|
+
// Use | as separator since it won't appear in path parts
|
|
952
|
+
const key = remainingEquivalentSchemaPathParts.join('|');
|
|
953
|
+
equivalentSchemaPathMap.set(key, equivalentSchemaPath);
|
|
954
|
+
}
|
|
612
955
|
for (const schemaPath of relevantSchemaPaths) {
|
|
613
956
|
const schemaPathParts = this.splitPath(schemaPath);
|
|
614
957
|
if (!pathParts.every((p, i) => schemaPathParts[i] === p)) {
|
|
615
958
|
continue;
|
|
616
959
|
}
|
|
617
960
|
const remainingSchemaPathParts = schemaPathParts.slice(pathParts.length);
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const remainingEquivalentSchemaPathParts = equivalentSchemaPathParts.slice(equivalentPathParts.length);
|
|
632
|
-
if (remainingSchemaPathParts.length !==
|
|
633
|
-
remainingEquivalentSchemaPathParts.length ||
|
|
634
|
-
!remainingEquivalentSchemaPathParts.every((p, i) => p === remainingSchemaPathParts[i])) {
|
|
635
|
-
missingEquivalentPath = true;
|
|
961
|
+
// PERF: O(1) Map lookup instead of O(n) inner loop
|
|
962
|
+
const remainingKey = remainingSchemaPathParts.join('|');
|
|
963
|
+
const equivalentSchemaPath = equivalentSchemaPathMap.get(remainingKey);
|
|
964
|
+
if (equivalentSchemaPath) {
|
|
965
|
+
// Skip propagation when there's a structural mismatch:
|
|
966
|
+
// - schemaPath ends with [] (array element, represents an object)
|
|
967
|
+
// - equivalentSchemaPath doesn't end with [] (non-array prop, usually a scalar)
|
|
968
|
+
// This prevents incorrectly typing array elements as strings when they're
|
|
969
|
+
// equivalent to scalar props like JSX keys (e.g., workouts[] ↔ Card().key)
|
|
970
|
+
const schemaPathEndsWithArray = schemaPath.endsWith('[]');
|
|
971
|
+
const equivalentEndsWithArray = equivalentSchemaPath.endsWith('[]');
|
|
972
|
+
if (schemaPathEndsWithArray !== equivalentEndsWithArray) {
|
|
973
|
+
// Don't propagate between array element paths and non-array paths
|
|
636
974
|
continue;
|
|
637
975
|
}
|
|
638
|
-
missingEquivalentPath = false;
|
|
639
976
|
const value1 = scopeNode.schema[schemaPath];
|
|
640
977
|
const value2 = equivalentScopeNode.schema[equivalentSchemaPath];
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
978
|
+
const bestValue = selectBestValue(value1, value2);
|
|
979
|
+
// PERF: Skip paths with repeated function-call signature patterns
|
|
980
|
+
// to prevent recursive type expansion (e.g., string.localeCompare returns string)
|
|
981
|
+
if (this.hasExcessivePatternRepetition(schemaPath) ||
|
|
982
|
+
this.hasExcessivePatternRepetition(equivalentSchemaPath)) {
|
|
983
|
+
continue;
|
|
646
984
|
}
|
|
647
985
|
scopeNode.schema[schemaPath] = bestValue;
|
|
648
986
|
equivalentScopeNode.schema[equivalentSchemaPath] = bestValue;
|
|
649
|
-
// if (traceId) {
|
|
650
|
-
// console.info('Debug Propagate: Assign Best Value', {
|
|
651
|
-
// traceId,
|
|
652
|
-
// sourceScopeNodeName: scopeNode.name,
|
|
653
|
-
// path,
|
|
654
|
-
// schemaPath,
|
|
655
|
-
// usageScopeNodeName: equivalentScopeNode.name,
|
|
656
|
-
// equivalentPath,
|
|
657
|
-
// equivalentSchemaPath,
|
|
658
|
-
// remainingSchemaPathParts,
|
|
659
|
-
// remainingEquivalentSchemaPathParts,
|
|
660
|
-
// value1,
|
|
661
|
-
// value2,
|
|
662
|
-
// bestValue,
|
|
663
|
-
// });
|
|
664
|
-
// }
|
|
665
|
-
break;
|
|
666
987
|
}
|
|
667
|
-
if (
|
|
668
|
-
(
|
|
669
|
-
|
|
988
|
+
else if (scopeNode.name.includes('____cyScope') ||
|
|
989
|
+
!('instantiatedVariables' in equivalentScopeNode)) {
|
|
990
|
+
// No matching equivalent path found - create one if needed
|
|
670
991
|
// Only necessary for internal function scopes or external function scopes
|
|
671
992
|
const newEquivalentPath = this.joinPathParts([
|
|
672
993
|
equivalentPath,
|
|
673
994
|
...remainingSchemaPathParts,
|
|
674
995
|
]);
|
|
675
|
-
//
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
// path,
|
|
680
|
-
// equivalentPath,
|
|
681
|
-
// schemaPath,
|
|
682
|
-
// remainingSchemaPathParts,
|
|
683
|
-
// equivalentScopeNodeName: equivalentScopeNode.name,
|
|
684
|
-
// // equivalentScopeNodeSchema: equivalentScopeNode.schema,
|
|
685
|
-
// newEquivalentPath,
|
|
686
|
-
// });
|
|
687
|
-
// }
|
|
996
|
+
// PERF: Skip paths with repeated function-call signature patterns
|
|
997
|
+
if (this.hasExcessivePatternRepetition(newEquivalentPath)) {
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
688
1000
|
equivalentScopeNode.schema[newEquivalentPath] =
|
|
689
1001
|
scopeNode.schema[schemaPath];
|
|
690
1002
|
}
|
|
@@ -707,101 +1019,137 @@ export class ScopeDataStructure {
|
|
|
707
1019
|
}
|
|
708
1020
|
}
|
|
709
1021
|
splitPath(path) {
|
|
710
|
-
|
|
711
|
-
return structuredClone(this.pathPartsCache.get(path));
|
|
712
|
-
}
|
|
713
|
-
const pathParts = splitOutsideParenthesesAndArrays(path);
|
|
714
|
-
this.pathPartsCache.set(path, structuredClone(pathParts));
|
|
715
|
-
return pathParts;
|
|
1022
|
+
return this.pathManager.splitPath(path);
|
|
716
1023
|
}
|
|
717
1024
|
joinPathParts(pathParts) {
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
1025
|
+
return this.pathManager.joinPathParts(pathParts);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Extracts the root variable name from a path.
|
|
1029
|
+
* E.g., "collected[]" -> "collected", "foo.bar" -> "foo", "collected[0]" -> "collected"
|
|
1030
|
+
*/
|
|
1031
|
+
extractRootVariable(path) {
|
|
1032
|
+
const parts = this.splitPath(path);
|
|
1033
|
+
if (parts.length === 0)
|
|
1034
|
+
return null;
|
|
1035
|
+
const firstPart = parts[0];
|
|
1036
|
+
// Strip array notation: "collected[]" -> "collected", "collected[0]" -> "collected"
|
|
1037
|
+
const bracketIndex = firstPart.indexOf('[');
|
|
1038
|
+
if (bracketIndex > 0) {
|
|
1039
|
+
return firstPart.substring(0, bracketIndex);
|
|
721
1040
|
}
|
|
722
|
-
|
|
723
|
-
this.pathJoinCache.set(cacheKey, result);
|
|
724
|
-
return result;
|
|
1041
|
+
return firstPart;
|
|
725
1042
|
}
|
|
726
1043
|
// PRIVATE METHODS //
|
|
727
|
-
uniqueId(
|
|
728
|
-
|
|
729
|
-
return parts.join('::');
|
|
1044
|
+
uniqueId(params) {
|
|
1045
|
+
return uniqueId(params);
|
|
730
1046
|
}
|
|
731
1047
|
uniqueScopeVariables(scopeVariables) {
|
|
732
|
-
return
|
|
1048
|
+
return uniqueScopeVariables(scopeVariables);
|
|
733
1049
|
}
|
|
734
1050
|
uniqueScopeAndPaths(scopeVariables) {
|
|
735
|
-
|
|
736
|
-
return [];
|
|
737
|
-
// Optimize from O(n²) to O(n) using Set for deduplication
|
|
738
|
-
const seen = new Set();
|
|
739
|
-
return scopeVariables.filter((varItem) => {
|
|
740
|
-
const key = `${varItem.scopeNodeName}::${varItem.schemaPath}`;
|
|
741
|
-
if (seen.has(key)) {
|
|
742
|
-
return false;
|
|
743
|
-
}
|
|
744
|
-
seen.add(key);
|
|
745
|
-
return true;
|
|
746
|
-
});
|
|
1051
|
+
return uniqueScopeAndPaths(scopeVariables);
|
|
747
1052
|
}
|
|
748
1053
|
isValidPath(path) {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
1054
|
+
return this.pathManager.isValidPath(path);
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Detects if a path contains excessive repetition of the same pattern.
|
|
1058
|
+
*
|
|
1059
|
+
* This prevents exponential blowup when analyzing recursive type structures.
|
|
1060
|
+
* For example, TypeScript AST nodes have `.attributes.properties[]` where each
|
|
1061
|
+
* property is also a node with `.attributes.properties[]`. Without this check,
|
|
1062
|
+
* paths like `signature[0].attributes.properties[].attributes.properties[].attributes.properties[]...`
|
|
1063
|
+
* would be generated exponentially.
|
|
1064
|
+
*
|
|
1065
|
+
* Two detection strategies:
|
|
1066
|
+
* 1. Known patterns: Check RECURSIVE_PATH_PATTERNS for common recursive structures
|
|
1067
|
+
* 2. Generic detection: For longer paths, detect any 2-3 part segment that repeats
|
|
1068
|
+
*
|
|
1069
|
+
* @param path - The schema path to check
|
|
1070
|
+
* @param maxRepetitions - Maximum allowed repetitions of any pattern (default: 2)
|
|
1071
|
+
* @returns true if the path has excessive repetition
|
|
1072
|
+
*/
|
|
1073
|
+
hasExcessivePatternRepetition(path, maxRepetitions = 2) {
|
|
1074
|
+
// Check known recursive patterns
|
|
1075
|
+
for (const pattern of RECURSIVE_PATH_PATTERNS) {
|
|
1076
|
+
const matches = path.match(pattern);
|
|
1077
|
+
if (matches && matches.length > maxRepetitions) {
|
|
1078
|
+
return true;
|
|
1079
|
+
}
|
|
757
1080
|
}
|
|
758
|
-
|
|
759
|
-
|
|
1081
|
+
// Check for repeated function calls that indicate recursive type expansion.
|
|
1082
|
+
// E.g., localeCompare(b[])...localeCompare(b[]) means string.localeCompare
|
|
1083
|
+
// returns a type that again has localeCompare, causing infinite expansion.
|
|
1084
|
+
// We extract all function call patterns like "funcName(args)" and check if
|
|
1085
|
+
// the same normalized call appears more than once.
|
|
1086
|
+
const funcCallPattern = /(?:^|\.)[^.([]+\([^)]*\)/g;
|
|
1087
|
+
const funcCallMatches = path.match(funcCallPattern);
|
|
1088
|
+
if (funcCallMatches && funcCallMatches.length > 1) {
|
|
1089
|
+
const seen = new Set();
|
|
1090
|
+
for (const match of funcCallMatches) {
|
|
1091
|
+
// Strip leading dot and normalize array indices
|
|
1092
|
+
const normalized = match.replace(/^\./, '').replace(/\[\d+\]/g, '[]');
|
|
1093
|
+
if (seen.has(normalized))
|
|
1094
|
+
return true;
|
|
1095
|
+
seen.add(normalized);
|
|
1096
|
+
}
|
|
760
1097
|
}
|
|
761
|
-
|
|
1098
|
+
// For longer paths, detect any repeated multi-part segments we haven't explicitly listed
|
|
1099
|
+
const pathParts = this.splitPath(path);
|
|
1100
|
+
if (pathParts.length <= 6) {
|
|
762
1101
|
return false;
|
|
763
1102
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
1103
|
+
// Check for repeated sequences of 2-3 consecutive parts
|
|
1104
|
+
for (let segmentLength = 2; segmentLength <= 3; segmentLength++) {
|
|
1105
|
+
const seen = new Map();
|
|
1106
|
+
for (let i = 0; i <= pathParts.length - segmentLength; i++) {
|
|
1107
|
+
const segment = pathParts.slice(i, i + segmentLength).join('.');
|
|
1108
|
+
const normalizedSegment = segment.replace(/\[\d+\]/g, '[]');
|
|
1109
|
+
const count = (seen.get(normalizedSegment) || 0) + 1;
|
|
1110
|
+
seen.set(normalizedSegment, count);
|
|
1111
|
+
if (count > maxRepetitions) {
|
|
1112
|
+
return true;
|
|
1113
|
+
}
|
|
767
1114
|
}
|
|
768
|
-
|
|
769
|
-
|
|
1115
|
+
}
|
|
1116
|
+
return false;
|
|
770
1117
|
}
|
|
771
1118
|
addToTree(pathParts) {
|
|
772
|
-
|
|
773
|
-
for (const pathPart of pathParts) {
|
|
774
|
-
const existingChild = scopeTreeNode.children.find((child) => child.name === pathPart);
|
|
775
|
-
if (existingChild) {
|
|
776
|
-
scopeTreeNode = existingChild;
|
|
777
|
-
}
|
|
778
|
-
else {
|
|
779
|
-
const childScopeTreeNode = {
|
|
780
|
-
name: pathPart,
|
|
781
|
-
children: [],
|
|
782
|
-
};
|
|
783
|
-
scopeTreeNode.children.push(childScopeTreeNode);
|
|
784
|
-
scopeTreeNode = childScopeTreeNode;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
1119
|
+
this.scopeTreeManager.addPath(pathParts);
|
|
787
1120
|
}
|
|
788
1121
|
setInstantiatedVariables(scopeNode) {
|
|
789
1122
|
let instantiatedVariables = scopeNode.analysis?.instantiatedVariables ?? [];
|
|
790
|
-
for (const [path,
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1123
|
+
for (const [path, rawEquivalentPath] of Object.entries(scopeNode.analysis.isolatedEquivalentVariables ?? {})) {
|
|
1124
|
+
// Normalize to array for consistent handling (supports both string and string[])
|
|
1125
|
+
const equivalentPaths = Array.isArray(rawEquivalentPath)
|
|
1126
|
+
? rawEquivalentPath
|
|
1127
|
+
: rawEquivalentPath
|
|
1128
|
+
? [rawEquivalentPath]
|
|
1129
|
+
: [];
|
|
1130
|
+
for (const equivalentPath of equivalentPaths) {
|
|
1131
|
+
if (typeof equivalentPath !== 'string') {
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
if (equivalentPath.startsWith('signature[')) {
|
|
1135
|
+
const equivalentPathParts = this.splitPath(equivalentPath);
|
|
1136
|
+
instantiatedVariables.push(equivalentPathParts[0]);
|
|
1137
|
+
instantiatedVariables.push(path);
|
|
1138
|
+
}
|
|
798
1139
|
}
|
|
799
1140
|
const duplicateInstantiated = instantiatedVariables.find((v) => path.split('::cyDuplicateKey')[0] === v.split('::cyDuplicateKey')[0]);
|
|
800
1141
|
if (duplicateInstantiated) {
|
|
801
1142
|
instantiatedVariables.push(path);
|
|
802
1143
|
}
|
|
803
1144
|
}
|
|
804
|
-
|
|
1145
|
+
const instantiatedSeen = new Set();
|
|
1146
|
+
instantiatedVariables = instantiatedVariables.filter((varName) => {
|
|
1147
|
+
if (instantiatedSeen.has(varName)) {
|
|
1148
|
+
return false;
|
|
1149
|
+
}
|
|
1150
|
+
instantiatedSeen.add(varName);
|
|
1151
|
+
return true;
|
|
1152
|
+
});
|
|
805
1153
|
scopeNode.instantiatedVariables = instantiatedVariables;
|
|
806
1154
|
if (!scopeNode.tree || scopeNode.tree.length === 0) {
|
|
807
1155
|
return;
|
|
@@ -813,35 +1161,168 @@ export class ScopeDataStructure {
|
|
|
813
1161
|
const parentInstantiatedVariables = [
|
|
814
1162
|
...(parentScopeNode.parentInstantiatedVariables ?? []),
|
|
815
1163
|
...parentScopeNode.instantiatedVariables.filter((v) => !v.startsWith('signature[') && !v.startsWith('returnValue')),
|
|
816
|
-
].filter((varName
|
|
817
|
-
|
|
818
|
-
|
|
1164
|
+
].filter((varName) => !instantiatedSeen.has(varName));
|
|
1165
|
+
const parentInstantiatedSeen = new Set();
|
|
1166
|
+
const dedupedParentInstantiatedVariables = parentInstantiatedVariables.filter((varName) => {
|
|
1167
|
+
if (parentInstantiatedSeen.has(varName)) {
|
|
1168
|
+
return false;
|
|
1169
|
+
}
|
|
1170
|
+
parentInstantiatedSeen.add(varName);
|
|
1171
|
+
return true;
|
|
1172
|
+
});
|
|
1173
|
+
scopeNode.parentInstantiatedVariables = dedupedParentInstantiatedVariables;
|
|
819
1174
|
}
|
|
820
1175
|
trackFunctionCalls(scopeNode) {
|
|
821
1176
|
this.captureFunctionCalls(scopeNode);
|
|
822
1177
|
this.checkExternalFunctionCalls();
|
|
823
1178
|
}
|
|
824
1179
|
determineEquivalenciesAndBuildSchema(scopeNode) {
|
|
1180
|
+
if (!scopeNode.analysis) {
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
825
1183
|
const { isolatedStructure, isolatedEquivalentVariables } = scopeNode.analysis;
|
|
1184
|
+
// Flatten isolatedEquivalentVariables values for allPaths (handles both string and string[])
|
|
1185
|
+
const flattenedEquivValues = Object.values(isolatedEquivalentVariables || {}).flatMap((v) => (Array.isArray(v) ? v : [v]));
|
|
826
1186
|
const allPaths = Array.from(new Set([
|
|
827
1187
|
...Object.keys(isolatedStructure || {}),
|
|
828
1188
|
...Object.keys(isolatedEquivalentVariables || {}),
|
|
829
|
-
...
|
|
1189
|
+
...flattenedEquivValues,
|
|
830
1190
|
]));
|
|
831
1191
|
for (let path in isolatedEquivalentVariables) {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1192
|
+
const rawEquivalentValue = isolatedEquivalentVariables?.[path];
|
|
1193
|
+
// Normalize to array for consistent handling
|
|
1194
|
+
const equivalentValues = Array.isArray(rawEquivalentValue)
|
|
1195
|
+
? rawEquivalentValue
|
|
1196
|
+
: [rawEquivalentValue];
|
|
1197
|
+
for (let equivalentValue of equivalentValues) {
|
|
1198
|
+
if (equivalentValue && this.isValidPath(equivalentValue)) {
|
|
1199
|
+
// IMPORTANT: DO NOT strip ::cyDuplicateKey:: markers from equivalencies.
|
|
1200
|
+
// These markers are critical for distinguishing variable reassignments.
|
|
1201
|
+
// For example, with:
|
|
1202
|
+
// let fetcher = useFetcher<ConfigData>();
|
|
1203
|
+
// const configData = fetcher.data?.data;
|
|
1204
|
+
// fetcher = useFetcher<SettingsData>();
|
|
1205
|
+
// const settingsData = fetcher.data?.data;
|
|
1206
|
+
//
|
|
1207
|
+
// mergeStatements creates:
|
|
1208
|
+
// fetcher → useFetcher<ConfigData>()...
|
|
1209
|
+
// fetcher::cyDuplicateKey1:: → useFetcher<SettingsData>()...
|
|
1210
|
+
// configData → fetcher.data.data
|
|
1211
|
+
// settingsData → fetcher::cyDuplicateKey1::.data.data
|
|
1212
|
+
//
|
|
1213
|
+
// If we strip ::cyDuplicateKey::, settingsData would incorrectly trace
|
|
1214
|
+
// to useFetcher<ConfigData>() instead of useFetcher<SettingsData>().
|
|
1215
|
+
path = cleanPath(path, allPaths);
|
|
1216
|
+
equivalentValue = cleanPath(equivalentValue, allPaths);
|
|
1217
|
+
this.addEquivalency(path, equivalentValue, scopeNode.name, scopeNode, 'original equivalency');
|
|
1218
|
+
// Propagate equivalencies involving parent-scope variables to those parent scopes.
|
|
1219
|
+
// This handles patterns like: collected.push({...entity}) where 'collected' is defined
|
|
1220
|
+
// in a parent scope. The equivalency collected[] -> push().signature[0] needs to be
|
|
1221
|
+
// visible when tracing from the parent scope.
|
|
1222
|
+
const rootVariable = this.extractRootVariable(path);
|
|
1223
|
+
const equivalentRootVariable = this.extractRootVariable(equivalentValue);
|
|
1224
|
+
// Skip propagation for self-referential reassignment patterns like:
|
|
1225
|
+
// x = x.method().functionCallReturnValue
|
|
1226
|
+
// where the path IS the variable itself (not a sub-path like x[] or x.prop).
|
|
1227
|
+
// These create circular references since both sides reference the same variable.
|
|
1228
|
+
//
|
|
1229
|
+
// But DO propagate for patterns like collected[] -> collected.push(...).signature[0]
|
|
1230
|
+
// where the path has additional segments beyond the root variable.
|
|
1231
|
+
const pathIsJustRootVariable = path === rootVariable;
|
|
1232
|
+
const isSelfReferentialReassignment = pathIsJustRootVariable && rootVariable === equivalentRootVariable;
|
|
1233
|
+
if (rootVariable &&
|
|
1234
|
+
!isSelfReferentialReassignment &&
|
|
1235
|
+
scopeNode.parentInstantiatedVariables?.includes(rootVariable)) {
|
|
1236
|
+
// Find the parent scope where this variable is defined
|
|
1237
|
+
for (const parentScopeName of scopeNode.tree || []) {
|
|
1238
|
+
const parentScope = this.scopeNodes[parentScopeName];
|
|
1239
|
+
if (parentScope?.instantiatedVariables?.includes(rootVariable)) {
|
|
1240
|
+
// Add the equivalency to the parent scope as well
|
|
1241
|
+
this.addEquivalency(path, equivalentValue, scopeNode.name, // The equivalent path's scope remains the child scope
|
|
1242
|
+
parentScope, // But store it in the parent scope's equivalencies
|
|
1243
|
+
'propagated parent-variable equivalency');
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
// Propagate sub-property equivalencies when the equivalentValue is a simple variable
|
|
1249
|
+
// that has sub-properties defined in the isolatedEquivalentVariables.
|
|
1250
|
+
// This handles cases like: dataItem={{ structure: completeDataStructure }}
|
|
1251
|
+
// where completeDataStructure has sub-properties like completeDataStructure['Function Arguments']
|
|
1252
|
+
// We need to propagate these to create: dataItem.structure['Function Arguments'] equivalencies
|
|
1253
|
+
const isSimpleVariable = !equivalentValue.startsWith('signature[') &&
|
|
1254
|
+
!equivalentValue.includes('functionCallReturnValue') &&
|
|
1255
|
+
!equivalentValue.includes('.') &&
|
|
1256
|
+
!equivalentValue.includes('[');
|
|
1257
|
+
if (isSimpleVariable) {
|
|
1258
|
+
// Look in current scope and all parent scopes for sub-properties
|
|
1259
|
+
const scopesToCheck = [scopeNode.name, ...scopeNode.tree];
|
|
1260
|
+
for (const scopeName of scopesToCheck) {
|
|
1261
|
+
const checkScope = this.scopeNodes[scopeName];
|
|
1262
|
+
if (!checkScope?.analysis?.isolatedEquivalentVariables)
|
|
1263
|
+
continue;
|
|
1264
|
+
for (const [subPath, rawSubValue] of Object.entries(checkScope.analysis.isolatedEquivalentVariables)) {
|
|
1265
|
+
// Normalize to array for consistent handling
|
|
1266
|
+
const subValues = Array.isArray(rawSubValue)
|
|
1267
|
+
? rawSubValue
|
|
1268
|
+
: rawSubValue
|
|
1269
|
+
? [rawSubValue]
|
|
1270
|
+
: [];
|
|
1271
|
+
// Check if this is a sub-property of the equivalentValue variable
|
|
1272
|
+
// e.g., completeDataStructure['Function Arguments'] or completeDataStructure.foo
|
|
1273
|
+
const matchesDot = subPath.startsWith(equivalentValue + '.');
|
|
1274
|
+
const matchesBracket = subPath.startsWith(equivalentValue + '[');
|
|
1275
|
+
if (matchesDot || matchesBracket) {
|
|
1276
|
+
const subPropertyPath = subPath.substring(equivalentValue.length);
|
|
1277
|
+
const newPath = cleanPath(path + subPropertyPath, allPaths);
|
|
1278
|
+
for (const subValue of subValues) {
|
|
1279
|
+
if (typeof subValue !== 'string')
|
|
1280
|
+
continue;
|
|
1281
|
+
const newEquivalentValue = cleanPath(subValue.replace(/::cyDuplicateKey\d+::/g, ''), allPaths);
|
|
1282
|
+
if (newEquivalentValue &&
|
|
1283
|
+
this.isValidPath(newEquivalentValue)) {
|
|
1284
|
+
this.addEquivalency(newPath, newEquivalentValue, checkScope.name, // Use the scope where the sub-property was found
|
|
1285
|
+
scopeNode, 'propagated sub-property equivalency');
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
// Also check if equivalentValue itself maps to a functionCallReturnValue
|
|
1290
|
+
// e.g., result = useMemo(...).functionCallReturnValue
|
|
1291
|
+
for (const subValue of subValues) {
|
|
1292
|
+
if (subPath === equivalentValue &&
|
|
1293
|
+
typeof subValue === 'string' &&
|
|
1294
|
+
subValue.endsWith('.functionCallReturnValue')) {
|
|
1295
|
+
this.propagateFunctionCallReturnSubProperties(path, subValue, scopeNode, allPaths);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
// Handle function call return values by propagating returnValue.* sub-properties
|
|
1302
|
+
// from the callback scope to the usage path
|
|
1303
|
+
if (equivalentValue.endsWith('.functionCallReturnValue')) {
|
|
1304
|
+
this.propagateFunctionCallReturnSubProperties(path, equivalentValue, scopeNode, allPaths);
|
|
1305
|
+
// Track which variable receives the return value of each function call
|
|
1306
|
+
// This enables generating separate mock data for each call site
|
|
1307
|
+
this.trackReceivingVariable(path, equivalentValue);
|
|
1308
|
+
}
|
|
1309
|
+
// Also track variables that receive destructured properties from function call return values
|
|
1310
|
+
// e.g., "userData" -> "db.query('users').functionCallReturnValue.data"
|
|
1311
|
+
if (equivalentValue.includes('.functionCallReturnValue.')) {
|
|
1312
|
+
this.trackReceivingVariable(path, equivalentValue);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
837
1315
|
}
|
|
838
1316
|
}
|
|
839
|
-
|
|
1317
|
+
// PERF: Enable batch processing to convert recursive addToSchema calls to iterative
|
|
1318
|
+
// This eliminates deep call stacks and improves deduplication
|
|
1319
|
+
this.batchProcessor = new BatchSchemaProcessor();
|
|
1320
|
+
this.batchQueuedSet = new Set();
|
|
1321
|
+
for (const key of allPaths) {
|
|
840
1322
|
let value = isolatedStructure[key] ?? 'unknown';
|
|
841
1323
|
if (['null', 'undefined'].includes(value)) {
|
|
842
1324
|
value = 'unknown';
|
|
843
1325
|
}
|
|
844
|
-
const startTime = new Date().getTime();
|
|
845
1326
|
this.addToSchema({
|
|
846
1327
|
path: cleanPath(key, allPaths),
|
|
847
1328
|
value,
|
|
@@ -854,90 +1335,426 @@ export class ScopeDataStructure {
|
|
|
854
1335
|
},
|
|
855
1336
|
],
|
|
856
1337
|
});
|
|
857
|
-
//
|
|
858
|
-
|
|
859
|
-
// console.info('SLOW', {
|
|
860
|
-
// timeDiff,
|
|
861
|
-
// root: this.scopeTree.name,
|
|
862
|
-
// scopeNodeName: scopeNode.name,
|
|
863
|
-
// schemaPath: key,
|
|
864
|
-
// onlyEquivalencies: this.onlyEquivalencies,
|
|
865
|
-
// });
|
|
866
|
-
// }
|
|
1338
|
+
// Process any work queued by followEquivalencies
|
|
1339
|
+
this.processBatchQueue();
|
|
867
1340
|
}
|
|
1341
|
+
// Final pass to ensure all queued work is processed
|
|
1342
|
+
this.processBatchQueue();
|
|
1343
|
+
// Clean up batch processor
|
|
1344
|
+
this.batchProcessor = null;
|
|
1345
|
+
this.batchQueuedSet = null;
|
|
868
1346
|
this.validateSchema(scopeNode, false, false);
|
|
869
1347
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1348
|
+
/**
|
|
1349
|
+
* Process all items in the batch queue.
|
|
1350
|
+
* Each item may queue more work via followEquivalencies.
|
|
1351
|
+
*/
|
|
1352
|
+
processBatchQueue() {
|
|
1353
|
+
if (!this.batchProcessor)
|
|
1354
|
+
return;
|
|
1355
|
+
let iterations = 0;
|
|
1356
|
+
while (this.batchProcessor.hasWork()) {
|
|
1357
|
+
iterations++;
|
|
1358
|
+
// Safety: detect potential infinite loops
|
|
1359
|
+
if (iterations > 100000) {
|
|
1360
|
+
console.error(`[ScopeDataStructure] processBatchQueue exceeded 100k iterations, possible infinite loop!`);
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
const item = this.batchProcessor.getNextWork();
|
|
1364
|
+
if (!item)
|
|
1365
|
+
break;
|
|
1366
|
+
const scopeNode = this.getScopeOrFunctionCallInfo(item.scopeNodeName);
|
|
1367
|
+
if (!scopeNode)
|
|
1368
|
+
continue;
|
|
878
1369
|
this.addToSchema({
|
|
879
|
-
path:
|
|
880
|
-
value:
|
|
881
|
-
scopeNode
|
|
882
|
-
equivalencyValueChain:
|
|
883
|
-
|
|
884
|
-
id: -1,
|
|
885
|
-
source: 'Start: explicit array item',
|
|
886
|
-
reason: 'Adding explicit array item to schema',
|
|
887
|
-
},
|
|
888
|
-
],
|
|
1370
|
+
path: item.path,
|
|
1371
|
+
value: item.value,
|
|
1372
|
+
scopeNode,
|
|
1373
|
+
equivalencyValueChain: item.equivalencyValueChain,
|
|
1374
|
+
traceId: item.traceId,
|
|
889
1375
|
});
|
|
890
1376
|
}
|
|
891
1377
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1378
|
+
/**
|
|
1379
|
+
* Tracks which variable receives the return value of a function call.
|
|
1380
|
+
*
|
|
1381
|
+
* When we encounter an equivalency like:
|
|
1382
|
+
* result1 -> db.select(query1).functionCallReturnValue
|
|
1383
|
+
*
|
|
1384
|
+
* This method extracts the call signature (db.select(query1)) and maps it
|
|
1385
|
+
* to the receiving variable (result1) on the corresponding FunctionCallInfo.
|
|
1386
|
+
*
|
|
1387
|
+
* This enables generating separate mock data for each call site when the same
|
|
1388
|
+
* function is called multiple times with different arguments.
|
|
1389
|
+
*/
|
|
1390
|
+
trackReceivingVariable(receivingVariable, equivalentValue) {
|
|
1391
|
+
// Extract the call signature by finding the .functionCallReturnValue part
|
|
1392
|
+
// and taking everything before it
|
|
1393
|
+
// Handles both:
|
|
1394
|
+
// "db.select(query1).functionCallReturnValue" -> "db.select(query1)"
|
|
1395
|
+
// "db.query('users').functionCallReturnValue.data" -> "db.query('users')"
|
|
1396
|
+
const funcReturnIdx = equivalentValue.indexOf('.functionCallReturnValue');
|
|
1397
|
+
if (funcReturnIdx === -1) {
|
|
1398
|
+
return;
|
|
908
1399
|
}
|
|
909
|
-
|
|
910
|
-
if
|
|
911
|
-
|
|
1400
|
+
const callSignature = equivalentValue.substring(0, funcReturnIdx);
|
|
1401
|
+
// Skip if the receiving variable is not a simple identifier
|
|
1402
|
+
// (e.g., skip if it's a path like "obj.property" or contains array access)
|
|
1403
|
+
if (receivingVariable.includes('.') || receivingVariable.includes('[')) {
|
|
1404
|
+
return;
|
|
912
1405
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
subPath,
|
|
919
|
-
functionAmbivalentSubPath,
|
|
920
|
-
scopeNodeName: scopeNode.name,
|
|
921
|
-
equivalentValuesLength: equivalentValues.length,
|
|
922
|
-
equivalentValues,
|
|
923
|
-
// scopeInfoEquivalencies: scopeNode.equivalencies,
|
|
924
|
-
// equivalencyValueChain,
|
|
925
|
-
}, null, 2));
|
|
1406
|
+
// Find the FunctionCallInfo that matches this call signature
|
|
1407
|
+
const searchKey = getFunctionCallRoot(callSignature);
|
|
1408
|
+
const functionCallInfo = this.getExternalFunctionCallsIndex().get(searchKey);
|
|
1409
|
+
if (!functionCallInfo) {
|
|
1410
|
+
return;
|
|
926
1411
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
1412
|
+
// Initialize arrays if needed
|
|
1413
|
+
if (!functionCallInfo.receivingVariableNames) {
|
|
1414
|
+
functionCallInfo.receivingVariableNames = [];
|
|
1415
|
+
}
|
|
1416
|
+
if (!functionCallInfo.callSignatureToVariable) {
|
|
1417
|
+
functionCallInfo.callSignatureToVariable = {};
|
|
1418
|
+
}
|
|
1419
|
+
// Add the receiving variable to the list (if not already present)
|
|
1420
|
+
if (!functionCallInfo.receivingVariableNames.includes(receivingVariable)) {
|
|
1421
|
+
functionCallInfo.receivingVariableNames.push(receivingVariable);
|
|
1422
|
+
}
|
|
1423
|
+
// Map the call signature to its receiving variable
|
|
1424
|
+
// Use the full call signature (not the search key) for precise mapping
|
|
1425
|
+
functionCallInfo.callSignatureToVariable[callSignature] = receivingVariable;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Propagates returnValue.* sub-properties from a callback scope to the usage path.
|
|
1429
|
+
*
|
|
1430
|
+
* When we have an equivalency like:
|
|
1431
|
+
* DataItemEditor().signature[0].structure -> getData().functionCallReturnValue
|
|
1432
|
+
*
|
|
1433
|
+
* And the callback scope for getData has:
|
|
1434
|
+
* returnValue.args -> dataStructure.arguments
|
|
1435
|
+
*
|
|
1436
|
+
* This method creates the transitive equivalency:
|
|
1437
|
+
* DataItemEditor().signature[0].structure.args -> signature[0].dataStructure.arguments
|
|
1438
|
+
*
|
|
1439
|
+
* It also resolves variable references through parent scopes (e.g., dataStructure -> signature[0].dataStructure)
|
|
1440
|
+
* and ensures the database entry is updated with the usage path.
|
|
1441
|
+
*/
|
|
1442
|
+
propagateFunctionCallReturnSubProperties(path, equivalentValue, scopeNode, allPaths) {
|
|
1443
|
+
// Try to find the callback scope name from different patterns:
|
|
1444
|
+
// 1. "getData().functionCallReturnValue" → look up getData variable to find scope
|
|
1445
|
+
// 2. "useMemo(cyScope1(), [...]).functionCallReturnValue" → extract cyScope1 directly
|
|
1446
|
+
let callbackScopeName;
|
|
1447
|
+
// Pattern 1: Simple function call like getData().functionCallReturnValue
|
|
1448
|
+
const simpleFunctionMatch = equivalentValue.match(/^(\w+)\(\)\.functionCallReturnValue$/);
|
|
1449
|
+
if (simpleFunctionMatch) {
|
|
1450
|
+
const functionName = simpleFunctionMatch[1];
|
|
1451
|
+
// Find the function reference in current or parent scopes
|
|
1452
|
+
const scopesToCheck = [scopeNode.name, ...scopeNode.tree];
|
|
1453
|
+
for (const scopeName of scopesToCheck) {
|
|
1454
|
+
const checkScope = this.scopeNodes[scopeName];
|
|
1455
|
+
if (!checkScope?.analysis?.isolatedEquivalentVariables)
|
|
1456
|
+
continue;
|
|
1457
|
+
const rawFunctionRef = checkScope.analysis.isolatedEquivalentVariables[functionName];
|
|
1458
|
+
// Normalize to array and find first string ending with 'F'
|
|
1459
|
+
const functionRefs = Array.isArray(rawFunctionRef)
|
|
1460
|
+
? rawFunctionRef
|
|
1461
|
+
: rawFunctionRef
|
|
1462
|
+
? [rawFunctionRef]
|
|
1463
|
+
: [];
|
|
1464
|
+
const functionRef = functionRefs.find((r) => typeof r === 'string' && r.endsWith('F'));
|
|
1465
|
+
if (typeof functionRef === 'string') {
|
|
1466
|
+
callbackScopeName = functionRef.slice(0, -1);
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
// Pattern 2: useMemo/useCallback with callback scope
|
|
1472
|
+
// e.g., "useMemo(cyScope1(), [deps]).functionCallReturnValue"
|
|
1473
|
+
if (!callbackScopeName) {
|
|
1474
|
+
const useMemoMatch = equivalentValue.match(/^useMemo\((\w+)\(\),\s*\[.*\]\)\.functionCallReturnValue$/);
|
|
1475
|
+
if (useMemoMatch) {
|
|
1476
|
+
callbackScopeName = useMemoMatch[1];
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
if (!callbackScopeName)
|
|
1480
|
+
return;
|
|
1481
|
+
const callbackScope = this.scopeNodes[callbackScopeName];
|
|
1482
|
+
if (!callbackScope)
|
|
1483
|
+
return;
|
|
1484
|
+
// Look for returnValue.* sub-properties in the callback scope
|
|
1485
|
+
if (!callbackScope.analysis?.isolatedEquivalentVariables)
|
|
1486
|
+
return;
|
|
1487
|
+
const isolatedVars = callbackScope.analysis.isolatedEquivalentVariables;
|
|
1488
|
+
// Get the first returnValue equivalency (normalize array to single value for these checks)
|
|
1489
|
+
const rawReturnValue = isolatedVars.returnValue;
|
|
1490
|
+
const firstReturnValue = Array.isArray(rawReturnValue)
|
|
1491
|
+
? rawReturnValue[0]
|
|
1492
|
+
: rawReturnValue;
|
|
1493
|
+
// First, check if returnValue is an alias to another variable (e.g., returnValue = intermediate)
|
|
1494
|
+
// If so, we need to look for that variable's sub-properties too
|
|
1495
|
+
const returnValueAlias = typeof firstReturnValue === 'string' && !firstReturnValue.includes('.')
|
|
1496
|
+
? firstReturnValue
|
|
1497
|
+
: undefined;
|
|
1498
|
+
// Pattern 3: Object.keys(X).reduce() - the reduce result has the same sub-properties as X
|
|
1499
|
+
// When returnValue = "Object.keys(source).reduce(...).functionCallReturnValue", look for source.* sub-properties
|
|
1500
|
+
let reduceSourceVar;
|
|
1501
|
+
if (typeof firstReturnValue === 'string') {
|
|
1502
|
+
const reduceMatch = firstReturnValue.match(/^Object\.keys\((\w+)\)\.reduce\(.*\)\.functionCallReturnValue$/);
|
|
1503
|
+
if (reduceMatch) {
|
|
1504
|
+
reduceSourceVar = reduceMatch[1];
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
for (const [subPath, rawSubValue] of Object.entries(isolatedVars)) {
|
|
1508
|
+
// Normalize to array for consistent handling
|
|
1509
|
+
const subValues = Array.isArray(rawSubValue)
|
|
1510
|
+
? rawSubValue
|
|
1511
|
+
: rawSubValue
|
|
1512
|
+
? [rawSubValue]
|
|
1513
|
+
: [];
|
|
1514
|
+
// Check for direct returnValue.* sub-properties
|
|
1515
|
+
const isReturnValueSub = subPath.startsWith('returnValue.') ||
|
|
1516
|
+
subPath.startsWith('returnValue[');
|
|
1517
|
+
// Also check for alias.* sub-properties (e.g., intermediate.args when returnValue = intermediate)
|
|
1518
|
+
const isAliasSub = returnValueAlias &&
|
|
1519
|
+
(subPath.startsWith(returnValueAlias + '.') ||
|
|
1520
|
+
subPath.startsWith(returnValueAlias + '['));
|
|
1521
|
+
// Also check for reduce source.* sub-properties (e.g., source['Function Arguments'] when returnValue = Object.keys(source).reduce())
|
|
1522
|
+
const isReduceSourceSub = reduceSourceVar &&
|
|
1523
|
+
(subPath.startsWith(reduceSourceVar + '.') ||
|
|
1524
|
+
subPath.startsWith(reduceSourceVar + '['));
|
|
1525
|
+
if (!isReturnValueSub && !isAliasSub && !isReduceSourceSub)
|
|
1526
|
+
continue;
|
|
1527
|
+
for (const subValue of subValues) {
|
|
1528
|
+
if (typeof subValue !== 'string')
|
|
1529
|
+
continue;
|
|
1530
|
+
// Convert alias/reduceSource paths to returnValue paths
|
|
1531
|
+
let effectiveSubPath = subPath;
|
|
1532
|
+
if (isAliasSub && !isReturnValueSub) {
|
|
1533
|
+
// Replace the alias prefix with returnValue
|
|
1534
|
+
effectiveSubPath =
|
|
1535
|
+
'returnValue' + subPath.substring(returnValueAlias.length);
|
|
1536
|
+
}
|
|
1537
|
+
else if (isReduceSourceSub && !isReturnValueSub && !isAliasSub) {
|
|
1538
|
+
// Replace the reduce source prefix with returnValue
|
|
1539
|
+
effectiveSubPath =
|
|
1540
|
+
'returnValue' + subPath.substring(reduceSourceVar.length);
|
|
1541
|
+
}
|
|
1542
|
+
const subPropertyPath = effectiveSubPath.substring('returnValue'.length);
|
|
1543
|
+
const newPath = cleanPath(path + subPropertyPath, allPaths);
|
|
1544
|
+
let newEquivalentValue = cleanPath(subValue.replace(/::cyDuplicateKey\d+::/g, ''), allPaths);
|
|
1545
|
+
// Resolve variable references through parent scope equivalencies
|
|
1546
|
+
const resolved = this.resolveVariableThroughParentScopes(newEquivalentValue, callbackScope, allPaths);
|
|
1547
|
+
newEquivalentValue = resolved.resolvedPath;
|
|
1548
|
+
const equivalentScopeName = resolved.scopeName;
|
|
1549
|
+
if (!newEquivalentValue || !this.isValidPath(newEquivalentValue))
|
|
1550
|
+
continue;
|
|
1551
|
+
this.addEquivalency(newPath, newEquivalentValue, equivalentScopeName, scopeNode, 'propagated function call return sub-property equivalency');
|
|
1552
|
+
// Ensure the database entry has the usage path
|
|
1553
|
+
this.addUsageToEquivalencyDatabaseEntry(newPath, newEquivalentValue, equivalentScopeName, scopeNode.name);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Resolves a variable path through parent scope equivalencies.
|
|
1559
|
+
*
|
|
1560
|
+
* For example, if the path is "dataStructure.arguments" and the parent scope has
|
|
1561
|
+
* dataStructure -> signature[0].dataStructure, this returns:
|
|
1562
|
+
* { resolvedPath: "signature[0].dataStructure.arguments", scopeName: "ParentScope" }
|
|
1563
|
+
*/
|
|
1564
|
+
resolveVariableThroughParentScopes(path, callbackScope, allPaths) {
|
|
1565
|
+
if (!path)
|
|
1566
|
+
return { resolvedPath: undefined, scopeName: callbackScope.name };
|
|
1567
|
+
// Extract the root variable name
|
|
1568
|
+
const dotIndex = path.indexOf('.');
|
|
1569
|
+
const bracketIndex = path.indexOf('[');
|
|
1570
|
+
let firstDelimiter = -1;
|
|
1571
|
+
if (dotIndex > -1 && bracketIndex > -1) {
|
|
1572
|
+
firstDelimiter = Math.min(dotIndex, bracketIndex);
|
|
1573
|
+
}
|
|
1574
|
+
else {
|
|
1575
|
+
firstDelimiter = dotIndex > -1 ? dotIndex : bracketIndex;
|
|
1576
|
+
}
|
|
1577
|
+
if (firstDelimiter === -1)
|
|
1578
|
+
return { resolvedPath: path, scopeName: callbackScope.name };
|
|
1579
|
+
const rootVar = path.substring(0, firstDelimiter);
|
|
1580
|
+
const restOfPath = path.substring(firstDelimiter);
|
|
1581
|
+
// Look in parent scopes for the root variable's equivalency
|
|
1582
|
+
for (const parentScopeName of callbackScope.tree || []) {
|
|
1583
|
+
const parentScope = this.scopeNodes[parentScopeName];
|
|
1584
|
+
if (!parentScope?.analysis?.isolatedEquivalentVariables)
|
|
1585
|
+
continue;
|
|
1586
|
+
const rawRootEquiv = parentScope.analysis.isolatedEquivalentVariables[rootVar];
|
|
1587
|
+
// Normalize to array and use first string value
|
|
1588
|
+
const rootEquivs = Array.isArray(rawRootEquiv)
|
|
1589
|
+
? rawRootEquiv
|
|
1590
|
+
: rawRootEquiv
|
|
1591
|
+
? [rawRootEquiv]
|
|
1592
|
+
: [];
|
|
1593
|
+
const rootEquiv = rootEquivs.find((r) => typeof r === 'string');
|
|
1594
|
+
if (typeof rootEquiv === 'string') {
|
|
1595
|
+
return {
|
|
1596
|
+
resolvedPath: cleanPath(rootEquiv + restOfPath, allPaths),
|
|
1597
|
+
scopeName: parentScopeName,
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
return { resolvedPath: path, scopeName: callbackScope.name };
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Adds a usage path to the equivalency database entry that has the given source.
|
|
1605
|
+
*
|
|
1606
|
+
* The addEquivalency call creates the equivalency but doesn't always properly
|
|
1607
|
+
* link the usage in the database, so we need to do it explicitly.
|
|
1608
|
+
*/
|
|
1609
|
+
addUsageToEquivalencyDatabaseEntry(usagePath, sourcePath, sourceScopeName, fallbackScopeName) {
|
|
1610
|
+
const usageEntry = {
|
|
1611
|
+
scopeNodeName: usagePath.match(/^([^().]+)\(\)/)
|
|
1612
|
+
? (usagePath.match(/^([^().]+)\(\)/)?.[1] ?? fallbackScopeName)
|
|
1613
|
+
: fallbackScopeName,
|
|
1614
|
+
schemaPath: usagePath,
|
|
1615
|
+
};
|
|
1616
|
+
const sourceKey = `${sourceScopeName}::${sourcePath}`;
|
|
1617
|
+
for (const entry of this.equivalencyDatabase) {
|
|
1618
|
+
if (entry.intermediatesOrder[sourceKey] === 0 ||
|
|
1619
|
+
entry.sourceCandidates.some((sc) => sc.scopeNodeName === sourceScopeName &&
|
|
1620
|
+
sc.schemaPath === sourcePath)) {
|
|
1621
|
+
const usageExists = entry.usages.some((u) => u.scopeNodeName === usageEntry.scopeNodeName &&
|
|
1622
|
+
u.schemaPath === usageEntry.schemaPath);
|
|
1623
|
+
if (!usageExists) {
|
|
1624
|
+
entry.usages.push(usageEntry);
|
|
1625
|
+
}
|
|
1626
|
+
break;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
checkForArrayItemPath(pathParts, scopeNode, equivalencyValueChain) {
|
|
1631
|
+
const arrayItemPath = this.joinPathParts([...pathParts, '[]']);
|
|
1632
|
+
if (scopeNode.equivalencies[arrayItemPath]) {
|
|
1633
|
+
const firstEquivalency = equivalencyValueChain[0].currentPath;
|
|
1634
|
+
const newFirstEquivalencyPath = this.joinPathParts([
|
|
1635
|
+
...this.splitPath(firstEquivalency.schemaPath),
|
|
1636
|
+
'[]',
|
|
1637
|
+
]);
|
|
1638
|
+
this.addToSchema({
|
|
1639
|
+
path: newFirstEquivalencyPath,
|
|
1640
|
+
value: 'unknown',
|
|
1641
|
+
scopeNode: this.scopeNodes[firstEquivalency.scopeNodeName],
|
|
1642
|
+
equivalencyValueChain: [
|
|
1643
|
+
{
|
|
1644
|
+
id: -1,
|
|
1645
|
+
source: 'Start: explicit array item',
|
|
1646
|
+
reason: 'Adding explicit array item to schema',
|
|
1647
|
+
},
|
|
1648
|
+
],
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Follows equivalencies for a subpath and recursively calls addToSchema.
|
|
1654
|
+
*
|
|
1655
|
+
* This is the recursive heart of schema propagation. When we have:
|
|
1656
|
+
* `user` equivalent to `props.user`
|
|
1657
|
+
* And we're processing `user.id`, this method will:
|
|
1658
|
+
* 1. Find the equivalency `user` → `props.user`
|
|
1659
|
+
* 2. Reconstruct the full path: `props.user.id`
|
|
1660
|
+
* 3. Recursively call addToSchema for the equivalent scope
|
|
1661
|
+
*
|
|
1662
|
+
* ## Function-Ambivalent Paths
|
|
1663
|
+
*
|
|
1664
|
+
* Handles paths like `data.map(fn)` by also checking equivalencies
|
|
1665
|
+
* for `data.map` (without the function argument). This allows
|
|
1666
|
+
* array method chains to propagate correctly.
|
|
1667
|
+
*
|
|
1668
|
+
* @param scopeNode - Current scope being processed
|
|
1669
|
+
* @param path - Full original path (e.g., 'user.profile.name')
|
|
1670
|
+
* @param pathParts - Split version of path
|
|
1671
|
+
* @param subPath - Current subpath being checked (e.g., 'user.profile')
|
|
1672
|
+
* @param subPathParts - Split version of subPath
|
|
1673
|
+
* @param value - Type value to propagate
|
|
1674
|
+
* @param equivalencyValueChain - Chain tracking for database
|
|
1675
|
+
* @param traceId - Debug ID
|
|
1676
|
+
* @param debugLevel - 0=minimal, 1=executed, 2=verbose
|
|
1677
|
+
*/
|
|
1678
|
+
followEquivalencies(scopeNode, path, pathParts, subPath, subPathParts, value, equivalencyValueChain, traceId, debugLevel = 0) {
|
|
1679
|
+
followEquivalenciesCallCount++;
|
|
1680
|
+
// Trace for debugging
|
|
1681
|
+
this.tracer.trace('followEquivalencies', {
|
|
1682
|
+
path,
|
|
1683
|
+
scope: scopeNode.name,
|
|
1684
|
+
subPath,
|
|
1685
|
+
hasEquivalencies: (scopeNode.equivalencies[subPath]?.length ?? 0) > 0,
|
|
1686
|
+
});
|
|
1687
|
+
let propagated = false;
|
|
1688
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1689
|
+
// Step 1: Collect equivalencies (including function-ambivalent paths)
|
|
1690
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1691
|
+
let equivalentValues = scopeNode.equivalencies[subPath] ?? [];
|
|
1692
|
+
let functionAmbivalentSubPath = subPath;
|
|
1693
|
+
let functionAmbivalentSubPathParts = subPathParts;
|
|
1694
|
+
// For paths like `data.map(fn)`, also check `data.map` equivalencies
|
|
1695
|
+
// PERF: Only do the expensive function-ambivalent processing if:
|
|
1696
|
+
// 1. No equivalencies found yet, AND
|
|
1697
|
+
// 2. The subpath ends with a function call (contains '(')
|
|
1698
|
+
const lastPart = subPathParts[subPathParts.length - 1];
|
|
1699
|
+
if (lastPart.indexOf('(') > -1) {
|
|
1700
|
+
// Check function-ambivalent path for equivalencies
|
|
1701
|
+
functionAmbivalentSubPathParts = [
|
|
1702
|
+
...subPathParts.slice(0, -1),
|
|
1703
|
+
lastPart.split('(')[0],
|
|
1704
|
+
];
|
|
1705
|
+
functionAmbivalentSubPath = this.joinPathParts(functionAmbivalentSubPathParts);
|
|
1706
|
+
const functionAmbivalentEquivalencies = scopeNode.equivalencies[functionAmbivalentSubPath];
|
|
1707
|
+
if (functionAmbivalentEquivalencies?.length > 0) {
|
|
1708
|
+
equivalentValues = [
|
|
1709
|
+
...equivalentValues,
|
|
1710
|
+
...functionAmbivalentEquivalencies,
|
|
1711
|
+
];
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
// Early exit optimization: if no equivalencies to follow, skip expensive processing
|
|
1715
|
+
if (equivalentValues.length === 0) {
|
|
1716
|
+
followEquivalenciesEarlyExitCount++;
|
|
1717
|
+
if (this.onlyEquivalencies) {
|
|
1718
|
+
followEquivalenciesEarlyExitPhase1Count++;
|
|
1719
|
+
}
|
|
1720
|
+
return false;
|
|
1721
|
+
}
|
|
1722
|
+
followEquivalenciesWithWorkCount++;
|
|
1723
|
+
if (traceId && debugLevel > 1) {
|
|
1724
|
+
console.info('Debug Propagation: equivalence', JSON.stringify({
|
|
1725
|
+
traceId,
|
|
1726
|
+
propagated,
|
|
1727
|
+
path,
|
|
1728
|
+
subPath,
|
|
1729
|
+
functionAmbivalentSubPath,
|
|
1730
|
+
scopeNodeName: scopeNode.name,
|
|
1731
|
+
equivalentValuesLength: equivalentValues.length,
|
|
1732
|
+
equivalentValues,
|
|
1733
|
+
// scopeInfoEquivalencies: scopeNode.equivalencies,
|
|
1734
|
+
// equivalencyValueChain,
|
|
1735
|
+
}, null, 2));
|
|
1736
|
+
}
|
|
1737
|
+
const uniqueEquivalentValues = this.uniqueScopeVariables(equivalentValues);
|
|
1738
|
+
// PERF: Only create Set when chain is non-empty (common case avoids allocation)
|
|
1739
|
+
// Pre-compute Set of chain IDs for O(1) cycle detection instead of O(n) .some()
|
|
1740
|
+
const chainIdSet = equivalencyValueChain.length > 0
|
|
1741
|
+
? new Set(equivalencyValueChain.map((ev) => ev.id))
|
|
1742
|
+
: null;
|
|
1743
|
+
for (let index = 0; index < uniqueEquivalentValues.length; ++index) {
|
|
1744
|
+
const equivalentValue = uniqueEquivalentValues[index];
|
|
1745
|
+
// O(1) cycle check using Set instead of O(n) .some()
|
|
1746
|
+
if (chainIdSet &&
|
|
1747
|
+
equivalentValue.id !== -1 &&
|
|
1748
|
+
chainIdSet.has(equivalentValue.id)) {
|
|
1749
|
+
if (traceId) {
|
|
1750
|
+
console.info('Debug Propagation: skipping circular equivalence', JSON.stringify({
|
|
1751
|
+
traceId,
|
|
1752
|
+
path,
|
|
1753
|
+
subPath,
|
|
1754
|
+
functionAmbivalentSubPath,
|
|
1755
|
+
scopeNodeName: scopeNode.name,
|
|
1756
|
+
equivalentValue,
|
|
1757
|
+
equivalencyValueChain,
|
|
941
1758
|
}, null, 2));
|
|
942
1759
|
}
|
|
943
1760
|
continue;
|
|
@@ -956,16 +1773,32 @@ export class ScopeDataStructure {
|
|
|
956
1773
|
if (lastRelevantSubPathPart.endsWith(')') &&
|
|
957
1774
|
schemaPathParts[schemaPathParts.length - 1] ===
|
|
958
1775
|
lastRelevantSubPathPart.split('(')[0]) {
|
|
959
|
-
|
|
960
|
-
|
|
1776
|
+
// PERF: Don't mutate the array - create a new one to avoid requiring structuredClone
|
|
1777
|
+
const updatedSchemaPathParts = [
|
|
1778
|
+
...schemaPathParts.slice(0, -1),
|
|
1779
|
+
lastRelevantSubPathPart,
|
|
1780
|
+
];
|
|
1781
|
+
schemaPath = this.joinPathParts(updatedSchemaPathParts);
|
|
961
1782
|
}
|
|
962
1783
|
const remainingPathParts = pathParts.slice(relevantSubPathParts.length);
|
|
963
1784
|
const remainingPath = this.joinPathParts(remainingPathParts);
|
|
964
1785
|
if (relevantSubPathParts.every((part, i) => part === schemaPathParts[i]) &&
|
|
965
1786
|
equivalentValue.scopeNodeName === scopeNode.name) {
|
|
1787
|
+
// DEBUG
|
|
966
1788
|
continue;
|
|
967
1789
|
}
|
|
968
1790
|
const newEquivalentPath = this.joinPathParts([schemaPath, remainingPath]);
|
|
1791
|
+
// PERF: Detect repeated patterns in paths to prevent exponential blowup
|
|
1792
|
+
// Paths like `signature[0].attributes.properties[].attributes.properties[]...`
|
|
1793
|
+
// indicate recursive type structures that cause exponential schema explosion
|
|
1794
|
+
if (this.hasExcessivePatternRepetition(newEquivalentPath)) {
|
|
1795
|
+
if (traceId && debugLevel > 0) {
|
|
1796
|
+
console.info('Debug: skipping path with excessive pattern repetition', {
|
|
1797
|
+
path: newEquivalentPath,
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
continue;
|
|
1801
|
+
}
|
|
969
1802
|
if (!equivalentScopeNode) {
|
|
970
1803
|
if (traceId) {
|
|
971
1804
|
console.info('Debug Propagation: missing equivalent scope info', {
|
|
@@ -1000,23 +1833,27 @@ export class ScopeDataStructure {
|
|
|
1000
1833
|
// equivalencies: scopeNode.equivalencies,
|
|
1001
1834
|
}, null, 2));
|
|
1002
1835
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1836
|
+
// PERF: Use spread instead of structuredClone - the chain items are immutable
|
|
1837
|
+
// so shallow copy is sufficient and much faster (structuredClone is expensive)
|
|
1838
|
+
const localEquivalencyValueChain = [
|
|
1839
|
+
...equivalencyValueChain,
|
|
1840
|
+
{
|
|
1841
|
+
id: equivalentValue.id,
|
|
1842
|
+
source: 'equivalence',
|
|
1843
|
+
previousPath: {
|
|
1844
|
+
scopeNodeName: scopeNode.name,
|
|
1845
|
+
schemaPath: path,
|
|
1846
|
+
value,
|
|
1847
|
+
},
|
|
1848
|
+
currentPath: {
|
|
1849
|
+
scopeNodeName: equivalentScopeNode.name,
|
|
1850
|
+
schemaPath: newEquivalentPath,
|
|
1851
|
+
value,
|
|
1852
|
+
},
|
|
1853
|
+
reason: equivalentValue.equivalencyReason,
|
|
1854
|
+
traceId,
|
|
1016
1855
|
},
|
|
1017
|
-
|
|
1018
|
-
traceId,
|
|
1019
|
-
});
|
|
1856
|
+
];
|
|
1020
1857
|
// writeEquivalencyToFile(
|
|
1021
1858
|
// scopeNode.name,
|
|
1022
1859
|
// subPath,
|
|
@@ -1026,13 +1863,48 @@ export class ScopeDataStructure {
|
|
|
1026
1863
|
// equivalentValue.equivalencyReason,
|
|
1027
1864
|
// )
|
|
1028
1865
|
propagated = true;
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1866
|
+
// PERF: If batch processor is active, queue work instead of recursing
|
|
1867
|
+
// This converts deep recursion to iterative processing
|
|
1868
|
+
if (this.batchProcessor) {
|
|
1869
|
+
// PERF OPTIMIZATION: For external function calls, use path-only key (ignore value)
|
|
1870
|
+
// External FCs don't have internals to analyze, so processing the same path
|
|
1871
|
+
// with different values is redundant - we're just tracking data flow
|
|
1872
|
+
const isExternalFc = equivalentValue.equivalencyReason ===
|
|
1873
|
+
'equivalency to external function call' ||
|
|
1874
|
+
this.getExternalFunctionCallInfo(equivalentScopeNode.name) !==
|
|
1875
|
+
undefined;
|
|
1876
|
+
const queueKey = isExternalFc
|
|
1877
|
+
? `${equivalentScopeNode.name}::${newEquivalentPath}` // path-only for external FC
|
|
1878
|
+
: `${equivalentScopeNode.name}::${newEquivalentPath}::${value}`; // full key otherwise
|
|
1879
|
+
// Always check visited - it catches already-processed items
|
|
1880
|
+
const alreadyVisited = this.visitedTracker.hasGlobalVisited(equivalentScopeNode.name, newEquivalentPath, value);
|
|
1881
|
+
// For external FCs, queueKey is path-only so this catches any-value duplicates
|
|
1882
|
+
const alreadyQueued = this.batchQueuedSet?.has(queueKey);
|
|
1883
|
+
if (alreadyVisited || alreadyQueued) {
|
|
1884
|
+
// Still record in database to capture the chain (as addToSchema does)
|
|
1885
|
+
this.addToEquivalencyDatabase(localEquivalencyValueChain, traceId);
|
|
1886
|
+
}
|
|
1887
|
+
else {
|
|
1888
|
+
// Mark as queued to prevent duplicate queue entries
|
|
1889
|
+
this.batchQueuedSet?.add(queueKey);
|
|
1890
|
+
this.batchProcessor.addWork({
|
|
1891
|
+
scopeNodeName: equivalentScopeNode.name,
|
|
1892
|
+
path: newEquivalentPath,
|
|
1893
|
+
value,
|
|
1894
|
+
equivalencyValueChain: localEquivalencyValueChain,
|
|
1895
|
+
traceId,
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
else {
|
|
1900
|
+
this.addToSchema({
|
|
1901
|
+
path: newEquivalentPath,
|
|
1902
|
+
value,
|
|
1903
|
+
scopeNode: equivalentScopeNode,
|
|
1904
|
+
equivalencyValueChain: localEquivalencyValueChain,
|
|
1905
|
+
traceId,
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1036
1908
|
}
|
|
1037
1909
|
}
|
|
1038
1910
|
return propagated;
|
|
@@ -1054,6 +1926,13 @@ export class ScopeDataStructure {
|
|
|
1054
1926
|
return;
|
|
1055
1927
|
}
|
|
1056
1928
|
const usageScopeNode = this.getScopeOrFunctionCallInfo(usageEquivalency.scopeNodeName);
|
|
1929
|
+
if (!usageScopeNode)
|
|
1930
|
+
continue;
|
|
1931
|
+
// Guard against infinite recursion by tracking which paths we've already
|
|
1932
|
+
// added from addComplexSourcePathVariables
|
|
1933
|
+
if (this.visitedTracker.checkAndMarkComplexSourceVisited(usageScopeNode.name, newUsageEquivalentPath)) {
|
|
1934
|
+
continue;
|
|
1935
|
+
}
|
|
1057
1936
|
this.addToSchema({
|
|
1058
1937
|
path: newUsageEquivalentPath,
|
|
1059
1938
|
value: 'unknown',
|
|
@@ -1097,6 +1976,8 @@ export class ScopeDataStructure {
|
|
|
1097
1976
|
continue;
|
|
1098
1977
|
}
|
|
1099
1978
|
const usageScopeNode = this.getScopeOrFunctionCallInfo(usageEquivalency.scopeNodeName);
|
|
1979
|
+
if (!usageScopeNode)
|
|
1980
|
+
continue;
|
|
1100
1981
|
// This is put in place to avoid propagating array functions like 'filter' through complex equivalencies
|
|
1101
1982
|
// but may cause problems if the funtion call is not on a known object (e.g. string or array)
|
|
1102
1983
|
if (newUsageEquivalentPath.endsWith(')') ||
|
|
@@ -1162,6 +2043,7 @@ export class ScopeDataStructure {
|
|
|
1162
2043
|
}
|
|
1163
2044
|
for (let i = 0; i < cleanEquivalencyValueChain.length; ++i) {
|
|
1164
2045
|
const pathInfo = cleanEquivalencyValueChain[i].currentPath;
|
|
2046
|
+
const previousPath = cleanEquivalencyValueChain[i].previousPath;
|
|
1165
2047
|
const schemaPathParts = this.splitPath(pathInfo.schemaPath);
|
|
1166
2048
|
const isSignaturePath = schemaPathParts.findIndex((p) => p.startsWith('signature[')) > 0;
|
|
1167
2049
|
if (schemaPathParts[0].startsWith('returnValue') ||
|
|
@@ -1171,6 +2053,17 @@ export class ScopeDataStructure {
|
|
|
1171
2053
|
) {
|
|
1172
2054
|
databaseEntry.usages.push(pathInfo);
|
|
1173
2055
|
}
|
|
2056
|
+
// Also add previousPath as a usage if it matches the criteria
|
|
2057
|
+
// This handles propagated sub-property equivalencies where the JSX prop path
|
|
2058
|
+
// is in previousPath and should be tracked as a usage
|
|
2059
|
+
if (previousPath) {
|
|
2060
|
+
const prevSchemaPathParts = this.splitPath(previousPath.schemaPath);
|
|
2061
|
+
const isPrevSignaturePath = prevSchemaPathParts.findIndex((p) => p.startsWith('signature[')) > 0;
|
|
2062
|
+
if (prevSchemaPathParts[0].startsWith('returnValue') ||
|
|
2063
|
+
isPrevSignaturePath) {
|
|
2064
|
+
databaseEntry.usages.push(previousPath);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
1174
2067
|
const pathId = this.uniqueId(pathInfo);
|
|
1175
2068
|
let intermediateIndex = cleanEquivalencyValueChain.length - i - 1;
|
|
1176
2069
|
const existingIntermediateIndex = databaseEntry.intermediatesOrder[pathId];
|
|
@@ -1181,9 +2074,70 @@ export class ScopeDataStructure {
|
|
|
1181
2074
|
// Update inverted index
|
|
1182
2075
|
this.intermediatesOrderIndex.set(pathId, databaseEntry);
|
|
1183
2076
|
if (intermediateIndex === 0) {
|
|
1184
|
-
|
|
2077
|
+
let isValidSourceCandidate = pathInfo.schemaPath.startsWith('signature[') ||
|
|
1185
2078
|
pathInfo.schemaPath.includes('functionCallReturnValue');
|
|
1186
|
-
if
|
|
2079
|
+
// Check if path STARTS with a spread pattern like [...var]
|
|
2080
|
+
// This handles cases like [...files][][0] or [...files].sort(...).functionCallReturnValue[][0]
|
|
2081
|
+
// where the spread source variable needs to be resolved to a signature path.
|
|
2082
|
+
// We do this REGARDLESS of isValidSourceCandidate because even paths containing
|
|
2083
|
+
// functionCallReturnValue may need spread resolution to trace back to the signature.
|
|
2084
|
+
const spreadMatch = pathInfo.schemaPath.match(/^\[\.\.\.(\w+)\]/);
|
|
2085
|
+
if (spreadMatch) {
|
|
2086
|
+
const spreadVar = spreadMatch[1];
|
|
2087
|
+
const spreadPattern = spreadMatch[0]; // The full [...var] match
|
|
2088
|
+
const scopeNode = this.scopeNodes[pathInfo.scopeNodeName];
|
|
2089
|
+
if (scopeNode?.equivalencies) {
|
|
2090
|
+
// Follow the equivalency chain to find a signature path
|
|
2091
|
+
// e.g., files (cyScope1) → files (root) → signature[0].files
|
|
2092
|
+
const resolveToSignature = (varName, currentScopeName, visited) => {
|
|
2093
|
+
const visitKey = `${currentScopeName}::${varName}`;
|
|
2094
|
+
if (visited.has(visitKey))
|
|
2095
|
+
return null;
|
|
2096
|
+
visited.add(visitKey);
|
|
2097
|
+
const currentScope = this.scopeNodes[currentScopeName];
|
|
2098
|
+
if (!currentScope?.equivalencies)
|
|
2099
|
+
return null;
|
|
2100
|
+
const varEquivs = currentScope.equivalencies[varName];
|
|
2101
|
+
if (!varEquivs)
|
|
2102
|
+
return null;
|
|
2103
|
+
// First check if any equivalency directly points to a signature path
|
|
2104
|
+
const signatureEquiv = varEquivs.find((eq) => eq.schemaPath.startsWith('signature['));
|
|
2105
|
+
if (signatureEquiv) {
|
|
2106
|
+
return signatureEquiv;
|
|
2107
|
+
}
|
|
2108
|
+
// Otherwise, follow the chain to other scopes
|
|
2109
|
+
for (const equiv of varEquivs) {
|
|
2110
|
+
// If the equivalency points to the same variable in a different scope,
|
|
2111
|
+
// follow the chain
|
|
2112
|
+
if (equiv.schemaPath === varName &&
|
|
2113
|
+
equiv.scopeNodeName !== currentScopeName) {
|
|
2114
|
+
const result = resolveToSignature(varName, equiv.scopeNodeName, visited);
|
|
2115
|
+
if (result)
|
|
2116
|
+
return result;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
return null;
|
|
2120
|
+
};
|
|
2121
|
+
const signatureEquiv = resolveToSignature(spreadVar, pathInfo.scopeNodeName, new Set());
|
|
2122
|
+
if (signatureEquiv) {
|
|
2123
|
+
// Replace ONLY the [...var] part with the resolved signature path
|
|
2124
|
+
// This preserves any suffix like .sort(...).functionCallReturnValue[][0]
|
|
2125
|
+
const resolvedPath = pathInfo.schemaPath.replace(spreadPattern, signatureEquiv.schemaPath);
|
|
2126
|
+
// Add the resolved path as a source candidate
|
|
2127
|
+
if (!databaseEntry.sourceCandidates.some((sc) => sc.schemaPath === resolvedPath &&
|
|
2128
|
+
sc.scopeNodeName === pathInfo.scopeNodeName)) {
|
|
2129
|
+
databaseEntry.sourceCandidates.push({
|
|
2130
|
+
scopeNodeName: pathInfo.scopeNodeName,
|
|
2131
|
+
schemaPath: resolvedPath,
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
isValidSourceCandidate = true;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
if (isValidSourceCandidate &&
|
|
2139
|
+
!databaseEntry.sourceCandidates.some((sc) => sc.schemaPath === pathInfo.schemaPath &&
|
|
2140
|
+
sc.scopeNodeName === pathInfo.scopeNodeName)) {
|
|
1187
2141
|
databaseEntry.sourceCandidates.push(pathInfo);
|
|
1188
2142
|
}
|
|
1189
2143
|
}
|
|
@@ -1236,6 +2190,7 @@ export class ScopeDataStructure {
|
|
|
1236
2190
|
if (functionScope) {
|
|
1237
2191
|
functionScope.functionCalls.push(externalFunctionCallInfo);
|
|
1238
2192
|
this.externalFunctionCalls.splice(i, 1);
|
|
2193
|
+
this.invalidateExternalFunctionCallsIndex();
|
|
1239
2194
|
for (const equivalentPath in externalFunctionCallInfo.equivalencies) {
|
|
1240
2195
|
let localEquivalentPath = equivalentPath;
|
|
1241
2196
|
if (localEquivalentPath.startsWith(externalFunctionCallInfo.callSignature)) {
|
|
@@ -1278,15 +2233,17 @@ export class ScopeDataStructure {
|
|
|
1278
2233
|
for (const key in scopeNode.equivalencies) {
|
|
1279
2234
|
const keyParts = this.splitPath(key);
|
|
1280
2235
|
if (keyParts.length > 1) {
|
|
1281
|
-
|
|
2236
|
+
// PERF: Don't mutate the array - use indexing instead of pop() to avoid requiring structuredClone
|
|
2237
|
+
const lastPart = keyParts[keyParts.length - 1];
|
|
1282
2238
|
if (lastPart.startsWith('signature[')) {
|
|
1283
|
-
const
|
|
2239
|
+
const keyPartsWithoutLast = keyParts.slice(0, -1);
|
|
2240
|
+
const functionCall = keyPartsWithoutLast[keyPartsWithoutLast.length - 1];
|
|
1284
2241
|
const argumentsIndex = functionCall.indexOf('(');
|
|
1285
2242
|
const functionName = this.joinPathParts([
|
|
1286
|
-
...
|
|
2243
|
+
...keyPartsWithoutLast.slice(0, -1),
|
|
1287
2244
|
functionCall.slice(0, argumentsIndex === -1 ? undefined : argumentsIndex),
|
|
1288
2245
|
]);
|
|
1289
|
-
const callSignature = this.joinPathParts(
|
|
2246
|
+
const callSignature = this.joinPathParts(keyPartsWithoutLast);
|
|
1290
2247
|
const functionCallInfo = {
|
|
1291
2248
|
name: functionName,
|
|
1292
2249
|
callSignature,
|
|
@@ -1298,15 +2255,17 @@ export class ScopeDataStructure {
|
|
|
1298
2255
|
for (const equivalentValues of scopeNode.equivalencies[key]) {
|
|
1299
2256
|
const equivalentValueParts = this.splitPath(equivalentValues.schemaPath);
|
|
1300
2257
|
if (equivalentValueParts.length > 1) {
|
|
1301
|
-
|
|
2258
|
+
// PERF: Don't mutate the array - use indexing instead of pop() to avoid requiring structuredClone
|
|
2259
|
+
const lastPart = equivalentValueParts[equivalentValueParts.length - 1];
|
|
1302
2260
|
if (lastPart.startsWith('functionCallReturnValue')) {
|
|
1303
|
-
const
|
|
2261
|
+
const partsWithoutLast = equivalentValueParts.slice(0, -1);
|
|
2262
|
+
const functionCall = partsWithoutLast[partsWithoutLast.length - 1];
|
|
1304
2263
|
const argumentsIndex = functionCall.indexOf('(');
|
|
1305
2264
|
const functionName = this.joinPathParts([
|
|
1306
|
-
...
|
|
2265
|
+
...partsWithoutLast.slice(0, -1),
|
|
1307
2266
|
functionCall.slice(0, argumentsIndex === -1 ? undefined : argumentsIndex),
|
|
1308
2267
|
]);
|
|
1309
|
-
const callSignature = this.joinPathParts(
|
|
2268
|
+
const callSignature = this.joinPathParts(partsWithoutLast);
|
|
1310
2269
|
const functionCallInfo = {
|
|
1311
2270
|
name: functionName,
|
|
1312
2271
|
callSignature,
|
|
@@ -1324,6 +2283,13 @@ export class ScopeDataStructure {
|
|
|
1324
2283
|
delete scopeNode.schema[key];
|
|
1325
2284
|
}
|
|
1326
2285
|
}
|
|
2286
|
+
// Ensure parameter-to-signature equivalencies are fully propagated.
|
|
2287
|
+
// When a parameter variable (e.g., `node`) is equivalenced to `signature[N]`,
|
|
2288
|
+
// all sub-paths of that variable should also appear under `signature[N]`.
|
|
2289
|
+
// This handles cases where the sub-path was added to the schema via a propagation
|
|
2290
|
+
// chain that already included the variable↔signature equivalency, causing the
|
|
2291
|
+
// cycle detection to prevent the reverse mapping.
|
|
2292
|
+
this.propagateParameterToSignaturePaths(scopeNode);
|
|
1327
2293
|
fillInSchemaGapsAndUnknowns(scopeNode, fillInUnknowns);
|
|
1328
2294
|
if (final) {
|
|
1329
2295
|
for (const manager of this.equivalencyManagers) {
|
|
@@ -1335,6 +2301,85 @@ export class ScopeDataStructure {
|
|
|
1335
2301
|
ensureSchemaConsistency(scopeNode.schema);
|
|
1336
2302
|
}
|
|
1337
2303
|
}
|
|
2304
|
+
/**
|
|
2305
|
+
* For each equivalency where a simple variable maps to signature[N],
|
|
2306
|
+
* ensure all sub-paths of that variable are reflected under signature[N].
|
|
2307
|
+
*/
|
|
2308
|
+
propagateParameterToSignaturePaths(scopeNode) {
|
|
2309
|
+
// Helper: check if a type is a concrete scalar that cannot have sub-properties.
|
|
2310
|
+
const SCALAR_TYPES = new Set([
|
|
2311
|
+
'string',
|
|
2312
|
+
'number',
|
|
2313
|
+
'boolean',
|
|
2314
|
+
'bigint',
|
|
2315
|
+
'symbol',
|
|
2316
|
+
'void',
|
|
2317
|
+
'never',
|
|
2318
|
+
]);
|
|
2319
|
+
const isDefinitelyScalar = (type) => {
|
|
2320
|
+
const parts = type.split('|').map((s) => s.trim());
|
|
2321
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
2322
|
+
return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
|
|
2323
|
+
};
|
|
2324
|
+
// Find variable → signature[N] equivalencies
|
|
2325
|
+
for (const [varName, equivalencies] of Object.entries(scopeNode.equivalencies)) {
|
|
2326
|
+
// Only process simple variable names (no dots, brackets, or parens)
|
|
2327
|
+
if (varName.includes('.') ||
|
|
2328
|
+
varName.includes('[') ||
|
|
2329
|
+
varName.includes('(')) {
|
|
2330
|
+
continue;
|
|
2331
|
+
}
|
|
2332
|
+
for (const equiv of equivalencies) {
|
|
2333
|
+
if (equiv.scopeNodeName === scopeNode.name &&
|
|
2334
|
+
equiv.schemaPath.startsWith('signature[')) {
|
|
2335
|
+
const signaturePath = equiv.schemaPath;
|
|
2336
|
+
const varPrefix = varName + '.';
|
|
2337
|
+
const varBracketPrefix = varName + '[';
|
|
2338
|
+
// Find all schema keys starting with the variable
|
|
2339
|
+
for (const key in scopeNode.schema) {
|
|
2340
|
+
if (key.startsWith(varPrefix) || key.startsWith(varBracketPrefix)) {
|
|
2341
|
+
const suffix = key.slice(varName.length);
|
|
2342
|
+
const sigKey = signaturePath + suffix;
|
|
2343
|
+
// Only add if the signature path doesn't already exist
|
|
2344
|
+
if (!scopeNode.schema[sigKey]) {
|
|
2345
|
+
// Check if this path represents variable conflation:
|
|
2346
|
+
// When a standalone variable (e.g., showWorkoutForm from useState)
|
|
2347
|
+
// appears as a sub-property of a scalar-typed ancestor (e.g.,
|
|
2348
|
+
// activity_type = "string"), it's from scope conflation, not real
|
|
2349
|
+
// property access. Block these while allowing legitimate built-in
|
|
2350
|
+
// accesses like string.length or string.slice.
|
|
2351
|
+
let isConflatedPath = false;
|
|
2352
|
+
let checkPos = signaturePath.length;
|
|
2353
|
+
while (true) {
|
|
2354
|
+
checkPos = sigKey.indexOf('.', checkPos + 1);
|
|
2355
|
+
if (checkPos === -1)
|
|
2356
|
+
break;
|
|
2357
|
+
const ancestorPath = sigKey.substring(0, checkPos);
|
|
2358
|
+
const ancestorType = scopeNode.schema[ancestorPath];
|
|
2359
|
+
if (ancestorType && isDefinitelyScalar(ancestorType)) {
|
|
2360
|
+
// Ancestor is scalar — check if the immediate sub-property
|
|
2361
|
+
// is also a standalone variable (indicating conflation)
|
|
2362
|
+
const afterDot = sigKey.substring(checkPos + 1);
|
|
2363
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
2364
|
+
const subPropName = nextSep === -1
|
|
2365
|
+
? afterDot
|
|
2366
|
+
: afterDot.substring(0, nextSep);
|
|
2367
|
+
if (scopeNode.schema[subPropName] !== undefined) {
|
|
2368
|
+
isConflatedPath = true;
|
|
2369
|
+
break;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
if (!isConflatedPath) {
|
|
2374
|
+
scopeNode.schema[sigKey] = scopeNode.schema[key];
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
1338
2383
|
filterAndConvertSchema({ filterPath, newPath, schema, }) {
|
|
1339
2384
|
const filterPathParts = this.splitPath(filterPath);
|
|
1340
2385
|
return Object.keys(schema).reduce((acc, key) => {
|
|
@@ -1394,6 +2439,10 @@ export class ScopeDataStructure {
|
|
|
1394
2439
|
path,
|
|
1395
2440
|
...this.splitPath(key).slice(equivalentValueSchemaPathParts.length),
|
|
1396
2441
|
]);
|
|
2442
|
+
// PERF: Skip keys with repeated function-call signature patterns
|
|
2443
|
+
// to prevent recursive type expansion (e.g., string.localeCompare returns string)
|
|
2444
|
+
if (this.hasExcessivePatternRepetition(newKey))
|
|
2445
|
+
continue;
|
|
1397
2446
|
resolvedSchema[newKey] = value;
|
|
1398
2447
|
}
|
|
1399
2448
|
}
|
|
@@ -1415,6 +2464,9 @@ export class ScopeDataStructure {
|
|
|
1415
2464
|
if (!subSchema)
|
|
1416
2465
|
continue;
|
|
1417
2466
|
for (const resolvedKey in subSchema) {
|
|
2467
|
+
// PERF: Skip keys with repeated function-call signature patterns
|
|
2468
|
+
if (this.hasExcessivePatternRepetition(resolvedKey))
|
|
2469
|
+
continue;
|
|
1418
2470
|
if (!resolvedSchema[resolvedKey] ||
|
|
1419
2471
|
subSchema[resolvedKey] === 'unknown') {
|
|
1420
2472
|
resolvedSchema[resolvedKey] = subSchema[resolvedKey];
|
|
@@ -1451,7 +2503,7 @@ export class ScopeDataStructure {
|
|
|
1451
2503
|
return this.getExternalFunctionCallInfo(scopeName);
|
|
1452
2504
|
}
|
|
1453
2505
|
getScopeNode(scopeName) {
|
|
1454
|
-
const scopeNode = this.scopeNodes[scopeName ?? this.
|
|
2506
|
+
const scopeNode = this.scopeNodes[scopeName ?? this.scopeTreeManager.getRootName()];
|
|
1455
2507
|
if (scopeNode)
|
|
1456
2508
|
return scopeNode;
|
|
1457
2509
|
for (const scopeNodeName in this.scopeNodes) {
|
|
@@ -1460,20 +2512,54 @@ export class ScopeDataStructure {
|
|
|
1460
2512
|
}
|
|
1461
2513
|
}
|
|
1462
2514
|
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Gets or builds the external function calls index for O(1) lookup.
|
|
2517
|
+
* The index maps both the full name and the name without generics to the FunctionCallInfo.
|
|
2518
|
+
*/
|
|
2519
|
+
getExternalFunctionCallsIndex() {
|
|
2520
|
+
if (this.externalFunctionCallsIndex === null) {
|
|
2521
|
+
this.externalFunctionCallsIndex = new Map();
|
|
2522
|
+
for (const efc of this.externalFunctionCalls) {
|
|
2523
|
+
this.externalFunctionCallsIndex.set(efc.name, efc);
|
|
2524
|
+
// Also index by name without generics (e.g., 'MyFunction<T>' -> 'MyFunction')
|
|
2525
|
+
const nameWithoutGenerics = this.pathManager.stripGenerics(efc.name);
|
|
2526
|
+
if (nameWithoutGenerics !== efc.name) {
|
|
2527
|
+
this.externalFunctionCallsIndex.set(nameWithoutGenerics, efc);
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
return this.externalFunctionCallsIndex;
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Invalidates the external function calls index.
|
|
2535
|
+
* Call this after any mutation to externalFunctionCalls array.
|
|
2536
|
+
*/
|
|
2537
|
+
invalidateExternalFunctionCallsIndex() {
|
|
2538
|
+
this.externalFunctionCallsIndex = null;
|
|
2539
|
+
}
|
|
1463
2540
|
getExternalFunctionCallInfo(functionName) {
|
|
1464
|
-
|
|
1465
|
-
|
|
2541
|
+
const searchKey = getFunctionCallRoot(functionName);
|
|
2542
|
+
const index = this.getExternalFunctionCallsIndex();
|
|
2543
|
+
// First try exact match
|
|
2544
|
+
const exact = index.get(searchKey);
|
|
2545
|
+
if (exact)
|
|
2546
|
+
return exact;
|
|
2547
|
+
// Fallback to the original find for edge cases not covered by index
|
|
2548
|
+
return this.externalFunctionCalls.find((efc) => efc.name === searchKey ||
|
|
2549
|
+
this.pathManager.stripGenerics(efc.name) === searchKey);
|
|
1466
2550
|
}
|
|
1467
2551
|
getScopeAnalysis(scopeName) {
|
|
1468
|
-
return this.scopeNodes[scopeName ?? this.
|
|
2552
|
+
return this.scopeNodes[scopeName ?? this.scopeTreeManager.getRootName()]
|
|
2553
|
+
.analysis;
|
|
1469
2554
|
}
|
|
1470
2555
|
getAnalysisTree() {
|
|
1471
2556
|
return this.scopeTree;
|
|
1472
2557
|
}
|
|
1473
2558
|
getSchema({ scopeName, fillInUnknowns, }) {
|
|
1474
|
-
const scopeNode = this.scopeNodes[scopeName ?? this.
|
|
2559
|
+
const scopeNode = this.scopeNodes[scopeName ?? this.scopeTreeManager.getRootName()];
|
|
1475
2560
|
if (!scopeNode) {
|
|
1476
|
-
const
|
|
2561
|
+
const searchKey = getFunctionCallRoot(scopeName);
|
|
2562
|
+
const externalFunctionCallSchema = this.getExternalFunctionCallsIndex().get(searchKey)?.schema;
|
|
1477
2563
|
if (!externalFunctionCallSchema)
|
|
1478
2564
|
return;
|
|
1479
2565
|
return Object.keys(externalFunctionCallSchema).reduce((acc, key) => {
|
|
@@ -1483,9 +2569,56 @@ export class ScopeDataStructure {
|
|
|
1483
2569
|
return acc;
|
|
1484
2570
|
}, {});
|
|
1485
2571
|
}
|
|
2572
|
+
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
2573
|
+
// during this "getter" method. See comment in getFunctionSignature.
|
|
2574
|
+
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
2575
|
+
this.onlyEquivalencies = true;
|
|
1486
2576
|
this.validateSchema(scopeNode, true, fillInUnknowns);
|
|
2577
|
+
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
1487
2578
|
const { schema } = scopeNode;
|
|
1488
|
-
|
|
2579
|
+
// For root scope, merge in external function call schemas
|
|
2580
|
+
// This ensures that imported objects used as method call targets (like logger.error())
|
|
2581
|
+
// appear in the schema as objects with function properties
|
|
2582
|
+
if (scopeName === undefined ||
|
|
2583
|
+
scopeName === this.scopeTreeManager.getRootName()) {
|
|
2584
|
+
const mergedSchema = { ...schema };
|
|
2585
|
+
for (const efc of this.externalFunctionCalls) {
|
|
2586
|
+
// Add the base object name (e.g., "logger") as an object
|
|
2587
|
+
const baseName = this.splitPath(efc.name)[0];
|
|
2588
|
+
if (!mergedSchema[baseName]) {
|
|
2589
|
+
mergedSchema[baseName] = 'object';
|
|
2590
|
+
}
|
|
2591
|
+
// Get all call signatures (use allCallSignatures if available, otherwise just the single callSignature)
|
|
2592
|
+
const signatures = efc.allCallSignatures ?? [efc.callSignature];
|
|
2593
|
+
for (const signature of signatures) {
|
|
2594
|
+
// Add the method as a function (e.g., "logger.error")
|
|
2595
|
+
// Extract method name from callSignature like "logger.error(args...)"
|
|
2596
|
+
// Get everything before the first '(' to get "logger.error"
|
|
2597
|
+
const parenIndex = signature.indexOf('(');
|
|
2598
|
+
if (parenIndex > 0) {
|
|
2599
|
+
const methodPath = signature.substring(0, parenIndex);
|
|
2600
|
+
if (methodPath.includes('.') && !mergedSchema[methodPath]) {
|
|
2601
|
+
mergedSchema[methodPath] = 'function';
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
return this.filterDuplicateKeys(mergedSchema);
|
|
2607
|
+
}
|
|
2608
|
+
return this.filterDuplicateKeys(schema);
|
|
2609
|
+
}
|
|
2610
|
+
/**
|
|
2611
|
+
* Filter out ::cyDuplicateKey:: entries from a schema.
|
|
2612
|
+
* These are internal markers for tracking variable reassignments
|
|
2613
|
+
* and should not appear in output schemas or LLM prompts.
|
|
2614
|
+
*/
|
|
2615
|
+
filterDuplicateKeys(schema) {
|
|
2616
|
+
return Object.entries(schema).reduce((acc, [key, value]) => {
|
|
2617
|
+
if (!key.includes('::cyDuplicateKey')) {
|
|
2618
|
+
acc[key] = value;
|
|
2619
|
+
}
|
|
2620
|
+
return acc;
|
|
2621
|
+
}, {});
|
|
1489
2622
|
}
|
|
1490
2623
|
getEquivalencies(scopeName) {
|
|
1491
2624
|
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName);
|
|
@@ -1496,7 +2629,9 @@ export class ScopeDataStructure {
|
|
|
1496
2629
|
if (this.equivalencyDatabaseCache.has(cacheKey)) {
|
|
1497
2630
|
return this.equivalencyDatabaseCache.get(cacheKey);
|
|
1498
2631
|
}
|
|
1499
|
-
|
|
2632
|
+
// PERF: Use inverted index for O(1) lookup instead of O(n) array scan
|
|
2633
|
+
// The intermediatesOrderIndex maps pathId (scopeNodeName::schemaPath) to entry
|
|
2634
|
+
const result = this.intermediatesOrderIndex.get(cacheKey);
|
|
1500
2635
|
this.equivalencyDatabaseCache.set(cacheKey, result);
|
|
1501
2636
|
return result;
|
|
1502
2637
|
}
|
|
@@ -1505,18 +2640,204 @@ export class ScopeDataStructure {
|
|
|
1505
2640
|
if (!scopeNode) {
|
|
1506
2641
|
return {};
|
|
1507
2642
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
2643
|
+
// Collect all descendant scope names (including the scope itself)
|
|
2644
|
+
// This ensures we include external calls from nested scopes like cyScope2
|
|
2645
|
+
const getAllDescendantScopeNames = (node) => {
|
|
2646
|
+
const names = new Set([node.name]);
|
|
2647
|
+
for (const child of node.children) {
|
|
2648
|
+
for (const name of getAllDescendantScopeNames(child)) {
|
|
2649
|
+
names.add(name);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
return names;
|
|
2653
|
+
};
|
|
2654
|
+
const treeNode = this.scopeTreeManager.findNode(scopeNode.name);
|
|
2655
|
+
const descendantScopeNames = treeNode
|
|
2656
|
+
? getAllDescendantScopeNames(treeNode)
|
|
2657
|
+
: new Set([scopeNode.name]);
|
|
2658
|
+
// Get all external function calls made from this scope or any descendant scope
|
|
2659
|
+
// This allows us to include prop equivalencies from JSX components
|
|
2660
|
+
// that were rendered in nested scopes (e.g., FileTableRow called from cyScope2)
|
|
2661
|
+
const externalCallsFromScope = this.externalFunctionCalls.filter((efc) => descendantScopeNames.has(efc.callScope));
|
|
2662
|
+
const externalCallNames = new Set(externalCallsFromScope.map((efc) => efc.name));
|
|
2663
|
+
// Helper to check if a usage belongs to this scope (directly, via descendant, or via external call)
|
|
2664
|
+
const usageMatchesScope = (usage) => descendantScopeNames.has(usage.scopeNodeName) ||
|
|
2665
|
+
externalCallNames.has(usage.scopeNodeName);
|
|
2666
|
+
const entries = this.equivalencyDatabase.filter((entry) => entry.usages.some(usageMatchesScope));
|
|
2667
|
+
// Helper to resolve a source candidate through equivalency chains to find signature paths
|
|
2668
|
+
const resolveToSignature = (source, visited) => {
|
|
2669
|
+
const visitKey = `${source.scopeNodeName}::${source.schemaPath}`;
|
|
2670
|
+
if (visited.has(visitKey))
|
|
2671
|
+
return [];
|
|
2672
|
+
visited.add(visitKey);
|
|
2673
|
+
// If already a signature path, return as-is
|
|
2674
|
+
if (source.schemaPath.startsWith('signature[')) {
|
|
2675
|
+
return [source];
|
|
2676
|
+
}
|
|
2677
|
+
const currentScope = this.scopeNodes[source.scopeNodeName];
|
|
2678
|
+
if (!currentScope?.equivalencies)
|
|
2679
|
+
return [source];
|
|
2680
|
+
// Check for direct equivalencies FIRST (full path match)
|
|
2681
|
+
// This ensures paths like "useMemo(...).functionCallReturnValue" follow to "cyScope1::returnValue"
|
|
2682
|
+
// before prefix matching tries "useMemo(...)" which goes to the useMemo scope
|
|
2683
|
+
const directEquivs = currentScope.equivalencies[source.schemaPath];
|
|
2684
|
+
if (directEquivs?.length > 0) {
|
|
2685
|
+
const results = [];
|
|
2686
|
+
for (const equiv of directEquivs) {
|
|
2687
|
+
const resolved = resolveToSignature({
|
|
2688
|
+
scopeNodeName: equiv.scopeNodeName,
|
|
2689
|
+
schemaPath: equiv.schemaPath,
|
|
2690
|
+
}, visited);
|
|
2691
|
+
results.push(...resolved);
|
|
2692
|
+
}
|
|
2693
|
+
if (results.length > 0)
|
|
2694
|
+
return results;
|
|
2695
|
+
}
|
|
2696
|
+
// Handle spread patterns like [...items].sort().functionCallReturnValue
|
|
2697
|
+
// Extract the spread variable and resolve it through the equivalency chain
|
|
2698
|
+
const spreadMatch = source.schemaPath.match(/^\[\.\.\.(\w+)\]/);
|
|
2699
|
+
if (spreadMatch) {
|
|
2700
|
+
const spreadVar = spreadMatch[1];
|
|
2701
|
+
const spreadPattern = spreadMatch[0];
|
|
2702
|
+
const varEquivs = currentScope.equivalencies[spreadVar];
|
|
2703
|
+
if (varEquivs?.length > 0) {
|
|
2704
|
+
const results = [];
|
|
2705
|
+
for (const equiv of varEquivs) {
|
|
2706
|
+
// Follow the variable equivalency and then resolve from there
|
|
2707
|
+
const resolvedVar = resolveToSignature({
|
|
2708
|
+
scopeNodeName: equiv.scopeNodeName,
|
|
2709
|
+
schemaPath: equiv.schemaPath,
|
|
2710
|
+
}, visited);
|
|
2711
|
+
// For each resolved variable path, create the full path with array element suffix
|
|
2712
|
+
for (const rv of resolvedVar) {
|
|
2713
|
+
if (rv.schemaPath.startsWith('signature[')) {
|
|
2714
|
+
// Get the suffix after the spread pattern
|
|
2715
|
+
let suffix = source.schemaPath.slice(spreadPattern.length);
|
|
2716
|
+
// Clean the suffix: strip array method chains like .sort(...).functionCallReturnValue[]
|
|
2717
|
+
// These don't change the data identity, just transform it.
|
|
2718
|
+
// Keep only the final element access parts like [0], [1], etc.
|
|
2719
|
+
// Pattern: strip everything from a method call up through functionCallReturnValue[]
|
|
2720
|
+
suffix = suffix.replace(/\.\w+\([^)]*\)\.functionCallReturnValue\[\]/g, '');
|
|
2721
|
+
// Also handle simpler case without nested parens
|
|
2722
|
+
suffix = suffix.replace(/\.sort\(\w*\(\)\)\.functionCallReturnValue\[\]/g, '');
|
|
2723
|
+
// Add [] to indicate array element access from the spread
|
|
2724
|
+
const resolvedPath = rv.schemaPath + '[]' + suffix;
|
|
2725
|
+
results.push({
|
|
2726
|
+
scopeNodeName: rv.scopeNodeName,
|
|
2727
|
+
schemaPath: resolvedPath,
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
if (results.length > 0)
|
|
2733
|
+
return results;
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
// Try to find prefix equivalencies that can resolve this path
|
|
2737
|
+
// For path like "cyScope3().signature[0][0]", check "cyScope3().signature[0]", etc.
|
|
2738
|
+
const pathParts = this.splitPath(source.schemaPath);
|
|
2739
|
+
for (let i = pathParts.length - 1; i > 0; i--) {
|
|
2740
|
+
const prefix = this.joinPathParts(pathParts.slice(0, i));
|
|
2741
|
+
const suffix = this.joinPathParts(pathParts.slice(i));
|
|
2742
|
+
const prefixEquivs = currentScope.equivalencies[prefix];
|
|
2743
|
+
if (prefixEquivs?.length > 0) {
|
|
2744
|
+
const results = [];
|
|
2745
|
+
for (const equiv of prefixEquivs) {
|
|
2746
|
+
const newPath = this.joinPathParts([equiv.schemaPath, suffix]);
|
|
2747
|
+
const resolved = resolveToSignature({ scopeNodeName: equiv.scopeNodeName, schemaPath: newPath }, visited);
|
|
2748
|
+
results.push(...resolved);
|
|
2749
|
+
}
|
|
2750
|
+
if (results.length > 0)
|
|
2751
|
+
return results;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
return [source];
|
|
2755
|
+
};
|
|
2756
|
+
const acc = entries.reduce((result, entry) => {
|
|
1510
2757
|
var _a;
|
|
1511
2758
|
if (entry.sourceCandidates.length === 0)
|
|
1512
|
-
return
|
|
1513
|
-
const usages = entry.usages.filter(
|
|
2759
|
+
return result;
|
|
2760
|
+
const usages = entry.usages.filter(usageMatchesScope);
|
|
1514
2761
|
for (const usage of usages) {
|
|
1515
|
-
|
|
1516
|
-
|
|
2762
|
+
result[_a = usage.schemaPath] || (result[_a] = []);
|
|
2763
|
+
// Resolve each source candidate through the equivalency chain
|
|
2764
|
+
for (const source of entry.sourceCandidates) {
|
|
2765
|
+
const resolvedSources = resolveToSignature(source, new Set());
|
|
2766
|
+
result[usage.schemaPath].push(...resolvedSources);
|
|
2767
|
+
}
|
|
1517
2768
|
}
|
|
1518
|
-
return
|
|
2769
|
+
return result;
|
|
1519
2770
|
}, {});
|
|
2771
|
+
// Post-processing: enrich useState-backed sources with co-located external
|
|
2772
|
+
// function calls. When a useState value resolves to a setter variable that
|
|
2773
|
+
// lives in the same scope as a fetch/API call, that fetch is a data source.
|
|
2774
|
+
this.enrichUseStateSourcesWithCoLocatedCalls(acc);
|
|
2775
|
+
return acc;
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* For each source that ends at a useState path, check if the setter was called
|
|
2779
|
+
* from a scope that also contains external function calls (like fetch).
|
|
2780
|
+
* If so, add those external calls as additional source candidates.
|
|
2781
|
+
*/
|
|
2782
|
+
enrichUseStateSourcesWithCoLocatedCalls(acc) {
|
|
2783
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
2784
|
+
const rootScope = this.scopeNodes[rootScopeName];
|
|
2785
|
+
if (!rootScope)
|
|
2786
|
+
return;
|
|
2787
|
+
// Collect all descendants for each scope node
|
|
2788
|
+
const getAllDescendants = (node) => {
|
|
2789
|
+
const names = new Set([node.name]);
|
|
2790
|
+
for (const child of node.children) {
|
|
2791
|
+
for (const name of getAllDescendants(child)) {
|
|
2792
|
+
names.add(name);
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
return names;
|
|
2796
|
+
};
|
|
2797
|
+
for (const [usagePath, sources] of Object.entries(acc)) {
|
|
2798
|
+
const additionalSources = [];
|
|
2799
|
+
for (const source of sources) {
|
|
2800
|
+
// Check if this source is a useState-related terminal path
|
|
2801
|
+
// (e.g., useState(X).functionCallReturnValue[1] or useState(X).signature[0])
|
|
2802
|
+
if (!source.schemaPath.match(/^useState\([^)]*\)\./))
|
|
2803
|
+
continue;
|
|
2804
|
+
// Find the useState call from the source path
|
|
2805
|
+
const useStateCallMatch = source.schemaPath.match(/^(useState\([^)]*\))\./);
|
|
2806
|
+
if (!useStateCallMatch)
|
|
2807
|
+
continue;
|
|
2808
|
+
const useStateCall = useStateCallMatch[1];
|
|
2809
|
+
// Look in the root scope for the useState value equivalency
|
|
2810
|
+
// which tells us where the setter was called from
|
|
2811
|
+
const valuePath = `${useStateCall}.functionCallReturnValue[0]`;
|
|
2812
|
+
const valueEquivs = rootScope.equivalencies[valuePath];
|
|
2813
|
+
if (!valueEquivs)
|
|
2814
|
+
continue;
|
|
2815
|
+
for (const equiv of valueEquivs) {
|
|
2816
|
+
// Find the scope where the setter was called
|
|
2817
|
+
const setterScopeName = equiv.scopeNodeName;
|
|
2818
|
+
const setterScopeTree = this.scopeTreeManager.findNode(setterScopeName);
|
|
2819
|
+
if (!setterScopeTree)
|
|
2820
|
+
continue;
|
|
2821
|
+
// Get all descendant scope names from the setter scope
|
|
2822
|
+
const relatedScopes = getAllDescendants(setterScopeTree);
|
|
2823
|
+
// Find external function calls in those scopes whose return values
|
|
2824
|
+
// are actually consumed (assigned to a variable). This excludes
|
|
2825
|
+
// fire-and-forget calls like analytics.track() or console.log().
|
|
2826
|
+
const coLocatedCalls = this.externalFunctionCalls.filter((efc) => relatedScopes.has(efc.callScope) &&
|
|
2827
|
+
efc.receivingVariableNames &&
|
|
2828
|
+
efc.receivingVariableNames.length > 0);
|
|
2829
|
+
for (const call of coLocatedCalls) {
|
|
2830
|
+
additionalSources.push({
|
|
2831
|
+
scopeNodeName: call.callScope,
|
|
2832
|
+
schemaPath: `${call.callSignature}.functionCallReturnValue`,
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
if (additionalSources.length > 0) {
|
|
2838
|
+
acc[usagePath].push(...additionalSources);
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
1520
2841
|
}
|
|
1521
2842
|
getUsageEquivalencies(functionName) {
|
|
1522
2843
|
const scopeNode = this.getScopeOrFunctionCallInfo(functionName);
|
|
@@ -1549,44 +2870,212 @@ export class ScopeDataStructure {
|
|
|
1549
2870
|
return acc;
|
|
1550
2871
|
}, {});
|
|
1551
2872
|
const equivalencies = this.getEquivalencies(functionName);
|
|
2873
|
+
const scopeName = functionName ?? this.scopeTreeManager.getRootName();
|
|
1552
2874
|
for (const equivalenceKey in equivalencies ?? {}) {
|
|
1553
2875
|
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
1554
2876
|
const schemaPath = equivalenceValue.schemaPath;
|
|
1555
2877
|
if (schemaPath.startsWith('signature[') &&
|
|
1556
|
-
equivalenceValue.scopeNodeName ===
|
|
2878
|
+
equivalenceValue.scopeNodeName === scopeName &&
|
|
1557
2879
|
!signatureInSchema[schemaPath]) {
|
|
1558
2880
|
signatureInSchema[schemaPath] = 'unknown';
|
|
1559
2881
|
}
|
|
1560
2882
|
}
|
|
1561
2883
|
}
|
|
1562
|
-
const tempScopeNode = this.createTempScopeNode(functionName ?? this.
|
|
2884
|
+
const tempScopeNode = this.createTempScopeNode(functionName ?? this.scopeTreeManager.getRootName(), signatureInSchema, equivalencies);
|
|
1563
2885
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
2886
|
+
// After validateSchema has filled in types, propagate nested paths from
|
|
2887
|
+
// variables to their signature equivalents.
|
|
2888
|
+
// e.g., workouts[].activity_type -> signature[0].workouts[].activity_type
|
|
2889
|
+
//
|
|
2890
|
+
// Build a map of variable names that are equivalent to signature paths
|
|
2891
|
+
// e.g., { 'workouts': 'signature[0].workouts' }
|
|
2892
|
+
const variableToSignatureMap = {};
|
|
2893
|
+
for (const equivalenceKey in equivalencies ?? {}) {
|
|
2894
|
+
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
2895
|
+
const schemaPath = equivalenceValue.schemaPath;
|
|
2896
|
+
// Track which variables map to signature paths
|
|
2897
|
+
// equivalenceKey is the variable name (e.g., 'workouts')
|
|
2898
|
+
// schemaPath is where it comes from (e.g., 'signature[0].workouts')
|
|
2899
|
+
if (schemaPath.startsWith('signature[') &&
|
|
2900
|
+
equivalenceValue.scopeNodeName === scopeName) {
|
|
2901
|
+
variableToSignatureMap[equivalenceKey] = schemaPath;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
// Enrich schema with deeply nested paths from internal function call scopes.
|
|
2906
|
+
// When a function call like traverse(tree) exists, and traverse's scope has
|
|
2907
|
+
// signature[0].children[path][entityName] (from propagateParameterToSignaturePaths),
|
|
2908
|
+
// we need to map those paths back to the argument variable (tree) in this scope.
|
|
2909
|
+
// This handles cases where cycle detection prevented the equivalency chain from
|
|
2910
|
+
// propagating deep paths during Phase 2 batch queue processing.
|
|
2911
|
+
for (const equivalenceKey in equivalencies ?? {}) {
|
|
2912
|
+
// Look for keys matching function call pattern: funcName(...).signature[N]
|
|
2913
|
+
const funcCallMatch = equivalenceKey.match(/^([^(]+)\(.*?\)\.(signature\[\d+\])$/);
|
|
2914
|
+
if (!funcCallMatch)
|
|
2915
|
+
continue;
|
|
2916
|
+
const calledFunctionName = funcCallMatch[1];
|
|
2917
|
+
const signatureParam = funcCallMatch[2]; // e.g., "signature[0]"
|
|
2918
|
+
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
2919
|
+
if (equivalenceValue.scopeNodeName !== scopeName)
|
|
2920
|
+
continue;
|
|
2921
|
+
const targetVariable = equivalenceValue.schemaPath;
|
|
2922
|
+
// Get the called function's schema (includes propagated parameter paths)
|
|
2923
|
+
const childSchema = this.getSchema({
|
|
2924
|
+
scopeName: calledFunctionName,
|
|
2925
|
+
});
|
|
2926
|
+
if (!childSchema)
|
|
2927
|
+
continue;
|
|
2928
|
+
// Map child function's signature paths to parent variable paths
|
|
2929
|
+
const sigPrefix = signatureParam + '.';
|
|
2930
|
+
const sigBracketPrefix = signatureParam + '[';
|
|
2931
|
+
for (const childKey in childSchema) {
|
|
2932
|
+
let suffix = null;
|
|
2933
|
+
if (childKey.startsWith(sigPrefix)) {
|
|
2934
|
+
suffix = childKey.slice(signatureParam.length);
|
|
2935
|
+
}
|
|
2936
|
+
else if (childKey.startsWith(sigBracketPrefix)) {
|
|
2937
|
+
suffix = childKey.slice(signatureParam.length);
|
|
2938
|
+
}
|
|
2939
|
+
if (suffix !== null) {
|
|
2940
|
+
const parentKey = targetVariable + suffix;
|
|
2941
|
+
if (!schema[parentKey]) {
|
|
2942
|
+
schema[parentKey] = childSchema[childKey];
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
// Helper: check if a type is a concrete scalar that cannot have sub-properties.
|
|
2949
|
+
// e.g., "string", "number | undefined", "boolean | null" are scalar.
|
|
2950
|
+
// "object", "array", "function", "unknown", "Workout", etc. are NOT scalar.
|
|
2951
|
+
const SCALAR_TYPES = new Set([
|
|
2952
|
+
'string',
|
|
2953
|
+
'number',
|
|
2954
|
+
'boolean',
|
|
2955
|
+
'bigint',
|
|
2956
|
+
'symbol',
|
|
2957
|
+
'void',
|
|
2958
|
+
'never',
|
|
2959
|
+
]);
|
|
2960
|
+
const isDefinitelyScalarType = (type) => {
|
|
2961
|
+
const parts = type.split('|').map((s) => s.trim());
|
|
2962
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
2963
|
+
return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
|
|
2964
|
+
};
|
|
2965
|
+
// Propagate nested paths from variables to their signature equivalents
|
|
2966
|
+
// e.g., if workouts = signature[0].workouts, then workouts[].title becomes
|
|
2967
|
+
// signature[0].workouts[].title
|
|
2968
|
+
for (const schemaKey in schema) {
|
|
2969
|
+
// Skip keys that already start with signature[
|
|
2970
|
+
if (schemaKey.startsWith('signature['))
|
|
2971
|
+
continue;
|
|
2972
|
+
// Check if this key starts with a variable that maps to a signature path
|
|
2973
|
+
for (const [variableName, signaturePath] of Object.entries(variableToSignatureMap)) {
|
|
2974
|
+
// Check if schemaKey starts with variableName followed by a property accessor
|
|
2975
|
+
// e.g., 'workouts[]' starts with 'workouts'
|
|
2976
|
+
if (schemaKey === variableName ||
|
|
2977
|
+
schemaKey.startsWith(variableName + '.') ||
|
|
2978
|
+
schemaKey.startsWith(variableName + '[')) {
|
|
2979
|
+
// Transform the path: replace the variable prefix with the signature path
|
|
2980
|
+
const suffix = schemaKey.slice(variableName.length);
|
|
2981
|
+
const signatureKey = signaturePath + suffix;
|
|
2982
|
+
// Add to schema if not already present
|
|
2983
|
+
if (!tempScopeNode.schema[signatureKey]) {
|
|
2984
|
+
// Check if this path represents variable conflation:
|
|
2985
|
+
// When a standalone variable (e.g., showWorkoutForm from useState)
|
|
2986
|
+
// appears as a sub-property of a scalar-typed ancestor (e.g.,
|
|
2987
|
+
// activity_type = "string"), it's from scope conflation, not real
|
|
2988
|
+
// property access. Block these while allowing legitimate built-in
|
|
2989
|
+
// accesses like string.length or string.slice.
|
|
2990
|
+
let isConflatedPath = false;
|
|
2991
|
+
let checkPos = signaturePath.length;
|
|
2992
|
+
while (true) {
|
|
2993
|
+
checkPos = signatureKey.indexOf('.', checkPos + 1);
|
|
2994
|
+
if (checkPos === -1)
|
|
2995
|
+
break;
|
|
2996
|
+
const ancestorPath = signatureKey.substring(0, checkPos);
|
|
2997
|
+
const ancestorType = tempScopeNode.schema[ancestorPath];
|
|
2998
|
+
if (ancestorType && isDefinitelyScalarType(ancestorType)) {
|
|
2999
|
+
// Ancestor is scalar — check if the immediate sub-property
|
|
3000
|
+
// is also a standalone variable (indicating conflation)
|
|
3001
|
+
const afterDot = signatureKey.substring(checkPos + 1);
|
|
3002
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
3003
|
+
const subPropName = nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
|
|
3004
|
+
if (schema[subPropName] !== undefined) {
|
|
3005
|
+
isConflatedPath = true;
|
|
3006
|
+
break;
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
if (!isConflatedPath) {
|
|
3011
|
+
tempScopeNode.schema[signatureKey] = schema[schemaKey];
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
// Post-process: filter out conflated signature paths.
|
|
3018
|
+
// During phase 2 scope analysis, useState(false) conflation can create
|
|
3019
|
+
// bad paths like signature[0].mockWorkouts[].activity_type.showWorkoutForm
|
|
3020
|
+
// directly in scopeNode.schema. These flow through signatureInSchema into
|
|
3021
|
+
// tempScopeNode.schema without any guard. Filter them out here by checking:
|
|
3022
|
+
// 1. An ancestor in the path has a concrete scalar type (string, number, boolean, etc.)
|
|
3023
|
+
// 2. The immediate sub-property of that scalar ancestor is also a standalone
|
|
3024
|
+
// variable in the schema (indicating conflation, not a real property access)
|
|
3025
|
+
for (const key of Object.keys(tempScopeNode.schema)) {
|
|
3026
|
+
if (!key.startsWith('signature['))
|
|
3027
|
+
continue;
|
|
3028
|
+
// Walk through the path looking for scalar-typed ancestors
|
|
3029
|
+
let pos = 0;
|
|
3030
|
+
while (true) {
|
|
3031
|
+
pos = key.indexOf('.', pos + 1);
|
|
3032
|
+
if (pos === -1)
|
|
3033
|
+
break;
|
|
3034
|
+
const ancestorPath = key.substring(0, pos);
|
|
3035
|
+
const ancestorType = tempScopeNode.schema[ancestorPath];
|
|
3036
|
+
if (ancestorType && isDefinitelyScalarType(ancestorType)) {
|
|
3037
|
+
// Found a scalar ancestor — check if the sub-property name
|
|
3038
|
+
// is a standalone variable in the getSchema() result
|
|
3039
|
+
const afterDot = key.substring(pos + 1);
|
|
3040
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
3041
|
+
const subPropName = nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
|
|
3042
|
+
if (schema[subPropName] !== undefined) {
|
|
3043
|
+
delete tempScopeNode.schema[key];
|
|
3044
|
+
break;
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
return this.filterDuplicateKeys(tempScopeNode.schema);
|
|
3050
|
+
}
|
|
3051
|
+
getReturnValue({ functionName, fillInUnknowns, }) {
|
|
3052
|
+
// Trigger finalization on all managers to apply any pending updates
|
|
3053
|
+
// (e.g., ref type propagation to external function call schemas)
|
|
3054
|
+
const rootScope = this.scopeNodes[this.scopeTreeManager.getRootName()];
|
|
3055
|
+
if (rootScope) {
|
|
3056
|
+
for (const manager of this.equivalencyManagers) {
|
|
3057
|
+
manager.finalize(rootScope, this);
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
const scopeName = functionName ?? this.scopeTreeManager.getRootName();
|
|
3061
|
+
const scopeNode = this.scopeNodes[scopeName];
|
|
3062
|
+
let schema = {};
|
|
3063
|
+
if (scopeNode) {
|
|
3064
|
+
schema = this.resolvePathIntoSchema({
|
|
3065
|
+
path: 'returnValue',
|
|
3066
|
+
scopeNode: scopeNode,
|
|
3067
|
+
});
|
|
1575
3068
|
}
|
|
1576
3069
|
else {
|
|
1577
|
-
|
|
3070
|
+
// Use getExternalFunctionCalls() which cleans cyScope from schemas
|
|
3071
|
+
for (const externalFunctionCall of this.getExternalFunctionCalls()) {
|
|
1578
3072
|
const functionNameParts = this.splitPath(functionName).map((p) => this.functionOrScopeName(p));
|
|
1579
3073
|
const nameParts = this.splitPath(externalFunctionCall.name).map((p) => this.functionOrScopeName(p));
|
|
1580
3074
|
if (functionNameParts.every((part, index) => part === nameParts[index])) {
|
|
1581
3075
|
for (const schemaPath in externalFunctionCall.schema) {
|
|
1582
3076
|
const value1 = schema[schemaPath];
|
|
1583
3077
|
const value2 = externalFunctionCall.schema[schemaPath];
|
|
1584
|
-
|
|
1585
|
-
if (bestValue === 'unknown' ||
|
|
1586
|
-
(bestValue.includes('unknown') && !value2.includes('unknown'))) {
|
|
1587
|
-
bestValue = value2;
|
|
1588
|
-
}
|
|
1589
|
-
schema[schemaPath] = bestValue;
|
|
3078
|
+
schema[schemaPath] = selectBestValue(value1, value2, value2);
|
|
1590
3079
|
}
|
|
1591
3080
|
}
|
|
1592
3081
|
}
|
|
@@ -1600,14 +3089,27 @@ export class ScopeDataStructure {
|
|
|
1600
3089
|
// Include function paths even if their return value wasn't captured
|
|
1601
3090
|
// This ensures methods like onAuthStateChange are included in the schema
|
|
1602
3091
|
// But exclude signature entries (they should only be included via functionCallReturnValue paths)
|
|
1603
|
-
|
|
3092
|
+
// Also exclude bare function call signatures - paths that are JUST a call like
|
|
3093
|
+
// "useCustomSizes(projectSlug)" should not be included as return values.
|
|
3094
|
+
// These represent "the function exists" not actual return data, and including
|
|
3095
|
+
// them causes nested path bugs in dependencySchemas.
|
|
3096
|
+
(schema[key] === 'function' &&
|
|
3097
|
+
key.indexOf('signature[') === -1 &&
|
|
3098
|
+
// Exclude bare call signatures: function calls with no dots OUTSIDE parentheses
|
|
3099
|
+
// e.g., "useCustomSizes(projectSlug)" is bare (exclude)
|
|
3100
|
+
// e.g., "loadProject({nested.property})" is bare - dots are inside args (exclude)
|
|
3101
|
+
// e.g., "getSupabase().auth.method()" has dots outside - method chain (include)
|
|
3102
|
+
!this.isBareCallSignature(key)))
|
|
1604
3103
|
.reduce((acc, key) => {
|
|
1605
3104
|
acc[key] = schema[key];
|
|
1606
3105
|
const keyParts = this.splitPath(key);
|
|
1607
3106
|
for (const path in schema) {
|
|
1608
3107
|
const pathParts = this.splitPath(path);
|
|
1609
3108
|
if (pathParts.every((p, i) => keyParts[i] === p)) {
|
|
1610
|
-
|
|
3109
|
+
// Also exclude bare call signatures from prefix paths
|
|
3110
|
+
if (!this.isBareCallSignature(path)) {
|
|
3111
|
+
acc[path] = schema[path];
|
|
3112
|
+
}
|
|
1611
3113
|
}
|
|
1612
3114
|
}
|
|
1613
3115
|
return acc;
|
|
@@ -1615,12 +3117,68 @@ export class ScopeDataStructure {
|
|
|
1615
3117
|
// Replace cyScope placeholders with actual callback text
|
|
1616
3118
|
const resolvedSchema = this.replaceCyScopePlaceholders(returnValueSchema);
|
|
1617
3119
|
const tempScopeNode = this.createTempScopeNode(scopeName, resolvedSchema);
|
|
3120
|
+
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
3121
|
+
// during this "getter" method. See comment in getFunctionSignature.
|
|
3122
|
+
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
3123
|
+
this.onlyEquivalencies = true;
|
|
1618
3124
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
1619
|
-
|
|
3125
|
+
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
3126
|
+
// Remove bare call signatures from the return value schema.
|
|
3127
|
+
// fillInSchemaGapsAndUnknowns may add parent paths like "useCustomSizes(projectSlug)"
|
|
3128
|
+
// when it sees "useCustomSizes(projectSlug).functionCallReturnValue". These bare
|
|
3129
|
+
// call signatures represent "the function exists" not actual return data, and
|
|
3130
|
+
// including them causes nested path bugs in dependencySchemas.
|
|
3131
|
+
const resultSchema = tempScopeNode.schema;
|
|
3132
|
+
for (const key of Object.keys(resultSchema)) {
|
|
3133
|
+
if (this.isBareCallSignature(key)) {
|
|
3134
|
+
delete resultSchema[key];
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
return resultSchema;
|
|
3138
|
+
}
|
|
3139
|
+
/**
|
|
3140
|
+
* Checks if a schema key is a "bare call signature" - a function call with no
|
|
3141
|
+
* method chain before it and no path segments after it.
|
|
3142
|
+
*
|
|
3143
|
+
* A bare call signature represents "this function exists" rather than actual
|
|
3144
|
+
* return data, and including them causes nested path bugs in dependencySchemas.
|
|
3145
|
+
*
|
|
3146
|
+
* Examples:
|
|
3147
|
+
* - "useCustomSizes(projectSlug)" -> bare (true)
|
|
3148
|
+
* - "loadProject({nested.property})" -> bare (dots are inside args, true)
|
|
3149
|
+
* - "getSupabase().auth.method()" -> not bare (has dots outside parens, false)
|
|
3150
|
+
* - "useProject().functionCallReturnValue" -> not bare (has path after, false)
|
|
3151
|
+
*/
|
|
3152
|
+
isBareCallSignature(key) {
|
|
3153
|
+
// Must end with ) and contain ( to be a call
|
|
3154
|
+
if (!key.endsWith(')') || key.indexOf('(') === -1) {
|
|
3155
|
+
return false;
|
|
3156
|
+
}
|
|
3157
|
+
// Check if there are any dots OUTSIDE of parentheses
|
|
3158
|
+
// Strip out content inside balanced parentheses, then check for dots
|
|
3159
|
+
let depth = 0;
|
|
3160
|
+
let hasDotsOutsideParens = false;
|
|
3161
|
+
for (let i = 0; i < key.length; i++) {
|
|
3162
|
+
const char = key[i];
|
|
3163
|
+
if (char === '(') {
|
|
3164
|
+
depth++;
|
|
3165
|
+
}
|
|
3166
|
+
else if (char === ')') {
|
|
3167
|
+
depth--;
|
|
3168
|
+
}
|
|
3169
|
+
else if (char === '.' && depth === 0) {
|
|
3170
|
+
hasDotsOutsideParens = true;
|
|
3171
|
+
break;
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
// It's a bare call signature if there are no dots outside parentheses
|
|
3175
|
+
return !hasDotsOutsideParens;
|
|
1620
3176
|
}
|
|
1621
3177
|
/**
|
|
1622
3178
|
* Replaces cyScope placeholder references (e.g., cyScope10()) in schema keys
|
|
1623
3179
|
* with the actual callback function text from the corresponding scope node.
|
|
3180
|
+
* If the scope text can't be found, uses a generic fallback to avoid leaking
|
|
3181
|
+
* internal cyScope names into stored data.
|
|
1624
3182
|
*/
|
|
1625
3183
|
replaceCyScopePlaceholders(schema) {
|
|
1626
3184
|
const cyScopePattern = /cyScope(\d+)\(\)/g;
|
|
@@ -1632,10 +3190,10 @@ export class ScopeDataStructure {
|
|
|
1632
3190
|
for (const match of matches) {
|
|
1633
3191
|
const cyScopeName = `cyScope${match[1]}`;
|
|
1634
3192
|
const scopeText = this.findCyScopeText(cyScopeName);
|
|
1635
|
-
if
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
3193
|
+
// Always replace cyScope references - use actual text if available,
|
|
3194
|
+
// otherwise use a generic callback placeholder
|
|
3195
|
+
const replacement = scopeText || '() => {}';
|
|
3196
|
+
newKey = newKey.replace(match[0], replacement);
|
|
1639
3197
|
}
|
|
1640
3198
|
result[newKey] = value;
|
|
1641
3199
|
}
|
|
@@ -1683,19 +3241,378 @@ export class ScopeDataStructure {
|
|
|
1683
3241
|
return scopeText;
|
|
1684
3242
|
}
|
|
1685
3243
|
getEquivalentSignatureVariables() {
|
|
1686
|
-
const scopeNode = this.scopeNodes[this.
|
|
3244
|
+
const scopeNode = this.scopeNodes[this.scopeTreeManager.getRootName()];
|
|
1687
3245
|
const equivalentSignatureVariables = {};
|
|
3246
|
+
// Helper to add equivalencies - accumulates into array if multiple values for same key
|
|
3247
|
+
// This is critical for OR expressions like `x = a || b` where x should map to both a and b
|
|
3248
|
+
const addEquivalency = (key, value) => {
|
|
3249
|
+
const existing = equivalentSignatureVariables[key];
|
|
3250
|
+
if (existing === undefined) {
|
|
3251
|
+
// First value - store as string
|
|
3252
|
+
equivalentSignatureVariables[key] = value;
|
|
3253
|
+
}
|
|
3254
|
+
else if (typeof existing === 'string') {
|
|
3255
|
+
if (existing !== value) {
|
|
3256
|
+
// Second different value - convert to array
|
|
3257
|
+
equivalentSignatureVariables[key] = [existing, value];
|
|
3258
|
+
}
|
|
3259
|
+
// Same value - no change needed
|
|
3260
|
+
}
|
|
3261
|
+
else {
|
|
3262
|
+
// Already an array - add if not already present
|
|
3263
|
+
if (!existing.includes(value)) {
|
|
3264
|
+
existing.push(value);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
};
|
|
1688
3268
|
for (const [path, equivalentValues] of Object.entries(scopeNode.equivalencies)) {
|
|
1689
3269
|
for (const equivalentValue of equivalentValues) {
|
|
3270
|
+
// Case 1: Props/signature equivalencies (existing behavior)
|
|
3271
|
+
// Maps local variable names to their signature paths
|
|
3272
|
+
// e.g., "propValue" -> "signature[0].prop"
|
|
1690
3273
|
if (path.startsWith('signature[')) {
|
|
1691
|
-
|
|
3274
|
+
addEquivalency(equivalentValue.schemaPath, path);
|
|
3275
|
+
}
|
|
3276
|
+
// Case 2: Hook variable equivalencies (new behavior)
|
|
3277
|
+
// The equivalencies are stored as: path = variable name, schemaPath = data source
|
|
3278
|
+
// e.g., path = "debugFetcher", schemaPath = "useFetcher<...>().functionCallReturnValue"
|
|
3279
|
+
// We need to map: "debugFetcher" -> "useFetcher<...>()"
|
|
3280
|
+
// This enables resolving paths like "debugFetcher.state" to
|
|
3281
|
+
// "useFetcher<...>().state" for execution flow validation
|
|
3282
|
+
if (equivalentValue.schemaPath.endsWith('.functionCallReturnValue')) {
|
|
3283
|
+
// Extract the hook call path (everything before .functionCallReturnValue)
|
|
3284
|
+
let hookCallPath = equivalentValue.schemaPath.slice(0, -'.functionCallReturnValue'.length);
|
|
3285
|
+
// Only include if it looks like a hook call (contains parentheses)
|
|
3286
|
+
// and the variable name (path) is a simple identifier (no dots)
|
|
3287
|
+
if (hookCallPath.includes('(') && !path.includes('.')) {
|
|
3288
|
+
// Special case: If hookCallPath is a callback scope (cyScope pattern),
|
|
3289
|
+
// trace through it to find what the callback actually returns.
|
|
3290
|
+
// This handles useState(() => { return prop; }) patterns.
|
|
3291
|
+
const cyScopeMatch = hookCallPath.match(/^(cyScope\d+)\(\)$/);
|
|
3292
|
+
if (cyScopeMatch) {
|
|
3293
|
+
// Use the equivalency database to trace the callback's return value
|
|
3294
|
+
// to its actual source (e.g., viewModeFromUrl -> segments -> params -> useParams)
|
|
3295
|
+
const dbEntry = this.getEquivalenciesDatabaseEntry(scopeNode.name, // Component scope
|
|
3296
|
+
path);
|
|
3297
|
+
if (dbEntry?.sourceCandidates?.length > 0) {
|
|
3298
|
+
// Use the traced source instead of the callback scope
|
|
3299
|
+
hookCallPath = dbEntry.sourceCandidates[0].schemaPath;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
addEquivalency(path, hookCallPath);
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
// Case 3: Destructured variables from local variables
|
|
3306
|
+
// e.g., const { scenarios } = currentEntityAnalysis;
|
|
3307
|
+
// This creates: path = "scenarios", schemaPath = "currentEntityAnalysis.scenarios"
|
|
3308
|
+
// We need to map: "scenarios" -> "currentEntityAnalysis.scenarios"
|
|
3309
|
+
// AND resolve transitively if currentEntityAnalysis is itself equivalent to a hook call
|
|
3310
|
+
if (!path.includes('.') && // path is a simple identifier
|
|
3311
|
+
!equivalentValue.schemaPath.startsWith('signature[') && // not a signature path
|
|
3312
|
+
!equivalentValue.schemaPath.endsWith('.functionCallReturnValue') // not already handled above
|
|
3313
|
+
) {
|
|
3314
|
+
// Skip bare "returnValue" from child scopes — this is the child's return value,
|
|
3315
|
+
// not a meaningful data source path in the parent scope
|
|
3316
|
+
if (equivalentValue.schemaPath === 'returnValue' &&
|
|
3317
|
+
equivalentValue.scopeNodeName !==
|
|
3318
|
+
this.scopeTreeManager.getRootName()) {
|
|
3319
|
+
continue;
|
|
3320
|
+
}
|
|
3321
|
+
// Add equivalency (will accumulate if multiple values for OR expressions)
|
|
3322
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3323
|
+
}
|
|
3324
|
+
// Case 4: Child component prop mappings (Fix 22)
|
|
3325
|
+
// When parent renders <ChildComponent prop={value} />, we get equivalencies like:
|
|
3326
|
+
// path = "ChildComponent().signature[0].prop"
|
|
3327
|
+
// schemaPath = "value" (the variable passed as the prop)
|
|
3328
|
+
// We need to include these so translateChildPathToParent can work.
|
|
3329
|
+
// Pattern: ComponentName().signature[N] or ComponentName().signature[N].propName
|
|
3330
|
+
if (path.includes('().signature[') &&
|
|
3331
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable, not a function call
|
|
3332
|
+
) {
|
|
3333
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3334
|
+
}
|
|
3335
|
+
// Case 5: Destructured function parameters (Fix 25)
|
|
3336
|
+
// When a function has destructured props: function Comp({ propA, propB }: Props)
|
|
3337
|
+
// We get equivalencies like:
|
|
3338
|
+
// path = "propA" (the destructured variable name)
|
|
3339
|
+
// schemaPath = "signature[0].propA" (the signature path)
|
|
3340
|
+
// We need to map: "propA" -> "signature[0].propA"
|
|
3341
|
+
// This enables translateChildPathToParent to resolve child variable paths
|
|
3342
|
+
// to their signature paths when merging execution flows.
|
|
3343
|
+
if (!path.includes('.') && // path is a simple identifier (destructured prop name)
|
|
3344
|
+
equivalentValue.schemaPath.startsWith('signature[') // schemaPath IS a signature path
|
|
3345
|
+
) {
|
|
3346
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3347
|
+
}
|
|
3348
|
+
// Case 7: Method calls on variables that result in .functionCallReturnValue (Fix 33)
|
|
3349
|
+
// When we have patterns like:
|
|
3350
|
+
// path = "segments" (simple identifier)
|
|
3351
|
+
// schemaPath = "splat.split('/').functionCallReturnValue"
|
|
3352
|
+
// This is a method call on a variable (not a hook call), but we still need to
|
|
3353
|
+
// track it so transitive resolution can resolve `splat` to its actual source.
|
|
3354
|
+
// E.g., if splat -> useParams().functionCallReturnValue['*'], then
|
|
3355
|
+
// segments -> useParams().functionCallReturnValue['*'].split('/').functionCallReturnValue
|
|
3356
|
+
if (!path.includes('.') && // path is a simple identifier
|
|
3357
|
+
equivalentValue.schemaPath.endsWith('.functionCallReturnValue') && // ends with function return
|
|
3358
|
+
equivalentValue.schemaPath.includes('.') // has property access (method call)
|
|
3359
|
+
) {
|
|
3360
|
+
// Check if this looks like a method call on a variable (not a hook call)
|
|
3361
|
+
// Hook calls look like: hookName() or hookName<T>()
|
|
3362
|
+
// Method calls look like: variable.method() or variable.method<T>()
|
|
3363
|
+
const hookCallPath = equivalentValue.schemaPath.slice(0, -'.functionCallReturnValue'.length);
|
|
3364
|
+
// If it's a method call (contains a dot before the parenthesis), include it
|
|
3365
|
+
const dotBeforeParen = hookCallPath.indexOf('.');
|
|
3366
|
+
const parenPos = hookCallPath.indexOf('(');
|
|
3367
|
+
if (dotBeforeParen !== -1 && dotBeforeParen < parenPos) {
|
|
3368
|
+
// This is a method call like "splat.split('/')", not a hook call
|
|
3369
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
// Case 6: Collect JSX child prop equivalencies from child scopes (Fix 26)
|
|
3375
|
+
// When a parent component renders <ChildComponent prop={value} />, the JSX
|
|
3376
|
+
// return statement may be in a child scope (e.g., cyScope2). The equivalencies
|
|
3377
|
+
// like ChildComponent().signature[0].prop -> value get stored in that child scope.
|
|
3378
|
+
// But translateChildPathToParent needs to find them from the parent scope's context.
|
|
3379
|
+
// So we collect Case 4 patterns from ALL child scopes that belong to this root scope.
|
|
3380
|
+
const rootName = this.scopeTreeManager.getRootName();
|
|
3381
|
+
for (const [scopeName, childScopeNode] of Object.entries(this.scopeNodes)) {
|
|
3382
|
+
// Skip the root scope (already processed above)
|
|
3383
|
+
if (scopeName === rootName)
|
|
3384
|
+
continue;
|
|
3385
|
+
// Only include scopes that are children of the root (their tree includes root)
|
|
3386
|
+
if (!childScopeNode.tree?.includes(rootName))
|
|
3387
|
+
continue;
|
|
3388
|
+
// Look for Case 4 patterns in the child scope
|
|
3389
|
+
for (const [path, equivalentValues] of Object.entries(childScopeNode.equivalencies || {})) {
|
|
3390
|
+
for (const equivalentValue of equivalentValues) {
|
|
3391
|
+
// Case 4 pattern: ChildComponent().signature[0].propName -> parentVariable
|
|
3392
|
+
if (path.includes('().signature[') &&
|
|
3393
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable
|
|
3394
|
+
) {
|
|
3395
|
+
// Only add if not already present from the root scope
|
|
3396
|
+
// Root scope values take precedence over child scope values
|
|
3397
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
3398
|
+
addEquivalency(path, equivalentValue.schemaPath);
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
// Transitive resolution: Resolve variable chains through multiple levels
|
|
3405
|
+
// E.g., analysis → currentEntityAnalysis → useLoaderData().functionCallReturnValue.currentEntityAnalysis
|
|
3406
|
+
// We need multiple passes because resolutions can depend on each other
|
|
3407
|
+
const maxIterations = 5; // Prevent infinite loops
|
|
3408
|
+
// Helper function to resolve a single source path using equivalencies
|
|
3409
|
+
const resolveSourcePath = (sourcePath, equivMap) => {
|
|
3410
|
+
// Extract base variable from the path
|
|
3411
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
3412
|
+
const bracketIndex = sourcePath.indexOf('[');
|
|
3413
|
+
let baseVar;
|
|
3414
|
+
let rest;
|
|
3415
|
+
if (dotIndex === -1 && bracketIndex === -1) {
|
|
3416
|
+
baseVar = sourcePath;
|
|
3417
|
+
rest = '';
|
|
3418
|
+
}
|
|
3419
|
+
else if (dotIndex === -1) {
|
|
3420
|
+
baseVar = sourcePath.slice(0, bracketIndex);
|
|
3421
|
+
rest = sourcePath.slice(bracketIndex);
|
|
3422
|
+
}
|
|
3423
|
+
else if (bracketIndex === -1) {
|
|
3424
|
+
baseVar = sourcePath.slice(0, dotIndex);
|
|
3425
|
+
rest = sourcePath.slice(dotIndex);
|
|
3426
|
+
}
|
|
3427
|
+
else {
|
|
3428
|
+
const firstIndex = Math.min(dotIndex, bracketIndex);
|
|
3429
|
+
baseVar = sourcePath.slice(0, firstIndex);
|
|
3430
|
+
rest = sourcePath.slice(firstIndex);
|
|
3431
|
+
}
|
|
3432
|
+
// Look up the base variable in equivalencies
|
|
3433
|
+
if (baseVar in equivMap && equivMap[baseVar] !== sourcePath) {
|
|
3434
|
+
const baseResolved = equivMap[baseVar];
|
|
3435
|
+
// Skip if baseResolved is an array (handle later)
|
|
3436
|
+
if (Array.isArray(baseResolved))
|
|
3437
|
+
return null;
|
|
3438
|
+
// If it resolves to a signature path, build the full resolved path
|
|
3439
|
+
if (baseResolved.startsWith('signature[') ||
|
|
3440
|
+
baseResolved.includes('()')) {
|
|
3441
|
+
if (baseResolved.endsWith('()')) {
|
|
3442
|
+
return baseResolved + '.functionCallReturnValue' + rest;
|
|
3443
|
+
}
|
|
3444
|
+
return baseResolved + rest;
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
return null;
|
|
3448
|
+
};
|
|
3449
|
+
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
3450
|
+
let changed = false;
|
|
3451
|
+
for (const [varName, sourcePathOrArray] of Object.entries(equivalentSignatureVariables)) {
|
|
3452
|
+
// Handle arrays (OR expressions) by resolving each element
|
|
3453
|
+
if (Array.isArray(sourcePathOrArray)) {
|
|
3454
|
+
const resolvedArray = [];
|
|
3455
|
+
let arrayChanged = false;
|
|
3456
|
+
for (const sourcePath of sourcePathOrArray) {
|
|
3457
|
+
// Try to resolve this path using transitive resolution
|
|
3458
|
+
const resolved = resolveSourcePath(sourcePath, equivalentSignatureVariables);
|
|
3459
|
+
if (resolved && resolved !== sourcePath) {
|
|
3460
|
+
resolvedArray.push(resolved);
|
|
3461
|
+
arrayChanged = true;
|
|
3462
|
+
}
|
|
3463
|
+
else {
|
|
3464
|
+
resolvedArray.push(sourcePath);
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
if (arrayChanged) {
|
|
3468
|
+
equivalentSignatureVariables[varName] = resolvedArray;
|
|
3469
|
+
changed = true;
|
|
3470
|
+
}
|
|
3471
|
+
continue;
|
|
3472
|
+
}
|
|
3473
|
+
const sourcePath = sourcePathOrArray;
|
|
3474
|
+
// Skip if already fully resolved (contains function call syntax)
|
|
3475
|
+
// BUT first check for computed value patterns that need resolution (Fix 28)
|
|
3476
|
+
// AND method call patterns that need base variable resolution (Fix 33)
|
|
3477
|
+
if (sourcePath.includes('()')) {
|
|
3478
|
+
// Fix 28: Handle computed value patterns with dependency arrays
|
|
3479
|
+
// Patterns like `functionName(arg, [dep1, dep2, ...])` are NOT controllable
|
|
3480
|
+
// data sources. We trace through the dependencies to find controllable sources.
|
|
3481
|
+
const bracketStart = sourcePath.indexOf('[');
|
|
3482
|
+
const bracketEnd = sourcePath.lastIndexOf(']');
|
|
3483
|
+
if (bracketStart !== -1 && bracketEnd > bracketStart) {
|
|
3484
|
+
const arrayContent = sourcePath.slice(bracketStart + 1, bracketEnd);
|
|
3485
|
+
const items = arrayContent.split(',').map((s) => s.trim());
|
|
3486
|
+
// Only process if this looks like a dependency array:
|
|
3487
|
+
// multiple items that are all simple identifiers (not numbers or expressions)
|
|
3488
|
+
const isIdentifier = (s) => /^\w+$/.test(s) && !/^\d+$/.test(s);
|
|
3489
|
+
if (items.length > 1 && items.every(isIdentifier)) {
|
|
3490
|
+
// Look for a dependency that's already resolved to a controllable source
|
|
3491
|
+
for (const dep of items) {
|
|
3492
|
+
if (dep in equivalentSignatureVariables) {
|
|
3493
|
+
const resolvedDep = equivalentSignatureVariables[dep];
|
|
3494
|
+
// Use if it's a controllable path (contains hook call)
|
|
3495
|
+
// and is NOT another unresolved computed pattern (has comma-separated deps)
|
|
3496
|
+
const hasCommaInBrackets = resolvedDep.includes('[') &&
|
|
3497
|
+
resolvedDep.includes(',') &&
|
|
3498
|
+
resolvedDep.indexOf(',') > resolvedDep.indexOf('[');
|
|
3499
|
+
if (resolvedDep.includes('()') && !hasCommaInBrackets) {
|
|
3500
|
+
// Computed value is typically an element from an array
|
|
3501
|
+
equivalentSignatureVariables[varName] = resolvedDep + '[]';
|
|
3502
|
+
changed = true;
|
|
3503
|
+
break;
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
// Fix 33: Handle method call patterns on variables
|
|
3510
|
+
// Patterns like: "splat.split('/').functionCallReturnValue"
|
|
3511
|
+
// We need to resolve the base variable (splat) to its actual source
|
|
3512
|
+
// Check if this is a method call on a variable (dot before first parenthesis)
|
|
3513
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
3514
|
+
const parenIndex = sourcePath.indexOf('(');
|
|
3515
|
+
if (dotIndex !== -1 &&
|
|
3516
|
+
dotIndex < parenIndex &&
|
|
3517
|
+
!sourcePath.startsWith('use') // Not a hook call like useState()
|
|
3518
|
+
) {
|
|
3519
|
+
// Extract the base variable (before the first dot)
|
|
3520
|
+
const baseVar = sourcePath.slice(0, dotIndex);
|
|
3521
|
+
const rest = sourcePath.slice(dotIndex); // includes ".method(...).functionCallReturnValue"
|
|
3522
|
+
// Check if the base variable can be resolved
|
|
3523
|
+
if (baseVar in equivalentSignatureVariables &&
|
|
3524
|
+
baseVar !== varName) {
|
|
3525
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
3526
|
+
// Skip if baseResolved is an array (OR expression)
|
|
3527
|
+
if (Array.isArray(baseResolved))
|
|
3528
|
+
continue;
|
|
3529
|
+
// Only resolve if the base resolved to something useful (contains () or .)
|
|
3530
|
+
if (baseResolved.includes('()') || baseResolved.includes('.')) {
|
|
3531
|
+
const newPath = baseResolved + rest;
|
|
3532
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
3533
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
3534
|
+
changed = true;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
// Fix 38: Handle cyScope lazy initializer return values
|
|
3540
|
+
// When we have viewMode -> cyScope20(), trace through to find what cyScope20 returns.
|
|
3541
|
+
// The lazy initializer's return value should be the controllable data source.
|
|
3542
|
+
// Pattern: cyScopeN() where N is a number
|
|
3543
|
+
const cyScopeMatch = sourcePath.match(/^(cyScope\d+)\(\)$/);
|
|
3544
|
+
if (cyScopeMatch) {
|
|
3545
|
+
const cyScopeName = cyScopeMatch[1];
|
|
3546
|
+
const cyScopeNode = this.scopeNodes[cyScopeName];
|
|
3547
|
+
if (cyScopeNode?.equivalencies) {
|
|
3548
|
+
// Look for returnValue equivalency in the cyScope
|
|
3549
|
+
const returnValueEquivs = cyScopeNode.equivalencies['returnValue'];
|
|
3550
|
+
if (returnValueEquivs && returnValueEquivs.length > 0) {
|
|
3551
|
+
// Get the first return value source
|
|
3552
|
+
const returnSource = returnValueEquivs[0].schemaPath;
|
|
3553
|
+
// If the return source is a simple variable (not a complex path),
|
|
3554
|
+
// resolve varName directly to that variable
|
|
3555
|
+
if (returnSource &&
|
|
3556
|
+
!returnSource.includes('(') &&
|
|
3557
|
+
!returnSource.includes('[')) {
|
|
3558
|
+
// Update varName to point to the return source
|
|
3559
|
+
if (equivalentSignatureVariables[varName] !== returnSource) {
|
|
3560
|
+
equivalentSignatureVariables[varName] = returnSource;
|
|
3561
|
+
changed = true;
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
continue;
|
|
3568
|
+
}
|
|
3569
|
+
// Check if the source path starts with a variable that's also in the map
|
|
3570
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
3571
|
+
let baseVar;
|
|
3572
|
+
let rest;
|
|
3573
|
+
if (dotIndex > 0) {
|
|
3574
|
+
// Path has a dot: "a.b.c" -> baseVar="a", rest=".b.c"
|
|
3575
|
+
baseVar = sourcePath.slice(0, dotIndex);
|
|
3576
|
+
rest = sourcePath.slice(dotIndex); // includes the leading dot
|
|
3577
|
+
}
|
|
3578
|
+
else {
|
|
3579
|
+
// Path is a simple identifier: "currentEntityAnalysis" -> baseVar="currentEntityAnalysis", rest=""
|
|
3580
|
+
baseVar = sourcePath;
|
|
3581
|
+
rest = '';
|
|
3582
|
+
}
|
|
3583
|
+
if (baseVar in equivalentSignatureVariables && baseVar !== varName) {
|
|
3584
|
+
// Handle array case (OR expressions) - use first element
|
|
3585
|
+
const rawBaseResolved = equivalentSignatureVariables[baseVar];
|
|
3586
|
+
const baseResolved = Array.isArray(rawBaseResolved)
|
|
3587
|
+
? rawBaseResolved[0]
|
|
3588
|
+
: rawBaseResolved;
|
|
3589
|
+
if (!baseResolved)
|
|
3590
|
+
continue;
|
|
3591
|
+
// If the base resolves to a hook call, add .functionCallReturnValue
|
|
3592
|
+
if (baseResolved.endsWith('()')) {
|
|
3593
|
+
const newPath = baseResolved + '.functionCallReturnValue' + rest;
|
|
3594
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
3595
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
3596
|
+
changed = true;
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
else if (baseResolved !== sourcePath) {
|
|
3600
|
+
const newPath = baseResolved + rest;
|
|
3601
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
3602
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
3603
|
+
changed = true;
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
1692
3606
|
}
|
|
1693
3607
|
}
|
|
3608
|
+
// Stop if no changes were made in this iteration
|
|
3609
|
+
if (!changed)
|
|
3610
|
+
break;
|
|
1694
3611
|
}
|
|
1695
3612
|
return equivalentSignatureVariables;
|
|
1696
3613
|
}
|
|
1697
3614
|
getVariableInfo(variableName, scopeName, final) {
|
|
1698
|
-
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName ?? this.
|
|
3615
|
+
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName ?? this.scopeTreeManager.getRootName());
|
|
1699
3616
|
if (!scopeNode)
|
|
1700
3617
|
return;
|
|
1701
3618
|
let equivalents = scopeNode.equivalencies[variableName];
|
|
@@ -1722,8 +3639,13 @@ export class ScopeDataStructure {
|
|
|
1722
3639
|
});
|
|
1723
3640
|
return { ...acc, ...filterdSchema };
|
|
1724
3641
|
}, {});
|
|
1725
|
-
const tempScopeNode = this.createTempScopeNode(scopeName ?? this.
|
|
3642
|
+
const tempScopeNode = this.createTempScopeNode(scopeName ?? this.scopeTreeManager.getRootName(), relevantSchema);
|
|
3643
|
+
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
3644
|
+
// during this "getter" method. See comment in getFunctionSignature.
|
|
3645
|
+
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
3646
|
+
this.onlyEquivalencies = true;
|
|
1726
3647
|
this.validateSchema(tempScopeNode, true, final);
|
|
3648
|
+
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
1727
3649
|
return {
|
|
1728
3650
|
name: variableName,
|
|
1729
3651
|
equivalentTo: equivalents,
|
|
@@ -1731,66 +3653,1212 @@ export class ScopeDataStructure {
|
|
|
1731
3653
|
};
|
|
1732
3654
|
}
|
|
1733
3655
|
getExternalFunctionCalls() {
|
|
1734
|
-
|
|
3656
|
+
// Replace cyScope placeholders in all external function call data
|
|
3657
|
+
// This ensures call signatures and schema paths use actual callback text
|
|
3658
|
+
// instead of internal cyScope names, preventing mock data merge conflicts.
|
|
3659
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
3660
|
+
const rootSchema = this.scopeNodes[rootScopeName]?.schema ?? {};
|
|
3661
|
+
return this.externalFunctionCalls.map((efc) => {
|
|
3662
|
+
const cleaned = this.cleanCyScopeFromFunctionCallInfo(efc);
|
|
3663
|
+
return this.filterConflatedExternalPaths(cleaned, rootSchema);
|
|
3664
|
+
});
|
|
3665
|
+
}
|
|
3666
|
+
/**
|
|
3667
|
+
* Filters out conflated paths from external function call schemas.
|
|
3668
|
+
*
|
|
3669
|
+
* When multiple useState(false) calls create equivalency conflation during
|
|
3670
|
+
* Phase 1 analysis, standalone boolean state variables (like showWorkoutForm,
|
|
3671
|
+
* showGoalForm) can bleed into external function call schemas as sub-properties
|
|
3672
|
+
* of unrelated data fields (like data[].activity_type.showWorkoutForm).
|
|
3673
|
+
*
|
|
3674
|
+
* Detection: group sub-properties by parent path. If 2+ sub-properties of
|
|
3675
|
+
* the same parent all match standalone root scope variable names, treat them
|
|
3676
|
+
* as conflation artifacts and remove them.
|
|
3677
|
+
*/
|
|
3678
|
+
filterConflatedExternalPaths(efc, rootSchema) {
|
|
3679
|
+
// Build a set of top-level root scope variable names (simple names, no dots/brackets)
|
|
3680
|
+
const topLevelRootVars = new Set();
|
|
3681
|
+
for (const key of Object.keys(rootSchema)) {
|
|
3682
|
+
if (!key.includes('.') && !key.includes('[')) {
|
|
3683
|
+
topLevelRootVars.add(key);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
if (topLevelRootVars.size === 0)
|
|
3687
|
+
return efc;
|
|
3688
|
+
// Group sub-property matches by their parent path.
|
|
3689
|
+
// For a path like "...data[].activity_type.showWorkoutForm",
|
|
3690
|
+
// parent = "...data[].activity_type", child = "showWorkoutForm"
|
|
3691
|
+
const parentToConflatedKeys = new Map();
|
|
3692
|
+
for (const key of Object.keys(efc.schema)) {
|
|
3693
|
+
const lastDot = key.lastIndexOf('.');
|
|
3694
|
+
if (lastDot === -1)
|
|
3695
|
+
continue;
|
|
3696
|
+
const parent = key.substring(0, lastDot);
|
|
3697
|
+
const child = key.substring(lastDot + 1);
|
|
3698
|
+
// Skip array access or function call patterns
|
|
3699
|
+
if (child.includes('[') || child.includes('('))
|
|
3700
|
+
continue;
|
|
3701
|
+
// Only consider paths inside array element chains (contains []).
|
|
3702
|
+
// Direct children of functionCallReturnValue are legitimate destructured
|
|
3703
|
+
// return values, not conflation. Conflation happens deeper in the chain
|
|
3704
|
+
// when array element fields get corrupted sub-properties.
|
|
3705
|
+
if (!parent.includes('['))
|
|
3706
|
+
continue;
|
|
3707
|
+
if (topLevelRootVars.has(child)) {
|
|
3708
|
+
if (!parentToConflatedKeys.has(parent)) {
|
|
3709
|
+
parentToConflatedKeys.set(parent, []);
|
|
3710
|
+
}
|
|
3711
|
+
parentToConflatedKeys.get(parent).push(key);
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
// Only filter when 2+ sub-properties of the same parent match root scope vars.
|
|
3715
|
+
// This threshold avoids false positives from coincidental name matches.
|
|
3716
|
+
const keysToRemove = new Set();
|
|
3717
|
+
const parentsToRestore = new Set();
|
|
3718
|
+
for (const [parent, conflatedKeys] of parentToConflatedKeys) {
|
|
3719
|
+
if (conflatedKeys.length >= 2) {
|
|
3720
|
+
for (const key of conflatedKeys) {
|
|
3721
|
+
keysToRemove.add(key);
|
|
3722
|
+
}
|
|
3723
|
+
parentsToRestore.add(parent);
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
if (keysToRemove.size === 0)
|
|
3727
|
+
return efc;
|
|
3728
|
+
// Create a new schema without the conflated paths
|
|
3729
|
+
const newSchema = {};
|
|
3730
|
+
for (const [key, value] of Object.entries(efc.schema)) {
|
|
3731
|
+
if (keysToRemove.has(key))
|
|
3732
|
+
continue;
|
|
3733
|
+
// Restore parent type: if it was changed to "object" because of conflated
|
|
3734
|
+
// sub-properties, and now all those sub-properties are removed, change it
|
|
3735
|
+
// back to "unknown" (we don't know the original type)
|
|
3736
|
+
if (parentsToRestore.has(key) && value === 'object') {
|
|
3737
|
+
// Check if there are any remaining sub-properties
|
|
3738
|
+
const hasRemainingSubProps = Object.keys(efc.schema).some((k) => !keysToRemove.has(k) &&
|
|
3739
|
+
k !== key &&
|
|
3740
|
+
(k.startsWith(key + '.') || k.startsWith(key + '[')));
|
|
3741
|
+
newSchema[key] = hasRemainingSubProps ? value : 'unknown';
|
|
3742
|
+
}
|
|
3743
|
+
else {
|
|
3744
|
+
newSchema[key] = value;
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
return { ...efc, schema: newSchema };
|
|
3748
|
+
}
|
|
3749
|
+
/**
|
|
3750
|
+
* Cleans cyScope placeholder references from a FunctionCallInfo.
|
|
3751
|
+
* Replaces cyScopeN() with the actual callback text in:
|
|
3752
|
+
* - callSignature
|
|
3753
|
+
* - allCallSignatures
|
|
3754
|
+
* - schema keys
|
|
3755
|
+
*/
|
|
3756
|
+
cleanCyScopeFromFunctionCallInfo(efc) {
|
|
3757
|
+
const cyScopePattern = /cyScope\d+\(\)/g;
|
|
3758
|
+
// Check if any cleaning is needed
|
|
3759
|
+
const hasCyScope = cyScopePattern.test(efc.callSignature) ||
|
|
3760
|
+
(efc.allCallSignatures &&
|
|
3761
|
+
efc.allCallSignatures.some((sig) => /cyScope\d+\(\)/.test(sig))) ||
|
|
3762
|
+
(efc.schema &&
|
|
3763
|
+
Object.keys(efc.schema).some((key) => /cyScope\d+\(\)/.test(key)));
|
|
3764
|
+
if (!hasCyScope) {
|
|
3765
|
+
return efc;
|
|
3766
|
+
}
|
|
3767
|
+
// Create cleaned copy
|
|
3768
|
+
const cleaned = { ...efc };
|
|
3769
|
+
// Clean callSignature
|
|
3770
|
+
cleaned.callSignature = this.replaceCyScopeInString(efc.callSignature);
|
|
3771
|
+
// Clean allCallSignatures
|
|
3772
|
+
if (efc.allCallSignatures) {
|
|
3773
|
+
cleaned.allCallSignatures = efc.allCallSignatures.map((sig) => this.replaceCyScopeInString(sig));
|
|
3774
|
+
}
|
|
3775
|
+
// Clean schema keys
|
|
3776
|
+
if (efc.schema) {
|
|
3777
|
+
cleaned.schema = this.replaceCyScopePlaceholders(efc.schema);
|
|
3778
|
+
}
|
|
3779
|
+
// Clean callSignatureToVariable keys
|
|
3780
|
+
if (efc.callSignatureToVariable) {
|
|
3781
|
+
cleaned.callSignatureToVariable = Object.entries(efc.callSignatureToVariable).reduce((acc, [key, value]) => {
|
|
3782
|
+
acc[this.replaceCyScopeInString(key)] = value;
|
|
3783
|
+
return acc;
|
|
3784
|
+
}, {});
|
|
3785
|
+
}
|
|
3786
|
+
return cleaned;
|
|
3787
|
+
}
|
|
3788
|
+
/**
|
|
3789
|
+
* Replaces cyScope placeholder references in a single string.
|
|
3790
|
+
* If the scope text can't be found, uses a generic fallback to avoid leaking
|
|
3791
|
+
* internal cyScope names into stored data.
|
|
3792
|
+
*
|
|
3793
|
+
* Handles two patterns:
|
|
3794
|
+
* 1. Function call style: cyScope7() - matched by cyScope(\d+)\(\)
|
|
3795
|
+
* 2. Scope name style: parentName____cyScopeXX or cyScopeXX - matched by (\w+____)?cyScope([0-9A-Fa-f]+)
|
|
3796
|
+
*/
|
|
3797
|
+
replaceCyScopeInString(str) {
|
|
3798
|
+
let result = str;
|
|
3799
|
+
// Pattern 1: Function call style - cyScope7()
|
|
3800
|
+
const functionCallPattern = /cyScope(\d+)\(\)/g;
|
|
3801
|
+
const functionCallMatches = [...str.matchAll(functionCallPattern)];
|
|
3802
|
+
for (const match of functionCallMatches) {
|
|
3803
|
+
const cyScopeName = `cyScope${match[1]}`;
|
|
3804
|
+
const scopeText = this.findCyScopeText(cyScopeName);
|
|
3805
|
+
// Always replace cyScope references - use actual text if available,
|
|
3806
|
+
// otherwise use a generic callback placeholder
|
|
3807
|
+
const replacement = scopeText || '() => {}';
|
|
3808
|
+
result = result.replace(match[0], replacement);
|
|
3809
|
+
}
|
|
3810
|
+
// Pattern 2: Scope name style - parentName____cyScopeXX or just cyScopeXX
|
|
3811
|
+
// This handles hex-encoded scope IDs like cyScope1F
|
|
3812
|
+
const scopeNamePattern = /(\w+____)?cyScope([0-9A-Fa-f]+)/g;
|
|
3813
|
+
const scopeNameMatches = [...result.matchAll(scopeNamePattern)];
|
|
3814
|
+
for (const match of scopeNameMatches) {
|
|
3815
|
+
const fullMatch = match[0];
|
|
3816
|
+
const prefix = match[1] || ''; // e.g., "getTitleColor____"
|
|
3817
|
+
const cyScopeId = match[2]; // e.g., "1F"
|
|
3818
|
+
const cyScopeName = `cyScope${cyScopeId}`;
|
|
3819
|
+
// Try to find the scope text, checking both with and without prefix
|
|
3820
|
+
let scopeText = this.findCyScopeText(cyScopeName);
|
|
3821
|
+
if (!scopeText && prefix) {
|
|
3822
|
+
// Try looking up with the full prefixed name
|
|
3823
|
+
scopeText = this.findCyScopeText(`${prefix}${cyScopeName}`);
|
|
3824
|
+
}
|
|
3825
|
+
if (scopeText) {
|
|
3826
|
+
result = result.replace(fullMatch, scopeText);
|
|
3827
|
+
}
|
|
3828
|
+
else {
|
|
3829
|
+
// Replace with a generic identifier to avoid leaking internal names
|
|
3830
|
+
result = result.replace(fullMatch, 'callback');
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
return result;
|
|
1735
3834
|
}
|
|
1736
3835
|
getEnvironmentVariables() {
|
|
1737
3836
|
return this.environmentVariables;
|
|
1738
3837
|
}
|
|
3838
|
+
/**
|
|
3839
|
+
* Add conditional usages from AST analysis.
|
|
3840
|
+
* Called during scope analysis to collect all conditionals.
|
|
3841
|
+
*/
|
|
3842
|
+
addConditionalUsages(usages) {
|
|
3843
|
+
for (const [path, pathUsages] of Object.entries(usages)) {
|
|
3844
|
+
if (!this.rawConditionalUsages[path]) {
|
|
3845
|
+
this.rawConditionalUsages[path] = [];
|
|
3846
|
+
}
|
|
3847
|
+
// Deduplicate usages
|
|
3848
|
+
for (const usage of pathUsages) {
|
|
3849
|
+
const exists = this.rawConditionalUsages[path].some((existing) => existing.location === usage.location &&
|
|
3850
|
+
existing.conditionType === usage.conditionType &&
|
|
3851
|
+
JSON.stringify(existing.comparedValues) ===
|
|
3852
|
+
JSON.stringify(usage.comparedValues));
|
|
3853
|
+
if (!exists) {
|
|
3854
|
+
this.rawConditionalUsages[path].push(usage);
|
|
3855
|
+
}
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
/**
|
|
3860
|
+
* Add conditional effects from AST analysis.
|
|
3861
|
+
* Called during scope analysis to collect all setter calls inside conditionals.
|
|
3862
|
+
*/
|
|
3863
|
+
addConditionalEffects(effects) {
|
|
3864
|
+
// Add effects, avoiding duplicates based on effect stateVariable and condition paths
|
|
3865
|
+
for (const effect of effects) {
|
|
3866
|
+
const exists = this.rawConditionalEffects.some((existing) => {
|
|
3867
|
+
// Same effect target (stateVariable + value)
|
|
3868
|
+
const sameEffect = existing.effect.stateVariable === effect.effect.stateVariable &&
|
|
3869
|
+
existing.effect.value === effect.effect.value;
|
|
3870
|
+
if (!sameEffect)
|
|
3871
|
+
return false;
|
|
3872
|
+
// Same condition(s)
|
|
3873
|
+
if (existing.condition && effect.condition) {
|
|
3874
|
+
return (existing.condition.path === effect.condition.path &&
|
|
3875
|
+
existing.condition.requiredValue === effect.condition.requiredValue);
|
|
3876
|
+
}
|
|
3877
|
+
if (existing.conditions && effect.conditions) {
|
|
3878
|
+
if (existing.conditions.length !== effect.conditions.length)
|
|
3879
|
+
return false;
|
|
3880
|
+
return existing.conditions.every((ec, i) => {
|
|
3881
|
+
const newCond = effect.conditions[i];
|
|
3882
|
+
return (ec.path === newCond.path &&
|
|
3883
|
+
ec.requiredValue === newCond.requiredValue);
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
return false;
|
|
3887
|
+
});
|
|
3888
|
+
if (!exists) {
|
|
3889
|
+
this.rawConditionalEffects.push(effect);
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
/**
|
|
3894
|
+
* Get conditional effects collected during analysis.
|
|
3895
|
+
*/
|
|
3896
|
+
getConditionalEffects() {
|
|
3897
|
+
return this.rawConditionalEffects;
|
|
3898
|
+
}
|
|
3899
|
+
/**
|
|
3900
|
+
* Add compound conditionals from AST analysis.
|
|
3901
|
+
* Called during scope analysis to collect grouped conditions (e.g., a && b && c).
|
|
3902
|
+
*/
|
|
3903
|
+
addCompoundConditionals(compounds) {
|
|
3904
|
+
// Add compounds, avoiding duplicates based on chainId
|
|
3905
|
+
for (const compound of compounds) {
|
|
3906
|
+
const exists = this.rawCompoundConditionals.some((existing) => existing.chainId === compound.chainId);
|
|
3907
|
+
if (!exists) {
|
|
3908
|
+
this.rawCompoundConditionals.push(compound);
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
/**
|
|
3913
|
+
* Get compound conditionals collected during analysis.
|
|
3914
|
+
*/
|
|
3915
|
+
getCompoundConditionals() {
|
|
3916
|
+
return this.rawCompoundConditionals;
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
3919
|
+
* Add child boundary gating conditions from AST analysis.
|
|
3920
|
+
* These track which conditions must be true for a child component to render.
|
|
3921
|
+
*/
|
|
3922
|
+
addChildBoundaryGatingConditions(conditions) {
|
|
3923
|
+
for (const [childName, usages] of Object.entries(conditions)) {
|
|
3924
|
+
if (!this.rawChildBoundaryGatingConditions[childName]) {
|
|
3925
|
+
this.rawChildBoundaryGatingConditions[childName] = [];
|
|
3926
|
+
}
|
|
3927
|
+
// Add usages, avoiding duplicates
|
|
3928
|
+
for (const usage of usages) {
|
|
3929
|
+
const exists = this.rawChildBoundaryGatingConditions[childName].some((existing) => existing.path === usage.path &&
|
|
3930
|
+
existing.conditionType === usage.conditionType &&
|
|
3931
|
+
existing.isNegated === usage.isNegated);
|
|
3932
|
+
if (!exists) {
|
|
3933
|
+
this.rawChildBoundaryGatingConditions[childName].push(usage);
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
/**
|
|
3939
|
+
* Get enriched child boundary gating conditions with source tracing.
|
|
3940
|
+
* Similar to getEnrichedConditionalUsages but for gating conditions.
|
|
3941
|
+
*/
|
|
3942
|
+
getEnrichedChildBoundaryGatingConditions() {
|
|
3943
|
+
const enriched = {};
|
|
3944
|
+
const rootScopeName = this.scopeTreeManager.getTree().name;
|
|
3945
|
+
for (const [childName, usages] of Object.entries(this.rawChildBoundaryGatingConditions)) {
|
|
3946
|
+
enriched[childName] = usages.map((usage) => {
|
|
3947
|
+
// Try to trace this path back to a data source
|
|
3948
|
+
const explanation = this.explainPath(rootScopeName, usage.path);
|
|
3949
|
+
let sourceDataPath;
|
|
3950
|
+
if (explanation.source) {
|
|
3951
|
+
sourceDataPath = `${explanation.source.scope}.${explanation.source.path}`;
|
|
3952
|
+
}
|
|
3953
|
+
return {
|
|
3954
|
+
...usage,
|
|
3955
|
+
sourceDataPath,
|
|
3956
|
+
};
|
|
3957
|
+
});
|
|
3958
|
+
}
|
|
3959
|
+
return enriched;
|
|
3960
|
+
}
|
|
3961
|
+
/**
|
|
3962
|
+
* Get enriched conditional usages with source tracing.
|
|
3963
|
+
* Uses explainPath to trace each local variable back to its data source.
|
|
3964
|
+
* Preserves all fields from the raw conditional usages including derivedFrom.
|
|
3965
|
+
*/
|
|
3966
|
+
getEnrichedConditionalUsages() {
|
|
3967
|
+
const enriched = {};
|
|
3968
|
+
console.log(`[getEnrichedConditionalUsages] Processing ${Object.keys(this.rawConditionalUsages).length} conditional paths: [${Object.keys(this.rawConditionalUsages).join(', ')}]`);
|
|
3969
|
+
for (const [path, usages] of Object.entries(this.rawConditionalUsages)) {
|
|
3970
|
+
// Try to trace this path back to a data source
|
|
3971
|
+
// First, try the root scope
|
|
3972
|
+
const rootScopeName = this.scopeTreeManager.getTree().name;
|
|
3973
|
+
const explanation = this.explainPath(rootScopeName, path);
|
|
3974
|
+
let sourceDataPath;
|
|
3975
|
+
if (explanation.source) {
|
|
3976
|
+
const { scope, path: sourcePath } = explanation.source;
|
|
3977
|
+
// Build initial path — avoid redundant prefix when path already contains the scope call
|
|
3978
|
+
let fullPath;
|
|
3979
|
+
if (sourcePath.startsWith(`${scope}(`)) {
|
|
3980
|
+
fullPath = sourcePath;
|
|
3981
|
+
}
|
|
3982
|
+
else {
|
|
3983
|
+
fullPath = `${scope}.${sourcePath}`;
|
|
3984
|
+
}
|
|
3985
|
+
sourceDataPath = fullPath;
|
|
3986
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" explainPath → scope="${scope}", sourcePath="${sourcePath}" → sourceDataPath="${sourceDataPath}"`);
|
|
3987
|
+
}
|
|
3988
|
+
else {
|
|
3989
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" explainPath → no source found`);
|
|
3990
|
+
}
|
|
3991
|
+
// If explainPath didn't find a useful external source (e.g., it traced to
|
|
3992
|
+
// useState or just to the component scope itself), check sourceEquivalencies
|
|
3993
|
+
// for an external function call source like a fetch call
|
|
3994
|
+
const hasExternalSource = sourceDataPath?.includes('.functionCallReturnValue');
|
|
3995
|
+
if (!hasExternalSource) {
|
|
3996
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" no external source (sourceDataPath="${sourceDataPath}"), checking sourceEquivalencies fallback...`);
|
|
3997
|
+
const sourceEquiv = this.getSourceEquivalencies();
|
|
3998
|
+
const returnValueKey = `returnValue.${path}`;
|
|
3999
|
+
const sources = sourceEquiv[returnValueKey];
|
|
4000
|
+
if (sources) {
|
|
4001
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies["${returnValueKey}"] has ${sources.length} sources: [${sources.map((s) => s.schemaPath).join(', ')}]`);
|
|
4002
|
+
const externalSource = sources.find((s) => s.schemaPath.includes('.functionCallReturnValue') &&
|
|
4003
|
+
!s.schemaPath.startsWith('useState('));
|
|
4004
|
+
if (externalSource) {
|
|
4005
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies fallback found external source: "${externalSource.schemaPath}"`);
|
|
4006
|
+
sourceDataPath = externalSource.schemaPath;
|
|
4007
|
+
}
|
|
4008
|
+
else {
|
|
4009
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies fallback found no external function call source`);
|
|
4010
|
+
}
|
|
4011
|
+
}
|
|
4012
|
+
else {
|
|
4013
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" sourceEquivalencies["${returnValueKey}"] not found`);
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
console.log(`[getEnrichedConditionalUsages] "${path}" FINAL sourceDataPath="${sourceDataPath ?? '(none)'}" (${usages.length} usages)`);
|
|
4017
|
+
enriched[path] = usages.map((usage) => ({
|
|
4018
|
+
...usage,
|
|
4019
|
+
sourceDataPath,
|
|
4020
|
+
}));
|
|
4021
|
+
}
|
|
4022
|
+
return enriched;
|
|
4023
|
+
}
|
|
4024
|
+
/**
|
|
4025
|
+
* Add JSX rendering usages from AST analysis.
|
|
4026
|
+
* These track arrays rendered via .map() and strings interpolated in JSX.
|
|
4027
|
+
*/
|
|
4028
|
+
addJsxRenderingUsages(usages) {
|
|
4029
|
+
// Add usages, avoiding duplicates based on path and renderingType
|
|
4030
|
+
for (const usage of usages) {
|
|
4031
|
+
const exists = this.rawJsxRenderingUsages.some((existing) => existing.path === usage.path &&
|
|
4032
|
+
existing.renderingType === usage.renderingType);
|
|
4033
|
+
if (!exists) {
|
|
4034
|
+
this.rawJsxRenderingUsages.push(usage);
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
/**
|
|
4039
|
+
* Get JSX rendering usages collected during analysis.
|
|
4040
|
+
*/
|
|
4041
|
+
getJsxRenderingUsages() {
|
|
4042
|
+
return this.rawJsxRenderingUsages;
|
|
4043
|
+
}
|
|
1739
4044
|
toSerializable() {
|
|
1740
|
-
// Helper to
|
|
4045
|
+
// Helper to clean cyScope and cyDuplicateKey from a string for output
|
|
4046
|
+
const cleanCyScope = (str) => this.replaceCyScopeInString(str).replace(/::cyDuplicateKey\d+::/g, '');
|
|
4047
|
+
// Helper to convert ScopeVariable to SerializableScopeVariable (with cyScope cleaned)
|
|
1741
4048
|
const toSerializableVariable = (vars) => vars.map((v) => ({
|
|
1742
|
-
scopeNodeName: v.scopeNodeName,
|
|
1743
|
-
schemaPath: v.schemaPath,
|
|
4049
|
+
scopeNodeName: cleanCyScope(v.scopeNodeName),
|
|
4050
|
+
schemaPath: cleanCyScope(v.schemaPath),
|
|
1744
4051
|
}));
|
|
4052
|
+
// Helper to clean cyScope from all keys in a schema
|
|
4053
|
+
const cleanSchemaKeys = (schema) => {
|
|
4054
|
+
return Object.entries(schema).reduce((acc, [key, value]) => {
|
|
4055
|
+
acc[cleanCyScope(key)] = value;
|
|
4056
|
+
return acc;
|
|
4057
|
+
}, {});
|
|
4058
|
+
};
|
|
1745
4059
|
// Helper to get function result for a given function name
|
|
1746
4060
|
const getFunctionResult = (functionName) => {
|
|
1747
4061
|
return {
|
|
1748
|
-
signature: this.getFunctionSignature({ functionName }) ?? {},
|
|
1749
|
-
signatureWithUnknowns: this.getFunctionSignature({ functionName, fillInUnknowns: true }) ??
|
|
1750
|
-
{},
|
|
1751
|
-
returnValue: this.getReturnValue({ functionName }) ?? {},
|
|
1752
|
-
returnValueWithUnknowns: this.getReturnValue({ functionName, fillInUnknowns: true }) ?? {},
|
|
4062
|
+
signature: cleanSchemaKeys(this.getFunctionSignature({ functionName }) ?? {}),
|
|
4063
|
+
signatureWithUnknowns: cleanSchemaKeys(this.getFunctionSignature({ functionName, fillInUnknowns: true }) ??
|
|
4064
|
+
{}),
|
|
4065
|
+
returnValue: cleanSchemaKeys(this.getReturnValue({ functionName }) ?? {}),
|
|
4066
|
+
returnValueWithUnknowns: cleanSchemaKeys(this.getReturnValue({ functionName, fillInUnknowns: true }) ?? {}),
|
|
1753
4067
|
usageEquivalencies: Object.entries(this.getUsageEquivalencies(functionName) ?? {}).reduce((acc, [key, vars]) => {
|
|
1754
|
-
|
|
4068
|
+
// Clean cyScope from the key as well as variable properties
|
|
4069
|
+
acc[cleanCyScope(key)] = toSerializableVariable(vars);
|
|
1755
4070
|
return acc;
|
|
1756
4071
|
}, {}),
|
|
1757
4072
|
sourceEquivalencies: Object.entries(this.getSourceEquivalencies(functionName) ?? {}).reduce((acc, [key, vars]) => {
|
|
1758
|
-
|
|
4073
|
+
// Clean cyScope from the key as well as variable properties
|
|
4074
|
+
acc[cleanCyScope(key)] = toSerializableVariable(vars);
|
|
1759
4075
|
return acc;
|
|
1760
4076
|
}, {}),
|
|
1761
4077
|
environmentVariables: this.getEnvironmentVariables(),
|
|
1762
4078
|
};
|
|
1763
4079
|
};
|
|
1764
|
-
// Convert external function calls
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
4080
|
+
// Convert external function calls - use getExternalFunctionCalls() which cleans cyScope
|
|
4081
|
+
const cleanedExternalCalls = this.getExternalFunctionCalls();
|
|
4082
|
+
// Get root scope schema for building per-variable return value schemas
|
|
4083
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
4084
|
+
const rootScope = this.scopeNodes[rootScopeName];
|
|
4085
|
+
const rootSchema = rootScope?.schema ?? {};
|
|
4086
|
+
const externalFunctionCalls = cleanedExternalCalls.map((efc) => {
|
|
4087
|
+
// Build perVariableSchemas from perCallSignatureSchemas when available.
|
|
4088
|
+
// This preserves distinct schemas per variable when the same function is called
|
|
4089
|
+
// multiple times with DIFFERENT call signatures (e.g., different type parameters).
|
|
4090
|
+
//
|
|
4091
|
+
// When field accesses happen in child scopes (like JSX expressions), the
|
|
4092
|
+
// rootSchema doesn't contain the detailed paths - they end up in child scope
|
|
4093
|
+
// schemas. Using perCallSignatureSchemas ensures we get the correct schema
|
|
4094
|
+
// for each call, regardless of where field accesses occur.
|
|
4095
|
+
let perVariableSchemas;
|
|
4096
|
+
// Use perCallSignatureSchemas only when:
|
|
4097
|
+
// 1. It exists and has distinct entries for different call signatures
|
|
4098
|
+
// 2. The number of distinct call signatures >= number of receiving variables
|
|
4099
|
+
//
|
|
4100
|
+
// This prevents using it when all calls have the same signature (e.g., useFetcher() x 2)
|
|
4101
|
+
// because in that case, perCallSignatureSchemas only has one entry.
|
|
4102
|
+
const numCallSignatures = efc.perCallSignatureSchemas
|
|
4103
|
+
? Object.keys(efc.perCallSignatureSchemas).length
|
|
4104
|
+
: 0;
|
|
4105
|
+
const numReceivingVars = efc.receivingVariableNames?.length ?? 0;
|
|
4106
|
+
const hasDistinctSchemas = numCallSignatures >= numReceivingVars && numCallSignatures > 1;
|
|
4107
|
+
// CASE 1: Multiple call signatures with distinct schemas - use indexed variable names
|
|
4108
|
+
if (hasDistinctSchemas &&
|
|
4109
|
+
efc.perCallSignatureSchemas &&
|
|
4110
|
+
efc.callSignatureToVariable) {
|
|
4111
|
+
perVariableSchemas = {};
|
|
4112
|
+
// Build a reverse map: variable -> array of call signatures (in order)
|
|
4113
|
+
// This handles the case where the same variable name is reused for different calls
|
|
4114
|
+
const varToCallSigs = {};
|
|
4115
|
+
for (const [callSig, varName] of Object.entries(efc.callSignatureToVariable)) {
|
|
4116
|
+
if (!varToCallSigs[varName]) {
|
|
4117
|
+
varToCallSigs[varName] = [];
|
|
4118
|
+
}
|
|
4119
|
+
varToCallSigs[varName].push(callSig);
|
|
4120
|
+
}
|
|
4121
|
+
// Track how many times each variable name has been seen
|
|
4122
|
+
const varNameCounts = {};
|
|
4123
|
+
// For each receiving variable, get its original schema from perCallSignatureSchemas
|
|
4124
|
+
for (const varName of efc.receivingVariableNames ?? []) {
|
|
4125
|
+
const occurrence = varNameCounts[varName] ?? 0;
|
|
4126
|
+
varNameCounts[varName] = occurrence + 1;
|
|
4127
|
+
const callSigs = varToCallSigs[varName];
|
|
4128
|
+
// Use the nth call signature for the nth occurrence of this variable
|
|
4129
|
+
const callSig = callSigs?.[occurrence];
|
|
4130
|
+
if (callSig && efc.perCallSignatureSchemas[callSig]) {
|
|
4131
|
+
// Use indexed key if this variable name is reused (e.g., fetcher, fetcher[1])
|
|
4132
|
+
const key = occurrence === 0 ? varName : `${varName}[${occurrence}]`;
|
|
4133
|
+
// Clone the schema to avoid shared references
|
|
4134
|
+
perVariableSchemas[key] = {
|
|
4135
|
+
...efc.perCallSignatureSchemas[callSig],
|
|
4136
|
+
};
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
// Only include if we have entries for ALL receiving variables
|
|
4140
|
+
if (Object.keys(perVariableSchemas).length < numReceivingVars) {
|
|
4141
|
+
// Not all variables have schemas - fall back to rootSchema extraction
|
|
4142
|
+
perVariableSchemas = undefined;
|
|
4143
|
+
}
|
|
4144
|
+
else {
|
|
4145
|
+
// Also check that at least one schema is non-empty
|
|
4146
|
+
// Bug fix: perCallSignatureSchemas may have entries but with empty schemas {}
|
|
4147
|
+
// In this case, we should fall through to Fallback which uses rootSchema
|
|
4148
|
+
const hasNonEmptySchema = Object.values(perVariableSchemas).some((schema) => Object.keys(schema).length > 0);
|
|
4149
|
+
if (!hasNonEmptySchema) {
|
|
4150
|
+
perVariableSchemas = undefined;
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
}
|
|
4154
|
+
// CASE 2: Single call signature with single variable - use perCallSignatureSchemas directly
|
|
4155
|
+
// This handles parameterized calls like useFetcher<ConfigData>() where each is a separate efc entry
|
|
4156
|
+
if (!perVariableSchemas &&
|
|
4157
|
+
efc.perCallSignatureSchemas &&
|
|
4158
|
+
numCallSignatures === 1 &&
|
|
4159
|
+
numReceivingVars === 1) {
|
|
4160
|
+
const varName = efc.receivingVariableNames[0];
|
|
4161
|
+
const callSig = Object.keys(efc.perCallSignatureSchemas)[0];
|
|
4162
|
+
const schema = efc.perCallSignatureSchemas[callSig];
|
|
4163
|
+
if (schema && Object.keys(schema).length > 0) {
|
|
4164
|
+
perVariableSchemas = { [varName]: { ...schema } };
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
// CASE 3: Extract from efc.schema when perCallSignatureSchemas is missing or empty
|
|
4168
|
+
// This handles two scenarios:
|
|
4169
|
+
// 1. Parameterized calls that create SEPARATE efc entries (no perCallSignatureSchemas)
|
|
4170
|
+
// 2. Destructuring where perCallSignatureSchemas exists but has EMPTY schemas
|
|
4171
|
+
//
|
|
4172
|
+
// When useFetcher<ConfigData>() and useFetcher<SettingsData>() are called, they create separate
|
|
4173
|
+
// efc entries because getFunctionCallRoot preserves type parameters. Each entry has its own
|
|
4174
|
+
// `schema` field, but due to variable reassignment, the schema may be contaminated with paths
|
|
4175
|
+
// from other calls (the tracer attributes field accesses to ALL equivalencies).
|
|
4176
|
+
//
|
|
4177
|
+
// Solution: Filter efc.schema to only include paths that match THIS entry's call signature.
|
|
4178
|
+
// The schema paths include the full call signature prefix, so we can filter by it.
|
|
4179
|
+
//
|
|
4180
|
+
// Example: ConfigData entry has paths like:
|
|
4181
|
+
// "useFetcher<{ data: ConfigData | null }>().functionCallReturnValue.data.data.theme"
|
|
4182
|
+
// But also (contaminated):
|
|
4183
|
+
// "useFetcher<{ data: ConfigData | null }>().functionCallReturnValue.data.data.notifications"
|
|
4184
|
+
//
|
|
4185
|
+
// We filter to only keep paths that should belong to THIS call by checking if the
|
|
4186
|
+
// receiving variable's equivalency points to this call's return value.
|
|
4187
|
+
//
|
|
4188
|
+
// BUG FIX: The old condition `!efc.perCallSignatureSchemas` was FALSE when the object
|
|
4189
|
+
// existed (even with empty schemas), causing this case to be skipped. We now also check
|
|
4190
|
+
// if all schemas in perCallSignatureSchemas are empty.
|
|
4191
|
+
const hasNonEmptyPerCallSignatureSchemas = efc.perCallSignatureSchemas &&
|
|
4192
|
+
Object.values(efc.perCallSignatureSchemas).some((schema) => Object.keys(schema).length > 0);
|
|
4193
|
+
// Build the call signature prefix that paths should start with
|
|
4194
|
+
const callSigPrefix = `${efc.callSignature}.functionCallReturnValue`;
|
|
4195
|
+
// Check if efc.schema has variable-specific paths (indicating destructuring).
|
|
4196
|
+
// Destructuring: const { entities, gitStatus } = useLoaderData()
|
|
4197
|
+
// - efc.schema has paths like: useLoaderData().functionCallReturnValue.entities...
|
|
4198
|
+
// Multiple calls: const x = useFetcher(); const y = useFetcher();
|
|
4199
|
+
// - efc.schema has paths like: useFetcher().functionCallReturnValue.data...
|
|
4200
|
+
// CASE 3 should only run for destructuring (variable-specific paths exist).
|
|
4201
|
+
const hasVariableSpecificPaths = (efc.receivingVariableNames ?? []).some((varName) => Object.keys(efc.schema).some((path) => path.startsWith(`${callSigPrefix}.${varName}`)));
|
|
4202
|
+
if (!perVariableSchemas &&
|
|
4203
|
+
!hasNonEmptyPerCallSignatureSchemas &&
|
|
4204
|
+
numReceivingVars >= 1 &&
|
|
4205
|
+
hasVariableSpecificPaths) {
|
|
4206
|
+
// Filter efc.schema to only include paths matching this call signature
|
|
4207
|
+
const filteredSchema = {};
|
|
4208
|
+
for (const [path, type] of Object.entries(efc.schema)) {
|
|
4209
|
+
if (path.startsWith(callSigPrefix) || path === efc.callSignature) {
|
|
4210
|
+
filteredSchema[path] = type;
|
|
4211
|
+
}
|
|
4212
|
+
}
|
|
4213
|
+
// Build perVariableSchemas from the filtered schema
|
|
4214
|
+
// For destructuring, filter paths by variable name
|
|
4215
|
+
if (Object.keys(filteredSchema).length > 0) {
|
|
4216
|
+
perVariableSchemas = {};
|
|
4217
|
+
for (const varName of efc.receivingVariableNames ?? []) {
|
|
4218
|
+
// For destructuring, extract only paths specific to this variable
|
|
4219
|
+
const varSpecificPrefix = `${callSigPrefix}.${varName}`;
|
|
4220
|
+
const varSchema = {};
|
|
4221
|
+
for (const [path, type] of Object.entries(filteredSchema)) {
|
|
4222
|
+
if (path.startsWith(varSpecificPrefix)) {
|
|
4223
|
+
// Transform: useLoaderData().functionCallReturnValue.entities.sha
|
|
4224
|
+
// -> functionCallReturnValue.entities.sha (keep the variable name)
|
|
4225
|
+
const suffix = path.slice(callSigPrefix.length);
|
|
4226
|
+
const returnValuePath = `functionCallReturnValue${suffix}`;
|
|
4227
|
+
varSchema[returnValuePath] = type;
|
|
4228
|
+
}
|
|
4229
|
+
else if (path === efc.callSignature) {
|
|
4230
|
+
// Include the function call type itself
|
|
4231
|
+
varSchema[path] = type;
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4234
|
+
if (Object.keys(varSchema).length > 0) {
|
|
4235
|
+
perVariableSchemas[varName] = varSchema;
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
// Only include if we have entries
|
|
4239
|
+
if (Object.keys(perVariableSchemas).length === 0) {
|
|
4240
|
+
perVariableSchemas = undefined;
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4244
|
+
// Fallback: extract from root scope schema when perCallSignatureSchemas is not available
|
|
4245
|
+
// or doesn't have distinct entries for each variable.
|
|
4246
|
+
// This works when field accesses are in the root scope.
|
|
4247
|
+
if (!perVariableSchemas &&
|
|
4248
|
+
efc.receivingVariableNames &&
|
|
4249
|
+
efc.receivingVariableNames.length > 0) {
|
|
4250
|
+
perVariableSchemas = {};
|
|
4251
|
+
for (const varName of efc.receivingVariableNames) {
|
|
4252
|
+
const varSchema = {};
|
|
4253
|
+
for (const [path, type] of Object.entries(rootSchema)) {
|
|
4254
|
+
// Check if path starts with this variable name
|
|
4255
|
+
if (path === varName ||
|
|
4256
|
+
path.startsWith(varName + '.') ||
|
|
4257
|
+
path.startsWith(varName + '[')) {
|
|
4258
|
+
// Transform to functionCallReturnValue format
|
|
4259
|
+
// e.g., userFetcher.data.id -> functionCallReturnValue.data.id
|
|
4260
|
+
const suffix = path.slice(varName.length);
|
|
4261
|
+
const returnValuePath = `functionCallReturnValue${suffix}`;
|
|
4262
|
+
varSchema[returnValuePath] = type;
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
if (Object.keys(varSchema).length > 0) {
|
|
4266
|
+
// Clean the variable name when using as key in output
|
|
4267
|
+
perVariableSchemas[cleanCyScope(varName)] = varSchema;
|
|
4268
|
+
}
|
|
4269
|
+
}
|
|
4270
|
+
// Only include if we have any entries
|
|
4271
|
+
if (Object.keys(perVariableSchemas).length === 0) {
|
|
4272
|
+
perVariableSchemas = undefined;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
// Enrich the schema with inferred types by applying fillInSchemaGapsAndUnknowns.
|
|
4276
|
+
// This ensures the serialized schema has the same type inference as getReturnValue().
|
|
4277
|
+
// Without this, evidence like "entities[].analyses: array" becomes "unknown".
|
|
4278
|
+
const enrichedSchema = { ...efc.schema };
|
|
4279
|
+
const tempScopeNode = {
|
|
4280
|
+
name: efc.name,
|
|
4281
|
+
schema: enrichedSchema,
|
|
4282
|
+
equivalencies: efc.equivalencies ?? {},
|
|
4283
|
+
};
|
|
4284
|
+
fillInSchemaGapsAndUnknowns(tempScopeNode, true);
|
|
4285
|
+
return {
|
|
4286
|
+
name: efc.name,
|
|
4287
|
+
callSignature: efc.callSignature,
|
|
4288
|
+
callScope: efc.callScope,
|
|
4289
|
+
schema: enrichedSchema,
|
|
4290
|
+
equivalencies: efc.equivalencies
|
|
4291
|
+
? Object.entries(efc.equivalencies).reduce((acc, [key, vars]) => {
|
|
4292
|
+
// Clean cyScope from the key as well as variable properties
|
|
4293
|
+
acc[cleanCyScope(key)] = toSerializableVariable(vars);
|
|
4294
|
+
return acc;
|
|
4295
|
+
}, {})
|
|
4296
|
+
: undefined,
|
|
4297
|
+
allCallSignatures: efc.allCallSignatures,
|
|
4298
|
+
receivingVariableNames: efc.receivingVariableNames?.map(cleanCyScope),
|
|
4299
|
+
callSignatureToVariable: efc.callSignatureToVariable
|
|
4300
|
+
? Object.fromEntries(Object.entries(efc.callSignatureToVariable).map(([k, v]) => [
|
|
4301
|
+
k,
|
|
4302
|
+
cleanCyScope(v),
|
|
4303
|
+
]))
|
|
4304
|
+
: undefined,
|
|
4305
|
+
perVariableSchemas,
|
|
4306
|
+
};
|
|
4307
|
+
});
|
|
4308
|
+
// POST-PROCESSING: Deduplicate schemas across parameterized calls to same base function
|
|
4309
|
+
// When useFetcher<ConfigData>() and useFetcher<SettingsData>() are called, they create
|
|
4310
|
+
// separate entries. Due to variable reassignment, BOTH entries may have ALL fields.
|
|
4311
|
+
// We deduplicate by assigning each field to ONLY ONE entry based on order of appearance.
|
|
4312
|
+
//
|
|
4313
|
+
// Strategy: Fields that appear first in order belong to the first entry,
|
|
4314
|
+
// fields that appear later belong to later entries (split evenly).
|
|
4315
|
+
const deduplicateParameterizedEntries = (entries) => {
|
|
4316
|
+
// Group entries by base function name (without type parameters)
|
|
4317
|
+
const groups = new Map();
|
|
4318
|
+
for (const entry of entries) {
|
|
4319
|
+
// Extract base function name by stripping type parameters
|
|
4320
|
+
// e.g., "useFetcher<{ data: ConfigData | null }>" -> "useFetcher"
|
|
4321
|
+
const baseName = entry.name.replace(/<.*>$/, '');
|
|
4322
|
+
const group = groups.get(baseName) || [];
|
|
4323
|
+
group.push(entry);
|
|
4324
|
+
groups.set(baseName, group);
|
|
4325
|
+
}
|
|
4326
|
+
// Process groups with multiple parameterized entries
|
|
4327
|
+
for (const [, group] of groups) {
|
|
4328
|
+
if (group.length <= 1)
|
|
4329
|
+
continue;
|
|
4330
|
+
// Check if these are parameterized calls (have type parameters in name)
|
|
4331
|
+
const hasTypeParams = group.every((e) => e.name.includes('<'));
|
|
4332
|
+
if (!hasTypeParams)
|
|
4333
|
+
continue;
|
|
4334
|
+
// Collect ALL unique field suffixes across all entries (in order of first appearance)
|
|
4335
|
+
// Field suffix is the path after functionCallReturnValue, e.g., ".data.data.theme"
|
|
4336
|
+
const allFieldSuffixes = [];
|
|
4337
|
+
for (const entry of group) {
|
|
4338
|
+
if (!entry.perVariableSchemas)
|
|
4339
|
+
continue;
|
|
4340
|
+
for (const varSchema of Object.values(entry.perVariableSchemas)) {
|
|
4341
|
+
for (const path of Object.keys(varSchema)) {
|
|
4342
|
+
// Skip the base "functionCallReturnValue" entry
|
|
4343
|
+
if (path === 'functionCallReturnValue')
|
|
4344
|
+
continue;
|
|
4345
|
+
// Extract field suffix
|
|
4346
|
+
const match = path.match(/functionCallReturnValue(.+)/);
|
|
4347
|
+
if (!match)
|
|
4348
|
+
continue;
|
|
4349
|
+
const fieldSuffix = match[1];
|
|
4350
|
+
if (!allFieldSuffixes.includes(fieldSuffix)) {
|
|
4351
|
+
allFieldSuffixes.push(fieldSuffix);
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
// Assign fields to entries: split evenly based on order
|
|
4357
|
+
// First N/2 fields go to first entry, remaining go to second entry
|
|
4358
|
+
const fieldToEntryMap = new Map();
|
|
4359
|
+
const fieldsPerEntry = Math.ceil(allFieldSuffixes.length / group.length);
|
|
4360
|
+
for (let i = 0; i < allFieldSuffixes.length; i++) {
|
|
4361
|
+
const fieldSuffix = allFieldSuffixes[i];
|
|
4362
|
+
const entryIdx = Math.min(Math.floor(i / fieldsPerEntry), group.length - 1);
|
|
4363
|
+
fieldToEntryMap.set(fieldSuffix, entryIdx);
|
|
4364
|
+
}
|
|
4365
|
+
// Filter each entry's perVariableSchemas to only include its assigned fields
|
|
4366
|
+
for (let i = 0; i < group.length; i++) {
|
|
4367
|
+
const entry = group[i];
|
|
4368
|
+
if (!entry.perVariableSchemas)
|
|
4369
|
+
continue;
|
|
4370
|
+
const filteredPerVarSchemas = {};
|
|
4371
|
+
for (const [varName, varSchema] of Object.entries(entry.perVariableSchemas)) {
|
|
4372
|
+
const filteredVarSchema = {};
|
|
4373
|
+
for (const [path, type] of Object.entries(varSchema)) {
|
|
4374
|
+
// Always keep the base functionCallReturnValue
|
|
4375
|
+
if (path === 'functionCallReturnValue') {
|
|
4376
|
+
filteredVarSchema[path] = type;
|
|
4377
|
+
continue;
|
|
4378
|
+
}
|
|
4379
|
+
// Extract field suffix
|
|
4380
|
+
const match = path.match(/functionCallReturnValue(.+)/);
|
|
4381
|
+
if (!match) {
|
|
4382
|
+
// Keep non-field paths
|
|
4383
|
+
filteredVarSchema[path] = type;
|
|
4384
|
+
continue;
|
|
4385
|
+
}
|
|
4386
|
+
const fieldSuffix = match[1];
|
|
4387
|
+
// Only include if this entry owns this field
|
|
4388
|
+
if (fieldToEntryMap.get(fieldSuffix) === i) {
|
|
4389
|
+
filteredVarSchema[path] = type;
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
if (Object.keys(filteredVarSchema).length > 0) {
|
|
4393
|
+
filteredPerVarSchemas[varName] = filteredVarSchema;
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
entry.perVariableSchemas =
|
|
4397
|
+
Object.keys(filteredPerVarSchemas).length > 0
|
|
4398
|
+
? filteredPerVarSchemas
|
|
4399
|
+
: undefined;
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
return entries;
|
|
4403
|
+
};
|
|
4404
|
+
// Apply deduplication
|
|
4405
|
+
const deduplicatedExternalFunctionCalls = deduplicateParameterizedEntries(externalFunctionCalls);
|
|
4406
|
+
// IMPORTANT: Get equivalent signature variables BEFORE calling getFunctionResult
|
|
4407
|
+
// because getFunctionResult calls validateSchema which may remove equivalencies
|
|
4408
|
+
// during the finalize step (e.g., cleanNonObjectFunctions removes method call
|
|
4409
|
+
// equivalencies like `segments -> splat.split('/').functionCallReturnValue`).
|
|
4410
|
+
// Fix 33: Move this call before any schema validation to preserve method call chains.
|
|
4411
|
+
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
1777
4412
|
// Get root function result
|
|
1778
4413
|
const rootFunction = getFunctionResult();
|
|
1779
|
-
// Get results for each external function
|
|
4414
|
+
// Get results for each external function (use cleaned calls for consistency)
|
|
1780
4415
|
const functionResults = {};
|
|
1781
|
-
for (const efc of
|
|
4416
|
+
for (const efc of cleanedExternalCalls) {
|
|
1782
4417
|
functionResults[efc.name] = getFunctionResult(efc.name);
|
|
1783
4418
|
}
|
|
1784
|
-
// Get equivalent signature variables
|
|
1785
|
-
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
1786
4419
|
const environmentVariables = this.getEnvironmentVariables();
|
|
4420
|
+
// Get enriched conditional usages with source tracing
|
|
4421
|
+
const enrichedConditionalUsages = this.getEnrichedConditionalUsages();
|
|
4422
|
+
const conditionalUsages = Object.keys(enrichedConditionalUsages).length > 0
|
|
4423
|
+
? enrichedConditionalUsages
|
|
4424
|
+
: undefined;
|
|
4425
|
+
// Get conditional effects (setter calls inside conditionals)
|
|
4426
|
+
const conditionalEffects = this.rawConditionalEffects.length > 0
|
|
4427
|
+
? this.rawConditionalEffects
|
|
4428
|
+
: undefined;
|
|
4429
|
+
// Get compound conditionals (grouped conditions that must all be true)
|
|
4430
|
+
const compoundConditionals = this.rawCompoundConditionals.length > 0
|
|
4431
|
+
? this.rawCompoundConditionals
|
|
4432
|
+
: undefined;
|
|
4433
|
+
// Get child boundary gating conditions
|
|
4434
|
+
const enrichedGatingConditions = this.getEnrichedChildBoundaryGatingConditions();
|
|
4435
|
+
const childBoundaryGatingConditions = Object.keys(enrichedGatingConditions).length > 0
|
|
4436
|
+
? enrichedGatingConditions
|
|
4437
|
+
: undefined;
|
|
4438
|
+
// Get JSX rendering usages (arrays via .map(), strings via interpolation)
|
|
4439
|
+
const jsxRenderingUsages = this.rawJsxRenderingUsages.length > 0
|
|
4440
|
+
? this.rawJsxRenderingUsages
|
|
4441
|
+
: undefined;
|
|
1787
4442
|
return {
|
|
1788
|
-
externalFunctionCalls,
|
|
4443
|
+
externalFunctionCalls: deduplicatedExternalFunctionCalls,
|
|
1789
4444
|
rootFunction,
|
|
1790
4445
|
functionResults,
|
|
1791
4446
|
equivalentSignatureVariables,
|
|
1792
4447
|
environmentVariables,
|
|
4448
|
+
conditionalUsages,
|
|
4449
|
+
conditionalEffects,
|
|
4450
|
+
compoundConditionals,
|
|
4451
|
+
childBoundaryGatingConditions,
|
|
4452
|
+
jsxRenderingUsages,
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
4456
|
+
// DEBUGGING HELPERS
|
|
4457
|
+
// These methods help understand what's happening during analysis.
|
|
4458
|
+
// Use them when investigating why a path is missing or has the wrong type.
|
|
4459
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
4460
|
+
/**
|
|
4461
|
+
* Explains a path by tracing its equivalencies and showing where data comes from.
|
|
4462
|
+
*
|
|
4463
|
+
* @example
|
|
4464
|
+
* ```typescript
|
|
4465
|
+
* const explanation = sds.explainPath('MyComponent', 'user.id');
|
|
4466
|
+
* console.log(explanation);
|
|
4467
|
+
* // {
|
|
4468
|
+
* // path: 'user.id',
|
|
4469
|
+
* // scope: 'MyComponent',
|
|
4470
|
+
* // schemaValue: 'string',
|
|
4471
|
+
* // equivalencies: [
|
|
4472
|
+
* // { scope: 'MyComponent', path: 'signature[0].user.id' },
|
|
4473
|
+
* // { scope: 'UserProfile', path: 'props.user.id' }
|
|
4474
|
+
* // ],
|
|
4475
|
+
* // source: { scope: 'fetchUser', path: 'functionCallReturnValue(fetch).data.user.id' }
|
|
4476
|
+
* // }
|
|
4477
|
+
* ```
|
|
4478
|
+
*/
|
|
4479
|
+
explainPath(scopeName, path) {
|
|
4480
|
+
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName);
|
|
4481
|
+
if (!scopeNode) {
|
|
4482
|
+
return {
|
|
4483
|
+
path,
|
|
4484
|
+
scope: scopeName,
|
|
4485
|
+
schemaValue: undefined,
|
|
4486
|
+
equivalencies: [],
|
|
4487
|
+
databaseEntry: undefined,
|
|
4488
|
+
source: undefined,
|
|
4489
|
+
};
|
|
4490
|
+
}
|
|
4491
|
+
const schemaValue = scopeNode.schema?.[path];
|
|
4492
|
+
const rawEquivalencies = scopeNode.equivalencies?.[path] ?? [];
|
|
4493
|
+
const equivalencies = rawEquivalencies.map((eq) => ({
|
|
4494
|
+
scope: eq.scopeNodeName,
|
|
4495
|
+
path: eq.schemaPath,
|
|
4496
|
+
reason: eq.equivalencyReason,
|
|
4497
|
+
}));
|
|
4498
|
+
const databaseEntry = this.getEquivalenciesDatabaseEntry(scopeName, path);
|
|
4499
|
+
const source = databaseEntry?.sourceCandidates?.[0] &&
|
|
4500
|
+
databaseEntry.sourceCandidates.length > 0
|
|
4501
|
+
? {
|
|
4502
|
+
scope: databaseEntry.sourceCandidates[0].scopeNodeName,
|
|
4503
|
+
path: databaseEntry.sourceCandidates[0].schemaPath,
|
|
4504
|
+
}
|
|
4505
|
+
: undefined;
|
|
4506
|
+
return {
|
|
4507
|
+
path,
|
|
4508
|
+
scope: scopeName,
|
|
4509
|
+
schemaValue,
|
|
4510
|
+
equivalencies,
|
|
4511
|
+
databaseEntry,
|
|
4512
|
+
source,
|
|
1793
4513
|
};
|
|
1794
4514
|
}
|
|
4515
|
+
/**
|
|
4516
|
+
* Dumps the current state of analysis for inspection.
|
|
4517
|
+
* Useful for understanding the overall state or finding issues.
|
|
4518
|
+
*
|
|
4519
|
+
* @param options - What to include in the dump
|
|
4520
|
+
* @returns A summary object with requested data
|
|
4521
|
+
*/
|
|
4522
|
+
dumpState(options) {
|
|
4523
|
+
const includeSchemas = options?.includeSchemas ?? false;
|
|
4524
|
+
const includeEquivalencies = options?.includeEquivalencies ?? false;
|
|
4525
|
+
const scopeFilter = options?.scopeFilter;
|
|
4526
|
+
const scopeNames = Object.keys(this.scopeNodes).filter((name) => !scopeFilter || name.includes(scopeFilter));
|
|
4527
|
+
const scopes = scopeNames.map((name) => {
|
|
4528
|
+
const node = this.scopeNodes[name];
|
|
4529
|
+
const result = {
|
|
4530
|
+
name,
|
|
4531
|
+
schemaKeyCount: Object.keys(node.schema ?? {}).length,
|
|
4532
|
+
equivalencyKeyCount: Object.keys(node.equivalencies ?? {}).length,
|
|
4533
|
+
functionCallCount: node.functionCalls?.length ?? 0,
|
|
4534
|
+
};
|
|
4535
|
+
if (includeSchemas) {
|
|
4536
|
+
result.schema = node.schema;
|
|
4537
|
+
}
|
|
4538
|
+
if (includeEquivalencies) {
|
|
4539
|
+
result.equivalencies = Object.entries(node.equivalencies ?? {}).reduce((acc, [key, vals]) => {
|
|
4540
|
+
acc[key] = vals.map((v) => ({
|
|
4541
|
+
scope: v.scopeNodeName,
|
|
4542
|
+
path: v.schemaPath,
|
|
4543
|
+
}));
|
|
4544
|
+
return acc;
|
|
4545
|
+
}, {});
|
|
4546
|
+
}
|
|
4547
|
+
return result;
|
|
4548
|
+
});
|
|
4549
|
+
return {
|
|
4550
|
+
scopeCount: Object.keys(this.scopeNodes).length,
|
|
4551
|
+
externalCallCount: this.externalFunctionCalls.length,
|
|
4552
|
+
equivalencyDatabaseSize: this.equivalencyDatabase.length,
|
|
4553
|
+
metrics: {
|
|
4554
|
+
addToSchemaCallCount,
|
|
4555
|
+
followEquivalenciesCallCount,
|
|
4556
|
+
maxEquivalencyChainDepth,
|
|
4557
|
+
},
|
|
4558
|
+
scopes,
|
|
4559
|
+
};
|
|
4560
|
+
}
|
|
4561
|
+
/**
|
|
4562
|
+
* Traces the full equivalency chain for a path, showing how data flows.
|
|
4563
|
+
* This is the most detailed debugging tool for understanding data tracing.
|
|
4564
|
+
*
|
|
4565
|
+
* @example
|
|
4566
|
+
* ```typescript
|
|
4567
|
+
* const chain = sds.traceEquivalencyChain('MyComponent', 'user.id');
|
|
4568
|
+
* // Returns array of steps showing how user.id is traced back to its source
|
|
4569
|
+
* ```
|
|
4570
|
+
*/
|
|
4571
|
+
traceEquivalencyChain(scopeName, path, maxDepth = 20) {
|
|
4572
|
+
const chain = [];
|
|
4573
|
+
const visited = new Set();
|
|
4574
|
+
const queue = [
|
|
4575
|
+
{ scope: scopeName, path, depth: 0 },
|
|
4576
|
+
];
|
|
4577
|
+
while (queue.length > 0 && chain.length < maxDepth) {
|
|
4578
|
+
const current = queue.shift();
|
|
4579
|
+
const key = `${current.scope}::${current.path}`;
|
|
4580
|
+
if (visited.has(key))
|
|
4581
|
+
continue;
|
|
4582
|
+
visited.add(key);
|
|
4583
|
+
const scopeNode = this.getScopeOrFunctionCallInfo(current.scope);
|
|
4584
|
+
const schemaValue = scopeNode?.schema?.[current.path];
|
|
4585
|
+
const rawEquivalencies = scopeNode?.equivalencies?.[current.path] ?? [];
|
|
4586
|
+
const nextEquivalencies = rawEquivalencies.map((eq) => ({
|
|
4587
|
+
scope: eq.scopeNodeName,
|
|
4588
|
+
path: eq.schemaPath,
|
|
4589
|
+
reason: eq.equivalencyReason,
|
|
4590
|
+
}));
|
|
4591
|
+
chain.push({
|
|
4592
|
+
step: chain.length + 1,
|
|
4593
|
+
scope: current.scope,
|
|
4594
|
+
path: current.path,
|
|
4595
|
+
schemaValue,
|
|
4596
|
+
nextEquivalencies,
|
|
4597
|
+
});
|
|
4598
|
+
// Add next equivalencies to queue for further tracing
|
|
4599
|
+
for (const eq of nextEquivalencies) {
|
|
4600
|
+
const nextKey = `${eq.scope}::${eq.path}`;
|
|
4601
|
+
if (!visited.has(nextKey)) {
|
|
4602
|
+
queue.push({
|
|
4603
|
+
scope: eq.scope,
|
|
4604
|
+
path: eq.path,
|
|
4605
|
+
depth: current.depth + 1,
|
|
4606
|
+
});
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
return chain;
|
|
4611
|
+
}
|
|
4612
|
+
/**
|
|
4613
|
+
* Finds all paths in a scope that match a pattern.
|
|
4614
|
+
* Useful for finding related paths when debugging.
|
|
4615
|
+
*
|
|
4616
|
+
* @example
|
|
4617
|
+
* ```typescript
|
|
4618
|
+
* const paths = sds.findPaths('MyComponent', /user/);
|
|
4619
|
+
* // Returns all schema paths containing "user"
|
|
4620
|
+
* ```
|
|
4621
|
+
*/
|
|
4622
|
+
findPaths(scopeName, pattern) {
|
|
4623
|
+
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName);
|
|
4624
|
+
if (!scopeNode)
|
|
4625
|
+
return [];
|
|
4626
|
+
const regex = typeof pattern === 'string' ? new RegExp(pattern) : pattern;
|
|
4627
|
+
const results = [];
|
|
4628
|
+
// Search in schema
|
|
4629
|
+
for (const [path, value] of Object.entries(scopeNode.schema ?? {})) {
|
|
4630
|
+
if (regex.test(path)) {
|
|
4631
|
+
results.push({
|
|
4632
|
+
path,
|
|
4633
|
+
value,
|
|
4634
|
+
hasEquivalencies: !!scopeNode.equivalencies?.[path]?.length,
|
|
4635
|
+
});
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
// Also search equivalency keys that might not be in schema
|
|
4639
|
+
for (const path of Object.keys(scopeNode.equivalencies ?? {})) {
|
|
4640
|
+
if (regex.test(path) && !results.find((r) => r.path === path)) {
|
|
4641
|
+
results.push({
|
|
4642
|
+
path,
|
|
4643
|
+
value: scopeNode.schema?.[path] ?? 'not-in-schema',
|
|
4644
|
+
hasEquivalencies: true,
|
|
4645
|
+
});
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
return results.sort((a, b) => a.path.localeCompare(b.path));
|
|
4649
|
+
}
|
|
4650
|
+
/**
|
|
4651
|
+
* Returns a summary of why a path might be missing from the schema.
|
|
4652
|
+
* Checks common issues that cause paths to not appear.
|
|
4653
|
+
*/
|
|
4654
|
+
diagnoseMissingPath(scopeName, path) {
|
|
4655
|
+
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName);
|
|
4656
|
+
const possibleReasons = [];
|
|
4657
|
+
const suggestions = [];
|
|
4658
|
+
if (!scopeNode) {
|
|
4659
|
+
possibleReasons.push(`Scope "${scopeName}" does not exist`);
|
|
4660
|
+
suggestions.push(`Available scopes: ${Object.keys(this.scopeNodes).join(', ')}`);
|
|
4661
|
+
return {
|
|
4662
|
+
exists: false,
|
|
4663
|
+
inSchema: false,
|
|
4664
|
+
inEquivalencies: false,
|
|
4665
|
+
possibleReasons,
|
|
4666
|
+
suggestions,
|
|
4667
|
+
};
|
|
4668
|
+
}
|
|
4669
|
+
const inSchema = path in (scopeNode.schema ?? {});
|
|
4670
|
+
const inEquivalencies = path in (scopeNode.equivalencies ?? {});
|
|
4671
|
+
if (inSchema) {
|
|
4672
|
+
return {
|
|
4673
|
+
exists: true,
|
|
4674
|
+
inSchema: true,
|
|
4675
|
+
inEquivalencies,
|
|
4676
|
+
possibleReasons: [],
|
|
4677
|
+
suggestions: [],
|
|
4678
|
+
};
|
|
4679
|
+
}
|
|
4680
|
+
// Check for similar paths
|
|
4681
|
+
const allPaths = [
|
|
4682
|
+
...Object.keys(scopeNode.schema ?? {}),
|
|
4683
|
+
...Object.keys(scopeNode.equivalencies ?? {}),
|
|
4684
|
+
];
|
|
4685
|
+
const similarPaths = allPaths.filter((p) => {
|
|
4686
|
+
const pathParts = path.split('.');
|
|
4687
|
+
const pParts = p.split('.');
|
|
4688
|
+
return (pathParts.some((part) => pParts.includes(part)) ||
|
|
4689
|
+
p.includes(path) ||
|
|
4690
|
+
path.includes(p));
|
|
4691
|
+
});
|
|
4692
|
+
if (similarPaths.length > 0) {
|
|
4693
|
+
possibleReasons.push(`Path "${path}" not found but similar paths exist`);
|
|
4694
|
+
suggestions.push(`Similar paths: ${similarPaths.slice(0, 5).join(', ')}`);
|
|
4695
|
+
}
|
|
4696
|
+
// Check if it's a partial path
|
|
4697
|
+
const parentPath = path.split('.').slice(0, -1).join('.');
|
|
4698
|
+
if (parentPath && scopeNode.schema?.[parentPath]) {
|
|
4699
|
+
possibleReasons.push(`Parent path "${parentPath}" exists with value "${scopeNode.schema[parentPath]}"`);
|
|
4700
|
+
suggestions.push(`The property might not have been accessed in the analyzed code`);
|
|
4701
|
+
}
|
|
4702
|
+
// Check visited tracker
|
|
4703
|
+
const wasVisited = this.visitedTracker.wasVisited(scopeName, path);
|
|
4704
|
+
if (wasVisited) {
|
|
4705
|
+
possibleReasons.push(`Path was visited during analysis but not written`);
|
|
4706
|
+
suggestions.push(`Check if the path was filtered by isValidPath() or hit cycle detection`);
|
|
4707
|
+
}
|
|
4708
|
+
if (possibleReasons.length === 0) {
|
|
4709
|
+
possibleReasons.push(`Path "${path}" was never encountered during analysis`);
|
|
4710
|
+
suggestions.push(`Verify the path is accessed in the source code being analyzed`);
|
|
4711
|
+
}
|
|
4712
|
+
return {
|
|
4713
|
+
exists: false,
|
|
4714
|
+
inSchema,
|
|
4715
|
+
inEquivalencies,
|
|
4716
|
+
possibleReasons,
|
|
4717
|
+
suggestions,
|
|
4718
|
+
};
|
|
4719
|
+
}
|
|
4720
|
+
/**
|
|
4721
|
+
* Analyzes the stored equivalencies to provide aggregate statistics.
|
|
4722
|
+
* Call this AFTER analysis completes to understand equivalency patterns.
|
|
4723
|
+
*
|
|
4724
|
+
* @example
|
|
4725
|
+
* ```typescript
|
|
4726
|
+
* const analysis = sds.analyzeEquivalencies();
|
|
4727
|
+
* console.log(analysis.byReason); // Count by reason
|
|
4728
|
+
* console.log(analysis.byScope); // Count by scope
|
|
4729
|
+
* console.log(analysis.hotSpots); // Scopes with most equivalencies
|
|
4730
|
+
* ```
|
|
4731
|
+
*/
|
|
4732
|
+
analyzeEquivalencies() {
|
|
4733
|
+
const byReason = {};
|
|
4734
|
+
const byScope = {};
|
|
4735
|
+
let total = 0;
|
|
4736
|
+
// Collect from all scope nodes
|
|
4737
|
+
for (const scopeName of Object.keys(this.scopeNodes)) {
|
|
4738
|
+
const scopeNode = this.scopeNodes[scopeName];
|
|
4739
|
+
const equivalencies = scopeNode.equivalencies ?? {};
|
|
4740
|
+
for (const path of Object.keys(equivalencies)) {
|
|
4741
|
+
for (const eq of equivalencies[path]) {
|
|
4742
|
+
total++;
|
|
4743
|
+
const reason = eq.equivalencyReason ?? 'unknown';
|
|
4744
|
+
byReason[reason] = (byReason[reason] ?? 0) + 1;
|
|
4745
|
+
byScope[scopeName] = (byScope[scopeName] ?? 0) + 1;
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4748
|
+
}
|
|
4749
|
+
// Also check external function calls
|
|
4750
|
+
for (const fc of this.externalFunctionCalls) {
|
|
4751
|
+
const equivalencies = fc.equivalencies ?? {};
|
|
4752
|
+
for (const path of Object.keys(equivalencies)) {
|
|
4753
|
+
for (const eq of equivalencies[path]) {
|
|
4754
|
+
total++;
|
|
4755
|
+
const reason = eq.equivalencyReason ?? 'unknown';
|
|
4756
|
+
byReason[reason] = (byReason[reason] ?? 0) + 1;
|
|
4757
|
+
byScope[fc.name] = (byScope[fc.name] ?? 0) + 1;
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
// Find hot spots (scopes with most equivalencies)
|
|
4762
|
+
const hotSpots = Object.entries(byScope)
|
|
4763
|
+
.map(([scope, count]) => ({ scope, count }))
|
|
4764
|
+
.sort((a, b) => b.count - a.count)
|
|
4765
|
+
.slice(0, 10);
|
|
4766
|
+
// Find reasons that appear in stored equivalencies but aren't in ALLOWED list
|
|
4767
|
+
const unusedReasons = Object.keys(byReason).filter((reason) => !ALLOWED_EQUIVALENCY_REASONS.has(reason));
|
|
4768
|
+
return {
|
|
4769
|
+
total,
|
|
4770
|
+
byReason,
|
|
4771
|
+
byScope,
|
|
4772
|
+
hotSpots,
|
|
4773
|
+
unusedReasons,
|
|
4774
|
+
};
|
|
4775
|
+
}
|
|
4776
|
+
/**
|
|
4777
|
+
* Validates equivalencies and identifies potential problems.
|
|
4778
|
+
* Returns actionable issues that may indicate bugs or optimization opportunities.
|
|
4779
|
+
*
|
|
4780
|
+
* @example
|
|
4781
|
+
* ```typescript
|
|
4782
|
+
* const issues = sds.validateEquivalencies();
|
|
4783
|
+
* if (issues.length > 0) {
|
|
4784
|
+
* console.log('Found issues:', issues);
|
|
4785
|
+
* }
|
|
4786
|
+
* ```
|
|
4787
|
+
*/
|
|
4788
|
+
validateEquivalencies() {
|
|
4789
|
+
const issues = [];
|
|
4790
|
+
const allScopeNames = new Set([
|
|
4791
|
+
...Object.keys(this.scopeNodes),
|
|
4792
|
+
...this.externalFunctionCalls.map((fc) => fc.name),
|
|
4793
|
+
]);
|
|
4794
|
+
// Check all scope nodes
|
|
4795
|
+
for (const scopeName of Object.keys(this.scopeNodes)) {
|
|
4796
|
+
const scopeNode = this.scopeNodes[scopeName];
|
|
4797
|
+
const equivalencies = scopeNode.equivalencies ?? {};
|
|
4798
|
+
for (const [path, eqs] of Object.entries(equivalencies)) {
|
|
4799
|
+
for (const eq of eqs) {
|
|
4800
|
+
// Check 1: Does the target scope exist?
|
|
4801
|
+
if (!allScopeNames.has(eq.scopeNodeName)) {
|
|
4802
|
+
issues.push({
|
|
4803
|
+
type: 'broken_reference',
|
|
4804
|
+
severity: 'error',
|
|
4805
|
+
scope: scopeName,
|
|
4806
|
+
path,
|
|
4807
|
+
details: `Equivalency points to non-existent scope "${eq.scopeNodeName}"`,
|
|
4808
|
+
});
|
|
4809
|
+
continue;
|
|
4810
|
+
}
|
|
4811
|
+
// Check 2: Does the target path exist in target scope's schema or equivalencies?
|
|
4812
|
+
const targetScope = this.getScopeOrFunctionCallInfo(eq.scopeNodeName);
|
|
4813
|
+
if (targetScope) {
|
|
4814
|
+
const hasInSchema = eq.schemaPath in (targetScope.schema ?? {});
|
|
4815
|
+
const hasInEquivalencies = eq.schemaPath in (targetScope.equivalencies ?? {});
|
|
4816
|
+
// Only flag as dead end if it's a leaf path (no sub-properties exist)
|
|
4817
|
+
if (!hasInSchema && !hasInEquivalencies) {
|
|
4818
|
+
const hasSubPaths = Object.keys(targetScope.schema ?? {}).some((p) => p.startsWith(eq.schemaPath + '.') ||
|
|
4819
|
+
p.startsWith(eq.schemaPath + '['));
|
|
4820
|
+
if (!hasSubPaths) {
|
|
4821
|
+
issues.push({
|
|
4822
|
+
type: 'dead_end',
|
|
4823
|
+
severity: 'warning',
|
|
4824
|
+
scope: scopeName,
|
|
4825
|
+
path,
|
|
4826
|
+
details: `Equivalency to "${eq.scopeNodeName}::${eq.schemaPath}" - path not in schema`,
|
|
4827
|
+
});
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
// Check 3: Trace chain depth
|
|
4833
|
+
const chain = this.traceEquivalencyChain(scopeName, path, 50);
|
|
4834
|
+
if (chain.length >= 20) {
|
|
4835
|
+
issues.push({
|
|
4836
|
+
type: 'long_chain',
|
|
4837
|
+
severity: 'warning',
|
|
4838
|
+
scope: scopeName,
|
|
4839
|
+
path,
|
|
4840
|
+
details: `Equivalency chain depth is ${chain.length} (may impact performance)`,
|
|
4841
|
+
});
|
|
4842
|
+
}
|
|
4843
|
+
// Check for potential cycles (chain that returns to starting point)
|
|
4844
|
+
const visited = new Set();
|
|
4845
|
+
for (const step of chain) {
|
|
4846
|
+
const key = `${step.scope}::${step.path}`;
|
|
4847
|
+
if (visited.has(key)) {
|
|
4848
|
+
issues.push({
|
|
4849
|
+
type: 'circular',
|
|
4850
|
+
severity: 'warning',
|
|
4851
|
+
scope: scopeName,
|
|
4852
|
+
path,
|
|
4853
|
+
details: `Circular reference detected at ${key}`,
|
|
4854
|
+
});
|
|
4855
|
+
break;
|
|
4856
|
+
}
|
|
4857
|
+
visited.add(key);
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
return issues;
|
|
4862
|
+
}
|
|
1795
4863
|
}
|
|
1796
4864
|
//# sourceMappingURL=ScopeDataStructure.js.map
|