@codeyam/codeyam-cli 0.1.0-staging.1 → 0.1.0-staging.8aea589

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 (111) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +51 -107
  4. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +36 -183
  5. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +34 -0
  6. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +238 -0
  7. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.ts +25 -0
  8. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/index.ts +2 -0
  9. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
  10. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +3 -2
  11. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  12. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
  13. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +3 -2
  14. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  15. package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +6 -2
  16. package/analyzer-template/project/writeUniversalMocks.ts +6 -2
  17. package/background/src/lib/virtualized/project/writeUniversalMocks.js +3 -2
  18. package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
  19. package/codeyam-cli/scripts/apply-setup.js +288 -0
  20. package/codeyam-cli/scripts/apply-setup.js.map +1 -0
  21. package/codeyam-cli/scripts/extract-setup.js +130 -0
  22. package/codeyam-cli/scripts/extract-setup.js.map +1 -0
  23. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +238 -0
  24. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +1 -0
  25. package/codeyam-cli/src/utils/analysisRunner.js +4 -3
  26. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  27. package/codeyam-cli/src/utils/backgroundServer.js +25 -5
  28. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  29. package/codeyam-cli/src/utils/fileWatcher.js +75 -5
  30. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  31. package/codeyam-cli/src/utils/queue/job.js +3 -2
  32. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  33. package/codeyam-cli/src/webserver/app/lib/database.js +13 -0
  34. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  35. package/codeyam-cli/src/webserver/backgroundServer.js +15 -35
  36. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  37. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-rqv54FUY.js +1 -0
  38. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-Dh-FldQK.js → InteractivePreview-B0oiPem-.js} +1 -1
  39. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DqXXjAJ7.js +3 -0
  40. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Dp6DC845.js → LogViewer-BKKG1s2B.js} +1 -1
  41. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-xwuhwsZH.js → SafeScreenshot-DU_jxCPD.js} +1 -1
  42. package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-5DY-YIxu.js +6 -0
  43. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-M2QuSHKC.js → ScenarioViewer-DmjXUj6m.js} +2 -2
  44. package/codeyam-cli/src/webserver/build/client/assets/_index-DvSrcxsk.js +1 -0
  45. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CsaMd9mb.js +10 -0
  46. package/codeyam-cli/src/webserver/build/client/assets/chart-column-VXBS6qOn.js +1 -0
  47. package/codeyam-cli/src/webserver/build/client/assets/circle-alert-n5GUC2AS.js +1 -0
  48. package/codeyam-cli/src/webserver/build/client/assets/clock-DKqtX8js.js +1 -0
  49. package/codeyam-cli/src/webserver/build/client/assets/{components-CAx5ONX_.js → components-Dj-Ggnl2.js} +1 -1
  50. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-DGy3zrli.js → dev.empty-BbR3FwNc.js} +1 -1
  51. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-1Z6D0fLM.js → entity._sha._-BHiWkb_W.js} +7 -7
  52. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-ChAdTrrU.js → entity._sha_.create-scenario-L7M9Vr5z.js} +1 -1
  53. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-D9L7267w.js → entity._sha_.edit._scenarioId-C9w-q7P3.js} +1 -1
  54. package/codeyam-cli/src/webserver/build/client/assets/{entityVersioning-DO2gCvXv.js → entityVersioning-Bk_YB1jM.js} +1 -1
  55. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-C6FRgjPr.js → entry.client-CdGoUs8A.js} +1 -1
  56. package/codeyam-cli/src/webserver/build/client/assets/file-text-B6Er7j5k.js +1 -0
  57. package/codeyam-cli/src/webserver/build/client/assets/files-KcDVw1FY.js +1 -0
  58. package/codeyam-cli/src/webserver/build/client/assets/git-B9uZ8eSJ.js +12 -0
  59. package/codeyam-cli/src/webserver/build/client/assets/globals-B0f88RTV.css +1 -0
  60. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-v3c6DFp4.js +1 -0
  61. package/codeyam-cli/src/webserver/build/client/assets/manifest-fca08d7e.js +1 -0
  62. package/codeyam-cli/src/webserver/build/client/assets/root-Cf8VBqIb.js +16 -0
  63. package/codeyam-cli/src/webserver/build/client/assets/search-DA14wXpu.js +1 -0
  64. package/codeyam-cli/src/webserver/build/client/assets/settings-COJUrwGu.js +1 -0
  65. package/codeyam-cli/src/webserver/build/client/assets/{settings-Hbf8b7J_.js → settings-NU_ZquhK.js} +1 -1
  66. package/codeyam-cli/src/webserver/build/client/assets/simulations-CNaMJ-nR.js +1 -0
  67. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BBlyqxij.js → useLastLogLine-Lumm1t01.js} +1 -1
  68. package/codeyam-cli/src/webserver/build/client/assets/useToast-BRShB17p.js +1 -0
  69. package/codeyam-cli/src/webserver/build/client/assets/zap-BvukH0eN.js +1 -0
  70. package/codeyam-cli/src/webserver/build/client/favicon.svg +13 -0
  71. package/codeyam-cli/src/webserver/build/server/assets/{index-eAULANMV.js → index-DHr4rT4u.js} +1 -1
  72. package/codeyam-cli/src/webserver/build/server/assets/server-build-Bi1mj14J.js +166 -0
  73. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  74. package/codeyam-cli/src/webserver/build-info.json +5 -5
  75. package/codeyam-cli/src/webserver/public/favicon.svg +13 -0
  76. package/codeyam-cli/templates/codeyam-setup-skill.md +24 -18
  77. package/package.json +1 -1
  78. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +51 -107
  79. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
  80. package/packages/ai/src/lib/generateEntityKeyAttributes.js +36 -183
  81. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
  82. package/packages/analyze/src/lib/FileAnalyzer.js +28 -0
  83. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  84. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +191 -0
  85. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -0
  86. package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js +16 -0
  87. package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js.map +1 -0
  88. package/packages/analyze/src/lib/asts/sourceFiles/index.js +2 -0
  89. package/packages/analyze/src/lib/asts/sourceFiles/index.js.map +1 -1
  90. package/packages/utils/src/lib/frameworks/getNextRoutePath.js +3 -2
  91. package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  92. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-GqWwt5wG.js +0 -1
  93. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-p0fuyqGQ.js +0 -3
  94. package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bl2IRh55.js +0 -1
  95. package/codeyam-cli/src/webserver/build/client/assets/_index-CAVtep9Q.js +0 -1
  96. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLmzsLsT.js +0 -10
  97. package/codeyam-cli/src/webserver/build/client/assets/chart-column-B2I7jQx2.js +0 -1
  98. package/codeyam-cli/src/webserver/build/client/assets/circle-alert-GwwOAbhw.js +0 -1
  99. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgyOwWip.js +0 -1
  100. package/codeyam-cli/src/webserver/build/client/assets/files-C3-cQjgv.js +0 -1
  101. package/codeyam-cli/src/webserver/build/client/assets/git-Dp4EB9nv.js +0 -12
  102. package/codeyam-cli/src/webserver/build/client/assets/globals-Da3jt49-.css +0 -1
  103. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DN7Vr40D.js +0 -1
  104. package/codeyam-cli/src/webserver/build/client/assets/manifest-172a4629.js +0 -1
  105. package/codeyam-cli/src/webserver/build/client/assets/root-COyVTsPq.js +0 -16
  106. package/codeyam-cli/src/webserver/build/client/assets/search-CvyP_1Lo.js +0 -1
  107. package/codeyam-cli/src/webserver/build/client/assets/settings-MZc4XdmE.js +0 -1
  108. package/codeyam-cli/src/webserver/build/client/assets/simulations-BMBi0VzO.js +0 -1
  109. package/codeyam-cli/src/webserver/build/client/assets/useToast-C_VxoXTh.js +0 -1
  110. package/codeyam-cli/src/webserver/build/client/assets/zap-B4gsLUZQ.js +0 -1
  111. package/codeyam-cli/src/webserver/build/server/assets/server-build-lutv16q5.js +0 -161
