@embedder/embedder 1.0.7
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/LICENSE +36 -0
- package/bundle/embedder.js +600 -0
- package/bundle/gdb-debugger-python/gdb_bridge.py +392 -0
- package/bundle/gdb-debugger-python/requirements.txt +1 -0
- package/bundle/postinstall-for-users.js +497 -0
- package/bundle/prebuilt/darwin-arm64/node-pty.node +0 -0
- package/bundle/prebuilt/darwin-arm64/serialport.node +0 -0
- package/bundle/prebuilt/darwin-x64/node-pty.node +0 -0
- package/bundle/prebuilt/darwin-x64/serialport.node +0 -0
- package/bundle/prebuilt/js/LICENSE +21 -0
- package/bundle/prebuilt/js/README.md +16 -0
- package/bundle/prebuilt/js/dist/index.d.ts +180 -0
- package/bundle/prebuilt/js/dist/index.js +380 -0
- package/bundle/prebuilt/js/package.json +30 -0
- package/bundle/prebuilt/linux-x64/node-pty.node +0 -0
- package/bundle/prebuilt/linux-x64/serialport.node +0 -0
- package/bundle/prebuilt/win32-x64/node-pty.node +0 -0
- package/bundle/prebuilt/win32-x64/serialport.node +0 -0
- package/bundle/repomap-bridge.js +6 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/16/f1/46475231336389d911f729227da4.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/4b/ed/71b2bc3ff2b4ae3127312ffb93b6.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/9a/a5/4cd70a20713e3b8fb1e15ada7795.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/a2/bd/43da7881d5016e770db1c6facb21.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/a9/9a/8d9d8580960d3db4249ad5534c93.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/c9/b3/539c4fa477faa91028d0911cbd93.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/cache.db +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/d2/7f/23d90301a6beae01ee51643cbdec.val +0 -0
- package/bundle/repomap-python/.repomap.tags.cache.v1/d4/03/91f221322e309efe044a99fd3b12.val +0 -0
- package/bundle/repomap-python/__pycache__/importance.cpython-310.pyc +0 -0
- package/bundle/repomap-python/__pycache__/repomap_class.cpython-310.pyc +0 -0
- package/bundle/repomap-python/__pycache__/scm.cpython-310.pyc +0 -0
- package/bundle/repomap-python/__pycache__/utils.cpython-310.pyc +0 -0
- package/bundle/repomap-python/importance.py +58 -0
- package/bundle/repomap-python/queries/repomap_server.py +577 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/README.md +9 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/c-tags.scm +9 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/d-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/go-tags.scm +42 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/java-tags.scm +20 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/python-tags.scm +14 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/r-tags.scm +21 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
- package/bundle/repomap-python/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/README.md +24 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/c-tags.scm +9 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/cpp-tags.scm +15 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/dart-tags.scm +91 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/elisp-tags.scm +8 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/elixir-tags.scm +54 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/elm-tags.scm +19 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/go-tags.scm +30 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/hcl-tags.scm +77 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/java-tags.scm +20 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/javascript-tags.scm +88 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/php-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/python-tags.scm +12 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ql-tags.scm +26 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/ruby-tags.scm +64 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/rust-tags.scm +60 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/scala-tags.scm +65 -0
- package/bundle/repomap-python/queries/tree-sitter-languages/typescript-tags.scm +41 -0
- package/bundle/repomap-python/repomap.py +229 -0
- package/bundle/repomap-python/repomap_bridge.py +234 -0
- package/bundle/repomap-python/repomap_class.py +637 -0
- package/bundle/repomap-python/repomap_server.py +585 -0
- package/bundle/repomap-python/requirements.txt +7 -0
- package/bundle/repomap-python/scm.py +59 -0
- package/bundle/repomap-python/utils.py +58 -0
- package/bundle/sandbox-macos-permissive-closed.sb +26 -0
- package/bundle/sandbox-macos-permissive-open.sb +19 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +31 -0
- package/bundle/sandbox-macos-restrictive-closed.sb +87 -0
- package/bundle/sandbox-macos-restrictive-open.sb +90 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +92 -0
- package/package.json +97 -0
- package/postinstall.js +42 -0
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Post-installation script for end users
|
|
4
|
+
* Installs Python dependencies for RepoMapper when embedder-cli is installed from .tgz
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { spawn, spawnSync } from 'child_process';
|
|
8
|
+
import { resolve, dirname, join } from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
import { existsSync, readFileSync } from 'fs';
|
|
11
|
+
import { platform } from 'os';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
|
|
16
|
+
// Cross-platform Python executable detection
|
|
17
|
+
function getPythonExecutables() {
|
|
18
|
+
const isWindows = platform() === 'win32';
|
|
19
|
+
|
|
20
|
+
if (isWindows) {
|
|
21
|
+
return ['py', 'python', 'python3'];
|
|
22
|
+
} else {
|
|
23
|
+
return ['python3', 'python'];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check if Python executable exists and get version
|
|
28
|
+
function checkPythonExecutable(executable) {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
const child = spawn(executable, ['--version'], {
|
|
31
|
+
stdio: 'pipe',
|
|
32
|
+
shell: platform() === 'win32'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
let output = '';
|
|
36
|
+
child.stdout.on('data', (data) => output += data.toString());
|
|
37
|
+
child.stderr.on('data', (data) => output += data.toString());
|
|
38
|
+
|
|
39
|
+
child.on('close', (code) => {
|
|
40
|
+
if (code === 0 && output.includes('Python')) {
|
|
41
|
+
const versionMatch = output.match(/Python (\d+)\.(\d+)/);
|
|
42
|
+
if (versionMatch) {
|
|
43
|
+
const major = parseInt(versionMatch[1]);
|
|
44
|
+
const minor = parseInt(versionMatch[2]);
|
|
45
|
+
|
|
46
|
+
// Require Python 3.8+
|
|
47
|
+
if (major >= 3 && (major > 3 || minor >= 8)) {
|
|
48
|
+
resolve({ executable, version: `${major}.${minor}`, valid: true });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
resolve({ executable, valid: false });
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
child.on('error', () => {
|
|
57
|
+
resolve({ executable, valid: false });
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Find the best Python executable
|
|
63
|
+
async function findPythonExecutable() {
|
|
64
|
+
const executables = getPythonExecutables();
|
|
65
|
+
|
|
66
|
+
for (const executable of executables) {
|
|
67
|
+
const result = await checkPythonExecutable(executable);
|
|
68
|
+
if (result.valid) {
|
|
69
|
+
console.log(`ā
Found Python ${result.version} at: ${executable}`);
|
|
70
|
+
return executable;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Check if pip is available
|
|
78
|
+
function checkPip(pythonExecutable) {
|
|
79
|
+
return new Promise((resolve) => {
|
|
80
|
+
const child = spawn(pythonExecutable, ['-m', 'pip', '--version'], {
|
|
81
|
+
stdio: 'pipe',
|
|
82
|
+
shell: platform() === 'win32'
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
child.on('close', (code) => {
|
|
86
|
+
resolve(code === 0);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
child.on('error', () => {
|
|
90
|
+
resolve(false);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Install Python dependencies
|
|
96
|
+
function installDependencies(pythonExecutable, requirementsPath) {
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
console.log('š¦ Installing RepoMapper Python dependencies...');
|
|
99
|
+
console.log(`Using: ${pythonExecutable} -m pip install -r ${requirementsPath}`);
|
|
100
|
+
|
|
101
|
+
const child = spawn(pythonExecutable, ['-m', 'pip', 'install', '-r', requirementsPath], {
|
|
102
|
+
stdio: 'inherit',
|
|
103
|
+
shell: platform() === 'win32',
|
|
104
|
+
cwd: dirname(requirementsPath)
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
child.on('close', (code) => {
|
|
108
|
+
if (code === 0) {
|
|
109
|
+
console.log('ā
RepoMapper Python dependencies installed successfully');
|
|
110
|
+
resolve();
|
|
111
|
+
} else {
|
|
112
|
+
reject(new Error(`pip install failed with exit code ${code}`));
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
child.on('error', (error) => {
|
|
117
|
+
reject(new Error(`Failed to run pip install: ${error.message}`));
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Validate installation
|
|
123
|
+
function validateInstallation(pythonExecutable) {
|
|
124
|
+
return new Promise((resolve, reject) => {
|
|
125
|
+
const checkScript = `
|
|
126
|
+
import sys
|
|
127
|
+
|
|
128
|
+
missing = []
|
|
129
|
+
required_modules = ['tiktoken', 'networkx', 'diskcache', 'grep_ast', 'tree_sitter', 'pygments', 'fastmcp']
|
|
130
|
+
|
|
131
|
+
for module in required_modules:
|
|
132
|
+
try:
|
|
133
|
+
__import__(module)
|
|
134
|
+
print(f' ā
{module}')
|
|
135
|
+
except ImportError:
|
|
136
|
+
missing.append(module)
|
|
137
|
+
print(f' ā {module}')
|
|
138
|
+
|
|
139
|
+
if missing:
|
|
140
|
+
print(f'\\nMissing modules: {missing}')
|
|
141
|
+
sys.exit(1)
|
|
142
|
+
else:
|
|
143
|
+
print('\\nā
All RepoMapper Python dependencies are available')
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
console.log('š§Ŗ Validating RepoMapper dependencies...');
|
|
147
|
+
|
|
148
|
+
const child = spawn(pythonExecutable, ['-c', checkScript], {
|
|
149
|
+
stdio: 'inherit',
|
|
150
|
+
shell: platform() === 'win32'
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
child.on('close', (code) => {
|
|
154
|
+
if (code === 0) {
|
|
155
|
+
resolve();
|
|
156
|
+
} else {
|
|
157
|
+
reject(new Error('Some RepoMapper dependencies are missing'));
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
child.on('error', (error) => {
|
|
162
|
+
reject(new Error(`Failed to validate dependencies: ${error.message}`));
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function main() {
|
|
168
|
+
// Skip if environment variable is set
|
|
169
|
+
if (process.env.SKIP_PYTHON_DEPS === 'true') {
|
|
170
|
+
console.log('āļø Skipping Python dependency installation (SKIP_PYTHON_DEPS=true)');
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
console.log('š§ Setting up Python dependencies for embedder-cli...');
|
|
175
|
+
console.log('');
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
await setupRepoMapperDependencies();
|
|
179
|
+
await setupGdbDebuggerDependencies();
|
|
180
|
+
} catch (error) {
|
|
181
|
+
console.error('ā Failed to setup Python dependencies:', error.message);
|
|
182
|
+
|
|
183
|
+
// Don't fail the npm install process by default, just warn
|
|
184
|
+
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
185
|
+
console.error('');
|
|
186
|
+
console.error('ā ļø Continuing with installation (some features may not work)');
|
|
187
|
+
} else {
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async function setupRepoMapperDependencies() {
|
|
194
|
+
try {
|
|
195
|
+
console.log('š¦ Setting up RepoMapper Python dependencies...');
|
|
196
|
+
|
|
197
|
+
// Check for both bundled and source installations
|
|
198
|
+
const bundleDir = resolve(__dirname, '../bundle');
|
|
199
|
+
const repomapPythonDir = join(bundleDir, 'repomap-python');
|
|
200
|
+
const bundledRequirementsPath = join(repomapPythonDir, 'requirements.txt');
|
|
201
|
+
const sourceRepomapDir = resolve(__dirname, '../packages/RepoMapper');
|
|
202
|
+
const sourceRequirementsPath = join(sourceRepomapDir, 'python/requirements.txt');
|
|
203
|
+
|
|
204
|
+
// Determine which installation type we have
|
|
205
|
+
if (existsSync(sourceRequirementsPath)) {
|
|
206
|
+
console.log('š¦ Found source RepoMapper, using unified installer with virtual environment...');
|
|
207
|
+
|
|
208
|
+
// Use the unified installer for source installations (supports virtual environments)
|
|
209
|
+
try {
|
|
210
|
+
const result = spawnSync('node', [
|
|
211
|
+
join(sourceRepomapDir, 'scripts/install-python-deps-unified.js')
|
|
212
|
+
], {
|
|
213
|
+
stdio: 'inherit',
|
|
214
|
+
cwd: sourceRepomapDir
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (result.status === 0) {
|
|
218
|
+
console.log('ā
RepoMapper Python dependencies setup complete via unified installer!');
|
|
219
|
+
return;
|
|
220
|
+
} else {
|
|
221
|
+
throw new Error(`Unified installer exited with code ${result.status}`);
|
|
222
|
+
}
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error('ā Failed to run unified installer:', error.message);
|
|
225
|
+
console.error(' Falling back to manual installation instructions...');
|
|
226
|
+
console.error(' Run: cd packages/RepoMapper && npm run install-python-deps');
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
} else if (existsSync(bundledRequirementsPath)) {
|
|
230
|
+
console.log('š¦ Found bundled RepoMapper, creating virtual environment...');
|
|
231
|
+
|
|
232
|
+
// For bundled installations, we also need virtual environments!
|
|
233
|
+
// Create a virtual environment in the bundle directory
|
|
234
|
+
const bundleVenvPath = join(bundleDir, 'repomap-venv');
|
|
235
|
+
const isWindows = platform() === 'win32';
|
|
236
|
+
const venvPython = isWindows
|
|
237
|
+
? join(bundleVenvPath, 'Scripts', 'python.exe')
|
|
238
|
+
: join(bundleVenvPath, 'bin', 'python');
|
|
239
|
+
|
|
240
|
+
try {
|
|
241
|
+
// Create virtual environment if it doesn't exist
|
|
242
|
+
if (!existsSync(venvPython)) {
|
|
243
|
+
console.log('šļø Creating virtual environment for bundled installation...');
|
|
244
|
+
|
|
245
|
+
// Find system Python
|
|
246
|
+
const pythonExecutable = await findPythonExecutable();
|
|
247
|
+
if (!pythonExecutable) {
|
|
248
|
+
throw new Error('No suitable Python installation found');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Create virtual environment
|
|
252
|
+
const createVenvResult = spawnSync(pythonExecutable, ['-m', 'venv', bundleVenvPath], {
|
|
253
|
+
stdio: 'inherit'
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
if (createVenvResult.status !== 0) {
|
|
257
|
+
throw new Error(`Failed to create virtual environment (exit code ${createVenvResult.status})`);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
console.log('ā
Virtual environment created successfully');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Install dependencies in virtual environment
|
|
264
|
+
console.log('š¦ Installing dependencies in virtual environment...');
|
|
265
|
+
const installResult = spawnSync(venvPython, ['-m', 'pip', 'install', '-r', bundledRequirementsPath], {
|
|
266
|
+
stdio: 'inherit',
|
|
267
|
+
cwd: repomapPythonDir
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
if (installResult.status !== 0) {
|
|
271
|
+
throw new Error(`pip install failed with exit code ${installResult.status}`);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
console.log('ā
RepoMapper Python dependencies installed successfully');
|
|
275
|
+
|
|
276
|
+
// Validate installation
|
|
277
|
+
await validateInstallation(venvPython);
|
|
278
|
+
|
|
279
|
+
console.log('š RepoMapper Python dependencies setup complete!');
|
|
280
|
+
return;
|
|
281
|
+
|
|
282
|
+
} catch (error) {
|
|
283
|
+
console.error('ā Failed to setup bundled RepoMapper with virtual environment:', error.message);
|
|
284
|
+
console.error(' Falling back to global installation...');
|
|
285
|
+
// Fall through to the original bundled logic below
|
|
286
|
+
}
|
|
287
|
+
} else {
|
|
288
|
+
console.log('ā¹ļø No RepoMapper installation found, skipping Python setup');
|
|
289
|
+
console.log(' (This is normal for CLI-only installations)');
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
console.log('š Setting up RepoMapper Python dependencies...');
|
|
294
|
+
|
|
295
|
+
// Find Python executable
|
|
296
|
+
const pythonExecutable = await findPythonExecutable();
|
|
297
|
+
if (!pythonExecutable) {
|
|
298
|
+
console.error('ā No suitable Python installation found');
|
|
299
|
+
console.error(' Please install Python 3.8+ and ensure it\'s in your PATH');
|
|
300
|
+
console.error(' Windows: Install from https://python.org or Microsoft Store');
|
|
301
|
+
console.error(' macOS: Install via homebrew or python.org');
|
|
302
|
+
console.error(' Linux: Install via package manager (apt, yum, etc.)');
|
|
303
|
+
console.error('');
|
|
304
|
+
console.error(' To skip this check, set SKIP_PYTHON_DEPS=true');
|
|
305
|
+
|
|
306
|
+
// Don't fail the installation, just warn
|
|
307
|
+
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
308
|
+
console.error('');
|
|
309
|
+
console.error('ā ļø Continuing with installation (RepoMapper features may not work)');
|
|
310
|
+
return;
|
|
311
|
+
} else {
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Check pip
|
|
317
|
+
console.log('š Checking pip availability...');
|
|
318
|
+
const pipAvailable = await checkPip(pythonExecutable);
|
|
319
|
+
if (!pipAvailable) {
|
|
320
|
+
console.error('ā pip is not available');
|
|
321
|
+
console.error(' Please install pip for your Python installation');
|
|
322
|
+
console.error(' Usually: python -m ensurepip --upgrade');
|
|
323
|
+
|
|
324
|
+
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
325
|
+
console.error('');
|
|
326
|
+
console.error('ā ļø Continuing with installation (RepoMapper features may not work)');
|
|
327
|
+
return;
|
|
328
|
+
} else {
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
console.log('ā
pip is available');
|
|
334
|
+
|
|
335
|
+
// Install dependencies
|
|
336
|
+
await installDependencies(pythonExecutable, requirementsPath);
|
|
337
|
+
|
|
338
|
+
// Validate installation
|
|
339
|
+
await validateInstallation(pythonExecutable);
|
|
340
|
+
|
|
341
|
+
console.log('');
|
|
342
|
+
console.log('š RepoMapper Python dependencies setup complete!');
|
|
343
|
+
|
|
344
|
+
} catch (error) {
|
|
345
|
+
console.error('ā Failed to install RepoMapper Python dependencies:', error.message);
|
|
346
|
+
console.error('');
|
|
347
|
+
console.error('You can:');
|
|
348
|
+
console.error('1. Install dependencies manually: pip install -r bundle/repomap-python/requirements.txt');
|
|
349
|
+
console.error('2. Skip this check by setting SKIP_PYTHON_DEPS=true');
|
|
350
|
+
console.error('3. Use embedder-cli without RepoMapper features');
|
|
351
|
+
|
|
352
|
+
// Don't fail the npm install process by default, just warn
|
|
353
|
+
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
354
|
+
console.error('');
|
|
355
|
+
console.error('ā ļø Continuing with installation (RepoMapper features may not work)');
|
|
356
|
+
} else {
|
|
357
|
+
throw error;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
async function setupGdbDebuggerDependencies() {
|
|
363
|
+
try {
|
|
364
|
+
console.log('š§ Setting up GDB Debugger Python dependencies...');
|
|
365
|
+
|
|
366
|
+
// Look for GDB Debugger Python requirements in the bundle
|
|
367
|
+
const bundleDir = resolve(__dirname, '../bundle');
|
|
368
|
+
const gdbDebuggerPythonDir = join(bundleDir, 'gdb-debugger-python');
|
|
369
|
+
const requirementsPath = join(gdbDebuggerPythonDir, 'requirements.txt');
|
|
370
|
+
|
|
371
|
+
if (!existsSync(requirementsPath)) {
|
|
372
|
+
console.log('ā¹ļø GDB Debugger Python files not found, skipping Python setup');
|
|
373
|
+
console.log(' (This is normal if you\'re installing from source)');
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
console.log('š Setting up GDB Debugger Python dependencies...');
|
|
378
|
+
|
|
379
|
+
// Find Python executable
|
|
380
|
+
const pythonExecutable = await findPythonExecutable();
|
|
381
|
+
if (!pythonExecutable) {
|
|
382
|
+
console.error('ā No suitable Python installation found for GDB Debugger');
|
|
383
|
+
console.error(' Please install Python 3.8+ and ensure it\'s in your PATH');
|
|
384
|
+
|
|
385
|
+
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
386
|
+
console.error('');
|
|
387
|
+
console.error('ā ļø Continuing with installation (GDB Debugger features may not work)');
|
|
388
|
+
return;
|
|
389
|
+
} else {
|
|
390
|
+
process.exit(1);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Check pip
|
|
395
|
+
const pipAvailable = await checkPip(pythonExecutable);
|
|
396
|
+
if (!pipAvailable) {
|
|
397
|
+
console.error('ā pip is not available for GDB Debugger');
|
|
398
|
+
|
|
399
|
+
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
400
|
+
console.error('');
|
|
401
|
+
console.error('ā ļø Continuing with installation (GDB Debugger features may not work)');
|
|
402
|
+
return;
|
|
403
|
+
} else {
|
|
404
|
+
process.exit(1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Install dependencies directly (GDB Debugger doesn't need virtual env in global install)
|
|
409
|
+
await installGdbDebuggerDependencies(pythonExecutable, requirementsPath);
|
|
410
|
+
|
|
411
|
+
// Validate installation
|
|
412
|
+
await validateGdbDebuggerInstallation(pythonExecutable);
|
|
413
|
+
|
|
414
|
+
console.log('');
|
|
415
|
+
console.log('šÆ GDB Debugger Python dependencies setup complete!');
|
|
416
|
+
|
|
417
|
+
} catch (error) {
|
|
418
|
+
console.error('ā Failed to install GDB Debugger Python dependencies:', error.message);
|
|
419
|
+
console.error('');
|
|
420
|
+
console.error('You can:');
|
|
421
|
+
console.error('1. Install dependencies manually: pip install -r bundle/gdb-debugger-python/requirements.txt');
|
|
422
|
+
console.error('2. Skip this check by setting SKIP_PYTHON_DEPS=true');
|
|
423
|
+
console.error('3. Use embedder-cli without GDB Debugger features');
|
|
424
|
+
|
|
425
|
+
// Don't fail the npm install process by default, just warn
|
|
426
|
+
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
427
|
+
console.error('');
|
|
428
|
+
console.error('ā ļø Continuing with installation (GDB Debugger features may not work)');
|
|
429
|
+
} else {
|
|
430
|
+
throw error;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// Install GDB Debugger Python dependencies
|
|
436
|
+
function installGdbDebuggerDependencies(pythonExecutable, requirementsPath) {
|
|
437
|
+
return new Promise((resolve, reject) => {
|
|
438
|
+
console.log('š¦ Installing GDB Debugger Python dependencies...');
|
|
439
|
+
console.log(`Using: ${pythonExecutable} -m pip install -r ${requirementsPath}`);
|
|
440
|
+
|
|
441
|
+
const child = spawn(pythonExecutable, ['-m', 'pip', 'install', '-r', requirementsPath], {
|
|
442
|
+
stdio: 'inherit',
|
|
443
|
+
shell: platform() === 'win32',
|
|
444
|
+
cwd: dirname(requirementsPath)
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
child.on('close', (code) => {
|
|
448
|
+
if (code === 0) {
|
|
449
|
+
console.log('ā
GDB Debugger Python dependencies installed successfully');
|
|
450
|
+
resolve();
|
|
451
|
+
} else {
|
|
452
|
+
reject(new Error(`pip install failed with exit code ${code}`));
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
child.on('error', (error) => {
|
|
457
|
+
reject(new Error(`Failed to run pip install: ${error.message}`));
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Validate GDB Debugger Python installation
|
|
463
|
+
function validateGdbDebuggerInstallation(pythonExecutable) {
|
|
464
|
+
return new Promise((resolve, reject) => {
|
|
465
|
+
console.log('š Validating GDB Debugger Python installation...');
|
|
466
|
+
|
|
467
|
+
const child = spawn(pythonExecutable, ['-c', `
|
|
468
|
+
try:
|
|
469
|
+
import pygdbmi
|
|
470
|
+
print('\\nā
All GDB Debugger Python dependencies are available')
|
|
471
|
+
print(f' pygdbmi version: {pygdbmi.__version__}')
|
|
472
|
+
except ImportError as e:
|
|
473
|
+
print(f'\\nā Missing dependency: {e}')
|
|
474
|
+
exit(1)
|
|
475
|
+
`], {
|
|
476
|
+
stdio: 'inherit',
|
|
477
|
+
shell: platform() === 'win32'
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
child.on('close', (code) => {
|
|
481
|
+
if (code === 0) {
|
|
482
|
+
resolve();
|
|
483
|
+
} else {
|
|
484
|
+
reject(new Error('Python validation failed'));
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
child.on('error', (error) => {
|
|
489
|
+
reject(new Error(`Failed to validate installation: ${error.message}`));
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Run if this is the main module
|
|
495
|
+
if (import.meta.url.startsWith('file:') && process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
496
|
+
main();
|
|
497
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2010 Christopher Williams. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to
|
|
7
|
+
deal in the Software without restriction, including without limitation the
|
|
8
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
9
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
21
|
+
IN THE SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @serialport/stream
|
|
2
|
+
|
|
3
|
+
The serialport stream interface. This package requires bindings to work.
|
|
4
|
+
|
|
5
|
+
You'd use this if you want to keep your package size down by requiring only the parts of serialport that you want to use. It is used internally in the `serialport` package.
|
|
6
|
+
|
|
7
|
+
This is how you use it.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
const { SerialPortStream } = require('@serialport/stream')
|
|
11
|
+
const { autoDetect } = require('@serialport/bindings-cpp')
|
|
12
|
+
const binding = autoDetect()
|
|
13
|
+
const port = new SerialPortStream({ binding, path: '/dev/ttyay', baudRate: 9600 })
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Learn more at our [stream documentation](https://serialport.io/docs/api-stream) page.
|