@embedder/embedder 1.1.0 → 2.0.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/assets/_commonjsHelpers-C1uRMj_j.js +1 -0
- package/assets/cli-DIXdkQBM.js +887 -0
- package/assets/devtools-B4JKPJyU.js +1 -0
- package/assets/index-B3hJUcJE.js +1 -0
- package/assets/index-BCdeyKtY.js +1 -0
- package/assets/index-oEV_emLn.js +1 -0
- package/cli.js +2 -0
- package/package.json +15 -96
- package/LICENSE +0 -36
- package/bundle/embedder.js +0 -618
- package/bundle/gdb-debugger-python/gdb_bridge.py +0 -392
- package/bundle/gdb-debugger-python/requirements.txt +0 -1
- package/bundle/postinstall-for-users.js +0 -515
- package/bundle/repomap-bridge.js +0 -6
- package/bundle/repomap-python/importance.py +0 -58
- package/bundle/repomap-python/queries/tree-sitter-language-pack/README.md +0 -9
- package/bundle/repomap-python/queries/tree-sitter-language-pack/arduino-tags.scm +0 -5
- package/bundle/repomap-python/queries/tree-sitter-language-pack/c-tags.scm +0 -9
- package/bundle/repomap-python/queries/tree-sitter-language-pack/chatito-tags.scm +0 -16
- package/bundle/repomap-python/queries/tree-sitter-language-pack/commonlisp-tags.scm +0 -122
- package/bundle/repomap-python/queries/tree-sitter-language-pack/cpp-tags.scm +0 -15
- package/bundle/repomap-python/queries/tree-sitter-language-pack/csharp-tags.scm +0 -26
- package/bundle/repomap-python/queries/tree-sitter-language-pack/d-tags.scm +0 -26
- package/bundle/repomap-python/queries/tree-sitter-language-pack/dart-tags.scm +0 -92
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elisp-tags.scm +0 -5
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elixir-tags.scm +0 -54
- package/bundle/repomap-python/queries/tree-sitter-language-pack/elm-tags.scm +0 -19
- package/bundle/repomap-python/queries/tree-sitter-language-pack/gleam-tags.scm +0 -41
- package/bundle/repomap-python/queries/tree-sitter-language-pack/go-tags.scm +0 -42
- package/bundle/repomap-python/queries/tree-sitter-language-pack/java-tags.scm +0 -20
- package/bundle/repomap-python/queries/tree-sitter-language-pack/javascript-tags.scm +0 -88
- package/bundle/repomap-python/queries/tree-sitter-language-pack/lua-tags.scm +0 -34
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ocaml-tags.scm +0 -115
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +0 -98
- package/bundle/repomap-python/queries/tree-sitter-language-pack/pony-tags.scm +0 -39
- package/bundle/repomap-python/queries/tree-sitter-language-pack/properties-tags.scm +0 -5
- package/bundle/repomap-python/queries/tree-sitter-language-pack/python-tags.scm +0 -14
- package/bundle/repomap-python/queries/tree-sitter-language-pack/r-tags.scm +0 -21
- package/bundle/repomap-python/queries/tree-sitter-language-pack/racket-tags.scm +0 -12
- package/bundle/repomap-python/queries/tree-sitter-language-pack/ruby-tags.scm +0 -64
- package/bundle/repomap-python/queries/tree-sitter-language-pack/rust-tags.scm +0 -60
- package/bundle/repomap-python/queries/tree-sitter-language-pack/solidity-tags.scm +0 -43
- package/bundle/repomap-python/queries/tree-sitter-language-pack/swift-tags.scm +0 -51
- package/bundle/repomap-python/queries/tree-sitter-language-pack/udev-tags.scm +0 -20
- package/bundle/repomap-python/queries/tree-sitter-languages/README.md +0 -24
- package/bundle/repomap-python/queries/tree-sitter-languages/c-tags.scm +0 -9
- package/bundle/repomap-python/queries/tree-sitter-languages/c_sharp-tags.scm +0 -46
- package/bundle/repomap-python/queries/tree-sitter-languages/cpp-tags.scm +0 -15
- package/bundle/repomap-python/queries/tree-sitter-languages/dart-tags.scm +0 -91
- package/bundle/repomap-python/queries/tree-sitter-languages/elisp-tags.scm +0 -8
- package/bundle/repomap-python/queries/tree-sitter-languages/elixir-tags.scm +0 -54
- package/bundle/repomap-python/queries/tree-sitter-languages/elm-tags.scm +0 -19
- package/bundle/repomap-python/queries/tree-sitter-languages/go-tags.scm +0 -30
- package/bundle/repomap-python/queries/tree-sitter-languages/hcl-tags.scm +0 -77
- package/bundle/repomap-python/queries/tree-sitter-languages/java-tags.scm +0 -20
- package/bundle/repomap-python/queries/tree-sitter-languages/javascript-tags.scm +0 -88
- package/bundle/repomap-python/queries/tree-sitter-languages/kotlin-tags.scm +0 -27
- package/bundle/repomap-python/queries/tree-sitter-languages/ocaml-tags.scm +0 -115
- package/bundle/repomap-python/queries/tree-sitter-languages/ocaml_interface-tags.scm +0 -98
- package/bundle/repomap-python/queries/tree-sitter-languages/php-tags.scm +0 -26
- package/bundle/repomap-python/queries/tree-sitter-languages/python-tags.scm +0 -12
- package/bundle/repomap-python/queries/tree-sitter-languages/ql-tags.scm +0 -26
- package/bundle/repomap-python/queries/tree-sitter-languages/ruby-tags.scm +0 -64
- package/bundle/repomap-python/queries/tree-sitter-languages/rust-tags.scm +0 -60
- package/bundle/repomap-python/queries/tree-sitter-languages/scala-tags.scm +0 -65
- package/bundle/repomap-python/queries/tree-sitter-languages/typescript-tags.scm +0 -41
- package/bundle/repomap-python/repomap.py +0 -229
- package/bundle/repomap-python/repomap_bridge.py +0 -234
- package/bundle/repomap-python/repomap_class.py +0 -637
- package/bundle/repomap-python/repomap_server.py +0 -561
- package/bundle/repomap-python/requirements.txt +0 -7
- package/bundle/repomap-python/scm.py +0 -59
- package/bundle/repomap-python/utils.py +0 -58
- package/bundle/sandbox-macos-permissive-closed.sb +0 -26
- package/bundle/sandbox-macos-permissive-open.sb +0 -19
- package/bundle/sandbox-macos-permissive-proxied.sb +0 -31
- package/bundle/sandbox-macos-restrictive-closed.sb +0 -87
- package/bundle/sandbox-macos-restrictive-open.sb +0 -90
- package/bundle/sandbox-macos-restrictive-proxied.sb +0 -92
- package/postinstall.js +0 -42
|
@@ -1,515 +0,0 @@
|
|
|
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
|
-
const isWindows = platform() === 'win32';
|
|
99
|
-
|
|
100
|
-
// Use --user flag on Unix systems to avoid permission issues with global installation
|
|
101
|
-
const pipArgs = ['-m', 'pip', 'install'];
|
|
102
|
-
if (!isWindows) {
|
|
103
|
-
pipArgs.push('--user');
|
|
104
|
-
}
|
|
105
|
-
pipArgs.push('-r', requirementsPath);
|
|
106
|
-
|
|
107
|
-
console.log('📦 Installing RepoMapper Python dependencies...');
|
|
108
|
-
console.log(`Using: ${pythonExecutable} ${pipArgs.join(' ')}`);
|
|
109
|
-
|
|
110
|
-
const child = spawn(pythonExecutable, pipArgs, {
|
|
111
|
-
stdio: 'inherit',
|
|
112
|
-
shell: isWindows,
|
|
113
|
-
cwd: dirname(requirementsPath)
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
child.on('close', (code) => {
|
|
117
|
-
if (code === 0) {
|
|
118
|
-
console.log('✅ RepoMapper Python dependencies installed successfully');
|
|
119
|
-
resolve();
|
|
120
|
-
} else {
|
|
121
|
-
reject(new Error(`pip install failed with exit code ${code}`));
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
child.on('error', (error) => {
|
|
126
|
-
reject(new Error(`Failed to run pip install: ${error.message}`));
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Validate installation
|
|
132
|
-
function validateInstallation(pythonExecutable) {
|
|
133
|
-
return new Promise((resolve, reject) => {
|
|
134
|
-
const checkScript = `
|
|
135
|
-
import sys
|
|
136
|
-
|
|
137
|
-
missing = []
|
|
138
|
-
required_modules = ['tiktoken', 'networkx', 'diskcache', 'grep_ast', 'tree_sitter', 'pygments', 'fastmcp']
|
|
139
|
-
|
|
140
|
-
for module in required_modules:
|
|
141
|
-
try:
|
|
142
|
-
__import__(module)
|
|
143
|
-
print(f' ✅ {module}')
|
|
144
|
-
except ImportError:
|
|
145
|
-
missing.append(module)
|
|
146
|
-
print(f' ❌ {module}')
|
|
147
|
-
|
|
148
|
-
if missing:
|
|
149
|
-
print(f'\\nMissing modules: {missing}')
|
|
150
|
-
sys.exit(1)
|
|
151
|
-
else:
|
|
152
|
-
print('\\n✅ All RepoMapper Python dependencies are available')
|
|
153
|
-
`;
|
|
154
|
-
|
|
155
|
-
console.log('🧪 Validating RepoMapper dependencies...');
|
|
156
|
-
|
|
157
|
-
const child = spawn(pythonExecutable, ['-c', checkScript], {
|
|
158
|
-
stdio: 'inherit',
|
|
159
|
-
shell: platform() === 'win32'
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
child.on('close', (code) => {
|
|
163
|
-
if (code === 0) {
|
|
164
|
-
resolve();
|
|
165
|
-
} else {
|
|
166
|
-
reject(new Error('Some RepoMapper dependencies are missing'));
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
child.on('error', (error) => {
|
|
171
|
-
reject(new Error(`Failed to validate dependencies: ${error.message}`));
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
async function main() {
|
|
177
|
-
// Skip if environment variable is set
|
|
178
|
-
if (process.env.SKIP_PYTHON_DEPS === 'true') {
|
|
179
|
-
console.log('⏭️ Skipping Python dependency installation (SKIP_PYTHON_DEPS=true)');
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
console.log('🔧 Setting up Python dependencies for embedder-cli...');
|
|
184
|
-
console.log('');
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
await setupRepoMapperDependencies();
|
|
188
|
-
await setupGdbDebuggerDependencies();
|
|
189
|
-
} catch (error) {
|
|
190
|
-
console.error('❌ Failed to setup Python dependencies:', error.message);
|
|
191
|
-
|
|
192
|
-
// Don't fail the npm install process by default, just warn
|
|
193
|
-
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
194
|
-
console.error('');
|
|
195
|
-
console.error('⚠️ Continuing with installation (some features may not work)');
|
|
196
|
-
} else {
|
|
197
|
-
process.exit(1);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
async function setupRepoMapperDependencies() {
|
|
203
|
-
try {
|
|
204
|
-
console.log('📦 Setting up RepoMapper Python dependencies...');
|
|
205
|
-
|
|
206
|
-
// Check for both bundled and source installations
|
|
207
|
-
const bundleDir = resolve(__dirname, '../bundle');
|
|
208
|
-
const repomapPythonDir = join(bundleDir, 'repomap-python');
|
|
209
|
-
const bundledRequirementsPath = join(repomapPythonDir, 'requirements.txt');
|
|
210
|
-
const sourceRepomapDir = resolve(__dirname, '../packages/RepoMapper');
|
|
211
|
-
const sourceRequirementsPath = join(sourceRepomapDir, 'python/requirements.txt');
|
|
212
|
-
|
|
213
|
-
// Determine which installation type we have
|
|
214
|
-
if (existsSync(sourceRequirementsPath)) {
|
|
215
|
-
console.log('📦 Found source RepoMapper, using unified installer with virtual environment...');
|
|
216
|
-
|
|
217
|
-
// Use the unified installer for source installations (supports virtual environments)
|
|
218
|
-
try {
|
|
219
|
-
const result = spawnSync('node', [
|
|
220
|
-
join(sourceRepomapDir, 'scripts/install-python-deps-unified.js')
|
|
221
|
-
], {
|
|
222
|
-
stdio: 'inherit',
|
|
223
|
-
cwd: sourceRepomapDir
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
if (result.status === 0) {
|
|
227
|
-
console.log('✅ RepoMapper Python dependencies setup complete via unified installer!');
|
|
228
|
-
return;
|
|
229
|
-
} else {
|
|
230
|
-
throw new Error(`Unified installer exited with code ${result.status}`);
|
|
231
|
-
}
|
|
232
|
-
} catch (error) {
|
|
233
|
-
console.error('❌ Failed to run unified installer:', error.message);
|
|
234
|
-
console.error(' Falling back to manual installation instructions...');
|
|
235
|
-
console.error(' Run: cd packages/RepoMapper && npm run install-python-deps');
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
} else if (existsSync(bundledRequirementsPath)) {
|
|
239
|
-
console.log('📦 Found bundled RepoMapper, creating virtual environment...');
|
|
240
|
-
|
|
241
|
-
// For bundled installations, we also need virtual environments!
|
|
242
|
-
// Create a virtual environment in the bundle directory
|
|
243
|
-
const bundleVenvPath = join(bundleDir, 'repomap-venv');
|
|
244
|
-
const isWindows = platform() === 'win32';
|
|
245
|
-
const venvPython = isWindows
|
|
246
|
-
? join(bundleVenvPath, 'Scripts', 'python.exe')
|
|
247
|
-
: join(bundleVenvPath, 'bin', 'python');
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
// Create virtual environment if it doesn't exist
|
|
251
|
-
if (!existsSync(venvPython)) {
|
|
252
|
-
console.log('🏗️ Creating virtual environment for bundled installation...');
|
|
253
|
-
|
|
254
|
-
// Find system Python
|
|
255
|
-
const pythonExecutable = await findPythonExecutable();
|
|
256
|
-
if (!pythonExecutable) {
|
|
257
|
-
throw new Error('No suitable Python installation found');
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Create virtual environment
|
|
261
|
-
const createVenvResult = spawnSync(pythonExecutable, ['-m', 'venv', bundleVenvPath], {
|
|
262
|
-
stdio: 'inherit'
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
if (createVenvResult.status !== 0) {
|
|
266
|
-
throw new Error(`Failed to create virtual environment (exit code ${createVenvResult.status})`);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
console.log('✅ Virtual environment created successfully');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Install dependencies in virtual environment
|
|
273
|
-
console.log('📦 Installing dependencies in virtual environment...');
|
|
274
|
-
const installResult = spawnSync(venvPython, ['-m', 'pip', 'install', '-r', bundledRequirementsPath], {
|
|
275
|
-
stdio: 'inherit',
|
|
276
|
-
cwd: repomapPythonDir
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
if (installResult.status !== 0) {
|
|
280
|
-
throw new Error(`pip install failed with exit code ${installResult.status}`);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
console.log('✅ RepoMapper Python dependencies installed successfully');
|
|
284
|
-
|
|
285
|
-
// Validate installation
|
|
286
|
-
await validateInstallation(venvPython);
|
|
287
|
-
|
|
288
|
-
console.log('🎉 RepoMapper Python dependencies setup complete!');
|
|
289
|
-
return;
|
|
290
|
-
|
|
291
|
-
} catch (error) {
|
|
292
|
-
console.error('❌ Failed to setup bundled RepoMapper with virtual environment:', error.message);
|
|
293
|
-
console.error(' Falling back to global installation...');
|
|
294
|
-
// Fall through to the original bundled logic below
|
|
295
|
-
}
|
|
296
|
-
} else {
|
|
297
|
-
console.log('ℹ️ No RepoMapper installation found, skipping Python setup');
|
|
298
|
-
console.log(' (This is normal for CLI-only installations)');
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
console.log('🔍 Setting up RepoMapper Python dependencies...');
|
|
303
|
-
|
|
304
|
-
// Find Python executable
|
|
305
|
-
const pythonExecutable = await findPythonExecutable();
|
|
306
|
-
if (!pythonExecutable) {
|
|
307
|
-
console.error('❌ No suitable Python installation found');
|
|
308
|
-
console.error(' Please install Python 3.8+ and ensure it\'s in your PATH');
|
|
309
|
-
console.error(' Windows: Install from https://python.org or Microsoft Store');
|
|
310
|
-
console.error(' macOS: Install via homebrew or python.org');
|
|
311
|
-
console.error(' Linux: Install via package manager (apt, yum, etc.)');
|
|
312
|
-
console.error('');
|
|
313
|
-
console.error(' To skip this check, set SKIP_PYTHON_DEPS=true');
|
|
314
|
-
|
|
315
|
-
// Don't fail the installation, just warn
|
|
316
|
-
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
317
|
-
console.error('');
|
|
318
|
-
console.error('⚠️ Continuing with installation (RepoMapper features may not work)');
|
|
319
|
-
return;
|
|
320
|
-
} else {
|
|
321
|
-
process.exit(1);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// Check pip
|
|
326
|
-
console.log('🔍 Checking pip availability...');
|
|
327
|
-
const pipAvailable = await checkPip(pythonExecutable);
|
|
328
|
-
if (!pipAvailable) {
|
|
329
|
-
console.error('❌ pip is not available');
|
|
330
|
-
console.error(' Please install pip for your Python installation');
|
|
331
|
-
console.error(' Usually: python -m ensurepip --upgrade');
|
|
332
|
-
|
|
333
|
-
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
334
|
-
console.error('');
|
|
335
|
-
console.error('⚠️ Continuing with installation (RepoMapper features may not work)');
|
|
336
|
-
return;
|
|
337
|
-
} else {
|
|
338
|
-
process.exit(1);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
console.log('✅ pip is available');
|
|
343
|
-
|
|
344
|
-
// Install dependencies
|
|
345
|
-
await installDependencies(pythonExecutable, requirementsPath);
|
|
346
|
-
|
|
347
|
-
// Validate installation
|
|
348
|
-
await validateInstallation(pythonExecutable);
|
|
349
|
-
|
|
350
|
-
console.log('');
|
|
351
|
-
console.log('🎉 RepoMapper Python dependencies setup complete!');
|
|
352
|
-
|
|
353
|
-
} catch (error) {
|
|
354
|
-
console.error('❌ Failed to install RepoMapper Python dependencies:', error.message);
|
|
355
|
-
console.error('');
|
|
356
|
-
console.error('You can:');
|
|
357
|
-
console.error('1. Install dependencies manually: pip install -r bundle/repomap-python/requirements.txt');
|
|
358
|
-
console.error('2. Skip this check by setting SKIP_PYTHON_DEPS=true');
|
|
359
|
-
console.error('3. Use embedder-cli without RepoMapper features');
|
|
360
|
-
|
|
361
|
-
// Don't fail the npm install process by default, just warn
|
|
362
|
-
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
363
|
-
console.error('');
|
|
364
|
-
console.error('⚠️ Continuing with installation (RepoMapper features may not work)');
|
|
365
|
-
} else {
|
|
366
|
-
throw error;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
async function setupGdbDebuggerDependencies() {
|
|
372
|
-
try {
|
|
373
|
-
console.log('🔧 Setting up GDB Debugger Python dependencies...');
|
|
374
|
-
|
|
375
|
-
// Look for GDB Debugger Python requirements in the bundle
|
|
376
|
-
const bundleDir = resolve(__dirname, '../bundle');
|
|
377
|
-
const gdbDebuggerPythonDir = join(bundleDir, 'gdb-debugger-python');
|
|
378
|
-
const requirementsPath = join(gdbDebuggerPythonDir, 'requirements.txt');
|
|
379
|
-
|
|
380
|
-
if (!existsSync(requirementsPath)) {
|
|
381
|
-
console.log('ℹ️ GDB Debugger Python files not found, skipping Python setup');
|
|
382
|
-
console.log(' (This is normal if you\'re installing from source)');
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
console.log('🔍 Setting up GDB Debugger Python dependencies...');
|
|
387
|
-
|
|
388
|
-
// Find Python executable
|
|
389
|
-
const pythonExecutable = await findPythonExecutable();
|
|
390
|
-
if (!pythonExecutable) {
|
|
391
|
-
console.error('❌ No suitable Python installation found for GDB Debugger');
|
|
392
|
-
console.error(' Please install Python 3.8+ and ensure it\'s in your PATH');
|
|
393
|
-
|
|
394
|
-
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
395
|
-
console.error('');
|
|
396
|
-
console.error('⚠️ Continuing with installation (GDB Debugger features may not work)');
|
|
397
|
-
return;
|
|
398
|
-
} else {
|
|
399
|
-
process.exit(1);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// Check pip
|
|
404
|
-
const pipAvailable = await checkPip(pythonExecutable);
|
|
405
|
-
if (!pipAvailable) {
|
|
406
|
-
console.error('❌ pip is not available for GDB Debugger');
|
|
407
|
-
|
|
408
|
-
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
409
|
-
console.error('');
|
|
410
|
-
console.error('⚠️ Continuing with installation (GDB Debugger features may not work)');
|
|
411
|
-
return;
|
|
412
|
-
} else {
|
|
413
|
-
process.exit(1);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Install dependencies directly (GDB Debugger doesn't need virtual env in global install)
|
|
418
|
-
await installGdbDebuggerDependencies(pythonExecutable, requirementsPath);
|
|
419
|
-
|
|
420
|
-
// Validate installation
|
|
421
|
-
await validateGdbDebuggerInstallation(pythonExecutable);
|
|
422
|
-
|
|
423
|
-
console.log('');
|
|
424
|
-
console.log('🎯 GDB Debugger Python dependencies setup complete!');
|
|
425
|
-
|
|
426
|
-
} catch (error) {
|
|
427
|
-
console.error('❌ Failed to install GDB Debugger Python dependencies:', error.message);
|
|
428
|
-
console.error('');
|
|
429
|
-
console.error('You can:');
|
|
430
|
-
console.error('1. Install dependencies manually: pip install -r bundle/gdb-debugger-python/requirements.txt');
|
|
431
|
-
console.error('2. Skip this check by setting SKIP_PYTHON_DEPS=true');
|
|
432
|
-
console.error('3. Use embedder-cli without GDB Debugger features');
|
|
433
|
-
|
|
434
|
-
// Don't fail the npm install process by default, just warn
|
|
435
|
-
if (process.env.FAIL_ON_PYTHON_ERROR !== 'true') {
|
|
436
|
-
console.error('');
|
|
437
|
-
console.error('⚠️ Continuing with installation (GDB Debugger features may not work)');
|
|
438
|
-
} else {
|
|
439
|
-
throw error;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
// Install GDB Debugger Python dependencies
|
|
445
|
-
function installGdbDebuggerDependencies(pythonExecutable, requirementsPath) {
|
|
446
|
-
return new Promise((resolve, reject) => {
|
|
447
|
-
const isWindows = platform() === 'win32';
|
|
448
|
-
|
|
449
|
-
// Use --user flag on Unix systems to avoid permission issues with global installation
|
|
450
|
-
const pipArgs = ['-m', 'pip', 'install'];
|
|
451
|
-
if (!isWindows) {
|
|
452
|
-
pipArgs.push('--user');
|
|
453
|
-
}
|
|
454
|
-
pipArgs.push('-r', requirementsPath);
|
|
455
|
-
|
|
456
|
-
console.log('📦 Installing GDB Debugger Python dependencies...');
|
|
457
|
-
console.log(`Using: ${pythonExecutable} ${pipArgs.join(' ')}`);
|
|
458
|
-
|
|
459
|
-
const child = spawn(pythonExecutable, pipArgs, {
|
|
460
|
-
stdio: 'inherit',
|
|
461
|
-
shell: isWindows,
|
|
462
|
-
cwd: dirname(requirementsPath)
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
child.on('close', (code) => {
|
|
466
|
-
if (code === 0) {
|
|
467
|
-
console.log('✅ GDB Debugger Python dependencies installed successfully');
|
|
468
|
-
resolve();
|
|
469
|
-
} else {
|
|
470
|
-
reject(new Error(`pip install failed with exit code ${code}`));
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
child.on('error', (error) => {
|
|
475
|
-
reject(new Error(`Failed to run pip install: ${error.message}`));
|
|
476
|
-
});
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// Validate GDB Debugger Python installation
|
|
481
|
-
function validateGdbDebuggerInstallation(pythonExecutable) {
|
|
482
|
-
return new Promise((resolve, reject) => {
|
|
483
|
-
console.log('🔍 Validating GDB Debugger Python installation...');
|
|
484
|
-
|
|
485
|
-
const child = spawn(pythonExecutable, ['-c', `
|
|
486
|
-
try:
|
|
487
|
-
import pygdbmi
|
|
488
|
-
print('\\n✅ All GDB Debugger Python dependencies are available')
|
|
489
|
-
print(f' pygdbmi version: {pygdbmi.__version__}')
|
|
490
|
-
except ImportError as e:
|
|
491
|
-
print(f'\\n❌ Missing dependency: {e}')
|
|
492
|
-
exit(1)
|
|
493
|
-
`], {
|
|
494
|
-
stdio: 'inherit',
|
|
495
|
-
shell: platform() === 'win32'
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
child.on('close', (code) => {
|
|
499
|
-
if (code === 0) {
|
|
500
|
-
resolve();
|
|
501
|
-
} else {
|
|
502
|
-
reject(new Error('Python validation failed'));
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
child.on('error', (error) => {
|
|
507
|
-
reject(new Error(`Failed to validate installation: ${error.message}`));
|
|
508
|
-
});
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// Run if this is the main module
|
|
513
|
-
if (import.meta.url.startsWith('file:') && process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
514
|
-
main();
|
|
515
|
-
}
|
package/bundle/repomap-bridge.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const _0x1770fe=_0x4783;import{createRequire}from'module';function _0x130a(){const _0x52fe7a=['url','../python/repomap_bridge.py','repomap-python/repomap_bridge.py','Python\x20script\x20not\x20found\x20at:\x20','\x20or\x20','getPlatformExecutables','win32','python','findPythonExecutable','cachedPython','checkPythonExecutable','data','toString','includes','Python','match','Windows\x20Installation\x20Options:\x0a','1.\x20Install\x20from\x20python.org:\x20https://python.org/downloads/\x0a','3.\x20Use\x20py\x20launcher:\x20Should\x20be\x20available\x20after\x20standard\x20install\x0a\x0a','Tried\x20executables:\x20','-\x20Exit\x20code\x209009\x20means\x20Python\x20executable\x20not\x20found\x20in\x20PATH\x0a','1.\x20Ubuntu/Debian:\x20sudo\x20apt\x20install\x20python3\x20python3-pip\x0a','3.\x20macOS:\x20brew\x20install\x20python3\x0a\x0a','join','🔍\x20DEBUG:\x20RepoMapBridge.generateMap\x20called','error','pythonScriptPath','🔍\x20DEBUG:\x20Request:\x20','stringify','🔍\x20DEBUG:\x20Timeout:\x20','pipe','Failed\x20to\x20find\x20Python\x20executable:\x20','message','🔍\x20DEBUG:\x20Spawned\x20Python\x20process\x20with\x20PID:\x20','pid','🔍\x20DEBUG:\x20Working\x20directory:\x20','🔍\x20DEBUG:\x20Python\x20process\x20timed\x20out\x20after\x20','kill','stdout','🔍\x20DEBUG:\x20Python\x20STDOUT\x20chunk:\x20','length','...','stderr','🔍\x20DEBUG:\x20Python\x20STDERR\x20chunk:\x20','close','🔍\x20DEBUG:\x20Final\x20STDOUT\x20length:\x20','🔍\x20DEBUG:\x20Final\x20STDERR\x20length:\x20','🔍\x20DEBUG:\x20Python\x20process\x20failed\x20with\x20stderr:\x20','Python\x20script\x20exited\x20with\x20code\x20','parse','🔍\x20DEBUG:\x20Failed\x20to\x20parse\x20Python\x20output:\x20','🔍\x20DEBUG:\x20Sending\x20request\x20to\x20Python:\x20','substring','write','stdin','end','🔍\x20DEBUG:\x20Request\x20sent\x20successfully','SIGTERM','searchIdentifiers','Failed\x20to\x20parse\x20Python\x20output:\x20','search_identifiers','checkDependencies','\x0aimport\x20sys\x0aimport\x20json\x0a\x0amissing\x20=\x20[]\x0arequired_modules\x20=\x20[\x27tiktoken\x27,\x20\x27networkx\x27,\x20\x27diskcache\x27,\x20\x27grep_ast\x27,\x20\x27tree_sitter\x27,\x20\x27pygments\x27,\x20\x27fastmcp\x27]\x0a\x0afor\x20module\x20in\x20required_modules:\x0a\x20\x20\x20\x20try:\x0a\x20\x20\x20\x20\x20\x20\x20\x20__import__(module)\x0a\x20\x20\x20\x20except\x20ImportError:\x0a\x20\x20\x20\x20\x20\x20\x20\x20missing.append(module)\x0a\x0aresult\x20=\x20{\x0a\x20\x20\x20\x20\x27available\x27:\x20len(missing)\x20==\x200,\x0a\x20\x20\x20\x20\x27missing\x27:\x20missing\x20if\x20missing\x20else\x20None\x0a}\x0aprint(json.dumps(result))\x0a','Failed\x20to\x20check\x20dependencies','Python\x20detection\x20failed:\x20','string','boolean','project-root','Options:','\x20\x20--chat-files\x20<files...>\x20\x20\x20\x20\x20\x20\x20\x20\x20Files\x20currently\x20in\x20chat\x20context','\x20\x20--mentioned-files\x20<files...>\x20\x20\x20\x20Files\x20explicitly\x20mentioned','\x20\x20--mentioned-idents\x20<idents...>\x20\x20Identifiers\x20explicitly\x20mentioned','\x20\x20--token-limit\x20<number>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Maximum\x20tokens\x20for\x20map\x20(default:\x208192)','\x20\x20--verbose\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Enable\x20verbose\x20output','\x20\x20repomap-bridge\x20--project-root\x20/path/to/project','exit','mentioned-files','other-files','exclude-unranked','verbose','max-context-window','timeout','chat-files','mentioned-idents','force-refresh','Checking\x20Python\x20dependencies...','missing','Dependencies\x20OK','Unknown\x20error','log','argv','repomap-bridge'];_0x130a=function(){return _0x52fe7a;};return _0x130a();}const require=createRequire(import.meta['url']);import{parseArgs as _0xbda99a}from'util';import{resolve as _0x506710}from'path';import{spawn as _0x129844}from'node:child_process';import{resolve as _0x2e353b,dirname as _0xbffd98}from'node:path';import{fileURLToPath as _0x4c6f4f}from'node:url';import{existsSync as _0x5984e8}from'node:fs';import{spawn as _0x312dd5}from'node:child_process';function _0x4783(_0x49bcfc,_0x130a56){const _0x478323=_0x130a();return _0x4783=function(_0x578f9c,_0x1fd9d3){_0x578f9c=_0x578f9c-0x167;let _0x2b40a9=_0x478323[_0x578f9c];return _0x2b40a9;},_0x4783(_0x49bcfc,_0x130a56);}import{platform as _0xaed5aa}from'node:os';var w=_0x4c6f4f(import.meta[_0x1770fe(0x167)]),g=_0xbffd98(w),u=class{['pythonScriptPath'];['cachedPython']=null;constructor(){const _0x110ac3=_0x1770fe;let _0x1cbd32=_0x2e353b(g,_0x110ac3(0x168)),_0x33bb40=_0x2e353b(g,_0x110ac3(0x169));if(_0x5984e8(_0x33bb40))this['pythonScriptPath']=_0x33bb40;else{if(_0x5984e8(_0x1cbd32))this['pythonScriptPath']=_0x1cbd32;else throw new Error(_0x110ac3(0x16a)+_0x1cbd32+_0x110ac3(0x16b)+_0x33bb40);}}[_0x1770fe(0x16c)](){const _0x3adfdb=_0x1770fe;return _0xaed5aa()===_0x3adfdb(0x16d)?['py','python','python3']:['python3',_0x3adfdb(0x16e)];}async[_0x1770fe(0x16f)](){const _0x340d83=_0x1770fe;if(this['cachedPython'])return this[_0x340d83(0x170)];let _0x5c26f5=this[_0x340d83(0x16c)]();for(let _0x3b3742 of _0x5c26f5)try{if(await this[_0x340d83(0x171)](_0x3b3742))return this['cachedPython']=_0x3b3742,_0x3b3742;}catch{continue;}throw new Error(this['createPythonNotFoundError']());}['checkPythonExecutable'](_0x2f2108){return new Promise(_0xc422a=>{const _0x2af912=_0x4783;let _0x254f7f=_0x312dd5(_0x2f2108,['--version'],{'stdio':'pipe','shell':_0xaed5aa()===_0x2af912(0x16d)}),_0x3ac9ef='';_0x254f7f['stdout']?.['on'](_0x2af912(0x172),_0x14d7ac=>_0x3ac9ef+=_0x14d7ac[_0x2af912(0x173)]()),_0x254f7f['stderr']?.['on'](_0x2af912(0x172),_0x84049=>_0x3ac9ef+=_0x84049[_0x2af912(0x173)]()),_0x254f7f['on']('close',_0x107afa=>{const _0x5f276a=_0x2af912;if(_0x107afa===0x0&&_0x3ac9ef[_0x5f276a(0x174)](_0x5f276a(0x175))){let _0x4fbd00=_0x3ac9ef[_0x5f276a(0x176)](/Python (\d+)\.(\d+)/);if(_0x4fbd00){let _0x5e9d0e=parseInt(_0x4fbd00[0x1]),_0x3be0e6=parseInt(_0x4fbd00[0x2]);_0xc422a(_0x5e9d0e>=0x3&&(_0x5e9d0e>0x3||_0x3be0e6>=0x8));return;}}_0xc422a(!0x1);}),_0x254f7f['on']('error',()=>_0xc422a(!0x1));});}['createPythonNotFoundError'](){const _0x3abb97=_0x1770fe;let _0x1b8c32=_0xaed5aa()==='win32',_0x166dda='❌\x20No\x20suitable\x20Python\x20installation\x20found\x20(requires\x20Python\x203.8+)\x0a\x0a';return _0x1b8c32?(_0x166dda+=_0x3abb97(0x177),_0x166dda+=_0x3abb97(0x178),_0x166dda+='2.\x20Install\x20from\x20Microsoft\x20Store:\x20\x27python3\x27\x20command\x0a',_0x166dda+=_0x3abb97(0x179),_0x166dda+=_0x3abb97(0x17a)+this['getPlatformExecutables']()['join'](',\x20')+'\x0a',_0x166dda+='\x0aCommon\x20Windows\x20Issues:\x0a',_0x166dda+=_0x3abb97(0x17b),_0x166dda+='-\x20Ensure\x20Python\x20installation\x20added\x20executables\x20to\x20PATH\x0a'):(_0x166dda+='Unix/Linux\x20Installation\x20Options:\x0a',_0x166dda+=_0x3abb97(0x17c),_0x166dda+='2.\x20CentOS/RHEL:\x20sudo\x20yum\x20install\x20python3\x20python3-pip\x0a',_0x166dda+=_0x3abb97(0x17d),_0x166dda+='Tried\x20executables:\x20'+this[_0x3abb97(0x16c)]()[_0x3abb97(0x17e)](',\x20')+'\x0a'),_0x166dda+='\x0aTo\x20skip\x20Python\x20features:\x20set\x20SKIP_PYTHON_DEPS=true',_0x166dda;}async['generateMap'](_0x13458a,_0x1d96a0=0xea60){const _0x3b544a=_0x1770fe;return console['error'](_0x3b544a(0x17f)),console[_0x3b544a(0x180)]('🔍\x20DEBUG:\x20Python\x20script\x20path:\x20'+this[_0x3b544a(0x181)]),console['error']('🔍\x20DEBUG:\x20Python\x20script\x20exists:\x20'+_0x5984e8(this[_0x3b544a(0x181)])),console[_0x3b544a(0x180)](_0x3b544a(0x182)+JSON[_0x3b544a(0x183)](_0x13458a,null,0x2)),console[_0x3b544a(0x180)](_0x3b544a(0x184)+_0x1d96a0+'ms'),new Promise(async(_0xceb1c9,_0x49fbf5)=>{const _0x43b563=_0x3b544a;let _0x263a93;try{let _0x522205=await this['findPythonExecutable']();console[_0x43b563(0x180)]('🔍\x20DEBUG:\x20Using\x20Python\x20executable:\x20'+_0x522205),_0x263a93=_0x129844(_0x522205,[this['pythonScriptPath']],{'stdio':[_0x43b563(0x185),_0x43b563(0x185),_0x43b563(0x185)],'cwd':_0xbffd98(this['pythonScriptPath'])});}catch(_0xb31f15){_0x49fbf5(new Error(_0x43b563(0x186)+(_0xb31f15 instanceof Error?_0xb31f15[_0x43b563(0x187)]:_0xb31f15)));return;}console[_0x43b563(0x180)](_0x43b563(0x188)+_0x263a93[_0x43b563(0x189)]),console['error'](_0x43b563(0x18a)+_0xbffd98(this[_0x43b563(0x181)]));let _0x1db867='',_0x53b460='',_0x4699e3=setTimeout(()=>{const _0x8b0fdb=_0x43b563;console['error'](_0x8b0fdb(0x18b)+_0x1d96a0+'ms'),_0x263a93[_0x8b0fdb(0x18c)]('SIGTERM'),_0x49fbf5(new Error('RepoMapper\x20timed\x20out\x20after\x20'+_0x1d96a0+'ms'));},_0x1d96a0);_0x263a93[_0x43b563(0x18d)]['on'](_0x43b563(0x172),_0x3ca26a=>{const _0x3cb0c0=_0x43b563;let _0x32fb30=_0x3ca26a['toString']();_0x1db867+=_0x32fb30,console[_0x3cb0c0(0x180)](_0x3cb0c0(0x18e)+_0x32fb30['substring'](0x0,0x64)+(_0x32fb30[_0x3cb0c0(0x18f)]>0x64?_0x3cb0c0(0x190):''));}),_0x263a93[_0x43b563(0x191)]['on'](_0x43b563(0x172),_0x249c17=>{const _0xdd4c5a=_0x43b563;let _0xc46421=_0x249c17['toString']();_0x53b460+=_0xc46421,console[_0xdd4c5a(0x180)](_0xdd4c5a(0x192)+_0xc46421);}),_0x263a93['on'](_0x43b563(0x193),_0x222a44=>{const _0x40077b=_0x43b563;if(clearTimeout(_0x4699e3),console[_0x40077b(0x180)]('🔍\x20DEBUG:\x20Python\x20process\x20closed\x20with\x20code:\x20'+_0x222a44),console[_0x40077b(0x180)](_0x40077b(0x194)+_0x1db867['length']),console['error'](_0x40077b(0x195)+_0x53b460['length']),_0x222a44!==0x0){console['error'](_0x40077b(0x196)+_0x53b460),_0x49fbf5(new Error(_0x40077b(0x197)+_0x222a44+'.\x20Stderr:\x20'+_0x53b460));return;}try{console[_0x40077b(0x180)]('🔍\x20DEBUG:\x20Attempting\x20to\x20parse\x20Python\x20output...');let _0x12914f=JSON[_0x40077b(0x198)](_0x1db867);console['error']('🔍\x20DEBUG:\x20Successfully\x20parsed\x20Python\x20output'),_0xceb1c9(_0x12914f);}catch(_0x385440){console[_0x40077b(0x180)](_0x40077b(0x199)+_0x385440),console[_0x40077b(0x180)]('🔍\x20DEBUG:\x20Raw\x20output:\x20'+_0x1db867),_0x49fbf5(new Error('Failed\x20to\x20parse\x20Python\x20output:\x20'+_0x385440+'.\x20Output:\x20'+_0x1db867));}}),_0x263a93['on'](_0x43b563(0x180),_0x3ef88c=>{const _0x574b0=_0x43b563;clearTimeout(_0x4699e3),console['error']('🔍\x20DEBUG:\x20Python\x20process\x20spawn\x20error:\x20'+_0x3ef88c[_0x574b0(0x187)]),_0x49fbf5(new Error('Failed\x20to\x20start\x20Python\x20process:\x20'+_0x3ef88c[_0x574b0(0x187)]));});try{let _0x5ad90a=JSON['stringify'](_0x13458a);console[_0x43b563(0x180)](_0x43b563(0x19a)+_0x5ad90a[_0x43b563(0x19b)](0x0,0xc8)+(_0x5ad90a['length']>0xc8?_0x43b563(0x190):'')),_0x263a93['stdin'][_0x43b563(0x19c)](_0x5ad90a),_0x263a93[_0x43b563(0x19d)][_0x43b563(0x19e)](),console[_0x43b563(0x180)](_0x43b563(0x19f));}catch(_0x1c3866){clearTimeout(_0x4699e3),_0x263a93[_0x43b563(0x18c)](_0x43b563(0x1a0)),console['error']('🔍\x20DEBUG:\x20Failed\x20to\x20write\x20to\x20Python\x20stdin:\x20'+_0x1c3866),_0x49fbf5(new Error('Failed\x20to\x20send\x20request\x20to\x20Python\x20script:\x20'+_0x1c3866));}});}async[_0x1770fe(0x1a1)](_0x398a28,_0x50e43e=0x7530){return new Promise(async(_0x1b6b20,_0x8356e2)=>{const _0x163a48=_0x4783;let _0x502a36;try{let _0x321fca=await this[_0x163a48(0x16f)]();_0x502a36=_0x129844(_0x321fca,[this['pythonScriptPath']],{'stdio':[_0x163a48(0x185),_0x163a48(0x185),'pipe'],'cwd':_0xbffd98(this[_0x163a48(0x181)])});}catch(_0x2bdd5d){_0x8356e2(new Error('Failed\x20to\x20find\x20Python\x20executable:\x20'+(_0x2bdd5d instanceof Error?_0x2bdd5d['message']:_0x2bdd5d)));return;}let _0x16d0be='',_0x463e48='',_0x56ad8b=setTimeout(()=>{const _0x22535f=_0x163a48;_0x502a36[_0x22535f(0x18c)](_0x22535f(0x1a0)),_0x8356e2(new Error('Identifier\x20search\x20timed\x20out\x20after\x20'+_0x50e43e+'ms'));},_0x50e43e);_0x502a36[_0x163a48(0x18d)]['on']('data',_0x20f175=>{_0x16d0be+=_0x20f175['toString']();}),_0x502a36['stderr']['on']('data',_0x56f430=>{_0x463e48+=_0x56f430['toString']();}),_0x502a36['on'](_0x163a48(0x193),_0x26ade3=>{const _0xe0fc70=_0x163a48;if(clearTimeout(_0x56ad8b),_0x26ade3!==0x0){_0x8356e2(new Error(_0xe0fc70(0x197)+_0x26ade3+'.\x20Stderr:\x20'+_0x463e48));return;}try{let _0x33576f=JSON[_0xe0fc70(0x198)](_0x16d0be);_0x1b6b20(_0x33576f);}catch(_0x4891cf){_0x8356e2(new Error(_0xe0fc70(0x1a2)+_0x4891cf+'.\x20Output:\x20'+_0x16d0be));}}),_0x502a36['on']('error',_0x326b7d=>{clearTimeout(_0x56ad8b),_0x8356e2(new Error('Failed\x20to\x20start\x20Python\x20process:\x20'+_0x326b7d['message']));});try{let _0xe5b092={'action':_0x163a48(0x1a3),..._0x398a28},_0x4b6b97=JSON[_0x163a48(0x183)](_0xe5b092);_0x502a36['stdin']['write'](_0x4b6b97),_0x502a36['stdin']['end']();}catch(_0x2cc43b){clearTimeout(_0x56ad8b),_0x502a36[_0x163a48(0x18c)]('SIGTERM'),_0x8356e2(new Error('Failed\x20to\x20send\x20search\x20request\x20to\x20Python\x20script:\x20'+_0x2cc43b));}});}async[_0x1770fe(0x1a4)](){return new Promise(async _0x4877e5=>{const _0x292210=_0x4783;let _0xfd2660=_0x292210(0x1a5);try{let _0x252579=await this['findPythonExecutable'](),_0x9384d0=_0x129844(_0x252579,['-c',_0xfd2660],{'stdio':['pipe','pipe','pipe']}),_0x5caa4f='';_0x9384d0['stdout']['on']('data',_0x441907=>{_0x5caa4f+=_0x441907['toString']();}),_0x9384d0['on']('close',()=>{const _0x593fb5=_0x292210;try{let _0x5795ce=JSON['parse'](_0x5caa4f['trim']());_0x4877e5(_0x5795ce);}catch{_0x4877e5({'available':!0x1,'missing':[_0x593fb5(0x1a6)]});}}),_0x9384d0['on'](_0x292210(0x180),()=>{_0x4877e5({'available':!0x1,'missing':['Python\x20executable\x20not\x20available']});});}catch(_0x12ef6c){_0x4877e5({'available':!0x1,'missing':[_0x292210(0x1a7)+(_0x12ef6c instanceof Error?_0x12ef6c['message']:_0x12ef6c)]});}});}};import{fileURLToPath as _0x314c34}from'url';function R(){const _0x2cdac3=_0x1770fe;let {values:_0x3d1e37}=_0xbda99a({'args':process['argv']['slice'](0x2),'options':{'project-root':{'type':'string'},'chat-files':{'type':'string','multiple':!0x0},'mentioned-files':{'type':'string','multiple':!0x0},'other-files':{'type':'string','multiple':!0x0},'mentioned-idents':{'type':'string','multiple':!0x0},'token-limit':{'type':_0x2cdac3(0x1a8),'default':'8192'},'exclude-unranked':{'type':'boolean','default':!0x1},'force-refresh':{'type':_0x2cdac3(0x1a9),'default':!0x1},'verbose':{'type':_0x2cdac3(0x1a9),'default':!0x1},'max-context-window':{'type':'string'},'timeout':{'type':_0x2cdac3(0x1a8),'default':'60'}}});return _0x3d1e37[_0x2cdac3(0x1aa)]||(console[_0x2cdac3(0x180)]('Usage:\x20repomap-bridge\x20--project-root\x20<path>\x20[options]'),console['error'](''),console['error'](_0x2cdac3(0x1ab)),console[_0x2cdac3(0x180)](' --project-root <path> Root directory of the project (required)'),console[_0x2cdac3(0x180)](_0x2cdac3(0x1ac)),console['error'](_0x2cdac3(0x1ad)),console['error']('\x20\x20--other-files\x20<files...>\x20\x20\x20\x20\x20\x20\x20\x20Other\x20relevant\x20files'),console['error'](_0x2cdac3(0x1ae)),console['error'](_0x2cdac3(0x1af)),console['error']('\x20\x20--exclude-unranked\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Exclude\x20files\x20with\x20PageRank\x200'),console[_0x2cdac3(0x180)]('\x20\x20--force-refresh\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Force\x20cache\x20refresh'),console[_0x2cdac3(0x180)](_0x2cdac3(0x1b0)),console[_0x2cdac3(0x180)]('\x20\x20--max-context-window\x20<number>\x20\x20\x20Maximum\x20context\x20window\x20size'),console['error']('\x20\x20--timeout\x20<seconds>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Timeout\x20in\x20seconds\x20(default:\x2060)'),console[_0x2cdac3(0x180)](''),console['error']('Examples:'),console[_0x2cdac3(0x180)](_0x2cdac3(0x1b1)),console[_0x2cdac3(0x180)]('\x20\x20repomap-bridge\x20--project-root\x20.\x20--chat-files\x20src/main.ts\x20src/utils.ts'),console[_0x2cdac3(0x180)]('\x20\x20repomap-bridge\x20--project-root\x20.\x20--mentioned-files\x20config.json\x20--token-limit\x204096'),process[_0x2cdac3(0x1b2)](0x1)),{'project-root':_0x3d1e37[_0x2cdac3(0x1aa)],'chat-files':_0x3d1e37['chat-files']||[],'mentioned-files':_0x3d1e37[_0x2cdac3(0x1b3)]||[],'other-files':_0x3d1e37[_0x2cdac3(0x1b4)]||[],'mentioned-idents':_0x3d1e37['mentioned-idents']||[],'token-limit':parseInt(_0x3d1e37['token-limit'])||0x2000,'exclude-unranked':_0x3d1e37[_0x2cdac3(0x1b5)],'force-refresh':_0x3d1e37['force-refresh'],'verbose':_0x3d1e37[_0x2cdac3(0x1b6)],'max-context-window':_0x3d1e37[_0x2cdac3(0x1b7)]?parseInt(_0x3d1e37[_0x2cdac3(0x1b7)]):void 0x0,'timeout':parseInt(_0x3d1e37[_0x2cdac3(0x1b8)])||0x3c};}async function $(){const _0x1f916b=_0x1770fe;try{let _0x48bc29=R(),_0x2f2fb9={'project_root':_0x506710(_0x48bc29[_0x1f916b(0x1aa)]),'chat_files':_0x48bc29[_0x1f916b(0x1b9)],'mentioned_files':_0x48bc29['mentioned-files'],'other_files':_0x48bc29['other-files'],'mentioned_idents':_0x48bc29[_0x1f916b(0x1ba)],'token_limit':_0x48bc29['token-limit'],'exclude_unranked':_0x48bc29['exclude-unranked'],'force_refresh':_0x48bc29[_0x1f916b(0x1bb)],'verbose':_0x48bc29[_0x1f916b(0x1b6)],'max_context_window':_0x48bc29['max-context-window']},_0x69f946=new u();if(_0x48bc29[_0x1f916b(0x1b6)]){console['error'](_0x1f916b(0x1bc));let _0x20aaf7=await _0x69f946['checkDependencies']();_0x20aaf7['available']||(console[_0x1f916b(0x180)]('Missing\x20Python\x20dependencies:',_0x20aaf7[_0x1f916b(0x1bd)]),console['error']('Run: pip install -r python/requirements.txt'),process['exit'](0x1)),console[_0x1f916b(0x180)](_0x1f916b(0x1be));}let _0xc5ef10=(_0x48bc29['timeout']||0x3c)*0x3e8,_0x454622=await _0x69f946['generateMap'](_0x2f2fb9,_0xc5ef10);console['log'](JSON['stringify'](_0x454622,null,0x2)),process[_0x1f916b(0x1b2)](0x0);}catch(_0x263d8a){console['error']('RepoMapper\x20bridge\x20failed:',_0x263d8a);let _0x5d20bb={'map':'','report':{'excluded':{},'definition_matches':0x0,'reference_matches':0x0,'total_files_considered':0x0},'error':_0x263d8a instanceof Error?_0x263d8a['message']:_0x1f916b(0x1bf)};console[_0x1f916b(0x1c0)](JSON['stringify'](_0x5d20bb,null,0x2)),process[_0x1f916b(0x1b2)](0x1);}}import.meta['url']['startsWith']('file:')&&(process[_0x1770fe(0x1c1)][0x1]===_0x314c34(import.meta[_0x1770fe(0x167)])||process[_0x1770fe(0x1c1)][0x1]?.['includes'](_0x1770fe(0x1c2))||process[_0x1770fe(0x1c1)]['length']>=0x2)&&$();/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2025 Google LLC
|
|
5
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
*/
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Important file filtering for RepoMap.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import os
|
|
6
|
-
from typing import List
|
|
7
|
-
|
|
8
|
-
IMPORTANT_FILENAMES = {
|
|
9
|
-
"README.md", "README.txt", "readme.md", "README.rst", "README",
|
|
10
|
-
"requirements.txt", "Pipfile", "pyproject.toml", "setup.py", "setup.cfg",
|
|
11
|
-
"package.json", "yarn.lock", "package-lock.json", "npm-shrinkwrap.json",
|
|
12
|
-
"Dockerfile", "docker-compose.yml", "docker-compose.yaml",
|
|
13
|
-
".gitignore", ".gitattributes", ".dockerignore",
|
|
14
|
-
"Makefile", "makefile", "CMakeLists.txt",
|
|
15
|
-
"LICENSE", "LICENSE.txt", "LICENSE.md", "COPYING",
|
|
16
|
-
"CHANGELOG.md", "CHANGELOG.txt", "HISTORY.md",
|
|
17
|
-
"CONTRIBUTING.md", "CODE_OF_CONDUCT.md",
|
|
18
|
-
".env", ".env.example", ".env.local",
|
|
19
|
-
"tox.ini", "pytest.ini", ".pytest.ini",
|
|
20
|
-
".flake8", ".pylintrc", "mypy.ini",
|
|
21
|
-
"go.mod", "go.sum", "Cargo.toml", "Cargo.lock",
|
|
22
|
-
"pom.xml", "build.gradle", "build.gradle.kts",
|
|
23
|
-
"composer.json", "composer.lock",
|
|
24
|
-
"Gemfile", "Gemfile.lock",
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
IMPORTANT_DIR_PATTERNS = {
|
|
28
|
-
os.path.normpath(".github/workflows"): lambda fname: fname.endswith((".yml", ".yaml")),
|
|
29
|
-
os.path.normpath(".github"): lambda fname: fname.endswith((".md", ".yml", ".yaml")),
|
|
30
|
-
os.path.normpath("docs"): lambda fname: fname.endswith((".md", ".rst", ".txt")),
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def is_important(rel_file_path: str) -> bool:
|
|
35
|
-
"""Check if a file is considered important."""
|
|
36
|
-
normalized_path = os.path.normpath(rel_file_path)
|
|
37
|
-
file_name = os.path.basename(normalized_path)
|
|
38
|
-
dir_name = os.path.dirname(normalized_path)
|
|
39
|
-
|
|
40
|
-
# Check specific directory patterns
|
|
41
|
-
for important_dir, checker_func in IMPORTANT_DIR_PATTERNS.items():
|
|
42
|
-
if dir_name == important_dir and checker_func(file_name):
|
|
43
|
-
return True
|
|
44
|
-
|
|
45
|
-
# Check if the full normalized path is important
|
|
46
|
-
if normalized_path in IMPORTANT_FILENAMES:
|
|
47
|
-
return True
|
|
48
|
-
|
|
49
|
-
# Check if just the basename is important
|
|
50
|
-
if file_name in IMPORTANT_FILENAMES:
|
|
51
|
-
return True
|
|
52
|
-
|
|
53
|
-
return False
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def filter_important_files(file_paths: List[str]) -> List[str]:
|
|
57
|
-
"""Filter list to only include important files."""
|
|
58
|
-
return [path for path in file_paths if is_important(path)]
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
These scm files are all adapted from the github repositories listed here:
|
|
2
|
-
|
|
3
|
-
https://github.com/Goldziher/tree-sitter-language-pack/blob/main/sources/language_definitions.json
|
|
4
|
-
|
|
5
|
-
See this URL for information on the licenses of each repo:
|
|
6
|
-
|
|
7
|
-
https://github.com/Goldziher/tree-sitter-language-pack/
|
|
8
|
-
|
|
9
|
-
(RepoMapper stole these from Aider)
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
(struct_specifier name: (type_identifier) @name.definition.class body:(_)) @definition.class
|
|
2
|
-
|
|
3
|
-
(declaration type: (union_specifier name: (type_identifier) @name.definition.class)) @definition.class
|
|
4
|
-
|
|
5
|
-
(function_declarator declarator: (identifier) @name.definition.function) @definition.function
|
|
6
|
-
|
|
7
|
-
(type_definition declarator: (type_identifier) @name.definition.type) @definition.type
|
|
8
|
-
|
|
9
|
-
(enum_specifier name: (type_identifier) @name.definition.type) @definition.type
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
; Definitions
|
|
2
|
-
(intent_def
|
|
3
|
-
(intent) @name.definition.intent) @definition.intent
|
|
4
|
-
|
|
5
|
-
(slot_def
|
|
6
|
-
(slot) @name.definition.slot) @definition.slot
|
|
7
|
-
|
|
8
|
-
(alias_def
|
|
9
|
-
(alias) @name.definition.alias) @definition.alias
|
|
10
|
-
|
|
11
|
-
; References
|
|
12
|
-
(slot_ref
|
|
13
|
-
(slot) @name.reference.slot) @reference.slot
|
|
14
|
-
|
|
15
|
-
(alias_ref
|
|
16
|
-
(alias) @name.reference.alias) @reference.alias
|