@gkoreli/ghx 2.1.13 → 2.1.16

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/README.md +10 -4
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -72,7 +72,10 @@ ghx explore <owner/repo> <path> # Subdirectory listing
72
72
  ghx read <owner/repo> <f1> [f2] [f3] # Read 1-10 files (GraphQL batching)
73
73
  ghx read <owner/repo> <dir> # Directory path → returns file listing
74
74
  ghx read <owner/repo> "src/**/*.ts" --map # Glob patterns with structural map
75
- ghx read <owner/repo> --map <f1> [f2] # Signatures, imports, types (~92% token reduction)
75
+ ghx read <owner/repo> --map <f1> [f2] # Parser-backed structural map (~92% token reduction)
76
+ ghx read <owner/repo> --map --kind func <f> # Map only functions/methods
77
+ ghx read <owner/repo> --map --kind type <f> # Map only types/structs/interfaces
78
+ ghx read <owner/repo> --map --level minimal <f> # Symbol names only (e.g. UserService.GetUser)
76
79
  ghx read <owner/repo> --grep "pat" <f> # Matching lines only (ERE regex, 2 lines context)
77
80
  ghx read <owner/repo> --lines 42-80 <f> # Specific line range
78
81
  ghx search "<query>" # Code search with matching lines
@@ -135,15 +138,18 @@ Designed for eager context injection via spawn hooks — the agent always has th
135
138
 
136
139
  Wraps `gh` CLI with GraphQL batching. `repos` and `explore` batch search + metadata + README into 1 call. `read` uses GraphQL aliases to fetch up to 10 files in 1 call — and if a path is a directory, returns its file listing instead of "not found" (via `... on Tree` inline fragments in the same query, zero extra API calls). Glob patterns (`src/**/*.ts`) auto-expand via tree fetch + [doublestar](https://github.com/bmatcuk/doublestar) matching in 2 API calls. `--grep` uses ERE regex with BRE normalization (agents trained on `grep` write `\|` for alternation — both styles work). `search` hits REST `/search/code` with `text_matches` for matching context and 200-char token protection.
137
140
 
141
+ `--map` runs a dedicated parser engine on the fetched content — no extra API calls. Engine selection is automatic: **Go** uses `go/ast` (top-level declarations only, full multi-line signatures, generics preserved), **TypeScript, JavaScript, Python, Rust** use [gotreesitter](https://github.com/odvcencio/gotreesitter) (captures class/impl methods that regex cannot reach), everything else falls back to regex. Methods carry a parent reference (`UserService.GetUser`) visible at `--level minimal`. `--map-engine regex` forces the fallback for any file.
142
+
138
143
  Codemode runs JS in a [goja](https://github.com/nicholasgasior/goja) sandbox with esbuild TypeScript transpilation. Tools are injected as synchronous functions on a `codemode` global object. Max 20 tool calls per execution, 64KB code size limit.
139
144
 
140
145
  ## Architecture
141
146
 
142
147
  ```
143
148
  v2/
144
- ├── pkg/ghx/ core library (Explore, Read, Search, Repos, Tree, Glob)
145
- ├── pkg/codemode/ JS executor (goja sandbox, TS transpilation, type generation)
146
- └── cmd/ CLI frontend (cobra) + MCP server (mcp-go)
149
+ ├── internal/mapengine/ parser-backed map engine (GoAST, TreeSitter, Regex, engine routing)
150
+ ├── pkg/ghx/ core library (Explore, Read, Search, Repos, Tree, Glob)
151
+ ├── pkg/codemode/ JS executor (goja sandbox, TS transpilation, type generation)
152
+ └── cmd/ — CLI frontend (cobra) + MCP server (mcp-go)
147
153
  ```
148
154
 
149
155
  See [docs/adr/](docs/adr/) for architectural decisions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkoreli/ghx",
3
- "version": "2.1.13",
3
+ "version": "2.1.16",
4
4
  "description": "Agent-first GitHub code exploration. GraphQL batching, code maps, codemode TypeScript sandbox, MCP server.",
5
5
  "bin": {
6
6
  "ghx": "npm/bin/ghx"
@@ -27,11 +27,11 @@
27
27
  "node": ">=16"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@gkoreli/ghx-darwin-arm64": "2.1.13",
31
- "@gkoreli/ghx-darwin-x64": "2.1.13",
32
- "@gkoreli/ghx-linux-arm64": "2.1.13",
33
- "@gkoreli/ghx-linux-x64": "2.1.13",
34
- "@gkoreli/ghx-win32-arm64": "2.1.13",
35
- "@gkoreli/ghx-win32-x64": "2.1.13"
30
+ "@gkoreli/ghx-darwin-arm64": "2.1.16",
31
+ "@gkoreli/ghx-darwin-x64": "2.1.16",
32
+ "@gkoreli/ghx-linux-arm64": "2.1.16",
33
+ "@gkoreli/ghx-linux-x64": "2.1.16",
34
+ "@gkoreli/ghx-win32-arm64": "2.1.16",
35
+ "@gkoreli/ghx-win32-x64": "2.1.16"
36
36
  }
37
37
  }