enact-cli 1.0.11 → 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 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,80 +1,24 @@
1
1
  {
2
2
  "name": "enact-cli",
3
- "version": "1.0.11",
4
- "description": "Official CLI for the Enact Protocol - package, secure, and discover AI tools",
5
- "type": "module",
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
- "src/web/static/**/*",
14
- "README.md",
15
- "LICENSE"
16
- ],
17
- "scripts": {
18
- "build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/mcp-server.ts --outdir ./dist --target node && mkdir -p ./dist/web && cp -r ./src/web/static ./dist/web/ && 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",
19
- "build:mcp": "bun build ./src/mcp-server.ts --outdir ./dist --target node",
20
- "start:mcp": "node ./dist/mcp-server.js",
21
- "dev:mcp": "bun run --watch src/mcp-server.ts",
22
- "dev:mcp-server": "bun run --watch src/mcp-server.ts",
23
- "test": "bun test",
24
- "test:watch": "bun test --watch",
25
- "test:cleanup": "node scripts/cleanup-test-dirs.js",
26
- "prepublishOnly": "npm run build",
27
- "start": "bun ./dist/index.js",
28
- "dev": "bun run --watch src/index.ts",
29
- "dev:cmd": "bun src/index.ts",
30
- "test:coverage": "vitest --coverage",
31
- "lint": "bunx @biomejs/biome lint ./src",
32
- "format": "bunx @biomejs/biome format --write ./src",
33
- "build:binary": "bun build ./src/index.ts --compile --outfile enact",
34
- "build:all": "npm run build:linux && npm run build:macos && npm run build:windows",
35
- "build:linux": "bun build ./src/index.ts --compile --target=bun-linux-x64 --outfile dist/enact-linux",
36
- "build:macos": "bun build ./src/index.ts --compile --target=bun-darwin-x64 --outfile dist/enact-macos",
37
- "build:windows": "bun build ./src/index.ts --compile --target=bun-windows-x64 --outfile dist/enact-windows.exe",
38
- "release": "npm run build:all && npm run build"
39
- },
40
- "keywords": [
41
- "cli",
42
- "enact",
43
- "enact-protocol",
44
- "ai-tools",
45
- "mcp",
46
- "model-context-protocol",
47
- "tool-discovery",
48
- "command-line-tool"
49
- ],
50
- "author": "EnactProtocol",
51
- "license": "MIT",
3
+ "version": "2.0.10",
4
+ "description": "Enact CLI (thin wrapper that loads the correct platform binary)",
5
+ "license": "Apache-2.0",
52
6
  "repository": {
53
7
  "type": "git",
54
- "url": "https://github.com/EnactProtocol/enact-cli.git"
8
+ "url": "https://github.com/EnactProtocol/enact.git",
9
+ "directory": "packages/enact"
55
10
  },
56
- "bugs": {
57
- "url": "https://github.com/EnactProtocol/enact-cli/issues"
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"
58
20
  },
59
- "homepage": "https://github.com/EnactProtocol/enact-cli#readme",
60
21
  "engines": {
61
22
  "node": ">=18.0.0"
62
- },
63
- "devDependencies": {
64
- "@types/node": "^20.12.12",
65
- "@vitest/coverage-v8": "^2.0.0",
66
- "bun-types": "latest",
67
- "typescript": "^5.4.5",
68
- "vitest": "^2.0.0"
69
- },
70
- "dependencies": {
71
- "@clack/core": "^0.4.2",
72
- "@clack/prompts": "^0.10.1",
73
- "@modelcontextprotocol/sdk": "^1.13.0",
74
- "dotenv": "^16.5.0",
75
- "picocolors": "^1.1.1",
76
- "strip-ansi": "^7.1.0",
77
- "yaml": "^2.8.0",
78
- "zod": "^3.25.67"
79
23
  }
