@codeyam/codeyam-cli 0.1.0-staging.73a4bf4 → 0.1.0-staging.790201e

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.
Files changed (118) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +13 -13
  4. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +232 -5
  5. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  6. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +15 -6
  7. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +96 -0
  8. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  9. package/analyzer-template/packages/aws/package.json +10 -10
  10. package/analyzer-template/project/constructMockCode.ts +32 -5
  11. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  12. package/analyzer-template/project/writeScenarioComponents.ts +76 -12
  13. package/background/src/lib/virtualized/project/constructMockCode.js +28 -5
  14. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  15. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  16. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  17. package/background/src/lib/virtualized/project/writeScenarioComponents.js +56 -7
  18. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  19. package/codeyam-cli/src/cli.js +31 -20
  20. package/codeyam-cli/src/cli.js.map +1 -1
  21. package/codeyam-cli/src/commands/memory.js +63 -20
  22. package/codeyam-cli/src/commands/memory.js.map +1 -1
  23. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +179 -0
  24. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  25. package/codeyam-cli/src/utils/backgroundServer.js +16 -33
  26. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  27. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  28. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  29. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
  30. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
  31. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
  32. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
  33. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +2 -4
  34. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
  35. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +2 -1
  36. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
  37. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +1 -1
  38. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -1
  39. package/codeyam-cli/src/utils/simulationGateMiddleware.js +138 -0
  40. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  41. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  42. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  43. package/codeyam-cli/src/utils/versionInfo.js +46 -0
  44. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  45. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  46. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  47. package/codeyam-cli/src/webserver/bootstrap.js +11 -0
  48. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  49. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-jNYXRRNI.js +1 -0
  50. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BLlhOa3C.js → EntityItem-bwuHPyTa.js} +1 -1
  51. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-De5b5pC7.js → EntityTypeBadge-CvzqMxcu.js} +1 -1
  52. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CzdG5I7z.js → EntityTypeIcon-BH0XDim7.js} +1 -1
  53. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-Bclf8Hka.js → InlineSpinner-EhOseatT.js} +1 -1
  54. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-Ce-byqKl.js → InteractivePreview-yjIHlOGa.js} +2 -2
  55. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-DEMHrl7v.js → LibraryFunctionPreview-Cq5o8jL4.js} +1 -1
  56. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B1LNGboS.js → LoadingDots-BvMu2i-g.js} +1 -1
  57. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-B0Ll1DjK.js → LogViewer-kgBTLoJD.js} +1 -1
  58. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-CVOvmCKb.js → ReportIssueModal-BzPgx-xO.js} +1 -1
  59. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-L0DWHa_L.js → SafeScreenshot-CwZrv-Ok.js} +1 -1
  60. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-D54Mmpwi.js → ScenarioViewer-BX2Ny2Qj.js} +1 -1
  61. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-C7PFQfXy.js → TruncatedFilePath-CDpEprKa.js} +1 -1
  62. package/codeyam-cli/src/webserver/build/client/assets/{_index-CKTtYlBU.js → _index-BRx8ZGZo.js} +1 -1
  63. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-CdziRIWU.js → activity.(_tab)-4S4yPfFw.js} +1 -1
  64. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-CPXtdaWm.js → agent-transcripts-DHKuQSmR.js} +1 -1
  65. package/codeyam-cli/src/webserver/build/client/assets/{book-open-Ch8b7GyQ.js → book-open-D4IPYH_y.js} +1 -1
  66. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-vJHJExlT.js → chevron-down-CG65viiV.js} +1 -1
  67. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-BEyX4X6_.js → chunk-JZWAC4HX-DB3aFuEO.js} +11 -11
  68. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-rwynPZTW.js → circle-check-igfMr5DY.js} +1 -1
  69. package/codeyam-cli/src/webserver/build/client/assets/{copy-BBSpeBYf.js → copy-Coc4o_8c.js} +1 -1
  70. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-DHVDauuc.js → createLucideIcon-D1zB-pYc.js} +1 -1
  71. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-B9_ZqelV.js → dev.empty-JTAjQ54M.js} +1 -1
  72. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-B0h9AqE6.js +23 -0
  73. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-Cfw__yQa.js → entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js} +1 -1
  74. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-BIDUUrI3.js → entity._sha_.create-scenario-CtYowLOt.js} +1 -1
  75. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BEqewwtZ.js → entity._sha_.edit._scenarioId-PePWg17F.js} +1 -1
  76. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-Dxqz8ygt.js → entry.client-I-Wo99C_.js} +1 -1
  77. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-CYnF5KWN.js → fileTableUtils-9sMMAiWJ.js} +1 -1
  78. package/codeyam-cli/src/webserver/build/client/assets/{files-B_dAq2PQ.js → files-Co65J0s3.js} +1 -1
  79. package/codeyam-cli/src/webserver/build/client/assets/{git-BHPqH3Ch.js → git-BdHOxVfg.js} +1 -1
  80. package/codeyam-cli/src/webserver/build/client/assets/globals-BSZfYCkU.css +1 -0
  81. package/codeyam-cli/src/webserver/build/client/assets/{index-viijWaN6.js → index-CUM5iXwc.js} +1 -1
  82. package/codeyam-cli/src/webserver/build/client/assets/{index-DgAAopZk.js → index-_417gcQW.js} +1 -1
  83. package/codeyam-cli/src/webserver/build/client/assets/labs-DAvt-sy-.js +1 -0
  84. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-LGi2eKI5.js → loader-circle-TzRHMVog.js} +1 -1
  85. package/codeyam-cli/src/webserver/build/client/assets/{manifest-87493a32.js → manifest-6947409c.js} +1 -1
  86. package/codeyam-cli/src/webserver/build/client/assets/memory-UIDVz141.js +92 -0
  87. package/codeyam-cli/src/webserver/build/client/assets/{pause-DxJFmMsK.js → pause-hjzB7t2z.js} +1 -1
  88. package/codeyam-cli/src/webserver/build/client/assets/root-D1WadSdf.js +62 -0
  89. package/codeyam-cli/src/webserver/build/client/assets/{search-Cu3QE9E5.js → search-DcAwD_Ln.js} +1 -1
  90. package/codeyam-cli/src/webserver/build/client/assets/{settings-KH9TdArD.js → settings-CclxrcPK.js} +1 -1
  91. package/codeyam-cli/src/webserver/build/client/assets/{simulations-D9Fkx0-d.js → simulations-DVNJVQgD.js} +1 -1
  92. package/codeyam-cli/src/webserver/build/client/assets/{terminal-dAhIBEcd.js → terminal-DbEAHMbA.js} +1 -1
  93. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-C4CYTEeP.js → triangle-alert-CAD5b1o_.js} +1 -1
  94. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-CLPnITMB.js → useCustomSizes-BqgrAzs3.js} +1 -1
  95. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-DmGI38Et.js → useLastLogLine-DAFqfEDH.js} +1 -1
  96. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-BK0S88PB.js → useReportContext-DZlYx2c4.js} +1 -1
  97. package/codeyam-cli/src/webserver/build/client/assets/{useToast-CJ-JqR0l.js → useToast-ihdMtlf6.js} +1 -1
  98. package/codeyam-cli/src/webserver/build/server/assets/{index-CkkmL6r5.js → index-mgnAFRsm.js} +1 -1
  99. package/codeyam-cli/src/webserver/build/server/assets/{server-build-iBGjHYtO.js → server-build-YljqAnWW.js} +78 -64
  100. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  101. package/codeyam-cli/src/webserver/build-info.json +5 -5
  102. package/codeyam-cli/templates/rule-reflection-hook.py +1 -1
  103. package/codeyam-cli/templates/rules-instructions.md +1 -1
  104. package/package.json +6 -6
  105. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +213 -3
  106. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  107. package/packages/ai/src/lib/dataStructureChunking.js +9 -5
  108. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
  109. package/packages/ai/src/lib/generateExecutionFlows.js +81 -0
  110. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  111. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  112. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  113. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-D9i_zSlY.js +0 -1
  114. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-BOPComvD.js +0 -16
  115. package/codeyam-cli/src/webserver/build/client/assets/globals-BJGhRykz.css +0 -1
  116. package/codeyam-cli/src/webserver/build/client/assets/labs-ChoAe3xq.js +0 -1
  117. package/codeyam-cli/src/webserver/build/client/assets/memory-D9eA6kTo.js +0 -78
  118. package/codeyam-cli/src/webserver/build/client/assets/root-C3r0p_7H.js +0 -62
