grepmax 0.1.0 → 0.2.0
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/LICENSE +1 -1
- package/NOTICE +2 -2
- package/README.md +72 -72
- package/dist/commands/claude-code.js +6 -6
- package/dist/commands/codex.js +17 -17
- package/dist/commands/doctor.js +6 -5
- package/dist/commands/droid.js +22 -22
- package/dist/commands/index.js +1 -1
- package/dist/commands/list.js +82 -19
- package/dist/commands/mcp.js +161 -142
- package/dist/commands/opencode.js +26 -26
- package/dist/commands/search.js +23 -13
- package/dist/commands/serve.js +30 -30
- package/dist/commands/setup.js +51 -40
- package/dist/commands/skeleton.js +19 -13
- package/dist/commands/symbols.js +40 -2
- package/dist/commands/verify.js +1 -1
- package/dist/commands/watch.js +206 -0
- package/dist/config.js +37 -7
- package/dist/eval.js +14 -14
- package/dist/index.js +11 -7
- package/dist/lib/core/languages.js +28 -0
- package/dist/lib/index/chunker.js +6 -3
- package/dist/lib/index/grammar-loader.js +2 -2
- package/dist/lib/index/ignore-patterns.js +1 -1
- package/dist/lib/index/index-config.js +50 -10
- package/dist/lib/index/sync-helpers.js +1 -1
- package/dist/lib/index/syncer.js +67 -45
- package/dist/lib/index/walker.js +3 -3
- package/dist/lib/index/watcher.js +4 -4
- package/dist/lib/output/formatter.js +1 -1
- package/dist/lib/search/searcher.js +9 -9
- package/dist/lib/setup/model-loader.js +3 -3
- package/dist/lib/setup/setup-helpers.js +2 -4
- package/dist/lib/skeleton/body-fields.js +20 -0
- package/dist/lib/skeleton/retriever.js +1 -1
- package/dist/lib/skeleton/skeletonizer.js +8 -2
- package/dist/lib/skeleton/summary-formatter.js +1 -4
- package/dist/lib/store/meta-cache.js +28 -3
- package/dist/lib/store/vector-db.js +17 -9
- package/dist/lib/utils/formatter.js +3 -3
- package/dist/lib/utils/lock.js +1 -1
- package/dist/lib/utils/project-registry.js +83 -0
- package/dist/lib/utils/project-root.js +32 -57
- package/dist/lib/utils/watcher-registry.js +100 -0
- package/dist/lib/workers/colbert-math.js +2 -2
- package/dist/lib/workers/download-worker.js +2 -2
- package/dist/lib/workers/embeddings/colbert.js +2 -2
- package/dist/lib/workers/embeddings/granite.js +4 -4
- package/dist/lib/workers/embeddings/mlx-client.js +1 -1
- package/dist/lib/workers/orchestrator.js +8 -8
- package/dist/lib/workers/pool.js +1 -1
- package/dist/lib/workers/worker.js +4 -1
- package/package.json +20 -21
- package/plugins/{osgrep → grepmax}/.claude-plugin/plugin.json +4 -4
- package/plugins/grepmax/hooks/start.js +63 -0
- package/plugins/grepmax/hooks/stop.js +3 -0
- package/plugins/{osgrep/skills/osgrep → grepmax/skills/gmax}/SKILL.md +11 -11
- package/plugins/osgrep/hooks/start.js +0 -90
- package/plugins/osgrep/hooks/stop.js +0 -3
- /package/plugins/{osgrep → grepmax}/hooks.json +0 -0
package/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
189
|
Copyright 2025 Mixedbread AI (original mgrep work)
|
|
190
|
-
Copyright 2025 Robert Owens (
|
|
190
|
+
Copyright 2025 Robert Owens (grepmax modifications and enhancements)
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/NOTICE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
grepmax
|
|
2
2
|
Copyright 2025 Ryan Donofrio
|
|
3
3
|
|
|
4
4
|
This product includes software originally developed by MixedBread as mgrep.
|
|
@@ -9,7 +9,7 @@ https://github.com/mixedbread-ai/mgrep
|
|
|
9
9
|
|
|
10
10
|
MODIFICATIONS AND ENHANCEMENTS
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
grepmax is a substantial modification and enhancement of the original mgrep
|
|
13
13
|
codebase. The following major changes and additions have been made by
|
|
14
14
|
Ryan Donofrio:
|
|
15
15
|
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Natural-language search that works like `grep`. Fast, local, and built for codin
|
|
|
36
36
|
2. **Setup (Recommended)**
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
|
|
39
|
+
gmax setup
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Downloads embedding models (~150MB) upfront and lets you choose between CPU (ONNX) and GPU (MLX) embedding modes. If you skip this, models download automatically on first use.
|
|
@@ -45,61 +45,61 @@ Natural-language search that works like `grep`. Fast, local, and built for codin
|
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
47
|
cd my-repo
|
|
48
|
-
|
|
48
|
+
gmax "where do we handle authentication?"
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
**Your first search will automatically index the repository.** Each repository is automatically isolated with its own index. Switching between repos "just works" — no manual configuration needed. If the background server is running (`
|
|
51
|
+
**Your first search will automatically index the repository.** Each repository is automatically isolated with its own index. Switching between repos "just works" — no manual configuration needed. If the background server is running (`gmax serve`), search goes through the hot daemon; otherwise it falls back to on-demand indexing.
|
|
52
52
|
|
|
53
53
|
4. **Trace** (Call Graph)
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
|
|
56
|
+
gmax trace "function_name"
|
|
57
57
|
```
|
|
58
58
|
See who calls a function (upstream dependencies) and what it calls (downstream dependencies). Perfect for impact analysis and understanding code flow.
|
|
59
59
|
|
|
60
60
|
To find the symbols in your code base:
|
|
61
61
|
```bash
|
|
62
|
-
|
|
62
|
+
gmax symbols
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
In our public benchmarks, `grepmax` can save about 20% of your LLM tokens and deliver a 30% speedup.
|
|
66
66
|
|
|
67
67
|
<div align="center">
|
|
68
|
-
<img src="public/bench.png" alt="
|
|
68
|
+
<img src="public/bench.png" alt="gmax benchmark" width="100%" style="border-radius: 8px; margin: 20px 0;" />
|
|
69
69
|
</div>
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
### Claude Code Plugin
|
|
74
74
|
|
|
75
|
-
1. Run `
|
|
75
|
+
1. Run `gmax install-claude-code`
|
|
76
76
|
2. Open Claude Code (`claude`) and ask it questions about your codebase.
|
|
77
77
|
3. Highly recommend indexing your code base before using the plugin.
|
|
78
|
-
4. The plugin's hooks auto-start `
|
|
78
|
+
4. The plugin's hooks auto-start `gmax serve` in the background and shut it down on session end. Claude will use `gmax` for semantic searches automatically but can be encouraged to do so.
|
|
79
79
|
|
|
80
80
|
### Opencode Plugin
|
|
81
|
-
1. Run `
|
|
81
|
+
1. Run `gmax install-opencode`
|
|
82
82
|
2. Open OC (`opencode`) and ask it questions about your codebase.
|
|
83
83
|
3. Highly recommend indexing your code base before using the plugin.
|
|
84
|
-
4. The plugin's hooks auto-start `
|
|
84
|
+
4. The plugin's hooks auto-start `gmax serve` in the background and shut it down on session end. OC will use `gmax` for semantic searches automatically but can be encouraged to do so.
|
|
85
85
|
|
|
86
86
|
### Codex Plugin
|
|
87
|
-
1. Run `
|
|
88
|
-
2. Codex will use `
|
|
87
|
+
1. Run `gmax install-codex`
|
|
88
|
+
2. Codex will use `gmax` for semantic searches.
|
|
89
89
|
|
|
90
90
|
### Factory Droid Plugin
|
|
91
|
-
1. Run `
|
|
92
|
-
2. To remove: `
|
|
91
|
+
1. Run `gmax install-droid`
|
|
92
|
+
2. To remove: `gmax uninstall-droid`
|
|
93
93
|
|
|
94
94
|
### MCP Server
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
gmax exposes tools via the [Model Context Protocol](https://modelcontextprotocol.io/) for any MCP-compatible AI agent or editor.
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
|
|
99
|
+
gmax mcp
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
This starts a stdio-based MCP server that auto-launches the `
|
|
102
|
+
This starts a stdio-based MCP server that auto-launches the `gmax serve` daemon. Available tools:
|
|
103
103
|
|
|
104
104
|
| Tool | Description |
|
|
105
105
|
| --- | --- |
|
|
@@ -112,12 +112,12 @@ This starts a stdio-based MCP server that auto-launches the `osgrep serve` daemo
|
|
|
112
112
|
|
|
113
113
|
## Commands
|
|
114
114
|
|
|
115
|
-
### `
|
|
115
|
+
### `gmax search`
|
|
116
116
|
|
|
117
117
|
The default command. Searches the current directory using semantic meaning.
|
|
118
118
|
|
|
119
119
|
```bash
|
|
120
|
-
|
|
120
|
+
gmax "how is the database connection pooled?"
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
**Options:**
|
|
@@ -139,26 +139,26 @@ osgrep "how is the database connection pooled?"
|
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
141
|
# General concept search
|
|
142
|
-
|
|
142
|
+
gmax "API rate limiting logic"
|
|
143
143
|
|
|
144
144
|
# Deep dive (show more matches per file)
|
|
145
|
-
|
|
145
|
+
gmax "error handling" --per-file 5
|
|
146
146
|
|
|
147
147
|
# Just give me the files
|
|
148
|
-
|
|
148
|
+
gmax "user validation" --compact
|
|
149
149
|
|
|
150
150
|
# Show relevance scores and filter low-confidence matches
|
|
151
|
-
|
|
151
|
+
gmax "authentication" --scores --min-score 0.5
|
|
152
152
|
|
|
153
153
|
# Show skeletons of matching files
|
|
154
|
-
|
|
154
|
+
gmax "database connection" --skeleton
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
### `
|
|
157
|
+
### `gmax index`
|
|
158
158
|
|
|
159
159
|
Manually indexes the repository. Useful if you want to pre-warm the cache or if you've made massive changes outside of the editor.
|
|
160
160
|
|
|
161
|
-
- Respects `.gitignore` and `.
|
|
161
|
+
- Respects `.gitignore` and `.gmaxignore` (see [Configuration](#ignoring-files) section).
|
|
162
162
|
- **Smart Indexing:** Only embeds code and config files. Skips binaries, lockfiles, and minified assets.
|
|
163
163
|
- **Bounded Concurrency:** Uses a fixed thread pool to keep your system responsive.
|
|
164
164
|
- **Semantic Chunking:** Uses TreeSitter grammars for supported languages (TypeScript, JavaScript, Python, Go, Rust, C/C++, Java, C#, Ruby, PHP, Swift, Kotlin, JSON).
|
|
@@ -175,13 +175,13 @@ Manually indexes the repository. Useful if you want to pre-warm the cache or if
|
|
|
175
175
|
**Examples:**
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
gmax index # Index current dir
|
|
179
|
+
gmax index --dry-run # See what would be indexed
|
|
180
|
+
gmax index --verbose # Watch detailed progress (useful for debugging)
|
|
181
|
+
gmax index --reset # Full re-index from scratch
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
### `
|
|
184
|
+
### `gmax serve`
|
|
185
185
|
|
|
186
186
|
Runs a lightweight HTTP server with live file watching so searches stay hot in RAM.
|
|
187
187
|
|
|
@@ -204,57 +204,57 @@ Runs a lightweight HTTP server with live file watching so searches stay hot in R
|
|
|
204
204
|
|
|
205
205
|
**Port Selection (priority order):**
|
|
206
206
|
1. Explicit `-p <port>` flag
|
|
207
|
-
2. `
|
|
207
|
+
2. `GMAX_PORT` environment variable
|
|
208
208
|
3. Default `4444` (auto-increments if in use)
|
|
209
209
|
|
|
210
210
|
**Usage:**
|
|
211
211
|
|
|
212
212
|
```bash
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
gmax serve # Foreground, port 4444 (or next available)
|
|
214
|
+
gmax serve --background # Background mode, auto port
|
|
215
|
+
gmax serve -b -p 5000 # Background on specific port
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
**Subcommands:**
|
|
219
219
|
|
|
220
220
|
```bash
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
gmax serve status # Show server status for current directory
|
|
222
|
+
gmax serve stop # Stop server in current directory
|
|
223
|
+
gmax serve stop --all # Stop all running gmax servers
|
|
224
224
|
```
|
|
225
225
|
|
|
226
226
|
**Example workflow:**
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
229
|
# Start servers in multiple projects
|
|
230
|
-
cd ~/project-a &&
|
|
231
|
-
cd ~/project-b &&
|
|
230
|
+
cd ~/project-a && gmax serve -b # Starts on port 4444
|
|
231
|
+
cd ~/project-b && gmax serve -b # Starts on port 4445 (auto-increment)
|
|
232
232
|
|
|
233
233
|
# Check status
|
|
234
|
-
|
|
234
|
+
gmax serve status
|
|
235
235
|
|
|
236
236
|
# Stop all when done
|
|
237
|
-
|
|
237
|
+
gmax serve stop --all
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
Claude Code hooks start/stop this automatically; you rarely need to run it manually.
|
|
241
241
|
|
|
242
|
-
### `
|
|
242
|
+
### `gmax list`
|
|
243
243
|
|
|
244
244
|
Lists all indexed repositories (stores) and their metadata.
|
|
245
245
|
|
|
246
246
|
```bash
|
|
247
|
-
|
|
247
|
+
gmax list
|
|
248
248
|
```
|
|
249
249
|
|
|
250
250
|
Shows store names, sizes, and last modified times. Useful for seeing what's indexed and cleaning up old stores.
|
|
251
251
|
|
|
252
|
-
### `
|
|
252
|
+
### `gmax skeleton`
|
|
253
253
|
|
|
254
254
|
Generates a compressed "skeleton" of a file, showing only signatures, types, and class structures while eliding function bodies.
|
|
255
255
|
|
|
256
256
|
```bash
|
|
257
|
-
|
|
257
|
+
gmax skeleton src/lib/auth.ts
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
**Output:**
|
|
@@ -267,25 +267,25 @@ class AuthService {
|
|
|
267
267
|
```
|
|
268
268
|
|
|
269
269
|
**Modes:**
|
|
270
|
-
- `
|
|
271
|
-
- `
|
|
272
|
-
- `
|
|
270
|
+
- `gmax skeleton <file>`: Skeletonize specific file.
|
|
271
|
+
- `gmax skeleton <Symbol>`: Find symbol in index and skeletonize its file.
|
|
272
|
+
- `gmax skeleton "query"`: Search for query and skeletonize top matches.
|
|
273
273
|
|
|
274
274
|
**Supported Languages:**
|
|
275
275
|
TypeScript, JavaScript, Python, Go, Rust, Java, C#, C++, C, Ruby, PHP, Swift, Kotlin.
|
|
276
276
|
|
|
277
277
|
|
|
278
|
-
### `
|
|
278
|
+
### `gmax doctor`
|
|
279
279
|
|
|
280
280
|
Checks installation health, model paths, and database integrity.
|
|
281
281
|
|
|
282
282
|
```bash
|
|
283
|
-
|
|
283
|
+
gmax doctor
|
|
284
284
|
```
|
|
285
285
|
|
|
286
286
|
## Performance & Architecture
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
gmax is designed to be a "good citizen" on your machine:
|
|
289
289
|
|
|
290
290
|
1. **Bounded Concurrency:** Chunking/embedding stay within small thread pools (1–4) and capped batch sizes to keep laptops responsive.
|
|
291
291
|
2. **Smart Chunking:** Uses `tree-sitter` to split code by function/class boundaries, ensuring embeddings capture complete logical blocks.
|
|
@@ -300,7 +300,7 @@ osgrep is designed to be a "good citizen" on your machine:
|
|
|
300
300
|
|
|
301
301
|
### Automatic Repository Isolation
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
gmax automatically creates a unique index for each repository based on:
|
|
304
304
|
|
|
305
305
|
1. **Git Remote URL** (e.g., `github.com/facebook/react` → `facebook-react`)
|
|
306
306
|
2. **Git Repo without Remote** → directory name + hash (e.g., `utils-7f8a2b3c`)
|
|
@@ -309,19 +309,19 @@ osgrep automatically creates a unique index for each repository based on:
|
|
|
309
309
|
**Examples:**
|
|
310
310
|
```bash
|
|
311
311
|
cd ~/work/myproject # Auto-detected: owner-myproject
|
|
312
|
-
|
|
312
|
+
gmax "API handlers"
|
|
313
313
|
|
|
314
314
|
cd ~/personal/utils # Auto-detected: utils-abc12345
|
|
315
|
-
|
|
315
|
+
gmax "helper functions"
|
|
316
316
|
```
|
|
317
317
|
|
|
318
318
|
Stores are isolated automatically — no manual `--store` flags needed!
|
|
319
319
|
|
|
320
320
|
### Ignoring Files
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
gmax respects both `.gitignore` and `.gmaxignore` files when indexing. Create a `.gmaxignore` file in your repository root to exclude additional files or patterns from indexing.
|
|
323
323
|
|
|
324
|
-
**`.
|
|
324
|
+
**`.gmaxignore` syntax:**
|
|
325
325
|
- Uses the same pattern syntax as `.gitignore`
|
|
326
326
|
- Patterns are relative to the repository root
|
|
327
327
|
- Supports glob patterns, negation (`!`), and directory patterns (`/`)
|
|
@@ -329,20 +329,20 @@ osgrep respects both `.gitignore` and `.osgrepignore` files when indexing. Creat
|
|
|
329
329
|
|
|
330
330
|
### Index Management
|
|
331
331
|
|
|
332
|
-
- **View indexed projects:** `
|
|
333
|
-
- **Index location:** `.
|
|
334
|
-
- **Clean up a project index:** `rm -rf .
|
|
335
|
-
- **Global data (models, grammars):** `~/.
|
|
332
|
+
- **View indexed projects:** `gmax list`
|
|
333
|
+
- **Index location:** `.gmax/` in each project root
|
|
334
|
+
- **Clean up a project index:** `rm -rf .gmax/` in the project directory
|
|
335
|
+
- **Global data (models, grammars):** `~/.gmax/`
|
|
336
336
|
|
|
337
337
|
### GPU Embeddings (Apple Silicon)
|
|
338
338
|
|
|
339
|
-
On Macs with Apple Silicon,
|
|
339
|
+
On Macs with Apple Silicon, gmax can use MLX for GPU-accelerated embeddings instead of ONNX on CPU.
|
|
340
340
|
|
|
341
|
-
1. Run `
|
|
342
|
-
2. Start the server: `
|
|
343
|
-
3. To force CPU mode on a GPU-configured project: `
|
|
341
|
+
1. Run `gmax setup` and select **GPU (MLX)** when prompted.
|
|
342
|
+
2. Start the server: `gmax serve` (automatically starts the MLX embed server).
|
|
343
|
+
3. To force CPU mode on a GPU-configured project: `gmax serve --cpu`.
|
|
344
344
|
|
|
345
|
-
The MLX embed server runs on port `8100` by default (configurable via `MLX_EMBED_PORT`). It is managed automatically by `
|
|
345
|
+
The MLX embed server runs on port `8100` by default (configurable via `MLX_EMBED_PORT`). It is managed automatically by `gmax serve` — you don't need to start it manually.
|
|
346
346
|
|
|
347
347
|
## Development
|
|
348
348
|
|
|
@@ -355,15 +355,15 @@ pnpm format # biome check
|
|
|
355
355
|
|
|
356
356
|
## Troubleshooting
|
|
357
357
|
|
|
358
|
-
- **Index feels stale?** Run `
|
|
359
|
-
- **Weird results?** Run `
|
|
360
|
-
- **Index getting stuck?** Run `
|
|
361
|
-
- **Need a fresh start?** Delete `.
|
|
362
|
-
- **MLX server won't start?** Check `/tmp/mlx-embed-server.log` for errors. Use `
|
|
358
|
+
- **Index feels stale?** Run `gmax index` to refresh, or use `gmax serve` for live reindexing.
|
|
359
|
+
- **Weird results?** Run `gmax doctor` to verify models.
|
|
360
|
+
- **Index getting stuck?** Run `gmax index --verbose` to see which file is being processed.
|
|
361
|
+
- **Need a fresh start?** Delete `.gmax/` in your project root and run `gmax index`.
|
|
362
|
+
- **MLX server won't start?** Check `/tmp/mlx-embed-server.log` for errors. Use `gmax serve --cpu` to fall back to CPU.
|
|
363
363
|
|
|
364
364
|
## Attribution
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
gmax is built upon the foundation of [mgrep](https://github.com/mixedbread-ai/mgrep) by MixedBread. We acknowledge and appreciate the original architectural concepts and design decisions that informed this work.
|
|
367
367
|
|
|
368
368
|
|
|
369
369
|
See the [NOTICE](NOTICE) file for detailed attribution information.
|
|
@@ -32,15 +32,15 @@ function runClaudeCommand(args) {
|
|
|
32
32
|
function installPlugin() {
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
try {
|
|
35
|
-
yield runClaudeCommand(["marketplace", "add", "reowens/
|
|
36
|
-
console.log("✅ Successfully added the
|
|
37
|
-
yield runClaudeCommand(["install", "
|
|
38
|
-
console.log("✅ Successfully installed the
|
|
35
|
+
yield runClaudeCommand(["marketplace", "add", "reowens/grepmax"]);
|
|
36
|
+
console.log("✅ Successfully added the gmax marketplace");
|
|
37
|
+
yield runClaudeCommand(["install", "grepmax"]);
|
|
38
|
+
console.log("✅ Successfully installed the gmax plugin for Claude Code");
|
|
39
39
|
console.log("\nNext steps:");
|
|
40
40
|
console.log("1. Restart Claude Code if it's running");
|
|
41
41
|
console.log("2. The plugin will automatically index your project when you open it");
|
|
42
|
-
console.log("3. Claude will use
|
|
43
|
-
console.log("4. You can also use `
|
|
42
|
+
console.log("3. Claude will use gmax for semantic code search automatically");
|
|
43
|
+
console.log("4. You can also use `gmax` commands directly in your terminal");
|
|
44
44
|
}
|
|
45
45
|
catch (error) {
|
|
46
46
|
console.error("❌ Error installing plugin:");
|
package/dist/commands/codex.js
CHANGED
|
@@ -23,8 +23,8 @@ const shell = process.env.SHELL || (process.platform === "win32" ? "cmd.exe" : "
|
|
|
23
23
|
const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
24
24
|
const SKILL = `
|
|
25
25
|
---
|
|
26
|
-
name:
|
|
27
|
-
description: Semantic code search and call-graph tracing via
|
|
26
|
+
name: gmax
|
|
27
|
+
description: Semantic code search and call-graph tracing via gmax.
|
|
28
28
|
---
|
|
29
29
|
|
|
30
30
|
## ⚠️ CRITICAL: Handling "Indexing" State
|
|
@@ -34,19 +34,19 @@ If the tool output says **"Indexing"**, **"Building"**, or **"Syncing"**:
|
|
|
34
34
|
3. **ASK** if they want to proceed or wait.
|
|
35
35
|
|
|
36
36
|
## Commands
|
|
37
|
-
- Search: \`
|
|
38
|
-
- Trace: \`
|
|
37
|
+
- Search: \`gmax "auth logic" --compact\`
|
|
38
|
+
- Trace: \`gmax trace "AuthService"\`
|
|
39
39
|
`;
|
|
40
40
|
function installPlugin() {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
try {
|
|
43
43
|
// 1. Register the MCP Tool
|
|
44
|
-
// '
|
|
45
|
-
yield execAsync("codex mcp add
|
|
44
|
+
// 'gmax mcp' acts as the server.
|
|
45
|
+
yield execAsync("codex mcp add gmax gmax mcp", {
|
|
46
46
|
shell,
|
|
47
47
|
env: process.env,
|
|
48
48
|
});
|
|
49
|
-
console.log("✅
|
|
49
|
+
console.log("✅ gmax MCP tool registered with Codex");
|
|
50
50
|
// 2. Add Instructions to AGENTS.md
|
|
51
51
|
const destPath = node_path_1.default.join(node_os_1.default.homedir(), ".codex", "AGENTS.md");
|
|
52
52
|
node_fs_1.default.mkdirSync(node_path_1.default.dirname(destPath), { recursive: true });
|
|
@@ -54,12 +54,12 @@ function installPlugin() {
|
|
|
54
54
|
? node_fs_1.default.readFileSync(destPath, "utf-8")
|
|
55
55
|
: "";
|
|
56
56
|
// Only append if not present
|
|
57
|
-
if (!content.includes("name:
|
|
58
|
-
node_fs_1.default.appendFileSync(destPath,
|
|
59
|
-
console.log("✅
|
|
57
|
+
if (!content.includes("name: gmax")) {
|
|
58
|
+
node_fs_1.default.appendFileSync(destPath, `\n${SKILL}`);
|
|
59
|
+
console.log("✅ gmax skill instructions added to Codex");
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
console.log("ℹ️
|
|
62
|
+
console.log("ℹ️ gmax skill instructions already present");
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
|
@@ -71,10 +71,10 @@ function installPlugin() {
|
|
|
71
71
|
function uninstallPlugin() {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
try {
|
|
74
|
-
yield execAsync("codex mcp remove
|
|
75
|
-
console.log("✅
|
|
74
|
+
yield execAsync("codex mcp remove gmax", { shell, env: process.env });
|
|
75
|
+
console.log("✅ gmax MCP tool removed");
|
|
76
76
|
}
|
|
77
|
-
catch (
|
|
77
|
+
catch (_e) {
|
|
78
78
|
/* ignore if not found */
|
|
79
79
|
}
|
|
80
80
|
const destPath = node_path_1.default.join(node_os_1.default.homedir(), ".codex", "AGENTS.md");
|
|
@@ -85,14 +85,14 @@ function uninstallPlugin() {
|
|
|
85
85
|
if (content.includes(SKILL)) {
|
|
86
86
|
content = content.replace(SKILL, "").trim();
|
|
87
87
|
node_fs_1.default.writeFileSync(destPath, content);
|
|
88
|
-
console.log("✅
|
|
88
|
+
console.log("✅ gmax instructions removed from AGENTS.md");
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
exports.installCodex = new commander_1.Command("install-codex")
|
|
94
|
-
.description("Install
|
|
94
|
+
.description("Install gmax for Codex")
|
|
95
95
|
.action(installPlugin);
|
|
96
96
|
exports.uninstallCodex = new commander_1.Command("uninstall-codex")
|
|
97
|
-
.description("Uninstall
|
|
97
|
+
.description("Uninstall gmax from Codex")
|
|
98
98
|
.action(uninstallPlugin);
|
package/dist/commands/doctor.js
CHANGED
|
@@ -51,9 +51,9 @@ const config_1 = require("../config");
|
|
|
51
51
|
const exit_1 = require("../lib/utils/exit");
|
|
52
52
|
const project_root_1 = require("../lib/utils/project-root");
|
|
53
53
|
exports.doctor = new commander_1.Command("doctor")
|
|
54
|
-
.description("Check
|
|
54
|
+
.description("Check gmax health and paths")
|
|
55
55
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
console.log("🏥
|
|
56
|
+
console.log("🏥 gmax Doctor\n");
|
|
57
57
|
const root = config_1.PATHS.globalRoot;
|
|
58
58
|
const models = config_1.PATHS.models;
|
|
59
59
|
const grammars = config_1.PATHS.grammars;
|
|
@@ -76,15 +76,16 @@ exports.doctor = new commander_1.Command("doctor")
|
|
|
76
76
|
});
|
|
77
77
|
const missingModels = modelStatuses.filter(({ exists }) => !exists);
|
|
78
78
|
if (missingModels.length > 0) {
|
|
79
|
-
console.log("❌ Some models are missing;
|
|
79
|
+
console.log("❌ Some models are missing; gmax will try bundled copies first, then download.");
|
|
80
80
|
}
|
|
81
81
|
console.log(`\nLocal Project: ${process.cwd()}`);
|
|
82
82
|
const projectRoot = (0, project_root_1.findProjectRoot)(process.cwd());
|
|
83
83
|
if (projectRoot) {
|
|
84
|
-
console.log(`✅
|
|
84
|
+
console.log(`✅ Project root: ${projectRoot}`);
|
|
85
|
+
console.log(` Centralized index at: ~/.gmax/lancedb/`);
|
|
85
86
|
}
|
|
86
87
|
else {
|
|
87
|
-
console.log(`ℹ️ No index found in current directory (run '
|
|
88
|
+
console.log(`ℹ️ No index found in current directory (run 'gmax index' to create one)`);
|
|
88
89
|
}
|
|
89
90
|
console.log(`\nSystem: ${os.platform()} ${os.arch()} | Node: ${process.version}`);
|
|
90
91
|
console.log("\nIf you see ✅ everywhere, you are ready to search!");
|
package/dist/commands/droid.js
CHANGED
|
@@ -19,23 +19,23 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
19
19
|
const commander_1 = require("commander");
|
|
20
20
|
const SKILL = `
|
|
21
21
|
---
|
|
22
|
-
name:
|
|
22
|
+
name: gmax
|
|
23
23
|
description: Semantic code search and call-graph tracing for AI agents. Finds code by concept, surfaces roles (ORCHESTRATION vs DEFINITION), and traces dependencies.
|
|
24
|
-
allowed-tools: "Bash(
|
|
24
|
+
allowed-tools: "Bash(gmax:*), Read"
|
|
25
25
|
license: Apache-2.0
|
|
26
26
|
---
|
|
27
27
|
|
|
28
28
|
## ⚠️ CRITICAL: Handling "Indexing" State
|
|
29
|
-
If any \`
|
|
29
|
+
If any \`gmax\` command returns a status indicating **"Indexing"**, **"Building"**, or **"Syncing"**:
|
|
30
30
|
1. **STOP** your current train of thought.
|
|
31
31
|
2. **INFORM** the user: "The semantic index is currently building. Search results will be incomplete."
|
|
32
32
|
3. **ASK**: "Do you want me to proceed with partial results, or wait for indexing to finish?"
|
|
33
33
|
*(Do not assume you should proceed without confirmation).*
|
|
34
34
|
|
|
35
35
|
## Core Commands
|
|
36
|
-
- Search: \`
|
|
37
|
-
- Trace: \`
|
|
38
|
-
- Symbols: \`
|
|
36
|
+
- Search: \`gmax "how does auth work" --compact\`
|
|
37
|
+
- Trace: \`gmax trace "AuthService"\`
|
|
38
|
+
- Symbols: \`gmax symbols "Auth"\`
|
|
39
39
|
|
|
40
40
|
## Output (Default = Compact TSV)
|
|
41
41
|
- One line per hit: \`path\\tlines\\tscore\\trole\\tconf\\tdefined\\tpreview\`
|
|
@@ -46,17 +46,17 @@ If any \`osgrep\` command returns a status indicating **"Indexing"**, **"Buildin
|
|
|
46
46
|
|
|
47
47
|
1. **Discover**
|
|
48
48
|
\`\`\`bash
|
|
49
|
-
|
|
49
|
+
gmax "worker pool lifecycle" --compact
|
|
50
50
|
\`\`\`
|
|
51
51
|
|
|
52
52
|
2. **Explore**
|
|
53
53
|
\`\`\`bash
|
|
54
|
-
|
|
54
|
+
gmax symbols Worker
|
|
55
55
|
\`\`\`
|
|
56
56
|
|
|
57
57
|
3. **Trace**
|
|
58
58
|
\`\`\`bash
|
|
59
|
-
|
|
59
|
+
gmax trace WorkerPool
|
|
60
60
|
\`\`\`
|
|
61
61
|
|
|
62
62
|
4. **Read**
|
|
@@ -119,24 +119,24 @@ function mergeHooks(existing, incoming) {
|
|
|
119
119
|
function installPlugin() {
|
|
120
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
121
|
const root = resolveDroidRoot();
|
|
122
|
-
const hooksDir = node_path_1.default.join(root, "hooks", "
|
|
123
|
-
const skillsDir = node_path_1.default.join(root, "skills", "
|
|
122
|
+
const hooksDir = node_path_1.default.join(root, "hooks", "gmax");
|
|
123
|
+
const skillsDir = node_path_1.default.join(root, "skills", "gmax");
|
|
124
124
|
const settingsPath = node_path_1.default.join(root, "settings.json");
|
|
125
125
|
// 1. Install Hook Scripts (Start/Stop Daemon)
|
|
126
126
|
// We expect these files to exist in your dist/hooks folder
|
|
127
|
-
const startJsPath = node_path_1.default.join(hooksDir, "
|
|
128
|
-
const stopJsPath = node_path_1.default.join(hooksDir, "
|
|
127
|
+
const startJsPath = node_path_1.default.join(hooksDir, "gmax_start.js");
|
|
128
|
+
const stopJsPath = node_path_1.default.join(hooksDir, "gmax_stop.js");
|
|
129
129
|
// Create these scripts dynamically if we don't want to read from dist
|
|
130
130
|
const startScript = `
|
|
131
131
|
const { spawn } = require("child_process");
|
|
132
132
|
const fs = require("fs");
|
|
133
|
-
const out = fs.openSync("/tmp/
|
|
134
|
-
const child = spawn("
|
|
133
|
+
const out = fs.openSync("/tmp/gmax.log", "a");
|
|
134
|
+
const child = spawn("gmax", ["serve"], { detached: true, stdio: ["ignore", out, out] });
|
|
135
135
|
child.unref();
|
|
136
136
|
`;
|
|
137
137
|
const stopScript = `
|
|
138
138
|
const { spawnSync, execSync } = require("child_process");
|
|
139
|
-
try { execSync("pkill -f '
|
|
139
|
+
try { execSync("pkill -f 'gmax serve'"); } catch {}
|
|
140
140
|
`;
|
|
141
141
|
writeFileIfChanged(startJsPath, startScript.trim());
|
|
142
142
|
writeFileIfChanged(stopJsPath, stopScript.trim());
|
|
@@ -165,25 +165,25 @@ try { execSync("pkill -f 'osgrep serve'"); } catch {}
|
|
|
165
165
|
settings.allowBackgroundProcesses = true;
|
|
166
166
|
settings.hooks = mergeHooks(settings.hooks, hookConfig);
|
|
167
167
|
saveSettings(settingsPath, settings);
|
|
168
|
-
console.log(`✅
|
|
168
|
+
console.log(`✅ gmax installed for Factory Droid (Hooks + Skill)`);
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
function uninstallPlugin() {
|
|
172
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
173
173
|
const root = resolveDroidRoot();
|
|
174
|
-
const hooksDir = node_path_1.default.join(root, "hooks", "
|
|
175
|
-
const skillsDir = node_path_1.default.join(root, "skills", "
|
|
174
|
+
const hooksDir = node_path_1.default.join(root, "hooks", "gmax");
|
|
175
|
+
const skillsDir = node_path_1.default.join(root, "skills", "gmax");
|
|
176
176
|
if (node_fs_1.default.existsSync(hooksDir))
|
|
177
177
|
node_fs_1.default.rmSync(hooksDir, { recursive: true, force: true });
|
|
178
178
|
if (node_fs_1.default.existsSync(skillsDir))
|
|
179
179
|
node_fs_1.default.rmSync(skillsDir, { recursive: true, force: true });
|
|
180
|
-
console.log("✅
|
|
180
|
+
console.log("✅ gmax removed from Factory Droid");
|
|
181
181
|
console.log("NOTE: You may want to manually clean up 'hooks' in ~/.factory/settings.json");
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
exports.installDroid = new commander_1.Command("install-droid")
|
|
185
|
-
.description("Install
|
|
185
|
+
.description("Install gmax for Factory Droid")
|
|
186
186
|
.action(installPlugin);
|
|
187
187
|
exports.uninstallDroid = new commander_1.Command("uninstall-droid")
|
|
188
|
-
.description("Uninstall
|
|
188
|
+
.description("Uninstall gmax from Factory Droid")
|
|
189
189
|
.action(uninstallPlugin);
|
package/dist/commands/index.js
CHANGED
|
@@ -71,7 +71,7 @@ exports.index = new commander_1.Command("index")
|
|
|
71
71
|
const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
|
|
72
72
|
vectorDb = new vector_db_1.VectorDB(paths.lancedbDir);
|
|
73
73
|
if (options.reset) {
|
|
74
|
-
console.log(`Resetting index at ${paths.
|
|
74
|
+
console.log(`Resetting index at ${paths.dataDir}...`);
|
|
75
75
|
// We do NOT manually drop/rm here anymore to avoid race conditions.
|
|
76
76
|
// The syncer handles it inside the lock.
|
|
77
77
|
}
|