@codeyam/codeyam-cli 0.1.0-bleeding-edge.8afd3ee → 0.1.0-staging.1

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 +107 -51
  4. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +183 -36
  5. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +0 -34
  6. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/index.ts +0 -2
  7. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
  8. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -3
  9. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  10. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
  11. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +2 -3
  12. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  13. package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +2 -6
  14. package/analyzer-template/project/writeUniversalMocks.ts +2 -6
  15. package/background/src/lib/virtualized/project/writeUniversalMocks.js +2 -3
  16. package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
  17. package/codeyam-cli/src/utils/analysisRunner.js +3 -4
  18. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  19. package/codeyam-cli/src/utils/backgroundServer.js +5 -25
  20. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  21. package/codeyam-cli/src/utils/fileWatcher.js +5 -75
  22. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  23. package/codeyam-cli/src/utils/queue/job.js +2 -3
  24. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  25. package/codeyam-cli/src/webserver/app/lib/database.js +0 -13
  26. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  27. package/codeyam-cli/src/webserver/backgroundServer.js +35 -15
  28. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  29. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-GqWwt5wG.js +1 -0
  30. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-B0oiPem-.js → InteractivePreview-Dh-FldQK.js} +1 -1
  31. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-p0fuyqGQ.js +3 -0
  32. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-BKKG1s2B.js → LogViewer-Dp6DC845.js} +1 -1
  33. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DU_jxCPD.js → SafeScreenshot-xwuhwsZH.js} +1 -1
  34. package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bl2IRh55.js +1 -0
  35. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DmjXUj6m.js → ScenarioViewer-M2QuSHKC.js} +2 -2
  36. package/codeyam-cli/src/webserver/build/client/assets/_index-CAVtep9Q.js +1 -0
  37. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLmzsLsT.js +10 -0
  38. package/codeyam-cli/src/webserver/build/client/assets/chart-column-B2I7jQx2.js +1 -0
  39. package/codeyam-cli/src/webserver/build/client/assets/circle-alert-GwwOAbhw.js +1 -0
  40. package/codeyam-cli/src/webserver/build/client/assets/{components-Dj-Ggnl2.js → components-CAx5ONX_.js} +1 -1
  41. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgyOwWip.js +1 -0
  42. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-BbR3FwNc.js → dev.empty-DGy3zrli.js} +1 -1
  43. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BHiWkb_W.js → entity._sha._-1Z6D0fLM.js} +7 -7
  44. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-L7M9Vr5z.js → entity._sha_.create-scenario-ChAdTrrU.js} +1 -1
  45. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-C9w-q7P3.js → entity._sha_.edit._scenarioId-D9L7267w.js} +1 -1
  46. package/codeyam-cli/src/webserver/build/client/assets/{entityVersioning-Bk_YB1jM.js → entityVersioning-DO2gCvXv.js} +1 -1
  47. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CdGoUs8A.js → entry.client-C6FRgjPr.js} +1 -1
  48. package/codeyam-cli/src/webserver/build/client/assets/files-C3-cQjgv.js +1 -0
  49. package/codeyam-cli/src/webserver/build/client/assets/git-Dp4EB9nv.js +12 -0
  50. package/codeyam-cli/src/webserver/build/client/assets/globals-Da3jt49-.css +1 -0
  51. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DN7Vr40D.js +1 -0
  52. package/codeyam-cli/src/webserver/build/client/assets/manifest-172a4629.js +1 -0
  53. package/codeyam-cli/src/webserver/build/client/assets/root-COyVTsPq.js +16 -0
  54. package/codeyam-cli/src/webserver/build/client/assets/search-CvyP_1Lo.js +1 -0
  55. package/codeyam-cli/src/webserver/build/client/assets/{settings-NU_ZquhK.js → settings-Hbf8b7J_.js} +1 -1
  56. package/codeyam-cli/src/webserver/build/client/assets/settings-MZc4XdmE.js +1 -0
  57. package/codeyam-cli/src/webserver/build/client/assets/simulations-BMBi0VzO.js +1 -0
  58. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-Lumm1t01.js → useLastLogLine-BBlyqxij.js} +1 -1
  59. package/codeyam-cli/src/webserver/build/client/assets/useToast-C_VxoXTh.js +1 -0
  60. package/codeyam-cli/src/webserver/build/client/assets/zap-B4gsLUZQ.js +1 -0
  61. package/codeyam-cli/src/webserver/build/server/assets/{index-DHr4rT4u.js → index-eAULANMV.js} +1 -1
  62. package/codeyam-cli/src/webserver/build/server/assets/server-build-lutv16q5.js +161 -0
  63. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  64. package/codeyam-cli/src/webserver/build-info.json +5 -5
  65. package/codeyam-cli/templates/codeyam-setup-skill.md +18 -24
  66. package/package.json +1 -1
  67. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +107 -51
  68. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
  69. package/packages/ai/src/lib/generateEntityKeyAttributes.js +183 -36
  70. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
  71. package/packages/analyze/src/lib/FileAnalyzer.js +0 -28
  72. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  73. package/packages/analyze/src/lib/asts/sourceFiles/index.js +0 -2
  74. package/packages/analyze/src/lib/asts/sourceFiles/index.js.map +1 -1
  75. package/packages/utils/src/lib/frameworks/getNextRoutePath.js +2 -3
  76. package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  77. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +0 -238
  78. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.ts +0 -25
  79. package/codeyam-cli/scripts/apply-setup.js +0 -288
  80. package/codeyam-cli/scripts/apply-setup.js.map +0 -1
  81. package/codeyam-cli/scripts/extract-setup.js +0 -130
  82. package/codeyam-cli/scripts/extract-setup.js.map +0 -1
  83. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  84. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  85. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-rqv54FUY.js +0 -1
  86. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DqXXjAJ7.js +0 -3
  87. package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-5DY-YIxu.js +0 -6
  88. package/codeyam-cli/src/webserver/build/client/assets/_index-DvSrcxsk.js +0 -1
  89. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CsaMd9mb.js +0 -10
  90. package/codeyam-cli/src/webserver/build/client/assets/chart-column-VXBS6qOn.js +0 -1
  91. package/codeyam-cli/src/webserver/build/client/assets/circle-alert-n5GUC2AS.js +0 -1
  92. package/codeyam-cli/src/webserver/build/client/assets/clock-DKqtX8js.js +0 -1
  93. package/codeyam-cli/src/webserver/build/client/assets/file-text-B6Er7j5k.js +0 -1
  94. package/codeyam-cli/src/webserver/build/client/assets/files-KcDVw1FY.js +0 -1
  95. package/codeyam-cli/src/webserver/build/client/assets/git-B9uZ8eSJ.js +0 -12
  96. package/codeyam-cli/src/webserver/build/client/assets/globals-B0f88RTV.css +0 -1
  97. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-v3c6DFp4.js +0 -1
  98. package/codeyam-cli/src/webserver/build/client/assets/manifest-fca08d7e.js +0 -1
  99. package/codeyam-cli/src/webserver/build/client/assets/root-Cf8VBqIb.js +0 -16
  100. package/codeyam-cli/src/webserver/build/client/assets/search-DA14wXpu.js +0 -1
  101. package/codeyam-cli/src/webserver/build/client/assets/settings-COJUrwGu.js +0 -1
  102. package/codeyam-cli/src/webserver/build/client/assets/simulations-CNaMJ-nR.js +0 -1
  103. package/codeyam-cli/src/webserver/build/client/assets/useToast-BRShB17p.js +0 -1
  104. package/codeyam-cli/src/webserver/build/client/assets/zap-BvukH0eN.js +0 -1
  105. package/codeyam-cli/src/webserver/build/client/favicon.svg +0 -13
  106. package/codeyam-cli/src/webserver/build/server/assets/server-build-Bi1mj14J.js +0 -166
  107. package/codeyam-cli/src/webserver/public/favicon.svg +0 -13
  108. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +0 -191
  109. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +0 -1
  110. package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js +0 -16
  111. package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js.map +0 -1
