gitarsenal-cli 1.9.69 → 1.9.70
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/.venv_status.json +1 -1
- package/bin/gitarsenal.js +83 -0
- package/package.json +1 -1
package/.venv_status.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"created":"2025-08-15T05:
|
|
1
|
+
{"created":"2025-08-15T05:04:01.624Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
|
package/bin/gitarsenal.js
CHANGED
|
@@ -16,6 +16,89 @@ const fs = require('fs');
|
|
|
16
16
|
const https = require('https');
|
|
17
17
|
const http = require('http');
|
|
18
18
|
|
|
19
|
+
// Function to activate virtual environment
|
|
20
|
+
function activateVirtualEnvironment() {
|
|
21
|
+
const isWindows = process.platform === 'win32';
|
|
22
|
+
const venvPath = path.join(__dirname, '..', '.venv');
|
|
23
|
+
const statusFile = path.join(__dirname, '..', '.venv_status.json');
|
|
24
|
+
|
|
25
|
+
// Check if virtual environment exists
|
|
26
|
+
if (!fs.existsSync(venvPath)) {
|
|
27
|
+
console.log(chalk.red('❌ Virtual environment not found. Please reinstall the package:'));
|
|
28
|
+
console.log(chalk.yellow(' npm uninstall -g gitarsenal-cli'));
|
|
29
|
+
console.log(chalk.yellow(' npm install -g gitarsenal-cli'));
|
|
30
|
+
console.log(chalk.yellow(''));
|
|
31
|
+
console.log(chalk.yellow('💡 Or run the postinstall script manually:'));
|
|
32
|
+
console.log(chalk.yellow(' cd /root/.nvm/versions/node/v22.18.0/lib/node_modules/gitarsenal-cli'));
|
|
33
|
+
console.log(chalk.yellow(' node scripts/postinstall.js'));
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Check if status file exists (indicates successful installation)
|
|
38
|
+
if (fs.existsSync(statusFile)) {
|
|
39
|
+
try {
|
|
40
|
+
const status = JSON.parse(fs.readFileSync(statusFile, 'utf8'));
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.log(chalk.gray('✅ Virtual environment found'));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Verify virtual environment structure - uv creates different structure
|
|
47
|
+
let pythonPath, pipPath;
|
|
48
|
+
|
|
49
|
+
// Check for uv-style virtual environment first
|
|
50
|
+
const uvPythonPath = path.join(venvPath, 'bin', 'python');
|
|
51
|
+
const uvPipPath = path.join(venvPath, 'bin', 'pip');
|
|
52
|
+
|
|
53
|
+
// Check for traditional venv structure
|
|
54
|
+
const traditionalPythonPath = isWindows ?
|
|
55
|
+
path.join(venvPath, 'Scripts', 'python.exe') :
|
|
56
|
+
path.join(venvPath, 'bin', 'python');
|
|
57
|
+
const traditionalPipPath = isWindows ?
|
|
58
|
+
path.join(venvPath, 'Scripts', 'pip.exe') :
|
|
59
|
+
path.join(venvPath, 'bin', 'pip');
|
|
60
|
+
|
|
61
|
+
// Determine which structure exists
|
|
62
|
+
// console.log(chalk.gray(`🔍 Checking virtual environment structure:`));
|
|
63
|
+
// console.log(chalk.gray(` Python: ${uvPythonPath} (exists: ${fs.existsSync(uvPythonPath)})`));
|
|
64
|
+
// console.log(chalk.gray(` Pip: ${uvPipPath} (exists: ${fs.existsSync(uvPipPath)})`));
|
|
65
|
+
|
|
66
|
+
// For uv virtual environments, we only need Python to exist
|
|
67
|
+
// uv doesn't create a pip executable, it uses 'uv pip' instead
|
|
68
|
+
if (fs.existsSync(uvPythonPath)) {
|
|
69
|
+
pythonPath = uvPythonPath;
|
|
70
|
+
pipPath = 'uv pip'; // Use uv pip instead of pip executable
|
|
71
|
+
// console.log(chalk.gray('✅ Found uv-style virtual environment'));
|
|
72
|
+
} else if (fs.existsSync(traditionalPythonPath) && fs.existsSync(traditionalPipPath)) {
|
|
73
|
+
pythonPath = traditionalPythonPath;
|
|
74
|
+
pipPath = traditionalPipPath;
|
|
75
|
+
console.log(chalk.gray('✅ Found traditional virtual environment'));
|
|
76
|
+
} else {
|
|
77
|
+
console.log(chalk.red('❌ Virtual environment structure not recognized'));
|
|
78
|
+
console.log(chalk.gray('Expected Python at:'));
|
|
79
|
+
console.log(chalk.gray(` ${uvPythonPath}`));
|
|
80
|
+
console.log(chalk.gray(` ${traditionalPythonPath}`));
|
|
81
|
+
console.log(chalk.yellow('💡 Please reinstall the package'));
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Update PATH to prioritize virtual environment
|
|
86
|
+
const pathSeparator = isWindows ? ';' : ':';
|
|
87
|
+
const venvBinPath = path.dirname(pythonPath); // Use the same directory as the Python executable
|
|
88
|
+
|
|
89
|
+
process.env.PATH = `${venvBinPath}${pathSeparator}${process.env.PATH}`;
|
|
90
|
+
process.env.VIRTUAL_ENV = venvPath;
|
|
91
|
+
process.env.PYTHONPATH = venvPath;
|
|
92
|
+
|
|
93
|
+
// Set Python executable path for child processes
|
|
94
|
+
process.env.PYTHON_EXECUTABLE = pythonPath;
|
|
95
|
+
process.env.PIP_EXECUTABLE = pipPath;
|
|
96
|
+
|
|
97
|
+
console.log(chalk.green('✅ Virtual environment activated successfully'));
|
|
98
|
+
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
19
102
|
|
|
20
103
|
// Lightweight preview of GPU/Torch/CUDA recommendations prior to GPU selection
|
|
21
104
|
async function previewRecommendations(repoUrl, optsOrShowSummary = true) {
|