@beads/bd 0.43.0 → 0.45.0
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/package.json +3 -2
- package/scripts/postinstall.js +56 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beads/bd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Beads issue tracker - lightweight memory system for coding agents with native binary support",
|
|
5
5
|
"main": "bin/bd.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"os": [
|
|
40
40
|
"darwin",
|
|
41
41
|
"linux",
|
|
42
|
-
"win32"
|
|
42
|
+
"win32",
|
|
43
|
+
"android"
|
|
43
44
|
],
|
|
44
45
|
"cpu": [
|
|
45
46
|
"x64",
|
package/scripts/postinstall.js
CHANGED
|
@@ -27,6 +27,9 @@ function getPlatformInfo() {
|
|
|
27
27
|
case 'linux':
|
|
28
28
|
platformName = 'linux';
|
|
29
29
|
break;
|
|
30
|
+
case 'android':
|
|
31
|
+
platformName = 'android';
|
|
32
|
+
break;
|
|
30
33
|
case 'win32':
|
|
31
34
|
platformName = 'windows';
|
|
32
35
|
binaryName = 'bd.exe';
|
|
@@ -109,7 +112,7 @@ function extractTarGz(tarGzPath, destDir, binaryName) {
|
|
|
109
112
|
throw new Error(`Binary not found after extraction: ${extractedBinary}`);
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
// Make executable on Unix-like systems
|
|
115
|
+
// Make executable on Unix-like systems (Linux, macOS, Android)
|
|
113
116
|
if (os.platform() !== 'win32') {
|
|
114
117
|
fs.chmodSync(extractedBinary, 0o755);
|
|
115
118
|
}
|
|
@@ -120,28 +123,53 @@ function extractTarGz(tarGzPath, destDir, binaryName) {
|
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
//
|
|
124
|
-
function
|
|
126
|
+
// Sleep helper for retry logic
|
|
127
|
+
function sleep(ms) {
|
|
128
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Extract zip file (for Windows) with retry logic
|
|
132
|
+
async function extractZip(zipPath, destDir, binaryName) {
|
|
125
133
|
console.log(`Extracting ${zipPath}...`);
|
|
126
134
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (os.platform() === 'win32') {
|
|
130
|
-
execSync(`powershell -command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`, { stdio: 'inherit' });
|
|
131
|
-
} else {
|
|
132
|
-
execSync(`unzip -o "${zipPath}" -d "${destDir}"`, { stdio: 'inherit' });
|
|
133
|
-
}
|
|
135
|
+
const maxRetries = 5;
|
|
136
|
+
const baseDelayMs = 500;
|
|
134
137
|
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
139
|
+
try {
|
|
140
|
+
// Use unzip command or powershell on Windows
|
|
141
|
+
if (os.platform() === 'win32') {
|
|
142
|
+
execSync(`powershell -command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`, { stdio: 'inherit' });
|
|
143
|
+
} else {
|
|
144
|
+
execSync(`unzip -o "${zipPath}" -d "${destDir}"`, { stdio: 'inherit' });
|
|
145
|
+
}
|
|
137
146
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
147
|
+
// The binary should now be in destDir
|
|
148
|
+
const extractedBinary = path.join(destDir, binaryName);
|
|
141
149
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
if (!fs.existsSync(extractedBinary)) {
|
|
151
|
+
throw new Error(`Binary not found after extraction: ${extractedBinary}`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
console.log(`Binary extracted to: ${extractedBinary}`);
|
|
155
|
+
return; // Success
|
|
156
|
+
} catch (err) {
|
|
157
|
+
const isFileLockError = err.message && (
|
|
158
|
+
err.message.includes('being used by another process') ||
|
|
159
|
+
err.message.includes('Access is denied') ||
|
|
160
|
+
err.message.includes('cannot access the file')
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
if (isFileLockError && attempt < maxRetries) {
|
|
164
|
+
const delayMs = baseDelayMs * Math.pow(2, attempt - 1);
|
|
165
|
+
console.log(`File may be locked (attempt ${attempt}/${maxRetries}). Retrying in ${delayMs}ms...`);
|
|
166
|
+
await sleep(delayMs);
|
|
167
|
+
} else if (attempt === maxRetries) {
|
|
168
|
+
throw new Error(`Failed to extract archive after ${maxRetries} attempts: ${err.message}`);
|
|
169
|
+
} else {
|
|
170
|
+
throw new Error(`Failed to extract archive: ${err.message}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
145
173
|
}
|
|
146
174
|
}
|
|
147
175
|
|
|
@@ -152,16 +180,8 @@ async function install() {
|
|
|
152
180
|
|
|
153
181
|
console.log(`Installing bd v${VERSION} for ${platformName}-${archName}...`);
|
|
154
182
|
|
|
155
|
-
// Construct download URL
|
|
156
|
-
// Format: https://github.com/steveyegge/beads/releases/download/v0.21.5/beads_0.21.5_darwin_amd64.tar.gz
|
|
157
|
-
const releaseVersion = VERSION;
|
|
158
|
-
const archiveExt = platformName === 'windows' ? 'zip' : 'tar.gz';
|
|
159
|
-
const archiveName = `beads_${releaseVersion}_${platformName}_${archName}.${archiveExt}`;
|
|
160
|
-
const downloadUrl = `https://github.com/steveyegge/beads/releases/download/v${releaseVersion}/${archiveName}`;
|
|
161
|
-
|
|
162
183
|
// Determine destination paths
|
|
163
184
|
const binDir = path.join(__dirname, '..', 'bin');
|
|
164
|
-
const archivePath = path.join(binDir, archiveName);
|
|
165
185
|
const binaryPath = path.join(binDir, binaryName);
|
|
166
186
|
|
|
167
187
|
// Ensure bin directory exists
|
|
@@ -169,13 +189,21 @@ async function install() {
|
|
|
169
189
|
fs.mkdirSync(binDir, { recursive: true });
|
|
170
190
|
}
|
|
171
191
|
|
|
192
|
+
// Construct download URL
|
|
193
|
+
// Format: https://github.com/steveyegge/beads/releases/download/v0.21.5/beads_0.21.5_darwin_amd64.tar.gz
|
|
194
|
+
const releaseVersion = VERSION;
|
|
195
|
+
const archiveExt = platformName === 'windows' ? 'zip' : 'tar.gz';
|
|
196
|
+
const archiveName = `beads_${releaseVersion}_${platformName}_${archName}.${archiveExt}`;
|
|
197
|
+
const downloadUrl = `https://github.com/steveyegge/beads/releases/download/v${releaseVersion}/${archiveName}`;
|
|
198
|
+
const archivePath = path.join(binDir, archiveName);
|
|
199
|
+
|
|
172
200
|
// Download the archive
|
|
173
201
|
console.log(`Downloading bd binary...`);
|
|
174
202
|
await downloadFile(downloadUrl, archivePath);
|
|
175
203
|
|
|
176
204
|
// Extract the archive based on platform
|
|
177
205
|
if (platformName === 'windows') {
|
|
178
|
-
extractZip(archivePath, binDir, binaryName);
|
|
206
|
+
await extractZip(archivePath, binDir, binaryName);
|
|
179
207
|
} else {
|
|
180
208
|
extractTarGz(archivePath, binDir, binaryName);
|
|
181
209
|
}
|
|
@@ -188,7 +216,7 @@ async function install() {
|
|
|
188
216
|
const output = execSync(`"${binaryPath}" version`, { encoding: 'utf8' });
|
|
189
217
|
console.log(`✓ bd installed successfully: ${output.trim()}`);
|
|
190
218
|
} catch (err) {
|
|
191
|
-
|
|
219
|
+
throw new Error(`Binary verification failed: ${err.message}`);
|
|
192
220
|
}
|
|
193
221
|
|
|
194
222
|
} catch (err) {
|