@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
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates execution flows from JSX rendering usages.
|
|
3
|
+
*
|
|
4
|
+
* This module creates variation flows for arrays and strings that are rendered
|
|
5
|
+
* directly in JSX, even without explicit conditionals:
|
|
6
|
+
* - Arrays rendered via .map() → empty, few, many flows
|
|
7
|
+
* - Strings rendered via interpolation → normal, long flows
|
|
8
|
+
*
|
|
9
|
+
* Only controllable paths (from props, hooks, or external data) produce flows.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { ExecutionFlow } from '~codeyam/types';
|
|
13
|
+
import type { JsxRenderingUsage } from './astScopes/types';
|
|
14
|
+
import resolvePathToControllable from './resolvePathToControllable';
|
|
15
|
+
|
|
16
|
+
export interface GenerateFlowsFromJsxUsagesArgs {
|
|
17
|
+
/** JSX rendering usages extracted from AST analysis */
|
|
18
|
+
jsxRenderingUsages: JsxRenderingUsage[];
|
|
19
|
+
/** Map of controllable paths to their types */
|
|
20
|
+
attributesMap: Record<string, string>;
|
|
21
|
+
/** Map from local variable names to data sources */
|
|
22
|
+
equivalentSignatureVariables: Record<string, string>;
|
|
23
|
+
/** Map from full paths to short paths */
|
|
24
|
+
fullToShortPathMap: Record<string, string>;
|
|
25
|
+
/** Structure map for type lookup */
|
|
26
|
+
structure: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generate a slug from a path for use in exclusive groups
|
|
31
|
+
*/
|
|
32
|
+
function pathToSlug(path: string): string {
|
|
33
|
+
return path
|
|
34
|
+
.replace(/\[\d+\]/g, '')
|
|
35
|
+
.replace(/\[\]/g, '')
|
|
36
|
+
.replace(/\(\)/g, '')
|
|
37
|
+
.replace(/\.functionCallReturnValue/g, '')
|
|
38
|
+
.replace(/[<>]/g, '')
|
|
39
|
+
.replace(/\./g, '-')
|
|
40
|
+
.toLowerCase();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Generate a human-readable name from a path.
|
|
45
|
+
*/
|
|
46
|
+
function generateNameFromPath(path: string): string {
|
|
47
|
+
const cleanPath = path
|
|
48
|
+
.replace(/\(\)/g, '')
|
|
49
|
+
.replace(/\.functionCallReturnValue/g, '');
|
|
50
|
+
const parts = cleanPath.split('.');
|
|
51
|
+
const lastPart = parts[parts.length - 1];
|
|
52
|
+
|
|
53
|
+
// Convert camelCase to Title Case
|
|
54
|
+
return lastPart
|
|
55
|
+
.replace(/([A-Z])/g, ' $1')
|
|
56
|
+
.replace(/^./, (str) => str.toUpperCase())
|
|
57
|
+
.trim();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Generate execution flows from JSX rendering usages.
|
|
62
|
+
*
|
|
63
|
+
* For arrays: generates empty (0), few (1-3), many (10+) flows
|
|
64
|
+
* For strings: generates normal and long text flows
|
|
65
|
+
*/
|
|
66
|
+
export default function generateExecutionFlowsFromJsxUsages(
|
|
67
|
+
args: GenerateFlowsFromJsxUsagesArgs,
|
|
68
|
+
): ExecutionFlow[] {
|
|
69
|
+
const {
|
|
70
|
+
jsxRenderingUsages,
|
|
71
|
+
attributesMap,
|
|
72
|
+
equivalentSignatureVariables,
|
|
73
|
+
fullToShortPathMap,
|
|
74
|
+
} = args;
|
|
75
|
+
|
|
76
|
+
const flows: ExecutionFlow[] = [];
|
|
77
|
+
const seenPaths = new Set<string>();
|
|
78
|
+
|
|
79
|
+
for (const usage of jsxRenderingUsages) {
|
|
80
|
+
// Resolve the path to a controllable data source
|
|
81
|
+
const resolution = resolvePathToControllable(
|
|
82
|
+
usage.path,
|
|
83
|
+
attributesMap,
|
|
84
|
+
equivalentSignatureVariables,
|
|
85
|
+
fullToShortPathMap,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if (!resolution.isControllable || !resolution.resolvedPath) {
|
|
89
|
+
// Path is not controllable - skip
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const resolvedPath = resolution.resolvedPath;
|
|
94
|
+
|
|
95
|
+
// Deduplicate by resolved path + rendering type
|
|
96
|
+
const dedupeKey = `${resolvedPath}:${usage.renderingType}`;
|
|
97
|
+
if (seenPaths.has(dedupeKey)) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
seenPaths.add(dedupeKey);
|
|
101
|
+
|
|
102
|
+
const baseName = generateNameFromPath(resolvedPath);
|
|
103
|
+
const pathSlug = pathToSlug(resolvedPath);
|
|
104
|
+
|
|
105
|
+
if (usage.renderingType === 'array-map') {
|
|
106
|
+
// Generate 3 mutually exclusive flows for array sizes
|
|
107
|
+
const exclusiveGroup = `array-length-${pathSlug}`;
|
|
108
|
+
|
|
109
|
+
// Empty array flow
|
|
110
|
+
flows.push({
|
|
111
|
+
id: `${pathSlug}-empty-array`,
|
|
112
|
+
name: `${baseName} Empty`,
|
|
113
|
+
description: `When ${baseName.toLowerCase()} array is empty`,
|
|
114
|
+
requiredValues: [
|
|
115
|
+
{
|
|
116
|
+
attributePath: resolvedPath,
|
|
117
|
+
value: '0',
|
|
118
|
+
comparison: 'length<',
|
|
119
|
+
valueType: 'array',
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
impact: 'medium',
|
|
123
|
+
exclusiveGroup,
|
|
124
|
+
sourceLocation: usage.sourceLocation
|
|
125
|
+
? {
|
|
126
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
127
|
+
column: usage.sourceLocation.column,
|
|
128
|
+
}
|
|
129
|
+
: undefined,
|
|
130
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Few items flow (1-3)
|
|
134
|
+
flows.push({
|
|
135
|
+
id: `${pathSlug}-few-items`,
|
|
136
|
+
name: `${baseName} Few Items`,
|
|
137
|
+
description: `When ${baseName.toLowerCase()} array has 1-3 items`,
|
|
138
|
+
requiredValues: [
|
|
139
|
+
{
|
|
140
|
+
attributePath: resolvedPath,
|
|
141
|
+
value: '3',
|
|
142
|
+
comparison: 'length<',
|
|
143
|
+
valueType: 'array',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
impact: 'low', // Baseline case
|
|
147
|
+
exclusiveGroup,
|
|
148
|
+
sourceLocation: usage.sourceLocation
|
|
149
|
+
? {
|
|
150
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
151
|
+
column: usage.sourceLocation.column,
|
|
152
|
+
}
|
|
153
|
+
: undefined,
|
|
154
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Many items flow (10+)
|
|
158
|
+
flows.push({
|
|
159
|
+
id: `${pathSlug}-many-items`,
|
|
160
|
+
name: `${baseName} Many Items`,
|
|
161
|
+
description: `When ${baseName.toLowerCase()} array has 10+ items`,
|
|
162
|
+
requiredValues: [
|
|
163
|
+
{
|
|
164
|
+
attributePath: resolvedPath,
|
|
165
|
+
value: '10',
|
|
166
|
+
comparison: 'length>',
|
|
167
|
+
valueType: 'array',
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
impact: 'medium',
|
|
171
|
+
exclusiveGroup,
|
|
172
|
+
sourceLocation: usage.sourceLocation
|
|
173
|
+
? {
|
|
174
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
175
|
+
column: usage.sourceLocation.column,
|
|
176
|
+
}
|
|
177
|
+
: undefined,
|
|
178
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
179
|
+
});
|
|
180
|
+
} else if (
|
|
181
|
+
usage.renderingType === 'text-interpolation' &&
|
|
182
|
+
usage.valueType === 'string'
|
|
183
|
+
) {
|
|
184
|
+
// Only generate text flows for strings (not numbers or other types)
|
|
185
|
+
// Generate 2 mutually exclusive flows for text lengths
|
|
186
|
+
const exclusiveGroup = `text-length-${pathSlug}`;
|
|
187
|
+
|
|
188
|
+
// Normal text flow
|
|
189
|
+
flows.push({
|
|
190
|
+
id: `${pathSlug}-normal-text`,
|
|
191
|
+
name: `${baseName} Normal`,
|
|
192
|
+
description: `When ${baseName.toLowerCase()} has normal length text`,
|
|
193
|
+
requiredValues: [
|
|
194
|
+
{
|
|
195
|
+
attributePath: resolvedPath,
|
|
196
|
+
value: 'normal',
|
|
197
|
+
comparison: 'equals',
|
|
198
|
+
valueType: 'string',
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
impact: 'low',
|
|
202
|
+
exclusiveGroup,
|
|
203
|
+
sourceLocation: usage.sourceLocation
|
|
204
|
+
? {
|
|
205
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
206
|
+
column: usage.sourceLocation.column,
|
|
207
|
+
}
|
|
208
|
+
: undefined,
|
|
209
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Long text flow
|
|
213
|
+
flows.push({
|
|
214
|
+
id: `${pathSlug}-long-text`,
|
|
215
|
+
name: `${baseName} Long Text`,
|
|
216
|
+
description: `When ${baseName.toLowerCase()} has long text that might overflow`,
|
|
217
|
+
requiredValues: [
|
|
218
|
+
{
|
|
219
|
+
attributePath: resolvedPath,
|
|
220
|
+
value: 'long',
|
|
221
|
+
comparison: 'equals',
|
|
222
|
+
valueType: 'string',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
impact: 'low',
|
|
226
|
+
exclusiveGroup,
|
|
227
|
+
sourceLocation: usage.sourceLocation
|
|
228
|
+
? {
|
|
229
|
+
lineNumber: usage.sourceLocation.lineNumber,
|
|
230
|
+
column: usage.sourceLocation.column,
|
|
231
|
+
}
|
|
232
|
+
: undefined,
|
|
233
|
+
codeSnippet: usage.sourceLocation?.codeSnippet,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return flows;
|
|
239
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExecutionFlow,
|
|
3
|
+
Scenario,
|
|
4
|
+
ScenariosDataStructure,
|
|
5
|
+
} from '~codeyam/types';
|
|
6
|
+
import simplifyKeysForLLM from './simplifyKeysForLLM';
|
|
7
|
+
import noErrorAttributes from './noErrorAttributes';
|
|
8
|
+
import { JsonTypeDefinition } from '~codeyam/types';
|
|
9
|
+
|
|
10
|
+
type RequiredValue = NonNullable<ExecutionFlow['requiredValues']>[number];
|
|
11
|
+
|
|
12
|
+
interface GenerateChunkPromptArgs {
|
|
13
|
+
scenario: Scenario;
|
|
14
|
+
chunk: ScenariosDataStructure['dataForMocks'];
|
|
15
|
+
chunkIndex: number;
|
|
16
|
+
totalChunks: number;
|
|
17
|
+
relevantRequiredValues: RequiredValue[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generate a prompt for a focused LLM call to generate mock data for a single chunk.
|
|
22
|
+
*
|
|
23
|
+
* Large data structures overwhelm LLMs, causing them to make mistakes on some keys.
|
|
24
|
+
* By processing smaller chunks, each key gets more focused attention.
|
|
25
|
+
*/
|
|
26
|
+
export default function generateChunkPrompt({
|
|
27
|
+
scenario,
|
|
28
|
+
chunk,
|
|
29
|
+
chunkIndex,
|
|
30
|
+
totalChunks,
|
|
31
|
+
relevantRequiredValues,
|
|
32
|
+
}: GenerateChunkPromptArgs): string {
|
|
33
|
+
// Clean up the schema for LLM consumption
|
|
34
|
+
const cleanedSchema = simplifyKeysForLLM(
|
|
35
|
+
noErrorAttributes(chunk) as JsonTypeDefinition,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const keysInChunk = Object.keys(chunk || {});
|
|
39
|
+
|
|
40
|
+
// Build requirements section if there are relevant requiredValues
|
|
41
|
+
const requirementsSection =
|
|
42
|
+
relevantRequiredValues.length > 0
|
|
43
|
+
? `## Execution Flow Requirements for These Keys
|
|
44
|
+
These specific values MUST be set to produce the correct scenario behavior:
|
|
45
|
+
\`\`\`json
|
|
46
|
+
${JSON.stringify(relevantRequiredValues, null, 2)}
|
|
47
|
+
\`\`\`
|
|
48
|
+
|
|
49
|
+
`
|
|
50
|
+
: '';
|
|
51
|
+
|
|
52
|
+
return `Generate mock data for chunk ${chunkIndex + 1} of ${totalChunks}.
|
|
53
|
+
|
|
54
|
+
## Scenario
|
|
55
|
+
\`\`\`json
|
|
56
|
+
${JSON.stringify({ name: scenario.name, description: scenario.description }, null, 2)}
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
${requirementsSection}## Keys in This Chunk (${keysInChunk.length} keys)
|
|
60
|
+
Generate data for ONLY these keys:
|
|
61
|
+
${keysInChunk.map((k) => `- \`${k}\``).join('\n')}
|
|
62
|
+
|
|
63
|
+
## Schema for This Chunk
|
|
64
|
+
\`\`\`json
|
|
65
|
+
${JSON.stringify(cleanedSchema, null, 2)}
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
## Instructions
|
|
69
|
+
1. Match the EXACT structure shown in the schema
|
|
70
|
+
2. Keys with special characters like \`*\` are LITERAL keys, not patterns
|
|
71
|
+
3. If requiredValues are shown above, set values that satisfy them
|
|
72
|
+
4. For paths like \`functionCall().functionCallReturnValue.property\`, the mock data key is just \`functionCall()\`
|
|
73
|
+
|
|
74
|
+
Return ONLY a JSON object with this structure:
|
|
75
|
+
\`\`\`json
|
|
76
|
+
{
|
|
77
|
+
"mockData": {
|
|
78
|
+
// fill in ONLY the keys from this chunk
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
\`\`\``;
|
|
82
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExecutionFlow,
|
|
3
|
+
Scenario,
|
|
4
|
+
ScenariosDataStructure,
|
|
5
|
+
} from '~codeyam/types';
|
|
6
|
+
import simplifyKeysForLLM from './simplifyKeysForLLM';
|
|
7
|
+
import noErrorAttributes from './noErrorAttributes';
|
|
8
|
+
import { JsonTypeDefinition } from '~codeyam/types';
|
|
9
|
+
|
|
10
|
+
interface GenerateCriticalKeysPromptArgs {
|
|
11
|
+
scenario: Scenario;
|
|
12
|
+
executionFlows: ExecutionFlow[] | undefined;
|
|
13
|
+
criticalKeys: string[];
|
|
14
|
+
fullDataForMocks: ScenariosDataStructure['dataForMocks'];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generate a prompt for a focused LLM call to generate only the critical mock data keys.
|
|
19
|
+
*
|
|
20
|
+
* When a scenario has covered flows with requiredValues, only a subset of the full
|
|
21
|
+
* dataForMocks schema is actually needed to satisfy those requirements. This prompt
|
|
22
|
+
* focuses the LLM on JUST those critical keys, avoiding confusion from large schemas.
|
|
23
|
+
*
|
|
24
|
+
* This is called BEFORE the main data generation to ensure critical keys are correctly
|
|
25
|
+
* generated with full attention from the LLM.
|
|
26
|
+
*/
|
|
27
|
+
export default function generateCriticalKeysPrompt({
|
|
28
|
+
scenario,
|
|
29
|
+
executionFlows,
|
|
30
|
+
criticalKeys,
|
|
31
|
+
fullDataForMocks,
|
|
32
|
+
}: GenerateCriticalKeysPromptArgs): string {
|
|
33
|
+
// Build the subset schema with only critical keys
|
|
34
|
+
const criticalSchema: Record<string, any> = {};
|
|
35
|
+
if (fullDataForMocks && typeof fullDataForMocks === 'object') {
|
|
36
|
+
for (const key of criticalKeys) {
|
|
37
|
+
if (key in fullDataForMocks) {
|
|
38
|
+
criticalSchema[key] = (fullDataForMocks as Record<string, any>)[key];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Clean up the schema for LLM consumption
|
|
44
|
+
const cleanedSchema = simplifyKeysForLLM(
|
|
45
|
+
noErrorAttributes(criticalSchema) as JsonTypeDefinition,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// Get the covered flows and their requirements
|
|
49
|
+
const coveredFlowIds = scenario.metadata?.coveredFlows || [];
|
|
50
|
+
const coveredFlowRequirements = coveredFlowIds
|
|
51
|
+
.map((flowId) => {
|
|
52
|
+
const flow = executionFlows?.find((f) => f.id === flowId);
|
|
53
|
+
if (!flow) return null;
|
|
54
|
+
return {
|
|
55
|
+
flowId: flow.id,
|
|
56
|
+
flowName: flow.name,
|
|
57
|
+
flowDescription: flow.description,
|
|
58
|
+
requiredValues: flow.requiredValues,
|
|
59
|
+
};
|
|
60
|
+
})
|
|
61
|
+
.filter(Boolean);
|
|
62
|
+
|
|
63
|
+
return `Generate mock data for these CRITICAL keys. Pay close attention to the requiredValues.
|
|
64
|
+
|
|
65
|
+
## IMPORTANT: These keys are critical for satisfying the execution flow requirements
|
|
66
|
+
The keys below directly control the scenario's behavior. Generate values that EXACTLY satisfy the requiredValues.
|
|
67
|
+
|
|
68
|
+
## Scenario
|
|
69
|
+
\`\`\`json
|
|
70
|
+
${JSON.stringify({ name: scenario.name, description: scenario.description }, null, 2)}
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
## Execution Flow Requirements
|
|
74
|
+
These are the specific values that MUST be set:
|
|
75
|
+
\`\`\`json
|
|
76
|
+
${JSON.stringify(coveredFlowRequirements, null, 2)}
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
## Critical Keys Schema (generate data for ONLY these keys)
|
|
80
|
+
\`\`\`json
|
|
81
|
+
${JSON.stringify(cleanedSchema, null, 2)}
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
## Instructions
|
|
85
|
+
1. Match the EXACT structure shown in the schema
|
|
86
|
+
2. Keys with special characters like \`*\` are LITERAL keys, not patterns
|
|
87
|
+
3. Set values that satisfy ALL the requiredValues above
|
|
88
|
+
4. For paths like \`functionCall().functionCallReturnValue.property\`, the mock data key is just \`functionCall()\`
|
|
89
|
+
|
|
90
|
+
Return ONLY a JSON object with this structure:
|
|
91
|
+
\`\`\`json
|
|
92
|
+
{
|
|
93
|
+
"scenarioData": {
|
|
94
|
+
"scenarioName": "${scenario.name}",
|
|
95
|
+
"data": {
|
|
96
|
+
"mockData": {
|
|
97
|
+
// fill in ONLY the critical keys above
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
\`\`\``;
|
|
103
|
+
}
|
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
ScenariosDataStructure,
|
|
3
3
|
Scenario,
|
|
4
4
|
ScenarioData,
|
|
5
|
+
JsonTypeDefinition,
|
|
5
6
|
ExecutionFlow,
|
|
6
7
|
} from '~codeyam/types';
|
|
7
8
|
import noErrorAttributes from './noErrorAttributes';
|
|
9
|
+
import simplifyKeysForLLM from './simplifyKeysForLLM';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Sort object keys by the size of their JSON-stringified values (smallest first).
|
|
@@ -21,12 +23,18 @@ function sortKeysBySize(obj: Record<string, any>): Record<string, any> {
|
|
|
21
23
|
return Object.fromEntries(entries);
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
interface GeneratePromptOptions {
|
|
27
|
+
/** When true, mockData has already been generated via chunks - skip it in main call */
|
|
28
|
+
mockDataAlreadyGenerated?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
export default function generateEntityScenarioDataGenerator(
|
|
25
32
|
structure: ScenariosDataStructure,
|
|
26
33
|
scenario: Scenario,
|
|
27
34
|
executionFlows: ExecutionFlow[] | undefined,
|
|
28
35
|
defaultScenarioData?: ScenarioData,
|
|
29
36
|
incompleteResponse?: string,
|
|
37
|
+
options?: GeneratePromptOptions,
|
|
30
38
|
) {
|
|
31
39
|
if (incompleteResponse) {
|
|
32
40
|
return incompleteResponse;
|
|
@@ -85,10 +93,16 @@ ${JSON.stringify(defaultScenarioData.data, null, 2)}
|
|
|
85
93
|
`
|
|
86
94
|
: '';
|
|
87
95
|
|
|
88
|
-
//
|
|
89
|
-
//
|
|
96
|
+
// Simplify verbose function call keys for LLM consumption, then sort by size.
|
|
97
|
+
// The static analysis generates keys like "useQuery({ id: Number(id), onSuccess: async (quote) => { ...30 lines... } })"
|
|
98
|
+
// which confuse the LLM. simplifyKeysForLLM reduces them to "useQuery({ id, onSuccess: () => <truncated> })"
|
|
99
|
+
// while the reconcileMockDataKeys function will still match the simplified response back to original keys.
|
|
100
|
+
// Then sort keys by size (smallest first) so small keys appear before large keys,
|
|
101
|
+
// increasing the chance the LLM generates all keys for large schemas.
|
|
90
102
|
const cleanedDataForMocks = structure.dataForMocks
|
|
91
|
-
?
|
|
103
|
+
? simplifyKeysForLLM(
|
|
104
|
+
noErrorAttributes(structure.dataForMocks) as JsonTypeDefinition,
|
|
105
|
+
)
|
|
92
106
|
: null;
|
|
93
107
|
const sortedDataForMocks =
|
|
94
108
|
cleanedDataForMocks &&
|
|
@@ -97,12 +111,15 @@ ${JSON.stringify(defaultScenarioData.data, null, 2)}
|
|
|
97
111
|
? sortKeysBySize(cleanedDataForMocks as Record<string, any>)
|
|
98
112
|
: cleanedDataForMocks;
|
|
99
113
|
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
// When mockData has already been generated via chunks, skip it in the main call
|
|
115
|
+
const mockDataSection = options?.mockDataAlreadyGenerated
|
|
116
|
+
? '## mockData Structure\nmockData has been pre-generated—return `{}` for mockData.'
|
|
117
|
+
: sortedDataForMocks
|
|
118
|
+
? `## mockData Structure
|
|
102
119
|
\`\`\`json
|
|
103
120
|
${JSON.stringify(sortedDataForMocks, null, 2)}
|
|
104
121
|
\`\`\``
|
|
105
|
-
|
|
122
|
+
: '## mockData Structure\nNone—return `{}` for mockData.';
|
|
106
123
|
|
|
107
124
|
const argumentsSection = structure.arguments
|
|
108
125
|
? `## argumentsData Structure
|