@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.
- package/.nvmrc +1 -0
- package/LICENSE +21 -0
- package/README.md +360 -0
- package/build/cli.d.ts +3 -0
- package/build/cli.js +50 -0
- package/build/commands/add/add.command.d.ts +2 -0
- package/build/commands/add/add.command.js +709 -0
- package/build/commands/add/command-plan.d.ts +15 -0
- package/build/commands/add/command-plan.js +182 -0
- package/build/commands/add/entity-plan.d.ts +7 -0
- package/build/commands/add/entity-plan.js +106 -0
- package/build/commands/add/event-plan.d.ts +8 -0
- package/build/commands/add/event-plan.js +59 -0
- package/build/commands/add/query-plan.d.ts +10 -0
- package/build/commands/add/query-plan.js +156 -0
- package/build/commands/add/repository-plan.d.ts +11 -0
- package/build/commands/add/repository-plan.js +252 -0
- package/build/commands/add/resource-plan.d.ts +52 -0
- package/build/commands/add/resource-plan.js +2031 -0
- package/build/commands/add/route-plan.d.ts +24 -0
- package/build/commands/add/route-plan.js +256 -0
- package/build/commands/add/socket-plan.d.ts +9 -0
- package/build/commands/add/socket-plan.js +81 -0
- package/build/commands/add/use-case-plan.d.ts +7 -0
- package/build/commands/add/use-case-plan.js +86 -0
- package/build/commands/check/check.command.d.ts +2 -0
- package/build/commands/check/check.command.js +113 -0
- package/build/commands/create/create.command.d.ts +2 -0
- package/build/commands/create/create.command.js +234 -0
- package/build/commands/create/project-plan.d.ts +44 -0
- package/build/commands/create/project-plan.js +1430 -0
- package/build/commands/doctor/doctor.command.d.ts +2 -0
- package/build/commands/doctor/doctor.command.js +38 -0
- package/build/commands/generate/bruno-analysis.d.ts +19 -0
- package/build/commands/generate/bruno-analysis.js +51 -0
- package/build/commands/generate/bruno-plan.d.ts +6 -0
- package/build/commands/generate/bruno-plan.js +326 -0
- package/build/commands/generate/generate.command.d.ts +2 -0
- package/build/commands/generate/generate.command.js +130 -0
- package/build/commands/info/info.command.d.ts +2 -0
- package/build/commands/info/info.command.js +26 -0
- package/build/commands/remove/remove.command.d.ts +2 -0
- package/build/commands/remove/remove.command.js +328 -0
- package/build/commands/shared/common-options.d.ts +10 -0
- package/build/commands/shared/common-options.js +23 -0
- package/build/commands/update/update.command.d.ts +2 -0
- package/build/commands/update/update.command.js +155 -0
- package/build/config/auth-policy.d.ts +4 -0
- package/build/config/auth-policy.js +54 -0
- package/build/config/find-soap-root.d.ts +1 -0
- package/build/config/find-soap-root.js +22 -0
- package/build/config/load-soap-config.d.ts +2 -0
- package/build/config/load-soap-config.js +30 -0
- package/build/config/schemas/types.d.ts +127 -0
- package/build/config/schemas/types.js +2 -0
- package/build/config/schemas/validation.d.ts +5 -0
- package/build/config/schemas/validation.js +130 -0
- package/build/config/soap-config.service.d.ts +4 -0
- package/build/config/soap-config.service.js +24 -0
- package/build/config/write-soap-config.d.ts +8 -0
- package/build/config/write-soap-config.js +25 -0
- package/build/core/command-context.d.ts +20 -0
- package/build/core/command-context.js +30 -0
- package/build/core/errors.d.ts +6 -0
- package/build/core/errors.js +23 -0
- package/build/core/output.d.ts +12 -0
- package/build/core/output.js +30 -0
- package/build/core/result.d.ts +9 -0
- package/build/core/result.js +11 -0
- package/build/dependencies/dependency-resolver.d.ts +6 -0
- package/build/dependencies/dependency-resolver.js +68 -0
- package/build/dependencies/package-manager.d.ts +7 -0
- package/build/dependencies/package-manager.js +54 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +9 -0
- package/build/io/conflict-policy.d.ts +10 -0
- package/build/io/conflict-policy.js +32 -0
- package/build/io/file-writer.d.ts +19 -0
- package/build/io/file-writer.js +65 -0
- package/build/io/format-file.d.ts +1 -0
- package/build/io/format-file.js +13 -0
- package/build/presets/create-presets.d.ts +4 -0
- package/build/presets/create-presets.js +97 -0
- package/build/presets/index.d.ts +2 -0
- package/build/presets/index.js +18 -0
- package/build/presets/preset.types.d.ts +6 -0
- package/build/presets/preset.types.js +2 -0
- package/build/prompts/add-resource.prompt.d.ts +13 -0
- package/build/prompts/add-resource.prompt.js +80 -0
- package/build/prompts/add-route.prompt.d.ts +16 -0
- package/build/prompts/add-route.prompt.js +140 -0
- package/build/prompts/create-project.prompt.d.ts +11 -0
- package/build/prompts/create-project.prompt.js +156 -0
- package/build/prompts/generate-bruno.prompt.d.ts +7 -0
- package/build/prompts/generate-bruno.prompt.js +21 -0
- package/build/prompts/index.d.ts +8 -0
- package/build/prompts/index.js +24 -0
- package/build/prompts/inquirer-prompt-adapter.d.ts +8 -0
- package/build/prompts/inquirer-prompt-adapter.js +52 -0
- package/build/prompts/mock-prompt-adapter.d.ts +13 -0
- package/build/prompts/mock-prompt-adapter.js +60 -0
- package/build/prompts/prompt-adapter.d.ts +7 -0
- package/build/prompts/prompt-adapter.js +2 -0
- package/build/prompts/prompt.types.d.ts +26 -0
- package/build/prompts/prompt.types.js +2 -0
- package/build/registry/registry.service.d.ts +19 -0
- package/build/registry/registry.service.js +68 -0
- package/build/resolvers/add-resource.resolver.d.ts +23 -0
- package/build/resolvers/add-resource.resolver.js +73 -0
- package/build/resolvers/add-route.resolver.d.ts +34 -0
- package/build/resolvers/add-route.resolver.js +83 -0
- package/build/resolvers/create-config.resolver.d.ts +32 -0
- package/build/resolvers/create-config.resolver.js +57 -0
- package/build/resolvers/generate-bruno.resolver.d.ts +17 -0
- package/build/resolvers/generate-bruno.resolver.js +23 -0
- package/build/resolvers/index.d.ts +5 -0
- package/build/resolvers/index.js +21 -0
- package/build/resolvers/resolver.types.d.ts +8 -0
- package/build/resolvers/resolver.types.js +2 -0
- package/build/summary/create-summary.d.ts +2 -0
- package/build/summary/create-summary.js +24 -0
- package/build/summary/index.d.ts +1 -0
- package/build/summary/index.js +17 -0
- package/build/templates/naming.d.ts +11 -0
- package/build/templates/naming.js +30 -0
- package/build/templates/template-context.d.ts +6 -0
- package/build/templates/template-context.js +2 -0
- package/build/templates/template-engine.d.ts +1 -0
- package/build/templates/template-engine.js +10 -0
- package/build/templates/template-resolver.d.ts +2 -0
- package/build/templates/template-resolver.js +17 -0
- package/build/terminal/terminal-capabilities.d.ts +6 -0
- package/build/terminal/terminal-capabilities.js +14 -0
- package/docs/adr/0001-soap-cli-project-aware-generator.md +108 -0
- package/docs/cli/add-resource.md +127 -0
- package/docs/cli/add-route.md +79 -0
- package/docs/cli/bruno.md +58 -0
- package/docs/cli/create.md +73 -0
- package/docs/cli/index.md +92 -0
- package/docs/cli/interactive-mode.md +61 -0
- package/docs/cli/remove.md +45 -0
- package/docs/guides/auth.md +90 -0
- package/docs/guides/cqrs-events-realtime.md +100 -0
- package/docs/guides/index.md +24 -0
- package/docs/guides/quality-and-safety.md +88 -0
- package/docs/guides/regular-api.md +119 -0
- package/docs/guides/storage.md +101 -0
- package/docs/plans/interactive-mode-plan.md +601 -0
- package/package.json +44 -0
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
# Soap CLI Interactive Mode Plan
|
|
2
|
+
|
|
3
|
+
This plan adapts `/Users/rad/Downloads/SOAP_CLI_INTERACTIVE_MODE_TICKETS.md` to the current `soap-cli` codebase.
|
|
4
|
+
|
|
5
|
+
The current CLI is deterministic, registry-aware, and template-based. Interactive mode must preserve that model. It should resolve command inputs, never generate code through AI, and never hide file writes, deletes, or overwrites.
|
|
6
|
+
|
|
7
|
+
## Current Baseline
|
|
8
|
+
|
|
9
|
+
Current command surface:
|
|
10
|
+
|
|
11
|
+
- `soap create`
|
|
12
|
+
- `soap add resource`
|
|
13
|
+
- `soap add route`
|
|
14
|
+
- `soap add entity`
|
|
15
|
+
- `soap add use-case`
|
|
16
|
+
- `soap add repository`
|
|
17
|
+
- `soap add command`
|
|
18
|
+
- `soap add query`
|
|
19
|
+
- `soap add event`
|
|
20
|
+
- `soap add socket`
|
|
21
|
+
- `soap generate bruno`
|
|
22
|
+
- `soap generate openapi`
|
|
23
|
+
- `soap info`
|
|
24
|
+
- `soap doctor`
|
|
25
|
+
- `soap check routes`
|
|
26
|
+
- `soap remove route`
|
|
27
|
+
- `soap remove resource`
|
|
28
|
+
- `soap update config`
|
|
29
|
+
|
|
30
|
+
Current capability model:
|
|
31
|
+
|
|
32
|
+
- Framework: `express`
|
|
33
|
+
- Architecture: `regular`, `cqrs`
|
|
34
|
+
- Databases: `mongo`, `postgres`, `mysql`, `sqlite`, `redis`
|
|
35
|
+
- Auth: `jwt`, `api-key`, `local`
|
|
36
|
+
- Messaging: `in-memory`, `kafka`
|
|
37
|
+
- Realtime: `ws`
|
|
38
|
+
- Telemetry: `logs`, `otel-noop`
|
|
39
|
+
- Docs: `openapi`
|
|
40
|
+
- API client: `bruno`
|
|
41
|
+
|
|
42
|
+
Out of scope for the first interactive pass:
|
|
43
|
+
|
|
44
|
+
- MySQL and SQLite
|
|
45
|
+
- OAuth2 and Basic auth
|
|
46
|
+
- role/admin decorator policies beyond existing auth strategy values
|
|
47
|
+
- Zod as a separate capability
|
|
48
|
+
- Pino/tracing capability names
|
|
49
|
+
- git init
|
|
50
|
+
- Docker enable/disable toggle
|
|
51
|
+
- migrations, DB indexes, generated test suites, mapper prompts
|
|
52
|
+
- registry field metadata
|
|
53
|
+
|
|
54
|
+
These are valid future directions, but they require model/schema work before prompts should expose them.
|
|
55
|
+
|
|
56
|
+
## Design Rules
|
|
57
|
+
|
|
58
|
+
1. Interactive is optional.
|
|
59
|
+
|
|
60
|
+
Every interactive flow must have an equivalent flag-based non-interactive flow.
|
|
61
|
+
|
|
62
|
+
2. Resolution order is fixed.
|
|
63
|
+
|
|
64
|
+
```txt
|
|
65
|
+
explicit CLI flags
|
|
66
|
+
interactive answers
|
|
67
|
+
.soap project/api/registry defaults
|
|
68
|
+
preset defaults
|
|
69
|
+
hardcoded fallback defaults
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
3. Interactive prompts are project-aware.
|
|
73
|
+
|
|
74
|
+
Existing `.soap/project.json`, `.soap/structure.json`, `.soap/api.json`, and `.soap/registry.json` determine available choices.
|
|
75
|
+
|
|
76
|
+
4. Prompting is only input resolution.
|
|
77
|
+
|
|
78
|
+
Prompt answers feed the same deterministic planners and writers used by non-interactive commands.
|
|
79
|
+
|
|
80
|
+
5. File conflict behavior is shared.
|
|
81
|
+
|
|
82
|
+
Interactive mode may ask, but actual writes/deletes must still go through the same safe file writer and registry hash checks.
|
|
83
|
+
|
|
84
|
+
6. Future capability expansion must happen below the prompt layer first.
|
|
85
|
+
|
|
86
|
+
Do not ask users about a capability until the config schema, dependency resolver, templates, registry behavior, and validation support it.
|
|
87
|
+
|
|
88
|
+
## Phase 1 — Interactive Foundation
|
|
89
|
+
|
|
90
|
+
### INT-MVP-001 — Shared Interactive Option
|
|
91
|
+
|
|
92
|
+
Add `-i, --interactive` to supported commands.
|
|
93
|
+
|
|
94
|
+
Initial supported commands:
|
|
95
|
+
|
|
96
|
+
- `soap create <name>`
|
|
97
|
+
- `soap add resource <name>`
|
|
98
|
+
- `soap add route <resource> <name>`
|
|
99
|
+
- `soap generate bruno`
|
|
100
|
+
- `soap remove route <resource> <route>`
|
|
101
|
+
- `soap remove resource <resource>`
|
|
102
|
+
|
|
103
|
+
Also add shared `--on-conflict <policy>` where useful.
|
|
104
|
+
|
|
105
|
+
Policies:
|
|
106
|
+
|
|
107
|
+
- `ask`
|
|
108
|
+
- `skip`
|
|
109
|
+
- `overwrite`
|
|
110
|
+
- `new`
|
|
111
|
+
- `abort`
|
|
112
|
+
|
|
113
|
+
Mapping to existing behavior:
|
|
114
|
+
|
|
115
|
+
- `skip` -> current skip modified behavior
|
|
116
|
+
- `overwrite` -> `--force`
|
|
117
|
+
- `new` -> `--write-new` where supported
|
|
118
|
+
- `abort` -> fail on first conflict
|
|
119
|
+
- `ask` -> prompt only in interactive TTY
|
|
120
|
+
|
|
121
|
+
Acceptance:
|
|
122
|
+
|
|
123
|
+
- Commands accept `-i` and `--interactive`.
|
|
124
|
+
- Help documents interactive flags.
|
|
125
|
+
- No prompt appears unless `-i` is passed.
|
|
126
|
+
- Existing non-interactive behavior remains unchanged.
|
|
127
|
+
|
|
128
|
+
### INT-MVP-002 — Prompt Adapter
|
|
129
|
+
|
|
130
|
+
Add a prompt abstraction under `src/prompts`.
|
|
131
|
+
|
|
132
|
+
Suggested files:
|
|
133
|
+
|
|
134
|
+
```txt
|
|
135
|
+
src/prompts/prompt.types.ts
|
|
136
|
+
src/prompts/prompt-adapter.ts
|
|
137
|
+
src/prompts/inquirer-prompt-adapter.ts
|
|
138
|
+
src/prompts/mock-prompt-adapter.ts
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Interface:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
interface PromptAdapter {
|
|
145
|
+
input(question: InputQuestion): Promise<string>;
|
|
146
|
+
confirm(question: ConfirmQuestion): Promise<boolean>;
|
|
147
|
+
select<T extends string>(question: SelectQuestion<T>): Promise<T>;
|
|
148
|
+
multiSelect<T extends string>(question: MultiSelectQuestion<T>): Promise<T[]>;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Acceptance:
|
|
153
|
+
|
|
154
|
+
- Command code does not import `@inquirer/prompts` directly.
|
|
155
|
+
- Adapter is mockable in tests.
|
|
156
|
+
- `@inquirer/prompts` is the only prompt implementation dependency.
|
|
157
|
+
|
|
158
|
+
### INT-MVP-003 — Terminal Capability Guard
|
|
159
|
+
|
|
160
|
+
Add TTY detection.
|
|
161
|
+
|
|
162
|
+
Suggested files:
|
|
163
|
+
|
|
164
|
+
```txt
|
|
165
|
+
src/terminal/terminal-capabilities.ts
|
|
166
|
+
src/commands/shared/interactive-guard.ts
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Behavior:
|
|
170
|
+
|
|
171
|
+
- If `--interactive` is passed outside a TTY, fail clearly.
|
|
172
|
+
- Non-interactive commands still work in CI.
|
|
173
|
+
- `--yes` may skip confirmations but must not imply interactive mode.
|
|
174
|
+
|
|
175
|
+
Error:
|
|
176
|
+
|
|
177
|
+
```txt
|
|
178
|
+
Interactive mode requires a TTY. Use explicit flags instead.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Acceptance:
|
|
182
|
+
|
|
183
|
+
- TTY and non-TTY behavior covered by unit tests.
|
|
184
|
+
|
|
185
|
+
### INT-MVP-004 — Input Resolvers
|
|
186
|
+
|
|
187
|
+
Add small resolvers for current command inputs.
|
|
188
|
+
|
|
189
|
+
Suggested files:
|
|
190
|
+
|
|
191
|
+
```txt
|
|
192
|
+
src/resolvers/resolver.types.ts
|
|
193
|
+
src/resolvers/create-config.resolver.ts
|
|
194
|
+
src/resolvers/add-resource.resolver.ts
|
|
195
|
+
src/resolvers/add-route.resolver.ts
|
|
196
|
+
src/resolvers/generate-bruno.resolver.ts
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Acceptance:
|
|
200
|
+
|
|
201
|
+
- Flags always win over prompt answers.
|
|
202
|
+
- Prompt answers win over config defaults.
|
|
203
|
+
- Project config restricts available options.
|
|
204
|
+
- Invalid resolved values fail before file planning.
|
|
205
|
+
|
|
206
|
+
### INT-MVP-005 — Shared Conflict Policy
|
|
207
|
+
|
|
208
|
+
Consolidate current `force`, `writeNew`, and skip behavior.
|
|
209
|
+
|
|
210
|
+
Suggested files:
|
|
211
|
+
|
|
212
|
+
```txt
|
|
213
|
+
src/io/conflict-policy.ts
|
|
214
|
+
src/prompts/file-conflict.prompt.ts
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Acceptance:
|
|
218
|
+
|
|
219
|
+
- Existing `--force` and `--write-new` still work.
|
|
220
|
+
- Interactive conflict `ask` presents skip/overwrite/write-new/abort.
|
|
221
|
+
- Non-interactive default stays safe.
|
|
222
|
+
|
|
223
|
+
## Phase 2 — Interactive Create
|
|
224
|
+
|
|
225
|
+
### INT-MVP-101 — `soap create <name> -i`
|
|
226
|
+
|
|
227
|
+
Prompt only for current supported capabilities.
|
|
228
|
+
|
|
229
|
+
Prompt flow:
|
|
230
|
+
|
|
231
|
+
```txt
|
|
232
|
+
Project name
|
|
233
|
+
Framework: express
|
|
234
|
+
Architecture: regular/cqrs
|
|
235
|
+
Databases: mongo/postgres/mysql/sqlite/redis/none
|
|
236
|
+
Auth: jwt/api-key/local/none
|
|
237
|
+
Messaging: in-memory/kafka
|
|
238
|
+
Realtime: ws/none
|
|
239
|
+
Telemetry: logs/otel-noop
|
|
240
|
+
Docs: openapi/none
|
|
241
|
+
API client: bruno/none
|
|
242
|
+
Zones: public/private/admin
|
|
243
|
+
Package manager: npm/pnpm/yarn/bun
|
|
244
|
+
Install dependencies: yes/no
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Do not prompt for unsupported future options.
|
|
248
|
+
|
|
249
|
+
Acceptance:
|
|
250
|
+
|
|
251
|
+
- Provided flags skip matching questions.
|
|
252
|
+
- Answers feed existing `createProjectFiles` and `createSoapConfigBundle`.
|
|
253
|
+
- Generated `.soap` files match selected answers.
|
|
254
|
+
- `--dry-run` prints summary and planned file count.
|
|
255
|
+
|
|
256
|
+
### INT-MVP-102 — Create Summary
|
|
257
|
+
|
|
258
|
+
Before writing files, show a summary in interactive mode.
|
|
259
|
+
|
|
260
|
+
Example:
|
|
261
|
+
|
|
262
|
+
```txt
|
|
263
|
+
Project: billing-service
|
|
264
|
+
Architecture: regular
|
|
265
|
+
Databases: postgres
|
|
266
|
+
Auth: jwt
|
|
267
|
+
Docs: openapi
|
|
268
|
+
API client: bruno
|
|
269
|
+
|
|
270
|
+
Generate project? yes/no
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Acceptance:
|
|
274
|
+
|
|
275
|
+
- User can abort before writes.
|
|
276
|
+
- `--yes` skips final confirmation.
|
|
277
|
+
|
|
278
|
+
### INT-MVP-103 — Create Presets
|
|
279
|
+
|
|
280
|
+
Add presets compatible with current capability model.
|
|
281
|
+
|
|
282
|
+
Initial presets:
|
|
283
|
+
|
|
284
|
+
- `express-mongo-api`
|
|
285
|
+
- `express-postgres-api`
|
|
286
|
+
- `express-cqrs-kafka-api`
|
|
287
|
+
- `express-full-demo`
|
|
288
|
+
|
|
289
|
+
Suggested files:
|
|
290
|
+
|
|
291
|
+
```txt
|
|
292
|
+
src/presets/create-presets.ts
|
|
293
|
+
src/presets/preset.types.ts
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Acceptance:
|
|
297
|
+
|
|
298
|
+
- `soap create my-api --preset express-mongo-api` works without prompts.
|
|
299
|
+
- `soap create my-api -i --preset express-mongo-api` uses preset values as defaults.
|
|
300
|
+
- Invalid preset shows available presets.
|
|
301
|
+
|
|
302
|
+
## Phase 3 — Interactive Resource And Route
|
|
303
|
+
|
|
304
|
+
### INT-MVP-201 — `soap add resource <name> -i`
|
|
305
|
+
|
|
306
|
+
Prompt flow based on current generator:
|
|
307
|
+
|
|
308
|
+
```txt
|
|
309
|
+
Resource name
|
|
310
|
+
Generate CRUD: yes/no
|
|
311
|
+
Storage: none + enabled databases only
|
|
312
|
+
Auth: none + enabled route auth only
|
|
313
|
+
Zone: enabled project zones
|
|
314
|
+
Generate Bruno requests: yes/no if Bruno enabled
|
|
315
|
+
Enable Bruno now: yes/no if Bruno disabled
|
|
316
|
+
Run as dry-run first: yes/no
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Acceptance:
|
|
320
|
+
|
|
321
|
+
- Reads `.soap` before prompting.
|
|
322
|
+
- Does not offer unavailable DB/auth choices.
|
|
323
|
+
- If Bruno is enabled interactively, updates `.soap/api.json` and project capabilities using update config behavior.
|
|
324
|
+
- Generated files and registry are unchanged from equivalent flag-based flow.
|
|
325
|
+
|
|
326
|
+
### INT-MVP-202 — Resource Plan Summary
|
|
327
|
+
|
|
328
|
+
Reuse the existing resource planning summary from `soap add resource --dry-run`.
|
|
329
|
+
|
|
330
|
+
Acceptance:
|
|
331
|
+
|
|
332
|
+
- Interactive mode shows planned file groups before writing.
|
|
333
|
+
- User can abort.
|
|
334
|
+
- `--yes` skips final confirmation.
|
|
335
|
+
|
|
336
|
+
### INT-MVP-203 — `soap add route <resource> <name> -i`
|
|
337
|
+
|
|
338
|
+
Prompt flow:
|
|
339
|
+
|
|
340
|
+
```txt
|
|
341
|
+
Resource: select from registry if missing
|
|
342
|
+
Route name
|
|
343
|
+
HTTP method
|
|
344
|
+
Path
|
|
345
|
+
Zone
|
|
346
|
+
Auth
|
|
347
|
+
Target: direct/use-case/command/query
|
|
348
|
+
Generate Bruno request: yes/no if Bruno enabled
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Acceptance:
|
|
352
|
+
|
|
353
|
+
- Resource list comes from registry.
|
|
354
|
+
- Auth choices come from enabled capabilities.
|
|
355
|
+
- Zone choices come from `.soap/project.json`.
|
|
356
|
+
- Generated route matches equivalent non-interactive flags.
|
|
357
|
+
|
|
358
|
+
## Phase 4 — Interactive Generated Artifacts
|
|
359
|
+
|
|
360
|
+
### INT-MVP-301 — `soap generate bruno -i`
|
|
361
|
+
|
|
362
|
+
Prompt flow:
|
|
363
|
+
|
|
364
|
+
```txt
|
|
365
|
+
Detected routes
|
|
366
|
+
Existing Bruno files
|
|
367
|
+
Missing Bruno files
|
|
368
|
+
Modified generated Bruno files
|
|
369
|
+
|
|
370
|
+
Choose:
|
|
371
|
+
- generate missing only
|
|
372
|
+
- regenerate all unmodified generated files
|
|
373
|
+
- generate E2E flow
|
|
374
|
+
- abort
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Acceptance:
|
|
378
|
+
|
|
379
|
+
- Manual `.bru` edits are detected.
|
|
380
|
+
- User can avoid overwriting modified files.
|
|
381
|
+
- `--force` still overrides.
|
|
382
|
+
|
|
383
|
+
### INT-MVP-302 — Interactive OpenAPI Export
|
|
384
|
+
|
|
385
|
+
Optional small enhancement:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
soap generate openapi -i
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Prompt:
|
|
392
|
+
|
|
393
|
+
```txt
|
|
394
|
+
Output path: openapi.json
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Acceptance:
|
|
398
|
+
|
|
399
|
+
- Only offered when OpenAPI capability is enabled.
|
|
400
|
+
- Dry run does not fetch from server.
|
|
401
|
+
|
|
402
|
+
## Phase 5 — Interactive Remove
|
|
403
|
+
|
|
404
|
+
### INT-MVP-401 — `soap remove route/resource -i`
|
|
405
|
+
|
|
406
|
+
Use existing safe remove behavior.
|
|
407
|
+
|
|
408
|
+
Prompt flow:
|
|
409
|
+
|
|
410
|
+
```txt
|
|
411
|
+
Found route/resource
|
|
412
|
+
Tracked files to delete
|
|
413
|
+
Modified tracked files
|
|
414
|
+
Registry entries to remove
|
|
415
|
+
|
|
416
|
+
Continue? yes/no
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Acceptance:
|
|
420
|
+
|
|
421
|
+
- Shows tracked file list before deletion.
|
|
422
|
+
- Refuses modified files unless user chooses overwrite/force.
|
|
423
|
+
- Dry run shows planned deletion.
|
|
424
|
+
- Does not delete untracked files.
|
|
425
|
+
|
|
426
|
+
## Phase 6 — Tests And Docs
|
|
427
|
+
|
|
428
|
+
### INT-MVP-501 — Resolver Unit Tests
|
|
429
|
+
|
|
430
|
+
Test:
|
|
431
|
+
|
|
432
|
+
- flags override prompts
|
|
433
|
+
- prompts override project config
|
|
434
|
+
- project config overrides preset
|
|
435
|
+
- preset overrides fallback
|
|
436
|
+
- invalid values fail
|
|
437
|
+
|
|
438
|
+
### INT-MVP-502 — Prompt Adapter Tests
|
|
439
|
+
|
|
440
|
+
Test commands with mocked prompt adapter.
|
|
441
|
+
|
|
442
|
+
Initial integration tests:
|
|
443
|
+
|
|
444
|
+
- `soap create my-api -i`
|
|
445
|
+
- `soap add resource users -i`
|
|
446
|
+
- `soap add route users search -i`
|
|
447
|
+
- `soap generate bruno -i`
|
|
448
|
+
- `soap remove route users create-user -i`
|
|
449
|
+
|
|
450
|
+
### INT-MVP-503 — Interactive Docs
|
|
451
|
+
|
|
452
|
+
Add:
|
|
453
|
+
|
|
454
|
+
```txt
|
|
455
|
+
docs/cli/interactive-mode.md
|
|
456
|
+
docs/cli/create.md
|
|
457
|
+
docs/cli/add-resource.md
|
|
458
|
+
docs/cli/add-route.md
|
|
459
|
+
docs/cli/bruno.md
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Update root README with an interactive section.
|
|
463
|
+
|
|
464
|
+
## Phase 7 — Future Capability Expansion
|
|
465
|
+
|
|
466
|
+
These items should not be prompt-only tickets. Each needs schema, templates, validation, registry, docs, and tests.
|
|
467
|
+
|
|
468
|
+
### FUT-001 — Contracts Capability
|
|
469
|
+
|
|
470
|
+
Add explicit contract capability, likely:
|
|
471
|
+
|
|
472
|
+
```ts
|
|
473
|
+
contracts: ["zod"]
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Work required:
|
|
477
|
+
|
|
478
|
+
- config schema
|
|
479
|
+
- dependency resolver
|
|
480
|
+
- route/resource templates
|
|
481
|
+
- registry metadata
|
|
482
|
+
- `soap update config --add-contracts zod`
|
|
483
|
+
- interactive prompts
|
|
484
|
+
|
|
485
|
+
### FUT-002 — Resource Field Metadata
|
|
486
|
+
|
|
487
|
+
Add field definitions to registry.
|
|
488
|
+
|
|
489
|
+
Used by:
|
|
490
|
+
|
|
491
|
+
- entity templates
|
|
492
|
+
- contracts
|
|
493
|
+
- Bruno request bodies
|
|
494
|
+
- repositories
|
|
495
|
+
- later migrations/indexes
|
|
496
|
+
|
|
497
|
+
This should be implemented before INT-style field prompts.
|
|
498
|
+
|
|
499
|
+
### FUT-003 — CRUD Route Matrix
|
|
500
|
+
|
|
501
|
+
Allow per-operation route config:
|
|
502
|
+
|
|
503
|
+
- method
|
|
504
|
+
- path
|
|
505
|
+
- zone
|
|
506
|
+
- auth
|
|
507
|
+
- Bruno yes/no
|
|
508
|
+
|
|
509
|
+
Requires route registry extension before interactive prompts expose it.
|
|
510
|
+
|
|
511
|
+
### FUT-004 — Auth Policies
|
|
512
|
+
|
|
513
|
+
Add route policy support beyond strategy names:
|
|
514
|
+
|
|
515
|
+
- admin
|
|
516
|
+
- roles
|
|
517
|
+
- custom
|
|
518
|
+
|
|
519
|
+
Implemented through registry metadata, `--policy`, CRUD matrix policy overrides, generated auth decorators, docs, and route checks.
|
|
520
|
+
|
|
521
|
+
### FUT-005 — More Storage Adapters
|
|
522
|
+
|
|
523
|
+
Add MySQL/SQLite only after:
|
|
524
|
+
|
|
525
|
+
- dependency resolver support
|
|
526
|
+
- generated config
|
|
527
|
+
- docker/dev story
|
|
528
|
+
- repository templates
|
|
529
|
+
- smoke tests
|
|
530
|
+
|
|
531
|
+
Implemented for MySQL and SQLite through the shared SQL runtime path, dependency resolver, generated config/client files, Docker/dev configuration for MySQL, SQLite env configuration, resource SQL repositories, and smoke generation tests.
|
|
532
|
+
|
|
533
|
+
### FUT-006 — Generated Tests
|
|
534
|
+
|
|
535
|
+
Add unit/integration test generation as a separate epic.
|
|
536
|
+
|
|
537
|
+
Do not include test prompts before the generator can produce compiling tests.
|
|
538
|
+
|
|
539
|
+
Implemented for generated CRUD resources in regular and CQRS modes:
|
|
540
|
+
|
|
541
|
+
- entity specs
|
|
542
|
+
- in-memory repository CRUD specs
|
|
543
|
+
- regular CRUD use-case specs
|
|
544
|
+
- CQRS command/query handler specs
|
|
545
|
+
|
|
546
|
+
Verified with generated project `npm test` for regular and CQRS resources with custom field metadata.
|
|
547
|
+
|
|
548
|
+
### FUT-007 — Git Init And Install
|
|
549
|
+
|
|
550
|
+
Can be added later, but should remain explicit and safe.
|
|
551
|
+
|
|
552
|
+
Implemented as explicit post-create actions:
|
|
553
|
+
|
|
554
|
+
- `--install` runs the selected package manager after files are written.
|
|
555
|
+
- `--skip-install` takes precedence over install.
|
|
556
|
+
- interactive create asks about dependency installation.
|
|
557
|
+
- `--git-init` runs `git init` after files are written.
|
|
558
|
+
- interactive create asks about git init with default `false`.
|
|
559
|
+
- no auto-commit and no push behavior.
|
|
560
|
+
|
|
561
|
+
## Recommended Implementation Order
|
|
562
|
+
|
|
563
|
+
```txt
|
|
564
|
+
1. INT-MVP-001 shared interactive option
|
|
565
|
+
2. INT-MVP-002 prompt adapter
|
|
566
|
+
3. INT-MVP-003 terminal guard
|
|
567
|
+
4. INT-MVP-005 shared conflict policy
|
|
568
|
+
5. INT-MVP-004 input resolvers
|
|
569
|
+
6. INT-MVP-101 create wizard
|
|
570
|
+
7. INT-MVP-102 create summary
|
|
571
|
+
8. INT-MVP-103 create presets
|
|
572
|
+
9. INT-MVP-201 add resource wizard
|
|
573
|
+
10. INT-MVP-202 resource plan summary
|
|
574
|
+
11. INT-MVP-203 add route wizard
|
|
575
|
+
12. INT-MVP-301 generate bruno wizard
|
|
576
|
+
13. INT-MVP-401 remove wizard
|
|
577
|
+
14. INT-MVP-501 resolver tests
|
|
578
|
+
15. INT-MVP-502 prompt/integration tests
|
|
579
|
+
16. INT-MVP-503 interactive docs
|
|
580
|
+
17. FUT-001 contracts capability
|
|
581
|
+
18. FUT-002 resource field metadata
|
|
582
|
+
19. FUT-003 CRUD route matrix
|
|
583
|
+
20. FUT-004 auth policies
|
|
584
|
+
21. FUT-005 more storage adapters
|
|
585
|
+
22. FUT-006 generated tests
|
|
586
|
+
23. FUT-007 git init and install
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## Codex Ticket Prompt
|
|
590
|
+
|
|
591
|
+
```txt
|
|
592
|
+
Implement INT-MVP-XXX from docs/plans/interactive-mode-plan.md.
|
|
593
|
+
|
|
594
|
+
Constraints:
|
|
595
|
+
- Preserve non-interactive behavior.
|
|
596
|
+
- Interactive mode only resolves options; generation stays deterministic.
|
|
597
|
+
- Use the existing .soap config and registry model.
|
|
598
|
+
- Do not expose unsupported future capabilities in prompts.
|
|
599
|
+
- Do not overwrite modified generated files without shared conflict policy.
|
|
600
|
+
- Add focused tests or smoke verification for the implemented behavior.
|
|
601
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@soapjs/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Deterministic project and code generator for SoapJS services.",
|
|
5
|
+
"homepage": "https://docs.soapjs.com",
|
|
6
|
+
"repository": "https://github.com/soapjs/soap-cli",
|
|
7
|
+
"bin": {
|
|
8
|
+
"soap": "./build/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "build/index.js",
|
|
11
|
+
"types": "build/index.d.ts",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=24.17.0"
|
|
15
|
+
},
|
|
16
|
+
"author": "Radoslaw Kamysz <radoslaw.kamysz@gmail.com>",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"clean",
|
|
19
|
+
"architecture",
|
|
20
|
+
"clean architecture",
|
|
21
|
+
"api design",
|
|
22
|
+
"framework",
|
|
23
|
+
"code generation",
|
|
24
|
+
"framework",
|
|
25
|
+
"typescript",
|
|
26
|
+
"microservices",
|
|
27
|
+
"backend",
|
|
28
|
+
"cli"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"clean": "rm -rf ./build",
|
|
32
|
+
"build": "npm run clean && tsc -b && chmod +x ./build/index.js",
|
|
33
|
+
"prepublish": "npm run clean && tsc --project tsconfig.build.json"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@inquirer/prompts": "^3.3.2",
|
|
37
|
+
"change-case": "^4.1.2",
|
|
38
|
+
"commander": "^10.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^24.0.0",
|
|
42
|
+
"typescript": "^4.5.4"
|
|
43
|
+
}
|
|
44
|
+
}
|