superacli 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 (69) hide show
  1. package/.env.example +14 -0
  2. package/README.md +173 -0
  3. package/cli/adapters/http.js +72 -0
  4. package/cli/adapters/mcp.js +193 -0
  5. package/cli/adapters/openapi.js +160 -0
  6. package/cli/ask.js +208 -0
  7. package/cli/config.js +133 -0
  8. package/cli/executor.js +117 -0
  9. package/cli/help-json.js +46 -0
  10. package/cli/mcp-local.js +72 -0
  11. package/cli/plan-runtime.js +32 -0
  12. package/cli/planner.js +67 -0
  13. package/cli/skills.js +240 -0
  14. package/cli/supercli.js +704 -0
  15. package/docs/features/adapters.md +25 -0
  16. package/docs/features/agent-friendly.md +28 -0
  17. package/docs/features/ask.md +32 -0
  18. package/docs/features/config-sync.md +22 -0
  19. package/docs/features/execution-plans.md +25 -0
  20. package/docs/features/observability.md +22 -0
  21. package/docs/features/skills.md +25 -0
  22. package/docs/features/storage.md +25 -0
  23. package/docs/features/workflows.md +33 -0
  24. package/docs/initial/AGENTS_FRIENDLY_TOOLS.md +553 -0
  25. package/docs/initial/agent-friendly.md +447 -0
  26. package/docs/initial/architecture.md +436 -0
  27. package/docs/initial/built-in-mcp-server.md +64 -0
  28. package/docs/initial/command-plan.md +532 -0
  29. package/docs/initial/core-features-2.md +428 -0
  30. package/docs/initial/core-features.md +366 -0
  31. package/docs/initial/dag.md +20 -0
  32. package/docs/initial/description.txt +9 -0
  33. package/docs/initial/idea.txt +564 -0
  34. package/docs/initial/initial-spec-details.md +726 -0
  35. package/docs/initial/initial-spec.md +731 -0
  36. package/docs/initial/mcp-local-mode.md +53 -0
  37. package/docs/initial/mcp-sse-mode.md +54 -0
  38. package/docs/initial/skills-support.md +246 -0
  39. package/docs/initial/storage-adapter-example.md +155 -0
  40. package/docs/initial/supercli-vs-gwc.md +109 -0
  41. package/examples/mcp-sse/install-demo.js +86 -0
  42. package/examples/mcp-sse/server.js +81 -0
  43. package/examples/mcp-stdio/install-demo.js +78 -0
  44. package/examples/mcp-stdio/server.js +50 -0
  45. package/package.json +21 -0
  46. package/server/app.js +59 -0
  47. package/server/public/app.js +18 -0
  48. package/server/routes/ask.js +92 -0
  49. package/server/routes/commands.js +126 -0
  50. package/server/routes/config.js +58 -0
  51. package/server/routes/jobs.js +122 -0
  52. package/server/routes/mcp.js +79 -0
  53. package/server/routes/plans.js +134 -0
  54. package/server/routes/specs.js +79 -0
  55. package/server/services/configService.js +88 -0
  56. package/server/storage/adapter.js +32 -0
  57. package/server/storage/file.js +64 -0
  58. package/server/storage/mongo.js +55 -0
  59. package/server/views/command-edit.ejs +110 -0
  60. package/server/views/commands.ejs +49 -0
  61. package/server/views/jobs.ejs +72 -0
  62. package/server/views/layout.ejs +42 -0
  63. package/server/views/mcp.ejs +80 -0
  64. package/server/views/partials/foot.ejs +5 -0
  65. package/server/views/partials/head.ejs +27 -0
  66. package/server/views/specs.ejs +91 -0
  67. package/tests/test-cli.js +367 -0
  68. package/tests/test-mcp.js +189 -0
  69. package/tests/test-openapi.js +101 -0
