magector 1.5.1 → 1.5.3
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/README.md +1 -0
- package/package.json +5 -5
- package/src/cli.js +7 -2
- package/src/init.js +7 -2
- package/src/mcp-server.js +10 -2
package/README.md
CHANGED
|
@@ -318,6 +318,7 @@ The `describe` command and `magento_describe` MCP tool require an Anthropic API
|
|
|
318
318
|
| `MAGECTOR_DB` | Path to index database | `./.magector/index.db` |
|
|
319
319
|
| `MAGECTOR_BIN` | Path to magector-core binary | Auto-detected |
|
|
320
320
|
| `MAGECTOR_MODELS` | Path to ONNX model directory | `~/.magector/models/` |
|
|
321
|
+
| `MAGECTOR_INDEX_TIMEOUT` | Indexing timeout in milliseconds | `1800000` (30 min) |
|
|
321
322
|
| `ANTHROPIC_API_KEY` | API key for description generation (`describe` command) | — |
|
|
322
323
|
|
|
323
324
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magector",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Semantic code search for Magento 2 — index, search, MCP server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/mcp-server.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"ruvector": "^0.1.96"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@magector/cli-darwin-arm64": "1.5.
|
|
41
|
-
"@magector/cli-linux-x64": "1.5.
|
|
42
|
-
"@magector/cli-linux-arm64": "1.5.
|
|
43
|
-
"@magector/cli-win32-x64": "1.5.
|
|
40
|
+
"@magector/cli-darwin-arm64": "1.5.3",
|
|
41
|
+
"@magector/cli-linux-x64": "1.5.3",
|
|
42
|
+
"@magector/cli-linux-arm64": "1.5.3",
|
|
43
|
+
"@magector/cli-win32-x64": "1.5.3"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"magento",
|
package/src/cli.js
CHANGED
|
@@ -85,6 +85,7 @@ async function runIndex(targetPath) {
|
|
|
85
85
|
const magectorDir = path.resolve(root, '.magector');
|
|
86
86
|
mkdirSync(magectorDir, { recursive: true });
|
|
87
87
|
|
|
88
|
+
const indexTimeout = parseInt(process.env.MAGECTOR_INDEX_TIMEOUT, 10) || 1800000;
|
|
88
89
|
try {
|
|
89
90
|
const indexArgs = [
|
|
90
91
|
'index',
|
|
@@ -97,14 +98,18 @@ async function runIndex(targetPath) {
|
|
|
97
98
|
if (existsSync(descDbPath)) {
|
|
98
99
|
indexArgs.push('--descriptions-db', descDbPath);
|
|
99
100
|
}
|
|
100
|
-
execFileSync(binary, indexArgs, { timeout:
|
|
101
|
+
execFileSync(binary, indexArgs, { timeout: indexTimeout, stdio: 'inherit' });
|
|
101
102
|
console.log('\nIndexing complete.');
|
|
102
103
|
} catch (err) {
|
|
103
104
|
if (err.status) {
|
|
104
105
|
console.error('Indexing failed.');
|
|
105
106
|
process.exit(err.status);
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
+
if (err.message && err.message.includes('ETIMEDOUT')) {
|
|
109
|
+
console.error(`Indexing timed out after ${indexTimeout / 1000}s. For large codebases, increase the timeout:\n MAGECTOR_INDEX_TIMEOUT=3600000 npx magector index`);
|
|
110
|
+
} else {
|
|
111
|
+
console.error(`Indexing error: ${err.message}`);
|
|
112
|
+
}
|
|
108
113
|
process.exit(1);
|
|
109
114
|
}
|
|
110
115
|
}
|
package/src/init.js
CHANGED
|
@@ -250,13 +250,18 @@ export async function init(projectPath) {
|
|
|
250
250
|
'-m', projectPath,
|
|
251
251
|
'-d', dbPath,
|
|
252
252
|
'-c', modelPath
|
|
253
|
-
], { timeout:
|
|
253
|
+
], { timeout: parseInt(process.env.MAGECTOR_INDEX_TIMEOUT, 10) || 1800000, stdio: 'inherit' });
|
|
254
254
|
} catch (err) {
|
|
255
255
|
if (err.status) {
|
|
256
256
|
console.error('Indexing failed.');
|
|
257
257
|
process.exit(err.status);
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
const initTimeout = parseInt(process.env.MAGECTOR_INDEX_TIMEOUT, 10) || 1800000;
|
|
260
|
+
if (err.message && err.message.includes('ETIMEDOUT')) {
|
|
261
|
+
console.error(`Indexing timed out after ${initTimeout / 1000}s. For large codebases, increase the timeout:\n MAGECTOR_INDEX_TIMEOUT=3600000 npx magector init ${projectPath}`);
|
|
262
|
+
} else {
|
|
263
|
+
console.error(`Indexing error: ${err.message}`);
|
|
264
|
+
}
|
|
260
265
|
process.exit(1);
|
|
261
266
|
}
|
|
262
267
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
package/src/mcp-server.js
CHANGED
|
@@ -533,8 +533,16 @@ function rustIndex(magentoRoot) {
|
|
|
533
533
|
if (existsSync(descDbPath)) {
|
|
534
534
|
indexArgs.push('--descriptions-db', descDbPath);
|
|
535
535
|
}
|
|
536
|
-
const
|
|
537
|
-
|
|
536
|
+
const indexTimeout = parseInt(process.env.MAGECTOR_INDEX_TIMEOUT, 10) || 1800000;
|
|
537
|
+
try {
|
|
538
|
+
const result = execFileSync(config.rustBinary, indexArgs, { encoding: 'utf-8', timeout: indexTimeout, stdio: ['pipe', 'pipe', 'pipe'], env: rustEnv });
|
|
539
|
+
return result;
|
|
540
|
+
} catch (err) {
|
|
541
|
+
if (err.message && err.message.includes('ETIMEDOUT')) {
|
|
542
|
+
throw new Error(`Indexing timed out after ${indexTimeout / 1000}s. Set MAGECTOR_INDEX_TIMEOUT=3600000 (or higher) in your environment to increase the limit.`);
|
|
543
|
+
}
|
|
544
|
+
throw err;
|
|
545
|
+
}
|
|
538
546
|
}
|
|
539
547
|
|
|
540
548
|
function rustStats() {
|