@pikku/cli 0.10.0 → 0.10.2

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 (152) hide show
  1. package/.pikku/channel/pikku-channel-types.gen.ts +4 -3
  2. package/.pikku/channel/pikku-channels-map.gen.d.ts +2 -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-types.gen.ts +23 -1
  6. package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +4 -115
  7. package/.pikku/cli/pikku-cli-wirings.gen.ts +2 -3
  8. package/.pikku/function/pikku-function-types.gen.ts +1 -1
  9. package/.pikku/function/pikku-functions-meta.gen.ts +156 -138
  10. package/.pikku/function/pikku-functions-meta.min.gen.ts +37 -32
  11. package/.pikku/function/pikku-functions.gen.ts +1 -1
  12. package/.pikku/http/pikku-http-types.gen.ts +1 -1
  13. package/.pikku/http/pikku-http-wirings-map.gen.d.ts +2 -2
  14. package/.pikku/http/pikku-http-wirings-meta.gen.ts +1 -1
  15. package/.pikku/http/pikku-http-wirings.gen.ts +1 -1
  16. package/.pikku/mcp/pikku-mcp-types.gen.ts +1 -1
  17. package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +1 -1
  18. package/.pikku/mcp/pikku-mcp-wirings.gen.ts +1 -1
  19. package/.pikku/pikku-bootstrap.gen.ts +1 -1
  20. package/.pikku/pikku-services.gen.ts +16 -12
  21. package/.pikku/pikku-types.gen.ts +1 -1
  22. package/.pikku/pikku-websocket.gen.ts +15 -1
  23. package/.pikku/queue/pikku-queue-types.gen.ts +1 -1
  24. package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +2 -2
  25. package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +1 -1
  26. package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +1 -1
  27. package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +2 -2
  28. package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +10 -9
  29. package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +9 -8
  30. package/.pikku/scheduler/pikku-scheduler-types.gen.ts +1 -1
  31. package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +1 -1
  32. package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +1 -1
  33. package/.pikku/schemas/register.gen.ts +5 -5
  34. package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  35. package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
  36. package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
  37. package/CHANGELOG.md +58 -0
  38. package/bin/pikku.ts +30 -21
  39. package/cli.schema.json +1 -1
  40. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +4 -3
  41. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  42. package/dist/.pikku/channel/pikku-channels-meta.gen.js +1 -1
  43. package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
  44. package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
  45. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +18 -1
  46. package/dist/.pikku/cli/pikku-cli-types.gen.js +20 -1
  47. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +4 -115
  48. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -2
  49. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -2
  50. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  51. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  52. package/dist/.pikku/function/pikku-functions-meta.gen.js +156 -138
  53. package/dist/.pikku/function/pikku-functions-meta.min.gen.js +37 -32
  54. package/dist/.pikku/function/pikku-functions.gen.js +1 -1
  55. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  56. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  57. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  58. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  59. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  60. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  61. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  62. package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +1 -1
  63. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
  64. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
  65. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  66. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  67. package/dist/.pikku/pikku-services.gen.d.ts +9 -6
  68. package/dist/.pikku/pikku-services.gen.js +8 -2
  69. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  70. package/dist/.pikku/pikku-types.gen.js +1 -1
  71. package/dist/.pikku/pikku-websocket.gen.d.ts +15 -1
  72. package/dist/.pikku/pikku-websocket.gen.js +15 -1
  73. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  74. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  75. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  76. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  77. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  78. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +9 -8
  79. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  80. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  81. package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +1 -1
  82. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
  83. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
  84. package/dist/.pikku/schemas/register.gen.js +3 -3
  85. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  86. package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
  87. package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
  88. package/dist/bin/pikku.js +24 -19
  89. package/dist/src/cli.wiring.js +107 -99
  90. package/dist/src/functions/commands/all.js +31 -2
  91. package/dist/src/functions/commands/bootstrap.d.ts +1 -0
  92. package/dist/src/functions/commands/bootstrap.js +23 -0
  93. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +46 -2
  94. package/dist/src/functions/wirings/channels/serialize-channel-types.js +3 -2
  95. package/dist/src/functions/wirings/channels/serialize-websocket-wrapper.js +14 -0
  96. package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +4 -4
  97. package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +24 -4
  98. package/dist/src/functions/wirings/cli/serialize-channel-cli.js +32 -7
  99. package/dist/src/functions/wirings/cli/serialize-cli-types.js +22 -0
  100. package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
  101. package/dist/src/functions/wirings/functions/pikku-command-services.js +54 -26
  102. package/dist/src/functions/wirings/functions/schemas.js +2 -2
  103. package/dist/src/functions/wirings/http/pikku-command-openapi.js +1 -1
  104. package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +3 -10
  105. package/dist/src/middleware/log-command-info-and-time.d.ts +1 -1
  106. package/dist/src/middleware/log-command-info-and-time.js +8 -5
  107. package/dist/src/services/cli-logger.service.d.ts +7 -2
  108. package/dist/src/services/cli-logger.service.js +16 -4
  109. package/dist/src/services.js +77 -12
  110. package/dist/src/utils/check-required-types.js +11 -1
  111. package/dist/src/utils/command-summary.d.ts +43 -0
  112. package/dist/src/utils/command-summary.js +73 -0
  113. package/dist/src/utils/file-writer.js +2 -2
  114. package/dist/src/utils/pikku-cli-config.js +28 -0
  115. package/dist/src/utils/schema-generator.d.ts +2 -2
  116. package/dist/src/utils/schema-generator.js +3 -3
  117. package/dist/tsconfig.tsbuildinfo +1 -1
  118. package/package.json +3 -4
  119. package/pikku.config.json +5 -2
  120. package/src/cli.wiring.ts +106 -101
  121. package/src/functions/commands/all.ts +38 -2
  122. package/src/functions/commands/bootstrap.ts +27 -0
  123. package/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +46 -2
  124. package/src/functions/wirings/channels/serialize-channel-types.ts +3 -2
  125. package/src/functions/wirings/channels/serialize-websocket-wrapper.ts +14 -0
  126. package/src/functions/wirings/cli/pikku-command-cli-entry.ts +4 -4
  127. package/src/functions/wirings/cli/serialize-channel-cli-client.ts +24 -4
  128. package/src/functions/wirings/cli/serialize-channel-cli.ts +40 -8
  129. package/src/functions/wirings/cli/serialize-cli-types.ts +22 -0
  130. package/src/functions/wirings/functions/pikku-command-services.ts +57 -28
  131. package/src/functions/wirings/functions/schemas.ts +4 -3
  132. package/src/functions/wirings/http/pikku-command-openapi.ts +2 -1
  133. package/src/functions/wirings/middleware/pikku-command-middleware.ts +11 -22
  134. package/src/middleware/log-command-info-and-time.ts +8 -5
  135. package/src/services/cli-logger.service.ts +20 -5
  136. package/src/services.ts +86 -11
  137. package/src/utils/check-required-types.ts +16 -1
  138. package/src/utils/command-summary.ts +101 -0
  139. package/src/utils/file-writer.ts +2 -2
  140. package/src/utils/pikku-cli-config.ts +28 -0
  141. package/src/utils/schema-generator.ts +5 -4
  142. package/types/application-types.d.ts +5 -1
  143. package/types/config.d.ts +16 -6
  144. package/.pikku/cli/pikku-cli-channel.gen.ts +0 -34
  145. package/.pikku/cli/pikku-cli-client.gen.ts +0 -43
  146. package/.pikku/cli/pikku-cli.gen.ts +0 -41
  147. package/dist/.pikku/cli/pikku-cli-channel.gen.d.ts +0 -1
  148. package/dist/.pikku/cli/pikku-cli-channel.gen.js +0 -33
  149. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +0 -10
  150. package/dist/.pikku/cli/pikku-cli-client.gen.js +0 -34
  151. package/dist/.pikku/cli/pikku-cli.gen.d.ts +0 -10
  152. package/dist/.pikku/cli/pikku-cli.gen.js +0 -38
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  /**
5
5
 
@@ -9,11 +9,12 @@
9
9
  import { CoreChannel, wireChannel as wireChannelCore } from '@pikku/core/channel'
10
10
  import { CorePikkuFunctionConfig } from '@pikku/core'
11
11
  import { AssertHTTPWiringParams } from '@pikku/core/http'
12
- import type { PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware } from '../function/pikku-function-types.gen.js'
12
+ import type { PikkuFunction, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware } from '../function/pikku-function-types.gen.js'
13
13
 
14
14
  /**
15
15
  * Type definition for WebSocket channels with typed data exchange.
16
16
  * Supports connection, disconnection, and message handling.
17
+ * Accepts both session-based (PikkuFunction) and sessionless (PikkuFunctionSessionless) functions.
17
18
  *
18
19
  * @template ChannelData - Type of data exchanged through the channel
19
20
  * @template Channel - String literal type for the channel name
@@ -23,7 +24,7 @@ type ChannelWiring<ChannelData, Channel extends string> = CoreChannel<
23
24
  Channel,
24
25
  CorePikkuFunctionConfig<PikkuFunctionSessionless<void, any, ChannelData>, PikkuPermission<void>, PikkuMiddleware>,
25
26
  CorePikkuFunctionConfig<PikkuFunctionSessionless<void, void, ChannelData>, PikkuPermission<void>, PikkuMiddleware>,
26
- CorePikkuFunctionConfig<PikkuFunctionSessionless<any, any, ChannelData>, PikkuPermission<any>, PikkuMiddleware>,
27
+ CorePikkuFunctionConfig<PikkuFunctionSessionless<any, any, ChannelData> | PikkuFunction<any, any, ChannelData>, PikkuPermission<any>, PikkuMiddleware>,
27
28
  PikkuPermission,
28
29
  PikkuMiddleware
29
30
  >
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  /**
5
5
  * This provides the structure needed for TypeScript to be aware of channels
@@ -9,10 +9,10 @@
9
9
 
10
10
  // Custom types are those that are defined directly within generics
11
11
  // or are broken into simpler types
12
- export type PikkuSchemasOutput = false | true
13
12
  export type PikkuChannelsOutput = false | true
14
13
  export type PikkuCLIOutput = false | true
15
14
  export type PikkuFunctionsOutput = false | true
15
+ export type PikkuSchemasOutput = false | true
16
16
  export type PikkuHTTPOutput = false | true
17
17
  export type PikkuMCPOutput = false | true
18
18
  export type PikkuMiddlewareOutput = false | true
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  import { pikkuState } from '@pikku/core'
5
5
  pikkuState('channel', 'meta', {})
@@ -1,4 +1,4 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  /* The files with an addChannel function call */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  /**
5
5
 
@@ -23,6 +23,28 @@ type Session = UserSession
23
23
  */
