enact-cli 1.0.10 → 2.0.10
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/bin/enact.js +61 -0
- package/package.json +15 -70
- package/LICENSE +0 -19
- package/README.md +0 -243
- package/dist/enact +0 -0
- package/dist/enact-linux +0 -0
- package/dist/enact-macos +0 -0
- package/dist/enact-windows.exe +0 -0
- package/dist/index.js +0 -13729
- package/dist/index.js.bak +0 -13728
- package/dist/lib/enact-direct.js +0 -8223
- package/dist/mcp-direct.js +0 -21593
- package/dist/mcp-direct.js.bak +0 -21593
- package/dist/mcp-entry.js +0 -21665
- package/dist/mcp-entry.js.bak +0 -21665
- package/dist/mcp-server.js +0 -22827
- package/dist/mcp-server.js.bak +0 -22826
package/bin/enact.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
|
|
5
|
+
function pkgNameFor(platform, arch) {
|
|
6
|
+
// Keep names aligned with the optionalDependencies list in this package.json
|
|
7
|
+
if (platform === "darwin" && arch === "arm64") return "@enactprotocol/enact-darwin-arm64";
|
|
8
|
+
if (platform === "darwin" && arch === "x64") return "@enactprotocol/enact-darwin-x64";
|
|
9
|
+
if (platform === "linux" && arch === "arm64") return "@enactprotocol/enact-linux-arm64";
|
|
10
|
+
if (platform === "linux" && arch === "x64") return "@enactprotocol/enact-linux-x64";
|
|
11
|
+
if (platform === "win32" && arch === "x64") return "@enactprotocol/enact-win32-x64";
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function loadPlatformBinary(pkgName) {
|
|
16
|
+
// Platform packages are expected to export { binPath }.
|
|
17
|
+
// They may be ESM or CJS; handle both.
|
|
18
|
+
try {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
20
|
+
const mod = require(pkgName);
|
|
21
|
+
return mod?.binPath ? mod : mod?.default ? mod.default : mod;
|
|
22
|
+
} catch (err) {
|
|
23
|
+
return { loadError: err };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function run() {
|
|
28
|
+
const pkgName = pkgNameFor(process.platform, process.arch);
|
|
29
|
+
if (!pkgName) {
|
|
30
|
+
console.error(
|
|
31
|
+
`enact: unsupported platform ${process.platform}/${process.arch}. No prebuilt binary is available.`
|
|
32
|
+
);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const platformPkg = loadPlatformBinary(pkgName);
|
|
37
|
+
if (!platformPkg || !platformPkg.binPath) {
|
|
38
|
+
const msg = platformPkg?.loadError ? String(platformPkg.loadError) : "Unknown error";
|
|
39
|
+
console.error(`enact: failed to load platform package ${pkgName}.`);
|
|
40
|
+
console.error(msg);
|
|
41
|
+
console.error("\nTry reinstalling: npm i -g @enactprotocol/enact");
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const binPath = platformPkg.binPath;
|
|
46
|
+
const args = process.argv.slice(2);
|
|
47
|
+
|
|
48
|
+
// Allow platform packages to ship a JS shim during development.
|
|
49
|
+
const isNodeScript = /\.c?js$/i.test(binPath);
|
|
50
|
+
const cmd = isNodeScript ? process.execPath : binPath;
|
|
51
|
+
const cmdArgs = isNodeScript ? [binPath, ...args] : args;
|
|
52
|
+
|
|
53
|
+
const result = spawnSync(cmd, cmdArgs, { stdio: "inherit" });
|
|
54
|
+
if (result.error) {
|
|
55
|
+
console.error(String(result.error));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
process.exit(result.status ?? 1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
run();
|
package/package.json
CHANGED
|
@@ -1,79 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "enact-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"enact": "./dist/index.js",
|
|
9
|
-
"enact-mcp": "./dist/mcp-server.js"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist/**/*",
|
|
13
|
-
"README.md",
|
|
14
|
-
"LICENSE"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/mcp-server.ts --outdir ./dist --target node && sed -i.bak '1{/^#!/d;}' ./dist/index.js && sed -i.bak '1{/^#!/d;}' ./dist/mcp-server.js && echo '#!/usr/bin/env node' | cat - ./dist/index.js > temp && mv temp ./dist/index.js && chmod +x ./dist/index.js && echo '#!/usr/bin/env node' | cat - ./dist/mcp-server.js > temp2 && mv temp2 ./dist/mcp-server.js && chmod +x ./dist/mcp-server.js",
|
|
18
|
-
"build:mcp": "bun build ./src/mcp-server.ts --outdir ./dist --target node",
|
|
19
|
-
"start:mcp": "node ./dist/mcp-server.js",
|
|
20
|
-
"dev:mcp": "bun run --watch src/mcp-server.ts",
|
|
21
|
-
"dev:mcp-server": "bun run --watch src/mcp-server.ts",
|
|
22
|
-
"test": "bun test",
|
|
23
|
-
"test:watch": "bun test --watch",
|
|
24
|
-
"test:cleanup": "node scripts/cleanup-test-dirs.js",
|
|
25
|
-
"prepublishOnly": "npm run build",
|
|
26
|
-
"start": "bun ./dist/index.js",
|
|
27
|
-
"dev": "bun run --watch src/index.ts",
|
|
28
|
-
"dev:cmd": "bun src/index.ts",
|
|
29
|
-
"test:coverage": "vitest --coverage",
|
|
30
|
-
"lint": "bunx @biomejs/biome lint ./src",
|
|
31
|
-
"format": "bunx @biomejs/biome format --write ./src",
|
|
32
|
-
"build:binary": "bun build ./src/index.ts --compile --outfile enact",
|
|
33
|
-
"build:all": "npm run build:linux && npm run build:macos && npm run build:windows",
|
|
34
|
-
"build:linux": "bun build ./src/index.ts --compile --target=bun-linux-x64 --outfile dist/enact-linux",
|
|
35
|
-
"build:macos": "bun build ./src/index.ts --compile --target=bun-darwin-x64 --outfile dist/enact-macos",
|
|
36
|
-
"build:windows": "bun build ./src/index.ts --compile --target=bun-windows-x64 --outfile dist/enact-windows.exe",
|
|
37
|
-
"release": "npm run build:all && npm run build"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"cli",
|
|
41
|
-
"enact",
|
|
42
|
-
"enact-protocol",
|
|
43
|
-
"ai-tools",
|
|
44
|
-
"mcp",
|
|
45
|
-
"model-context-protocol",
|
|
46
|
-
"tool-discovery",
|
|
47
|
-
"command-line-tool"
|
|
48
|
-
],
|
|
49
|
-
"author": "EnactProtocol",
|
|
50
|
-
"license": "MIT",
|
|
3
|
+
"version": "2.0.10",
|
|
4
|
+
"description": "Enact CLI (thin wrapper that loads the correct platform binary)",
|
|
5
|
+
"license": "Apache-2.0",
|
|
51
6
|
"repository": {
|
|
52
7
|
"type": "git",
|
|
53
|
-
"url": "https://github.com/EnactProtocol/enact
|
|
8
|
+
"url": "https://github.com/EnactProtocol/enact.git",
|
|
9
|
+
"directory": "packages/enact"
|
|
54
10
|
},
|
|
55
|
-
"
|
|
56
|
-
"
|
|
11
|
+
"bin": {
|
|
12
|
+
"enact": "./bin/enact.js"
|
|
13
|
+
},
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"@enactprotocol/enact-darwin-arm64": "2.0.10",
|
|
16
|
+
"@enactprotocol/enact-darwin-x64": "2.0.10",
|
|
17
|
+
"@enactprotocol/enact-linux-arm64": "2.0.10",
|
|
18
|
+
"@enactprotocol/enact-linux-x64": "2.0.10",
|
|
19
|
+
"@enactprotocol/enact-win32-x64": "2.0.10"
|
|
57
20
|
},
|
|
58
|
-
"homepage": "https://github.com/EnactProtocol/enact-cli#readme",
|
|
59
21
|
"engines": {
|
|
60
22
|
"node": ">=18.0.0"
|
|
61
|
-
},
|
|
62
|
-
"devDependencies": {
|
|
63
|
-
"@types/node": "^20.12.12",
|
|
64
|
-
"@vitest/coverage-v8": "^2.0.0",
|
|
65
|
-
"bun-types": "latest",
|
|
66
|
-
"typescript": "^5.4.5",
|
|
67
|
-
"vitest": "^2.0.0"
|
|
68
|
-
},
|
|
69
|
-
"dependencies": {
|
|
70
|
-
"@clack/core": "^0.4.2",
|
|
71
|
-
"@clack/prompts": "^0.10.1",
|
|
72
|
-
"@modelcontextprotocol/sdk": "^1.13.0",
|
|
73
|
-
"dotenv": "^16.5.0",
|
|
74
|
-
"picocolors": "^1.1.1",
|
|
75
|
-
"strip-ansi": "^7.1.0",
|
|
76
|
-
"yaml": "^2.8.0",
|
|
77
|
-
"zod": "^3.25.67"
|
|
78
23
|
}
|
|
79
|
-
}
|
|
24
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright (c) {{ year }} {{ organization }}
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
14
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
15
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
16
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
17
|
-
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
18
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
19
|
-
OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
# Enact CLI
|
|
2
|
-
|
|
3
|
-
Official CLI for the Enact Protocol - package, secure, and discover AI tools.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🔍 **Search & Discovery** - Find AI tools in the Enact ecosystem
|
|
8
|
-
- ⚡ **Execute Tools** - Run tools directly with secure execution
|
|
9
|
-
- 📦 **Publishing** - Publish your own tools to the registry
|
|
10
|
-
- 🔐 **Security** - Cryptographic signing and verification
|
|
11
|
-
- 🎯 **MCP Integration** - Full Model Context Protocol support
|
|
12
|
-
- 🚀 **Direct Library** - Use as a library in your applications
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
### For End Users
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# Install globally
|
|
20
|
-
npm install -g enact-cli
|
|
21
|
-
|
|
22
|
-
# Now you can use:
|
|
23
|
-
enact search --tags web,api
|
|
24
|
-
enact exec author/tool-name
|
|
25
|
-
enact-mcp-server # Start MCP server
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### For MCP (Model Context Protocol) Users
|
|
29
|
-
|
|
30
|
-
After installation, you can use Enact with any MCP client:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# With MCP Inspector
|
|
34
|
-
npx @modelcontextprotocol/inspector enact-mcp-server
|
|
35
|
-
|
|
36
|
-
# In Claude Desktop (add to config)
|
|
37
|
-
{
|
|
38
|
-
"mcpServers": {
|
|
39
|
-
"enact": {
|
|
40
|
-
"command": "enact-mcp-server"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
See [MCP_USAGE.md](./MCP_USAGE.md) for detailed MCP integration guide.
|
|
47
|
-
|
|
48
|
-
## Quick Start
|
|
49
|
-
|
|
50
|
-
### CLI Usage
|
|
51
|
-
```bash
|
|
52
|
-
# Search for tools
|
|
53
|
-
enact search "text processing"
|
|
54
|
-
|
|
55
|
-
# Get help
|
|
56
|
-
enact --help
|
|
57
|
-
|
|
58
|
-
# Execute a tool
|
|
59
|
-
enact exec author/tool-name --input '{"key": "value"}'
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### MCP Server Usage
|
|
63
|
-
```bash
|
|
64
|
-
# Start the comprehensive MCP server
|
|
65
|
-
enact-mcp-server
|
|
66
|
-
|
|
67
|
-
# Start the MCP server
|
|
68
|
-
enact-mcp
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Library Usage
|
|
72
|
-
```typescript
|
|
73
|
-
import { executeToolByName, searchTools } from 'enact-cli/dist/lib/enact-direct.js';
|
|
74
|
-
|
|
75
|
-
// Search for tools
|
|
76
|
-
const tools = await searchTools({ query: 'text processing', limit: 5 });
|
|
77
|
-
|
|
78
|
-
// Execute a tool
|
|
79
|
-
const result = await executeToolByName('author/tool-name', { input: 'data' });
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Available MCP Servers
|
|
83
|
-
|
|
84
|
-
This package provides multiple MCP server options:
|
|
85
|
-
|
|
86
|
-
| Command | Description | Best For |
|
|
87
|
-
|---------|-------------|----------|
|
|
88
|
-
| `enact-mcp` | Modern MCP server | All integrations |
|
|
89
|
-
|
|
90
|
-
## Development
|
|
91
|
-
|
|
92
|
-
This section provides instructions for setting up your development environment and contributing to the Enact CLI.
|
|
93
|
-
|
|
94
|
-
### Prerequisites
|
|
95
|
-
|
|
96
|
-
* **Bun:** This project is built using Bun. Ensure you have Bun installed on your system. You can find installation instructions on the [official Bun website](https://bun.sh/).
|
|
97
|
-
* **Node.js (optional):** While Bun is the primary runtime, having Node.js installed can be helpful for certain development tools. You can download it from [nodejs.org](https://nodejs.org/).
|
|
98
|
-
|
|
99
|
-
### Getting Started
|
|
100
|
-
|
|
101
|
-
1. **Clone the repository:**
|
|
102
|
-
```bash
|
|
103
|
-
git clone <repository-url>
|
|
104
|
-
cd enact-cli
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
2. **Install dependencies:**
|
|
108
|
-
```bash
|
|
109
|
-
bun install
|
|
110
|
-
```
|
|
111
|
-
This command will install all the necessary dependencies listed in your `package.json` file.
|
|
112
|
-
|
|
113
|
-
3. **Build and install locally:**
|
|
114
|
-
```bash
|
|
115
|
-
chmod +x deploy
|
|
116
|
-
./deploy
|
|
117
|
-
```
|
|
118
|
-
This creates a standalone binary and installs it to your PATH so you can use `enact` commands globally.
|
|
119
|
-
|
|
120
|
-
### Development Workflow
|
|
121
|
-
|
|
122
|
-
1. **Make changes:** Create a new branch for your feature or bug fix:
|
|
123
|
-
```bash
|
|
124
|
-
git checkout -b feature/your-feature-name
|
|
125
|
-
# or
|
|
126
|
-
git checkout -b bugfix/your-bug-fix
|
|
127
|
-
```
|
|
128
|
-
Make your code changes in the `src/` directory.
|
|
129
|
-
|
|
130
|
-
2. **Test during development:** You can run the CLI directly without building:
|
|
131
|
-
```bash
|
|
132
|
-
bun src/index.ts <command> [arguments] [options]
|
|
133
|
-
|
|
134
|
-
# Examples:
|
|
135
|
-
bun src/index.ts --help
|
|
136
|
-
bun src/index.ts publish
|
|
137
|
-
bun src/index.ts create my-tool
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
3. **Build and test the binary:** After making changes, rebuild and test:
|
|
141
|
-
```bash
|
|
142
|
-
./deploy
|
|
143
|
-
enact --version # Test the installed binary
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
4. **Run tests (when available):**
|
|
147
|
-
```bash
|
|
148
|
-
bun test
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
5. **Lint and format your code:**
|
|
152
|
-
```bash
|
|
153
|
-
bun run lint # Check for issues
|
|
154
|
-
bun run format # Format code
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
6. **Commit your changes:**
|
|
158
|
-
```bash
|
|
159
|
-
git add .
|
|
160
|
-
git commit -m "feat: Add your feature description"
|
|
161
|
-
```
|
|
162
|
-
Follow [conventional commit](https://conventionalcommits.org/) guidelines for better collaboration.
|
|
163
|
-
|
|
164
|
-
7. **Push and create PR:**
|
|
165
|
-
```bash
|
|
166
|
-
git push origin feature/your-feature-name
|
|
167
|
-
```
|
|
168
|
-
Then create a pull request on GitHub.
|
|
169
|
-
|
|
170
|
-
### Development Commands
|
|
171
|
-
|
|
172
|
-
| Command | Description |
|
|
173
|
-
|---------|-------------|
|
|
174
|
-
| `bun src/index.ts` | Run CLI directly from source |
|
|
175
|
-
| `./deploy` | Build and install binary to PATH |
|
|
176
|
-
| `bun test` | Run test suite |
|
|
177
|
-
| `bun run lint` | Check code style |
|
|
178
|
-
| `bun run format` | Format code |
|
|
179
|
-
|
|
180
|
-
### Project Structure
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
src/
|
|
184
|
-
├── index.ts # CLI entry point
|
|
185
|
-
├── commands/ # Command implementations
|
|
186
|
-
│ ├── publish.ts # Publish command
|
|
187
|
-
│ ├── create.ts # Create command
|
|
188
|
-
│ └── remote.ts # Remote management
|
|
189
|
-
└── utils/ # Shared utilities
|
|
190
|
-
├── help.ts # Help system
|
|
191
|
-
├── logger.ts # Logging utilities
|
|
192
|
-
├── config.ts # Configuration management
|
|
193
|
-
└── version.ts # Version display
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Building for Release
|
|
197
|
-
|
|
198
|
-
To build standalone binaries for distribution:
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# Single platform (current system)
|
|
202
|
-
bun build src/index.ts --compile --outfile=dist/enact
|
|
203
|
-
|
|
204
|
-
# Multiple platforms
|
|
205
|
-
bun build src/index.ts --compile --target=bun-linux-x64 --outfile=dist/enact-linux
|
|
206
|
-
bun build src/index.ts --compile --target=bun-darwin-x64 --outfile=dist/enact-macos
|
|
207
|
-
bun build src/index.ts --compile --target=bun-windows-x64 --outfile=dist/enact.exe
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Debugging
|
|
211
|
-
|
|
212
|
-
For debugging during development:
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
# Run with debug output
|
|
216
|
-
DEBUG=* bun src/index.ts <command>
|
|
217
|
-
|
|
218
|
-
# Or set log level in code
|
|
219
|
-
# See src/utils/logger.ts for LogLevel options
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Contributing Guidelines
|
|
223
|
-
|
|
224
|
-
- Follow TypeScript best practices
|
|
225
|
-
- Add tests for new features
|
|
226
|
-
- Update documentation for any CLI changes
|
|
227
|
-
- Use conventional commit messages
|
|
228
|
-
- Ensure the binary builds successfully before submitting PRs
|
|
229
|
-
|
|
230
|
-
### Troubleshooting
|
|
231
|
-
|
|
232
|
-
**Binary not found after build:**
|
|
233
|
-
- Ensure `~/.local/bin` is in your PATH
|
|
234
|
-
- Try restarting your terminal
|
|
235
|
-
- Run `source ~/.bashrc` (or your shell profile)
|
|
236
|
-
|
|
237
|
-
**Permission denied:**
|
|
238
|
-
- Make sure deploy script is executable: `chmod +x deploy`
|
|
239
|
-
- Check that `~/.local/bin` has write permissions
|
|
240
|
-
|
|
241
|
-
**Bun build fails:**
|
|
242
|
-
- Ensure you're using a recent version of Bun (`bun --version`)
|
|
243
|
-
- Check for TypeScript errors: `bun check src/index.ts`
|
package/dist/enact
DELETED
|
Binary file
|
package/dist/enact-linux
DELETED
|
Binary file
|
package/dist/enact-macos
DELETED
|
Binary file
|
package/dist/enact-windows.exe
DELETED
|
Binary file
|