@pikku/cli 0.12.20 → 0.12.22

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 (455) hide show
  1. package/cli.schema.json +1 -1
  2. package/console-app/assets/index-C52h1B_L.css +1 -0
  3. package/console-app/assets/index-CAk106ji.js +232 -0
  4. package/console-app/index.html +3 -6
  5. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  6. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +3 -3
  7. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  8. package/dist/.pikku/cli/pikku-cli-channel.d.ts +6 -6
  9. package/dist/.pikku/cli/pikku-cli-channel.js +280 -1
  10. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  11. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  12. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  13. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +792 -8
  14. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  15. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  16. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  17. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  18. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  19. package/dist/.pikku/function/pikku-function-types.gen.d.ts +44 -70
  20. package/dist/.pikku/function/pikku-function-types.gen.js +33 -40
  21. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  22. package/dist/.pikku/function/pikku-functions-meta.gen.json +1439 -316
  23. package/dist/.pikku/function/pikku-functions.gen.js +21 -9
  24. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  25. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  26. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  27. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  28. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  29. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  30. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  31. package/dist/.pikku/pikku-bootstrap.gen.d.ts +3 -1
  32. package/dist/.pikku/pikku-bootstrap.gen.js +3 -1
  33. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  34. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  35. package/dist/.pikku/pikku-services.gen.d.ts +2 -1
  36. package/dist/.pikku/pikku-services.gen.js +1 -0
  37. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  38. package/dist/.pikku/pikku-types.gen.js +1 -1
  39. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  40. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  41. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.d.ts +1 -0
  42. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +6 -0
  43. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +250 -0
  44. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +4 -0
  45. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +5 -0
  46. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  47. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +66 -10
  48. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  49. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  50. package/dist/.pikku/schemas/register.gen.js +157 -11
  51. package/dist/.pikku/schemas/schemas/BinaryInput.schema.json +1 -0
  52. package/dist/.pikku/schemas/schemas/DbMigrateInput.schema.json +1 -0
  53. package/dist/.pikku/schemas/schemas/DbResetInput.schema.json +1 -0
  54. package/dist/.pikku/schemas/schemas/DbSeedInput.schema.json +1 -0
  55. package/dist/.pikku/schemas/schemas/FabricDbSchemaInput.schema.json +1 -0
  56. package/dist/.pikku/schemas/schemas/FabricDbSchemaOutput.schema.json +1 -0
  57. package/dist/.pikku/schemas/schemas/FabricDeployApplyInput.schema.json +1 -0
  58. package/dist/.pikku/schemas/schemas/FabricDeployApplyOutput.schema.json +1 -0
  59. package/dist/.pikku/schemas/schemas/FabricDeployListInput.schema.json +1 -0
  60. package/dist/.pikku/schemas/schemas/FabricDeployListOutput.schema.json +1 -0
  61. package/dist/.pikku/schemas/schemas/FabricDeployPlanInput.schema.json +1 -0
  62. package/dist/.pikku/schemas/schemas/FabricDeployPlanOutput.schema.json +1 -0
  63. package/dist/.pikku/schemas/schemas/FabricDeployUnitsInput.schema.json +1 -0
  64. package/dist/.pikku/schemas/schemas/FabricDeployUnitsOutput.schema.json +1 -0
  65. package/dist/.pikku/schemas/schemas/FabricDomainsAddInput.schema.json +1 -0
  66. package/dist/.pikku/schemas/schemas/FabricDomainsAddOutput.schema.json +1 -0
  67. package/dist/.pikku/schemas/schemas/FabricDomainsListInput.schema.json +1 -0
  68. package/dist/.pikku/schemas/schemas/FabricDomainsListOutput.schema.json +1 -0
  69. package/dist/.pikku/schemas/schemas/FabricDomainsRemoveInput.schema.json +1 -0
  70. package/dist/.pikku/schemas/schemas/FabricDomainsRemoveOutput.schema.json +1 -0
  71. package/dist/.pikku/schemas/schemas/FabricErrorsInput.schema.json +1 -0
  72. package/dist/.pikku/schemas/schemas/FabricErrorsOutput.schema.json +1 -0
  73. package/dist/.pikku/schemas/schemas/FabricInitInput.schema.json +1 -0
  74. package/dist/.pikku/schemas/schemas/FabricInitOutput.schema.json +1 -0
  75. package/dist/.pikku/schemas/schemas/FabricLLMKeyInput.schema.json +1 -0
  76. package/dist/.pikku/schemas/schemas/FabricLLMKeyOutput.schema.json +1 -0
  77. package/dist/.pikku/schemas/schemas/FabricLinkInput.schema.json +1 -0
  78. package/dist/.pikku/schemas/schemas/FabricLinkOutput.schema.json +1 -0
  79. package/dist/.pikku/schemas/schemas/FabricLoginInput.schema.json +1 -0
  80. package/dist/.pikku/schemas/schemas/FabricLoginOutput.schema.json +1 -0
  81. package/dist/.pikku/schemas/schemas/FabricLogsInput.schema.json +1 -0
  82. package/dist/.pikku/schemas/schemas/FabricLogsOutput.schema.json +1 -0
  83. package/dist/.pikku/schemas/schemas/FabricMetricsInput.schema.json +1 -0
  84. package/dist/.pikku/schemas/schemas/FabricMetricsOutput.schema.json +1 -0
  85. package/dist/.pikku/schemas/schemas/FabricRollbackInput.schema.json +1 -0
  86. package/dist/.pikku/schemas/schemas/FabricRollbackOutput.schema.json +1 -0
  87. package/dist/.pikku/schemas/schemas/FabricSecretsListInput.schema.json +1 -0
  88. package/dist/.pikku/schemas/schemas/FabricSecretsListOutput.schema.json +1 -0
  89. package/dist/.pikku/schemas/schemas/FabricSecretsSetInput.schema.json +1 -0
  90. package/dist/.pikku/schemas/schemas/FabricSecretsSetOutput.schema.json +1 -0
  91. package/dist/.pikku/schemas/schemas/FabricStatusInput.schema.json +1 -0
  92. package/dist/.pikku/schemas/schemas/FabricStatusOutput.schema.json +1 -0
  93. package/dist/.pikku/schemas/schemas/FabricTraceInput.schema.json +1 -0
  94. package/dist/.pikku/schemas/schemas/FabricTraceOutput.schema.json +1 -0
  95. package/dist/.pikku/schemas/schemas/FabricValidateInput.schema.json +1 -0
  96. package/dist/.pikku/schemas/schemas/FabricValidateOutput.schema.json +1 -0
  97. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  98. package/dist/.pikku/schemas/schemas/PikkuCommandChannelsOutput.schema.json +1 -0
  99. package/dist/.pikku/schemas/schemas/PikkuCommandHTTPOutput.schema.json +1 -0
  100. package/dist/.pikku/schemas/schemas/PikkuCommandQueueOutput.schema.json +1 -0
  101. package/dist/.pikku/schemas/schemas/PikkuEventsScaffoldOutput.schema.json +1 -0
  102. package/dist/.pikku/schemas/schemas/PikkuMetaClientsInput.schema.json +1 -0
  103. package/dist/.pikku/schemas/schemas/PikkuMetaContextInput.schema.json +1 -0
  104. package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsGetInput.schema.json +1 -0
  105. package/dist/.pikku/schemas/schemas/PikkuMetaFunctionsListInput.schema.json +1 -0
  106. package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareGetInput.schema.json +1 -0
  107. package/dist/.pikku/schemas/schemas/PikkuMetaMiddlewareListInput.schema.json +1 -0
  108. package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsGetInput.schema.json +1 -0
  109. package/dist/.pikku/schemas/schemas/PikkuMetaPermissionsListInput.schema.json +1 -0
  110. package/dist/.pikku/schemas/schemas/PikkuMetaSchemasGetInput.schema.json +1 -0
  111. package/dist/.pikku/schemas/schemas/PikkuMetaSchemasListInput.schema.json +1 -0
  112. package/dist/.pikku/schemas/schemas/PikkuMetaWiresChannelInput.schema.json +1 -0
  113. package/dist/.pikku/schemas/schemas/PikkuMetaWiresHttpInput.schema.json +1 -0
  114. package/dist/.pikku/schemas/schemas/PikkuMetaWiresListInput.schema.json +1 -0
  115. package/dist/.pikku/schemas/schemas/PikkuMetaWiresQueueInput.schema.json +1 -0
  116. package/dist/.pikku/schemas/schemas/PikkuMetaWiresSchedulerInput.schema.json +1 -0
  117. package/dist/.pikku/schemas/schemas/PikkuMetaWiresTriggerInput.schema.json +1 -0
  118. package/dist/.pikku/schemas/schemas/PikkuMetaWiresTypeInput.schema.json +1 -0
  119. package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsGetInput.schema.json +1 -0
  120. package/dist/.pikku/schemas/schemas/PikkuMetaWorkflowsListInput.schema.json +1 -0
  121. package/dist/.pikku/schemas/schemas/PikkuSkillsInstallInput.schema.json +1 -0
  122. package/dist/.pikku/schemas/schemas/PikkuSkillsListInput.schema.json +1 -0
  123. package/dist/.pikku/schemas/schemas/PikkuTestsCoverageInput.schema.json +1 -0
  124. package/dist/.pikku/schemas/schemas/PikkuTestsInitInput.schema.json +1 -0
  125. package/dist/.pikku/schemas/schemas/WorkflowRunStatus.schema.json +1 -1
  126. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  127. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  128. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  129. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  130. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  131. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  132. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  133. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  134. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  135. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  136. package/dist/.pikku/workflow/meta/allWorkflow.gen.json +237 -629
  137. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  138. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  139. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  140. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  141. package/dist/bin/pikku-bin.mjs +23 -0
  142. package/dist/bin/pikku.js +28 -1
  143. package/dist/src/cli.wiring.js +286 -10
  144. package/dist/src/deploy/analyzer/analyzer.d.ts +16 -1
  145. package/dist/src/deploy/analyzer/analyzer.js +83 -43
  146. package/dist/src/deploy/analyzer/manifest.d.ts +10 -0
  147. package/dist/src/deploy/build-pipeline.d.ts +2 -0
  148. package/dist/src/deploy/build-pipeline.js +123 -19
  149. package/dist/src/deploy/bundler/bundler.d.ts +3 -1
  150. package/dist/src/deploy/bundler/bundler.js +40 -9
  151. package/dist/src/deploy/bundler/dep-extractor.d.ts +5 -2
  152. package/dist/src/deploy/bundler/dep-extractor.js +103 -23
  153. package/dist/src/deploy/bundler/types.d.ts +5 -1
  154. package/dist/src/deploy/codegen/per-unit-codegen.d.ts +11 -1
  155. package/dist/src/deploy/codegen/per-unit-codegen.js +49 -6
  156. package/dist/src/deploy/plan/planner.js +25 -3
  157. package/dist/src/deploy/plan/provider.d.ts +2 -0
  158. package/dist/src/deploy/provider-adapter.d.ts +34 -0
  159. package/dist/src/deploy/server-entry.d.ts +16 -0
  160. package/dist/src/deploy/server-entry.js +81 -0
  161. package/dist/src/fabric/fabric-commands.d.ts +522 -0
  162. package/dist/src/fabric/fabric-commands.js +299 -0
  163. package/dist/src/fabric/functions/db-schema.function.d.ts +35 -0
  164. package/dist/src/fabric/functions/db-schema.function.js +37 -0
  165. package/dist/src/fabric/functions/deploy-list.function.d.ts +41 -0
  166. package/dist/src/fabric/functions/deploy-list.function.js +43 -0
  167. package/dist/src/fabric/functions/deploy-units.function.d.ts +35 -0
  168. package/dist/src/fabric/functions/deploy-units.function.js +41 -0
  169. package/dist/src/fabric/functions/deploy.function.d.ts +105 -0
  170. package/dist/src/fabric/functions/deploy.function.js +122 -0
  171. package/dist/src/fabric/functions/domains-add.function.d.ts +35 -0
  172. package/dist/src/fabric/functions/domains-add.function.js +46 -0
  173. package/dist/src/fabric/functions/domains-list.function.d.ts +20 -0
  174. package/dist/src/fabric/functions/domains-list.function.js +50 -0
  175. package/dist/src/fabric/functions/domains-remove.function.d.ts +24 -0
  176. package/dist/src/fabric/functions/domains-remove.function.js +44 -0
  177. package/dist/src/fabric/functions/errors.function.d.ts +44 -0
  178. package/dist/src/fabric/functions/errors.function.js +50 -0
  179. package/dist/src/fabric/functions/init.function.d.ts +51 -0
  180. package/dist/src/fabric/functions/init.function.js +54 -0
  181. package/dist/src/fabric/functions/link.function.d.ts +28 -0
  182. package/dist/src/fabric/functions/link.function.js +77 -0
  183. package/dist/src/fabric/functions/llm-key.function.d.ts +46 -0
  184. package/dist/src/fabric/functions/llm-key.function.js +76 -0
  185. package/dist/src/fabric/functions/login.function.d.ts +42 -0
  186. package/dist/src/fabric/functions/login.function.js +68 -0
  187. package/dist/src/fabric/functions/logs.function.d.ts +40 -0
  188. package/dist/src/fabric/functions/logs.function.js +84 -0
  189. package/dist/src/fabric/functions/metrics.function.d.ts +32 -0
  190. package/dist/src/fabric/functions/metrics.function.js +49 -0
  191. package/dist/src/fabric/functions/rollback.function.d.ts +76 -0
  192. package/dist/src/fabric/functions/rollback.function.js +69 -0
  193. package/dist/src/fabric/functions/secrets-list.function.d.ts +24 -0
  194. package/dist/src/fabric/functions/secrets-list.function.js +37 -0
  195. package/dist/src/fabric/functions/secrets-set.function.d.ts +32 -0
  196. package/dist/src/fabric/functions/secrets-set.function.js +36 -0
  197. package/dist/src/fabric/functions/status.function.d.ts +34 -0
  198. package/dist/src/fabric/functions/status.function.js +43 -0
  199. package/dist/src/fabric/functions/trace.function.d.ts +28 -0
  200. package/dist/src/fabric/functions/trace.function.js +45 -0
  201. package/dist/src/fabric/functions/validate.function.d.ts +50 -0
  202. package/dist/src/fabric/functions/validate.function.js +363 -0
  203. package/dist/src/fabric/lib/config.d.ts +64 -0
  204. package/dist/src/fabric/lib/config.js +62 -0
  205. package/dist/src/fabric/lib/console-url.d.ts +5 -0
  206. package/dist/src/fabric/lib/console-url.js +13 -0
  207. package/dist/src/fabric/lib/git.d.ts +53 -0
  208. package/dist/src/fabric/lib/git.js +151 -0
  209. package/dist/src/fabric/lib/http.d.ts +4 -0
  210. package/dist/src/fabric/lib/http.js +12 -0
  211. package/dist/src/fabric/lib/not-implemented.d.ts +5 -0
  212. package/dist/src/fabric/lib/not-implemented.js +8 -0
  213. package/dist/src/fabric/lib/output.d.ts +23 -0
  214. package/dist/src/fabric/lib/output.js +39 -0
  215. package/dist/src/fabric/lib/prompt.d.ts +12 -0
  216. package/dist/src/fabric/lib/prompt.js +32 -0
  217. package/dist/src/fabric/lib/stage.d.ts +7 -0
  218. package/dist/src/fabric/lib/stage.js +14 -0
  219. package/dist/src/fabric/sdk/pikku-fetch.gen.d.ts +14 -0
  220. package/dist/src/fabric/sdk/pikku-fetch.gen.js +30 -0
  221. package/dist/src/fabric/sdk/pikku-rpc.gen.d.ts +105 -0
  222. package/dist/src/fabric/sdk/pikku-rpc.gen.js +126 -0
  223. package/dist/src/functions/commands/all.d.ts +1 -1
  224. package/dist/src/functions/commands/binary.d.ts +7 -0
  225. package/dist/src/functions/commands/binary.js +40 -0
  226. package/dist/src/functions/commands/bootstrap.d.ts +1 -1
  227. package/dist/src/functions/commands/bootstrap.js +7 -4
  228. package/dist/src/functions/commands/console.d.ts +3 -3
  229. package/dist/src/functions/commands/db-migrate.d.ts +1 -0
  230. package/dist/src/functions/commands/db-migrate.js +35 -0
  231. package/dist/src/functions/commands/db-reset.d.ts +1 -0
  232. package/dist/src/functions/commands/db-reset.js +36 -0
  233. package/dist/src/functions/commands/db-seed.d.ts +1 -0
  234. package/dist/src/functions/commands/db-seed.js +27 -0
  235. package/dist/src/functions/commands/db-shared.d.ts +32 -0
  236. package/dist/src/functions/commands/db-shared.js +26 -0
  237. package/dist/src/functions/commands/deploy-apply.d.ts +3 -3
  238. package/dist/src/functions/commands/deploy-apply.js +6 -4
  239. package/dist/src/functions/commands/deploy-info.d.ts +1 -1
  240. package/dist/src/functions/commands/deploy-plan.d.ts +3 -3
  241. package/dist/src/functions/commands/deploy-plan.js +7 -1
  242. package/dist/src/functions/commands/dev.d.ts +3 -3
  243. package/dist/src/functions/commands/dev.js +142 -86
  244. package/dist/src/functions/commands/enable.d.ts +5 -4
  245. package/dist/src/functions/commands/enable.js +4 -0
  246. package/dist/src/functions/commands/info.d.ts +4 -4
  247. package/dist/src/functions/commands/load-user-project.d.ts +11 -0
  248. package/dist/src/functions/commands/load-user-project.js +40 -0
  249. package/dist/src/functions/commands/meta.d.ts +82 -0
  250. package/dist/src/functions/commands/meta.js +454 -0
  251. package/dist/src/functions/commands/new-addon.d.ts +3 -3
  252. package/dist/src/functions/commands/new-function.d.ts +3 -3
  253. package/dist/src/functions/commands/new-middleware.d.ts +3 -3
  254. package/dist/src/functions/commands/new-permission.d.ts +3 -3
  255. package/dist/src/functions/commands/new-wiring.d.ts +3 -3
  256. package/dist/src/functions/commands/pikku-command-bootstrap.d.ts +1 -1
  257. package/dist/src/functions/commands/pikku-command-bootstrap.js +15 -1
  258. package/dist/src/functions/commands/pikku-command-summary.d.ts +1 -1
  259. package/dist/src/functions/commands/pikku-command-summary.js +7 -1
  260. package/dist/src/functions/commands/skills.d.ts +26 -0
  261. package/dist/src/functions/commands/skills.js +184 -0
  262. package/dist/src/functions/commands/tests-coverage.d.ts +7 -0
  263. package/dist/src/functions/commands/tests-coverage.js +231 -0
  264. package/dist/src/functions/commands/tests-init.d.ts +7 -0
  265. package/dist/src/functions/commands/tests-init.js +225 -0
  266. package/dist/src/functions/commands/versions-check.d.ts +1 -1
  267. package/dist/src/functions/commands/versions-init.d.ts +3 -3
  268. package/dist/src/functions/commands/versions-update.d.ts +1 -1
  269. package/dist/src/functions/commands/versions-update.js +4 -2
  270. package/dist/src/functions/commands/watch.d.ts +3 -3
  271. package/dist/src/functions/commands/watch.js +1 -1
  272. package/dist/src/functions/db/local-db.d.ts +48 -0
  273. package/dist/src/functions/db/local-db.js +106 -0
  274. package/dist/src/functions/db/seed.d.ts +11 -0
  275. package/dist/src/functions/db/seed.js +22 -0
  276. package/dist/src/functions/db/sql-migrator.d.ts +26 -0
  277. package/dist/src/functions/db/sql-migrator.js +104 -0
  278. package/dist/src/functions/db/sqlite-codegen.d.ts +45 -0
  279. package/dist/src/functions/db/sqlite-codegen.js +294 -0
  280. package/dist/src/functions/db/zod-codegen.d.ts +10 -0
  281. package/dist/src/functions/db/zod-codegen.js +109 -0
  282. package/dist/src/functions/runtimes/fetch/index.d.ts +1 -1
  283. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -1
  284. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +21 -2
  285. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.d.ts +1 -0
  286. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-worker-rpc-wrapper.js +163 -0
  287. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts +1 -1
  288. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +5 -2
  289. package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.d.ts +1 -0
  290. package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.js +32 -0
  291. package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.d.ts +11 -0
  292. package/dist/src/functions/runtimes/tanstack-start/serialize-tanstack-start-shim.js +36 -0
  293. package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.d.ts +1 -1
  294. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.d.ts +1 -1
  295. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.d.ts +1 -1
  296. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +1 -10
  297. package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.d.ts +1 -1
  298. package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +76 -1
  299. package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
  300. package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -1
  301. package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -1
  302. package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -1
  303. package/dist/src/functions/wirings/channels/pikku-command-channels.js +1 -1
  304. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -1
  305. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +5 -2
  306. package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +5 -1
  307. package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +8 -2
  308. package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -1
  309. package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +27 -9
  310. package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +5 -1
  311. package/dist/src/functions/wirings/cli/serialize-channel-cli.js +13 -3
  312. package/dist/src/functions/wirings/console/pikku-command-console-functions.d.ts +1 -1
  313. package/dist/src/functions/wirings/console/pikku-command-console-functions.js +5 -1
  314. package/dist/src/functions/wirings/console/pikku-command-node-types.d.ts +1 -1
  315. package/dist/src/functions/wirings/console/pikku-command-nodes-meta.d.ts +1 -1
  316. package/dist/src/functions/wirings/console/serialize-console-functions.js +5 -0
  317. package/dist/src/functions/wirings/credentials/pikku-command-credentials.d.ts +1 -1
  318. package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +5 -1
  319. package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +7 -2
  320. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -1
  321. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
  322. package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -1
  323. package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
  324. package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
  325. package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
  326. package/dist/src/functions/wirings/functions/serialize-function-types.js +105 -80
  327. package/dist/src/functions/wirings/gateway/pikku-command-gateway.d.ts +1 -1
  328. package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -1
  329. package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -1
  330. package/dist/src/functions/wirings/http/pikku-command-http-routes.js +1 -1
  331. package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -1
  332. package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -1
  333. package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -1
  334. package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -1
  335. package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -1
  336. package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -1
  337. package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -1
  338. package/dist/src/functions/wirings/package/pikku-command-package-types.d.ts +2 -2
  339. package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -1
  340. package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -1
  341. package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -1
  342. package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +1 -1
  343. package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -1
  344. package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -1
  345. package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -1
  346. package/dist/src/functions/wirings/queue/pikku-command-queue.js +1 -1
  347. package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -1
  348. package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -1
  349. package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.d.ts +1 -0
  350. package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.js +26 -0
  351. package/dist/src/functions/wirings/realtime/pikku-command-realtime.d.ts +1 -0
  352. package/dist/src/functions/wirings/realtime/pikku-command-realtime.js +35 -0
  353. package/dist/src/functions/wirings/realtime/serialize-events-scaffold.d.ts +23 -0
  354. package/dist/src/functions/wirings/realtime/serialize-events-scaffold.js +98 -0
  355. package/dist/src/functions/wirings/realtime/serialize-realtime-client.d.ts +22 -0
  356. package/dist/src/functions/wirings/realtime/serialize-realtime-client.js +337 -0
  357. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -1
  358. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +5 -1
  359. package/dist/src/functions/wirings/rpc/pikku-command-react-query.d.ts +1 -1
  360. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -1
  361. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.js +5 -1
  362. package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -1
  363. package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +3 -1
  364. package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +2 -2
  365. package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +2 -1
  366. package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +13 -7
  367. package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +1 -0
  368. package/dist/src/functions/wirings/rpc/serialize-react-query-hooks.js +1 -1
  369. package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +7 -1
  370. package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +16 -2
  371. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -1
  372. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -1
  373. package/dist/src/functions/wirings/secrets/pikku-command-secrets.d.ts +1 -1
  374. package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.d.ts +1 -1
  375. package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.js +1 -1
  376. package/dist/src/functions/wirings/triggers/pikku-command-trigger.d.ts +1 -1
  377. package/dist/src/functions/wirings/variables/pikku-command-variables.d.ts +1 -1
  378. package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.d.ts +1 -1
  379. package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.js +1 -1
  380. package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +5 -1
  381. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +18 -4
  382. package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.d.ts +3 -0
  383. package/dist/src/functions/wirings/workflow/serialize-workflow-bootstrap-map.js +40 -0
  384. package/dist/src/functions/wirings/workflow/serialize-workflow-routes.js +56 -2
  385. package/dist/src/functions/workflows/all.workflow.js +45 -12
  386. package/dist/src/scaffold/rpc-remote.gen.d.ts +3 -3
  387. package/dist/src/scaffold/rpc-remote.gen.js +7 -2
  388. package/dist/src/scaffold/workflow-routes.gen.d.ts +18 -18
  389. package/dist/src/scaffold/workflow-routes.gen.js +33 -1
  390. package/dist/src/services/cli-logger.service.d.ts +22 -3
  391. package/dist/src/services/cli-logger.service.js +107 -41
  392. package/dist/src/services.js +32 -67
  393. package/dist/src/utils/generate-bootstrap-file.js +3 -0
  394. package/dist/src/utils/parse-cli-filters.d.ts +18 -0
  395. package/dist/src/utils/parse-cli-filters.js +99 -0
  396. package/dist/src/utils/pikku-cli-config.js +29 -9
  397. package/dist/tsconfig.tsbuildinfo +1 -1
  398. package/package.json +9 -4
  399. package/skills/pikku-addon/SKILL.md +330 -0
  400. package/skills/pikku-ai-agent/SKILL.md +227 -0
  401. package/skills/pikku-ai-vercel/SKILL.md +78 -0
  402. package/skills/pikku-ai-voice/SKILL.md +85 -0
  403. package/skills/pikku-auth-js/SKILL.md +106 -0
  404. package/skills/pikku-aws/SKILL.md +107 -0
  405. package/skills/pikku-backblaze/SKILL.md +70 -0
  406. package/skills/pikku-cli/SKILL.md +281 -0
  407. package/skills/pikku-concepts/SKILL.md +281 -0
  408. package/skills/pikku-concepts/references/concept-mapping.md +528 -0
  409. package/skills/pikku-config/SKILL.md +208 -0
  410. package/skills/pikku-cron/SKILL.md +211 -0
  411. package/skills/pikku-deploy-azure/SKILL.md +69 -0
  412. package/skills/pikku-deploy-cloudflare/SKILL.md +80 -0
  413. package/skills/pikku-deploy-express/SKILL.md +83 -0
  414. package/skills/pikku-deploy-fastify/SKILL.md +70 -0
  415. package/skills/pikku-deploy-lambda/SKILL.md +107 -0
  416. package/skills/pikku-deploy-nextjs/SKILL.md +76 -0
  417. package/skills/pikku-deploy-uws/SKILL.md +85 -0
  418. package/skills/pikku-fabric/SKILL.md +245 -0
  419. package/skills/pikku-feature/SKILL.md +258 -0
  420. package/skills/pikku-gateway-slack/SKILL.md +112 -0
  421. package/skills/pikku-http/SKILL.md +317 -0
  422. package/skills/pikku-i18n/SKILL.md +208 -0
  423. package/skills/pikku-info/SKILL.md +95 -0
  424. package/skills/pikku-jose/SKILL.md +102 -0
  425. package/skills/pikku-kysely/SKILL.md +145 -0
  426. package/skills/pikku-mcp/SKILL.md +237 -0
  427. package/skills/pikku-mongodb/SKILL.md +102 -0
  428. package/skills/pikku-n8n-addon-map/SKILL.md +178 -0
  429. package/skills/pikku-n8n-code-translate/SKILL.md +166 -0
  430. package/skills/pikku-pino/SKILL.md +77 -0
  431. package/skills/pikku-queue/SKILL.md +237 -0
  432. package/skills/pikku-react/SKILL.md +183 -0
  433. package/skills/pikku-react-query/SKILL.md +205 -0
  434. package/skills/pikku-realtime/SKILL.md +285 -0
  435. package/skills/pikku-redis/SKILL.md +87 -0
  436. package/skills/pikku-rpc/SKILL.md +168 -0
  437. package/skills/pikku-rtl/SKILL.md +205 -0
  438. package/skills/pikku-schedule/SKILL.md +54 -0
  439. package/skills/pikku-schema-ajv/SKILL.md +60 -0
  440. package/skills/pikku-schema-cfworker/SKILL.md +60 -0
  441. package/skills/pikku-security/SKILL.md +243 -0
  442. package/skills/pikku-services/SKILL.md +247 -0
  443. package/skills/pikku-template-clone/SKILL.md +39 -0
  444. package/skills/pikku-testing/SKILL.md +428 -0
  445. package/skills/pikku-trigger/SKILL.md +177 -0
  446. package/skills/pikku-versioning/SKILL.md +169 -0
  447. package/skills/pikku-websocket/SKILL.md +239 -0
  448. package/skills/pikku-workflow/SKILL.md +283 -0
  449. package/skills/pikku-workflows-client/SKILL.md +150 -0
  450. package/skills/pikku-ws/SKILL.md +45 -0
  451. package/console-app/assets/index-BpY2pSuA.css +0 -10
  452. package/console-app/assets/index-DXLy-_D4.js +0 -717
  453. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +0 -10
  454. package/dist/.pikku/cli/pikku-cli-client.gen.js +0 -44
  455. /package/dist/.pikku/schemas/schemas/{PikkuChannelsOutput.schema.json → PikkuCLIEntryOutput.schema.json} +0 -0
