@pikku/cli 0.10.2 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/.pikku/channel/pikku-channel-types.gen.ts +1 -1
  2. package/.pikku/channel/pikku-channels-map.gen.d.ts +5 -2
  3. package/.pikku/channel/pikku-channels-meta.gen.ts +1 -1
  4. package/.pikku/channel/pikku-channels.gen.ts +1 -1
  5. package/.pikku/cli/pikku-cli-channel.ts +92 -0
  6. package/.pikku/cli/pikku-cli-client.gen.ts +56 -0
  7. package/.pikku/cli/pikku-cli-types.gen.ts +1 -1
  8. package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +131 -5
  9. package/.pikku/cli/pikku-cli-wirings.gen.ts +3 -2
  10. package/.pikku/cli/pikku-cli.gen.ts +41 -0
  11. package/.pikku/function/pikku-function-types.gen.ts +1 -1
  12. package/.pikku/function/pikku-functions-meta.gen.ts +240 -131
  13. package/.pikku/function/pikku-functions-meta.min.gen.ts +59 -34
  14. package/.pikku/function/pikku-functions.gen.ts +9 -1
  15. package/.pikku/http/pikku-http-types.gen.ts +1 -1
  16. package/.pikku/http/pikku-http-wirings-map.gen.d.ts +5 -2
  17. package/.pikku/http/pikku-http-wirings-meta.gen.ts +1 -1
  18. package/.pikku/http/pikku-http-wirings.gen.ts +1 -1
  19. package/.pikku/mcp/pikku-mcp-types.gen.ts +1 -1
  20. package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +1 -1
  21. package/.pikku/mcp/pikku-mcp-wirings.gen.ts +1 -1
  22. package/.pikku/pikku-bootstrap.gen.ts +4 -1
  23. package/.pikku/pikku-services.gen.ts +8 -3
  24. package/.pikku/pikku-types.gen.ts +1 -1
  25. package/.pikku/pikku-websocket.gen.ts +1 -1
  26. package/.pikku/queue/pikku-queue-types.gen.ts +1 -1
  27. package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +5 -2
  28. package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +7 -2
  29. package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +1 -1
  30. package/.pikku/rpc/pikku-remote-rpc-workers.gen.ts +27 -0
  31. package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +13 -3
  32. package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +25 -10
  33. package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +14 -9
  34. package/.pikku/scheduler/pikku-scheduler-types.gen.ts +1 -1
  35. package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +1 -1
  36. package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +1 -1
  37. package/.pikku/schemas/register.gen.ts +17 -5
  38. package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  39. package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
  40. package/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -0
  41. package/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -0
  42. package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
  43. package/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -0
  44. package/.pikku/workflow/pikku-workflow-map.gen.d.ts +62 -0
  45. package/.pikku/workflow/pikku-workflow-types.gen.ts +92 -0
  46. package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +5 -0
  47. package/.pikku/workflow/pikku-workflow-wirings.gen.ts +4 -0
  48. package/CHANGELOG.md +13 -0
  49. package/bin/pikku.ts +20 -20
  50. package/build.sh +1 -1
  51. package/cli.schema.json +1 -1
  52. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  53. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  54. package/dist/.pikku/channel/pikku-channels-meta.gen.js +1 -1
  55. package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
  56. package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
  57. package/dist/.pikku/cli/pikku-cli-channel.d.ts +1 -0
  58. package/dist/.pikku/cli/pikku-cli-channel.js +91 -0
  59. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +10 -0
  60. package/dist/.pikku/cli/pikku-cli-client.gen.js +46 -0
  61. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  62. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  63. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +131 -5
  64. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +2 -1
  65. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +2 -1
  66. package/dist/.pikku/cli/pikku-cli.gen.d.ts +10 -0
  67. package/dist/.pikku/cli/pikku-cli.gen.js +38 -0
  68. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  69. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  70. package/dist/.pikku/function/pikku-functions-meta.gen.js +240 -131
  71. package/dist/.pikku/function/pikku-functions-meta.min.gen.js +59 -34
  72. package/dist/.pikku/function/pikku-functions.gen.js +9 -1
  73. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  74. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  75. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  76. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  77. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  78. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  79. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  80. package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +1 -1
  81. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
  82. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
  83. package/dist/.pikku/pikku-bootstrap.gen.d.ts +4 -1
  84. package/dist/.pikku/pikku-bootstrap.gen.js +4 -1
  85. package/dist/.pikku/pikku-services.gen.d.ts +10 -4
  86. package/dist/.pikku/pikku-services.gen.js +8 -2
  87. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  88. package/dist/.pikku/pikku-types.gen.js +1 -1
  89. package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
  90. package/dist/.pikku/pikku-websocket.gen.js +1 -1
  91. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  92. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  93. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +7 -2
  94. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  95. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  96. package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.d.ts +17 -0
  97. package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +22 -0
  98. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +14 -9
  99. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  100. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  101. package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +1 -1
  102. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
  103. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
  104. package/dist/.pikku/schemas/register.gen.js +9 -3
  105. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  106. package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
  107. package/dist/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -0
  108. package/dist/.pikku/schemas/schemas/PikkuRemoteInternalRPCInput.schema.json +1 -0
  109. package/dist/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -0
  110. package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
  111. package/dist/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -0
  112. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +58 -0
  113. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +28 -0
  114. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts +1 -0
  115. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +5 -0
  116. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +4 -0
  117. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +5 -0
  118. package/dist/bin/pikku.js +18 -20
  119. package/dist/src/cli.wiring.js +109 -107
  120. package/dist/src/functions/commands/all.js +20 -0
  121. package/dist/src/functions/commands/bootstrap.js +1 -0
  122. package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +15 -22
  123. package/dist/src/functions/wirings/queue/pikku-queue.js +9 -1
  124. package/dist/src/functions/wirings/queue/serialize-queue-map.d.ts +2 -2
  125. package/dist/src/functions/wirings/queue/serialize-queue-meta.d.ts +2 -2
  126. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -0
  127. package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +23 -0
  128. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -0
  129. package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.js +23 -0
  130. package/dist/src/functions/wirings/rpc/serialize-public-rpc.d.ts +4 -0
  131. package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +30 -0
  132. package/dist/src/functions/wirings/rpc/serialize-remote-rpc.d.ts +4 -0
  133. package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +30 -0
  134. package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +2 -2
  135. package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +27 -3
  136. package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.d.ts +1 -0
  137. package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.js +12 -0
  138. package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.d.ts +1 -0
  139. package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.js +11 -0
  140. package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +1 -0
  141. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +55 -0
  142. package/dist/src/functions/wirings/workflow/serialize-workflow-map.d.ts +4 -0
  143. package/dist/src/functions/wirings/workflow/serialize-workflow-map.js +79 -0
  144. package/dist/src/functions/wirings/workflow/serialize-workflow-meta.d.ts +2 -0
  145. package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +10 -0
  146. package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +4 -0
  147. package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +95 -0
  148. package/dist/src/functions/wirings/workflow/serialize-workflow-workers.d.ts +4 -0
  149. package/dist/src/functions/wirings/workflow/serialize-workflow-workers.js +60 -0
  150. package/dist/src/services/cli-logger-forwarder.service.d.ts +3 -0
  151. package/dist/src/services/cli-logger-forwarder.service.js +9 -2
  152. package/dist/src/services/cli-logger.service.js +1 -1
  153. package/dist/src/utils/command-summary.d.ts +1 -0
  154. package/dist/src/utils/command-summary.js +9 -8
  155. package/dist/src/utils/pikku-cli-config.js +24 -4
  156. package/dist/src/utils/schema-generator.js +28 -7
  157. package/dist/tsconfig.tsbuildinfo +1 -1
  158. package/package.json +3 -3
  159. package/src/cli.wiring.ts +111 -106
  160. package/src/functions/commands/all.ts +28 -0
  161. package/src/functions/commands/bootstrap.ts +1 -0
  162. package/src/functions/wirings/cli/serialize-channel-cli-client.ts +15 -22
  163. package/src/functions/wirings/queue/pikku-queue.ts +10 -1
  164. package/src/functions/wirings/queue/serialize-queue-map.ts +3 -3
  165. package/src/functions/wirings/queue/serialize-queue-meta.ts +2 -2
  166. package/src/functions/wirings/rpc/pikku-command-public-rpc.ts +32 -0
  167. package/src/functions/wirings/rpc/pikku-command-remote-rpc.ts +35 -0
  168. package/src/functions/wirings/rpc/serialize-public-rpc.ts +30 -0
  169. package/src/functions/wirings/rpc/serialize-remote-rpc.ts +30 -0
  170. package/src/functions/wirings/rpc/serialize-rpc-wrapper.ts +2 -2
  171. package/src/functions/wirings/rpc/serialize-typed-rpc-map.ts +26 -3
  172. package/src/functions/wirings/workflow/pikku-command-workflow-map.ts +24 -0
  173. package/src/functions/wirings/workflow/pikku-command-workflow-types.ts +22 -0
  174. package/src/functions/wirings/workflow/pikku-command-workflow.ts +123 -0
  175. package/src/functions/wirings/workflow/serialize-workflow-map.ts +123 -0
  176. package/src/functions/wirings/workflow/serialize-workflow-meta.ts +16 -0
  177. package/src/functions/wirings/workflow/serialize-workflow-types.ts +95 -0
  178. package/src/functions/wirings/workflow/serialize-workflow-workers.ts +60 -0
  179. package/src/services/cli-logger-forwarder.service.ts +11 -2
  180. package/src/services/cli-logger.service.ts +1 -1
  181. package/src/utils/command-summary.ts +10 -8
  182. package/src/utils/pikku-cli-config.ts +44 -4
  183. package/src/utils/schema-generator.ts +25 -7
  184. package/types/config.d.ts +45 -0
