iteratr 0.3.2 → 0.3.4

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.
Files changed (2) hide show
  1. package/bin/iteratr +11 -5
  2. package/package.json +1 -1
package/bin/iteratr CHANGED
@@ -50,25 +50,31 @@ async function install() {
50
50
  const filename = `${BINARY}_${version}_${platform}_${arch}.${ext}`;
51
51
  const url = `https://github.com/${REPO}/releases/download/v${version}/${filename}`;
52
52
  const archivePath = path.join(binDir, filename);
53
+ // Extract to temp dir to avoid overwriting this JS wrapper script
54
+ const tempDir = path.join(binDir, ".tmp-extract");
53
55
 
54
56
  console.log(`Installing ${BINARY} v${version} (${platform}/${arch})...`);
55
57
 
56
58
  await download(url, archivePath);
57
59
 
60
+ // Create temp extraction directory
61
+ fs.mkdirSync(tempDir, { recursive: true });
62
+
58
63
  if (platform === "windows") {
59
- spawnSync("powershell", ["-Command", `Expand-Archive -Path "${archivePath}" -DestinationPath "${binDir}" -Force`]);
64
+ spawnSync("powershell", ["-Command", `Expand-Archive -Path "${archivePath}" -DestinationPath "${tempDir}" -Force`]);
60
65
  } else {
61
- spawnSync("tar", ["-xzf", archivePath, "-C", binDir]);
66
+ spawnSync("tar", ["-xzf", archivePath, "-C", tempDir]);
62
67
  }
63
68
 
64
- // Rename extracted binary
65
- const extractedPath = path.join(binDir, platform === "windows" ? `${BINARY}.exe` : BINARY);
66
- if (extractedPath !== binaryPath && fs.existsSync(extractedPath)) {
69
+ // Move extracted binary to final location (from temp dir to avoid overwriting wrapper)
70
+ const extractedPath = path.join(tempDir, platform === "windows" ? `${BINARY}.exe` : BINARY);
71
+ if (fs.existsSync(extractedPath)) {
67
72
  fs.renameSync(extractedPath, binaryPath);
68
73
  }
69
74
 
70
75
  if (platform !== "windows") fs.chmodSync(binaryPath, 0o755);
71
76
  fs.unlinkSync(archivePath);
77
+ fs.rmSync(tempDir, { recursive: true, force: true });
72
78
  console.log(`Installed ${BINARY} successfully`);
73
79
  }
74
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iteratr",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "AI-powered CLI tool",
5
5
  "repository": {
6
6
  "type": "git",