@@ -1,10 +1,10 @@
1
1
  {
2
- "buildTimestamp": "2025-12-08T02:11:48.611Z",
3
- "buildTime": 1765159908611,
4
- "gitCommit": "22495c526b766b949a5503c8f4b8ef8aa3efe705",
2
+ "buildTimestamp": "2025-12-09T21:27:34.619Z",
3
+ "buildTime": 1765315654619,
4
+ "gitCommit": "8aea589922b9c184fd5458f522d785af2e348e72",
5
5
  "nodeVersion": "v20.19.6",
6
- "contentHash": "d64db0470f626ffbe7a594e6bf16b9d759cebeca008c6ba08b37cdfbfeda6ce2",
7
- "buildNumber": 37,
8
- "semanticVersion": "0.1.37",
9
- "version": "0.1.37 (2025-12-08T02:11+d64db04)"
6
+ "contentHash": "131ce1b86de761d815eb9d47d321d6959a13627b88b736f0e01a873d6f68e719",
7
+ "buildNumber": 47,
8
+ "semanticVersion": "0.1.47",
9
+ "version": "0.1.47 (2025-12-09T21:27+131ce1b)"
10
10
  }
@@ -1,7 +1,7 @@
1
1
 
2
- [12/8/2025, 2:11:48 AM] > codeyam-combo@1.0.0 mergeDependencies
3
- [12/8/2025, 2:11:48 AM] > node ./scripts/mergePackageJsonFiles.cjs
2
+ [12/9/2025, 9:27:34 PM] > codeyam-combo@1.0.0 mergeDependencies
3
+ [12/9/2025, 9:27:34 PM] > node ./scripts/mergePackageJsonFiles.cjs
4
4
 
5
5
 
6
- [12/8/2025, 2:11:48 AM] Merged dependencies into root package.json
6
+ [12/9/2025, 9:27:34 PM] Merged dependencies into root package.json
7
7
 
@@ -138,154 +138,98 @@ export default async function generateChangesEntityKeyAttributes({
138
138
  };
139
139
  }
140
140
 
141
- const FRONTEND_SYSTEM_MESSAGE = `We have a frontend function that was recently changed.
141
+ const FRONTEND_SYSTEM_MESSAGE = `You are updating the key attributes for a frontend component that was recently changed.
142
142
 
143
- Can you help us identify if any of the key data attributes in the function are no longer valid or if any new key data attributes should be added to the list?
143
+ This is an INCREMENTAL update. Existing key attributes should be preserved unless the code change clearly invalidates them. Removing and re-adding attributes across changes causes unnecessary churn.
144
144
 
145
- We've provided a list of the existing key data attributes, the commit diff, a list of all data attributes that are now valid, and the function code.
145
+ ## Stability Rules
146
146
 
147
- Each key attribute represents a path from a top level variable and that path must be noted exactly as it is in the "Attributes and Value Types" list.
147
+ - REMOVE only if the attribute is clearly no longer used (variable deleted, conditional removed, no longer referenced)
148
+ - KEEP marginal attributes—if unsure, preserve rather than remove
149
+ - ADD new attributes freely when warranted
148
150
 
149
- Key attributes must come either from the function signature or from a function call that is made from within the function that return data that is used in the function. Please capture the attrribute path exactly from the list.
151
+ ## What Makes a Key Attribute
150
152
 
151
- If an attribute has the keyword "functionCallReturnValue" in it, it is a function call that returns data that is used in the function. That keyword simply designated the return value of the function call. If an attribute path has "[]" in it (e.g. "items[]") that represents one item in that array.
153
+ A key attribute is a data path from "Attributes and Value Types" that dramatically changes how the component renders:
152
154
 
153
- ## Key Attribute Rules
155
+ - Controls a conditional that shows/hides significant UI sections
156
+ - Changes the component's primary visual state (not just minor text differences)
157
+ - Determines which branch of rendering logic executes
154
158
 
155
- - All key attributes must come from the "Attributes and Value Types" provided. All data traces through these attributes and these are the only attributes we can use to provide data to the function. Only use these attributes. Do not reference internally computed variables. Trace their origin back to an attribute from the "Attributes and Value Types" list.
159
+ NOT key attributes:
160
+ - Values that only affect non-visible behavior (hrefs, image srcs)
161
+ - Fallback values that won't be used if primary values exist
162
+ - Values that would cause errors if changed
156
163
 
157
- ### Should be a key attribute
164
+ Note: A conditional that shows a different UI state (e.g., loading screen, redirect message) IS significant—include it. Only exclude guard clauses that render literally nothing.
158
165
 
159
- - Changing the value, length (e.g. for strings or arrays), etc of this variable will dramatically change how the component displays (the return value of the function).
166
+ ## Path Format
160
167
 
161
- - Is used in a conditional that dramatically alters how the component displays (note: if the conditional compares two or more variables, note which variables are involved and how they must be set to cause different behavior).
168
+ Only return attributes from the "Attributes and Value Types" list—these are the only values we can control. Use the exact path provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
162
169
 
163
- ### Should NOT be a key attribute
170
+ ## Response Format
164
171
 