@@ -1 +1 @@
1
- import{W as I,N as J,O as K,U as L,Q as X,R as Y,M as Z,T as _,V as $}from"./assets/server-build-Bi1mj14J.js";import"react/jsx-runtime";import"node:stream";import"@remix-run/node";import"@remix-run/react";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"react-resizable";import"openai";import"p-queue";import"p-retry";import"child_process";import"util";import"@aws-sdk/client-dynamodb";import"json5";import"lru-cache";import"pluralize";import"piscina";import"@aws-sdk/util-dynamodb";import"dotenv";import"events";import"uuid";import"url";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"v8";import"react-diff-viewer-continued";export{I as assets,J as assetsBuildDirectory,K as basename,L as entry,X as future,Y as isSpaMode,Z as mode,_ as publicPath,$ as routes};
1
+ import{W as I,N as J,O as K,U as L,Q as X,R as Y,M as Z,T as _,V as $}from"./assets/server-build-lutv16q5.js";import"react/jsx-runtime";import"node:stream";import"@remix-run/node";import"@remix-run/react";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"react-resizable";import"openai";import"p-queue";import"p-retry";import"child_process";import"util";import"@aws-sdk/client-dynamodb";import"json5";import"lru-cache";import"pluralize";import"piscina";import"@aws-sdk/util-dynamodb";import"dotenv";import"events";import"uuid";import"url";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"v8";import"react-diff-viewer-continued";export{I as assets,J as assetsBuildDirectory,K as basename,L as entry,X as future,Y as isSpaMode,Z as mode,_ as publicPath,$ as routes};
@@ -1,7 +1,7 @@
1
1
  {
2
- "buildTimestamp": "2025-12-09T21:06:53.801Z",
3
- "buildTime": 1765314413801,
4
- "buildNumber": 48,
5
- "semanticVersion": "0.1.48",
6
- "version": "0.1.48 (2025-12-09T21:06)"
2
+ "buildTimestamp": "2025-12-08T02:11:45.872Z",
3
+ "buildTime": 1765159905872,
4
+ "buildNumber": 38,
5
+ "semanticVersion": "0.1.38",
6
+ "version": "0.1.38 (2025-12-08T02:11)"
7
7
  }
