magector 2.1.3 → 2.1.4

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/package.json +5 -5
  2. package/src/mcp-server.js +11 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magector",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Semantic code search for Magento 2 — index, search, MCP server",
5
5
  "type": "module",
6
6
  "main": "src/mcp-server.js",
@@ -39,10 +39,10 @@
39
39
  "ruvector": "^0.1.96"
40
40
  },
41
41
  "optionalDependencies": {
42
- "@magector/cli-darwin-arm64": "2.1.3",
43
- "@magector/cli-linux-x64": "2.1.3",
44
- "@magector/cli-linux-arm64": "2.1.3",
45
- "@magector/cli-win32-x64": "2.1.3"
42
+ "@magector/cli-darwin-arm64": "2.1.4",
43
+ "@magector/cli-linux-x64": "2.1.4",
44
+ "@magector/cli-linux-arm64": "2.1.4",
45
+ "@magector/cli-win32-x64": "2.1.4"
46
46
  },
47
47
  "keywords": [
48
48
  "magento",
package/src/mcp-server.js CHANGED
@@ -81,8 +81,8 @@ function logToFile(level, message) {
81
81
  }
82
82
  }
83
83
 
84
- // Initialize log file on startup
85
- try { writeFileSync(LOG_PATH, `[${new Date().toISOString()}] [INFO] Magector MCP server starting\n`); } catch {}
84
+ // Initialize log on startup — append to preserve history across MCP restarts
85
+ try { appendFileSync(LOG_PATH, `\n[${new Date().toISOString()}] [INFO] ════ Magector MCP server starting ════\n`); } catch {}
86
86
 
87
87
  // Log resolved configuration so the log file is self-contained for debugging
88
88
  logToFile('INFO', `Config: MAGENTO_ROOT=${config.magentoRoot}`);
@@ -320,12 +320,17 @@ function startBackgroundReindex() {
320
320
  // Write PID file so other MCP instances know a reindex is running
321
321
  writeReindexPidFile(reindexProcess.pid);
322
322
 
323
- reindexProcess.stdout.on('data', (d) => {
324
- const text = d.toString().replace(/\x1b\[[0-9;]*m/g, '').trim();
323
+ // Log stdout/stderr line-by-line using readline to avoid buffering issues.
324
+ // Without this, Rust tracing output accumulates in pipe buffers and progress
325
+ // entries arrive in large chunks instead of in real time.
326
+ const indexStdout = createInterface({ input: reindexProcess.stdout });
327
+ const indexStderr = createInterface({ input: reindexProcess.stderr });
328
+ indexStdout.on('line', (line) => {
329
+ const text = line.replace(/\x1b\[[0-9;]*m/g, '').trim();
325
330
  if (text) logToFile('INDEX', text);
326
331
  });
327
- reindexProcess.stderr.on('data', (d) => {
328
- const text = d.toString().replace(/\x1b\[[0-9;]*m/g, '').trim();
332
+ indexStderr.on('line', (line) => {
333
+ const text = line.replace(/\x1b\[[0-9;]*m/g, '').trim();
329
334
  if (text) logToFile('INDEX', text);
330
335
  });
331
336