165
- - Changing the value of this variable will cause an error or exception to be thrown.
166
-
167
- - Changing the value of this variable will cause a guard clause to be triggered that results in nothing being displayed.
168
-
169
- - Changing the value of this variable will cause a minor change in display that is not significant (e.g. slightly different text).
170
-
171
- - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
172
-
173
- - The value changes non-visible behavior (e.g. the href in a link or src in an image - all images sources are mocked out).
174
-
175
- ## Instructions
176
-
177
- - Read each line of code. Pay particular attention to the return value of the function and how this frontend component will be displayed. What will cause it display distinctly different but functional and robust results to the user?
178
- - Find the most impactful key attributes that will change how the frontend component is displayed. This should be a limited subset of the "Attributes and Value Types" provided.
179
- - Reference the list of existing key attributes to determine if any of them are no longer valid or if any new key attributes should be added.
180
- - Return each key attribute with the following information:
181
- - \`path\`: The path to the data attribute in the code
182
- - \`description\`: A short description of the data attribute and how it is used in the code.
183
- - \`validValueOptions\`: A list of possible values for the data attribute that should be tested. This should include extreme values that could cause different behavior in the code but these values should not cause an error.
184
- - Each attribute should reference exactly the path of a data attribute provided in the "Attributes and Value Types" section.
185
-
186
- ## Response
187
-
188
- Please respond by specifying which attributes need to be added or removed. For removed attributes just specify the path that is no longer valid.
172
+ For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
189
173
 
190
174
  \`\`\`json
191
175
  {
192
176
  "addedKeyAttributes": [
193
177
  {
194
- "path": "notification.read",
195
- 'percentage": 50,
196
- "description": "The read status of the notification determines how the message is displayed.",
197
- "validValueOptions": [
198
- "true",
199
- "false"
200
- ],
201
- "errorValueOptions": []
202
- },
178
+ "path": "user",
179
+ "description": "Controls whether the main form or redirect screen displays",
180
+ "validValueOptions": ["truthy user object", "null/undefined"]
181
+ }
203
182
  ],
204
- "removedKeyAttributes": [
205
- "notification.message"
206
- ]
183
+ "removedKeyAttributes": ["oldAttribute.path"]
207
184
  }
208
185
  \`\`\`
209
186
 
210
- ## Important
211
-
212
- - A key attribute must be an exact attribute path from the "Attributes and Value Types" provided. Do not return any other attribute paths. The only data we can provide to the function comes from these attributes so any other attribute is useless. For internally computed variables trace them back to one of the higher level variables that we can actually impact. Be sure to match the text from the attribute list exactly including spaces, commas, etc.
187
+ Return empty arrays if no changes needed.
213
188
  `;
214
189
 
215
- const BACKEND_SYSTEM_MESSAGE = `We have a function that was recently changed.
216
-
217
- Can you help us identify if any of the key data attributes in the function are no longer valid or if any new key data attributes should be added to the list?
218
-
219
- We've provided a list of the existing key data attributes, the commit diff, a list of all data attributes that are now valid, and the function code.
190
+ const BACKEND_SYSTEM_MESSAGE = `You are updating the key attributes for a backend function that was recently changed.
220
191
 
221
- Can you help us identify the key data attributes in the code that will cause the function to return distinctly different but functional and robust results?
192
+ This is an INCREMENTAL update. Existing key attributes should be preserved unless the code change clearly invalidates them. Removing and re-adding attributes across changes causes unnecessary churn.
222
193
 
223
- We're not interested in causing errors or in high-level guard clauses that result in nothing being returned. We're interested in always returning a robust result that demonstrates the core intent of the function.
194
+ ## Stability Rules
224
195
 
225
- In order to do so we want to identify the key data attributes in the code.
196
+ - REMOVE only if the attribute is clearly no longer used (variable deleted, conditional removed, no longer referenced)
197
+ - KEEP marginal attributes—if unsure, preserve rather than remove
198
+ - ADD new attributes freely when warranted
226
199
 
227
- Each key attribute represents a path from a top level variable and that path must be noted exactly as it is in the "Attributes and Value Types" list.
200
+ ## What Makes a Key Attribute
228
201
 
229
- Key attributes must come either from the function signature or from a function call that is made from within the function that return data that is used in the function. Please capture the attrribute path exactly from the list.
202
+ A key attribute is a data path from "Attributes and Value Types" that dramatically changes the function's behavior:
230
203
 
231
- If an attribute has the keyword "functionCallReturnValue" in it, it is a function call that returns data that is used in the function. That keyword simply designated the return value of the function call. If an attribute path has "[]" in it (e.g. "items[]") that represents one item in that array.
204
+ - Controls a conditional that significantly alters execution flow or return value
205
+ - Determines which branch of logic executes
206
+ - For side-effect functions: changes how external systems are called (database, email, etc.)
232
207
 
233
- ## Key Attribute Rules
208
+ NOT key attributes:
209
+ - Fallback values that won't be used if primary values exist
210
+ - Values that would cause errors if changed
211
+ - Guard clauses that return nothing/minimal data
234
212
 
235
- - All key attributes must come from the "Attributes and Value Types" provided. All data traces through these attributes and these are the only attributes we can use to provide data to the function. Only use these attributes. Do not reference internally computed variables. Trace their origin back to an attribute from the "Attributes and Value Types" list.
213
+ ## Path Format
236
214
 
237
- ### Should be a key attribute
215
+ Only return attributes from the "Attributes and Value Types" list—these are the only values we can control. Use the exact path provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
238
216
 
239
- - Changing the value, length (e.g. for strings or arrays), etc of this variable will dramatically impact the return value of the function.
217
+ ## Response Format
240
218
 
