lua-cli 3.5.0-alpha.3 โ†’ 3.5.0-beta.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 (465) hide show
  1. package/README.md +137 -689
  2. package/dist/api/agent.api.service.d.ts +1 -8
  3. package/dist/api/agent.api.service.js +1 -11
  4. package/dist/api/agent.api.service.js.map +1 -1
  5. package/dist/api/auth.api.service.d.ts +1 -1
  6. package/dist/api/auth.api.service.js +1 -1
  7. package/dist/api/auth.api.service.js.map +1 -1
  8. package/dist/api/backup.api.service.d.ts +80 -0
  9. package/dist/api/backup.api.service.js +101 -0
  10. package/dist/api/backup.api.service.js.map +1 -0
  11. package/dist/api/basket.api.service.d.ts +4 -5
  12. package/dist/api/basket.api.service.js +13 -18
  13. package/dist/api/basket.api.service.js.map +1 -1
  14. package/dist/api/cdn.api.service.d.ts +2 -0
  15. package/dist/api/cdn.api.service.js +2 -0
  16. package/dist/api/cdn.api.service.js.map +1 -1
  17. package/dist/api/chat.api.service.d.ts +10 -2
  18. package/dist/api/chat.api.service.js +21 -2
  19. package/dist/api/chat.api.service.js.map +1 -1
  20. package/dist/api/credentials.js +5 -8
  21. package/dist/api/credentials.js.map +1 -1
  22. package/dist/api/custom.data.api.service.d.ts +3 -3
  23. package/dist/api/custom.data.api.service.js +9 -10
  24. package/dist/api/custom.data.api.service.js.map +1 -1
  25. package/dist/api/developer.api.service.d.ts +1 -1
  26. package/dist/api/developer.api.service.js +1 -1
  27. package/dist/api/developer.api.service.js.map +1 -1
  28. package/dist/api/http.client.js.map +1 -0
  29. package/dist/api/job.api.service.d.ts +2 -2
  30. package/dist/api/job.api.service.js +2 -2
  31. package/dist/api/job.api.service.js.map +1 -1
  32. package/dist/api/logs.api.service.d.ts +1 -1
  33. package/dist/api/logs.api.service.js +1 -1
  34. package/dist/api/logs.api.service.js.map +1 -1
  35. package/dist/api/marketplace.api.service.d.ts +6 -6
  36. package/dist/api/marketplace.api.service.js.map +1 -1
  37. package/dist/api/order.api.service.d.ts +3 -4
  38. package/dist/api/order.api.service.js +8 -10
  39. package/dist/api/order.api.service.js.map +1 -1
  40. package/dist/api/persona.api.service.d.ts +1 -1
  41. package/dist/api/persona.api.service.js +1 -1
  42. package/dist/api/persona.api.service.js.map +1 -1
  43. package/dist/api/postprocessor.api.service.d.ts +1 -1
  44. package/dist/api/postprocessor.api.service.js +1 -1
  45. package/dist/api/postprocessor.api.service.js.map +1 -1
  46. package/dist/api/preprocessor.api.service.d.ts +1 -1
  47. package/dist/api/preprocessor.api.service.js +1 -1
  48. package/dist/api/preprocessor.api.service.js.map +1 -1
  49. package/dist/api/products.api.service.d.ts +4 -4
  50. package/dist/api/products.api.service.js +6 -6
  51. package/dist/api/products.api.service.js.map +1 -1
  52. package/dist/api/resource.api.service.d.ts +76 -0
  53. package/dist/api/resource.api.service.js +74 -0
  54. package/dist/api/resource.api.service.js.map +1 -0
  55. package/dist/api/skills.api.service.d.ts +7 -15
  56. package/dist/api/skills.api.service.js +1 -1
  57. package/dist/api/skills.api.service.js.map +1 -1
  58. package/dist/api/tool.api.service.d.ts +1 -1
  59. package/dist/api/tool.api.service.js +1 -1
  60. package/dist/api/tool.api.service.js.map +1 -1
  61. package/dist/api/unifiedto.api.service.d.ts +1 -1
  62. package/dist/api/unifiedto.api.service.js +1 -1
  63. package/dist/api/unifiedto.api.service.js.map +1 -1
  64. package/dist/api/user.data.api.service.d.ts +7 -8
  65. package/dist/api/user.data.api.service.js +2 -3
  66. package/dist/api/user.data.api.service.js.map +1 -1
  67. package/dist/api/webhook.api.service.d.ts +1 -1
  68. package/dist/api/webhook.api.service.js +1 -1
  69. package/dist/api/webhook.api.service.js.map +1 -1
  70. package/dist/api/whatsapp-templates.api.service.d.ts +1 -1
  71. package/dist/api/whatsapp-templates.api.service.js +1 -1
  72. package/dist/api/whatsapp-templates.api.service.js.map +1 -1
  73. package/dist/api-exports.d.ts +14 -12
  74. package/dist/api-exports.js +8 -8
  75. package/dist/api-exports.js.map +1 -1
  76. package/dist/cli/command-definitions.js +32 -17
  77. package/dist/cli/command-definitions.js.map +1 -1
  78. package/dist/commands/admin.js +3 -24
  79. package/dist/commands/admin.js.map +1 -1
  80. package/dist/commands/agents.d.ts +8 -7
  81. package/dist/commands/agents.js +63 -21
  82. package/dist/commands/agents.js.map +1 -1
  83. package/dist/commands/channels.js +11 -23
  84. package/dist/commands/channels.js.map +1 -1
  85. package/dist/commands/chat.js +33 -47
  86. package/dist/commands/chat.js.map +1 -1
  87. package/dist/commands/chatClear.js +11 -41
  88. package/dist/commands/chatClear.js.map +1 -1
  89. package/dist/commands/compile.d.ts +26 -23
  90. package/dist/commands/compile.js +98 -403
  91. package/dist/commands/compile.js.map +1 -1
  92. package/dist/commands/completion.js +1 -1
  93. package/dist/commands/completion.js.map +1 -1
  94. package/dist/commands/deploy.js +55 -25
  95. package/dist/commands/deploy.js.map +1 -1
  96. package/dist/commands/dev.js +29 -45
  97. package/dist/commands/dev.js.map +1 -1
  98. package/dist/commands/env.js +12 -25
  99. package/dist/commands/env.js.map +1 -1
  100. package/dist/commands/evals.js +3 -20
  101. package/dist/commands/evals.js.map +1 -1
  102. package/dist/commands/features.js +10 -23
  103. package/dist/commands/features.js.map +1 -1
  104. package/dist/commands/index.d.ts +1 -0
  105. package/dist/commands/index.js +1 -0
  106. package/dist/commands/index.js.map +1 -1
  107. package/dist/commands/init.d.ts +1 -0
  108. package/dist/commands/init.js +135 -19
  109. package/dist/commands/init.js.map +1 -1
  110. package/dist/commands/integrations.js +26 -37
  111. package/dist/commands/integrations.js.map +1 -1
  112. package/dist/commands/jobs.js +32 -56
  113. package/dist/commands/jobs.js.map +1 -1
  114. package/dist/commands/logs.js +9 -20
  115. package/dist/commands/logs.js.map +1 -1
  116. package/dist/commands/marketplace.js +34 -52
  117. package/dist/commands/marketplace.js.map +1 -1
  118. package/dist/commands/mcp.js +10 -23
  119. package/dist/commands/mcp.js.map +1 -1
  120. package/dist/commands/persona.js +43 -74
  121. package/dist/commands/persona.js.map +1 -1
  122. package/dist/commands/postprocessors.js +15 -28
  123. package/dist/commands/postprocessors.js.map +1 -1
  124. package/dist/commands/preprocessors.js +15 -28
  125. package/dist/commands/preprocessors.js.map +1 -1
  126. package/dist/commands/production.js +30 -63
  127. package/dist/commands/production.js.map +1 -1
  128. package/dist/commands/push.js +294 -1241
  129. package/dist/commands/push.js.map +1 -1
  130. package/dist/commands/pushBackup.d.ts +22 -0
  131. package/dist/commands/pushBackup.js +133 -0
  132. package/dist/commands/pushBackup.js.map +1 -0
  133. package/dist/commands/resources.js +29 -72
  134. package/dist/commands/resources.js.map +1 -1
  135. package/dist/commands/skills.d.ts +1 -1
  136. package/dist/commands/skills.js +58 -70
  137. package/dist/commands/skills.js.map +1 -1
  138. package/dist/commands/sync.d.ts +1 -3
  139. package/dist/commands/sync.js +12 -24
  140. package/dist/commands/sync.js.map +1 -1
  141. package/dist/commands/test.js +135 -104
  142. package/dist/commands/test.js.map +1 -1
  143. package/dist/commands/webhooks.js +15 -28
  144. package/dist/commands/webhooks.js.map +1 -1
  145. package/dist/compiler/agent-traverser.d.ts +104 -0
  146. package/dist/compiler/agent-traverser.js +311 -0
  147. package/dist/compiler/agent-traverser.js.map +1 -0
  148. package/dist/compiler/bundler.d.ts +42 -0
  149. package/dist/compiler/bundler.js +187 -0
  150. package/dist/compiler/bundler.js.map +1 -0
  151. package/dist/compiler/compiler.d.ts +177 -0
  152. package/dist/compiler/compiler.js +580 -0
  153. package/dist/compiler/compiler.js.map +1 -0
  154. package/dist/compiler/index.d.ts +36 -0
  155. package/dist/compiler/index.js +42 -0
  156. package/dist/compiler/index.js.map +1 -0
  157. package/dist/compiler/plugins/base.d.ts +264 -0
  158. package/dist/compiler/plugins/base.js +307 -0
  159. package/dist/compiler/plugins/base.js.map +1 -0
  160. package/dist/compiler/plugins/job.plugin.d.ts +33 -0
  161. package/dist/compiler/plugins/job.plugin.js +143 -0
  162. package/dist/compiler/plugins/job.plugin.js.map +1 -0
  163. package/dist/compiler/plugins/mcp-server.plugin.d.ts +50 -0
  164. package/dist/compiler/plugins/mcp-server.plugin.js +186 -0
  165. package/dist/compiler/plugins/mcp-server.plugin.js.map +1 -0
  166. package/dist/compiler/plugins/postprocessor.plugin.d.ts +20 -0
  167. package/dist/compiler/plugins/postprocessor.plugin.js +39 -0
  168. package/dist/compiler/plugins/postprocessor.plugin.js.map +1 -0
  169. package/dist/compiler/plugins/preprocessor.plugin.d.ts +20 -0
  170. package/dist/compiler/plugins/preprocessor.plugin.js +48 -0
  171. package/dist/compiler/plugins/preprocessor.plugin.js.map +1 -0
  172. package/dist/compiler/plugins/processor-base.d.ts +16 -0
  173. package/dist/compiler/plugins/processor-base.js +34 -0
  174. package/dist/compiler/plugins/processor-base.js.map +1 -0
  175. package/dist/compiler/plugins/registry.d.ts +61 -0
  176. package/dist/compiler/plugins/registry.js +107 -0
  177. package/dist/compiler/plugins/registry.js.map +1 -0
  178. package/dist/compiler/plugins/skill.plugin.d.ts +71 -0
  179. package/dist/compiler/plugins/skill.plugin.js +243 -0
  180. package/dist/compiler/plugins/skill.plugin.js.map +1 -0
  181. package/dist/compiler/plugins/tool.plugin.d.ts +67 -0
  182. package/dist/compiler/plugins/tool.plugin.js +279 -0
  183. package/dist/compiler/plugins/tool.plugin.js.map +1 -0
  184. package/dist/compiler/plugins/webhook.plugin.d.ts +37 -0
  185. package/dist/compiler/plugins/webhook.plugin.js +127 -0
  186. package/dist/compiler/plugins/webhook.plugin.js.map +1 -0
  187. package/dist/compiler/source-writer.d.ts +98 -0
  188. package/dist/compiler/source-writer.js +223 -0
  189. package/dist/compiler/source-writer.js.map +1 -0
  190. package/dist/compiler/types.d.ts +289 -0
  191. package/dist/compiler/types.js +20 -0
  192. package/dist/compiler/types.js.map +1 -0
  193. package/dist/compiler/utils/ast-helpers.d.ts +57 -0
  194. package/dist/compiler/utils/ast-helpers.js +164 -0
  195. package/dist/compiler/utils/ast-helpers.js.map +1 -0
  196. package/dist/compiler/utils/common.d.ts +23 -0
  197. package/dist/compiler/utils/common.js +66 -0
  198. package/dist/compiler/utils/common.js.map +1 -0
  199. package/dist/compiler/utils/file-discovery.d.ts +34 -0
  200. package/dist/compiler/utils/file-discovery.js +68 -0
  201. package/dist/compiler/utils/file-discovery.js.map +1 -0
  202. package/dist/compiler/utils/path-resolver.d.ts +25 -0
  203. package/dist/compiler/utils/path-resolver.js +66 -0
  204. package/dist/compiler/utils/path-resolver.js.map +1 -0
  205. package/dist/compiler/utils/schema-converter.d.ts +26 -0
  206. package/dist/compiler/utils/schema-converter.js +94 -0
  207. package/dist/compiler/utils/schema-converter.js.map +1 -0
  208. package/dist/config/compile.constants.d.ts +2 -22
  209. package/dist/config/compile.constants.js +2 -49
  210. package/dist/config/compile.constants.js.map +1 -1
  211. package/dist/config/constants.d.ts +18 -2
  212. package/dist/config/constants.js +28 -8
  213. package/dist/config/constants.js.map +1 -1
  214. package/dist/config/dev.constants.d.ts +0 -10
  215. package/dist/config/dev.constants.js +0 -10
  216. package/dist/config/dev.constants.js.map +1 -1
  217. package/dist/index.js +7 -0
  218. package/dist/index.js.map +1 -1
  219. package/dist/instances/basket.instance.js.map +1 -0
  220. package/dist/instances/data.entry.instance.js.map +1 -0
  221. package/dist/instances/job.instance.js.map +1 -0
  222. package/dist/instances/order.instance.js.map +1 -0
  223. package/dist/instances/product.instance.js.map +1 -0
  224. package/dist/instances/product.pagination.instance.js.map +1 -0
  225. package/dist/instances/product.search.instance.js.map +1 -0
  226. package/dist/instances/user.instance.js.map +1 -0
  227. package/dist/interfaces/admin.d.ts +0 -38
  228. package/dist/interfaces/backup.d.ts +125 -0
  229. package/dist/interfaces/backup.js +8 -0
  230. package/dist/interfaces/backup.js.map +1 -0
  231. package/dist/interfaces/baskets.d.ts +0 -56
  232. package/dist/interfaces/common.d.ts +1 -0
  233. package/dist/interfaces/deploy.d.ts +0 -15
  234. package/dist/interfaces/index.d.ts +1 -1
  235. package/dist/interfaces/marketplace.d.ts +51 -0
  236. package/dist/interfaces/marketplace.js +1 -1
  237. package/dist/interfaces/marketplace.js.map +1 -1
  238. package/dist/interfaces/message.d.ts +0 -3
  239. package/dist/interfaces/orders.d.ts +0 -24
  240. package/dist/interfaces/postprocessors.d.ts +0 -18
  241. package/dist/interfaces/preprocessors.d.ts +0 -18
  242. package/dist/interfaces/skills.d.ts +61 -0
  243. package/dist/interfaces/user.d.ts +25 -0
  244. package/dist/interfaces/webhooks.d.ts +0 -9
  245. package/dist/primitives/base.handler.d.ts +106 -0
  246. package/dist/primitives/base.handler.js +370 -0
  247. package/dist/primitives/base.handler.js.map +1 -0
  248. package/dist/primitives/index.d.ts +47 -0
  249. package/dist/primitives/index.js +78 -0
  250. package/dist/primitives/index.js.map +1 -0
  251. package/dist/primitives/job.handler.d.ts +52 -0
  252. package/dist/primitives/job.handler.js +118 -0
  253. package/dist/primitives/job.handler.js.map +1 -0
  254. package/dist/primitives/mcp-server.handler.d.ts +54 -0
  255. package/dist/primitives/mcp-server.handler.js +91 -0
  256. package/dist/primitives/mcp-server.handler.js.map +1 -0
  257. package/dist/primitives/postprocessor.handler.d.ts +49 -0
  258. package/dist/primitives/postprocessor.handler.js +81 -0
  259. package/dist/primitives/postprocessor.handler.js.map +1 -0
  260. package/dist/primitives/preprocessor.handler.d.ts +54 -0
  261. package/dist/primitives/preprocessor.handler.js +95 -0
  262. package/dist/primitives/preprocessor.handler.js.map +1 -0
  263. package/dist/primitives/skill.handler.d.ts +44 -0
  264. package/dist/primitives/skill.handler.js +192 -0
  265. package/dist/primitives/skill.handler.js.map +1 -0
  266. package/dist/primitives/types.d.ts +72 -0
  267. package/dist/primitives/types.js +17 -0
  268. package/dist/primitives/types.js.map +1 -0
  269. package/dist/primitives/webhook.handler.d.ts +50 -0
  270. package/dist/primitives/webhook.handler.js +96 -0
  271. package/dist/primitives/webhook.handler.js.map +1 -0
  272. package/dist/services/auth.js +1 -2
  273. package/dist/services/auth.js.map +1 -1
  274. package/dist/services/sandbox.service.d.ts +103 -0
  275. package/dist/services/sandbox.service.js +479 -0
  276. package/dist/services/sandbox.service.js.map +1 -0
  277. package/dist/types/api-contracts.d.ts +1 -1
  278. package/dist/types/index.d.ts +2 -1
  279. package/dist/types/index.js.map +1 -1
  280. package/dist/types/skill.d.ts +8 -2
  281. package/dist/types/skill.js +8 -0
  282. package/dist/types/skill.js.map +1 -1
  283. package/dist/types/yaml.types.d.ts +69 -0
  284. package/dist/types/yaml.types.js +6 -0
  285. package/dist/types/yaml.types.js.map +1 -0
  286. package/dist/utils/artifact-loader.d.ts +108 -0
  287. package/dist/utils/artifact-loader.js +188 -0
  288. package/dist/utils/artifact-loader.js.map +1 -0
  289. package/dist/utils/backup-helpers.d.ts +122 -0
  290. package/dist/utils/backup-helpers.js +274 -0
  291. package/dist/utils/backup-helpers.js.map +1 -0
  292. package/dist/utils/cli.d.ts +8 -0
  293. package/dist/utils/cli.js +19 -2
  294. package/dist/utils/cli.js.map +1 -1
  295. package/dist/utils/command-utils.d.ts +42 -0
  296. package/dist/utils/command-utils.js +83 -0
  297. package/dist/utils/command-utils.js.map +1 -0
  298. package/dist/utils/deploy-helpers.d.ts +0 -29
  299. package/dist/utils/deploy-helpers.js +0 -70
  300. package/dist/utils/deploy-helpers.js.map +1 -1
  301. package/dist/utils/dev-api.d.ts +3 -99
  302. package/dist/utils/dev-api.js +3 -430
  303. package/dist/utils/dev-api.js.map +1 -1
  304. package/dist/utils/dev-server.d.ts +3 -1
  305. package/dist/utils/dev-server.js +69 -145
  306. package/dist/utils/dev-server.js.map +1 -1
  307. package/dist/utils/dev-watcher.d.ts +0 -1
  308. package/dist/utils/dev-watcher.js +23 -8
  309. package/dist/utils/dev-watcher.js.map +1 -1
  310. package/dist/utils/env-loader.utils.d.ts +10 -1
  311. package/dist/utils/env-loader.utils.js +39 -31
  312. package/dist/utils/env-loader.utils.js.map +1 -1
  313. package/dist/utils/files.d.ts +47 -3
  314. package/dist/utils/files.js +98 -40
  315. package/dist/utils/files.js.map +1 -1
  316. package/dist/utils/init-agent.js +1 -2
  317. package/dist/utils/init-agent.js.map +1 -1
  318. package/dist/utils/init-helpers.d.ts +2 -10
  319. package/dist/utils/init-helpers.js +9 -17
  320. package/dist/utils/init-helpers.js.map +1 -1
  321. package/dist/utils/init-prompts.d.ts +0 -8
  322. package/dist/utils/init-prompts.js +0 -22
  323. package/dist/utils/init-prompts.js.map +1 -1
  324. package/dist/utils/prompt-handler.d.ts +3 -0
  325. package/dist/utils/prompt-handler.js +13 -0
  326. package/dist/utils/prompt-handler.js.map +1 -1
  327. package/dist/utils/sandbox-storage.d.ts +6 -5
  328. package/dist/utils/sandbox-storage.js +12 -12
  329. package/dist/utils/sandbox-storage.js.map +1 -1
  330. package/dist/utils/sandbox.d.ts +7 -30
  331. package/dist/utils/sandbox.js +247 -223
  332. package/dist/utils/sandbox.js.map +1 -1
  333. package/dist/utils/semver.d.ts +12 -0
  334. package/dist/utils/semver.js +23 -0
  335. package/dist/utils/semver.js.map +1 -1
  336. package/dist/utils/sync-display.d.ts +9 -0
  337. package/dist/utils/sync-display.js +67 -0
  338. package/dist/utils/sync-display.js.map +1 -0
  339. package/dist/utils/sync-fetch.d.ts +23 -0
  340. package/dist/utils/sync-fetch.js +64 -0
  341. package/dist/utils/sync-fetch.js.map +1 -0
  342. package/dist/utils/sync-helpers.d.ts +4 -59
  343. package/dist/utils/sync-helpers.js +4 -206
  344. package/dist/utils/sync-helpers.js.map +1 -1
  345. package/dist/web/app.css +912 -186
  346. package/dist/web/app.js +46 -46
  347. package/docs/API_INDEX.md +100 -0
  348. package/docs/API_REFERENCE.md +773 -0
  349. package/docs/CLI_REFERENCE.md +924 -0
  350. package/docs/GETTING_STARTED.md +862 -0
  351. package/docs/README.md +270 -0
  352. package/docs/api/AI.md +882 -0
  353. package/docs/api/Baskets.md +511 -0
  354. package/docs/api/CDN.md +524 -0
  355. package/docs/api/Data.md +446 -0
  356. package/docs/api/Jobs.md +524 -0
  357. package/docs/api/LuaAgent.md +454 -0
  358. package/docs/api/LuaJob.md +604 -0
  359. package/docs/api/LuaSkill.md +396 -0
  360. package/docs/api/LuaTool.md +521 -0
  361. package/docs/api/LuaWebhook.md +601 -0
  362. package/docs/api/Orders.md +514 -0
  363. package/docs/api/PostProcessor.md +565 -0
  364. package/docs/api/PreProcessor.md +630 -0
  365. package/docs/api/Products.md +507 -0
  366. package/docs/api/Templates.md +662 -0
  367. package/docs/api/User.md +567 -0
  368. package/docs/archive/DEVELOPMENT_GUIDE_V1.md +1294 -0
  369. package/docs/compiler-v2/ASSESSMENT.md +205 -0
  370. package/docs/compiler-v2/TEST_PLAN.md +306 -0
  371. package/package.json +3 -7
  372. package/template/tsconfig.json +1 -1
  373. package/dist/common/basket.instance.js.map +0 -1
  374. package/dist/common/data.entry.instance.js.map +0 -1
  375. package/dist/common/http.client.js.map +0 -1
  376. package/dist/common/job.instance.js.map +0 -1
  377. package/dist/common/order.instance.js.map +0 -1
  378. package/dist/common/product.instance.js.map +0 -1
  379. package/dist/common/product.pagination.instance.js.map +0 -1
  380. package/dist/common/product.search.instance.js.map +0 -1
  381. package/dist/common/user.instance.js.map +0 -1
  382. package/dist/config/auth.constants.d.ts +0 -11
  383. package/dist/config/auth.constants.js +0 -12
  384. package/dist/config/auth.constants.js.map +0 -1
  385. package/dist/config/init.constants.d.ts +0 -15
  386. package/dist/config/init.constants.js +0 -20
  387. package/dist/config/init.constants.js.map +0 -1
  388. package/dist/interfaces/compile.d.ts +0 -12
  389. package/dist/interfaces/compile.js +0 -5
  390. package/dist/interfaces/compile.js.map +0 -1
  391. package/dist/types/compile.types.d.ts +0 -131
  392. package/dist/types/compile.types.js +0 -6
  393. package/dist/types/compile.types.js.map +0 -1
  394. package/dist/utils/agent-code-utils.d.ts +0 -25
  395. package/dist/utils/agent-code-utils.js +0 -107
  396. package/dist/utils/agent-code-utils.js.map +0 -1
  397. package/dist/utils/bundling.d.ts +0 -89
  398. package/dist/utils/bundling.js +0 -1068
  399. package/dist/utils/bundling.js.map +0 -1
  400. package/dist/utils/compile.d.ts +0 -116
  401. package/dist/utils/compile.js +0 -1062
  402. package/dist/utils/compile.js.map +0 -1
  403. package/dist/utils/deploy-api.d.ts +0 -26
  404. package/dist/utils/deploy-api.js +0 -54
  405. package/dist/utils/deploy-api.js.map +0 -1
  406. package/dist/utils/deployment.d.ts +0 -26
  407. package/dist/utils/deployment.js +0 -218
  408. package/dist/utils/deployment.js.map +0 -1
  409. package/dist/utils/dev-helpers.d.ts +0 -47
  410. package/dist/utils/dev-helpers.js +0 -82
  411. package/dist/utils/dev-helpers.js.map +0 -1
  412. package/dist/utils/job-management.d.ts +0 -27
  413. package/dist/utils/job-management.js +0 -248
  414. package/dist/utils/job-management.js.map +0 -1
  415. package/dist/utils/mcp-server-management.d.ts +0 -26
  416. package/dist/utils/mcp-server-management.js +0 -197
  417. package/dist/utils/mcp-server-management.js.map +0 -1
  418. package/dist/utils/postprocessor-management.d.ts +0 -9
  419. package/dist/utils/postprocessor-management.js +0 -117
  420. package/dist/utils/postprocessor-management.js.map +0 -1
  421. package/dist/utils/pre-bundle-jobs.d.ts +0 -27
  422. package/dist/utils/pre-bundle-jobs.js +0 -189
  423. package/dist/utils/pre-bundle-jobs.js.map +0 -1
  424. package/dist/utils/preprocessor-management.d.ts +0 -9
  425. package/dist/utils/preprocessor-management.js +0 -117
  426. package/dist/utils/preprocessor-management.js.map +0 -1
  427. package/dist/utils/push-api.d.ts +0 -15
  428. package/dist/utils/push-api.js +0 -49
  429. package/dist/utils/push-api.js.map +0 -1
  430. package/dist/utils/push-helpers.d.ts +0 -82
  431. package/dist/utils/push-helpers.js +0 -246
  432. package/dist/utils/push-helpers.js.map +0 -1
  433. package/dist/utils/skill-management.d.ts +0 -39
  434. package/dist/utils/skill-management.js +0 -299
  435. package/dist/utils/skill-management.js.map +0 -1
  436. package/dist/utils/test-helpers.d.ts +0 -33
  437. package/dist/utils/test-helpers.js +0 -84
  438. package/dist/utils/test-helpers.js.map +0 -1
  439. package/dist/utils/test-prompts.d.ts +0 -23
  440. package/dist/utils/test-prompts.js +0 -187
  441. package/dist/utils/test-prompts.js.map +0 -1
  442. package/dist/utils/tool-detection.d.ts +0 -19
  443. package/dist/utils/tool-detection.js +0 -125
  444. package/dist/utils/tool-detection.js.map +0 -1
  445. package/dist/utils/webhook-management.d.ts +0 -27
  446. package/dist/utils/webhook-management.js +0 -241
  447. package/dist/utils/webhook-management.js.map +0 -1
  448. /package/dist/{common โ†’ api}/http.client.d.ts +0 -0
  449. /package/dist/{common โ†’ api}/http.client.js +0 -0
  450. /package/dist/{common โ†’ instances}/basket.instance.d.ts +0 -0
  451. /package/dist/{common โ†’ instances}/basket.instance.js +0 -0
  452. /package/dist/{common โ†’ instances}/data.entry.instance.d.ts +0 -0
  453. /package/dist/{common โ†’ instances}/data.entry.instance.js +0 -0
  454. /package/dist/{common โ†’ instances}/job.instance.d.ts +0 -0
  455. /package/dist/{common โ†’ instances}/job.instance.js +0 -0
  456. /package/dist/{common โ†’ instances}/order.instance.d.ts +0 -0
  457. /package/dist/{common โ†’ instances}/order.instance.js +0 -0
  458. /package/dist/{common โ†’ instances}/product.instance.d.ts +0 -0
  459. /package/dist/{common โ†’ instances}/product.instance.js +0 -0
  460. /package/dist/{common โ†’ instances}/product.pagination.instance.d.ts +0 -0
  461. /package/dist/{common โ†’ instances}/product.pagination.instance.js +0 -0
  462. /package/dist/{common โ†’ instances}/product.search.instance.d.ts +0 -0
  463. /package/dist/{common โ†’ instances}/product.search.instance.js +0 -0
  464. /package/dist/{common โ†’ instances}/user.instance.d.ts +0 -0
  465. /package/dist/{common โ†’ instances}/user.instance.js +0 -0
