@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,8 +1,16 @@
1
1
  ---
2
2
  name: pikku-kysely
3
- description: 'Use when WRITING KYSELY QUERIES (select/join/aggregate/insert/update/delete) inside a Pikku function body, or when setting up SQL database services with Kysely. Covers the query builder API (joins, aggregates + groupBy/having, returning, sql template, expression builder, $if, transactions, jsonArrayFrom relation helpers) AND @pikku/kysely service setup (channel stores, workflow services, secret services, AI storage, deployment services).
4
- TRIGGER when: writing any non-trivial kysely query (a join, an aggregate/count/sum, groupBy, subquery, transaction, or conditional query), the injected `kysely` service is used in a function body, or code uses PikkuKysely, KyselyChannelStore, KyselyWorkflowService, KyselySecretService, or the user asks about SQL setup with Pikku.
5
- DO NOT TRIGGER when: user asks about MongoDB (use pikku-mongodb) or Redis (use pikku-redis).'
3
+ description: >-
4
+ Use when WRITING KYSELY QUERIES (select/join/aggregate/insert/update/delete) inside a Pikku
5
+ function body, or when setting up SQL database services with Kysely. Covers the query builder
6
+ API (joins, aggregates + groupBy/having, returning, sql template, expression builder, $if,
7
+ transactions, jsonArrayFrom relation helpers) AND @pikku/kysely service setup (channel stores,
8
+ workflow services, secret services, AI storage, deployment services). TRIGGER when: writing any
9
+ non-trivial kysely query (a join, an aggregate/count/sum, groupBy, subquery, transaction, or
10
+ conditional query), the injected `kysely` service is used in a function body, or code uses
11
+ PikkuKysely, KyselyChannelStore, KyselyWorkflowService, KyselySecretService, or the user asks
12
+ about SQL setup with Pikku. DO NOT TRIGGER when: user asks about MongoDB (use pikku-mongodb) or
13
+ Redis (use pikku-redis).
6
14
  installGroups: [core]
7
15
  ---
8
16
 
@@ -156,8 +164,8 @@ const secrets = new PgKyselySecretService(db.kysely, {
156
164
  })
157
165
  await secrets.init()
158
166
 
159
- await secrets.setSecretJSON('api-key', { key: 'sk-...' })
160
- const value = await secrets.getSecretJSON<{ key: string }>('api-key')
167
+ await secrets.setSecret('api-key', { key: 'sk-...' })
168
+ const value = await secrets.getSecret<{ key: string }>('api-key')
161
169
  await secrets.rotateKEK() // Re-encrypt all secrets with new KEK
