magector 1.2.13 → 1.2.14
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 +112 -125
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -72,19 +72,22 @@ Without Magector, asking Claude Code or Cursor *"how are checkout totals calcula
|
|
|
72
72
|
## Architecture
|
|
73
73
|
|
|
74
74
|
```mermaid
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
flowchart TD
|
|
76
|
+
subgraph rust ["Rust Core"]
|
|
77
|
+
A["AST Parser · PHP + JS"]
|
|
78
|
+
B["Pattern Detection · 20+"]
|
|
79
|
+
C["ONNX Embedder · 384d"]
|
|
80
|
+
D["HNSW + Reranking"]
|
|
81
|
+
A --> B --> C --> D
|
|
82
82
|
end
|
|
83
|
-
|
|
84
|
-
E["MCP Server
|
|
85
|
-
F["Persistent Serve
|
|
86
|
-
G["CLI
|
|
83
|
+
subgraph node ["Node.js Layer"]
|
|
84
|
+
E["MCP Server · 19 tools"]
|
|
85
|
+
F["Persistent Serve"]
|
|
86
|
+
G["CLI · init/index/search"]
|
|
87
|
+
E --> F
|
|
88
|
+
G --> F
|
|
87
89
|
end
|
|
90
|
+
node -->|stdin/stdout JSON| rust
|
|
88
91
|
|
|
89
92
|
style rust fill:#f4a460,color:#000
|
|
90
93
|
style node fill:#68b684,color:#000
|
|
@@ -93,26 +96,25 @@ block-beta
|
|
|
93
96
|
### Indexing Pipeline
|
|
94
97
|
|
|
95
98
|
```mermaid
|
|
96
|
-
flowchart
|
|
97
|
-
A[Source File
|
|
98
|
-
B --> C[
|
|
99
|
-
C --> D[
|
|
100
|
-
D --> E[ONNX
|
|
101
|
-
E --> F[
|
|
102
|
-
A --> G[Metadata
|
|
103
|
-
|
|
104
|
-
G --> H
|
|
99
|
+
flowchart TD
|
|
100
|
+
A[Source File] --> B[AST Parser]
|
|
101
|
+
B --> C[Pattern Detection]
|
|
102
|
+
C --> D[Text Enrichment]
|
|
103
|
+
D --> E[ONNX Embedding]
|
|
104
|
+
E --> F[(HNSW Index)]
|
|
105
|
+
A --> G[Metadata]
|
|
106
|
+
G --> F
|
|
105
107
|
```
|
|
106
108
|
|
|
107
109
|
### Search Pipeline
|
|
108
110
|
|
|
109
111
|
```mermaid
|
|
110
|
-
flowchart
|
|
111
|
-
Q[Query
|
|
112
|
-
E1 --> E2[ONNX Embedding
|
|
113
|
-
E2 --> H[HNSW
|
|
114
|
-
H --> R[Hybrid
|
|
115
|
-
R --> J[Structured JSON
|
|
112
|
+
flowchart TD
|
|
113
|
+
Q[Query] --> E1[Synonym Enrichment]
|
|
114
|
+
E1 --> E2[ONNX Embedding]
|
|
115
|
+
E2 --> H[HNSW Search]
|
|
116
|
+
H --> R[Hybrid Reranking]
|
|
117
|
+
R --> J[Structured JSON]
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
### Components
|
|
@@ -145,12 +147,12 @@ npx magector init
|
|
|
145
147
|
This single command handles the entire setup:
|
|
146
148
|
|
|
147
149
|
```mermaid
|
|
148
|
-
flowchart
|
|
149
|
-
A["npx magector init"] --> B[Verify
|
|
150
|
-
B --> C[Download
|
|
151
|
-
C --> D[Index Codebase
|
|
152
|
-
D --> E[Detect IDE
|
|
153
|
-
E --> F[Write Config
|
|
150
|
+
flowchart TD
|
|
151
|
+
A["npx magector init"] --> B[Verify Project]
|
|
152
|
+
B --> C[Download Model]
|
|
153
|
+
C --> D[Index Codebase]
|
|
154
|
+
D --> E[Detect IDE]
|
|
155
|
+
E --> F[Write Config]
|
|
154
156
|
F --> G[Update .gitignore]
|
|
155
157
|
```
|
|
156
158
|
|
|
@@ -341,35 +343,35 @@ All search tools return structured JSON:
|
|
|
341
343
|
Each tool description includes "See also" hints to help AI clients chain tools effectively:
|
|
342
344
|
|
|
343
345
|
```mermaid
|
|
344
|
-
graph
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
style
|
|
362
|
-
style
|
|
363
|
-
style
|
|
364
|
-
style
|
|
365
|
-
style
|
|
366
|
-
style
|
|
346
|
+
graph TD
|
|
347
|
+
cls["find_class"] --> plg["find_plugin"]
|
|
348
|
+
cls --> prf["find_preference"]
|
|
349
|
+
cls --> mtd["find_method"]
|
|
350
|
+
cfg["find_config"] --> obs["find_observer"]
|
|
351
|
+
cfg --> prf
|
|
352
|
+
cfg --> api["find_api"]
|
|
353
|
+
plg --> cls
|
|
354
|
+
plg --> mtd
|
|
355
|
+
tpl["find_template"] --> blk["find_block"]
|
|
356
|
+
blk --> tpl
|
|
357
|
+
blk --> cfg
|
|
358
|
+
dbs["find_db_schema"] --> cls
|
|
359
|
+
gql["find_graphql"] --> cls
|
|
360
|
+
gql --> mtd
|
|
361
|
+
ctl["find_controller"] --> cfg
|
|
362
|
+
|
|
363
|
+
style cls fill:#4a90d9,color:#fff
|
|
364
|
+
style mtd fill:#4a90d9,color:#fff
|
|
365
|
+
style cfg fill:#e8a838,color:#000
|
|
366
|
+
style plg fill:#d94a4a,color:#fff
|
|
367
|
+
style obs fill:#d94a4a,color:#fff
|
|
368
|
+
style prf fill:#e8a838,color:#000
|
|
367
369
|
style api fill:#e8a838,color:#000
|
|
368
|
-
style
|
|
369
|
-
style
|
|
370
|
-
style
|
|
371
|
-
style
|
|
372
|
-
style
|
|
370
|
+
style tpl fill:#68b684,color:#000
|
|
371
|
+
style blk fill:#68b684,color:#000
|
|
372
|
+
style dbs fill:#9b59b6,color:#fff
|
|
373
|
+
style gql fill:#9b59b6,color:#fff
|
|
374
|
+
style ctl fill:#4a90d9,color:#fff
|
|
373
375
|
```
|
|
374
376
|
|
|
375
377
|
### Query Examples
|
|
@@ -425,15 +427,11 @@ Magector is validated at two levels:
|
|
|
425
427
|
config:
|
|
426
428
|
themeVariables:
|
|
427
429
|
pie1: "#4caf50"
|
|
428
|
-
pie2: "#
|
|
429
|
-
pie3: "#2196f3"
|
|
430
|
-
pie4: "#9c27b0"
|
|
430
|
+
pie2: "#f44336"
|
|
431
431
|
---
|
|
432
|
-
pie title
|
|
433
|
-
"
|
|
434
|
-
"
|
|
435
|
-
"MRR (99.2%)" : 99.2
|
|
436
|
-
"NDCG@10 (85.5%)" : 85.5
|
|
432
|
+
pie title Test Pass Rate (101 queries)
|
|
433
|
+
"Passed (101)" : 101
|
|
434
|
+
"Failed (0)" : 0
|
|
437
435
|
```
|
|
438
436
|
|
|
439
437
|
| Metric | Value |
|
|
@@ -569,23 +567,20 @@ Magector scans every `.php`, `.js`, `.xml`, `.phtml`, and `.graphqls` file in a
|
|
|
569
567
|
The MCP server spawns a persistent Rust process (`magector-core serve`) that keeps the ONNX model and HNSW index loaded in memory. Queries are sent as JSON over stdin and responses returned via stdout -- eliminating the ~2.6s cold-start overhead of loading the model per query. Falls back to single-shot `execFileSync` if the serve process is unavailable.
|
|
570
568
|
|
|
571
569
|
```mermaid
|
|
572
|
-
flowchart
|
|
570
|
+
flowchart TD
|
|
573
571
|
subgraph startup ["Startup (once)"]
|
|
574
|
-
S1[Load
|
|
575
|
-
S2 --> S3[
|
|
572
|
+
S1[Load Model] --> S2[Load Index]
|
|
573
|
+
S2 --> S3[Ready Signal]
|
|
576
574
|
end
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
Q4 --> Q5["stdout: JSON response"]
|
|
575
|
+
subgraph query ["Per Query (10-45ms)"]
|
|
576
|
+
Q1[stdin JSON] --> Q2[Embed]
|
|
577
|
+
Q2 --> Q3[HNSW Search]
|
|
578
|
+
Q3 --> Q4[Rerank]
|
|
579
|
+
Q4 --> Q5[stdout JSON]
|
|
583
580
|
end
|
|
584
|
-
|
|
585
581
|
startup --> query
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
F1["execFileSync\n~2.6s cold start"]
|
|
582
|
+
subgraph fallback ["Fallback"]
|
|
583
|
+
F1[execFileSync ~2.6s]
|
|
589
584
|
end
|
|
590
585
|
|
|
591
586
|
style startup fill:#e8f4e8,color:#000
|
|
@@ -599,20 +594,20 @@ The MCP server delegates all search/index operations to the Rust core binary. An
|
|
|
599
594
|
|
|
600
595
|
```mermaid
|
|
601
596
|
sequenceDiagram
|
|
602
|
-
participant Dev
|
|
603
|
-
participant AI
|
|
604
|
-
participant MCP
|
|
605
|
-
participant Rust
|
|
606
|
-
participant HNSW
|
|
607
|
-
|
|
608
|
-
Dev->>AI: "
|
|
609
|
-
AI->>MCP: magento_search(
|
|
610
|
-
MCP->>Rust:
|
|
611
|
-
Rust->>HNSW:
|
|
612
|
-
HNSW-->>Rust:
|
|
613
|
-
Rust-->>MCP:
|
|
614
|
-
MCP-->>AI:
|
|
615
|
-
AI-->>Dev: TotalsCollector.php
|
|
597
|
+
participant Dev
|
|
598
|
+
participant AI
|
|
599
|
+
participant MCP
|
|
600
|
+
participant Rust
|
|
601
|
+
participant HNSW
|
|
602
|
+
|
|
603
|
+
Dev->>AI: "checkout totals?"
|
|
604
|
+
AI->>MCP: magento_search(...)
|
|
605
|
+
MCP->>Rust: JSON query
|
|
606
|
+
Rust->>HNSW: embed + search
|
|
607
|
+
HNSW-->>Rust: candidates
|
|
608
|
+
Rust-->>MCP: JSON results
|
|
609
|
+
MCP-->>AI: paths, methods, badges
|
|
610
|
+
AI-->>Dev: TotalsCollector.php
|
|
616
611
|
```
|
|
617
612
|
|
|
618
613
|
---
|
|
@@ -621,38 +616,29 @@ sequenceDiagram
|
|
|
621
616
|
|
|
622
617
|
```mermaid
|
|
623
618
|
mindmap
|
|
624
|
-
root((
|
|
625
|
-
PHP
|
|
619
|
+
root((Patterns))
|
|
620
|
+
PHP
|
|
626
621
|
Controller
|
|
627
622
|
Model
|
|
628
623
|
Repository
|
|
629
624
|
Block
|
|
630
625
|
Helper
|
|
631
626
|
ViewModel
|
|
632
|
-
Console Command
|
|
633
|
-
Data Provider
|
|
634
627
|
Interception
|
|
635
628
|
Plugin
|
|
636
629
|
Observer
|
|
637
630
|
Preference
|
|
638
|
-
XML
|
|
631
|
+
XML
|
|
639
632
|
di.xml
|
|
640
633
|
events.xml
|
|
641
634
|
webapi.xml
|
|
642
635
|
routes.xml
|
|
643
|
-
system.xml
|
|
644
|
-
layout XML
|
|
645
|
-
module.xml
|
|
646
636
|
crontab.xml
|
|
647
637
|
db_schema.xml
|
|
648
638
|
Frontend
|
|
649
|
-
|
|
639
|
+
Template
|
|
650
640
|
JavaScript
|
|
651
|
-
GraphQL
|
|
652
|
-
GraphQL Resolver
|
|
653
|
-
Database
|
|
654
|
-
Setup Patch
|
|
655
|
-
Declarative Schema
|
|
641
|
+
GraphQL
|
|
656
642
|
```
|
|
657
643
|
|
|
658
644
|
Magector understands these Magento 2 architectural patterns:
|
|
@@ -856,23 +842,24 @@ struct IndexMetadata {
|
|
|
856
842
|
|
|
857
843
|
```mermaid
|
|
858
844
|
gantt
|
|
859
|
-
title
|
|
845
|
+
title Roadmap
|
|
860
846
|
dateFormat YYYY-MM
|
|
861
|
-
axisFormat %b
|
|
862
|
-
section
|
|
863
|
-
Hybrid search
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
Cross-tool
|
|
867
|
-
E2E
|
|
868
|
-
section
|
|
869
|
-
Method
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
Incremental
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
847
|
+
axisFormat %b
|
|
848
|
+
section Done
|
|
849
|
+
Hybrid search :done, 2025-01, 30d
|
|
850
|
+
Serve mode :done, 2025-02, 30d
|
|
851
|
+
JSON output :done, 2025-03, 15d
|
|
852
|
+
Cross-tool hints :done, 2025-03, 15d
|
|
853
|
+
E2E tests :done, 2025-03, 15d
|
|
854
|
+
section Next
|
|
855
|
+
Method chunking :active, 2025-04, 30d
|
|
856
|
+
Intent detection :2025-05, 30d
|
|
857
|
+
Type filtering :2025-06, 30d
|
|
858
|
+
Incremental index :2025-07, 30d
|
|
859
|
+
section Future
|
|
860
|
+
VSCode extension :2025-08, 60d
|
|
861
|
+
Web UI :2025-10, 60d
|
|
862
|
+
Commerce support :2026-01, 60d
|
|
876
863
|
```
|
|
877
864
|
|
|
878
865
|
- [x] Hybrid search (semantic + keyword re-ranking)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magector",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
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": "1.2.
|
|
37
|
-
"@magector/cli-linux-x64": "1.2.
|
|
38
|
-
"@magector/cli-linux-arm64": "1.2.
|
|
39
|
-
"@magector/cli-win32-x64": "1.2.
|
|
36
|
+
"@magector/cli-darwin-arm64": "1.2.14",
|
|
37
|
+
"@magector/cli-linux-x64": "1.2.14",
|
|
38
|
+
"@magector/cli-linux-arm64": "1.2.14",
|
|
39
|
+
"@magector/cli-win32-x64": "1.2.14"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"magento",
|