@involvex/super-agent-cli 0.0.58 → 0.0.60
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/.gitmodules +3 -0
- package/@plugins/README.md +106 -0
- package/@plugins/examples/notify/README.md +43 -0
- package/@plugins/examples/notify/package.json +27 -0
- package/@plugins/examples/weather/README.md +76 -0
- package/@plugins/examples/weather/package.json +27 -0
- package/@plugins/shared/types.ts +27 -0
- package/@plugins/templates/basic/README.md +50 -0
- package/@plugins/templates/basic/package.json +25 -0
- package/README.md +51 -0
- package/dist/index.js +111 -11
- package/dist/super-agent-cli.exe +0 -0
- package/package.json +1 -1
package/.gitmodules
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Super Agent CLI Plugins
|
|
2
|
+
|
|
3
|
+
Official plugin repository for [Super Agent CLI](https://github.com/involvex/super-agent-cli).
|
|
4
|
+
|
|
5
|
+
Extend your Super Agent CLI with custom tools, integrations, and capabilities through a simple plugin system.
|
|
6
|
+
|
|
7
|
+
## 🚀 Quick Start
|
|
8
|
+
|
|
9
|
+
See [QUICKSTART.md](./QUICKSTART.md) for a step-by-step guide to creating your first plugin.
|
|
10
|
+
|
|
11
|
+
## 📦 Available Examples
|
|
12
|
+
|
|
13
|
+
Explore fully-functional example plugins in the `examples/` directory:
|
|
14
|
+
|
|
15
|
+
- **[weather](./examples/weather/)** - External API integration with weather data
|
|
16
|
+
- **[database](./examples/database/)** - Database query tools with state management
|
|
17
|
+
- **[notify](./examples/notify/)** - System notifications and cross-platform integration
|
|
18
|
+
|
|
19
|
+
## 🎨 Templates
|
|
20
|
+
|
|
21
|
+
Get started quickly with our templates in the `templates/` directory:
|
|
22
|
+
|
|
23
|
+
- **[basic](./templates/basic/)** - Minimal single-tool plugin
|
|
24
|
+
- **[advanced](./templates/advanced/)** - Full-featured plugin with tests and CI
|
|
25
|
+
|
|
26
|
+
## 📖 Plugin API
|
|
27
|
+
|
|
28
|
+
All plugins must export a `SuperAgentPlugin` object:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
export interface SuperAgentPlugin {
|
|
32
|
+
name: string; // Unique plugin identifier
|
|
33
|
+
version: string; // Semantic version
|
|
34
|
+
description?: string; // Human-readable description
|
|
35
|
+
tools?: SuperAgentTool[]; // Tools provided by this plugin
|
|
36
|
+
onInit?: (context: PluginContext) => Promise<void>;
|
|
37
|
+
onShutdown?: () => Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Tool Definition
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
export interface SuperAgentTool {
|
|
45
|
+
type: "function";
|
|
46
|
+
function: {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
parameters?: {
|
|
50
|
+
type: "object";
|
|
51
|
+
properties: Record<string, any>;
|
|
52
|
+
required?: string[];
|
|
53
|
+
};
|
|
54
|
+
executor: (args: any, context: any) => Promise<string>;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 🔧 Installing Plugins
|
|
60
|
+
|
|
61
|
+
### From this repository:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
super-agent plugins install @plugins/examples/weather
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### From local file:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
super-agent plugins install ./my-plugin.js
|
|
71
|
+
super-agent plugins install /path/to/plugin/dist/index.js
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### List installed plugins:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
super-agent plugins list
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Remove a plugin:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
super-agent plugins uninstall weather
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 📝 Contributing
|
|
87
|
+
|
|
88
|
+
We welcome plugin contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
|
|
89
|
+
|
|
90
|
+
### Plugin Submission Checklist
|
|
91
|
+
|
|
92
|
+
- [ ] Plugin follows the API specification
|
|
93
|
+
- [ ] Includes README with usage examples
|
|
94
|
+
- [ ] TypeScript types are properly defined
|
|
95
|
+
- [ ] Error handling is implemented
|
|
96
|
+
- [ ] Code is tested (for advanced plugins)
|
|
97
|
+
|
|
98
|
+
## 📄 License
|
|
99
|
+
|
|
100
|
+
MIT - See [LICENSE](LICENSE) for details.
|
|
101
|
+
|
|
102
|
+
## 🔗 Links
|
|
103
|
+
|
|
104
|
+
- [Super Agent CLI Documentation](https://github.com/involvex/super-agent-cli)
|
|
105
|
+
- [Plugin Quickstart Guide](./QUICKSTART.md)
|
|
106
|
+
- [Report Issues](https://github.com/involvex/super-agent-cli-plugins/issues)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Notification Plugin
|
|
2
|
+
|
|
3
|
+
Send desktop notifications from Super Agent CLI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Cross-platform support (macOS, Windows, Linux)
|
|
8
|
+
- Urgency levels (low, normal, critical)
|
|
9
|
+
- Simple, single-tool example
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
super-agent plugins install @plugins/examples/notify
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
> Notify me when this is done
|
|
21
|
+
> Send a notification saying the build is complete
|
|
22
|
+
> Alert me with "Meeting in 5 minutes"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Platform Requirements
|
|
26
|
+
|
|
27
|
+
- **macOS**: Built-in (uses `osascript`)
|
|
28
|
+
- **Windows**: Built-in (uses PowerShell)
|
|
29
|
+
- **Linux**: Requires `notify-send` (usually pre-installed)
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
{
|
|
35
|
+
"title": "Build Complete",
|
|
36
|
+
"message": "Your project build finished successfully!",
|
|
37
|
+
"urgency": "normal"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@involvex/super-agent-plugin-notify",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Desktop notification plugin for Super Agent CLI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"super-agent",
|
|
7
|
+
"plugin",
|
|
8
|
+
"notifications",
|
|
9
|
+
"desktop"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "InvolveX",
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"dev": "tsc --watch"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^20.0.0",
|
|
22
|
+
"typescript": "^5.0.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@involvex/super-agent-cli": ">=0.0.58"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Weather Plugin
|
|
2
|
+
|
|
3
|
+
Get weather information for any city using the OpenWeatherMap API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Current weather conditions
|
|
8
|
+
- Temperature in Celsius/Fahrenheit
|
|
9
|
+
- Humidity, wind speed, and conditions
|
|
10
|
+
- Simple, single-tool example
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
super-agent plugins install @plugins/examples/weather
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
Add your API key to `~/.super-agent/settings.json`:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"plugins": ["@plugins/examples/weather"],
|
|
25
|
+
"pluginConfigs": {
|
|
26
|
+
"weather": {
|
|
27
|
+
"apiKey": "your-openweathermap-api-key",
|
|
28
|
+
"units": "metric"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Get a free API key at [OpenWeatherMap](https://openweathermap.org/api).
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
Simply ask Super Agent about the weather:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
> What's the weather in London?
|
|
42
|
+
> Is it raining in Tokyo?
|
|
43
|
+
> What's the temperature in New York?
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Implementation Details
|
|
47
|
+
|
|
48
|
+
This plugin demonstrates:
|
|
49
|
+
|
|
50
|
+
- **External API integration** - Makes HTTP requests to OpenWeatherMap
|
|
51
|
+
- **Configuration handling** - Reads API key from plugin config
|
|
52
|
+
- **Error handling** - Gracefully handles API errors and missing config
|
|
53
|
+
- **Parameter validation** - Validates city name input
|
|
54
|
+
|
|
55
|
+
## Code Structure
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
weather/
|
|
59
|
+
├── src/
|
|
60
|
+
│ └── index.ts # Main plugin code
|
|
61
|
+
├── package.json # Dependencies
|
|
62
|
+
├── tsconfig.json # TypeScript config
|
|
63
|
+
└── README.md # This file
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install
|
|
70
|
+
npm run build
|
|
71
|
+
npm run dev # Watch mode
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@involvex/super-agent-plugin-weather",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Weather plugin for Super Agent CLI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"super-agent",
|
|
7
|
+
"plugin",
|
|
8
|
+
"weather",
|
|
9
|
+
"openweathermap"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "InvolveX",
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"dev": "tsc --watch"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^20.0.0",
|
|
22
|
+
"typescript": "^5.0.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@involvex/super-agent-cli": ">=0.0.58"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface PluginContext {
|
|
2
|
+
agent: any; // SuperAgent instance
|
|
3
|
+
config: any; // Plugin-specific configuration
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface SuperAgentTool {
|
|
7
|
+
type: "function";
|
|
8
|
+
function: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
parameters?: {
|
|
12
|
+
type: "object";
|
|
13
|
+
properties: Record<string, any>;
|
|
14
|
+
required?: string[];
|
|
15
|
+
};
|
|
16
|
+
executor: (args: any, context: any) => Promise<string>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface SuperAgentPlugin {
|
|
21
|
+
name: string;
|
|
22
|
+
version: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
tools?: SuperAgentTool[];
|
|
25
|
+
onInit?: (context: PluginContext) => Promise<void>;
|
|
26
|
+
onShutdown?: () => Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Basic Plugin Template
|
|
2
|
+
|
|
3
|
+
A minimal template for creating Super Agent CLI plugins.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
1. **Copy this template:**
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cp -r templates/basic my-plugin
|
|
11
|
+
cd my-plugin
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. **Customize `src/index.ts`:**
|
|
15
|
+
- Change plugin name, version, description
|
|
16
|
+
- Replace `example_tool` with your own tool
|
|
17
|
+
- Update the tool's name, description, and parameters
|
|
18
|
+
|
|
19
|
+
3. **Build:**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install
|
|
23
|
+
npm run build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
4. **Install:**
|
|
27
|
+
```bash
|
|
28
|
+
super-agent plugins install ./dist/index.js
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
basic/
|
|
35
|
+
├── src/
|
|
36
|
+
│ └── index.ts # Plugin implementation
|
|
37
|
+
├── package.json # Dependencies
|
|
38
|
+
├── tsconfig.json # TypeScript configuration
|
|
39
|
+
└── README.md # This file
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Next Steps
|
|
43
|
+
|
|
44
|
+
- See [QUICKSTART.md](../../QUICKSTART.md) for detailed guide
|
|
45
|
+
- Check [examples/](../../examples/) for more complex plugins
|
|
46
|
+
- Use [advanced template](../advanced/) for full-featured plugins
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@involvex/super-agent-plugin-template",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Basic template for Super Agent CLI plugins",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"super-agent",
|
|
7
|
+
"plugin"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Your Name",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"clean": "rm -rf dist",
|
|
16
|
+
"dev": "tsc --watch"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^20.0.0",
|
|
20
|
+
"typescript": "^5.0.0"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@involvex/super-agent-cli": ">=0.0.58"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/README.md
CHANGED
|
@@ -219,8 +219,59 @@ Commands:
|
|
|
219
219
|
plugins list/install/uninstall <name/path> Manage plugins for Super Agent CLI
|
|
220
220
|
git Git operations with AI assistance
|
|
221
221
|
mcp Manage MCP servers
|
|
222
|
+
web Start web interface
|
|
223
|
+
serve Start both TUI and web interfaces
|
|
222
224
|
```
|
|
223
225
|
|
|
226
|
+
### Plugin System
|
|
227
|
+
|
|
228
|
+
Extend Super Agent with custom tools and capabilities through plugins.
|
|
229
|
+
|
|
230
|
+
#### Installing Plugins
|
|
231
|
+
|
|
232
|
+
**From GitHub Repository:**
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Full URL
|
|
236
|
+
super-agent plugins install https://github.com/involvex/super-agent-cli-plugins
|
|
237
|
+
|
|
238
|
+
# Short format (owner/repo)
|
|
239
|
+
super-agent plugins install involvex/super-agent-cli-plugins
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**From Local Directory:**
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
super-agent plugins install ./my-plugin
|
|
246
|
+
super-agent plugins install /path/to/plugin-directory
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**From File:**
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
super-agent plugins install ./plugin.js
|
|
253
|
+
super-agent plugins install /path/to/plugin/dist/index.js
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### Managing Plugins
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# List installed plugins
|
|
260
|
+
super-agent plugins list
|
|
261
|
+
|
|
262
|
+
# Uninstall a plugin
|
|
263
|
+
super-agent plugins uninstall plugin-name
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### Creating Plugins
|
|
267
|
+
|
|
268
|
+
See the [official plugin repository](https://github.com/involvex/super-agent-cli-plugins) for:
|
|
269
|
+
|
|
270
|
+
- Example plugins (weather, database, notifications)
|
|
271
|
+
- Plugin templates
|
|
272
|
+
- Quickstart guide
|
|
273
|
+
- API documentation
|
|
274
|
+
|
|
224
275
|
### Custom Instructions
|
|
225
276
|
|
|
226
277
|
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.
|
package/dist/index.js
CHANGED
|
@@ -540,7 +540,7 @@ var init_indexer = __esm(() => {
|
|
|
540
540
|
var require_package = __commonJS((exports, module) => {
|
|
541
541
|
module.exports = {
|
|
542
542
|
name: "@involvex/super-agent-cli",
|
|
543
|
-
version: "0.0.
|
|
543
|
+
version: "0.0.60",
|
|
544
544
|
description: "An open-source AI agent that brings the power of Super Agent directly into your terminal.",
|
|
545
545
|
keywords: [
|
|
546
546
|
"cli",
|
|
@@ -928,9 +928,9 @@ class WebServer {
|
|
|
928
928
|
}
|
|
929
929
|
try {
|
|
930
930
|
if (await fs15.pathExists(absolutePath)) {
|
|
931
|
-
const
|
|
931
|
+
const stat5 = await fs15.stat(absolutePath);
|
|
932
932
|
let filePath = absolutePath;
|
|
933
|
-
if (
|
|
933
|
+
if (stat5.isDirectory()) {
|
|
934
934
|
filePath = path14.join(absolutePath, "index.html");
|
|
935
935
|
}
|
|
936
936
|
const content = await fs15.readFile(filePath);
|
|
@@ -2081,8 +2081,11 @@ init_config();
|
|
|
2081
2081
|
|
|
2082
2082
|
// src/plugins/manager.ts
|
|
2083
2083
|
init_settings_manager();
|
|
2084
|
+
import { exec as exec2 } from "child_process";
|
|
2085
|
+
import { promisify as promisify2 } from "util";
|
|
2084
2086
|
import * as fs4 from "fs-extra";
|
|
2085
2087
|
import * as path4 from "path";
|
|
2088
|
+
var execAsync2 = promisify2(exec2);
|
|
2086
2089
|
|
|
2087
2090
|
class PluginManager {
|
|
2088
2091
|
static instance;
|
|
@@ -2135,15 +2138,112 @@ class PluginManager {
|
|
|
2135
2138
|
}
|
|
2136
2139
|
}
|
|
2137
2140
|
async installPlugin(pluginPath) {
|
|
2141
|
+
let resolvedPath = pluginPath;
|
|
2142
|
+
if (this.isGitHubUrl(pluginPath)) {
|
|
2143
|
+
console.log(`\uD83D\uDCE6 Cloning from GitHub: ${pluginPath}...`);
|
|
2144
|
+
resolvedPath = await this.cloneGitHubRepo(pluginPath);
|
|
2145
|
+
console.log(`✅ Cloned to: ${resolvedPath}`);
|
|
2146
|
+
} else if (await this.isDirectory(pluginPath)) {
|
|
2147
|
+
console.log(`\uD83D\uDCC1 Installing from local directory: ${pluginPath}...`);
|
|
2148
|
+
resolvedPath = await this.installFromDirectory(pluginPath);
|
|
2149
|
+
console.log(`✅ Installed from: ${pluginPath}`);
|
|
2150
|
+
} else {
|
|
2151
|
+
resolvedPath = path4.resolve(pluginPath);
|
|
2152
|
+
if (!await fs4.pathExists(resolvedPath)) {
|
|
2153
|
+
throw new Error(`Plugin file not found: ${resolvedPath}`);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2138
2156
|
const manager = getSettingsManager();
|
|
2139
2157
|
const settings = manager.loadUserSettings();
|
|
2140
2158
|
const plugins = settings.plugins || [];
|
|
2141
|
-
if (!plugins.includes(
|
|
2142
|
-
plugins.push(
|
|
2159
|
+
if (!plugins.includes(resolvedPath)) {
|
|
2160
|
+
plugins.push(resolvedPath);
|
|
2143
2161
|
manager.updateUserSetting("plugins", plugins);
|
|
2144
|
-
return
|
|
2162
|
+
return resolvedPath;
|
|
2145
2163
|
}
|
|
2146
|
-
return
|
|
2164
|
+
return resolvedPath;
|
|
2165
|
+
}
|
|
2166
|
+
isGitHubUrl(url) {
|
|
2167
|
+
return url.startsWith("https://github.com/") || url.startsWith("git@github.com:") || url.match(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/) !== null;
|
|
2168
|
+
}
|
|
2169
|
+
async isDirectory(filePath) {
|
|
2170
|
+
try {
|
|
2171
|
+
const stats = await fs4.stat(filePath);
|
|
2172
|
+
return stats.isDirectory();
|
|
2173
|
+
} catch {
|
|
2174
|
+
return false;
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
async cloneGitHubRepo(repoUrl) {
|
|
2178
|
+
let gitUrl = repoUrl;
|
|
2179
|
+
if (repoUrl.match(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/)) {
|
|
2180
|
+
gitUrl = `https://github.com/${repoUrl}.git`;
|
|
2181
|
+
} else if (!repoUrl.endsWith(".git")) {
|
|
2182
|
+
gitUrl = `${repoUrl}.git`;
|
|
2183
|
+
}
|
|
2184
|
+
const repoName = path4.basename(gitUrl, ".git");
|
|
2185
|
+
const targetDir = path4.join(this.pluginDirectory, repoName);
|
|
2186
|
+
if (await fs4.pathExists(targetDir)) {
|
|
2187
|
+
console.log(`Repository already cloned at ${targetDir}. Pulling latest...`);
|
|
2188
|
+
try {
|
|
2189
|
+
await execAsync2(`cd "${targetDir}" && git pull`);
|
|
2190
|
+
} catch (error) {
|
|
2191
|
+
console.warn(`Failed to pull updates: ${error}`);
|
|
2192
|
+
}
|
|
2193
|
+
} else {
|
|
2194
|
+
await execAsync2(`git clone "${gitUrl}" "${targetDir}"`);
|
|
2195
|
+
}
|
|
2196
|
+
const packageJsonPath = path4.join(targetDir, "package.json");
|
|
2197
|
+
if (await fs4.pathExists(packageJsonPath)) {
|
|
2198
|
+
console.log("\uD83D\uDCE6 Installing dependencies...");
|
|
2199
|
+
try {
|
|
2200
|
+
const hasBun = await fs4.pathExists(path4.join(targetDir, "bun.lockb"));
|
|
2201
|
+
const hasYarn = await fs4.pathExists(path4.join(targetDir, "yarn.lock"));
|
|
2202
|
+
const installCmd = hasBun ? "bun install" : hasYarn ? "yarn install" : "npm install";
|
|
2203
|
+
await execAsync2(`cd "${targetDir}" && ${installCmd}`);
|
|
2204
|
+
console.log("\uD83D\uDD28 Building plugin...");
|
|
2205
|
+
const buildCmd = hasBun ? "bun run build" : hasYarn ? "yarn build" : "npm run build";
|
|
2206
|
+
await execAsync2(`cd "${targetDir}" && ${buildCmd}`);
|
|
2207
|
+
} catch (error) {
|
|
2208
|
+
console.warn(`Build failed: ${error.message}`);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
const distPath = path4.join(targetDir, "dist", "index.js");
|
|
2212
|
+
if (await fs4.pathExists(distPath)) {
|
|
2213
|
+
return distPath;
|
|
2214
|
+
}
|
|
2215
|
+
const srcPath = path4.join(targetDir, "src", "index.ts");
|
|
2216
|
+
if (await fs4.pathExists(srcPath)) {
|
|
2217
|
+
return srcPath;
|
|
2218
|
+
}
|
|
2219
|
+
return path4.join(targetDir, "index.js");
|
|
2220
|
+
}
|
|
2221
|
+
async installFromDirectory(dirPath) {
|
|
2222
|
+
const absolutePath = path4.resolve(dirPath);
|
|
2223
|
+
const packageJsonPath = path4.join(absolutePath, "package.json");
|
|
2224
|
+
if (await fs4.pathExists(packageJsonPath)) {
|
|
2225
|
+
console.log("\uD83D\uDCE6 Installing dependencies...");
|
|
2226
|
+
try {
|
|
2227
|
+
const hasBun = await fs4.pathExists(path4.join(absolutePath, "bun.lockb"));
|
|
2228
|
+
const hasYarn = await fs4.pathExists(path4.join(absolutePath, "yarn.lock"));
|
|
2229
|
+
const installCmd = hasBun ? "bun install" : hasYarn ? "yarn install" : "npm install";
|
|
2230
|
+
await execAsync2(`cd "${absolutePath}" && ${installCmd}`);
|
|
2231
|
+
console.log("\uD83D\uDD28 Building plugin...");
|
|
2232
|
+
const buildCmd = hasBun ? "bun run build" : hasYarn ? "yarn build" : "npm run build";
|
|
2233
|
+
await execAsync2(`cd "${absolutePath}" && ${buildCmd}`);
|
|
2234
|
+
} catch (error) {
|
|
2235
|
+
console.warn(`Build failed: ${error.message}`);
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
const distPath = path4.join(absolutePath, "dist", "index.js");
|
|
2239
|
+
if (await fs4.pathExists(distPath)) {
|
|
2240
|
+
return distPath;
|
|
2241
|
+
}
|
|
2242
|
+
const srcPath = path4.join(absolutePath, "src", "index.ts");
|
|
2243
|
+
if (await fs4.pathExists(srcPath)) {
|
|
2244
|
+
return srcPath;
|
|
2245
|
+
}
|
|
2246
|
+
return path4.join(absolutePath, "index.js");
|
|
2147
2247
|
}
|
|
2148
2248
|
async removePlugin(pluginOrPath) {
|
|
2149
2249
|
const manager = getSettingsManager();
|
|
@@ -5060,9 +5160,9 @@ function ChatHistory({
|
|
|
5060
5160
|
init_settings_manager();
|
|
5061
5161
|
|
|
5062
5162
|
// src/tools/bash.ts
|
|
5063
|
-
import { exec as
|
|
5064
|
-
import { promisify as
|
|
5065
|
-
var
|
|
5163
|
+
import { exec as exec3 } from "child_process";
|
|
5164
|
+
import { promisify as promisify3 } from "util";
|
|
5165
|
+
var execAsync3 = promisify3(exec3);
|
|
5066
5166
|
|
|
5067
5167
|
class BashTool {
|
|
5068
5168
|
currentDirectory = process.cwd();
|
|
@@ -5101,7 +5201,7 @@ Working directory: ${this.currentDirectory}`
|
|
|
5101
5201
|
};
|
|
5102
5202
|
}
|
|
5103
5203
|
}
|
|
5104
|
-
const { stdout, stderr } = await
|
|
5204
|
+
const { stdout, stderr } = await execAsync3(command, {
|
|
5105
5205
|
cwd: this.currentDirectory,
|
|
5106
5206
|
timeout,
|
|
5107
5207
|
maxBuffer: 1024 * 1024
|
package/dist/super-agent-cli.exe
CHANGED
|
Binary file
|