@codeyam/codeyam-cli 0.1.0-staging.1 → 0.1.0-staging.28f73cf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +7 -7
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +8 -7
- package/analyzer-template/packages/ai/index.ts +2 -1
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/scripts/ai-test-matrix.mjs +424 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +24 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +6 -16
- package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +197 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +28 -2
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +127 -4
- package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +1 -3
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1821 -542
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.ts +138 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +1 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +139 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/DebugTracer.ts +224 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/PathManager.ts +203 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/README.md +294 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +161 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.ts +235 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +14 -6
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/selectBestValue.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.ts +113 -0
- package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +36 -0
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityDocumentation.ts +20 -2
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +51 -107
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +56 -160
- package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +79 -265
- package/analyzer-template/packages/ai/src/lib/generateEntityDocumentation.ts +16 -2
- package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +53 -176
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +53 -154
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +84 -254
- package/analyzer-template/packages/ai/src/lib/generateStatementAnalysis.ts +48 -71
- package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +27 -6
- package/analyzer-template/packages/ai/src/lib/getLLMCallStats.ts +0 -14
- package/analyzer-template/packages/ai/src/lib/modelInfo.ts +15 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +42 -4
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.ts +8 -33
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +54 -62
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +93 -109
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.ts +8 -27
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +33 -38
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +30 -30
- package/analyzer-template/packages/ai/src/lib/types/index.ts +2 -0
- package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +39 -0
- package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +52 -6
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +2 -1
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +238 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.ts +25 -0
- package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +8 -10
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +6 -1
- package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +8 -6
- package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +5 -13
- package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +34 -15
- package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +17 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +35 -16
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +7 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +6 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +15 -7
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.d.ts +23 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.d.ts.map +1 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.js +30 -0
- package/analyzer-template/packages/aws/dist/src/lib/s3/getPresignedUrl.js.map +1 -0
- package/analyzer-template/packages/aws/package.json +5 -4
- package/analyzer-template/packages/aws/s3/index.ts +4 -0
- package/analyzer-template/packages/aws/src/lib/s3/getPresignedUrl.ts +62 -0
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +28 -21
- package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.ts +18 -11
- package/analyzer-template/packages/generate/src/lib/scenarioComponent.ts +6 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +28 -21
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js +5 -3
- package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponent.js.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.d.ts +2 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.js +3 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/db.js.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelations.d.ts +2 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tableRelations.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.d.ts +37 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.js +27 -0
- package/analyzer-template/packages/github/dist/supabase/src/lib/kysely/tables/debugReportsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/index.d.ts +2 -0
- package/analyzer-template/packages/github/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/index.js +2 -0
- package/analyzer-template/packages/github/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/supabase/src/lib/kysely/db.ts +6 -0
- package/analyzer-template/packages/supabase/src/lib/kysely/tableRelations.ts +3 -0
- package/analyzer-template/packages/supabase/src/lib/kysely/tables/debugReportsTable.ts +61 -0
- package/analyzer-template/packages/ui-components/src/scenario-editor/components/DataItemEditor.tsx +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.d.ts +2 -0
- package/analyzer-template/packages/utils/dist/utils/index.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/index.js +2 -0
- package/analyzer-template/packages/utils/dist/utils/index.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts +25 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js +40 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/Semaphore.js.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts +12 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.d.ts.map +1 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/utils/index.ts +2 -0
- package/analyzer-template/packages/utils/src/lib/Semaphore.ts +42 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +8 -3
- package/analyzer-template/packages/utils/src/lib/frameworks/getRemixRoutePath.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.ts +2 -1
- package/analyzer-template/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.ts +1 -0
- package/analyzer-template/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.ts +33 -0
- package/analyzer-template/project/constructMockCode.ts +170 -6
- package/analyzer-template/project/reconcileMockDataKeys.ts +13 -0
- package/analyzer-template/project/start.ts +1 -11
- package/analyzer-template/project/startScenarioCapture.ts +24 -0
- package/analyzer-template/project/trackGeneratedFiles.ts +41 -0
- package/analyzer-template/project/writeMockDataTsx.ts +125 -4
- package/analyzer-template/project/writeScenarioComponents.ts +199 -45
- package/analyzer-template/project/writeUniversalMocks.ts +72 -10
- package/background/src/lib/virtualized/project/constructMockCode.js +158 -7
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +12 -0
- package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
- package/background/src/lib/virtualized/project/start.js +1 -8
- package/background/src/lib/virtualized/project/start.js.map +1 -1
- package/background/src/lib/virtualized/project/startScenarioCapture.js +18 -0
- package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js +30 -0
- package/background/src/lib/virtualized/project/trackGeneratedFiles.js.map +1 -0
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +95 -3
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +144 -28
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeUniversalMocks.js +59 -9
- package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +288 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -0
- package/codeyam-cli/scripts/extract-setup.js +130 -0
- package/codeyam-cli/scripts/extract-setup.js.map +1 -0
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +238 -0
- package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +1 -0
- package/codeyam-cli/src/cli.js +6 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +0 -0
- package/codeyam-cli/src/commands/debug.js +221 -0
- package/codeyam-cli/src/commands/debug.js.map +1 -0
- package/codeyam-cli/src/commands/init.js +4 -23
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/report.js +102 -0
- package/codeyam-cli/src/commands/report.js.map +1 -0
- package/codeyam-cli/src/commands/setup-sandbox.js +164 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js +6 -6
- package/codeyam-cli/src/utils/__tests__/cleanupAnalysisFiles.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +8 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analysisRunner.js +4 -3
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +30 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +25 -5
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js +2 -2
- package/codeyam-cli/src/utils/cleanupAnalysisFiles.js.map +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +75 -5
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +219 -0
- package/codeyam-cli/src/utils/generateReport.js.map +1 -0
- package/codeyam-cli/src/utils/install-skills.js +7 -0
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/queue/__tests__/job.pidTracking.test.js +1 -0
- package/codeyam-cli/src/utils/queue/__tests__/job.pidTracking.test.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +8 -3
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +4 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/utils/webappDetection.js +2 -1
- package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +63 -2
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +15 -35
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-D5ZHFomX.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-Dh-FldQK.js → InteractivePreview-XDSzQLOY.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-BYVx9KFp.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Dp6DC845.js → LogViewer-CRcT5fOZ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-BORLgi0X.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-Bual6h18.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bi-YUMa-.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-4D2vLLJz.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/_index-BC200mfN.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CxvZPkCv.js +10 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.generate-report-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chart-column-B2I7jQx2.js → chart-column-B8fb6wnw.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-De6i8FUT.js +26 -0
- package/codeyam-cli/src/webserver/build/client/assets/{circle-alert-GwwOAbhw.js → circle-alert-IdsgAK39.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/circle-check-BACUUf75.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/clock-vWeoCemX.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CS7XDrKv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DIOEw_3i.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-1Z6D0fLM.js → entity._sha._-8Els_3Wb.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-C3FZJx1w.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-YJz_igar.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/entityStatus-BEqj2qBy.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entityVersioning-DO2gCvXv.js → entityVersioning-Bk_YB1jM.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-DiP0q291.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/file-text-LM0mgxXE.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-Dxh9CcaV.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-BXmqrWCH.js +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-BGS74ED-.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +5 -0
- package/codeyam-cli/src/webserver/build/client/assets/index-D-zYbzFZ.js +8 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DN7Vr40D.js → loader-circle-BXPKbHEb.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-1af162d4.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-DB7VgjCY.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/{settings-MZc4XdmE.js → settings-5zF_GOcS.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-Dc4MlMpK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-BQ-02-jB.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-D7k-ArFa.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BBlyqxij.js → useLastLogLine-AlhS7g5F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-Ddo4UQv7.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{zap-B4gsLUZQ.js → zap-_jw-9DCp.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/index-D4JpXSIO.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-vwbN7n65.js +169 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/server.js +1 -1
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/templates/codeyam-setup-skill.md +85 -94
- package/codeyam-cli/templates/debug-command.md +125 -0
- package/package.json +9 -11
- package/packages/ai/index.js +1 -2
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +13 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +6 -15
- package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
- package/packages/ai/src/lib/astScopes/methodSemantics.js +134 -0
- package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
- package/packages/ai/src/lib/astScopes/paths.js +28 -3
- package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +111 -3
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/checkAllAttributes.js +1 -3
- package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1320 -396
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js +137 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/FunctionCallManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +112 -0
- package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js +176 -0
- package/packages/ai/src/lib/dataStructure/helpers/DebugTracer.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js +178 -0
- package/packages/ai/src/lib/dataStructure/helpers/PathManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +138 -0
- package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js +199 -0
- package/packages/ai/src/lib/dataStructure/helpers/VisitedTracker.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +14 -6
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js +62 -0
- package/packages/ai/src/lib/dataStructure/helpers/selectBestValue.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js +90 -0
- package/packages/ai/src/lib/dataStructure/helpers/uniqueIdUtils.js.map +1 -0
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +22 -0
- package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js +19 -1
- package/packages/ai/src/lib/generateChangesEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +51 -107
- package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js +55 -156
- package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateChangesEntityScenarios.js +79 -262
- package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js +15 -1
- package/packages/ai/src/lib/generateEntityDocumentation.js.map +1 -1
- package/packages/ai/src/lib/generateEntityKeyAttributes.js +53 -176
- package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +52 -152
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarios.js +88 -258
- package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
- package/packages/ai/src/lib/generateStatementAnalysis.js +46 -71
- package/packages/ai/src/lib/generateStatementAnalysis.js.map +1 -1
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js +13 -8
- package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
- package/packages/ai/src/lib/getLLMCallStats.js +0 -14
- package/packages/ai/src/lib/getLLMCallStats.js.map +1 -1
- package/packages/ai/src/lib/modelInfo.js +15 -0
- package/packages/ai/src/lib/modelInfo.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +36 -3
- package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js +8 -33
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +35 -41
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +59 -72
- package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js +8 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityDocumentationGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +24 -27
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +21 -22
- package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
- package/packages/ai/src/lib/types/index.js +2 -0
- package/packages/ai/src/lib/types/index.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/analyze/src/lib/FileAnalyzer.js +45 -5
- package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/index.js +2 -1
- package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +191 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js +16 -0
- package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js.map +1 -0
- package/packages/analyze/src/lib/asts/sourceFiles/index.js +2 -0
- package/packages/analyze/src/lib/asts/sourceFiles/index.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +6 -8
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +5 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +8 -2
- package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +5 -8
- package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeChange.js +21 -9
- package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeEntity.js +10 -4
- package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
- package/packages/analyze/src/lib/files/analyzeInitial.js +21 -9
- package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +6 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +9 -1
- package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +5 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +9 -1
- package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +16 -7
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +28 -21
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js +18 -11
- package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageRemix.js.map +1 -1
- package/packages/generate/src/lib/scenarioComponent.js +5 -3
- package/packages/generate/src/lib/scenarioComponent.js.map +1 -1
- package/packages/supabase/src/lib/kysely/db.js +3 -0
- package/packages/supabase/src/lib/kysely/db.js.map +1 -1
- package/packages/supabase/src/lib/kysely/tables/debugReportsTable.js +27 -0
- package/packages/supabase/src/lib/kysely/tables/debugReportsTable.js.map +1 -0
- package/packages/utils/index.js +2 -0
- package/packages/utils/index.js.map +1 -1
- package/packages/utils/src/lib/Semaphore.js +40 -0
- package/packages/utils/src/lib/Semaphore.js.map +1 -0
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js +5 -3
- package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js +2 -1
- package/packages/utils/src/lib/frameworks/getRemixRoutePath.js.map +1 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js +2 -1
- package/packages/utils/src/lib/frameworks/nextRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js +1 -0
- package/packages/utils/src/lib/frameworks/remixRouteFileNameToRoute.js.map +1 -1
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js +32 -0
- package/packages/utils/src/lib/frameworks/sanitizeNextRouteSegments.js.map +1 -0
- package/analyzer-template/packages/ai/src/lib/generateEntityDataMap.ts +0 -375
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-GqWwt5wG.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-p0fuyqGQ.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-xwuhwsZH.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bl2IRh55.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-M2QuSHKC.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/_index-CAVtep9Q.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLmzsLsT.js +0 -10
- package/codeyam-cli/src/webserver/build/client/assets/components-CAx5ONX_.js +0 -40
- package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgyOwWip.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DGy3zrli.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-ChAdTrrU.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-D9L7267w.js +0 -5
- package/codeyam-cli/src/webserver/build/client/assets/entry.client-C6FRgjPr.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-C3-cQjgv.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-Dp4EB9nv.js +0 -12
- package/codeyam-cli/src/webserver/build/client/assets/globals-Da3jt49-.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-172a4629.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-COyVTsPq.js +0 -16
- package/codeyam-cli/src/webserver/build/client/assets/search-CvyP_1Lo.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-Hbf8b7J_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-BMBi0VzO.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-C_VxoXTh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/cy-logo-cli.svg +0 -13
- package/codeyam-cli/src/webserver/build/server/assets/index-eAULANMV.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-lutv16q5.js +0 -161
- package/codeyam-cli/src/webserver/public/cy-logo-cli.svg +0 -13
- package/packages/ai/src/lib/generateEntityDataMap.js +0 -335
- package/packages/ai/src/lib/generateEntityDataMap.js.map +0 -1
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js +0 -17
- package/packages/ai/src/lib/promptGenerators/generateEntityDataMapGenerator.js.map +0 -1
|
@@ -63,7 +63,7 @@ export default async function generateEntityScenarios({ entity, keyAttributes, a
|
|
|
63
63
|
console.log(scenariosString);
|
|
64
64
|
const result = parseJsonSafe(scenariosString);
|
|
65
65
|
if (!result) {
|
|
66
|
-
console.log(`CodeYam Error: Error Generating entity ${error ? 'error ' : ''}scenarios failed: Invalid JSON response from AI`, response
|
|
66
|
+
console.log(`CodeYam Error: Error Generating entity ${error ? 'error ' : ''}scenarios failed: Invalid JSON response from AI`, JSON.stringify(response, null, 2));
|
|
67
67
|
throw new Error(`CodeYam Error: Error Generating entity ${error ? 'error ' : ''}scenarios failed: Invalid JSON response from AI`);
|
|
68
68
|
}
|
|
69
69
|
if (typeof result !== 'object') {
|
|
@@ -110,313 +110,143 @@ export default async function generateEntityScenarios({ entity, keyAttributes, a
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
function generateSystemMessage(context, scenarioCount) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
const scenarioCountText = scenarioCount
|
|
114
|
+
? `Generate exactly ${scenarioCount} scenario${scenarioCount > 1 ? 's' : ''}.`
|
|
115
|
+
: 'Generate 1-4 scenarios.';
|
|
116
|
+
const contextSection = context
|
|
117
|
+
? `## Business Context
|
|
118
118
|
${context}
|
|
119
119
|
|
|
120
|
-
Focus
|
|
120
|
+
Focus scenarios on demonstrating this specific behavior change.
|
|
121
121
|
|
|
122
122
|
`
|
|
123
|
-
: ''
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
## Instructions
|
|
145
|
-
|
|
146
|
-
- Each scenario should have:
|
|
147
|
-
- a unique name (should be short and concise with absolutely no special characters other than spaces).
|
|
148
|
-
- a "testName" written in the style of Jest the focuses on specific expectations for the test. Try to avoid generic names like "it('should work')" or "it('should render')" and describe more specific expectations.
|
|
149
|
-
- a description that describes why the key attributes were changed from the default scenario.
|
|
150
|
-
- "keyAttributeInstructions" specifying how the key attributes should be set. All key attributes should be set with valid values from the "validValueOptions" list in the "keyAttributes" list.
|
|
151
|
-
- Optional "playwrightInstructions" that provide the necessary code to run in Playwright to put the function into the correct state to demonstrate the scenario.
|
|
152
|
-
- Focus on positive scenarios that showcase the intended behavior of this function. We have another prompt for generating error scenarios. These scenarios should focus on robust but different data between scenarios that vary key attributes to demonstrate different aspects of the function's behavior.
|
|
153
|
-
|
|
154
|
-
## Dependencies
|
|
155
|
-
|
|
156
|
-
This function may dependend on other functions that have key attributes as well. You can leverage those to generate data scenarios also by creating key attribute instructions for those key attributes in the same manner. Generally speaking key attributes for dependencies are necessary for robust scenarios.
|
|
157
|
-
|
|
158
|
-
## Relative Dates
|
|
159
|
-
|
|
160
|
-
If a relative date is required you can describe it in the "keyAttributeInstructions", e.g. 'today', 'tomorrow', 'next week', 'last month'.
|
|
161
|
-
|
|
162
|
-
## Rules
|
|
163
|
-
|
|
164
|
-
- If the key attributes require react elements, keep them simple (e.g. <div> or <span>). Do not reference custom jsx elements as they will not exist.
|
|
165
|
-
|
|
166
|
-
- Do not reference any external libraries, such as React, in the "keyAttributeInstructions". Assume no external libraries are available. Do not reference custom jsx elements.
|
|
167
|
-
|
|
168
|
-
## Response Structure
|
|
169
|
-
|
|
170
|
-
Respond with the data scenarios in a JSON object format, without additional information or delimiters. Ensure clarity and specificity in each data scenario to facilitate accurate data generation for testing or demonstration purposes.
|
|
171
|
-
|
|
172
|
-
IMPORTANT: For keyAttributeInstructions, use the "dataStructurePath" from the Key Attributes as the key (e.g., "useDiffModal().diffView"), and include both the "localVariable" name and the "instruction" in the value object:
|
|
173
|
-
|
|
123
|
+
: '';
|
|
124
|
+
return `You are a test scenario designer. Generate data scenarios that demonstrate a function's behavior.
|
|
125
|
+
|
|
126
|
+
${contextSection}${scenarioCountText}
|
|
127
|
+
|
|
128
|
+
## Default Scenario Rules
|
|
129
|
+
The FIRST scenario MUST be named exactly "${DEFAULT_SCENARIO_NAME}" (case-sensitive).
|
|
130
|
+
- Fill ALL key attributes using values from their \`validValueOptions\` list
|
|
131
|
+
- If "children" is an argument, populate it (otherwise output may be blank)
|
|
132
|
+
- Ignore error-related attributes (set to null)
|
|
133
|
+
- NEVER include \`playwrightInstructions\` - we need a screenshot BEFORE any user interaction
|
|
134
|
+
- Do NOT add playwrightInstructions even if the component has forms/buttons - default shows initial state only
|
|
135
|
+
|
|
136
|
+
## Other Scenarios
|
|
137
|
+
- Each produces DISTINCT output (visual: different screenshot; backend: different return/side-effect)
|
|
138
|
+
- Only specify attributes that DIFFER from default
|
|
139
|
+
- May include \`playwrightInstructions\` for user interactions (clicks, form fills)
|
|
140
|
+
|
|
141
|
+
## keyAttributeInstructions Format
|
|
142
|
+
Use \`dataStructurePath\` as key, include both variable name and instruction:
|
|
143
|
+
\`\`\`json
|
|
174
144
|
{
|
|
175
|
-
"
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"description": string;
|
|
180
|
-
"keyAttributeInstructions": {
|
|
181
|
-
["dataStructurePath"]: {
|
|
182
|
-
"localVariable": string; // The local variable name (e.g., "diffView")
|
|
183
|
-
"instruction": string; // How to set this attribute for the scenario
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
"playwrightInstructions?": {
|
|
187
|
-
"selectorFn": string;
|
|
188
|
-
"selectorArgs": string[];
|
|
189
|
-
"actionFn": string;
|
|
190
|
-
"actionArgs": string[];
|
|
191
|
-
}[]
|
|
192
|
-
}
|
|
193
|
-
]
|
|
145
|
+
"useDiffModal().diffView": {
|
|
146
|
+
"localVariable": "diffView",
|
|
147
|
+
"instruction": "Set to 'split' mode"
|
|
148
|
+
}
|
|
194
149
|
}
|
|
150
|
+
\`\`\`
|
|
195
151
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
Usually playwright instructions should not be included in the ${DEFAULT_SCENARIO_NAME}. If playwright instructions will cause the front-end function's results to look different than create a non-default scenario that includes those instructions.
|
|
199
|
-
|
|
200
|
-
This is often the case if the key attributes are only used through a button click or form submission or if the data required for this scenario is not listed as a key attribute and must be provided directly by the user.
|
|
201
|
-
|
|
202
|
-
If the data won't exist or be used without user actions then use the "playwrightInstructions" to trigger execution of that code through the user actions.
|
|
203
|
-
|
|
204
|
-
For \`playwrightInstructions\`, provide an array of strings representing the necessary code to run.
|
|
152
|
+
## playwrightInstructions (optional, non-default only)
|
|
205
153
|
\`\`\`json
|
|
206
154
|
{
|
|
207
155
|
"playwrightInstructions": [
|
|
208
|
-
{
|
|
209
|
-
|
|
210
|
-
"selectorArgs": ["email"],
|
|
211
|
-
"actionFn": "fill",
|
|
212
|
-
"actionArgs": ["test@example.com"]
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"selectorFn": "getByText",
|
|
216
|
-
"selectorArgs": ["Submit"],
|
|
217
|
-
"actionFn": "click",
|
|
218
|
-
"actionArgs": []
|
|
219
|
-
}
|
|
156
|
+
{ "selectorFn": "getByLabel", "selectorArgs": ["Email"], "actionFn": "fill", "actionArgs": ["test@example.com"] },
|
|
157
|
+
{ "selectorFn": "getByRole", "selectorArgs": ["button", { "name": "Submit" }], "actionFn": "click", "actionArgs": [] }
|
|
220
158
|
]
|
|
221
159
|
}
|
|
222
160
|
\`\`\`
|
|
161
|
+
Note: selectorArgs values must be JSON strings, not JavaScript regex literals.
|
|
223
162
|
|
|
224
|
-
|
|
163
|
+
Use when: data only appears after user action (button click, form submit), or key attribute isn't in data structure.
|
|
225
164
|
|
|
165
|
+
## Rules
|
|
166
|
+
- Relative dates OK in instructions: "today", "tomorrow", "last month"
|
|
167
|
+
- React elements: use simple elements (\`<div>\`, \`<span>\`) - no custom JSX
|
|
168
|
+
- No external library references - plain JS/TS values only
|
|
169
|
+
- Scenario names: letters, numbers, spaces only (no special characters)
|
|
170
|
+
- testName: Jest style with specific expectations, e.g. \`it("displays error when email invalid")\`
|
|
171
|
+
- All values must be valid JSON (strings, numbers, booleans, arrays, objects) - no JavaScript literals like regex
|
|
172
|
+
|
|
173
|
+
## Response Format
|
|
226
174
|
\`\`\`json
|
|
227
175
|
{
|
|
228
176
|
"dataScenarios": [
|
|
229
177
|
{
|
|
230
|
-
"name": ${DEFAULT_SCENARIO_NAME},
|
|
231
|
-
"
|
|
232
|
-
"
|
|
178
|
+
"name": "${DEFAULT_SCENARIO_NAME}",
|
|
179
|
+
"testName": "it(\"displays notifications with unread indicator\")",
|
|
180
|
+
"description": "Default state with 3 unread and 2 read notifications",
|
|
233
181
|
"keyAttributeInstructions": {
|
|
234
|
-
"useNotifications().notifications[]": {
|
|
235
|
-
|
|
236
|
-
"instruction": "Create 5 notifications"
|
|
237
|
-
},
|
|
238
|
-
"useNotifications().notifications[].read": {
|
|
239
|
-
"localVariable": "notifications[].read",
|
|
240
|
-
"instruction": "Set to false for 3 notifications and true for 2 notifications"
|
|
241
|
-
},
|
|
242
|
-
"useNotifications().notifications[].message": {
|
|
243
|
-
"localVariable": "notifications[].message",
|
|
244
|
-
"instruction": "Messages should be no longer than 200 characters"
|
|
245
|
-
}
|
|
182
|
+
"useNotifications().notifications[]": { "localVariable": "notifications[]", "instruction": "Create 5 notifications" },
|
|
183
|
+
"useNotifications().notifications[].read": { "localVariable": "notifications[].read", "instruction": "false for 3, true for 2" }
|
|
246
184
|
}
|
|
247
185
|
},
|
|
248
186
|
{
|
|
249
|
-
"name": "
|
|
250
|
-
"testName": "it(\"
|
|
251
|
-
"description": "
|
|
187
|
+
"name": "Empty state",
|
|
188
|
+
"testName": "it(\"shows placeholder when no notifications\")",
|
|
189
|
+
"description": "User has no notifications",
|
|
252
190
|
"keyAttributeInstructions": {
|
|
253
|
-
"useNotifications().notifications[]": {
|
|
254
|
-
"localVariable": "notifications[]",
|
|
255
|
-
"instruction": "Should be an empty array"
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
"name": "Many notifications, all unread, one long message",
|
|
261
|
-
"testName": "it(\"properly truncates long messages with the title containing the full message\")",
|
|
262
|
-
"description": "A user has many notifications, all unread, with one notification featuring a long message.",
|
|
263
|
-
"keyAttributeInstructions": {
|
|
264
|
-
"useNotifications().notifications[]": {
|
|
265
|
-
"localVariable": "notifications[]",
|
|
266
|
-
"instruction": "Create 10 notifications"
|
|
267
|
-
},
|
|
268
|
-
"useNotifications().notifications[].read": {
|
|
269
|
-
"localVariable": "notifications[].read",
|
|
270
|
-
"instruction": "Set to false for all notifications"
|
|
271
|
-
},
|
|
272
|
-
"useNotifications().notifications[].message": {
|
|
273
|
-
"localVariable": "notifications[].message",
|
|
274
|
-
"instruction": "Ensure at least one message is longer than 500 characters"
|
|
275
|
-
}
|
|
191
|
+
"useNotifications().notifications[]": { "localVariable": "notifications[]", "instruction": "Empty array" }
|
|
276
192
|
}
|
|
277
193
|
}
|
|
278
194
|
]
|
|
279
195
|
}
|
|
280
196
|
\`\`\`
|
|
281
|
-
|
|
282
|
-
Remember:
|
|
283
|
-
|
|
284
|
-
- Name the first scenario exactly "${DEFAULT_SCENARIO_NAME}".
|
|
285
|
-
- For the ${DEFAULT_SCENARIO_NAME} scenario fill in all key attributes with valid values from the "validValueOptions" list in the "keyAttributes" list. Do not leave any key attributes out of the "keyAttributeInstructions" unless they are error attributes.
|
|
286
|
-
- For other scenarios, find ways to create distinctly different outputs using other valid values for key attributes or providing playwright instructions to trigger user interactions.
|
|
287
|
-
- Do not use any special characters in the scenario names. Keep them short and concise and only use letters, numbers, and spaces.
|
|
288
|
-
- Do not use playwright instructions in the ${DEFAULT_SCENARIO_NAME} as we want a screenshot of the function before any user interactions.
|
|
289
197
|
`;
|
|
290
198
|
}
|
|
291
199
|
const SYSTEM_MESSAGE = generateSystemMessage();
|
|
292
|
-
const ERROR_SYSTEM_MESSAGE = `
|
|
200
|
+
const ERROR_SYSTEM_MESSAGE = `You are a security/reliability analyst. Identify data inputs that will cause UNCAUGHT ERRORS in this function.
|
|
293
201
|
|
|
294
|
-
|
|
202
|
+
## What Qualifies as an Error Scenario
|
|
203
|
+
- MUST cause an actual thrown error (not awkward behavior)
|
|
204
|
+
- MUST be fixable by changing THIS function's code
|
|
205
|
+
- MUST NOT rely on type errors caught by static analysis
|
|
206
|
+
- MUST NOT assume dependent functions will fail
|
|
295
207
|
|
|
296
|
-
|
|
208
|
+
## Likelihood Scale (1-10)
|
|
209
|
+
- 1-3: Requires clearly wrong/unusual data
|
|
210
|
+
- 4-6: Plausible edge case
|
|
211
|
+
- 7-9: Common real-world scenario
|
|
212
|
+
- 10: ONLY if guaranteed bug regardless of input
|
|
297
213
|
|
|
298
|
-
|
|
299
|
-
- 1 = Unlikely. It would require passing in data that is clearly wrong and not suited for the function.
|
|
300
|
-
- 10 = Guaranteed. There is a bug in the function that will happen regardless of the data passed in.
|
|
214
|
+
Be conservative with high scores—they should surface truly likely errors.
|
|
301
215
|
|
|
302
|
-
|
|
303
|
-
- 1 = Minor
|
|
304
|
-
- 2 = Major
|
|
305
|
-
|
|
306
|
-
## Instructions
|
|
307
|
-
|
|
308
|
-
Another AI will then read the "keyAttributeInstructions" and generate the necessary data. You can assume the other AI will generate reasonable default data to satisfy the data structure, so only provide instructions for the essential parts of the data that should be generated.
|
|
309
|
-
|
|
310
|
-
We can only generate data for the exact data structure provided, regardless of the code for the function. Do not provide "keyAttributeInstructions" for data that is not in the data structure.
|
|
311
|
-
|
|
312
|
-
All data must be plain that can be run in a node environment (not in the browser). Do not reference any external libraries in the "keyAttributeInstructions". If an external library is required by the function, then provide instructructions on how to fake or mock that data.
|
|
313
|
-
|
|
314
|
-
Focus on "Major" errors. Only include "Minor" errors is they are very likely to occur.
|
|
315
|
-
|
|
316
|
-
## Response
|
|
317
|
-
|
|
318
|
-
For each error scenario, start with a data mapping between the phrase you want to use in the "keyAttributeInstructions" and the exact variable in the data strucure. Then provide a name and a description that predicts how the function will error out and a suggested way to fix the error. The name should be unique and short (no more than 30 characters), and the description should provide context for the error scenario.
|
|
216
|
+
## Severity Scale (1-2)
|
|
217
|
+
- 1 = Minor: Unexpected behavior, no crash
|
|
218
|
+
- 2 = Major: Function fails completely (focus here)
|
|
319
219
|
|
|
320
220
|
## Rules
|
|
221
|
+
- Only reference data in the provided data structure
|
|
222
|
+
- React elements: simple only (\`<div>\`, \`<span>\`)
|
|
223
|
+
- No external library references—mock with plain JS
|
|
224
|
+
- Each scenario must cause a DISTINCT error type
|
|
225
|
+
- If no errors possible: \`{ "errorDataScenarios": "No errors found" }\`
|
|
321
226
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
- If the data structure calls for react elements, keep them simple (e.g. <div> or <span>). Do not reference custom jsx elements as they will not exist.
|
|
325
|
-
|
|
326
|
-
- Do not reference any external libraries, such as React, in the "keyAttributeInstructions". Assume no external libraries are available. Do not reference custom jsx elements. If needed describe how to mock the enternal library data using plain javascript that can be run in a node environment.
|
|
327
|
-
|
|
328
|
-
- Only create new error scenarios if the scenario will literally cause an error. We are not looking for awkward or unintended results, only literal errors. Do not create an error scenario if you are not confident it will cause an error.
|
|
329
|
-
|
|
330
|
-
- Do not assume that another function might cause an error. We are looking for errors that are a direct result of the code in this function.
|
|
331
|
-
|
|
332
|
-
- Do not create errors that can be caught through normal type detection. We only want errors that are reasonably likely to happen and won't be caught by basic static code analysis.
|
|
333
|
-
|
|
334
|
-
- Only create error scenarios that can be fixed by changing the code in this function. Do not create error scenarios that require changes to other functions or external libraries.
|
|
335
|
-
|
|
336
|
-
- Look to create a few error scenarios, but if you can not identify any way to cause an error then do not generate any error scenarios. Each error scenario should represent a distinctly different way to cause an error. If there are no errors you can respond with:
|
|
337
|
-
|
|
338
|
-
\`\`\`
|
|
339
|
-
{
|
|
340
|
-
"errorDataScenarios": "No errors found"
|
|
341
|
-
}
|
|
342
|
-
\`\`\`
|
|
343
|
-
|
|
344
|
-
- Make sure each error scenario has a unique name.
|
|
345
|
-
|
|
346
|
-
## Response Structure
|
|
347
|
-
|
|
348
|
-
Respond with the data scenarios in a JSON object format, without additional information or delimiters. Ensure clarity and specificity in each data scenario to facilitate accurate data generation for testing or demonstration purposes.
|
|
349
|
-
|
|
350
|
-
{
|
|
351
|
-
"errorDataScenarios": [
|
|
352
|
-
{
|
|
353
|
-
"dataMapping": { [key: string]: string };
|
|
354
|
-
"name": string;
|
|
355
|
-
"codeSnippet": string;
|
|
356
|
-
"description": string;
|
|
357
|
-
"fix": string;
|
|
358
|
-
"fixSnippet": string;
|
|
359
|
-
"likelihood": number;
|
|
360
|
-
"likelihoodDescription": string;
|
|
361
|
-
"severity": number;
|
|
362
|
-
"severityDescription": string;
|
|
363
|
-
"instructions": string[];
|
|
364
|
-
}
|
|
365
|
-
]
|
|
366
|
-
}
|
|
227
|
+
Note: In JS/TS, any non-zero value satisfies a boolean check—this won't error.
|
|
367
228
|
|
|
368
|
-
##
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
\`\`\`
|
|
372
|
-
{
|
|
373
|
-
"arguments": [
|
|
374
|
-
{
|
|
375
|
-
"notifications": {
|
|
376
|
-
"message": "string",
|
|
377
|
-
"read": "boolean"
|
|
378
|
-
}[]
|
|
379
|
-
}
|
|
380
|
-
]
|
|
381
|
-
}
|
|
382
|
-
\`\`\`
|
|
383
|
-
|
|
384
|
-
The full response might be:
|
|
385
|
-
|
|
386
|
-
\`\`\`
|
|
229
|
+
## Response Format
|
|
230
|
+
\`\`\`json
|
|
387
231
|
{
|
|
388
232
|
"errorDataScenarios": [
|
|
389
233
|
{
|
|
390
|
-
"dataMapping": {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
"
|
|
394
|
-
"
|
|
395
|
-
"
|
|
396
|
-
"fix": "Wrap the \`encodeURIComponent\` call in a try/catch block.",
|
|
397
|
-
"fixSnippet: "...\nlet encodedMessage: string | undefined;\ntry {\n encodedMessage = encodeURIComponent(message)\n} catch (e) {\n console.error('Error encoding message:', e)\n..."
|
|
234
|
+
"dataMapping": { "notifications array": "arguments - notifications" },
|
|
235
|
+
"name": "Non-utf8 message encoding",
|
|
236
|
+
"codeSnippet": "const encoded = encodeURIComponent(message);",
|
|
237
|
+
"description": "encodeURIComponent throws on non-utf8 characters",
|
|
238
|
+
"fix": "Wrap in try/catch",
|
|
239
|
+
"fixSnippet": "try {\\n encoded = encodeURIComponent(message);\\n} catch (e) {\\n // handle\\n}",
|
|
398
240
|
"likelihood": 7,
|
|
399
|
-
"likelihoodDescription": "
|
|
241
|
+
"likelihoodDescription": "International users may input non-utf8 characters",
|
|
400
242
|
"severity": 2,
|
|
401
|
-
"severityDescription": "
|
|
243
|
+
"severityDescription": "Function throws uncaught error",
|
|
402
244
|
"keyAttributeInstructions": {
|
|
403
|
-
"notifications[]": "
|
|
245
|
+
"notifications[]": "Array with message containing non-utf8 characters"
|
|
404
246
|
}
|
|
405
247
|
}
|
|
406
248
|
]
|
|
407
249
|
}
|
|
408
250
|
\`\`\`
|
|
409
|
-
|
|
410
|
-
Please write both the \`codeSnippet\` and \`fixSnippet\` with appropriate line breaks to increase readability.
|
|
411
|
-
|
|
412
|
-
Assume that all functions this function depends on exist even if they are not provided in the prompt. We have isolated this function for analysis but those dependencies do exist.
|
|
413
|
-
|
|
414
|
-
Only create error scenarios based on the code that is in the function provided.
|
|
415
|
-
|
|
416
|
-
Common Errors In Your Analysis:
|
|
417
|
-
- Typescript/javascript:
|
|
418
|
-
- Any object or primitive other than 0 can be used to satisfy a boolean. This will not cause an error.
|
|
419
|
-
|
|
420
|
-
Do not mark anything as a "10" for likelihood unless the error will literally happen every time the function is called. In general be cautious about high likelihood scores so that errors that are truly most likely to happen show up as higher priority.
|
|
421
251
|
`;
|
|
422
252
|
//# sourceMappingURL=generateEntityScenarios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateEntityScenarios.js","sourceRoot":"","sources":["../../../../../../packages/ai/src/lib/generateEntityScenarios.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,gCAAgC,MAAM,qDAAqD,CAAC;AASnG,+DAA+D;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAM,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAoCtE,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB,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EAAE,QAAQ,CAAC,EAAE;gBACf,QAAQ,EAAE;oBACR,qBAAqB,EAAE;wBACrB,4BAA4B,EAC1B,MAAM,CAAC,QAAQ,CAAC,qBAAqB;6BAClC,4BAA4B;qBAClC;iBACF;aACF;YACD,KAAK;YACL,KAAK;SACN;QACD,GAAG,QAAQ,CAAC,KAAK;KAClB,CAAC,CAAC;IAEH,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACjD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CACT,0CAA0C,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,uCAAuC,CACvG,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,GAAG,CACT,WAAW,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,sBAAsB,CAC1H,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAE7B,MAAM,MAAM,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CACT,0CAA0C,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,iDAAiD,EAChH,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"generateEntityScenarios.js","sourceRoot":"","sources":["../../../../../../packages/ai/src/lib/generateEntityScenarios.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,gCAAgC,MAAM,qDAAqD,CAAC;AASnG,+DAA+D;AAC/D,OAAO,E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BAA8B,CACpD,YAAY,CAAC,sBAAsB,IAAI,EAAE,EACzC,MAAM,CAAC,IAAI,EACX,YAAY,CAAC,IAAI,CAClB;SACF;KACF,CAAa,CACjB,CAAC;IAEF,OAAO;QACL,SAAS;QACT,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAC5B,OAAgB,EAChB,aAAsB;IAEtB,MAAM,iBAAiB,GAAG,aAAa;QACrC,CAAC,CAAC,oBAAoB,aAAa,YAAY,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG;QAC9E,CAAC,CAAC,yBAAyB,CAAC;IAE9B,MAAM,cAAc,GAAG,OAAO;QAC5B,CAAC,CAAC;EACJ,OAAO;;;;CAIR;QACG,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;EAEP,cAAc,GAAG,iBAAiB;;;4CAGQ,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiDhD,qBAAqB;;;;;;;;;;;;;;;;;;;CAmBrC,CAAC;AACF,CAAC;AAED,MAAM,cAAc,GAAG,qBAAqB,EAAE,CAAC;AAE/C,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmD5B,CAAC"}
|
|
@@ -108,85 +108,50 @@ export default async function generateStatementAnalysis({ entity, scope, issues,
|
|
|
108
108
|
}
|
|
109
109
|
return { sha, structure, equivalentVariables, llmCall };
|
|
110
110
|
}
|
|
111
|
-
const SYSTEM_MESSAGE = (reservedStrategies) =>
|
|
111
|
+
const SYSTEM_MESSAGE = (reservedStrategies) => `Analyze a code snippet to extract:
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
1. **structure**: The data type of each variable and property path (string, number, boolean, array, object, function, or unknown)
|
|
114
|
+
2. **equivalentVariables**: Assignments between variables, where the key is the target (left side) and value is the source (right side)
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
## Type Rules
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
- Use type annotations when available; otherwise infer from context or use "unknown"
|
|
119
|
+
- Non-primitive types are "object"
|
|
120
|
+
- Function calls are "function"
|
|
119
121
|
|
|
120
|
-
|
|
122
|
+
## Equivalency Rules
|
|
121
123
|
|
|
122
|
-
|
|
124
|
+
For assignments like \`const a = b\`, record \`"a": "b"\`.
|
|
123
125
|
|
|
124
|
-
|
|
125
|
-
- Every variable in the code snippet has a data structure.
|
|
126
|
-
- The data structure of a variable is the type of data it holds. For example, a variable could hold a string, a number, an array, an object, a function, etc.
|
|
127
|
-
- We want to identify every aspect of every variable in the code snippet.
|
|
126
|
+
For destructuring like \`const { x } = obj\`, record \`"x": "obj.x"\`.
|
|
128
127
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
\`\`\`
|
|
128
|
+
For function calls like \`const result = foo(arg)\`:
|
|
129
|
+
- Record \`"result": "foo(arg).functionCallReturnValue"\`
|
|
130
|
+
- Record \`"foo(arg).signature[0]": "arg"\`
|
|
133
131
|
|
|
134
|
-
|
|
132
|
+
For destructured function returns like \`const { data } = foo()\`:
|
|
133
|
+
- Record \`"data": "foo().functionCallReturnValue.data"\`
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
{
|
|
138
|
-
"structure": {
|
|
139
|
-
"person": "object",
|
|
140
|
-
"person.name": "string",
|
|
141
|
-
"person.age": "number"
|
|
142
|
-
"name": "string",
|
|
143
|
-
"age": "number"
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
\`\`\`
|
|
147
|
-
|
|
148
|
-
Equivalent Variables:
|
|
149
|
-
- In the code variables or aspects of a variable may be assigned to one another, passed in as arguments to a function call, or assigned to the return value of a function call.
|
|
150
|
-
- We want to track all of these equivalent variables so that we can merge the data structure of all equivalencies together.
|
|
151
|
-
- The key should be the variable or aspect of a variable that is recieving existing data from the other variable, which is the path.
|
|
135
|
+
## Example
|
|
152
136
|
|
|
153
|
-
Example:
|
|
154
137
|
\`\`\`typescript
|
|
155
|
-
const { name
|
|
156
|
-
|
|
138
|
+
const { name } = person;
|
|
139
|
+
const result = process(name);
|
|
157
140
|
\`\`\`
|
|
158
141
|
|
|
159
|
-
Here we have a number of equivalencies:
|
|
160
|
-
|
|
161
|
-
\`\`\`
|
|
162
|
-
{
|
|
163
|
-
"equivalentVariables": {
|
|
164
|
-
"name": "person.name",
|
|
165
|
-
"hobbies": "person.hobbies",
|
|
166
|
-
"hobbies[0].started": "selectedHobby.alreadyStarted"
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
\`\`\`
|
|
170
|
-
|
|
171
|
-
**Response:**
|
|
172
|
-
|
|
173
|
-
Combine these together to form the response:
|
|
174
|
-
|
|
175
142
|
\`\`\`json
|
|
176
143
|
{
|
|
177
144
|
"structure": {
|
|
178
145
|
"person": "object",
|
|
179
146
|
"person.name": "string",
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"selectedHobby": "object",
|
|
184
|
-
"selectedHobby.alreadyStarted": "boolean"
|
|
147
|
+
"name": "string",
|
|
148
|
+
"process(name)": "function",
|
|
149
|
+
"result": "unknown"
|
|
185
150
|
},
|
|
186
151
|
"equivalentVariables": {
|
|
187
152
|
"name": "person.name",
|
|
188
|
-
"
|
|
189
|
-
"
|
|
153
|
+
"process(name).signature[0]": "name",
|
|
154
|
+
"result": "process(name).functionCallReturnValue"
|
|
190
155
|
}
|
|
191
156
|
}
|
|
192
157
|
\`\`\`
|
|
@@ -195,10 +160,7 @@ ${relevantExamples(reservedStrategies)}
|
|
|
195
160
|
|
|
196
161
|
---
|
|
197
162
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
- Take your time and analyze the code snippet carefully. Capture all the data structures, function calls, and equivalencies you can find. If you miss any the simulation will fail.
|
|
201
|
-
- Double check your work to ensure nothing was missed and all rules are followed.
|
|
163
|
+
Analyze carefully. Missing equivalencies will cause simulation failures.
|
|
202
164
|
`;
|
|
203
165
|
function keywords(reservedStrategies) {
|
|
204
166
|
const messages = [];
|
|
@@ -284,7 +246,20 @@ const STRATEGIES = {
|
|
|
284
246
|
name: 'Basic Variable Assignment',
|
|
285
247
|
examples: [
|
|
286
248
|
{
|
|
287
|
-
name: 'Simple',
|
|
249
|
+
name: 'Simple Assignment',
|
|
250
|
+
code: `const selectedPerson = person;`,
|
|
251
|
+
response: `{
|
|
252
|
+
"structure": {
|
|
253
|
+
"selectedPerson": "unknown",
|
|
254
|
+
"person": "unknown"
|
|
255
|
+
},
|
|
256
|
+
"equivalentVariables": {
|
|
257
|
+
"selectedPerson": "person"
|
|
258
|
+
}
|
|
259
|
+
}`,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'Property Assignment',
|
|
288
263
|
code: `selectedPerson.position = position.name;`,
|
|
289
264
|
response: `{
|
|
290
265
|
"structure": {
|
|
@@ -299,7 +274,7 @@ const STRATEGIES = {
|
|
|
299
274
|
}`,
|
|
300
275
|
},
|
|
301
276
|
{
|
|
302
|
-
name: '
|
|
277
|
+
name: 'Destructuring',
|
|
303
278
|
code: `const { name, age } = getPerson(personId);`,
|
|
304
279
|
response: `{
|
|
305
280
|
"structure": {
|
|
@@ -339,10 +314,10 @@ const STRATEGIES = {
|
|
|
339
314
|
response: `{
|
|
340
315
|
"structure": {
|
|
341
316
|
"person": "object",
|
|
342
|
-
"options: "object"
|
|
317
|
+
"options": "object"
|
|
343
318
|
},
|
|
344
319
|
"equivalentVariables": {
|
|
345
|
-
"person": "signature[0]"
|
|
320
|
+
"person": "signature[0]",
|
|
346
321
|
"options": "signature[1]"
|
|
347
322
|
}
|
|
348
323
|
}`,
|
|
@@ -412,7 +387,7 @@ const STRATEGIES = {
|
|
|
412
387
|
"name": "string",
|
|
413
388
|
"title": "string",
|
|
414
389
|
"category": "string",
|
|
415
|
-
"age": "number"
|
|
390
|
+
"age": "number"
|
|
416
391
|
},
|
|
417
392
|
"equivalentVariables": {
|
|
418
393
|
"name": "signature[0].name",
|
|
@@ -860,10 +835,10 @@ const STRATEGIES = {
|
|
|
860
835
|
response: `{
|
|
861
836
|
"structure": {
|
|
862
837
|
"age": "number",
|
|
863
|
-
"returnValue": "number"
|
|
838
|
+
"returnValue": "number"
|
|
864
839
|
},
|
|
865
840
|
"equivalentVariables": {
|
|
866
|
-
"returnValue: "age"
|
|
841
|
+
"returnValue": "age"
|
|
867
842
|
}
|
|
868
843
|
}`,
|
|
869
844
|
},
|
|
@@ -916,7 +891,7 @@ const STRATEGIES = {
|
|
|
916
891
|
"structure": {
|
|
917
892
|
"items": "array",
|
|
918
893
|
"items.filter(cyScope1())": "function",
|
|
919
|
-
"cyScope1()"
|
|
894
|
+
"cyScope1()": "function",
|
|
920
895
|
"List()": "function",
|
|
921
896
|
"div()": "function"
|
|
922
897
|
},
|
|
@@ -1607,7 +1582,7 @@ const STRATEGIES = {
|
|
|
1607
1582
|
"foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo()": "function"
|
|
1608
1583
|
},
|
|
1609
1584
|
"equivalentVariables": {
|
|
1610
|
-
"data": "foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo().functionCallReturnValue.data"
|
|
1585
|
+
"data": "foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo().functionCallReturnValue.data",
|
|
1611
1586
|
"error": "foo(arg1).bar({ arg2, arg3 }).bar().baz(arg4, arg5).boo().functionCallReturnValue.error"
|
|
1612
1587
|
}
|
|
1613
1588
|
}`,
|