@codeyam/codeyam-cli 0.1.0-staging.7c30edc → 0.1.0-staging.80e493d
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 +13 -13
- package/analyzer-template/packages/ai/index.ts +1 -0
- package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +14 -0
- package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +232 -5
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +29 -18
- package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
- package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +15 -6
- package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +96 -0
- package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
- package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +18 -0
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +50 -25
- package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +153 -76
- package/analyzer-template/packages/aws/package.json +10 -10
- package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +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 +98 -3
- 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 +121 -3
- package/analyzer-template/project/constructMockCode.ts +34 -7
- package/analyzer-template/project/orchestrateCapture.ts +4 -1
- package/analyzer-template/project/writeScenarioComponents.ts +76 -12
- package/background/src/lib/virtualized/project/constructMockCode.js +30 -7
- package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
- package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
- package/background/src/lib/virtualized/project/writeScenarioComponents.js +56 -7
- package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
- package/codeyam-cli/scripts/apply-setup.js +1 -1
- package/codeyam-cli/src/cli.js +31 -20
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/analyze.js +2 -2
- package/codeyam-cli/src/commands/analyze.js.map +1 -1
- package/codeyam-cli/src/commands/default.js +6 -1
- package/codeyam-cli/src/commands/default.js.map +1 -1
- package/codeyam-cli/src/commands/memory.js +64 -74
- package/codeyam-cli/src/commands/memory.js.map +1 -1
- package/codeyam-cli/src/commands/setup-simulations.js +1 -1
- package/codeyam-cli/src/commands/verify.js +12 -2
- package/codeyam-cli/src/commands/verify.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
- package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +11 -11
- package/codeyam-cli/src/utils/backgroundServer.js +90 -23
- 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 +13 -13
- package/codeyam-cli/src/utils/labsAutoCheck.js +0 -29
- package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -1
- package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
- package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +2 -4
- package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +2 -1
- package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +1 -1
- package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -1
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
- package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
- package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +83 -0
- package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.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 +14 -4
- package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
- package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
- package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
- package/codeyam-cli/src/utils/rules/sourceFiles.js +47 -0
- package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
- package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +7 -7
- package/codeyam-cli/src/utils/simulationGateMiddleware.js +138 -0
- package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
- package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
- package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
- package/codeyam-cli/src/utils/versionInfo.js +46 -0
- package/codeyam-cli/src/utils/versionInfo.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/dbNotifier.js.map +1 -1
- package/codeyam-cli/src/webserver/backgroundServer.js +26 -7
- 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-CA3JxPb7.js → CopyButton-jNYXRRNI.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-B86KKU7e.js → EntityItem-bwuHPyTa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-B5ctlSYt.js → EntityTypeBadge-CvzqMxcu.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BqY8gDAW.js → EntityTypeIcon-BH0XDim7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-ClaLpuOo.js → InlineSpinner-EhOseatT.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-BDhPilK7.js → InteractivePreview-yjIHlOGa.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-VeqEBv9v.js → LibraryFunctionPreview-Cq5o8jL4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-Bs7Nn1Jr.js → LoadingDots-BvMu2i-g.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Bm3PmcCz.js → LogViewer-kgBTLoJD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-C6PKeMYR.js → ReportIssueModal-BzPgx-xO.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-Gq3Ocjo6.js → SafeScreenshot-CwZrv-Ok.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BNLaXBHR.js → ScenarioViewer-BX2Ny2Qj.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CiwXDxLh.js → TruncatedFilePath-CDpEprKa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{_index-B3TDXxnk.js → _index-BRx8ZGZo.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BtBFH820.js → activity.(_tab)-4S4yPfFw.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +17 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-PttOB2SF.js → book-open-D4IPYH_y.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-TJp6ofnp.js → chevron-down-CG65viiV.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-JE9ZIoBl.js → chunk-JZWAC4HX-DB3aFuEO.js} +9 -9
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CXhHQYrI.js → circle-check-igfMr5DY.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-6y9ALfGT.js → copy-Coc4o_8c.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Ca9fAY46.js → createLucideIcon-D1zB-pYc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-C5lqplTC.js → dev.empty-JTAjQ54M.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-n38keI1k.js → entity._sha._-B0h9AqE6.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js → entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-DGgZjdFg.js → entity._sha_.create-scenario-CtYowLOt.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-38yPijoD.js → entity._sha_.edit._scenarioId-PePWg17F.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-BSHEfydn.js → entry.client-I-Wo99C_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DCPhhSMo.js → fileTableUtils-9sMMAiWJ.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{files-0N0YJQv7.js → files-Co65J0s3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{git-DXnyr8uP.js → git-BdHOxVfg.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-B4MPiL7S.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-ChN9-fAY.js → index-CUM5iXwc.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-CcsFv748.js → index-_417gcQW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-DAvt-sy-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CTqLEAGU.js → loader-circle-TzRHMVog.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-e24d6600.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/memory-bAp4y2hv.js +92 -0
- package/codeyam-cli/src/webserver/build/client/assets/{pause-D6vreykR.js → pause-hjzB7t2z.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/root-DoB3B10-.js +62 -0
- package/codeyam-cli/src/webserver/build/client/assets/{search-B8VUL8nl.js → search-DcAwD_Ln.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{settings-BejnUJ6R.js → settings-CclxrcPK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{simulations-CPoAg7Zo.js → simulations-DVNJVQgD.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-BrCP7uQo.js → terminal-DbEAHMbA.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BZz2NjYa.js → triangle-alert-CAD5b1o_.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-DNwUduNu.js → useCustomSizes-BqgrAzs3.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-COky1GVF.js → useLastLogLine-DAFqfEDH.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CpZgwliL.js → useReportContext-DZlYx2c4.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{useToast-Bv9JFvUO.js → useToast-ihdMtlf6.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/{index-CFKHuovO.js → index-C_nP9_jr.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BEaMCeTu.js +273 -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 → codeyam-diagnose.md} +1 -1
- package/codeyam-cli/templates/{codeyam:memory.md → codeyam-memory.md} +7 -3
- package/codeyam-cli/templates/{codeyam:new-rule.md → codeyam-new-rule.md} +1 -1
- package/codeyam-cli/templates/{codeyam:setup.md → codeyam-setup.md} +1 -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-reflection-hook.py +1 -1
- package/codeyam-cli/templates/rules-instructions.md +1 -1
- package/package.json +12 -12
- package/packages/ai/index.js +1 -1
- package/packages/ai/index.js.map +1 -1
- package/packages/ai/src/lib/analyzeScope.js +14 -0
- package/packages/ai/src/lib/analyzeScope.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +213 -3
- package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +24 -16
- package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
- package/packages/ai/src/lib/dataStructureChunking.js +9 -5
- package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
- package/packages/ai/src/lib/generateExecutionFlows.js +81 -0
- package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
- package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +11 -1
- package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +42 -13
- package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +123 -67
- package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
- package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
- package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-CN61MOMa.js +0 -11
- package/codeyam-cli/src/webserver/build/client/assets/api.labs-survey-l0sNRNKZ.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-CuCsBc3b.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-CB3MGcys.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-de6ccaf4.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/memory-DCA-kLYt.js +0 -81
- package/codeyam-cli/src/webserver/build/client/assets/root-F7e6dvys.js +0 -62
- package/codeyam-cli/src/webserver/build/server/assets/server-build-BQe9Dh4p.js +0 -260
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"buildTimestamp": "2026-02-
|
|
3
|
-
"buildTime":
|
|
4
|
-
"gitCommit": "
|
|
2
|
+
"buildTimestamp": "2026-02-23T19:24:41.178Z",
|
|
3
|
+
"buildTime": 1771874681178,
|
|
4
|
+
"gitCommit": "80e493d2d23413dae7c1ee02edb59828263fb98f",
|
|
5
5
|
"nodeVersion": "v20.20.0",
|
|
6
|
-
"contentHash": "
|
|
7
|
-
"buildNumber":
|
|
8
|
-
"semanticVersion": "0.1.
|
|
9
|
-
"version": "0.1.
|
|
6
|
+
"contentHash": "2ecaac9a4db618717f2df27f667eaab3b8630093f73966eff1cec34d3899aca6",
|
|
7
|
+
"buildNumber": 646,
|
|
8
|
+
"semanticVersion": "0.1.646",
|
|
9
|
+
"version": "0.1.646 (2026-02-23T19:24+2ecaac9)"
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
[2/
|
|
3
|
-
[2/
|
|
2
|
+
[2/23/2026, 7:24:41 PM] > codeyam-combo@1.0.0 mergeDependencies
|
|
3
|
+
[2/23/2026, 7:24:41 PM] > node ./scripts/mergePackageJsonFiles.cjs
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
[2/
|
|
6
|
+
[2/23/2026, 7:24:41 PM] Merged dependencies into root package.json
|
|
7
7
|
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
"build": "tsc && node ./scripts/postbuild.cjs"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
11
|
-
"@aws-sdk/client-cloudfront": "^3.
|
|
12
|
-
"@aws-sdk/client-codebuild": "^3.
|
|
13
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
14
|
-
"@aws-sdk/client-ec2": "^3.
|
|
15
|
-
"@aws-sdk/client-ecr": "^3.
|
|
16
|
-
"@aws-sdk/client-ecs": "^3.
|
|
17
|
-
"@aws-sdk/client-s3": "^3.
|
|
18
|
-
"@aws-sdk/client-sqs": "^3.
|
|
19
|
-
"@aws-sdk/lib-storage": "^3.
|
|
20
|
-
"@aws-sdk/util-dynamodb": "^3.
|
|
10
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.990.0",
|
|
11
|
+
"@aws-sdk/client-cloudfront": "^3.990.0",
|
|
12
|
+
"@aws-sdk/client-codebuild": "^3.990.0",
|
|
13
|
+
"@aws-sdk/client-dynamodb": "^3.990.0",
|
|
14
|
+
"@aws-sdk/client-ec2": "^3.990.0",
|
|
15
|
+
"@aws-sdk/client-ecr": "^3.990.0",
|
|
16
|
+
"@aws-sdk/client-ecs": "^3.990.0",
|
|
17
|
+
"@aws-sdk/client-s3": "^3.990.0",
|
|
18
|
+
"@aws-sdk/client-sqs": "^3.990.0",
|
|
19
|
+
"@aws-sdk/lib-storage": "^3.990.0",
|
|
20
|
+
"@aws-sdk/util-dynamodb": "^3.990.0",
|
|
21
21
|
"@octokit/auth-app": "^8.1.0",
|
|
22
22
|
"@octokit/rest": "^22.0.0",
|
|
23
23
|
"@sendgrid/mail": "^8.1.4",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dotenv": "^17.2.3",
|
|
27
27
|
"express": "^5.2.1",
|
|
28
28
|
"get-port": "^7.1.0",
|
|
29
|
-
"htmlparser2": "^10.
|
|
29
|
+
"htmlparser2": "^10.1.0",
|
|
30
30
|
"jest": "^30.2.0",
|
|
31
31
|
"jsdom": "^27.4.0",
|
|
32
32
|
"jsonc-parser": "^3.2.1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"yargs": "^18.0.0",
|
|
46
46
|
"json5": "^2.2.3",
|
|
47
47
|
"@anthropic-ai/sdk": "^0.74.0",
|
|
48
|
-
"@aws-sdk/s3-request-presigner": "^3.
|
|
48
|
+
"@aws-sdk/s3-request-presigner": "^3.990.0",
|
|
49
49
|
"better-sqlite3": "^12.4.1",
|
|
50
50
|
"fetch-retry": "^6.0.0",
|
|
51
51
|
"kysely": "^0.28.11",
|
|
@@ -43,6 +43,7 @@ export { default as isolateScopes } from './src/lib/isolateScopes';
|
|
|
43
43
|
export {
|
|
44
44
|
default as analyzeScope,
|
|
45
45
|
destroyWorkerPool,
|
|
46
|
+
skipWorkerPool,
|
|
46
47
|
} from './src/lib/analyzeScope';
|
|
47
48
|
export { default as logOrderedMap } from './src/lib/logOrderedMap';
|
|
48
49
|
export {
|
|
@@ -50,6 +50,19 @@ let workerPool: Piscina<
|
|
|
50
50
|
AnalyzeScopeWorkerOutput
|
|
51
51
|
> | null = null;
|
|
52
52
|
let workerPoolDestroyed = false;
|
|
53
|
+
let workerPoolSkipped = false;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Skip worker pool initialization for the current session.
|
|
57
|
+
*
|
|
58
|
+
* The worker thread creates its own ProjectAnalyzer (ts.Program), which takes
|
|
59
|
+
* 50-70s — far longer than the actual entity processing (<2s for typical batches).
|
|
60
|
+
* When the entity count is small, running analyzeScopeLocal on the main thread
|
|
61
|
+
* reuses the existing ProjectAnalyzer and avoids this overhead entirely.
|
|
62
|
+
*/
|
|
63
|
+
export function skipWorkerPool() {
|
|
64
|
+
workerPoolSkipped = true;
|
|
65
|
+
}
|
|
53
66
|
|
|
54
67
|
/**
|
|
55
68
|
* Check if we're in Node.js main thread
|
|
@@ -108,6 +121,7 @@ function ensureWorkerPool() {
|
|
|
108
121
|
'analyzeScope should not be called after data structure preparation completes.',
|
|
109
122
|
);
|
|
110
123
|
}
|
|
124
|
+
if (workerPoolSkipped) return;
|
|
111
125
|
if (workerPool !== null) return;
|
|
112
126
|
|
|
113
127
|
// Only initialize worker pool in Node.js environment
|
|
@@ -3360,6 +3360,22 @@ export class ScopeDataStructure {
|
|
|
3360
3360
|
* ensure all sub-paths of that variable are reflected under signature[N].
|
|
3361
3361
|
*/
|
|
3362
3362
|
private propagateParameterToSignaturePaths(scopeNode: ScopeNode) {
|
|
3363
|
+
// Helper: check if a type is a concrete scalar that cannot have sub-properties.
|
|
3364
|
+
const SCALAR_TYPES = new Set([
|
|
3365
|
+
'string',
|
|
3366
|
+
'number',
|
|
3367
|
+
'boolean',
|
|
3368
|
+
'bigint',
|
|
3369
|
+
'symbol',
|
|
3370
|
+
'void',
|
|
3371
|
+
'never',
|
|
3372
|
+
]);
|
|
3373
|
+
const isDefinitelyScalar = (type: string): boolean => {
|
|
3374
|
+
const parts = type.split('|').map((s) => s.trim());
|
|
3375
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
3376
|
+
return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
|
|
3377
|
+
};
|
|
3378
|
+
|
|
3363
3379
|
// Find variable → signature[N] equivalencies
|
|
3364
3380
|
for (const [varName, equivalencies] of Object.entries(
|
|
3365
3381
|
scopeNode.equivalencies,
|
|
@@ -3390,7 +3406,38 @@ export class ScopeDataStructure {
|
|
|
3390
3406
|
|
|
3391
3407
|
// Only add if the signature path doesn't already exist
|
|
3392
3408
|
if (!scopeNode.schema[sigKey]) {
|
|
3393
|
-
|
|
3409
|
+
// Check if this path represents variable conflation:
|
|
3410
|
+
// When a standalone variable (e.g., showWorkoutForm from useState)
|
|
3411
|
+
// appears as a sub-property of a scalar-typed ancestor (e.g.,
|
|
3412
|
+
// activity_type = "string"), it's from scope conflation, not real
|
|
3413
|
+
// property access. Block these while allowing legitimate built-in
|
|
3414
|
+
// accesses like string.length or string.slice.
|
|
3415
|
+
let isConflatedPath = false;
|
|
3416
|
+
let checkPos = signaturePath.length;
|
|
3417
|
+
while (true) {
|
|
3418
|
+
checkPos = sigKey.indexOf('.', checkPos + 1);
|
|
3419
|
+
if (checkPos === -1) break;
|
|
3420
|
+
const ancestorPath = sigKey.substring(0, checkPos);
|
|
3421
|
+
const ancestorType = scopeNode.schema[ancestorPath];
|
|
3422
|
+
if (ancestorType && isDefinitelyScalar(ancestorType)) {
|
|
3423
|
+
// Ancestor is scalar — check if the immediate sub-property
|
|
3424
|
+
// is also a standalone variable (indicating conflation)
|
|
3425
|
+
const afterDot = sigKey.substring(checkPos + 1);
|
|
3426
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
3427
|
+
const subPropName =
|
|
3428
|
+
nextSep === -1
|
|
3429
|
+
? afterDot
|
|
3430
|
+
: afterDot.substring(0, nextSep);
|
|
3431
|
+
if (scopeNode.schema[subPropName] !== undefined) {
|
|
3432
|
+
isConflatedPath = true;
|
|
3433
|
+
break;
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
|
|
3438
|
+
if (!isConflatedPath) {
|
|
3439
|
+
scopeNode.schema[sigKey] = scopeNode.schema[key];
|
|
3440
|
+
}
|
|
3394
3441
|
}
|
|
3395
3442
|
}
|
|
3396
3443
|
}
|
|
@@ -4165,6 +4212,24 @@ export class ScopeDataStructure {
|
|
|
4165
4212
|
}
|
|
4166
4213
|
}
|
|
4167
4214
|
|
|
4215
|
+
// Helper: check if a type is a concrete scalar that cannot have sub-properties.
|
|
4216
|
+
// e.g., "string", "number | undefined", "boolean | null" are scalar.
|
|
4217
|
+
// "object", "array", "function", "unknown", "Workout", etc. are NOT scalar.
|
|
4218
|
+
const SCALAR_TYPES = new Set([
|
|
4219
|
+
'string',
|
|
4220
|
+
'number',
|
|
4221
|
+
'boolean',
|
|
4222
|
+
'bigint',
|
|
4223
|
+
'symbol',
|
|
4224
|
+
'void',
|
|
4225
|
+
'never',
|
|
4226
|
+
]);
|
|
4227
|
+
const isDefinitelyScalarType = (type: string): boolean => {
|
|
4228
|
+
const parts = type.split('|').map((s) => s.trim());
|
|
4229
|
+
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
4230
|
+
return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
|
|
4231
|
+
};
|
|
4232
|
+
|
|
4168
4233
|
// Propagate nested paths from variables to their signature equivalents
|
|
4169
4234
|
// e.g., if workouts = signature[0].workouts, then workouts[].title becomes
|
|
4170
4235
|
// signature[0].workouts[].title
|
|
@@ -4189,7 +4254,69 @@ export class ScopeDataStructure {
|
|
|
4189
4254
|
|
|
4190
4255
|
// Add to schema if not already present
|
|
4191
4256
|
if (!tempScopeNode.schema[signatureKey]) {
|
|
4192
|
-
|
|
4257
|
+
// Check if this path represents variable conflation:
|
|
4258
|
+
// When a standalone variable (e.g., showWorkoutForm from useState)
|
|
4259
|
+
// appears as a sub-property of a scalar-typed ancestor (e.g.,
|
|
4260
|
+
// activity_type = "string"), it's from scope conflation, not real
|
|
4261
|
+
// property access. Block these while allowing legitimate built-in
|
|
4262
|
+
// accesses like string.length or string.slice.
|
|
4263
|
+
let isConflatedPath = false;
|
|
4264
|
+
let checkPos = signaturePath.length;
|
|
4265
|
+
while (true) {
|
|
4266
|
+
checkPos = signatureKey.indexOf('.', checkPos + 1);
|
|
4267
|
+
if (checkPos === -1) break;
|
|
4268
|
+
const ancestorPath = signatureKey.substring(0, checkPos);
|
|
4269
|
+
const ancestorType = tempScopeNode.schema[ancestorPath];
|
|
4270
|
+
if (ancestorType && isDefinitelyScalarType(ancestorType)) {
|
|
4271
|
+
// Ancestor is scalar — check if the immediate sub-property
|
|
4272
|
+
// is also a standalone variable (indicating conflation)
|
|
4273
|
+
const afterDot = signatureKey.substring(checkPos + 1);
|
|
4274
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
4275
|
+
const subPropName =
|
|
4276
|
+
nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
|
|
4277
|
+
if (schema[subPropName] !== undefined) {
|
|
4278
|
+
isConflatedPath = true;
|
|
4279
|
+
break;
|
|
4280
|
+
}
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
|
|
4284
|
+
if (!isConflatedPath) {
|
|
4285
|
+
tempScopeNode.schema[signatureKey] = schema[schemaKey];
|
|
4286
|
+
}
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
// Post-process: filter out conflated signature paths.
|
|
4293
|
+
// During phase 2 scope analysis, useState(false) conflation can create
|
|
4294
|
+
// bad paths like signature[0].mockWorkouts[].activity_type.showWorkoutForm
|
|
4295
|
+
// directly in scopeNode.schema. These flow through signatureInSchema into
|
|
4296
|
+
// tempScopeNode.schema without any guard. Filter them out here by checking:
|
|
4297
|
+
// 1. An ancestor in the path has a concrete scalar type (string, number, boolean, etc.)
|
|
4298
|
+
// 2. The immediate sub-property of that scalar ancestor is also a standalone
|
|
4299
|
+
// variable in the schema (indicating conflation, not a real property access)
|
|
4300
|
+
for (const key of Object.keys(tempScopeNode.schema)) {
|
|
4301
|
+
if (!key.startsWith('signature[')) continue;
|
|
4302
|
+
|
|
4303
|
+
// Walk through the path looking for scalar-typed ancestors
|
|
4304
|
+
let pos = 0;
|
|
4305
|
+
while (true) {
|
|
4306
|
+
pos = key.indexOf('.', pos + 1);
|
|
4307
|
+
if (pos === -1) break;
|
|
4308
|
+
const ancestorPath = key.substring(0, pos);
|
|
4309
|
+
const ancestorType = tempScopeNode.schema[ancestorPath];
|
|
4310
|
+
if (ancestorType && isDefinitelyScalarType(ancestorType)) {
|
|
4311
|
+
// Found a scalar ancestor — check if the sub-property name
|
|
4312
|
+
// is a standalone variable in the getSchema() result
|
|
4313
|
+
const afterDot = key.substring(pos + 1);
|
|
4314
|
+
const nextSep = afterDot.search(/[.\[]/);
|
|
4315
|
+
const subPropName =
|
|
4316
|
+
nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
|
|
4317
|
+
if (schema[subPropName] !== undefined) {
|
|
4318
|
+
delete tempScopeNode.schema[key];
|
|
4319
|
+
break;
|
|
4193
4320
|
}
|
|
4194
4321
|
}
|
|
4195
4322
|
}
|
|
@@ -4929,9 +5056,109 @@ export class ScopeDataStructure {
|
|
|
4929
5056
|
// Replace cyScope placeholders in all external function call data
|
|
4930
5057
|
// This ensures call signatures and schema paths use actual callback text
|
|
4931
5058
|
// instead of internal cyScope names, preventing mock data merge conflicts.
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
5059
|
+
const rootScopeName = this.scopeTreeManager.getRootName();
|
|
5060
|
+
const rootSchema = this.scopeNodes[rootScopeName]?.schema ?? {};
|
|
5061
|
+
|
|
5062
|
+
return this.externalFunctionCalls.map((efc) => {
|
|
5063
|
+
const cleaned = this.cleanCyScopeFromFunctionCallInfo(efc);
|
|
5064
|
+
return this.filterConflatedExternalPaths(cleaned, rootSchema);
|
|
5065
|
+
});
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5068
|
+
/**
|
|
5069
|
+
* Filters out conflated paths from external function call schemas.
|
|
5070
|
+
*
|
|
5071
|
+
* When multiple useState(false) calls create equivalency conflation during
|
|
5072
|
+
* Phase 1 analysis, standalone boolean state variables (like showWorkoutForm,
|
|
5073
|
+
* showGoalForm) can bleed into external function call schemas as sub-properties
|
|
5074
|
+
* of unrelated data fields (like data[].activity_type.showWorkoutForm).
|
|
5075
|
+
*
|
|
5076
|
+
* Detection: group sub-properties by parent path. If 2+ sub-properties of
|
|
5077
|
+
* the same parent all match standalone root scope variable names, treat them
|
|
5078
|
+
* as conflation artifacts and remove them.
|
|
5079
|
+
*/
|
|
5080
|
+
private filterConflatedExternalPaths(
|
|
5081
|
+
efc: FunctionCallInfo,
|
|
5082
|
+
rootSchema: Record<string, string>,
|
|
5083
|
+
): FunctionCallInfo {
|
|
5084
|
+
// Build a set of top-level root scope variable names (simple names, no dots/brackets)
|
|
5085
|
+
const topLevelRootVars = new Set<string>();
|
|
5086
|
+
for (const key of Object.keys(rootSchema)) {
|
|
5087
|
+
if (!key.includes('.') && !key.includes('[')) {
|
|
5088
|
+
topLevelRootVars.add(key);
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
|
|
5092
|
+
if (topLevelRootVars.size === 0) return efc;
|
|
5093
|
+
|
|
5094
|
+
// Group sub-property matches by their parent path.
|
|
5095
|
+
// For a path like "...data[].activity_type.showWorkoutForm",
|
|
5096
|
+
// parent = "...data[].activity_type", child = "showWorkoutForm"
|
|
5097
|
+
const parentToConflatedKeys = new Map<string, string[]>();
|
|
5098
|
+
|
|
5099
|
+
for (const key of Object.keys(efc.schema)) {
|
|
5100
|
+
const lastDot = key.lastIndexOf('.');
|
|
5101
|
+
if (lastDot === -1) continue;
|
|
5102
|
+
|
|
5103
|
+
const parent = key.substring(0, lastDot);
|
|
5104
|
+
const child = key.substring(lastDot + 1);
|
|
5105
|
+
|
|
5106
|
+
// Skip array access or function call patterns
|
|
5107
|
+
if (child.includes('[') || child.includes('(')) continue;
|
|
5108
|
+
|
|
5109
|
+
// Only consider paths inside array element chains (contains []).
|
|
5110
|
+
// Direct children of functionCallReturnValue are legitimate destructured
|
|
5111
|
+
// return values, not conflation. Conflation happens deeper in the chain
|
|
5112
|
+
// when array element fields get corrupted sub-properties.
|
|
5113
|
+
if (!parent.includes('[')) continue;
|
|
5114
|
+
|
|
5115
|
+
if (topLevelRootVars.has(child)) {
|
|
5116
|
+
if (!parentToConflatedKeys.has(parent)) {
|
|
5117
|
+
parentToConflatedKeys.set(parent, []);
|
|
5118
|
+
}
|
|
5119
|
+
parentToConflatedKeys.get(parent)!.push(key);
|
|
5120
|
+
}
|
|
5121
|
+
}
|
|
5122
|
+
|
|
5123
|
+
// Only filter when 2+ sub-properties of the same parent match root scope vars.
|
|
5124
|
+
// This threshold avoids false positives from coincidental name matches.
|
|
5125
|
+
const keysToRemove = new Set<string>();
|
|
5126
|
+
const parentsToRestore = new Set<string>();
|
|
5127
|
+
|
|
5128
|
+
for (const [parent, conflatedKeys] of parentToConflatedKeys) {
|
|
5129
|
+
if (conflatedKeys.length >= 2) {
|
|
5130
|
+
for (const key of conflatedKeys) {
|
|
5131
|
+
keysToRemove.add(key);
|
|
5132
|
+
}
|
|
5133
|
+
parentsToRestore.add(parent);
|
|
5134
|
+
}
|
|
5135
|
+
}
|
|
5136
|
+
|
|
5137
|
+
if (keysToRemove.size === 0) return efc;
|
|
5138
|
+
|
|
5139
|
+
// Create a new schema without the conflated paths
|
|
5140
|
+
const newSchema: Record<string, string> = {};
|
|
5141
|
+
for (const [key, value] of Object.entries(efc.schema)) {
|
|
5142
|
+
if (keysToRemove.has(key)) continue;
|
|
5143
|
+
|
|
5144
|
+
// Restore parent type: if it was changed to "object" because of conflated
|
|
5145
|
+
// sub-properties, and now all those sub-properties are removed, change it
|
|
5146
|
+
// back to "unknown" (we don't know the original type)
|
|
5147
|
+
if (parentsToRestore.has(key) && value === 'object') {
|
|
5148
|
+
// Check if there are any remaining sub-properties
|
|
5149
|
+
const hasRemainingSubProps = Object.keys(efc.schema).some(
|
|
5150
|
+
(k) =>
|
|
5151
|
+
!keysToRemove.has(k) &&
|
|
5152
|
+
k !== key &&
|
|
5153
|
+
(k.startsWith(key + '.') || k.startsWith(key + '[')),
|
|
5154
|
+
);
|
|
5155
|
+
newSchema[key] = hasRemainingSubProps ? value : 'unknown';
|
|
5156
|
+
} else {
|
|
5157
|
+
newSchema[key] = value;
|
|
5158
|
+
}
|
|
5159
|
+
}
|
|
5160
|
+
|
|
5161
|
+
return { ...efc, schema: newSchema };
|
|
4935
5162
|
}
|
|
4936
5163
|
|
|
4937
5164
|
/**
|
|
@@ -14,35 +14,46 @@ 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
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
23
27
|
const parts = t.split('|').map((s) => s.trim());
|
|
24
28
|
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
base[0] === '
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
|
|
43
|
+
// Treat these as structural placeholders (don't commit them as concrete leaves)
|
|
44
|
+
function isSkippableLeafType(t: string) {
|
|
45
|
+
return getTypeAnalysis(t).isSkippable;
|
|
32
46
|
}
|
|
33
47
|
|
|
34
48
|
// Extract the base structural type from a potentially nullable type string.
|
|
35
49
|
// e.g., 'object | undefined' → 'object', 'array | null' → 'array'
|
|
36
50
|
function getBaseSkippableType(t: string): string {
|
|
37
|
-
|
|
38
|
-
const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
|
|
39
|
-
return base[0];
|
|
51
|
+
return getTypeAnalysis(t).baseType;
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
// Check if a type string has nullable annotations (| undefined or | null)
|
|
43
55
|
function isNullableType(t: string): boolean {
|
|
44
|
-
|
|
45
|
-
return parts.includes('undefined') || parts.includes('null');
|
|
56
|
+
return getTypeAnalysis(t).isNullable;
|
|
46
57
|
}
|
|
47
58
|
|
|
48
59
|
// Matches paths containing [][] — e.g., "items[][]" or "items[][].text"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively strips `_nullable` keys from LLM-generated mock data.
|
|
3
|
+
*
|
|
4
|
+
* The `_nullable` marker is an internal CodeYam concept used in type definitions
|
|
5
|
+
* to indicate that a field can be null/undefined. The LLM sometimes includes
|
|
6
|
+
* these markers in its generated scenario data, which causes runtime errors
|
|
7
|
+
* when code iterates over object keys (e.g., `Object.keys(importedBy)` picks
|
|
8
|
+
* up `_nullable` as a key alongside real data).
|
|
9
|
+
*
|
|
10
|
+
* This function mutates the input object in-place, consistent with other
|
|
11
|
+
* post-processing helpers like `convertNullToUndefinedBySchema`.
|
|
12
|
+
*/
|
|
13
|
+
export default function stripNullableMarkers(
|
|
14
|
+
data: Record<string, unknown>,
|
|
15
|
+
): void {
|
|
16
|
+
if (data == null || typeof data !== 'object') return;
|
|
17
|
+
|
|
18
|
+
// Delete _nullable from this level
|
|
19
|
+
if ('_nullable' in data) {
|
|
20
|
+
delete data._nullable;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Recurse into nested objects and arrays
|
|
24
|
+
for (const value of Object.values(data)) {
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
for (const item of value) {
|
|
27
|
+
if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
|
|
28
|
+
stripNullableMarkers(item as Record<string, unknown>);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} else if (value !== null && typeof value === 'object') {
|
|
32
|
+
stripNullableMarkers(value as Record<string, unknown>);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -4,10 +4,10 @@ import type { ExecutionFlow, ScenariosDataStructure } from '~codeyam/types';
|
|
|
4
4
|
type RequiredValue = NonNullable<ExecutionFlow['requiredValues']>[number];
|
|
5
5
|
|
|
6
6
|
const DEFAULT_MAX_CHUNK_SIZE = 10_000; // ~10K chars per chunk
|
|
7
|
+
const DEFAULT_MAX_KEYS_PER_CHUNK = 20;
|
|
7
8
|
|
|
8
9
|
export interface ChunkOptions {
|
|
9
10
|
maxChunkSize?: number;
|
|
10
|
-
/** @deprecated Use maxChunkSize instead. Kept for backward compatibility in tests. */
|
|
11
11
|
maxKeysPerChunk?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -33,16 +33,19 @@ export function chunkDataStructure(
|
|
|
33
33
|
return [dataForMocks];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const {
|
|
36
|
+
const {
|
|
37
|
+
maxChunkSize = DEFAULT_MAX_CHUNK_SIZE,
|
|
38
|
+
maxKeysPerChunk = DEFAULT_MAX_KEYS_PER_CHUNK,
|
|
39
|
+
} = options;
|
|
37
40
|
const keys = Object.keys(dataForMocks);
|
|
38
41
|
|
|
39
42
|
// Calculate total size to see if chunking is needed
|
|
40
43
|
const totalSize = JSON.stringify(dataForMocks).length;
|
|
41
|
-
if (totalSize <= maxChunkSize) {
|
|
44
|
+
if (totalSize <= maxChunkSize && keys.length <= maxKeysPerChunk) {
|
|
42
45
|
return [dataForMocks];
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
// Greedily pack keys into chunks by cumulative size
|
|
48
|
+
// Greedily pack keys into chunks by cumulative size and key count
|
|
46
49
|
const chunks: Array<ScenariosDataStructure['dataForMocks']> = [];
|
|
47
50
|
let currentChunk: Record<string, unknown> = {};
|
|
48
51
|
let currentSize = 0;
|
|
@@ -52,8 +55,14 @@ export function chunkDataStructure(
|
|
|
52
55
|
(dataForMocks as Record<string, unknown>)[key],
|
|
53
56
|
).length;
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
const currentKeyCount = Object.keys(currentChunk).length;
|
|
59
|
+
|
|
60
|
+
// If adding this key would exceed size or key count limit AND chunk isn't empty, start a new chunk
|
|
61
|
+
if (
|
|
62
|
+
currentSize > 0 &&
|
|
63
|
+
(currentSize + keySize > maxChunkSize ||
|
|
64
|
+
currentKeyCount >= maxKeysPerChunk)
|
|
65
|
+
) {
|
|
57
66
|
chunks.push(currentChunk as ScenariosDataStructure['dataForMocks']);
|
|
58
67
|
currentChunk = {};
|
|
59
68
|
currentSize = 0;
|
|
@@ -32,6 +32,30 @@ import resolvePathToControllable from './resolvePathToControllable';
|
|
|
32
32
|
import { AI } from '~codeyam/ai';
|
|
33
33
|
import type { JsxRenderingUsage, ConditionalUsage } from './astScopes/types';
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Patterns that indicate a child component is a modal/overlay/blocking element.
|
|
37
|
+
* Same patterns used in generateExecutionFlowsFromConditionalEffects.ts for
|
|
38
|
+
* state variable names — here applied to child component names.
|
|
39
|
+
*/
|
|
40
|
+
const BLOCKING_CHILD_PATTERNS = [
|
|
41
|
+
/modal/i,
|
|
42
|
+
/overlay/i,
|
|
43
|
+
/dialog/i,
|
|
44
|
+
/popup/i,
|
|
45
|
+
/drawer/i,
|
|
46
|
+
/sheet/i,
|
|
47
|
+
/lightbox/i,
|
|
48
|
+
/backdrop/i,
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Check if a child component name suggests it's a blocking/modal element.
|
|
53
|
+
* Exported for testing.
|
|
54
|
+
*/
|
|
55
|
+
export function isBlockingChildComponent(componentName: string): boolean {
|
|
56
|
+
return BLOCKING_CHILD_PATTERNS.some((pattern) => pattern.test(componentName));
|
|
57
|
+
}
|
|
58
|
+
|
|
35
59
|
interface GenerateExecutionFlowsArgs {
|
|
36
60
|
entity: Pick<Entity, 'sha' | 'name' | 'filePath' | 'code' | 'metadata'>;
|
|
37
61
|
mergedDataStructure: Omit<DataStructure, 'equivalentSignatureVariables'>;
|
|
@@ -273,6 +297,11 @@ export default function generateExecutionFlows({
|
|
|
273
297
|
calculateFlowPriority(flow, gatingPathToChildren);
|
|
274
298
|
}
|
|
275
299
|
|
|
300
|
+
// Assign exclusiveGroup for truthy/falsy flow pairs that control child components.
|
|
301
|
+
// When the same gating path produces both a truthy flow (show component) and a
|
|
302
|
+
// falsy flow (hide component), they are mutually exclusive and should be grouped.
|
|
303
|
+
assignExclusiveGroupsForGatingPairs(allFlows);
|
|
304
|
+
|
|
276
305
|
// Sort flows by priority (highest first)
|
|
277
306
|
allFlows.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
278
307
|
|
|
@@ -361,6 +390,60 @@ function buildGatingPathToChildrenMap(
|
|
|
361
390
|
return gatingPathToChildren;
|
|
362
391
|
}
|
|
363
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Assign exclusiveGroup for truthy/falsy flow pairs that control child components.
|
|
395
|
+
*
|
|
396
|
+
* When the same attribute path produces both a truthy and falsy flow (e.g.,
|
|
397
|
+
* {diffView && <DiffModal/>}), they are mutually exclusive — only one can be
|
|
398
|
+
* active at a time. Grouping them ensures the scenario generator treats them
|
|
399
|
+
* as alternative states rather than combining them.
|
|
400
|
+
*/
|
|
401
|
+
function assignExclusiveGroupsForGatingPairs(flows: ExecutionFlow[]): void {
|
|
402
|
+
// Build a map: attributePath -> flows with truthy or falsy comparison for that path
|
|
403
|
+
const pathToFlows = new Map<
|
|
404
|
+
string,
|
|
405
|
+
{ truthy: ExecutionFlow[]; falsy: ExecutionFlow[] }
|
|
406
|
+
>();
|
|
407
|
+
|
|
408
|
+
for (const flow of flows) {
|
|
409
|
+
// Only consider flows that control child components
|
|
410
|
+
if (!flow.childComponentsControlled?.length) continue;
|
|
411
|
+
|
|
412
|
+
for (const rv of flow.requiredValues) {
|
|
413
|
+
if (rv.comparison === 'truthy' || rv.comparison === 'falsy') {
|
|
414
|
+
if (!pathToFlows.has(rv.attributePath)) {
|
|
415
|
+
pathToFlows.set(rv.attributePath, { truthy: [], falsy: [] });
|
|
416
|
+
}
|
|
417
|
+
pathToFlows.get(rv.attributePath)![rv.comparison].push(flow);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Also check falsy flows that DON'T have childComponentsControlled —
|
|
423
|
+
// they still pair with truthy flows that do
|
|
424
|
+
for (const flow of flows) {
|
|
425
|
+
if (flow.childComponentsControlled?.length) continue; // Already processed
|
|
426
|
+
|
|
427
|
+
for (const rv of flow.requiredValues) {
|
|
428
|
+
if (rv.comparison === 'falsy' && pathToFlows.has(rv.attributePath)) {
|
|
429
|
+
pathToFlows.get(rv.attributePath)!.falsy.push(flow);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Assign exclusiveGroup where both truthy and falsy flows exist
|
|
435
|
+
for (const [attributePath, { truthy, falsy }] of pathToFlows) {
|
|
436
|
+
if (truthy.length > 0 && falsy.length > 0) {
|
|
437
|
+
const groupName = `gating:${attributePath}`;
|
|
438
|
+
for (const flow of [...truthy, ...falsy]) {
|
|
439
|
+
if (!flow.exclusiveGroup) {
|
|
440
|
+
flow.exclusiveGroup = groupName;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
364
447
|
/**
|
|
365
448
|
* Calculate priority and childComponentsControlled for a flow.
|
|
366
449
|
*
|
|
@@ -415,6 +498,19 @@ function calculateFlowPriority(
|
|
|
415
498
|
if (flow.impact !== 'high') {
|
|
416
499
|
flow.impact = 'high';
|
|
417
500
|
}
|
|
501
|
+
|
|
502
|
+
// Check if any controlled child component is a modal/dialog/overlay.
|
|
503
|
+
// Only truthy flows (which SHOW the component) should be marked as blocking.
|
|
504
|
+
// Falsy flows (which HIDE the component) should not be blocking.
|
|
505
|
+
const isTruthyFlow = flow.requiredValues.some(
|
|
506
|
+
(rv) => rv.comparison === 'truthy' || rv.comparison === 'equals',
|
|
507
|
+
);
|
|
508
|
+
if (
|
|
509
|
+
isTruthyFlow &&
|
|
510
|
+
Array.from(childComponentsControlled).some(isBlockingChildComponent)
|
|
511
|
+
) {
|
|
512
|
+
flow.blocksOtherFlows = true;
|
|
513
|
+
}
|
|
418
514
|
}
|
|
419
515
|
|
|
420
516
|
// Calculate priority score
|