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.
- package/.env.example +14 -0
- package/README.md +173 -0
- package/cli/adapters/http.js +72 -0
- package/cli/adapters/mcp.js +193 -0
- package/cli/adapters/openapi.js +160 -0
- package/cli/ask.js +208 -0
- package/cli/config.js +133 -0
- package/cli/executor.js +117 -0
- package/cli/help-json.js +46 -0
- package/cli/mcp-local.js +72 -0
- package/cli/plan-runtime.js +32 -0
- package/cli/planner.js +67 -0
- package/cli/skills.js +240 -0
- package/cli/supercli.js +704 -0
- package/docs/features/adapters.md +25 -0
- package/docs/features/agent-friendly.md +28 -0
- package/docs/features/ask.md +32 -0
- package/docs/features/config-sync.md +22 -0
- package/docs/features/execution-plans.md +25 -0
- package/docs/features/observability.md +22 -0
- package/docs/features/skills.md +25 -0
- package/docs/features/storage.md +25 -0
- package/docs/features/workflows.md +33 -0
- package/docs/initial/AGENTS_FRIENDLY_TOOLS.md +553 -0
- package/docs/initial/agent-friendly.md +447 -0
- package/docs/initial/architecture.md +436 -0
- package/docs/initial/built-in-mcp-server.md +64 -0
- package/docs/initial/command-plan.md +532 -0
- package/docs/initial/core-features-2.md +428 -0
- package/docs/initial/core-features.md +366 -0
- package/docs/initial/dag.md +20 -0
- package/docs/initial/description.txt +9 -0
- package/docs/initial/idea.txt +564 -0
- package/docs/initial/initial-spec-details.md +726 -0
- package/docs/initial/initial-spec.md +731 -0
- package/docs/initial/mcp-local-mode.md +53 -0
- package/docs/initial/mcp-sse-mode.md +54 -0
- package/docs/initial/skills-support.md +246 -0
- package/docs/initial/storage-adapter-example.md +155 -0
- package/docs/initial/supercli-vs-gwc.md +109 -0
- package/examples/mcp-sse/install-demo.js +86 -0
- package/examples/mcp-sse/server.js +81 -0
- package/examples/mcp-stdio/install-demo.js +78 -0
- package/examples/mcp-stdio/server.js +50 -0
- package/package.json +21 -0
- package/server/app.js +59 -0
- package/server/public/app.js +18 -0
- package/server/routes/ask.js +92 -0
- package/server/routes/commands.js +126 -0
- package/server/routes/config.js +58 -0
- package/server/routes/jobs.js +122 -0
- package/server/routes/mcp.js +79 -0
- package/server/routes/plans.js +134 -0
- package/server/routes/specs.js +79 -0
- package/server/services/configService.js +88 -0
- package/server/storage/adapter.js +32 -0
- package/server/storage/file.js +64 -0
- package/server/storage/mongo.js +55 -0
- package/server/views/command-edit.ejs +110 -0
- package/server/views/commands.ejs +49 -0
- package/server/views/jobs.ejs +72 -0
- package/server/views/layout.ejs +42 -0
- package/server/views/mcp.ejs +80 -0
- package/server/views/partials/foot.ejs +5 -0
- package/server/views/partials/head.ejs +27 -0
- package/server/views/specs.ejs +91 -0
- package/tests/test-cli.js +367 -0
- package/tests/test-mcp.js +189 -0
- package/tests/test-openapi.js +101 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
Your principles are **very solid** and actually align almost perfectly with what an **AI-native CLI runtime** like SUPERCLI should be. The interesting part is that because SUPERCLI is **config-driven**, you can enforce many of these principles **at the platform level**, not per command.
|
|
2
|
+
|
|
3
|
+
That is the real power: **tool authors cannot accidentally break agent-friendliness**.
|
|
4
|
+
|
|
5
|
+
Below is how I would **translate your philosophy into concrete SUPERCLI architecture rules**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 1. Make “Agent Mode” the Default
|
|
10
|
+
|
|
11
|
+
Instead of:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
human mode default
|
|
15
|
+
--json for agents
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Flip the model.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
machine mode default
|
|
22
|
+
--human for pretty output
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
So execution:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
supercli referential users fetch --id 42
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
returns:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"version": "1.0",
|
|
36
|
+
"command": "referential.users.fetch",
|
|
37
|
+
"data": {
|
|
38
|
+
"id": 42,
|
|
39
|
+
"name": "Alice"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Human-friendly view:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
supercli referential users fetch --id 42 --human
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Output:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
User
|
|
54
|
+
ID: 42
|
|
55
|
+
Name: Alice
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This aligns SUPERCLI with **agent-first tooling**.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
# 2. Make Output Schemas Part of the Command Spec
|
|
63
|
+
|
|
64
|
+
Your DB command schema should include **output schema**.
|
|
65
|
+
|
|
66
|
+
Example command:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"namespace": "referential",
|
|
71
|
+
"resource": "users",
|
|
72
|
+
"action": "fetch",
|
|
73
|
+
|
|
74
|
+
"adapter": "openapi",
|
|
75
|
+
|
|
76
|
+
"args": [
|
|
77
|
+
{"name":"id","type":"string","required":true}
|
|
78
|
+
],
|
|
79
|
+
|
|
80
|
+
"output": {
|
|
81
|
+
"version": "1.0",
|
|
82
|
+
"schema": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"properties": {
|
|
85
|
+
"id": {"type":"string"},
|
|
86
|
+
"name": {"type":"string"},
|
|
87
|
+
"email": {"type":"string"}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Benefits:
|
|
95
|
+
|
|
96
|
+
Agents can query:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
supercli schema referential users fetch
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Response:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"input_schema": {...},
|
|
107
|
+
"output_schema": {...}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This is **extremely powerful for tool planning**.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
# 3. Enforce Semantic Exit Codes Globally
|
|
116
|
+
|
|
117
|
+
SUPERCLI runtime should **normalize exit codes**.
|
|
118
|
+
|
|
119
|
+
Adapters return structured errors:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"type": "resource_not_found",
|
|
124
|
+
"message": "User 42 not found"
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The runtime maps:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
resource_not_found → exit 92
|
|
132
|
+
validation_error → exit 82
|
|
133
|
+
timeout → exit 105
|
|
134
|
+
internal_error → exit 110
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
So adapters never decide exit codes.
|
|
138
|
+
|
|
139
|
+
The **platform does**.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
# 4. Built-in Structured Error Format
|
|
144
|
+
|
|
145
|
+
All failures return the same envelope.
|
|
146
|
+
|
|
147
|
+
Example:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"error": {
|
|
152
|
+
"code": 92,
|
|
153
|
+
"type": "resource_not_found",
|
|
154
|
+
"message": "User not found",
|
|
155
|
+
"recoverable": false,
|
|
156
|
+
"suggestions": [
|
|
157
|
+
"Run: supercli referential users list"
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
stderr:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
resource_not_found: User not found
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Agents parse JSON.
|
|
170
|
+
|
|
171
|
+
Humans read stderr.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
# 5. SUPERCLI Should Provide Tool Introspection
|
|
176
|
+
|
|
177
|
+
Add built-in commands:
|
|
178
|
+
|
|
179
|
+
### list commands
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
supercli commands --json
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### inspect command
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
supercli inspect referential users fetch
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Example:
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"command": "referential.users.fetch",
|
|
196
|
+
"description": "Fetch user",
|
|
197
|
+
"args": [
|
|
198
|
+
{"name":"id","type":"string","required":true}
|
|
199
|
+
],
|
|
200
|
+
"output_schema": {...},
|
|
201
|
+
"adapter": "openapi"
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Agents can explore the system.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
# 6. Add a Native Tool API
|
|
210
|
+
|
|
211
|
+
SUPERCLI server should expose:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
GET /api/tools
|
|
215
|
+
POST /api/tools/execute
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
This instantly makes SUPERCLI compatible with:
|
|
219
|
+
|
|
220
|
+
* OpenAI API tools
|
|
221
|
+
* Model Context Protocol
|
|
222
|
+
* LangChain
|
|
223
|
+
|
|
224
|
+
So the **CLI and agent tools share the same backend**.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
# 7. Deterministic Command Output Envelope
|
|
229
|
+
|
|
230
|
+
Every command returns the same envelope.
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"version": "1.0",
|
|
235
|
+
"command": "referential.users.fetch",
|
|
236
|
+
"duration_ms": 42,
|
|
237
|
+
"data": {...}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Benefits:
|
|
242
|
+
|
|
243
|
+
Agents always know where data lives.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
# 8. Streaming Mode for Long Operations
|
|
248
|
+
|
|
249
|
+
Support **JSON Lines streaming**.
|
|
250
|
+
|
|
251
|
+
Example:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
supercli infra deploy service --stream
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
stdout:
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
{"event":"start"}
|
|
261
|
+
{"event":"build_complete"}
|
|
262
|
+
{"event":"deploy_started"}
|
|
263
|
+
{"event":"deploy_complete"}
|
|
264
|
+
{"event":"result","data":{...}}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
stderr:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
Deploying service...
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Agents can process events.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
# 9. Command Capability Discovery
|
|
278
|
+
|
|
279
|
+
Add a discovery endpoint:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
supercli capabilities
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Example:
|
|
286
|
+
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"commands": 120,
|
|
290
|
+
"namespaces": ["referential","infra","ai"],
|
|
291
|
+
"output_formats": ["json","human"],
|
|
292
|
+
"protocols": ["cli","http","mcp"]
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Useful for agents.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
# 10. Automatic Agent-Friendly Behavior
|
|
301
|
+
|
|
302
|
+
SUPERCLI runtime automatically:
|
|
303
|
+
|
|
304
|
+
### disables colors
|
|
305
|
+
|
|
306
|
+
If:
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
stdout not TTY
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### disables interactive prompts
|
|
313
|
+
|
|
314
|
+
If:
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
CI=true
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### enables JSON
|
|
321
|
+
|
|
322
|
+
If:
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
stdout not TTY
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
This avoids needing many flags.
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
# 11. Pipe-Friendly Design
|
|
333
|
+
|
|
334
|
+
Commands should accept stdin.
|
|
335
|
+
|
|
336
|
+
Example:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
echo '{"id":42}' | supercli referential users fetch
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
SUPERCLI maps stdin to args.
|
|
343
|
+
|
|
344
|
+
This makes pipelines extremely powerful.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
# 12. Built-in Command Composition
|
|
349
|
+
|
|
350
|
+
Example:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
supercli referential users list --json \
|
|
354
|
+
| jq '.data[].id' \
|
|
355
|
+
| xargs -I {} supercli referential users fetch --id {}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Because output is deterministic, pipelines work perfectly.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
# 13. Token Optimization Trick (Important)
|
|
363
|
+
|
|
364
|
+
Agents pay for tokens.
|
|
365
|
+
|
|
366
|
+
So SUPERCLI should support:
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
--compact
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Example output:
|
|
373
|
+
|
|
374
|
+
```json
|
|
375
|
+
{"v":"1","c":"referential.users.fetch","d":{"id":42,"n":"Alice"}}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Fields compressed.
|
|
379
|
+
|
|
380
|
+
This reduces token usage drastically.
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
# 14. Self-Describing CLI
|
|
385
|
+
|
|
386
|
+
Agents can run:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
supercli help --json
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
Example:
|
|
393
|
+
|
|
394
|
+
```json
|
|
395
|
+
{
|
|
396
|
+
"version":"1.0",
|
|
397
|
+
"namespaces":[
|
|
398
|
+
{
|
|
399
|
+
"name":"referential",
|
|
400
|
+
"resources":[
|
|
401
|
+
{
|
|
402
|
+
"name":"users",
|
|
403
|
+
"actions":["fetch","list","create"]
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Agents can explore the CLI automatically.
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
# 15. The Big Result
|
|
416
|
+
|
|
417
|
+
If you implement these ideas, SUPERCLI becomes something very rare:
|
|
418
|
+
|
|
419
|
+
A CLI that is simultaneously:
|
|
420
|
+
|
|
421
|
+
```
|
|
422
|
+
human friendly
|
|
423
|
+
automation friendly
|
|
424
|
+
AI agent friendly
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
Few CLIs achieve this.
|
|
428
|
+
|
|
429
|
+
Most tools only target **one of these audiences**.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
✅ **Key insight for your architecture**
|
|
434
|
+
|
|
435
|
+
Because SUPERCLI is **config-driven**, these principles can be:
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
enforced automatically
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Meaning every command added to the platform becomes **agent-safe by default**.
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
If you want, I can also show you **one extremely powerful feature that would make SUPERCLI probably the best AI-native CLI architecture:**
|
|
446
|
+
|
|
447
|
+
**"Command Plans" — where an LLM can request a plan and the CLI returns a safe execution graph before running anything.**
|