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.
Files changed (2) hide show
  1. package/README.md +112 -125
  2. 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
- block-beta
76
- columns 2
77
- block:rust["Rust Core"]:1
78
- A["Tree-sitter AST Parser\nPHP + JS"]
79
- B["Magento Pattern Detection\n20+ patterns"]
80
- C["ONNX Embedder\nMiniLM-L6-v2 · 384 dim"]
81
- D["HNSW Vector DB\n+ Hybrid Reranking"]
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
- block:node["Node.js Layer"]:1
84
- E["MCP Server\n19 tools · JSON output"]
85
- F["Persistent Serve Process\nstdin/stdout JSON"]
86
- G["CLI Interface\ninit · index · search · serve"]
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 LR
97
- A[Source File\n.php .xml .js .phtml .graphqls] --> B[Tree-sitter\nAST Parser]
98
- B --> C[Magento Pattern\nDetection]
99
- C --> D[Search Text\nEnrichment]
100
- D --> E[ONNX Runtime\nMiniLM-L6-v2]
101
- E --> F[384-dim\nEmbedding]
102
- A --> G[Metadata\npath · class · namespace\nmethods · patterns]
103
- F --> H[(HNSW Index\n35,795 vectors)]
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 LR
111
- Q[Query Text] --> E1[Pattern Synonym\nEnrichment]
112
- E1 --> E2[ONNX Embedding\n384-dim vector]
113
- E2 --> H[HNSW\nNearest Neighbor]
114
- H --> R[Hybrid\nReranking]
115
- R --> J[Structured JSON\npath · class · methods\nbadges · snippet]
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 LR
149
- A["npx magector init"] --> B[Verify Magento\nProject]
150
- B --> C[Download ONNX Model\n~86MB · cached]
151
- C --> D[Index Codebase\n36K+ vectors]
152
- D --> E[Detect IDE\nCursor / Claude Code]
153
- E --> F[Write Config\nMCP + IDE rules]
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 LR
345
- class["find_class"] --> plugin["find_plugin"]
346
- class --> pref["find_preference"]
347
- class --> method["find_method"]
348
- config["find_config"] --> observer["find_observer"]
349
- config --> pref
350
- config --> api["find_api"]
351
- plugin --> class
352
- plugin --> method
353
- template["find_template"] --> block["find_block"]
354
- block --> template
355
- block --> config
356
- db["find_db_schema"] --> class
357
- graphql["find_graphql"] --> class
358
- graphql --> method
359
- controller["find_controller"] --> config
360
-
361
- style class fill:#4a90d9,color:#fff
362
- style method fill:#4a90d9,color:#fff
363
- style config fill:#e8a838,color:#000
364
- style plugin fill:#d94a4a,color:#fff
365
- style observer fill:#d94a4a,color:#fff
366
- style pref fill:#e8a838,color:#000
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 template fill:#68b684,color:#000
369
- style block fill:#68b684,color:#000
370
- style db fill:#9b59b6,color:#fff
371
- style graphql fill:#9b59b6,color:#fff
372
- style controller fill:#4a90d9,color:#fff
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: "#ff9800"
429
- pie3: "#2196f3"
430
- pie4: "#9c27b0"
430
+ pie2: "#f44336"
431
431
  ---
432
- pie title Accuracy Breakdown (94.9/100)
433
- "Pass Rate (100%)" : 100
434
- "Precision (93.2%)" : 93.2
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 TB
570
+ flowchart TD
573
571
  subgraph startup ["Startup (once)"]
574
- S1[Load ONNX Model\n~500ms] --> S2[Load HNSW Index\n~1s]
575
- S2 --> S3["Send ready signal\n{ok:true, ready:true}"]
572
+ S1[Load Model] --> S2[Load Index]
573
+ S2 --> S3[Ready Signal]
576
574
  end
577
-
578
- subgraph query ["Per Query (~10-45ms)"]
579
- Q1["stdin: JSON query"] --> Q2[Embed query\n~2ms]
580
- Q2 --> Q3[HNSW search\n~5-15ms]
581
- Q3 --> Q4[Hybrid rerank\n~1ms]
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
- subgraph fallback ["Fallback (if serve unavailable)"]
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 as Developer
603
- participant AI as AI Assistant
604
- participant MCP as MCP Server<br/>(Node.js)
605
- participant Rust as Persistent Rust<br/>Process
606
- participant HNSW as HNSW Index<br/>(35K vectors)
607
-
608
- Dev->>AI: "How does checkout totals calculation work?"
609
- AI->>MCP: magento_search("checkout totals collector")
610
- MCP->>Rust: {"command":"search","query":"...","limit":10}
611
- Rust->>HNSW: Embed query → nearest neighbor
612
- HNSW-->>Rust: Top candidates + scores
613
- Rust-->>MCP: {"ok":true,"data":[...]}
614
- MCP-->>AI: Structured JSON with paths,<br/>methods, badges, snippets
615
- AI-->>Dev: TotalsCollector.php,<br/>Address/Total/Collector.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((Magento 2\nPatterns))
625
- PHP Classes
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 Config
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
- PHTML Template
639
+ Template
650
640
  JavaScript
651
- GraphQL Schema
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 Magector Development Roadmap
845
+ title Roadmap
860
846
  dateFormat YYYY-MM
861
- axisFormat %b %Y
862
- section Completed
863
- Hybrid search (semantic + keyword) :done, 2025-01, 2025-02
864
- Persistent serve mode :done, 2025-02, 2025-03
865
- Structured JSON output :done, 2025-03, 2025-03
866
- Cross-tool discovery hints :done, 2025-03, 2025-03
867
- E2E accuracy test suite (101 queries) :done, 2025-03, 2025-03
868
- section Planned
869
- Method-level chunking :active, 2025-04, 2025-05
870
- Query intent classification :2025-05, 2025-06
871
- Vector-level file type filtering :2025-06, 2025-07
872
- Incremental indexing :2025-07, 2025-08
873
- VSCode extension :2025-08, 2025-10
874
- Web UI for browsing results :2025-10, 2025-12
875
- Magento Commerce support :2026-01, 2026-03
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.13",
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.13",
37
- "@magector/cli-linux-x64": "1.2.13",
38
- "@magector/cli-linux-arm64": "1.2.13",
39
- "@magector/cli-win32-x64": "1.2.13"
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",