speiidev 1.4.1 → 1.4.2
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/bin/speiidev.js +29 -6
- package/package.json +1 -1
- package/src/autodev/_version.py +1 -1
package/bin/speiidev.js
CHANGED
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { spawnSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
4
5
|
const os = require('os');
|
|
5
6
|
|
|
6
7
|
const isWin = os.platform() === 'win32';
|
|
7
8
|
const pythonCmd = isWin ? 'python' : 'python3';
|
|
8
9
|
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// 1. Check Python installation
|
|
11
|
+
const checkPython = spawnSync(pythonCmd, ['--version'], { stdio: 'ignore' });
|
|
12
|
+
if (checkPython.error || checkPython.status !== 0) {
|
|
13
|
+
console.error('❌ Error: Python 3 is required to run speiidev, but it was not found.');
|
|
14
|
+
console.error('💡 Please install Python 3: https://www.python.org/downloads/');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
12
17
|
|
|
13
|
-
//
|
|
18
|
+
// 2. Ensure core dependencies (rich, prompt_toolkit) are available
|
|
19
|
+
const checkDeps = spawnSync(pythonCmd, ['-c', 'import rich, prompt_toolkit'], { stdio: 'ignore' });
|
|
20
|
+
if (checkDeps.status !== 0) {
|
|
21
|
+
console.log('📦 Installing required dependencies (rich, prompt_toolkit)...');
|
|
22
|
+
const installResult = spawnSync(pythonCmd, ['-m', 'pip', 'install', 'rich>=13.0.0', 'prompt_toolkit>=3.0.0'], { stdio: 'inherit' });
|
|
23
|
+
if (installResult.status !== 0) {
|
|
24
|
+
// Retry with --break-system-packages / --user for modern PEP 668 managed environments (Homebrew, Ubuntu 24+)
|
|
25
|
+
spawnSync(pythonCmd, ['-m', 'pip', 'install', '--user', '--break-system-packages', 'rich>=13.0.0', 'prompt_toolkit>=3.0.0'], { stdio: 'inherit' });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 3. Resolve bundled Python source code from the npm package
|
|
30
|
+
const srcDir = path.resolve(__dirname, '..', 'src');
|
|
14
31
|
const args = process.argv.slice(2);
|
|
15
|
-
const
|
|
16
|
-
process.
|
|
32
|
+
const env = {
|
|
33
|
+
...process.env,
|
|
34
|
+
PYTHONPATH: srcDir + (process.env.PYTHONPATH ? path.delimiter + process.env.PYTHONPATH : ''),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// 4. Launch the exact bundled code
|
|
38
|
+
const result = spawnSync(pythonCmd, ['-m', 'autodev.cli', ...args], { stdio: 'inherit', env });
|
|
39
|
+
process.exit(result.status !== null ? result.status : 1);
|
package/package.json
CHANGED
package/src/autodev/_version.py
CHANGED