@@ -170,6 +170,18 @@ codeyam update-config
170
170
 
171
171
  ### Step 2: Test Startup for Selected Webapps
172
172
 
173
+ Ask user how they want to handle environment setup:
174
+
175
+ ```
176
+ CodeYam needs to start your dev server safely without connecting to real services.
177
+ This won't affect your normal development.
178
+
179
+ Options:
180
+ 1. "My environment is already safe" - Test as-is
181
+ 2. "I'll configure it myself" - You guide, user creates mocks
182
+ 3. "Claude handles it" - You create mocks automatically
183
+ ```
184
+
173
185
  **IMPORTANT: You must test EVERY webapp selected in Step 1**
174
186
 
175
187
  **ACTION 1:** Get the selected webapps from config:
@@ -202,13 +214,13 @@ codeyam test-startup --webappPath . --debug
202
214
 
203
215
  - Keep a checklist of all webapps
204
216
  - Mark each as passing or failing
205
- - ALL selected webapps must pass before proceeding to Step 4
217
+ - ALL webapps must pass before proceeding to Step 4
206
218
 
207
219
  **Flow for each webapp:**
208
220
 
209
221
  - If success → Move to next webapp
210
222
  - If error → Go to Step 3, create mocks, re-test THIS webapp until it passes
211
- - Only after ALL selected webapps pass → Go to Step 4
223
+ - Only after ALL webapps pass → Go to Step 4
212
224
 
213
225
  ### Step 3: Fix Errors (Environment Variables or Mocks)
214
226
 
@@ -295,7 +307,7 @@ Repeat until the webapp passes, then continue testing remaining webapps.
295
307
 
296
308
  ### Step 4: Success
297
309
 
298
- Once `test-startup` passes for ALL selected webapps:
310
+ Once `test-startup` passes for ALL webapps:
299
311
 
300
312
  1. Run `codeyam suggest --limit 1 --verbose` (timeout: 5 minutes)
301
313
  2. Tell user CodeYam is ready
