gitarsenal-cli 1.5.8 → 1.5.10
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/ascii_banner.txt +12 -0
- package/bin/gitarsenal.js +15 -6
- package/package.json +1 -1
- package/python/modal_auth_patch.py +1 -1
- package/python/modal_token_solution.py +1 -1
- package/python/test_modalSandboxScript.py +1867 -1523
- package/scripts/postinstall.js +108 -26
- package/python/__pycache__/credentials_manager.cpython-313.pyc +0 -0
- package/python/__pycache__/modal_auth_patch.cpython-313.pyc +0 -0
- package/python/__pycache__/modal_token_solution.cpython-313.pyc +0 -0
- package/python/__pycache__/test_modalSandboxScript.cpython-313.pyc +0 -0
- package/python/test_nvcc.py +0 -80
package/scripts/postinstall.js
CHANGED
@@ -15,10 +15,100 @@ 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 Python packages
|
19
|
+
async function installPythonPackages() {
|
20
|
+
const packages = ['modal', 'gitingest', 'requests'];
|
21
|
+
|
22
|
+
console.log(chalk.yellow(`📦 Installing Python packages: ${packages.join(', ')}`));
|
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
|
+
];
|
31
|
+
|
32
|
+
for (const pipCommand of pipCommands) {
|
33
|
+
try {
|
34
|
+
// Check if pip command exists
|
35
|
+
const [pipCmd] = pipCommand.split(' ');
|
36
|
+
await execAsync(`${pipCmd} --version`);
|
37
|
+
|
38
|
+
console.log(chalk.gray(`🔄 Using: ${pipCommand}`));
|
39
|
+
|
40
|
+
await execAsync(`${pipCommand} ${packages.join(' ')}`, {
|
41
|
+
env: { ...process.env, PYTHONIOENCODING: 'utf-8' }
|
42
|
+
});
|
43
|
+
|
44
|
+
console.log(chalk.green('✅ Python packages installed successfully!'));
|
45
|
+
return true;
|
46
|
+
} catch (error) {
|
47
|
+
console.log(chalk.gray(`⚠️ ${pipCommand} failed, trying next...`));
|
48
|
+
}
|
49
|
+
}
|
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
|
+
}
|
57
|
+
|
58
|
+
// Function to check Python
|
59
|
+
async function checkPython() {
|
60
|
+
const pythonCommands = ['python3', 'python', 'py'];
|
61
|
+
|
62
|
+
for (const cmd of pythonCommands) {
|
63
|
+
try {
|
64
|
+
const { stdout } = await execAsync(`${cmd} --version`);
|
65
|
+
console.log(chalk.green(`✅ Python found: ${stdout.trim()}`));
|
66
|
+
return true;
|
67
|
+
} catch (error) {
|
68
|
+
// Continue to next command
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
console.log(chalk.red('❌ Python not found. Please install Python 3.7+'));
|
73
|
+
console.log(chalk.yellow('💡 Download from: https://www.python.org/downloads/'));
|
74
|
+
return false;
|
75
|
+
}
|
76
|
+
|
77
|
+
// Function to check Git
|
78
|
+
async function checkGit() {
|
79
|
+
try {
|
80
|
+
const { stdout } = await execAsync('git --version');
|
81
|
+
console.log(chalk.green(`✅ Git found: ${stdout.trim()}`));
|
82
|
+
return true;
|
83
|
+
} catch (error) {
|
84
|
+
console.log(chalk.yellow('⚠️ Git not found. Please install Git:'));
|
85
|
+
console.log(chalk.yellow(' macOS: brew install git'));
|
86
|
+
console.log(chalk.yellow(' Ubuntu: sudo apt-get install git'));
|
87
|
+
console.log(chalk.yellow(' Windows: https://git-scm.com/download/win'));
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
18
92
|
async function postinstall() {
|
19
93
|
try {
|
20
94
|
console.log(chalk.blue('📦 Running GitArsenal CLI postinstall script...'));
|
21
95
|
|
96
|
+
// Check Python first
|
97
|
+
console.log(chalk.blue('🔍 Checking Python installation...'));
|
98
|
+
const pythonOk = await checkPython();
|
99
|
+
if (!pythonOk) {
|
100
|
+
console.log(chalk.red('❌ Python is required for GitArsenal CLI'));
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
|
104
|
+
// Check Git
|
105
|
+
console.log(chalk.blue('🔍 Checking Git installation...'));
|
106
|
+
await checkGit();
|
107
|
+
|
108
|
+
// Install Python packages
|
109
|
+
console.log(chalk.blue('🔍 Installing Python dependencies...'));
|
110
|
+
await installPythonPackages();
|
111
|
+
|
22
112
|
// Create the Python directory if it doesn't exist
|
23
113
|
await fs.ensureDir(pythonScriptDir);
|
24
114
|
|
@@ -30,10 +120,6 @@ async function postinstall() {
|
|
30
120
|
if (stats.size > 5000) {
|
31
121
|
console.log(chalk.green('✅ Found existing full Python script. Keeping it.'));
|
32
122
|
scriptFound = true;
|
33
|
-
// Skip the rest of the script to avoid overwriting the existing file
|
34
|
-
console.log(chalk.blue('📦 GitArsenal CLI installation complete!'));
|
35
|
-
console.log(chalk.blue('🚀 Run "gitarsenal" to start using the CLI.'));
|
36
|
-
return;
|
37
123
|
} else {
|
38
124
|
console.log(chalk.yellow('⚠️ Existing Python script appears to be minimal. Looking for full version...'));
|
39
125
|
}
|
@@ -129,28 +215,24 @@ if __name__ == "__main__":
|
|
129
215
|
console.log(chalk.yellow(`⚠️ Could not make script executable: ${error.message}`));
|
130
216
|
}
|
131
217
|
|
132
|
-
//
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
}
|
151
|
-
|
152
|
-
console.log(chalk.blue('📦 GitArsenal CLI installation complete!'));
|
153
|
-
console.log(chalk.blue('🚀 Run "gitarsenal" to start using the CLI.'));
|
218
|
+
// Final success message
|
219
|
+
console.log(chalk.green(`
|
220
|
+
✅ GitArsenal CLI Installation Complete!
|
221
|
+
========================================
|
222
|
+
|
223
|
+
What was installed:
|
224
|
+
• GitArsenal CLI (npm package)
|
225
|
+
• Modal (Python package)
|
226
|
+
• GitIngest (Python package)
|
227
|
+
• Requests (Python package)
|
228
|
+
|
229
|
+
💡 Next steps:
|
230
|
+
• Run: gitarsenal --help
|
231
|
+
• Run: gitarsenal setup
|
232
|
+
• Visit: https://gitarsenal.dev
|
233
|
+
|
234
|
+
Having issues? Run: gitarsenal --debug
|
235
|
+
`));
|
154
236
|
|
155
237
|
} catch (error) {
|
156
238
|
console.error(chalk.red(`❌ Error during postinstall: ${error.message}`));
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/python/test_nvcc.py
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
import subprocess
|
2
|
-
import time
|
3
|
-
import modal
|
4
|
-
|
5
|
-
app = modal.App()
|
6
|
-
|
7
|
-
# Use NVIDIA CUDA development image with full toolkit including nvcc
|
8
|
-
cuda_version = "12.8.1" # should be no greater than host CUDA version
|
9
|
-
flavor = "devel" # includes full CUDA toolkit with nvcc
|
10
|
-
operating_sys = "ubuntu24.04"
|
11
|
-
tag = f"{cuda_version}-{flavor}-{operating_sys}"
|
12
|
-
|
13
|
-
image = (
|
14
|
-
modal.Image.from_registry(f"nvidia/cuda:{tag}", add_python="3.12")
|
15
|
-
.entrypoint([]) # remove verbose logging by base image on entry
|
16
|
-
.apt_install("openssh-server", "vim", "nano", "htop", "git") # SSH and useful tools
|
17
|
-
.run_commands("mkdir -p /run/sshd") # SSH daemon requires this directory
|
18
|
-
.add_local_file("~/.ssh/id_rsa.pub", "/root/.ssh/authorized_keys", copy=True)
|
19
|
-
.run_commands("chmod 700 /root/.ssh && chmod 600 /root/.ssh/authorized_keys")
|
20
|
-
)
|
21
|
-
|
22
|
-
@app.function(
|
23
|
-
image=image,
|
24
|
-
gpu="any", # Request GPU access
|
25
|
-
timeout=3600, # Keep alive for 1 hour
|
26
|
-
cpu=2,
|
27
|
-
memory=8192
|
28
|
-
)
|
29
|
-
def start_cuda_container():
|
30
|
-
"""
|
31
|
-
Start a CUDA container with nvcc compiler and SSH access.
|
32
|
-
"""
|
33
|
-
|
34
|
-
# Start SSH daemon
|
35
|
-
print("Starting SSH daemon...")
|
36
|
-
subprocess.Popen(["/usr/sbin/sshd", "-D", "-e"])
|
37
|
-
|
38
|
-
# Verify CUDA installation
|
39
|
-
print("Verifying CUDA installation...")
|
40
|
-
try:
|
41
|
-
nvcc_output = subprocess.check_output(["nvcc", "--version"], text=True)
|
42
|
-
print("NVCC version:")
|
43
|
-
print(nvcc_output)
|
44
|
-
except Exception as e:
|
45
|
-
print(f"Error checking nvcc: {e}")
|
46
|
-
|
47
|
-
try:
|
48
|
-
nvidia_smi_output = subprocess.check_output(["nvidia-smi"], text=True)
|
49
|
-
print("GPU status:")
|
50
|
-
print(nvidia_smi_output)
|
51
|
-
except Exception as e:
|
52
|
-
print(f"Error checking nvidia-smi: {e}")
|
53
|
-
|
54
|
-
# Set up port forwarding for SSH
|
55
|
-
with modal.forward(port=22, unencrypted=True) as tunnel:
|
56
|
-
hostname, port = tunnel.tcp_socket
|
57
|
-
connection_cmd = f'ssh -p {port} root@{hostname}'
|
58
|
-
|
59
|
-
print("=" * 60)
|
60
|
-
print("🚀 CUDA Container Ready!")
|
61
|
-
print("=" * 60)
|
62
|
-
print(f"SSH into container: {connection_cmd}")
|
63
|
-
print(f"Hostname: {hostname}")
|
64
|
-
print(f"Port: {port}")
|
65
|
-
print("=" * 60)
|
66
|
-
print("Available tools:")
|
67
|
-
print("- nvcc (CUDA compiler)")
|
68
|
-
print("- nvidia-smi (GPU monitoring)")
|
69
|
-
print("- vim, nano, git, htop")
|
70
|
-
print("- Python 3.12")
|
71
|
-
print("=" * 60)
|
72
|
-
|
73
|
-
# Keep the container alive
|
74
|
-
print("Container running for 1 hour...")
|
75
|
-
time.sleep(3600)
|
76
|
-
|
77
|
-
# Start the container immediately
|
78
|
-
if __name__ == "__main__":
|
79
|
-
print("Starting CUDA container with nvcc...")
|
80
|
-
start_cuda_container.remote()
|