241
- - Is used in a conditional that dramatically the execution flow of the function and as a result the return value of the function (note: if the conditional compares two or more variables, note which variables are involved and how they must be set to cause different behavior).
242
-
243
- - Note: some functions do not return anything but instead call out to other systems (e.g. send an email, write to a database, etc). In those cases, the key attributes should be those that dramatically change how the function interacts with those other systems.
244
-
245
- ### Should NOT be a key attribute
246
-
247
- - Changing the value of this variable will cause an error or exception to be thrown.
248
-
249
- - Changing the value of this variable will cause a guard clause to be triggered that results in nothing or very little being returned.
250
-
251
- - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
252
-
253
- ## Instructions
254
-
255
- - Read each line of code. Pay particular attention to the return value of the function. What data attributes will cause it to return distinctly different but functional and robust results?
256
- - Find the most impactful key attributes that will impact the return value of the function. This should be a limited subset of the "Attributes and Value Types" provided.
257
- - Reference the list of existing key attributes to determine if any of them are no longer valid or if any new key attributes should be added.
258
- - Return each key attribute with the following information:
259
- - \`path\`: The path to the data attribute in the code
260
- - \`description\`: A short description of the data attribute and how it is used in the code.
261
- - \`validValueOptions\`: A list of possible values for the data attribute that should be tested. This should include extreme values that could cause different behavior in the code but these values should not cause an error.
262
- - Each attribute should reference exactly the path of a data attribute provided in the "Attributes and Value Types" section.
263
-
264
- ## Response
265
-
266
- Please respond by specifying which attributes need to be added or removed. For removed attributes just specify the path that is no longer valid.
219
+ For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
267
220
 
268
221
  \`\`\`json
269
222
  {
270
223
  "addedKeyAttributes": [
271
224
  {
272
- "path": "notification.read",
273
- 'percentage": 50,
274
- "description": "The read status of the notification determines how the message is displayed.",
275
- "validValueOptions": [
276
- "true",
277
- "false"
278
- ],
279
- "errorValueOptions": []
280
- },
225
+ "path": "config.enabled",
226
+ "description": "Controls whether the main processing logic runs",
227
+ "validValueOptions": ["true", "false"]
228
+ }
281
229
  ],
282
- "removedKeyAttributes": [
283
- "notification.message"
284
- ]
230
+ "removedKeyAttributes": ["oldAttribute.path"]
285
231
  }
286
232
  \`\`\`
287
233
 
288
- ## Important
289
-
290
- - A key attribute must be an exact attribute path from the "Attributes and Value Types" provided. Do not return any other attribute paths. The only data we can provide to the function comes from these attributes so any other attribute is useless. For internally computed variables trace them back to one of the higher level variables that we can actually impact. Be sure to match the text from the attribute list exactly including spaces, commas, etc.
234
+ Return empty arrays if no changes needed.
291
235
  `;
@@ -151,224 +151,77 @@ export default async function generateEntityKeyAttributes({
151
151
  };
152
152
  }
153
153
 
154
- const FRONTEND_SYSTEM_MESSAGE = `We have a frontend function and need to determine how best to vary what is returned from this function and displayed to the user.
154
+ const FRONTEND_SYSTEM_MESSAGE = `You analyze frontend components to identify key data attributes that significantly impact rendering.
155
155
 
156
- We're not interested in causing errors or in high-level guard clauses that often display nothing on the screen. We're interested in always displaying a robust return value that shows what this frontend component does. This does not mean that values can't be undefined, but only allow a "validValueOption" to be "undefined" if the component will still display something meaningful to the user.
156
+ ## What Makes a Key Attribute
157
157
 
158
- In order to do so we want to identify the key data attributes in the code. We've included a list of attributes we've identified as being used in conditionals in the code. Can you start with those, order them by importance and remove any that will result in nothing being displayed?
158
+ A key attribute is a data path from "Attributes and Value Types" that dramatically changes how the component renders:
159
159
 
160
- Then can you idfentify any other key attributes from the "Attributes and Value Types" list that will dramatically change how the component is displayed to the user?
160
+ - Controls a conditional that shows/hides significant UI sections
161
+ - Changes the component's primary visual state (not just minor text differences)
162
+ - Determines which branch of rendering logic executes
161
163
 
162
- Each key attribute represents a path from a top level variable and that path must be noted exactly as it is in the "Attributes and Value Types" list.
164
+ NOT key attributes:
165
+ - Values that only affect non-visible behavior (hrefs, image srcs)
166
+ - Fallback values that won't be used if primary values exist
167
+ - Values that would cause errors if changed
168
+ - Guard clauses that render literally nothing
163
169
 
