@codeyam/codeyam-cli 0.1.0-staging.1669d45 → 0.1.0-staging.323686
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/log.txt +3 -3
- package/analyzer-template/package.json +3 -3
- package/analyzer-template/packages/ai/index.ts +9 -1
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +48 -34
- package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +31 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +139 -23
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +6 -126
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +277 -8
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +73 -1
- package/analyzer-template/packages/ai/src/lib/completionCall.ts +198 -34
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +108 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +205 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +23 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +87 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +32 -7
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
- package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
- package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +626 -6
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +26 -1
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +375 -6
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1003 -45
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
- 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 +23 -6
- package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
- package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +154 -32
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +22 -1
- package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
- package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +10 -13
- package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -7
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +142 -73
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +42 -5
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +1 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +77 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -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/updateCommitMetadata.ts +7 -14
- 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 +8 -1
- 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/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/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/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/types/index.d.ts +1 -1
- 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 +25 -1
- 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/ScenariosDataStructure.d.ts +51 -1
- package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/types/index.ts +1 -0
- package/analyzer-template/packages/types/src/types/Analysis.ts +25 -0
- package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
- package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +64 -1
- package/analyzer-template/packages/utils/dist/types/index.d.ts +1 -1
- 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 +25 -1
- 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/ScenariosDataStructure.d.ts +51 -1
- package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
- package/analyzer-template/playwright/capture.ts +20 -8
- package/analyzer-template/playwright/captureStatic.ts +1 -1
- package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
- package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
- package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
- package/analyzer-template/project/constructMockCode.ts +314 -29
- package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
- package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
- package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
- package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
- package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
- package/analyzer-template/project/orchestrateCapture.ts +71 -6
- package/analyzer-template/project/reconcileMockDataKeys.ts +152 -9
- package/analyzer-template/project/runAnalysis.ts +4 -0
- package/analyzer-template/project/start.ts +35 -11
- package/analyzer-template/project/writeMockDataTsx.ts +114 -2
- package/analyzer-template/project/writeScenarioComponents.ts +101 -8
- package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
- package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
- package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
- 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 +255 -4
- package/background/src/lib/virtualized/project/constructMockCode.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/loadReadyToBeCaptured.js +19 -8
- package/background/src/lib/virtualized/project/loadReadyToBeCaptured.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/SequentialCaptureTaskRunner.js +7 -5
- package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +58 -6
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +126 -9
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/runAnalysis.js +3 -0
- package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +32 -11
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +89 -2
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +57 -8
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/codeyam-cli/src/cli.js +2 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +273 -0
- package/codeyam-cli/src/commands/memory.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +4 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +21 -2
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +20 -6
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +1 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/queue/manager.js +6 -0
- package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
- package/codeyam-cli/src/utils/rules/index.js +5 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -0
- package/codeyam-cli/src/utils/rules/parser.js +106 -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/staleness.js +132 -0
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +2 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +7 -3
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +40 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-DsN1wKrm.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-COi5OvsN.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BwdQv49w.js → EntityTypeIcon-Ba2JVPzP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-CEleMv_j.js → InlineSpinner-C8lyxW9k.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D68KarMg.js → InteractivePreview-aht4aafF.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-L75Wvqgw.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-C53WM8qn.js → LoadingDots-B0GLXMsr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CrNkmy4i.js → LogViewer-xgeCVgSM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-OApQuNyq.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CQifa1n-.js → SafeScreenshot-DuDvi0jm.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CyaBFX7l.js → ScenarioViewer-DzccYyI8.js} +3 -13
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D36O1rzU.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BwavGCpm.js +32 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.health-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/{chevron-down-DgTPh8H-.js → chevron-down-Cx24_aWc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-DdQKK6on.js → chunk-EPOLDU6W-CXRTFQ3F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-Dmr2bb1R.js → circle-check-BOARzkeR.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Do4ZLUYa.js → createLucideIcon-BdhJEx6B.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BBnGWYga.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CbdFyxZh.js → entity._sha._-BJUiQqZF.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js → entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-wDWZZO1W.js → entity._sha_.create-scenario-D1T4TGjf.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMbl7MeQ.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-5wRKRIH9.js → entry.client-CS2cb_eZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DD3SDH7t.js → fileTableUtils-DMJ7zii9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-CJ6lTdTA.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{git-zXjT7J0G.js → git-CPTZZ-JZ.js} +8 -8
- package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-DLbXwndH.js → index-B1h680n5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-gPZ-lad1.js → index-lzqtyFU8.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BsPXJ81F.js → loader-circle-B7B9V-bu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-7522edd4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-yxFcrxBX.js +92 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-P2FKIUql.js → search-CxXUmBSd.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{settings-B2eDuBj8.js → settings-CS5f3WzT.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-L18M6-kN.js → simulations-DwFIBT09.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BDz7kbVA.js → triangle-alert-B6LgvRJg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-29dDmbH8.js → useCustomSizes-C1v1PQzo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BUm0UVJm.js → useLastLogLine-aSv48UbS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CkIOKTrZ.js → useReportContext-DYxHZQuP.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-KKw5kTn-.js → useToast-mBRpZPiu.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-DVzYx8PN.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-4Cr0uToj.js +257 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/templates/codeyam-memory-hook.sh +200 -0
- package/codeyam-cli/templates/codeyam:debug.md +47 -3
- package/codeyam-cli/templates/codeyam:diagnose.md +203 -25
- package/codeyam-cli/templates/codeyam:memory.md +462 -0
- package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
- package/package.json +8 -5
- package/packages/ai/index.js +5 -2
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +41 -17
- 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 +24 -0
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +109 -23
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +1 -102
- package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +228 -11
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/completionCall.js +161 -30
- package/packages/ai/src/lib/completionCall.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +86 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +179 -0
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +19 -0
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +70 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +29 -7
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
- package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructureChunking.js +111 -0
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
- package/packages/ai/src/lib/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/generateEntityScenarioData.js +510 -7
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +19 -1
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +273 -4
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +738 -40
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
- package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
- 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 +15 -7
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.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 +131 -27
- package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
- package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
- package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
- package/packages/ai/src/lib/worker/analyzeScopeWorker.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/files/analyze/analyzeEntities/prepareDataStructures.js +8 -4
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.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/validateDependencyAnalyses.js +31 -7
- package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +116 -66
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +37 -5
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +65 -0
- 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/database/src/lib/kysely/db.js +8 -1
- 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/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/updateCommitMetadata.js +5 -4
- package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
- package/packages/types/index.js.map +1 -1
- package/packages/utils/src/lib/safeFileName.js +29 -3
- package/packages/utils/src/lib/safeFileName.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +0 -37
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +0 -57
- package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +0 -228
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import completionCall from "./completionCall.js";
|
|
2
2
|
import generateEntityScenarioDataGenerator from "./promptGenerators/generateEntityScenarioDataGenerator.js";
|
|
3
3
|
import generateMissingKeysPrompt from "./promptGenerators/generateMissingKeysPrompt.js";
|
|
4
|
+
import generateChunkPrompt from "./promptGenerators/generateChunkPrompt.js";
|
|
4
5
|
import { saveLlmCall } from "../../../../packages/aws/dynamodb/index.js";
|
|
6
|
+
import { trackDataSnapshot } from "./e2eDataTracking.js";
|
|
5
7
|
import validateJson from "./validateJson.js";
|
|
6
8
|
import { awsLog, awsLogDebugLevel } from "../../../../packages/utils/index.js";
|
|
7
9
|
import { parseJsonSafe } from "../../../../packages/ai/index.js";
|
|
8
10
|
import convertNullToUndefinedBySchema from "./dataStructure/helpers/convertNullToUndefinedBySchema.js";
|
|
11
|
+
import fixNullIdsBySchema from "./dataStructure/helpers/fixNullIdsBySchema.js";
|
|
12
|
+
import { deepMerge } from "../../../../packages/generate/index.js";
|
|
13
|
+
import { chunkDataStructure, getRequiredValuesForChunk, } from "./dataStructureChunking.js";
|
|
9
14
|
/**
|
|
10
15
|
* Check if any of the scenario's covered flows require error data.
|
|
11
16
|
* Returns true if any requiredValue has an error path with truthy comparison.
|
|
@@ -90,6 +95,278 @@ function deepMergeScenarioData(defaultData, scenarioData) {
|
|
|
90
95
|
return result;
|
|
91
96
|
}
|
|
92
97
|
const DEFAULT_SCENARIO_NAME = 'Default Scenario';
|
|
98
|
+
/**
|
|
99
|
+
* Find the path to a key within a nested dataForMocks structure.
|
|
100
|
+
* Returns the path as an array of keys, or null if not found.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* // dataForMocks = { trpc: { fastener: { "useMutation()": { isLoading: "boolean" } } } }
|
|
104
|
+
* // findKeyPath("fastener", dataForMocks) returns ["trpc"]
|
|
105
|
+
*/
|
|
106
|
+
function findKeyPath(targetKey, obj, currentPath = []) {
|
|
107
|
+
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
for (const key of Object.keys(obj)) {
|
|
111
|
+
if (key === targetKey) {
|
|
112
|
+
return currentPath;
|
|
113
|
+
}
|
|
114
|
+
// Recursively search in nested objects
|
|
115
|
+
const nested = obj[key];
|
|
116
|
+
if (typeof nested === 'object' &&
|
|
117
|
+
nested !== null &&
|
|
118
|
+
!Array.isArray(nested)) {
|
|
119
|
+
const result = findKeyPath(targetKey, nested, [
|
|
120
|
+
...currentPath,
|
|
121
|
+
key,
|
|
122
|
+
]);
|
|
123
|
+
if (result !== null) {
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Relocate misplaced nested keys in mockData to their correct position
|
|
132
|
+
* based on the dataForMocks structure.
|
|
133
|
+
*
|
|
134
|
+
* When the LLM returns mockData with keys at the wrong nesting level
|
|
135
|
+
* (e.g., { trpc: { quote: {...} }, fastener: {...} } when fastener should
|
|
136
|
+
* be inside trpc), this function moves them to the correct position.
|
|
137
|
+
*
|
|
138
|
+
* This function works recursively to handle nested misplacements, not just
|
|
139
|
+
* root-level ones. For example, if getQuote is at trpc.getQuote instead of
|
|
140
|
+
* trpc.quote.getQuote, it will be relocated.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* // dataForMocks: { trpc: { quote: {...}, fastener: {...} } }
|
|
144
|
+
* // mockData: { trpc: { quote: {...} }, fastener: {...} }
|
|
145
|
+
* // After: mockData: { trpc: { quote: {...}, fastener: {...} } }
|
|
146
|
+
*
|
|
147
|
+
* @example (nested case)
|
|
148
|
+
* // dataForMocks: { trpc: { quote: { getQuote: {...} } } }
|
|
149
|
+
* // mockData: { trpc: { quote: {...}, getQuote: {...} } }
|
|
150
|
+
* // After: mockData: { trpc: { quote: { getQuote: {...} } } }
|
|
151
|
+
*/
|
|
152
|
+
function relocateMisplacedNestedKeys(mockData, dataForMocks, currentPathForLogging = []) {
|
|
153
|
+
if (typeof dataForMocks !== 'object' || dataForMocks === null) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const keysInSchema = Object.keys(dataForMocks);
|
|
157
|
+
const keysToRelocate = [];
|
|
158
|
+
// Find keys in mockData that are NOT at this level in dataForMocks
|
|
159
|
+
// but DO exist somewhere nested in dataForMocks
|
|
160
|
+
for (const key of Object.keys(mockData)) {
|
|
161
|
+
if (!keysInSchema.includes(key)) {
|
|
162
|
+
// This key is at this level in mockData but not at this level in dataForMocks
|
|
163
|
+
// Check if it exists somewhere nested in dataForMocks
|
|
164
|
+
const path = findKeyPath(key, dataForMocks);
|
|
165
|
+
if (path !== null && path.length > 0) {
|
|
166
|
+
keysToRelocate.push({ key, path });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Relocate each misplaced key to its correct nested position
|
|
171
|
+
for (const { key, path } of keysToRelocate) {
|
|
172
|
+
const value = mockData[key];
|
|
173
|
+
// Navigate to the correct parent in mockData, creating nested objects if needed
|
|
174
|
+
let current = mockData;
|
|
175
|
+
for (const pathKey of path) {
|
|
176
|
+
if (current[pathKey] === undefined) {
|
|
177
|
+
current[pathKey] = {};
|
|
178
|
+
}
|
|
179
|
+
current = current[pathKey];
|
|
180
|
+
}
|
|
181
|
+
// Deep merge the value into the correct location
|
|
182
|
+
// Use deep merge to preserve existing data at that location
|
|
183
|
+
if (current[key] !== undefined && typeof current[key] === 'object') {
|
|
184
|
+
current[key] = deepMerge(current[key], value);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
current[key] = value;
|
|
188
|
+
}
|
|
189
|
+
// Remove the key from its current (wrong) level
|
|
190
|
+
delete mockData[key];
|
|
191
|
+
const fullPath = [...currentPathForLogging, ...path].join('.');
|
|
192
|
+
awsLog(`CodeYam: Relocated misplaced key "${key}" from [${currentPathForLogging.join('.')}] to [${fullPath}]`);
|
|
193
|
+
}
|
|
194
|
+
// Recursively process nested objects to handle deeply nested misplacements
|
|
195
|
+
for (const key of Object.keys(mockData)) {
|
|
196
|
+
const mockValue = mockData[key];
|
|
197
|
+
const schemaValue = dataForMocks[key];
|
|
198
|
+
// Only recurse if both mockData and schema have nested objects at this key
|
|
199
|
+
if (typeof mockValue === 'object' &&
|
|
200
|
+
mockValue !== null &&
|
|
201
|
+
!Array.isArray(mockValue) &&
|
|
202
|
+
typeof schemaValue === 'object' &&
|
|
203
|
+
schemaValue !== null &&
|
|
204
|
+
!Array.isArray(schemaValue)) {
|
|
205
|
+
relocateMisplacedNestedKeys(mockValue, schemaValue, [...currentPathForLogging, key]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Generate default mock data for a schema type.
|
|
211
|
+
* Returns reasonable default values based on the schema type string.
|
|
212
|
+
*/
|
|
213
|
+
function generateDefaultForSchemaType(schemaType) {
|
|
214
|
+
if (typeof schemaType === 'string') {
|
|
215
|
+
// Handle common type strings
|
|
216
|
+
if (schemaType === 'function')
|
|
217
|
+
return () => { };
|
|
218
|
+
if (schemaType === 'promise')
|
|
219
|
+
return Promise.resolve();
|
|
220
|
+
if (schemaType === 'boolean')
|
|
221
|
+
return false;
|
|
222
|
+
if (schemaType === 'string')
|
|
223
|
+
return '';
|
|
224
|
+
if (schemaType === 'number')
|
|
225
|
+
return 0;
|
|
226
|
+
if (schemaType.includes('number | undefined'))
|
|
227
|
+
return undefined;
|
|
228
|
+
if (schemaType.includes('string | undefined'))
|
|
229
|
+
return undefined;
|
|
230
|
+
if (schemaType.includes('boolean | undefined'))
|
|
231
|
+
return undefined;
|
|
232
|
+
if (schemaType.includes('| undefined'))
|
|
233
|
+
return undefined;
|
|
234
|
+
if (schemaType.includes('| null'))
|
|
235
|
+
return null;
|
|
236
|
+
return schemaType; // Return the type as a string placeholder
|
|
237
|
+
}
|
|
238
|
+
if (typeof schemaType === 'object' &&
|
|
239
|
+
schemaType !== null &&
|
|
240
|
+
!Array.isArray(schemaType)) {
|
|
241
|
+
// Recursively generate defaults for nested objects
|
|
242
|
+
const result = {};
|
|
243
|
+
for (const [key, value] of Object.entries(schemaType)) {
|
|
244
|
+
result[key] = generateDefaultForSchemaType(value);
|
|
245
|
+
}
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Detect if a string should be converted to an array.
|
|
252
|
+
* Returns the array if the field appears to be an array field, or null if it should remain a string.
|
|
253
|
+
*
|
|
254
|
+
* This handles two cases:
|
|
255
|
+
* 1. Comma-separated values: "color,size" -> ["color", "size"]
|
|
256
|
+
* 2. Single values for array-named fields: "Finish" -> ["Finish"]
|
|
257
|
+
*/
|
|
258
|
+
function parseCommaSeparatedStringAsArray(value, key) {
|
|
259
|
+
// Heuristic: if the key name suggests it's an array field, convert it
|
|
260
|
+
// Common patterns: *_attributes, *_ids, *_items, *_tags, *_values, plural names
|
|
261
|
+
// Check this FIRST because array-named fields should be converted regardless
|
|
262
|
+
// of whether they contain commas (single values become single-element arrays).
|
|
263
|
+
const arrayFieldPatterns = [
|
|
264
|
+
/_attributes$/i,
|
|
265
|
+
/_ids$/i,
|
|
266
|
+
/_items$/i,
|
|
267
|
+
/_tags$/i,
|
|
268
|
+
/_values$/i,
|
|
269
|
+
/_types$/i,
|
|
270
|
+
/_names$/i,
|
|
271
|
+
/_keys$/i,
|
|
272
|
+
/^attributes$/i,
|
|
273
|
+
/^items$/i,
|
|
274
|
+
/^tags$/i,
|
|
275
|
+
/^values$/i,
|
|
276
|
+
];
|
|
277
|
+
const looksLikeArrayField = arrayFieldPatterns.some((pattern) => pattern.test(key));
|
|
278
|
+
if (looksLikeArrayField) {
|
|
279
|
+
// Skip newlines check - multiline values shouldn't be split
|
|
280
|
+
if (value.includes('\n')) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
// Split by comma and trim whitespace
|
|
284
|
+
const parts = value.split(',').map((s) => s.trim());
|
|
285
|
+
// Filter out empty strings - this handles both "Finish" -> ["Finish"]
|
|
286
|
+
// and "" -> []
|
|
287
|
+
return parts.filter((s) => s.length > 0);
|
|
288
|
+
}
|
|
289
|
+
// For non-array-named fields, only convert if there are commas
|
|
290
|
+
if (!value.includes(',')) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
// For non-array-named fields, apply stricter sentence detection
|
|
294
|
+
// Skip if it looks like a sentence (comma followed by space and lowercase)
|
|
295
|
+
if (/,\s+[a-z]/.test(value)) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
// Skip if it contains newlines (likely formatted text)
|
|
299
|
+
if (value.includes('\n')) {
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Convert comma-separated string values to arrays when they look like array data.
|
|
306
|
+
* This handles cases where the LLM generates strings like "color,size" instead
|
|
307
|
+
* of arrays like ["color", "size"] due to schema type misdetection.
|
|
308
|
+
*/
|
|
309
|
+
function convertCommaSeparatedStringsToArrays(mockData) {
|
|
310
|
+
for (const [key, value] of Object.entries(mockData)) {
|
|
311
|
+
if (typeof value === 'string') {
|
|
312
|
+
const asArray = parseCommaSeparatedStringAsArray(value, key);
|
|
313
|
+
if (asArray !== null) {
|
|
314
|
+
mockData[key] = asArray;
|
|
315
|
+
awsLog(`CodeYam: Converted comma-separated string to array for key "${key}": "${value}" -> [${asArray.map((s) => `"${s}"`).join(', ')}]`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else if (value !== null &&
|
|
319
|
+
typeof value === 'object' &&
|
|
320
|
+
!Array.isArray(value)) {
|
|
321
|
+
// Recursively process nested objects
|
|
322
|
+
convertCommaSeparatedStringsToArrays(value);
|
|
323
|
+
}
|
|
324
|
+
else if (Array.isArray(value)) {
|
|
325
|
+
// Recursively process arrays (each element could be an object)
|
|
326
|
+
for (const item of value) {
|
|
327
|
+
if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
|
|
328
|
+
convertCommaSeparatedStringsToArrays(item);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Ensure all keys from dataForMocks have corresponding data in mockData.
|
|
336
|
+
* For missing keys, generate default values based on the schema.
|
|
337
|
+
* Recursively checks nested objects to fill in any missing nested fields.
|
|
338
|
+
*/
|
|
339
|
+
function fillMissingMockDataKeysWithDefaults(mockData, dataForMocks, pathPrefix = '') {
|
|
340
|
+
if (typeof dataForMocks !== 'object' || dataForMocks === null) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const missingKeys = [];
|
|
344
|
+
for (const key of Object.keys(dataForMocks)) {
|
|
345
|
+
const fullPath = pathPrefix ? `${pathPrefix}.${key}` : key;
|
|
346
|
+
if (mockData[key] === undefined) {
|
|
347
|
+
missingKeys.push(fullPath);
|
|
348
|
+
// Generate default data based on schema
|
|
349
|
+
const schemaForKey = dataForMocks[key];
|
|
350
|
+
mockData[key] = generateDefaultForSchemaType(schemaForKey);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
// Key exists, but if both are objects, recursively check for missing nested keys
|
|
354
|
+
const schemaValue = dataForMocks[key];
|
|
355
|
+
const mockValue = mockData[key];
|
|
356
|
+
if (typeof schemaValue === 'object' &&
|
|
357
|
+
schemaValue !== null &&
|
|
358
|
+
!Array.isArray(schemaValue) &&
|
|
359
|
+
typeof mockValue === 'object' &&
|
|
360
|
+
mockValue !== null &&
|
|
361
|
+
!Array.isArray(mockValue)) {
|
|
362
|
+
fillMissingMockDataKeysWithDefaults(mockValue, schemaValue, fullPath);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (missingKeys.length > 0) {
|
|
367
|
+
awsLog(`CodeYam: Generated default mock data for ${missingKeys.length} missing key(s): ${missingKeys.slice(0, 10).join(', ')}${missingKeys.length > 10 ? '...' : ''}`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
93
370
|
/**
|
|
94
371
|
* For Default Scenario only: detect missing mockData keys and make a follow-up
|
|
95
372
|
* LLM call to fill them in. This handles cases where the LLM completes normally
|
|
@@ -144,8 +421,69 @@ async function fillMissingMockDataKeys({ structure, scenario, executionFlows, fu
|
|
|
144
421
|
}
|
|
145
422
|
}
|
|
146
423
|
export async function generateDataForScenario({ entity, structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, analysis, model, }) {
|
|
424
|
+
var _a;
|
|
147
425
|
awsLogDebugLevel(1, `Generating data for ${entity.name}: ${scenario.name}`);
|
|
148
|
-
|
|
426
|
+
// Check if we should chunk the data structure for focused processing
|
|
427
|
+
let chunkedMockData;
|
|
428
|
+
const coveredFlowIds = scenario.metadata?.coveredFlows || [];
|
|
429
|
+
if (structure.dataForMocks &&
|
|
430
|
+
!incompleteResponse // Don't do chunked calls on continuation
|
|
431
|
+
) {
|
|
432
|
+
const chunks = chunkDataStructure(structure.dataForMocks);
|
|
433
|
+
// If we have multiple chunks, process each one with a focused call
|
|
434
|
+
if (chunks.length > 1) {
|
|
435
|
+
awsLog(`Data structure has ${Object.keys(structure.dataForMocks).length} keys, splitting into ${chunks.length} chunks for focused processing`);
|
|
436
|
+
chunkedMockData = {};
|
|
437
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
438
|
+
const chunk = chunks[i];
|
|
439
|
+
const chunkKeys = Object.keys(chunk || {});
|
|
440
|
+
// Get relevant requiredValues for this chunk
|
|
441
|
+
const relevantRequiredValues = getRequiredValuesForChunk(chunk, executionFlows || [], coveredFlowIds);
|
|
442
|
+
awsLog(`Processing chunk ${i + 1}/${chunks.length}: ${chunkKeys.join(', ')}`);
|
|
443
|
+
const chunkPrompt = generateChunkPrompt({
|
|
444
|
+
scenario,
|
|
445
|
+
chunk,
|
|
446
|
+
chunkIndex: i,
|
|
447
|
+
totalChunks: chunks.length,
|
|
448
|
+
relevantRequiredValues,
|
|
449
|
+
});
|
|
450
|
+
const chunkResponse = await completionCall({
|
|
451
|
+
type: 'generateChunkMockData',
|
|
452
|
+
systemMessage: generateChunkSystemMessage(scenario.name),
|
|
453
|
+
prompt: chunkPrompt,
|
|
454
|
+
model,
|
|
455
|
+
});
|
|
456
|
+
// Save chunk call to LLM log for replay support
|
|
457
|
+
await saveLlmCall({
|
|
458
|
+
object_type: 'analysis',
|
|
459
|
+
object_id: analysis.id,
|
|
460
|
+
propsJson: {
|
|
461
|
+
entity: { name: entity.name, filePath: entity.filePath },
|
|
462
|
+
scenario: { name: scenario.name },
|
|
463
|
+
chunkIndex: i,
|
|
464
|
+
totalChunks: chunks.length,
|
|
465
|
+
},
|
|
466
|
+
...chunkResponse.stats,
|
|
467
|
+
});
|
|
468
|
+
if (chunkResponse.completion) {
|
|
469
|
+
const validJson = validateJson(chunkResponse.completion);
|
|
470
|
+
const parsed = parseJsonSafe(validJson);
|
|
471
|
+
if (parsed && typeof parsed === 'object' && 'mockData' in parsed) {
|
|
472
|
+
const chunkMockData = parsed.mockData;
|
|
473
|
+
if (chunkMockData && typeof chunkMockData === 'object') {
|
|
474
|
+
Object.assign(chunkedMockData, chunkMockData);
|
|
475
|
+
awsLog(`Chunk ${i + 1} generated data for: ${Object.keys(chunkMockData).join(', ')}`);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
awsLog(`Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
// When we have chunked mock data with actual content, tell the main prompt to skip mockData generation
|
|
484
|
+
// Important: Check for actual keys, not just truthy object, because {} would skip generation incorrectly
|
|
485
|
+
const hasChunkedData = chunkedMockData && Object.keys(chunkedMockData).length > 0;
|
|
486
|
+
const prompt = generateEntityScenarioDataGenerator(structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, { mockDataAlreadyGenerated: hasChunkedData });
|
|
149
487
|
const isDefault = scenario.name === DEFAULT_SCENARIO_NAME;
|
|
150
488
|
const response = await completionCall({
|
|
151
489
|
type: 'generateEntityScenarioData',
|
|
@@ -267,12 +605,36 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
|
|
|
267
605
|
}
|
|
268
606
|
}
|
|
269
607
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
608
|
+
// Merge flat-level mock data into mockData.
|
|
609
|
+
// Sometimes the LLM returns some data inside data.mockData but other data at the flat
|
|
610
|
+
// data level (e.g., data.useRouter() instead of data.mockData.useRouter()).
|
|
611
|
+
// This code ensures all dataForMocks keys end up in mockData.
|
|
612
|
+
if (structure.dataForMocks) {
|
|
613
|
+
(_a = fullScenarioData.data).mockData || (_a.mockData = {});
|
|
614
|
+
const dataAsAny = fullScenarioData.data;
|
|
615
|
+
for (const propKey of Object.keys(structure.dataForMocks)) {
|
|
616
|
+
// Only copy if it exists at flat level and not already in mockData
|
|
617
|
+
if (dataAsAny[propKey] !== undefined &&
|
|
618
|
+
!fullScenarioData.data.mockData[propKey]) {
|
|
619
|
+
fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
// Merge chunked mock data from focused calls (takes priority over main call's data)
|
|
624
|
+
// This ensures keys processed with focused attention are correctly generated.
|
|
625
|
+
if (chunkedMockData && fullScenarioData.data.mockData) {
|
|
626
|
+
for (const [key, value] of Object.entries(chunkedMockData)) {
|
|
627
|
+
// Chunked data takes priority - overwrite main call's potentially wrong data
|
|
628
|
+
fullScenarioData.data.mockData[key] = value;
|
|
275
629
|
}
|
|
630
|
+
awsLog(`Merged chunked mock data for keys: ${Object.keys(chunkedMockData).join(', ')}`);
|
|
631
|
+
}
|
|
632
|
+
// Relocate misplaced nested keys to their correct position.
|
|
633
|
+
// The LLM sometimes places nested keys at root level instead of inside their
|
|
634
|
+
// parent object (e.g., 'fastener' at root instead of inside 'trpc').
|
|
635
|
+
// This ensures the mockData structure matches the dataForMocks schema.
|
|
636
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
637
|
+
relocateMisplacedNestedKeys(fullScenarioData.data.mockData, structure.dataForMocks);
|
|
276
638
|
}
|
|
277
639
|
// Convert null values to undefined based on schema type constraints.
|
|
278
640
|
// LLM uses null for "no value" (JSON doesn't support undefined), but TypeScript
|
|
@@ -281,6 +643,21 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
|
|
|
281
643
|
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
282
644
|
convertNullToUndefinedBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
|
|
283
645
|
}
|
|
646
|
+
// Convert comma-separated strings to arrays when appropriate.
|
|
647
|
+
// The LLM sometimes generates strings like "color,size" instead of arrays
|
|
648
|
+
// like ["color", "size"] when the schema type is incorrectly inferred as
|
|
649
|
+
// 'string' instead of 'string[]'. This causes runtime errors when code
|
|
650
|
+
// calls array methods like .map() on the value.
|
|
651
|
+
if (fullScenarioData.data.mockData) {
|
|
652
|
+
convertCommaSeparatedStringsToArrays(fullScenarioData.data.mockData);
|
|
653
|
+
}
|
|
654
|
+
// Fix null values for ID fields when the schema indicates they should be non-null.
|
|
655
|
+
// The LLM sometimes generates `null` for ID fields (e.g., `"id": null`) when
|
|
656
|
+
// the schema type is `"number"`. This causes runtime issues when code checks
|
|
657
|
+
// `if (!data?.id)` expecting a truthy value.
|
|
658
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
659
|
+
fixNullIdsBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
|
|
660
|
+
}
|
|
284
661
|
if (structure.arguments && fullScenarioData.data.argumentsData) {
|
|
285
662
|
for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
|
|
286
663
|
if (structure.arguments[i]) {
|
|
@@ -288,7 +665,8 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
|
|
|
288
665
|
}
|
|
289
666
|
}
|
|
290
667
|
}
|
|
291
|
-
// For Default Scenario only: check for missing keys and make follow-up call if needed
|
|
668
|
+
// For Default Scenario only: check for missing keys and make follow-up call if needed.
|
|
669
|
+
// This tries to get better-quality data via LLM before falling back to defaults.
|
|
292
670
|
if (isDefault) {
|
|
293
671
|
await fillMissingMockDataKeys({
|
|
294
672
|
structure,
|
|
@@ -298,6 +676,21 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
|
|
|
298
676
|
model,
|
|
299
677
|
});
|
|
300
678
|
}
|
|
679
|
+
// Fill in missing mock data keys with default values (after trying LLM follow-up).
|
|
680
|
+
// The LLM sometimes doesn't generate data for all keys in large schemas.
|
|
681
|
+
// This ensures all dataForMocks keys have corresponding data to prevent
|
|
682
|
+
// runtime errors like "Cannot read properties of undefined".
|
|
683
|
+
// Only run for Default Scenario - non-default scenarios will get missing
|
|
684
|
+
// data filled in from the merge with default scenario data.
|
|
685
|
+
if (isDefault && structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
686
|
+
fillMissingMockDataKeysWithDefaults(fullScenarioData.data.mockData, structure.dataForMocks);
|
|
687
|
+
}
|
|
688
|
+
// Track the final scenario data for E2E debugging
|
|
689
|
+
trackDataSnapshot('generateDataForScenario_result', {
|
|
690
|
+
scenarioName: scenario.name,
|
|
691
|
+
mockData: fullScenarioData.data.mockData,
|
|
692
|
+
argumentsData: fullScenarioData.data.argumentsData,
|
|
693
|
+
}, entity.name, scenario.name);
|
|
301
694
|
return {
|
|
302
695
|
scenarioData: fullScenarioData,
|
|
303
696
|
llmCall: { name: scenario.name, id: llmCall.id },
|
|
@@ -448,6 +841,17 @@ For example, if a flow requires:
|
|
|
448
841
|
\`\`\`
|
|
449
842
|
Then set \`isLoading: false\` in the mockData.
|
|
450
843
|
|
|
844
|
+
### Array Length Requirements (length< and length>)
|
|
845
|
+
For array size variation flows:
|
|
846
|
+
- \`comparison: "length<"\` with \`value: "0"\` → generate EMPTY array \`[]\`
|
|
847
|
+
- \`comparison: "length<"\` with \`value: "3"\` → generate 1-2 items (few items)
|
|
848
|
+
- \`comparison: "length>"\` with \`value: "10"\` → generate 12+ items (many items)
|
|
849
|
+
|
|
850
|
+
### String Length Requirements (normal vs long)
|
|
851
|
+
For text length variation flows:
|
|
852
|
+
- \`value: "normal"\` with \`valueType: "string"\` → generate normal length text (10-50 chars)
|
|
853
|
+
- \`value: "long"\` with \`valueType: "string"\` → generate LONG text (200+ chars) to test overflow/truncation
|
|
854
|
+
|
|
451
855
|
## CRITICAL: Blocking Flows to Avoid
|
|
452
856
|
If the scenario includes \`blockingFlowsToAvoid\`, these are flows (like modals, overlays) that would BLOCK the expected UI.
|
|
453
857
|
You MUST generate mock data that PREVENTS these flows from triggering:
|
|
@@ -542,6 +946,8 @@ export const generateMissingKeysSystemMessage = () => `You are completing mock d
|
|
|
542
946
|
|
|
543
947
|
Generate data ONLY for the missing keys provided in the prompt. Do not skip any of them.
|
|
544
948
|
|
|
949
|
+
- Scenario name must match exactly: "Default Scenario"
|
|
950
|
+
|
|
545
951
|
## Special Markers
|
|
546
952
|
|
|
547
953
|
### Dynamic Dates (\`~~codeyam-code~~\`)
|
|
@@ -585,4 +991,101 @@ NEVER include "error" fields in responses. Skip them entirely.
|
|
|
585
991
|
- No \`undefined\`—use \`null\` or omit
|
|
586
992
|
- No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
|
|
587
993
|
`;
|
|
994
|
+
/**
|
|
995
|
+
* System message for focused calls to generate critical mockData keys.
|
|
996
|
+
* These are keys referenced by the scenario's execution flow requiredValues.
|
|
997
|
+
*/
|
|
998
|
+
export const generateCriticalKeysSystemMessage = (scenarioName) => `You are generating mock data for CRITICAL keys that control scenario behavior.
|
|
999
|
+
|
|
1000
|
+
These keys are referenced by the execution flow's requiredValues - they directly determine
|
|
1001
|
+
what the component renders. Pay EXTRA attention to matching the exact structure and values.
|
|
1002
|
+
|
|
1003
|
+
- Scenario name must match exactly: "${scenarioName}"
|
|
1004
|
+
|
|
1005
|
+
## CRITICAL: Special Characters in Keys
|
|
1006
|
+
Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
|
|
1007
|
+
- If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
|
|
1008
|
+
- Do NOT interpret \`*\` as "any key" - use it as an actual key name
|
|
1009
|
+
|
|
1010
|
+
## CRITICAL: Preserve Exact Structure
|
|
1011
|
+
Your response MUST mirror the EXACT nested structure provided.
|
|
1012
|
+
- Copy key strings EXACTLY as shown (including special characters)
|
|
1013
|
+
- Only change leaf VALUES (replacing type descriptions with actual data)
|
|
1014
|
+
- Do NOT modify keys, type parameters, or add extra keys
|
|
1015
|
+
|
|
1016
|
+
## Matching requiredValues
|
|
1017
|
+
When the prompt shows requiredValues like:
|
|
1018
|
+
- \`attributePath: "useParams().functionCallReturnValue.*"\`
|
|
1019
|
+
- \`value: "scenarios"\`
|
|
1020
|
+
|
|
1021
|
+
This means set the \`*\` key to include "scenarios". For URL paths split by \`/\`,
|
|
1022
|
+
generate a path like \`"scenarios/id/mode"\` where segments match requirements.
|
|
1023
|
+
|
|
1024
|
+
## Response Format
|
|
1025
|
+
\`\`\`json
|
|
1026
|
+
{
|
|
1027
|
+
"scenarioData": {
|
|
1028
|
+
"scenarioName": "${scenarioName}",
|
|
1029
|
+
"data": {
|
|
1030
|
+
"mockData": {
|
|
1031
|
+
// generate data for ONLY the critical keys
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
\`\`\`
|
|
1037
|
+
|
|
1038
|
+
## Rules
|
|
1039
|
+
- Valid JSON only
|
|
1040
|
+
- No \`undefined\`—use \`null\` or omit
|
|
1041
|
+
- Match the exact schema structure provided
|
|
1042
|
+
`;
|
|
1043
|
+
/**
|
|
1044
|
+
* System message for focused calls to generate mock data for a chunk of keys.
|
|
1045
|
+
* Used when data structures are large and need to be processed in smaller pieces.
|
|
1046
|
+
*/
|
|
1047
|
+
export const generateChunkSystemMessage = (scenarioName) => `You are generating mock data for a SUBSET of keys from a larger data structure.
|
|
1048
|
+
|
|
1049
|
+
This chunk contains fewer keys so you can focus on generating HIGH QUALITY data for each one.
|
|
1050
|
+
Pay EXTRA attention to matching the exact structure and values for each key.
|
|
1051
|
+
|
|
1052
|
+
- Scenario name must match exactly: "${scenarioName}"
|
|
1053
|
+
|
|
1054
|
+
## CRITICAL: Special Characters in Keys
|
|
1055
|
+
Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
|
|
1056
|
+
- If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
|
|
1057
|
+
- Do NOT interpret \`*\` as "any key" - use it as an actual key name
|
|
1058
|
+
|
|
1059
|
+
## CRITICAL: Preserve Exact Structure
|
|
1060
|
+
Your response MUST mirror the EXACT nested structure provided.
|
|
1061
|
+
- Copy key strings EXACTLY as shown (including special characters)
|
|
1062
|
+
- Only change leaf VALUES (replacing type descriptions with actual data)
|
|
1063
|
+
- Do NOT modify keys, type parameters, or add extra keys
|
|
1064
|
+
|
|
1065
|
+
## Matching requiredValues
|
|
1066
|
+
If the prompt includes requiredValues, these are specific values that MUST be set:
|
|
1067
|
+
- For \`attributePath: "useParams().functionCallReturnValue.*"\` with \`value: "scenarios"\`
|
|
1068
|
+
→ Set the \`*\` key to include "scenarios" (e.g., "scenarios/id/mode")
|
|
1069
|
+
- For URL paths, generate realistic paths that satisfy the requirements
|
|
1070
|
+
|
|
1071
|
+
## CRITICAL: NO ERROR DATA
|
|
1072
|
+
NEVER include "error" fields in responses. Skip them entirely.
|
|
1073
|
+
- If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
|
|
1074
|
+
- Leave out any attribute named "error"—do not set to null, omit entirely
|
|
1075
|
+
|
|
1076
|
+
## Response Format
|
|
1077
|
+
\`\`\`json
|
|
1078
|
+
{
|
|
1079
|
+
"mockData": {
|
|
1080
|
+
// generate data for ONLY the keys in this chunk
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
\`\`\`
|
|
1084
|
+
|
|
1085
|
+
## Rules
|
|
1086
|
+
- Valid JSON only
|
|
1087
|
+
- No \`undefined\`—use \`null\` or omit
|
|
1088
|
+
- Generate data for ALL keys in the chunk (don't skip any)
|
|
1089
|
+
- Arrays should have many items (at least 4) unless specified otherwise
|
|
1090
|
+
`;
|
|
588
1091
|
//# sourceMappingURL=generateEntityScenarioData.js.map
|