@gkoreli/ghx 0.1.0 → 0.1.1

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 (3) hide show
  1. package/README.md +18 -18
  2. package/{ggcode → ghx} +15 -15
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ggcode
1
+ # ghx
2
2
 
3
3
  GitHub code exploration for agents and humans. One command does what takes 3-5 API calls with any other tool.
4
4
 
@@ -13,19 +13,19 @@ GitHub code exploration for agents and humans. One command does what takes 3-5 A
13
13
 
14
14
  ```bash
15
15
  # Homebrew (macOS/Linux)
16
- brew install gkoreli/tap/ggcode
16
+ brew install gkoreli/tap/ghx
17
17
 
18
- # gh extension (coming soon — requires separate gh-ggcode repo)
19
- gh extension install gkoreli/gh-ggcode
18
+ # gh extension (coming soon — requires separate gh-ghx repo)
19
+ gh extension install gkoreli/gh-ghx
20
20
 
21
21
  # npx (zero install)
22
- npx ggcode --help
22
+ npx @gkoreli/ghx --help
23
23
 
24
24
  # curl
25
- curl -sf https://raw.githubusercontent.com/gkoreli/ggcode/main/install.sh | sh
25
+ curl -sf https://raw.githubusercontent.com/gkoreli/ghx/main/install.sh | sh
26
26
 
27
27
  # Manual — just copy the script
28
- curl -sf https://raw.githubusercontent.com/gkoreli/ggcode/main/ggcode -o ~/.local/bin/ggcode && chmod +x ~/.local/bin/ggcode
28
+ curl -sf https://raw.githubusercontent.com/gkoreli/ghx/main/ghx -o ~/.local/bin/ghx && chmod +x ~/.local/bin/ghx
29
29
  ```
30
30
 
31
31
  Requires [`gh` CLI](https://cli.github.com/) authenticated (`gh auth login`).
@@ -34,26 +34,26 @@ Requires [`gh` CLI](https://cli.github.com/) authenticated (`gh auth login`).
34
34
 
35
35
  ```bash
36
36
  # Explore a repo — branch, file tree, and README in 1 API call
37
- ggcode explore plausible/analytics
37
+ ghx explore plausible/analytics
38
38
 
39
39
  # Read multiple files in 1 API call
40
- ggcode read plausible/analytics mix.exs assets/js/dashboard/stats/bar.js
40
+ ghx read plausible/analytics mix.exs assets/js/dashboard/stats/bar.js
41
41
 
42
42
  # Code map — signatures, imports, types only (~92% token reduction)
43
- ggcode read plausible/analytics --map lib/plausible/stats/query.ex
43
+ ghx read plausible/analytics --map lib/plausible/stats/query.ex
44
44
 
45
45
  # Grep within a remote file (2 lines context)
46
- ggcode read plausible/analytics --grep "defmodule" lib/plausible/stats/query.ex
46
+ ghx read plausible/analytics --grep "defmodule" lib/plausible/stats/query.ex
47
47
 
48
48
  # Read specific line range
49
- ggcode read plausible/analytics --lines 42-80 lib/plausible/stats/query.ex
49
+ ghx read plausible/analytics --lines 42-80 lib/plausible/stats/query.ex
50
50
 
51
51
  # Search code (full GitHub search syntax)
52
- ggcode search "useState repo:facebook/react"
53
- ggcode search "path:llms.txt extension:txt"
52
+ ghx search "useState repo:facebook/react"
53
+ ghx search "path:llms.txt extension:txt"
54
54
 
55
55
  # Full recursive tree
56
- ggcode tree plausible/analytics assets/js
56
+ ghx tree plausible/analytics assets/js
57
57
  ```
58
58
 
59
59
  ## Why
@@ -66,9 +66,9 @@ AI agents exploring GitHub repos face a tooling gap:
66
66
  | Octocode MCP | 1 (parallel) | ~10K tokens | npm + Docker |
67
67
  | Raw `gh` CLI | 1 | 0 | `gh` |
68
68
  | Gitingest | N (clones first) | 0 | pip + tiktoken |
69
- | **ggcode** | **1-10 (GraphQL batch)** | **0** | **`gh`** |
69
+ | **ghx** | **1-10 (GraphQL batch)** | **0** | **`gh`** |
70
70
 
71
- `ggcode` reads 10 files in 1 API call. No other tool does this.
71
+ `ghx` reads 10 files in 1 API call. No other tool does this.
72
72
 
73
73
  ## Code Map (`--map`)
74
74
 
@@ -88,7 +88,7 @@ Supported: TypeScript/JavaScript, Python, Go, Rust, Java/Kotlin, Ruby. Falls bac
88
88
 
89
89
  ## How It Works
90
90
 
91
- `ggcode` wraps `gh` CLI with GraphQL batching. The `explore` command fetches tree + README in 1 GraphQL call. The `read` command uses GraphQL aliases (`f0:`, `f1:`, ...) to fetch up to 10 files in 1 call. The `search` command hits the REST `/search/code` endpoint directly (GraphQL has no code search).
91
+ `ghx` wraps `gh` CLI with GraphQL batching. The `explore` command fetches tree + README in 1 GraphQL call. The `read` command uses GraphQL aliases (`f0:`, `f1:`, ...) to fetch up to 10 files in 1 call. The `search` command hits the REST `/search/code` endpoint directly (GraphQL has no code search).
92
92
 
93
93
  The `--map` flag applies per-language regex patterns to extract structural declarations from the fetched content. No Tree-sitter, no AST parsing — just regex on the first line of each declaration. This works because structural declarations in most languages start at the beginning of a line with a keyword (`function`, `class`, `def`, `func`, `export`, `import`, etc.).
94
94
 
package/{ggcode → ghx} RENAMED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # ggcode — GitHub code exploration for agents and humans
2
+ # ghx — GitHub code exploration for agents and humans
3
3
  # Efficient GitHub repo exploration via GraphQL batching, code maps, and targeted extraction.
4
4
  # One command does what takes 3-5 API calls with any other tool.
5
5
 
@@ -78,7 +78,7 @@ read)
78
78
  done
79
79
 
80
80
  if [[ ${#files[@]} -eq 0 ]]; then
81
- echo "Usage: ggcode read <owner/repo> <path1> [path2] [--grep pattern] [--lines N-M]" >&2
81
+ echo "Usage: ghx read <owner/repo> <path1> [path2] [--grep pattern] [--lines N-M]" >&2
82
82
  exit 1
83
83
  fi
84
84
 
@@ -136,7 +136,7 @@ read)
136
136
  search)
137
137
  query="$*"
138
138
  if [[ -z "$query" ]]; then
139
- echo "Usage: ggcode search <query>" >&2
139
+ echo "Usage: ghx search <query>" >&2
140
140
  echo "Query syntax: 'term1 term2 repo:owner/repo' (AND), 'term1 OR term2 repo:owner/repo'" >&2
141
141
  echo "Filters: path:src/ extension:tsx language:typescript" >&2
142
142
  exit 1
@@ -166,26 +166,26 @@ tree)
166
166
  # ─── help ───
167
167
  help|*)
