@codeyam/codeyam-cli 0.1.0-staging.15d0f46 → 0.1.0-staging.1669d45
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 +7 -7
- package/analyzer-template/common/execAsync.ts +1 -1
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +9 -5
- package/analyzer-template/packages/ai/index.ts +5 -3
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +152 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +107 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +42 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +38 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +301 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +972 -106
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +232 -0
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +18 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1409 -138
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +771 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +233 -75
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +39 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +42 -2
- package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +6 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +486 -86
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +182 -104
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +201 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1019 -0
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +276 -3
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +33 -3
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +71 -4
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -53
- 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/resolvePathToControllable.ts +690 -0
- package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +102 -0
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +458 -267
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +18 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
- package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +196 -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 +588 -52
- 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 +299 -133
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +156 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +384 -94
- 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/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 +2 -2
- package/analyzer-template/packages/aws/s3/index.ts +1 -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/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
- package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
- package/analyzer-template/packages/generate/index.ts +3 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
- 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 +26 -1
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +30 -7
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- 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 +16 -1
- 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/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 +27 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.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/loadOrCreateCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +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 +3 -0
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +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 +63 -13
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -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/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 +146 -0
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.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/src/lib/loadOrCreateCommit.ts +14 -0
- package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
- 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 +4 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +79 -13
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +161 -0
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- 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 +63 -13
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -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/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 +146 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.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/playwright/capture.ts +37 -18
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/analyzeBaselineCommit.ts +4 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +4 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +4 -0
- package/analyzer-template/project/constructMockCode.ts +868 -132
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +49 -33
- package/analyzer-template/project/orchestrateCapture.ts +10 -3
- package/analyzer-template/project/reconcileMockDataKeys.ts +102 -2
- package/analyzer-template/project/runAnalysis.ts +7 -0
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +26 -4
- package/analyzer-template/project/startScenarioCapture.ts +72 -40
- package/analyzer-template/project/writeMockDataTsx.ts +118 -55
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +263 -92
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +13 -15
- package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +2 -1
- package/background/src/lib/local/createLocalAnalyzer.js +1 -29
- 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 +1 -1
- package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +799 -121
- 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/executeLibraryFunctionDirect.js +6 -3
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.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/KyselyAnalysisLoader.js +3 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +42 -28
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +7 -4
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +87 -2
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +6 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +21 -4
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +56 -30
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +110 -48
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +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 +211 -75
- 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 +13 -13
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/src/cli.js +5 -1
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +1 -1
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +174 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/debug.js +28 -18
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +0 -15
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +44 -23
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +72 -24
- package/codeyam-cli/src/commands/report.js.map +1 -1
- 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/test-startup.js +1 -1
- package/codeyam-cli/src/commands/test-startup.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__/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 +27 -27
- package/codeyam-cli/src/utils/analysisRunner.js +8 -13
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +12 -2
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/database.js +91 -5
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +253 -106
- package/codeyam-cli/src/utils/generateReport.js.map +1 -1
- 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 +11 -11
- package/codeyam-cli/src/utils/install-skills.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/job.js +239 -16
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +19 -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/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +5 -5
- package/codeyam-cli/src/utils/versionInfo.js +25 -19
- package/codeyam-cli/src/utils/versionInfo.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/app/lib/database.js +96 -0
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +2 -5
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DKdsUF7Y.js → EntityTypeBadge-COi5OvsN.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BwdQv49w.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CEleMv_j.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D68KarMg.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-L75Wvqgw.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-C53WM8qn.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-CrNkmy4i.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CQifa1n-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CyaBFX7l.js +20 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CWjSsLqY.js → TruncatedFilePath-D36O1rzU.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +37 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DgTPh8H-.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-DdQKK6on.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-Dmr2bb1R.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-Do4ZLUYa.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
- 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-Bn6aCAy_.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CbdFyxZh.js +23 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-wDWZZO1W.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BMbl7MeQ.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-5wRKRIH9.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-DD3SDH7t.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-zXjT7J0G.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.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-DLbXwndH.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-gPZ-lad1.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-BsPXJ81F.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +57 -0
- package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-P2FKIUql.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-B2eDuBj8.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-L18M6-kN.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BDz7kbVA.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-29dDmbH8.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-CmrTPlIB.js → useLastLogLine-BUm0UVJm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CkIOKTrZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-C1ig_BmP.js → useToast-KKw5kTn-.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +228 -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-skill.md → codeyam:debug.md} +1 -1
- package/codeyam-cli/templates/codeyam:diagnose.md +625 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +139 -4
- package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam:sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam:test.md} +1 -1
- package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam:verify.md} +1 -1
- package/package.json +8 -8
- package/packages/ai/index.js +2 -4
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +107 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +76 -1
- 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 +29 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.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 +23 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +239 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +728 -87
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +24 -9
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +17 -1
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1126 -82
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +482 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +173 -55
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +35 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
- 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/fillInSchemaGapsAndUnknowns.js +34 -3
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/deepEqual.js +32 -0
- package/packages/ai/src/lib/deepEqual.js.map +1 -0
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +5 -0
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +398 -81
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +168 -82
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +123 -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 +742 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
- package/packages/ai/src/lib/getConditionalUsagesFromCode.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 +231 -4
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +26 -3
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -64
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +58 -4
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -34
- 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/resolvePathToControllable.js +563 -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/worker/SerializableDataStructure.js +22 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +15 -0
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
- 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/files/analyze/analyzeEntities/prepareDataStructures.js +214 -50
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +10 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
- package/packages/analyze/src/lib/files/analyzeInitial.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/scenarios/enrichArrayTypesFromChildSignatures.js +159 -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 +458 -48
- 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 +235 -81
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +96 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +307 -89
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- 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/src/lib/kysely/db.js +2 -2
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/generate/index.js +3 -0
- package/packages/generate/index.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.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 +27 -1
- package/packages/generate/src/lib/deepMerge.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/loadOrCreateCommit.js +10 -0
- package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
- package/packages/github/src/lib/syncPrimaryBranch.js.map +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/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
- 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/scripts/finalize-analyzer.cjs +3 -1
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
- 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.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/webserver/build/client/assets/EntityItem-D0VW1-W7.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BAk4S4pI.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-Y756iZxZ.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-zzrrjW1p.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-QMn7bJg6.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DmP5mRxX.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BXwvsbLw.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DAmUX_1y.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-Df-nk4J5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-_ZUyFdie.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-Eoh0PhcW.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CZgPLy5i.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-DI-p9ZLZ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DvyV2x6y.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DURu2qlF.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-DDobn9Xh.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CGdWnLD_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-DgMmzrKs.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-DEVXuhkn.js +0 -13
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-WPRQyc68.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-B9u3lJer.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-YGnKIuHU.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/globals-28lrWTTo.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/index-CJ0uPJjV.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/index-CfqeA2XG.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DIjSvh6B.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-8125c15c.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-BXl3LOEh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-C-g286WP.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-xBKWfOxd.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-DVY_wGOx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-Be1pJo5A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CR-FkSvx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DABetnSj.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DcR7DH9q.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BDBrfp7e.js +0 -175
- package/codeyam-cli/templates/debug-codeyam.md +0 -527
- 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 -136
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
- 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/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 -72
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
- /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/{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
|
@@ -82,21 +82,34 @@
|
|
|
82
82
|
import { ScopeAnalysis } from '~codeyam/types';
|
|
83
83
|
import { EquivalencyManager } from './equivalencyManagers/EquivalencyManager';
|
|
84
84
|
import fillInSchemaGapsAndUnknowns from './helpers/fillInSchemaGapsAndUnknowns';
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Patterns that indicate recursive type structures in schema paths.
|
|
88
|
+
* Used by hasExcessivePatternRepetition() to detect exponential path blowup.
|
|
89
|
+
*/
|
|
90
|
+
const RECURSIVE_PATH_PATTERNS = [
|
|
91
|
+
/\.attributes\.properties\[\]/g, // TypeScript AST JSX nodes
|
|
92
|
+
/\.children\[\]/g, // Tree structures
|
|
93
|
+
/\.elements\[\]/g, // Array-like structures
|
|
94
|
+
/\.members\[\]/g, // Class/interface members
|
|
95
|
+
/\.properties\[\]/g, // Object properties
|
|
96
|
+
/\.items\[\]/g, // Generic items arrays
|
|
97
|
+
];
|
|
85
98
|
import ensureSchemaConsistency from './helpers/ensureSchemaConsistency';
|
|
86
99
|
import cleanPath from './helpers/cleanPath';
|
|
87
100
|
import { PathManager } from './helpers/PathManager';
|
|
88
101
|
import {
|
|
89
102
|
uniqueId,
|
|
90
|
-
uniqueScopeVariables,
|
|
91
103
|
uniqueScopeAndPaths,
|
|
104
|
+
uniqueScopeVariables,
|
|
92
105
|
} from './helpers/uniqueIdUtils';
|
|
93
106
|
import selectBestValue from './helpers/selectBestValue';
|
|
94
107
|
import { VisitedTracker } from './helpers/VisitedTracker';
|
|
95
108
|
import { DebugTracer } from './helpers/DebugTracer';
|
|
96
109
|
import { BatchSchemaProcessor } from './helpers/BatchSchemaProcessor';
|
|
97
110
|
import {
|
|
98
|
-
ScopeTreeManager,
|
|
99
111
|
ROOT_SCOPE_NAME,
|
|
112
|
+
ScopeTreeManager,
|
|
100
113
|
ScopeTreeNode,
|
|
101
114
|
} from './helpers/ScopeTreeManager';
|
|
102
115
|
import cleanScopeNodeName from './helpers/cleanScopeNodeName';
|
|
@@ -108,6 +121,7 @@ import type {
|
|
|
108
121
|
SerializableFunctionCallInfo,
|
|
109
122
|
SerializableFunctionResult,
|
|
110
123
|
SerializableScopeVariable,
|
|
124
|
+
EnrichedConditionalUsage,
|
|
111
125
|
} from '../worker/SerializableDataStructure';
|
|
112
126
|
|
|
113
127
|
/**
|
|
@@ -125,6 +139,21 @@ export interface ScopeInfo {
|
|
|
125
139
|
isStatic?: boolean;
|
|
126
140
|
isClassScope?: boolean;
|
|
127
141
|
analysis?: any;
|
|
142
|
+
/** For JSX child scopes, the original JSX tag name (e.g., 'ChildViewer') */
|
|
143
|
+
jsxTagName?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Gating conditions detected during JSX extraction (before JSX is simplified).
|
|
146
|
+
* Maps child component name to conditions that must be true for it to render.
|
|
147
|
+
* This is populated by processJSXForScope in isolateScopes.ts.
|
|
148
|
+
*/
|
|
149
|
+
extractedGatingConditions?: {
|
|
150
|
+
[childComponentName: string]: Array<{
|
|
151
|
+
path: string;
|
|
152
|
+
conditionType: 'truthiness' | 'comparison';
|
|
153
|
+
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
154
|
+
isNegated?: boolean;
|
|
155
|
+
}>;
|
|
156
|
+
};
|
|
128
157
|
}
|
|
129
158
|
|
|
130
159
|
/**
|
|
@@ -221,6 +250,22 @@ export interface FunctionCallInfo {
|
|
|
221
250
|
* For example: { "db.select(query1)": "result1", "db.select(query2)": "result2" }
|
|
222
251
|
*/
|
|
223
252
|
callSignatureToVariable?: Record<string, string>;
|
|
253
|
+
/**
|
|
254
|
+
* Stores individual schemas per call signature BEFORE merging.
|
|
255
|
+
* When multiple calls to the same function are merged into one FunctionCallInfo,
|
|
256
|
+
* this preserves each call's distinct schema.
|
|
257
|
+
* Key is the call signature (e.g., "useFetcher()").
|
|
258
|
+
* Used internally; converted to perVariableSchemas in toSerializable().
|
|
259
|
+
*/
|
|
260
|
+
perCallSignatureSchemas?: Record<string, Record<string, string>>;
|
|
261
|
+
/**
|
|
262
|
+
* Stores individual return value schemas per receiving variable, BEFORE merging.
|
|
263
|
+
* When multiple calls to the same function have different return types
|
|
264
|
+
* (e.g., useFetcher<UserData>() vs useFetcher<ReportData>()), this preserves
|
|
265
|
+
* each call's distinct schema for mock data generation.
|
|
266
|
+
* Key is the receiving variable name (e.g., "userFetcher", "reportFetcher").
|
|
267
|
+
*/
|
|
268
|
+
perVariableSchemas?: Record<string, Record<string, string>>;
|
|
224
269
|
}
|
|
225
270
|
|
|
226
271
|
/**
|
|
@@ -320,6 +365,10 @@ const ALLOWED_EQUIVALENCY_REASONS = new Set([
|
|
|
320
365
|
'propagated function call return sub-property equivalency',
|
|
321
366
|
'propagated parent-variable equivalency', // Added: propagate child scope equivalencies to parent scope when variable is defined in parent
|
|
322
367
|
'where was this function called from', // Added: tracks which scope called an external function
|
|
368
|
+
'MUI DataGrid renderCell params.row equivalency', // Added: links DataGrid renderCell params.row to rows array elements
|
|
369
|
+
'MUI Autocomplete getOptionLabel option equivalency', // Added: links Autocomplete getOptionLabel callback param to options array
|
|
370
|
+
'MUI Autocomplete renderOption option equivalency', // Added: links Autocomplete renderOption callback param to options array
|
|
371
|
+
'MUI Autocomplete option property equivalency', // Added: propagates property accesses from Autocomplete callbacks
|
|
323
372
|
]);
|
|
324
373
|
|
|
325
374
|
const SILENTLY_IGNORED_EQUIVALENCY_REASONS = new Set([
|
|
@@ -364,6 +413,29 @@ export class ScopeDataStructure {
|
|
|
364
413
|
}>
|
|
365
414
|
> = {};
|
|
366
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Conditional effects collected during AST analysis.
|
|
418
|
+
* Tracks what setter calls happen inside conditionals (if, switch, ternary).
|
|
419
|
+
*/
|
|
420
|
+
private rawConditionalEffects: import('../astScopes/types').ConditionalEffect[] =
|
|
421
|
+
[];
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Compound conditionals collected during AST analysis.
|
|
425
|
+
* Groups conditions that must all be true together (e.g., a && b && c).
|
|
426
|
+
*/
|
|
427
|
+
private rawCompoundConditionals: import('../astScopes/types').CompoundConditional[] =
|
|
428
|
+
[];
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Gating conditions for child component boundaries.
|
|
432
|
+
* Maps child component name to the conditions that must be true for it to render.
|
|
433
|
+
*/
|
|
434
|
+
private rawChildBoundaryGatingConditions: Record<
|
|
435
|
+
string,
|
|
436
|
+
import('../astScopes/types').ConditionalUsage[]
|
|
437
|
+
> = {};
|
|
438
|
+
|
|
367
439
|
private lastAddToSchemaId = 0;
|
|
368
440
|
private lastEquivalencyId = 0;
|
|
369
441
|
private lastEquivalencyDatabaseId = 0;
|
|
@@ -382,6 +454,10 @@ export class ScopeDataStructure {
|
|
|
382
454
|
private externalFunctionCallsIndex: Map<string, FunctionCallInfo> | null =
|
|
383
455
|
null;
|
|
384
456
|
|
|
457
|
+
// Tracks internal functions that have been filtered out during captureCompleteSchema
|
|
458
|
+
// Prevents re-adding them via subsequent equivalency propagation (e.g., from getReturnValue)
|
|
459
|
+
private filteredInternalFunctions: Set<string> = new Set();
|
|
460
|
+
|
|
385
461
|
// Debug tracer for selective path/scope tracing
|
|
386
462
|
// Enable via: CODEYAM_DEBUG=true CODEYAM_DEBUG_PATHS="user.*,signature" npm test
|
|
387
463
|
private tracer: DebugTracer = new DebugTracer({
|
|
@@ -540,6 +616,8 @@ export class ScopeDataStructure {
|
|
|
540
616
|
const efcName = this.pathManager.stripGenerics(efc.name);
|
|
541
617
|
for (const manager of this.equivalencyManagers) {
|
|
542
618
|
if (manager.internalFunctions.has(efcName)) {
|
|
619
|
+
// Track this so we don't re-add it via subsequent finalize calls
|
|
620
|
+
this.filteredInternalFunctions.add(efcName);
|
|
543
621
|
return false;
|
|
544
622
|
}
|
|
545
623
|
}
|
|
@@ -567,13 +645,51 @@ export class ScopeDataStructure {
|
|
|
567
645
|
const baseName = this.pathManager.stripGenerics(
|
|
568
646
|
candidate.scopeNodeName,
|
|
569
647
|
);
|
|
648
|
+
// Check if this is a local variable path (doesn't contain function call pattern)
|
|
649
|
+
// Local variables like "surveys[]" or "items[]" are important for tracing data flow
|
|
650
|
+
// from parent to child components (e.g., surveys[] -> SurveyCard().signature[0].survey)
|
|
651
|
+
const isLocalVariablePath =
|
|
652
|
+
!candidate.schemaPath.includes('()') &&
|
|
653
|
+
!candidate.schemaPath.startsWith('signature[') &&
|
|
654
|
+
!candidate.schemaPath.startsWith('returnValue');
|
|
655
|
+
|
|
570
656
|
return (
|
|
571
657
|
validExternalFacingScopeNames.has(baseName) &&
|
|
572
658
|
(candidate.schemaPath.startsWith('signature[') ||
|
|
573
|
-
candidate.schemaPath.startsWith(baseName)
|
|
659
|
+
candidate.schemaPath.startsWith(baseName) ||
|
|
660
|
+
isLocalVariablePath) &&
|
|
574
661
|
!containsArrayMethod(candidate.schemaPath)
|
|
575
662
|
);
|
|
576
663
|
});
|
|
664
|
+
|
|
665
|
+
// If all sourceCandidates were filtered out (e.g., because they belonged to
|
|
666
|
+
// internal functions like useState), look for the highest-order intermediate
|
|
667
|
+
// that belongs to a valid external-facing scope
|
|
668
|
+
if (
|
|
669
|
+
entry.sourceCandidates.length === 0 &&
|
|
670
|
+
Object.keys(entry.intermediatesOrder).length > 0
|
|
671
|
+
) {
|
|
672
|
+
// Find intermediates that belong to valid external-facing scopes
|
|
673
|
+
const validIntermediates = Object.entries(entry.intermediatesOrder)
|
|
674
|
+
.filter(([pathId]) => {
|
|
675
|
+
const [scopeNodeName, schemaPath] = pathId.split('::');
|
|
676
|
+
if (!scopeNodeName || !schemaPath) return false;
|
|
677
|
+
const baseName = this.pathManager.stripGenerics(scopeNodeName);
|
|
678
|
+
return (
|
|
679
|
+
validExternalFacingScopeNames.has(baseName) &&
|
|
680
|
+
!containsArrayMethod(schemaPath)
|
|
681
|
+
);
|
|
682
|
+
})
|
|
683
|
+
.sort((a, b) => b[1] - a[1]); // Sort by order descending (highest first)
|
|
684
|
+
|
|
685
|
+
if (validIntermediates.length > 0) {
|
|
686
|
+
const [pathId] = validIntermediates[0];
|
|
687
|
+
const [scopeNodeName, schemaPath] = pathId.split('::');
|
|
688
|
+
if (scopeNodeName && schemaPath) {
|
|
689
|
+
entry.sourceCandidates.push({ scopeNodeName, schemaPath });
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
577
693
|
}
|
|
578
694
|
|
|
579
695
|
this.propagateSourceAndUsageEquivalencies(
|
|
@@ -904,8 +1020,8 @@ export class ScopeDataStructure {
|
|
|
904
1020
|
equivalencyValueChain?: EquivalencyValueChainItem[],
|
|
905
1021
|
traceId?: number,
|
|
906
1022
|
) {
|
|
907
|
-
// DEBUG: Detect infinite loops
|
|
908
1023
|
addEquivalencyCallCount++;
|
|
1024
|
+
|
|
909
1025
|
if (addEquivalencyCallCount > 50000) {
|
|
910
1026
|
console.error('INFINITE LOOP DETECTED in addEquivalency', {
|
|
911
1027
|
callCount: addEquivalencyCallCount,
|
|
@@ -1151,10 +1267,38 @@ export class ScopeDataStructure {
|
|
|
1151
1267
|
const existingFunctionCall =
|
|
1152
1268
|
this.getExternalFunctionCallsIndex().get(searchKey);
|
|
1153
1269
|
if (existingFunctionCall) {
|
|
1154
|
-
|
|
1270
|
+
// Preserve per-call schemas BEFORE merging to enable per-variable mock data.
|
|
1271
|
+
// This is critical for hooks like useFetcher<UserData>() vs useFetcher<ReportData>()
|
|
1272
|
+
// where each call returns different typed data.
|
|
1273
|
+
if (!existingFunctionCall.perCallSignatureSchemas) {
|
|
1274
|
+
// First merge - save the existing call's schema
|
|
1275
|
+
existingFunctionCall.perCallSignatureSchemas = {
|
|
1276
|
+
[existingFunctionCall.callSignature]: {
|
|
1277
|
+
...existingFunctionCall.schema,
|
|
1278
|
+
},
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
// Save the new call's schema before it gets merged
|
|
1282
|
+
existingFunctionCall.perCallSignatureSchemas[
|
|
1283
|
+
functionCallInfo.callSignature
|
|
1284
|
+
] = { ...functionCallInfo.schema };
|
|
1285
|
+
|
|
1286
|
+
// Merge schemas using selectBestValue to preserve specific types like 'null'
|
|
1287
|
+
// over generic types like 'unknown'. This ensures ref variables detected
|
|
1288
|
+
// earlier (marked as 'null') aren't overwritten by later 'unknown' values.
|
|
1289
|
+
const mergedSchema: Record<string, string> = {
|
|
1155
1290
|
...existingFunctionCall.schema,
|
|
1156
|
-
...functionCallInfo.schema,
|
|
1157
1291
|
};
|
|
1292
|
+
for (const key in functionCallInfo.schema) {
|
|
1293
|
+
const existingValue = existingFunctionCall.schema[key];
|
|
1294
|
+
const newValue = functionCallInfo.schema[key];
|
|
1295
|
+
mergedSchema[key] = selectBestValue(
|
|
1296
|
+
existingValue,
|
|
1297
|
+
newValue,
|
|
1298
|
+
newValue,
|
|
1299
|
+
);
|
|
1300
|
+
}
|
|
1301
|
+
existingFunctionCall.schema = mergedSchema;
|
|
1158
1302
|
|
|
1159
1303
|
existingFunctionCall.equivalencies = {
|
|
1160
1304
|
...existingFunctionCall.equivalencies,
|
|
@@ -1187,8 +1331,15 @@ export class ScopeDataStructure {
|
|
|
1187
1331
|
);
|
|
1188
1332
|
|
|
1189
1333
|
if (isExternal) {
|
|
1190
|
-
this
|
|
1191
|
-
|
|
1334
|
+
// Check if this function was already filtered out as an internal function
|
|
1335
|
+
// (e.g., useState was filtered in captureCompleteSchema but finalize is trying to re-add it)
|
|
1336
|
+
const strippedName = this.pathManager.stripGenerics(
|
|
1337
|
+
functionCallInfo.name,
|
|
1338
|
+
);
|
|
1339
|
+
if (!this.filteredInternalFunctions.has(strippedName)) {
|
|
1340
|
+
this.externalFunctionCalls.push(functionCallInfo);
|
|
1341
|
+
this.invalidateExternalFunctionCallsIndex();
|
|
1342
|
+
}
|
|
1192
1343
|
}
|
|
1193
1344
|
}
|
|
1194
1345
|
}
|
|
@@ -1296,6 +1447,18 @@ export class ScopeDataStructure {
|
|
|
1296
1447
|
const equivalentSchemaPath = equivalentSchemaPathMap.get(remainingKey);
|
|
1297
1448
|
|
|
1298
1449
|
if (equivalentSchemaPath) {
|
|
1450
|
+
// Skip propagation when there's a structural mismatch:
|
|
1451
|
+
// - schemaPath ends with [] (array element, represents an object)
|
|
1452
|
+
// - equivalentSchemaPath doesn't end with [] (non-array prop, usually a scalar)
|
|
1453
|
+
// This prevents incorrectly typing array elements as strings when they're
|
|
1454
|
+
// equivalent to scalar props like JSX keys (e.g., workouts[] ↔ Card().key)
|
|
1455
|
+
const schemaPathEndsWithArray = schemaPath.endsWith('[]');
|
|
1456
|
+
const equivalentEndsWithArray = equivalentSchemaPath.endsWith('[]');
|
|
1457
|
+
if (schemaPathEndsWithArray !== equivalentEndsWithArray) {
|
|
1458
|
+
// Don't propagate between array element paths and non-array paths
|
|
1459
|
+
continue;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1299
1462
|
const value1 = scopeNode.schema[schemaPath];
|
|
1300
1463
|
const value2 = equivalentScopeNode.schema[equivalentSchemaPath];
|
|
1301
1464
|
|
|
@@ -1404,6 +1567,60 @@ export class ScopeDataStructure {
|
|
|
1404
1567
|
return this.pathManager.isValidPath(path);
|
|
1405
1568
|
}
|
|
1406
1569
|
|
|
1570
|
+
/**
|
|
1571
|
+
* Detects if a path contains excessive repetition of the same pattern.
|
|
1572
|
+
*
|
|
1573
|
+
* This prevents exponential blowup when analyzing recursive type structures.
|
|
1574
|
+
* For example, TypeScript AST nodes have `.attributes.properties[]` where each
|
|
1575
|
+
* property is also a node with `.attributes.properties[]`. Without this check,
|
|
1576
|
+
* paths like `signature[0].attributes.properties[].attributes.properties[].attributes.properties[]...`
|
|
1577
|
+
* would be generated exponentially.
|
|
1578
|
+
*
|
|
1579
|
+
* Two detection strategies:
|
|
1580
|
+
* 1. Known patterns: Check RECURSIVE_PATH_PATTERNS for common recursive structures
|
|
1581
|
+
* 2. Generic detection: For longer paths, detect any 2-3 part segment that repeats
|
|
1582
|
+
*
|
|
1583
|
+
* @param path - The schema path to check
|
|
1584
|
+
* @param maxRepetitions - Maximum allowed repetitions of any pattern (default: 2)
|
|
1585
|
+
* @returns true if the path has excessive repetition
|
|
1586
|
+
*/
|
|
1587
|
+
private hasExcessivePatternRepetition(
|
|
1588
|
+
path: string,
|
|
1589
|
+
maxRepetitions = 2,
|
|
1590
|
+
): boolean {
|
|
1591
|
+
// Check known recursive patterns
|
|
1592
|
+
for (const pattern of RECURSIVE_PATH_PATTERNS) {
|
|
1593
|
+
const matches = path.match(pattern);
|
|
1594
|
+
if (matches && matches.length > maxRepetitions) {
|
|
1595
|
+
return true;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
// For longer paths, detect any repeated multi-part segments we haven't explicitly listed
|
|
1600
|
+
const pathParts = this.splitPath(path);
|
|
1601
|
+
if (pathParts.length <= 6) {
|
|
1602
|
+
return false;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
// Check for repeated sequences of 2-3 consecutive parts
|
|
1606
|
+
for (let segmentLength = 2; segmentLength <= 3; segmentLength++) {
|
|
1607
|
+
const seen = new Map<string, number>();
|
|
1608
|
+
|
|
1609
|
+
for (let i = 0; i <= pathParts.length - segmentLength; i++) {
|
|
1610
|
+
const segment = pathParts.slice(i, i + segmentLength).join('.');
|
|
1611
|
+
const normalizedSegment = segment.replace(/\[\d+\]/g, '[]');
|
|
1612
|
+
const count = (seen.get(normalizedSegment) || 0) + 1;
|
|
1613
|
+
seen.set(normalizedSegment, count);
|
|
1614
|
+
|
|
1615
|
+
if (count > maxRepetitions) {
|
|
1616
|
+
return true;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
return false;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1407
1624
|
private addToTree(pathParts: string[]) {
|
|
1408
1625
|
this.scopeTreeManager.addPath(pathParts);
|
|
1409
1626
|
}
|
|
@@ -1472,44 +1689,13 @@ export class ScopeDataStructure {
|
|
|
1472
1689
|
}
|
|
1473
1690
|
|
|
1474
1691
|
private determineEquivalenciesAndBuildSchema(scopeNode: ScopeNode) {
|
|
1692
|
+
if (!scopeNode.analysis) {
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1475
1696
|
const { isolatedStructure, isolatedEquivalentVariables } =
|
|
1476
1697
|
scopeNode.analysis;
|
|
1477
1698
|
|
|
1478
|
-
// DEBUG: Log all equivalencies related to useFetcher
|
|
1479
|
-
if (
|
|
1480
|
-
Object.keys(isolatedEquivalentVariables || {}).some(
|
|
1481
|
-
(k) => k.includes('Fetcher') || k.includes('fetcher'),
|
|
1482
|
-
)
|
|
1483
|
-
) {
|
|
1484
|
-
console.log(
|
|
1485
|
-
'CodeYam DEBUG determineEquivalenciesAndBuildSchema:',
|
|
1486
|
-
JSON.stringify(
|
|
1487
|
-
{
|
|
1488
|
-
scopeNodeName: scopeNode.name,
|
|
1489
|
-
fetcherEquivalencies: Object.entries(
|
|
1490
|
-
isolatedEquivalentVariables || {},
|
|
1491
|
-
)
|
|
1492
|
-
.filter(
|
|
1493
|
-
([k, v]) =>
|
|
1494
|
-
k.includes('Fetcher') ||
|
|
1495
|
-
k.includes('fetcher') ||
|
|
1496
|
-
String(v).includes('Fetcher') ||
|
|
1497
|
-
String(v).includes('fetcher'),
|
|
1498
|
-
)
|
|
1499
|
-
.reduce(
|
|
1500
|
-
(acc, [k, v]) => {
|
|
1501
|
-
acc[k] = v;
|
|
1502
|
-
return acc;
|
|
1503
|
-
},
|
|
1504
|
-
{} as Record<string, string>,
|
|
1505
|
-
),
|
|
1506
|
-
},
|
|
1507
|
-
null,
|
|
1508
|
-
2,
|
|
1509
|
-
),
|
|
1510
|
-
);
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
1699
|
const allPaths = Array.from(
|
|
1514
1700
|
new Set([
|
|
1515
1701
|
...Object.keys(isolatedStructure || {}),
|
|
@@ -1522,11 +1708,24 @@ export class ScopeDataStructure {
|
|
|
1522
1708
|
let equivalentValue = isolatedEquivalentVariables?.[path];
|
|
1523
1709
|
|
|
1524
1710
|
if (equivalentValue && this.isValidPath(equivalentValue)) {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1711
|
+
// IMPORTANT: DO NOT strip ::cyDuplicateKey:: markers from equivalencies.
|
|
1712
|
+
// These markers are critical for distinguishing variable reassignments.
|
|
1713
|
+
// For example, with:
|
|
1714
|
+
// let fetcher = useFetcher<ConfigData>();
|
|
1715
|
+
// const configData = fetcher.data?.data;
|
|
1716
|
+
// fetcher = useFetcher<SettingsData>();
|
|
1717
|
+
// const settingsData = fetcher.data?.data;
|
|
1718
|
+
//
|
|
1719
|
+
// mergeStatements creates:
|
|
1720
|
+
// fetcher → useFetcher<ConfigData>()...
|
|
1721
|
+
// fetcher::cyDuplicateKey1:: → useFetcher<SettingsData>()...
|
|
1722
|
+
// configData → fetcher.data.data
|
|
1723
|
+
// settingsData → fetcher::cyDuplicateKey1::.data.data
|
|
1724
|
+
//
|
|
1725
|
+
// If we strip ::cyDuplicateKey::, settingsData would incorrectly trace
|
|
1726
|
+
// to useFetcher<ConfigData>() instead of useFetcher<SettingsData>().
|
|
1727
|
+
path = cleanPath(path, allPaths);
|
|
1728
|
+
equivalentValue = cleanPath(equivalentValue, allPaths);
|
|
1530
1729
|
|
|
1531
1730
|
this.addEquivalency(
|
|
1532
1731
|
path,
|
|
@@ -1672,7 +1871,7 @@ export class ScopeDataStructure {
|
|
|
1672
1871
|
this.batchProcessor = new BatchSchemaProcessor();
|
|
1673
1872
|
this.batchQueuedSet = new Set();
|
|
1674
1873
|
|
|
1675
|
-
for (const key of
|
|
1874
|
+
for (const key of allPaths) {
|
|
1676
1875
|
let value = isolatedStructure[key] ?? 'unknown';
|
|
1677
1876
|
|
|
1678
1877
|
if (['null', 'undefined'].includes(value)) {
|
|
@@ -1713,7 +1912,19 @@ export class ScopeDataStructure {
|
|
|
1713
1912
|
private processBatchQueue(): void {
|
|
1714
1913
|
if (!this.batchProcessor) return;
|
|
1715
1914
|
|
|
1915
|
+
let iterations = 0;
|
|
1916
|
+
|
|
1716
1917
|
while (this.batchProcessor.hasWork()) {
|
|
1918
|
+
iterations++;
|
|
1919
|
+
|
|
1920
|
+
// Safety: detect potential infinite loops
|
|
1921
|
+
if (iterations > 100000) {
|
|
1922
|
+
console.error(
|
|
1923
|
+
`[ScopeDataStructure] processBatchQueue exceeded 100k iterations, possible infinite loop!`,
|
|
1924
|
+
);
|
|
1925
|
+
break;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1717
1928
|
const item = this.batchProcessor.getNextWork();
|
|
1718
1929
|
if (!item) break;
|
|
1719
1930
|
|
|
@@ -1771,26 +1982,6 @@ export class ScopeDataStructure {
|
|
|
1771
1982
|
const functionCallInfo =
|
|
1772
1983
|
this.getExternalFunctionCallsIndex().get(searchKey);
|
|
1773
1984
|
|
|
1774
|
-
// DEBUG: Track useFetcher calls
|
|
1775
|
-
if (searchKey === 'useFetcher' || callSignature.includes('useFetcher')) {
|
|
1776
|
-
console.log(
|
|
1777
|
-
'CodeYam DEBUG trackReceivingVariable:',
|
|
1778
|
-
JSON.stringify(
|
|
1779
|
-
{
|
|
1780
|
-
receivingVariable,
|
|
1781
|
-
equivalentValue,
|
|
1782
|
-
callSignature,
|
|
1783
|
-
searchKey,
|
|
1784
|
-
foundFunctionCallInfo: !!functionCallInfo,
|
|
1785
|
-
existingRecvVars: functionCallInfo?.receivingVariableNames,
|
|
1786
|
-
existingCallSigToVar: functionCallInfo?.callSignatureToVariable,
|
|
1787
|
-
},
|
|
1788
|
-
null,
|
|
1789
|
-
2,
|
|
1790
|
-
),
|
|
1791
|
-
);
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
1985
|
if (!functionCallInfo) {
|
|
1795
1986
|
return;
|
|
1796
1987
|
}
|
|
@@ -2290,6 +2481,21 @@ export class ScopeDataStructure {
|
|
|
2290
2481
|
|
|
2291
2482
|
const newEquivalentPath = this.joinPathParts([schemaPath, remainingPath]);
|
|
2292
2483
|
|
|
2484
|
+
// PERF: Detect repeated patterns in paths to prevent exponential blowup
|
|
2485
|
+
// Paths like `signature[0].attributes.properties[].attributes.properties[]...`
|
|
2486
|
+
// indicate recursive type structures that cause exponential schema explosion
|
|
2487
|
+
if (this.hasExcessivePatternRepetition(newEquivalentPath)) {
|
|
2488
|
+
if (traceId && debugLevel > 0) {
|
|
2489
|
+
console.info(
|
|
2490
|
+
'Debug: skipping path with excessive pattern repetition',
|
|
2491
|
+
{
|
|
2492
|
+
path: newEquivalentPath,
|
|
2493
|
+
},
|
|
2494
|
+
);
|
|
2495
|
+
}
|
|
2496
|
+
continue;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2293
2499
|
if (!equivalentScopeNode) {
|
|
2294
2500
|
if (traceId) {
|
|
2295
2501
|
console.info('Debug Propagation: missing equivalent scope info', {
|
|
@@ -3160,7 +3366,12 @@ export class ScopeDataStructure {
|
|
|
3160
3366
|
);
|
|
3161
3367
|
}
|
|
3162
3368
|
|
|
3369
|
+
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
3370
|
+
// during this "getter" method. See comment in getFunctionSignature.
|
|
3371
|
+
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
3372
|
+
this.onlyEquivalencies = true;
|
|
3163
3373
|
this.validateSchema(scopeNode, true, fillInUnknowns);
|
|
3374
|
+
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
3164
3375
|
|
|
3165
3376
|
const { schema } = scopeNode;
|
|
3166
3377
|
|
|
@@ -3194,10 +3405,29 @@ export class ScopeDataStructure {
|
|
|
3194
3405
|
}
|
|
3195
3406
|
}
|
|
3196
3407
|
}
|
|
3197
|
-
return mergedSchema;
|
|
3408
|
+
return this.filterDuplicateKeys(mergedSchema);
|
|
3198
3409
|
}
|
|
3199
3410
|
|
|
3200
|
-
return schema;
|
|
3411
|
+
return this.filterDuplicateKeys(schema);
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
/**
|
|
3415
|
+
* Filter out ::cyDuplicateKey:: entries from a schema.
|
|
3416
|
+
* These are internal markers for tracking variable reassignments
|
|
3417
|
+
* and should not appear in output schemas or LLM prompts.
|
|
3418
|
+
*/
|
|
3419
|
+
private filterDuplicateKeys(
|
|
3420
|
+
schema: Record<string, string>,
|
|
3421
|
+
): Record<string, string> {
|
|
3422
|
+
return Object.entries(schema).reduce(
|
|
3423
|
+
(acc, [key, value]) => {
|
|
3424
|
+
if (!key.includes('::cyDuplicateKey')) {
|
|
3425
|
+
acc[key] = value;
|
|
3426
|
+
}
|
|
3427
|
+
return acc;
|
|
3428
|
+
},
|
|
3429
|
+
{} as Record<string, string>,
|
|
3430
|
+
);
|
|
3201
3431
|
}
|
|
3202
3432
|
|
|
3203
3433
|
getEquivalencies(scopeName?: string) {
|
|
@@ -3261,6 +3491,7 @@ export class ScopeDataStructure {
|
|
|
3261
3491
|
(candidate) => candidate.scopeNodeName === scopeNode.name,
|
|
3262
3492
|
),
|
|
3263
3493
|
);
|
|
3494
|
+
|
|
3264
3495
|
return entries.reduce(
|
|
3265
3496
|
(acc, entry) => {
|
|
3266
3497
|
if (entry.usages.length === 0) return acc;
|
|
@@ -3304,12 +3535,14 @@ export class ScopeDataStructure {
|
|
|
3304
3535
|
);
|
|
3305
3536
|
|
|
3306
3537
|
const equivalencies = this.getEquivalencies(functionName);
|
|
3538
|
+
const scopeName = functionName ?? this.scopeTreeManager.getRootName();
|
|
3539
|
+
|
|
3307
3540
|
for (const equivalenceKey in equivalencies ?? {}) {
|
|
3308
3541
|
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
3309
3542
|
const schemaPath = equivalenceValue.schemaPath;
|
|
3310
3543
|
if (
|
|
3311
3544
|
schemaPath.startsWith('signature[') &&
|
|
3312
|
-
equivalenceValue.scopeNodeName ===
|
|
3545
|
+
equivalenceValue.scopeNodeName === scopeName &&
|
|
3313
3546
|
!signatureInSchema[schemaPath]
|
|
3314
3547
|
) {
|
|
3315
3548
|
signatureInSchema[schemaPath] = 'unknown';
|
|
@@ -3325,7 +3558,60 @@ export class ScopeDataStructure {
|
|
|
3325
3558
|
|
|
3326
3559
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
3327
3560
|
|
|
3328
|
-
|
|
3561
|
+
// After validateSchema has filled in types, propagate nested paths from
|
|
3562
|
+
// variables to their signature equivalents.
|
|
3563
|
+
// e.g., workouts[].activity_type -> signature[0].workouts[].activity_type
|
|
3564
|
+
//
|
|
3565
|
+
// Build a map of variable names that are equivalent to signature paths
|
|
3566
|
+
// e.g., { 'workouts': 'signature[0].workouts' }
|
|
3567
|
+
const variableToSignatureMap: Record<string, string> = {};
|
|
3568
|
+
|
|
3569
|
+
for (const equivalenceKey in equivalencies ?? {}) {
|
|
3570
|
+
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
3571
|
+
const schemaPath = equivalenceValue.schemaPath;
|
|
3572
|
+
// Track which variables map to signature paths
|
|
3573
|
+
// equivalenceKey is the variable name (e.g., 'workouts')
|
|
3574
|
+
// schemaPath is where it comes from (e.g., 'signature[0].workouts')
|
|
3575
|
+
if (
|
|
3576
|
+
schemaPath.startsWith('signature[') &&
|
|
3577
|
+
equivalenceValue.scopeNodeName === scopeName
|
|
3578
|
+
) {
|
|
3579
|
+
variableToSignatureMap[equivalenceKey] = schemaPath;
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3583
|
+
|
|
3584
|
+
// Propagate nested paths from variables to their signature equivalents
|
|
3585
|
+
// e.g., if workouts = signature[0].workouts, then workouts[].title becomes
|
|
3586
|
+
// signature[0].workouts[].title
|
|
3587
|
+
for (const schemaKey in schema) {
|
|
3588
|
+
// Skip keys that already start with signature[
|
|
3589
|
+
if (schemaKey.startsWith('signature[')) continue;
|
|
3590
|
+
|
|
3591
|
+
// Check if this key starts with a variable that maps to a signature path
|
|
3592
|
+
for (const [variableName, signaturePath] of Object.entries(
|
|
3593
|
+
variableToSignatureMap,
|
|
3594
|
+
)) {
|
|
3595
|
+
// Check if schemaKey starts with variableName followed by a property accessor
|
|
3596
|
+
// e.g., 'workouts[]' starts with 'workouts'
|
|
3597
|
+
if (
|
|
3598
|
+
schemaKey === variableName ||
|
|
3599
|
+
schemaKey.startsWith(variableName + '.') ||
|
|
3600
|
+
schemaKey.startsWith(variableName + '[')
|
|
3601
|
+
) {
|
|
3602
|
+
// Transform the path: replace the variable prefix with the signature path
|
|
3603
|
+
const suffix = schemaKey.slice(variableName.length);
|
|
3604
|
+
const signatureKey = signaturePath + suffix;
|
|
3605
|
+
|
|
3606
|
+
// Add to schema if not already present
|
|
3607
|
+
if (!tempScopeNode.schema[signatureKey]) {
|
|
3608
|
+
tempScopeNode.schema[signatureKey] = schema[schemaKey];
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
return this.filterDuplicateKeys(tempScopeNode.schema);
|
|
3329
3615
|
}
|
|
3330
3616
|
|
|
3331
3617
|
getReturnValue({
|
|
@@ -3335,6 +3621,15 @@ export class ScopeDataStructure {
|
|
|
3335
3621
|
functionName?: string;
|
|
3336
3622
|
fillInUnknowns?: boolean;
|
|
3337
3623
|
}) {
|
|
3624
|
+
// Trigger finalization on all managers to apply any pending updates
|
|
3625
|
+
// (e.g., ref type propagation to external function call schemas)
|
|
3626
|
+
const rootScope = this.scopeNodes[this.scopeTreeManager.getRootName()];
|
|
3627
|
+
if (rootScope) {
|
|
3628
|
+
for (const manager of this.equivalencyManagers) {
|
|
3629
|
+
manager.finalize(rootScope, this);
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3338
3633
|
const scopeName = functionName ?? this.scopeTreeManager.getRootName();
|
|
3339
3634
|
const scopeNode = this.scopeNodes[scopeName];
|
|
3340
3635
|
|
|
@@ -3345,7 +3640,8 @@ export class ScopeDataStructure {
|
|
|
3345
3640
|
scopeNode: scopeNode,
|
|
3346
3641
|
});
|
|
3347
3642
|
} else {
|
|
3348
|
-
|
|
3643
|
+
// Use getExternalFunctionCalls() which cleans cyScope from schemas
|
|
3644
|
+
for (const externalFunctionCall of this.getExternalFunctionCalls()) {
|
|
3349
3645
|
const functionNameParts = this.splitPath(functionName).map((p) =>
|
|
3350
3646
|
this.functionOrScopeName(p),
|
|
3351
3647
|
);
|
|
@@ -3377,7 +3673,17 @@ export class ScopeDataStructure {
|
|
|
3377
3673
|
// Include function paths even if their return value wasn't captured
|
|
3378
3674
|
// This ensures methods like onAuthStateChange are included in the schema
|
|
3379
3675
|
// But exclude signature entries (they should only be included via functionCallReturnValue paths)
|
|
3380
|
-
|
|
3676
|
+
// Also exclude bare function call signatures - paths that are JUST a call like
|
|
3677
|
+
// "useCustomSizes(projectSlug)" should not be included as return values.
|
|
3678
|
+
// These represent "the function exists" not actual return data, and including
|
|
3679
|
+
// them causes nested path bugs in dependencySchemas.
|
|
3680
|
+
(schema[key] === 'function' &&
|
|
3681
|
+
key.indexOf('signature[') === -1 &&
|
|
3682
|
+
// Exclude bare call signatures: function calls with no dots OUTSIDE parentheses
|
|
3683
|
+
// e.g., "useCustomSizes(projectSlug)" is bare (exclude)
|
|
3684
|
+
// e.g., "loadProject({nested.property})" is bare - dots are inside args (exclude)
|
|
3685
|
+
// e.g., "getSupabase().auth.method()" has dots outside - method chain (include)
|
|
3686
|
+
!this.isBareCallSignature(key)),
|
|
3381
3687
|
)
|
|
3382
3688
|
.reduce(
|
|
3383
3689
|
(acc, key) => {
|
|
@@ -3387,7 +3693,10 @@ export class ScopeDataStructure {
|
|
|
3387
3693
|
for (const path in schema) {
|
|
3388
3694
|
const pathParts = this.splitPath(path);
|
|
3389
3695
|
if (pathParts.every((p, i) => keyParts[i] === p)) {
|
|
3390
|
-
|
|
3696
|
+
// Also exclude bare call signatures from prefix paths
|
|
3697
|
+
if (!this.isBareCallSignature(path)) {
|
|
3698
|
+
acc[path] = schema[path];
|
|
3699
|
+
}
|
|
3391
3700
|
}
|
|
3392
3701
|
}
|
|
3393
3702
|
|
|
@@ -3401,14 +3710,73 @@ export class ScopeDataStructure {
|
|
|
3401
3710
|
|
|
3402
3711
|
const tempScopeNode = this.createTempScopeNode(scopeName, resolvedSchema);
|
|
3403
3712
|
|
|
3713
|
+
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
3714
|
+
// during this "getter" method. See comment in getFunctionSignature.
|
|
3715
|
+
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
3716
|
+
this.onlyEquivalencies = true;
|
|
3404
3717
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
3718
|
+
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
3719
|
+
|
|
3720
|
+
// Remove bare call signatures from the return value schema.
|
|
3721
|
+
// fillInSchemaGapsAndUnknowns may add parent paths like "useCustomSizes(projectSlug)"
|
|
3722
|
+
// when it sees "useCustomSizes(projectSlug).functionCallReturnValue". These bare
|
|
3723
|
+
// call signatures represent "the function exists" not actual return data, and
|
|
3724
|
+
// including them causes nested path bugs in dependencySchemas.
|
|
3725
|
+
const resultSchema = tempScopeNode.schema;
|
|
3726
|
+
for (const key of Object.keys(resultSchema)) {
|
|
3727
|
+
if (this.isBareCallSignature(key)) {
|
|
3728
|
+
delete resultSchema[key];
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3731
|
+
|
|
3732
|
+
return resultSchema;
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3735
|
+
/**
|
|
3736
|
+
* Checks if a schema key is a "bare call signature" - a function call with no
|
|
3737
|
+
* method chain before it and no path segments after it.
|
|
3738
|
+
*
|
|
3739
|
+
* A bare call signature represents "this function exists" rather than actual
|
|
3740
|
+
* return data, and including them causes nested path bugs in dependencySchemas.
|
|
3741
|
+
*
|
|
3742
|
+
* Examples:
|
|
3743
|
+
* - "useCustomSizes(projectSlug)" -> bare (true)
|
|
3744
|
+
* - "loadProject({nested.property})" -> bare (dots are inside args, true)
|
|
3745
|
+
* - "getSupabase().auth.method()" -> not bare (has dots outside parens, false)
|
|
3746
|
+
* - "useProject().functionCallReturnValue" -> not bare (has path after, false)
|
|
3747
|
+
*/
|
|
3748
|
+
private isBareCallSignature(key: string): boolean {
|
|
3749
|
+
// Must end with ) and contain ( to be a call
|
|
3750
|
+
if (!key.endsWith(')') || key.indexOf('(') === -1) {
|
|
3751
|
+
return false;
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
// Check if there are any dots OUTSIDE of parentheses
|
|
3755
|
+
// Strip out content inside balanced parentheses, then check for dots
|
|
3756
|
+
let depth = 0;
|
|
3757
|
+
let hasDotsOutsideParens = false;
|
|
3758
|
+
|
|
3759
|
+
for (let i = 0; i < key.length; i++) {
|
|
3760
|
+
const char = key[i];
|
|
3761
|
+
if (char === '(') {
|
|
3762
|
+
depth++;
|
|
3763
|
+
} else if (char === ')') {
|
|
3764
|
+
depth--;
|
|
3765
|
+
} else if (char === '.' && depth === 0) {
|
|
3766
|
+
hasDotsOutsideParens = true;
|
|
3767
|
+
break;
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3405
3770
|
|
|
3406
|
-
|
|
3771
|
+
// It's a bare call signature if there are no dots outside parentheses
|
|
3772
|
+
return !hasDotsOutsideParens;
|
|
3407
3773
|
}
|
|
3408
3774
|
|
|
3409
3775
|
/**
|
|
3410
3776
|
* Replaces cyScope placeholder references (e.g., cyScope10()) in schema keys
|
|
3411
3777
|
* with the actual callback function text from the corresponding scope node.
|
|
3778
|
+
* If the scope text can't be found, uses a generic fallback to avoid leaking
|
|
3779
|
+
* internal cyScope names into stored data.
|
|
3412
3780
|
*/
|
|
3413
3781
|
private replaceCyScopePlaceholders(
|
|
3414
3782
|
schema: Record<string, string>,
|
|
@@ -3424,10 +3792,10 @@ export class ScopeDataStructure {
|
|
|
3424
3792
|
for (const match of matches) {
|
|
3425
3793
|
const cyScopeName = `cyScope${match[1]}`;
|
|
3426
3794
|
const scopeText = this.findCyScopeText(cyScopeName);
|
|
3427
|
-
if
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3795
|
+
// Always replace cyScope references - use actual text if available,
|
|
3796
|
+
// otherwise use a generic callback placeholder
|
|
3797
|
+
const replacement = scopeText || '() => {}';
|
|
3798
|
+
newKey = newKey.replace(match[0], replacement);
|
|
3431
3799
|
}
|
|
3432
3800
|
|
|
3433
3801
|
result[newKey] = value;
|
|
@@ -3493,12 +3861,264 @@ export class ScopeDataStructure {
|
|
|
3493
3861
|
scopeNode.equivalencies,
|
|
3494
3862
|
)) {
|
|
3495
3863
|
for (const equivalentValue of equivalentValues) {
|
|
3864
|
+
// Case 1: Props/signature equivalencies (existing behavior)
|
|
3865
|
+
// Maps local variable names to their signature paths
|
|
3866
|
+
// e.g., "propValue" -> "signature[0].prop"
|
|
3496
3867
|
if (path.startsWith('signature[')) {
|
|
3497
3868
|
equivalentSignatureVariables[equivalentValue.schemaPath] = path;
|
|
3498
3869
|
}
|
|
3870
|
+
|
|
3871
|
+
// Case 2: Hook variable equivalencies (new behavior)
|
|
3872
|
+
// The equivalencies are stored as: path = variable name, schemaPath = data source
|
|
3873
|
+
// e.g., path = "debugFetcher", schemaPath = "useFetcher<...>().functionCallReturnValue"
|
|
3874
|
+
// We need to map: "debugFetcher" -> "useFetcher<...>()"
|
|
3875
|
+
// This enables resolving paths like "debugFetcher.state" to
|
|
3876
|
+
// "useFetcher<...>().state" for execution flow validation
|
|
3877
|
+
if (equivalentValue.schemaPath.endsWith('.functionCallReturnValue')) {
|
|
3878
|
+
// Extract the hook call path (everything before .functionCallReturnValue)
|
|
3879
|
+
const hookCallPath = equivalentValue.schemaPath.slice(
|
|
3880
|
+
0,
|
|
3881
|
+
-'.functionCallReturnValue'.length,
|
|
3882
|
+
);
|
|
3883
|
+
// Only include if it looks like a hook call (contains parentheses)
|
|
3884
|
+
// and the variable name (path) is a simple identifier (no dots)
|
|
3885
|
+
if (hookCallPath.includes('(') && !path.includes('.')) {
|
|
3886
|
+
equivalentSignatureVariables[path] = hookCallPath;
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
// Case 3: Destructured variables from local variables
|
|
3891
|
+
// e.g., const { scenarios } = currentEntityAnalysis;
|
|
3892
|
+
// This creates: path = "scenarios", schemaPath = "currentEntityAnalysis.scenarios"
|
|
3893
|
+
// We need to map: "scenarios" -> "currentEntityAnalysis.scenarios"
|
|
3894
|
+
// AND resolve transitively if currentEntityAnalysis is itself equivalent to a hook call
|
|
3895
|
+
if (
|
|
3896
|
+
!path.includes('.') && // path is a simple identifier
|
|
3897
|
+
!equivalentValue.schemaPath.startsWith('signature[') && // not a signature path
|
|
3898
|
+
!equivalentValue.schemaPath.endsWith('.functionCallReturnValue') // not already handled above
|
|
3899
|
+
) {
|
|
3900
|
+
// Only add if we haven't already captured this variable in Case 1 or 2
|
|
3901
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
3902
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3903
|
+
}
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
// Case 4: Child component prop mappings (Fix 22)
|
|
3907
|
+
// When parent renders <ChildComponent prop={value} />, we get equivalencies like:
|
|
3908
|
+
// path = "ChildComponent().signature[0].prop"
|
|
3909
|
+
// schemaPath = "value" (the variable passed as the prop)
|
|
3910
|
+
// We need to include these so translateChildPathToParent can work.
|
|
3911
|
+
// Pattern: ComponentName().signature[N] or ComponentName().signature[N].propName
|
|
3912
|
+
if (
|
|
3913
|
+
path.includes('().signature[') &&
|
|
3914
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable, not a function call
|
|
3915
|
+
) {
|
|
3916
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3917
|
+
}
|
|
3918
|
+
|
|
3919
|
+
// Case 5: Destructured function parameters (Fix 25)
|
|
3920
|
+
// When a function has destructured props: function Comp({ propA, propB }: Props)
|
|
3921
|
+
// We get equivalencies like:
|
|
3922
|
+
// path = "propA" (the destructured variable name)
|
|
3923
|
+
// schemaPath = "signature[0].propA" (the signature path)
|
|
3924
|
+
// We need to map: "propA" -> "signature[0].propA"
|
|
3925
|
+
// This enables translateChildPathToParent to resolve child variable paths
|
|
3926
|
+
// to their signature paths when merging execution flows.
|
|
3927
|
+
if (
|
|
3928
|
+
!path.includes('.') && // path is a simple identifier (destructured prop name)
|
|
3929
|
+
equivalentValue.schemaPath.startsWith('signature[') // schemaPath IS a signature path
|
|
3930
|
+
) {
|
|
3931
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3934
|
+
// Case 7: Method calls on variables that result in .functionCallReturnValue (Fix 33)
|
|
3935
|
+
// When we have patterns like:
|
|
3936
|
+
// path = "segments" (simple identifier)
|
|
3937
|
+
// schemaPath = "splat.split('/').functionCallReturnValue"
|
|
3938
|
+
// This is a method call on a variable (not a hook call), but we still need to
|
|
3939
|
+
// track it so transitive resolution can resolve `splat` to its actual source.
|
|
3940
|
+
// E.g., if splat -> useParams().functionCallReturnValue['*'], then
|
|
3941
|
+
// segments -> useParams().functionCallReturnValue['*'].split('/').functionCallReturnValue
|
|
3942
|
+
if (
|
|
3943
|
+
!path.includes('.') && // path is a simple identifier
|
|
3944
|
+
equivalentValue.schemaPath.endsWith('.functionCallReturnValue') && // ends with function return
|
|
3945
|
+
equivalentValue.schemaPath.includes('.') && // has property access (method call)
|
|
3946
|
+
!(path in equivalentSignatureVariables) // not already captured
|
|
3947
|
+
) {
|
|
3948
|
+
// Check if this looks like a method call on a variable (not a hook call)
|
|
3949
|
+
// Hook calls look like: hookName() or hookName<T>()
|
|
3950
|
+
// Method calls look like: variable.method() or variable.method<T>()
|
|
3951
|
+
const hookCallPath = equivalentValue.schemaPath.slice(
|
|
3952
|
+
0,
|
|
3953
|
+
-'.functionCallReturnValue'.length,
|
|
3954
|
+
);
|
|
3955
|
+
// If it's a method call (contains a dot before the parenthesis), include it
|
|
3956
|
+
const dotBeforeParen = hookCallPath.indexOf('.');
|
|
3957
|
+
const parenPos = hookCallPath.indexOf('(');
|
|
3958
|
+
if (dotBeforeParen !== -1 && dotBeforeParen < parenPos) {
|
|
3959
|
+
// This is a method call like "splat.split('/')", not a hook call
|
|
3960
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3966
|
+
// Case 6: Collect JSX child prop equivalencies from child scopes (Fix 26)
|
|
3967
|
+
// When a parent component renders <ChildComponent prop={value} />, the JSX
|
|
3968
|
+
// return statement may be in a child scope (e.g., cyScope2). The equivalencies
|
|
3969
|
+
// like ChildComponent().signature[0].prop -> value get stored in that child scope.
|
|
3970
|
+
// But translateChildPathToParent needs to find them from the parent scope's context.
|
|
3971
|
+
// So we collect Case 4 patterns from ALL child scopes that belong to this root scope.
|
|
3972
|
+
const rootName = this.scopeTreeManager.getRootName();
|
|
3973
|
+
for (const [scopeName, childScopeNode] of Object.entries(this.scopeNodes)) {
|
|
3974
|
+
// Skip the root scope (already processed above)
|
|
3975
|
+
if (scopeName === rootName) continue;
|
|
3976
|
+
|
|
3977
|
+
// Only include scopes that are children of the root (their tree includes root)
|
|
3978
|
+
if (!childScopeNode.tree?.includes(rootName)) continue;
|
|
3979
|
+
|
|
3980
|
+
// Look for Case 4 patterns in the child scope
|
|
3981
|
+
for (const [path, equivalentValues] of Object.entries(
|
|
3982
|
+
childScopeNode.equivalencies || {},
|
|
3983
|
+
)) {
|
|
3984
|
+
for (const equivalentValue of equivalentValues) {
|
|
3985
|
+
// Case 4 pattern: ChildComponent().signature[0].propName -> parentVariable
|
|
3986
|
+
if (
|
|
3987
|
+
path.includes('().signature[') &&
|
|
3988
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable
|
|
3989
|
+
) {
|
|
3990
|
+
// Only add if not already present from the root scope
|
|
3991
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
3992
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3499
3996
|
}
|
|
3500
3997
|
}
|
|
3501
3998
|
|
|
3999
|
+
// Transitive resolution: Resolve variable chains through multiple levels
|
|
4000
|
+
// E.g., analysis → currentEntityAnalysis → useLoaderData().functionCallReturnValue.currentEntityAnalysis
|
|
4001
|
+
// We need multiple passes because resolutions can depend on each other
|
|
4002
|
+
const maxIterations = 5; // Prevent infinite loops
|
|
4003
|
+
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
4004
|
+
let changed = false;
|
|
4005
|
+
|
|
4006
|
+
for (const [varName, sourcePath] of Object.entries(
|
|
4007
|
+
equivalentSignatureVariables,
|
|
4008
|
+
)) {
|
|
4009
|
+
// Skip if already fully resolved (contains function call syntax)
|
|
4010
|
+
// BUT first check for computed value patterns that need resolution (Fix 28)
|
|
4011
|
+
// AND method call patterns that need base variable resolution (Fix 33)
|
|
4012
|
+
if (sourcePath.includes('()')) {
|
|
4013
|
+
// Fix 28: Handle computed value patterns with dependency arrays
|
|
4014
|
+
// Patterns like `functionName(arg, [dep1, dep2, ...])` are NOT controllable
|
|
4015
|
+
// data sources. We trace through the dependencies to find controllable sources.
|
|
4016
|
+
const bracketStart = sourcePath.indexOf('[');
|
|
4017
|
+
const bracketEnd = sourcePath.lastIndexOf(']');
|
|
4018
|
+
|
|
4019
|
+
if (bracketStart !== -1 && bracketEnd > bracketStart) {
|
|
4020
|
+
const arrayContent = sourcePath.slice(bracketStart + 1, bracketEnd);
|
|
4021
|
+
const items = arrayContent.split(',').map((s) => s.trim());
|
|
4022
|
+
|
|
4023
|
+
// Only process if this looks like a dependency array:
|
|
4024
|
+
// multiple items that are all simple identifiers (not numbers or expressions)
|
|
4025
|
+
const isIdentifier = (s: string) =>
|
|
4026
|
+
/^\w+$/.test(s) && !/^\d+$/.test(s);
|
|
4027
|
+
if (items.length > 1 && items.every(isIdentifier)) {
|
|
4028
|
+
// Look for a dependency that's already resolved to a controllable source
|
|
4029
|
+
for (const dep of items) {
|
|
4030
|
+
if (dep in equivalentSignatureVariables) {
|
|
4031
|
+
const resolvedDep = equivalentSignatureVariables[dep];
|
|
4032
|
+
// Use if it's a controllable path (contains hook call)
|
|
4033
|
+
// and is NOT another unresolved computed pattern (has comma-separated deps)
|
|
4034
|
+
const hasCommaInBrackets =
|
|
4035
|
+
resolvedDep.includes('[') &&
|
|
4036
|
+
resolvedDep.includes(',') &&
|
|
4037
|
+
resolvedDep.indexOf(',') > resolvedDep.indexOf('[');
|
|
4038
|
+
if (resolvedDep.includes('()') && !hasCommaInBrackets) {
|
|
4039
|
+
// Computed value is typically an element from an array
|
|
4040
|
+
equivalentSignatureVariables[varName] = resolvedDep + '[]';
|
|
4041
|
+
changed = true;
|
|
4042
|
+
break;
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
// Fix 33: Handle method call patterns on variables
|
|
4050
|
+
// Patterns like: "splat.split('/').functionCallReturnValue"
|
|
4051
|
+
// We need to resolve the base variable (splat) to its actual source
|
|
4052
|
+
// Check if this is a method call on a variable (dot before first parenthesis)
|
|
4053
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
4054
|
+
const parenIndex = sourcePath.indexOf('(');
|
|
4055
|
+
if (
|
|
4056
|
+
dotIndex !== -1 &&
|
|
4057
|
+
dotIndex < parenIndex &&
|
|
4058
|
+
!sourcePath.startsWith('use') // Not a hook call like useState()
|
|
4059
|
+
) {
|
|
4060
|
+
// Extract the base variable (before the first dot)
|
|
4061
|
+
const baseVar = sourcePath.slice(0, dotIndex);
|
|
4062
|
+
const rest = sourcePath.slice(dotIndex); // includes ".method(...).functionCallReturnValue"
|
|
4063
|
+
|
|
4064
|
+
// Check if the base variable can be resolved
|
|
4065
|
+
if (
|
|
4066
|
+
baseVar in equivalentSignatureVariables &&
|
|
4067
|
+
baseVar !== varName
|
|
4068
|
+
) {
|
|
4069
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
4070
|
+
// Only resolve if the base resolved to something useful (contains () or .)
|
|
4071
|
+
if (baseResolved.includes('()') || baseResolved.includes('.')) {
|
|
4072
|
+
const newPath = baseResolved + rest;
|
|
4073
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
4074
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
4075
|
+
changed = true;
|
|
4076
|
+
}
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
|
|
4081
|
+
continue;
|
|
4082
|
+
}
|
|
4083
|
+
|
|
4084
|
+
// Check if the source path starts with a variable that's also in the map
|
|
4085
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
4086
|
+
let baseVar: string;
|
|
4087
|
+
let rest: string;
|
|
4088
|
+
|
|
4089
|
+
if (dotIndex > 0) {
|
|
4090
|
+
// Path has a dot: "a.b.c" -> baseVar="a", rest=".b.c"
|
|
4091
|
+
baseVar = sourcePath.slice(0, dotIndex);
|
|
4092
|
+
rest = sourcePath.slice(dotIndex); // includes the leading dot
|
|
4093
|
+
} else {
|
|
4094
|
+
// Path is a simple identifier: "currentEntityAnalysis" -> baseVar="currentEntityAnalysis", rest=""
|
|
4095
|
+
baseVar = sourcePath;
|
|
4096
|
+
rest = '';
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
if (baseVar in equivalentSignatureVariables && baseVar !== varName) {
|
|
4100
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
4101
|
+
// If the base resolves to a hook call, add .functionCallReturnValue
|
|
4102
|
+
if (baseResolved.endsWith('()')) {
|
|
4103
|
+
const newPath = baseResolved + '.functionCallReturnValue' + rest;
|
|
4104
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
4105
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
4106
|
+
changed = true;
|
|
4107
|
+
}
|
|
4108
|
+
} else if (baseResolved !== sourcePath) {
|
|
4109
|
+
const newPath = baseResolved + rest;
|
|
4110
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
4111
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
4112
|
+
changed = true;
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
}
|
|
4117
|
+
|
|
4118
|
+
// Stop if no changes were made in this iteration
|
|
4119
|
+
if (!changed) break;
|
|
4120
|
+
}
|
|
4121
|
+
|
|
3502
4122
|
return equivalentSignatureVariables;
|
|
3503
4123
|
}
|
|
3504
4124
|
|
|
@@ -3549,7 +4169,12 @@ export class ScopeDataStructure {
|
|
|
3549
4169
|
relevantSchema,
|
|
3550
4170
|
);
|
|
3551
4171
|
|
|
4172
|
+
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
4173
|
+
// during this "getter" method. See comment in getFunctionSignature.
|
|
4174
|
+
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
4175
|
+
this.onlyEquivalencies = true;
|
|
3552
4176
|
this.validateSchema(tempScopeNode, true, final);
|
|
4177
|
+
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
3553
4178
|
|
|
3554
4179
|
return {
|
|
3555
4180
|
name: variableName,
|
|
@@ -3558,8 +4183,123 @@ export class ScopeDataStructure {
|
|
|
3558
4183
|
};
|
|
3559
4184
|
}
|
|
3560
4185
|
|
|
3561
|
-
getExternalFunctionCalls() {
|
|
3562
|
-
|
|
4186
|
+
getExternalFunctionCalls(): FunctionCallInfo[] {
|
|
4187
|
+
// Replace cyScope placeholders in all external function call data
|
|
4188
|
+
// This ensures call signatures and schema paths use actual callback text
|
|
4189
|
+
// instead of internal cyScope names, preventing mock data merge conflicts.
|
|
4190
|
+
return this.externalFunctionCalls.map((efc) =>
|
|
4191
|
+
this.cleanCyScopeFromFunctionCallInfo(efc),
|
|
4192
|
+
);
|
|
4193
|
+
}
|
|
4194
|
+
|
|
4195
|
+
/**
|
|
4196
|
+
* Cleans cyScope placeholder references from a FunctionCallInfo.
|
|
4197
|
+
* Replaces cyScopeN() with the actual callback text in:
|
|
4198
|
+
* - callSignature
|
|
4199
|
+
* - allCallSignatures
|
|
4200
|
+
* - schema keys
|
|
4201
|
+
*/
|
|
4202
|
+
private cleanCyScopeFromFunctionCallInfo(
|
|
4203
|
+
efc: FunctionCallInfo,
|
|
4204
|
+
): FunctionCallInfo {
|
|
4205
|
+
const cyScopePattern = /cyScope\d+\(\)/g;
|
|
4206
|
+
|
|
4207
|
+
// Check if any cleaning is needed
|
|
4208
|
+
const hasCyScope =
|
|
4209
|
+
cyScopePattern.test(efc.callSignature) ||
|
|
4210
|
+
(efc.allCallSignatures &&
|
|
4211
|
+
efc.allCallSignatures.some((sig) => /cyScope\d+\(\)/.test(sig))) ||
|
|
4212
|
+
(efc.schema &&
|
|
4213
|
+
Object.keys(efc.schema).some((key) => /cyScope\d+\(\)/.test(key)));
|
|
4214
|
+
|
|
4215
|
+
if (!hasCyScope) {
|
|
4216
|
+
return efc;
|
|
4217
|
+
}
|
|
4218
|
+
|
|
4219
|
+
// Create cleaned copy
|
|
4220
|
+
const cleaned: FunctionCallInfo = { ...efc };
|
|
4221
|
+
|
|
4222
|
+
// Clean callSignature
|
|
4223
|
+
cleaned.callSignature = this.replaceCyScopeInString(efc.callSignature);
|
|
4224
|
+
|
|
4225
|
+
// Clean allCallSignatures
|
|
4226
|
+
if (efc.allCallSignatures) {
|
|
4227
|
+
cleaned.allCallSignatures = efc.allCallSignatures.map((sig) =>
|
|
4228
|
+
this.replaceCyScopeInString(sig),
|
|
4229
|
+
);
|
|
4230
|
+
}
|
|
4231
|
+
|
|
4232
|
+
// Clean schema keys
|
|
4233
|
+
if (efc.schema) {
|
|
4234
|
+
cleaned.schema = this.replaceCyScopePlaceholders(efc.schema);
|
|
4235
|
+
}
|
|
4236
|
+
|
|
4237
|
+
// Clean callSignatureToVariable keys
|
|
4238
|
+
if (efc.callSignatureToVariable) {
|
|
4239
|
+
cleaned.callSignatureToVariable = Object.entries(
|
|
4240
|
+
efc.callSignatureToVariable,
|
|
4241
|
+
).reduce(
|
|
4242
|
+
(acc, [key, value]) => {
|
|
4243
|
+
acc[this.replaceCyScopeInString(key)] = value;
|
|
4244
|
+
return acc;
|
|
4245
|
+
},
|
|
4246
|
+
{} as Record<string, string>,
|
|
4247
|
+
);
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4250
|
+
return cleaned;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
/**
|
|
4254
|
+
* Replaces cyScope placeholder references in a single string.
|
|
4255
|
+
* If the scope text can't be found, uses a generic fallback to avoid leaking
|
|
4256
|
+
* internal cyScope names into stored data.
|
|
4257
|
+
*
|
|
4258
|
+
* Handles two patterns:
|
|
4259
|
+
* 1. Function call style: cyScope7() - matched by cyScope(\d+)\(\)
|
|
4260
|
+
* 2. Scope name style: parentName____cyScopeXX or cyScopeXX - matched by (\w+____)?cyScope([0-9A-Fa-f]+)
|
|
4261
|
+
*/
|
|
4262
|
+
private replaceCyScopeInString(str: string): string {
|
|
4263
|
+
let result = str;
|
|
4264
|
+
|
|
4265
|
+
// Pattern 1: Function call style - cyScope7()
|
|
4266
|
+
const functionCallPattern = /cyScope(\d+)\(\)/g;
|
|
4267
|
+
const functionCallMatches = [...str.matchAll(functionCallPattern)];
|
|
4268
|
+
for (const match of functionCallMatches) {
|
|
4269
|
+
const cyScopeName = `cyScope${match[1]}`;
|
|
4270
|
+
const scopeText = this.findCyScopeText(cyScopeName);
|
|
4271
|
+
// Always replace cyScope references - use actual text if available,
|
|
4272
|
+
// otherwise use a generic callback placeholder
|
|
4273
|
+
const replacement = scopeText || '() => {}';
|
|
4274
|
+
result = result.replace(match[0], replacement);
|
|
4275
|
+
}
|
|
4276
|
+
|
|
4277
|
+
// Pattern 2: Scope name style - parentName____cyScopeXX or just cyScopeXX
|
|
4278
|
+
// This handles hex-encoded scope IDs like cyScope1F
|
|
4279
|
+
const scopeNamePattern = /(\w+____)?cyScope([0-9A-Fa-f]+)/g;
|
|
4280
|
+
const scopeNameMatches = [...result.matchAll(scopeNamePattern)];
|
|
4281
|
+
for (const match of scopeNameMatches) {
|
|
4282
|
+
const fullMatch = match[0];
|
|
4283
|
+
const prefix = match[1] || ''; // e.g., "getTitleColor____"
|
|
4284
|
+
const cyScopeId = match[2]; // e.g., "1F"
|
|
4285
|
+
const cyScopeName = `cyScope${cyScopeId}`;
|
|
4286
|
+
|
|
4287
|
+
// Try to find the scope text, checking both with and without prefix
|
|
4288
|
+
let scopeText = this.findCyScopeText(cyScopeName);
|
|
4289
|
+
if (!scopeText && prefix) {
|
|
4290
|
+
// Try looking up with the full prefixed name
|
|
4291
|
+
scopeText = this.findCyScopeText(`${prefix}${cyScopeName}`);
|
|
4292
|
+
}
|
|
4293
|
+
|
|
4294
|
+
if (scopeText) {
|
|
4295
|
+
result = result.replace(fullMatch, scopeText);
|
|
4296
|
+
} else {
|
|
4297
|
+
// Replace with a generic identifier to avoid leaking internal names
|
|
4298
|
+
result = result.replace(fullMatch, 'callback');
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
return result;
|
|
3563
4303
|
}
|
|
3564
4304
|
|
|
3565
4305
|
getEnvironmentVariables() {
|
|
@@ -3602,29 +4342,145 @@ export class ScopeDataStructure {
|
|
|
3602
4342
|
}
|
|
3603
4343
|
|
|
3604
4344
|
/**
|
|
3605
|
-
*
|
|
3606
|
-
*
|
|
4345
|
+
* Add conditional effects from AST analysis.
|
|
4346
|
+
* Called during scope analysis to collect all setter calls inside conditionals.
|
|
4347
|
+
*/
|
|
4348
|
+
addConditionalEffects(
|
|
4349
|
+
effects: import('../astScopes/types').ConditionalEffect[],
|
|
4350
|
+
): void {
|
|
4351
|
+
// Add effects, avoiding duplicates based on effect stateVariable and condition paths
|
|
4352
|
+
for (const effect of effects) {
|
|
4353
|
+
const exists = this.rawConditionalEffects.some((existing) => {
|
|
4354
|
+
// Same effect target (stateVariable + value)
|
|
4355
|
+
const sameEffect =
|
|
4356
|
+
existing.effect.stateVariable === effect.effect.stateVariable &&
|
|
4357
|
+
existing.effect.value === effect.effect.value;
|
|
4358
|
+
if (!sameEffect) return false;
|
|
4359
|
+
|
|
4360
|
+
// Same condition(s)
|
|
4361
|
+
if (existing.condition && effect.condition) {
|
|
4362
|
+
return (
|
|
4363
|
+
existing.condition.path === effect.condition.path &&
|
|
4364
|
+
existing.condition.requiredValue === effect.condition.requiredValue
|
|
4365
|
+
);
|
|
4366
|
+
}
|
|
4367
|
+
if (existing.conditions && effect.conditions) {
|
|
4368
|
+
if (existing.conditions.length !== effect.conditions.length)
|
|
4369
|
+
return false;
|
|
4370
|
+
return existing.conditions.every((ec, i) => {
|
|
4371
|
+
const newCond = effect.conditions![i];
|
|
4372
|
+
return (
|
|
4373
|
+
ec.path === newCond.path &&
|
|
4374
|
+
ec.requiredValue === newCond.requiredValue
|
|
4375
|
+
);
|
|
4376
|
+
});
|
|
4377
|
+
}
|
|
4378
|
+
return false;
|
|
4379
|
+
});
|
|
4380
|
+
if (!exists) {
|
|
4381
|
+
this.rawConditionalEffects.push(effect);
|
|
4382
|
+
}
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
|
|
4386
|
+
/**
|
|
4387
|
+
* Get conditional effects collected during analysis.
|
|
4388
|
+
*/
|
|
4389
|
+
getConditionalEffects(): import('../astScopes/types').ConditionalEffect[] {
|
|
4390
|
+
return this.rawConditionalEffects;
|
|
4391
|
+
}
|
|
4392
|
+
|
|
4393
|
+
/**
|
|
4394
|
+
* Add compound conditionals from AST analysis.
|
|
4395
|
+
* Called during scope analysis to collect grouped conditions (e.g., a && b && c).
|
|
3607
4396
|
*/
|
|
3608
|
-
|
|
4397
|
+
addCompoundConditionals(
|
|
4398
|
+
compounds: import('../astScopes/types').CompoundConditional[],
|
|
4399
|
+
): void {
|
|
4400
|
+
// Add compounds, avoiding duplicates based on chainId
|
|
4401
|
+
for (const compound of compounds) {
|
|
4402
|
+
const exists = this.rawCompoundConditionals.some(
|
|
4403
|
+
(existing) => existing.chainId === compound.chainId,
|
|
4404
|
+
);
|
|
4405
|
+
if (!exists) {
|
|
4406
|
+
this.rawCompoundConditionals.push(compound);
|
|
4407
|
+
}
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
|
|
4411
|
+
/**
|
|
4412
|
+
* Get compound conditionals collected during analysis.
|
|
4413
|
+
*/
|
|
4414
|
+
getCompoundConditionals(): import('../astScopes/types').CompoundConditional[] {
|
|
4415
|
+
return this.rawCompoundConditionals;
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4418
|
+
/**
|
|
4419
|
+
* Add child boundary gating conditions from AST analysis.
|
|
4420
|
+
* These track which conditions must be true for a child component to render.
|
|
4421
|
+
*/
|
|
4422
|
+
addChildBoundaryGatingConditions(
|
|
4423
|
+
conditions: Record<string, import('../astScopes/types').ConditionalUsage[]>,
|
|
4424
|
+
): void {
|
|
4425
|
+
for (const [childName, usages] of Object.entries(conditions)) {
|
|
4426
|
+
if (!this.rawChildBoundaryGatingConditions[childName]) {
|
|
4427
|
+
this.rawChildBoundaryGatingConditions[childName] = [];
|
|
4428
|
+
}
|
|
4429
|
+
// Add usages, avoiding duplicates
|
|
4430
|
+
for (const usage of usages) {
|
|
4431
|
+
const exists = this.rawChildBoundaryGatingConditions[childName].some(
|
|
4432
|
+
(existing) =>
|
|
4433
|
+
existing.path === usage.path &&
|
|
4434
|
+
existing.conditionType === usage.conditionType &&
|
|
4435
|
+
existing.isNegated === usage.isNegated,
|
|
4436
|
+
);
|
|
4437
|
+
if (!exists) {
|
|
4438
|
+
this.rawChildBoundaryGatingConditions[childName].push(usage);
|
|
4439
|
+
}
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
|
|
4444
|
+
/**
|
|
4445
|
+
* Get enriched child boundary gating conditions with source tracing.
|
|
4446
|
+
* Similar to getEnrichedConditionalUsages but for gating conditions.
|
|
4447
|
+
*/
|
|
4448
|
+
getEnrichedChildBoundaryGatingConditions(): Record<
|
|
3609
4449
|
string,
|
|
3610
|
-
|
|
3611
|
-
path: string;
|
|
3612
|
-
conditionType: 'truthiness' | 'comparison' | 'switch';
|
|
3613
|
-
comparedValues?: string[];
|
|
3614
|
-
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
3615
|
-
sourceDataPath?: string;
|
|
3616
|
-
}>
|
|
4450
|
+
EnrichedConditionalUsage[]
|
|
3617
4451
|
> {
|
|
3618
|
-
const enriched: Record<
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
4452
|
+
const enriched: Record<string, EnrichedConditionalUsage[]> = {};
|
|
4453
|
+
const rootScopeName = this.scopeTreeManager.getTree().name;
|
|
4454
|
+
|
|
4455
|
+
for (const [childName, usages] of Object.entries(
|
|
4456
|
+
this.rawChildBoundaryGatingConditions,
|
|
4457
|
+
)) {
|
|
4458
|
+
enriched[childName] = usages.map((usage) => {
|
|
4459
|
+
// Try to trace this path back to a data source
|
|
4460
|
+
const explanation = this.explainPath(rootScopeName, usage.path);
|
|
4461
|
+
|
|
4462
|
+
let sourceDataPath: string | undefined;
|
|
4463
|
+
if (explanation.source) {
|
|
4464
|
+
sourceDataPath = `${explanation.source.scope}.${explanation.source.path}`;
|
|
4465
|
+
}
|
|
4466
|
+
|
|
4467
|
+
return {
|
|
4468
|
+
...usage,
|
|
4469
|
+
sourceDataPath,
|
|
4470
|
+
};
|
|
4471
|
+
});
|
|
4472
|
+
}
|
|
4473
|
+
|
|
4474
|
+
return enriched;
|
|
4475
|
+
}
|
|
4476
|
+
|
|
4477
|
+
/**
|
|
4478
|
+
* Get enriched conditional usages with source tracing.
|
|
4479
|
+
* Uses explainPath to trace each local variable back to its data source.
|
|
4480
|
+
* Preserves all fields from the raw conditional usages including derivedFrom.
|
|
4481
|
+
*/
|
|
4482
|
+
getEnrichedConditionalUsages(): Record<string, EnrichedConditionalUsage[]> {
|
|
4483
|
+
const enriched: Record<string, EnrichedConditionalUsage[]> = {};
|
|
3628
4484
|
|
|
3629
4485
|
for (const [path, usages] of Object.entries(this.rawConditionalUsages)) {
|
|
3630
4486
|
// Try to trace this path back to a data source
|
|
@@ -3648,34 +4504,58 @@ export class ScopeDataStructure {
|
|
|
3648
4504
|
}
|
|
3649
4505
|
|
|
3650
4506
|
toSerializable(): SerializableDataStructure {
|
|
3651
|
-
// Helper to
|
|
4507
|
+
// Helper to clean cyScope and cyDuplicateKey from a string for output
|
|
4508
|
+
const cleanCyScope = (str: string): string =>
|
|
4509
|
+
this.replaceCyScopeInString(str).replace(/::cyDuplicateKey\d+::/g, '');
|
|
4510
|
+
|
|
4511
|
+
// Helper to convert ScopeVariable to SerializableScopeVariable (with cyScope cleaned)
|
|
3652
4512
|
const toSerializableVariable = (
|
|
3653
4513
|
vars:
|
|
3654
4514
|
| ScopeVariable[]
|
|
3655
4515
|
| Pick<ScopeVariable, 'scopeNodeName' | 'schemaPath'>[],
|
|
3656
4516
|
): SerializableScopeVariable[] =>
|
|
3657
4517
|
vars.map((v) => ({
|
|
3658
|
-
scopeNodeName: v.scopeNodeName,
|
|
3659
|
-
schemaPath: v.schemaPath,
|
|
4518
|
+
scopeNodeName: cleanCyScope(v.scopeNodeName),
|
|
4519
|
+
schemaPath: cleanCyScope(v.schemaPath),
|
|
3660
4520
|
}));
|
|
3661
4521
|
|
|
4522
|
+
// Helper to clean cyScope from all keys in a schema
|
|
4523
|
+
const cleanSchemaKeys = (
|
|
4524
|
+
schema: Record<string, string>,
|
|
4525
|
+
): Record<string, string> => {
|
|
4526
|
+
return Object.entries(schema).reduce(
|
|
4527
|
+
(acc, [key, value]) => {
|
|
4528
|
+
acc[cleanCyScope(key)] = value;
|
|
4529
|
+
return acc;
|
|
4530
|
+
},
|
|
4531
|
+
{} as Record<string, string>,
|
|
4532
|
+
);
|
|
4533
|
+
};
|
|
4534
|
+
|
|
3662
4535
|
// Helper to get function result for a given function name
|
|
3663
4536
|
const getFunctionResult = (
|
|
3664
4537
|
functionName?: string,
|
|
3665
4538
|
): SerializableFunctionResult => {
|
|
3666
4539
|
return {
|
|
3667
|
-
signature:
|
|
3668
|
-
|
|
4540
|
+
signature: cleanSchemaKeys(
|
|
4541
|
+
this.getFunctionSignature({ functionName }) ?? {},
|
|
4542
|
+
),
|
|
4543
|
+
signatureWithUnknowns: cleanSchemaKeys(
|
|
3669
4544
|
this.getFunctionSignature({ functionName, fillInUnknowns: true }) ??
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
4545
|
+
{},
|
|
4546
|
+
),
|
|
4547
|
+
returnValue: cleanSchemaKeys(
|
|
4548
|
+
this.getReturnValue({ functionName }) ?? {},
|
|
4549
|
+
),
|
|
4550
|
+
returnValueWithUnknowns: cleanSchemaKeys(
|
|
3673
4551
|
this.getReturnValue({ functionName, fillInUnknowns: true }) ?? {},
|
|
4552
|
+
),
|
|
3674
4553
|
usageEquivalencies: Object.entries(
|
|
3675
4554
|
this.getUsageEquivalencies(functionName) ?? {},
|
|
3676
4555
|
).reduce(
|
|
3677
4556
|
(acc, [key, vars]) => {
|
|
3678
|
-
|
|
4557
|
+
// Clean cyScope from the key as well as variable properties
|
|
4558
|
+
acc[cleanCyScope(key)] = toSerializableVariable(vars);
|
|
3679
4559
|
return acc;
|
|
3680
4560
|
},
|
|
3681
4561
|
{} as Record<string, SerializableScopeVariable[]>,
|
|
@@ -3684,7 +4564,8 @@ export class ScopeDataStructure {
|
|
|
3684
4564
|
this.getSourceEquivalencies(functionName) ?? {},
|
|
3685
4565
|
).reduce(
|
|
3686
4566
|
(acc, [key, vars]) => {
|
|
3687
|
-
|
|
4567
|
+
// Clean cyScope from the key as well as variable properties
|
|
4568
|
+
acc[cleanCyScope(key)] = toSerializableVariable(vars);
|
|
3688
4569
|
return acc;
|
|
3689
4570
|
},
|
|
3690
4571
|
{} as Record<string, SerializableScopeVariable[]>,
|
|
@@ -3693,39 +4574,406 @@ export class ScopeDataStructure {
|
|
|
3693
4574
|
};
|
|
3694
4575
|
};
|
|
3695
4576
|
|
|
3696
|
-
// Convert external function calls
|
|
4577
|
+
// Convert external function calls - use getExternalFunctionCalls() which cleans cyScope
|
|
4578
|
+
const cleanedExternalCalls = this.getExternalFunctionCalls();
|
|
4579
|
+
|
|
4580
|
+
// Get root scope schema for building per-variable return value schemas
|
|
4581
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
4582
|
+
const rootScope = this.scopeNodes[rootScopeName];
|
|
4583
|
+
const rootSchema = rootScope?.schema ?? {};
|
|
4584
|
+
|
|
3697
4585
|
const externalFunctionCalls: SerializableFunctionCallInfo[] =
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
4586
|
+
cleanedExternalCalls.map((efc) => {
|
|
4587
|
+
// Build perVariableSchemas from perCallSignatureSchemas when available.
|
|
4588
|
+
// This preserves distinct schemas per variable when the same function is called
|
|
4589
|
+
// multiple times with DIFFERENT call signatures (e.g., different type parameters).
|
|
4590
|
+
//
|
|
4591
|
+
// When field accesses happen in child scopes (like JSX expressions), the
|
|
4592
|
+
// rootSchema doesn't contain the detailed paths - they end up in child scope
|
|
4593
|
+
// schemas. Using perCallSignatureSchemas ensures we get the correct schema
|
|
4594
|
+
// for each call, regardless of where field accesses occur.
|
|
4595
|
+
let perVariableSchemas:
|
|
4596
|
+
| Record<string, Record<string, string>>
|
|
4597
|
+
| undefined;
|
|
4598
|
+
|
|
4599
|
+
// Use perCallSignatureSchemas only when:
|
|
4600
|
+
// 1. It exists and has distinct entries for different call signatures
|
|
4601
|
+
// 2. The number of distinct call signatures >= number of receiving variables
|
|
4602
|
+
//
|
|
4603
|
+
// This prevents using it when all calls have the same signature (e.g., useFetcher() x 2)
|
|
4604
|
+
// because in that case, perCallSignatureSchemas only has one entry.
|
|
4605
|
+
const numCallSignatures = efc.perCallSignatureSchemas
|
|
4606
|
+
? Object.keys(efc.perCallSignatureSchemas).length
|
|
4607
|
+
: 0;
|
|
4608
|
+
const numReceivingVars = efc.receivingVariableNames?.length ?? 0;
|
|
4609
|
+
const hasDistinctSchemas =
|
|
4610
|
+
numCallSignatures >= numReceivingVars && numCallSignatures > 1;
|
|
4611
|
+
|
|
4612
|
+
// CASE 1: Multiple call signatures with distinct schemas - use indexed variable names
|
|
4613
|
+
if (
|
|
4614
|
+
hasDistinctSchemas &&
|
|
4615
|
+
efc.perCallSignatureSchemas &&
|
|
4616
|
+
efc.callSignatureToVariable
|
|
4617
|
+
) {
|
|
4618
|
+
perVariableSchemas = {};
|
|
4619
|
+
|
|
4620
|
+
// Build a reverse map: variable -> array of call signatures (in order)
|
|
4621
|
+
// This handles the case where the same variable name is reused for different calls
|
|
4622
|
+
const varToCallSigs: Record<string, string[]> = {};
|
|
4623
|
+
for (const [callSig, varName] of Object.entries(
|
|
4624
|
+
efc.callSignatureToVariable,
|
|
4625
|
+
)) {
|
|
4626
|
+
if (!varToCallSigs[varName]) {
|
|
4627
|
+
varToCallSigs[varName] = [];
|
|
4628
|
+
}
|
|
4629
|
+
varToCallSigs[varName].push(callSig);
|
|
4630
|
+
}
|
|
4631
|
+
|
|
4632
|
+
// Track how many times each variable name has been seen
|
|
4633
|
+
const varNameCounts: Record<string, number> = {};
|
|
4634
|
+
|
|
4635
|
+
// For each receiving variable, get its original schema from perCallSignatureSchemas
|
|
4636
|
+
for (const varName of efc.receivingVariableNames ?? []) {
|
|
4637
|
+
const occurrence = varNameCounts[varName] ?? 0;
|
|
4638
|
+
varNameCounts[varName] = occurrence + 1;
|
|
4639
|
+
|
|
4640
|
+
const callSigs = varToCallSigs[varName];
|
|
4641
|
+
// Use the nth call signature for the nth occurrence of this variable
|
|
4642
|
+
const callSig = callSigs?.[occurrence];
|
|
4643
|
+
|
|
4644
|
+
if (callSig && efc.perCallSignatureSchemas[callSig]) {
|
|
4645
|
+
// Use indexed key if this variable name is reused (e.g., fetcher, fetcher[1])
|
|
4646
|
+
const key =
|
|
4647
|
+
occurrence === 0 ? varName : `${varName}[${occurrence}]`;
|
|
4648
|
+
// Clone the schema to avoid shared references
|
|
4649
|
+
perVariableSchemas[key] = {
|
|
4650
|
+
...efc.perCallSignatureSchemas[callSig],
|
|
4651
|
+
};
|
|
4652
|
+
}
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4655
|
+
// Only include if we have entries for ALL receiving variables
|
|
4656
|
+
if (Object.keys(perVariableSchemas).length < numReceivingVars) {
|
|
4657
|
+
// Not all variables have schemas - fall back to rootSchema extraction
|
|
4658
|
+
perVariableSchemas = undefined;
|
|
4659
|
+
} else {
|
|
4660
|
+
// Also check that at least one schema is non-empty
|
|
4661
|
+
// Bug fix: perCallSignatureSchemas may have entries but with empty schemas {}
|
|
4662
|
+
// In this case, we should fall through to Fallback which uses rootSchema
|
|
4663
|
+
const hasNonEmptySchema = Object.values(perVariableSchemas).some(
|
|
4664
|
+
(schema) => Object.keys(schema).length > 0,
|
|
4665
|
+
);
|
|
4666
|
+
if (!hasNonEmptySchema) {
|
|
4667
|
+
perVariableSchemas = undefined;
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4672
|
+
// CASE 2: Single call signature with single variable - use perCallSignatureSchemas directly
|
|
4673
|
+
// This handles parameterized calls like useFetcher<ConfigData>() where each is a separate efc entry
|
|
4674
|
+
if (
|
|
4675
|
+
!perVariableSchemas &&
|
|
4676
|
+
efc.perCallSignatureSchemas &&
|
|
4677
|
+
numCallSignatures === 1 &&
|
|
4678
|
+
numReceivingVars === 1
|
|
4679
|
+
) {
|
|
4680
|
+
const varName = efc.receivingVariableNames![0];
|
|
4681
|
+
const callSig = Object.keys(efc.perCallSignatureSchemas)[0];
|
|
4682
|
+
const schema = efc.perCallSignatureSchemas[callSig];
|
|
4683
|
+
if (schema && Object.keys(schema).length > 0) {
|
|
4684
|
+
perVariableSchemas = { [varName]: { ...schema } };
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
|
|
4688
|
+
// CASE 3: Extract from efc.schema when perCallSignatureSchemas is missing or empty
|
|
4689
|
+
// This handles two scenarios:
|
|
4690
|
+
// 1. Parameterized calls that create SEPARATE efc entries (no perCallSignatureSchemas)
|
|
4691
|
+
// 2. Destructuring where perCallSignatureSchemas exists but has EMPTY schemas
|
|
4692
|
+
//
|
|
4693
|
+
// When useFetcher<ConfigData>() and useFetcher<SettingsData>() are called, they create separate
|
|
4694
|
+
// efc entries because getFunctionCallRoot preserves type parameters. Each entry has its own
|
|
4695
|
+
// `schema` field, but due to variable reassignment, the schema may be contaminated with paths
|
|
4696
|
+
// from other calls (the tracer attributes field accesses to ALL equivalencies).
|
|
4697
|
+
//
|
|
4698
|
+
// Solution: Filter efc.schema to only include paths that match THIS entry's call signature.
|
|
4699
|
+
// The schema paths include the full call signature prefix, so we can filter by it.
|
|
4700
|
+
//
|
|
4701
|
+
// Example: ConfigData entry has paths like:
|
|
4702
|
+
// "useFetcher<{ data: ConfigData | null }>().functionCallReturnValue.data.data.theme"
|
|
4703
|
+
// But also (contaminated):
|
|
4704
|
+
// "useFetcher<{ data: ConfigData | null }>().functionCallReturnValue.data.data.notifications"
|
|
4705
|
+
//
|
|
4706
|
+
// We filter to only keep paths that should belong to THIS call by checking if the
|
|
4707
|
+
// receiving variable's equivalency points to this call's return value.
|
|
4708
|
+
//
|
|
4709
|
+
// BUG FIX: The old condition `!efc.perCallSignatureSchemas` was FALSE when the object
|
|
4710
|
+
// existed (even with empty schemas), causing this case to be skipped. We now also check
|
|
4711
|
+
// if all schemas in perCallSignatureSchemas are empty.
|
|
4712
|
+
const hasNonEmptyPerCallSignatureSchemas =
|
|
4713
|
+
efc.perCallSignatureSchemas &&
|
|
4714
|
+
Object.values(efc.perCallSignatureSchemas).some(
|
|
4715
|
+
(schema) => Object.keys(schema).length > 0,
|
|
4716
|
+
);
|
|
4717
|
+
|
|
4718
|
+
// Build the call signature prefix that paths should start with
|
|
4719
|
+
const callSigPrefix = `${efc.callSignature}.functionCallReturnValue`;
|
|
4720
|
+
|
|
4721
|
+
// Check if efc.schema has variable-specific paths (indicating destructuring).
|
|
4722
|
+
// Destructuring: const { entities, gitStatus } = useLoaderData()
|
|
4723
|
+
// - efc.schema has paths like: useLoaderData().functionCallReturnValue.entities...
|
|
4724
|
+
// Multiple calls: const x = useFetcher(); const y = useFetcher();
|
|
4725
|
+
// - efc.schema has paths like: useFetcher().functionCallReturnValue.data...
|
|
4726
|
+
// CASE 3 should only run for destructuring (variable-specific paths exist).
|
|
4727
|
+
const hasVariableSpecificPaths = (
|
|
4728
|
+
efc.receivingVariableNames ?? []
|
|
4729
|
+
).some((varName) =>
|
|
4730
|
+
Object.keys(efc.schema).some((path) =>
|
|
4731
|
+
path.startsWith(`${callSigPrefix}.${varName}`),
|
|
4732
|
+
),
|
|
4733
|
+
);
|
|
4734
|
+
|
|
4735
|
+
if (
|
|
4736
|
+
!perVariableSchemas &&
|
|
4737
|
+
!hasNonEmptyPerCallSignatureSchemas &&
|
|
4738
|
+
numReceivingVars >= 1 &&
|
|
4739
|
+
hasVariableSpecificPaths
|
|
4740
|
+
) {
|
|
4741
|
+
// Filter efc.schema to only include paths matching this call signature
|
|
4742
|
+
const filteredSchema: Record<string, string> = {};
|
|
4743
|
+
for (const [path, type] of Object.entries(efc.schema)) {
|
|
4744
|
+
if (path.startsWith(callSigPrefix) || path === efc.callSignature) {
|
|
4745
|
+
filteredSchema[path] = type;
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4748
|
+
|
|
4749
|
+
// Build perVariableSchemas from the filtered schema
|
|
4750
|
+
// For destructuring, filter paths by variable name
|
|
4751
|
+
if (Object.keys(filteredSchema).length > 0) {
|
|
4752
|
+
perVariableSchemas = {};
|
|
4753
|
+
for (const varName of efc.receivingVariableNames ?? []) {
|
|
4754
|
+
// For destructuring, extract only paths specific to this variable
|
|
4755
|
+
const varSpecificPrefix = `${callSigPrefix}.${varName}`;
|
|
4756
|
+
const varSchema: Record<string, string> = {};
|
|
4757
|
+
|
|
4758
|
+
for (const [path, type] of Object.entries(filteredSchema)) {
|
|
4759
|
+
if (path.startsWith(varSpecificPrefix)) {
|
|
4760
|
+
// Transform: useLoaderData().functionCallReturnValue.entities.sha
|
|
4761
|
+
// -> functionCallReturnValue.entities.sha (keep the variable name)
|
|
4762
|
+
const suffix = path.slice(callSigPrefix.length);
|
|
4763
|
+
const returnValuePath = `functionCallReturnValue${suffix}`;
|
|
4764
|
+
varSchema[returnValuePath] = type;
|
|
4765
|
+
} else if (path === efc.callSignature) {
|
|
4766
|
+
// Include the function call type itself
|
|
4767
|
+
varSchema[path] = type;
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
if (Object.keys(varSchema).length > 0) {
|
|
4771
|
+
perVariableSchemas[varName] = varSchema;
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
// Only include if we have entries
|
|
4775
|
+
if (Object.keys(perVariableSchemas).length === 0) {
|
|
4776
|
+
perVariableSchemas = undefined;
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
}
|
|
4780
|
+
|
|
4781
|
+
// Fallback: extract from root scope schema when perCallSignatureSchemas is not available
|
|
4782
|
+
// or doesn't have distinct entries for each variable.
|
|
4783
|
+
// This works when field accesses are in the root scope.
|
|
4784
|
+
if (
|
|
4785
|
+
!perVariableSchemas &&
|
|
4786
|
+
efc.receivingVariableNames &&
|
|
4787
|
+
efc.receivingVariableNames.length > 0
|
|
4788
|
+
) {
|
|
4789
|
+
perVariableSchemas = {};
|
|
4790
|
+
for (const varName of efc.receivingVariableNames) {
|
|
4791
|
+
const varSchema: Record<string, string> = {};
|
|
4792
|
+
for (const [path, type] of Object.entries(rootSchema)) {
|
|
4793
|
+
// Check if path starts with this variable name
|
|
4794
|
+
if (
|
|
4795
|
+
path === varName ||
|
|
4796
|
+
path.startsWith(varName + '.') ||
|
|
4797
|
+
path.startsWith(varName + '[')
|
|
4798
|
+
) {
|
|
4799
|
+
// Transform to functionCallReturnValue format
|
|
4800
|
+
// e.g., userFetcher.data.id -> functionCallReturnValue.data.id
|
|
4801
|
+
const suffix = path.slice(varName.length);
|
|
4802
|
+
const returnValuePath = `functionCallReturnValue${suffix}`;
|
|
4803
|
+
varSchema[returnValuePath] = type;
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
if (Object.keys(varSchema).length > 0) {
|
|
4807
|
+
// Clean the variable name when using as key in output
|
|
4808
|
+
perVariableSchemas[cleanCyScope(varName)] = varSchema;
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
// Only include if we have any entries
|
|
4812
|
+
if (Object.keys(perVariableSchemas).length === 0) {
|
|
4813
|
+
perVariableSchemas = undefined;
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
|
|
4817
|
+
return {
|
|
4818
|
+
name: efc.name,
|
|
4819
|
+
callSignature: efc.callSignature,
|
|
4820
|
+
callScope: efc.callScope,
|
|
4821
|
+
schema: efc.schema,
|
|
4822
|
+
equivalencies: efc.equivalencies
|
|
4823
|
+
? Object.entries(efc.equivalencies).reduce(
|
|
4824
|
+
(acc, [key, vars]) => {
|
|
4825
|
+
// Clean cyScope from the key as well as variable properties
|
|
4826
|
+
acc[cleanCyScope(key)] = toSerializableVariable(vars);
|
|
4827
|
+
return acc;
|
|
4828
|
+
},
|
|
4829
|
+
{} as Record<string, SerializableScopeVariable[]>,
|
|
4830
|
+
)
|
|
4831
|
+
: undefined,
|
|
4832
|
+
allCallSignatures: efc.allCallSignatures,
|
|
4833
|
+
receivingVariableNames: efc.receivingVariableNames?.map(cleanCyScope),
|
|
4834
|
+
callSignatureToVariable: efc.callSignatureToVariable
|
|
4835
|
+
? Object.fromEntries(
|
|
4836
|
+
Object.entries(efc.callSignatureToVariable).map(([k, v]) => [
|
|
4837
|
+
k,
|
|
4838
|
+
cleanCyScope(v),
|
|
4839
|
+
]),
|
|
4840
|
+
)
|
|
4841
|
+
: undefined,
|
|
4842
|
+
perVariableSchemas,
|
|
4843
|
+
};
|
|
4844
|
+
});
|
|
4845
|
+
|
|
4846
|
+
// POST-PROCESSING: Deduplicate schemas across parameterized calls to same base function
|
|
4847
|
+
// When useFetcher<ConfigData>() and useFetcher<SettingsData>() are called, they create
|
|
4848
|
+
// separate entries. Due to variable reassignment, BOTH entries may have ALL fields.
|
|
4849
|
+
// We deduplicate by assigning each field to ONLY ONE entry based on order of appearance.
|
|
4850
|
+
//
|
|
4851
|
+
// Strategy: Fields that appear first in order belong to the first entry,
|
|
4852
|
+
// fields that appear later belong to later entries (split evenly).
|
|
4853
|
+
const deduplicateParameterizedEntries = (
|
|
4854
|
+
entries: typeof externalFunctionCalls,
|
|
4855
|
+
): typeof externalFunctionCalls => {
|
|
4856
|
+
// Group entries by base function name (without type parameters)
|
|
4857
|
+
const groups = new Map<string, typeof externalFunctionCalls>();
|
|
4858
|
+
for (const entry of entries) {
|
|
4859
|
+
// Extract base function name by stripping type parameters
|
|
4860
|
+
// e.g., "useFetcher<{ data: ConfigData | null }>" -> "useFetcher"
|
|
4861
|
+
const baseName = entry.name.replace(/<.*>$/, '');
|
|
4862
|
+
const group = groups.get(baseName) || [];
|
|
4863
|
+
group.push(entry);
|
|
4864
|
+
groups.set(baseName, group);
|
|
4865
|
+
}
|
|
4866
|
+
|
|
4867
|
+
// Process groups with multiple parameterized entries
|
|
4868
|
+
for (const [, group] of groups) {
|
|
4869
|
+
if (group.length <= 1) continue;
|
|
4870
|
+
|
|
4871
|
+
// Check if these are parameterized calls (have type parameters in name)
|
|
4872
|
+
const hasTypeParams = group.every((e) => e.name.includes('<'));
|
|
4873
|
+
if (!hasTypeParams) continue;
|
|
4874
|
+
|
|
4875
|
+
// Collect ALL unique field suffixes across all entries (in order of first appearance)
|
|
4876
|
+
// Field suffix is the path after functionCallReturnValue, e.g., ".data.data.theme"
|
|
4877
|
+
const allFieldSuffixes: string[] = [];
|
|
4878
|
+
for (const entry of group) {
|
|
4879
|
+
if (!entry.perVariableSchemas) continue;
|
|
4880
|
+
for (const varSchema of Object.values(entry.perVariableSchemas)) {
|
|
4881
|
+
for (const path of Object.keys(varSchema)) {
|
|
4882
|
+
// Skip the base "functionCallReturnValue" entry
|
|
4883
|
+
if (path === 'functionCallReturnValue') continue;
|
|
4884
|
+
// Extract field suffix
|
|
4885
|
+
const match = path.match(/functionCallReturnValue(.+)/);
|
|
4886
|
+
if (!match) continue;
|
|
4887
|
+
const fieldSuffix = match[1];
|
|
4888
|
+
if (!allFieldSuffixes.includes(fieldSuffix)) {
|
|
4889
|
+
allFieldSuffixes.push(fieldSuffix);
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
|
|
4895
|
+
// Assign fields to entries: split evenly based on order
|
|
4896
|
+
// First N/2 fields go to first entry, remaining go to second entry
|
|
4897
|
+
const fieldToEntryMap = new Map<string, number>();
|
|
4898
|
+
const fieldsPerEntry = Math.ceil(
|
|
4899
|
+
allFieldSuffixes.length / group.length,
|
|
4900
|
+
);
|
|
4901
|
+
for (let i = 0; i < allFieldSuffixes.length; i++) {
|
|
4902
|
+
const fieldSuffix = allFieldSuffixes[i];
|
|
4903
|
+
const entryIdx = Math.min(
|
|
4904
|
+
Math.floor(i / fieldsPerEntry),
|
|
4905
|
+
group.length - 1,
|
|
4906
|
+
);
|
|
4907
|
+
fieldToEntryMap.set(fieldSuffix, entryIdx);
|
|
4908
|
+
}
|
|
4909
|
+
|
|
4910
|
+
// Filter each entry's perVariableSchemas to only include its assigned fields
|
|
4911
|
+
for (let i = 0; i < group.length; i++) {
|
|
4912
|
+
const entry = group[i];
|
|
4913
|
+
if (!entry.perVariableSchemas) continue;
|
|
4914
|
+
|
|
4915
|
+
const filteredPerVarSchemas: Record<
|
|
4916
|
+
string,
|
|
4917
|
+
Record<string, string>
|
|
4918
|
+
> = {};
|
|
4919
|
+
for (const [varName, varSchema] of Object.entries(
|
|
4920
|
+
entry.perVariableSchemas,
|
|
4921
|
+
)) {
|
|
4922
|
+
const filteredVarSchema: Record<string, string> = {};
|
|
4923
|
+
for (const [path, type] of Object.entries(varSchema)) {
|
|
4924
|
+
// Always keep the base functionCallReturnValue
|
|
4925
|
+
if (path === 'functionCallReturnValue') {
|
|
4926
|
+
filteredVarSchema[path] = type;
|
|
4927
|
+
continue;
|
|
4928
|
+
}
|
|
4929
|
+
// Extract field suffix
|
|
4930
|
+
const match = path.match(/functionCallReturnValue(.+)/);
|
|
4931
|
+
if (!match) {
|
|
4932
|
+
// Keep non-field paths
|
|
4933
|
+
filteredVarSchema[path] = type;
|
|
4934
|
+
continue;
|
|
4935
|
+
}
|
|
4936
|
+
const fieldSuffix = match[1];
|
|
4937
|
+
// Only include if this entry owns this field
|
|
4938
|
+
if (fieldToEntryMap.get(fieldSuffix) === i) {
|
|
4939
|
+
filteredVarSchema[path] = type;
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
if (Object.keys(filteredVarSchema).length > 0) {
|
|
4943
|
+
filteredPerVarSchemas[varName] = filteredVarSchema;
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
entry.perVariableSchemas =
|
|
4947
|
+
Object.keys(filteredPerVarSchemas).length > 0
|
|
4948
|
+
? filteredPerVarSchemas
|
|
4949
|
+
: undefined;
|
|
4950
|
+
}
|
|
4951
|
+
}
|
|
4952
|
+
|
|
4953
|
+
return entries;
|
|
4954
|
+
};
|
|
4955
|
+
|
|
4956
|
+
// Apply deduplication
|
|
4957
|
+
const deduplicatedExternalFunctionCalls = deduplicateParameterizedEntries(
|
|
4958
|
+
externalFunctionCalls,
|
|
4959
|
+
);
|
|
4960
|
+
|
|
4961
|
+
// IMPORTANT: Get equivalent signature variables BEFORE calling getFunctionResult
|
|
4962
|
+
// because getFunctionResult calls validateSchema which may remove equivalencies
|
|
4963
|
+
// during the finalize step (e.g., cleanNonObjectFunctions removes method call
|
|
4964
|
+
// equivalencies like `segments -> splat.split('/').functionCallReturnValue`).
|
|
4965
|
+
// Fix 33: Move this call before any schema validation to preserve method call chains.
|
|
4966
|
+
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
3716
4967
|
|
|
3717
4968
|
// Get root function result
|
|
3718
4969
|
const rootFunction = getFunctionResult();
|
|
3719
4970
|
|
|
3720
|
-
// Get results for each external function
|
|
4971
|
+
// Get results for each external function (use cleaned calls for consistency)
|
|
3721
4972
|
const functionResults: Record<string, SerializableFunctionResult> = {};
|
|
3722
|
-
for (const efc of
|
|
4973
|
+
for (const efc of cleanedExternalCalls) {
|
|
3723
4974
|
functionResults[efc.name] = getFunctionResult(efc.name);
|
|
3724
4975
|
}
|
|
3725
4976
|
|
|
3726
|
-
// Get equivalent signature variables
|
|
3727
|
-
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
3728
|
-
|
|
3729
4977
|
const environmentVariables = this.getEnvironmentVariables();
|
|
3730
4978
|
|
|
3731
4979
|
// Get enriched conditional usages with source tracing
|
|
@@ -3735,13 +4983,36 @@ export class ScopeDataStructure {
|
|
|
3735
4983
|
? enrichedConditionalUsages
|
|
3736
4984
|
: undefined;
|
|
3737
4985
|
|
|
4986
|
+
// Get conditional effects (setter calls inside conditionals)
|
|
4987
|
+
const conditionalEffects =
|
|
4988
|
+
this.rawConditionalEffects.length > 0
|
|
4989
|
+
? this.rawConditionalEffects
|
|
4990
|
+
: undefined;
|
|
4991
|
+
|
|
4992
|
+
// Get compound conditionals (grouped conditions that must all be true)
|
|
4993
|
+
const compoundConditionals =
|
|
4994
|
+
this.rawCompoundConditionals.length > 0
|
|
4995
|
+
? this.rawCompoundConditionals
|
|
4996
|
+
: undefined;
|
|
4997
|
+
|
|
4998
|
+
// Get child boundary gating conditions
|
|
4999
|
+
const enrichedGatingConditions =
|
|
5000
|
+
this.getEnrichedChildBoundaryGatingConditions();
|
|
5001
|
+
const childBoundaryGatingConditions =
|
|
5002
|
+
Object.keys(enrichedGatingConditions).length > 0
|
|
5003
|
+
? enrichedGatingConditions
|
|
5004
|
+
: undefined;
|
|
5005
|
+
|
|
3738
5006
|
return {
|
|
3739
|
-
externalFunctionCalls,
|
|
5007
|
+
externalFunctionCalls: deduplicatedExternalFunctionCalls,
|
|
3740
5008
|
rootFunction,
|
|
3741
5009
|
functionResults,
|
|
3742
5010
|
equivalentSignatureVariables,
|
|
3743
5011
|
environmentVariables,
|
|
3744
5012
|
conditionalUsages,
|
|
5013
|
+
conditionalEffects,
|
|
5014
|
+
compoundConditionals,
|
|
5015
|
+
childBoundaryGatingConditions,
|
|
3745
5016
|
};
|
|
3746
5017
|
}
|
|
3747
5018
|
|