grepmax 0.7.35 → 0.7.37

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 CHANGED
@@ -125,6 +125,7 @@ gmax "how is the database connection pooled?"
125
125
 
126
126
  | Flag | Description | Default |
127
127
  | --- | --- | --- |
128
+ | `--agent` | Ultra-compact output for AI agents (one line per result). | `false` |
128
129
  | `-m <n>` | Max total results to return. | `5` |
129
130
  | `--per-file <n>` | Max matches to show per file. | `3` |
130
131
  | `-c`, `--content` | Show full chunk content instead of snippets. | `false` |
@@ -148,13 +149,15 @@ gmax "how is the database connection pooled?"
148
149
 
149
150
  ```bash
150
151
  gmax "API rate limiting logic"
151
- gmax "auth handler" --role ORCHESTRATION --lang ts --plain
152
- gmax "database" --file syncer.ts --plain
153
- gmax "VectorDB" --symbol --plain
154
- gmax "error handling" -C 5 --imports
155
- gmax "handler" --name "handle.*" --exclude tests/
152
+ gmax "auth handler" --role ORCHESTRATION --lang ts --agent
153
+ gmax "database" --file syncer.ts --agent
154
+ gmax "VectorDB" --symbol --agent
155
+ gmax "error handling" -C 5 --imports --plain
156
+ gmax "handler" --name "handle.*" --exclude tests/ --agent
156
157
  ```
157
158
 
159
+ > **For AI agents:** Use `--agent` for the most token-efficient output (~90% fewer tokens than default). Output format: `file:line symbol [role] — summary`
160
+
158
161
  ### `gmax index`
159
162
 
160
163
  Index a directory into the centralized store.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.7.35",
3
+ "version": "0.7.37",
4
4
  "author": "Robert Owens <robowens@me.com>",
5
5
  "homepage": "https://github.com/reowens/grepmax",
6
6
  "bugs": {
@@ -23,6 +23,7 @@
23
23
  "files": [
24
24
  "dist",
25
25
  "plugins",
26
+ "scripts/postinstall.js",
26
27
  "mlx-embed-server",
27
28
  "README.md",
28
29
  "LICENSE",
@@ -62,6 +63,7 @@
62
63
  "vitest": "^1.6.1"
63
64
  },
64
65
  "scripts": {
66
+ "postinstall": "node scripts/postinstall.js",
65
67
  "prebuild": "mkdir -p dist",
66
68
  "build": "tsc",
67
69
  "postbuild": "chmod +x dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.7.35",
3
+ "version": "0.7.37",
4
4
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
5
5
  "author": {
6
6
  "name": "Robert Owens",
@@ -4,12 +4,13 @@ description: Semantic code search. Use alongside grep - grep for exact strings,
4
4
  allowed-tools: "mcp__grepmax__semantic_search, mcp__grepmax__code_skeleton, mcp__grepmax__trace_calls, mcp__grepmax__list_symbols, mcp__grepmax__index_status, mcp__grepmax__summarize_directory, mcp__grepmax__summarize_project, mcp__grepmax__related_files, mcp__grepmax__recent_changes, Bash(gmax:*), Read"
5
5
  ---
6
6
 
7
- ## What gmax does
7
+ ## When to use what
8
8
 
9
- Semantic code search finds code by meaning, not just strings.
10
-
11
- - grep/ripgrep: exact string match
12
- - gmax: concept match ("where do we handle auth?", "how does booking flow work?")
9
+ - **Know the exact string/symbol?** `Grep` tool (fastest, zero overhead)
10
+ - **Know the file already?** → `Read` tool directly
11
+ - **Searching by concept/behavior?** `Bash(gmax "query" --agent)` (semantic search)
12
+ - **Need file structure?** → `Bash(gmax skeleton <path>)`
13
+ - **Need call flow?** → `Bash(gmax trace <symbol>)`
13
14
 
14
15
  ## IMPORTANT: Use CLI, not MCP tools
15
16
 
@@ -78,7 +79,7 @@ gmax doctor # health check
78
79
  ## Workflow
79
80
 
80
81
  1. **Explore** — `Bash(gmax project)` for overview of a new codebase
81
- 2. **Search** — `Bash(gmax "query" --plain)` to find code. Add `--symbol` for function/class names.
82
+ 2. **Search** — `Bash(gmax "query" --agent)` to find code. Add `--symbol` for function/class names.
82
83
  3. **Read** — `Read file:line` for specific ranges
83
84
  4. **Skeleton** — `Bash(gmax skeleton <path>)` before reading large files
84
85
  5. **Trace** — `Bash(gmax trace <symbol> -d 2)` for call flow
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Postinstall: sync plugin files (SKILL.md, hooks, plugin.json) to
4
+ * the Claude Code plugin cache if it exists. This ensures `npm update -g grepmax`
5
+ * automatically updates the skill instructions without needing `gmax install-claude-code`.
6
+ */
7
+ const fs = require("node:fs");
8
+ const path = require("node:path");
9
+ const os = require("node:os");
10
+
11
+ const pluginCacheBase = path.join(os.homedir(), ".claude", "plugins", "cache", "grepmax", "grepmax");
12
+ const sourcePlugin = path.join(__dirname, "..", "plugins", "grepmax");
13
+
14
+ if (!fs.existsSync(pluginCacheBase) || !fs.existsSync(sourcePlugin)) {
15
+ // Plugin not installed via Claude Code — skip silently
16
+ process.exit(0);
17
+ }
18
+
19
+ // Find installed version directories
20
+ let entries;
21
+ try {
22
+ entries = fs.readdirSync(pluginCacheBase, { withFileTypes: true });
23
+ } catch {
24
+ process.exit(0);
25
+ }
26
+
27
+ const versionDirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
28
+ if (versionDirs.length === 0) process.exit(0);
29
+
30
+ // Sync files to each installed version
31
+ function copyRecursive(src, dest) {
32
+ if (!fs.existsSync(src)) return;
33
+ const stat = fs.statSync(src);
34
+ if (stat.isDirectory()) {
35
+ fs.mkdirSync(dest, { recursive: true });
36
+ for (const entry of fs.readdirSync(src)) {
37
+ copyRecursive(path.join(src, entry), path.join(dest, entry));
38
+ }
39
+ } else {
40
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
41
+ fs.copyFileSync(src, dest);
42
+ }
43
+ }
44
+
45
+ for (const ver of versionDirs) {
46
+ const destDir = path.join(pluginCacheBase, ver);
47
+ try {
48
+ // Sync skills
49
+ copyRecursive(
50
+ path.join(sourcePlugin, "skills"),
51
+ path.join(destDir, "skills"),
52
+ );
53
+ // Sync hooks
54
+ copyRecursive(
55
+ path.join(sourcePlugin, "hooks"),
56
+ path.join(destDir, "hooks"),
57
+ );
58
+ // Sync hooks.json
59
+ const hooksJson = path.join(sourcePlugin, "hooks.json");
60
+ if (fs.existsSync(hooksJson)) {
61
+ fs.copyFileSync(hooksJson, path.join(destDir, "hooks.json"));
62
+ }
63
+ } catch {
64
+ // Best-effort — don't fail the install
65
+ }
66
+ }