@scottymade/mana 1.0.2 → 1.0.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.
package/bin/mana CHANGED
@@ -9,8 +9,14 @@
9
9
 
10
10
  set -e
11
11
 
12
- # Get the directory where this script is located
13
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
12
+ # Get the directory where this script is located (resolving symlinks)
13
+ SOURCE="$0"
14
+ while [ -L "$SOURCE" ]; do
15
+ DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
16
+ SOURCE="$(readlink "$SOURCE")"
17
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
18
+ done
19
+ SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
14
20
 
15
21
  # Try to find the binary
16
22
  # First, check for the symlink/copy created by postinstall
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scottymade/mana",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "MANA - LLM Token Usage Optimizer for Claude Code",
5
5
  "keywords": [
6
6
  "claude",
@@ -54,40 +54,18 @@ function getBinaryName() {
54
54
  }
55
55
 
56
56
  /**
57
- * Download a file from URL to destination
58
- * Follows redirects (GitHub releases redirect to S3)
57
+ * Download a file from URL to destination using curl
58
+ * More reliable than Node https for following GitHub redirects
59
59
  */
60
60
  function downloadFile(url, dest) {
61
61
  return new Promise((resolve, reject) => {
62
- const file = fs.createWriteStream(dest);
63
-
64
- const request = (url) => {
65
- https.get(url, (response) => {
66
- // Handle redirects (GitHub releases return 302)
67
- if (response.statusCode === 301 || response.statusCode === 302) {
68
- const redirectUrl = response.headers.location;
69
- request(redirectUrl);
70
- return;
71
- }
72
-
73
- if (response.statusCode !== 200) {
74
- reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
75
- return;
76
- }
77
-
78
- response.pipe(file);
79
-
80
- file.on('finish', () => {
81
- file.close();
82
- resolve();
83
- });
84
- }).on('error', (err) => {
85
- fs.unlink(dest, () => {}); // Delete partial file
86
- reject(err);
87
- });
88
- };
89
-
90
- request(url);
62
+ try {
63
+ // Use curl which handles redirects properly
64
+ execSync(`curl -fsSL "${url}" -o "${dest}"`, { stdio: 'pipe' });
65
+ resolve();
66
+ } catch (error) {
67
+ reject(new Error(`Failed to download: ${error.message}`));
68
+ }
91
69
  });
92
70
  }
93
71