@codeyam/codeyam-cli 0.1.0-staging.2a88920 → 0.1.0-staging.4684848
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 +4 -4
- package/analyzer-template/packages/ai/index.ts +1 -0
- package/analyzer-template/packages/ai/package.json +2 -2
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +23 -1
- package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
- package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +101 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
- package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +6 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +330 -9
- package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +11 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +2 -2
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +140 -14
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +20 -1
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +84 -19
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +33 -15
- package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
- package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +299 -5
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +38 -2
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +359 -142
- package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
- package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
- package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +24 -4
- package/analyzer-template/packages/analyze/index.ts +2 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +69 -3
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +4 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +59 -26
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +194 -15
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +372 -57
- package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
- package/analyzer-template/packages/database/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/db.ts +6 -0
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
- package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
- package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
- package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
- 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 +3 -0
- 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/debugReportsTable.d.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +7 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +7 -0
- package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +93 -2
- package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +108 -2
- package/analyzer-template/project/constructMockCode.ts +36 -1
- package/analyzer-template/project/writeMockDataTsx.ts +174 -12
- package/analyzer-template/project/writeScenarioComponents.ts +60 -12
- package/analyzer-template/project/writeSimpleRoot.ts +21 -11
- package/background/src/lib/local/createLocalAnalyzer.js +1 -1
- package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
- package/background/src/lib/virtualized/project/constructMockCode.js +30 -1
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +156 -8
- package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +60 -15
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
- package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +180 -0
- package/codeyam-cli/scripts/apply-setup.js.map +1 -1
- package/codeyam-cli/src/cli.js +2 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/codeyam-cli.js +18 -2
- package/codeyam-cli/src/codeyam-cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +4 -2
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/baseline.js +2 -0
- package/codeyam-cli/src/commands/baseline.js.map +1 -1
- package/codeyam-cli/src/commands/debug.js +2 -0
- package/codeyam-cli/src/commands/debug.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +31 -20
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
- package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +49 -257
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +17 -26
- package/codeyam-cli/src/commands/memory.js.map +1 -1
- package/codeyam-cli/src/commands/recapture.js +2 -0
- package/codeyam-cli/src/commands/recapture.js.map +1 -1
- package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
- package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
- package/codeyam-cli/src/commands/setup-simulations.js +284 -0
- package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
- package/codeyam-cli/src/commands/test-startup.js +2 -0
- package/codeyam-cli/src/commands/test-startup.js.map +1 -1
- package/codeyam-cli/src/commands/verify.js +14 -2
- package/codeyam-cli/src/commands/verify.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +128 -86
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
- package/codeyam-cli/src/utils/analyzer.js +7 -0
- package/codeyam-cli/src/utils/analyzer.js.map +1 -1
- package/codeyam-cli/src/utils/backgroundServer.js +9 -0
- package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/utils/generateReport.js +2 -2
- package/codeyam-cli/src/utils/install-skills.js +57 -54
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
- package/codeyam-cli/src/utils/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/queue/job.js +4 -0
- package/codeyam-cli/src/utils/queue/job.js.map +1 -1
- package/codeyam-cli/src/utils/requireSimulations.js +10 -0
- package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +378 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
- package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
- package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
- package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
- package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
- package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/index.js +1 -0
- package/codeyam-cli/src/utils/rules/index.js.map +1 -1
- package/codeyam-cli/src/utils/rules/parser.js +2 -25
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
- package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
- package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
- package/codeyam-cli/src/utils/rules/staleness.js +16 -11
- package/codeyam-cli/src/utils/rules/staleness.js.map +1 -1
- package/codeyam-cli/src/utils/serverState.js +37 -10
- package/codeyam-cli/src/utils/serverState.js.map +1 -1
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +21 -44
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/database.js +15 -3
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +24 -0
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CQ-wF3Tv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DsN1wKrm.js → EntityItem-HdckCi0m.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-Dh5RJMOE.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BnjjBHJu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-CUSfu6W5.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-Coll1aD6.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-lYMY8h-y.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-ay8XeA59.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-Dpul1_ik.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-OApQuNyq.js → ReportIssueModal-CRBCfV2W.js} +3 -8
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-DRTFDNFt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DzccYyI8.js → ScenarioViewer-d6PSFxhS.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-DDEOQ6Iw.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-CkziGg5F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BwavGCpm.js → activity.(_tab)-B2v1pm9w.js} +6 -11
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-BXIaK8Md.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/book-open-qbapxy6o.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-C-mKrwr1.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-BAvUl1nT.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-DlrT-SzI.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-clIxnCqQ.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-B931Etud.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-BBnGWYga.js → dev.empty-BoPM6KnE.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-oVRMh9Hl.js +16 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-BjyzwQ7H.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-DxuyDmZA.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-DESSZGQp.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-D5Yb90Ad.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-DuObVYgh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-CJ6lTdTA.js → files-CDfz4Y-i.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-CPTZZ-JZ.js → git-D6jOlDQw.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-CKT08Djd.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-DvOt1KIt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-WfQFdoWK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-BbGyC1RY.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-Bb7Y9k5O.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-fd06e67a.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-BXebUPaL.js +78 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-DaAHX2on.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-CvNE9MaT.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-DIqAPIrO.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-DCIzBZM9.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-C6n_fNQY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/terminal-CmPsszJy.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-Beg-oV50.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-D7TLbP3M.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-Ce5rnai3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-B4D3wj27.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-BDt_-DnY.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-BM6TDT1Y.js → index-DDr9Cp9M.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DjwiujaU.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:debug.md → codeyam-debug.md} +1 -1
- package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
- package/codeyam-cli/templates/codeyam-memory-hook.sh +19 -20
- package/codeyam-cli/templates/codeyam-memory.md +392 -0
- package/codeyam-cli/templates/{codeyam:new-rule.md → codeyam-new-rule.md} +2 -2
- package/codeyam-cli/templates/{codeyam:setup.md → codeyam-setup.md} +13 -1
- package/codeyam-cli/templates/{codeyam:sim.md → codeyam-sim.md} +1 -1
- package/codeyam-cli/templates/{codeyam:test.md → codeyam-test.md} +1 -1
- package/codeyam-cli/templates/{codeyam:verify.md → codeyam-verify.md} +1 -1
- package/codeyam-cli/templates/rule-notification-hook.py +56 -0
- package/codeyam-cli/templates/rule-reflection-hook.py +554 -87
- package/codeyam-cli/templates/rules-instructions.md +63 -24
- package/package.json +10 -10
- package/packages/ai/index.js +1 -1
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +21 -1
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
- package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
- package/packages/ai/src/lib/astScopes/processExpression.js +78 -1
- package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
- package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
- package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +262 -8
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
- package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +11 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +2 -2
- package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
- package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +122 -12
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +15 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +78 -17
- package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
- package/packages/ai/src/lib/dataStructureChunking.js +26 -11
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
- package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
- package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
- package/packages/ai/src/lib/generateEntityScenarioData.js +212 -3
- package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +16 -2
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +242 -81
- package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
- package/packages/ai/src/lib/isolateScopes.js +39 -3
- package/packages/ai/src/lib/isolateScopes.js.map +1 -1
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
- package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
- package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +17 -2
- package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
- package/packages/analyze/index.js +1 -0
- package/packages/analyze/index.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +52 -2
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +3 -0
- package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
- package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +5 -1
- package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +51 -14
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +116 -13
- package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +310 -45
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/analyze/src/lib/index.js +1 -0
- package/packages/analyze/src/lib/index.js.map +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js +1 -1
- package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
- package/packages/database/src/lib/analysisToDb.js +1 -1
- package/packages/database/src/lib/analysisToDb.js.map +1 -1
- package/packages/database/src/lib/branchToDb.js +1 -1
- package/packages/database/src/lib/branchToDb.js.map +1 -1
- package/packages/database/src/lib/commitBranchToDb.js +1 -1
- package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
- package/packages/database/src/lib/commitToDb.js +1 -1
- package/packages/database/src/lib/commitToDb.js.map +1 -1
- package/packages/database/src/lib/fileToDb.js +1 -1
- package/packages/database/src/lib/fileToDb.js.map +1 -1
- package/packages/database/src/lib/kysely/db.js +3 -0
- package/packages/database/src/lib/kysely/db.js.map +1 -1
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
- package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
- package/packages/database/src/lib/projectToDb.js +1 -1
- package/packages/database/src/lib/projectToDb.js.map +1 -1
- package/packages/database/src/lib/saveFiles.js +1 -1
- package/packages/database/src/lib/saveFiles.js.map +1 -1
- package/packages/database/src/lib/scenarioToDb.js +1 -1
- package/packages/database/src/lib/scenarioToDb.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +93 -2
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/scripts/finalize-analyzer.cjs +8 -76
- package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-BJUiQqZF.js +0 -23
- package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-a78b90a2.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory--GCbFsBE.js +0 -92
- package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +0 -62
- package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-dYC34MHw.js +0 -257
- package/codeyam-cli/templates/codeyam:diagnose.md +0 -803
- package/codeyam-cli/templates/codeyam:memory.md +0 -341
|
@@ -18,6 +18,7 @@ import { AI, parseJsonSafe } from '~codeyam/ai';
|
|
|
18
18
|
import convertNullToUndefinedBySchema from './dataStructure/helpers/convertNullToUndefinedBySchema';
|
|
19
19
|
import convertTypeAnnotationsToValues from './dataStructure/helpers/convertTypeAnnotationsToValues';
|
|
20
20
|
import fixNullIdsBySchema from './dataStructure/helpers/fixNullIdsBySchema';
|
|
21
|
+
import coerceObjectsToPrimitivesBySchema from './dataStructure/helpers/coerceObjectsToPrimitivesBySchema';
|
|
21
22
|
import { JsonTypeDefinition } from '~codeyam/types';
|
|
22
23
|
import { deepMerge } from '~codeyam/generate';
|
|
23
24
|
import {
|
|
@@ -293,11 +294,13 @@ function generateDefaultForSchemaType(schemaType: unknown): unknown {
|
|
|
293
294
|
if (schemaType.includes('| null')) return null;
|
|
294
295
|
return schemaType; // Return the type as a string placeholder
|
|
295
296
|
}
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
if (Array.isArray(schemaType)) {
|
|
298
|
+
if (schemaType.length === 0) return [];
|
|
299
|
+
// Generate a single default element based on the first element's schema
|
|
300
|
+
const elementDefault = generateDefaultForSchemaType(schemaType[0]);
|
|
301
|
+
return elementDefault !== undefined ? [elementDefault] : [];
|
|
302
|
+
}
|
|
303
|
+
if (typeof schemaType === 'object' && schemaType !== null) {
|
|
301
304
|
// Recursively generate defaults for nested objects
|
|
302
305
|
const result: Record<string, unknown> = {};
|
|
303
306
|
for (const [key, value] of Object.entries(schemaType)) {
|
|
@@ -425,6 +428,8 @@ function fillMissingMockDataKeysWithDefaults(
|
|
|
425
428
|
const missingKeys: string[] = [];
|
|
426
429
|
|
|
427
430
|
for (const key of Object.keys(dataForMocks)) {
|
|
431
|
+
if (key === '_nullable') continue; // Internal marker, not a data key
|
|
432
|
+
|
|
428
433
|
const fullPath = pathPrefix ? `${pathPrefix}.${key}` : key;
|
|
429
434
|
|
|
430
435
|
if (mockData[key] === undefined) {
|
|
@@ -460,6 +465,193 @@ function fillMissingMockDataKeysWithDefaults(
|
|
|
460
465
|
}
|
|
461
466
|
}
|
|
462
467
|
|
|
468
|
+
/**
|
|
469
|
+
* Enforce execution flow requiredValues by setting falsy paths to null.
|
|
470
|
+
*
|
|
471
|
+
* The LLM doesn't reliably generate null for `comparison: 'falsy'` requirements.
|
|
472
|
+
* For example, a flow like "diffView: falsy" should hide a modal, but the LLM
|
|
473
|
+
* might generate a truthy object, causing the modal to show in all screenshots.
|
|
474
|
+
*
|
|
475
|
+
* This function:
|
|
476
|
+
* 1. Gets requiredValues from covered flows
|
|
477
|
+
* 2. For 'falsy' comparisons: sets the value to null
|
|
478
|
+
* 3. For 'truthy' comparisons with falsy values: generates a default truthy value
|
|
479
|
+
*/
|
|
480
|
+
function enforceRequiredValues(
|
|
481
|
+
mockData: Record<string, unknown>,
|
|
482
|
+
coveredFlowIds: string[],
|
|
483
|
+
executionFlows: ExecutionFlow[],
|
|
484
|
+
): void {
|
|
485
|
+
if (!coveredFlowIds.length || !executionFlows.length) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// Get all requiredValues from covered flows
|
|
490
|
+
const coveredFlows = executionFlows.filter((flow) =>
|
|
491
|
+
coveredFlowIds.includes(flow.id),
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
for (const flow of coveredFlows) {
|
|
495
|
+
if (!flow.requiredValues) continue;
|
|
496
|
+
|
|
497
|
+
for (const rv of flow.requiredValues) {
|
|
498
|
+
if (!rv.attributePath) continue;
|
|
499
|
+
|
|
500
|
+
// Find the value in mockData - the path could be nested
|
|
501
|
+
// e.g., attributePath: "diffView" could be at mockData['useDiffModal()'].diffView
|
|
502
|
+
const result = findAndSetValueInMockData(
|
|
503
|
+
mockData,
|
|
504
|
+
rv.attributePath,
|
|
505
|
+
rv.comparison,
|
|
506
|
+
rv.valueType,
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
if (result.found) {
|
|
510
|
+
awsLog(
|
|
511
|
+
`CodeYam: Enforced ${rv.comparison} for ${rv.attributePath} (set to ${result.newValue === null ? 'null' : typeof result.newValue})`,
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Find a value in mockData by attributePath and enforce the comparison.
|
|
520
|
+
* The attributePath could be a simple key or a nested path.
|
|
521
|
+
*
|
|
522
|
+
* Returns { found: boolean, newValue: unknown }
|
|
523
|
+
*/
|
|
524
|
+
function findAndSetValueInMockData(
|
|
525
|
+
mockData: Record<string, unknown>,
|
|
526
|
+
attributePath: string,
|
|
527
|
+
comparison: string,
|
|
528
|
+
valueType?: string,
|
|
529
|
+
): { found: boolean; newValue?: unknown } {
|
|
530
|
+
// Try to find the path at various nesting levels
|
|
531
|
+
// The attributePath might be "diffView" but the actual location is
|
|
532
|
+
// mockData['useDiffModal()'].diffView
|
|
533
|
+
|
|
534
|
+
// Strategy 1: Direct path (e.g., mockData[attributePath])
|
|
535
|
+
if (attributePath in mockData) {
|
|
536
|
+
const currentValue = mockData[attributePath];
|
|
537
|
+
const { shouldChange, newValue } = getEnforcedValue(
|
|
538
|
+
currentValue,
|
|
539
|
+
comparison,
|
|
540
|
+
valueType,
|
|
541
|
+
);
|
|
542
|
+
if (shouldChange) {
|
|
543
|
+
mockData[attributePath] = newValue;
|
|
544
|
+
return { found: true, newValue };
|
|
545
|
+
}
|
|
546
|
+
return { found: true, newValue: currentValue };
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// Strategy 2: Search in nested objects
|
|
550
|
+
for (const [key, value] of Object.entries(mockData)) {
|
|
551
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
552
|
+
const nestedObj = value as Record<string, unknown>;
|
|
553
|
+
|
|
554
|
+
// Check if attributePath exists in this nested object
|
|
555
|
+
if (attributePath in nestedObj) {
|
|
556
|
+
const currentValue = nestedObj[attributePath];
|
|
557
|
+
const { shouldChange, newValue } = getEnforcedValue(
|
|
558
|
+
currentValue,
|
|
559
|
+
comparison,
|
|
560
|
+
valueType,
|
|
561
|
+
);
|
|
562
|
+
if (shouldChange) {
|
|
563
|
+
nestedObj[attributePath] = newValue;
|
|
564
|
+
return { found: true, newValue };
|
|
565
|
+
}
|
|
566
|
+
return { found: true, newValue: currentValue };
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// Also check dot-notation paths (e.g., "diffView.type")
|
|
570
|
+
if (attributePath.includes('.')) {
|
|
571
|
+
const parts = attributePath.split('.');
|
|
572
|
+
const firstPart = parts[0];
|
|
573
|
+
if (firstPart in nestedObj) {
|
|
574
|
+
// Recurse with the rest of the path
|
|
575
|
+
const result = findAndSetValueInMockData(
|
|
576
|
+
nestedObj,
|
|
577
|
+
attributePath,
|
|
578
|
+
comparison,
|
|
579
|
+
valueType,
|
|
580
|
+
);
|
|
581
|
+
if (result.found) return result;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Recursively search deeper
|
|
586
|
+
const result = findAndSetValueInMockData(
|
|
587
|
+
nestedObj,
|
|
588
|
+
attributePath,
|
|
589
|
+
comparison,
|
|
590
|
+
valueType,
|
|
591
|
+
);
|
|
592
|
+
if (result.found) return result;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
return { found: false };
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Determine if a value should be changed to match a comparison requirement.
|
|
601
|
+
*
|
|
602
|
+
* For 'falsy' comparison: truthy values should become null
|
|
603
|
+
* For 'truthy' comparison: falsy values should become a default truthy value
|
|
604
|
+
*/
|
|
605
|
+
function getEnforcedValue(
|
|
606
|
+
currentValue: unknown,
|
|
607
|
+
comparison: string,
|
|
608
|
+
valueType?: string,
|
|
609
|
+
): { shouldChange: boolean; newValue: unknown } {
|
|
610
|
+
const isTruthy = Boolean(currentValue);
|
|
611
|
+
|
|
612
|
+
if (comparison === 'falsy') {
|
|
613
|
+
// Value should be falsy
|
|
614
|
+
if (isTruthy) {
|
|
615
|
+
return { shouldChange: true, newValue: null };
|
|
616
|
+
}
|
|
617
|
+
return { shouldChange: false, newValue: currentValue };
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
if (comparison === 'truthy') {
|
|
621
|
+
// Value should be truthy
|
|
622
|
+
if (!isTruthy) {
|
|
623
|
+
// Generate a default truthy value based on valueType
|
|
624
|
+
const defaultValue = generateDefaultTruthyValue(valueType);
|
|
625
|
+
return { shouldChange: true, newValue: defaultValue };
|
|
626
|
+
}
|
|
627
|
+
return { shouldChange: false, newValue: currentValue };
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// For other comparisons (equals, exists, etc.), don't auto-enforce
|
|
631
|
+
return { shouldChange: false, newValue: currentValue };
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Generate a default truthy value for a given type.
|
|
636
|
+
*/
|
|
637
|
+
function generateDefaultTruthyValue(valueType?: string): unknown {
|
|
638
|
+
if (!valueType) return { _placeholder: true };
|
|
639
|
+
|
|
640
|
+
switch (valueType.toLowerCase()) {
|
|
641
|
+
case 'string':
|
|
642
|
+
return 'default-value';
|
|
643
|
+
case 'number':
|
|
644
|
+
return 1;
|
|
645
|
+
case 'boolean':
|
|
646
|
+
return true;
|
|
647
|
+
case 'array':
|
|
648
|
+
return [{ _placeholder: true }];
|
|
649
|
+
case 'object':
|
|
650
|
+
default:
|
|
651
|
+
return { _placeholder: true };
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
463
655
|
type ScenarioDataWithoutDescription = Omit<ScenarioData, 'scenarioDescription'>;
|
|
464
656
|
|
|
465
657
|
interface GenerateEntityScenarioDataArgs {
|
|
@@ -653,6 +845,29 @@ export async function generateDataForScenario({
|
|
|
653
845
|
}
|
|
654
846
|
}
|
|
655
847
|
|
|
848
|
+
// Detect keys that were lost from failed or partial chunk responses
|
|
849
|
+
// and fill them with schema-based defaults so they aren't permanently lost.
|
|
850
|
+
const allChunkedKeys = chunks.flatMap((c) => Object.keys(c || {}));
|
|
851
|
+
const returnedKeys = new Set(Object.keys(chunkedMockData));
|
|
852
|
+
const missingChunkKeys = allChunkedKeys.filter(
|
|
853
|
+
(k) => !returnedKeys.has(k),
|
|
854
|
+
);
|
|
855
|
+
|
|
856
|
+
if (missingChunkKeys.length > 0) {
|
|
857
|
+
awsLog(
|
|
858
|
+
`Chunked processing: ${missingChunkKeys.length} key(s) missing from chunk results, filling with defaults: ${missingChunkKeys.join(', ')}`,
|
|
859
|
+
);
|
|
860
|
+
const dataForMocksRecord = structure.dataForMocks as Record<
|
|
861
|
+
string,
|
|
862
|
+
unknown
|
|
863
|
+
>;
|
|
864
|
+
for (const key of missingChunkKeys) {
|
|
865
|
+
chunkedMockData[key] = generateDefaultForSchemaType(
|
|
866
|
+
dataForMocksRecord[key],
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
656
871
|
awsLog(
|
|
657
872
|
`Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`,
|
|
658
873
|
);
|
|
@@ -870,6 +1085,19 @@ export async function generateDataForScenario({
|
|
|
870
1085
|
);
|
|
871
1086
|
}
|
|
872
1087
|
|
|
1088
|
+
// Coerce objects/arrays to primitives when the schema expects a primitive type.
|
|
1089
|
+
// The LLM sometimes generates an object where the schema expects "string",
|
|
1090
|
+
// e.g., { body: { "env": "production" } } instead of { body: "some string" }.
|
|
1091
|
+
// This causes runtime errors like "TypeError: body.match is not a function".
|
|
1092
|
+
// Must run BEFORE convertCommaSeparatedStringsToArrays, which intentionally
|
|
1093
|
+
// overrides schema types for array-like field names.
|
|
1094
|
+
if (structure.dataForMocks && fullScenarioData.data.mockData) {
|
|
1095
|
+
coerceObjectsToPrimitivesBySchema(
|
|
1096
|
+
fullScenarioData.data.mockData,
|
|
1097
|
+
structure.dataForMocks,
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
873
1101
|
// Convert comma-separated strings to arrays when appropriate.
|
|
874
1102
|
// The LLM sometimes generates strings like "color,size" instead of arrays
|
|
875
1103
|
// like ["color", "size"] when the schema type is incorrectly inferred as
|
|
@@ -897,6 +1125,18 @@ export async function generateDataForScenario({
|
|
|
897
1125
|
fixNullIdsBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
|
|
898
1126
|
}
|
|
899
1127
|
|
|
1128
|
+
// Enforce execution flow requiredValues by setting falsy paths to null.
|
|
1129
|
+
// The LLM doesn't reliably generate null for falsy requirements (e.g., diffView: falsy
|
|
1130
|
+
// to hide a modal). This post-processing ensures that scenarios match their
|
|
1131
|
+
// covered flows' requiredValues.
|
|
1132
|
+
if (fullScenarioData.data.mockData && executionFlows) {
|
|
1133
|
+
enforceRequiredValues(
|
|
1134
|
+
fullScenarioData.data.mockData,
|
|
1135
|
+
scenario.metadata?.coveredFlows || [],
|
|
1136
|
+
executionFlows,
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
900
1140
|
if (structure.arguments && fullScenarioData.data.argumentsData) {
|
|
901
1141
|
for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
|
|
902
1142
|
if (structure.arguments[i]) {
|
|
@@ -1086,6 +1326,60 @@ export default async function generateEntityScenarioData({
|
|
|
1086
1326
|
defaultScenarioData.data.argumentsData.map((arg) => ({ ...arg }));
|
|
1087
1327
|
}
|
|
1088
1328
|
|
|
1329
|
+
// Enforce requiredValues AFTER merge for non-default scenarios
|
|
1330
|
+
// This ensures that if a non-default scenario doesn't cover a certain flow,
|
|
1331
|
+
// it inherits the enforcement from the default scenario
|
|
1332
|
+
if (scenarioData.data?.mockData && executionFlows) {
|
|
1333
|
+
// Get the flows covered by this scenario
|
|
1334
|
+
const scenarioCoveredFlows =
|
|
1335
|
+
nonDefaultScenarios.find(
|
|
1336
|
+
(s) => s.name === result.scenarioData.scenarioDescription,
|
|
1337
|
+
)?.metadata?.coveredFlows || [];
|
|
1338
|
+
|
|
1339
|
+
// Get the paths that the scenario's flows affect
|
|
1340
|
+
const scenarioAffectedPaths = new Set<string>();
|
|
1341
|
+
for (const flowId of scenarioCoveredFlows) {
|
|
1342
|
+
const flow = executionFlows.find((f) => f.id === flowId);
|
|
1343
|
+
if (flow?.requiredValues) {
|
|
1344
|
+
for (const rv of flow.requiredValues) {
|
|
1345
|
+
if (rv.attributePath) {
|
|
1346
|
+
// Extract base path (e.g., "diffView" from "diffView.type")
|
|
1347
|
+
const basePath = rv.attributePath.split('.')[0];
|
|
1348
|
+
scenarioAffectedPaths.add(basePath);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
// Get the default scenario's flows
|
|
1355
|
+
const defaultCoveredFlows =
|
|
1356
|
+
defaultScenario.metadata?.coveredFlows || [];
|
|
1357
|
+
|
|
1358
|
+
// For paths NOT affected by the scenario, apply default's enforcement
|
|
1359
|
+
const defaultFlowsForUnaffectedPaths = defaultCoveredFlows.filter(
|
|
1360
|
+
(flowId) => {
|
|
1361
|
+
const flow = executionFlows.find((f) => f.id === flowId);
|
|
1362
|
+
if (!flow?.requiredValues) return false;
|
|
1363
|
+
|
|
1364
|
+
// Check if this flow affects a path that the scenario doesn't cover
|
|
1365
|
+
return flow.requiredValues.some((rv) => {
|
|
1366
|
+
if (!rv.attributePath) return false;
|
|
1367
|
+
const basePath = rv.attributePath.split('.')[0];
|
|
1368
|
+
return !scenarioAffectedPaths.has(basePath);
|
|
1369
|
+
});
|
|
1370
|
+
},
|
|
1371
|
+
);
|
|
1372
|
+
|
|
1373
|
+
// Apply enforcement from default scenario for unaffected paths
|
|
1374
|
+
if (defaultFlowsForUnaffectedPaths.length > 0) {
|
|
1375
|
+
enforceRequiredValues(
|
|
1376
|
+
scenarioData.data.mockData,
|
|
1377
|
+
defaultFlowsForUnaffectedPaths,
|
|
1378
|
+
executionFlows,
|
|
1379
|
+
);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1089
1383
|
return scenarioData;
|
|
1090
1384
|
});
|
|
1091
1385
|
|
|
@@ -105,6 +105,19 @@ export default function generateExecutionFlows({
|
|
|
105
105
|
fullToShortPathMap[fullPath] = shortPath;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
console.log(
|
|
109
|
+
`[generateExecutionFlows] ${entity.name}: attributesMap has ${Object.keys(resolvedAttributesMap).length} keys, fullToShortPathMap has ${Object.keys(fullToShortPathMap).length} entries`,
|
|
110
|
+
);
|
|
111
|
+
console.log(
|
|
112
|
+
`[generateExecutionFlows] ${entity.name}: attributesMap keys: [${Object.keys(resolvedAttributesMap).join(', ')}]`,
|
|
113
|
+
);
|
|
114
|
+
console.log(
|
|
115
|
+
`[generateExecutionFlows] ${entity.name}: fullToShortPathMap: ${JSON.stringify(fullToShortPathMap)}`,
|
|
116
|
+
);
|
|
117
|
+
console.log(
|
|
118
|
+
`[generateExecutionFlows] ${entity.name}: equivalentSignatureVariables: ${JSON.stringify(equivalentSignatureVariables)}`,
|
|
119
|
+
);
|
|
120
|
+
|
|
108
121
|
// Get pre-computed conditional data from metadata
|
|
109
122
|
const conditionalUsages: Record<string, ConditionalUsage[]> =
|
|
110
123
|
entity.metadata?.isolatedDataStructure?.conditionalUsages ?? {};
|
|
@@ -149,6 +162,26 @@ export default function generateExecutionFlows({
|
|
|
149
162
|
}
|
|
150
163
|
}
|
|
151
164
|
|
|
165
|
+
console.log(
|
|
166
|
+
`[generateExecutionFlows] ${entity.name}: conditionalUsages keys: [${Object.keys(conditionalUsages).join(', ')}]`,
|
|
167
|
+
);
|
|
168
|
+
console.log(
|
|
169
|
+
`[generateExecutionFlows] ${entity.name}: conditionalUsages sourceDataPaths: ${JSON.stringify(
|
|
170
|
+
Object.fromEntries(
|
|
171
|
+
Object.entries(conditionalUsages).map(([k, v]) => [
|
|
172
|
+
k,
|
|
173
|
+
(v as any[]).map((u: any) => u.sourceDataPath ?? '(none)'),
|
|
174
|
+
]),
|
|
175
|
+
),
|
|
176
|
+
)}`,
|
|
177
|
+
);
|
|
178
|
+
console.log(
|
|
179
|
+
`[generateExecutionFlows] ${entity.name}: compoundConditionals count: ${compoundConditionals.length}`,
|
|
180
|
+
);
|
|
181
|
+
console.log(
|
|
182
|
+
`[generateExecutionFlows] ${entity.name}: sourceEquivalencies keys count: ${Object.keys(mergedDataStructure.sourceEquivalencies ?? {}).length}`,
|
|
183
|
+
);
|
|
184
|
+
|
|
152
185
|
const conditionalsBasedFlows = generateExecutionFlowsFromConditionals({
|
|
153
186
|
conditionalUsages,
|
|
154
187
|
compoundConditionals,
|
|
@@ -503,8 +536,11 @@ function buildValueGroupMap(flows: ExecutionFlow[]): Map<string, string[]> {
|
|
|
503
536
|
for (const [, flowValues] of pathToValues) {
|
|
504
537
|
// Only create groups if there are multiple different values for the same path
|
|
505
538
|
const uniqueValues = new Set(flowValues.map((fv) => fv.value));
|
|
506
|
-
if (uniqueValues.size > 1) {
|
|
507
|
-
// This attribute has multiple values, so all flows are siblings
|
|
539
|
+
if (uniqueValues.size > 1 && flowValues.length <= 10) {
|
|
540
|
+
// This attribute has multiple values, so all flows are siblings.
|
|
541
|
+
// Skip large groups (>10 flows) — these are typically shared gating conditions
|
|
542
|
+
// (like route params) that would dominate the selection by pulling in too many
|
|
543
|
+
// siblings and displacing higher-priority flows.
|
|
508
544
|
const siblingIds = flowValues.map((fv) => fv.flowId);
|
|
509
545
|
for (const fv of flowValues) {
|
|
510
546
|
valueGroupMap.set(
|