162
170
  ```
163
171
 
@@ -1,8 +1,14 @@
1
1
  ---
2
2
  name: pikku-machine-auth
3
- description: 'Use when authenticating a CLI/agent/service against a Pikku server, adding machine-to-machine (M2M) auth, issuing scoped API keys for sandboxes/agents/workers, or wiring better-auth sessions into Pikku middleware. Covers `pikku login` (device-authorization), the better-auth API Key plugin, machine identities, and `betterAuthSession` with the api-key branch.
4
- TRIGGER when: user asks about CLI login, `pikku login`, machine agents, service-to-service auth, API keys, client credentials, sandbox/worker tokens, or resolving a better-auth session in a Pikku function.
5
- DO NOT TRIGGER when: user asks about end-user HTTP session/cookie auth only (use pikku-http + the app betterAuth config) or about WebSocket channel mechanics (use pikku-websocket).'
3
+ description: >-
4
+ Use when authenticating a CLI/agent/service against a Pikku server, adding machine-to-machine
5
+ (M2M) auth, issuing scoped API keys for sandboxes/agents/workers, or wiring better-auth sessions
6
+ into Pikku middleware. Covers `pikku login` (device-authorization), the better-auth API Key
7
+ plugin, machine identities, and `betterAuthSession` with the api-key branch. TRIGGER when: user
8
+ asks about CLI login, `pikku login`, machine agents, service-to-service auth, API keys, client
9
+ credentials, sandbox/worker tokens, or resolving a better-auth session in a Pikku function. DO
10
+ NOT TRIGGER when: user asks about end-user HTTP session/cookie auth only (use pikku-http + the
11
+ app betterAuth config) or about WebSocket channel mechanics (use pikku-websocket).
6
12
  ---
7
13
 
8
14
  # Pikku Machine Auth
@@ -1,8 +1,12 @@
1
1
  ---
2
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).'
3
+ description: >-
4
+ Use when exposing Pikku functions as MCP tools, resources, or prompts for AI assistants. Covers
5
+ mcp: true flag, pikkuMCPResourceFunc, pikkuMCPPromptFunc, and MCP wire object. TRIGGER when:
6
+ code uses mcp: true or pikkuMCPResourceFunc/pikkuMCPPromptFunc, user asks about MCP, Model
7
+ Context Protocol, AI tool integration, or exposing functions to Claude/ChatGPT. DO NOT TRIGGER
8
+ when: user asks about AI agents (use pikku-ai-agent) or general function definitions (use
9
+ pikku-concepts).
6
10
  installGroups: [core]
7
11
  ---
8
12
 
@@ -1,8 +1,13 @@
1
1
  ---
2
2
  name: pikku-middleware
3
- description: 'Use when adding any middleware to a Pikku app — global HTTP middleware, tag-scoped middleware (including service-to-service bearer auth), per-route middleware, session-setting middleware, or understanding middleware execution order and priority.
4
- TRIGGER when: user wants middleware on some or all routes, machine-to-machine auth, tag-scoped cross-cutting concerns, global interceptors, or middleware priority/order questions.
5
- DO NOT TRIGGER when: user asks about permissions/authorization checks (use pikku-permissions), auth strategies like authBearer/authCookie (use pikku-security), or deployment.'
3
+ description: >-
4
+ Use when adding any middleware to a Pikku app global HTTP middleware, tag-scoped middleware
5
+ (including service-to-service bearer auth), per-route middleware, session-setting middleware, or
6
+ understanding middleware execution order and priority. TRIGGER when: user wants middleware on
7
+ some or all routes, machine-to-machine auth, tag-scoped cross-cutting concerns, global
8
+ interceptors, or middleware priority/order questions. DO NOT TRIGGER when: user asks about
9
+ permissions/authorization checks (use pikku-permissions), auth strategies like
10
+ authBearer/authCookie (use pikku-security), or deployment.
6
11
  installGroups: [core]
7
12
  ---
8
13
 
@@ -13,7 +18,7 @@ installGroups: [core]
13
18
  1. Discover before editing. Run `pikku info middleware --verbose` and `pikku info tags --json` to understand the existing middleware and tag landscape.
14
19
  2. Identify the source files that own the behavior — wirings files, not generated output.
15
20
  3. Register middleware at module load time — in a `wirings/*.ts` file, never inside a function body.
16
- 4. Validate: run `pikku all` after adding or changing middleware; run `pikku tsc` to confirm type safety.
21
+ 4. Validate: run `pikku all --tsc` after adding or changing middleware it regenerates and then confirms type safety in one pass.
17
22
 
18
23
  ## The `pikkuMiddleware` Factory
19
24
 
@@ -221,6 +226,6 @@ export const myFunc = pikkuSessionlessFunc({
221
226
  ## After Changes
222
227
 
223
228
  ```bash
224
- pikku all # regenerate metadata so new tags are picked up
225
- pikku tsc # type-check
229
+ pikku all # regenerate metadata so new tags are picked up
230
+ pikku all --tsc # regenerate, then type-check (fails on type errors)
226
231
  ```
@@ -1,8 +1,11 @@
1
1
  ---
2
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).'
3
+ description: >-
4
+ Use when setting up MongoDB database services in a Pikku app. Covers PikkuMongoDB connection,
5
+ channel stores, workflow services, secret services, AI storage, agent runs, and deployment
6
+ services. TRIGGER when: code uses PikkuMongoDB, MongoDBChannelStore, MongoDBWorkflowService,
7
+ MongoDBSecretService, or user asks about MongoDB setup with Pikku. DO NOT TRIGGER when: user
8
+ asks about SQL databases (use pikku-kysely) or Redis (use pikku-redis).
6
9
  ---
7
10
 
8
11
  # Pikku MongoDB
@@ -70,8 +73,8 @@ const secrets = new MongoDBSecretService(mongo.db, {
70
73
  })
71
74
  await secrets.init()
72
75
 
73
- await secrets.setSecretJSON('api-key', { key: 'sk-...' })
74
- const value = await secrets.getSecretJSON<{ key: string }>('api-key')
76
+ await secrets.setSecret('api-key', { key: 'sk-...' })
77
+ const value = await secrets.getSecret<{ key: string }>('api-key')
75
78
  await secrets.rotateKEK()
76
79
  ```
77
80
 
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: pikku-n8n-import
3
+ description: 'Use to import an n8n workflow JSON export into a runnable Pikku workflow. Triggers when the user says "import this n8n workflow", "convert this n8n export to pikku", points at an n8n `.json` export or a directory of them, or picks up after `pikku import n8n` left throwing stub functions (`STUB — generated from n8n …`, `— implement me`) or a `<workflow>.integrations.json` manifest. Owns the whole flow: run the importer, triage what it could not map, fill each stub, report any missing `@pikku/addon-*` integrations, and verify the result compiles and runs with no surviving stubs. DO NOT TRIGGER for hand-written addon wiring unrelated to an n8n import (use pikku-addon), or for authoring workflows from scratch (use pikku-workflow).'
4
+ metadata:
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # n8n → Pikku Import
9
+
10
+ Take an n8n export all the way to a compiling, stub-free Pikku workflow. The
11
+ `@pikku/n8n-import` package (invoked by `pikku import n8n`) is **frozen**: it does
12
+ the provable, mechanical conversion and leaves everything it cannot prove as a
13
+ typed stub that throws at runtime. This skill runs that package, then fills the
14
+ remainder with judgment, reports what needs a human decision, and verifies.
15
+
16
+ Never re-do what the importer already did, and never hand-edit generated files to
17
+ paper over a stub — fix the source cause (the stub function, the graph node, or a
18
+ missing dependency).
19
+
20
+ ## Agent Operating Procedure
21
+
22
+ 1. Discover before editing. Prefer `pikku-meta`/`pikku meta ... --json` when
23
+ available; inspect only the focused output you need.
24
+ 2. Identify the source file that owns the behavior. Do not start from generated
25
+ output, `.pikku`, `node_modules`, or vendored packages.
26
+ 3. Make the smallest source change that satisfies the task. Keep generated files
27
+ generated.
28
+ 4. Validate with the narrowest relevant command first, then `pikku all` /
29
+ `pikku-verify` when functions, wirings, or schemas changed.
30
+ 5. If validation fails, fix the source cause and rerun. Never edit generated
31
+ files to hide an error.
32
+
33
+ ## Workflow
34
+
35
+ ### 1 — Run the importer (do as much as possible, cheaply)
36
+
37
+ ```bash
38
+ pikku import n8n <export.json> [outDir]
39
+ ```
40
+
41
+ It writes `<slug>.graph.ts` (+ `.agent.ts` for AI workflows), `<slug>.addons.gen.ts`,
42
+ a `<slug>.integrations.json` manifest, and one stub function per node it could not
43
+ map. It **exits 1** on an un-importable input (a cross-workflow sub-workflow
44
+ reference, a dynamic workflow target, a mid-flow `respondToWebhook`) with a
45
+ `[reason] message` — relay that to the user; do not fake a partial scaffold.
46
+
47
+ For a directory of exports, run it per file.
48
+
49
+ ### 2 — Triage what it left
50
+
51
+ Every unmapped node is a stub that throws `… — implement me`. Classify each by its
52
+ JSDoc marker and route to the matching reference:
53
+
54
+ | Stub marker / signal | Handle via |
55
+ |---|---|
56
+ | `STUB — generated from n8n node "…" (type "n8n-nodes-base.<svc>…")` | `references/addon-mapping.md` |
57
+ | `STUB — generated from n8n Code node "…"` | `references/code-translation.md` |
58
+ | A `control` stub — Loop Over Items / **splitInBatches**, Switch expr-mode | `references/loops-and-control.md` |
59
+ | `STUB — … vector-store … #902` | rare now (RAG ships as `<store>:query`/`:ingest`); a residual one = an unmapped store → report it, don't guess |
60
+ | Importer `diagnostics` (already exited 1) | explain the reason; the workflow is un-importable as-is |
61
+
62
+ Read a reference file only when you actually hit that stub class.
63
+
64
+ ### 3 — Fill each stub
65
+
66
+ Work the manifest + stub files per the routed reference. The mechanical classes
67
+ (addon, code) are near-deterministic; the loop/control class needs judgment
68
+ (map vs reduce, done-branch semantics) — reference `loops-and-control.md` tells you
69
+ when to decide vs ask.
70
+
71
+ ### 4 — Report missing integrations (first-class output)
72
+
73
+ An addon stub can only be wired to an **installed** `@pikku/addon-*`. When the
74
+ package for an n8n service is not in `dependencies`, do not guess a lookalike —
75
+ collect it. Give the user one upfront list:
76
+
77
+ ```
78
+ Missing integrations — install these or the nodes stay stubs:
79
+ • slackTool "Post to channel" → npm i @pikku/addon-chat-slack
80
+ • hubspot "Create contact" → no @pikku/addon-hubspot exists yet
81
+ ```
82
+
83
+ ### 5 — Verify it works
84
+
85
+ 1. `pikku all` (regenerate) → `yarn tsc` from the package root; fix the source
86
+ cause of any error and rerun.
87
+ 2. Grep the emitted functions for any surviving `— implement me`
88
+ / `throw new Error('Stub:`. **Any survivor means the import is not done** —
89
+ list them by node name.
90
+ 3. Green tsc **and** zero surviving stubs = success.
91
+
92
+ ## References
93
+
94
+ | Open when you need to… | Read |
95
+ |---|---|
96
+ | map an integration stub (gmailTool, slackTool, googleSheets, plain action nodes) to an installed addon `ref(...)` | `references/addon-mapping.md` |
97
+ | translate an n8n Code node body into a Pikku function body | `references/code-translation.md` |
98
+ | lower a Loop Over Items / splitInBatches loop, or a Switch that stayed a stub | `references/loops-and-control.md` |
99
+
100
+ ## Final summary
101
+
102
+ Report, terse:
103
+
104
+ - Files written and workflow shape (`pure-graph` / `agent`).
105
+ - Stubs filled, by class.
106
+ - **Missing integrations** (the step-4 list) — the thing the user must act on.
107
+ - Anything left as a `// TODO:` and why (credentials to wire, a loop deferred, an
108
+ unmapped store).
109
+ - Verification: `tsc` status + surviving-stub count (must be 0).
@@ -0,0 +1,84 @@
1
+ # n8n → Pikku Import Specification
2
+
3
+ ## Intent
4
+
5
+ Take an n8n workflow JSON export all the way to a compiling, stub-free, runnable
6
+ Pikku workflow. The `@pikku/n8n-import` package is treated as **frozen**: it does
7
+ the provable mechanical conversion and leaves everything it cannot prove as a typed,
8
+ throwing stub. This skill owns the end-to-end flow around it — run it, fill the
9
+ remainder with judgment, report gaps that need a human decision, and verify.
10
+
11
+ ## Scope
12
+
13
+ In scope:
14
+ - Running `pikku import n8n` and triaging its output.
15
+ - Filling integration stubs (→ addon refs), Code stubs (→ function bodies), and
16
+ loop/control stubs (→ `graph:map`/reduce/branch).
17
+ - Reporting missing `@pikku/addon-*` integrations as a first-class output.
18
+ - Verifying via `pikku all` + `tsc` + a zero-surviving-stub check.
19
+
20
+ Out of scope:
21
+ - Extending `@pikku/n8n-import` itself (it is frozen; do not add per-service tables
22
+ or new compiler rules to it).
23
+ - Authoring workflows from scratch (`pikku-workflow`) or hand-written addon wiring
24
+ unrelated to an import (`pikku-addon`).
25
+ - Inventing batching primitives or guessing ambiguous loop semantics — surface them.
26
+
27
+ ## Users And Trigger Context
28
+
29
+ - Primary users: developers importing their own n8n workflows into a Pikku app,
30
+ usually inside an agentic session.
31
+ - Common requests: "import this n8n workflow", "convert this n8n export to pikku",
32
+ finishing `— implement me` stubs, wiring a `*.integrations.json` manifest.
33
+ - Should not trigger for: from-scratch workflow authoring, or addon wiring with no
34
+ n8n import involved.
35
+
36
+ ## Runtime Contract
37
+
38
+ - Required first action: run `pikku import n8n <export.json> [outDir]` (per file for
39
+ a directory); relay any exit-1 diagnostic instead of scaffolding a partial.
40
+ - Required outputs: filled stubs, a missing-integrations list, verification status.
41
+ - Non-negotiable: never hand-edit generated files to hide a stub; map only to
42
+ installed addons; zero surviving `— implement me` stubs at success.
43
+ - Bundled files loaded at runtime: `references/addon-mapping.md`,
44
+ `references/code-translation.md`, `references/loops-and-control.md` — each only
45
+ when its stub class appears.
46
+
47
+ ## Source And Evidence Model
48
+
49
+ Authoritative sources:
50
+ - `@pikku/n8n-import` codegen (stub markers, manifest shape, `import-n8n` command).
51
+ - `@pikku/addon-graph` function contracts (`graph:map`/`fanout`, `branch`).
52
+ - Installed `@pikku/addon-*` source (function names verified by grep, never guessed).
53
+
54
+ Useful improvement sources: real imported workflows, harness coverage deltas,
55
+ addon catalogue changes.
56
+
57
+ Data that must not be stored: credential secrets, customer data, private ids beyond
58
+ what a manifest already records for reproduction.
59
+
60
+ ## Reference Architecture
61
+
62
+ - `SKILL.md`: the run → triage → fill → report → verify workflow + router.
63
+ - `references/`: per-stub-class depth (addon mapping, code translation, loops/control).
64
+
65
+ ## Validation
66
+
67
+ - Lightweight: `yarn tsc` from the package root after each fill.
68
+ - Deeper: `pikku all` regeneration; grep emitted functions for surviving stub throws.
69
+ - Acceptance gates: green tsc **and** zero surviving `— implement me` stubs.
70
+
71
+ ## Known Limitations
72
+
73
+ - `splitInBatches` with `batchSize > 1` and reduce-style accumulators have no direct
74
+ primitive — surfaced, not auto-converted.
75
+ - Missing addons block their nodes; the skill reports, it does not install.
76
+ - Cross-workflow sub-workflow references fail import at the package level.
77
+
78
+ ## Maintenance Notes
79
+
80
+ - Update `SKILL.md` when the import command, stub taxonomy, or verify gates change.
81
+ - Update a reference when an addon convention, the `graph:map` contract, or a rubric
82
+ changes.
83
+ - This skill supersedes the former `pikku-n8n-addon-map` and `pikku-n8n-code-translate`
84
+ skills (folded into `references/addon-mapping.md` and `references/code-translation.md`).
@@ -0,0 +1,121 @@
1
+ # Integration stub → Pikku addon
2
+
3
+ Translate n8n integration nodes (`gmailTool`, `slackTool`, `googleSheetsTool`, plain
4
+ `gmail` / `slack` action nodes, etc.) that the importer left as throwing stubs into
5
+ real `ref('<addonRpc>')` references pointing at functions in **installed**
6
+ `@pikku/addon-*` packages.
7
+
8
+ This is **per-stub mechanical**. Do not invent business logic, chain calls, or
9
+ "improve" the workflow. Read one manifest entry, find the matching addon function,
10
+ rewrite the stub.
11
+
12
+ ## Inputs
13
+
14
+ 1. **Manifest** — `<workflow>.integrations.json` next to the `.graph.ts`. Each entry:
15
+ ```jsonc
16
+ {
17
+ "rpcName": "agentGmailtool__sendAMessageInGmail",
18
+ "n8nType": "n8n-nodes-base.gmailTool",
19
+ "n8nName": "Send a message in Gmail",
20
+ "parameters": { "sendTo": "...", "message": "...", "subject": "..." },
21
+ "credentials": { "gmailOAuth2": { "id": "...", "name": "Personal Gmail" } },
22
+ "isAgentTool": true,
23
+ "agentName": "Inbox Assistant"
24
+ }
25
+ ```
26
+ 2. **Installed addons** — `@pikku/addon-*` in the project's `package.json`
27
+ `dependencies`. Map **only** against installed packages. If the addon for an n8n
28
+ type is not installed, surface it (see SKILL step 4) — never silently skip and
29
+ never pick a vaguely-named function from another addon.
30
+
31
+ ## Per entry, in order
32
+
33
+ ### Step 1 — identify the target addon
34
+
35
+ Map `n8nType` to a package by reading its source. Common shapes (**guesses, not
36
+ authoritative** — always verify against installed source):
37
+
38
+ | n8n type prefix | typical addon candidate |
39
+ |---|---|
40
+ | `n8n-nodes-base.gmail` / `gmailTool` | `@pikku/addon-email-gmail` |
41
+ | `n8n-nodes-base.slack` / `slackTool` | `@pikku/addon-chat-slack` |
42
+ | `n8n-nodes-base.googleSheets` / `…Tool` | `@pikku/addon-sheets-google` |
43
+ | `n8n-nodes-base.notion` / `notionTool` | `@pikku/addon-docs-notion` |
44
+ | `n8n-nodes-base.telegram` / `telegramTool` | `@pikku/addon-chat-telegram` |
45
+
46
+ If no installed addon plausibly covers the n8n type, stop and report it — do not
47
+ pick a wrong addon.
48
+
49
+ ### Step 2 — pick the function (resource + operation → fn name)
50
+
51
+ n8n nodes use a `(resource, operation)` pair. Rubric:
52
+
53
+ - `resource` defaults to the integration's primary noun if absent (gmail →
54
+ `message`, slack → `message`, sheets → `spreadsheet`). Read the addon's folder
55
+ structure (`messages/`, `drafts/`, `channels/`) to see what nouns exist.
56
+ - `operation` is usually a verb (`get`, `getAll`, `send`, `delete`, `addLabels`).
57
+ - The pikku function name is almost always `<resource><Verb>` in camelCase, matching
58
+ the file's `export const` (`messageList` for `messages/list.function.ts`).
59
+
60
+ Verify: `grep -h "^export const" <addonPkg>/src/functions/**/*.ts` and match by name.
61
+ Conventions in `@pikku/addon-email-gmail` (a **sanity reference**, not a fallback):
62
+
63
+ - `getAll → <resource>List`, `get → <resource>Get`, `send → <resource>Send`,
64
+ `delete → <resource>Delete`, `reply → <resource>Reply`
65
+ - `addLabels → <resource>AddLabel` (singular!), `removeLabels → <resource>RemoveLabel`
66
+ - `markAsRead / markAsUnread → <resource>MarkRead / <resource>MarkUnread`
67
+ - `create → <resource>Create`
68
+
69
+ If the function has a `node:` block, prefer matching its `category`/`displayName`
70
+ over guessing.
71
+
72
+ ### Step 3 — rewrite the stub
73
+
74
+ Two outcomes, by `isAgentTool`:
75
+
76
+ **A) `isAgentTool: true`** — the stub is an agent tool referenced via `ref()`:
77
+ 1. Delete the stub file.
78
+ 2. In the agent file, replace `ref('agentGmailtool__sendAMessageInGmail')` in
79
+ `tools: [...]` with `ref('messageSend')` (the resolved addon function).
80
+ 3. Ensure the addon is where pikku scans functions (usually automatic via
81
+ `node_modules/@pikku/addon-*`).
82
+
83
+ If you can't delete safely, leave a one-line re-export instead of a stub:
84
+ ```ts
85
+ import { messageSend } from '@pikku/addon-email-gmail'
86
+ export const agentGmailtool__sendAMessageInGmail = messageSend
87
+ ```
88
+ Default is delete + retarget; wrappers add maintenance burden.
89
+
90
+ **B) `isAgentTool: false`** — the stub is a graph node:
91
+ 1. Open `<workflow>.graph.ts`.
92
+ 2. In `nodes: { … }` find the entry whose value is the stub rpc name.
93
+ 3. Replace it with the addon function name (`'messageSend'`).
94
+ 4. If `config: { <id>: { input } }` produces an `{ items }` envelope, rewrite it to
95
+ the addon function's real input schema (read its `input: z.object({...})`).
96
+ 5. Delete the stub file.
97
+
98
+ ### Step 4 — port hard-coded parameters
99
+
100
+ - **Hardcoded values** (`"limit": 20`, `"labelIds": ["INBOX"]`) were user choices.
101
+ Preserve them in the graph node's `input` (case B). **Agent tools cannot carry
102
+ hardcoded params** (the LLM fills args at call time) — surface the trade-off; if
103
+ the user needs a value pinned, they keep a thin wrapper.
104
+ - **`$fromAI('Name', '', 'string')`** placeholders are LLM-filled — the addon's Zod
105
+ schema becomes the tool schema. Just drop the placeholder string; no other action.
106
+
107
+ ### Step 5 — credentials
108
+
109
+ `credentials: { gmailOAuth2: { id, name } }` is the n8n credential ref. Pikku addons
110
+ expect a wired service (`services.gmail`). Do **not** auto-wire — leave a TODO:
111
+
112
+ > `// TODO: wire services.gmail using credential "Personal Gmail" (n8n id: gmail_cred_1) — see @pikku/addon-email-gmail/README.md`
113
+
114
+ ## Never
115
+
116
+ - Invent functions that don't exist — grep first.
117
+ - Pick a wrong addon because the right one isn't installed — report `npm i @pikku/addon-<x>`.
118
+ - Bake per-mapping tables into `@pikku/n8n-import` — it is addon-agnostic; mapping lives here.
119
+ - Modify the manifest — it's an audit artifact.
120
+ - Chain calls — each entry maps to exactly one addon function.
121
+ - Silently drop a hardcoded param — surface it.
@@ -0,0 +1,121 @@
1
+ # n8n Code node → Pikku function
2
+
3
+ Replace a Code-node stub's `throw new Error(...)` body with a faithful TypeScript
4
+ reimplementation. The original JS is preserved verbatim in the JSDoc above the
5
+ function. Keep the signature and JSDoc intact; only widen the Zod input/output if
6
+ the code's data shape demands it.
7
+
8
+ **Narrow, mechanical translation** — behavioral parity, not better code. Do not
9
+ refactor, add error handling, or invent fields.
10
+
11
+ ## Process
12
+
13
+ 1. **Read the file.** Identify the input schema, output schema, the verbatim JS in
14
+ the JSDoc, and the `pikkuSessionlessFunc` shape.
15
+ 2. **Determine the n8n mode** from the original JSON if available (importer leaves it
16
+ in `fixtures/`, or ask). Two modes:
17
+ - `runOnceForAllItems` (default) — code runs once with `items: Array<{ json, binary, pairedItem }>`, returns an array of envelopes.
18
+ - `runOnceForEachItem` — runs once per item, `$json` / `$input.item.json` in scope, returns a single envelope.
19
+ - If unknown, infer: bare `items.X` → all-items; bare `$json.X` / `$input.item.X` → each-item.
20
+ 3. **Apply the rubric.**
21
+ 4. **Edit only the function body.** Leave imports, schemas, JSDoc, name, description, refs untouched unless step 5 forces it.
22
+ 5. **If the schemas are wrong** (code reads `$json.userId: string` but input is `items: z.array(z.unknown())`), tighten with the smallest change. Prefer `z.unknown()` over `z.any()`. Never widen output to `z.any()`.
23
+ 6. **Add one comment** at the top of the body noting the mode: `// translated from n8n Code node, mode: runOnceForAllItems`. This is the *only* comment you may add.
24
+ 7. **Typecheck** (`yarn tsc` from the package root); fix errors with the smallest change.
25
+
26
+ ## Rubric
27
+
28
+ ### Envelope unwrapping — all-items mode
29
+
30
+ | n8n | Pikku |
31
+ |---|---|
32
+ | `items` | `(data.items ?? []) as any[]` (or typed if known) |
33
+ | `items[i].json.X` | `items[i].X` |
34
+ | `items[i].json` | `items[i]` |
35
+ | `items[i].binary` | **NOT supported** — leave a TODO and explain |
36
+ | `items.length` | `items.length` |
37
+ | `items.map(i => i.json.X)` | `items.map((i: any) => i.X)` |
38
+
39
+ ### Envelope unwrapping — each-item mode
40
+
41
+ | n8n | Pikku |
42
+ |---|---|
43
+ | `$json.X` / `$input.item.json.X` | `data.X` (input is the item itself) |
44
+ | `$input.item.json` | `data` |
45
+ | `$input.all()` | not available per-item — change to all-items mode |
46
+
47
+ ### Return statement
48
+
49
+ | n8n | Pikku |
50
+ |---|---|
51
+ | `return [{ json: X }]` | `return { items: [X] }` |
52
+ | `return items.map(i => ({ json: ... }))` | `return { items: items.map(...) }` |
53
+ | `return [{ json: X }, { json: Y }]` | `return { items: [X, Y] }` |
54
+ | `return { json: X }` (each-item) | `return X` |
55
+ | `return [...]` (already plain) | wrap in `{ items: [...] }` only if the output schema expects it |
56
+
57
+ ### Built-ins — do NOT auto-translate
58
+
59
+ If the code references any of these, **stop**, leave the body a stub, and annotate
60
+ `// TODO:` + explain:
61
+
62
+ - `this.helpers.*` (binary buffers, HTTP requests, prepareBinaryData)
63
+ - `$node['Some Node'].json` (cross-node refs — resolve via Pikku `ref()` upstream, not in the body)
64
+ - `$workflow`, `$execution`, `$item()`, `$items('Other Node')`
65
+ - `getBinaryDataBuffer` / `getStaticData` — no equivalent, TODO
66
+ - `require()` / dynamic `import()` — flag and stop
67
+
68
+ Translate these only when reachable: `$now`/`$today` → `new Date()`; `$env.X` →
69
+ `services.variables.get('X')` (never `process.env` — Pikku house rule; `services` is
70
+ the first param).
71
+
72
+ ### Async / types
73
+
74
+ - Original uses `await` → the body is already `async`; keep every `await`.
75
+ - `this.helpers.httpRequest(...)` → do NOT inline; the user should use a separate
76
+ `httpRequest` rpc node. Leave a `// TODO:` and explain.
77
+ - Cast `items` as `any[]` only if the schema is `z.array(z.unknown())`; use the
78
+ inferred type if tightened. Never `as any` on the return — fix the schema instead.
79
+
80
+ ## Example
81
+
82
+ Before (stub):
83
+ ```ts
84
+ /**
85
+ * STUB — generated from n8n Code node "Custom Code".
86
+ * const total = items.reduce((acc, i) => acc + i.json.amount, 0);
87
+ * return [{ json: { total } }];
88
+ */
89
+ export const codeStubCustomCode = pikkuSessionlessFunc({
90
+ input: CodeStubCustomCodeInput,
91
+ output: CodeStubCustomCodeOutput,
92
+ func: async (_services, _data) => {
93
+ throw new Error('Stub: ported from n8n Code node "Custom Code" — implement me')
94
+ },
95
+ })
96
+ ```
97
+
98
+ After:
99
+ ```ts
100
+ export const codeStubCustomCode = pikkuSessionlessFunc({
101
+ description: 'Ported from n8n Code node "Custom Code"',
102
+ input: CodeStubCustomCodeInput,
103
+ output: CodeStubCustomCodeOutput,
104
+ func: async (_services, data) => {
105
+ // translated from n8n Code node, mode: runOnceForAllItems
106
+ const items = (data.items ?? []) as any[]
107
+ const total = items.reduce((acc, i) => acc + i.amount, 0)
108
+ return { items: [{ total }] }
109
+ },
110
+ })
111
+ ```
112
+
113
+ ## Report
114
+
115
+ Terse: the mode you inferred (one sentence), the literal rubric translations
116
+ applied, anything flagged TODO and why, any schema tightening (before → after).
117
+
118
+ Do not add tests, refactor, edit other files, "improve" the logic, or add
119
+ try/catch unless the original did. If the code is empty, comment-only, or so
120
+ dependent on n8n internals that no honest translation is possible, leave the stub
121
+ and tell the user which n8n features block it.
@@ -0,0 +1,87 @@
1
+ # Loops & control stubs
2
+
3
+ The importer maps the mechanical control flow (IF/Filter/Switch it can normalize →
4
+ `graph:branch`) but leaves the **semantic** cases as `control` stubs — chiefly
5
+ **Loop Over Items / splitInBatches** and Switch in expression mode. These need
6
+ judgment, which is why they are not compiled. Read the loop body and the workflow
7
+ around it; decide, or ask.
8
+
9
+ ## Loop Over Items / splitInBatches
10
+
11
+ n8n's loop node has two outputs: **loop** (output 1, fires per batch) and **done**
12
+ (output 0, fires once when iteration finishes). The loop body flows from the loop
13
+ output back into the node — a cycle. Pikku graphs are a DAG, so **the loop becomes a
14
+ `graph:map`** (`@pikku/addon-graph`) and the back-edge disappears:
15
+
16
+ ```ts
17
+ theLoop: "graph:map", // (graph:fanout) — one child invocation per item
18
+ // config:
19
+ theLoop: {
20
+ input: (ref) => ({
21
+ items: ref("<predecessor>"), // what fed the loop
22
+ child: "<childRpc-or-subGraph>", // the loop body
23
+ childInput: { /* $item-rebound body input */ },
24
+ stepPrefix: "theLoop",
25
+ }),
26
+ next: "<done-branch target>", // output 0
27
+ }
28
+ ```
29
+
30
+ Inside `childInput`, references rebind to the current element: the body's `$json` /
31
+ predecessor and any `$('<loop node>')` become `$item`.
32
+
33
+ ### Decide the shape first
34
+
35
+ | Loop body does… | Emit |
36
+ |---|---|
37
+ | transform each item independently (enrich, format, call one thing) | `graph:map` — child = the body |
38
+ | accumulate across items (running total, build one object/array) | a **reduce**: a single generated function over the whole array, not a map — `graph:map` collects per-item results and *loses* the accumulator |
39
+ | pure side-effect per item, nothing downstream consumes results | `graph:map` with **no `next`** (done branch empty) — the safest, unambiguous case |
40
+
41
+ ### Child arity
42
+
43
+ - **Single-node body** → `child: "<that node's rpc>"`, its input as `childInput`.
44
+ - **Multi-node body** → the child must be a per-item **sub-graph**. Lift the body
45
+ into its own `pikkuWorkflowGraph` (see `pikku-workflow`) and set `child` to that
46
+ workflow's registered name. If the body references nodes **outside** the loop
47
+ (not just the item), that value has to be threaded in as `childInput` — if you
48
+ can't do it cleanly, stop and ask rather than emit something subtly wrong.
49
+
50
+ ### Done-branch semantics (ask if it matters)
51
+
52
+ n8n's done output is version-dependent: it may carry the *original* items or the
53
+ *accumulated* results. `graph:map`'s `next` receives the array of child results.
54
+ If a downstream node reads that array's shape and the distinction matters, add:
55
+
56
+ ```ts
57
+ // TODO(n8n): done branch receives collected loop results (not original items) — confirm this matches intent
58
+ ```
59
+
60
+ and call it out in your summary. When the done branch is empty, there's nothing to
61
+ decide.
62
+
63
+ ### batchSize > 1
64
+
65
+ `graph:map` is one-item-at-a-time. A real numeric `batchSize` (chunk into groups,
66
+ run the body per chunk) has no direct primitive — leave the stub, and tell the user
67
+ this loop batches N-at-a-time and needs a manual pass (or a `graph:chunk` +
68
+ `graph:map` composition if the body is chunk-shaped).
69
+
70
+ ## Switch / control stubs the importer couldn't normalize
71
+
72
+ A Switch in **expression mode** (routing by an arbitrary JS expression rather than
73
+ comparable conditions) stays a `control` stub. Options, in order of preference:
74
+
75
+ 1. If the expression is really a set of value comparisons, rewrite the node as a
76
+ `graph:branch` by hand (see `pikku-workflow` for the `branch` shape) and wire the
77
+ emitted `next` keys to the branch targets.
78
+ 2. If it's genuinely computed routing, translate the stub into a small function that
79
+ returns the branch key, then feed it a `graph:branch`.
80
+ 3. If neither is faithful, leave the stub and explain what the Switch does.
81
+
82
+ ## Never
83
+
84
+ - Emit a `graph:map` for an accumulator loop — you'll silently drop the running state.
85
+ - Guess the done-branch semantics when a downstream node depends on the shape — mark
86
+ it and surface it.
87
+ - Invent a batching primitive — say what's unsupported instead.