@codeyam/codeyam-cli 0.1.0-staging.596f0eb → 0.1.0-staging.6e699e5
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 +10 -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 +128 -6
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +138 -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 +38 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1239 -104
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +304 -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 +1501 -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 +976 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +243 -77
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +103 -6
- 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/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 +89 -112
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +6 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1111 -91
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +207 -104
- 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/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/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 -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/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 +123 -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/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 +455 -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/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 +265 -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 +336 -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 +461 -94
- 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/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 +3 -3
- 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 +87 -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 +196 -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/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.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 +5 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +104 -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 +224 -0
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
- 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 +87 -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 +196 -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/lightweightEntityExtractor.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.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/lightweightEntityExtractor.ts +27 -0
- 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/takeElementScreenshot.ts +26 -11
- package/analyzer-template/playwright/takeScreenshot.ts +9 -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 +1181 -160
- 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 +82 -36
- package/analyzer-template/project/orchestrateCapture.ts +36 -3
- package/analyzer-template/project/reconcileMockDataKeys.ts +245 -2
- package/analyzer-template/project/runAnalysis.ts +11 -0
- package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
- package/analyzer-template/project/serverOnlyModules.ts +194 -21
- package/analyzer-template/project/start.ts +26 -4
- package/analyzer-template/project/startScenarioCapture.ts +79 -41
- package/analyzer-template/project/writeMockDataTsx.ts +232 -57
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +769 -181
- 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 +1053 -124
- 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 +69 -32
- 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 +204 -2
- 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/runMultiScenarioServer.js +11 -9
- package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
- package/background/src/lib/virtualized/project/serverOnlyModules.js +163 -23
- 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 +61 -31
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +199 -50
- 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 +552 -125
- 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 +7 -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 +40 -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 +226 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -0
- 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 +31 -27
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- 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 +14 -4
- 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 +31 -17
- 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 +245 -16
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +25 -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 +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 +98 -1
- 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 +5 -10
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +49 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-efWKDYMr.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-CVtiBnY5.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-B0GLXMsr.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-xgeCVgSM.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-D4TZhLuw.js +21 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DuDvi0jm.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DEx02QDa.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-COPstp9J.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/api.health-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.rules-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-Cx24_aWc.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-BOARzkeR.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BdhJEx6B.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-BRb-0kQl.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-C2N4Op8e.js +23 -0
- 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-CTBG2mmz.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-CS2cb_eZ.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-DMJ7zii9.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-B4RJRvYB.js +15 -0
- 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/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-B1h680n5.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-lzqtyFU8.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-B7B9V-bu.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.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-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/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-CxXUmBSd.js +6 -0
- 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-B6LgvRJg.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C1v1PQzo.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-3pmpUQB-.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-DEyawJ8r.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-967OuJoF.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DRTmerg9.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/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-power-rules-hook.sh +200 -0
- package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +48 -4
- package/codeyam-cli/templates/codeyam:diagnose.md +650 -0
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/codeyam-cli/templates/codeyam:power-rules.md +447 -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 +17 -16
- package/packages/ai/index.js +5 -4
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +99 -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 +100 -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 +23 -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 +945 -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 +178 -31
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1198 -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 +661 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +180 -56
- 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 +86 -4
- 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/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 +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 +904 -84
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +186 -82
- 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/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/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 -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/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/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/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 +218 -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/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 +209 -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 +264 -78
- 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 +372 -89
- 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/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/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
- package/packages/utils/src/lib/lightweightEntityExtractor.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 +6 -4
- 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-CVbSvOjo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-DcwcHyl5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-WgwC1GfJ.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-IEKom9O2.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-BYnfxbUG.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-_lBPJCzG.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-lHVhvsu_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-d_TBk4GQ.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-kGT7VUqj.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DDGmhu7P.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-n_HPRfM_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CbVoyx1U.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-D1VOYveA.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-YR8jjAlu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-B8vP3V_s.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CN6aLCT1.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DA5Jeu2P.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BTeitalf.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-du6UEYD-.js +0 -13
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-BpjkhMoi.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BQGvk4lJ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-DVdYRT-I.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.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-DCG-vks0.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-GazdNeLl.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-0b694d28.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-D3tQP7hx.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-CIY6XmtE.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-CoMDgElu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-agkniXp2.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-B2VUcygF.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-EvdK-zXP.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DGVHQEXD.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CghkTkIL.js +0 -166
- package/codeyam-cli/templates/debug-command.md +0 -303
- 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/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +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
|
@@ -38,6 +38,10 @@ export interface AnalysisOptions {
|
|
|
38
38
|
forceAll?: boolean;
|
|
39
39
|
updateProgress?: (detail: string) => void;
|
|
40
40
|
modelString?: string;
|
|
41
|
+
/** Process data structure preparation sequentially instead of in parallel (for debugging) */
|
|
42
|
+
sequentialDataStructurePrep?: boolean;
|
|
43
|
+
/** Called after data structures are prepared, signaling orchestration can begin */
|
|
44
|
+
onAnalysisProducing?: () => void;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
interface AnalyzeEntitiesArgs {
|
|
@@ -113,6 +117,14 @@ export default async function analyzeEntities({
|
|
|
113
117
|
'Data structure preparation',
|
|
114
118
|
);
|
|
115
119
|
|
|
120
|
+
// Signal that analysis can now produce captures
|
|
121
|
+
// This allows orchestration to start polling for ready analyses
|
|
122
|
+
awsLogDebugLevel(
|
|
123
|
+
1,
|
|
124
|
+
'Data structures prepared, analysis can now produce captures',
|
|
125
|
+
);
|
|
126
|
+
options.onAnalysisProducing?.();
|
|
127
|
+
|
|
116
128
|
// Persist entities so isolatedDataStructure is available in future runs.
|
|
117
129
|
// This ensures stable dependencyAnalyzedTreeSha across multiple analyzeEntities calls.
|
|
118
130
|
const entitiesWithDataStructure = Array.from(allEntities).filter(
|
|
@@ -376,6 +388,12 @@ export default async function analyzeEntities({
|
|
|
376
388
|
// Circular dependency detected in path - skip
|
|
377
389
|
continue;
|
|
378
390
|
}
|
|
391
|
+
// If already visited via another traversal path, skip to avoid deadlock.
|
|
392
|
+
// Its subtree has been fully explored; any leaves are already in leafKeys.
|
|
393
|
+
// Blocking on it would just propagate the block and cause stuck analysis.
|
|
394
|
+
if (visited.has(dependentEntityKey)) {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
379
397
|
isLeaf = false;
|
|
380
398
|
visitEntity(dependentEntity, [...path, dependentEntityKey]);
|
|
381
399
|
}
|
|
@@ -161,6 +161,9 @@ export default async function findOrCreateEntity({
|
|
|
161
161
|
const defaultExport = fileAnalyzer.isDefaultExport(entity.name);
|
|
162
162
|
entity.metadata.namedExport = !defaultExport;
|
|
163
163
|
|
|
164
|
+
// Detect if the entity is an async function/component (Server Component in Next.js)
|
|
165
|
+
entity.metadata.isAsync = fileAnalyzer.isEntityAsync(localEntityName);
|
|
166
|
+
|
|
164
167
|
if (defaultExport) {
|
|
165
168
|
const allEntityNodes = fileAnalyzer.getAllEntityNodes();
|
|
166
169
|
entity.metadata.exportAlias = Object.keys(allEntityNodes).find(
|
package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
Analysis,
|
|
3
|
+
Entity,
|
|
3
4
|
ReadonlyAnalysisMap,
|
|
4
5
|
ReadonlyAnalysis,
|
|
5
6
|
ReadonlyEntity,
|
|
@@ -61,7 +62,10 @@ export default function validateDependencyAnalyses({
|
|
|
61
62
|
for (const dependency of entity.metadata?.importedExports ?? []) {
|
|
62
63
|
const dependencyFilePath =
|
|
63
64
|
dependency.resolvedFilePath ?? dependency.filePath;
|
|
64
|
-
|
|
65
|
+
// Use the entity/import name, not the export name (resolvedName).
|
|
66
|
+
// For default exports, resolvedName is 'default' but the entity is stored
|
|
67
|
+
// under its actual identifier name (e.g., 'QuoteDetailsDrawer').
|
|
68
|
+
const dependencyName = dependency.name;
|
|
65
69
|
|
|
66
70
|
// if the entity has duplicate dependencies, handle gracefully
|
|
67
71
|
if (dependentAnalyses[dependencyFilePath]?.[dependencyName]) {
|
|
@@ -103,6 +107,23 @@ export default function validateDependencyAnalyses({
|
|
|
103
107
|
continue;
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
// Ensure the entity is attached to the analysis.
|
|
111
|
+
// The entity might not be attached if the analysis was loaded from the database
|
|
112
|
+
// without its entity being in the context's entity map.
|
|
113
|
+
// This is critical for generateDataStructure to merge child component tRPC calls.
|
|
114
|
+
let dependentEntity: ReadonlyEntity | undefined = dependentAnalysis.entity;
|
|
115
|
+
if (!dependentEntity) {
|
|
116
|
+
// Try to get the entity from the context
|
|
117
|
+
dependentEntity = context.getEntity(dependencyFilePath, dependencyName);
|
|
118
|
+
if (dependentEntity) {
|
|
119
|
+
// Attach the entity to the analysis (mutating, but necessary for downstream use)
|
|
120
|
+
// We need the double cast because ReadonlyEntity has readonly arrays that aren't
|
|
121
|
+
// assignable to Entity's mutable arrays.
|
|
122
|
+
(dependentAnalysis as unknown as Analysis).entity =
|
|
123
|
+
dependentEntity as unknown as Entity;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
106
127
|
// Store the dependent analysis
|
|
107
128
|
dependentAnalyses[dependencyFilePath] ||= {};
|
|
108
129
|
dependentAnalyses[dependencyFilePath][dependencyName] = dependentAnalysis;
|
|
@@ -125,12 +146,17 @@ export default function validateDependencyAnalyses({
|
|
|
125
146
|
}
|
|
126
147
|
}
|
|
127
148
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
// Only recurse if we have the entity. Without the entity, we can't process
|
|
150
|
+
// the dependency's own dependencies, but we can still use this dependency's
|
|
151
|
+
// analysis data (mergedDataStructure, etc.)
|
|
152
|
+
if (dependentEntity) {
|
|
153
|
+
validateDependencyAnalyses({
|
|
154
|
+
readonlyAnalysis: dependentAnalysis,
|
|
155
|
+
entity: dependentEntity,
|
|
156
|
+
context: context,
|
|
157
|
+
dependentAnalyses,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
134
160
|
}
|
|
135
161
|
|
|
136
162
|
return { dependentAnalyses };
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
import generateDataStructure from './scenarios/generateDataStructure';
|
|
8
8
|
import generateChangesScenarioData from './scenarios/generateChangesScenarioData';
|
|
9
9
|
import generateChangesScenarios from './scenarios/generateChangesScenarios';
|
|
10
|
-
import
|
|
10
|
+
import generateExecutionFlows from './scenarios/generateExecutionFlows';
|
|
11
11
|
import { upsertAnalysesWithScenarios } from '~codeyam/database';
|
|
12
12
|
import { Step } from './enums/steps';
|
|
13
13
|
import recordStep from './recordStep';
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
pushAnalysisError,
|
|
23
23
|
Semaphore,
|
|
24
24
|
} from '~codeyam/utils';
|
|
25
|
+
import deepEqual from '../utils/deepEqual';
|
|
25
26
|
|
|
26
27
|
export interface AnalyzeChangeArgs {
|
|
27
28
|
previousAnalysis: Analysis;
|
|
@@ -115,33 +116,48 @@ export default async function analyzeChange({
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
//
|
|
119
|
-
if (!steps || steps.includes(Step.
|
|
120
|
-
awsLogDebugLevel(1, `
|
|
119
|
+
// ExecutionFlows phase: I/O-bound LLM call, can run in parallel with other entities' Structure
|
|
120
|
+
if (!steps || steps.includes(Step.ExecutionFlows)) {
|
|
121
|
+
awsLogDebugLevel(1, `Generating execution flows for ${entity.name}...`);
|
|
121
122
|
|
|
122
|
-
const { step:
|
|
123
|
-
'
|
|
123
|
+
const { step: executionFlowsStep } = await recordStep(
|
|
124
|
+
'generateExecutionFlows',
|
|
124
125
|
() =>
|
|
125
|
-
|
|
126
|
+
generateExecutionFlows({
|
|
126
127
|
entity,
|
|
127
128
|
analysis,
|
|
128
|
-
dependentAnalyses,
|
|
129
129
|
model,
|
|
130
130
|
updateProgress,
|
|
131
|
+
dependentAnalyses,
|
|
131
132
|
}),
|
|
132
133
|
);
|
|
133
|
-
analysis.status.steps.push(
|
|
134
|
+
analysis.status.steps.push(executionFlowsStep);
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
analysis.metadata.scenariosDataStructure
|
|
138
|
-
previousAnalysis.metadata.scenariosDataStructure
|
|
139
|
-
)
|
|
137
|
+
const dataStructureUnchanged = deepEqual(
|
|
138
|
+
analysis.metadata.scenariosDataStructure,
|
|
139
|
+
previousAnalysis.metadata.scenariosDataStructure,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const executionFlowsUnchanged = deepEqual(
|
|
143
|
+
analysis.metadata.executionFlows,
|
|
144
|
+
previousAnalysis.metadata.executionFlows,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
if (dataStructureUnchanged && executionFlowsUnchanged) {
|
|
140
148
|
awsLogDebugLevel(
|
|
141
149
|
1,
|
|
142
|
-
`Data structure unchanged, reusing previous scenarios for ${entity.name}...`,
|
|
150
|
+
`Data structure and execution flows unchanged, reusing previous scenarios for ${entity.name}...`,
|
|
143
151
|
);
|
|
144
|
-
|
|
152
|
+
// Reuse previous scenarios but mark them for recapture if entity code changed
|
|
153
|
+
analysis.scenarios = previousAnalysis.scenarios.map((scenario) => ({
|
|
154
|
+
...scenario,
|
|
155
|
+
metadata: {
|
|
156
|
+
...scenario.metadata,
|
|
157
|
+
// Only mark for recapture if entity code actually changed
|
|
158
|
+
needsRecapture: entityChanged,
|
|
159
|
+
},
|
|
160
|
+
}));
|
|
145
161
|
} else {
|
|
146
162
|
if (!steps || steps.includes(Step.Scenarios)) {
|
|
147
163
|
awsLogDebugLevel(1, `Generating scenarios for ${entity.name}...`);
|
|
@@ -230,7 +230,7 @@ export default async function analyzeEntity({
|
|
|
230
230
|
|
|
231
231
|
// For partial analyses, skip Step.Structure to reuse existing mergedDataStructure
|
|
232
232
|
if (isPartialAnalysis && !steps) {
|
|
233
|
-
steps = [Step.
|
|
233
|
+
steps = [Step.ExecutionFlows, Step.Scenarios, Step.Data];
|
|
234
234
|
awsLog(
|
|
235
235
|
'CodeYam: continuing from partial analysis, skipping Structure step',
|
|
236
236
|
{
|
|
@@ -271,13 +271,17 @@ export default async function analyzeEntity({
|
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
// Return early if analysis is already complete for its purpose:
|
|
275
|
+
// - Full analysis: has analyzedTreeSha
|
|
276
|
+
// - Dependency analysis: has executionFlows (Structure + ExecutionFlows already ran)
|
|
277
|
+
const isCompleteDependencyAnalysis =
|
|
278
|
+
analyzeAsDependency && !!existingAnalysis.metadata?.executionFlows;
|
|
279
|
+
|
|
274
280
|
if (
|
|
275
281
|
!force &&
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
// existingAnalysis.status?.readyToBeCaptured ||
|
|
280
|
-
// branchCommitSha)
|
|
282
|
+
existingAnalysis.dependencyAnalyzedTreeSha ===
|
|
283
|
+
dependencyAnalyzedTreeSha &&
|
|
284
|
+
(!!existingAnalysis.analyzedTreeSha || isCompleteDependencyAnalysis)
|
|
281
285
|
) {
|
|
282
286
|
awsLogDebugLevel(1, `Using existing analysis for ${entity.name}...`);
|
|
283
287
|
awsLog('Returning existing analysis', {
|
|
@@ -375,7 +379,7 @@ export default async function analyzeEntity({
|
|
|
375
379
|
}
|
|
376
380
|
|
|
377
381
|
if (!steps || steps?.includes(Step.Scenarios)) {
|
|
378
|
-
delete existingAnalysis.metadata.
|
|
382
|
+
delete existingAnalysis.metadata.executionFlows;
|
|
379
383
|
}
|
|
380
384
|
|
|
381
385
|
if (!steps || steps?.includes(Step.Data)) {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
pushAnalysisError,
|
|
19
19
|
Semaphore,
|
|
20
20
|
} from '~codeyam/utils';
|
|
21
|
-
import
|
|
21
|
+
import generateExecutionFlows from './scenarios/generateExecutionFlows';
|
|
22
22
|
|
|
23
23
|
export interface AnalyzeInitialArgs {
|
|
24
24
|
analysis: Analysis;
|
|
@@ -83,30 +83,30 @@ export default async function analyzeInitial({
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
// Short-circuit for test mocking: only generate data structure, skip
|
|
86
|
+
// Short-circuit for test mocking: only generate data structure, skip execution flows and scenarios
|
|
87
87
|
if (process.env.ONLY_DATA_STRUCTURE === 'true') {
|
|
88
88
|
awsLog(
|
|
89
|
-
'CodeYam: Skipping
|
|
89
|
+
'CodeYam: Skipping execution flows and scenario generation (ONLY_DATA_STRUCTURE=true)',
|
|
90
90
|
);
|
|
91
91
|
return { analysis };
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
//
|
|
95
|
-
if (!steps || steps.includes(Step.
|
|
96
|
-
awsLogDebugLevel(1, `
|
|
94
|
+
// ExecutionFlows phase: I/O-bound LLM call, can run in parallel with other entities' Structure
|
|
95
|
+
if (!steps || steps.includes(Step.ExecutionFlows)) {
|
|
96
|
+
awsLogDebugLevel(1, `Generating execution flows for ${entity.name}...`);
|
|
97
97
|
|
|
98
|
-
const { step:
|
|
99
|
-
'
|
|
98
|
+
const { step: executionFlowsStep } = await recordStep(
|
|
99
|
+
'generateExecutionFlows',
|
|
100
100
|
() =>
|
|
101
|
-
|
|
101
|
+
generateExecutionFlows({
|
|
102
102
|
entity,
|
|
103
103
|
analysis,
|
|
104
|
-
dependentAnalyses,
|
|
105
104
|
model,
|
|
106
105
|
updateProgress,
|
|
106
|
+
dependentAnalyses,
|
|
107
107
|
}),
|
|
108
108
|
);
|
|
109
|
-
analysis.status.steps.push(
|
|
109
|
+
analysis.status.steps.push(executionFlowsStep);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
if (analyzeAsDependency) {
|
|
@@ -176,7 +176,6 @@ export default async function analyzeInitial({
|
|
|
176
176
|
analysis.status.steps.push(mockDataStep);
|
|
177
177
|
}
|
|
178
178
|
} catch (error) {
|
|
179
|
-
console.log(error);
|
|
180
179
|
pushAnalysisError({
|
|
181
180
|
status: analysis.status,
|
|
182
181
|
error,
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { DataStructure } from '~codeyam/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enriches mocked dependency array types with fields from child component signatures.
|
|
5
|
+
*
|
|
6
|
+
* When a mocked dependency (e.g., getSurveysAction) returns an array, and elements
|
|
7
|
+
* from that array are passed to child components (e.g., SurveyCard), the child's
|
|
8
|
+
* signatureSchema specifies required fields (e.g., survey.updatedAt). This function
|
|
9
|
+
* enriches the mocked dependency's returnValueSchema so the LLM knows what fields
|
|
10
|
+
* to generate for array elements.
|
|
11
|
+
*
|
|
12
|
+
* Uses usageEquivalencies to trace data flow and ONLY enrich arrays with fields
|
|
13
|
+
* from children that actually receive elements from that array.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* - getSurveysAction returns { data: array }
|
|
17
|
+
* - usageEquivalencies shows: surveys[] -> SurveyCard().signature[0].survey
|
|
18
|
+
* - SurveyCard expects signature[0].survey.updatedAt: date
|
|
19
|
+
* - After enrichment: getSurveysAction().data[]: object, data[].updatedAt: date
|
|
20
|
+
*/
|
|
21
|
+
export default function enrichArrayTypesFromChildSignatures(
|
|
22
|
+
importedExports: {
|
|
23
|
+
filePath?: string;
|
|
24
|
+
name: string;
|
|
25
|
+
isMocked?: boolean;
|
|
26
|
+
}[],
|
|
27
|
+
dependencySchemas: DataStructure['dependencySchemas'],
|
|
28
|
+
usageEquivalencies?: DataStructure['usageEquivalencies'],
|
|
29
|
+
): void {
|
|
30
|
+
// Find all mocked dependencies with array return types
|
|
31
|
+
const mockedArrayPaths: {
|
|
32
|
+
filePath: string;
|
|
33
|
+
entityName: string;
|
|
34
|
+
arrayPath: string; // e.g., "getSurveysAction().functionCallReturnValue.data"
|
|
35
|
+
}[] = [];
|
|
36
|
+
|
|
37
|
+
for (const importedExport of importedExports) {
|
|
38
|
+
if (!importedExport.isMocked || !importedExport.filePath) continue;
|
|
39
|
+
|
|
40
|
+
const schema =
|
|
41
|
+
dependencySchemas?.[importedExport.filePath]?.[importedExport.name]
|
|
42
|
+
?.returnValueSchema;
|
|
43
|
+
if (!schema) continue;
|
|
44
|
+
|
|
45
|
+
// Find paths that are top-level data arrays (not deeply nested, not direct returns)
|
|
46
|
+
// We only want to enrich arrays that likely contain objects passed to children
|
|
47
|
+
// e.g., getSurveysAction().data but NOT:
|
|
48
|
+
// - wrapThrows().data.createdBy (deeply nested)
|
|
49
|
+
// - getStatusOptions().functionCallReturnValue (direct array return - usually options/primitives)
|
|
50
|
+
for (const [path, type] of Object.entries(schema)) {
|
|
51
|
+
// Check if type is array (including nullable/optional variants like 'array | undefined')
|
|
52
|
+
if (!type.startsWith('array')) continue;
|
|
53
|
+
|
|
54
|
+
// Skip paths with computed property patterns like [key], [i], [0], etc.
|
|
55
|
+
// These represent dynamic access patterns, not simple data arrays
|
|
56
|
+
// We only match brackets with content (not empty [] which indicates array element type)
|
|
57
|
+
if (/\[[^\]]+\]/.test(path)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Skip direct array returns (e.g., getStatusOptions().functionCallReturnValue)
|
|
62
|
+
// These are typically specialized arrays like [{label, value}], not entity arrays
|
|
63
|
+
if (path.endsWith('.functionCallReturnValue')) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Check if this is a top-level array (at most one property after functionCallReturnValue)
|
|
68
|
+
// e.g., "foo().functionCallReturnValue.data" is top-level
|
|
69
|
+
// e.g., "foo().functionCallReturnValue.data.createdBy" is nested (skip)
|
|
70
|
+
const returnValueMatch = path.match(/\.functionCallReturnValue\.(.+)$/);
|
|
71
|
+
if (returnValueMatch) {
|
|
72
|
+
const afterReturnValue = returnValueMatch[1];
|
|
73
|
+
// If there's more than one property access, it's nested
|
|
74
|
+
const propertyCount = afterReturnValue.split('.').length;
|
|
75
|
+
if (propertyCount > 1) {
|
|
76
|
+
continue; // Skip deeply nested arrays
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
mockedArrayPaths.push({
|
|
81
|
+
filePath: importedExport.filePath,
|
|
82
|
+
entityName: importedExport.name,
|
|
83
|
+
arrayPath: path,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (mockedArrayPaths.length === 0) return;
|
|
89
|
+
|
|
90
|
+
// Build a map from child component signature paths to their prop fields
|
|
91
|
+
// e.g., "SurveyCard().signature[0].survey" -> { "id": "string", "updatedAt": "date" }
|
|
92
|
+
const childSignatureFieldsByPath: Map<
|
|
93
|
+
string,
|
|
94
|
+
{ propName: string; fields: Record<string, string> }
|
|
95
|
+
> = new Map();
|
|
96
|
+
|
|
97
|
+
// Helper to extract prop name and fields from a signature schema
|
|
98
|
+
const extractSignatureInfo = (
|
|
99
|
+
entityName: string,
|
|
100
|
+
schema: Record<string, string>,
|
|
101
|
+
): void => {
|
|
102
|
+
// Group by prop name (e.g., signature[0].survey.id, signature[0].survey.name -> "survey")
|
|
103
|
+
const propGroups: Record<string, Record<string, string>> = {};
|
|
104
|
+
|
|
105
|
+
for (const [path, type] of Object.entries(schema)) {
|
|
106
|
+
// Match signature[0].propName.field or signature[0].propName[].field patterns
|
|
107
|
+
// The (?:\[\])? makes array props optional, handling both:
|
|
108
|
+
// - signature[0].survey.updatedAt (object prop)
|
|
109
|
+
// - signature[0].questionAnswers[].question.questionText (array prop)
|
|
110
|
+
const match = path.match(/^signature\[0\]\.(\w+)(?:\[\])?\.(.+)$/);
|
|
111
|
+
if (match) {
|
|
112
|
+
const [, propName, fieldPath] = match;
|
|
113
|
+
propGroups[propName] ||= {};
|
|
114
|
+
propGroups[propName][fieldPath] = type;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Store with the full signature path as key
|
|
119
|
+
for (const [propName, fields] of Object.entries(propGroups)) {
|
|
120
|
+
if (Object.keys(fields).length > 0) {
|
|
121
|
+
const signaturePath = `${entityName}().signature[0].${propName}`;
|
|
122
|
+
childSignatureFieldsByPath.set(signaturePath, { propName, fields });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Process all schemas in dependencySchemas
|
|
128
|
+
if (dependencySchemas) {
|
|
129
|
+
for (const [, entities] of Object.entries(dependencySchemas)) {
|
|
130
|
+
for (const [entityName, schemas] of Object.entries(entities)) {
|
|
131
|
+
const signatureSchema = schemas?.signatureSchema;
|
|
132
|
+
if (signatureSchema) {
|
|
133
|
+
extractSignatureInfo(entityName, signatureSchema);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (childSignatureFieldsByPath.size === 0) return;
|
|
140
|
+
|
|
141
|
+
// Helper to check if a local variable name could be derived from a mocked function name
|
|
142
|
+
// e.g., "getSurveys" -> "surveys", "fetchUsers" -> "users", "loadData" -> "data"
|
|
143
|
+
// e.g., "getSurveysAction" -> "surveys" (removes "Action" suffix too)
|
|
144
|
+
const couldBeDerivedFrom = (
|
|
145
|
+
localVarName: string,
|
|
146
|
+
mockedFunctionName: string,
|
|
147
|
+
): boolean => {
|
|
148
|
+
const normalizedVar = localVarName.toLowerCase().replace(/\[\]$/, '');
|
|
149
|
+
let normalizedFunc = mockedFunctionName.toLowerCase();
|
|
150
|
+
|
|
151
|
+
// Direct match (e.g., "surveys" from function "surveys")
|
|
152
|
+
if (normalizedFunc === normalizedVar) return true;
|
|
153
|
+
|
|
154
|
+
// Remove common prefixes like "get", "fetch", "load", "use"
|
|
155
|
+
const prefixPattern = /^(get|fetch|load|use)/i;
|
|
156
|
+
normalizedFunc = normalizedFunc.replace(prefixPattern, '');
|
|
157
|
+
|
|
158
|
+
// Remove common suffixes like "Action", "Query", "Mutation", "Handler"
|
|
159
|
+
const suffixPattern = /(action|query|mutation|handler)$/i;
|
|
160
|
+
normalizedFunc = normalizedFunc.replace(suffixPattern, '');
|
|
161
|
+
|
|
162
|
+
// Check if function name (without prefix/suffix) matches the variable name
|
|
163
|
+
if (normalizedFunc === normalizedVar) return true;
|
|
164
|
+
|
|
165
|
+
// Check for singular/plural relationship
|
|
166
|
+
// e.g., "survey" from "getSurveys" or "surveys" from "getSurvey"
|
|
167
|
+
if (
|
|
168
|
+
normalizedFunc.endsWith('s') &&
|
|
169
|
+
normalizedFunc.slice(0, -1) === normalizedVar
|
|
170
|
+
)
|
|
171
|
+
return true;
|
|
172
|
+
if (
|
|
173
|
+
normalizedVar.endsWith('s') &&
|
|
174
|
+
normalizedVar.slice(0, -1) === normalizedFunc
|
|
175
|
+
)
|
|
176
|
+
return true;
|
|
177
|
+
|
|
178
|
+
// Check if the array property name (like "data") is in the variable
|
|
179
|
+
// This handles cases like "const { data: surveys } = getSurveys()" where
|
|
180
|
+
// the local var might be the renamed destructured property
|
|
181
|
+
// Skip this for now as it's too loose
|
|
182
|
+
|
|
183
|
+
return false;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// For each mocked array, find which child signatures it flows to via usageEquivalencies
|
|
187
|
+
for (const { filePath, entityName, arrayPath } of mockedArrayPaths) {
|
|
188
|
+
const schema = dependencySchemas[filePath][entityName].returnValueSchema;
|
|
189
|
+
|
|
190
|
+
// Check if this array already has element type definitions
|
|
191
|
+
// If so, skip it - it's likely a specialized array like [null] for refs
|
|
192
|
+
const elementPathPrefix = `${arrayPath}[`;
|
|
193
|
+
const hasExistingElementType = Object.keys(schema).some((path) =>
|
|
194
|
+
path.startsWith(elementPathPrefix),
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
if (hasExistingElementType) {
|
|
198
|
+
// Array already has element type info (e.g., useAutoAnimate()[0]: null)
|
|
199
|
+
// Don't override it with child signature fields
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Find matching child signatures via usageEquivalencies
|
|
204
|
+
// Look for equivalencies where this array (or local variables derived from it)
|
|
205
|
+
// flows to a child component's signature
|
|
206
|
+
const matchedFields: Record<string, string> = {};
|
|
207
|
+
|
|
208
|
+
if (usageEquivalencies) {
|
|
209
|
+
// Check all equivalency entries for paths that could be derived from this array
|
|
210
|
+
for (const [sourcePath, targets] of Object.entries(usageEquivalencies)) {
|
|
211
|
+
// Check if this source path relates to our mocked array
|
|
212
|
+
// Direct match: "getSurveysAction().functionCallReturnValue.data[]"
|
|
213
|
+
// Indirect match: local variable like "surveys[]" that comes from the array
|
|
214
|
+
if (!sourcePath.endsWith('[]')) continue;
|
|
215
|
+
|
|
216
|
+
// Get the local variable name from the source path (e.g., "surveys[]" -> "surveys")
|
|
217
|
+
const localVarName = sourcePath.replace(/\[\]$/, '');
|
|
218
|
+
|
|
219
|
+
// Check if this local variable could have come from this mocked function
|
|
220
|
+
// Use heuristics: name matching (getSurveys -> surveys, getUsers -> users)
|
|
221
|
+
if (!couldBeDerivedFrom(localVarName, entityName)) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
for (const target of targets) {
|
|
226
|
+
// Target should be something like "SurveyCard().signature[0].survey"
|
|
227
|
+
// or "SurveyCard().signature[0].surveys[]"
|
|
228
|
+
const { schemaPath } = target;
|
|
229
|
+
|
|
230
|
+
// Look for signature fields that match this target
|
|
231
|
+
// Handle both singular (survey) and plural (surveys[]) forms
|
|
232
|
+
const normalizedTarget = schemaPath.replace(/\[\]$/, '');
|
|
233
|
+
|
|
234
|
+
for (const [signaturePath, info] of childSignatureFieldsByPath) {
|
|
235
|
+
if (normalizedTarget === signaturePath) {
|
|
236
|
+
// Found a match! Add all fields from this child signature
|
|
237
|
+
for (const [fieldPath, type] of Object.entries(info.fields)) {
|
|
238
|
+
if (!matchedFields[fieldPath]) {
|
|
239
|
+
matchedFields[fieldPath] = type;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// If no equivalencies matched, skip this array entirely
|
|
249
|
+
// This prevents the bug where ALL child signatures get merged into ALL arrays
|
|
250
|
+
if (Object.keys(matchedFields).length === 0) {
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Add array element type and matched fields
|
|
255
|
+
const elementPath = `${arrayPath}[]`;
|
|
256
|
+
schema[elementPath] = 'object';
|
|
257
|
+
|
|
258
|
+
for (const [fieldPath, type] of Object.entries(matchedFields)) {
|
|
259
|
+
const fullPath = `${elementPath}.${fieldPath}`;
|
|
260
|
+
if (!schema[fullPath]) {
|
|
261
|
+
schema[fullPath] = type;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { DataStructure } from '~codeyam/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enriches mocked dependency return value types using sourceEquivalencies.
|
|
5
|
+
*
|
|
6
|
+
* When a mocked dependency returns a value with an `unknown` type, and that value
|
|
7
|
+
* is passed to a child component, we can infer the type from the child's signature.
|
|
8
|
+
* The sourceEquivalencies track this data flow.
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
* - trpc.quote.getQuoteQuestionAnswers.useQuery().functionCallReturnValue.data is `unknown`
|
|
12
|
+
* - sourceEquivalencies shows this data flows to QuoteHeaderExcel().signature[0].questionAnswers
|
|
13
|
+
* - QuoteHeaderExcel's signatureSchema says signature[0].questionAnswers is `array | undefined`
|
|
14
|
+
* - Therefore, data should be `array | undefined`
|
|
15
|
+
*
|
|
16
|
+
* Without this enrichment, fillInDirectSchemaGapsAndUnknowns will guess the type
|
|
17
|
+
* based on the property name, often incorrectly (e.g., 'data' becomes 'number'
|
|
18
|
+
* because pluralize.isPlural('data') returns true).
|
|
19
|
+
*/
|
|
20
|
+
export default function enrichUnknownTypesFromSourceEquivalencies(
|
|
21
|
+
isolatedDependencySchemas: DataStructure['dependencySchemas'],
|
|
22
|
+
mergedDependencySchemas: DataStructure['dependencySchemas'],
|
|
23
|
+
mockedImports: { filePath?: string; name: string; isMocked?: boolean }[],
|
|
24
|
+
): void {
|
|
25
|
+
// Build a map of mocked dependency schemas for quick lookup
|
|
26
|
+
const mockedSchemas = new Map<string, Record<string, string>>();
|
|
27
|
+
for (const imp of mockedImports) {
|
|
28
|
+
if (!imp.isMocked || !imp.filePath) continue;
|
|
29
|
+
const schema =
|
|
30
|
+
mergedDependencySchemas?.[imp.filePath]?.[imp.name]?.returnValueSchema;
|
|
31
|
+
if (schema) {
|
|
32
|
+
mockedSchemas.set(`${imp.filePath}:${imp.name}`, schema);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (mockedSchemas.size === 0) return;
|
|
37
|
+
|
|
38
|
+
// Iterate over all sourceEquivalencies in all dependency schemas
|
|
39
|
+
for (const filePath in isolatedDependencySchemas) {
|
|
40
|
+
for (const entityName in isolatedDependencySchemas[filePath]) {
|
|
41
|
+
const depSchema = isolatedDependencySchemas[filePath][entityName];
|
|
42
|
+
const sourceEquivs = depSchema.sourceEquivalencies;
|
|
43
|
+
if (!sourceEquivs) continue;
|
|
44
|
+
|
|
45
|
+
// For each sourceEquivalency: key is destination, value contains sources
|
|
46
|
+
for (const [destinationPath, sources] of Object.entries(sourceEquivs)) {
|
|
47
|
+
// Parse the destination to get the child entity name and signature path
|
|
48
|
+
// e.g., "QuoteHeaderExcel().signature[0].questionAnswers" ->
|
|
49
|
+
// entityName: "QuoteHeaderExcel", sigPath: "signature[0].questionAnswers"
|
|
50
|
+
const destMatch = destinationPath.match(/^(\w+)\(\)\.(.+)$/);
|
|
51
|
+
if (!destMatch) continue;
|
|
52
|
+
|
|
53
|
+
const [, destEntityName, destSigPath] = destMatch;
|
|
54
|
+
|
|
55
|
+
// Find the child's signatureSchema to get the destination type
|
|
56
|
+
let destType: string | undefined;
|
|
57
|
+
for (const depFilePath in mergedDependencySchemas) {
|
|
58
|
+
const childSchema =
|
|
59
|
+
mergedDependencySchemas[depFilePath][destEntityName];
|
|
60
|
+
if (childSchema?.signatureSchema?.[destSigPath]) {
|
|
61
|
+
destType = childSchema.signatureSchema[destSigPath];
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!destType || destType === 'unknown') continue;
|
|
67
|
+
|
|
68
|
+
// Now check each source to see if it's a mocked dependency with unknown type
|
|
69
|
+
for (const source of sources) {
|
|
70
|
+
const { scopeNodeName, schemaPath } = source;
|
|
71
|
+
|
|
72
|
+
// Find which mocked dependency this belongs to
|
|
73
|
+
for (const [key, schema] of mockedSchemas) {
|
|
74
|
+
const [mockedFilePath, mockedName] = key.split(':');
|
|
75
|
+
|
|
76
|
+
// Check if this source path is in the mocked dependency's schema
|
|
77
|
+
// The schemaPath contains the full path like:
|
|
78
|
+
// "trpc.quote.getQuoteQuestionAnswers.useQuery(...).functionCallReturnValue.data"
|
|
79
|
+
// We need to find it in the returnValueSchema
|
|
80
|
+
if (schema[schemaPath] === 'unknown') {
|
|
81
|
+
// Found an unknown type that flows to a known type!
|
|
82
|
+
schema[schemaPath] = destType;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Also check without the functionCallReturnValue part
|
|
86
|
+
// (some schemas might have the transformed path)
|
|
87
|
+
const transformedPath = schemaPath.replace(
|
|
88
|
+
/\.functionCallReturnValue/g,
|
|
89
|
+
'',
|
|
90
|
+
);
|
|
91
|
+
if (
|
|
92
|
+
transformedPath !== schemaPath &&
|
|
93
|
+
schema[transformedPath] === 'unknown'
|
|
94
|
+
) {
|
|
95
|
+
schema[transformedPath] = destType;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|