164
- Key attributes must come either from the function signature or from a function call that is made from within the function that return data that is used in the function. Please capture the attrribute path exactly from the list.
170
+ Note: A conditional that shows a different UI state (e.g., loading screen, redirect message) IS significant—include it.
165
171
 
166
- If an attribute has the keyword "functionCallReturnValue" in it, it is a function call that returns data that is used in the function. That keyword simply designated the return value of the function call. If an attribute path has "[]" in it (e.g. "items[]") that represents one item in that array.
172
+ ## Path Format
167
173
 
168
- ## Key Attribute Rules
174
+ Only return attributes from the "Attributes and Value Types" list—these are the only values we can control. Use the exact \`fullPath\` provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
169
175
 
170
- - All key attributes must come from the "Attributes and Value Types" provided. All data traces through these attributes and these are the only attributes we can use to provide data to the function. Only use these attributes. Do not reference internally computed variables. Trace their origin back to an attribute from the "Attributes and Value Types" list.
176
+ ## Response Format
171
177
 
172
- ### Should be a key attribute
173
-
174
- - Changing the presence, value, length (e.g. for strings or arrays), etc of this variable will dramatically change how the component displays (the return value of the function).
175
-
176
- - Is used in a conditional (especially conditionals in the JSX such as \`{varName1 && varName2 && ([JSX])}\` where the absence or presence of both \`varName1\` and \`varName2\` directly impact what the user sees) that alters how the component displays. Capture how the conditional uses the variable. Does it require the variable to be true/false, defined/not defined (e.g. undefined), greater than/less than a certain value, compared with another variable, etc. Really any attribute that is used in a conditional should be a key attribute.
177
-
178
- ### Should NOT be a key attribute
179
-
180
- - Changing the value of this variable will cause an error or exception to be thrown.
181
-
182
- - Changing the value of this variable will cause a guard clause around the whole method or function to be triggered that results in nothing at all being displayed.
183
-
184
- - Changing the value of this variable will cause a minor change in display that is not significant (e.g. slightly different text).
185
-
186
- - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
187
-
188
- - The value changes non-visible behavior (e.g. the href in a link or src in an image - all images sources are mocked out).
189
-
190
- ## Instructions
191
-
192
- - Read each line of code. Pay particular attention to the return value of the function and how this frontend component will be displayed. What will cause it display distinctly different but functional and robust results to the user?
193
- - Find the most impactful key attributes that will change how the frontend component is displayed. This should be a limited subset of the "Attributes and Value Types" provided.
194
- - Return each key attribute with the following information:
195
- - \`fullPath\`: The fullPath to the data attribute in the code
196
- - \`description\`: A short description of the data attribute and how it is used in the code.
197
- - \`validValueOptions\`: A list of possible values for the data attribute that should be tested. This list should be minimal and only include values that the code will handle properly and will clearly make a difference in how the component is displayed. Do not make up arbitrary values without clear evidence that each different value will cause a different display behavior.
198
- - List the key attributes in the order of importance (most important first, with importance determined by how much changing the attribute will impact how the component is displayed).
199
- - Each attribute should reference exactly the full fullPath of a data attribute provided in the "Attributes and Value Types" section.
200
-
201
- ## Example
202
-
203
- Given the following "Attributes and Value Types":
204
- \`\`\`
205
- 'notification.read': { fullPath: 'signature[0].notification.read', type: 'boolean' }
206
- 'notification.message': { fullPath: 'signature[0].notification.message', type: 'string' }
207
- \`\`\`
208
-
209
- and code:
210
-
211
- \`\`\`typescript
212
- const NotificationText = (notification) => {
213
- if (notification.read) {
214
- return (
215
- <span onClick={markAsRead(notification.id)}>
216
- <img src={notification.icon} alt="Notification Icon" />
217
- {notification.message}
218
- </span>
219
- );
220
- } else {
221
- return <strong>{notification.message}</strong>;
222
- }
223
- };
224
- \`\`\`
225
-
226
- The response might be:
178
+ For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
227
179
 
228
180
  \`\`\`json
229
181
  {
230
182
  "keyAttributes": [
231
183
  {
232
- "fullPath": "signature[0].notification.read",
233
- "description": "The read status of the notification determines how the message is displayed.",
234
- "validValueOptions": [
235
- "true",
236
- "false"
237
- ]
238
- },
239
- {
240
- "fullPath": "signature[0].notification.message",
241
- "description": "The message text is displayed and should be tested for various lengths.",
242
- "validValueOptions": [
243
- "An empty message (no characters)",
244
- "A medium message (around 100 characters)",
245
- "A long message (longer than 200 characters)"
246
- ]
184
+ "fullPath": "signature[0].user",
185
+ "description": "Controls whether the main form or redirect screen displays",
186
+ "validValueOptions": ["truthy user object", "null/undefined"]
247
187
  }
248
188
  ]
249
189
  }
250
190
  \`\`\`
251
-
252
- ## Important
253
-
254
- - A key attribute must be an exact attribute fullPath from the "Attributes and Value Types" provided. Do not return any other attribute fullPaths. The only data we can provide to the function comes from these attributes so any other attribute is useless. For internally computed variables trace them back to one of the higher level variables that we can actually impact. Be sure to match the text from the attribute list exactly including spaces, commas, etc.
255
191
  `;