@@ -1 +1 @@
1
- { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "outDir": { "type": "string" }, "schemaDirectory": { "type": "string" }, "typesDeclarationFile": { "type": "string" }, "functionsFile": { "type": "string" }, "functionsMetaFile": { "type": "string" }, "functionsMetaMinFile": { "type": "string" }, "functionTypesFile": { "type": "string" }, "httpWiringsFile": { "type": "string" }, "httpWiringMetaFile": { "type": "string" }, "httpMapDeclarationFile": { "type": "string" }, "httpTypesFile": { "type": "string" }, "channelsWiringFile": { "type": "string" }, "channelsWiringMetaFile": { "type": "string" }, "channelsMapDeclarationFile": { "type": "string" }, "channelsTypesFile": { "type": "string" }, "rpcInternalWiringMetaFile": { "type": "string" }, "rpcInternalMapDeclarationFile": { "type": "string" }, "rpcMapDeclarationFile": { "type": "string" }, "schedulersWiringFile": { "type": "string" }, "schedulersWiringMetaFile": { "type": "string" }, "schedulersTypesFile": { "type": "string" }, "queueWorkersWiringFile": { "type": "string" }, "queueWorkersWiringMetaFile": { "type": "string" }, "queueMapDeclarationFile": { "type": "string" }, "queueTypesFile": { "type": "string" }, "mcpWiringsFile": { "type": "string" }, "mcpWiringsMetaFile": { "type": "string" }, "mcpTypesFile": { "type": "string" }, "cliWiringsFile": { "type": "string" }, "cliWiringMetaFile": { "type": "string" }, "cliBootstrapFile": { "type": "string" }, "cliTypesFile": { "type": "string" }, "servicesFile": { "type": "string" }, "middlewareFile": { "type": "string" }, "middlewareGroupsMetaFile": { "type": "string" }, "permissionsFile": { "type": "string" }, "bootstrapFile": { "type": "string" }, "$schema": { "type": "string" }, "extends": { "type": "string" }, "rootDir": { "type": "string" }, "srcDirectories": { "type": "array", "items": { "type": "string" } }, "ignoreFiles": { "type": "array", "items": { "type": "string" } }, "packageMappings": { "type": "object", "additionalProperties": { "type": "string" } }, "configFile": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "userSessionType": { "type": "string" }, "singletonServicesFactoryType": { "type": "string" }, "sessionServicesFactoryType": { "type": "string" }, "configDir": { "type": "string" }, "tsconfig": { "type": "string" }, "nextBackendFile": { "type": "string" }, "nextHTTPFile": { "type": "string" }, "fetchFile": { "type": "string" }, "websocketFile": { "type": "string" }, "rpcWiringsFile": { "type": "string" }, "queueWiringsFile": { "type": "string" }, "mcpJsonFile": { "type": "string" }, "openAPI": { "type": "object", "properties": { "outputFile": { "type": "string" }, "additionalInfo": { "$ref": "#/definitions/OpenAPISpecInfo" } }, "required": ["outputFile", "additionalInfo"], "additionalProperties": false }, "schema": { "type": "object", "properties": { "additionalProperties": { "type": "boolean" }, "supportsImportAttributes": { "type": "boolean" } }, "additionalProperties": false }, "cli": { "type": "object", "properties": { "entrypoints": { "type": "object", "additionalProperties": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }, { "type": "array", "items": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }] } }] } } }, "additionalProperties": false }, "forceRequiredServices": { "type": "array", "items": { "type": "string" } }, "schemasFromTypes": { "type": "array", "items": { "type": "string" } }, "stateOutput": { "type": "string" }, "stateInput": { "type": "string" }, "filters": { "$ref": "#/definitions/InspectorFilters" } }, "required": ["bootstrapFile", "channelsMapDeclarationFile", "channelsTypesFile", "channelsWiringFile", "channelsWiringMetaFile", "cliBootstrapFile", "cliTypesFile", "cliWiringMetaFile", "cliWiringsFile", "configDir", "filters", "functionTypesFile", "functionsFile", "functionsMetaFile", "functionsMetaMinFile", "httpMapDeclarationFile", "httpTypesFile", "httpWiringMetaFile", "httpWiringsFile", "mcpTypesFile", "mcpWiringsFile", "mcpWiringsMetaFile", "middlewareFile", "middlewareGroupsMetaFile", "outDir", "packageMappings", "permissionsFile", "queueMapDeclarationFile", "queueTypesFile", "queueWorkersWiringFile", "queueWorkersWiringMetaFile", "rootDir", "rpcInternalMapDeclarationFile", "rpcInternalWiringMetaFile", "rpcMapDeclarationFile", "schedulersTypesFile", "schedulersWiringFile", "schedulersWiringMetaFile", "schemaDirectory", "servicesFile", "srcDirectories", "tsconfig", "typesDeclarationFile"], "definitions": { "OpenAPISpecInfo": { "type": "object", "properties": { "info": { "type": "object", "properties": { "title": { "type": "string" }, "version": { "type": "string" }, "description": { "type": "string" }, "termsOfService": { "type": "string" }, "contact": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" }, "email": { "type": "string" } }, "additionalProperties": false }, "license": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "required": ["title", "version", "description"], "additionalProperties": false }, "servers": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "description": { "type": "string" } }, "required": ["url"], "additionalProperties": false } }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "externalDocs": { "type": "object", "properties": { "description": { "type": "string" }, "url": { "type": "string" } }, "required": ["url"], "additionalProperties": false }, "securitySchemes": { "type": "object" }, "security": { "type": "array", "items": { "type": "object", "additionalProperties": { "type": "array", "items": {} } } } }, "required": ["info", "servers"], "additionalProperties": false }, "InspectorFilters": { "type": "object", "properties": { "names": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "directories": { "type": "array", "items": { "type": "string" } }, "httpRoutes": { "type": "array", "items": { "type": "string" } }, "httpMethods": { "type": "array", "items": { "type": "string" } } }, "additionalProperties": false } } }
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "outDir": { "type": "string" }, "schemaDirectory": { "type": "string" }, "typesDeclarationFile": { "type": "string" }, "functionsFile": { "type": "string" }, "functionsMetaFile": { "type": "string" }, "functionsMetaMinFile": { "type": "string" }, "functionTypesFile": { "type": "string" }, "httpWiringsFile": { "type": "string" }, "httpWiringMetaFile": { "type": "string" }, "httpMapDeclarationFile": { "type": "string" }, "httpTypesFile": { "type": "string" }, "channelsWiringFile": { "type": "string" }, "channelsWiringMetaFile": { "type": "string" }, "channelsMapDeclarationFile": { "type": "string" }, "channelsTypesFile": { "type": "string" }, "rpcInternalWiringMetaFile": { "type": "string" }, "rpcInternalMapDeclarationFile": { "type": "string" }, "rpcMapDeclarationFile": { "type": "string" }, "schedulersWiringFile": { "type": "string" }, "schedulersWiringMetaFile": { "type": "string" }, "schedulersTypesFile": { "type": "string" }, "queueWorkersWiringFile": { "type": "string" }, "queueWorkersWiringMetaFile": { "type": "string" }, "queueMapDeclarationFile": { "type": "string" }, "queueTypesFile": { "type": "string" }, "workflowsWiringFile": { "type": "string" }, "workflowsWiringMetaFile": { "type": "string" }, "workflowsWorkersFile": { "type": "string" }, "workflowMapDeclarationFile": { "type": "string" }, "workflowTypesFile": { "type": "string" }, "mcpWiringsFile": { "type": "string" }, "mcpWiringsMetaFile": { "type": "string" }, "mcpTypesFile": { "type": "string" }, "cliWiringsFile": { "type": "string" }, "cliWiringMetaFile": { "type": "string" }, "cliBootstrapFile": { "type": "string" }, "cliTypesFile": { "type": "string" }, "servicesFile": { "type": "string" }, "middlewareFile": { "type": "string" }, "middlewareGroupsMetaFile": { "type": "string" }, "permissionsFile": { "type": "string" }, "bootstrapFile": { "type": "string" }, "$schema": { "type": "string" }, "extends": { "type": "string" }, "rootDir": { "type": "string" }, "srcDirectories": { "type": "array", "items": { "type": "string" } }, "ignoreFiles": { "type": "array", "items": { "type": "string" } }, "packageMappings": { "type": "object", "additionalProperties": { "type": "string" } }, "configFile": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "userSessionType": { "type": "string" }, "singletonServicesFactoryType": { "type": "string" }, "sessionServicesFactoryType": { "type": "string" }, "configDir": { "type": "string" }, "tsconfig": { "type": "string" }, "nextBackendFile": { "type": "string" }, "nextHTTPFile": { "type": "string" }, "fetchFile": { "type": "string" }, "websocketFile": { "type": "string" }, "rpcWiringsFile": { "type": "string" }, "queueWiringsFile": { "type": "string" }, "mcpJsonFile": { "type": "string" }, "openAPI": { "type": "object", "properties": { "outputFile": { "type": "string" }, "additionalInfo": { "$ref": "#/definitions/OpenAPISpecInfo" } }, "required": ["outputFile", "additionalInfo"], "additionalProperties": false }, "schema": { "type": "object", "properties": { "additionalProperties": { "type": "boolean" }, "supportsImportAttributes": { "type": "boolean" } }, "additionalProperties": false }, "cli": { "type": "object", "properties": { "entrypoints": { "type": "object", "additionalProperties": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }, { "type": "array", "items": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }] } }] } } }, "additionalProperties": false }, "workflows": { "anyOf": [{ "type": "object", "properties": { "singleQueue": { "type": "boolean", "const": true }, "path": { "type": "string" }, "orchestratorQueue": { "type": "string" }, "workerQueue": { "type": "string" } }, "required": ["singleQueue", "path"], "additionalProperties": false }, { "type": "object", "properties": { "singleQueue": { "type": "boolean", "const": false }, "dir": { "type": "string" }, "orchestratorQueuePrefix": { "type": "string" }, "workerQueuePrefix": { "type": "string" } }, "required": ["singleQueue", "dir"], "additionalProperties": false }] }, "rpc": { "type": "object", "properties": { "remoteRpcWorkersPath": { "type": "string" }, "publicRpcPath": { "type": "string" } }, "additionalProperties": false }, "forceRequiredServices": { "type": "array", "items": { "type": "string" } }, "schemasFromTypes": { "type": "array", "items": { "type": "string" } }, "stateOutput": { "type": "string" }, "stateInput": { "type": "string" }, "filters": { "$ref": "#/definitions/InspectorFilters" } }, "required": ["bootstrapFile", "channelsMapDeclarationFile", "channelsTypesFile", "channelsWiringFile", "channelsWiringMetaFile", "cliBootstrapFile", "cliTypesFile", "cliWiringMetaFile", "cliWiringsFile", "configDir", "filters", "functionTypesFile", "functionsFile", "functionsMetaFile", "functionsMetaMinFile", "httpMapDeclarationFile", "httpTypesFile", "httpWiringMetaFile", "httpWiringsFile", "mcpTypesFile", "mcpWiringsFile", "mcpWiringsMetaFile", "middlewareFile", "middlewareGroupsMetaFile", "outDir", "packageMappings", "permissionsFile", "queueMapDeclarationFile", "queueTypesFile", "queueWorkersWiringFile", "queueWorkersWiringMetaFile", "rootDir", "rpcInternalMapDeclarationFile", "rpcInternalWiringMetaFile", "rpcMapDeclarationFile", "schedulersTypesFile", "schedulersWiringFile", "schedulersWiringMetaFile", "schemaDirectory", "servicesFile", "srcDirectories", "tsconfig", "typesDeclarationFile", "workflowMapDeclarationFile", "workflowTypesFile", "workflowsWiringFile", "workflowsWiringMetaFile", "workflowsWorkersFile"], "definitions": { "OpenAPISpecInfo": { "type": "object", "properties": { "info": { "type": "object", "properties": { "title": { "type": "string" }, "version": { "type": "string" }, "description": { "type": "string" }, "termsOfService": { "type": "string" }, "contact": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" }, "email": { "type": "string" } }, "additionalProperties": false }, "license": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "required": ["title", "version", "description"], "additionalProperties": false }, "servers": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "description": { "type": "string" } }, "required": ["url"], "additionalProperties": false } }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "externalDocs": { "type": "object", "properties": { "description": { "type": "string" }, "url": { "type": "string" } }, "required": ["url"], "additionalProperties": false }, "securitySchemes": { "type": "object" }, "security": { "type": "array", "items": { "type": "object", "additionalProperties": { "type": "array", "items": {} } } } }, "required": ["info", "servers"], "additionalProperties": false }, "InspectorFilters": { "type": "object", "properties": { "names": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "directories": { "type": "array", "items": { "type": "string" } }, "httpRoutes": { "type": "array", "items": { "type": "string" } }, "httpMethods": { "type": "array", "items": { "type": "string" } } }, "additionalProperties": false } } }
@@ -1 +1 @@
1
- { "$schema": "http://json-schema.org/draft-07/schema#", "type": "boolean", "enum": [false, true], "description": "This provides the structure needed for typescript to be aware of RPCs and their return types", "definitions": {} }
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "boolean", "enum": [false, true], "definitions": {} }
@@ -0,0 +1 @@
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "boolean", "enum": [false, true], "definitions": {} }
@@ -0,0 +1 @@
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "rpcName": { "type": "string" }, "data": {} }, "required": ["rpcName"], "additionalProperties": false, "definitions": {} }
@@ -0,0 +1 @@
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "boolean", "enum": [false, true], "definitions": {} }
@@ -1 +1 @@
1
- { "$schema": "http://json-schema.org/draft-07/schema#", "type": "boolean", "enum": [false, true], "definitions": {} }
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "boolean", "enum": [false, true], "description": "This provides the structure needed for typescript to be aware of RPCs and their return types", "definitions": {} }
@@ -0,0 +1 @@
1
+ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "boolean", "enum": [false, true], "definitions": {} }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.11.1
3
+ */
4
+ /**
5
+ * Workflow-specific type definitions for tree-shaking optimization
6
+ */
7
+ import { CoreWorkflow, PikkuWorkflowInteraction, WorkflowStepOptions } from '@pikku/core/workflow';
8
+ import { CorePikkuFunctionConfig, CorePikkuFunctionSessionless } from '@pikku/core';
9
+ import type { PikkuPermission, PikkuMiddleware } from '../function/pikku-function-types.gen.js';
10
+ import type { UserSession, SingletonServices } from '../../types/application-types.d.js';
11
+ import type { TypedPikkuRPC, RPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js';
12
+ /**
13
+ * Type definition for workflows that orchestrate multi-step processes.
14
+ * Workflows support both inline and remote execution modes with step caching.
15
+ */
16
+ type WorkflowWiring = CoreWorkflow<CorePikkuFunctionConfig<PikkuFunctionWorkflow<any, any>, PikkuPermission<any>, PikkuMiddleware>>;
17
+ /**
18
+ * Typed workflow interaction with RPC awareness
19
+ * Provides type-safe workflow.do() for RPC steps
20
+ */
21
+ export interface TypedWorkflow extends PikkuWorkflowInteraction {
22
+ /**
23
+ * Execute a workflow step with RPC invocation (typed based on available RPCs)
24
+ * @template K - RPC name from the RPC map
25
+ */
26
+ do<K extends keyof RPCMap>(stepName: string, rpcName: K, data: RPCMap[K]['input'], options?: WorkflowStepOptions): Promise<RPCMap[K]['output']>;
27
+ /**
28
+ * Execute a workflow step with inline function
29
+ * @template T - Return type of the inline function
30
+ */
31
+ do<T>(stepName: string, fn: () => T | Promise<T>, options?: WorkflowStepOptions): Promise<T>;
32
+ }
33
+ /**
34
+ * Workflow function type with typed workflow service
35
+ * Includes the workflow interaction object with typed RPC methods
36
+ */
37
+ export type PikkuFunctionWorkflow<In = unknown, Out = never> = CorePikkuFunctionSessionless<In, Out, null, SingletonServices & {
38
+ rpc: TypedPikkuRPC;
39
+ workflow: TypedWorkflow;
40
+ }, UserSession>;
41
+ /**
42
+ * Creates a workflow function with typed input and output.
43
+ * Workflow functions have access to the workflow interaction object for step execution.
44
+ *
45
+ * @template In - Input type for the workflow
46
+ * @template Out - Output type for the workflow
47
+ * @param func - Function definition, either direct function or configuration object
48
+ * @returns The normalized configuration object
49
+ */
50
+ export declare const pikkuWorkflowFunc: <In, Out = unknown>(func: PikkuFunctionWorkflow<In, Out> | CorePikkuFunctionConfig<PikkuFunctionWorkflow<In, Out>, PikkuPermission<In>, PikkuMiddleware>) => CorePikkuFunctionConfig<PikkuFunctionWorkflow<In, Out>, PikkuPermission<In>, PikkuMiddleware>;
51
+ /**
52
+ * Registers a workflow with the Pikku framework.
53
+ * Workflows can run in 'inline' (synchronous) or 'remote' (queue-based) execution modes.
54
+ *
55
+ * @param workflow - Workflow definition with name, execution mode, and handler function
56
+ */
57
+ export declare const wireWorkflow: (workflow: WorkflowWiring) => void;
58
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.11.1
3
+ */
4
+ /**
5
+ * Workflow-specific type definitions for tree-shaking optimization
6
+ */
7
+ import { wireWorkflow as wireWorkflowCore } from '@pikku/core/workflow';
8
+ /**
9
+ * Creates a workflow function with typed input and output.
10
+ * Workflow functions have access to the workflow interaction object for step execution.
11
+ *
12
+ * @template In - Input type for the workflow
13
+ * @template Out - Output type for the workflow
14
+ * @param func - Function definition, either direct function or configuration object
15
+ * @returns The normalized configuration object
16
+ */
17
+ export const pikkuWorkflowFunc = (func) => {
18
+ return typeof func === 'function' ? { func } : func;
19
+ };
20
+ /**
21
+ * Registers a workflow with the Pikku framework.
22
+ * Workflows can run in 'inline' (synchronous) or 'remote' (queue-based) execution modes.
23
+ *
24
+ * @param workflow - Workflow definition with name, execution mode, and handler function
25
+ */
26
+ export const wireWorkflow = (workflow) => {
27
+ wireWorkflowCore(workflow);
28
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.11.1
3
+ */
4
+ import { pikkuState } from '@pikku/core';
5
+ pikkuState('workflows', 'meta', {});
@@ -0,0 +1,4 @@
1
+ export {};
2
+ /**
3
+ * This file was generated by @pikku/cli@0.11.1
4
+ */
@@ -0,0 +1,5 @@
1
+ export {};
2
+ /**
3
+ * This file was generated by @pikku/cli@0.11.1
4
+ */
5
+ /* The files with an wireWorkflow function call */
package/dist/bin/pikku.js CHANGED
@@ -3,27 +3,25 @@ import { Command } from 'commander';
3
3
  import { createConfig, createSingletonServices } from '../src/services.js';
4
4
  import { PikkuRPCService } from '@pikku/core/rpc';
5
5
  import { LocalVariablesService } from '@pikku/core/services';
6
- // import { existsSync } from 'fs'
7
- // import { fileURLToPath } from 'url'
8
- // import { dirname, join } from 'path'
9
- // const __filename = fileURLToPath(import.meta.url)
10
- // const __dirname = dirname(__filename)
6
+ import { existsSync } from 'fs';
7
+ import { fileURLToPath } from 'url';
8
+ import { dirname, join } from 'path';
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
11
  // Check if Pikku CLI is available
12
- // const pikkuCliPath = join(__dirname, '../.pikku/cli/pikku-cli.gen.js')
13
- // if (existsSync(pikkuCliPath)) {
14
- // try {
15
- // // Use the generated Pikku CLI
16
- // const { PikkuCLI } = await import('../.pikku/cli/pikku-cli.gen.js')
17
- // await PikkuCLI(process.argv.slice(2))
18
- // process.exit(0)
19
- // } catch (error) {
20
- // // If import fails, fall back to Commander.js
21
- // console.warn(
22
- // 'Failed to load Pikku CLI, using fallback mode:',
23
- // error.message
24
- // )
25
- // }
26
- // }
12
+ const pikkuCliPath = join(__dirname, '../.pikku/cli/pikku-cli.gen.js');
13
+ if (existsSync(pikkuCliPath)) {
14
+ try {
15
+ // Use the generated Pikku CLI
16
+ const { PikkuCLI } = await import(pikkuCliPath);
17
+ await PikkuCLI(process.argv.slice(2));
18
+ process.exit(0);
19
+ }
20
+ catch (error) {
21
+ // If import fails, fall back to Commander.js
22
+ console.warn('Failed to load Pikku CLI, using fallback mode:', error.message);
23
+ }
24
+ }
27
25
  // Fallback to Commander.js for initial setup
28
26
  // Import bootstrap if it exists
29
27
  try {
@@ -1,107 +1,109 @@
1
- // import { pikkuSchemas } from './functions/wirings/functions/schemas.js'
2
- // import { pikkuFetch } from './functions/wirings/fetch/index.js'
3
- // import { pikkuWebSocketTyped } from './functions/wirings/channels/pikku-command-websocket-typed.js'
4
- // import { pikkuRPCClient } from './functions/wirings/rpc/pikku-command-rpc-client.js'
5
- // import { pikkuQueueService } from './functions/wirings/queue/pikku-command-queue-service.js'
6
- // import { pikkuOpenAPI } from './functions/wirings/http/pikku-command-openapi.js'
7
- // import { pikkuNext } from './functions/runtimes/nextjs/pikku-command-nextjs.js'
8
- // import { pikkuCLICommand, wireCLI } from '../.pikku/cli/pikku-cli-types.gen.js'
9
- // import { all } from './functions/commands/all.js'
10
- // import { bootstrap } from './functions/commands/bootstrap.js'
11
- // import { clientCLIRenderer } from './services.js'
12
- export {};
13
- // wireCLI({
14
- // program: 'pikku',
15
- // description:
16
- // 'Pikku CLI - Code generation tool for type-safe backend development',
17
- // render: clientCLIRenderer,
18
- // options: {
19
- // config: {
20
- // description: 'Path to pikku.config.json file',
21
- // short: 'c',
22
- // },
23
- // logLevel: {
24
- // description: 'Set log level',
25
- // default: 'info' as const,
26
- // short: 'l',
27
- // },
28
- // userSessionType: {
29
- // description:
30
- // 'Specify which UserSession type to use (when multiple exist)',
31
- // },
32
- // singletonServicesFactoryType: {
33
- // description: 'Specify which singleton services factory to use',
34
- // },
35
- // sessionServicesFactoryType: {
36
- // description: 'Specify which session services factory to use',
37
- // },
38
- // stateOutput: {
39
- // description: 'Save inspector state to JSON file for reuse',
40
- // },
41
- // stateInput: {
42
- // description: 'Load inspector state from JSON file (skips inspection)',
43
- // },
44
- // },
45
- // commands: {
46
- // all: pikkuCLICommand({
47
- // func: all,
48
- // description: 'Generate all Pikku files (types, schemas, wirings, etc.)',
49
- // isDefault: true,
50
- // options: {
51
- // tags: {
52
- // description: 'Filter functions by tags (comma-separated)',
53
- // short: 't',
54
- // },
55
- // types: {
56
- // description: 'Filter functions by types (comma-separated)',
57
- // },
58
- // directories: {
59
- // description: 'Filter functions by directories (comma-separated)',
60
- // short: 'd',
61
- // },
62
- // httpMethods: {
63
- // description: 'Filter HTTP routes by methods (comma-separated)',
64
- // },
65
- // httpRoutes: {
66
- // description: 'Filter HTTP routes by route patterns (comma-separated)',
67
- // },
68
- // names: {
69
- // description: 'Filter functions by name patterns (supports wildcards)',
70
- // short: 'n',
71
- // },
72
- // },
73
- // }),
74
- // bootstrap: pikkuCLICommand({
75
- // func: bootstrap,
76
- // description: 'Generate only type files (setup phase only)',
77
- // }),
78
- // schemas: pikkuCLICommand({
79
- // func: pikkuSchemas,
80
- // description: 'Generate JSON schemas for function input/output types',
81
- // }),
82
- // fetch: pikkuCLICommand({
83
- // func: pikkuFetch,
84
- // description: 'Generate type-safe HTTP fetch client',
85
- // }),
86
- // websocket: pikkuCLICommand({
87
- // func: pikkuWebSocketTyped,
88
- // description: 'Generate type-safe WebSocket client',
89
- // }),
90
- // rpc: pikkuCLICommand({
91
- // func: pikkuRPCClient,
92
- // description: 'Generate RPC client wrappers',
93
- // }),
94
- // 'queue-service': pikkuCLICommand({
95
- // func: pikkuQueueService,
96
- // description: 'Generate queue service wrapper',
97
- // }),
98
- // openapi: pikkuCLICommand({
99
- // func: pikkuOpenAPI,
100
- // description: 'Generate OpenAPI specification from HTTP routes',
101
- // }),
102
- // nextjs: pikkuCLICommand({
103
- // func: pikkuNext,
104
- // description: 'Generate Next.js backend and HTTP wrappers',
105
- // }),
106
- // },
107
- // })
1
+ import { pikkuSchemas } from './functions/wirings/functions/schemas.js';
2
+ import { pikkuFetch } from './functions/wirings/fetch/index.js';
3
+ import { pikkuWebSocketTyped } from './functions/wirings/channels/pikku-command-websocket-typed.js';
4
+ import { pikkuRPCClient } from './functions/wirings/rpc/pikku-command-rpc-client.js';
5
+ import { pikkuQueueService } from './functions/wirings/queue/pikku-command-queue-service.js';
6
+ import { pikkuOpenAPI } from './functions/wirings/http/pikku-command-openapi.js';
7
+ import { pikkuNext } from './functions/runtimes/nextjs/pikku-command-nextjs.js';
8
+ import { pikkuCLICommand, wireCLI } from '../.pikku/cli/pikku-cli-types.gen.js';
9
+ import { all } from './functions/commands/all.js';
10
+ import { bootstrap } from './functions/commands/bootstrap.js';
11
+ import { watch } from './functions/commands/watch.js';
12
+ import { clientCLIRenderer } from './services.js';
13
+ wireCLI({
14
+ program: 'pikku',
15
+ description: 'Pikku CLI - Code generation tool for type-safe backend development',
16
+ render: clientCLIRenderer,
17
+ options: {
18
+ config: {
19
+ description: 'Path to pikku.config.json file',
20
+ short: 'c',
21
+ },
22
+ logLevel: {
23
+ description: 'Set log level',
24
+ default: 'info',
25
+ short: 'l',
26
+ },
27
+ userSessionType: {
28
+ description: 'Specify which UserSession type to use (when multiple exist)',
29
+ },
30
+ singletonServicesFactoryType: {
31
+ description: 'Specify which singleton services factory to use',
32
+ },
33
+ sessionServicesFactoryType: {
34
+ description: 'Specify which session services factory to use',
35
+ },
36
+ stateOutput: {
37
+ description: 'Save inspector state to JSON file for reuse',
38
+ },
39
+ stateInput: {
40
+ description: 'Load inspector state from JSON file (skips inspection)',
41
+ },
42
+ },
43
+ commands: {
44
+ all: pikkuCLICommand({
45
+ func: all,
46
+ description: 'Generate all Pikku files (types, schemas, wirings, etc.)',
47
+ isDefault: true,
48
+ options: {
49
+ tags: {
50
+ description: 'Filter functions by tags (comma-separated)',
51
+ short: 't',
52
+ },
53
+ types: {
54
+ description: 'Filter functions by types (comma-separated)',
55
+ },
56
+ directories: {
57
+ description: 'Filter functions by directories (comma-separated)',
58
+ short: 'd',
59
+ },
60
+ httpMethods: {
61
+ description: 'Filter HTTP routes by methods (comma-separated)',
62
+ },
63
+ httpRoutes: {
64
+ description: 'Filter HTTP routes by route patterns (comma-separated)',
65
+ },
66
+ names: {
67
+ description: 'Filter functions by name patterns (supports wildcards)',
68
+ short: 'n',
69
+ },
70
+ },
71
+ }),
72
+ bootstrap: pikkuCLICommand({
73
+ func: bootstrap,
74
+ description: 'Generate only type files (setup phase only)',
75
+ }),
76
+ watch: pikkuCLICommand({
77
+ func: watch,
78
+ description: 'Watch for file changes and regenerate automatically',
79
+ }),
80
+ schemas: pikkuCLICommand({
81
+ func: pikkuSchemas,
82
+ description: 'Generate JSON schemas for function input/output types',
83
+ }),
84
+ fetch: pikkuCLICommand({
85
+ func: pikkuFetch,
86
+ description: 'Generate type-safe HTTP fetch client',
87
+ }),
88
+ websocket: pikkuCLICommand({
89
+ func: pikkuWebSocketTyped,
90
+ description: 'Generate type-safe WebSocket client',
91
+ }),
92
+ rpc: pikkuCLICommand({
93
+ func: pikkuRPCClient,
94
+ description: 'Generate RPC client wrappers',
95
+ }),
96
+ 'queue-service': pikkuCLICommand({
97
+ func: pikkuQueueService,
98
+ description: 'Generate queue service wrapper',
99
+ }),
100
+ openapi: pikkuCLICommand({
101
+ func: pikkuOpenAPI,
102
+ description: 'Generate OpenAPI specification from HTTP routes',
103
+ }),
104
+ nextjs: pikkuCLICommand({
105
+ func: pikkuNext,
106
+ description: 'Generate Next.js backend and HTTP wrappers',
107
+ }),
108
+ },
109
+ });
@@ -23,6 +23,7 @@ export const all = pikkuVoidFunc({
23
23
  await rpc.invoke('pikkuChannelTypes', null);
24
24
  await rpc.invoke('pikkuSchedulerTypes', null);
25
25
  await rpc.invoke('pikkuQueueTypes', null);
26
+ await rpc.invoke('pikkuWorkflowTypes', null);
26
27
  await rpc.invoke('pikkuMCPTypes', null);
27
28
  await rpc.invoke('pikkuCLITypes', null);
28
29
  const hasFunctionRegistrations = await rpc.invoke('pikkuFunctions', null);
@@ -69,6 +70,22 @@ export const all = pikkuVoidFunc({
69
70
  if (scheduler) {
70
71
  allImports.push(config.schedulersWiringMetaFile, config.schedulersWiringFile);
71
72
  }
73
+ // Generate Workflows
74
+ const workflows = await rpc.invoke('pikkuWorkflow', null);
75
+ // Generate Remote RPC Workers (must be before queue discovery so wireQueueWorker calls are picked up)
76
+ const remoteRPC = await rpc.invoke('pikkuRemoteRPC', null);
77
+ // Reinspect to pick up generated workflow workers and remote RPC workers BEFORE generating maps
78
+ if (workflows || remoteRPC) {
79
+ await getInspectorState(true);
80
+ }
81
+ if (workflows) {
82
+ await rpc.invoke('pikkuWorkflowMap', null);
83
+ allImports.push(config.workflowsWiringMetaFile, config.workflowsWiringFile);
84
+ }
85
+ if (remoteRPC && config.rpc?.remoteRpcWorkersPath) {
86
+ // Only add to imports if we actually generated the file
87
+ allImports.push(config.rpc.remoteRpcWorkersPath);
88
+ }
72
89
  // Generate Queues
73
90
  const queues = await rpc.invoke('pikkuQueue', null);
74
91
  if (queues) {
@@ -131,6 +148,9 @@ export const all = pikkuVoidFunc({
131
148
  if (totalCommands > 0)
132
149
  summary.set('cliCommands', totalCommands);
133
150
  }
151
+ if (state.workflows?.meta) {
152
+ summary.set('workflows', Object.keys(state.workflows.meta).length);
153
+ }
134
154
  // Display summary (unless in silent mode)
135
155
  if (!logger.isSilent()) {
136
156
  console.log(summary.format());
@@ -13,6 +13,7 @@ export const bootstrap = pikkuVoidFunc({
13
13
  await rpc.invoke('pikkuChannelTypes', null);
14
14
  await rpc.invoke('pikkuSchedulerTypes', null);
15
15
  await rpc.invoke('pikkuQueueTypes', null);
16
+ await rpc.invoke('pikkuWorkflowTypes', null);
16
17
  await rpc.invoke('pikkuMCPTypes', null);
17
18
  await rpc.invoke('pikkuCLITypes', null);
18
19
  // Check for critical errors and exit if any were logged
@@ -99,29 +99,10 @@ ${rendererImports}
99
99
  * Executes CLI commands over a WebSocket connection
100
100
  */
101
101
  export async function ${capitalizedName}CLIClient(
102
- url: string,
102
+ ws: WebSocket,
103
103
  args?: string[]
104
104
  ): Promise<void> {
105
- // Get WebSocket implementation (browser or Node.js)
106
- let WebSocketImpl: any
107
- if (typeof WebSocket !== 'undefined') {
108
- WebSocketImpl = WebSocket
109
- } else {
110
- // Node.js environment - dynamically import 'ws'
111
- try {
112
- const wsModule = await import('ws')
113
- WebSocketImpl = wsModule.default
114
- } catch (e) {
115
- throw new Error(
116
- 'No WebSocket implementation found. In Node.js environments, you need to:\\n' +
117
- '1. Install the "ws" package: npm install ws\\n' +
118
- 'Learn more: https://www.npmjs.com/package/ws'
119
- )
120
- }
121
- }
122
-
123
- // Create WebSocket connection
124
- const ws = new WebSocketImpl(url) as WebSocket
105
+ // Create Pikku WebSocket wrapper
125
106
  const pikkuWS = new CorePikkuWebsocket(ws)
126
107
 
127
108
  // Register renderers for CLI commands
@@ -141,7 +122,19 @@ export default ${capitalizedName}CLIClient
141
122
  // For direct execution (if this file is run directly)
142
123
  if (import.meta.url === \`file://\${process.argv[1]}\`) {
143
124
  const url = process.env.PIKKU_WS_URL || 'ws://localhost:4002${finalChannelRoute}'
144
- ${capitalizedName}CLIClient(url, process.argv.slice(2)).catch(error => {
125
+
126
+ // Create WebSocket instance
127
+ let WebSocketImpl: any
128
+ if (typeof WebSocket !== 'undefined') {
129
+ WebSocketImpl = WebSocket
130
+ } else {
131
+ // Node.js environment - dynamically import 'ws'
132
+ const wsModule = await import('ws')
133
+ WebSocketImpl = wsModule.default
134
+ }
135
+
136
+ const ws = new WebSocketImpl(url) as WebSocket
137
+ ${capitalizedName}CLIClient(ws, process.argv.slice(2)).catch(error => {
145
138
  console.error('Fatal channel CLI error:', error)
146
139
  // TODO: We get an error code even when it exists cleanly, investigate
147
140
  // process.exit(1)
@@ -8,7 +8,15 @@ export const pikkuQueue = pikkuSessionlessFunc({
8
8
  const visitState = await getInspectorState();
9
9
  const { queueWorkersWiringFile, queueWorkersWiringMetaFile, packageMappings, } = config;
10
10
  const { queueWorkers } = visitState;
11
- await writeFileInDir(logger, queueWorkersWiringMetaFile, serializeQueueMeta(queueWorkers.meta));
11
+ // Add remote RPC worker to queue metadata if it exists
12
+ const queueMeta = { ...queueWorkers.meta };
13
+ if (config.rpc?.remoteRpcWorkersPath) {
14
+ queueMeta['pikku-remote-internal-rpc'] = {
15
+ pikkuFuncName: 'pikkuRemoteInternalRPC',
16
+ queueName: 'pikku-remote-internal-rpc',
17
+ };
18
+ }
19
+ await writeFileInDir(logger, queueWorkersWiringMetaFile, serializeQueueMeta(queueMeta));
12
20
  await writeFileInDir(logger, queueWorkersWiringFile, serializeFileImports('addQueueWorkers', queueWorkersWiringFile, queueWorkers.files, packageMappings));
13
21
  return true;
14
22
  },
@@ -1,4 +1,4 @@
1
- import type { queueWorkersMeta } from '@pikku/core/queue';
1
+ import type { QueueWorkersMeta } from '@pikku/core/queue';
2
2
  import { TypesMap } from '@pikku/inspector';
3
3
  import { FunctionsMeta } from '@pikku/core';
4
- export declare const serializeQueueMap: (relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, functionsMeta: FunctionsMeta, queueWorkersMeta: queueWorkersMeta) => string;
4
+ export declare const serializeQueueMap: (relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, functionsMeta: FunctionsMeta, queueWorkersMeta: QueueWorkersMeta) => string;
@@ -1,2 +1,2 @@
1
- import { queueWorkersMeta } from '@pikku/core/queue';
2
- export declare const serializeQueueMeta: (queueWorkersMeta: queueWorkersMeta) => string;
1
+ import { QueueWorkersMeta } from '@pikku/core/queue';
2
+ export declare const serializeQueueMeta: (queueWorkersMeta: QueueWorkersMeta) => string;
@@ -0,0 +1 @@
1
+ export declare const pikkuPublicRPC: any;