@soapjs/cli 1.0.0

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 (149) hide show
  1. package/.nvmrc +1 -0
  2. package/LICENSE +21 -0
  3. package/README.md +360 -0
  4. package/build/cli.d.ts +3 -0
  5. package/build/cli.js +50 -0
  6. package/build/commands/add/add.command.d.ts +2 -0
  7. package/build/commands/add/add.command.js +709 -0
  8. package/build/commands/add/command-plan.d.ts +15 -0
  9. package/build/commands/add/command-plan.js +182 -0
  10. package/build/commands/add/entity-plan.d.ts +7 -0
  11. package/build/commands/add/entity-plan.js +106 -0
  12. package/build/commands/add/event-plan.d.ts +8 -0
  13. package/build/commands/add/event-plan.js +59 -0
  14. package/build/commands/add/query-plan.d.ts +10 -0
  15. package/build/commands/add/query-plan.js +156 -0
  16. package/build/commands/add/repository-plan.d.ts +11 -0
  17. package/build/commands/add/repository-plan.js +252 -0
  18. package/build/commands/add/resource-plan.d.ts +52 -0
  19. package/build/commands/add/resource-plan.js +2031 -0
  20. package/build/commands/add/route-plan.d.ts +24 -0
  21. package/build/commands/add/route-plan.js +256 -0
  22. package/build/commands/add/socket-plan.d.ts +9 -0
  23. package/build/commands/add/socket-plan.js +81 -0
  24. package/build/commands/add/use-case-plan.d.ts +7 -0
  25. package/build/commands/add/use-case-plan.js +86 -0
  26. package/build/commands/check/check.command.d.ts +2 -0
  27. package/build/commands/check/check.command.js +113 -0
  28. package/build/commands/create/create.command.d.ts +2 -0
  29. package/build/commands/create/create.command.js +234 -0
  30. package/build/commands/create/project-plan.d.ts +44 -0
  31. package/build/commands/create/project-plan.js +1430 -0
  32. package/build/commands/doctor/doctor.command.d.ts +2 -0
  33. package/build/commands/doctor/doctor.command.js +38 -0
  34. package/build/commands/generate/bruno-analysis.d.ts +19 -0
  35. package/build/commands/generate/bruno-analysis.js +51 -0
  36. package/build/commands/generate/bruno-plan.d.ts +6 -0
  37. package/build/commands/generate/bruno-plan.js +326 -0
  38. package/build/commands/generate/generate.command.d.ts +2 -0
  39. package/build/commands/generate/generate.command.js +130 -0
  40. package/build/commands/info/info.command.d.ts +2 -0
  41. package/build/commands/info/info.command.js +26 -0
  42. package/build/commands/remove/remove.command.d.ts +2 -0
  43. package/build/commands/remove/remove.command.js +328 -0
  44. package/build/commands/shared/common-options.d.ts +10 -0
  45. package/build/commands/shared/common-options.js +23 -0
  46. package/build/commands/update/update.command.d.ts +2 -0
  47. package/build/commands/update/update.command.js +155 -0
  48. package/build/config/auth-policy.d.ts +4 -0
  49. package/build/config/auth-policy.js +54 -0
  50. package/build/config/find-soap-root.d.ts +1 -0
  51. package/build/config/find-soap-root.js +22 -0
  52. package/build/config/load-soap-config.d.ts +2 -0
  53. package/build/config/load-soap-config.js +30 -0
  54. package/build/config/schemas/types.d.ts +127 -0
  55. package/build/config/schemas/types.js +2 -0
  56. package/build/config/schemas/validation.d.ts +5 -0
  57. package/build/config/schemas/validation.js +130 -0
  58. package/build/config/soap-config.service.d.ts +4 -0
  59. package/build/config/soap-config.service.js +24 -0
  60. package/build/config/write-soap-config.d.ts +8 -0
  61. package/build/config/write-soap-config.js +25 -0
  62. package/build/core/command-context.d.ts +20 -0
  63. package/build/core/command-context.js +30 -0
  64. package/build/core/errors.d.ts +6 -0
  65. package/build/core/errors.js +23 -0
  66. package/build/core/output.d.ts +12 -0
  67. package/build/core/output.js +30 -0
  68. package/build/core/result.d.ts +9 -0
  69. package/build/core/result.js +11 -0
  70. package/build/dependencies/dependency-resolver.d.ts +6 -0
  71. package/build/dependencies/dependency-resolver.js +68 -0
  72. package/build/dependencies/package-manager.d.ts +7 -0
  73. package/build/dependencies/package-manager.js +54 -0
  74. package/build/index.d.ts +2 -0
  75. package/build/index.js +9 -0
  76. package/build/io/conflict-policy.d.ts +10 -0
  77. package/build/io/conflict-policy.js +32 -0
  78. package/build/io/file-writer.d.ts +19 -0
  79. package/build/io/file-writer.js +65 -0
  80. package/build/io/format-file.d.ts +1 -0
  81. package/build/io/format-file.js +13 -0
  82. package/build/presets/create-presets.d.ts +4 -0
  83. package/build/presets/create-presets.js +97 -0
  84. package/build/presets/index.d.ts +2 -0
  85. package/build/presets/index.js +18 -0
  86. package/build/presets/preset.types.d.ts +6 -0
  87. package/build/presets/preset.types.js +2 -0
  88. package/build/prompts/add-resource.prompt.d.ts +13 -0
  89. package/build/prompts/add-resource.prompt.js +80 -0
  90. package/build/prompts/add-route.prompt.d.ts +16 -0
  91. package/build/prompts/add-route.prompt.js +140 -0
  92. package/build/prompts/create-project.prompt.d.ts +11 -0
  93. package/build/prompts/create-project.prompt.js +156 -0
  94. package/build/prompts/generate-bruno.prompt.d.ts +7 -0
  95. package/build/prompts/generate-bruno.prompt.js +21 -0
  96. package/build/prompts/index.d.ts +8 -0
  97. package/build/prompts/index.js +24 -0
  98. package/build/prompts/inquirer-prompt-adapter.d.ts +8 -0
  99. package/build/prompts/inquirer-prompt-adapter.js +52 -0
  100. package/build/prompts/mock-prompt-adapter.d.ts +13 -0
  101. package/build/prompts/mock-prompt-adapter.js +60 -0
  102. package/build/prompts/prompt-adapter.d.ts +7 -0
  103. package/build/prompts/prompt-adapter.js +2 -0
  104. package/build/prompts/prompt.types.d.ts +26 -0
  105. package/build/prompts/prompt.types.js +2 -0
  106. package/build/registry/registry.service.d.ts +19 -0
  107. package/build/registry/registry.service.js +68 -0
  108. package/build/resolvers/add-resource.resolver.d.ts +23 -0
  109. package/build/resolvers/add-resource.resolver.js +73 -0
  110. package/build/resolvers/add-route.resolver.d.ts +34 -0
  111. package/build/resolvers/add-route.resolver.js +83 -0
  112. package/build/resolvers/create-config.resolver.d.ts +32 -0
  113. package/build/resolvers/create-config.resolver.js +57 -0
  114. package/build/resolvers/generate-bruno.resolver.d.ts +17 -0
  115. package/build/resolvers/generate-bruno.resolver.js +23 -0
  116. package/build/resolvers/index.d.ts +5 -0
  117. package/build/resolvers/index.js +21 -0
  118. package/build/resolvers/resolver.types.d.ts +8 -0
  119. package/build/resolvers/resolver.types.js +2 -0
  120. package/build/summary/create-summary.d.ts +2 -0
  121. package/build/summary/create-summary.js +24 -0
  122. package/build/summary/index.d.ts +1 -0
  123. package/build/summary/index.js +17 -0
  124. package/build/templates/naming.d.ts +11 -0
  125. package/build/templates/naming.js +30 -0
  126. package/build/templates/template-context.d.ts +6 -0
  127. package/build/templates/template-context.js +2 -0
  128. package/build/templates/template-engine.d.ts +1 -0
  129. package/build/templates/template-engine.js +10 -0
  130. package/build/templates/template-resolver.d.ts +2 -0
  131. package/build/templates/template-resolver.js +17 -0
  132. package/build/terminal/terminal-capabilities.d.ts +6 -0
  133. package/build/terminal/terminal-capabilities.js +14 -0
  134. package/docs/adr/0001-soap-cli-project-aware-generator.md +108 -0
  135. package/docs/cli/add-resource.md +127 -0
  136. package/docs/cli/add-route.md +79 -0
  137. package/docs/cli/bruno.md +58 -0
  138. package/docs/cli/create.md +73 -0
  139. package/docs/cli/index.md +92 -0
  140. package/docs/cli/interactive-mode.md +61 -0
  141. package/docs/cli/remove.md +45 -0
  142. package/docs/guides/auth.md +90 -0
  143. package/docs/guides/cqrs-events-realtime.md +100 -0
  144. package/docs/guides/index.md +24 -0
  145. package/docs/guides/quality-and-safety.md +88 -0
  146. package/docs/guides/regular-api.md +119 -0
  147. package/docs/guides/storage.md +101 -0
  148. package/docs/plans/interactive-mode-plan.md +601 -0
  149. package/package.json +44 -0
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 24.17.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Radosław Kamysz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,360 @@
1
+ # SoapJS CLI
2
+
3
+ Deterministic project and code generator for SoapJS services.
4
+
5
+ The CLI creates a runnable TypeScript service, records generated artifacts in `.soap`, and can add resources, routes, API clients, OpenAPI docs, auth, databases, messaging, and realtime support without relying on interactive prompts.
6
+
7
+ ## Installation
8
+
9
+ Requirements:
10
+
11
+ - Node.js `>=24.17.0` (Node 24 LTS or newer)
12
+ - Generated projects include `.nvmrc` with `24.17.0`
13
+
14
+ ```bash
15
+ npm install -g @soapjs/cli
16
+ soap --help
17
+ ```
18
+
19
+ For local development inside this repository:
20
+
21
+ ```bash
22
+ npm install
23
+ npm run build
24
+ node build/index.js --help
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```bash
30
+ soap create users-api \
31
+ --db postgres \
32
+ --auth jwt \
33
+ --docs openapi \
34
+ --api-client bruno \
35
+ --skip-install
36
+
37
+ cd users-api
38
+ npm install
39
+ npm run build
40
+ npm start
41
+ ```
42
+
43
+ In another terminal:
44
+
45
+ ```bash
46
+ curl http://localhost:3000/health
47
+ soap info
48
+ soap doctor
49
+ soap check routes
50
+ ```
51
+
52
+ ## Interactive Mode
53
+
54
+ Supported commands accept `-i` for guided prompts:
55
+
56
+ ```bash
57
+ soap create users-api -i
58
+ soap add resource invoice -i
59
+ soap add route invoice approve -i
60
+ soap generate bruno -i
61
+ soap remove route invoice approve -i
62
+ ```
63
+
64
+ Interactive mode requires a TTY and uses the same deterministic planners as the flag-based CLI. Use `--yes` to skip final confirmation prompts where supported.
65
+
66
+ Detailed docs:
67
+
68
+ - [CLI reference](docs/cli/index.md)
69
+ - [Interactive mode](docs/cli/interactive-mode.md)
70
+ - [Create](docs/cli/create.md)
71
+ - [Add resource](docs/cli/add-resource.md)
72
+ - [Add route](docs/cli/add-route.md)
73
+ - [Bruno](docs/cli/bruno.md)
74
+ - [Remove](docs/cli/remove.md)
75
+
76
+ Developer guides:
77
+
78
+ - [Developer guides index](docs/guides/index.md)
79
+ - [Regular CRUD API](docs/guides/regular-api.md)
80
+ - [CQRS, events, Kafka, and WebSockets](docs/guides/cqrs-events-realtime.md)
81
+ - [Auth and route policies](docs/guides/auth.md)
82
+ - [Storage capabilities](docs/guides/storage.md)
83
+ - [Quality, tests, and safe changes](docs/guides/quality-and-safety.md)
84
+
85
+ ## `soap create`
86
+
87
+ `soap create` bootstraps a new service.
88
+
89
+ ```bash
90
+ soap create users-api --skip-install
91
+ soap create users-api --install
92
+ soap create users-api --git-init --skip-install
93
+ soap create users-api --db mongo --auth api-key --api-client bruno --skip-install
94
+ soap create users-api --db mysql --db sqlite --skip-install
95
+ soap create users-api --architecture cqrs --messaging kafka --realtime ws --skip-install
96
+ ```
97
+
98
+ Common options:
99
+
100
+ - `--architecture regular|cqrs`
101
+ - `--db mongo|postgres|mysql|sqlite|redis|none`
102
+ - `--auth jwt|api-key|local|none`
103
+ - `--messaging in-memory|kafka|none`
104
+ - `--docs openapi|none`
105
+ - `--contracts zod|none`
106
+ - `--api-client bruno|none`
107
+ - `--realtime ws|none`
108
+ - `--zones public,private,admin`
109
+ - `--package-manager npm|pnpm|yarn|bun`
110
+ - `--install` to install dependencies after generation
111
+ - `--git-init` to initialize a local git repository without committing or pushing
112
+ - `--force` and `--write-new` for generated file conflicts
113
+
114
+ ## `soap add resource`
115
+
116
+ Add a resource to an existing SoapJS project:
117
+
118
+ ```bash
119
+ soap add resource user --crud
120
+ soap add resource invoice --crud --db postgres --auth jwt --zone private
121
+ soap add resource invoice --crud --db mysql --auth jwt --zone private
122
+ soap add resource note --crud --db sqlite
123
+ soap add resource audit-log --db mongo --zone admin
124
+ soap add resource product --crud --field title:string --field price:number --field active:boolean:optional
125
+ soap add resource report --crud --auth jwt --policy roles:admin,editor
126
+ soap add resource report --crud --crud-route list:get:/search:jwt:private:admin:no-bruno
127
+ ```
128
+
129
+ Use `--dry-run` to inspect the expanded plan before writing:
130
+
131
+ ```bash
132
+ soap add resource order --crud --db postgres --dry-run
133
+ soap add resource order --crud --db postgres --yes
134
+ ```
135
+
136
+ CRUD resources generate domain, repository, use-case or CQRS files, route controllers, route contracts, registry entries, and Bruno requests when Bruno is enabled.
137
+
138
+ Use `--field name:type` to store resource field metadata in the registry. Supported field types are `string`, `number`, `boolean`, and `date`. Add `:optional` to make a field optional.
139
+
140
+ Use `--policy admin`, `--policy roles:a,b`, or `--policy custom:name` to attach an auth policy to generated protected routes. Policies require route auth.
141
+
142
+ Use `--crud-route operation:method:path[:auth][:zone][:policy][:bruno|no-bruno]` to override CRUD route metadata per operation. Supported operations are `list`, `get`, `create`, `update`, and `delete`. Matrix policies use `admin`, `roles=a,b`, or `custom=name`.
143
+
144
+ ## `soap add route`
145
+
146
+ Add a route to an existing resource:
147
+
148
+ ```bash
149
+ soap add route users export --method get --path export
150
+ soap add route users activate-user --method post --path :id/activate --auth jwt --zone private
151
+ soap add route users approve --method post --path :id/approve --auth jwt --policy custom:approver
152
+ soap add route users rebuild --method post --command rebuild-user
153
+ soap add route users search --method get --query search-users
154
+ ```
155
+
156
+ The route path must stay under the resource path. Route names and resource names are normalized to kebab-case in the registry. `--policy` supports `admin`, `roles:a,b`, `custom:name`, and `none`.
157
+
158
+ ## Bruno
159
+
160
+ Enable Bruno at project creation:
161
+
162
+ ```bash
163
+ soap create users-api --api-client bruno --skip-install
164
+ ```
165
+
166
+ Or add it later:
167
+
168
+ ```bash
169
+ soap update config --add-api-client bruno
170
+ soap generate bruno
171
+ ```
172
+
173
+ Generated collection structure:
174
+
175
+ ```txt
176
+ bruno/
177
+ bruno.json
178
+ environments/Local.bru
179
+ Health/health.bru
180
+ <Resource>/<Request>.bru
181
+ ```
182
+
183
+ Run API tests:
184
+
185
+ ```bash
186
+ npm run bruno
187
+ npm run test:api
188
+ make bruno
189
+ make test-api
190
+ ```
191
+
192
+ Generate a CRUD E2E flow:
193
+
194
+ ```bash
195
+ soap generate bruno --e2e
196
+ npm run bruno
197
+ ```
198
+
199
+ Bruno generation is registry-driven. Modified `.bru` files are skipped by default; use `--force` to overwrite or `--write-new` to write `.new` files.
200
+
201
+ ## OpenAPI
202
+
203
+ Enable OpenAPI at project creation:
204
+
205
+ ```bash
206
+ soap create users-api --docs openapi --skip-install
207
+ ```
208
+
209
+ Or add it later:
210
+
211
+ ```bash
212
+ soap update config --add-docs openapi
213
+ ```
214
+
215
+ When the app is running, fetch the generated spec:
216
+
217
+ ```bash
218
+ soap generate openapi
219
+ soap generate openapi --output openapi.json
220
+ ```
221
+
222
+ The generated app exposes:
223
+
224
+ - `/docs`
225
+ - `/openapi.json`
226
+
227
+ ## Docker Flow
228
+
229
+ Generated projects include `Dockerfile`, `docker-compose.yml`, and `Makefile`.
230
+
231
+ ```bash
232
+ make up
233
+ make logs
234
+ curl http://localhost:3000/health
235
+ make down
236
+ make down-clean
237
+ ```
238
+
239
+ Selected capabilities update Docker services. For example, Redis adds a `redis` service and `REDIS_URL`, Postgres adds a `postgres` service and volume, MySQL adds a `mysql` service and volume, SQLite adds `SQLITE_FILENAME`, and Kafka adds Redpanda.
240
+
241
+ ## `.soap` Folder
242
+
243
+ Every generated project includes:
244
+
245
+ ```txt
246
+ .soap/
247
+ project.json
248
+ structure.json
249
+ api.json
250
+ registry.json
251
+ ```
252
+
253
+ - `project.json` stores project metadata and selected capabilities.
254
+ - `structure.json` stores source layout conventions.
255
+ - `api.json` stores API-level settings such as base URL, health path, auth defaults, and Bruno config.
256
+ - `registry.json` stores resources, routes, and generated file hashes.
257
+
258
+ The registry is what makes later commands deterministic and safe.
259
+
260
+ ## Generated Architecture
261
+
262
+ Default layout:
263
+
264
+ ```txt
265
+ src/
266
+ index.ts
267
+ config/
268
+ config.ts
269
+ controllers.ts
270
+ dependencies.ts
271
+ resources.ts
272
+ common/
273
+ features/
274
+ <resource>/
275
+ domain/
276
+ application/
277
+ data/
278
+ api/
279
+ contracts/
280
+ ```
281
+
282
+ Generated code keeps optional adapters in the composition root:
283
+
284
+ - database clients in `src/config/dependencies.ts`
285
+ - controllers in `src/config/controllers.ts`
286
+ - resource registration in `src/config/resources.ts`
287
+ - OpenAPI plugin in `src/index.ts`
288
+ - auth strategies in `src/features/auth`
289
+
290
+ ## Capabilities
291
+
292
+ Supported MVP capabilities:
293
+
294
+ - Framework: `express`
295
+ - Architecture: `regular`, `cqrs`
296
+ - Databases: `mongo`, `postgres`, `mysql`, `sqlite`, `redis`
297
+ - Auth: `jwt`, `api-key`, `local`
298
+ - Messaging: `in-memory`, `kafka`
299
+ - Realtime: `ws`
300
+ - Telemetry: `logs`, `otel-noop`
301
+ - Docs: `openapi`
302
+ - Contracts: `zod`
303
+ - API client: `bruno`
304
+
305
+ Add capabilities after project creation:
306
+
307
+ ```bash
308
+ soap update config --add-db redis
309
+ soap update config --add-db mysql
310
+ soap update config --add-auth api-key
311
+ soap update config --add-docs openapi
312
+ soap update config --add-contracts zod
313
+ soap update config --add-api-client bruno
314
+ ```
315
+
316
+ ## Safety and Overwrite Behavior
317
+
318
+ The CLI tracks generated file hashes in `.soap/registry.json`.
319
+
320
+ Default behavior:
321
+
322
+ - Existing unmodified generated files can be updated.
323
+ - Manually modified generated files are skipped.
324
+ - `--force` overwrites or deletes modified generated files.
325
+ - `--write-new` writes a `.new` file for supported generators.
326
+ - `--dry-run` prints planned writes/deletes without changing files.
327
+
328
+ Safe removal:
329
+
330
+ ```bash
331
+ soap remove route users create-user
332
+ soap remove resource users
333
+ soap remove route users create-user --force
334
+ ```
335
+
336
+ `soap remove` only deletes files tracked in the registry. If a target file was manually modified, the operation is skipped unless `--force` is used.
337
+
338
+ ## Validation
339
+
340
+ ```bash
341
+ soap info
342
+ soap doctor
343
+ soap check routes
344
+ ```
345
+
346
+ `soap check routes` verifies route uniqueness, zones, auth strategies, contracts, and Bruno request files when Bruno is enabled.
347
+
348
+ ## MVP Limitations
349
+
350
+ - Only the Express adapter is supported.
351
+ - The generator is template-based; it does not perform broad AST mutation of user-edited app code.
352
+ - Dependency installation is explicit. Use `--install` or answer yes in interactive mode.
353
+ - Git initialization is explicit. Use `--git-init`; the CLI does not commit or push.
354
+ - Update commands are add-only for capabilities.
355
+ - Redis is currently wired as dependency/config/Docker capability; resource repositories are implemented for memory, Mongo, Postgres, MySQL, and SQLite paths.
356
+ - Generated code is intended as a clean starting point and integration surface, not as a migration engine for arbitrary existing apps.
357
+
358
+ ## License
359
+
360
+ MIT
package/build/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function buildProgram(): Command;
3
+ export declare function runCli(argv: string[]): Promise<void>;
package/build/cli.js ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCli = exports.buildProgram = void 0;
4
+ const commander_1 = require("commander");
5
+ const command_context_1 = require("./core/command-context");
6
+ const errors_1 = require("./core/errors");
7
+ const create_command_1 = require("./commands/create/create.command");
8
+ const add_command_1 = require("./commands/add/add.command");
9
+ const generate_command_1 = require("./commands/generate/generate.command");
10
+ const info_command_1 = require("./commands/info/info.command");
11
+ const doctor_command_1 = require("./commands/doctor/doctor.command");
12
+ const check_command_1 = require("./commands/check/check.command");
13
+ const remove_command_1 = require("./commands/remove/remove.command");
14
+ const update_command_1 = require("./commands/update/update.command");
15
+ function buildProgram() {
16
+ const program = new commander_1.Command();
17
+ program
18
+ .name("soap")
19
+ .description("Deterministic project and code generator for SoapJS services.")
20
+ .option("--cwd <path>", "working directory", process.cwd())
21
+ .option("--dry-run", "show planned writes without writing files", false)
22
+ .option("--verbose", "show debug logs and stack traces", false)
23
+ .option("--silent", "suppress non-error output", false);
24
+ (0, create_command_1.registerCreateCommand)(program);
25
+ (0, add_command_1.registerAddCommand)(program);
26
+ (0, generate_command_1.registerGenerateCommand)(program);
27
+ (0, info_command_1.registerInfoCommand)(program);
28
+ (0, doctor_command_1.registerDoctorCommand)(program);
29
+ (0, check_command_1.registerCheckCommand)(program);
30
+ (0, remove_command_1.registerRemoveCommand)(program);
31
+ (0, update_command_1.registerUpdateCommand)(program);
32
+ program.hook("preAction", (root, actionCommand) => {
33
+ const options = root.opts();
34
+ actionCommand.setOptionValue("_context", (0, command_context_1.createCommandContext)(options));
35
+ });
36
+ return program;
37
+ }
38
+ exports.buildProgram = buildProgram;
39
+ async function runCli(argv) {
40
+ const program = buildProgram();
41
+ try {
42
+ await program.parseAsync(argv);
43
+ }
44
+ catch (error) {
45
+ const context = (0, command_context_1.createCommandContext)(program.opts());
46
+ (0, errors_1.handleCliError)(error, context);
47
+ process.exitCode = 1;
48
+ }
49
+ }
50
+ exports.runCli = runCli;
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare function registerAddCommand(program: Command): void;