@codeyam/codeyam-cli 0.1.0-staging.b8a55ba → 0.1.0-staging.c90f8c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/common/execAsync.ts +1 -1
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +9 -6
- package/analyzer-template/packages/ai/index.ts +10 -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 +126 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +116 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +140 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +849 -9
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +244 -0
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +216 -36
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +892 -117
- 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 +296 -35
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +120 -76
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +80 -5
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +8 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
- package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
- package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
- package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +86 -142
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +1 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1111 -87
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +191 -191
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +570 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1977 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
- 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/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -142
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +90 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -89
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +11 -11
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +812 -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 +118 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- 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 +381 -265
- 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/analyze/validateDependencyAnalyses.ts +33 -7
- 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 +148 -41
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +506 -59
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +157 -74
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +156 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +35 -129
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -3
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +420 -87
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- 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/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 +3 -3
- 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/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +16 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- 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/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -18
- 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 +17 -1
- 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.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/loadAnalyses.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +13 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.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/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 +3 -4
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js +0 -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 +71 -27
- 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 +9 -54
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +1 -21
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +148 -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/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.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 +3 -6
- package/analyzer-template/packages/types/src/types/Analysis.ts +87 -27
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +9 -77
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +175 -0
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/index.d.ts +3 -4
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js +0 -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 +71 -27
- 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 +9 -54
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +1 -21
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +148 -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/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +37 -18
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- 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 +1112 -169
- 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 +7 -1
- package/analyzer-template/project/orchestrateCapture.ts +36 -3
- package/analyzer-template/project/reconcileMockDataKeys.ts +220 -78
- package/analyzer-template/project/runAnalysis.ts +11 -0
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +16 -4
- package/analyzer-template/project/startScenarioCapture.ts +6 -0
- package/analyzer-template/project/writeMockDataTsx.ts +164 -24
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +304 -112
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +11 -35
- 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 +987 -130
- 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 +3 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +27 -4
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +188 -47
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +9 -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 +15 -4
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +7 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +139 -23
- 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 +228 -95
- 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 +11 -34
- 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 +29 -18
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +46 -1
- 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 +31 -27
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +28 -14
- 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 +4 -3
- 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 +31 -17
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +105 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +6 -0
- 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 +7 -5
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- 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 +73 -20
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +40 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CzGX-miz.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Ba2JVPzP.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C8lyxW9k.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-aht4aafF.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CBQPrpT0.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-B0GLXMsr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-xgeCVgSM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-D4TZhLuw.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-BfmDgXxG.js → SafeScreenshot-DuDvi0jm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DEx02QDa.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-6J7zDUD5.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DoLIqZX2.js +37 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-Cx24_aWc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-BOARzkeR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CgUsG7ib.js → createLucideIcon-BdhJEx6B.js} +1 -1
- 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-BRb-0kQl.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-zUEpfPsu.js → entity._sha._-C2N4Op8e.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D1T4TGjf.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-CS2cb_eZ.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DAtOlaWE.js → fileTableUtils-DMJ7zii9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-D62Lxxmv.js → git-B4RJRvYB.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/git-commit-horizontal-CysbcZxi.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DMUaGAqV.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-B1h680n5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-lzqtyFU8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-B7B9V-bu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-Bz5TunQg.js +57 -0
- package/codeyam-cli/src/webserver/build/client/assets/rules-hEkvVw2-.js +97 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-CxXUmBSd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DwFIBT09.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-B6LgvRJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C1v1PQzo.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BqPPNjAl.js → useLastLogLine-aSv48UbS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DYxHZQuP.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-DWHcCcl1.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-uNNbimct.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-B08qC4Y7.js +257 -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/server.js +35 -25
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-power-rules-hook.sh +200 -0
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +48 -4
- package/codeyam-cli/templates/{debug-codeyam.md → codeyam:diagnose.md} +185 -23
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/codeyam-cli/templates/codeyam:power-rules.md +449 -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 +6 -5
- package/packages/ai/index.js +5 -4
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +97 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
- package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +84 -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 +97 -6
- 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 +7 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +654 -13
- 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 +178 -31
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +715 -64
- 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 +230 -23
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +77 -55
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +67 -3
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.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 +6 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +111 -0
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
- package/packages/ai/src/lib/deepEqual.js +32 -0
- package/packages/ai/src/lib/deepEqual.js.map +1 -0
- package/packages/ai/src/lib/e2eDataTracking.js +241 -0
- package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
- package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +78 -120
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +1 -0
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +906 -82
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +170 -162
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +392 -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 +1440 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
- 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/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -100
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
- package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +68 -6
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -70
- 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 +9 -9
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
- package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
- package/packages/ai/src/lib/resolvePathToControllable.js +667 -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 +29 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.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/analysisContext.js +30 -5
- package/packages/analyze/src/lib/analysisContext.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 +151 -52
- 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/analyze/validateDependencyAnalyses.js +31 -7
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.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 +121 -37
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- 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 +410 -55
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.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 +126 -57
- 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 +27 -98
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -3
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +342 -83
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
- package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.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/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +13 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.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/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 +0 -1
- package/packages/types/index.js.map +1 -1
- package/packages/types/src/types/Scenario.js +1 -21
- package/packages/types/src/types/Scenario.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +29 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -3
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -409
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -288
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -495
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -120
- 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/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js +0 -7
- package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-2mG6mjVb.js +0 -32
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-C6vQASxy.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-09d684be.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BxJUvKau.js +0 -56
- package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CV6i1S1A.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BDlyhfrv.js +0 -175
- 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 -298
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -226
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -408
- 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 -77
- 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/codeyam-cli/src/webserver/build/client/assets/{api.link-scenario-value-l0sNRNKZ.js → api.health-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-key-attributes-l0sNRNKZ.js → api.restart-server-l0sNRNKZ.js} +0 -0
- /package/codeyam-cli/src/webserver/build/client/assets/{api.update-valid-values-l0sNRNKZ.js → api.rules-l0sNRNKZ.js} +0 -0
- /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
|
@@ -79,15 +79,27 @@
|
|
|
79
79
|
* - `helpers/README.md` - Overview of the helper module architecture
|
|
80
80
|
*/
|
|
81
81
|
import fillInSchemaGapsAndUnknowns from "./helpers/fillInSchemaGapsAndUnknowns.js";
|
|
82
|
+
/**
|
|
83
|
+
* Patterns that indicate recursive type structures in schema paths.
|
|
84
|
+
* Used by hasExcessivePatternRepetition() to detect exponential path blowup.
|
|
85
|
+
*/
|
|
86
|
+
const RECURSIVE_PATH_PATTERNS = [
|
|
87
|
+
/\.attributes\.properties\[\]/g, // TypeScript AST JSX nodes
|
|
88
|
+
/\.children\[\]/g, // Tree structures
|
|
89
|
+
/\.elements\[\]/g, // Array-like structures
|
|
90
|
+
/\.members\[\]/g, // Class/interface members
|
|
91
|
+
/\.properties\[\]/g, // Object properties
|
|
92
|
+
/\.items\[\]/g, // Generic items arrays
|
|
93
|
+
];
|
|
82
94
|
import ensureSchemaConsistency from "./helpers/ensureSchemaConsistency.js";
|
|
83
95
|
import cleanPath from "./helpers/cleanPath.js";
|
|
84
96
|
import { PathManager } from "./helpers/PathManager.js";
|
|
85
|
-
import { uniqueId,
|
|
97
|
+
import { uniqueId, uniqueScopeAndPaths, uniqueScopeVariables, } from "./helpers/uniqueIdUtils.js";
|
|
86
98
|
import selectBestValue from "./helpers/selectBestValue.js";
|
|
87
99
|
import { VisitedTracker } from "./helpers/VisitedTracker.js";
|
|
88
100
|
import { DebugTracer } from "./helpers/DebugTracer.js";
|
|
89
101
|
import { BatchSchemaProcessor } from "./helpers/BatchSchemaProcessor.js";
|
|
90
|
-
import {
|
|
102
|
+
import { ROOT_SCOPE_NAME, ScopeTreeManager, } from "./helpers/ScopeTreeManager.js";
|
|
91
103
|
import cleanScopeNodeName from "./helpers/cleanScopeNodeName.js";
|
|
92
104
|
import getFunctionCallRoot from "./helpers/getFunctionCallRoot.js";
|
|
93
105
|
import cleanPathOfNonTransformingFunctions from "./helpers/cleanPathOfNonTransformingFunctions.js";
|
|
@@ -176,6 +188,26 @@ export class ScopeDataStructure {
|
|
|
176
188
|
* Maps local variable path to array of usages.
|
|
177
189
|
*/
|
|
178
190
|
this.rawConditionalUsages = {};
|
|
191
|
+
/**
|
|
192
|
+
* Conditional effects collected during AST analysis.
|
|
193
|
+
* Tracks what setter calls happen inside conditionals (if, switch, ternary).
|
|
194
|
+
*/
|
|
195
|
+
this.rawConditionalEffects = [];
|
|
196
|
+
/**
|
|
197
|
+
* Compound conditionals collected during AST analysis.
|
|
198
|
+
* Groups conditions that must all be true together (e.g., a && b && c).
|
|
199
|
+
*/
|
|
200
|
+
this.rawCompoundConditionals = [];
|
|
201
|
+
/**
|
|
202
|
+
* Gating conditions for child component boundaries.
|
|
203
|
+
* Maps child component name to the conditions that must be true for it to render.
|
|
204
|
+
*/
|
|
205
|
+
this.rawChildBoundaryGatingConditions = {};
|
|
206
|
+
/**
|
|
207
|
+
* JSX rendering usages collected during AST analysis.
|
|
208
|
+
* Tracks arrays rendered via .map() and strings interpolated in JSX.
|
|
209
|
+
*/
|
|
210
|
+
this.rawJsxRenderingUsages = [];
|
|
179
211
|
this.lastAddToSchemaId = 0;
|
|
180
212
|
this.lastEquivalencyId = 0;
|
|
181
213
|
this.lastEquivalencyDatabaseId = 0;
|
|
@@ -599,7 +631,6 @@ export class ScopeDataStructure {
|
|
|
599
631
|
}
|
|
600
632
|
addEquivalency(path, equivalentPath, equivalentScopeName, scopeNode, equivalencyReason, equivalencyValueChain, traceId) {
|
|
601
633
|
var _a;
|
|
602
|
-
// DEBUG: Detect infinite loops
|
|
603
634
|
addEquivalencyCallCount++;
|
|
604
635
|
if (addEquivalencyCallCount > 50000) {
|
|
605
636
|
console.error('INFINITE LOOP DETECTED in addEquivalency', {
|
|
@@ -913,6 +944,17 @@ export class ScopeDataStructure {
|
|
|
913
944
|
const remainingKey = remainingSchemaPathParts.join('|');
|
|
914
945
|
const equivalentSchemaPath = equivalentSchemaPathMap.get(remainingKey);
|
|
915
946
|
if (equivalentSchemaPath) {
|
|
947
|
+
// Skip propagation when there's a structural mismatch:
|
|
948
|
+
// - schemaPath ends with [] (array element, represents an object)
|
|
949
|
+
// - equivalentSchemaPath doesn't end with [] (non-array prop, usually a scalar)
|
|
950
|
+
// This prevents incorrectly typing array elements as strings when they're
|
|
951
|
+
// equivalent to scalar props like JSX keys (e.g., workouts[] ↔ Card().key)
|
|
952
|
+
const schemaPathEndsWithArray = schemaPath.endsWith('[]');
|
|
953
|
+
const equivalentEndsWithArray = equivalentSchemaPath.endsWith('[]');
|
|
954
|
+
if (schemaPathEndsWithArray !== equivalentEndsWithArray) {
|
|
955
|
+
// Don't propagate between array element paths and non-array paths
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
916
958
|
const value1 = scopeNode.schema[schemaPath];
|
|
917
959
|
const value2 = equivalentScopeNode.schema[equivalentSchemaPath];
|
|
918
960
|
const bestValue = selectBestValue(value1, value2);
|
|
@@ -983,6 +1025,51 @@ export class ScopeDataStructure {
|
|
|
983
1025
|
isValidPath(path) {
|
|
984
1026
|
return this.pathManager.isValidPath(path);
|
|
985
1027
|
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Detects if a path contains excessive repetition of the same pattern.
|
|
1030
|
+
*
|
|
1031
|
+
* This prevents exponential blowup when analyzing recursive type structures.
|
|
1032
|
+
* For example, TypeScript AST nodes have `.attributes.properties[]` where each
|
|
1033
|
+
* property is also a node with `.attributes.properties[]`. Without this check,
|
|
1034
|
+
* paths like `signature[0].attributes.properties[].attributes.properties[].attributes.properties[]...`
|
|
1035
|
+
* would be generated exponentially.
|
|
1036
|
+
*
|
|
1037
|
+
* Two detection strategies:
|
|
1038
|
+
* 1. Known patterns: Check RECURSIVE_PATH_PATTERNS for common recursive structures
|
|
1039
|
+
* 2. Generic detection: For longer paths, detect any 2-3 part segment that repeats
|
|
1040
|
+
*
|
|
1041
|
+
* @param path - The schema path to check
|
|
1042
|
+
* @param maxRepetitions - Maximum allowed repetitions of any pattern (default: 2)
|
|
1043
|
+
* @returns true if the path has excessive repetition
|
|
1044
|
+
*/
|
|
1045
|
+
hasExcessivePatternRepetition(path, maxRepetitions = 2) {
|
|
1046
|
+
// Check known recursive patterns
|
|
1047
|
+
for (const pattern of RECURSIVE_PATH_PATTERNS) {
|
|
1048
|
+
const matches = path.match(pattern);
|
|
1049
|
+
if (matches && matches.length > maxRepetitions) {
|
|
1050
|
+
return true;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
// For longer paths, detect any repeated multi-part segments we haven't explicitly listed
|
|
1054
|
+
const pathParts = this.splitPath(path);
|
|
1055
|
+
if (pathParts.length <= 6) {
|
|
1056
|
+
return false;
|
|
1057
|
+
}
|
|
1058
|
+
// Check for repeated sequences of 2-3 consecutive parts
|
|
1059
|
+
for (let segmentLength = 2; segmentLength <= 3; segmentLength++) {
|
|
1060
|
+
const seen = new Map();
|
|
1061
|
+
for (let i = 0; i <= pathParts.length - segmentLength; i++) {
|
|
1062
|
+
const segment = pathParts.slice(i, i + segmentLength).join('.');
|
|
1063
|
+
const normalizedSegment = segment.replace(/\[\d+\]/g, '[]');
|
|
1064
|
+
const count = (seen.get(normalizedSegment) || 0) + 1;
|
|
1065
|
+
seen.set(normalizedSegment, count);
|
|
1066
|
+
if (count > maxRepetitions) {
|
|
1067
|
+
return true;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
return false;
|
|
1072
|
+
}
|
|
986
1073
|
addToTree(pathParts) {
|
|
987
1074
|
this.scopeTreeManager.addPath(pathParts);
|
|
988
1075
|
}
|
|
@@ -1023,22 +1110,10 @@ export class ScopeDataStructure {
|
|
|
1023
1110
|
this.checkExternalFunctionCalls();
|
|
1024
1111
|
}
|
|
1025
1112
|
determineEquivalenciesAndBuildSchema(scopeNode) {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
if (Object.keys(isolatedEquivalentVariables || {}).some((k) => k.includes('Fetcher') || k.includes('fetcher'))) {
|
|
1029
|
-
console.log('CodeYam DEBUG determineEquivalenciesAndBuildSchema:', JSON.stringify({
|
|
1030
|
-
scopeNodeName: scopeNode.name,
|
|
1031
|
-
fetcherEquivalencies: Object.entries(isolatedEquivalentVariables || {})
|
|
1032
|
-
.filter(([k, v]) => k.includes('Fetcher') ||
|
|
1033
|
-
k.includes('fetcher') ||
|
|
1034
|
-
String(v).includes('Fetcher') ||
|
|
1035
|
-
String(v).includes('fetcher'))
|
|
1036
|
-
.reduce((acc, [k, v]) => {
|
|
1037
|
-
acc[k] = v;
|
|
1038
|
-
return acc;
|
|
1039
|
-
}, {}),
|
|
1040
|
-
}, null, 2));
|
|
1113
|
+
if (!scopeNode.analysis) {
|
|
1114
|
+
return;
|
|
1041
1115
|
}
|
|
1116
|
+
const { isolatedStructure, isolatedEquivalentVariables } = scopeNode.analysis;
|
|
1042
1117
|
const allPaths = Array.from(new Set([
|
|
1043
1118
|
...Object.keys(isolatedStructure || {}),
|
|
1044
1119
|
...Object.keys(isolatedEquivalentVariables || {}),
|
|
@@ -1047,8 +1122,24 @@ export class ScopeDataStructure {
|
|
|
1047
1122
|
for (let path in isolatedEquivalentVariables) {
|
|
1048
1123
|
let equivalentValue = isolatedEquivalentVariables?.[path];
|
|
1049
1124
|
if (equivalentValue && this.isValidPath(equivalentValue)) {
|
|
1050
|
-
|
|
1051
|
-
|
|
1125
|
+
// IMPORTANT: DO NOT strip ::cyDuplicateKey:: markers from equivalencies.
|
|
1126
|
+
// These markers are critical for distinguishing variable reassignments.
|
|
1127
|
+
// For example, with:
|
|
1128
|
+
// let fetcher = useFetcher<ConfigData>();
|
|
1129
|
+
// const configData = fetcher.data?.data;
|
|
1130
|
+
// fetcher = useFetcher<SettingsData>();
|
|
1131
|
+
// const settingsData = fetcher.data?.data;
|
|
1132
|
+
//
|
|
1133
|
+
// mergeStatements creates:
|
|
1134
|
+
// fetcher → useFetcher<ConfigData>()...
|
|
1135
|
+
// fetcher::cyDuplicateKey1:: → useFetcher<SettingsData>()...
|
|
1136
|
+
// configData → fetcher.data.data
|
|
1137
|
+
// settingsData → fetcher::cyDuplicateKey1::.data.data
|
|
1138
|
+
//
|
|
1139
|
+
// If we strip ::cyDuplicateKey::, settingsData would incorrectly trace
|
|
1140
|
+
// to useFetcher<ConfigData>() instead of useFetcher<SettingsData>().
|
|
1141
|
+
path = cleanPath(path, allPaths);
|
|
1142
|
+
equivalentValue = cleanPath(equivalentValue, allPaths);
|
|
1052
1143
|
this.addEquivalency(path, equivalentValue, scopeNode.name, scopeNode, 'original equivalency');
|
|
1053
1144
|
// Propagate equivalencies involving parent-scope variables to those parent scopes.
|
|
1054
1145
|
// This handles patterns like: collected.push({...entity}) where 'collected' is defined
|
|
@@ -1140,7 +1231,7 @@ export class ScopeDataStructure {
|
|
|
1140
1231
|
// This eliminates deep call stacks and improves deduplication
|
|
1141
1232
|
this.batchProcessor = new BatchSchemaProcessor();
|
|
1142
1233
|
this.batchQueuedSet = new Set();
|
|
1143
|
-
for (const key of
|
|
1234
|
+
for (const key of allPaths) {
|
|
1144
1235
|
let value = isolatedStructure[key] ?? 'unknown';
|
|
1145
1236
|
if (['null', 'undefined'].includes(value)) {
|
|
1146
1237
|
value = 'unknown';
|
|
@@ -1174,7 +1265,14 @@ export class ScopeDataStructure {
|
|
|
1174
1265
|
processBatchQueue() {
|
|
1175
1266
|
if (!this.batchProcessor)
|
|
1176
1267
|
return;
|
|
1268
|
+
let iterations = 0;
|
|
1177
1269
|
while (this.batchProcessor.hasWork()) {
|
|
1270
|
+
iterations++;
|
|
1271
|
+
// Safety: detect potential infinite loops
|
|
1272
|
+
if (iterations > 100000) {
|
|
1273
|
+
console.error(`[ScopeDataStructure] processBatchQueue exceeded 100k iterations, possible infinite loop!`);
|
|
1274
|
+
break;
|
|
1275
|
+
}
|
|
1178
1276
|
const item = this.batchProcessor.getNextWork();
|
|
1179
1277
|
if (!item)
|
|
1180
1278
|
break;
|
|
@@ -1221,18 +1319,6 @@ export class ScopeDataStructure {
|
|
|
1221
1319
|
// Find the FunctionCallInfo that matches this call signature
|
|
1222
1320
|
const searchKey = getFunctionCallRoot(callSignature);
|
|
1223
1321
|
const functionCallInfo = this.getExternalFunctionCallsIndex().get(searchKey);
|
|
1224
|
-
// DEBUG: Track useFetcher calls
|
|
1225
|
-
if (searchKey === 'useFetcher' || callSignature.includes('useFetcher')) {
|
|
1226
|
-
console.log('CodeYam DEBUG trackReceivingVariable:', JSON.stringify({
|
|
1227
|
-
receivingVariable,
|
|
1228
|
-
equivalentValue,
|
|
1229
|
-
callSignature,
|
|
1230
|
-
searchKey,
|
|
1231
|
-
foundFunctionCallInfo: !!functionCallInfo,
|
|
1232
|
-
existingRecvVars: functionCallInfo?.receivingVariableNames,
|
|
1233
|
-
existingCallSigToVar: functionCallInfo?.callSignatureToVariable,
|
|
1234
|
-
}, null, 2));
|
|
1235
|
-
}
|
|
1236
1322
|
if (!functionCallInfo) {
|
|
1237
1323
|
return;
|
|
1238
1324
|
}
|
|
@@ -1587,6 +1673,17 @@ export class ScopeDataStructure {
|
|
|
1587
1673
|
continue;
|
|
1588
1674
|
}
|
|
1589
1675
|
const newEquivalentPath = this.joinPathParts([schemaPath, remainingPath]);
|
|
1676
|
+
// PERF: Detect repeated patterns in paths to prevent exponential blowup
|
|
1677
|
+
// Paths like `signature[0].attributes.properties[].attributes.properties[]...`
|
|
1678
|
+
// indicate recursive type structures that cause exponential schema explosion
|
|
1679
|
+
if (this.hasExcessivePatternRepetition(newEquivalentPath)) {
|
|
1680
|
+
if (traceId && debugLevel > 0) {
|
|
1681
|
+
console.info('Debug: skipping path with excessive pattern repetition', {
|
|
1682
|
+
path: newEquivalentPath,
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
continue;
|
|
1686
|
+
}
|
|
1590
1687
|
if (!equivalentScopeNode) {
|
|
1591
1688
|
if (traceId) {
|
|
1592
1689
|
console.info('Debug Propagation: missing equivalent scope info', {
|
|
@@ -2233,9 +2330,22 @@ export class ScopeDataStructure {
|
|
|
2233
2330
|
}
|
|
2234
2331
|
}
|
|
2235
2332
|
}
|
|
2236
|
-
return mergedSchema;
|
|
2333
|
+
return this.filterDuplicateKeys(mergedSchema);
|
|
2237
2334
|
}
|
|
2238
|
-
return schema;
|
|
2335
|
+
return this.filterDuplicateKeys(schema);
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Filter out ::cyDuplicateKey:: entries from a schema.
|
|
2339
|
+
* These are internal markers for tracking variable reassignments
|
|
2340
|
+
* and should not appear in output schemas or LLM prompts.
|
|
2341
|
+
*/
|
|
2342
|
+
filterDuplicateKeys(schema) {
|
|
2343
|
+
return Object.entries(schema).reduce((acc, [key, value]) => {
|
|
2344
|
+
if (!key.includes('::cyDuplicateKey')) {
|
|
2345
|
+
acc[key] = value;
|
|
2346
|
+
}
|
|
2347
|
+
return acc;
|
|
2348
|
+
}, {});
|
|
2239
2349
|
}
|
|
2240
2350
|
getEquivalencies(scopeName) {
|
|
2241
2351
|
const scopeNode = this.getScopeOrFunctionCallInfo(scopeName);
|
|
@@ -2301,26 +2411,63 @@ export class ScopeDataStructure {
|
|
|
2301
2411
|
return acc;
|
|
2302
2412
|
}, {});
|
|
2303
2413
|
const equivalencies = this.getEquivalencies(functionName);
|
|
2414
|
+
const scopeName = functionName ?? this.scopeTreeManager.getRootName();
|
|
2304
2415
|
for (const equivalenceKey in equivalencies ?? {}) {
|
|
2305
2416
|
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
2306
2417
|
const schemaPath = equivalenceValue.schemaPath;
|
|
2307
2418
|
if (schemaPath.startsWith('signature[') &&
|
|
2308
|
-
equivalenceValue.scopeNodeName ===
|
|
2419
|
+
equivalenceValue.scopeNodeName === scopeName &&
|
|
2309
2420
|
!signatureInSchema[schemaPath]) {
|
|
2310
2421
|
signatureInSchema[schemaPath] = 'unknown';
|
|
2311
2422
|
}
|
|
2312
2423
|
}
|
|
2313
2424
|
}
|
|
2314
2425
|
const tempScopeNode = this.createTempScopeNode(functionName ?? this.scopeTreeManager.getRootName(), signatureInSchema, equivalencies);
|
|
2315
|
-
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
2316
|
-
// during this "getter" method. validateSchema triggers manager.finalize which
|
|
2317
|
-
// can call addToSchema -> addToEquivalencyDatabase -> mergeEquivalencyDatabaseEntries,
|
|
2318
|
-
// which would incorrectly remove entries from the database.
|
|
2319
|
-
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
2320
|
-
this.onlyEquivalencies = true;
|
|
2321
2426
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
2322
|
-
|
|
2323
|
-
|
|
2427
|
+
// After validateSchema has filled in types, propagate nested paths from
|
|
2428
|
+
// variables to their signature equivalents.
|
|
2429
|
+
// e.g., workouts[].activity_type -> signature[0].workouts[].activity_type
|
|
2430
|
+
//
|
|
2431
|
+
// Build a map of variable names that are equivalent to signature paths
|
|
2432
|
+
// e.g., { 'workouts': 'signature[0].workouts' }
|
|
2433
|
+
const variableToSignatureMap = {};
|
|
2434
|
+
for (const equivalenceKey in equivalencies ?? {}) {
|
|
2435
|
+
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
2436
|
+
const schemaPath = equivalenceValue.schemaPath;
|
|
2437
|
+
// Track which variables map to signature paths
|
|
2438
|
+
// equivalenceKey is the variable name (e.g., 'workouts')
|
|
2439
|
+
// schemaPath is where it comes from (e.g., 'signature[0].workouts')
|
|
2440
|
+
if (schemaPath.startsWith('signature[') &&
|
|
2441
|
+
equivalenceValue.scopeNodeName === scopeName) {
|
|
2442
|
+
variableToSignatureMap[equivalenceKey] = schemaPath;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
// Propagate nested paths from variables to their signature equivalents
|
|
2447
|
+
// e.g., if workouts = signature[0].workouts, then workouts[].title becomes
|
|
2448
|
+
// signature[0].workouts[].title
|
|
2449
|
+
for (const schemaKey in schema) {
|
|
2450
|
+
// Skip keys that already start with signature[
|
|
2451
|
+
if (schemaKey.startsWith('signature['))
|
|
2452
|
+
continue;
|
|
2453
|
+
// Check if this key starts with a variable that maps to a signature path
|
|
2454
|
+
for (const [variableName, signaturePath] of Object.entries(variableToSignatureMap)) {
|
|
2455
|
+
// Check if schemaKey starts with variableName followed by a property accessor
|
|
2456
|
+
// e.g., 'workouts[]' starts with 'workouts'
|
|
2457
|
+
if (schemaKey === variableName ||
|
|
2458
|
+
schemaKey.startsWith(variableName + '.') ||
|
|
2459
|
+
schemaKey.startsWith(variableName + '[')) {
|
|
2460
|
+
// Transform the path: replace the variable prefix with the signature path
|
|
2461
|
+
const suffix = schemaKey.slice(variableName.length);
|
|
2462
|
+
const signatureKey = signaturePath + suffix;
|
|
2463
|
+
// Add to schema if not already present
|
|
2464
|
+
if (!tempScopeNode.schema[signatureKey]) {
|
|
2465
|
+
tempScopeNode.schema[signatureKey] = schema[schemaKey];
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
return this.filterDuplicateKeys(tempScopeNode.schema);
|
|
2324
2471
|
}
|
|
2325
2472
|
getReturnValue({ functionName, fillInUnknowns, }) {
|
|
2326
2473
|
// Trigger finalization on all managers to apply any pending updates
|
|
@@ -2363,14 +2510,27 @@ export class ScopeDataStructure {
|
|
|
2363
2510
|
// Include function paths even if their return value wasn't captured
|
|
2364
2511
|
// This ensures methods like onAuthStateChange are included in the schema
|
|
2365
2512
|
// But exclude signature entries (they should only be included via functionCallReturnValue paths)
|
|
2366
|
-
|
|
2513
|
+
// Also exclude bare function call signatures - paths that are JUST a call like
|
|
2514
|
+
// "useCustomSizes(projectSlug)" should not be included as return values.
|
|
2515
|
+
// These represent "the function exists" not actual return data, and including
|
|
2516
|
+
// them causes nested path bugs in dependencySchemas.
|
|
2517
|
+
(schema[key] === 'function' &&
|
|
2518
|
+
key.indexOf('signature[') === -1 &&
|
|
2519
|
+
// Exclude bare call signatures: function calls with no dots OUTSIDE parentheses
|
|
2520
|
+
// e.g., "useCustomSizes(projectSlug)" is bare (exclude)
|
|
2521
|
+
// e.g., "loadProject({nested.property})" is bare - dots are inside args (exclude)
|
|
2522
|
+
// e.g., "getSupabase().auth.method()" has dots outside - method chain (include)
|
|
2523
|
+
!this.isBareCallSignature(key)))
|
|
2367
2524
|
.reduce((acc, key) => {
|
|
2368
2525
|
acc[key] = schema[key];
|
|
2369
2526
|
const keyParts = this.splitPath(key);
|
|
2370
2527
|
for (const path in schema) {
|
|
2371
2528
|
const pathParts = this.splitPath(path);
|
|
2372
2529
|
if (pathParts.every((p, i) => keyParts[i] === p)) {
|
|
2373
|
-
|
|
2530
|
+
// Also exclude bare call signatures from prefix paths
|
|
2531
|
+
if (!this.isBareCallSignature(path)) {
|
|
2532
|
+
acc[path] = schema[path];
|
|
2533
|
+
}
|
|
2374
2534
|
}
|
|
2375
2535
|
}
|
|
2376
2536
|
return acc;
|
|
@@ -2384,7 +2544,56 @@ export class ScopeDataStructure {
|
|
|
2384
2544
|
this.onlyEquivalencies = true;
|
|
2385
2545
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
2386
2546
|
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
2387
|
-
return
|
|
2547
|
+
// Remove bare call signatures from the return value schema.
|
|
2548
|
+
// fillInSchemaGapsAndUnknowns may add parent paths like "useCustomSizes(projectSlug)"
|
|
2549
|
+
// when it sees "useCustomSizes(projectSlug).functionCallReturnValue". These bare
|
|
2550
|
+
// call signatures represent "the function exists" not actual return data, and
|
|
2551
|
+
// including them causes nested path bugs in dependencySchemas.
|
|
2552
|
+
const resultSchema = tempScopeNode.schema;
|
|
2553
|
+
for (const key of Object.keys(resultSchema)) {
|
|
2554
|
+
if (this.isBareCallSignature(key)) {
|
|
2555
|
+
delete resultSchema[key];
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
return resultSchema;
|
|
2559
|
+
}
|
|
2560
|
+
/**
|
|
2561
|
+
* Checks if a schema key is a "bare call signature" - a function call with no
|
|
2562
|
+
* method chain before it and no path segments after it.
|
|
2563
|
+
*
|
|
2564
|
+
* A bare call signature represents "this function exists" rather than actual
|
|
2565
|
+
* return data, and including them causes nested path bugs in dependencySchemas.
|
|
2566
|
+
*
|
|
2567
|
+
* Examples:
|
|
2568
|
+
* - "useCustomSizes(projectSlug)" -> bare (true)
|
|
2569
|
+
* - "loadProject({nested.property})" -> bare (dots are inside args, true)
|
|
2570
|
+
* - "getSupabase().auth.method()" -> not bare (has dots outside parens, false)
|
|
2571
|
+
* - "useProject().functionCallReturnValue" -> not bare (has path after, false)
|
|
2572
|
+
*/
|
|
2573
|
+
isBareCallSignature(key) {
|
|
2574
|
+
// Must end with ) and contain ( to be a call
|
|
2575
|
+
if (!key.endsWith(')') || key.indexOf('(') === -1) {
|
|
2576
|
+
return false;
|
|
2577
|
+
}
|
|
2578
|
+
// Check if there are any dots OUTSIDE of parentheses
|
|
2579
|
+
// Strip out content inside balanced parentheses, then check for dots
|
|
2580
|
+
let depth = 0;
|
|
2581
|
+
let hasDotsOutsideParens = false;
|
|
2582
|
+
for (let i = 0; i < key.length; i++) {
|
|
2583
|
+
const char = key[i];
|
|
2584
|
+
if (char === '(') {
|
|
2585
|
+
depth++;
|
|
2586
|
+
}
|
|
2587
|
+
else if (char === ')') {
|
|
2588
|
+
depth--;
|
|
2589
|
+
}
|
|
2590
|
+
else if (char === '.' && depth === 0) {
|
|
2591
|
+
hasDotsOutsideParens = true;
|
|
2592
|
+
break;
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
// It's a bare call signature if there are no dots outside parentheses
|
|
2596
|
+
return !hasDotsOutsideParens;
|
|
2388
2597
|
}
|
|
2389
2598
|
/**
|
|
2390
2599
|
* Replaces cyScope placeholder references (e.g., cyScope10()) in schema keys
|
|
@@ -2457,11 +2666,271 @@ export class ScopeDataStructure {
|
|
|
2457
2666
|
const equivalentSignatureVariables = {};
|
|
2458
2667
|
for (const [path, equivalentValues] of Object.entries(scopeNode.equivalencies)) {
|
|
2459
2668
|
for (const equivalentValue of equivalentValues) {
|
|
2669
|
+
// Case 1: Props/signature equivalencies (existing behavior)
|
|
2670
|
+
// Maps local variable names to their signature paths
|
|
2671
|
+
// e.g., "propValue" -> "signature[0].prop"
|
|
2460
2672
|
if (path.startsWith('signature[')) {
|
|
2461
2673
|
equivalentSignatureVariables[equivalentValue.schemaPath] = path;
|
|
2462
2674
|
}
|
|
2675
|
+
// Case 2: Hook variable equivalencies (new behavior)
|
|
2676
|
+
// The equivalencies are stored as: path = variable name, schemaPath = data source
|
|
2677
|
+
// e.g., path = "debugFetcher", schemaPath = "useFetcher<...>().functionCallReturnValue"
|
|
2678
|
+
// We need to map: "debugFetcher" -> "useFetcher<...>()"
|
|
2679
|
+
// This enables resolving paths like "debugFetcher.state" to
|
|
2680
|
+
// "useFetcher<...>().state" for execution flow validation
|
|
2681
|
+
if (equivalentValue.schemaPath.endsWith('.functionCallReturnValue')) {
|
|
2682
|
+
// Extract the hook call path (everything before .functionCallReturnValue)
|
|
2683
|
+
let hookCallPath = equivalentValue.schemaPath.slice(0, -'.functionCallReturnValue'.length);
|
|
2684
|
+
// Only include if it looks like a hook call (contains parentheses)
|
|
2685
|
+
// and the variable name (path) is a simple identifier (no dots)
|
|
2686
|
+
if (hookCallPath.includes('(') && !path.includes('.')) {
|
|
2687
|
+
// Special case: If hookCallPath is a callback scope (cyScope pattern),
|
|
2688
|
+
// trace through it to find what the callback actually returns.
|
|
2689
|
+
// This handles useState(() => { return prop; }) patterns.
|
|
2690
|
+
const cyScopeMatch = hookCallPath.match(/^(cyScope\d+)\(\)$/);
|
|
2691
|
+
if (cyScopeMatch) {
|
|
2692
|
+
// Use the equivalency database to trace the callback's return value
|
|
2693
|
+
// to its actual source (e.g., viewModeFromUrl -> segments -> params -> useParams)
|
|
2694
|
+
const dbEntry = this.getEquivalenciesDatabaseEntry(scopeNode.name, // Component scope
|
|
2695
|
+
path);
|
|
2696
|
+
if (dbEntry?.sourceCandidates?.length > 0) {
|
|
2697
|
+
// Use the traced source instead of the callback scope
|
|
2698
|
+
hookCallPath = dbEntry.sourceCandidates[0].schemaPath;
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
equivalentSignatureVariables[path] = hookCallPath;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
// Case 3: Destructured variables from local variables
|
|
2705
|
+
// e.g., const { scenarios } = currentEntityAnalysis;
|
|
2706
|
+
// This creates: path = "scenarios", schemaPath = "currentEntityAnalysis.scenarios"
|
|
2707
|
+
// We need to map: "scenarios" -> "currentEntityAnalysis.scenarios"
|
|
2708
|
+
// AND resolve transitively if currentEntityAnalysis is itself equivalent to a hook call
|
|
2709
|
+
if (!path.includes('.') && // path is a simple identifier
|
|
2710
|
+
!equivalentValue.schemaPath.startsWith('signature[') && // not a signature path
|
|
2711
|
+
!equivalentValue.schemaPath.endsWith('.functionCallReturnValue') // not already handled above
|
|
2712
|
+
) {
|
|
2713
|
+
// Only add if we haven't already captured this variable in Case 1 or 2
|
|
2714
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
2715
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
// Case 4: Child component prop mappings (Fix 22)
|
|
2719
|
+
// When parent renders <ChildComponent prop={value} />, we get equivalencies like:
|
|
2720
|
+
// path = "ChildComponent().signature[0].prop"
|
|
2721
|
+
// schemaPath = "value" (the variable passed as the prop)
|
|
2722
|
+
// We need to include these so translateChildPathToParent can work.
|
|
2723
|
+
// Pattern: ComponentName().signature[N] or ComponentName().signature[N].propName
|
|
2724
|
+
if (path.includes('().signature[') &&
|
|
2725
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable, not a function call
|
|
2726
|
+
) {
|
|
2727
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
2728
|
+
}
|
|
2729
|
+
// Case 5: Destructured function parameters (Fix 25)
|
|
2730
|
+
// When a function has destructured props: function Comp({ propA, propB }: Props)
|
|
2731
|
+
// We get equivalencies like:
|
|
2732
|
+
// path = "propA" (the destructured variable name)
|
|
2733
|
+
// schemaPath = "signature[0].propA" (the signature path)
|
|
2734
|
+
// We need to map: "propA" -> "signature[0].propA"
|
|
2735
|
+
// This enables translateChildPathToParent to resolve child variable paths
|
|
2736
|
+
// to their signature paths when merging execution flows.
|
|
2737
|
+
if (!path.includes('.') && // path is a simple identifier (destructured prop name)
|
|
2738
|
+
equivalentValue.schemaPath.startsWith('signature[') // schemaPath IS a signature path
|
|
2739
|
+
) {
|
|
2740
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
2741
|
+
}
|
|
2742
|
+
// Case 7: Method calls on variables that result in .functionCallReturnValue (Fix 33)
|
|
2743
|
+
// When we have patterns like:
|
|
2744
|
+
// path = "segments" (simple identifier)
|
|
2745
|
+
// schemaPath = "splat.split('/').functionCallReturnValue"
|
|
2746
|
+
// This is a method call on a variable (not a hook call), but we still need to
|
|
2747
|
+
// track it so transitive resolution can resolve `splat` to its actual source.
|
|
2748
|
+
// E.g., if splat -> useParams().functionCallReturnValue['*'], then
|
|
2749
|
+
// segments -> useParams().functionCallReturnValue['*'].split('/').functionCallReturnValue
|
|
2750
|
+
if (!path.includes('.') && // path is a simple identifier
|
|
2751
|
+
equivalentValue.schemaPath.endsWith('.functionCallReturnValue') && // ends with function return
|
|
2752
|
+
equivalentValue.schemaPath.includes('.') && // has property access (method call)
|
|
2753
|
+
!(path in equivalentSignatureVariables) // not already captured
|
|
2754
|
+
) {
|
|
2755
|
+
// Check if this looks like a method call on a variable (not a hook call)
|
|
2756
|
+
// Hook calls look like: hookName() or hookName<T>()
|
|
2757
|
+
// Method calls look like: variable.method() or variable.method<T>()
|
|
2758
|
+
const hookCallPath = equivalentValue.schemaPath.slice(0, -'.functionCallReturnValue'.length);
|
|
2759
|
+
// If it's a method call (contains a dot before the parenthesis), include it
|
|
2760
|
+
const dotBeforeParen = hookCallPath.indexOf('.');
|
|
2761
|
+
const parenPos = hookCallPath.indexOf('(');
|
|
2762
|
+
if (dotBeforeParen !== -1 && dotBeforeParen < parenPos) {
|
|
2763
|
+
// This is a method call like "splat.split('/')", not a hook call
|
|
2764
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2463
2767
|
}
|
|
2464
2768
|
}
|
|
2769
|
+
// Case 6: Collect JSX child prop equivalencies from child scopes (Fix 26)
|
|
2770
|
+
// When a parent component renders <ChildComponent prop={value} />, the JSX
|
|
2771
|
+
// return statement may be in a child scope (e.g., cyScope2). The equivalencies
|
|
2772
|
+
// like ChildComponent().signature[0].prop -> value get stored in that child scope.
|
|
2773
|
+
// But translateChildPathToParent needs to find them from the parent scope's context.
|
|
2774
|
+
// So we collect Case 4 patterns from ALL child scopes that belong to this root scope.
|
|
2775
|
+
const rootName = this.scopeTreeManager.getRootName();
|
|
2776
|
+
for (const [scopeName, childScopeNode] of Object.entries(this.scopeNodes)) {
|
|
2777
|
+
// Skip the root scope (already processed above)
|
|
2778
|
+
if (scopeName === rootName)
|
|
2779
|
+
continue;
|
|
2780
|
+
// Only include scopes that are children of the root (their tree includes root)
|
|
2781
|
+
if (!childScopeNode.tree?.includes(rootName))
|
|
2782
|
+
continue;
|
|
2783
|
+
// Look for Case 4 patterns in the child scope
|
|
2784
|
+
for (const [path, equivalentValues] of Object.entries(childScopeNode.equivalencies || {})) {
|
|
2785
|
+
for (const equivalentValue of equivalentValues) {
|
|
2786
|
+
// Case 4 pattern: ChildComponent().signature[0].propName -> parentVariable
|
|
2787
|
+
if (path.includes('().signature[') &&
|
|
2788
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable
|
|
2789
|
+
) {
|
|
2790
|
+
// Only add if not already present from the root scope
|
|
2791
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
2792
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
// Transitive resolution: Resolve variable chains through multiple levels
|
|
2799
|
+
// E.g., analysis → currentEntityAnalysis → useLoaderData().functionCallReturnValue.currentEntityAnalysis
|
|
2800
|
+
// We need multiple passes because resolutions can depend on each other
|
|
2801
|
+
const maxIterations = 5; // Prevent infinite loops
|
|
2802
|
+
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
2803
|
+
let changed = false;
|
|
2804
|
+
for (const [varName, sourcePath] of Object.entries(equivalentSignatureVariables)) {
|
|
2805
|
+
// Skip if already fully resolved (contains function call syntax)
|
|
2806
|
+
// BUT first check for computed value patterns that need resolution (Fix 28)
|
|
2807
|
+
// AND method call patterns that need base variable resolution (Fix 33)
|
|
2808
|
+
if (sourcePath.includes('()')) {
|
|
2809
|
+
// Fix 28: Handle computed value patterns with dependency arrays
|
|
2810
|
+
// Patterns like `functionName(arg, [dep1, dep2, ...])` are NOT controllable
|
|
2811
|
+
// data sources. We trace through the dependencies to find controllable sources.
|
|
2812
|
+
const bracketStart = sourcePath.indexOf('[');
|
|
2813
|
+
const bracketEnd = sourcePath.lastIndexOf(']');
|
|
2814
|
+
if (bracketStart !== -1 && bracketEnd > bracketStart) {
|
|
2815
|
+
const arrayContent = sourcePath.slice(bracketStart + 1, bracketEnd);
|
|
2816
|
+
const items = arrayContent.split(',').map((s) => s.trim());
|
|
2817
|
+
// Only process if this looks like a dependency array:
|
|
2818
|
+
// multiple items that are all simple identifiers (not numbers or expressions)
|
|
2819
|
+
const isIdentifier = (s) => /^\w+$/.test(s) && !/^\d+$/.test(s);
|
|
2820
|
+
if (items.length > 1 && items.every(isIdentifier)) {
|
|
2821
|
+
// Look for a dependency that's already resolved to a controllable source
|
|
2822
|
+
for (const dep of items) {
|
|
2823
|
+
if (dep in equivalentSignatureVariables) {
|
|
2824
|
+
const resolvedDep = equivalentSignatureVariables[dep];
|
|
2825
|
+
// Use if it's a controllable path (contains hook call)
|
|
2826
|
+
// and is NOT another unresolved computed pattern (has comma-separated deps)
|
|
2827
|
+
const hasCommaInBrackets = resolvedDep.includes('[') &&
|
|
2828
|
+
resolvedDep.includes(',') &&
|
|
2829
|
+
resolvedDep.indexOf(',') > resolvedDep.indexOf('[');
|
|
2830
|
+
if (resolvedDep.includes('()') && !hasCommaInBrackets) {
|
|
2831
|
+
// Computed value is typically an element from an array
|
|
2832
|
+
equivalentSignatureVariables[varName] = resolvedDep + '[]';
|
|
2833
|
+
changed = true;
|
|
2834
|
+
break;
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
// Fix 33: Handle method call patterns on variables
|
|
2841
|
+
// Patterns like: "splat.split('/').functionCallReturnValue"
|
|
2842
|
+
// We need to resolve the base variable (splat) to its actual source
|
|
2843
|
+
// Check if this is a method call on a variable (dot before first parenthesis)
|
|
2844
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
2845
|
+
const parenIndex = sourcePath.indexOf('(');
|
|
2846
|
+
if (dotIndex !== -1 &&
|
|
2847
|
+
dotIndex < parenIndex &&
|
|
2848
|
+
!sourcePath.startsWith('use') // Not a hook call like useState()
|
|
2849
|
+
) {
|
|
2850
|
+
// Extract the base variable (before the first dot)
|
|
2851
|
+
const baseVar = sourcePath.slice(0, dotIndex);
|
|
2852
|
+
const rest = sourcePath.slice(dotIndex); // includes ".method(...).functionCallReturnValue"
|
|
2853
|
+
// Check if the base variable can be resolved
|
|
2854
|
+
if (baseVar in equivalentSignatureVariables &&
|
|
2855
|
+
baseVar !== varName) {
|
|
2856
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
2857
|
+
// Only resolve if the base resolved to something useful (contains () or .)
|
|
2858
|
+
if (baseResolved.includes('()') || baseResolved.includes('.')) {
|
|
2859
|
+
const newPath = baseResolved + rest;
|
|
2860
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
2861
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
2862
|
+
changed = true;
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
// Fix 38: Handle cyScope lazy initializer return values
|
|
2868
|
+
// When we have viewMode -> cyScope20(), trace through to find what cyScope20 returns.
|
|
2869
|
+
// The lazy initializer's return value should be the controllable data source.
|
|
2870
|
+
// Pattern: cyScopeN() where N is a number
|
|
2871
|
+
const cyScopeMatch = sourcePath.match(/^(cyScope\d+)\(\)$/);
|
|
2872
|
+
if (cyScopeMatch) {
|
|
2873
|
+
const cyScopeName = cyScopeMatch[1];
|
|
2874
|
+
const cyScopeNode = this.scopeNodes[cyScopeName];
|
|
2875
|
+
if (cyScopeNode?.equivalencies) {
|
|
2876
|
+
// Look for returnValue equivalency in the cyScope
|
|
2877
|
+
const returnValueEquivs = cyScopeNode.equivalencies['returnValue'];
|
|
2878
|
+
if (returnValueEquivs && returnValueEquivs.length > 0) {
|
|
2879
|
+
// Get the first return value source
|
|
2880
|
+
const returnSource = returnValueEquivs[0].schemaPath;
|
|
2881
|
+
// If the return source is a simple variable (not a complex path),
|
|
2882
|
+
// resolve varName directly to that variable
|
|
2883
|
+
if (returnSource &&
|
|
2884
|
+
!returnSource.includes('(') &&
|
|
2885
|
+
!returnSource.includes('[')) {
|
|
2886
|
+
// Update varName to point to the return source
|
|
2887
|
+
if (equivalentSignatureVariables[varName] !== returnSource) {
|
|
2888
|
+
equivalentSignatureVariables[varName] = returnSource;
|
|
2889
|
+
changed = true;
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
continue;
|
|
2896
|
+
}
|
|
2897
|
+
// Check if the source path starts with a variable that's also in the map
|
|
2898
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
2899
|
+
let baseVar;
|
|
2900
|
+
let rest;
|
|
2901
|
+
if (dotIndex > 0) {
|
|
2902
|
+
// Path has a dot: "a.b.c" -> baseVar="a", rest=".b.c"
|
|
2903
|
+
baseVar = sourcePath.slice(0, dotIndex);
|
|
2904
|
+
rest = sourcePath.slice(dotIndex); // includes the leading dot
|
|
2905
|
+
}
|
|
2906
|
+
else {
|
|
2907
|
+
// Path is a simple identifier: "currentEntityAnalysis" -> baseVar="currentEntityAnalysis", rest=""
|
|
2908
|
+
baseVar = sourcePath;
|
|
2909
|
+
rest = '';
|
|
2910
|
+
}
|
|
2911
|
+
if (baseVar in equivalentSignatureVariables && baseVar !== varName) {
|
|
2912
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
2913
|
+
// If the base resolves to a hook call, add .functionCallReturnValue
|
|
2914
|
+
if (baseResolved.endsWith('()')) {
|
|
2915
|
+
const newPath = baseResolved + '.functionCallReturnValue' + rest;
|
|
2916
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
2917
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
2918
|
+
changed = true;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
else if (baseResolved !== sourcePath) {
|
|
2922
|
+
const newPath = baseResolved + rest;
|
|
2923
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
2924
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
2925
|
+
changed = true;
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
// Stop if no changes were made in this iteration
|
|
2931
|
+
if (!changed)
|
|
2932
|
+
break;
|
|
2933
|
+
}
|
|
2465
2934
|
return equivalentSignatureVariables;
|
|
2466
2935
|
}
|
|
2467
2936
|
getVariableInfo(variableName, scopeName, final) {
|
|
@@ -2621,9 +3090,112 @@ export class ScopeDataStructure {
|
|
|
2621
3090
|
}
|
|
2622
3091
|
}
|
|
2623
3092
|
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Add conditional effects from AST analysis.
|
|
3095
|
+
* Called during scope analysis to collect all setter calls inside conditionals.
|
|
3096
|
+
*/
|
|
3097
|
+
addConditionalEffects(effects) {
|
|
3098
|
+
// Add effects, avoiding duplicates based on effect stateVariable and condition paths
|
|
3099
|
+
for (const effect of effects) {
|
|
3100
|
+
const exists = this.rawConditionalEffects.some((existing) => {
|
|
3101
|
+
// Same effect target (stateVariable + value)
|
|
3102
|
+
const sameEffect = existing.effect.stateVariable === effect.effect.stateVariable &&
|
|
3103
|
+
existing.effect.value === effect.effect.value;
|
|
3104
|
+
if (!sameEffect)
|
|
3105
|
+
return false;
|
|
3106
|
+
// Same condition(s)
|
|
3107
|
+
if (existing.condition && effect.condition) {
|
|
3108
|
+
return (existing.condition.path === effect.condition.path &&
|
|
3109
|
+
existing.condition.requiredValue === effect.condition.requiredValue);
|
|
3110
|
+
}
|
|
3111
|
+
if (existing.conditions && effect.conditions) {
|
|
3112
|
+
if (existing.conditions.length !== effect.conditions.length)
|
|
3113
|
+
return false;
|
|
3114
|
+
return existing.conditions.every((ec, i) => {
|
|
3115
|
+
const newCond = effect.conditions[i];
|
|
3116
|
+
return (ec.path === newCond.path &&
|
|
3117
|
+
ec.requiredValue === newCond.requiredValue);
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
return false;
|
|
3121
|
+
});
|
|
3122
|
+
if (!exists) {
|
|
3123
|
+
this.rawConditionalEffects.push(effect);
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* Get conditional effects collected during analysis.
|
|
3129
|
+
*/
|
|
3130
|
+
getConditionalEffects() {
|
|
3131
|
+
return this.rawConditionalEffects;
|
|
3132
|
+
}
|
|
3133
|
+
/**
|
|
3134
|
+
* Add compound conditionals from AST analysis.
|
|
3135
|
+
* Called during scope analysis to collect grouped conditions (e.g., a && b && c).
|
|
3136
|
+
*/
|
|
3137
|
+
addCompoundConditionals(compounds) {
|
|
3138
|
+
// Add compounds, avoiding duplicates based on chainId
|
|
3139
|
+
for (const compound of compounds) {
|
|
3140
|
+
const exists = this.rawCompoundConditionals.some((existing) => existing.chainId === compound.chainId);
|
|
3141
|
+
if (!exists) {
|
|
3142
|
+
this.rawCompoundConditionals.push(compound);
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
/**
|
|
3147
|
+
* Get compound conditionals collected during analysis.
|
|
3148
|
+
*/
|
|
3149
|
+
getCompoundConditionals() {
|
|
3150
|
+
return this.rawCompoundConditionals;
|
|
3151
|
+
}
|
|
3152
|
+
/**
|
|
3153
|
+
* Add child boundary gating conditions from AST analysis.
|
|
3154
|
+
* These track which conditions must be true for a child component to render.
|
|
3155
|
+
*/
|
|
3156
|
+
addChildBoundaryGatingConditions(conditions) {
|
|
3157
|
+
for (const [childName, usages] of Object.entries(conditions)) {
|
|
3158
|
+
if (!this.rawChildBoundaryGatingConditions[childName]) {
|
|
3159
|
+
this.rawChildBoundaryGatingConditions[childName] = [];
|
|
3160
|
+
}
|
|
3161
|
+
// Add usages, avoiding duplicates
|
|
3162
|
+
for (const usage of usages) {
|
|
3163
|
+
const exists = this.rawChildBoundaryGatingConditions[childName].some((existing) => existing.path === usage.path &&
|
|
3164
|
+
existing.conditionType === usage.conditionType &&
|
|
3165
|
+
existing.isNegated === usage.isNegated);
|
|
3166
|
+
if (!exists) {
|
|
3167
|
+
this.rawChildBoundaryGatingConditions[childName].push(usage);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
/**
|
|
3173
|
+
* Get enriched child boundary gating conditions with source tracing.
|
|
3174
|
+
* Similar to getEnrichedConditionalUsages but for gating conditions.
|
|
3175
|
+
*/
|
|
3176
|
+
getEnrichedChildBoundaryGatingConditions() {
|
|
3177
|
+
const enriched = {};
|
|
3178
|
+
const rootScopeName = this.scopeTreeManager.getTree().name;
|
|
3179
|
+
for (const [childName, usages] of Object.entries(this.rawChildBoundaryGatingConditions)) {
|
|
3180
|
+
enriched[childName] = usages.map((usage) => {
|
|
3181
|
+
// Try to trace this path back to a data source
|
|
3182
|
+
const explanation = this.explainPath(rootScopeName, usage.path);
|
|
3183
|
+
let sourceDataPath;
|
|
3184
|
+
if (explanation.source) {
|
|
3185
|
+
sourceDataPath = `${explanation.source.scope}.${explanation.source.path}`;
|
|
3186
|
+
}
|
|
3187
|
+
return {
|
|
3188
|
+
...usage,
|
|
3189
|
+
sourceDataPath,
|
|
3190
|
+
};
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
return enriched;
|
|
3194
|
+
}
|
|
2624
3195
|
/**
|
|
2625
3196
|
* Get enriched conditional usages with source tracing.
|
|
2626
3197
|
* Uses explainPath to trace each local variable back to its data source.
|
|
3198
|
+
* Preserves all fields from the raw conditional usages including derivedFrom.
|
|
2627
3199
|
*/
|
|
2628
3200
|
getEnrichedConditionalUsages() {
|
|
2629
3201
|
const enriched = {};
|
|
@@ -2644,9 +3216,29 @@ export class ScopeDataStructure {
|
|
|
2644
3216
|
}
|
|
2645
3217
|
return enriched;
|
|
2646
3218
|
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Add JSX rendering usages from AST analysis.
|
|
3221
|
+
* These track arrays rendered via .map() and strings interpolated in JSX.
|
|
3222
|
+
*/
|
|
3223
|
+
addJsxRenderingUsages(usages) {
|
|
3224
|
+
// Add usages, avoiding duplicates based on path and renderingType
|
|
3225
|
+
for (const usage of usages) {
|
|
3226
|
+
const exists = this.rawJsxRenderingUsages.some((existing) => existing.path === usage.path &&
|
|
3227
|
+
existing.renderingType === usage.renderingType);
|
|
3228
|
+
if (!exists) {
|
|
3229
|
+
this.rawJsxRenderingUsages.push(usage);
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
/**
|
|
3234
|
+
* Get JSX rendering usages collected during analysis.
|
|
3235
|
+
*/
|
|
3236
|
+
getJsxRenderingUsages() {
|
|
3237
|
+
return this.rawJsxRenderingUsages;
|
|
3238
|
+
}
|
|
2647
3239
|
toSerializable() {
|
|
2648
|
-
// Helper to clean cyScope from a string
|
|
2649
|
-
const cleanCyScope = (str) => this.replaceCyScopeInString(str);
|
|
3240
|
+
// Helper to clean cyScope and cyDuplicateKey from a string for output
|
|
3241
|
+
const cleanCyScope = (str) => this.replaceCyScopeInString(str).replace(/::cyDuplicateKey\d+::/g, '');
|
|
2650
3242
|
// Helper to convert ScopeVariable to SerializableScopeVariable (with cyScope cleaned)
|
|
2651
3243
|
const toSerializableVariable = (vars) => vars.map((v) => ({
|
|
2652
3244
|
scopeNodeName: cleanCyScope(v.scopeNodeName),
|
|
@@ -2744,6 +3336,15 @@ export class ScopeDataStructure {
|
|
|
2744
3336
|
// Not all variables have schemas - fall back to rootSchema extraction
|
|
2745
3337
|
perVariableSchemas = undefined;
|
|
2746
3338
|
}
|
|
3339
|
+
else {
|
|
3340
|
+
// Also check that at least one schema is non-empty
|
|
3341
|
+
// Bug fix: perCallSignatureSchemas may have entries but with empty schemas {}
|
|
3342
|
+
// In this case, we should fall through to Fallback which uses rootSchema
|
|
3343
|
+
const hasNonEmptySchema = Object.values(perVariableSchemas).some((schema) => Object.keys(schema).length > 0);
|
|
3344
|
+
if (!hasNonEmptySchema) {
|
|
3345
|
+
perVariableSchemas = undefined;
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
2747
3348
|
}
|
|
2748
3349
|
// CASE 2: Single call signature with single variable - use perCallSignatureSchemas directly
|
|
2749
3350
|
// This handles parameterized calls like useFetcher<ConfigData>() where each is a separate efc entry
|
|
@@ -2758,7 +3359,11 @@ export class ScopeDataStructure {
|
|
|
2758
3359
|
perVariableSchemas = { [varName]: { ...schema } };
|
|
2759
3360
|
}
|
|
2760
3361
|
}
|
|
2761
|
-
// CASE 3:
|
|
3362
|
+
// CASE 3: Extract from efc.schema when perCallSignatureSchemas is missing or empty
|
|
3363
|
+
// This handles two scenarios:
|
|
3364
|
+
// 1. Parameterized calls that create SEPARATE efc entries (no perCallSignatureSchemas)
|
|
3365
|
+
// 2. Destructuring where perCallSignatureSchemas exists but has EMPTY schemas
|
|
3366
|
+
//
|
|
2762
3367
|
// When useFetcher<ConfigData>() and useFetcher<SettingsData>() are called, they create separate
|
|
2763
3368
|
// efc entries because getFunctionCallRoot preserves type parameters. Each entry has its own
|
|
2764
3369
|
// `schema` field, but due to variable reassignment, the schema may be contaminated with paths
|
|
@@ -2774,11 +3379,25 @@ export class ScopeDataStructure {
|
|
|
2774
3379
|
//
|
|
2775
3380
|
// We filter to only keep paths that should belong to THIS call by checking if the
|
|
2776
3381
|
// receiving variable's equivalency points to this call's return value.
|
|
3382
|
+
//
|
|
3383
|
+
// BUG FIX: The old condition `!efc.perCallSignatureSchemas` was FALSE when the object
|
|
3384
|
+
// existed (even with empty schemas), causing this case to be skipped. We now also check
|
|
3385
|
+
// if all schemas in perCallSignatureSchemas are empty.
|
|
3386
|
+
const hasNonEmptyPerCallSignatureSchemas = efc.perCallSignatureSchemas &&
|
|
3387
|
+
Object.values(efc.perCallSignatureSchemas).some((schema) => Object.keys(schema).length > 0);
|
|
3388
|
+
// Build the call signature prefix that paths should start with
|
|
3389
|
+
const callSigPrefix = `${efc.callSignature}.functionCallReturnValue`;
|
|
3390
|
+
// Check if efc.schema has variable-specific paths (indicating destructuring).
|
|
3391
|
+
// Destructuring: const { entities, gitStatus } = useLoaderData()
|
|
3392
|
+
// - efc.schema has paths like: useLoaderData().functionCallReturnValue.entities...
|
|
3393
|
+
// Multiple calls: const x = useFetcher(); const y = useFetcher();
|
|
3394
|
+
// - efc.schema has paths like: useFetcher().functionCallReturnValue.data...
|
|
3395
|
+
// CASE 3 should only run for destructuring (variable-specific paths exist).
|
|
3396
|
+
const hasVariableSpecificPaths = (efc.receivingVariableNames ?? []).some((varName) => Object.keys(efc.schema).some((path) => path.startsWith(`${callSigPrefix}.${varName}`)));
|
|
2777
3397
|
if (!perVariableSchemas &&
|
|
2778
|
-
!
|
|
2779
|
-
numReceivingVars >= 1
|
|
2780
|
-
|
|
2781
|
-
const callSigPrefix = `${efc.callSignature}.functionCallReturnValue`;
|
|
3398
|
+
!hasNonEmptyPerCallSignatureSchemas &&
|
|
3399
|
+
numReceivingVars >= 1 &&
|
|
3400
|
+
hasVariableSpecificPaths) {
|
|
2782
3401
|
// Filter efc.schema to only include paths matching this call signature
|
|
2783
3402
|
const filteredSchema = {};
|
|
2784
3403
|
for (const [path, type] of Object.entries(efc.schema)) {
|
|
@@ -2787,16 +3406,17 @@ export class ScopeDataStructure {
|
|
|
2787
3406
|
}
|
|
2788
3407
|
}
|
|
2789
3408
|
// Build perVariableSchemas from the filtered schema
|
|
3409
|
+
// For destructuring, filter paths by variable name
|
|
2790
3410
|
if (Object.keys(filteredSchema).length > 0) {
|
|
2791
3411
|
perVariableSchemas = {};
|
|
2792
3412
|
for (const varName of efc.receivingVariableNames ?? []) {
|
|
2793
|
-
// For
|
|
3413
|
+
// For destructuring, extract only paths specific to this variable
|
|
3414
|
+
const varSpecificPrefix = `${callSigPrefix}.${varName}`;
|
|
2794
3415
|
const varSchema = {};
|
|
2795
3416
|
for (const [path, type] of Object.entries(filteredSchema)) {
|
|
2796
|
-
if (path.startsWith(
|
|
2797
|
-
// Transform
|
|
2798
|
-
//
|
|
2799
|
-
// -> "functionCallReturnValue.data.data.theme"
|
|
3417
|
+
if (path.startsWith(varSpecificPrefix)) {
|
|
3418
|
+
// Transform: useLoaderData().functionCallReturnValue.entities.sha
|
|
3419
|
+
// -> functionCallReturnValue.entities.sha (keep the variable name)
|
|
2800
3420
|
const suffix = path.slice(callSigPrefix.length);
|
|
2801
3421
|
const returnValuePath = `functionCallReturnValue${suffix}`;
|
|
2802
3422
|
varSchema[returnValuePath] = type;
|
|
@@ -2838,7 +3458,8 @@ export class ScopeDataStructure {
|
|
|
2838
3458
|
}
|
|
2839
3459
|
}
|
|
2840
3460
|
if (Object.keys(varSchema).length > 0) {
|
|
2841
|
-
|
|
3461
|
+
// Clean the variable name when using as key in output
|
|
3462
|
+
perVariableSchemas[cleanCyScope(varName)] = varSchema;
|
|
2842
3463
|
}
|
|
2843
3464
|
}
|
|
2844
3465
|
// Only include if we have any entries
|
|
@@ -2859,8 +3480,13 @@ export class ScopeDataStructure {
|
|
|
2859
3480
|
}, {})
|
|
2860
3481
|
: undefined,
|
|
2861
3482
|
allCallSignatures: efc.allCallSignatures,
|
|
2862
|
-
receivingVariableNames: efc.receivingVariableNames,
|
|
2863
|
-
callSignatureToVariable: efc.callSignatureToVariable
|
|
3483
|
+
receivingVariableNames: efc.receivingVariableNames?.map(cleanCyScope),
|
|
3484
|
+
callSignatureToVariable: efc.callSignatureToVariable
|
|
3485
|
+
? Object.fromEntries(Object.entries(efc.callSignatureToVariable).map(([k, v]) => [
|
|
3486
|
+
k,
|
|
3487
|
+
cleanCyScope(v),
|
|
3488
|
+
]))
|
|
3489
|
+
: undefined,
|
|
2864
3490
|
perVariableSchemas,
|
|
2865
3491
|
};
|
|
2866
3492
|
});
|
|
@@ -2962,6 +3588,12 @@ export class ScopeDataStructure {
|
|
|
2962
3588
|
};
|
|
2963
3589
|
// Apply deduplication
|
|
2964
3590
|
const deduplicatedExternalFunctionCalls = deduplicateParameterizedEntries(externalFunctionCalls);
|
|
3591
|
+
// IMPORTANT: Get equivalent signature variables BEFORE calling getFunctionResult
|
|
3592
|
+
// because getFunctionResult calls validateSchema which may remove equivalencies
|
|
3593
|
+
// during the finalize step (e.g., cleanNonObjectFunctions removes method call
|
|
3594
|
+
// equivalencies like `segments -> splat.split('/').functionCallReturnValue`).
|
|
3595
|
+
// Fix 33: Move this call before any schema validation to preserve method call chains.
|
|
3596
|
+
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
2965
3597
|
// Get root function result
|
|
2966
3598
|
const rootFunction = getFunctionResult();
|
|
2967
3599
|
// Get results for each external function (use cleaned calls for consistency)
|
|
@@ -2969,14 +3601,29 @@ export class ScopeDataStructure {
|
|
|
2969
3601
|
for (const efc of cleanedExternalCalls) {
|
|
2970
3602
|
functionResults[efc.name] = getFunctionResult(efc.name);
|
|
2971
3603
|
}
|
|
2972
|
-
// Get equivalent signature variables
|
|
2973
|
-
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
2974
3604
|
const environmentVariables = this.getEnvironmentVariables();
|
|
2975
3605
|
// Get enriched conditional usages with source tracing
|
|
2976
3606
|
const enrichedConditionalUsages = this.getEnrichedConditionalUsages();
|
|
2977
3607
|
const conditionalUsages = Object.keys(enrichedConditionalUsages).length > 0
|
|
2978
3608
|
? enrichedConditionalUsages
|
|
2979
3609
|
: undefined;
|
|
3610
|
+
// Get conditional effects (setter calls inside conditionals)
|
|
3611
|
+
const conditionalEffects = this.rawConditionalEffects.length > 0
|
|
3612
|
+
? this.rawConditionalEffects
|
|
3613
|
+
: undefined;
|
|
3614
|
+
// Get compound conditionals (grouped conditions that must all be true)
|
|
3615
|
+
const compoundConditionals = this.rawCompoundConditionals.length > 0
|
|
3616
|
+
? this.rawCompoundConditionals
|
|
3617
|
+
: undefined;
|
|
3618
|
+
// Get child boundary gating conditions
|
|
3619
|
+
const enrichedGatingConditions = this.getEnrichedChildBoundaryGatingConditions();
|
|
3620
|
+
const childBoundaryGatingConditions = Object.keys(enrichedGatingConditions).length > 0
|
|
3621
|
+
? enrichedGatingConditions
|
|
3622
|
+
: undefined;
|
|
3623
|
+
// Get JSX rendering usages (arrays via .map(), strings via interpolation)
|
|
3624
|
+
const jsxRenderingUsages = this.rawJsxRenderingUsages.length > 0
|
|
3625
|
+
? this.rawJsxRenderingUsages
|
|
3626
|
+
: undefined;
|
|
2980
3627
|
return {
|
|
2981
3628
|
externalFunctionCalls: deduplicatedExternalFunctionCalls,
|
|
2982
3629
|
rootFunction,
|
|
@@ -2984,6 +3631,10 @@ export class ScopeDataStructure {
|
|
|
2984
3631
|
equivalentSignatureVariables,
|
|
2985
3632
|
environmentVariables,
|
|
2986
3633
|
conditionalUsages,
|
|
3634
|
+
conditionalEffects,
|
|
3635
|
+
compoundConditionals,
|
|
3636
|
+
childBoundaryGatingConditions,
|
|
3637
|
+
jsxRenderingUsages,
|
|
2987
3638
|
};
|
|
2988
3639
|
}
|
|
2989
3640
|
// ═══════════════════════════════════════════════════════════════════════════
|