magector 1.5.2 → 1.6.0
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 +36 -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
|
---
|
|
@@ -837,6 +838,41 @@ Copy `.cursorrules` to your Magento project root for optimized AI-assisted devel
|
|
|
837
838
|
3. Follow Magento development patterns
|
|
838
839
|
4. Interpret search results correctly
|
|
839
840
|
|
|
841
|
+
### Excluding Directories (`.magectorignore`)
|
|
842
|
+
|
|
843
|
+
Magector automatically skips common non-project directories during indexing:
|
|
844
|
+
|
|
845
|
+
- `vendor/` — Composer dependencies (100K-500K files)
|
|
846
|
+
- `node_modules/` — npm packages
|
|
847
|
+
- `generated/` — DI-compiled files
|
|
848
|
+
- `var/` — cache, logs, sessions
|
|
849
|
+
- `pub/static/` — deployed static assets
|
|
850
|
+
- `dev/tests/`, `dev/tools/` — Magento development tools
|
|
851
|
+
- `Test/`, `Tests/`, `test/`, `tests/` — test directories
|
|
852
|
+
- `.git/` — version control
|
|
853
|
+
|
|
854
|
+
For project-specific exclusions, create a `.magectorignore` file in your Magento project root:
|
|
855
|
+
|
|
856
|
+
```gitignore
|
|
857
|
+
# .magectorignore — additional directories to exclude from Magector indexing
|
|
858
|
+
# One pattern per line, gitignore-like syntax
|
|
859
|
+
|
|
860
|
+
# Custom exclusions
|
|
861
|
+
pub/media
|
|
862
|
+
setup
|
|
863
|
+
update
|
|
864
|
+
phpserver
|
|
865
|
+
bin
|
|
866
|
+
lib/internal
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
**Pattern rules:**
|
|
870
|
+
- Lines starting with `#` are comments
|
|
871
|
+
- Empty lines are ignored
|
|
872
|
+
- Trailing slashes are stripped (`vendor/` → `vendor`)
|
|
873
|
+
- Patterns without `/` match directory names anywhere in the tree
|
|
874
|
+
- Patterns with `/` match relative paths from the project root
|
|
875
|
+
|
|
840
876
|
### Model Configuration
|
|
841
877
|
|
|
842
878
|
The ONNX model (`all-MiniLM-L6-v2`) is automatically downloaded on first run to `~/.magector/models/`. To use a different location:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magector",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
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.
|
|
41
|
-
"@magector/cli-linux-x64": "1.
|
|
42
|
-
"@magector/cli-linux-arm64": "1.
|
|
43
|
-
"@magector/cli-win32-x64": "1.
|
|
40
|
+
"@magector/cli-darwin-arm64": "1.6.0",
|
|
41
|
+
"@magector/cli-linux-x64": "1.6.0",
|
|
42
|
+
"@magector/cli-linux-arm64": "1.6.0",
|
|
43
|
+
"@magector/cli-win32-x64": "1.6.0"
|
|
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() {
|