gitarsenal-cli 1.8.9 → 1.9.1
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/gitarsenal.js +6 -66
- package/package.json +1 -1
package/bin/gitarsenal.js
CHANGED
@@ -15,74 +15,16 @@ const { spawn } = require('child_process');
|
|
15
15
|
const fs = require('fs');
|
16
16
|
|
17
17
|
// Function to activate virtual environment
|
18
|
-
|
18
|
+
function activateVirtualEnvironment() {
|
19
19
|
const isWindows = process.platform === 'win32';
|
20
20
|
const venvPath = path.join(__dirname, '..', '.venv');
|
21
21
|
|
22
22
|
// Check if virtual environment exists
|
23
23
|
if (!fs.existsSync(venvPath)) {
|
24
|
-
console.log(chalk.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
const { execSync } = require('child_process');
|
29
|
-
|
30
|
-
// Check if uv is available
|
31
|
-
try {
|
32
|
-
execSync('uv --version', { stdio: 'pipe' });
|
33
|
-
console.log(chalk.gray('🔄 Creating virtual environment with uv...'));
|
34
|
-
|
35
|
-
// Create virtual environment with uv
|
36
|
-
execSync('uv venv', {
|
37
|
-
cwd: path.join(__dirname, '..'),
|
38
|
-
stdio: 'inherit'
|
39
|
-
});
|
40
|
-
|
41
|
-
console.log(chalk.green('✅ Virtual environment created with uv!'));
|
42
|
-
|
43
|
-
// Install packages with uv
|
44
|
-
console.log(chalk.gray('🔄 Installing Python packages with uv...'));
|
45
|
-
execSync('uv pip install modal gitingest requests', {
|
46
|
-
cwd: path.join(__dirname, '..'),
|
47
|
-
stdio: 'inherit'
|
48
|
-
});
|
49
|
-
|
50
|
-
console.log(chalk.green('✅ Python packages installed successfully!'));
|
51
|
-
|
52
|
-
} catch (uvError) {
|
53
|
-
console.log(chalk.gray('⚠️ uv not available, trying Python venv...'));
|
54
|
-
|
55
|
-
// Fallback to Python venv
|
56
|
-
const pythonCmd = isWindows ? 'python' : 'python3';
|
57
|
-
|
58
|
-
// Create virtual environment
|
59
|
-
execSync(`${pythonCmd} -m venv "${venvPath}"`, {
|
60
|
-
stdio: 'inherit'
|
61
|
-
});
|
62
|
-
|
63
|
-
console.log(chalk.green('✅ Virtual environment created with Python venv!'));
|
64
|
-
|
65
|
-
// Install packages
|
66
|
-
const pipPath = isWindows ?
|
67
|
-
path.join(venvPath, 'Scripts', 'pip.exe') :
|
68
|
-
path.join(venvPath, 'bin', 'pip');
|
69
|
-
|
70
|
-
console.log(chalk.gray('🔄 Installing Python packages...'));
|
71
|
-
execSync(`"${pipPath}" install modal gitingest requests`, {
|
72
|
-
stdio: 'inherit'
|
73
|
-
});
|
74
|
-
|
75
|
-
console.log(chalk.green('✅ Python packages installed successfully!'));
|
76
|
-
}
|
77
|
-
|
78
|
-
} catch (error) {
|
79
|
-
console.log(chalk.red(`❌ Failed to create virtual environment: ${error.message}`));
|
80
|
-
console.log(chalk.yellow('💡 Please run manually:'));
|
81
|
-
console.log(chalk.yellow(' cd /root/.nvm/versions/node/v22.18.0/lib/node_modules/gitarsenal-cli'));
|
82
|
-
console.log(chalk.yellow(' uv venv'));
|
83
|
-
console.log(chalk.yellow(' uv pip install modal gitingest requests'));
|
84
|
-
return false;
|
85
|
-
}
|
24
|
+
console.log(chalk.red('❌ Virtual environment not found. Please reinstall the package:'));
|
25
|
+
console.log(chalk.yellow(' npm uninstall -g gitarsenal-cli'));
|
26
|
+
console.log(chalk.yellow(' npm install -g gitarsenal-cli'));
|
27
|
+
return false;
|
86
28
|
}
|
87
29
|
|
88
30
|
// Set environment variables to use the virtual environment
|
@@ -112,9 +54,7 @@ async function activateVirtualEnvironment() {
|
|
112
54
|
}
|
113
55
|
|
114
56
|
// Activate virtual environment
|
115
|
-
(
|
116
|
-
await activateVirtualEnvironment();
|
117
|
-
})();
|
57
|
+
activateVirtualEnvironment();
|
118
58
|
|
119
59
|
// Check for updates
|
120
60
|
updateNotifier({ pkg }).notify();
|