cli

package
v2.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Ask progress streaming (ADR-0040 L2): while a `ghx sidecar ask` turn runs (40–106s), the caller previously saw nothing until the full report landed. The session's live.jsonl (ADR-0022.1) already carries turn activity as it happens — this file tails it and renders compact progress lines on STDERR, so first useful evidence is visible within seconds instead of after the whole turn. STDOUT stays reserved for the final report / --json envelope (ADR-0019.3 D2: streaming is human decoration only; machine surfaces are untouched).

Rendering rules (docs/research/006-l2-streaming-ux-states.md):

  • one scannable line per event, newest-wins; repeats of an identical line collapse (the FRICTION.md ~48×`(pending)` pathology cannot recur);
  • pending tool updates render nothing — they carry no new information beyond the tool.call line already shown;
  • a >3s event gap derives ONE static "thinking…" / "synthesizing… (N sources so far)" line — never a fabricated activity name;
  • non-TTY stderr gets the same information without glyphs, behind a "# " prefix scripting agents can grep.

Index

Constants

View Source
const (
	// ExitOK is returned by successful commands.
	ExitOK = 0
	// ExitNoResults means the command ran correctly but found no matching data.
	ExitNoResults = 1
	// ExitBadInvocation means arguments or flags were invalid.
	ExitBadInvocation = 2
	// ExitUpstreamFailure means GitHub, gh auth, or another upstream dependency failed.
	ExitUpstreamFailure = 3
)

Variables

View Source
var MCPSkillMD string
View Source
var ReconSkillMD string
View Source
var RootCmd = &cobra.Command{
	Use:   "ghx",
	Short: "GitHub code exploration for agents and humans",
	Long: `ghx — GitHub code exploration for agents and humans

Exit codes:
  0  ok
  1  no results
  2  bad invocation
  3  upstream/API failure`,
	Version: VERSION,
	Example: `  ghx --version
  ghx explore gkoreli/ghx
  ghx read gkoreli/ghx cmd/ghx/main.go --lines 1-40`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			cmd.Help()
		}
	},
}
View Source
var SkillMD string
View Source
var VERSION = "dev"

Functions

func CodeForError added in v2.3.0

func CodeForError(err error) int

CodeForError returns the semantic exit code for err. A CLI ExitError set by a handler wins (it is the deliberate, final mapping); otherwise the FailureClass a core ghx.Error carries is honored; an unclassified error is a bad invocation.

func WithExitCode added in v2.3.0

func WithExitCode(code int, err error) error

WithExitCode marks err with the semantic CLI exit code.

Types

type ExitError added in v2.3.0

type ExitError struct {
	Code int
	Err  error
}

ExitError carries the process exit code for a CLI failure.

func (*ExitError) Error added in v2.3.0

func (e *ExitError) Error() string

Error returns the wrapped error text.

func (*ExitError) Unwrap added in v2.3.0

func (e *ExitError) Unwrap() error

Unwrap returns the wrapped error.

type HTTPTransport

type HTTPTransport struct {
	Address string
}

HTTPTransport implements Transport for streamable HTTP communication

func (*HTTPTransport) Serve

func (t *HTTPTransport) Serve(s *server.MCPServer) error

type StdioTransport

type StdioTransport struct{}

StdioTransport implements Transport for stdio communication

func (*StdioTransport) Serve

func (t *StdioTransport) Serve(s *server.MCPServer) error

type Transport

type Transport interface {
	Serve(s *server.MCPServer) error
}

Transport defines the interface for MCP server transports

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL