alurkerja-cli 1.0.2 → 1.0.3

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/index.js CHANGED
@@ -56,7 +56,8 @@ function getVersion() {
56
56
  */
57
57
  async function downloadBinary(version, platform) {
58
58
  const binaryName = `alurkerja-${platform.os}-${platform.arch}${platform.os === 'windows' ? '.exe' : ''}`;
59
- const downloadUrl = `${GITLAB_BASE}/-/raw/master/dist/${binaryName}`;
59
+ // Use GitLab raw file download with correct parameters
60
+ const downloadUrl = `${GITLAB_BASE}/-/raw/master/dist/${binaryName}?ref_type=heads&inline=false`;
60
61
 
61
62
  console.log(`📥 Downloading Alurkerja CLI ${version}...`);
62
63
 
@@ -141,6 +142,16 @@ async function downloadBinary(version, platform) {
141
142
  }
142
143
  }
143
144
 
145
+ // Validate the downloaded file
146
+ const stats = fs.statSync(tempPath);
147
+ if (stats.size < 1000) {
148
+ // File too small, likely an error page
149
+ const content = fs.readFileSync(tempPath, 'utf8');
150
+ try { fs.unlinkSync(tempPath); } catch {}
151
+ reject(new Error(`Download failed: received invalid file (${stats.size} bytes)`));
152
+ return;
153
+ }
154
+
144
155
  // Rename temp file to final path
145
156
  try {
146
157
  // Remove old binary if exists
@@ -218,6 +229,8 @@ async function bootstrap() {
218
229
  if (needsDownload) {
219
230
  await downloadBinary(version, platform);
220
231
  console.log(`✅ Alurkerja CLI ${version} ready!`);
232
+ // Small delay to ensure file system sync after download
233
+ await new Promise(resolve => setTimeout(resolve, 100));
221
234
  }
222
235
 
223
236
  // Execute the binary with all arguments passed to this script
package/index.js.backup CHANGED
@@ -56,7 +56,8 @@ function getVersion() {
56
56
  */
57
57
  async function downloadBinary(version, platform) {
58
58
  const binaryName = `alurkerja-${platform.os}-${platform.arch}${platform.os === 'windows' ? '.exe' : ''}`;
59
- const downloadUrl = `${GITLAB_BASE}/-/raw/master/dist/${binaryName}`;
59
+ // Use GitLab raw file download with correct parameters
60
+ const downloadUrl = `${GITLAB_BASE}/-/raw/master/dist/${binaryName}?ref_type=heads&inline=false`;
60
61
 
61
62
  console.log(`📥 Downloading Alurkerja CLI ${version}...`);
62
63
 
@@ -141,6 +142,16 @@ async function downloadBinary(version, platform) {
141
142
  }
142
143
  }
143
144
 
145
+ // Validate the downloaded file
146
+ const stats = fs.statSync(tempPath);
147
+ if (stats.size < 1000) {
148
+ // File too small, likely an error page
149
+ const content = fs.readFileSync(tempPath, 'utf8');
150
+ try { fs.unlinkSync(tempPath); } catch {}
151
+ reject(new Error(`Download failed: received invalid file (${stats.size} bytes)`));
152
+ return;
153
+ }
154
+
144
155
  // Rename temp file to final path
145
156
  try {
146
157
  // Remove old binary if exists
@@ -218,6 +229,8 @@ async function bootstrap() {
218
229
  if (needsDownload) {
219
230
  await downloadBinary(version, platform);
220
231
  console.log(`✅ Alurkerja CLI ${version} ready!`);
232
+ // Small delay to ensure file system sync after download
233
+ await new Promise(resolve => setTimeout(resolve, 100));
221
234
  }
222
235
 
223
236
  // Execute the binary with all arguments passed to this script
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alurkerja-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Alurkerja CLI - npx wrapper for Go binary",
5
5
  "main": "index.js",
6
6
  "private": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alurkerja-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Alurkerja CLI - npx wrapper for Go binary",
5
5
  "main": "index.js",
6
6
  "private": false,