@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
|
@@ -19,6 +19,160 @@ import {
|
|
|
19
19
|
unwrapExpression,
|
|
20
20
|
} from './sharedPatterns';
|
|
21
21
|
import { processBindingPattern } from './processBindings';
|
|
22
|
+
import {
|
|
23
|
+
extractConditionalEffectsFromTernary,
|
|
24
|
+
findUseStateSetters,
|
|
25
|
+
} from './conditionalEffectsExtractor';
|
|
26
|
+
import { detectArrayDerivedPattern } from './arrayDerivationDetector';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Extracts the component name from a JSX element.
|
|
30
|
+
* Returns null for intrinsic elements (div, span, etc.) since we only care about
|
|
31
|
+
* custom components for gating condition tracking.
|
|
32
|
+
*
|
|
33
|
+
* Examples:
|
|
34
|
+
* - <ChildViewer /> → "ChildViewer"
|
|
35
|
+
* - <ScenarioViewer scenario={...} /> → "ScenarioViewer"
|
|
36
|
+
* - <div> → null (intrinsic element)
|
|
37
|
+
*/
|
|
38
|
+
function getComponentNameFromJsx(
|
|
39
|
+
node: ts.JsxElement | ts.JsxSelfClosingElement,
|
|
40
|
+
): string | null {
|
|
41
|
+
let tagName: ts.JsxTagNameExpression;
|
|
42
|
+
|
|
43
|
+
if (ts.isJsxElement(node)) {
|
|
44
|
+
tagName = node.openingElement.tagName;
|
|
45
|
+
} else {
|
|
46
|
+
tagName = node.tagName;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Get the text of the tag name
|
|
50
|
+
const name = tagName.getText();
|
|
51
|
+
|
|
52
|
+
// Check if it's a custom component (starts with uppercase) vs intrinsic element
|
|
53
|
+
// Custom components start with uppercase: <MyComponent />
|
|
54
|
+
// Intrinsic elements start with lowercase: <div />
|
|
55
|
+
if (
|
|
56
|
+
name &&
|
|
57
|
+
name[0] === name[0].toUpperCase() &&
|
|
58
|
+
name[0] !== name[0].toLowerCase()
|
|
59
|
+
) {
|
|
60
|
+
return name;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Extracts condition paths from a logical AND chain expression.
|
|
68
|
+
* Used for creating gating conditions for child components.
|
|
69
|
+
*
|
|
70
|
+
* Example: `hasData && isReady && <Component />` returns ['hasData', 'isReady']
|
|
71
|
+
*/
|
|
72
|
+
function extractConditionPathsFromAndChain(
|
|
73
|
+
expr: ts.Expression,
|
|
74
|
+
sourceFile: ts.SourceFile,
|
|
75
|
+
): string[] {
|
|
76
|
+
const paths: string[] = [];
|
|
77
|
+
const unwrapped = unwrapExpression(expr);
|
|
78
|
+
|
|
79
|
+
if (
|
|
80
|
+
ts.isBinaryExpression(unwrapped) &&
|
|
81
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
|
|
82
|
+
) {
|
|
83
|
+
// Recursively get conditions from left side
|
|
84
|
+
paths.push(
|
|
85
|
+
...extractConditionPathsFromAndChain(unwrapped.left, sourceFile),
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Process right side if it's not JSX (JSX is the consequence, not a condition)
|
|
89
|
+
const rightUnwrapped = unwrapExpression(unwrapped.right);
|
|
90
|
+
if (
|
|
91
|
+
!ts.isJsxElement(rightUnwrapped) &&
|
|
92
|
+
!ts.isJsxSelfClosingElement(rightUnwrapped) &&
|
|
93
|
+
!ts.isJsxFragment(rightUnwrapped)
|
|
94
|
+
) {
|
|
95
|
+
paths.push(
|
|
96
|
+
...extractConditionPathsFromAndChain(unwrapped.right, sourceFile),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
// Base case: extract path from this expression
|
|
101
|
+
const path = StructuredPath.fromNode(unwrapped, sourceFile);
|
|
102
|
+
if (path) {
|
|
103
|
+
paths.push(path.toString());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return paths;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Finds the rightmost JSX element in an && chain.
|
|
112
|
+
* Example: `a && b && <Component />` returns <Component />
|
|
113
|
+
*/
|
|
114
|
+
function findJsxInAndChain(
|
|
115
|
+
expr: ts.Expression,
|
|
116
|
+
): ts.JsxElement | ts.JsxSelfClosingElement | null {
|
|
117
|
+
const unwrapped = unwrapExpression(expr);
|
|
118
|
+
|
|
119
|
+
if (ts.isJsxElement(unwrapped) || ts.isJsxSelfClosingElement(unwrapped)) {
|
|
120
|
+
return unwrapped;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (
|
|
124
|
+
ts.isBinaryExpression(unwrapped) &&
|
|
125
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
|
|
126
|
+
) {
|
|
127
|
+
// Check right side first (most common case: condition && <Jsx />)
|
|
128
|
+
const rightResult = findJsxInAndChain(unwrapped.right);
|
|
129
|
+
if (rightResult) return rightResult;
|
|
130
|
+
|
|
131
|
+
// Also check left side for rare cases
|
|
132
|
+
return findJsxInAndChain(unwrapped.left);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Fix 32: Finds a JSX fragment in an && chain.
|
|
140
|
+
* Example: `activeTab && <><ChildA /><ChildB /></>` returns the fragment
|
|
141
|
+
* This is needed to propagate parent conditions through fragments.
|
|
142
|
+
*/
|
|
143
|
+
function findJsxFragmentInAndChain(expr: ts.Expression): ts.JsxFragment | null {
|
|
144
|
+
const unwrapped = unwrapExpression(expr);
|
|
145
|
+
|
|
146
|
+
if (ts.isJsxFragment(unwrapped)) {
|
|
147
|
+
return unwrapped;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (
|
|
151
|
+
ts.isBinaryExpression(unwrapped) &&
|
|
152
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
|
|
153
|
+
) {
|
|
154
|
+
// Check right side first (most common case: condition && <></>)
|
|
155
|
+
const rightResult = findJsxFragmentInAndChain(unwrapped.right);
|
|
156
|
+
if (rightResult) return rightResult;
|
|
157
|
+
|
|
158
|
+
// Also check left side for rare cases
|
|
159
|
+
return findJsxFragmentInAndChain(unwrapped.left);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Detects if a property access looks like an environment variable store access.
|
|
167
|
+
* Matches patterns like `env.DATABASE_URL`, `env.IS_FORMBRICKS_CLOUD`, etc.
|
|
168
|
+
* where the object is named "env" and the property looks like an env var name.
|
|
169
|
+
*/
|
|
170
|
+
function isEnvStoreAccess(fullText: string): boolean {
|
|
171
|
+
// Match: env.SOME_VAR or env.someVar (but object must be exactly "env")
|
|
172
|
+
// This catches patterns from @t3-oss/env-nextjs and similar packages
|
|
173
|
+
const envStorePattern = /^env\.[A-Z_][A-Z0-9_]*$/;
|
|
174
|
+
return envStorePattern.test(fullText);
|
|
175
|
+
}
|
|
22
176
|
|
|
23
177
|
/**
|
|
24
178
|
* Converts a call expression argument to a StructuredPath.
|
|
@@ -215,6 +369,149 @@ function getSourceLocation(
|
|
|
215
369
|
};
|
|
216
370
|
}
|
|
217
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Extracts the root array path from an expression that ends with .map().
|
|
374
|
+
* Handles chained methods like .filter().map(), .slice().map(), etc.
|
|
375
|
+
*
|
|
376
|
+
* Examples:
|
|
377
|
+
* - items.map(...) → "items"
|
|
378
|
+
* - data.users.map(...) → "data.users"
|
|
379
|
+
* - items.filter(...).map(...) → "items"
|
|
380
|
+
* - items.slice(0, 5).map(...) → "items"
|
|
381
|
+
*/
|
|
382
|
+
function extractArrayPathFromMapCall(
|
|
383
|
+
expr: ts.CallExpression,
|
|
384
|
+
sourceFile: ts.SourceFile,
|
|
385
|
+
): string | null {
|
|
386
|
+
// Walk up the chain to find the root array
|
|
387
|
+
let current: ts.Expression = expr.expression;
|
|
388
|
+
|
|
389
|
+
while (ts.isPropertyAccessExpression(current)) {
|
|
390
|
+
const methodName = current.name.getText(sourceFile);
|
|
391
|
+
|
|
392
|
+
// Common array methods that return arrays (so we keep going up)
|
|
393
|
+
const arrayReturningMethods = [
|
|
394
|
+
'map',
|
|
395
|
+
'filter',
|
|
396
|
+
'slice',
|
|
397
|
+
'concat',
|
|
398
|
+
'flat',
|
|
399
|
+
'flatMap',
|
|
400
|
+
'reverse',
|
|
401
|
+
'sort',
|
|
402
|
+
'toReversed',
|
|
403
|
+
'toSorted',
|
|
404
|
+
'toSpliced',
|
|
405
|
+
];
|
|
406
|
+
|
|
407
|
+
if (arrayReturningMethods.includes(methodName)) {
|
|
408
|
+
const objectExpr = current.expression;
|
|
409
|
+
|
|
410
|
+
// If the object is a call expression (chained method), keep going
|
|
411
|
+
if (ts.isCallExpression(objectExpr)) {
|
|
412
|
+
current = objectExpr.expression;
|
|
413
|
+
} else {
|
|
414
|
+
// Found the root - it's an identifier or property access
|
|
415
|
+
const path = StructuredPath.fromNode(objectExpr, sourceFile);
|
|
416
|
+
return path ? path.toString() : null;
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
419
|
+
// Not an array method we recognize
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Extracts JSX rendering usages from a JSX expression.
|
|
429
|
+
* Detects:
|
|
430
|
+
* - array.map() calls → 'array-map' type
|
|
431
|
+
* - string interpolations (identifiers/property access) → 'text-interpolation' type
|
|
432
|
+
*
|
|
433
|
+
* Recursively searches inside && chains and ternary expressions.
|
|
434
|
+
*
|
|
435
|
+
* @param expr The expression inside {expr}
|
|
436
|
+
* @param context The analysis context
|
|
437
|
+
*/
|
|
438
|
+
function extractJsxRenderingUsage(
|
|
439
|
+
expr: ts.Expression,
|
|
440
|
+
context: AnalysisContext,
|
|
441
|
+
): void {
|
|
442
|
+
const unwrapped = unwrapExpression(expr);
|
|
443
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
444
|
+
|
|
445
|
+
// Detect array.map() calls
|
|
446
|
+
if (ts.isCallExpression(unwrapped)) {
|
|
447
|
+
const calleeExpr = unwrapped.expression;
|
|
448
|
+
|
|
449
|
+
if (ts.isPropertyAccessExpression(calleeExpr)) {
|
|
450
|
+
const methodName = calleeExpr.name.getText(context.sourceFile);
|
|
451
|
+
|
|
452
|
+
if (methodName === 'map') {
|
|
453
|
+
const arrayPath = extractArrayPathFromMapCall(
|
|
454
|
+
unwrapped,
|
|
455
|
+
context.sourceFile,
|
|
456
|
+
);
|
|
457
|
+
|
|
458
|
+
if (arrayPath) {
|
|
459
|
+
context.addJsxRenderingUsage({
|
|
460
|
+
path: arrayPath,
|
|
461
|
+
renderingType: 'array-map',
|
|
462
|
+
valueType: 'array',
|
|
463
|
+
sourceLocation,
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
// Detect simple string interpolations: {title} or {user.name}
|
|
470
|
+
else if (
|
|
471
|
+
ts.isIdentifier(unwrapped) ||
|
|
472
|
+
ts.isPropertyAccessExpression(unwrapped)
|
|
473
|
+
) {
|
|
474
|
+
const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
|
|
475
|
+
|
|
476
|
+
if (path) {
|
|
477
|
+
const pathStr = path.toString();
|
|
478
|
+
const typeInfo = context.getTypeInfo(path);
|
|
479
|
+
|
|
480
|
+
// Only track as text interpolation if it's a string type
|
|
481
|
+
// Check for 'string' type, or types that contain 'string' (but not 'string[]')
|
|
482
|
+
if (
|
|
483
|
+
typeInfo === 'string' ||
|
|
484
|
+
(typeInfo &&
|
|
485
|
+
typeInfo.includes('string') &&
|
|
486
|
+
!typeInfo.includes('string[]'))
|
|
487
|
+
) {
|
|
488
|
+
context.addJsxRenderingUsage({
|
|
489
|
+
path: pathStr,
|
|
490
|
+
renderingType: 'text-interpolation',
|
|
491
|
+
valueType: 'string',
|
|
492
|
+
sourceLocation,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// Recursively search inside && chains: {showList && items.map(...)}
|
|
498
|
+
else if (
|
|
499
|
+
ts.isBinaryExpression(unwrapped) &&
|
|
500
|
+
unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
|
|
501
|
+
) {
|
|
502
|
+
// Check the right side of the && chain (where .map() typically appears)
|
|
503
|
+
const rightSide = unwrapExpression(unwrapped.right);
|
|
504
|
+
extractJsxRenderingUsage(rightSide, context);
|
|
505
|
+
// Also check nested && chains on the left
|
|
506
|
+
extractJsxRenderingUsage(unwrapped.left, context);
|
|
507
|
+
}
|
|
508
|
+
// Recursively search inside ternaries: {isEmpty ? null : items.map(...)}
|
|
509
|
+
else if (ts.isConditionalExpression(unwrapped)) {
|
|
510
|
+
extractJsxRenderingUsage(unwrapped.whenTrue, context);
|
|
511
|
+
extractJsxRenderingUsage(unwrapped.whenFalse, context);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
218
515
|
/**
|
|
219
516
|
* Counts the number of conditions in an && chain (excluding JSX consequence)
|
|
220
517
|
*/
|
|
@@ -251,6 +548,430 @@ interface ChainInfo {
|
|
|
251
548
|
chainExpression: string;
|
|
252
549
|
currentPosition: number;
|
|
253
550
|
compound: CompoundConditional;
|
|
551
|
+
/**
|
|
552
|
+
* When processing OR expressions within an && chain, this tracks the
|
|
553
|
+
* current OR group ID. Conditions added while this is set will be marked
|
|
554
|
+
* as OR alternatives (only one needs to be true).
|
|
555
|
+
*/
|
|
556
|
+
currentOrGroupId?: string;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Parent gating condition accumulated during JSX traversal.
|
|
561
|
+
* Used to track conditions from parent && chains that gate child components.
|
|
562
|
+
*/
|
|
563
|
+
interface ParentGatingCondition {
|
|
564
|
+
path: string;
|
|
565
|
+
sourceLocation: { lineNumber: number; column: number; codeSnippet: string };
|
|
566
|
+
isNegated?: boolean;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Extracts conditionals from JSX elements by recursively traversing children.
|
|
571
|
+
*
|
|
572
|
+
* This is CRITICAL for extracting compound conditionals from JSX expressions
|
|
573
|
+
* like `{hasNewerVersion && !isActive && <Banner />}`.
|
|
574
|
+
*
|
|
575
|
+
* This function is called BEFORE the child boundary check in processExpression
|
|
576
|
+
* because JSX elements are NOT scopes - their expressions use variables from
|
|
577
|
+
* the parent scope and should have their conditionals extracted regardless of
|
|
578
|
+
* whether the JSX is within a child boundary.
|
|
579
|
+
*
|
|
580
|
+
* Fix 32: Added parentConditions parameter to track gating conditions from
|
|
581
|
+
* parent && chains. When we find a component nested inside multiple conditionals
|
|
582
|
+
* like `{activeTab && <>{ternary ? ... : <Component />}</>}`, ALL parent
|
|
583
|
+
* conditions should be added as gating conditions for the component.
|
|
584
|
+
*
|
|
585
|
+
* @param node The JSX element, self-closing element, or fragment to traverse
|
|
586
|
+
* @param context The analysis context
|
|
587
|
+
* @param parentConditions Accumulated gating conditions from parent && chains
|
|
588
|
+
*/
|
|
589
|
+
function extractConditionalsFromJsx(
|
|
590
|
+
node: ts.JsxElement | ts.JsxSelfClosingElement | ts.JsxFragment,
|
|
591
|
+
context: AnalysisContext,
|
|
592
|
+
parentConditions: ParentGatingCondition[] = [],
|
|
593
|
+
): void {
|
|
594
|
+
// Get children to process
|
|
595
|
+
let children: ts.NodeArray<ts.JsxChild> | undefined;
|
|
596
|
+
|
|
597
|
+
if (ts.isJsxElement(node)) {
|
|
598
|
+
children = node.children;
|
|
599
|
+
} else if (ts.isJsxFragment(node)) {
|
|
600
|
+
children = node.children;
|
|
601
|
+
}
|
|
602
|
+
// JsxSelfClosingElement has no children
|
|
603
|
+
|
|
604
|
+
if (!children) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
for (const child of children) {
|
|
609
|
+
// Process JSX expressions: {expr}
|
|
610
|
+
if (ts.isJsxExpression(child) && child.expression) {
|
|
611
|
+
const expr = unwrapExpression(child.expression);
|
|
612
|
+
|
|
613
|
+
// Extract JSX rendering usages (array.map, text interpolation)
|
|
614
|
+
// This handles direct usages like {items.map(...)} or {user.name}
|
|
615
|
+
extractJsxRenderingUsage(expr, context);
|
|
616
|
+
|
|
617
|
+
// If the expression is an && chain, extract its conditional usages
|
|
618
|
+
if (
|
|
619
|
+
ts.isBinaryExpression(expr) &&
|
|
620
|
+
expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
|
|
621
|
+
) {
|
|
622
|
+
// Mark nullable variables
|
|
623
|
+
markConditionVariablesAsNullable(expr, context);
|
|
624
|
+
// Extract conditional usage (this handles compound conditionals)
|
|
625
|
+
// Pass controlsJsxRendering: true since this conditional controls JSX rendering
|
|
626
|
+
extractConditionalUsage(expr, context, 'logical-and', {
|
|
627
|
+
controlsJsxRendering: true,
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
// Extract all condition paths from the && chain for gating tracking
|
|
631
|
+
const conditionPaths = extractConditionPathsFromAndChain(
|
|
632
|
+
expr,
|
|
633
|
+
context.sourceFile,
|
|
634
|
+
);
|
|
635
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
636
|
+
|
|
637
|
+
// Fix 32: Build accumulated conditions including parent conditions
|
|
638
|
+
const accumulatedConditions: ParentGatingCondition[] = [
|
|
639
|
+
...parentConditions,
|
|
640
|
+
...conditionPaths.map((path) => ({
|
|
641
|
+
path,
|
|
642
|
+
sourceLocation,
|
|
643
|
+
isNegated: false,
|
|
644
|
+
})),
|
|
645
|
+
];
|
|
646
|
+
|
|
647
|
+
// Track gating conditions for child components
|
|
648
|
+
// Example: {hasAnalysis && <ScenarioViewer />}
|
|
649
|
+
const jsxElement = findJsxInAndChain(expr);
|
|
650
|
+
if (jsxElement) {
|
|
651
|
+
const componentName = getComponentNameFromJsx(jsxElement);
|
|
652
|
+
if (componentName) {
|
|
653
|
+
// Fix 32: Add ALL accumulated conditions (parent + current) as gating conditions
|
|
654
|
+
for (const condition of accumulatedConditions) {
|
|
655
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
656
|
+
path: condition.path,
|
|
657
|
+
conditionType: 'truthiness',
|
|
658
|
+
location: 'logical-and',
|
|
659
|
+
sourceLocation: condition.sourceLocation,
|
|
660
|
+
controlsJsxRendering: true,
|
|
661
|
+
isNegated: condition.isNegated,
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// Fix 32: Recursively process nested JSX with accumulated conditions
|
|
667
|
+
if (
|
|
668
|
+
ts.isJsxElement(jsxElement) ||
|
|
669
|
+
ts.isJsxSelfClosingElement(jsxElement)
|
|
670
|
+
) {
|
|
671
|
+
extractConditionalsFromJsx(
|
|
672
|
+
jsxElement,
|
|
673
|
+
context,
|
|
674
|
+
accumulatedConditions,
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// Fix 32: Also check for nested JSX fragments
|
|
680
|
+
const jsxFragment = findJsxFragmentInAndChain(expr);
|
|
681
|
+
if (jsxFragment) {
|
|
682
|
+
extractConditionalsFromJsx(
|
|
683
|
+
jsxFragment,
|
|
684
|
+
context,
|
|
685
|
+
accumulatedConditions,
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
// If the expression is a ternary, extract its conditional
|
|
690
|
+
else if (ts.isConditionalExpression(expr)) {
|
|
691
|
+
// Pass controlsJsxRendering: true since this conditional controls JSX rendering
|
|
692
|
+
extractConditionalUsage(expr.condition, context, 'ternary', {
|
|
693
|
+
controlsJsxRendering: true,
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
// Track gating conditions for components in both branches of the ternary
|
|
697
|
+
// Example: {isError ? <ErrorView /> : <SuccessView />}
|
|
698
|
+
const conditionPath = StructuredPath.fromNode(
|
|
699
|
+
unwrapExpression(expr.condition),
|
|
700
|
+
context.sourceFile,
|
|
701
|
+
);
|
|
702
|
+
const sourceLocation = getSourceLocation(expr, context.sourceFile);
|
|
703
|
+
|
|
704
|
+
// Recursively process the whenTrue and whenFalse branches for JSX
|
|
705
|
+
const whenTrue = unwrapExpression(expr.whenTrue);
|
|
706
|
+
const whenFalse = unwrapExpression(expr.whenFalse);
|
|
707
|
+
|
|
708
|
+
// Fix 32: Build conditions for whenTrue branch (parent conditions + ternary condition truthy)
|
|
709
|
+
const whenTrueConditions: ParentGatingCondition[] = [
|
|
710
|
+
...parentConditions,
|
|
711
|
+
...(conditionPath
|
|
712
|
+
? [
|
|
713
|
+
{
|
|
714
|
+
path: conditionPath.toString(),
|
|
715
|
+
sourceLocation,
|
|
716
|
+
isNegated: false,
|
|
717
|
+
},
|
|
718
|
+
]
|
|
719
|
+
: []),
|
|
720
|
+
];
|
|
721
|
+
|
|
722
|
+
// Fix 32: Build conditions for whenFalse branch (parent conditions + ternary condition falsy)
|
|
723
|
+
const whenFalseConditions: ParentGatingCondition[] = [
|
|
724
|
+
...parentConditions,
|
|
725
|
+
...(conditionPath
|
|
726
|
+
? [
|
|
727
|
+
{
|
|
728
|
+
path: conditionPath.toString(),
|
|
729
|
+
sourceLocation,
|
|
730
|
+
isNegated: true,
|
|
731
|
+
},
|
|
732
|
+
]
|
|
733
|
+
: []),
|
|
734
|
+
];
|
|
735
|
+
|
|
736
|
+
// Handle whenTrue branch (condition is truthy)
|
|
737
|
+
if (ts.isJsxElement(whenTrue) || ts.isJsxSelfClosingElement(whenTrue)) {
|
|
738
|
+
const componentName = getComponentNameFromJsx(whenTrue);
|
|
739
|
+
if (componentName) {
|
|
740
|
+
// Fix 32: Add ALL conditions (parent + ternary) as gating conditions
|
|
741
|
+
for (const condition of whenTrueConditions) {
|
|
742
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
743
|
+
path: condition.path,
|
|
744
|
+
conditionType: 'truthiness',
|
|
745
|
+
location: 'ternary',
|
|
746
|
+
sourceLocation: condition.sourceLocation,
|
|
747
|
+
controlsJsxRendering: true,
|
|
748
|
+
isNegated: condition.isNegated,
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
if (
|
|
754
|
+
ts.isJsxElement(whenTrue) ||
|
|
755
|
+
ts.isJsxSelfClosingElement(whenTrue) ||
|
|
756
|
+
ts.isJsxFragment(whenTrue)
|
|
757
|
+
) {
|
|
758
|
+
extractConditionalsFromJsx(whenTrue, context, whenTrueConditions);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// Handle whenFalse branch (condition is falsy/negated)
|
|
762
|
+
if (
|
|
763
|
+
ts.isJsxElement(whenFalse) ||
|
|
764
|
+
ts.isJsxSelfClosingElement(whenFalse)
|
|
765
|
+
) {
|
|
766
|
+
const componentName = getComponentNameFromJsx(whenFalse);
|
|
767
|
+
if (componentName) {
|
|
768
|
+
// Fix 32: Add ALL conditions (parent + ternary) as gating conditions
|
|
769
|
+
for (const condition of whenFalseConditions) {
|
|
770
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
771
|
+
path: condition.path,
|
|
772
|
+
conditionType: 'truthiness',
|
|
773
|
+
location: 'ternary',
|
|
774
|
+
sourceLocation: condition.sourceLocation,
|
|
775
|
+
controlsJsxRendering: true,
|
|
776
|
+
isNegated: condition.isNegated,
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
if (
|
|
782
|
+
ts.isJsxElement(whenFalse) ||
|
|
783
|
+
ts.isJsxSelfClosingElement(whenFalse) ||
|
|
784
|
+
ts.isJsxFragment(whenFalse)
|
|
785
|
+
) {
|
|
786
|
+
extractConditionalsFromJsx(whenFalse, context, whenFalseConditions);
|
|
787
|
+
}
|
|
788
|
+
// Handle chained ternaries: a ? <A/> : b ? <B/> : <C/>
|
|
789
|
+
// When whenFalse is another ConditionalExpression, recursively process it
|
|
790
|
+
else if (ts.isConditionalExpression(whenFalse)) {
|
|
791
|
+
// Extract conditional usage for the nested ternary's condition
|
|
792
|
+
extractConditionalUsage(whenFalse.condition, context, 'ternary', {
|
|
793
|
+
controlsJsxRendering: true,
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
// Get the nested condition path
|
|
797
|
+
const nestedConditionPath = StructuredPath.fromNode(
|
|
798
|
+
unwrapExpression(whenFalse.condition),
|
|
799
|
+
context.sourceFile,
|
|
800
|
+
);
|
|
801
|
+
const nestedSourceLocation = getSourceLocation(
|
|
802
|
+
whenFalse,
|
|
803
|
+
context.sourceFile,
|
|
804
|
+
);
|
|
805
|
+
|
|
806
|
+
const nestedWhenTrue = unwrapExpression(whenFalse.whenTrue);
|
|
807
|
+
const nestedWhenFalse = unwrapExpression(whenFalse.whenFalse);
|
|
808
|
+
|
|
809
|
+
// Fix 32: Build conditions for nested whenTrue (parent falsy + nested truthy)
|
|
810
|
+
const nestedWhenTrueConditions: ParentGatingCondition[] = [
|
|
811
|
+
...whenFalseConditions, // Parent ternary was falsy to get here
|
|
812
|
+
...(nestedConditionPath
|
|
813
|
+
? [
|
|
814
|
+
{
|
|
815
|
+
path: nestedConditionPath.toString(),
|
|
816
|
+
sourceLocation: nestedSourceLocation,
|
|
817
|
+
isNegated: false,
|
|
818
|
+
},
|
|
819
|
+
]
|
|
820
|
+
: []),
|
|
821
|
+
];
|
|
822
|
+
|
|
823
|
+
// Fix 32: Build conditions for nested whenFalse (parent falsy + nested falsy)
|
|
824
|
+
const nestedWhenFalseConditions: ParentGatingCondition[] = [
|
|
825
|
+
...whenFalseConditions, // Parent ternary was falsy to get here
|
|
826
|
+
...(nestedConditionPath
|
|
827
|
+
? [
|
|
828
|
+
{
|
|
829
|
+
path: nestedConditionPath.toString(),
|
|
830
|
+
sourceLocation: nestedSourceLocation,
|
|
831
|
+
isNegated: true,
|
|
832
|
+
},
|
|
833
|
+
]
|
|
834
|
+
: []),
|
|
835
|
+
];
|
|
836
|
+
|
|
837
|
+
// Handle nested whenTrue branch
|
|
838
|
+
if (
|
|
839
|
+
ts.isJsxElement(nestedWhenTrue) ||
|
|
840
|
+
ts.isJsxSelfClosingElement(nestedWhenTrue)
|
|
841
|
+
) {
|
|
842
|
+
const componentName = getComponentNameFromJsx(nestedWhenTrue);
|
|
843
|
+
if (componentName) {
|
|
844
|
+
// Fix 32: Add ALL accumulated conditions
|
|
845
|
+
for (const condition of nestedWhenTrueConditions) {
|
|
846
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
847
|
+
path: condition.path,
|
|
848
|
+
conditionType: 'truthiness',
|
|
849
|
+
location: 'ternary',
|
|
850
|
+
sourceLocation: condition.sourceLocation,
|
|
851
|
+
controlsJsxRendering: true,
|
|
852
|
+
isNegated: condition.isNegated,
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
if (
|
|
858
|
+
ts.isJsxElement(nestedWhenTrue) ||
|
|
859
|
+
ts.isJsxSelfClosingElement(nestedWhenTrue) ||
|
|
860
|
+
ts.isJsxFragment(nestedWhenTrue)
|
|
861
|
+
) {
|
|
862
|
+
extractConditionalsFromJsx(
|
|
863
|
+
nestedWhenTrue,
|
|
864
|
+
context,
|
|
865
|
+
nestedWhenTrueConditions,
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// Handle nested whenFalse branch (this could be another chained ternary or JSX)
|
|
870
|
+
if (
|
|
871
|
+
ts.isJsxElement(nestedWhenFalse) ||
|
|
872
|
+
ts.isJsxSelfClosingElement(nestedWhenFalse)
|
|
873
|
+
) {
|
|
874
|
+
const componentName = getComponentNameFromJsx(nestedWhenFalse);
|
|
875
|
+
if (componentName) {
|
|
876
|
+
// Fix 32: Add ALL accumulated conditions
|
|
877
|
+
for (const condition of nestedWhenFalseConditions) {
|
|
878
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
879
|
+
path: condition.path,
|
|
880
|
+
conditionType: 'truthiness',
|
|
881
|
+
location: 'ternary',
|
|
882
|
+
sourceLocation: condition.sourceLocation,
|
|
883
|
+
controlsJsxRendering: true,
|
|
884
|
+
isNegated: condition.isNegated,
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
if (
|
|
890
|
+
ts.isJsxElement(nestedWhenFalse) ||
|
|
891
|
+
ts.isJsxSelfClosingElement(nestedWhenFalse) ||
|
|
892
|
+
ts.isJsxFragment(nestedWhenFalse)
|
|
893
|
+
) {
|
|
894
|
+
extractConditionalsFromJsx(
|
|
895
|
+
nestedWhenFalse,
|
|
896
|
+
context,
|
|
897
|
+
nestedWhenFalseConditions,
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
// If nestedWhenFalse is yet another ConditionalExpression, the recursion
|
|
901
|
+
// will handle it on the next iteration when this function processes it
|
|
902
|
+
else if (ts.isConditionalExpression(nestedWhenFalse)) {
|
|
903
|
+
// Recursively handle deeper nesting by wrapping in a synthetic process
|
|
904
|
+
// We create a fake JsxExpression context to reuse the same logic
|
|
905
|
+
const syntheticChild = {
|
|
906
|
+
kind: ts.SyntaxKind.JsxExpression,
|
|
907
|
+
expression: nestedWhenFalse,
|
|
908
|
+
} as unknown as ts.JsxExpression;
|
|
909
|
+
// Process via the main JSX expression handler by recursing
|
|
910
|
+
// For now, just extract conditionals directly
|
|
911
|
+
extractConditionalUsage(
|
|
912
|
+
nestedWhenFalse.condition,
|
|
913
|
+
context,
|
|
914
|
+
'ternary',
|
|
915
|
+
{ controlsJsxRendering: true },
|
|
916
|
+
);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
// Recursively process nested JSX elements - Fix 32: pass parent conditions
|
|
922
|
+
else if (ts.isJsxElement(child)) {
|
|
923
|
+
// Check if this is a user-defined component (vs intrinsic element like div)
|
|
924
|
+
// If it's a component AND there are parent conditions, record the gating conditions
|
|
925
|
+
const componentName = getComponentNameFromJsx(child);
|
|
926
|
+
if (componentName && parentConditions.length > 0) {
|
|
927
|
+
for (const condition of parentConditions) {
|
|
928
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
929
|
+
path: condition.path,
|
|
930
|
+
conditionType: 'truthiness',
|
|
931
|
+
location: 'ternary',
|
|
932
|
+
sourceLocation: condition.sourceLocation,
|
|
933
|
+
controlsJsxRendering: true,
|
|
934
|
+
isNegated: condition.isNegated,
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
extractConditionalsFromJsx(child, context, parentConditions);
|
|
939
|
+
}
|
|
940
|
+
// Handle self-closing JSX elements (e.g., <ScenarioViewer />)
|
|
941
|
+
else if (ts.isJsxSelfClosingElement(child)) {
|
|
942
|
+
// Check if this is a user-defined component (vs intrinsic element like div)
|
|
943
|
+
// If it's a component AND there are parent conditions, record the gating conditions
|
|
944
|
+
const componentName = getComponentNameFromJsx(child);
|
|
945
|
+
if (componentName && parentConditions.length > 0) {
|
|
946
|
+
for (const condition of parentConditions) {
|
|
947
|
+
context.addChildBoundaryGatingCondition(componentName, {
|
|
948
|
+
path: condition.path,
|
|
949
|
+
conditionType: 'truthiness',
|
|
950
|
+
location: 'ternary',
|
|
951
|
+
sourceLocation: condition.sourceLocation,
|
|
952
|
+
controlsJsxRendering: true,
|
|
953
|
+
isNegated: condition.isNegated,
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
// Self-closing elements have no children, so no recursion needed
|
|
958
|
+
}
|
|
959
|
+
// Recursively process nested JSX fragments - Fix 32: pass parent conditions
|
|
960
|
+
else if (ts.isJsxFragment(child)) {
|
|
961
|
+
extractConditionalsFromJsx(child, context, parentConditions);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Options for extractConditionalUsage
|
|
968
|
+
*/
|
|
969
|
+
interface ExtractConditionalOptions {
|
|
970
|
+
/**
|
|
971
|
+
* Whether this conditional controls JSX rendering.
|
|
972
|
+
* Set to true when the conditional appears in a JSX expression like {cond && <Component />}
|
|
973
|
+
*/
|
|
974
|
+
controlsJsxRendering?: boolean;
|
|
254
975
|
}
|
|
255
976
|
|
|
256
977
|
/**
|
|
@@ -261,12 +982,15 @@ interface ChainInfo {
|
|
|
261
982
|
* @param condition The condition expression to analyze
|
|
262
983
|
* @param context The analysis context
|
|
263
984
|
* @param location Where this condition appears (if, ternary, logical-and, switch)
|
|
985
|
+
* @param options Additional options including controlsJsxRendering flag
|
|
264
986
|
*/
|
|
265
987
|
export function extractConditionalUsage(
|
|
266
988
|
condition: ts.Expression,
|
|
267
989
|
context: AnalysisContext,
|
|
268
990
|
location: ConditionalUsage['location'],
|
|
991
|
+
options: ExtractConditionalOptions = {},
|
|
269
992
|
): void {
|
|
993
|
+
const { controlsJsxRendering } = options;
|
|
270
994
|
// Internal recursive function with chain tracking
|
|
271
995
|
function extractWithChainTracking(
|
|
272
996
|
expr: ts.Expression,
|
|
@@ -300,6 +1024,7 @@ export function extractConditionalUsage(
|
|
|
300
1024
|
conditions: [],
|
|
301
1025
|
location,
|
|
302
1026
|
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
1027
|
+
controlsJsxRendering,
|
|
303
1028
|
};
|
|
304
1029
|
chainInfo = {
|
|
305
1030
|
chainId,
|
|
@@ -333,14 +1058,37 @@ export function extractConditionalUsage(
|
|
|
333
1058
|
}
|
|
334
1059
|
|
|
335
1060
|
// Handle binary expressions with || (logical OR)
|
|
336
|
-
// OR
|
|
1061
|
+
// When OR is inside an && chain, we need to continue chain tracking
|
|
1062
|
+
// and mark conditions as OR alternatives
|
|
337
1063
|
if (
|
|
338
1064
|
ts.isBinaryExpression(unwrapped) &&
|
|
339
1065
|
unwrapped.operatorToken.kind === ts.SyntaxKind.BarBarToken
|
|
340
1066
|
) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
1067
|
+
if (chainInfo) {
|
|
1068
|
+
// We're inside an && chain - continue tracking but mark as OR alternatives
|
|
1069
|
+
// Generate an orGroupId so conditions from both sides can be grouped
|
|
1070
|
+
const orGroupId =
|
|
1071
|
+
chainInfo.currentOrGroupId ?? `or_${crypto.randomUUID().slice(0, 8)}`;
|
|
1072
|
+
|
|
1073
|
+
// Process left side with OR group tracking
|
|
1074
|
+
const leftChainInfo = {
|
|
1075
|
+
...chainInfo,
|
|
1076
|
+
currentOrGroupId: orGroupId,
|
|
1077
|
+
};
|
|
1078
|
+
extractWithChainTracking(unwrapped.left, leftChainInfo, false);
|
|
1079
|
+
|
|
1080
|
+
// Process right side with same OR group
|
|
1081
|
+
// Note: we use leftChainInfo's currentPosition which may have been updated
|
|
1082
|
+
const rightChainInfo = {
|
|
1083
|
+
...leftChainInfo,
|
|
1084
|
+
currentPosition: chainInfo.currentPosition,
|
|
1085
|
+
};
|
|
1086
|
+
extractWithChainTracking(unwrapped.right, rightChainInfo, false);
|
|
1087
|
+
} else {
|
|
1088
|
+
// Not inside a chain - OR breaks into independent conditional checks
|
|
1089
|
+
extractWithChainTracking(unwrapped.left, null, false);
|
|
1090
|
+
extractWithChainTracking(unwrapped.right, null, false);
|
|
1091
|
+
}
|
|
344
1092
|
return;
|
|
345
1093
|
}
|
|
346
1094
|
|
|
@@ -385,6 +1133,7 @@ export function extractConditionalUsage(
|
|
|
385
1133
|
conditionType: 'comparison' | 'truthiness',
|
|
386
1134
|
comparedValues?: string[],
|
|
387
1135
|
requiredValue?: string | boolean,
|
|
1136
|
+
sourceExpr?: ts.Expression,
|
|
388
1137
|
) => {
|
|
389
1138
|
const usage: ConditionalUsage = {
|
|
390
1139
|
path,
|
|
@@ -393,8 +1142,20 @@ export function extractConditionalUsage(
|
|
|
393
1142
|
location,
|
|
394
1143
|
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
395
1144
|
isNegated,
|
|
1145
|
+
controlsJsxRendering,
|
|
396
1146
|
};
|
|
397
1147
|
|
|
1148
|
+
// Check for inline array-derived patterns (.length) on the source expression
|
|
1149
|
+
if (sourceExpr) {
|
|
1150
|
+
const arrayDerived = detectArrayDerivedPattern(sourceExpr);
|
|
1151
|
+
if (arrayDerived) {
|
|
1152
|
+
usage.derivedFrom = {
|
|
1153
|
+
operation: arrayDerived.operation,
|
|
1154
|
+
sourcePath: arrayDerived.sourcePath,
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
398
1159
|
// Add chain info if part of a compound conditional
|
|
399
1160
|
if (chainInfo) {
|
|
400
1161
|
usage.chainId = chainInfo.chainId;
|
|
@@ -410,6 +1171,9 @@ export function extractConditionalUsage(
|
|
|
410
1171
|
comparedValues,
|
|
411
1172
|
isNegated,
|
|
412
1173
|
requiredValue,
|
|
1174
|
+
...(chainInfo.currentOrGroupId && {
|
|
1175
|
+
orGroupId: chainInfo.currentOrGroupId,
|
|
1176
|
+
}),
|
|
413
1177
|
});
|
|
414
1178
|
}
|
|
415
1179
|
|
|
@@ -424,6 +1188,7 @@ export function extractConditionalUsage(
|
|
|
424
1188
|
'comparison',
|
|
425
1189
|
literalValue !== undefined ? [literalValue] : undefined,
|
|
426
1190
|
getRequiredValue(literalValue, isNegated),
|
|
1191
|
+
unwrapped.left, // Pass source expression for array derivation detection
|
|
427
1192
|
);
|
|
428
1193
|
return;
|
|
429
1194
|
}
|
|
@@ -436,16 +1201,29 @@ export function extractConditionalUsage(
|
|
|
436
1201
|
'comparison',
|
|
437
1202
|
literalValue !== undefined ? [literalValue] : undefined,
|
|
438
1203
|
getRequiredValue(literalValue, isNegated),
|
|
1204
|
+
unwrapped.right, // Pass source expression for array derivation detection
|
|
439
1205
|
);
|
|
440
1206
|
return;
|
|
441
1207
|
}
|
|
442
1208
|
|
|
443
1209
|
// Both sides are variables - record both as comparisons without specific values
|
|
444
1210
|
if (leftPath) {
|
|
445
|
-
addCondition(
|
|
1211
|
+
addCondition(
|
|
1212
|
+
leftPath.toLeftHandSideString(),
|
|
1213
|
+
'comparison',
|
|
1214
|
+
undefined,
|
|
1215
|
+
undefined,
|
|
1216
|
+
unwrapped.left,
|
|
1217
|
+
);
|
|
446
1218
|
}
|
|
447
1219
|
if (rightPath) {
|
|
448
|
-
addCondition(
|
|
1220
|
+
addCondition(
|
|
1221
|
+
rightPath.toLeftHandSideString(),
|
|
1222
|
+
'comparison',
|
|
1223
|
+
undefined,
|
|
1224
|
+
undefined,
|
|
1225
|
+
unwrapped.right,
|
|
1226
|
+
);
|
|
449
1227
|
}
|
|
450
1228
|
return;
|
|
451
1229
|
}
|
|
@@ -471,8 +1249,19 @@ export function extractConditionalUsage(
|
|
|
471
1249
|
location,
|
|
472
1250
|
sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
|
|
473
1251
|
isNegated,
|
|
1252
|
+
controlsJsxRendering,
|
|
474
1253
|
};
|
|
475
1254
|
|
|
1255
|
+
// Check for inline array-derived patterns (.some(), .every(), .includes(), .length)
|
|
1256
|
+
// This populates derivedFrom so downstream code can resolve to the base array path
|
|
1257
|
+
const arrayDerived = detectArrayDerivedPattern(unwrapped);
|
|
1258
|
+
if (arrayDerived) {
|
|
1259
|
+
usage.derivedFrom = {
|
|
1260
|
+
operation: arrayDerived.operation,
|
|
1261
|
+
sourcePath: arrayDerived.sourcePath,
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
|
|
476
1265
|
// Add chain info if part of a compound conditional
|
|
477
1266
|
if (chainInfo) {
|
|
478
1267
|
usage.chainId = chainInfo.chainId;
|
|
@@ -488,6 +1277,9 @@ export function extractConditionalUsage(
|
|
|
488
1277
|
conditionType: 'truthiness',
|
|
489
1278
|
isNegated,
|
|
490
1279
|
requiredValue: !isNegated,
|
|
1280
|
+
...(chainInfo.currentOrGroupId && {
|
|
1281
|
+
orGroupId: chainInfo.currentOrGroupId,
|
|
1282
|
+
}),
|
|
491
1283
|
});
|
|
492
1284
|
}
|
|
493
1285
|
|
|
@@ -611,6 +1403,18 @@ export function processExpression({
|
|
|
611
1403
|
}
|
|
612
1404
|
}
|
|
613
1405
|
|
|
1406
|
+
// CRITICAL: Extract conditionals from JSX BEFORE checking child boundaries
|
|
1407
|
+
// JSX elements are NOT scopes - their expressions use variables from the parent scope.
|
|
1408
|
+
// Even if the JSX element is within a child boundary (e.g., because it contains callbacks),
|
|
1409
|
+
// we must still extract conditionals from JSX expression children like {x && <div>...</div>}
|
|
1410
|
+
if (
|
|
1411
|
+
ts.isJsxElement(unwrappedNode) ||
|
|
1412
|
+
ts.isJsxSelfClosingElement(unwrappedNode) ||
|
|
1413
|
+
ts.isJsxFragment(unwrappedNode)
|
|
1414
|
+
) {
|
|
1415
|
+
extractConditionalsFromJsx(unwrappedNode, context);
|
|
1416
|
+
}
|
|
1417
|
+
|
|
614
1418
|
// If the node falls within an excluded child scope, stop processing it.
|
|
615
1419
|
if (context.isChildBoundary(node)) {
|
|
616
1420
|
return true;
|
|
@@ -802,7 +1606,8 @@ export function processExpression({
|
|
|
802
1606
|
// Check if this is an environment variable access
|
|
803
1607
|
const fullText = unwrappedNode.getText(context.sourceFile);
|
|
804
1608
|
if (
|
|
805
|
-
fullText.includes('.env.') //
|
|
1609
|
+
fullText.includes('.env.') || // process.env.X, window.env.X
|
|
1610
|
+
isEnvStoreAccess(fullText) // env.X where env is likely an env config object
|
|
806
1611
|
) {
|
|
807
1612
|
context.addEnvironmentVariable(fullText);
|
|
808
1613
|
}
|
|
@@ -1109,6 +1914,14 @@ export function processExpression({
|
|
|
1109
1914
|
// e.g., `const tab = segments[0] || 'default'` should trace tab back to segments[0]
|
|
1110
1915
|
if (operatorKind === ts.SyntaxKind.QuestionQuestionToken) {
|
|
1111
1916
|
// specifically for ?? we create an equivalence to the left side
|
|
1917
|
+
// IMPORTANT: Also process the left side recursively to apply method semantics
|
|
1918
|
+
// (e.g., for `const segments = splat?.split('/') ?? []`, we need split semantics)
|
|
1919
|
+
processExpression({
|
|
1920
|
+
node: unwrappedNode.left,
|
|
1921
|
+
context,
|
|
1922
|
+
// Don't pass targetPath here - we'll establish equivalence separately below
|
|
1923
|
+
});
|
|
1924
|
+
|
|
1112
1925
|
if (targetPath) {
|
|
1113
1926
|
resultPath = StructuredPath.fromNode(
|
|
1114
1927
|
unwrappedNode.left,
|
|
@@ -1126,15 +1939,31 @@ export function processExpression({
|
|
|
1126
1939
|
);
|
|
1127
1940
|
}
|
|
1128
1941
|
} else if (operatorKind === ts.SyntaxKind.BarBarToken) {
|
|
1129
|
-
// For ||,
|
|
1942
|
+
// For ||, create equivalences to BOTH sides
|
|
1130
1943
|
// This enables data flow tracing through fallback expressions
|
|
1944
|
+
// e.g., `const item = items.find(...) || null` should trace to both:
|
|
1945
|
+
// - items[] (from the find result)
|
|
1946
|
+
// - null (from the fallback)
|
|
1131
1947
|
if (targetPath) {
|
|
1948
|
+
// Process left side recursively to capture its full equivalency chain
|
|
1949
|
+
processExpression({
|
|
1950
|
+
node: unwrappedNode.left,
|
|
1951
|
+
context,
|
|
1952
|
+
targetPath,
|
|
1953
|
+
});
|
|
1954
|
+
// Process right side recursively for completeness
|
|
1955
|
+
processExpression({
|
|
1956
|
+
node: unwrappedNode.right,
|
|
1957
|
+
context,
|
|
1958
|
+
targetPath,
|
|
1959
|
+
});
|
|
1960
|
+
// Set resultPath to left side for type inference
|
|
1132
1961
|
resultPath = StructuredPath.fromNode(
|
|
1133
1962
|
unwrappedNode.left,
|
|
1134
1963
|
context.sourceFile,
|
|
1135
1964
|
);
|
|
1136
1965
|
}
|
|
1137
|
-
// Note:
|
|
1966
|
+
// Note: When there's no targetPath, we don't recursively process
|
|
1138
1967
|
// because || is often used in boolean contexts where the full expression matters
|
|
1139
1968
|
}
|
|
1140
1969
|
} else if (operatorKind === ts.SyntaxKind.InstanceOfKeyword) {
|
|
@@ -1673,6 +2502,17 @@ export function processExpression({
|
|
|
1673
2502
|
// Extract conditional usages for key attribute detection
|
|
1674
2503
|
extractConditionalUsage(unwrappedNode.condition, context, 'ternary');
|
|
1675
2504
|
|
|
2505
|
+
// Extract conditional effects (setter calls in ternary branches)
|
|
2506
|
+
const knownSetters = findUseStateSetters(context.sourceFile);
|
|
2507
|
+
const effects = extractConditionalEffectsFromTernary(
|
|
2508
|
+
unwrappedNode,
|
|
2509
|
+
context,
|
|
2510
|
+
knownSetters,
|
|
2511
|
+
);
|
|
2512
|
+
for (const effect of effects) {
|
|
2513
|
+
context.addConditionalEffect(effect);
|
|
2514
|
+
}
|
|
2515
|
+
|
|
1676
2516
|
// Process all parts recursively
|
|
1677
2517
|
processExpression({
|
|
1678
2518
|
node: unwrappedNode.condition,
|