@involvex/super-agent-cli 0.0.39
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/.grok/settings.json +3 -0
- package/.prettierignore +11 -0
- package/.super-agent/settings.json +23 -0
- package/LICENSE +21 -0
- package/README.md +366 -0
- package/assets/splash.png +0 -0
- package/dist/agent/grok-agent.d.ts +54 -0
- package/dist/agent/grok-agent.js +638 -0
- package/dist/agent/grok-agent.js.map +1 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.js +139 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/super-agent.d.ts +54 -0
- package/dist/agent/super-agent.js +638 -0
- package/dist/agent/super-agent.js.map +1 -0
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.js +247 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/core/client.d.ts +49 -0
- package/dist/core/client.js +81 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/tools.d.ts +8 -0
- package/dist/core/tools.js +351 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/grok/client.d.ts +49 -0
- package/dist/grok/client.js +81 -0
- package/dist/grok/client.js.map +1 -0
- package/dist/grok/tools.d.ts +8 -0
- package/dist/grok/tools.js +351 -0
- package/dist/grok/tools.js.map +1 -0
- package/dist/hooks/use-enhanced-input.d.ts +37 -0
- package/dist/hooks/use-enhanced-input.js +228 -0
- package/dist/hooks/use-enhanced-input.js.map +1 -0
- package/dist/hooks/use-input-handler.d.ts +34 -0
- package/dist/hooks/use-input-handler.js +607 -0
- package/dist/hooks/use-input-handler.js.map +1 -0
- package/dist/hooks/use-input-history.d.ts +9 -0
- package/dist/hooks/use-input-history.js +62 -0
- package/dist/hooks/use-input-history.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6591 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +29 -0
- package/dist/mcp/client.js +127 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/config.d.ts +13 -0
- package/dist/mcp/config.js +45 -0
- package/dist/mcp/config.js.map +1 -0
- package/dist/mcp/transports.d.ts +51 -0
- package/dist/mcp/transports.js +229 -0
- package/dist/mcp/transports.js.map +1 -0
- package/dist/tools/bash.d.ts +10 -0
- package/dist/tools/bash.js +76 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/confirmation-tool.d.ts +16 -0
- package/dist/tools/confirmation-tool.js +77 -0
- package/dist/tools/confirmation-tool.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/morph-editor.d.ts +36 -0
- package/dist/tools/morph-editor.js +324 -0
- package/dist/tools/morph-editor.js.map +1 -0
- package/dist/tools/search.d.ts +69 -0
- package/dist/tools/search.js +307 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/text-editor.d.ts +26 -0
- package/dist/tools/text-editor.js +583 -0
- package/dist/tools/text-editor.js.map +1 -0
- package/dist/tools/todo-tool.d.ts +20 -0
- package/dist/tools/todo-tool.js +134 -0
- package/dist/tools/todo-tool.js.map +1 -0
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/app.d.ts +6 -0
- package/dist/ui/app.js +76 -0
- package/dist/ui/app.js.map +1 -0
- package/dist/ui/components/api-key-input.d.ts +6 -0
- package/dist/ui/components/api-key-input.js +70 -0
- package/dist/ui/components/api-key-input.js.map +1 -0
- package/dist/ui/components/chat-history.d.ts +7 -0
- package/dist/ui/components/chat-history.js +136 -0
- package/dist/ui/components/chat-history.js.map +1 -0
- package/dist/ui/components/chat-input.d.ts +8 -0
- package/dist/ui/components/chat-input.js +47 -0
- package/dist/ui/components/chat-input.js.map +1 -0
- package/dist/ui/components/chat-interface.d.ts +7 -0
- package/dist/ui/components/chat-interface.js +213 -0
- package/dist/ui/components/chat-interface.js.map +1 -0
- package/dist/ui/components/command-suggestions.d.ts +16 -0
- package/dist/ui/components/command-suggestions.js +18 -0
- package/dist/ui/components/command-suggestions.js.map +1 -0
- package/dist/ui/components/confirmation-dialog.d.ts +10 -0
- package/dist/ui/components/confirmation-dialog.js +70 -0
- package/dist/ui/components/confirmation-dialog.js.map +1 -0
- package/dist/ui/components/diff-renderer.d.ts +13 -0
- package/dist/ui/components/diff-renderer.js +200 -0
- package/dist/ui/components/diff-renderer.js.map +1 -0
- package/dist/ui/components/loading-spinner.d.ts +7 -0
- package/dist/ui/components/loading-spinner.js +52 -0
- package/dist/ui/components/loading-spinner.js.map +1 -0
- package/dist/ui/components/mcp-status.d.ts +4 -0
- package/dist/ui/components/mcp-status.js +37 -0
- package/dist/ui/components/mcp-status.js.map +1 -0
- package/dist/ui/components/model-selection.d.ts +11 -0
- package/dist/ui/components/model-selection.js +9 -0
- package/dist/ui/components/model-selection.js.map +1 -0
- package/dist/ui/shared/max-sized-box.d.ts +8 -0
- package/dist/ui/shared/max-sized-box.js +6 -0
- package/dist/ui/shared/max-sized-box.js.map +1 -0
- package/dist/ui/utils/code-colorizer.d.ts +2 -0
- package/dist/ui/utils/code-colorizer.js +7 -0
- package/dist/ui/utils/code-colorizer.js.map +1 -0
- package/dist/ui/utils/colors.d.ts +14 -0
- package/dist/ui/utils/colors.js +15 -0
- package/dist/ui/utils/colors.js.map +1 -0
- package/dist/ui/utils/markdown-renderer.d.ts +3 -0
- package/dist/ui/utils/markdown-renderer.js +23 -0
- package/dist/ui/utils/markdown-renderer.js.map +1 -0
- package/dist/utils/confirmation-service.d.ts +33 -0
- package/dist/utils/confirmation-service.js +110 -0
- package/dist/utils/confirmation-service.js.map +1 -0
- package/dist/utils/custom-instructions.d.ts +1 -0
- package/dist/utils/custom-instructions.js +23 -0
- package/dist/utils/custom-instructions.js.map +1 -0
- package/dist/utils/model-config.d.ts +28 -0
- package/dist/utils/model-config.js +42 -0
- package/dist/utils/model-config.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +99 -0
- package/dist/utils/settings-manager.js +286 -0
- package/dist/utils/settings-manager.js.map +1 -0
- package/dist/utils/settings.d.ts +1 -0
- package/dist/utils/settings.js +4 -0
- package/dist/utils/settings.js.map +1 -0
- package/dist/utils/text-utils.d.ts +80 -0
- package/dist/utils/text-utils.js +191 -0
- package/dist/utils/text-utils.js.map +1 -0
- package/dist/utils/token-counter.d.ts +33 -0
- package/dist/utils/token-counter.js +79 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/eslint.config.mjs +33 -0
- package/package.json +87 -0
package/.prettierignore
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"active_provider": "gemini",
|
|
3
|
+
"providers": {
|
|
4
|
+
"zai": {
|
|
5
|
+
"id": "zai",
|
|
6
|
+
"provider": "zai",
|
|
7
|
+
"model": "GLM-4.7",
|
|
8
|
+
"api_key": "2848b5f116bf4918a3d8f5396147cbf1.mr1ZJWiNOD01ifHY",
|
|
9
|
+
"base_url": "https://api.z.ai/api/v1",
|
|
10
|
+
"default_model": "GLM-4.7"
|
|
11
|
+
},
|
|
12
|
+
"gemini": {
|
|
13
|
+
"id": "gemini",
|
|
14
|
+
"provider": "gemini",
|
|
15
|
+
"model": "gemini-3-flash-preview",
|
|
16
|
+
"api_key": "AIzaSyCrJujbcYf2_drrGmY8LlEdK21qp7XlEe0",
|
|
17
|
+
"default_model": "gemini-3-flash-preview"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"ui": {
|
|
21
|
+
"theme": "dark"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 InvolveX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission statement shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# @involvex/super-agent-cli
|
|
2
|
+
|
|
3
|
+
A conversational AI CLI tool powered by Super Agent with intelligent text editor capabilities and tool usage.
|
|
4
|
+
|
|
5
|
+
<img width="980" height="435" alt="Screenshot 2025-07-21 at 13 35 41" src="assets/splash.png" />
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **🤖 Conversational AI**: Natural language interface powered by Super Agent-3
|
|
10
|
+
- **📝 Smart File Operations**: AI automatically uses tools to view, create, and edit files
|
|
11
|
+
- **⚡ Bash Integration**: Execute shell commands through natural conversation
|
|
12
|
+
- **🔧 Automatic Tool Selection**: AI intelligently chooses the right tools for your requests
|
|
13
|
+
- **🚀 Morph Fast Apply**: Optional high-speed code editing at 4,500+ tokens/sec with 98% accuracy
|
|
14
|
+
- **🔌 MCP Tools**: Extend capabilities with Model Context Protocol servers (Linear, GitHub, etc.)
|
|
15
|
+
- **💬 Interactive UI**: Beautiful terminal interface built with Ink
|
|
16
|
+
- **🌍 Global Installation**: Install and use anywhere with `bun add -g @involvex/super-agent-cli`
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
bun add -g @involvex/super-agent-cli
|
|
23
|
+
|
|
24
|
+
Or with npm (fallback):
|
|
25
|
+
|
|
26
|
+
npm install -g @involvex/super-agent-cli
|
|
27
|
+
|
|
28
|
+
## Configuration Files
|
|
29
|
+
|
|
30
|
+
Super Agent CLI uses two types of configuration files to manage settings:
|
|
31
|
+
|
|
32
|
+
### User-Level Settings (`~/.super-agent/settings.json`)
|
|
33
|
+
|
|
34
|
+
This file stores **global settings** that apply across all projects. These settings rarely change and include:
|
|
35
|
+
|
|
36
|
+
- **API Key**: Your Super Agent API key
|
|
37
|
+
- **Base URL**: Custom API endpoint (if needed)
|
|
38
|
+
- **Default Model**: Your preferred model (e.g., `gemini-3.0-flash`)
|
|
39
|
+
- **Available Models**: List of models you can use
|
|
40
|
+
|
|
41
|
+
**Example:**
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"active_provider": "gemini",
|
|
46
|
+
"providers": {
|
|
47
|
+
"gemini": {
|
|
48
|
+
"id": "gemini",
|
|
49
|
+
"provider": "gemini",
|
|
50
|
+
"model": "MODEL_NAME",
|
|
51
|
+
"api_key": "API_KEY",
|
|
52
|
+
"base_url": "BASE_URL (optional)",
|
|
53
|
+
"default_model": "MODEL_NAME"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Project-Level Settings (`.super-agent/settings.json`)
|
|
60
|
+
|
|
61
|
+
This file stores **project-specific settings** in your current working directory. It includes:
|
|
62
|
+
|
|
63
|
+
- **Current Model**: The model currently in use for this project
|
|
64
|
+
- **MCP Servers**: Model Context Protocol server configurations
|
|
65
|
+
|
|
66
|
+
**Example:**
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"active_provider": "gemini",
|
|
71
|
+
"providers": {
|
|
72
|
+
"gemini": {
|
|
73
|
+
"id": "gemini",
|
|
74
|
+
"provider": "gemini",
|
|
75
|
+
"model": "MODEL_NAME",
|
|
76
|
+
"api_key": "API_KEY",
|
|
77
|
+
"base_url": "BASE_URL (optional)",
|
|
78
|
+
"default_model": "MODEL_NAME"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"linear": {
|
|
83
|
+
"name": "linear",
|
|
84
|
+
"transport": "stdio",
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["@linear/mcp-server"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### How It Works
|
|
93
|
+
|
|
94
|
+
1. **Global Defaults**: User-level settings provide your default preferences
|
|
95
|
+
2. **Project Override**: Project-level settings override defaults for specific projects
|
|
96
|
+
3. **Directory-Specific**: When you change directories, project settings are loaded automatically
|
|
97
|
+
4. **Fallback Logic**: Project model → User default model → System default (`gemini-3-pro-preview`)
|
|
98
|
+
|
|
99
|
+
This means you can have different models for different projects while maintaining consistent global settings like your API key.
|
|
100
|
+
|
|
101
|
+
### Using Other API Providers
|
|
102
|
+
|
|
103
|
+
**Important**: Super Agent CLI uses **OpenAI-compatible APIs**. You can use any provider that implements the OpenAI chat completions standard.
|
|
104
|
+
|
|
105
|
+
**Popular Providers**:
|
|
106
|
+
|
|
107
|
+
- **Google (Gemini)**: `https://generativelanguage.googleapis.com/v1beta/openai` (default)
|
|
108
|
+
- **OpenAI**: `https://api.openai.com/v1`
|
|
109
|
+
- **OpenRouter**: `https://openrouter.ai/api/v1`
|
|
110
|
+
- **Groq**: `https://api.groq.com/openai/v1`
|
|
111
|
+
|
|
112
|
+
**Example with OpenRouter**:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"apiKey": "your_openrouter_key",
|
|
117
|
+
"baseURL": "https://openrouter.ai/api/v1",
|
|
118
|
+
"defaultModel": "anthropic/claude-3.5-sonnet",
|
|
119
|
+
"models": [
|
|
120
|
+
"anthropic/claude-3.5-sonnet",
|
|
121
|
+
"openai/gpt-4o",
|
|
122
|
+
"meta-llama/llama-3.1-70b-instruct"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Usage
|
|
128
|
+
|
|
129
|
+
### Interactive Mode
|
|
130
|
+
|
|
131
|
+
Start the conversational AI assistant:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
super-agent
|
|
135
|
+
# or
|
|
136
|
+
super-agent about
|
|
137
|
+
# or
|
|
138
|
+
super-agent plugins list
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Or specify a working directory:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
super-agent -d /path/to/project
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Headless Mode
|
|
148
|
+
|
|
149
|
+
Process a single prompt and exit (useful for scripting and automation):
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
super-agent --prompt "show me the package.json file"
|
|
153
|
+
super-agent -p "create a new file called example.js with a hello world function"
|
|
154
|
+
super-agent --prompt "run bun test and show me the results" --directory /path/to/project
|
|
155
|
+
super-agent --prompt "complex task" --max-tool-rounds 50 # Limit tool usage for faster execution
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This mode is particularly useful for:
|
|
159
|
+
|
|
160
|
+
- **CI/CD pipelines**: Automate code analysis and file operations
|
|
161
|
+
- **Scripting**: Integrate AI assistance into shell scripts
|
|
162
|
+
- **Terminal benchmarks**: Perfect for tools like Terminal Bench that need non-interactive execution
|
|
163
|
+
- **Batch processing**: Process multiple prompts programmatically
|
|
164
|
+
|
|
165
|
+
### Tool Execution Control
|
|
166
|
+
|
|
167
|
+
By default, Super Agent CLI allows up to 400 tool execution rounds to handle complex multi-step tasks. You can control this behavior:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Limit tool rounds for faster execution on simple tasks
|
|
171
|
+
super-agent --max-tool-rounds 10 --prompt "show me the current directory"
|
|
172
|
+
|
|
173
|
+
# Increase limit for very complex tasks (use with caution)
|
|
174
|
+
super-agent --max-tool-rounds 1000 --prompt "comprehensive code refactoring"
|
|
175
|
+
|
|
176
|
+
# Works with all modes
|
|
177
|
+
super-agent --max-tool-rounds 20 # Interactive mode
|
|
178
|
+
super-agent git commit-and-push --max-tool-rounds 30 # Git commands
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Use Cases**:
|
|
182
|
+
|
|
183
|
+
- **Fast responses**: Lower limits (10-50) for simple queries
|
|
184
|
+
- **Complex automation**: Higher limits (500+) for comprehensive tasks
|
|
185
|
+
- **Resource control**: Prevent runaway executions in automated environments
|
|
186
|
+
|
|
187
|
+
### Model Selection
|
|
188
|
+
|
|
189
|
+
You can specify which AI model to use with the `--model` parameter
|
|
190
|
+
|
|
191
|
+
# Use Super Agent models
|
|
192
|
+
|
|
193
|
+
super-agent --model gemini-3-pro-preview
|
|
194
|
+
super-agent --model gemini-2.5-pro
|
|
195
|
+
super-agent --model gemini-2.5-flash
|
|
196
|
+
|
|
197
|
+
**Method 2: User Settings File**
|
|
198
|
+
Add to `~/.super-agent/settings.json`:
|
|
199
|
+
|
|
200
|
+
**Model Priority**: `--model` flag > user default model > system default (gemini-3-pro-preview)
|
|
201
|
+
|
|
202
|
+
### Command Line Options
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
super-agent [options]
|
|
206
|
+
|
|
207
|
+
Options:
|
|
208
|
+
-V, --version output the version number
|
|
209
|
+
-d, --directory <dir> set working directory
|
|
210
|
+
-k, --api-key <key> Super Agent API key (or set SUPER_AGENT_API_KEY env var)
|
|
211
|
+
-u, --base-url <url> Super Agent API base URL (or set SUPER_AGENT_BASE_URL env var)
|
|
212
|
+
-m, --model <model> AI model to use (e.g., super-agent-code-fast-1, super-agent-4-latest) (or set SUPER_AGENT_MODEL env var)
|
|
213
|
+
-p, --prompt <prompt> process a single prompt and exit (headless mode)
|
|
214
|
+
--max-tool-rounds <rounds> maximum number of tool execution rounds (default: 400)
|
|
215
|
+
-h, --help display help for command
|
|
216
|
+
|
|
217
|
+
Commands:
|
|
218
|
+
about Show information about the Super Agent CLI
|
|
219
|
+
plugins list/install/uninstall <name/path> Manage plugins for Super Agent CLI
|
|
220
|
+
git Git operations with AI assistance
|
|
221
|
+
mcp Manage MCP servers
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Custom Instructions
|
|
225
|
+
|
|
226
|
+
You can provide custom instructions to tailor Super Agent's behavior to your project or globally. Super Agent CLI supports both project-level and global custom instructions.
|
|
227
|
+
|
|
228
|
+
#### Project-Level Instructions
|
|
229
|
+
|
|
230
|
+
Create a `.super-agent/SUPER_AGENT.md` file in your project directory to provide instructions specific to that project:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
mkdir .super-agent
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Create `.super-agent/SUPER_AGENT.md` with your project-specific instructions:
|
|
237
|
+
|
|
238
|
+
```markdown
|
|
239
|
+
# Custom Instructions for This Project
|
|
240
|
+
|
|
241
|
+
Always use TypeScript for any new code files.
|
|
242
|
+
When creating React components, use functional components with hooks.
|
|
243
|
+
Prefer const assertions and explicit typing over inference where it improves clarity.
|
|
244
|
+
Always add JSDoc comments for public functions and interfaces.
|
|
245
|
+
Follow the existing code style and patterns in this project.
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
#### Global Instructions
|
|
249
|
+
|
|
250
|
+
For instructions that apply across all projects, create `~/.super-agent/SUPER_AGENT.md` in your home directory:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
mkdir -p ~/.super-agent
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Create `~/.super-agent/SUPER_AGENT.md` with your global instructions:
|
|
257
|
+
|
|
258
|
+
```markdown
|
|
259
|
+
# Global Custom Instructions for Super Agent CLI
|
|
260
|
+
|
|
261
|
+
Always prioritize code readability and maintainability.
|
|
262
|
+
Use descriptive variable names and add comments for complex logic.
|
|
263
|
+
Follow best practices for the programming language being used.
|
|
264
|
+
When suggesting code changes, consider performance implications.
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### Priority Order
|
|
268
|
+
|
|
269
|
+
Super Agent will load custom instructions in the following priority order:
|
|
270
|
+
|
|
271
|
+
1. **Project-level** (`.super-agent/SUPER_AGENT.md` in current directory) - takes highest priority
|
|
272
|
+
2. **Global** (`~/.super-agent/SUPER_AGENT.md` in home directory) - fallback if no project instructions exist
|
|
273
|
+
|
|
274
|
+
If both files exist, project instructions will be used. If neither exists, Super Agent operates with its default behavior.
|
|
275
|
+
|
|
276
|
+
The custom instructions are added to Super Agent's system prompt and influence its responses across all interactions in the respective context.
|
|
277
|
+
|
|
278
|
+
## MCP Tools
|
|
279
|
+
|
|
280
|
+
Super Agent CLI supports MCP (Model Context Protocol) servers, allowing you to extend the AI assistant with additional tools and capabilities.
|
|
281
|
+
|
|
282
|
+
### Adding MCP Tools
|
|
283
|
+
|
|
284
|
+
#### Add a custom MCP server:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Add an stdio-based MCP server
|
|
288
|
+
super-agent mcp add my-server --transport stdio --command "bun" --args server.js
|
|
289
|
+
|
|
290
|
+
# Add an HTTP-based MCP server
|
|
291
|
+
super-agent mcp add my-server --transport http --url "http://localhost:3000"
|
|
292
|
+
|
|
293
|
+
# Add with environment variables
|
|
294
|
+
super-agent mcp add my-server --transport stdio --command "python" --args "-m" "my_mcp_server" --env "API_KEY=your_key"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### Add from JSON configuration:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
super-agent mcp add-json my-server '{"command": "bun", "args": ["server.js"], "env": {"API_KEY": "your_key"}}'
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Linear Integration Example
|
|
304
|
+
|
|
305
|
+
To add Linear MCP tools for project management:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Add Linear MCP server
|
|
309
|
+
super-agent mcp add linear --transport sse --url "https://mcp.linear.app/sse"
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
This enables Linear tools like:
|
|
313
|
+
|
|
314
|
+
- Create and manage Linear issues
|
|
315
|
+
- Search and filter issues
|
|
316
|
+
- Update issue status and assignees
|
|
317
|
+
- Access team and project information
|
|
318
|
+
|
|
319
|
+
### Managing MCP Servers
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# List all configured servers
|
|
323
|
+
super-agent mcp list
|
|
324
|
+
|
|
325
|
+
# Test server connection
|
|
326
|
+
super-agent mcp test server-name
|
|
327
|
+
|
|
328
|
+
# Remove a server
|
|
329
|
+
super-agent mcp remove server-name
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Available Transport Types
|
|
333
|
+
|
|
334
|
+
- **stdio**: Run MCP server as a subprocess (most common)
|
|
335
|
+
- **http**: Connect to HTTP-based MCP server
|
|
336
|
+
- **sse**: Connect via Server-Sent Events
|
|
337
|
+
|
|
338
|
+
## Development
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
# Install dependencies
|
|
342
|
+
bun install
|
|
343
|
+
|
|
344
|
+
# Development mode
|
|
345
|
+
bun run dev
|
|
346
|
+
|
|
347
|
+
# Build project
|
|
348
|
+
bun run build
|
|
349
|
+
|
|
350
|
+
# Run linter
|
|
351
|
+
bun run lint
|
|
352
|
+
|
|
353
|
+
# Type check
|
|
354
|
+
bun run typecheck
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Architecture
|
|
358
|
+
|
|
359
|
+
- **Agent**: Core command processing and execution logic
|
|
360
|
+
- **Tools**: Text editor and bash tool implementations
|
|
361
|
+
- **UI**: Ink-based terminal interface components
|
|
362
|
+
- **Types**: TypeScript definitions for the entire system
|
|
363
|
+
|
|
364
|
+
## License
|
|
365
|
+
|
|
366
|
+
MIT
|
|
Binary file
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { GrokToolCall } from "../grok/client";
|
|
2
|
+
import { ToolResult } from "../types";
|
|
3
|
+
import { EventEmitter } from "events";
|
|
4
|
+
export interface ChatEntry {
|
|
5
|
+
type: "user" | "assistant" | "tool_result" | "tool_call";
|
|
6
|
+
content: string;
|
|
7
|
+
timestamp: Date;
|
|
8
|
+
toolCalls?: GrokToolCall[];
|
|
9
|
+
toolCall?: GrokToolCall;
|
|
10
|
+
toolResult?: {
|
|
11
|
+
success: boolean;
|
|
12
|
+
output?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
};
|
|
15
|
+
isStreaming?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface StreamingChunk {
|
|
18
|
+
type: "content" | "tool_calls" | "tool_result" | "done" | "token_count";
|
|
19
|
+
content?: string;
|
|
20
|
+
toolCalls?: GrokToolCall[];
|
|
21
|
+
toolCall?: GrokToolCall;
|
|
22
|
+
toolResult?: ToolResult;
|
|
23
|
+
tokenCount?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare class GrokAgent extends EventEmitter {
|
|
26
|
+
private grokClient;
|
|
27
|
+
private textEditor;
|
|
28
|
+
private morphEditor;
|
|
29
|
+
private bash;
|
|
30
|
+
private todoTool;
|
|
31
|
+
private confirmationTool;
|
|
32
|
+
private search;
|
|
33
|
+
private chatHistory;
|
|
34
|
+
private messages;
|
|
35
|
+
private tokenCounter;
|
|
36
|
+
private abortController;
|
|
37
|
+
private mcpInitialized;
|
|
38
|
+
private maxToolRounds;
|
|
39
|
+
constructor(apiKey: string, baseURL?: string, model?: string, maxToolRounds?: number);
|
|
40
|
+
private initializeMCP;
|
|
41
|
+
private isGrokModel;
|
|
42
|
+
private shouldUseSearchFor;
|
|
43
|
+
processUserMessage(message: string): Promise<ChatEntry[]>;
|
|
44
|
+
private messageReducer;
|
|
45
|
+
processUserMessageStream(message: string): AsyncGenerator<StreamingChunk, void, unknown>;
|
|
46
|
+
private executeTool;
|
|
47
|
+
private executeMCPTool;
|
|
48
|
+
getChatHistory(): ChatEntry[];
|
|
49
|
+
getCurrentDirectory(): string;
|
|
50
|
+
executeBashCommand(command: string): Promise<ToolResult>;
|
|
51
|
+
getCurrentModel(): string;
|
|
52
|
+
setModel(model: string): void;
|
|
53
|
+
abortCurrentOperation(): void;
|
|
54
|
+
}
|