gitarsenal-cli 1.8.2 → 1.8.4
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/package.json +1 -1
- package/python/test_modalSandboxScript.py +861 -31
- package/scripts/postinstall.js +66 -10
- package/test_modalSandboxScript.py +861 -31
package/scripts/postinstall.js
CHANGED
@@ -15,42 +15,94 @@ const pythonScriptPath = path.join(pythonScriptDir, 'test_modalSandboxScript.py'
|
|
15
15
|
// Path to the original Python script
|
16
16
|
const originalScriptPath = path.join(__dirname, '..', '..', '..', 'mcp-server', 'src', 'utils', 'test_modalSandboxScript.py');
|
17
17
|
|
18
|
+
// Function to check and install uv
|
19
|
+
async function checkAndInstallUv() {
|
20
|
+
try {
|
21
|
+
// Check if uv is already installed
|
22
|
+
await execAsync('uv --version');
|
23
|
+
console.log(chalk.green('✅ uv is already installed'));
|
24
|
+
return true;
|
25
|
+
} catch (error) {
|
26
|
+
console.log(chalk.yellow('⚠️ uv not found. Attempting to install...'));
|
27
|
+
|
28
|
+
// Try different methods to install uv
|
29
|
+
const installMethods = [
|
30
|
+
'curl -LsSf https://astral.sh/uv/install.sh | sh',
|
31
|
+
'pip install uv',
|
32
|
+
'pip3 install uv',
|
33
|
+
'cargo install uv'
|
34
|
+
];
|
35
|
+
|
36
|
+
for (const method of installMethods) {
|
37
|
+
try {
|
38
|
+
console.log(chalk.gray(`🔄 Trying to install uv with: ${method}`));
|
39
|
+
|
40
|
+
if (method.includes('curl')) {
|
41
|
+
// For curl installation, we need to handle the shell script
|
42
|
+
await execAsync(method, {
|
43
|
+
env: { ...process.env, SHELL: '/bin/bash' },
|
44
|
+
stdio: 'inherit'
|
45
|
+
});
|
46
|
+
} else {
|
47
|
+
await execAsync(method);
|
48
|
+
}
|
49
|
+
|
50
|
+
// Verify installation
|
51
|
+
await execAsync('uv --version');
|
52
|
+
console.log(chalk.green('✅ uv installed successfully!'));
|
53
|
+
return true;
|
54
|
+
} catch (installError) {
|
55
|
+
console.log(chalk.gray(`⚠️ ${method} failed, trying next...`));
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
console.log(chalk.yellow('⚠️ Could not install uv automatically'));
|
60
|
+
console.log(chalk.yellow('💡 Please install uv manually:'));
|
61
|
+
console.log(chalk.yellow(' curl -LsSf https://astral.sh/uv/install.sh | sh'));
|
62
|
+
console.log(chalk.yellow(' or: pip install uv'));
|
63
|
+
console.log(chalk.yellow(' or: cargo install uv'));
|
64
|
+
return false;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
18
68
|
// Function to install Python packages
|
19
69
|
async function installPythonPackages() {
|
20
70
|
const packages = ['modal', 'gitingest', 'requests'];
|
21
71
|
|
22
72
|
console.log(chalk.yellow(`📦 Installing Python packages: ${packages.join(', ')}`));
|
23
73
|
|
24
|
-
// Try
|
25
|
-
const
|
74
|
+
// Try uv first, then fall back to pip commands
|
75
|
+
const installCommands = [
|
76
|
+
'uv pip install',
|
26
77
|
'pip3 install',
|
27
78
|
'pip install',
|
28
79
|
'python -m pip install',
|
29
80
|
'py -m pip install'
|
30
81
|
];
|
31
82
|
|
32
|
-
for (const
|
83
|
+
for (const installCommand of installCommands) {
|
33
84
|
try {
|
34
|
-
// Check if
|
35
|
-
const [
|
36
|
-
await execAsync(`${
|
85
|
+
// Check if command exists
|
86
|
+
const [cmd] = installCommand.split(' ');
|
87
|
+
await execAsync(`${cmd} --version`);
|
37
88
|
|
38
|
-
console.log(chalk.gray(`🔄 Using: ${
|
89
|
+
console.log(chalk.gray(`🔄 Using: ${installCommand}`));
|
39
90
|
|
40
|
-
await execAsync(`${
|
91
|
+
await execAsync(`${installCommand} ${packages.join(' ')}`, {
|
41
92
|
env: { ...process.env, PYTHONIOENCODING: 'utf-8' }
|
42
93
|
});
|
43
94
|
|
44
95
|
console.log(chalk.green('✅ Python packages installed successfully!'));
|
45
96
|
return true;
|
46
97
|
} catch (error) {
|
47
|
-
console.log(chalk.gray(`⚠️ ${
|
98
|
+
console.log(chalk.gray(`⚠️ ${installCommand} failed, trying next...`));
|
48
99
|
}
|
49
100
|
}
|
50
101
|
|
51
102
|
console.log(chalk.red('❌ Failed to install Python packages'));
|
52
103
|
console.log(chalk.yellow('💡 Please run manually:'));
|
53
|
-
console.log(chalk.yellow(' pip install modal gitingest requests'));
|
104
|
+
console.log(chalk.yellow(' uv pip install modal gitingest requests'));
|
105
|
+
console.log(chalk.yellow(' or: pip install modal gitingest requests'));
|
54
106
|
console.log(chalk.yellow(' or: pip3 install modal gitingest requests'));
|
55
107
|
return false;
|
56
108
|
}
|
@@ -105,6 +157,10 @@ async function postinstall() {
|
|
105
157
|
console.log(chalk.blue('🔍 Checking Git installation...'));
|
106
158
|
await checkGit();
|
107
159
|
|
160
|
+
// Check and install uv if needed
|
161
|
+
console.log(chalk.blue('🔍 Checking for uv package manager...'));
|
162
|
+
await checkAndInstallUv();
|
163
|
+
|
108
164
|
// Install Python packages
|
109
165
|
console.log(chalk.blue('🔍 Installing Python dependencies...'));
|
110
166
|
await installPythonPackages();
|