168
168
  cat <<'EOF'
169
- ggcode — GitHub code exploration for agents and humans
169
+ ghx — GitHub code exploration for agents and humans
170
170
 
171
171
  Commands:
172
- ggcode explore <owner/repo> [path] Branch + tree + README in 1 API call
173
- ggcode read <owner/repo> <f1> [f2..] Read 1-10 files in 1 API call
174
- ggcode search <query> Code search (full syntax: AND, OR, path:, extension:, language:)
175
- ggcode tree <owner/repo> [path] Full recursive tree listing
172
+ ghx explore <owner/repo> [path] Branch + tree + README in 1 API call
173
+ ghx read <owner/repo> <f1> [f2..] Read 1-10 files in 1 API call
174
+ ghx search <query> Code search (full syntax: AND, OR, path:, extension:, language:)
175
+ ghx tree <owner/repo> [path] Full recursive tree listing
176
176
 
177
177
  Read flags:
178
178
  --grep <pattern> Filter output to matching lines (case-insensitive, 2 lines context)
179
179
  --lines <N-M> Extract specific line range
180
180
 
181
181
  Examples:
182
- ggcode explore plausible/analytics
183
- ggcode read plausible/analytics mix.exs assets/js/dashboard/stats/bar.js
184
- ggcode read plausible/analytics src/app.ts --grep "useState"
185
- ggcode read plausible/analytics src/app.ts --lines 42-80
186
- ggcode search "useState repo:plausible/analytics"
187
- ggcode search "bar OR percentage repo:plausible/analytics"
188
- ggcode tree plausible/analytics assets/js
182
+ ghx explore plausible/analytics
183
+ ghx read plausible/analytics mix.exs assets/js/dashboard/stats/bar.js
184
+ ghx read plausible/analytics src/app.ts --grep "useState"
185
+ ghx read plausible/analytics src/app.ts --lines 42-80
186
+ ghx search "useState repo:plausible/analytics"
187
+ ghx search "bar OR percentage repo:plausible/analytics"
188
+ ghx tree plausible/analytics assets/js
189
189
  EOF
190
190
  ;;
191
191
 
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@gkoreli/ghx",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "GitHub code exploration for agents and humans. Batch file reads, code maps, search — all via gh CLI.",
5
5
  "bin": {
6
- "ghx": "./ggcode"
6
+ "ghx": "./ghx"
7
7
  },
8
8
  "keywords": ["github", "cli", "code-exploration", "agent", "graphql", "code-map"],
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/gkoreli/ggcode"
12
+ "url": "https://github.com/gkoreli/ghx"
13
13
  },
14
- "files": ["ggcode", "README.md", "LICENSE"],
14
+ "files": ["ghx", "README.md", "LICENSE"],
15
15
  "os": ["darwin", "linux"],
16
16
  "engines": {
17
17
  "node": ">=16"