@@ -0,0 +1,564 @@
1
+
2
+ HUMAN:
3
+ Brainstorm with me: A dynamic CLI what defines itself based on a cloud configuration and support multiple OPENAPI specs, MCP servers and custom integrations
4
+
5
+ Example:
6
+
7
+ "supercli referential users fetch" => fetch users
8
+
9
+ Flow:
10
+
11
+ checks config locally TTL cache
12
+ fetch config from cloud
13
+
14
+ AI:
15
+ You’re essentially describing a **cloud-defined CLI runtime**.
16
+ The CLI itself is just a **thin execution engine**, while **commands are dynamically materialized from configuration** that maps to APIs, MCP tools, or integrations.
17
+
18
+ Below is a structured brainstorming.
19
+
20
+ ---
21
+
22
+ # 1. Mental Model
23
+
24
+ Think of it as:
25
+
26
+ **CLI = runtime + interpreter for a command graph**
27
+
28
+ The cloud config defines:
29
+
30
+ * namespaces
31
+ * commands
32
+ * arguments
33
+ * bindings to execution backends
34
+
35
+ Example command:
36
+
37
+ ```
38
+ supercli referential users fetch --id 42
39
+ ```
40
+
41
+ Internally resolves to something like:
42
+
43
+ ```
44
+ namespace: referential
45
+ resource: users
46
+ action: fetch
47
+ ```
48
+
49
+ Which maps to an execution adapter:
50
+
51
+ ```
52
+ adapter: openapi
53
+ spec: referential-api
54
+ operationId: getUser
55
+ ```
56
+
57
+ ---
58
+
59
+ # 2. Core Components
60
+
61
+ ### 1️⃣ CLI Runtime
62
+
63
+ Responsibilities:
64
+
65
+ * parse commands
66
+ * resolve config
67
+ * route execution
68
+ * handle auth
69
+ * render output
70
+
71
+ Think:
72
+
73
+ ```
74
+ supercli
75
+ ├── parser
76
+ ├── config-loader
77
+ ├── executor
78
+ └── adapters
79
+ ```
80
+
81
+ ---
82
+
83
+ ### 2️⃣ Cloud Command Registry
84
+
85
+ A **central configuration service** describing commands.
86
+
87
+ Example config:
88
+
89
+ ```yaml
90
+ namespaces:
91
+ referential:
92
+ users:
93
+ fetch:
94
+ adapter: openapi
95
+ spec: referential-api
96
+ operationId: getUser
97
+ list:
98
+ adapter: openapi
99
+ spec: referential-api
100
+ operationId: listUsers
101
+
102
+ ai:
103
+ summarize:
104
+ adapter: mcp
105
+ server: ai-tools
106
+ tool: summarize
107
+ ```
108
+
109
+ ---
110
+
111
+ ### 3️⃣ Adapter Layer
112
+
113
+ Each backend type has a runtime adapter.
114
+
115
+ Adapters:
116
+
117
+ ```
118
+ openapi
119
+ mcp
120
+ http
121
+ graphql
122
+ custom-js
123
+ shell
124
+ grpc
125
+ ```
126
+
127
+ Interface:
128
+
129
+ ```
130
+ execute(command, args, context)
131
+ ```
132
+
133
+ ---
134
+
135
+ # 3. Command Resolution Pipeline
136
+
137
+ Example:
138
+
139
+ ```
140
+ supercli referential users fetch --id 12
141
+ ```
142
+
143
+ Pipeline:
144
+
145
+ 1️⃣ Parse command
146
+
147
+ ```
148
+ ["referential", "users", "fetch"]
149
+ ```
150
+
151
+ 2️⃣ Load cached config
152
+
153
+ ```
154
+ ~/.supercli/cache/config.json
155
+ ```
156
+
157
+ 3️⃣ TTL expired?
158
+
159
+ ```
160
+ yes → fetch cloud config
161
+ no → use local
162
+ ```
163
+
164
+ 4️⃣ Resolve command
165
+
166
+ ```
167
+ referential.users.fetch
168
+ ```
169
+
170
+ 5️⃣ Select adapter
171
+
172
+ ```
173
+ openapi
174
+ ```
175
+
176
+ 6️⃣ Execute
177
+
178
+ ```
179
+ operationId=getUser
180
+ ```
181
+
182
+ ---
183
+
184
+ # 4. Local Cache Strategy
185
+
186
+ Cache file:
187
+
188
+ ```
189
+ ~/.supercli/config-cache.json
190
+ ```
191
+
192
+ Example metadata:
193
+
194
+ ```
195
+ {
196
+ "version": "d81a9c",
197
+ "ttl": 3600,
198
+ "fetched_at": 171000000
199
+ }
200
+ ```
201
+
202
+ Startup flow:
203
+
204
+ ```
205
+ if cache.valid():
206
+ use cache
207
+ else:
208
+ fetch cloud config
209
+ ```
210
+
211
+ Optional:
212
+
213
+ ```
214
+ supercli config refresh
215
+ ```
216
+
217
+ ---
218
+
219
+ # 5. OPENAPI Integration
220
+
221
+ When registering a spec:
222
+
223
+ ```
224
+ specs:
225
+ referential-api:
226
+ type: openapi
227
+ url: https://api.company.com/openapi.json
228
+ ```
229
+
230
+ CLI dynamically maps operations:
231
+
232
+ Example mapping:
233
+
234
+ ```
235
+ referential users fetch -> GET /users/{id}
236
+ referential users list -> GET /users
237
+ ```
238
+
239
+ Arguments inferred from:
240
+
241
+ ```
242
+ parameters
243
+ requestBody
244
+ ```
245
+
246
+ So the CLI can auto-generate:
247
+
248
+ ```
249
+ --id
250
+ --limit
251
+ --offset
252
+ ```
253
+
254
+ ---
255
+
256
+ # 6. MCP Server Integration
257
+
258
+ Config:
259
+
260
+ ```
261
+ mcp_servers:
262
+ ai-tools:
263
+ url: https://mcp.company.com
264
+ ```
265
+
266
+ Command:
267
+
268
+ ```
269
+ ai summarize
270
+ ```
271
+
272
+ Mapping:
273
+
274
+ ```
275
+ tool: summarize
276
+ ```
277
+
278
+ Execution:
279
+
280
+ ```
281
+ call MCP tool
282
+ ```
283
+
284
+ ---
285
+
286
+ # 7. Custom Integration Example
287
+
288
+ Example adapter:
289
+
290
+ ```
291
+ adapter: shell
292
+ command: terraform
293
+ args:
294
+ - apply
295
+ ```
296
+
297
+ Or:
298
+
299
+ ```
300
+ adapter: node
301
+ handler: deployLambda
302
+ ```
303
+
304
+ ---
305
+
306
+ # 8. Plugin System
307
+
308
+ Allow extensions:
309
+
310
+ ```
311
+ ~/.supercli/plugins/
312
+ ```
313
+
314
+ Plugin registers:
315
+
316
+ ```
317
+ adapter
318
+ middleware
319
+ auth provider
320
+ output formatter
321
+ ```
322
+
323
+ ---
324
+
325
+ # 9. Smart CLI UX
326
+
327
+ Dynamic help:
328
+
329
+ ```
330
+ supercli
331
+ ```
332
+
333
+ Output:
334
+
335
+ ```
336
+ Available namespaces:
337
+
338
+ referential
339
+ ai
340
+ billing
341
+ infra
342
+ ```
343
+
344
+ Then:
345
+
346
+ ```
347
+ supercli referential
348
+ ```
349
+
350
+ Output:
351
+
352
+ ```
353
+ users
354
+ groups
355
+ permissions
356
+ ```
357
+
358
+ Then:
359
+
360
+ ```
361
+ supercli referential users
362
+ ```
363
+
364
+ Output:
365
+
366
+ ```
367
+ fetch
368
+ list
369
+ create
370
+ delete
371
+ ```
372
+
373
+ Everything **generated from config**.
374
+
375
+ ---
376
+
377
+ # 10. Authentication Model
378
+
379
+ Auth providers:
380
+
381
+ ```
382
+ oauth
383
+ apiKey
384
+ jwt
385
+ aws-sigv4
386
+ ```
387
+
388
+ Config example:
389
+
390
+ ```
391
+ auth:
392
+ provider: oauth
393
+ token_url: https://auth.company.com/token
394
+ ```
395
+
396
+ Stored locally:
397
+
398
+ ```
399
+ ~/.supercli/credentials
400
+ ```
401
+
402
+ ---
403
+
404
+ # 11. Output Formatting
405
+
406
+ Support:
407
+
408
+ ```
409
+ --json
410
+ --yaml
411
+ --table
412
+ --raw
413
+ ```
414
+
415
+ Example:
416
+
417
+ ```
418
+ supercli referential users list --table
419
+ ```
420
+
421
+ ---
422
+
423
+ # 12. Interesting Advanced Features
424
+
425
+ ### Command Graph
426
+
427
+ Allow:
428
+
429
+ ```
430
+ supercli run workflow.yaml
431
+ ```
432
+
433
+ Example:
434
+
435
+ ```
436
+ steps:
437
+ - referential.users.fetch
438
+ - ai.summarize
439
+ ```
440
+
441
+ ---
442
+
443
+ ### AI Assisted CLI
444
+
445
+ ```
446
+ supercli ask "fetch user 42 and summarize activity"
447
+ ```
448
+
449
+ LLM maps to:
450
+
451
+ ```
452
+ referential.users.fetch
453
+ ai.summarize
454
+ ```
455
+
456
+ ---
457
+
458
+ ### Auto-generated SDK
459
+
460
+ Same config could generate:
461
+
462
+ ```
463
+ CLI
464
+ SDK
465
+ Docs
466
+ ```
467
+
468
+ ---
469
+
470
+ # 13. Real Value
471
+
472
+ This becomes:
473
+
474
+ **“Postman + CLI + API gateway + MCP router”**
475
+
476
+ But **cloud-driven**.
477
+
478
+ Use cases:
479
+
480
+ * internal platform engineering
481
+ * developer portals
482
+ * infra automation
483
+ * AI tool orchestration
484
+
485
+ ---
486
+
487
+ # 14. Name Ideas
488
+
489
+ If productized:
490
+
491
+ ```
492
+ SUPERCLI
493
+ CommandMesh
494
+ Clousupercli
495
+ OpenCommand
496
+ CmdFabric
497
+ ControlPlane CLI
498
+ ```
499
+
500
+ ---
501
+
502
+ # 15. Interesting Architectural Twist
503
+
504
+ Instead of commands being static:
505
+
506
+ **commands are nodes in a graph**
507
+
508
+ Example:
509
+
510
+ ```
511
+ referential.users.fetch
512
+ ```
513
+
514
+ is actually:
515
+
516
+ ```
517
+ namespace/resource/action
518
+ ```
519
+
520
+ Meaning you could also support:
521
+
522
+ ```
523
+ supercli referential.users.fetch
524
+ ```
525
+
526
+ or
527
+
528
+ ```
529
+ supercli run referential.users.fetch
530
+ ```
531
+
532
+ ---
533
+
534
+ # 16. Killer Feature
535
+
536
+ One idea that makes it **really powerful**:
537
+
538
+ **commands can compose other commands**
539
+
540
+ Example:
541
+
542
+ ```
543
+ deploy service
544
+ ```
545
+
546
+ Internally runs:
547
+
548
+ ```
549
+ infra.build
550
+ infra.push
551
+ infra.deploy
552
+ infra.verify
553
+ ```
554
+
555
+ ---
556
+
557
+ 💡 My take:
558
+ If you add **OpenAPI + MCP + workflows**, this becomes a **universal operational CLI for AI-era infrastructure**.
559
+
560
+ Which is actually a **very strong developer tool category**.
561
+
562
+ ---
563
+
564
+ If you want, I can also show you a **clean architecture for implementing this in ~2k LOC (Go or Node)** that would make a **very powerful POC quickly.**