@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
|
@@ -82,21 +82,34 @@
|
|
|
82
82
|
import { ScopeAnalysis } from '~codeyam/types';
|
|
83
83
|
import { EquivalencyManager } from './equivalencyManagers/EquivalencyManager';
|
|
84
84
|
import fillInSchemaGapsAndUnknowns from './helpers/fillInSchemaGapsAndUnknowns';
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Patterns that indicate recursive type structures in schema paths.
|
|
88
|
+
* Used by hasExcessivePatternRepetition() to detect exponential path blowup.
|
|
89
|
+
*/
|
|
90
|
+
const RECURSIVE_PATH_PATTERNS = [
|
|
91
|
+
/\.attributes\.properties\[\]/g, // TypeScript AST JSX nodes
|
|
92
|
+
/\.children\[\]/g, // Tree structures
|
|
93
|
+
/\.elements\[\]/g, // Array-like structures
|
|
94
|
+
/\.members\[\]/g, // Class/interface members
|
|
95
|
+
/\.properties\[\]/g, // Object properties
|
|
96
|
+
/\.items\[\]/g, // Generic items arrays
|
|
97
|
+
];
|
|
85
98
|
import ensureSchemaConsistency from './helpers/ensureSchemaConsistency';
|
|
86
99
|
import cleanPath from './helpers/cleanPath';
|
|
87
100
|
import { PathManager } from './helpers/PathManager';
|
|
88
101
|
import {
|
|
89
102
|
uniqueId,
|
|
90
|
-
uniqueScopeVariables,
|
|
91
103
|
uniqueScopeAndPaths,
|
|
104
|
+
uniqueScopeVariables,
|
|
92
105
|
} from './helpers/uniqueIdUtils';
|
|
93
106
|
import selectBestValue from './helpers/selectBestValue';
|
|
94
107
|
import { VisitedTracker } from './helpers/VisitedTracker';
|
|
95
108
|
import { DebugTracer } from './helpers/DebugTracer';
|
|
96
109
|
import { BatchSchemaProcessor } from './helpers/BatchSchemaProcessor';
|
|
97
110
|
import {
|
|
98
|
-
ScopeTreeManager,
|
|
99
111
|
ROOT_SCOPE_NAME,
|
|
112
|
+
ScopeTreeManager,
|
|
100
113
|
ScopeTreeNode,
|
|
101
114
|
} from './helpers/ScopeTreeManager';
|
|
102
115
|
import cleanScopeNodeName from './helpers/cleanScopeNodeName';
|
|
@@ -108,6 +121,7 @@ import type {
|
|
|
108
121
|
SerializableFunctionCallInfo,
|
|
109
122
|
SerializableFunctionResult,
|
|
110
123
|
SerializableScopeVariable,
|
|
124
|
+
EnrichedConditionalUsage,
|
|
111
125
|
} from '../worker/SerializableDataStructure';
|
|
112
126
|
|
|
113
127
|
/**
|
|
@@ -125,6 +139,21 @@ export interface ScopeInfo {
|
|
|
125
139
|
isStatic?: boolean;
|
|
126
140
|
isClassScope?: boolean;
|
|
127
141
|
analysis?: any;
|
|
142
|
+
/** For JSX child scopes, the original JSX tag name (e.g., 'ChildViewer') */
|
|
143
|
+
jsxTagName?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Gating conditions detected during JSX extraction (before JSX is simplified).
|
|
146
|
+
* Maps child component name to conditions that must be true for it to render.
|
|
147
|
+
* This is populated by processJSXForScope in isolateScopes.ts.
|
|
148
|
+
*/
|
|
149
|
+
extractedGatingConditions?: {
|
|
150
|
+
[childComponentName: string]: Array<{
|
|
151
|
+
path: string;
|
|
152
|
+
conditionType: 'truthiness' | 'comparison';
|
|
153
|
+
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
154
|
+
isNegated?: boolean;
|
|
155
|
+
}>;
|
|
156
|
+
};
|
|
128
157
|
}
|
|
129
158
|
|
|
130
159
|
/**
|
|
@@ -384,6 +413,36 @@ export class ScopeDataStructure {
|
|
|
384
413
|
}>
|
|
385
414
|
> = {};
|
|
386
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Conditional effects collected during AST analysis.
|
|
418
|
+
* Tracks what setter calls happen inside conditionals (if, switch, ternary).
|
|
419
|
+
*/
|
|
420
|
+
private rawConditionalEffects: import('../astScopes/types').ConditionalEffect[] =
|
|
421
|
+
[];
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Compound conditionals collected during AST analysis.
|
|
425
|
+
* Groups conditions that must all be true together (e.g., a && b && c).
|
|
426
|
+
*/
|
|
427
|
+
private rawCompoundConditionals: import('../astScopes/types').CompoundConditional[] =
|
|
428
|
+
[];
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Gating conditions for child component boundaries.
|
|
432
|
+
* Maps child component name to the conditions that must be true for it to render.
|
|
433
|
+
*/
|
|
434
|
+
private rawChildBoundaryGatingConditions: Record<
|
|
435
|
+
string,
|
|
436
|
+
import('../astScopes/types').ConditionalUsage[]
|
|
437
|
+
> = {};
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* JSX rendering usages collected during AST analysis.
|
|
441
|
+
* Tracks arrays rendered via .map() and strings interpolated in JSX.
|
|
442
|
+
*/
|
|
443
|
+
private rawJsxRenderingUsages: import('../astScopes/types').JsxRenderingUsage[] =
|
|
444
|
+
[];
|
|
445
|
+
|
|
387
446
|
private lastAddToSchemaId = 0;
|
|
388
447
|
private lastEquivalencyId = 0;
|
|
389
448
|
private lastEquivalencyDatabaseId = 0;
|
|
@@ -968,8 +1027,8 @@ export class ScopeDataStructure {
|
|
|
968
1027
|
equivalencyValueChain?: EquivalencyValueChainItem[],
|
|
969
1028
|
traceId?: number,
|
|
970
1029
|
) {
|
|
971
|
-
// DEBUG: Detect infinite loops
|
|
972
1030
|
addEquivalencyCallCount++;
|
|
1031
|
+
|
|
973
1032
|
if (addEquivalencyCallCount > 50000) {
|
|
974
1033
|
console.error('INFINITE LOOP DETECTED in addEquivalency', {
|
|
975
1034
|
callCount: addEquivalencyCallCount,
|
|
@@ -1395,6 +1454,18 @@ export class ScopeDataStructure {
|
|
|
1395
1454
|
const equivalentSchemaPath = equivalentSchemaPathMap.get(remainingKey);
|
|
1396
1455
|
|
|
1397
1456
|
if (equivalentSchemaPath) {
|
|
1457
|
+
// Skip propagation when there's a structural mismatch:
|
|
1458
|
+
// - schemaPath ends with [] (array element, represents an object)
|
|
1459
|
+
// - equivalentSchemaPath doesn't end with [] (non-array prop, usually a scalar)
|
|
1460
|
+
// This prevents incorrectly typing array elements as strings when they're
|
|
1461
|
+
// equivalent to scalar props like JSX keys (e.g., workouts[] ↔ Card().key)
|
|
1462
|
+
const schemaPathEndsWithArray = schemaPath.endsWith('[]');
|
|
1463
|
+
const equivalentEndsWithArray = equivalentSchemaPath.endsWith('[]');
|
|
1464
|
+
if (schemaPathEndsWithArray !== equivalentEndsWithArray) {
|
|
1465
|
+
// Don't propagate between array element paths and non-array paths
|
|
1466
|
+
continue;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1398
1469
|
const value1 = scopeNode.schema[schemaPath];
|
|
1399
1470
|
const value2 = equivalentScopeNode.schema[equivalentSchemaPath];
|
|
1400
1471
|
|
|
@@ -1503,6 +1574,60 @@ export class ScopeDataStructure {
|
|
|
1503
1574
|
return this.pathManager.isValidPath(path);
|
|
1504
1575
|
}
|
|
1505
1576
|
|
|
1577
|
+
/**
|
|
1578
|
+
* Detects if a path contains excessive repetition of the same pattern.
|
|
1579
|
+
*
|
|
1580
|
+
* This prevents exponential blowup when analyzing recursive type structures.
|
|
1581
|
+
* For example, TypeScript AST nodes have `.attributes.properties[]` where each
|
|
1582
|
+
* property is also a node with `.attributes.properties[]`. Without this check,
|
|
1583
|
+
* paths like `signature[0].attributes.properties[].attributes.properties[].attributes.properties[]...`
|
|
1584
|
+
* would be generated exponentially.
|
|
1585
|
+
*
|
|
1586
|
+
* Two detection strategies:
|
|
1587
|
+
* 1. Known patterns: Check RECURSIVE_PATH_PATTERNS for common recursive structures
|
|
1588
|
+
* 2. Generic detection: For longer paths, detect any 2-3 part segment that repeats
|
|
1589
|
+
*
|
|
1590
|
+
* @param path - The schema path to check
|
|
1591
|
+
* @param maxRepetitions - Maximum allowed repetitions of any pattern (default: 2)
|
|
1592
|
+
* @returns true if the path has excessive repetition
|
|
1593
|
+
*/
|
|
1594
|
+
private hasExcessivePatternRepetition(
|
|
1595
|
+
path: string,
|
|
1596
|
+
maxRepetitions = 2,
|
|
1597
|
+
): boolean {
|
|
1598
|
+
// Check known recursive patterns
|
|
1599
|
+
for (const pattern of RECURSIVE_PATH_PATTERNS) {
|
|
1600
|
+
const matches = path.match(pattern);
|
|
1601
|
+
if (matches && matches.length > maxRepetitions) {
|
|
1602
|
+
return true;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
// For longer paths, detect any repeated multi-part segments we haven't explicitly listed
|
|
1607
|
+
const pathParts = this.splitPath(path);
|
|
1608
|
+
if (pathParts.length <= 6) {
|
|
1609
|
+
return false;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
// Check for repeated sequences of 2-3 consecutive parts
|
|
1613
|
+
for (let segmentLength = 2; segmentLength <= 3; segmentLength++) {
|
|
1614
|
+
const seen = new Map<string, number>();
|
|
1615
|
+
|
|
1616
|
+
for (let i = 0; i <= pathParts.length - segmentLength; i++) {
|
|
1617
|
+
const segment = pathParts.slice(i, i + segmentLength).join('.');
|
|
1618
|
+
const normalizedSegment = segment.replace(/\[\d+\]/g, '[]');
|
|
1619
|
+
const count = (seen.get(normalizedSegment) || 0) + 1;
|
|
1620
|
+
seen.set(normalizedSegment, count);
|
|
1621
|
+
|
|
1622
|
+
if (count > maxRepetitions) {
|
|
1623
|
+
return true;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
return false;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1506
1631
|
private addToTree(pathParts: string[]) {
|
|
1507
1632
|
this.scopeTreeManager.addPath(pathParts);
|
|
1508
1633
|
}
|
|
@@ -1571,44 +1696,13 @@ export class ScopeDataStructure {
|
|
|
1571
1696
|
}
|
|
1572
1697
|
|
|
1573
1698
|
private determineEquivalenciesAndBuildSchema(scopeNode: ScopeNode) {
|
|
1699
|
+
if (!scopeNode.analysis) {
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1574
1703
|
const { isolatedStructure, isolatedEquivalentVariables } =
|
|
1575
1704
|
scopeNode.analysis;
|
|
1576
1705
|
|
|
1577
|
-
// DEBUG: Log all equivalencies related to useFetcher
|
|
1578
|
-
if (
|
|
1579
|
-
Object.keys(isolatedEquivalentVariables || {}).some(
|
|
1580
|
-
(k) => k.includes('Fetcher') || k.includes('fetcher'),
|
|
1581
|
-
)
|
|
1582
|
-
) {
|
|
1583
|
-
console.log(
|
|
1584
|
-
'CodeYam DEBUG determineEquivalenciesAndBuildSchema:',
|
|
1585
|
-
JSON.stringify(
|
|
1586
|
-
{
|
|
1587
|
-
scopeNodeName: scopeNode.name,
|
|
1588
|
-
fetcherEquivalencies: Object.entries(
|
|
1589
|
-
isolatedEquivalentVariables || {},
|
|
1590
|
-
)
|
|
1591
|
-
.filter(
|
|
1592
|
-
([k, v]) =>
|
|
1593
|
-
k.includes('Fetcher') ||
|
|
1594
|
-
k.includes('fetcher') ||
|
|
1595
|
-
String(v).includes('Fetcher') ||
|
|
1596
|
-
String(v).includes('fetcher'),
|
|
1597
|
-
)
|
|
1598
|
-
.reduce(
|
|
1599
|
-
(acc, [k, v]) => {
|
|
1600
|
-
acc[k] = v;
|
|
1601
|
-
return acc;
|
|
1602
|
-
},
|
|
1603
|
-
{} as Record<string, string>,
|
|
1604
|
-
),
|
|
1605
|
-
},
|
|
1606
|
-
null,
|
|
1607
|
-
2,
|
|
1608
|
-
),
|
|
1609
|
-
);
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
1706
|
const allPaths = Array.from(
|
|
1613
1707
|
new Set([
|
|
1614
1708
|
...Object.keys(isolatedStructure || {}),
|
|
@@ -1621,11 +1715,24 @@ export class ScopeDataStructure {
|
|
|
1621
1715
|
let equivalentValue = isolatedEquivalentVariables?.[path];
|
|
1622
1716
|
|
|
1623
1717
|
if (equivalentValue && this.isValidPath(equivalentValue)) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1718
|
+
// IMPORTANT: DO NOT strip ::cyDuplicateKey:: markers from equivalencies.
|
|
1719
|
+
// These markers are critical for distinguishing variable reassignments.
|
|
1720
|
+
// For example, with:
|
|
1721
|
+
// let fetcher = useFetcher<ConfigData>();
|
|
1722
|
+
// const configData = fetcher.data?.data;
|
|
1723
|
+
// fetcher = useFetcher<SettingsData>();
|
|
1724
|
+
// const settingsData = fetcher.data?.data;
|
|
1725
|
+
//
|
|
1726
|
+
// mergeStatements creates:
|
|
1727
|
+
// fetcher → useFetcher<ConfigData>()...
|
|
1728
|
+
// fetcher::cyDuplicateKey1:: → useFetcher<SettingsData>()...
|
|
1729
|
+
// configData → fetcher.data.data
|
|
1730
|
+
// settingsData → fetcher::cyDuplicateKey1::.data.data
|
|
1731
|
+
//
|
|
1732
|
+
// If we strip ::cyDuplicateKey::, settingsData would incorrectly trace
|
|
1733
|
+
// to useFetcher<ConfigData>() instead of useFetcher<SettingsData>().
|
|
1734
|
+
path = cleanPath(path, allPaths);
|
|
1735
|
+
equivalentValue = cleanPath(equivalentValue, allPaths);
|
|
1629
1736
|
|
|
1630
1737
|
this.addEquivalency(
|
|
1631
1738
|
path,
|
|
@@ -1771,7 +1878,7 @@ export class ScopeDataStructure {
|
|
|
1771
1878
|
this.batchProcessor = new BatchSchemaProcessor();
|
|
1772
1879
|
this.batchQueuedSet = new Set();
|
|
1773
1880
|
|
|
1774
|
-
for (const key of
|
|
1881
|
+
for (const key of allPaths) {
|
|
1775
1882
|
let value = isolatedStructure[key] ?? 'unknown';
|
|
1776
1883
|
|
|
1777
1884
|
if (['null', 'undefined'].includes(value)) {
|
|
@@ -1812,7 +1919,19 @@ export class ScopeDataStructure {
|
|
|
1812
1919
|
private processBatchQueue(): void {
|
|
1813
1920
|
if (!this.batchProcessor) return;
|
|
1814
1921
|
|
|
1922
|
+
let iterations = 0;
|
|
1923
|
+
|
|
1815
1924
|
while (this.batchProcessor.hasWork()) {
|
|
1925
|
+
iterations++;
|
|
1926
|
+
|
|
1927
|
+
// Safety: detect potential infinite loops
|
|
1928
|
+
if (iterations > 100000) {
|
|
1929
|
+
console.error(
|
|
1930
|
+
`[ScopeDataStructure] processBatchQueue exceeded 100k iterations, possible infinite loop!`,
|
|
1931
|
+
);
|
|
1932
|
+
break;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1816
1935
|
const item = this.batchProcessor.getNextWork();
|
|
1817
1936
|
if (!item) break;
|
|
1818
1937
|
|
|
@@ -1870,26 +1989,6 @@ export class ScopeDataStructure {
|
|
|
1870
1989
|
const functionCallInfo =
|
|
1871
1990
|
this.getExternalFunctionCallsIndex().get(searchKey);
|
|
1872
1991
|
|
|
1873
|
-
// DEBUG: Track useFetcher calls
|
|
1874
|
-
if (searchKey === 'useFetcher' || callSignature.includes('useFetcher')) {
|
|
1875
|
-
console.log(
|
|
1876
|
-
'CodeYam DEBUG trackReceivingVariable:',
|
|
1877
|
-
JSON.stringify(
|
|
1878
|
-
{
|
|
1879
|
-
receivingVariable,
|
|
1880
|
-
equivalentValue,
|
|
1881
|
-
callSignature,
|
|
1882
|
-
searchKey,
|
|
1883
|
-
foundFunctionCallInfo: !!functionCallInfo,
|
|
1884
|
-
existingRecvVars: functionCallInfo?.receivingVariableNames,
|
|
1885
|
-
existingCallSigToVar: functionCallInfo?.callSignatureToVariable,
|
|
1886
|
-
},
|
|
1887
|
-
null,
|
|
1888
|
-
2,
|
|
1889
|
-
),
|
|
1890
|
-
);
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
1992
|
if (!functionCallInfo) {
|
|
1894
1993
|
return;
|
|
1895
1994
|
}
|
|
@@ -2389,6 +2488,21 @@ export class ScopeDataStructure {
|
|
|
2389
2488
|
|
|
2390
2489
|
const newEquivalentPath = this.joinPathParts([schemaPath, remainingPath]);
|
|
2391
2490
|
|
|
2491
|
+
// PERF: Detect repeated patterns in paths to prevent exponential blowup
|
|
2492
|
+
// Paths like `signature[0].attributes.properties[].attributes.properties[]...`
|
|
2493
|
+
// indicate recursive type structures that cause exponential schema explosion
|
|
2494
|
+
if (this.hasExcessivePatternRepetition(newEquivalentPath)) {
|
|
2495
|
+
if (traceId && debugLevel > 0) {
|
|
2496
|
+
console.info(
|
|
2497
|
+
'Debug: skipping path with excessive pattern repetition',
|
|
2498
|
+
{
|
|
2499
|
+
path: newEquivalentPath,
|
|
2500
|
+
},
|
|
2501
|
+
);
|
|
2502
|
+
}
|
|
2503
|
+
continue;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2392
2506
|
if (!equivalentScopeNode) {
|
|
2393
2507
|
if (traceId) {
|
|
2394
2508
|
console.info('Debug Propagation: missing equivalent scope info', {
|
|
@@ -3298,10 +3412,29 @@ export class ScopeDataStructure {
|
|
|
3298
3412
|
}
|
|
3299
3413
|
}
|
|
3300
3414
|
}
|
|
3301
|
-
return mergedSchema;
|
|
3415
|
+
return this.filterDuplicateKeys(mergedSchema);
|
|
3302
3416
|
}
|
|
3303
3417
|
|
|
3304
|
-
return schema;
|
|
3418
|
+
return this.filterDuplicateKeys(schema);
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
/**
|
|
3422
|
+
* Filter out ::cyDuplicateKey:: entries from a schema.
|
|
3423
|
+
* These are internal markers for tracking variable reassignments
|
|
3424
|
+
* and should not appear in output schemas or LLM prompts.
|
|
3425
|
+
*/
|
|
3426
|
+
private filterDuplicateKeys(
|
|
3427
|
+
schema: Record<string, string>,
|
|
3428
|
+
): Record<string, string> {
|
|
3429
|
+
return Object.entries(schema).reduce(
|
|
3430
|
+
(acc, [key, value]) => {
|
|
3431
|
+
if (!key.includes('::cyDuplicateKey')) {
|
|
3432
|
+
acc[key] = value;
|
|
3433
|
+
}
|
|
3434
|
+
return acc;
|
|
3435
|
+
},
|
|
3436
|
+
{} as Record<string, string>,
|
|
3437
|
+
);
|
|
3305
3438
|
}
|
|
3306
3439
|
|
|
3307
3440
|
getEquivalencies(scopeName?: string) {
|
|
@@ -3409,12 +3542,14 @@ export class ScopeDataStructure {
|
|
|
3409
3542
|
);
|
|
3410
3543
|
|
|
3411
3544
|
const equivalencies = this.getEquivalencies(functionName);
|
|
3545
|
+
const scopeName = functionName ?? this.scopeTreeManager.getRootName();
|
|
3546
|
+
|
|
3412
3547
|
for (const equivalenceKey in equivalencies ?? {}) {
|
|
3413
3548
|
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
3414
3549
|
const schemaPath = equivalenceValue.schemaPath;
|
|
3415
3550
|
if (
|
|
3416
3551
|
schemaPath.startsWith('signature[') &&
|
|
3417
|
-
equivalenceValue.scopeNodeName ===
|
|
3552
|
+
equivalenceValue.scopeNodeName === scopeName &&
|
|
3418
3553
|
!signatureInSchema[schemaPath]
|
|
3419
3554
|
) {
|
|
3420
3555
|
signatureInSchema[schemaPath] = 'unknown';
|
|
@@ -3428,16 +3563,62 @@ export class ScopeDataStructure {
|
|
|
3428
3563
|
equivalencies,
|
|
3429
3564
|
);
|
|
3430
3565
|
|
|
3431
|
-
// CRITICAL: Set onlyEquivalencies to true to prevent database modifications
|
|
3432
|
-
// during this "getter" method. validateSchema triggers manager.finalize which
|
|
3433
|
-
// can call addToSchema -> addToEquivalencyDatabase -> mergeEquivalencyDatabaseEntries,
|
|
3434
|
-
// which would incorrectly remove entries from the database.
|
|
3435
|
-
const wasOnlyEquivalencies = this.onlyEquivalencies;
|
|
3436
|
-
this.onlyEquivalencies = true;
|
|
3437
3566
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
3438
|
-
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
3439
3567
|
|
|
3440
|
-
|
|
3568
|
+
// After validateSchema has filled in types, propagate nested paths from
|
|
3569
|
+
// variables to their signature equivalents.
|
|
3570
|
+
// e.g., workouts[].activity_type -> signature[0].workouts[].activity_type
|
|
3571
|
+
//
|
|
3572
|
+
// Build a map of variable names that are equivalent to signature paths
|
|
3573
|
+
// e.g., { 'workouts': 'signature[0].workouts' }
|
|
3574
|
+
const variableToSignatureMap: Record<string, string> = {};
|
|
3575
|
+
|
|
3576
|
+
for (const equivalenceKey in equivalencies ?? {}) {
|
|
3577
|
+
for (const equivalenceValue of equivalencies[equivalenceKey]) {
|
|
3578
|
+
const schemaPath = equivalenceValue.schemaPath;
|
|
3579
|
+
// Track which variables map to signature paths
|
|
3580
|
+
// equivalenceKey is the variable name (e.g., 'workouts')
|
|
3581
|
+
// schemaPath is where it comes from (e.g., 'signature[0].workouts')
|
|
3582
|
+
if (
|
|
3583
|
+
schemaPath.startsWith('signature[') &&
|
|
3584
|
+
equivalenceValue.scopeNodeName === scopeName
|
|
3585
|
+
) {
|
|
3586
|
+
variableToSignatureMap[equivalenceKey] = schemaPath;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
// Propagate nested paths from variables to their signature equivalents
|
|
3592
|
+
// e.g., if workouts = signature[0].workouts, then workouts[].title becomes
|
|
3593
|
+
// signature[0].workouts[].title
|
|
3594
|
+
for (const schemaKey in schema) {
|
|
3595
|
+
// Skip keys that already start with signature[
|
|
3596
|
+
if (schemaKey.startsWith('signature[')) continue;
|
|
3597
|
+
|
|
3598
|
+
// Check if this key starts with a variable that maps to a signature path
|
|
3599
|
+
for (const [variableName, signaturePath] of Object.entries(
|
|
3600
|
+
variableToSignatureMap,
|
|
3601
|
+
)) {
|
|
3602
|
+
// Check if schemaKey starts with variableName followed by a property accessor
|
|
3603
|
+
// e.g., 'workouts[]' starts with 'workouts'
|
|
3604
|
+
if (
|
|
3605
|
+
schemaKey === variableName ||
|
|
3606
|
+
schemaKey.startsWith(variableName + '.') ||
|
|
3607
|
+
schemaKey.startsWith(variableName + '[')
|
|
3608
|
+
) {
|
|
3609
|
+
// Transform the path: replace the variable prefix with the signature path
|
|
3610
|
+
const suffix = schemaKey.slice(variableName.length);
|
|
3611
|
+
const signatureKey = signaturePath + suffix;
|
|
3612
|
+
|
|
3613
|
+
// Add to schema if not already present
|
|
3614
|
+
if (!tempScopeNode.schema[signatureKey]) {
|
|
3615
|
+
tempScopeNode.schema[signatureKey] = schema[schemaKey];
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
return this.filterDuplicateKeys(tempScopeNode.schema);
|
|
3441
3622
|
}
|
|
3442
3623
|
|
|
3443
3624
|
getReturnValue({
|
|
@@ -3499,7 +3680,17 @@ export class ScopeDataStructure {
|
|
|
3499
3680
|
// Include function paths even if their return value wasn't captured
|
|
3500
3681
|
// This ensures methods like onAuthStateChange are included in the schema
|
|
3501
3682
|
// But exclude signature entries (they should only be included via functionCallReturnValue paths)
|
|
3502
|
-
|
|
3683
|
+
// Also exclude bare function call signatures - paths that are JUST a call like
|
|
3684
|
+
// "useCustomSizes(projectSlug)" should not be included as return values.
|
|
3685
|
+
// These represent "the function exists" not actual return data, and including
|
|
3686
|
+
// them causes nested path bugs in dependencySchemas.
|
|
3687
|
+
(schema[key] === 'function' &&
|
|
3688
|
+
key.indexOf('signature[') === -1 &&
|
|
3689
|
+
// Exclude bare call signatures: function calls with no dots OUTSIDE parentheses
|
|
3690
|
+
// e.g., "useCustomSizes(projectSlug)" is bare (exclude)
|
|
3691
|
+
// e.g., "loadProject({nested.property})" is bare - dots are inside args (exclude)
|
|
3692
|
+
// e.g., "getSupabase().auth.method()" has dots outside - method chain (include)
|
|
3693
|
+
!this.isBareCallSignature(key)),
|
|
3503
3694
|
)
|
|
3504
3695
|
.reduce(
|
|
3505
3696
|
(acc, key) => {
|
|
@@ -3509,7 +3700,10 @@ export class ScopeDataStructure {
|
|
|
3509
3700
|
for (const path in schema) {
|
|
3510
3701
|
const pathParts = this.splitPath(path);
|
|
3511
3702
|
if (pathParts.every((p, i) => keyParts[i] === p)) {
|
|
3512
|
-
|
|
3703
|
+
// Also exclude bare call signatures from prefix paths
|
|
3704
|
+
if (!this.isBareCallSignature(path)) {
|
|
3705
|
+
acc[path] = schema[path];
|
|
3706
|
+
}
|
|
3513
3707
|
}
|
|
3514
3708
|
}
|
|
3515
3709
|
|
|
@@ -3530,7 +3724,59 @@ export class ScopeDataStructure {
|
|
|
3530
3724
|
this.validateSchema(tempScopeNode, true, fillInUnknowns);
|
|
3531
3725
|
this.onlyEquivalencies = wasOnlyEquivalencies;
|
|
3532
3726
|
|
|
3533
|
-
return
|
|
3727
|
+
// Remove bare call signatures from the return value schema.
|
|
3728
|
+
// fillInSchemaGapsAndUnknowns may add parent paths like "useCustomSizes(projectSlug)"
|
|
3729
|
+
// when it sees "useCustomSizes(projectSlug).functionCallReturnValue". These bare
|
|
3730
|
+
// call signatures represent "the function exists" not actual return data, and
|
|
3731
|
+
// including them causes nested path bugs in dependencySchemas.
|
|
3732
|
+
const resultSchema = tempScopeNode.schema;
|
|
3733
|
+
for (const key of Object.keys(resultSchema)) {
|
|
3734
|
+
if (this.isBareCallSignature(key)) {
|
|
3735
|
+
delete resultSchema[key];
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
return resultSchema;
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
/**
|
|
3743
|
+
* Checks if a schema key is a "bare call signature" - a function call with no
|
|
3744
|
+
* method chain before it and no path segments after it.
|
|
3745
|
+
*
|
|
3746
|
+
* A bare call signature represents "this function exists" rather than actual
|
|
3747
|
+
* return data, and including them causes nested path bugs in dependencySchemas.
|
|
3748
|
+
*
|
|
3749
|
+
* Examples:
|
|
3750
|
+
* - "useCustomSizes(projectSlug)" -> bare (true)
|
|
3751
|
+
* - "loadProject({nested.property})" -> bare (dots are inside args, true)
|
|
3752
|
+
* - "getSupabase().auth.method()" -> not bare (has dots outside parens, false)
|
|
3753
|
+
* - "useProject().functionCallReturnValue" -> not bare (has path after, false)
|
|
3754
|
+
*/
|
|
3755
|
+
private isBareCallSignature(key: string): boolean {
|
|
3756
|
+
// Must end with ) and contain ( to be a call
|
|
3757
|
+
if (!key.endsWith(')') || key.indexOf('(') === -1) {
|
|
3758
|
+
return false;
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3761
|
+
// Check if there are any dots OUTSIDE of parentheses
|
|
3762
|
+
// Strip out content inside balanced parentheses, then check for dots
|
|
3763
|
+
let depth = 0;
|
|
3764
|
+
let hasDotsOutsideParens = false;
|
|
3765
|
+
|
|
3766
|
+
for (let i = 0; i < key.length; i++) {
|
|
3767
|
+
const char = key[i];
|
|
3768
|
+
if (char === '(') {
|
|
3769
|
+
depth++;
|
|
3770
|
+
} else if (char === ')') {
|
|
3771
|
+
depth--;
|
|
3772
|
+
} else if (char === '.' && depth === 0) {
|
|
3773
|
+
hasDotsOutsideParens = true;
|
|
3774
|
+
break;
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
// It's a bare call signature if there are no dots outside parentheses
|
|
3779
|
+
return !hasDotsOutsideParens;
|
|
3534
3780
|
}
|
|
3535
3781
|
|
|
3536
3782
|
/**
|
|
@@ -3622,12 +3868,315 @@ export class ScopeDataStructure {
|
|
|
3622
3868
|
scopeNode.equivalencies,
|
|
3623
3869
|
)) {
|
|
3624
3870
|
for (const equivalentValue of equivalentValues) {
|
|
3871
|
+
// Case 1: Props/signature equivalencies (existing behavior)
|
|
3872
|
+
// Maps local variable names to their signature paths
|
|
3873
|
+
// e.g., "propValue" -> "signature[0].prop"
|
|
3625
3874
|
if (path.startsWith('signature[')) {
|
|
3626
3875
|
equivalentSignatureVariables[equivalentValue.schemaPath] = path;
|
|
3627
3876
|
}
|
|
3877
|
+
|
|
3878
|
+
// Case 2: Hook variable equivalencies (new behavior)
|
|
3879
|
+
// The equivalencies are stored as: path = variable name, schemaPath = data source
|
|
3880
|
+
// e.g., path = "debugFetcher", schemaPath = "useFetcher<...>().functionCallReturnValue"
|
|
3881
|
+
// We need to map: "debugFetcher" -> "useFetcher<...>()"
|
|
3882
|
+
// This enables resolving paths like "debugFetcher.state" to
|
|
3883
|
+
// "useFetcher<...>().state" for execution flow validation
|
|
3884
|
+
if (equivalentValue.schemaPath.endsWith('.functionCallReturnValue')) {
|
|
3885
|
+
// Extract the hook call path (everything before .functionCallReturnValue)
|
|
3886
|
+
let hookCallPath = equivalentValue.schemaPath.slice(
|
|
3887
|
+
0,
|
|
3888
|
+
-'.functionCallReturnValue'.length,
|
|
3889
|
+
);
|
|
3890
|
+
// Only include if it looks like a hook call (contains parentheses)
|
|
3891
|
+
// and the variable name (path) is a simple identifier (no dots)
|
|
3892
|
+
if (hookCallPath.includes('(') && !path.includes('.')) {
|
|
3893
|
+
// Special case: If hookCallPath is a callback scope (cyScope pattern),
|
|
3894
|
+
// trace through it to find what the callback actually returns.
|
|
3895
|
+
// This handles useState(() => { return prop; }) patterns.
|
|
3896
|
+
const cyScopeMatch = hookCallPath.match(/^(cyScope\d+)\(\)$/);
|
|
3897
|
+
if (cyScopeMatch) {
|
|
3898
|
+
// Use the equivalency database to trace the callback's return value
|
|
3899
|
+
// to its actual source (e.g., viewModeFromUrl -> segments -> params -> useParams)
|
|
3900
|
+
const dbEntry = this.getEquivalenciesDatabaseEntry(
|
|
3901
|
+
scopeNode.name, // Component scope
|
|
3902
|
+
path, // variable name (e.g., viewMode)
|
|
3903
|
+
);
|
|
3904
|
+
if (dbEntry?.sourceCandidates?.length > 0) {
|
|
3905
|
+
// Use the traced source instead of the callback scope
|
|
3906
|
+
hookCallPath = dbEntry.sourceCandidates[0].schemaPath;
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
equivalentSignatureVariables[path] = hookCallPath;
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
|
|
3913
|
+
// Case 3: Destructured variables from local variables
|
|
3914
|
+
// e.g., const { scenarios } = currentEntityAnalysis;
|
|
3915
|
+
// This creates: path = "scenarios", schemaPath = "currentEntityAnalysis.scenarios"
|
|
3916
|
+
// We need to map: "scenarios" -> "currentEntityAnalysis.scenarios"
|
|
3917
|
+
// AND resolve transitively if currentEntityAnalysis is itself equivalent to a hook call
|
|
3918
|
+
if (
|
|
3919
|
+
!path.includes('.') && // path is a simple identifier
|
|
3920
|
+
!equivalentValue.schemaPath.startsWith('signature[') && // not a signature path
|
|
3921
|
+
!equivalentValue.schemaPath.endsWith('.functionCallReturnValue') // not already handled above
|
|
3922
|
+
) {
|
|
3923
|
+
// Only add if we haven't already captured this variable in Case 1 or 2
|
|
3924
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
3925
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
|
|
3929
|
+
// Case 4: Child component prop mappings (Fix 22)
|
|
3930
|
+
// When parent renders <ChildComponent prop={value} />, we get equivalencies like:
|
|
3931
|
+
// path = "ChildComponent().signature[0].prop"
|
|
3932
|
+
// schemaPath = "value" (the variable passed as the prop)
|
|
3933
|
+
// We need to include these so translateChildPathToParent can work.
|
|
3934
|
+
// Pattern: ComponentName().signature[N] or ComponentName().signature[N].propName
|
|
3935
|
+
if (
|
|
3936
|
+
path.includes('().signature[') &&
|
|
3937
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable, not a function call
|
|
3938
|
+
) {
|
|
3939
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
// Case 5: Destructured function parameters (Fix 25)
|
|
3943
|
+
// When a function has destructured props: function Comp({ propA, propB }: Props)
|
|
3944
|
+
// We get equivalencies like:
|
|
3945
|
+
// path = "propA" (the destructured variable name)
|
|
3946
|
+
// schemaPath = "signature[0].propA" (the signature path)
|
|
3947
|
+
// We need to map: "propA" -> "signature[0].propA"
|
|
3948
|
+
// This enables translateChildPathToParent to resolve child variable paths
|
|
3949
|
+
// to their signature paths when merging execution flows.
|
|
3950
|
+
if (
|
|
3951
|
+
!path.includes('.') && // path is a simple identifier (destructured prop name)
|
|
3952
|
+
equivalentValue.schemaPath.startsWith('signature[') // schemaPath IS a signature path
|
|
3953
|
+
) {
|
|
3954
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3955
|
+
}
|
|
3956
|
+
|
|
3957
|
+
// Case 7: Method calls on variables that result in .functionCallReturnValue (Fix 33)
|
|
3958
|
+
// When we have patterns like:
|
|
3959
|
+
// path = "segments" (simple identifier)
|
|
3960
|
+
// schemaPath = "splat.split('/').functionCallReturnValue"
|
|
3961
|
+
// This is a method call on a variable (not a hook call), but we still need to
|
|
3962
|
+
// track it so transitive resolution can resolve `splat` to its actual source.
|
|
3963
|
+
// E.g., if splat -> useParams().functionCallReturnValue['*'], then
|
|
3964
|
+
// segments -> useParams().functionCallReturnValue['*'].split('/').functionCallReturnValue
|
|
3965
|
+
if (
|
|
3966
|
+
!path.includes('.') && // path is a simple identifier
|
|
3967
|
+
equivalentValue.schemaPath.endsWith('.functionCallReturnValue') && // ends with function return
|
|
3968
|
+
equivalentValue.schemaPath.includes('.') && // has property access (method call)
|
|
3969
|
+
!(path in equivalentSignatureVariables) // not already captured
|
|
3970
|
+
) {
|
|
3971
|
+
// Check if this looks like a method call on a variable (not a hook call)
|
|
3972
|
+
// Hook calls look like: hookName() or hookName<T>()
|
|
3973
|
+
// Method calls look like: variable.method() or variable.method<T>()
|
|
3974
|
+
const hookCallPath = equivalentValue.schemaPath.slice(
|
|
3975
|
+
0,
|
|
3976
|
+
-'.functionCallReturnValue'.length,
|
|
3977
|
+
);
|
|
3978
|
+
// If it's a method call (contains a dot before the parenthesis), include it
|
|
3979
|
+
const dotBeforeParen = hookCallPath.indexOf('.');
|
|
3980
|
+
const parenPos = hookCallPath.indexOf('(');
|
|
3981
|
+
if (dotBeforeParen !== -1 && dotBeforeParen < parenPos) {
|
|
3982
|
+
// This is a method call like "splat.split('/')", not a hook call
|
|
3983
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3628
3986
|
}
|
|
3629
3987
|
}
|
|
3630
3988
|
|
|
3989
|
+
// Case 6: Collect JSX child prop equivalencies from child scopes (Fix 26)
|
|
3990
|
+
// When a parent component renders <ChildComponent prop={value} />, the JSX
|
|
3991
|
+
// return statement may be in a child scope (e.g., cyScope2). The equivalencies
|
|
3992
|
+
// like ChildComponent().signature[0].prop -> value get stored in that child scope.
|
|
3993
|
+
// But translateChildPathToParent needs to find them from the parent scope's context.
|
|
3994
|
+
// So we collect Case 4 patterns from ALL child scopes that belong to this root scope.
|
|
3995
|
+
const rootName = this.scopeTreeManager.getRootName();
|
|
3996
|
+
for (const [scopeName, childScopeNode] of Object.entries(this.scopeNodes)) {
|
|
3997
|
+
// Skip the root scope (already processed above)
|
|
3998
|
+
if (scopeName === rootName) continue;
|
|
3999
|
+
|
|
4000
|
+
// Only include scopes that are children of the root (their tree includes root)
|
|
4001
|
+
if (!childScopeNode.tree?.includes(rootName)) continue;
|
|
4002
|
+
|
|
4003
|
+
// Look for Case 4 patterns in the child scope
|
|
4004
|
+
for (const [path, equivalentValues] of Object.entries(
|
|
4005
|
+
childScopeNode.equivalencies || {},
|
|
4006
|
+
)) {
|
|
4007
|
+
for (const equivalentValue of equivalentValues) {
|
|
4008
|
+
// Case 4 pattern: ChildComponent().signature[0].propName -> parentVariable
|
|
4009
|
+
if (
|
|
4010
|
+
path.includes('().signature[') &&
|
|
4011
|
+
!equivalentValue.schemaPath.includes('()') // schemaPath is a simple variable
|
|
4012
|
+
) {
|
|
4013
|
+
// Only add if not already present from the root scope
|
|
4014
|
+
if (!(path in equivalentSignatureVariables)) {
|
|
4015
|
+
equivalentSignatureVariables[path] = equivalentValue.schemaPath;
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
|
|
4022
|
+
// Transitive resolution: Resolve variable chains through multiple levels
|
|
4023
|
+
// E.g., analysis → currentEntityAnalysis → useLoaderData().functionCallReturnValue.currentEntityAnalysis
|
|
4024
|
+
// We need multiple passes because resolutions can depend on each other
|
|
4025
|
+
const maxIterations = 5; // Prevent infinite loops
|
|
4026
|
+
|
|
4027
|
+
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
4028
|
+
let changed = false;
|
|
4029
|
+
|
|
4030
|
+
for (const [varName, sourcePath] of Object.entries(
|
|
4031
|
+
equivalentSignatureVariables,
|
|
4032
|
+
)) {
|
|
4033
|
+
// Skip if already fully resolved (contains function call syntax)
|
|
4034
|
+
// BUT first check for computed value patterns that need resolution (Fix 28)
|
|
4035
|
+
// AND method call patterns that need base variable resolution (Fix 33)
|
|
4036
|
+
if (sourcePath.includes('()')) {
|
|
4037
|
+
// Fix 28: Handle computed value patterns with dependency arrays
|
|
4038
|
+
// Patterns like `functionName(arg, [dep1, dep2, ...])` are NOT controllable
|
|
4039
|
+
// data sources. We trace through the dependencies to find controllable sources.
|
|
4040
|
+
const bracketStart = sourcePath.indexOf('[');
|
|
4041
|
+
const bracketEnd = sourcePath.lastIndexOf(']');
|
|
4042
|
+
|
|
4043
|
+
if (bracketStart !== -1 && bracketEnd > bracketStart) {
|
|
4044
|
+
const arrayContent = sourcePath.slice(bracketStart + 1, bracketEnd);
|
|
4045
|
+
const items = arrayContent.split(',').map((s) => s.trim());
|
|
4046
|
+
|
|
4047
|
+
// Only process if this looks like a dependency array:
|
|
4048
|
+
// multiple items that are all simple identifiers (not numbers or expressions)
|
|
4049
|
+
const isIdentifier = (s: string) =>
|
|
4050
|
+
/^\w+$/.test(s) && !/^\d+$/.test(s);
|
|
4051
|
+
if (items.length > 1 && items.every(isIdentifier)) {
|
|
4052
|
+
// Look for a dependency that's already resolved to a controllable source
|
|
4053
|
+
for (const dep of items) {
|
|
4054
|
+
if (dep in equivalentSignatureVariables) {
|
|
4055
|
+
const resolvedDep = equivalentSignatureVariables[dep];
|
|
4056
|
+
// Use if it's a controllable path (contains hook call)
|
|
4057
|
+
// and is NOT another unresolved computed pattern (has comma-separated deps)
|
|
4058
|
+
const hasCommaInBrackets =
|
|
4059
|
+
resolvedDep.includes('[') &&
|
|
4060
|
+
resolvedDep.includes(',') &&
|
|
4061
|
+
resolvedDep.indexOf(',') > resolvedDep.indexOf('[');
|
|
4062
|
+
if (resolvedDep.includes('()') && !hasCommaInBrackets) {
|
|
4063
|
+
// Computed value is typically an element from an array
|
|
4064
|
+
equivalentSignatureVariables[varName] = resolvedDep + '[]';
|
|
4065
|
+
changed = true;
|
|
4066
|
+
break;
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
|
|
4073
|
+
// Fix 33: Handle method call patterns on variables
|
|
4074
|
+
// Patterns like: "splat.split('/').functionCallReturnValue"
|
|
4075
|
+
// We need to resolve the base variable (splat) to its actual source
|
|
4076
|
+
// Check if this is a method call on a variable (dot before first parenthesis)
|
|
4077
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
4078
|
+
const parenIndex = sourcePath.indexOf('(');
|
|
4079
|
+
if (
|
|
4080
|
+
dotIndex !== -1 &&
|
|
4081
|
+
dotIndex < parenIndex &&
|
|
4082
|
+
!sourcePath.startsWith('use') // Not a hook call like useState()
|
|
4083
|
+
) {
|
|
4084
|
+
// Extract the base variable (before the first dot)
|
|
4085
|
+
const baseVar = sourcePath.slice(0, dotIndex);
|
|
4086
|
+
const rest = sourcePath.slice(dotIndex); // includes ".method(...).functionCallReturnValue"
|
|
4087
|
+
|
|
4088
|
+
// Check if the base variable can be resolved
|
|
4089
|
+
if (
|
|
4090
|
+
baseVar in equivalentSignatureVariables &&
|
|
4091
|
+
baseVar !== varName
|
|
4092
|
+
) {
|
|
4093
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
4094
|
+
// Only resolve if the base resolved to something useful (contains () or .)
|
|
4095
|
+
if (baseResolved.includes('()') || baseResolved.includes('.')) {
|
|
4096
|
+
const newPath = baseResolved + rest;
|
|
4097
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
4098
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
4099
|
+
changed = true;
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
|
|
4105
|
+
// Fix 38: Handle cyScope lazy initializer return values
|
|
4106
|
+
// When we have viewMode -> cyScope20(), trace through to find what cyScope20 returns.
|
|
4107
|
+
// The lazy initializer's return value should be the controllable data source.
|
|
4108
|
+
// Pattern: cyScopeN() where N is a number
|
|
4109
|
+
const cyScopeMatch = sourcePath.match(/^(cyScope\d+)\(\)$/);
|
|
4110
|
+
if (cyScopeMatch) {
|
|
4111
|
+
const cyScopeName = cyScopeMatch[1];
|
|
4112
|
+
const cyScopeNode = this.scopeNodes[cyScopeName];
|
|
4113
|
+
|
|
4114
|
+
if (cyScopeNode?.equivalencies) {
|
|
4115
|
+
// Look for returnValue equivalency in the cyScope
|
|
4116
|
+
const returnValueEquivs =
|
|
4117
|
+
cyScopeNode.equivalencies['returnValue'];
|
|
4118
|
+
if (returnValueEquivs && returnValueEquivs.length > 0) {
|
|
4119
|
+
// Get the first return value source
|
|
4120
|
+
const returnSource = returnValueEquivs[0].schemaPath;
|
|
4121
|
+
|
|
4122
|
+
// If the return source is a simple variable (not a complex path),
|
|
4123
|
+
// resolve varName directly to that variable
|
|
4124
|
+
if (
|
|
4125
|
+
returnSource &&
|
|
4126
|
+
!returnSource.includes('(') &&
|
|
4127
|
+
!returnSource.includes('[')
|
|
4128
|
+
) {
|
|
4129
|
+
// Update varName to point to the return source
|
|
4130
|
+
if (equivalentSignatureVariables[varName] !== returnSource) {
|
|
4131
|
+
equivalentSignatureVariables[varName] = returnSource;
|
|
4132
|
+
changed = true;
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
|
|
4139
|
+
continue;
|
|
4140
|
+
}
|
|
4141
|
+
|
|
4142
|
+
// Check if the source path starts with a variable that's also in the map
|
|
4143
|
+
const dotIndex = sourcePath.indexOf('.');
|
|
4144
|
+
let baseVar: string;
|
|
4145
|
+
let rest: string;
|
|
4146
|
+
|
|
4147
|
+
if (dotIndex > 0) {
|
|
4148
|
+
// Path has a dot: "a.b.c" -> baseVar="a", rest=".b.c"
|
|
4149
|
+
baseVar = sourcePath.slice(0, dotIndex);
|
|
4150
|
+
rest = sourcePath.slice(dotIndex); // includes the leading dot
|
|
4151
|
+
} else {
|
|
4152
|
+
// Path is a simple identifier: "currentEntityAnalysis" -> baseVar="currentEntityAnalysis", rest=""
|
|
4153
|
+
baseVar = sourcePath;
|
|
4154
|
+
rest = '';
|
|
4155
|
+
}
|
|
4156
|
+
|
|
4157
|
+
if (baseVar in equivalentSignatureVariables && baseVar !== varName) {
|
|
4158
|
+
const baseResolved = equivalentSignatureVariables[baseVar];
|
|
4159
|
+
// If the base resolves to a hook call, add .functionCallReturnValue
|
|
4160
|
+
if (baseResolved.endsWith('()')) {
|
|
4161
|
+
const newPath = baseResolved + '.functionCallReturnValue' + rest;
|
|
4162
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
4163
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
4164
|
+
changed = true;
|
|
4165
|
+
}
|
|
4166
|
+
} else if (baseResolved !== sourcePath) {
|
|
4167
|
+
const newPath = baseResolved + rest;
|
|
4168
|
+
if (newPath !== equivalentSignatureVariables[varName]) {
|
|
4169
|
+
equivalentSignatureVariables[varName] = newPath;
|
|
4170
|
+
changed = true;
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
|
|
4176
|
+
// Stop if no changes were made in this iteration
|
|
4177
|
+
if (!changed) break;
|
|
4178
|
+
}
|
|
4179
|
+
|
|
3631
4180
|
return equivalentSignatureVariables;
|
|
3632
4181
|
}
|
|
3633
4182
|
|
|
@@ -3851,29 +4400,145 @@ export class ScopeDataStructure {
|
|
|
3851
4400
|
}
|
|
3852
4401
|
|
|
3853
4402
|
/**
|
|
3854
|
-
*
|
|
3855
|
-
*
|
|
4403
|
+
* Add conditional effects from AST analysis.
|
|
4404
|
+
* Called during scope analysis to collect all setter calls inside conditionals.
|
|
4405
|
+
*/
|
|
4406
|
+
addConditionalEffects(
|
|
4407
|
+
effects: import('../astScopes/types').ConditionalEffect[],
|
|
4408
|
+
): void {
|
|
4409
|
+
// Add effects, avoiding duplicates based on effect stateVariable and condition paths
|
|
4410
|
+
for (const effect of effects) {
|
|
4411
|
+
const exists = this.rawConditionalEffects.some((existing) => {
|
|
4412
|
+
// Same effect target (stateVariable + value)
|
|
4413
|
+
const sameEffect =
|
|
4414
|
+
existing.effect.stateVariable === effect.effect.stateVariable &&
|
|
4415
|
+
existing.effect.value === effect.effect.value;
|
|
4416
|
+
if (!sameEffect) return false;
|
|
4417
|
+
|
|
4418
|
+
// Same condition(s)
|
|
4419
|
+
if (existing.condition && effect.condition) {
|
|
4420
|
+
return (
|
|
4421
|
+
existing.condition.path === effect.condition.path &&
|
|
4422
|
+
existing.condition.requiredValue === effect.condition.requiredValue
|
|
4423
|
+
);
|
|
4424
|
+
}
|
|
4425
|
+
if (existing.conditions && effect.conditions) {
|
|
4426
|
+
if (existing.conditions.length !== effect.conditions.length)
|
|
4427
|
+
return false;
|
|
4428
|
+
return existing.conditions.every((ec, i) => {
|
|
4429
|
+
const newCond = effect.conditions![i];
|
|
4430
|
+
return (
|
|
4431
|
+
ec.path === newCond.path &&
|
|
4432
|
+
ec.requiredValue === newCond.requiredValue
|
|
4433
|
+
);
|
|
4434
|
+
});
|
|
4435
|
+
}
|
|
4436
|
+
return false;
|
|
4437
|
+
});
|
|
4438
|
+
if (!exists) {
|
|
4439
|
+
this.rawConditionalEffects.push(effect);
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
|
|
4444
|
+
/**
|
|
4445
|
+
* Get conditional effects collected during analysis.
|
|
4446
|
+
*/
|
|
4447
|
+
getConditionalEffects(): import('../astScopes/types').ConditionalEffect[] {
|
|
4448
|
+
return this.rawConditionalEffects;
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
/**
|
|
4452
|
+
* Add compound conditionals from AST analysis.
|
|
4453
|
+
* Called during scope analysis to collect grouped conditions (e.g., a && b && c).
|
|
4454
|
+
*/
|
|
4455
|
+
addCompoundConditionals(
|
|
4456
|
+
compounds: import('../astScopes/types').CompoundConditional[],
|
|
4457
|
+
): void {
|
|
4458
|
+
// Add compounds, avoiding duplicates based on chainId
|
|
4459
|
+
for (const compound of compounds) {
|
|
4460
|
+
const exists = this.rawCompoundConditionals.some(
|
|
4461
|
+
(existing) => existing.chainId === compound.chainId,
|
|
4462
|
+
);
|
|
4463
|
+
if (!exists) {
|
|
4464
|
+
this.rawCompoundConditionals.push(compound);
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
}
|
|
4468
|
+
|
|
4469
|
+
/**
|
|
4470
|
+
* Get compound conditionals collected during analysis.
|
|
3856
4471
|
*/
|
|
3857
|
-
|
|
4472
|
+
getCompoundConditionals(): import('../astScopes/types').CompoundConditional[] {
|
|
4473
|
+
return this.rawCompoundConditionals;
|
|
4474
|
+
}
|
|
4475
|
+
|
|
4476
|
+
/**
|
|
4477
|
+
* Add child boundary gating conditions from AST analysis.
|
|
4478
|
+
* These track which conditions must be true for a child component to render.
|
|
4479
|
+
*/
|
|
4480
|
+
addChildBoundaryGatingConditions(
|
|
4481
|
+
conditions: Record<string, import('../astScopes/types').ConditionalUsage[]>,
|
|
4482
|
+
): void {
|
|
4483
|
+
for (const [childName, usages] of Object.entries(conditions)) {
|
|
4484
|
+
if (!this.rawChildBoundaryGatingConditions[childName]) {
|
|
4485
|
+
this.rawChildBoundaryGatingConditions[childName] = [];
|
|
4486
|
+
}
|
|
4487
|
+
// Add usages, avoiding duplicates
|
|
4488
|
+
for (const usage of usages) {
|
|
4489
|
+
const exists = this.rawChildBoundaryGatingConditions[childName].some(
|
|
4490
|
+
(existing) =>
|
|
4491
|
+
existing.path === usage.path &&
|
|
4492
|
+
existing.conditionType === usage.conditionType &&
|
|
4493
|
+
existing.isNegated === usage.isNegated,
|
|
4494
|
+
);
|
|
4495
|
+
if (!exists) {
|
|
4496
|
+
this.rawChildBoundaryGatingConditions[childName].push(usage);
|
|
4497
|
+
}
|
|
4498
|
+
}
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4502
|
+
/**
|
|
4503
|
+
* Get enriched child boundary gating conditions with source tracing.
|
|
4504
|
+
* Similar to getEnrichedConditionalUsages but for gating conditions.
|
|
4505
|
+
*/
|
|
4506
|
+
getEnrichedChildBoundaryGatingConditions(): Record<
|
|
3858
4507
|
string,
|
|
3859
|
-
|
|
3860
|
-
path: string;
|
|
3861
|
-
conditionType: 'truthiness' | 'comparison' | 'switch';
|
|
3862
|
-
comparedValues?: string[];
|
|
3863
|
-
location: 'if' | 'ternary' | 'logical-and' | 'switch';
|
|
3864
|
-
sourceDataPath?: string;
|
|
3865
|
-
}>
|
|
4508
|
+
EnrichedConditionalUsage[]
|
|
3866
4509
|
> {
|
|
3867
|
-
const enriched: Record<
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
4510
|
+
const enriched: Record<string, EnrichedConditionalUsage[]> = {};
|
|
4511
|
+
const rootScopeName = this.scopeTreeManager.getTree().name;
|
|
4512
|
+
|
|
4513
|
+
for (const [childName, usages] of Object.entries(
|
|
4514
|
+
this.rawChildBoundaryGatingConditions,
|
|
4515
|
+
)) {
|
|
4516
|
+
enriched[childName] = usages.map((usage) => {
|
|
4517
|
+
// Try to trace this path back to a data source
|
|
4518
|
+
const explanation = this.explainPath(rootScopeName, usage.path);
|
|
4519
|
+
|
|
4520
|
+
let sourceDataPath: string | undefined;
|
|
4521
|
+
if (explanation.source) {
|
|
4522
|
+
sourceDataPath = `${explanation.source.scope}.${explanation.source.path}`;
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
return {
|
|
4526
|
+
...usage,
|
|
4527
|
+
sourceDataPath,
|
|
4528
|
+
};
|
|
4529
|
+
});
|
|
4530
|
+
}
|
|
4531
|
+
|
|
4532
|
+
return enriched;
|
|
4533
|
+
}
|
|
4534
|
+
|
|
4535
|
+
/**
|
|
4536
|
+
* Get enriched conditional usages with source tracing.
|
|
4537
|
+
* Uses explainPath to trace each local variable back to its data source.
|
|
4538
|
+
* Preserves all fields from the raw conditional usages including derivedFrom.
|
|
4539
|
+
*/
|
|
4540
|
+
getEnrichedConditionalUsages(): Record<string, EnrichedConditionalUsage[]> {
|
|
4541
|
+
const enriched: Record<string, EnrichedConditionalUsage[]> = {};
|
|
3877
4542
|
|
|
3878
4543
|
for (const [path, usages] of Object.entries(this.rawConditionalUsages)) {
|
|
3879
4544
|
// Try to trace this path back to a data source
|
|
@@ -3896,10 +4561,37 @@ export class ScopeDataStructure {
|
|
|
3896
4561
|
return enriched;
|
|
3897
4562
|
}
|
|
3898
4563
|
|
|
4564
|
+
/**
|
|
4565
|
+
* Add JSX rendering usages from AST analysis.
|
|
4566
|
+
* These track arrays rendered via .map() and strings interpolated in JSX.
|
|
4567
|
+
*/
|
|
4568
|
+
addJsxRenderingUsages(
|
|
4569
|
+
usages: import('../astScopes/types').JsxRenderingUsage[],
|
|
4570
|
+
): void {
|
|
4571
|
+
// Add usages, avoiding duplicates based on path and renderingType
|
|
4572
|
+
for (const usage of usages) {
|
|
4573
|
+
const exists = this.rawJsxRenderingUsages.some(
|
|
4574
|
+
(existing) =>
|
|
4575
|
+
existing.path === usage.path &&
|
|
4576
|
+
existing.renderingType === usage.renderingType,
|
|
4577
|
+
);
|
|
4578
|
+
if (!exists) {
|
|
4579
|
+
this.rawJsxRenderingUsages.push(usage);
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4583
|
+
|
|
4584
|
+
/**
|
|
4585
|
+
* Get JSX rendering usages collected during analysis.
|
|
4586
|
+
*/
|
|
4587
|
+
getJsxRenderingUsages(): import('../astScopes/types').JsxRenderingUsage[] {
|
|
4588
|
+
return this.rawJsxRenderingUsages;
|
|
4589
|
+
}
|
|
4590
|
+
|
|
3899
4591
|
toSerializable(): SerializableDataStructure {
|
|
3900
|
-
// Helper to clean cyScope from a string
|
|
4592
|
+
// Helper to clean cyScope and cyDuplicateKey from a string for output
|
|
3901
4593
|
const cleanCyScope = (str: string): string =>
|
|
3902
|
-
this.replaceCyScopeInString(str);
|
|
4594
|
+
this.replaceCyScopeInString(str).replace(/::cyDuplicateKey\d+::/g, '');
|
|
3903
4595
|
|
|
3904
4596
|
// Helper to convert ScopeVariable to SerializableScopeVariable (with cyScope cleaned)
|
|
3905
4597
|
const toSerializableVariable = (
|
|
@@ -4049,6 +4741,16 @@ export class ScopeDataStructure {
|
|
|
4049
4741
|
if (Object.keys(perVariableSchemas).length < numReceivingVars) {
|
|
4050
4742
|
// Not all variables have schemas - fall back to rootSchema extraction
|
|
4051
4743
|
perVariableSchemas = undefined;
|
|
4744
|
+
} else {
|
|
4745
|
+
// Also check that at least one schema is non-empty
|
|
4746
|
+
// Bug fix: perCallSignatureSchemas may have entries but with empty schemas {}
|
|
4747
|
+
// In this case, we should fall through to Fallback which uses rootSchema
|
|
4748
|
+
const hasNonEmptySchema = Object.values(perVariableSchemas).some(
|
|
4749
|
+
(schema) => Object.keys(schema).length > 0,
|
|
4750
|
+
);
|
|
4751
|
+
if (!hasNonEmptySchema) {
|
|
4752
|
+
perVariableSchemas = undefined;
|
|
4753
|
+
}
|
|
4052
4754
|
}
|
|
4053
4755
|
}
|
|
4054
4756
|
|
|
@@ -4068,7 +4770,11 @@ export class ScopeDataStructure {
|
|
|
4068
4770
|
}
|
|
4069
4771
|
}
|
|
4070
4772
|
|
|
4071
|
-
// CASE 3:
|
|
4773
|
+
// CASE 3: Extract from efc.schema when perCallSignatureSchemas is missing or empty
|
|
4774
|
+
// This handles two scenarios:
|
|
4775
|
+
// 1. Parameterized calls that create SEPARATE efc entries (no perCallSignatureSchemas)
|
|
4776
|
+
// 2. Destructuring where perCallSignatureSchemas exists but has EMPTY schemas
|
|
4777
|
+
//
|
|
4072
4778
|
// When useFetcher<ConfigData>() and useFetcher<SettingsData>() are called, they create separate
|
|
4073
4779
|
// efc entries because getFunctionCallRoot preserves type parameters. Each entry has its own
|
|
4074
4780
|
// `schema` field, but due to variable reassignment, the schema may be contaminated with paths
|
|
@@ -4084,14 +4790,39 @@ export class ScopeDataStructure {
|
|
|
4084
4790
|
//
|
|
4085
4791
|
// We filter to only keep paths that should belong to THIS call by checking if the
|
|
4086
4792
|
// receiving variable's equivalency points to this call's return value.
|
|
4793
|
+
//
|
|
4794
|
+
// BUG FIX: The old condition `!efc.perCallSignatureSchemas` was FALSE when the object
|
|
4795
|
+
// existed (even with empty schemas), causing this case to be skipped. We now also check
|
|
4796
|
+
// if all schemas in perCallSignatureSchemas are empty.
|
|
4797
|
+
const hasNonEmptyPerCallSignatureSchemas =
|
|
4798
|
+
efc.perCallSignatureSchemas &&
|
|
4799
|
+
Object.values(efc.perCallSignatureSchemas).some(
|
|
4800
|
+
(schema) => Object.keys(schema).length > 0,
|
|
4801
|
+
);
|
|
4802
|
+
|
|
4803
|
+
// Build the call signature prefix that paths should start with
|
|
4804
|
+
const callSigPrefix = `${efc.callSignature}.functionCallReturnValue`;
|
|
4805
|
+
|
|
4806
|
+
// Check if efc.schema has variable-specific paths (indicating destructuring).
|
|
4807
|
+
// Destructuring: const { entities, gitStatus } = useLoaderData()
|
|
4808
|
+
// - efc.schema has paths like: useLoaderData().functionCallReturnValue.entities...
|
|
4809
|
+
// Multiple calls: const x = useFetcher(); const y = useFetcher();
|
|
4810
|
+
// - efc.schema has paths like: useFetcher().functionCallReturnValue.data...
|
|
4811
|
+
// CASE 3 should only run for destructuring (variable-specific paths exist).
|
|
4812
|
+
const hasVariableSpecificPaths = (
|
|
4813
|
+
efc.receivingVariableNames ?? []
|
|
4814
|
+
).some((varName) =>
|
|
4815
|
+
Object.keys(efc.schema).some((path) =>
|
|
4816
|
+
path.startsWith(`${callSigPrefix}.${varName}`),
|
|
4817
|
+
),
|
|
4818
|
+
);
|
|
4819
|
+
|
|
4087
4820
|
if (
|
|
4088
4821
|
!perVariableSchemas &&
|
|
4089
|
-
!
|
|
4090
|
-
numReceivingVars >= 1
|
|
4822
|
+
!hasNonEmptyPerCallSignatureSchemas &&
|
|
4823
|
+
numReceivingVars >= 1 &&
|
|
4824
|
+
hasVariableSpecificPaths
|
|
4091
4825
|
) {
|
|
4092
|
-
// Build the call signature prefix that paths should start with
|
|
4093
|
-
const callSigPrefix = `${efc.callSignature}.functionCallReturnValue`;
|
|
4094
|
-
|
|
4095
4826
|
// Filter efc.schema to only include paths matching this call signature
|
|
4096
4827
|
const filteredSchema: Record<string, string> = {};
|
|
4097
4828
|
for (const [path, type] of Object.entries(efc.schema)) {
|
|
@@ -4101,16 +4832,18 @@ export class ScopeDataStructure {
|
|
|
4101
4832
|
}
|
|
4102
4833
|
|
|
4103
4834
|
// Build perVariableSchemas from the filtered schema
|
|
4835
|
+
// For destructuring, filter paths by variable name
|
|
4104
4836
|
if (Object.keys(filteredSchema).length > 0) {
|
|
4105
4837
|
perVariableSchemas = {};
|
|
4106
4838
|
for (const varName of efc.receivingVariableNames ?? []) {
|
|
4107
|
-
// For
|
|
4839
|
+
// For destructuring, extract only paths specific to this variable
|
|
4840
|
+
const varSpecificPrefix = `${callSigPrefix}.${varName}`;
|
|
4108
4841
|
const varSchema: Record<string, string> = {};
|
|
4842
|
+
|
|
4109
4843
|
for (const [path, type] of Object.entries(filteredSchema)) {
|
|
4110
|
-
if (path.startsWith(
|
|
4111
|
-
// Transform
|
|
4112
|
-
//
|
|
4113
|
-
// -> "functionCallReturnValue.data.data.theme"
|
|
4844
|
+
if (path.startsWith(varSpecificPrefix)) {
|
|
4845
|
+
// Transform: useLoaderData().functionCallReturnValue.entities.sha
|
|
4846
|
+
// -> functionCallReturnValue.entities.sha (keep the variable name)
|
|
4114
4847
|
const suffix = path.slice(callSigPrefix.length);
|
|
4115
4848
|
const returnValuePath = `functionCallReturnValue${suffix}`;
|
|
4116
4849
|
varSchema[returnValuePath] = type;
|
|
@@ -4156,7 +4889,8 @@ export class ScopeDataStructure {
|
|
|
4156
4889
|
}
|
|
4157
4890
|
}
|
|
4158
4891
|
if (Object.keys(varSchema).length > 0) {
|
|
4159
|
-
|
|
4892
|
+
// Clean the variable name when using as key in output
|
|
4893
|
+
perVariableSchemas[cleanCyScope(varName)] = varSchema;
|
|
4160
4894
|
}
|
|
4161
4895
|
}
|
|
4162
4896
|
// Only include if we have any entries
|
|
@@ -4181,8 +4915,15 @@ export class ScopeDataStructure {
|
|
|
4181
4915
|
)
|
|
4182
4916
|
: undefined,
|
|
4183
4917
|
allCallSignatures: efc.allCallSignatures,
|
|
4184
|
-
receivingVariableNames: efc.receivingVariableNames,
|
|
4185
|
-
callSignatureToVariable: efc.callSignatureToVariable
|
|
4918
|
+
receivingVariableNames: efc.receivingVariableNames?.map(cleanCyScope),
|
|
4919
|
+
callSignatureToVariable: efc.callSignatureToVariable
|
|
4920
|
+
? Object.fromEntries(
|
|
4921
|
+
Object.entries(efc.callSignatureToVariable).map(([k, v]) => [
|
|
4922
|
+
k,
|
|
4923
|
+
cleanCyScope(v),
|
|
4924
|
+
]),
|
|
4925
|
+
)
|
|
4926
|
+
: undefined,
|
|
4186
4927
|
perVariableSchemas,
|
|
4187
4928
|
};
|
|
4188
4929
|
});
|
|
@@ -4302,6 +5043,13 @@ export class ScopeDataStructure {
|
|
|
4302
5043
|
externalFunctionCalls,
|
|
4303
5044
|
);
|
|
4304
5045
|
|
|
5046
|
+
// IMPORTANT: Get equivalent signature variables BEFORE calling getFunctionResult
|
|
5047
|
+
// because getFunctionResult calls validateSchema which may remove equivalencies
|
|
5048
|
+
// during the finalize step (e.g., cleanNonObjectFunctions removes method call
|
|
5049
|
+
// equivalencies like `segments -> splat.split('/').functionCallReturnValue`).
|
|
5050
|
+
// Fix 33: Move this call before any schema validation to preserve method call chains.
|
|
5051
|
+
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
5052
|
+
|
|
4305
5053
|
// Get root function result
|
|
4306
5054
|
const rootFunction = getFunctionResult();
|
|
4307
5055
|
|
|
@@ -4311,9 +5059,6 @@ export class ScopeDataStructure {
|
|
|
4311
5059
|
functionResults[efc.name] = getFunctionResult(efc.name);
|
|
4312
5060
|
}
|
|
4313
5061
|
|
|
4314
|
-
// Get equivalent signature variables
|
|
4315
|
-
const equivalentSignatureVariables = this.getEquivalentSignatureVariables();
|
|
4316
|
-
|
|
4317
5062
|
const environmentVariables = this.getEnvironmentVariables();
|
|
4318
5063
|
|
|
4319
5064
|
// Get enriched conditional usages with source tracing
|
|
@@ -4323,6 +5068,32 @@ export class ScopeDataStructure {
|
|
|
4323
5068
|
? enrichedConditionalUsages
|
|
4324
5069
|
: undefined;
|
|
4325
5070
|
|
|
5071
|
+
// Get conditional effects (setter calls inside conditionals)
|
|
5072
|
+
const conditionalEffects =
|
|
5073
|
+
this.rawConditionalEffects.length > 0
|
|
5074
|
+
? this.rawConditionalEffects
|
|
5075
|
+
: undefined;
|
|
5076
|
+
|
|
5077
|
+
// Get compound conditionals (grouped conditions that must all be true)
|
|
5078
|
+
const compoundConditionals =
|
|
5079
|
+
this.rawCompoundConditionals.length > 0
|
|
5080
|
+
? this.rawCompoundConditionals
|
|
5081
|
+
: undefined;
|
|
5082
|
+
|
|
5083
|
+
// Get child boundary gating conditions
|
|
5084
|
+
const enrichedGatingConditions =
|
|
5085
|
+
this.getEnrichedChildBoundaryGatingConditions();
|
|
5086
|
+
const childBoundaryGatingConditions =
|
|
5087
|
+
Object.keys(enrichedGatingConditions).length > 0
|
|
5088
|
+
? enrichedGatingConditions
|
|
5089
|
+
: undefined;
|
|
5090
|
+
|
|
5091
|
+
// Get JSX rendering usages (arrays via .map(), strings via interpolation)
|
|
5092
|
+
const jsxRenderingUsages =
|
|
5093
|
+
this.rawJsxRenderingUsages.length > 0
|
|
5094
|
+
? this.rawJsxRenderingUsages
|
|
5095
|
+
: undefined;
|
|
5096
|
+
|
|
4326
5097
|
return {
|
|
4327
5098
|
externalFunctionCalls: deduplicatedExternalFunctionCalls,
|
|
4328
5099
|
rootFunction,
|
|
@@ -4330,6 +5101,10 @@ export class ScopeDataStructure {
|
|
|
4330
5101
|
equivalentSignatureVariables,
|
|
4331
5102
|
environmentVariables,
|
|
4332
5103
|
conditionalUsages,
|
|
5104
|
+
conditionalEffects,
|
|
5105
|
+
compoundConditionals,
|
|
5106
|
+
childBoundaryGatingConditions,
|
|
5107
|
+
jsxRenderingUsages,
|
|
4333
5108
|
};
|
|
4334
5109
|
}
|
|
4335
5110
|
|