gitarsenal-cli 1.8.5 → 1.8.6
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 +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +38 -45
package/activate_venv.sh
CHANGED
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
@@ -65,74 +65,67 @@ async function checkAndInstallUv() {
|
|
65
65
|
}
|
66
66
|
}
|
67
67
|
|
68
|
-
// Function to create and activate virtual environment
|
68
|
+
// Function to create and activate virtual environment using uv
|
69
69
|
async function createVirtualEnvironment() {
|
70
|
-
const venvPath = path.join(__dirname, '..', 'venv');
|
71
70
|
const packages = ['modal', 'gitingest', 'requests'];
|
72
71
|
|
73
|
-
console.log(chalk.yellow(`📦 Creating virtual environment and installing packages: ${packages.join(', ')}`));
|
72
|
+
console.log(chalk.yellow(`📦 Creating virtual environment with uv and installing packages: ${packages.join(', ')}`));
|
74
73
|
|
75
74
|
try {
|
76
|
-
//
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
// First, ensure uv is available
|
76
|
+
let uvAvailable = false;
|
77
|
+
try {
|
78
|
+
await execAsync('uv --version');
|
79
|
+
uvAvailable = true;
|
80
|
+
} catch (error) {
|
81
|
+
console.log(chalk.yellow('⚠️ uv not found, attempting to install...'));
|
82
|
+
await checkAndInstallUv();
|
84
83
|
try {
|
85
|
-
await execAsync(
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
84
|
+
await execAsync('uv --version');
|
85
|
+
uvAvailable = true;
|
86
|
+
} catch (installError) {
|
87
|
+
console.log(chalk.red('❌ Failed to install uv'));
|
88
|
+
return false;
|
90
89
|
}
|
91
90
|
}
|
92
91
|
|
93
|
-
if (!
|
94
|
-
console.log(chalk.red('❌
|
92
|
+
if (!uvAvailable) {
|
93
|
+
console.log(chalk.red('❌ uv is required but not available'));
|
95
94
|
return false;
|
96
95
|
}
|
97
96
|
|
98
|
-
console.log(chalk.gray(`🔄 Creating virtual environment with
|
97
|
+
console.log(chalk.gray(`🔄 Creating virtual environment with uv...`));
|
99
98
|
|
100
|
-
// Create virtual environment
|
101
|
-
await execAsync(
|
99
|
+
// Create virtual environment using uv
|
100
|
+
await execAsync('uv venv', {
|
101
|
+
cwd: path.join(__dirname, '..'),
|
102
102
|
env: { ...process.env, PYTHONIOENCODING: 'utf-8' }
|
103
103
|
});
|
104
104
|
|
105
|
-
console.log(chalk.green('✅ Virtual environment created successfully!'));
|
105
|
+
console.log(chalk.green('✅ Virtual environment created successfully with uv!'));
|
106
106
|
|
107
|
-
|
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');
|
107
|
+
console.log(chalk.gray(`🔄 Installing packages in virtual environment with uv...`));
|
111
108
|
|
112
|
-
//
|
113
|
-
|
114
|
-
|
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(' ')}`, {
|
109
|
+
// Install packages using uv pip
|
110
|
+
await execAsync(`uv pip install ${packages.join(' ')}`, {
|
111
|
+
cwd: path.join(__dirname, '..'),
|
122
112
|
env: { ...process.env, PYTHONIOENCODING: 'utf-8' }
|
123
113
|
});
|
124
114
|
|
125
115
|
console.log(chalk.green('✅ Python packages installed successfully in virtual environment!'));
|
126
116
|
|
127
117
|
// Create a script to activate the virtual environment
|
118
|
+
const isWindows = process.platform === 'win32';
|
119
|
+
const venvPath = path.join(__dirname, '..', '.venv');
|
120
|
+
|
128
121
|
const activateScript = isWindows ?
|
129
122
|
`@echo off
|
130
123
|
cd /d "%~dp0"
|
131
|
-
call "
|
124
|
+
call ".venv\\Scripts\\activate.bat"
|
132
125
|
%*` :
|
133
126
|
`#!/bin/bash
|
134
127
|
cd "$(dirname "$0")"
|
135
|
-
source "
|
128
|
+
source ".venv/bin/activate"
|
136
129
|
exec "$@"`;
|
137
130
|
|
138
131
|
const activateScriptPath = path.join(__dirname, '..', 'activate_venv' + (isWindows ? '.bat' : '.sh'));
|
@@ -146,12 +139,12 @@ exec "$@"`;
|
|
146
139
|
|
147
140
|
return true;
|
148
141
|
} catch (error) {
|
149
|
-
console.log(chalk.red(`❌ Error creating virtual environment: ${error.message}`));
|
142
|
+
console.log(chalk.red(`❌ Error creating virtual environment with uv: ${error.message}`));
|
150
143
|
console.log(chalk.yellow('💡 Please run manually:'));
|
151
|
-
console.log(chalk.yellow('
|
152
|
-
console.log(chalk.yellow('
|
153
|
-
console.log(chalk.yellow(' venv
|
154
|
-
console.log(chalk.yellow('
|
144
|
+
console.log(chalk.yellow(' uv venv'));
|
145
|
+
console.log(chalk.yellow(' uv pip install modal gitingest requests'));
|
146
|
+
console.log(chalk.yellow(' source .venv/bin/activate # On Unix/macOS'));
|
147
|
+
console.log(chalk.yellow(' .venv\\Scripts\\activate.bat # On Windows'));
|
155
148
|
return false;
|
156
149
|
}
|
157
150
|
}
|
@@ -338,8 +331,8 @@ if __name__ == "__main__":
|
|
338
331
|
• Visit: https://gitarsenal.dev
|
339
332
|
|
340
333
|
💡 To activate the virtual environment:
|
341
|
-
• Unix/macOS: source venv/bin/activate
|
342
|
-
• Windows: venv\\Scripts\\activate.bat
|
334
|
+
• Unix/macOS: source .venv/bin/activate
|
335
|
+
• Windows: .venv\\Scripts\\activate.bat
|
343
336
|
• Or use: ./activate_venv.sh (Unix/macOS) or activate_venv.bat (Windows)
|
344
337
|
|
345
338
|
Having issues? Run: gitarsenal --debug
|