@@ -432,7 +444,7 @@ export const prisma = {
432
444
 
433
445
  3. **Validate before retry** - Use `codeyam validate-mock` to catch issues before running test-startup again.
434
446
 
435
- 4. **Keep mocks minimal** - Empty methods and null returns are usually enough. The goal is to provide a simple mock with a structurally accurate return value. Do not import anything for mocks. Keep the mock simple.
447
+ 4. **Keep mocks minimal** - Empty methods and null returns are usually enough.
436
448
 
437
449
  5. **Match exports exactly** - Export names are case-sensitive and must match the original.
438
450
 
@@ -443,26 +455,8 @@ export const prisma = {
443
455
  Setup is complete when:
444
456
 
445
457
  - ✅ Selected `webapps` configured in `.codeyam/config.json` with startCommand **including `$PORT` placeholder**
446
- - ✅ `environmentVariables` added to config (if required for startup)
458
+ - ✅ `environmentVariables` added to config (if needed for startup)
447
459
  - ✅ `codeyam test-startup --webappPath <path> --debug` passes for all SELECTED webapps
448
- - ✅ User knows how to use CodeYam (analyze, test)
460
+ - ✅ User knows how to use CodeYam (simulate, analyze, test)
449
461
 
450
462
  **CRITICAL:** The startCommand must include `$PORT` in the args (e.g., `["dev", "--port", "$PORT"]`) or env (e.g., `{"PORT": "$PORT"}`). Without this, CodeYam cannot start the server on the required port for capture.
451
-
452
- ## Wrap It Up
453
-
454
- - Always end by presenting the user with a basic overview of CodeYam
455
-
456
- ```
457
- CodeYam is set up!
458
-
459
- You can now:
460
-
461
- - Open the CodeYam dashboard: run `codeyam` or ask me to open it for you
462
- - Simulate any function or method in your project. Just ask me to `simulate [NAME OF FUNCTION OR METHOD]`
463
- - Ask me to test any function or method and I will be able to write tests more easily using the generated data structure CodeYam provides.
464
-
465
- To start how about simulating [FILE PATH AND ENTITY NAME OF SUGGESTED COMPONENT]?
466
-
467
- Do you want me to simulate that now?
468
- ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeyam/codeyam-cli",
3
- "version": "0.1.0-bleeding-edge.8afd3ee",
3
+ "version": "0.1.0-staging.1",
4
4
  "description": "Local development CLI for CodeYam analysis",
5
5
  "type": "module",
6
6
  "bin": {
@@ -93,98 +93,154 @@ export default async function generateChangesEntityKeyAttributes({ entity, exist
93
93
  llmCall,
94
94
  };
95
95
  }
96
- const FRONTEND_SYSTEM_MESSAGE = `You are updating the key attributes for a frontend component that was recently changed.
96
+ const FRONTEND_SYSTEM_MESSAGE = `We have a frontend function that was recently changed.
97
97
 
98
- 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.
98
+ 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?
99
99
 
100
- ## Stability Rules
100
+ 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.
101
101
 
102
- - REMOVE only if the attribute is clearly no longer used (variable deleted, conditional removed, no longer referenced)
103
- - KEEP marginal attributes—if unsure, preserve rather than remove
104
- - ADD new attributes freely when warranted
102
+ 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.
105
103
 
106
- ## What Makes a Key Attribute
104
+ 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.
107
105
 
108
- A key attribute is a data path from "Attributes and Value Types" that dramatically changes how the component renders:
106
+ 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.
109
107
 
110
- - Controls a conditional that shows/hides significant UI sections
111
- - Changes the component's primary visual state (not just minor text differences)
112
- - Determines which branch of rendering logic executes
108
+ ## Key Attribute Rules
113
109
 
114
- NOT key attributes:
115
- - Values that only affect non-visible behavior (hrefs, image srcs)
116
- - Fallback values that won't be used if primary values exist
117
- - Values that would cause errors if changed
110
+ - 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.
118
111
 
119
- 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.
112
+ ### Should be a key attribute
120
113
 
121
- ## Path Format
114
+ - 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).
122
115
 
123
- 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[]\`).
116
+ - 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).
124
117
 
125
- ## Response Format
118
+ ### Should NOT be a key attribute
126
119
 
127
- For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
120
+ - Changing the value of this variable will cause an error or exception to be thrown.
121
+
122
+ - Changing the value of this variable will cause a guard clause to be triggered that results in nothing being displayed.
123
+
124
+ - Changing the value of this variable will cause a minor change in display that is not significant (e.g. slightly different text).
125
+
126
+ - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
127
+
128
+ - The value changes non-visible behavior (e.g. the href in a link or src in an image - all images sources are mocked out).
129
+
130
+ ## Instructions
131
+
132
+ - 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?
133
+ - 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.
134
+ - 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.
135
+ - Return each key attribute with the following information:
136
+ - \`path\`: The path to the data attribute in the code
137
+ - \`description\`: A short description of the data attribute and how it is used in the code.
138
+ - \`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.
139
+ - Each attribute should reference exactly the path of a data attribute provided in the "Attributes and Value Types" section.
140
+
141
+ ## Response
142
+
143
+ Please respond by specifying which attributes need to be added or removed. For removed attributes just specify the path that is no longer valid.
128
144
 
129
145
  \`\`\`json
130
146
  {
131
147
  "addedKeyAttributes": [
132
148
  {
133
- "path": "user",
134
- "description": "Controls whether the main form or redirect screen displays",
135
- "validValueOptions": ["truthy user object", "null/undefined"]
136
- }
149
+ "path": "notification.read",
150
+ 'percentage": 50,
151
+ "description": "The read status of the notification determines how the message is displayed.",
152
+ "validValueOptions": [
153
+ "true",
154
+ "false"
155
+ ],
156
+ "errorValueOptions": []
157
+ },
137
158
  ],
138
- "removedKeyAttributes": ["oldAttribute.path"]
159
+ "removedKeyAttributes": [
160
+ "notification.message"
161
+ ]
139
162
  }
140
163
  \`\`\`
141
164
 
142
- Return empty arrays if no changes needed.
165
+ ## Important
166
+
167
+ - 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.
143
168
  `;
144
- const BACKEND_SYSTEM_MESSAGE = `You are updating the key attributes for a backend function that was recently changed.
169
+ const BACKEND_SYSTEM_MESSAGE = `We have a function that was recently changed.
170
+
171
+ 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?
172
+
173
+ 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
174
 
146
- 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.
175
+ 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?
147
176
 
148
- ## Stability Rules
177
+ 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.
149
178
 
150
- - REMOVE only if the attribute is clearly no longer used (variable deleted, conditional removed, no longer referenced)
151
- - KEEP marginal attributes—if unsure, preserve rather than remove
152
- - ADD new attributes freely when warranted
179
+ In order to do so we want to identify the key data attributes in the code.
153
180
 
154
- ## What Makes a Key Attribute
181
+ 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.
155
182
 
156
- A key attribute is a data path from "Attributes and Value Types" that dramatically changes the function's behavior:
183
+ 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.
157
184
 
158
- - Controls a conditional that significantly alters execution flow or return value
159
- - Determines which branch of logic executes
160
- - For side-effect functions: changes how external systems are called (database, email, etc.)
185
+ 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.
161
186
 
162
- NOT key attributes:
163
- - Fallback values that won't be used if primary values exist
164
- - Values that would cause errors if changed
165
- - Guard clauses that return nothing/minimal data
187
+ ## Key Attribute Rules
166
188
 
167
- ## Path Format
189
+ - 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.
168
190
 
169
- 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[]\`).
191
+ ### Should be a key attribute
170
192
 
171
- ## Response Format
193
+ - Changing the value, length (e.g. for strings or arrays), etc of this variable will dramatically impact the return value of the function.
172
194
 
173
- For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
195
+ - 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).
196
+
197
+ - 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.
198
+
199
+ ### Should NOT be a key attribute
200
+
201
+ - Changing the value of this variable will cause an error or exception to be thrown.
202
+
203
+ - Changing the value of this variable will cause a guard clause to be triggered that results in nothing or very little being returned.
204
+
205
+ - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
206
+
207
+ ## Instructions
208
+
209
+ - 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?
210
+ - 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.
211
+ - 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.
212
+ - Return each key attribute with the following information:
213
+ - \`path\`: The path to the data attribute in the code
214
+ - \`description\`: A short description of the data attribute and how it is used in the code.
215
+ - \`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.
216
+ - Each attribute should reference exactly the path of a data attribute provided in the "Attributes and Value Types" section.
217
+
218
+ ## Response
219
+
220
+ Please respond by specifying which attributes need to be added or removed. For removed attributes just specify the path that is no longer valid.
174
221
 
175
222
  \`\`\`json
176
223
  {
177
224
  "addedKeyAttributes": [
178
225
  {
179
- "path": "config.enabled",
180
- "description": "Controls whether the main processing logic runs",
181
- "validValueOptions": ["true", "false"]
182
- }
226
+ "path": "notification.read",
227
+ 'percentage": 50,
228
+ "description": "The read status of the notification determines how the message is displayed.",
229
+ "validValueOptions": [
230
+ "true",
231
+ "false"
232
+ ],
233
+ "errorValueOptions": []
234
+ },
183
235
  ],
184
- "removedKeyAttributes": ["oldAttribute.path"]
236
+ "removedKeyAttributes": [
237
+ "notification.message"
238
+ ]
185
239
  }
186
240
  \`\`\`
187
241
 
188
- Return empty arrays if no changes needed.
242
+ ## Important
243
+
244
+ - 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.
189
245
  `;
190
246
  //# sourceMappingURL=generateChangesEntityKeyAttributes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateChangesEntityKeyAttributes.js","sourceRoot":"","sources":["../../../../../../packages/ai/src/lib/generateChangesEntityKeyAttributes.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AAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtE,OAAO;QACL,aAAa,EAAE,yBAAyB;QACxC,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C/B,CAAC;AAEF,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C9B,CAAC"}
1
+ {"version":3,"file":"generateChangesEntityKeyAttributes.js","sourceRoot":"","sources":["../../../../../../packages/ai/src/lib/generateChangesEntityKeyAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,oCAAoC,MAAM,yDAAyD,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAM,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAU7E,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,kCAAkC,CAAC,EAC/D,MAAM,EACN,qBAAqB,EACrB,QAAQ,EACR,UAAU,EACV,KAAK,GACkC;IACvC,MAAM,CAAC,2CAA2C,EAAE;QAClD,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,UAAU,EAAE,MAAM,CAAC,IAAI;QACvB,UAAU,EAAE,QAAQ,CAAC,EAAE;QACvB,qBAAqB,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;KACzE,CAAC,CAAC;IAEH,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAA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AC,SAAS,CACnC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,YAAY,CACvC,CAAC;QACF,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,MAAM,yBAAyB,GAAG,aAAa;SAC5C,MAAM,CACL,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAC5B,IAAI,CAAC,SAAS,CACZ,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,KAAK,YAAY,CAAC,YAAY,CACtD,KAAK,KAAK,CACd;SACA,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtE,OAAO;QACL,aAAa,EAAE,yBAAyB;QACxC,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE/B,CAAC;AAEF,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4E9B,CAAC"}
@@ -106,77 +106,224 @@ export default async function generateEntityKeyAttributes({ entity, model, }) {
106
106
  llmCall,
107
107
  };
108
108
  }
109
- const FRONTEND_SYSTEM_MESSAGE = `You analyze frontend components to identify key data attributes that significantly impact rendering.
109
+ 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.
110
110
 
111
- ## What Makes a Key Attribute
111
+ 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.
112
112
 
113
- A key attribute is a data path from "Attributes and Value Types" that dramatically changes how the component renders:
113
+ 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?
114
114
 
115
- - Controls a conditional that shows/hides significant UI sections
116
- - Changes the component's primary visual state (not just minor text differences)
117
- - Determines which branch of rendering logic executes
115
+ 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?
118
116
 
119
- NOT key attributes:
120
- - Values that only affect non-visible behavior (hrefs, image srcs)
121
- - Fallback values that won't be used if primary values exist
122
- - Values that would cause errors if changed
123
- - Guard clauses that render literally nothing
117
+ 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.
124
118
 
125
- Note: A conditional that shows a different UI state (e.g., loading screen, redirect message) IS significant—include it.
119
+ 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.
126
120
 
127
- ## Path Format
121
+ 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.
128
122
 
129
- 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[]\`).
123
+ ## Key Attribute Rules
130
124
 
131
- ## Response Format
125
+ - 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.
132
126
 
133
- For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
127
+ ### Should be a key attribute
128
+
129
+ - 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).
130
+
131
+ - 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.
132
+
133
+ ### Should NOT be a key attribute
134
+
135
+ - Changing the value of this variable will cause an error or exception to be thrown.
136
+
137
+ - 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.
138
+
139
+ - Changing the value of this variable will cause a minor change in display that is not significant (e.g. slightly different text).
140
+
141
+ - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
142
+
143
+ - The value changes non-visible behavior (e.g. the href in a link or src in an image - all images sources are mocked out).
144
+
145
+ ## Instructions
146
+
147
+ - 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?
148
+ - 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.
149
+ - Return each key attribute with the following information:
150
+ - \`fullPath\`: The fullPath to the data attribute in the code
151
+ - \`description\`: A short description of the data attribute and how it is used in the code.
152
+ - \`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.
153
+ - 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).
154
+ - Each attribute should reference exactly the full fullPath of a data attribute provided in the "Attributes and Value Types" section.
155
+
156
+ ## Example
157
+
158
+ Given the following "Attributes and Value Types":
159
+ \`\`\`
160
+ 'notification.read': { fullPath: 'signature[0].notification.read', type: 'boolean' }
161
+ 'notification.message': { fullPath: 'signature[0].notification.message', type: 'string' }
162
+ \`\`\`
163
+
164
+ and code:
165
+
166
+ \`\`\`typescript
167
+ const NotificationText = (notification) => {
168
+ if (notification.read) {
169
+ return (
170
+ <span onClick={markAsRead(notification.id)}>
171
+ <img src={notification.icon} alt="Notification Icon" />
172
+ {notification.message}
173
+ </span>
174
+ );
175
+ } else {
176
+ return <strong>{notification.message}</strong>;
177
+ }
178
+ };
179
+ \`\`\`
180
+
181
+ The response might be:
134
182
 
135
183
  \`\`\`json
136
184
  {
137
185
  "keyAttributes": [
138
186
  {
139
- "fullPath": "signature[0].user",
140
- "description": "Controls whether the main form or redirect screen displays",
141
- "validValueOptions": ["truthy user object", "null/undefined"]
187
+ "fullPath": "signature[0].notification.read",
188
+ "description": "The read status of the notification determines how the message is displayed.",
189
+ "validValueOptions": [
190
+ "true",
191
+ "false"
192
+ ]
193
+ },
194
+ {
195
+ "fullPath": "signature[0].notification.message",
196
+ "description": "The message text is displayed and should be tested for various lengths.",
197
+ "validValueOptions": [
198
+ "An empty message (no characters)",
199
+ "A medium message (around 100 characters)",
200
+ "A long message (longer than 200 characters)"
201
+ ]
142
202
  }
143
203
  ]
144
204
  }
145
205
  \`\`\`
206
+
207
+ ## Important
208
+
209
+ - 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.
146
210
  `;
147
- const BACKEND_SYSTEM_MESSAGE = `You analyze backend functions to identify key data attributes that significantly impact behavior.
211
+ const BACKEND_SYSTEM_MESSAGE = `We have a function that we want to test in various ways by passing in appropriate data.
212
+
213
+ 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?
214
+
215
+ 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.
148
216
 
149
- ## What Makes a Key Attribute
217
+ 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?
150
218
 
151
- A key attribute is a data path from "Attributes and Value Types" that dramatically changes the function's behavior:
219
+ 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?
152
220
 
153
- - Controls a conditional that significantly alters execution flow or return value
154
- - Determines which branch of logic executes
155
- - For side-effect functions: changes how external systems are called (database, email, etc.)
221
+ 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.
156
222
 
157
- NOT key attributes:
158
- - Fallback values that won't be used if primary values exist
159
- - Values that would cause errors if changed
160
- - Guard clauses that return nothing/minimal data
223
+ 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.
161
224
 
162
- ## Path Format
225
+ 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.
163
226
 
164
- 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[]\`).
227
+ ## Key Attribute Rules
165
228
 
166
- ## Response Format
229
+ - 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.
167
230
 
168
- For \`validValueOptions\`, include boundary/extreme values that trigger different behavior—but NOT values that would cause errors.
231
+ ### Should be a key attribute
232
+
233
+ - Changing the value, length (e.g. for strings or arrays), etc of this variable will dramatically impact the return value of the function.
234
+
235
+ - 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).
236
+
237
+ - 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.
238
+
239
+ ### Should NOT be a key attribute
240
+
241
+ - Changing the value of this variable will cause an error or exception to be thrown.
242
+
243
+ - Changing the value of this variable will cause a guard clause to be triggered that results in nothing or very little being returned.
244
+
245
+ - The value is used as a fallback or alternative for another value and won't even be used if the other value is present.
246
+
247
+ ## Instructions
248
+
249
+ - 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?
250
+ - 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.
251
+ - Return each key attribute with the following information:
252
+ - \`fullPath\`: The fullPath to the data attribute in the code
253
+ - \`description\`: A short description of the data attribute and how it is used in the code.
254
+ - \`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.
255
+ - 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).
256
+ - Each attribute should reference exactly the fullPath of a data attribute provided in the "Attributes and Value Types" section.
257
+
258
+ ## Example
259
+
260
+ Given the following "Attributes and Value Types":
261
+ \`\`\`
262
+ [
263
+ items[].quantity: { fullPath: 'signature[0][].quantity', type: 'number' },
264
+ items[].price: { fullPath: 'signature[0][].price', type: 'number' },
265
+ discount: { fullPath: 'signature[1]', type: 'number' },
266
+ taxRate: { fullPath: 'signature[2]', type: 'number' },
267
+ ]
268
+ \`\`\`
269
+
270
+ and code:
271
+
272
+ \`\`\`typescript
273
+ const calculateTotal = (items, discount, taxRate) => {
274
+ const subtotal = items.reduce((sum, item) => sum + item.quantity * item.price, 0);
275
+ const discountedTotal = subtotal - discount;
276
+ const tax = discountedTotal * taxRate;
277
+ return discountedTotal + tax;
278
+ }
279
+ \`\`\`
280
+
281
+ The response might be:
169
282
 
170
283
  \`\`\`json
171
284
  {
172
285
  "keyAttributes": [
173
286
  {
174
- "fullPath": "signature[0].config.enabled",
175
- "description": "Controls whether the main processing logic runs",
176
- "validValueOptions": ["true", "false"]
287
+ "fullPath": "signature[0][].quantity",
288
+ "description": "The quantity of each item affects the subtotal calculation.",
289
+ "validValueOptions": [
290
+ "0 (no items)",
291
+ "1 (single item)",
292
+ "5 (multiple items)",
293
+ "100 (large quantity)"
294
+ ]
295
+ },
296
+ {
297
+ "fullPath": "signature[0][].price",
298
+ "description": "The price of each item affects the subtotal calculation.",
299
+ "validValueOptions": [
300
+ "0.00 (free item)",
301
+ "19.99 (average price)",
302
+ "999.99 (high price)"
303
+ ]
304
+ },
305
+ {
306
+ "fullPath": "signature[1]",
307
+ "description": "The discount amount directly reduces the subtotal.",
308
+ "validValueOptions": [
309
+ "0 (no discount)",
310
+ "20.00 (discount)"
311
+ ]
312
+ },
313
+ {
314
+ "fullPath": "signature[2]",
315
+ "description": "The tax rate affects the final total calculation.",
316
+ "validValueOptions": [
317
+ "0 (no tax)",
318
+ "0.20 (20% tax)"
319
+ ]
177
320
  }
178
321
  ]
179
322
  }
180
323
  \`\`\`
324
+
325
+ ## Important
326
+
327
+ - 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.
181
328
  `;
182
329
  //# sourceMappingURL=generateEntityKeyAttributes.js.map