clawdepl 0.0.1
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/LICENSE +21 -0
- package/README.md +50 -0
- package/bin/clawdepl.js +76 -0
- package/bin/install.js +212 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 clawdepl
|
|
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 notice 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,50 @@
|
|
|
1
|
+
# clawdepl
|
|
2
|
+
|
|
3
|
+
Create and manage OpenClaw AI Agent orchestrator instances from the command line.
|
|
4
|
+
|
|
5
|
+
This is the npm distribution of clawdepl. For full documentation, see the [main repository](https://github.com/clawdepl/clawdepl).
|
|
6
|
+
|
|
7
|
+
## Quick Start (No Install)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx clawdepl init my-project
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g clawdepl
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Create a new OpenClaw project
|
|
23
|
+
clawdepl init my-project
|
|
24
|
+
|
|
25
|
+
# Deploy to hosted infrastructure
|
|
26
|
+
clawdepl deploy
|
|
27
|
+
|
|
28
|
+
# Check instance status
|
|
29
|
+
clawdepl status
|
|
30
|
+
|
|
31
|
+
# Get help
|
|
32
|
+
clawdepl --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## How It Works
|
|
36
|
+
|
|
37
|
+
This package is a thin wrapper around the clawdepl Go binary. On installation, it automatically downloads the appropriate binary for your platform from GitHub Releases.
|
|
38
|
+
|
|
39
|
+
Supported platforms:
|
|
40
|
+
- Linux (x64, arm64)
|
|
41
|
+
- macOS (x64, arm64)
|
|
42
|
+
- Windows (x64, arm64)
|
|
43
|
+
|
|
44
|
+
## Environment Variables
|
|
45
|
+
|
|
46
|
+
- `CLAWDEPL_BINARY_PATH`: Override the path to the clawdepl binary
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT - see [LICENSE](https://github.com/clawdepl/clawdepl/blob/main/LICENSE)
|
package/bin/clawdepl.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get the path to the clawdepl binary for the current platform
|
|
10
|
+
*/
|
|
11
|
+
function getBinaryPath() {
|
|
12
|
+
const platform = os.platform();
|
|
13
|
+
let binaryName = "clawdepl";
|
|
14
|
+
if (platform === "win32") {
|
|
15
|
+
binaryName += ".exe";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 1. Check for binary in the same directory as this script (installed by postinstall)
|
|
19
|
+
const localBinary = path.join(__dirname, binaryName);
|
|
20
|
+
if (fs.existsSync(localBinary)) {
|
|
21
|
+
return localBinary;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 2. Check for development binary in project root
|
|
25
|
+
const devBinary = path.join(__dirname, "..", "..", binaryName);
|
|
26
|
+
if (fs.existsSync(devBinary)) {
|
|
27
|
+
return devBinary;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 3. Check for binary via CLAWDEPL_BINARY_PATH env var (useful for testing)
|
|
31
|
+
if (process.env.CLAWDEPL_BINARY_PATH && fs.existsSync(process.env.CLAWDEPL_BINARY_PATH)) {
|
|
32
|
+
return process.env.CLAWDEPL_BINARY_PATH;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 4. Fall back to PATH lookup
|
|
36
|
+
return binaryName;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Run the clawdepl binary with the provided arguments
|
|
41
|
+
*/
|
|
42
|
+
function run() {
|
|
43
|
+
const binaryPath = getBinaryPath();
|
|
44
|
+
const args = process.argv.slice(2);
|
|
45
|
+
|
|
46
|
+
const child = spawn(binaryPath, args, {
|
|
47
|
+
stdio: "inherit",
|
|
48
|
+
shell: process.platform === "win32",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
child.on("error", (err) => {
|
|
52
|
+
if (err.code === "ENOENT") {
|
|
53
|
+
console.error("Error: clawdepl binary not found.");
|
|
54
|
+
console.error("");
|
|
55
|
+
console.error("The binary was not bundled with this package and is not in your PATH.");
|
|
56
|
+
console.error("");
|
|
57
|
+
console.error("Install the binary using one of these methods:");
|
|
58
|
+
console.error("");
|
|
59
|
+
console.error(" # Install from source (requires Go 1.21+):");
|
|
60
|
+
console.error(" go install github.com/clawdepl/clawdepl@latest");
|
|
61
|
+
console.error("");
|
|
62
|
+
console.error(" # Or set CLAWDEPL_BINARY_PATH to point to the binary:");
|
|
63
|
+
console.error(" export CLAWDEPL_BINARY_PATH=/path/to/clawdepl");
|
|
64
|
+
console.error("");
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
console.error("Error running clawdepl:", err.message);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
child.on("close", (code) => {
|
|
72
|
+
process.exit(code ?? 0);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
run();
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const { execSync, spawn } = require("child_process");
|
|
8
|
+
const zlib = require("zlib");
|
|
9
|
+
|
|
10
|
+
const VERSION = require("../package.json").version;
|
|
11
|
+
const REPO = "clawdepl/clawdepl";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get platform-specific binary info
|
|
15
|
+
*/
|
|
16
|
+
function getPlatformInfo() {
|
|
17
|
+
const platform = os.platform();
|
|
18
|
+
const arch = os.arch();
|
|
19
|
+
|
|
20
|
+
const platformMap = {
|
|
21
|
+
darwin: "darwin",
|
|
22
|
+
linux: "linux",
|
|
23
|
+
win32: "windows",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const archMap = {
|
|
27
|
+
x64: "amd64",
|
|
28
|
+
arm64: "arm64",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const osPlatform = platformMap[platform];
|
|
32
|
+
const osArch = archMap[arch];
|
|
33
|
+
|
|
34
|
+
if (!osPlatform || !osArch) {
|
|
35
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const ext = platform === "win32" ? ".exe" : "";
|
|
39
|
+
const binaryName = `clawdepl${ext}`;
|
|
40
|
+
const archiveName = `clawdepl_${VERSION}_${osPlatform}_${osArch}.tar.gz`;
|
|
41
|
+
|
|
42
|
+
return { platform: osPlatform, arch: osArch, binaryName, archiveName, ext };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Follow redirects and download file
|
|
47
|
+
*/
|
|
48
|
+
function downloadFile(url) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const makeRequest = (currentUrl, redirectCount = 0) => {
|
|
51
|
+
if (redirectCount > 10) {
|
|
52
|
+
reject(new Error("Too many redirects"));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const protocol = currentUrl.startsWith("https") ? https : require("http");
|
|
57
|
+
|
|
58
|
+
protocol.get(currentUrl, {
|
|
59
|
+
headers: {
|
|
60
|
+
"User-Agent": "clawdepl-npm-installer",
|
|
61
|
+
"Accept": "application/octet-stream",
|
|
62
|
+
}
|
|
63
|
+
}, (response) => {
|
|
64
|
+
if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
65
|
+
makeRequest(response.headers.location, redirectCount + 1);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (response.statusCode !== 200) {
|
|
70
|
+
reject(new Error(`Download failed with status ${response.statusCode}`));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const chunks = [];
|
|
75
|
+
response.on("data", (chunk) => chunks.push(chunk));
|
|
76
|
+
response.on("end", () => resolve(Buffer.concat(chunks)));
|
|
77
|
+
response.on("error", reject);
|
|
78
|
+
}).on("error", reject);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
makeRequest(url);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Extract tar.gz archive
|
|
87
|
+
*/
|
|
88
|
+
async function extractTarGz(buffer, destDir, binaryName) {
|
|
89
|
+
const tar = require("tar");
|
|
90
|
+
const tmpFile = path.join(os.tmpdir(), `clawdepl-${Date.now()}.tar.gz`);
|
|
91
|
+
|
|
92
|
+
fs.writeFileSync(tmpFile, buffer);
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
await tar.extract({
|
|
96
|
+
file: tmpFile,
|
|
97
|
+
cwd: destDir,
|
|
98
|
+
filter: (p) => p === binaryName || p.endsWith(`/${binaryName}`),
|
|
99
|
+
});
|
|
100
|
+
} finally {
|
|
101
|
+
fs.unlinkSync(tmpFile);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Simple tar extraction without external dependency
|
|
107
|
+
*/
|
|
108
|
+
function extractTarGzSimple(buffer, destDir, binaryName) {
|
|
109
|
+
return new Promise((resolve, reject) => {
|
|
110
|
+
const gunzip = zlib.createGunzip();
|
|
111
|
+
const chunks = [];
|
|
112
|
+
|
|
113
|
+
gunzip.on("data", (chunk) => chunks.push(chunk));
|
|
114
|
+
gunzip.on("end", () => {
|
|
115
|
+
const tarData = Buffer.concat(chunks);
|
|
116
|
+
|
|
117
|
+
// Simple tar parsing - find the binary file
|
|
118
|
+
let offset = 0;
|
|
119
|
+
while (offset < tarData.length) {
|
|
120
|
+
// Read header (512 bytes)
|
|
121
|
+
const header = tarData.slice(offset, offset + 512);
|
|
122
|
+
if (header[0] === 0) break; // End of archive
|
|
123
|
+
|
|
124
|
+
// Get filename (first 100 bytes, null-terminated)
|
|
125
|
+
let nameEnd = 0;
|
|
126
|
+
while (nameEnd < 100 && header[nameEnd] !== 0) nameEnd++;
|
|
127
|
+
const name = header.slice(0, nameEnd).toString("utf8");
|
|
128
|
+
|
|
129
|
+
// Get file size (octal, bytes 124-135)
|
|
130
|
+
const sizeStr = header.slice(124, 136).toString("utf8").trim();
|
|
131
|
+
const size = parseInt(sizeStr, 8) || 0;
|
|
132
|
+
|
|
133
|
+
offset += 512; // Move past header
|
|
134
|
+
|
|
135
|
+
// Check if this is our binary
|
|
136
|
+
if (name === binaryName || name.endsWith(`/${binaryName}`)) {
|
|
137
|
+
const fileData = tarData.slice(offset, offset + size);
|
|
138
|
+
const destPath = path.join(destDir, binaryName);
|
|
139
|
+
fs.writeFileSync(destPath, fileData);
|
|
140
|
+
fs.chmodSync(destPath, 0o755);
|
|
141
|
+
resolve(destPath);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Move to next file (size rounded up to 512-byte boundary)
|
|
146
|
+
offset += Math.ceil(size / 512) * 512;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
reject(new Error(`Binary ${binaryName} not found in archive`));
|
|
150
|
+
});
|
|
151
|
+
gunzip.on("error", reject);
|
|
152
|
+
|
|
153
|
+
gunzip.end(buffer);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Download and install the binary
|
|
159
|
+
*/
|
|
160
|
+
async function downloadBinary() {
|
|
161
|
+
const { binaryName, archiveName } = getPlatformInfo();
|
|
162
|
+
const binDir = __dirname;
|
|
163
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
164
|
+
|
|
165
|
+
// Skip if binary already exists
|
|
166
|
+
if (fs.existsSync(binaryPath)) {
|
|
167
|
+
console.log("clawdepl binary already installed.");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Check for local development binary (in project root)
|
|
172
|
+
const devBinary = path.join(__dirname, "..", "..", binaryName);
|
|
173
|
+
if (fs.existsSync(devBinary)) {
|
|
174
|
+
console.log("Using local development binary.");
|
|
175
|
+
fs.copyFileSync(devBinary, binaryPath);
|
|
176
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${archiveName}`;
|
|
181
|
+
|
|
182
|
+
console.log(`Downloading clawdepl v${VERSION}...`);
|
|
183
|
+
console.log(`Platform: ${os.platform()}-${os.arch()}`);
|
|
184
|
+
console.log(`URL: ${downloadUrl}`);
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
const buffer = await downloadFile(downloadUrl);
|
|
188
|
+
console.log(`Downloaded ${buffer.length} bytes, extracting...`);
|
|
189
|
+
|
|
190
|
+
await extractTarGzSimple(buffer, binDir, binaryName);
|
|
191
|
+
|
|
192
|
+
console.log(`Successfully installed clawdepl to ${binaryPath}`);
|
|
193
|
+
} catch (err) {
|
|
194
|
+
console.warn("");
|
|
195
|
+
console.warn(`Note: Could not download pre-built binary: ${err.message}`);
|
|
196
|
+
console.warn("");
|
|
197
|
+
console.warn("This is expected if:");
|
|
198
|
+
console.warn(" - This version hasn't been released yet");
|
|
199
|
+
console.warn(" - You're on an unsupported platform");
|
|
200
|
+
console.warn("");
|
|
201
|
+
console.warn("The CLI will look for 'clawdepl' in your PATH at runtime.");
|
|
202
|
+
console.warn("Install from source: go install github.com/clawdepl/clawdepl@latest");
|
|
203
|
+
console.warn("");
|
|
204
|
+
// Don't fail the install - the wrapper will handle missing binary at runtime
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
downloadBinary().catch((err) => {
|
|
209
|
+
console.error("Installation warning:", err.message);
|
|
210
|
+
// Exit 0 to not fail npm install - wrapper handles missing binary gracefully
|
|
211
|
+
process.exit(0);
|
|
212
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "clawdepl",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Create and manage OpenClaw AI Agent orchestrator instances",
|
|
5
|
+
"bin": {
|
|
6
|
+
"clawdepl": "./bin/clawdepl.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node ./bin/install.js",
|
|
10
|
+
"test": "node ./bin/clawdepl.js --version"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"openclaw",
|
|
14
|
+
"ai",
|
|
15
|
+
"agents",
|
|
16
|
+
"orchestrator",
|
|
17
|
+
"cli",
|
|
18
|
+
"clawdepl",
|
|
19
|
+
"clawdepl"
|
|
20
|
+
],
|
|
21
|
+
"author": "clawdepl",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/clawdepl/clawdepl.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/clawdepl/clawdepl/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/clawdepl/clawdepl#readme",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=16.0.0"
|
|
33
|
+
},
|
|
34
|
+
"os": [
|
|
35
|
+
"darwin",
|
|
36
|
+
"linux",
|
|
37
|
+
"win32"
|
|
38
|
+
],
|
|
39
|
+
"cpu": [
|
|
40
|
+
"x64",
|
|
41
|
+
"arm64"
|
|
42
|
+
],
|
|
43
|
+
"files": [
|
|
44
|
+
"bin/",
|
|
45
|
+
"README.md",
|
|
46
|
+
"LICENSE"
|
|
47
|
+
],
|
|
48
|
+
"preferGlobal": true
|
|
49
|
+
}
|