@codeyam/codeyam-cli 0.1.0-staging.2a88920 → 0.1.0-staging.4813bf3
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 +3 -3
- 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 +126 -11
- 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 +9 -1
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +194 -15
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +260 -22
- 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/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 +5 -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-CA3JxPb7.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DsN1wKrm.js → EntityItem-B86KKU7e.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DLqD3qNt.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-Ba2JVPzP.js → EntityTypeIcon-BqY8gDAW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-C8lyxW9k.js → InlineSpinner-ClaLpuOo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-aht4aafF.js → InteractivePreview-BDhPilK7.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CVtiBnY5.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B0GLXMsr.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-xgeCVgSM.js → LogViewer-Bm3PmcCz.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-OApQuNyq.js → ReportIssueModal-CgMEzchJ.js} +3 -8
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DuDvi0jm.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DzccYyI8.js → ScenarioViewer-CBui0id_.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-DyFZkK0l.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{_index-BwqWJOgH.js → _index-B3TDXxnk.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BwavGCpm.js → activity.(_tab)-BtBFH820.js} +6 -11
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-CN61MOMa.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-PttOB2SF.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-Cx24_aWc.js → chevron-down-TJp6ofnp.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-CXRTFQ3F.js → chunk-JZWAC4HX-JE9ZIoBl.js} +12 -12
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BOARzkeR.js → circle-check-CXhHQYrI.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-BdhJEx6B.js → createLucideIcon-Ca9fAY46.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-BBnGWYga.js → dev.empty-C0epRiVn.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BJUiQqZF.js → entity._sha._-BVnB8a9L.js} +10 -10
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js → entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D1T4TGjf.js → entity._sha_.create-scenario-DGgZjdFg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CTBG2mmz.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CS2cb_eZ.js → entry.client-BSHEfydn.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DMJ7zii9.js → fileTableUtils-DCPhhSMo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-CJ6lTdTA.js → files-0N0YJQv7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-CPTZZ-JZ.js → git-DXnyr8uP.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-lzqtyFU8.js → index-CcsFv748.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-B1h680n5.js → index-ChN9-fAY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-BLJ7HxOC.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-B7B9V-bu.js → loader-circle-CTqLEAGU.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-b171b9d3.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-CCQd4aZA.js +78 -0
- package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/root-CHhiHoo_.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-CxXUmBSd.js → search-B8VUL8nl.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-BejnUJ6R.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-DwFIBT09.js → simulations-CPoAg7Zo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-B6LgvRJg.js → triangle-alert-BZz2NjYa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-C1v1PQzo.js → useCustomSizes-DNwUduNu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-aSv48UbS.js → useLastLogLine-COky1GVF.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DYxHZQuP.js → useReportContext-CpZgwliL.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-mBRpZPiu.js → useToast-Bv9JFvUO.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-BM6TDT1Y.js → index-8Fv-lH1-.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-Akn3iYFP.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 +2 -2
- 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 +113 -11
- 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 +9 -1
- 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 +231 -22
- 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/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/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
|
@@ -17,20 +17,98 @@ const DYNAMIC_LENGTH_RE = /\[\].*\.length$/;
|
|
|
17
17
|
// Treat these as structural placeholders (don't commit them as concrete leaves)
|
|
18
18
|
function isSkippableLeafType(t: string) {
|
|
19
19
|
// 'unknown' by itself is a placeholder (but 'boolean | unknown' is not)
|
|
20
|
+
// Also handles optional variants like 'object | undefined', 'object | null',
|
|
21
|
+
// 'array | undefined', etc. — these are still structural placeholders that
|
|
22
|
+
// should not overwrite already-populated structures.
|
|
23
|
+
const parts = t.split('|').map((s) => s.trim());
|
|
24
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
20
25
|
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
base.length === 1 &&
|
|
27
|
+
(base[0] === 'object' ||
|
|
28
|
+
base[0] === 'array' ||
|
|
29
|
+
base[0] === 'function' ||
|
|
30
|
+
base[0] === 'unknown')
|
|
25
31
|
);
|
|
26
32
|
}
|
|
27
33
|
|
|
34
|
+
// Extract the base structural type from a potentially nullable type string.
|
|
35
|
+
// e.g., 'object | undefined' → 'object', 'array | null' → 'array'
|
|
36
|
+
function getBaseSkippableType(t: string): string {
|
|
37
|
+
const parts = t.split('|').map((s) => s.trim());
|
|
38
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
39
|
+
return base[0];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check if a type string has nullable annotations (| undefined or | null)
|
|
43
|
+
function isNullableType(t: string): boolean {
|
|
44
|
+
const parts = t.split('|').map((s) => s.trim());
|
|
45
|
+
return parts.includes('undefined') || parts.includes('null');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Matches paths containing [][] — e.g., "items[][]" or "items[][].text"
|
|
49
|
+
const DOUBLE_ARRAY_RE = /\[\]\[\]/;
|
|
50
|
+
|
|
51
|
+
// Matches a [].property segment — e.g., "items[].name" (but not "items[][]")
|
|
52
|
+
const ARRAY_OBJECT_PROPERTY_RE = /\[\]\.[^[\]]/;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* When scope analysis produces both `prefix[].property` (array of objects) and
|
|
56
|
+
* `prefix[][]` (array of arrays) for the same prefix, there's a conflict about
|
|
57
|
+
* what the array elements are. Object-property paths are more specific and come
|
|
58
|
+
* from actual property access; double-array paths come from mixed iteration
|
|
59
|
+
* patterns in the scope analysis. Drop the double-array paths when both exist.
|
|
60
|
+
*/
|
|
61
|
+
function resolveDoubleArrayConflicts(
|
|
62
|
+
schema: Record<string, string>,
|
|
63
|
+
): Record<string, string> {
|
|
64
|
+
// Collect prefixes that end in [] and have object property children
|
|
65
|
+
const objectArrayPrefixes = new Set<string>();
|
|
66
|
+
for (const path of Object.keys(schema)) {
|
|
67
|
+
if (!ARRAY_OBJECT_PROPERTY_RE.test(path)) continue;
|
|
68
|
+
// Extract every "...[]" prefix that is followed by ".prop"
|
|
69
|
+
let idx = 0;
|
|
70
|
+
while ((idx = path.indexOf('[].', idx)) !== -1) {
|
|
71
|
+
objectArrayPrefixes.add(path.slice(0, idx + 2)); // includes the "[]"
|
|
72
|
+
idx += 3;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (objectArrayPrefixes.size === 0) return schema;
|
|
77
|
+
|
|
78
|
+
// Check if any double-array paths actually conflict
|
|
79
|
+
let hasConflict = false;
|
|
80
|
+
for (const path of Object.keys(schema)) {
|
|
81
|
+
if (!DOUBLE_ARRAY_RE.test(path)) continue;
|
|
82
|
+
const idx = path.indexOf('[][]');
|
|
83
|
+
if (idx !== -1 && objectArrayPrefixes.has(path.slice(0, idx + 2))) {
|
|
84
|
+
hasConflict = true;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!hasConflict) return schema;
|
|
90
|
+
|
|
91
|
+
// Filter out conflicting double-array paths
|
|
92
|
+
const resolved: Record<string, string> = {};
|
|
93
|
+
for (const [path, value] of Object.entries(schema)) {
|
|
94
|
+
if (DOUBLE_ARRAY_RE.test(path)) {
|
|
95
|
+
const idx = path.indexOf('[][]');
|
|
96
|
+
if (idx !== -1 && objectArrayPrefixes.has(path.slice(0, idx + 2))) {
|
|
97
|
+
continue; // drop this conflicting path
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
resolved[path] = value;
|
|
101
|
+
}
|
|
102
|
+
return resolved;
|
|
103
|
+
}
|
|
104
|
+
|
|
28
105
|
export default function convertDotNotation(
|
|
29
106
|
schema: Record<string, string>,
|
|
30
107
|
): JsonTypeDefinition {
|
|
108
|
+
const resolved = resolveDoubleArrayConflicts(schema);
|
|
31
109
|
const result: JsonTypeDefinition = {};
|
|
32
110
|
|
|
33
|
-
for (const [rawPath, typ] of Object.entries(
|
|
111
|
+
for (const [rawPath, typ] of Object.entries(resolved)) {
|
|
34
112
|
// Skip paths with .length after array notation from dynamic iteration
|
|
35
113
|
// e.g., metadata[].length, metadata[][].length
|
|
36
114
|
if (DYNAMIC_LENGTH_RE.test(rawPath)) continue;
|
|
@@ -218,6 +296,17 @@ export default function convertDotNotation(
|
|
|
218
296
|
// If the next segment after '[]' is another '[]' or a standalone index,
|
|
219
297
|
// we need an array at cursor[key][0], not an object (for patterns like "key[][]" or "key[][0]")
|
|
220
298
|
if (afterArray === '[]' || isStandaloneIndex(afterArray)) {
|
|
299
|
+
// But don't overwrite an existing populated object — object properties
|
|
300
|
+
// (from paths like key[].property) take precedence over double-array hints
|
|
301
|
+
// (from paths like key[][]) which come from mixed access patterns in scope analysis
|
|
302
|
+
if (
|
|
303
|
+
cursor[key][0] &&
|
|
304
|
+
typeof cursor[key][0] === 'object' &&
|
|
305
|
+
!Array.isArray(cursor[key][0]) &&
|
|
306
|
+
Object.keys(cursor[key][0]).length > 0
|
|
307
|
+
) {
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
221
310
|
if (!Array.isArray(cursor[key][0])) cursor[key][0] = [];
|
|
222
311
|
} else {
|
|
223
312
|
// Default case: create an object
|
|
@@ -242,15 +331,41 @@ export default function convertDotNotation(
|
|
|
242
331
|
cursor[key] = typ;
|
|
243
332
|
} else {
|
|
244
333
|
// Structural/placeholder terminal
|
|
245
|
-
|
|
334
|
+
const nullable = isNullableType(typ);
|
|
335
|
+
const baseType = getBaseSkippableType(typ);
|
|
336
|
+
|
|
337
|
+
if (baseType === 'array') {
|
|
246
338
|
if (!Array.isArray(cursor[key])) cursor[key] = [];
|
|
339
|
+
if (nullable) {
|
|
340
|
+
(cursor[key] as any)._nullable = true;
|
|
341
|
+
}
|
|
247
342
|
} else if (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
343
|
+
baseType === 'object' ||
|
|
344
|
+
baseType === 'function' ||
|
|
345
|
+
baseType === 'unknown'
|
|
251
346
|
) {
|
|
252
|
-
if (
|
|
253
|
-
|
|
347
|
+
if (nullable) {
|
|
348
|
+
// Nullable object: ensure it's an actual object (not a string
|
|
349
|
+
// placeholder) so _nullable can be set and child paths can
|
|
350
|
+
// populate properties on it.
|
|
351
|
+
if (
|
|
352
|
+
cursor[key] === undefined ||
|
|
353
|
+
typeof cursor[key] === 'string'
|
|
354
|
+
) {
|
|
355
|
+
cursor[key] = {};
|
|
356
|
+
}
|
|
357
|
+
if (
|
|
358
|
+
typeof cursor[key] === 'object' &&
|
|
359
|
+
cursor[key] !== null &&
|
|
360
|
+
!Array.isArray(cursor[key])
|
|
361
|
+
) {
|
|
362
|
+
(cursor[key] as any)._nullable = true;
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
// Non-nullable: preserve existing behavior (string placeholder)
|
|
366
|
+
if (cursor[key] === undefined) {
|
|
367
|
+
cursor[key] = typ;
|
|
368
|
+
}
|
|
254
369
|
}
|
|
255
370
|
}
|
|
256
371
|
}
|
|
@@ -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
|
}
|