ramorie 2.2.1 → 2.2.2

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/package.json +1 -1
  2. package/postinstall.js +14 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ramorie",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "AI-powered task and memory management CLI",
5
5
  "homepage": "https://ramorie.com",
6
6
  "repository": {
package/postinstall.js CHANGED
@@ -72,16 +72,20 @@ async function main() {
72
72
  const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${assetName}`;
73
73
 
74
74
  const binDir = path.join(__dirname, 'bin');
75
+ const tempDir = path.join(__dirname, 'temp-extract');
75
76
  const tempFile = path.join(__dirname, `ramorie-temp.${ext}`);
76
77
  const binaryPath = path.join(binDir, binaryName);
77
78
 
78
79
  console.log(`šŸ“¦ Installing Ramorie v${VERSION} for ${platform}/${arch}...`);
79
80
 
80
81
  try {
81
- // Ensure bin directory exists
82
+ // Ensure directories exist
82
83
  if (!fs.existsSync(binDir)) {
83
84
  fs.mkdirSync(binDir, { recursive: true });
84
85
  }
86
+ if (!fs.existsSync(tempDir)) {
87
+ fs.mkdirSync(tempDir, { recursive: true });
88
+ }
85
89
 
86
90
  // Download the archive
87
91
  console.log(` Downloading...`);
@@ -89,18 +93,18 @@ async function main() {
89
93
  fs.writeFileSync(tempFile, data);
90
94
  console.log(' āœ“ Downloaded');
91
95
 
92
- // Extract using system tools
96
+ // Extract to temp directory (not bin!) to avoid overwriting shim
93
97
  console.log(' Extracting...');
94
98
  const extractedBinary = isWindows ? 'ramorie.exe' : 'ramorie';
95
- const extractedPath = path.join(binDir, extractedBinary);
99
+ const extractedPath = path.join(tempDir, extractedBinary);
96
100
 
97
101
  if (isWindows) {
98
- execSync(`powershell -command "Expand-Archive -Path '${tempFile}' -DestinationPath '${binDir}' -Force"`, { stdio: 'pipe' });
102
+ execSync(`powershell -command "Expand-Archive -Path '${tempFile}' -DestinationPath '${tempDir}' -Force"`, { stdio: 'pipe' });
99
103
  } else {
100
- execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'pipe' });
104
+ execSync(`tar -xzf "${tempFile}" -C "${tempDir}"`, { stdio: 'pipe' });
101
105
  }
102
106
 
103
- // Rename to avoid overwriting the shim script
107
+ // Move only the binary to bin/ with new name
104
108
  if (fs.existsSync(extractedPath)) {
105
109
  fs.renameSync(extractedPath, binaryPath);
106
110
  }
@@ -111,10 +115,13 @@ async function main() {
111
115
  fs.chmodSync(binaryPath, 0o755);
112
116
  }
113
117
 
114
- // Cleanup
118
+ // Cleanup temp files and directory
115
119
  if (fs.existsSync(tempFile)) {
116
120
  fs.unlinkSync(tempFile);
117
121
  }
122
+ if (fs.existsSync(tempDir)) {
123
+ fs.rmSync(tempDir, { recursive: true, force: true });
124
+ }
118
125
 
119
126
  console.log(`\nāœ… Ramorie v${VERSION} installed successfully!`);
120
127
  console.log(' Run "ramorie --help" to get started.\n');