@codeyam/codeyam-cli 0.1.0-staging.eb21b2f → 0.1.0-staging.fef152f

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 (71) 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/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  7. package/analyzer-template/packages/aws/package.json +10 -10
  8. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  9. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +6 -2
  10. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  11. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +14 -2
  12. package/analyzer-template/project/constructMockCode.ts +32 -5
  13. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  14. package/analyzer-template/project/writeScenarioComponents.ts +62 -12
  15. package/background/src/lib/virtualized/project/constructMockCode.js +28 -5
  16. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  17. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  18. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  19. package/background/src/lib/virtualized/project/writeScenarioComponents.js +46 -7
  20. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  21. package/codeyam-cli/src/cli.js +31 -20
  22. package/codeyam-cli/src/cli.js.map +1 -1
  23. package/codeyam-cli/src/commands/memory.js +3 -56
  24. package/codeyam-cli/src/commands/memory.js.map +1 -1
  25. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +6 -0
  26. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -1
  27. package/codeyam-cli/src/utils/npmVersionCheck.js +2 -2
  28. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -1
  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/rules/__tests__/pathMatcher.test.js +84 -0
  36. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  37. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +83 -0
  38. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  39. package/codeyam-cli/src/utils/rules/index.js +1 -0
  40. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  41. package/codeyam-cli/src/utils/rules/pathMatcher.js +10 -0
  42. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
  43. package/codeyam-cli/src/utils/rules/sourceFiles.js +47 -0
  44. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  45. package/codeyam-cli/src/utils/simulationGateMiddleware.js +138 -0
  46. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  47. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  48. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  49. package/codeyam-cli/src/utils/versionInfo.js +21 -0
  50. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  51. package/codeyam-cli/src/webserver/build/client/assets/globals-Dzl-jeq-.css +1 -0
  52. package/codeyam-cli/src/webserver/build/client/assets/labs-DAvt-sy-.js +1 -0
  53. package/codeyam-cli/src/webserver/build/client/assets/{manifest-390cb8fa.js → manifest-2d0e2ebb.js} +1 -1
  54. package/codeyam-cli/src/webserver/build/client/assets/memory-DVGtTawo.js +92 -0
  55. package/codeyam-cli/src/webserver/build/client/assets/root-Bg3WICdl.js +62 -0
  56. package/codeyam-cli/src/webserver/build/server/assets/{index-CXfuiwt3.js → index-CpreP2n8.js} +1 -1
  57. package/codeyam-cli/src/webserver/build/server/assets/server-build-DyvoFrHR.js +273 -0
  58. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  59. package/codeyam-cli/src/webserver/build-info.json +5 -5
  60. package/package.json +5 -5
  61. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +213 -3
  62. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  63. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  64. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  65. package/packages/utils/src/lib/fs/rsyncCopy.js +6 -2
  66. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  67. package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +0 -1
  68. package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +0 -1
  69. package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +0 -78
  70. package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +0 -62
  71. package/codeyam-cli/src/webserver/build/server/assets/server-build-BSvme_Ao.js +0 -259
