@gkoreli/ghx 2.4.1 → 2.5.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.
Files changed (2) hide show
  1. package/README.md +100 -12
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -68,8 +68,16 @@ you can `ls` and `jq`:
68
68
  logs.jsonl # GenAI-convention message-content records
69
69
  metrics.jsonl # duration, token, report-size metrics
70
70
  tier-decisions.jsonl # escalation policy evaluation per turn (which tier, why)
71
+ live.jsonl # realtime turn activity, appended as it happens
71
72
  ```
72
73
 
74
+ The OTLP artifacts are written when a question completes; `live.jsonl` streams
75
+ turn activity in realtime — turn start/end, text and thought chunks, every tool
76
+ call and update as the agent works — so
77
+ `tail -f ~/.ghx/sessions/<name>/live.jsonl` watches a running question instead
78
+ of waiting minutes for the final report
79
+ (see [ADR-0022.1](docs/adr/0022.1-live-turn-log.md)).
80
+
73
81
  Sessions persist, so follow-up questions on the same repo are cheaper and
74
82
  context-aware. The traces are **official OpenTelemetry** (OTLP/JSON, GenAI
75
83
  semantic conventions) — any industry tool consumes them in seconds, and
@@ -146,26 +154,78 @@ go install github.com/gkoreli/ghx/v2/cmd/ghx@latest
146
154
  The sidecar drives an ACP-capable agent under the hood, and it reads GitHub
147
155
  through the authenticated [gh CLI](https://cli.github.com/) (`gh auth login`).
148
156
 
149
- ### 2. Configure the agent
157
+ ### 2. Configure the agent (optional — zero-config works)
150
158
 
151
159
  The sidecar speaks [Agent Client Protocol (ACP)](https://agentclientprotocol.com)
152
- to its underlying model. One command writes a working config using the
160
+ to its underlying model. **With no config at all, the pinned
153
161
  [claude-agent-acp](https://www.npmjs.com/package/@agentclientprotocol/claude-agent-acp)
154
- adapter:
162
+ adapter is the default** — if you have Node/npx and are logged into Claude Code,
163
+ `ghx sidecar ask` works out of the box. Write an explicit config only to pin a
164
+ different agent or model:
155
165
 
156
166
  ```bash
157
167
  ghx sidecar config init --claude-acp # writes ~/.ghx/config.json with the ACP adapter
