data-adjust.json 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. {
  2. "version": "3.16",
  3. "name": "DataAdjust",
  4. "description": "Add or modify database fields/tables with automatic cascade through services and sections. Handles: add field, remove field, add table, change field type, add enum value.",
  5. "sectionMerge": true,
  6. "registry": {
  7. "params": [
  8. "dataRequest(STRING)",
  9. "currentMeta(OBJECT)"
  10. ],
  11. "services": [],
  12. "apis": [],
  13. "components": [],
  14. "vars": [
  15. "$dataPlan(OBJECT)",
  16. "$dbChanges(ARRAY)",
  17. "$cascadeServices(ARRAY)",
  18. "$cascadeSections(ARRAY)",
  19. "$updatedMeta(OBJECT)"
  20. ],
  21. "files": {
  22. "inputs": [
  23. ".vl-code/ProjectMeta.json",
  24. "Database/*",
  25. "Services/*",
  26. "Sections/*"
  27. ],
  28. "artifacts": [
  29. ".vl-code/ProjectMeta.json",
  30. "Database/*",
  31. "Services/*",
  32. "Sections/*"
  33. ]
  34. },
  35. "docs": {
  36. "1": "VL 3.7 Syntax Rules"
  37. }
  38. },
  39. "steps": [
  40. {
  41. "id": "LLM_010_PlanDataChange",
  42. "meta": {
  43. "title": "1. Analyze data model change and plan cascade"
  44. },
  45. "in": {
  46. "docs": [
  47. "1"
  48. ],
  49. "max_tokens": 32768,
  50. "messages": [
  51. {
  52. "role": "user",
  53. "content": "You are a VL data architect. Analyze the requested data model change and determine the full cascade impact.\n\nCurrent ProjectMeta:"
  54. },
  55. {
  56. "role": "user",
  57. "content": "=currentMeta"
  58. },
  59. {
  60. "role": "user",
  61. "content": "Data change request:"
  62. },
  63. {
  64. "role": "user",
  65. "content": "=dataRequest"
  66. },
  67. {
  68. "role": "user",
  69. "content": "Return JSON with:\n- summary: one-line description\n- dbChanges: [{table, action(\"addField\"|\"removeField\"|\"addTable\"|\"changeType\"|\"addEnum\"), details: object}]\n- cascadeServices: [{name, file, changes: string}] — services affected by the data change\n- cascadeSections: [{name, file, changes: string}] — sections that use affected data and need UI updates\n- updatedMeta: FULL updated ProjectMeta\n\nTrace the cascade: DB change → affected SERVICE queries/methods → affected SECTION bindings/events/layout"
  70. }
  71. ],
  72. "output_config": {
  73. "format": {
  74. "type": "json_object"
  75. }
  76. },
  77. "stream": true
  78. },
  79. "out": {
  80. "$dataPlan": "=_result",
  81. "$dbChanges": "=_result.dbChanges",
  82. "$cascadeServices": "=_result.cascadeServices",
  83. "$cascadeSections": "=_result.cascadeSections",
  84. "$updatedMeta": "=_result.updatedMeta"
  85. },
  86. "next": "Pause_020_ReviewPlan"
  87. },
  88. {
  89. "id": "Pause_020_ReviewPlan",
  90. "meta": {
  91. "title": "2. Review data change plan (developer checkpoint)"
  92. },
  93. "resumeResultTarget": "$approved",
  94. "next": "Branch_025_CheckApproval"
  95. },
  96. {
  97. "id": "Branch_025_CheckApproval",
  98. "meta": {
  99. "title": "Check approval"
  100. },
  101. "cases": [
  102. {
  103. "condition": "=$approved === false",
  104. "next": "Stop_Cancelled"
  105. }
  106. ],
  107. "default": "LLM_030_EditDatabase"
  108. },
  109. {
  110. "id": "LLM_030_EditDatabase",
  111. "meta": {
  112. "title": "3. Apply database schema changes"
  113. },
  114. "in": {
  115. "docs": [
  116. "1"
  117. ],
  118. "max_tokens": 32768,
  119. "stream": true,
  120. "messages": [
  121. {
  122. "role": "user",
  123. "content": "Apply the following database changes to the VL .vdb file.\n\nCurrent database from ProjectMeta:"
  124. },
  125. {
  126. "role": "user",
  127. "content": "=currentMeta.database"
  128. },
  129. {
  130. "role": "user",
  131. "content": "Changes to apply:"
  132. },
  133. {
  134. "role": "user",
  135. "content": "=$dbChanges"
  136. },
  137. {
  138. "role": "user",
  139. "content": "Output the COMPLETE updated .vdb file in VL 3.7 syntax. Preserve all existing tables/fields not being changed.\n\nIMPORTANT: The file MUST start with '// VL_VERSION:3.7' as the first non-empty line."
  140. }
  141. ]
  142. },
  143. "out": {
  144. "/{currentMeta.database.file || ('Database/' + currentMeta.projectName + '.vdb')}": "=_result"
  145. },
  146. "next": "Fork_040_Cascade"
  147. },
  148. {
  149. "id": "Fork_040_Cascade",
  150. "meta": {
  151. "title": "4. Cascade changes to services and sections (parallel)"
  152. },
  153. "children": [
  154. "Loop_050_CascadeServices",
  155. "Loop_060_CascadeSections"
  156. ],
  157. "next": "Set_070_UpdateMeta"
  158. },
  159. {
  160. "id": "Loop_050_CascadeServices",
  161. "meta": {
  162. "title": "4a. Update affected services"
  163. },
  164. "source": "=$cascadeServices",
  165. "mode": "serial",
  166. "children": [
  167. "LLM_051_EditService"
  168. ],
  169. "next": "RETURN"
  170. },
  171. {
  172. "id": "LLM_051_EditService",
  173. "meta": {
  174. "title": "Update service: =_item.name"
  175. },
  176. "in": {
  177. "docs": [
  178. "1"
  179. ],
  180. "max_tokens": 32768,
  181. "stream": true,
  182. "readFiles": [
  183. "=_item.file"
  184. ],
  185. "messages": [
  186. {
  187. "role": "user",
  188. "content": "Update this VL service file to reflect database changes.\n\nChanges needed:"
  189. },
  190. {
  191. "role": "user",
  192. "content": "=_item.changes"
  193. },
  194. {
  195. "role": "user",
  196. "content": "Output the COMPLETE updated .vs file. Preserve all existing methods. Add/modify only what's needed for the data change.\n\nIMPORTANT: The file MUST start with '// VL_VERSION:3.7' as the first non-empty line."
  197. }
  198. ]
  199. },
  200. "out": {
  201. "/{_item.file}": "=_result"
  202. },
  203. "onError": "retry",
  204. "retryCount": 1
  205. },
  206. {
  207. "id": "Loop_060_CascadeSections",
  208. "meta": {
  209. "title": "4b. Update affected sections"
  210. },
  211. "source": "=$cascadeSections",
  212. "mode": "serial",
  213. "children": [
  214. "LLM_061_EditSection"
  215. ],
  216. "next": "RETURN"
  217. },
  218. {
  219. "id": "LLM_061_EditSection",
  220. "meta": {
  221. "title": "Update section: =_item.name"
  222. },
  223. "in": {
  224. "docs": [
  225. "1"
  226. ],
  227. "max_tokens": 32768,
  228. "stream": true,
  229. "readFiles": [
  230. "=_item.file"
  231. ],
  232. "messages": [
  233. {
  234. "role": "user",
  235. "content": "Update this VL section file to reflect data model changes.\n\nChanges needed:"
  236. },
  237. {
  238. "role": "user",
  239. "content": "=_item.changes"
  240. },
  241. {
  242. "role": "user",
  243. "content": "Output the COMPLETE updated .sc file. Preserve ALL existing elements. Only modify what's needed for the data change.\n\nIMPORTANT: The file MUST start with '// VL_VERSION:3.7' as the first non-empty line."
  244. }
  245. ]
  246. },
  247. "out": {
  248. "/{_item.file}": "=_result"
  249. },
  250. "onError": "retry",
  251. "retryCount": 1
  252. },
  253. {
  254. "id": "Set_070_UpdateMeta",
  255. "meta": {
  256. "title": "5. Update ProjectMeta"
  257. },
  258. "in": {},
  259. "out": {
  260. "/.vl-code/ProjectMeta.json": "=$updatedMeta"
  261. },
  262. "next": "Stop_Done"
  263. },
  264. {
  265. "id": "Stop_Done",
  266. "meta": {
  267. "title": "Data model adjustment complete — cascade applied"
  268. }
  269. },
  270. {
  271. "id": "Stop_Cancelled",
  272. "meta": {
  273. "title": "Data adjustment cancelled by developer"
  274. }
  275. }
  276. ]
  277. }