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,25 @@
|
|
|
1
|
+
# Adapters Integration
|
|
2
|
+
|
|
3
|
+
SUPERCLI acts as a universal frontend proxy that translates semantic commands (e.g., `aws instances list`) into specific backend protocol requests via adapters.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **HTTP Adapter**: Directly invokes external REST APIs with configured methods, headers, and interpolated path/query parameters.
|
|
8
|
+
- **OpenAPI Adapter**: Given a registered OpenAPI spec URL, maps a SUPERCLI command dynamically to an OpenAPI operation, handling auth and schema resolution on the fly.
|
|
9
|
+
- **MCP Adapter (Model Context Protocol)**: Connects to local or remote MCP servers to trigger their exposed tools. Supports both standard HTTP/SSE connections and spinning up local `stdio` child process execution (like `node server.js`).
|
|
10
|
+
- **Local MCP Registry**: Decouples MCP tool integration from the backend server by maintaining a local `.supercli_cache.json` registry for fast integration.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# The adapter is chosen when commands are bound. For example MCP management:
|
|
16
|
+
|
|
17
|
+
# List offline/local MCP servers registered in the config
|
|
18
|
+
supercli mcp list
|
|
19
|
+
|
|
20
|
+
# Add an offline local MCP stdio server
|
|
21
|
+
supercli mcp add summarize-local --url http://127.0.0.1:8787
|
|
22
|
+
|
|
23
|
+
# Execute an MCP tool via the bound alias
|
|
24
|
+
supercli ai text summarize --text "Hello world"
|
|
25
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Agent-Friendly Tooling
|
|
2
|
+
|
|
3
|
+
SUPERCLI is designed from the ground up to be frictionless for AI agents to discover, understand, and interact with infrastructure.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Machine-Readable Discovery (`--help-json`)**: Emits the entire capability tree of the CLI in a single nested JSON object, allowing agents to ingest all available namespaces, resources, and actions at once.
|
|
8
|
+
- **Input/Output Schemas (`--schema`)**: Returns JSON schemas for command arguments and expected outputs, giving agents strict contracts.
|
|
9
|
+
- **Token Optimization (`--compact`)**: Compresses verbose JSON payload keys into short aliases (e.g., `namespace` -> `ns`) to save on LLM context windows.
|
|
10
|
+
- **Automatic JSON Envelope (`--json`)**: Wraps all output (success or failure) in a deterministic envelope with metadata like duration and execution command.
|
|
11
|
+
- **Smart Piped Input**: Automatically detects if data is piped via `stdin` and parses JSON into command arguments seamlessly (perfect for chaining workflows).
|
|
12
|
+
- **Separation of Concerns**: Informational logs or human-readable warnings go to `stderr`, while pure data goes to `stdout`, keeping pure JSON piping safe.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Get all available commands formatted for agents
|
|
18
|
+
supercli --help-json
|
|
19
|
+
|
|
20
|
+
# Inspect argument and return schemas for a specific command
|
|
21
|
+
supercli <namespace> <resource> <action> --schema
|
|
22
|
+
|
|
23
|
+
# Execute a command and get output in compact, token-saving mode
|
|
24
|
+
supercli <namespace> <resource> <action> --compact
|
|
25
|
+
|
|
26
|
+
# Pipe JSON directly into a command
|
|
27
|
+
echo '{"id": 123}' | supercli <namespace> <resource> <action> --json
|
|
28
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Natural Language execution ("ask")
|
|
2
|
+
|
|
3
|
+
SUPERCLI seamlessly translates natural language intents into execution steps in your infrastructure by mapping user queries directly to your established command capability graph.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Decentralized Execution (`SUPERCLI_SERVER` vs Local)**: SUPERCLI can generate natural language execution workflows on the backend server to share API keys across teams, or directly on the individual developer's machine locally using `OPENAI_BASE_URL`.
|
|
8
|
+
- **Automatic Fallback Execution**: The translation produces a DAG workflow JSON. SUPERCLI takes this JSON and runs it sequentially via the standard workflow planner mechanism.
|
|
9
|
+
- **Dynamic Context**: The LLM context is strictly limited to the definitions and JSON schemas of the actual configured commands.
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Set environment variables on either the local machine (for purely local mode) or the backend server (`server/app.js`):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
export OPENAI_BASE_URL=https://api.openai.com/v1
|
|
17
|
+
export OPENAI_MODEL=gpt-4
|
|
18
|
+
export OPENAI_API_KEY=sk-...
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
If the feature is enabled (either server-side or locally), it becomes visible in `supercli help`.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Query the system to build and execute a workflow
|
|
27
|
+
supercli ask "list the posts and summarize them"
|
|
28
|
+
|
|
29
|
+
# Output will stream the execution steps
|
|
30
|
+
# 1. jsonplaceholder posts list
|
|
31
|
+
# 2. ai text summarize --text="{{step.0.data.summary}}"
|
|
32
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Configuration Synchronization
|
|
2
|
+
|
|
3
|
+
SUPERCLI leverages a caching strategy that allows the CLI executable to run blazingly fast while decoupling read operations from needing immediate backend validation.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Offline Command Trees**: Upon a synchronization phase, SUPERCLI pulls down the entire state of the backend configuration (commands, actions, MCP servers, OpenAPI specs) into a rapid-access local flat file cache (`.supercli_cache.json`).
|
|
8
|
+
- **Speed Sub-Millisecond Dispatch**: Bypassing HTTP verification checks manually against the server saves precious tokens and network latency. The `help`, `inspect`, and `skills` routing operations become instant.
|
|
9
|
+
- **Independent Execution**: You do not strictly need a running server to perform offline tool execution or registry manipulation (such as adding internal MCP tools natively to the cache).
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Sync entire backend state locally
|
|
15
|
+
supercli sync
|
|
16
|
+
|
|
17
|
+
# Inspect local cache statistics (commands stored, cache TTL, mcp servers)
|
|
18
|
+
supercli config show
|
|
19
|
+
|
|
20
|
+
# Start executing against local registry (network calls defer to MCP providers instead of backend)
|
|
21
|
+
supercli ai text summarize "Offline CLI Mode"
|
|
22
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Execution Plans (DAG)
|
|
2
|
+
|
|
3
|
+
Execution Plans allow SUPERCLI to decouple the intent to execute a command from the actual execution itself. This gives agents (and humans) the ability to dry-run commands, verify correctness, analyze side effects, and explicitly authorize actions.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **4-Step Directed Acyclic Graph (DAG)**: Computes the precise chain of operations needed to run a command:
|
|
8
|
+
1. `resolve`: Lookup the command spec and backend adapter configuration.
|
|
9
|
+
2. `validate`: Run input schema validation.
|
|
10
|
+
3. `adapter`: Prepare the external request (HTTP, MCP, OpenAPI) based on the input.
|
|
11
|
+
4. `transform`: Process the raw response into the finalized output format.
|
|
12
|
+
- **Risk Assessment**: Automatically classifies execution intent based on the presence of side-effects (`safe` for reads, `medium` for mutations).
|
|
13
|
+
- **Stateful Short-Lived Plans**: The backend safely stores generated execution plans with unique IDs, locking the execution context so it cannot be tampered with between generation and execution.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# 1. Generate an execution plan without running the command
|
|
19
|
+
supercli plan <namespace> <resource> <action> --arg1 value
|
|
20
|
+
|
|
21
|
+
# (Output returns a plan_id and a list of steps)
|
|
22
|
+
|
|
23
|
+
# 2. Execute the previously created plan
|
|
24
|
+
supercli execute <plan_id>
|
|
25
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Observability & Traceability
|
|
2
|
+
|
|
3
|
+
SUPERCLI maintains a rich audit trail to monitor tool utilization natively, eliminating CLI tooling "blind spots".
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Job Tracing API (`/api/jobs`)**: Every time the CLI executes a command, it fires an asynchronous job tracking payload via `fetch` to the backend server with its execution parameters (command called, user arguments, duration, risk classification, outcome code).
|
|
8
|
+
- **Historical Analysis**: Administrators can review which endpoints are failing at the network adapter layer, identify slow execution patterns, or audit AI agent behaviors natively.
|
|
9
|
+
- **Dashboard Interface**: The built-in Express `.ejs` UI ships a dedicated `Jobs` dashboard that dynamically visualizes job history and computes basic high-level stats (e.g., success rate).
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Observability is enabled entirely passively. The CLI client naturally logs its outcome up to the server.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# The CLI automatically records this execution trace
|
|
17
|
+
SUPERCLI_SERVER=http://127.0.0.1:3000 supercli github issues list
|
|
18
|
+
|
|
19
|
+
# The traces can be consumed locally or via REST
|
|
20
|
+
open http://localhost:3000/jobs
|
|
21
|
+
curl http://127.0.0.1:3000/api/jobs/stats
|
|
22
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AI Skills Support
|
|
2
|
+
|
|
3
|
+
SUPERCLI natively integrates a teaching mechanism to empower local LLMs/agents with context about the application's CLI interface.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Bootstrapping Skills (`teach`)**: Emits a meta-skill document (in Markdown format compatible with Anthropic/OpenAI instructions) detailing the core architectural design of SUPERCLI and dynamically listing the namespaces and resources available.
|
|
8
|
+
- **Micro-Skills Extraction (`get <cmd>`)**: Automatically pulls a specific SUPERCLI command's capabilities and formats it into a self-contained AI-actionable tool instruction (e.g., Markdown schema).
|
|
9
|
+
- **Embedded DAG Planning**: Optionally injects execution plan information (`--show-dag`) into a skill's document to teach agents how to handle dry-runs for risky operations before execution.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# List all available capabilities briefly as an index
|
|
15
|
+
supercli skills list --json
|
|
16
|
+
|
|
17
|
+
# Extract the global knowledge required to teach an agent how SUPERCLI works
|
|
18
|
+
supercli skills teach
|
|
19
|
+
|
|
20
|
+
# Generate a hyper-specific instruction for an AI agent on how to call a command
|
|
21
|
+
supercli skills get oapi.todos.list
|
|
22
|
+
|
|
23
|
+
# Same as above, but instruct the AI on execution planning
|
|
24
|
+
supercli skills get oapi.todos.list --show-dag
|
|
25
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Pluggable Storage
|
|
2
|
+
|
|
3
|
+
By default, the backend of SUPERCLI is incredibly lightweight. However, for scaled enterprise deployments, its datastore is fully pluggable.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Key-Value Abstraction Layer**: Rather than tying the application to a specific database driver (e.g., MongoDB), SUPERCLI operates strictly against a generic `delete`, `set`, `get`, and `listKeys` interface.
|
|
8
|
+
- **Natural Entity Keys**: Data records internally utilize human-readable string IDs (like `command:namespace.resource.action`) rather than opaque ObjectIDs to improve portability.
|
|
9
|
+
- **Zero-Dependency Native Backend (`FileAdapter`)**: Without MongoDB configured, SUPERCLI defaults to reading and writing `.json` files in a local directory (`./supercli_storage`). This makes local testing completely frictionless and allows backing up configurations natively into Git if desired.
|
|
10
|
+
- **Enterprise Scale (`MongoAdapter`)**: Toggling an environment variable enables MongoDB persistence for shared, concurrent, high-availability deployments.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
The storage adapter is entirely determined by your environment variables in `.env` or process spawn.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Default behavior (uses FileAdapter producing ./supercli_storage/*.json files)
|
|
18
|
+
npm start
|
|
19
|
+
|
|
20
|
+
# Enable MongoDB Mode
|
|
21
|
+
export SUPERCLI_USE_MONGO=true
|
|
22
|
+
export MONGO_URL=mongodb://127.0.0.1:27017
|
|
23
|
+
export SUPERCLI_DB=supercli
|
|
24
|
+
npm start
|
|
25
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Multi-Step Workflows
|
|
2
|
+
|
|
3
|
+
SUPERCLI handles command chaining inherently via Workflow Commands without forcing agents or developers to write complicated shell orchestration.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Workflow Adapter Definition**: SUPERCLI represents compound multi-step processes as just another single command in its capability tree (`type: workflow`).
|
|
8
|
+
- **Data Piping (Context Mapping)**: When a workflow command executes, the `stdout` JSON result of step 1 can automatically be injected into the arguments of step 2. This creates clean API mapping layers (e.g., extract an ID from one endpoint, pass it to another).
|
|
9
|
+
- **Atomic Abstraction**: A complex graph of actions is compacted into one deterministic interface that agents discover seamlessly.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
A workflow is stored as a standard command in the registry, composed of references to other commands:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"namespace": "aws",
|
|
18
|
+
"resource": "instances",
|
|
19
|
+
"action": "restart_and_log",
|
|
20
|
+
"type": "workflow",
|
|
21
|
+
"adapterConfig": {
|
|
22
|
+
"steps": [
|
|
23
|
+
{ "command": "aws.instances.restart", "args": { "instance_id": "{{args.id}}" } },
|
|
24
|
+
{ "command": "logging.events.publish", "args": { "message": "Instance {{step.0.data.status}} restarted." } }
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Executing the workflow command feels completely standard
|
|
32
|
+
supercli aws instances restart_and_log --id i-0123456789
|
|
33
|
+
```
|