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,428 @@
1
+ The idea that really changes the nature of the project is to treat **commands as a control plane resource**, similar to how Kubernetes treats pods, services, and deployments.
2
+
3
+ Instead of “a CLI that runs commands”, you get:
4
+
5
+ **A distributed command runtime where the CLI is just one client.**
6
+
7
+ That turns SUPERCLI into something closer to a **“Kubernetes for commands / tools / APIs / AI”**.
8
+
9
+ ---
10
+
11
+ # 1. Core Shift: Commands Become Resources
12
+
13
+ Instead of thinking:
14
+
15
+ ```
16
+ CLI command
17
+ ```
18
+
19
+ Think:
20
+
21
+ ```
22
+ Command Resource
23
+ ```
24
+
25
+ Similar to:
26
+
27
+ * Deployment
28
+ * Service
29
+ * Job
30
+
31
+ Example resource:
32
+
33
+ ```
34
+ Command
35
+ ```
36
+
37
+ Example definition:
38
+
39
+ ```yaml
40
+ kind: Command
41
+ metadata:
42
+ name: users.fetch
43
+ spec:
44
+ namespace: referential
45
+ resource: users
46
+ action: fetch
47
+
48
+ adapter: openapi
49
+
50
+ adapterConfig:
51
+ spec: referential-api
52
+ operationId: getUser
53
+ ```
54
+
55
+ The CLI just **invokes resources**.
56
+
57
+ ---
58
+
59
+ # 2. Introduce “Command Jobs”
60
+
61
+ Every execution becomes a **job**.
62
+
63
+ Example:
64
+
65
+ ```
66
+ supercli referential users fetch --id 42
67
+ ```
68
+
69
+ Creates:
70
+
71
+ ```
72
+ CommandJob
73
+ ```
74
+
75
+ Example record:
76
+
77
+ ```json
78
+ {
79
+ "id": "job_9821",
80
+ "command": "referential.users.fetch",
81
+ "args": { "id": 42 },
82
+ "status": "running",
83
+ "createdAt": "...",
84
+ "result": null
85
+ }
86
+ ```
87
+
88
+ Stored in Mongo.
89
+
90
+ This allows:
91
+
92
+ * retries
93
+ * observability
94
+ * async execution
95
+ * distributed runners
96
+
97
+ ---
98
+
99
+ # 3. Introduce Runners
100
+
101
+ Instead of executing commands **inside the CLI**, you can have **runners**.
102
+
103
+ Architecture:
104
+
105
+ ```
106
+ CLI
107
+ |
108
+ API
109
+ |
110
+ Job Queue
111
+ |
112
+ Runners
113
+ ```
114
+
115
+ Runners execute commands.
116
+
117
+ Example runner types:
118
+
119
+ ```
120
+ http-runner
121
+ mcp-runner
122
+ infra-runner
123
+ ai-runner
124
+ ```
125
+
126
+ This enables:
127
+
128
+ ```
129
+ distributed command execution
130
+ ```
131
+
132
+ ---
133
+
134
+ # 4. Command Events
135
+
136
+ Each command produces events.
137
+
138
+ Example:
139
+
140
+ ```
141
+ CommandStarted
142
+ CommandFinished
143
+ CommandFailed
144
+ ```
145
+
146
+ These can be streamed.
147
+
148
+ Architecture:
149
+
150
+ ```
151
+ CLI
152
+ |
153
+ API
154
+ |
155
+ Event Bus
156
+ |
157
+ Subscribers
158
+ ```
159
+
160
+ Use cases:
161
+
162
+ * dashboards
163
+ * audit logs
164
+ * automation
165
+
166
+ ---
167
+
168
+ # 5. Command Pipelines
169
+
170
+ Commands can subscribe to events.
171
+
172
+ Example:
173
+
174
+ ```
175
+ user.created
176
+ ```
177
+
178
+ Triggers:
179
+
180
+ ```
181
+ billing.createCustomer
182
+ email.sendWelcome
183
+ ```
184
+
185
+ This turns the system into a **light automation platform**.
186
+
187
+ ---
188
+
189
+ # 6. Multi-Client Interface
190
+
191
+ Once commands are resources, multiple interfaces become possible.
192
+
193
+ Clients:
194
+
195
+ ```
196
+ CLI
197
+ Web UI
198
+ API
199
+ Agents
200
+ ```
201
+
202
+ AI agents could call commands like tools.
203
+
204
+ Example agent toolset:
205
+
206
+ ```
207
+ referential.users.fetch
208
+ infra.service.deploy
209
+ billing.invoice.create
210
+ ```
211
+
212
+ This makes SUPERCLI a **tool registry for agents**.
213
+
214
+ ---
215
+
216
+ # 7. Command Permissions
217
+
218
+ Once commands are resources, you can add RBAC.
219
+
220
+ Example:
221
+
222
+ ```
223
+ role: dev
224
+ allowed:
225
+ - referential.users.*
226
+ - infra.service.deploy
227
+ ```
228
+
229
+ ---
230
+
231
+ # 8. Command Versioning
232
+
233
+ Commands can evolve.
234
+
235
+ Example:
236
+
237
+ ```
238
+ referential.users.fetch:v1
239
+ referential.users.fetch:v2
240
+ ```
241
+
242
+ This solves a classic CLI problem:
243
+
244
+ ```
245
+ breaking changes
246
+ ```
247
+
248
+ ---
249
+
250
+ # 9. Observability
251
+
252
+ Because commands become jobs, you can track:
253
+
254
+ ```
255
+ execution time
256
+ failure rate
257
+ usage
258
+ ```
259
+
260
+ Example dashboard:
261
+
262
+ ```
263
+ Top commands
264
+ Failed commands
265
+ Slow commands
266
+ ```
267
+
268
+ This is something traditional CLIs lack.
269
+
270
+ ---
271
+
272
+ # 10. Command Graph Visualization
273
+
274
+ The Web UI could show command relationships.
275
+
276
+ Example:
277
+
278
+ ```
279
+ infra.service.deploy
280
+ ├ build
281
+ ├ push
282
+ ├ deploy
283
+ └ verify
284
+ ```
285
+
286
+ This helps teams understand automation.
287
+
288
+ ---
289
+
290
+ # 11. AI Agents as Runners
291
+
292
+ An interesting extension:
293
+
294
+ ```
295
+ runner: ai-agent
296
+ ```
297
+
298
+ Example command:
299
+
300
+ ```
301
+ analysis.repository.audit
302
+ ```
303
+
304
+ Runner:
305
+
306
+ ```
307
+ LLM agent
308
+ ```
309
+
310
+ This integrates AI tasks into the same execution plane.
311
+
312
+ ---
313
+
314
+ # 12. Real Architecture
315
+
316
+ System becomes:
317
+
318
+ ```
319
+ +------------------+
320
+ | Web UI |
321
+ +---------+--------+
322
+ |
323
+ v
324
+ Control Plane
325
+ (NodeJS)
326
+ |
327
+ +--------------+-------------+
328
+ | |
329
+ v v
330
+ Command DB Command Jobs
331
+ MongoDB MongoDB
332
+ | |
333
+ +-------------+--------------+
334
+ |
335
+ Event Stream
336
+ |
337
+ +--------+--------+
338
+ | |
339
+ v v
340
+ Runners CLI
341
+ ```
342
+
343
+ ---
344
+
345
+ # 13. Why This Is a New Category
346
+
347
+ Most tools only solve one layer:
348
+
349
+ | Tool | Capability |
350
+ | -------------- | ------------ |
351
+ | Terraform | infra |
352
+ | Postman | APIs |
353
+ | LangChain | AI tools |
354
+ | GitHub Actions | CI pipelines |
355
+
356
+ SUPERCLI could unify:
357
+
358
+ ```
359
+ APIs
360
+ AI tools
361
+ infra
362
+ automation
363
+ ```
364
+
365
+ Under one runtime.
366
+
367
+ ---
368
+
369
+ # 14. The Simplest Killer Demo
370
+
371
+ A single project could show the power.
372
+
373
+ ```
374
+ supercli import-openapi stripe.json
375
+ ```
376
+
377
+ Now the CLI instantly supports:
378
+
379
+ ```
380
+ supercli stripe customers list
381
+ supercli stripe charges create
382
+ ```
383
+
384
+ Then:
385
+
386
+ ```
387
+ supercli workflow create-customer
388
+ ```
389
+
390
+ Pipeline:
391
+
392
+ ```
393
+ stripe.customer.create
394
+ email.send
395
+ crm.contact.create
396
+ ```
397
+
398
+ Then:
399
+
400
+ ```
401
+ supercli ask "create a customer for john@example.com"
402
+ ```
403
+
404
+ And the system routes to commands.
405
+
406
+ That demo alone would communicate the idea extremely well.
407
+
408
+ ---
409
+
410
+ # 15. Strategic Insight
411
+
412
+ The real value isn't the CLI.
413
+
414
+ The value is:
415
+
416
+ ```
417
+ a control plane for tools
418
+ ```
419
+
420
+ Which could eventually become:
421
+
422
+ ```
423
+ a universal execution layer for humans and agents
424
+ ```
425
+
426
+ ---
427
+
428
+ If you're interested, the next thing worth designing is the **single architectural trick that would let this scale to thousands of commands without the CLI becoming slow or bloated**.