158
168
  ```
159
169
 
160
- > Setup is the hardest step, so this is designed to be one command. Without
161
- > `--claude-acp`, `config init` auto-detects any ACP-capable agent already on
162
- > your PATH; a bare `claude` binary does **not** speak ACP on stdio and is
163
- > rejected on purpose (it would hang every turn — see
170
+ > Without `--claude-acp`, `config init` auto-detects any ACP-capable agent
171
+ > already on your PATH; a bare `claude` binary does **not** speak ACP on stdio
172
+ > and is rejected on purpose (it would hang every turn see
164
173
  > [ADR-0019](docs/adr/0019-sidecar-adoption-zero-cli-surface.md) D4).
165
174
 
166
175
  Re-running `config init --claude-acp` against an existing config shows a field
167
176
  diff and refuses to overwrite without `--force`.
168
177
 
178
+ **Using your installed Claude Code (toolbox / wrapper builds).** The adapter's
179
+ SDK ships its own bundled Claude Code binary and its own credential store — by
180
+ default your `claude` on PATH (and its `~/.claude/settings.json`, credential
181
+ hooks, model aliases) is **not** what runs. If your organization installs a
182
+ wrapped `claude` that carries work credentials, point the adapter at it with
183
+ `CLAUDE_CODE_EXECUTABLE` (honored by `claude-agent-acp` ≥ 0.55):
184
+
185
+ ```json
186
+ {
187
+ "agent": "env CLAUDE_CODE_EXECUTABLE=/path/to/your/claude npx -y @agentclientprotocol/claude-agent-acp@0.55.0"
188
+ }
189
+ ```
190
+
191
+ `ghx sidecar config init --claude-exe /path/to/your/claude` writes exactly this
192
+ config for you (`--claude-exe auto` resolves `claude` from your PATH; the same
193
+ diff-and-`--force` rules apply).
194
+
195
+ > **Known upstream issue (enterprise wrapper builds):** when
196
+ > `CLAUDE_CODE_EXECUTABLE` points at a *wrapper* script/binary (e.g. a
197
+ > corporate toolbox `claude` that resolves credentials itself), the adapter
198
+ > can hang indefinitely at prompt time: ghx legitimately sends ACP
199
+ > `settingSources: []` for session isolation, and some wrappers stall instead
200
+ > of erroring when settings loading is suppressed (isolated 2026-07-06:
201
+ > `settingSources: []` alone reproduces the hang; `strictMcpConfig` and
202
+ > `tools` do not; mechanism: the native binary resolves Bedrock
203
+ > `modelOverrides` from `~/.claude/settings.json` and stalls instead of
204
+ > erroring when that read is suppressed). The fix is one config line:
205
+ >
206
+ > ```json
207
+ > {
208
+ > "agent": "env CLAUDE_CODE_EXECUTABLE=/path/to/your/claude npx -y @agentclientprotocol/claude-agent-acp@0.55.0",
209
+ > "agentSettingSources": ["user"]
210
+ > }
211
+ > ```
212
+ >
213
+ > `agentSettingSources` opts the spawned agent into loading your user
214
+ > settings (`~/.claude/settings.json`) so the wrapper's model aliases and
215
+ > credential hooks work. It deliberately weakens session isolation — host
216
+ > user settings apply to sidecar sessions — which is why it is opt-in and
217
+ > off by default (ADR-0033.2). Wrapping the *adapter* in a script that
218
+ > exports auth env itself remains a valid alternative.
219
+
220
+ Embedding `env VAR=...` in the agent command makes the setting travel with the
221
+ command itself, so it works no matter which process (CLI or resident daemon)
222
+ spawns the agent. Exporting `CLAUDE_CODE_EXECUTABLE` in your shell also works:
223
+ every ask forwards auth-relevant env to the agent
224
+ ([ADR-0033.1](docs/adr/0033.1-client-auth-env-passthrough.md)), and the same
225
+ applies to Bedrock/Vertex/gateway env (`CLAUDE_CODE_USE_BEDROCK`, `AWS_*`,
226
+ `ANTHROPIC_BASE_URL`, ...). `ghx sidecar doctor` shows exactly which names your
227
+ shell would forward.
228
+
169
229
  ### 3. Verify
170
230
 
171
231
  ```bash
@@ -267,7 +327,7 @@ A main agent talks to the sidecar through a single MCP tool — one tool it cann
267
327
  be tempted into step-driving:
268
328
 
269
329
  ```bash
270
- ghx serve --recon # exposes exactly one MCP tool: recon(question, repo, session?)
330
+ ghx serve --recon # exposes exactly one MCP tool: recon(question, repo?, session?)
271
331
  ```
272
332
 