@@ -0,0 +1,1294 @@
1
+ # Lua CLI Development Guide
2
+
3
+ A comprehensive guide for developers and AI assistants working on features and updates in the lua-cli ecosystem.
4
+
5
+ > โš ๏ธ **Important:** After every change to lua-cli, remember to update **lua-dev-docs** (public developer documentation). See [Documentation Checklist](#documentation-checklist-always-do-this).
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Architecture Overview](#architecture-overview)
10
+ 2. [Repository Structure](#repository-structure)
11
+ 3. [Adding a New Primitive](#adding-a-new-primitive)
12
+ 4. [Modifying an Existing Primitive](#modifying-an-existing-primitive)
13
+ 5. [Adding a New API](#adding-a-new-api)
14
+ 6. [Modifying an Existing API](#modifying-an-existing-api)
15
+ 7. [Adding New CLI Commands](#adding-new-cli-commands)
16
+ 8. [Key Patterns](#key-patterns)
17
+ 9. [Checklists](#checklists)
18
+ 10. [Example Walkthroughs](#example-walkthroughs)
19
+ 11. [Commit Message Conventions](#commit-message-conventions)
20
+
21
+ ---
22
+
23
+ ## Architecture Overview
24
+
25
+ The Lua platform is a multi-repository system for building and deploying AI agents. Code written by developers using lua-cli gets compiled, bundled, and executed at runtime by lua-core.
26
+
27
+ ### System Architecture Diagram
28
+
29
+ ```mermaid
30
+ flowchart TB
31
+ subgraph Developer [Developer Environment]
32
+ DevCode[Developer Code<br/>Skills, Jobs, Webhooks]
33
+ LuaCLI[lua-cli<br/>Compile & Bundle]
34
+ TestSandbox[Test Sandbox VM]
35
+ end
36
+
37
+ subgraph LuaAPI [lua-api Gateway]
38
+ AuthMW[Auth Middleware]
39
+ Proxy[Proxy Layer]
40
+ DevServices[Developer Services<br/>Jobs, Webhooks, Processors]
41
+ end
42
+
43
+ subgraph LuaAgents [lua-agents]
44
+ SkillsSvc[Skills Service]
45
+ DataSvc[Data Service]
46
+ EcommSvc[Ecommerce Service]
47
+ MCPSvc[MCP Server Service]
48
+ end
49
+
50
+ subgraph LuaCore [lua-core Runtime]
51
+ AgentSvc[Agent Service<br/>stream/generate]
52
+ VMExec[VM Execution]
53
+ DynTools[Dynamic Tool Service]
54
+ PromptSvc[Prompt Service]
55
+ ExecSvc[Execution Services<br/>Job, Webhook, Processors]
56
+ end
57
+
58
+ subgraph LuaAuth [lua-auth]
59
+ AuthSvc[Auth Service]
60
+ end
61
+
62
+ subgraph Supporting [Supporting Services]
63
+ LuaCDN[lua-cdn<br/>File Storage]
64
+ LuaEmail[lua-email<br/>Email Service]
65
+ LuaWhatsApp[lua-whatsapp<br/>Channel Integrations]
66
+ end
67
+
68
+ subgraph Channels [External Channels]
69
+ WA[WhatsApp]
70
+ IG[Instagram]
71
+ Slack[Slack]
72
+ Other[Other Channels]
73
+ end
74
+
75
+ DevCode --> LuaCLI
76
+ LuaCLI --> TestSandbox
77
+ LuaCLI -->|push/deploy| AuthMW
78
+ AuthMW --> Proxy
79
+ Proxy --> DevServices
80
+ Proxy --> SkillsSvc
81
+ Proxy --> DataSvc
82
+ Proxy --> EcommSvc
83
+ Proxy --> AgentSvc
84
+ AuthMW --> AuthSvc
85
+
86
+ AgentSvc --> VMExec
87
+ AgentSvc --> DynTools
88
+ AgentSvc --> PromptSvc
89
+ VMExec --> ExecSvc
90
+
91
+ WA --> LuaWhatsApp
92
+ IG --> LuaWhatsApp
93
+ Slack --> LuaWhatsApp
94
+ Other --> LuaWhatsApp
95
+ LuaWhatsApp -->|webhook payload| AgentSvc
96
+ ```
97
+
98
+ ### Request Flow Diagram
99
+
100
+ ```mermaid
101
+ sequenceDiagram
102
+ participant Dev as Developer
103
+ participant CLI as lua-cli
104
+ participant API as lua-api
105
+ participant Agents as lua-agents
106
+ participant Core as lua-core
107
+ participant VM as VM Sandbox
108
+
109
+ Note over Dev,VM: Deployment Flow
110
+ Dev->>CLI: lua push
111
+ CLI->>CLI: Compile & Bundle
112
+ CLI->>API: POST /skills (with bundled code)
113
+ API->>API: Authenticate
114
+ API->>Agents: Store skill/job/webhook
115
+ Agents-->>API: Success
116
+ API-->>CLI: Deployed
117
+
118
+ Note over Dev,VM: Runtime Flow (Agent Request)
119
+ Dev->>API: POST /chat/stream
120
+ API->>Core: Forward to lua-core
121
+ Core->>Core: Resolve tools dynamically
122
+ Core->>VM: Execute tool code
123
+ VM->>VM: APIs available (User, Data, Products, etc.)
124
+ VM-->>Core: Result
125
+ Core-->>API: Response
126
+ API-->>Dev: Streamed response
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Repository Structure
132
+
133
+ ### lua-cli
134
+
135
+ The command-line tool for building and deploying Lua agents.
136
+
137
+ ```
138
+ lua-cli/
139
+ โ”œโ”€โ”€ src/
140
+ โ”‚ โ”œโ”€โ”€ api/ # API services (HTTP-based, for test sandbox)
141
+ โ”‚ โ”‚ โ”œโ”€โ”€ user.data.api.service.ts
142
+ โ”‚ โ”‚ โ”œโ”€โ”€ products.api.service.ts
143
+ โ”‚ โ”‚ โ”œโ”€โ”€ basket.api.service.ts
144
+ โ”‚ โ”‚ โ”œโ”€โ”€ order.api.service.ts
145
+ โ”‚ โ”‚ โ”œโ”€โ”€ custom.data.api.service.ts
146
+ โ”‚ โ”‚ โ”œโ”€โ”€ job.api.service.ts
147
+ โ”‚ โ”‚ โ”œโ”€โ”€ webhook.api.service.ts
148
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
149
+ โ”‚ โ”œโ”€โ”€ cli/
150
+ โ”‚ โ”‚ โ””โ”€โ”€ command-definitions.ts # CLI command definitions
151
+ โ”‚ โ”œโ”€โ”€ commands/ # Command implementations
152
+ โ”‚ โ”‚ โ”œโ”€โ”€ skills.ts
153
+ โ”‚ โ”‚ โ”œโ”€โ”€ jobs.ts
154
+ โ”‚ โ”‚ โ”œโ”€โ”€ webhooks.ts
155
+ โ”‚ โ”‚ โ”œโ”€โ”€ test.ts
156
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
157
+ โ”‚ โ”œโ”€โ”€ common/ # Instance classes
158
+ โ”‚ โ”‚ โ”œโ”€โ”€ user.instance.ts
159
+ โ”‚ โ”‚ โ”œโ”€โ”€ product.instance.ts
160
+ โ”‚ โ”‚ โ”œโ”€โ”€ basket.instance.ts
161
+ โ”‚ โ”‚ โ”œโ”€โ”€ job.instance.ts
162
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
163
+ โ”‚ โ”œโ”€โ”€ interfaces/ # TypeScript interfaces
164
+ โ”‚ โ”œโ”€โ”€ types/
165
+ โ”‚ โ”‚ โ”œโ”€โ”€ skill.ts # Primitive classes (LuaSkill, LuaJob, etc.)
166
+ โ”‚ โ”‚ โ”œโ”€โ”€ api-contracts.ts # API contract interfaces
167
+ โ”‚ โ”‚ โ””โ”€โ”€ index.ts # Barrel export
168
+ โ”‚ โ”œโ”€โ”€ utils/
169
+ โ”‚ โ”‚ โ”œโ”€โ”€ compile.ts # Code compilation (IMPORTANT)
170
+ โ”‚ โ”‚ โ”œโ”€โ”€ bundling.ts # Code bundling (IMPORTANT)
171
+ โ”‚ โ”‚ โ””โ”€โ”€ sandbox.ts # Test VM sandbox (IMPORTANT)
172
+ โ”‚ โ”œโ”€โ”€ api-exports.ts # Public API exports
173
+ โ”‚ โ””โ”€โ”€ index.ts # CLI entry point
174
+ ```
175
+
176
+ ### lua-core
177
+
178
+ The runtime service where agent code executes.
179
+
180
+ ```
181
+ lua-core/
182
+ โ”œโ”€โ”€ src/
183
+ โ”‚ โ”œโ”€โ”€ controllers/
184
+ โ”‚ โ”‚ โ”œโ”€โ”€ chat.controller.ts
185
+ โ”‚ โ”‚ โ”œโ”€โ”€ job.controller.ts
186
+ โ”‚ โ”‚ โ””โ”€โ”€ webhook.controller.ts
187
+ โ”‚ โ”œโ”€โ”€ services/
188
+ โ”‚ โ”‚ โ””โ”€โ”€ agent.service.ts # Main agent request handling
189
+ โ”‚ โ””โ”€โ”€ mastra/
190
+ โ”‚ โ”œโ”€โ”€ agents/
191
+ โ”‚ โ”‚ โ””โ”€โ”€ base/
192
+ โ”‚ โ”‚ โ””โ”€โ”€ base.agent.ts # Base agent template
193
+ โ”‚ โ””โ”€โ”€ common/
194
+ โ”‚ โ”œโ”€โ”€ devtools/
195
+ โ”‚ โ”‚ โ”œโ”€โ”€ apis/ # API services (direct DB calls)
196
+ โ”‚ โ”‚ โ”œโ”€โ”€ common/ # Instance classes (MUST MATCH lua-cli)
197
+ โ”‚ โ”‚ โ”œโ”€โ”€ interfaces/ # Types
198
+ โ”‚ โ”‚ โ””โ”€โ”€ types/
199
+ โ”‚ โ”œโ”€โ”€ services/
200
+ โ”‚ โ”‚ โ”œโ”€โ”€ execute-function.service.ts
201
+ โ”‚ โ”‚ โ”œโ”€โ”€ execute.job.service.ts
202
+ โ”‚ โ”‚ โ”œโ”€โ”€ execute.webhook.service.ts
203
+ โ”‚ โ”‚ โ”œโ”€โ”€ execute.preprocessor.service.ts
204
+ โ”‚ โ”‚ โ”œโ”€โ”€ execute.postprocessor.service.ts
205
+ โ”‚ โ”‚ โ”œโ”€โ”€ dynamic.tool.service.ts
206
+ โ”‚ โ”‚ โ””โ”€โ”€ prompt.service.ts
207
+ โ”‚ โ””โ”€โ”€ utils/
208
+ โ”‚ โ””โ”€โ”€ vm-execution.utils.ts # Production VM (IMPORTANT)
209
+ ```
210
+
211
+ ### lua-api
212
+
213
+ The API gateway with authentication.
214
+
215
+ ```
216
+ lua-api/
217
+ โ”œโ”€โ”€ src/
218
+ โ”‚ โ”œโ”€โ”€ controllers/ # API endpoints
219
+ โ”‚ โ””โ”€โ”€ services/
220
+ โ”‚ โ”œโ”€โ”€ developer.job.service.ts
221
+ โ”‚ โ”œโ”€โ”€ developer.webhook.service.ts
222
+ โ”‚ โ”œโ”€โ”€ developer.preprocessor.service.ts
223
+ โ”‚ โ””โ”€โ”€ developer.postprocessor.service.ts
224
+ ```
225
+
226
+ ### lua-agents
227
+
228
+ Business logic for all primitives and APIs.
229
+
230
+ ```
231
+ lua-agents/
232
+ โ”œโ”€โ”€ src/
233
+ โ”‚ โ””โ”€โ”€ services/
234
+ โ”‚ โ”œโ”€โ”€ agent.service.ts
235
+ โ”‚ โ”œโ”€โ”€ skills.service.ts
236
+ โ”‚ โ”œโ”€โ”€ data.service.ts
237
+ โ”‚ โ”œโ”€โ”€ ecommerce.service.ts
238
+ โ”‚ โ”œโ”€โ”€ mcp-server.service.ts
239
+ โ”‚ โ””โ”€โ”€ ...
240
+ ```
241
+
242
+ ### Supporting Services
243
+
244
+ These services support specific features and rarely need modification during lua-cli development.
245
+
246
+ #### lua-cdn
247
+
248
+ CDN service for file uploads and downloads. Backs the `CDN` API.
249
+
250
+ **When to modify:**
251
+ - Changing file storage/retrieval logic
252
+ - Adding new file type support
253
+ - Modifying CDN endpoints
254
+
255
+ #### lua-email
256
+
257
+ Email microservice for sending emails.
258
+
259
+ **When to modify:**
260
+ - Adding new email templates
261
+ - Changing email delivery logic
262
+ - Modifying email providers
263
+
264
+ #### lua-whatsapp
265
+
266
+ **Important service** containing all channel integration logic: WhatsApp, Instagram, Facebook Messenger, Slack, Teams, Front, MessageBird, and more.
267
+
268
+ **When to modify:**
269
+ - Adding a new channel integration
270
+ - Changing webhook payload structure (this is where `Lua.request.webhook` payload originates)
271
+ - Modifying message transformation logic
272
+ - Adding channel-specific features
273
+
274
+ **Key responsibility:** This service receives incoming messages from various channels, transforms them into a unified format, and passes the raw webhook payload that becomes available via `Lua.request.webhook` in user code.
275
+
276
+ ### Documentation & Examples Repositories
277
+
278
+ > โš ๏ธ These repos **must be updated** for every lua-cli change that affects developers.
279
+
280
+ #### lua-dev-docs (ALWAYS UPDATE)
281
+
282
+ **Public** developer documentation. Update for every functional change.
283
+
284
+ **Important:** lua-cli is a **private repository**. Documentation should:
285
+ - Focus on functional changes (features, API changes, fixes)
286
+ - NOT include internal implementation details
287
+ - Be written from user/developer perspective
288
+
289
+ #### lua-dev-examples
290
+
291
+ **Public** repository with example code. Update when:
292
+ - New features need examples
293
+ - Existing patterns change
294
+
295
+ #### lua-market
296
+
297
+ Marketplace repository (not public). Update when:
298
+ - Marketplace features change
299
+ - Skill/installation functionality is modified
300
+
301
+ ---
302
+
303
+ ## Adding a New Primitive
304
+
305
+ A "primitive" is a deployable unit like Skill, Job, Webhook, Preprocessor, or Postprocessor.
306
+
307
+ ### Example: Adding an "Automation" Primitive
308
+
309
+ #### Step 1: Define Types in lua-cli
310
+
311
+ **`src/types/skill.ts`** - Add the primitive class:
312
+
313
+ ```typescript
314
+ export interface LuaAutomationConfig {
315
+ name: string;
316
+ description?: string;
317
+ trigger: AutomationTrigger;
318
+ timeout?: number;
319
+ }
320
+
321
+ export type AutomationTrigger =
322
+ | { type: 'event'; eventName: string }
323
+ | { type: 'schedule'; cron: string };
324
+
325
+ export class LuaAutomation {
326
+ name: string;
327
+ description?: string;
328
+ trigger: AutomationTrigger;
329
+ timeout?: number;
330
+ execute: (context: AutomationContext) => Promise<any>;
331
+
332
+ constructor(config: LuaAutomationConfig) {
333
+ this.name = config.name;
334
+ this.description = config.description;
335
+ this.trigger = config.trigger;
336
+ this.timeout = config.timeout;
337
+ }
338
+ }
339
+ ```
340
+
341
+ **`src/interfaces/automations.ts`** - Add interfaces:
342
+
343
+ ```typescript
344
+ export interface AutomationContext {
345
+ automationId: string;
346
+ triggeredAt: Date;
347
+ metadata: Record<string, any>;
348
+ }
349
+
350
+ export interface AutomationResponse {
351
+ id: string;
352
+ name: string;
353
+ status: 'active' | 'inactive';
354
+ // ...
355
+ }
356
+ ```
357
+
358
+ #### Step 2: Update Compilation Logic
359
+
360
+ **`src/utils/compile.ts`** - Add compilation for the new primitive:
361
+
362
+ Look for existing primitive handling (like `extractJobConfigs`) and add similar:
363
+
364
+ ```typescript
365
+ export async function extractAutomationConfigs(
366
+ project: Project,
367
+ indexPath: string
368
+ ): Promise<AutomationInfo[]> {
369
+ // Follow the pattern of extractJobConfigs or extractWebhookConfigs
370
+ // 1. Find exports of LuaAutomation type
371
+ // 2. Extract config properties
372
+ // 3. Extract execute function
373
+ // 4. Return structured data
374
+ }
375
+ ```
376
+
377
+ #### Step 3: Update Bundling Logic
378
+
379
+ **`src/utils/bundling.ts`** - Add bundling support:
380
+
381
+ ```typescript
382
+ export async function bundleAutomations(
383
+ automations: AutomationInfo[],
384
+ dependencies: string[]
385
+ ): Promise<BundledAutomation[]> {
386
+ // Follow existing patterns for jobs/webhooks
387
+ }
388
+ ```
389
+
390
+ #### Step 4: Add Test Sandbox Execution
391
+
392
+ **`src/utils/sandbox.ts`** - Add execution function:
393
+
394
+ ```typescript
395
+ export interface ExecuteAutomationOptions extends SandboxOptions {
396
+ automationCode: string;
397
+ context: AutomationContext;
398
+ }
399
+
400
+ export async function executeAutomation(
401
+ options: ExecuteAutomationOptions
402
+ ): Promise<any> {
403
+ const { automationCode, context } = options;
404
+ const sandbox = createSandbox(options);
405
+
406
+ const commonJsWrapper = `
407
+ const executeFunction = ${automationCode};
408
+
409
+ module.exports = async (context) => {
410
+ try {
411
+ return await executeFunction(context);
412
+ } catch(e) {
413
+ console.error(e);
414
+ return { status: 'error', error: e.message };
415
+ }
416
+ };
417
+ `;
418
+
419
+ const vmContext = vm.createContext(sandbox);
420
+ // ... execute and return result
421
+ }
422
+ ```
423
+
424
+ #### Step 5: Add CLI Commands
425
+
426
+ **`src/cli/command-definitions.ts`**:
427
+
428
+ ```typescript
429
+ export const automationsCommands = {
430
+ name: 'automations',
431
+ description: 'Manage automations',
432
+ subcommands: [
433
+ { name: 'list', description: 'List all automations' },
434
+ { name: 'test', description: 'Test an automation locally' },
435
+ // ...
436
+ ],
437
+ };
438
+ ```
439
+
440
+ **`src/commands/automations.ts`** - Implement the commands.
441
+
442
+ #### Step 6: Update API Exports
443
+
444
+ **`src/api-exports.ts`**:
445
+
446
+ ```typescript
447
+ export {
448
+ LuaAutomation,
449
+ LuaAutomationConfig,
450
+ AutomationTrigger,
451
+ } from './types/skill.js';
452
+
453
+ export {
454
+ AutomationContext,
455
+ AutomationResponse,
456
+ } from './interfaces/automations.js';
457
+ ```
458
+
459
+ #### Step 7: Add Backend Services
460
+
461
+ **lua-api** - Add controller and service:
462
+ - `src/controllers/automation.controller.ts`
463
+ - `src/services/developer.automation.service.ts`
464
+
465
+ **lua-agents** - Add business logic:
466
+ - `src/services/automation.service.ts`
467
+
468
+ **lua-core** - Add execution service:
469
+ - `src/mastra/common/services/execute.automation.service.ts`
470
+
471
+ ---
472
+
473
+ ## Modifying an Existing Primitive
474
+
475
+ ### Example: Adding a `retryDelay` Field to Jobs
476
+
477
+ #### Step 1: Update Types
478
+
479
+ **`lua-cli/src/types/skill.ts`**:
480
+
481
+ ```typescript
482
+ export interface LuaJobConfig {
483
+ name: string;
484
+ description?: string;
485
+ schedule: JobSchedule;
486
+ timeout?: number;
487
+ retry?: { maxAttempts: number; backoffSeconds?: number };
488
+ retryDelay?: number; // NEW FIELD
489
+ metadata?: Record<string, any>;
490
+ }
491
+ ```
492
+
493
+ **`lua-cli/src/interfaces/jobs.ts`**:
494
+
495
+ ```typescript
496
+ export interface JobData {
497
+ // ... existing fields
498
+ retryDelay?: number; // NEW FIELD
499
+ }
500
+ ```
501
+
502
+ #### Step 2: Update Compilation
503
+
504
+ **`lua-cli/src/utils/compile.ts`**:
505
+
506
+ Find the job config extraction code and add handling for the new field:
507
+
508
+ ```typescript
509
+ // In extractJobConfigs or similar function
510
+ const retryDelay = configArg.getProperty('retryDelay')?.getInitializer()?.getText();
511
+ ```
512
+
513
+ #### Step 3: Update Bundling
514
+
515
+ **`lua-cli/src/utils/bundling.ts`**:
516
+
517
+ Ensure the new field is included in the bundled output.
518
+
519
+ #### Step 4: Update Backend
520
+
521
+ **`lua-api/src/services/developer.job.service.ts`**:
522
+
523
+ Handle the new field in create/update operations.
524
+
525
+ **`lua-core/src/mastra/common/services/execute.job.service.ts`**:
526
+
527
+ Use the new field during job execution.
528
+
529
+ ---
530
+
531
+ ## Adding a New API
532
+
533
+ APIs are services available to user code at runtime (User, Data, Products, etc.).
534
+
535
+ ### Example: Adding a "Notifications" API
536
+
537
+ This requires changes in BOTH lua-cli (test) and lua-core (production).
538
+
539
+ #### Step 1: Create API Service in lua-cli
540
+
541
+ **`lua-cli/src/api/notifications.api.service.ts`**:
542
+
543
+ ```typescript
544
+ import { HttpClient } from '../common/http.client.js';
545
+
546
+ export default class NotificationsApi extends HttpClient {
547
+ private apiKey: string;
548
+ private agentId: string;
549
+
550
+ constructor(baseUrl: string, apiKey: string, agentId: string) {
551
+ super(baseUrl);
552
+ this.apiKey = apiKey;
553
+ this.agentId = agentId;
554
+ }
555
+
556
+ async send(userId: string, message: string): Promise<NotificationResult> {
557
+ const response = await this.httpPost<NotificationResult>(
558
+ `/developer/notifications/agent/${this.agentId}`,
559
+ { userId, message },
560
+ { Authorization: `Bearer ${this.apiKey}` }
561
+ );
562
+ if (!response.success) {
563
+ throw new Error(response.error?.message || 'Failed to send notification');
564
+ }
565
+ return response.data;
566
+ }
567
+
568
+ async getHistory(userId: string): Promise<Notification[]> {
569
+ const response = await this.httpGet<Notification[]>(
570
+ `/developer/notifications/agent/${this.agentId}/user/${userId}`,
571
+ { Authorization: `Bearer ${this.apiKey}` }
572
+ );
573
+ if (!response.success) {
574
+ throw new Error(response.error?.message || 'Failed to get notifications');
575
+ }
576
+ return response.data || [];
577
+ }
578
+ }
579
+ ```
580
+
581
+ #### Step 2: Add Interfaces
582
+
583
+ **`lua-cli/src/interfaces/notifications.ts`**:
584
+
585
+ ```typescript
586
+ export interface Notification {
587
+ id: string;
588
+ userId: string;
589
+ message: string;
590
+ sentAt: string;
591
+ read: boolean;
592
+ }
593
+
594
+ export interface NotificationResult {
595
+ id: string;
596
+ success: boolean;
597
+ }
598
+ ```
599
+
600
+ #### Step 3: Add to Sandbox
601
+
602
+ **`lua-cli/src/utils/sandbox.ts`**:
603
+
604
+ ```typescript
605
+ import NotificationsApi from '../api/notifications.api.service.js';
606
+
607
+ export function createSandbox(options: SandboxOptions): any {
608
+ // ... existing code
609
+
610
+ const notificationsService = new NotificationsApi(BASE_URLS.API, apiKey, agentId);
611
+
612
+ const sandbox = {
613
+ // ... existing APIs
614
+ Notifications: notificationsService,
615
+ };
616
+
617
+ return sandbox;
618
+ }
619
+ ```
620
+
621
+ #### Step 4: Export in api-exports.ts
622
+
623
+ **`lua-cli/src/api-exports.ts`**:
624
+
625
+ ```typescript
626
+ import {
627
+ // ... existing imports
628
+ getNotificationsInstance,
629
+ } from './api/lazy-instances.js';
630
+
631
+ export const Notifications = {
632
+ async send(userId: string, message: string): Promise<NotificationResult> {
633
+ const instance = await getNotificationsInstance();
634
+ return instance.send(userId, message);
635
+ },
636
+
637
+ async getHistory(userId: string): Promise<Notification[]> {
638
+ const instance = await getNotificationsInstance();
639
+ return instance.getHistory(userId);
640
+ },
641
+ };
642
+
643
+ // Also export types
644
+ export { Notification, NotificationResult } from './interfaces/notifications.js';
645
+ ```
646
+
647
+ #### Step 5: Create Matching API in lua-core
648
+
649
+ **`lua-core/src/mastra/common/devtools/apis/notifications.api.service.ts`**:
650
+
651
+ ```typescript
652
+ // Note: NO HTTP calls - direct service calls
653
+ import { sendNotification, getNotificationHistory } from '../../services/notifications.service';
654
+
655
+ export default class NotificationsApi {
656
+ userId: string;
657
+ agentId: string;
658
+
659
+ constructor(userId: string, agentId: string) {
660
+ this.userId = userId;
661
+ this.agentId = agentId;
662
+ }
663
+
664
+ async send(targetUserId: string, message: string): Promise<NotificationResult> {
665
+ return await sendNotification(this.agentId, targetUserId, message);
666
+ }
667
+
668
+ async getHistory(targetUserId: string): Promise<Notification[]> {
669
+ return await getNotificationHistory(this.agentId, targetUserId);
670
+ }
671
+ }
672
+ ```
673
+
674
+ #### Step 6: Register in lua-core VM
675
+
676
+ **`lua-core/src/mastra/common/utils/vm-execution.utils.ts`**:
677
+
678
+ ```typescript
679
+ import NotificationsApi from '../devtools/apis/notifications.api.service';
680
+
681
+ static createSandboxContext(/* ... */) {
682
+ return {
683
+ // ... existing APIs
684
+ Notifications: new NotificationsApi(userId, agentId),
685
+ };
686
+ }
687
+ ```
688
+
689
+ #### Step 7: Implement Backend
690
+
691
+ **lua-agents** - Add business logic service
692
+ **lua-api** - Add endpoints if needed for external access
693
+
694
+ ---
695
+
696
+ ## Modifying an Existing API
697
+
698
+ ### Example: Adding `getProfile()` to User API
699
+
700
+ #### Step 1: Update lua-cli API Service
701
+
702
+ **`lua-cli/src/api/user.data.api.service.ts`**:
703
+
704
+ ```typescript
705
+ async getProfile(): Promise<UserProfile> {
706
+ const response = await this.httpGet<UserProfile>(
707
+ `/developer/user/profile/agent/${this.agentId}`,
708
+ { Authorization: `Bearer ${this.apiKey}` }
709
+ );
710
+ if (!response.success) {
711
+ throw new Error(response.error?.message || 'Failed to get profile');
712
+ }
713
+ return response.data;
714
+ }
715
+ ```
716
+
717
+ #### Step 2: Update Instance (if needed)
718
+
719
+ **`lua-cli/src/common/user.instance.ts`**:
720
+
721
+ ```typescript
722
+ async getProfile(): Promise<UserProfile> {
723
+ return this.apiService.getProfile();
724
+ }
725
+ ```
726
+
727
+ #### Step 3: Update API Exports
728
+
729
+ **`lua-cli/src/api-exports.ts`**:
730
+
731
+ ```typescript
732
+ export const User = {
733
+ // ... existing methods
734
+
735
+ async getProfile(): Promise<UserProfile> {
736
+ const instance = await getUserInstance();
737
+ return instance.getProfile();
738
+ },
739
+ };
740
+ ```
741
+
742
+ #### Step 4: Update Type Contracts
743
+
744
+ **`lua-cli/src/types/api-contracts.ts`**:
745
+
746
+ ```typescript
747
+ export interface UserDataAPI {
748
+ // ... existing methods
749
+ getProfile(): Promise<UserProfile>;
750
+ }
751
+ ```
752
+
753
+ #### Step 5: Update lua-core API Service (CRITICAL)
754
+
755
+ **`lua-core/src/mastra/common/devtools/apis/user.data.api.service.ts`**:
756
+
757
+ ```typescript
758
+ async getProfile(): Promise<UserProfile> {
759
+ // Direct service call - no HTTP
760
+ return await getUserProfile(this.userId, this.agentId);
761
+ }
762
+ ```
763
+
764
+ #### Step 6: Update lua-core Instance
765
+
766
+ **`lua-core/src/mastra/common/devtools/common/user.instance.ts`**:
767
+
768
+ Keep in sync with lua-cli version.
769
+
770
+ #### Step 7: Implement Backend
771
+
772
+ **lua-agents** - Add `getUserProfile()` function in data.service.ts
773
+
774
+ ---
775
+
776
+ ## Adding New CLI Commands
777
+
778
+ ### Example: Adding a `lua analytics` Command
779
+
780
+ #### Step 1: Define Command
781
+
782
+ **`lua-cli/src/cli/command-definitions.ts`**:
783
+
784
+ ```typescript
785
+ export const analyticsCommands = {
786
+ name: 'analytics',
787
+ description: 'View agent analytics and metrics',
788
+ subcommands: [
789
+ {
790
+ name: 'overview',
791
+ description: 'Show analytics overview',
792
+ options: [
793
+ { name: 'period', short: 'p', description: 'Time period (7d, 30d, 90d)', default: '7d' },
794
+ ],
795
+ },
796
+ {
797
+ name: 'export',
798
+ description: 'Export analytics data',
799
+ options: [
800
+ { name: 'format', short: 'f', description: 'Export format (json, csv)', default: 'json' },
801
+ ],
802
+ },
803
+ ],
804
+ };
805
+ ```
806
+
807
+ #### Step 2: Implement Command
808
+
809
+ **`lua-cli/src/commands/analytics.ts`**:
810
+
811
+ ```typescript
812
+ import { Command } from 'commander';
813
+ import { getCredentials } from '../api/credentials.js';
814
+
815
+ export function registerAnalyticsCommands(program: Command) {
816
+ const analytics = program
817
+ .command('analytics')
818
+ .description('View agent analytics and metrics');
819
+
820
+ analytics
821
+ .command('overview')
822
+ .description('Show analytics overview')
823
+ .option('-p, --period <period>', 'Time period', '7d')
824
+ .action(async (options) => {
825
+ const credentials = await getCredentials();
826
+ // Implement analytics fetching and display
827
+ });
828
+
829
+ analytics
830
+ .command('export')
831
+ .description('Export analytics data')
832
+ .option('-f, --format <format>', 'Export format', 'json')
833
+ .action(async (options) => {
834
+ // Implement export logic
835
+ });
836
+ }
837
+ ```
838
+
839
+ #### Step 3: Register in Index
840
+
841
+ **`lua-cli/src/commands/index.ts`**:
842
+
843
+ ```typescript
844
+ export { registerAnalyticsCommands } from './analytics.js';
845
+ ```
846
+
847
+ **`lua-cli/src/index.ts`**:
848
+
849
+ ```typescript
850
+ import { registerAnalyticsCommands } from './commands/index.js';
851
+
852
+ // In the main function
853
+ registerAnalyticsCommands(program);
854
+ ```
855
+
856
+ ---
857
+
858
+ ## Key Patterns
859
+
860
+ ### VM Sandbox Pattern
861
+
862
+ Both `sandbox.ts` (lua-cli) and `vm-execution.utils.ts` (lua-core) must expose identical APIs:
863
+
864
+ ```typescript
865
+ // APIs available in user code:
866
+ User // User data management
867
+ Data // Custom data collections
868
+ Products // Product catalog
869
+ Baskets // Shopping baskets
870
+ Orders // Order management
871
+ Jobs // Job scheduling
872
+ Templates // Message templates (Templates.whatsapp)
873
+ CDN // File upload/download
874
+ AI // AI generation
875
+ Lua // Runtime context (Lua.request.channel)
876
+ env() // Environment variables
877
+ ```
878
+
879
+ ### API Service Pattern Differences
880
+
881
+ | Aspect | lua-cli (Test) | lua-core (Production) |
882
+ |--------|----------------|----------------------|
883
+ | Authentication | API key in headers | User context from request |
884
+ | Communication | HTTP calls to lua-api | Direct function calls |
885
+ | Constructor | `(baseUrl, apiKey, agentId)` | `(userId, agentId)` |
886
+
887
+ ### Type Export Chain
888
+
889
+ When adding types, update in this order:
890
+
891
+ 1. `src/interfaces/*.ts` - Create/update interface file
892
+ 2. `src/types/api-contracts.ts` - Add API contract interface
893
+ 3. `src/types/index.ts` - Add to barrel export
894
+ 4. `src/api-exports.ts` - Export for public use
895
+
896
+ ---
897
+
898
+ ## Checklists
899
+
900
+ ### New Primitive Checklist
901
+
902
+ - [ ] **lua-cli Types**
903
+ - [ ] Add class in `src/types/skill.ts`
904
+ - [ ] Add interfaces in `src/interfaces/`
905
+ - [ ] Export in `src/api-exports.ts`
906
+ - [ ] Export in `src/types/index.ts`
907
+ - [ ] **lua-cli Compile/Bundle**
908
+ - [ ] Add extraction in `src/utils/compile.ts`
909
+ - [ ] Add bundling in `src/utils/bundling.ts`
910
+ - [ ] **lua-cli Sandbox**
911
+ - [ ] Add execution function in `src/utils/sandbox.ts`
912
+ - [ ] **lua-cli Commands**
913
+ - [ ] Add command definition in `src/cli/command-definitions.ts`
914
+ - [ ] Implement command in `src/commands/`
915
+ - [ ] Export in `src/commands/index.ts`
916
+ - [ ] **lua-api**
917
+ - [ ] Add controller
918
+ - [ ] Add developer service
919
+ - [ ] **lua-agents**
920
+ - [ ] Add business logic service
921
+ - [ ] **lua-core**
922
+ - [ ] Add execution service in `src/mastra/common/services/`
923
+ - [ ] Add controller if needed
924
+ - [ ] **Documentation** (see Documentation Checklist below)
925
+
926
+ ### New API Checklist
927
+
928
+ - [ ] **lua-cli**
929
+ - [ ] Create API service in `src/api/`
930
+ - [ ] Create instance class in `src/common/` (if needed)
931
+ - [ ] Add interfaces in `src/interfaces/`
932
+ - [ ] Add type contract in `src/types/api-contracts.ts`
933
+ - [ ] Register in `src/utils/sandbox.ts`
934
+ - [ ] Export in `src/api-exports.ts`
935
+ - [ ] Add lazy instance getter in `src/api/lazy-instances.ts`
936
+ - [ ] **lua-core** (MUST MATCH lua-cli)
937
+ - [ ] Create API service in `src/mastra/common/devtools/apis/`
938
+ - [ ] Create instance class in `src/mastra/common/devtools/common/`
939
+ - [ ] Add interfaces in `src/mastra/common/devtools/interfaces/`
940
+ - [ ] Register in `src/mastra/common/utils/vm-execution.utils.ts`
941
+ - [ ] **Backend**
942
+ - [ ] Implement in lua-agents
943
+ - [ ] Add endpoints in lua-api (if external access needed)
944
+ - [ ] **Documentation** (see Documentation Checklist below)
945
+
946
+ ### API Modification Checklist
947
+
948
+ - [ ] **lua-cli**
949
+ - [ ] Update API service method
950
+ - [ ] Update instance class (if applicable)
951
+ - [ ] Update type contract
952
+ - [ ] Update exports
953
+ - [ ] **lua-core** (KEEP IN SYNC!)
954
+ - [ ] Update API service method
955
+ - [ ] Update instance class
956
+ - [ ] **Backend**
957
+ - [ ] Update lua-agents service
958
+ - [ ] Update lua-api endpoint (if applicable)
959
+ - [ ] **Documentation** (see Documentation Checklist below)
960
+
961
+ ### CLI Command Checklist
962
+
963
+ - [ ] Add command definition in `src/cli/command-definitions.ts`
964
+ - [ ] Implement command in `src/commands/`
965
+ - [ ] Export in `src/commands/index.ts`
966
+ - [ ] Register in `src/index.ts`
967
+ - [ ] Add any required API services
968
+ - [ ] **Documentation** (see below)
969
+
970
+ ### Documentation Checklist (ALWAYS DO THIS)
971
+
972
+ > โš ๏ธ **Critical:** Documentation must be updated for **every change** to lua-cli, even if a new version hasn't been published yet.
973
+
974
+ - [ ] **lua-dev-docs** (Public developer docs - ALWAYS UPDATE)
975
+ - [ ] Document new features, API changes, or bug fixes
976
+ - [ ] Write from user/developer perspective
977
+ - [ ] Focus on **functional changes only** (lua-cli is a private repo - no internal implementation details!)
978
+ - [ ] Include code examples where helpful
979
+ - [ ] **lua-dev-examples** (Public examples repo)
980
+ - [ ] Add examples for new features
981
+ - [ ] Update existing examples if patterns changed
982
+ - [ ] **lua-market** (Marketplace repo)
983
+ - [ ] Update if marketplace-related features changed
984
+
985
+ **What belongs in lua-dev-docs:**
986
+ - New features and how to use them
987
+ - API additions/changes with examples
988
+ - Bug fixes affecting user behavior
989
+ - Breaking changes and migration guides
990
+
991
+ **What does NOT belong in lua-dev-docs:**
992
+ - Internal implementation details
993
+ - Technical details about lua-cli codebase
994
+ - Service-to-service communication internals
995
+ - Code architecture decisions
996
+
997
+ ---
998
+
999
+ ## Example Walkthroughs
1000
+
1001
+ ### Walkthrough 1: Adding `sendReminder()` to User API
1002
+
1003
+ **Goal**: Allow sending reminder messages to users.
1004
+
1005
+ **Step 1**: Add to lua-cli API service
1006
+
1007
+ ```typescript
1008
+ // lua-cli/src/api/user.data.api.service.ts
1009
+ async sendReminder(message: string, scheduleAt?: Date): Promise<ReminderResult> {
1010
+ const response = await this.httpPost<ReminderResult>(
1011
+ `/developer/user/reminder/agent/${this.agentId}`,
1012
+ { message, scheduleAt: scheduleAt?.toISOString() },
1013
+ { Authorization: `Bearer ${this.apiKey}` }
1014
+ );
1015
+ if (!response.success) {
1016
+ throw new Error(response.error?.message || 'Failed to send reminder');
1017
+ }
1018
+ return response.data;
1019
+ }
1020
+ ```
1021
+
1022
+ **Step 2**: Add interface
1023
+
1024
+ ```typescript
1025
+ // lua-cli/src/interfaces/user.ts
1026
+ export interface ReminderResult {
1027
+ id: string;
1028
+ scheduledAt: string;
1029
+ status: 'scheduled' | 'sent';
1030
+ }
1031
+ ```
1032
+
1033
+ **Step 3**: Export in api-exports.ts
1034
+
1035
+ ```typescript
1036
+ // lua-cli/src/api-exports.ts
1037
+ export const User = {
1038
+ // ... existing
1039
+ async sendReminder(message: string, scheduleAt?: Date): Promise<ReminderResult> {
1040
+ const instance = await getUserInstance();
1041
+ return instance.sendReminder(message, scheduleAt);
1042
+ },
1043
+ };
1044
+ ```
1045
+
1046
+ **Step 4**: Add to lua-core (CRITICAL - must match!)
1047
+
1048
+ ```typescript
1049
+ // lua-core/src/mastra/common/devtools/apis/user.data.api.service.ts
1050
+ async sendReminder(message: string, scheduleAt?: Date): Promise<ReminderResult> {
1051
+ return await sendUserReminder(this.userId, this.agentId, message, scheduleAt);
1052
+ }
1053
+ ```
1054
+
1055
+ **Step 5**: Implement backend
1056
+
1057
+ ```typescript
1058
+ // lua-agents/src/services/data.service.ts
1059
+ export async function sendUserReminder(
1060
+ userId: string,
1061
+ agentId: string,
1062
+ message: string,
1063
+ scheduleAt?: Date
1064
+ ): Promise<ReminderResult> {
1065
+ // Implementation
1066
+ }
1067
+ ```
1068
+
1069
+ ### Walkthrough 2: Adding a `metadata` Field to Webhooks
1070
+
1071
+ **Goal**: Allow webhooks to store custom metadata.
1072
+
1073
+ **Step 1**: Update type definition
1074
+
1075
+ ```typescript
1076
+ // lua-cli/src/types/skill.ts
1077
+ export interface LuaWebhookConfig {
1078
+ name: string;
1079
+ description?: string;
1080
+ path?: string;
1081
+ metadata?: Record<string, any>; // NEW
1082
+ }
1083
+ ```
1084
+
1085
+ **Step 2**: Update interface
1086
+
1087
+ ```typescript
1088
+ // lua-cli/src/interfaces/webhooks.ts
1089
+ export interface WebhookData {
1090
+ // ... existing
1091
+ metadata?: Record<string, any>; // NEW
1092
+ }
1093
+ ```
1094
+
1095
+ **Step 3**: Update compilation
1096
+
1097
+ ```typescript
1098
+ // lua-cli/src/utils/compile.ts
1099
+ // In extractWebhookConfigs function, add:
1100
+ const metadata = configArg.getProperty('metadata')?.getInitializer()?.getText();
1101
+ ```
1102
+
1103
+ **Step 4**: Update bundling
1104
+
1105
+ ```typescript
1106
+ // lua-cli/src/utils/bundling.ts
1107
+ // Ensure metadata is included in bundled webhook data
1108
+ ```
1109
+
1110
+ **Step 5**: Update backend services
1111
+
1112
+ - `lua-api/src/services/developer.webhook.service.ts`
1113
+ - `lua-core/src/mastra/common/services/execute.webhook.service.ts`
1114
+
1115
+ ---
1116
+
1117
+ ## Common Issues and Solutions
1118
+
1119
+ ### Issue: API not available in user code
1120
+
1121
+ **Cause**: Missing registration in sandbox context.
1122
+
1123
+ **Solution**: Check both:
1124
+ - `lua-cli/src/utils/sandbox.ts` - `createSandbox` function
1125
+ - `lua-core/src/mastra/common/utils/vm-execution.utils.ts` - `createSandboxContext` function
1126
+
1127
+ ### Issue: Type errors after adding new API method
1128
+
1129
+ **Cause**: Type contract not updated.
1130
+
1131
+ **Solution**: Update `src/types/api-contracts.ts` with the new method signature.
1132
+
1133
+ ### Issue: Test works but production fails
1134
+
1135
+ **Cause**: lua-core API service not updated to match lua-cli.
1136
+
1137
+ **Solution**: Ensure both API services have identical method signatures.
1138
+
1139
+ ### Issue: Compilation fails for new primitive
1140
+
1141
+ **Cause**: Missing handling in compile.ts.
1142
+
1143
+ **Solution**:
1144
+ 1. Read entire compile.ts to understand patterns
1145
+ 2. Add extraction function following existing patterns
1146
+ 3. Handle edge cases (optional fields, default values)
1147
+
1148
+ ---
1149
+
1150
+ ## Testing Changes
1151
+
1152
+ ### Local Testing with lua-cli
1153
+
1154
+ ```bash
1155
+ # Test a skill
1156
+ lua test skill <skill-name>
1157
+
1158
+ # Test a job
1159
+ lua test job <job-name>
1160
+
1161
+ # Test a webhook
1162
+ lua test webhook <webhook-name> --body '{"key": "value"}'
1163
+
1164
+ # Test a preprocessor
1165
+ lua test preprocessor <name> --message "test message"
1166
+ ```
1167
+
1168
+ ### Verifying Synchronization
1169
+
1170
+ After making changes, verify:
1171
+
1172
+ 1. **API methods match** between lua-cli and lua-core
1173
+ 2. **Instance classes match** between lua-cli and lua-core
1174
+ 3. **Types are exported** in api-exports.ts
1175
+ 4. **Sandbox context** includes all APIs
1176
+
1177
+ ---
1178
+
1179
+ ---
1180
+
1181
+ ## Commit Message Conventions
1182
+
1183
+ lua-cli uses **conventional commits** with a changelog-friendly format. Commit messages are used to auto-generate the changelog for releases, so following the correct format is important.
1184
+
1185
+ ### Format
1186
+
1187
+ ```
1188
+ <type>(<scope>): <description>
1189
+ ```
1190
+
1191
+ ### Commit Types
1192
+
1193
+ | Type | Description | Changelog Section |
1194
+ |------|-------------|-------------------|
1195
+ | `feat` | New feature | โœจ New Features |
1196
+ | `fix` | Bug fix | ๐Ÿ› Bug Fixes |
1197
+ | `refactor` | Code refactoring (no behavior change) | ๐Ÿ”„ Refactoring |
1198
+ | `docs` | Documentation changes | ๐Ÿ“š Documentation |
1199
+ | `chore` | Maintenance, tooling, releases | (often not in changelog) |
1200
+ | `test` | Adding or updating tests | ๐Ÿงช Tests |
1201
+ | `perf` | Performance improvements | โšก Performance |
1202
+
1203
+ ### Scope Guidelines
1204
+
1205
+ Use the primary affected area as scope:
1206
+
1207
+ **Primitives:**
1208
+ - `skills`, `jobs`, `webhooks`, `preprocessors`, `postprocessors`, `mcp`
1209
+
1210
+ **Core Systems:**
1211
+ - `compile` - Compilation logic
1212
+ - `bundling` - Bundling logic
1213
+ - `sandbox` - Test sandbox VM
1214
+
1215
+ **APIs:**
1216
+ - `products`, `baskets`, `orders`, `data`, `user`, `templates`, `cdn`
1217
+
1218
+ **Commands:**
1219
+ - `chat`, `sync`, `push`, `test`, `deploy`, `init`, `logs`
1220
+
1221
+ **Other:**
1222
+ - `runtime` - Lua runtime API
1223
+ - `marketplace` - Marketplace features
1224
+ - `release` - Version releases
1225
+
1226
+ ### Examples
1227
+
1228
+ ```bash
1229
+ # New features
1230
+ feat(compile): add variable reference and path alias resolution
1231
+ feat(mcp): add streamable-http transport, block stdio (not supported yet)
1232
+ feat(products): add filter support to Products.get() with backward compatibility
1233
+ feat(runtime): add Lua.request.webhook for raw webhook payload access
1234
+
1235
+ # Bug fixes
1236
+ fix(push): handle undefined version when pushing primitives without version field
1237
+ fix(sync): fix persistent drift detection issues
1238
+ fix(compile): normalize skill metadata property naming
1239
+
1240
+ # Refactoring
1241
+ refactor(commands): normalize action handling across multiple command files
1242
+ refactor(agent): centralize persona handling and simplify yaml
1243
+ refactor(init): simplify agent creation, remove deprecated persona prompts
1244
+
1245
+ # Documentation
1246
+ docs(api): update User API documentation with new methods
1247
+
1248
+ # Tests
1249
+ test(compile): add comprehensive tests for configuration extraction
1250
+
1251
+ # Releases
1252
+ chore(release): lua-cli v3.4.0
1253
+ ```
1254
+
1255
+ ### Writing Good Commit Messages
1256
+
1257
+ 1. **Be specific** - Describe what changed, not just the file
1258
+ - Good: `feat(products): add filter support to Products.get()`
1259
+ - Bad: `feat(products): update products`
1260
+
1261
+ 2. **Use imperative mood** - "add" not "added" or "adds"
1262
+ - Good: `fix(sync): handle edge case for empty configs`
1263
+ - Bad: `fix(sync): fixed edge case handling`
1264
+
1265
+ 3. **Keep it concise** - First line under 72 characters
1266
+ - Use body for additional details if needed
1267
+
1268
+ 4. **Reference issues** - If fixing a bug from an issue
1269
+ - `fix(compile): resolve path alias in nested imports (#123)`
1270
+
1271
+ ### Pre-release Commits
1272
+
1273
+ For alpha/beta releases, use descriptive version commits:
1274
+
1275
+ ```bash
1276
+ v3.2.0-alpha.1: Sync Command, Chat Clear, Lua Runtime API
1277
+ v3.2.0-alpha.2: Fix Skill Metadata Property Naming
1278
+ ```
1279
+
1280
+ ### Checking Existing Patterns
1281
+
1282
+ Before committing, check recent history to match the style:
1283
+
1284
+ ```bash
1285
+ git log --oneline -20
1286
+ ```
1287
+
1288
+ ---
1289
+
1290
+ ## Additional Resources
1291
+
1292
+ - [API Index](./API_INDEX.md) - Complete API reference
1293
+ - [Lua CLI README](../README.md) - Getting started guide
1294
+ - [Changelog](../CHANGELOG_V3.md) - Version history