magector 2.6.5 → 2.7.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/package.json +5 -5
- package/src/mcp-server.js +39 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magector",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.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",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"ruvector": "^0.1.96"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@magector/cli-darwin-arm64": "2.
|
|
37
|
-
"@magector/cli-linux-x64": "2.
|
|
38
|
-
"@magector/cli-linux-arm64": "2.
|
|
39
|
-
"@magector/cli-win32-x64": "2.
|
|
36
|
+
"@magector/cli-darwin-arm64": "2.7.0",
|
|
37
|
+
"@magector/cli-linux-x64": "2.7.0",
|
|
38
|
+
"@magector/cli-linux-arm64": "2.7.0",
|
|
39
|
+
"@magector/cli-win32-x64": "2.7.0"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"magento",
|
package/src/mcp-server.js
CHANGED
|
@@ -5640,7 +5640,45 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
5640
5640
|
const res = raw.map(normalizeResult).filter(r =>
|
|
5641
5641
|
r.magentoType === 'plugin' || r.path?.toLowerCase().includes('plugin')
|
|
5642
5642
|
);
|
|
5643
|
-
text = formatSearchResults(res.slice(0,
|
|
5643
|
+
text = formatSearchResults(res.slice(0, 5));
|
|
5644
|
+
// DI registrations + method bodies (same as standalone find_plugin)
|
|
5645
|
+
if (a.targetClass) {
|
|
5646
|
+
const diFiles = await getDiXmlFiles(config.magentoRoot);
|
|
5647
|
+
const normalizedTarget = a.targetClass.replace(/\\\\/g, '\\');
|
|
5648
|
+
const isFqcn = normalizedTarget.includes('\\');
|
|
5649
|
+
const shortTarget = normalizedTarget.split('\\').pop().toLowerCase();
|
|
5650
|
+
for (const { content: diContent, relPath } of diFiles) {
|
|
5651
|
+
if (!diContent.includes(isFqcn ? normalizedTarget : a.targetClass)) continue;
|
|
5652
|
+
const typeBlockRegex = /<type\s+name="([^"]+)"[^>]*>([\s\S]*?)<\/type>/g;
|
|
5653
|
+
let tm;
|
|
5654
|
+
while ((tm = typeBlockRegex.exec(diContent)) !== null) {
|
|
5655
|
+
const typeName = tm[1].replace(/\\\\/g, '\\');
|
|
5656
|
+
const typeMatches = isFqcn ? typeName === normalizedTarget : typeName.split('\\').pop().toLowerCase() === shortTarget;
|
|
5657
|
+
if (!typeMatches) continue;
|
|
5658
|
+
const block = tm[2];
|
|
5659
|
+
const pluginRegex = /<plugin\s+([^/>]*)\/?>/g;
|
|
5660
|
+
let pm;
|
|
5661
|
+
while ((pm = pluginRegex.exec(block)) !== null) {
|
|
5662
|
+
const attrs = {};
|
|
5663
|
+
const localAttrRe = /(\w+)="([^"]*)"/g;
|
|
5664
|
+
let am;
|
|
5665
|
+
while ((am = localAttrRe.exec(pm[1])) !== null) attrs[am[1]] = am[2];
|
|
5666
|
+
text += `\n- **${attrs.name || '?'}** → \`${attrs.type || '?'}\` (${relPath})`;
|
|
5667
|
+
if (attrs.type) {
|
|
5668
|
+
const pFile = findClassFile(config.magentoRoot, attrs.type);
|
|
5669
|
+
if (pFile) {
|
|
5670
|
+
const methods = extractPluginMethods(pFile);
|
|
5671
|
+
for (const m of methods) {
|
|
5672
|
+
const body = readFullMethodBody(pFile, m.name);
|
|
5673
|
+
text += `\n - \`${m.type}\` **${m.targetMethod}** → \`${m.name}()\``;
|
|
5674
|
+
if (body) text += '\n ' + '```php\n ' + body.split('\n').join('\n ') + '\n ' + '```';
|
|
5675
|
+
}
|
|
5676
|
+
}
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5679
|
+
}
|
|
5680
|
+
}
|
|
5681
|
+
}
|
|
5644
5682
|
break;
|
|
5645
5683
|
}
|
|
5646
5684
|
case 'magento_find_observer': {
|