273
333
  The recommended skill for agents is the concise recon skill (`ghx skill --recon`,
@@ -319,7 +379,7 @@ matching files. Same command, always useful output.
319
379
  ### Commands
320
380
 
321
381
  ```bash
322
- ghx --version # Health check / installed version
382
+ ghx --version # Health check / installed version (also: ghx version)
323
383
  ghx explore <owner/repo> # Compact branch + tree + README orientation
324
384
  ghx explore <owner/repo> --full # Complete legacy explore output
325
385
  ghx explore <owner/repo> <path> # Compact subdirectory listing
@@ -338,11 +398,36 @@ ghx search <owner/repo> "func main" # Repo-first code search, auto-quote
338
398
  ghx search <owner/repo> "router" --lang go # Narrow by language
339
399
  ghx search <owner/repo> "router" --glob "**/*.go" # Narrow by path glob
340
400
  ghx search "repo:gkoreli/ghx cobra.Command" # Advanced raw GitHub code-search query
401
+ ghx inspect <owner/repo> "routing middleware" # Concern-driven search + ranked files, maps, snippets
341
402
  ghx grep <owner/repo> "func main" # Grep-like repo search
342
403
  ghx grep <owner/repo> "RunE" --path internal/cli --limit 10
343
404
  ghx repos "<query>" # Repo search with README preview
344
405
  ghx tree <owner/repo> [path] # Full recursive tree
345
406
  ghx tree <owner/repo> [path] --depth N # Tree limited to N levels
407
+ ghx code "<js>" # Execute JS with access to all ghx tools
408
+ ghx code --list # List available tools with type stubs
409
+ ghx serve # Start the direct-tools MCP server (stdio)
410
+ ghx serve --http :8080 # Serve MCP over streamable HTTP
411
+ ghx serve --recon # Start the single-tool recon MCP service
412
+ ghx skill # Print the classic CLI skill
413
+ ghx skill --mcp # Print the classic MCP skill
414
+ ghx skill --recon # Print the concise recon skill
415
+ ghx sidecar config init --claude-acp # Write ~/.ghx/config.json for Claude ACP
416
+ ghx sidecar config show # Show resolved sidecar config
417
+ ghx sidecar doctor # Verify token, network, ghx binary, ACP, report sink
418
+ ghx sidecar doctor --live # Run a real one-prompt ACP turn for diagnosis
419
+ ghx sidecar ask --repo <owner/repo> "<q>" # Delegate one repo question to the sidecar
420
+ ghx sidecar ask "<q>" # Discovery question across GitHub
421
+ ghx sidecar ask --repo <o/r> --local "<q>" # Also allow tier-2 local analysis (codemap/ast-grep/repomap)
422
+ ghx sidecar daemon --status # Inspect the warm sidecar daemon
423
+ ghx sidecar daemon --stop # Stop the warm sidecar daemon
424
+ ghx sidecar sessions list # List persisted sidecar sessions
425
+ ghx sidecar sessions show <session> # Metadata + report history
426
+ ghx sidecar sessions ledger <session> # Accumulated evidence ledger JSON
427
+ ghx sidecar sessions reroute <s> <turn> <dest> # Move a mis-routed turn and rebuild ledgers
428
+ ghx sidecar view [session] # Local OTel viewer over session artifacts
429
+ ghx sidecar evals export --format sft --run <dir> --out <file> # Export committed eval episodes
430
+ ghx sidecar report-sink --out <path> # Internal report-sink MCP server used by ACP turns
346
431
  ghx tier2 codemap <owner/repo> # Tier-2 cross-file structure as JSON (local snapshot)
347
432
  ghx tier2 codemap <owner/repo> --context # Agent-ready JSON context envelope (--compact to shrink)
348
433
  ghx tier2 codemap <owner/repo> --importers <file> # Who imports a file (fan-in; needs ast-grep)
@@ -379,9 +464,12 @@ the binary codemap needs for `--importers`/`--deps`), and `local:repomap`
379
464
  stolen with attribution from
380
465
  [aider's repo map](https://github.com/Aider-AI/aider), Apache-2.0 — an
381
466
  algorithm, not a dependency; deterministic given the same snapshot and
382
- query). If a tool binary is missing, ghx prints the install hint and exits
383
- before any clone; answers fall back to remote Tier-1 evidence — never a
384
- silent or faked Tier-2 result. `astgrep` follows grep parity: exit `1` with
467
+ query). Only `local:repomap` works with zero extra installs; codemap and
468
+ ast-grep are optional external binaries, and `ghx sidecar doctor` reports
469
+ which tier-2 backends resolve on your machine with install hints for the
470
+ missing ones. If a tool binary is missing, ghx prints the install hint and
471
+ exits before any clone; answers fall back to remote Tier-1 evidence — never
472
+ a silent or faked Tier-2 result. `astgrep` follows grep parity: exit `1` with
385
473
  `[]` means the search ran and found nothing.
386
474
 
387
475
  When the sidecar answers a question, escalation is never vibes: every turn
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkoreli/ghx",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
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"
@@ -28,11 +28,11 @@
28
28
  "node": ">=16"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@gkoreli/ghx-darwin-arm64": "2.4.1",
32
- "@gkoreli/ghx-darwin-x64": "2.4.1",
33
- "@gkoreli/ghx-linux-arm64": "2.4.1",
34
- "@gkoreli/ghx-linux-x64": "2.4.1",
35
- "@gkoreli/ghx-win32-arm64": "2.4.1",
36
- "@gkoreli/ghx-win32-x64": "2.4.1"
31
+ "@gkoreli/ghx-darwin-arm64": "2.5.0",
32
+ "@gkoreli/ghx-darwin-x64": "2.5.0",
33
+ "@gkoreli/ghx-linux-arm64": "2.5.0",
34
+ "@gkoreli/ghx-linux-x64": "2.5.0",
35
+ "@gkoreli/ghx-win32-arm64": "2.5.0",
36
+ "@gkoreli/ghx-win32-x64": "2.5.0"
37
37
  }
38
38
  }