256
192
 
257
- const BACKEND_SYSTEM_MESSAGE = `We have a function that we want to test in various ways by passing in appropriate data.
258
-
259
- Can you help us identify the key data attributes in the code that will cause the function to return distinctly different but functional and robust results?
260
-
261
- We're not interested in causing errors or in high-level guard clauses that result in nothing being returned. We're interested in always returning a robust result that demonstrates the core intent of the function.
193
+ const BACKEND_SYSTEM_MESSAGE = `You analyze backend functions to identify key data attributes that significantly impact behavior.
262
194
 
263
- In order to do so we want to identify the key data attributes in the code. We've included a list of attributes we've identified as being used in conditionals in the code. Can you start with those, order them by importance and remove any that will result in nothing being displayed?
195
+ ## What Makes a Key Attribute
264
196
 
265
- Then can you idfentify any other key attributes from the "Attributes and Value Types" list that will dramatically change how the component is displayed to the user?
197
+ A key attribute is a data path from "Attributes and Value Types" that dramatically changes the function's behavior:
266
198
 
267
- Each key attribute represents a path from a top level variable and that fullPath must be noted exactly as it is in the "Attributes and Value Types" list.
199
+ - Controls a conditional that significantly alters execution flow or return value
200
+ - Determines which branch of logic executes
201
+ - For side-effect functions: changes how external systems are called (database, email, etc.)
268
202
 
269
- Key attributes must come either from the function signature or from a function call that is made from within the function that return data that is used in the function. Please capture the attrribute fullPath exactly from the list.
203
+ NOT key attributes:
204
+ - Fallback values that won't be used if primary values exist
205
+ - Values that would cause errors if changed
206
+ - Guard clauses that return nothing/minimal data
270
207
 
271
- If an attribute has the keyword "functionCallReturnValue" in it, it is a function call that returns data that is used in the function. That keyword simply designated the return value of the function call. If an attribute path has "[]" in it (e.g. "items[]") that represents one item in that array.
208
+ ## Path Format
272
209
 
