@codeyam/codeyam-cli 0.1.0-staging.e38f7bd → 0.1.0-staging.eb21b2f
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 +21 -17
- package/analyzer-template/packages/ai/index.ts +21 -5
- package/analyzer-template/packages/ai/package.json +4 -4
- package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +228 -24
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +205 -10
- package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +181 -23
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
- 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 +1619 -125
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +324 -5
- 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 +2543 -399
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +21 -4
- 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/BatchSchemaProcessor.ts +16 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +71 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +161 -19
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +163 -14
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +441 -82
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -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 +63 -2
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1419 -101
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +216 -109
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +710 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -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 +328 -7
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +17 -7
- 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 +110 -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 +824 -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 +127 -3
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +121 -2
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
- package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
- 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/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +570 -180
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +54 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
- 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/analyzeRemixRoute.ts +4 -5
- package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +22 -13
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +313 -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 +711 -78
- 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 +550 -137
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +264 -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 +1067 -167
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
- package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
- 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/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +18 -5
- package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
- package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
- package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
- package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
- package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
- package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
- package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
- package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +30 -5
- package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
- package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
- package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
- 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/directExecutionScript.ts +17 -2
- package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
- package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +4 -2
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +13 -3
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
- 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/commitsTable.d.ts +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.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/labsRequestsTable.d.ts +23 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
- package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +23 -5
- package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
- package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.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/directExecutionScript.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js +10 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.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/Commit.d.ts +2 -0
- package/analyzer-template/packages/github/dist/types/src/types/Commit.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/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.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 +199 -3
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.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/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +26 -2
- package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.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/package.json +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/Commit.ts +2 -0
- package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +7 -0
- package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +228 -3
- package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
- package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
- package/analyzer-template/packages/ui-components/package.json +4 -4
- 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/Commit.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/types/src/types/Commit.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/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.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 +199 -3
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.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/applyUniversalMocks.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +26 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +93 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.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/applyUniversalMocks.ts +28 -2
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +108 -2
- 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 +57 -26
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
- package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
- package/analyzer-template/playwright/takeScreenshot.ts +15 -9
- package/analyzer-template/playwright/waitForServer.ts +21 -6
- package/analyzer-template/project/TESTING.md +83 -0
- package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
- package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
- package/analyzer-template/project/analyzeFileEntities.ts +4 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
- package/analyzer-template/project/constructMockCode.ts +1319 -158
- package/analyzer-template/project/controller/startController.ts +16 -1
- package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
- package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
- package/analyzer-template/project/loadReadyToBeCaptured.ts +82 -42
- package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
- package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
- package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +13 -9
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +93 -42
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +88 -12
- 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 +413 -0
- package/analyzer-template/project/start.ts +72 -19
- package/analyzer-template/project/startScenarioCapture.ts +79 -41
- package/analyzer-template/project/writeMockDataTsx.ts +466 -73
- package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
- package/analyzer-template/project/writeScenarioComponents.ts +1447 -214
- package/analyzer-template/project/writeScenarioFiles.ts +26 -0
- package/analyzer-template/project/writeSimpleRoot.ts +56 -22
- package/analyzer-template/project/writeUniversalMocks.ts +32 -11
- package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
- package/analyzer-template/scripts/defaultCmd.sh +9 -0
- package/analyzer-template/tsconfig.json +2 -1
- package/background/src/lib/local/createLocalAnalyzer.js +2 -30
- 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 +7 -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 +7 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
- package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +1171 -120
- 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/createEntitiesAndSortFiles.js +73 -1
- package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.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/loadReadyToBeCaptured.js +34 -9
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.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/AwsCaptureTaskRunner.js +2 -2
- package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +12 -6
- package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +73 -36
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +72 -13
- 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 +338 -0
- package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
- package/background/src/lib/virtualized/project/start.js +62 -19
- 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 +404 -62
- 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 +1066 -146
- 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 +57 -20
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +27 -12
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +180 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/cli.js +11 -1
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +18 -2
- package/codeyam-cli/src/codeyam-cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +5 -3
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +176 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -0
- package/codeyam-cli/src/commands/debug.js +44 -18
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +30 -34
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +49 -257
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +307 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/commands/recapture.js +228 -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/setup-sandbox.js +2 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
- package/codeyam-cli/src/commands/setup-simulations.js +284 -0
- package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
- 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 +3 -1
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/verify.js +14 -2
- package/codeyam-cli/src/commands/verify.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__/npmVersionCheck.test.js +179 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.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 +128 -82
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +29 -15
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +7 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +104 -23
- 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 +76 -42
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
- package/codeyam-cli/src/utils/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.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 +249 -16
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +103 -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/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +378 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +6 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +83 -0
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
- package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +137 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/serverState.js +37 -10
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +21 -42
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/versionInfo.js +46 -15
- 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/__tests__/dependency-smoke.test.js +66 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +118 -6
- 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 +55 -10
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +60 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-jNYXRRNI.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-bwuHPyTa.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-kykTbcnD.js → EntityTypeBadge-CvzqMxcu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BH0XDim7.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-yjIHlOGa.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-Cq5o8jL4.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-BvMu2i-g.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-kgBTLoJD.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-BzPgx-xO.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CwZrv-Ok.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BX2Ny2Qj.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-C06nsHKY.js → TruncatedFilePath-CDpEprKa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BRx8ZGZo.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-4S4yPfFw.js +27 -0
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +17 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-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.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-D4IPYH_y.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-CG65viiV.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-DB3aFuEO.js +51 -0
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-igfMr5DY.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/copy-Coc4o_8c.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-D1zB-pYc.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-JTAjQ54M.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CYqBrC9s.js → entity._sha._-B0h9AqE6.js} +22 -15
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-PePWg17F.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-I-Wo99C_.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-9sMMAiWJ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-Co65J0s3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-BdHOxVfg.js +15 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.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-CUM5iXwc.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-_417gcQW.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-TzRHMVog.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +78 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-hjzB7t2z.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/search-DcAwD_Ln.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DVNJVQgD.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/terminal-DbEAHMbA.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CAD5b1o_.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-Blr5oZDE.js → useLastLogLine-DAFqfEDH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DZlYx2c4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-Bbf4Hokd.js → useToast-ihdMtlf6.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-CXfuiwt3.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BSvme_Ao.js +259 -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} +48 -4
- package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
- package/codeyam-cli/templates/codeyam-memory.md +396 -0
- package/codeyam-cli/templates/codeyam-new-rule.md +13 -0
- package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam-setup.md} +151 -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/codeyam-cli/templates/rule-notification-hook.py +56 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +627 -0
- package/codeyam-cli/templates/rules-instructions.md +132 -0
- package/package.json +25 -22
- package/packages/ai/index.js +8 -6
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +181 -13
- 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 +154 -9
- 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 +138 -23
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.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 +1235 -104
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
- package/packages/ai/src/lib/astScopes/sharedPatterns.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 +1961 -224
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +19 -4
- 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/BatchSchemaProcessor.js +13 -3
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +66 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +139 -13
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +142 -12
- 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/convertTypeAnnotationsToValues.js +173 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
- package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +371 -73
- 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 +130 -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 +50 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +1127 -91
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +193 -83
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +495 -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 +1807 -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 +270 -7
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
- package/packages/ai/src/lib/mergeStatements.js +88 -46
- package/packages/ai/src/lib/mergeStatements.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +16 -4
- 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 +83 -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 +677 -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 +98 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/FileAnalyzer.js +75 -36
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
- package/packages/analyze/src/lib/ProjectAnalyzer.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/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +428 -123
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +42 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
- package/packages/analyze/src/lib/files/analyze/dependencyResolver.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/gatherEntityMap.js +2 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
- 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/analyzeRemixRoute.js +3 -2
- package/packages/analyze/src/lib/files/analyzeRemixRoute.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/getImportedExports.js +17 -8
- package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +255 -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 +550 -62
- 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 +404 -85
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +144 -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 +875 -141
- 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/analyze/src/lib/files/setImportedExports.js +2 -1
- package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
- package/packages/analyze/src/lib/index.js +1 -0
- package/packages/analyze/src/lib/index.js.map +1 -1
- package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
- package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
- 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/analysisBranchToDb.js +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/packages/database/src/lib/analysisToDb.js +1 -1
- package/packages/database/src/lib/analysisToDb.js.map +1 -1
- package/packages/database/src/lib/branchToDb.js +1 -1
- package/packages/database/src/lib/branchToDb.js.map +1 -1
- package/packages/database/src/lib/commitBranchToDb.js +1 -1
- package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
- package/packages/database/src/lib/commitToDb.js +1 -1
- package/packages/database/src/lib/commitToDb.js.map +1 -1
- package/packages/database/src/lib/fileToDb.js +1 -1
- package/packages/database/src/lib/fileToDb.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +13 -3
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
- package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
- 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/kysely/tables/labsRequestsTable.js +35 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/packages/database/src/lib/loadAnalyses.js +45 -2
- package/packages/database/src/lib/loadAnalyses.js.map +1 -1
- package/packages/database/src/lib/loadAnalysis.js +8 -0
- package/packages/database/src/lib/loadAnalysis.js.map +1 -1
- package/packages/database/src/lib/loadBranch.js +11 -1
- package/packages/database/src/lib/loadBranch.js.map +1 -1
- package/packages/database/src/lib/loadCommit.js +7 -0
- package/packages/database/src/lib/loadCommit.js.map +1 -1
- package/packages/database/src/lib/loadCommits.js +22 -1
- package/packages/database/src/lib/loadCommits.js.map +1 -1
- package/packages/database/src/lib/loadEntities.js +23 -4
- package/packages/database/src/lib/loadEntities.js.map +1 -1
- package/packages/database/src/lib/loadEntityBranches.js +9 -0
- package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +23 -5
- package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
- package/packages/database/src/lib/projectToDb.js +1 -1
- package/packages/database/src/lib/projectToDb.js.map +1 -1
- package/packages/database/src/lib/saveFiles.js +1 -1
- package/packages/database/src/lib/saveFiles.js.map +1 -1
- package/packages/database/src/lib/scenarioToDb.js +1 -1
- package/packages/database/src/lib/scenarioToDb.js.map +1 -1
- package/packages/database/src/lib/updateCommitMetadata.js +5 -4
- package/packages/database/src/lib/updateCommitMetadata.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/directExecutionScript.js +10 -1
- package/packages/generate/src/lib/directExecutionScript.js.map +1 -1
- package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
- package/packages/generate/src/lib/getComponentScenarioPath.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/applyUniversalMocks.js +26 -2
- package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +93 -2
- package/packages/utils/src/lib/fs/rsyncCopy.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 +8 -74
- 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/ai/src/lib/transformMockDataToMatchSchema.ts +0 -156
- 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-D4htqD-x.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Catz6XEN.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-TlHocYno.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CVMmGuIc.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/LogViewer-JkfQ-VaI.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-CVZ0H4BL.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BrMAP1nP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CJhE4cCv.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-faVIcr_i.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLMa2sgx.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DwYjrK_h.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CgXbbZRx.js +0 -26
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-B2oHQ-zo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BBYuR56H.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CT0Q5lVu.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-Bj5GHkhb.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-eW5z9AyZ.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-B9tSboXM.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-CmO-EZAB.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-DLinnTOx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-CIxwBQvb.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-xPz593l2.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-_LjBsTxX.js +0 -8
- package/codeyam-cli/src/webserver/build/client/assets/loader-circle-D_EGChhq.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-ca438c41.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-CHHYHuzL.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-DY8yoDpH.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-BT6wVHd5.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-gv3H7JV7.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BthANBVv.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CANr3QJ5.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-BtBPtyHx.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-N2cTnejq.js +0 -166
- package/codeyam-cli/templates/debug-command.md +0 -141
- 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/ai/src/lib/transformMockDataToMatchSchema.js +0 -124
- package/packages/ai/src/lib/transformMockDataToMatchSchema.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
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import completionCall from './completionCall';
|
|
2
2
|
import generateEntityScenarioDataGenerator from './promptGenerators/generateEntityScenarioDataGenerator';
|
|
3
|
+
import generateMissingKeysPrompt from './promptGenerators/generateMissingKeysPrompt';
|
|
4
|
+
import generateChunkPrompt from './promptGenerators/generateChunkPrompt';
|
|
3
5
|
import { saveLlmCall } from '~codeyam/aws/dynamodb';
|
|
6
|
+
import { trackDataSnapshot } from './e2eDataTracking';
|
|
4
7
|
import type {
|
|
5
8
|
Analysis,
|
|
6
9
|
Entity,
|
|
10
|
+
ExecutionFlow,
|
|
7
11
|
Scenario,
|
|
8
12
|
ScenarioData,
|
|
9
13
|
ScenariosDataStructure,
|
|
@@ -11,16 +15,650 @@ import type {
|
|
|
11
15
|
import validateJson from './validateJson';
|
|
12
16
|
import { awsLog, awsLogDebugLevel } from '~codeyam/utils';
|
|
13
17
|
import { AI, parseJsonSafe } from '~codeyam/ai';
|
|
14
|
-
import
|
|
18
|
+
import convertNullToUndefinedBySchema from './dataStructure/helpers/convertNullToUndefinedBySchema';
|
|
19
|
+
import convertTypeAnnotationsToValues from './dataStructure/helpers/convertTypeAnnotationsToValues';
|
|
20
|
+
import fixNullIdsBySchema from './dataStructure/helpers/fixNullIdsBySchema';
|
|
21
|
+
import coerceObjectsToPrimitivesBySchema from './dataStructure/helpers/coerceObjectsToPrimitivesBySchema';
|
|
22
|
+
import { JsonTypeDefinition } from '~codeyam/types';
|
|
23
|
+
import { deepMerge } from '~codeyam/generate';
|
|
24
|
+
import {
|
|
25
|
+
chunkDataStructure,
|
|
26
|
+
getRequiredValuesForChunk,
|
|
27
|
+
} from './dataStructureChunking';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Check if any of the scenario's covered flows require error data.
|
|
31
|
+
* Returns true if any requiredValue has an error path with truthy comparison.
|
|
32
|
+
*/
|
|
33
|
+
function scenarioRequiresErrorData(
|
|
34
|
+
scenario: Scenario,
|
|
35
|
+
executionFlows: ExecutionFlow[] | undefined,
|
|
36
|
+
): boolean {
|
|
37
|
+
const coveredFlowIds = scenario.metadata?.coveredFlows || [];
|
|
38
|
+
for (const flowId of coveredFlowIds) {
|
|
39
|
+
const flow = executionFlows?.find((f) => f.id === flowId);
|
|
40
|
+
if (!flow?.requiredValues) continue;
|
|
41
|
+
for (const rv of flow.requiredValues) {
|
|
42
|
+
// Check if any requiredValue has an error path and requires it to be truthy
|
|
43
|
+
if (
|
|
44
|
+
rv.attributePath?.toLowerCase().includes('.error') &&
|
|
45
|
+
rv.comparison === 'truthy'
|
|
46
|
+
) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Deep merge scenario data with default scenario data.
|
|
56
|
+
* The scenario-specific data takes precedence, with default filling in missing fields.
|
|
57
|
+
*
|
|
58
|
+
* IMPORTANT: null values are PRESERVED (not removed) in the result.
|
|
59
|
+
* This is critical because writeMockDataTsx.ts does another deepMerge with default data,
|
|
60
|
+
* and it needs null values to prevent defaults from being filled back in.
|
|
61
|
+
* If we removed null here, the second merge would restore the defaults,
|
|
62
|
+
* making scenarios identical to the default scenario.
|
|
63
|
+
*/
|
|
64
|
+
function deepMergeScenarioData(
|
|
65
|
+
defaultData: Record<string, any>,
|
|
66
|
+
scenarioData: Record<string, any>,
|
|
67
|
+
): Record<string, any> {
|
|
68
|
+
// Guard against non-object inputs (LLM sometimes returns primitives)
|
|
69
|
+
if (
|
|
70
|
+
typeof scenarioData !== 'object' ||
|
|
71
|
+
scenarioData === null ||
|
|
72
|
+
Array.isArray(scenarioData)
|
|
73
|
+
) {
|
|
74
|
+
// Return scenario value directly if it's not a mergeable object
|
|
75
|
+
return scenarioData;
|
|
76
|
+
}
|
|
77
|
+
if (
|
|
78
|
+
typeof defaultData !== 'object' ||
|
|
79
|
+
defaultData === null ||
|
|
80
|
+
Array.isArray(defaultData)
|
|
81
|
+
) {
|
|
82
|
+
// Return scenario value if default isn't mergeable
|
|
83
|
+
return scenarioData;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const result: Record<string, any> = {};
|
|
87
|
+
|
|
88
|
+
// Start with all keys from default
|
|
89
|
+
for (const key of Object.keys(defaultData)) {
|
|
90
|
+
if (key in scenarioData) {
|
|
91
|
+
const scenarioValue = scenarioData[key];
|
|
92
|
+
const defaultValue = defaultData[key];
|
|
93
|
+
|
|
94
|
+
// null means explicitly override with null (falsy value)
|
|
95
|
+
// IMPORTANT: We preserve null instead of removing the key
|
|
96
|
+
// This ensures writeMockDataTsx's deepMerge won't fill in defaults
|
|
97
|
+
if (scenarioValue === null) {
|
|
98
|
+
result[key] = null;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Deep merge objects (but not arrays)
|
|
103
|
+
if (
|
|
104
|
+
typeof scenarioValue === 'object' &&
|
|
105
|
+
!Array.isArray(scenarioValue) &&
|
|
106
|
+
typeof defaultValue === 'object' &&
|
|
107
|
+
!Array.isArray(defaultValue) &&
|
|
108
|
+
defaultValue !== null
|
|
109
|
+
) {
|
|
110
|
+
result[key] = deepMergeScenarioData(defaultValue, scenarioValue);
|
|
111
|
+
} else {
|
|
112
|
+
// Use scenario value (overrides default)
|
|
113
|
+
result[key] = scenarioValue;
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
// Key not in scenario, use default
|
|
117
|
+
result[key] = defaultData[key];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Add any keys that are only in scenario data (including null values)
|
|
122
|
+
for (const key of Object.keys(scenarioData)) {
|
|
123
|
+
if (!(key in defaultData)) {
|
|
124
|
+
result[key] = scenarioData[key];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
15
130
|
|
|
16
131
|
const DEFAULT_SCENARIO_NAME = 'Default Scenario';
|
|
17
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Find the path to a key within a nested dataForMocks structure.
|
|
135
|
+
* Returns the path as an array of keys, or null if not found.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* // dataForMocks = { trpc: { fastener: { "useMutation()": { isLoading: "boolean" } } } }
|
|
139
|
+
* // findKeyPath("fastener", dataForMocks) returns ["trpc"]
|
|
140
|
+
*/
|
|
141
|
+
function findKeyPath(
|
|
142
|
+
targetKey: string,
|
|
143
|
+
obj: JsonTypeDefinition,
|
|
144
|
+
currentPath: string[] = [],
|
|
145
|
+
): string[] | null {
|
|
146
|
+
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (const key of Object.keys(obj)) {
|
|
151
|
+
if (key === targetKey) {
|
|
152
|
+
return currentPath;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Recursively search in nested objects
|
|
156
|
+
const nested = obj[key];
|
|
157
|
+
if (
|
|
158
|
+
typeof nested === 'object' &&
|
|
159
|
+
nested !== null &&
|
|
160
|
+
!Array.isArray(nested)
|
|
161
|
+
) {
|
|
162
|
+
const result = findKeyPath(targetKey, nested as JsonTypeDefinition, [
|
|
163
|
+
...currentPath,
|
|
164
|
+
key,
|
|
165
|
+
]);
|
|
166
|
+
if (result !== null) {
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Relocate misplaced nested keys in mockData to their correct position
|
|
177
|
+
* based on the dataForMocks structure.
|
|
178
|
+
*
|
|
179
|
+
* When the LLM returns mockData with keys at the wrong nesting level
|
|
180
|
+
* (e.g., { trpc: { quote: {...} }, fastener: {...} } when fastener should
|
|
181
|
+
* be inside trpc), this function moves them to the correct position.
|
|
182
|
+
*
|
|
183
|
+
* This function works recursively to handle nested misplacements, not just
|
|
184
|
+
* root-level ones. For example, if getQuote is at trpc.getQuote instead of
|
|
185
|
+
* trpc.quote.getQuote, it will be relocated.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* // dataForMocks: { trpc: { quote: {...}, fastener: {...} } }
|
|
189
|
+
* // mockData: { trpc: { quote: {...} }, fastener: {...} }
|
|
190
|
+
* // After: mockData: { trpc: { quote: {...}, fastener: {...} } }
|
|
191
|
+
*
|
|
192
|
+
* @example (nested case)
|
|
193
|
+
* // dataForMocks: { trpc: { quote: { getQuote: {...} } } }
|
|
194
|
+
* // mockData: { trpc: { quote: {...}, getQuote: {...} } }
|
|
195
|
+
* // After: mockData: { trpc: { quote: { getQuote: {...} } } }
|
|
196
|
+
*/
|
|
197
|
+
function relocateMisplacedNestedKeys(
|
|
198
|
+
mockData: Record<string, unknown>,
|
|
199
|
+
dataForMocks: JsonTypeDefinition,
|
|
200
|
+
currentPathForLogging: string[] = [],
|
|
201
|
+
): void {
|
|
202
|
+
if (typeof dataForMocks !== 'object' || dataForMocks === null) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const keysInSchema = Object.keys(dataForMocks);
|
|
207
|
+
const keysToRelocate: { key: string; path: string[] }[] = [];
|
|
208
|
+
|
|
209
|
+
// Find keys in mockData that are NOT at this level in dataForMocks
|
|
210
|
+
// but DO exist somewhere nested in dataForMocks
|
|
211
|
+
for (const key of Object.keys(mockData)) {
|
|
212
|
+
if (!keysInSchema.includes(key)) {
|
|
213
|
+
// This key is at this level in mockData but not at this level in dataForMocks
|
|
214
|
+
// Check if it exists somewhere nested in dataForMocks
|
|
215
|
+
const path = findKeyPath(key, dataForMocks);
|
|
216
|
+
if (path !== null && path.length > 0) {
|
|
217
|
+
keysToRelocate.push({ key, path });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Relocate each misplaced key to its correct nested position
|
|
223
|
+
for (const { key, path } of keysToRelocate) {
|
|
224
|
+
const value = mockData[key];
|
|
225
|
+
|
|
226
|
+
// Navigate to the correct parent in mockData, creating nested objects if needed
|
|
227
|
+
let current: Record<string, unknown> = mockData;
|
|
228
|
+
for (const pathKey of path) {
|
|
229
|
+
if (current[pathKey] === undefined) {
|
|
230
|
+
current[pathKey] = {};
|
|
231
|
+
}
|
|
232
|
+
current = current[pathKey] as Record<string, unknown>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Deep merge the value into the correct location
|
|
236
|
+
// Use deep merge to preserve existing data at that location
|
|
237
|
+
if (current[key] !== undefined && typeof current[key] === 'object') {
|
|
238
|
+
current[key] = deepMerge(
|
|
239
|
+
current[key] as Record<string, unknown>,
|
|
240
|
+
value as Record<string, unknown>,
|
|
241
|
+
);
|
|
242
|
+
} else {
|
|
243
|
+
current[key] = value;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Remove the key from its current (wrong) level
|
|
247
|
+
delete mockData[key];
|
|
248
|
+
|
|
249
|
+
const fullPath = [...currentPathForLogging, ...path].join('.');
|
|
250
|
+
awsLog(
|
|
251
|
+
`CodeYam: Relocated misplaced key "${key}" from [${currentPathForLogging.join('.')}] to [${fullPath}]`,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Recursively process nested objects to handle deeply nested misplacements
|
|
256
|
+
for (const key of Object.keys(mockData)) {
|
|
257
|
+
const mockValue = mockData[key];
|
|
258
|
+
const schemaValue = dataForMocks[key];
|
|
259
|
+
|
|
260
|
+
// Only recurse if both mockData and schema have nested objects at this key
|
|
261
|
+
if (
|
|
262
|
+
typeof mockValue === 'object' &&
|
|
263
|
+
mockValue !== null &&
|
|
264
|
+
!Array.isArray(mockValue) &&
|
|
265
|
+
typeof schemaValue === 'object' &&
|
|
266
|
+
schemaValue !== null &&
|
|
267
|
+
!Array.isArray(schemaValue)
|
|
268
|
+
) {
|
|
269
|
+
relocateMisplacedNestedKeys(
|
|
270
|
+
mockValue as Record<string, unknown>,
|
|
271
|
+
schemaValue as JsonTypeDefinition,
|
|
272
|
+
[...currentPathForLogging, key],
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Generate default mock data for a schema type.
|
|
280
|
+
* Returns reasonable default values based on the schema type string.
|
|
281
|
+
*/
|
|
282
|
+
function generateDefaultForSchemaType(schemaType: unknown): unknown {
|
|
283
|
+
if (typeof schemaType === 'string') {
|
|
284
|
+
// Handle common type strings
|
|
285
|
+
if (schemaType === 'function') return () => {};
|
|
286
|
+
if (schemaType === 'promise') return Promise.resolve();
|
|
287
|
+
if (schemaType === 'boolean') return false;
|
|
288
|
+
if (schemaType === 'string') return '';
|
|
289
|
+
if (schemaType === 'number') return 0;
|
|
290
|
+
if (schemaType.includes('number | undefined')) return undefined;
|
|
291
|
+
if (schemaType.includes('string | undefined')) return undefined;
|
|
292
|
+
if (schemaType.includes('boolean | undefined')) return undefined;
|
|
293
|
+
if (schemaType.includes('| undefined')) return undefined;
|
|
294
|
+
if (schemaType.includes('| null')) return null;
|
|
295
|
+
return schemaType; // Return the type as a string placeholder
|
|
296
|
+
}
|
|
297
|
+
if (Array.isArray(schemaType)) {
|
|
298
|
+
if (schemaType.length === 0) return [];
|
|
299
|
+
// Generate a single default element based on the first element's schema
|
|
300
|
+
const elementDefault = generateDefaultForSchemaType(schemaType[0]);
|
|
301
|
+
return elementDefault !== undefined ? [elementDefault] : [];
|
|
302
|
+
}
|
|
303
|
+
if (typeof schemaType === 'object' && schemaType !== null) {
|
|
304
|
+
// Recursively generate defaults for nested objects
|
|
305
|
+
const result: Record<string, unknown> = {};
|
|
306
|
+
for (const [key, value] of Object.entries(schemaType)) {
|
|
307
|
+
result[key] = generateDefaultForSchemaType(value);
|
|
308
|
+
}
|
|
309
|
+
return result;
|
|
310
|
+
}
|
|
311
|
+
return undefined;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Detect if a string should be converted to an array.
|
|
316
|
+
* Returns the array if the field appears to be an array field, or null if it should remain a string.
|
|
317
|
+
*
|
|
318
|
+
* This handles two cases:
|
|
319
|
+
* 1. Comma-separated values: "color,size" -> ["color", "size"]
|
|
320
|
+
* 2. Single values for array-named fields: "Finish" -> ["Finish"]
|
|
321
|
+
*/
|
|
322
|
+
function parseCommaSeparatedStringAsArray(
|
|
323
|
+
value: string,
|
|
324
|
+
key: string,
|
|
325
|
+
): string[] | null {
|
|
326
|
+
// Heuristic: if the key name suggests it's an array field, convert it
|
|
327
|
+
// Common patterns: *_attributes, *_ids, *_items, *_tags, *_values, plural names
|
|
328
|
+
// Check this FIRST because array-named fields should be converted regardless
|
|
329
|
+
// of whether they contain commas (single values become single-element arrays).
|
|
330
|
+
const arrayFieldPatterns = [
|
|
331
|
+
/_attributes$/i,
|
|
332
|
+
/_ids$/i,
|
|
333
|
+
/_items$/i,
|
|
334
|
+
/_tags$/i,
|
|
335
|
+
/_values$/i,
|
|
336
|
+
/_types$/i,
|
|
337
|
+
/_names$/i,
|
|
338
|
+
/_keys$/i,
|
|
339
|
+
/^attributes$/i,
|
|
340
|
+
/^items$/i,
|
|
341
|
+
/^tags$/i,
|
|
342
|
+
/^values$/i,
|
|
343
|
+
];
|
|
344
|
+
|
|
345
|
+
const looksLikeArrayField = arrayFieldPatterns.some((pattern) =>
|
|
346
|
+
pattern.test(key),
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
if (looksLikeArrayField) {
|
|
350
|
+
// Skip newlines check - multiline values shouldn't be split
|
|
351
|
+
if (value.includes('\n')) {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
// Split by comma and trim whitespace
|
|
355
|
+
const parts = value.split(',').map((s) => s.trim());
|
|
356
|
+
// Filter out empty strings - this handles both "Finish" -> ["Finish"]
|
|
357
|
+
// and "" -> []
|
|
358
|
+
return parts.filter((s) => s.length > 0);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// For non-array-named fields, only convert if there are commas
|
|
362
|
+
if (!value.includes(',')) {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// For non-array-named fields, apply stricter sentence detection
|
|
367
|
+
// Skip if it looks like a sentence (comma followed by space and lowercase)
|
|
368
|
+
if (/,\s+[a-z]/.test(value)) {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
// Skip if it contains newlines (likely formatted text)
|
|
372
|
+
if (value.includes('\n')) {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Convert comma-separated string values to arrays when they look like array data.
|
|
381
|
+
* This handles cases where the LLM generates strings like "color,size" instead
|
|
382
|
+
* of arrays like ["color", "size"] due to schema type misdetection.
|
|
383
|
+
*/
|
|
384
|
+
function convertCommaSeparatedStringsToArrays(
|
|
385
|
+
mockData: Record<string, unknown>,
|
|
386
|
+
): void {
|
|
387
|
+
for (const [key, value] of Object.entries(mockData)) {
|
|
388
|
+
if (typeof value === 'string') {
|
|
389
|
+
const asArray = parseCommaSeparatedStringAsArray(value, key);
|
|
390
|
+
if (asArray !== null) {
|
|
391
|
+
mockData[key] = asArray;
|
|
392
|
+
awsLog(
|
|
393
|
+
`CodeYam: Converted comma-separated string to array for key "${key}": "${value}" -> [${asArray.map((s) => `"${s}"`).join(', ')}]`,
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
} else if (
|
|
397
|
+
value !== null &&
|
|
398
|
+
typeof value === 'object' &&
|
|
399
|
+
!Array.isArray(value)
|
|
400
|
+
) {
|
|
401
|
+
// Recursively process nested objects
|
|
402
|
+
convertCommaSeparatedStringsToArrays(value as Record<string, unknown>);
|
|
403
|
+
} else if (Array.isArray(value)) {
|
|
404
|
+
// Recursively process arrays (each element could be an object)
|
|
405
|
+
for (const item of value) {
|
|
406
|
+
if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
|
|
407
|
+
convertCommaSeparatedStringsToArrays(item as Record<string, unknown>);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Ensure all keys from dataForMocks have corresponding data in mockData.
|
|
416
|
+
* For missing keys, generate default values based on the schema.
|
|
417
|
+
* Recursively checks nested objects to fill in any missing nested fields.
|
|
418
|
+
*/
|
|
419
|
+
function fillMissingMockDataKeysWithDefaults(
|
|
420
|
+
mockData: Record<string, unknown>,
|
|
421
|
+
dataForMocks: JsonTypeDefinition,
|
|
422
|
+
pathPrefix: string = '',
|
|
423
|
+
): void {
|
|
424
|
+
if (typeof dataForMocks !== 'object' || dataForMocks === null) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const missingKeys: string[] = [];
|
|
429
|
+
|
|
430
|
+
for (const key of Object.keys(dataForMocks)) {
|
|
431
|
+
if (key === '_nullable') continue; // Internal marker, not a data key
|
|
432
|
+
|
|
433
|
+
const fullPath = pathPrefix ? `${pathPrefix}.${key}` : key;
|
|
434
|
+
|
|
435
|
+
if (mockData[key] === undefined) {
|
|
436
|
+
missingKeys.push(fullPath);
|
|
437
|
+
// Generate default data based on schema
|
|
438
|
+
const schemaForKey = dataForMocks[key];
|
|
439
|
+
mockData[key] = generateDefaultForSchemaType(schemaForKey);
|
|
440
|
+
} else {
|
|
441
|
+
// Key exists, but if both are objects, recursively check for missing nested keys
|
|
442
|
+
const schemaValue = dataForMocks[key];
|
|
443
|
+
const mockValue = mockData[key];
|
|
444
|
+
if (
|
|
445
|
+
typeof schemaValue === 'object' &&
|
|
446
|
+
schemaValue !== null &&
|
|
447
|
+
!Array.isArray(schemaValue) &&
|
|
448
|
+
typeof mockValue === 'object' &&
|
|
449
|
+
mockValue !== null &&
|
|
450
|
+
!Array.isArray(mockValue)
|
|
451
|
+
) {
|
|
452
|
+
fillMissingMockDataKeysWithDefaults(
|
|
453
|
+
mockValue as Record<string, unknown>,
|
|
454
|
+
schemaValue as JsonTypeDefinition,
|
|
455
|
+
fullPath,
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (missingKeys.length > 0) {
|
|
462
|
+
awsLog(
|
|
463
|
+
`CodeYam: Generated default mock data for ${missingKeys.length} missing key(s): ${missingKeys.slice(0, 10).join(', ')}${missingKeys.length > 10 ? '...' : ''}`,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Enforce execution flow requiredValues by setting falsy paths to null.
|
|
470
|
+
*
|
|
471
|
+
* The LLM doesn't reliably generate null for `comparison: 'falsy'` requirements.
|
|
472
|
+
* For example, a flow like "diffView: falsy" should hide a modal, but the LLM
|
|
473
|
+
* might generate a truthy object, causing the modal to show in all screenshots.
|
|
474
|
+
*
|
|
475
|
+
* This function:
|
|
476
|
+
* 1. Gets requiredValues from covered flows
|
|
477
|
+
* 2. For 'falsy' comparisons: sets the value to null
|
|
478
|
+
* 3. For 'truthy' comparisons with falsy values: generates a default truthy value
|
|
479
|
+
*/
|
|
480
|
+
function enforceRequiredValues(
|
|
481
|
+
mockData: Record<string, unknown>,
|
|
482
|
+
coveredFlowIds: string[],
|
|
483
|
+
executionFlows: ExecutionFlow[],
|
|
484
|
+
): void {
|
|
485
|
+
if (!coveredFlowIds.length || !executionFlows.length) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// Get all requiredValues from covered flows
|
|
490
|
+
const coveredFlows = executionFlows.filter((flow) =>
|
|
491
|
+
coveredFlowIds.includes(flow.id),
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
for (const flow of coveredFlows) {
|
|
495
|
+
if (!flow.requiredValues) continue;
|
|
496
|
+
|
|
497
|
+
for (const rv of flow.requiredValues) {
|
|
498
|
+
if (!rv.attributePath) continue;
|
|
499
|
+
|
|
500
|
+
// Find the value in mockData - the path could be nested
|
|
501
|
+
// e.g., attributePath: "diffView" could be at mockData['useDiffModal()'].diffView
|
|
502
|
+
const result = findAndSetValueInMockData(
|
|
503
|
+
mockData,
|
|
504
|
+
rv.attributePath,
|
|
505
|
+
rv.comparison,
|
|
506
|
+
rv.valueType,
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
if (result.found) {
|
|
510
|
+
awsLog(
|
|
511
|
+
`CodeYam: Enforced ${rv.comparison} for ${rv.attributePath} (set to ${result.newValue === null ? 'null' : typeof result.newValue})`,
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Find a value in mockData by attributePath and enforce the comparison.
|
|
520
|
+
* The attributePath could be a simple key or a nested path.
|
|
521
|
+
*
|
|
522
|
+
* Returns { found: boolean, newValue: unknown }
|
|
523
|
+
*/
|
|
524
|
+
function findAndSetValueInMockData(
|
|
525
|
+
mockData: Record<string, unknown>,
|
|
526
|
+
attributePath: string,
|
|
527
|
+
comparison: string,
|
|
528
|
+
valueType?: string,
|
|
529
|
+
): { found: boolean; newValue?: unknown } {
|
|
530
|
+
// Try to find the path at various nesting levels
|
|
531
|
+
// The attributePath might be "diffView" but the actual location is
|
|
532
|
+
// mockData['useDiffModal()'].diffView
|
|
533
|
+
|
|
534
|
+
// Strategy 1: Direct path (e.g., mockData[attributePath])
|
|
535
|
+
if (attributePath in mockData) {
|
|
536
|
+
const currentValue = mockData[attributePath];
|
|
537
|
+
const { shouldChange, newValue } = getEnforcedValue(
|
|
538
|
+
currentValue,
|
|
539
|
+
comparison,
|
|
540
|
+
valueType,
|
|
541
|
+
);
|
|
542
|
+
if (shouldChange) {
|
|
543
|
+
mockData[attributePath] = newValue;
|
|
544
|
+
return { found: true, newValue };
|
|
545
|
+
}
|
|
546
|
+
return { found: true, newValue: currentValue };
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// Strategy 2: Search in nested objects
|
|
550
|
+
for (const [key, value] of Object.entries(mockData)) {
|
|
551
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
552
|
+
const nestedObj = value as Record<string, unknown>;
|
|
553
|
+
|
|
554
|
+
// Check if attributePath exists in this nested object
|
|
555
|
+
if (attributePath in nestedObj) {
|
|
556
|
+
const currentValue = nestedObj[attributePath];
|
|
557
|
+
const { shouldChange, newValue } = getEnforcedValue(
|
|
558
|
+
currentValue,
|
|
559
|
+
comparison,
|
|
560
|
+
valueType,
|
|
561
|
+
);
|
|
562
|
+
if (shouldChange) {
|
|
563
|
+
nestedObj[attributePath] = newValue;
|
|
564
|
+
return { found: true, newValue };
|
|
565
|
+
}
|
|
566
|
+
return { found: true, newValue: currentValue };
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// Also check dot-notation paths (e.g., "diffView.type")
|
|
570
|
+
if (attributePath.includes('.')) {
|
|
571
|
+
const parts = attributePath.split('.');
|
|
572
|
+
const firstPart = parts[0];
|
|
573
|
+
if (firstPart in nestedObj) {
|
|
574
|
+
// Recurse with the rest of the path
|
|
575
|
+
const result = findAndSetValueInMockData(
|
|
576
|
+
nestedObj,
|
|
577
|
+
attributePath,
|
|
578
|
+
comparison,
|
|
579
|
+
valueType,
|
|
580
|
+
);
|
|
581
|
+
if (result.found) return result;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Recursively search deeper
|
|
586
|
+
const result = findAndSetValueInMockData(
|
|
587
|
+
nestedObj,
|
|
588
|
+
attributePath,
|
|
589
|
+
comparison,
|
|
590
|
+
valueType,
|
|
591
|
+
);
|
|
592
|
+
if (result.found) return result;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
return { found: false };
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Determine if a value should be changed to match a comparison requirement.
|
|
601
|
+
*
|
|
602
|
+
* For 'falsy' comparison: truthy values should become null
|
|
603
|
+
* For 'truthy' comparison: falsy values should become a default truthy value
|
|
604
|
+
*/
|
|
605
|
+
function getEnforcedValue(
|
|
606
|
+
currentValue: unknown,
|
|
607
|
+
comparison: string,
|
|
608
|
+
valueType?: string,
|
|
609
|
+
): { shouldChange: boolean; newValue: unknown } {
|
|
610
|
+
const isTruthy = Boolean(currentValue);
|
|
611
|
+
|
|
612
|
+
if (comparison === 'falsy') {
|
|
613
|
+
// Value should be falsy
|
|
614
|
+
if (isTruthy) {
|
|
615
|
+
return { shouldChange: true, newValue: null };
|
|
616
|
+
}
|
|
617
|
+
return { shouldChange: false, newValue: currentValue };
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
if (comparison === 'truthy') {
|
|
621
|
+
// Value should be truthy
|
|
622
|
+
if (!isTruthy) {
|
|
623
|
+
// Generate a default truthy value based on valueType
|
|
624
|
+
const defaultValue = generateDefaultTruthyValue(valueType);
|
|
625
|
+
return { shouldChange: true, newValue: defaultValue };
|
|
626
|
+
}
|
|
627
|
+
return { shouldChange: false, newValue: currentValue };
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// For other comparisons (equals, exists, etc.), don't auto-enforce
|
|
631
|
+
return { shouldChange: false, newValue: currentValue };
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Generate a default truthy value for a given type.
|
|
636
|
+
*/
|
|
637
|
+
function generateDefaultTruthyValue(valueType?: string): unknown {
|
|
638
|
+
if (!valueType) return { _placeholder: true };
|
|
639
|
+
|
|
640
|
+
switch (valueType.toLowerCase()) {
|
|
641
|
+
case 'string':
|
|
642
|
+
return 'default-value';
|
|
643
|
+
case 'number':
|
|
644
|
+
return 1;
|
|
645
|
+
case 'boolean':
|
|
646
|
+
return true;
|
|
647
|
+
case 'array':
|
|
648
|
+
return [{ _placeholder: true }];
|
|
649
|
+
case 'object':
|
|
650
|
+
default:
|
|
651
|
+
return { _placeholder: true };
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
18
655
|
type ScenarioDataWithoutDescription = Omit<ScenarioData, 'scenarioDescription'>;
|
|
19
656
|
|
|
20
657
|
interface GenerateEntityScenarioDataArgs {
|
|
21
658
|
entity: Pick<Entity, 'name' | 'filePath' | 'metadata'>;
|
|
22
659
|
structure: ScenariosDataStructure;
|
|
23
660
|
scenarios: Scenario[];
|
|
661
|
+
executionFlows?: ExecutionFlow[];
|
|
24
662
|
incompleteResponse?: string;
|
|
25
663
|
analysis: Analysis;
|
|
26
664
|
model?: AI.Model;
|
|
@@ -34,10 +672,96 @@ type GenerateDataForScenarioArgs = Omit<
|
|
|
34
672
|
defaultScenarioData?: ScenarioData;
|
|
35
673
|
};
|
|
36
674
|
|
|
675
|
+
interface FillMissingMockDataKeysArgs {
|
|
676
|
+
structure: ScenariosDataStructure;
|
|
677
|
+
scenario: Scenario;
|
|
678
|
+
executionFlows: ExecutionFlow[] | undefined;
|
|
679
|
+
fullScenarioData: ScenarioData;
|
|
680
|
+
model: AI.Model | undefined;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* For Default Scenario only: detect missing mockData keys and make a follow-up
|
|
685
|
+
* LLM call to fill them in. This handles cases where the LLM completes normally
|
|
686
|
+
* but misses some keys (often small/simple ones when the schema is large).
|
|
687
|
+
*/
|
|
688
|
+
async function fillMissingMockDataKeys({
|
|
689
|
+
structure,
|
|
690
|
+
scenario,
|
|
691
|
+
executionFlows,
|
|
692
|
+
fullScenarioData,
|
|
693
|
+
model,
|
|
694
|
+
}: FillMissingMockDataKeysArgs): Promise<void> {
|
|
695
|
+
if (
|
|
696
|
+
!structure.dataForMocks ||
|
|
697
|
+
typeof structure.dataForMocks !== 'object' ||
|
|
698
|
+
Array.isArray(structure.dataForMocks)
|
|
699
|
+
) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
const expectedKeys = Object.keys(structure.dataForMocks);
|
|
704
|
+
const generatedKeys = Object.keys(fullScenarioData.data.mockData || {});
|
|
705
|
+
const missingKeys = expectedKeys.filter((k) => !generatedKeys.includes(k));
|
|
706
|
+
|
|
707
|
+
if (missingKeys.length === 0) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
awsLog(
|
|
712
|
+
`Default Scenario missing ${missingKeys.length} keys, making follow-up call`,
|
|
713
|
+
{ missingKeys },
|
|
714
|
+
);
|
|
715
|
+
|
|
716
|
+
// Build subset schema with only missing keys
|
|
717
|
+
const missingSchema: Record<string, any> = {};
|
|
718
|
+
for (const key of missingKeys) {
|
|
719
|
+
missingSchema[key] = (structure.dataForMocks as Record<string, any>)[key];
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
const followUpPrompt = generateMissingKeysPrompt({
|
|
723
|
+
scenario,
|
|
724
|
+
executionFlows,
|
|
725
|
+
generatedMockData: fullScenarioData.data.mockData || {},
|
|
726
|
+
missingSchema,
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
const followUpResponse = await completionCall({
|
|
730
|
+
type: 'generateMissingMockData',
|
|
731
|
+
systemMessage: generateMissingKeysSystemMessage(),
|
|
732
|
+
prompt: followUpPrompt,
|
|
733
|
+
model,
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
if (!followUpResponse.completion) {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
const followUpJson = validateJson(followUpResponse.completion);
|
|
741
|
+
const followUpParsed = parseJsonSafe(followUpJson);
|
|
742
|
+
|
|
743
|
+
if (
|
|
744
|
+
!followUpParsed ||
|
|
745
|
+
typeof followUpParsed !== 'object' ||
|
|
746
|
+
!('mockData' in followUpParsed)
|
|
747
|
+
) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
const followUpMockData = (followUpParsed as any).mockData;
|
|
752
|
+
if (followUpMockData && typeof followUpMockData === 'object') {
|
|
753
|
+
fullScenarioData.data.mockData = {
|
|
754
|
+
...fullScenarioData.data.mockData,
|
|
755
|
+
...followUpMockData,
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
37
760
|
export async function generateDataForScenario({
|
|
38
761
|
entity,
|
|
39
762
|
structure,
|
|
40
763
|
scenario,
|
|
764
|
+
executionFlows,
|
|
41
765
|
defaultScenarioData,
|
|
42
766
|
incompleteResponse,
|
|
43
767
|
analysis,
|
|
@@ -45,11 +769,122 @@ export async function generateDataForScenario({
|
|
|
45
769
|
}: GenerateDataForScenarioArgs) {
|
|
46
770
|
awsLogDebugLevel(1, `Generating data for ${entity.name}: ${scenario.name}`);
|
|
47
771
|
|
|
772
|
+
// Check if we should chunk the data structure for focused processing
|
|
773
|
+
let chunkedMockData: Record<string, unknown> | undefined;
|
|
774
|
+
const coveredFlowIds = scenario.metadata?.coveredFlows || [];
|
|
775
|
+
|
|
776
|
+
if (
|
|
777
|
+
structure.dataForMocks &&
|
|
778
|
+
!incompleteResponse // Don't do chunked calls on continuation
|
|
779
|
+
) {
|
|
780
|
+
const chunks = chunkDataStructure(structure.dataForMocks);
|
|
781
|
+
|
|
782
|
+
// If we have multiple chunks, process each one with a focused call
|
|
783
|
+
if (chunks.length > 1) {
|
|
784
|
+
awsLog(
|
|
785
|
+
`Data structure has ${Object.keys(structure.dataForMocks).length} keys, splitting into ${chunks.length} chunks for focused processing`,
|
|
786
|
+
);
|
|
787
|
+
|
|
788
|
+
chunkedMockData = {};
|
|
789
|
+
|
|
790
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
791
|
+
const chunk = chunks[i];
|
|
792
|
+
const chunkKeys = Object.keys(chunk || {});
|
|
793
|
+
|
|
794
|
+
// Get relevant requiredValues for this chunk
|
|
795
|
+
const relevantRequiredValues = getRequiredValuesForChunk(
|
|
796
|
+
chunk,
|
|
797
|
+
executionFlows || [],
|
|
798
|
+
coveredFlowIds,
|
|
799
|
+
);
|
|
800
|
+
|
|
801
|
+
awsLog(
|
|
802
|
+
`Processing chunk ${i + 1}/${chunks.length}: ${chunkKeys.join(', ')}`,
|
|
803
|
+
);
|
|
804
|
+
|
|
805
|
+
const chunkPrompt = generateChunkPrompt({
|
|
806
|
+
scenario,
|
|
807
|
+
chunk,
|
|
808
|
+
chunkIndex: i,
|
|
809
|
+
totalChunks: chunks.length,
|
|
810
|
+
relevantRequiredValues,
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
const chunkResponse = await completionCall({
|
|
814
|
+
type: 'generateChunkMockData',
|
|
815
|
+
systemMessage: generateChunkSystemMessage(scenario.name),
|
|
816
|
+
prompt: chunkPrompt,
|
|
817
|
+
model,
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
// Save chunk call to LLM log for replay support
|
|
821
|
+
await saveLlmCall({
|
|
822
|
+
object_type: 'analysis',
|
|
823
|
+
object_id: analysis.id,
|
|
824
|
+
propsJson: {
|
|
825
|
+
entity: { name: entity.name, filePath: entity.filePath },
|
|
826
|
+
scenario: { name: scenario.name },
|
|
827
|
+
chunkIndex: i,
|
|
828
|
+
totalChunks: chunks.length,
|
|
829
|
+
},
|
|
830
|
+
...chunkResponse.stats,
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
if (chunkResponse.completion) {
|
|
834
|
+
const validJson = validateJson(chunkResponse.completion);
|
|
835
|
+
const parsed = parseJsonSafe(validJson);
|
|
836
|
+
if (parsed && typeof parsed === 'object' && 'mockData' in parsed) {
|
|
837
|
+
const chunkMockData = (parsed as any).mockData;
|
|
838
|
+
if (chunkMockData && typeof chunkMockData === 'object') {
|
|
839
|
+
Object.assign(chunkedMockData, chunkMockData);
|
|
840
|
+
awsLog(
|
|
841
|
+
`Chunk ${i + 1} generated data for: ${Object.keys(chunkMockData).join(', ')}`,
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// Detect keys that were lost from failed or partial chunk responses
|
|
849
|
+
// and fill them with schema-based defaults so they aren't permanently lost.
|
|
850
|
+
const allChunkedKeys = chunks.flatMap((c) => Object.keys(c || {}));
|
|
851
|
+
const returnedKeys = new Set(Object.keys(chunkedMockData));
|
|
852
|
+
const missingChunkKeys = allChunkedKeys.filter(
|
|
853
|
+
(k) => !returnedKeys.has(k),
|
|
854
|
+
);
|
|
855
|
+
|
|
856
|
+
if (missingChunkKeys.length > 0) {
|
|
857
|
+
awsLog(
|
|
858
|
+
`Chunked processing: ${missingChunkKeys.length} key(s) missing from chunk results, filling with defaults: ${missingChunkKeys.join(', ')}`,
|
|
859
|
+
);
|
|
860
|
+
const dataForMocksRecord = structure.dataForMocks as Record<
|
|
861
|
+
string,
|
|
862
|
+
unknown
|
|
863
|
+
>;
|
|
864
|
+
for (const key of missingChunkKeys) {
|
|
865
|
+
chunkedMockData[key] = generateDefaultForSchemaType(
|
|
866
|
+
dataForMocksRecord[key],
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
awsLog(
|
|
872
|
+
`Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`,
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// When we have chunked mock data with actual content, tell the main prompt to skip mockData generation
|
|
878
|
+
// Important: Check for actual keys, not just truthy object, because {} would skip generation incorrectly
|
|
879
|
+
const hasChunkedData =
|
|
880
|
+
chunkedMockData && Object.keys(chunkedMockData).length > 0;
|
|
48
881
|
const prompt = generateEntityScenarioDataGenerator(
|
|
49
882
|
structure,
|
|
50
883
|
scenario,
|
|
884
|
+
executionFlows,
|
|
51
885
|
defaultScenarioData,
|
|
52
886
|
incompleteResponse,
|
|
887
|
+
{ mockDataAlreadyGenerated: hasChunkedData },
|
|
53
888
|
);
|
|
54
889
|
|
|
55
890
|
const isDefault = scenario.name === DEFAULT_SCENARIO_NAME;
|
|
@@ -92,7 +927,7 @@ export async function generateDataForScenario({
|
|
|
92
927
|
...response.stats,
|
|
93
928
|
});
|
|
94
929
|
|
|
95
|
-
|
|
930
|
+
let { completion, finishReason } = response;
|
|
96
931
|
|
|
97
932
|
if (!completion) {
|
|
98
933
|
console.log(
|
|
@@ -101,51 +936,79 @@ export async function generateDataForScenario({
|
|
|
101
936
|
return null;
|
|
102
937
|
}
|
|
103
938
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
finishReason,
|
|
108
|
-
completion,
|
|
109
|
-
},
|
|
939
|
+
awsLogDebugLevel(
|
|
940
|
+
1,
|
|
941
|
+
`LLMCall ${llmCall ? llmCall.id : 'N/A'}: ${entity.filePath} ${entity.metadata?.exportAlias ?? entity.name} finishReason: ${finishReason}`,
|
|
110
942
|
);
|
|
111
943
|
|
|
944
|
+
// If response was truncated due to token limit, make a continuation call
|
|
945
|
+
if (finishReason === 'length') {
|
|
946
|
+
awsLogDebugLevel(1, 'Response truncated, making continuation call');
|
|
947
|
+
|
|
948
|
+
const continuationResponse = await completionCall({
|
|
949
|
+
type: 'generateEntityScenarioData',
|
|
950
|
+
systemMessage: generateIncompleteSystemMessage(scenario.name, isDefault),
|
|
951
|
+
prompt: completion, // Pass the incomplete response as the prompt
|
|
952
|
+
model,
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
if (continuationResponse.completion) {
|
|
956
|
+
completion = completion + continuationResponse.completion;
|
|
957
|
+
finishReason = continuationResponse.finishReason;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
112
961
|
const validJson = validateJson(completion);
|
|
113
962
|
|
|
114
963
|
const parsed = parseJsonSafe(validJson);
|
|
115
964
|
if (!parsed || typeof parsed !== 'object' || !('scenarioData' in parsed)) {
|
|
116
|
-
|
|
117
|
-
entityName: entity.name,
|
|
118
|
-
scenarioName: scenario.name,
|
|
119
|
-
hasParsed: !!parsed,
|
|
120
|
-
parsedType: typeof parsed,
|
|
121
|
-
hasScenarioData: parsed && 'scenarioData' in parsed,
|
|
122
|
-
completionPreview: completion.substring(0, 200),
|
|
123
|
-
});
|
|
965
|
+
awsLog(`Failed to parse scenario data for ${entity.name}/${scenario.name}`);
|
|
124
966
|
return null;
|
|
125
967
|
}
|
|
126
968
|
|
|
127
|
-
|
|
969
|
+
let { scenarioData: scenarioDataWithoutDescription } = parsed as {
|
|
128
970
|
scenarioData: ScenarioDataWithoutDescription;
|
|
129
971
|
};
|
|
130
972
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
973
|
+
// FIX: LLM sometimes puts mock data keys directly under scenarioData instead of
|
|
974
|
+
// under scenarioData.data.mockData. Detect and fix this structural issue.
|
|
975
|
+
if (structure.dataForMocks) {
|
|
976
|
+
const scenarioDataAsAny = scenarioDataWithoutDescription as any;
|
|
977
|
+
const reservedKeys = new Set([
|
|
978
|
+
'scenarioName',
|
|
979
|
+
'data',
|
|
980
|
+
'scenarioDescription',
|
|
981
|
+
]);
|
|
982
|
+
const misplacedKeys: string[] = [];
|
|
983
|
+
|
|
984
|
+
// Find keys that are directly under scenarioData but should be in mockData
|
|
985
|
+
for (const key of Object.keys(scenarioDataAsAny)) {
|
|
986
|
+
if (reservedKeys.has(key)) continue;
|
|
987
|
+
// If this key exists in the dataForMocks schema, it's misplaced
|
|
988
|
+
if (key in structure.dataForMocks) {
|
|
989
|
+
misplacedKeys.push(key);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
if (misplacedKeys.length > 0) {
|
|
994
|
+
// Ensure data.mockData exists
|
|
995
|
+
if (!scenarioDataAsAny.data) {
|
|
996
|
+
scenarioDataAsAny.data = {};
|
|
997
|
+
}
|
|
998
|
+
if (!scenarioDataAsAny.data.mockData) {
|
|
999
|
+
scenarioDataAsAny.data.mockData = {};
|
|
1000
|
+
}
|
|
140
1001
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1002
|
+
// Move misplaced keys to mockData
|
|
1003
|
+
for (const key of misplacedKeys) {
|
|
1004
|
+
scenarioDataAsAny.data.mockData[key] = scenarioDataAsAny[key];
|
|
1005
|
+
delete scenarioDataAsAny[key];
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// Update the reference
|
|
1009
|
+
scenarioDataWithoutDescription =
|
|
1010
|
+
scenarioDataAsAny as ScenarioDataWithoutDescription;
|
|
1011
|
+
}
|
|
149
1012
|
}
|
|
150
1013
|
|
|
151
1014
|
const fullScenarioData: ScenarioData = {
|
|
@@ -155,8 +1018,9 @@ export async function generateDataForScenario({
|
|
|
155
1018
|
|
|
156
1019
|
if (structure.dataForMocks && !fullScenarioData.data.argumentsData) {
|
|
157
1020
|
fullScenarioData.data.argumentsData = [];
|
|
158
|
-
|
|
159
|
-
|
|
1021
|
+
// Populate argumentsData from structure.arguments using top-level data values
|
|
1022
|
+
// Bug fix: removed redundant !argumentsData check that was always false after setting to []
|
|
1023
|
+
if (structure.arguments) {
|
|
160
1024
|
for (let i = 0; i < structure.arguments.length; ++i) {
|
|
161
1025
|
if (!fullScenarioData.data.argumentsData[i]) {
|
|
162
1026
|
fullScenarioData.data.argumentsData[i] = {};
|
|
@@ -169,14 +1033,158 @@ export async function generateDataForScenario({
|
|
|
169
1033
|
}
|
|
170
1034
|
}
|
|
171
1035
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
1036
|
+
// Merge flat-level mock data into mockData.
|
|
1037
|
+
// Sometimes the LLM returns some data inside data.mockData but other data at the flat
|
|
1038
|
+
// data level (e.g., data.useRouter() instead of data.mockData.useRouter()).
|
|
1039
|
+
// This code ensures all dataForMocks keys end up in mockData.
|
|
1040
|
+
if (structure.dataForMocks) {
|
|
1041
|
+
fullScenarioData.data.mockData ||= {};
|
|
1042
|
+
const dataAsAny = fullScenarioData.data as any;
|
|
1043
|
+
for (const propKey of Object.keys(structure.dataForMocks)) {
|
|
1044
|
+
// Only copy if it exists at flat level and not already in mockData
|
|
1045
|
+
if (
|
|
1046
|
+
dataAsAny[propKey] !== undefined &&
|
|
1047
|
+
!fullScenarioData.data.mockData[propKey]
|
|
1048
|
+
) {
|
|
1049
|
+
fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
// Merge chunked mock data from focused calls (takes priority over main call's data)
|
|
1055
|
+
// This ensures keys processed with focused attention are correctly generated.
|
|
1056
|
+
if (chunkedMockData && fullScenarioData.data.mockData) {
|
|
1057
|
+
for (const [key, value] of Object.entries(chunkedMockData)) {
|
|
1058
|
+
// Chunked data takes priority - overwrite main call's potentially wrong data
|
|
1059
|
+
fullScenarioData.data.mockData[key] = value;
|
|
1060
|
+
}
|
|
1061
|
+
awsLog(
|
|
1062
|
+
`Merged chunked mock data for keys: ${Object.keys(chunkedMockData).join(', ')}`,
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// Relocate misplaced nested keys to their correct position.
|
|
1067
|
+
// The LLM sometimes places nested keys at root level instead of inside their
|
|
1068
|
+
// parent object (e.g., 'fastener' at root instead of inside 'trpc').
|
|
1069
|
+
// This ensures the mockData structure matches the dataForMocks schema.
|
|
1070
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
1071
|
+
relocateMisplacedNestedKeys(
|
|
1072
|
+
fullScenarioData.data.mockData,
|
|
1073
|
+
structure.dataForMocks,
|
|
1074
|
+
);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// Convert null values to undefined based on schema type constraints.
|
|
1078
|
+
// LLM uses null for "no value" (JSON doesn't support undefined), but TypeScript
|
|
1079
|
+
// types like "string | undefined" don't accept null. This converts null→undefined
|
|
1080
|
+
// for fields typed as "T | undefined" (but preserves null for "T | null").
|
|
1081
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
1082
|
+
convertNullToUndefinedBySchema(
|
|
1083
|
+
fullScenarioData.data.mockData,
|
|
1084
|
+
structure.dataForMocks,
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
// Coerce objects/arrays to primitives when the schema expects a primitive type.
|
|
1089
|
+
// The LLM sometimes generates an object where the schema expects "string",
|
|
1090
|
+
// e.g., { body: { "env": "production" } } instead of { body: "some string" }.
|
|
1091
|
+
// This causes runtime errors like "TypeError: body.match is not a function".
|
|
1092
|
+
// Must run BEFORE convertCommaSeparatedStringsToArrays, which intentionally
|
|
1093
|
+
// overrides schema types for array-like field names.
|
|
1094
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
1095
|
+
coerceObjectsToPrimitivesBySchema(
|
|
1096
|
+
fullScenarioData.data.mockData,
|
|
1097
|
+
structure.dataForMocks,
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
// Convert comma-separated strings to arrays when appropriate.
|
|
1102
|
+
// The LLM sometimes generates strings like "color,size" instead of arrays
|
|
1103
|
+
// like ["color", "size"] when the schema type is incorrectly inferred as
|
|
1104
|
+
// 'string' instead of 'string[]'. This causes runtime errors when code
|
|
1105
|
+
// calls array methods like .map() on the value.
|
|
1106
|
+
if (fullScenarioData.data.mockData) {
|
|
1107
|
+
convertCommaSeparatedStringsToArrays(fullScenarioData.data.mockData);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
// Convert type annotation strings that appear as values to actual values.
|
|
1111
|
+
// The LLM sometimes echoes the schema type annotation as the value.
|
|
1112
|
+
// For example, if the schema says { filePath: "string | undefined" },
|
|
1113
|
+
// the LLM might return { filePath: "string | undefined" } instead of
|
|
1114
|
+
// generating an actual value. This converts those type strings to
|
|
1115
|
+
// appropriate default values (e.g., "string | undefined" → undefined).
|
|
1116
|
+
if (fullScenarioData.data.mockData) {
|
|
1117
|
+
convertTypeAnnotationsToValues(fullScenarioData.data.mockData);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// Fix null values for ID fields when the schema indicates they should be non-null.
|
|
1121
|
+
// The LLM sometimes generates `null` for ID fields (e.g., `"id": null`) when
|
|
1122
|
+
// the schema type is `"number"`. This causes runtime issues when code checks
|
|
1123
|
+
// `if (!data?.id)` expecting a truthy value.
|
|
1124
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
1125
|
+
fixNullIdsBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// Enforce execution flow requiredValues by setting falsy paths to null.
|
|
1129
|
+
// The LLM doesn't reliably generate null for falsy requirements (e.g., diffView: falsy
|
|
1130
|
+
// to hide a modal). This post-processing ensures that scenarios match their
|
|
1131
|
+
// covered flows' requiredValues.
|
|
1132
|
+
if (fullScenarioData.data.mockData && executionFlows) {
|
|
1133
|
+
enforceRequiredValues(
|
|
1134
|
+
fullScenarioData.data.mockData,
|
|
1135
|
+
scenario.metadata?.coveredFlows || [],
|
|
1136
|
+
executionFlows,
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
if (structure.arguments && fullScenarioData.data.argumentsData) {
|
|
1141
|
+
for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
|
|
1142
|
+
if (structure.arguments[i]) {
|
|
1143
|
+
convertNullToUndefinedBySchema(
|
|
1144
|
+
fullScenarioData.data.argumentsData[i],
|
|
1145
|
+
structure.arguments[i],
|
|
1146
|
+
);
|
|
1147
|
+
}
|
|
177
1148
|
}
|
|
178
1149
|
}
|
|
179
1150
|
|
|
1151
|
+
// For Default Scenario only: check for missing keys and make follow-up call if needed.
|
|
1152
|
+
// This tries to get better-quality data via LLM before falling back to defaults.
|
|
1153
|
+
if (isDefault) {
|
|
1154
|
+
await fillMissingMockDataKeys({
|
|
1155
|
+
structure,
|
|
1156
|
+
scenario,
|
|
1157
|
+
executionFlows,
|
|
1158
|
+
fullScenarioData,
|
|
1159
|
+
model,
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// Fill in missing mock data keys with default values (after trying LLM follow-up).
|
|
1164
|
+
// The LLM sometimes doesn't generate data for all keys in large schemas.
|
|
1165
|
+
// This ensures all dataForMocks keys have corresponding data to prevent
|
|
1166
|
+
// runtime errors like "Cannot read properties of undefined".
|
|
1167
|
+
// Only run for Default Scenario - non-default scenarios will get missing
|
|
1168
|
+
// data filled in from the merge with default scenario data.
|
|
1169
|
+
if (isDefault && structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
1170
|
+
fillMissingMockDataKeysWithDefaults(
|
|
1171
|
+
fullScenarioData.data.mockData,
|
|
1172
|
+
structure.dataForMocks,
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// Track the final scenario data for E2E debugging
|
|
1177
|
+
trackDataSnapshot(
|
|
1178
|
+
'generateDataForScenario_result',
|
|
1179
|
+
{
|
|
1180
|
+
scenarioName: scenario.name,
|
|
1181
|
+
mockData: fullScenarioData.data.mockData,
|
|
1182
|
+
argumentsData: fullScenarioData.data.argumentsData,
|
|
1183
|
+
},
|
|
1184
|
+
entity.name,
|
|
1185
|
+
scenario.name,
|
|
1186
|
+
);
|
|
1187
|
+
|
|
180
1188
|
return {
|
|
181
1189
|
scenarioData: fullScenarioData,
|
|
182
1190
|
llmCall: { name: scenario.name, id: llmCall.id },
|
|
@@ -187,6 +1195,7 @@ export default async function generateEntityScenarioData({
|
|
|
187
1195
|
entity,
|
|
188
1196
|
structure,
|
|
189
1197
|
scenarios,
|
|
1198
|
+
executionFlows,
|
|
190
1199
|
incompleteResponse,
|
|
191
1200
|
analysis,
|
|
192
1201
|
model,
|
|
@@ -207,6 +1216,7 @@ export default async function generateEntityScenarioData({
|
|
|
207
1216
|
entity,
|
|
208
1217
|
structure,
|
|
209
1218
|
scenario: defaultScenario,
|
|
1219
|
+
executionFlows,
|
|
210
1220
|
incompleteResponse,
|
|
211
1221
|
analysis,
|
|
212
1222
|
model,
|
|
@@ -229,6 +1239,7 @@ export default async function generateEntityScenarioData({
|
|
|
229
1239
|
entity,
|
|
230
1240
|
structure,
|
|
231
1241
|
scenario,
|
|
1242
|
+
executionFlows,
|
|
232
1243
|
defaultScenarioData,
|
|
233
1244
|
incompleteResponse,
|
|
234
1245
|
analysis,
|
|
@@ -249,37 +1260,131 @@ export default async function generateEntityScenarioData({
|
|
|
249
1260
|
);
|
|
250
1261
|
}
|
|
251
1262
|
|
|
252
|
-
|
|
253
|
-
|
|
1263
|
+
// Merge non-default scenario data with default scenario data
|
|
1264
|
+
// The LLM generates partial data (only differences), we need to merge with default
|
|
1265
|
+
const mergedScenarioDatas = validResults.map((result) => {
|
|
1266
|
+
const scenarioData = result.scenarioData;
|
|
1267
|
+
|
|
1268
|
+
// Merge mockData with default mockData
|
|
1269
|
+
if (defaultScenarioData.data?.mockData && scenarioData.data?.mockData) {
|
|
1270
|
+
scenarioData.data.mockData = deepMergeScenarioData(
|
|
1271
|
+
defaultScenarioData.data.mockData,
|
|
1272
|
+
scenarioData.data.mockData,
|
|
1273
|
+
);
|
|
1274
|
+
} else if (
|
|
1275
|
+
defaultScenarioData.data?.mockData &&
|
|
1276
|
+
!scenarioData.data?.mockData
|
|
1277
|
+
) {
|
|
1278
|
+
// Use default mockData if scenario has none
|
|
1279
|
+
scenarioData.data.mockData = { ...defaultScenarioData.data.mockData };
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
// Merge argumentsData with default argumentsData
|
|
1283
|
+
if (
|
|
1284
|
+
defaultScenarioData.data?.argumentsData &&
|
|
1285
|
+
Array.isArray(defaultScenarioData.data.argumentsData) &&
|
|
1286
|
+
scenarioData.data?.argumentsData &&
|
|
1287
|
+
Array.isArray(scenarioData.data.argumentsData)
|
|
1288
|
+
) {
|
|
1289
|
+
for (
|
|
1290
|
+
let i = 0;
|
|
1291
|
+
i < defaultScenarioData.data.argumentsData.length;
|
|
1292
|
+
i++
|
|
1293
|
+
) {
|
|
1294
|
+
const scenarioArg = scenarioData.data.argumentsData[i];
|
|
1295
|
+
const defaultArg = defaultScenarioData.data.argumentsData[i];
|
|
1296
|
+
|
|
1297
|
+
// Only merge if both are objects (LLM sometimes returns primitives)
|
|
1298
|
+
if (
|
|
1299
|
+
scenarioArg &&
|
|
1300
|
+
typeof scenarioArg === 'object' &&
|
|
1301
|
+
!Array.isArray(scenarioArg) &&
|
|
1302
|
+
defaultArg &&
|
|
1303
|
+
typeof defaultArg === 'object' &&
|
|
1304
|
+
!Array.isArray(defaultArg)
|
|
1305
|
+
) {
|
|
1306
|
+
scenarioData.data.argumentsData[i] = deepMergeScenarioData(
|
|
1307
|
+
defaultArg,
|
|
1308
|
+
scenarioArg,
|
|
1309
|
+
);
|
|
1310
|
+
} else if (scenarioArg !== undefined) {
|
|
1311
|
+
// Keep the scenario value as-is (even if primitive)
|
|
1312
|
+
scenarioData.data.argumentsData[i] = scenarioArg;
|
|
1313
|
+
} else if (defaultArg && typeof defaultArg === 'object') {
|
|
1314
|
+
// Use default if scenario is undefined and default is an object
|
|
1315
|
+
scenarioData.data.argumentsData[i] = { ...defaultArg };
|
|
1316
|
+
} else {
|
|
1317
|
+
scenarioData.data.argumentsData[i] = defaultArg;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
} else if (
|
|
1321
|
+
defaultScenarioData.data?.argumentsData &&
|
|
1322
|
+
!scenarioData.data?.argumentsData
|
|
1323
|
+
) {
|
|
1324
|
+
// Use default argumentsData if scenario has none
|
|
1325
|
+
scenarioData.data.argumentsData =
|
|
1326
|
+
defaultScenarioData.data.argumentsData.map((arg) => ({ ...arg }));
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// Enforce requiredValues AFTER merge for non-default scenarios
|
|
1330
|
+
// This ensures that if a non-default scenario doesn't cover a certain flow,
|
|
1331
|
+
// it inherits the enforcement from the default scenario
|
|
1332
|
+
if (scenarioData.data?.mockData && executionFlows) {
|
|
1333
|
+
// Get the flows covered by this scenario
|
|
1334
|
+
const scenarioCoveredFlows =
|
|
1335
|
+
nonDefaultScenarios.find(
|
|
1336
|
+
(s) => s.name === result.scenarioData.scenarioDescription,
|
|
1337
|
+
)?.metadata?.coveredFlows || [];
|
|
1338
|
+
|
|
1339
|
+
// Get the paths that the scenario's flows affect
|
|
1340
|
+
const scenarioAffectedPaths = new Set<string>();
|
|
1341
|
+
for (const flowId of scenarioCoveredFlows) {
|
|
1342
|
+
const flow = executionFlows.find((f) => f.id === flowId);
|
|
1343
|
+
if (flow?.requiredValues) {
|
|
1344
|
+
for (const rv of flow.requiredValues) {
|
|
1345
|
+
if (rv.attributePath) {
|
|
1346
|
+
// Extract base path (e.g., "diffView" from "diffView.type")
|
|
1347
|
+
const basePath = rv.attributePath.split('.')[0];
|
|
1348
|
+
scenarioAffectedPaths.add(basePath);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
// Get the default scenario's flows
|
|
1355
|
+
const defaultCoveredFlows =
|
|
1356
|
+
defaultScenario.metadata?.coveredFlows || [];
|
|
1357
|
+
|
|
1358
|
+
// For paths NOT affected by the scenario, apply default's enforcement
|
|
1359
|
+
const defaultFlowsForUnaffectedPaths = defaultCoveredFlows.filter(
|
|
1360
|
+
(flowId) => {
|
|
1361
|
+
const flow = executionFlows.find((f) => f.id === flowId);
|
|
1362
|
+
if (!flow?.requiredValues) return false;
|
|
1363
|
+
|
|
1364
|
+
// Check if this flow affects a path that the scenario doesn't cover
|
|
1365
|
+
return flow.requiredValues.some((rv) => {
|
|
1366
|
+
if (!rv.attributePath) return false;
|
|
1367
|
+
const basePath = rv.attributePath.split('.')[0];
|
|
1368
|
+
return !scenarioAffectedPaths.has(basePath);
|
|
1369
|
+
});
|
|
1370
|
+
},
|
|
1371
|
+
);
|
|
1372
|
+
|
|
1373
|
+
// Apply enforcement from default scenario for unaffected paths
|
|
1374
|
+
if (defaultFlowsForUnaffectedPaths.length > 0) {
|
|
1375
|
+
enforceRequiredValues(
|
|
1376
|
+
scenarioData.data.mockData,
|
|
1377
|
+
defaultFlowsForUnaffectedPaths,
|
|
1378
|
+
executionFlows,
|
|
1379
|
+
);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
254
1382
|
|
|
255
|
-
|
|
256
|
-
filePath: entity.filePath,
|
|
257
|
-
entityName: entity.name,
|
|
258
|
-
totalScenarios: scenarios.length,
|
|
259
|
-
defaultScenarioGenerated: !!defaultScenarioResult,
|
|
260
|
-
otherScenariosRequested: scenarios.length - 1,
|
|
261
|
-
otherScenariosResults: results.length,
|
|
262
|
-
nullResults: results.filter((r) => r === null).length,
|
|
263
|
-
validResults: validResults.length,
|
|
264
|
-
finalScenarioDatasCount: scenarioDatas.length,
|
|
1383
|
+
return scenarioData;
|
|
265
1384
|
});
|
|
266
1385
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
JSON.stringify(
|
|
270
|
-
{
|
|
271
|
-
filePath: entity.filePath,
|
|
272
|
-
entityName: entity.name,
|
|
273
|
-
scenarioDatas: scenarioDatas.map((sd) => ({
|
|
274
|
-
scenarioName: sd.scenarioName,
|
|
275
|
-
hasData: !!sd.data,
|
|
276
|
-
dataKeys: sd.data ? Object.keys(sd.data) : [],
|
|
277
|
-
})),
|
|
278
|
-
},
|
|
279
|
-
null,
|
|
280
|
-
2,
|
|
281
|
-
),
|
|
282
|
-
);
|
|
1386
|
+
scenarioDatas.push(...mergedScenarioDatas);
|
|
1387
|
+
llmCalls.push(...validResults.map((result) => result.llmCall));
|
|
283
1388
|
|
|
284
1389
|
return { scenarioDatas, llmCalls };
|
|
285
1390
|
} catch (error) {
|
|
@@ -291,28 +1396,85 @@ export default async function generateEntityScenarioData({
|
|
|
291
1396
|
export const generateSystemMessage = (
|
|
292
1397
|
scenarioName: string,
|
|
293
1398
|
defaultScenario: boolean,
|
|
1399
|
+
requiresErrorData: boolean = false,
|
|
294
1400
|
) => {
|
|
295
1401
|
const scenarioType = defaultScenario
|
|
296
1402
|
? `## Default Scenario
|
|
297
1403
|
Generate COMPLETE, robust data for the entire data structure.
|
|
298
|
-
- Fill ALL fields with realistic values (except error attributes
|
|
299
|
-
-
|
|
300
|
-
-
|
|
1404
|
+
- Fill ALL fields with realistic values (except error attributes)
|
|
1405
|
+
- Do not skip any keys, even simple or small entries
|
|
1406
|
+
- Arrays should have 3-5 items to provide realistic test data variety
|
|
1407
|
+
- Don't skip nested attributes unless the execution flow requirements specify a parent attribute should be null or undefined
|
|
301
1408
|
- This provides the baseline data for all other scenarios`
|
|
302
1409
|
: `## Non-Default Scenario
|
|
303
1410
|
Generate ONLY the differences from the default scenario.
|
|
304
1411
|
- Include only fields that need to change
|
|
305
|
-
-
|
|
1412
|
+
- For object/scalar fields: set to \`null\` to remove/unset the data
|
|
1413
|
+
- For array fields: use \`[]\` for empty arrays (not \`null\`) unless the schema type explicitly includes \`| null\`
|
|
306
1414
|
- Omit unchanged fields—they merge from default`;
|
|
307
1415
|
|
|
1416
|
+
// Only include the "NO ERROR DATA" instruction when the scenario doesn't require error data
|
|
1417
|
+
const noErrorDataInstruction = requiresErrorData
|
|
1418
|
+
? `## IMPORTANT: ERROR DATA REQUIRED
|
|
1419
|
+
This scenario tests error handling. You MUST include "error" fields with realistic error messages.
|
|
1420
|
+
- Set error fields to truthy values (e.g., "Error: Operation failed" or "Something went wrong")
|
|
1421
|
+
- The error data is REQUIRED to trigger the correct error UI state`
|
|
1422
|
+
: `## CRITICAL: NO ERROR DATA
|
|
1423
|
+
NEVER include "error" fields in responses. Skip them entirely.
|
|
1424
|
+
- If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
|
|
1425
|
+
- Leave out any attribute named "error"—do not set to null, omit entirely`;
|
|
1426
|
+
|
|
308
1427
|
return `You are a test data generator. Create mock data matching a data structure and scenario requirements.
|
|
309
1428
|
|
|
1429
|
+
## Execution Flow Requirements
|
|
1430
|
+
Each scenario has \`coveredFlows\` which lists the execution flows (distinct outcomes/behaviors) this scenario should demonstrate.
|
|
1431
|
+
Each flow has \`requiredValues\` - the attribute values that MUST be set to produce that outcome.
|
|
1432
|
+
|
|
1433
|
+
**Your job**: Generate mock data that satisfies ALL the requiredValues from ALL coveredFlows.
|
|
1434
|
+
|
|
1435
|
+
For example, if a flow requires:
|
|
1436
|
+
\`\`\`json
|
|
1437
|
+
{
|
|
1438
|
+
"attributePath": "signature[0].isLoading",
|
|
1439
|
+
"value": "false",
|
|
1440
|
+
"comparison": "equals",
|
|
1441
|
+
"valueType": "boolean"
|
|
1442
|
+
}
|
|
1443
|
+
\`\`\`
|
|
1444
|
+
Then set \`isLoading: false\` in the mockData.
|
|
1445
|
+
|
|
1446
|
+
### Array Length Requirements (length< and length>)
|
|
1447
|
+
For array size variation flows:
|
|
1448
|
+
- \`comparison: "length<"\` with \`value: "0"\` → generate EMPTY array \`[]\`
|
|
1449
|
+
- \`comparison: "length<"\` with \`value: "3"\` → generate 1-2 items (few items)
|
|
1450
|
+
- \`comparison: "length>"\` with \`value: "10"\` → generate 12+ items (many items)
|
|
1451
|
+
|
|
1452
|
+
### String Length Requirements (normal vs long)
|
|
1453
|
+
For text length variation flows:
|
|
1454
|
+
- \`value: "normal"\` with \`valueType: "string"\` → generate normal length text (10-50 chars)
|
|
1455
|
+
- \`value: "long"\` with \`valueType: "string"\` → generate LONG text (200+ chars) to test overflow/truncation
|
|
1456
|
+
|
|
1457
|
+
## CRITICAL: Blocking Flows to Avoid
|
|
1458
|
+
If the scenario includes \`blockingFlowsToAvoid\`, these are flows (like modals, overlays) that would BLOCK the expected UI.
|
|
1459
|
+
You MUST generate mock data that PREVENTS these flows from triggering:
|
|
1460
|
+
|
|
1461
|
+
- For \`comparison: "truthy"\` requirements → set the value to \`false\`, \`null\`, \`undefined\`, or \`0\`
|
|
1462
|
+
- For \`comparison: "exists"\` requirements → set the value to \`null\` or omit it entirely
|
|
1463
|
+
- For \`comparison: "equals"\` requirements → set a DIFFERENT value than what's required
|
|
1464
|
+
|
|
1465
|
+
For example, if a blocking flow has:
|
|
1466
|
+
\`\`\`json
|
|
1467
|
+
{
|
|
1468
|
+
"attributePath": "useFetcher().data.success",
|
|
1469
|
+
"value": "true",
|
|
1470
|
+
"comparison": "truthy"
|
|
1471
|
+
}
|
|
1472
|
+
\`\`\`
|
|
1473
|
+
Then you MUST set \`useFetcher().data\` to \`null\` or \`{ success: false }\` to prevent the modal from appearing.
|
|
1474
|
+
|
|
310
1475
|
${scenarioType}
|
|
311
1476
|
|
|
312
|
-
|
|
313
|
-
NEVER include "error" fields in responses. Skip them entirely.
|
|
314
|
-
- If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
|
|
315
|
-
- Leave out any attribute named "error"—do not set to null, omit entirely
|
|
1477
|
+
${noErrorDataInstruction}
|
|
316
1478
|
|
|
317
1479
|
## Special Markers
|
|
318
1480
|
|
|
@@ -328,30 +1490,20 @@ Use for relative dates. Code runs in Node (no browser APIs, no external librarie
|
|
|
328
1490
|
\`\`\`
|
|
329
1491
|
Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
|
|
330
1492
|
|
|
331
|
-
|
|
332
|
-
|
|
1493
|
+
### Arrays
|
|
1494
|
+
- Arrays should have many items (at least 4) unless specified otherwise
|
|
1495
|
+
- Each item must follow the exact structure provided
|
|
1496
|
+
- In general we want robust data, not minimal data unless specified otherwise
|
|
1497
|
+
- For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
|
|
333
1498
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
\`\`\`
|
|
343
|
-
|
|
344
|
-
### Variable-qualified calls (for multiple calls to the same function)
|
|
345
|
-
When the same function is called multiple times with results stored in different variables, keys use the format \`variableName <- functionName\`:
|
|
346
|
-
\`\`\`json
|
|
347
|
-
{
|
|
348
|
-
"mockData": {
|
|
349
|
-
"entityDiffFetcher <- useFetcher": { "data": null, "state": "idle" },
|
|
350
|
-
"reportFetcher <- useFetcher": { "data": { "reportId": "abc123" }, "state": "idle" }
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
\`\`\`
|
|
354
|
-
This reads as "entityDiffFetcher receives from useFetcher". Each variable gets its own distinct mock data.
|
|
1499
|
+
## CRITICAL: Preserve Exact Structure
|
|
1500
|
+
Your response MUST mirror the EXACT nested structure provided in mockData Structure.
|
|
1501
|
+
- Do NOT reorganize, split, or create duplicate keys
|
|
1502
|
+
- The hierarchy of nested objects must match exactly what was provided unless overridden by scenario rules
|
|
1503
|
+
- Only change the leaf VALUES (replacing type descriptions like "string" with actual data like "hello")
|
|
1504
|
+
- Copy the key strings EXACTLY from the structure
|
|
1505
|
+
- Do NOT modify type parameters, arguments, or any part of the key
|
|
1506
|
+
- The keys preserve the exact function call as written in the original code
|
|
355
1507
|
|
|
356
1508
|
## Response Format
|
|
357
1509
|
\`\`\`json
|
|
@@ -369,9 +1521,15 @@ This reads as "entityDiffFetcher receives from useFetcher". Each variable gets i
|
|
|
369
1521
|
## Rules
|
|
370
1522
|
- Valid JSON only—no raw code outside markers
|
|
371
1523
|
- No \`undefined\`—use \`null\` or omit
|
|
372
|
-
- No data references (can't use \`posts[0]\` elsewhere—duplicate the value)
|
|
1524
|
+
- No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
|
|
373
1525
|
- Scenario name must match exactly: "${scenarioName}"
|
|
374
1526
|
- Empty mockData: \`{}\`, empty argumentsData: \`[]\`
|
|
1527
|
+
|
|
1528
|
+
## IMPORTANT: Avoid Identifier Collisions
|
|
1529
|
+
When generating identifier values (SHA hashes, entity IDs, etc.):
|
|
1530
|
+
- Use DISTINCT values for different identifier fields
|
|
1531
|
+
- Avoid matching: if \`entity.sha\` is "abc123", arrays like \`jobs[].entityShas\` or \`currentlyExecuting.entityShas\` should NOT contain "abc123"
|
|
1532
|
+
- This prevents accidental blocking of UI conditionals that check if IDs are in/not-in arrays
|
|
375
1533
|
`;
|
|
376
1534
|
};
|
|
377
1535
|
|
|
@@ -387,3 +1545,163 @@ Here is the original system message as well:
|
|
|
387
1545
|
${generateSystemMessage(scenarioName, isDefault)}
|
|
388
1546
|
\`\`\`
|
|
389
1547
|
`;
|
|
1548
|
+
|
|
1549
|
+
/**
|
|
1550
|
+
* System message for follow-up calls to generate missing mockData keys.
|
|
1551
|
+
* Includes the same rules as the main system message but with a simpler response format.
|
|
1552
|
+
*/
|
|
1553
|
+
export const generateMissingKeysSystemMessage =
|
|
1554
|
+
() => `You are completing mock data generation for the Default Scenario. The initial response was missing some keys.
|
|
1555
|
+
|
|
1556
|
+
Generate data ONLY for the missing keys provided in the prompt. Do not skip any of them.
|
|
1557
|
+
|
|
1558
|
+
- Scenario name must match exactly: "Default Scenario"
|
|
1559
|
+
|
|
1560
|
+
## Special Markers
|
|
1561
|
+
|
|
1562
|
+
### Dynamic Dates (\`~~codeyam-code~~\`)
|
|
1563
|
+
\`\`\`json
|
|
1564
|
+
{ "createdAt": { "~~codeyam-code~~": "new Date(Date.now() - 24*60*60*1000)" } }
|
|
1565
|
+
\`\`\`
|
|
1566
|
+
Use for relative dates. Code runs in Node (no browser APIs, no external libraries).
|
|
1567
|
+
|
|
1568
|
+
### JSX Children (\`~~codeyam-jsx~~\`)
|
|
1569
|
+
\`\`\`json
|
|
1570
|
+
{ "children": { "~~codeyam-jsx~~": "<div>Hello</div>" } }
|
|
1571
|
+
\`\`\`
|
|
1572
|
+
Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
|
|
1573
|
+
|
|
1574
|
+
### Arrays
|
|
1575
|
+
- Arrays should have many items (at least 4) unless specified otherwise
|
|
1576
|
+
- Each item must follow the exact structure provided
|
|
1577
|
+
- For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
|
|
1578
|
+
|
|
1579
|
+
## CRITICAL: Preserve Exact Structure
|
|
1580
|
+
Your response MUST mirror the EXACT nested structure provided for the missing keys.
|
|
1581
|
+
- Only change the leaf VALUES (replacing type descriptions like "string" with actual data)
|
|
1582
|
+
- Copy the key strings EXACTLY from the structure
|
|
1583
|
+
- Do NOT modify type parameters, arguments, or any part of the key
|
|
1584
|
+
|
|
1585
|
+
## CRITICAL: NO ERROR DATA
|
|
1586
|
+
NEVER include "error" fields in responses. Skip them entirely.
|
|
1587
|
+
- If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
|
|
1588
|
+
- Leave out any attribute named "error"—do not set to null, omit entirely
|
|
1589
|
+
|
|
1590
|
+
## Response Format
|
|
1591
|
+
\`\`\`json
|
|
1592
|
+
{
|
|
1593
|
+
"mockData": {
|
|
1594
|
+
// fill in ONLY the missing keys
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
\`\`\`
|
|
1598
|
+
|
|
1599
|
+
## Rules
|
|
1600
|
+
- Valid JSON only—no raw code outside markers
|
|
1601
|
+
- No \`undefined\`—use \`null\` or omit
|
|
1602
|
+
- No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
|
|
1603
|
+
`;
|
|
1604
|
+
|
|
1605
|
+
/**
|
|
1606
|
+
* System message for focused calls to generate critical mockData keys.
|
|
1607
|
+
* These are keys referenced by the scenario's execution flow requiredValues.
|
|
1608
|
+
*/
|
|
1609
|
+
export const generateCriticalKeysSystemMessage = (
|
|
1610
|
+
scenarioName: string,
|
|
1611
|
+
) => `You are generating mock data for CRITICAL keys that control scenario behavior.
|
|
1612
|
+
|
|
1613
|
+
These keys are referenced by the execution flow's requiredValues - they directly determine
|
|
1614
|
+
what the component renders. Pay EXTRA attention to matching the exact structure and values.
|
|
1615
|
+
|
|
1616
|
+
- Scenario name must match exactly: "${scenarioName}"
|
|
1617
|
+
|
|
1618
|
+
## CRITICAL: Special Characters in Keys
|
|
1619
|
+
Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
|
|
1620
|
+
- If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
|
|
1621
|
+
- Do NOT interpret \`*\` as "any key" - use it as an actual key name
|
|
1622
|
+
|
|
1623
|
+
## CRITICAL: Preserve Exact Structure
|
|
1624
|
+
Your response MUST mirror the EXACT nested structure provided.
|
|
1625
|
+
- Copy key strings EXACTLY as shown (including special characters)
|
|
1626
|
+
- Only change leaf VALUES (replacing type descriptions with actual data)
|
|
1627
|
+
- Do NOT modify keys, type parameters, or add extra keys
|
|
1628
|
+
|
|
1629
|
+
## Matching requiredValues
|
|
1630
|
+
When the prompt shows requiredValues like:
|
|
1631
|
+
- \`attributePath: "useParams().functionCallReturnValue.*"\`
|
|
1632
|
+
- \`value: "scenarios"\`
|
|
1633
|
+
|
|
1634
|
+
This means set the \`*\` key to include "scenarios". For URL paths split by \`/\`,
|
|
1635
|
+
generate a path like \`"scenarios/id/mode"\` where segments match requirements.
|
|
1636
|
+
|
|
1637
|
+
## Response Format
|
|
1638
|
+
\`\`\`json
|
|
1639
|
+
{
|
|
1640
|
+
"scenarioData": {
|
|
1641
|
+
"scenarioName": "${scenarioName}",
|
|
1642
|
+
"data": {
|
|
1643
|
+
"mockData": {
|
|
1644
|
+
// generate data for ONLY the critical keys
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
\`\`\`
|
|
1650
|
+
|
|
1651
|
+
## Rules
|
|
1652
|
+
- Valid JSON only
|
|
1653
|
+
- No \`undefined\`—use \`null\` or omit
|
|
1654
|
+
- Match the exact schema structure provided
|
|
1655
|
+
`;
|
|
1656
|
+
|
|
1657
|
+
/**
|
|
1658
|
+
* System message for focused calls to generate mock data for a chunk of keys.
|
|
1659
|
+
* Used when data structures are large and need to be processed in smaller pieces.
|
|
1660
|
+
*/
|
|
1661
|
+
export const generateChunkSystemMessage = (
|
|
1662
|
+
scenarioName: string,
|
|
1663
|
+
) => `You are generating mock data for a SUBSET of keys from a larger data structure.
|
|
1664
|
+
|
|
1665
|
+
This chunk contains fewer keys so you can focus on generating HIGH QUALITY data for each one.
|
|
1666
|
+
Pay EXTRA attention to matching the exact structure and values for each key.
|
|
1667
|
+
|
|
1668
|
+
- Scenario name must match exactly: "${scenarioName}"
|
|
1669
|
+
|
|
1670
|
+
## CRITICAL: Special Characters in Keys
|
|
1671
|
+
Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
|
|
1672
|
+
- If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
|
|
1673
|
+
- Do NOT interpret \`*\` as "any key" - use it as an actual key name
|
|
1674
|
+
|
|
1675
|
+
## CRITICAL: Preserve Exact Structure
|
|
1676
|
+
Your response MUST mirror the EXACT nested structure provided.
|
|
1677
|
+
- Copy key strings EXACTLY as shown (including special characters)
|
|
1678
|
+
- Only change leaf VALUES (replacing type descriptions with actual data)
|
|
1679
|
+
- Do NOT modify keys, type parameters, or add extra keys
|
|
1680
|
+
|
|
1681
|
+
## Matching requiredValues
|
|
1682
|
+
If the prompt includes requiredValues, these are specific values that MUST be set:
|
|
1683
|
+
- For \`attributePath: "useParams().functionCallReturnValue.*"\` with \`value: "scenarios"\`
|
|
1684
|
+
→ Set the \`*\` key to include "scenarios" (e.g., "scenarios/id/mode")
|
|
1685
|
+
- For URL paths, generate realistic paths that satisfy the requirements
|
|
1686
|
+
|
|
1687
|
+
## CRITICAL: NO ERROR DATA
|
|
1688
|
+
NEVER include "error" fields in responses. Skip them entirely.
|
|
1689
|
+
- If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
|
|
1690
|
+
- Leave out any attribute named "error"—do not set to null, omit entirely
|
|
1691
|
+
|
|
1692
|
+
## Response Format
|
|
1693
|
+
\`\`\`json
|
|
1694
|
+
{
|
|
1695
|
+
"mockData": {
|
|
1696
|
+
// generate data for ONLY the keys in this chunk
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
\`\`\`
|
|
1700
|
+
|
|
1701
|
+
## Rules
|
|
1702
|
+
- Valid JSON only
|
|
1703
|
+
- No \`undefined\`—use \`null\` or omit
|
|
1704
|
+
- Generate data for ALL keys in the chunk (don't skip any)
|
|
1705
|
+
- Arrays should have many items (at least 4) unless specified otherwise
|
|
1706
|
+
- For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
|
|
1707
|
+
`;
|