80
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,277 +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** - **Mandatory cryptographic signing and verification** for all tool execution
11
- - 🎯 **MCP Integration** - Full Model Context Protocol support
12
- - 🚀 **Direct Library** - Use as a library in your applications
13
- - 🌐 **Environment Manager** - Web-based interface for managing environment variables
14
-
15
- ## Installation
16
-
17
- ### For End Users
18
-
19
- ```bash
20
- # Install globally
21
- npm install -g enact-cli
22
-
23
- # Now you can use:
24
- enact search --tags web,api
25
- enact exec author/tool-name
26
- enact-mcp-server # Start MCP server
27
- ```
28
-
29
- ### For MCP (Model Context Protocol) Users
30
-
31
- After installation, you can use Enact with any MCP client:
32
-
33
- ```bash
34
- # With MCP Inspector
35
- npx @modelcontextprotocol/inspector enact-mcp-server
36
-
37
- # In Claude Desktop (add to config)
38
- {
39
- "mcpServers": {
40
- "enact": {
41
- "command": "enact-mcp-server"
42
- }
43
- }
44
- }
45
- ```
46
-
47
- See [MCP_USAGE.md](./MCP_USAGE.md) for detailed MCP integration guide.
48
-
49
- ## Quick Start
50
-
51
- ### CLI Usage
52
- ```bash
53
- # Search for tools
54
- enact search "text processing"
55
-
56
- # Get help
57
- enact --help
58
-
59
- # Execute a tool
60
- enact exec author/tool-name --input '{"key": "value"}'
61
- ```
62
-
63
- ### MCP Server Usage
64
- ```bash
65
- # Start the comprehensive MCP server (includes web-based environment manager)
66
- enact-mcp-server
67
-
68
- # Start the MCP server
69
- enact-mcp
70
- ```
71
-
72
- #### Environment Manager Web Interface
73
-
74
- The MCP server includes a built-in web interface for managing environment variables:
75
-
76
- - **URL**: `http://localhost:5555` (when MCP server is running)
77
- - **Features**: Package-based environment variable management
78
- - **File Structure**: `~/.enact/env/{namespace}/.env`
79
-
80
- See [ENVIRONMENT_MANAGER.md](./ENVIRONMENT_MANAGER.md) for detailed usage instructions.
81
-
82
- ## Security
83
-
84
- 🔐 **Mandatory Signature Verification** - All tools must be cryptographically signed and verified before execution.
85
-
86
- **Verification Policies:**
87
- - `permissive` - Require 1+ valid signatures (default)
88
- - `enterprise` - Require author + reviewer signatures
89
- - `paranoid` - Require author + reviewer + approver signatures
90
-
91
- **Example Usage:**
92
- ```bash
93
- # Tools are automatically verified before execution
94
- enact exec my-org/secure-tool
95
-
96
- # Use strict enterprise policy
97
- enact exec critical-tool --verify-policy enterprise
98
-
99
- # Sign your own tools
100
- enact sign sign my-tool.yaml --role author
101
- ```
102
-
103
- 📋 **See [MANDATORY_SIGNATURE_VERIFICATION.md](./MANDATORY_SIGNATURE_VERIFICATION.md) for complete security documentation.**
104
-
105
- ### Library Usage
106
- ```typescript
107
- import { executeToolByName, searchTools } from 'enact-cli/dist/lib/enact-direct.js';
108
-
109
- // Search for tools
110
- const tools = await searchTools({ query: 'text processing', limit: 5 });
111
-
112
- // Execute a tool
113
- const result = await executeToolByName('author/tool-name', { input: 'data' });
114
- ```
115
-
116
- ## Available MCP Servers
117
-
118
- This package provides multiple MCP server options:
119
-
120
- | Command | Description | Best For |
121
- |---------|-------------|----------|
122
- | `enact-mcp` | Modern MCP server | All integrations |
123
-
124
- ## Development
125
-
126
- This section provides instructions for setting up your development environment and contributing to the Enact CLI.
127
-
128
- ### Prerequisites
129
-
130
- * **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/).
131
- * **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/).
132
-
133
- ### Getting Started
134
-
135
- 1. **Clone the repository:**
136
- ```bash
137
- git clone <repository-url>
138
- cd enact-cli
139
- ```
140
-
141
- 2. **Install dependencies:**
142
- ```bash
143
- bun install
144
- ```
145
- This command will install all the necessary dependencies listed in your `package.json` file.
146
-
147
- 3. **Build and install locally:**
148
- ```bash
149
- chmod +x deploy
150
- ./deploy
151
- ```
152
- This creates a standalone binary and installs it to your PATH so you can use `enact` commands globally.
153
-
154
- ### Development Workflow
155
-
156
- 1. **Make changes:** Create a new branch for your feature or bug fix:
157
- ```bash
158
- git checkout -b feature/your-feature-name
159
- # or
160
- git checkout -b bugfix/your-bug-fix
161
- ```
162
- Make your code changes in the `src/` directory.
163
-
164
- 2. **Test during development:** You can run the CLI directly without building:
165
- ```bash
166
- bun src/index.ts <command> [arguments] [options]
167
-
168
- # Examples:
169
- bun src/index.ts --help
170
- bun src/index.ts publish
171
- bun src/index.ts create my-tool
172
- ```
173
-
174
- 3. **Build and test the binary:** After making changes, rebuild and test:
175
- ```bash
176
- ./deploy
177
- enact --version # Test the installed binary
178
- ```
179
-
180
- 4. **Run tests (when available):**
181
- ```bash
182
- bun test
183
- ```
184
-
185
- 5. **Lint and format your code:**
186
- ```bash
187
- bun run lint # Check for issues
188
- bun run format # Format code
189
- ```
190
-
191
- 6. **Commit your changes:**
192
- ```bash
193
- git add .
194
- git commit -m "feat: Add your feature description"
195
- ```
196
- Follow [conventional commit](https://conventionalcommits.org/) guidelines for better collaboration.
197
-
198
- 7. **Push and create PR:**
199
- ```bash
200
- git push origin feature/your-feature-name
201
- ```
202
- Then create a pull request on GitHub.
203
-
204
- ### Development Commands
205
-
206
- | Command | Description |
207
- |---------|-------------|
208
- | `bun src/index.ts` | Run CLI directly from source |
209
- | `./deploy` | Build and install binary to PATH |
210
- | `bun test` | Run test suite |
211
- | `bun run lint` | Check code style |
212
- | `bun run format` | Format code |
213
-
214
- ### Project Structure
215
-
216
- ```
217
- src/
218
- ├── index.ts # CLI entry point
219
- ├── commands/ # Command implementations
220
- │ ├── publish.ts # Publish command
221
- │ ├── create.ts # Create command
222
- │ └── remote.ts # Remote management
223
- └── utils/ # Shared utilities
224
- ├── help.ts # Help system
225
- ├── logger.ts # Logging utilities
226
- ├── config.ts # Configuration management
227
- └── version.ts # Version display
228
- ```
229
-
230
- ### Building for Release
231
-
232
- To build standalone binaries for distribution:
233
-
234
- ```bash
235
- # Single platform (current system)
236
- bun build src/index.ts --compile --outfile=dist/enact
237
-
238
- # Multiple platforms
239
- bun build src/index.ts --compile --target=bun-linux-x64 --outfile=dist/enact-linux
240
- bun build src/index.ts --compile --target=bun-darwin-x64 --outfile=dist/enact-macos
241
- bun build src/index.ts --compile --target=bun-windows-x64 --outfile=dist/enact.exe
242
- ```
243
-
244
- ### Debugging
245
-
246
- For debugging during development:
247
-
248
- ```bash
249
- # Run with debug output
250
- DEBUG=* bun src/index.ts <command>
251
-
252
- # Or set log level in code
253
- # See src/utils/logger.ts for LogLevel options
254
- ```
255
-
256
- ### Contributing Guidelines
257
-
258
- - Follow TypeScript best practices
259
- - Add tests for new features
260
- - Update documentation for any CLI changes
261
- - Use conventional commit messages
262
- - Ensure the binary builds successfully before submitting PRs
263
-
264
- ### Troubleshooting
265
-
266
- **Binary not found after build:**
267
- - Ensure `~/.local/bin` is in your PATH
268
- - Try restarting your terminal
269
- - Run `source ~/.bashrc` (or your shell profile)
270
-
271
- **Permission denied:**
272
- - Make sure deploy script is executable: `chmod +x deploy`
273
- - Check that `~/.local/bin` has write permissions
274
-
275
- **Bun build fails:**
276
- - Ensure you're using a recent version of Bun (`bun --version`)
277
- - Check for TypeScript errors: `bun check src/index.ts`