@@ -1,10 +1,10 @@
1
1
  {
2
- "buildTimestamp": "2026-02-13T14:28:17.195Z",
3
- "buildTime": 1770992897195,
4
- "gitCommit": "73a4bf44d0625577d9329b832941832b3f85c2d9",
2
+ "buildTimestamp": "2026-02-20T10:49:38.469Z",
3
+ "buildTime": 1771584578469,
4
+ "gitCommit": "790201edf1562f0841f04417020fc44039213399",
5
5
  "nodeVersion": "v20.20.0",
6
- "contentHash": "a9e7da7c2163d221270c5c78518194b788e5d1cf54afc7c2fc030b2791db4c29",
7
- "buildNumber": 619,
8
- "semanticVersion": "0.1.619",
9
- "version": "0.1.619 (2026-02-13T14:28+a9e7da7)"
6
+ "contentHash": "7aa82b02f9a5c4c0baec4d7db041ce29c43713b4208ef992dbac30fbc81f00da",
7
+ "buildNumber": 641,
8
+ "semanticVersion": "0.1.641",
9
+ "version": "0.1.641 (2026-02-20T10:49+7aa82b0)"
10
10
  }
@@ -1,7 +1,7 @@
1
1
 
2
- [2/13/2026, 2:28:17 PM] > codeyam-combo@1.0.0 mergeDependencies
3
- [2/13/2026, 2:28:17 PM] > node ./scripts/mergePackageJsonFiles.cjs
2
+ [2/20/2026, 10:49:38 AM] > codeyam-combo@1.0.0 mergeDependencies
3
+ [2/20/2026, 10:49:38 AM] > node ./scripts/mergePackageJsonFiles.cjs
4
4
 
