gitarsenal-cli 1.8.3 → 1.8.5
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/activate_venv.sh +4 -0
- package/package.json +1 -1
- package/python/__pycache__/auth_manager.cpython-313.pyc +0 -0
- package/python/auth_manager.py +485 -0
- package/python/debug_delete.py +167 -0
- package/python/gitarsenal.py +188 -0
- package/python/gitarsenal_keys.py +43 -55
- package/python/test_modalSandboxScript.py +358 -89
- package/scripts/postinstall.js +150 -39
- package/test_modalSandboxScript.py +358 -89
package/scripts/postinstall.js
CHANGED
@@ -15,44 +15,145 @@ 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 install
|
19
|
-
async function
|
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
|
+
|
68
|
+
// Function to create and activate virtual environment
|
69
|
+
async function createVirtualEnvironment() {
|
70
|
+
const venvPath = path.join(__dirname, '..', 'venv');
|
20
71
|
const packages = ['modal', 'gitingest', 'requests'];
|
21
72
|
|
22
|
-
console.log(chalk.yellow(`📦
|
23
|
-
|
24
|
-
// Try different pip commands
|
25
|
-
const pipCommands = [
|
26
|
-
'pip3 install',
|
27
|
-
'pip install',
|
28
|
-
'python -m pip install',
|
29
|
-
'py -m pip install'
|
30
|
-
];
|
73
|
+
console.log(chalk.yellow(`📦 Creating virtual environment and installing packages: ${packages.join(', ')}`));
|
31
74
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
75
|
+
try {
|
76
|
+
// Create virtual environment directory
|
77
|
+
await fs.ensureDir(path.dirname(venvPath));
|
78
|
+
|
79
|
+
// Try different Python commands to create virtual environment
|
80
|
+
const pythonCommands = ['python3', 'python', 'py'];
|
81
|
+
let pythonCmd = null;
|
82
|
+
|
83
|
+
for (const cmd of pythonCommands) {
|
84
|
+
try {
|
85
|
+
await execAsync(`${cmd} --version`);
|
86
|
+
pythonCmd = cmd;
|
87
|
+
break;
|
88
|
+
} catch (error) {
|
89
|
+
// Continue to next command
|
90
|
+
}
|
48
91
|
}
|
92
|
+
|
93
|
+
if (!pythonCmd) {
|
94
|
+
console.log(chalk.red('❌ No Python command found'));
|
95
|
+
return false;
|
96
|
+
}
|
97
|
+
|
98
|
+
console.log(chalk.gray(`🔄 Creating virtual environment with ${pythonCmd}...`));
|
99
|
+
|
100
|
+
// Create virtual environment
|
101
|
+
await execAsync(`${pythonCmd} -m venv "${venvPath}"`, {
|
102
|
+
env: { ...process.env, PYTHONIOENCODING: 'utf-8' }
|
103
|
+
});
|
104
|
+
|
105
|
+
console.log(chalk.green('✅ Virtual environment created successfully!'));
|
106
|
+
|
107
|
+
// Determine the pip path based on OS
|
108
|
+
const isWindows = process.platform === 'win32';
|
109
|
+
const pipPath = isWindows ? path.join(venvPath, 'Scripts', 'pip.exe') : path.join(venvPath, 'bin', 'pip');
|
110
|
+
const pythonPath = isWindows ? path.join(venvPath, 'Scripts', 'python.exe') : path.join(venvPath, 'bin', 'python');
|
111
|
+
|
112
|
+
// Verify virtual environment was created properly
|
113
|
+
if (!(await fs.pathExists(pipPath))) {
|
114
|
+
console.log(chalk.red('❌ Virtual environment pip not found'));
|
115
|
+
return false;
|
116
|
+
}
|
117
|
+
|
118
|
+
console.log(chalk.gray(`🔄 Installing packages in virtual environment...`));
|
119
|
+
|
120
|
+
// Install packages in virtual environment
|
121
|
+
await execAsync(`"${pipPath}" install ${packages.join(' ')}`, {
|
122
|
+
env: { ...process.env, PYTHONIOENCODING: 'utf-8' }
|
123
|
+
});
|
124
|
+
|
125
|
+
console.log(chalk.green('✅ Python packages installed successfully in virtual environment!'));
|
126
|
+
|
127
|
+
// Create a script to activate the virtual environment
|
128
|
+
const activateScript = isWindows ?
|
129
|
+
`@echo off
|
130
|
+
cd /d "%~dp0"
|
131
|
+
call "${venvPath.replace(/\\/g, '\\\\')}\\Scripts\\activate.bat"
|
132
|
+
%*` :
|
133
|
+
`#!/bin/bash
|
134
|
+
cd "$(dirname "$0")"
|
135
|
+
source "${venvPath}/bin/activate"
|
136
|
+
exec "$@"`;
|
137
|
+
|
138
|
+
const activateScriptPath = path.join(__dirname, '..', 'activate_venv' + (isWindows ? '.bat' : '.sh'));
|
139
|
+
await fs.writeFile(activateScriptPath, activateScript);
|
140
|
+
|
141
|
+
if (!isWindows) {
|
142
|
+
await fs.chmod(activateScriptPath, 0o755);
|
143
|
+
}
|
144
|
+
|
145
|
+
console.log(chalk.green(`✅ Virtual environment activation script created: ${activateScriptPath}`));
|
146
|
+
|
147
|
+
return true;
|
148
|
+
} catch (error) {
|
149
|
+
console.log(chalk.red(`❌ Error creating virtual environment: ${error.message}`));
|
150
|
+
console.log(chalk.yellow('💡 Please run manually:'));
|
151
|
+
console.log(chalk.yellow(' python3 -m venv venv'));
|
152
|
+
console.log(chalk.yellow(' source venv/bin/activate # On Unix/macOS'));
|
153
|
+
console.log(chalk.yellow(' venv\\Scripts\\activate.bat # On Windows'));
|
154
|
+
console.log(chalk.yellow(' pip install modal gitingest requests'));
|
155
|
+
return false;
|
49
156
|
}
|
50
|
-
|
51
|
-
console.log(chalk.red('❌ Failed to install Python packages'));
|
52
|
-
console.log(chalk.yellow('💡 Please run manually:'));
|
53
|
-
console.log(chalk.yellow(' pip install modal gitingest requests'));
|
54
|
-
console.log(chalk.yellow(' or: pip3 install modal gitingest requests'));
|
55
|
-
return false;
|
56
157
|
}
|
57
158
|
|
58
159
|
// Function to check Python
|
@@ -105,9 +206,13 @@ async function postinstall() {
|
|
105
206
|
console.log(chalk.blue('🔍 Checking Git installation...'));
|
106
207
|
await checkGit();
|
107
208
|
|
108
|
-
//
|
109
|
-
console.log(chalk.blue('🔍
|
110
|
-
await
|
209
|
+
// Check and install uv if needed
|
210
|
+
console.log(chalk.blue('🔍 Checking for uv package manager...'));
|
211
|
+
await checkAndInstallUv();
|
212
|
+
|
213
|
+
// Install Python packages in virtual environment
|
214
|
+
console.log(chalk.blue('🔍 Installing Python dependencies in virtual environment...'));
|
215
|
+
await createVirtualEnvironment();
|
111
216
|
|
112
217
|
// Create the Python directory if it doesn't exist
|
113
218
|
await fs.ensureDir(pythonScriptDir);
|
@@ -222,15 +327,21 @@ if __name__ == "__main__":
|
|
222
327
|
|
223
328
|
What was installed:
|
224
329
|
• GitArsenal CLI (npm package)
|
225
|
-
•
|
226
|
-
|
227
|
-
|
330
|
+
• Virtual environment with Python packages:
|
331
|
+
- Modal
|
332
|
+
- GitIngest
|
333
|
+
- Requests
|
228
334
|
|
229
335
|
💡 Next steps:
|
230
336
|
• Run: gitarsenal --help
|
231
337
|
• Run: gitarsenal setup
|
232
338
|
• Visit: https://gitarsenal.dev
|
233
339
|
|
340
|
+
💡 To activate the virtual environment:
|
341
|
+
• Unix/macOS: source venv/bin/activate
|
342
|
+
• Windows: venv\\Scripts\\activate.bat
|
343
|
+
• Or use: ./activate_venv.sh (Unix/macOS) or activate_venv.bat (Windows)
|
344
|
+
|
234
345
|
Having issues? Run: gitarsenal --debug
|
235
346
|
`));
|
236
347
|
|