@pikku/cli 0.12.82 → 0.12.85

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 (346) hide show
  1. package/cli.schema.json +1 -1
  2. package/console-app/assets/{index-ChcXIEhS.js → index-CEv-kj3J.js} +154 -147
  3. package/console-app/assets/index-CSzCJzBb.css +1 -0
  4. package/console-app/index.html +2 -2
  5. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +4 -2
  6. package/dist/.pikku/auth/auth.types.d.ts +4 -0
  7. package/dist/.pikku/auth/auth.types.js +5 -0
  8. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  9. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  10. package/dist/.pikku/cli/pikku-cli-channel.d.ts +4 -4
  11. package/dist/.pikku/cli/pikku-cli-channel.js +21 -1
  12. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  13. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  14. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
  15. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
  16. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  17. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  18. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  19. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +60 -3
  20. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  21. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  22. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  23. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  24. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  25. package/dist/.pikku/function/pikku-function-types.gen.d.ts +29 -25
  26. package/dist/.pikku/function/pikku-function-types.gen.js +3 -12
  27. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  28. package/dist/.pikku/function/pikku-functions-meta.gen.json +195 -32
  29. package/dist/.pikku/function/pikku-functions.gen.js +15 -3
  30. package/dist/.pikku/http/pikku-http-types.gen.d.ts +2 -24
  31. package/dist/.pikku/http/pikku-http-types.gen.js +2 -24
  32. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  33. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  34. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -5
  35. package/dist/.pikku/pikku-bootstrap.gen.js +1 -5
  36. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  37. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  38. package/dist/.pikku/pikku-services.gen.d.ts +4 -1
  39. package/dist/.pikku/pikku-services.gen.js +3 -0
  40. package/dist/.pikku/pikku-types.gen.d.ts +2 -1
  41. package/dist/.pikku/pikku-types.gen.js +3 -1
  42. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  43. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  44. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  45. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +10 -2
  46. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  47. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  48. package/dist/.pikku/schemas/register.gen.js +13 -7
  49. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  50. package/dist/.pikku/schemas/schemas/PikkuGraphWiringsOutput.schema.json +1 -0
  51. package/dist/.pikku/schemas/schemas/PikkuImportN8nInput.schema.json +1 -0
  52. package/dist/.pikku/schemas/schemas/PikkuScopesInput.schema.json +1 -0
  53. package/dist/.pikku/schemas/schemas/PikkuWebhookOutput.schema.json +1 -0
  54. package/dist/.pikku/schemas/schemas/ScopesAuditInput.schema.json +1 -0
  55. package/dist/.pikku/schemas/schemas/ScopesPruneInput.schema.json +1 -0
  56. package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +5 -0
  57. package/dist/.pikku/scopes/pikku-scope-types.gen.js +4 -0
  58. package/dist/.pikku/scopes/pikku-scopes-meta.gen.json +1 -0
  59. package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +35 -0
  60. package/dist/.pikku/scopes/pikku-scopes.gen.js +27 -0
  61. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  62. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  63. package/dist/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
  64. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +11 -1
  65. package/dist/.pikku/secrets/pikku-secrets.gen.js +11 -1
  66. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  67. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  68. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  69. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  70. package/dist/.pikku/variables/pikku-variables-meta.gen.json +1 -0
  71. package/dist/.pikku/variables/pikku-variables.gen.d.ts +11 -1
  72. package/dist/.pikku/variables/pikku-variables.gen.js +13 -3
  73. package/dist/.pikku/workflow/meta/allWorkflow.gen.json +49 -7
  74. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +11 -2
  75. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  76. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  77. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  78. package/dist/bin/pikku-bin.mjs +2 -2
  79. package/dist/src/cli.wiring.js +47 -4
  80. package/dist/src/deploy/analyzer/analyzer.js +6 -0
  81. package/dist/src/fabric/fabric-commands.d.ts +53 -53
  82. package/dist/src/fabric/functions/add.function.d.ts +2 -2
  83. package/dist/src/fabric/functions/addon-verify.function.d.ts +2 -2
  84. package/dist/src/fabric/functions/db-schema.function.d.ts +2 -2
  85. package/dist/src/fabric/functions/deploy-list.function.d.ts +2 -2
  86. package/dist/src/fabric/functions/deploy-units.function.d.ts +2 -2
  87. package/dist/src/fabric/functions/deploy.function.d.ts +4 -4
  88. package/dist/src/fabric/functions/domains-add.function.d.ts +2 -2
  89. package/dist/src/fabric/functions/domains-list.function.d.ts +2 -2
  90. package/dist/src/fabric/functions/domains-remove.function.d.ts +2 -2
  91. package/dist/src/fabric/functions/errors.function.d.ts +2 -2
  92. package/dist/src/fabric/functions/init.function.d.ts +2 -2
  93. package/dist/src/fabric/functions/link.function.d.ts +2 -2
  94. package/dist/src/fabric/functions/llm-key.function.d.ts +6 -6
  95. package/dist/src/fabric/functions/login.function.d.ts +2 -2
  96. package/dist/src/fabric/functions/logs.function.d.ts +2 -2
  97. package/dist/src/fabric/functions/metrics.function.d.ts +2 -2
  98. package/dist/src/fabric/functions/publish.function.d.ts +2 -2
  99. package/dist/src/fabric/functions/rollback.function.d.ts +2 -2
  100. package/dist/src/fabric/functions/secrets-list.function.d.ts +2 -2
  101. package/dist/src/fabric/functions/secrets-set.function.d.ts +2 -2
  102. package/dist/src/fabric/functions/smoke.function.d.ts +2 -2
  103. package/dist/src/fabric/functions/status.function.d.ts +2 -2
  104. package/dist/src/fabric/functions/trace.function.d.ts +2 -2
  105. package/dist/src/fabric/functions/validate.function.d.ts +2 -2
  106. package/dist/src/functions/commands/all.d.ts +1 -1
  107. package/dist/src/functions/commands/audit.d.ts +1 -1
  108. package/dist/src/functions/commands/binary.d.ts +2 -2
  109. package/dist/src/functions/commands/bootstrap.d.ts +1 -1
  110. package/dist/src/functions/commands/bootstrap.js +3 -0
  111. package/dist/src/functions/commands/db-audit.d.ts +1 -1
  112. package/dist/src/functions/commands/db-generate.d.ts +1 -1
  113. package/dist/src/functions/commands/db-migrate.d.ts +1 -1
  114. package/dist/src/functions/commands/db-reset.d.ts +1 -1
  115. package/dist/src/functions/commands/db-seed.d.ts +1 -1
  116. package/dist/src/functions/commands/deploy-apply.d.ts +2 -2
  117. package/dist/src/functions/commands/deploy-info.d.ts +1 -1
  118. package/dist/src/functions/commands/deploy-plan.d.ts +2 -2
  119. package/dist/src/functions/commands/dev.d.ts +2 -2
  120. package/dist/src/functions/commands/dev.js +14 -3
  121. package/dist/src/functions/commands/emails-init.d.ts +1 -1
  122. package/dist/src/functions/commands/enable.d.ts +8 -7
  123. package/dist/src/functions/commands/enable.js +10 -5
  124. package/dist/src/functions/commands/import-n8n.d.ts +10 -0
  125. package/dist/src/functions/commands/import-n8n.js +130 -0
  126. package/dist/src/functions/commands/info.d.ts +4 -4
  127. package/dist/src/functions/commands/info.js +0 -13
  128. package/dist/src/functions/commands/login.d.ts +5 -5
  129. package/dist/src/functions/commands/meta.d.ts +25 -25
  130. package/dist/src/functions/commands/new-addon.d.ts +13 -2
  131. package/dist/src/functions/commands/new-addon.js +71 -39
  132. package/dist/src/functions/commands/new-function.d.ts +2 -2
  133. package/dist/src/functions/commands/new-middleware.d.ts +2 -2
  134. package/dist/src/functions/commands/new-permission.d.ts +2 -2
  135. package/dist/src/functions/commands/new-wiring.d.ts +2 -2
  136. package/dist/src/functions/commands/pikku-command-bootstrap.d.ts +1 -1
  137. package/dist/src/functions/commands/pikku-command-bootstrap.js +6 -0
  138. package/dist/src/functions/commands/pikku-command-summary.d.ts +1 -1
  139. package/dist/src/functions/commands/scenario.d.ts +3 -3
  140. package/dist/src/functions/commands/scopes-audit.d.ts +1 -0
  141. package/dist/src/functions/commands/scopes-audit.js +37 -0
  142. package/dist/src/functions/commands/scopes-prune.d.ts +14 -0
  143. package/dist/src/functions/commands/scopes-prune.js +50 -0
  144. package/dist/src/functions/commands/scopes-shared.d.ts +39 -0
  145. package/dist/src/functions/commands/scopes-shared.js +83 -0
  146. package/dist/src/functions/commands/serve.d.ts +2 -2
  147. package/dist/src/functions/commands/serve.js +4 -2
  148. package/dist/src/functions/commands/skills.d.ts +4 -4
  149. package/dist/src/functions/commands/skills.js +18 -10
  150. package/dist/src/functions/commands/versions-check.d.ts +1 -1
  151. package/dist/src/functions/commands/versions-init.d.ts +2 -2
  152. package/dist/src/functions/commands/versions-update.d.ts +1 -1
  153. package/dist/src/functions/commands/watch.d.ts +2 -2
  154. package/dist/src/functions/commands/workspace-validate.d.ts +2 -2
  155. package/dist/src/functions/runtimes/fetch/index.d.ts +1 -1
  156. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -1
  157. package/dist/src/functions/runtimes/tanstack-start/pikku-command-tanstack-start.d.ts +1 -1
  158. package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.d.ts +1 -1
  159. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.d.ts +1 -1
  160. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.js +3 -2
  161. package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.d.ts +1 -1
  162. package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.d.ts +1 -1
  163. package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.d.ts +1 -1
  164. package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.js +4 -2
  165. package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +55 -16
  166. package/dist/src/functions/wirings/auth/pikku-command-auth.d.ts +2 -2
  167. package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
  168. package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -1
  169. package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -1
  170. package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -1
  171. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -1
  172. package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +1 -1
  173. package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -1
  174. package/dist/src/functions/wirings/console/pikku-command-console-functions.d.ts +1 -1
  175. package/dist/src/functions/wirings/console/pikku-command-node-types.d.ts +1 -1
  176. package/dist/src/functions/wirings/console/pikku-command-nodes-meta.d.ts +1 -1
  177. package/dist/src/functions/wirings/console/serialize-console-functions.js +6 -0
  178. package/dist/src/functions/wirings/credentials/pikku-command-credentials.d.ts +1 -1
  179. package/dist/src/functions/wirings/credentials/serialize-credentials-types.js +22 -0
  180. package/dist/src/functions/wirings/emails/pikku-command-emails.d.ts +1 -1
  181. package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +1 -1
  182. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +2 -2
  183. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
  184. package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +2 -2
  185. package/dist/src/functions/wirings/functions/pikku-command-function-types.js +2 -2
  186. package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
  187. package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +2 -2
  188. package/dist/src/functions/wirings/functions/pikku-command-services.js +9 -2
  189. package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
  190. package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
  191. package/dist/src/functions/wirings/functions/serialize-function-types.js +37 -28
  192. package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.d.ts +1 -1
  193. package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +6 -2
  194. package/dist/src/functions/wirings/gateway/pikku-command-gateway.d.ts +1 -1
  195. package/dist/src/functions/wirings/graph/pikku-command-graph-wirings.d.ts +1 -0
  196. package/dist/src/functions/wirings/graph/pikku-command-graph-wirings.js +21 -0
  197. package/dist/src/functions/wirings/graph/serialize-graph-wirings.d.ts +5 -0
  198. package/dist/src/functions/wirings/graph/serialize-graph-wirings.js +14 -0
  199. package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -1
  200. package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -1
  201. package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -1
  202. package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -1
  203. package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -1
  204. package/dist/src/functions/wirings/http/serialize-http-types.js +2 -30
  205. package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -1
  206. package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -1
  207. package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -1
  208. package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -1
  209. package/dist/src/functions/wirings/package/pikku-command-package-types.d.ts +3 -2
  210. package/dist/src/functions/wirings/package/pikku-command-package-types.js +14 -1
  211. package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -1
  212. package/dist/src/functions/wirings/package/serialize-package-types.d.ts +1 -0
  213. package/dist/src/functions/wirings/package/serialize-package-types.js +5 -0
  214. package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -1
  215. package/dist/src/functions/wirings/permissions/pikku-command-permissions.js +1 -3
  216. package/dist/src/functions/wirings/permissions/serialize-permissions-imports.d.ts +6 -1
  217. package/dist/src/functions/wirings/permissions/serialize-permissions-imports.js +7 -64
  218. package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -1
  219. package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -1
  220. package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -1
  221. package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -1
  222. package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -1
  223. package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -1
  224. package/dist/src/functions/wirings/realtime/pikku-command-events-scaffold.d.ts +1 -1
  225. package/dist/src/functions/wirings/realtime/pikku-command-realtime.d.ts +1 -1
  226. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -1
  227. package/dist/src/functions/wirings/rpc/pikku-command-react-query.d.ts +1 -1
  228. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -1
  229. package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -1
  230. package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +7 -2
  231. package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +20 -0
  232. package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +1 -1
  233. package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.d.ts +1 -0
  234. package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +8 -3
  235. package/dist/src/functions/wirings/scenarios/pikku-command-scenario-functions.d.ts +1 -1
  236. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -1
  237. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -1
  238. package/dist/src/functions/wirings/scopes/pikku-command-scopes.d.ts +7 -0
  239. package/dist/src/functions/wirings/scopes/pikku-command-scopes.js +34 -0
  240. package/dist/src/functions/wirings/scopes/serialize-scopes-types.d.ts +15 -0
  241. package/dist/src/functions/wirings/scopes/serialize-scopes-types.js +86 -0
  242. package/dist/src/functions/wirings/secrets/pikku-command-secrets.d.ts +1 -1
  243. package/dist/src/functions/wirings/secrets/serialize-secrets-types.js +13 -0
  244. package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.d.ts +2 -2
  245. package/dist/src/functions/wirings/triggers/pikku-command-trigger.d.ts +1 -1
  246. package/dist/src/functions/wirings/variables/pikku-command-variables.d.ts +1 -1
  247. package/dist/src/functions/wirings/variables/serialize-variables-types.js +15 -2
  248. package/dist/src/functions/wirings/webhook/pikku-command-webhook.d.ts +1 -0
  249. package/dist/src/functions/wirings/webhook/pikku-command-webhook.js +25 -0
  250. package/dist/src/functions/wirings/webhook/serialize-webhook.d.ts +14 -0
  251. package/dist/src/functions/wirings/webhook/serialize-webhook.js +34 -0
  252. package/dist/src/functions/wirings/workflow/pikku-command-workflow-routes.d.ts +1 -1
  253. package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +1 -1
  254. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +2 -1
  255. package/dist/src/functions/wirings/workflow/serialize-workflow-routes.js +29 -0
  256. package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +1 -1
  257. package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +11 -2
  258. package/dist/src/functions/workflows/all.workflow.js +23 -3
  259. package/dist/src/services.d.ts +1 -0
  260. package/dist/src/services.js +1 -0
  261. package/dist/src/utils/pikku-cli-config.js +20 -0
  262. package/dist/tsconfig.tsbuildinfo +1 -1
  263. package/package.json +9 -8
  264. package/skills/pikku-addon/SKILL.md +7 -3
  265. package/skills/pikku-ai-agent/SKILL.md +9 -6
  266. package/skills/pikku-ai-vercel/SKILL.md +6 -3
  267. package/skills/pikku-ai-voice/SKILL.md +6 -3
  268. package/skills/pikku-audit/SKILL.md +10 -3
  269. package/skills/pikku-aws/SKILL.md +9 -5
  270. package/skills/pikku-backblaze/SKILL.md +4 -3
  271. package/skills/pikku-better-auth/SKILL.md +10 -5
  272. package/skills/pikku-cli/SKILL.md +6 -3
  273. package/skills/pikku-concepts/SKILL.md +9 -4
  274. package/skills/pikku-concepts/references/concept-mapping.md +12 -10
  275. package/skills/pikku-config/SKILL.md +9 -5
  276. package/skills/pikku-cron/SKILL.md +6 -3
  277. package/skills/pikku-deploy-azure/SKILL.md +5 -3
  278. package/skills/pikku-deploy-cloudflare/SKILL.md +5 -3
  279. package/skills/pikku-deploy-express/SKILL.md +6 -3
  280. package/skills/pikku-deploy-fastify/SKILL.md +6 -3
  281. package/skills/pikku-deploy-lambda/SKILL.md +6 -3
  282. package/skills/pikku-deploy-nextjs/SKILL.md +5 -3
  283. package/skills/pikku-deploy-uws/SKILL.md +7 -4
  284. package/skills/pikku-deps/SKILL.md +13 -6
  285. package/skills/pikku-emails/SKILL.md +10 -5
  286. package/skills/pikku-feature/SKILL.md +1 -1
  287. package/skills/pikku-gateway-slack/SKILL.md +6 -3
  288. package/skills/pikku-http/SKILL.md +15 -21
  289. package/skills/pikku-http/references/http-options.md +0 -2
  290. package/skills/pikku-info/SKILL.md +9 -4
  291. package/skills/pikku-jose/SKILL.md +6 -3
  292. package/skills/pikku-kysely/SKILL.md +13 -5
  293. package/skills/pikku-machine-auth/SKILL.md +9 -3
  294. package/skills/pikku-mcp/SKILL.md +7 -3
  295. package/skills/pikku-middleware/SKILL.md +11 -6
  296. package/skills/pikku-mongodb/SKILL.md +8 -5
  297. package/skills/pikku-n8n-import/SKILL.md +109 -0
  298. package/skills/pikku-n8n-import/SPEC.md +84 -0
  299. package/skills/pikku-n8n-import/references/addon-mapping.md +121 -0
  300. package/skills/pikku-n8n-import/references/code-translation.md +121 -0
  301. package/skills/pikku-n8n-import/references/loops-and-control.md +87 -0
  302. package/skills/pikku-permissions/SKILL.md +26 -15
  303. package/skills/pikku-pino/SKILL.md +5 -3
  304. package/skills/pikku-product-second-opinion/README.md +43 -0
  305. package/skills/pikku-product-second-opinion/SKILL.md +158 -0
  306. package/skills/pikku-product-second-opinion/example/sample-report.md +90 -0
  307. package/skills/pikku-product-second-opinion/references/report-template.md +73 -0
  308. package/skills/pikku-queue/SKILL.md +7 -4
  309. package/skills/pikku-redis/SKILL.md +9 -6
  310. package/skills/pikku-rpc/SKILL.md +7 -4
  311. package/skills/pikku-rtl/SKILL.md +1 -1
  312. package/skills/pikku-scenario/SKILL.md +215 -0
  313. package/skills/pikku-schedule/SKILL.md +6 -3
  314. package/skills/pikku-schema-ajv/SKILL.md +5 -3
  315. package/skills/pikku-schema-cfworker/SKILL.md +6 -3
  316. package/skills/pikku-security/SKILL.md +8 -4
  317. package/skills/pikku-services/SKILL.md +42 -4
  318. package/skills/pikku-software-archaeology/README.md +70 -0
  319. package/skills/pikku-software-archaeology/SKILL.md +186 -0
  320. package/skills/pikku-software-archaeology/references/blueprint.schema.json +625 -0
  321. package/skills/pikku-software-archaeology/references/pikku-mapping.md +49 -0
  322. package/skills/pikku-software-archaeology/scripts/validate.mjs +173 -0
  323. package/skills/pikku-template-clone/SKILL.md +1 -1
  324. package/skills/pikku-trigger/SKILL.md +7 -3
  325. package/skills/pikku-versioning/SKILL.md +7 -3
  326. package/skills/pikku-websocket/SKILL.md +8 -4
  327. package/skills/pikku-workflow/SKILL.md +7 -3
  328. package/skills/pikku-ws/SKILL.md +5 -3
  329. package/console-app/assets/index-DwyRdRuZ.css +0 -1
  330. package/dist/.pikku/http/pikku-http-wirings-meta.gen.d.ts +0 -1
  331. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +0 -6
  332. package/dist/.pikku/http/pikku-http-wirings-meta.gen.json +0 -26
  333. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +0 -4
  334. package/dist/.pikku/http/pikku-http-wirings.gen.js +0 -5
  335. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.d.ts +0 -1
  336. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +0 -6
  337. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +0 -10
  338. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +0 -4
  339. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +0 -5
  340. package/dist/.pikku/schemas/schemas/RemoteRPCHandlerInput.schema.json +0 -1
  341. package/dist/src/scaffold/rpc-remote.gen.d.ts +0 -10
  342. package/dist/src/scaffold/rpc-remote.gen.js +0 -27
  343. package/skills/pikku-n8n-addon-map/SKILL.md +0 -178
  344. package/skills/pikku-n8n-code-translate/SKILL.md +0 -166
  345. package/skills/pikku-testing/SKILL.md +0 -328
  346. package/skills/pikku-testing/references/cucumber-bdd-testing.md +0 -176
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was generated by @pikku/cli@0.12.82
3
- */
4
- import { pikkuState } from '@pikku/core/internal';
5
- import metaData from './pikku-http-wirings-meta.gen.json' with { type: 'json' };
6
- pikkuState(null, 'http', 'meta', metaData);
@@ -1,26 +0,0 @@
1
- {
2
- "get": {},
3
- "post": {
4
- "/remote/rpc/:rpcName": {
5
- "pikkuFuncId": "remoteRPCHandler",
6
- "route": "/remote/rpc/:rpcName",
7
- "sourceFile": "/home/runner/work/pikku/pikku/packages/cli/src/scaffold/rpc-remote.gen.ts",
8
- "method": "post",
9
- "params": [
10
- "rpcName"
11
- ],
12
- "middleware": [
13
- {
14
- "type": "wire",
15
- "name": "pikkuRemoteAuthMiddleware",
16
- "inline": false
17
- }
18
- ]
19
- }
20
- },
21
- "put": {},
22
- "delete": {},
23
- "head": {},
24
- "patch": {},
25
- "options": {}
26
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was generated by @pikku/cli@0.12.82
3
- */
4
- import '../../src/scaffold/rpc-remote.gen.js';
@@ -1,5 +0,0 @@
1
- /**
2
- * This file was generated by @pikku/cli@0.12.82
3
- */
4
- /* The files with an wireHTTP function call */
5
- import '../../src/scaffold/rpc-remote.gen.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was generated by @pikku/cli@0.12.82
3
- */
4
- import { pikkuState } from '@pikku/core/internal';
5
- import metaData from './pikku-queue-workers-wirings-meta.gen.json' with { type: 'json' };
6
- pikkuState(null, 'queue', 'meta', metaData);
@@ -1,10 +0,0 @@
1
- {
2
- "pikku-remote-internal-rpc": {
3
- "pikkuFuncId": "remoteRPCHandler",
4
- "name": "pikku-remote-internal-rpc"
5
- },
6
- "wf-orchestrator-all-workflow": {
7
- "name": "wf-orchestrator-all-workflow",
8
- "pikkuFuncId": "pikkuWorkflowOrchestrator:allWorkflow"
9
- }
10
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was generated by @pikku/cli@0.12.82
3
- */
4
- import '../../src/scaffold/rpc-remote.gen.js';
@@ -1,5 +0,0 @@
1
- /**
2
- * This file was generated by @pikku/cli@0.12.82
3
- */
4
- /* The files with an addQueueWorkers function call */
5
- import '../../src/scaffold/rpc-remote.gen.js';
@@ -1 +0,0 @@
1
- { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "rpcName": { "type": "string" }, "data": {} }, "required": ["rpcName"], "additionalProperties": false, "definitions": {} }
@@ -1,10 +0,0 @@
1
- export declare const remoteRPCHandler: import("../../.pikku/pikku-types.gen.js").PikkuFunctionConfig<{
2
- rpcName: string;
3
- data?: unknown;
4
- }, unknown, "rpc" | "session", import("../../.pikku/pikku-types.gen.js").PikkuFunctionSessionless<{
5
- rpcName: string;
6
- data?: unknown;
7
- }, unknown, "rpc" | "session", import("../../types/application-types.js").Services> | import("../../.pikku/pikku-types.gen.js").PikkuFunction<{
8
- rpcName: string;
9
- data?: unknown;
10
- }, unknown, "rpc" | "session", import("../../types/application-types.js").Services>, undefined, undefined>;
@@ -1,27 +0,0 @@
1
- /**
2
- * This file was generated by @pikku/cli@0.12.35
3
- */
4
- /**
5
- * Auto-generated remote internal RPC queue worker and HTTP endpoint
6
- * Do not edit manually - regenerate with 'npx pikku'
7
- */
8
- import { pikkuSessionlessFunc, wireHTTP, wireQueueWorker } from '../../.pikku/pikku-types.gen.js';
9
- import { pikkuRemoteAuthMiddleware } from '@pikku/core/middleware';
10
- export const remoteRPCHandler = pikkuSessionlessFunc({
11
- tags: ['pikku'],
12
- func: async (_services, { rpcName, data }, { rpc }) => {
13
- return await rpc.invoke(rpcName, data);
14
- },
15
- remote: true,
16
- });
17
- wireQueueWorker({
18
- name: 'pikku-remote-internal-rpc',
19
- func: remoteRPCHandler,
20
- });
21
- wireHTTP({
22
- route: '/remote/rpc/:rpcName',
23
- method: 'post',
24
- auth: false,
25
- middleware: [pikkuRemoteAuthMiddleware],
26
- func: remoteRPCHandler,
27
- });
@@ -1,178 +0,0 @@
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. DO NOT TRIGGER when: the stub is an n8n Code node (use pikku-n8n-code-translate), or no n8n-generated stub/manifest is involved (use pikku-addon for hand-written addon wiring).'
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.
@@ -1,166 +0,0 @@
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. DO NOT TRIGGER when: the stub is an n8n integration/service node such as gmailTool or slackTool (use pikku-n8n-addon-map), or the code is not an n8n-generated stub at all."
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.