5
5
 
6
- [2/13/2026, 2:28:17 PM] Merged dependencies into root package.json
6
+ [2/20/2026, 10:49:38 AM] 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.980.0",
11
- "@aws-sdk/client-cloudfront": "^3.985.0",
12
- "@aws-sdk/client-codebuild": "^3.948.0",
13
- "@aws-sdk/client-dynamodb": "^3.956.0",
14
- "@aws-sdk/client-ec2": "^3.899.0",
15
- "@aws-sdk/client-ecr": "^3.948.0",
16
- "@aws-sdk/client-ecs": "^3.956.0",
17
- "@aws-sdk/client-s3": "^3.940.0",
18
- "@aws-sdk/client-sqs": "^3.956.0",
19
- "@aws-sdk/lib-storage": "^3.975.0",
20
- "@aws-sdk/util-dynamodb": "^3.971.0",
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.0.0",
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.940.0",
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",
@@ -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
- scopeNode.schema[sigKey] = scopeNode.schema[key];
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
- tempScopeNode.schema[signatureKey] = schema[schemaKey];
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
- return this.externalFunctionCalls.map((efc) =>
4933
- this.cleanCyScopeFromFunctionCallInfo(efc),
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
  /**
@@ -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 { maxChunkSize = DEFAULT_MAX_CHUNK_SIZE } = options;
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
- // If adding this key would exceed the limit AND chunk isn't empty, start a new chunk
56
- if (currentSize > 0 && currentSize + keySize > maxChunkSize) {
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
@@ -39,6 +39,7 @@ export function getNodeType(node: ts.Node, sourceFile: ts.SourceFile) {
39
39
  case 'StringLiteral':
40
40
  case 'NumericLiteral':
41
41
  case 'ObjectLiteralExpression':
42
+ case 'ArrayLiteralExpression':
42
43
  nodeType = 'data';
43
44
  break;
44
45
  case 'TypeAliasDeclaration':
@@ -11,15 +11,15 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
- "@aws-sdk/client-codebuild": "^3.948.0",
15
- "@aws-sdk/client-cloudwatch-logs": "^3.980.0",
16
- "@aws-sdk/client-dynamodb": "^3.956.0",
17
- "@aws-sdk/client-ecr": "^3.948.0",
18
- "@aws-sdk/client-ecs": "^3.956.0",
19
- "@aws-sdk/client-s3": "^3.940.0",
20
- "@aws-sdk/client-sqs": "^3.956.0",
21
- "@aws-sdk/lib-storage": "^3.975.0",
22
- "@aws-sdk/s3-request-presigner": "^3.940.0",
23
- "@aws-sdk/util-dynamodb": "^3.971.0"
14
+ "@aws-sdk/client-codebuild": "^3.990.0",
15
+ "@aws-sdk/client-cloudwatch-logs": "^3.990.0",
16
+ "@aws-sdk/client-dynamodb": "^3.990.0",
17
+ "@aws-sdk/client-ecr": "^3.990.0",
18
+ "@aws-sdk/client-ecs": "^3.990.0",
19
+ "@aws-sdk/client-s3": "^3.990.0",
20
+ "@aws-sdk/client-sqs": "^3.990.0",
21
+ "@aws-sdk/lib-storage": "^3.990.0",
22
+ "@aws-sdk/s3-request-presigner": "^3.990.0",
23
+ "@aws-sdk/util-dynamodb": "^3.990.0"
24
24
  }
25
25
  }
@@ -2288,6 +2288,23 @@ export default function constructMockCode(
2288
2288
  }
2289
2289
  }
2290
2290
 
2291
+ // Post-processing: When the root functionCallReturnValue is typed as "function" but the
2292
+ // return value also has nested properties (methods like .from(), .auth, etc.), it's actually
2293
+ // an object, not a function to be called. Clear returnsFunctionArgs to prevent double-wrapping
2294
+ // (adding an extra () => { return { ... } } wrapper and ["()"] data paths).
2295
+ // This handles cases like Supabase's createClient() which returns an object with methods.
2296
+ // Only applied to the root level - nested parts that are functions with methods (like
2297
+ // useSearchParams()[1] which is a setter function with .set() and .delete()) should keep
2298
+ // their returnsFunctionArgs since they genuinely ARE functions.
2299
+ if (
2300
+ returnValueParts.returnsFunctionArgs &&
2301
+ returnValueParts.returnsFunctionArgs.length === 0 &&
2302
+ returnValueParts.nested &&
2303
+ returnValueParts.nested.length > 0
2304
+ ) {
2305
+ returnValueParts.returnsFunctionArgs = undefined;
2306
+ }
2307
+
2291
2308
  const contents = constructReturnValueString(returnValueParts);
2292
2309
 
2293
2310
  if (mockNameParts.length > 1) {
@@ -2360,16 +2377,26 @@ export default function constructMockCode(
2360
2377
  const nameAssignment = isErrorSubclass
2361
2378
  ? `this.name = '${baseMockName}';`
2362
2379
  : '';
2363
- // Use the safe function name for the class definition
2364
- const className = mockNameIsCallSignature
2365
- ? derivedFunctionName
2366
- : baseMockName;
2380
+ // Use the base class name for the class definition, not the call-signature-derived name.
2381
+ // When mockName is "StatsCalculator(supabase)", baseMockName is "StatsCalculator"
2382
+ // and derivedFunctionName would be "StatsCalculator_supabase" which is wrong.
2383
+ // Classes are instantiated with `new ClassName(args)` so the name must match the original.
2384
+ const className = baseMockName;
2385
+
2386
+ // Use the already-generated contents (which has proper function wrappers for methods)
2387
+ // instead of raw scenarios().data() which would create non-callable string-keyed properties.
2388
+ // For classes with methods like calculateStats(), the contents will have:
2389
+ // { calculateStats: (...args) => scenarios().data()?.["key"]?.["calculateStats(...)"], ... }
2390
+ // which makes methods callable on the instance.
2391
+ const classContents = enhancedContents.trim().startsWith('{')
2392
+ ? enhancedContents
2393
+ : `scenarios().data()?.${quotePropertyKey(dataKey)} || {}`;
2367
2394
 
2368
2395
  return `class ${className}${isErrorSubclass ? ' extends Error' : ''} {
2369
2396
  constructor(message) {
2370
2397
  ${superCall}
2371
2398
  ${nameAssignment}
2372
- Object.assign(this, scenarios().data()?.${quotePropertyKey(dataKey)} || {});
2399
+ Object.assign(this, ${classContents});
2373
2400
  }
2374
2401
  }`;
2375
2402
  }
@@ -32,7 +32,10 @@ import type {
32
32
  } from './orchestrateCapture/taskRunner';
33
33
  import KyselyAnalysisLoader from './orchestrateCapture/KyselyAnalysisLoader';
34
34
 
35
- const MAX_BATCH_SIZE = 6;
35
+ // Temporarily set to 1 (effectively disabling batching) to work around reliability
36
+ // issues where multi-analysis batches cause cascading failures. Revisit once we
37
+ // reassess the SQS protocol and worker error handling.
38
+ const MAX_BATCH_SIZE = 1;
36
39
  const POLLING_INTERVAL = 30 * 1000; // 30 seconds
37
40
  const TASK_HEALTH_CHECK_INTERVAL = 60 * 1000; // 1 minute
38
41
  const ANALYSIS_TIMEOUT = 20 * 60 * 1000;