@codeyam/codeyam-cli 0.1.0-staging.15d0f46 → 0.1.0-staging.1669d45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/common/execAsync.ts +1 -1
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +9 -5
- package/analyzer-template/packages/ai/index.ts +5 -3
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +152 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +107 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +42 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +38 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +301 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +972 -106
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +232 -0
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +18 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1409 -138
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +771 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +233 -75
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +39 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +42 -2
- package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +6 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +486 -86
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +182 -104
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +201 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1019 -0
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
- package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +276 -3
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +33 -3
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +71 -4
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -53
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +690 -0
- package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +102 -0
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +458 -267
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +18 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
- package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +196 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +588 -52
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +299 -133
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +156 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +384 -94
- package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
- package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
- package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
- package/analyzer-template/packages/aws/package.json +2 -2
- package/analyzer-template/packages/aws/s3/index.ts +1 -0
- package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
- package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
- package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
- package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
- package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
- package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
- package/analyzer-template/packages/generate/index.ts +3 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
- package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +30 -7
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
- package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/index.js +3 -0
- package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
- package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
- package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.d.ts +2 -2
- package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +63 -13
- package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +11 -6
- package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +146 -0
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
- package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
- package/analyzer-template/packages/process/index.ts +2 -0
- package/analyzer-template/packages/process/package.json +12 -0
- package/analyzer-template/packages/process/tsconfig.json +8 -0
- package/analyzer-template/packages/types/index.ts +4 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +79 -13
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +161 -0
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
- package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +63 -13
- package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +11 -6
- package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +146 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
- package/analyzer-template/playwright/capture.ts +37 -18
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/analyzeBaselineCommit.ts +4 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +4 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +4 -0
- package/analyzer-template/project/constructMockCode.ts +868 -132
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +49 -33
- package/analyzer-template/project/orchestrateCapture.ts +10 -3
- package/analyzer-template/project/reconcileMockDataKeys.ts +102 -2
- package/analyzer-template/project/runAnalysis.ts +7 -0
- package/analyzer-template/project/serverOnlyModules.ts +127 -2
- package/analyzer-template/project/start.ts +26 -4
- package/analyzer-template/project/startScenarioCapture.ts +72 -40
- package/analyzer-template/project/writeMockDataTsx.ts +118 -55
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +263 -92
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +13 -15
- package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +2 -1
- package/background/src/lib/local/createLocalAnalyzer.js +1 -29
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/background/src/lib/local/execAsync.js +1 -1
- package/background/src/lib/local/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/common/execAsync.js +1 -1
- package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
- package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +2 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +799 -121
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/controller/startController.js +11 -1
- package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
- package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
- package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +42 -28
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +7 -4
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +87 -2
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +6 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +21 -4
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +56 -30
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +110 -48
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
- package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +211 -75
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
- package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +13 -13
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/src/cli.js +5 -1
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +1 -1
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +174 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/debug.js +28 -18
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +0 -15
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +44 -23
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +72 -24
- package/codeyam-cli/src/commands/report.js.map +1 -1
- package/codeyam-cli/src/commands/start.js +8 -12
- package/codeyam-cli/src/commands/start.js.map +1 -1
- package/codeyam-cli/src/commands/status.js +23 -1
- package/codeyam-cli/src/commands/status.js.map +1 -1
- package/codeyam-cli/src/commands/test-startup.js +1 -1
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/wipe.js +108 -0
- package/codeyam-cli/src/commands/wipe.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
- package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +27 -27
- package/codeyam-cli/src/utils/analysisRunner.js +8 -13
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +12 -2
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/database.js +91 -5
- package/codeyam-cli/src/utils/database.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +253 -106
- package/codeyam-cli/src/utils/generateReport.js.map +1 -1
- package/codeyam-cli/src/utils/git.js +79 -0
- package/codeyam-cli/src/utils/git.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +11 -11
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
- package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +239 -16
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +19 -7
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +5 -5
- package/codeyam-cli/src/utils/versionInfo.js +25 -19
- package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
- package/codeyam-cli/src/utils/wipe.js +128 -0
- package/codeyam-cli/src/utils/wipe.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +96 -0
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +2 -5
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DKdsUF7Y.js → EntityTypeBadge-COi5OvsN.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BwdQv49w.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CEleMv_j.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D68KarMg.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-L75Wvqgw.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-C53WM8qn.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-CrNkmy4i.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CQifa1n-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CyaBFX7l.js +20 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CWjSsLqY.js → TruncatedFilePath-D36O1rzU.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +37 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DgTPh8H-.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-DdQKK6on.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-Dmr2bb1R.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-Do4ZLUYa.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CbdFyxZh.js +23 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-wDWZZO1W.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BMbl7MeQ.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-5wRKRIH9.js +29 -0
- package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DD3SDH7t.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-zXjT7J0G.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-DLbXwndH.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-gPZ-lad1.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-BsPXJ81F.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +57 -0
- package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-P2FKIUql.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-B2eDuBj8.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-L18M6-kN.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BDz7kbVA.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-29dDmbH8.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-CmrTPlIB.js → useLastLogLine-BUm0UVJm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CkIOKTrZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-C1ig_BmP.js → useToast-KKw5kTn-.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +228 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/devServer.js +1 -3
- package/codeyam-cli/src/webserver/devServer.js.map +1 -1
- package/codeyam-cli/src/webserver/server.js +35 -25
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +1 -1
- package/codeyam-cli/templates/codeyam:diagnose.md +625 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +139 -4
- package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam:sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam:test.md} +1 -1
- package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam:verify.md} +1 -1
- package/package.json +8 -8
- package/packages/ai/index.js +2 -4
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +107 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +76 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
- package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js +29 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
- package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +23 -0
- package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +239 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +728 -87
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +24 -9
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +17 -1
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1126 -82
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +482 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +173 -55
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +35 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +34 -3
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/deepEqual.js +32 -0
- package/packages/ai/src/lib/deepEqual.js.map +1 -0
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +5 -0
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +398 -81
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +168 -82
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +123 -0
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +742 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
- package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +231 -4
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +26 -3
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -64
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +58 -4
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -34
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
- package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
- package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
- package/packages/ai/src/lib/resolvePathToControllable.js +563 -0
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
- package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
- package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +22 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +15 -0
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
- package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +214 -50
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +10 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
- package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js +1 -1
- package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +159 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
- package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +458 -48
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
- package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +235 -81
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +96 -0
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +307 -89
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
- package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
- package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +2 -2
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
- package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/generate/index.js +3 -0
- package/packages/generate/index.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
- package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
- package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
- package/packages/generate/src/lib/deepMerge.js +27 -1
- package/packages/generate/src/lib/deepMerge.js.map +1 -1
- package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
- package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
- package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
- package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
- package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
- package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
- package/packages/process/index.js +3 -0
- package/packages/process/index.js.map +1 -0
- package/packages/process/src/GlobalProcessManager.js.map +1 -0
- package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
- package/packages/process/src/ProcessManager.js.map +1 -0
- package/packages/process/src/index.js.map +1 -0
- package/packages/process/src/managedExecAsync.js.map +1 -0
- package/packages/types/index.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -1
- package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
- package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
- package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
- package/analyzer-template/process/README.md +0 -507
- package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
- package/background/src/lib/process/ProcessManager.js.map +0 -1
- package/background/src/lib/process/index.js.map +0 -1
- package/background/src/lib/process/managedExecAsync.js.map +0 -1
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-D0VW1-W7.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BAk4S4pI.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-Y756iZxZ.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-zzrrjW1p.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-QMn7bJg6.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DmP5mRxX.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BXwvsbLw.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DAmUX_1y.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-Df-nk4J5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-_ZUyFdie.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-Eoh0PhcW.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CZgPLy5i.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-DI-p9ZLZ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DvyV2x6y.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DURu2qlF.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-DDobn9Xh.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CGdWnLD_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-DgMmzrKs.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-DEVXuhkn.js +0 -13
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-WPRQyc68.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-B9u3lJer.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-YGnKIuHU.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/globals-28lrWTTo.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/index-CJ0uPJjV.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/index-CfqeA2XG.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DIjSvh6B.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-8125c15c.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-BXl3LOEh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-C-g286WP.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-xBKWfOxd.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-DVY_wGOx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-Be1pJo5A.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CR-FkSvx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DABetnSj.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DcR7DH9q.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BDBrfp7e.js +0 -175
- package/codeyam-cli/templates/debug-codeyam.md +0 -527
- package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
- package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -136
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
- package/packages/ai/src/lib/isFrontend.js +0 -5
- package/packages/ai/src/lib/isFrontend.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
- package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -72
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
- /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
- /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
- /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
- /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates execution flows from conditional usages using pure static analysis.
|
|
3
|
+
*
|
|
4
|
+
* This replaces LLM-driven flow generation with deterministic flow generation
|
|
5
|
+
* based on conditionalUsages extracted from the AST. Only paths that resolve
|
|
6
|
+
* to controllable data sources (exist in attributesMap) produce flows.
|
|
7
|
+
*
|
|
8
|
+
* Flow generation rules:
|
|
9
|
+
* - truthiness conditions → truthy flow + falsy flow
|
|
10
|
+
* - comparison conditions → one flow per compared value
|
|
11
|
+
* - switch conditions → one flow per case value
|
|
12
|
+
* - compound conditionals → one flow with all conditions (only if ALL paths controllable)
|
|
13
|
+
*/
|
|
14
|
+
import resolvePathToControllable from "./resolvePathToControllable.js";
|
|
15
|
+
/**
|
|
16
|
+
* Clean up sourceDataPath by removing redundant scope prefixes.
|
|
17
|
+
*
|
|
18
|
+
* This function ONLY handles the specific pattern where a scope name is
|
|
19
|
+
* duplicated before the hook call:
|
|
20
|
+
*
|
|
21
|
+
* Example:
|
|
22
|
+
* "useLoaderData<LoaderData>.useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
|
|
23
|
+
* → "useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
|
|
24
|
+
*
|
|
25
|
+
* For paths with multiple function calls (like fetch().json()), or paths
|
|
26
|
+
* that don't match the expected pattern, returns null to indicate the
|
|
27
|
+
* fallback resolution should be used.
|
|
28
|
+
*/
|
|
29
|
+
function cleanSourceDataPath(sourceDataPath) {
|
|
30
|
+
// Count function call patterns - both empty () and with content (...)
|
|
31
|
+
// We detect multiple function calls by counting:
|
|
32
|
+
// 1. Empty () patterns
|
|
33
|
+
// 2. Patterns like functionName(...) - closing paren followed by dot or end
|
|
34
|
+
const emptyFnCalls = (sourceDataPath.match(/\(\)/g) || []).length;
|
|
35
|
+
const fnCallReturnValues = (sourceDataPath.match(/\.functionCallReturnValue/g) || []).length;
|
|
36
|
+
// If there are multiple functionCallReturnValue occurrences, this is a chained call
|
|
37
|
+
// (e.g., fetch(...).functionCallReturnValue.json().functionCallReturnValue.data)
|
|
38
|
+
if (fnCallReturnValues > 1 || emptyFnCalls !== 1) {
|
|
39
|
+
// Multiple function calls - return null to use fallback resolution
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
// Find the "()" which marks the function call
|
|
43
|
+
const fnCallIndex = sourceDataPath.indexOf('()');
|
|
44
|
+
// Find where the function name starts (go back to find the start of this segment)
|
|
45
|
+
const beforeFnCall = sourceDataPath.slice(0, fnCallIndex);
|
|
46
|
+
const lastDotBeforeFn = beforeFnCall.lastIndexOf('.');
|
|
47
|
+
if (lastDotBeforeFn === -1) {
|
|
48
|
+
return sourceDataPath;
|
|
49
|
+
}
|
|
50
|
+
// Extract the scope prefix and the actual path
|
|
51
|
+
const scopePrefix = sourceDataPath.slice(0, lastDotBeforeFn);
|
|
52
|
+
const actualPath = sourceDataPath.slice(lastDotBeforeFn + 1);
|
|
53
|
+
// Verify this is actually a redundant scope prefix pattern
|
|
54
|
+
// The actualPath should start with something that matches the scopePrefix
|
|
55
|
+
// e.g., scopePrefix="useLoaderData<LoaderData>" and actualPath starts with "useLoaderData<LoaderData>()..."
|
|
56
|
+
if (!actualPath.startsWith(scopePrefix.split('.').pop() || '')) {
|
|
57
|
+
// Not a redundant prefix pattern - return the original path
|
|
58
|
+
return sourceDataPath;
|
|
59
|
+
}
|
|
60
|
+
return actualPath;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Find a path in attributesMap, using fullToShortPathMap to verify the path is controllable.
|
|
64
|
+
*
|
|
65
|
+
* IMPORTANT: Returns the FULL path (preserving data source context) when possible.
|
|
66
|
+
* This ensures execution flows can be traced back to specific data sources,
|
|
67
|
+
* which is critical when multiple data sources have the same property names
|
|
68
|
+
* (e.g., multiple useFetcher hooks all having 'state' and 'data').
|
|
69
|
+
*
|
|
70
|
+
* The attributesMap contains short relative paths (e.g., "entity.sha")
|
|
71
|
+
* The sourceDataPath contains full paths (e.g., "useLoaderData<LoaderData>().functionCallReturnValue.entity.sha")
|
|
72
|
+
* The fullToShortPathMap maps full paths to short paths
|
|
73
|
+
*/
|
|
74
|
+
function findInAttributesMapForPath(path, attributesMap, fullToShortPathMap) {
|
|
75
|
+
// Direct match in attributesMap (already a short path)
|
|
76
|
+
if (path in attributesMap) {
|
|
77
|
+
return path;
|
|
78
|
+
}
|
|
79
|
+
// Try looking up the path in fullToShortPathMap to verify it's controllable
|
|
80
|
+
// IMPORTANT: Return the FULL path, not the short path, to preserve data source context
|
|
81
|
+
if (path in fullToShortPathMap) {
|
|
82
|
+
const shortPath = fullToShortPathMap[path];
|
|
83
|
+
if (shortPath in attributesMap) {
|
|
84
|
+
return path; // Return FULL path to preserve data source context
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Normalized match (array indices [N] → [])
|
|
88
|
+
const normalizedPath = path.replace(/\[\d+\]/g, '[]');
|
|
89
|
+
if (normalizedPath !== path) {
|
|
90
|
+
if (normalizedPath in attributesMap) {
|
|
91
|
+
return normalizedPath;
|
|
92
|
+
}
|
|
93
|
+
if (normalizedPath in fullToShortPathMap) {
|
|
94
|
+
const shortPath = fullToShortPathMap[normalizedPath];
|
|
95
|
+
if (shortPath in attributesMap) {
|
|
96
|
+
return normalizedPath; // Return normalized FULL path
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Try prefix matching for child paths
|
|
101
|
+
// e.g., path is "entity.sha.something" and attributesMap has "entity.sha"
|
|
102
|
+
// OR path is a full path like "useLoaderData<...>().functionCallReturnValue.entity.sha"
|
|
103
|
+
// and we need to find matching short path prefix
|
|
104
|
+
for (const attrPath of Object.keys(attributesMap)) {
|
|
105
|
+
if (path.startsWith(attrPath + '.') || path.startsWith(attrPath + '[')) {
|
|
106
|
+
// The path is a child of a known attribute path
|
|
107
|
+
return path;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Try suffix matching: if the path ends with ".X.Y.Z" and attributesMap has "X.Y.Z"
|
|
111
|
+
// Return the FULL input path to preserve data source context
|
|
112
|
+
for (const attrPath of Object.keys(attributesMap)) {
|
|
113
|
+
if (path.endsWith('.' + attrPath) ||
|
|
114
|
+
path.endsWith('.' + attrPath.replace(/\[\d+\]/g, '[]'))) {
|
|
115
|
+
return path; // Return FULL path, not short attrPath
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Generate a human-readable name from a path.
|
|
122
|
+
* Extracts the last meaningful part of the path.
|
|
123
|
+
*
|
|
124
|
+
* Examples:
|
|
125
|
+
* - "useFetcher<...>().functionCallReturnValue.state" → "state"
|
|
126
|
+
* - "useLoaderData<...>().functionCallReturnValue.user.isActive" → "isActive"
|
|
127
|
+
*/
|
|
128
|
+
function generateNameFromPath(path) {
|
|
129
|
+
// Remove function call markers and get the last meaningful segment
|
|
130
|
+
const cleanPath = path
|
|
131
|
+
.replace(/\(\)/g, '')
|
|
132
|
+
.replace(/\.functionCallReturnValue/g, '');
|
|
133
|
+
const parts = cleanPath.split('.');
|
|
134
|
+
const lastPart = parts[parts.length - 1];
|
|
135
|
+
// Convert camelCase to Title Case with spaces
|
|
136
|
+
return lastPart
|
|
137
|
+
.replace(/([A-Z])/g, ' $1')
|
|
138
|
+
.replace(/^./, (str) => str.toUpperCase())
|
|
139
|
+
.trim();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Generate a flow ID from path and value.
|
|
143
|
+
* Creates a unique, URL-safe identifier.
|
|
144
|
+
*/
|
|
145
|
+
function generateFlowId(path, value) {
|
|
146
|
+
// Clean the path for use in ID
|
|
147
|
+
const cleanPath = path
|
|
148
|
+
.replace(/\(\)/g, '')
|
|
149
|
+
.replace(/\.functionCallReturnValue/g, '')
|
|
150
|
+
.replace(/[<>]/g, '')
|
|
151
|
+
.replace(/\./g, '-');
|
|
152
|
+
// Clean the value
|
|
153
|
+
const cleanValue = value
|
|
154
|
+
.toString()
|
|
155
|
+
.toLowerCase()
|
|
156
|
+
.replace(/[^a-z0-9]/g, '-')
|
|
157
|
+
.replace(/-+/g, '-')
|
|
158
|
+
.replace(/^-|-$/g, '');
|
|
159
|
+
return `${cleanPath}-${cleanValue}`.toLowerCase();
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Infer value type from a string value.
|
|
163
|
+
*/
|
|
164
|
+
function inferValueType(value) {
|
|
165
|
+
if (value === 'true' || value === 'false')
|
|
166
|
+
return 'boolean';
|
|
167
|
+
if (value === 'null' || value === 'undefined')
|
|
168
|
+
return 'null';
|
|
169
|
+
if (!isNaN(Number(value)) && value !== '')
|
|
170
|
+
return 'number';
|
|
171
|
+
return 'string';
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Generate flows from a single conditional usage.
|
|
175
|
+
* Sets impact to 'high' if the conditional controls JSX rendering.
|
|
176
|
+
*/
|
|
177
|
+
function generateFlowsFromUsage(usage, resolvedPath) {
|
|
178
|
+
const flows = [];
|
|
179
|
+
const baseName = generateNameFromPath(resolvedPath);
|
|
180
|
+
// Determine impact based on whether this conditional controls JSX rendering
|
|
181
|
+
// Conditionals that control visual output are high-impact
|
|
182
|
+
const impact = usage.controlsJsxRendering
|
|
183
|
+
? 'high'
|
|
184
|
+
: 'medium';
|
|
185
|
+
if (usage.conditionType === 'truthiness') {
|
|
186
|
+
// Generate both truthy and falsy flows
|
|
187
|
+
const isNegated = usage.isNegated ?? false;
|
|
188
|
+
// Truthy flow (or falsy if negated)
|
|
189
|
+
flows.push({
|
|
190
|
+
id: generateFlowId(resolvedPath, isNegated ? 'falsy' : 'truthy'),
|
|
191
|
+
name: `${baseName} ${isNegated ? 'False' : 'True'}`,
|
|
192
|
+
description: `When ${baseName.toLowerCase()} is ${isNegated ? 'falsy' : 'truthy'}`,
|
|
193
|
+
requiredValues: [
|
|
194
|
+
{
|
|
195
|
+
attributePath: resolvedPath,
|
|
196
|
+
value: isNegated ? 'falsy' : 'truthy',
|
|
197
|
+
comparison: isNegated ? 'falsy' : 'truthy',
|
|
198
|
+
valueType: 'boolean',
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
impact,
|
|
202
|
+
sourceLocation: usage.sourceLocation
|
|
203
|
+
? {
|
|
204
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
205
|
+
column: usage.sourceLocation.column,
|
|
206
|
+
}
|
|
207
|
+
: undefined,
|
|
208
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
209
|
+
});
|
|
210
|
+
// Falsy flow (or truthy if negated)
|
|
211
|
+
flows.push({
|
|
212
|
+
id: generateFlowId(resolvedPath, isNegated ? 'truthy' : 'falsy'),
|
|
213
|
+
name: `${baseName} ${isNegated ? 'True' : 'False'}`,
|
|
214
|
+
description: `When ${baseName.toLowerCase()} is ${isNegated ? 'truthy' : 'falsy'}`,
|
|
215
|
+
requiredValues: [
|
|
216
|
+
{
|
|
217
|
+
attributePath: resolvedPath,
|
|
218
|
+
value: isNegated ? 'truthy' : 'falsy',
|
|
219
|
+
comparison: isNegated ? 'truthy' : 'falsy',
|
|
220
|
+
valueType: 'boolean',
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
impact,
|
|
224
|
+
sourceLocation: usage.sourceLocation
|
|
225
|
+
? {
|
|
226
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
227
|
+
column: usage.sourceLocation.column,
|
|
228
|
+
}
|
|
229
|
+
: undefined,
|
|
230
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else if (usage.conditionType === 'comparison' ||
|
|
234
|
+
usage.conditionType === 'switch') {
|
|
235
|
+
// Generate one flow per compared value
|
|
236
|
+
const values = usage.comparedValues ?? [];
|
|
237
|
+
for (const value of values) {
|
|
238
|
+
flows.push({
|
|
239
|
+
id: generateFlowId(resolvedPath, value),
|
|
240
|
+
name: `${baseName}: ${value}`,
|
|
241
|
+
description: `When ${baseName.toLowerCase()} equals "${value}"`,
|
|
242
|
+
requiredValues: [
|
|
243
|
+
{
|
|
244
|
+
attributePath: resolvedPath,
|
|
245
|
+
value: value,
|
|
246
|
+
comparison: 'equals',
|
|
247
|
+
valueType: inferValueType(value),
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
impact,
|
|
251
|
+
sourceLocation: usage.sourceLocation
|
|
252
|
+
? {
|
|
253
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
254
|
+
column: usage.sourceLocation.column,
|
|
255
|
+
}
|
|
256
|
+
: undefined,
|
|
257
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return flows;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Generate a flow from a compound conditional (all conditions must be satisfied).
|
|
265
|
+
* Sets impact to 'high' if the compound conditional controls JSX rendering.
|
|
266
|
+
*/
|
|
267
|
+
function generateFlowFromCompound(compound, resolvedPaths) {
|
|
268
|
+
// Determine impact based on whether this compound conditional controls JSX rendering
|
|
269
|
+
const impact = compound.controlsJsxRendering
|
|
270
|
+
? 'high'
|
|
271
|
+
: 'medium';
|
|
272
|
+
const requiredValues = [];
|
|
273
|
+
for (const condition of compound.conditions) {
|
|
274
|
+
const resolvedPath = resolvedPaths.get(condition.path);
|
|
275
|
+
if (!resolvedPath) {
|
|
276
|
+
// This shouldn't happen if we pre-filtered, but safety check
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
// Determine the required value based on condition type
|
|
280
|
+
let value;
|
|
281
|
+
let comparison;
|
|
282
|
+
if (condition.conditionType === 'truthiness') {
|
|
283
|
+
// If negated (!foo), we need falsy; otherwise truthy
|
|
284
|
+
value = condition.isNegated ? 'falsy' : 'truthy';
|
|
285
|
+
comparison = condition.isNegated ? 'falsy' : 'truthy';
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
// For comparison/switch, use the first compared value or required value
|
|
289
|
+
value =
|
|
290
|
+
condition.requiredValue?.toString() ??
|
|
291
|
+
condition.comparedValues?.[0] ??
|
|
292
|
+
'truthy';
|
|
293
|
+
comparison = 'equals';
|
|
294
|
+
}
|
|
295
|
+
requiredValues.push({
|
|
296
|
+
attributePath: resolvedPath,
|
|
297
|
+
value,
|
|
298
|
+
comparison,
|
|
299
|
+
valueType: inferValueType(value),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
// Generate a combined ID from all paths
|
|
303
|
+
const pathParts = requiredValues
|
|
304
|
+
.map((rv) => {
|
|
305
|
+
const name = generateNameFromPath(rv.attributePath);
|
|
306
|
+
return name.toLowerCase().replace(/\s+/g, '-');
|
|
307
|
+
})
|
|
308
|
+
.join('-and-');
|
|
309
|
+
return {
|
|
310
|
+
id: `compound-${pathParts}`,
|
|
311
|
+
name: requiredValues
|
|
312
|
+
.map((rv) => generateNameFromPath(rv.attributePath))
|
|
313
|
+
.join(' + '),
|
|
314
|
+
description: `When ${requiredValues.map((rv) => `${generateNameFromPath(rv.attributePath).toLowerCase()} is ${rv.value}`).join(' and ')}`,
|
|
315
|
+
requiredValues,
|
|
316
|
+
impact,
|
|
317
|
+
sourceLocation: {
|
|
318
|
+
lineNumber: compound.sourceLocation.lineNumber,
|
|
319
|
+
column: compound.sourceLocation.column,
|
|
320
|
+
},
|
|
321
|
+
codeSnippet: compound.sourceLocation.codeSnippet,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Generate execution flows from conditional usages using pure static analysis.
|
|
326
|
+
*
|
|
327
|
+
* Only generates flows where all paths resolve to controllable data sources.
|
|
328
|
+
* This ensures we never produce flows with invalid paths like useState variables.
|
|
329
|
+
*/
|
|
330
|
+
/**
|
|
331
|
+
* Normalize a resolved path to a canonical form for deduplication.
|
|
332
|
+
* Uses fullToShortPathMap to convert full paths to short paths.
|
|
333
|
+
* This ensures that both "hasNewerVersion" and
|
|
334
|
+
* "useLoaderData<LoaderData>().functionCallReturnValue.hasNewerVersion"
|
|
335
|
+
* normalize to the same canonical path.
|
|
336
|
+
*/
|
|
337
|
+
function normalizePathForDeduplication(resolvedPath, fullToShortPathMap) {
|
|
338
|
+
// If the path is in fullToShortPathMap, use the short path as canonical
|
|
339
|
+
if (resolvedPath in fullToShortPathMap) {
|
|
340
|
+
return fullToShortPathMap[resolvedPath];
|
|
341
|
+
}
|
|
342
|
+
// Otherwise, the path itself is canonical
|
|
343
|
+
return resolvedPath;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Translate a child component path to a parent path using prop mappings.
|
|
347
|
+
*
|
|
348
|
+
* Given:
|
|
349
|
+
* - childPath: "selectedScenario.metadata.screenshotPaths[0]" (path in child's context)
|
|
350
|
+
* - childEquiv: { selectedScenario: "signature[0].selectedScenario" } (child's internal-to-prop mapping)
|
|
351
|
+
* - parentEquiv: { "ChildName().signature[0].selectedScenario": "selectedScenario" } (parent's prop assignments)
|
|
352
|
+
* - childName: "ChildName"
|
|
353
|
+
*
|
|
354
|
+
* Returns: "selectedScenario.metadata.screenshotPaths[0]" (path in parent's context)
|
|
355
|
+
*
|
|
356
|
+
* The translation works by:
|
|
357
|
+
* 1. Finding the root variable in the child path (e.g., "selectedScenario")
|
|
358
|
+
* 2. Looking up the child's equivalence to find the prop path (e.g., "signature[0].selectedScenario")
|
|
359
|
+
* 3. Building the full child prop path (e.g., "ChildName().signature[0].selectedScenario")
|
|
360
|
+
* 4. Looking up the parent's equivalence to find the parent path (e.g., "selectedScenario")
|
|
361
|
+
* 5. Replacing the root with the parent path and preserving the suffix
|
|
362
|
+
*/
|
|
363
|
+
function translateChildPathToParent(childPath, childEquivalentSignatureVariables, parentEquivalentSignatureVariables, childName) {
|
|
364
|
+
// Extract the root variable from the child path
|
|
365
|
+
// e.g., "selectedScenario.metadata.screenshotPaths[0]" → "selectedScenario"
|
|
366
|
+
const dotIndex = childPath.indexOf('.');
|
|
367
|
+
const bracketIndex = childPath.indexOf('[');
|
|
368
|
+
let rootVar;
|
|
369
|
+
let suffix;
|
|
370
|
+
if (dotIndex === -1 && bracketIndex === -1) {
|
|
371
|
+
rootVar = childPath;
|
|
372
|
+
suffix = '';
|
|
373
|
+
}
|
|
374
|
+
else if (dotIndex === -1) {
|
|
375
|
+
rootVar = childPath.slice(0, bracketIndex);
|
|
376
|
+
suffix = childPath.slice(bracketIndex);
|
|
377
|
+
}
|
|
378
|
+
else if (bracketIndex === -1) {
|
|
379
|
+
rootVar = childPath.slice(0, dotIndex);
|
|
380
|
+
suffix = childPath.slice(dotIndex);
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
const firstIndex = Math.min(dotIndex, bracketIndex);
|
|
384
|
+
rootVar = childPath.slice(0, firstIndex);
|
|
385
|
+
suffix = childPath.slice(firstIndex);
|
|
386
|
+
}
|
|
387
|
+
// Look up the child's equivalence for this root variable
|
|
388
|
+
// e.g., childEquiv[selectedScenario] = "signature[0].selectedScenario"
|
|
389
|
+
const childPropPath = childEquivalentSignatureVariables[rootVar];
|
|
390
|
+
if (!childPropPath) {
|
|
391
|
+
// No mapping found - this might be internal state, not a prop
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
// Build the full child prop path as seen from parent
|
|
395
|
+
// e.g., "ChildName().signature[0].selectedScenario"
|
|
396
|
+
const fullChildPropPath = `${childName}().${childPropPath}`;
|
|
397
|
+
// Look up parent's equivalence to find what value was passed to this prop
|
|
398
|
+
// e.g., parentEquiv["ChildName().signature[0].selectedScenario"] = "selectedScenario"
|
|
399
|
+
const parentValue = parentEquivalentSignatureVariables[fullChildPropPath];
|
|
400
|
+
if (!parentValue) {
|
|
401
|
+
// No parent mapping found - log ALL parent keys that contain the childName
|
|
402
|
+
const relevantParentKeys = Object.keys(parentEquivalentSignatureVariables).filter((k) => k.includes(childName));
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
// Build the translated path: parentValue + suffix
|
|
406
|
+
// e.g., "selectedScenario" + ".metadata.screenshotPaths[0]"
|
|
407
|
+
const result = parentValue + suffix;
|
|
408
|
+
return result;
|
|
409
|
+
}
|
|
410
|
+
export default function generateExecutionFlowsFromConditionals(args) {
|
|
411
|
+
const { conditionalUsages, compoundConditionals, attributesMap, equivalentSignatureVariables, fullToShortPathMap, childComponentData, } = args;
|
|
412
|
+
const flows = [];
|
|
413
|
+
const seenFlowIds = new Set();
|
|
414
|
+
// Track normalized resolved paths to prevent duplicate flows
|
|
415
|
+
// This handles the case where we have usages for both:
|
|
416
|
+
// - "hasNewerVersion" (short path from destructured variable)
|
|
417
|
+
// - "useLoaderData<LoaderData>().functionCallReturnValue.hasNewerVersion" (full path)
|
|
418
|
+
// Both resolve to the same logical data source, so we only want ONE set of flows.
|
|
419
|
+
const seenNormalizedPaths = new Set();
|
|
420
|
+
// Track which usages are part of compound conditionals (to avoid duplicates)
|
|
421
|
+
const compoundChainIds = new Set(compoundConditionals.map((c) => c.chainId).filter(Boolean));
|
|
422
|
+
// Process individual conditional usages
|
|
423
|
+
for (const [_path, usages] of Object.entries(conditionalUsages)) {
|
|
424
|
+
for (const usage of usages) {
|
|
425
|
+
// Skip usages that are part of compound conditionals (handled separately)
|
|
426
|
+
if (usage.chainId && compoundChainIds.has(usage.chainId)) {
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
// First, try to use pre-computed sourceDataPath if available
|
|
430
|
+
let resolvedPath = null;
|
|
431
|
+
if (usage.sourceDataPath) {
|
|
432
|
+
// Clean up the sourceDataPath - it may have redundant scope prefixes
|
|
433
|
+
// e.g., "useLoaderData<LoaderData>.useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
|
|
434
|
+
// should become "useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
|
|
435
|
+
// Returns null for malformed paths (e.g., chained function calls like fetch().json())
|
|
436
|
+
const cleanedPath = cleanSourceDataPath(usage.sourceDataPath);
|
|
437
|
+
if (cleanedPath) {
|
|
438
|
+
// Verify the cleaned path exists in attributesMap
|
|
439
|
+
const pathMatch = findInAttributesMapForPath(cleanedPath, attributesMap, fullToShortPathMap);
|
|
440
|
+
if (pathMatch) {
|
|
441
|
+
resolvedPath = pathMatch;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
// If cleanedPath is null, fall through to use fallback resolution
|
|
445
|
+
}
|
|
446
|
+
// Fall back to resolution via equivalentSignatureVariables
|
|
447
|
+
if (!resolvedPath) {
|
|
448
|
+
const resolution = resolvePathToControllable(usage.path, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
449
|
+
if (resolution.isControllable && resolution.resolvedPath) {
|
|
450
|
+
resolvedPath = resolution.resolvedPath;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// If still not resolved, try using derivedFrom info to find the source path
|
|
454
|
+
// This handles cases like: const hasAnalysis = analysis !== null
|
|
455
|
+
// where hasAnalysis is not in attributesMap but analysis is
|
|
456
|
+
if (!resolvedPath && usage.derivedFrom) {
|
|
457
|
+
const { sourcePath, sourcePaths } = usage.derivedFrom;
|
|
458
|
+
// For single-source derivations (notNull, equals, etc.)
|
|
459
|
+
if (sourcePath) {
|
|
460
|
+
const resolution = resolvePathToControllable(sourcePath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
461
|
+
if (resolution.isControllable && resolution.resolvedPath) {
|
|
462
|
+
resolvedPath = resolution.resolvedPath;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
// For multi-source derivations (or, and), try the first resolvable path
|
|
466
|
+
// This is a simplification - ideally we'd generate flows for each source
|
|
467
|
+
if (!resolvedPath && sourcePaths && sourcePaths.length > 0) {
|
|
468
|
+
for (const sp of sourcePaths) {
|
|
469
|
+
const resolution = resolvePathToControllable(sp, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
470
|
+
if (resolution.isControllable && resolution.resolvedPath) {
|
|
471
|
+
resolvedPath = resolution.resolvedPath;
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (!resolvedPath) {
|
|
478
|
+
// Path is not controllable - skip (no invalid flows possible)
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
// Normalize the resolved path to detect duplicates
|
|
482
|
+
// E.g., both "hasNewerVersion" and "useLoaderData<...>().hasNewerVersion"
|
|
483
|
+
// should normalize to the same canonical path
|
|
484
|
+
const normalizedPath = normalizePathForDeduplication(resolvedPath, fullToShortPathMap);
|
|
485
|
+
// Skip if we've already generated flows for this normalized path
|
|
486
|
+
// This prevents duplicate flows when we have usages for both short and full paths
|
|
487
|
+
if (seenNormalizedPaths.has(normalizedPath)) {
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
seenNormalizedPaths.add(normalizedPath);
|
|
491
|
+
// Generate flows for this controllable usage
|
|
492
|
+
const usageFlows = generateFlowsFromUsage(usage, resolvedPath);
|
|
493
|
+
for (const flow of usageFlows) {
|
|
494
|
+
// Deduplicate by flow ID
|
|
495
|
+
if (!seenFlowIds.has(flow.id)) {
|
|
496
|
+
seenFlowIds.add(flow.id);
|
|
497
|
+
flows.push(flow);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
// Process compound conditionals
|
|
503
|
+
for (const compound of compoundConditionals) {
|
|
504
|
+
// First, check if ALL paths in this compound are controllable
|
|
505
|
+
const resolvedPaths = new Map();
|
|
506
|
+
let allControllable = true;
|
|
507
|
+
for (const condition of compound.conditions) {
|
|
508
|
+
const resolution = resolvePathToControllable(condition.path, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
509
|
+
if (!resolution.isControllable || !resolution.resolvedPath) {
|
|
510
|
+
allControllable = false;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
resolvedPaths.set(condition.path, resolution.resolvedPath);
|
|
514
|
+
}
|
|
515
|
+
// Only create a flow if ALL paths are controllable
|
|
516
|
+
if (allControllable && resolvedPaths.size > 0) {
|
|
517
|
+
const compoundFlow = generateFlowFromCompound(compound, resolvedPaths);
|
|
518
|
+
if (compoundFlow && !seenFlowIds.has(compoundFlow.id)) {
|
|
519
|
+
seenFlowIds.add(compoundFlow.id);
|
|
520
|
+
flows.push(compoundFlow);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
// Process child component conditional usages
|
|
525
|
+
// Translate child paths to parent paths and merge flows
|
|
526
|
+
if (childComponentData) {
|
|
527
|
+
for (const [childName, childData] of Object.entries(childComponentData)) {
|
|
528
|
+
// First, resolve gating conditions to get required values that must be added to all child flows
|
|
529
|
+
const gatingRequiredValues = [];
|
|
530
|
+
if (childData.gatingConditions) {
|
|
531
|
+
for (const gatingCondition of childData.gatingConditions) {
|
|
532
|
+
// Try to resolve via derivedFrom first
|
|
533
|
+
let gatingPath = gatingCondition.path;
|
|
534
|
+
if (gatingCondition.derivedFrom?.sourcePath) {
|
|
535
|
+
gatingPath = gatingCondition.derivedFrom.sourcePath;
|
|
536
|
+
}
|
|
537
|
+
// Fix 32: Handle comparison expressions like "activeTab === 'scenarios'"
|
|
538
|
+
// Extract the variable name and the compared value
|
|
539
|
+
const comparisonMatch = gatingPath.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*(===?|!==?)\s*['"]?([^'"]+)['"]?$/);
|
|
540
|
+
if (comparisonMatch) {
|
|
541
|
+
const [, varName, operator, comparedValue] = comparisonMatch;
|
|
542
|
+
// Try to resolve the variable name
|
|
543
|
+
const varResolution = resolvePathToControllable(varName, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
544
|
+
if (varResolution.isControllable && varResolution.resolvedPath) {
|
|
545
|
+
const isNegated = gatingCondition.isNegated === true;
|
|
546
|
+
const isNotEquals = operator === '!=' || operator === '!==';
|
|
547
|
+
// Determine the effective value for this gating condition
|
|
548
|
+
// If condition is "activeTab === 'scenarios'" and NOT negated, flow needs activeTab = 'scenarios'
|
|
549
|
+
// If condition is "activeTab === 'scenarios'" and IS negated, flow needs activeTab != 'scenarios' (falsy/other value)
|
|
550
|
+
// If condition is "activeTab !== 'scenarios'" and NOT negated, flow needs activeTab != 'scenarios'
|
|
551
|
+
// XOR logic: isNegated XOR isNotEquals
|
|
552
|
+
const needsExactValue = isNegated !== isNotEquals;
|
|
553
|
+
gatingRequiredValues.push({
|
|
554
|
+
attributePath: varResolution.resolvedPath,
|
|
555
|
+
value: needsExactValue ? 'falsy' : comparedValue,
|
|
556
|
+
comparison: needsExactValue ? 'falsy' : 'equals',
|
|
557
|
+
});
|
|
558
|
+
continue; // Skip to next gating condition
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
// Fix 31: Handle compound gating conditions (containing && or ||)
|
|
562
|
+
// e.g., "isEditMode && selectedScenario" should be parsed into individual paths
|
|
563
|
+
const isAndExpression = gatingPath.includes(' && ');
|
|
564
|
+
const isOrExpression = gatingPath.includes(' || ');
|
|
565
|
+
const isCompoundExpression = isAndExpression || isOrExpression;
|
|
566
|
+
if (isCompoundExpression) {
|
|
567
|
+
// Parse the compound expression into individual variable names
|
|
568
|
+
// Split on && and || (with optional spaces)
|
|
569
|
+
const parts = gatingPath.split(/\s*(?:&&|\|\|)\s*/);
|
|
570
|
+
const isNegated = gatingCondition.isNegated === true;
|
|
571
|
+
// Fix 37: Apply DeMorgan's law correctly for compound conditions
|
|
572
|
+
// - !(A && B) = !A || !B: EITHER A is false OR B is false (can't know which)
|
|
573
|
+
// - !(A || B) = !A && !B: BOTH must be false
|
|
574
|
+
// - (A && B): BOTH must be true
|
|
575
|
+
// - (A || B): EITHER is true (can't know which)
|
|
576
|
+
//
|
|
577
|
+
// We should only add gating requirements when we can definitively say
|
|
578
|
+
// all parts must have the same value. This is true for:
|
|
579
|
+
// - Non-negated &&: all parts must be truthy
|
|
580
|
+
// - Negated ||: all parts must be falsy (DeMorgan: !(A || B) = !A && !B)
|
|
581
|
+
//
|
|
582
|
+
// We should NOT add gating requirements when either part could be true/false:
|
|
583
|
+
// - Negated && (DeMorgan: !(A && B) = !A || !B): can't constrain both to falsy
|
|
584
|
+
// - Non-negated ||: can't constrain both to truthy
|
|
585
|
+
const shouldSkipGating = (isAndExpression && isNegated) || // !(A && B) - either could be falsy
|
|
586
|
+
(isOrExpression && !isNegated); // (A || B) - either could be truthy
|
|
587
|
+
if (shouldSkipGating) {
|
|
588
|
+
// Don't add gating requirements for this compound condition
|
|
589
|
+
// The child flow's own requirements will determine what values are needed
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
for (const part of parts) {
|
|
593
|
+
// Clean up the part (remove parentheses, negation, etc.)
|
|
594
|
+
const cleanPart = part
|
|
595
|
+
.replace(/^\(+|\)+$/g, '') // Remove leading/trailing parens
|
|
596
|
+
.replace(/^!+/, '') // Remove leading negation
|
|
597
|
+
.trim();
|
|
598
|
+
if (!cleanPart)
|
|
599
|
+
continue;
|
|
600
|
+
// Try to resolve this individual path
|
|
601
|
+
const partResolution = resolvePathToControllable(cleanPart, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
602
|
+
if (partResolution.isControllable &&
|
|
603
|
+
partResolution.resolvedPath) {
|
|
604
|
+
// For non-negated &&: all parts must be truthy
|
|
605
|
+
// For negated ||: all parts must be falsy (DeMorgan: !(A || B) = !A && !B)
|
|
606
|
+
gatingRequiredValues.push({
|
|
607
|
+
attributePath: partResolution.resolvedPath,
|
|
608
|
+
value: isNegated ? 'falsy' : 'truthy',
|
|
609
|
+
comparison: isNegated ? 'falsy' : 'truthy',
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
// Simple gating condition (single path)
|
|
617
|
+
// Resolve the gating path in parent context
|
|
618
|
+
const gatingResolution = resolvePathToControllable(gatingPath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
619
|
+
if (gatingResolution.isControllable &&
|
|
620
|
+
gatingResolution.resolvedPath) {
|
|
621
|
+
// For truthiness conditions on gating, check if the condition is negated
|
|
622
|
+
// e.g., ternary else branch: isError ? <ErrorView /> : <SuccessView />
|
|
623
|
+
// SuccessView has isNegated: true, meaning it renders when isError is falsy
|
|
624
|
+
const isNegated = gatingCondition.isNegated === true;
|
|
625
|
+
gatingRequiredValues.push({
|
|
626
|
+
attributePath: gatingResolution.resolvedPath,
|
|
627
|
+
value: isNegated ? 'falsy' : 'truthy',
|
|
628
|
+
comparison: isNegated ? 'falsy' : 'truthy',
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
// Track which child usages are part of compound conditionals (to avoid duplicates)
|
|
635
|
+
// Fix 33: Only skip usages that are part of compound conditionals, not all usages with chainIds
|
|
636
|
+
const childCompoundChainIds = new Set(childData.compoundConditionals.map((c) => c.chainId).filter(Boolean));
|
|
637
|
+
for (const [_path, usages] of Object.entries(childData.conditionalUsages)) {
|
|
638
|
+
for (const usage of usages) {
|
|
639
|
+
// Skip usages that are part of compound conditionals (handled separately)
|
|
640
|
+
// Fix 33: Only skip if the chainId is in the child's compound conditionals
|
|
641
|
+
if (usage.chainId && childCompoundChainIds.has(usage.chainId)) {
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
// Determine the child path to translate
|
|
645
|
+
let childPath = usage.path;
|
|
646
|
+
// If the usage has derivedFrom, use the source path instead
|
|
647
|
+
if (usage.derivedFrom?.sourcePath) {
|
|
648
|
+
childPath = usage.derivedFrom.sourcePath;
|
|
649
|
+
}
|
|
650
|
+
// Translate the child path to a parent path
|
|
651
|
+
let translatedPath = translateChildPathToParent(childPath, childData.equivalentSignatureVariables, equivalentSignatureVariables, childName);
|
|
652
|
+
// If translation failed but we have sourceDataPath, try to extract the prop path from it
|
|
653
|
+
// sourceDataPath format: "ChildName.signature[n].propPath.rest" → extract "propPath.rest"
|
|
654
|
+
if (!translatedPath && usage.sourceDataPath) {
|
|
655
|
+
const signatureMatch = usage.sourceDataPath.match(/\.signature\[\d+\]\.(.+)$/);
|
|
656
|
+
if (signatureMatch) {
|
|
657
|
+
translatedPath = signatureMatch[1];
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (!translatedPath) {
|
|
661
|
+
// Could not translate - skip this usage
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
// Now resolve the translated path in the parent context
|
|
665
|
+
const resolution = resolvePathToControllable(translatedPath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
666
|
+
if (!resolution.isControllable || !resolution.resolvedPath) {
|
|
667
|
+
// Path is not controllable in parent context
|
|
668
|
+
continue;
|
|
669
|
+
}
|
|
670
|
+
const resolvedPath = resolution.resolvedPath;
|
|
671
|
+
// Check for duplicates
|
|
672
|
+
const normalizedPath = normalizePathForDeduplication(resolvedPath, fullToShortPathMap);
|
|
673
|
+
if (seenNormalizedPaths.has(normalizedPath)) {
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
seenNormalizedPaths.add(normalizedPath);
|
|
677
|
+
// Generate flows for this translated usage
|
|
678
|
+
// Create a modified usage with the translated path for flow generation
|
|
679
|
+
const translatedUsage = {
|
|
680
|
+
...usage,
|
|
681
|
+
path: resolvedPath,
|
|
682
|
+
};
|
|
683
|
+
const usageFlows = generateFlowsFromUsage(translatedUsage, resolvedPath);
|
|
684
|
+
// Add gating conditions to each flow
|
|
685
|
+
for (const flow of usageFlows) {
|
|
686
|
+
// Add gating required values to the flow
|
|
687
|
+
if (gatingRequiredValues.length > 0) {
|
|
688
|
+
// Filter out any gating values that are already in the flow
|
|
689
|
+
const existingPaths = new Set(flow.requiredValues.map((rv) => rv.attributePath));
|
|
690
|
+
const newGatingValues = gatingRequiredValues.filter((gv) => !existingPaths.has(gv.attributePath));
|
|
691
|
+
flow.requiredValues = [
|
|
692
|
+
...flow.requiredValues,
|
|
693
|
+
...newGatingValues,
|
|
694
|
+
];
|
|
695
|
+
// Update the flow ID to include gating conditions
|
|
696
|
+
if (newGatingValues.length > 0) {
|
|
697
|
+
const gatingIdPart = newGatingValues
|
|
698
|
+
.map((gv) => `${gv.attributePath}-${gv.value}`)
|
|
699
|
+
.join('-');
|
|
700
|
+
flow.id = `${flow.id}-gated-${gatingIdPart}`;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
if (!seenFlowIds.has(flow.id)) {
|
|
704
|
+
seenFlowIds.add(flow.id);
|
|
705
|
+
flows.push(flow);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
// Process child's compound conditionals
|
|
711
|
+
for (const compound of childData.compoundConditionals) {
|
|
712
|
+
const resolvedPaths = new Map();
|
|
713
|
+
let allControllable = true;
|
|
714
|
+
for (const condition of compound.conditions) {
|
|
715
|
+
// Determine the child path to translate
|
|
716
|
+
const childPath = condition.path;
|
|
717
|
+
// Translate the child path to a parent path
|
|
718
|
+
const translatedPath = translateChildPathToParent(childPath, childData.equivalentSignatureVariables, equivalentSignatureVariables, childName);
|
|
719
|
+
if (!translatedPath) {
|
|
720
|
+
allControllable = false;
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
const resolution = resolvePathToControllable(translatedPath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
|
|
724
|
+
if (!resolution.isControllable || !resolution.resolvedPath) {
|
|
725
|
+
allControllable = false;
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
resolvedPaths.set(condition.path, resolution.resolvedPath);
|
|
729
|
+
}
|
|
730
|
+
if (allControllable && resolvedPaths.size > 0) {
|
|
731
|
+
const compoundFlow = generateFlowFromCompound(compound, resolvedPaths);
|
|
732
|
+
if (compoundFlow && !seenFlowIds.has(compoundFlow.id)) {
|
|
733
|
+
seenFlowIds.add(compoundFlow.id);
|
|
734
|
+
flows.push(compoundFlow);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
return flows;
|
|
741
|
+
}
|
|
742
|
+
//# sourceMappingURL=generateExecutionFlowsFromConditionals.js.map
|