24
24
  type PikkuCLIRender<Data, RequiredServices extends SingletonServices = SingletonServices> = CorePikkuCLIRender<Data, RequiredServices, Session>
25
25
 
26
+ /**
27
+ * Creates a type-safe CLI renderer with access to your application's singleton services.
28
+ * The renderer receives the full singleton services and output data to format and display results.
29
+ *
30
+ * @template Data - The output data type from the CLI command
31
+ * @template RequiredServices - The minimum services required for type checking (defaults to SingletonServices)
32
+ * @param render - Function that receives singleton services and data to render output
33
+ * @returns A CLI renderer configuration
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const myRenderer = pikkuCLIRender<MyData>(({ logger }, data) => {
38
+ * logger.info(data.message)
39
+ * })
40
+ * ```
41
+ */
42
+ export const pikkuCLIRender = <Data, RequiredServices extends SingletonServices = SingletonServices>(
43
+ render: (services: SingletonServices, data: Data) => void | Promise<void>
44
+ ): PikkuCLIRender<Data, RequiredServices> => {
45
+ return render as any
46
+ }
47
+
26
48
  /**
27
49
  * CLI command configuration with project-specific types.
28
50
  * Uses CoreCLICommandConfig from @pikku/core with local middleware and render types.
@@ -1,120 +1,9 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  import { pikkuState } from '@pikku/core'
5
5
  pikkuState('cli', 'meta', {
6
- "programs": {
7
- "pikku": {
8
- "program": "pikku",
9
- "commands": {
10
- "all": {
11
- "pikkuFuncName": "all",
12
- "positionals": [],
13
- "options": {
14
- "tags": {
15
- "description": "Filter functions by tags (comma-separated)",
16
- "short": "t"
17
- },
18
- "types": {
19
- "description": "Filter functions by types (comma-separated)"
20
- },
21
- "directories": {
22
- "description": "Filter functions by directories (comma-separated)",
23
- "short": "d"
24
- },
25
- "httpMethods": {
26
- "description": "Filter HTTP routes by methods (comma-separated)"
27
- },
28
- "httpRoutes": {
29
- "description": "Filter HTTP routes by route patterns (comma-separated)"
30
- },
31
- "names": {
32
- "description": "Filter functions by name patterns (supports wildcards)",
33
- "short": "n"
34
- }
35
- },
36
- "description": "Generate all Pikku files (types, schemas, wirings, etc.)",
37
- "isDefault": true
38
- },
39
- "schemas": {
40
- "pikkuFuncName": "pikkuSchemas",
41
- "positionals": [],
42
- "options": {},
43
- "description": "Generate JSON schemas for function input/output types"
44
- },
45
- "fetch": {
46
- "pikkuFuncName": "pikkuFetch",
47
- "positionals": [],
48
- "options": {},
49
- "description": "Generate type-safe HTTP fetch client"
50
- },
51
- "websocket": {
52
- "pikkuFuncName": "pikkuWebSocketTyped",
53
- "positionals": [],
54
- "options": {},
55
- "description": "Generate type-safe WebSocket client"
56
- },
57
- "rpc": {
58
- "pikkuFuncName": "pikkuRPCClient",
59
- "positionals": [],
60
- "options": {},
61
- "description": "Generate RPC client wrappers"
62
- },
63
- "queue-service": {
64
- "pikkuFuncName": "pikkuQueueService",
65
- "positionals": [],
66
- "options": {},
67
- "description": "Generate queue service wrapper"
68
- },
69
- "openapi": {
70
- "pikkuFuncName": "pikkuOpenAPI",
71
- "positionals": [],
72
- "options": {},
73
- "description": "Generate OpenAPI specification from HTTP routes"
74
- },
75
- "nextjs": {
76
- "pikkuFuncName": "pikkuNext",
77
- "positionals": [],
78
- "options": {},
79
- "description": "Generate Next.js backend and HTTP wrappers"
80
- }
81
- },
82
- "options": {
83
- "config": {
84
- "description": "Path to pikku.config.json file",
85
- "short": "c"
86
- },
87
- "logLevel": {
88
- "description": "Set log level",
89
- "short": "l",
90
- "choices": [
91
- "trace",
92
- "debug",
93
- "info",
94
- "warn",
95
- "error",
96
- "critical"
97
- ]
98
- },
99
- "userSessionType": {
100
- "description": "Specify which UserSession type to use (when multiple exist)"
101
- },
102
- "singletonServicesFactoryType": {
103
- "description": "Specify which singleton services factory to use"
104
- },
105
- "sessionServicesFactoryType": {
106
- "description": "Specify which session services factory to use"
107
- },
108
- "stateOutput": {
109
- "description": "Save inspector state to JSON file for reuse"
110
- },
111
- "stateInput": {
112
- "description": "Load inspector state from JSON file (skips inspection)"
113
- }
114
- },
115
- "defaultRenderName": "clientCLIRenderer"
116
- }
117
- },
6
+ "programs": {},
118
7
  "renderers": {
119
8
  "defaultCLIRenderer": {
120
9
  "name": "defaultCLIRenderer",
@@ -130,7 +19,7 @@ pikkuState('cli', 'meta', {
130
19
  "variables"
131
20
  ]
132
21
  },
133
- "filePath": "/home/runner/work/pikku/pikku/packages/cli/src/services.ts"
22
+ "filePath": "src/services.ts"
134
23
  },
135
24
  "clientCLIRenderer": {
136
25
  "name": "clientCLIRenderer",
@@ -139,7 +28,7 @@ pikkuState('cli', 'meta', {
139
28
  "optimized": true,
140
29
  "services": []
141
30
  },
142
- "filePath": "/home/runner/work/pikku/pikku/packages/cli/src/services.ts"
31
+ "filePath": "src/services.ts"
143
32
  }
144
33
  }
145
34
  })
@@ -1,6 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  /* The files with an wireCLI function call */
5
- import '../../src/services.js'
6
- import '../../src/cli.wiring.js'
5
+ import '../../src/services.js'
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.10.0
2
+ * This file was generated by @pikku/cli@0.10.2
3
3
  */
4
4
  /**
5
5
  * Core function, middleware, and permission types for all wirings