@gkoreli/ghx 2.1.12 → 2.1.13
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 +19 -4
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -4,9 +4,23 @@ One command does what takes 3-5 API calls. Batch file reads, code maps, search
|
|
|
4
4
|
|
|
5
5
|
## Why
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
An agent wants to understand `packages/shadcn/src/utils/` in [shadcn-ui/ui](https://github.com/shadcn-ui/ui):
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
**With `gh` CLI** — 4 turns, 4 API calls, reads 3 full files (3,761 tokens), sees 3 of 34 files:
|
|
10
|
+
```
|
|
11
|
+
gh api /repos/shadcn-ui/ui/contents/packages/shadcn/src/utils → JSON with shas, urls, links (480 tokens for a file list)
|
|
12
|
+
gh api /repos/.../get-config.ts --jq '.content' | base64 -d → full file (1,981 tokens — agent only needed exports)
|
|
13
|
+
gh api /repos/.../registries.ts --jq '.content' | base64 -d → full file (676 tokens)
|
|
14
|
+
gh api /repos/.../frameworks.ts --jq '.content' | base64 -d → full file (624 tokens)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**With ghx** — 2 turns, 2 API calls, maps 10 files (3,058 tokens), sees signatures of all 10:
|
|
18
|
+
```
|
|
19
|
+
ghx read shadcn-ui/ui packages/shadcn/src/utils → directory listing (199 tokens)
|
|
20
|
+
ghx read shadcn-ui/ui "packages/shadcn/src/utils/*.ts" --map → signatures of 10 files (2,859 tokens)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Same token budget. The `gh` agent read 3 full files. The ghx agent saw the structure of 10 — imports, exports, function signatures — and knows which ones to drill into. Pass a file, get content. Pass a directory, get a listing. Pass a glob, get matching files. Same command, always useful output.
|
|
10
24
|
|
|
11
25
|
| Tool | Files per call | Matching context | Programmable | Dependencies |
|
|
12
26
|
|------|---------------|-----------------|-------------|-------------|
|
|
@@ -56,6 +70,7 @@ No install step — npx downloads and caches the binary on first run.
|
|
|
56
70
|
ghx explore <owner/repo> # Branch + tree + README in 1 API call
|
|
57
71
|
ghx explore <owner/repo> <path> # Subdirectory listing
|
|
58
72
|
ghx read <owner/repo> <f1> [f2] [f3] # Read 1-10 files (GraphQL batching)
|
|
73
|
+
ghx read <owner/repo> <dir> # Directory path → returns file listing
|
|
59
74
|
ghx read <owner/repo> "src/**/*.ts" --map # Glob patterns with structural map
|
|
60
75
|
ghx read <owner/repo> --map <f1> [f2] # Signatures, imports, types (~92% token reduction)
|
|
61
76
|
ghx read <owner/repo> --grep "pat" <f> # Matching lines only (ERE regex, 2 lines context)
|
|
@@ -114,11 +129,11 @@ Designed for eager context injection via spawn hooks — the agent always has th
|
|
|
114
129
|
|
|
115
130
|
## How It Was Built
|
|
116
131
|
|
|
117
|
-
23 agent sessions, 2,500+ conversation turns, 3 rewrites,
|
|
132
|
+
23 agent sessions, 2,500+ conversation turns, 3 rewrites, 12 ADRs. The full story: **[Build the GitHub Exploration Tool, No Mistakes](https://gkoreli.com/how-ghx-was-born)**
|
|
118
133
|
|
|
119
134
|
## How It Works
|
|
120
135
|
|
|
121
|
-
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. 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.
|
|
136
|
+
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.
|
|
122
137
|
|
|
123
138
|
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.
|
|
124
139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gkoreli/ghx",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.13",
|
|
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.
|
|
31
|
-
"@gkoreli/ghx-darwin-x64": "2.1.
|
|
32
|
-
"@gkoreli/ghx-linux-arm64": "2.1.
|
|
33
|
-
"@gkoreli/ghx-linux-x64": "2.1.
|
|
34
|
-
"@gkoreli/ghx-win32-arm64": "2.1.
|
|
35
|
-
"@gkoreli/ghx-win32-x64": "2.1.
|
|
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"
|
|
36
36
|
}
|
|
37
37
|
}
|