273
- ## Key Attribute Rules
210
+ Only return attributes from the "Attributes and Value Types" list—these are the only values we can control. Use the exact \`fullPath\` provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
274
211
 
275
- - All key attributes must come from the "Attributes and Value Types" provided. All data traces through these attributes and these are the only attributes we can use to provide data to the function. Only use these attributes. Do not reference internally computed variables. Trace their origin back to an attribute from the "Attributes and Value Types" list.
212
+ ## Response Format
276
213
 
277
- ### Should be a key attribute
278
-
279
- - Changing the value, length (e.g. for strings or arrays), etc of this variable will dramatically impact the return value of the function.
280
-
281
- - Is used in a conditional that dramatically the execution flow of the function and as a result the return value of the function (note: if the conditional compares two or more variables, note which variables are involved and how they must be set to cause different behavior).
282
-
283
- - Note: some functions do not return anything but instead call out to other systems (e.g. send an email, write to a database, etc). In those cases, the key attributes should be those that dramatically change how the function interacts with those other systems.
284
-
285
- ### Should NOT be a key attribute
286
-
287
- - Changing the value of this variable will cause an error or exception to be thrown.
288
-
289
- - Changing the value of this variable will cause a guard clause to be triggered that results in nothing or very little being returned.
290
-
291
- - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
292
-
293
- ## Instructions
294
-
295
- - Read each line of code. Pay particular attention to the return value of the function. What data attributes will cause it to return distinctly different but functional and robust results?
296
- - Find the most impactful key attributes that will impact the return value of the function. This should be a limited subset of the "Attributes and Value Types" provided.
297
- - Return each key attribute with the following information:
298
- - \`fullPath\`: The fullPath to the data attribute in the code
299
- - \`description\`: A short description of the data attribute and how it is used in the code.
300
- - \`validValueOptions\`: A list of possible values for the data attribute that should be tested. This list should be minimal and only include values that the code will handle properly and will clearly make a difference in the functions's behavior. Do not make up arbitrary values without clear evidence that each different value will clearly result in a different function behavior.
301
- - List the key attributes in the order of importance (most important first, with importance determined by how much changing the attribute will change the return value of the function).
302
- - Each attribute should reference exactly the fullPath of a data attribute provided in the "Attributes and Value Types" section.
303
-
304
- ## Example
305
-
306
- Given the following "Attributes and Value Types":
307
- \`\`\`
308
- [
309
- items[].quantity: { fullPath: 'signature[0][].quantity', type: 'number' },
310
- items[].price: { fullPath: 'signature[0][].price', type: 'number' },
311
- discount: { fullPath: 'signature[1]', type: 'number' },
312
- taxRate: { fullPath: 'signature[2]', type: 'number' },
313
- ]
314
- \`\`\`
315
-
316
- and code:
317
-
318
- \`\`\`typescript
319
- const calculateTotal = (items, discount, taxRate) => {
320
- const subtotal = items.reduce((sum, item) => sum + item.quantity * item.price, 0);
321
- const discountedTotal = subtotal - discount;
322
- const tax = discountedTotal * taxRate;
323
- return discountedTotal + tax;
324
- }
325
- \`\`\`
326
-
327
- The response might be:
214
+ For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
328
215
 
329
216
  \`\`\`json
330
217
  {
331
218
  "keyAttributes": [
332
219
  {
333
- "fullPath": "signature[0][].quantity",
334
- "description": "The quantity of each item affects the subtotal calculation.",
335
- "validValueOptions": [
336
- "0 (no items)",
337
- "1 (single item)",
338
- "5 (multiple items)",
339
- "100 (large quantity)"
340
- ]
341
- },
342
- {
343
- "fullPath": "signature[0][].price",
344
- "description": "The price of each item affects the subtotal calculation.",
345
- "validValueOptions": [
346
- "0.00 (free item)",
347
- "19.99 (average price)",
348
- "999.99 (high price)"
349
- ]
350
- },
351
- {
352
- "fullPath": "signature[1]",
353
- "description": "The discount amount directly reduces the subtotal.",
354
- "validValueOptions": [
355
- "0 (no discount)",
356
- "20.00 (discount)"
357
- ]
358
- },
359
- {
360
- "fullPath": "signature[2]",
361
- "description": "The tax rate affects the final total calculation.",
362
- "validValueOptions": [
363
- "0 (no tax)",
364
- "0.20 (20% tax)"
365
- ]
220
+ "fullPath": "signature[0].config.enabled",
221
+ "description": "Controls whether the main processing logic runs",
222
+ "validValueOptions": ["true", "false"]
366
223
  }
367
224
  ]
368
225
  }
369
226
  \`\`\`
370
-
371
- ## Important
372
-
373
- - A key attribute must be an exact attribute fullPath from the "Attributes and Value Types" provided. Do not return any other attribute fullPaths. The only data we can provide to the function comes from these attributes so any other attribute is useless. For internally computed variables trace them back to one of the higher level variables that we can actually impact. Be sure to match the text from the attribute list exactly including spaces, commas, etc.
374
227
  `;
@@ -84,6 +84,17 @@ export class FileAnalyzer {
84
84
  }
85
85
  }
86
86
 
87
+ /**
88
+ * Returns only declared entity nodes (not identifier references).
89
+ * Use this when you need to find entities that can be replaced/mocked.
90
+ */
91
+ getAllDeclaredEntityNodes() {
92
+ if (!this.sourceFile) return {};
93
+ return lib.asts.sourceFiles.getAllDeclaredEntityNodes({
94
+ sourceFile: this.sourceFile,
95
+ });
96
+ }
97
+
87
98
  getNodeCode(node: ts.Node, removeComments = false) {
88
99
  if (!this.sourceFile) return '';
89
100
  if (removeComments) {
@@ -138,6 +149,29 @@ export class FileAnalyzer {
138
149
  });
139
150
  }
140
151
 
152
+ /**
153
+ * Get the code for a declared entity (not identifier references).
154
+ * Use this when you need to find code that can be replaced/mocked.
155
+ */
156
+ getDeclaredEntityCode(entityName: string, removeComments = false) {
157
+ if (!this.sourceFile) return '';
158
+ const entityNode = lib.asts.sourceFiles.getDeclaredEntityNode({
159
+ entityName,
160
+ sourceFile: this.sourceFile,
161
+ });
162
+
163
+ if (removeComments) {
164
+ const printer = ts.createPrinter({ removeComments: true });
165
+ return printer.printNode(
166
+ ts.EmitHint.Unspecified,
167
+ entityNode,
168
+ this.sourceFile,
169
+ );
170
+ }
171
+
172
+ return entityNode.getText(this.sourceFile);
173
+ }
174
+
141
175
  getAllExports(): Record<string, ExportedFunction> {
142
176
  if (!this.sourceFile) return {};
143
177
  return lib.asts.sourceFiles.getAllExports(this.sourceFile);