@@ -0,0 +1,237 @@
1
+ ---
2
+ name: pikku-mcp
3
+ description: 'Use when exposing Pikku functions as MCP tools, resources, or prompts for AI assistants. Covers mcp: true flag, pikkuMCPResourceFunc, pikkuMCPPromptFunc, and MCP wire object.
4
+ TRIGGER when: code uses mcp: true or pikkuMCPResourceFunc/pikkuMCPPromptFunc, user asks about MCP, Model Context Protocol, AI tool integration, or exposing functions to Claude/ChatGPT.
5
+ DO NOT TRIGGER when: user asks about AI agents (use pikku-ai-agent) or general function definitions (use pikku-concepts).'
6
+ installGroups: [core]
7
+ ---
8
+
9
+ # Pikku MCP Wiring
10
+
11
+ ## Agent Operating Procedure
12
+
13
+ Use this skill as an execution checklist, not reference material.
14
+
15
+ 1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
16
+ 2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
17
+ 3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
18
+ 4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
19
+ 5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
20
+
21
+ Expose Pikku functions as Model Context Protocol (MCP) tools, resources, and prompts for AI assistants like Claude, ChatGPT, and others.
22
+
23
+ ## Before You Start
24
+
25
+ ```bash
26
+ pikku info functions --verbose # See existing functions that could become MCP tools
27
+ pikku info tags --verbose # Understand project organization
28
+ ```
29
+
30
+ See `pikku-concepts` for the core mental model.
31
+
32
+ ## API Reference
33
+
34
+ ### MCP Tools (simplest approach)
35
+
36
+ Add `mcp: true` to any existing `pikkuFunc` to expose it as an MCP tool:
37
+
38
+ ```typescript
39
+ const myFunc = pikkuFunc({
40
+ description: string, // Used as MCP tool description
41
+ input: ZodSchema, // Becomes MCP tool input schema
42
+ output: ZodSchema, // Return type
43
+ mcp: true, // ← Expose as MCP tool
44
+ func: async (services, data) => { ... },
45
+ })
46
+ ```
47
+
48
+ ### MCP Resources (`pikkuMCPResourceFunc`)
49
+
50
+ ```typescript
51
+ import { pikkuMCPResourceFunc } from '#pikku'
52
+
53
+ const resource = pikkuMCPResourceFunc({
54
+ uri: string, // URI template, e.g. 'todos/{id}'
55
+ title: string, // Human-readable title
56
+ description?: string,
57
+ func: async (services, data, { mcp }) => {
58
+ // Must return array of { uri, text } or { uri, blob, mimeType }
59
+ return [{ uri: mcp.uri!, text: JSON.stringify(result) }]
60
+ },
61
+ })
62
+ ```
63
+
64
+ ### MCP Prompts (`pikkuMCPPromptFunc`)
65
+
66
+ ```typescript
67
+ import { pikkuMCPPromptFunc } from '#pikku'
68
+
69
+ const prompt = pikkuMCPPromptFunc({
70
+ name: string,
71
+ description: string,
72
+ func: async (services, data) => {
73
+ // Must return array of MCP messages
74
+ return [
75
+ {
76
+ role: 'user',
77
+ content: { type: 'text', text: '...' },
78
+ },
79
+ ]
80
+ },
81
+ })
82
+ ```
83
+
84
+ ### MCP Wire Object
85
+
86
+ Inside MCP-enabled functions, `wire.mcp` provides:
87
+
88
+ ```typescript
89
+ mcp.uri // Current resource URI (for resources)
90
+ mcp.sendResourceUpdated(uri) // Notify clients a resource changed
91
+ mcp.enableTools({ toolName: true }) // Dynamically enable/disable tools
92
+ ```
93
+
94
+ ## Usage Patterns
95
+
96
+ ### Expose Existing Functions as MCP Tools
97
+
98
+ The simplest path — add `mcp: true` to any function:
99
+
100
+ ```typescript
101
+ export const createTodo = pikkuFunc({
102
+ description: 'Create a new todo item',
103
+ input: CreateTodoInput,
104
+ output: CreateTodoOutput,
105
+ mcp: true,
106
+ func: async ({ db }, { text, priority }) => {
107
+ return await db.createTodo({ text, priority })
108
+ },
109
+ })
110
+ ```
111
+
112
+ ### MCP Resources with URI Templates
113
+
114
+ ```typescript
115
+ export const getTodo = pikkuMCPResourceFunc({
116
+ uri: 'todos/{id}',
117
+ title: 'Todo Details',
118
+ description: 'Get a todo by ID',
119
+ func: async ({ db }, { id }, { mcp }) => {
120
+ const todo = await db.getTodo(id)
121
+ return [{ uri: mcp.uri!, text: JSON.stringify(todo) }]
122
+ },
123
+ })
124
+ ```
125
+
126
+ ### MCP Prompts
127
+
128
+ ```typescript
129
+ export const codeReview = pikkuMCPPromptFunc({
130
+ name: 'codeReview',
131
+ description: 'Generate a code review prompt',
132
+ func: async ({}, { filePath, context }) => {
133
+ return [
134
+ {
135
+ role: 'user',
136
+ content: {
137
+ type: 'text',
138
+ text: `Review ${filePath}. Context: ${context}`,
139
+ },
140
+ },
141
+ ]
142
+ },
143
+ })
144
+ ```
145
+
146
+ ### Dynamic Tool Control
147
+
148
+ ```typescript
149
+ export const manageTodos = pikkuFunc({
150
+ description: 'Manage todo items',
151
+ input: ManageTodosInput,
152
+ output: ManageTodosOutput,
153
+ mcp: true,
154
+ func: async ({ db }, { action, id }, { mcp }) => {
155
+ if (action === 'delete') {
156
+ await db.deleteTodo(id)
157
+ mcp.sendResourceUpdated(`todos/${id}`)
158
+ await mcp.enableTools({ archiveTodos: true })
159
+ return { deleted: true }
160
+ }
161
+ },
162
+ })
163
+ ```
164
+
165
+ ### MCP Server Setup
166
+
167
+ ```typescript
168
+ // start.ts
169
+ import { PikkuMCPServer } from '@pikku/modelcontextprotocol'
170
+
171
+ const server = new PikkuMCPServer(config, singletonServices, createWireServices)
172
+ await server.init()
173
+ await server.start()
174
+ ```
175
+
176
+ ## Complete Example
177
+
178
+ ```typescript
179
+ // functions/todos.functions.ts
180
+ export const listTodos = pikkuSessionlessFunc({
181
+ description: 'List all todo items',
182
+ input: ListTodosInput,
183
+ output: ListTodosOutput,
184
+ mcp: true,
185
+ func: async ({ db }, { status }) => {
186
+ return { todos: await db.listTodos(status) }
187
+ },
188
+ })
189
+
190
+ export const createTodo = pikkuFunc({
191
+ description: 'Create a new todo item',
192
+ input: CreateTodoInput,
193
+ output: CreateTodoOutput,
194
+ mcp: true,
195
+ func: async ({ db }, { text, priority }) => {
196
+ return await db.createTodo({ text, priority })
197
+ },
198
+ })
199
+
200
+ export const completeTodo = pikkuFunc({
201
+ description: 'Mark a todo as complete',
202
+ input: CompleteTodoInput,
203
+ output: CompleteTodoOutput,
204
+ mcp: true,
205
+ func: async ({ db }, { todoId }) => {
206
+ return await db.completeTodo(todoId)
207
+ },
208
+ })
209
+
210
+ // functions/todos.mcp.ts
211
+ export const getTodoResource = pikkuMCPResourceFunc({
212
+ uri: 'todos/{id}',
213
+ title: 'Todo Details',
214
+ description: 'Get details of a specific todo',
215
+ func: async ({ db }, { id }, { mcp }) => {
216
+ const todo = await db.getTodo(id)
217
+ return [{ uri: mcp.uri!, text: JSON.stringify(todo) }]
218
+ },
219
+ })
220
+
221
+ export const planDayPrompt = pikkuMCPPromptFunc({
222
+ name: 'planDay',
223
+ description: 'Create a daily plan based on pending todos',
224
+ func: async ({ db }, {}) => {
225
+ const { todos } = await db.listTodos('pending')
226
+ return [
227
+ {
228
+ role: 'user',
229
+ content: {
230
+ type: 'text',
231
+ text: `Plan my day. Here are my pending todos:\n${todos.map((t) => `- ${t.text} (${t.priority})`).join('\n')}`,
232
+ },
233
+ },
234
+ ]
235
+ },
236
+ })
237
+ ```
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: pikku-mongodb
3
+ description: 'Use when setting up MongoDB database services in a Pikku app. Covers PikkuMongoDB connection, channel stores, workflow services, secret services, AI storage, agent runs, and deployment services.
4
+ TRIGGER when: code uses PikkuMongoDB, MongoDBChannelStore, MongoDBWorkflowService, MongoDBSecretService, or user asks about MongoDB setup with Pikku.
5
+ DO NOT TRIGGER when: user asks about SQL databases (use pikku-kysely) or Redis (use pikku-redis).'
6
+ ---
7
+
8
+ # Pikku MongoDB
9
+
10
+ ## Agent Operating Procedure
11
+
12
+ Use this skill as an execution checklist, not reference material.
13
+
14
+ 1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
15
+ 2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
16
+ 3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
17
+ 4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
18
+ 5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
19
+
20
+ `@pikku/mongodb` provides MongoDB-backed implementations of Pikku's core service interfaces.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ yarn add @pikku/mongodb
26
+ ```
27
+
28
+ ## API Reference
29
+
30
+ ### `PikkuMongoDB` (Connection Wrapper)
31
+
32
+ ```typescript
33
+ import { PikkuMongoDB } from '@pikku/mongodb'
34
+
35
+ const mongo = new PikkuMongoDB(
36
+ logger: Logger,
37
+ clientOrUri: MongoClient | string,
38
+ dbName: string,
39
+ options?: MongoClientOptions
40
+ )
41
+
42
+ await mongo.init()
43
+ mongo.db // Db instance for queries
44
+ await mongo.close()
45
+ ```
46
+
47
+ ### Available Services
48
+
49
+ | Service | Interface | Purpose |
50
+ | --------------------------- | ------------------------------------- | ---------------------------------------------- |
51
+ | `MongoDBChannelStore` | `ChannelStore` | WebSocket channel state persistence |
52
+ | `MongoDBEventHubStore` | `EventHubStore` | Event hub state persistence |
53
+ | `MongoDBWorkflowService` | `PikkuWorkflowService` | Workflow definition storage |
54
+ | `MongoDBWorkflowRunService` | `WorkflowRunService` | Workflow execution tracking |
55
+ | `MongoDBDeploymentService` | `DeploymentService` | Deployment state management |
56
+ | `MongoDBAIStorageService` | `AIStorageService, AIRunStateService` | AI conversation/run storage |
57
+ | `MongoDBAgentRunService` | `AgentRunService` | Agent execution tracking |
58
+ | `MongoDBSecretService` | `SecretService` | Encrypted secret storage (envelope encryption) |
59
+
60
+ All services take a `Db` instance in their constructor and have an `init()` method that creates collections/indexes.
61
+
62
+ ### Secret Service
63
+
64
+ ```typescript
65
+ import { MongoDBSecretService } from '@pikku/mongodb'
66
+
67
+ const secrets = new MongoDBSecretService(mongo.db, {
68
+ kekSecret: 'your-key-encryption-key',
69
+ salt: 'your-salt',
70
+ })
71
+ await secrets.init()
72
+
73
+ await secrets.setSecretJSON('api-key', { key: 'sk-...' })
74
+ const value = await secrets.getSecretJSON<{ key: string }>('api-key')
75
+ await secrets.rotateKEK()
76
+ ```
77
+
78
+ ## Usage Patterns
79
+
80
+ ### Full Setup
81
+
82
+ ```typescript
83
+ import {
84
+ PikkuMongoDB,
85
+ MongoDBChannelStore,
86
+ MongoDBWorkflowService,
87
+ } from '@pikku/mongodb'
88
+
89
+ const createSingletonServices = pikkuServices(async (config) => {
90
+ const logger = new PinoLogger()
91
+ const mongo = new PikkuMongoDB(logger, config.mongoUri, 'myapp')
92
+ await mongo.init()
93
+
94
+ const channelStore = new MongoDBChannelStore(mongo.db)
95
+ await channelStore.init()
96
+
97
+ const workflowService = new MongoDBWorkflowService(mongo.db)
98
+ await workflowService.init()
99
+
100
+ return { config, logger, database: mongo, channelStore, workflowService }
101
+ })
102
+ ```
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: pikku-n8n-addon-map
3
+ description: 'Use when mapping n8n integration stubs (gmailTool, slackTool, googleSheetsTool, plain gmail/slack action nodes, etc.) emitted by @pikku/n8n-import to real `@pikku/addon-*` functions. Triggered when the user points at a `<workflow>.integrations.json` manifest produced by `pikku-n8n-import`, says ''map the n8n integrations'', ''wire up the gmail/slack stubs'', ''replace these stubs with addon refs'', or opens a stub file generated from an n8n integration node (the stub''s JSDoc says `STUB — generated from n8n node "..." (type "n8n-nodes-base.<service>...")`). For n8n **Code** node stubs use `pikku-n8n-code-translate` instead.'
4
+ metadata:
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # n8n Integration Stub → Pikku Addon Mapper
9
+
10
+ ## Agent Operating Procedure
11
+
12
+ Use this skill as an execution checklist, not reference material.
13
+
14
+ 1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
15
+ 2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
16
+ 3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
17
+ 4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
18
+ 5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
19
+
20
+ You are translating n8n integration nodes (`gmailTool`, `slackTool`, `googleSheetsTool`, plain `gmail` / `slack` action nodes, etc.) that `@pikku/n8n-import` left as throwing stubs into real `ref('<addonRpc>')` references that point at functions in installed `@pikku/addon-*` packages.
21
+
22
+ This skill is **per-stub mechanical**. You do not invent business logic, you do not chain calls, you do not "improve" the workflow. You read one entry from a manifest, find the matching addon function, and rewrite the stub.
23
+
24
+ ## Inputs
25
+
26
+ 1. **Manifest file** — `<workflow>.integrations.json` next to the workflow `.graph.ts`. Each entry:
27
+ ```jsonc
28
+ {
29
+ "rpcName": "agentGmailtool__sendAMessageInGmail",
30
+ "n8nType": "n8n-nodes-base.gmailTool",
31
+ "n8nName": "Send a message in Gmail",
32
+ "parameters": { "sendTo": "...", "message": "...", "subject": "..." },
33
+ "credentials": {
34
+ "gmailOAuth2": { "id": "...", "name": "Personal Gmail" },
35
+ },
36
+ "isAgentTool": true,
37
+ "agentName": "Inbox Assistant",
38
+ }
39
+ ```
40
+ 2. **Installed addons** — anything matching `@pikku/addon-*` in the project's `package.json` `dependencies`. The mapping is _only_ allowed against installed packages. If the addon for a given n8n type is not installed, surface that — do not silently skip and do not pick a vaguely-named function from another addon.
41
+
42
+ ## What you actually do, in order
43
+
44
+ For **each** entry in the manifest:
45
+
46
+ ### Step 1 — identify the target addon
47
+
48
+ Map `n8nType` to a `@pikku/addon-*` package by reading its source. Common shapes:
49
+
50
+ | n8n type prefix | typical addon package candidate(s) |
51
+ | ------------------------------------------ | ---------------------------------- |
52
+ | `n8n-nodes-base.gmail` / `gmailTool` | `@pikku/addon-email-gmail` |
53
+ | `n8n-nodes-base.slack` / `slackTool` | `@pikku/addon-chat-slack` |
54
+ | `n8n-nodes-base.googleSheets` / `…Tool` | `@pikku/addon-sheets-google` |
55
+ | `n8n-nodes-base.notion` / `notionTool` | `@pikku/addon-docs-notion` |
56
+ | `n8n-nodes-base.telegram` / `telegramTool` | `@pikku/addon-chat-telegram` |
57
+
58
+ **These are guesses, not authoritative.** Always verify by reading the installed addon's `src/functions/**` to confirm the exported function names exist. If you cannot find an installed addon that plausibly covers this n8n type, stop and tell the user — do not pick a wrong addon.
59
+
60
+ ### Step 2 — pick the function (resource + operation → fn name)
61
+
62
+ n8n integration nodes use a `(resource, operation)` pair to disambiguate. The mapping rubric:
63
+
64
+ - `resource` defaults to the integration's primary noun if absent (gmail → `message`, slack → `message`, sheets → `spreadsheet`, etc.). Look at the addon's folder structure (`messages/`, `drafts/`, `channels/`) to see what nouns exist.
65
+ - `operation` is usually a verb (`get`, `getAll`, `send`, `delete`, `addLabels`, `markAsRead`, `create`).
66
+ - The pikku addon function name is almost always `<resource><Verb>` in camelCase, matching the file's `export const` (e.g. `messageList` for `messages/list.function.ts`, `draftCreate` for `drafts/create.function.ts`).
67
+
68
+ Verify by `grep -h "^export const" <addonPkg>/src/functions/**/*.ts` and matching by name.
69
+
70
+ Conventions seen in `@pikku/addon-email-gmail` (use as a sanity reference, **not** as a fallback if the addon is something else):
71
+
72
+ - `getAll` → `<resource>List`
73
+ - `get` → `<resource>Get`
74
+ - `send` → `<resource>Send`
75
+ - `delete` → `<resource>Delete`
76
+ - `reply` → `<resource>Reply`
77
+ - `addLabels` → `<resource>AddLabel` (singular!)
78
+ - `removeLabels` → `<resource>RemoveLabel`
79
+ - `markAsRead` / `markAsUnread` → `<resource>MarkRead` / `<resource>MarkUnread`
80
+ - `create` (drafts/labels) → `<resource>Create`
81
+
82
+ If the addon has a `node:` block on the function, prefer matching on that block's `category`/`displayName` over guessing — read the source.
83
+
84
+ ### Step 3 — rewrite the stub
85
+
86
+ The stub file currently looks like:
87
+
88
+ ```ts
89
+ import { z } from 'zod'
90
+ import { pikkuSessionlessFunc } from '#pikku'
91
+
92
+ export const AgentGmailtoolSendAMessageInGmailInput = z.object({
93
+ items: z.array(z.unknown()).optional(),
94
+ })
95
+ export const AgentGmailtoolSendAMessageInGmailOutput = z.object({
96
+ items: z.array(z.unknown()),
97
+ })
98
+
99
+ /** STUB — generated from n8n node "Send a message in Gmail" (type "n8n-nodes-base.gmailTool"). … */
100
+ export const agentGmailtool__sendAMessageInGmail = pikkuSessionlessFunc({
101
+ func: async () => {
102
+ throw new Error('agentGmailtool__sendAMessageInGmail — implement me')
103
+ },
104
+ })
105
+ ```
106
+
107
+ **There are two outcomes**, depending on `isAgentTool`:
108
+
109
+ #### A) `isAgentTool: true` — the stub is consumed by an agent via `ref()`
110
+
111
+ The agent file references the stub by its export name. The cleanest path is:
112
+
113
+ 1. **Delete the stub file entirely.**
114
+ 2. In the agent file (look in the same emitted directory or `src/functions`), update the agent's `tools: [...]` array — replace `ref('agentGmailtool__sendAMessageInGmail')` with `ref('messageSend')` (or whichever addon function name you resolved).
115
+ 3. Make sure the addon package is imported wherever pikku scans functions (typically already handled by pikku CLI scanning `node_modules/@pikku/addon-*`).
116
+
117
+ If you cannot delete the stub safely (e.g. it has multiple consumers, or the user wants to keep a thin wrapper for renaming), leave a _one-line_ re-export wrapper instead:
118
+
119
+ ```ts
120
+ import { messageSend } from '@pikku/addon-email-gmail'
121
+ export const agentGmailtool__sendAMessageInGmail = messageSend
122
+ ```
123
+
124
+ But the default is delete + retarget. Wrappers add maintenance burden.
125
+
126
+ #### B) `isAgentTool: false` — the stub is part of the workflow graph proper
127
+
128
+ 1. Open the workflow `.graph.ts` file.
129
+ 2. Find the entry in `nodes: { … }` whose value is the stub's rpc name (e.g. `'agentGmailtool__sendAMessageInGmail'`).
130
+ 3. Replace the value with the addon function name (e.g. `'messageSend'`).
131
+ 4. If the workflow's `config: { <id>: { input: … } }` block has an `input` expression that produces an `{ items }` envelope, rewrite it to produce the addon's actual input schema (read the addon function's `input: z.object({...})` to know the shape).
132
+ 5. Delete the stub file.
133
+
134
+ ### Step 4 — port hard-coded parameters
135
+
136
+ n8n parameters fall into two camps:
137
+
138
+ - **Hardcoded values** (e.g. `"limit": 20`, `"labelIds": ["INBOX"]`, `"sendTo": "alice@example.com"`) — these were user choices in the n8n UI. Preserve them in the workflow's `input` expression (case B), or, for agent tools (case A), document them in the agent's tool list comment so the user knows what was lost. **Agent tools cannot carry hardcoded params** — the LLM fills the args at call time. If the user _needs_ a hardcoded value baked in, they must keep a wrapper function. Surface this trade-off explicitly.
139
+ - **`$fromAI('Name', '', 'string')` placeholders** — these are LLM-filled. They map naturally to addon function input fields the LLM will populate via the `pikkuAIAgent`'s tool-calling. No action needed beyond deleting the placeholder string; the addon's Zod schema becomes the tool schema.
140
+
141
+ ### Step 5 — credentials
142
+
143
+ Each entry's `credentials: { gmailOAuth2: { id, name } }` is the n8n credential reference. Pikku addons typically expect a service (e.g. `services.gmail`) wired in `services.ts`. Do **not** attempt to auto-wire — append a one-line note for the user:
144
+
145
+ > `// TODO: wire services.gmail using credential "Personal Gmail" (n8n id: gmail_cred_1) — see @pikku/addon-email-gmail/README.md`
146
+
147
+ …either at the top of the workflow file or printed in your final summary.
148
+
149
+ ## What you must NOT do
150
+
151
+ - **Do not invent functions** in addon packages that don't exist. Grep first.
152
+ - **Do not pick the wrong addon** because the right one isn't installed. Stop and tell the user `npm i @pikku/addon-<x>` is required.
153
+ - **Do not bake per-mapping tables into `@pikku/n8n-import`.** That package is intentionally addon-agnostic. All mapping logic lives here in this skill.
154
+ - **Do not modify the manifest file.** It's an audit artifact. Leave it alone.
155
+ - **Do not chain calls** ("send and then mark as read"). Each manifest entry maps to _one_ addon function. If the n8n graph composed multiple steps, the n8n-import already represented that as multiple stubs / multiple workflow nodes.
156
+ - **Do not silently drop hardcoded params.** If the addon function has no place to put a value, surface it in the summary.
157
+
158
+ ## After you finish
159
+
160
+ Print a short summary to the user:
161
+
162
+ ```
163
+ Mapped 3 of 5 stubs:
164
+ ✓ agentGmailtool__sendAMessageInGmail → ref('messageSend') [agent tool: Inbox Assistant]
165
+ ✓ agentGmailtool__getManyMessagesInGmail → ref('messageList') [agent tool: Inbox Assistant]
166
+ ✓ workflow node 'updateRow' → 'sheetRowAppend' [graph node]
167
+
168
+ Unmapped:
169
+ ✗ slackTool 'Post to channel' — @pikku/addon-chat-slack not installed (npm i @pikku/addon-chat-slack)
170
+ ✗ notionTool 'Create page' — no `pageCreate` in @pikku/addon-docs-notion (only `pageGet`, `pageUpdate`)
171
+
172
+ Hardcoded params worth knowing:
173
+ • Get many messages in Gmail had limit=20, labelIds=["INBOX"] — agent tools cannot pin these; if you need them fixed, add a thin wrapper function.
174
+
175
+ Credential wiring TODOs added to the top of agentGmailtool.graph.ts.
176
+ ```
177
+
178
+ Be terse. The user already knows the workflow context — they pointed you at the manifest.
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: pikku-n8n-code-translate
3
+ description: "Use when translating an n8n Code node body into a real Pikku function body. Triggered when the user opens or points at a stub generated by @pikku/n8n-import (look for `STUB — generated from n8n Code node` in the file's JSDoc), or when the user says 'translate this n8n code', 'port this n8n code node', 'finish the codeStub__... function', etc. The stub file is a `pikkuSessionlessFunc` with a Zod input/output, a JSDoc preserving the original n8n JavaScript verbatim, and a `throw new Error('… — implement me')` body."
4
+ metadata:
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # n8n Code Node → Pikku Function Translator
9
+
10
+ ## Agent Operating Procedure
11
+
12
+ Use this skill as an execution checklist, not reference material.
13
+
14
+ 1. Discover before editing. Prefer OpenCode tools such as `pikku-meta` when available; otherwise run the relevant `pikku meta ... --json` command and inspect only the focused output you need.
15
+ 2. Identify the source files that own the behavior. Do not start by reading generated output, `.pikku`, `node_modules`, vendored packages, or broad build artifacts.
16
+ 3. Make the smallest source change that satisfies the task. Keep generated files generated, and avoid hand-editing SDKs, schema output, or typegen.
17
+ 4. Validate with the narrowest relevant command first, then run `pikku-verify` or `pikku all` when functions, wirings, schemas, or generated clients may have changed.
18
+ 5. If validation fails, fix the source cause and rerun validation. Do not paper over generated errors by editing generated files.
19
+
20
+ You are translating an n8n **Code node** body into a Pikku `pikkuSessionlessFunc` body. The original JavaScript is preserved verbatim in the JSDoc above the function. Your job: replace the `throw new Error(...)` body with a faithful TypeScript reimplementation, keep the function signature and the JSDoc intact, and only widen the Zod input/output if the original code's data shape demands it.
21
+
22
+ This is a **narrow, mechanical translation**. Do not "improve" the logic, refactor for style, add error handling, or invent fields. The goal is behavioral parity, not better code.
23
+
24
+ ## Process
25
+
26
+ 1. **Read the file** the user points you at. Identify:
27
+ - The exported input schema (e.g. `CodeStubCustomCodeInput`)
28
+ - The exported output schema (e.g. `CodeStubCustomCodeOutput`)
29
+ - The verbatim JavaScript inside the JSDoc block
30
+ - The function name and `pikkuSessionlessFunc` shape
31
+ 2. **Determine the n8n mode** from the original n8n JSON if available (the importer leaves the JSON on disk in `fixtures/` or you can ask the user). The two modes:
32
+ - `runOnceForAllItems` (default) — code runs once with `items: Array<{ json, binary, pairedItem }>` in scope, returns an array of envelopes.
33
+ - `runOnceForEachItem` — code runs once per input item, with `$json` / `$input.item.json` in scope, returns a single envelope.
34
+ If you can't determine the mode, infer from the code: bare `items.X` → all-items; bare `$json.X` or `$input.item.X` → each-item.
35
+ 3. **Apply the rubric below** to translate.
36
+ 4. **Edit the file** to replace only the function body. Leave the import block, schema definitions, JSDoc, function name, description, and Zod refs untouched unless step 5 forces a change.
37
+ 5. **If the schemas are wrong** (e.g. the code reads `$json.userId: string` but the input schema is `items: z.array(z.unknown())`), tighten the schemas with the smallest change that lets the code compile. Prefer `z.unknown()` over `z.any()`. Never widen output to `z.any()`.
38
+ 6. **Add a one-line comment at the top of the body** noting the n8n mode you assumed: `// translated from n8n Code node, mode: runOnceForAllItems`. This is the _only_ comment you may add.
39
+ 7. **Run the test/typecheck** if available (`yarn tsc` from the package root). Fix any type errors with the smallest viable change.
40
+
41
+ ## Translation rubric
42
+
43
+ ### Envelope unwrapping (all-items mode)
44
+
45
+ The n8n `items` is an array of `{ json, binary, pairedItem }` envelopes. In Pikku, the input is typed — `data.items` is the payload array. Translate by treating `items[i]` as the payload directly.
46
+
47
+ | n8n | Pikku |
48
+ | -------------------------- | ------------------------------------------------- |
49
+ | `items` | `(data.items ?? []) as any[]` (or typed if known) |
50
+ | `items[i].json.X` | `items[i].X` |
51
+ | `items[i].json` | `items[i]` |
52
+ | `items[i].binary` | **NOT supported** — leave a TODO and explain |
53
+ | `items.length` | `items.length` |
54
+ | `items.map(i => i.json.X)` | `items.map((i: any) => i.X)` |
55
+
56
+ ### Envelope unwrapping (each-item mode)
57
+
58
+ | n8n | Pikku |
59
+ | -------------------------------- | ------------------------------------------------- |
60
+ | `$json.X` / `$input.item.json.X` | `data.X` (assuming input is the item itself) |
61
+ | `$input.item.json` | `data` |
62
+ | `$input.all()` | not available per-item — change to all-items mode |
63
+
64
+ ### Return statement
65
+
66
+ | n8n | Pikku |
67
+ | ---------------------------------------- | ----------------------------------------------------------- |
68
+ | `return [{ json: X }]` | `return { items: [X] }` |
69
+ | `return items.map(i => ({ json: ... }))` | `return { items: items.map(...) }` |
70
+ | `return [{ json: X }, { json: Y }]` | `return { items: [X, Y] }` |
71
+ | `return { json: X }` (each-item) | `return X` |
72
+ | `return [...]` (already plain) | wrap in `{ items: [...] }` only if output schema expects it |
73
+
74
+ ### n8n built-ins and helpers — do NOT auto-translate
75
+
76
+ If the code references **any** of the following, **stop**, leave the body as a stub, and ask the user how to handle it (or annotate with a `// TODO:` line and explain in your reply):
77
+
78
+ - `this.helpers.*` (binary buffers, HTTP requests, prepareBinaryData, etc.)
79
+ - `$node['Some Node'].json` (cross-node references — these need to be resolved via Pikku's `ref()` upstream wiring, not in the function body)
80
+ - `$workflow`, `$execution`, `$item()`, `$items('Other Node')`
81
+ - `$now`, `$today`, `$env.X` — translate to `new Date()`, `new Date()`, and `services.variables.get('X')` respectively, but only if the function signature lets you reach `services` (it does — first param). NOTE: `process.env` is forbidden per Pikku house rules; always use `services.variables.get()`.
82
+ - `getBinaryDataBuffer` / `getStaticData` — Pikku has no equivalent, leave a TODO
83
+ - `require()` / dynamic `import()` — flag and stop
84
+
85
+ ### Async
86
+
87
+ - If the original uses `await`, the Pikku body is already `async` — keep all `await` calls intact.
88
+ - If the original references `this.helpers.httpRequest(...)`, **do not translate** — the user should use a separate `httpRequest` rpc node in the workflow, not embed the call. Leave a `// TODO:` and explain.
89
+
90
+ ### Types
91
+
92
+ - Cast incoming `items` as `any[]` only if the schema is `z.array(z.unknown())`. If the user has tightened the schema, use the inferred type.
93
+ - Never use `as any` on the _return_ value. If the return doesn't match the output schema, the schema is wrong — fix it (step 5).
94
+
95
+ ## Example
96
+
97
+ ### Before (stub the importer emitted)
98
+
99
+ ```ts
100
+ import { z } from 'zod'
101
+ import { pikkuSessionlessFunc } from '#pikku'
102
+
103
+ export const CodeStubCustomCodeInput = z.object({
104
+ items: z.array(z.unknown()),
105
+ })
106
+
107
+ export const CodeStubCustomCodeOutput = z.object({
108
+ items: z.array(z.unknown()),
109
+ })
110
+
111
+ /**
112
+ * STUB — generated from n8n Code node "Custom Code".
113
+ *
114
+ * Original n8n JavaScript (preserved verbatim for reference; rewrite for Pikku semantics):
115
+ *
116
+ * const total = items.reduce((acc, i) => acc + i.json.amount, 0);
117
+ * return [{ json: { total } }];
118
+ *
119
+ * TODO: re-implement in TypeScript. ...
120
+ */
121
+ export const codeStubCustomCode = pikkuSessionlessFunc({
122
+ description: 'Stub: ported from n8n Code node "Custom Code"',
123
+ input: CodeStubCustomCodeInput,
124
+ output: CodeStubCustomCodeOutput,
125
+ func: async (_services, _data) => {
126
+ throw new Error(
127
+ 'Stub: ported from n8n Code node "Custom Code" — implement me'
128
+ )
129
+ },
130
+ })
131
+ ```
132
+
133
+ ### After (your output)
134
+
135
+ ```ts
136
+ export const codeStubCustomCode = pikkuSessionlessFunc({
137
+ description: 'Ported from n8n Code node "Custom Code"',
138
+ input: CodeStubCustomCodeInput,
139
+ output: CodeStubCustomCodeOutput,
140
+ func: async (_services, data) => {
141
+ // translated from n8n Code node, mode: runOnceForAllItems
142
+ const items = (data.items ?? []) as any[]
143
+ const total = items.reduce((acc, i) => acc + i.amount, 0)
144
+ return { items: [{ total }] }
145
+ },
146
+ })
147
+ ```
148
+
149
+ ## What you should report back to the user
150
+
151
+ A short summary, no fluff:
152
+
153
+ - The mode you inferred and why (one sentence).
154
+ - The literal translations you applied from the rubric (e.g. `items[i].json.amount → items[i].amount`).
155
+ - Anything you flagged as a TODO and why.
156
+ - Any schema tightening you did (with before → after).
157
+
158
+ Do **not**:
159
+
160
+ - Add tests
161
+ - Refactor surrounding code
162
+ - Edit other files unless the user asked
163
+ - "Improve" the logic
164
+ - Wrap things in `try/catch` unless the original did
165
+
166
+ If the original is empty, contains only comments, or is so dependent on n8n internals (binary, cross-node refs, helpers) that no honest translation is possible, leave the stub in place and tell the user which n8n features are blocking it.