@leverageaiapps/gogogo 1.0.0

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.
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Post-install script to fix node-pty permissions on macOS/Linux
5
+ * This ensures the spawn-helper binary has execute permissions
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const os = require('os');
11
+
12
+ const platform = os.platform();
13
+
14
+ // Only run on macOS and Linux
15
+ if (platform !== 'darwin' && platform !== 'linux') {
16
+ console.log('Skipping node-pty permission fix (not macOS/Linux)');
17
+ process.exit(0);
18
+ }
19
+
20
+ // Determine the architecture
21
+ const arch = os.arch();
22
+ let prebuildDir;
23
+
24
+ if (platform === 'darwin') {
25
+ prebuildDir = arch === 'arm64' ? 'darwin-arm64' : 'darwin-x64';
26
+ } else if (platform === 'linux') {
27
+ prebuildDir = arch === 'arm64' ? 'linux-arm64' : 'linux-x64';
28
+ }
29
+
30
+ const spawnHelperPath = path.join(
31
+ __dirname,
32
+ '..',
33
+ 'node_modules',
34
+ 'node-pty',
35
+ 'prebuilds',
36
+ prebuildDir,
37
+ 'spawn-helper'
38
+ );
39
+
40
+ // Check if spawn-helper exists
41
+ if (!fs.existsSync(spawnHelperPath)) {
42
+ console.log(`spawn-helper not found at: ${spawnHelperPath}`);
43
+ console.log('This is normal if node-pty uses a different installation method');
44
+ process.exit(0);
45
+ }
46
+
47
+ try {
48
+ // Get current permissions
49
+ const stats = fs.statSync(spawnHelperPath);
50
+ const currentMode = stats.mode;
51
+
52
+ // Add execute permission (chmod +x)
53
+ const newMode = currentMode | fs.constants.S_IXUSR | fs.constants.S_IXGRP | fs.constants.S_IXOTH;
54
+
55
+ if (currentMode !== newMode) {
56
+ fs.chmodSync(spawnHelperPath, newMode);
57
+ console.log('✓ Fixed node-pty spawn-helper permissions');
58
+ } else {
59
+ console.log('✓ node-pty spawn-helper permissions already correct');
60
+ }
61
+ } catch (error) {
62
+ console.error('Warning: Failed to fix node-pty permissions:', error.message);
63
+ console.error('You may need to run manually: chmod +x node_modules/node-pty/prebuilds/*/spawn-helper');
64
+ // Don't fail the installation
65
+ process.exit(0);
66
+ }
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Installation verification script
5
+ * Checks if all dependencies and permissions are correctly set up
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const os = require('os');
11
+ const { execSync } = require('child_process');
12
+
13
+ console.log('🔍 Verifying gogogo installation...\n');
14
+
15
+ let hasErrors = false;
16
+ let hasWarnings = false;
17
+
18
+ // Check 1: Node.js version
19
+ console.log('1. Checking Node.js version...');
20
+ const nodeVersion = process.version;
21
+ const majorVersion = parseInt(nodeVersion.slice(1).split('.')[0]);
22
+ if (majorVersion >= 18) {
23
+ console.log(` ✓ Node.js ${nodeVersion} (>= 18.0.0)\n`);
24
+ } else {
25
+ console.log(` ✗ Node.js ${nodeVersion} is too old. Required: >= 18.0.0\n`);
26
+ hasErrors = true;
27
+ }
28
+
29
+ // Check 2: cloudflared
30
+ console.log('2. Checking cloudflared...');
31
+ try {
32
+ const cloudflaredVersion = execSync('cloudflared --version', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] });
33
+ console.log(` ✓ cloudflared installed: ${cloudflaredVersion.trim()}\n`);
34
+ } catch (error) {
35
+ console.log(' ✗ cloudflared not found');
36
+ console.log(' Install it from: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/\n');
37
+ hasErrors = true;
38
+ }
39
+
40
+ // Check 3: node-pty installation
41
+ console.log('3. Checking node-pty...');
42
+ const nodePtyPath = path.join(__dirname, '..', 'node_modules', 'node-pty');
43
+ if (fs.existsSync(nodePtyPath)) {
44
+ console.log(' ✓ node-pty installed\n');
45
+ } else {
46
+ console.log(' ✗ node-pty not found. Run: npm install\n');
47
+ hasErrors = true;
48
+ }
49
+
50
+ // Check 4: spawn-helper permissions (macOS/Linux only)
51
+ if (os.platform() === 'darwin' || os.platform() === 'linux') {
52
+ console.log('4. Checking spawn-helper permissions...');
53
+
54
+ const arch = os.arch();
55
+ const platform = os.platform();
56
+ let prebuildDir;
57
+
58
+ if (platform === 'darwin') {
59
+ prebuildDir = arch === 'arm64' ? 'darwin-arm64' : 'darwin-x64';
60
+ } else {
61
+ prebuildDir = arch === 'arm64' ? 'linux-arm64' : 'linux-x64';
62
+ }
63
+
64
+ const spawnHelperPath = path.join(nodePtyPath, 'prebuilds', prebuildDir, 'spawn-helper');
65
+
66
+ if (fs.existsSync(spawnHelperPath)) {
67
+ try {
68
+ const stats = fs.statSync(spawnHelperPath);
69
+ const hasExecute = (stats.mode & fs.constants.S_IXUSR) !== 0;
70
+
71
+ if (hasExecute) {
72
+ console.log(' ✓ spawn-helper has execute permissions\n');
73
+ } else {
74
+ console.log(' ✗ spawn-helper missing execute permissions');
75
+ console.log(` Fix: chmod +x ${spawnHelperPath}\n`);
76
+ hasErrors = true;
77
+ }
78
+ } catch (error) {
79
+ console.log(` ⚠ Could not check permissions: ${error.message}\n`);
80
+ hasWarnings = true;
81
+ }
82
+ } else {
83
+ console.log(` ⚠ spawn-helper not found at expected location`);
84
+ console.log(` This may be normal if using a different node-pty version\n`);
85
+ hasWarnings = true;
86
+ }
87
+ } else {
88
+ console.log('4. Skipping spawn-helper check (Windows)\n');
89
+ }
90
+
91
+ // Check 5: Built files
92
+ console.log('5. Checking built files...');
93
+ const distPath = path.join(__dirname, '..', 'dist', 'index.js');
94
+ if (fs.existsSync(distPath)) {
95
+ console.log(' ✓ Project built successfully\n');
96
+ } else {
97
+ console.log(' ⚠ Project not built yet. Run: npm run build\n');
98
+ hasWarnings = true;
99
+ }
100
+
101
+ // Check 6: Shell availability
102
+ console.log('6. Checking shell...');
103
+ const shell = process.env.SHELL || (os.platform() === 'win32' ? 'cmd.exe' : '/bin/sh');
104
+ if (fs.existsSync(shell)) {
105
+ console.log(` ✓ Shell available: ${shell}\n`);
106
+ } else {
107
+ console.log(` ⚠ Default shell not found: ${shell}\n`);
108
+ hasWarnings = true;
109
+ }
110
+
111
+ // Summary
112
+ console.log('═'.repeat(50));
113
+ if (hasErrors) {
114
+ console.log('❌ Installation has errors. Please fix the issues above.');
115
+ process.exit(1);
116
+ } else if (hasWarnings) {
117
+ console.log('⚠️ Installation complete with warnings.');
118
+ console.log(' You may want to address the warnings above.');
119
+ process.exit(0);
120
+ } else {
121
+ console.log('✅ Installation verified successfully!');
122
+ console.log('\nYou can now run: gogogo start');
123
+ process.exit(0);
124
+ }