@@ -1 +1 @@
1
- import{Y as H,Z as I,M as J,N as K,W as L,O as _,R as $,T as rr,V as tr,U as or,X as ir,Q as pr}from"./assets/server-build-BSvme_Ao.js";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"fetch-retry";import"better-sqlite3";import"pg";import"fs";import"path";import"kysely";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"typescript";import"fs/promises";import"os";import"prompts";import"chalk";import"crypto";import"child_process";import"url";import"util";import"dotenv";import"events";import"uuid";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";export{H as allowedActionOrigins,I as assets,J as assetsBuildDirectory,K as basename,L as entry,_ as future,$ as isSpaMode,rr as prerender,tr as publicPath,or as routeDiscovery,ir as routes,pr as ssr};
1
+ import{Y as H,Z as I,M as J,N as K,W as L,O as _,R as $,T as rr,V as tr,U as or,X as ir,Q as pr}from"./assets/server-build-DyvoFrHR.js";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"fetch-retry";import"better-sqlite3";import"pg";import"fs";import"path";import"kysely";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"typescript";import"fs/promises";import"os";import"prompts";import"chalk";import"crypto";import"child_process";import"url";import"util";import"dotenv";import"events";import"uuid";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";export{H as allowedActionOrigins,I as assets,J as assetsBuildDirectory,K as basename,L as entry,_ as future,$ as isSpaMode,rr as prerender,tr as publicPath,or as routeDiscovery,ir as routes,pr as ssr};
@@ -1,7 +1,7 @@
1
1
  {
2
- "buildTimestamp": "2026-02-14T10:09:27.718Z",
3
- "buildTime": 1771063767718,
4
- "buildNumber": 645,
5
- "semanticVersion": "0.1.645",
6
- "version": "0.1.645 (2026-02-14T10:09)"
2
+ "buildTimestamp": "2026-02-20T14:12:02.037Z",
3
+ "buildTime": 1771596722037,
4
+ "buildNumber": 662,
5
+ "semanticVersion": "0.1.662",
6
+ "version": "0.1.662 (2026-02-20T14:12)"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeyam/codeyam-cli",
3
- "version": "0.1.0-staging.eb21b2f",
3
+ "version": "0.1.0-staging.fef152f",
4
4
  "description": "Local development CLI for CodeYam analysis",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,9 +12,9 @@
12
12
  "dependencies": {
13
13
  "@anthropic-ai/claude-code": "^2.1.7",
14
14
  "@anthropic-ai/sdk": "^0.74.0",
15
- "@aws-sdk/client-dynamodb": "^3.956.0",
16
- "@aws-sdk/s3-request-presigner": "^3.940.0",
17
- "@aws-sdk/util-dynamodb": "^3.971.0",
15
+ "@aws-sdk/client-dynamodb": "^3.990.0",
16
+ "@aws-sdk/s3-request-presigner": "^3.990.0",
17
+ "@aws-sdk/util-dynamodb": "^3.990.0",
18
18
  "@modelcontextprotocol/sdk": "^1.26.0",
19
19
  "@octokit/auth-app": "^8.1.0",
20
20
  "@octokit/request": "^10.0.3",
@@ -33,7 +33,7 @@
33
33
  "express": "^5.2.1",
34
34
  "fetch-retry": "^6.0.0",
35
35
  "get-port": "^7.1.0",
36
- "htmlparser2": "^10.0.0",
36
+ "htmlparser2": "^10.1.0",
37
37
  "isbot": "^4",
38
38
  "jsdom": "^27.4.0",
39
39
  "json5": "^2.2.3",
@@ -2306,6 +2306,21 @@ export class ScopeDataStructure {
2306
2306
  * ensure all sub-paths of that variable are reflected under signature[N].
2307
2307
  */
2308
2308
  propagateParameterToSignaturePaths(scopeNode) {
2309
+ // Helper: check if a type is a concrete scalar that cannot have sub-properties.
2310
+ const SCALAR_TYPES = new Set([
2311
+ 'string',
2312
+ 'number',
2313
+ 'boolean',
2314
+ 'bigint',
2315
+ 'symbol',
2316
+ 'void',
2317
+ 'never',
2318
+ ]);
2319
+ const isDefinitelyScalar = (type) => {
2320
+ const parts = type.split('|').map((s) => s.trim());
2321
+ const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
2322
+ return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
2323
+ };
2309
2324
  // Find variable → signature[N] equivalencies
2310
2325
  for (const [varName, equivalencies] of Object.entries(scopeNode.equivalencies)) {
2311
2326
  // Only process simple variable names (no dots, brackets, or parens)
@@ -2327,7 +2342,37 @@ export class ScopeDataStructure {
2327
2342
  const sigKey = signaturePath + suffix;
2328
2343
  // Only add if the signature path doesn't already exist
2329
2344
  if (!scopeNode.schema[sigKey]) {
2330
- scopeNode.schema[sigKey] = scopeNode.schema[key];
2345
+ // Check if this path represents variable conflation:
2346
+ // When a standalone variable (e.g., showWorkoutForm from useState)
2347
+ // appears as a sub-property of a scalar-typed ancestor (e.g.,
2348
+ // activity_type = "string"), it's from scope conflation, not real
2349
+ // property access. Block these while allowing legitimate built-in
2350
+ // accesses like string.length or string.slice.
2351
+ let isConflatedPath = false;
2352
+ let checkPos = signaturePath.length;
2353
+ while (true) {
2354
+ checkPos = sigKey.indexOf('.', checkPos + 1);
2355
+ if (checkPos === -1)
2356
+ break;
2357
+ const ancestorPath = sigKey.substring(0, checkPos);
2358
+ const ancestorType = scopeNode.schema[ancestorPath];
2359
+ if (ancestorType && isDefinitelyScalar(ancestorType)) {
2360
+ // Ancestor is scalar — check if the immediate sub-property
2361
+ // is also a standalone variable (indicating conflation)
2362
+ const afterDot = sigKey.substring(checkPos + 1);
2363
+ const nextSep = afterDot.search(/[.\[]/);
2364
+ const subPropName = nextSep === -1
2365
+ ? afterDot
2366
+ : afterDot.substring(0, nextSep);
2367
+ if (scopeNode.schema[subPropName] !== undefined) {
2368
+ isConflatedPath = true;
2369
+ break;
2370
+ }
2371
+ }
2372
+ }
2373
+ if (!isConflatedPath) {
2374
+ scopeNode.schema[sigKey] = scopeNode.schema[key];
2375
+ }
2331
2376
  }
2332
2377
  }
2333
2378
  }
@@ -2900,6 +2945,23 @@ export class ScopeDataStructure {
2900
2945
  }
2901
2946
  }
2902
2947
  }
2948
+ // Helper: check if a type is a concrete scalar that cannot have sub-properties.
2949
+ // e.g., "string", "number | undefined", "boolean | null" are scalar.
2950
+ // "object", "array", "function", "unknown", "Workout", etc. are NOT scalar.
2951
+ const SCALAR_TYPES = new Set([
2952
+ 'string',
2953
+ 'number',
2954
+ 'boolean',
2955
+ 'bigint',
2956
+ 'symbol',
2957
+ 'void',
2958
+ 'never',
2959
+ ]);
2960
+ const isDefinitelyScalarType = (type) => {
2961
+ const parts = type.split('|').map((s) => s.trim());
2962
+ const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
2963
+ return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
2964
+ };
2903
2965
  // Propagate nested paths from variables to their signature equivalents
2904
2966
  // e.g., if workouts = signature[0].workouts, then workouts[].title becomes
2905
2967
  // signature[0].workouts[].title
@@ -2919,7 +2981,67 @@ export class ScopeDataStructure {
2919
2981
  const signatureKey = signaturePath + suffix;
2920
2982
  // Add to schema if not already present
2921
2983
  if (!tempScopeNode.schema[signatureKey]) {
2922
- tempScopeNode.schema[signatureKey] = schema[schemaKey];
2984
+ // Check if this path represents variable conflation:
2985
+ // When a standalone variable (e.g., showWorkoutForm from useState)
2986
+ // appears as a sub-property of a scalar-typed ancestor (e.g.,
2987
+ // activity_type = "string"), it's from scope conflation, not real
2988
+ // property access. Block these while allowing legitimate built-in
2989
+ // accesses like string.length or string.slice.
2990
+ let isConflatedPath = false;
2991
+ let checkPos = signaturePath.length;
2992
+ while (true) {
2993
+ checkPos = signatureKey.indexOf('.', checkPos + 1);
2994
+ if (checkPos === -1)
2995
+ break;
2996
+ const ancestorPath = signatureKey.substring(0, checkPos);
2997
+ const ancestorType = tempScopeNode.schema[ancestorPath];
2998
+ if (ancestorType && isDefinitelyScalarType(ancestorType)) {
2999
+ // Ancestor is scalar — check if the immediate sub-property
3000
+ // is also a standalone variable (indicating conflation)
3001
+ const afterDot = signatureKey.substring(checkPos + 1);
3002
+ const nextSep = afterDot.search(/[.\[]/);
3003
+ const subPropName = nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
3004
+ if (schema[subPropName] !== undefined) {
3005
+ isConflatedPath = true;
3006
+ break;
3007
+ }
3008
+ }
3009
+ }
3010
+ if (!isConflatedPath) {
3011
+ tempScopeNode.schema[signatureKey] = schema[schemaKey];
3012
+ }
3013
+ }
3014
+ }
3015
+ }
3016
+ }
3017
+ // Post-process: filter out conflated signature paths.
3018
+ // During phase 2 scope analysis, useState(false) conflation can create
3019
+ // bad paths like signature[0].mockWorkouts[].activity_type.showWorkoutForm
3020
+ // directly in scopeNode.schema. These flow through signatureInSchema into
3021
+ // tempScopeNode.schema without any guard. Filter them out here by checking:
3022
+ // 1. An ancestor in the path has a concrete scalar type (string, number, boolean, etc.)
3023
+ // 2. The immediate sub-property of that scalar ancestor is also a standalone
3024
+ // variable in the schema (indicating conflation, not a real property access)
3025
+ for (const key of Object.keys(tempScopeNode.schema)) {
3026
+ if (!key.startsWith('signature['))
3027
+ continue;
3028
+ // Walk through the path looking for scalar-typed ancestors
3029
+ let pos = 0;
3030
+ while (true) {
3031
+ pos = key.indexOf('.', pos + 1);
3032
+ if (pos === -1)
3033
+ break;
3034
+ const ancestorPath = key.substring(0, pos);
3035
+ const ancestorType = tempScopeNode.schema[ancestorPath];
3036
+ if (ancestorType && isDefinitelyScalarType(ancestorType)) {
3037
+ // Found a scalar ancestor — check if the sub-property name
3038
+ // is a standalone variable in the getSchema() result
3039
+ const afterDot = key.substring(pos + 1);
3040
+ const nextSep = afterDot.search(/[.\[]/);
3041
+ const subPropName = nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
3042
+ if (schema[subPropName] !== undefined) {
3043
+ delete tempScopeNode.schema[key];
3044
+ break;
2923
3045
  }
2924
3046
  }
2925
3047
  }
@@ -3534,7 +3656,95 @@ export class ScopeDataStructure {
3534
3656
  // Replace cyScope placeholders in all external function call data
3535
3657
  // This ensures call signatures and schema paths use actual callback text
3536
3658
  // instead of internal cyScope names, preventing mock data merge conflicts.
3537
- return this.externalFunctionCalls.map((efc) => this.cleanCyScopeFromFunctionCallInfo(efc));
3659
+ const rootScopeName = this.scopeTreeManager.getRootName();
3660
+ const rootSchema = this.scopeNodes[rootScopeName]?.schema ?? {};
3661
+ return this.externalFunctionCalls.map((efc) => {
3662
+ const cleaned = this.cleanCyScopeFromFunctionCallInfo(efc);
3663
+ return this.filterConflatedExternalPaths(cleaned, rootSchema);
3664
+ });
3665
+ }
3666
+ /**
3667
+ * Filters out conflated paths from external function call schemas.
3668
+ *
3669
+ * When multiple useState(false) calls create equivalency conflation during
3670
+ * Phase 1 analysis, standalone boolean state variables (like showWorkoutForm,
3671
+ * showGoalForm) can bleed into external function call schemas as sub-properties
3672
+ * of unrelated data fields (like data[].activity_type.showWorkoutForm).
3673
+ *
3674
+ * Detection: group sub-properties by parent path. If 2+ sub-properties of
3675
+ * the same parent all match standalone root scope variable names, treat them
3676
+ * as conflation artifacts and remove them.
3677
+ */
3678
+ filterConflatedExternalPaths(efc, rootSchema) {
3679
+ // Build a set of top-level root scope variable names (simple names, no dots/brackets)
3680
+ const topLevelRootVars = new Set();
3681
+ for (const key of Object.keys(rootSchema)) {
3682
+ if (!key.includes('.') && !key.includes('[')) {
3683
+ topLevelRootVars.add(key);
3684
+ }
3685
+ }
3686
+ if (topLevelRootVars.size === 0)
3687
+ return efc;
3688
+ // Group sub-property matches by their parent path.
3689
+ // For a path like "...data[].activity_type.showWorkoutForm",
3690
+ // parent = "...data[].activity_type", child = "showWorkoutForm"
3691
+ const parentToConflatedKeys = new Map();
3692
+ for (const key of Object.keys(efc.schema)) {
3693
+ const lastDot = key.lastIndexOf('.');
3694
+ if (lastDot === -1)
3695
+ continue;
3696
+ const parent = key.substring(0, lastDot);
3697
+ const child = key.substring(lastDot + 1);
3698
+ // Skip array access or function call patterns
3699
+ if (child.includes('[') || child.includes('('))
3700
+ continue;
3701
+ // Only consider paths inside array element chains (contains []).
3702
+ // Direct children of functionCallReturnValue are legitimate destructured
3703
+ // return values, not conflation. Conflation happens deeper in the chain
3704
+ // when array element fields get corrupted sub-properties.
3705
+ if (!parent.includes('['))
3706
+ continue;
3707
+ if (topLevelRootVars.has(child)) {
3708
+ if (!parentToConflatedKeys.has(parent)) {
3709
+ parentToConflatedKeys.set(parent, []);
3710
+ }
3711
+ parentToConflatedKeys.get(parent).push(key);
3712
+ }
3713
+ }
3714
+ // Only filter when 2+ sub-properties of the same parent match root scope vars.
3715
+ // This threshold avoids false positives from coincidental name matches.
3716
+ const keysToRemove = new Set();
3717
+ const parentsToRestore = new Set();
3718
+ for (const [parent, conflatedKeys] of parentToConflatedKeys) {
3719
+ if (conflatedKeys.length >= 2) {
3720
+ for (const key of conflatedKeys) {
3721
+ keysToRemove.add(key);
3722
+ }
3723
+ parentsToRestore.add(parent);
3724
+ }
3725
+ }
3726
+ if (keysToRemove.size === 0)
3727
+ return efc;
3728
+ // Create a new schema without the conflated paths
3729
+ const newSchema = {};
3730
+ for (const [key, value] of Object.entries(efc.schema)) {
3731
+ if (keysToRemove.has(key))
3732
+ continue;
3733
+ // Restore parent type: if it was changed to "object" because of conflated
3734
+ // sub-properties, and now all those sub-properties are removed, change it
3735
+ // back to "unknown" (we don't know the original type)
3736
+ if (parentsToRestore.has(key) && value === 'object') {
3737
+ // Check if there are any remaining sub-properties
3738
+ const hasRemainingSubProps = Object.keys(efc.schema).some((k) => !keysToRemove.has(k) &&
3739
+ k !== key &&
3740
+ (k.startsWith(key + '.') || k.startsWith(key + '[')));
3741
+ newSchema[key] = hasRemainingSubProps ? value : 'unknown';
3742
+ }
3743
+ else {
3744
+ newSchema[key] = value;
3745
+ }
3746
+ }
3747
+ return { ...efc, schema: newSchema };
3538
3748
  }
3539
3749
  /**
3540
3750
  * Cleans cyScope placeholder references from a FunctionCallInfo.