grepmax 0.26.50 → 0.26.52

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.
@@ -10,7 +10,7 @@
10
10
  "name": "grepmax",
11
11
  "source": "./plugins/grepmax",
12
12
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
13
- "version": "0.26.50",
13
+ "version": "0.26.52",
14
14
  "author": {
15
15
  "name": "Robert Owens",
16
16
  "email": "robowens@me.com"
package/README.md CHANGED
@@ -119,9 +119,11 @@ gmax plugin remove claude # Remove specific plugin
119
119
 
120
120
  After upgrading with `npm install -g grepmax@latest`, run `gmax plugin update` (or `gmax plugin update <client>`) to refresh integrations. Package installation does not modify your agent configuration; its postinstall script only prints this reminder.
121
121
 
122
+ Starting with v0.26.51, the installer refreshes an existing Claude marketplace from its configured source and updates each existing user/project/local installation in its original scope. It does not remove the marketplace, reset disabled preferences, or reinstall after a refresh failure. New installations use the local npm package. An existing source is retained; moving to another source is a separate migration. Codex instructions follow `CODEX_HOME` (default `~/.codex`), and a matching STDIO registration retains its existing options. A different existing launch configuration is reported for review instead of overwritten. Refresh the plugins after upgrading to activate the hook and installer repairs.
123
+
122
124
  ### How it works per client
123
125
 
124
- - **Claude Code:** Plugin with hooks (SessionStart, SessionEnd, CwdChanged, SubagentStart, PreToolUse). Model uses CLI via `Bash(gmax ... --agent)`.
126
+ - **Claude Code:** Plugin with session/directory hooks, guidance hooks and activity renewal on UserPromptSubmit/PostToolUse for Bash. Model uses CLI via `Bash(gmax ... --agent)`; the plugin does not register an MCP server. Source hooks honor the autostart kill switch, start only after a definite absent socket and never fall back to a separate watcher beside a live daemon.
125
127
  - **OpenCode:** Tool shim with dynamic SKILL + session plugin for daemon startup. Model calls gmax tool directly.
126
128
  - **Codex:** MCP server registration + AGENTS.md skill instructions.
127
129
  - **Factory Droid:** Skills + SessionStart/SessionEnd hooks for daemon lifecycle.
@@ -486,7 +488,7 @@ whether you need to act.
486
488
  | `disabling auto-rebuild until an optimize succeeds` | Transient, not a wedge. The next successful optimize clears it. Search stays available. |
487
489
  | `ANN: vector index not built` | Normal — exact search is the default. |
488
490
  | `cannot reach the daemon socket from this sandbox` (exit 2) | The shell is sandboxed. Add the two keys in [Running under the Claude Code sandbox](#running-under-the-claude-code-sandbox); `gmax doctor` warns about the same gap. |
489
- | `npm audit` reports advisories on install | v0.26.49 passed production and fresh packed-consumer audits. Audit findings can change: record the installed version and dependency path and report new findings; do not assume historical advisories still apply. |
491
+ | `npm audit` reports advisories on install | Record the installed version and dependency path and report new findings. JavaScript consumer audits do not cover the Python embedding environment; maintainers also audit its locked registry dependencies with `pnpm run audit:python` (Python 3.11+; no model load). |
490
492
 
491
493
  ## Contributing
492
494
 
@@ -46,32 +46,36 @@ exports.installClaudeCode = void 0;
46
46
  const node_child_process_1 = require("node:child_process");
47
47
  const fs = __importStar(require("node:fs"));
48
48
  const path = __importStar(require("node:path"));
49
+ const node_util_1 = require("node:util");
49
50
  const commander_1 = require("commander");
50
- function runClaudeCommand(args) {
51
- return new Promise((resolve, reject) => {
52
- const child = (0, node_child_process_1.spawn)("claude", ["plugin", ...args], {
51
+ const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
52
+ function runClaudeCommand(args_1) {
53
+ return __awaiter(this, arguments, void 0, function* (args, options = {}) {
54
+ const { stdout, stderr } = yield execFileAsync("claude", ["plugin", ...args], {
53
55
  env: process.env,
54
- stdio: "inherit",
55
- });
56
- const timeout = setTimeout(() => {
57
- child.kill("SIGTERM");
58
- reject(new Error("claude command timed out after 60s"));
59
- }, 60000);
60
- child.on("error", (error) => {
61
- clearTimeout(timeout);
62
- reject(error);
63
- });
64
- child.on("exit", (code) => {
65
- clearTimeout(timeout);
66
- if (code === 0) {
67
- resolve();
68
- }
69
- else {
70
- reject(new Error(`claude exited with code ${code !== null && code !== void 0 ? code : "unknown"}`));
71
- }
56
+ encoding: "utf8",
57
+ timeout: 60000,
58
+ maxBuffer: 2 * 1024 * 1024,
59
+ cwd: options.cwd,
72
60
  });
61
+ if (!options.quiet) {
62
+ process.stdout.write(stdout);
63
+ process.stderr.write(stderr);
64
+ }
65
+ return stdout;
73
66
  });
74
67
  }
68
+ function parseList(raw, label) {
69
+ const parsed = JSON.parse(raw);
70
+ const key = label === "marketplace list" ? "name" : "id";
71
+ if (!Array.isArray(parsed) ||
72
+ parsed.some((entry) => !entry ||
73
+ typeof entry !== "object" ||
74
+ typeof entry[key] !== "string" ||
75
+ !entry[key]))
76
+ throw new Error(`Unexpected Claude ${label} response; configuration preserved`);
77
+ return parsed;
78
+ }
75
79
  /**
76
80
  * Resolve the gmax package root directory.
77
81
  * Works for both npm global installs (symlinked binary) and dev mode.
@@ -94,19 +98,47 @@ function installPlugin() {
94
98
  return;
95
99
  }
96
100
  console.log(`Installing plugin from ${marketplacePath}`);
97
- // Remove old GitHub-based marketplace if present (ignore errors)
98
- try {
99
- yield runClaudeCommand(["marketplace", "remove", "grepmax"]);
101
+ // Query the CLI so account selection and CLAUDE_CONFIG_DIR match the client.
102
+ // A failed/invalid inventory must never trigger a destructive reinstall.
103
+ const marketplaces = parseList(yield runClaudeCommand(["marketplace", "list", "--json"], {
104
+ quiet: true,
105
+ }), "marketplace list");
106
+ const installed = parseList(yield runClaudeCommand(["list", "--json"], { quiet: true }), "plugin list").filter((entry) => entry.id === "grepmax@grepmax");
107
+ const updates = installed.filter((entry) => entry.scope !== "managed");
108
+ // Validate every target before even refreshing the source.
109
+ for (const entry of updates) {
110
+ if (!["user", "project", "local"].includes(String(entry.scope)))
111
+ throw new Error("Unknown gmax installation scope; configuration preserved");
112
+ if (entry.scope !== "user" &&
113
+ (typeof entry.projectPath !== "string" ||
114
+ !fs.existsSync(entry.projectPath)))
115
+ throw new Error("Missing gmax installation project; configuration preserved");
100
116
  }
101
- catch (_a) {
102
- // May not exist — fine
117
+ if (installed.length > 0 && updates.length === 0) {
118
+ console.log("gmax is managed by your administrator; installation preserved.");
119
+ return;
120
+ }
121
+ if (marketplaces.some((entry) => entry.name === "grepmax")) {
122
+ // Retain the user's chosen source, including GitHub or another npm prefix.
123
+ // Retargeting by removing a marketplace also deletes plugin-owned state.
124
+ yield runClaudeCommand(["marketplace", "update", "grepmax"]);
125
+ console.log("✔ Marketplace refreshed (existing source preserved)");
126
+ }
127
+ else {
128
+ yield runClaudeCommand(["marketplace", "add", marketplacePath]);
129
+ console.log("✔ Marketplace registered (local)");
130
+ }
131
+ if (updates.length === 0) {
132
+ yield runClaudeCommand(["install", "grepmax@grepmax", "--scope", "user"]);
133
+ }
134
+ else {
135
+ for (const entry of updates) {
136
+ yield runClaudeCommand(["update", "grepmax@grepmax", "--scope", String(entry.scope)], {
137
+ cwd: entry.scope === "user" ? undefined : String(entry.projectPath),
138
+ });
139
+ }
103
140
  }
104
- // Add local package directory as marketplace source
105
- yield runClaudeCommand(["marketplace", "add", marketplacePath]);
106
- console.log("✔ Marketplace registered (local)");
107
- // Install the plugin from the local marketplace
108
- yield runClaudeCommand(["install", "grepmax"]);
109
- console.log("✅ Successfully installed the gmax plugin for Claude Code");
141
+ console.log("✅ Successfully refreshed the gmax plugin for Claude Code");
110
142
  console.log("\nNext steps:");
111
143
  console.log("1. Restart Claude Code if it's running");
112
144
  console.log("2. Run `gmax add` in your project to index it");
@@ -15,13 +15,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.uninstallCodex = exports.installCodex = void 0;
16
16
  const node_child_process_1 = require("node:child_process");
17
17
  const node_fs_1 = __importDefault(require("node:fs"));
18
- const node_os_1 = __importDefault(require("node:os"));
19
18
  const node_path_1 = __importDefault(require("node:path"));
20
19
  const node_util_1 = require("node:util");
21
20
  const commander_1 = require("commander");
21
+ const codex_home_1 = require("../lib/utils/codex-home");
22
22
  const shell = process.env.SHELL || (process.platform === "win32" ? "cmd.exe" : "/bin/sh");
23
23
  const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
24
- const AGENTS_PATH = node_path_1.default.join(node_os_1.default.homedir(), ".codex", "AGENTS.md");
25
24
  const SKILL_START = "<!-- gmax:start -->";
26
25
  const SKILL_END = "<!-- gmax:end -->";
27
26
  function ownedSkillBlocks() {
@@ -48,6 +47,7 @@ function loadSkill() {
48
47
  }
49
48
  }
50
49
  function writeSkillToAgents(skill) {
50
+ const AGENTS_PATH = (0, codex_home_1.codexAgentsPath)();
51
51
  node_fs_1.default.mkdirSync(node_path_1.default.dirname(AGENTS_PATH), { recursive: true });
52
52
  const block = `${SKILL_START}\n${skill.trim()}\n${SKILL_END}`;
53
53
  if (!node_fs_1.default.existsSync(AGENTS_PATH)) {
@@ -74,20 +74,37 @@ function writeSkillToAgents(skill) {
74
74
  }
75
75
  function installPlugin() {
76
76
  return __awaiter(this, void 0, void 0, function* () {
77
+ var _a;
77
78
  try {
79
+ const inventory = yield execAsync("codex mcp list --json", {
80
+ shell,
81
+ env: process.env,
82
+ });
83
+ const servers = JSON.parse(inventory.stdout);
84
+ if (!Array.isArray(servers) ||
85
+ servers.some((server) => !server || typeof server.name !== "string"))
86
+ throw new Error("Unexpected Codex MCP inventory; configuration preserved");
87
+ const existing = servers.find((server) => (server === null || server === void 0 ? void 0 : server.name) === "gmax");
88
+ if (existing &&
89
+ (((_a = existing.transport) === null || _a === void 0 ? void 0 : _a.type) !== "stdio" ||
90
+ node_path_1.default.basename(String(existing.transport.command)) !== "gmax" ||
91
+ JSON.stringify(existing.transport.args) !== JSON.stringify(["mcp"])))
92
+ throw new Error("Existing gmax MCP launch differs; review it before replacing");
78
93
  // 1. Register MCP tool. Codex requires the stdio command after `--`:
79
94
  // codex mcp add [OPTIONS] <NAME> -- <COMMAND>...
80
95
  // Without the separator the launch command is misparsed. AGENTS.md is only
81
96
  // written after this resolves, so a failed registration leaves it untouched.
82
- yield execAsync("codex mcp add gmax -- gmax mcp", {
83
- shell,
84
- env: process.env,
85
- });
86
- console.log("✅ gmax MCP tool registered with Codex");
97
+ if (!existing) {
98
+ yield execAsync("codex mcp add gmax -- gmax mcp", {
99
+ shell,
100
+ env: process.env,
101
+ });
102
+ }
103
+ console.log("✅ gmax MCP registration ready (existing options preserved)");
87
104
  // 2. Write SKILL to AGENTS.md (idempotent)
88
105
  const skill = loadSkill();
89
106
  writeSkillToAgents(skill);
90
- console.log("✅ gmax skill instructions written to", AGENTS_PATH);
107
+ console.log("✅ gmax skill instructions written to", (0, codex_home_1.codexAgentsPath)());
91
108
  }
92
109
  catch (error) {
93
110
  console.error(`❌ Error installing Codex plugin: ${error}`);
@@ -97,6 +114,7 @@ function installPlugin() {
97
114
  }
98
115
  function uninstallPlugin() {
99
116
  return __awaiter(this, void 0, void 0, function* () {
117
+ const AGENTS_PATH = (0, codex_home_1.codexAgentsPath)();
100
118
  try {
101
119
  yield execAsync("codex mcp remove gmax", { shell, env: process.env });
102
120
  console.log("✅ gmax MCP tool removed");
@@ -49,6 +49,7 @@ const fs = __importStar(require("node:fs"));
49
49
  const os = __importStar(require("node:os"));
50
50
  const path = __importStar(require("node:path"));
51
51
  const commander_1 = require("commander");
52
+ const codex_home_1 = require("../lib/utils/codex-home");
52
53
  const exit_1 = require("../lib/utils/exit");
53
54
  function commandExists(cmd) {
54
55
  try {
@@ -106,7 +107,7 @@ function getClients() {
106
107
  id: "codex",
107
108
  detect: () => commandExists("codex"),
108
109
  isInstalled: () => {
109
- const p = path.join(os.homedir(), ".codex", "AGENTS.md");
110
+ const p = (0, codex_home_1.codexAgentsPath)();
110
111
  try {
111
112
  return (fs.existsSync(p) && fs.readFileSync(p, "utf-8").includes("gmax"));
112
113
  }
@@ -53,6 +53,7 @@ const watcher_1 = require("../lib/index/watcher");
53
53
  const index_state_footer_1 = require("../lib/output/index-state-footer");
54
54
  const meta_cache_1 = require("../lib/store/meta-cache");
55
55
  const vector_db_1 = require("../lib/store/vector-db");
56
+ const autostart_1 = require("../lib/utils/autostart");
56
57
  const daemon_restart_1 = require("../lib/utils/daemon-restart");
57
58
  const exit_1 = require("../lib/utils/exit");
58
59
  const filter_builder_1 = require("../lib/utils/filter-builder");
@@ -92,11 +93,18 @@ exports.watch = new commander_1.Command("watch")
92
93
  return;
93
94
  }
94
95
  if (options.background) {
96
+ const startOnly = process.env.GMAX_DAEMON_START_ONLY === "1";
97
+ // Plugin hooks are implicit starts. Recheck quarantine in this child
98
+ // and never use their launch as a version-upgrade restart.
99
+ if (startOnly && (0, autostart_1.isAutostartDisabled)())
100
+ return;
95
101
  // Skip spawn if daemon already running at the same version.
96
102
  // If version mismatches (e.g. after npm install -g), shut down the old
97
103
  // daemon so we can start a fresh one with the new code.
98
104
  const { isDaemonRunning, isDaemonHeartbeatFresh, sendDaemonCommand, readDaemonPid, waitForProcessExit, } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/daemon-client")));
99
105
  if (yield isDaemonRunning()) {
106
+ if (startOnly)
107
+ return;
100
108
  const cliVersion = JSON.parse(fs.readFileSync(path.join(__dirname, "../../package.json"), "utf-8")).version;
101
109
  const resp = yield sendDaemonCommand({ cmd: "ping" });
102
110
  if (resp.version && resp.version === cliVersion) {
@@ -49,7 +49,7 @@ const config_1 = require("../../config");
49
49
  * Explicit `gmax watch --daemon` is never gated: typing it is the user asking
50
50
  * for a daemon in that moment.
51
51
  *
52
- * plugins/grepmax/hooks/start.js carries a plain-JS copy of these semantics
52
+ * plugins/grepmax/hooks/watch-lease.js carries a plain-JS copy of these semantics
53
53
  * (env var checked first, then the file) because a SessionStart hook cannot
54
54
  * import from dist. Keep the two in sync.
55
55
  */
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.codexAgentsPath = codexAgentsPath;
37
+ const os = __importStar(require("node:os"));
38
+ const path = __importStar(require("node:path"));
39
+ function codexAgentsPath() {
40
+ const home = process.env.CODEX_HOME
41
+ ? path.resolve(process.env.CODEX_HOME)
42
+ : path.join(os.homedir(), ".codex");
43
+ return path.join(home, "AGENTS.md");
44
+ }
@@ -6,7 +6,7 @@ requires-python = ">=3.13"
6
6
  dependencies = [
7
7
  "fastapi>=0.115.0",
8
8
  "uvicorn>=0.34.0",
9
- "mlx-embeddings @ git+https://github.com/Blaizzy/mlx-embeddings.git",
9
+ "mlx-embeddings @ git+https://github.com/Blaizzy/mlx-embeddings.git@88522e288c0142170a5a44fd93c184d8ed777371",
10
10
  "mlx-lm>=0.22.0",
11
11
  "setproctitle>=1.3.0",
12
12
  ]
@@ -14,3 +14,23 @@ dependencies = [
14
14
  [project.scripts]
15
15
  mlx-embed-server = "server:main"
16
16
  mlx-summarizer = "summarizer:main"
17
+
18
+ [tool.uv]
19
+ # Advisory patch floors for the HTTP/TLS, model and utility dependency trees.
20
+ # Constraints do not install otherwise-unused packages or change model weights.
21
+ # Keep these floors when refreshing the lock; npm audits do not cover Python.
22
+ constraint-dependencies = [
23
+ "aiohttp>=3.14.3",
24
+ "anyio>=4.14.2",
25
+ "click>=8.3.3",
26
+ "datasets>=5.0.1",
27
+ "fsspec>=2026.6.0",
28
+ "idna>=3.15",
29
+ "multidict>=6.9.1",
30
+ "pillow>=12.3.0",
31
+ "pygments>=2.20.0",
32
+ "requests>=2.33.0",
33
+ "starlette>=1.3.1",
34
+ "transformers>=5.10.1", # 5.10.0 was yanked by its maintainers.
35
+ "urllib3>=2.8.0",
36
+ ]