@codeyam/codeyam-cli 0.1.0-staging.483fdc2 → 0.1.0-staging.4c0c3c9
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 +46 -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 +38 -3
- package/analyzer-template/project/writeMockDataTsx.ts +119 -17
- 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 +32 -3
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/writeMockDataTsx.js +102 -13
- 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 +44 -10
- 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__/npmVersionCheck.test.js +179 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
- 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 +90 -19
- 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/npmVersionCheck.js +76 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
- package/codeyam-cli/src/utils/progress.js +7 -0
- package/codeyam-cli/src/utils/progress.js.map +1 -1
- package/codeyam-cli/src/utils/queue/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/__tests__/dependency-smoke.test.js +66 -0
- package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
- package/codeyam-cli/src/webserver/app/lib/database.js +15 -3
- package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
- package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +50 -0
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/bootstrap.js +11 -0
- package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-jNYXRRNI.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DsN1wKrm.js → EntityItem-bwuHPyTa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-CvzqMxcu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BH0XDim7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-EhOseatT.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-yjIHlOGa.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-Cq5o8jL4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-BvMu2i-g.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-kgBTLoJD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-OApQuNyq.js → ReportIssueModal-BzPgx-xO.js} +3 -8
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-CwZrv-Ok.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DzccYyI8.js → ScenarioViewer-BX2Ny2Qj.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CDpEprKa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-BRx8ZGZo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BwavGCpm.js → activity.(_tab)-4S4yPfFw.js} +6 -11
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +17 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.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-D4IPYH_y.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-CG65viiV.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-DB3aFuEO.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-igfMr5DY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-Coc4o_8c.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-D1zB-pYc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-BBnGWYga.js → dev.empty-JTAjQ54M.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BJUiQqZF.js → entity._sha._-B0h9AqE6.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-CtYowLOt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-PePWg17F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-I-Wo99C_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-9sMMAiWJ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-CJ6lTdTA.js → files-Co65J0s3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-CPTZZ-JZ.js → git-BdHOxVfg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-CUM5iXwc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-lzqtyFU8.js → index-_417gcQW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-TzRHMVog.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +78 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-hjzB7t2z.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-DcAwD_Ln.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-DVNJVQgD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/terminal-DbEAHMbA.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-CAD5b1o_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-BqgrAzs3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-DAFqfEDH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-DZlYx2c4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-ihdMtlf6.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-TD1f-DHV.js → index-CxaRxKVt.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-D4DT0nM_.js +259 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/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 → codeyam-memory.md} +26 -33
- package/codeyam-cli/templates/codeyam-new-rule.md +13 -0
- 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 -88
- package/codeyam-cli/templates/rules-instructions.md +54 -48
- package/package.json +9 -9
- 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 +32 -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/utils/reviewedRules.js +0 -92
- package/codeyam-cli/src/utils/reviewedRules.js.map +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/globals-CX9f-5xM.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-bba56ec1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-DuTFSyJ2.js +0 -92
- package/codeyam-cli/src/webserver/build/client/assets/root-DTfSQARG.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-BQ-1XyEa.js +0 -258
- package/codeyam-cli/templates/codeyam:diagnose.md +0 -803
- package/codeyam-cli/templates/codeyam:new-rule.md +0 -52
|
@@ -14,23 +14,112 @@ const isStandaloneIndex = (s?: string) => !!s && STANDALONE_INDEX_RE.test(s);
|
|
|
14
14
|
// The regex matches any path ending with .length that has [] somewhere before it
|
|
15
15
|
const DYNAMIC_LENGTH_RE = /\[\].*\.length$/;
|
|
16
16
|
|
|
17
|
+
// Cache for type string analysis to avoid repeated split/filter operations.
|
|
18
|
+
// These functions are called multiple times per path segment across thousands of paths.
|
|
19
|
+
const typeAnalysisCache = new Map<
|
|
20
|
+
string,
|
|
21
|
+
{ isSkippable: boolean; baseType: string; isNullable: boolean }
|
|
22
|
+
>();
|
|
23
|
+
|
|
24
|
+
function getTypeAnalysis(t: string) {
|
|
25
|
+
const cached = typeAnalysisCache.get(t);
|
|
26
|
+
if (cached) return cached;
|
|
27
|
+
const parts = t.split('|').map((s) => s.trim());
|
|
28
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
29
|
+
const result = {
|
|
30
|
+
isSkippable:
|
|
31
|
+
base.length === 1 &&
|
|
32
|
+
(base[0] === 'object' ||
|
|
33
|
+
base[0] === 'array' ||
|
|
34
|
+
base[0] === 'function' ||
|
|
35
|
+
base[0] === 'unknown'),
|
|
36
|
+
baseType: base[0],
|
|
37
|
+
isNullable: parts.includes('undefined') || parts.includes('null'),
|
|
38
|
+
};
|
|
39
|
+
typeAnalysisCache.set(t, result);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
|
|
17
43
|
// Treat these as structural placeholders (don't commit them as concrete leaves)
|
|
18
44
|
function isSkippableLeafType(t: string) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
);
|
|
45
|
+
return getTypeAnalysis(t).isSkippable;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Extract the base structural type from a potentially nullable type string.
|
|
49
|
+
// e.g., 'object | undefined' → 'object', 'array | null' → 'array'
|
|
50
|
+
function getBaseSkippableType(t: string): string {
|
|
51
|
+
return getTypeAnalysis(t).baseType;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Check if a type string has nullable annotations (| undefined or | null)
|
|
55
|
+
function isNullableType(t: string): boolean {
|
|
56
|
+
return getTypeAnalysis(t).isNullable;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Matches paths containing [][] — e.g., "items[][]" or "items[][].text"
|
|
60
|
+
const DOUBLE_ARRAY_RE = /\[\]\[\]/;
|
|
61
|
+
|
|
62
|
+
// Matches a [].property segment — e.g., "items[].name" (but not "items[][]")
|
|
63
|
+
const ARRAY_OBJECT_PROPERTY_RE = /\[\]\.[^[\]]/;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* When scope analysis produces both `prefix[].property` (array of objects) and
|
|
67
|
+
* `prefix[][]` (array of arrays) for the same prefix, there's a conflict about
|
|
68
|
+
* what the array elements are. Object-property paths are more specific and come
|
|
69
|
+
* from actual property access; double-array paths come from mixed iteration
|
|
70
|
+
* patterns in the scope analysis. Drop the double-array paths when both exist.
|
|
71
|
+
*/
|
|
72
|
+
function resolveDoubleArrayConflicts(
|
|
73
|
+
schema: Record<string, string>,
|
|
74
|
+
): Record<string, string> {
|
|
75
|
+
// Collect prefixes that end in [] and have object property children
|
|
76
|
+
const objectArrayPrefixes = new Set<string>();
|
|
77
|
+
for (const path of Object.keys(schema)) {
|
|
78
|
+
if (!ARRAY_OBJECT_PROPERTY_RE.test(path)) continue;
|
|
79
|
+
// Extract every "...[]" prefix that is followed by ".prop"
|
|
80
|
+
let idx = 0;
|
|
81
|
+
while ((idx = path.indexOf('[].', idx)) !== -1) {
|
|
82
|
+
objectArrayPrefixes.add(path.slice(0, idx + 2)); // includes the "[]"
|
|
83
|
+
idx += 3;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (objectArrayPrefixes.size === 0) return schema;
|
|
88
|
+
|
|
89
|
+
// Check if any double-array paths actually conflict
|
|
90
|
+
let hasConflict = false;
|
|
91
|
+
for (const path of Object.keys(schema)) {
|
|
92
|
+
if (!DOUBLE_ARRAY_RE.test(path)) continue;
|
|
93
|
+
const idx = path.indexOf('[][]');
|
|
94
|
+
if (idx !== -1 && objectArrayPrefixes.has(path.slice(0, idx + 2))) {
|
|
95
|
+
hasConflict = true;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (!hasConflict) return schema;
|
|
101
|
+
|
|
102
|
+
// Filter out conflicting double-array paths
|
|
103
|
+
const resolved: Record<string, string> = {};
|
|
104
|
+
for (const [path, value] of Object.entries(schema)) {
|
|
105
|
+
if (DOUBLE_ARRAY_RE.test(path)) {
|
|
106
|
+
const idx = path.indexOf('[][]');
|
|
107
|
+
if (idx !== -1 && objectArrayPrefixes.has(path.slice(0, idx + 2))) {
|
|
108
|
+
continue; // drop this conflicting path
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
resolved[path] = value;
|
|
112
|
+
}
|
|
113
|
+
return resolved;
|
|
26
114
|
}
|
|
27
115
|
|
|
28
116
|
export default function convertDotNotation(
|
|
29
117
|
schema: Record<string, string>,
|
|
30
118
|
): JsonTypeDefinition {
|
|
119
|
+
const resolved = resolveDoubleArrayConflicts(schema);
|
|
31
120
|
const result: JsonTypeDefinition = {};
|
|
32
121
|
|
|
33
|
-
for (const [rawPath, typ] of Object.entries(
|
|
122
|
+
for (const [rawPath, typ] of Object.entries(resolved)) {
|
|
34
123
|
// Skip paths with .length after array notation from dynamic iteration
|
|
35
124
|
// e.g., metadata[].length, metadata[][].length
|
|
36
125
|
if (DYNAMIC_LENGTH_RE.test(rawPath)) continue;
|
|
@@ -218,6 +307,17 @@ export default function convertDotNotation(
|
|
|
218
307
|
// If the next segment after '[]' is another '[]' or a standalone index,
|
|
219
308
|
// we need an array at cursor[key][0], not an object (for patterns like "key[][]" or "key[][0]")
|
|
220
309
|
if (afterArray === '[]' || isStandaloneIndex(afterArray)) {
|
|
310
|
+
// But don't overwrite an existing populated object — object properties
|
|
311
|
+
// (from paths like key[].property) take precedence over double-array hints
|
|
312
|
+
// (from paths like key[][]) which come from mixed access patterns in scope analysis
|
|
313
|
+
if (
|
|
314
|
+
cursor[key][0] &&
|
|
315
|
+
typeof cursor[key][0] === 'object' &&
|
|
316
|
+
!Array.isArray(cursor[key][0]) &&
|
|
317
|
+
Object.keys(cursor[key][0]).length > 0
|
|
318
|
+
) {
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
221
321
|
if (!Array.isArray(cursor[key][0])) cursor[key][0] = [];
|
|
222
322
|
} else {
|
|
223
323
|
// Default case: create an object
|
|
@@ -242,15 +342,41 @@ export default function convertDotNotation(
|
|
|
242
342
|
cursor[key] = typ;
|
|
243
343
|
} else {
|
|
244
344
|
// Structural/placeholder terminal
|
|
245
|
-
|
|
345
|
+
const nullable = isNullableType(typ);
|
|
346
|
+
const baseType = getBaseSkippableType(typ);
|
|
347
|
+
|
|
348
|
+
if (baseType === 'array') {
|
|
246
349
|
if (!Array.isArray(cursor[key])) cursor[key] = [];
|
|
350
|
+
if (nullable) {
|
|
351
|
+
(cursor[key] as any)._nullable = true;
|
|
352
|
+
}
|
|
247
353
|
} else if (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
354
|
+
baseType === 'object' ||
|
|
355
|
+
baseType === 'function' ||
|
|
356
|
+
baseType === 'unknown'
|
|
251
357
|
) {
|
|
252
|
-
if (
|
|
253
|
-
|
|
358
|
+
if (nullable) {
|
|
359
|
+
// Nullable object: ensure it's an actual object (not a string
|
|
360
|
+
// placeholder) so _nullable can be set and child paths can
|
|
361
|
+
// populate properties on it.
|
|
362
|
+
if (
|
|
363
|
+
cursor[key] === undefined ||
|
|
364
|
+
typeof cursor[key] === 'string'
|
|
365
|
+
) {
|
|
366
|
+
cursor[key] = {};
|
|
367
|
+
}
|
|
368
|
+
if (
|
|
369
|
+
typeof cursor[key] === 'object' &&
|
|
370
|
+
cursor[key] !== null &&
|
|
371
|
+
!Array.isArray(cursor[key])
|
|
372
|
+
) {
|
|
373
|
+
(cursor[key] as any)._nullable = true;
|
|
374
|
+
}
|
|
375
|
+
} else {
|
|
376
|
+
// Non-nullable: preserve existing behavior (string placeholder)
|
|
377
|
+
if (cursor[key] === undefined) {
|
|
378
|
+
cursor[key] = typ;
|
|
379
|
+
}
|
|
254
380
|
}
|
|
255
381
|
}
|
|
256
382
|
}
|
|
@@ -81,7 +81,23 @@ function isTypeAnnotation(value: string): boolean {
|
|
|
81
81
|
'string | number | undefined',
|
|
82
82
|
];
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
if (commonTypePatterns.includes(trimmed)) return true;
|
|
85
|
+
|
|
86
|
+
// Check for arrow function type annotations like "() => void", "(event: MouseEvent) => void"
|
|
87
|
+
// These contain '=>' but the body is a type keyword, not a JS expression
|
|
88
|
+
if (trimmed.includes('=>')) {
|
|
89
|
+
const arrowIndex = trimmed.indexOf('=>');
|
|
90
|
+
const body = trimmed.slice(arrowIndex + 2).trim();
|
|
91
|
+
if (
|
|
92
|
+
/^(void|string|number|boolean|any|unknown|never|null|undefined|object|Date|Promise<\w+>)$/i.test(
|
|
93
|
+
body,
|
|
94
|
+
)
|
|
95
|
+
) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return false;
|
|
85
101
|
}
|
|
86
102
|
|
|
87
103
|
/**
|
|
@@ -105,6 +121,9 @@ function typeAnnotationToValue(typeAnnotation: string): unknown {
|
|
|
105
121
|
return [];
|
|
106
122
|
}
|
|
107
123
|
|
|
124
|
+
// Handle arrow function type annotations like "() => void"
|
|
125
|
+
if (trimmed.includes('=>')) return () => {};
|
|
126
|
+
|
|
108
127
|
// Handle primitive types
|
|
109
128
|
if (trimmed === 'string') return '';
|
|
110
129
|
if (trimmed === 'number') return 0;
|
package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts
CHANGED
|
@@ -152,8 +152,11 @@ export default function fillInSchemaGapsAndUnknowns(
|
|
|
152
152
|
schema[previousSubPath],
|
|
153
153
|
)
|
|
154
154
|
) {
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
// When fillInUnknowns=false, add missing gaps as 'unknown' to preserve raw schema.
|
|
156
|
+
// When fillInUnknowns=true, infer the type using checkIfKnownType.
|
|
157
|
+
const newValue = fillInUnknowns
|
|
158
|
+
? (checkIfKnownType(previousSubPath, functionKeysMapping) ?? 'object')
|
|
159
|
+
: 'unknown';
|
|
157
160
|
|
|
158
161
|
if (
|
|
159
162
|
!schema[previousSubPath] ||
|
|
@@ -166,10 +169,14 @@ export default function fillInSchemaGapsAndUnknowns(
|
|
|
166
169
|
|
|
167
170
|
// Handle the wrong function chaining function().function()
|
|
168
171
|
if (isFunction && !existingSchema(previousSubPath)) {
|
|
172
|
+
// When fillInUnknowns=false, use 'unknown' for non-function paths.
|
|
173
|
+
// When fillInUnknowns=true, infer the type.
|
|
169
174
|
schema[previousSubPath] = previousSubPath.endsWith(')')
|
|
170
175
|
? 'function'
|
|
171
|
-
:
|
|
172
|
-
|
|
176
|
+
: fillInUnknowns
|
|
177
|
+
? (checkIfKnownType(previousSubPath, functionKeysMapping) ??
|
|
178
|
+
'object')
|
|
179
|
+
: 'unknown';
|
|
173
180
|
changeMade = true;
|
|
174
181
|
}
|
|
175
182
|
|
|
@@ -458,7 +465,10 @@ export function fillInDirectSchemaGapsAndUnknowns({
|
|
|
458
465
|
}
|
|
459
466
|
} else if (schema[key] === 'unknown') {
|
|
460
467
|
const newType = guessTypeForPath(key, 'string');
|
|
461
|
-
|
|
468
|
+
// Don't convert 'unknown' to 'object' — 'object' is just inferred from
|
|
469
|
+
// having child properties, which isn't more useful than 'unknown' and
|
|
470
|
+
// prevents enrichment from filling in the actual type later.
|
|
471
|
+
if (newType && newType !== 'object' && schema[key] !== newType) {
|
|
462
472
|
schema[key] = newType;
|
|
463
473
|
changeMade = true;
|
|
464
474
|
}
|
|
@@ -481,12 +491,44 @@ export function fillInDirectSchemaGapsAndUnknowns({
|
|
|
481
491
|
// This handles spurious [] paths from components like JsonNode that handle
|
|
482
492
|
// both arrays and objects. When metadata is explicitly typed as 'object',
|
|
483
493
|
// paths like metadata[] (from dynamic iteration) should not change it.
|
|
494
|
+
const existingType = schema[previousSubPath];
|
|
495
|
+
const baseType = existingType?.split(' | ')[0];
|
|
496
|
+
|
|
497
|
+
// Also check if this path has meaningful object property children (non-[] children).
|
|
498
|
+
// If it does, it's an object with mixed access patterns (e.g., agent.entries
|
|
499
|
+
// AND agent[].type), not a pure array. Don't infer 'array' in that case.
|
|
500
|
+
// Exclude .length since it exists on arrays too and is NOT evidence of object-ness.
|
|
501
|
+
let hasObjectPropertyChildren = false;
|
|
502
|
+
if (baseType !== 'array' && baseType !== 'object') {
|
|
503
|
+
const dotPrefix = previousSubPath + '.';
|
|
504
|
+
const lengthPath = previousSubPath + '.length';
|
|
505
|
+
for (const schemaKey in schema) {
|
|
506
|
+
if (
|
|
507
|
+
schemaKey.startsWith(dotPrefix) &&
|
|
508
|
+
schemaKey !== lengthPath
|
|
509
|
+
) {
|
|
510
|
+
hasObjectPropertyChildren = true;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
484
516
|
if (
|
|
485
|
-
|
|
486
|
-
|
|
517
|
+
baseType !== 'array' &&
|
|
518
|
+
baseType !== 'object' &&
|
|
519
|
+
!hasObjectPropertyChildren
|
|
487
520
|
) {
|
|
488
|
-
|
|
489
|
-
|
|
521
|
+
// Preserve nullability from existing type (e.g., 'unknown | undefined' -> 'array | undefined')
|
|
522
|
+
let newType = 'array';
|
|
523
|
+
if (existingType?.includes(' | undefined')) {
|
|
524
|
+
newType = 'array | undefined';
|
|
525
|
+
} else if (existingType?.includes(' | null')) {
|
|
526
|
+
newType = 'array | null';
|
|
527
|
+
}
|
|
528
|
+
if (schema[previousSubPath] !== newType) {
|
|
529
|
+
schema[previousSubPath] = newType;
|
|
530
|
+
changeMade = true;
|
|
531
|
+
}
|
|
490
532
|
}
|
|
491
533
|
}
|
|
492
534
|
}
|
|
@@ -502,14 +544,36 @@ export function fillInDirectSchemaGapsAndUnknowns({
|
|
|
502
544
|
schema[previousSubPath],
|
|
503
545
|
)
|
|
504
546
|
) {
|
|
505
|
-
const
|
|
506
|
-
|
|
547
|
+
const existingType = schema[previousSubPath];
|
|
548
|
+
const baseExistingType = existingType?.split(' | ')[0];
|
|
549
|
+
// Skip if the base type is already a structured type
|
|
507
550
|
if (
|
|
508
|
-
!
|
|
509
|
-
|
|
551
|
+
!['object', 'array', 'function', 'async-function'].includes(
|
|
552
|
+
baseExistingType,
|
|
553
|
+
)
|
|
510
554
|
) {
|
|
511
|
-
|
|
512
|
-
|
|
555
|
+
let newValue = getKnownType(previousSubPath) ?? 'object';
|
|
556
|
+
// Don't overwrite 'unknown' with 'object' — 'object' is just
|
|
557
|
+
// inferred from child properties and isn't more useful than 'unknown'
|
|
558
|
+
if (
|
|
559
|
+
newValue === 'object' &&
|
|
560
|
+
existingType &&
|
|
561
|
+
existingType.split(' | ')[0] === 'unknown'
|
|
562
|
+
) {
|
|
563
|
+
// preserve existing 'unknown' (possibly with nullability)
|
|
564
|
+
} else {
|
|
565
|
+
// Preserve nullability from existing type
|
|
566
|
+
if (existingType?.includes(' | undefined')) {
|
|
567
|
+
newValue = `${newValue} | undefined`;
|
|
568
|
+
} else if (existingType?.includes(' | null')) {
|
|
569
|
+
newValue = `${newValue} | null`;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if (!existingType || existingType !== newValue) {
|
|
573
|
+
schema[previousSubPath] = newValue;
|
|
574
|
+
changeMade = true;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
513
577
|
}
|
|
514
578
|
}
|
|
515
579
|
|
|
@@ -778,10 +842,11 @@ function checkIfKnownType(
|
|
|
778
842
|
return 'array';
|
|
779
843
|
}
|
|
780
844
|
|
|
781
|
-
// When .includes() or .indexOf() is called with a variable argument
|
|
782
|
-
//
|
|
783
|
-
//
|
|
784
|
-
|
|
845
|
+
// When .includes() or .indexOf() is called with a variable argument, prefer array.
|
|
846
|
+
// Pattern: arr.includes(item) -> likely array (checking if item exists in collection)
|
|
847
|
+
// String literals are already filtered by hasStringLiteralArgument, so if we get here
|
|
848
|
+
// with a variable argument, it's strong evidence of array membership testing.
|
|
849
|
+
if (isArray && hasIncludesOrIndexOfWithVariable) {
|
|
785
850
|
return 'array';
|
|
786
851
|
}
|
|
787
852
|
|
|
@@ -3,9 +3,11 @@ import type { ExecutionFlow, ScenariosDataStructure } from '~codeyam/types';
|
|
|
3
3
|
// Type for a single required value from ExecutionFlow
|
|
4
4
|
type RequiredValue = NonNullable<ExecutionFlow['requiredValues']>[number];
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const DEFAULT_MAX_CHUNK_SIZE = 10_000; // ~10K chars per chunk
|
|
7
7
|
|
|
8
8
|
export interface ChunkOptions {
|
|
9
|
+
maxChunkSize?: number;
|
|
10
|
+
/** @deprecated Use maxChunkSize instead. Kept for backward compatibility in tests. */
|
|
9
11
|
maxKeysPerChunk?: number;
|
|
10
12
|
}
|
|
11
13
|
|
|
@@ -15,8 +17,12 @@ export interface ChunkOptions {
|
|
|
15
17
|
* Large schemas overwhelm LLMs, causing them to make mistakes on some keys.
|
|
16
18
|
* By processing smaller chunks, each key gets more focused attention.
|
|
17
19
|
*
|
|
20
|
+
* Uses cumulative JSON size to decide chunk boundaries rather than a fixed
|
|
21
|
+
* key count, so a single oversized key gets its own chunk while many small
|
|
22
|
+
* keys are grouped together efficiently.
|
|
23
|
+
*
|
|
18
24
|
* @param dataForMocks - The full data structure schema
|
|
19
|
-
* @param options - Chunking options (
|
|
25
|
+
* @param options - Chunking options (maxChunkSize defaults to 10_000)
|
|
20
26
|
* @returns Array of smaller data structure chunks
|
|
21
27
|
*/
|
|
22
28
|
export function chunkDataStructure(
|
|
@@ -27,27 +33,39 @@ export function chunkDataStructure(
|
|
|
27
33
|
return [dataForMocks];
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
const {
|
|
36
|
+
const { maxChunkSize = DEFAULT_MAX_CHUNK_SIZE } = options;
|
|
31
37
|
const keys = Object.keys(dataForMocks);
|
|
32
38
|
|
|
33
|
-
//
|
|
34
|
-
|
|
39
|
+
// Calculate total size to see if chunking is needed
|
|
40
|
+
const totalSize = JSON.stringify(dataForMocks).length;
|
|
41
|
+
if (totalSize <= maxChunkSize) {
|
|
35
42
|
return [dataForMocks];
|
|
36
43
|
}
|
|
37
44
|
|
|
45
|
+
// Greedily pack keys into chunks by cumulative size
|
|
38
46
|
const chunks: Array<ScenariosDataStructure['dataForMocks']> = [];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
let currentChunk: Record<string, unknown> = {};
|
|
48
|
+
let currentSize = 0;
|
|
49
|
+
|
|
50
|
+
for (const key of keys) {
|
|
51
|
+
const keySize = JSON.stringify(
|
|
52
|
+
(dataForMocks as Record<string, unknown>)[key],
|
|
53
|
+
).length;
|
|
54
|
+
|
|
55
|
+
// If adding this key would exceed the limit AND chunk isn't empty, start a new chunk
|
|
56
|
+
if (currentSize > 0 && currentSize + keySize > maxChunkSize) {
|
|
57
|
+
chunks.push(currentChunk as ScenariosDataStructure['dataForMocks']);
|
|
58
|
+
currentChunk = {};
|
|
59
|
+
currentSize = 0;
|
|
48
60
|
}
|
|
49
61
|
|
|
50
|
-
|
|
62
|
+
currentChunk[key] = (dataForMocks as Record<string, unknown>)[key];
|
|
63
|
+
currentSize += keySize;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Push the last chunk
|
|
67
|
+
if (Object.keys(currentChunk).length > 0) {
|
|
68
|
+
chunks.push(currentChunk as ScenariosDataStructure['dataForMocks']);
|
|
51
69
|
}
|
|
52
70
|
|
|
53
71
|
return chunks;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Entity } from '~codeyam/types';
|
|
2
2
|
import isolateScopes from './isolateScopes';
|
|
3
3
|
import analyzeScope from './analyzeScope';
|
|
4
|
-
import { FileAnalyzer } from '~codeyam/analyze';
|
|
4
|
+
import { FileAnalyzer, transformationTracer } from '~codeyam/analyze';
|
|
5
5
|
import { AI, SerializableDataStructure } from '~codeyam/ai';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
resetScopeDataStructureMetrics,
|
|
8
|
+
ScopeDataStructure,
|
|
9
|
+
} from './dataStructure/ScopeDataStructure';
|
|
7
10
|
|
|
8
11
|
// import { awsLog } from '~codeyam/utils';
|
|
9
12
|
|
|
@@ -91,8 +94,60 @@ export default async function generateEntityDataStructure({
|
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
// Inspect the runtime type of dataStructure to see if it must be serialized
|
|
97
|
+
// Note: When worker threads are used, dataStructure is already serialized (no toSerializable).
|
|
98
|
+
// Workers are disabled when CODEYAM_TRACE_TRANSFORMS=1 to enable full tracing.
|
|
94
99
|
if ('toSerializable' in entityScope.dataStructure) {
|
|
95
|
-
|
|
100
|
+
const scopeDataStructure =
|
|
101
|
+
entityScope.dataStructure as unknown as ScopeDataStructure;
|
|
102
|
+
|
|
103
|
+
// Trace the internal state BEFORE serialization - captures what methods return
|
|
104
|
+
if (transformationTracer.isEnabled()) {
|
|
105
|
+
transformationTracer.startEntity({
|
|
106
|
+
name: entity.name,
|
|
107
|
+
entityType: entity.entityType ?? 'unknown',
|
|
108
|
+
filePath: entity.filePath,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Capture internal state - this is what getReturnValue/getFunctionSignature return
|
|
112
|
+
transformationTracer.snapshot(entity.name, 'scopeDataStructure', {
|
|
113
|
+
signatureSchema: scopeDataStructure.getFunctionSignature({
|
|
114
|
+
fillInUnknowns: true,
|
|
115
|
+
}),
|
|
116
|
+
returnValueSchema: scopeDataStructure.getReturnValue({
|
|
117
|
+
fillInUnknowns: true,
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const serialized = scopeDataStructure.toSerializable();
|
|
123
|
+
|
|
124
|
+
// Trace AFTER serialization - shows what gets output
|
|
125
|
+
if (transformationTracer.isEnabled()) {
|
|
126
|
+
// Build schema from external function calls for comparison
|
|
127
|
+
const externalSchemas: Record<string, string> = {};
|
|
128
|
+
for (const efc of serialized.externalFunctionCalls ?? []) {
|
|
129
|
+
for (const [path, type] of Object.entries(efc.schema ?? {})) {
|
|
130
|
+
externalSchemas[path] = type;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
transformationTracer.snapshot(entity.name, 'serialized', {
|
|
135
|
+
signatureSchema:
|
|
136
|
+
serialized.functionResults?.[entity.name]?.signatureWithUnknowns,
|
|
137
|
+
returnValueSchema:
|
|
138
|
+
serialized.functionResults?.[entity.name]?.returnValueWithUnknowns,
|
|
139
|
+
// Include external function schemas to detect serialization gaps
|
|
140
|
+
dependencySchemas: {
|
|
141
|
+
externalFunctions: {
|
|
142
|
+
combined: {
|
|
143
|
+
returnValueSchema: externalSchemas,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return serialized;
|
|
96
151
|
}
|
|
97
152
|
return entityScope.dataStructure;
|
|
98
153
|
}
|
|
@@ -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) {
|
|
@@ -840,6 +845,29 @@ export async function generateDataForScenario({
|
|
|
840
845
|
}
|
|
841
846
|
}
|
|
842
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
|
+
|
|
843
871
|
awsLog(
|
|
844
872
|
`Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`,
|
|
845
873
|
);
|
|
@@ -1057,6 +1085,19 @@ export async function generateDataForScenario({
|
|
|
1057
1085
|
);
|
|
1058
1086
|
}
|
|
1059
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
|
+
|
|
1060
1101
|
// Convert comma-separated strings to arrays when appropriate.
|
|
1061
1102
|
// The LLM sometimes generates strings like "color,size" instead of arrays
|
|
1062
1103
|
// like ["color", "size"] when the schema type is incorrectly inferred as
|