@pikku/cli 0.7.7 → 0.8.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.
- package/CHANGELOG.md +43 -0
- package/bin/pikku-all.ts +188 -91
- package/bin/pikku-fetch.ts +10 -38
- package/bin/pikku-nextjs.ts +12 -113
- package/bin/pikku-openapi.ts +9 -54
- package/bin/pikku-queue-service.ts +28 -0
- package/bin/pikku-schemas.ts +6 -32
- package/bin/pikku-websocket.ts +11 -41
- package/bin/pikku.ts +2 -0
- package/cli.schema.json +113 -10
- package/dist/bin/pikku-all.d.ts +1 -1
- package/dist/bin/pikku-all.js +105 -84
- package/dist/bin/pikku-fetch.d.ts +1 -3
- package/dist/bin/pikku-fetch.js +9 -15
- package/dist/bin/pikku-nextjs.d.ts +1 -4
- package/dist/bin/pikku-nextjs.js +10 -40
- package/dist/bin/pikku-openapi.d.ts +0 -3
- package/dist/bin/pikku-openapi.js +8 -24
- package/dist/bin/pikku-queue-service.d.ts +4 -0
- package/dist/bin/pikku-queue-service.js +19 -0
- package/dist/bin/pikku-schemas.d.ts +0 -3
- package/dist/bin/pikku-schemas.js +5 -11
- package/dist/bin/pikku-websocket.d.ts +1 -3
- package/dist/bin/pikku-websocket.js +9 -18
- package/dist/bin/pikku.js +2 -0
- package/dist/src/events/channels/pikku-channels.d.ts +2 -0
- package/dist/src/events/channels/pikku-channels.js +9 -0
- package/dist/src/events/channels/pikku-command-channels-map.d.ts +2 -0
- package/dist/src/events/channels/pikku-command-channels-map.js +8 -0
- package/dist/src/events/channels/pikku-command-channels.d.ts +2 -0
- package/dist/src/events/channels/pikku-command-channels.js +9 -0
- package/dist/src/events/channels/pikku-command-websocket-typed.d.ts +2 -0
- package/dist/src/events/channels/pikku-command-websocket-typed.js +15 -0
- package/dist/src/{serialize-typed-channel-map.js → events/channels/serialize-typed-channel-map.js} +2 -2
- package/dist/src/events/fetch/index.d.ts +2 -0
- package/dist/src/events/fetch/index.js +12 -0
- package/dist/src/events/functions/pikku-command-function-types.d.ts +2 -0
- package/dist/src/events/functions/pikku-command-function-types.js +13 -0
- package/dist/src/events/functions/pikku-command-functions.d.ts +6 -0
- package/dist/src/events/functions/pikku-command-functions.js +35 -0
- package/dist/src/events/functions/pikku-command-services.d.ts +3 -0
- package/dist/src/events/functions/pikku-command-services.js +73 -0
- package/dist/src/events/functions/pikku-function-types.d.ts +2 -0
- package/dist/{bin → src/events/functions}/pikku-function-types.js +6 -6
- package/dist/src/events/functions/pikku-functions.d.ts +6 -0
- package/dist/{bin → src/events/functions}/pikku-functions.js +5 -5
- package/dist/src/events/http/pikku-command-http-map.d.ts +2 -0
- package/dist/src/events/http/pikku-command-http-map.js +8 -0
- package/dist/src/events/http/pikku-command-http-routes.d.ts +2 -0
- package/dist/src/events/http/pikku-command-http-routes.js +9 -0
- package/dist/src/events/http/pikku-command-openapi.d.ts +2 -0
- package/dist/src/events/http/pikku-command-openapi.js +20 -0
- package/dist/src/events/http/pikku-http-routes.d.ts +2 -0
- package/dist/src/events/http/pikku-http-routes.js +9 -0
- package/dist/src/{serialize-typed-http-map.d.ts → events/http/serialize-typed-http-map.d.ts} +0 -1
- package/dist/src/{serialize-typed-http-map.js → events/http/serialize-typed-http-map.js} +2 -15
- package/dist/src/events/mcp/pikku-command-mcp-json.d.ts +2 -0
- package/dist/src/events/mcp/pikku-command-mcp-json.js +13 -0
- package/dist/src/events/mcp/pikku-command-mcp.d.ts +2 -0
- package/dist/src/events/mcp/pikku-command-mcp.js +54 -0
- package/dist/src/events/mcp/serialize-mcp-json.d.ts +5 -0
- package/dist/src/events/mcp/serialize-mcp-json.js +101 -0
- package/dist/src/events/queue/pikku-command-queue-map.d.ts +2 -0
- package/dist/src/events/queue/pikku-command-queue-map.js +8 -0
- package/dist/src/events/queue/pikku-command-queue-service.d.ts +2 -0
- package/dist/src/events/queue/pikku-command-queue-service.js +12 -0
- package/dist/src/events/queue/pikku-command-queue.d.ts +2 -0
- package/dist/src/events/queue/pikku-command-queue.js +10 -0
- package/dist/src/events/queue/pikku-queue-map.d.ts +2 -0
- package/dist/src/events/queue/pikku-queue-map.js +8 -0
- package/dist/src/events/queue/pikku-queue.d.ts +2 -0
- package/dist/src/events/queue/pikku-queue.js +10 -0
- package/dist/src/events/queue/serialize-queue-map.d.ts +4 -0
- package/dist/src/events/queue/serialize-queue-map.js +77 -0
- package/dist/src/events/queue/serialize-queue-meta.d.ts +2 -0
- package/dist/src/events/queue/serialize-queue-meta.js +6 -0
- package/dist/src/events/queue/serialize-queue-wrapper.d.ts +1 -0
- package/dist/src/events/queue/serialize-queue-wrapper.js +35 -0
- package/dist/src/events/rpc/pikku-command-rpc-client.d.ts +2 -0
- package/dist/src/events/rpc/pikku-command-rpc-client.js +12 -0
- package/dist/src/events/rpc/pikku-command-rpc-map.d.ts +2 -0
- package/dist/src/events/rpc/pikku-command-rpc-map.js +8 -0
- package/dist/src/events/rpc/pikku-command-rpc.d.ts +2 -0
- package/dist/src/events/rpc/pikku-command-rpc.js +6 -0
- package/dist/src/events/rpc/pikku-rpc.d.ts +2 -0
- package/dist/src/events/rpc/pikku-rpc.js +6 -0
- package/dist/src/events/rpc/serialize-rpc-wrapper.d.ts +1 -0
- package/dist/src/events/rpc/serialize-rpc-wrapper.js +29 -0
- package/dist/src/{serialize-typed-rpc-map.d.ts → events/rpc/serialize-typed-rpc-map.d.ts} +1 -1
- package/dist/src/{serialize-typed-rpc-map.js → events/rpc/serialize-typed-rpc-map.js} +3 -3
- package/dist/src/events/scheduler/pikku-command-scheduler.d.ts +2 -0
- package/dist/src/events/scheduler/pikku-command-scheduler.js +10 -0
- package/dist/src/inspector-glob.d.ts +1 -1
- package/dist/src/inspector-glob.js +4 -4
- package/dist/src/pikku-cli-config.d.ts +12 -2
- package/dist/src/pikku-cli-config.js +79 -30
- package/dist/src/pikku-command-schemas.d.ts +2 -0
- package/dist/src/pikku-command-schemas.js +8 -0
- package/dist/src/runtimes/nextjs/pikku-command-nextjs.d.ts +2 -0
- package/dist/src/runtimes/nextjs/pikku-command-nextjs.js +36 -0
- package/dist/src/schema-generator.d.ts +3 -2
- package/dist/src/schema-generator.js +9 -9
- package/dist/src/schemas.d.ts +2 -0
- package/dist/src/schemas.js +8 -0
- package/dist/src/{utils/serialize-import-map.js → serialize-import-map.js} +3 -0
- package/dist/src/serialize-pikku-types.js +378 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.js +1 -0
- package/dist/src/{utils/utils.d.ts → utils.d.ts} +20 -7
- package/dist/src/{utils/utils.js → utils.js} +56 -32
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/{bin → src/events/channels}/pikku-channels.ts +8 -3
- package/src/events/channels/pikku-command-channels-map.ts +26 -0
- package/src/events/channels/pikku-command-channels.ts +38 -0
- package/src/events/channels/pikku-command-websocket-typed.ts +36 -0
- package/src/{serialize-typed-channel-map.ts → events/channels/serialize-typed-channel-map.ts} +2 -2
- package/src/events/fetch/index.ts +33 -0
- package/src/events/functions/pikku-command-function-types.ts +48 -0
- package/src/events/functions/pikku-command-functions.ts +84 -0
- package/src/events/functions/pikku-command-services.ts +125 -0
- package/{bin → src/events/functions}/pikku-function-types.ts +12 -15
- package/{bin → src/events/functions}/pikku-functions.ts +9 -6
- package/src/events/http/pikku-command-http-map.ts +27 -0
- package/src/events/http/pikku-command-http-routes.ts +40 -0
- package/src/events/http/pikku-command-openapi.ts +54 -0
- package/{bin → src/events/http}/pikku-http-routes.ts +8 -3
- package/src/{serialize-typed-http-map.ts → events/http/serialize-typed-http-map.ts} +2 -19
- package/src/events/mcp/pikku-command-mcp-json.ts +33 -0
- package/src/events/mcp/pikku-command-mcp.ts +110 -0
- package/src/events/mcp/serialize-mcp-json.ts +159 -0
- package/src/events/queue/pikku-command-queue-map.ts +26 -0
- package/src/events/queue/pikku-command-queue-service.ts +33 -0
- package/src/events/queue/pikku-command-queue.ts +42 -0
- package/src/events/queue/pikku-queue-map.ts +26 -0
- package/src/events/queue/pikku-queue.ts +40 -0
- package/src/events/queue/serialize-queue-map.ts +119 -0
- package/src/events/queue/serialize-queue-meta.ts +10 -0
- package/src/events/queue/serialize-queue-wrapper.ts +35 -0
- package/src/events/rpc/pikku-command-rpc-client.ts +33 -0
- package/src/events/rpc/pikku-command-rpc-map.ts +26 -0
- package/src/events/rpc/pikku-command-rpc.ts +22 -0
- package/{bin → src/events/rpc}/pikku-rpc.ts +8 -6
- package/src/events/rpc/serialize-rpc-wrapper.ts +29 -0
- package/src/{serialize-typed-rpc-map.ts → events/rpc/serialize-typed-rpc-map.ts} +5 -4
- package/{bin/pikku-scheduler.ts → src/events/scheduler/pikku-command-scheduler.ts} +11 -8
- package/src/inspector-glob.ts +4 -2
- package/src/pikku-cli-config.ts +119 -42
- package/src/pikku-command-schemas.ts +33 -0
- package/src/runtimes/nextjs/pikku-command-nextjs.ts +110 -0
- package/src/schema-generator.ts +10 -5
- package/src/schemas.ts +33 -0
- package/src/{utils/serialize-import-map.ts → serialize-import-map.ts} +5 -0
- package/src/serialize-pikku-types.ts +378 -1
- package/src/types.ts +16 -0
- package/src/{utils/utils.ts → utils.ts} +68 -34
- package/tsconfig.json +1 -1
- package/bin/pikku-channels-map.ts +0 -25
- package/bin/pikku-http-map.ts +0 -26
- package/bin/pikku-nextjs.test.ts +0 -279
- package/bin/pikku-rpc-map.ts +0 -25
- package/dist/bin/pikku-channels-map.d.ts +0 -3
- package/dist/bin/pikku-channels-map.js +0 -8
- package/dist/bin/pikku-channels.d.ts +0 -3
- package/dist/bin/pikku-channels.js +0 -9
- package/dist/bin/pikku-function-types.d.ts +0 -4
- package/dist/bin/pikku-functions.d.ts +0 -7
- package/dist/bin/pikku-http-map.d.ts +0 -3
- package/dist/bin/pikku-http-map.js +0 -8
- package/dist/bin/pikku-http-routes.d.ts +0 -3
- package/dist/bin/pikku-http-routes.js +0 -9
- package/dist/bin/pikku-rpc-map.d.ts +0 -3
- package/dist/bin/pikku-rpc-map.js +0 -8
- package/dist/bin/pikku-rpc.d.ts +0 -3
- package/dist/bin/pikku-rpc.js +0 -6
- package/dist/bin/pikku-scheduler.d.ts +0 -3
- package/dist/bin/pikku-scheduler.js +0 -10
- /package/dist/src/{serialize-typed-channel-map.d.ts → events/channels/serialize-typed-channel-map.d.ts} +0 -0
- /package/dist/src/{serialize-websocket-wrapper.d.ts → events/channels/serialize-websocket-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-websocket-wrapper.js → events/channels/serialize-websocket-wrapper.js} +0 -0
- /package/dist/src/{openapi-spec-generator.d.ts → events/http/openapi-spec-generator.d.ts} +0 -0
- /package/dist/src/{openapi-spec-generator.js → events/http/openapi-spec-generator.js} +0 -0
- /package/dist/src/{serialize-fetch-wrapper.d.ts → events/http/serialize-fetch-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-fetch-wrapper.js → events/http/serialize-fetch-wrapper.js} +0 -0
- /package/dist/src/{serialize-scheduler-meta.d.ts → events/scheduler/serialize-scheduler-meta.d.ts} +0 -0
- /package/dist/src/{serialize-scheduler-meta.js → events/scheduler/serialize-scheduler-meta.js} +0 -0
- /package/dist/src/{serialize-nextjs-backend-wrapper.d.ts → runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-nextjs-backend-wrapper.js → runtimes/nextjs/serialize-nextjs-backend-wrapper.js} +0 -0
- /package/dist/src/{serialize-nextjs-http-wrapper.d.ts → runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-nextjs-http-wrapper.js → runtimes/nextjs/serialize-nextjs-http-wrapper.js} +0 -0
- /package/dist/src/{utils/serialize-import-map.d.ts → serialize-import-map.d.ts} +0 -0
- /package/src/{serialize-websocket-wrapper.ts → events/channels/serialize-websocket-wrapper.ts} +0 -0
- /package/src/{openapi-spec-generator.ts → events/http/openapi-spec-generator.ts} +0 -0
- /package/src/{serialize-fetch-wrapper.ts → events/http/serialize-fetch-wrapper.ts} +0 -0
- /package/src/{serialize-scheduler-meta.ts → events/scheduler/serialize-scheduler-meta.ts} +0 -0
- /package/src/{serialize-nextjs-backend-wrapper.ts → runtimes/nextjs/serialize-nextjs-backend-wrapper.ts} +0 -0
- /package/src/{serialize-nextjs-http-wrapper.ts → runtimes/nextjs/serialize-nextjs-http-wrapper.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @pikku/cli
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 44e3ff4: feat: enhance CLI filtering with type and directory filters
|
|
8
|
+
|
|
9
|
+
- Add --types filter to filter by PikkuEventTypes (http, channel, queue, scheduler, rpc, mcp)
|
|
10
|
+
- Add --directories filter to filter by file paths/directories
|
|
11
|
+
- All filters (tags, types, directories) now work together with AND logic
|
|
12
|
+
- Add comprehensive logging interface to inspector package
|
|
13
|
+
- Add comprehensive test suite for matchesFilters function
|
|
14
|
+
- Support cross-platform path handling
|
|
15
|
+
|
|
16
|
+
- 7c592b8: feat: support for required services and improved service configuration
|
|
17
|
+
|
|
18
|
+
This release includes several enhancements to service management and configuration:
|
|
19
|
+
|
|
20
|
+
- Added support for required services configuration
|
|
21
|
+
- Improved service discovery and registration
|
|
22
|
+
- Added typed RPC clients for service communication
|
|
23
|
+
- Updated middleware to run per function
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [3261090]
|
|
26
|
+
- Updated dependencies [44e3ff4]
|
|
27
|
+
- Updated dependencies [7c592b8]
|
|
28
|
+
- Updated dependencies [30a082f]
|
|
29
|
+
- @pikku/core@0.8.1
|
|
30
|
+
- @pikku/inspector@0.8.1
|
|
31
|
+
|
|
32
|
+
## 0.8.0
|
|
33
|
+
|
|
34
|
+
### Major Features
|
|
35
|
+
|
|
36
|
+
- **Model Context Protocol (MCP) Support**: Complete MCP implementation with automatic generation of MCP JSON specifications, resources, tools, and prompts
|
|
37
|
+
- **Queue System**: Added queue support
|
|
38
|
+
- **RPC (Remote Procedure Calls)**: Added typed RPC call generation with local and remote procedure support
|
|
39
|
+
- **Multiple Bootstrap Files**: Added support for generating different transport-specific bootstrap files
|
|
40
|
+
- **Service Destructuring Analysis**: Added service destructuring analysis for better code generation
|
|
41
|
+
- **Bootstrap Files**: Added support for generating transport-specific bootstrap files
|
|
42
|
+
- **Service Destructuring**: Added service destructuring analysis for better code organization
|
|
43
|
+
- **Error Handling**: Improved error handling for complex type generation
|
|
44
|
+
- **Performance**: Optimized code generation for large projects with multiple event types
|
|
45
|
+
|
|
3
46
|
## 0.7.7
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
package/bin/pikku-all.ts
CHANGED
|
@@ -1,67 +1,77 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
import {
|
|
3
|
+
CLILogger,
|
|
3
4
|
getFileImportRelativePath,
|
|
4
|
-
logInfo,
|
|
5
|
-
logPikkuLogo,
|
|
6
5
|
PikkuCLIOptions,
|
|
7
6
|
writeFileInDir,
|
|
8
|
-
} from '../src/utils
|
|
7
|
+
} from '../src/utils.js'
|
|
9
8
|
import { getPikkuCLIConfig, PikkuCLIConfig } from '../src/pikku-cli-config.js'
|
|
10
|
-
import { pikkuHTTP } from '
|
|
11
|
-
import { pikkuFunctionTypes } from '
|
|
12
|
-
import { pikkuHTTPMap } from '
|
|
9
|
+
import { pikkuHTTP } from '../src/events/http/pikku-command-http-routes.js'
|
|
10
|
+
import { pikkuFunctionTypes } from '../src/events/functions/pikku-command-function-types.js'
|
|
11
|
+
import { pikkuHTTPMap } from '../src/events/http/pikku-command-http-map.js'
|
|
13
12
|
import { existsSync } from 'fs'
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { pikkuChannels } from './pikku-channels.js'
|
|
17
|
-
import { pikkuNext } from './pikku-nextjs.js'
|
|
18
|
-
import { pikkuOpenAPI } from './pikku-openapi.js'
|
|
19
|
-
import { pikkuScheduler } from './pikku-scheduler.js'
|
|
20
|
-
import { pikkuSchemas } from './pikku-schemas.js'
|
|
21
|
-
import { pikkuWebSocket } from './pikku-websocket.js'
|
|
13
|
+
import { pikkuChannelsMap } from '../src/events/channels/pikku-command-channels-map.js'
|
|
14
|
+
import { pikkuChannels } from '../src/events/channels/pikku-command-channels.js'
|
|
22
15
|
import { inspectorGlob } from '../src/inspector-glob.js'
|
|
23
16
|
import chokidar from 'chokidar'
|
|
24
|
-
import { pikkuFunctions } from '
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
import { pikkuFunctions } from '../src/events/functions/pikku-command-functions.js'
|
|
18
|
+
import { pikkuServices } from '../src/events/functions/pikku-command-services.js'
|
|
19
|
+
import { pikkuRPC } from '../src/events/rpc/pikku-command-rpc.js'
|
|
20
|
+
import { pikkuRPCMap } from '../src/events/rpc/pikku-command-rpc-map.js'
|
|
21
|
+
import { pikkuQueue } from '../src/events/queue/pikku-command-queue.js'
|
|
22
|
+
import { pikkuQueueMap } from '../src/events/queue/pikku-command-queue-map.js'
|
|
23
|
+
import { pikkuFetch } from '../src/events/fetch/index.js'
|
|
24
|
+
import { pikkuRPCClient } from '../src/events/rpc/pikku-command-rpc-client.js'
|
|
25
|
+
import { pikkuWebSocketTyped } from '../src/events/channels/pikku-command-websocket-typed.js'
|
|
26
|
+
import { pikkuOpenAPI } from '../src/events/http/pikku-command-openapi.js'
|
|
27
|
+
import { pikkuMCP } from '../src/events/mcp/pikku-command-mcp.js'
|
|
28
|
+
import { pikkuQueueService } from '../src/events/queue/pikku-command-queue-service.js'
|
|
29
|
+
import { pikkuScheduler } from '../src/events/scheduler/pikku-command-scheduler.js'
|
|
30
|
+
import { pikkuSchemas } from '../src/schemas.js'
|
|
31
|
+
import { pikkuMCPJSON } from '../src/events/mcp/pikku-command-mcp-json.js'
|
|
32
|
+
import { pikkuNext } from '../src/runtimes/nextjs/pikku-command-nextjs.js'
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!addTo || addTo?.includes(transport as PikkuEventTypes)) {
|
|
50
|
-
boostrapImports[transport] = boostrapImports[transport] || {
|
|
51
|
-
meta: [],
|
|
52
|
-
events: [],
|
|
53
|
-
}
|
|
54
|
-
if (type === 'meta') {
|
|
55
|
-
boostrapImports[transport].meta.push(statement)
|
|
56
|
-
} else {
|
|
57
|
-
boostrapImports[transport].events.push(statement)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
34
|
+
const generateBootstrapFile = async (
|
|
35
|
+
logger: CLILogger,
|
|
36
|
+
cliConfig: PikkuCLIConfig,
|
|
37
|
+
bootstrapFile: string,
|
|
38
|
+
specificImports: string[],
|
|
39
|
+
schemas?: boolean
|
|
40
|
+
) => {
|
|
41
|
+
// Common imports that every bootstrap file needs
|
|
42
|
+
const commonImports = [cliConfig.functionsMetaFile, cliConfig.functionsFile]
|
|
43
|
+
|
|
44
|
+
// Add schema if it exists
|
|
45
|
+
if (schemas) {
|
|
46
|
+
commonImports.push(`${cliConfig.schemaDirectory}/register.gen.ts`)
|
|
61
47
|
}
|
|
62
48
|
|
|
49
|
+
// Combine common imports with specific imports
|
|
50
|
+
const allImports = [...commonImports, ...specificImports]
|
|
51
|
+
|
|
52
|
+
await writeFileInDir(
|
|
53
|
+
logger,
|
|
54
|
+
bootstrapFile,
|
|
55
|
+
allImports
|
|
56
|
+
.map(
|
|
57
|
+
(to) =>
|
|
58
|
+
`import '${getFileImportRelativePath(bootstrapFile, to, cliConfig.packageMappings)}'`
|
|
59
|
+
)
|
|
60
|
+
.sort((to) => (to.includes('meta') ? -1 : 1)) // Ensure meta files are at the top
|
|
61
|
+
.join('\n')
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const runAll = async (
|
|
66
|
+
logger: CLILogger,
|
|
67
|
+
cliConfig: PikkuCLIConfig,
|
|
68
|
+
options: PikkuCLIOptions
|
|
69
|
+
) => {
|
|
70
|
+
const allImports: string[] = []
|
|
71
|
+
|
|
63
72
|
let typesDeclarationFileExists = true
|
|
64
73
|
let visitState = await inspectorGlob(
|
|
74
|
+
logger,
|
|
65
75
|
cliConfig.rootDir,
|
|
66
76
|
cliConfig.srcDirectories,
|
|
67
77
|
cliConfig.filters
|
|
@@ -70,80 +80,158 @@ const runAll = async (cliConfig: PikkuCLIConfig, options: PikkuCLIOptions) => {
|
|
|
70
80
|
if (!existsSync(cliConfig.typesDeclarationFile)) {
|
|
71
81
|
typesDeclarationFileExists = false
|
|
72
82
|
}
|
|
73
|
-
await pikkuFunctionTypes(cliConfig,
|
|
83
|
+
await pikkuFunctionTypes(logger, cliConfig, visitState, options)
|
|
74
84
|
|
|
75
85
|
// This is needed since the addHTTPRoute function will add the routes to the visitState
|
|
76
86
|
if (!typesDeclarationFileExists) {
|
|
77
|
-
|
|
87
|
+
logger.info(`• Type file first created, inspecting again...\x1b[0m`)
|
|
78
88
|
visitState = await inspectorGlob(
|
|
89
|
+
logger,
|
|
79
90
|
cliConfig.rootDir,
|
|
80
91
|
cliConfig.srcDirectories,
|
|
81
92
|
cliConfig.filters
|
|
82
93
|
)
|
|
83
94
|
}
|
|
84
95
|
|
|
85
|
-
const functions = pikkuFunctions(cliConfig, visitState)
|
|
96
|
+
const functions = pikkuFunctions(logger, cliConfig, visitState)
|
|
86
97
|
if (!functions) {
|
|
87
|
-
|
|
98
|
+
logger.info(`• No functions found, skipping remaining steps...\x1b[0m`)
|
|
88
99
|
process.exit(1)
|
|
89
100
|
}
|
|
90
|
-
addImport(cliConfig.functionsMetaFile, 'meta')
|
|
91
|
-
addImport(cliConfig.functionsFile, 'events')
|
|
92
101
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
// Base imports for all bootstrap files
|
|
103
|
+
allImports.push(cliConfig.functionsMetaFile, cliConfig.functionsFile)
|
|
104
|
+
|
|
105
|
+
// Generate services map
|
|
106
|
+
await pikkuServices(logger, cliConfig, visitState)
|
|
96
107
|
|
|
97
|
-
|
|
108
|
+
await pikkuRPC(logger, cliConfig, visitState)
|
|
109
|
+
await pikkuRPCMap(logger, cliConfig, visitState)
|
|
110
|
+
await pikkuRPCClient(logger, cliConfig)
|
|
111
|
+
allImports.push(cliConfig.rpcMetaFile)
|
|
112
|
+
|
|
113
|
+
const schemas = await pikkuSchemas(logger, cliConfig, visitState)
|
|
98
114
|
if (schemas) {
|
|
99
|
-
|
|
115
|
+
allImports.push(`${cliConfig.schemaDirectory}/register.gen.ts`)
|
|
100
116
|
}
|
|
101
117
|
|
|
102
|
-
|
|
118
|
+
// RPC bootstrap is always generated since RPC is always present
|
|
119
|
+
await generateBootstrapFile(
|
|
120
|
+
logger,
|
|
121
|
+
cliConfig,
|
|
122
|
+
cliConfig.bootstrapFiles.rpc,
|
|
123
|
+
[cliConfig.rpcMetaFile],
|
|
124
|
+
schemas
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
const http = await pikkuHTTP(logger, cliConfig, visitState)
|
|
103
128
|
if (http) {
|
|
104
|
-
await pikkuHTTPMap(cliConfig, visitState)
|
|
105
|
-
await pikkuFetch(cliConfig)
|
|
106
|
-
|
|
107
|
-
|
|
129
|
+
await pikkuHTTPMap(logger, cliConfig, visitState)
|
|
130
|
+
await pikkuFetch(logger, cliConfig)
|
|
131
|
+
allImports.push(cliConfig.httpRoutesMetaFile, cliConfig.httpRoutesFile)
|
|
132
|
+
|
|
133
|
+
await generateBootstrapFile(
|
|
134
|
+
logger,
|
|
135
|
+
cliConfig,
|
|
136
|
+
cliConfig.bootstrapFiles.http,
|
|
137
|
+
[cliConfig.httpRoutesMetaFile, cliConfig.httpRoutesFile],
|
|
138
|
+
schemas
|
|
139
|
+
)
|
|
108
140
|
}
|
|
109
141
|
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
const scheduler = await pikkuScheduler(logger, cliConfig, visitState)
|
|
143
|
+
if (scheduler) {
|
|
144
|
+
allImports.push(cliConfig.schedulersMetaFile, cliConfig.schedulersFile)
|
|
145
|
+
|
|
146
|
+
await generateBootstrapFile(
|
|
147
|
+
logger,
|
|
148
|
+
cliConfig,
|
|
149
|
+
cliConfig.bootstrapFiles.scheduler,
|
|
150
|
+
[cliConfig.schedulersMetaFile, cliConfig.schedulersFile],
|
|
151
|
+
schemas
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const queues = await pikkuQueue(logger, cliConfig, visitState)
|
|
156
|
+
if (queues) {
|
|
157
|
+
await pikkuQueueMap(logger, cliConfig, visitState)
|
|
158
|
+
await pikkuQueueService(logger, cliConfig)
|
|
159
|
+
allImports.push(cliConfig.queueWorkersMetaFile, cliConfig.queueWorkersFile)
|
|
160
|
+
|
|
161
|
+
await generateBootstrapFile(
|
|
162
|
+
logger,
|
|
163
|
+
cliConfig,
|
|
164
|
+
cliConfig.bootstrapFiles.queue,
|
|
165
|
+
[cliConfig.queueWorkersMetaFile, cliConfig.queueWorkersFile],
|
|
166
|
+
schemas
|
|
167
|
+
)
|
|
114
168
|
}
|
|
115
169
|
|
|
116
|
-
const channels = await pikkuChannels(cliConfig, visitState)
|
|
170
|
+
const channels = await pikkuChannels(logger, cliConfig, visitState)
|
|
117
171
|
if (channels) {
|
|
118
|
-
await pikkuChannelsMap(cliConfig, visitState)
|
|
119
|
-
await
|
|
120
|
-
|
|
121
|
-
|
|
172
|
+
await pikkuChannelsMap(logger, cliConfig, visitState)
|
|
173
|
+
await pikkuWebSocketTyped(logger, cliConfig)
|
|
174
|
+
allImports.push(cliConfig.channelsMetaFile, cliConfig.channelsFile)
|
|
175
|
+
|
|
176
|
+
await generateBootstrapFile(
|
|
177
|
+
logger,
|
|
178
|
+
cliConfig,
|
|
179
|
+
cliConfig.bootstrapFiles.channel,
|
|
180
|
+
[cliConfig.channelsMetaFile, cliConfig.channelsFile],
|
|
181
|
+
schemas
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const mcp = await pikkuMCP(logger, cliConfig, visitState)
|
|
186
|
+
if (mcp) {
|
|
187
|
+
await pikkuMCPJSON(logger, cliConfig, visitState)
|
|
188
|
+
allImports.push(cliConfig.mcpEndpointsMetaFile, cliConfig.mcpEndpointsFile)
|
|
189
|
+
|
|
190
|
+
await generateBootstrapFile(
|
|
191
|
+
logger,
|
|
192
|
+
cliConfig,
|
|
193
|
+
cliConfig.bootstrapFiles.mcp,
|
|
194
|
+
[cliConfig.mcpEndpointsMetaFile, cliConfig.mcpEndpointsFile],
|
|
195
|
+
schemas
|
|
196
|
+
)
|
|
122
197
|
}
|
|
123
198
|
|
|
124
199
|
if (cliConfig.nextBackendFile || cliConfig.nextHTTPFile) {
|
|
125
|
-
await pikkuNext(cliConfig, visitState, options)
|
|
200
|
+
await pikkuNext(logger, cliConfig, visitState, options)
|
|
126
201
|
}
|
|
127
202
|
|
|
128
203
|
if (cliConfig.openAPI) {
|
|
129
|
-
|
|
204
|
+
logger.info(
|
|
205
|
+
`• OpenAPI requires a reinspection to pickup new generated types..`
|
|
206
|
+
)
|
|
130
207
|
visitState = await inspectorGlob(
|
|
208
|
+
logger,
|
|
131
209
|
cliConfig.rootDir,
|
|
132
210
|
cliConfig.srcDirectories,
|
|
133
211
|
cliConfig.filters
|
|
134
212
|
)
|
|
135
|
-
await pikkuOpenAPI(cliConfig, visitState)
|
|
213
|
+
await pikkuOpenAPI(logger, cliConfig, visitState)
|
|
136
214
|
}
|
|
137
215
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
216
|
+
// Generate main bootstrap file (pass all imports directly since this is the main file)
|
|
217
|
+
await writeFileInDir(
|
|
218
|
+
logger,
|
|
219
|
+
cliConfig.bootstrapFile,
|
|
220
|
+
allImports
|
|
221
|
+
.map(
|
|
222
|
+
(to) =>
|
|
223
|
+
`import '${getFileImportRelativePath(cliConfig.bootstrapFile, to, cliConfig.packageMappings)}'`
|
|
224
|
+
)
|
|
225
|
+
.sort((to) => (to.includes('meta') ? -1 : 1)) // Ensure meta files are at the top
|
|
226
|
+
.join('\n')
|
|
227
|
+
)
|
|
144
228
|
}
|
|
145
229
|
|
|
146
|
-
const watch = (
|
|
230
|
+
const watch = (
|
|
231
|
+
logger: CLILogger,
|
|
232
|
+
cliConfig: PikkuCLIConfig,
|
|
233
|
+
options: PikkuCLIOptions
|
|
234
|
+
) => {
|
|
147
235
|
const configWatcher = chokidar.watch(cliConfig.srcDirectories, {
|
|
148
236
|
ignoreInitial: true,
|
|
149
237
|
ignored: /.*\.gen\.tsx?/,
|
|
@@ -154,7 +242,7 @@ const watch = (cliConfig: PikkuCLIConfig, options: PikkuCLIOptions) => {
|
|
|
154
242
|
const generatorWatcher = () => {
|
|
155
243
|
watcher.close()
|
|
156
244
|
|
|
157
|
-
|
|
245
|
+
logger.info(
|
|
158
246
|
`• Watching directories: \n - ${cliConfig.srcDirectories.join('\n - ')}`
|
|
159
247
|
)
|
|
160
248
|
watcher = chokidar.watch(cliConfig.srcDirectories, {
|
|
@@ -165,7 +253,7 @@ const watch = (cliConfig: PikkuCLIConfig, options: PikkuCLIOptions) => {
|
|
|
165
253
|
watcher.on('ready', async () => {
|
|
166
254
|
const handle = async () => {
|
|
167
255
|
try {
|
|
168
|
-
await runAll(cliConfig, options)
|
|
256
|
+
await runAll(logger, cliConfig, options)
|
|
169
257
|
} catch (err) {
|
|
170
258
|
console.error(err)
|
|
171
259
|
console.info()
|
|
@@ -194,19 +282,23 @@ const watch = (cliConfig: PikkuCLIConfig, options: PikkuCLIOptions) => {
|
|
|
194
282
|
}
|
|
195
283
|
|
|
196
284
|
export const action = async (options: PikkuCLIOptions): Promise<void> => {
|
|
197
|
-
|
|
285
|
+
const logger = new CLILogger({ logLogo: true })
|
|
198
286
|
|
|
199
287
|
const cliConfig = await getPikkuCLIConfig(
|
|
200
288
|
options.config,
|
|
201
289
|
[],
|
|
202
|
-
|
|
290
|
+
{
|
|
291
|
+
tags: options.tags,
|
|
292
|
+
types: options.types,
|
|
293
|
+
directories: options.directories,
|
|
294
|
+
},
|
|
203
295
|
true
|
|
204
296
|
)
|
|
205
297
|
|
|
206
298
|
if (options.watch) {
|
|
207
|
-
watch(cliConfig, options)
|
|
299
|
+
watch(logger, cliConfig, options)
|
|
208
300
|
} else {
|
|
209
|
-
await runAll(cliConfig, options)
|
|
301
|
+
await runAll(logger, cliConfig, options)
|
|
210
302
|
}
|
|
211
303
|
}
|
|
212
304
|
|
|
@@ -225,6 +317,11 @@ export const all = (program: Command): void => {
|
|
|
225
317
|
)
|
|
226
318
|
.option('-c | --config <string>', 'The path to pikku cli config file')
|
|
227
319
|
.option('-t | --tags <tags...>', 'Which tags to filter by')
|
|
320
|
+
.option(
|
|
321
|
+
'--types <types...>',
|
|
322
|
+
'Which types to filter by (http, channel, queue, scheduler, rpc, mcp)'
|
|
323
|
+
)
|
|
324
|
+
.option('--directories <directories...>', 'Which directories to filter by')
|
|
228
325
|
.option('-w | --watch', 'Whether to watch file changes')
|
|
229
326
|
.action(action)
|
|
230
327
|
}
|
package/bin/pikku-fetch.ts
CHANGED
|
@@ -1,49 +1,21 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import { getPikkuCLIConfig
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
getFileImportRelativePath,
|
|
6
|
-
logCommandInfoAndTime,
|
|
7
|
-
logPikkuLogo,
|
|
8
|
-
PikkuCLIOptions,
|
|
9
|
-
writeFileInDir,
|
|
10
|
-
} from '../src/utils/utils.js'
|
|
11
|
-
|
|
12
|
-
export const pikkuFetch = async ({
|
|
13
|
-
fetchFile,
|
|
14
|
-
httpRoutesMapDeclarationFile,
|
|
15
|
-
packageMappings,
|
|
16
|
-
}: PikkuCLIConfig) => {
|
|
17
|
-
await logCommandInfoAndTime(
|
|
18
|
-
'Generating fetch wrapper',
|
|
19
|
-
'Generated fetch wrapper',
|
|
20
|
-
[fetchFile === undefined, "fetchFile isn't set in the pikku config"],
|
|
21
|
-
async () => {
|
|
22
|
-
if (!fetchFile) {
|
|
23
|
-
throw new Error("fetchFile is isn't set in the pikku config")
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
27
|
-
fetchFile,
|
|
28
|
-
httpRoutesMapDeclarationFile,
|
|
29
|
-
packageMappings
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
const content = [serializeFetchWrapper(routesMapDeclarationPath)]
|
|
33
|
-
await writeFileInDir(fetchFile, content.join('\n'))
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
}
|
|
2
|
+
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js'
|
|
3
|
+
import { pikkuFetch } from '../src/events/fetch/index.js'
|
|
4
|
+
import { CLILogger, PikkuCLIOptions } from '../src/utils.js'
|
|
37
5
|
|
|
38
6
|
export const action = async (options: PikkuCLIOptions): Promise<void> => {
|
|
39
|
-
|
|
7
|
+
const logger = new CLILogger({ logLogo: true })
|
|
40
8
|
const cliConfig = await getPikkuCLIConfig(
|
|
41
9
|
options.config,
|
|
42
10
|
['rootDir', 'schemaDirectory', 'configDir', 'fetchFile'],
|
|
43
|
-
|
|
11
|
+
{
|
|
12
|
+
tags: options.tags,
|
|
13
|
+
types: options.types,
|
|
14
|
+
directories: options.directories,
|
|
15
|
+
},
|
|
44
16
|
true
|
|
45
17
|
)
|
|
46
|
-
await pikkuFetch(cliConfig)
|
|
18
|
+
await pikkuFetch(logger, cliConfig)
|
|
47
19
|
}
|
|
48
20
|
|
|
49
21
|
export const fetch = (program: Command): void => {
|
package/bin/pikku-nextjs.ts
CHANGED
|
@@ -1,130 +1,29 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
getFileImportRelativePath,
|
|
6
|
-
getPikkuFilesAndMethods,
|
|
7
|
-
logCommandInfoAndTime,
|
|
8
|
-
logPikkuLogo,
|
|
9
|
-
PikkuCLIOptions,
|
|
10
|
-
writeFileInDir,
|
|
11
|
-
} from '../src/utils/utils.js'
|
|
12
|
-
import { getPikkuCLIConfig, PikkuCLIConfig } from '../src/pikku-cli-config.js'
|
|
13
|
-
import { InspectorState } from '@pikku/inspector'
|
|
2
|
+
import { CLILogger, PikkuCLIOptions } from '../src/utils.js'
|
|
3
|
+
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js'
|
|
14
4
|
import { inspectorGlob } from '../src/inspector-glob.js'
|
|
15
|
-
|
|
16
|
-
export const pikkuNext = async (
|
|
17
|
-
{
|
|
18
|
-
nextBackendFile,
|
|
19
|
-
nextHTTPFile,
|
|
20
|
-
httpRoutesMapDeclarationFile,
|
|
21
|
-
packageMappings,
|
|
22
|
-
fetchFile,
|
|
23
|
-
bootstrapFiles,
|
|
24
|
-
}: PikkuCLIConfig,
|
|
25
|
-
visitState: InspectorState,
|
|
26
|
-
options: PikkuCLIOptions
|
|
27
|
-
) => {
|
|
28
|
-
return await logCommandInfoAndTime(
|
|
29
|
-
'Generating nextjs wrapper',
|
|
30
|
-
'Generated nextjs wrapper',
|
|
31
|
-
[
|
|
32
|
-
nextBackendFile === undefined && nextHTTPFile === undefined,
|
|
33
|
-
'nextjs outfile is not defined',
|
|
34
|
-
],
|
|
35
|
-
async () => {
|
|
36
|
-
if (!nextBackendFile && !nextHTTPFile) {
|
|
37
|
-
throw new Error(
|
|
38
|
-
'nextBackendFile or nextHTTPFile is required in pikku config for nextJS'
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (nextHTTPFile && !fetchFile) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
'fetchFile is required in pikku config in order for nextJS http wrapper to work'
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (nextBackendFile) {
|
|
49
|
-
const {
|
|
50
|
-
pikkuConfigFactory,
|
|
51
|
-
singletonServicesFactory,
|
|
52
|
-
sessionServicesFactory,
|
|
53
|
-
} = await getPikkuFilesAndMethods(
|
|
54
|
-
visitState,
|
|
55
|
-
packageMappings,
|
|
56
|
-
nextBackendFile,
|
|
57
|
-
options,
|
|
58
|
-
{
|
|
59
|
-
config: true,
|
|
60
|
-
singletonServicesFactory: true,
|
|
61
|
-
sessionServicesFactory: true,
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
const pikkuConfigImport = `import { ${pikkuConfigFactory.variable} as createConfig } from '${getFileImportRelativePath(nextBackendFile, pikkuConfigFactory.file, packageMappings)}'`
|
|
66
|
-
const singletonServicesImport = `import { ${singletonServicesFactory.variable} as createSingletonServices } from '${getFileImportRelativePath(nextBackendFile, singletonServicesFactory.file, packageMappings)}'`
|
|
67
|
-
const sessionServicesImport = `import { ${sessionServicesFactory.variable} as createSessionServices } from '${getFileImportRelativePath(nextBackendFile, sessionServicesFactory.file, packageMappings)}'`
|
|
68
|
-
|
|
69
|
-
const httpBootstrapPath = getFileImportRelativePath(
|
|
70
|
-
nextBackendFile,
|
|
71
|
-
bootstrapFiles.http,
|
|
72
|
-
packageMappings
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
76
|
-
nextBackendFile,
|
|
77
|
-
httpRoutesMapDeclarationFile,
|
|
78
|
-
packageMappings
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
const content = serializeNextBackendWrapper(
|
|
82
|
-
httpBootstrapPath,
|
|
83
|
-
routesMapDeclarationPath,
|
|
84
|
-
pikkuConfigImport,
|
|
85
|
-
singletonServicesImport,
|
|
86
|
-
sessionServicesImport
|
|
87
|
-
)
|
|
88
|
-
await writeFileInDir(nextBackendFile, content)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (nextHTTPFile && fetchFile) {
|
|
92
|
-
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
93
|
-
nextHTTPFile,
|
|
94
|
-
httpRoutesMapDeclarationFile,
|
|
95
|
-
packageMappings
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
const fetchPath = getFileImportRelativePath(
|
|
99
|
-
nextHTTPFile,
|
|
100
|
-
fetchFile,
|
|
101
|
-
packageMappings
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
const content = serializeNextHTTPWrapper(
|
|
105
|
-
routesMapDeclarationPath,
|
|
106
|
-
fetchPath
|
|
107
|
-
)
|
|
108
|
-
await writeFileInDir(nextHTTPFile, content)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
}
|
|
5
|
+
import { pikkuNext } from '../src/runtimes/nextjs/pikku-command-nextjs.js'
|
|
113
6
|
|
|
114
7
|
export const action = async (options: PikkuCLIOptions): Promise<void> => {
|
|
115
|
-
|
|
8
|
+
const logger = new CLILogger({ logLogo: true })
|
|
9
|
+
|
|
116
10
|
const cliConfig = await getPikkuCLIConfig(
|
|
117
11
|
options.config,
|
|
118
12
|
['rootDir', 'schemaDirectory', 'configDir'],
|
|
119
|
-
|
|
13
|
+
{
|
|
14
|
+
tags: options.tags,
|
|
15
|
+
types: options.types,
|
|
16
|
+
directories: options.directories,
|
|
17
|
+
},
|
|
120
18
|
true
|
|
121
19
|
)
|
|
122
20
|
const visitState = await inspectorGlob(
|
|
21
|
+
logger,
|
|
123
22
|
cliConfig.rootDir,
|
|
124
23
|
cliConfig.srcDirectories,
|
|
125
24
|
cliConfig.filters
|
|
126
25
|
)
|
|
127
|
-
await pikkuNext(cliConfig, visitState, options)
|
|
26
|
+
await pikkuNext(logger, cliConfig, visitState, options)
|
|
128
27
|
}
|
|
129
28
|
|
|
130
29
|
export const nextjs = (program: Command): void => {
|