ramorie 2.2.0 → 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.
package/bin/ramorie ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Ramorie CLI - bin shim
5
+ *
6
+ * This script executes the downloaded Go binary.
7
+ * It's a thin wrapper that npm uses to expose the 'ramorie' command.
8
+ */
9
+
10
+ const { spawn } = require('child_process');
11
+ const path = require('path');
12
+ const fs = require('fs');
13
+
14
+ // Determine binary name based on platform
15
+ // Binary is named ramorie-bin to avoid conflict with this shim script
16
+ const binaryName = process.platform === 'win32' ? 'ramorie-bin.exe' : 'ramorie-bin';
17
+ const binaryPath = path.join(__dirname, binaryName);
18
+
19
+ // Check if binary exists
20
+ if (!fs.existsSync(binaryPath)) {
21
+ console.error(`
22
+ ❌ Ramorie binary not found at: ${binaryPath}
23
+
24
+ This usually means the postinstall script failed.
25
+ Try reinstalling: npm install -g ramorie
26
+
27
+ Or install via other methods:
28
+ • brew install ramorie
29
+ • go install github.com/terzigolu/josepshbrain-go/cmd/jbraincli@latest
30
+ `);
31
+ process.exit(1);
32
+ }
33
+
34
+ // Execute the binary with all arguments passed through
35
+ const child = spawn(binaryPath, process.argv.slice(2), {
36
+ stdio: 'inherit',
37
+ windowsHide: true
38
+ });
39
+
40
+ child.on('error', (err) => {
41
+ console.error(`Failed to start ramorie: ${err.message}`);
42
+ process.exit(1);
43
+ });
44
+
45
+ child.on('close', (code) => {
46
+ process.exit(code || 0);
47
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ramorie",
3
- "version": "2.2.0",
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
@@ -65,22 +65,27 @@ async function main() {
65
65
 
66
66
  const isWindows = process.platform === 'win32';
67
67
  const ext = isWindows ? 'zip' : 'tar.gz';
68
- const binaryName = isWindows ? 'ramorie.exe' : 'ramorie';
68
+ // Use different name to avoid overwriting the shim script
69
+ const binaryName = isWindows ? 'ramorie-bin.exe' : 'ramorie-bin';
69
70
 
70
71
  const assetName = `ramorie_${VERSION}_${platform}_${arch}.${ext}`;
71
72
  const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${assetName}`;
72
73
 
73
74
  const binDir = path.join(__dirname, 'bin');
75
+ const tempDir = path.join(__dirname, 'temp-extract');
74
76
  const tempFile = path.join(__dirname, `ramorie-temp.${ext}`);
75
77
  const binaryPath = path.join(binDir, binaryName);
76
78
 
77
79
  console.log(`📦 Installing Ramorie v${VERSION} for ${platform}/${arch}...`);
78
80
 
79
81
  try {
80
- // Ensure bin directory exists
82
+ // Ensure directories exist
81
83
  if (!fs.existsSync(binDir)) {
82
84
  fs.mkdirSync(binDir, { recursive: true });
83
85
  }
86
+ if (!fs.existsSync(tempDir)) {
87
+ fs.mkdirSync(tempDir, { recursive: true });
88
+ }
84
89
 
85
90
  // Download the archive
86
91
  console.log(` Downloading...`);
@@ -88,12 +93,20 @@ async function main() {
88
93
  fs.writeFileSync(tempFile, data);
89
94
  console.log(' ✓ Downloaded');
90
95
 
91
- // Extract using system tools
96
+ // Extract to temp directory (not bin!) to avoid overwriting shim
92
97
  console.log(' Extracting...');
98
+ const extractedBinary = isWindows ? 'ramorie.exe' : 'ramorie';
99
+ const extractedPath = path.join(tempDir, extractedBinary);
100
+
93
101
  if (isWindows) {
94
- 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' });
95
103
  } else {
96
- execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'pipe' });
104
+ execSync(`tar -xzf "${tempFile}" -C "${tempDir}"`, { stdio: 'pipe' });
105
+ }
106
+
107
+ // Move only the binary to bin/ with new name
108
+ if (fs.existsSync(extractedPath)) {
109
+ fs.renameSync(extractedPath, binaryPath);
97
110
  }
98
111
  console.log(' ✓ Extracted');
99
112
 
@@ -102,10 +115,13 @@ async function main() {
102
115
  fs.chmodSync(binaryPath, 0o755);
103
116
  }
104
117
 
105
- // Cleanup
118
+ // Cleanup temp files and directory
106
119
  if (fs.existsSync(tempFile)) {
107
120
  fs.unlinkSync(tempFile);
108
121
  }
122
+ if (fs.existsSync(tempDir)) {
123
+ fs.rmSync(tempDir, { recursive: true, force: true });
124
+ }
109
125
 
110
126
  console.log(`\n✅ Ramorie v${VERSION} installed successfully!`);
111
127
  console.log(' Run "ramorie --help" to get started.\n');