grepmax 0.7.2 → 0.7.3
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.
|
@@ -33,7 +33,8 @@ function installPlugin() {
|
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
try {
|
|
35
35
|
yield runClaudeCommand(["marketplace", "add", "reowens/grepmax"]);
|
|
36
|
-
|
|
36
|
+
yield runClaudeCommand(["marketplace", "update", "grepmax"]);
|
|
37
|
+
console.log("✅ Marketplace updated");
|
|
37
38
|
yield runClaudeCommand(["install", "grepmax"]);
|
|
38
39
|
console.log("✅ Successfully installed the gmax plugin for Claude Code");
|
|
39
40
|
console.log("\nNext steps:");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require("node:fs");
|
|
2
2
|
const _path = require("node:path");
|
|
3
3
|
const http = require("node:http");
|
|
4
|
-
const { spawn } = require("node:child_process");
|
|
4
|
+
const { spawn, execFileSync } = require("node:child_process");
|
|
5
5
|
|
|
6
6
|
function isServerRunning(port) {
|
|
7
7
|
return new Promise((resolve) => {
|
|
@@ -20,12 +20,30 @@ function isServerRunning(port) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function findMlxServerDir() {
|
|
24
|
+
// Try to find mlx-embed-server relative to the gmax binary (npm install location)
|
|
25
|
+
try {
|
|
26
|
+
const gmaxPath = execFileSync("which gmax", {
|
|
27
|
+
encoding: "utf-8",
|
|
28
|
+
}).trim();
|
|
29
|
+
// gmax binary is a symlink in .bin/ → resolve to package root
|
|
30
|
+
const realPath = fs.realpathSync(gmaxPath);
|
|
31
|
+
const pkgRoot = _path.resolve(_path.dirname(realPath), "..");
|
|
32
|
+
const serverDir = _path.join(pkgRoot, "mlx-embed-server");
|
|
33
|
+
if (fs.existsSync(_path.join(serverDir, "server.py"))) return serverDir;
|
|
34
|
+
} catch {}
|
|
35
|
+
|
|
36
|
+
// Fallback: dev mode — relative to plugin root
|
|
24
37
|
const pluginRoot = __dirname.replace(/\/hooks$/, "");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
38
|
+
const devRoot = _path.resolve(pluginRoot, "../..");
|
|
39
|
+
const devDir = _path.join(devRoot, "mlx-embed-server");
|
|
40
|
+
if (fs.existsSync(_path.join(devDir, "server.py"))) return devDir;
|
|
27
41
|
|
|
28
|
-
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function startPythonServer(serverDir, scriptName, logName) {
|
|
46
|
+
if (!serverDir) return;
|
|
29
47
|
|
|
30
48
|
const logPath = `/tmp/${logName}.log`;
|
|
31
49
|
const out = fs.openSync(logPath, "a");
|
|
@@ -41,7 +59,6 @@ function startPythonServer(scriptName, logName) {
|
|
|
41
59
|
|
|
42
60
|
function startWatcher() {
|
|
43
61
|
try {
|
|
44
|
-
const { execFileSync } = require("node:child_process");
|
|
45
62
|
execFileSync("gmax", ["watch", "-b"], { timeout: 5000, stdio: "ignore" });
|
|
46
63
|
} catch {
|
|
47
64
|
// Watcher may already be running or gmax not in PATH — ignore
|
|
@@ -49,18 +66,19 @@ function startWatcher() {
|
|
|
49
66
|
}
|
|
50
67
|
|
|
51
68
|
async function main() {
|
|
52
|
-
const embedMode =
|
|
53
|
-
process.env.GMAX_EMBED_MODE || process.env.OSGREP_EMBED_MODE || "auto";
|
|
69
|
+
const embedMode = process.env.GMAX_EMBED_MODE || "auto";
|
|
54
70
|
|
|
55
71
|
if (embedMode !== "cpu") {
|
|
72
|
+
const serverDir = findMlxServerDir();
|
|
73
|
+
|
|
56
74
|
// Start MLX embed server (port 8100)
|
|
57
|
-
if (!(await isServerRunning(8100))) {
|
|
58
|
-
startPythonServer("server.py", "mlx-embed-server");
|
|
75
|
+
if (serverDir && !(await isServerRunning(8100))) {
|
|
76
|
+
startPythonServer(serverDir, "server.py", "mlx-embed-server");
|
|
59
77
|
}
|
|
60
78
|
|
|
61
79
|
// Start LLM summarizer server (port 8101)
|
|
62
|
-
if (!(await isServerRunning(8101))) {
|
|
63
|
-
startPythonServer("summarizer.py", "mlx-summarizer");
|
|
80
|
+
if (serverDir && !(await isServerRunning(8101))) {
|
|
81
|
+
startPythonServer(serverDir, "summarizer.py", "mlx-summarizer");
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
|
|
@@ -71,7 +89,7 @@ async function main() {
|
|
|
71
89
|
hookSpecificOutput: {
|
|
72
90
|
hookEventName: "SessionStart",
|
|
73
91
|
additionalContext:
|
|
74
|
-
|
|
92
|
+
"gmax MCP ready. Use semantic_search for concept-based code search (5+ words recommended). Use code_skeleton before reading large files. index_status to check health.",
|
|
75
93
|
},
|
|
76
94
|
};
|
|
77
95
|
process.stdout.write(JSON.stringify(response));
|